On Friday 05 of December 2014 12:11:57 Gary V. Vaughan wrote:
> > Yes, we can use ac_cv_.... workaround globally, but that is not
> > ideal as this turns off the ld.so.conf parsing in libtool (which works
> > pretty well to reimplement).
> > 
> > ... so yet another idea.  What about have some API environment variable
> > _enhancing_ the library path detected by libtool?
> 
> Great idea!  Yes, that is a good middle ground without any safety concerns on
> my part; I'd be very happy to apply a patch along those lines.

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.

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.

Thoughts?

Pavel
diff --git a/doc/libtool.texi b/doc/libtool.texi
index 90aeb8f..fefbfae 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 PREPEND_LIB_DLSEARCH_PATH
+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..ea69eb4 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{PREPEND_LIB_DLSEARCH_PATH} 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..839bfbf 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,13 @@ 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, however this is still not possible.  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 +3015,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="\$PREPEND_LIB_DLSEARCH_PATH $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 +8257,18 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
 ])# _LT_CHECK_SHELL_FEATURES
 
 
+# _LT_HANDLE_SEARCH_PATHS
+# -----------------------
+# Process configure-time variable PREPEND_DLSEARCH_PATH.  Paths from this
+# variable are going to be prepended to the automatically detected PATH.
+
+m4_defun([_LT_HANDLE_SEARCH_PATHS],
+[test -z "$PREPEND_LIB_DLSEARCH_PATH" && PREPEND_LIB_DLSEARCH_PATH=""
+_LT_DECL([], [PREPEND_LIB_DLSEARCH_PATH], [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
_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool

Reply via email to