From 695c668b979c0c4e27925112b9f1a75a4adffc77 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <barracuda@macos-powerpc.org>
Date: Sun, 8 Jun 2025 21:26:19 +0800
Subject: [PATCH 10/12] Actually enable building PortAudio plug-in

---
 configure.ac | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index d7aa62cbb..e36d15c50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,7 @@
 AC_ARG_ENABLE(oss,      [AS_HELP_STRING([--disable-oss     ], [disable Open Sound System output plugin (default: enabled)])], [enable_oss=$enableval], [enable_oss=yes])
 AC_ARG_ENABLE(pipewire, [AS_HELP_STRING([--disable-pipewire   ], [disable Pipewire output plugin (default: enabled)])], [enable_pipewire=$enableval], [enable_pipewire=yes])
 AC_ARG_ENABLE(pulse,    [AS_HELP_STRING([--disable-pulse   ], [disable PulseAudio output plugin (default: enabled)])], [enable_pulse=$enableval], [enable_pulse=yes])
+AC_ARG_ENABLE(portaudio,[AS_HELP_STRING([--disable-portaudio],[disable PortAudio output plugin (default: enabled)])], [enable_portaudio=$enableval], [enable_portaudio=yes])
 AC_ARG_ENABLE(coreaudio,[AS_HELP_STRING([--disable-coreaudio], [disable CoreAudio output plugin (default: enabled)])], [enable_coreaudio=$enableval], [enable_coreaudio=yes])
 AC_ARG_ENABLE(gtk3,     [AS_HELP_STRING([--disable-gtk3     ], [disable GTK3 version of gtkui plugin (default: enabled)])], [enable_gtk3=$enableval], [enable_gtk3=yes])
 AC_ARG_ENABLE(gtk2,     [AS_HELP_STRING([--disable-gtk2     ], [disable GTK2 version of gtkui plugin (default: enabled)])], [enable_gtk2=$enableval], [enable_gtk2=yes])
@@ -355,6 +356,18 @@
     ])
 ])
 
+AS_IF([test "${enable_portaudio}" != "no"], [
+    AS_IF([test "${enable_staticlink}" != "no"], [
+        HAVE_PORTAUDIO=yes
+        PORTAUDIO_DEPS_LIBS="-lportaudio"
+        PORTAUDIO_DEPS_CFLAGS="-I../../$LIB/include/"
+        AC_SUBST(PORTAUDIO_DEPS_CFLAGS)
+        AC_SUBST(PORTAUDIO_DEPS_LIBS)
+    ], [
+        PKG_CHECK_MODULES(PORTAUDIO_DEPS, portaudio-2.0, HAVE_PORTAUDIO=yes, HAVE_PORTAUDIO=no)
+    ])
+])
+
 AS_IF([test "${enable_pipewire}" != "no"], [
     AS_IF([test "${enable_staticlink}" != "no"], [
         HAVE_PIPEWIRE=yes
@@ -664,6 +687,12 @@
     ])
 ])
 
+AS_IF([test "${enable_portaudio}" != "no"], [
+    AS_IF([test "${HAVE_PORTAUDIO}" = "yes"], [
+        HAVE_PORTAUDIO_PLUGIN=yes
+    ])
+])
+
 AS_IF([test "${enable_pipewire}" != "no"], [
     AS_IF([test "${HAVE_PIPEWIRE}" = "yes"], [
         HAVE_PIPEWIRE_PLUGIN=yes
@@ -876,7 +905,7 @@
     HAVE_SOUNDTOUCH=yes
 ])
 
-PLUGINS_DIRS="plugins/liboggedit plugins/lastfm plugins/mp3 plugins/vorbis plugins/opus plugins/flac plugins/wavpack plugins/sndfile plugins/vfs_curl plugins/cdda plugins/gtkui plugins/alsa plugins/ffmpeg plugins/hotkeys plugins/oss plugins/artwork plugins/adplug plugins/ffap plugins/sid plugins/nullout plugins/supereq plugins/vtx plugins/gme plugins/pulse plugins/notify plugins/musepack plugins/wildmidi plugins/tta plugins/dca plugins/aac plugins/mms plugins/shellexec plugins/shellexecui plugins/dsp_libsrc plugins/m3u plugins/vfs_zip plugins/converter plugins/dumb plugins/shn plugins/psf plugins/mono2stereo plugins/alac plugins/wma plugins/pltbrowser plugins/coreaudio plugins/sc68 plugins/rg_scanner plugins/soundtouch plugins/medialib plugins/lyrics plugins/mpris"
+PLUGINS_DIRS="plugins/liboggedit plugins/lastfm plugins/mp3 plugins/vorbis plugins/opus plugins/flac plugins/wavpack plugins/sndfile plugins/vfs_curl plugins/cdda plugins/gtkui plugins/alsa plugins/ffmpeg plugins/hotkeys plugins/oss plugins/artwork plugins/adplug plugins/ffap plugins/sid plugins/nullout plugins/supereq plugins/vtx plugins/gme plugins/portaudio plugins/pulse plugins/notify plugins/musepack plugins/wildmidi plugins/tta plugins/dca plugins/aac plugins/mms plugins/shellexec plugins/shellexecui plugins/dsp_libsrc plugins/m3u plugins/vfs_zip plugins/converter plugins/dumb plugins/shn plugins/psf plugins/mono2stereo plugins/alac plugins/wma plugins/pltbrowser plugins/coreaudio plugins/sc68 plugins/rg_scanner plugins/soundtouch plugins/medialib plugins/lyrics plugins/mpris"
 
 AM_CONDITIONAL(APE_USE_YASM, test "x$APE_USE_YASM" = "xyes")
 AM_CONDITIONAL(HAVE_VORBIS, test "x$HAVE_VORBISPLUGIN" = "xyes")
@@ -894,6 +923,7 @@
 AM_CONDITIONAL(HAVE_COREAUDIO, test "x$HAVE_COREAUDIO" = "xyes")
 AM_CONDITIONAL(HAVE_FFMPEG, test "x$HAVE_FFMPEGPLUGIN" = "xyes")
 AM_CONDITIONAL(HAVE_PIPEWIRE, test "x$HAVE_PIPEWIRE_PLUGIN" = "xyes")
+AM_CONDITIONAL(HAVE_PORTAUDIO, test "x$HAVE_PORTAUDIO_PLUGIN" = "xyes")
 AM_CONDITIONAL(HAVE_PULSE, test "x$HAVE_PULSEPLUGIN" = "xyes")
 AM_CONDITIONAL(HAVE_ARTWORK, test "x$HAVE_ARTWORK" = "xyes")
 AM_CONDITIONAL(ARTWORK_USE_VFS_CURL, test "x$ARTWORK_USE_VFS_CURL" = "xyes")
@@ -986,6 +1016,7 @@
 plugins/sid/Makefile
 plugins/oss/Makefile
 plugins/pulse/Makefile
+plugins/portaudio/Makefile
 plugins/artwork/Makefile
 plugins/supereq/Makefile
 plugins/notify/Makefile
@@ -1082,6 +1113,7 @@
 PRINT_PLUGIN_INFO([pltbrowser],[playlist browser gui plugin],[test "x$HAVE_PLTBROWSER" = "xyes"])
 PRINT_PLUGIN_INFO([psf],[PSF player, using Audio Overload SDK],[test "x$HAVE_PSF" = "xyes"])
 PRINT_PLUGIN_INFO([pipewire],[Pipewire output plugin],[test "x$HAVE_PIPEWIRE_PLUGIN" = "xyes"])
+PRINT_PLUGIN_INFO([portaudio],[PortAudio output plugin],[test "x$HAVE_PORTAUDIO_PLUGIN" = "xyes"])
 PRINT_PLUGIN_INFO([pulse],[PulseAudio output plugin],[test "x$HAVE_PULSEPLUGIN" = "xyes"])
 PRINT_PLUGIN_INFO([rgscanner],[plugin for ReplayGain scanner support],[test "x$HAVE_RGSCANNER" = "xyes"])
 PRINT_PLUGIN_INFO([sc68],[sc68 Atari ST And Amiga player],[test "x$HAVE_SC68" = "xyes"])
