diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-03-15 06:35:30 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-05-05 15:38:48 -0400 |
commit | 8af16c5d4481a517cc7c400b97d469ee550ffd79 (patch) | |
tree | 69278658bf36bc3db82d9a02b3cb5e36483e9659 | |
parent | f5f5b7035518af810ce60331bdbb13391d02845e (diff) | |
download | gtk+-8af16c5d4481a517cc7c400b97d469ee550ffd79.tar.gz |
New visibility handling in gdk
Change the visibility handling to be the same way we do it in
GLib now. We pass -fvisibility=hidden to gcc and decorate public
functions with __attribute__((visibility("default"))).
This commit just does this for GDK, GTK+ will follow later.
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | gdk/Makefile.am | 5 | ||||
-rw-r--r-- | gdk/broadway/Makefile.am | 15 | ||||
-rw-r--r-- | gdk/quartz/Makefile.am | 1 | ||||
-rw-r--r-- | gdk/wayland/Makefile.am | 1 | ||||
-rw-r--r-- | gdk/win32/Makefile.am | 17 | ||||
-rw-r--r-- | gdk/x11/Makefile.am | 15 |
7 files changed, 63 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac index d15fdbd1de..cb522617e2 100644 --- a/configure.ac +++ b/configure.ac @@ -1674,6 +1674,39 @@ else fi ################################################## +# Visibility handling +################################################## + +GDK_HIDDEN_VISIBILITY_CFLAGS="" +case "$host" in + *-*-mingw*) + dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport) + AC_DEFINE([_GDK_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern], + [defines how to decorate public symbols while building]) + CFLAGS="${CFLAGS} -fvisibility=hidden" + ;; + *) + 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([], [int main (void) { 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([_GDK_EXTERN], [__attribute__((visibility("default"))) extern], + [defines how to decorate public symbols while building]) + GDK_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" + ]) + ;; +esac +AC_SUBST(GDK_HIDDEN_VISIBILITY_CFLAGS) + +################################################## # Output commands ################################################## diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 0b81376af1..161996f16b 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -144,11 +144,11 @@ gdk_c_sources = \ gdkwindowimpl.c gdk_built_sources = \ + gdkenumtypes.h \ gdkenumtypes.c \ gdkmarshalers.h \ gdkmarshalers.c \ - gdkversionmacros.h \ - gdkenumtypes.h + gdkversionmacros.h # # setup GDK sources and their dependencies @@ -166,6 +166,7 @@ common_sources = \ gdkmarshalers.h libgdk_3_la_SOURCES = $(common_sources) +libgdk_3_la_CFLAGS = $(AM_CFLAGS) $(GDK_HIDDEN_VISIBILITY_CFLAGS) libgdk_3_la_LIBADD = $(GDK_DEP_LIBS) libgdk_3_la_LDFLAGS = $(LDADD) diff --git a/gdk/broadway/Makefile.am b/gdk/broadway/Makefile.am index 661fb7e4a8..1bbde7c312 100644 --- a/gdk/broadway/Makefile.am +++ b/gdk/broadway/Makefile.am @@ -4,13 +4,14 @@ include $(top_srcdir)/Makefile.decl libgdkincludedir = $(includedir)/gtk-3.0/gdk libgdkbroadwayincludedir = $(includedir)/gtk-3.0/gdk/broadway -AM_CPPFLAGS = \ - -DG_LOG_DOMAIN=\"Gdk\" \ - -DGDK_COMPILATION \ - -I$(top_srcdir) \ - -I$(top_srcdir)/gdk \ - -I$(top_builddir)/gdk \ - $(GTK_DEBUG_FLAGS) \ +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"Gdk\" \ + -DGDK_COMPILATION \ + -I$(top_srcdir) \ + -I$(top_srcdir)/gdk \ + -I$(top_builddir)/gdk \ + $(GDK_HIDDEN_VISIBILITY_CFLAGS) \ + $(GTK_DEBUG_FLAGS) \ $(GDK_DEP_CFLAGS) LDADDS = $(GDK_DEP_LIBS) diff --git a/gdk/quartz/Makefile.am b/gdk/quartz/Makefile.am index a8be38e4f8..2c8fb90e6a 100644 --- a/gdk/quartz/Makefile.am +++ b/gdk/quartz/Makefile.am @@ -9,6 +9,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/gdk \ -I$(top_builddir)/gdk \ + $(GDK_HIDDEN_VISIBILITY_CFLAGS) \ $(GTK_DEBUG_FLAGS) \ $(GDK_DEP_CFLAGS) \ "-xobjective-c" diff --git a/gdk/wayland/Makefile.am b/gdk/wayland/Makefile.am index 5b66090b04..eed33ad2a5 100644 --- a/gdk/wayland/Makefile.am +++ b/gdk/wayland/Makefile.am @@ -10,6 +10,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/gdk \ -I$(top_builddir)/gdk \ + $(GDK_HIDDEN_VISIBILITY_CFLAGS) \ $(GTK_DEBUG_FLAGS) \ $(GDK_DEP_CFLAGS) diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am index 492e1c55d9..ef5f6e8851 100644 --- a/gdk/win32/Makefile.am +++ b/gdk/win32/Makefile.am @@ -5,14 +5,15 @@ libgdkincludedir = $(includedir)/gtk-3.0/gdk libgdkwin32includedir = $(includedir)/gtk-3.0/gdk/win32 AM_CPPFLAGS = \ - -DG_LOG_DOMAIN=\"Gdk\" \ - -DINSIDE_GDK_WIN32 \ - -I$(top_srcdir) \ - -I$(top_srcdir)/gdk \ - -I$(top_builddir)/gdk \ - $(GTK_DEBUG_FLAGS) \ - $(GDK_DEP_CFLAGS) \ - $(GDK_WIN32_EXTRA_CFLAGS)\ + -DG_LOG_DOMAIN=\"Gdk\" \ + -DINSIDE_GDK_WIN32 \ + -I$(top_srcdir) \ + -I$(top_srcdir)/gdk \ + -I$(top_builddir)/gdk \ + $(GDK_HIDDEN_VISIBILITY_CFLAGS) \ + $(GTK_DEBUG_FLAGS) \ + $(GDK_DEP_CFLAGS) \ + $(GDK_WIN32_EXTRA_CFLAGS) \ -DGDK_COMPILATION LDADDS = $(GDK_DEP_LIBS) diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am index a00118eae7..5930f7e7e4 100644 --- a/gdk/x11/Makefile.am +++ b/gdk/x11/Makefile.am @@ -4,13 +4,14 @@ include $(top_srcdir)/Makefile.decl libgdkincludedir = $(includedir)/gtk-3.0/gdk libgdkx11includedir = $(includedir)/gtk-3.0/gdk/x11 -AM_CPPFLAGS = \ - -DG_LOG_DOMAIN=\"Gdk\" \ - -DGDK_COMPILATION \ - -I$(top_srcdir) \ - -I$(top_srcdir)/gdk \ - -I$(top_builddir)/gdk \ - $(GTK_DEBUG_FLAGS) \ +AM_CPPFLAGS = \ + -DG_LOG_DOMAIN=\"Gdk\" \ + -DGDK_COMPILATION \ + -I$(top_srcdir) \ + -I$(top_srcdir)/gdk \ + -I$(top_builddir)/gdk \ + $(GDK_HIDDEN_VISIBILITY_CFLAGS) \ + $(GTK_DEBUG_FLAGS) \ $(GDK_DEP_CFLAGS) LDADDS = $(GDK_DEP_LIBS) |