mirror of
git://git.sv.gnu.org/autoconf
synced 2024-12-09 02:10:22 +08:00
cd7cd7bf31
* autoreconf.sh: Likewise. * autoheader.sh: Ditto. * autoupdate.sh: Similarly. * doc/autoconf.texi: Adjust. * tests/atspecific.m4: Be sure to remove configure.in. Adjust the test suite to use `configure.ac'.
282 lines
7.1 KiB
Plaintext
282 lines
7.1 KiB
Plaintext
# -*- autoconf -*-
|
|
|
|
AT_BANNER([[Testing config.status.
|
|
|
|
## ---------------------------------------------------------------- ##
|
|
## 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. ##
|
|
## ---------------------------------------------------------------- ##]])
|
|
|
|
|
|
## ---------------------------------------------- ##
|
|
## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ##
|
|
## ---------------------------------------------- ##
|
|
|
|
AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])
|
|
|
|
AT_DATA(configure.ac,
|
|
[[AC_INIT
|
|
rm -rf header file link command
|
|
touch header.in file.in link.in command.in
|
|
case $what_to_test in
|
|
header) AC_CONFIG_HEADERS(header:header.in);;
|
|
file) AC_CONFIG_FILES(file:file.in);;
|
|
command) AC_CONFIG_COMMANDS(command:command.in, [cp command.in command]);;
|
|
link) AC_CONFIG_LINKS(link:link.in);;
|
|
esac
|
|
AC_OUTPUT
|
|
]])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
|
|
# Create a header
|
|
AT_CHECK_CONFIGURE([what_to_test=header])
|
|
AT_CHECK([ls header file command link 2>/dev/null], [ignore], [header
|
|
])
|
|
|
|
# Create a file
|
|
AT_CHECK_CONFIGURE([what_to_test=file])
|
|
AT_CHECK([ls header file command link 2>/dev/null], [ignore], [file
|
|
])
|
|
|
|
# Execute a command
|
|
AT_CHECK_CONFIGURE([what_to_test=command])
|
|
AT_CHECK([ls header file command link 2>/dev/null], [ignore], [command
|
|
])
|
|
|
|
# Create a link
|
|
AT_CHECK_CONFIGURE([what_to_test=link])
|
|
AT_CHECK([ls header file command link 2>/dev/null], [ignore], [link
|
|
])
|
|
|
|
AT_CLEANUP(header file link command header.in file.in link.in command.in)
|
|
|
|
|
|
|
|
## ------------------- ##
|
|
## 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(configure config.status config.log config.cache)
|
|
|
|
|
|
|
|
## -------------------------------------------- ##
|
|
## 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)
|
|
# 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 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)
|
|
|
|
# Check the value of DEFS. Note the leading space.
|
|
AT_DATA([expout],
|
|
[[ -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...'.
|
|
|
|
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([Big_Value],
|
|
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
|
|
|
|
m4_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.*.
|
|
m4_define([AT_DUMMY_VAR],
|
|
[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
|
|
|
|
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.
|
|
|
|
|
|
AT_SETUP([Torturing config.status])
|
|
|
|
AT_DATA([dummy.in],
|
|
[m4_for([AT_Count], 1, 100, 1,
|
|
[@AT_DUMMY_VAR(AT_Count)@
|
|
])])
|
|
|
|
AT_DATA(configure.ac,
|
|
[[AC_INIT
|
|
AC_CONFIG_HEADERS(config.h:config.hin)
|
|
AC_CONFIG_FILES(dummy)
|
|
m4_define]([AC_DEFUBST_VALUE], Big_Value)
|
|
dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
|
|
dnl to AC_DUMMY_VAR in Autoconf.
|
|
[m4_define]([AC_DUMMY_VAR],
|
|
m4_changequote({{, }})dnl
|
|
[m4_defn({{AT_DUMMY_VAR}})]dnl
|
|
m4_changequote([, ]))
|
|
m4_for(AT_Count, 1, 100, 1,
|
|
[AC_DEFUBST(AT_Count)
|
|
])
|
|
AC_OUTPUT
|
|
])
|
|
|
|
AT_CHECK_AUTOCONF
|
|
AT_CHECK_AUTOHEADER
|
|
AT_CHECK_CONFIGURE
|
|
|
|
# Checking that AC_DEFINE worked properly.
|
|
AT_DATA(expout,
|
|
[m4_for(AT_Count, 1, 100, 1,
|
|
[
|
|
/* 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, 1,
|
|
[Big_Value
|
|
])])
|
|
|
|
AT_CLEANUP(dummy)
|