Skip to content

Commit

Permalink
configury, cmake: add check for endpointvolume.h :
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sezero committed Sep 28, 2018
1 parent cf7460e commit b11c75e
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 4 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
17 changes: 17 additions & 0 deletions configure
Expand Up @@ -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 :

Expand All @@ -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;
Expand Down
9 changes: 9 additions & 0 deletions configure.in
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions include/SDL_config.h.cmake
Expand Up @@ -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@

Expand Down
3 changes: 3 additions & 0 deletions include/SDL_config.h.in
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions include/SDL_config_windows.h
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions include/SDL_config_winrt.h
Expand Up @@ -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
Expand Down

0 comments on commit b11c75e

Please sign in to comment.