From c975987c646797db459fd4c23a5e82877c79f46f Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sat, 10 Nov 2007 10:20:08 +0100 Subject: [PATCH] Fix default includes ordering to be `-I. -I$(srcdir) ...' again. * automake.in (handle_compile): Put -I$(srcdir) before include paths for config headers, as was done before Automake 1.10, but keep uniquified list without multiple adjacent spaces. * doc/automake.texi (Program variables): List include paths in order. * NEWS: Mention 1.10 regression. * tests/stdinc.test: New test. * tests/Makefile.am: Adjust. * THANKS: Update. Report by Kent Boortz. --- ChangeLog | 18 +++++++++++-- NEWS | 3 +++ THANKS | 1 + automake.in | 7 ++--- doc/automake.texi | 4 +-- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/stdinc.test | 67 +++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 95 insertions(+), 7 deletions(-) create mode 100755 tests/stdinc.test diff --git a/ChangeLog b/ChangeLog index 22cab109d..fa941b46b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,20 @@ +2007-11-10 Ralf Wildenhues + + Fix default includes ordering to be `-I. -I$(srcdir) ...' again. + * automake.in (handle_compile): Put -I$(srcdir) before include + paths for config headers, as was done before Automake 1.10, but + keep uniquified list without multiple adjacent spaces. + * doc/automake.texi (Program variables): List include paths + in order. + * NEWS: Mention 1.10 regression. + * tests/stdinc.test: New test. + * tests/Makefile.am: Adjust. + * THANKS: Update. + Report by Kent Boortz. + 2007-11-08 Akim Demaille - Ralf Wildenhues - Bob Proulx + Ralf Wildenhues + Bob Proulx Implement colorized test output. * automake.in (handle_tests): Set COLOR depending on `color-tests'. diff --git a/NEWS b/NEWS index 79a3deac1..d4f81b11f 100644 --- a/NEWS +++ b/NEWS @@ -64,6 +64,9 @@ Bugs fixed in 1.10a: - $(EXEEXT) is automatically appended to filenames of XFAIL_TESTS that have been declared as programs in the same Makefile. This is for consistency with the analogous change to TESTS in 1.10. + + - Fix order of standard includes to again be `-I. -I$(srcdir)', + followed by directories containing config headers. New in 1.10: diff --git a/THANKS b/THANKS index 0e031c251..4533fb550 100644 --- a/THANKS +++ b/THANKS @@ -152,6 +152,7 @@ Julien Sopena julien.sopena@lip6.fr Karl Berry kb@cs.umb.edu Karl Heuer kwzh@gnu.org Kelley Cook kcook@gcc.gnu.org +Kent Boortz kent@mysql.com Kevin Dalley kevin@aimnet.com Kevin P. Fleming. kpfleming@cox.net Kevin Ryde user42@zip.com.au diff --git a/automake.in b/automake.in index 127a6072b..ee1391fa4 100755 --- a/automake.in +++ b/automake.in @@ -2312,7 +2312,7 @@ sub handle_compile () my $default_includes = ''; if (! option 'nostdinc') { - my @incs = ('-I.'); + my @incs = ('-I.', subst ('am__isrc')); my $var = var 'CONFIG_HEADER'; if ($var) @@ -2326,8 +2326,9 @@ sub handle_compile () # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@` # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'. # Items in CONFIG_HEADER are never in $(srcdir) so it is safe - # to just append @am__isrc@. - $default_includes = ' ' . uniq (@incs) . subst ('am__isrc'); + # to just put @am__isrc@ right after `-I.', without a space. + ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/; + print "D: $default_includes"; } my (@mostly_rms, @dist_rms); diff --git a/doc/automake.texi b/doc/automake.texi index 2a39ec180..3b705573f 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -5748,8 +5748,8 @@ instance, @option{-I} and @option{-D} options should be listed here. Automake already provides some @option{-I} options automatically, in a separate variable that is also passed to every compilation that invokes -the C preprocessor. In particular it generates @samp{-I$(srcdir)}, -@samp{-I.}, and a @option{-I} pointing to the directory holding +the C preprocessor. In particular it generates @samp{-I.}, +@samp{-I$(srcdir)}, and a @option{-I} pointing to the directory holding @file{config.h} (if you've used @code{AC_CONFIG_HEADERS} or @code{AM_CONFIG_HEADER}). You can disable the default @option{-I} options using the @option{nostdinc} option. diff --git a/tests/Makefile.am b/tests/Makefile.am index 79a89d0b3..81a038221 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -501,6 +501,7 @@ spell2.test \ spell3.test \ spelling.test \ spy.test \ +stdinc.test \ stamph2.test \ stdlib.test \ stdlib2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index e0e30ca94..999ed2409 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -649,6 +649,7 @@ spell2.test \ spell3.test \ spelling.test \ spy.test \ +stdinc.test \ stamph2.test \ stdlib.test \ stdlib2.test \ diff --git a/tests/stdinc.test b/tests/stdinc.test new file mode 100755 index 000000000..04301bec5 --- /dev/null +++ b/tests/stdinc.test @@ -0,0 +1,67 @@ +#! /bin/sh +# Copyright (C) 2007 Free Software Foundation, Inc. +# +# This file is part of GNU Automake. +# +# GNU Automake 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 3, or (at your option) +# any later version. +# +# GNU Automake 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 Automake; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. + +# Test to make sure the standard include order is stable. +# Report by Kent Boortz. + +. ./defs || exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_CONFIG_HEADERS([sub/config.h]) +AC_CONFIG_FILES([sub/bar.h]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +bin_PROGRAMS = foo +foo_SOURCES = foo.c +BUILT_SOURCES = bar.h +END + +mkdir sub + +cat >foo.c <<'END' +#include +#include +int main() { return bar (); } +END +cat >bar.h <<'END' +int bar () { return 0; } +END +cat >sub/bar.h.in <<'END' +choke me +END + +$ACLOCAL +$AUTOCONF +$AUTOHEADER +$AUTOMAKE + +mkdir build +cd build +../configure -C +$MAKE + +cd .. +./configure -C +$MAKE -- 2.47.2