AC_SUBST(AM_CFLAGS)
+dnl--------------------------------------------------------------------------
+dnl Define language support for assembler.
+dnl
+dnl This is stolen from https://gitlab.crest.iu.edu/jsfiroz/hpx/commit/
+dnl 84be4345db6eec3797a57b8e53483cb43f4733bf
+
+AC_LANG_DEFINE([CPPAS], [cppas], [CPPAS], [CCAS], [C],
+ [ac_ext=S ac_cpp='$CPP $CPPFLAGS'
+ ac_compile='$CCAS -c $CCASFLAGS $CPPFLAGS dnl
+ conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ ac_link='$CCAS -oconftest$ac_exeext $CCASFLAGS $CPPFLAGS $LDFLAGS dnl
+ conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'])
+
+AC_DEFUN([AC_LANG_PREPROC(CPPAS)], [AC_REQUIRE([AC_PROG_CPP])])
+AC_DEFUN([AC_LANG_COMPILER(CPPAS)], [AC_REQUIRE([AM_PROG_AS])])
+AC_DEFUN([AC_LANG_CONFTEST(CPPAS)],
+ [cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$1
+_ACEOF])
+
+AC_CACHE_CHECK(
+ [whether the assembler is likely to work], [mdw_cv_gnuish_as],
+ [AC_LANG_PUSH([CPPAS])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ .text
+ .L\$_test = 23
+.macro mymac
+ .L\$_test = .L\$_test + 1
+.endm
+ .globl foo
+ .extern bar
+ mymac]])],
+ [mdw_cv_gnuish_as=yes], [mdw_cv_gnuish_as=no])
+ AC_LANG_POP([CPPAS])])
+AM_CONDITIONAL([GNUISH_AS], [test $mdw_cv_gnuish_as = yes])
+
dnl--------------------------------------------------------------------------
dnl Host-specific configuration.
[m4_undefine([catacomb_seen_abi/$3])])])
dnl Identify the current host.
-case $host_cpu,$host_os in
- m4_define([catacomb_CPU_CASE],
- [$1) CPUFAM=$2 ABI=$3 ;;
+if test $mdw_cv_gnuish_as = no; then
+ CPUFAM=nil ABI=nil
+else
+ case $host_cpu,$host_os in
+ m4_define([catacomb_CPU_CASE],
+ [$1) CPUFAM=$2 ABI=$3 ;;
])
- catacomb_CPU_FAMILIES([catacomb_CPU_CASE])
- *) CPUFAM=nil ABI=nil ;;
-esac
+ catacomb_CPU_FAMILIES([catacomb_CPU_CASE])
+ *) CPUFAM=nil ABI=nil ;;
+ esac
+fi
dnl Figure out the current CPU.
catacomb_CPU_FAMILIES([catacomb_CLEAR_FLAGS])
*) AC_MSG_RESULT([$CPUFAM/$ABI]) ;;
esac
-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--------------------------------------------------------------------------
+dnl CPU-specific assembler features.
+
+AC_LANG([CPPAS])
+
+case $CPUFAM in
+ armel)
+ AC_CACHE_CHECK(
+ [whether the assembler understands ARMv8 crypto extensions],
+ [mdw_cv_as_armv8_crypto],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ .arch armv8-a
+ .fpu crypto-neon-fp-armv8
+
+ .text
+ .globl foo
+foo:
+ vldmia r0, {d0-d3}
+ aese.8 q0, q1
+ aesmc.8 q0, q0
+ vstmia r0, {d0, d1}
+ bx r14]])],
+ [mdw_cv_as_armv8_crypto=yes],
+ [mdw_cv_as_armv8_crypto=no])])
+ ;;
+esac
+
+: ${mdw_cv_as_armv8_crypto=no}
+AM_CONDITIONAL([HAVE_AS_ARMV8_CRYPTO], [test $mdw_cv_as_armv8_crypto = yes])
+if test $mdw_cv_as_armv8_crypto = yes; then
+ AC_DEFINE([HAVE_AS_ARMV8_CRYPTO], [1],
+ [Define to 1 if your ARM assembler supports the ARMv8 crypto instructions.])
+fi
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])
dnl Find out whether very long integer types are available.
AC_CHECK_HEADERS([stdint.h])
AC_SUBST([have_stdint_h])
-AC_C_LONG_LONG
+AX_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.
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(
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.2.1])
AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS"