diff configure.in @ 2763:6fc50bdd88c0

Some cleanups on the new XInput code. One or two things got moved around, but largely this is hooked up correctly in the Unix configure system now: it can be dynamically loaded and fallback gracefully if not available, or libXi can be directly linked to libSDL. XInput support can be --disable'd from the configure script, too (defaults to enabled). Please note that while the framework is in place to gracefully fallback, the current state of the source requires XInput. We'll need to adjust a few things still to correct this.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 17 Sep 2008 08:20:57 +0000
parents 50bc882455e5
children 6d7baec32718
line wrap: on
line diff
--- a/configure.in	Mon Sep 15 20:48:51 2008 +0000
+++ b/configure.in	Wed Sep 17 08:20:57 2008 +0000
@@ -989,6 +989,7 @@
                     x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
                     xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
                     xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
+                    xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
                     ;;
                 *-*-osf*)
                     x11_lib='libX11.so'
@@ -1025,6 +1026,12 @@
                                 xrandr_lib=[`ls -- $path/libXrandr.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
                             fi
                         fi
+                        if test "x$xinput_lib" = "x"; then
+                            xinput_lib=[`ls -- $path/libXi.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
+                            if test "x$xinput_lib" = "x"; then
+                                xinput_lib=[`ls -- $path/libXi.so.[0-9]* 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
+                            fi
+                        fi
                     done
                     ;;
             esac
@@ -1041,9 +1048,6 @@
             SOURCES="$SOURCES $srcdir/src/video/Xext/XmuStdCmap/*.c"
             EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
 
-echo "FIXME: Need to get dynamic loading of XInput working"
-	    enable_x11_shared=no
-
             if test x$enable_x11_shared = xmaybe; then
                 enable_x11_shared=$x11_symbols_private
             fi
@@ -1066,7 +1070,7 @@
                 AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib")
             else
                 enable_x11_shared=no
-                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext -lXi"
+                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
             fi
             have_video=yes
 
@@ -1128,6 +1132,33 @@
             if test x$definitely_enable_video_x11_xrandr = xyes; then
                 AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR)
             fi
+            AC_ARG_ENABLE(video-x11-xinput,
+AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
+                            , enable_video_x11_xinput=yes)
+            if test x$enable_video_x11_xinput = xyes; then
+                definitely_enable_video_x11_xinput=no
+                AC_CHECK_HEADER(X11/extensions/XInput.h,
+                                have_xinput_h_hdr=yes,
+                                have_xinput_h_hdr=no,
+                                [#include <X11/Xlib.h>
+                                ])
+                if test x$have_xinput_h_hdr = xyes; then
+                    if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
+                        echo "-- dynamic libXi -> $xinput_lib"
+                        AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT, "$xinput_lib")
+                        definitely_enable_video_x11_xinput=yes
+                    else
+                        AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
+                        if test x$have_xinput_lib = xyes ; then
+                            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
+                            definitely_enable_video_x11_xinput=yes
+                        fi
+                    fi
+                fi
+            fi
+            if test x$definitely_enable_video_x11_xinput = xyes; then
+                AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT)
+            fi
             AC_ARG_ENABLE(video-x11-dpms,
 AC_HELP_STRING([--enable-video-x11-dpms], [enable X11 DPMS extension [[default=yes]]]),
                             , enable_video_x11_dpms=yes)