OSDN Git Service

* ChangeLog: Additional fixes for AVX2 ChangeLog entry.
[pf3gnuchains/gcc-fork.git] / gcc / acinclude.m4
1 dnl Copyright (C) 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc.
2 dnl
3 dnl This file is part of GCC.
4 dnl
5 dnl GCC is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3, or (at your option)
8 dnl any later version.
9 dnl
10 dnl GCC is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with GCC; see the file COPYING3.  If not see
17 dnl <http://www.gnu.org/licenses/>.
18
19 dnl See whether we need a declaration for a function.
20 dnl The result is highly dependent on the INCLUDES passed in, so make sure
21 dnl to use a different cache variable name in this macro if it is invoked
22 dnl in a different context somewhere else.
23 dnl gcc_AC_CHECK_DECL(SYMBOL,
24 dnl     [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
25 AC_DEFUN([gcc_AC_CHECK_DECL],
26 [AC_MSG_CHECKING([whether $1 is declared])
27 AC_CACHE_VAL(gcc_cv_have_decl_$1,
28 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$4],
29 [#ifndef $1
30 char *(*pfn) = (char *(*)) $1 ;
31 #endif])], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
32 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
33   AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
34 else
35   AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
36 fi
37 ])dnl
38
39 dnl Check multiple functions to see whether each needs a declaration.
40 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
41 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
42 dnl     [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
43 AC_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
48 for ac_func in $1
49 do
50   ac_tr_decl=AS_TR_CPP([HAVE_DECL_$ac_func])
51 gcc_AC_CHECK_DECL($ac_func,
52   [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
53   [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
54 dnl It is possible that the include files passed in here are local headers
55 dnl which supply a backup declaration for the relevant prototype based on
56 dnl the definition of (or lack of) the HAVE_DECL_ macro.  If so, this test
57 dnl will always return success.  E.g. see libiberty.h's handling of
58 dnl `basename'.  To avoid this, we define the relevant HAVE_DECL_ macro to
59 dnl 1 so that any local headers used do not provide their own prototype
60 dnl during this test.
61 #undef $ac_tr_decl
62 #define $ac_tr_decl 1
63   $4
64 )
65 done
66 ])
67
68 dnl 'make compare' can be significantly faster, if cmp itself can
69 dnl skip bytes instead of using tail.  The test being performed is
70 dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
71 dnl but we need to sink errors and handle broken shells.  We also test
72 dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
73 dnl accepted by cmp on some systems.
74 AC_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 ])
97 make_compare_target=$gcc_cv_prog_cmp_skip
98 AC_SUBST(make_compare_target)
99 ])
100
101 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
102 AC_DEFUN([gcc_AC_PROG_LN_S],
103 [AC_MSG_CHECKING(whether ln -s works)
104 AC_CACHE_VAL(gcc_cv_prog_LN_S,
105 [rm -f conftestdata_t
106 echo >conftestdata_f
107 if ln -s conftestdata_f conftestdata_t 2>/dev/null
108 then
109   gcc_cv_prog_LN_S="ln -s"
110 else
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
122 fi
123 rm -f conftestdata_f conftestdata_t
124 ])dnl
125 LN_S="$gcc_cv_prog_LN_S"
126 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
127   AC_MSG_RESULT(yes)
128 else
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
134 fi
135 AC_SUBST(LN_S)dnl
136 ])
137
138 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
139 dnl of the usual 2.
140 AC_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)])
154 if 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.])
156 fi
157 ])
158
159 AC_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.
171 AC_MSG_CHECKING(for a BSD compatible install)
172 if test -z "$INSTALL"; then
173 AC_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
208 fi
209 dnl We do special magic for INSTALL instead of AC_SUBST, to get
210 dnl relative paths right.
211 AC_MSG_RESULT($INSTALL)
212 AC_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.
216 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
217 AC_SUBST(INSTALL_PROGRAM)dnl
218
219 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
220 AC_SUBST(INSTALL_DATA)dnl
221 ])
222
223 # mmap(2) blacklisting.  Some platforms provide the mmap library routine
224 # but don't support all of the features we need from it.
225 AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
226 [
227 AC_CHECK_HEADER([sys/mman.h],
228                 [gcc_header_sys_mman_h=yes], [gcc_header_sys_mman_h=no])
229 AC_CHECK_FUNC([mmap], [gcc_func_mmap=yes], [gcc_func_mmap=no])
230 if test "$gcc_header_sys_mman_h" != yes \
231  || test "$gcc_func_mmap" != yes; then
232    gcc_cv_func_mmap_file=no
233    gcc_cv_func_mmap_dev_zero=no
234    gcc_cv_func_mmap_anon=no
235 else
236    AC_CACHE_CHECK([whether read-only mmap of a plain file works], 
237   gcc_cv_func_mmap_file,
238   [# Add a system to this blacklist if 
239    # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
240    # memory area containing the same data that you'd get if you applied
241    # read() to the same fd.  The only system known to have a problem here
242    # is VMS, where text files have record structure.
243    case "$host_os" in
244      vms* | ultrix*) 
245         gcc_cv_func_mmap_file=no ;;
246      *)
247         gcc_cv_func_mmap_file=yes;;
248    esac])
249    AC_CACHE_CHECK([whether mmap from /dev/zero works],
250   gcc_cv_func_mmap_dev_zero,
251   [# Add a system to this blacklist if it has mmap() but /dev/zero
252    # does not exist, or if mmapping /dev/zero does not give anonymous
253    # zeroed pages with both the following properties:
254    # 1. If you map N consecutive pages in with one call, and then
255    #    unmap any subset of those pages, the pages that were not
256    #    explicitly unmapped remain accessible.
257    # 2. If you map two adjacent blocks of memory and then unmap them
258    #    both at once, they must both go away.
259    # Systems known to be in this category are Windows (all variants),
260    # VMS, and Darwin.
261    case "$host_os" in
262      vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
263         gcc_cv_func_mmap_dev_zero=no ;;
264      *)
265         gcc_cv_func_mmap_dev_zero=yes;;
266    esac])
267
268    # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
269    AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
270     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
271 [#include <sys/types.h>
272 #include <sys/mman.h>
273 #include <unistd.h>
274
275 #ifndef MAP_ANONYMOUS
276 #define MAP_ANONYMOUS MAP_ANON
277 #endif
278 ],
279 [int n = MAP_ANONYMOUS;])],
280     gcc_cv_decl_map_anon=yes,
281     gcc_cv_decl_map_anon=no)])
282
283    if test $gcc_cv_decl_map_anon = no; then
284      gcc_cv_func_mmap_anon=no
285    else
286      AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
287      gcc_cv_func_mmap_anon,
288   [# Add a system to this blacklist if it has mmap() and MAP_ANON or
289    # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
290    # doesn't give anonymous zeroed pages with the same properties listed
291    # above for use of /dev/zero.
292    # Systems known to be in this category are Windows, VMS, and SCO Unix.
293    case "$host_os" in
294      vms* | cygwin* | pe | mingw* | sco* | udk* )
295         gcc_cv_func_mmap_anon=no ;;
296      *)
297         gcc_cv_func_mmap_anon=yes;;
298    esac])
299    fi
300 fi
301
302 if test $gcc_cv_func_mmap_file = yes; then
303   AC_DEFINE(HAVE_MMAP_FILE, 1,
304             [Define if read-only mmap of a plain file works.])
305 fi
306 if test $gcc_cv_func_mmap_dev_zero = yes; then
307   AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
308             [Define if mmap of /dev/zero works.])
309 fi
310 if test $gcc_cv_func_mmap_anon = yes; then
311   AC_DEFINE(HAVE_MMAP_ANON, 1,
312             [Define if mmap with MAP_ANON(YMOUS) works.])
313 fi
314 ])
315
316 dnl Determine if enumerated bitfields are unsigned.   ISO C says they can 
317 dnl be either signed or unsigned.
318 dnl
319 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
320 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
321 [AC_RUN_IFELSE([AC_LANG_SOURCE([#include <stdlib.h>
322 enum t { BLAH = 128 } ;
323 struct s_t { enum t member : 8; } s ;
324 int main(void)
325 {            
326         s.member = BLAH;
327         if (s.member < 0) exit(1);
328         exit(0);
329
330 }])], gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
331 if test $gcc_cv_enum_bf_unsigned = yes; then
332   AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
333     [Define if enumerated bitfields are treated as unsigned values.])
334 fi])
335
336 dnl Probe number of bits in a byte.
337 dnl Note C89 requires CHAR_BIT >= 8.
338 dnl
339 AC_DEFUN([gcc_AC_C_CHAR_BIT],
340 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
341 [AC_EGREP_CPP(found,
342 [#ifdef HAVE_LIMITS_H
343 #include <limits.h>
344 #endif
345 #ifdef CHAR_BIT
346 found
347 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
348 ])
349 if test $gcc_cv_decl_char_bit = no; then
350   AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
351 [i=8
352  gcc_cv_c_nbby=
353  while test $i -lt 65; do
354    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,
355      [switch(0) {
356   case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
357   case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
358   ; }])],
359      [gcc_cv_c_nbby=$i; break])
360    i=`expr $i + 1`
361  done
362  test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
363 ])
364 if test $gcc_cv_c_nbby = failed; then
365   AC_MSG_ERROR(cannot determine number of bits in a byte)
366 else
367   AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
368   [Define as the number of bits in a byte, if `limits.h' doesn't.])
369 fi
370 fi])
371
372 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
373 [AC_ARG_ENABLE(initfini-array,
374         [  --enable-initfini-array      use .init_array/.fini_array sections],
375         [], [
376 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
377                  gcc_cv_initfini_array, [dnl
378   if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
379     AC_RUN_IFELSE([AC_LANG_SOURCE([
380 #ifndef __ELF__
381 #error Not an ELF OS
382 #endif
383 #ifdef __ia64__
384 /* We turn on .preinit_array/.init_array/.fini_array support for ia64
385    if it can be used.  */
386 static int x = -1;
387 int main (void) { return x; }
388 int foo (void) { x = 0; }
389 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
390 #else
391 extern void abort ();
392 static int count;
393
394 static void
395 init1005 ()
396 {
397   if (count != 0)
398     abort ();
399   count = 1005;
400 }
401 void (*const init_array1005[]) ()
402   __attribute__ ((section (".init_array.01005"), aligned (sizeof (void *))))
403   = { init1005 };
404 static void
405 fini1005 ()
406 {
407   if (count != 1005)
408     abort ();
409 }
410 void (*const fini_array1005[]) ()
411   __attribute__ ((section (".fini_array.01005"), aligned (sizeof (void *))))
412   = { fini1005 };
413
414 static void
415 ctor1007 ()
416 {
417   if (count != 1005)
418     abort ();
419   count = 1007;
420 }
421 void (*const ctors1007[]) ()
422   __attribute__ ((section (".ctors.64528"), aligned (sizeof (void *))))
423   = { ctor1007 };
424 static void
425 dtor1007 ()
426 {
427   if (count != 1007)
428     abort ();
429   count = 1005;
430 }
431 void (*const dtors1007[]) ()
432   __attribute__ ((section (".dtors.64528"), aligned (sizeof (void *))))
433   = { dtor1007 };
434
435 static void
436 init65530 ()
437 {
438   if (count != 1007)
439     abort ();
440   count = 65530;
441 }
442 void (*const init_array65530[]) ()
443   __attribute__ ((section (".init_array.65530"), aligned (sizeof (void *))))
444   = { init65530 };
445 static void
446 fini65530 ()
447 {
448   if (count != 65530)
449     abort ();
450   count = 1007;
451 }
452 void (*const fini_array65530[]) ()
453   __attribute__ ((section (".fini_array.65530"), aligned (sizeof (void *))))
454   = { fini65530 };
455
456 static void
457 ctor65535 ()
458 {
459   if (count != 65530)
460     abort ();
461   count = 65535;
462 }
463 void (*const ctors65535[]) ()
464   __attribute__ ((section (".ctors"), aligned (sizeof (void *))))
465   = { ctor65535 };
466 static void
467 dtor65535 ()
468 {
469   if (count != 65535)
470     abort ();
471   count = 65530;
472 }
473 void (*const dtors65535[]) ()
474   __attribute__ ((section (".dtors"), aligned (sizeof (void *))))
475   = { dtor65535 };
476
477 int
478 main ()
479 {
480   return 0;
481 }
482 #endif
483 ])],
484              [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
485              [gcc_cv_initfini_array=no])
486    else
487      AC_MSG_CHECKING(cross compile... guessing)
488      gcc_cv_initfini_array=no
489    fi])
490   enable_initfini_array=$gcc_cv_initfini_array
491 ])
492 if test $enable_initfini_array = yes; then
493   AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
494     [Define .init_array/.fini_array sections are available and working.])
495 fi])
496
497 dnl # _gcc_COMPUTE_GAS_VERSION
498 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
499 dnl #
500 dnl # WARNING:
501 dnl # gcc_cv_as_gas_srcdir must be defined before this.
502 dnl # This gross requirement will go away eventually.
503 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
504 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
505 for f in $gcc_cv_as_bfd_srcdir/configure \
506          $gcc_cv_as_gas_srcdir/configure \
507          $gcc_cv_as_gas_srcdir/configure.in \
508          $gcc_cv_as_gas_srcdir/Makefile.in ; do
509   gcc_cv_gas_version=`sed -n -e 's/^[[  ]]*\(VERSION=[[0-9]]*\.[[0-9]]*.*\)/\1/p' < $f`
510   if test x$gcc_cv_gas_version != x; then
511     break
512   fi
513 done
514 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
515 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
516 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
517 case $gcc_cv_gas_patch_version in
518   "") gcc_cv_gas_patch_version="0" ;;
519 esac
520 gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
521                             + $gcc_cv_gas_minor_version \) \* 1000 \
522                             + $gcc_cv_gas_patch_version`
523 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
524
525 dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
526 dnl #                     [command_if_true = :], [command_if_false = :])
527 dnl # Check to see if the version of GAS is greater than or
528 dnl # equal to the specified version.
529 dnl #
530 dnl # The first ifelse() shortens the shell code if the patchlevel
531 dnl # is unimportant (the usual case).  The others handle missing
532 dnl # commands.  Note that the tests are structured so that the most
533 dnl # common version number cases are tested first.
534 AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
535 [ifelse([$1], elf,
536  [if test $in_tree_gas_is_elf = yes \
537   &&],
538  [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4`
539   then dnl
540 ifelse([$5],,:,[$5])[]dnl
541 ifelse([$6],,,[
542   else $6])
543 fi])
544
545 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
546 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
547 ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
548                   [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
549
550 dnl # gcc_GAS_FLAGS
551 dnl # Used by gcc_GAS_CHECK_FEATURE 
552 dnl #
553 AC_DEFUN([gcc_GAS_FLAGS],
554 [AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags,
555 [ case "$target" in
556   i[[34567]]86-*-linux*)
557     dnl Always pass --32 to ia32 Linux assembler.
558     gcc_cv_as_flags="--32"
559     ;;
560   powerpc*-*-darwin*)
561     dnl Always pass -arch ppc to assembler.
562     gcc_cv_as_flags="-arch ppc"
563     ;;
564   *)
565     gcc_cv_as_flags=" "
566     ;;
567   esac])
568 ])
569
570 dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
571 dnl [extra switches to as], [assembler input],
572 dnl [extra testing logic], [command if feature available])
573 dnl
574 dnl Checks for an assembler feature.  If we are building an in-tree
575 dnl gas, the feature is available if the associated assembler version
576 dnl is greater than or equal to major.minor.patchlevel.  If not, then
577 dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
578 dnl if assembly succeeds.  If EXTRA TESTING LOGIC is not the empty string,
579 dnl then it is run instead of simply setting CV to "yes" - it is responsible
580 dnl for doing so, if appropriate.
581 AC_DEFUN([gcc_GAS_CHECK_FEATURE],
582 [AC_REQUIRE([gcc_GAS_FLAGS])dnl
583 AC_CACHE_CHECK([assembler for $1], [$2],
584  [[$2]=no
585   ifelse([$3],,,[dnl
586   if test $in_tree_gas = yes; then
587     gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
588   el])if test x$gcc_cv_as != x; then
589     AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s
590     if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
591     then
592         ifelse([$6],, [$2]=yes, [$6])
593     else
594       echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
595       cat conftest.s >&AS_MESSAGE_LOG_FD
596     fi
597     rm -f conftest.o conftest.s
598   fi])
599 ifelse([$7],,,[dnl
600 if test $[$2] = yes; then
601   $7
602 fi])])
603
604 dnl GCC_TARGET_TEMPLATE(KEY)
605 dnl ------------------------
606 dnl Define KEY as a valid configure key on the target machine.
607
608 m4_define([GCC_TARGET_TEMPLATE],
609 [m4_define([GCC_TARGET_TEMPLATE($1)],[])])
610
611 dnl AH_TEMPLATE(KEY, DESCRIPTION)
612 dnl -----------------------------
613 dnl Issue an autoheader template for KEY, i.e., a comment composed of
614 dnl DESCRIPTION (properly wrapped), and then #undef KEY.  Redefinition
615 dnl of the macro in autoheader.m4, to support definition of only a few
616 dnl keys while compiling target libraries.
617
618 m4_define([AH_TEMPLATE],
619 [AH_VERBATIM([$1],m4_text_wrap([$2 */], [   ], [/* ])
620 m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[#ifndef USED_FOR_TARGET
621 ])[#undef $1]m4_ifdef([GCC_TARGET_TEMPLATE($1)],[],[
622 #endif
623 ]))])
624
625 dnl Make sure that build_exeext is looked for
626 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
627 ac_executable_extensions="$build_exeext"])
628