From: Tom Tromey Date: Fri, 18 Jan 2002 22:20:28 +0000 (+0000) Subject: For PR automake/288: X-Git-Tag: Release-1-5d~24 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=f933936bddb31f3449e667ded509f7b6c47cd558;p=automake.git For PR automake/288: * automake.in (lang_c_rewrite): Don't prepend directory to base if directory is `.'. Also, properly compute de_ansi_files entry in subdir-objects case * tests/Makefile.am (TESTS): Added ansi7.test. * tests/ansi7.test: New file. --- diff --git a/ChangeLog b/ChangeLog index 0cf0f620..10ff2040 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2002-01-18 Tom Tromey + For PR automake/288: + * automake.in (lang_c_rewrite): Don't prepend directory to base if + directory is `.'. Also, properly compute de_ansi_files entry in + subdir-objects case + * tests/Makefile.am (TESTS): Added ansi7.test. + * tests/ansi7.test: New file. + * aclocal.in (parse_arguments): Added 2002. (write_aclocal): Likewise. (parse_arguments): Updated my email address. diff --git a/automake.in b/automake.in index 665724bc..dda1a006 100755 --- a/automake.in +++ b/automake.in @@ -5153,7 +5153,8 @@ sub lang_c_rewrite if (defined $options{'subdir-objects'}) { $r = $LANG_SUBDIR; - $base = $directory . '/' . $base; + $base = $directory . '/' . $base + unless $directory eq '.' || $directory eq ''; if (! $seen_cc_c_o) { @@ -5164,11 +5165,18 @@ sub lang_c_rewrite } require_conf_file ("$am_file.am", FOREIGN, 'compile'); + + # In this case we already have the directory information, so + # don't add it again. + $de_ansi_files{$base} = ''; + } + else + { + $de_ansi_files{$base} = (($directory eq '.' || $directory eq '') + ? '' + : "$directory/"); } - $de_ansi_files{$base} = (($directory eq '.' || $directory eq '') - ? '' - : "$directory/"); return $r; } diff --git a/tests/Makefile.am b/tests/Makefile.am index 8af8343b..2f5c100a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,6 +25,7 @@ ansi3.test \ ansi4.test \ ansi5.test \ ansi6.test \ +ansi7.test \ ar.test \ asm.test \ auxdir.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 41e745bb..daa2ffb3 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,7 +1,7 @@ # Makefile.in generated by automake 1.5c from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -99,6 +99,7 @@ ansi3.test \ ansi4.test \ ansi5.test \ ansi6.test \ +ansi7.test \ ar.test \ asm.test \ auxdir.test \ diff --git a/tests/ansi7.test b/tests/ansi7.test new file mode 100755 index 00000000..5ca9bc40 --- /dev/null +++ b/tests/ansi7.test @@ -0,0 +1,56 @@ +#! /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_PROG_CC_C_O +AM_C_PROTOTYPES +AC_EXEEXT +AC_OBJEXT +AC_CONFIG_FILES(Makefile) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = ansi2knr subdir-objects +bin_PROGRAMS = hello +hello_SOURCES = hello.c sub/dir.c +END + +cat > hello.c << 'END' +#include + +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