From 9c2d268af412b905d845b2889bb3ef5375481330 Mon Sep 17 00:00:00 2001 From: Aaron Burghardt Date: Fri, 9 Oct 2015 02:18:36 +0200 Subject: Added IOKit option for OS X that removes libusb dependency (enabled by default) --- configure.ac | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 67459b8..bc8ba3d 100644 --- a/configure.ac +++ b/configure.ac @@ -33,15 +33,14 @@ AC_PROG_LIBTOOL AC_CHECK_HEADERS([readline/readline.h], [], [AC_MSG_ERROR([Please install readline development headers])] ) -PKG_CHECK_MODULES(libusb, libusb-1.0 >= $LIBUSB_VERSION) # Check additional platform flags case "$host_os" in darwin*) AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h, [ - AC_CHECK_HEADER(IOKit/IOKitLib.h, [ - AC_DEFINE(HAVE_IOKIT, 1, [Define if we have IOKit]) + AC_CHECK_HEADER(IOKit/usb/IOUSBLib.h, [ LIBIRECOVERYLDFLAGS="-framework IOKit -framework CoreFoundation" + have_iokit=yes ], []) ], []) ;; @@ -61,6 +60,24 @@ case "$host_os" in esac AC_SUBST(LIBIRECOVERYLDFLAGS) +AS_IF([test "x$have_iokit" = "xyes"], [ + AC_ARG_WITH([iokit], + [AS_HELP_STRING([--with-iokit], [Use IOKit instead of libusb on OS X [default=yes]])], + [], + [with_iokit=yes]) + ], [] +) + +AS_IF([test "x$with_iokit" = "xyes" && test "x$have_iokit" = "xyes"] , [ + AC_DEFINE(HAVE_IOKIT, 1, [Define if we have IOKit]) + USB_BACKEND="IOKit" + ], + [ + PKG_CHECK_MODULES(libusb, libusb-1.0 >= $LIBUSB_VERSION) + USB_BACKEND="libusb `$PKG_CONFIG --modversion libusb-1.0`" + ] +) + # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) @@ -144,6 +161,7 @@ Configuration for $PACKAGE $VERSION: ------------------------------------------- Install prefix: .........: $prefix + USB backend: ............: $USB_BACKEND Now type 'make' to build $PACKAGE $VERSION, and then 'make install' for installation. -- cgit v1.1-32-gdbae