]> git.ipfire.org Git - thirdparty/gcc.git/blame - config/acx.m4
configure: Rebuilt.
[thirdparty/gcc.git] / config / acx.m4
CommitLineData
671aa708
NN
1# Autoconf M4 include file defining utility macros for complex Canadian
2# cross builds.
3
8b87bb96
NN
4dnl ####
5dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
6dnl # $build_alias or canonical $build if blank.
7dnl # Used when we would use $build_alias, but empty is not OK.
8AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_BUILD],
9[AC_REQUIRE([AC_CANONICAL_BUILD]) []dnl
10case ${build_alias} in
11 "") build_noncanonical=${build} ;;
12 *) build_noncanonical=${build_alias} ;;
13esac
14]) []dnl # _GCC_TOPLEV_NONCANONICAL_BUILD
15
16dnl ####
17dnl # _GCC_TOPLEV_NONCANONICAL_HOST
18dnl # $host_alias, or $build_noncanonical if blank.
19dnl # Used when we would use $host_alias, but empty is not OK.
20AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_HOST],
21[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
22case ${host_alias} in
23 "") host_noncanonical=${build_noncanonical} ;;
24 *) host_noncanonical=${host_alias} ;;
25esac
26]) []dnl # _GCC_TOPLEV_NONCANONICAL_HOST
27
28dnl ####
29dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
30dnl # $target_alias or $host_noncanonical if blank.
31dnl # Used when we would use $target_alias, but empty is not OK.
32AC_DEFUN([_GCC_TOPLEV_NONCANONICAL_TARGET],
33[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
34case ${target_alias} in
35 "") target_noncanonical=${host_noncanonical} ;;
36 *) target_noncanonical=${target_alias} ;;
37esac
38]) []dnl # _GCC_TOPLEV_NONCANONICAL_TARGET
39
41693162
NN
40dnl ####
41dnl # ACX_NONCANONICAL_BUILD
42dnl # Like underscored version, but AC_SUBST's.
43AC_DEFUN([ACX_NONCANONICAL_BUILD],
44[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
45AC_SUBST(build_noncanonical)
46]) []dnl # ACX_NONCANONICAL_BUILD
47
48dnl ####
49dnl # ACX_NONCANONICAL_HOST
50dnl # Like underscored version, but AC_SUBST's.
51AC_DEFUN([ACX_NONCANONICAL_HOST],
52[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_HOST]) []dnl
53AC_SUBST(host_noncanonical)
54]) []dnl # ACX_NONCANONICAL_HOST
55
56dnl ####
57dnl # ACX_NONCANONICAL_TARGET
58dnl # Like underscored version, but AC_SUBST's.
59AC_DEFUN([ACX_NONCANONICAL_TARGET],
60[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
61AC_SUBST(target_noncanonical)
62]) []dnl # ACX_NONCANONICAL_TARGET
63
8b87bb96
NN
64dnl ####
65dnl # GCC_TOPLEV_SUBDIRS
66dnl # GCC & friends build 'build', 'host', and 'target' tools. These must
67dnl # be separated into three well-known subdirectories of the build directory:
68dnl # build_subdir, host_subdir, and target_subdir. The values are determined
69dnl # here so that they can (theoretically) be changed in the future. They
70dnl # were previously reproduced across many different files.
71dnl #
72dnl # This logic really amounts to very little with autoconf 2.13; it will
73dnl # amount to a lot more with autoconf 2.5x.
74AC_DEFUN([GCC_TOPLEV_SUBDIRS],
75[AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_TARGET]) []dnl
76AC_REQUIRE([_GCC_TOPLEV_NONCANONICAL_BUILD]) []dnl
57255173
PB
77
78# post-stage1 host modules use a different CC_FOR_BUILD so, in order to
79# have matching libraries, they should use host libraries: Makefile.tpl
80# arranges to pass --with-build-libsubdir=$(HOST_SUBDIR).
81# However, they still use the build modules, because the corresponding
82# host modules (e.g. bison) are only built for the host when bootstrap
83# finishes. So:
84# - build_subdir is where we find build modules, and never changes.
85# - build_libsubdir is where we find build libraries, and can be overridden.
86
8b87bb96
NN
87# Prefix 'build-' so this never conflicts with target_subdir.
88build_subdir="build-${build_noncanonical}"
57255173
PB
89AC_ARG_WITH(build-libsubdir,
90[ --with-build-libsubdir=[DIR] Directory where to find libraries for build system],
91build_libsubdir="$withval",
92build_libsubdir="$build_subdir")
215c351a
PB
93# --srcdir=. covers the toplevel, while "test -d" covers the subdirectories
94if ( test $srcdir = . && test -d gcc ) \
95 || test -d $srcdir/../host-${host_noncanonical}; then
96 host_subdir="host-${host_noncanonical}"
97else
98 host_subdir=.
99fi
8b87bb96
NN
100# No prefix.
101target_subdir=${target_noncanonical}
57255173 102AC_SUBST([build_libsubdir]) []dnl
8b87bb96
NN
103AC_SUBST([build_subdir]) []dnl
104AC_SUBST([host_subdir]) []dnl
105AC_SUBST([target_subdir]) []dnl
106]) []dnl # GCC_TOPLEV_SUBDIRS
107
108
671aa708
NN
109####
110# _NCN_TOOL_PREFIXES: Some stuff that oughtta be done in AC_CANONICAL_SYSTEM
111# or AC_INIT.
112# These demand that AC_CANONICAL_SYSTEM be called beforehand.
113AC_DEFUN([_NCN_TOOL_PREFIXES],
114[ncn_tool_prefix=
115test -n "$host_alias" && ncn_tool_prefix=$host_alias-
116ncn_target_tool_prefix=
117test -n "$target_alias" && ncn_target_tool_prefix=$target_alias-
118]) []dnl # _NCN_TOOL_PREFIXES
119
120####
2693c0b0 121# NCN_STRICT_CHECK_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path])
e8b05380 122# Like plain AC_CHECK_TOOLS, but require prefix if build!=host.
671aa708 123
2693c0b0 124AC_DEFUN([NCN_STRICT_CHECK_TOOLS],
671aa708 125[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
278a7a38
AO
126AC_ARG_VAR([$1], [$1 for the host])
127
128if test -n "[$]$1"; then
129 ac_cv_prog_$1=[$]$1
130elif test -n "$ac_cv_prog_$1"; then
131 $1=$ac_cv_prog_$1
132fi
133
134if test -n "$ac_cv_prog_$1"; then
135 for ncn_progname in $2; do
136 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
137 done
138fi
139
2693c0b0
PB
140for ncn_progname in $2; do
141 if test -n "$ncn_tool_prefix"; then
142 AC_CHECK_PROG([$1], [${ncn_tool_prefix}${ncn_progname}],
143 [${ncn_tool_prefix}${ncn_progname}], , [$4])
144 fi
145 if test -z "$ac_cv_prog_$1" && test $build = $host ; then
146 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
147 fi
148 test -n "$ac_cv_prog_$1" && break
149done
671aa708 150
671aa708 151if test -z "$ac_cv_prog_$1" ; then
2693c0b0 152 ifelse([$3],[], [set dummy $2
671aa708 153 if test $build = $host ; then
2693c0b0 154 $1="[$]2"
671aa708 155 else
2693c0b0
PB
156 $1="${ncn_tool_prefix}[$]2"
157 fi], [$1="$3"])
671aa708 158fi
2693c0b0 159]) []dnl # NCN_STRICT_CHECK_TOOLS
671aa708
NN
160
161####
2693c0b0
PB
162# NCN_STRICT_CHECK_TARGET_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path])
163# Like CVS Autoconf AC_CHECK_TARGET_TOOLS, but require prefix if build!=target.
671aa708 164
2693c0b0 165AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOLS],
671aa708 166[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
278a7a38
AO
167AC_ARG_VAR([$1], patsubst([$1], [_FOR_TARGET$], [])[ for the target])
168
169if test -n "[$]$1"; then
170 ac_cv_prog_$1=[$]$1
171elif test -n "$ac_cv_prog_$1"; then
172 $1=$ac_cv_prog_$1
173fi
174
175if test -n "$ac_cv_prog_$1"; then
176 for ncn_progname in $2; do
177 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
178 done
179fi
180
181if test -z "$ac_cv_prog_$1" && test -n "$with_build_time_tools"; then
e8b05380
PB
182 for ncn_progname in $2; do
183 AC_MSG_CHECKING([for ${ncn_progname} in $with_build_time_tools])
d1f8db0c
PB
184 if test -x $with_build_time_tools/${ncn_progname}; then
185 ac_cv_prog_$1=$with_build_time_tools/${ncn_progname}
e8b05380
PB
186 AC_MSG_RESULT(yes)
187 break
188 else
189 AC_MSG_RESULT(no)
190 fi
191 done
192fi
2693c0b0 193
e8b05380
PB
194if test -z "$ac_cv_prog_$1"; then
195 for ncn_progname in $2; do
196 if test -n "$ncn_target_tool_prefix"; then
197 AC_CHECK_PROG([$1], [${ncn_target_tool_prefix}${ncn_progname}],
198 [${ncn_target_tool_prefix}${ncn_progname}], , [$4])
199 fi
200 if test -z "$ac_cv_prog_$1" && test $build = $target ; then
201 AC_CHECK_PROG([$1], [${ncn_progname}], [${ncn_progname}], , [$4])
202 fi
203 test -n "$ac_cv_prog_$1" && break
204 done
205fi
206
671aa708 207if test -z "$ac_cv_prog_$1" ; then
2693c0b0 208 ifelse([$3],[], [set dummy $2
671aa708 209 if test $build = $target ; then
2693c0b0 210 $1="[$]2"
671aa708 211 else
2693c0b0
PB
212 $1="${ncn_target_tool_prefix}[$]2"
213 fi], [$1="$3"])
671aa708 214fi
2693c0b0 215]) []dnl # NCN_STRICT_CHECK_TARGET_TOOLS
e8b05380
PB
216
217
218# Backported from Autoconf 2.5x; can go away when and if
219# we switch. Put the OS path separator in $PATH_SEPARATOR.
220AC_DEFUN([ACX_PATH_SEP], [
221# The user is always right.
222if test "${PATH_SEPARATOR+set}" != set; then
223 echo "#! /bin/sh" >conf$$.sh
224 echo "exit 0" >>conf$$.sh
225 chmod +x conf$$.sh
226 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
227 PATH_SEPARATOR=';'
228 else
229 PATH_SEPARATOR=:
230 fi
231 rm -f conf$$.sh
232fi
233])
234
235
236AC_DEFUN([ACX_TOOL_DIRS], [
237AC_REQUIRE([ACX_PATH_SEP])
238if test "x$exec_prefix" = xNONE; then
239 if test "x$prefix" = xNONE; then
240 gcc_cv_tool_prefix=$ac_default_prefix
241 else
242 gcc_cv_tool_prefix=$prefix
243 fi
244else
245 gcc_cv_tool_prefix=$exec_prefix
246fi
247
248# If there is no compiler in the tree, use the PATH only. In any
249# case, if there is no compiler in the tree nobody should use
250# AS_FOR_TARGET and LD_FOR_TARGET.
251if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then
252 gcc_version=`cat $srcdir/gcc/BASE-VER`
253 gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
254 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR"
255 gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
256 gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical$PATH_SEPARATOR"
257 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
258 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin$PATH_SEPARATOR"
259else
260 gcc_cv_tool_dirs=
261fi
262
263if test x$build = x$target && test -n "$md_exec_prefix"; then
264 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$md_exec_prefix$PATH_SEPARATOR"
265fi
266
267]) []dnl # ACX_TOOL_DIRS
268
269# ACX_HAVE_GCC_FOR_TARGET
270# Check if the variable GCC_FOR_TARGET really points to a GCC binary.
271AC_DEFUN([ACX_HAVE_GCC_FOR_TARGET], [
272cat > conftest.c << \EOF
273#ifdef __GNUC__
274 gcc_yay;
275#endif
276EOF
277if ($GCC_FOR_TARGET -E conftest.c | grep gcc_yay) > /dev/null 2>&1; then
278 have_gcc_for_target=yes
279else
280 GCC_FOR_TARGET=${ncn_target_tool_prefix}gcc
281 have_gcc_for_target=no
282fi
283rm conftest.c
284])
285
286# ACX_CHECK_INSTALLED_TARGET_TOOL(VAR, PROG)
287# Searching for installed target binutils. We need to take extra care,
288# else we may find the wrong assembler, linker, etc., and lose.
289#
290# First try --with-build-time-tools, if specified.
291#
292# For build != host, we ask the installed GCC for the name of the tool it
293# uses, and accept it if it is an absolute path. This is because the
294# only good choice for a compiler is the same GCC version that is being
295# installed (or we couldn't make target libraries), and we assume that
296# on the host system we'll have not only the same GCC version, but also
297# the same binutils version.
298#
299# For build == host, search the same directories that the installed
300# compiler will search. We used to do this for the assembler, linker,
301# and nm only; for simplicity of configuration, however, we extend this
302# criterion to tools (such as ar and ranlib) that are never invoked by
303# the compiler, to avoid mismatches.
304#
305# Also note we have to check MD_EXEC_PREFIX before checking the user's path
306# if build == target. This makes the most sense only when bootstrapping,
307# but we also do so when build != host. In this case, we hope that the
308# build and host systems will have similar contents of MD_EXEC_PREFIX.
309#
310# If we do not find a suitable binary, then try the user's path.
311
312AC_DEFUN([ACX_CHECK_INSTALLED_TARGET_TOOL], [
313AC_REQUIRE([ACX_TOOL_DIRS])
314AC_REQUIRE([ACX_HAVE_GCC_FOR_TARGET])
315if test -z "$ac_cv_path_$1" ; then
316 if test -n "$with_build_time_tools"; then
d1f8db0c
PB
317 AC_MSG_CHECKING([for $2 in $with_build_time_tools])
318 if test -x $with_build_time_tools/$2; then
319 $1=`cd $with_build_time_tools && pwd`/$2
320 ac_cv_path_$1=[$]$1
321 AC_MSG_RESULT([$ac_cv_path_$1])
322 else
323 AC_MSG_RESULT(no)
324 fi
e8b05380
PB
325 elif test $build != $host && test $have_gcc_for_target = yes; then
326 $1=`$GCC_FOR_TARGET --print-prog-name=$2`
327 test [$]$1=$2 && $1=
328 ac_cv_path_$1=[$]$1
329 fi
330fi
1c710c3c 331if test -z "$ac_cv_path_$1" && test -n "$gcc_cv_tool_dirs"; then
e8b05380
PB
332 AC_PATH_PROG([$1], [$2], [], [$gcc_cv_tool_dirs])
333fi
334if test -z "$ac_cv_path_$1" ; then
335 NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2])
d1f8db0c
PB
336else
337 $1=$ac_cv_path_$1
e8b05380
PB
338fi
339]) []dnl # ACX_CHECK_INSTALLED_TARGET_TOOL
029e256e
DJ
340
341###
342# AC_PROG_CPP_WERROR
343# Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which
344# triggers warnings from the preprocessor. Will be in autoconf 2.58.
345# For now, using this also overrides header checks to use only the
346# preprocessor (matches 2.13 behavior; matching 2.58's behavior is a
347# bit harder from here).
348# Eventually autoconf will default to checking headers with the compiler
349# instead, and we'll have to do this differently.
350
351AC_DEFUN([AC_PROG_CPP_WERROR],
352[AC_REQUIRE([AC_PROG_CPP])dnl
353m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD]))
354ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
e4c9c075
PB
355
356# Test for GNAT.
357# We require the gnatbind program, and a compiler driver that
358# understands Ada. We use the user's CC setting, already found.
359#
360# Sets the shell variable have_gnat to yes or no as appropriate, and
5305be7e 361# substitutes GNATBIND and GNATMAKE.
e4c9c075
PB
362AC_DEFUN([ACX_PROG_GNAT],
363[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
364AC_REQUIRE([AC_PROG_CC])
365AC_CHECK_TOOL(GNATBIND, gnatbind, no)
5305be7e 366AC_CHECK_TOOL(GNATMAKE, gnatmake, no)
e4c9c075
PB
367AC_CACHE_CHECK([whether compiler driver understands Ada],
368 acx_cv_cc_gcc_supports_ada,
369[cat >conftest.adb <<EOF
370procedure conftest is begin null; end conftest;
371EOF
372acx_cv_cc_gcc_supports_ada=no
373# There is a bug in old released versions of GCC which causes the
374# driver to exit successfully when the appropriate language module
375# has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
376# Therefore we must check for the error message as well as an
377# unsuccessful exit.
1db673ca
RO
378# Other compilers, like HP Tru64 UNIX cc, exit successfully when
379# given a .adb file, but produce no object file. So we must check
380# if an object file was really produced to guard against this.
e4c9c075 381errors=`(${CC} -c conftest.adb) 2>&1 || echo failure`
1db673ca 382if test x"$errors" = x && test -f conftest.$ac_objext; then
e4c9c075 383 acx_cv_cc_gcc_supports_ada=yes
e4c9c075
PB
384fi
385rm -f conftest.*])
386
5305be7e 387if test x$GNATBIND != xno && test x$GNATMAKE != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
e4c9c075
PB
388 have_gnat=yes
389else
390 have_gnat=no
391fi
392])
6cf1ac42
PB
393
394dnl 'make compare' can be significantly faster, if cmp itself can
395dnl skip bytes instead of using tail. The test being performed is
396dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
397dnl but we need to sink errors and handle broken shells. We also test
398dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
399dnl accepted by cmp on some systems.
400AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL],
401[AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip,
402[ echo abfoo >t1
403 echo cdfoo >t2
404 gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2'
405 if cmp t1 t2 2 2 > /dev/null 2>&1; then
406 if cmp t1 t2 1 1 > /dev/null 2>&1; then
407 :
408 else
409 gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16'
410 fi
411 fi
412 if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
413 if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
414 :
415 else
416 gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2'
417 fi
418 fi
419 rm t1 t2
420])
421do_compare="$gcc_cv_prog_cmp_skip"
422AC_SUBST(do_compare)
423])
4f4e53dd
PB
424
425dnl See whether we can include both string.h and strings.h.
426AC_DEFUN([ACX_HEADER_STRING],
427[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
428 gcc_cv_header_string,
429[AC_TRY_COMPILE([#include <string.h>
430#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
431if test $gcc_cv_header_string = yes; then
432 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
433fi
434])
435
436dnl See if stdbool.h properly defines bool and true/false.
437dnl Check whether _Bool is built-in.
438AC_DEFUN([ACX_HEADER_STDBOOL],
439[AC_CACHE_CHECK([for working stdbool.h],
440 ac_cv_header_stdbool_h,
441[AC_TRY_COMPILE([#include <stdbool.h>],
442[bool foo = false;],
443ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
444if test $ac_cv_header_stdbool_h = yes; then
445 AC_DEFINE(HAVE_STDBOOL_H, 1,
446 [Define if you have a working <stdbool.h> header file.])
447fi
448AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
449[AC_TRY_COMPILE(,
450[_Bool foo;],
451gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
452])
453if test $gcc_cv_c__bool = yes; then
454 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
455fi
456])
457
ad6717df
PB
458dnl See if hard links work and if not, try to substitute $1 or simple copy.
459AC_DEFUN([ACX_PROG_LN],
460[AC_MSG_CHECKING(whether ln works)
461AC_CACHE_VAL(acx_cv_prog_LN,
462[rm -f conftestdata_t
463echo >conftestdata_f
464if ln conftestdata_f conftestdata_t 2>/dev/null
465then
466 acx_cv_prog_LN=ln
467else
468 acx_cv_prog_LN=no
469fi
470rm -f conftestdata_f conftestdata_t
471])dnl
472if test $acx_cv_prog_LN = no; then
473 LN="ifelse([$1],,cp,[$1])"
474 AC_MSG_RESULT([no, using $LN])
475else
476 LN="$acx_cv_prog_LN"
477 AC_MSG_RESULT(yes)
478fi
479AC_SUBST(LN)dnl
480])
481
2abefe3d
PB
482dnl GCC_TARGET_TOOL(PROGRAM, TARGET-VAR, HOST-VAR, IN-TREE-TOOL, LANGUAGE)
483AC_DEFUN([GCC_TARGET_TOOL],
484[AC_MSG_CHECKING(where to find the target $1)
485if test "x${build}" != "x${host}" ; then
e8b05380
PB
486 if expr "x[$]$2" : "x/" > /dev/null; then
487 # We already found the complete path
488 AC_MSG_RESULT(pre-installed in `dirname [$]$2`)
489 else
490 # Canadian cross, just use what we found
491 AC_MSG_RESULT(pre-installed)
492 fi
2abefe3d
PB
493else
494 ifelse([$4],,,
495 [ok=yes
496 case " ${configdirs} " in
497 *" patsubst([$4], [/.*], []) "*) ;;
498 *) ok=no ;;
499 esac
500 ifelse([$5],,,
501 [case ,${enable_languages}, in
502 *,$5,*) ;;
503 *) ok=no ;;
504 esac])
505 if test $ok = yes; then
506 # An in-tree tool is available and we can use it
507 $2='$$r/$(HOST_SUBDIR)/$4'
508 AC_MSG_RESULT(just compiled)
e8b05380
PB
509 el])if expr "x[$]$2" : "x/" > /dev/null; then
510 # We already found the complete path
511 AC_MSG_RESULT(pre-installed in `dirname [$]$2`)
512 elif test "x$target" = "x$host"; then
2abefe3d
PB
513 # We can use an host tool
514 $2='$($3)'
515 AC_MSG_RESULT(host tool)
516 else
517 # We need a cross tool
518 AC_MSG_RESULT(pre-installed)
519 fi
0b0dc272
AM
520fi
521AC_SUBST($2)])
758a2c96
DF
522
523
524dnl Locate a program and check that its version is acceptable.
525dnl ACX_PROG_CHECK_VER(var, name, version-switch,
526dnl version-extract-regexp, version-glob)
527AC_DEFUN([ACX_CHECK_PROG_VER],[
528 AC_CHECK_PROG([$1], [$2], [$2])
529 if test -n "[$]$1"; then
530 # Found it, now check the version.
531 AC_CACHE_CHECK([for modern $2],
532 [gcc_cv_prog_$2_modern],
533 [ac_prog_version=`eval [$]$1 $3 2>&1 |
534 sed -n 's/^.*patsubst([[$4]],/,\/).*$/\1/p'`
535
536 [case $ac_prog_version in
537 '') gcc_cv_prog_$2_modern=no;;
538 $5) gcc_cv_prog_$2_modern=yes;;
539 *) gcc_cv_prog_$2_modern=no;;
540 esac]
541
542 if test $gcc_cv_prog_$2_modern = no; then
543 $1="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing $2"
544 fi
545 ])
546 else
547 gcc_cv_prog_$2_modern=no
548 fi
003de0e1
PB
549 if test $gcc_cv_prog_$2_modern = no; then
550 $1="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing $2"
551 fi
758a2c96 552])