aboutsummaryrefslogtreecommitdiffstats
path: root/main/autoconf/0001-Fix-regression-of-AC_CONFIG_SUBDIRS-with-multiple-ar.patch
blob: ca73d2d34fc5dec2265307ab6f3d70e243d9b0c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
From 49a6f8a8b52060d8fe0f97aa6f1d5c47b40b65c1 Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Date: Tue, 6 Jul 2010 22:31:33 +0200
Subject: [PATCH 1/5] Fix regression of AC_CONFIG_SUBDIRS with multiple arguments.

* lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Do not assume the
argument is a single word.
* tests/torture.at (Deep Package): Extend test to cover this.
(Non-literal AC_CONFIG_SUBDIRS): New test.
* doc/autoconf.texi (Subdirectories): Add example marker.
* NEWS: Update.
Report by Bruno Haible.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
---
 ChangeLog              |   12 ++++++++++
 NEWS                   |    2 +
 doc/autoconf.texi      |    1 +
 lib/autoconf/status.m4 |    2 +-
 tests/torture.at       |   54 +++++++++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 0c106c7..39c2ba6 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -3617,6 +3617,7 @@ Make @code{AC_OUTPUT} run @command{configure} in each subdirectory
 be a literal, i.e., please do not use:
 
 @example
+@c If you change this example, adjust tests/torture.at:Non-literal AC_CONFIG_SUBDIRS.
 if test "x$package_foo_enabled" = xyes; then
   my_subdirs="$my_subdirs foo"
 fi
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 52b7a3d..b9e7026 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -1102,7 +1102,7 @@ AC_DEFUN([AC_CONFIG_SUBDIRS],
   _AC_CONFIG_COMPUTE_DEST(], [))])]dnl
 [m4_append([_AC_LIST_SUBDIRS], [$1], [
 ])]dnl
-[AS_LITERAL_WORD_IF([$1], [],
+[AS_LITERAL_IF([$1], [],
 	       [AC_DIAGNOSE([syntax], [$0: you should use literals])])]dnl
 [AC_SUBST([subdirs], ["$subdirs m4_normalize([$1])"])])
 
diff --git a/tests/torture.at b/tests/torture.at
index 5f13874..e7f61ed 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1567,7 +1567,9 @@ AC_ARG_VAR([INNER2], [an inner2 variable])
 AC_OUTPUT
 ]])
 
-AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
+AT_CHECK([autoreconf -Wall -v], [0], [ignore], [stderr])
+# We should not warn about nonliteral argument to AC_CONFIG_SUBDIRS here.
+AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [1])
 AT_CHECK([test -f inner/configure])
 AT_CHECK([test -f inner/innermost/configure])
 AT_CHECK([test -f inner/innermost/config.hin])
@@ -1693,6 +1695,56 @@ AT_CHECK([test -f inner/myfile], 0)
 AT_CLEANUP
 
 
+## ------------------------------- ##
+## Non-literal AC_CONFIG_SUBDIRS.  ##
+## ------------------------------- ##
+
+AT_SETUP([Non-literal AC_CONFIG_SUBDIRS])
+AT_KEYWORDS([autoreconf])
+
+# We use aclocal (via autoreconf).
+AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
+
+AT_DATA([install-sh], [])
+AT_DATA([configure.in],
+[[AC_INIT(GNU Outer, 1.0)
+
+my_subdirs=
+# Taken from autoconf.texi:Subdirectories.
+if test "x$package_foo_enabled" = xyes; then
+  my_subdirs="$my_subdirs foo"
+fi
+AC_CONFIG_SUBDIRS([$my_subdirs])
+AC_OUTPUT
+]])
+
+AS_MKDIR_P([foo])
+
+AT_DATA([foo/configure],
+[[#! /bin/sh
+touch innerfile
+exit 0
+]])
+chmod +x foo/configure
+
+# autoreconf should warn without -Wno-syntax, but should not fail without -Werror.
+AT_CHECK([autoreconf -Werror -v], [1], [ignore], [stderr])
+AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [0], [ignore])
+AT_CHECK([autoreconf -v], [0], [ignore], [stderr])
+AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [0], [ignore])
+# We cannot assume aclocal won't warn (aclocal-1.9 does not understand -W*
+# options), so check autoconf only.
+AT_CHECK([autoconf --force -Wno-syntax], 0, [ignore], [stderr])
+AT_CHECK([grep 'AC_CONFIG_SUBDIRS:.*literals' stderr], [1])
+
+AT_CHECK([./configure $configure_options], [0], [ignore])
+AT_CHECK([test ! -f foo/innerfile])
+# Running the outer configure should trigger the inner.
+AT_CHECK([./configure $configure_options package_foo_enabled=yes], [0], [ignore])
+AT_CHECK([test -f foo/innerfile])
+
+AT_CLEANUP
+
 
 ## ----------------- ##
 ## Empty directory.  ##
-- 
1.7.1.1