diff options
-rw-r--r-- | backends/platform/sdl/posix/posix.cpp | 21 | ||||
-rw-r--r-- | backends/platform/sdl/posix/posix.h | 4 | ||||
-rwxr-xr-x | configure | 12 |
3 files changed, 26 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 @@ -212,6 +212,7 @@ _tainted_build=no # The following variables are automatically detected, and should not # be modified otherwise. Consider them read-only. _posix=no +_has_posix_spawn=no _endian=unknown _need_memalign=yes _have_x86=no @@ -3630,6 +3631,17 @@ echo $_posix if test "$_posix" = yes ; then append_var DEFINES "-DPOSIX" add_line_to_config_mk 'POSIX = 1' + + echo_n "Checking if posix_spawn is supported... " + cat > $TMPC << EOF +#include <spawn.h> +int main(void) { return posix_spawn(0, 0, 0, 0, 0, 0); } +EOF + cc_check && _has_posix_spawn=yes + echo $_has_posix_spawn + if test "$_has_posix_spawn" = yes ; then + append_var DEFINES "-DHAS_POSIX_SPAWN" + fi fi # |