bug-gnulib
[Top][All Lists]
Advanced

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

Re: maint.mk and config.h


From: Eric Blake
Subject: Re: maint.mk and config.h
Date: Mon, 27 Apr 2009 13:11:58 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Jim Meyering on 4/26/2009 11:41 PM:
> Eric Blake wrote:
>> Right now, maint.mk is hard-coded to check for <config.h> as the first
>> include of each .c file.  But what about m4's situation, where every file
>> includes a common header ("m4.h", analogous to coreutils' "system.h") from
>> the project first, and that header in turn includes <config.h> first?
>> Would it be worth trying to parameterize the preferred name of the first
>> file to include as part of cfg.mk?
> 
> Yes.
> This is a common situation.

Done as follows, after testing that m4 could add config_h_header="m4\.h"
in its cfg.mk.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkn2A30ACgkQ84KuGfSFAYBhlQCeKYxnrnNM3NkH8T+nqjQJyvSf
z/UAoNHfVCBANULC1K98Ien6UWAHGCTF
=oeX7
-----END PGP SIGNATURE-----
>From 3c52ec7163fa9d23e0446019f21d85fb5a69c778 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Mon, 27 Apr 2009 08:36:55 -0600
Subject: [PATCH] maint.mk: allow package-specific header to provide <config.h>

* top/maint.mk (sc_require_config_h): New variable.
(sc_require_config_h, sc_require_config_h_first): Use it.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog    |    6 ++++++
 top/maint.mk |   12 ++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3126a87..1c0d6a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-27  Eric Blake  <address@hidden>
+
+       maint.mk: allow package-specific header to provide <config.h>
+       * top/maint.mk (sc_require_config_h): New variable.
+       (sc_require_config_h, sc_require_config_h_first): Use it.
+
 2009-04-27  Simon Josefsson  <address@hidden>

        * top/maint.mk (sc_avoid_if_before_free): Except
diff --git a/top/maint.mk b/top/maint.mk
index 2873878..b7f6868 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -191,10 +191,13 @@ sc_prohibit_have_config_h:
          { echo '$(ME): found use of HAVE''_CONFIG_H; remove'          \
                1>&2; exit 1; } || :

-# Nearly all .c files must include <config.h>.
+# Nearly all .c files must include <config.h>.  However, we also permit this
+# via inclusion of a package-specific header, if cfg.mk specified one.
+# config_h_header must be suitable for grep -E.
+config_h_header ?= <config\.h>
 sc_require_config_h:
-       @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then               
\
-         grep -L '^# *include <config\.h>'                             \
+       @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then       \
+         grep -EL '^# *include $(config_h_header)'                     \
                $$($(VC_LIST_EXCEPT) | grep '\.c$$')                    \
              | grep . &&                                               \
          { echo '$(ME): the above files do not include <config.h>'     \
@@ -203,12 +206,13 @@ sc_require_config_h:
        fi

 # You must include <config.h> before including any other header file.
+# This can possibly be via a package-specific header, if given by cfg.mk.
 sc_require_config_h_first:
        @if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then       \
          fail=0;                                                       \
          for i in $$($(VC_LIST_EXCEPT) | grep '\.c$$'); do             \
            grep '^# *include\>' $$i | sed 1q                           \
-               | grep '^# *include <config\.h>' > /dev/null            \
+               | grep -E '^# *include $(config_h_header)' > /dev/null  \
              || { echo $$i; fail=1; };                                 \
          done;                                                         \
          test $$fail = 1 &&                                            \
-- 
1.6.1.2


reply via email to

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