[Top][All Lists]
[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: |
Thu, 26 Jun 2003 18:08:46 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 |
Okay, I took the rest of your (Alexandre's) advice, including testing `make
dist'.
It was a good thing I decided to test `make dist' because I was using
require_file completely wrong. I also implemented my idea about keeping track
of $where for each AC_CONFIG_LINKS call. Anyhow, everything works now and no
new
tests are broken. If the guys who admin sources.redhat.com ever fix my
account, I
can commit it, with your approval.
* automake.in (scan_autoconf_traces): Handle AC_CONFIG_LINKS.
(handle_configure): Handle adding AC_CONFIG_LINKS arguments to
distclean targets (CONFIG_CLEAN_FILES makefile var).
* tests/Makefile.am (XFAIL_TESTS): Add new tests.
(TESTS): Ditto.
* tests/distclean.test: New test that links are cleaned on distclean.
* tests/distlinksource.test: New test that source files for links are
distributed.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1470
diff -u -r1.1470 automake.in
--- automake.in 25 Jun 2003 14:01:22 -0000 1.1470
+++ automake.in 26 Jun 2003 22:03:00 -0000
@@ -318,6 +318,9 @@
# Where AC_CONFIG_HEADER appears.
my $config_header_location;
+# Names used in AC_CONFIG_LINKS call.
+my @config_links = ();
+
# Directory where output files go. Actually, output files are
# relative to this directory.
my $output_directory;
@@ -4345,7 +4348,61 @@
rewrite_inputs_into_dependencies (0, @inputs));
}
- # These files get removed by "make clean".
+ foreach my $struct (@config_links)
+ {
+ my ($spec, $where) = @$struct;
+ 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
+ {
+ undef $local;
+ }
+ }
+
+ push @actual_other_files, $local if $local;
+
+ $local = basename ($file);
+ $fd = dirname ($file);
+
+ # Make sure the dist directory for each input file is created.
+ # We only have to do this at the topmost level though.
+ if ($relative_dir eq '.')
+ {
+ $dist_dirs{$fd} = 1;
+ }
+
+ # We skip files that aren't in this directory. However, if
+ # the files's directory does not have a Makefile, and we are
+ # currently doing `.', then we require the file from `.'.
+ if ($fd ne $relative_dir)
+ {
+ if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+ {
+ $local = $file;
+ }
+ else
+ {
+ next;
+ }
+ }
+
+ # Require all input files.
+ require_file ($where, FOREIGN, $local);
+ }
+
+ # These files get removed by "make distclean".
define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL,
@actual_other_files);
}
@@ -4935,6 +4992,7 @@
AC_CONFIG_AUX_DIR
AC_CONFIG_FILES
AC_CONFIG_HEADERS
+ AC_CONFIG_LINKS
AC_INIT
AC_LIBSOURCE
AC_SUBST
@@ -4993,6 +5051,10 @@
{
$config_header_location = $where;
push @config_headers, split (' ', $args[1]);
+ }
+ elsif ($macro eq 'AC_CONFIG_LINKS')
+ {
+ push @config_links, map { [$_, $where] } 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 26 Jun 2003 22:03:00 -0000
@@ -1,4 +1,3 @@
-## Process this file with automake to create Makefile.in
XFAIL_TESTS = auxdir2.test cond17.test txinfo5.test
@@ -161,6 +160,8 @@
dirforbid.test \
dirlist.test \
discover.test \
+distclean.test \
+distlinksource.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 26 Jun 2003 22:03:00 -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
+
+set -e
+
+echo 'SUBDIRS = sdir' > Makefile.am
+: > src
+mkdir sdir
+: > sdir/Makefile.am
+: > sdir/src2
+mkdir sdir-no-make
+
+cat >>configure.in << 'EOF'
+AC_CONFIG_FILES(sdir/Makefile)
+AC_CONFIG_LINKS(dest:src)
+AC_CONFIG_LINKS(dest2:src)
+AC_CONFIG_LINKS(sdir/dest3:src)
+AC_CONFIG_LINKS(dest4:sdir/src2)
+AC_CONFIG_LINKS(sdir/dest5:sdir/src2 sdir-no-make/dest6:src)
+AC_OUTPUT
+EOF
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+./configure
+
+# Make sure nothing is deleted by `make clean'
+$MAKE clean
+
+test -r dest
+test -r dest2
+test -r sdir/dest3
+test -r dest4
+test -r sdir/dest5
+test -r sdir-no-make/dest6
+test -f src
+test -f sdir/src2
+
+# Make sure the links are deleted by `make distclean' and the original files
+# are not.
+$MAKE distclean
+
+test -f src
+test -f sdir/src2
+
+test -r dest && exit 1
+test -r dest2 && exit 1
+test -r sdir/dest3 && exit 1
+test -r dest4 && exit 1
+test -r sdir/dest5 && exit 1
+test -r sdir-no-make/dest6 && exit 1
+
+:
Index: tests/distlinksource.test
===================================================================
RCS file: tests/distlinksource.test
diff -N tests/distlinksource.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/distlinksource.test 26 Jun 2003 22:03:00 -0000
@@ -0,0 +1,60 @@
+#! /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 that sources for links created by AC_CONFIG_LINKS
+# are distributed.
+
+. ./defs || exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+SUBDIRS = sdir
+test: distdir
+ test -f $(distdir)/src
+ test -f $(distdir)/src2
+ test -f $(distdir)/sdir/src3
+ test -f $(distdir)/sdir-no-make/src4
+ test 2 -gt `find $(distdir)/sdir -type d | wc -l`
+ test 2 -gt `find $(distdir)/sdir-no-make -type d | wc -l`
+ test 4 -gt `find $(distdir) -type d | wc -l`
+END
+
+: > src
+: > src2
+mkdir sdir
+: > sdir/Makefile.am
+: > sdir/src3
+mkdir sdir-no-make
+: > sdir-no-make/src4
+
+cat >>configure.in << 'EOF'
+AC_CONFIG_FILES(sdir/Makefile)
+AC_CONFIG_LINKS(dest:src)
+AC_CONFIG_LINKS(sdir/dest2:src2 sdir-no-make/dest3:sdir/src3)
+AC_CONFIG_LINKS(sdir/dest4:sdir-no-make/src4)
+AC_OUTPUT
+EOF
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+./configure
+$MAKE test
--
*8^)
Email: address@hidden
Get CVS support at <http://ximbiot.com>!
--
OK, who stopped payment on my reality check?
- Re: 02-distclean-test.diff, (continued)
- 1.8 TODO (Was: Re: 02-distclean-test.diff), Alexandre Duret-Lutz, 2003/06/26
- Re: 1.8 TODO, Akim Demaille, 2003/06/27
- Re: 1.8 TODO, Alexandre Duret-Lutz, 2003/06/27
- Re: 1.8 TODO, Akim Demaille, 2003/06/27
- Re: 1.8 TODO, Alexandre Duret-Lutz, 2003/06/27
- Re: 02-distclean-test.diff, Derek Robert Price, 2003/06/25
- Re: 02-distclean-test.diff,
Derek Robert Price <=
- Re: 02-distclean-test.diff, Alexandre Duret-Lutz, 2003/06/26
- Re: 02-distclean-test.diff, Derek Robert Price, 2003/06/26
- Re: 02-distclean-test.diff, Alexandre Duret-Lutz, 2003/06/27
- Re: 02-distclean-test.diff, Jim Meyering, 2003/06/27
- sorting NEWS (Was: Re: 02-distclean-test.diff), Alexandre Duret-Lutz, 2003/06/27