OSDN Git Service

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