mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-15 02:20:10 +08:00
4e0329a533
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.
929 lines
21 KiB
Plaintext
929 lines
21 KiB
Plaintext
# -*- Autotest -*-
|
|
|
|
# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 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 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., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
# 02110-1301, USA.
|
|
|
|
|
|
AT_BANNER([[Testing config.status.]])
|
|
|
|
|
|
## ---------------------------------------- ##
|
|
## AC_CONFIG_COMMANDS with empty commands. ##
|
|
## ---------------------------------------- ##
|
|
|
|
AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
|
|
[[AC_CONFIG_COMMANDS([foo], [], [:])
|
|
]])
|
|
|
|
|
|
## -------------------------- ##
|
|
## Multiple AC_CONFIG_FILES. ##
|
|
## -------------------------- ##
|
|
|
|
AT_SETUP([Multiple AC_CONFIG_FILES])
|
|
|
|
AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])
|
|
AT_CHECK_AUTOCONF([], 1, [], [ignore])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## ------------ ##
|
|
## AC_ARG_VAR. ##
|
|
## ------------ ##
|
|
|
|
# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
|
|
# ----------------------------------------------
|
|
# Check that AC_ARG_VAR caches the latest values, diagnoses
|
|
# inconsistencies, and arms config.status.
|
|
m4_define([AT_CHECK_AC_ARG_VAR],
|
|
[rm -f config.cache
|
|
|
|
# Initial value.
|
|
m4_ifval([$1],
|
|
[precious='$1'; export precious],
|
|
[unset precious])
|
|
AT_CHECK_CONFIGURE([--config-cache -q])
|
|
AT_CHECK([cat file], [], [`$1'
|
|
])
|
|
|
|
# Testing --recheck: 1. have the environment `forget' about PRECIOUS.
|
|
unset precious
|
|
# 2. Rerun config.status to recreate `file'.
|
|
AT_CHECK([./config.status --recheck], [], [ignore])
|
|
AT_CHECK([./config.status], [], [ignore])
|
|
# 3. Check that file contains the old value of PRECIOUS.
|
|
AT_CHECK([cat file], [], [`$1'
|
|
])
|
|
|
|
# Second value: we should issue an error here: the value
|
|
# has changed!
|
|
m4_ifval([$2],
|
|
[precious='$2'; export precious],
|
|
[unset precious])
|
|
AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
|
|
|
|
])# AT_CHECK_AC_ARG_VAR
|
|
|
|
|
|
AT_SETUP([AC_ARG_VAR])
|
|
|
|
# We don't want to run this test if this shell doesn't support
|
|
# `unset'.
|
|
AT_CHECK([
|
|
if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
|
|
exit 0
|
|
else
|
|
exit 77
|
|
fi
|
|
])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
AC_ARG_VAR([precious], [this variable costs a lot])
|
|
echo "precious:$precious"
|
|
AC_OUTPUT(file)
|
|
]])
|
|
|
|
AT_DATA([file.in],
|
|
[[`@precious@'
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
# Set a precious variable
|
|
AT_CHECK_AC_ARG_VAR([], [apple of my eye])
|
|
|
|
# Unset a precious variable
|
|
AT_CHECK_AC_ARG_VAR([apple of my eye], [])
|
|
|
|
# Change a precious variable
|
|
AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
## ---------------------------------------------- ##
|
|
## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
|
|
## ---------------------------------------------- ##
|
|
|
|
AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
rm -f -r header var-header file var-file link var-link command var-command
|
|
echo 'OK' >input
|
|
|
|
# Be sure to also stress the associated INIT-CMDS.
|
|
case $what_to_test in
|
|
header)
|
|
AC_CONFIG_HEADERS(header:input);;
|
|
var-header)
|
|
AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);;
|
|
|
|
file)
|
|
AC_CONFIG_FILES(file:input);;
|
|
var-file)
|
|
AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);;
|
|
|
|
command)
|
|
AC_CONFIG_COMMANDS(command,
|
|
[cp input command]);;
|
|
var-command)
|
|
AC_CONFIG_COMMANDS(var-command,
|
|
[cp $command_in var-command], [command_in=input]);;
|
|
|
|
link)
|
|
AC_CONFIG_LINKS(link:input);;
|
|
var-link)
|
|
AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;
|
|
esac
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
|
|
# AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))
|
|
# ------------------------------------------------------------------
|
|
# Check that THING and var-THING (which uses variables in AC_CONFIG_THING)
|
|
# are properly created, with the right content.
|
|
# Use `grep OK' instead of a simple `cat' to avoid banners such as in
|
|
# AC_CONFIG_HEADERS.
|
|
m4_define([AT_CHECK_CONFIG_CREATION],
|
|
[AT_CHECK_CONFIGURE([what_to_test=$1])
|
|
AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
|
|
[ignore], [$1
|
|
])
|
|
AT_CHECK([grep OK $1], [], [OK
|
|
])
|
|
|
|
AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])
|
|
# config.status might be stupidly expecting data on stdin, if it's
|
|
# really broken...
|
|
AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])
|
|
AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null],
|
|
[ignore], [var-$1
|
|
])
|
|
AT_CHECK([grep OK var-$1], [], [OK
|
|
])
|
|
])# AT_CHECK_CONFIG_CREATION
|
|
|
|
|
|
# Create a file
|
|
AT_CHECK_CONFIG_CREATION(file)
|
|
|
|
# Create a header
|
|
AT_CHECK_CONFIG_CREATION(header)
|
|
|
|
# Execute a command
|
|
AT_CHECK_CONFIG_CREATION(command)
|
|
|
|
# Create a link
|
|
AT_CHECK_CONFIG_CREATION(link)
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## ------------------- ##
|
|
## Missing templates. ##
|
|
## ------------------- ##
|
|
|
|
# Check that config.status detects missing input files
|
|
AT_SETUP([Missing templates])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
AC_CONFIG_FILES([nonexistent])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_CONFIGURE([], [1], [],
|
|
[[config.status: error: cannot find input file: nonexistent.in
|
|
]])
|
|
# Make sure that the output file doesn't exist
|
|
AT_CHECK([test -f nonexistent], 1)
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
|
|
## ---------------------- ##
|
|
## configure invocation. ##
|
|
## ---------------------- ##
|
|
|
|
# Check that `configure' and `config.status' honor their interface.
|
|
#
|
|
# We run `./configure one=val1 --enable-two=val2 --with-three=val3'
|
|
# and verify that (i) `configure' correctly receives the arguments and
|
|
# (ii) correctly passes them to `config.status', which we check by
|
|
# running `config.status --recheck'.
|
|
|
|
AT_SETUP([configure invocation])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
echo "result=$one$enable_two$with_three"
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
|
|
sed -n -e 's/^result=//p'], 0,
|
|
[onetwothree
|
|
])
|
|
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
|
|
[onetwothree
|
|
])
|
|
|
|
AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
|
|
sed -n -e 's/^result=//p'], 0,
|
|
["'$ " ' $ "'$
|
|
])
|
|
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
|
|
["'$ " ' $ "'$
|
|
])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## -------------------------------------------- ##
|
|
## Check that `#define' templates are honored. ##
|
|
## -------------------------------------------- ##
|
|
|
|
# Use various forms of `#define' templates, and make sure there are no
|
|
# problems when a symbol is prefix of another.
|
|
|
|
AT_SETUP([#define header templates])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
AC_CONFIG_HEADERS(config.h:config.hin)
|
|
|
|
# I18n of dummy variables: their French translations.
|
|
AC_DEFINE(foo, toto)
|
|
AC_DEFINE(bar, tata)
|
|
AC_DEFINE(baz, titi)
|
|
AC_DEFINE(fubar, tutu)
|
|
|
|
# Symbols which are prefixes of another.
|
|
AC_DEFINE(a, A)
|
|
AC_DEFINE(aaa, AAA)
|
|
AC_DEFINE(aa, AA)
|
|
AC_CONFIG_FILES(defs)
|
|
|
|
# Things included in confdefs.h, but which make no sense in
|
|
# config.h, nor in $DEFS.
|
|
cat <<\EOF >>confdefs.h
|
|
/* Hi Mum! Look, I am doing C++! */
|
|
#ifdef __cplusplus
|
|
void exit (int status);
|
|
#endif
|
|
EOF
|
|
|
|
# In addition of config.h output a full DEFS
|
|
AC_OUTPUT_MAKE_DEFS
|
|
DEFS_SAVED=$DEFS
|
|
AC_SUBST(DEFS_SAVED)
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_DATA([defs.in],
|
|
[[@DEFS_SAVED@
|
|
]])
|
|
|
|
AT_DATA([config.hin],
|
|
[[#define foo 0
|
|
# define bar bar
|
|
# define baz "Archimedes was sinking in his baz"
|
|
# define fubar tutu
|
|
#define a B
|
|
#define aa BB
|
|
#define aaa BBB
|
|
#undef a
|
|
#undef aa
|
|
#undef aaa
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_CONFIGURE
|
|
|
|
AT_DATA([expout],
|
|
[[/* config.h. Generated from config.hin by configure. */
|
|
#define foo toto
|
|
# define bar tata
|
|
# define baz titi
|
|
# define fubar tutu
|
|
#define a A
|
|
#define aa AA
|
|
#define aaa AAA
|
|
#define a A
|
|
#define aa AA
|
|
#define aaa AAA
|
|
]])
|
|
AT_CHECK([cat config.h], 0, expout)
|
|
|
|
# Check the value of DEFS.
|
|
AT_DATA([expout],
|
|
[[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA
|
|
]])
|
|
|
|
# Because we strip trailing spaces in `testsuite' we can't leave one in
|
|
# expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.
|
|
AT_CHECK([sed -e 's/ $//' defs], 0, expout)
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## ------------------------- ##
|
|
## Torturing config.status. ##
|
|
## ------------------------- ##
|
|
|
|
## Require 100 AC_DEFINE and AC_SUBST with a significantly big value.
|
|
## This is mostly to check that Autoconf produces portable sed scripts
|
|
## in config.status. sed is used to skip the first two lines
|
|
## `Generated by...'.
|
|
|
|
# We use m4_for many times.
|
|
m4_pattern_allow([^m4_for$])
|
|
|
|
AT_SETUP([Torturing config.status])
|
|
|
|
dnl The value used as a big value for AC_DEFINE.
|
|
dnl Don't use sh active chars here, below it is also used in a sh
|
|
dnl assignment.
|
|
m4_define([AT_BIG_VALUE],
|
|
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
|
|
|
|
m4_define([AT_DESCRIPTION],
|
|
[Define to a long string if your `Autoconf' works properly.])
|
|
|
|
|
|
# AT_DUMMY_VAR(NUMBER)
|
|
# --------------------
|
|
# Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it
|
|
# so that the check for user name space invasion does not complain
|
|
# of the new variables defined.
|
|
#
|
|
# Note that you should not use the name ac_dummy, because it will be
|
|
# turned into ac_uummy during the construction of config.status. Yes,
|
|
# this is admittedly a bug, but it would be too hard to fix this.
|
|
# There is really no point in AC_DEFINE a var named ac_d.*.
|
|
m4_pattern_allow([^m4_bpatsubst$])
|
|
m4_define([AT_DUMMY_VAR],
|
|
[ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])])
|
|
|
|
|
|
|
|
AT_DATA([dummy.in],
|
|
[m4_for([AT_Count], 1, 100, 1,
|
|
[@AT_DUMMY_VAR(AT_Count)@
|
|
])])
|
|
|
|
|
|
# ------------ #
|
|
# configure.ac #
|
|
# ------------ #
|
|
|
|
m4_pattern_allow([^m4_(define|defun)$])
|
|
AT_DATA([configure.ac],
|
|
dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
|
|
dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
|
|
[[m4_define([AC_DUMMY_VAR],]
|
|
m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
|
|
|
|
[[m4_define([AC_DESCRIPTION],]
|
|
m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
|
|
|
|
[[m4_define([AC_BIG_VALUE],]
|
|
m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
|
|
|
|
[[# AC_DEFUBST(NAME)
|
|
# ----------------
|
|
# Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
|
|
# used in the torture tests.
|
|
m4_defun([AC_DEFUBST],
|
|
[AC_DUMMY_VAR($1)="AC_BIG_VALUE"
|
|
AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)",
|
|
AC_DESCRIPTION)
|
|
AC_SUBST(AC_DUMMY_VAR($1))])
|
|
|
|
AC_INIT
|
|
AC_CONFIG_HEADERS(config.h:config.hin)
|
|
AC_CONFIG_FILES(dummy)
|
|
m4_for(AC_Count, 1, 100, 1,
|
|
[AC_DEFUBST(AC_Count)])
|
|
AC_OUTPUT
|
|
]])# configure.ac
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_AUTOHEADER
|
|
AT_CHECK_CONFIGURE
|
|
|
|
# Checking that AC_DEFINE worked properly.
|
|
AT_DATA([expout],
|
|
[/* Define to the address where bug reports for this package should be sent. */
|
|
#define PACKAGE_BUGREPORT ""
|
|
|
|
/* Define to the full name of this package. */
|
|
#define PACKAGE_NAME ""
|
|
|
|
/* Define to the full name and version of this package. */
|
|
#define PACKAGE_STRING ""
|
|
|
|
/* Define to the one symbol short name of this package. */
|
|
#define PACKAGE_TARNAME ""
|
|
|
|
/* Define to the version of this package. */
|
|
#define PACKAGE_VERSION ""
|
|
m4_for(AT_Count, 1, 100, 1,
|
|
[
|
|
/* AT_DESCRIPTION */
|
|
[#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE"
|
|
])])
|
|
AT_CHECK([sed -n '4,$ p' config.h], 0, expout)
|
|
|
|
# Checking that AC_SUBST worked properly.
|
|
AT_DATA([expout],
|
|
[m4_for(AT_Count, 1, 100, 1,
|
|
[AT_BIG_VALUE
|
|
])])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
## ------------------------------- ##
|
|
## Substitute a 2000-byte string. ##
|
|
## ------------------------------- ##
|
|
|
|
# Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX
|
|
# sed dumps core around 8 KiB. However, POSIX says that sed need not
|
|
# handle lines longer than 2048 bytes (including the trailing newline).
|
|
# So we'll just test a 2000-byte value.
|
|
|
|
AT_SETUP([Substitute a 2000-byte string])
|
|
|
|
AT_DATA([Foo.in], [@foo@
|
|
])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
AC_CONFIG_AUX_DIR($top_srcdir/config)
|
|
AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[)
|
|
AC_CONFIG_FILES([Foo])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_CONFIGURE
|
|
AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................)
|
|
)
|
|
AT_CLEANUP
|
|
|
|
|
|
## ------------------------------ ##
|
|
## Define to a 2000-byte string. ##
|
|
## ------------------------------ ##
|
|
|
|
AT_SETUP([Define to a 2000-byte string])
|
|
|
|
AT_CONFIGURE_AC(
|
|
[[
|
|
AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc])
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_AUTOHEADER
|
|
AT_CHECK_CONFIGURE
|
|
AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................)
|
|
])
|
|
AT_CLEANUP
|
|
|
|
|
|
## ------------------------------------------ ##
|
|
## Substitute and define special characters. ##
|
|
## ------------------------------------------ ##
|
|
|
|
# Use characters special to the shell, sed, and M4.
|
|
|
|
AT_SETUP([Substitute and define special characters])
|
|
|
|
AT_DATA([Foo.in], [@foo@
|
|
])
|
|
|
|
AT_CONFIGURE_AC(
|
|
[[foo="AS@&t@_ESCAPE([[X*'[]+ ", `\($foo]])"
|
|
AC_SUBST([foo])
|
|
AC_DEFINE([foo], [[X*'[]+ ", `\($foo]], [Awful value.])
|
|
AC_CONFIG_FILES([Foo])]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_AUTOHEADER
|
|
AT_CHECK_CONFIGURE
|
|
AT_CHECK([cat Foo], 0, [[X*'[]+ ", `\($foo
|
|
]])
|
|
AT_CHECK_DEFINES([[#define foo X*'[]+ ", `\($foo
|
|
]])
|
|
AT_CLEANUP
|
|
|
|
|
|
## ---------------------- ##
|
|
## Substitute a newline. ##
|
|
## ---------------------- ##
|
|
|
|
AT_SETUP([Substitute a newline])
|
|
|
|
AT_DATA([Foo.in],
|
|
[@foo@
|
|
])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
AC_CONFIG_AUX_DIR($top_srcdir/config)
|
|
foo='one
|
|
two'
|
|
AC_SUBST([foo])
|
|
AC_CONFIG_FILES([Foo])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_CONFIGURE
|
|
AT_CHECK([cat Foo], 0, [one
|
|
two
|
|
])
|
|
AT_CLEANUP
|
|
|
|
|
|
## ------------------ ##
|
|
## Define a newline. ##
|
|
## ------------------ ##
|
|
|
|
AT_SETUP([Define a newline])
|
|
AT_XFAIL_IF(:)
|
|
AT_CONFIGURE_AC([[AC_DEFINE([foo], [one
|
|
two], [This spans two lines.])
|
|
]])
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_AUTOHEADER
|
|
AT_CHECK_CONFIGURE
|
|
AT_CHECK_DEFINES([[#define foo one
|
|
two
|
|
]])
|
|
AT_CLEANUP
|
|
|
|
|
|
## -------- ##
|
|
## srcdir. ##
|
|
## -------- ##
|
|
|
|
AT_SETUP([srcdir])
|
|
|
|
rm -f -r at-dir
|
|
mkdir at-dir
|
|
: >at-dir/bar.in
|
|
: >foo.in
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
|
|
AC_CONFIG_FILES([foo at-dir/bar])
|
|
|
|
AC_CONFIG_COMMANDS([report],
|
|
[test -f $srcdir/configure.ac ||
|
|
AC_MSG_ERROR([cannot find $srcdir/configure.ac])],
|
|
[srcdir=$srcdir])
|
|
|
|
AC_OUTPUT
|
|
rm -f -r foo at-dir/bar
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
# In place.
|
|
AT_CHECK([./configure], [], [ignore])
|
|
|
|
# Relative name.
|
|
AT_CHECK([cd at-dir && ../configure], [], [ignore])
|
|
|
|
# Absolute name.
|
|
at_here=`pwd`
|
|
AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
## ----------------- ##
|
|
## Signal handling. ##
|
|
## ----------------- ##
|
|
|
|
AT_SETUP([Signal handling])
|
|
|
|
AT_DATA([configure.ac],
|
|
[[AC_INIT
|
|
kill -2 $$
|
|
exit 77
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_CONFIGURE([], 1, ignore, ignore)
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
AT_BANNER([autoreconf.])
|
|
|
|
## ---------------------------- ##
|
|
## Configuring subdirectories. ##
|
|
## ---------------------------- ##
|
|
|
|
# .
|
|
# |-- builddir
|
|
# | |-- config.log
|
|
# | |-- config.status
|
|
# | `-- inner
|
|
# | |-- config.log
|
|
# | |-- config.status
|
|
# | `-- innermost
|
|
# | `-- config
|
|
# |-- configure
|
|
# |-- configure.ac
|
|
# |-- inner
|
|
# | |-- configure
|
|
# | |-- configure.ac
|
|
# | `-- innermost
|
|
# | `-- config.in
|
|
# `-- install-sh
|
|
#
|
|
AT_SETUP([Configuring subdirectories])
|
|
AT_KEYWORDS(autoreconf)
|
|
|
|
# We use aclocal (via autoreconf).
|
|
AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
|
|
# It should understand configure.ac.
|
|
AT_CHECK([[grep '1.[01234]' stdout && exit 77]], [1], [ignore])
|
|
|
|
# The contents of `inner/', and `inner/innermost/'.
|
|
AS_MKDIR_P([inner/innermost])
|
|
|
|
# We have to use configure.in, not configure.ac, if we still want to
|
|
# be compatible with Automake 1.4: aclocal (run by autoreconf) would
|
|
# die because it can't find configure.in.
|
|
AT_DATA([inner/configure.in],
|
|
[[AC_INIT(GNU Inner, 1.0)
|
|
AC_CONFIG_SRCDIR([innermost/config.in])
|
|
AC_ARG_VAR([INNER], [an inner variable])
|
|
AC_SUBST([INNER])
|
|
if test "x$INNER" = x; then
|
|
INNER=inner
|
|
fi
|
|
AC_CONFIG_FILES([innermost/config])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_DATA([inner/innermost/config.in],
|
|
[INNER=@INNER@
|
|
srcdir=@srcdir@
|
|
top_srcdir=@top_srcdir@
|
|
prefix=@prefix@
|
|
])
|
|
|
|
# The contents of `.'
|
|
AT_DATA([install-sh], [])
|
|
|
|
# nonexistent is allowed not to exist.
|
|
AT_DATA([configure.in],
|
|
[[AC_INIT(GNU Outer, 1.0)
|
|
AC_ARG_VAR([OUTER], [an outer variable])
|
|
if false; then
|
|
AC_CONFIG_SUBDIRS([nonexistent])
|
|
fi
|
|
AC_CONFIG_SUBDIRS([inner])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
# If there are improperly quoted AC_DEFUN installed in share/aclocal,
|
|
# they trigger warnings from aclocal 1.8, so ignore stderr.
|
|
AT_CHECK([autoreconf], [], [], [ignore])
|
|
AT_CHECK([test -f inner/configure])
|
|
|
|
# Running the outer configure recursively should provide the innermost
|
|
# help strings.
|
|
AT_CHECK([./configure --help=recursive | grep INNER], 0, [ignore])
|
|
|
|
# Running the outer configure should trigger the inner.
|
|
AT_CHECK_CONFIGURE
|
|
AT_CHECK([cat inner/innermost/config], 0,
|
|
[INNER=inner
|
|
srcdir=.
|
|
top_srcdir=..
|
|
prefix=/usr/local
|
|
])
|
|
|
|
# The same, but from a builddir.
|
|
AS_MKDIR_P([builddir])
|
|
AT_CHECK([cd builddir && ../configure], 0, [ignore])
|
|
AT_CHECK([cat builddir/inner/innermost/config], 0,
|
|
[INNER=inner
|
|
srcdir=../../../inner/innermost
|
|
top_srcdir=../../../inner
|
|
prefix=/usr/local
|
|
])
|
|
|
|
# Make sure precious variables and command line options are properly
|
|
# passed, even when there are duplicates. Run another directory so
|
|
# that if the user has set config.site to have a config.cache, then
|
|
# the two runs don't have colliding caches.
|
|
AS_MKDIR_P([builddir2])
|
|
AT_CHECK([cd builddir2 && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
|
|
AT_CHECK([cat builddir2/inner/innermost/config], 0,
|
|
[INNER=good
|
|
srcdir=../../../inner/innermost
|
|
top_srcdir=../../../inner
|
|
prefix=/good
|
|
])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## -------------- ##
|
|
## Deep Package. ##
|
|
## -------------- ##
|
|
|
|
AT_SETUP([Deep Package])
|
|
AT_KEYWORDS(autoreconf)
|
|
|
|
# We use aclocal (via autoreconf).
|
|
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
|
|
|
|
# The contents of `.'
|
|
AT_DATA([install-sh], [])
|
|
AT_DATA([configure.in],
|
|
[[AC_INIT(GNU Outer, 1.0)
|
|
AC_ARG_VAR([OUTER], [an outer variable])
|
|
AC_CONFIG_SUBDIRS([inner])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
# The contents of `inner/', and `inner/innermost/'.
|
|
AS_MKDIR_P([inner/innermost])
|
|
|
|
AT_DATA([inner/configure.in],
|
|
[[AC_INIT(GNU Inner, 1.0)
|
|
AC_ARG_VAR([INNER], [an inner variable])
|
|
AC_CONFIG_SUBDIRS(innermost)
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_DATA([inner/innermost/configure.in],
|
|
[[AC_INIT(GNU Innermost, 1.0)
|
|
AC_ARG_VAR([INNERMOST], [an innermost variable])
|
|
AC_CONFIG_HEADERS(config.h:config.hin)
|
|
AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
|
|
AT_CHECK([test -f inner/configure])
|
|
AT_CHECK([test -f inner/innermost/configure])
|
|
AT_CHECK([test -f inner/innermost/config.hin])
|
|
|
|
# Running the outer configure recursively should provide the innermost
|
|
# help strings.
|
|
AT_CHECK([./configure --help=recursive | grep " INNER "], 0, [ignore])
|
|
AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
|
|
|
|
# Running the outer configure should trigger the inner.
|
|
AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
|
|
AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
|
|
[[#define INNERMOST tsomrenni
|
|
]])
|
|
|
|
# The same, but from a builddir.
|
|
AS_MKDIR_P([builddir])
|
|
AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
|
|
AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
|
|
[[#define INNERMOST build/tsomrenni
|
|
]])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## -------------------------------- ##
|
|
## Non-Autoconf AC_CONFIG_SUBDIRS. ##
|
|
## -------------------------------- ##
|
|
|
|
AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS])
|
|
AT_KEYWORDS([autoreconf])
|
|
|
|
# We use aclocal (via autoreconf).
|
|
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
|
|
|
|
AT_DATA([install-sh], [])
|
|
AT_DATA([configure.in],
|
|
[[AC_INIT(GNU Outer, 1.0)
|
|
AC_CONFIG_SUBDIRS([inner])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AS_MKDIR_P([inner])
|
|
|
|
AT_DATA([inner/configure],
|
|
[[#! /bin/sh
|
|
case "$*" in
|
|
*--help*) echo 'No Autoconf here, folks!' ;;
|
|
*) echo got_it >myfile ;;
|
|
esac
|
|
exit 0
|
|
]])
|
|
chmod +x inner/configure
|
|
|
|
AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore])
|
|
|
|
# Running the outer configure recursively should provide the innermost
|
|
# help strings.
|
|
AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore])
|
|
|
|
# Running the outer configure should trigger the inner.
|
|
AT_CHECK([./configure], 0, [ignore])
|
|
AT_CHECK([test -f inner/myfile], 0)
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## ----------------- ##
|
|
## Empty directory. ##
|
|
## ----------------- ##
|
|
|
|
AT_SETUP([Empty directory])
|
|
AT_KEYWORDS([autoreconf])
|
|
|
|
# We use aclocal (via autoreconf).
|
|
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
|
|
|
|
# The test group directory is not necessarily _empty_, but it does not contain
|
|
# files meaningful to `autoreconf'.
|
|
|
|
AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore])
|
|
|
|
AT_CLEANUP
|
|
|
|
|
|
|
|
## ------------------------------ ##
|
|
## Unusual Automake input files. ##
|
|
## ------------------------------ ##
|
|
|
|
# This parallels gnumake.test in Automake.
|
|
|
|
AT_SETUP([Unusual Automake input files])
|
|
AT_KEYWORDS([autoreconf])
|
|
|
|
# We use aclocal and automake via autoreconf.
|
|
AT_CHECK([automake --version || exit 77], [], [ignore], [ignore])
|
|
|
|
AT_DATA([configure.in],
|
|
[[AC_INIT(GNU foo, 1.0)
|
|
AM_INIT_AUTOMAKE
|
|
AC_CONFIG_FILES([HeeHee])
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_DATA([HeeHee.am],
|
|
[[# Humans do no worse than `GNUmakefile.am'.
|
|
AUTOMAKE_OPTIONS = foreign
|
|
]])
|
|
|
|
AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [ignore])
|
|
AT_CHECK([test -f HeeHee.in])
|
|
|
|
AT_CLEANUP
|