1From d619ccf6c11ab574466914c57994a82fb99401af Mon Sep 17 00:00:00 2001 2From: Khem Raj <raj.khem@gmail.com> 3Date: Wed, 22 Mar 2017 16:06:55 +0000 4Subject: [PATCH] configure: Check for clang 5 6Disable gcc specific options if using clang 7 8Signed-off-by: Khem Raj <raj.khem@gmail.com> 9--- 10Upstream-Status: Pending 11 12 configure.ac | 19 +++++++++++++++++-- 13 1 file changed, 17 insertions(+), 2 deletions(-) 14 15diff --git a/configure.ac b/configure.ac 16index 28b0a14..2d4e984 100644 17--- a/configure.ac 18+++ b/configure.ac 19@@ -98,6 +98,16 @@ AC_ARG_ENABLE(examples, 20 21 AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes]) 22 23+AC_MSG_CHECKING([whether C compiler is clang]) 24+$CC -x c /dev/null -dM -E > conftest.txt 2>&1 25+if grep "__clang__" conftest.txt >/dev/null 2>&1; then 26+ AC_SUBST([CC_CLANG], [1]) 27+ AC_MSG_RESULT([yes]) 28+ else 29+ AC_SUBST([CC_CLANG], [0]) 30+ AC_MSG_RESULT([no]) 31+fi 32+ 33 dnl -------------------------------------------------- 34 dnl Set build flags based on environment 35 dnl -------------------------------------------------- 36@@ -132,10 +142,15 @@ else 37 AC_MSG_RESULT([$GCC_VERSION]) 38 case $host in 39 *86-*-linux*) 40+ if test "$CC_CLANG" = "1"; then 41+ ieeefp="" 42+ else 43+ ieefp="-mno-ieee-fp" 44+ fi 45 DEBUG="-g -Wall -Wextra -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" 46- CFLAGS="-O3 -Wall -Wextra -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char" 47+ CFLAGS="-O3 -Wall -Wextra -ffast-math -D_REENTRANT -fsigned-char ${ieefp}" 48 # PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static" 49- PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline" 50+ PROFILE="-Wall -Wextra -pg -g -O3 -ffast-math ${ieefp} -D_REENTRANT -fsigned-char -fno-inline" 51 52 # glibc < 2.1.3 has a serious FP bug in the math inline header 53 # that will cripple Vorbis. Look to see if the magic FP stack 54-- 552.17.0 56 57