File: gcc_visibility.m4

package info (click to toggle)
avahi 0.7-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,956 kB
  • sloc: ansic: 40,180; sh: 6,285; xml: 4,433; cs: 2,185; makefile: 1,706; python: 321; cpp: 222
file content (36 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (7)
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
dnl @synopsis CHECK_VISIBILITY([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
dnl
dnl @summary check for the gcc -fvisibility flag
dnl

AC_DEFUN([CHECK_VISIBILITY_HIDDEN], [
  save_CFLAGS="$CFLAGS"
  VISIBILITY_HIDDEN_CFLAGS=""
  OPTION=-fvisibility=hidden

  AC_MSG_CHECKING(for gcc $OPTION support)

  CFLAGS="$CFLAGS $OPTION"

  AC_TRY_COMPILE([
      int default_vis __attribute__ ((visibility("default")));
      int hidden_vis __attribute__ ((visibility("hidden")));
    ],
    [],
    ac_visibility_supported=yes,
    ac_visibility_supported=no)
  AC_MSG_RESULT($ac_visibility_supported)

  if test x"$ac_visibility_supported" = xyes; then
    ifelse([$1],,AC_DEFINE(HAVE_GCC_VISIBILITY,1,[Define if you have gcc -fvisibility=hidden support ]),[$1])
    VISIBILITY_HIDDEN_CFLAGS="$OPTION -DHAVE_VISIBILITY_HIDDEN"
    AC_DEFINE(HAVE_VISIBILITY_HIDDEN,[],[Support for visibility hidden])
  else
    $2
    :
  fi

  AC_SUBST(VISIBILITY_HIDDEN_CFLAGS)

  CFLAGS="$save_CFLAGS"
])