AM_INIT_AUTOMAKE: allow obsolescent two-args invocation once again
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 24 Aug 2012 08:47:17 +0000 (10:47 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 24 Aug 2012 09:42:41 +0000 (11:42 +0200)
This partially reverts commit 'v1.12-67-ge186355' of 2012-05-25,
"init: obsolete usages of AM_INIT_AUTOMAKE not supported anymore"

Some users still need to be able to define the version number for
their package dynamically, at configure runtime.

Their user case is that, for development snapshots, they want to be
able to base the complete version of the package on the VCS revision
ID (mostly Git or Mercurial).  They could of course do so by
specifying such version dynamically in their call to AC_INIT, as is
done by several GNU packages.  But then they would need to regenerate
and re-run the configure script before each snapshot, which might be
very time-consuming for complex packages, to the point of slowing
down and even somewhat impeding development.

The situation should truly be solved in Autoconf, by allowing a way
to specify the version dynamically in a way that doesn't force the
configure script to be regenerated and re-run every time the package
version changes.  But until Autoconf has been improved to allow
this, Automake will have to support the obsolescent two-arguments
invocation for AM_INIT_AUTOMAKE, to avoid regressing the suboptimal
but working solution for the use case described above.

See also:
<http://lists.gnu.org/archive/html/automake/2012-08/msg00025.html>

* NEWS: Update.
* m4/init.m4 (AM_INIT_AUTOMAKE): Support once again invocation with
two or three arguments.
* t/aminit-moreargs-no-more.sh: Renamed ...
* t/aminit-moreargs-deprecated.sh: ... like this, and updated.
* t/nodef.sh: Recovered test, with minor adjustments.
* t/backcompat.sh: Likewise.
* t/backcompat2.sh: Likewise.
* t/backcompat3.sh: Likewise.
* t/backcompat6.sh: Likewise.
* t/list-of-tests.mk: Adjust.

Suggested-by: Bob Friesenhahn n<bfriesen@simple.dallas.tx.us>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
m4/init.m4
t/aminit-moreargs-deprecation.sh [moved from t/aminit-moreargs-no-more.sh with 73% similarity]
t/backcompat.sh [new file with mode: 0755]
t/backcompat2.sh [new file with mode: 0755]
t/backcompat3.sh [new file with mode: 0755]
t/backcompat6.sh [new file with mode: 0755]
t/list-of-tests.mk
t/nodef.sh [new file with mode: 0755]

diff --git a/NEWS b/NEWS
index 59b86ea..5490e72 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,11 +7,6 @@ New in 1.13:
   - The rules to build PDF and DVI output from Texinfo input now
     requires Texinfo 4.9 or later.
 
-* Obsolete features removed:
-
-  - Use of the long-deprecated two- and three-arguments invocation forms
-    of the AM_INIT_AUTOMAKE is not supported anymore.
-
   - Support for the "Cygnus-style" trees (once enabled by the 'cygnus'
     option) has been removed.  See discussion about automake bug#11034
     for more background.
@@ -44,6 +39,16 @@ New in 1.13:
 
   - All the "old alias" macros in 'm4/obsolete.m4' have been removed.
 
+* Obsolescent features:
+
+  - Use of the long-deprecated two- and three-arguments invocation forms
+    of the AM_INIT_AUTOMAKE is not documented anymore.  It's still
+    supported though (albeit with a warning in the 'obsolete' category),
+    to cater for people who want to define the version number for their
+    package dynamically (e.g., from the current VCS revision).  We'll
+    have to continue this support until Autoconf itself is fixed to allow
+    better support for such dynamic version numbers.
+
 * Elisp byte-compilation:
 
   - The byte compilation of '.el' files into '.elc' files is now done
index 1d5dffd..fc05148 100644 (file)
@@ -9,8 +9,17 @@
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
 
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 # AM_INIT_AUTOMAKE([OPTIONS])
-# ---------------------------
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
 [AC_PREREQ([2.65])dnl
 dnl Autoconf wants to disallow AM_ names.  We explicitly allow
@@ -39,18 +48,21 @@ fi
 AC_SUBST([CYGPATH_W])
 
 # Define the identity of the package.
-dnl Error out on old-style AM_INIT_AUTOMAKE calls.
-m4_ifval([$2], [m4_fatal(
-[$0: old-style two- and three-arguments forms are now unsupported.  For more info:
-http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])])
-_AM_SET_OPTIONS([$1])dnl
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[AC_DIAGNOSE([obsolete],
+             [$0: two- and three-arguments forms are deprecated.])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
 m4_if(
   m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
   [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
 [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
similarity index 73%
rename from t/aminit-moreargs-no-more.sh
rename to t/aminit-moreargs-deprecation.sh
index ce30c29..a8d4605 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check that automake error out (with an helpful error message) against
-# old-style usages of AM_INIT_AUTOMAKE (i.e., calls with two or three
-# arguments).
+# Check that automake warns against old-style usages of AM_INIT_AUTOMAKE
+# (i.e., calls with two or three arguments).
 
 . ./defs || exit 1
 
-warn_rx='AM_INIT_AUTOMAKE.* old-style two-.* three-arguments form.*unsupported'
-
-$ACLOCAL
-mv aclocal.m4 aclocal.sav
+warn_rx='AM_INIT_AUTOMAKE.* two-.* three-arguments form.*deprecated'
 
 cat > configure.ac <<'END'
 AC_INIT([Makefile.am])
@@ -31,14 +27,16 @@ AM_INIT_AUTOMAKE([twoargs], [1.0])
 AC_CONFIG_FILES([Makefile])
 END
 
+$ACLOCAL
+
 do_check()
 {
   rm -rf autom4te*.cache
-  for cmd in "$ACLOCAL" "$AUTOCONF" "$AUTOMAKE"; do
-    cp aclocal.sav aclocal.m4
-    $cmd -Wnone -Wno-error 2>stderr && { cat stderr; exit 1; }
+  for cmd in "$AUTOCONF" "$AUTOMAKE"; do
+    $cmd -Werror -Wnone -Wobsolete 2>stderr && { cat stderr; exit 1; }
     cat stderr >&2
     grep "^configure\.ac:2:.*$warn_rx" stderr
+    $cmd -Werror -Wall -Wno-obsolete || exit 1
   done
 }
 
diff --git a/t/backcompat.sh b/t/backcompat.sh
new file mode 100755 (executable)
index 0000000..fa83687
--- /dev/null
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2010-2012 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 or three arguments, for
+# backward-compatibility.
+
+. ./defs || exit 1
+
+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
+    unindent > 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 # For debugging.
+    $ACLOCAL
+    $AUTOCONF
+    $AUTOMAKE -Wno-obsolete
+    ./configure
+    $MAKE test
+  done
+done
+
+:
diff --git a/t/backcompat2.sh b/t/backcompat2.sh
new file mode 100755 (executable)
index 0000000..109483b
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 2010-2012 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.
+
+am_create_testdir=empty
+. ./defs || exit 1
+
+# 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.ac
+$ACLOCAL
+rm -rf configure.ac autom4te.*
+
+touch install-sh missing
+
+cat > config.h.in <<'END'
+#undef PACKAGE
+#undef VERSION
+END
+
+for am_arg3 in ':' 'false' '#' ' '; do
+  unindent > configure.ac <<END
+    AC_INIT
+    AC_CONFIG_HEADERS([config.h])
+    AM_INIT_AUTOMAKE([pkgname], [pkgversion], [$am_arg3])
+    AC_OUTPUT
+END
+  cat configure.ac # For debugging.
+  $AUTOCONF
+  ./configure
+  cat config.h # 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
+  # This is required because even relatively-recent versions of the
+  # BSD shell wrongly exit when the 'errexit' shell flag is active if
+  # the last command of a compound statement fails, even if it should
+  # be protected by the use of "&&".
+  :
+done
+
+for am_extra_args in '' ',' ', []'; do
+  unindent > configure.ac <<END
+    AC_INIT
+    AC_CONFIG_HEADERS([config.h])
+    AM_INIT_AUTOMAKE([pkgname], [pkgversion]$am_extra_args)
+    AC_OUTPUT
+END
+  cat configure.ac # For debugging.
+  $AUTOCONF
+  ./configure
+  cat config.h # For debugging.
+  grep '^ *# *define  *PACKAGE  *"pkgname" *$' config.h
+  grep '^ *# *define  *VERSION  *"pkgversion" *$' config.h
+done
+
+:
diff --git a/t/backcompat3.sh b/t/backcompat3.sh
new file mode 100755 (executable)
index 0000000..26ea7d4
--- /dev/null
@@ -0,0 +1,147 @@
+#! /bin/sh
+# Copyright (C) 2010-2012 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.
+
+am_create_testdir=empty
+. ./defs || exit 1
+
+empty=''
+
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+
+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.ac <<END
+AC_INIT([ac_name], [ac_version])
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.ac
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./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.ac <<'END'
+AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
+        [ac_url])],
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.ac
+
+$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.ac <<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.ac
+
+$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/t/backcompat6.sh b/t/backcompat6.sh
new file mode 100755 (executable)
index 0000000..9fc4946
--- /dev/null
@@ -0,0 +1,104 @@
+#! /bin/sh
+# Copyright (C) 2010-2012 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 Automake.
+# See also the similar test 'backcompat5.test'.
+
+required=cc
+am_create_testdir=empty
+. ./defs || exit 1
+
+# Anyone doing something like this in a real-life package probably
+# deserves to be killed.
+cat > configure.ac <<'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)
+AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = yes)
+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
+check-local:
+       test x'$(PACKAGE)' = x'nonesuch-zardoz'
+       test x'$(VERSION)' = x'nonesuch-0.1'
+if ! CROSS_COMPILING
+       ./foo
+## Do not anchor the regexps w.r.t. the end of line, because on
+## MinGW/MSYS, grep may assume LF line endings only, while our
+## 'foo' program may generate CRLF line endings.
+       ./foo | grep '^PACKAGE = nonesuch-zardoz!'
+       ./foo | echo '^VERSION = nonesuch-0\.1!'
+endif
+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 -Wno-obsolete --add-missing
+$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
+
+:
index a299262..2706e95 100644 (file)
@@ -124,7 +124,7 @@ t/alpha2.sh \
 t/amhello-cflags.sh \
 t/amhello-cross-compile.sh \
 t/amhello-binpkg.sh \
-t/aminit-moreargs-no-more.sh \
+t/aminit-moreargs-deprecation.sh \
 t/amassign.sh \
 t/am-macro-not-found.sh \
 t/amopt.sh \
@@ -172,6 +172,10 @@ t/auxdir-computed.tap \
 t/auxdir-misplaced.sh \
 t/auxdir-nonexistent.sh \
 t/auxdir-unportable.tap \
+t/backcompat.sh \
+t/backcompat2.sh \
+t/backcompat3.sh \
+t/backcompat6.sh \
 t/backcompat-acout.sh \
 t/backsl.sh \
 t/backsl2.sh \
@@ -688,6 +692,7 @@ t/nobase.sh \
 t/nobase-libtool.sh \
 t/nobase-python.sh \
 t/nobase-nodist.sh \
+t/nodef.sh \
 t/nodef2.sh \
 t/nodep.sh \
 t/nodep2.sh \
diff --git a/t/nodef.sh b/t/nodef.sh
new file mode 100755 (executable)
index 0000000..979b906
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2002-2012 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/>.
+
+# Make sure that PACKAGE and VERSION are AC_DEFINEd when requested.
+
+. ./defs || exit 1
+
+# -------------------------------------------------------------------
+# Do not upgrade this file to use the modern AC_INIT/AM_INIT_AUTOMAKE
+# forms.  The day these obsolete AC_INIT and AM_INIT_AUTOMAKE forms
+# are dropped, just erase the file.
+# nodef2.test contains the modern version of this test.
+# -------------------------------------------------------------------
+
+# First, check that PACKAGE and VERSION are output by default.
+
+cat > configure.ac << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE([UnIqUe_PaCkAgE], [UnIqUe_VeRsIoN])
+AC_OUTPUT(output)
+END
+
+echo 'DEFS = @DEFS@' > output.in
+
+$ACLOCAL
+$AUTOCONF
+./configure
+
+grep 'DEFS.*-DVERSION=\\"UnIqUe' output
+
+# Then, check that PACKAGE and VERSION are not output if requested.
+
+cat > configure.ac << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE([UnIqUe_PaCkAgE], [UnIqUe_VeRsIoN], [no])
+AC_OUTPUT(output)
+END
+
+$ACLOCAL
+$AUTOCONF
+./configure
+
+grep 'DEFS.*-DVERSION=\\"UnIqUe' output && exit 1
+
+: