diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-05-10 22:59:30 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-05-10 23:12:21 +0300 |
commit | a24a980424ec2ec81b13c8e5a95394d62cbf7406 (patch) | |
tree | ffb22273ec44b5a74d85d5b0c328810d7a0b127c /solenv | |
parent | 44e52d6698742edc8295bdcb7ad06ff370e5e6a6 (diff) |
Make visibility tests work as intended on Mac OS X
If the tests detect that visibiliy works, then use it also in
gbuild. In the old build system, -fvisibility=hidden was already
being used on Mac OS X if HAVE_GCC_VISIBILITY_FEATURE had been
detected.
In configure.in, let's not hardcode the -shared, -fpic and -Wl,-z,defs
options or the .so suffix used in visibility-related tests. Factor
them out and use platform-specific options. Done just for Mac OS X so
far. Using the Linux options for Mac OS X caused visibility tests to
silently and misleadingly fail.
Yes, it is silly to now define some platform-specific options in three
places: configure.in, solenv/inc/* for the old build system, and
solenv/gbuild/platform/* for gbuild.
At least with my Xcode3 installation, I need to pass an -isysroot flag
pointing to the SDK when running $CC -E, otherwise headers weren't
found. This was then misinterpreted as the visibility tests failing.
Pass -DHAVE_GCC_VISIBILITY_FEATURE to the compiler if configure
detected visibility working. In that case also pass
-fvisibility=hidden. HAVE_GCC_VISIBILITY_FEATURE being defined is
supposed to mean that the -fvisibility=hidden option is used, I think.
Pass also -fvisibility-inlines-hidden if that was detected to work.
Change-Id: I I I58d566fcb07584246e91f45e683ce9b31208edba
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/gbuild/platform/macosx.mk | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk index 9241cdac3a5d..5ad4f3d105b5 100644 --- a/solenv/gbuild/platform/macosx.mk +++ b/solenv/gbuild/platform/macosx.mk @@ -47,9 +47,23 @@ gb_OSDEFS := \ $(EXTRA_CDEFS) \ +ifeq ($(HAVE_GCC_VISIBILITY_FEATURE),TRUE) gb_COMPILERDEFS += \ -DHAVE_GCC_VISIBILITY_FEATURE \ +gb_CFLAGS += \ + -fvisibility=hidden + +gb_CXXFLAGS += \ + -fvisibility=hidden \ + +ifneq ($(HAVE_GCC_VISIBILITY_BROKEN),TRUE) +gb_CXXFLAGS += \ + -fvisibility-inlines-hidden \ + +endif + +endif ifeq ($(HAVE_SFINAE_ANONYMOUS_BROKEN),TRUE) gb_COMPILERDEFS += \ |