From 7b157815ab4222c30e7a4fb682735cf91d031da1 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 17 Jul 2025 15:08:58 +1000 Subject: [PATCH] Fix ALSA build on very old compilers. --- miniaudio.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/miniaudio.h b/miniaudio.h index 05bc8e7a..f5215182 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -28165,7 +28165,19 @@ ma_device_backend_vtable* ma_device_backend_winmm = NULL; ALSA Backend ******************************************************************************/ -#ifdef MA_HAS_ALSA +/* +Our ALSA backend uses poll() and eventfd() which are not available on very old +versions of Linux so we'll need check for it and disable the ALSA backend if +necessary. This should be a non-issue in practice because ALSA itself won't be +available in old versions of Linux anyway. +*/ +#if defined(MA_HAS_ALSA) + #if (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 199309L) + #undef MA_HAS_ALSA + #endif +#endif + +#if defined(MA_HAS_ALSA) #include /* poll(), struct pollfd */ #include /* eventfd() */