New module description field 'Link'.
authorBruno Haible <bruno@clisp.org>
Thu, 1 Feb 2007 01:52:34 +0000 (01:52 +0000)
committerBruno Haible <bruno@clisp.org>
Thu, 1 Feb 2007 01:52:34 +0000 (01:52 +0000)
ChangeLog
gnulib-tool
modules/acl
modules/clock-time
modules/euidaccess
modules/gettext
modules/iconv
modules/lock
modules/nanosleep
modules/readline

index ab851dc..27decb8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-01-31  Bruno Haible  <bruno@clisp.org>
+
+       New module description field 'Link'.
+       * gnulib-tool (func_usage): Document --extract-link-directive.
+       (sed_extract_prog): Recognize 'Link' directive.
+       (func_get_link_directive): New function.
+       (func_import): Show summary of link directives.
+       Handle --extract-link-directive option.
+       * modules/acl (Link): New section.
+       * modules/clock-time (Link): New section.
+       * modules/euidaccess (Link): New section.
+       * modules/gettext (Link): New section.
+       * modules/iconv (Link): New section.
+       * modules/lock (Link): New section.
+       * modules/nanosleep (Link): New section.
+       * modules/readline (Link): New section.
+
 2007-01-27  Bruno Haible  <bruno@clisp.org>
 
        Enforce the use of gnulib modules for unportable <string.h> functions.
index 4b6fcb8..0046ff5 100755 (executable)
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2007-01-28 13:58:02 $'
+cvsdatestamp='$Date: 2007-02-01 01:52:34 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 nl='
@@ -93,6 +93,7 @@ Usage: gnulib-tool --list
        gnulib-tool --extract-autoconf-snippet module
        gnulib-tool --extract-automake-snippet module
        gnulib-tool --extract-include-directive module
+       gnulib-tool --extract-link-directive module
        gnulib-tool --extract-license module
        gnulib-tool --extract-maintainer module
        gnulib-tool --extract-tests-module module
@@ -117,6 +118,7 @@ Operation modes:
       --extract-autoconf-snippet   extract the snippet for configure.ac
       --extract-automake-snippet   extract the snippet for library makefile
       --extract-include-directive  extract the #include directive
+      --extract-link-directive     extract the linker directive
       --extract-license            report the license terms of the source files
                                    under lib/
       --extract-maintainer         report the maintainer(s) inside gnulib
@@ -891,6 +893,7 @@ sed_extract_prog=':[         ]*$/ {
     s/^configure\.ac:[  ]*$//
     s/^Makefile\.am:[   ]*$//
     s/^Include:[        ]*$//
+    s/^Link:[   ]*$//
     s/^License:[        ]*$//
     s/^Maintainer:[     ]*$//
     tb
@@ -1015,6 +1018,15 @@ func_get_include_directive ()
   sed -e 's/^\(["<]\)/#include \1/'
 }
 
+# func_get_link_directive module
+# Input:
+# - local_gnulib_dir  from --local-dir
+func_get_link_directive ()
+{
+  func_lookup_file "modules/$1"
+  sed -n -e "/^Link$sed_extract_prog" < "$lookedup_file"
+}
+
 # func_get_license module
 # Input:
 # - local_gnulib_dir  from --local-dir
@@ -2252,6 +2264,19 @@ func_import ()
   ) | sed -e '/^$/d' -e 's/^/  /'
   rm -f "$tmp"/include-angles "$tmp"/include-quotes "$tmp"/include-if
 
+  for module in $modules; do
+    func_get_link_directive "$module"
+  done \
+    | LC_ALL=C sort -u | sed -e '/^$/d' -e 's/^/  /' > "$tmp"/link
+  if test `wc -l < "$tmp"/link` != 0; then
+    echo
+    echo "You may need to use the following Makefile variables when linking."
+    echo "Use them in <program>_LDADD when linking a program, or"
+    echo "in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library."
+    cat "$tmp"/link
+  fi
+  rm -f "$tmp"/link
+
   echo
   echo "Don't forget to"
   if test "$makefile_am" = Makefile.am; then
@@ -3056,6 +3081,16 @@ case $mode in
     done
     ;;
 
+  extract-link-directive )
+    for module
+    do
+      func_verify_module
+      if test -n "$module"; then
+        func_get_link_directive "$module"
+      fi
+    done
+    ;;
+
   extract-license )
     for module
     do
index 26a6f68..9695115 100644 (file)
@@ -18,6 +18,9 @@ Makefile.am:
 Include:
 "acl.h"
 
+Link:
+$(LIB_ACL)
+
 License:
 GPL
 
index d69d613..ba866d9 100644 (file)
@@ -14,6 +14,9 @@ Makefile.am:
 
 Include:
 
+Link:
+$(LIB_CLOCK_GETTIME)
+
 License:
 GPL
 
index 965b719..66cfdd8 100644 (file)
@@ -18,6 +18,9 @@ Makefile.am:
 Include:
 "euidaccess.h"
 
+Link:
+$(LIB_EACCESS)
+
 License:
 LGPL
 
index b4f802d..1cfee27 100644 (file)
@@ -53,6 +53,9 @@ AM_CPPFLAGS += -I$(top_builddir)/intl
 Include:
 "gettext.h"
 
+Link:
+$(LTLIBINTL) when linking with libtool, $(LIBINTL) otherwise
+
 License:
 LGPL
 
index 757bd5b..0b930cc 100644 (file)
@@ -17,6 +17,9 @@ Include:
 # include <iconv.h>
 #endif
 
+Link:
+$(LTLIBICONV) when linking with libtool, $(LIBICONV) otherwise
+
 License:
 LGPL
 
index c6b2ccd..6d4a287 100644 (file)
@@ -19,6 +19,9 @@ lib_SOURCES += lock.h lock.c
 Include:
 "lock.h"
 
+Link:
+$(LTLIBTHREAD) when linking with libtool, $(LIBTHREAD) otherwise
+
 License:
 LGPL
 
index 02398d4..4cc7f52 100644 (file)
@@ -20,6 +20,9 @@ Makefile.am:
 Include:
 "timespec.h"
 
+Link:
+$(LIB_NANOSLEEP)
+
 License:
 GPL
 
index 24bbec9..933ae5b 100644 (file)
@@ -18,6 +18,9 @@ Makefile.am:
 Include:
 "readline.h"
 
+Link:
+$(LTLIBREADLINE) when linking with libtool, $(LIBREADLINE) otherwise
+
 License:
 GPL