summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorDan Nicholson <[email protected]>2008-05-05 16:53:35 -0700
committerDan Nicholson <[email protected]>2008-05-05 16:57:07 -0700
commit7d016b76e22c0911f9a5ee024a2849096661ddd7 (patch)
tree764f2fb9fd088670b1df8e93c6a55afab5ff63f4 /configure.ac
parent113f5b14cbab2d62d5ca470f4b1f82989d3a50fe (diff)
autoconf: Sanitize asm build for cross-compiling and --enable-*-bit
Two fixes to the asm configuration: - Disable when the user is cross-compiling for x86 or x86_64 since it requires running an executable compiled for the target host. - If the user has specified --enable-32-bit on x86_64 or --enable-64-bit on x86, respect that and choose the correct asm architecture.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac115
1 files changed, 72 insertions, 43 deletions
diff --git a/configure.ac b/configure.ac
index bc2ebf6583f..b0f17f9286b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -207,13 +207,6 @@ if test "x$enable_debug" = xyes; then
CXXFLAGS="$CXXFLAGS -g"
fi
fi
-dnl These will be used near the end in the arch specific options
-AC_ARG_ENABLE([asm],
- [AS_HELP_STRING([--disable-asm],
- [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
- [enable_asm="$enableval"],
- [enable_asm=yes]
-)
dnl
dnl library names
@@ -809,62 +802,98 @@ fi
AC_SUBST([APP_LIB_DEPS])
AC_SUBST([PROGRAM_DIRS])
+dnl
dnl Arch/platform-specific settings
-PIC_FLAGS=""
+dnl
+AC_ARG_ENABLE([asm],
+ [AS_HELP_STRING([--disable-asm],
+ [disable assembly usage @<:@default=enabled on supported plaforms@:>@])],
+ [enable_asm="$enableval"],
+ [enable_asm=yes]
+)
+asm_arch=""
ASM_FLAGS=""
ASM_SOURCES=""
ASM_API=""
-AC_SUBST([PIC_FLAGS])
-AC_SUBST([ASM_FLAGS])
-AC_SUBST([ASM_SOURCES])
-AC_SUBST([ASM_API])
-case "$host_os" in
-linux*)
- PIC_FLAGS="-fPIC"
+AC_MSG_CHECKING([whether to enable assembly])
+test "x$enable_asm" = xno && AC_MSG_RESULT([no])
+# disable if cross compiling on x86/x86_64 since we must run gen_matypes
+if test "x$enable_asm" = xyes && test "x$cross_compiling" = xyes; then
case "$host_cpu" in
- i*86)
- if test "x$enable_asm" = xyes; then
- ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
- ASM_SOURCES='$(X86_SOURCES)'
- ASM_API='$(X86_API)'
- fi
+ i?86 | x86_64)
+ enable_asm=no
+ AC_MSG_RESULT([no, cross compiling])
+ ;;
+ esac
+fi
+# check for supported arches
+if test "x$enable_asm" = xyes; then
+ case "$host_cpu" in
+ i?86)
+ case "$host_os" in
+ linux* | freebsd* | dragonfly*)
+ test "x$enable_64bit" = xyes && asm_arch=x86_64 || asm_arch=x86
+ ;;
+ esac
;;
x86_64)
- if test "x$enable_asm" = xyes; then
- ASM_FLAGS="-DUSE_X86_64_ASM"
- ASM_SOURCES='$(X86-64_SOURCES)'
- ASM_API='$(X86-64_API)'
- fi
+ case "$host_os" in
+ linux* | freebsd* | dragonfly*)
+ test "x$enable_32bit" = xyes && asm_arch=x86 || asm_arch=x86_64
+ ;;
+ esac
;;
powerpc)
- if test "x$enable_asm" = xyes; then
- ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
- ASM_SOURCES='$(PPC_SOURCES)'
- fi
+ case "$host_os" in
+ linux*)
+ asm_arch=ppc
+ ;;
+ esac
+ ;;
+ esac
+
+ case "$asm_arch" in
+ x86)
+ ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
+ ASM_SOURCES='$(X86_SOURCES)'
+ ASM_API='$(X86_API)'
+ AC_MSG_RESULT([yes, x86])
+ ;;
+ x86_64)
+ ASM_FLAGS="-DUSE_X86_64_ASM"
+ ASM_SOURCES='$(X86-64_SOURCES)'
+ ASM_API='$(X86-64_API)'
+ AC_MSG_RESULT([yes, x86_64])
+ ;;
+ ppc)
+ ASM_FLAGS="-DUSE_PPC_ASM -DUSE_VMX_ASM"
+ ASM_SOURCES='$(PPC_SOURCES)'
+ AC_MSG_RESULT([yes, ppc])
+ ;;
+ *)
+ AC_MSG_RESULT([no, platform not supported])
;;
esac
+fi
+AC_SUBST([ASM_FLAGS])
+AC_SUBST([ASM_SOURCES])
+AC_SUBST([ASM_API])
+
+PIC_FLAGS=""
+case "$host_os" in
+linux*)
+ PIC_FLAGS="-fPIC"
;;
freebsd* | dragonfly*)
PIC_FLAGS="-fPIC"
case "$host_cpu" in
- i*86)
+ i?86)
PIC_FLAGS=""
- if test "x$enable_asm" = xyes; then
- ASM_FLAGS="-DUSE_X86_ASM -DUSE_MMX_ASM -DUSE_3DNOW_ASM -DUSE_SSE_ASM"
- ASM_SOURCES='$(X86_SOURCES)'
- ASM_API='$(X86_API)'
- fi
- ;;
- x86_64)
- if test "x$enable_asm" = xyes; then
- ASM_FLAGS="-DUSE_X86_64_ASM"
- ASM_SOURCES='$(X86-64_SOURCES)'
- ASM_API='$(X86-64_API)'
- fi
;;
esac
;;
esac
+AC_SUBST([PIC_FLAGS])
dnl Restore LDFLAGS and CPPFLAGS
LDFLAGS="$_SAVE_LDFLAGS"