summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-02-02 13:43:41 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-02-02 13:43:41 -0300
commitcf08915d62e338c987b71c078b148490510e9fe7 (patch)
treea70c98ab7b2edc588658a99ec3b9a3ab8077222d
parentc888ae0aea030491f90b749260a156ce15635681 (diff)
downloadlua-github-cf08915d62e338c987b71c078b148490510e9fe7.tar.gz
New macro LUA_USE_IOS
Do not try to detect automatically whether system is iOS; it is simpler and more reliable to let the programmer inform that.
-rw-r--r--loslib.c17
-rw-r--r--luaconf.h6
2 files changed, 11 insertions, 12 deletions
diff --git a/loslib.c b/loslib.c
index 7eb05caf..89ac06bc 100644
--- a/loslib.c
+++ b/loslib.c
@@ -138,21 +138,14 @@
/* }================================================================== */
-/*
-** Despite claiming to be ISO, the C library in some Apple platforms
-** does not implement 'system'.
-*/
-#if !defined(l_system) && defined(__APPLE__) /* { */
-#include "TargetConditionals.h"
-#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV
-#define l_system(cmd) ((cmd) == NULL ? 0 : -1)
-#endif
-#endif /* } */
-
#if !defined(l_system)
+#if defined(LUA_USE_IOS)
+/* Despite claiming to be ISO C, iOS does not implement 'system'. */
+#define l_system(cmd) ((cmd) == NULL ? 0 : -1)
+#else
#define l_system(cmd) system(cmd) /* default definition */
#endif
-
+#endif
static int os_execute (lua_State *L) {
diff --git a/luaconf.h b/luaconf.h
index e4650fbc..137103ed 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -70,6 +70,12 @@
#endif
+#if defined(LUA_USE_IOS)
+#define LUA_USE_POSIX
+#define LUA_USE_DLOPEN
+#endif
+
+
/*
@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits.
*/