1 # If possible, ignore libraries that are not depended on.
3 dnl Copyright (C) 2006 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl Written by Paul Eggert.
10 AC_DEFUN([gl_IGNORE_UNUSED_LIBRARIES],
12 AC_CACHE_CHECK([for flag to ignore unused libraries],
13 [gl_cv_ignore_unused_libraries],
14 [gl_cv_ignore_unused_libraries=none
15 gl_saved_ldflags=$LDFLAGS
16 # Use long option sequences like '-z ignore' to test for the feature,
17 # to forestall problems with linkers that have -z, -i, -g, -n, etc. flags.
18 for gl_flags in '-Xlinker -z -Xlinker ignore' '-z ignore'; do
19 LDFLAGS="$gl_flags $LDFLAGS"
20 AC_LINK_IFELSE([AC_LANG_PROGRAM()],
22 '-Xlinker -z -Xlinker ignore')
23 # Shorten this ugly thing, for prettier 'make' output.
24 gl_cv_ignore_unused_libraries='-Xlinker -zignore';;
26 gl_cv_ignore_unused_libraries=$gl_flags;;
28 LDFLAGS=$gl_saved_ldflags
29 test "$gl_cv_ignore_unused_libraries" != none && break
32 test "$gl_cv_ignore_unused_libraries" != none &&
33 LDFLAGS="$LDFLAGS $gl_cv_ignore_unused_libraries"