diff configure.in @ 4604:d7535d7a40ea

Integrate XFixes and XDamage into the build system.
author Sunny Sachanandani <sunnysachanandani@gmail.com>
date Mon, 19 Jul 2010 20:05:53 +0530
parents 87a2d87786d4
children 844b5ef4b149
line wrap: on
line diff
--- a/configure.in	Mon Jul 19 18:57:02 2010 +0530
+++ b/configure.in	Mon Jul 19 20:05:53 2010 +0530
@@ -1055,7 +1055,9 @@
                     xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
                     xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
                     xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
-                    ;;
+                    xdamage_lib=[`find_lib "libXdamage.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
+                    xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
+;;
             esac
 
             if test x$ac_cv_func_shmat != xyes; then
@@ -1222,14 +1224,50 @@
             if test x$definitely_enable_video_x11_xrender = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRENDER)
             fi
-
+            AC_ARG_ENABLE(video-x11-xdamage-xfixes,
+AC_HELP_STRING([--enable-video-x11-xdamage-xfixes], [enable X11 Xdamage and Xfixes extensions [[default=yes]]]),
+                            , enable_video_x11_xdamage=yes)
+            if test x$enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xrender = xyes ; then
+                AC_CHECK_HEADER(X11/extensions/Xdamage.h,
+                                have_xdamage_h_hdr=yes,
+                                have_xdamage_h_hdr=no,
+                                [#include <X11/Xlib.h>
+                                ])
+                AC_CHECK_HEADER(X11/extensions/Xfixes.h,
+                                have_xfixes_h_hdr=yes,
+                                have_xfixes_h_hdr=no,
+                                [#include <X11/Xlib.h>
+                                ])
+                if test x$have_xdamage_h_hdr = xyes && test x$have_xfixes_h_hdr = xyes ; then
+                    if test x$enable_x11_shared = xyes && test x$xdamage_lib != x && test x$xfixes_lib != x ; then
+                        echo "-- dynamic libXdamage -> $xdamage_lib"
+                        echo "-- dynamic libXfixes -> $xfixes_lib"
+                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XDAMAGE, "$xdamage_lib")
+                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib")
+                        definitely_enable_video_x11_xdamage=yes
+                        definitely_enable_video_x11_xfixes=yes
+                    else
+                        AC_CHECK_LIB(Xdamage, XDamageQueryExtension, have_xdamage_lib=yes)
+                        AC_CHECK_LIB(Xfixes, XFixesQueryExtension, have_xfixes_lib=yes)
+                        if test x$have_xdamage_lib = xyes && test x$have_xfixes_lib = xyes ; then
+                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXdamage -lXfixes"
+                            definitely_enable_video_x11_xdamage=yes
+                            definitely_enable_video_x11_xfixes=yes
+                        fi
+                    fi
+                fi
+            fi
+            if test x$definitely_enable_video_x11_xdamage = xyes && test x$definitely_enable_video_x11_xfixes = xyes ; then
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDAMAGE)
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES)
+            fi
             AC_ARG_ENABLE(render-x11,
 AC_HELP_STRING([--enable-render-x11], [enable the X11 render driver [[default=yes]]]),
                                 , enable_render_x11=yes)
             if test x$enable_render_x11 = xyes; then
                 AC_DEFINE(SDL_VIDEO_RENDER_X11)
             fi
-        fi
+       fi
     fi
 }