Hello,
  I factored out common code from AC_*TOOL macros.

Then I changed
        test "$build" != "$host"
to
        test "$cross_compiling" = yes

as we are recommending this in the manual.

This induced some hacks in the testsuite.  (In cases where the tests
set cross_compilig=yes.)

I committed the resulting patch, as attached to this mail.

Have a nice day,
        Stepan
2006-03-17  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autoconf/programs.m4 (AC_PATH_TOOL, AC_CHECK_TOOL, 
AC_CHECK_TOOLS):
          Factor out the warning to...
        (_AC_TOOL_WARN): ... this new macro; use `cross_compiling'.
        * tests/local.at (AT_CHECK_MACRO_CROSS): Avoid this warning.
        * tests/semantics.at (AC_C_BIGENDIAN): Likewise.

Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.49
diff -u -r1.49 programs.m4
--- lib/autoconf/programs.m4    17 Mar 2006 19:05:27 -0000      1.49
+++ lib/autoconf/programs.m4    17 Mar 2006 20:26:20 -0000
@@ -206,6 +206,17 @@
 AU_DEFUN([AC_CHECK_TOOL_PREFIX])
 
 
+# _AC_TOOL_WARN
+# -------------
+AC_DEFUN([_AC_TOOL_WARN],
+[case $cross_compiling:$ac_tool_warned in
+yes:)
+AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to [EMAIL PROTECTED])
+ac_tool_warned=yes ;;
+esac])
+
 # AC_PATH_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH])
 # -----------------------------------------------------------------------
 # (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
@@ -219,11 +230,7 @@
   if test "x$ac_pt_$1" = x; then
     $1="$3"
   else
-    if test "$build" != "$host"; then
-      AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to [EMAIL PROTECTED])
-    fi
+    _AC_TOOL_WARN
     $1=$ac_pt_$1
   fi
 else
@@ -245,11 +252,7 @@
   if test "x$ac_ct_$1" = x; then
     $1="$3"
   else
-    if test "$build" != "$host"; then
-      AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to [EMAIL PROTECTED])
-    fi
+    _AC_TOOL_WARN
     $1=$ac_ct_$1
   fi
 else
@@ -280,11 +283,7 @@
   if test "x$ac_ct_$1" = x; then
     $1="$3"
   else
-    if test "$build" != "$host"; then
-      AC_MSG_WARN([In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to [EMAIL PROTECTED])
-    fi
+    _AC_TOOL_WARN
     $1=$ac_ct_$1
   fi
 fi
Index: tests/local.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/local.at,v
retrieving revision 1.26
diff -u -r1.26 local.at
--- tests/local.at      17 Mar 2006 18:03:01 -0000      1.26
+++ tests/local.at      17 Mar 2006 20:26:21 -0000
@@ -434,8 +434,9 @@
 [AT_CHECK_MACRO($@)
 AT_CHECK_MACRO([$1 (cross compile)],
   [AT_KEYWORDS([cross])
-  # Exercise the code used when cross-compiling
+  # Exercise the code used when cross-compiling.
   cross_compiling=yes
+  ac_tool_warned=yes
   m4_default([$2], [$1])],
   [$3], [$4])
 ])
Index: tests/semantics.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/semantics.at,v
retrieving revision 1.55
diff -u -r1.55 semantics.at
--- tests/semantics.at  17 Mar 2006 18:03:01 -0000      1.55
+++ tests/semantics.at  17 Mar 2006 20:26:21 -0000
@@ -465,7 +465,9 @@
 
 rm -f config.hin  # So that next run of autoheader is quiet.
 _AT_CHECK_AC_MACRO(
-  [[cross_compiling=yes
+  [[# Force cross compiling.
+   cross_compiling=yes
+   ac_tool_warned=yes
    AC_C_BIGENDIAN([ac_endian=big],[ac_endian=little],[ac_endian=unknown])
    ac_prevendian=`cat at-endian`
    # Check that we have found the same result as in the previous run

Reply via email to