source: trunk/libs/newlib/src/config/weakref.m4 @ 689

Last change on this file since 689 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.7 KB
Line 
1
2dnl Check if the target supports weak.
3AC_DEFUN([GCC_CHECK_ATTRIBUTE_WEAK], [
4  AC_CACHE_CHECK([whether the target supports weak],
5                 ac_cv_have_attribute_weak, [
6  weakref_m4_saved_CFLAGS="$CFLAGS"
7  CFLAGS="$CFLAGS -Werror"
8  AC_TRY_COMPILE([void __attribute__((weak)) foo(void) { }],
9                 [], ac_cv_have_attribute_weak=yes,
10                 ac_cv_have_attribute_weak=no)
11  CFLAGS="$weakref_m4_saved_CFLAGS"])
12  if test x"$ac_cv_have_attribute_weak" = xyes; then
13    AC_DEFINE(HAVE_ATTRIBUTE_WEAK, 1,
14      [Define to 1 if the target supports __attribute__((weak)).])
15  fi])
16
17dnl Check whether weak refs work like the ELF ones.
18dnl This means that the weak reference works without having to satify
19dnl linkage for the item.
20dnl There are targets (at least Darwin) where we have fully functional
21dnl weakrefs at runtime, but must supply the referenced item at link time.
22AC_DEFUN([GCC_CHECK_ELF_STYLE_WEAKREF], [
23  AC_CACHE_CHECK([whether weak refs work like ELF],
24                  ac_cv_have_elf_style_weakref, [
25  weakref_m4_saved_CFLAGS="$CFLAGS"
26  case "${host}" in
27    *-apple-darwin*) CFLAGS="$CFLAGS -Wl,-undefined,dynamic_lookup" ;;
28    *) ;;
29  esac 
30  AC_RUN_IFELSE([AC_LANG_SOURCE([[
31extern void fNotToBeFound(void) __attribute__((weak));
32int main ()
33{
34  if (fNotToBeFound)
35    return 1;
36  else
37    return 0;
38}
39]])], ac_cv_have_elf_style_weakref=yes, ac_cv_have_elf_style_weakref=no, [
40case "${host}" in
41  *-apple-darwin[[89]]*) ac_cv_have_elf_style_weakref=no ;;
42  *) ac_cv_have_elf_style_weakref=yes;;
43esac])CFLAGS="$weakref_m4_saved_CFLAGS"])
44if test x"$ac_cv_have_elf_style_weakref" = xyes; then
45  AC_DEFINE(HAVE_ELF_STYLE_WEAKREF, 1, [Define to 1 if target has a weakref that works like the ELF one.])
46fi])
47
Note: See TracBrowser for help on using the repository browser.