diff --git a/ChangeLog b/ChangeLog index 06450a6d8..b8a32b0ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-12-27 Chris Bagwell + * configure.in, configure, config.h.in, sanei_usb.c, + check-usb-chip.c, sane-find-scanner.c: Add check for + libusb-win32 which is API compatible with libusb-0.1 + but has different header file name to prevent conflicts + with Windows own usb.h. Since libusb-1.0 is scheduled to + support Windows (not a forked version), it will probably + work as-is if user has pkg-config installed under mingw. + 2011-12-20 m. allan noah * backend/fujitsu*, doc/descriptions/fujitsu.desc: backend v109 - added some MS and INQ information diff --git a/configure b/configure index 14d2c62a7..ae6000930 100755 --- a/configure +++ b/configure @@ -9753,6 +9753,58 @@ fi fi + for ac_header in lusb0_usb.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "lusb0_usb.h" "ac_cv_header_lusb0_usb_h" "$ac_includes_default" +if test "x$ac_cv_header_lusb0_usb_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LUSB0_USB_H 1 +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for usb_interrupt_read in -lusb" >&5 +$as_echo_n "checking for usb_interrupt_read in -lusb... " >&6; } +if ${ac_cv_lib_usb_usb_interrupt_read+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lusb $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char usb_interrupt_read (); +int +main () +{ +return usb_interrupt_read (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_usb_usb_interrupt_read=yes +else + ac_cv_lib_usb_usb_interrupt_read=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_usb_usb_interrupt_read" >&5 +$as_echo "$ac_cv_lib_usb_usb_interrupt_read" >&6; } +if test "x$ac_cv_lib_usb_usb_interrupt_read" = xyes; then : + USB_LIBS="$USB_LIBS -lusb" + HAVE_USB=yes +fi + +fi + +done + fi ;; esac diff --git a/configure.in b/configure.in index f2629719e..ac0917387 100644 --- a/configure.in +++ b/configure.in @@ -371,9 +371,13 @@ if test "$enable_libusb" != "no"; then dnl Fallback to the old libusb dnl libusb >= 0.1.8 is required, as we need usb_interrupt_read() AC_CHECK_HEADER(usb.h, - AC_CHECK_LIB(usb, usb_interrupt_read, + AC_CHECK_LIB(usb, usb_interrupt_read, [USB_LIBS="$USB_LIBS -lusb" HAVE_USB=yes])) + AC_CHECK_HEADERS(lusb0_usb.h, + AC_CHECK_LIB(usb, usb_interrupt_read, + [USB_LIBS="$USB_LIBS -lusb" + HAVE_USB=yes])) fi ;; esac diff --git a/include/sane/config.h.in b/include/sane/config.h.in index 32a0641b4..738a521a6 100644 --- a/include/sane/config.h.in +++ b/include/sane/config.h.in @@ -186,6 +186,9 @@ /* Define if the long long type is available. */ #undef HAVE_LONG_LONG +/* Define to 1 if you have the header file. */ +#undef HAVE_LUSB0_USB_H + /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_CPUFUNC_H diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c index eccf247a4..1430985fd 100644 --- a/sanei/sanei_usb.c +++ b/sanei/sanei_usb.c @@ -67,7 +67,11 @@ #endif #ifdef HAVE_LIBUSB +#ifdef HAVE_LUSB0_USB_H +#include +#else #include +#endif #endif /* HAVE_LIBUSB */ #ifdef HAVE_LIBUSB_1_0 diff --git a/tools/check-usb-chip.c b/tools/check-usb-chip.c index f3cfb9176..4e6730ef3 100644 --- a/tools/check-usb-chip.c +++ b/tools/check-usb-chip.c @@ -35,7 +35,11 @@ #include #include +#ifdef HAVE_LUSB0_USB_H +#include +#else #include +#endif #include "../include/_stdint.h" diff --git a/tools/sane-find-scanner.c b/tools/sane-find-scanner.c index 1f899667f..2b1b1649f 100644 --- a/tools/sane-find-scanner.c +++ b/tools/sane-find-scanner.c @@ -42,7 +42,11 @@ #include "../include/sane/sanei_config.h" #ifdef HAVE_LIBUSB +#ifdef HAVE_LUSB0_USB_H +#include +#else #include +#endif extern char * check_usb_chip (struct usb_device *dev, int verbosity, SANE_Bool from_file); #endif