]> sigrok.org Git - libsigrok.git/blobdiff - configure.ac
brymen-bm86x: Add current loop sensor support.
[libsigrok.git] / configure.ac
index 84960e183ba727aa9c0d141f624c97ab12f5a18e..792929631b5e000dbc6f35e291ce8b44171893b7 100644 (file)
@@ -129,6 +129,7 @@ DRIVER([MIC 985xx], [mic-985xx])
 DRIVER([Motech LPS 30x], [motech-lps-30x])
 DRIVER([Norma DMM], [norma-dmm])
 DRIVER([OpenBench Logic Sniffer], [openbench-logic-sniffer])
+DRIVER([Pipistrello-OLS], [pipistrello-ols])
 DRIVER([Rigol DS], [rigol-ds])
 DRIVER([Saleae Logic16], [saleae-logic16])
 DRIVER([serial DMM], [serial-dmm])
@@ -139,6 +140,7 @@ DRIVER([Tondaj SL-814], [tondaj-sl-814])
 DRIVER([UNI-T DMM], [uni-t-dmm])
 DRIVER([UNI-T UT32x], [uni-t-ut32x])
 DRIVER([Victor DMM], [victor-dmm])
+DRIVER([Yokogawa DL/DLM], [yokogawa-dlm])
 DRIVER([ZEROPLUS Logic Cube], [zeroplus-logic-cube])
 
 AC_ARG_ENABLE(libserialport,
@@ -175,6 +177,11 @@ AC_ARG_ENABLE(java,
        [build Java bindings [default=yes]]),
        [BINDINGS_JAVA="$enableval"], [BINDINGS_JAVA=$BINDINGS_ALL])
 
+AC_ARG_WITH(jni-include-path,
+       AC_HELP_STRING([--with-jni-include-path=path],
+       [specify include path for JNI [default=autodetect]]),
+       [JNI_INCLUDE_DIRS="$withval"], [JNI_INCLUDE_DIRS=auto])
+
 # Check if the C++ compiler supports the C++11 standard.
 
 m4_ifdef([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX_11(,[optional])],
@@ -184,30 +191,28 @@ if test "x$HAVE_CXX11" != "x1"; then
        BINDINGS_CXX="no"; cxx_msg="C++11 compiler required"
 fi
 
-# The C++ bindings use gccxml to parse libsigrok symbols.
-AC_CHECK_PROG([HAVE_GCCXML], [gccxml], [yes])
-if test "x$HAVE_GCCXML" != "xyes"; then
-       BINDINGS_CXX="no"; cxx_msg="gccxml required"
+# 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
 
-# Python is needed for the C++ (and Python) bindings.
+# The Python bindings need Python development files
 PKG_CHECK_MODULES([python], [python >= 2.7],
         [CXXFLAGS="$CXXFLAGS $python_CFLAGS";
         CXXLIBS="$CXXLIBS $python_LIBS"],
-               [BINDINGS_CXX="no"; cxx_msg="Python required"])
-
-# The C++ bindings need the pygccxml Python module.
-m4_ifdef([AX_PYTHON_MODULE], [AX_PYTHON_MODULE([pygccxml])],
-       # We'll let it go through even if the macro wasn't found, the python
-       # module may still be there.
-       [HAVE_PYTHON_PYGCCXML="yes";
-               AC_MSG_NOTICE([Missing macro m4_toupper(aX_PYTHON_MODULE), no pygccxml check])]
-)
-if test "x$HAVE_PYMOD_PYGCCXML" != "xyes"; then
-       BINDINGS_CXX="no"; cxx_msg="Python pygccxml module required"
-fi
+[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 C++ bindings need the setuptools Python module.
+# 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.
@@ -215,7 +220,7 @@ m4_ifdef([AX_PYTHON_MODULE], [AX_PYTHON_MODULE([setuptools])],
                AC_MSG_NOTICE([Missing macro m4_toupper(aX_PYTHON_MODULE), no setuptools check])]
 )
 if test "x$HAVE_PYMOD_SETUPTOOLS" != "xyes"; then
-       BINDINGS_CXX="no"; cxx_msg="Python setuptools module required"
+       BINDINGS_PYTHON="no"; python_msg="Python setuptools module required"
 fi
 
 # The Python and Java bindings use swig to generate code.
@@ -267,7 +272,7 @@ PKG_CHECK_MODULES([libzip], [libzip >= 0.10],
 # 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.1.0],
+       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"],
@@ -296,13 +301,12 @@ fi
 # Serial port helper code is only compiled in if libserialport was found.
 AM_CONDITIONAL(NEED_SERIAL, test "x$have_libserialport" != xno)
 
+# 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"])
-
-# VISA SCPI backend is only compiled in if librevisa was found.
 AM_CONDITIONAL(NEED_VISA, test "x$have_librevisa" != xno)
 
 # Define HAVE_LIBREVISA in config.h if we found librevisa.
@@ -311,6 +315,20 @@ if test "x$have_librevisa" != "xno"; then
                [Specifies whether we have librevisa.])
 fi
 
+# GPIB backend is only compiled in if libgpib headers 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)
+
+# Define HAVE_LIBGPIB in config.h if we found libgpib.
+if test "x$have_libgpib" != "xno"; then
+       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
@@ -372,6 +390,7 @@ 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.
@@ -380,6 +399,19 @@ PKG_CHECK_MODULES([glibmm], [glibmm-2.4 >= 2.32.0],
        CXXLIBS="$CXXLIBS $glibmm_LIBS"],
        [BINDINGS_CXX="no"; cxx_msg="glibmm required"])
 
+# C++ bindings want stoi and stod
+if test "x$BINDINGS_CXX" == "xyes"; then
+       AC_LANG_PUSH([C++])
+       AC_MSG_CHECKING([for stoi and stod])
+       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <string>],
+                                          [{ return std::stoi("1")+std::stod("1.0"); }])],
+              [AC_MSG_RESULT([yes]);
+               AC_DEFINE_UNQUOTED(HAVE_STOI_STOD, [1],
+               [Specifies whether we have the stoi and stod functions.])],
+              [AC_MSG_RESULT([no])])
+       AC_LANG_POP([C++])
+fi
+
 # PyGObject is needed for the Python bindings.
 PKG_CHECK_MODULES([pygobject], [pygobject-3.0 >= 3.0.0],
         [CXXFLAGS="$CXXFLAGS $pygobject_CFLAGS";
@@ -403,10 +435,14 @@ case "$host" in
        ;;
 esac
 
+# The BeagleLogic driver needs sys/mman.h and sys/ioctl.h. Don't try to
+# build it if these headers aren't available.
+AC_CHECK_HEADERS([sys/mman.h sys/ioctl.h], [], [HW_BEAGLELOGIC="no"])
+
 AC_SUBST(SR_PKGLIBS)
 
-CFLAGS="$CFLAGS -I./include/libsigrok $LIB_CFLAGS"
-CXXFLAGS="$CXXFLAGS -I./include -I./bindings/cxx/include $LIB_CFLAGS"
+CFLAGS="$CFLAGS -Iinclude/libsigrok -I${srcdir}/include/libsigrok $LIB_CFLAGS"
+CXXFLAGS="$CXXFLAGS -Iinclude/libsigrok -I${srcdir}/include -Ibindings/cxx -Ibindings/cxx/include/libsigrok -I${srcdir}/bindings/cxx/include $LIB_CFLAGS"
 
 # Find Java compiler and JNI includes for Java bindings.
 
@@ -414,10 +450,19 @@ AC_CHECK_PROG([HAVE_JAVAC], [javac], [yes], [no])
 
 if test "x$HAVE_JAVAC" = "xyes"; then
        AX_PROG_JAVAC
-       AX_JNI_INCLUDE_DIR
+       if test "x$JNI_INCLUDE_DIRS" = "xauto"; then
+               if test "x$cross_compiling" = "xyes"; then
+                       JNI_INCLUDE_DIRS=
+               else
+                       AX_JNI_INCLUDE_DIR
+               fi
+       fi
        for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS; do
                CXXFLAGS="$CXXFLAGS -I$JNI_INCLUDE_DIR"
        done
+       AC_LANG_PUSH([C++])
+       AC_CHECK_HEADERS([jni.h], [], [BINDINGS_JAVA="no"; java_msg="Java JNI headers required"])
+       AC_LANG_POP([C++])
 else
        BINDINGS_JAVA="no"; java_msg="Java compiler required"
 fi
@@ -565,6 +610,11 @@ if test "x$HW_OPENBENCH_LOGIC_SNIFFER" = "xyes"; then
        AC_DEFINE(HAVE_HW_OPENBENCH_LOGIC_SNIFFER, 1, [OpenBench Logic Sniffer (OLS) support])
 fi
 
+AM_CONDITIONAL(HW_PIPISTRELLO_OLS, test x$HW_PIPISTRELLO_OLS = xyes)
+if test "x$HW_PIPISTRELLO_OLS" = "xyes"; then
+       AC_DEFINE(HAVE_HW_PIPISTRELLO_OLS, 1, [Pipistrello OLS support])
+fi
+
 AM_CONDITIONAL(HW_RIGOL_DS, test x$HW_RIGOL_DS = xyes)
 if test "x$HW_RIGOL_DS" = "xyes"; then
        AC_DEFINE(HAVE_HW_RIGOL_DS, 1, [Rigol DS support])
@@ -615,6 +665,11 @@ if test "x$HW_VICTOR_DMM" = "xyes"; then
        AC_DEFINE(HAVE_HW_VICTOR_DMM, 1, [Victor DMM support])
 fi
 
+AM_CONDITIONAL(HW_YOKOGAWA_DLM, test x$HW_YOKOGAWA_DLM = xyes)
+if test "x$HW_YOKOGAWA_DLM" = "xyes"; then
+       AC_DEFINE(HAVE_HW_YOKOGAWA_DLM, 1, [Yokogawa DL/DLM support])
+fi
+
 AM_CONDITIONAL(HW_ZEROPLUS_LOGIC_CUBE, test x$HW_ZEROPLUS_LOGIC_CUBE = xyes)
 if test "x$HW_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
        AC_DEFINE(HAVE_HW_ZEROPLUS_LOGIC_CUBE, 1, [ZEROPLUS Logic Cube support])
@@ -627,7 +682,8 @@ AM_CONDITIONAL(BINDINGS_PYTHON, test x$BINDINGS_PYTHON = xyes)
 AM_CONDITIONAL(BINDINGS_JAVA, test x$BINDINGS_JAVA = xyes)
 
 # Checks for header files.
-# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
+# These are already implicitly checked: inttypes.h stdint.h stdlib.h string.h
+# unistd.h memory.h strings.h dlfcn.h sys/types.h sys/stat.h.
 
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_BIGENDIAN
@@ -664,7 +720,11 @@ echo "Detected libraries:"
 echo
 
 # Note: This only works for libs with pkg-config integration.
-for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.0" "librevisa >= 0.0.20130812" "libusb-1.0 >= 1.0.16" "libftdi >= 0.16" "libftdi1 >= 1.0" "glibmm-2.4 >= 2.32.0" "pygobject-3.0 >= 3.0.0" "check >= 0.9.4"; do
+for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.2.0" \
+       "librevisa >= 0.0.20130812" "libusb-1.0 >= 1.0.16" "libftdi >= 0.16" \
+       "libftdi1 >= 1.0" "glibmm-2.4 >= 2.32.0" "pygobject-3.0 >= 3.0.0" \
+       "check >= 0.9.4" "libgpib"
+do
        optional="OPTIONAL"
        if test "x$lib" = "xglib-2.0 >= 2.32.0"; then optional="REQUIRED"; fi
        if test "x$lib" = "xlibzip >= 0.10"; then optional="REQUIRED"; fi