From c0bb39e5e9f3504ba6b70bfbaff04e9d9dba86e9 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 2 Apr 2022 02:50:02 +0300
Subject: [PATCH] check for HAVE_ROAPI_H in cmake and autotools, and
update SDL_config_windows.h and SDL_config_winrt.h
---
CMakeLists.txt | 1 +
configure | 35 ++++++++++++++++++++++++-----------
configure.ac | 14 ++++++++++----
include/SDL_config.h.cmake | 1 +
include/SDL_config.h.in | 1 +
include/SDL_config_windows.h | 1 +
include/SDL_config_winrt.h | 2 ++
7 files changed, 40 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6ca97b7c7cd..b0dce6b8be9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1600,6 +1600,7 @@ elseif(WINDOWS)
# headers needed elsewhere
check_include_file(tpcshrd.h HAVE_TPCSHRD_H)
+ check_include_file(roapi.h HAVE_ROAPI_H)
check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
diff --git a/configure b/configure
index 7611d78da55..3bf0e00b65d 100755
--- a/configure
+++ b/configure
@@ -24779,6 +24779,30 @@ $as_echo "$have_wince" >&6; }
# This fixes Windows stack alignment with newer GCC
CheckStackBoundary
+
+ # headers needed elsewhere
+ ac_fn_c_check_header_mongrel "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default"
+if test "x$ac_cv_header_tpcshrd_h" = xyes; then :
+ have_tpcshrd_h=yes
+fi
+
+
+ if test x$have_tpcshrd_h = xyes; then
+
+$as_echo "#define HAVE_TPCSHRD_H 1" >>confdefs.h
+
+ fi
+ ac_fn_c_check_header_mongrel "$LINENO" "roapi.h" "ac_cv_header_roapi_h" "$ac_includes_default"
+if test "x$ac_cv_header_roapi_h" = xyes; then :
+ have_roapi_h=yes
+fi
+
+
+ if test x$have_roapi_h = xyes; then
+
+$as_echo "#define HAVE_ROAPI_H 1" >>confdefs.h
+
+ fi
}
CheckOS2()
@@ -26255,17 +26279,6 @@ $as_echo "#define SDL_HAPTIC_DINPUT 1" >>confdefs.h
have_haptic=yes
fi
fi
- ac_fn_c_check_header_mongrel "$LINENO" "tpcshrd.h" "ac_cv_header_tpcshrd_h" "$ac_includes_default"
-if test "x$ac_cv_header_tpcshrd_h" = xyes; then :
- have_tpcshrd_h=yes
-fi
-
-
- if test x$have_tpcshrd_h = xyes; then
-
-$as_echo "#define HAVE_TPCSHRD_H 1" >>confdefs.h
-
- fi
# Set up files for the sensor library
ac_fn_c_check_header_mongrel "$LINENO" "sensorsapi.h" "ac_cv_header_sensorsapi_h" "$ac_includes_default"
if test "x$ac_cv_header_sensorsapi_h" = xyes; then :
diff --git a/configure.ac b/configure.ac
index 1d96004ab2f..117715cee91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3198,6 +3198,16 @@ CheckWINDOWS()
# This fixes Windows stack alignment with newer GCC
CheckStackBoundary
+
+ # headers needed elsewhere
+ AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes)
+ if test x$have_tpcshrd_h = xyes; then
+ AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ])
+ fi
+ AC_CHECK_HEADER(roapi.h,have_roapi_h=yes)
+ if test x$have_roapi_h = xyes; then
+ AC_DEFINE(HAVE_ROAPI_H, 1, [ ])
+ fi
}
dnl Determine whether the compiler can produce OS/2 executables
@@ -3999,10 +4009,6 @@ case "$host" in
have_haptic=yes
fi
fi
- AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes)
- if test x$have_tpcshrd_h = xyes; then
- AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ])
- fi
# Set up files for the sensor library
AC_CHECK_HEADER(sensorsapi.h,have_winsensors=yes,have_winsensors=no)
if test x$have_winsensors = xyes; then
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index f82b0a205db..fcd18e57dfa 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -253,6 +253,7 @@
#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_H@
#cmakedefine HAVE_TPCSHRD_H @HAVE_TPCSHRD_H@
#cmakedefine HAVE_SENSORSAPI_H @HAVE_SENSORSAPI_H@
+#cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@
#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@
#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 195b9887eac..f912e4112c2 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -242,6 +242,7 @@
#undef HAVE_AUDIOCLIENT_H
#undef HAVE_TPCSHRD_H
#undef HAVE_SENSORSAPI_H
+#undef HAVE_ROAPI_H
/* SDL internal assertion support */
#undef SDL_DEFAULT_ASSERT_LEVEL
diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h
index efb246da968..770b19039d8 100644
--- a/include/SDL_config_windows.h
+++ b/include/SDL_config_windows.h
@@ -104,6 +104,7 @@ typedef unsigned int uintptr_t;
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */
#define HAVE_D3D11_H 1
+#define HAVE_ROAPI_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h
index c548fd695a6..f3901a59743 100644
--- a/include/SDL_config_winrt.h
+++ b/include/SDL_config_winrt.h
@@ -195,6 +195,8 @@ typedef unsigned int uintptr_t;
#define HAVE_TRUNCF 1
#define HAVE__FSEEKI64 1
+#define HAVE_ROAPI_H 1
+
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_WASAPI 1
#define SDL_AUDIO_DRIVER_DISK 1