automake-patches
[Top][All Lists]
Advanced

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

Re: 02-distclean-test.diff


From: Derek Robert Price
Subject: Re: 02-distclean-test.diff
Date: Tue, 24 Jun 2003 22:34:55 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02

Okay, this patch includes the fix.  It seems to work correctly, except
multiple invocations of AC_CONFIG_LINKS with the same source file seem
to cause multiple warnings when the file is missing:

        configure.in:10: required file `./sdir/src' not found
        configure.in:10: required file `sdir/src' not found

Should I worry about this?  Would you like me to write another test for
the require functionality?

One last question, why is only the last $where preserved for AC_CONFIG_FILES
and the like?  I duplicated this behavior for AC_CONFIG_LINKS, but it doesn't
seem like it would be very hard to preserve the exact $where for each macro
invocation.


Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1469
diff -u -r1.1469 automake.in
--- automake.in 23 Jun 2003 21:39:52 -0000      1.1469
+++ automake.in 25 Jun 2003 02:16:16 -0000
@@ -318,6 +318,11 @@
# Where AC_CONFIG_HEADER appears.
my $config_header_location;

+# Names used in AC_CONFIG_LINKS call.
+my @config_links = ();
+# Where the last AC_CONFIG_LINKS appears.
+my $ac_config_links_location;
+
# Directory where output files go.  Actually, output files are
# relative to this directory.
my $output_directory;
@@ -4345,6 +4350,35 @@
                      rewrite_inputs_into_dependencies (0, @inputs));
    }

+    foreach my $spec (@config_links)
+    {
+       my ($link, $file) = split /:/, $spec;
+
+       # We skip links that aren't in this directory.  However, if
+       # the link's directory does not have a Makefile, and we are
+       # currently doing `.', then we add the link to CONFIG_CLEAN_FILES
+       # in `.'s Makefile.in.
+       my $local = basename ($link);
+       my $fd = dirname ($link);
+       if ($fd ne $relative_dir)
+       {
+           if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+           {
+               $local = $link;
+           }
+           else
+           {
+               next;
+           }
+       }
+
+       push (@actual_other_files, $local);
+
+       # Require all input files.
+       require_file ($ac_config_links_location, FOREIGN,
+                     rewrite_inputs_into_dependencies (0, $file));
+    }
+
    # These files get removed by "make clean".
    define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL,
                            @actual_other_files);
@@ -4935,6 +4969,7 @@
                  AC_CONFIG_AUX_DIR
                  AC_CONFIG_FILES
                  AC_CONFIG_HEADERS
+                 AC_CONFIG_LINKS
                  AC_INIT
                  AC_LIBSOURCE
                  AC_SUBST
@@ -4993,6 +5028,11 @@
        {
          $config_header_location = $where;
          push @config_headers, split (' ', $args[1]);
+       }
+      elsif ($macro eq 'AC_CONFIG_LINKS')
+       {
+         $ac_config_links_location = $where;
+         push @config_links, split (' ', $args[1]);
        }
      elsif ($macro eq 'AC_INIT')
        {
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.500
diff -u -r1.500 Makefile.am
--- tests/Makefile.am   23 Jun 2003 21:39:53 -0000      1.500
+++ tests/Makefile.am   25 Jun 2003 02:16:16 -0000
@@ -161,6 +161,7 @@
dirforbid.test \
dirlist.test \
discover.test \
+distclean.test \
distcom.test \
distcom2.test \
distcom3.test \
Index: tests/distclean.test
===================================================================
RCS file: tests/distclean.test
diff -N tests/distclean.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/distclean.test        25 Jun 2003 02:16:16 -0000
@@ -0,0 +1,76 @@
+#! /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 autoconf; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test to make sure links created by AC_CONFIG_LINKS get removed with
+# `make distclean'
+
+. ./defs || exit 1
+
+echo 'SUBDIRS = sdir' > Makefile.am
+: > src
+mkdir sdir
+: > sdir/Makefile.am
+: > sdir/src
+mkdir sdir-no-make
+
+cat >>configure.in << 'EOF'
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES(sdir/Makefile)
+AC_CONFIG_LINKS(dest:src)
+AC_CONFIG_LINKS(dest2:src)
+AC_CONFIG_LINKS(sdir/dest:src)
+AC_CONFIG_LINKS(dest3:sdir/src)
+AC_CONFIG_LINKS(sdir/dest2:sdir/src sdir-no-make/dest:src)
+AC_OUTPUT
+EOF
+
+set -e
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+./configure
+
+# Make sure nothing is deleted by `make clean'
+$MAKE clean
+
+test -r dest
+test -r dest2
+test -r sdir/dest
+test -r dest3
+test -r sdir/dest2
+test -r sdir-no-make/dest
+test -f src
+test -f sdir/src
+
+# Make sure the links are deleted by `make distclean' and the original files
+# are not.
+$MAKE distclean
+
+test -f src
+test -f sdir/src
+
+set +e
+test -r dest && exit 1
+test -r dest2 && exit 1
+test -r sdir/dest && exit 1
+test -r dest3 && exit 1
+test -r sdir/dest2 && exit 1
+test -r sdir-no-make/dest && exit 1



Derek
--
               *8^)

Email: address@hidden

Get CVS support at <http://ximbiot.com>!
--
They are laughing at me, not with me.
They are laughing at me, not with me.
They are laughing at me, not with me...

         - Bart Simpson on chalkboard, _The Simpsons_







reply via email to

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