]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/aclocal.m4
* config/m32c/m32c.h (TRAMPOLINE_ALIGNMENT): Correct misspelling
[thirdparty/gcc.git] / gcc / aclocal.m4
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])
9
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],
20 [#ifndef $1
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])
25 else
26 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
27 fi
28 ])dnl
29
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
38 define to 0.])])dnl
39 for ac_func in $1
40 do
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
51 dnl during this test.
52 #undef $ac_tr_decl
53 #define $ac_tr_decl 1
54 $4
55 )
56 done
57 ])
58
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,
67 [ echo abfoo >t1
68 echo cdfoo >t2
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
72 :
73 else
74 gcc_cv_prog_cmp_skip=gnucompare
75 fi
76 fi
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
80 :
81 else
82 gcc_cv_prog_cmp_skip=fastcompare
83 fi
84 fi
85 fi
86 rm t1 t2
87 ])
88 make_compare_target=$gcc_cv_prog_cmp_skip
89 AC_SUBST(make_compare_target)
90 ])
91
92 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
93 AC_DEFUN([gcc_AC_PROG_LN_S],
94 [AC_MSG_CHECKING(whether ln -s works)
95 AC_CACHE_VAL(gcc_cv_prog_LN_S,
96 [rm -f conftestdata_t
97 echo >conftestdata_f
98 if ln -s conftestdata_f conftestdata_t 2>/dev/null
99 then
100 gcc_cv_prog_LN_S="ln -s"
101 else
102 if ln conftestdata_f conftestdata_t 2>/dev/null
103 then
104 gcc_cv_prog_LN_S=ln
105 else
106 if cp -p conftestdata_f conftestdata_t 2>/dev/null
107 then
108 gcc_cv_prog_LN_S="cp -p"
109 else
110 gcc_cv_prog_LN_S=cp
111 fi
112 fi
113 fi
114 rm -f conftestdata_f conftestdata_t
115 ])dnl
116 LN_S="$gcc_cv_prog_LN_S"
117 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
118 AC_MSG_RESULT(yes)
119 else
120 if test "$gcc_cv_prog_LN_S" = "ln"; then
121 AC_MSG_RESULT([no, using ln])
122 else
123 AC_MSG_RESULT([no, and neither does ln, so using $gcc_cv_prog_LN_S])
124 fi
125 fi
126 AC_SUBST(LN_S)dnl
127 ])
128
129 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
130 dnl of the usual 2.
131 AC_DEFUN([gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG],
132 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
133 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
134 #include <sys/types.h>
135 #ifdef HAVE_SYS_STAT_H
136 # include <sys/stat.h>
137 #endif
138 #ifdef HAVE_UNISTD_H
139 # include <unistd.h>
140 #endif
141 #ifdef HAVE_DIRECT_H
142 # include <direct.h>
143 #endif], [mkdir ("foo", 0);])],
144 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
145 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
146 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
147 fi
148 ])
149
150 AC_DEFUN([gcc_AC_PROG_INSTALL],
151 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
152 # Find a good install program. We prefer a C program (faster),
153 # so one script is as good as another. But avoid the broken or
154 # incompatible versions:
155 # SysV /etc/install, /usr/sbin/install
156 # SunOS /usr/etc/install
157 # IRIX /sbin/install
158 # AIX /bin/install
159 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
160 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
161 # ./install, which can be erroneously created by make from ./install.sh.
162 AC_MSG_CHECKING(for a BSD compatible install)
163 if test -z "$INSTALL"; then
164 AC_CACHE_VAL(ac_cv_path_install,
165 [ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
166 for ac_dir in $PATH; do
167 # Account for people who put trailing slashes in PATH elements.
168 case "$ac_dir/" in
169 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
170 *)
171 # OSF1 and SCO ODT 3.0 have their own names for install.
172 for ac_prog in ginstall scoinst install; do
173 if test -f $ac_dir/$ac_prog; then
174 if test $ac_prog = install &&
175 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
176 # AIX install. It has an incompatible calling convention.
177 # OSF/1 installbsd also uses dspmsg, but is usable.
178 :
179 else
180 ac_cv_path_install="$ac_dir/$ac_prog -c"
181 break 2
182 fi
183 fi
184 done
185 ;;
186 esac
187 done
188 IFS="$ac_save_IFS"
189 ])dnl
190 if test "${ac_cv_path_install+set}" = set; then
191 INSTALL="$ac_cv_path_install"
192 else
193 # As a last resort, use the slow shell script. We don't cache a
194 # path for INSTALL within a source directory, because that will
195 # break other packages using the cache if that directory is
196 # removed, or if the path is relative.
197 INSTALL="$ac_install_sh"
198 fi
199 fi
200 dnl We do special magic for INSTALL instead of AC_SUBST, to get
201 dnl relative paths right.
202 AC_MSG_RESULT($INSTALL)
203 AC_SUBST(INSTALL)dnl
204
205 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
206 # It thinks the first close brace ends the variable substitution.
207 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
208 AC_SUBST(INSTALL_PROGRAM)dnl
209
210 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
211 AC_SUBST(INSTALL_DATA)dnl
212 ])
213
214 # mmap(2) blacklisting. Some platforms provide the mmap library routine
215 # but don't support all of the features we need from it.
216 AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
217 [
218 AC_CHECK_HEADER([sys/mman.h],
219 [gcc_header_sys_mman_h=yes], [gcc_header_sys_mman_h=no])
220 AC_CHECK_FUNC([mmap], [gcc_func_mmap=yes], [gcc_func_mmap=no])
221 if test "$gcc_header_sys_mman_h" != yes \
222 || test "$gcc_func_mmap" != yes; then
223 gcc_cv_func_mmap_file=no
224 gcc_cv_func_mmap_dev_zero=no
225 gcc_cv_func_mmap_anon=no
226 else
227 AC_CACHE_CHECK([whether read-only mmap of a plain file works],
228 gcc_cv_func_mmap_file,
229 [# Add a system to this blacklist if
230 # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
231 # memory area containing the same data that you'd get if you applied
232 # read() to the same fd. The only system known to have a problem here
233 # is VMS, where text files have record structure.
234 case "$host_os" in
235 vms* | ultrix*)
236 gcc_cv_func_mmap_file=no ;;
237 *)
238 gcc_cv_func_mmap_file=yes;;
239 esac])
240 AC_CACHE_CHECK([whether mmap from /dev/zero works],
241 gcc_cv_func_mmap_dev_zero,
242 [# Add a system to this blacklist if it has mmap() but /dev/zero
243 # does not exist, or if mmapping /dev/zero does not give anonymous
244 # zeroed pages with both the following properties:
245 # 1. If you map N consecutive pages in with one call, and then
246 # unmap any subset of those pages, the pages that were not
247 # explicitly unmapped remain accessible.
248 # 2. If you map two adjacent blocks of memory and then unmap them
249 # both at once, they must both go away.
250 # Systems known to be in this category are Windows (all variants),
251 # VMS, and Darwin.
252 case "$host_os" in
253 vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
254 gcc_cv_func_mmap_dev_zero=no ;;
255 *)
256 gcc_cv_func_mmap_dev_zero=yes;;
257 esac])
258
259 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
260 AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
261 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
262 [#include <sys/types.h>
263 #include <sys/mman.h>
264 #include <unistd.h>
265
266 #ifndef MAP_ANONYMOUS
267 #define MAP_ANONYMOUS MAP_ANON
268 #endif
269 ],
270 [int n = MAP_ANONYMOUS;])],
271 gcc_cv_decl_map_anon=yes,
272 gcc_cv_decl_map_anon=no)])
273
274 if test $gcc_cv_decl_map_anon = no; then
275 gcc_cv_func_mmap_anon=no
276 else
277 AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
278 gcc_cv_func_mmap_anon,
279 [# Add a system to this blacklist if it has mmap() and MAP_ANON or
280 # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
281 # doesn't give anonymous zeroed pages with the same properties listed
282 # above for use of /dev/zero.
283 # Systems known to be in this category are Windows, VMS, and SCO Unix.
284 case "$host_os" in
285 vms* | cygwin* | pe | mingw* | sco* | udk* )
286 gcc_cv_func_mmap_anon=no ;;
287 *)
288 gcc_cv_func_mmap_anon=yes;;
289 esac])
290 fi
291 fi
292
293 if test $gcc_cv_func_mmap_file = yes; then
294 AC_DEFINE(HAVE_MMAP_FILE, 1,
295 [Define if read-only mmap of a plain file works.])
296 fi
297 if test $gcc_cv_func_mmap_dev_zero = yes; then
298 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
299 [Define if mmap of /dev/zero works.])
300 fi
301 if test $gcc_cv_func_mmap_anon = yes; then
302 AC_DEFINE(HAVE_MMAP_ANON, 1,
303 [Define if mmap with MAP_ANON(YMOUS) works.])
304 fi
305 ])
306
307 dnl Locate a program and check that its version is acceptable.
308 dnl AC_PROG_CHECK_VER(var, name, version-switch,
309 dnl version-extract-regexp, version-glob)
310 AC_DEFUN([gcc_AC_CHECK_PROG_VER],
311 [AC_REQUIRE([gcc_AC_BUILD_EXEEXT])
312 AC_CHECK_PROG([$1], [$2], [$2])
313 if test -n "[$]$1"; then
314 # Found it, now check the version.
315 AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
316 [changequote(<<,>>)dnl
317 ac_prog_version=`<<$>>$1 $3 2>&1 |
318 sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
319 changequote([,])dnl
320 echo "configure:__oline__: version of $2 is $ac_prog_version" >&AS_MESSAGE_LOG_FD
321 changequote(<<,>>)dnl
322 case $ac_prog_version in
323 '') gcc_cv_prog_$2_modern=no;;
324 <<$5>>)
325 gcc_cv_prog_$2_modern=yes;;
326 *) gcc_cv_prog_$2_modern=no;;
327 esac
328 changequote([,])dnl
329 ])
330 else
331 gcc_cv_prog_$2_modern=no
332 fi
333 ])
334
335 dnl Determine if enumerated bitfields are unsigned. ISO C says they can
336 dnl be either signed or unsigned.
337 dnl
338 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
339 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
340 [AC_RUN_IFELSE([AC_LANG_SOURCE([#include <stdlib.h>
341 enum t { BLAH = 128 } ;
342 struct s_t { enum t member : 8; } s ;
343 int main(void)
344 {
345 s.member = BLAH;
346 if (s.member < 0) exit(1);
347 exit(0);
348
349 }])], gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
350 if test $gcc_cv_enum_bf_unsigned = yes; then
351 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
352 [Define if enumerated bitfields are treated as unsigned values.])
353 fi])
354
355 dnl Probe number of bits in a byte.
356 dnl Note C89 requires CHAR_BIT >= 8.
357 dnl
358 AC_DEFUN([gcc_AC_C_CHAR_BIT],
359 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
360 [AC_EGREP_CPP(found,
361 [#ifdef HAVE_LIMITS_H
362 #include <limits.h>
363 #endif
364 #ifdef CHAR_BIT
365 found
366 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
367 ])
368 if test $gcc_cv_decl_char_bit = no; then
369 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
370 [i=8
371 gcc_cv_c_nbby=
372 while test $i -lt 65; do
373 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
374 [switch(0) {
375 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
376 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
377 ; }])],
378 [gcc_cv_c_nbby=$i; break])
379 i=`expr $i + 1`
380 done
381 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
382 ])
383 if test $gcc_cv_c_nbby = failed; then
384 AC_MSG_ERROR(cannot determine number of bits in a byte)
385 else
386 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
387 [Define as the number of bits in a byte, if \`limits.h' doesn't.])
388 fi
389 fi])
390
391 dnl From Bruno Haible.
392
393 AC_DEFUN([AM_LANGINFO_CODESET],
394 [
395 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
396 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <langinfo.h>],
397 [char* cs = nl_langinfo(CODESET);])],
398 am_cv_langinfo_codeset=yes,
399 am_cv_langinfo_codeset=no)
400 ])
401 if test $am_cv_langinfo_codeset = yes; then
402 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
403 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
404 fi
405 ])
406
407 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
408 [AC_ARG_ENABLE(initfini-array,
409 [ --enable-initfini-array use .init_array/.fini_array sections],
410 [], [
411 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
412 gcc_cv_initfini_array, [dnl
413 AC_RUN_IFELSE([AC_LANG_SOURCE([
414 static int x = -1;
415 int main (void) { return x; }
416 int foo (void) { x = 0; }
417 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;])],
418 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
419 [gcc_cv_initfini_array=no])])
420 enable_initfini_array=$gcc_cv_initfini_array
421 ])
422 if test $enable_initfini_array = yes; then
423 AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
424 [Define .init_array/.fini_array sections are available and working.])
425 fi])
426
427 dnl # _gcc_COMPUTE_GAS_VERSION
428 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
429 dnl #
430 dnl # WARNING:
431 dnl # gcc_cv_as_gas_srcdir must be defined before this.
432 dnl # This gross requirement will go away eventually.
433 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
434 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
435 for f in $gcc_cv_as_bfd_srcdir/configure \
436 $gcc_cv_as_gas_srcdir/configure \
437 $gcc_cv_as_gas_srcdir/configure.in \
438 $gcc_cv_as_gas_srcdir/Makefile.in ; do
439 gcc_cv_gas_version=`sed -n -e 's/^[[ ]]*\(VERSION=[[0-9]]*\.[[0-9]]*.*\)/\1/p' < $f`
440 if test x$gcc_cv_gas_version != x; then
441 break
442 fi
443 done
444 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
445 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
446 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
447 case $gcc_cv_gas_patch_version in
448 "") gcc_cv_gas_patch_version="0" ;;
449 esac
450 gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
451 + $gcc_cv_gas_minor_version \) \* 1000 \
452 + $gcc_cv_gas_patch_version`
453 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
454
455 dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
456 dnl # [command_if_true = :], [command_if_false = :])
457 dnl # Check to see if the version of GAS is greater than or
458 dnl # equal to the specified version.
459 dnl #
460 dnl # The first ifelse() shortens the shell code if the patchlevel
461 dnl # is unimportant (the usual case). The others handle missing
462 dnl # commands. Note that the tests are structured so that the most
463 dnl # common version number cases are tested first.
464 AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
465 [ifelse([$1], elf,
466 [if test $in_tree_gas_is_elf = yes \
467 &&],
468 [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4`
469 then dnl
470 ifelse([$5],,:,[$5])[]dnl
471 ifelse([$6],,,[
472 else $6])
473 fi])
474
475 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
476 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
477 ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
478 [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
479
480 dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
481 dnl [extra switches to as], [assembler input],
482 dnl [extra testing logic], [command if feature available])
483 dnl
484 dnl Checks for an assembler feature. If we are building an in-tree
485 dnl gas, the feature is available if the associated assembler version
486 dnl is greater than or equal to major.minor.patchlevel. If not, then
487 dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
488 dnl if assembly succeeds. If EXTRA TESTING LOGIC is not the empty string,
489 dnl then it is run instead of simply setting CV to "yes" - it is responsible
490 dnl for doing so, if appropriate.
491 AC_DEFUN([gcc_GAS_CHECK_FEATURE],
492 [AC_CACHE_CHECK([assembler for $1], [$2],
493 [[$2]=no
494 ifelse([$3],,,[dnl
495 if test $in_tree_gas = yes; then
496 gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
497 el])if test x$gcc_cv_as != x; then
498 echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s
499 if AC_TRY_COMMAND([$gcc_cv_as $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
500 then
501 ifelse([$6],, [$2]=yes, [$6])
502 else
503 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
504 cat conftest.s >&AS_MESSAGE_LOG_FD
505 fi
506 rm -f conftest.o conftest.s
507 fi])
508 ifelse([$7],,,[dnl
509 if test $[$2] = yes; then
510 $7
511 fi])])
512
513 # AM_PROG_CC_C_O
514 # --------------
515 # Like AC_PROG_CC_C_O, but changed for automake.
516
517 # Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
518
519 # This program is free software; you can redistribute it and/or modify
520 # it under the terms of the GNU General Public License as published by
521 # the Free Software Foundation; either version 2, or (at your option)
522 # any later version.
523
524 # This program is distributed in the hope that it will be useful,
525 # but WITHOUT ANY WARRANTY; without even the implied warranty of
526 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
527 # GNU General Public License for more details.
528
529 # You should have received a copy of the GNU General Public License
530 # along with this program; if not, write to the Free Software
531 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
532 # 02110-1301, USA.
533
534 AC_DEFUN([AM_PROG_CC_C_O],
535 [AC_REQUIRE([AC_PROG_CC_C_O])dnl
536 AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
537 # FIXME: we rely on the cache variable name because
538 # there is no other way.
539 set dummy $CC
540 ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
541 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
542 # Losing compiler, so override with the script.
543 # FIXME: It is wrong to rewrite CC.
544 # But if we don't then we get into trouble of one sort or another.
545 # A longer-term fix would be to have automake use am__CC in this case,
546 # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
547 CC="$am_aux_dir/compile $CC"
548 fi
549 ])
550
551 # AM_AUX_DIR_EXPAND
552
553 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
554
555 # This program is free software; you can redistribute it and/or modify
556 # it under the terms of the GNU General Public License as published by
557 # the Free Software Foundation; either version 2, or (at your option)
558 # any later version.
559
560 # This program is distributed in the hope that it will be useful,
561 # but WITHOUT ANY WARRANTY; without even the implied warranty of
562 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
563 # GNU General Public License for more details.
564
565 # You should have received a copy of the GNU General Public License
566 # along with this program; if not, write to the Free Software
567 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
568 # 02110-1301, USA.
569
570 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
571 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
572 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
573 #
574 # Of course, Automake must honor this variable whenever it calls a
575 # tool from the auxiliary directory. The problem is that $srcdir (and
576 # therefore $ac_aux_dir as well) can be either absolute or relative,
577 # depending on how configure is run. This is pretty annoying, since
578 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
579 # source directory, any form will work fine, but in subdirectories a
580 # relative path needs to be adjusted first.
581 #
582 # $ac_aux_dir/missing
583 # fails when called from a subdirectory if $ac_aux_dir is relative
584 # $top_srcdir/$ac_aux_dir/missing
585 # fails if $ac_aux_dir is absolute,
586 # fails when called from a subdirectory in a VPATH build with
587 # a relative $ac_aux_dir
588 #
589 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
590 # are both prefixed by $srcdir. In an in-source build this is usually
591 # harmless because $srcdir is `.', but things will broke when you
592 # start a VPATH build or use an absolute $srcdir.
593 #
594 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
595 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
596 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
597 # and then we would define $MISSING as
598 # MISSING="\${SHELL} $am_aux_dir/missing"
599 # This will work as long as MISSING is not called from configure, because
600 # unfortunately $(top_srcdir) has no meaning in configure.
601 # However there are other variables, like CC, which are often used in
602 # configure, and could therefore not use this "fixed" $ac_aux_dir.
603 #
604 # Another solution, used here, is to always expand $ac_aux_dir to an
605 # absolute PATH. The drawback is that using absolute paths prevent a
606 # configured tree to be moved without reconfiguration.
607
608 AC_DEFUN([AM_AUX_DIR_EXPAND],
609 [dnl Rely on autoconf to set up CDPATH properly.
610 AC_PREREQ([2.50])dnl
611 # expand $ac_aux_dir to an absolute path
612 am_aux_dir=`cd $ac_aux_dir && pwd`
613 ])
614
615
616 dnl GCC_TARGET_TEMPLATE(KEY)
617 dnl ------------------------
618 dnl Define KEY as a valid configure key on the target machine.
619
620 m4_define([GCC_TARGET_TEMPLATE],
621 [m4_define([GCC_TARGET_TEMPLATE($1)],[])])
622
623 dnl AH_TEMPLATE(KEY, DESCRIPTION)
624 dnl -----------------------------
625 dnl Issue an autoheader template for KEY, i.e., a comment composed of
626 dnl DESCRIPTION (properly wrapped), and then #undef KEY. Redefinition
627 dnl of the macro in autoheader.m4, to support definition of only a few
628 dnl keys while compiling target libraries.
629
630 m4_define([AH_TEMPLATE],
631 [AH_VERBATIM([$1],m4_text_wrap([$2 */], [ ], [/* ])
632 m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[#ifndef USED_FOR_TARGET
633 ])[#undef $1]m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[
634 #endif
635 ]))])
636
637 AC_DEFUN([gcc_AC_TOOL_DIRS], [
638 # When searching for the assembler or linker, search the same directories
639 # that the installed compiler will search. Else we may find the wrong
640 # assembler or linker and lose. If we do not find a suitable binary,
641 # then try the user's path.
642 #
643 # Also note we have to check MD_EXEC_PREFIX before checking the user's path.
644 if test "x$exec_prefix" = xNONE; then
645 if test "x$prefix" = xNONE; then
646 gcc_cv_tool_prefix=/usr/local
647 else
648 gcc_cv_tool_prefix=$prefix
649 fi
650 else
651 gcc_cv_tool_prefix=$exec_prefix
652 fi
653
654 if test x$host = x$build; then
655 gcc_cv_tool_dirs="$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical/$gcc_version"
656 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/libexec/gcc/$target_noncanonical"
657 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR/usr/lib/gcc/$target_noncanonical/$gcc_version"
658 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR/usr/lib/gcc/$target_noncanonical"
659 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/$target_noncanonical/bin/$target_noncanonical/$gcc_version"
660 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$gcc_cv_tool_prefix/$target_noncanonical/bin"
661 else
662 gcc_cv_tool_dirs=
663 fi
664
665 if test x$build = x$target; then
666 # Rummage through tm_files looking for MD_EXEC_PREFIX
667 md_dirs=
668 for f in ${tm_file_list}; do
669 if test -f $f; then
670 if grep '^#[ ]*undef[ ]*MD_EXEC_PREFIX' $f > /dev/null; then
671 md_dirs=
672 fi
673 md_dirs="$md_dirs "`sed -n -e 's@^#[ ]*define[ ]*MD_EXEC_PREFIX[ ]*"\(.*\)/"@\1@p' < $f`
674 fi
675 done
676 for f in ${md_dirs}; do
677 gcc_cv_tool_dirs="$gcc_cv_tool_dirs$PATH_SEPARATOR$f"
678 done
679 fi])
680
681 dnl Make sure that build_exeext is looked for
682 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
683 ac_executable_extensions="$build_exeext"])
684
685 AC_DEFUN([gcc_AC_CHECK_TOOL], [
686 AC_REQUIRE([gcc_AC_TOOL_DIRS])
687 AC_REQUIRE([gcc_AC_BUILD_EXEEXT])
688
689 dnl shut up useless "checking for..." messages
690 dnl we can still read them in config.log
691 exec AS_MESSAGE_FD([])>/dev/null
692 if test "x[$]$1" = x; then
693 # The AC_PATH_PROGS macro doesn't work properly when its 4th argument
694 # is empty.
695 if test "x$gcc_cv_tool_dirs" = x; then
696 $1=
697 else
698 AC_PATH_PROGS($1, $2, , $gcc_cv_tool_dirs)
699 fi
700 fi
701 if test "x[$]$1" = x; then
702 # If the loop above did not find a tool, then use whatever
703 # one we can find in the users's path. We are looking for a
704 # ${build} -> ${target} tool.
705 if test "x$program_prefix" != xNONE; then
706 default_tool_name=${program_prefix}$2
707 elif test x$build != x$host && test x$build != x$target; then
708 default_tool_name=${target_noncanonical}-$2
709 else
710 default_tool_name=`echo $2 | sed "${program_transform_name}"`
711 fi
712 AC_PATH_PROGS($1, $default_tool_name,
713 $gcc_cv_tool_prefix/bin/$default_tool_name$build_exeext)
714 fi
715 test "$silent" != yes && exec AS_MESSAGE_FD([])>&1
716
717 $3="[$]$1"
718 AC_SUBST($3)])