clutter: Assume compiler supports visibility flag and attributes

Unconditionally pass -fvisibility=hidden to compiler and define
_CLUTTER_EXTERN to __attribute__((visibility("default"))) extern.
This commit is contained in:
Jonas Ådahl 2018-05-24 17:31:04 +02:00
parent e3c6e3b84d
commit db77e2e187
3 changed files with 2 additions and 24 deletions

View File

@ -14,6 +14,7 @@ AM_CPPFLAGS = \
-DCLUTTER_COMPILATION=1 \
-DCOGL_DISABLE_DEPRECATION_WARNINGS \
-DG_LOG_DOMAIN=\"Clutter\" \
-fvisibility=hidden \
-I$(top_srcdir) \
-I$(top_srcdir)/clutter \
-I$(top_builddir) \
@ -23,7 +24,6 @@ AM_CPPFLAGS = \
-I$(top_builddir)/../cogl/cogl \
$(CLUTTER_DEPRECATED_CFLAGS) \
$(CLUTTER_DEBUG_CFLAGS) \
$(CLUTTER_HIDDEN_VISIBILITY_CFLAGS) \
$(NULL)
AM_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)

View File

@ -90,9 +90,7 @@
#define CLUTTER_PRIVATE_FIELD(x) clutter_private_ ## x
#endif
#ifndef _CLUTTER_EXTERN
#define _CLUTTER_EXTERN extern
#endif
#define _CLUTTER_EXTERN __attribute__((visibility("default"))) extern
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || \
__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4)

View File

@ -101,26 +101,6 @@ AC_ARG_ENABLE([Bsymbolic],
AS_IF([test "x$enable_Bsymbolic" = "xyes"], [CLUTTER_LINK_FLAGS=-Wl[,]-Bsymbolic-functions])
AC_SUBST(CLUTTER_LINK_FLAGS)
# Check for the visibility flags
CLUTTER_HIDDEN_VISIBILITY_CFLAGS=""
dnl on other compilers, check if we can do -fvisibility=hidden
SAVED_CFLAGS="${CFLAGS}"
CFLAGS="-fvisibility=hidden"
AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
AC_TRY_COMPILE([], [return 0],
AC_MSG_RESULT(yes)
enable_fvisibility_hidden=yes,
AC_MSG_RESULT(no)
enable_fvisibility_hidden=no)
CFLAGS="${SAVED_CFLAGS}"
AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
AC_DEFINE([_CLUTTER_EXTERN], [__attribute__((visibility("default"))) extern],
[defines how to decorate public symbols while building])
CLUTTER_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
])
AC_SUBST(CLUTTER_HIDDEN_VISIBILITY_CFLAGS)
AC_CACHE_SAVE
dnl ========================================================================