OSDN Git Service

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