2000-10-05 17:39:06 +08:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
# Build some of the Autoconf test files.
|
2005-01-29 05:21:32 +08:00
|
|
|
|
|
|
|
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
|
|
|
|
# Foundation, Inc.
|
2000-10-05 17:39:06 +08:00
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
# 02111-1307, USA.
|
|
|
|
|
2000-10-14 00:37:21 +08:00
|
|
|
# If we fail, clean up, but touch the output files. We probably failed
|
|
|
|
# because we used some non portable tool, but we just don't care: this
|
|
|
|
# shell script is a maintainer tool, and we do expect good tools.
|
2001-01-22 17:03:38 +08:00
|
|
|
|
2001-01-26 19:59:49 +08:00
|
|
|
as_me=`echo "$0" | sed 's,.*[\\/],,'`
|
2001-01-22 17:03:38 +08:00
|
|
|
|
|
|
|
trap 'echo "'"$as_me"': failed. To proceed run make check." >&2
|
2001-01-26 19:59:49 +08:00
|
|
|
rm -f acdefuns audefuns requires *.tat
|
2001-01-22 17:03:38 +08:00
|
|
|
for file in "$@"
|
|
|
|
do
|
2001-01-26 19:59:49 +08:00
|
|
|
touch `echo "$file" | sed "s,.*[\\/],,;s/\..*/.at/"`
|
2001-01-22 17:03:38 +08:00
|
|
|
done
|
2000-10-14 00:37:21 +08:00
|
|
|
trap 0
|
|
|
|
exit 1' \
|
|
|
|
0 1 2 15
|
|
|
|
|
|
|
|
# If ever something goes wrong, fail, so that the trap be launched.
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# We need arguments.
|
|
|
|
test $# != 0
|
|
|
|
|
|
|
|
# We need these arguments.
|
2000-10-05 17:39:06 +08:00
|
|
|
src="$@"
|
|
|
|
|
2000-10-25 03:30:00 +08:00
|
|
|
# Set locale to C so that `sort' behaves in a uniform way.
|
|
|
|
export LANGUAGE; LANGUAGE=C
|
|
|
|
export LANG; LANG=C
|
|
|
|
export LC_ALL; LC_ALL=C
|
|
|
|
|
2000-10-05 21:52:41 +08:00
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
# requires
|
|
|
|
# --------
|
|
|
|
# Get the list of macros that are required: there is little interest
|
|
|
|
# in testing them since they will be run but the guy who requires
|
|
|
|
# them.
|
|
|
|
cat $src |
|
|
|
|
sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
|
|
|
|
sort |
|
|
|
|
uniq >requires
|
|
|
|
|
|
|
|
|
2000-11-07 22:16:54 +08:00
|
|
|
# exclude_list
|
|
|
|
# ------------
|
2001-01-22 17:03:38 +08:00
|
|
|
# Macros which must not be checked at all (not by ac-macros.at, nor
|
|
|
|
# au-macros.at).
|
2000-11-07 22:16:54 +08:00
|
|
|
# The trailing new line is meant.
|
|
|
|
#
|
|
|
|
# - ac_cv_prog_gcc, gxx, g77
|
|
|
|
# Not macros, just mapping from old variable name to a new one.
|
|
|
|
exclude_list='^ac_cv_prog_(gcc|gxx|g77)$
|
|
|
|
'
|
|
|
|
|
2001-01-26 19:59:49 +08:00
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
# ac_exclude_list
|
|
|
|
# ---------------
|
|
|
|
# The test `ac-macros.at' tries to run all the macros of Autoconf to check
|
2000-10-05 17:39:06 +08:00
|
|
|
# for syntax problems, etc. Not all the macros can be run without argument,
|
|
|
|
# and some are already tested elsewhere. EGREP_EXCLUDE must filter out
|
2001-01-22 17:03:38 +08:00
|
|
|
# the macros we don't want to test in ac-macros.at.
|
2000-10-05 17:39:06 +08:00
|
|
|
#
|
2000-10-24 02:58:43 +08:00
|
|
|
# - AC_CANONICALIZE, AC_PREFIX_PROGRAM, AC_PREREQ
|
2000-10-05 17:39:06 +08:00
|
|
|
# Need an argument.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2004-03-19 16:57:51 +08:00
|
|
|
# - AC_CHECK alignof, decl, file, func, header, lib, member, prog, sizeof,
|
|
|
|
# host/target tool, type
|
2000-10-05 17:39:06 +08:00
|
|
|
# Performed in the semantics tests.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-10-05 17:39:06 +08:00
|
|
|
# - AC_CONFIG
|
|
|
|
# They fail when the source does not exist.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
|
|
|
# - AC_FUNC_GETLOADAVG, AC_REPLACE_FNMATCH, AC_FUNC_FNMATCH_GNU
|
|
|
|
# Require a file that is not shipped with Autoconf. But it should.
|
|
|
|
#
|
2000-10-05 17:39:06 +08:00
|
|
|
# - AC_INIT
|
|
|
|
# AC_INIT includes all the AC_INIT macros. Note that there is an
|
|
|
|
# infinite m4 recursion if AC_INIT it used twice.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-10-05 17:39:06 +08:00
|
|
|
# - AC_LANG*
|
|
|
|
# Heavily used by other macros.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2004-03-19 16:57:51 +08:00
|
|
|
# - AC_PATH_PROGS?, AC_PATH_TOOL, AC_PATH_TARGET_TOOL, AC_F77_FUNC, AC_FC_FUNC,
|
|
|
|
# AC_FC_SRCEXT
|
2000-10-05 17:39:06 +08:00
|
|
|
# They produce `= val' because $1, the variable used to store the result,
|
|
|
|
# is empty.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2003-11-04 20:32:01 +08:00
|
|
|
# - AC_FC_FREEFORM
|
|
|
|
# Requires the current language to be Fortran, not C.
|
|
|
|
#
|
2001-02-06 23:11:50 +08:00
|
|
|
# - AC_TRY, AC_.*_IFELSE, AC_RUN_LOG.
|
2000-10-05 17:39:06 +08:00
|
|
|
# Used in many places.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-10-05 17:39:06 +08:00
|
|
|
# - _AC_
|
|
|
|
# Internal macros are used elsewhere.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-10-05 17:39:06 +08:00
|
|
|
# - AC_OUTPUT
|
|
|
|
# Already tested by `AT_CHECK_MACRO'.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-10-05 17:39:06 +08:00
|
|
|
# - AC_FD_CC
|
|
|
|
# Is a number.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-12-07 23:21:54 +08:00
|
|
|
# - AC_PROG_CC, AC_C_(CONST|INLINE|VOLATILE), AC_PATH_XTRA
|
2000-10-05 17:39:06 +08:00
|
|
|
# Checked in semantics.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-10-05 17:39:06 +08:00
|
|
|
# - AC_CYGWIN, AC_CYGWIN32, AC_EMXOS2, AC_MING32, AC_EXEEXT, AC_OBJEXT
|
|
|
|
# AU defined to nothing.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2000-12-07 23:21:54 +08:00
|
|
|
# - AC_PATH_XTRA
|
|
|
|
# Checked in semantics.
|
2002-06-07 17:50:32 +08:00
|
|
|
#
|
2001-06-26 02:27:51 +08:00
|
|
|
# - AC_SYS_RESTARTABLE_SYSCALLS, AC_FUNC_WAIT3
|
|
|
|
# Obsolete, checked in semantics.
|
2000-12-07 23:21:54 +08:00
|
|
|
#
|
2001-01-22 17:03:38 +08:00
|
|
|
ac_exclude_list='^AC_ARG_VAR$
|
2000-10-24 02:58:43 +08:00
|
|
|
^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
|
2004-03-19 16:57:51 +08:00
|
|
|
^AC_CHECK_(ALIGNOF|DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|(TARGET_)?TOOL|TYPE)S?$
|
2000-10-05 17:39:06 +08:00
|
|
|
^AC_CONFIG
|
2003-09-04 20:52:35 +08:00
|
|
|
^AC_(F77|FC)_FUNC$
|
2003-11-04 20:32:01 +08:00
|
|
|
^AC_FC_(FUNC|FREEFORM|SRCEXT)$
|
2003-09-04 20:52:35 +08:00
|
|
|
^AC_FD_CC$
|
2003-09-04 22:33:03 +08:00
|
|
|
^AC_FUNC_(GETLOADAVG|FNMATCH_GNU|WAIT3)$
|
2000-10-05 17:39:06 +08:00
|
|
|
^AC_INIT
|
|
|
|
^AC_LANG
|
|
|
|
^AC_LINKER_OPTION$
|
|
|
|
^AC_LINK_FILES$
|
|
|
|
^AC_LIST_MEMBER_OF$
|
|
|
|
^AC_OUTPUT$
|
2004-03-19 16:57:51 +08:00
|
|
|
^AC_PATH_((TARGET_)?TOOL|PROG)S?$
|
2003-09-04 22:33:03 +08:00
|
|
|
^AC_REPLACE_(FNMATCH|FUNCS)$
|
2000-10-05 17:39:06 +08:00
|
|
|
^AC_SEARCH_LIBS$
|
2001-02-06 23:11:50 +08:00
|
|
|
^(AC_TRY.*|AC_RUN_LOG)$
|
2000-10-05 17:39:06 +08:00
|
|
|
^AC_.*_IFELSE$
|
2003-04-13 04:53:49 +08:00
|
|
|
^(AC_(PROG_CC|C_CONST|C_INLINE|C_RESTRICT|C_VOLATILE))$
|
2000-10-05 17:39:06 +08:00
|
|
|
^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$
|
2000-12-07 23:21:54 +08:00
|
|
|
^AC_PATH_XTRA$
|
2001-06-26 02:27:51 +08:00
|
|
|
^AC_SYS_RESTARTABLE_SYSCALLS$
|
2000-10-05 17:39:06 +08:00
|
|
|
_AC_'
|
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
|
|
|
|
# ac_exclude_egrep
|
|
|
|
# ----------------
|
2002-05-30 06:29:54 +08:00
|
|
|
# Build a single extended regular expression out of filter_macros_list.
|
2002-09-02 14:44:27 +08:00
|
|
|
ac_exclude_egrep=$exclude_list$ac_exclude_list
|
2000-10-05 21:52:41 +08:00
|
|
|
|
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
# au_exclude_list
|
|
|
|
# ---------------
|
2000-10-24 02:58:43 +08:00
|
|
|
# AC_LANG_RESTORE
|
|
|
|
# cannot be used alone.
|
|
|
|
# AC_LINK_FILES, AC_PREREQ
|
|
|
|
# need arguments and are tested elsewhere.
|
|
|
|
# AC_INIT and AC_OUTPUT
|
2000-12-23 18:11:57 +08:00
|
|
|
# are already in `configure.ac'.
|
2002-04-03 02:22:08 +08:00
|
|
|
# AC_C_CROSS and AC_PROG_CC_STDC
|
|
|
|
# are empty.
|
2000-12-14 17:39:33 +08:00
|
|
|
# AC_CYGWIN, AC_MINGW32, AC_EMXOS2
|
|
|
|
# are using AC_REQUIRE.
|
2001-01-22 17:03:38 +08:00
|
|
|
au_exclude_list='^AC_LANG_RESTORE$
|
2000-10-24 02:58:43 +08:00
|
|
|
^AC_LINK_FILES|AC_PREREQ$
|
2000-12-14 17:39:33 +08:00
|
|
|
^AC_(INIT|OUTPUT)$
|
2002-04-03 02:22:08 +08:00
|
|
|
^AC_C_CROSS|AC_PROG_CC_STDC$
|
2000-12-14 17:39:33 +08:00
|
|
|
^AC_(CYGWIN|MINGW32|EMXOS2)$'
|
2000-10-05 21:52:41 +08:00
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
|
|
|
|
# au_exclude_egrep
|
|
|
|
# ----------------
|
2002-05-30 06:29:54 +08:00
|
|
|
# Build a single extended regular expression out of filter_macros_list.
|
2002-09-02 14:44:27 +08:00
|
|
|
au_exclude_egrep=$exclude_list$au_exclude_list
|
2000-10-05 17:39:06 +08:00
|
|
|
|
|
|
|
|
2002-05-30 06:29:54 +08:00
|
|
|
# egrep
|
|
|
|
# -----
|
2005-01-29 05:21:32 +08:00
|
|
|
if echo a | grep -E '(a|b)' >/dev/null 2>&1
|
2002-05-30 06:29:54 +08:00
|
|
|
then egrep='grep -E'
|
|
|
|
else egrep='egrep'
|
|
|
|
fi
|
|
|
|
|
2000-10-05 21:52:41 +08:00
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
## ------------------------- ##
|
|
|
|
## Creating the test files. ##
|
|
|
|
## ------------------------- ##
|
2000-10-05 21:52:41 +08:00
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
for file in $src
|
|
|
|
do
|
2001-01-26 19:59:49 +08:00
|
|
|
base=`echo "$file" | sed 's,.*[\\/],,;s/\..*//'`
|
2001-01-22 17:03:38 +08:00
|
|
|
# Get the list of macros which are defined in Autoconf level.
|
|
|
|
# Get rid of the macros we are not interested in.
|
|
|
|
cat $file |
|
|
|
|
sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \
|
|
|
|
-e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' |
|
|
|
|
sort |
|
|
|
|
uniq |
|
|
|
|
# Watch out we are `set -e': don't fail.
|
2002-05-30 06:29:54 +08:00
|
|
|
($egrep -v "$ac_exclude_egrep" || true) >acdefuns
|
2000-10-05 21:52:41 +08:00
|
|
|
|
2001-01-22 17:03:38 +08:00
|
|
|
# Get the list of macros which are defined in Autoupdate level.
|
|
|
|
cat $file |
|
|
|
|
sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' |
|
|
|
|
sort |
|
|
|
|
uniq |
|
2002-05-30 06:29:54 +08:00
|
|
|
($egrep -v "$au_exclude_egrep" || true) > audefuns
|
2001-01-22 17:03:38 +08:00
|
|
|
|
|
|
|
# Filter out required macros.
|
|
|
|
{
|
|
|
|
sed 's/^ *//' <<MK_EOF
|
2003-09-11 00:54:12 +08:00
|
|
|
# Generated by $as_me. -*- Autotest -*-
|
|
|
|
|
|
|
|
## --------------------- ##
|
|
|
|
## Do not edit by hand. ##
|
|
|
|
## --------------------- ##
|
|
|
|
|
2005-01-03 15:40:10 +08:00
|
|
|
# Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
|
2000-10-05 21:52:41 +08:00
|
|
|
|
2001-08-01 21:46:22 +08:00
|
|
|
AT_BANNER([Testing autoconf/$base macros.])
|
2001-01-22 17:03:38 +08:00
|
|
|
|
|
|
|
MK_EOF
|
|
|
|
|
|
|
|
echo "# Modern macros."
|
|
|
|
for macro in `cat acdefuns`; do
|
2002-06-27 15:51:16 +08:00
|
|
|
if grep "$macro" requires >/dev/null 2>&1; then :; else
|
2001-01-22 17:03:38 +08:00
|
|
|
echo "AT_CHECK_MACRO([$macro])"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
echo "# Obsolete macros."
|
|
|
|
for macro in `cat audefuns`; do
|
2002-06-27 15:51:16 +08:00
|
|
|
if grep "$macro" requires >/dev/null 2>&1; then :; else
|
2001-01-22 17:03:38 +08:00
|
|
|
echo "AT_CHECK_AU_MACRO([$macro])"
|
|
|
|
fi
|
|
|
|
done
|
2001-08-01 21:46:22 +08:00
|
|
|
} >ac$base.tat
|
2001-01-22 17:03:38 +08:00
|
|
|
|
|
|
|
# In one atomic step so that if something above fails, the trap
|
2001-09-13 14:56:44 +08:00
|
|
|
# preserves the old version of the file. If there is nothing to
|
|
|
|
# check, output /rien du tout/[1].
|
2002-06-27 15:51:16 +08:00
|
|
|
if grep AT_CHECK ac$base.tat >/dev/null 2>&1; then
|
2003-09-25 17:30:34 +08:00
|
|
|
mv -f ac$base.tat ac$base.at
|
2003-09-11 00:54:12 +08:00
|
|
|
# Help people not to update these files by hand.
|
|
|
|
chmod a-w ac$base.at
|
2001-09-13 14:56:44 +08:00
|
|
|
else
|
|
|
|
rm -f ac$base.tat ac$base.at
|
|
|
|
touch ac$base.at
|
|
|
|
fi
|
2001-01-22 17:03:38 +08:00
|
|
|
done
|
2000-10-05 17:39:06 +08:00
|
|
|
|
2000-10-12 20:45:16 +08:00
|
|
|
rm -f acdefuns audefuns requires
|
2000-10-14 00:37:21 +08:00
|
|
|
|
|
|
|
trap 0
|
2000-10-05 17:39:06 +08:00
|
|
|
exit 0
|
2001-09-13 14:56:44 +08:00
|
|
|
|
|
|
|
# [1] En franc,ais dans le texte.
|