New config-h module, so that "make" output needn't be cluttered
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Aug 2006 06:39:32 +0000 (06:39 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Aug 2006 06:39:32 +0000 (06:39 +0000)
by -DHAVE_CONFIG_H.
* MODULES.html.sh (Support for building libraries and executables):
Add config-h.
* modules/config-h: New file.
* gnulib-tool (nl, sed_transform_lib_file): New vars.
(func_import): Turn "#ifdef HAVE_CONFIG_H" to "#if 1" if
the config-h module is used.
* m4/config-h.m4: New file.

ChangeLog
MODULES.html.sh
gnulib-tool
m4/ChangeLog
m4/config-h.m4 [new file with mode: 0644]
modules/config-h [new file with mode: 0644]

index 92cec00..696b22f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2006-08-25  Paul Eggert  <eggert@cs.ucla.edu>
 
+       New config-h module, so that "make" output needn't be cluttered
+       by -DHAVE_CONFIG_H.
+       * MODULES.html.sh (Support for building libraries and executables):
+       Add config-h.
+       * modules/config-h: New file.
+       * gnulib-tool (nl, sed_transform_lib_file): New vars.
+       (func_import): Turn "#ifdef HAVE_CONFIG_H" to "#if 1" if
+       the config-h module is used.
+
        New configmake module, so that "make" output needn't be cluttered
        by fluff like '-DLIBDIR=\"/usr/local/lib\"'.
        * MODULES.html.sh (Support for building libraries and executables):
index 5fb9747..b6d41a9 100755 (executable)
@@ -2099,6 +2099,7 @@ func_all_modules ()
   func_echo "$element"
 
   func_begin_table
+  func_module config-h
   func_module configmake
   func_module dummy
   func_module elisp-comp
index 7f0ee31..1ce4f5d 100755 (executable)
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2006-08-24 13:48:29 $'
+cvsdatestamp='$Date: 2006-08-26 06:39:32 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 
@@ -59,6 +59,9 @@ if test -z "$SORT"; then
   SORT=sort
 fi
 
+nl='
+'
+
 # func_usage
 # outputs to stdout the --help usage message.
 func_usage ()
@@ -1226,6 +1229,23 @@ func_import ()
     done
   fi
 
+  # Determine script to apply to imported library files.
+  sed_transform_lib_file=
+  case $nl$modules$nl in
+    *"${nl}config-h$nl"*)
+      # Assume config.h exists, and that -DHAVE_CONFIG_H is omitted.
+      sed_transform_lib_file=$sed_transform_lib_file'
+       s/^#ifdef[       ]*HAVE_CONFIG_H[        ]*$/#if 1/
+      ' ;;
+  esac
+  if test -n "$lgpl"; then
+    # Update license.
+    sed_transform_lib_file=$sed_transform_lib_file'
+      s/GNU General/GNU Lesser General/g
+      s/version 2\([ ,]\)/version 2.1\1/g
+    '
+  fi
+
   # Determine final file list.
   func_modules_to_filelist
   echo "File list:"
@@ -1349,12 +1369,10 @@ func_import ()
     func_dest_tmpfilename "$g"
     func_lookup_file "$f"
     cp "$lookedup_file" "$tmpfile" || func_fatal_error "failed"
-    if test -n "$lgpl"; then
-      # Update license.
+    if test -n "sed_transform_lib_file"; then
       case "$f" in
         lib/*)
-          sed -e 's/GNU General/GNU Lesser General/g' \
-              -e 's/version 2\([ ,]\)/version 2.1\1/g' \
+          sed -e "$sed_transform_lib_file" \
             < "$lookedup_file" > "$tmpfile" || func_fatal_error "failed"
           ;;
       esac
index 7957ca3..972d36a 100644 (file)
@@ -1,3 +1,7 @@
+2006-08-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * config-h.m4: New file.
+
 2006-08-23  Bruno Haible  <bruno@clisp.org>
 
        * fsusage.m4 (gl_FILE_SYSTEM_USAGE): Don't consider BeOS statvfs
diff --git a/m4/config-h.m4 b/m4/config-h.m4
new file mode 100644 (file)
index 0000000..807d515
--- /dev/null
@@ -0,0 +1,13 @@
+# Say that -DHAVE_CONFIG_H is not needed.
+
+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.
+
+# This package's source files all include config.h unconditionally,
+# so there's no need to pass -DHAVE_CONFIG_H to the compiler.
+AC_DEFUN([gl_CONFIG_H],
+  [AC_CONFIG_COMMANDS_PRE([test "X$DEFS" = X-DHAVE_CONFIG_H && DEFS=])])
diff --git a/modules/config-h b/modules/config-h
new file mode 100644 (file)
index 0000000..0af7c3e
--- /dev/null
@@ -0,0 +1,20 @@
+Description:
+Assume config.h exists, to avoid -DHAVE_CONFIG_H clutter in 'make' output.
+
+Files:
+m4/config-h.m4
+
+Depends-on:
+
+configure.ac:
+gl_CONFIG_H
+
+Makefile.am:
+
+Include:
+
+License:
+LGPL
+
+Maintainer:
+Paul Eggert, Jim Meyering