From 8d3e8193bd09573e1980589044132eb35f0bad08 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Mon, 3 Jan 2005 15:16:57 +0000 Subject: [PATCH] * Makefile.am, libusb.m4: New libusb check macro. --- m4/ChangeLog | 4 ++++ m4/Makefile.am | 2 +- m4/libusb.m4 | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 m4/libusb.m4 diff --git a/m4/ChangeLog b/m4/ChangeLog index 76abace19..331d26d2a 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,7 @@ +2005-01-03 David Shaw + + * Makefile.am, libusb.m4: New libusb check macro. + 2004-12-24 David Shaw * libcurl.m4: Rewrite this to use the new --protocols flag I gave diff --git a/m4/Makefile.am b/m4/Makefile.am index 6b7c1cc05..0c2938181 100644 --- a/m4/Makefile.am +++ b/m4/Makefile.am @@ -1 +1 @@ -EXTRA_DIST = intmax.m4 longdouble.m4 longlong.m4 printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 readline.m4 libcurl.m4 +EXTRA_DIST = intmax.m4 longdouble.m4 longlong.m4 printf-posix.m4 signed.m4 size_max.m4 wchar_t.m4 wint_t.m4 xsize.m4 codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 nls.m4 po.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 ulonglong.m4 readline.m4 libcurl.m4 libusb.m4 diff --git a/m4/libusb.m4 b/m4/libusb.m4 new file mode 100644 index 000000000..d11a9d954 --- /dev/null +++ b/m4/libusb.m4 @@ -0,0 +1,50 @@ +dnl Check for libusb +dnl Copyright (C) 2004 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 +dnl Public License, this file may be distributed as part of a program +dnl that contains a configuration script generated by Autoconf, under +dnl the same distribution terms as the rest of that program. +dnl +dnl Defines HAVE_LIBUSB to 1 if a working libusb setup is found, and sets +dnl @LIBUSB@ to the necessary libraries. HAVE_USB_GET_BUSSES is set if +dnl usb_get_busses() exists. + +AC_DEFUN([GNUPG_CHECK_LIBUSB], +[ + AC_ARG_WITH(libusb, + AC_HELP_STRING([--with-libusb=DIR], + [look for the libusb library in DIR]), + [_do_libusb=$withval],[_do_libusb=yes]) + + if test "$_do_libusb" != "no" ; then + if test -d "$withval" ; then + CPPFLAGS="${CPPFLAGS} -I$withval/include" + LDFLAGS="${LDFLAGS} -L$withval/lib" + fi + + _libusb_save_libs=$LIBS + LIBS="$LIBS -lusb" + + AC_MSG_CHECKING([whether libusb is present and sane]) + + AC_LINK_IFELSE(AC_LANG_PROGRAM([#include ],[ +usb_bulk_write(NULL,0,NULL,0,0); +]),_found_libusb=yes,_found_libusb=no) + + AC_MSG_RESULT([$_found_libusb]) + + 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_CHECK_FUNCS(usb_get_busses) + fi + + LIBS=$_libusb_save_libs + + unset _libusb_save_libs + unset _found_libusb + fi +])dnl