add support for libusb-win32

It is API compatible with libusb-0.1 that is already supported
but uses different header file name to prevent conflict with
Window's own usb.h.
merge-requests/1/head
Chris Bagwell 2011-12-27 17:35:35 -06:00
rodzic 909aa82085
commit 8ac464a47d
7 zmienionych plików z 81 dodań i 1 usunięć

Wyświetl plik

@ -1,3 +1,12 @@
2011-12-27 Chris Bagwell <chris at cnpbagwell dot com>
* 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 <kitno455 at gmail dot com>
* backend/fujitsu*, doc/descriptions/fujitsu.desc: backend v109
- added some MS and INQ information

52
configure vendored
Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -186,6 +186,9 @@
/* Define if the long long type is available. */
#undef HAVE_LONG_LONG
/* Define to 1 if you have the <lusb0_usb.h> header file. */
#undef HAVE_LUSB0_USB_H
/* Define to 1 if you have the <machine/cpufunc.h> header file. */
#undef HAVE_MACHINE_CPUFUNC_H

Wyświetl plik

@ -67,7 +67,11 @@
#endif
#ifdef HAVE_LIBUSB
#ifdef HAVE_LUSB0_USB_H
#include <lusb0_usb.h>
#else
#include <usb.h>
#endif
#endif /* HAVE_LIBUSB */
#ifdef HAVE_LIBUSB_1_0

Wyświetl plik

@ -35,7 +35,11 @@
#include <string.h>
#include <errno.h>
#ifdef HAVE_LUSB0_USB_H
#include <lusb0_usb.h>
#else
#include <usb.h>
#endif
#include "../include/_stdint.h"

Wyświetl plik

@ -42,7 +42,11 @@
#include "../include/sane/sanei_config.h"
#ifdef HAVE_LIBUSB
#ifdef HAVE_LUSB0_USB_H
#include <lusb0_usb.h>
#else
#include <usb.h>
#endif
extern char * check_usb_chip (struct usb_device *dev, int verbosity, SANE_Bool from_file);
#endif