aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--m4/ChangeLog6
-rw-r--r--m4/libusb.m425
2 files changed, 28 insertions, 3 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog
index 6133f2125..c3f79fa4f 100644
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -1,3 +1,9 @@
+2005-11-05 David Shaw <[email protected]>
+
+ * libusb.m4: Check for libusb-config and if we find it, use --libs
+ and --cflags. This is needed for OS X since libusb brings in
+ dependencies to various Apple libraries.
+
2005-10-21 David Shaw <[email protected]>
* readline.m4: Check for rl_completion_func_t and
diff --git a/m4/libusb.m4 b/m4/libusb.m4
index d11a9d954..809dc1dd9 100644
--- a/m4/libusb.m4
+++ b/m4/libusb.m4
@@ -1,5 +1,5 @@
dnl Check for libusb
-dnl Copyright (C) 2004 Free Software Foundation, Inc.
+dnl Copyright (C) 2004, 2005 Free Software Foundation, Inc.
dnl
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
@@ -22,10 +22,24 @@ AC_DEFUN([GNUPG_CHECK_LIBUSB],
if test -d "$withval" ; then
CPPFLAGS="${CPPFLAGS} -I$withval/include"
LDFLAGS="${LDFLAGS} -L$withval/lib"
+ AC_PATH_PROG([_usb_config],["$_do_libusb/bin/libusb-config"])
+ else
+ AC_PATH_PROG([_usb_config],[libusb-config])
fi
_libusb_save_libs=$LIBS
- LIBS="$LIBS -lusb"
+ _libusb_save_cflags=$CFLAGS
+
+ if test x$_usb_config != "x" ; then
+ _libusb_try_libs=`$LIBS $_usb_config --libs`
+ _libusb_try_cflags=`$LIBS $_usb_config --cflags`
+ else
+ _libusb_try_libs="-lusb"
+ _libusb_try_cflags=""
+ fi
+
+ LIBS="$LIBS $_libusb_try_libs"
+ CFLAGS="$CFLAGS $_libusb_try_cflags"
AC_MSG_CHECKING([whether libusb is present and sane])
@@ -38,13 +52,18 @@ usb_bulk_write(NULL,0,NULL,0,0);
if test $_found_libusb = yes ; then
AC_DEFINE(HAVE_LIBUSB,1,
[Define to 1 if you have a fully functional libusb library.])
- AC_SUBST(LIBUSB,"-lusb")
+ AC_SUBST(LIBUSB_CPPFLAGS,$_libusb_try_cflags)
+ AC_SUBST(LIBUSB,$_libusb_try_libs)
AC_CHECK_FUNCS(usb_get_busses)
fi
LIBS=$_libusb_save_libs
+ CFLAGS=$_libusb_save_cflags
unset _libusb_save_libs
+ unset _libusb_save_cflags
+ unset _libusb_try_libs
+ unset _libusb_try_cflags
unset _found_libusb
fi
])dnl