* tests/base.at, tests/compile.at, tests/foreign.at,
* tests/m4sh.at, tests/m4sugar.at, tests/mktests.sh,
* tests/semantics.at, tests/suite.at, tests/tools.at,
* tests/torture.at: Ask Autotest mode, not Autoconf mode.
2001-08-20 22:44:38 +08:00
|
|
|
# -*- Autotest -*-
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
AT_BANNER([[Testing config.status.
|
2000-02-08 01:15:51 +08:00
|
|
|
|
|
|
|
## ---------------------------------------------------------------- ##
|
2000-10-05 17:39:06 +08:00
|
|
|
## This section of torture tests is trying to make Autoconf produce ##
|
|
|
|
## failing `configure' scripts, which must never happen. If one of ##
|
|
|
|
## these tests ever fails, it is extremely important that you ##
|
|
|
|
## report the failure to bug-autoconf@gnu.org. ##
|
2000-11-29 18:12:05 +08:00
|
|
|
## ---------------------------------------------------------------- ##]])
|
2000-02-08 01:15:51 +08:00
|
|
|
|
* AUTHORS, BUGS, ChangeLog, ChangeLog.0, ChangeLog.1,
ChangeLog.2, GNUmakefile, Makefile.maint, NEWS, README,
README-alpha, TODO, configure.ac, lib/autoconf/Makefile.am,
m4/atconfig.m4, m4/init.m4, m4/m4.m4, m4/missing.m4,
m4/sanity.m4, tests/README, tests/aclocal.m4,
tests/atspecific.m4, tests/base.at, tests/compile.at,
tests/foreign.at, tests/m4sh.at, tests/m4sugar.at,
tests/semantics.at, tests/suite.at, tests/tools.at,
tests/torture.at: Add copyright notice.
* tests/mktests.sh: Update year in copyright notice.
2001-08-12 21:05:11 +08:00
|
|
|
# Copyright 2000, 2001 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., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
# 02111-1307, USA.
|
|
|
|
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2001-06-18 02:14:27 +08:00
|
|
|
## ------------ ##
|
|
|
|
## AC_ARG_VAR. ##
|
|
|
|
## ------------ ##
|
|
|
|
|
2001-06-24 01:14:34 +08:00
|
|
|
# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
|
|
|
|
# ----------------------------------------------
|
2001-06-18 02:14:27 +08:00
|
|
|
# Check that AC_ARG_VAR caches the latest values, diagnoses
|
|
|
|
# inconsistances, and arms config.status.
|
2001-06-21 18:56:21 +08:00
|
|
|
m4_define([AT_CHECK_AC_ARG_VAR],
|
2001-06-24 01:14:34 +08:00
|
|
|
[rm -f config.cache
|
|
|
|
|
|
|
|
# Initial value.
|
|
|
|
m4_ifval([$1],
|
|
|
|
[precious='$1'; export precious],
|
|
|
|
[unset precious])
|
|
|
|
AT_CHECK_CONFIGURE([--config-cache])
|
|
|
|
AT_CHECK([cat file], [], [`$1'
|
|
|
|
])
|
|
|
|
|
|
|
|
# Testing --recheck.
|
|
|
|
unset precious
|
|
|
|
AT_CHECK([./config.status --recheck], [], [ignore])
|
|
|
|
AT_CHECK([./config.status], [], [ignore])
|
|
|
|
AT_CHECK([cat file], [], [`$1'
|
|
|
|
])
|
|
|
|
|
|
|
|
# Second value.
|
|
|
|
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])
|
2001-06-18 02:14:27 +08:00
|
|
|
|
|
|
|
# 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])
|
|
|
|
AC_OUTPUT(file)
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([file.in],
|
|
|
|
[[`@precious@'
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
|
2001-06-24 01:14:34 +08:00
|
|
|
# Set a precious variable
|
|
|
|
AT_CHECK_AC_ARG_VAR([], [apple of my eye])
|
2001-06-18 02:14:27 +08:00
|
|
|
|
2001-06-24 01:14:34 +08:00
|
|
|
# Unset a precious variable
|
|
|
|
AT_CHECK_AC_ARG_VAR([apple of my eye], [])
|
2001-06-18 02:14:27 +08:00
|
|
|
|
2001-06-24 01:14:34 +08:00
|
|
|
# Change a precious variable
|
|
|
|
AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])
|
2001-06-18 02:14:27 +08:00
|
|
|
|
|
|
|
AT_CLEANUP
|
|
|
|
|
2001-06-23 23:04:14 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
## ---------------------------------------------- ##
|
|
|
|
## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
|
|
|
|
## ---------------------------------------------- ##
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA(configure.ac,
|
2000-11-16 22:56:17 +08:00
|
|
|
[[AC_INIT
|
2001-06-23 23:04:14 +08:00
|
|
|
rm -rf header var-header file var-file link var-link command var-command
|
|
|
|
echo 'OK' >input
|
|
|
|
|
|
|
|
# Be sure to also stress the associated INIT-CMDS.
|
2000-11-16 22:56:17 +08:00
|
|
|
case $what_to_test in
|
2001-06-23 23:04:14 +08:00
|
|
|
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:input,
|
|
|
|
[cp input command]);;
|
|
|
|
var-command)
|
|
|
|
AC_CONFIG_COMMANDS(var-command:$command_in,
|
|
|
|
[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]);;
|
2000-11-16 22:56:17 +08:00
|
|
|
esac
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2000-11-23 17:52:35 +08:00
|
|
|
AT_CHECK_AUTOCONF
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2001-06-23 23:04:14 +08:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2000-02-17 17:31:34 +08:00
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
# Create a file
|
2001-06-23 23:04:14 +08:00
|
|
|
AT_CHECK_CONFIG_CREATION(file)
|
|
|
|
|
|
|
|
# Create a header
|
|
|
|
AT_CHECK_CONFIG_CREATION(header)
|
2000-02-17 17:31:34 +08:00
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
# Execute a command
|
2001-06-23 23:04:14 +08:00
|
|
|
AT_CHECK_CONFIG_CREATION(command)
|
2000-02-17 17:31:34 +08:00
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
# Create a link
|
2001-06-23 23:04:14 +08:00
|
|
|
AT_CHECK_CONFIG_CREATION(link)
|
2000-11-16 22:56:17 +08:00
|
|
|
|
2001-06-23 23:04:14 +08:00
|
|
|
AT_CLEANUP(header file link commandvar-header var-file var-link var-command
|
|
|
|
input)
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2000-02-17 17:31:34 +08:00
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
## ------------------- ##
|
|
|
|
## Missing templates. ##
|
|
|
|
## ------------------- ##
|
2000-11-16 22:56:17 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
# Check that config.status detects missing input files
|
|
|
|
AT_SETUP([Missing templates])
|
2000-02-08 01:15:51 +08:00
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA(configure.ac,
|
2000-11-16 22:56:17 +08:00
|
|
|
[[AC_INIT
|
|
|
|
AC_CONFIG_FILES([nonexistent])
|
2000-02-17 17:31:34 +08:00
|
|
|
AC_OUTPUT
|
2000-11-16 22:56:17 +08:00
|
|
|
]])
|
2000-02-17 17:31:34 +08:00
|
|
|
|
2000-11-23 17:52:35 +08:00
|
|
|
AT_CHECK_AUTOCONF
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CHECK_CONFIGURE([], [1], [],
|
2000-11-30 00:08:43 +08:00
|
|
|
[[config.status: error: cannot find input file: nonexistent.in
|
2000-11-16 22:56:17 +08:00
|
|
|
]])
|
|
|
|
# Make sure that the output file doesn't exist
|
|
|
|
AT_CHECK([test -f nonexistent], 1)
|
2000-02-17 17:31:34 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CLEANUP
|
2000-02-10 02:08:37 +08:00
|
|
|
|
2000-02-10 02:24:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
## ---------------------- ##
|
|
|
|
## configure invocation. ##
|
|
|
|
## ---------------------- ##
|
2000-02-10 02:24:24 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
# Check that `configure' and `config.status' honor their interface.
|
|
|
|
#
|
2000-05-22 16:05:40 +08:00
|
|
|
# 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'.
|
2000-02-10 02:24:24 +08:00
|
|
|
|
2000-11-29 18:12:05 +08:00
|
|
|
AT_SETUP([configure invocation])
|
2000-02-10 02:24:24 +08:00
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA(configure.ac,
|
2000-02-10 02:24:24 +08:00
|
|
|
[[AC_INIT
|
2000-05-22 16:05:40 +08:00
|
|
|
echo "result=$one$enable_two$with_three"
|
2000-02-10 02:24:24 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
2000-11-23 17:52:35 +08:00
|
|
|
AT_CHECK_AUTOCONF
|
2000-02-10 02:24:24 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
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,
|
2000-05-22 16:05:40 +08:00
|
|
|
[onetwothree
|
2000-12-19 16:15:48 +08:00
|
|
|
])
|
2000-02-10 02:24:24 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
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,
|
2000-05-22 16:05:40 +08:00
|
|
|
["'$ " ' $ "'$
|
2000-12-19 16:15:48 +08:00
|
|
|
])
|
2000-02-10 02:24:24 +08:00
|
|
|
|
|
|
|
AT_CLEANUP(configure config.status config.log config.cache)
|
Honor properly the `#define' config.h.in templates.
Test it.
* acgeneral.m4 (AC_OUTPUT_HEADERS): Renamed as...
(_AC_OUTPUT_HEADERS): this. All callers changed.
Don't mess with changequote, just quote properly.
Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not
removed, and therefore the sed script contained `<<define>>'
instead of `define'. Now that the block is properly quoted, there
is no need to quote `define'.
Bug 2. Once a `#define' substitution performed, we were branching
to the top of the sed script (`t top'). This resulted in an
endless substitution of `#define foo 1' to `#define foo 1'.
Branching is not enough: you also have to fetch the next input
line, i.e., use `t' instead of `t t' in ac_dD, and don't output
`: top' in `config.defines'.
Though it was correct for `#undef' templates, just apply the same
transformation to `ac_uD' and `config.undefs'.
Bug 3. Don't try to preserve what was behind the value in the
template, since on
#define NAME "bar baz"
it leads to
#define NAME 1 baz"
Now `ac_dB' catches everything behind the NAME (making sure there
is at least a space) and `ac_dC' only outputs a space.
* tests/torture.m4: Check that various forms of `#define' header
templates are properly handled.
2000-02-10 18:38:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## -------------------------------------------- ##
|
|
|
|
## 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])
|
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA([configure.ac],
|
Honor properly the `#define' config.h.in templates.
Test it.
* acgeneral.m4 (AC_OUTPUT_HEADERS): Renamed as...
(_AC_OUTPUT_HEADERS): this. All callers changed.
Don't mess with changequote, just quote properly.
Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not
removed, and therefore the sed script contained `<<define>>'
instead of `define'. Now that the block is properly quoted, there
is no need to quote `define'.
Bug 2. Once a `#define' substitution performed, we were branching
to the top of the sed script (`t top'). This resulted in an
endless substitution of `#define foo 1' to `#define foo 1'.
Branching is not enough: you also have to fetch the next input
line, i.e., use `t' instead of `t t' in ac_dD, and don't output
`: top' in `config.defines'.
Though it was correct for `#undef' templates, just apply the same
transformation to `ac_uD' and `config.undefs'.
Bug 3. Don't try to preserve what was behind the value in the
template, since on
#define NAME "bar baz"
it leads to
#define NAME 1 baz"
Now `ac_dB' catches everything behind the NAME (making sure there
is at least a space) and `ac_dC' only outputs a space.
* tests/torture.m4: Check that various forms of `#define' header
templates are properly handled.
2000-02-10 18:38:59 +08:00
|
|
|
[[AC_INIT
|
|
|
|
AC_CONFIG_HEADERS(config.h:config.hin)
|
2001-01-31 03:29:38 +08:00
|
|
|
|
Honor properly the `#define' config.h.in templates.
Test it.
* acgeneral.m4 (AC_OUTPUT_HEADERS): Renamed as...
(_AC_OUTPUT_HEADERS): this. All callers changed.
Don't mess with changequote, just quote properly.
Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not
removed, and therefore the sed script contained `<<define>>'
instead of `define'. Now that the block is properly quoted, there
is no need to quote `define'.
Bug 2. Once a `#define' substitution performed, we were branching
to the top of the sed script (`t top'). This resulted in an
endless substitution of `#define foo 1' to `#define foo 1'.
Branching is not enough: you also have to fetch the next input
line, i.e., use `t' instead of `t t' in ac_dD, and don't output
`: top' in `config.defines'.
Though it was correct for `#undef' templates, just apply the same
transformation to `ac_uD' and `config.undefs'.
Bug 3. Don't try to preserve what was behind the value in the
template, since on
#define NAME "bar baz"
it leads to
#define NAME 1 baz"
Now `ac_dB' catches everything behind the NAME (making sure there
is at least a space) and `ac_dC' only outputs a space.
* tests/torture.m4: Check that various forms of `#define' header
templates are properly handled.
2000-02-10 18:38:59 +08:00
|
|
|
# I18n of dummy variables: their French translations.
|
|
|
|
AC_DEFINE(foo, toto)
|
|
|
|
AC_DEFINE(bar, tata)
|
|
|
|
AC_DEFINE(baz, titi)
|
|
|
|
AC_DEFINE(fubar, tutu)
|
2001-01-31 03:29:38 +08:00
|
|
|
|
Honor properly the `#define' config.h.in templates.
Test it.
* acgeneral.m4 (AC_OUTPUT_HEADERS): Renamed as...
(_AC_OUTPUT_HEADERS): this. All callers changed.
Don't mess with changequote, just quote properly.
Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not
removed, and therefore the sed script contained `<<define>>'
instead of `define'. Now that the block is properly quoted, there
is no need to quote `define'.
Bug 2. Once a `#define' substitution performed, we were branching
to the top of the sed script (`t top'). This resulted in an
endless substitution of `#define foo 1' to `#define foo 1'.
Branching is not enough: you also have to fetch the next input
line, i.e., use `t' instead of `t t' in ac_dD, and don't output
`: top' in `config.defines'.
Though it was correct for `#undef' templates, just apply the same
transformation to `ac_uD' and `config.undefs'.
Bug 3. Don't try to preserve what was behind the value in the
template, since on
#define NAME "bar baz"
it leads to
#define NAME 1 baz"
Now `ac_dB' catches everything behind the NAME (making sure there
is at least a space) and `ac_dC' only outputs a space.
* tests/torture.m4: Check that various forms of `#define' header
templates are properly handled.
2000-02-10 18:38:59 +08:00
|
|
|
# Symbols which are prefixes of another.
|
|
|
|
AC_DEFINE(a, A)
|
|
|
|
AC_DEFINE(aaa, AAA)
|
|
|
|
AC_DEFINE(aa, AA)
|
2000-02-10 18:41:52 +08:00
|
|
|
AC_CONFIG_FILES(defs)
|
2001-01-31 03:29:38 +08:00
|
|
|
|
|
|
|
# Things included in confdefs.h, but which make no sense in
|
|
|
|
# config.h, nor in $DEFS.
|
|
|
|
cat <<\EOF >>confdefs.h
|
|
|
|
/* Hi Mum! Look, I'm doing C++! */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
void exit (int status);
|
|
|
|
#endif
|
|
|
|
EOF
|
|
|
|
|
2000-02-10 18:41:52 +08:00
|
|
|
# In addition of config.h output a full DEFS
|
|
|
|
AC_OUTPUT_MAKE_DEFS
|
|
|
|
DEFS_SAVED=$DEFS
|
|
|
|
AC_SUBST(DEFS_SAVED)
|
Honor properly the `#define' config.h.in templates.
Test it.
* acgeneral.m4 (AC_OUTPUT_HEADERS): Renamed as...
(_AC_OUTPUT_HEADERS): this. All callers changed.
Don't mess with changequote, just quote properly.
Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not
removed, and therefore the sed script contained `<<define>>'
instead of `define'. Now that the block is properly quoted, there
is no need to quote `define'.
Bug 2. Once a `#define' substitution performed, we were branching
to the top of the sed script (`t top'). This resulted in an
endless substitution of `#define foo 1' to `#define foo 1'.
Branching is not enough: you also have to fetch the next input
line, i.e., use `t' instead of `t t' in ac_dD, and don't output
`: top' in `config.defines'.
Though it was correct for `#undef' templates, just apply the same
transformation to `ac_uD' and `config.undefs'.
Bug 3. Don't try to preserve what was behind the value in the
template, since on
#define NAME "bar baz"
it leads to
#define NAME 1 baz"
Now `ac_dB' catches everything behind the NAME (making sure there
is at least a space) and `ac_dC' only outputs a space.
* tests/torture.m4: Check that various forms of `#define' header
templates are properly handled.
2000-02-10 18:38:59 +08:00
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_DATA([defs.in],
|
2000-02-10 18:41:52 +08:00
|
|
|
[[@DEFS_SAVED@
|
|
|
|
]])
|
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_DATA([config.hin],
|
Honor properly the `#define' config.h.in templates.
Test it.
* acgeneral.m4 (AC_OUTPUT_HEADERS): Renamed as...
(_AC_OUTPUT_HEADERS): this. All callers changed.
Don't mess with changequote, just quote properly.
Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not
removed, and therefore the sed script contained `<<define>>'
instead of `define'. Now that the block is properly quoted, there
is no need to quote `define'.
Bug 2. Once a `#define' substitution performed, we were branching
to the top of the sed script (`t top'). This resulted in an
endless substitution of `#define foo 1' to `#define foo 1'.
Branching is not enough: you also have to fetch the next input
line, i.e., use `t' instead of `t t' in ac_dD, and don't output
`: top' in `config.defines'.
Though it was correct for `#undef' templates, just apply the same
transformation to `ac_uD' and `config.undefs'.
Bug 3. Don't try to preserve what was behind the value in the
template, since on
#define NAME "bar baz"
it leads to
#define NAME 1 baz"
Now `ac_dB' catches everything behind the NAME (making sure there
is at least a space) and `ac_dC' only outputs a space.
* tests/torture.m4: Check that various forms of `#define' header
templates are properly handled.
2000-02-10 18:38:59 +08:00
|
|
|
[[#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
|
|
|
|
]])
|
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CHECK_AUTOCONF
|
2000-11-23 17:52:35 +08:00
|
|
|
AT_CHECK_CONFIGURE
|
2000-02-10 18:41:52 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_DATA([expout],
|
Honor properly the `#define' config.h.in templates.
Test it.
* acgeneral.m4 (AC_OUTPUT_HEADERS): Renamed as...
(_AC_OUTPUT_HEADERS): this. All callers changed.
Don't mess with changequote, just quote properly.
Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not
removed, and therefore the sed script contained `<<define>>'
instead of `define'. Now that the block is properly quoted, there
is no need to quote `define'.
Bug 2. Once a `#define' substitution performed, we were branching
to the top of the sed script (`t top'). This resulted in an
endless substitution of `#define foo 1' to `#define foo 1'.
Branching is not enough: you also have to fetch the next input
line, i.e., use `t' instead of `t t' in ac_dD, and don't output
`: top' in `config.defines'.
Though it was correct for `#undef' templates, just apply the same
transformation to `ac_uD' and `config.undefs'.
Bug 3. Don't try to preserve what was behind the value in the
template, since on
#define NAME "bar baz"
it leads to
#define NAME 1 baz"
Now `ac_dB' catches everything behind the NAME (making sure there
is at least a space) and `ac_dC' only outputs a space.
* tests/torture.m4: Check that various forms of `#define' header
templates are properly handled.
2000-02-10 18:38:59 +08:00
|
|
|
[[/* config.h. Generated automatically 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)
|
|
|
|
|
2000-02-11 16:59:52 +08:00
|
|
|
# Check the value of DEFS. Note the leading space.
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_DATA([expout],
|
2001-01-31 03:29:38 +08:00
|
|
|
[[-Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA]
|
2000-02-10 18:41:52 +08:00
|
|
|
])
|
|
|
|
|
2000-02-15 17:03:36 +08:00
|
|
|
# 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)
|
2000-02-10 18:41:52 +08:00
|
|
|
|
2000-12-19 16:15:48 +08:00
|
|
|
AT_CLEANUP
|
2000-11-16 22:56:17 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## ------------------------- ##
|
|
|
|
## 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...'.
|
|
|
|
|
2001-01-18 17:15:52 +08:00
|
|
|
AT_SETUP([Torturing config.status])
|
|
|
|
|
2000-11-16 22:56:17 +08:00
|
|
|
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.
|
2001-01-18 17:15:52 +08:00
|
|
|
m4_define([AT_BIG_VALUE],
|
2000-11-16 22:56:17 +08:00
|
|
|
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
|
|
|
|
|
2001-01-18 17:15:52 +08:00
|
|
|
m4_define([AT_DESCRIPTION],
|
2000-11-16 22:56:17 +08:00
|
|
|
[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.*.
|
2000-11-23 17:45:48 +08:00
|
|
|
m4_define([AT_DUMMY_VAR],
|
2000-11-16 22:56:17 +08:00
|
|
|
[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-23 17:45:48 +08:00
|
|
|
AT_DATA([dummy.in],
|
|
|
|
[m4_for([AT_Count], 1, 100, 1,
|
2000-11-16 22:56:17 +08:00
|
|
|
[@AT_DUMMY_VAR(AT_Count)@
|
|
|
|
])])
|
|
|
|
|
2001-01-18 17:15:52 +08:00
|
|
|
|
|
|
|
# ------------ #
|
|
|
|
# configure.ac #
|
|
|
|
# ------------ #
|
|
|
|
|
2000-12-23 18:11:57 +08:00
|
|
|
AT_DATA(configure.ac,
|
2001-01-18 17:15:52 +08:00
|
|
|
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
|
2000-11-16 22:56:17 +08:00
|
|
|
AC_CONFIG_HEADERS(config.h:config.hin)
|
|
|
|
AC_CONFIG_FILES(dummy)
|
2001-01-18 17:15:52 +08:00
|
|
|
m4_for(AC_Count, 1, 100, 1,
|
|
|
|
[AC_DEFUBST(AC_Count)])
|
2000-11-16 22:56:17 +08:00
|
|
|
AC_OUTPUT
|
2001-01-18 17:15:52 +08:00
|
|
|
]])# configure.ac
|
2000-11-16 22:56:17 +08:00
|
|
|
|
2000-11-23 17:52:35 +08:00
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
AT_CHECK_AUTOHEADER
|
|
|
|
AT_CHECK_CONFIGURE
|
2000-11-16 22:56:17 +08:00
|
|
|
|
|
|
|
# Checking that AC_DEFINE worked properly.
|
|
|
|
AT_DATA(expout,
|
2000-11-23 17:45:48 +08:00
|
|
|
[m4_for(AT_Count, 1, 100, 1,
|
2000-11-16 22:56:17 +08:00
|
|
|
[
|
2001-01-18 17:15:52 +08:00
|
|
|
/* AT_DESCRIPTION */
|
|
|
|
[#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE"
|
2000-11-16 22:56:17 +08:00
|
|
|
])])
|
2001-01-18 17:15:52 +08:00
|
|
|
AT_CHECK([sed -n '3,$ p' config.h], 0, expout)
|
2000-11-16 22:56:17 +08:00
|
|
|
|
|
|
|
# Checking that AC_SUBST worked properly.
|
|
|
|
AT_DATA(expout,
|
2000-11-23 17:45:48 +08:00
|
|
|
[m4_for(AT_Count, 1, 100, 1,
|
2001-01-18 17:15:52 +08:00
|
|
|
[AT_BIG_VALUE
|
2000-11-16 22:56:17 +08:00
|
|
|
])])
|
|
|
|
|
|
|
|
AT_CLEANUP(dummy)
|
2001-01-24 21:19:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
## -------- ##
|
|
|
|
## srcdir. ##
|
|
|
|
## -------- ##
|
|
|
|
|
|
|
|
AT_SETUP([srcdir])
|
|
|
|
|
|
|
|
rm -rf 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 -rf foo at-dir/bar
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
|
|
|
|
# In place.
|
|
|
|
AT_CHECK([./configure], [], [ignore])
|
|
|
|
|
|
|
|
# Relative path.
|
|
|
|
AT_CHECK([cd at-dir && ../configure], [], [ignore])
|
|
|
|
|
|
|
|
# Absolute path.
|
|
|
|
at_here=`pwd`
|
|
|
|
AT_CHECK([cd at-dir && $at_here/configure], [], [ignore])
|
|
|
|
|
|
|
|
AT_CLEANUP(at-dir foo.in foo)
|
2001-06-02 13:49:54 +08:00
|
|
|
|
|
|
|
|
|
|
|
## ----------------- ##
|
|
|
|
## 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
|