blob: 7dad0cd8a5af64142beff07c3deb85ae40cc52e6 [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001From 44b4511784f9b51c514dff4ceb3cbeaf9c374d08 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 eddd02d..00ecba5 100644
17--- a/configure.ac
18+++ b/configure.ac
19@@ -93,6 +93,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@@ -127,10 +137,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 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
47+ CFLAGS="-O3 -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--
551.8.3.1
56