2003-05-18 David Carlton <carlton@bactrian.org>
[deliverable/binutils-gdb.git] / config / acx.m4
CommitLineData
5212e868
NN
1# Autoconf M4 include file defining utility macros for complex Canadian
2# cross builds.
3
4####
5# _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM
6# or AC_INIT.
7# These demand that AC_CANONICAL_SYSTEM be called beforehand.
8AC_DEFUN([_NCN_TOOL_PREFIXES],
9[ncn_tool_prefix=
10test -n "$host_alias" && ncn_tool_prefix=$host_alias-
11ncn_target_tool_prefix=
12test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
13]) []dnl # _NCN_TOOL_PREFIXES
14
15####
16# NCN_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path])
17# Like AC_CHECK_TOOL, but tries a prefix of the target, not the host.
18# Code is pretty much lifted from autoconf2.53.
19
20AC_DEFUN([NCN_CHECK_TARGET_TOOL],
21[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
22if test -n "$ncn_target_tool_prefix"; then
23 AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2],
24 [${ncn_target_tool_prefix}$2], , [$4])
25fi
26if test -z "$ac_cv_prog_$1" ; then
66e7a4d5
AO
27 ncn_cv_$1=$$1
28 AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [$3], [$4])
29 $1=$ncn_cv_$1
5212e868
NN
30else
31 $1="$ac_cv_prog_$1"
32fi
33]) []dnl # NCN_CHECK_TARGET_TOOL
34
35
36####
37# NCN_STRICT_CHECK_TOOL(variable, prog-to-check-for,[value-if-not-found],[path])
38# Like AC_CHECK_TOOL, but requires the prefix if build!=host.
39
40AC_DEFUN([NCN_STRICT_CHECK_TOOL],
41[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
42if test -n "$ncn_tool_prefix"; then
43 AC_CHECK_PROG([$1], [${ncn_tool_prefix}$2],
44 [${ncn_tool_prefix}$2], , [$4])
45fi
46if test -z "$ac_cv_prog_$1" ; then
47 if test $build = $host ; then
66e7a4d5
AO
48 ncn_cv_$1=$$1
49 AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4])
50 $1=$ncn_cv_$1
5212e868 51 else
66e7a4d5 52 $1="ifelse([$3],[],[${ncn_tool_prefix}$2],[$3])"
5212e868
NN
53 fi
54else
55 $1="$ac_cv_prog_$1"
56fi
57]) []dnl # NCN_STRICT_CHECK_TOOL
58
59
60####
61# NCN_STRICT_CHECK_TARGET_TOOL(variable, prog-to-check-for,[value-if-not-found],[path])
62# Like NCN_CHECK_TARGET_TOOL, but requires the prefix if build!=target.
63
64AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOL],
65[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
66if test -n "$ncn_target_tool_prefix"; then
67 AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2],
68 [${ncn_target_tool_prefix}$2], , [$4])
69fi
70if test -z "$ac_cv_prog_$1" ; then
71 if test $build = $target ; then
66e7a4d5
AO
72 ncn_cv_$1=$$1
73 AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4])
74 $1=$ncn_cv_$1
5212e868 75 else
66e7a4d5 76 $1="ifelse([$3],[],[${ncn_target_tool_prefix}$2],[$3])"
5212e868
NN
77 fi
78else
79 $1="$ac_cv_prog_$1"
80fi
81]) []dnl # NCN_STRICT_CHECK_TARGET_TOOL
This page took 0.040799 seconds and 4 git commands to generate.