blob: 4f5232af80f66256bafe009f93ec2b99da3cc2e2 [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
Daniel Drakec0c94322008-03-13 12:36:56 +000013AC_MSG_CHECKING([operating system])
14case $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])
23esac
24
25AM_CONDITIONAL([OS_LINUX], [test "x$backend" == "xlinux"])
26
Daniel Drake852bba42007-11-28 13:48:45 +000027# Library versioning
28lt_major="0"
29lt_revision="0"
30lt_age="0"
31AC_SUBST(lt_major)
32AC_SUBST(lt_revision)
33AC_SUBST(lt_age)
34
35# Message logging
36AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
37 [log_enabled=$enableval],
38 [log_enabled='yes'])
39if test "x$log_enabled" != "xno"; then
40 AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
41fi
42
43AC_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'])
47if test "x$debug_log_enabled" != "xno"; then
48 AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
49fi
50
51# Examples build
52AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
53 [build example applications (default n)])],
54 [build_examples=$enableval],
55 [build_examples='no'])
56AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
57
Daniel Drake37b7f9a2008-01-26 14:03:43 +000058# Restore gnu89 inline semantics on gcc 4.3 and newer
59saved_cflags="$CFLAGS"
60CFLAGS="$CFLAGS -fgnu89-inline"
61AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="")
62CFLAGS="$saved_cflags"
63
Daniel Drake852bba42007-11-28 13:48:45 +000064AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
Daniel Drake37b7f9a2008-01-26 14:03:43 +000065AM_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 +000066AC_SUBST(AM_CFLAGS)
67
Daniel Drakeead09cd2008-03-15 16:35:12 +000068AC_CONFIG_FILES([libusb-1.0.pc] [Makefile] [libusb/Makefile] [examples/Makefile] [doc/Makefile])
Daniel Drake852bba42007-11-28 13:48:45 +000069AC_OUTPUT
70