[Commits] SDL: configury: check mmdeviceapi.h and audioclient.h before ena...

libsdl.org revision control commits-owner at libsdl.org
Mon Aug 21 11:17:42 PDT 2017


details:   https://hg.libsdl.org/SDL/rev/a9f4f63b5add
changeset: 11335:a9f4f63b5add
user:      Sam Lantinga <slouken at libsdl.org>
date:      Mon Aug 21 11:17:38 2017 -0700
description:
configury: check mmdeviceapi.h and audioclient.h before enabling wasapi.

diffstat:

 CMakeLists.txt |   3 ++-
 configure      |  18 +++++++++++++++++-
 configure.in   |   8 ++++++--
 3 files changed, 25 insertions(+), 4 deletions(-)

diffs (83 lines):

diff -r 749cb40916f2 -r a9f4f63b5add CMakeLists.txt
--- a/CMakeLists.txt	Mon Aug 21 00:42:06 2017 -0400
+++ b/CMakeLists.txt	Mon Aug 21 11:17:38 2017 -0700
@@ -1153,6 +1153,7 @@
     check_include_file(dsound.h HAVE_DSOUND_H)
     check_include_file(dinput.h HAVE_DINPUT_H)
     check_include_file(xaudio2.h HAVE_XAUDIO2_H)
+    check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
     check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
     check_include_file(dxgi.h HAVE_DXGI_H)
     if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
@@ -1184,7 +1185,7 @@
       set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES})
     endif()
 
-    if(HAVE_AUDIOCLIENT_H)
+    if(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)
       set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES})
diff -r 749cb40916f2 -r a9f4f63b5add configure
--- a/configure	Mon Aug 21 00:42:06 2017 -0400
+++ b/configure	Mon Aug 21 11:17:38 2017 -0700
@@ -22834,6 +22834,20 @@
 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
+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 :
+
+else
+  have_wasapi=no
+fi
+
+
         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -23840,10 +23854,12 @@
 
                 SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
             fi
+            if test x$have_wasapi = xyes; then
 
 $as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h
 
-            SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
+                SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
+            fi
             have_audio=yes
         fi
         # Set up files for the joystick library
diff -r 749cb40916f2 -r a9f4f63b5add configure.in
--- a/configure.in	Mon Aug 21 00:42:06 2017 -0400
+++ b/configure.in	Mon Aug 21 11:17:38 2017 -0700
@@ -2876,6 +2876,8 @@
         AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
         AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
         AC_CHECK_HEADER(xinput.h, have_xinput=yes)
+        AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
+        AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
         AC_TRY_COMPILE([
 #include <windows.h>
 #include <xinput.h>
@@ -3405,8 +3407,10 @@
                 AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
                 SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
             fi
-            AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
-            SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
+            if test x$have_wasapi = xyes; then
+                AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
+                SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
+            fi
             have_audio=yes
         fi
         # Set up files for the joystick library


More information about the commits mailing list