diff configure.in @ 1700:21184e1d04c3 SDL-1.3

Merged dynamic X11 fix from SDL 1.2
author Sam Lantinga <slouken@libsdl.org>
date Fri, 23 Jun 2006 08:40:46 +0000
parents 393092a3ebf6
children 865ba39fc96d
line wrap: on
line diff
--- a/configure.in	Wed Jun 21 08:26:43 2006 +0000
+++ b/configure.in	Fri Jun 23 08:40:46 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,10 +879,21 @@
             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$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
+            fi
+
             if test x$have_loadso = xyes && \
                test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
                 echo "-- dynamic libX11 -> $x11_lib"