changeset 1879:cb232e63552c

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.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 23 Jun 2006 08:39:05 +0000
parents d7c9d7f42881
children 9d940db55a91
files configure.in
diffstat 1 files changed, 25 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Fri Jun 23 08:35:48 2006 +0000
+++ b/configure.in	Fri Jun 23 08:39:05 2006 +0000
@@ -813,12 +813,18 @@
         AC_PATH_X
         AC_PATH_XTRA
         if test x$have_x = xyes; then
+            # Only allow dynamically loaded X11 if the X11 function pointers
+            # will not end up in the global namespace, which causes problems
+            # with other libraries calling X11 functions.
+            x11_symbols_private=$have_gcc_fvisibility
+
             AC_ARG_ENABLE(x11-shared,
-AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=yes]]]),
-                          , enable_x11_shared=yes)
+AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
+                          , enable_x11_shared=maybe)
 
             case "$host" in
                 *-*-darwin*) # Latest Mac OS X actually ships with Xrandr/Xrender libs...
+                    x11_symbols_private=yes
                     x11_lib='/usr/X11R6/lib/libX11.6.dylib'
                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
@@ -837,27 +843,27 @@
                     for path in $x11_lib_path /usr/lib /usr/X11/lib /usr/X11R6/lib; do
                         if test "x$x11_lib" = "x"; then
                             x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							if test "x$x11_lib" = "x"; then
-								x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							fi
+                            if test "x$x11_lib" = "x"; then
+                                x11_lib=[`ls -- $path/libX11.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
+                            fi
                         fi
                         if test "x$x11ext_lib" = "x"; then
                             x11ext_lib=[`ls -- $path/libXext.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							if test "x$x11ext_lib" = "x"; then
-								x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							fi
+                            if test "x$x11ext_lib" = "x"; then
+                                x11ext_lib=[`ls -- $path/libXext.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
+                            fi
                         fi
                         if test "x$xrender_lib" = "x"; then
                             xrender_lib=[`ls -- $path/libXrender.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							if test "x$xrender_lib" = "x"; then
-								xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							fi
+                            if test "x$xrender_lib" = "x"; then
+                                xrender_lib=[`ls -- $path/libXrender.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
+                            fi
                         fi
                         if test "x$xrandr_lib" = "x"; then
                             xrandr_lib=[`ls -- $path/libXrandr.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							if test "x$xrandr_lib" = "x"; then
-								xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
-							fi
+                            if test "x$xrandr_lib" = "x"; then
+                                xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
+                            fi
                         fi
                     done
                     ;;
@@ -873,13 +879,16 @@
             AC_DEFINE(SDL_VIDEO_DRIVER_X11)
             SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
+
+            if test x$enable_x11_shared = xmaybe; then
+                enable_x11_shared=$x11_symbols_private
+            fi
             if test x$have_loadso != xyes && \
                test x$enable_x11_shared = xyes; then
                 AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
                 enable_x11_shared=no
             fi
-
-            if test x$have_gcc_fvisibility != xyes && \
+            if test x$x11_symbols_private != xyes && \
                test x$enable_x11_shared = xyes; then
                 AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
                 enable_x11_shared=no