]> Savannah Git Hosting - gnulib.git/commitdiff
havelib: Prefer the search path of /usr/bin/gcc over the one of $CC.
authorBruno Haible <bruno@clisp.org>
Sun, 19 Feb 2017 18:46:14 +0000 (19:46 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 19 Feb 2017 18:46:14 +0000 (19:46 +0100)
ChangeLog
m4/lib-prefix.m4

index 2f2a8b718cd0569bbcfe829638d38b96be0e94e2..2feb63278794a82d11f7768ccf6ca1261f420551 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2017-02-19  Bruno Haible  <bruno@clisp.org>
 
+       havelib: Prefer the search path of /usr/bin/gcc over the one of $CC.
+       This helps when CC=clang.
+       * m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Prefer the search path
+       of /usr/bin/gcc.
+
        havelib: Support overriding the result of AC_LIB_PREPARE_MULTILIB.
        * m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Use AC_CACHE_CHECK.
 
index afd5b938cfe006d223128402744058b474cf86fd..a5d56c8d78627ba665b7c9d5bfa63138a010662a 100644 (file)
@@ -202,7 +202,16 @@ sixtyfour bits
          fi
          ;;
        *)
-         searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+         dnl The result is a property of the system. However, non-system
+         dnl compilers sometimes have odd library search paths. Therefore
+         dnl prefer asking /usr/bin/gcc, if available, rather than $CC.
+         searchpath=`(if test -f /usr/bin/gcc \
+                         && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \
+                        LC_ALL=C /usr/bin/gcc -print-search-dirs; \
+                      else \
+                        LC_ALL=C $CC -print-search-dirs; \
+                      fi) 2>/dev/null \
+                     | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
          if test -n "$searchpath"; then
            acl_save_IFS="${IFS=        }"; IFS=":"
            for searchdir in $searchpath; do