diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2014-07-07 18:04:14 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2014-08-15 10:00:38 +0800 |
commit | d281b07c4aba18d30c4365ef3cba2df85ac4ab6f (patch) | |
tree | 7a1d0d578ed76b98824c5374a03e717b12691098 /configure.ac | |
parent | eab36c0001e22c0ee66246ae9a0b8018b2325c96 (diff) | |
download | gobject-introspection-d281b07c4aba18d30c4365ef3cba2df85ac4ab6f.tar.gz |
build: Export Symbols Using Compiler Directives
Use compiler directives for exporting symbols for the build of
libgirepository and also for the test libraries, like what is now done
in GLib and GTK+ so that maintaining a separate .symbols (and .def files)
would not be needed, in which the correct compiler directive is determined
during configure time. Drop all the .def files and the .symbols file as
we would not be using them anymore.
https://bugzilla.gnome.org/show_bug.cgi?id=732669
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index b863220a..5add902e 100644 --- a/configure.ac +++ b/configure.ac @@ -292,6 +292,39 @@ AC_SUBST(GLIBSRC) AC_MSG_RESULT([$GLIBSRC]) dnl +dnl Check for -fvisibility=hidden to determine if we can do GNU-style +dnl visibility attributes for symbol export control +dnl +GI_HIDDEN_VISIBILITY_CFLAGS="" +case "$host" in + *-*-mingw*) + dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport) + AC_DEFINE([_GI_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([_GI_EXTERN], [__attribute__((visibility("default"))) extern], + [defines how to decorate public symbols while building]) + GI_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden" + ]) + ;; +esac +AC_SUBST(GI_HIDDEN_VISIBILITY_CFLAGS) + +dnl dnl Check for -Bsymbolic-functions linker flag used to avoid dnl intra-library PLT jumps, if available. dnl |