configure.ac: Segregate checks by source language better.
[catacomb] / configure.ac
index b76c561..f5d004f 100644 (file)
@@ -31,7 +31,7 @@ mdw_AUTO_VERSION
 AC_INIT([catacomb], AUTO_VERSION, [mdw@distorted.org.uk])
 AC_CONFIG_SRCDIR([catacomb.pc.in])
 AC_CONFIG_AUX_DIR([config])
-AM_INIT_AUTOMAKE([foreign parallel-tests])
+AM_INIT_AUTOMAKE([foreign parallel-tests color-tests subdir-objects])
 AC_CANONICAL_HOST
 mdw_SILENT_RULES
 
@@ -55,7 +55,12 @@ dnl The table of CPU families and ABIs which we might support.  Support is
 dnl not uniform: each dispatched function might or might not have an
 dnl implementation for any particular CPU/ABI combination.
 AC_DEFUN([catacomb_CPU_FAMILIES],
-  [$1([i[[3-6]]86,*], [x86], [sysv])])
+  [$1([i[[3-6]]86,cygwin], [x86], [win])
+   $1([i[[3-6]]86,*], [x86], [sysv])
+   $1([x86_64,cygwin], [amd64], [win])
+   $1([x86_64,*], [amd64], [sysv])
+   $1([arm,*-gnueabi | arm,*-gnueabihf | dnl
+       armv*,*-gnueabi | armv*,*-gnueabihf], [armel], [gnueabi])])
 
 dnl A utility to clear the `seen' flags, used so as to process each CPU or
 dnl ABI once.
@@ -128,6 +133,10 @@ esac
 dnl--------------------------------------------------------------------------
 dnl C programming environment.
 
+AC_LANG([C])
+
+CATACOMB_LIBS=
+
 dnl Find out if we're cross-compiling.
 AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
 
@@ -149,6 +158,12 @@ AC_CHECK_HEADERS([stdint.h])
 AC_SUBST([have_stdint_h])
 AC_C_LONG_LONG
 
+dnl Some equipment wanted for checking CPU features at runtime.
+AC_CHECK_HEADERS([asm/hwcap.h])
+AC_CHECK_HEADERS([sys/auxv.h])
+AC_CHECK_HEADERS([linux/auxvec.h])
+AC_CHECK_FUNCS([getauxval])
+
 dnl Find the bit lengths of the obvious integer types.  This will be useful
 dnl when deciding on a representation for multiprecision integers.
 type_bits="" type_bits_sep=""
@@ -210,6 +225,15 @@ AC_SUBST([limits])
 
 dnl Functions used for noise-gathering.
 AC_CHECK_FUNCS([setgroups])
+AC_CHECK_HEADERS([linux/random.h])
+mdw_ORIG_LIBS=$LIBS LIBS=$CATACOMB_LIBS
+AC_SEARCH_LIBS([clock_gettime], [rt])
+CATACOMB_LIBS=$LIBS LIBS=$mdw_ORIG_LIBS
+if test "$ac_cv_search_clock_gettime" != no; then
+  AC_DEFINE([HAVE_CLOCK_GETTIME], [1],
+           [Define if you have the \`clock_gettime' function.])
+fi
+AC_CHECK_FUNCS([getentropy])
 AC_CACHE_CHECK([whether the freewheel noise generator will work],
        [catacomb_cv_freewheel],
 [AC_TRY_LINK(
@@ -237,8 +261,11 @@ LIBS=$mdw_ORIG_LIBS
 dnl Memory locking support.
 AC_CHECK_FUNCS([mlock])
 
+dnl Set the master libraries we need.
+AC_SUBST([CATACOMB_LIBS])
+
 dnl Necessary support libraries.
-PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
+PKG_CHECK_MODULES([mLib], [mLib >= 2.2.2.1])
 AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS"
 
 dnl--------------------------------------------------------------------------