From 4f1025378f77664404e37ec66f22b2902e611e8b Mon Sep 17 00:00:00 2001 From: Thierry Crozat Date: Fri, 15 Dec 2017 01:08:14 +0000 Subject: BUILD: Check if posix_spawn is available in configure --- backends/platform/sdl/posix/posix.cpp | 21 ++++++++++++++------- backends/platform/sdl/posix/posix.h | 4 ---- 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'backends/platform') diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp index 8817279c50..b8a04020d5 100644 --- a/backends/platform/sdl/posix/posix.cpp +++ b/backends/platform/sdl/posix/posix.cpp @@ -49,10 +49,7 @@ #include #include -// With very old macOS SDKs (10.4 for example) spawn.h is not there. Since it is -// used for posix_spawnp() in openUrl(), which is reimplemented in OSystem_MacOSX -// anyway, skip this code. -#ifndef MACOSX +#ifdef HAS_POSIX_SPAWN #include #endif extern char **environ; @@ -90,8 +87,12 @@ void OSystem_POSIX::initBackend() { } bool OSystem_POSIX::hasFeature(Feature f) { - if (f == kFeatureDisplayLogFile || f == kFeatureOpenUrl) + if (f == kFeatureDisplayLogFile) return true; +#ifdef HAS_POSIX_SPAWN + if (f == kFeatureOpenUrl) + return true; +#endif return OSystem_SDL::hasFeature(f); } @@ -273,8 +274,8 @@ bool OSystem_POSIX::displayLogFile() { return WIFEXITED(status) && WEXITSTATUS(status) == 0; } -#ifndef MACOSX bool OSystem_POSIX::openUrl(const Common::String &url) { +#ifdef HAS_POSIX_SPAWN // inspired by Qt's "qdesktopservices_x11.cpp" // try "standards" @@ -309,9 +310,13 @@ bool OSystem_POSIX::openUrl(const Common::String &url) { warning("openUrl() (POSIX) failed to open URL"); return false; +#else + return false; +#endif } bool OSystem_POSIX::launchBrowser(const Common::String &client, const Common::String &url) { +#ifdef HAS_POSIX_SPAWN pid_t pid; const char *argv[] = { client.c_str(), @@ -327,8 +332,10 @@ bool OSystem_POSIX::launchBrowser(const Common::String &client, const Common::St return false; } return (waitpid(pid, NULL, WNOHANG) != -1); -} +#else + return false; #endif +} AudioCDManager *OSystem_POSIX::createAudioCDManager() { #ifdef USE_LINUXCD diff --git a/backends/platform/sdl/posix/posix.h b/backends/platform/sdl/posix/posix.h index d21b04070b..bd3a069d5b 100644 --- a/backends/platform/sdl/posix/posix.h +++ b/backends/platform/sdl/posix/posix.h @@ -35,9 +35,7 @@ public: virtual bool displayLogFile(); -#ifndef MACOSX virtual bool openUrl(const Common::String &url); -#endif virtual void init(); virtual void initBackend(); @@ -68,9 +66,7 @@ protected: virtual AudioCDManager *createAudioCDManager(); -#ifndef MACOSX bool launchBrowser(const Common::String& client, const Common::String &url); -#endif }; #endif -- cgit v1.2.3