configure.ac: detect libusb-1.0

Damjan Jovanovic damjan.jov at gmail.com
Wed Mar 24 09:15:59 CDT 2010


Changelog:
* configure.ac: detect libusb-1.0

Damjan Jovanovic
-------------- next part --------------
diff --git a/configure.ac b/configure.ac
index 3bb3536..b02bb4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,6 +69,7 @@ AC_ARG_WITH(png,       AS_HELP_STRING([--without-png],[do not use PNG]),
 AC_ARG_WITH(pthread,   AS_HELP_STRING([--without-pthread],[do not use the pthread library]),
             [if test "x$withval" = "xno"; then ac_cv_header_pthread_h=no; fi])
 AC_ARG_WITH(sane,      AS_HELP_STRING([--without-sane],[do not use SANE (scanner support)]))
+AC_ARG_WITH(usb,       AS_HELP_STRING([--without-usb],[do not use libusb]))
 AC_ARG_WITH(v4l,       AS_HELP_STRING([--without-v4l],[do not use v4l1 (v4l support)]))
 AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
             [if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
@@ -1148,6 +1149,28 @@ fi
 WINE_NOTICE_WITH(sane,[test "x$ac_cv_lib_soname_sane" = "x"],
                  [libsane ${notice_platform}development files not found, scanners won't be supported.])
 
+dnl *** Check for libusb-1.0 ****
+AC_SUBST(LIBUSBINCL,"")
+AC_SUBST(LIBUSBLIBS,"")
+if test "x$with_usb" != "xno"
+then
+    ac_save_CPPFLAGS="$CPPFLAGS"
+    if test "$PKG_CONFIG" != "false"
+    then
+        ac_usb_libs="`$PKG_CONFIG --libs libusb-1.0 2>/dev/null`"
+        ac_usb_cflags="`$PKG_CONFIG --cflags libusb-1.0 2>/dev/null`"
+        CPPFLAGS="$CPPFLAGS $ac_usb_cflags"
+    fi
+    AC_CHECK_HEADER(libusb.h,
+        [AC_CHECK_LIB(usb-1.0,libusb_init,
+             [AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have the libusb-1.0 library and header])
+              LIBUSBLIBS="$ac_usb_libs"
+              LIBUSBINCL="$ac_usb_cflags"],,$ac_usb_libs)])
+    CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+WINE_NOTICE_WITH(usb,[test "x$ac_cv_lib_usb_1_0_libusb_init" != "xyes"],
+                 [libusb-1.0 ${notice_platform}development files not found, USB won't be supported.])
+
 dnl **** Check for libv4l1 ****
 if test "x$with_v4l" != "xno"
 then


More information about the wine-patches mailing list