X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb/blobdiff_plain/373641eaacc86b56715a2ebf0b603fce25c16051..814bf4c5e6e79dd20661786a5a32b5b287d252da:/configure.ac diff --git a/configure.ac b/configure.ac index bd2c3b5c..40353daa 100644 --- a/configure.ac +++ b/configure.ac @@ -67,27 +67,9 @@ AC_DEFUN([AC_LANG_CONFTEST(CPPAS)], $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]) - 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. @@ -108,47 +90,73 @@ m4_ifdef([catacomb_seen_abi/$3], [m4_undefine([catacomb_seen_abi/$3])])]) dnl Identify the current host. -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 ;; +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 -fi + catacomb_CPU_FAMILIES([catacomb_CPU_CASE]) + *) CPUFAM=nil ABI=nil ;; +esac -dnl Figure out the current CPU. -catacomb_CPU_FAMILIES([catacomb_CLEAR_FLAGS]) -case $CPUFAM in - m4_define([catacomb_DEFINE_CPU], - [m4_ifdef([catacomb_seen_cpu/$2], [], - [$2) - AC_DEFINE([CPUFAM_]m4_translit([$2], [a-z], [A-Z]), [1], - [Define if host CPU family is \`$2\'.]) - ;;m4_define([catacomb_seen_cpu/$2], [t])])]) - catacomb_CPU_FAMILIES([catacomb_DEFINE_CPU]) +dnl Now check the assembler. We have target-specific requirements here, so +dnl we couldn't do this any earlier. +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]) + case $CPUFAM in + x86 | amd64) + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ + .text + .arch pentium4 + .intel_syntax noprefix + .globl foo +foo: + adcd var, 0 + ret + .data +var: .long 1 + ]])], + [:], [mdw_cv_gnuish_as=no]) + ;; + esac + AC_LANG_POP([CPPAS])]) +AM_CONDITIONAL([GNUISH_AS], [test $mdw_cv_gnuish_as = yes]) +if test $mdw_cv_gnuish_as = no; then CPUFAM=nil ABI=nil; fi + +dnl A hairy macro used to set the `CPUFAM_...' and `ABI_...' variables. We +dnl basically need to do the same thing for the family and ABI, so it's worth +dnl some effort to hide the ugliness. +m4_define([catacomb_DEFINE_CPU_OR_ABI], +[case $$1 in + m4_define([_def], + [m4_ifdef([catacomb_seen_$3/$$2], [], + [$$2) + AC_DEFINE([$4]m4_translit([$$2], [a-z], [A-Z]), [1], [$5]) + ;;m4_define([catacomb_seen_$3/$$2], [t])])]) + catacomb_CPU_FAMILIES([_def]) nil) ;; - *) AC_MSG_ERROR([BUG: unexpected cpufam \`$CPUFAM']) ;; -esac -AC_SUBST([CPUFAM]) + *) AC_MSG_ERROR([BUG: unexpected $1 \`$1']) ;; +esac]) -dnl Figure out the current ABI. +dnl Now that's out the way, we can explain what we're doing. +AC_MSG_CHECKING([CPU family and ABI]) + +dnl Figure out the target CPU family and ABI. catacomb_CPU_FAMILIES([catacomb_CLEAR_FLAGS]) -case $ABI in - m4_define([catacomb_DEFINE_ABI], - [m4_ifdef([catacomb_seen_abi/$3], [], - [$3) - AC_DEFINE([ABI_]m4_translit([$3], [a-z], [A-Z]), [1], - [Define if host ABI variant is \`$3\'.]) - ;;m4_define([catacomb_seen_abi/$3], [t])])]) - catacomb_CPU_FAMILIES([catacomb_DEFINE_ABI]) - nil) ;; - *) AC_MSG_ERROR([BUG: unexpected ABI \`$ABI']) ;; -esac -AC_SUBST([ABI]) +catacomb_DEFINE_CPU_OR_ABI([CPUFAM], [2], [cpu], + [CPUFAM_], [Define if target CPU is \`$][2\'.]) +catacomb_DEFINE_CPU_OR_ABI([ABI], [3], [abi], + [ABI_], [Define if target ABI is \`$][3\'.]) dnl Establish Automake conditions for things. catacomb_CPU_FAMILIES([catacomb_CLEAR_FLAGS]) @@ -360,6 +368,12 @@ LIBS=$mdw_ORIG_LIBS dnl Memory locking support. AC_CHECK_FUNCS([mlock]) +dnl See if we can find Valgrind's header files. +AC_CHECK_HEADER([valgrind/memcheck.h], + AC_DEFINE([HAVE_VALGRIND_H], [1], + [Define if the Valgrind header files are available.]) + []) + dnl Set the master libraries we need. AC_SUBST([CATACOMB_LIBS])