Skip to content

Commit

Permalink
Default the X11 dynamically loading on if the OS loader loads libraries
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Jun 23, 2006
1 parent 77799d9 commit 9ce0dd7
Showing 1 changed file with 25 additions and 16 deletions.
41 changes: 25 additions & 16 deletions configure.in
Expand Up @@ -813,12 +813,18 @@ AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
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'
Expand All @@ -837,27 +843,27 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ye
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
;;
Expand All @@ -873,13 +879,16 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ye
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
Expand Down

0 comments on commit 9ce0dd7

Please sign in to comment.