automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: fix ansi2knr location reporting


From: Alexandre Duret-Lutz
Subject: FYI: fix ansi2knr location reporting
Date: Wed, 04 Jun 2003 22:15:43 +0200
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3 (gnu/linux)

I'm installing this on HEAD and branch-1-7.  This fixes an issue
similar to the one Akim reported with readme-alpha.  Here Automake
blindingly assumed that `ansi2knr' were coming from AUTOMAKE_OPTIONS.

2003-06-04  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (process_option_list): Record the location
        of ansi2knr's definition.
        (handle_compile): Use it.
        * tests/ansi3.test: Make sure the location appears correctly.
        Update to use set -e.
        * tests/ansi3b.test: New file.
        * tests/Makefile.am (TESTS): Add ansi3b.test.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1464
diff -u -r1.1464 automake.in
--- automake.in 4 Jun 2003 19:30:34 -0000       1.1464
+++ automake.in 4 Jun 2003 20:04:59 -0000
@@ -1400,7 +1400,7 @@
          # An option like "../lib/ansi2knr" is allowed.  With no
          # path prefix, we assume the required programs are in this
          # directory.  We save the actual option for later.
-         $options{'ansi2knr'} = $_;
+         $options{'ansi2knr'} = [$_, $where];
        }
       elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo'
             || $_ eq 'dist-shar' || $_ eq 'dist-zip'
@@ -2820,25 +2820,27 @@
     # Check for automatic de-ANSI-fication.
     if (defined $options{'ansi2knr'})
       {
-       require_variables_for_variable ('AUTOMAKE_OPTIONS',
-                                       "option `ansi2knr' is used",
-                                       "ANSI2KNR", "U");
+       my ($ansi2knr_filename, $ansi2knr_where) = @{$options{'ansi2knr'}};
+       my $ansi2knr_dir = '';
+
+       require_variables ($ansi2knr_where, "option `ansi2knr' is used",
+                          TRUE, "ANSI2KNR", "U");
 
        # topdir is where ansi2knr should be.
-       if ($options{'ansi2knr'} eq 'ansi2knr')
+       if ($ansi2knr_filename eq 'ansi2knr')
          {
            # Only require ansi2knr files if they should appear in
            # this directory.
-           require_file_with_macro (TRUE, 'AUTOMAKE_OPTIONS', FOREIGN,
-                                    'ansi2knr.c', 'ansi2knr.1');
+           require_file ($ansi2knr_where, FOREIGN,
+                         'ansi2knr.c', 'ansi2knr.1');
 
            # ansi2knr needs to be built before subdirs, so unshift it.
            unshift (@all, '$(ANSI2KNR)');
          }
-
-       my $ansi2knr_dir = '';
-       $ansi2knr_dir = dirname ($options{'ansi2knr'})
-         if $options{'ansi2knr'} ne 'ansi2knr';
+       else
+         {
+           $ansi2knr_dir = dirname ($ansi2knr_filename);
+         }
 
        $output_rules .= &file_contents ('ansi2knr',
                                         new Automake::Location,
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.495
diff -u -r1.495 Makefile.am
--- tests/Makefile.am   4 Jun 2003 19:30:35 -0000       1.495
+++ tests/Makefile.am   4 Jun 2003 20:04:59 -0000
@@ -26,6 +26,7 @@
 ansi.test \
 ansi2.test \
 ansi3.test \
+ansi3b.test \
 ansi4.test \
 ansi5.test \
 ansi6.test \
Index: tests/ansi3.test
===================================================================
RCS file: /cvs/automake/automake/tests/ansi3.test,v
retrieving revision 1.12
diff -u -r1.12 ansi3.test
--- tests/ansi3.test    10 Jan 2003 18:15:21 -0000      1.12
+++ tests/ansi3.test    4 Jun 2003 20:04:59 -0000
@@ -24,6 +24,8 @@
 required=gcc
 . ./defs || exit 1
 
+set -e
+
 cat > configure.in << 'END'
 AC_INIT(hello.c)
 AM_INIT_AUTOMAKE(hello,0.23)
@@ -53,9 +55,11 @@
 
 # We use gcc and not gcc -traditional as the latter fails on some
 # Linux boxes (Red Hat 5.1 in particular).
-$ACLOCAL \
-   && $AUTOCONF \
-   && $AUTOMAKE -a \
-   && CC='gcc' ./configure \
-   && ANSI2KNR=./ansi2knr U=_ $MAKE -e \
-   && ./hello
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a 2>stderr
+cat stderr
+grep 'Makefile.am:1:.*ansi2knr\.c' stderr
+CC='gcc' ./configure
+ANSI2KNR=./ansi2knr U=_ $MAKE -e
+./hello
Index: tests/ansi3b.test
===================================================================
RCS file: tests/ansi3b.test
diff -N tests/ansi3b.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/ansi3b.test   4 Jun 2003 20:04:59 -0000
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 1998, 1999, 2001, 2002, 2003  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Automake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with autoconf; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Actual test of ansi2knr functionality.  Relies on existence
+# of working gcc.  Same as ansi3.test, but with AUTOMAKE_OPTIONS
+# defined in configure.in.
+
+required=gcc
+. ./defs || exit 1
+
+set -e
+
+cat > configure.in << 'END'
+AC_INIT([hello], [0.24])
+AM_INIT_AUTOMAKE([ansi2knr no-dependencies])
+AC_PROG_CC
+AM_C_PROTOTYPES
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+echo 'bin_PROGRAMS = hello' > Makefile.am
+
+cat > hello.c << 'END'
+#include <stdio.h>
+int
+main (int argc, char *argv[])
+{
+   printf ("yeah, yeah\n");
+   return 0;
+}
+END
+
+# Ignore user CFLAGS.
+CFLAGS=
+export CFLAGS
+
+# We use gcc and not gcc -traditional as the latter fails on some
+# Linux boxes (Red Hat 5.1 in particular).
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a 2>stderr
+cat stderr
+grep 'configure.in:2:.*ansi2knr\.1' stderr
+CC='gcc' ./configure
+ANSI2KNR=./ansi2knr U=_ $MAKE -e
+./hello

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]