Make Solaris Studio hide internal shared library symbols by default
authorrbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 2 Mar 2013 22:11:26 +0000 (22:11 +0000)
committerrbalint <rbalint@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 2 Mar 2013 22:11:26 +0000 (22:11 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@48020 f5534014-38df-0310-8fa8-9805f1628bb7

CMakeLists.txt
configure.ac
ws_symbol_export.h

index d00a66be27171aebc814fc5336450e077fee11b9..3cdce2ad81af6157c4cf259004dc421fa8668942 100644 (file)
@@ -218,8 +218,13 @@ check_c_compiler_flag(-fvisibility=hidden FVHIDDEN)
 if((FVHIDDEN))
        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
 else() # TODO add alternate compiler flags for hiding symbols
-       message(WARNING "Hiding shared library symbols is not supported by the compiler."
+       check_c_compiler_flag(-xldscope=hidden FVHIDDEN)
+       if((FVHIDDEN))
+               set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+       else()
+               message(WARNING "Hiding shared library symbols is not supported by the compiler."
                " All shared library symbols will be exported.")
+       endif()
 endif()
 
 if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_GCC_CHECKS)
index 2d8d9f2465f3bb8ef40e30f685cad4116146d3cd..344737308f26b523acbdf21a370b0d48e996423c 100644 (file)
@@ -521,10 +521,12 @@ fi
 
 CFLAGS_before_fvhidden=$CFLAGS
 AC_WIRESHARK_GCC_CFLAGS_CHECK(-fvisibility=hidden)
-if test "x$CLFAGS" = "x$CFLAGS_before_fvhidden"
-then
+if test "x$CLFAGS" = "x$CFLAGS_before_fvhidden" ; then
+       AC_WIRESHARK_GCC_CFLAGS_CHECK(-xldscope=hidden)
        # TODO add other ways of hiding symbols
-       AC_MSG_WARN(Compiler will export all symbols from shared libraries)
+       if test "x$CLFAGS" = "x$CFLAGS_before_fvhidden" ; then
+               AC_MSG_WARN(Compiler will export all symbols from shared libraries)
+       fi
 fi
 
 AC_WIRESHARK_LDFLAGS_CHECK([-Wl,--as-needed])
index ac9b97305316812e9c01934a312b37ad88282ae5..d85efba188e878bbd38a505a7cd935fd8aae9a91 100644 (file)
@@ -24,7 +24,7 @@
 #define SYMBOL_EXPORT_H
 
 /* Originally copied from GCC Wiki at http://gcc.gnu.org/wiki/Visibility */
-#if defined _WIN32 || defined __CYGWIN__
+#if defined _WIN32 || defined __CYGWIN__ || defined __SUNPRO_C || defined__SUNPRO_CC
   #ifdef WS_BUILD_DLL
     #ifdef __GNUC__
 #define WS_DLL_PUBLIC __attribute__ ((dllexport))