1 AC_INIT([libusb-compat], [0.1.3])
3 AC_CONFIG_SRCDIR([libusb/core.c])
4 AM_CONFIG_HEADER([config.h])
5 AC_CONFIG_MACRO_DIR([m4])
21 # The libusb-0.1 version we pretend to be
22 LIBUSB01_VERSION="0.1.12"
23 AC_SUBST(LIBUSB01_VERSION)
25 PKG_CHECK_MODULES([LIBUSB_1_0], libusb-1.0 >= 0.9.1)
26 AC_SUBST(LIBUSB_1_0_CFLAGS)
27 AC_SUBST(LIBUSB_1_0_LIBS)
30 AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
31 [log_enabled=$enableval],
33 if test "x$log_enabled" != "xno"; then
34 AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
37 AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
38 [enable debug logging (default n)])],
39 [debug_log_enabled=$enableval],
40 [debug_log_enabled='no'])
41 if test "x$debug_log_enabled" != "xno"; then
42 AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
46 AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
47 [build example applications (default n)])],
48 [build_examples=$enableval],
49 [build_examples='no'])
50 AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
52 # Restore gnu89 inline semantics on gcc 4.3 and newer
53 saved_cflags="$CFLAGS"
54 CFLAGS="$CFLAGS -fgnu89-inline"
55 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="")
56 CFLAGS="$saved_cflags"
58 AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
59 AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wshadow"
62 AC_CONFIG_FILES([libusb.pc] [libusb-config] [Makefile] [libusb/Makefile] [examples/Makefile])
63 AC_CONFIG_COMMANDS([default],[[chmod +x libusb-config]],[[]])