1 dnl See whether we need a declaration for a function.
2 dnl The result is highly dependent on the INCLUDES passed in, so make sure
3 dnl to use a different cache variable name in this macro if it is invoked
4 dnl in a different context somewhere else.
5 dnl gcc_AC_CHECK_DECL(SYMBOL,
6 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
7 AC_DEFUN([gcc_AC_CHECK_DECL],
8 [AC_MSG_CHECKING([whether $1 is declared])
9 AC_CACHE_VAL(gcc_cv_have_decl_$1,
10 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$4],
12 char *(*pfn) = (char *(*)) $1 ;
13 #endif])], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
14 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
15 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
17 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
21 dnl Check multiple functions to see whether each needs a declaration.
22 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
23 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
24 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
25 AC_DEFUN([gcc_AC_CHECK_DECLS],
26 [AC_FOREACH([gcc_AC_Func], [$1],
27 [AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_[]gcc_AC_Func),
28 [Define to 1 if we found a declaration for ']gcc_AC_Func[', otherwise
32 ac_tr_decl=AS_TR_CPP([HAVE_DECL_$ac_func])
33 gcc_AC_CHECK_DECL($ac_func,
34 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
35 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
36 dnl It is possible that the include files passed in here are local headers
37 dnl which supply a backup declaration for the relevant prototype based on
38 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
39 dnl will always return success. E.g. see libiberty.h's handling of
40 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
41 dnl 1 so that any local headers used do not provide their own prototype
50 dnl 'make compare' can be significantly faster, if cmp itself can
51 dnl skip bytes instead of using tail. The test being performed is
52 dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
53 dnl but we need to sink errors and handle broken shells. We also test
54 dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
55 dnl accepted by cmp on some systems.
56 AC_DEFUN([gcc_AC_PROG_CMP_IGNORE_INITIAL],
57 [AC_CACHE_CHECK([for cmp's capabilities], gcc_cv_prog_cmp_skip,
60 gcc_cv_prog_cmp_skip=slowcompare
61 if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
62 if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
65 gcc_cv_prog_cmp_skip=gnucompare
68 if test $gcc_cv_prog_cmp_skip = slowcompare ; then
69 if cmp t1 t2 2 2 > /dev/null 2>&1; then
70 if cmp t1 t2 1 1 > /dev/null 2>&1; then
73 gcc_cv_prog_cmp_skip=fastcompare
79 make_compare_target=$gcc_cv_prog_cmp_skip
80 AC_SUBST(make_compare_target)
83 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
84 AC_DEFUN([gcc_AC_PROG_LN_S],
85 [AC_MSG_CHECKING(whether ln -s works)
86 AC_CACHE_VAL(gcc_cv_prog_LN_S,
89 if ln -s conftestdata_f conftestdata_t 2>/dev/null
91 gcc_cv_prog_LN_S="ln -s"
93 if ln conftestdata_f conftestdata_t 2>/dev/null
97 if cp -p conftestdata_f conftestdata_t 2>/dev/null
99 gcc_cv_prog_LN_S="cp -p"
105 rm -f conftestdata_f conftestdata_t
107 LN_S="$gcc_cv_prog_LN_S"
108 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
111 if test "$gcc_cv_prog_LN_S" = "ln"; then
112 AC_MSG_RESULT([no, using ln])
114 AC_MSG_RESULT([no, and neither does ln, so using $gcc_cv_prog_LN_S])
120 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
122 AC_DEFUN([gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG],
123 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
124 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
125 #include <sys/types.h>
126 #ifdef HAVE_SYS_STAT_H
127 # include <sys/stat.h>
134 #endif], [mkdir ("foo", 0);])],
135 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
136 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
137 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
141 AC_DEFUN([gcc_AC_PROG_INSTALL],
142 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
143 # Find a good install program. We prefer a C program (faster),
144 # so one script is as good as another. But avoid the broken or
145 # incompatible versions:
146 # SysV /etc/install, /usr/sbin/install
147 # SunOS /usr/etc/install
150 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
151 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
152 # ./install, which can be erroneously created by make from ./install.sh.
153 AC_MSG_CHECKING(for a BSD compatible install)
154 if test -z "$INSTALL"; then
155 AC_CACHE_VAL(ac_cv_path_install,
156 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
157 for ac_dir in $PATH; do
158 # Account for people who put trailing slashes in PATH elements.
160 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
162 # OSF1 and SCO ODT 3.0 have their own names for install.
163 for ac_prog in ginstall scoinst install; do
164 if test -f $ac_dir/$ac_prog; then
165 if test $ac_prog = install &&
166 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
167 # AIX install. It has an incompatible calling convention.
168 # OSF/1 installbsd also uses dspmsg, but is usable.
171 ac_cv_path_install="$ac_dir/$ac_prog -c"
181 if test "${ac_cv_path_install+set}" = set; then
182 INSTALL="$ac_cv_path_install"
184 # As a last resort, use the slow shell script. We don't cache a
185 # path for INSTALL within a source directory, because that will
186 # break other packages using the cache if that directory is
187 # removed, or if the path is relative.
188 INSTALL="$ac_install_sh"
191 dnl We do special magic for INSTALL instead of AC_SUBST, to get
192 dnl relative paths right.
193 AC_MSG_RESULT($INSTALL)
196 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
197 # It thinks the first close brace ends the variable substitution.
198 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
199 AC_SUBST(INSTALL_PROGRAM)dnl
201 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
202 AC_SUBST(INSTALL_DATA)dnl
205 # mmap(2) blacklisting. Some platforms provide the mmap library routine
206 # but don't support all of the features we need from it.
207 AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
209 AC_CHECK_HEADER([sys/mman.h],
210 [gcc_header_sys_mman_h=yes], [gcc_header_sys_mman_h=no])
211 AC_CHECK_FUNC([mmap], [gcc_func_mmap=yes], [gcc_func_mmap=no])
212 if test "$gcc_header_sys_mman_h" != yes \
213 || test "$gcc_func_mmap" != yes; then
214 gcc_cv_func_mmap_file=no
215 gcc_cv_func_mmap_dev_zero=no
216 gcc_cv_func_mmap_anon=no
218 AC_CACHE_CHECK([whether read-only mmap of a plain file works],
219 gcc_cv_func_mmap_file,
220 [# Add a system to this blacklist if
221 # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
222 # memory area containing the same data that you'd get if you applied
223 # read() to the same fd. The only system known to have a problem here
224 # is VMS, where text files have record structure.
227 gcc_cv_func_mmap_file=no ;;
229 gcc_cv_func_mmap_file=yes;;
231 AC_CACHE_CHECK([whether mmap from /dev/zero works],
232 gcc_cv_func_mmap_dev_zero,
233 [# Add a system to this blacklist if it has mmap() but /dev/zero
234 # does not exist, or if mmapping /dev/zero does not give anonymous
235 # zeroed pages with both the following properties:
236 # 1. If you map N consecutive pages in with one call, and then
237 # unmap any subset of those pages, the pages that were not
238 # explicitly unmapped remain accessible.
239 # 2. If you map two adjacent blocks of memory and then unmap them
240 # both at once, they must both go away.
241 # Systems known to be in this category are Windows (all variants),
244 vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
245 gcc_cv_func_mmap_dev_zero=no ;;
247 gcc_cv_func_mmap_dev_zero=yes;;
250 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
251 AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
252 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
253 [#include <sys/types.h>
254 #include <sys/mman.h>
257 #ifndef MAP_ANONYMOUS
258 #define MAP_ANONYMOUS MAP_ANON
261 [int n = MAP_ANONYMOUS;])],
262 gcc_cv_decl_map_anon=yes,
263 gcc_cv_decl_map_anon=no)])
265 if test $gcc_cv_decl_map_anon = no; then
266 gcc_cv_func_mmap_anon=no
268 AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
269 gcc_cv_func_mmap_anon,
270 [# Add a system to this blacklist if it has mmap() and MAP_ANON or
271 # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
272 # doesn't give anonymous zeroed pages with the same properties listed
273 # above for use of /dev/zero.
274 # Systems known to be in this category are Windows, VMS, and SCO Unix.
276 vms* | cygwin* | pe | mingw* | sco* | udk* )
277 gcc_cv_func_mmap_anon=no ;;
279 gcc_cv_func_mmap_anon=yes;;
284 if test $gcc_cv_func_mmap_file = yes; then
285 AC_DEFINE(HAVE_MMAP_FILE, 1,
286 [Define if read-only mmap of a plain file works.])
288 if test $gcc_cv_func_mmap_dev_zero = yes; then
289 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
290 [Define if mmap of /dev/zero works.])
292 if test $gcc_cv_func_mmap_anon = yes; then
293 AC_DEFINE(HAVE_MMAP_ANON, 1,
294 [Define if mmap with MAP_ANON(YMOUS) works.])
298 dnl Locate a program and check that its version is acceptable.
299 dnl AC_PROG_CHECK_VER(var, name, version-switch,
300 dnl version-extract-regexp, version-glob)
301 AC_DEFUN([gcc_AC_CHECK_PROG_VER],
302 [AC_REQUIRE([gcc_AC_BUILD_EXEEXT])
303 AC_CHECK_PROG([$1], [$2], [$2])
304 if test -n "[$]$1"; then
305 # Found it, now check the version.
306 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
307 [changequote(<<,>>)dnl
308 ac_prog_version=`<<$>>$1 $3 2>&1 |
309 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
311 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AS_MESSAGE_LOG_FD
312 changequote(<<,>>)dnl
313 case $ac_prog_version in
314 '') gcc_cv_prog_$2_modern=no;;
316 gcc_cv_prog_$2_modern=yes;;
317 *) gcc_cv_prog_$2_modern=no;;
322 gcc_cv_prog_$2_modern=no
326 dnl Determine if enumerated bitfields are unsigned. ISO C says they can
327 dnl be either signed or unsigned.
329 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
330 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
331 [AC_RUN_IFELSE([AC_LANG_SOURCE([#include <stdlib.h>
332 enum t { BLAH = 128 } ;
333 struct s_t { enum t member : 8; } s ;
337 if (s.member < 0) exit(1);
340 }])], gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
341 if test $gcc_cv_enum_bf_unsigned = yes; then
342 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
343 [Define if enumerated bitfields are treated as unsigned values.])
346 dnl Probe number of bits in a byte.
347 dnl Note C89 requires CHAR_BIT >= 8.
349 AC_DEFUN([gcc_AC_C_CHAR_BIT],
350 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
352 [#ifdef HAVE_LIMITS_H
357 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
359 if test $gcc_cv_decl_char_bit = no; then
360 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
363 while test $i -lt 65; do
364 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
366 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
367 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
369 [gcc_cv_c_nbby=$i; break])
372 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
374 if test $gcc_cv_c_nbby = failed; then
375 AC_MSG_ERROR(cannot determine number of bits in a byte)
377 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
378 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
382 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
383 [AC_ARG_ENABLE(initfini-array,
384 [ --enable-initfini-array use .init_array/.fini_array sections],
386 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
387 gcc_cv_initfini_array, [dnl
388 AC_RUN_IFELSE([AC_LANG_SOURCE([
390 int main (void) { return x; }
391 int foo (void) { x = 0; }
392 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;])],
393 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
394 [gcc_cv_initfini_array=no])])
395 enable_initfini_array=$gcc_cv_initfini_array
397 if test $enable_initfini_array = yes; then
398 AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
399 [Define .init_array/.fini_array sections are available and working.])
402 dnl # _gcc_COMPUTE_GAS_VERSION
403 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
406 dnl # gcc_cv_as_gas_srcdir must be defined before this.
407 dnl # This gross requirement will go away eventually.
408 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
409 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
410 for f in $gcc_cv_as_bfd_srcdir/configure \
411 $gcc_cv_as_gas_srcdir/configure \
412 $gcc_cv_as_gas_srcdir/configure.in \
413 $gcc_cv_as_gas_srcdir/Makefile.in ; do
414 gcc_cv_gas_version=`sed -n -e 's/^[[ ]]*\(VERSION=[[0-9]]*\.[[0-9]]*.*\)/\1/p' < $f`
415 if test x$gcc_cv_gas_version != x; then
419 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
420 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
421 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
422 case $gcc_cv_gas_patch_version in
423 "") gcc_cv_gas_patch_version="0" ;;
425 gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
426 + $gcc_cv_gas_minor_version \) \* 1000 \
427 + $gcc_cv_gas_patch_version`
428 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
430 dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
431 dnl # [command_if_true = :], [command_if_false = :])
432 dnl # Check to see if the version of GAS is greater than or
433 dnl # equal to the specified version.
435 dnl # The first ifelse() shortens the shell code if the patchlevel
436 dnl # is unimportant (the usual case). The others handle missing
437 dnl # commands. Note that the tests are structured so that the most
438 dnl # common version number cases are tested first.
439 AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
441 [if test $in_tree_gas_is_elf = yes \
443 [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4`
445 ifelse([$5],,:,[$5])[]dnl
450 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
451 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
452 ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
453 [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
455 dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
456 dnl [extra switches to as], [assembler input],
457 dnl [extra testing logic], [command if feature available])
459 dnl Checks for an assembler feature. If we are building an in-tree
460 dnl gas, the feature is available if the associated assembler version
461 dnl is greater than or equal to major.minor.patchlevel. If not, then
462 dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
463 dnl if assembly succeeds. If EXTRA TESTING LOGIC is not the empty string,
464 dnl then it is run instead of simply setting CV to "yes" - it is responsible
465 dnl for doing so, if appropriate.
466 AC_DEFUN([gcc_GAS_CHECK_FEATURE],
467 [AC_CACHE_CHECK([assembler for $1], [$2],
470 if test $in_tree_gas = yes; then
471 gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
472 el])if test x$gcc_cv_as != x; then
473 echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s
474 if AC_TRY_COMMAND([$gcc_cv_as $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
476 ifelse([$6],, [$2]=yes, [$6])
478 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
479 cat conftest.s >&AS_MESSAGE_LOG_FD
481 rm -f conftest.o conftest.s
484 if test $[$2] = yes; then
488 dnl GCC_TARGET_TEMPLATE(KEY)
489 dnl ------------------------
490 dnl Define KEY as a valid configure key on the target machine.
492 m4_define([GCC_TARGET_TEMPLATE],
493 [m4_define([GCC_TARGET_TEMPLATE($1)],[])])
495 dnl AH_TEMPLATE(KEY, DESCRIPTION)
496 dnl -----------------------------
497 dnl Issue an autoheader template for KEY, i.e., a comment composed of
498 dnl DESCRIPTION (properly wrapped), and then #undef KEY. Redefinition
499 dnl of the macro in autoheader.m4, to support definition of only a few
500 dnl keys while compiling target libraries.
502 m4_define([AH_TEMPLATE],
503 [AH_VERBATIM([$1],m4_text_wrap([$2 */], [ ], [/* ])
504 m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[#ifndef USED_FOR_TARGET
505 ])[#undef $1]m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[
509 AC_DEFUN([gcc_AC_TOOL_DIRS], [
510 # When searching for the assembler or linker, search the same directories
511 # that the installed compiler will search. Else we may find the wrong
512 # assembler or linker and lose. If we do not find a suitable binary,
513 # then try the user's path.
515 # Also note we have to check MD_EXEC_PREFIX before checking the user's path.
516 if test "x$exec_prefix" = xNONE; then
517 if test "x$prefix" = xNONE; then
518 gcc_cv_tool_prefix=/usr/local
520 gcc_cv_tool_prefix=$prefix
523 gcc_cv_tool_prefix=$exec_prefix
526 if test x$host = x$build; then
527 gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version"
528 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical"
529 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR/usr/lib/gcc/$target_noncanonical/$gcc_version"
530 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR/usr/lib/gcc/$target_noncanonical"
531 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version"
532 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/$target_noncanonical/bin"
537 if test x$build = x$target; then
538 # Rummage through tm_files looking for MD_EXEC_PREFIX
540 for f in ${tm_file_list}; do
542 if grep '^#[ ]*undef[ ]*MD_EXEC_PREFIX' $f > /dev/null; then
545 md_dirs="$md_dirs "`sed -n -e 's@^#[ ]*define[ ]*MD_EXEC_PREFIX[ ]*"\(.*\)/"@\1@p' < $f`
548 for f in ${md_dirs}; do
549 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$f"
553 dnl Make sure that build_exeext is looked for
554 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
555 ac_executable_extensions="$build_exeext"])
557 AC_DEFUN([gcc_AC_CHECK_TOOL], [
558 AC_REQUIRE([gcc_AC_TOOL_DIRS])
559 AC_REQUIRE([gcc_AC_BUILD_EXEEXT])
561 dnl shut up useless "checking for..." messages
562 dnl we can still read them in config.log
563 exec AS_MESSAGE_FD([])>/dev/null
565 # First try the environment variables. Handle full paths or basenames.
566 if test "x[$]$1" = x && test -n "[$]$4"; then
567 AC_PATH_PROG($1, [$]$4)
569 if test "x[$]$1" = x && test -n "[$]$5" && test x$host = x$target; then
570 AC_PATH_PROG($1, [$]$5)
573 if test "x[$]$1" = x; then
574 # The AC_PATH_PROGS macro doesn't work properly when its 4th argument
576 if test "x$gcc_cv_tool_dirs" = x; then
579 AC_PATH_PROGS($1, $2, , $gcc_cv_tool_dirs)
582 if test "x[$]$1" = x; then
583 # If the loop above did not find a tool, then use whatever
584 # one we can find in the users's path. We are looking for a
585 # ${build} -> ${target} tool.
586 if test "x$program_prefix" != xNONE; then
587 default_tool_name=${program_prefix}$2
588 elif test x$build != x$host && test x$build != x$target; then
589 default_tool_name=${target_noncanonical}-$2
591 default_tool_name=`echo $2 | sed "${program_transform_name}"`
593 AC_PATH_PROGS($1, $default_tool_name,
594 $gcc_cv_tool_prefix/bin/$default_tool_name$build_exeext)
596 test "$silent" != yes && exec AS_MESSAGE_FD([])>&1