Missing parts of fixes for in-tree libiconv
[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
dd12c3a8
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
118c4fba
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
dd12c3a8
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
c1cb7e02
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
dd12c3a8
NN
87# Prefix 'build-' so this never conflicts with target_subdir.
88build_subdir="build-${build_noncanonical}"
c1cb7e02
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")
b00612cc
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
dd12c3a8
NN
100# No prefix.
101target_subdir=${target_noncanonical}
c1cb7e02 102AC_SUBST([build_libsubdir]) []dnl
dd12c3a8
NN
103AC_SUBST([build_subdir]) []dnl
104AC_SUBST([host_subdir]) []dnl
105AC_SUBST([target_subdir]) []dnl
106]) []dnl # GCC_TOPLEV_SUBDIRS
107
108
5212e868
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####
05cbd757 121# NCN_STRICT_CHECK_TOOLS(variable, progs-to-check-for,[value-if-not-found],[path])
2429c060 122# Like plain AC_CHECK_TOOLS, but require prefix if build!=host.
5212e868 123
05cbd757 124AC_DEFUN([NCN_STRICT_CHECK_TOOLS],
5212e868 125[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
9a819804
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
05cbd757
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
5212e868 150
5212e868 151if test -z "$ac_cv_prog_$1" ; then
05cbd757 152 ifelse([$3],[], [set dummy $2
5212e868 153 if test $build = $host ; then
05cbd757 154 $1="[$]2"
5212e868 155 else
05cbd757
PB
156 $1="${ncn_tool_prefix}[$]2"
157 fi], [$1="$3"])
5212e868 158fi
05cbd757 159]) []dnl # NCN_STRICT_CHECK_TOOLS
5212e868
NN
160
161####
05cbd757
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.
5212e868 164
05cbd757 165AC_DEFUN([NCN_STRICT_CHECK_TARGET_TOOLS],
5212e868 166[AC_REQUIRE([_NCN_TOOL_PREFIXES]) []dnl
9a819804
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
2429c060
PB
182 for ncn_progname in $2; do
183 AC_MSG_CHECKING([for ${ncn_progname} in $with_build_time_tools])
3a35eeb3
PB
184 if test -x $with_build_time_tools/${ncn_progname}; then
185 ac_cv_prog_$1=$with_build_time_tools/${ncn_progname}
2429c060
PB
186 AC_MSG_RESULT(yes)
187 break
188 else
189 AC_MSG_RESULT(no)
190 fi
191 done
192fi
05cbd757 193
2429c060
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
5212e868 207if test -z "$ac_cv_prog_$1" ; then
05cbd757 208 ifelse([$3],[], [set dummy $2
5212e868 209 if test $build = $target ; then
05cbd757 210 $1="[$]2"
5212e868 211 else
05cbd757
PB
212 $1="${ncn_target_tool_prefix}[$]2"
213 fi], [$1="$3"])
d3f5afc4
MS
214else
215 $1="$ac_cv_prog_$1"
5212e868 216fi
05cbd757 217]) []dnl # NCN_STRICT_CHECK_TARGET_TOOLS
2429c060
PB
218
219
220# Backported from Autoconf 2.5x; can go away when and if
221# we switch. Put the OS path separator in $PATH_SEPARATOR.
222AC_DEFUN([ACX_PATH_SEP], [
223# The user is always right.
224if test "${PATH_SEPARATOR+set}" != set; then
225 echo "#! /bin/sh" >conf$$.sh
226 echo "exit 0" >>conf$$.sh
227 chmod +x conf$$.sh
228 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
229 PATH_SEPARATOR=';'
230 else
231 PATH_SEPARATOR=:
232 fi
233 rm -f conf$$.sh
234fi
235])
236
237
238AC_DEFUN([ACX_TOOL_DIRS], [
239AC_REQUIRE([ACX_PATH_SEP])
240if test "x$exec_prefix" = xNONE; then
241 if test "x$prefix" = xNONE; then
242 gcc_cv_tool_prefix=$ac_default_prefix
243 else
244 gcc_cv_tool_prefix=$prefix
245 fi
246else
247 gcc_cv_tool_prefix=$exec_prefix
248fi
249
250# If there is no compiler in the tree, use the PATH only. In any
251# case, if there is no compiler in the tree nobody should use
252# AS_FOR_TARGET and LD_FOR_TARGET.
253if test x$host = x$build && test -f $srcdir/gcc/BASE-VER; then
254 gcc_version=`cat $srcdir/gcc/BASE-VER`
255 gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
256 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical$PATH_SEPARATOR"
257 gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
258 gcc_cv_tool_dirs="$gcc_cv_tool_dirs/usr/lib/gcc/$target_noncanonical$PATH_SEPARATOR"
259 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version$PATH_SEPARATOR"
260 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$gcc_cv_tool_prefix/$target_noncanonical/bin$PATH_SEPARATOR"
261else
262 gcc_cv_tool_dirs=
263fi
264
265if test x$build = x$target && test -n "$md_exec_prefix"; then
266 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$md_exec_prefix$PATH_SEPARATOR"
267fi
268
269]) []dnl # ACX_TOOL_DIRS
270
271# ACX_HAVE_GCC_FOR_TARGET
272# Check if the variable GCC_FOR_TARGET really points to a GCC binary.
273AC_DEFUN([ACX_HAVE_GCC_FOR_TARGET], [
274cat > conftest.c << \EOF
275#ifdef __GNUC__
276 gcc_yay;
277#endif
278EOF
279if ($GCC_FOR_TARGET -E conftest.c | grep gcc_yay) > /dev/null 2>&1; then
280 have_gcc_for_target=yes
281else
282 GCC_FOR_TARGET=${ncn_target_tool_prefix}gcc
283 have_gcc_for_target=no
284fi
285rm conftest.c
286])
287
288# ACX_CHECK_INSTALLED_TARGET_TOOL(VAR, PROG)
289# Searching for installed target binutils. We need to take extra care,
290# else we may find the wrong assembler, linker, etc., and lose.
291#
292# First try --with-build-time-tools, if specified.
293#
294# For build != host, we ask the installed GCC for the name of the tool it
295# uses, and accept it if it is an absolute path. This is because the
296# only good choice for a compiler is the same GCC version that is being
297# installed (or we couldn't make target libraries), and we assume that
298# on the host system we'll have not only the same GCC version, but also
299# the same binutils version.
300#
301# For build == host, search the same directories that the installed
302# compiler will search. We used to do this for the assembler, linker,
303# and nm only; for simplicity of configuration, however, we extend this
304# criterion to tools (such as ar and ranlib) that are never invoked by
305# the compiler, to avoid mismatches.
306#
307# Also note we have to check MD_EXEC_PREFIX before checking the user's path
308# if build == target. This makes the most sense only when bootstrapping,
309# but we also do so when build != host. In this case, we hope that the
310# build and host systems will have similar contents of MD_EXEC_PREFIX.
311#
312# If we do not find a suitable binary, then try the user's path.
313
314AC_DEFUN([ACX_CHECK_INSTALLED_TARGET_TOOL], [
315AC_REQUIRE([ACX_TOOL_DIRS])
316AC_REQUIRE([ACX_HAVE_GCC_FOR_TARGET])
317if test -z "$ac_cv_path_$1" ; then
318 if test -n "$with_build_time_tools"; then
3a35eeb3
PB
319 AC_MSG_CHECKING([for $2 in $with_build_time_tools])
320 if test -x $with_build_time_tools/$2; then
321 $1=`cd $with_build_time_tools && pwd`/$2
322 ac_cv_path_$1=[$]$1
323 AC_MSG_RESULT([$ac_cv_path_$1])
324 else
325 AC_MSG_RESULT(no)
326 fi
2429c060
PB
327 elif test $build != $host && test $have_gcc_for_target = yes; then
328 $1=`$GCC_FOR_TARGET --print-prog-name=$2`
d3f5afc4
MS
329 test [$]$1 = $2 && $1=
330 test -n "[$]$1" && ac_cv_path_$1=[$]$1
2429c060
PB
331 fi
332fi
c6b750e1 333if test -z "$ac_cv_path_$1" && test -n "$gcc_cv_tool_dirs"; then
2429c060
PB
334 AC_PATH_PROG([$1], [$2], [], [$gcc_cv_tool_dirs])
335fi
336if test -z "$ac_cv_path_$1" ; then
337 NCN_STRICT_CHECK_TARGET_TOOLS([$1], [$2])
3a35eeb3
PB
338else
339 $1=$ac_cv_path_$1
2429c060
PB
340fi
341]) []dnl # ACX_CHECK_INSTALLED_TARGET_TOOL
394559cb
DJ
342
343###
344# AC_PROG_CPP_WERROR
345# Used for autoconf 2.5x to force AC_PREPROC_IFELSE to reject code which
346# triggers warnings from the preprocessor. Will be in autoconf 2.58.
347# For now, using this also overrides header checks to use only the
348# preprocessor (matches 2.13 behavior; matching 2.58's behavior is a
349# bit harder from here).
350# Eventually autoconf will default to checking headers with the compiler
351# instead, and we'll have to do this differently.
352
353AC_DEFUN([AC_PROG_CPP_WERROR],
354[AC_REQUIRE([AC_PROG_CPP])dnl
355m4_define([AC_CHECK_HEADER],m4_defn([_AC_CHECK_HEADER_OLD]))
356ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
9e07f89d
NN
357
358# Test for GNAT.
64b986c0
EB
359# We require the gnatbind & gnatmake programs, as well as a compiler driver
360# that understands Ada. We use the user's CC setting, already found, and
361# possibly add $1 to the command-line parameters.
9e07f89d
NN
362#
363# Sets the shell variable have_gnat to yes or no as appropriate, and
a0323144 364# substitutes GNATBIND and GNATMAKE.
9e07f89d
NN
365AC_DEFUN([ACX_PROG_GNAT],
366[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])
367AC_REQUIRE([AC_PROG_CC])
368AC_CHECK_TOOL(GNATBIND, gnatbind, no)
a0323144 369AC_CHECK_TOOL(GNATMAKE, gnatmake, no)
9e07f89d
NN
370AC_CACHE_CHECK([whether compiler driver understands Ada],
371 acx_cv_cc_gcc_supports_ada,
372[cat >conftest.adb <<EOF
373procedure conftest is begin null; end conftest;
374EOF
375acx_cv_cc_gcc_supports_ada=no
376# There is a bug in old released versions of GCC which causes the
377# driver to exit successfully when the appropriate language module
378# has not been installed. This is fixed in 2.95.4, 3.0.2, and 3.1.
379# Therefore we must check for the error message as well as an
380# unsuccessful exit.
b8908782
DD
381# Other compilers, like HP Tru64 UNIX cc, exit successfully when
382# given a .adb file, but produce no object file. So we must check
383# if an object file was really produced to guard against this.
1f01c90e 384errors=`(${CC} $1[]m4_ifval([$1], [ ])-c conftest.adb) 2>&1 || echo failure`
b8908782 385if test x"$errors" = x && test -f conftest.$ac_objext; then
9e07f89d 386 acx_cv_cc_gcc_supports_ada=yes
9e07f89d
NN
387fi
388rm -f conftest.*])
389
64b986c0 390if test "x$GNATBIND" != xno && test "x$GNATMAKE" != xno && test x$acx_cv_cc_gcc_supports_ada != xno; then
9e07f89d
NN
391 have_gnat=yes
392else
393 have_gnat=no
394fi
395])
4b1cb4fe
DD
396
397dnl 'make compare' can be significantly faster, if cmp itself can
398dnl skip bytes instead of using tail. The test being performed is
399dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
400dnl but we need to sink errors and handle broken shells. We also test
401dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
402dnl accepted by cmp on some systems.
403AC_DEFUN([ACX_PROG_CMP_IGNORE_INITIAL],
404[AC_CACHE_CHECK([how to compare bootstrapped objects], gcc_cv_prog_cmp_skip,
405[ echo abfoo >t1
406 echo cdfoo >t2
407 gcc_cv_prog_cmp_skip='tail +16c $$f1 > tmp-foo1; tail +16c $$f2 > tmp-foo2; cmp tmp-foo1 tmp-foo2'
408 if cmp t1 t2 2 2 > /dev/null 2>&1; then
409 if cmp t1 t2 1 1 > /dev/null 2>&1; then
410 :
411 else
412 gcc_cv_prog_cmp_skip='cmp $$f1 $$f2 16 16'
413 fi
414 fi
415 if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
416 if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
417 :
418 else
419 gcc_cv_prog_cmp_skip='cmp --ignore-initial=16 $$f1 $$f2'
420 fi
421 fi
422 rm t1 t2
423])
424do_compare="$gcc_cv_prog_cmp_skip"
425AC_SUBST(do_compare)
426])
04cf1b77
PB
427
428dnl See whether we can include both string.h and strings.h.
429AC_DEFUN([ACX_HEADER_STRING],
430[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
431 gcc_cv_header_string,
432[AC_TRY_COMPILE([#include <string.h>
433#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
434if test $gcc_cv_header_string = yes; then
435 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define if you can safely include both <string.h> and <strings.h>.])
436fi
437])
438
439dnl See if stdbool.h properly defines bool and true/false.
440dnl Check whether _Bool is built-in.
441AC_DEFUN([ACX_HEADER_STDBOOL],
442[AC_CACHE_CHECK([for working stdbool.h],
443 ac_cv_header_stdbool_h,
444[AC_TRY_COMPILE([#include <stdbool.h>],
445[bool foo = false;],
446ac_cv_header_stdbool_h=yes, ac_cv_header_stdbool_h=no)])
447if test $ac_cv_header_stdbool_h = yes; then
448 AC_DEFINE(HAVE_STDBOOL_H, 1,
449 [Define if you have a working <stdbool.h> header file.])
450fi
451AC_CACHE_CHECK(for built-in _Bool, gcc_cv_c__bool,
452[AC_TRY_COMPILE(,
453[_Bool foo;],
454gcc_cv_c__bool=yes, gcc_cv_c__bool=no)
455])
456if test $gcc_cv_c__bool = yes; then
457 AC_DEFINE(HAVE__BOOL, 1, [Define if the \`_Bool' type is built-in.])
458fi
459])
460
656fdd47
PB
461dnl See if hard links work and if not, try to substitute $1 or simple copy.
462AC_DEFUN([ACX_PROG_LN],
463[AC_MSG_CHECKING(whether ln works)
464AC_CACHE_VAL(acx_cv_prog_LN,
465[rm -f conftestdata_t
466echo >conftestdata_f
467if ln conftestdata_f conftestdata_t 2>/dev/null
468then
469 acx_cv_prog_LN=ln
470else
471 acx_cv_prog_LN=no
472fi
473rm -f conftestdata_f conftestdata_t
474])dnl
475if test $acx_cv_prog_LN = no; then
476 LN="ifelse([$1],,cp,[$1])"
477 AC_MSG_RESULT([no, using $LN])
478else
479 LN="$acx_cv_prog_LN"
480 AC_MSG_RESULT(yes)
481fi
482AC_SUBST(LN)dnl
483])
484
be01d343
PB
485dnl GCC_TARGET_TOOL(PROGRAM, TARGET-VAR, HOST-VAR, IN-TREE-TOOL, LANGUAGE)
486AC_DEFUN([GCC_TARGET_TOOL],
487[AC_MSG_CHECKING(where to find the target $1)
488if test "x${build}" != "x${host}" ; then
2429c060
PB
489 if expr "x[$]$2" : "x/" > /dev/null; then
490 # We already found the complete path
b8025f34
AS
491 ac_dir=`dirname [$]$2`
492 AC_MSG_RESULT(pre-installed in $ac_dir)
2429c060
PB
493 else
494 # Canadian cross, just use what we found
495 AC_MSG_RESULT(pre-installed)
496 fi
be01d343
PB
497else
498 ifelse([$4],,,
499 [ok=yes
500 case " ${configdirs} " in
501 *" patsubst([$4], [/.*], []) "*) ;;
502 *) ok=no ;;
503 esac
504 ifelse([$5],,,
505 [case ,${enable_languages}, in
506 *,$5,*) ;;
507 *) ok=no ;;
508 esac])
509 if test $ok = yes; then
510 # An in-tree tool is available and we can use it
511 $2='$$r/$(HOST_SUBDIR)/$4'
512 AC_MSG_RESULT(just compiled)
2429c060
PB
513 el])if expr "x[$]$2" : "x/" > /dev/null; then
514 # We already found the complete path
b8025f34
AS
515 ac_dir=`dirname [$]$2`
516 AC_MSG_RESULT(pre-installed in $ac_dir)
2429c060 517 elif test "x$target" = "x$host"; then
be01d343
PB
518 # We can use an host tool
519 $2='$($3)'
520 AC_MSG_RESULT(host tool)
521 else
522 # We need a cross tool
523 AC_MSG_RESULT(pre-installed)
524 fi
9b134994
PB
525fi
526AC_SUBST($2)])
a0323144
PB
527
528
529dnl Locate a program and check that its version is acceptable.
530dnl ACX_PROG_CHECK_VER(var, name, version-switch,
531dnl version-extract-regexp, version-glob)
532AC_DEFUN([ACX_CHECK_PROG_VER],[
533 AC_CHECK_PROG([$1], [$2], [$2])
534 if test -n "[$]$1"; then
535 # Found it, now check the version.
536 AC_CACHE_CHECK([for modern $2],
537 [gcc_cv_prog_$2_modern],
538 [ac_prog_version=`eval [$]$1 $3 2>&1 |
539 sed -n 's/^.*patsubst([[$4]],/,\/).*$/\1/p'`
540
541 [case $ac_prog_version in
542 '') gcc_cv_prog_$2_modern=no;;
543 $5) gcc_cv_prog_$2_modern=yes;;
544 *) gcc_cv_prog_$2_modern=no;;
545 esac]
a0323144
PB
546 ])
547 else
548 gcc_cv_prog_$2_modern=no
549 fi
550 if test $gcc_cv_prog_$2_modern = no; then
551 $1="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing $2"
552 fi
553])
a1ac8190
JM
554
555dnl Support the --with-pkgversion configure option.
556dnl ACX_PKGVERSION(default-pkgversion)
557AC_DEFUN([ACX_PKGVERSION],[
558 AC_ARG_WITH(pkgversion,
559 AS_HELP_STRING([--with-pkgversion=PKG],
560 [Use PKG in the version string in place of "$1"]),
561 [case "$withval" in
562 yes) AC_MSG_ERROR([package version not specified]) ;;
563 no) PKGVERSION= ;;
564 *) PKGVERSION="($withval) " ;;
565 esac],
566 PKGVERSION="($1) "
567 )
568 AC_SUBST(PKGVERSION)
569])
570
571dnl Support the --with-bugurl configure option.
572dnl ACX_BUGURL(default-bugurl)
573AC_DEFUN([ACX_BUGURL],[
574 AC_ARG_WITH(bugurl,
575 AS_HELP_STRING([--with-bugurl=URL],
576 [Direct users to URL to report a bug]),
577 [case "$withval" in
578 yes) AC_MSG_ERROR([bug URL not specified]) ;;
5bd8253d 579 no) BUGURL=
a1ac8190 580 ;;
5bd8253d 581 *) BUGURL="$withval"
a1ac8190
JM
582 ;;
583 esac],
5bd8253d 584 BUGURL="$1"
a1ac8190 585 )
5bd8253d
L
586 case ${BUGURL} in
587 "")
588 REPORT_BUGS_TO=
589 REPORT_BUGS_TEXI=
590 ;;
591 *)
592 REPORT_BUGS_TO="<$BUGURL>"
593 REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
594 ;;
595 esac;
a1ac8190
JM
596 AC_SUBST(REPORT_BUGS_TO)
597 AC_SUBST(REPORT_BUGS_TEXI)
598])
e33b51a6
NC
599
600dnl ####
601dnl # ACX_CHECK_CYGWIN_CAT_WORKS
602dnl # On Cygwin hosts, check that the cat command ignores
603dnl # carriage returns as otherwise builds will not work.
604dnl # See binutils PR 4334 for more details.
605AC_DEFUN([ACX_CHECK_CYGWIN_CAT_WORKS],[
606AC_MSG_CHECKING([to see if cat works as expected])
607echo a >cygwin-cat-check
eb6cdd53 608if test `cat cygwin-cat-check` = a ; then
e33b51a6
NC
609 rm cygwin-cat-check
610 AC_MSG_RESULT(yes)
611else
612 rm cygwin-cat-check
613 AC_MSG_RESULT(no)
614 AC_MSG_ERROR([The cat command does not ignore carriage return characters.
615 Please either mount the build directory in binary mode or run the following
616 commands before running any configure script:
617set -o igncr
618export SHELLOPTS
619 ])
620fi
621])
This page took 0.627877 seconds and 4 git commands to generate.