+2002-01-13 Tom Tromey <tromey@redhat.com>
+
+ For PR automake/288:
+ * automake.in (lang_c_rewrite): Set value for de_ansi_files entry
+ to directory.
+ (lang_c_finish): Likewise. Also, use directory information from
+ de_ansi_files.
+
+2002-01-13 Kevin Ryde <user42@zip.com.au>
+
+ For PR automake/288:
+ * tests/Makefile.am (TESTS): Added ansi6.test.
+ * tests/ansi6.test: New file.
+
2002-01-13 Tom Tromey <tromey@redhat.com>
For PR automake/287:
|| exit 1; \
fi; \
done
- for subdir in $(SUBDIRS); do \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
# This is a list of all targets to run during "make dist".
my @dist_targets;
-# Keys in this hash are the basenames of files which must depend
-# on ansi2knr.
+# Keys in this hash are the basenames of files which must depend on
+# ansi2knr. Values are either the empty string, or the directory in
+# which the ANSI source file appears; the directory must have a
+# trailing `/'.
my %de_ansi_files;
# This maps the source extension of a suffix rule to its
require_conf_file ("$am_file.am", FOREIGN, 'compile');
}
- $de_ansi_files{$base} = 1;
+ $de_ansi_files{$base} = (($directory eq '.' || $directory eq '')
+ ? ''
+ : "$directory/");
return $r;
}
{
if ($file =~ /^(.*)\.[cly]$/ && -f "$relative_dir/$file")
{
- $de_ansi_files{$1} = 1;
+ $de_ansi_files{$1} = (($relative_dir eq '.' || $relative_dir eq '')
+ ? ''
+ : "$relative_dir/");
}
}
# dir (because these files might be auto-generated. But
# we can't use $< -- some makes only define $< during a
# suffix rule.
- $output_rules .= ($base . "_.c: $base.c \$(ANSI2KNR)\n\t"
+ my $ansfile = $de_ansi_files{$base} . $base . '.c';
+ $output_rules .= ($base . "_.c: $ansfile \$(ANSI2KNR)\n\t"
. '$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) '
- . '`if test -f $(srcdir)/' . $base . '.c'
- . '; then echo $(srcdir)/' . $base . '.c'
- . '; else echo ' . $base . '.c; fi` '
+ . '`if test -f $(srcdir)/' . $ansfile
+ . '; then echo $(srcdir)/' . $ansfile
+ . '; else echo ' . $ansfile . '; fi` '
. "| sed 's/^# \\([0-9]\\)/#line \\1/' "
. '| $(ANSI2KNR) > ' . $base . "_.c"
# If ansi2knr fails then we shouldn't
--- /dev/null
+#! /bin/sh
+
+# Check ansi2knr on a source file in subdirectory.
+# From Kevin Ryde.
+
+required=gcc
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(ansi6, 1.0)
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+AM_C_PROTOTYPES
+AC_EXEEXT
+AC_OBJEXT
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = ansi2knr
+bin_PROGRAMS = hello
+hello_SOURCES = hello.c sub/dir.c
+END
+
+cat > hello.c << 'END'
+#include <stdio.h>
+
+extern int foo ();
+
+int
+main (int argc, char **argv)
+{
+ printf ("%d\n", foo ());
+}
+END
+
+mkdir sub
+
+cat > sub/dir.c << 'END'
+int
+foo ()
+{
+ return 23;
+}
+END
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure am_cv_prog_cc_stdc=no
+$MAKE