37
50
# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)
38
51
# ----------------------------------------------
39
52
# Check that AC_ARG_VAR caches the latest values, diagnoses
40
# inconsistances, and arms config.status.
53
# inconsistencies, and arms config.status.
41
54
m4_define([AT_CHECK_AC_ARG_VAR],
42
55
[rm -f config.cache
46
[precious='$1'; export precious],
48
AT_CHECK_CONFIGURE([--config-cache])
59
[precious='$1'; export precious],
61
AT_CHECK_CONFIGURE([--config-cache -q])
49
62
AT_CHECK([cat file], [], [`$1'
65
# Testing --recheck: 1. have the environment `forget' about PRECIOUS.
67
# 2. Rerun config.status to recreate `file'.
54
68
AT_CHECK([./config.status --recheck], [], [ignore])
55
69
AT_CHECK([./config.status], [], [ignore])
70
# 3. Check that file contains the old value of PRECIOUS.
56
71
AT_CHECK([cat file], [], [`$1'
74
# Second value: we should issue an error here: the value
61
[precious='$2'; export precious],
77
[precious='$2'; export precious],
63
79
AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])
65
81
])# AT_CHECK_AC_ARG_VAR
233
250
AT_CHECK_AUTOCONF
235
252
AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three |
236
sed -n -e 's/^result=//p'], 0,
253
sed -n -e 's/^result=//p'], 0,
239
256
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
243
260
AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"|
244
sed -n -e 's/^result=//p'], 0,
261
sed -n -e 's/^result=//p'], 0,
247
264
AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0,
542
559
AT_KEYWORDS(autoreconf)
544
561
# We use aclocal (via autoreconf).
545
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
547
# Move into a fresh testSubDir. But Autotest is not ready for such
548
# tricks, albeit most useful :( It expects to find its files
549
# (at-setup-line and so on) in the original `.', and it will complain
550
# not to find even one. So just run mkdir as if it were a test. This
551
# will create at-setup-line blah blah, and Autotest will leave us in
554
# FIXME: The more I think about it, the more I am tempted to *always*
555
# have test groups run in a subdir, a` la Automake.
556
AT_CHECK([AS_MKDIR_P([testSubDir])])
562
AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore])
563
# It should understand configure.ac.
564
AT_CHECK([[grep '1.[01234]' stdout && exit 77]], [1], [ignore])
559
566
# The contents of `inner/', and `inner/innermost/'.
560
567
AS_MKDIR_P([inner/innermost])
563
570
# be compatible with Automake 1.4: aclocal (run by autoreconf) would
564
571
# die because it can't find configure.in.
565
572
AT_DATA([inner/configure.in],
566
[AC_INIT(GNU Inner, 1.0)
573
[[AC_INIT(GNU Inner, 1.0)
567
574
AC_CONFIG_SRCDIR([innermost/config.in])
568
575
AC_ARG_VAR([INNER], [an inner variable])
569
AC_SUBST([INNER], "inner")
577
if test "x$INNER" = x; then
570
580
AC_CONFIG_FILES([innermost/config])
574
584
AT_DATA([inner/innermost/config.in],
577
587
top_srcdir=@top_srcdir@
580
591
# The contents of `.'
583
594
# nonexistent is allowed not to exist.
584
595
AT_DATA([configure.in],
585
[AC_INIT(GNU Outer, 1.0)
596
[[AC_INIT(GNU Outer, 1.0)
586
597
AC_ARG_VAR([OUTER], [an outer variable])
588
599
AC_CONFIG_SUBDIRS([nonexistent])
590
601
AC_CONFIG_SUBDIRS([inner])
594
AT_CHECK([autoreconf])
605
# If there are improperly quoted AC_DEFUN installed in share/aclocal,
606
# they trigger warnings from aclocal 1.8, so ignore stderr.
607
AT_CHECK([autoreconf], [], [], [ignore])
595
608
AT_CHECK([test -f inner/configure])
597
610
# Running the outer configure recursively should provide the innermost
614
628
srcdir=../../../inner/innermost
615
629
top_srcdir=../../../inner
633
# Make sure precious variables and command line options are properly
634
# passed, even when there are duplicates. Run another directory so
635
# that if the user has set config.site to have a config.cache, then
636
# the two runs don't have colliding caches.
637
AS_MKDIR_P([builddir2])
638
AT_CHECK([cd builddir2 && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore])
639
AT_CHECK([cat builddir2/inner/innermost/config], 0,
641
srcdir=../../../inner/innermost
642
top_srcdir=../../../inner
654
AT_SETUP([Deep Package])
655
AT_KEYWORDS(autoreconf)
657
# We use aclocal (via autoreconf).
658
AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore])
660
# The contents of `.'
661
AT_DATA([install-sh], [])
662
AT_DATA([configure.in],
663
[[AC_INIT(GNU Outer, 1.0)
664
AC_ARG_VAR([OUTER], [an outer variable])
665
AC_CONFIG_SUBDIRS([inner])
669
# The contents of `inner/', and `inner/innermost/'.
670
AS_MKDIR_P([inner/innermost])
672
AT_DATA([inner/configure.ac],
673
[[AC_INIT(GNU Inner, 1.0)
674
AC_ARG_VAR([INNER], [an inner variable])
675
AC_CONFIG_SUBDIRS(innermost)
679
AT_DATA([inner/innermost/configure.ac],
680
[[AC_INIT(GNU Innermost, 1.0)
681
AC_ARG_VAR([INNERMOST], [an innermost variable])
682
AC_CONFIG_HEADERS(config.h:config.hin)
683
AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable])
687
AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore])
688
AT_CHECK([test -f inner/configure])
689
AT_CHECK([test -f inner/innermost/configure])
690
AT_CHECK([test -f inner/innermost/config.hin])
692
# Running the outer configure recursively should provide the innermost
694
AT_CHECK([./configure --help=recursive | grep " INNER "], 0, [ignore])
695
AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore])
697
# Running the outer configure should trigger the inner.
698
AT_CHECK_CONFIGURE([INNERMOST=tsomrenni])
699
AT_CHECK([grep INNERMOST inner/innermost/config.h], 0,
700
[[#define INNERMOST tsomrenni
703
# The same, but from a builddir.
704
AS_MKDIR_P([builddir])
705
AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore])
706
AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0,
707
[[#define INNERMOST build/tsomrenni