annotate config/weakref.m4 @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1
kono
parents:
diff changeset
2 dnl Check if the target supports weak.
kono
parents:
diff changeset
3 AC_DEFUN([GCC_CHECK_ATTRIBUTE_WEAK], [
kono
parents:
diff changeset
4 AC_CACHE_CHECK([whether the target supports weak],
kono
parents:
diff changeset
5 ac_cv_have_attribute_weak, [
kono
parents:
diff changeset
6 weakref_m4_saved_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
7 CFLAGS="$CFLAGS -Werror"
kono
parents:
diff changeset
8 AC_TRY_COMPILE([void __attribute__((weak)) foo(void) { }],
kono
parents:
diff changeset
9 [], ac_cv_have_attribute_weak=yes,
kono
parents:
diff changeset
10 ac_cv_have_attribute_weak=no)
kono
parents:
diff changeset
11 CFLAGS="$weakref_m4_saved_CFLAGS"])
kono
parents:
diff changeset
12 if test x"$ac_cv_have_attribute_weak" = xyes; then
kono
parents:
diff changeset
13 AC_DEFINE(HAVE_ATTRIBUTE_WEAK, 1,
kono
parents:
diff changeset
14 [Define to 1 if the target supports __attribute__((weak)).])
kono
parents:
diff changeset
15 fi])
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 dnl Check whether weak refs work like the ELF ones.
kono
parents:
diff changeset
18 dnl This means that the weak reference works without having to satify
kono
parents:
diff changeset
19 dnl linkage for the item.
kono
parents:
diff changeset
20 dnl There are targets (at least Darwin) where we have fully functional
kono
parents:
diff changeset
21 dnl weakrefs at runtime, but must supply the referenced item at link time.
kono
parents:
diff changeset
22 AC_DEFUN([GCC_CHECK_ELF_STYLE_WEAKREF], [
kono
parents:
diff changeset
23 AC_CACHE_CHECK([whether weak refs work like ELF],
kono
parents:
diff changeset
24 ac_cv_have_elf_style_weakref, [
kono
parents:
diff changeset
25 weakref_m4_saved_CFLAGS="$CFLAGS"
kono
parents:
diff changeset
26 case "${host}" in
kono
parents:
diff changeset
27 *-apple-darwin*) CFLAGS="$CFLAGS -Wl,-undefined,dynamic_lookup" ;;
kono
parents:
diff changeset
28 *) ;;
kono
parents:
diff changeset
29 esac
kono
parents:
diff changeset
30 AC_RUN_IFELSE([AC_LANG_SOURCE([[
kono
parents:
diff changeset
31 extern void fNotToBeFound(void) __attribute__((weak));
kono
parents:
diff changeset
32 int main ()
kono
parents:
diff changeset
33 {
kono
parents:
diff changeset
34 if (fNotToBeFound)
kono
parents:
diff changeset
35 return 1;
kono
parents:
diff changeset
36 else
kono
parents:
diff changeset
37 return 0;
kono
parents:
diff changeset
38 }
kono
parents:
diff changeset
39 ]])], ac_cv_have_elf_style_weakref=yes, ac_cv_have_elf_style_weakref=no, [
kono
parents:
diff changeset
40 case "${host}" in
kono
parents:
diff changeset
41 *-apple-darwin[[89]]*) ac_cv_have_elf_style_weakref=no ;;
kono
parents:
diff changeset
42 *) ac_cv_have_elf_style_weakref=yes;;
kono
parents:
diff changeset
43 esac])CFLAGS="$weakref_m4_saved_CFLAGS"])
kono
parents:
diff changeset
44 if test x"$ac_cv_have_elf_style_weakref" = xyes; then
kono
parents:
diff changeset
45 AC_DEFINE(HAVE_ELF_STYLE_WEAKREF, 1, [Define to 1 if target has a weakref that works like the ELF one.])
kono
parents:
diff changeset
46 fi])
kono
parents:
diff changeset
47