1 dnl @synopsis CHECK_VISIBILITY([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
3 dnl @summary check for the gcc -fvisibility flag
6 AC_DEFUN([CHECK_VISIBILITY_HIDDEN], [
8 VISIBILITY_HIDDEN_CFLAGS=""
9 OPTION=-fvisibility=hidden
11 AC_MSG_CHECKING(for gcc $OPTION support)
13 CFLAGS="$CFLAGS $OPTION"
16 int default_vis __attribute__ ((visibility("default")));
17 int hidden_vis __attribute__ ((visibility("hidden")));
20 ac_visibility_supported=yes,
21 ac_visibility_supported=no)
22 AC_MSG_RESULT($ac_visibility_supported)
24 if test x"$ac_visibility_supported" = xyes; then
25 ifelse([$1],,AC_DEFINE(HAVE_GCC_VISIBILITY,1,[Define if you have gcc -fvisibility=hidden support ]),[$1])
26 VISIBILITY_HIDDEN_CFLAGS="$OPTION -DHAVE_VISIBILITY_HIDDEN"
27 AC_DEFINE(HAVE_VISIBILITY_HIDDEN,[],[Support for visibility hidden])
33 AC_SUBST(VISIBILITY_HIDDEN_CFLAGS)