1# -*- Autotest -*- 2 3# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software 4# Foundation, Inc. 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 2, or (at your option) 9# any later version. 10# 11# This program is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU General Public License for more details. 15# 16# You should have received a copy of the GNU General Public License 17# along with this program; if not, write to the Free Software 18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19# 02110-1301, USA. 20 21 22AT_BANNER([[Testing config.status.]]) 23 24 25## ---------------------------------------- ## 26## AC_CONFIG_COMMANDS with empty commands. ## 27## ---------------------------------------- ## 28 29AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands], 30[[AC_CONFIG_COMMANDS([foo], [], [:]) 31]]) 32 33 34## -------------------------- ## 35## Multiple AC_CONFIG_FILES. ## 36## -------------------------- ## 37 38AT_SETUP([Multiple AC_CONFIG_FILES]) 39 40AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]]) 41AT_CHECK_AUTOCONF([], 1, [], [ignore]) 42 43AT_CLEANUP 44 45 46 47## ------------ ## 48## AC_ARG_VAR. ## 49## ------------ ## 50 51# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE) 52# ---------------------------------------------- 53# Check that AC_ARG_VAR caches the latest values, diagnoses 54# inconsistencies, and arms config.status. 55m4_define([AT_CHECK_AC_ARG_VAR], 56[rm -f config.cache 57 58# Initial value. 59m4_ifval([$1], 60 [precious='m4_bpatsubst($1, [[']], ['\\''])'; export precious], 61 [unset precious]) 62AT_CHECK_CONFIGURE([--config-cache -q]) 63AT_CHECK([cat file], [], [`$1' 64]) 65 66# Testing --recheck: 1. have the environment `forget' about PRECIOUS. 67unset precious 68# 2. Rerun config.status to recreate `file'. 69AT_CHECK([./config.status --recheck], [], [ignore]) 70AT_CHECK([./config.status], [], [ignore]) 71# 3. Check that file contains the old value of PRECIOUS. 72AT_CHECK([cat file], [], [`$1' 73]) 74 75# Second value: we should issue an error here: the value 76# has changed! 77m4_ifval([$2], 78 [precious='$2'; export precious], 79 [unset precious]) 80AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore]) 81 82])# AT_CHECK_AC_ARG_VAR 83 84 85AT_SETUP([AC_ARG_VAR]) 86 87# We don't want to run this test if this shell doesn't support 88# `unset'. 89AT_CHECK([ 90if (FOO=FOO; unset FOO) >/dev/null 2>&1; then 91 exit 0 92else 93 exit 77 94fi 95]) 96 97AT_DATA([configure.ac], 98[[AC_INIT 99AC_ARG_VAR([precious], [this variable costs a lot]) 100echo "precious:$precious" 101AC_OUTPUT(file) 102]]) 103 104AT_DATA([file.in], 105[[`@precious@' 106]]) 107 108AT_CHECK_AUTOCONF 109 110# Set a precious variable 111AT_CHECK_AC_ARG_VAR([], [apple of my eye]) 112 113# Unset a precious variable 114AT_CHECK_AC_ARG_VAR([apple of my eye], []) 115 116# Change a precious variable 117AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye]) 118 119# Change a precious variable that contains braces 120AT_CHECK_AC_ARG_VAR([apple of my {eye}], [orange of my eye]) 121 122# Change a precious variable that contains all kinds of fun 123AT_CHECK_AC_ARG_VAR(['p r ec"iou$], [orange of my eye]) 124 125AT_CLEANUP 126 127 128 129 130## ---------------------------------------------- ## 131## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ## 132## ---------------------------------------------- ## 133 134AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]) 135 136AT_DATA([configure.ac], 137[[AC_INIT 138rm -f -r header var-header file var-file link var-link command var-command 139echo 'OK' >input 140 141# Be sure to also stress the associated INIT-CMDS. 142case $what_to_test in 143 header) 144 AC_CONFIG_HEADERS(header:input);; 145 var-header) 146 AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);; 147 148 file) 149 AC_CONFIG_FILES(file:input);; 150 var-file) 151 AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);; 152 153 command) 154 AC_CONFIG_COMMANDS(command, 155 [cp input command]);; 156 var-command) 157 AC_CONFIG_COMMANDS(var-command, 158 [cp $command_in var-command], [command_in=input]);; 159 160 link) 161 AC_CONFIG_LINKS(link:input);; 162 var-link) 163 AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);; 164esac 165AC_OUTPUT 166]]) 167 168AT_CHECK_AUTOCONF 169 170 171# AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command)) 172# ------------------------------------------------------------------ 173# Check that THING and var-THING (which uses variables in AC_CONFIG_THING) 174# are properly created, with the right content. 175# Use `grep OK' instead of a simple `cat' to avoid banners such as in 176# AC_CONFIG_HEADERS. 177m4_define([AT_CHECK_CONFIG_CREATION], 178[AT_CHECK_CONFIGURE([what_to_test=$1]) 179AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null], 180 [ignore], [$1 181]) 182AT_CHECK([grep OK $1], [], [OK 183]) 184 185AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create]) 186# config.status might be stupidly expecting data on stdin, if it's 187# really broken... 188AT_CHECK([./config.status var-$1 </dev/null], [], [ignore]) 189AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null], 190 [ignore], [var-$1 191]) 192AT_CHECK([grep OK var-$1], [], [OK 193]) 194])# AT_CHECK_CONFIG_CREATION 195 196 197# Create a file 198AT_CHECK_CONFIG_CREATION(file) 199 200# Create a header 201AT_CHECK_CONFIG_CREATION(header) 202 203# Execute a command 204AT_CHECK_CONFIG_CREATION(command) 205 206# Create a link 207AT_CHECK_CONFIG_CREATION(link) 208 209AT_CLEANUP 210 211 212 213## ---------------------------------------- ## 214## Macro calls in AC_CONFIG_COMMANDS tags. ## 215## ---------------------------------------- ## 216 217AT_SETUP([Macro calls in AC_CONFIG_COMMANDS tags]) 218 219AT_DATA_M4SUGAR([configure.ac], 220[[AC_INIT 221AC_CONFIG_COMMANDS([m4_if(1,1,mytag)]) 222AC_OUTPUT 223]]) 224 225AT_CHECK_AUTOCONF 226AT_CHECK_CONFIGURE 227 228AT_CLEANUP 229 230 231 232## ------------------- ## 233## Missing templates. ## 234## ------------------- ## 235 236# Check that config.status detects missing input files 237AT_SETUP([Missing templates]) 238 239AT_DATA([configure.ac], 240[[AC_INIT 241AC_CONFIG_FILES([nonexistent]) 242AC_OUTPUT 243]]) 244 245AT_CHECK_AUTOCONF 246AT_CHECK_CONFIGURE([], [1], [], 247[[config.status: error: cannot find input file: nonexistent.in 248]]) 249# Make sure that the output file doesn't exist 250AT_CHECK([test -f nonexistent], 1) 251 252AT_CLEANUP 253 254 255 256 257## ---------------------- ## 258## configure invocation. ## 259## ---------------------- ## 260 261# Check that `configure' and `config.status' honor their interface. 262# 263# We run `./configure one=val1 --enable-two=val2 --with-three=val3' 264# and verify that (i) `configure' correctly receives the arguments, 265# (ii) correctly passes them to `config.status', which we check by 266# running `config.status --recheck', and (iii) correctly passes them 267# to sub-configure scripts. 268 269AT_SETUP([configure invocation]) 270 271mkdir sub 272 273AT_DATA([configure.ac], 274[[AC_INIT 275AC_CONFIG_SUBDIRS([sub]) 276echo "result=$one$enable_two$with_three" 277AC_OUTPUT 278]]) 279 280AT_DATA([sub/configure.ac], 281[[AC_INIT 282echo "result=$one$enable_two$with_three" 283AC_OUTPUT 284]]) 285 286echo fake install-sh script >install-sh 287 288AT_CHECK_AUTOCONF 289cd sub 290AT_CHECK_AUTOCONF 291cd .. 292 293AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three | 294 sed -n -e 's/^result=//p'], 0, 295 [m4_do([onetwothree 296], [onetwothree 297])]) 298AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0, 299 [onetwothree 300]) 301 302AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"| 303 sed -n -e 's/^result=//p'], 0, 304 [m4_do(["'$ " ' $ "'$ 305], ["'$ " ' $ "'$ 306])]) 307AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0, 308 ["'$ " ' $ "'$ 309]) 310 311AT_CLEANUP 312 313 314 315## -------------------------------------------- ## 316## Check that `#define' templates are honored. ## 317## -------------------------------------------- ## 318 319# Use various forms of `#define' templates, and make sure there are no 320# problems when a symbol is prefix of another. 321 322AT_SETUP([[#define header templates]]) 323 324AT_DATA([configure.ac], 325[[AC_INIT 326AC_CONFIG_HEADERS(config.h:config.hin) 327 328# I18n of dummy variables: their French translations. 329AC_DEFINE(foo, toto) 330AC_DEFINE(bar, tata) 331AC_DEFINE(baz, titi) 332AC_DEFINE(fubar, tutu) 333 334# Symbols which are prefixes of another. 335AC_DEFINE(a, A) 336AC_DEFINE(aaa, AAA) 337AC_DEFINE(aa, AA) 338AC_CONFIG_FILES(defs) 339 340# Things included in confdefs.h, but which make no sense in 341# config.h, nor in $DEFS. 342cat <<\EOF >>confdefs.h 343/* Hi Mum! Look, I am doing C++! */ 344#ifdef __cplusplus 345void exit (int status); 346#endif 347EOF 348 349# In addition of config.h output a full DEFS 350AC_OUTPUT_MAKE_DEFS 351DEFS_SAVED=$DEFS 352AC_SUBST(DEFS_SAVED) 353AC_OUTPUT 354]]) 355 356AT_DATA([defs.in], 357[[@DEFS_SAVED@ 358]]) 359 360AT_DATA([config.hin], 361[[#define foo 0 362# define bar bar 363# define baz "Archimedes was sinking in his baz" 364# define fubar tutu 365#define a B 366#define aa BB 367#define aaa BBB 368#undef a 369#undef aa 370#undef aaa 371]]) 372 373AT_CHECK_AUTOCONF 374AT_CHECK_CONFIGURE 375 376AT_DATA([expout], 377[[/* config.h. Generated from config.hin by configure. */ 378#define foo toto 379# define bar tata 380# define baz titi 381# define fubar tutu 382#define a A 383#define aa AA 384#define aaa AAA 385#define a A 386#define aa AA 387#define aaa AAA 388]]) 389AT_CHECK([cat config.h], 0, expout) 390 391# Check the value of DEFS. 392AT_DATA([expout], 393[[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA 394]]) 395 396# Because we strip trailing spaces in `testsuite' we can't leave one in 397# expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS. 398AT_CHECK([sed -e 's/ $//' defs], 0, expout) 399 400AT_CLEANUP 401 402 403 404## ------------------------- ## 405## Torturing config.status. ## 406## ------------------------- ## 407 408## Require 100 AC_DEFINE and AC_SUBST and AC_SUBST_FILE with a significantly 409## big value. This is mostly to check that Autoconf produces portable sed 410## scripts in config.status. sed is used to skip the first two lines 411## `Generated by...'. 412 413# We use m4_for many times. 414m4_pattern_allow([^m4_for$]) 415 416AT_SETUP([Torturing config.status]) 417 418dnl The value used as a big value for AC_DEFINE. 419dnl Don't use sh active chars here, below it is also used in a sh 420dnl assignment. 421m4_define([AT_BIG_VALUE], 422[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.]) 423 424m4_define([AT_DESCRIPTION], 425[Define to a long string if your `Autoconf' works properly.]) 426 427 428# AT_DUMMY_VAR(NUMBER) 429# -------------------- 430# Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it 431# so that the check for user name space invasion does not complain 432# of the new variables defined. 433# 434# Note that you should not use the name ac_dummy, because it will be 435# turned into ac_uummy during the construction of config.status. Yes, 436# this is admittedly a bug, but it would be too hard to fix this. 437# There is really no point in AC_DEFINE a var named ac_d.*. 438m4_pattern_allow([^m4_bpatsubst$]) 439m4_define([AT_DUMMY_VAR], 440[ac_Dummy_[]m4_bpatsubst([000$1], [.*\(...\)$], [\1])]) 441 442 443 444AT_DATA([dummy.in], 445[m4_for([AT_Count], 1, 100, 1, 446[@AT_DUMMY_VAR(AT_Count)@ 447@[f]AT_Count@ 448])]) 449 450 451i=1 452while test $i != 101; do 453 echo "content of file $i" > file_$i 454 i=`expr $i + 1` 455done 456 457 458# ------------ # 459# configure.ac # 460# ------------ # 461 462m4_pattern_allow([^m4_(define|defun)$]) 463AT_DATA([configure.ac], 464dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and 465dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc. 466[[m4_define([AC_DUMMY_VAR],] 467m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]] 468 469[[m4_define([AC_DESCRIPTION],] 470m4_dquote(m4_defn([AT_DESCRIPTION]))[)]] 471 472[[m4_define([AC_BIG_VALUE],] 473m4_dquote(m4_defn([AT_BIG_VALUE]))[)]] 474 475[[# AC_DEFUBST(NAME) 476# ---------------- 477# Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is 478# used in the torture tests. 479m4_defun([AC_DEFUBST], 480[AC_DUMMY_VAR($1)="AC_BIG_VALUE" 481AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)", 482 AC_DESCRIPTION) 483AC_SUBST(AC_DUMMY_VAR($1)) 484AC_SUBST_FILE([f]$1) 485f$1=file_$1 486]) 487 488AC_INIT 489AC_CONFIG_HEADERS(config.h:config.hin) 490AC_CONFIG_FILES(dummy) 491m4_for(AC_Count, 1, 100, 1, 492 [AC_DEFUBST(AC_Count)]) 493AC_OUTPUT 494]])# configure.ac 495 496AT_CHECK_AUTOCONF 497AT_CHECK_AUTOHEADER 498AT_CHECK_CONFIGURE 499 500# Checking that AC_DEFINE worked properly. 501AT_DATA([expout], 502[/* Define to the address where bug reports for this package should be sent. */ 503#define PACKAGE_BUGREPORT "" 504 505/* Define to the full name of this package. */ 506#define PACKAGE_NAME "" 507 508/* Define to the full name and version of this package. */ 509#define PACKAGE_STRING "" 510 511/* Define to the one symbol short name of this package. */ 512#define PACKAGE_TARNAME "" 513 514/* Define to the version of this package. */ 515#define PACKAGE_VERSION "" 516m4_for(AT_Count, 1, 100, 1, 517[ 518/* AT_DESCRIPTION */ 519[#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE" 520])]) 521AT_CHECK([sed -n '4,$ p' config.h], 0, expout) 522 523# Checking that AC_SUBST worked properly. 524AT_DATA([expout], 525[m4_for(AT_Count, 1, 100, 1, 526[AT_BIG_VALUE 527content of file AT_Count 528])]) 529 530AT_CHECK([cat dummy], 0, expout) 531 532AT_CLEANUP 533 534 535## ------------------------------- ## 536## Substitute a 2000-byte string. ## 537## ------------------------------- ## 538 539# Solaris 9 /usr/ucb/sed that rejects commands longer than 4000 bytes. HP/UX 540# sed dumps core around 8 KiB. However, POSIX says that sed need not 541# handle lines longer than 2048 bytes (including the trailing newline). 542# So we'll just test a 2000-byte value. 543 544AT_SETUP([Substitute a 2000-byte string]) 545 546AT_DATA([Foo.in], [@foo@ 547]) 548 549AT_DATA([configure.ac], 550[[AC_INIT 551AC_CONFIG_AUX_DIR($top_srcdir/build-aux) 552AC_SUBST([foo], ]m4_for([n], 1, 100,, ....................)[) 553AC_CONFIG_FILES([Foo]) 554AC_OUTPUT 555]]) 556 557AT_CHECK_AUTOCONF 558AT_CHECK_CONFIGURE 559AT_CHECK([cat Foo], 0, m4_for([n], 1, 100,, ....................) 560) 561AT_CLEANUP 562 563 564## ------------------------------ ## 565## Define to a 2000-byte string. ## 566## ------------------------------ ## 567 568AT_SETUP([Define to a 2000-byte string]) 569 570AT_CONFIGURE_AC( 571[[ 572AC_DEFINE([foo], ]m4_for([n], 1, 100,, ....................)[, [desc]) 573]]) 574 575AT_CHECK_AUTOCONF 576AT_CHECK_AUTOHEADER 577AT_CHECK_CONFIGURE 578AT_CHECK_DEFINES([@%:@define foo m4_for([n], 1, 100,, ....................) 579]) 580AT_CLEANUP 581 582 583## ------------------------------------------ ## 584## Substitute and define special characters. ## 585## ------------------------------------------ ## 586 587# Use characters special to the shell, sed, and M4. 588 589AT_SETUP([Substitute and define special characters]) 590 591AT_DATA([Foo.in], [@foo@ 592]) 593 594AT_CONFIGURE_AC( 595[[foo="AS@&t@_ESCAPE([[X*'[]+ ", `\($foo]])" 596AC_SUBST([foo]) 597AC_DEFINE([foo], [[X*'[]+ ", `\($foo]], [Awful value.]) 598AC_CONFIG_FILES([Foo])]]) 599 600AT_CHECK_AUTOCONF 601AT_CHECK_AUTOHEADER 602AT_CHECK_CONFIGURE 603AT_CHECK([cat Foo], 0, [[X*'[]+ ", `\($foo 604]]) 605AT_CHECK_DEFINES([[#define foo X*'[]+ ", `\($foo 606]]) 607AT_CLEANUP 608 609 610## ---------------------- ## 611## Substitute a newline. ## 612## ---------------------- ## 613 614AT_SETUP([Substitute a newline]) 615 616AT_DATA([Foo.in], 617[@foo@ 618]) 619 620AT_DATA([configure.ac], 621[[AC_INIT 622AC_CONFIG_AUX_DIR($top_srcdir/build-aux) 623foo='one 624two' 625AC_SUBST([foo]) 626AC_CONFIG_FILES([Foo]) 627AC_OUTPUT 628]]) 629 630AT_CHECK_AUTOCONF 631AT_CHECK_CONFIGURE 632AT_CHECK([cat Foo], 0, [one 633two 634]) 635AT_CLEANUP 636 637 638## ------------------ ## 639## Define a newline. ## 640## ------------------ ## 641 642AT_SETUP([Define a newline]) 643AT_XFAIL_IF(:) 644AT_CONFIGURE_AC([[AC_DEFINE([foo], [one 645two], [This spans two lines.]) 646]]) 647AT_CHECK_AUTOCONF 648AT_CHECK_AUTOHEADER 649AT_CHECK_CONFIGURE 650AT_CHECK_DEFINES([[#define foo one 651two 652]]) 653AT_CLEANUP 654 655 656## ------------------------ ## 657## datarootdir workaround. ## 658## ------------------------ ## 659 660AT_SETUP([datarootdir workaround]) 661 662AT_DATA([Foo.in], 663[@datadir@ 664@docdir@ 665@infodir@ 666@localedir@ 667@mandir@ 668]) 669 670AT_DATA([Bar.in], 671[@mydatadir@ 672]) 673 674AT_DATA([configure.ac], 675[[AC_INIT 676d@&t@nl The following line silences the warnings, if uncommented: 677d@&t@nl AC_DEFUN([AC_DATAROOTDIR_CHECKED]) 678AC_CONFIG_AUX_DIR($top_srcdir/build-aux) 679 680# This substitution is wrong and bogus! Don't use it in your own code! 681# Read `info Autoconf "Defining Directories"'! 682AC_SUBST([mydatadir], [${datadir}/my]) 683 684AC_CONFIG_FILES([Foo Bar]) 685AC_OUTPUT 686]]) 687 688AT_CHECK_AUTOCONF 689AT_CHECK_CONFIGURE([], [], [], 690 [config.status: WARNING: Foo.in seems to ignore the --datarootdir setting 691config.status: WARNING: Bar contains a reference to the variable `datarootdir' 692which seems to be undefined. Please make sure it is defined. 693]) 694AT_CHECK([grep datarootdir Foo], 1, []) 695 696rm configure 697sed '/AC_DEFUN/s/^d@&t@nl //' configure.ac >t 698mv t configure.ac 699 700AT_CHECK_AUTOCONF 701AT_CHECK_CONFIGURE 702 703AT_CLEANUP 704 705 706## -------- ## 707## srcdir. ## 708## -------- ## 709 710AT_SETUP([srcdir]) 711 712rm -f -r at-dir 713mkdir at-dir 714: >at-dir/bar.in 715: >foo.in 716 717AT_DATA([configure.ac], 718[[AC_INIT 719 720AC_CONFIG_FILES([foo at-dir/bar]) 721 722AC_CONFIG_COMMANDS([report], 723[test -f $srcdir/configure.ac || 724 AC_MSG_ERROR([cannot find $srcdir/configure.ac])], 725 [srcdir=$srcdir]) 726 727AC_OUTPUT 728rm -f -r foo at-dir/bar 729]]) 730 731AT_CHECK_AUTOCONF 732 733# In place. 734AT_CHECK([./configure], [], [ignore]) 735 736# Relative name. 737AT_CHECK([cd at-dir && ../configure], [], [ignore]) 738 739# Absolute name. 740at_here=`pwd` 741AT_CHECK([cd at-dir && "$at_here/configure"], [], [ignore]) 742 743AT_CLEANUP 744 745 746## ----------------- ## 747## Signal handling. ## 748## ----------------- ## 749 750AT_SETUP([Signal handling]) 751 752AT_DATA([configure.ac], 753[[AC_INIT 754kill -2 $$ 755exit 77 756]]) 757 758AT_CHECK_AUTOCONF 759AT_CHECK_CONFIGURE([], 1, ignore, ignore) 760 761AT_CLEANUP 762 763 764 765AT_BANNER([autoreconf.]) 766 767## ---------------------------- ## 768## Configuring subdirectories. ## 769## ---------------------------- ## 770 771# . 772# |-- builddir 773# | |-- config.log 774# | |-- config.status 775# | `-- inner 776# | |-- config.log 777# | |-- config.status 778# | `-- innermost 779# | `-- config 780# |-- configure 781# |-- configure.ac 782# |-- inner 783# | |-- configure 784# | |-- configure.ac 785# | `-- innermost 786# | `-- config.in 787# `-- install-sh 788# 789AT_SETUP([Configuring subdirectories]) 790AT_KEYWORDS(autoreconf) 791 792# We use aclocal (via autoreconf). 793AT_CHECK([aclocal --version || exit 77], [], [stdout], [ignore]) 794# It should understand configure.ac. 795AT_CHECK([[grep '[^0-9]1.[01234][^0-9]' stdout && exit 77]], [1], [ignore]) 796 797# Set CONFIG_SITE to a nonexistent file, so that there are 798# no worries about nonstandard values for 'prefix'. 799CONFIG_SITE=no-such-file 800export CONFIG_SITE 801 802# The contents of `inner/', and `inner/innermost/'. 803AS_MKDIR_P([inner/innermost]) 804 805# We have to use configure.in, not configure.ac, if we still want to 806# be compatible with Automake 1.4: aclocal (run by autoreconf) would 807# die because it can't find configure.in. 808AT_DATA([inner/configure.in], 809[[AC_INIT(GNU Inner, 1.0) 810AC_CONFIG_SRCDIR([innermost/config.in]) 811AC_ARG_VAR([INNER], [an inner variable]) 812AC_SUBST([INNER]) 813if test "x$INNER" = x; then 814 INNER=inner 815fi 816AC_CONFIG_FILES([innermost/config]) 817AC_OUTPUT 818]]) 819 820AT_DATA([inner/innermost/config.in], 821[INNER=@INNER@ 822srcdir=@srcdir@ 823top_srcdir=@top_srcdir@ 824prefix=@prefix@ 825]) 826 827# The contents of `.' 828AT_DATA([install-sh], []) 829 830# nonexistent is allowed not to exist. 831AT_DATA([configure.in], 832[[AC_INIT(GNU Outer, 1.0) 833AC_ARG_VAR([OUTER], [an outer variable]) 834if false; then 835 AC_CONFIG_SUBDIRS([nonexistent]) 836fi 837AC_CONFIG_SUBDIRS([inner]) 838AC_OUTPUT 839]]) 840 841# If there are improperly quoted AC_DEFUN installed in share/aclocal, 842# they trigger warnings from aclocal 1.8, so ignore stderr. 843AT_CHECK([autoreconf], [], [], [ignore]) 844AT_CHECK([test -f inner/configure]) 845 846# Running the outer configure recursively should provide the innermost 847# help strings. 848AT_CHECK([./configure --help=recursive | grep INNER], 0, [ignore]) 849 850# Running the outer configure should trigger the inner. 851AT_CHECK_CONFIGURE 852AT_CHECK([cat inner/innermost/config], 0, 853[INNER=inner 854srcdir=. 855top_srcdir=.. 856prefix=/usr/local 857]) 858 859# The same, but from a builddir. 860AS_MKDIR_P([builddir]) 861AT_CHECK([cd builddir && ../configure], 0, [ignore]) 862AT_CHECK([cat builddir/inner/innermost/config], 0, 863[INNER=inner 864srcdir=../../../inner/innermost 865top_srcdir=../../../inner 866prefix=/usr/local 867]) 868 869# Make sure precious variables and command line options are properly 870# passed, even when there are duplicates. 871AT_CHECK([cd builddir && ../configure --prefix /bad --prefix /good INNER=bad INNER=good], 0, [ignore]) 872AT_CHECK([cat builddir/inner/innermost/config], 0, 873[INNER=good 874srcdir=../../../inner/innermost 875top_srcdir=../../../inner 876prefix=/good 877]) 878 879# Make sure --prefix is properly quoted 880AT_CHECK([cd builddir && ../configure --prefix "/a b c$ 'd"], 0, [ignore]) 881AT_CHECK([cat builddir/inner/innermost/config], 0, 882[INNER=inner 883srcdir=../../../inner/innermost 884top_srcdir=../../../inner 885prefix=/a b c$ 'd 886]) 887 888# Make sure --silent is properly passed... 889AT_CHECK([cd builddir && ../configure --silent], 0, []) 890# ...but not stored in config.status. 891AT_CHECK([cd builddir && ./config.status --recheck], 0, [stdout]) 892AT_CHECK([grep 'creating \./config.status' stdout], 0, [ignore]) 893 894# Make sure we can run autoreconf on a subdirectory 895rm -f configure configure.in 896AT_CHECK([autoreconf inner], [], [], [ignore]) 897 898# Make sure we can pass a configure.ac name 899AT_CHECK([cd inner && autoreconf configure.in], [], [], [ignore]) 900AT_CHECK([autoreconf inner/configure.in], [], [], [ignore]) 901 902AT_CLEANUP 903 904 905 906## -------------- ## 907## Deep Package. ## 908## -------------- ## 909 910AT_SETUP([Deep Package]) 911AT_KEYWORDS(autoreconf) 912 913# We use aclocal (via autoreconf). 914AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) 915 916# The contents of `.' 917AT_DATA([install-sh], []) 918AT_DATA([configure.in], 919[[AC_INIT(GNU Outer, 1.0) 920AC_ARG_VAR([OUTER], [an outer variable]) 921AC_CONFIG_SUBDIRS([inner]) 922AC_OUTPUT 923]]) 924 925# The contents of `inner/', and `inner/innermost/'. 926AS_MKDIR_P([inner/innermost]) 927 928AT_DATA([inner/configure.in], 929[[AC_INIT(GNU Inner, 1.0) 930AC_ARG_VAR([INNER], [an inner variable]) 931AC_CONFIG_SUBDIRS(innermost) 932AC_OUTPUT 933]]) 934 935AT_DATA([inner/innermost/configure.in], 936[[AC_INIT(GNU Innermost, 1.0) 937AC_ARG_VAR([INNERMOST], [an innermost variable]) 938AC_CONFIG_HEADERS(config.h:config.hin) 939AC_DEFINE_UNQUOTED([INNERMOST], [$INNERMOST], [an innermost variable]) 940AC_OUTPUT 941]]) 942 943AT_CHECK([autoreconf -Wall -v], [0], [ignore], [ignore]) 944AT_CHECK([test -f inner/configure]) 945AT_CHECK([test -f inner/innermost/configure]) 946AT_CHECK([test -f inner/innermost/config.hin]) 947 948# Running the outer configure recursively should provide the innermost 949# help strings. 950AT_CHECK([./configure --help=recursive | grep " INNER "], 0, [ignore]) 951AT_CHECK([./configure --help=recursive | grep " INNERMOST "], 0, [ignore]) 952 953# Running the outer configure should trigger the inner. 954AT_CHECK_CONFIGURE([INNERMOST=tsomrenni]) 955AT_CHECK([grep INNERMOST inner/innermost/config.h], 0, 956[[#define INNERMOST tsomrenni 957]]) 958 959# The same, but from a builddir. 960AS_MKDIR_P([builddir]) 961AT_CHECK([cd builddir && ../configure INNERMOST=build/tsomrenni], 0, [ignore]) 962AT_CHECK([grep INNERMOST builddir/inner/innermost/config.h], 0, 963[[#define INNERMOST build/tsomrenni 964]]) 965 966AT_CLEANUP 967 968 969 970## -------------------------------- ## 971## Non-Autoconf AC_CONFIG_SUBDIRS. ## 972## -------------------------------- ## 973 974AT_SETUP([Non-Autoconf AC_CONFIG_SUBDIRS]) 975AT_KEYWORDS([autoreconf]) 976 977# We use aclocal (via autoreconf). 978AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) 979 980AT_DATA([install-sh], []) 981AT_DATA([configure.in], 982[[AC_INIT(GNU Outer, 1.0) 983AC_CONFIG_SUBDIRS([inner]) 984AC_OUTPUT 985]]) 986 987AS_MKDIR_P([inner]) 988 989AT_DATA([inner/configure], 990[[#! /bin/sh 991case "$*" in 992 *--help*) echo 'No Autoconf here, folks!' ;; 993 *) echo got_it >myfile ;; 994esac 995exit 0 996]]) 997chmod +x inner/configure 998 999AT_CHECK([autoreconf -Wall -v], 0, [ignore], [ignore]) 1000 1001# Running the outer configure recursively should provide the innermost 1002# help strings. 1003AT_CHECK([./configure --help=recursive | grep "folks"], 0, [ignore]) 1004 1005# Running the outer configure should trigger the inner. 1006AT_CHECK([./configure], 0, [ignore]) 1007AT_CHECK([test -f inner/myfile], 0) 1008 1009AT_CLEANUP 1010 1011 1012 1013## ----------------- ## 1014## Empty directory. ## 1015## ----------------- ## 1016 1017AT_SETUP([Empty directory]) 1018AT_KEYWORDS([autoreconf]) 1019 1020# We use aclocal (via autoreconf). 1021AT_CHECK([aclocal --version || exit 77], [], [ignore], [ignore]) 1022 1023# The test group directory is not necessarily _empty_, but it does not contain 1024# files meaningful to `autoreconf'. 1025 1026AT_CHECK([autoreconf -Wall -v], 1, [ignore], [ignore]) 1027 1028AT_CLEANUP 1029 1030 1031 1032## ------------------------------ ## 1033## Unusual Automake input files. ## 1034## ------------------------------ ## 1035 1036# This parallels gnumake.test in Automake. 1037 1038AT_SETUP([Unusual Automake input files]) 1039AT_KEYWORDS([autoreconf]) 1040 1041# We use aclocal and automake via autoreconf. 1042AT_CHECK([automake --version || exit 77], [], [ignore], [ignore]) 1043 1044AT_DATA([configure.in], 1045[[AC_INIT(GNU foo, 1.0) 1046AM_INIT_AUTOMAKE 1047AC_CONFIG_FILES([HeeHee]) 1048AC_OUTPUT 1049]]) 1050 1051AT_DATA([HeeHee.am], 1052[[# Humans do no worse than `GNUmakefile.am'. 1053AUTOMAKE_OPTIONS = foreign 1.8 1054]]) 1055 1056AT_CHECK([autoreconf -Wall -v -i], 0, [ignore], [stderr], 1057 [AT_CHECK([grep 'require.*1\.8' stderr && exit 77], [1])]) 1058AT_CHECK([test -f HeeHee.in]) 1059 1060AT_CLEANUP 1061