bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

new module lib-ignore; new section build_lib in MODULES.html


From: Paul Eggert
Subject: new module lib-ignore; new section build_lib in MODULES.html
Date: Mon, 09 Jan 2006 15:50:34 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

I thought this module might be useful for people trying to build
executables on systems like Solaris where the "-lrt" option causes the
executable to dynamically link to rt, even if the executable does not
need any of the rt routines.

I couldn't find any section for this in MODULES.html.sh, so I invented
a new one.  Not sure if it's named well.

2006-01-09  Paul Eggert  <address@hidden>

        Sync from coreutils.

        * MODULES.html.sh (build_lib): New section, with new lib-ignore module.
        * modules/lib-ignore: New file.
        * m4/lib-ignore.m4: New file.

--- MODULES.html.sh.~1.111.~    2005-12-16 07:05:12.000000000 -0800
+++ MODULES.html.sh     2006-01-09 15:39:11.000000000 -0800
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2002-2005 Free Software Foundation, Inc.
+# Copyright (C) 2002-2006 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -2042,6 +2042,15 @@ func_all_modules ()
   func_module sysexits
   func_module visibility
   func_end_table
+
+  element="Support for building libraries and executables"
+  func_section_wrap build_lib
+  func_wrap H2
+  func_echo "$element"
+
+  func_begin_table
+  func_module lib-ignore
+  func_end_table
 }
 
 
--- /dev/null   2005-09-24 22:00:15.000000000 -0700
+++ m4/lib-ignore.m4    2006-01-09 10:42:51.000000000 -0800
@@ -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"
+])
--- /dev/null   2005-09-24 22:00:15.000000000 -0700
+++ modules/lib-ignore  2006-01-09 15:08:36.000000000 -0800
@@ -0,0 +1,20 @@
+Description:
+If possible, ignore libraries that are not depended on.
+
+Files:
+m4/lib-ignore.m4
+
+Depends-on:
+
+configure.ac:
+gl_IGNORE_UNUSED_LIBRARIES
+
+Makefile.am:
+
+Include:
+
+License:
+GPL
+
+Maintainer:
+Paul Eggert and Jim Meyering




reply via email to

[Prev in Thread] Current Thread [Next in Thread]