summaryrefslogtreecommitdiffstats
path: root/third_party/libusb/src/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libusb/src/configure.ac')
-rw-r--r--third_party/libusb/src/configure.ac75
1 files changed, 51 insertions, 24 deletions
diff --git a/third_party/libusb/src/configure.ac b/third_party/libusb/src/configure.ac
index f9e648e..6d6b35d 100644
--- a/third_party/libusb/src/configure.ac
+++ b/third_party/libusb/src/configure.ac
@@ -8,14 +8,14 @@ m4_define([LU_DEFINE_VERSION_RC_ATOM],
[^#define\s*$1\s*"\(-rc[0-9]*\)".*], [\1]))])
dnl The m4_bregexp() returns (only) the numbers following the #define named
dnl in the first macro parameter. m4_define() then defines the name for use
-dnl in AC_INIT().
+dnl in AC_INIT.
LU_DEFINE_VERSION_ATOM([LIBUSB_MAJOR])
LU_DEFINE_VERSION_ATOM([LIBUSB_MINOR])
LU_DEFINE_VERSION_ATOM([LIBUSB_MICRO])
LU_DEFINE_VERSION_RC_ATOM([LIBUSB_RC])
-AC_INIT([libusb], LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC, [libusb-devel@lists.sourceforge.net], [libusb], [http://www.libusb.org/])
+AC_INIT([libusbx],[LIBUSB_MAJOR[.]LIBUSB_MINOR[.]LIBUSB_MICRO[]LIBUSB_RC],[libusbx-devel@lists.sourceforge.net],[libusbx],[http://libusbx.org])
# Library versioning
# These numbers should be tweaked on every release. Read carefully:
@@ -31,12 +31,12 @@ AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR([libusb/core.c])
AC_CONFIG_MACRO_DIR([m4])
-AM_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PREREQ([2.50])
AC_PROG_CC
-AC_PROG_LIBTOOL
+LT_INIT
LT_LANG([Windows Resource])
AC_C_INLINE
AM_PROG_CC_C_O
@@ -45,26 +45,34 @@ AC_DEFINE([_GNU_SOURCE], 1, [Use GNU extensions])
LTLDFLAGS="${LTLDFLAGS} -no-undefined"
AC_MSG_CHECKING([operating system])
+
case $host in
*-linux*)
AC_MSG_RESULT([Linux])
backend="linux"
+ threads="posix"
;;
*-darwin*)
AC_MSG_RESULT([Darwin/Mac OS X])
backend="darwin"
+ threads="posix"
;;
*-openbsd*)
AC_MSG_RESULT([OpenBSD])
- backend="openbsd"
+ backend="bsd"
+ threads="posix"
;;
*-netbsd*)
AC_MSG_RESULT([NetBSD (using OpenBSD backend)])
- backend="openbsd"
+ backend="bsd"
+ threads="posix"
;;
*-mingw*)
AC_MSG_RESULT([Windows])
backend="windows"
+ threads="windows"
+ create_import_lib="yes"
+ AM_CFLAGS="${AM_CFLAGS} -fno-omit-frame-pointer"
;;
*-cygwin*)
AC_MSG_RESULT([Cygwin (using Windows backend)])
@@ -74,22 +82,33 @@ case $host in
*)
AC_MSG_ERROR([unsupported operating system])
esac
+
case $backend in
linux)
AC_DEFINE(OS_LINUX, 1, [Linux backend])
AC_SUBST(OS_LINUX)
- AC_CHECK_LIB(rt, clock_gettime, PC_LIBS_PRIVATE="-lrt")
- threads="posix"
+ AC_SEARCH_LIBS(clock_gettime, rt, [], [], -pthread)
+ AC_ARG_ENABLE([udev],
+ [AC_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended, default: yes)])],
+ [], [enable_udev="yes"])
+ if test "x$enable_udev" = "xyes" ; then
+ # system has udev. use it or fail!
+ AC_CHECK_HEADERS([libudev.h],[],[AC_ERROR(["udev support requested but libudev not installed"])])
+ AC_CHECK_LIB([udev], [udev_new], [], [AC_ERROR(["udev support requested but libudev not installed"])])
+ AC_DEFINE(USE_UDEV, 1, [Use udev for device enumeration/hotplug])
+ else
+ AC_CHECK_HEADERS([linux/netlink.h linux/filter.h], [], [AC_ERROR(["Linux netlink headers not found"])])
+ fi
+ AC_SUBST(USE_UDEV)
THREAD_CFLAGS="-pthread"
- PC_LIBS_PRIVATE="${PC_LIBS_PRIVATE} -pthread"
+ LIBS="${LIBS} -pthread"
AC_CHECK_HEADERS([poll.h])
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
darwin)
AC_DEFINE(OS_DARWIN, 1, [Darwin backend])
AC_SUBST(OS_DARWIN)
- threads="posix"
- PC_LIBS_PRIVATE="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
+ LIBS="-lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
LTLDFLAGS="${LTLDFLAGS} -Wl,-prebind"
AC_CHECK_HEADERS([poll.h])
AC_CHECK_TYPE([nfds_t],
@@ -97,32 +116,32 @@ darwin)
[AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])],
[#include <poll.h>])
;;
-openbsd)
- AC_DEFINE(OS_OPENBSD, 1, [OpenBSD backend])
+bsd)
+ AC_DEFINE(OS_OPENBSD, 1, [OpenBSD/NetBSD backend])
AC_SUBST(OS_OPENBSD)
- threads="posix"
THREAD_CFLAGS="-pthread"
- PC_LIBS_PRIVATE="-pthread"
+ LIBS="-pthread"
AC_CHECK_HEADERS([poll.h])
AC_DEFINE([POLL_NFDS_TYPE],[nfds_t],[type of second poll() argument])
;;
windows)
AC_DEFINE(OS_WINDOWS, 1, [Windows backend])
AC_SUBST(OS_WINDOWS)
- PC_LIBS_PRIVATE=""
+ LIBS=""
LTLDFLAGS="${LTLDFLAGS} -avoid-version -Wl,--add-stdcall-alias"
AC_DEFINE([POLL_NFDS_TYPE],[unsigned int],[type of second poll() argument])
;;
esac
-AC_SUBST(THREAD_CFLAGS)
-AC_SUBST(PC_LIBS_PRIVATE)
-LIBS="${LIBS} ${PC_LIBS_PRIVATE}"
+
+AC_SUBST(LIBS)
AM_CONDITIONAL(OS_LINUX, test "x$backend" = xlinux)
AM_CONDITIONAL(OS_DARWIN, test "x$backend" = xdarwin)
-AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xopenbsd)
+AM_CONDITIONAL(OS_OPENBSD, test "x$backend" = xbsd)
AM_CONDITIONAL(OS_WINDOWS, test "x$backend" = xwindows)
AM_CONDITIONAL(THREADS_POSIX, test "x$threads" = xposix)
+AM_CONDITIONAL(CREATE_IMPORT_LIB, test "x$create_import_lib" = "xyes")
+AM_CONDITIONAL(USE_UDEV, test "x$enable_udev" = xyes)
if test "$threads" = posix; then
AC_DEFINE(THREADS_POSIX, 1, [Use POSIX Threads])
fi
@@ -166,11 +185,11 @@ if test "x$log_enabled" != "xno"; then
fi
AC_ARG_ENABLE([debug-log], [AS_HELP_STRING([--enable-debug-log],
- [enable debug logging (default n)])],
+ [start with debug message logging enabled (default n)])],
[debug_log_enabled=$enableval],
[debug_log_enabled='no'])
if test "x$debug_log_enabled" != "xno"; then
- AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Debug message logging])
+ AC_DEFINE([ENABLE_DEBUG_LOGGING], 1, [Start with debug message logging enabled])
fi
# Examples build
@@ -180,6 +199,13 @@ AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
[build_examples='no'])
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
+# Tests build
+AC_ARG_ENABLE([tests-build], [AS_HELP_STRING([--enable-tests-build],
+ [build test applications (default n)])],
+ [build_tests=$enableval],
+ [build_tests='no'])
+AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != "xno"])
+
# check for -fvisibility=hidden compiler support (GCC >= 3.4)
saved_cflags="$CFLAGS"
# -Werror required for cygwin
@@ -206,10 +232,10 @@ AM_CONDITIONAL([HAVE_SIGACTION], [test "x$have_sigaction" = "xyes"])
# headers not available on all platforms but required on others
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_FUNCS(gettimeofday)
+AC_CHECK_HEADERS([signal.h])
-AM_CFLAGS="-std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
+AM_CFLAGS="${AM_CFLAGS} -std=gnu99 -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow ${THREAD_CFLAGS} ${VISIBILITY_CFLAGS}"
-AC_SUBST(VISIBILITY_CFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(LTLDFLAGS)
@@ -217,6 +243,7 @@ AC_CONFIG_FILES([libusb-1.0.pc])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([libusb/Makefile])
AC_CONFIG_FILES([examples/Makefile])
+AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([doc/doxygen.cfg])
AC_OUTPUT