libtool-patches
[Top][All Lists]
Advanced

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

Re: reorganized config.status


From: Stepan Kasal
Subject: Re: reorganized config.status
Date: Wed, 10 Aug 2005 10:39:54 +0200
User-agent: Mutt/1.4.1i

Hello Ralf,
  no, I don't think using ac_config_headers is a good idea.

First, let me return to your original code:

| m4_ifset([AC_LIST_HEADERS],
|     [CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[     ]]*,,;s,[[ 
:]].*$,,'`],
|     [CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])])

I think this code was unfortunate, because it combined static and
dynamic computation.  It should have been:

m4_ifset([AC_LIST_HEADERS],
    [CONFIG_H="m4_bpatsubst(m4_normalize(AC_LIST_HEADERS), [[ :]*])"],
    [CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])])

IOW, the name of the header should have been computed statically, by m4.

The other alternative would be to use ac_config_headers for dynamic
computation, like this:

if test "$ac_config_headers" = ""; then
  CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])
else
  [CONFIG_H=`echo "$ac_config_headers" | $SED 's,^[     ]*,,;s,[        
:].*$,,'`]
fi

This alternative would that survive my recent rewrite of config.status macros.

But I think the "static" alternative is better, because it is consitent
with autoheader.  autoheader has no option, it cannot use the "dynamic"
method.

Please note that the two methods can give different results, at least in
theory, the first AC_CONFIG_HEADERS can be hidden in an if and run only
in certain cases.

And I think that "to know the name of the config header" is a
legitimate requirement, which could help other projects, too.
So I think Autoconf should give the full answer, so that the user doesn't
have to use sed.

So I still would like to see this:
> > [...] the first AC_CONFIG_HEADERS could define a macro, say
> > AH_HEADER which would hold the name.
> >
> > You could then do:
> > m4_ifndef([AH_HEADER], [AC_CONFIG_HEADERS([config.h])])
> > AC_SUBST([CONFIG_H], ["AH_HEADER"])

and I don't think ac_config_headers should be published.

Have a nice day,
        Stepan

BTW: your patch (attached below) would not work with CVS Autoconf if
there were no config headers declared.  (_AC_LIST_TAGS is set as soon
as a config file is declared.)

> --- m4/ltdl.m4        29 Jul 2005 13:24:13 -0000      1.31
> +++ m4/ltdl.m4        4 Aug 2005 12:40:58 -0000
> @@ -164,10 +164,10 @@
>  # the parent projects config.h file, The first file in AC_CONFIG_HEADERS
>  # must contain the definitions required by ltdl.c.
>  m4_ifset([_AC_LIST_TAGS],
> -    [CONFIG_H=`echo "_AC_LIST_TAGS" | $GREP HEADERS | $SED 's,^[[    
> ]]*,,;s,[[ :)]].*$,,'`],
> -  [m4_ifset([AC_LIST_HEADERS],
> -    [CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[  ]]*,,;s,[[ :]].*$,,'`],
> -  [CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])]])
> +      [CONFIG_H=`echo "$ac_config_headers" | $SED 's,^[[     ]]*,,;s,[[ 
> :)]].*$,,'`],
> +      [m4_ifset([AC_LIST_HEADERS],
> +                [CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[      
> ]]*,,;s,[[ :]].*$,,'`],
> +                [CONFIG_H=config.h;AC_CONFIG_HEADERS([config.h])])])
>  AC_SUBST([CONFIG_H])




reply via email to

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