I'm leery of removing -I. in VPATH builds : - for one thing relying on BUILT_SOURCES looks fragile because there are other ways to ensure built headers (SUBDIRS ordering, explicit dependencies...) - also there is something convenient about the way VPATH builds are done now: you can temporarily override a distributed source file by placing a tweaked copy of that file in the build directory. I did that only a couple of times, I don't know if I'm alone. Anyway for headers this only works with `-I. -I$(srcdir)'.
On the other hand, I agree that `-I. -I.' is unsightly in non-VPATH builds. So how about something like this instead: use [EMAIL PROTECTED]@' and expand it to `-I.' or `-I. -I$(srcdir)' as needed? 2006-08-30 Alexandre Duret-Lutz <[EMAIL PROTECTED]> For PR automake/501: * automake.in (handle_compile) <$default_includes>: Do not output the same -I twice. Use @am__isrc@ instead of ` -I$(srcdir)'. * m4/init.m4: Define am__isrc as ` -I$(srcdir)' only in non-VPATH builds since we always have `-I.'. * tests/subpkg.test: Make sure config headers are found in VPATH and non-VPATH builds. Index: automake.in =================================================================== RCS file: /cvs/automake/automake/automake.in,v retrieving revision 1.1629 diff -u -r1.1629 automake.in --- automake.in 20 Aug 2006 15:46:10 -0000 1.1629 +++ automake.in 30 Aug 2006 07:16:51 -0000 @@ -2301,16 +2301,22 @@ my $default_includes = ''; if (! option 'nostdinc') { - $default_includes = ' -I. -I$(srcdir)'; + my @incs = ('-I.'); my $var = var 'CONFIG_HEADER'; if ($var) { foreach my $hdr (split (' ', $var->variable_value)) { - $default_includes .= ' -I' . dirname ($hdr); + push @incs, '-I' . dirname ($hdr); } } + # We want `-I. -I$(srcdir)', but the latter -I is redundant + # and unaesthetic in non-VPATH builds. We use [EMAIL PROTECTED]@` + # 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 @[EMAIL PROTECTED] + $default_includes = ' ' . uniq (@incs) . '@am__isrc@'; } my (@mostly_rms, @dist_rms); Index: m4/init.m4 =================================================================== RCS file: /cvs/automake/automake/m4/init.m4,v retrieving revision 1.65 diff -u -r1.65 init.m4 --- m4/init.m4 19 Aug 2006 13:58:03 -0000 1.65 +++ m4/init.m4 30 Aug 2006 07:16:52 -0000 @@ -30,10 +30,14 @@ m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl -# test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && - test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi fi # test whether we have cygpath Index: tests/subpkg.test =================================================================== RCS file: /cvs/automake/automake/tests/subpkg.test,v retrieving revision 1.10 diff -u -r1.10 subpkg.test --- tests/subpkg.test 14 May 2005 20:28:56 -0000 1.10 +++ tests/subpkg.test 30 Aug 2006 07:16:52 -0000 @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc. # # This file is part of GNU Automake. # @@ -74,6 +74,7 @@ AM_INIT_AUTOMAKE AC_PROG_RANLIB AC_PROG_YACC +AC_CONFIG_HEADERS([config.h:config.hin]) AC_CONFIG_FILES([Makefile]) FOO EOF @@ -105,6 +106,7 @@ cp lib/foo.y lib/bar.y cat >lib/src/x.c <<'EOF' +#include <config.h> int lib () { return 0; @@ -119,10 +121,12 @@ $ACLOCAL -I ../m4 $FGREP 'm4_include([../m4/foo.m4])' aclocal.m4 $AUTOCONF +$AUTOHEADER $AUTOMAKE -Wno-override --add-missing cd .. ./configure +$MAKE $MAKE distcheck test ! -d subpack-1 # make sure distcheck cleans up after itself test -f subpack-1.tar.gz -- Alexandre Duret-Lutz