On Saturday 06 of December 2014 14:36:23 Pavel Raiskup wrote:
> Iteration #0. Patch (for discussion, not push) implementing configure
> time PREPEND_LIB_DLSEARCH_PATH variable. Possible enhancements for future
> could be {APPEND_,}LIB_DLSEARCH_PATH and
> {,APPEND_,PREPEND_}LIB_SEARCH_PATH.
Iteration #1 attached, more complete hopefully,
s/PREPEND_LIB_DLSEARCH_PATH/LIB_DLSEARCH_PATH_PREPEND/.
> Questions:
> * Is the name good-enough? Any namespace should be used?
> * should I use AC_ARG_VAR rather?
>
> Benefits would be:
> * No need to touch ac_cv_* at least for our (Fedora) case.
> * Can be easily set in ${prefix}/share/config.site.
> * Does not break libtool's dlsearch path guesses.
> * Avoiding hard-wiring list of $host_cpu.
> * Should be fully backward compatible.
Still valid ^.
Pavel
>From 855b61d1df1ca00a4dbd963c44a7a377256c6569 Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <[email protected]>
Date: Sat, 6 Dec 2014 16:35:41 +0100
Subject: [PATCH] libtool: avoid rpath via LIB_DLSEARCH_PATH_PREPEND
Some GNU/Linux distributions install libraries into /lib64 (or
/usr/lib64) on 64-bit machines, while /lib (/usr/lib respectively)
stays for multilib variant. Other distributions keep /usr/lib for
64-bit variant and reserve /usr/lib32 for multilib. Distributions
also have ldconfig configured properly to search corresponding
library PATH.
For libtool, it is quite difficult to defect which approach the
GNU/Linux box uses, however. Glibc's ldconfig does not provide
complete PATH either. So, by using LIB_DLSEARCH_PATH_PREPEND we
are able to enhance the dynamic library search path during
./configure time. So, for now stay with default /lib (and
/usr/lib) and allow distributions/users to specify additional
directories accordingly (e.g. via config.site).
References:
http://thread.gmane.org/gmane.comp.gnu.libtool.general/8339/focus=8345
* m4/libtool.m4 (_LT_HANDLE_SEARCH_PATHS): New macro.
(_LT_SYS_DYNAMIC_LINKER): Require _LT_HANDLE_SEARCH_PATHS.
Prepend $LIB_DLSEARCH_PATH_PREPEND contents before
$sys_lib_dlsearch_path_spec globally. Remove the hard-wired list
$host_cpu candidates as that does not generally say anything about
used approach.
* m4/ltdl.m4 (LT_SYS_DLSEARCH_PATH): Use eval for
lt_cv_sys_dlsearch_path assignment to expand
$LIB_DLSEARCH_PATH_PREPEND.
* doc/libtool.texi: Document.
* doc/notes.texi: Likewise.
---
doc/libtool.texi | 7 +++++++
doc/notes.texi | 13 +++++++------
m4/libtool.m4 | 30 +++++++++++++++++++++---------
m4/ltdl.m4 | 2 +-
4 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/doc/libtool.texi b/doc/libtool.texi
index 90aeb8f..a379771 100644
--- a/doc/libtool.texi
+++ b/doc/libtool.texi
@@ -2419,6 +2419,13 @@ Program to use rather than checking for @command{mt}, the Manifest Tool.
Only used on Cygwin/MS-Windows at the moment.
@end defvar
+@defvar LIB_DLSEARCH_PATH_PREPEND
+Libtool is trying heavily to detect what the system run-time search path for
+libraries is. If the guesses are not good enough, this variable can be used to
+prepend additional directories (separated by space) before the path detected by
+libtool internals.
+@end defvar
+
With 1.3 era libtool, if you wanted to know any details of what
libtool had discovered about your architecture and environment, you
had to run the script with @option{--config} and grep through the
diff --git a/doc/notes.texi b/doc/notes.texi
index a99bbbd..226f7d0 100644
--- a/doc/notes.texi
+++ b/doc/notes.texi
@@ -70,11 +70,12 @@ and all recent releases of XEmacs.
@item
When building on some GNU/Linux systems for multilib targets
@command{libtool} sometimes guesses the wrong paths that the linker
-and dynamic linker search by default. If this occurs, you may override
-libtool's guesses at @command{configure} time by setting the
-@command{autoconf} cache variables
-@code{lt_cv_sys_lib_search_path_spec} and
-@code{lt_cv_sys_lib_dlsearch_path_spec} respectively to the correct search
-paths.
+and dynamic linker search by default.
+If this occurs, for the dynamic linker, you may prepend additional directories
+at @command{configure} time by setting the variable
+@code{LIB_DLSEARCH_PATH_PREPEND} to the correct search paths. Possibly, you may
+completely override libtool's guesses by setting the @command{autoconf} cache
+variables @code{lt_cv_sys_lib_search_path_spec} and
+@code{lt_cv_sys_lib_dlsearch_path_spec} respectively.
@end itemize
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 2f52305..dc04134 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -2212,6 +2212,7 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl
m4_require([_LT_DECL_OBJDUMP])dnl
m4_require([_LT_DECL_SED])dnl
m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_HANDLE_SEARCH_PATHS])dnl
AC_MSG_CHECKING([dynamic linker characteristics])
m4_if([$1],
[], [
@@ -2791,19 +2792,16 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
# before this can be enabled.
hardcode_into_libs=yes
- # Append ld.so.conf contents to the search path
+ # Ideally, we could use ldconfig to report *all* directores which are
+ # searched for libraries, however this is still not possible. Aside from not
+ # being certain /sbin/ldconfig is available, command
+ # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+ # even though it is searched at run-time. Try to do the best guess by
+ # appending ld.so.conf contents (and includes) to the search path.
if test -f /etc/ld.so.conf; then
lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
- # Ideally we could use /sbin/ldconfig to report what directories are
- # searched, but (aside from not being certain /sbin/ldconfig is
- # available) Fedora on 64bit does not report /usr/lib64, even though
- # it is searched at run-time.
- case $host_cpu in
- # match at least x86_64, ia64, powerpc64*, s390x (add other glibc/ELF 64bit cpus here):
- *64*|s390x) sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 $sys_lib_dlsearch_path_spec" ;;
- esac
# We used to test for /lib/ld.so.1 and disable shared libraries on
# powerpc, because MkLinux only supported shared libraries with the
@@ -3020,6 +3018,8 @@ if test yes = "$GCC"; then
variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
fi
+sys_lib_dlsearch_path_spec="\$LIB_DLSEARCH_PATH_PREPEND $sys_lib_dlsearch_path_spec"
+
if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
fi
@@ -8260,6 +8260,18 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
])# _LT_CHECK_SHELL_FEATURES
+# _LT_HANDLE_SEARCH_PATHS
+# -----------------------
+# Process configure-time variable LIB_DLSEARCH_PATH_PREPEND. This path is going
+# to be prepended before automatically detected PATH.
+
+m4_defun([_LT_HANDLE_SEARCH_PATHS],
+[test -z "$LIB_DLSEARCH_PATH_PREPEND" && LIB_DLSEARCH_PATH_PREPEND=""
+_LT_DECL([], [LIB_DLSEARCH_PATH_PREPEND], [1],
+[Explicitly user-defined run-time search path for libraries.])dnl
+])# _LT_HANDLE_SEARCH_PATHS
+
+
# _LT_PATH_CONVERSION_FUNCTIONS
# -----------------------------
# Determine what file name conversion functions should be used by
diff --git a/m4/ltdl.m4 b/m4/ltdl.m4
index ce24858..7404ac2 100644
--- a/m4/ltdl.m4
+++ b/m4/ltdl.m4
@@ -607,7 +607,7 @@ AC_DEFUN([LT_SYS_DLSEARCH_PATH],
[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl
AC_CACHE_CHECK([for the default library search path],
[lt_cv_sys_dlsearch_path],
- [lt_cv_sys_dlsearch_path=$sys_lib_dlsearch_path_spec])
+ [eval lt_cv_sys_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"])
if test -n "$lt_cv_sys_dlsearch_path"; then
sys_dlsearch_path=
for dir in $lt_cv_sys_dlsearch_path; do
--
1.9.3
_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool