]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/acinclude.m4
Update copyright years.
[thirdparty/gcc.git] / gcc / acinclude.m4
CommitLineData
818ab71a 1dnl Copyright (C) 2005-2016 Free Software Foundation, Inc.
ad41bd84
JM
2dnl
3dnl This file is part of GCC.
4dnl
5dnl GCC is free software; you can redistribute it and/or modify
6dnl it under the terms of the GNU General Public License as published by
7dnl the Free Software Foundation; either version 3, or (at your option)
8dnl any later version.
9dnl
10dnl GCC is distributed in the hope that it will be useful,
11dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13dnl GNU General Public License for more details.
14dnl
15dnl You should have received a copy of the GNU General Public License
16dnl along with GCC; see the file COPYING3. If not see
17dnl <http://www.gnu.org/licenses/>.
18
67da1534
KC
19dnl See whether we need a declaration for a function.
20dnl The result is highly dependent on the INCLUDES passed in, so make sure
21dnl to use a different cache variable name in this macro if it is invoked
22dnl in a different context somewhere else.
23dnl gcc_AC_CHECK_DECL(SYMBOL,
24dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
25AC_DEFUN([gcc_AC_CHECK_DECL],
26[AC_MSG_CHECKING([whether $1 is declared])
27AC_CACHE_VAL(gcc_cv_have_decl_$1,
28[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$4],
29[#ifndef $1
30char *(*pfn) = (char *(*)) $1 ;
31#endif])], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
32if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
33 AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
34else
35 AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
36fi
37])dnl
38
39dnl Check multiple functions to see whether each needs a declaration.
40dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
41dnl gcc_AC_CHECK_DECLS(SYMBOLS,
42dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
43AC_DEFUN([gcc_AC_CHECK_DECLS],
44[AC_FOREACH([gcc_AC_Func], [$1],
45 [AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_[]gcc_AC_Func),
46 [Define to 1 if we found a declaration for ']gcc_AC_Func[', otherwise
47 define to 0.])])dnl
48for ac_func in $1
49do
50 ac_tr_decl=AS_TR_CPP([HAVE_DECL_$ac_func])
51gcc_AC_CHECK_DECL($ac_func,
52 [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
53 [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
54dnl It is possible that the include files passed in here are local headers
55dnl which supply a backup declaration for the relevant prototype based on
56dnl the definition of (or lack of) the HAVE_DECL_ macro. If so, this test
57dnl will always return success. E.g. see libiberty.h's handling of
58dnl `basename'. To avoid this, we define the relevant HAVE_DECL_ macro to
59dnl 1 so that any local headers used do not provide their own prototype
60dnl during this test.
61#undef $ac_tr_decl
62#define $ac_tr_decl 1
63 $4
64)
65done
66])
67
68dnl 'make compare' can be significantly faster, if cmp itself can
69dnl skip bytes instead of using tail. The test being performed is
70dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
71dnl but we need to sink errors and handle broken shells. We also test
72dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
73dnl accepted by cmp on some systems.
74AC_DEFUN([gcc_AC_PROG_CMP_IGNORE_INITIAL],
75[AC_CACHE_CHECK([for cmp's capabilities], gcc_cv_prog_cmp_skip,
76[ echo abfoo >t1
77 echo cdfoo >t2
78 gcc_cv_prog_cmp_skip=slowcompare
79 if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
80 if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
81 :
82 else
83 gcc_cv_prog_cmp_skip=gnucompare
84 fi
85 fi
86 if test $gcc_cv_prog_cmp_skip = slowcompare ; then
87 if cmp t1 t2 2 2 > /dev/null 2>&1; then
88 if cmp t1 t2 1 1 > /dev/null 2>&1; then
89 :
90 else
91 gcc_cv_prog_cmp_skip=fastcompare
92 fi
93 fi
94 fi
95 rm t1 t2
96])
97make_compare_target=$gcc_cv_prog_cmp_skip
98AC_SUBST(make_compare_target)
99])
100
101dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
102AC_DEFUN([gcc_AC_PROG_LN_S],
103[AC_MSG_CHECKING(whether ln -s works)
104AC_CACHE_VAL(gcc_cv_prog_LN_S,
105[rm -f conftestdata_t
106echo >conftestdata_f
107if ln -s conftestdata_f conftestdata_t 2>/dev/null
108then
109 gcc_cv_prog_LN_S="ln -s"
110else
111 if ln conftestdata_f conftestdata_t 2>/dev/null
112 then
113 gcc_cv_prog_LN_S=ln
114 else
115 if cp -p conftestdata_f conftestdata_t 2>/dev/null
116 then
117 gcc_cv_prog_LN_S="cp -p"
118 else
119 gcc_cv_prog_LN_S=cp
120 fi
121 fi
122fi
123rm -f conftestdata_f conftestdata_t
124])dnl
125LN_S="$gcc_cv_prog_LN_S"
126if test "$gcc_cv_prog_LN_S" = "ln -s"; then
127 AC_MSG_RESULT(yes)
128else
129 if test "$gcc_cv_prog_LN_S" = "ln"; then
130 AC_MSG_RESULT([no, using ln])
131 else
132 AC_MSG_RESULT([no, and neither does ln, so using $gcc_cv_prog_LN_S])
133 fi
134fi
135AC_SUBST(LN_S)dnl
136])
137
138dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
139dnl of the usual 2.
140AC_DEFUN([gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG],
141[AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
142[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
143#include <sys/types.h>
144#ifdef HAVE_SYS_STAT_H
145# include <sys/stat.h>
146#endif
147#ifdef HAVE_UNISTD_H
148# include <unistd.h>
149#endif
150#ifdef HAVE_DIRECT_H
151# include <direct.h>
152#endif], [mkdir ("foo", 0);])],
153 gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
154if test $gcc_cv_mkdir_takes_one_arg = yes ; then
155 AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
156fi
157])
158
159AC_DEFUN([gcc_AC_PROG_INSTALL],
160[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
161# Find a good install program. We prefer a C program (faster),
162# so one script is as good as another. But avoid the broken or
163# incompatible versions:
164# SysV /etc/install, /usr/sbin/install
165# SunOS /usr/etc/install
166# IRIX /sbin/install
167# AIX /bin/install
168# AFS /usr/afsws/bin/install, which mishandles nonexistent args
169# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
170# ./install, which can be erroneously created by make from ./install.sh.
171AC_MSG_CHECKING(for a BSD compatible install)
172if test -z "$INSTALL"; then
173AC_CACHE_VAL(ac_cv_path_install,
174[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
175 for ac_dir in $PATH; do
176 # Account for people who put trailing slashes in PATH elements.
177 case "$ac_dir/" in
178 /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
179 *)
180 # OSF1 and SCO ODT 3.0 have their own names for install.
181 for ac_prog in ginstall scoinst install; do
182 if test -f $ac_dir/$ac_prog; then
183 if test $ac_prog = install &&
184 grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
185 # AIX install. It has an incompatible calling convention.
186 # OSF/1 installbsd also uses dspmsg, but is usable.
187 :
188 else
189 ac_cv_path_install="$ac_dir/$ac_prog -c"
190 break 2
191 fi
192 fi
193 done
194 ;;
195 esac
196 done
197 IFS="$ac_save_IFS"
198])dnl
199 if test "${ac_cv_path_install+set}" = set; then
200 INSTALL="$ac_cv_path_install"
201 else
202 # As a last resort, use the slow shell script. We don't cache a
203 # path for INSTALL within a source directory, because that will
204 # break other packages using the cache if that directory is
205 # removed, or if the path is relative.
206 INSTALL="$ac_install_sh"
207 fi
208fi
209dnl We do special magic for INSTALL instead of AC_SUBST, to get
210dnl relative paths right.
211AC_MSG_RESULT($INSTALL)
212AC_SUBST(INSTALL)dnl
213
214# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
215# It thinks the first close brace ends the variable substitution.
216test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
217AC_SUBST(INSTALL_PROGRAM)dnl
218
219test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
220AC_SUBST(INSTALL_DATA)dnl
221])
222
67da1534
KC
223dnl Determine if enumerated bitfields are unsigned. ISO C says they can
224dnl be either signed or unsigned.
225dnl
226AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
227[AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
228[AC_RUN_IFELSE([AC_LANG_SOURCE([#include <stdlib.h>
229enum t { BLAH = 128 } ;
230struct s_t { enum t member : 8; } s ;
231int main(void)
232{
233 s.member = BLAH;
234 if (s.member < 0) exit(1);
235 exit(0);
236
237}])], gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
238if test $gcc_cv_enum_bf_unsigned = yes; then
239 AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
240 [Define if enumerated bitfields are treated as unsigned values.])
241fi])
242
243dnl Probe number of bits in a byte.
244dnl Note C89 requires CHAR_BIT >= 8.
245dnl
246AC_DEFUN([gcc_AC_C_CHAR_BIT],
247[AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
248[AC_EGREP_CPP(found,
249[#ifdef HAVE_LIMITS_H
250#include <limits.h>
251#endif
252#ifdef CHAR_BIT
253found
254#endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
255])
256if test $gcc_cv_decl_char_bit = no; then
257 AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
258[i=8
259 gcc_cv_c_nbby=
260 while test $i -lt 65; do
261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
262 [switch(0) {
263 case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
264 case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
265 ; }])],
266 [gcc_cv_c_nbby=$i; break])
267 i=`expr $i + 1`
268 done
269 test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
270])
271if test $gcc_cv_c_nbby = failed; then
272 AC_MSG_ERROR(cannot determine number of bits in a byte)
273else
274 AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
236ec2d7 275 [Define as the number of bits in a byte, if `limits.h' doesn't.])
67da1534
KC
276fi
277fi])
278
279AC_DEFUN([gcc_AC_INITFINI_ARRAY],
e992fc2e
RO
280[AC_REQUIRE([gcc_SUN_LD_VERSION])dnl
281AC_ARG_ENABLE(initfini-array,
67da1534
KC
282 [ --enable-initfini-array use .init_array/.fini_array sections],
283 [], [
284AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
285 gcc_cv_initfini_array, [dnl
0c587260 286 if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
e9c9f128
JJ
287 case "${target}" in
288 ia64-*)
289 AC_RUN_IFELSE([AC_LANG_SOURCE([
b0894e1f
L
290#ifndef __ELF__
291#error Not an ELF OS
292#endif
0c587260
L
293/* We turn on .preinit_array/.init_array/.fini_array support for ia64
294 if it can be used. */
67da1534
KC
295static int x = -1;
296int main (void) { return x; }
297int foo (void) { x = 0; }
0c587260 298int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
0c587260 299])],
67da1534 300 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
e9c9f128
JJ
301 [gcc_cv_initfini_array=no]);;
302 *)
303 gcc_cv_initfini_array=no
304 if test $in_tree_ld = yes ; then
305 if test "$gcc_cv_gld_major_version" -eq 2 \
306 -a "$gcc_cv_gld_minor_version" -ge 22 \
307 -o "$gcc_cv_gld_major_version" -gt 2 \
308 && test $in_tree_ld_is_elf = yes; then
309 gcc_cv_initfini_array=yes
310 fi
311 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
e6b6bf09
RO
312 case $target:$gas in
313 *:yes)
314 sh_flags='"a"'
315 sh_type='%progbits'
316 ;;
317 i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
318 sh_flags='"a"'
319 sh_type='@progbits'
320 ;;
321 sparc*-*-solaris2*:no)
322 sh_flags='#alloc'
323 sh_type='#progbits'
324 sh_quote='"'
325 ;;
326 esac
327 case "$target:$gnu_ld" in
328 *:yes)
329 cat > conftest.s <<EOF
330.section .dtors,$sh_flags,$sh_type
e9c9f128
JJ
331.balign 4
332.byte 'A', 'A', 'A', 'A'
e6b6bf09 333.section .ctors,$sh_flags,$sh_type
e9c9f128
JJ
334.balign 4
335.byte 'B', 'B', 'B', 'B'
e6b6bf09 336.section .fini_array.65530,$sh_flags,$sh_type
e9c9f128
JJ
337.balign 4
338.byte 'C', 'C', 'C', 'C'
e6b6bf09 339.section .init_array.65530,$sh_flags,$sh_type
e9c9f128
JJ
340.balign 4
341.byte 'D', 'D', 'D', 'D'
e6b6bf09 342.section .dtors.64528,$sh_flags,$sh_type
e9c9f128
JJ
343.balign 4
344.byte 'E', 'E', 'E', 'E'
e6b6bf09 345.section .ctors.64528,$sh_flags,$sh_type
e9c9f128
JJ
346.balign 4
347.byte 'F', 'F', 'F', 'F'
e6b6bf09 348.section .fini_array.01005,$sh_flags,$sh_type
e9c9f128
JJ
349.balign 4
350.byte 'G', 'G', 'G', 'G'
e6b6bf09 351.section .init_array.01005,$sh_flags,$sh_type
e9c9f128
JJ
352.balign 4
353.byte 'H', 'H', 'H', 'H'
354.text
e992fc2e
RO
355.globl _start
356_start:
e9c9f128 357EOF
e6b6bf09
RO
358 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
359 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
360 && $gcc_cv_objdump -s -j .init_array conftest \
361 | grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
362 && $gcc_cv_objdump -s -j .fini_array conftest \
363 | grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
364 gcc_cv_initfini_array=yes
365 fi
366 ;;
367 *-*-solaris2*:no)
368 # When Solaris ld added constructor priority support, it was
369 # decided to only handle .init_array.N/.fini_array.N since
370 # there was no need for backwards compatibility with
371 # .ctors.N/.dtors.N. .ctors/.dtors remain as separate
372 # sections with correct execution order resp. to
373 # .init_array/.fini_array, while gld merges them into
374 # .init_array/.fini_array.
375 cat > conftest.s <<EOF
376.section $sh_quote.fini_array.65530$sh_quote,$sh_flags,$sh_type
377.align 4
378.byte 'C', 'C', 'C', 'C'
379.section $sh_quote.init_array.65530$sh_quote,$sh_flags,$sh_type
380.align 4
381.byte 'D', 'D', 'D', 'D'
382.section $sh_quote.fini_array.01005$sh_quote,$sh_flags,$sh_type
383.align 4
384.byte 'G', 'G', 'G', 'G'
385.section $sh_quote.init_array.01005$sh_quote,$sh_flags,$sh_type
386.align 4
387.byte 'H', 'H', 'H', 'H'
388.text
389.globl _start
390_start:
391EOF
392 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
393 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
394 && $gcc_cv_objdump -s -j .init_array conftest \
395 | grep HHHHDDDD > /dev/null 2>&1 \
396 && $gcc_cv_objdump -s -j .fini_array conftest \
397 | grep GGGGCCCC > /dev/null 2>&1; then
398 gcc_cv_initfini_array=yes
399 fi
400 ;;
401 esac
e9c9f128
JJ
402changequote(,)dnl
403 rm -f conftest conftest.*
404changequote([,])dnl
405 fi
406 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
407#ifndef __ELF__
e992fc2e 408# error Not an ELF OS
e9c9f128
JJ
409#endif
410#include <stdlib.h>
e992fc2e
RO
411#if defined __GLIBC_PREREQ
412# if __GLIBC_PREREQ (2, 4)
413# else
414# error GLIBC 2.4 required
415# endif
e9c9f128 416#else
e992fc2e
RO
417# if defined __sun__ && defined __svr4__
418 /* Solaris ld.so.1 supports .init_array/.fini_array since Solaris 8. */
419# else
420# error The C library not known to support .init_array/.fini_array
421# endif
e9c9f128 422#endif
7888f266 423])],, [gcc_cv_initfini_array=no]);;
e9c9f128
JJ
424 esac
425 else
426 AC_MSG_CHECKING(cross compile... guessing)
427 gcc_cv_initfini_array=no
428 fi])
67da1534
KC
429 enable_initfini_array=$gcc_cv_initfini_array
430])
e6b6bf09
RO
431AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY_SUPPORT,
432 [`if test $enable_initfini_array = yes; then echo 1; else echo 0; fi`],
433 [Define 0/1 if .init_array/.fini_array sections are available and working.])
434])
67da1534
KC
435
436dnl # _gcc_COMPUTE_GAS_VERSION
437dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
438dnl #
439dnl # WARNING:
440dnl # gcc_cv_as_gas_srcdir must be defined before this.
441dnl # This gross requirement will go away eventually.
442AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
443[gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
444for f in $gcc_cv_as_bfd_srcdir/configure \
445 $gcc_cv_as_gas_srcdir/configure \
6b1786aa 446 $gcc_cv_as_gas_srcdir/configure.ac \
67da1534 447 $gcc_cv_as_gas_srcdir/Makefile.in ; do
81179208 448 gcc_cv_gas_version=`sed -n -e 's/^[[ ]]*VERSION=[[^0-9A-Za-z_]]*\([[0-9]]*\.[[0-9]]*.*\)/VERSION=\1/p' < $f`
67da1534
KC
449 if test x$gcc_cv_gas_version != x; then
450 break
451 fi
452done
81179208
HPN
453case $gcc_cv_gas_version in
454 VERSION=[[0-9]]*) ;;
455 *) AC_MSG_ERROR([[cannot find version of in-tree assembler]]);;
456esac
67da1534
KC
457gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
458gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
459gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
460case $gcc_cv_gas_patch_version in
461 "") gcc_cv_gas_patch_version="0" ;;
462esac
463gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
464 + $gcc_cv_gas_minor_version \) \* 1000 \
465 + $gcc_cv_gas_patch_version`
466]) []dnl # _gcc_COMPUTE_GAS_VERSION
467
468dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
469dnl # [command_if_true = :], [command_if_false = :])
470dnl # Check to see if the version of GAS is greater than or
471dnl # equal to the specified version.
472dnl #
473dnl # The first ifelse() shortens the shell code if the patchlevel
474dnl # is unimportant (the usual case). The others handle missing
475dnl # commands. Note that the tests are structured so that the most
476dnl # common version number cases are tested first.
477AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
478[ifelse([$1], elf,
479 [if test $in_tree_gas_is_elf = yes \
480 &&],
481 [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4`
482 then dnl
483ifelse([$5],,:,[$5])[]dnl
484ifelse([$6],,,[
485 else $6])
486fi])
487
488AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
489[AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
490ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
491 [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
492
e0b0fd74
L
493dnl # gcc_GAS_FLAGS
494dnl # Used by gcc_GAS_CHECK_FEATURE
495dnl #
496AC_DEFUN([gcc_GAS_FLAGS],
497[AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags,
498[ case "$target" in
499 i[[34567]]86-*-linux*)
d1227447
TS
500 dnl Override the default, which may be incompatible.
501 gcc_cv_as_flags=--32
502 ;;
503 x86_64-*-linux-gnux32)
504 dnl Override the default, which may be incompatible.
505 gcc_cv_as_flags=--x32
506 ;;
507 x86_64-*-linux*)
508 dnl Override the default, which may be incompatible.
509 gcc_cv_as_flags=--64
e0b0fd74 510 ;;
88ee1fc7
MS
511 powerpc*-*-darwin*)
512 dnl Always pass -arch ppc to assembler.
513 gcc_cv_as_flags="-arch ppc"
514 ;;
e0b0fd74
L
515 *)
516 gcc_cv_as_flags=" "
517 ;;
518 esac])
519])
520
67da1534
KC
521dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
522dnl [extra switches to as], [assembler input],
523dnl [extra testing logic], [command if feature available])
524dnl
525dnl Checks for an assembler feature. If we are building an in-tree
526dnl gas, the feature is available if the associated assembler version
527dnl is greater than or equal to major.minor.patchlevel. If not, then
528dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
529dnl if assembly succeeds. If EXTRA TESTING LOGIC is not the empty string,
530dnl then it is run instead of simply setting CV to "yes" - it is responsible
531dnl for doing so, if appropriate.
532AC_DEFUN([gcc_GAS_CHECK_FEATURE],
e0b0fd74
L
533[AC_REQUIRE([gcc_GAS_FLAGS])dnl
534AC_CACHE_CHECK([assembler for $1], [$2],
67da1534
KC
535 [[$2]=no
536 ifelse([$3],,,[dnl
537 if test $in_tree_gas = yes; then
538 gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
539 el])if test x$gcc_cv_as != x; then
dddc6762 540 AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s
e0b0fd74 541 if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
67da1534
KC
542 then
543 ifelse([$6],, [$2]=yes, [$6])
544 else
545 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
546 cat conftest.s >&AS_MESSAGE_LOG_FD
547 fi
548 rm -f conftest.o conftest.s
549 fi])
550ifelse([$7],,,[dnl
551if test $[$2] = yes; then
552 $7
553fi])])
554
e992fc2e
RO
555dnl gcc_SUN_LD_VERSION
556dnl
557dnl Determines Sun linker version numbers, setting gcc_cv_sun_ld_vers to
558dnl the complete version number and gcc_cv_sun_ld_vers_{major, minor} to
559dnl the corresponding fields.
560dnl
561dnl ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version
562dnl numbers can be used in ld.so.1 feature checks even if a different
563dnl linker is configured.
564dnl
565AC_DEFUN([gcc_SUN_LD_VERSION],
566[changequote(,)dnl
567if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
568 case "${target}" in
569 *-*-solaris2*)
570 #
571 # Solaris 2 ld -V output looks like this for a regular version:
572 #
573 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699
574 #
575 # but test versions add stuff at the end:
576 #
577 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10
578 #
579 gcc_cv_sun_ld_ver=`/usr/ccs/bin/ld -V 2>&1`
580 if echo "$gcc_cv_sun_ld_ver" | grep 'Solaris Link Editors' > /dev/null; then
581 gcc_cv_sun_ld_vers=`echo $gcc_cv_sun_ld_ver | sed -n \
582 -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
583 gcc_cv_sun_ld_vers_major=`expr "$gcc_cv_sun_ld_vers" : '\([0-9]*\)'`
584 gcc_cv_sun_ld_vers_minor=`expr "$gcc_cv_sun_ld_vers" : '[0-9]*\.\([0-9]*\)'`
585 fi
586 ;;
587 esac
588fi
589changequote([,])dnl
590])
591
67da1534
KC
592dnl GCC_TARGET_TEMPLATE(KEY)
593dnl ------------------------
594dnl Define KEY as a valid configure key on the target machine.
595
596m4_define([GCC_TARGET_TEMPLATE],
597[m4_define([GCC_TARGET_TEMPLATE($1)],[])])
598
599dnl AH_TEMPLATE(KEY, DESCRIPTION)
600dnl -----------------------------
601dnl Issue an autoheader template for KEY, i.e., a comment composed of
602dnl DESCRIPTION (properly wrapped), and then #undef KEY. Redefinition
603dnl of the macro in autoheader.m4, to support definition of only a few
604dnl keys while compiling target libraries.
605
606m4_define([AH_TEMPLATE],
607[AH_VERBATIM([$1],m4_text_wrap([$2 */], [ ], [/* ])
608m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[#ifndef USED_FOR_TARGET
609])[#undef $1]m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[
610#endif
611]))])
612
67da1534
KC
613dnl Make sure that build_exeext is looked for
614AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
615ac_executable_extensions="$build_exeext"])
616
75a2bcc0
JM
617dnl GCC_GLIBC_VERSION_GTE_IFELSE(MAJOR, MINOR, IF-TRUE, IF-FALSE)
618dnl -------------------------------------------------------------
619dnl If the target glibc version ($glibc_version_major.$glibc_version_minor)
620dnl is at least MAJOR.MINOR, call IF-TRUE, otherwise call IF-FALSE.
621AC_DEFUN([GCC_GLIBC_VERSION_GTE_IFELSE],
622[
623AS_IF([test $glibc_version_major -gt $1 \
624 || ( test $glibc_version_major -eq $1 && test $glibc_version_minor -ge $2 )],
625[$3], [$4])])