view m4/lib-ignore.m4 @ 6572:df6195e003c4

* socklen.m4: Look in ws2tcpip.h too, for mingw32.
author Simon Josefsson <simon@josefsson.org>
date Thu, 19 Jan 2006 14:13:52 +0000
parents c89ddea009ce
children c9644fabfcbc
line wrap: on
line source

# 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
     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()],
	 [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"
])