Commit b11c75e9f47823b41b356ac4ccd9d1afdddecbd1

Ozkan Sezer 2018-09-28T13:41:04

configury, cmake: add check for endpointvolume.h : add HAVE_ENDPOINTVOLUME_H, HAVE_MMDEVICEAPI_H and HAVE_AUDIOCLIENT_H in SDL_config.h.in, SDL_config.h.cmake, SDL_config_windows.h, and in SDL_config_winrt.h.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 886e1a5..0840f71 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1212,6 +1212,11 @@ elseif(WINDOWS)
     set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
   endif()
 
+  # headers needed elsewhere ...
+  check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
+  check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
+  check_include_file(endpointvolume.h HAVE_ENDPOINTVOLUME_H)
+
   if(SDL_AUDIO)
     set(SDL_AUDIO_DRIVER_WINMM 1)
     file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c)
@@ -1224,10 +1229,6 @@ elseif(WINDOWS)
       set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
     endif()
 
-    # headers needed for WASAPI support:
-    check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
-    check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
-
     if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
       set(SDL_AUDIO_DRIVER_WASAPI 1)
       file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
diff --git a/configure b/configure
index 1d7ec14..e5ecea0 100755
--- a/configure
+++ b/configure
@@ -23258,6 +23258,10 @@ if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
 fi
 
 
+    if test x$have_wasapi = xyes; then
+        $as_echo "#define HAVE_MMDEVICEAPI_H 1" >>confdefs.h
+
+    fi
     ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default"
 if test "x$ac_cv_header_audioclient_h" = xyes; then :
 
@@ -23266,6 +23270,19 @@ else
 fi
 
 
+    if test x$have_wasapi = xyes; then
+        $as_echo "#define HAVE_AUDIOCLIENT_H 1" >>confdefs.h
+
+    fi
+
+    ac_fn_c_check_header_mongrel "$LINENO" "endpointvolume.h" "ac_cv_header_endpointvolume_h" "$ac_includes_default"
+if test "x$ac_cv_header_endpointvolume_h" = xyes; then :
+  $as_echo "#define HAVE_ENDPOINTVOLUME_H 1" >>confdefs.h
+
+fi
+
+
+
     # Check whether --enable-wasapi was given.
 if test "${enable_wasapi+set}" = set; then :
   enableval=$enable_wasapi;
diff --git a/configure.in b/configure.in
index 177a7bd..8711587 100644
--- a/configure.in
+++ b/configure.in
@@ -3098,7 +3098,16 @@ XINPUT_STATE_EX s1;
     fi
 
     AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
+    if test x$have_wasapi = xyes; then
+        AC_DEFINE(HAVE_MMDEVICEAPI_H,1,[])
+    fi
     AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
+    if test x$have_wasapi = xyes; then
+        AC_DEFINE(HAVE_AUDIOCLIENT_H,1,[])
+    fi
+
+    AC_CHECK_HEADER(endpointvolume.h,AC_DEFINE(HAVE_ENDPOINTVOLUME_H,1,[]))
+
     AC_ARG_ENABLE(wasapi,
 AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
                                 , enable_wasapi=yes)
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index f46984b..48dd2d4 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -209,6 +209,11 @@
 #cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@
 #cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@
 #cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@
+
+#cmakedefine HAVE_ENDPOINTVOLUME_H @HAVE_ENDPOINTVOLUME_H@
+#cmakedefine HAVE_MMDEVICEAPI_H @HAVE_MMDEVICEAPI_H@
+#cmakedefine HAVE_AUDIOCLIENT_H @HAVE_AUDIOCLIENT_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 45a80ae..883b6f4 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -209,6 +209,9 @@
 #undef HAVE_DSOUND_H
 #undef HAVE_DXGI_H
 #undef HAVE_XINPUT_H
+#undef HAVE_ENDPOINTVOLUME_H
+#undef HAVE_MMDEVICEAPI_H
+#undef HAVE_AUDIOCLIENT_H
 #undef HAVE_XINPUT_GAMEPAD_EX
 #undef HAVE_XINPUT_STATE_EX
 
diff --git a/include/SDL_config_windows.h b/include/SDL_config_windows.h
index 4aa06f7..c58be8e 100644
--- a/include/SDL_config_windows.h
+++ b/include/SDL_config_windows.h
@@ -82,6 +82,9 @@ typedef unsigned int uintptr_t;
 #define HAVE_DSOUND_H 1
 #define HAVE_DXGI_H 1
 #define HAVE_XINPUT_H 1
+#define HAVE_MMDEVICEAPI_H 1
+#define HAVE_AUDIOCLIENT_H 1
+#define HAVE_ENDPOINTVOLUME_H 1
 
 /* This is disabled by default to avoid C runtime dependencies and manifest requirements */
 #ifdef HAVE_LIBC
diff --git a/include/SDL_config_winrt.h b/include/SDL_config_winrt.h
index 568b421..e3fe55b 100644
--- a/include/SDL_config_winrt.h
+++ b/include/SDL_config_winrt.h
@@ -97,6 +97,11 @@ typedef unsigned int uintptr_t;
 #if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
 #define HAVE_XINPUT_H 1
 #endif
+
+#define HAVE_MMDEVICEAPI_H 1
+#define HAVE_AUDIOCLIENT_H 1
+#define HAVE_ENDPOINTVOLUME_H 1
+
 #define HAVE_LIBC 1
 #define STDC_HEADERS 1
 #define HAVE_CTYPE_H 1