blob: 58b4aa231c1967623f1d85bdc8267cbf3ad7ee8a [file] [log] [blame]
Daniel Drakee9364d72008-01-04 00:40:49 +00001AC_INIT([libusb], [0.9.0])
Daniel Drake852bba42007-11-28 13:48:45 +00002AM_INIT_AUTOMAKE
Daniel Drakee9364d72008-01-04 00:40:49 +00003AC_CONFIG_SRCDIR([libusb/core.c])
Daniel Drake852bba42007-11-28 13:48:45 +00004AM_CONFIG_HEADER([config.h])
5
6AC_PREREQ([2.50])
7AC_PROG_CC
8AC_PROG_LIBTOOL
9AC_C_INLINE
10AM_PROG_CC_C_O
Daniel Drake637a8d72008-01-30 13:19:10 +000011AC_DEFINE([_GNU_SOURCE], [], [Use GNU extensions])
Daniel Drake852bba42007-11-28 13:48:45 +000012
13# Library versioning
14lt_major="0"
15lt_revision="0"
16lt_age="0"
17AC_SUBST(lt_major)
18AC_SUBST(lt_revision)
19AC_SUBST(lt_age)
20
21# Message logging
22AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
23 [log_enabled=$enableval],
24 [log_enabled='yes'])
25if test "x$log_enabled" != "xno"; then
26 AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
27fi
28
29AC_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'])
33if test "x$debug_log_enabled" != "xno"; then
34 AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
35fi
36
37# Examples build
38AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
39 [build example applications (default n)])],
40 [build_examples=$enableval],
41 [build_examples='no'])
42AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
43
Daniel Drake37b7f9a2008-01-26 14:03:43 +000044# Restore gnu89 inline semantics on gcc 4.3 and newer
45saved_cflags="$CFLAGS"
46CFLAGS="$CFLAGS -fgnu89-inline"
47AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="")
48CFLAGS="$saved_cflags"
49
Daniel Drake852bba42007-11-28 13:48:45 +000050AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
Daniel Drake37b7f9a2008-01-26 14:03:43 +000051AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
Daniel Drake852bba42007-11-28 13:48:45 +000052AC_SUBST(AM_CFLAGS)
53
Daniel Drakee9364d72008-01-04 00:40:49 +000054AC_CONFIG_FILES([libusb-1.0.pc] [Makefile] [libusb/Makefile] [examples/Makefile])
Daniel Drake852bba42007-11-28 13:48:45 +000055AC_OUTPUT
56