automake-patches
[Top][All Lists]
Advanced

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

Re: Automake needs to recognise AC_CANONICAL_BUILD


From: Alexandre Duret-Lutz
Subject: Re: Automake needs to recognise AC_CANONICAL_BUILD
Date: Mon, 02 Aug 2004 00:14:18 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

>>> "Norman" == Norman Gray <address@hidden> writes:

[...]

 Norman> I haven't yet completed FSF copyright paperwork, though I'm in the
 Norman> process or organising that for other patches I hope to contribute.
 Norman> Perhaps this patch is too small to require paperwork.

It's too long, but fortunately it's not entirely correct as
these macros are nested (TARGET implies HOST which implies
BUILD; this matters when defining %TARGET%, %HOST% and %BUILD%).
I'm installing this, which only reuses parts of your test case.

Thanks for catching that bug.  I wonder why nobody ever noticed.

I'm installing this on HEAD and branch-1-9.
I'll update Autoconf accordingly in a moment.

2004-08-02  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (AC_CANONICAL_HOST, AC_CANONICAL_SYSTEM): Replace by ...
        (AC_CANONICAL_BUILD, AC_CANONICAL_HOST, AC_CANONICAL_SYSTEM): ... these.
        (scan_autoconf_traces): Scan for the latter three macros instead of
        the former two.
        (make_paragraphs): Adjust definitions of %BUILD%, %HOST%, and %TARGET%.
        * tests/hosts.test: New file.
        * tests/Makefile.am (TESTS): Add hosts.test.
        Report and test case from Norman Gray.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1569
diff -u -r1.1569 automake.in
--- automake.in 28 Jul 2004 20:05:15 -0000      1.1569
+++ automake.in 1 Aug 2004 22:12:55 -0000
@@ -197,8 +197,9 @@
   '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$";
 
 # Values for AC_CANONICAL_*
-use constant AC_CANONICAL_HOST   => 1;
-use constant AC_CANONICAL_SYSTEM => 2;
+use constant AC_CANONICAL_BUILD  => 1;
+use constant AC_CANONICAL_HOST   => 2;
+use constant AC_CANONICAL_TARGET => 3;
 
 # Values indicating when something should be cleaned.
 use constant MOSTLY_CLEAN     => 0;
@@ -342,8 +343,9 @@
 # Lists of tags supported by Libtool.
 my %libtool_tags = ();
 
-# TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM).
+# Most important AC_CANONICAL_* macro seen so far.
 my $seen_canonical = 0;
+# Location of that macro.
 my $canonical_location;
 
 # Where AM_MAINTAINER_MODE appears.
@@ -4633,8 +4635,9 @@
   # IMPORTANT: If you add a macro here, you should also add this macro
   # =========  to Automake-preselection in autoconf/lib/autom4te.in.
   my %traced = (
+               AC_CANONICAL_BUILD => 0,
                AC_CANONICAL_HOST => 0,
-               AC_CANONICAL_SYSTEM => 0,
+               AC_CANONICAL_TARGET => 0,
                AC_CONFIG_AUX_DIR => 1,
                AC_CONFIG_FILES => 1,
                AC_CONFIG_HEADERS => 1,
@@ -4685,17 +4688,25 @@
        }
 
       # Alphabetical ordering please.
-      if ($macro eq 'AC_CANONICAL_HOST')
+      if ($macro eq 'AC_CANONICAL_BUILD')
        {
-         if (! $seen_canonical)
+         if ($seen_canonical <= AC_CANONICAL_BUILD)
+           {
+             $seen_canonical = AC_CANONICAL_BUILD;
+             $canonical_location = $where;
+           }
+       }
+      elsif ($macro eq 'AC_CANONICAL_HOST')
+       {
+         if ($seen_canonical <= AC_CANONICAL_HOST)
            {
              $seen_canonical = AC_CANONICAL_HOST;
              $canonical_location = $where;
            }
        }
-      elsif ($macro eq 'AC_CANONICAL_SYSTEM')
+      elsif ($macro eq 'AC_CANONICAL_TARGET')
        {
-         $seen_canonical = AC_CANONICAL_SYSTEM;
+         $seen_canonical = AC_CANONICAL_TARGET;
          $canonical_location = $where;
        }
       elsif ($macro eq 'AC_CONFIG_AUX_DIR')
@@ -6097,9 +6108,9 @@
                 'TOPDIR'       => backname ($relative_dir),
                 'TOPDIR_P'     => $relative_dir eq '.',
 
-                'BUILD'    => $seen_canonical == AC_CANONICAL_SYSTEM,
-                'HOST'     => $seen_canonical,
-                'TARGET'   => $seen_canonical == AC_CANONICAL_SYSTEM,
+                'BUILD'    => ($seen_canonical >= AC_CANONICAL_BUILD),
+                'HOST'     => ($seen_canonical >= AC_CANONICAL_HOST),
+                'TARGET'   => ($seen_canonical >= AC_CANONICAL_TARGET),
 
                 'LIBTOOL'      => !! var ('LIBTOOL'),
                 'NONLIBTOOL'   => 1,
@@ -7112,8 +7123,8 @@
   # handle_libtool.)
   if ($relative_dir eq '.')
     {
-      # AC_CANONICAL_HOST and AC_CANONICAL_SYSTEM need config.guess and
-      # config.sub.
+      # AC_CANONICAL_HOST, AC_CANONICAL_SYSTEM, and AC_CANONICAL_TARGET
+      # need config.guess and config.sub.
       require_conf_file ($canonical_location, FOREIGN,
                         'config.guess', 'config.sub')
        if $seen_canonical;
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.565
diff -u -r1.565 Makefile.am
--- tests/Makefile.am   11 Jul 2004 22:07:24 -0000      1.565
+++ tests/Makefile.am   1 Aug 2004 22:12:55 -0000
@@ -245,6 +245,7 @@
 gnits3.test \
 header.test \
 help.test \
+hosts.test \
 implicit.test \
 include.test \
 include2.test \
Index: tests/hosts.test
===================================================================
RCS file: tests/hosts.test
diff -N tests/hosts.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/hosts.test    1 Aug 2004 22:12:57 -0000
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 2004  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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test to make sure automake correctly recognizes presence of
+# AC_CANONICAL_(BUILD|HOST|SYSTEM|TARGET), and creates config.* in all
+# those cases.
+# From Norman Gray.
+
+. ./defs || exit 1
+
+set -e
+
+: >Makefile.am
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+test ! -f config.guess
+test ! -f config.sub
+
+# Test all four of the AC_CANONICAL_* targets, including _SYSTEM, which is
+# supported but deprecated by autoconf.
+for macro in AC_CANONICAL_BUILD AC_CANONICAL_HOST \
+             AC_CANONICAL_SYSTEM AC_CANONICAL_TARGET
+do
+  rm -rf autom4te.cache config.sub config.guess
+
+  cat >configure.in<<EOF
+AC_INIT([hosts], [1.0])
+$macro
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+EOF
+
+  $ACLOCAL
+  $AUTOMAKE --add-missing
+
+  # Show the files which were installed
+  ls
+
+  test -f config.guess
+  test -f config.sub
+done
-- 
Alexandre Duret-Lutz





reply via email to

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