2000-02-08 01:15:51 +08:00
|
|
|
# -*- autoconf -*-
|
|
|
|
|
|
|
|
cat <<\EOF
|
|
|
|
|
|
|
|
Torturing config.status.
|
|
|
|
|
|
|
|
## ---------------------------------------------------------------- ##
|
|
|
|
## This section of tests is trying to make Autoconf produce failing ##
|
|
|
|
## `configure' scripts, which must not happen. If these tests ever ##
|
|
|
|
## fail, it is extremely important that you report the failure to ##
|
|
|
|
## bug-autoconf@gnu.org. ##
|
|
|
|
## ---------------------------------------------------------------- ##
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
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.
|
|
|
|
define(Big_Value,
|
|
|
|
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
|
|
|
|
|
|
|
|
define(DEFINE_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.*.
|
|
|
|
define(AT_DUMMY_VAR,
|
|
|
|
[ac_Dummy_[]patsubst([000$1], [.*\(...\)$], [\1])])
|
|
|
|
|
2000-02-10 02:08:37 +08:00
|
|
|
dnl This call was quite delicate to write because we didn't want to
|
|
|
|
dnl produce the 100 commands by hand. Be very careful if you want to
|
|
|
|
dnl touch something.
|
2000-02-08 01:15:51 +08:00
|
|
|
|
|
|
|
## 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...'.
|
|
|
|
|
|
|
|
AT_DATA(dummy.in,
|
|
|
|
[m4_for(AT_Count, 1, 100,
|
|
|
|
[@AT_DUMMY_VAR(AT_Count)@
|
|
|
|
])])
|
|
|
|
|
|
|
|
AT_TEST_MACRO(config.status under extreme conditions,
|
|
|
|
[AC_CONFIG_FILES(dummy)
|
|
|
|
[define]([AC_DEFUBST_VALUE], Big_Value)
|
2000-02-08 01:28:43 +08:00
|
|
|
dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
|
|
|
|
dnl to AC_DUMMY_VAR in Autoconf.
|
2000-02-08 01:15:51 +08:00
|
|
|
[define]([AC_DUMMY_VAR],
|
|
|
|
changequote({{, }})dnl
|
|
|
|
[defn({{AT_DUMMY_VAR}})]dnl
|
|
|
|
changequote([, ]))
|
|
|
|
m4_for(AT_Count, 1, 100,
|
|
|
|
[AC_DEFUBST(AT_Count)
|
|
|
|
])],
|
|
|
|
[# Checking that AC_DEFINE worked properly.
|
|
|
|
AT_DATA(expout,
|
|
|
|
[m4_for(AT_Count, 1, 100,
|
|
|
|
[
|
|
|
|
/* DEFINE_Description */
|
|
|
|
[#define] AT_DUMMY_VAR(AT_Count) "Big_Value"
|
|
|
|
])])
|
|
|
|
AT_CHECK([sed -n -e '3,$ p' config.h], 0, expout)
|
|
|
|
# Checking that AC_SUBST worked properly.
|
|
|
|
AT_DATA(expout,
|
|
|
|
[m4_for(AT_Count, 1, 100,
|
|
|
|
[Big_Value
|
|
|
|
])])
|
|
|
|
])
|
2000-02-10 02:08:37 +08:00
|
|
|
|
|
|
|
dnl Remove test files.
|
|
|
|
rm -f dummy dummy.in
|
2000-02-10 02:24:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dnl ## ------------------------------------------------------ ##
|
|
|
|
dnl ## Check that `configure' and `config.status' honor their ##
|
|
|
|
dnl ## interface. ##
|
|
|
|
dnl ## ------------------------------------------------------ ##
|
|
|
|
|
|
|
|
dnl We run `./configure result=val' and verify that (i) `configure'
|
|
|
|
dnl correctly receives `val' and (ii) correctly passes it to
|
|
|
|
dnl `config.status', which we check by running `config.status
|
|
|
|
dnl --recheck' (which *must* preserve the value of `result').
|
|
|
|
|
|
|
|
AT_SETUP(command line interface)
|
|
|
|
|
|
|
|
AT_DATA(configure.in,
|
|
|
|
[[AC_INIT
|
|
|
|
echo "result=$result"
|
|
|
|
AC_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_CHECK([../autoconf -m .. -l $at_srcdir], 0,, ignore)
|
|
|
|
|
|
|
|
AT_CHECK([./configure result=result | sed -n -e 's/^result=//p'], 0,
|
|
|
|
[result
|
|
|
|
], ignore)
|
|
|
|
AT_CHECK([./config.status --recheck | sed -n -e 's/^result=//p'], 0,
|
|
|
|
[result
|
|
|
|
], ignore)
|
|
|
|
|
|
|
|
AT_CHECK([./configure result="\"'$" | sed -n -e 's/^result=//p'], 0,
|
|
|
|
["'$
|
|
|
|
], ignore)
|
|
|
|
AT_CHECK([./config.status --recheck | sed -n -e 's/^result=//p'], 0,
|
|
|
|
["'$
|
|
|
|
], ignore)
|
|
|
|
|
|
|
|
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])
|
|
|
|
|
|
|
|
AT_DATA(configure.in,
|
|
|
|
[[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_OUTPUT
|
|
|
|
]])
|
|
|
|
|
|
|
|
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_DATA(expout,
|
|
|
|
[[/* 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([../autoconf -m .. -l $at_srcdir], 0)
|
|
|
|
AT_CHECK([./configure], 0, ignore)
|
|
|
|
AT_CHECK([cat config.h], 0, expout)
|
|
|
|
|
|
|
|
AT_CLEANUP(configure config.status config.log config.cache config.h)
|