From 1f94239d20d3b769ef0b0f9627eb8eda5d389885 Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 8 Nov 2012 22:09:22 +0100 Subject: [PATCH] configure: differentiate gcc and clang options The version checking was made similarly for clang and gcc. This patch modifies this to check on compiler name. This way we can avoid to set march=native which is not supported by clang on some system. At the same time, this fix the annoying warning about no-fp-tree being unsupported by clang. --- configure.ac | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/configure.ac b/configure.ac index 52fdf09a06..3aa62b45cc 100644 --- a/configure.ac +++ b/configure.ac @@ -35,24 +35,30 @@ AC_INIT(configure.ac) echo ]) - dnl get gcc version - AC_MSG_CHECKING([gcc version]) - gccver=$($CC -dumpversion) - gccvermajor=$(echo $gccver | cut -d . -f1) - gccverminor=$(echo $gccver | cut -d . -f2) - gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor) - AC_MSG_RESULT($gccver) - - if test "$gccvernum" -ge "400"; then - dnl gcc 4.0 or later - CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration" - else - CFLAGS="$CFLAGS -W" + if test `basename $CC` = "clang"; then + CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration" fi + if test `basename $CC` = "gcc"; then + dnl get gcc version + AC_MSG_CHECKING([gcc version]) + gccver=$($CC -dumpversion) + gccvermajor=$(echo $gccver | cut -d . -f1) + gccverminor=$(echo $gccver | cut -d . -f2) + gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor) + AC_MSG_RESULT($gccver) + + if test "$gccvernum" -ge "400"; then + dnl gcc 4.0 or later + CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration" + else + CFLAGS="$CFLAGS -W" + fi - # remove optimization options that break our code - # VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code. - CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -fno-tree-pre" + # remove optimization options that break our code + # VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code. + CFLAGS="$CFLAGS -fno-tree-pre" + fi + CFLAGS="$CFLAGS -Wall -fno-strict-aliasing" CFLAGS="$CFLAGS -Wno-unused-parameter" CFLAGS="$CFLAGS -std=gnu99"