1 # Autoconf M4 include file defining utility macros for complex Canadian
5 # _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM
7 # These demand that AC_CANONICAL_SYSTEM be called beforehand.
8 AC_DEFUN([_NCN_TOOL_PREFIXES],
10 test -n "$host_alias" && ncn_tool_prefix=$host_alias-
11 ncn_target_tool_prefix=
12 test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
13 ]) []dnl # _NCN_TOOL_PREFIXES
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.
20 AC_DEFUN([NCN_CHECK_TARGET_TOOL],
21 [AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
22 if test -n "$ncn_target_tool_prefix"; then
23 AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2],
24 [${ncn_target_tool_prefix}$2], , [$4])
26 if test -z "$ac_cv_prog_$1" ; then
28 AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [$3], [$4])
33 ]) []dnl # NCN_CHECK_TARGET_TOOL
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.
40 AC_DEFUN([NCN_STRICT_CHECK_TOOL],
41 [AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
42 if test -n "$ncn_tool_prefix"; then
43 AC_CHECK_PROG([$1], [${ncn_tool_prefix}$2],
44 [${ncn_tool_prefix}$2], , [$4])
46 if test -z "$ac_cv_prog_$1" ; then
47 if test $build = $host ; then
49 AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4])
52 $1="ifelse([$3],[],[${ncn_tool_prefix}$2],[$3])"
57 ]) []dnl # NCN_STRICT_CHECK_TOOL
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.
64 AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOL],
65 [AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
66 if test -n "$ncn_target_tool_prefix"; then
67 AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}$2],
68 [${ncn_target_tool_prefix}$2], , [$4])
70 if test -z "$ac_cv_prog_$1" ; then
71 if test $build = $target ; then
73 AC_CHECK_PROG([ncn_cv_$1], [$2], [$2], [ifelse([$3],[],[$2],[$3])], [$4])
76 $1="ifelse([$3],[],[${ncn_target_tool_prefix}$2],[$3])"
81 ]) []dnl # NCN_STRICT_CHECK_TARGET_TOOL