autoconf/tests/tools.at

910 lines
20 KiB
Plaintext
Raw Normal View History

# -*- Autotest -*-
AT_BANNER([Executables (autoheader, autoupdate...).])
# Copyright (C) 2000, 2001, 2003, 2004, 2006, 2007 Free Software
# Foundation, Inc.
#
# 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
## ----------------------------- ##
## Syntax of the shell scripts. ##
## ----------------------------- ##
# We use `/bin/sh -n script' to check that there are no syntax errors
# in the scripts. Although incredible, there are /bin/sh that go into
# endless loops with `-n', e.g., SunOS's:
#
# $ uname -a
# SunOS ondine 4.1.3 2 sun4m unknown
# $ cat endless.sh
# while false
# do
# :
# done
# exit 0
# $ time sh endless.sh
# sh endless.sh 0,02s user 0,03s system 78% cpu 0,064 total
# $ time sh -nx endless.sh
# ^Csh -nx endless.sh 3,67s user 0,03s system 63% cpu 5,868 total
#
# So before using `/bin/sh -n' to check our scripts, we first check
# that `/bin/sh -n' is not broken to death.
AT_SETUP([Syntax of the shell scripts])
AT_CHECK([test "$ac_cv_sh_n_works" = yes || exit 77])
# Specify the absolute name of the tool, as some shells don't honor PATH when
# running `sh PROG'.
AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/bin/autoconf])
AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/autoconf])
AT_CHECK_SHELL_SYNTAX([$abs_top_builddir/tests/testsuite])
# These are not built, they are in the src tree.
Rework to use more-modern build style. Many files are renamed; all uses of their names were changed. * .x-sc_trailing_blank: Renamed from .x-sc_trailing_blank. * .x-sc_useless_cpp_parens: New file. * build-aux/config.guess: Renamed from config/config.guess. Update. * build-aux/config.sub: Renamed from config/config.sub. Update. * build-aux/elisp-comp: Renamed from config/elisp-comp. * build-aux/install-sh: Renamed from config/install-sh. Update. * build-aux/mdate-sh: Renamed from config/mdate-sh. * build-aux/missing: Renamed from config/missing. * build-aux/texinfo.tex: Renamed from config/texinfo.tex. Update. * build-aux/vc-list-files: Renamed from config/vc-list-files. * config/Makefile.am: Removed. * config/mkinstalldirs: Removed. * config/move-if-change: Removed. * m4/m4.m4: Renamed from config/m4.m4. Add (C) to copyright notice. * Makefile.am (SUBDIRS): Remove config. (ACLOCAL_AMFLAGS): Include from m4, not config. (EXTRA_DIST): Add config/announce-gen, config/prev-version.txt. (WGET, WGETFLAGS): New macros, since Makefile.maint no longer does this. (autom4te-update): Rewrite with a loop. Get from gnulib, not automake. Fail if there's an error. * Makefile.cfg (move_if_change): Remove. (wget_files): Remove. (cvs_executable_files): New macro. (cvs_files): Use it. Remove mkinstalldirs. Add fdl.texi. (executable-update): Use $(cvs_executable_files). (local-checks-to-skip): Remove. * Makefile.maint: Merge from coreutils, plus add our own changes (gzip_rsyncable): New macro. (GZIP_ENV): Use it. (CVS_LIST): Use build-aux/vc-list-files. (VERSION_REGEXP): New macro. (local-checks-available): Add patch-check, $(syntax-check-rules), check-AUTHORS. (syntax-check-rules): Compute dynamically. (sc_cast_of_x_alloc_return_value): Work even if no source files. (sc_cast_of_alloca_return_value): Likewise. (sc_prohibit_atoi_atof): Simplify regexp. (sc_no_if_have_config_h, sc_require_config_h): (sc_prohibit_assert_without_use, (sc_obsolete_symbols): Check for O_NDELAY. (sc_texi_notab): Remove. (sc-changelog): Don't make an exception for '----' lines. (.re-list): Remove, so we don't have a junk file behind. (sc_system_h_headers): Remove the need for .re-list. (sc_the_the): New rule. (sc_tight_scope): Simplify. (sc_trailing_space): Renamed from sc_trailing_blank. (longopt_re): New macro. (sc_two_space_separator_in_usage): New rule. (sc_unmarked_diagnostics): Look at all files under CVS. (sc_useless_cpp_parens, patch-check, check-AUTHORS): New rules. (news-date-check, changelog-check): Version is OK. (po-check): Look for lib files even if not in CVS. (copyright-check): Use $() not ``. (maintainer-distcheck): Do not depend on changelog-check. (my-distcheck): Depend on $(release_archive_dir)/$(prev-tgz). Also check for -Wpointer-arith. (WGET, WGETFLAGS, tgz-md5, tgz-sha1, bz2-md5, bz2-sha1): (xdelta-md5, xdelta-sha1, tgz-size, bz2-size, xd-size, rel-check): Remove. (announcement): Add --gpg-key-id arg. (cvs-sv): Remove. (move_if_change): Just use mv. (local_updates: Remove wget-update, po-update. (po_repo, do-po-update, po-update, wget_files, get-targets): Remove. (config.guess-url_prefix, config.sub-url_prefix): Remove. (ansi2knr.c-url_prefix, texinfo.tex-url_prefix): (standards.texi-url_prefix, make-stds.texi-url_prefix, target, url): ($(get-targets)): Remove. (cvs_files): Remove missing, mkinstalldirs, ansi2knr.c. (gnulib_repo): Renamed from automake_repo. Get from gnulib now. (cvs-update): Get from gnulib. (emut_upload_commands): gnupload is in build-aux now. (alpha beta major): Add changelog-check. Check version. * configure.ac (AC_CONFIG_AUX_DIR): Renamed from config to build-aux. (AC_CONFIG_FILES): Remove. * bin/autoconf.as: Add spaces to avoid distcheck warning. * config/announce-gen: Sync from coreutils. * doc/make-stds.texi: Sync from gnulib. * doc/standards.texi: Likewise. * man/Makefile.am: Adjust for config -> build-aux renaming. * tests/Makefile.am: Prefer $(FOO) to @FOO@. * tests/local.at: Adjust from config -> build-aux renaming. * tests/tools.at: Likewise. * tests/torture.at: Likewise.
2006-08-25 06:56:47 +08:00
AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/build-aux/install-sh])
AT_CHECK_SHELL_SYNTAX([$abs_top_srcdir/build-aux/missing])
AT_CLEANUP
## ---------------------------- ##
## Syntax of the Perl scripts. ##
## ---------------------------- ##
AT_SETUP([Syntax of the Perl scripts])
AT_CHECK_PERL_SYNTAX([autoheader])
AT_CHECK_PERL_SYNTAX([autom4te])
AT_CHECK_PERL_SYNTAX([autoreconf])
AT_CHECK_PERL_SYNTAX([autoscan])
AT_CHECK_PERL_SYNTAX([autoupdate])
AT_CHECK_PERL_SYNTAX([ifnames])
AT_CLEANUP
## ------------------ ##
## autom4te's cache. ##
## ------------------ ##
AT_SETUP([autom4te cache])
AT_DATA_M4SUGAR([[script.4s]],
[[m4_include([foo])
]])
# Everything is OK.
touch foo
AT_CHECK_M4SUGAR
# We moved a file: it should fail
mkdir sub
mv foo sub
AT_CHECK_M4SUGAR([], [1], [],
[m4:script.4s:1: cannot open `foo': No such file or directory
autom4te: m4 failed with exit status: 1
])
# But if we change the main file, then we should no longer complain of
# missing files.
AT_DATA_M4SUGAR([[script.4s]],
[[m4_include([sub/foo])
]])
AT_CHECK_M4SUGAR
AT_CLEANUP
# autom4te --force
# ----------------
AT_SETUP([autom4te --force])
AT_DATA([file.m4],
[[right
]])
AT_CHECK_AUTOM4TE([-o file file.m4])
# Create a file whose time stamp is in the future.
# (next year)-01-01 00:01 UTC should always be in the future,
# even on slow machines.
echo BAD >file
this_year=`TZ=UTC0 date +%Y`
TZ=UTC0 touch -t `expr $this_year + 1`01010001 file
AT_CHECK_AUTOM4TE([--force -o file file.m4])
AT_CHECK([cat file], 0,
[[right
]])
AT_CLEANUP
## ------------------ ##
## autoconf --trace. ##
## ------------------ ##
# autoconf --trace: user macros
# -----------------------------
AT_SETUP([autoconf --trace: user macros])
AT_DATA([configure.ac],
[[m4_define([active], [ACTIVE])
m4_define([TRACE1], [TRACE2(m4_shift($@))])
m4_define([TRACE2], [[$2], $1])
# No arguments.
TRACE1
TRACE2
# With arguments, single line.
TRACE1(foo, @bar, @baz)
TRACE1(foo, TRACE1(bar, baz))
TRACE1(foo, active, baz)
TRACE1(foo, [active], TRACE1(active, [active]))
]])
# Several --traces.
AT_CHECK_AUTOCONF([-t TRACE1 -t TRACE2], 0,
[[configure.ac:6:TRACE1:
configure.ac:6:TRACE2:
configure.ac:7:TRACE2:
configure.ac:10:TRACE1:foo:@bar:@baz
configure.ac:10:TRACE2:@bar:@baz
configure.ac:11:TRACE1:bar:baz
configure.ac:11:TRACE2:baz
configure.ac:11:TRACE1:foo::baz
configure.ac:11:TRACE2::baz
configure.ac:12:TRACE1:foo:ACTIVE:baz
configure.ac:12:TRACE2:ACTIVE:baz
configure.ac:13:TRACE1:ACTIVE:active
configure.ac:13:TRACE2:active
configure.ac:13:TRACE1:foo:active::ACTIVE
configure.ac:13:TRACE2:active::ACTIVE
]])
# Several line requests.
AT_CHECK_AUTOCONF([[-t TRACE1:'
[$1], [$2], [$3].']], 0,
[[
[], [], [].
[foo], [@bar], [@baz].
[bar], [baz], [].
[foo], [], [baz].
[foo], [ACTIVE], [baz].
[ACTIVE], [active], [].
[foo], [active], [].
]])
# ${sep}@.
AT_CHECK_AUTOCONF([-t TRACE2:'${)===(}@'], 0,
[[[]
[]
[@bar])===([@baz]
[baz]
[])===([baz]
[ACTIVE])===([baz]
[active]
[active])===([])===([ACTIVE]
]])
# Arguments spanning multiple lines.
AT_DATA([configure.ac],
[[m4_define([TRACE], [])
TRACE(foo
bar,
bar
foo)
]])
AT_CHECK_AUTOCONF([-t TRACE:'$%'], 0,
[[foo bar:bar foo
]])
AT_CLEANUP
# autoconf --trace: builtins
# --------------------------
AT_SETUP([autoconf --trace: builtins])
AT_DATA([configure.ac],
[[define([active], [ACTIVE])
]])
AT_CHECK_AUTOCONF([[-t define | sed -n '$p']],
0,
[[configure.ac:1:define:active:ACTIVE
]])
# FIXME: Without `$1' the following test dies. Groumphf, once again to
# dive into obscure feature interaction...
# Note that using `-i' means we need the *.m4 files, not the *.m4f files,
# hence we need srcdir, not builddir.
AT_CHECK_AUTOCONF([[-t define:'$1' -i| sed -n '$p']],
0,
[[active
]])
AT_CLEANUP
## ---------------------------- ##
## autoconf: forbidden tokens. ##
## ---------------------------- ##
# autoconf: forbidden tokens, basic
# ---------------------------------
AT_SETUP([autoconf: forbidden tokens,[] basic])
AT_DATA_M4SH([configure.ac],
[[AS_INIT
m4_foo
_m4_bar
AS_FOO
_AS_BAR
[dnl]
]])
AT_CHECK_AUTOCONF([], 1, [],
[[configure.ac:2: error: possibly undefined macro: m4@&t@_foo
If this token and others are legitimate, please use m4@&t@_pattern_allow.
See the Autoconf documentation.
configure.ac:3: error: possibly undefined macro: _m4@&t@_bar
configure.ac:4: error: possibly undefined macro: AS@&t@_FOO
configure.ac:5: error: possibly undefined macro: _AS@&t@_BAR
configure.ac:6: error: possibly undefined macro: d@&t@nl
]])
# Second run should succeed and yield no output.
AT_CHECK([autoconf])
AT_CLEANUP
# autoconf: forbidden tokens, exceptions
# --------------------------------------
AT_SETUP([autoconf: forbidden tokens,[] exceptions])
AT_DATA_M4SH([configure.ac],
[[AS_INIT
# This is allowed in spite of the name.
# It is on purpose that we check the case where there are several
# tokens on the same line.
m4_pattern_allow([^AS_ALLOWED$])
NOT_AS_ALLOWED AS_ALLOWED AS_ALLOWED_NOT
# Test forbidding.
m4_pattern_forbid([^FORBIDDEN$])
NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT
# Test Autoconf's patterns.
AS_THIS_IS_INVALID and _AS_THIS_IS_INVALID_TOO
BUT_AZ_THIS_IS_NOT ALTHOUGH_AS_THIS_IS
# This is legal, although there is `AS_DEFINE' in there.
BAS_DEFINE
# AS_THIS_IS_A_COMMENT so just shut up.
It would be very bad if Autoconf forgot to expand [AS_]INIT!
]])
AT_CHECK_AUTOCONF([], 1, [],
[[configure.ac:1: error: possibly undefined macro: AS@&t@_INIT
If this token and others are legitimate, please use m4@&t@_pattern_allow.
See the Autoconf documentation.
configure.ac:7: error: possibly undefined macro: AS@&t@_ALLOWED_NOT
configure.ac:10: error: possibly undefined macro: FORBIDDEN
configure.ac:14: error: possibly undefined macro: AS@&t@_THIS_IS_INVALID
configure.ac:14: error: possibly undefined macro: _AS@&t@_THIS_IS_INVALID_TOO
]])
AT_CLEANUP
# autoconf: automatically allowed tokens
# --------------------------------------
AT_SETUP([autoconf: automatically allowed tokens])
AT_DATA_M4SH([configure.ac],
[[AC_INIT
m4_pattern_forbid([^FB_])
AC_DEFINE([FB_ONE])
AC_SUBST([FB_TWO])
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
AT_CLEANUP
# autoconf: do not forbid the empty token
# ---------------------------------------
AT_SETUP([autoconf: the empty token])
AT_DATA_M4SH([configure.ac],
[[m4_pattern_allow([^foo$])
m4_divert([0])dnl
line that begins with a space
]])
AT_CHECK_AUTOCONF
AT_CLEANUP
# autoconf: subdirectories
# ------------------------
AT_SETUP([autoconf: subdirectories])
AT_DATA([configure.ac],
[[AC_INIT
AC_PROG_MKDIR_P
AC_CONFIG_FILES(sub/foo)
AC_OUTPUT
]])
mkdir sub
AT_DATA([sub/foo.in],
[[@MKDIR_P@
]])
AT_DATA([install-sh])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CHECK([[grep '^[^/].*/mkdir -p' sub/foo]], 1)
AT_CLEANUP
# autoconf: input from stdin
# --------------------------
AT_SETUP([autoconf: input from stdin])
# Past Autoconf versions failed to read from stdin when other, non-frozen input
# files were present.
AT_DATA([aclocal.m4])
AT_CHECK([echo 'AC_INIT(X, 1.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
0, [stdin:1:AC_INIT:X:1.0:bug-autoconf@gnu.org
])
AT_CHECK([echo 'AC_INIT(X, 2.0, bug-autoconf@gnu.org)' | autoconf -t AC_INIT -],
0, [stdin:1:AC_INIT:X:2.0:bug-autoconf@gnu.org
])
AT_CLEANUP
# autoconf: AC_VERSION
# --------------------------------------
AT_SETUP([autoconf: AC_VERSION])
AT_DATA([configure.ac],
[[AC_INIT
version AC_VERSION version
AC_OUTPUT
]])
AT_CHECK_AUTOCONF
AT_CHECK([[grep 'version ]]AT_PACKAGE_VERSION[[ version' configure]],
0, [ignore])
AT_CLEANUP
## --------- ##
## ifnames. ##
## --------- ##
AT_SETUP([ifnames])
AT_DATA([iftest1.c],
[[#ifdef DEF1
#ifndef DEF2
#if ! defined DEF3 && defined DEF4 /* but not defined DEF5 */
# if SPACES
# if TABS
/* #if C_COMMENTS */
// #if CXX_COMMENTS
#if LINE1 = \
LINE2
#if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */
]])
AT_DATA([iftest2.c],
[[#ifdef IFTEST2
#if VAL1
]])
AT_CHECK([ifnames iftest1.c iftest2.c], 0,
[DEF1 iftest1.c
DEF2 iftest1.c
DEF3 iftest1.c
DEF4 iftest1.c
IFTEST2 iftest2.c
LINE1 iftest1.c
LINE2 iftest1.c
SPACES iftest1.c
TABS iftest1.c
VAL1 iftest1.c iftest2.c
VAL2 iftest1.c
VAL3 iftest1.c
VAL4 iftest1.c
], [])
AT_CLEANUP
## ------------ ##
## autoheader. ##
## ------------ ##
2001-11-25 23:13:03 +08:00
# autoheader is intensively used in its modern form throughout this
# test suite. But we also have to check that acconfig.h still works.
# autoheader uses autoconf --trace, so traces first.
AT_SETUP([autoheader])
AT_DATA([acconfig.h],
[[/* Define this to whatever you want. */
#undef this
]])
# 1. Check that `acconfig.h' is still honored.
AT_DATA([configure.ac],
[[AC_INIT
AC_CONFIG_HEADERS(config.h:config.hin)
AC_DEFINE(this, "whatever you want.")
]])
AT_CHECK_AUTOHEADER([], [], [], [ignore])
AT_CHECK([cat config.hin], 0,
[[/* config.hin. Generated from configure.ac by autoheader. */
/* Define this to whatever you want. */
#undef this
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
]])
# 2. Check that missing templates are a fatal error.
AT_DATA([configure.ac],
[[AC_INIT
AC_CONFIG_HEADERS(config.h:config.hin)
AC_DEFINE(that, "whatever you want.")
]])
# The test suite goes too fast for the cache time stamps...
# Pass --force.
AT_CHECK_AUTOHEADER([--force], [1], [], [ignore])
# 3. Check TOP and BOTTOM.
AT_DATA([acconfig.h],
[[/* Top from acconfig.h. */
@TOP@
/* Middle from acconfig.h. */
@BOTTOM@
/* Bottom from acconfig.h. */
]])
AT_DATA([configure.ac],
[[AC_INIT
AC_CONFIG_HEADERS(config.h:config.hin)
AH_TOP([Top1 from configure.ac.])
AH_TOP([Top2 from configure.ac.])
AH_TOP([The Cat in a h@t.])
AH_VERBATIM([Middle], [Middle from configure.ac.])
AH_VERBATIM([Mouse], [The Mouse in a h@t.])
AH_BOTTOM([Bottom1 from configure.ac.])
AH_BOTTOM([Bottom2 from configure.ac.])
AH_BOTTOM([The Dog in a h@t.])
AC_DEFINE([ANT], [@], [The Ant in a h@t.])
]])
# Yes, that's right: the `middle' part of `acconfig.h' is still before
# the AH_TOP part. But so what, you're not supposed to use the two
# together.
# Ignore STDERR which is the longuish complaint against autoheader junk
# files.
AT_CHECK_AUTOHEADER([--force], [], [], [ignore])
AT_CHECK([cat config.hin], 0,
[[/* config.hin. Generated from configure.ac by autoheader. */
/* Top from acconfig.h. */
/* Middle from acconfig.h. */
Top1 from configure.ac.
Top2 from configure.ac.
The Cat in a h@t.
/* The Ant in a h@t. */
#undef ANT
Middle from configure.ac.
The Mouse in a h@t.
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
Bottom1 from configure.ac.
Bottom2 from configure.ac.
The Dog in a h@t.
/* Bottom from acconfig.h. */
]])
AT_CLEANUP
## ------------ ##
## autoupdate. ##
## ------------ ##
# Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated.
AT_SETUP([autoupdate])
AT_DATA([configure.ac],
[[AC_INIT(Test, 1.0)
AC_CANONICAL_SYSTEM
# The doc says 27 is a valid fubar.
fubar=27
AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
]])
AT_DATA([expout],
[[AC_INIT([Test],[1.0])
AC_CANONICAL_TARGET
# The doc says 27 is a valid fubar.
fubar=27
AC_CONFIG_FILES([Makefile])
Rewrite substantial part of lib/autoconf/status.m4. The main change is that CONFIG_FILES, CONFIG_HEADERS, CONFIG_LINKS, and CONFIG_COMMANDS are not processed in four separate loops. Instead, there is one main loop. This alows that the common code is expanded only once, thus config.status (and configure) is smaller. The registration mechnism in AC_CONFIG_FILES and cousins also changed; the AC_LIST_FILES and cousins macros are no longer used. * lib/autoconf/status.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, _AC_OUTPUT_LINKS, _AC_OUTPUT_COMMANDS): Renamed to ... (_AC_OUTPUT_FILE, _AC_OUTPUT_HEADER, _AC_OUTPUT_LINK, _AC_OUTPUT_COMMAND): ..., respectively. These macros no longer contains the initialization, nor the for loop, nor the associated commands; all these go to ... (_AC_OUTPUT_MAIN_LOOP): ... this new macro, called from _AC_OUTPUT_CONFIG_STATUS. (_AC_CONFIG_SPLIT, _AC_CONFIG_SPLIT_SOURCE_DEST, _AC_CONFIG_SPLIT_FILE_IN): Nuked; the code was merged into _AC_OUTPUT_MAIN_LOOP. (_AC_OUTPUT_FILE): The creation of the sed script ... (AC_OUTPUT): ... and the setup of ac_vpsub goes to ... (_AC_OUTPUT_FILES_PREPARE): ... a new macro, also called from _AC_OUTPUT_MAIN_LOOP. (_AC_CONFIG_FILES, _AC_CONFIG_HEADERS, _AC_CONFIG_LINKS, _AC_CONFIG_COMMANDS): Use ... (_AC_CONFIG_FOOS): ... this new macro, which uses these ... (_AC_CONFIG_REGISTER, _AC_CONFIG_REGISTER_DEST): ... new macros. (_AC_CONFIG_FILE, _AC_CONFIG_HEADER, _AC_CONFIG_LINK, _AC_CONFIG_COMMAND, _AC_CONFIG_DEPENDENCIES): No longer needed. (_AC_CONFIG_DEPENDENCY): Update, it uses these ... (_AC_CONFIG_DEPENDENCY_DEFAULT, _AC_FILE_DEPENDENCY_TRACE_COLON): ... new macros. (_AC_CONFIG_UNIQUE): Update. (AC_LIST_FILES, AC_LIST_HEADERS, AC_LIST_LINKS, AC_LIST_COMMANDS): Replaced by this ... (_AC_LIST_TAGS): ... new common macro. (AC_LIST_FILE_COMMANDS, AC_LIST_HEADER_COMMANDS, AC_LIST_LINK_COMMANDS, AC_LIST_COMMAND_COMMANDS): Replaced by this ... (_AC_LIST_TAG_COMMANDS): ... new common macro. (_AC_CONFIG_COMMANDS_INIT): Moved top to the `registration' section; this didn't belong to the `config commands' section. (_AC_OUTPUT_COMMANDS_INIT): Don't initialize, m4_ifdef is our friend. (AC_CONFIG_COMMANDS_PRE, AC_OUTPUT_COMMANDS_PRE, AC_CONFIG_COMMANDS_POST): Moved to a new section, these didn't belong to the `config commands' section either. (AC_CONFIG_SUBDIRS): Don't touch diversion DEFAULTS. (_AC_LIST_SUBDIRS): Don't initialize, m4_ifdef is our friend. ... and many changes to the comments nearby. * lib/autoconf/general.m4 (_AC_INIT_DEFAULTS): At the end of the day, set ac_subdirs_all='_AC_LIST_SUBDIRS'. * tests/torture.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS): AC_CONFIG_COMMANDS(command:input,...) is no longer allowed. (#define header templates): The comment at the top of the generated header now includes the name(s) of the source file(s). Several unrelated small changes: * lib/autoconf/general.m4 (AC_CACHE_VAL): Be didactic, quote the first parameter to AC_DIAGNOSE. * lib/autoconf/status.m4 (AC_CONFIG_SUBDIRS): Likewise. (_AC_LINK_FILES_CNT): Don't AU_DEFUN this; it causes confusing messages with autoupdate; use m4_define_default inside AU_DEFUNed AC_LINK_FILES. (AC_OUTPUT): In the compatibility code, use m4_ifvaln, to be consistent with AU::AC_OUTPUT. (AU::AC_OUTPUT): Don't double-quote $2 and $3, the compatibility code in AC_OUTPUT doesn't double-quote it either. * tests/tools.at (autoupdate): AU::AC_OUTPUT no longer double-quotes the parameters.
2005-07-26 02:10:25 +08:00
AC_CONFIG_COMMANDS([default],[echo $fubar],[fubar=$fubar])
AC_OUTPUT
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
AT_CHECK([cat configure.ac], 0, [expout])
# Checking that `autoupdate' is idempotent
AT_CHECK_AUTOUPDATE
AT_CHECK([cat configure.ac], 0, [expout])
AT_CLEANUP
# autoupdating AC_LINK_FILES
# --------------------------
AT_SETUP([autoupdating AC_LINK_FILES])
AT_DATA([configure.ac],
[[AC_INIT
AC_LINK_FILES(dst1 dst2, src1 src2)
AC_OUTPUT
]])
AT_DATA([dst1], dst1
)
AT_DATA([dst2], dst2
)
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], 0, [], ignore)
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CHECK([cat src1], 0, [dst1
])
AT_CHECK([cat src2], 0, [dst2
])
AT_CLEANUP
# autoupdating AC_PREREQ
# ----------------------
AT_SETUP([autoupdating AC_PREREQ])
# Produce `AC_PREREQ(<AUTOUPDATE VERSION>)'.
AT_CHECK([autoupdate --version | sed 's/.*) //;q'], 0, [stdout])
autoupdate_version=`cat stdout`
echo "AC_PREREQ($autoupdate_version)" >expout
AT_CHECK([echo "AC_PREREQ(1.0)" | autoupdate -],
0, [expout], [])
AT_CHECK([echo "AC_PREREQ($autoupdate_version)" | autoupdate -],
0, [expout], [])
AT_CHECK([echo "AC_PREREQ(999.99)" | autoupdate -],
63, [], [ignore])
AT_CLEANUP
# autoupdating AU_ALIAS
# ---------------------
AT_SETUP([autoupdating AU_ALIAS])
AT_DATA([configure.ac],
[[AC_INIT
AC_DEFUN([FOO], [$#])
AU_ALIAS([BAZ],[FOO])
test "FOO:FOO():FOO(x) BAZ:BAZ():BAZ(x)" = "0:1:1 0:1:1" || exit 1
AC_PROG_CC
AC_STDC_HEADERS
AC_OUTPUT
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CHECK([grep 'AC_HEADER_STDC(' configure.ac], 1, [ignore], [ignore])
AT_CHECK([grep 'AC_HEADER_STDC' configure.ac], 0, [ignore], [ignore])
AT_CLEANUP
2006-04-01 23:57:02 +08:00
# autoupdating OLD to NEW
# -----------------------
# The example taken from the code comments.
AT_SETUP([autoupdating OLD to NEW])
AT_DATA([aclocal.m4],
[[AU_DEFUN([OLD], [NEW([$1, $2], m4@&t@_eval([$1 + $2]))])
AC_DEFUN([NEW], [echo "sum($1) = $2"])
]])
AT_DATA([configure.ac],
[[AC_INIT
OLD(1, 2)
NEW([0, 0], [0])
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE
AT_CHECK([[grep 'NEW(\[1, 2], *\[3])' configure.ac]], 0, [ignore], [ignore])
AT_CHECK([[grep 'NEW(\[0, 0], *\[0])' configure.ac]], 0, [ignore], [ignore])
AT_CLEANUP
# autoupdating AC_HELP_STRING
# ---------------------------
AT_SETUP([autoupdating AC_HELP_STRING])
AT_DATA([configure.ac],
[[AC_INIT
AC_ARG_ENABLE([foo], [AC_HELP_STRING([--enable-foo], [foo bar])], [:], [:])
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [], [], [ignore])
AT_CHECK([[grep '\[--enable-foo], *\[foo bar]' configure.ac]], 0, [ignore], [ignore])
AT_CLEANUP
# autoupdating with m4sugar
# -------------------------
AT_SETUP([autoupdating with m4sugar])
AT_DATA([aclocal.m4],
[[AU_DEFUN([OLD],
[m4@&t@_pushdef([foo], [bar])dn@&t@l
echo "foo $1 foo"
m4@&t@_popdef([foo])dn@&t@l
])
]])
touch foo.in
AT_DATA([configure.ac],
[[AC_PREREQ(2.54)
m4_define([gnumeric_version_epoch], [1])
AC_INIT
OLD([ bla bla ])
AC_FOREACH([name], [n1 n2],
[echo name
])
AC_CHECKING([for feature])
AC_MSG_RESULT_UNQUOTED([`echo done`])
AC_OUTPUT([foo])
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [], [], [ignore])
AT_CLEANUP
# autoupdating AC_LANG_SAVE
# -------------------------
AT_SETUP([autoupdating AC_LANG_SAVE])
AT_DATA([configure.ac],
[[AC_INIT
AC_LANG_SAVE
AC_LANG_RESTORE
AC_LANG_SAVE
AC_LANG_RESTORE
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE([], [], [], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [], [], [ignore])
AT_CLEANUP
# autoupdating AC_FOREACH
# -----------------------
AT_SETUP([autoupdating AC_FOREACH])
AT_DATA([aclocal.m4],
[[AU_DEFUN([OLD], [AC_FOREACH([myvar], [4 5 6], [' myvar'])])
]])
AT_DATA([configure.ac],
[[AC_INIT
echo AC_FOREACH([myvar], [1 2 3], [' myvar'])OLD
]])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
AT_CHECK([[grep 'echo 1 2 3 4 5 6' configure.ac]], 1, [ignore], [ignore])
AT_CHECK([[grep 'm4@&t@_foreach_w' configure.ac]], 0, [ignore], [ignore])
AT_CHECK_AUTOCONF
AT_CHECK_CONFIGURE([], [0], [stdout])
AT_CHECK([[grep ' 1 2 3 4 5 6' stdout]], 0, [ignore], [ignore])
AT_CLEANUP
# autoupdating with aclocal and m4_include
# ----------------------------------------
AT_SETUP([autoupdating with aclocal and m4@&t@_include])
# We use aclocal.
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
mkdir m4 aclocal
AT_DATA([configure.in],
[[AC_INIT(x,0)
AC_UNCHANGED_MACRO
AC_OLD_MACRO
AC_OUTPUT
]])
AT_DATA([m4/stuff.m4],
[[AU_ALIAS([AC_OLD_MACRO], [AC_NEW_MACRO])
AC_DEFUN([AC_NEW_MACRO], [echo hi])
AC_DEFUN([AC_UNCHANGED_MACRO], [echo one])
]])
cp m4/stuff.m4 aclocal/stuff.m4
AT_CHECK([aclocal -I aclocal], [0], [ignore], [ignore])
# Checking `autoupdate'.
AT_CHECK_AUTOUPDATE
AT_CHECK([aclocal -I m4], [0], [ignore], [ignore])
AT_CHECK_AUTOUPDATE
AT_CLEANUP
# Keeping autom4te.cfg complete
# -----------------------------
AT_SETUP([autom4te preselections])
: ${sleep='sleep 1'} # Command to force different time stamps.
# If this test should run on FAT file systems and older w32,
# then setting $sleep correctly needs to be revisited.
# We use aclocal and automake.
AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
AT_CHECK([test ! -f $HOME/.autom4te.cfg || exit 77], [], [ignore], [ignore])
AT_DATA([configure.in],
[[AC_INIT(GNU foo, 1.0)
AM_INIT_AUTOMAKE
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
]])
AT_DATA([Makefile.am],
[[AUTOMAKE_OPTIONS = foreign
]])
$sleep # `aclocal.m4' should be strictly younger than its inputs
# If Autoconf is too old, or the user has turned caching off, skip:
AT_CHECK([aclocal || { ret=$?; test $ret -eq 63 && ret=77; exit $ret; }],
[], [], [ignore])
AT_CHECK([test -d autom4te.cache || exit 77])
AT_CHECK([autoconf])
# If this test fails due to missing entries in lib/autom4te.in, then
# comparing the old and new requests is a good place to start debugging:
cp autom4te.cache/requests old-requests
echo newer >newer
$sleep # if `configure' is regenerated, we want it to be strictly newer,
# to catch the error consistently.
AT_CHECK([aclocal], [], [], [ignore])
AT_CHECK([automake --no-force --add-missing], [], [], [ignore])
AT_CHECK([autoconf])
AT_CHECK([test "`find configure -newer newer`" = "" ||
{ diff old-requests autom4te.cache/requests; exit 1; }])
AT_CLEANUP