]> sourceware.org Git - automake.git/commitdiff
* automake.in (top_srcdir): New global.
authorAlexandre Duret-Lutz <adl@gnu.org>
Thu, 5 Jan 2006 23:32:35 +0000 (23:32 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Thu, 5 Jan 2006 23:32:35 +0000 (23:32 +0000)
(generate_makefile): Compute it.
(fill_dist_dirs): New function extracted from handle_dist.
(handle_dist, handle_configure): Use fill_dist_dirs.
* tests/distdir.test: Test for cases where $(top_srcdir) or
$(srcdir) appear in EXTRA_DIST.  Report from Sander Niemeijer.

ChangeLog
automake.in
tests/distdir.test

index ed8739b38eb5b60b929faf830bd816ec1f4fe1a1..31b3d39195b583491fda60f6fc84594adcc4c544 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
+2006-01-05  Stepan Kasal  <kasal@ucw.cz>
+           Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * automake.in (top_srcdir): New global.
+       (generate_makefile): Compute it.
+       (fill_dist_dirs): New function extracted from handle_dist.
+       (handle_dist, handle_configure): Use fill_dist_dirs.
+       * tests/distdir.test: Test for cases where $(top_srcdir) or
+       $(srcdir) appear in EXTRA_DIST.  Report from Sander Niemeijer.
+
 2006-01-05  Zack Weinberg  <zackw@panix.com>
-       Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * lib/depcomp: Add 'ia64hp' dependency style.
        Zack's original patch was contributed to GCC on 2005-06-13.
index 81043847e816dd5084bb680219bca4e91ffc6199..dcccb3470345d27528512b50b8391ed03ad38a42 100755 (executable)
@@ -7,7 +7,7 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
 
 # automake - create Makefile.in from Makefile.am
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -463,6 +463,9 @@ my $am_relative_dir;
 my $in_file_name;
 my $relative_dir;
 
+# Relative path to the top directory.
+my $topsrcdir;
+
 # Greatest timestamp of the output's dependencies (excluding
 # configure's dependencies).
 my $output_deps_greatest_timestamp;
@@ -3485,6 +3488,23 @@ sub for_dist_common
     return $a cmp $b;
 }
 
+# fill_dist_dirs(@FILES)
+# ----------------------
+# Record in %dist_dirs the directory part of any file passed.
+sub fill_dist_dirs (@)
+{
+  my @copy = @_;
+  foreach (@copy)
+    {
+      s/\$\(top_srcdir\)/$topsrcdir/;
+      s/\$\(srcdir\)/./;
+      # Strip any leading `./'.
+      s,^(:?\./+)*,,;
+      next unless s,/+[^/]+$,,;
+      $dist_dirs{$_} = 1
+       unless $_ eq '.';
+    }
+}
 
 # handle_dist
 # -----------
@@ -3602,34 +3622,18 @@ sub handle_dist ()
   # originally, but there were so many requests that I finally
   # relented.
   my $extra_dist = var ('EXTRA_DIST');
-  if ($extra_dist)
-    {
-      # FIXME: This should be fixed to work with conditions.  That
-      # will require only making the entries in %dist_dirs under the
-      # appropriate condition.  This is meaningful if the nature of
-      # the distribution should depend upon the configure options
-      # used.
-      foreach ($extra_dist->value_as_list_recursive (skip_ac_subst => 1))
-       {
-         next unless s,/+[^/]+$,,;
-         $dist_dirs{$_} = 1
-           unless $_ eq '.';
-       }
-    }
+  # FIXME: This should be fixed to work with conditions.  That
+  # will require only making the entries in %dist_dirs under the
+  # appropriate condition.  This is meaningful if the nature of
+  # the distribution should depend upon the configure options
+  # used.
+  fill_dist_dirs ($extra_dist->value_as_list_recursive (skip_ac_subst => 1))
+    if $extra_dist;
 
   # We have to check DIST_COMMON for extra directories in case the
   # user put a source used in AC_OUTPUT into a subdir.
-  my $topsrcdir = backname ($relative_dir);
-  foreach (rvar ('DIST_COMMON')->value_as_list_recursive (skip_ac_subst => 1))
-    {
-      s/\$\(top_srcdir\)/$topsrcdir/;
-      s/\$\(srcdir\)/./;
-      # Strip any leading `./'.
-      s,^(:?\./+)*,,;
-      next unless s,/+[^/]+$,,;
-      $dist_dirs{$_} = 1
-       unless $_ eq '.';
-    }
+  fill_dist_dirs (rvar ('DIST_COMMON')
+                  ->value_as_list_recursive (skip_ac_subst => 1));
 
   $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook';
   $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external;
@@ -4065,13 +4069,8 @@ sub handle_configure ($$$@)
       # is a bit ugly but it easier than spreading out the logic,
       # especially in cases like AC_OUTPUT(foo/out:bar/in), where
       # there is no Makefile in bar/.
-      if ($relative_dir eq '.')
-       {
-         foreach (@inputs)
-           {
-             $dist_dirs{dirname ($_)} = 1;
-           }
-       }
+      fill_dist_dirs (@inputs)
+       if $relative_dir eq '.';
 
       # We skip files that aren't in this directory.  However, if
       # the file's directory does not have a Makefile, and we are
@@ -7370,6 +7369,7 @@ sub generate_makefile ($$)
 
   $relative_dir = dirname ($makefile);
   $am_relative_dir = dirname ($makefile_am);
+  $topsrcdir = backname ($relative_dir);
 
   read_main_am_file ($makefile_am);
   if (handle_options)
index 111ec0f9f8ec237429681a99080431ee12488692..33247cb9e87dbc21ae3e6bc66d8479250e13e930 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2006  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 # Boston, MA 02110-1301, USA.
 
 # Test to make sure subdirs in EXTRA_DIST work.  Also tests to make
-# sure "./" is ignored.
+# sure "./" is ignored and *srcdir properly handled.
 
 . ./defs || exit 1
 
 set -e
 
+echo AC_OUTPUT >>configure.in
+
 cat > Makefile.am << 'END'
-EXTRA_DIST = foo/bar ./joe
+EXTRA_DIST = foo/bar ./joe $(top_srcdir)/woo/doo $(srcdir)/dada
+check-local:
+       test -f $(srcdir)/foo/bar
+       test -f $(srcdir)/woo/doo
+       test -f $(srcdir)/joe
+       test -f $(srcdir)/dada
 END
 
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE
 
+mkdir foo woo
+touch foo/bar joe woo/doo dada
+
 grep '\$(mkdir_p).*\.' Makefile.in && exit 1
+grep '\$(mkdir_p).*srcdir' Makefile.in && exit 1
 grep '\$(mkdir_p).*foo' Makefile.in
 
 # Check to make sure `foo' isn't made in build directory.
 grep 'mkdir_p.*foo.*foo' Makefile.in && exit 1
+
+./configure --prefix `pwd`
+$MAKE distcheck
+
 exit 0
This page took 0.043004 seconds and 5 git commands to generate.