1AC_INIT([libusb-compat], [0.1.3])
2AM_INIT_AUTOMAKE
3AC_CONFIG_SRCDIR([libusb/core.c])
4AM_CONFIG_HEADER([config.h])
5AC_CONFIG_MACRO_DIR([m4])
6
7AC_PREREQ([2.50])
8AC_PROG_CC
9AC_PROG_LIBTOOL
10AC_C_INLINE
11AM_PROG_CC_C_O
12
13# Library versioning
14LT_MAJOR="8"
15LT_REVISION="4"
16LT_AGE="4"
17AC_SUBST(LT_MAJOR)
18AC_SUBST(LT_REVISION)
19AC_SUBST(LT_AGE)
20
21# The libusb-0.1 version we pretend to be
22LIBUSB01_VERSION="0.1.12"
23AC_SUBST(LIBUSB01_VERSION)
24
25PKG_CHECK_MODULES([LIBUSB_1_0], libusb-1.0 >= 0.9.1)
26AC_SUBST(LIBUSB_1_0_CFLAGS)
27AC_SUBST(LIBUSB_1_0_LIBS)
28
29# Message logging
30AC_ARG_ENABLE([log], [AS_HELP_STRING([--disable-log], [disable all logging])],
31	[log_enabled=$enableval],
32	[log_enabled='yes'])
33if test "x$log_enabled" != "xno"; then
34	AC_DEFINE([ENABLE_LOGGING], 1, [Message logging])
35fi
36
37AC_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'])
41if test "x$debug_log_enabled" != "xno"; then
42	AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
43fi
44
45# Examples build
46AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
47	[build example applications (default n)])],
48	[build_examples=$enableval],
49	[build_examples='no'])
50AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
51
52# Restore gnu89 inline semantics on gcc 4.3 and newer
53saved_cflags="$CFLAGS"
54CFLAGS="$CFLAGS -fgnu89-inline"
55AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="")
56CFLAGS="$saved_cflags"
57
58AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
59AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
60AC_SUBST(AM_CFLAGS)
61
62AC_CONFIG_FILES([libusb.pc] [libusb-config] [Makefile] [libusb/Makefile] [examples/Makefile])
63AC_CONFIG_COMMANDS([default],[[chmod +x libusb-config]],[[]])
64
65AC_OUTPUT
66
67