+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.
# 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
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;
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
# -----------
# 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;
# 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
$relative_dir = dirname ($makefile);
$am_relative_dir = dirname ($makefile_am);
+ $topsrcdir = backname ($relative_dir);
read_main_am_file ($makefile_am);
if (handle_options)
#! /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