[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Improve AC_CHECK_TOOL, introduce AC_CHECK_TARGET_TOOL (v. 4)
From: |
Nathanael Nerode |
Subject: |
[PATCH] Improve AC_CHECK_TOOL, introduce AC_CHECK_TARGET_TOOL (v. 4) |
Date: |
Sun, 19 Jan 2003 18:41:29 -0500 |
User-agent: |
Mutt/1.4i |
*Really* fix the cut-and-paste error. Otherwise, identical to v.2 and
v.3 of the same patch.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.716
diff -u -r1.716 autoconf.texi
--- doc/autoconf.texi 3 Dec 2002 07:35:31 -0000 1.716
+++ doc/autoconf.texi 19 Jan 2003 23:39:32 -0000
@@ -3251,9 +3251,10 @@
@acindex CHECK_TOOL
Like @code{AC_CHECK_PROG}, but first looks for @var{prog-to-check-for}
with a prefix of the host type as determined by
address@hidden, followed by a dash (@pxref{Canonicalizing}).
-For example, if the user runs @samp{configure --host=i386-gnu}, then
-this call:
address@hidden, followed by a dash (@pxref{Canonicalizing}). If
+the host type is not the same as the build type, the prefix is required.
+For example, if the user runs @samp{configure --build=i386-gnu
--host=i386-gnu},
+then this call:
@example
AC_CHECK_TOOL(RANLIB, ranlib, :)
@end example
@@ -3261,6 +3262,29 @@
sets @code{RANLIB} to @file{i386-gnu-ranlib} if that program exists in
@code{PATH}, or otherwise to @samp{ranlib} if that program exists in
@code{PATH}, or to @samp{:} if neither program exists.
+If instead the user runs @samp{configure --host=i386-gnu}, it sets
address@hidden to @file{i386-gnu-ranlib} if that program exists in
address@hidden, or to @samp{:} if that program doesn't exist.
address@hidden defmac
+
address@hidden AC_CHECK_TARGET_TOOL (@var{variable}, @var{prog-to-check-for},
@ovar{value-if-not-found}, @ovar{path})
address@hidden CHECK_TARGET_TOOL
+Like @code{AC_CHECK_PROG}, but first looks for @var{prog-to-check-for}
+with a prefix of the target type as determined by
address@hidden, followed by a dash (@pxref{Canonicalizing}). If
+the target type is not the same as the build type, the prefix is required.
+For example, if the user runs @samp{configure --build=i386-gnu
--target=i386-gnu},
+then this call:
address@hidden
+AC_CHECK_TARGET_TOOL(RANLIB_FOR_TARGET, ranlib, :)
address@hidden example
address@hidden
+sets @code{RANLIB_FOR_TARGET} to @file{i386-gnu-ranlib} if that program exists
in
address@hidden, or otherwise to @samp{ranlib} if that program exists in
address@hidden, or to @samp{:} if neither program exists.
+If instead the user runs @samp{configure --target=i386-gnu}, it sets
address@hidden to @file{i386-gnu-ranlib} if that program exists in
address@hidden, or to @samp{:} if that program doesn't exist.
@end defmac
@defmac AC_CHECK_TOOLS (@var{variable}, @var{progs-to-check-for},
@ovar{value-if-not-found}, @ovar{path})
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.811
diff -u -r1.811 general.m4
--- lib/autoconf/general.m4 12 Nov 2002 10:54:46 -0000 1.811
+++ lib/autoconf/general.m4 19 Jan 2003 23:39:40 -0000
@@ -929,6 +929,9 @@
ac_tool_prefix=
test -n "$host_alias" && ac_tool_prefix=$host_alias-
+ac_target_tool_prefix=
+test -n "$target_alias" && ac_target_tool_prefix=$target_alias-
+
test "$silent" = yes && exec AS_MESSAGE_FD>/dev/null
m4_divert_pop([PARSE_ARGS])dnl
Index: lib/autoconf/programs.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/programs.m4,v
retrieving revision 1.13
diff -u -r1.13 programs.m4
--- lib/autoconf/programs.m4 31 Oct 2002 13:15:03 -0000 1.13
+++ lib/autoconf/programs.m4 19 Jan 2003 23:39:41 -0000
@@ -192,13 +192,19 @@
# -----------------------------------------------------------------------
# (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.)
AC_DEFUN([AC_PATH_TOOL],
-[if test -n "$ac_tool_prefix"; then
+[AC_REQUIRE([AC_CANONICAL_BUILD])
+AC_REQUIRE([AC_CANONICAL_HOST])
+if test -n "$ac_tool_prefix"; then
AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4])
fi
if test -z "$ac_cv_path_$1"; then
- ac_pt_$1=$$1
- AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
- $1=$ac_pt_$1
+ if test $build = $host ; then
+ ac_pt_$1=$$1
+ AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4])
+ $1=$ac_pt_$1
+ else
+ $1="$3"
+ fi
else
$1="$ac_cv_path_$1"
fi
@@ -209,19 +215,48 @@
# ------------------------------------------------------------------------
# (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
AC_DEFUN([AC_CHECK_TOOL],
-[if test -n "$ac_tool_prefix"; then
+[AC_REQUIRE([AC_CANONICAL_BUILD])
+AC_REQUIRE([AC_CANONICAL_HOST])
+if test -n "$ac_tool_prefix"; then
AC_CHECK_PROG([$1], [${ac_tool_prefix}$2], [${ac_tool_prefix}$2], , [$4])
fi
if test -z "$ac_cv_prog_$1"; then
- ac_ct_$1=$$1
- AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
- $1=$ac_ct_$1
+ if test $build = $host ; then
+ ac_ct_$1=$$1
+ AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4])
+ $1=$ac_ct_$1
+ else
+ $1="$3"
+ fi
else
$1="$ac_cv_prog_$1"
fi
])# AC_CHECK_TOOL
+# AC_CHECK_TARGET_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
[PATH])
+# ------------------------------------------------------------------------
+# (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.)
+AC_DEFUN([AC_CHECK_TARGET_TOOL],
+[AC_REQUIRE([AC_CANONICAL_BUILD])
+AC_REQUIRE([AC_CANONICAL_TARGET])
+if test -n "$ac_target_tool_prefix"; then
+ AC_CHECK_PROG([$1], [${ac_target_tool_prefix}$2],
[${ac_target_tool_prefix}$2], , [$4])
+fi
+if test -z "$ac_cv_prog_$1"; then
+ if test $build = $target ; then
+ ac_ctt_$1=$$1
+ AC_CHECK_PROG([ac_ctt_$1], [$2], [$2], [$3], [$4])
+ $1=$ac_ctt_$1
+ else
+ $1="$3"
+ fi
+else
+ $1="$ac_cv_prog_$1"
+fi
+])# AC_CHECK_TARGET_TOOL
+
+
# AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND],
# [PATH])
# ------------------------------------------------------------------
@@ -229,7 +264,9 @@
# none can be found with a cross prefix, then use the first one that
# was found without the cross prefix.
AC_DEFUN([AC_CHECK_TOOLS],
-[if test -n "$ac_tool_prefix"; then
+[AC_REQUIRE([AC_CANONICAL_BUILD])
+AC_REQUIRE([AC_CANONICAL_HOST])
+if test -n "$ac_tool_prefix"; then
for ac_prog in $2
do
AC_CHECK_PROG([$1],
@@ -239,9 +276,13 @@
done
fi
if test -z "$$1"; then
- ac_ct_$1=$$1
- AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
- $1=$ac_ct_$1
+ if test $build = $host ; then
+ ac_ct_$1=$$1
+ AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4])
+ $1=$ac_ct_$1
+ else
+ $1="$3"
+ fi
fi
])# AC_CHECK_TOOLS
Index: tests/acgeneral.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/acgeneral.at,v
retrieving revision 1.6
diff -u -r1.6 acgeneral.at
--- tests/acgeneral.at 27 Oct 2002 18:30:39 -0000 1.6
+++ tests/acgeneral.at 19 Jan 2003 23:39:42 -0000
@@ -7,7 +7,6 @@
AT_CHECK_MACRO([AC_ARG_ENABLE])
AT_CHECK_MACRO([AC_ARG_PROGRAM])
AT_CHECK_MACRO([AC_ARG_WITH])
-AT_CHECK_MACRO([AC_CANONICAL_TARGET])
AT_CHECK_MACRO([AC_EGREP_CPP])
AT_CHECK_MACRO([AC_EGREP_HEADER])
AT_CHECK_MACRO([AC_PREFIX_DEFAULT])
Index: tests/mktests.sh
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/mktests.sh,v
retrieving revision 1.29
diff -u -r1.29 mktests.sh
--- tests/mktests.sh 2 Sep 2002 06:44:27 -0000 1.29
+++ tests/mktests.sh 19 Jan 2003 23:39:43 -0000
@@ -128,7 +128,7 @@
#
ac_exclude_list='^AC_ARG_VAR$
^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$
-^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$
+^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TARGET_TOOL|TYPE)S?$
^AC_CONFIG
^AC_F77_FUNC$
^AC_(FUNC_GETLOADAVG|REPLACE_FNMATCH|FUNC_FNMATCH_GNU)$
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Improve AC_CHECK_TOOL, introduce AC_CHECK_TARGET_TOOL (v. 4),
Nathanael Nerode <=