Pádraig Brady wrote:
> On 22/01/10 17:09, Jim Meyering wrote:
>> Eric Blake wrote:
>>> According to Jim Meyering on 1/22/2010 6:17 AM:
>>>> However, it'd sure be nice to use something more generic than
>>>> lib/config.h.  IMHO, autoconf should make configure AC_SUBST its
>>>> currently-internal-only CONFIG_HEADERS variable.  While we wait,
>>>> I suppose we can kludge it by extracting the first file name
>>>> from the use of AC_CONFIG_HEADER(S)? in configure.ac.
>>>
>>> And what's wrong with AH_HEADER?  It should be possible to do something
>>> like (untested):
>>>
>>> AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
>>>   [AC_SUBST([CONFIG_HEADER], m4_defn([AH_HEADER]))])])
>>
>> I didn't know we could do that ;-)
>> And it's even documented.
>> Thanks!
>>
>> Then, to enable maint.mk to rely on a definition of $(CONFIG_HEADER)
>> we could add something like the above to modules/maintainer-makefile:
>>
>>      configure.ac:
>>      AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
>>        [AC_SUBST([CONFIG_HEADER], m4_defn([AH_HEADER]))])])
>>
>
> The attached gnulib patch (summarized below) seems to work.
>
> cheers,
> Pádraig.
>
> --- a/modules/maintainer-makefile
> +++ b/modules/maintainer-makefile
>
> +configure.ac:
> +AC_CONFIG_COMMANDS_PRE([m4_ifdef([AH_HEADER],
> +  [AC_SUBST([CONFIG_INCLUDE], m4_defn([AH_HEADER]))])])
> +
>
> --- a/top/maint.mk
> +++ b/top/maint.mk
>
> +# #if HAVE_... will evaluate to false for any non numeric string.
> +# That would be flagged by using -Wundef, however gnulib currently
> +# tests many undefined macros, and so we can't enable that option.
> +# So at least preclude common boolean strings as macro values.
> +sc_Wundef_boolean:
> +       @grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \
> +         { echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || :
> +
>
>
>>From 0e9eb78c012655bc9f4e9deb12d574bed52f898c Mon Sep 17 00:00:00 2001
> From: =?utf-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
> Date: Mon, 25 Jan 2010 10:55:34 +0000
> Subject: [PATCH] syntax-check: detect incorrect boolean macro values in 
> config.h
>
> * modules/maintainer-makefile (configure.ac): Parameterize the location
> of config.h.  The logic is from Eric Blake and the location indicated
> by Jim Meyering.  Note CONFIG_HEADER is a forbidden variable name.
> * top/maint.mk (sc_Wundef_boolean): New rule.
> ---
>  ChangeLog                   |    8 ++++++++
>  modules/maintainer-makefile |    4 ++++
>  top/maint.mk                |    8 ++++++++
>  3 files changed, 20 insertions(+), 0 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 9546514..ad563d4 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,11 @@
> +2010-01-25 Pádraig Brady <p...@draigbrady.com>
> +
> +     syntax-check: detect incorrect boolean macro values in config.h
> +     * modules/maintainer-makefile (configure.ac): Parameterize the location
> +     of config.h.  The logic is from Eric Blake and the location indicated
> +     by Jim Meyering.  Note CONFIG_HEADER is a forbidden variable name.
> +     * top/maint.mk (sc_Wundef_boolean): New rule.

That patch looks fine.
What does "forbidden variable name" mean?
Maybe say that this has the effect of exporting CONFIG_HEADER
(via an AC_SUBST-like mechanism) so that Makefile.am files may
use $(CONFIG_HEADER) ?


Reply via email to