Re: [RFC PATCH] configure: Create sh.config based on Makefile.config data

Subject: Re: [RFC PATCH] configure: Create sh.config based on Makefile.config data

Date: Sun, 25 May 2014 11:22:48 +0300

To: Tomi Ollila, notmuch@notmuchmail.org

Cc: tomi.ollila@iki.fi

From: Jani Nikula


On Sun, 11 May 2014, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> Read Makefile.config and when line matches var = val assignment
> create _var='val' from it. var must match [a-zA-Z_][a-zA-Z0-9_]*
> and val [^'\]* ('\' usually meaning multiline assignments).
>
> Write these lines to sh.config.
>
> sh.config can then be used e.g. in test scripts.

I like the general idea here much better than [1] or the symlinks that
we have now. However I'm wary of the sed magic and the various ways it
might trip over. The resulting file has way more info than we need, but
then it also misses the multiline settings (which we luckily don't
need).

At the risk of duplicating stuff, I'd go with manually generated config
for shell with minimal amount of information. For now, we'd only need
this for HAVE_XAPIAN_COMPACT and HAVE_MAN (the latter of which could
also be dropped from Makefile.config).

BR,
Jani.


[1] id:1399737224-79348-1-git-send-email-cceleri@cs.stanford.edu




> ---
>  configure | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/configure b/configure
> index 9bde2eb72b0e..feb0e480f86a 100755
> --- a/configure
> +++ b/configure
> @@ -935,3 +935,8 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\
>  
>  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
>  EOF
> +
> +# Create sh.config based on Makefile.config values.
> +# Output will be _var='val', val not containing ' nor \ (skipping multiline).
> +sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\) *= *\([^\\'\'']*\)$/_\1='\''\2'\''/p' \
> +	Makefile.config > sh.config
> -- 
> 1.8.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: