blob: 400b79823f2a2ccc71cd348eb1c118d7f940ae7d [file] [log] [blame]
Andrew Geissler635e0e42020-08-21 15:58:33 -05001From ae5a7d622dc9addb2ca9fc85889c45964c025a9c Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 15 Apr 2020 14:17:20 -0700
Andrew Geissler635e0e42020-08-21 15:58:33 -05004Subject: [PATCH 16/17] Check for clang before checking gcc version
Andrew Geissler82c905d2020-04-13 13:39:40 -05005
6Clang advertises itself to be gcc 4.2.1, so when compiling this test
7here fails since gcc < 4.4.5 did not support -static-libstdc++ but thats
8not true for clang, so its better to make an additional check for clang
9before resorting to gcc version check. This should let clang enable
10static libstdc++ linking
11
12Upstream-Status: Pending
13
14Signed-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
20diff --git a/configure b/configure
Andrew Geissler635e0e42020-08-21 15:58:33 -050021index 6782f8b6ab8..72f5766b363 100755
Andrew Geissler82c905d2020-04-13 13:39:40 -050022--- a/configure
23+++ b/configure
Andrew Geissler635e0e42020-08-21 15:58:33 -050024@@ -5143,7 +5143,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
Andrew Geissler82c905d2020-04-13 13:39:40 -050025 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() {}
33diff --git a/configure.ac b/configure.ac
Andrew Geissler635e0e42020-08-21 15:58:33 -050034index 55beb1dea46..3f9e613e2d9 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050035--- a/configure.ac
36+++ b/configure.ac
Andrew Geissler635e0e42020-08-21 15:58:33 -050037@@ -1312,7 +1312,7 @@ if test "$GCC" = yes; then
Andrew Geissler82c905d2020-04-13 13:39:40 -050038 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() {}])],
46--
Andrew Geissler635e0e42020-08-21 15:58:33 -0500472.28.0
Andrew Geissler82c905d2020-04-13 13:39:40 -050048