2002-07-22 Alexandre Duret-Lutz <duret_g@epita.fr>
+ * automake.in (handle_subdirs): Warn if `obj' appears in SUBDIRS.
+ * tests/subdir7.test: New file.
+ * tests/Makefile.am (TESTS): Add subdir7.test.
+
* lib/mkinstalldirs: Remove Id keyword.
* lib/am/progs.am (installcheck-%DIR%PROGRAMS): Honor
return
unless variable_defined ('SUBDIRS');
+ my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all');
+ my @dsubdirs = ();
+ @dsubdirs = &variable_value_as_list_recursive ('DIST_SUBDIRS', 'all')
+ if variable_defined ('DIST_SUBDIRS');
+
+ # If an `obj/' directory exists, BSD make will enter it before
+ # reading `Makefile'. Hence the `Makefile' in the current directory
+ # will not be read.
+ #
+ # % cat Makefile
+ # all:
+ # echo Hello
+ # % cat obj/Makefile
+ # all:
+ # echo World
+ # % make # GNU make
+ # echo Hello
+ # Hello
+ # % pmake # BSD make
+ # echo World
+ # World
+ msg_var ('portability', 'SUBDIRS',
+ "naming a subdirectory `obj' causes troubles with BSD make")
+ if grep ($_ eq 'obj', @subdirs);
+ msg_var ('portability', 'DIST_SUBDIRS',
+ "naming a subdirectory `obj' causes troubles with BSD make")
+ if grep ($_ eq 'obj', @dsubdirs);
+
# Make sure each directory mentioned in SUBDIRS actually exists.
- foreach my $dir (&variable_value_as_list_recursive ('SUBDIRS', 'all'))
+ foreach my $dir (@subdirs)
{
# Skip directories substituted by configure.
next if $dir =~ /^\@.*\@$/;
--- /dev/null
+#! /bin/sh
+
+# Naming a subdirectory `obj/' is a bad idea. Automake should say so.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+mkdir obj
+
+cat >>configure.in << 'END'
+AC_CONFIG_FILES(obj/Makefile)
+AC_OUTPUT
+END
+
+: > obj/Makefile.am
+echo 'SUBDIRS = obj' >Makefile.am
+
+$ACLOCAL
+
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'obj.*BSD' stderr
+
+cat >Makefile.am <<EOF
+SUBDIRS = @STH@
+DIST_SUBDIRS = obj
+EOF
+
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'obj.*BSD' stderr