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