configury, cmake: make wasapi option independent of directx.
authorOzkan Sezer <sezeroz@gmail.com>
Fri, 28 Sep 2018 11:30:50 +0300
changeset 12248a65c2e471570
parent 12247 f1cfd508f012
child 12249 4f358c108da1
configury, cmake: make wasapi option independent of directx.
CMakeLists.txt
configure
configure.in
     1.1 --- a/CMakeLists.txt	Fri Sep 28 01:18:54 2018 -0700
     1.2 +++ b/CMakeLists.txt	Fri Sep 28 11:30:50 2018 +0300
     1.3 @@ -334,7 +334,7 @@
     1.4  endforeach()
     1.5  set_option(VIDEO_COCOA         "Use Cocoa video driver" ${APPLE})
     1.6  set_option(DIRECTX             "Use DirectX for Windows audio/video" ${WINDOWS})
     1.7 -dep_option(WASAPI              "Use the Windows WASAPI audio driver" ON "DIRECTX" OFF)
     1.8 +set_option(WASAPI              "Use the Windows WASAPI audio driver" ${WINDOWS})
     1.9  set_option(RENDER_D3D          "Enable the Direct3D render driver" ${WINDOWS})
    1.10  set_option(VIDEO_VIVANTE       "Use Vivante EGL video driver" ${UNIX_SYS})
    1.11  dep_option(VIDEO_VULKAN        "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF)
    1.12 @@ -1200,8 +1200,6 @@
    1.13      check_include_file(ddraw.h HAVE_DDRAW_H)
    1.14      check_include_file(dsound.h HAVE_DSOUND_H)
    1.15      check_include_file(dinput.h HAVE_DINPUT_H)
    1.16 -    check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
    1.17 -    check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
    1.18      check_include_file(dxgi.h HAVE_DXGI_H)
    1.19      if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
    1.20        set(HAVE_DIRECTX TRUE)
    1.21 @@ -1226,6 +1224,10 @@
    1.22        set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
    1.23      endif()
    1.24  
    1.25 +    # headers needed for WASAPI support:
    1.26 +    check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H)
    1.27 +    check_include_file(audioclient.h HAVE_AUDIOCLIENT_H)
    1.28 +
    1.29      if(WASAPI AND HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H)
    1.30        set(SDL_AUDIO_DRIVER_WASAPI 1)
    1.31        file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c)
     2.1 --- a/configure	Fri Sep 28 01:18:54 2018 -0700
     2.2 +++ b/configure	Fri Sep 28 11:30:50 2018 +0300
     2.3 @@ -23165,20 +23165,6 @@
     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 @@ -23257,14 +23243,6 @@
    2.25          SUMMARY_video="${SUMMARY_video} directx"
    2.26          SUMMARY_audio="${SUMMARY_audio} directx"
    2.27  
    2.28 -        # Check whether --enable-wasapi was given.
    2.29 -if test "${enable_wasapi+set}" = set; then :
    2.30 -  enableval=$enable_wasapi;
    2.31 -else
    2.32 -  enable_wasapi=yes
    2.33 -fi
    2.34 -
    2.35 -
    2.36          # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
    2.37          # FIXME:  ...so force it off for now.
    2.38          case "$host" in
    2.39 @@ -23273,6 +23251,28 @@
    2.40              ;;
    2.41          esac
    2.42      fi
    2.43 +
    2.44 +    ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default"
    2.45 +if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then :
    2.46 +  have_wasapi=yes
    2.47 +fi
    2.48 +
    2.49 +
    2.50 +    ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default"
    2.51 +if test "x$ac_cv_header_audioclient_h" = xyes; then :
    2.52 +
    2.53 +else
    2.54 +  have_wasapi=no
    2.55 +fi
    2.56 +
    2.57 +
    2.58 +    # Check whether --enable-wasapi was given.
    2.59 +if test "${enable_wasapi+set}" = set; then :
    2.60 +  enableval=$enable_wasapi;
    2.61 +else
    2.62 +  enable_wasapi=yes
    2.63 +fi
    2.64 +
    2.65  }
    2.66  
    2.67  CheckDLOPEN()
     3.1 --- a/configure.in	Fri Sep 28 01:18:54 2018 -0700
     3.2 +++ b/configure.in	Fri Sep 28 11:30:50 2018 +0300
     3.3 @@ -3052,8 +3052,6 @@
     3.4          AC_CHECK_HEADER(dinput.h, have_dinput=yes)
     3.5          AC_CHECK_HEADER(dxgi.h, have_dxgi=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 @@ -3090,10 +3088,6 @@
    3.13          SUMMARY_video="${SUMMARY_video} directx"
    3.14          SUMMARY_audio="${SUMMARY_audio} directx"
    3.15  
    3.16 -        AC_ARG_ENABLE(wasapi,
    3.17 -AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
    3.18 -                                , enable_wasapi=yes)
    3.19 -
    3.20          # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
    3.21          # FIXME:  ...so force it off for now.
    3.22          case "$host" in
    3.23 @@ -3102,6 +3096,12 @@
    3.24              ;;
    3.25          esac
    3.26      fi
    3.27 +
    3.28 +    AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
    3.29 +    AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
    3.30 +    AC_ARG_ENABLE(wasapi,
    3.31 +AC_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [[default=yes]]]),
    3.32 +                                , enable_wasapi=yes)
    3.33  }
    3.34  
    3.35  dnl Check for the dlfcn.h interface for dynamically loading objects