Discussion:
havelib: make it work again for CC="gcc -m32"
(too old to reply)
Bruno Haible
2017-09-30 14:03:30 UTC
Permalink
Raw Message
On Linux/powerpc64 and Linux/sparc64 platforms (at least), the change from
2017-02-19 has the effect that the AC_LIB_LINKFLAGS macro will search for
the libraries under $prefix/lib64 - even if CC="gcc -m32".

This fixes it.

2017-09-30 Bruno Haible <***@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.

diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4
index 0d03dc2..ea3b03a 100644
--- a/m4/lib-prefix.m4
+++ b/m4/lib-prefix.m4
@@ -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"
diff --git a/modules/havelib b/modules/havelib
index 2a264cc..7504435 100644
--- a/modules/havelib
+++ b/modules/havelib
@@ -8,6 +8,7 @@ m4/lib-prefix.m4
build-aux/config.rpath

Depends-on:
+host-cpu-c-abi

configure.ac:
Bruno Haible
2017-10-03 23:26:21 UTC
Permalink
Raw Message
Post by Bruno Haible
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.
Now I get this autoconf warning:

configure.in:61: warning: AC_REQUIRE: `gl_HOST_CPU_C_ABI' was expanded before it was required
configure.in:61: http://www.gnu.org/software/autoconf/manual/autoconf.html#Expanded-Before-Required
aclocal.m4:7822: AC_LIB_PREPARE_MULTILIB is expanded from...
aclocal.m4:7063: AC_LIB_LINKFLAGS_BODY is expanded from...
aclocal.m4:6939: AC_LIB_HAVE_LINKFLAGS is expanded from...
aclocal.m4:7920: gl_LIBSIGSEGV is expanded from...
aclocal.m4:4478: gl_INIT is expanded from...
configure.in:61: the top level

This patch fixes it.


2017-10-03 Bruno Haible <***@clisp.org>

Fix warning "`gl_HOST_CPU_C_ABI' was expanded before it was required".
* modules/host-cpu-c-abi (configure.ac): Require, don't invoke
gl_HOST_CPU_C_ABI.

diff --git a/modules/host-cpu-c-abi b/modules/host-cpu-c-abi
index 6c92cc4..a9cf48b 100644
--- a/modules/host-cpu-c-abi
+++ b/modules/host-cpu-c-abi
@@ -8,7 +8,7 @@ m4/asm-underscore.m4
Depends-on:

configure.ac:
-gl_HOST_CPU_C_ABI
+AC_REQUIRE([gl_HOST_CPU_C_ABI])

Makefile.am:

Loading...