changeset 7199:85ef7b18536b

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. * m4/config-h.m4: New file.
author Paul Eggert <eggert@cs.ucla.edu>
date Sat, 26 Aug 2006 06:39:32 +0000
parents 5d9d77ec603f
children d3872bcda7e9
files ChangeLog MODULES.html.sh gnulib-tool m4/ChangeLog m4/config-h.m4 modules/config-h
diffstat 6 files changed, 70 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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):
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2099,6 +2099,7 @@
   func_echo "$element"
 
   func_begin_table
+  func_module config-h
   func_module configmake
   func_module dummy
   func_module elisp-comp
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -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 @@
   SORT=sort
 fi
 
+nl='
+'
+
 # func_usage
 # outputs to stdout the --help usage message.
 func_usage ()
@@ -1226,6 +1229,23 @@
     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_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
--- a/m4/ChangeLog
+++ b/m4/ChangeLog
@@ -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
new file mode 100644
--- /dev/null
+++ b/m4/config-h.m4
@@ -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=])])
new file mode 100644
--- /dev/null
+++ b/modules/config-h
@@ -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