configure: regroup library checks
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 18 Mar 2021 23:00:14 +0000 (19:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 19 Mar 2021 18:32:11 +0000 (14:32 -0400)
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

Change-Id: Iea3c5f5348426b7cbefabb60a7c9b33e179e6650
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac

index 10d4ff0041b1b5507733dd131739fb41dfb1898f..c7492df594c081bcd9a723a4dd1e40ef4bc704c0 100644 (file)
@@ -132,9 +132,40 @@ AC_SUBST([NPROC_CMD], [$NPROC_CMD])
 LT_INIT
 
 
+##                ##
+## Library checks ##
+##                ##
+
+# Checks for library functions.
+AC_FUNC_MMAP
+AC_FUNC_FORK
+AC_CHECK_FUNCS([ \
+       atexit \
+       getcpuid \
+       gettid \
+       gettimeofday \
+       memeset \
+       memset \
+       munmap \
+       rand_r \
+       sched_getcpu \
+       strerror \
+       strtoul \
+       sysconf \
+])
+
+# AC_FUNC_MALLOC causes problems when cross-compiling.
+#AC_FUNC_MALLOC
+
+# Search for clock_gettime() in -lrt
+AC_SEARCH_LIBS([clock_gettime], [rt], [
+  AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1], [clock_gettime() is detected.])
+])
+
+
+
 AH_TEMPLATE([CONFIG_RCU_SMP], [Enable SMP support. With SMP support enabled, uniprocessors are also supported. With SMP support disabled, UP systems work fine, but the behavior of SMP systems is undefined.])
 AH_TEMPLATE([CONFIG_RCU_TLS], [TLS provided by the compiler.])
-AH_TEMPLATE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [clock_gettime() is detected.])
 AH_TEMPLATE([CONFIG_RCU_FORCE_SYS_MEMBARRIER], [Require the operating system to support the membarrier system call for default and bulletproof flavors.])
 AH_TEMPLATE([CONFIG_RCU_DEBUG], [Enable internal debugging self-checks. Introduces a performance penalty.])
 AH_TEMPLATE([CONFIG_CDS_LFHT_ITER_DEBUG], [Enable extra debugging checks for lock-free hash table iterator traversal. Alters the rculfhash ABI. Make sure to compile both library and application with matching configuration.])
@@ -158,33 +189,6 @@ AS_IF([test "x$def_compiler_tls" = "xyes"], AC_DEFINE([CONFIG_RCU_TLS], [1]), [:
 
 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
 
-# Checks for library functions.
-AC_FUNC_MMAP
-AC_FUNC_FORK
-AC_CHECK_FUNCS([ \
-       atexit \
-       getcpuid \
-       gettid \
-       gettimeofday \
-       memeset \
-       memset \
-       munmap \
-       rand_r \
-       sched_getcpu \
-       strerror \
-       strtoul \
-       sysconf \
-])
-
-# AC_FUNC_MALLOC causes problems when cross-compiling.
-#AC_FUNC_MALLOC
-
-# Search for clock_gettime
-AC_SEARCH_LIBS([clock_gettime], [rt], [
-       AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1])
-       config_rcu_have_clock_gettime=yes
-], [])
-
 AM_CONDITIONAL([NO_SHARED], [test "x$enable_shared" = "xno"])
 
 # smp-support configure option
@@ -435,7 +439,7 @@ test "x$def_compiler_tls" = "xyes" && value="compiler TLS" || value="pthread_get
 PPRINT_PROP_STRING([Thread Local Storage (TLS)], [$value])
 
 # clock_gettime() available
-test "x$config_rcu_have_clock_gettime" = "xyes" && value=1 || value=0
+test "x$ac_cv_search_function_clock_gettime" != "xno" && value=1 || value=0
 PPRINT_PROP_BOOL([clock_gettime()], $value)
 
 # Require membarrier
This page took 0.02703 seconds and 4 git commands to generate.