[Pcsclite-cvs-commit] r1770 - trunk/Drivers/ccid
Ludovic Rousseau
rousseau at costa.debian.org
Tue Nov 29 09:24:15 UTC 2005
Author: rousseau
Date: 2005-11-29 09:24:15 +0000 (Tue, 29 Nov 2005)
New Revision: 1770
Modified:
trunk/Drivers/ccid/configure.in
Log:
rewrite the libusb detection code to:
- use libusb-config if available
- --enable-libusb do not give a path anymore but just a yes/no status.
paths/arguments/etc must be given using LIBUSB_CFLAGS and LIBUSB_LIBS
- use AC_TRY_LINK_FUNC() instead of AC_CHECK_LIB() so we do not
explicitely give the library name. This name should come from LIBUSB_LIBS
Modified: trunk/Drivers/ccid/configure.in
===================================================================
--- trunk/Drivers/ccid/configure.in 2005-11-29 09:19:22 UTC (rev 1769)
+++ trunk/Drivers/ccid/configure.in 2005-11-29 09:24:15 UTC (rev 1770)
@@ -93,28 +93,22 @@
CFLAGS="$CFLAGS -Wall"
-# --enable-libusb=PATH
-LIBUSB_CFLAGS=`libusb-config --cflags`
-LIBUSB_LIBS=`libusb-config --libs`
+# --enable-libusb
AC_ARG_ENABLE(libusb,
- AC_HELP_STRING([--enable-libusb=PATH],[libusb path (default /usr)]),
- [
- case ${enableval} in
- "" | "yes" | "YES")
- ;;
- "no" | "NO")
- use_libusb=false
- ;;
- *)
- LIBUSB_CFLAGS="-I${enableval}/include"
- LIBUSB_LIBS="-L${enableval}/lib -lusb"
- ;;
- esac
- ]
-)
+ AC_HELP_STRING([--enable-libusb],[use libusb (default=yes)]),
+ [ use_libusb=no ], [ use_libusb=yes ] )
-# check if libusb is available
-if test "x$use_libusb" != xfalse ; then
+# check if libusb is used
+if test "x$use_libusb" != xno ; then
+ AC_CHECK_PROG([LIBUSBCONFIG], [libusb-config], [yes])
+
+ if test "$LIBUSBCONFIG" = "yes" ; then
+ LIBUSB_CFLAGS="$LIBUSB_CFLAGS `libusb-config --cflags`"
+ LIBUSB_LIBS="$LIBUSB_LIBS `libusb-config --libs`"
+ else
+ AC_MSG_WARN([libusb-config not found.])
+ fi
+
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
@@ -122,14 +116,16 @@
LIBS="$LDFLAGS $LIBUSB_LIBS"
AC_CHECK_HEADERS(usb.h, [],
- [ AC_MSG_ERROR([usb.h not found, use --enable-libusb=PATH]) ])
+ [ AC_MSG_ERROR([usb.h not found, use ./configure LIBUSB_CFLAGS=...]) ])
LIBS="$LIBS $COREFOUNDATION $IOKIT"
- AC_CHECK_LIB(usb, usb_init, [LIBUSB="$LIBUSB -lusb"],
- [ AC_MSG_ERROR([libusb not found]) ])
- LIBS="$LIBS $COREFOUNDATION $IOKIT"
- AC_CHECK_LIB(usb, usb_get_string_simple, [LIBUSB="$LIBUSB -lusb"],
+ AC_MSG_CHECKING([for usb_init])
+ AC_TRY_LINK_FUNC(usb_init, [ AC_MSG_RESULT([yes]) ],
+ [ AC_MSG_ERROR([libusb not found, use ./configure LIBUSB_LIBS=...]) ])
+
+ AC_MSG_CHECKING([for usb_get_string_simple])
+ AC_TRY_LINK_FUNC(usb_get_string_simple, [ AC_MSG_RESULT([yes]) ],
[ AC_MSG_ERROR([your libusb is too old. install version 0.1.7 or above]) ])
CPPFLAGS="$saved_CPPFLAGS"
More information about the Pcsclite-cvs-commit
mailing list