Mercurial > gnulib
changeset 19219:037ac9ebd80a
havelib: Make it work for CC="gcc -m32" (regression from 2017-02-19).
* m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Require gl_HOST_CPU_C_ABI.
When $CC produces 32-bit code, set acl_libdirstem to 'lib', not 'lib64'.
* modules/havelib (Depends-on): Add host-cpu-c-abi.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 30 Sep 2017 15:59:27 +0200 |
parents | 2e4328369f85 |
children | e08430695f6b |
files | ChangeLog m4/lib-prefix.m4 modules/havelib |
diffstat | 3 files changed, 45 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Sep 30 14:22:53 2017 +0200 +++ b/ChangeLog Sat Sep 30 15:59:27 2017 +0200 @@ -1,3 +1,10 @@ +2017-09-30 Bruno Haible <bruno@clisp.org> + + havelib: Make it work for CC="gcc -m32" (regression from 2017-02-19). + * m4/lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): Require gl_HOST_CPU_C_ABI. + When $CC produces 32-bit code, set acl_libdirstem to 'lib', not 'lib64'. + * modules/havelib (Depends-on): Add host-cpu-c-abi. + 2017-09-30 Bruno Haible <bruno@clisp.org> uniname/uniname: Don't assume C99 compiler (regression from 2015-02-16).
--- a/m4/lib-prefix.m4 Sat Sep 30 14:22:53 2017 +0200 +++ b/m4/lib-prefix.m4 Sat Sep 30 15:59:27 2017 +0200 @@ -1,4 +1,4 @@ -# lib-prefix.m4 serial 8 +# lib-prefix.m4 serial 9 dnl Copyright (C) 2001-2005, 2008-2017 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -174,6 +174,7 @@ dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_HOST_CPU_C_ABI]) dnl Allow the user to override the result by setting acl_cv_libdirstems. AC_CACHE_CHECK([for the common suffixes of directories in the library search path], [acl_cv_libdirstems], @@ -202,34 +203,42 @@ fi ;; *) - 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 - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac + dnl If $CC generates code for a 32-bit ABI, the libraries are + dnl surely under $prefix/lib, not $prefix/lib64. + case "$gl_cv_host_cpu_c_abi" in + i386 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | s390 | sparc) + ;; + *) # x86_64 | arm64 | hppa64 | ia64 | mips64 | powerpc64* | s390x | sparc64 | ... + 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 + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" fi - done - IFS="$acl_save_IFS" - fi + ;; + esac ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"