File: weakref.m4

package info (click to toggle)
gdb 8.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 223,696 kB
  • sloc: ansic: 1,936,156; asm: 341,757; exp: 146,606; makefile: 56,749; sh: 23,776; cpp: 20,830; yacc: 12,914; perl: 5,331; ada: 4,977; python: 4,617; xml: 4,176; pascal: 3,134; lisp: 1,527; cs: 879; lex: 620; f90: 479; sed: 228; awk: 140; objc: 134; fortran: 43
file content (47 lines) | stat: -rw-r--r-- 1,713 bytes parent folder | download | duplicates (61)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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])