summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-03-15 06:35:30 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-05-05 15:38:48 -0400
commit8af16c5d4481a517cc7c400b97d469ee550ffd79 (patch)
tree69278658bf36bc3db82d9a02b3cb5e36483e9659 /configure.ac
parentf5f5b7035518af810ce60331bdbb13391d02845e (diff)
downloadgtk+-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.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac33
1 files changed, 33 insertions, 0 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
##################################################