Yavor Goulishev | e9a6831 | 2011-05-23 11:58:06 -0700 | [diff] [blame] | 1 | AC_INIT([libusb-compat], [0.1.3]) |
| 2 | AM_INIT_AUTOMAKE |
| 3 | AC_CONFIG_SRCDIR([libusb/core.c]) |
| 4 | AM_CONFIG_HEADER([config.h]) |
| 5 | AC_CONFIG_MACRO_DIR([m4]) |
| 6 | |
| 7 | AC_PREREQ([2.50]) |
| 8 | AC_PROG_CC |
| 9 | AC_PROG_LIBTOOL |
| 10 | AC_C_INLINE |
| 11 | AM_PROG_CC_C_O |
| 12 | |
| 13 | # Library versioning |
| 14 | LT_MAJOR="8" |
| 15 | LT_REVISION="4" |
| 16 | LT_AGE="4" |
| 17 | AC_SUBST(LT_MAJOR) |
| 18 | AC_SUBST(LT_REVISION) |
| 19 | AC_SUBST(LT_AGE) |
| 20 | |
| 21 | # The libusb-0.1 version we pretend to be |
| 22 | LIBUSB01_VERSION="0.1.12" |
| 23 | AC_SUBST(LIBUSB01_VERSION) |
| 24 | |
| 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) |
| 28 | |
| 29 | # Message logging |
| 30 | AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])], |
| 31 | [log_enabled=$enableval], |
| 32 | [log_enabled='yes']) |
| 33 | if test "x$log_enabled" != "xno"; then |
| 34 | AC_DEFINE([ENABLE_LOGGING], 1, [Message logging]) |
| 35 | fi |
| 36 | |
| 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]) |
| 43 | fi |
| 44 | |
| 45 | # Examples build |
| 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"]) |
| 51 | |
| 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" |
| 57 | |
| 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 -Wno-pointer-sign -Wshadow" |
| 60 | AC_SUBST(AM_CFLAGS) |
| 61 | |
| 62 | AC_CONFIG_FILES([libusb.pc] [libusb-config] [Makefile] [libusb/Makefile] [examples/Makefile]) |
| 63 | AC_CONFIG_COMMANDS([default],[[chmod +x libusb-config]],[[]]) |
| 64 | |
| 65 | AC_OUTPUT |
| 66 | |