Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From d619ccf6c11ab574466914c57994a82fb99401af Mon Sep 17 00:00:00 2001 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 22 Mar 2017 16:06:55 +0000 |
| 4 | Subject: [PATCH] configure: Check for clang |
| 5 | |
| 6 | Disable gcc specific options if using clang |
| 7 | |
| 8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 9 | --- |
| 10 | Upstream-Status: Pending |
| 11 | |
| 12 | configure.ac | 19 +++++++++++++++++-- |
| 13 | 1 file changed, 17 insertions(+), 2 deletions(-) |
| 14 | |
| 15 | diff --git a/configure.ac b/configure.ac |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 16 | index 28b0a14..2d4e984 100644 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 17 | --- a/configure.ac |
| 18 | +++ b/configure.ac |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 19 | @@ -98,6 +98,16 @@ AC_ARG_ENABLE(examples, |
| 20 | |
| 21 | AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$enable_examples" = xyes]) |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 -------------------------------------------------- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 36 | @@ -132,10 +142,15 @@ else |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 37 | AC_MSG_RESULT([$GCC_VERSION]) |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 38 | case $host in |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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" |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 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}" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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 | -- |
Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 55 | 2.17.0 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 56 | |