diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2016-01-27 04:24:05 +0100 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2016-01-27 04:24:05 +0100 |
commit | d0d97089706286fafd3c8ff56f3b5bf7ac07c6e0 (patch) | |
tree | 23e551ce4d6d732b5556e1027f06deefa23f4d31 /configure.ac | |
parent | Post release updates (diff) | |
download | gnupg2-d0d97089706286fafd3c8ff56f3b5bf7ac07c6e0.tar.xz gnupg2-d0d97089706286fafd3c8ff56f3b5bf7ac07c6e0.zip |
scd: Migrate to new API of libusb 1.0.
* configure.ac (LIBUSB_CPPFLAGS): New.
* scd/Makefile.am (AM_CPPFLAGS): Add LIBUSB_CPPFLAGS.
* scd/ccid-driver.c: Use libusb 1.0 API.
--
Changes are straightforward, not use any new features.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index b790e6d75..c20006935 100644 --- a/configure.ac +++ b/configure.ac @@ -783,15 +783,52 @@ AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no) # # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs. if test "$use_ccid_driver" = yes ; then - AC_CHECK_LIB(usb, usb_bulk_write, - [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb" - AC_DEFINE(HAVE_LIBUSB,1, - [defined if libusb is available]) + case $target in + *-*-darwin*) + LIBUSB_LIBS="-lusb-1.0 -Wl,-framework,CoreFoundation -Wl,-framework,IOKit" + ;; + *-*-freebsd*) + # FreeBSD has a native 1.0 compatible library by -lusb. + LIBUSB_LIBS="-lusb" + ;; + *) + LIBUSB_LIBS="-lusb-1.0" + ;; + esac + AC_CHECK_LIB(usb-1.0, libusb_init, + [ LIBUSB_LIBS="$LIBUSB_LIBS" + AC_DEFINE(HAVE_LIBUSB,1, [defined if libusb is available]) have_libusb=yes ]) - AC_CHECK_FUNCS(usb_create_match) + AC_DEFINE([HAVE_LIBUSB]) + AC_MSG_CHECKING([libusb include dir]) + usb_incdir_found="no" + for _incdir in "" "/usr/include/libusb-1.0" "/usr/local/include/libusb-1.0"; do + _libusb_save_cppflags=$CPPFLAGS + if test -n "${_incdir}"; then + CPPFLAGS="-I${_incdir} ${CPPFLAGS}" + fi + AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <libusb.h>]])], + [usb_incdir=${_incdir}; usb_incdir_found="yes"], []) + CPPFLAGS=${_libusb_save_cppflags} + if test "$usb_incdir_found" = "yes"; then + break + fi + done + if test "$usb_incdir_found" = "yes"; then + AC_MSG_RESULT([${usb_incdir}]) + else + AC_MSG_RESULT([not found]) + use_ccid_driver=no + fi + if test "$usb_incdir" = ""; then + LIBUSB_CPPFLAGS="" + else + LIBUSB_CPPFLAGS="-I${usb_incdir}" + fi fi AC_SUBST(LIBUSB_LIBS) +AC_SUBST(LIBUSB_CPPFLAGS) # # Check wether it is necessary to link against libdl. |