From af6126adbe61fb2b6cc780025246d33df93072e6 Mon Sep 17 00:00:00 2001 From: Josh de Kock Date: Sun, 21 Aug 2016 22:59:08 +0100 Subject: ao_openal: enable building on OSX Signed-off-by: Josh de Kock --- audio/out/ao_openal.c | 14 ++++++++++++++ waftools/checks/custom.py | 13 ++++++++++++- wscript | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c index 237226e4a5..aba049445d 100644 --- a/audio/out/ao_openal.c +++ b/audio/out/ao_openal.c @@ -24,6 +24,19 @@ #include #include #include + +#ifdef __APPLE__ +#ifndef AL_FORMAT_MONO_FLOAT32 +#define AL_FORMAT_MONO_FLOAT32 0x10010 +#endif +#ifndef AL_FORMAT_STEREO_FLOAT32 +#define AL_FORMAT_STEREO_FLOAT32 0x10011 +#endif +#ifndef AL_FORMAT_MONO_DOUBLE_EXT +#define AL_FORMAT_MONO_DOUBLE_EXT 0x10012 +#endif +#include +#else #ifdef OPENAL_AL_H #include #include @@ -33,6 +46,7 @@ #include #include #endif +#endif // __APPLE__ #include "common/msg.h" diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py index b570b4b836..50a16ce26a 100644 --- a/waftools/checks/custom.py +++ b/waftools/checks/custom.py @@ -4,7 +4,7 @@ from waflib import Utils import os __all__ = ["check_pthreads", "check_iconv", "check_lua", "check_oss_4front", - "check_cocoa"] + "check_cocoa", "check_openal"] pthreads_program = load_fragment('pthreads.c') @@ -116,3 +116,14 @@ def check_cocoa(ctx, dependency_identifier): linkflags = '-fobjc-arc') return fn(ctx, dependency_identifier) + +def check_openal(ctx, dependency_identifier): + checks = [ + check_pkg_config('openal', '>= 1.13'), + check_statement(['OpenAL/AL.h'], 'int i = AL_VERSION', framework='OpenAL') + ] + + for fn in checks: + if fn(ctx, dependency_identifier): + return True + return False diff --git a/wscript b/wscript index 6ec084729c..13cb5269ee 100644 --- a/wscript +++ b/wscript @@ -581,7 +581,7 @@ audio_output_features = [ }, { 'name': '--openal', 'desc': 'OpenAL audio output', - 'func': check_pkg_config('openal', '>= 1.13'), + 'func': check_openal, 'default': 'disable' }, { 'name': '--opensles', -- cgit v1.2.3