configury: check mmdeviceapi.h and audioclient.h before enabling wasapi.
authorSam Lantinga <slouken@libsdl.org>
Mon, 21 Aug 2017 11:17:38 -0700
changeset 11335a9f4f63b5add
parent 11334 749cb40916f2
child 11336 5893a480c519
configury: check mmdeviceapi.h and audioclient.h before enabling wasapi.
CMakeLists.txt
configure
configure.in
     1.1 --- a/CMakeLists.txt	Mon Aug 21 00:42:06 2017 -0400
     1.2 +++ b/CMakeLists.txt	Mon Aug 21 11:17:38 2017 -0700
     1.3 @@ -1153,6 +1153,7 @@
     1.4      check_include_file(dsound.h HAVE_DSOUND_H)
     1.5      check_include_file(dinput.h HAVE_DINPUT_H)
     1.6      check_include_file(xaudio2.h HAVE_XAUDIO2_H)
     1.7 +    check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
     1.8      check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
     1.9      check_include_file(dxgi.h HAVE_DXGI_H)
    1.10      if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
    1.11 @@ -1184,7 +1185,7 @@
    1.12        set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES})
    1.13      endif()
    1.14  
    1.15 -    if(HAVE_AUDIOCLIENT_H)
    1.16 +    if(HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
    1.17        set(SDL_AUDIO_DRIVER_WASAPI 1)
    1.18        file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
    1.19        set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES})
     2.1 --- a/configure	Mon Aug 21 00:42:06 2017 -0400
     2.2 +++ b/configure	Mon Aug 21 11:17:38 2017 -0700
     2.3 @@ -22834,6 +22834,20 @@
     2.4  fi
     2.5  
     2.6  
     2.7 +        ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
     2.8 +if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
     2.9 +  have_wasapi=yes
    2.10 +fi
    2.11 +
    2.12 +
    2.13 +        ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default"
    2.14 +if test "x$ac_cv_header_audioclient_h" = xyes; then :
    2.15 +
    2.16 +else
    2.17 +  have_wasapi=no
    2.18 +fi
    2.19 +
    2.20 +
    2.21          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    2.22  /* end confdefs.h.  */
    2.23  
    2.24 @@ -23840,10 +23854,12 @@
    2.25  
    2.26                  SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
    2.27              fi
    2.28 +            if test x$have_wasapi = xyes; then
    2.29  
    2.30  $as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h
    2.31  
    2.32 -            SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
    2.33 +                SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
    2.34 +            fi
    2.35              have_audio=yes
    2.36          fi
    2.37          # Set up files for the joystick library
     3.1 --- a/configure.in	Mon Aug 21 00:42:06 2017 -0400
     3.2 +++ b/configure.in	Mon Aug 21 11:17:38 2017 -0700
     3.3 @@ -2876,6 +2876,8 @@
     3.4          AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
     3.5          AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
     3.6          AC_CHECK_HEADER(xinput.h, have_xinput=yes)
     3.7 +        AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
     3.8 +        AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
     3.9          AC_TRY_COMPILE([
    3.10  #include <windows.h>
    3.11  #include <xinput.h>
    3.12 @@ -3405,8 +3407,10 @@
    3.13                  AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
    3.14                  SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
    3.15              fi
    3.16 -            AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
    3.17 -            SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
    3.18 +            if test x$have_wasapi = xyes; then
    3.19 +                AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
    3.20 +                SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
    3.21 +            fi
    3.22              have_audio=yes
    3.23          fi
    3.24          # Set up files for the joystick library