Ralf Wildenhues wrote: > Hi Peter, > > * Peter O'Gorman wrote on Wed, Jan 30, 2008 at 09:16:38AM CET: >> Not much response last time, here we go again. > > Sorry about the delay. > >> Ok to apply to branch-1-5 and forward port to HEAD? > > Nits below. > > FWIW, on Debian x86_64, this patch causes for me /usr/lib to appear > in the front, with both 64bit mode (./configure) and 32bit mode > (./configure CPPFLAGS=-m32 LDFLAGS=-m32). For Debian, the latter > is wrong, /usr/lib64 is a symlink to /usr/lib. Before the patch, > both modes looked better.
Thank you! I think this one should do the right thing on your debian system too. Would you be kind enough to give it a try for me? I killed the awk, test for pwd -P, and try to get the real absolute dir name. Peter -- Peter O'Gorman http://pogma.com
Index: libtool.m4 =================================================================== RCS file: /sources/libtool/libtool/Attic/libtool.m4,v retrieving revision 1.314.2.195 diff -u -r1.314.2.195 libtool.m4 --- libtool.m4 30 Jan 2008 06:40:57 -0000 1.314.2.195 +++ libtool.m4 30 Jan 2008 21:03:32 -0000 @@ -1315,42 +1315,93 @@ else lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi + +lt_pwdP= +if (pwd -P || exit) >/dev/null 2>&1; then lt_pwdP="pwd -P";fi + +lt_func_print_dir_resolving_links () { +lt_func_print_dir_resolving_links_result= +if test -n "$lt_pwdP"; then + lt_func_print_dir_resolving_links_result=`cd [$]1 && $lt_pwdP` +else + if test -h "[$]1"; then + _lt_dir=`ls -ld [$]1 | ${SED} 's/.* -> //'` + else + _lt_dir=[$]1 + fi + lt_func_print_dir_resolving_links_result=`cd $_lt_dir && pwd` +fi +} + # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + lt_func_print_dir_resolving_links $lt_sys_path/$lt_multi_os_dir + case " $lt_tmp_lt_search_path_spec " in + *" $lt_func_print_dir_resolving_links_result ") ;; + *) lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_func_print_dir_resolving_links_result" ;; + esac else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + if test -d "$lt_sys_path"; then + lt_func_print_dir_resolving_links $lt_sys_path + case " $lt_tmp_lt_search_path_spec " in + *" $lt_func_print_dir_resolving_links_result ") ;; + *) lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_func_print_dir_resolving_links_result" ;; + esac + fi fi done - lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } + + sys_lib_search_path_spec=`echo $lt_tmp_lt_search_path_spec` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +# And it gets worse. gcc -print-search-dirs combined with gcc +# -print-multi-os-directory does not find all the directories that gcc +# searches. When building gcc -m32 on a system which defaults to 64 +# bit builds, gcc also searches directories like e.g. +# /usr/lib/gcc/x86_64-redhat-linux/4.1.2/32 but +# -print-multi-os-directory outputs ../lib. I no longer know why we +# don't just assume that gcc does the right thing, so we now verbose +# link something grab the -L paths and prepend to +# sys_lib_search_path_spec is not already there... +# Sad yet? +# +# We could probably get away without conftest.c and just do +# 'gcc -v -x c -o /dev/null /dev/null', but lets be conservative. +# +# Need LDFLAGS, but not with -L. +_lt_ldflags= +for _ld_flag in "$LDFLAGS"; do + case "$_ld_flag" in + -L*) ;; + *) _lt_ldflags="$_ld_flag $_lt_ldflags" ;; + esac +done +echo 'int main() { return 1;}' > conftest.c +_lt_verbose_search_libs=`$CC $CPPFLAGS $CFLAGS $_lt_ldflags -o conftest -v conftest.c 2>&1 | awk ' +BEGIN {lt_space=0;} /-L/ { + for (lt_x=1; lt_x <= NF; lt_x++) { + if ( substr($lt_x,1,2) == "-L") { + lt_y=substr($lt_x,3,length($lt_x) -2); + if (lt_space > 0) { printf " "; } + printf lt_y; + lt_space++; } } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` - sys_lib_search_path_spec=`echo $lt_search_path_spec` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) +rm -rf conftest* +for _lt_verbose_search_lib in $_lt_verbose_search_libs; do + lt_func_print_dir_resolving_links $_lt_verbose_search_lib + case " $sys_lib_search_path_spec " in + *" $lt_func_print_dir_resolving_links_result "*) ;; + *) sys_lib_search_path_spec="$_lt_verbose_search_lib $sys_lib_search_path_spec" ;; + esac +done +]) need_lib_prefix=unknown hardcode_into_libs=no