Some weeks ago Bruno Haible reported (in private mail) that
running `make dist' with srcdir != builddir could produce
distributions which are not up-to-date, especially if you have
generated files like bison parsers: $builddir/parser.c would be
updated whenever $srcdir/parser.y is changed but the
distribution would ship with an old $srcdir/parser.c instead of
the fresh $builddir/parser.c.  Fortunately, this is detected if
you run `make distcheck' instead of `make dist', because the
buildir is non empty after `make distclean' (parser.c is left).

This can be easily fixed by changing the distdir code to look
for files in the builddir first and failling back to look in the
srcdir if needed.  But maybe this is not the right fix; maybe
bison should not output its parsers in the builddir but in the
srcdir instead (actually, this is what the GNU Standards ask
for).

I have attempted to build a testcase that demonstrates the
failure, but unfortunately it fails before this error!  (it is
expected to fail at the end of `make distcheck', where the build
directory is listed to see if there are any file left).

On Automake 1.4d it fails in `make distcheck' with:

make[3]: Entering directory 
`/home/adl/projs/automake-1.4d/tests/testSubDir/sub/foo-0.1/=build'
chmod -R a+w foo-0.1 > /dev/null 2>&1; rm -rf foo-0.1
mkdir foo-0.1
/bin/sh ../../../mkinstalldirs foo-0.1/../.. ../..
cp: cannot create regular file `foo-0.1/../../install-sh': Permission denied
make[3]: *** [distdir] Error 1
make[3]: Leaving directory 
`/home/adl/projs/automake-1.4d/tests/testSubDir/sub/foo-0.1/=build'
make[2]: *** [distcheck] Error 2
make[2]: Leaving directory `/home/adl/projs/automake-1.4d/tests/testSubDir/sub'
FAIL: yaccvpath.test

Today's CVS Automake fails likewise on another file.

I assume this is related to
...utomake-1.4d/tests/testSubDir % grep \^DIST_COMMON Makefile.in
DIST_COMMON =  ../../depcomp ../../install-sh ../../missing \


I don't understand where these `../../' come from, I whish
someone could shed some light on this.  It looks like the
Makefile uses the tools installed in Automake's directory
instead of those installed locally.  If I run the test manually,
with Autoconf-1.4d installed in my PATH, it runs fine (i.e. it's
stop at the expected place and don't add those annoying
`../../').

Here is the file.
#! /bin/sh

# This attempts to `make distcheck' from a separate directory
# (i.e. builddir!=srcdir).  Before doing `make distcheck' a parser
# definition is updated in the srcdir in order to check whether the
# archived perser is up-to-date or not.

. $srcdir/defs || exit 1

cat > configure.in << 'END'
AC_INIT
AM_INIT_AUTOMAKE(foo, 0.1)
PACKAGE=foo
VERSION=0.1
AC_PROG_CC
AC_PROG_YACC
AC_OUTPUT(Makefile)
END

cat > Makefile.am << 'END'
bin_PROGRAMS= foo
foo_SOURCES= parse.y foo.c
END

cat > parse.y << 'END'
%{
int yylex () {return 0;}
void yyerror (char *s) {}
%}
%%
foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
END

cat > foo.c << 'END'
int main () { return 0; }
END

# Fail gracefully if no autoconf.
$needs_autoconf
# Likewise for gcc.
(gcc -v) > /dev/null 2>&1 || exit 77

# Remove some files installed by defs.
# They will be reinstalled by automake.
rm -f install-sh missing mkinstalldirs

set -e

$ACLOCAL
$AUTOCONF
$AUTOMAKE -a

./configure
$MAKE
$MAKE distclean
# this should left parse.c in the current directory

cat >> parse.y << 'END'
fubar : 'f' foobar {};
END

mkdir sub
cd sub
../configure
$MAKE
$MAKE distcheck
-- 
Alexandre Duret-Lutz

Reply via email to