Subject: libtool.m4 forgets LD_LIBRARY_PATH when computing sys_lib_dlsearch_path_spec

From: Ryan Lortie <[email-masked]>
Date: Tue, 04 Dec 2012 13:51:35 -0500

According to the manpage for ld.so on Linux, libraries are searched for 
in three places:

  - LD_LIBRARY_PATH

  - /etc/ld.so.cache (built from ld.so.conf)

  - /lib and /usr/lib

libtool features a variable named sys_lib_dlsearch_path_spec which is 
meant to list the library search path with the purpose of excluding 
these paths from being hardcoded into libraries as -rpath.

The Linux case for determining the value of sys_lib_dlsearch_path_spec 
in libtool.m4 handles both the /etc/ld.so.cache case (by sourcing 
/etc/ld.so.conf) and hardcodes /lib and /usr/lib.  It fails to take 
LD_LIBRARY_PATH into account, however, resulting in unnecessary -rpath 
usage for the directories in this variable.

It would probably be relatively easy to split up LD_LIBRARY_PATH across 
the ':' it contains and add the paths to sys_lib_dlsearch_path_spec.

I'd do the patch myself but I am (blissfully) unaware of which set of 
tools (cut? sed?) are considered portable enough to be used from 
libtool.m4...

Thanks for your consideration.

Cheers