>From a7fbc7bdbea8160ab03e29e20e704702b0441517 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 19 Feb 2017 19:46:14 +0100 Subject: [PATCH 2/2] havelib: Prefer the search path of /usr/bin/gcc over the one of $CC. --- ChangeLog | 5 +++++ m4/lib-prefix.m4 | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2f2a8b7..2feb632 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 afd5b93..a5d56c8 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 -- 2.7.4