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.
pull/187/head
Eric Leblond 13 years ago
parent 57d7783402
commit 1f94239d20

@ -35,24 +35,30 @@ AC_INIT(configure.ac)
echo echo
]) ])
dnl get gcc version if test `basename $CC` = "clang"; then
AC_MSG_CHECKING([gcc version]) CFLAGS="$CFLAGS -Wextra -Werror-implicit-function-declaration"
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 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 # remove optimization options that break our code
# VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code. # VJ 2010/06/27: no-tree-pre added. It breaks ringbuffers code.
CFLAGS="$CFLAGS -Wall -fno-strict-aliasing -fno-tree-pre" CFLAGS="$CFLAGS -fno-tree-pre"
fi
CFLAGS="$CFLAGS -Wall -fno-strict-aliasing"
CFLAGS="$CFLAGS -Wno-unused-parameter" CFLAGS="$CFLAGS -Wno-unused-parameter"
CFLAGS="$CFLAGS -std=gnu99" CFLAGS="$CFLAGS -std=gnu99"

Loading…
Cancel
Save