From 38befc71844a6108a78e1fe5a76946450d49ca76 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 4 Sep 2019 23:56:37 +0200 Subject: Add device add/remove event subscription API --- configure.ac | 96 ++++++++++++++++++++++++++++-------------------------------- 1 file changed, 44 insertions(+), 52 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 1f10bb7..6481d74 100644 --- a/configure.ac +++ b/configure.ac @@ -28,36 +28,59 @@ AC_PROG_CXX AM_PROG_CC_C_O AC_PROG_LIBTOOL +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T +AC_TYPE_UINT16_T +AC_TYPE_UINT32_T +AC_TYPE_UINT8_T + +# Checks for library functions. +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS([strdup strerror strndup]) + # Checks for libraries. AC_CHECK_HEADERS([readline/readline.h], [], [AC_MSG_ERROR([Please install readline development headers])] ) # Check additional platform flags -case "$host_os" in +AC_MSG_CHECKING([for platform-specific build settings]) +case ${host_os} in darwin*) + AC_MSG_RESULT([${host_os}]) AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h, [ AC_CHECK_HEADER(IOKit/usb/IOUSBLib.h, [ - LIBIRECOVERYLDFLAGS="-framework IOKit -framework CoreFoundation" + GLOBAL_LDFLAGS+=" -framework IOKit -framework CoreFoundation" have_iokit=yes ], []) ], []) + AX_PTHREAD([], [AC_MSG_ERROR([pthread is required to build $PACKAGE])]) ;; mingw32*) - LDFLAGS+=" -static-libgcc" - LIBIRECOVERYLDFLAGS=" -lkernel32 -lmsvcrt -lsetupapi" + AC_MSG_RESULT([${host_os}]) + GLOBAL_LDFLAGS+=" -static-libgcc -lkernel32 -lmsvcrt -lsetupapi" + win32=true ;; cygwin*) + AC_MSG_RESULT([${host_os}]) CC=gcc-3 CFLAGS+=" -mno-cygwin" - LDFLAGS+=" -static-libgcc" - LIBIRECOVERYLDFLAGS=" -lkernel32 -lmsvcrt -lsetupapi" + GLOBAL_LDFLAGS+=" -static-libgcc -lkernel32 -lmsvcrt -lsetupapi" + win32=true ;; *) - LIBIRECOVERYLDFLAGS= + AC_MSG_RESULT([${host_os}]) + AX_PTHREAD([], [AC_MSG_ERROR([pthread is required to build $PACKAGE])]) ;; esac -AC_SUBST(LIBIRECOVERYLDFLAGS) +AM_CONDITIONAL(WIN32, test x$win32 = xtrue) AC_ARG_WITH([dummy], [AS_HELP_STRING([--with-dummy], [Use no USB driver at all [default=no]. This is only useful if you just want to query the device list by product type or hardware model. All other operations are no-ops or will return IRECV_E_UNSUPPORTED.])], @@ -69,61 +92,30 @@ AS_IF([test "x$have_iokit" = "xyes"], [ [AS_HELP_STRING([--with-iokit], [Use IOKit instead of libusb on OS X [default=yes]])], [], [with_iokit=yes]) - ], [] + ] ) AS_IF([test "x$with_dummy" = "xyes"], [ AC_DEFINE(USE_DUMMY, 1, [Define if we are using dummy USB driver]) USB_BACKEND="dummy" ], [ - 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" - ], - [ + 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" + ], [ + AS_IF([test "x$win32" = "xtrue"], [ + USB_BACKEND="win32 native (setupapi)" + ], [ PKG_CHECK_MODULES(libusb, libusb-1.0 >= $LIBUSB_VERSION) USB_BACKEND="libusb `$PKG_CONFIG --modversion libusb-1.0`" - LIBUSB_REQUIRED="libusb-1.0 >= $LIBUSB_VERSION" - AC_SUBST(LIBUSB_REQUIRED) - ] - ) + ]) + ]) ]) -# Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_TYPE_UINT16_T -AC_TYPE_UINT32_T -AC_TYPE_UINT8_T - -# Checks for library functions. -AC_FUNC_MALLOC -AC_FUNC_REALLOC -AC_CHECK_FUNCS([strcasecmp strdup strerror strndup]) - -# Check for operating system -AC_MSG_CHECKING([whether to enable WIN32 build settings]) -case ${host_os} in - *mingw32*|*cygwin*) - win32=true - AC_MSG_RESULT([yes]) - AC_CHECK_TOOL([WINDRES], [windres], AC_MSG_ERROR([windres not found])) - AC_SUBST(WINDRES) - ;; - *) - win32=false - AC_MSG_RESULT([no]) - ;; -esac -AM_CONDITIONAL(WIN32, test x$win32 = xtrue) - -AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden") +AS_COMPILER_FLAGS(GLOBAL_CFLAGS, "-Wall -Wextra -Wmissing-declarations -Wredundant-decls -Wshadow -Wpointer-arith -Wwrite-strings -Wswitch-default -Wno-unused-parameter -fvisibility=hidden $PTHREAD_CFLAGS") +GLOBAL_LDFLAGS+=" $PTHREAD_LIBS" AC_SUBST(GLOBAL_CFLAGS) +AC_SUBST(GLOBAL_LDFLAGS) case "$GLOBAL_CFLAGS" in *-fvisibility=hidden*) -- cgit v1.1-32-gdbae