Enable assembler code only if it is known to work
authorLasse Collin <lasse.collin@tukaani.org>
Sun, 22 Nov 2009 10:00:30 +0000 (12:00 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Sun, 22 Nov 2009 10:00:30 +0000 (12:00 +0200)
on that operating system.

I'm too lazy to think how to make a good Autoconf test
for this and it's not that important anyway.

No longer define HAVE_ASM_X86 or HAVE_ASM_X86_64.
Inline assembler (if any) is used if a macro like
__i386__ or __x86_64__ is defined.

configure.ac

index aa05ba4..706ab5a 100644 (file)
@@ -288,29 +288,27 @@ AC_ARG_ENABLE([assembler], AC_HELP_STRING([--disable-assembler],
                for the architecture.]),
        [], [enable_assembler=yes])
 if test "x$enable_assembler" = xyes; then
-       case $host_cpu in
-               i?86)   enable_assembler=x86 ;;
-               x86_64) enable_assembler=x86_64 ;;
-               *)      enable_assembler=no ;;
+       enable_assembler=no
+       case $host_os in
+               # Darwin should work too but only if not creating universal
+               # binaries. Solaris x86 could work too but I cannot test.
+               linux* | *bsd* | mingw* | cygwin*)
+                       case $host_cpu in
+                               i?86)   enable_assembler=x86 ;;
+                               x86_64) enable_assembler=x86_64 ;;
+                       esac
+                       ;;
        esac
 fi
 case $enable_assembler in
-       x86)
-               AC_DEFINE([HAVE_ASM_X86], [1],
-                       [Define to 1 if using x86 assembler optimizations.])
-               ;;
-       x86_64)
-               AC_DEFINE([HAVE_ASM_X86_64], [1],
-                       [Define to 1 if using x86_64 assembler optimizations.])
-               ;;
-       no)
+       x86 | x86_64 | no)
+               AC_MSG_RESULT([$enable_assembler])
                ;;
        *)
                AC_MSG_RESULT([])
                AC_MSG_ERROR([--enable-assembler accepts only \`yes', \`no', \`x86', or \`x86_64'.])
                ;;
 esac
-AC_MSG_RESULT([$enable_assembler])
 AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86)
 AM_CONDITIONAL(COND_ASM_X86_64, test "x$enable_assembler" = xx86_64)