Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 1 | From 707a5d49ecaa4fd722176d764251360a44fc5655 Mon Sep 17 00:00:00 2001 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 15 Apr 2020 14:17:20 -0700 |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 4 | Subject: [PATCH] Check for clang before checking gcc version |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 5 | |
| 6 | Clang advertises itself to be gcc 4.2.1, so when compiling this test |
| 7 | here fails since gcc < 4.4.5 did not support -static-libstdc++ but thats |
| 8 | not true for clang, so its better to make an additional check for clang |
| 9 | before resorting to gcc version check. This should let clang enable |
| 10 | static libstdc++ linking |
| 11 | |
| 12 | Upstream-Status: Pending |
| 13 | |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | configure | 2 +- |
| 17 | configure.ac | 2 +- |
| 18 | 2 files changed, 2 insertions(+), 2 deletions(-) |
| 19 | |
| 20 | diff --git a/configure b/configure |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 21 | index e8ba1a1d3de..e00d4764583 100755 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | --- a/configure |
| 23 | +++ b/configure |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 24 | @@ -5275,7 +5275,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 25 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
| 26 | /* end confdefs.h. */ |
| 27 | |
| 28 | -#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) |
| 29 | +#if !defined(__clang__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)) |
| 30 | #error -static-libstdc++ not implemented |
| 31 | #endif |
| 32 | int main() {} |
| 33 | diff --git a/configure.ac b/configure.ac |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 34 | index 3a8a3ae1f3b..c7f08b802d0 100644 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 35 | --- a/configure.ac |
| 36 | +++ b/configure.ac |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 37 | @@ -1309,7 +1309,7 @@ if test "$GCC" = yes; then |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 38 | AC_MSG_CHECKING([whether g++ accepts -static-libstdc++ -static-libgcc]) |
| 39 | AC_LANG_PUSH(C++) |
| 40 | AC_LINK_IFELSE([AC_LANG_SOURCE([ |
| 41 | -#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) |
| 42 | +#if !defined(__clang__) && ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)) |
| 43 | #error -static-libstdc++ not implemented |
| 44 | #endif |
| 45 | int main() {}])], |