Commit | Line | Data |
---|---|---|
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. | |
8 | AC_DEFUN([_NCN_TOOL_PREFIXES], | |
9 | [ncn_tool_prefix= | |
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 | |
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 | ||
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]) | |
25 | fi | |
26 | if 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 |
30 | else |
31 | $1="$ac_cv_prog_$1" | |
32 | fi | |
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 | ||
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]) | |
45 | fi | |
46 | if 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 |
54 | else | |
55 | $1="$ac_cv_prog_$1" | |
56 | fi | |
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 | ||
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]) | |
69 | fi | |
70 | if 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 |
78 | else | |
79 | $1="$ac_cv_prog_$1" | |
80 | fi | |
81 | ]) []dnl # NCN_STRICT_CHECK_TARGET_TOOL |