From a24a980424ec2ec81b13c8e5a95394d62cbf7406 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 10 May 2012 22:59:30 +0300 Subject: 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 --- solenv/gbuild/platform/macosx.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'solenv') 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 += \ -- cgit