automake-patches
[Top][All Lists]
Advanced

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

Re: FYI: 02-distclean-test.diff


From: Derek Robert Price
Subject: Re: FYI: 02-distclean-test.diff
Date: Wed, 16 Jul 2003 15:32:30 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

Derek Robert Price wrote:

Alexandre approved this patch awhile back. I just ported it forward and committed it since the guys at sources finally got around to updating my account information. :)

Derek


Whoops.  Here's the diff:

        * 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).
        * NEWS: Note new handling of AC_CONFIG_LINKS.
        * automake.texi (Other things Automake recognizes): Ditto.
        * tests/Makefile.am (TESTS): Add new tests.
        * tests/conflnk.test: New test that links are cleaned on distclean.
        * tests/conflnk2.test: New test that source files for links are
        distributed.



Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.219
diff -u -r1.219 NEWS
--- NEWS        3 Jul 2003 20:38:21 -0000       1.219
+++ NEWS        16 Jul 2003 19:07:59 -0000
@@ -142,6 +142,9 @@

  - Targets dist-gzip, dist-bzip2, dist-tarZ, dist-zip are always defined.

+* Automake will now recognize AC_CONFIG_LINKS so far as removing created links
+  as part of the distclean target and including source files in distributions.
+

New in 1.7:
* Autoconf 2.54 is required.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1482
diff -u -r1.1482 automake.in
--- automake.in 15 Jul 2003 21:21:25 -0000      1.1482
+++ automake.in 16 Jul 2003 19:08:01 -0000
@@ -316,6 +316,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;
@@ -3903,7 +3906,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);
}
@@ -4487,6 +4544,7 @@
                AC_CONFIG_AUX_DIR => 1,
                AC_CONFIG_FILES => 1,
                AC_CONFIG_HEADERS => 1,
+               AC_CONFIG_LINKS => 1,
                AC_INIT => 0,
                AC_LIBSOURCE => 1,
                AC_SUBST => 1,
@@ -4558,6 +4616,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: automake.texi
===================================================================
RCS file: /cvs/automake/automake/automake.texi,v
retrieving revision 1.345
diff -u -r1.345 automake.texi
--- automake.texi       10 Jul 2003 20:32:27 -0000      1.345
+++ automake.texi       16 Jul 2003 19:08:04 -0000
@@ -1144,6 +1144,12 @@
(@pxref{Macros}); this is no longer the case today.
@cvindex AC_CONFIG_HEADERS

address@hidden AC_CONFIG_LINKS
+Automake will generate rules to remove @file{configure} generated links on
address@hidden distclean} and to distribute named source files as part of
address@hidden dist}.
address@hidden AC_CONFIG_LINKS
+
@item AC_CONFIG_AUX_DIR
Automake will look for various helper scripts, such as
@file{mkinstalldirs}, in the directory named in this macro invocation.
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.503
diff -u -r1.503 Makefile.am
--- tests/Makefile.am   2 Jul 2003 23:19:38 -0000       1.503
+++ tests/Makefile.am   16 Jul 2003 19:08:04 -0000
@@ -123,6 +123,8 @@
confh4.test \
config.test \
confincl.test \
+conflnk.test \
+conflnk2.test \
confsub.test \
confvar.test \
confvar2.test \
Index: tests/conflnk.test
===================================================================
RCS file: tests/conflnk.test
diff -N tests/conflnk.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/conflnk.test  16 Jul 2003 19:08:04 -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/conflnk2.test
===================================================================
RCS file: tests/conflnk2.test
diff -N tests/conflnk2.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/conflnk2.test 16 Jul 2003 19:08:04 -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



Derek

--
               *8^)

Email: address@hidden

Get CVS support at <http://ximbiot.com>!
--
      *******         ****       ****         *******
    *    *    *      *    *     *    *      *         *
   *     *     *    *       * *       *    *   *   *   *
  *      *      *   *        *        *   *             *
  *     ***     *    *               *    *             *
  *    * * *    *      *           *      *   *     *   *
   *  *  *  *  *         *       *         *   *****   *
    **   *   **            *   *            *         *
      *******                *                *******






reply via email to

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