From 3dae6da4163c0c1030e4cee8177d855049ca5f8a Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Sun, 29 Jan 2006 17:35:12 +0000 Subject: [PATCH] Append $(EXEEXT) to programs that may be listed in TESTS. Report from Simon Josefsson. * automake.in (%known_programs): New global. (initialize_per_input): Reset it. (append_exeext): Take a predicate as first argument to select the filename to rewrite. (handle_programs): Fill %known_programs. (handle_tests): Append $(EXEEXT) to all tests that are in %known_programs. (am_install_var): Update call to append_exeext. * doc/automake.texi (EXEEXT): TESTS is also rewritten. (Tests): More about the difference between check_PROGRAMS and TESTS. Give an example of TEST_ENVIRONMENT. * tests/cond32.test: Augment with a nested condition. * tests/exeext4.test: Also check TESTS. * tests/check5.test: New file. * tests/Makefile.am (TESTS): Add check5.test. --- ChangeLog | 21 ++ NEWS | 4 + automake.in | 63 +++-- doc/automake.texi | 56 +++-- doc/stamp-vti | 2 +- doc/version.texi | 2 +- tests/Makefile.am | 1 + tests/Makefile.in | 711 ++++++++++------------------------------------------- tests/check5.test | 57 +++++ tests/cond32.test | 17 +- tests/exeext4.test | 34 ++- 11 files changed, 338 insertions(+), 630 deletions(-) create mode 100755 tests/check5.test diff --git a/ChangeLog b/ChangeLog index d2d9c8e..bdb66f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2006-01-29 Alexandre Duret-Lutz + + Append $(EXEEXT) to programs that may be listed in TESTS. + Report from Simon Josefsson. + + * automake.in (%known_programs): New global. + (initialize_per_input): Reset it. + (append_exeext): Take a predicate as first argument to select + the filename to rewrite. + (handle_programs): Fill %known_programs. + (handle_tests): Append $(EXEEXT) to all tests that are in + %known_programs. + (am_install_var): Update call to append_exeext. + * doc/automake.texi (EXEEXT): TESTS is also rewritten. + (Tests): More about the difference between check_PROGRAMS and TESTS. + Give an example of TEST_ENVIRONMENT. + * tests/cond32.test: Augment with a nested condition. + * tests/exeext4.test: Also check TESTS. + * tests/check5.test: New file. + * tests/Makefile.am (TESTS): Add check5.test. + 2006-01-12 Paul Eggert * lib/install-sh (dstdir): Don't use semicolons inside { } in diff --git a/NEWS b/NEWS index fae9944..ae0120c 100644 --- a/NEWS +++ b/NEWS @@ -89,6 +89,10 @@ New in 1.9a: $(LIBOBJS), $(LTLIBOBJS), $(ALLOCA), and $(LTALLOCA) can be used in different directories. + - $(EXEEXT) is automatically appended to filenames of TESTS and + that have been declared as programs in the same Makefile. + This is mostly useful when some check_PROGRAMS are listed in TESTS. + New in 1.9: diff --git a/automake.in b/automake.in index 70175d9..bc285a6 100755 --- a/automake.in +++ b/automake.in @@ -538,6 +538,10 @@ my %dep_files; # This is a list of all targets to run during "make dist". my @dist_targets; +# Keep track of all programs declared in this Makefile, without +# $(EXEEXT). @substitution@ are not listed. +my %known_programs; + # Keys in this hash are the basenames of files which must depend on # ansi2knr. Values are either the empty string, or the directory in # which the ANSI source file appears; the directory must have a @@ -659,6 +663,8 @@ sub initialize_per_input () @dist_targets = (); + %known_programs = (); + %de_ansi_files = (); $all_target = ''; @@ -1482,6 +1488,32 @@ sub handle_languages } } + +# append_exeext { PREDICATE } $MACRO +# ---------------------------------- +# Append $(EXEEXT) to each filename in $F appearing in the Makefile +# variable $MACRO if &PREDICATE($F) is true. @substitutions@ are +# ignored. +# +# This is typically used on all filenames of *_PROGRAMS, and filenames +# of TESTS that are programs. +sub append_exeext (&$) +{ + my ($pred, $macro) = @_; + + transform_variable_recursively + ($macro, $macro, 'am__EXEEXT', 0, INTERNAL, + sub { + my ($subvar, $val, $cond, $full_cond) = @_; + # Append $(EXEEXT) unless the user did it already, or it's a + # @substitution@. + $val .= '$(EXEEXT)' + if $val !~ /(?:\$\(EXEEXT\)$|^[@]\w+[@]$)/ && &$pred ($val); + return $val; + }); +} + + # Check to make sure a source defined in LIBOBJS is not explicitly # mentioned. This is a separate function (as opposed to being inlined # in handle_source_transform) because it isn't always appropriate to @@ -2371,6 +2403,8 @@ sub handle_programs # We'll add $(EXEEXT) back later anyway. $one_file =~ s/\$\(EXEEXT\)$//; + $known_programs{$one_file} = $where; + # Canonicalize names and check for misspellings. my $xname = &check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', '_SOURCES', '_OBJECTS', @@ -4577,6 +4611,9 @@ sub handle_tests { push (@check_tests, 'check-TESTS'); $output_rules .= &file_contents ('check', new Automake::Location); + + # Tests that are known programs should have $(EXEEXT) appended. + append_exeext { exists $known_programs{$_[0]} } 'TESTS'; } } @@ -6660,29 +6697,6 @@ sub file_contents ($$%) } -# &append_exeext ($MACRO) -# ----------------------- -# Macro is an Automake magic macro which primary is PROGRAMS, e.g. -# bin_PROGRAMS. Make sure these programs have $(EXEEXT) appended. -sub append_exeext ($) -{ - my ($macro) = @_; - - prog_error "append_exeext ($macro)" - unless $macro =~ /_PROGRAMS$/; - - transform_variable_recursively - ($macro, $macro, 'am__EXEEXT', 0, INTERNAL, - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - # Append $(EXEEXT) unless the user did it already, or it's a - # @substitution@. - $val .= '$(EXEEXT)' unless $val =~ /(?:\$\(EXEEXT\)$|^[@]\w+[@]$)/; - return $val; - }); -} - - # @PREFIX # &am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES) # ----------------------------------------------------- @@ -6883,7 +6897,7 @@ sub am_install_var } # A blatant hack: we rewrite each _PROGRAMS primary to include # EXEEXT. - append_exeext ($one_name) + append_exeext { 1 } $one_name if $primary eq 'PROGRAMS'; # "EXTRA" shouldn't be used when generating clean targets, # all, or install targets. We used to warn if EXTRA_FOO was @@ -7446,6 +7460,7 @@ sub generate_makefile ($$) handle_subdirs; handle_tags; handle_minor_options; + # Must come after handle_programs so that %known_programs is up-to-date. handle_tests; # This must come after most other rules. diff --git a/doc/automake.texi b/doc/automake.texi index d0451f6..f5732b1 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -5198,6 +5198,11 @@ bin_PROGRAMS = liver$(EXEEXT) The targets Automake generates are likewise given the @samp{$(EXEEXT)} extension. +The variable @code{TESTS} (@pxref{Tests}) is also rewritten if it +contains filenames that have been declared as programs in the same +@file{Makefile}. (This is mostly useful when some programs from +@code{check_PROGRAMS} are listed in @code{TESTS}.) + However, Automake cannot apply this rewriting to @command{configure} substitutions. This means that if you are conditionally building a program using such a substitution, then your @file{configure.ac} must @@ -6681,15 +6686,13 @@ Automake supports two forms of test suites. @section Simple Tests -If the variable @code{TESTS} is defined, its value is taken to be a list -of programs to run in order to do the testing. The programs can either -be derived objects or source objects; the generated rule will look both -in @code{srcdir} and @file{.}. Programs needing data files should look -for them in @code{srcdir} (which is both an environment variable and a -make variable) so they work when building in a separate directory -(@pxref{Build Directories, , Build Directories , autoconf, The Autoconf -Manual}), and in particular for the @code{distcheck} rule -(@pxref{Dist}). +If the variable @code{TESTS} is defined, its value is taken to be a +list of programs or scripts to run in order to do the testing. +Programs needing data files should look for them in @code{srcdir} +(which is both an environment variable and a make variable) so they +work when building in a separate directory (@pxref{Build Directories, +, Build Directories , autoconf, The Autoconf Manual}), and in +particular for the @code{distcheck} rule (@pxref{Dist}). @cindex Exit status 77, special interpretation @@ -6698,13 +6701,20 @@ given test program exits with a status of 77, then its result is ignored in the final count. This feature allows non-portable tests to be ignored in environments where they don't make sense. +@vindex TESTS +@vindex TESTS_ENVIRONMENT The variable @code{TESTS_ENVIRONMENT} can be used to set environment variables for the test run; the environment variable @code{srcdir} is set in the rule. If all your test programs are scripts, you can also set @code{TESTS_ENVIRONMENT} to an invocation of the shell (e.g. -@samp{$(SHELL) -x}); this can be useful for debugging the tests. -@vindex TESTS -@vindex TESTS_ENVIRONMENT +@samp{$(SHELL) -x} can be useful for debugging the tests), or any other +interpreter. For instance the following setup is used by the Automake +package to run four tests in Perl. +@example +TESTS_ENVIRONMENT = $(PERL) -Mstrict -I $(top_srcdir)/lib -w +TESTS = Condition.pl DisjConditions.pl Version.pl Wrap.pl +@end example + @cindex Tests, expected failure @cindex Expected test failure @@ -6714,12 +6724,22 @@ You may define the variable @code{XFAIL_TESTS} to a list of tests reverse the result of those tests. @vindex XFAIL_TESTS -Automake ensures that each program listed in @code{TESTS} is built -before any tests are run; you can list both source and derived programs -in @code{TESTS}. For instance, you might want to run a C program as a -test. To do this you would list its name in @code{TESTS} and also in -@code{check_PROGRAMS}, and then specify it as you would any other -program. +Automake ensures that each file listed in @code{TESTS} is built before +any tests are run; you can list both source and derived programs (or +scripts) in @code{TESTS}; the generated rule will look both in +@code{srcdir} and @file{.}. For instance, you might want to run a C +program as a test. To do this you would list its name in @code{TESTS} +and also in @code{check_PROGRAMS}, and then specify it as you would +any other program. + +Programs listed in @code{check_PROGRAMS} (and @code{check_LIBRARIES}, +@code{check_LTLIBRARIES}...) are only built during @code{make check}, +not during @code{make all}. You should list there any program needed +by your tests that does not need to be built by @code{make all}. Note +that @code{check_PROGRAMS} are @emph{not} automatically added to +@code{TESTS} because @code{check_PROGRAMS} usually lists programs used +by the tests, not the tests themselves. Of course you can set +@code{TESTS = $(check_PROGRAMS)} if all your programs are test cases. @section DejaGnu Tests diff --git a/doc/stamp-vti b/doc/stamp-vti index 356e8b2..ad87a58 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 6 January 2006 +@set UPDATED 29 January 2006 @set UPDATED-MONTH January 2006 @set EDITION 1.9a @set VERSION 1.9a diff --git a/doc/version.texi b/doc/version.texi index 356e8b2..ad87a58 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 6 January 2006 +@set UPDATED 29 January 2006 @set UPDATED-MONTH January 2006 @set EDITION 1.9a @set VERSION 1.9a diff --git a/tests/Makefile.am b/tests/Makefile.am index 986d33b..b08e6a8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -78,6 +78,7 @@ check.test \ check2.test \ check3.test \ check4.test \ +check5.test \ checkall.test \ clean.test \ clean2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index bad954e..7f1b877 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -2,7 +2,7 @@ # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -30,6 +30,136 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ +TESTS = aclibobj.test aclocal.test aclocal3.test aclocal4.test \ + aclocal5.test aclocal6.test aclocal7.test aclocal8.test \ + aclocal9.test acloca10.test acloca11.test acloca12.test \ + acloca13.test acloca14.test acloca15.test acloca16.test \ + acloca17.test acloca18.test acloca19.test acoutnoq.test \ + acoutpt.test acoutpt2.test acoutqnl.test acoutbs.test \ + acsilent.test acsubst.test acsubst2.test all.test alloca.test \ + alloca2.test alpha.test alpha2.test amassign.test \ + ammissing.test ansi.test ansi2.test ansi3.test ansi3b.test \ + ansi4.test ansi5.test ansi6.test ansi7.test ansi8.test \ + ansi9.test ansi10.test ar.test ar2.test asm.test autohdr.test \ + autohdr2.test autohdr3.test autohdr4.test automake.test \ + auxdir.test auxdir2.test auxdir3.test auxdir4.test backsl.test \ + backsl2.test backsl3.test backsl4.test badline.test \ + badprog.test block.test bsource.test canon.test canon2.test \ + canon3.test canon4.test canon5.test ccnoco.test check.test \ + check2.test check3.test check4.test check5.test checkall.test \ + clean.test clean2.test colneq.test colneq2.test colon.test \ + colon2.test colon3.test colon4.test colon5.test colon6.test \ + colon7.test comment.test comment2.test comment3.test \ + comment4.test comment5.test comment6.test comment7.test \ + comment8.test comment9.test commen10.test compile.test \ + compile_f90_c_cxx.test compile_f_c_cxx.test cond.test \ + cond2.test cond3.test cond4.test cond5.test cond6.test \ + cond7.test cond8.test cond9.test cond10.test cond11.test \ + cond13.test cond14.test cond15.test cond16.test cond17.test \ + cond18.test cond19.test cond20.test cond21.test cond22.test \ + cond23.test cond24.test cond25.test cond26.test cond27.test \ + cond28.test cond29.test cond30.test cond31.test cond32.test \ + cond33.test cond34.test cond35.test cond36.test cond37.test \ + cond38.test condd.test condhook.test condinc.test \ + condinc2.test condlib.test condman.test condman2.test \ + conf2.test confdeps.test conff.test conff2.test confh.test \ + confh4.test confh5.test config.test confincl.test conflnk.test \ + conflnk2.test conflnk3.test confsub.test confvar.test \ + confvar2.test copy.test ctarget1.test cxx.test cxx2.test \ + cxxansi.test cxxcpp.test cxxlibobj.test cxxlink.test \ + cxxnoc.test cxxo.test cygwin32.test dash.test defun.test \ + defun2.test dejagnu.test dejagnu2.test dejagnu3.test \ + dejagnu4.test dejagnu5.test dejagnu6.test dejagnu7.test \ + depacl2.test depcomp.test depcomp2.test depcomp3.test \ + depcomp4.test depcomp5.test depdist.test depend.test \ + depend2.test depend3.test depend4.test destdir.test \ + dirforbid.test dirlist.test discover.test distcom2.test \ + distcom3.test distcom4.test distcom5.test distcom6.test \ + distcom7.test distdir.test distname.test dollar.test \ + double.test dup2.test else.test empty.test empty2.test \ + empty3.test empty4.test exdir.test exdir2.test exeext.test \ + exeext2.test exeext3.test exeext4.test exsource.test ext.test \ + ext2.test extra.test extra3.test extra4.test extra5.test \ + extra6.test extra7.test f90only.test flibs.test fn99.test \ + fnoc.test fo.test fonly.test fortdep.test fpinst2.test \ + fpinstall.test gcj.test gcj2.test gcj3.test gcj4.test \ + gcj5.test getopt.test gettext.test gettext2.test gnumake.test \ + gnuwarn.test gnuwarn2.test gnits.test gnits2.test gnits3.test \ + header.test help.test hfs.test hosts.test implicit.test \ + include.test include2.test info.test insh2.test install2.test \ + installdir.test instsh.test instsh2.test instdat.test \ + instdat2.test instexec.test insthook.test instman.test \ + instman2.test instspc.test interp.test interp2.test java.test \ + java2.test java3.test javaprim.test javasubst.test ldadd.test \ + ldflags.test lex.test lex2.test lex3.test lex4.test lex5.test \ + libobj2.test libobj3.test libobj4.test libobj5.test \ + libobj7.test libobj8.test libobj10.test libobj11.test \ + libobj12.test libobj13.test libobj14.test library.test \ + library2.test library3.test libtool.test libtool2.test \ + libtool3.test libtool4.test libtool5.test libtool6.test \ + libtool7.test libtool8.test libtool9.test license.test \ + link_c_cxx.test link_dist.test link_f90_only.test link_fc.test \ + link_fccxx.test link_fcxx.test link_f_only.test lisp2.test \ + lisp3.test lisp4.test lisp5.test lisp6.test lisp7.test \ + lisp8.test listval.test location.test longline.test \ + longlin2.test ltcond.test ltcond2.test ltconv.test ltdeps.test \ + ltlibobjs.test ltlibsrc.test maintclean.test make.test \ + makej.test makevars.test man.test man2.test mclean.test \ + mdate.test mdate2.test mdate3.test mdate4.test missing.test \ + missing2.test missing3.test mkinstall.test mkinst2.test \ + mkinst3.test mmodely.test multlib.test nobase.test nodef.test \ + nodef2.test nodep.test nodepcomp.test nodist.test nodist2.test \ + nodist3.test nogzip.test nogzip2.test noinst.test \ + noinstdir.test nolink.test nostdinc.test number.test \ + obsolete.test order.test outdir.test output.test output2.test \ + output3.test output4.test output5.test output6.test \ + output7.test output8.test output9.test output10.test \ + output11.test output12.test overrid.test parse.test \ + percent.test percent2.test phony.test pluseq.test pluseq2.test \ + pluseq3.test pluseq4.test pluseq5.test pluseq6.test \ + pluseq7.test pluseq8.test pluseq9.test pluseq10.test \ + postproc.test ppf77.test pr2.test pr9.test pr72.test pr87.test \ + pr204.test pr211.test pr220.test pr224.test pr229.test \ + pr243.test pr266.test pr279.test pr279-2.test pr287.test \ + pr300-lib.test pr300-ltlib.test pr300-prog.test pr307.test \ + pr401.test pr401b.test pr401c.test prefix.test primary.test \ + primary2.test primary3.test proginst.test python.test \ + python2.test python3.test python4.test python5.test \ + python6.test python7.test python8.test python9.test \ + python10.test python11.test python12.test recurs.test \ + recurs2.test remake.test remake2.test remake3.test \ + remake4.test remake5.test regex.test req.test reqd.test \ + reqd2.test rulepat.test scripts.test seenc.test sinclude.test \ + srcsub.test srcsub2.test space.test specflg.test specflg2.test \ + specflg3.test specflg6.test specflg7.test specflg8.test \ + specflg9.test spell.test spell2.test spell3.test spelling.test \ + spy.test stamph2.test stdlib.test stdlib2.test strip.test \ + subdir.test subdir2.test subdir3.test subdir4.test \ + subdir5.test subdir6.test subdir7.test subdir8.test \ + subdir9.test subdirbuiltsources.test subcond.test \ + subcond2.test subcond3.test subobj.test subobj2.test \ + subobj3.test subobj4.test subobj5.test subobj6.test \ + subobj7.test subobj8.test subobj9.test subobjname.test \ + subpkg.test subpkg2.test subst.test subst2.test substref.test \ + substre2.test substtarg.test suffix.test suffix2.test \ + suffix3.test suffix4.test suffix5.test suffix6.test \ + suffix7.test suffix8.test suffix9.test suffix10.test \ + suffix11.test symlink.test symlink2.test symlink3.test \ + syntax.test tags.test tagsub.test tar.test tar2.test tar3.test \ + target-cflags.test targetclash.test txinfo.test txinfo2.test \ + txinfo3.test txinfo4.test txinfo5.test txinfo6.test \ + txinfo7.test txinfo8.test txinfo9.test txinfo10.test \ + txinfo13.test txinfo16.test txinfo17.test txinfo18.test \ + txinfo19.test txinfo20.test txinfo21.test txinfo22.test \ + txinfo23.test txinfo24.test txinfo25.test txinfo26.test \ + txinfo27.test txinfo28.test txinfo29.test txinfo30.test \ + transform.test unused.test vars.test vars3.test vartar.test \ + version.test version2.test version3.test version4.test \ + version6.test version7.test version8.test vpath.test \ + vtexi.test vtexi2.test warnopts.test werror.test werror2.test \ + whoami.test xsource.test yacc.test yacc2.test yacc3.test \ + yacc4.test yacc5.test yacc6.test yacc7.test yacc8.test \ + yaccpp.test yaccvpath.test subdir = tests DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs.in @@ -132,585 +262,6 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ XFAIL_TESTS = auxdir2.test cond17.test txinfo5.test -TESTS = \ -aclibobj.test \ -aclocal.test \ -aclocal3.test \ -aclocal4.test \ -aclocal5.test \ -aclocal6.test \ -aclocal7.test \ -aclocal8.test \ -aclocal9.test \ -acloca10.test \ -acloca11.test \ -acloca12.test \ -acloca13.test \ -acloca14.test \ -acloca15.test \ -acloca16.test \ -acloca17.test \ -acloca18.test \ -acloca19.test \ -acoutnoq.test \ -acoutpt.test \ -acoutpt2.test \ -acoutqnl.test \ -acoutbs.test \ -acsilent.test \ -acsubst.test \ -acsubst2.test \ -all.test \ -alloca.test \ -alloca2.test \ -alpha.test \ -alpha2.test \ -amassign.test \ -ammissing.test \ -ansi.test \ -ansi2.test \ -ansi3.test \ -ansi3b.test \ -ansi4.test \ -ansi5.test \ -ansi6.test \ -ansi7.test \ -ansi8.test \ -ansi9.test \ -ansi10.test \ -ar.test \ -ar2.test \ -asm.test \ -autohdr.test \ -autohdr2.test \ -autohdr3.test \ -autohdr4.test \ -automake.test \ -auxdir.test \ -auxdir2.test \ -auxdir3.test \ -auxdir4.test \ -backsl.test \ -backsl2.test \ -backsl3.test \ -backsl4.test \ -badline.test \ -badprog.test \ -block.test \ -bsource.test \ -canon.test \ -canon2.test \ -canon3.test \ -canon4.test \ -canon5.test \ -ccnoco.test \ -check.test \ -check2.test \ -check3.test \ -check4.test \ -checkall.test \ -clean.test \ -clean2.test \ -colneq.test \ -colneq2.test \ -colon.test \ -colon2.test \ -colon3.test \ -colon4.test \ -colon5.test \ -colon6.test \ -colon7.test \ -comment.test \ -comment2.test \ -comment3.test \ -comment4.test \ -comment5.test \ -comment6.test \ -comment7.test \ -comment8.test \ -comment9.test \ -commen10.test \ -compile.test \ -compile_f90_c_cxx.test \ -compile_f_c_cxx.test \ -cond.test \ -cond2.test \ -cond3.test \ -cond4.test \ -cond5.test \ -cond6.test \ -cond7.test \ -cond8.test \ -cond9.test \ -cond10.test \ -cond11.test \ -cond13.test \ -cond14.test \ -cond15.test \ -cond16.test \ -cond17.test \ -cond18.test \ -cond19.test \ -cond20.test \ -cond21.test \ -cond22.test \ -cond23.test \ -cond24.test \ -cond25.test \ -cond26.test \ -cond27.test \ -cond28.test \ -cond29.test \ -cond30.test \ -cond31.test \ -cond32.test \ -cond33.test \ -cond34.test \ -cond35.test \ -cond36.test \ -cond37.test \ -cond38.test \ -condd.test \ -condhook.test \ -condinc.test \ -condinc2.test \ -condlib.test \ -condman.test \ -condman2.test \ -conf2.test \ -confdeps.test \ -conff.test \ -conff2.test \ -confh.test \ -confh4.test \ -confh5.test \ -config.test \ -confincl.test \ -conflnk.test \ -conflnk2.test \ -conflnk3.test \ -confsub.test \ -confvar.test \ -confvar2.test \ -copy.test \ -ctarget1.test \ -cxx.test \ -cxx2.test \ -cxxansi.test \ -cxxcpp.test \ -cxxlibobj.test \ -cxxlink.test \ -cxxnoc.test \ -cxxo.test \ -cygwin32.test \ -dash.test \ -defun.test \ -defun2.test \ -dejagnu.test \ -dejagnu2.test \ -dejagnu3.test \ -dejagnu4.test \ -dejagnu5.test \ -dejagnu6.test \ -dejagnu7.test \ -depacl2.test \ -depcomp.test \ -depcomp2.test \ -depcomp3.test \ -depcomp4.test \ -depcomp5.test \ -depdist.test \ -depend.test \ -depend2.test \ -depend3.test \ -depend4.test \ -destdir.test \ -dirforbid.test \ -dirlist.test \ -discover.test \ -distcom2.test \ -distcom3.test \ -distcom4.test \ -distcom5.test \ -distcom6.test \ -distcom7.test \ -distdir.test \ -distname.test \ -dollar.test \ -double.test \ -dup2.test \ -else.test \ -empty.test \ -empty2.test \ -empty3.test \ -empty4.test \ -exdir.test \ -exdir2.test \ -exeext.test \ -exeext2.test \ -exeext3.test \ -exeext4.test \ -exsource.test \ -ext.test \ -ext2.test \ -extra.test \ -extra3.test \ -extra4.test \ -extra5.test \ -extra6.test \ -extra7.test \ -f90only.test \ -flibs.test \ -fn99.test \ -fnoc.test \ -fo.test \ -fonly.test \ -fortdep.test \ -fpinst2.test \ -fpinstall.test \ -gcj.test \ -gcj2.test \ -gcj3.test \ -gcj4.test \ -gcj5.test \ -getopt.test \ -gettext.test \ -gettext2.test \ -gnumake.test \ -gnuwarn.test \ -gnuwarn2.test \ -gnits.test \ -gnits2.test \ -gnits3.test \ -header.test \ -help.test \ -hfs.test \ -hosts.test \ -implicit.test \ -include.test \ -include2.test \ -info.test \ -insh2.test \ -install2.test \ -installdir.test \ -instsh.test \ -instsh2.test \ -instdat.test \ -instdat2.test \ -instexec.test \ -insthook.test \ -instman.test \ -instman2.test \ -instspc.test \ -interp.test \ -interp2.test \ -java.test \ -java2.test \ -java3.test \ -javaprim.test \ -javasubst.test \ -ldadd.test \ -ldflags.test \ -lex.test \ -lex2.test \ -lex3.test \ -lex4.test \ -lex5.test \ -libobj2.test \ -libobj3.test \ -libobj4.test \ -libobj5.test \ -libobj7.test \ -libobj8.test \ -libobj10.test \ -libobj11.test \ -libobj12.test \ -libobj13.test \ -libobj14.test \ -library.test \ -library2.test \ -library3.test \ -libtool.test \ -libtool2.test \ -libtool3.test \ -libtool4.test \ -libtool5.test \ -libtool6.test \ -libtool7.test \ -libtool8.test \ -libtool9.test \ -license.test \ -link_c_cxx.test \ -link_dist.test \ -link_f90_only.test \ -link_fc.test \ -link_fccxx.test \ -link_fcxx.test \ -link_f_only.test \ -lisp2.test \ -lisp3.test \ -lisp4.test \ -lisp5.test \ -lisp6.test \ -lisp7.test \ -lisp8.test \ -listval.test \ -location.test \ -longline.test \ -longlin2.test \ -ltcond.test \ -ltcond2.test \ -ltconv.test \ -ltdeps.test \ -ltlibobjs.test \ -ltlibsrc.test \ -maintclean.test \ -make.test \ -makej.test \ -makevars.test \ -man.test \ -man2.test \ -mclean.test \ -mdate.test \ -mdate2.test \ -mdate3.test \ -mdate4.test \ -missing.test \ -missing2.test \ -missing3.test \ -mkinstall.test \ -mkinst2.test \ -mkinst3.test \ -mmodely.test \ -multlib.test \ -nobase.test \ -nodef.test \ -nodef2.test \ -nodep.test \ -nodepcomp.test \ -nodist.test \ -nodist2.test \ -nodist3.test \ -nogzip.test \ -nogzip2.test \ -noinst.test \ -noinstdir.test \ -nolink.test \ -nostdinc.test \ -number.test \ -obsolete.test \ -order.test \ -outdir.test \ -output.test \ -output2.test \ -output3.test \ -output4.test \ -output5.test \ -output6.test \ -output7.test \ -output8.test \ -output9.test \ -output10.test \ -output11.test \ -output12.test \ -overrid.test \ -parse.test \ -percent.test \ -percent2.test \ -phony.test \ -pluseq.test \ -pluseq2.test \ -pluseq3.test \ -pluseq4.test \ -pluseq5.test \ -pluseq6.test \ -pluseq7.test \ -pluseq8.test \ -pluseq9.test \ -pluseq10.test \ -postproc.test \ -ppf77.test \ -pr2.test \ -pr9.test \ -pr72.test \ -pr87.test \ -pr204.test \ -pr211.test \ -pr220.test \ -pr224.test \ -pr229.test \ -pr243.test \ -pr266.test \ -pr279.test \ -pr279-2.test \ -pr287.test \ -pr300-lib.test \ -pr300-ltlib.test \ -pr300-prog.test \ -pr307.test \ -pr401.test \ -pr401b.test \ -pr401c.test \ -prefix.test \ -primary.test \ -primary2.test \ -primary3.test \ -proginst.test \ -python.test \ -python2.test \ -python3.test \ -python4.test \ -python5.test \ -python6.test \ -python7.test \ -python8.test \ -python9.test \ -python10.test \ -python11.test \ -python12.test \ -recurs.test \ -recurs2.test \ -remake.test \ -remake2.test \ -remake3.test \ -remake4.test \ -remake5.test \ -regex.test \ -req.test \ -reqd.test \ -reqd2.test \ -rulepat.test \ -scripts.test \ -seenc.test \ -sinclude.test \ -srcsub.test \ -srcsub2.test \ -space.test \ -specflg.test \ -specflg2.test \ -specflg3.test \ -specflg6.test \ -specflg7.test \ -specflg8.test \ -specflg9.test \ -spell.test \ -spell2.test \ -spell3.test \ -spelling.test \ -spy.test \ -stamph2.test \ -stdlib.test \ -stdlib2.test \ -strip.test \ -subdir.test \ -subdir2.test \ -subdir3.test \ -subdir4.test \ -subdir5.test \ -subdir6.test \ -subdir7.test \ -subdir8.test \ -subdir9.test \ -subdirbuiltsources.test \ -subcond.test \ -subcond2.test \ -subcond3.test \ -subobj.test \ -subobj2.test \ -subobj3.test \ -subobj4.test \ -subobj5.test \ -subobj6.test \ -subobj7.test \ -subobj8.test \ -subobj9.test \ -subobjname.test \ -subpkg.test \ -subpkg2.test \ -subst.test \ -subst2.test \ -substref.test \ -substre2.test \ -substtarg.test \ -suffix.test \ -suffix2.test \ -suffix3.test \ -suffix4.test \ -suffix5.test \ -suffix6.test \ -suffix7.test \ -suffix8.test \ -suffix9.test \ -suffix10.test \ -suffix11.test \ -symlink.test \ -symlink2.test \ -symlink3.test \ -syntax.test \ -tags.test \ -tagsub.test \ -tar.test \ -tar2.test \ -tar3.test \ -target-cflags.test \ -targetclash.test \ -txinfo.test \ -txinfo2.test \ -txinfo3.test \ -txinfo4.test \ -txinfo5.test \ -txinfo6.test \ -txinfo7.test \ -txinfo8.test \ -txinfo9.test \ -txinfo10.test \ -txinfo13.test \ -txinfo16.test \ -txinfo17.test \ -txinfo18.test \ -txinfo19.test \ -txinfo20.test \ -txinfo21.test \ -txinfo22.test \ -txinfo23.test \ -txinfo24.test \ -txinfo25.test \ -txinfo26.test \ -txinfo27.test \ -txinfo28.test \ -txinfo29.test \ -txinfo30.test \ -transform.test \ -unused.test \ -vars.test \ -vars3.test \ -vartar.test \ -version.test \ -version2.test \ -version3.test \ -version4.test \ -version6.test \ -version7.test \ -version8.test \ -vpath.test \ -vtexi.test \ -vtexi2.test \ -warnopts.test \ -werror.test \ -werror2.test \ -whoami.test \ -xsource.test \ -yacc.test \ -yacc2.test \ -yacc3.test \ -yacc4.test \ -yacc5.test \ -yacc6.test \ -yacc7.test \ -yacc8.test \ -yaccpp.test \ -yaccvpath.test - EXTRA_DIST = ChangeLog-old $(TESTS) # Each test case depends on defs, aclocal, and automake. diff --git a/tests/check5.test b/tests/check5.test new file mode 100755 index 0000000..bcb563f --- /dev/null +++ b/tests/check5.test @@ -0,0 +1,57 @@ +#! /bin/sh +# Copyright (C) 2006 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GNU Automake is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# Test TESTS = $(check_PROGRAMS) + +. ./defs || exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_OUTPUT +END + +cat > Makefile.am << 'END' +check_PROGRAMS = one two +TESTS = $(check_PROGRAMS) +check-local: + test -f one$(EXEEXT) + test -f two$(EXEEXT) + touch ok +print-tests: + echo BEG: $(TESTS) :END +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +cat >one.c <output +cat output +grep 'BEG: one.bin two.bin :END' output diff --git a/tests/cond32.test b/tests/cond32.test index ade8d5c..e63489d 100755 --- a/tests/cond32.test +++ b/tests/cond32.test @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -28,6 +28,7 @@ cat >>configure.in <<'EOF' AC_PROG_CC AM_CONDITIONAL(C1, [test -z "$two"]) AM_CONDITIONAL(C2, [test -n "$two"]) +AM_CONDITIONAL(C3, [test -z "$three"]) AC_SUBST([MYSUB], [foo.o]) AC_OUTPUT EOF @@ -41,7 +42,12 @@ a_DEPENDENCIES = $(MYSUB) nonsense.a # using some self computed a_DEPENDENCIES variable. endif if C2 -a_LDADD = bar.o +if C3 +BAR = bar.o +else +BAR = baz.o +endif +a_LDADD = $(BAR) endif print: @echo BEG: $(a_DEPENDENCIES) :END @@ -56,7 +62,12 @@ $MAKE -e print > stdout cat stdout grep 'BEG: foo.o nonsense.a :END' stdout -./configure two=yes +./configure two=yes three= $MAKE -e print > stdout cat stdout grep 'BEG: bar.o :END' stdout + +./configure two=yes three=yes +$MAKE -e print > stdout +cat stdout +grep 'BEG: baz.o :END' stdout diff --git a/tests/exeext4.test b/tests/exeext4.test index efe48d3..6e31a9a 100755 --- a/tests/exeext4.test +++ b/tests/exeext4.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -18,13 +18,15 @@ # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. -# Make sure $(EXEEXT) is not appended to @substitutions@. +# Make sure $(EXEEXT) is appended to programs and to tests that are +# programs, but not to @substitutions@. . ./defs || exit 1 set -e cat >> configure.in << 'END' +AM_CONDITIONAL([COND], [test -n "$cond"]) AC_SUBST([programs], ['prg1$(EXEEXT) prg2$(EXEEXT)']) AC_PROG_CC AC_OUTPUT @@ -32,12 +34,24 @@ END cat > Makefile.am << 'END' EXEEXT = .bin -bin_PROGRAMS = $(programs) @programs@ prg3 +if COND + BAR = bar + DEP = bar + BAZE = baz$(EXEEXT) + BAZ = baz $(DEP) +endif +bin_PROGRAMS = $(programs) @programs@ prg3 $(BAR) $(BAZE) EXTRA_PROGRAMS = prg1 prg2 prg3 +TESTS = prg1 prg3 prg4 $(BAZ) + print-bin: echo BEG: $(bin_PROGRAMS) :END print-extra: echo BEG: $(EXTRA_PROGRAMS) :END +print-tests: + echo BEG: $(TESTS) :END +print-barbaz: + echo BEG: $(BAR) $(BAZ) :END END $ACLOCAL @@ -50,3 +64,17 @@ grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin' output $MAKE print-extra > output cat output grep 'prg1.bin prg2.bin prg3.bin' output +$MAKE print-tests > output +cat output +grep 'prg1.bin prg3.bin prg4' output + +./configure cond=yes +$MAKE print-bin > output +cat output +grep 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin bar.bin baz.bin' output +$MAKE print-tests > output +cat output +grep 'prg1.bin prg3.bin prg4 baz.bin bar.bin' output +$MAKE print-barbaz > output +cat output +grep 'bar baz bar' output -- 2.7.4