]> sigrok.org Git - libsigrok.git/commitdiff
add explicit configure flags for ftdi/serial/usb libraries
authorMike Frysinger <redacted>
Sat, 14 Jun 2014 02:44:38 +0000 (22:44 -0400)
committerBert Vermeulen <redacted>
Sun, 15 Jun 2014 08:38:06 +0000 (10:38 +0200)
This makes it a lot easier for distros to control this functionality.

configure.ac

index 496bc7a2e2e622aaacd1509fd03083251f6bf17b..f23e6306f34587f513759686c4b427fba803fe46 100644 (file)
@@ -261,6 +261,18 @@ AC_ARG_ENABLE(zeroplus-logic-cube,
        [HW_ZEROPLUS_LOGIC_CUBE="$enableval"],
        [HW_ZEROPLUS_LOGIC_CUBE=$HW_ENABLED_DEFAULT])
 
+AC_ARG_ENABLE(libserialport,
+       AC_HELP_STRING([--disable-libserialport],
+       [disable libserialport support [default=detect]]))
+
+AC_ARG_ENABLE(libftdi,
+       AC_HELP_STRING([--disable-libftdi],
+       [disable libftdi support [default=detect]]))
+
+AC_ARG_ENABLE(libusb,
+       AC_HELP_STRING([--disable-libusb],
+       [disable libusb support [default=detect]]))
+
 # Checks for libraries.
 
 case "$host" in
@@ -302,20 +314,29 @@ PKG_CHECK_MODULES([libzip], [libzip >= 0.10],
 
 # libserialport is only needed for some hardware drivers. Disable the
 # respective drivers if it is not found.
-PKG_CHECK_MODULES([libserialport], [libserialport >= 0.1.0],
-       [have_libserialport="yes"; LIB_CFLAGS="$LIB_CFLAGS $libserialport_CFLAGS";
-       LIBS="$LIBS $libserialport_LIBS";
-       SR_PKGLIBS="$SR_PKGLIBS libserialport"],
-       [have_libserialport="no"; HW_AGILENT_DMM="no"; HW_APPA_55II="no";
+if test "x$enable_libserialport" != "xno"; then
+       PKG_CHECK_MODULES([libserialport], [libserialport >= 0.1.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
+
+# Define HAVE_LIBSERIALPORT in config.h if we found libserialport.
+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_MIC_985XX="no"; HW_MOTECH_LPS_30X="no"; HW_NORMA_DMM="no";
        HW_OLS="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
+       HW_TONDAJ_SL_814="no";
+else
        AC_DEFINE_UNQUOTED(HAVE_LIBSERIALPORT, [1],
                [Specifies whether we have libserialport.])
 fi
@@ -340,43 +361,62 @@ fi
 
 # libusb-1.0 is only needed for some hardware drivers. Disable the respective
 # drivers if it is not found.
-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.
+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
+
+# Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0.
+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_UNI_T_DMM="no";
+       HW_UNI_T_UT32X="no"; HW_VICTOR_DMM="no";
+       HW_ZEROPLUS_LOGIC_CUBE="no"; HW_SALEAE_LOGIC16="no";
+else
        AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
                [Specifies whether we have a libusb.h header.])
-       ;;
-*)
-       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"; 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_UNI_T_DMM="no";
-               HW_UNI_T_UT32X="no"; HW_VICTOR_DMM="no";
-               HW_ZEROPLUS_LOGIC_CUBE="no"; HW_SALEAE_LOGIC16="no"])
-
-       # Define HAVE_LIBUSB_1_0 in config.h if we found libusb-1.0.
-       if test "x$have_libusb1_0" != "xno"; then
-               AC_DEFINE_UNQUOTED(HAVE_LIBUSB_1_0, [1],
-                       [Specifies whether we have a libusb.h header.])
-       fi
-       ;;
-esac
+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.
-PKG_CHECK_MODULES([libftdi], [libftdi >= 0.16],
-       [LIB_CFLAGS="$LIB_CFLAGS $libftdi_CFLAGS";
-       LIBS="$LIBS $libftdi_LIBS";
-       SR_PKGLIBS="$SR_PKGLIBS libftdi"],
-       [HW_ASIX_SIGMA="no"; HW_CHRONOVU_LA="no"; HW_IKALOGIC_SCANAPLUS="no"])
+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"],
+               [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";
+fi
 
 # The Check unit testing framework is optional. Disable if not found.
 PKG_CHECK_MODULES([check], [check >= 0.9.4],