diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2006-01-07 01:55:27 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2006-01-07 01:55:27 +0000 |
commit | 56e7ad30019a9fda67b233bdcdc33b8b9fade5be (patch) | |
tree | 361adb6b0c6342b821aee0bc17bafe0f19313d18 /m4 | |
parent | 55e0a76ddc8d95c446e8bb9f51fe2245a0bf6c20 (diff) | |
download | coreutils-56e7ad30019a9fda67b233bdcdc33b8b9fade5be.tar.xz |
Initial version.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/lib-ignore.m4 | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/m4/lib-ignore.m4 b/m4/lib-ignore.m4 new file mode 100644 index 000000000..319cf987a --- /dev/null +++ b/m4/lib-ignore.m4 @@ -0,0 +1,43 @@ +# If possible, ignore libraries that are not depended on. + +dnl Copyright (C) 2006 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +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" + 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]) + + test "$gl_cv_ignore_unused_libraries" != none && + LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries" +]) |