From 57c720096a413b5cb11acd4efb4fbe43a521ffba Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Fri, 19 Apr 2013 18:40:49 +0200 Subject: [PATCH] compat: reinstate support for obsolete $(INCLUDES) variable 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: 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 Signed-off-by: Stefano Lattarini --- NEWS | 3 --- automake.in | 25 +++++++++++-------- doc/automake.texi | 14 ++++++++--- ...des-no-more.sh => includes-deprecation.sh} | 17 ++++++++++--- t/list-of-tests.mk | 2 +- t/warnopts.sh | 8 ++---- 6 files changed, 41 insertions(+), 28 deletions(-) rename t/{includes-no-more.sh => includes-deprecation.sh} (67%) diff --git a/NEWS b/NEWS index 6f163800a..fb70eee87 100644 --- 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 diff --git a/automake.in b/automake.in index 4275b57ea..0dcf06bef 100644 --- a/automake.in +++ b/automake.in @@ -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); diff --git a/doc/automake.texi b/doc/automake.texi index deb96d3a4..ec17160d8 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -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 diff --git a/t/includes-no-more.sh b/t/includes-deprecation.sh similarity index 67% rename from t/includes-no-more.sh rename to t/includes-deprecation.sh index 4867ee5a5..ec54359ae 100755 --- a/t/includes-no-more.sh +++ b/t/includes-deprecation.sh @@ -14,19 +14,28 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# 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 : diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index c0fe1bd1e..1c069efff 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -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 \ diff --git a/t/warnopts.sh b/t/warnopts.sh index 7e1a2d564..f1c4c8c34 100755 --- a/t/warnopts.sh +++ b/t/warnopts.sh @@ -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 < t +mv -f t configure.ac $ACLOCAL $AUTOMAKE -- 2.47.2