From 7a5af13c85ee4d42e032ecbc790ec845110ed0ba Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 26 May 2016 09:26:09 +0100 Subject: [PATCH] configure.ac: Check that the chosen assembler will actually work. If the system assembler doesn't like the GNUish directive syntax I'm using, then the build will fail badly and be hard to fix. Now, if the assembler doesn't look like it's going to work, then declare the target platform to be unknown so as to disable all of this fancy machinery. --- configure.ac | 53 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 47 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index f5d004f0..1802a8a0 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,43 @@ AC_PROG_YACC 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. AC_MSG_CHECKING([CPU family and ABI]) @@ -71,13 +108,17 @@ m4_ifdef([catacomb_seen_abi/$3], [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]) -- 2.11.0