From b3fab3711f95719271f6e1dd56fd7f76539e12ff Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 26 Mar 2002 10:48:37 +0000 Subject: [PATCH] * tests/extra7.test: New file. * tests/Makefile.am: Add it. * lib/am/distdir.an (distdir): When a distribuable directory exists both in `.' and $(srcdir), merge both directories. This works around a failure of extra6.test on Tru64 reported by Nicolas Joly. --- ChangeLog | 9 ++++++++ lib/am/distdir.am | 26 ++++++++++++++++-------- tests/Makefile.am | 1 + tests/Makefile.in | 7 +++++-- tests/extra7.test | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 85 insertions(+), 10 deletions(-) create mode 100755 tests/extra7.test diff --git a/ChangeLog b/ChangeLog index b4177b6b8..33e4d7d7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-03-26 Alexandre Duret-Lutz + + * tests/extra7.test: New file. + * tests/Makefile.am: Add it. + * lib/am/distdir.an (distdir): When a distribuable directory + exists both in `.' and $(srcdir), merge both directories. This + works around a failure of extra6.test on Tru64 reported by + Nicolas Joly. + 2002-03-26 Alexandre Duret-Lutz * tests/pr87.test, tests/yaccvpath.test: Require GNU make. diff --git a/lib/am/distdir.am b/lib/am/distdir.am index f8b1dff0a..4b9d46cda 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -82,20 +82,30 @@ endif %?TOPDIR_P% dir=''; \ fi; \ ## -## In loop, test for file existence because sometimes a file gets -## included in DISTFILES twice. For example this happens when a single -## source file is used in building more than one program. Also, there -## are situations in which "ln" can fail. For instance a file to -## distribute could actually be a cross-filesystem symlink -- this can -## easily happen if "gettextize" was run on the distribution. +## Use cp, not ln. There are situations in which "ln" can fail. For +## instance a file to distribute could actually be a cross-filesystem +## symlink -- this can easily happen if "gettextize" was run on the +## distribution. ## if test -d $$d/$$file; then \ ## Don't mention $$file in destination argument, since this fails if ## destination directory already exists. Also, use `-R' and not `-r'. ## `-r' is almost always incorrect. - cp -pR $$d/$$file $(distdir)$$dir \ - || exit 1; \ +## +## If a directory exists both in `.' and $(srcdir), then +## We copy the files from $(srcdir) first and then install those from +## `.'. This can help people who distribute directories made of +## source files _and_ generated files. It is also important when the +## directory exists only in $(srcdir), because some vendor Make (such +## as Tru64) will magically create an empty directory in `.' + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ +## Test for file existence because sometimes a file gets included in +## DISTFILES twice. For example this happens when a single source +## file is used in building more than one program. test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ diff --git a/tests/Makefile.am b/tests/Makefile.am index b295919bd..fbbd652d8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -149,6 +149,7 @@ extra3.test \ extra4.test \ extra5.test \ extra6.test \ +extra7.test \ flibs.test \ fnoc.test \ fo.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 76dc869e1..44000741a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -225,6 +225,7 @@ extra3.test \ extra4.test \ extra5.test \ extra6.test \ +extra7.test \ flibs.test \ fnoc.test \ fo.test \ @@ -533,8 +534,10 @@ distdir: $(DISTFILES) dir=''; \ fi; \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir)$$dir \ - || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ diff --git a/tests/extra7.test b/tests/extra7.test new file mode 100755 index 000000000..f1dfdeb16 --- /dev/null +++ b/tests/extra7.test @@ -0,0 +1,52 @@ +#! /bin/sh + +# Check to make sure that when distdir is invoked in a VPATH +# configuration and has to distribute directory X, it actually merge +# $(srcdir)/X and ./X, with the files from the later overriding the +# files from the former. + +. $srcdir/defs || exit 1 + +set -e + +echo AC_OUTPUT >> configure.in + +cat > Makefile.am << 'END' +EXTRA_DIST=foo/bar baz + +check: distdir + test -f $(distdir)/foo/bar/baz + test -f $(distdir)/foo/bar/baz2 + test -f $(distdir)/baz/foo + test -f $(distdir)/baz/foo2 + grep source $(distdir)/foo/bar/baz + grep build $(distdir)/foo/bar/baz2 + grep source $(distdir)/baz/foo + grep build $(distdir)/baz/foo2 +END + +# Create some files in $(srcdir) +mkdir foo +mkdir foo/bar +echo source > foo/bar/baz +echo source > foo/bar/baz2 +mkdir baz +echo source > baz/foo +echo source > baz/foo2 + +$ACLOCAL +$AUTOMAKE +$AUTOCONF +mkdir build +cd build +../configure + +# Create some files in $(builddir) that will override part of the +# files if $(srcdir) when the distribution is made. +mkdir foo +mkdir foo/bar +echo build > foo/bar/baz2 +mkdir baz +echo build > baz/foo2 + +$MAKE check -- 2.34.1