configure.ac: split -fvisibility and __attribute__((visibility)) checks

The former does not imply the latter and vice-versa. One such example is
the Sun compiler.

v2: Add missing closing brakets. (Alan)

Cc: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
main
Emil Velikov 2015-03-09 12:18:32 +00:00
parent 0d78b37b1c
commit 40902b9fa1
1 changed files with 10 additions and 5 deletions

View File

@ -415,14 +415,19 @@ if test "x$GCC" = xyes; then
# Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed. # Restore CFLAGS; VISIBILITY_CFLAGS are added to it where needed.
CFLAGS=$save_CFLAGS CFLAGS=$save_CFLAGS
if test "x$VISIBILITY_CFLAGS" != x; then
AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler has -fvisibility support])
fi
AC_SUBST([VISIBILITY_CFLAGS]) AC_SUBST([VISIBILITY_CFLAGS])
fi fi
AC_MSG_CHECKING([whether $CC supports __attribute__((visibility))])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
int foo_default( void ) __attribute__((visibility("default")));
int foo_hidden( void ) __attribute__((visibility("hidden")));
])], HAVE_ATTRIBUTE_VISIBILITY="yes"; AC_MSG_RESULT([yes]), AC_MSG_RESULT([no]));
if test "x$HAVE_ATTRIBUTE_VISIBILITY" = xyes; then
AC_DEFINE(HAVE_VISIBILITY, 1, [Compiler supports __attribute__((visibility))])
fi
AC_SUBST(WARN_CFLAGS) AC_SUBST(WARN_CFLAGS)
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile Makefile