Fix: Add failover for platforms without nproc
[userspace-rcu.git] / configure.ac
index fcad176c16e6c5aac0e349a084d32cd8d146c79a..3cc8dd2a062ae9fa2fdaa43ca672e8fec3d86f2d 100644 (file)
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
-AC_INIT([userspace-rcu],[0.9.1],[mathieu dot desnoyers at efficios dot com], [], [http://liburcu.org/])
+AC_INIT([userspace-rcu],[0.9.2],[mathieu dot desnoyers at efficios dot com], [], [http://liburcu.org/])
 
 # Following the numbering scheme proposed by libtool for the library version
 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
@@ -25,6 +25,7 @@ AH_TEMPLATE([CONFIG_RCU_HAVE_FUTEX], [Defined when on a system with futex suppor
 AH_TEMPLATE([CONFIG_RCU_COMPAT_ARCH], [Compatibility mode for i386 which lacks cmpxchg instruction.])
 AH_TEMPLATE([CONFIG_RCU_ARM_HAVE_DMB], [Use the dmb instruction if available for use on ARM.])
 AH_TEMPLATE([CONFIG_RCU_TLS], [TLS provided by the compiler.])
+AH_TEMPLATE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [clock_gettime() is detected.])
 
 # Allow overriding storage used for TLS variables.
 AC_ARG_ENABLE([compiler-tls],
@@ -50,6 +51,16 @@ AC_PROG_CC_STDC
 AC_PROG_AWK
 AC_PROG_MAKE_SET
 AC_CHECK_PROGS(NPROC, [nproc gnproc])
+AC_CHECK_PROGS(GETCONF, [getconf])
+AS_IF([test "x$NPROC" != "x"],
+       [NPROC_CMD=$NPROC],
+       [AS_IF([test "x$GETCONF" != "x"],
+               [NPROC_CMD="$GETCONF _NPROCESSORS_ONLN"],
+               [NPROC_CMD="echo 1"]
+       )]
+)
+AC_SUBST([NPROC_CMD], [$NPROC_CMD])
+
 LT_INIT
 
 # Checks for typedefs, structures, and compiler characteristics.
@@ -121,7 +132,7 @@ AS_CASE([$host_cpu],
        [alpha*], [ARCHTYPE="alpha"],
        [ia64], [ARCHTYPE="ia64"],
        [arm*], [ARCHTYPE="arm"],
-       [aarch64], [ARCHTYPE="aarch64"],
+       [aarch64*], [ARCHTYPE="aarch64"],
        [mips*], [ARCHTYPE="mips"],
        [tile*], [ARCHTYPE="tile"],
        [hppa*], [ARCHTYPE="hppa"],
@@ -133,6 +144,11 @@ AS_CASE([$host],[*-*-linux-androideabi],
        [AM_CONDITIONAL(TARGET_IS_ANDROID, false)]
 )
 
+AS_CASE([$host],[*-cygwin*],
+       [AM_CONDITIONAL(USE_CYGWIN, true)],
+       [AM_CONDITIONAL(USE_CYGWIN, false)]
+)
+
 AC_SUBST(ARCHTYPE)
 AC_SUBST(SUBARCHTYPE)
 
@@ -215,9 +231,9 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 ])
 
 # Search for clock_gettime
-AC_SEARCH_LIBS([clock_gettime], [rt], [],
-       [AC_MSG_ERROR([Cannot find clock_gettime function.])]
-)
+AC_SEARCH_LIBS([clock_gettime], [rt], [
+       AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1])
+], [])
 
 # Check for pthread
 AC_CHECK_LIB([pthread], [pthread_create],
This page took 0.023782 seconds and 4 git commands to generate.