Merged dynamic X11 fix from SDL 1.2 SDL-1.3
authorSam Lantinga
Fri, 23 Jun 2006 08:40:46 +0000
branchSDL-1.3
changeset 170021184e1d04c3
parent 1699 4ce6deb843c5
child 1701 442248d4e738
Merged dynamic X11 fix from SDL 1.2
configure.in
     1.1 --- a/configure.in	Wed Jun 21 08:26:43 2006 +0000
     1.2 +++ b/configure.in	Fri Jun 23 08:40:46 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,10 +879,21 @@
    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 +            if test x$x11_symbols_private != xyes && \
    1.78 +               test x$enable_x11_shared = xyes; then
    1.79 +                AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
    1.80 +                enable_x11_shared=no
    1.81 +            fi
    1.82 +
    1.83              if test x$have_loadso = xyes && \
    1.84                 test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
    1.85                  echo "-- dynamic libX11 -> $x11_lib"