aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMisty De Meo <mistydemeo@gmail.com>2014-11-10 19:38:22 -0800
committerMax Kellermann <max@duempel.org>2014-11-11 06:22:24 +0100
commit134cb6a0171192b7d621697f84196ce670a3ce21 (patch)
tree63924635fa60a8a6010ad3adac201561f47db8dc
parent8d036c4b7c3a09bd55bdc86a4fb7b5d525a805c2 (diff)
downloadmpd-134cb6a0171192b7d621697f84196ce670a3ce21.tar.gz
mpd-134cb6a0171192b7d621697f84196ce670a3ce21.tar.xz
mpd-134cb6a0171192b7d621697f84196ce670a3ce21.zip
Main: fix compilation on OS X using non-Apple compilers
Commit d42c0f1dc5063d50a62817b63a1c2a4507c46071 added an OS X-specific method of calling mpd_main_after_fork(), which uses Grand Central Dispatch. Since this uses a block literal, it breaks compilation on compilers which don't support the block extension, e.g. non-Apple compilers. This affects users on older OS X releases with GCD (which depend on older Clang releases, or Apple GCCs, which don't support the C++11 features MPD needs); or which don't support GCD at all (10.5 and lower). This patch changes the #ifdef so that the non-GCD code is used as it was on OS X before this patch if blocks aren't available, via checking __BLOCKS__ macro.
-rw-r--r--NEWS1
-rw-r--r--src/Main.cxx4
2 files changed, 3 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index b1cc2cf04..52f4671e3 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ ver 0.19.3 (not yet released)
- audiofile: fix bit rate calculation
- ffmpeg: support opus
* fix distorted audio with soxr resampler
+* fix build failure on Mac OS X with non-Apple compilers
ver 0.19.2 (2014/11/02)
* input
diff --git a/src/Main.cxx b/src/Main.cxx
index 2719c05e0..26d4e7ae4 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -114,7 +114,7 @@
#include <ws2tcpip.h>
#endif
-#ifdef __APPLE__
+#ifdef __BLOCKS__
#include <dispatch/dispatch.h>
#endif
@@ -517,7 +517,7 @@ int mpd_main(int argc, char *argv[])
daemonize_begin(options.daemon);
#endif
-#ifdef __APPLE__
+#ifdef __BLOCKS__
/* Runs the OS X native event loop in the main thread, and runs
the rest of mpd_main on a new thread. This lets CoreAudio receive
route change notifications (e.g. plugging or unplugging headphones).