-# The C++ bindings use Doxygen to parse libsigrok symbols.
-AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [yes])
-if test "x$HAVE_DOXYGEN" != "xyes"; then
- BINDINGS_CXX="no"; cxx_msg="Doxygen required"
-fi
-
-# Python is needed for the C++ bindings.
-AC_CHECK_PROG([HAVE_PYTHON], [python], [yes])
-if test "x$HAVE_PYTHON" != "xyes"; then
- BINDINGS_CXX="no"; cxx_msg="Python required"
-fi
-
-# The Python bindings need Python development files.
-PKG_CHECK_MODULES([python], [python >= 2.7],
- [CXXFLAGS="$CXXFLAGS $python_CFLAGS";
- CXXLIBS="$CXXLIBS $python_LIBS"],
-[PKG_CHECK_MODULES([python27], [python-2.7 >= 2.7],
- [CXXFLAGS="$CXXFLAGS $python27_CFLAGS";
- CXXLIBS="$CXXLIBS $python27_LIBS"],
- [BINDINGS_PYTHON="no"; python_msg="Python headers required"])])
-
-# The Python bindings need the setuptools Python module.
-m4_ifdef([AX_PYTHON_MODULE], [AX_PYTHON_MODULE([setuptools])],
- # We'll let it go through even if the macro wasn't found, the Python
- # module may still be there.
- [HAVE_PYTHON_SETUPTOOLS="yes";
- AC_MSG_NOTICE([Missing macro m4_toupper(aX_PYTHON_MODULE), no setuptools check])]
-)
-if test "x$HAVE_PYMOD_SETUPTOOLS" != "xyes"; then
- BINDINGS_PYTHON="no"; python_msg="Python setuptools module required"
-fi
-
-# The Python and Java bindings use SWIG to generate code.
-AC_CHECK_PROG([HAVE_SWIG], [swig], [yes])
-if test "x$HAVE_SWIG" != "xyes"; then
- BINDINGS_PYTHON="no"; python_msg="SWIG required"
- BINDINGS_JAVA="no"; java_msg="SWIG required"
-fi
-
-# Checks for libraries.
-
-case "$host" in
-*mingw*)
- # We need to link against the Winsock2 library for SCPI over TCP.
- LIBS="$LIBS -lws2_32";;
-esac
-
-# This variable collects the pkg-config names of all detected libs.
-# It is then used to construct the "Requires.private:" field in the
-# libsigrok.pc file.
-SR_PKGLIBS=""
-
-# libm (the standard math library) is always needed.
-AC_SEARCH_LIBS([pow], [m])
-
-# RPC is only needed for VXI support.
-AC_MSG_CHECKING([for RPC support])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <rpc/rpc.h>],
- [CLIENT *rpc_test(void)],
- [{ return clnt_create("", 0, 0, ""); }])],
- [AC_MSG_RESULT([yes]); have_rpc=1],
- [AC_MSG_RESULT([no]); have_rpc=0])
-# Define HAVE_RPC in config.h if we found RPC support.
-AC_DEFINE_UNQUOTED(HAVE_RPC, [$have_rpc], [Specifies whether we have RPC support.])
-# VXI support is only compiled if RPC support was found.
-AM_CONDITIONAL(NEED_RPC, test "x$have_rpc" != "x0")
-
-# libglib-2.0 is always needed. Abort if it's not found.
-# Note: glib-2.0 is part of the libsigrok API (hard pkg-config requirement).
-# We require at least 2.32.0 due to e.g. g_variant_new_fixed_array().
-AM_PATH_GLIB_2_0([2.32.0],
- [LIB_CFLAGS="$LIB_CFLAGS $GLIB_CFLAGS"; LIBS="$LIBS $GLIB_LIBS"])
-
-# libzip is always needed. Abort if it's not found.
-PKG_CHECK_MODULES([libzip], [libzip >= 0.10],
- [LIB_CFLAGS="$LIB_CFLAGS $libzip_CFLAGS"; LIBS="$LIBS $libzip_LIBS";
- SR_PKGLIBS="$SR_PKGLIBS libzip"])
-
-# libserialport is only needed for some hardware drivers. Disable the
-# respective drivers if it is not found.
-if test "x$enable_libserialport" != "xno"; then
- PKG_CHECK_MODULES([libserialport], [libserialport >= 0.2.0],
- [have_libserialport="yes"; LIB_CFLAGS="$LIB_CFLAGS $libserialport_CFLAGS";
- LIBS="$LIBS $libserialport_LIBS";
- SR_PKGLIBS="$SR_PKGLIBS libserialport"],
- [have_libserialport="no"])
- if test "x$enable_libserialport$have_libserialport" = "xyesno"; then
- AC_MSG_ERROR([libserialport support requested, but it was not found.])
- fi
-else
- have_libserialport="no"
-fi
-if test "x$have_libserialport" = "xno"; then
- HW_AGILENT_DMM="no"; HW_APPA_55II="no";
- HW_ATTEN_PPS3XXX="no"; HW_BRYMEN_DMM="no"; HW_CEM_DT_885X="no";
- HW_CENTER_3XX="no"; HW_COLEAD_SLM="no"; HW_CONRAD_DIGI_35_CPU="no";
- HW_FLUKE_DMM="no"; HW_GMC_MH_1X_2X="no"; HW_HAMEG_HMO="no";
- HW_MANSON_HCS_3XXX="no"; HW_MIC_985XX="no"; HW_MOTECH_LPS_30X="no";
- HW_NORMA_DMM="no"; HW_OPENBENCH_LOGIC_SNIFFER="no"; HW_SERIAL_DMM="no";
- HW_TELEINFO="no"; HW_TONDAJ_SL_814="no";
-else
- # Define HAVE_LIBSERIALPORT in config.h if we found libserialport.
- AC_DEFINE_UNQUOTED(HAVE_LIBSERIALPORT, [1],
- [Specifies whether we have libserialport.])
-fi
-
-# Serial port helper code is only compiled in if libserialport was found.
-AM_CONDITIONAL(NEED_SERIAL, test "x$have_libserialport" != xno)
-
-# The VISA SCPI backend is only compiled in if librevisa was found.
-PKG_CHECK_MODULES([librevisa], [librevisa >= 0.0.20130812],
- [have_librevisa="yes"; LIB_CFLAGS="$LIB_CFLAGS $librevisa_CFLAGS";
- LIBS="$LIBS $librevisa_LIBS";
- SR_PKGLIBS="$SR_PKGLIBS librevisa"],
- [have_librevisa="no"])
-AM_CONDITIONAL(NEED_VISA, test "x$have_librevisa" != xno)
-if test "x$have_librevisa" != "xno"; then
- # Define HAVE_LIBREVISA in config.h if we found librevisa.
- AC_DEFINE_UNQUOTED(HAVE_LIBREVISA, [1],
- [Specifies whether we have librevisa.])
-fi
-
-# The GPIB SCPI backend is only compiled in if libgpib is found.
-PKG_CHECK_MODULES([libgpib], [libgpib],
- [have_libgpib="yes"; LIB_CFLAGS="$LIB_CFLAGS $libgpib_CFLAGS";
- LIBS="$LIBS $libgpib_LIBS";
- SR_PKGLIBS="$SR_PKGLIBS libgpib"],
- [have_libgpib="no"])
-AM_CONDITIONAL(NEED_GPIB, test "x$have_libgpib" != xno)
-if test "x$have_libgpib" != "xno"; then
- # Define HAVE_LIBGPIB in config.h if we found libgpib.
- AC_DEFINE_UNQUOTED(HAVE_LIBGPIB, [1],
- [Specifies whether we have libgpib.])
-fi
-
-# libusb-1.0 is only needed for some hardware drivers. Disable the respective
-# drivers if it is not found.
-if test "x$enable_libusb" != "xno"; then
- case "$host" in
- *freebsd*)
- # 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,
- # and no need to (potentially) disable any drivers if it's not found.
- have_libusb1_0="yes"
- ;;
- *)
- PKG_CHECK_MODULES([libusb], [libusb-1.0 >= 1.0.16],
- [have_libusb1_0="yes"; LIB_CFLAGS="$LIB_CFLAGS $libusb_CFLAGS";
- LIBS="$LIBS $libusb_LIBS";
- SR_PKGLIBS="$SR_PKGLIBS libusb-1.0"],
- [have_libusb1_0="no"])
- if test "x$enable_libusb$have_libusb1_0" = "xyesno"; then
- AC_MSG_ERROR([libusb support requested, but it was not found.])
- fi
- ;;
- esac
-else
- have_libusb1_0="no"
-fi
-if test "x$have_libusb1_0" = "xno"; then
- HW_BRYMEN_BM86X="no"; HW_FX2LAFW="no";
- HW_HANTEK_DSO="no"; HW_IKALOGIC_SCANALOGIC2="no";
- HW_KECHENG_KC_330B="no"; HW_LASCAR_EL_USB="no";
- HW_SYSCLK_LWLA="no"; HW_TESTO="no"; HW_UNI_T_DMM="no";
- HW_UNI_T_UT32X="no"; HW_VICTOR_DMM="no";
- HW_ZEROPLUS_LOGIC_CUBE="no"; HW_SALEAE_LOGIC16="no";
-else
- # Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0.
- AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
- [Specifies whether we have libusb-1.0.])
-fi
-
-# USB + FX2 firmware helper code is only compiled in if libusb-1.0 was found.
-AM_CONDITIONAL(NEED_USB, test "x$have_libusb1_0" != xno)
-
-# libftdi is only needed for some hardware drivers. Disable them if not found.
-if test "x$enable_libftdi" != "xno"; then
- PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
- [have_libftdi="yes"; LIB_CFLAGS="$LIB_CFLAGS $libftdi_CFLAGS";
- LIBS="$LIBS $libftdi_LIBS";
- SR_PKGLIBS="$SR_PKGLIBS libftdi"],
- [PKG_CHECK_MODULES([libftdi1], [libftdi1 >= 1.0],
- [LIB_CFLAGS="$LIB_CFLAGS $libftdi1_CFLAGS";
- LIBS="$LIBS $libftdi1_LIBS";
- SR_PKGLIBS="$SR_PKGLIBS libftdi1"],
- [have_libftdi="no"])])
- if test "x$enable_libftdi$have_libftdi" = "xyesno"; then
- AC_MSG_ERROR([libftdi support requested, but it was not found.])
- fi
-else
- have_libftdi="no"
-fi
-if test "x$have_libftdi" = "xno"; then
- HW_ASIX_SIGMA="no"; HW_CHRONOVU_LA="no"; HW_IKALOGIC_SCANAPLUS="no";
- HW_PIPISTRELLO_OLS="no";
-fi
-
-# glibmm-2.4 is needed for the C++ bindings.
-PKG_CHECK_MODULES([glibmm], [glibmm-2.4 >= 2.32.0],
- [CXXFLAGS="$CXXFLAGS $glibmm_CFLAGS";
- CXXLIBS="$CXXLIBS $glibmm_LIBS"],
- [BINDINGS_CXX="no"; cxx_msg="glibmm required"])