[Scummvm-git-logs] scummvm master -> 4f1025378f77664404e37ec66f22b2902e611e8b

criezy criezy at scummvm.org
Fri Dec 15 02:09:01 CET 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
4f1025378f BUILD: Check if posix_spawn is available in configure


Commit: 4f1025378f77664404e37ec66f22b2902e611e8b
    https://github.com/scummvm/scummvm/commit/4f1025378f77664404e37ec66f22b2902e611e8b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2017-12-15T01:08:14Z

Commit Message:
BUILD: Check if posix_spawn is available in configure

Changed paths:
    backends/platform/sdl/posix/posix.cpp
    backends/platform/sdl/posix/posix.h
    configure


diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 8817279..b8a0402 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 d21b040..bd3a069 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
diff --git a/configure b/configure
index 4ff90e0..4e55164 100755
--- a/configure
+++ b/configure
@@ -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
 
 #





More information about the Scummvm-git-logs mailing list