]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
compat: reinstate support for obsolete $(INCLUDES) variable
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 19 Apr 2013 16:40:49 +0000 (18:40 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 19 Apr 2013 17:26:31 +0000 (19:26 +0200)
Since INCLUDES and AM_CPPFLAGS can be both used at the same time in a
single project, and interact in a non-obvious way, switching away from
INCLUDES is, unfortunately, not simply a matter of doing a mindless
INCLUDES -> AM_CPPFLAGS substitution.  In fact, the transition from a
"INCLUDES + CPPFLAGS" setup to a "AM_CPPFLAGS only" setup could cause
subtle bugs to sneak into the build systems of the client packages
doing the transition.  Forcing this risk upon our users is definitely
not worth the small enhancement in consistency and cleanliness that
the removal of INCLUDES would give us.

For a more extended rationale and related discussions, see:
<http://lists.gnu.org/archive/html/automake/2013-02/msg00001.html>

This change basically reverts commit v1.13-8-g880595d.

* automake.in: Re-introduce support for INCLUDES (its use will cause
warnings in the 'obsolete' category rather than fatal errors).
* doc/automake.texi: Adjust to re-add mention of INCLUDES.
* t/includes-no-more.sh: Rename ...
* t/includes-deprecation.sh: ... like this, and adjust.
* t/list-of-tests.mk: Update.
* t/warnopts.sh: Minor fixlet while at it.

Suggested-by: Peter Rosin <peda@lysator.liu.se>
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
automake.in
doc/automake.texi
t/includes-deprecation.sh [moved from t/includes-no-more.sh with 67% similarity]
t/list-of-tests.mk
t/warnopts.sh

diff --git a/NEWS b/NEWS
index 6f163800aea4c959daa8d5915437ff42cbbdef58..fb70eee87d285ba04f40ef93cb95738a6176aef8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -30,9 +30,6 @@ New in 2.0:
     been removed.  It should be safe to simply remove any definition
     of it you have in your Makefiles.
 
-  - Support for the long-obsolete $(INCLUDES) variable has been finally
-    removed, in favour of the modern equivalent $(AM_CPPFLAGS).
-
 * Removed support for obsolete platforms:
 
   - Support for automatic dependency tracking with the SGI C/C++ compilers
index 4275b57ea0b3dcc35b350e3efef425005c44dc3e..0dcf06beff7e111a85297f5b498a30675f855544 100644 (file)
@@ -604,6 +604,7 @@ my @cpplike_flags =
   qw{
     $(DEFS)
     $(DEFAULT_INCLUDES)
+    $(INCLUDES)
     $(AM_CPPFLAGS)
     $(CPPFLAGS)
   };
@@ -790,9 +791,9 @@ register_language ('name' => 'asm',
                   'config_vars' => ['CCAS', 'CCASFLAGS'],
 
                   'flags' => ['CCASFLAGS'],
-                  # Users can set AM_CCASFLAGS to include $(DEFS) or
-                  # or anything else required.  They can also set CCAS.
-                  # Or simply use Preprocessed Assembler.
+                  # Users can set AM_CCASFLAGS to include $(DEFS),
+                   # $(INCLUDES), or anything else required.  They can also
+                   # set CCAS.  Or simply use Preprocessed Assembler.
                   'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)',
                   'ccer' => 'CCAS',
                   'compiler' => 'CCASCOMPILE',
@@ -871,9 +872,9 @@ register_language ('name' => 'ppfc',
 # Preprocessed Fortran 77
 #
 # The current support for preprocessing Fortran 77 just involves
-# passing "$(DEFS) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)"
-# as additional flags to the Fortran 77 compiler, since this is
-# how GNU Make does it; see the "GNU Make Manual, Edition 0.51
+# passing "$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS)
+# $(CPPFLAGS)" as additional flags to the Fortran 77 compiler, since
+# this is how GNU Make does it; see the "GNU Make Manual, Edition 0.51
 # for 'make' Version 3.76 Beta" (specifically, from info file
 # '(make)Catalogue of Rules').
 #
@@ -7724,14 +7725,18 @@ sub generate_makefile
     }
 
   # Catch some obsolete variables.
-  reject_var 'INCLUDES', "'INCLUDES' is the obsolete name for " .
-                         "'AM_CPPFLAGS' (or '*_CPPFLAGS')";
-  if (my $amflags = var ('ACLOCAL_AMFLAGS'))
+  if (my $ovar = var ('ACLOCAL_AMFLAGS'))
     {
-      msg_var 'obsolete', $amflags,
+      msg_var 'obsolete', $ovar,
               "'ACLOCAL_AMFLAGS' is deprecated; use 'AC_CONFIG_MACRO_DIRS'"
               . " in configure.ac instead";
     }
+  if (my $ovar = var ('INCLUDES'))
+    {
+      msg_var 'obsolete', $ovar,
+              "'INCLUDES' is deprecated; you should use 'AM_CPPFLAGS'"
+              . " (or '*_CPPFLAGS') instead"
+    }
 
   # Must do this after reading .am file.
   define_variable ('subdir', $relative_dir, INTERNAL);
index deb96d3a4780ca496a340776388ed6014f450879..ec17160d802b2e77cbf68515db8c5c111c9510c5 100644 (file)
@@ -6117,6 +6117,12 @@ files in the source directory are ignored.
 @code{AM_CPPFLAGS} is ignored in preference to a per-executable (or
 per-library) @code{_CPPFLAGS} variable if it is defined.
 
+@item INCLUDES
+This does the same job as @code{AM_CPPFLAGS} (or any per-target
+@code{_CPPFLAGS} variable if it is used).  It is an older name for the
+same functionality.  This variable is deprecated; we suggest using
+@code{AM_CPPFLAGS} and per-target @code{_CPPFLAGS} instead.
+
 @item AM_CFLAGS
 This is the variable the @file{Makefile.am} author can use to pass
 in additional C compiler flags.  In some situations, this is
@@ -6449,8 +6455,8 @@ assembly code.  This compiler must work a bit like a C compiler; in
 particular it must accept @option{-c} and @option{-o}.  The values of
 @code{CCASFLAGS} and @code{AM_CCASFLAGS} (or its per-target
 definition) is passed to the compilation.  For preprocessed files,
-@code{DEFS}, @code{DEFAULT_INCLUDES}, @code{CPPFLAGS} and
-@code{AM_CPPFLAGS} are also used.
+@code{DEFS}, @code{DEFAULT_INCLUDES}, @code{INCLUDES}, @code{CPPFLAGS}
+and @code{AM_CPPFLAGS} are also used.
 
 The autoconf macro @code{AM_PROG_AS} will define @code{CCAS} and
 @code{CCASFLAGS} for you (unless they are already set, it simply sets
@@ -6539,7 +6545,7 @@ command used is as follows:
 @table @file
 
 @item .F
-@code{$(F77) -F $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS)@*
+@code{$(F77) -F $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@*
 $(AM_FFLAGS) $(FFLAGS)}
 
 @item .r
@@ -6562,7 +6568,7 @@ is as follows:
 @code{$(F77) -c $(AM_FFLAGS) $(FFLAGS)}
 
 @item .F
-@code{$(F77) -c $(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS)@*
+@code{$(F77) -c $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)@*
 $(AM_FFLAGS) $(FFLAGS)}
 
 @item .r
similarity index 67%
rename from t/includes-no-more.sh
rename to t/includes-deprecation.sh
index 4867ee5a58f2ba24eb9af7cc02fd9f77220d794e..ec54359aece702cd348f5e03490f7ca715de58ec 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/>.
 
-# Support for $(INCLUDES) has been removed.
+# Support for $(INCLUDES) is deprecated.
 
 . test-init.sh
 
 echo AC_PROG_CC >> configure.ac
 
+$ACLOCAL
+
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 INCLUDES = -DFOO
 END
 
-$ACLOCAL
-AUTOMAKE_fails -Wnone -Wno-error
-grep "^Makefile\\.am:2:.* 'INCLUDES'.* obsolete.* 'AM_CPPFLAGS'" stderr
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^Makefile\\.am:2:.* 'INCLUDES'.* deprecated.* 'AM_CPPFLAGS'" stderr
+AUTOMAKE_run -Wall -Wno-obsolete
+test ! -s stderr
+
+echo 'AC_SUBST([INCLUDES])' >> configure.ac
+sed '/^INCLUDES/d' Makefile.am > t && mv -f t Makefile.am
+
+AUTOMAKE_run -Wno-error
+grep "^configure\\.ac:5:.* 'INCLUDES'.* deprecated.* 'AM_CPPFLAGS'" stderr
 
 :
index c0fe1bd1e108dbf57cef892844b11a51e07883f7..1c069efff1e597936482dc2791819e7310496e32 100644 (file)
@@ -500,7 +500,7 @@ t/help-silent.sh \
 t/help-upc.sh \
 t/hfs.sh \
 t/implicit.sh \
-t/includes-no-more.sh \
+t/includes-deprecation.sh \
 t/init.sh \
 t/init2.sh \
 t/insh2.sh \
index 7e1a2d5648ca4cb03a6bb40f84e1371de814d5f7..f1c4c8c34264501b9cc26a55bcca6043185318cf 100755 (executable)
@@ -63,12 +63,8 @@ test $(grep -v 'warnings are treated as errors' stderr | wc -l) = 3
 rm -rf autom4te*.cache
 
 # If we add a global -Wnone, all warnings should disappear.
-cat >configure.ac <<END
-AC_INIT([warnopts], [1.0])
-AM_INIT_AUTOMAKE([-Wnone])
-AC_CONFIG_FILES([Makefile sub/Makefile])
-AC_OUTPUT
-END
+sed 's/^AM_INIT_AUTOMAKE/AM_INIT_AUTOMAKE([-Wnone])/' configure.ac > t
+mv -f t configure.ac
 $ACLOCAL
 $AUTOMAKE