Subject: [PATCH 1/2] cygnus: warn when it's used (flagged as 'obsolete' now)

From: Stefano Lattarini <[email-masked]>
Date: Mon, 30 Apr 2012 18:45:42 +0200

Support for "Cygnus-style" tree as enabled by the 'cygnus'
option is now reported as obsolete when the warnings in the
'obsolete' category are enabled.

See automake bug#11034.

* automake.in (check_cygnus): Report the use of 'cygnus' mode as
obsolete.
* NEWS: Update.
* docs/automake.texi: Minor adjustments.
* t/cygnus-deprecation.sh: New test.
* t/list-of-tests.mk: Add it.
* tests/cygnus-check-without-all.sh: Adjust by calling automake
with the warnings in the 'obsolete' category disabled.
* t/cygnus-requires-maintainer-mode.sh: Likewise.
* t/cygnus-dependency-tracking.sh: Likewise.
* t/cygnus-imply-foreign.sh: Likewise.
* t/cygnus-no-installinfo.sh: Likewise.
* t/cygnus-no-dist.sh: Likewise.
* t/clean2.sh: Likewise.
* t/flavor.sh: Likewise.
* t/txinfo5.sh: Likewise.
* t/txinfo5b.sh: Likewise.
* t/library.sh: Remove use of 'cygnus' and 'dejagnu' options,
and of AM_MAINTAINER_MODE macro.

Signed-off-by: Stefano Lattarini <[email-masked]>
---
 NEWS                                 |   14 +++++--
 automake.in                          |    5 +++
 doc/automake.texi                    |   12 +++---
 t/clean2.sh                          |    2 +-
 t/cygnus-check-without-all.sh        |    2 +-
 t/cygnus-dependency-tracking.sh      |    1 +
 t/cygnus-deprecation.sh              |   68 ++++++++++++++++++++++++++++++++++
 t/cygnus-no-dist.sh                  |    4 +-
 t/cygnus-no-installinfo.sh           |    6 ++-
 t/cygnus-requires-maintainer-mode.sh |    6 +--
 t/flavor.sh                          |   22 ++++++++++-
 t/library.sh                         |    2 -
 t/list-of-tests.mk                   |    1 +
 t/txinfo5.sh                         |    2 +-
 t/txinfo5b.sh                        |    5 ++-
 15 files changed, 127 insertions(+), 25 deletions(-)
 create mode 100755 t/cygnus-deprecation.sh

diff --git a/NEWS b/NEWS
index 4e49512..bc867c4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,13 @@
+New in 1.12.1:
+
+* Deprecated obsolescent features:
+
+  - Support for the "Cygnus-style" trees (enabled by the 'cygnus' option) is
+    now deprecated (its use triggers a warning in the 'obsolete' category).
+    It will be removed in the next major Automake release (1.13).
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 New in 1.12:
 
 * WARNING: Future backward-incompatibilities!
@@ -32,10 +42,6 @@ New in 1.12:
   - All the "old alias" macros in 'm4/obsolete.m4' will be removed in
     the next major Automake version (1.13).
 
-  - Support for the "Cygnus-style" trees (enabled by the 'cygnus' option)
-    will be deprecated in the next minor version of Automake (1.12.1) and
-    removed in the next major version (1.13).
-
   - Support for the two- and three-arguments invocation forms of the
     AM_INIT_AUTOMAKE macro will be deprecated in the next minor version
     of Automake (1.12.1) and removed in the next major version (1.13).
diff --git a/automake.in b/automake.in
index a454109..d5b8e43 100644
--- a/automake.in
+++ b/automake.in
@@ -5570,6 +5570,11 @@ sub check_cygnus
   my $cygnus = option 'cygnus';
   return unless $cygnus;
 
+  # This feature is deprecated, will be removed in the next
+  # Automake major release.
+  msg 'obsolete', $cygnus->get,
+      "support for Cygnus-style trees is deprecated";
+
   set_strictness ('foreign');
   set_option ('no-installinfo', $cygnus);
   set_option ('no-dependencies', $cygnus);
diff --git a/doc/automake.texi b/doc/automake.texi
index c21a5b7..045964f 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -1958,9 +1958,9 @@ Automake also has a special (and @emph{today deprecated}) ``cygnus'' mode
 that is similar to strictness but handled differently.  This mode is
 useful for packages that are put into a ``Cygnus'' style tree (e.g., older
 versions of the GCC and gdb trees).  @xref{Cygnus}, for more information
-on this mode.  Please note that this mode is deprecated and @emph{will be
-removed in the future automake versions}; you must avoid its use in new
-packages, and should stop using it in existing packages as well.
+on this mode.  Please note that this mode @emph{is deprecated and will be
+removed in the next major Automake release (1.13)}; you must avoid its use
+in new packages, and should stop using it in existing packages as well.

 @node Uniform
@@ -2604,7 +2604,7 @@ copied.  The default is to make a symbolic link.
 Causes the generated @file{Makefile.in}s to follow Cygnus rules, instead
 of GNU or Gnits rules.  For more information, see @ref{Cygnus}.
 Note that @emph{this mode of operation is deprecated, and will be removed}
-in a future Automake release.
+in the next major Automake release (1.13).
 
 @item -f
 @opindex -f
@@ -11026,8 +11026,8 @@ The file @file{THANKS} is required.
 
 @emph{The features described in this section are deprecated; you must
 not use any of them in new code, and should remove their use from older
-but still maintained code: they will be withdrawn in a future Automake
-release.}
+but still maintained code: they will be withdrawn the next major Automake
+release (1.13).}
 
 Some packages, notably GNU GCC and GNU gdb, used to have a build
 environment originally written at Cygnus Support (subsequently renamed
diff --git a/t/clean2.sh b/t/clean2.sh
index 2599e97..b5f5df2 100755
--- a/t/clean2.sh
+++ b/t/clean2.sh
@@ -49,7 +49,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 ./configure
 $MAKE
diff --git a/t/cygnus-check-without-all.sh b/t/cygnus-check-without-all.sh
index f428e95..121c657 100755
--- a/t/cygnus-check-without-all.sh
+++ b/t/cygnus-check-without-all.sh
@@ -33,7 +33,7 @@ check-local:
 END
 
 $ACLOCAL
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 $EGREP '(^| )all.*(:|:.* )check' Makefile.in && Exit 1
 
diff --git a/t/cygnus-dependency-tracking.sh b/t/cygnus-dependency-tracking.sh
index f07c6fc..6c858c1 100755
--- a/t/cygnus-dependency-tracking.sh
+++ b/t/cygnus-dependency-tracking.sh
@@ -27,6 +27,7 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = -Wno-obsolete
 bin_PROGRAMS = foo
 foo_SOURCES = foo.c
 .PHONY: test-nodeps
diff --git a/t/cygnus-deprecation.sh b/t/cygnus-deprecation.sh
new file mode 100755
index 0000000..779914b
--- /dev/null
+++ b/t/cygnus-deprecation.sh
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that support for Cygnus-style trees is deprecated.
+# That feature will be removed in the next major Automake release.
+# See automake bug#11034.
+
+. ./defs || Exit 1
+
+warn_rx='support for Cygnus.*trees.*deprecated'
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AM_MAINTAINER_MODE
+END
+
+$ACLOCAL
+$AUTOCONF
+
+: > Makefile.am
+
+# 'cygnus' option from command line
+$AUTOMAKE --cygnus -Wno-obsolete
+AUTOMAKE_fails --cygnus
+grep "^automake.*: .*$warn_rx" stderr
+AUTOMAKE_fails -Wnone -Wobsolete --cygnus
+grep "^automake.*: .*$warn_rx" stderr
+AUTOMAKE_fails --cygnus -Wnone -Wobsolete
+grep "^automake.*: .*$warn_rx" stderr
+
+rm -rf autom4te*.cache
+
+# 'cygnus' option in Makefile.am
+echo "AUTOMAKE_OPTIONS = cygnus" > Makefile.am
+cat Makefile.am # For debugging.
+$AUTOMAKE -Wno-obsolete
+AUTOMAKE_fails
+grep "^Makefile\.am:1:.*$warn_rx" stderr
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^Makefile\.am:1:.*$warn_rx" stderr
+
+rm -rf autom4te*.cache
+
+# 'cygnus' option in configure.ac
+: > Makefile.am
+sed "s|^\\(AM_INIT_AUTOMAKE\\).*|\1([cygnus])|" configure.ac > t
+diff configure.ac t && fatal_ "failed to edit configure.ac"
+mv -f t configure.ac
+$AUTOMAKE -Wno-obsolete
+AUTOMAKE_fails
+grep "^configure\.ac:2:.*$warn_rx" stderr
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^configure\.ac:2:.*$warn_rx" stderr
+
+:
diff --git a/t/cygnus-no-dist.sh b/t/cygnus-no-dist.sh
index 519f0c2..d94a8f5 100755
--- a/t/cygnus-no-dist.sh
+++ b/t/cygnus-no-dist.sh
@@ -29,7 +29,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 ./configure
 $MAKE
@@ -55,6 +55,8 @@ cat > sub2/Makefile.am <<'END'
 # in override warnings, for when (below) we add the 'distdir'
 # target.
 AUTOMAKE_OPTIONS = cygnus -Wall
+# This is required because the 'cygnus' option is now deprecated.
+AUTOMAKE_OPTIONS += -Wno-obsolete
 END
 
 cat configure.stub - > configure.ac <<'END'
diff --git a/t/cygnus-no-installinfo.sh b/t/cygnus-no-installinfo.sh
index 6f3f322..d46b6b3 100755
--- a/t/cygnus-no-installinfo.sh
+++ b/t/cygnus-no-installinfo.sh
@@ -33,9 +33,11 @@ cat > foo.texi <<'END'
 END
 
 $ACLOCAL
-# FIXME: -Wno-override works around a buglet in definition of $(MAKEINFO)
+# -Wno-override works around a buglet in definition of $(MAKEINFO)
 # in cygnus mode; see also xfailing test 'txinfo5.test'.
-$AUTOMAKE --cygnus -Wno-override
+# -Wno-obsolete accounts for the fact that the cygnus mode is now
+# deprecated.
+$AUTOMAKE --cygnus -Wno-override -Wno-obsolete
 $AUTOCONF
 
 cwd=`pwd` || Exit 1
diff --git a/t/cygnus-requires-maintainer-mode.sh b/t/cygnus-requires-maintainer-mode.sh
index b01dfbc..546e898 100755
--- a/t/cygnus-requires-maintainer-mode.sh
+++ b/t/cygnus-requires-maintainer-mode.sh
@@ -21,7 +21,7 @@
 : > Makefile.am
 
 $ACLOCAL
-AUTOMAKE_fails --cygnus
+AUTOMAKE_fails -Wno-obsolete --cygnus
 grep '^configure\.ac:.*AM_MAINTAINER_MODE.*required.*cygnus' stderr
 
 cat >> configure.ac <<'END'
@@ -34,7 +34,7 @@ END
 
 mkdir sub
 cat > sub/Makefile.am <<'END'
-AUTOMAKE_OPTIONS = cygnus
+AUTOMAKE_OPTIONS = -Wno-obsolete cygnus
 END
 
 rm -rf autom4te.cache
@@ -48,6 +48,6 @@ END
 
 rm -rf autom4te.cache
 $ACLOCAL
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 :
diff --git a/t/flavor.sh b/t/flavor.sh
index f532406..6a1fddb 100755
--- a/t/flavor.sh
+++ b/t/flavor.sh
@@ -35,8 +35,8 @@ END
 $ACLOCAL
 $AUTOCONF
 # Order flavors so that all needed files are installed early.
-for flavor in --gnits --gnu --foreign --cygnus --ignore-deps
-do
+for flavor in --gnits --gnu --foreign --ignore-deps; do
+
   $AUTOMAKE --add-missing $flavor
   ./configure --enable-maintainer-mode
   grep " $flavor" Makefile
@@ -54,6 +54,24 @@ do
   touch Makefile.am
   $MAKE
   grep " $flavor" Makefile
+
 done
 
+# Cygnus mode is deprecated now, and must be handled separately.
+$AUTOMAKE --cygnus -Wno-obsolete
+./configure --enable-maintainer-mode
+grep " --cygnus" Makefile
+$MAKE
+# Two code paths in configure.am:
+# - either a file in $(am__configure_deps) has been updated ...
+$sleep
+touch aclocal.m4
+$MAKE
+grep " --cygnus" Makefile
+# - ... or not; i.e., Makefile.am or an included file has.
+$sleep
+touch Makefile.am
+$MAKE
+grep " --cygnus" Makefile
+
 :
diff --git a/t/library.sh b/t/library.sh
index dffe658..1bf34de 100755
--- a/t/library.sh
+++ b/t/library.sh
@@ -20,13 +20,11 @@
 
 cat >> configure.ac << 'END'
 AC_PROG_RANLIB
-AM_MAINTAINER_MODE
 AC_PROG_CC
 AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = dejagnu cygnus
 lib_LIBRARIES = libfoo.a
 libfoo_a_DEPENDENCIES = libzot.a
 END
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index fef7165..5b6f746 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -330,6 +330,7 @@ t/cxxlibobj.sh \
 t/cxxlink.sh \
 t/cxxnoc.sh \
 t/cxxo.sh \
+t/cygnus-deprecation.sh \
 t/cygnus-check-without-all.sh \
 t/cygnus-dependency-tracking.sh \
 t/cygnus-imply-foreign.sh \
diff --git a/t/txinfo5.sh b/t/txinfo5.sh
index 9e42823..d515617 100755
--- a/t/txinfo5.sh
+++ b/t/txinfo5.sh
@@ -33,6 +33,6 @@ END
 echo '@setfilename ian.info' > ian.texi
 
 $ACLOCAL
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 :
diff --git a/t/txinfo5b.sh b/t/txinfo5b.sh
index c4eac53..a99f607 100755
--- a/t/txinfo5b.sh
+++ b/t/txinfo5b.sh
@@ -25,9 +25,10 @@ AM_MAINTAINER_MODE
 END
 
 cat > Makefile.am << 'END'
-# Disable 'override' warning to work around an unrelated
+# Disable 'override' warnings to work around an unrelated
 # texi+cygnus bug.
-AUTOMAKE_OPTIONS = -Wno-override
+# Disable obsolete warnings because the 'cygnus' mode is now deprecated.
+AUTOMAKE_OPTIONS = -Wno-override -Wno-obsolete
 info_TEXINFOS = ian.texi
 END
 
-- 
1.7.9.5