OSDN Git Service

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