Commit 802e17aad9ee5e555dfd95fd89ffc1ac414de9cf

Ozkan Sezer 2021-11-03T20:35:20

autotools: added windows.gaming.input.h (and SDL_JOYSTICK_WGI) detection

diff --git a/configure b/configure
index 7699078..c87dc3d 100755
--- a/configure
+++ b/configure
@@ -24071,6 +24071,18 @@ $as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h
         fi
     fi
 
+    ac_fn_c_check_header_mongrel "$LINENO" "windows.gaming.input.h" "ac_cv_header_windows_gaming_input_h" "$ac_includes_default"
+if test "x$ac_cv_header_windows_gaming_input_h" = xyes; then :
+  have_wgi=yes
+fi
+
+
+    if test x$have_wgi = xyes; then
+
+$as_echo "#define HAVE_WINDOWS_GAMING_INPUT_H 1" >>confdefs.h
+
+    fi
+
     ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
 if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
   have_wasapi=yes
@@ -25238,12 +25250,17 @@ $as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h
 
 $as_echo "#define SDL_JOYSTICK_RAWINPUT 1" >>confdefs.h
 
-            if test x$have_dinput = xyes -o x$have_xinput = xyes; then
+            if test x$have_dinput = xyes -o x$have_xinput = xyes -o x$have_wgi = xyes; then
                 if test x$have_xinput = xyes; then
 
 $as_echo "#define SDL_JOYSTICK_XINPUT 1" >>confdefs.h
 
                 fi
+                if test x$have_wgi = xyes; then
+
+$as_echo "#define SDL_JOYSTICK_WGI 1" >>confdefs.h
+
+                fi
                 if test x$have_dinput = xyes; then
 
 $as_echo "#define SDL_JOYSTICK_DINPUT 1" >>confdefs.h
diff --git a/configure.ac b/configure.ac
index b61d3f1..bec63a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3199,6 +3199,11 @@ XINPUT_STATE_EX s1;
         fi
     fi
 
+    AC_CHECK_HEADER(windows.gaming.input.h, have_wgi=yes)
+    if test x$have_wgi = xyes; then
+        AC_DEFINE(HAVE_WINDOWS_GAMING_INPUT_H, 1, [ ])
+    fi
+
     AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
     if test x$have_wasapi = xyes; then
         AC_DEFINE(HAVE_MMDEVICEAPI_H, 1, [ ])
@@ -3846,10 +3851,13 @@ case "$host" in
         # Set up files for the joystick library
         if test x$enable_joystick = xyes; then
             AC_DEFINE(SDL_JOYSTICK_RAWINPUT, 1, [ ])
-            if test x$have_dinput = xyes -o x$have_xinput = xyes; then
+            if test x$have_dinput = xyes -o x$have_xinput = xyes -o x$have_wgi = xyes; then
                 if test x$have_xinput = xyes; then
                     AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ])
                 fi
+                if test x$have_wgi = xyes; then
+                    AC_DEFINE(SDL_JOYSTICK_WGI, 1, [ ])
+                fi
                 if test x$have_dinput = xyes; then
                     AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
                     EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 0bb904c..51731b4 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -232,6 +232,7 @@
 #undef HAVE_DINPUT_H
 #undef HAVE_DSOUND_H
 #undef HAVE_DXGI_H
+#undef HAVE_WINDOWS_GAMING_INPUT_H
 #undef HAVE_XINPUT_H
 
 #undef HAVE_MMDEVICEAPI_H
@@ -307,6 +308,7 @@
 #undef SDL_INPUT_WSCONS
 #undef SDL_JOYSTICK_HAIKU
 #undef SDL_JOYSTICK_DINPUT
+#undef SDL_JOYSTICK_WGI
 #undef SDL_JOYSTICK_XINPUT
 #undef SDL_JOYSTICK_DUMMY
 #undef SDL_JOYSTICK_IOKIT