blob: b06029b98b7972acc17193d83348712a0c8875dd [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From d619ccf6c11ab574466914c57994a82fb99401af Mon Sep 17 00:00:00 2001
Brad Bishop6e60e8b2018-02-01 10:27:11 -05002From: 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
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080016index 28b0a14..2d4e984 100644
Brad Bishop6e60e8b2018-02-01 10:27:11 -050017--- a/configure.ac
18+++ b/configure.ac
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080019@@ -98,6 +98,16 @@ AC_ARG_ENABLE(examples,
20
21 AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes])
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022
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 --------------------------------------------------
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080036@@ -132,10 +142,15 @@ else
Brad Bishop6e60e8b2018-02-01 10:27:11 -050037 AC_MSG_RESULT([$GCC_VERSION])
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080038 case $host in
Brad Bishop6e60e8b2018-02-01 10:27:11 -050039 *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"
Brad Bishop1a4b7ee2018-12-16 17:11:34 -080046- 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}"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050048 # 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--
Brad Bishop1a4b7ee2018-12-16 17:11:34 -0800552.17.0
Brad Bishop6e60e8b2018-02-01 10:27:11 -050056