0011-Check-for-clang-before-checking-gcc-version.patch 1.6 KB

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