Added support for gcc4's -fvisibility=hidden option.
authorRyan C. Gordon <icculus@icculus.org>
Wed, 22 Mar 2006 01:28:36 +0000
changeset 15732422ca15ba42
parent 1572 3a8920cc822b
child 1574 0fd72308659e
Added support for gcc4's -fvisibility=hidden option.

Fixes Bugzilla #169.
configure.in
include/begin_code.h
     1.1 --- a/configure.in	Tue Mar 21 16:04:44 2006 +0000
     1.2 +++ b/configure.in	Wed Mar 22 01:28:36 2006 +0000
     1.3 @@ -699,6 +699,31 @@
     1.4      fi
     1.5  }
     1.6  
     1.7 +dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
     1.8 +dnl  Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
     1.9 +CheckVisibilityHidden()
    1.10 +{
    1.11 +    AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
    1.12 +    have_gcc_fvisibility=no
    1.13 +
    1.14 +    visibility_CFLAGS="-fvisibility=hidden"
    1.15 +    save_CFLAGS="$CFLAGS"
    1.16 +    CFLAGS="$save_CFLAGS $visibility_CFLAGS"
    1.17 +    AC_TRY_COMPILE([
    1.18 +        int placeholder = 1;
    1.19 +    ],[
    1.20 +    ],[
    1.21 +    have_gcc_fvisibility=yes
    1.22 +    ])
    1.23 +    AC_MSG_RESULT($have_gcc_fvisibility)
    1.24 +    CFLAGS="$save_CFLAGS"
    1.25 +
    1.26 +    if test x$have_gcc_fvisibility = xyes; then
    1.27 +        EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS -DDECLSPEC=SDL_GCC_ATTR_VIS_DEFAULT"
    1.28 +    fi
    1.29 +}
    1.30 +
    1.31 +
    1.32  dnl Do the iPod thing
    1.33  CheckIPod()
    1.34  {
    1.35 @@ -1967,6 +1992,7 @@
    1.36              *-*-aix*)           ARCH=aix ;;
    1.37              *-*-osf*)           ARCH=osf ;;
    1.38          esac
    1.39 +        CheckVisibilityHidden
    1.40          CheckDummyVideo
    1.41          CheckDiskAudio
    1.42          CheckDummyAudio
     2.1 --- a/include/begin_code.h	Tue Mar 21 16:04:44 2006 +0000
     2.2 +++ b/include/begin_code.h	Wed Mar 22 01:28:36 2006 +0000
     2.3 @@ -31,6 +31,10 @@
     2.4  #endif
     2.5  #define _begin_code_h
     2.6  
     2.7 +#ifdef __GNUC__
     2.8 +#define SDL_GCC_ATTR_VIS_DEFAULT __attribute__((visibility("default")))
     2.9 +#endif
    2.10 +
    2.11  /* Some compilers use a special export keyword */
    2.12  #ifndef DECLSPEC
    2.13  # ifdef __BEOS__