]> sigrok.org Git - libsigrok.git/blobdiff - configure.ac
configure.ac: libserialport is optional.
[libsigrok.git] / configure.ac
index 1b91c78f008bad14a3ae8791eb5bc0da301d2c14..36a82d5124719c073fbbc56506f56817c640adc2 100644 (file)
@@ -24,7 +24,7 @@ AC_PREREQ([2.63])
 # libsigrok package version number (NOT the same as shared lib version!).
 m4_define([sr_package_version_major], [0])
 m4_define([sr_package_version_minor], [2])
-m4_define([sr_package_version_micro], [1])
+m4_define([sr_package_version_micro], [2])
 m4_define([sr_package_version], [sr_package_version_major.sr_package_version_minor.sr_package_version_micro])
 
 AC_INIT([libsigrok], [sr_package_version], [sigrok-devel@lists.sourceforge.net],
@@ -67,7 +67,7 @@ PKG_PROG_PKG_CONFIG([0.22])
 # The algorithm for determining which number to change (and how) is nontrivial!
 # http://www.gnu.org/software/libtool/manual/libtool.html#Updating-version-info
 SR_LIB_VERSION_CURRENT=1
-SR_LIB_VERSION_REVISION=1
+SR_LIB_VERSION_REVISION=2
 SR_LIB_VERSION_AGE=0
 SR_LIB_VERSION="$SR_LIB_VERSION_CURRENT:$SR_LIB_VERSION_REVISION:$SR_LIB_VERSION_AGE"
 SR_LIB_LDFLAGS="-version-info $SR_LIB_VERSION"
@@ -251,6 +251,27 @@ PKG_CHECK_MODULES([libzip], [libzip >= 0.10],
        [CFLAGS="$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.
+PKG_CHECK_MODULES([libserialport], [libserialport >= 0.1],
+       [have_libserialport="yes"; CFLAGS="$CFLAGS $libserialport_CFLAGS";
+       LIBS="$LIBS $libserialport_LIBS";
+       SR_PKGLIBS="$SR_PKGLIBS libserialport"],
+       [have_libserialport="no"; HW_AGILENT_DMM="no"; HW_BRYMEN_DMM="no";
+       HW_CEM_DT_885X="no"; HW_CENTER_3XX="no"; HW_COLEAD_SLM="no";
+       HW_FLUKE_DMM="no"; HW_LINK_MSO19="no"; HW_MIC_985XX="no";
+       HW_NORMA_DMM="no"; HW_OLS="no"; HW_RIGOL_DS1XX2="no";
+       HW_SERIAL_DMM="no"; HW_TELEINFO="no"; HW_TONDAJ_SL_814="no"])
+
+# Define HAVE_LIBSERIALPORT in config.h if we found libserialport.
+if test "x$have_libserialport" != "xno"; then
+       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)
+
 # libusb-1.0 is only needed for some hardware drivers. Disable the respective
 # drivers if it is not found.
 case "$host" in
@@ -432,6 +453,11 @@ if test "x$HW_RIGOL_DS1XX2" = "xyes"; then
        AC_DEFINE(HAVE_HW_RIGOL_DS1XX2, 1, [Rigol DS1xx2 support])
 fi
 
+AM_CONDITIONAL(HW_SALEAE_LOGIC16, test x$HW_SALEAE_LOGIC16 = xyes)
+if test "x$HW_SALEAE_LOGIC16" = "xyes"; then
+       AC_DEFINE(HAVE_HW_SALEAE_LOGIC16, 1, [Saleae Logic16 support])
+fi
+
 AM_CONDITIONAL(HW_SERIAL_DMM, test x$HW_SERIAL_DMM = xyes)
 if test "x$HW_SERIAL_DMM" = "xyes"; then
        AC_DEFINE(HAVE_HW_SERIAL_DMM, 1, [Serial DMM support])
@@ -467,11 +493,6 @@ if test "x$HW_ZEROPLUS_LOGIC_CUBE" = "xyes"; then
        AC_DEFINE(HAVE_HW_ZEROPLUS_LOGIC_CUBE, 1, [ZEROPLUS Logic Cube support])
 fi
 
-AM_CONDITIONAL(HW_SALEAE_LOGIC16, test x$HW_SALEAE_LOGIC16 = xyes)
-if test "x$HW_SALEAE_LOGIC16" = "xyes"; then
-       AC_DEFINE(HAVE_HW_SALEAE_LOGIC16, 1, [Saleae Logic16 support])
-fi
-
 # Checks for header files.
 # These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
 AC_CHECK_HEADERS([fcntl.h sys/time.h termios.h])
@@ -561,7 +582,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" "libusb-1.0 >= 1.0.9" "libftdi >= 0.16" "libudev >= 151" "alsa >= 1.0" "check >= 0.9.4"; do
+for lib in "glib-2.0 >= 2.32.0" "libzip >= 0.10" "libserialport >= 0.1" "libusb-1.0 >= 1.0.9" "libftdi >= 0.16" "libudev >= 151" "alsa >= 1.0" "check >= 0.9.4"; do
        if `$PKG_CONFIG --exists $lib`; then
                ver=`$PKG_CONFIG --modversion $lib`
                answer="yes ($ver)"