SDL: autotools needs to check d3d12sdklayers.h too

From 5e876db89f06a477187242e4b9c7bf65e18a6b9b Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 28 May 2024 17:02:26 +0200
Subject: [PATCH] autotools needs to check d3d12sdklayers.h too

---
 configure    | 29 ++++++++++++++++++++++++-----
 configure.ac |  9 ++++++++-
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index bce0832653552..7e559cbb459a1 100755
--- a/configure
+++ b/configure
@@ -19218,15 +19218,13 @@ then :
   ac_cv_func_alloca_works=yes
 else $as_nop
   ac_cv_func_alloca_works=no
-
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.beam \
     conftest$ac_exeext conftest.$ac_ext
 fi
-
-fi
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
 printf "%s\n" "$ac_cv_func_alloca_works" >&6; }
+fi
 
 if test $ac_cv_func_alloca_works = yes; then
 
@@ -27600,11 +27598,32 @@ then :
   have_d3d11=yes
 fi
 
-        ac_fn_c_check_header_compile "$LINENO" "d3d12.h" "ac_cv_header_d3d12_h" "$ac_includes_default"
-if test "x$ac_cv_header_d3d12_h" = xyes
+        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compatible d3d12 headers" >&5
+printf %s "checking for compatible d3d12 headers... " >&6; }
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <d3d12.h>
+#include <d3d12sdklayers.h>
+ID3D12Device1 *device;
+
+int
+main (void)
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
 then :
   have_d3d12=yes
+else $as_nop
+  have_d3d12=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_d3d12" >&5
+printf "%s\n" "$have_d3d12" >&6; }
 
         ac_fn_c_check_header_compile "$LINENO" "ddraw.h" "ac_cv_header_ddraw_h" "$ac_includes_default"
 if test "x$ac_cv_header_ddraw_h" = xyes
diff --git a/configure.ac b/configure.ac
index 14d8e11ad0756..46c17dc3b5bf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3350,7 +3350,14 @@ CheckDIRECTX()
     if test x$enable_directx = xyes; then
         AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
         AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
-        AC_CHECK_HEADER(d3d12.h, have_d3d12=yes)
+        AC_MSG_CHECKING(for compatible d3d12 headers)
+        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <d3d12.h>
+#include <d3d12sdklayers.h>
+ID3D12Device1 *device;
+            ]])], [have_d3d12=yes],[have_d3d12=no])
+        AC_MSG_RESULT($have_d3d12)
+
         AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
         AC_CHECK_HEADER(dsound.h, have_dsound=yes)
         AC_CHECK_HEADER(dinput.h, have_dinput=yes)