summaryrefslogtreecommitdiff
path: root/m4/ax_gcc_archflag.m4
diff options
context:
space:
mode:
authorTsukasa OI <li@livegrid.org>2014-08-15 18:05:14 +0900
committerPeter Simons <simons@cryp.to>2014-10-15 11:07:21 +0200
commit7354d36876d85610b456150f7c1f87aba34463a3 (patch)
tree4520044e0c75a58a54c9efdd5e6740319861f229 /m4/ax_gcc_archflag.m4
parentd061ba9cc582a323ea42d1a37decf1c97e38c3cd (diff)
downloadautoconf-archive-7354d36876d85610b456150f7c1f87aba34463a3.tar.gz
AX_GCC_ARCHFLAG: reorder option checking for Clang
LLVM Clang does not fail if -mcpu=UNKNOWN or -mtune=UNKNOWN is specified. This will result in "no CPU tuning". This fix changes order of option checking to support LLVM Clang.
Diffstat (limited to 'm4/ax_gcc_archflag.m4')
-rw-r--r--m4/ax_gcc_archflag.m423
1 files changed, 12 insertions, 11 deletions
diff --git a/m4/ax_gcc_archflag.m4 b/m4/ax_gcc_archflag.m4
index 5225144..f8f892e 100644
--- a/m4/ax_gcc_archflag.m4
+++ b/m4/ax_gcc_archflag.m4
@@ -64,7 +64,7 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 15
+#serial 16
AC_DEFUN([AX_GCC_ARCHFLAG],
[AC_REQUIRE([AC_PROG_CC])
@@ -205,16 +205,17 @@ fi # not cross-compiling
fi # guess arch
if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
-for arch in $ax_gcc_arch; do
- if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
- flags="-mtune=$arch"
- # -mcpu=$arch and m$arch generate nonportable code on every arch except
- # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
- case $host_cpu in i*86|x86_64*|amd64*) flags="$flags -mcpu=$arch -m$arch";; esac
- else
- flags="-march=$arch -mcpu=$arch -m$arch"
- fi
- for flag in $flags; do
+if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
+ flag_prefixes="-mtune="
+ # -mcpu=$arch and m$arch generate nonportable code on every arch except
+ # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
+ case $host_cpu in i*86|x86_64*|amd64*) flag_prefixes="$flag_prefixes -mcpu= -m";; esac
+else
+ flag_prefixes="-march= -mcpu= -m"
+fi
+for flag_prefix in $flag_prefixes; do
+ for arch in $ax_gcc_arch; do
+ flag="$flag_prefix$arch"
AX_CHECK_COMPILE_FLAG($flag, [ax_cv_gcc_archflag=$flag; break])
done
test "x$ax_cv_gcc_archflag" = xunknown || break