1dnl @synopsis CHECK_VISIBILITY([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) 2dnl 3dnl @summary check for the gcc -fvisibility flag 4dnl 5 6AC_DEFUN([CHECK_VISIBILITY_HIDDEN], [ 7 save_CFLAGS="$CFLAGS" 8 VISIBILITY_HIDDEN_CFLAGS="" 9 OPTION=-fvisibility=hidden 10 11 AC_MSG_CHECKING(for gcc $OPTION support) 12 13 CFLAGS="$CFLAGS $OPTION" 14 15 AC_TRY_COMPILE([ 16 int default_vis __attribute__ ((visibility("default"))); 17 int hidden_vis __attribute__ ((visibility("hidden"))); 18 ], 19 [], 20 ac_visibility_supported=yes, 21 ac_visibility_supported=no) 22 AC_MSG_RESULT($ac_visibility_supported) 23 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]) 28 else 29 $2 30 : 31 fi 32 33 AC_SUBST(VISIBILITY_HIDDEN_CFLAGS) 34 35 CFLAGS="$save_CFLAGS" 36]) 37