[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new config-h module, to remove the need for -DHAVE_CONFIG_H
From: |
Paul Eggert |
Subject: |
new config-h module, to remove the need for -DHAVE_CONFIG_H |
Date: |
Fri, 25 Aug 2006 23:43:14 -0700 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
I installed this into gnulib, and will install the corresponding
coreutils patch in a few minutes.
The basic idea is that source files should include config.h
unconditionally, so that we needn't clutter "make" output with
-DHAVE_CONFIG_H.
I'd also like to change gnulib source code so that its instances of
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
are replaced by "#include <config.h>". But one step at a time.
2006-08-25 Paul Eggert <address@hidden>
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.
--- MODULES.html.sh 25 Aug 2006 23:14:53 -0000 1.142
+++ MODULES.html.sh 26 Aug 2006 06:35:36 -0000
@@ -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
--- gnulib-tool 24 Aug 2006 13:48:29 -0000 1.143
+++ gnulib-tool 26 Aug 2006 06:35:36 -0000
@@ -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
--- /dev/null 2005-09-24 22:00:15.000000000 -0700
+++ m4/config-h.m4 2006-08-25 23:29:40.000000000 -0700
@@ -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=])])
--- /dev/null 2005-09-24 22:00:15.000000000 -0700
+++ modules/config-h 2006-08-25 23:04:57.000000000 -0700
@@ -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
- new config-h module, to remove the need for -DHAVE_CONFIG_H,
Paul Eggert <=