summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lefevre <vincent@vinc17.net>2021-08-24 15:17:05 +0200
committerVincent Lefevre <vincent@vinc17.net>2021-08-24 15:17:05 +0200
commit67c16b7cbbe793bd888648618beeb1f3aab0db00 (patch)
tree49eea627a11973ce6f70887cca131882574c6978
parent898eb3ca27b3320df1bf7707d12ec4a7c5c2b3ea (diff)
Improve conststrings.c generation, mainly for GNU Autoconf 2.71.
With GNU Autoconf 2.71, the "ac_cs_config=" line in config.status may contain sequences like '\'' when a configure argument has spaces in it, for instance CFLAGS with several options. Thus it is not sufficient to get this line with grep; one needs to eval it and output the result. GNU Autoconf 2.69 was including the whole $ac_cs_config value inside double quotes, and the previous code also had issues with configure arguments containing special characters (but spaces were fine).
-rw-r--r--Makefile.am8
1 files changed, 5 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 19381a48..a4377892 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -108,6 +108,10 @@ noinst_PROGRAMS = txt2c
mutt_dotlock.c: dotlock.c
cp $(srcdir)/dotlock.c mutt_dotlock.c
+# With autoconf 2.71, the "ac_cs_config=" line in config.status may contain
+# sequences like '\'' when using a configure argument with spaces in it,
+# for instance CFLAGS with several options. Thus it is not sufficient to
+# get this line with grep; one needs to eval it and output the result.
conststrings.c: txt2c config.status
( \
($(CC) -v >/dev/null 2>&1 && $(CC) -v) || \
@@ -116,9 +120,7 @@ conststrings.c: txt2c config.status
echo "unknown compiler"; \
) 2>&1 | ${srcdir}/txt2c.sh cc_version >conststrings_c
echo "$(CFLAGS)" | ${srcdir}/txt2c.sh cc_cflags >>conststrings_c
- grep ac_cs_config= config.status | \
- cut -d= -f2- | \
- sed -e 's/^"//' -e 's/"$$//' | ${srcdir}/txt2c.sh configure_options >>conststrings_c
+ ( eval "`grep '^ac_cs_config=' config.status`" && echo $$ac_cs_config; ) | ${srcdir}/txt2c.sh configure_options >>conststrings_c
mv -f conststrings_c conststrings.c
CLEANFILES = mutt_dotlock.c $(BUILT_SOURCES)