No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / autoconf / tests / mktests.sh
blob8981cd3724c836a550385094d6f1f13f589f3792
1 #! /bin/sh
3 # Build some of the Autoconf test files.
4 # Copyright 2000 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)
9 # any later version.
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
19 # 02111-1307, USA.
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
29 for file in "$@"
31 touch `echo "$file" | sed "s,.*[\\/],,;s/\..*/.at/"`
32 done
33 trap 0
34 exit 1' \
35 0 1 2 15
37 # If ever something goes wrong, fail, so that the trap be launched.
38 set -e
40 # We need arguments.
41 test $# != 0
43 # We need these arguments.
44 src="$@"
46 # Set locale to C so that `sort' behaves in a uniform way.
47 export LANGUAGE; LANGUAGE=C
48 export LANG; LANG=C
49 export LC_ALL; LC_ALL=C
52 # requires
53 # --------
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
56 # them.
57 cat $src |
58 sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
59 sort |
60 uniq >requires
63 # exclude_list
64 # ------------
65 # Macros which must not be checked at all (not by ac-macros.at, nor
66 # au-macros.at).
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)$
75 # ac_exclude_list
76 # ---------------
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
83 # Need an argument.
84 # - AC_CHECK decl, file, func, header, lib, member, prog, sizeof, type
85 # Performed in the semantics tests.
86 # - AC_CONFIG
87 # They fail when the source does not exist.
88 # - AC_INIT
89 # AC_INIT includes all the AC_INIT macros. Note that there is an
90 # infinite m4 recursion if AC_INIT it used twice.
91 # - AC_LANG*
92 # Heavily used by other macros.
93 # - AC_PATH_PROGS?, AC_F77_FUNC
94 # They produce `= val' because $1, the variable used to store the result,
95 # is empty.
96 # - AC_TRY, AC_.*_IFELSE, AC_RUN_LOG.
97 # Used in many places.
98 # - _AC_
99 # Internal macros are used elsewhere.
100 # - AC_OUTPUT
101 # Already tested by `AT_CHECK_MACRO'.
102 # - AC_FD_CC
103 # Is a number.
104 # - AC_PROG_CC, AC_C_(CONST|INLINE|VOLATILE), AC_PATH_XTRA
105 # Checked in semantics.
106 # - AC_CYGWIN, AC_CYGWIN32, AC_EMXOS2, AC_MING32, AC_EXEEXT, AC_OBJEXT
107 # AU defined to nothing.
108 # - AC_PATH_XTRA
109 # Checked in semantics.
110 # - AC_SYS_RESTARTABLE_SYSCALLS, AC_FUNC_WAIT3
111 # Obsolete, checked in semantics.
113 ac_exclude_list='^AC_ARG_VAR$
114 ^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
115 ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$
116 ^AC_CONFIG
117 ^AC_F77_FUNC$
118 ^AC_INIT
119 ^AC_LANG
120 ^AC_LINKER_OPTION$
121 ^AC_LINK_FILES$
122 ^AC_LIST_MEMBER_OF$
123 ^AC_OUTPUT$
124 ^AC_PATH_(TOOL|PROG)S?$
125 ^AC_REPLACE_FUNCS$
126 ^AC_SEARCH_LIBS$
127 ^(AC_TRY.*|AC_RUN_LOG)$
128 ^AC_.*_IFELSE$
129 ^AC_FD_CC$
130 ^(AC_(PROG_CC|C_CONST|C_INLINE|C_VOLATILE))$
131 ^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$
132 ^AC_PATH_XTRA$
133 ^AC_SYS_RESTARTABLE_SYSCALLS$
134 ^AC_FUNC_WAIT3$
135 _AC_'
138 # ac_exclude_egrep
139 # ----------------
140 # Build a single egrep pattern out of filter_macros_list.
141 # Sed is used to get rid of the trailing `|' coming from the trailing
142 # `\n' from `echo'.
143 ac_exclude_egrep=`echo "$exclude_list$ac_exclude_list" | tr '
144 ' '|' | sed 's/.$//'`
147 # au_exclude_list
148 # ---------------
149 # AC_LANG_RESTORE
150 # cannot be used alone.
151 # AC_LINK_FILES, AC_PREREQ
152 # need arguments and are tested elsewhere.
153 # AC_INIT and AC_OUTPUT
154 # are already in `configure.ac'.
155 # AC_CYGWIN, AC_MINGW32, AC_EMXOS2
156 # are using AC_REQUIRE.
157 au_exclude_list='^AC_LANG_RESTORE$
158 ^AC_LINK_FILES|AC_PREREQ$
159 ^AC_(INIT|OUTPUT)$
160 ^AC_(CYGWIN|MINGW32|EMXOS2)$'
163 # au_exclude_egrep
164 # ----------------
165 # Build a single egrep pattern out of filter_macros_list.
166 # Sed is used to get rid of the trailing `|' coming from the trailing
167 # `\n' from `echo'.
168 au_exclude_egrep=`echo "$exclude_list$au_exclude_list" | tr '
169 ' '|' | sed 's/.$//'`
173 ## ------------------------- ##
174 ## Creating the test files. ##
175 ## ------------------------- ##
177 for file in $src
179 base=`echo "$file" | sed 's,.*[\\/],,;s/\..*//'`
180 # Get the list of macros which are defined in Autoconf level.
181 # Get rid of the macros we are not interested in.
182 cat $file |
183 sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
184 -e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
185 sort |
186 uniq |
187 # Watch out we are `set -e': don't fail.
188 ( egrep -v "$ac_exclude_egrep" || true) >acdefuns
190 # Get the list of macros which are defined in Autoupdate level.
191 cat $file |
192 sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' |
193 sort |
194 uniq |
195 ( egrep -v "$au_exclude_egrep" || true) > audefuns
197 # Filter out required macros.
199 sed 's/^ *//' <<MK_EOF
200 # Generated by $as_me, do not edit by hand. -*- autoconf -*-
202 AT_BANNER([Testing $base macros.])
204 MK_EOF
206 echo "# Modern macros."
207 for macro in `cat acdefuns`; do
208 if fgrep "$macro" requires >/dev/null 2>&1; then :; else
209 echo "AT_CHECK_MACRO([$macro])"
211 done
212 echo
213 echo "# Obsolete macros."
214 for macro in `cat audefuns`; do
215 if fgrep "$macro" requires >/dev/null 2>&1; then :; else
216 echo "AT_CHECK_AU_MACRO([$macro])"
218 done
219 } >$base.tat
221 # In one atomic step so that if something above fails, the trap
222 # preserves the old version of the file.
223 mv $base.tat $base.at
224 done
226 rm -f acdefuns audefuns requires
228 trap 0
229 exit 0