Skip to content

Commit

Permalink
Try to use -fvisibility=hidden on gcc4 and later.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Jan 5, 2010
1 parent 8826199 commit dfe32da
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions configure.in
Expand Up @@ -144,6 +144,33 @@ $srcdir/music.c"
dnl set this to use on systems that use lib64 instead of lib
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`

dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden()
{
AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
have_gcc_fvisibility=no

visibility_CFLAGS="-fvisibility=hidden"
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
AC_TRY_COMPILE([
#if !defined(__GNUC__) || __GNUC__ < 4
#error SDL only uses visibility attributes in GCC 4 or newer
#endif
],[
],[
have_gcc_fvisibility=yes
])
AC_MSG_RESULT($have_gcc_fvisibility)
CFLAGS="$save_CFLAGS"

if test x$have_gcc_fvisibility = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
fi
}


dnl Function to find a library in the compiler search path
find_lib()
{
Expand Down Expand Up @@ -178,6 +205,8 @@ AC_CHECK_LIB(m, pow, [LIBM="-lm"])

dnl Check command-line options

CheckVisibilityHidden

AC_ARG_ENABLE([music-cmd],
AC_HELP_STRING([--enable-music-cmd], [support an external music player [[default=yes]]]),
[], [enable_music_cmd=detect])
Expand Down

0 comments on commit dfe32da

Please sign in to comment.