configure: regroup and expand C header and program checks
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 18 Mar 2021 22:40:47 +0000 (18:40 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 19 Mar 2021 18:32:05 +0000 (14:32 -0400)
This is part of an effort to standardise our autotools setup across
project to simplify maintenance.

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

index b587e9e7a9e4550cf2b833abe6473c88271ac484..10d4ff0041b1b5507733dd131739fb41dfb1898f 100644 (file)
@@ -97,6 +97,41 @@ AC_TYPE_UINT64_T
 AC_TYPE_UINT8_T
 
 
 AC_TYPE_UINT8_T
 
 
+##               ##
+## Header checks ##
+##               ##
+
+AC_HEADER_STDBOOL
+AC_CHECK_HEADERS([ \
+       limits.h \
+       stddef.h \
+       sys/param.h \
+       sys/time.h \
+])
+
+
+##                 ##
+## Programs checks ##
+##                 ##
+
+AC_PROG_AWK
+AC_PROG_GREP
+AC_PROG_MAKE_SET
+AC_CHECK_PROGS(NPROC, [nproc gnproc])
+AC_CHECK_PROG(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])
+
+# Initialize and configure libtool
+LT_INIT
+
+
 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_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.])
@@ -120,21 +155,6 @@ AC_ARG_ENABLE([compiler-tls],
 
 AS_IF([test "x$def_compiler_tls" = "xyes"], AC_DEFINE([CONFIG_RCU_TLS], [1]), [:])
 
 
 AS_IF([test "x$def_compiler_tls" = "xyes"], AC_DEFINE([CONFIG_RCU_TLS], [1]), [:])
 
-# Checks for programs.
-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
 
 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
 
 
 AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
 
@@ -159,15 +179,6 @@ AC_CHECK_FUNCS([ \
 # AC_FUNC_MALLOC causes problems when cross-compiling.
 #AC_FUNC_MALLOC
 
 # AC_FUNC_MALLOC causes problems when cross-compiling.
 #AC_FUNC_MALLOC
 
-# Check for headers
-AC_HEADER_STDBOOL
-AC_CHECK_HEADERS([ \
-       limits.h \
-       stddef.h \
-       sys/param.h \
-       sys/time.h \
-])
-
 # Search for clock_gettime
 AC_SEARCH_LIBS([clock_gettime], [rt], [
        AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1])
 # Search for clock_gettime
 AC_SEARCH_LIBS([clock_gettime], [rt], [
        AC_DEFINE([CONFIG_RCU_HAVE_CLOCK_GETTIME], [1])
This page took 0.027146 seconds and 4 git commands to generate.