📄 torture.at
字号:
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 shdnl 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, anddnl 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_INITAC_CONFIG_HEADERS(config.h:config.hin)AC_CONFIG_FILES(dummy)m4_for(AC_Count, 1, 100, 1, [AC_DEFUBST(AC_Count)])AC_OUTPUT]])# configure.acAT_CHECK_AUTOCONFAT_CHECK_AUTOHEADERAT_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## -------- #### srcdir. #### -------- ##AT_SETUP([srcdir])rm -rf at-dirmkdir at-dir: >at-dir/bar.in: >foo.inAT_DATA([configure.ac],[[AC_INITAC_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_OUTPUTrm -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## ----------------- #### Signal handling. #### ----------------- ##AT_SETUP([Signal handling])AT_DATA([configure.ac],[[AC_INITkill -2 $$exit 77]])AT_CHECK_AUTOCONFAT_CHECK_CONFIGURE([], 1, ignore, ignore)AT_CLEANUP## ---------------------------- #### 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=innerfiAC_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])fiAC_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_CONFIGUREAT_CHECK([cat inner/innermost/config], 0,[INNER=innersrcdir=.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=innersrcdir=../../../inner/innermosttop_srcdir=../../../innerprefix=/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=goodsrcdir=../../../inner/innermosttop_srcdir=../../../innerprefix=/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.ac],[[AC_INIT(GNU Inner, 1.0)AC_ARG_VAR([INNER], [an inner variable])AC_CONFIG_SUBDIRS(innermost)AC_OUTPUT]])AT_DATA([inner/innermost/configure.ac],[[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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -