]> sigrok.org Git - libsigrok.git/blobdiff - configure.ac
configure: Enable largefile support on 32-bit systems
[libsigrok.git] / configure.ac
index 3579650f8f671096bba30fae034bdc8f8805f5a8..b4a4332eae15f01932c649a693a790af3f3f490b 100644 (file)
@@ -30,7 +30,7 @@ AC_CONFIG_HEADERS([config.h include/libsigrok/version.h])
 
 # We require at least automake 1.11 (needed for 'silent rules').
 AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define nostdinc subdir-objects check-news color-tests])
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+AM_SILENT_RULES([yes])
 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 
 AH_TOP([#ifndef SR_CONFIG_H
@@ -39,7 +39,6 @@ AH_BOTTOM([#endif /* SR_CONFIG_H */])
 
 # Checks for programs.
 AC_PROG_CC
-AC_PROG_CPP
 AC_PROG_CXX
 AC_PROG_INSTALL
 AC_PROG_LN_S
@@ -74,7 +73,7 @@ SR_PKG_CHECK_SUMMARY([sr_pkglibs_summary])
 # These are used to derive the compiler flags and for the "Requires.private"
 # field in the generated libsigrok.pc file.
 SR_VAR_OPT_PKG([SR_PKGLIBS], [sr_deps_avail])
-SR_PKGLIBS_CHECK=
+SR_PKGLIBS_TESTS=
 SR_PKGLIBS_CXX=
 SR_PKGLIBS_PYTHON=
 
@@ -82,7 +81,7 @@ SR_ARG_OPT_PKG([libserialport], [LIBSERIALPORT], [NEED_SERIAL],
        [libserialport >= 0.1.1])
 
 SR_ARG_OPT_PKG([libftdi], [LIBFTDI],,
-       [libftdi >= 0.16], [libftdi1 >= 1.0])
+       [libftdi1 >= 1.0], [libftdi >= 0.16])
 
 # FreeBSD comes with an "integrated" libusb-1.0-style USB API.
 # This means libusb-1.0 is always available; no need to check for it.
@@ -102,26 +101,33 @@ SR_ARG_OPT_PKG([libgpib], [LIBGPIB], [NEED_GPIB],
 ######################
 
 # The Check unit testing framework is optional. Disable if not found.
-SR_PKG_CHECK([check], [SR_PKGLIBS_CHECK], [check >= 0.9.4])
+SR_PKG_CHECK([check], [SR_PKGLIBS_TESTS], [check >= 0.9.4])
 AM_CONDITIONAL([HAVE_CHECK], [test "x$sr_have_check" = xyes])
 
 AC_LANG([C])
 
-# Enable the C11 standard if possible, and enforce the use
+# Enable the C99 standard if possible, and enforce the use
 # of SR_API to explicitly mark all public API functions.
 SR_EXTRA_CFLAGS=
-SR_CHECK_COMPILE_FLAGS([SR_EXTRA_CFLAGS], [C11], [-std=gnu11 -std=c11])
+SR_CHECK_COMPILE_FLAGS([SR_EXTRA_CFLAGS], [C99], [-std=c99 -c99 -AC99 -qlanglvl=extc99])
 SR_CHECK_COMPILE_FLAGS([SR_EXTRA_CFLAGS], [visibility], [-fvisibility=hidden])
 
 SR_ARG_ENABLE_WARNINGS([SR_WFLAGS], [-Wall], [-Wall -Wextra -Wmissing-prototypes])
 
 # Check host characteristics.
+AC_SYS_LARGEFILE
 AC_C_BIGENDIAN
 
 AC_CHECK_HEADERS([sys/mman.h], [SR_APPEND([sr_deps_avail], [sys_mman_h])])
 AC_CHECK_HEADERS([sys/ioctl.h], [SR_APPEND([sr_deps_avail], [sys_ioctl_h])])
 AC_CHECK_HEADERS([sys/timerfd.h], [SR_APPEND([sr_deps_avail], [sys_timerfd_h])])
 
+# We need to link against the Winsock2 library for SCPI over TCP.
+AS_CASE([$host], [*-mingw*], [SR_EXTRA_LIBS='-lws2_32'], [SR_EXTRA_LIBS=])
+
+# libm (the standard math library) is always needed.
+SR_SEARCH_LIBS([SR_EXTRA_LIBS], [pow], [m])
+
 # RPC is only needed for VXI support.
 AC_CACHE_CHECK([for RPC support], [sr_cv_have_rpc],
        [AC_LINK_IFELSE([AC_LANG_PROGRAM(
@@ -149,6 +155,7 @@ sr_check_driver_deps() {
                AS_CASE([" $sr_deps_avail "], [*" $sr_dep "*],,
                        [SR_APPEND([sr_deps_missing], [', '], [$sr_dep])])
        done
+       test -z "$sr_deps_missing" || return 1
 }
 
 AC_ARG_ENABLE([all-drivers],
@@ -163,9 +170,8 @@ m4_define([_SR_DRIVER], [
                [$3=$enableval], [$3=$enable_all_drivers])
 
        AS_IF([test "x[$]$3" = xyes], [sr_hw_info=yes[]m4_ifval([$4], [
-               sr_check_driver_deps $4
-               AS_IF([test -n "$sr_deps_missing"],
-                       [$3=no sr_hw_info="no (missing: $sr_deps_missing)"])
+               sr_check_driver_deps $4 \
+                       || $3=no sr_hw_info="no (missing: $sr_deps_missing)"
        ])], [sr_hw_info='no (disabled)'])
        sr_driver_summary_append "$2" "$sr_hw_info"
 
@@ -200,6 +206,7 @@ SR_DRIVER([Hantek DSO], [hantek-dso], [libusb])
 SR_DRIVER([Ikalogic Scanalogic-2], [ikalogic-scanalogic2], [libusb])
 SR_DRIVER([Ikalogic Scanaplus], [ikalogic-scanaplus], [libftdi])
 SR_DRIVER([Kecheng KC-330B], [kecheng-kc-330b], [libusb])
+SR_DRIVER([KERN scale], [kern-scale], [libserialport])
 SR_DRIVER([Lascar EL-USB], [lascar-el-usb], [libusb])
 SR_DRIVER([Manson HCS-3xxx], [manson-hcs-3xxx], [libserialport])
 SR_DRIVER([maynuo-m97], [maynuo-m97])
@@ -252,9 +259,7 @@ AC_ARG_ENABLE([java],
 sr_cxx_missing=
 
 # Check if the C++ compiler supports the C++11 standard.
-m4_ifdef([AX_CXX_COMPILE_STDCXX_11],
-       [AX_CXX_COMPILE_STDCXX_11(, [optional])],
-       [m4_warn([unsupported], [Missing macro AX_CXX_COMPILE_STDCXX_11: no C++11 check possible])])
+AX_CXX_COMPILE_STDCXX_11([noext], [optional])
 AS_IF([test "x$HAVE_CXX11" != x1],
        [SR_APPEND([sr_cxx_missing], [', '], ['C++11'])])
 
@@ -323,7 +328,7 @@ AS_IF([test "x$HAVE_PYMOD_SETUPTOOLS" != xyes],
        [SR_APPEND([sr_python_missing], [', '], [setuptools])])
 
 # The Python bindings use SWIG to generate code.
-AC_CHECK_PROGS([SWIG], [swig swig2.0 swig3.0])
+AC_CHECK_PROGS([SWIG], [swig swig3.0 swig2.0])
 AS_IF([test "x$SWIG" = x],
        [SR_APPEND([sr_python_missing], [', '], [SWIG])])
 
@@ -392,7 +397,7 @@ AC_SUBST([SR_PKGLIBS])
 # Retrieve the compile and link flags for all modules combined.
 # Also, bail out at this point if any module dependency is not met.
 PKG_CHECK_MODULES([LIBSIGROK], [glib-2.0 >= 2.32.0 $SR_PKGLIBS])
-PKG_CHECK_MODULES([CHECK], [$SR_PKGLIBS_CHECK glib-2.0 $SR_PKGLIBS])
+PKG_CHECK_MODULES([TESTS], [$SR_PKGLIBS_TESTS glib-2.0 $SR_PKGLIBS])
 
 # SR_PKGLIBS_CXX may be empty, so only invoke these checks when
 # the C++ bindings are enabled.
@@ -408,18 +413,6 @@ AC_DEFINE_UNQUOTED([CONF_LIBZIP_VERSION], ["$sr_libzip_version"],
 AC_DEFINE_UNQUOTED([CONF_HOST], ["$host"],
        [The canonical host libsigrok will run on.])
 
-AC_LANG([C])
-
-# libm (the standard math library) is always needed.
-AC_SEARCH_LIBS([pow], [m])
-
-# We need to link against the Winsock2 library for SCPI over TCP.
-AS_CASE([$host], [*mingw*], [LIBS="$LIBS -lws2_32"])
-
-AC_SUBST([FIRMWARE_DIR], ['$(datadir)/sigrok-firmware'])
-AC_SUBST([MAKEFLAGS], ['--no-print-directory'])
-AC_SUBST([AM_LIBTOOLFLAGS], ['--silent'])
-
 AC_CONFIG_FILES([Makefile libsigrok.pc bindings/cxx/libsigrokcxx.pc])
 
 AC_OUTPUT