From e016cc894090127c5fe72b009290b4bf4a534363 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 19 May 2021 14:37:09 +0200
Subject: [PATCH] lib/upnp/meson.build: auto-disable UPnP without CURL/expat

---
 src/lib/upnp/meson.build | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/lib/upnp/meson.build b/src/lib/upnp/meson.build
index bdc248e6c..863f9d4a1 100644
--- a/src/lib/upnp/meson.build
+++ b/src/lib/upnp/meson.build
@@ -1,5 +1,15 @@
 upnp_option = get_option('upnp')
 
+if upnp_option == 'auto'
+  if not curl_dep.found()
+    warning('No UPnP because CURL is not enabled')
+    upnp_option = 'disabled'
+  elif not expat_dep.found()
+    warning('No UPnP because expat is not enabled')
+    upnp_option = 'disabled'
+  endif
+endif
+
 if upnp_option == 'auto'
   upnp_dep = dependency('libupnp', version: '>= 1.8', required: false)
   conf.set('USING_PUPNP', upnp_dep.found())