[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] lib-link.m4: lib64
From: |
Bruno Haible |
Subject: |
Re: [bug-gnulib] lib-link.m4: lib64 |
Date: |
Fri, 2 Sep 2005 13:22:51 +0200 |
User-agent: |
KMail/1.5 |
Simon Josefsson wrote:
> Further, does this macro handle 64-bit libraries in $prefix/lib64?
I have committed this untested patch. Do you have time to try it on a mixed
32/64-bit system?
Bruno
2005-08-27 Bruno Haible <address@hidden>
Support for lib vs. lib64 distinction on biarch platforms.
* lib-prefix.m4 (AC_LIB_PREPARE_MULTILIB): New macro.
(AC_LIB_PREFIX): Require it. Use $acl_libdirstem instead of 'lib'.
* lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Likewise.
*** m4/lib-prefix.m4.bak 2005-02-24 20:43:23.000000000 +0100
--- m4/lib-prefix.m4 2005-08-27 02:35:13.000000000 +0200
***************
*** 1,4 ****
! # lib-prefix.m4 serial 4 (gettext-0.14.2)
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # lib-prefix.m4 serial 5 (gettext-0.15)
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 24,29 ****
--- 24,30 ----
AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
dnl By default, look in $includedir and $libdir.
use_additional=yes
***************
*** 45,51 ****
])
else
additional_includedir="$withval/include"
! additional_libdir="$withval/lib"
fi
fi
])
--- 46,52 ----
])
else
additional_includedir="$withval/include"
! additional_libdir="$withval/$acl_libdirstem"
fi
fi
])
***************
*** 87,93 ****
dnl 2. if it's already present in $LDFLAGS,
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
! if test "X$additional_libdir" != "X/usr/lib"; then
haveit=
for x in $LDFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
--- 88,94 ----
dnl 2. if it's already present in $LDFLAGS,
dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
dnl 4. if it doesn't exist as a directory.
! if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
haveit=
for x in $LDFLAGS; do
AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
***************
*** 97,103 ****
fi
done
if test -z "$haveit"; then
! if test "X$additional_libdir" = "X/usr/local/lib"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
--- 98,104 ----
fi
done
if test -z "$haveit"; then
! if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
if test -n "$GCC"; then
case $host_os in
linux*) haveit=yes;;
***************
*** 151,153 ****
--- 152,185 ----
exec_prefix="$acl_save_exec_prefix"
prefix="$acl_save_prefix"
])
+
+ dnl AC_LIB_PREPARE_MULTILIB creates a variable acl_libdirstem, containing
+ dnl the basename of the libdir, either "lib" or "lib64".
+ AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+ [
+ dnl There is no formal standard regarding lib and lib64. The current
+ dnl practice is that on a system supporting 32-bit and 64-bit instruction
+ dnl sets or ABIs, 64-bit libraries go under $prefix/lib64 and 32-bit
+ dnl libraries go under $prefix/lib. We determine the compiler's default
+ dnl mode by looking at the compiler's library search path. If at least
+ dnl of its elements ends in /lib64 or points to a directory whose absolute
+ dnl pathname ends in /lib64, we assume a 64-bit ABI. Otherwise we use the
+ dnl default, namely "lib".
+ acl_libdirstem=lib
+ searchpath=`(LC_ALL=C $CC -print-search-dirs) 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 ;;
+ *) searchdir=`cd "$searchdir" && pwd`
+ case "$searchdir" in
+ */lib64 ) acl_libdirstem=lib64 ;;
+ esac ;;
+ esac
+ fi
+ done
+ IFS="$acl_save_IFS"
+ fi
+ ])
*** m4/lib-link.m4.bak 2005-05-03 12:51:53.000000000 +0200
--- m4/lib-link.m4 2005-08-27 02:37:58.000000000 +0200
***************
*** 1,4 ****
! # lib-link.m4 serial 6 (gettext-0.14.3)
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
--- 1,4 ----
! # lib-link.m4 serial 7 (gettext-0.15)
dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
***************
*** 126,131 ****
--- 126,132 ----
dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
[
+ AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
dnl By default, look in $includedir and $libdir.
***************
*** 148,154 ****
])
else
additional_includedir="$withval/include"
! additional_libdir="$withval/lib"
fi
fi
])
--- 149,155 ----
])
else
additional_includedir="$withval/include"
! additional_libdir="$withval/$acl_libdirstem"
fi
fi
])
***************
*** 248,254 ****
dnl Linking with a shared library. We attempt to hardcode its
dnl directory into the executable's runpath, unless it's the
dnl standard /usr/lib.
! if test "$enable_rpath" = no || test "X$found_dir" =
"X/usr/lib"; then
dnl No hardcoding is needed.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
--- 249,255 ----
dnl Linking with a shared library. We attempt to hardcode its
dnl directory into the executable's runpath, unless it's the
dnl standard /usr/lib.
! if test "$enable_rpath" = no || test "X$found_dir" =
"X/usr/$acl_libdirstem"; then
dnl No hardcoding is needed.
LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
else
***************
*** 334,341 ****
dnl Assume the include files are nearby.
additional_includedir=
case "$found_dir" in
! */lib | */lib/)
! basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e
's,/lib/*$,,'`
additional_includedir="$basedir/include"
;;
esac
--- 335,342 ----
dnl Assume the include files are nearby.
additional_includedir=
case "$found_dir" in
! */$acl_libdirstem | */$acl_libdirstem/)
! basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e
"s,/$acl_libdirstem/"'*$,,'`
additional_includedir="$basedir/include"
;;
esac
***************
*** 396,404 ****
dnl 3. if it's already present in $LDFLAGS or the
already
dnl constructed $LIBNAME,
dnl 4. if it doesn't exist as a directory.
! if test "X$additional_libdir" != "X/usr/lib"; then
haveit=
! if test "X$additional_libdir" = "X/usr/local/lib"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
--- 397,405 ----
dnl 3. if it's already present in $LDFLAGS or the
already
dnl constructed $LIBNAME,
dnl 4. if it doesn't exist as a directory.
! if test "X$additional_libdir" != "X/usr/$acl_libdirstem";
then
haveit=
! if test "X$additional_libdir" =
"X/usr/local/$acl_libdirstem"; then
if test -n "$GCC"; then
case $host_os in
linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- Re: [bug-gnulib] lib-link.m4: lib64,
Bruno Haible <=