diff configure.in @ 524:a0bb7a9c05b1

Added -fvisibility=hidden support.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 06 Aug 2007 09:41:58 +0000
parents 46d5f399cb35
children a116d8f628a0
line wrap: on
line diff
--- a/configure.in	Mon Aug 06 09:40:31 2007 +0000
+++ b/configure.in	Mon Aug 06 09:41:58 2007 +0000
@@ -66,17 +66,38 @@
               , enable_debug=no)
 if test x$enable_debug = xyes; then
   if test x$ac_cv_prog_cc_g = xyes; then
-    CFLAGS="-g -O0"
+    SDLSOUNDCFLAGS="$SDLSOUNDCFLAGS -g -O0"
   else
-    CFLAGS="-O0"
+    SDLSOUNDCFLAGS="$SDLSOUNDCFLAGS -O0"
   fi
-  CFLAGS="$CFLAGS -Werror"
+  SDLSOUNDCFLAGS="$SDLSOUNDCFLAGS -Werror"
   AC_DEFINE(DEBUG, 1, [Define for debug builds.])
   AC_DEFINE(DEBUG_CHATTER, 1, [Define for debug build chattering.])
 else
   AC_DEFINE(NDEBUG, 1, [Define to disable debugging.])
 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
+    SDLSOUNDCFLAGS="$SDLSOUNDCFLAGS $visibility_CFLAGS"
+fi
+
 
 dnl ---------------------------------------------------------------------
 dnl Checks for libraries.
@@ -88,7 +109,7 @@
             :,
  	     AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
 )
-CFLAGS="$CFLAGS $SDL_CFLAGS"
+SDLSOUNDCFLAGS="$SDLSOUNDCFLAGS $SDL_CFLAGS"
 LIBS="$LIBS $SDL_LIBS"
 
 
@@ -235,7 +256,6 @@
   fi
 
   if test x$have_vorbis = xyes; then
-    CFLAGS="$CFLAGS"
     LIBS="$LIBS -logg -lvorbis -lvorbisfile"
     AC_DEFINE(SOUND_SUPPORTS_OGG, 1, [Define if OGG support is desired.])
   fi
@@ -324,6 +344,8 @@
 AC_FUNC_MEMCMP
 AC_CHECK_FUNCS([memset strrchr setbuf])
 
+CFLAGS="$SDLSOUNDCFLAGS $CFLAGS -D_REENTRANT -D_THREAD_SAFE"
+
 dnl Add Makefile conditionals
 AM_CONDITIONAL(USE_TIMIDITY, test x$enable_midi = xyes)
 AM_CONDITIONAL(USE_MPGLIB, test x$enable_mpglib = xyes)