Default the X11 dynamically loading on if the OS loader loads libraries
authorSam Lantinga
Fri, 23 Jun 2006 08:39:05 +0000
changeset 1879cb232e63552c
parent 1878 d7c9d7f42881
child 1880 9d940db55a91
Default the X11 dynamically loading on if the OS loader loads libraries
with their private symbols hidden. If that isn't the case, and someone
tries to enable it anyway, spit out a warning and don't let them do it.
configure.in
     1.1 --- a/configure.in	Fri Jun 23 08:35:48 2006 +0000
     1.2 +++ b/configure.in	Fri Jun 23 08:39:05 2006 +0000
     1.3 @@ -813,12 +813,18 @@
     1.4          AC_PATH_X
     1.5          AC_PATH_XTRA
     1.6          if test x$have_x = xyes; then
     1.7 +            # Only allow dynamically loaded X11 if the X11 function pointers
     1.8 +            # will not end up in the global namespace, which causes problems
     1.9 +            # with other libraries calling X11 functions.
    1.10 +            x11_symbols_private=$have_gcc_fvisibility
    1.11 +
    1.12              AC_ARG_ENABLE(x11-shared,
    1.13 -AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=yes]]]),
    1.14 -                          , enable_x11_shared=yes)
    1.15 +AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
    1.16 +                          , enable_x11_shared=maybe)
    1.17  
    1.18              case "$host" in
    1.19                  *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
    1.20 +                    x11_symbols_private=yes
    1.21                      x11_lib='/usr/X11R6/lib/libX11.6.dylib'
    1.22                      x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
    1.23                      xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
    1.24 @@ -837,27 +843,27 @@
    1.25                      for path in $x11_lib_path /usr/lib /usr/X11/lib /usr/X11R6/lib; do
    1.26                          if test "x$x11_lib" = "x"; then
    1.27                              x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.28 -							if test "x$x11_lib" = "x"; then
    1.29 -								x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.30 -							fi
    1.31 +                            if test "x$x11_lib" = "x"; then
    1.32 +                                x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.33 +                            fi
    1.34                          fi
    1.35                          if test "x$x11ext_lib" = "x"; then
    1.36                              x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.37 -							if test "x$x11ext_lib" = "x"; then
    1.38 -								x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.39 -							fi
    1.40 +                            if test "x$x11ext_lib" = "x"; then
    1.41 +                                x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.42 +                            fi
    1.43                          fi
    1.44                          if test "x$xrender_lib" = "x"; then
    1.45                              xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.46 -							if test "x$xrender_lib" = "x"; then
    1.47 -								xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.48 -							fi
    1.49 +                            if test "x$xrender_lib" = "x"; then
    1.50 +                                xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.51 +                            fi
    1.52                          fi
    1.53                          if test "x$xrandr_lib" = "x"; then
    1.54                              xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.55 -							if test "x$xrandr_lib" = "x"; then
    1.56 -								xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.57 -							fi
    1.58 +                            if test "x$xrandr_lib" = "x"; then
    1.59 +                                xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
    1.60 +                            fi
    1.61                          fi
    1.62                      done
    1.63                      ;;
    1.64 @@ -873,13 +879,16 @@
    1.65              AC_DEFINE(SDL_VIDEO_DRIVER_X11)
    1.66              SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
    1.67              EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
    1.68 +
    1.69 +            if test x$enable_x11_shared = xmaybe; then
    1.70 +                enable_x11_shared=$x11_symbols_private
    1.71 +            fi
    1.72              if test x$have_loadso != xyes && \
    1.73                 test x$enable_x11_shared = xyes; then
    1.74                  AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
    1.75                  enable_x11_shared=no
    1.76              fi
    1.77 -
    1.78 -            if test x$have_gcc_fvisibility != xyes && \
    1.79 +            if test x$x11_symbols_private != xyes && \
    1.80                 test x$enable_x11_shared = xyes; then
    1.81                  AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
    1.82                  enable_x11_shared=no