OSDN Git Service

2004-09-27 Kelley Cook <kcook@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / aclocal.m4
1 m4_include([../config/accross.m4])
2 m4_include([../config/acx.m4])
3 m4_include([../config/gettext-sister.m4])
4 m4_include([../config/gcc-lib-path.m4])
5 m4_include([../config/iconv.m4])
6 m4_include([../config/lcmessage.m4])
7 m4_include([../config/lib-ld.m4])
8 m4_include([../config/lib-link.m4])
9 m4_include([../config/lib-prefix.m4])
10 m4_include([../config/progtest.m4])
11
12 dnl See whether we need a declaration for a function.
13 dnl The result is highly dependent on the INCLUDES passed in, so make sure
14 dnl to use a different cache variable name in this macro if it is invoked
15 dnl in a different context somewhere else.
16 dnl gcc_AC_CHECK_DECL(SYMBOL,
17 dnl     [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]])
18 AC_DEFUN([gcc_AC_CHECK_DECL],
19 [AC_MSG_CHECKING([whether $1 is declared])
20 AC_CACHE_VAL(gcc_cv_have_decl_$1,
21 [AC_TRY_COMPILE([$4],
22 [#ifndef $1
23 char *(*pfn) = (char *(*)) $1 ;
24 #endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")])
25 if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then
26   AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2])
27 else
28   AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3])
29 fi
30 ])dnl
31
32 dnl Check multiple functions to see whether each needs a declaration.
33 dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate.
34 dnl gcc_AC_CHECK_DECLS(SYMBOLS,
35 dnl     [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]])
36 AC_DEFUN([gcc_AC_CHECK_DECLS],
37 [AC_FOREACH([gcc_AC_Func], [$1],
38   [AH_TEMPLATE(AS_TR_CPP(HAVE_DECL_[]gcc_AC_Func),
39   [Define to 1 if we found a declaration for ']gcc_AC_Func[', otherwise
40    define to 0.])])dnl
41 for ac_func in $1
42 do
43   ac_tr_decl=AS_TR_CPP([HAVE_DECL_$ac_func])
44 gcc_AC_CHECK_DECL($ac_func,
45   [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2],
46   [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3],
47 dnl It is possible that the include files passed in here are local headers
48 dnl which supply a backup declaration for the relevant prototype based on
49 dnl the definition of (or lack of) the HAVE_DECL_ macro.  If so, this test
50 dnl will always return success.  E.g. see libiberty.h's handling of
51 dnl `basename'.  To avoid this, we define the relevant HAVE_DECL_ macro to
52 dnl 1 so that any local headers used do not provide their own prototype
53 dnl during this test.
54 #undef $ac_tr_decl
55 #define $ac_tr_decl 1
56   $4
57 )
58 done
59 ])
60
61 dnl 'make compare' can be significantly faster, if cmp itself can
62 dnl skip bytes instead of using tail.  The test being performed is
63 dnl "if cmp --ignore-initial=2 t1 t2 && ! cmp --ignore-initial=1 t1 t2"
64 dnl but we need to sink errors and handle broken shells.  We also test
65 dnl for the parameter format "cmp file1 file2 skip1 skip2" which is
66 dnl accepted by cmp on some systems.
67 AC_DEFUN([gcc_AC_PROG_CMP_IGNORE_INITIAL],
68 [AC_CACHE_CHECK([for cmp's capabilities], gcc_cv_prog_cmp_skip,
69 [ echo abfoo >t1
70   echo cdfoo >t2
71   gcc_cv_prog_cmp_skip=slowcompare
72   if cmp --ignore-initial=2 t1 t2 > /dev/null 2>&1; then
73     if cmp --ignore-initial=1 t1 t2 > /dev/null 2>&1; then
74       :
75     else
76       gcc_cv_prog_cmp_skip=gnucompare
77     fi
78   fi
79   if test $gcc_cv_prog_cmp_skip = slowcompare ; then
80     if cmp t1 t2 2 2 > /dev/null 2>&1; then
81       if cmp t1 t2 1 1 > /dev/null 2>&1; then
82         :
83       else
84         gcc_cv_prog_cmp_skip=fastcompare
85       fi
86     fi
87   fi
88   rm t1 t2
89 ])
90 make_compare_target=$gcc_cv_prog_cmp_skip
91 AC_SUBST(make_compare_target)
92 ])
93
94 dnl See if the printf functions in libc support %p in format strings.
95 AC_DEFUN([gcc_AC_FUNC_PRINTF_PTR],
96 [AC_CACHE_CHECK(whether the printf functions support %p,
97   gcc_cv_func_printf_ptr,
98 [AC_TRY_RUN([#include <stdio.h>
99
100 int main()
101 {
102   char buf[64];
103   char *p = buf, *q = NULL;
104   sprintf(buf, "%p", p);
105   sscanf(buf, "%p", &q);
106   return (p != q);
107 }], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
108         gcc_cv_func_printf_ptr=no)
109 rm -f core core.* *.core])
110 if test $gcc_cv_func_printf_ptr = yes ; then
111   AC_DEFINE(HAVE_PRINTF_PTR, 1, [Define if printf supports "%p".])
112 fi
113 ])
114
115 dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
116 AC_DEFUN([gcc_AC_PROG_LN_S],
117 [AC_MSG_CHECKING(whether ln -s works)
118 AC_CACHE_VAL(gcc_cv_prog_LN_S,
119 [rm -f conftestdata_t
120 echo >conftestdata_f
121 if ln -s conftestdata_f conftestdata_t 2>/dev/null
122 then
123   gcc_cv_prog_LN_S="ln -s"
124 else
125   if ln conftestdata_f conftestdata_t 2>/dev/null
126   then
127     gcc_cv_prog_LN_S=ln
128   else
129     gcc_cv_prog_LN_S=cp
130   fi
131 fi
132 rm -f conftestdata_f conftestdata_t
133 ])dnl
134 LN_S="$gcc_cv_prog_LN_S"
135 if test "$gcc_cv_prog_LN_S" = "ln -s"; then
136   AC_MSG_RESULT(yes)
137 else
138   if test "$gcc_cv_prog_LN_S" = "ln"; then
139     AC_MSG_RESULT([no, using ln])
140   else
141     AC_MSG_RESULT([no, and neither does ln, so using cp])
142   fi
143 fi
144 AC_SUBST(LN_S)dnl
145 ])
146
147 dnl Define MKDIR_TAKES_ONE_ARG if mkdir accepts only one argument instead
148 dnl of the usual 2.
149 AC_DEFUN([gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG],
150 [AC_CACHE_CHECK([if mkdir takes one argument], gcc_cv_mkdir_takes_one_arg,
151 [AC_TRY_COMPILE([
152 #include <sys/types.h>
153 #ifdef HAVE_SYS_STAT_H
154 # include <sys/stat.h>
155 #endif
156 #ifdef HAVE_UNISTD_H
157 # include <unistd.h>
158 #endif
159 #ifdef HAVE_DIRECT_H
160 # include <direct.h>
161 #endif], [mkdir ("foo", 0);], 
162         gcc_cv_mkdir_takes_one_arg=no, gcc_cv_mkdir_takes_one_arg=yes)])
163 if test $gcc_cv_mkdir_takes_one_arg = yes ; then
164   AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single argument.])
165 fi
166 ])
167
168 AC_DEFUN([gcc_AC_PROG_INSTALL],
169 [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
170 # Find a good install program.  We prefer a C program (faster),
171 # so one script is as good as another.  But avoid the broken or
172 # incompatible versions:
173 # SysV /etc/install, /usr/sbin/install
174 # SunOS /usr/etc/install
175 # IRIX /sbin/install
176 # AIX /bin/install
177 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
178 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
179 # ./install, which can be erroneously created by make from ./install.sh.
180 AC_MSG_CHECKING(for a BSD compatible install)
181 if test -z "$INSTALL"; then
182 AC_CACHE_VAL(ac_cv_path_install,
183 [  IFS="${IFS=  }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
184   for ac_dir in $PATH; do
185     # Account for people who put trailing slashes in PATH elements.
186     case "$ac_dir/" in
187     /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
188     *)
189       # OSF1 and SCO ODT 3.0 have their own names for install.
190       for ac_prog in ginstall scoinst install; do
191         if test -f $ac_dir/$ac_prog; then
192           if test $ac_prog = install &&
193             grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
194             # AIX install.  It has an incompatible calling convention.
195             # OSF/1 installbsd also uses dspmsg, but is usable.
196             :
197           else
198             ac_cv_path_install="$ac_dir/$ac_prog -c"
199             break 2
200           fi
201         fi
202       done
203       ;;
204     esac
205   done
206   IFS="$ac_save_IFS"
207 ])dnl
208   if test "${ac_cv_path_install+set}" = set; then
209     INSTALL="$ac_cv_path_install"
210   else
211     # As a last resort, use the slow shell script.  We don't cache a
212     # path for INSTALL within a source directory, because that will
213     # break other packages using the cache if that directory is
214     # removed, or if the path is relative.
215     INSTALL="$ac_install_sh"
216   fi
217 fi
218 dnl We do special magic for INSTALL instead of AC_SUBST, to get
219 dnl relative paths right.
220 AC_MSG_RESULT($INSTALL)
221 AC_SUBST(INSTALL)dnl
222
223 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
224 # It thinks the first close brace ends the variable substitution.
225 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
226 AC_SUBST(INSTALL_PROGRAM)dnl
227
228 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
229 AC_SUBST(INSTALL_DATA)dnl
230 ])
231
232 # mmap(2) blacklisting.  Some platforms provide the mmap library routine
233 # but don't support all of the features we need from it.
234 AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
235 [
236 AC_CHECK_HEADER([sys/mman.h],
237                 [gcc_header_sys_mman_h=yes], [gcc_header_sys_mman_h=no])
238 AC_CHECK_FUNC([mmap], [gcc_func_mmap=yes], [gcc_func_mmap=no])
239 if test "$gcc_header_sys_mman_h" != yes \
240  || test "$gcc_func_mmap" != yes; then
241    gcc_cv_func_mmap_file=no
242    gcc_cv_func_mmap_dev_zero=no
243    gcc_cv_func_mmap_anon=no
244 else
245    AC_CACHE_CHECK([whether read-only mmap of a plain file works], 
246   gcc_cv_func_mmap_file,
247   [# Add a system to this blacklist if 
248    # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
249    # memory area containing the same data that you'd get if you applied
250    # read() to the same fd.  The only system known to have a problem here
251    # is VMS, where text files have record structure.
252    case "$host_os" in
253      vms* | ultrix*) 
254         gcc_cv_func_mmap_file=no ;;
255      *)
256         gcc_cv_func_mmap_file=yes;;
257    esac])
258    AC_CACHE_CHECK([whether mmap from /dev/zero works],
259   gcc_cv_func_mmap_dev_zero,
260   [# Add a system to this blacklist if it has mmap() but /dev/zero
261    # does not exist, or if mmapping /dev/zero does not give anonymous
262    # zeroed pages with both the following properties:
263    # 1. If you map N consecutive pages in with one call, and then
264    #    unmap any subset of those pages, the pages that were not
265    #    explicitly unmapped remain accessible.
266    # 2. If you map two adjacent blocks of memory and then unmap them
267    #    both at once, they must both go away.
268    # Systems known to be in this category are Windows (all variants),
269    # VMS, and Darwin.
270    case "$host_os" in
271      vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
272         gcc_cv_func_mmap_dev_zero=no ;;
273      *)
274         gcc_cv_func_mmap_dev_zero=yes;;
275    esac])
276
277    # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
278    AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
279     [AC_TRY_COMPILE(
280 [#include <sys/types.h>
281 #include <sys/mman.h>
282 #include <unistd.h>
283
284 #ifndef MAP_ANONYMOUS
285 #define MAP_ANONYMOUS MAP_ANON
286 #endif
287 ],
288 [int n = MAP_ANONYMOUS;],
289     gcc_cv_decl_map_anon=yes,
290     gcc_cv_decl_map_anon=no)])
291
292    if test $gcc_cv_decl_map_anon = no; then
293      gcc_cv_func_mmap_anon=no
294    else
295      AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
296      gcc_cv_func_mmap_anon,
297   [# Add a system to this blacklist if it has mmap() and MAP_ANON or
298    # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
299    # doesn't give anonymous zeroed pages with the same properties listed
300    # above for use of /dev/zero.
301    # Systems known to be in this category are Windows, VMS, and SCO Unix.
302    case "$host_os" in
303      vms* | cygwin* | pe | mingw* | sco* | udk* )
304         gcc_cv_func_mmap_anon=no ;;
305      *)
306         gcc_cv_func_mmap_anon=yes;;
307    esac])
308    fi
309 fi
310
311 if test $gcc_cv_func_mmap_file = yes; then
312   AC_DEFINE(HAVE_MMAP_FILE, 1,
313             [Define if read-only mmap of a plain file works.])
314 fi
315 if test $gcc_cv_func_mmap_dev_zero = yes; then
316   AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
317             [Define if mmap of /dev/zero works.])
318 fi
319 if test $gcc_cv_func_mmap_anon = yes; then
320   AC_DEFINE(HAVE_MMAP_ANON, 1,
321             [Define if mmap with MAP_ANON(YMOUS) works.])
322 fi
323 ])
324
325 dnl Locate a program and check that its version is acceptable.
326 dnl AC_PROG_CHECK_VER(var, name, version-switch,
327 dnl                  version-extract-regexp, version-glob)
328 AC_DEFUN([gcc_AC_CHECK_PROG_VER],
329 [AC_CHECK_PROG([$1], [$2], [$2])
330 if test -n "[$]$1"; then
331   # Found it, now check the version.
332   AC_CACHE_CHECK(for modern $2, gcc_cv_prog_$2_modern,
333 [changequote(<<,>>)dnl
334   ac_prog_version=`<<$>>$1 $3 2>&1 |
335                    sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'`
336 changequote([,])dnl
337   echo "configure:__oline__: version of $2 is $ac_prog_version" >&AC_FD_CC
338 changequote(<<,>>)dnl
339   case $ac_prog_version in
340     '')     gcc_cv_prog_$2_modern=no;;
341     <<$5>>)
342             gcc_cv_prog_$2_modern=yes;;
343     *)      gcc_cv_prog_$2_modern=no;;
344   esac
345 changequote([,])dnl
346 ])
347 else
348   gcc_cv_prog_$2_modern=no
349 fi
350 ])
351
352 dnl Determine if enumerated bitfields are unsigned.   ISO C says they can 
353 dnl be either signed or unsigned.
354 dnl
355 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
356 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
357 [AC_TRY_RUN(#include <stdlib.h>
358 enum t { BLAH = 128 } ;
359 struct s_t { enum t member : 8; } s ;
360 int main(void)
361 {            
362         s.member = BLAH;
363         if (s.member < 0) exit(1);
364         exit(0);
365
366 }, gcc_cv_enum_bf_unsigned=yes, gcc_cv_enum_bf_unsigned=no, gcc_cv_enum_bf_unsigned=yes)])
367 if test $gcc_cv_enum_bf_unsigned = yes; then
368   AC_DEFINE(ENUM_BITFIELDS_ARE_UNSIGNED, 1,
369     [Define if enumerated bitfields are treated as unsigned values.])
370 fi])
371
372 dnl Probe number of bits in a byte.
373 dnl Note C89 requires CHAR_BIT >= 8.
374 dnl
375 AC_DEFUN([gcc_AC_C_CHAR_BIT],
376 [AC_CACHE_CHECK(for CHAR_BIT, gcc_cv_decl_char_bit,
377 [AC_EGREP_CPP(found,
378 [#ifdef HAVE_LIMITS_H
379 #include <limits.h>
380 #endif
381 #ifdef CHAR_BIT
382 found
383 #endif], gcc_cv_decl_char_bit=yes, gcc_cv_decl_char_bit=no)
384 ])
385 if test $gcc_cv_decl_char_bit = no; then
386   AC_CACHE_CHECK(number of bits in a byte, gcc_cv_c_nbby,
387 [i=8
388  gcc_cv_c_nbby=
389  while test $i -lt 65; do
390    AC_TRY_COMPILE(,
391      [switch(0) {
392   case (unsigned char)((unsigned long)1 << $i) == ((unsigned long)1 << $i):
393   case (unsigned char)((unsigned long)1<<($i-1)) == ((unsigned long)1<<($i-1)):
394   ; }], 
395      [gcc_cv_c_nbby=$i; break])
396    i=`expr $i + 1`
397  done
398  test -z "$gcc_cv_c_nbby" && gcc_cv_c_nbby=failed
399 ])
400 if test $gcc_cv_c_nbby = failed; then
401   AC_MSG_ERROR(cannot determine number of bits in a byte)
402 else
403   AC_DEFINE_UNQUOTED(CHAR_BIT, $gcc_cv_c_nbby,
404   [Define as the number of bits in a byte, if \`limits.h' doesn't.])
405 fi
406 fi])
407
408 dnl Checking for long long.
409 dnl By Caolan McNamara <caolan@skynet.ie>
410 dnl Added check for __int64, Zack Weinberg <zackw@stanford.edu>
411 dnl
412 AC_DEFUN([gcc_AC_C_LONG_LONG],
413 [AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
414   [AC_TRY_COMPILE(,[long long int i;],
415          ac_cv_c_long_long=yes,
416          ac_cv_c_long_long=no)])
417   if test $ac_cv_c_long_long = yes; then
418     AC_DEFINE(HAVE_LONG_LONG, 1,
419       [Define if your compiler supports the \`long long' type.])
420   fi
421 AC_CACHE_CHECK(for __int64, ac_cv_c___int64,
422   [AC_TRY_COMPILE(,[__int64 i;],
423         ac_cv_c___int64=yes,
424         ac_cv_c___int64=no)])
425   if test $ac_cv_c___int64 = yes; then
426     AC_DEFINE(HAVE___INT64, 1,
427       [Define if your compiler supports the \`__int64' type.])
428   fi
429 ])
430
431 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
432 [AC_ARG_ENABLE(initfini-array,
433         [  --enable-initfini-array      use .init_array/.fini_array sections],
434         [], [
435 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
436                  gcc_cv_initfini_array, [dnl
437   AC_TRY_RUN([
438 static int x = -1;
439 int main (void) { return x; }
440 int foo (void) { x = 0; }
441 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
442              [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
443              [gcc_cv_initfini_array=no])])
444   enable_initfini_array=$gcc_cv_initfini_array
445 ])
446 if test $enable_initfini_array = yes; then
447   AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
448     [Define .init_array/.fini_array sections are available and working.])
449 fi])
450
451 dnl # _gcc_COMPUTE_GAS_VERSION
452 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
453 dnl #
454 dnl # WARNING:
455 dnl # gcc_cv_as_gas_srcdir must be defined before this.
456 dnl # This gross requirement will go away eventually.
457 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
458 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
459 for f in $gcc_cv_as_bfd_srcdir/configure \
460          $gcc_cv_as_gas_srcdir/configure \
461          $gcc_cv_as_gas_srcdir/configure.in \
462          $gcc_cv_as_gas_srcdir/Makefile.in ; do
463   gcc_cv_gas_version=`sed -n -e 's/^[[  ]]*\(VERSION=[[0-9]]*\.[[0-9]]*.*\)/\1/p' < $f`
464   if test x$gcc_cv_gas_version != x; then
465     break
466   fi
467 done
468 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
469 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
470 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
471 case $gcc_cv_gas_patch_version in
472   "") gcc_cv_gas_patch_version="0" ;;
473 esac
474 gcc_cv_gas_vers=`expr \( \( $gcc_cv_gas_major_version \* 1000 \) \
475                             + $gcc_cv_gas_minor_version \) \* 1000 \
476                             + $gcc_cv_gas_patch_version`
477 ]) []dnl # _gcc_COMPUTE_GAS_VERSION
478
479 dnl # gcc_GAS_VERSION_GTE_IFELSE([elf,] major, minor, patchlevel,
480 dnl #                     [command_if_true = :], [command_if_false = :])
481 dnl # Check to see if the version of GAS is greater than or
482 dnl # equal to the specified version.
483 dnl #
484 dnl # The first ifelse() shortens the shell code if the patchlevel
485 dnl # is unimportant (the usual case).  The others handle missing
486 dnl # commands.  Note that the tests are structured so that the most
487 dnl # common version number cases are tested first.
488 AC_DEFUN([_gcc_GAS_VERSION_GTE_IFELSE],
489 [ifelse([$1], elf,
490  [if test $in_tree_gas_is_elf = yes \
491   &&],
492  [if]) test $gcc_cv_gas_vers -ge `expr \( \( $2 \* 1000 \) + $3 \) \* 1000 + $4`
493   then dnl
494 ifelse([$5],,:,[$5])[]dnl
495 ifelse([$6],,,[
496   else $6])
497 fi])
498
499 AC_DEFUN([gcc_GAS_VERSION_GTE_IFELSE],
500 [AC_REQUIRE([_gcc_COMPUTE_GAS_VERSION])dnl
501 ifelse([$1], elf, [_gcc_GAS_VERSION_GTE_IFELSE($@)],
502                   [_gcc_GAS_VERSION_GTE_IFELSE(,$@)])])
503
504 dnl gcc_GAS_CHECK_FEATURE(description, cv, [[elf,]major,minor,patchlevel],
505 dnl [extra switches to as], [assembler input],
506 dnl [extra testing logic], [command if feature available])
507 dnl
508 dnl Checks for an assembler feature.  If we are building an in-tree
509 dnl gas, the feature is available if the associated assembler version
510 dnl is greater than or equal to major.minor.patchlevel.  If not, then
511 dnl ASSEMBLER INPUT is fed to the assembler and the feature is available
512 dnl if assembly succeeds.  If EXTRA TESTING LOGIC is not the empty string,
513 dnl then it is run instead of simply setting CV to "yes" - it is responsible
514 dnl for doing so, if appropriate.
515 AC_DEFUN([gcc_GAS_CHECK_FEATURE],
516 [AC_CACHE_CHECK([assembler for $1], [$2],
517  [[$2]=no
518   ifelse([$3],,,[dnl
519   if test $in_tree_gas = yes; then
520     gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
521   el])if test x$gcc_cv_as != x; then
522     echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s
523     if AC_TRY_COMMAND([$gcc_cv_as $4 -o conftest.o conftest.s >&AC_FD_CC])
524     then
525         ifelse([$6],, [$2]=yes, [$6])
526     else
527       echo "configure: failed program was" >&AC_FD_CC
528       cat conftest.s >&AC_FD_CC
529     fi
530     rm -f conftest.o conftest.s
531   fi])
532 ifelse([$7],,,[dnl
533 if test $[$2] = yes; then
534   $7
535 fi])])
536
537 # AM_PROG_CC_C_O
538 # --------------
539 # Like AC_PROG_CC_C_O, but changed for automake.
540
541 # Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
542
543 # This program is free software; you can redistribute it and/or modify
544 # it under the terms of the GNU General Public License as published by
545 # the Free Software Foundation; either version 2, or (at your option)
546 # any later version.
547
548 # This program is distributed in the hope that it will be useful,
549 # but WITHOUT ANY WARRANTY; without even the implied warranty of
550 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
551 # GNU General Public License for more details.
552
553 # You should have received a copy of the GNU General Public License
554 # along with this program; if not, write to the Free Software
555 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
556 # 02111-1307, USA.
557
558 AC_DEFUN([AM_PROG_CC_C_O],
559 [AC_REQUIRE([AC_PROG_CC_C_O])dnl
560 AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
561 # FIXME: we rely on the cache variable name because
562 # there is no other way.
563 set dummy $CC
564 ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
565 if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
566    # Losing compiler, so override with the script.
567    # FIXME: It is wrong to rewrite CC.
568    # But if we don't then we get into trouble of one sort or another.
569    # A longer-term fix would be to have automake use am__CC in this case,
570    # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
571    CC="$am_aux_dir/compile $CC"
572 fi
573 ])
574
575 # AM_AUX_DIR_EXPAND
576
577 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.
578
579 # This program is free software; you can redistribute it and/or modify
580 # it under the terms of the GNU General Public License as published by
581 # the Free Software Foundation; either version 2, or (at your option)
582 # any later version.
583
584 # This program is distributed in the hope that it will be useful,
585 # but WITHOUT ANY WARRANTY; without even the implied warranty of
586 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
587 # GNU General Public License for more details.
588
589 # You should have received a copy of the GNU General Public License
590 # along with this program; if not, write to the Free Software
591 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
592 # 02111-1307, USA.
593
594 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
595 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
596 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
597 #
598 # Of course, Automake must honor this variable whenever it calls a
599 # tool from the auxiliary directory.  The problem is that $srcdir (and
600 # therefore $ac_aux_dir as well) can be either absolute or relative,
601 # depending on how configure is run.  This is pretty annoying, since
602 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
603 # source directory, any form will work fine, but in subdirectories a
604 # relative path needs to be adjusted first.
605 #
606 # $ac_aux_dir/missing
607 #    fails when called from a subdirectory if $ac_aux_dir is relative
608 # $top_srcdir/$ac_aux_dir/missing
609 #    fails if $ac_aux_dir is absolute,
610 #    fails when called from a subdirectory in a VPATH build with
611 #          a relative $ac_aux_dir
612 #
613 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
614 # are both prefixed by $srcdir.  In an in-source build this is usually
615 # harmless because $srcdir is `.', but things will broke when you
616 # start a VPATH build or use an absolute $srcdir.
617 #
618 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
619 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
620 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
621 # and then we would define $MISSING as
622 #   MISSING="\${SHELL} $am_aux_dir/missing"
623 # This will work as long as MISSING is not called from configure, because
624 # unfortunately $(top_srcdir) has no meaning in configure.
625 # However there are other variables, like CC, which are often used in
626 # configure, and could therefore not use this "fixed" $ac_aux_dir.
627 #
628 # Another solution, used here, is to always expand $ac_aux_dir to an
629 # absolute PATH.  The drawback is that using absolute paths prevent a
630 # configured tree to be moved without reconfiguration.
631
632 AC_DEFUN([AM_AUX_DIR_EXPAND],
633 [dnl Rely on autoconf to set up CDPATH properly.
634 AC_PREREQ([2.50])dnl
635 # expand $ac_aux_dir to an absolute path
636 am_aux_dir=`cd $ac_aux_dir && pwd`
637 ])