From: Michael Jeanson Date: Thu, 18 Mar 2021 23:00:14 +0000 (-0400) Subject: configure: regroup library checks X-Git-Tag: v0.13.0~33 X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=commitdiff_plain;h=c673679bdf8346feb043b9fac34f2ddb8eeca4ea configure: regroup library checks This is part of an effort to standardise our autotools setup across project to simplify maintenance. Change-Id: Iea3c5f5348426b7cbefabb60a7c9b33e179e6650 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index 10d4ff0..c7492df 100644 --- a/configure.ac +++ b/configure.ac @@ -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