aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac46
1 files changed, 40 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 5b880f6..d4f1251 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,6 +124,7 @@ case $host in
platform=windows
test "x$enable_shared" = xyes && create_import_lib=yes
EXTRA_CFLAGS="-mwin32 -fno-omit-frame-pointer"
+ EXTRA_LDFLAGS="-static-libgcc"
;;
*)
AC_MSG_RESULT([Null])
@@ -152,6 +153,7 @@ if test "x$platform" = xposix; then
AC_SEARCH_LIBS([pthread_create], [pthread],
[test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
[], [])
+ AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
elif test "x$platform" = xwindows; then
AC_DEFINE([PLATFORM_WINDOWS], [1], [Define to 1 if compiling for a Windows platform.])
else
@@ -161,7 +163,8 @@ fi
case $backend in
darwin)
AC_CHECK_FUNCS([pthread_threadid_np])
- LIBS="${LIBS} -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation"
+ LIBS="${LIBS} -lobjc -Wl,-framework,IOKit -Wl,-framework,CoreFoundation -Wl,-framework,Security"
+ AC_CHECK_HEADERS([IOKit/usb/IOUSBHostFamilyDefinitions.h])
;;
haiku)
LIBS="${LIBS} -lbe"
@@ -170,12 +173,20 @@ linux)
AC_SEARCH_LIBS([clock_gettime], [rt], [], [], [])
AC_CHECK_FUNCS([pthread_setname_np])
AC_ARG_ENABLE([udev],
- [AC_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended) [default=yes]])],
+ [AS_HELP_STRING([--enable-udev], [use udev for device enumeration and hotplug support (recommended) [default=yes]])],
[use_udev=$enableval], [use_udev=yes])
if test "x$use_udev" = xyes; then
dnl system has udev. use it or fail!
AC_CHECK_HEADER([libudev.h], [], [AC_MSG_ERROR([udev support requested but libudev header not installed])])
AC_CHECK_LIB([udev], [udev_new], [], [AC_MSG_ERROR([udev support requested but libudev not installed])])
+
+ # We can build umockdev tests (if available)
+ PKG_PROG_PKG_CONFIG
+ PKG_CHECK_MODULES(UMOCKDEV, umockdev-1.0 >= 0.16.0, ac_have_umockdev=yes, ac_have_umockdev=no)
+ PKG_CHECK_MODULES(UMOCKDEV_HOTPLUG, umockdev-1.0 >= 0.17.7, ac_umockdev_hotplug=yes, ac_umockdev_hotplug=no)
+ if test "x$ac_umockdev_hotplug" = xyes; then
+ AC_DEFINE([UMOCKDEV_HOTPLUG], [1], [UMockdev hotplug code is not racy])
+ fi
else
AC_CHECK_HEADERS([asm/types.h])
AC_CHECK_HEADER([linux/netlink.h], [], [AC_MSG_ERROR([Linux netlink header not found])])
@@ -199,17 +210,37 @@ dnl headers not available on all platforms but required on others
AC_CHECK_HEADERS([sys/time.h])
if test "x$platform" = xposix; then
- dnl the clock_gettime() function needs certain clock IDs defined
- AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes], [have_clock_gettime=])
+ dnl check availability of clock_gettime()
+ if test "x$backend" = xdarwin; then
+ dnl need to verify that OS X target is 10.12 or later for clock_gettime()
+ AC_MSG_CHECKING([whether OS X target version is 10.12 or later])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+ #include <AvailabilityMacros.h>
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
+ # error "Target OS X version is too old"
+ #endif
+ ], [])],
+ [AC_MSG_RESULT([yes])
+ osx_10_12_or_later=yes],
+ [AC_MSG_RESULT([no])
+ osx_10_12_or_later=])
+ if test "x$osx_10_12_or_later" = xyes; then
+ AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes], [have_clock_gettime=])
+ else
+ AC_MSG_NOTICE([clock_gettime() is not available on target OS X version])
+ fi
+ else
+ AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes], [AC_MSG_ERROR([clock_gettime() is required on this platform])])
+ fi
+
if test "x$have_clock_gettime" = xyes; then
+ dnl the clock_gettime() function needs certain clock IDs defined
AC_CHECK_DECL([CLOCK_MONOTONIC], [], [AC_MSG_ERROR([C library headers missing definition for CLOCK_MONOTONIC])], [[#include <time.h>]])
dnl use the monotonic clock for condition variable timed waits if possible
AC_CHECK_FUNCS([pthread_condattr_setclock], [need_clock_realtime=], [need_clock_realtime=yes])
if test "x$need_clock_realtime" = xyes; then
AC_CHECK_DECL([CLOCK_REALTIME], [], [AC_MSG_ERROR([C library headers missing definition for CLOCK_REALTIME])], [[#include <time.h>]])
fi
- elif test "x$backend" != xdarwin; then
- AC_MSG_ERROR([clock_gettime() is required on this platform])
fi
fi
@@ -335,6 +366,7 @@ AC_ARG_ENABLE([tests-build],
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != xno])
AM_CONDITIONAL([BUILD_TESTS], [test "x$build_tests" != xno])
+AM_CONDITIONAL([BUILD_UMOCKDEV_TEST], [test "x$ac_have_umockdev" = xyes -a "x$log_enabled" != xno])
AM_CONDITIONAL([CREATE_IMPORT_LIB], [test "x$create_import_lib" = xyes])
AM_CONDITIONAL([OS_DARWIN], [test "x$backend" = xdarwin])
AM_CONDITIONAL([OS_HAIKU], [test "x$backend" = xhaiku])
@@ -372,6 +404,8 @@ AC_SUBST(AM_CXXFLAGS)
AC_SUBST(LT_LDFLAGS)
+AC_SUBST([EXTRA_LDFLAGS])
+
dnl set name of html output directory for doxygen
AC_SUBST(DOXYGEN_HTMLDIR, [api-1.0])