automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix AC_CONFIG_LINKS brokenness when source is variable


From: Alexandre Duret-Lutz
Subject: Re: Fix AC_CONFIG_LINKS brokenness when source is variable
Date: Thu, 04 Dec 2003 19:17:04 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:

[...]

 adl> (I realize we should do this for AC_CONFIG_HEADERS too;
 adl> I'll work on it tomorrow.)

I'm checking this in.

2003-12-04  Alexandre Duret-Lutz  <address@hidden>

        * automake.in ($config_header_location): Remove.  Use
        %ac_config_files_location instead.
        (rewrite_inputs_into_dependencies): Do not prepend $(top_builddir)/
        at the top-level.
        (handle_configure): Use rewrite_inputs_into_dependencies to
        distribute and compute AC_CONFIG_HEADERS dependencies.
        (scan_autoconf_traces) <AC_CONFIG_HEADERS>: Fill
        %ac_config_files_location.
        * lib/am/remake-hdr.am ($(srcdir)/%CONFIG_HIN%): Rename as ...
        (%CONFIG_HIN%): ... this.  $(srcdir) is already added in
        scan_autoconf_traces.
        * tests/Makefile.am (TESTS): Add confh5.test.
        * tests/confh5.test: New file.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1524
diff -u -r1.1524 automake.in
--- automake.in 3 Dec 2003 23:14:48 -0000       1.1524
+++ automake.in 4 Dec 2003 18:16:02 -0000
@@ -296,8 +296,6 @@
 
 # Names used in AC_CONFIG_HEADER call.
 my @config_headers = ();
-# Where AC_CONFIG_HEADER appears.
-my $config_header_location;
 
 # Names used in AC_CONFIG_LINKS call.
 my @config_links = ();
@@ -316,7 +314,7 @@
 # List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's,
 # and their outputs.
 my @other_input_files = ();
-# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK appears.
+# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADER appears.
 # The keys are the files created by these macros.
 my %ac_config_files_location = ();
 
@@ -3500,11 +3498,16 @@
     {
       if (exists $ac_config_files_location{$i})
        {
-         if (dirname ($i) eq $relative_dir)
+         my $di = dirname $i;
+         if ($di eq $relative_dir)
            {
              $i = basename $i;
            }
-         else
+         # In the top-level Makefile we do not use $(top_builddir), because
+         # we are already there, and since the targets are built without
+         # a $(top_builddir), it helps BSD Make to match them with 
+          # dependencies.
+         elsif ($relative_dir ne '.')
            {
              $i = '$(top_builddir)/' . $i;
            }
@@ -3609,14 +3612,8 @@
                }
            }
 
-         # Distribute all inputs.
-         for my $in (@ins)
-           {
-             error $config_header_location, "required file `$in' not found"
-               unless -f $in;
-             push_dist_common (prepend_srcdir ($in));
-           }
-         @ins = prepend_srcdir (@ins);
+         # This will also distribute all inputs.
+         @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins);
 
          # Header defined and in this directory.
          my @files;
@@ -4495,8 +4492,12 @@
        }
       elsif ($macro eq 'AC_CONFIG_HEADERS')
        {
-         $config_header_location = $where;
-         push @config_headers, split (' ', $args[1]);
+         foreach my $spec (split (' ', $args[1]))
+           {
+             my ($dest, @src) = split (':', $spec);
+             $ac_config_files_location{$dest} = $where;
+             push @config_headers, $spec;
+           }
        }
       elsif ($macro eq 'AC_CONFIG_LINKS')
        {
Index: lib/am/remake-hdr.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/remake-hdr.am,v
retrieving revision 1.42
diff -u -r1.42 remake-hdr.am
--- lib/am/remake-hdr.am        27 Oct 2003 21:17:14 -0000      1.42
+++ lib/am/remake-hdr.am        4 Dec 2003 18:16:02 -0000
@@ -36,7 +36,7 @@
 ## Only the first file of AC_CONFIG_HEADERS is assumed to be generated
 ## by autoheader.
 if %?FIRST_CONFIG_HIN%
-$(srcdir)/%CONFIG_HIN%: %MAINTAINER-MODE% $(am__configure_deps) %FILES%
+%CONFIG_HIN%: %MAINTAINER-MODE% $(am__configure_deps) %FILES%
        cd $(top_srcdir) && $(AUTOHEADER)
 ## Whenever $(AUTOHEADER) has run, we must make sure that
 ## ./config.status will rebuild config.h.  The dependency from %STAMP%
@@ -74,5 +74,5 @@
 ## must not changed gratuitously is config.h, which is already handled
 ## by config.status, there is no reason to make things complex for
 ## config.hin.
-       touch $(srcdir)/%CONFIG_HIN%
+       touch $@
 endif %?FIRST_CONFIG_HIN%
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.538
diff -u -r1.538 Makefile.am
--- tests/Makefile.am   3 Dec 2003 23:14:48 -0000       1.538
+++ tests/Makefile.am   4 Dec 2003 18:16:02 -0000
@@ -129,6 +129,7 @@
 conff2.test \
 confh.test \
 confh4.test \
+confh5.test \
 config.test \
 confincl.test \
 conflnk.test \
Index: tests/confh5.test
===================================================================
RCS file: tests/confh5.test
diff -N tests/confh5.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/confh5.test   4 Dec 2003 18:16:02 -0000
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 2003  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 2, 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Make sure we do not distribute header sources when they are built.
+
+. ./defs || exit 1
+
+cat >> configure.in << 'END'
+AC_SUBST([FOO], [name])
+AC_CONFIG_FILES(include/config.h.in)
+AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_HEADERS(include/config.h)
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+test: distdir
+       test -f $(distdir)/config.h.in
+       test -f $(distdir)/include/config.h.in.in
+       test ! -e $(distdir)/include/config.h.in
+END
+
+mkdir include
+: > include/config.h.in.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOHEADER
+$AUTOMAKE
+
+./configure
+$MAKE
+
+$sleep
+echo '#undef @FOO@' > include/config.h.in.in
+$MAKE include/config.h
+grep '/\*.*#undef.*name' include/config.h
+$MAKE test
+$MAKE distcheck
-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]