summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2016-06-06 19:49:25 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2016-06-29 17:32:21 +0800
commit1147da131ad13e583e73fed956e5c944e1497bf4 (patch)
treefb3cd7cfa281e4409946cbc6bdf3534c9aa00985 /configure.ac
parentbbb38aa2da449810989d2bdadad900ffc48846d8 (diff)
downloadpango-1147da131ad13e583e73fed956e5c944e1497bf4.tar.gz
Export symbols with compiler directives if possible
Add a configure check to see whether compiler directives are available for exporting symbols, and use them if so. Likewise, update the Visual Studio projects and config.h.win32.in to do likewise for Windows builds. We can then drop the .def files that were used to export symbols on Windows builds, which should clean up things a bit.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac35
1 files changed, 35 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index b8ca9302..e43e134a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -556,6 +556,41 @@ AC_ARG_ENABLE(installed_tests,
AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
+dnl *********************************************************************
+dnl * Check for -fvisibility=hidden to determine if we can do GNU-style *
+dnl * visibility attributes for symbol export control *
+dnl *********************************************************************
+
+PANGO_HIDDEN_VISIBILITY_CFLAGS=""
+case "$host" in
+ *-*-mingw*)
+ dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
+ AC_DEFINE([_PANGO_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([], [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([_PANGO_EXTERN], [__attribute__((visibility("default"))) extern],
+ [defines how to decorate public symbols while building])
+ PANGO_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+ ])
+ ;;
+esac
+AC_SUBST(PANGO_HIDDEN_VISIBILITY_CFLAGS)
+
+
AC_HEADER_DIRENT
AC_CHECK_HEADERS(unistd.h)