1
0
Эх сурвалжийг харах

Added -fvisibility=hidden support, for builds by gcc4 and later.
All the sordid reasons for this are laid out here:

http://gcc.gnu.org/wiki/Visibility

Ryan C. Gordon 20 жил өмнө
parent
commit
5d26eca4a4
3 өөрчлөгдсөн 28 нэмэгдсэн , 3 устгасан
  1. 1 0
      CHANGELOG
  2. 25 3
      configure.in
  3. 2 0
      physfs.h

+ 1 - 0
CHANGELOG

@@ -2,6 +2,7 @@
  * CHANGELOG.
  * CHANGELOG.
  */
  */
 
 
+03232006 - Added -fvisibility for gcc4 (http://gcc.gnu.org/wiki/Visibility)
 01012006 - Cleaned up overflow checks in platform memory allocators (thanks to
 01012006 - Cleaned up overflow checks in platform memory allocators (thanks to
            Nicolas Lebedenco for pointing out the original issue with
            Nicolas Lebedenco for pointing out the original issue with
            long long literals). Added physfs.rc (thanks, Dennis!). Changed my
            long long literals). Added physfs.rc (thanks, Dennis!). Changed my

+ 25 - 3
configure.in

@@ -68,19 +68,41 @@ AC_ARG_ENABLE(debug,
                 , enable_debug=no)
                 , enable_debug=no)
 if test x$enable_debug = xyes; then
 if test x$enable_debug = xyes; then
   if test x$ac_cv_prog_cc_g = xyes; then
   if test x$ac_cv_prog_cc_g = xyes; then
-    PHYSFSCFLAGS="-g -O0"
+    PHYSFSCFLAGS="$PHYSFSCFLAGS -g -O0"
   else
   else
-    PHYSFSCFLAGS="-O0"
+    PHYSFSCFLAGS="$PHYSFSCFLAGS -O0"
   fi
   fi
   PHYSFSCFLAGS="$PHYSFSCFLAGS -Werror -Wall"
   PHYSFSCFLAGS="$PHYSFSCFLAGS -Werror -Wall"
   AC_DEFINE([DEBUG], 1, [define if debug build is enabled])
   AC_DEFINE([DEBUG], 1, [define if debug build is enabled])
   AC_DEFINE([DEBUG_CHATTER], 1, [define if debug chatter is enabled])
   AC_DEFINE([DEBUG_CHATTER], 1, [define if debug chatter is enabled])
 else
 else
-  PHYSFSCFLAGS="-O2"
+  PHYSFSCFLAGS="$PHYSFSCFLAGS -O2"
   AC_DEFINE([NDEBUG], 1, [define if debug build is disabled])
   AC_DEFINE([NDEBUG], 1, [define if debug build is disabled])
 fi
 fi
 
 
 
 
+dnl ---------------------------------------------------------------------
+dnl Have GCC's -fvisibility option?
+dnl ---------------------------------------------------------------------
+AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
+have_gcc_fvisibility=no
+visibility_CFLAGS="-fvisibility=hidden"
+save_CFLAGS="$CFLAGS"
+CFLAGS="$save_CFLAGS $visibility_CFLAGS"
+AC_TRY_COMPILE([
+int placeholder = 1;
+],[
+],[
+have_gcc_fvisibility=yes
+])
+AC_MSG_RESULT($have_gcc_fvisibility)
+CFLAGS="$save_CFLAGS"
+
+if test x$have_gcc_fvisibility = xyes; then
+    PHYSFSCFLAGS="$PHYSFSCFLAGS $visibility_CFLAGS"
+fi
+
+
 dnl ---------------------------------------------------------------------
 dnl ---------------------------------------------------------------------
 dnl Profile sorts, etc?
 dnl Profile sorts, etc?
 dnl ---------------------------------------------------------------------
 dnl ---------------------------------------------------------------------

+ 2 - 0
physfs.h

@@ -166,6 +166,8 @@ extern "C" {
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
 #if (defined _MSC_VER)
 #if (defined _MSC_VER)
 #define __EXPORT__ __declspec(dllexport)
 #define __EXPORT__ __declspec(dllexport)
+#elif (defined __GNUC__)
+#define __EXPORT__ __attribute__((visibility("default")))
 #else
 #else
 #define __EXPORT__
 #define __EXPORT__
 #endif
 #endif