comparison gcc/acinclude.m4 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents f6334be47118
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 dnl Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 1 dnl Copyright (C) 2005-2017 Free Software Foundation, Inc.
2 dnl 2 dnl
3 dnl This file is part of GCC. 3 dnl This file is part of GCC.
4 dnl 4 dnl
5 dnl GCC is free software; you can redistribute it and/or modify 5 dnl GCC is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by 6 dnl it under the terms of the GNU General Public License as published by
218 218
219 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' 219 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
220 AC_SUBST(INSTALL_DATA)dnl 220 AC_SUBST(INSTALL_DATA)dnl
221 ]) 221 ])
222 222
223 # mmap(2) blacklisting. Some platforms provide the mmap library routine
224 # but don't support all of the features we need from it.
225 AC_DEFUN([gcc_AC_FUNC_MMAP_BLACKLIST],
226 [
227 AC_CHECK_HEADER([sys/mman.h],
228 [gcc_header_sys_mman_h=yes], [gcc_header_sys_mman_h=no])
229 AC_CHECK_FUNC([mmap], [gcc_func_mmap=yes], [gcc_func_mmap=no])
230 if test "$gcc_header_sys_mman_h" != yes \
231 || test "$gcc_func_mmap" != yes; then
232 gcc_cv_func_mmap_file=no
233 gcc_cv_func_mmap_dev_zero=no
234 gcc_cv_func_mmap_anon=no
235 else
236 AC_CACHE_CHECK([whether read-only mmap of a plain file works],
237 gcc_cv_func_mmap_file,
238 [# Add a system to this blacklist if
239 # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a
240 # memory area containing the same data that you'd get if you applied
241 # read() to the same fd. The only system known to have a problem here
242 # is VMS, where text files have record structure.
243 case "$host_os" in
244 vms* | ultrix*)
245 gcc_cv_func_mmap_file=no ;;
246 *)
247 gcc_cv_func_mmap_file=yes;;
248 esac])
249 AC_CACHE_CHECK([whether mmap from /dev/zero works],
250 gcc_cv_func_mmap_dev_zero,
251 [# Add a system to this blacklist if it has mmap() but /dev/zero
252 # does not exist, or if mmapping /dev/zero does not give anonymous
253 # zeroed pages with both the following properties:
254 # 1. If you map N consecutive pages in with one call, and then
255 # unmap any subset of those pages, the pages that were not
256 # explicitly unmapped remain accessible.
257 # 2. If you map two adjacent blocks of memory and then unmap them
258 # both at once, they must both go away.
259 # Systems known to be in this category are Windows (all variants),
260 # VMS, and Darwin.
261 case "$host_os" in
262 vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00)
263 gcc_cv_func_mmap_dev_zero=no ;;
264 *)
265 gcc_cv_func_mmap_dev_zero=yes;;
266 esac])
267
268 # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for.
269 AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon,
270 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
271 [#include <sys/types.h>
272 #include <sys/mman.h>
273 #include <unistd.h>
274
275 #ifndef MAP_ANONYMOUS
276 #define MAP_ANONYMOUS MAP_ANON
277 #endif
278 ],
279 [int n = MAP_ANONYMOUS;])],
280 gcc_cv_decl_map_anon=yes,
281 gcc_cv_decl_map_anon=no)])
282
283 if test $gcc_cv_decl_map_anon = no; then
284 gcc_cv_func_mmap_anon=no
285 else
286 AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works],
287 gcc_cv_func_mmap_anon,
288 [# Add a system to this blacklist if it has mmap() and MAP_ANON or
289 # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0)
290 # doesn't give anonymous zeroed pages with the same properties listed
291 # above for use of /dev/zero.
292 # Systems known to be in this category are Windows, VMS, and SCO Unix.
293 case "$host_os" in
294 vms* | cygwin* | pe | mingw* | sco* | udk* )
295 gcc_cv_func_mmap_anon=no ;;
296 *)
297 gcc_cv_func_mmap_anon=yes;;
298 esac])
299 fi
300 fi
301
302 if test $gcc_cv_func_mmap_file = yes; then
303 AC_DEFINE(HAVE_MMAP_FILE, 1,
304 [Define if read-only mmap of a plain file works.])
305 fi
306 if test $gcc_cv_func_mmap_dev_zero = yes; then
307 AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1,
308 [Define if mmap of /dev/zero works.])
309 fi
310 if test $gcc_cv_func_mmap_anon = yes; then
311 AC_DEFINE(HAVE_MMAP_ANON, 1,
312 [Define if mmap with MAP_ANON(YMOUS) works.])
313 fi
314 ])
315
316 dnl Determine if enumerated bitfields are unsigned. ISO C says they can 223 dnl Determine if enumerated bitfields are unsigned. ISO C says they can
317 dnl be either signed or unsigned. 224 dnl be either signed or unsigned.
318 dnl 225 dnl
319 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED], 226 AC_DEFUN([gcc_AC_C_ENUM_BF_UNSIGNED],
320 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned, 227 [AC_CACHE_CHECK(for unsigned enumerated bitfields, gcc_cv_enum_bf_unsigned,
368 [Define as the number of bits in a byte, if `limits.h' doesn't.]) 275 [Define as the number of bits in a byte, if `limits.h' doesn't.])
369 fi 276 fi
370 fi]) 277 fi])
371 278
372 AC_DEFUN([gcc_AC_INITFINI_ARRAY], 279 AC_DEFUN([gcc_AC_INITFINI_ARRAY],
373 [AC_ARG_ENABLE(initfini-array, 280 [AC_REQUIRE([gcc_SUN_LD_VERSION])dnl
281 AC_ARG_ENABLE(initfini-array,
374 [ --enable-initfini-array use .init_array/.fini_array sections], 282 [ --enable-initfini-array use .init_array/.fini_array sections],
375 [], [ 283 [], [
376 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support, 284 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
377 gcc_cv_initfini_array, [dnl 285 gcc_cv_initfini_array, [dnl
378 AC_RUN_IFELSE([AC_LANG_SOURCE([ 286 if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
287 case "${target}" in
288 ia64-*)
289 AC_RUN_IFELSE([AC_LANG_SOURCE([
290 #ifndef __ELF__
291 #error Not an ELF OS
292 #endif
293 /* We turn on .preinit_array/.init_array/.fini_array support for ia64
294 if it can be used. */
379 static int x = -1; 295 static int x = -1;
380 int main (void) { return x; } 296 int main (void) { return x; }
381 int foo (void) { x = 0; } 297 int foo (void) { x = 0; }
382 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;])], 298 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
299 ])],
383 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no], 300 [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
384 [gcc_cv_initfini_array=no])]) 301 [gcc_cv_initfini_array=no]);;
302 *)
303 gcc_cv_initfini_array=no
304 if test $in_tree_ld = yes ; then
305 if test "$gcc_cv_gld_major_version" -eq 2 \
306 -a "$gcc_cv_gld_minor_version" -ge 22 \
307 -o "$gcc_cv_gld_major_version" -gt 2 \
308 && test $in_tree_ld_is_elf = yes; then
309 gcc_cv_initfini_array=yes
310 fi
311 elif test x$gcc_cv_as != x -a x$gcc_cv_ld != x -a x$gcc_cv_objdump != x ; then
312 case $target:$gas in
313 *:yes)
314 sh_flags='"a"'
315 sh_type='%progbits'
316 ;;
317 i?86-*-solaris2*:no | x86_64-*-solaris2*:no)
318 sh_flags='"a"'
319 sh_type='@progbits'
320 ;;
321 sparc*-*-solaris2*:no)
322 sh_flags='#alloc'
323 sh_type='#progbits'
324 sh_quote='"'
325 ;;
326 esac
327 case "$target:$gnu_ld" in
328 *:yes)
329 cat > conftest.s <<EOF
330 .section .dtors,$sh_flags,$sh_type
331 .balign 4
332 .byte 'A', 'A', 'A', 'A'
333 .section .ctors,$sh_flags,$sh_type
334 .balign 4
335 .byte 'B', 'B', 'B', 'B'
336 .section .fini_array.65530,$sh_flags,$sh_type
337 .balign 4
338 .byte 'C', 'C', 'C', 'C'
339 .section .init_array.65530,$sh_flags,$sh_type
340 .balign 4
341 .byte 'D', 'D', 'D', 'D'
342 .section .dtors.64528,$sh_flags,$sh_type
343 .balign 4
344 .byte 'E', 'E', 'E', 'E'
345 .section .ctors.64528,$sh_flags,$sh_type
346 .balign 4
347 .byte 'F', 'F', 'F', 'F'
348 .section .fini_array.01005,$sh_flags,$sh_type
349 .balign 4
350 .byte 'G', 'G', 'G', 'G'
351 .section .init_array.01005,$sh_flags,$sh_type
352 .balign 4
353 .byte 'H', 'H', 'H', 'H'
354 .text
355 .globl _start
356 _start:
357 EOF
358 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
359 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
360 && $gcc_cv_objdump -s -j .init_array conftest \
361 | grep HHHHFFFFDDDDBBBB > /dev/null 2>&1 \
362 && $gcc_cv_objdump -s -j .fini_array conftest \
363 | grep GGGGEEEECCCCAAAA > /dev/null 2>&1; then
364 gcc_cv_initfini_array=yes
365 fi
366 ;;
367 *-*-solaris2*:no)
368 # When Solaris ld added constructor priority support, it was
369 # decided to only handle .init_array.N/.fini_array.N since
370 # there was no need for backwards compatibility with
371 # .ctors.N/.dtors.N. .ctors/.dtors remain as separate
372 # sections with correct execution order resp. to
373 # .init_array/.fini_array, while gld merges them into
374 # .init_array/.fini_array.
375 cat > conftest.s <<EOF
376 .section $sh_quote.fini_array.65530$sh_quote,$sh_flags,$sh_type
377 .align 4
378 .byte 'C', 'C', 'C', 'C'
379 .section $sh_quote.init_array.65530$sh_quote,$sh_flags,$sh_type
380 .align 4
381 .byte 'D', 'D', 'D', 'D'
382 .section $sh_quote.fini_array.01005$sh_quote,$sh_flags,$sh_type
383 .align 4
384 .byte 'G', 'G', 'G', 'G'
385 .section $sh_quote.init_array.01005$sh_quote,$sh_flags,$sh_type
386 .align 4
387 .byte 'H', 'H', 'H', 'H'
388 .text
389 .globl _start
390 _start:
391 EOF
392 if $gcc_cv_as -o conftest.o conftest.s > /dev/null 2>&1 \
393 && $gcc_cv_ld -o conftest conftest.o > /dev/null 2>&1 \
394 && $gcc_cv_objdump -s -j .init_array conftest \
395 | grep HHHHDDDD > /dev/null 2>&1 \
396 && $gcc_cv_objdump -s -j .fini_array conftest \
397 | grep GGGGCCCC > /dev/null 2>&1; then
398 gcc_cv_initfini_array=yes
399 fi
400 ;;
401 esac
402 changequote(,)dnl
403 rm -f conftest conftest.*
404 changequote([,])dnl
405 fi
406 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
407 #ifndef __ELF__
408 # error Not an ELF OS
409 #endif
410 #include <stdlib.h>
411 #if defined __GLIBC_PREREQ
412 # if __GLIBC_PREREQ (2, 4)
413 # else
414 # error GLIBC 2.4 required
415 # endif
416 #else
417 # if defined __sun__ && defined __svr4__
418 /* Solaris ld.so.1 supports .init_array/.fini_array since Solaris 8. */
419 # else
420 # error The C library not known to support .init_array/.fini_array
421 # endif
422 #endif
423 ])],, [gcc_cv_initfini_array=no]);;
424 esac
425 else
426 AC_MSG_CHECKING(cross compile... guessing)
427 gcc_cv_initfini_array=no
428 fi])
385 enable_initfini_array=$gcc_cv_initfini_array 429 enable_initfini_array=$gcc_cv_initfini_array
386 ]) 430 ])
387 if test $enable_initfini_array = yes; then 431 AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY_SUPPORT,
388 AC_DEFINE(HAVE_INITFINI_ARRAY, 1, 432 [`if test $enable_initfini_array = yes; then echo 1; else echo 0; fi`],
389 [Define .init_array/.fini_array sections are available and working.]) 433 [Define 0/1 if .init_array/.fini_array sections are available and working.])
390 fi]) 434 ])
391 435
392 dnl # _gcc_COMPUTE_GAS_VERSION 436 dnl # _gcc_COMPUTE_GAS_VERSION
393 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE 437 dnl # Used by gcc_GAS_VERSION_GTE_IFELSE
394 dnl # 438 dnl #
395 dnl # WARNING: 439 dnl # WARNING:
397 dnl # This gross requirement will go away eventually. 441 dnl # This gross requirement will go away eventually.
398 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION], 442 AC_DEFUN([_gcc_COMPUTE_GAS_VERSION],
399 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd 443 [gcc_cv_as_bfd_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/bfd
400 for f in $gcc_cv_as_bfd_srcdir/configure \ 444 for f in $gcc_cv_as_bfd_srcdir/configure \
401 $gcc_cv_as_gas_srcdir/configure \ 445 $gcc_cv_as_gas_srcdir/configure \
402 $gcc_cv_as_gas_srcdir/configure.in \ 446 $gcc_cv_as_gas_srcdir/configure.ac \
403 $gcc_cv_as_gas_srcdir/Makefile.in ; do 447 $gcc_cv_as_gas_srcdir/Makefile.in ; do
404 gcc_cv_gas_version=`sed -n -e 's/^[[ ]]*\(VERSION=[[0-9]]*\.[[0-9]]*.*\)/\1/p' < $f` 448 gcc_cv_gas_version=`sed -n -e 's/^[[ ]]*VERSION=[[^0-9A-Za-z_]]*\([[0-9]]*\.[[0-9]]*.*\)/VERSION=\1/p' < $f`
405 if test x$gcc_cv_gas_version != x; then 449 if test x$gcc_cv_gas_version != x; then
406 break 450 break
407 fi 451 fi
408 done 452 done
453 case $gcc_cv_gas_version in
454 VERSION=[[0-9]]*) ;;
455 *) AC_MSG_ERROR([[cannot find version of in-tree assembler]]);;
456 esac
409 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"` 457 gcc_cv_gas_major_version=`expr "$gcc_cv_gas_version" : "VERSION=\([[0-9]]*\)"`
410 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"` 458 gcc_cv_gas_minor_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.\([[0-9]]*\)"`
411 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"` 459 gcc_cv_gas_patch_version=`expr "$gcc_cv_gas_version" : "VERSION=[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)"`
412 case $gcc_cv_gas_patch_version in 460 case $gcc_cv_gas_patch_version in
413 "") gcc_cv_gas_patch_version="0" ;; 461 "") gcc_cv_gas_patch_version="0" ;;
447 dnl # 495 dnl #
448 AC_DEFUN([gcc_GAS_FLAGS], 496 AC_DEFUN([gcc_GAS_FLAGS],
449 [AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags, 497 [AC_CACHE_CHECK([assembler flags], gcc_cv_as_flags,
450 [ case "$target" in 498 [ case "$target" in
451 i[[34567]]86-*-linux*) 499 i[[34567]]86-*-linux*)
452 dnl Always pass --32 to ia32 Linux assembler. 500 dnl Override the default, which may be incompatible.
453 gcc_cv_as_flags="--32" 501 gcc_cv_as_flags=--32
502 ;;
503 x86_64-*-linux-gnux32)
504 dnl Override the default, which may be incompatible.
505 gcc_cv_as_flags=--x32
506 ;;
507 x86_64-*-linux*)
508 dnl Override the default, which may be incompatible.
509 gcc_cv_as_flags=--64
454 ;; 510 ;;
455 powerpc*-*-darwin*) 511 powerpc*-*-darwin*)
456 dnl Always pass -arch ppc to assembler. 512 dnl Always pass -arch ppc to assembler.
457 gcc_cv_as_flags="-arch ppc" 513 gcc_cv_as_flags="-arch ppc"
458 ;; 514 ;;
479 [[$2]=no 535 [[$2]=no
480 ifelse([$3],,,[dnl 536 ifelse([$3],,,[dnl
481 if test $in_tree_gas = yes; then 537 if test $in_tree_gas = yes; then
482 gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes]) 538 gcc_GAS_VERSION_GTE_IFELSE($3, [[$2]=yes])
483 el])if test x$gcc_cv_as != x; then 539 el])if test x$gcc_cv_as != x; then
484 echo ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]') > conftest.s 540 AS_ECHO([ifelse(m4_substr([$5],0,1),[$], "[$5]", '[$5]')]) > conftest.s
485 if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD]) 541 if AC_TRY_COMMAND([$gcc_cv_as $gcc_cv_as_flags $4 -o conftest.o conftest.s >&AS_MESSAGE_LOG_FD])
486 then 542 then
487 ifelse([$6],, [$2]=yes, [$6]) 543 ifelse([$6],, [$2]=yes, [$6])
488 else 544 else
489 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD 545 echo "configure: failed program was" >&AS_MESSAGE_LOG_FD
492 rm -f conftest.o conftest.s 548 rm -f conftest.o conftest.s
493 fi]) 549 fi])
494 ifelse([$7],,,[dnl 550 ifelse([$7],,,[dnl
495 if test $[$2] = yes; then 551 if test $[$2] = yes; then
496 $7 552 $7
553 fi])
554 ifelse([$8],,,[dnl
555 if test $[$2] != yes; then
556 $8
497 fi])]) 557 fi])])
558
559 dnl gcc_SUN_LD_VERSION
560 dnl
561 dnl Determines Sun linker version numbers, setting gcc_cv_sun_ld_vers to
562 dnl the complete version number and gcc_cv_sun_ld_vers_{major, minor} to
563 dnl the corresponding fields.
564 dnl
565 dnl ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version
566 dnl numbers can be used in ld.so.1 feature checks even if a different
567 dnl linker is configured.
568 dnl
569 AC_DEFUN([gcc_SUN_LD_VERSION],
570 [changequote(,)dnl
571 if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
572 case "${target}" in
573 *-*-solaris2*)
574 #
575 # Solaris 2 ld -V output looks like this for a regular version:
576 #
577 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699
578 #
579 # but test versions add stuff at the end:
580 #
581 # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10
582 #
583 gcc_cv_sun_ld_ver=`/usr/ccs/bin/ld -V 2>&1`
584 if echo "$gcc_cv_sun_ld_ver" | grep 'Solaris Link Editors' > /dev/null; then
585 gcc_cv_sun_ld_vers=`echo $gcc_cv_sun_ld_ver | sed -n \
586 -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'`
587 gcc_cv_sun_ld_vers_major=`expr "$gcc_cv_sun_ld_vers" : '\([0-9]*\)'`
588 gcc_cv_sun_ld_vers_minor=`expr "$gcc_cv_sun_ld_vers" : '[0-9]*\.\([0-9]*\)'`
589 fi
590 ;;
591 esac
592 fi
593 changequote([,])dnl
594 ])
498 595
499 dnl GCC_TARGET_TEMPLATE(KEY) 596 dnl GCC_TARGET_TEMPLATE(KEY)
500 dnl ------------------------ 597 dnl ------------------------
501 dnl Define KEY as a valid configure key on the target machine. 598 dnl Define KEY as a valid configure key on the target machine.
502 599
519 616
520 dnl Make sure that build_exeext is looked for 617 dnl Make sure that build_exeext is looked for
521 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [ 618 AC_DEFUN([gcc_AC_BUILD_EXEEXT], [
522 ac_executable_extensions="$build_exeext"]) 619 ac_executable_extensions="$build_exeext"])
523 620
621 dnl GCC_GLIBC_VERSION_GTE_IFELSE(MAJOR, MINOR, IF-TRUE, IF-FALSE)
622 dnl -------------------------------------------------------------
623 dnl If the target glibc version ($glibc_version_major.$glibc_version_minor)
624 dnl is at least MAJOR.MINOR, call IF-TRUE, otherwise call IF-FALSE.
625 AC_DEFUN([GCC_GLIBC_VERSION_GTE_IFELSE],
626 [
627 AS_IF([test $glibc_version_major -gt $1 \
628 || ( test $glibc_version_major -eq $1 && test $glibc_version_minor -ge $2 )],
629 [$3], [$4])])