diff options
author | Owen Rudge <owen@owenrudge.net> | 2018-04-09 23:18:45 +0100 |
---|---|---|
committer | Owen Rudge <owen@owenrudge.net> | 2018-05-17 15:06:37 +0100 |
commit | 7bd2fa351653b0140c82fcad96a0f3b16758a0b0 (patch) | |
tree | fd63d65d64bd677c6e703f2bf5fc676b660fa565 /config.lib | |
parent | fb54dd04a14ff5b3bc24a37bf06a8aed41fbd7b8 (diff) | |
download | openttd-7bd2fa351653b0140c82fcad96a0f3b16758a0b0.tar.xz |
Feature: Add XAudio2 driver
Diffstat (limited to 'config.lib')
-rw-r--r-- | config.lib | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/config.lib b/config.lib index 7fa44f5b3..d6ebb68a1 100644 --- a/config.lib +++ b/config.lib @@ -77,6 +77,7 @@ set_default() { enable_builtin_depend="1" with_makedepend="0" with_direct_music="1" + with_xaudio2="1" with_sort="1" with_iconv="1" with_midi="" @@ -152,6 +153,7 @@ set_default() { enable_builtin_depend with_makedepend with_direct_music + with_xaudio2 with_sort with_iconv with_midi @@ -411,6 +413,10 @@ detect_params() { --without-direct-music) with_direct_music="0";; --with-direct-music=*) with_direct_music="$optarg";; + --with-xaudio2) with_xaudio2="2";; + --without-xaudio2) with_xaudio2="0";; + --with-xaudio2=*) with_xaudio2="$optarg";; + --with-sort) with_sort="2";; --without-sort) with_sort="0";; --with-sort=*) with_sort="$optarg";; @@ -871,6 +877,20 @@ check_params() { fi fi + if [ "$with_xaudio2" != "0" ]; then + if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then + if [ "$with_xaudio2" != "1" ]; then + log 1 "configure: error: xaudio2 is only supported on Win32 targets" + exit 1 + fi + with_xaudio2="0" + + log 1 "checking xaudio2... not Windows, skipping" + else + check_xaudio2 + fi + fi + detect_sort # Suppress language errors when there is a version defined, indicating a release @@ -1772,6 +1792,10 @@ make_cflags_and_ldflags() { fi fi + if [ "$with_xaudio2" != "0" ]; then + CFLAGS="$CFLAGS -DWITH_XAUDIO2" + fi + if [ -n "$libtimidity_config" ]; then CFLAGS="$CFLAGS -DLIBTIMIDITY" CFLAGS="$CFLAGS `$libtimidity_config --cflags | tr '\n\r' ' '`" @@ -2160,6 +2184,35 @@ check_direct_music() { fi } +check_xaudio2() { + echo " + #include <windows.h> + + #undef NTDDI_VERSION + #undef _WIN32_WINNT + + #define NTDDI_VERSION NTDDI_WIN8 + #define _WIN32_WINNT _WIN32_WINNT_WIN8 + + #include <xaudio2.h> + int main(int argc, char *argv[]) { }" > xaudio2.test.c + $cxx_host $CFLAGS xaudio2.test.c -o xaudio2.test 2> /dev/null + res=$? + rm -f xaudio2.test.c xaudio2.test + + if [ "$res" != "0" ]; then + if [ "$with_xaudio2" != "1" ]; then + log 1 "configure: error: xaudio2 is not available on this system" + exit 1 + fi + with_xaudio2="0" + + log 1 "checking xaudio2... not found" + else + log 1 "checking xaudio2... found" + fi +} + check_makedepend() { if [ "$enable_builtin_depend" != "0" ]; then with_makedepend="0" |