]> Savannah Git Hosting - gnulib.git/commitdiff
havelib: Make it work for CC="gcc -m32" (regression from 2017-02-19).
authorBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2017 13:59:27 +0000 (15:59 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 30 Sep 2017 13:59:27 +0000 (15:59 +0200)
* 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.

ChangeLog
m4/lib-prefix.m4
modules/havelib

index f9511d0b6985be0bd24092940ed3eb531f60f3f8..0d219bd392f395845ca2c6483ee4372ae932bcbf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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).
index 0d03dc22ba0f5a2deba9cc6639e4fcb21eb5c891..ea3b03a633364a311d8eadc3303774d604a240cc 100644 (file)
@@ -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 @@ AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
   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 @@ sixtyfour bits
          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"
index 2a264ccd9766f138a301a4f07fd1371e853dc3b1..75044356efd753a33b1589526545957a791ea028 100644 (file)
@@ -8,6 +8,7 @@ m4/lib-prefix.m4
 build-aux/config.rpath
 
 Depends-on:
+host-cpu-c-abi
 
 configure.ac: