path: root/configure
diff options
authorAndre McCurdy <>2015-04-21 10:34:05 -0700
committerRich Felker <>2015-04-21 13:38:48 -0400
commita6274a1971b7aa1d12fdce3d040f847539a71049 (patch)
treeadc522bcde7a7d91fc665fb2fb32cc8d0731ddd4 /configure
parentea1b6bb6123d2177508ddca438669ec96cfa0021 (diff)
configure: check for -march and -mtune passed via CC
Some build environments pass -march and -mtune as part of CC, therefore update configure to check both CC and CFLAGS before making the decision to fall back to generic -march and -mtune options for x86. Signed-off-by: Andre McCurdy <>
Diffstat (limited to 'configure')
1 files changed, 4 insertions, 2 deletions
diff --git a/configure b/configure
index e35c9b63..f325cda3 100755
--- a/configure
+++ b/configure
@@ -391,10 +391,12 @@ tryflag CFLAGS_AUTO -Wa,--noexecstack
# extensions enabled by default. This is bad for making static binaries.
# We cheat and use i486 rather than i386 because i386 really does not
# work anyway (issues with atomic ops).
+# Some build environments pass -march and -mtune options via CC, so
+# check both CC and CFLAGS.
if test "$ARCH" = "i386" ; then
-fnmatch '-march=*|*\ -march=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -march=i486
-fnmatch '-mtune=*|*\ -mtune=*' "$CFLAGS" || tryldflag CFLAGS_AUTO -mtune=generic
+fnmatch '-march=*|*\ -march=*' "$CC $CFLAGS" || tryldflag CFLAGS_AUTO -march=i486
+fnmatch '-mtune=*|*\ -mtune=*' "$CC $CFLAGS" || tryldflag CFLAGS_AUTO -mtune=generic