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