automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.


From: Stefano Lattarini
Subject: Re: [PATCH] New tests on obsoleted usages of automake/autoconf macros.
Date: Wed, 3 Nov 2010 19:12:27 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Pinging this patch again, following this:
 <http://lists.gnu.org/archive/html/automake-patches/2010-11/msg00003.html>

I've also re-based the patch off of latest maint, extended some checks a
little bit, fixed a typo in comments, and fixed some very minor and theoretic
portability problems (use of "test -z").
The updated patch is attached.

The only unresolved question about the patch is the following one:
> At Thursday 17 June 2010, Ralf Wildenhues wrote:
> > Stefano Lattarini wrote:
> > > --- /dev/null
> > > +++ b/tests/backcompat2.test
> > >
> > > @@ -0,0 +1,69 @@
> > > +# A trick to make the test run muuuch faster, by avoiding repeated
> > > +# runs of aclocal (one order of magnitude improvement in speed!).
> > > +echo 'AC_INIT(x,0) AM_INIT_AUTOMAKE' >configure.in
> > > +$ACLOCAL
> 
> > Hmm, does that mean this test completely relies on caching?
> It should mean that the test relies on each autoconf call requiring an
> aclocal.m4 that defines just AM_INIT_AUTOMAKE and the macros it requires,
> and nothing more.  And this aclocal.m4 is created by the first $ACLOCAL
> run.
> Just to be sure, I amended the script to remove the autom4te.* stuff after
> the call to $ACLOCAL (and only then).
>
> > You probably need a $sleep or "rm -rf autom4te.cache" before
> > each of the following edits to configure.in, to avoid autotools
> > operating on old cached transformations of the file.
> But then we would need to do that in each test where we modify and reuse
> 'configure.in' (see e.g. acloca10.test, pr401.test, nodef.test, etc..).
> Right?
>
> > Am I overlooking something here?
> I'd like to ask you the same question :-)

So, OK to push as is, or should I address your concerns about autom4te
caching in some way?

Regards,
   Stefano
From d41eadf9a9f51c74c9a3095db01739094c77aba4 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 18 Jun 2010 12:56:47 +0200
Subject: [PATCH] New tests on obsoleted usages of automake/autoconf macros.

* tests/backcompat.test: New test script.
* tests/backcompat2.test: Likewise.
* tests/backcompat3.test: Likewise.
* tests/backcompat4.test: Likewise.
* tests/backcompat5.test: Likewise.
* tests/backcompat6.test: Likewise.
* tests/init.test: Extended and improved, esp. by trying more
combinations of calls to AC_INIT and AM_INIT_AUTOMAKE with few
arguments.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog              |   15 +++++
 tests/Makefile.am      |    6 ++
 tests/Makefile.in      |    7 ++
 tests/backcompat.test  |   66 +++++++++++++++++++++
 tests/backcompat2.test |   67 +++++++++++++++++++++
 tests/backcompat3.test |  153 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/backcompat4.test |   64 ++++++++++++++++++++
 tests/backcompat5.test |  119 +++++++++++++++++++++++++++++++++++++
 tests/backcompat6.test |  105 +++++++++++++++++++++++++++++++++
 tests/init.test        |   29 ++++++----
 10 files changed, 620 insertions(+), 11 deletions(-)
 create mode 100755 tests/backcompat.test
 create mode 100755 tests/backcompat2.test
 create mode 100755 tests/backcompat3.test
 create mode 100755 tests/backcompat4.test
 create mode 100755 tests/backcompat5.test
 create mode 100755 tests/backcompat6.test

diff --git a/ChangeLog b/ChangeLog
index 7883d5e..b22b094 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-03  Stefano Lattarini  <address@hidden>
+
+       New tests on obsoleted usages of automake/autoconf macros (such
+       as AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT).
+       * tests/backcompat.test: New test script.
+       * tests/backcompat2.test: Likewise.
+       * tests/backcompat3.test: Likewise.
+       * tests/backcompat4.test: Likewise.
+       * tests/backcompat5.test: Likewise.
+       * tests/backcompat6.test: Likewise.
+       * tests/init.test: Extended and improved, esp. by trying more
+       combinations of calls to AC_INIT and AM_INIT_AUTOMAKE with few
+       arguments.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-10-04  Stefano Lattarini  <address@hidden>
 
        Add support for newer python versions.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index acc7640..5cc293d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -103,6 +103,12 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+backcompat.test \
+backcompat2.test \
+backcompat3.test \
+backcompat4.test \
+backcompat5.test \
+backcompat6.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 117f2ba..7e88ab6 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -280,6 +280,7 @@ gcj6.test \
 txinfo5.test
 
 parallel_tests = \
+backcompat5-p.test \
 check-p.test \
 check10-p.test \
 check11-p.test \
@@ -370,6 +371,12 @@ auxdir.test \
 auxdir2.test \
 auxdir3.test \
 auxdir4.test \
+backcompat.test \
+backcompat2.test \
+backcompat3.test \
+backcompat4.test \
+backcompat5.test \
+backcompat6.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
diff --git a/tests/backcompat.test b/tests/backcompat.test
new file mode 100755
index 0000000..3367db2
--- /dev/null
+++ b/tests/backcompat.test
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test usage of AM_INIT_AUTOMAKE with two ot three arguments, for
+# backward-compatibility.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am <<'END'
+.PHONY: test display
+
+## Might be useful for debugging.
+display:
+       ## The following should be substituted by AM_INIT_AUTOMAKE.
+       @echo PACKAGE = $(PACKAGE)
+       @echo VERSION = $(VERSION)
+       ## The following should not be substituted, as we used the
+       ## old form of AC_INIT.
+       @echo PACKAGE_NAME = $(PACKAGE_NAME)
+       @echo PACKAGE_VERSION = $(PACKAGE_VERSION)
+       @echo PACKAGE_TARNAME = $(PACKAGE_TARNAME)
+       @echo PACKAGE_STRING = $(PACKAGE_STRING)
+
+test: display
+       test x'$(PACKAGE)' = x'FooBar'
+       test x'$(VERSION)' = x'0.7.1'
+       test x'$(PACKAGE_NAME)' = x
+       test x'$(PACKAGE_VERSION)' = x
+       test x'$(PACKAGE_TARNAME)' = x
+       test x'$(PACKAGE_STRING)' = x
+END
+
+for ac_init in 'AC_INIT' 'AC_INIT([Makefile.am])'; do
+  for am_extra_args in '' ', []' ', [:]' ', [false]'; do
+    rm -rf autom4te*.cache config* Makefile.in Makefile
+    cat > configure.in <<END
+$ac_init
+AM_INIT_AUTOMAKE([FooBar], [0.7.1]$am_extra_args)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+    cat configure.in # might be useful for debugging
+    $ACLOCAL
+    $AUTOCONF
+    $AUTOMAKE
+    ./configure
+    $MAKE test
+  done
+done
+
+:
diff --git a/tests/backcompat2.test b/tests/backcompat2.test
new file mode 100755
index 0000000..0967720
--- /dev/null
+++ b/tests/backcompat2.test
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Backward-compatibility test: check that AM_INIT_AUTOMAKE with two or
+# three arguments does AC_DEFINE the symbols PACKAGE and VERSION iff the
+# third argument is empty or non-existent.
+
+. ./defs || Exit 1
+
+set -e
+
+# A trick to make the test run muuuch faster, by avoiding repeated
+# runs of aclocal (one order of magnitude improvement in speed!).
+echo 'AC_INIT(x,0) AM_INIT_AUTOMAKE' > configure.in
+$ACLOCAL
+rm -rf configure.in autom4te.*
+
+cat > config.h.in <<'END'
+#undef PACKAGE
+#undef VERSION
+END
+
+for am_arg3 in ':' 'false' '#' ' '; do
+  cat > configure.in <<END
+AC_INIT
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([pkgname], [pkgversion], [$am_arg3])
+AC_OUTPUT
+END
+  cat configure.in # might be useful for debugging
+  $AUTOCONF
+  ./configure
+  cat config.h # might be useful for debugging
+  # The non-empty third argument should prevent PACKAGE and VERSION
+  # from being AC_DEFINE'd.
+  $EGREP 'pkg(name|version)' config.h && Exit 1
+done
+
+for am_extra_args in '' ',' ', []'; do
+  cat > configure.in <<END
+AC_INIT
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([pkgname], [pkgversion]$am_extra_args)
+AC_OUTPUT
+END
+  cat configure.in # might be useful for debugging
+  $AUTOCONF
+  ./configure
+  cat config.h # might be useful for debugging
+  grep '^ *# *define  *PACKAGE  *"pkgname" *$' config.h
+  grep '^ *# *define  *VERSION  *"pkgversion" *$' config.h
+done
+
+:
diff --git a/tests/backcompat3.test b/tests/backcompat3.test
new file mode 100755
index 0000000..f07eaff
--- /dev/null
+++ b/tests/backcompat3.test
@@ -0,0 +1,153 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Backward-compatibility test: check what happens when AC_INIT and
+# AM_INIT_AUTOMAKE are both given two or more arguments.
+
+. ./defs || Exit 1
+
+set -e
+
+empty=''
+
+cat > Makefile.am <<'END'
+## Leading `:;' here required to work around bugs of (at least) bash 3.2
+got: Makefile
+       @:; { \
+         echo 'PACKAGE = $(PACKAGE)'; \
+         echo 'VERSION = $(VERSION)'; \
+         echo 'PACKAGE_NAME = $(PACKAGE_NAME)'; \
+         echo 'PACKAGE_VERSION = $(PACKAGE_VERSION)'; \
+         echo 'PACKAGE_STRING = $(PACKAGE_STRING)'; \
+         echo 'PACKAGE_TARNAME = $(PACKAGE_TARNAME)'; \
+         echo 'PACKAGE_BUGREPORT = $(PACKAGE_BUGREPORT)'; \
+         echo 'PACKAGE_URL = $(PACKAGE_URL)'; \
+       } >$@
+END
+
+
+### Run 1 ###
+
+cat > configure.in <<END
+AC_INIT([ac_name], [ac_version])
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_name
+PACKAGE_BUGREPORT = $empty
+PACKAGE_URL = $empty
+END
+
+$MAKE got
+
+diff exp got
+
+
+### Run 2 ###
+
+cat > configure.in <<'END'
+dnl#  `AC_INIT' in Autoconf <= 2.63 doesn't have an URL argument.
+dnl#  Luckily, `AC_AUTOCONF_VERSION' and `m4_version_prereq' are
+dnl#  both present in autoconf 2.62, which we require; so that we
+dnl#  can at least use the following workaround.
+m4_version_prereq([2.64],
+    [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
+             [ac_url])],
+    [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname])
+     AC_SUBST([PACKAGE_URL], [ac_url])])
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_tarname
+PACKAGE_BUGREPORT = ac_bugreport
+PACKAGE_URL = ac_url
+END
+
+$MAKE got
+
+diff exp got
+
+
+### Run 3 ###
+
+cat > configure.in <<END
+AC_INIT([ac_name], [ac_version])
+AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_name
+PACKAGE_BUGREPORT = $empty
+PACKAGE_URL = $empty
+END
+
+$MAKE got
+
+diff exp got
+
+$FGREP am_foo_quux Makefile.in Makefile configure config.status && Exit 1
+
+
+### Done ###
+
+:
diff --git a/tests/backcompat4.test b/tests/backcompat4.test
new file mode 100755
index 0000000..1bee059
--- /dev/null
+++ b/tests/backcompat4.test
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Backward-compatibility: AC_OUTPUT with arguments.
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+: > Makefile.am
+: > zardoz
+: > foo.in
+: > foo1.in
+: > foo2.in
+: > foo3.in
+: > sub/bar.in
+
+ls -l # might be useful for debugging
+
+for args in \
+  'foo' \
+  'foo:foo1.in' \
+  'foo:zardoz' \
+  'foo:sub/bar.in' \
+  'foo:foo1.in:foo2.in' \
+  'foo:zardoz:zardoz' \
+  'foo:foo1.in:foo2.in:foo3.in' \
+  'foo:foo1.in:foo2.in:sub/bar.in:foo3.in' \
+; do
+  cat >configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([$args])
+AC_OUTPUT
+END
+  $ACLOCAL
+  $AUTOMAKE Makefile
+  mv -f Makefile.in Makefile.acf
+  cat >configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_OUTPUT([$args])
+END
+  $ACLOCAL
+  $AUTOMAKE Makefile
+  mv -f Makefile.in Makefile.aco
+  diff Makefile.acf Makefile.aco
+done
+
+:
diff --git a/tests/backcompat5.test b/tests/backcompat5.test
new file mode 100755
index 0000000..b68316d
--- /dev/null
+++ b/tests/backcompat5.test
@@ -0,0 +1,119 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Backward-compatibility test: try to build and distribute a package
+# using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
+# This script can also serve as mild stress-testing for Automke.
+# See also the similar test `backcompat6.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+# Yuck!
+cat > configure.in <<'END'
+dnl. Everything here is *deliberately* underquoted!
+AC_INIT(src/foo.input)
+AM_INIT_AUTOMAKE(foo, 1.0)
+AC_CONFIG_FILES(Makefile:mkfile.in)
+AC_OUTPUT(hacky/Makefile src/Makefile data/Makefile tests/Makefile)
+END
+
+distdir=foo-1.0
+
+cat > mkfile.am <<'END'
+SUBDIRS = src data tests hacky
+installcheck-local:
+       grep DataDataData $(DESTDIR)$(prefix)/data/$(PACKAGE)-$(VERSION)/bar
+END
+
+mkdir hacky src tests data
+
+echo 'This is a dummy package' > README
+
+cat > src/foo.input <<'END'
+#!sh
+echo Zardoz
+END
+
+cat > tests/a.test <<'END'
+#!/bin/sh
+"$srcdir/../src/foo" | grep Zardoz
+END
+chmod a+x tests/a.test
+
+cat > data/bar <<'END'
+line1
+line2
+line3
+END
+
+cat >hacky/Makefile.am <<'END'
+dist-hook:
+       find $(top_distdir) -print ## useful for debugging
+       chmod a+rx $(top_distdir)/tests/*.test
+END
+
+cat > src/Makefile.am <<'END'
+dist_bin_SCRIPTS = foo
+foo: foo.input
+       sed '1s,^#!.*$$,#!/bin/sh,' $(srcdir)/foo.input >$@
+       chmod a+x $@
+EXTRA_DIST = foo.input
+DISTCLEANFILES = foo
+END
+
+cat > data/Makefile.am <<'END'
+nodist_data_DATA = bar
+datadir = $(prefix)/data/$(PACKAGE)-$(VERSION)
+bar:
+       echo DataDataData >$@
+distclean-local:
+       rm -f bar
+END
+
+cat > tests/Makefile.am <<'END'
+TESTS = a.test
+EXTRA_DIST = $(TESTS)
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+ls -l . hacky src data tests # useful for debugging
+test ! -f mkfile
+$MAKE
+$MAKE distdir
+test ! -f $distdir/Makefile.in
+test ! -f $distdir/data/bar
+test -f $distdir/src/foo
+diff README $distdir/README
+diff mkfile.in $distdir/mkfile.in
+diff tests/a.test $distdir/tests/a.test
+diff src/foo.input $distdir/src/foo.input
+
+$MAKE check
+$MAKE distcheck
+
+test -f $distdir.tar.gz
+
+chmod a-x tests/a.test
+# dist-hook should take care of making test files executables
+$MAKE distcheck
+
+:
diff --git a/tests/backcompat6.test b/tests/backcompat6.test
new file mode 100755
index 0000000..534ecb1
--- /dev/null
+++ b/tests/backcompat6.test
@@ -0,0 +1,105 @@
+#! /bin/sh
+# Copyright (C) 2010 Free Software Foundation, Inc.
+#
+# This program 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.
+#
+# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Backward-compatibility test: try to build and distribute a package
+# using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
+# This script can also serve as mild stress-testing for Automke.
+# See also the similar test `backcompat5.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+# Anyone doing something like this in a real-life package probably
+# deserves to be killed.
+cat > configure.in <<'END'
+dnl. Everything here is *deliberately* underquoted!
+AC_INIT(quux.c)
+PACKAGE=nonesuch-zardoz
+VERSION=nonesuch-0.1
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AC_SUBST(one,1)
+two=2
+AC_SUBST(two, $two)
+three=3
+AC_SUBST(three)
+AC_PROG_CC
+AC_CONFIG_HEADERS(config.h:config.hin)
+AC_OUTPUT(Makefile foo.got:foo1.in:foo2.in:foo3.in)
+END
+
+echo @one@ > foo1.in
+echo @two@ > foo2.in
+echo @three@ > foo3.in
+
+cat >config.hin <<'END'
+#undef PACKAGE
+#undef VERSION
+END
+
+cat >> Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = quux.c
+DISTCLEANFILES = *.tmp
+check-local:
+       rm -f exp got
+       echo 'PACKAGE = nonesuch-zardoz' > exp.tmp
+       echo 'VERSION = nonesuch-0.1' >> exp.tmp
+       echo 'PACKAGE = $(PACKAGE)' > got1.tmp
+       echo 'VERSION = $(VERSION)' >> got1.tmp
+       ./foo > got2.tmp
+       cat exp.tmp
+       cat got1.tmp
+       cat got2.tmp
+       diff exp.tmp got1.tmp
+       diff exp.tmp got2.tmp
+END
+
+cat > quux.c <<'END'
+#include <config.h>
+#include <stdio.h>
+int main (void)
+{
+  printf("PACKAGE = %s\nVERSION = %s\n", PACKAGE, VERSION);
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+cat >foo.exp <<'END'
+1
+2
+3
+END
+
+diff foo.exp foo.got
+
+$MAKE
+$MAKE check
+
+distdir=nonesuch-zardoz-nonesuch-0.1
+$MAKE distdir
+test -f $distdir/quux.c
+test ! -f $distdir/foo.got
+
+$MAKE distcheck
+
+:
diff --git a/tests/init.test b/tests/init.test
index 38ec681..895bad6 100755
--- a/tests/init.test
+++ b/tests/init.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -14,20 +14,27 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure we give a sensible error message when neither AC_INIT nor
-# AM_INIT_AUTOMAKE are given arguments.
+# Make sure we give a sensible error message when AC_INIT and
+# AM_INIT_AUTOMAKE are both given less than two arguments.
 
 . ./defs || Exit 1
 
 set -e
 
-cat >configure.in <<END
-AC_INIT
-AM_INIT_AUTOMAKE
+for ac_init_args in '' '([x])'; do
+  for am_init_args in '' '([1.10])'; do
+    rm -rf aclocal.m4 autom4te*.cache
+    cat >configure.in <<END
+AC_INIT$ac_init_args
+AM_INIT_AUTOMAKE$am_init_args
 END
+    cat configure.in # might be useful for debugging
+    # The error message should mention AC_INIT, not AC_PACKAGE_VERSION.
+    ($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
+    cat stderr >&2
+    $FGREP AC_PACKAGE_VERSION stderr && Exit 1
+    grep 'configure\.in:.* AC_INIT .*arguments' stderr
+  done
+done
 
-# The error message should mension AC_INIT, not AC_PACKAGE_VERSION.
-($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep AC_PACKAGE_VERSION stderr && Exit 1
-grep AC_INIT stderr
+:
-- 
1.7.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]