1 m4_include([../config/acx.m4])
2 m4_include([../config/gettext-sister.m4])
3 m4_include([../config/iconv.m4])
4 m4_include([../config/lcmessage.m4])
5 m4_include([../config/lib-ld.m4])
6 m4_include([../config/lib-link.m4])
7 m4_include([../config/lib-prefix.m4])
8 m4_include([../config/progtest.m4])
10 dnl See whether we need a declaration for a function.
11 dnl The result is highly dependent on the INCLUDES passed in, so make sure
12 dnl to use a different cache variable name in this macro if it is invoked
13 dnl in a different context somewhere else.
14 dnl gcc_AC_CHECK_DECL(SYMBOL,
15 dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
16 AC_DEFUN([gcc_AC_CHECK_DECL],
17 [AC_MSG_CHECKING([whether $1 is declared])
18 AC_CACHE_VAL(gcc_cv_have_decl_$1,
19 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$4],
21 char *(*pfn) = (char *(*)) $1 ;
22 #endif])], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
23 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
24 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
26 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
30 dnl Check multiple functions to see whether each needs a declaration.
31 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
32 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
33 dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
34 AC_DEFUN([gcc_AC_CHECK_DECLS],
35 [AC_FOREACH([gcc_AC_Func], [$1],
36 [AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_[]gcc_AC_Func),
37 [Define to 1 if we found a declaration for ']gcc_AC_Func[', otherwise
41 ac_tr_decl=AS_TR_CPP([HAVE_DECL_$ac_func])
42 gcc_AC_CHECK_DECL($ac_func,
43 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
44 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
45 dnl It is possible that the include files passed in here are local headers
46 dnl which supply a backup declaration for the relevant prototype based on
47 dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
48 dnl will always return success. E.g. see libiberty.h's handling of
49 dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
50 dnl 1 so that any local headers used do not provide their own prototype
59 dnl 'make compare' can be significantly faster, if cmp itself can
60 dnl skip bytes instead of using tail. The test being performed is
61 dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
62 dnl but we need to sink errors and handle broken shells. We also test
63 dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
64 dnl accepted by cmp on some systems.
65 AC_DEFUN([gcc_AC_PROG_CMP_IGNORE_INITIAL],
66 [AC_CACHE_CHECK([for cmp's capabilities], gcc_cv_prog_cmp_skip,
69 gcc_cv_prog_cmp_skip=slowcompare
70 if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
71 if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
74 gcc_cv_prog_cmp_skip=gnucompare
77 if test $gcc_cv_prog_cmp_skip = slowcompare ; then
78 if cmp t1 t2 2 2 > /dev/null 2>&1; then
79 if cmp t1 t2 1 1 > /dev/null 2>&1; then
82 gcc_cv_prog_cmp_skip=fastcompare
88 make_compare_target=$gcc_cv_prog_cmp_skip
89 AC_SUBST(make_compare_target)
92 dnl See if the printf functions in libc support %p in format strings.
93 AC_DEFUN([gcc_AC_FUNC_PRINTF_PTR],
94 [AC_CACHE_CHECK(whether the printf functions support %p,
95 gcc_cv_func_printf_ptr,
96 [AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
101 char *p = buf, *q = NULL;
102 sprintf(buf, "%p", p);
103 sscanf(buf, "%p", &q);
105 }]])], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
106 gcc_cv_func_printf_ptr=no)
107 rm -f core core.* *.core])
108 if test $gcc_cv_func_printf_ptr = yes ; then
109 AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
113 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
114 AC_DEFUN([gcc_AC_PROG_LN_S],
115 [AC_MSG_CHECKING(whether ln -s works)
116 AC_CACHE_VAL(gcc_cv_prog_LN_S,
117 [rm -f conftestdata_t
119 if ln -s conftestdata_f conftestdata_t 2>/dev/null
121 gcc_cv_prog_LN_S="ln -s"
123 if ln conftestdata_f conftestdata_t 2>/dev/null
127 if cp -p conftestdata_f conftestdata_t 2>/dev/null
129 gcc_cv_prog_LN_S="cp -p"
135 rm -f conftestdata_f conftestdata_t
137 LN_S="$gcc_cv_prog_LN_S"
138 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
141 if test "$gcc_cv_prog_LN_S" = "ln"; then
142 AC_MSG_RESULT([no, using ln])
144 AC_MSG_RESULT([no, and neither does ln, so using $gcc_cv_prog_LN_S])
150 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
152 AC_DEFUN([gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG],
153 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
154 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
155 #include <sys/types.h>
156 #ifdef HAVE_SYS_STAT_H
157 # include <sys/stat.h>
164 #endif], [mkdir ("foo", 0);])],
165 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
166 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
167 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
171 AC_DEFUN([gcc_AC_PROG_INSTALL],
172 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
173 # Find a good install program. We prefer a C program (faster),
174 # so one script is as good as another. But avoid the broken or
175 # incompatible versions:
176 # SysV /etc/install, /usr/sbin/install
177 # SunOS /usr/etc/install
180 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
181 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
182 # ./install, which can be erroneously created by make from ./install.sh.
183 AC_MSG_CHECKING(for a BSD compatible install)
184 if test -z "$INSTALL"; then
185 AC_CACHE_VAL(ac_cv_path_install,
186 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
187 for ac_dir in $PATH; do
188 # Account for people who put trailing slashes in PATH elements.
190 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
192 # OSF1 and SCO ODT 3.0 have their own names for install.
193 for ac_prog in ginstall scoinst install; do
194 if test -f $ac_dir/$ac_prog; then
195 if test $ac_prog = install &&
196 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
197 # AIX install. It has an incompatible calling convention.
198 # OSF/1 installbsd also uses dspmsg, but is usable.
201 ac_cv_path_install="$ac_dir/$ac_prog -c"
211 if test "${ac_cv_path_install+set}" = set; then
212 INSTALL="$ac_cv_path_install"
214 # As a last resort, use the slow shell script. We don't cache a
215 # path for INSTALL within a source directory, because that will
216 # break other packages using the cache if that directory is
217 # removed, or if the path is relative.
218 INSTALL="$ac_install_sh"
221 dnl We do special magic for INSTALL instead of AC_SUBST, to get
222 dnl relative paths right.
223 AC_MSG_RESULT($INSTALL)
226 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
227 # It thinks the first close brace ends the variable substitution.
228 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
229 AC_SUBST(INSTALL_PROGRAM)dnl
231 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
232 AC_SUBST(INSTALL_DATA)dnl
235 # mmap(2) blacklisting. Some platforms provide the mmap library routine
236 # but don't support all of the features we need from it.
237 AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
239 AC_CHECK_HEADER([sys/mman.h],
240 [gcc_header_sys_mman_h=yes], [gcc_header_sys_mman_h=no])
241 AC_CHECK_FUNC([mmap], [gcc_func_mmap=yes], [gcc_func_mmap=no])
242 if test "$gcc_header_sys_mman_h" != yes \
243 || test "$gcc_func_mmap" != yes; then
244 gcc_cv_func_mmap_file=no
245 gcc_cv_func_mmap_dev_zero=no
246 gcc_cv_func_mmap_anon=no
248 AC_CACHE_CHECK([whether read-only mmap of a plain file works],
249 gcc_cv_func_mmap_file,
250 [# Add a system to this blacklist if
251 # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
252 # memory area containing the same data that you'd get if you applied
253 # read() to the same fd. The only system known to have a problem here
254 # is VMS, where text files have record structure.
257 gcc_cv_func_mmap_file=no ;;
259 gcc_cv_func_mmap_file=yes;;
261 AC_CACHE_CHECK([whether mmap from /dev/zero works],
262 gcc_cv_func_mmap_dev_zero,
263 [# Add a system to this blacklist if it has mmap() but /dev/zero
264 # does not exist, or if mmapping /dev/zero does not give anonymous
265 # zeroed pages with both the following properties:
266 # 1. If you map N consecutive pages in with one call, and then
267 # unmap any subset of those pages, the pages that were not
268 # explicitly unmapped remain accessible.
269 # 2. If you map two adjacent blocks of memory and then unmap them
270 # both at once, they must both go away.
271 # Systems known to be in this category are Windows (all variants),
274 vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
275 gcc_cv_func_mmap_dev_zero=no ;;
277 gcc_cv_func_mmap_dev_zero=yes;;
280 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
281 AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
282 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
283 [#include <sys/types.h>
284 #include <sys/mman.h>
287 #ifndef MAP_ANONYMOUS
288 #define MAP_ANONYMOUS MAP_ANON
291 [int n = MAP_ANONYMOUS;])],
292 gcc_cv_decl_map_anon=yes,
293 gcc_cv_decl_map_anon=no)])
295 if test $gcc_cv_decl_map_anon = no; then
296 gcc_cv_func_mmap_anon=no
298 AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
299 gcc_cv_func_mmap_anon,
300 [# Add a system to this blacklist if it has mmap() and MAP_ANON or
301 # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
302 # doesn't give anonymous zeroed pages with the same properties listed
303 # above for use of /dev/zero.
304 # Systems known to be in this category are Windows, VMS, and SCO Unix.
306 vms* | cygwin* | pe | mingw* | sco* | udk* )
307 gcc_cv_func_mmap_anon=no ;;
309 gcc_cv_func_mmap_anon=yes;;
314 if test $gcc_cv_func_mmap_file = yes; then
315 AC_DEFINE(HAVE_MMAP_FILE, 1,
316 [Define if read-only mmap of a plain file works.])
318 if test $gcc_cv_func_mmap_dev_zero = yes; then
319 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
320 [Define if mmap of /dev/zero works.])
322 if test $gcc_cv_func_mmap_anon = yes; then
323 AC_DEFINE(HAVE_MMAP_ANON, 1,
324 [Define if mmap with MAP_ANON(YMOUS) works.])
328 dnl Locate a program and check that its version is acceptable.
329 dnl AC_PROG_CHECK_VER(var, name, version-switch,
330 dnl version-extract-regexp, version-glob)
331 AC_DEFUN([gcc_AC_CHECK_PROG_VER],
332 [AC_REQUIRE([gcc_AC_BUILD_EXEEXT])
333 AC_CHECK_PROG([$1], [$2], [$2])
334 if test -n "[$]$1"; then
335 # Found it, now check the version.
336 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
337 [changequote(<<,>>)dnl
338 ac_prog_version=`<<$>>$1 $3 2>&1 |
339 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
341 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AS_MESSAGE_LOG_FD
342 changequote(<<,>>)dnl
343 case $ac_prog_version in
344 '') gcc_cv_prog_$2_modern=no;;
346 gcc_cv_prog_$2_modern=yes;;
347 *) gcc_cv_prog_$2_modern=no;;
352 gcc_cv_prog_$2_modern=no
356 dnl Determine if enumerated bitfields are unsigned. ISO C says they can
357 dnl be either signed or unsigned.
359 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
360 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
361 [AC_RUN_IFELSE([AC_LANG_SOURCE([#include <stdlib.h>
362 enum t { BLAH = 128 } ;
363 struct s_t { enum t member : 8; } s ;
367 if (s.member < 0) exit(1);
370 }])], gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
371 if test $gcc_cv_enum_bf_unsigned = yes; then
372 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
373 [Define if enumerated bitfields are treated as unsigned values.])
376 dnl Probe number of bits in a byte.
377 dnl Note C89 requires CHAR_BIT >= 8.
379 AC_DEFUN([gcc_AC_C_CHAR_BIT],
380 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
382 [#ifdef HAVE_LIMITS_H
387 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
389 if test $gcc_cv_decl_char_bit = no; then
390 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
393 while test $i -lt 65; do
394 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
396 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
397 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
399 [gcc_cv_c_nbby=$i; break])
402 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
404 if test $gcc_cv_c_nbby = failed; then
405 AC_MSG_ERROR(cannot determine number of bits in a byte)
407 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
408 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
412 dnl From Bruno Haible.
414 AC_DEFUN([AM_LANGINFO_CODESET],
416 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
417 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <langinfo.h>],
418 [char* cs = nl_langinfo(CODESET);])],
419 am_cv_langinfo_codeset=yes,
420 am_cv_langinfo_codeset=no)
422 if test $am_cv_langinfo_codeset = yes; then
423 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
424 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
428 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
429 [AC_ARG_ENABLE(initfini-array,
430 [ --enable-initfini-array use .init_array/.fini_array sections],
432 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
433 gcc_cv_initfini_array, [dnl
434 AC_RUN_IFELSE([AC_LANG_SOURCE([
436 int main (void) { return x; }
437 int foo (void) { x = 0; }
438 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;])],
439 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
440 [gcc_cv_initfini_array=no])])
441 enable_initfini_array=$gcc_cv_initfini_array
443 if test $enable_initfini_array = yes; then
444 AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
445 [Define .init_array/.fini_array sections are available and working.])
448 dnl # _gcc_COMPUTE_GAS_VERSION
449 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
452 dnl # gcc_cv_as_gas_srcdir must be defined before this.
453 dnl # This gross requirement will go away eventually.
454 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
455 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
456 for f in $gcc_cv_as_bfd_srcdir/configure \
457 $gcc_cv_as_gas_srcdir/configure \
458 $gcc_cv_as_gas_srcdir/configure.in \
459 $gcc_cv_as_gas_srcdir/Makefile.in ; do
460 gcc_cv_gas_version=`sed -n -e 's/^[[ ]]*\(VERSION=[[0-9]]*\.[[0-9]]*.*\)/\1/p' < $f`
461 if test x$gcc_cv_gas_version != x; then
465 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
466 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
467 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
468 case $gcc_cv_gas_patch_version in
469 "") gcc_cv_gas_patch_version="0" ;;
471 gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
472 + $gcc_cv_gas_minor_version \) \* 1000 \
473 + $gcc_cv_gas_patch_version`
474 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
476 dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
477 dnl # [command_if_true = :], [command_if_false = :])
478 dnl # Check to see if the version of GAS is greater than or
479 dnl # equal to the specified version.
481 dnl # The first ifelse() shortens the shell code if the patchlevel
482 dnl # is unimportant (the usual case). The others handle missing
483 dnl # commands. Note that the tests are structured so that the most
484 dnl # common version number cases are tested first.
485 AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
487 [if test $in_tree_gas_is_elf = yes \
489 [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4`
491 ifelse([$5],,:,[$5])[]dnl
496 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
497 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
498 ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
499 [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
501 dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
502 dnl [extra switches to as], [assembler input],
503 dnl [extra testing logic], [command if feature available])
505 dnl Checks for an assembler feature. If we are building an in-tree
506 dnl gas, the feature is available if the associated assembler version
507 dnl is greater than or equal to major.minor.patchlevel. If not, then
508 dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
509 dnl if assembly succeeds. If EXTRA TESTING LOGIC is not the empty string,
510 dnl then it is run instead of simply setting CV to "yes" - it is responsible
511 dnl for doing so, if appropriate.
512 AC_DEFUN([gcc_GAS_CHECK_FEATURE],
513 [AC_CACHE_CHECK([assembler for $1], [$2],
516 if test $in_tree_gas = yes; then
517 gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
518 el])if test x$gcc_cv_as != x; then
519 echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s
520 if AC_TRY_COMMAND([$gcc_cv_as $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
522 ifelse([$6],, [$2]=yes, [$6])
524 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
525 cat conftest.s >&AS_MESSAGE_LOG_FD
527 rm -f conftest.o conftest.s
530 if test $[$2] = yes; then
536 # Like AC_PROG_CC_C_O, but changed for automake.
538 # Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
540 # This program is free software; you can redistribute it and/or modify
541 # it under the terms of the GNU General Public License as published by
542 # the Free Software Foundation; either version 2, or (at your option)
545 # This program is distributed in the hope that it will be useful,
546 # but WITHOUT ANY WARRANTY; without even the implied warranty of
547 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
548 # GNU General Public License for more details.
550 # You should have received a copy of the GNU General Public License
551 # along with this program; if not, write to the Free Software
552 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
555 AC_DEFUN([AM_PROG_CC_C_O],
556 [AC_REQUIRE([AC_PROG_CC_C_O])dnl
557 AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
558 # FIXME: we rely on the cache variable name because
559 # there is no other way.
561 ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
562 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
563 # Losing compiler, so override with the script.
564 # FIXME: It is wrong to rewrite CC.
565 # But if we don't then we get into trouble of one sort or another.
566 # A longer-term fix would be to have automake use am__CC in this case,
567 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
568 CC="$am_aux_dir/compile $CC"
574 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
576 # This program is free software; you can redistribute it and/or modify
577 # it under the terms of the GNU General Public License as published by
578 # the Free Software Foundation; either version 2, or (at your option)
581 # This program is distributed in the hope that it will be useful,
582 # but WITHOUT ANY WARRANTY; without even the implied warranty of
583 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
584 # GNU General Public License for more details.
586 # You should have received a copy of the GNU General Public License
587 # along with this program; if not, write to the Free Software
588 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
591 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
592 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
593 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
595 # Of course, Automake must honor this variable whenever it calls a
596 # tool from the auxiliary directory. The problem is that $srcdir (and
597 # therefore $ac_aux_dir as well) can be either absolute or relative,
598 # depending on how configure is run. This is pretty annoying, since
599 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
600 # source directory, any form will work fine, but in subdirectories a
601 # relative path needs to be adjusted first.
603 # $ac_aux_dir/missing
604 # fails when called from a subdirectory if $ac_aux_dir is relative
605 # $top_srcdir/$ac_aux_dir/missing
606 # fails if $ac_aux_dir is absolute,
607 # fails when called from a subdirectory in a VPATH build with
608 # a relative $ac_aux_dir
610 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
611 # are both prefixed by $srcdir. In an in-source build this is usually
612 # harmless because $srcdir is `.', but things will broke when you
613 # start a VPATH build or use an absolute $srcdir.
615 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
616 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
617 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
618 # and then we would define $MISSING as
619 # MISSING="\${SHELL} $am_aux_dir/missing"
620 # This will work as long as MISSING is not called from configure, because
621 # unfortunately $(top_srcdir) has no meaning in configure.
622 # However there are other variables, like CC, which are often used in
623 # configure, and could therefore not use this "fixed" $ac_aux_dir.
625 # Another solution, used here, is to always expand $ac_aux_dir to an
626 # absolute PATH. The drawback is that using absolute paths prevent a
627 # configured tree to be moved without reconfiguration.
629 AC_DEFUN([AM_AUX_DIR_EXPAND],
630 [dnl Rely on autoconf to set up CDPATH properly.
632 # expand $ac_aux_dir to an absolute path
633 am_aux_dir=`cd $ac_aux_dir && pwd`
637 dnl GCC_TARGET_TEMPLATE(KEY)
638 dnl ------------------------
639 dnl Define KEY as a valid configure key on the target machine.
641 m4_define([GCC_TARGET_TEMPLATE],
642 [m4_define([GCC_TARGET_TEMPLATE($1)],[])])
644 dnl AH_TEMPLATE(KEY, DESCRIPTION)
645 dnl -----------------------------
646 dnl Issue an autoheader template for KEY, i.e., a comment composed of
647 dnl DESCRIPTION (properly wrapped), and then #undef KEY. Redefinition
648 dnl of the macro in autoheader.m4, to support definition of only a few
649 dnl keys while compiling target libraries.
651 m4_define([AH_TEMPLATE],
652 [AH_VERBATIM([$1],m4_text_wrap([$2 */], [ ], [/* ])
653 m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[#ifndef USED_FOR_TARGET
654 ])[#undef $1]m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[
658 AC_DEFUN([gcc_AC_TOOL_DIRS], [
659 # When searching for the assembler or linker, search the same directories
660 # that the installed compiler will search. Else we may find the wrong
661 # assembler or linker and lose. If we do not find a suitable binary,
662 # then try the user's path.
664 # Also note we have to check MD_EXEC_PREFIX before checking the user's path.
665 if test "x$exec_prefix" = xNONE; then
666 if test "x$prefix" = xNONE; then
667 gcc_cv_tool_prefix=/usr/local
669 gcc_cv_tool_prefix=$prefix
672 gcc_cv_tool_prefix=$exec_prefix
675 if test x$host = x$build; then
676 gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version"
677 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical"
678 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR/usr/lib/gcc/$target_noncanonical/$gcc_version"
679 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR/usr/lib/gcc/$target_noncanonical"
680 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version"
681 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/$target_noncanonical/bin"
686 if test x$build = x$target; then
687 # Rummage through tm_files looking for MD_EXEC_PREFIX
689 for f in ${tm_file_list}; do
691 if grep '^#[ ]*undef[ ]*MD_EXEC_PREFIX' $f > /dev/null; then
694 md_dirs="$md_dirs "`sed -n -e 's@^#[ ]*define[ ]*MD_EXEC_PREFIX[ ]*"\(.*\)/"@\1@p' < $f`
697 for f in ${md_dirs}; do
698 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$f"
702 dnl Make sure that build_exeext is looked for
703 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
704 ac_executable_extensions="$build_exeext"])
706 AC_DEFUN([gcc_AC_CHECK_TOOL], [
707 AC_REQUIRE([gcc_AC_TOOL_DIRS])
708 AC_REQUIRE([gcc_AC_BUILD_EXEEXT])
710 dnl shut up useless "checking for..." messages
711 dnl we can still read them in config.log
712 exec AS_MESSAGE_FD([])>/dev/null
713 if test "x[$]$1" = x; then
714 # The AC_PATH_PROGS macro doesn't work properly when its 4th argument
716 if test "x$gcc_cv_tool_dirs" = x; then
719 AC_PATH_PROGS($1, $2, , $gcc_cv_tool_dirs)
722 if test "x[$]$1" = x; then
723 # If the loop above did not find a tool, then use whatever
724 # one we can find in the users's path. We are looking for a
725 # ${build} -> ${target} tool.
726 if test "x$program_prefix" != xNONE; then
727 default_tool_name=${program_prefix}$2
728 elif test x$build != x$host && test x$build != x$target; then
729 default_tool_name=${target_noncanonical}-$2
731 default_tool_name=`echo $2 | sed "${program_transform_name}"`
733 AC_PATH_PROGS($1, $default_tool_name,
734 $gcc_cv_tool_prefix/bin/$default_tool_name$build_exeext)
736 test "$silent" != yes && exec AS_MESSAGE_FD([])>&1