1 | #! /bin/sh
|
---|
2 |
|
---|
3 | # Build some of the Autoconf test files.
|
---|
4 |
|
---|
5 | # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
|
---|
6 | # Foundation, Inc.
|
---|
7 |
|
---|
8 | # This program is free software; you can redistribute it and/or modify
|
---|
9 | # it under the terms of the GNU General Public License as published by
|
---|
10 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
11 | # any later version.
|
---|
12 |
|
---|
13 | # This program is distributed in the hope that it will be useful,
|
---|
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | # GNU General Public License for more details.
|
---|
17 |
|
---|
18 | # You should have received a copy of the GNU General Public License
|
---|
19 | # along with this program; if not, write to the Free Software
|
---|
20 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
---|
21 | # 02110-1301, USA.
|
---|
22 |
|
---|
23 | # If we fail, clean up, but touch the output files. We probably failed
|
---|
24 | # because we used some non-portable tool.
|
---|
25 |
|
---|
26 | as_me=`echo "$0" | sed 's,.*[\\/],,'`
|
---|
27 |
|
---|
28 | trap 'echo "'"$as_me"': failed." >&2
|
---|
29 | rm -f acdefuns audefuns requires *.tat
|
---|
30 | trap "" 0
|
---|
31 | exit 1' \
|
---|
32 | 0 1 2 15
|
---|
33 |
|
---|
34 | # If ever something goes wrong, fail, so that the trap is launched.
|
---|
35 | set -e
|
---|
36 |
|
---|
37 | # We need arguments.
|
---|
38 | test $# != 0
|
---|
39 |
|
---|
40 | # We need these arguments.
|
---|
41 | src="$@"
|
---|
42 |
|
---|
43 | # Set locale to C so that `sort' behaves in a uniform way.
|
---|
44 | LANGUAGE=C; export LANGUAGE
|
---|
45 | LANG=C; export LANG
|
---|
46 | LC_ALL=C export LC_ALL
|
---|
47 |
|
---|
48 |
|
---|
49 | # requires
|
---|
50 | # --------
|
---|
51 | # Get the list of macros that are required: there is little interest
|
---|
52 | # in testing them since they will be run by the guy who requires them.
|
---|
53 | sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' $src |
|
---|
54 | sort -u >requires
|
---|
55 |
|
---|
56 |
|
---|
57 | # exclude_list
|
---|
58 | # ------------
|
---|
59 | # Macros which must not be checked at all (not with AT_CHECK_MACRO nor
|
---|
60 | # AT_CHECK_AU_MACRO).
|
---|
61 | exclude_list='
|
---|
62 | # Not a macro name at all.
|
---|
63 | /^$/ {next}
|
---|
64 |
|
---|
65 | # Not macros, just mapping from old variable name to a new one.
|
---|
66 | /^ac_cv_prog_(gcc|gxx|g77)$/ {next}
|
---|
67 | '
|
---|
68 |
|
---|
69 |
|
---|
70 | # ac_exclude_list
|
---|
71 | # ---------------
|
---|
72 | # We try to test all the Autoconf macros with AT_CHECK_MACRO to check
|
---|
73 | # for syntax problems, etc. Not every macros can be run without
|
---|
74 | # arguments, and some are already tested elsewhere. AC_EXCLUDE_LIST
|
---|
75 | # filters out the macros we don't want to test.
|
---|
76 | ac_exclude_list='
|
---|
77 | # Internal macros are used elsewhere.
|
---|
78 | /^_?_AC_/ {next}
|
---|
79 |
|
---|
80 | # Used in many places.
|
---|
81 | /^AC_.*_IFELSE$/ {next}
|
---|
82 | /^AC_LANG/ {next}
|
---|
83 | /^AC_RUN_LOG$/ {next}
|
---|
84 | /^AC_TRY/ {next}
|
---|
85 |
|
---|
86 | # Need an argument.
|
---|
87 | /^AC_(CANONICALIZE|PREFIX_PROGRAM|PREREQ)$/ {next}
|
---|
88 | /^AC_(SEARCH_LIBS|REPLACE_FUNCS)$/ {next}
|
---|
89 | /^AC_(CACHE_CHECK|COMPUTE)_INT$/ {next}
|
---|
90 |
|
---|
91 | # Performed in the semantics tests.
|
---|
92 | /^AC_CHECK_(ALIGNOF|DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|(TARGET_)?TOOL|TYPE)S?$/ {next}
|
---|
93 |
|
---|
94 | # Fail when the source does not exist.
|
---|
95 | /^AC_CONFIG/ {next}
|
---|
96 |
|
---|
97 | # AU defined to nothing.
|
---|
98 | /^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$/ {next}
|
---|
99 |
|
---|
100 | # Produce "= val" because $1, the variable used to store the result,
|
---|
101 | # is empty.
|
---|
102 | /^AC_(F77|FC)_FUNC$/ {next}
|
---|
103 | /^AC_FC_SRCEXT$/ {next}
|
---|
104 | /^AC_PATH_((TARGET_)?TOOL|PROG)S?$/ {next}
|
---|
105 |
|
---|
106 | # Requires the current language to be Fortran, not C.
|
---|
107 | /^AC_FC_FREEFORM$/ {next}
|
---|
108 |
|
---|
109 | # Is a number.
|
---|
110 | /^AC_FD_CC$/ {next}
|
---|
111 |
|
---|
112 | # Obsolete, but needs to be AC_DEFUNed.
|
---|
113 | /^AC_FOREACH$/ {next}
|
---|
114 |
|
---|
115 | # Require a file that is not shipped with Autoconf. But it should.
|
---|
116 | /^AC_FUNC_(GETLOADAVG|FNMATCH_GNU)$/ {next}
|
---|
117 | /^AC_REPLACE_FNMATCH$/ {next}
|
---|
118 |
|
---|
119 | # Obsolete, checked in semantics.
|
---|
120 | /^AC_FUNC_WAIT3$/ {next}
|
---|
121 | /^AC_SYS_RESTARTABLE_SYSCALLS$/ {next}
|
---|
122 |
|
---|
123 | # Not intended to be invoked at the top level.
|
---|
124 | /^AC_INCLUDES_DEFAULT$/ {next}
|
---|
125 |
|
---|
126 | # AC_INIT includes all the AC_INIT macros.
|
---|
127 | # There is an infinite m4 recursion if AC_INIT is used twice.
|
---|
128 | /^AC_INIT/ {next}
|
---|
129 |
|
---|
130 | # Checked in semantics.
|
---|
131 | /^AC_(PROG_CC|C_CONST|C_VOLATILE)$/ {next}
|
---|
132 | /^AC_PATH_XTRA$/ {next}
|
---|
133 |
|
---|
134 | # Requires a working C++ compiler, which is not a given.
|
---|
135 | /^AC_PROG_CXX_C_O$/ {next}
|
---|
136 |
|
---|
137 | # Already tested by AT_CHECK_MACRO.
|
---|
138 | /^AC_OUTPUT$/ {next}
|
---|
139 | '
|
---|
140 |
|
---|
141 |
|
---|
142 | # ac_exclude_script
|
---|
143 | # -----------------
|
---|
144 | # Build a single awk script out of the above.
|
---|
145 | ac_exclude_script="$exclude_list $ac_exclude_list {print}"
|
---|
146 |
|
---|
147 |
|
---|
148 | # au_exclude_list
|
---|
149 | # ---------------
|
---|
150 | # Check all AU_DEFUN'ed macros with AT_CHECK_AU_MACRO, except these.
|
---|
151 | au_exclude_list='
|
---|
152 | # Empty.
|
---|
153 | /^AC_(C_CROSS|PROG_CC_STDC)$/ {next}
|
---|
154 |
|
---|
155 | # Use AC_REQUIRE.
|
---|
156 | /^AC_(CYGWIN|MINGW32|EMXOS2)$/ {next}
|
---|
157 |
|
---|
158 | # Already in configure.ac.
|
---|
159 | /^AC_(INIT|OUTPUT)$/ {next}
|
---|
160 |
|
---|
161 | # AC_LANG_SAVE needs user interaction to be removed.
|
---|
162 | # AC_LANG_RESTORE cannot be used alone.
|
---|
163 | /^AC_LANG_(SAVE|RESTORE)$/ {next}
|
---|
164 |
|
---|
165 | # Need arguments and are tested elsewhere.
|
---|
166 | /^AC_(LINK_FILES|PREREQ)$/ {next}
|
---|
167 | '
|
---|
168 |
|
---|
169 | # au_exclude_script
|
---|
170 | # -----------------
|
---|
171 | # Build a single awk script out of the above.
|
---|
172 | au_exclude_script="$exclude_list $au_exclude_list {print}"
|
---|
173 |
|
---|
174 |
|
---|
175 | ## ------------------------- ##
|
---|
176 | ## Creating the test files. ##
|
---|
177 | ## ------------------------- ##
|
---|
178 |
|
---|
179 | for file in $src
|
---|
180 | do
|
---|
181 | base=`echo "$file" | sed 's,.*[\\/],,;s/\..*//'`
|
---|
182 | # Get the list of macros which are defined in Autoconf level.
|
---|
183 | # Get rid of the macros we are not interested in.
|
---|
184 | sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
|
---|
185 | -e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' $file |
|
---|
186 | awk "$ac_exclude_script" |
|
---|
187 | sort -u >acdefuns
|
---|
188 |
|
---|
189 | # Get the list of macros which are defined in Autoupdate level.
|
---|
190 | sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' $file |
|
---|
191 | awk "$au_exclude_script" |
|
---|
192 | sort -u >audefuns
|
---|
193 |
|
---|
194 | # Filter out required macros.
|
---|
195 | {
|
---|
196 | sed 's/^ *//' <<MK_EOF
|
---|
197 | # Generated by $as_me. -*- Autotest -*-
|
---|
198 |
|
---|
199 | ## --------------------- ##
|
---|
200 | ## Do not edit by hand. ##
|
---|
201 | ## --------------------- ##
|
---|
202 |
|
---|
203 | # Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
---|
204 |
|
---|
205 | AT_BANNER([Testing autoconf/$base macros.])
|
---|
206 |
|
---|
207 | MK_EOF
|
---|
208 |
|
---|
209 | echo "# Modern macros."
|
---|
210 | comm -23 acdefuns requires | sed 's/.*/AT_CHECK_MACRO([&])/'
|
---|
211 | echo
|
---|
212 | echo "# Obsolete macros."
|
---|
213 | comm -23 audefuns requires | sed 's/.*/AT_CHECK_AU_MACRO([&])/'
|
---|
214 | } >ac$base.tat
|
---|
215 |
|
---|
216 | # In one atomic step so that if something above fails, the trap
|
---|
217 | # preserves the old version of the file. If there is nothing to
|
---|
218 | # check, output /rien du tout/[1].
|
---|
219 | if grep AT_CHECK ac$base.tat >/dev/null 2>&1; then
|
---|
220 | mv -f ac$base.tat ac$base.at
|
---|
221 | else
|
---|
222 | rm -f ac$base.tat ac$base.at
|
---|
223 | touch ac$base.at
|
---|
224 | fi
|
---|
225 | # Help people not to update these files by hand.
|
---|
226 | chmod a-w ac$base.at
|
---|
227 | done
|
---|
228 |
|
---|
229 | rm -f acdefuns audefuns requires
|
---|
230 |
|
---|
231 | trap '' 0
|
---|
232 | exit 0
|
---|
233 |
|
---|
234 | # [1] En franc,ais dans le texte.
|
---|