+2001-11-09 Alexandre Duret-Lutz <duret_g@epita.fr>
+
+ Fix for distcommon2.test:
+ * automake.in (automake_needs_to_reprocess_all_files): New
+ variable.
+ ("main"): Process all Makefiles a second time if
+ $automake_needs_to_reprocess_all_files is set.
+ (maybe_push_required_file): Return 1 or 0 whether the file is
+ pushed or not.
+ (require_file_internal): Set $automake_needs_to_reprocess_all_files
+ if an added file can't be pushed.
+
+ * test/distcommon2.test: New file.
+ * test/Makefile.am (TESTS): Add distcommon2.test.
+ From Pavel Roskin.
+
2001-11-09 Alexandre Duret-Lutz <duret_g@epita.fr>
* automake.in (exec_dir_p): Remove. Replace by...
'install-man' => 1,
);
+# This is set to 1 when Automake needs to be run again.
+# (For instance, this happens when an auxiliary file such as
+# depcomp is added after the toplevel Makefile.in -- which
+# should distribute depcomp -- has been generated.)
+my $automake_needs_to_reprocess_all_files = 0;
\f
################################################################
die "$me: no `Makefile.am' found or specified\n"
if ! @input_files;
-# Now do all the work on each file.
-# This guy must be local otherwise it's private to the loop.
-use vars '$am_file';
-local $am_file;
-foreach $am_file (@input_files)
+my $automake_has_run = 0;
+
+do
{
- if (! -f ($am_file . '.am'))
+ if ($automake_has_run)
{
- &am_error ("`" . $am_file . ".am' does not exist");
+ print "$me: processing Makefiles another time to fix them up.\n";
+ &prog_error ("running more than two times should never be needed.")
+ if $automake_has_run >= 2;
}
- else
+ $automake_needs_to_reprocess_all_files = 0;
+
+ # Now do all the work on each file.
+ # This guy must be local otherwise it's private to the loop.
+ use vars '$am_file';
+ local $am_file;
+ foreach $am_file (@input_files)
{
- &generate_makefile ($output_files{$am_file}, $am_file);
+ if (! -f ($am_file . '.am'))
+ {
+ &am_error ("`" . $am_file . ".am' does not exist");
+ }
+ else
+ {
+ &generate_makefile ($output_files{$am_file}, $am_file);
+ }
}
+ ++$automake_has_run;
}
+while ($automake_needs_to_reprocess_all_files);
exit $exit_status;
if ($dir eq $relative_dir)
{
push_dist_common ($file);
+ return 1;
}
elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
{
# subdir which does not have a Makefile, then we distribute it
# here.
push_dist_common ($fullfile);
+ return 1;
}
+ return 0;
}
}
}
- maybe_push_required_file (dirname ($errfile),
- $file, $errfile);
+ if (! maybe_push_required_file (dirname ($errfile),
+ $file, $errfile))
+ {
+ if (! $found_it)
+ {
+ # We have added the file but could not push it
+ # into DIST_COMMON (probably because this is
+ # an auxiliary file and we are not processing
+ # the top level Makefile). This is unfortunate,
+ # since it means we are using a file which is not
+ # distributed!
+
+ # Get Automake to be run again: on the second
+ # run the file will be found, and pushed into
+ # the toplevel DIST_COMMON automatically.
+ $automake_needs_to_reprocess_all_files = 1;
+ }
+ }
# Prune the path list.
@require_file_paths = &dirname ($errfile);
--- /dev/null
+#! /bin/sh
+
+# Test to make sure that depcomp and compile are added to DIST_COMMON
+# From Pavel Roskin.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+PACKAGE=nonesuch
+VERSION=nonesuch
+AC_PROG_CC
+AC_OUTPUT(Makefile subdir/Makefile)
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = subdir
+END
+
+mkdir subdir
+: > subdir/foo.c
+
+cat > subdir/Makefile.am << 'END'
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+foo_CFLAGS = -DBAR
+END
+
+rm -f compile depcomp
+
+$ACLOCAL || exit 1
+$AUTOMAKE --add-missing || exit 1
+
+test -f compile || exit 1
+test -f depcomp || exit 1
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+ :loop
+ p
+ n
+ /\\$/ b loop
+ p
+ n
+ }' -e '/^DIST_COMMON =/ p' Makefile.in | grep compile || exit 1
+
+sed -n -e '/^DIST_COMMON =.*\\$/ {
+ :loop
+ p
+ n
+ /\\$/ b loop
+ p
+ n
+ }' -e '/^DIST_COMMON =/ p' Makefile.in | grep depcomp || exit 1