From: Bruno Haible Date: Sun, 19 Feb 2017 18:46:14 +0000 (+0100) Subject: havelib: Prefer the search path of /usr/bin/gcc over the one of $CC. X-Git-Tag: v1.0~6353 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=a7fbc7bdbea8160ab03e29e20e704702b0441517;p=gnulib.git havelib: Prefer the search path of /usr/bin/gcc over the one of $CC. --- diff --git a/ChangeLog b/ChangeLog index 2f2a8b718c..2feb632787 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2017-02-19 Bruno Haible + 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. diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 index afd5b938cf..a5d56c8d78 100644 --- a/m4/lib-prefix.m4 +++ b/m4/lib-prefix.m4 @@ -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