]> sourceware.org Git - automake.git/commitdiff
For PR automake/288:
authorTom Tromey <tromey@redhat.com>
Fri, 18 Jan 2002 22:20:28 +0000 (22:20 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 18 Jan 2002 22:20:28 +0000 (22:20 +0000)
* 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.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/ansi7.test [new file with mode: 0755]

index 0cf0f62072b17b9a57b7f3eae5d6fc158261a5c7..10ff204072728d0791334029fb1797493a29f40b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2002-01-18  Tom Tromey  <tromey@redhat.com>
 
+       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.
index 665724bc67fe830c61e19fe8fae16abe0698223a..dda1a006cbd7028e9936740eb90f4a6419afd45b 100755 (executable)
@@ -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;
 }
 
index 8af8343bbb62b0de1d1e64216a168f514983e0b4..2f5c100aa285bf739a42198eaa725497c228494c 100644 (file)
@@ -25,6 +25,7 @@ ansi3.test \
 ansi4.test \
 ansi5.test \
 ansi6.test \
+ansi7.test \
 ar.test \
 asm.test \
 auxdir.test \
index 41e745bb15105407401ec1ed24f669a9abb912cf..daa2ffb359ead9371541f1c901feae18779da2b4 100644 (file)
@@ -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 (executable)
index 0000000..5ca9bc4
--- /dev/null
@@ -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 <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
This page took 0.043644 seconds and 5 git commands to generate.