Peter O'Gorman wrote: > 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 >
Sigh, plus two more *. I installed amd64 debian in a VM and with this patch I get: /usr/lib/gcc/x86_64-linux/gnu/4.1.2 /usr/lib /lib I do not know if it is best to leave in the symlink and the original dir ( i.e. do cd $dir && pwd as well as cd $dir && pwd -P), which on debian would give something like: /usr/lib/gcc/x86_64-linux/gnu/4.1.2 /usr/lib64 /usr/lib /lib64 /lib Peter -- Peter O'Gorman http://pogma.com
Index: ChangeLog =================================================================== RCS file: /sources/libtool/libtool/ChangeLog,v retrieving revision 1.1220.2.492 diff -u -r1.1220.2.492 ChangeLog --- ChangeLog 30 Jan 2008 06:40:56 -0000 1.1220.2.492 +++ ChangeLog 31 Jan 2008 06:56:41 -0000 @@ -1,5 +1,11 @@ 2008-01-30 Peter O'Gorman <[EMAIL PROTECTED]> + * libtool.m4 (AC_LIBTOOL_SYS_DYNAMIC_LINKER): If using gcc, check + the -L flags output by a test link command also to get a more + accurate value for sys_lib_search_path_spec. + +2008-01-30 Peter O'Gorman <[EMAIL PROTECTED]> + Backport darwin support reorganization from HEAD. * libtool.m4 [darwin]: Check for nmedit and dsymutil with AC_CHECK_TOOL, use -single_module by default (can be turned off 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 31 Jan 2008 06:56:45 -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