| 1 |
# Check for -fvisibility and the related __attribute__s |
| 2 |
|
| 3 |
AC_DEFUN([CF_CHECK_VISIBILITY], |
| 4 |
[ |
| 5 |
AC_MSG_CHECKING([whether the C compiler supports -fvisibility=hidden and the visibility __attribute__]) |
| 6 |
saved_CFLAGS="$CFLAGS" |
| 7 |
CFLAGS="$CFLAGS -fvisibility=hidden -Werror" |
| •8 |
AC_LINK_IFELSE([AC_LANG_SOURCE([[ |
| 9 |
__attribute__((visibility("hidden"))) |
| 10 |
int t1(void) |
| 11 |
{ |
| 12 |
return 0; |
| 13 |
} |
| 14 |
|
| 15 |
__attribute__((visibility("default"))) |
| 16 |
int t2(void) |
| 17 |
{ |
| 18 |
return 0; |
| 19 |
} |
| 20 |
|
| 21 |
int main(void) |
| 22 |
{ |
| 23 |
t1(); |
| 24 |
t2(); |
| 25 |
return 0; |
| 26 |
} |
| 27 |
]])],[ |
| 28 |
AC_MSG_RESULT([yes]) |
| 29 |
AC_DEFINE([HAVE_VISIBILITY], 1, [Define if __attribute__((visibility)) is supported]) |
| 30 |
CFLAGS="$saved_CFLAGS -fvisibility=hidden" |
| 31 |
],[ |
| 32 |
AC_MSG_RESULT([no]) |
| 33 |
CFLAGS="$saved_CFLAGS" |
| 34 |
]) |
| 35 |
]) |