Daniel Drake | e9364d7 | 2008-01-04 00:40:49 +0000 | [diff] [blame] | 1 | AC_INIT([libusb], [0.9.0]) |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 2 | AM_INIT_AUTOMAKE |
Daniel Drake | e9364d7 | 2008-01-04 00:40:49 +0000 | [diff] [blame] | 3 | AC_CONFIG_SRCDIR([libusb/core.c]) |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 4 | AM_CONFIG_HEADER([config.h]) |
| 5 | |
| 6 | AC_PREREQ([2.50]) |
| 7 | AC_PROG_CC |
| 8 | AC_PROG_LIBTOOL |
| 9 | AC_C_INLINE |
| 10 | AM_PROG_CC_C_O |
Daniel Drake | 637a8d7 | 2008-01-30 13:19:10 +0000 | [diff] [blame] | 11 | AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions]) |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 12 | |
| 13 | # Library versioning |
| 14 | lt_major="0" |
| 15 | lt_revision="0" |
| 16 | lt_age="0" |
| 17 | AC_SUBST(lt_major) |
| 18 | AC_SUBST(lt_revision) |
| 19 | AC_SUBST(lt_age) |
| 20 | |
| 21 | # Message logging |
| 22 | AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])], |
| 23 | [log_enabled=$enableval], |
| 24 | [log_enabled='yes']) |
| 25 | if test "x$log_enabled" != "xno"; then |
| 26 | AC_DEFINE([ENABLE_LOGGING], 1, [Message logging]) |
| 27 | fi |
| 28 | |
| 29 | AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log], |
| 30 | [enable debug logging (default n)])], |
| 31 | [debug_log_enabled=$enableval], |
| 32 | [debug_log_enabled='no']) |
| 33 | if test "x$debug_log_enabled" != "xno"; then |
| 34 | AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging]) |
| 35 | fi |
| 36 | |
| 37 | # Examples build |
| 38 | AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build], |
| 39 | [build example applications (default n)])], |
| 40 | [build_examples=$enableval], |
| 41 | [build_examples='no']) |
| 42 | AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"]) |
| 43 | |
Daniel Drake | 37b7f9a | 2008-01-26 14:03:43 +0000 | [diff] [blame] | 44 | # Restore gnu89 inline semantics on gcc 4.3 and newer |
| 45 | saved_cflags="$CFLAGS" |
| 46 | CFLAGS="$CFLAGS -fgnu89-inline" |
| 47 | AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="") |
| 48 | CFLAGS="$saved_cflags" |
| 49 | |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 50 | AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility]) |
Daniel Drake | 37b7f9a | 2008-01-26 14:03:43 +0000 | [diff] [blame] | 51 | AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow" |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 52 | AC_SUBST(AM_CFLAGS) |
| 53 | |
Daniel Drake | e9364d7 | 2008-01-04 00:40:49 +0000 | [diff] [blame] | 54 | AC_CONFIG_FILES([libusb-1.0.pc] [Makefile] [libusb/Makefile] [examples/Makefile]) |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 55 | AC_OUTPUT |
| 56 | |