X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=configure.ac;h=a60450cd1cc2c599d4e6389364bdd3ff3534f1da;hb=107639373df3d592961eb70111e6f4ccb36f74fa;hp=cd9fc12455195190ff6358f61fd369506aac0491;hpb=63d0fb752830fa8ea225ed9a9776e44a0ba66928;p=libsigrok.git diff --git a/configure.ac b/configure.ac index cd9fc124..a60450cd 100644 --- a/configure.ac +++ b/configure.ac @@ -46,10 +46,12 @@ AH_BOTTOM([#endif /* SR_CONFIG_H */]) # and enforce use of SR_API to explicitly mark all public API functions. COMMON_FLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden" CFLAGS="$COMMON_FLAGS -Wmissing-prototypes" +CXXFLAGS="-std=c++11 $COMMON_FLAGS" # Checks for programs. AC_PROG_CC AC_PROG_CPP +AC_PROG_CXX AC_PROG_INSTALL AC_PROG_LN_S @@ -78,8 +80,6 @@ AC_SUBST(SR_LIB_VERSION_AGE) AC_SUBST(SR_LIB_VERSION) AC_SUBST(SR_LIB_LDFLAGS) -# Hardware support '--enable' options. - AC_ARG_ENABLE(all-drivers, AC_HELP_STRING([--enable-all-drivers], [enable all drivers by default [default=yes]]), [HW_ENABLED_DEFAULT="$enableval"], @@ -98,14 +98,15 @@ AC_DEFUN([DRIVER], [ AC_ARG_ENABLE($2, AC_HELP_STRING([--enable-$2], [enable $1 support]), [m4_join([], [HW_], upperize([$2]))="$enableval"], [m4_join([], [HW_], upperize([$2]))=$default]) - dots=$(expr substr ".............................." 1 $(expr 32 - length $2)) - driver_summary="${driver_summary} - $2${dots} ${m4_join([], [HW_], upperize([$2]))}\n" + dots=$(echo -n ".............................." | cut -c 1-$(expr 32 - $(echo -n $2|wc -c))) + driver_summary="${driver_summary} - $2${dots} \${m4_join([], [HW_], upperize([$2]))}@" ]) DRIVER([Agilent DMM], [agilent-dmm]) DRIVER([Appa 55II], [appa-55ii]) DRIVER([ASIX SIGMA/SIGMA2], [asix-sigma]) DRIVER([Atten PPS3xxx], [atten-pps3xxx]) +DRIVER([BeagleLogic], [beaglelogic]) DRIVER([Brymen BM86x], [brymen-bm86x]) DRIVER([Brymen DMM], [brymen-dmm]) DRIVER([CEM DT-885x], [cem-dt-885x]) @@ -128,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]) @@ -138,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, @@ -152,6 +155,81 @@ AC_ARG_ENABLE(libusb, AC_HELP_STRING([--disable-libusb], [disable libusb support [default=detect]])) +# Language binding '--enable' options + +AC_ARG_ENABLE(bindings, + AC_HELP_STRING([--enable-bindings], + [build language bindings [default=yes]]), + [BINDINGS_ALL="$enableval"], [BINDINGS_ALL="yes"]) + +AC_ARG_ENABLE(cxx, + AC_HELP_STRING([--enable-cxx], + [build C++ bindings [default=yes]]), + [BINDINGS_CXX="$enableval"], [BINDINGS_CXX=$BINDINGS_ALL]) + +AC_ARG_ENABLE(python, + AC_HELP_STRING([--enable-python], + [build Python bindings [default=yes]]), + [BINDINGS_PYTHON="$enableval"], [BINDINGS_PYTHON=$BINDINGS_ALL]) + +AC_ARG_ENABLE(java, + AC_HELP_STRING([--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])], + [AC_MSG_NOTICE([Missing macro m4_toupper(aX_CXX_COMPILE_STDCXX_11), no C++11 check])]) + +if test "x$HAVE_CXX11" != "x1"; then + BINDINGS_CXX="no"; cxx_msg="C++11 compiler required" +fi + +# 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 @@ -194,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"], @@ -299,8 +377,25 @@ 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"]) + +# PyGObject is needed for the Python bindings. +PKG_CHECK_MODULES([pygobject], [pygobject-3.0 >= 3.0.0], + [CXXFLAGS="$CXXFLAGS $pygobject_CFLAGS"; + CXXLIBS="$CXXLIBS $pygobject_LIBS"; + PKG_CHECK_MODULES([pygobject_3_7_91], [pygobject-3.0 >= 3.7.91], + [pyg_flags_signed=0], [pyg_flags_signed=1]); + AC_DEFINE_UNQUOTED(PYGOBJECT_FLAGS_SIGNED, [$pyg_flags_signed], + [Whether last argument to pyg_flags_get_value() is signed])], + [BINDINGS_PYTHON="no"; python_msg="Python pygobject module required"]) + # The Check unit testing framework is optional. Disable if not found. PKG_CHECK_MODULES([check], [check >= 0.9.4], [have_check="yes"], [have_check="no"]) @@ -314,9 +409,43 @@ 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" +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. + +AC_CHECK_PROG([HAVE_JAVAC], [javac], [yes], [no]) + +if test "x$HAVE_JAVAC" = "xyes"; then + AX_PROG_JAVAC + 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 + +# Python and Java bindings depend on C++ bindings. +if test "x$BINDINGS_CXX" != "xyes"; then + BINDINGS_PYTHON="no"; python_msg="C++ bindings required" + BINDINGS_JAVA="no"; java_msg="C++ bindings required" +fi # Now set AM_CONDITIONALs and AC_DEFINEs for the enabled/disabled drivers. @@ -340,6 +469,11 @@ if test "x$HW_ATTEN_PPS3XXX" = "xyes"; then AC_DEFINE(HAVE_HW_ATTEN_PPS3XXX, 1, [Atten PPS3xxx support]) fi +AM_CONDITIONAL(HW_BEAGLELOGIC, test x$HW_BEAGLELOGIC = xyes) +if test "x$HW_BEAGLELOGIC" = "xyes"; then + AC_DEFINE(HAVE_HW_BEAGLELOGIC, 1, [BeagleLogic support]) +fi + AM_CONDITIONAL(HW_BRYMEN_BM86X, test x$HW_BRYMEN_BM86X = xyes) if test "x$HW_BRYMEN_BM86X" = "xyes"; then AC_DEFINE(HAVE_HW_BRYMEN_BM86X, 1, [Brymen BM86X support]) @@ -450,6 +584,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]) @@ -500,13 +639,25 @@ 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]) fi +AM_CONDITIONAL(BINDINGS_CXX, test x$BINDINGS_CXX = xyes) + +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 @@ -525,7 +676,8 @@ AC_SUBST(SR_PACKAGE_VERSION_MINOR) AC_SUBST(SR_PACKAGE_VERSION_MICRO) AC_SUBST(SR_PACKAGE_VERSION) -AC_CONFIG_FILES([Makefile include/libsigrok/version.h libsigrok.pc]) +AC_CONFIG_FILES([Makefile include/libsigrok/version.h libsigrok.pc + bindings/cxx/libsigrokxx.pc]) AC_OUTPUT @@ -542,7 +694,7 @@ 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" "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"; 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 @@ -555,5 +707,36 @@ for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1.0" "libre echo " - ($optional) $lib: $answer" done -echo -e "\nEnabled hardware drivers:\n${driver_summary}" +eval echo -e "@Enabled hardware drivers:@@${driver_summary}" | tr @ \\n + +# Prepare final bindings report messages +final_cxx="" +final_python="" +final_java="" +if test "$enable_bindings" = "no"; then + final_cxx=" (disabled)" + final_python=" (disabled)" + final_java=" (disabled)" +else + if test "$enable_cxx" = "no"; then + final_cxx=" (disabled)" + elif test "$BINDINGS_CXX" = "no"; then + final_cxx=" ($cxx_msg)" + fi + if test "$enable_python" = "no"; then + final_python=" (disabled)" + elif test "$BINDINGS_PYTHON" = "no"; then + final_python=" ($python_msg)" + fi + if test "$enable_java" = "no"; then + final_java=" (disabled)" + elif test "$BINDINGS_JAVA" = "no"; then + final_java=" ($java_msg)" + fi +fi +echo -e "Enabled language bindings:\n" +echo " - C++............................. $BINDINGS_CXX$final_cxx" +echo " - Python.......................... $BINDINGS_PYTHON$final_python" +echo " - Java............................ $BINDINGS_JAVA$final_java" +echo