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 | |
Daniel Drake | c0c9432 | 2008-03-13 12:36:56 +0000 | [diff] [blame] | 13 | AC_MSG_CHECKING([operating system]) |
| 14 | case $host in |
| 15 | *-linux*) |
| 16 | AC_DEFINE(OS_LINUX, [], [Linux backend]) |
| 17 | AC_SUBST(OS_LINUX) |
| 18 | AC_MSG_RESULT([Linux]) |
| 19 | backend="linux" |
| 20 | ;; |
| 21 | *) |
| 22 | AC_MSG_ERROR([unsupported operating system]) |
| 23 | esac |
| 24 | |
| 25 | AM_CONDITIONAL([OS_LINUX], [test "x$backend" == "xlinux"]) |
| 26 | |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 27 | # Library versioning |
| 28 | lt_major="0" |
| 29 | lt_revision="0" |
| 30 | lt_age="0" |
| 31 | AC_SUBST(lt_major) |
| 32 | AC_SUBST(lt_revision) |
| 33 | AC_SUBST(lt_age) |
| 34 | |
| 35 | # Message logging |
| 36 | AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])], |
| 37 | [log_enabled=$enableval], |
| 38 | [log_enabled='yes']) |
| 39 | if test "x$log_enabled" != "xno"; then |
| 40 | AC_DEFINE([ENABLE_LOGGING], 1, [Message logging]) |
| 41 | fi |
| 42 | |
| 43 | AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log], |
| 44 | [enable debug logging (default n)])], |
| 45 | [debug_log_enabled=$enableval], |
| 46 | [debug_log_enabled='no']) |
| 47 | if test "x$debug_log_enabled" != "xno"; then |
| 48 | AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging]) |
| 49 | fi |
| 50 | |
| 51 | # Examples build |
| 52 | AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build], |
| 53 | [build example applications (default n)])], |
| 54 | [build_examples=$enableval], |
| 55 | [build_examples='no']) |
| 56 | AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"]) |
| 57 | |
Daniel Drake | 37b7f9a | 2008-01-26 14:03:43 +0000 | [diff] [blame] | 58 | # Restore gnu89 inline semantics on gcc 4.3 and newer |
| 59 | saved_cflags="$CFLAGS" |
| 60 | CFLAGS="$CFLAGS -fgnu89-inline" |
| 61 | AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="") |
| 62 | CFLAGS="$saved_cflags" |
| 63 | |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 64 | AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility]) |
Daniel Drake | 37b7f9a | 2008-01-26 14:03:43 +0000 | [diff] [blame] | 65 | 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] | 66 | AC_SUBST(AM_CFLAGS) |
| 67 | |
Daniel Drake | ead09cd | 2008-03-15 16:35:12 +0000 | [diff] [blame] | 68 | AC_CONFIG_FILES([libusb-1.0.pc] [Makefile] [libusb/Makefile] [examples/Makefile] [doc/Makefile]) |
Daniel Drake | 852bba4 | 2007-11-28 13:48:45 +0000 | [diff] [blame] | 69 | AC_OUTPUT |
| 70 | |