13 changed files with 273 additions and 13 deletions
@ -0,0 +1,15 @@ |
|||
;; Cribbed from libffi |
|||
|
|||
AC_DEFUN([GCC_AS_CFI_PSEUDO_OP], |
|||
[AC_CACHE_CHECK([assembler .cfi pseudo-op support], |
|||
gcc_cv_as_cfi_pseudo_op, [ |
|||
gcc_cv_as_cfi_pseudo_op=unknown |
|||
AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],, |
|||
[gcc_cv_as_cfi_pseudo_op=yes], |
|||
[gcc_cv_as_cfi_pseudo_op=no]) |
|||
]) |
|||
if test "x$gcc_cv_as_cfi_pseudo_op" = xyes; then |
|||
AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, |
|||
[Define if your assembler supports .cfi_* directives.]) |
|||
fi |
|||
]) |
|||
@ -0,0 +1,50 @@ |
|||
dnl GCC_CHECK_LIBM |
|||
dnl |
|||
dnl Check whether -lm is available. This is a pre-requisite for |
|||
dnl GCC_CHECK_MATH_FUNC so that it will link with -lm. |
|||
AC_DEFUN([GCC_CHECK_LIBM], |
|||
[AC_CHECK_LIB([m],[sin])]) |
|||
|
|||
dnl GCC_CHECK_MATH_HEADERS |
|||
dnl |
|||
dnl Check for math.h and complex.h. This is a pre-requisite for |
|||
dnl GCC_CHECK_MATH_FUNC so that it includes the right headers. |
|||
dnl (Some systems, such as AIX or OpenVMS may define macro for math |
|||
dnl functions). |
|||
AC_DEFUN([GCC_CHECK_MATH_HEADERS], |
|||
[AC_CHECK_HEADERS_ONCE(math.h complex.h)]) |
|||
|
|||
dnl GCC_CHECK_MATH_FUNC([name]) |
|||
dnl |
|||
dnl Check whether math function NAME is available on the system (by compiling |
|||
dnl and linking a C program) and run define HAVE_name on success. |
|||
dnl |
|||
dnl Note that OpenVMS system insists on including complex.h before math.h |
|||
AC_DEFUN([GCC_CHECK_MATH_FUNC], |
|||
[ |
|||
AC_REQUIRE([GCC_CHECK_LIBM]) |
|||
AC_REQUIRE([GCC_CHECK_MATH_HEADERS]) |
|||
AC_CACHE_CHECK([for $1], [gcc_cv_math_func_$1], |
|||
[AC_LINK_IFELSE([ |
|||
#ifdef HAVE_COMPLEX_H |
|||
#include <complex.h> |
|||
#endif |
|||
#ifdef HAVE_MATH_H |
|||
#include <math.h> |
|||
#endif |
|||
|
|||
int (*ptr)() = (int (*)())$1; |
|||
|
|||
int |
|||
main () |
|||
{ |
|||
return 0; |
|||
} |
|||
], |
|||
[gcc_cv_math_func_$1=yes], |
|||
[gcc_cv_math_func_$1=no])]) |
|||
if test $gcc_cv_math_func_$1 = yes; then |
|||
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$1),[1], |
|||
[Define to 1 if you have the `$1' function.]) |
|||
fi |
|||
]) |
|||
@ -1,5 +1,7 @@ |
|||
# The -mdynamic-no-pic ensures that the compiler executable is built without |
|||
# position-independent-code -- the usual default on Darwin. This fix speeds |
|||
# compiles by 3-5%. |
|||
|
|||
BOOT_CFLAGS += -mdynamic-no-pic |
|||
|
|||
# Ensure we don't try and use -pie, as it is incompatible with pch. |
|||
BOOT_LDFLAGS += `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;` |
|||
|
|||
@ -1,2 +0,0 @@ |
|||
# The shell may not be in /bin. |
|||
SHELL = sh |
|||
@ -0,0 +1,97 @@ |
|||
dnl ---------------------------------------------------------------------- |
|||
dnl This whole bit snagged from gcc |
|||
|
|||
dnl |
|||
dnl mmap(2) blacklisting. Some platforms provide the mmap library routine |
|||
dnl but don't support all of the features we need from it. |
|||
dnl |
|||
AC_DEFUN([GCC_AC_FUNC_MMAP_BLACKLIST], |
|||
[ |
|||
AC_CHECK_HEADER([sys/mman.h], |
|||
[gcc_header_sys_mman_h=yes], [gcc_header_sys_mman_h=no]) |
|||
AC_CHECK_FUNC([mmap], [gcc_func_mmap=yes], [gcc_func_mmap=no]) |
|||
if test "$gcc_header_sys_mman_h" != yes \ |
|||
|| test "$gcc_func_mmap" != yes; then |
|||
gcc_cv_func_mmap_file=no |
|||
gcc_cv_func_mmap_dev_zero=no |
|||
gcc_cv_func_mmap_anon=no |
|||
else |
|||
AC_CACHE_CHECK([whether read-only mmap of a plain file works], |
|||
gcc_cv_func_mmap_file, |
|||
[# Add a system to this blacklist if |
|||
# mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a |
|||
# memory area containing the same data that you'd get if you applied |
|||
# read() to the same fd. The only system known to have a problem here |
|||
# is VMS, where text files have record structure. |
|||
case "$host_os" in |
|||
*vms* | ultrix*) |
|||
gcc_cv_func_mmap_file=no ;; |
|||
*) |
|||
gcc_cv_func_mmap_file=yes;; |
|||
esac]) |
|||
AC_CACHE_CHECK([whether mmap from /dev/zero works], |
|||
gcc_cv_func_mmap_dev_zero, |
|||
[# Add a system to this blacklist if it has mmap() but /dev/zero |
|||
# does not exist, or if mmapping /dev/zero does not give anonymous |
|||
# zeroed pages with both the following properties: |
|||
# 1. If you map N consecutive pages in with one call, and then |
|||
# unmap any subset of those pages, the pages that were not |
|||
# explicitly unmapped remain accessible. |
|||
# 2. If you map two adjacent blocks of memory and then unmap them |
|||
# both at once, they must both go away. |
|||
# Systems known to be in this category are Windows (all variants), |
|||
# VMS, and Darwin. |
|||
case "$host_os" in |
|||
*vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) |
|||
gcc_cv_func_mmap_dev_zero=no ;; |
|||
*) |
|||
gcc_cv_func_mmap_dev_zero=yes;; |
|||
esac]) |
|||
|
|||
# Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. |
|||
AC_CACHE_CHECK([for MAP_ANON(YMOUS)], gcc_cv_decl_map_anon, |
|||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
|||
[#include <sys/types.h> |
|||
#include <sys/mman.h> |
|||
#include <unistd.h> |
|||
|
|||
#ifndef MAP_ANONYMOUS |
|||
#define MAP_ANONYMOUS MAP_ANON |
|||
#endif |
|||
], |
|||
[int n = MAP_ANONYMOUS;])], |
|||
gcc_cv_decl_map_anon=yes, |
|||
gcc_cv_decl_map_anon=no)]) |
|||
|
|||
if test $gcc_cv_decl_map_anon = no; then |
|||
gcc_cv_func_mmap_anon=no |
|||
else |
|||
AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works], |
|||
gcc_cv_func_mmap_anon, |
|||
[# Add a system to this blacklist if it has mmap() and MAP_ANON or |
|||
# MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) |
|||
# doesn't give anonymous zeroed pages with the same properties listed |
|||
# above for use of /dev/zero. |
|||
# Systems known to be in this category are Windows, VMS, and SCO Unix. |
|||
case "$host_os" in |
|||
*vms* | cygwin* | pe | mingw* | sco* | udk* ) |
|||
gcc_cv_func_mmap_anon=no ;; |
|||
*) |
|||
gcc_cv_func_mmap_anon=yes;; |
|||
esac]) |
|||
fi |
|||
fi |
|||
|
|||
if test $gcc_cv_func_mmap_file = yes; then |
|||
AC_DEFINE(HAVE_MMAP_FILE, 1, |
|||
[Define if read-only mmap of a plain file works.]) |
|||
fi |
|||
if test $gcc_cv_func_mmap_dev_zero = yes; then |
|||
AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1, |
|||
[Define if mmap of /dev/zero works.]) |
|||
fi |
|||
if test $gcc_cv_func_mmap_anon = yes; then |
|||
AC_DEFINE(HAVE_MMAP_ANON, 1, |
|||
[Define if mmap with MAP_ANON(YMOUS) works.]) |
|||
fi |
|||
]) |
|||
@ -1,2 +1,3 @@ |
|||
CFLAGS_FOR_TARGET += -mieee |
|||
CXXFLAGS_FOR_TARGET += -mieee |
|||
GOCFLAGS_FOR_TARGET += -mieee |
|||
|
|||
@ -0,0 +1,47 @@ |
|||
|
|||
dnl Check if the target supports weak. |
|||
AC_DEFUN([GCC_CHECK_ATTRIBUTE_WEAK], [ |
|||
AC_CACHE_CHECK([whether the target supports weak], |
|||
ac_cv_have_attribute_weak, [ |
|||
weakref_m4_saved_CFLAGS="$CFLAGS" |
|||
CFLAGS="$CFLAGS -Werror" |
|||
AC_TRY_COMPILE([void __attribute__((weak)) foo(void) { }], |
|||
[], ac_cv_have_attribute_weak=yes, |
|||
ac_cv_have_attribute_weak=no) |
|||
CFLAGS="$weakref_m4_saved_CFLAGS"]) |
|||
if test x"$ac_cv_have_attribute_weak" = xyes; then |
|||
AC_DEFINE(HAVE_ATTRIBUTE_WEAK, 1, |
|||
[Define to 1 if the target supports __attribute__((weak)).]) |
|||
fi]) |
|||
|
|||
dnl Check whether weak refs work like the ELF ones. |
|||
dnl This means that the weak reference works without having to satify |
|||
dnl linkage for the item. |
|||
dnl There are targets (at least Darwin) where we have fully functional |
|||
dnl weakrefs at runtime, but must supply the referenced item at link time. |
|||
AC_DEFUN([GCC_CHECK_ELF_STYLE_WEAKREF], [ |
|||
AC_CACHE_CHECK([whether weak refs work like ELF], |
|||
ac_cv_have_elf_style_weakref, [ |
|||
weakref_m4_saved_CFLAGS="$CFLAGS" |
|||
case "${host}" in |
|||
*-apple-darwin*) CFLAGS="$CFLAGS -Wl,-undefined,dynamic_lookup" ;; |
|||
*) ;; |
|||
esac |
|||
AC_RUN_IFELSE([AC_LANG_SOURCE([[ |
|||
extern void fNotToBeFound(void) __attribute__((weak)); |
|||
int main () |
|||
{ |
|||
if (fNotToBeFound) |
|||
return 1; |
|||
else |
|||
return 0; |
|||
} |
|||
]])], ac_cv_have_elf_style_weakref=yes, ac_cv_have_elf_style_weakref=no, [ |
|||
case "${host}" in |
|||
*-apple-darwin[[89]]*) ac_cv_have_elf_style_weakref=no ;; |
|||
*) ac_cv_have_elf_style_weakref=yes;; |
|||
esac])CFLAGS="$weakref_m4_saved_CFLAGS"]) |
|||
if test x"$ac_cv_have_elf_style_weakref" = xyes; then |
|||
AC_DEFINE(HAVE_ELF_STYLE_WEAKREF, 1, [Define to 1 if target has a weakref that works like the ELF one.]) |
|||
fi]) |
|||
|
|||
Loading…
Reference in new issue