aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorThierry Crozat2017-12-15 01:08:14 +0000
committerThierry Crozat2017-12-15 01:08:14 +0000
commit4f1025378f77664404e37ec66f22b2902e611e8b (patch)
tree47f2f6c65e8dbbfd4f808796376487c54b8cd214 /backends/platform
parent2926cd4a5071c9f06a2c2258b4a479028a8b8c2e (diff)
downloadscummvm-rg350-4f1025378f77664404e37ec66f22b2902e611e8b.tar.gz
scummvm-rg350-4f1025378f77664404e37ec66f22b2902e611e8b.tar.bz2
scummvm-rg350-4f1025378f77664404e37ec66f22b2902e611e8b.zip
BUILD: Check if posix_spawn is available in configure
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/sdl/posix/posix.cpp21
-rw-r--r--backends/platform/sdl/posix/posix.h4
2 files changed, 14 insertions, 11 deletions
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 <sys/wait.h>
#include <unistd.h>
-// 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 <spawn.h>
#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