3 # Build some of the Autoconf test files.
4 # Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 # If we fail, clean up, but touch the output files. We probably failed
22 # because we used some non portable tool, but we just don't care: this
23 # shell script is a maintainer tool, and we do expect good tools.
25 as_me
=`echo "$0" | sed 's,.*[\\/],,'`
27 trap 'echo "'"$as_me"': failed. To proceed run make check." >&2
28 rm -f acdefuns audefuns requires *.tat
31 touch `echo "$file" | sed "s,.*[\\/],,;s/\..*/.at/"`
37 # If ever something goes wrong, fail, so that the trap be launched.
43 # We need these arguments.
46 # Set locale to C so that `sort' behaves in a uniform way.
47 export LANGUAGE
; LANGUAGE
=C
49 export LC_ALL
; LC_ALL
=C
54 # Get the list of macros that are required: there is little interest
55 # in testing them since they will be run but the guy who requires
58 sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
65 # Macros which must not be checked at all (not by ac-macros.at, nor
67 # The trailing new line is meant.
69 # - ac_cv_prog_gcc, gxx, g77
70 # Not macros, just mapping from old variable name to a new one.
71 exclude_list
='^ac_cv_prog_(gcc|gxx|g77)$
77 # The test `ac-macros.at' tries to run all the macros of Autoconf to check
78 # for syntax problems, etc. Not all the macros can be run without argument,
79 # and some are already tested elsewhere. EGREP_EXCLUDE must filter out
80 # the macros we don't want to test in ac-macros.at.
82 # - AC_CANONICALIZE, AC_PREFIX_PROGRAM, AC_PREREQ
85 # - AC_CHECK decl, file, func, header, lib, member, prog, sizeof, type
86 # Performed in the semantics tests.
89 # They fail when the source does not exist.
91 # - AC_FUNC_GETLOADAVG, AC_REPLACE_FNMATCH, AC_FUNC_FNMATCH_GNU
92 # Require a file that is not shipped with Autoconf. But it should.
95 # AC_INIT includes all the AC_INIT macros. Note that there is an
96 # infinite m4 recursion if AC_INIT it used twice.
99 # Heavily used by other macros.
101 # - AC_PATH_PROGS?, AC_F77_FUNC, AC_FC_FUNC, AC_FC_SRCEXT
102 # They produce `= val' because $1, the variable used to store the result,
106 # Requires the current language to be Fortran, not C.
108 # - AC_TRY, AC_.*_IFELSE, AC_RUN_LOG.
109 # Used in many places.
112 # Internal macros are used elsewhere.
115 # Already tested by `AT_CHECK_MACRO'.
120 # - AC_PROG_CC, AC_C_(CONST|INLINE|VOLATILE), AC_PATH_XTRA
121 # Checked in semantics.
123 # - AC_CYGWIN, AC_CYGWIN32, AC_EMXOS2, AC_MING32, AC_EXEEXT, AC_OBJEXT
124 # AU defined to nothing.
127 # Checked in semantics.
129 # - AC_SYS_RESTARTABLE_SYSCALLS, AC_FUNC_WAIT3
130 # Obsolete, checked in semantics.
132 ac_exclude_list
='^AC_ARG_VAR$
133 ^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
134 ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$
137 ^AC_FC_(FUNC|FREEFORM|SRCEXT)$
139 ^AC_FUNC_(GETLOADAVG|FNMATCH_GNU|WAIT3)$
146 ^AC_PATH_(TOOL|PROG)S?$
147 ^AC_REPLACE_(FNMATCH|FUNCS)$
149 ^(AC_TRY.*|AC_RUN_LOG)$
151 ^(AC_(PROG_CC|C_CONST|C_INLINE|C_RESTRICT|C_VOLATILE))$
152 ^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$
154 ^AC_SYS_RESTARTABLE_SYSCALLS$
160 # Build a single extended regular expression out of filter_macros_list.
161 ac_exclude_egrep
=$exclude_list$ac_exclude_list
167 # cannot be used alone.
168 # AC_LINK_FILES, AC_PREREQ
169 # need arguments and are tested elsewhere.
170 # AC_INIT and AC_OUTPUT
171 # are already in `configure.ac'.
172 # AC_C_CROSS and AC_PROG_CC_STDC
174 # AC_CYGWIN, AC_MINGW32, AC_EMXOS2
175 # are using AC_REQUIRE.
176 au_exclude_list
='^AC_LANG_RESTORE$
177 ^AC_LINK_FILES|AC_PREREQ$
179 ^AC_C_CROSS|AC_PROG_CC_STDC$
180 ^AC_(CYGWIN|MINGW32|EMXOS2)$'
185 # Build a single extended regular expression out of filter_macros_list.
186 au_exclude_egrep
=$exclude_list$au_exclude_list
191 if echo a |
(grep -E '(a|b)') >/dev
/null
2>&1
197 ## ------------------------- ##
198 ## Creating the test files. ##
199 ## ------------------------- ##
203 base
=`echo "$file" | sed 's,.*[\\/],,;s/\..*//'`
204 # Get the list of macros which are defined in Autoconf level.
205 # Get rid of the macros we are not interested in.
207 sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
208 -e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
211 # Watch out we are `set -e': don't fail.
212 ($egrep -v "$ac_exclude_egrep" || true
) >acdefuns
214 # Get the list of macros which are defined in Autoupdate level.
216 sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' |
219 ($egrep -v "$au_exclude_egrep" || true
) > audefuns
221 # Filter out required macros.
223 sed 's/^ *//' <<MK_EOF
224 # Generated by $as_me. -*- Autotest -*-
226 ## --------------------- ##
227 ## Do not edit by hand. ##
228 ## --------------------- ##
230 # Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
232 AT_BANNER([Testing autoconf/$base macros.])
236 echo "# Modern macros."
237 for macro
in `cat acdefuns`; do
238 if grep "$macro" requires
>/dev
/null
2>&1; then :; else
239 echo "AT_CHECK_MACRO([$macro])"
243 echo "# Obsolete macros."
244 for macro
in `cat audefuns`; do
245 if grep "$macro" requires
>/dev
/null
2>&1; then :; else
246 echo "AT_CHECK_AU_MACRO([$macro])"
251 # In one atomic step so that if something above fails, the trap
252 # preserves the old version of the file. If there is nothing to
253 # check, output /rien du tout/[1].
254 if grep AT_CHECK ac
$base.tat
>/dev
/null
2>&1; then
255 mv -f ac
$base.tat ac
$base.
at
256 # Help people not to update these files by hand.
259 rm -f ac
$base.tat ac
$base.
at
264 rm -f acdefuns audefuns requires
269 # [1] En franc,ais dans le texte.