diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-01-17 07:21:48 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-01-17 07:21:48 +0000 |
commit | 739de8914fae814e11198abe20f629cbf50a7586 (patch) | |
tree | 312a1c0237f552136202d67260ee013f6e671451 /m4 | |
parent | b88411cca3e2812bd59feb97cf99c9479b7b1607 (diff) | |
download | coreutils-739de8914fae814e11198abe20f629cbf50a7586.tar.xz |
(gl_IGNORE_UNUSED_LIBRARIES): Don't use ldd, as it's not portable
and it doesn't work with cross-compiles. Fix missing-$ typo in 'test
"gl_cv_ignore_unused_libraries" ...' that prevented -zignore from being
used with Sun's C compiler.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/ChangeLog | 8 | ||||
-rw-r--r-- | m4/lib-ignore.m4 | 39 |
2 files changed, 23 insertions, 24 deletions
diff --git a/m4/ChangeLog b/m4/ChangeLog index a7ac9c2b4..160d2b151 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,11 @@ +2006-01-16 Paul Eggert <eggert@cs.ucla.edu> + + * lib-ignore.m4 (gl_IGNORE_UNUSED_LIBRARIES): Don't use ldd, as + it's not portable and it doesn't work with cross-compiles. + Problem reported by Bruno Haible. Fix missing-$ typo in + 'test "gl_cv_ignore_unused_libraries" ...' that prevented + -zignore from being used with Sun's C compiler. + 2006-01-13 Jim Meyering <jim@meyering.net> * ls-mntd-fs.m4 (AC_FUNC_GETMNTENT): Invoke AC_CHECK_FUNCS(getmntent) diff --git a/m4/lib-ignore.m4 b/m4/lib-ignore.m4 index 319cf987a..a84ca167e 100644 --- a/m4/lib-ignore.m4 +++ b/m4/lib-ignore.m4 @@ -12,31 +12,22 @@ AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES], AC_CACHE_CHECK([for flag to ignore unused libraries], [gl_cv_ignore_unused_libraries], [gl_cv_ignore_unused_libraries=none - AC_LINK_IFELSE([AC_LANG_PROGRAM()], - [gl_ldd_output0=`(ldd conftest$ac_exeext) 2>/dev/null` || - gl_ldd_output0=]) - if test "$gl_ldd_output0"; then - gl_saved_ldflags=$LDFLAGS - gl_saved_libs=$LIBS - LIBS="$LIBS -lm" + gl_saved_ldflags=$LDFLAGS + # Use long option sequences like '-z ignore' to test for the feature, + # to forestall problems with linkers that have -z, -i, -g, -n, etc. flags. + for gl_flags in '-Xlinker -z -Xlinker ignore' '-z ignore'; do + LDFLAGS="$gl_flags $LDFLAGS" AC_LINK_IFELSE([AC_LANG_PROGRAM()], - [gl_ldd_output1=`(ldd conftest$ac_exeext) 2>/dev/null` || - gl_ldd_output1=]) - if test "$gl_ldd_output1" && test "$gl_ldd_output0" != "$gl_ldd_output1" - then - for gl_flags in '-Xlinker -zignore' '-zignore'; do - LDFLAGS="$gl_flags $LDFLAGS" - AC_LINK_IFELSE([AC_LANG_PROGRAM()], - [if gl_ldd_output2=`(ldd conftest$ac_exeext) 2>/dev/null` && - test "$gl_ldd_output0" = "$gl_ldd_output2"; then - gl_cv_ignore_unused_libraries=$gl_flags - fi]) - LDFLAGS=$gl_saved_ldflags - test "gl_cv_ignore_unused_libraries" != none && break - done - fi - LIBS=$gl_saved_LIBS - fi]) + [case $gl_flags in + '-Xlinker -z -Xlinker ignore') + # Shorten this ugly thing, for prettier 'make' output. + gl_cv_ignore_unused_libraries='-Xlinker -zignore';; + *) + gl_cv_ignore_unused_libraries=$gl_flags;; + esac]) + LDFLAGS=$gl_saved_ldflags + test "$gl_cv_ignore_unused_libraries" != none && break + done]) test "$gl_cv_ignore_unused_libraries" != none && LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries" |