summaryrefslogtreecommitdiff
path: root/gio
diff options
context:
space:
mode:
authorPeter Williams <peter@newton.cx>2023-04-17 21:35:08 -0400
committerPeter Williams <peter@newton.cx>2023-04-20 08:54:23 -0400
commitbb19523a0a2db1e8afcd6b22a090fb48b9e7622d (patch)
tree88ed68363846016742e3c35b057b83c00c9fb7f7 /gio
parent9f111c34160d8a2e38f0ff0ce89dbcabec7c333a (diff)
downloadglib-bb19523a0a2db1e8afcd6b22a090fb48b9e7622d.tar.gz
gio: fix build on older macOS SDKs
The merge request !2848 added code to automatically detect the module prefix on macOS, with a test for the Mac #define TARGET_OS_OSX. However, older versions of the SDK (at least 10.11) don't provide this #define, leading to build failure. If the #define is missing, fall back to checking TARGET_OS_MAC. On newer SDKs this symbol is also true for watchOS, etc., but in those situations TARGET_OS_OSX is available.
Diffstat (limited to 'gio')
-rw-r--r--gio/giomodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gio/giomodule.c b/gio/giomodule.c
index 47b8de27e..17fabe640 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -1273,7 +1273,9 @@ get_gio_module_dir (void)
module_dir = g_strdup (GIO_MODULE_DIR);
#ifdef __APPLE__
#include "TargetConditionals.h"
-#if TARGET_OS_OSX
+/* Only auto-relocate on macOS, not watchOS etc; older macOS SDKs only define TARGET_OS_MAC */
+#if (defined (TARGET_OS_OSX) && TARGET_OS_OSX) || \
+ (!defined (TARGET_OS_OSX) && defined (TARGET_OS_MAC) && TARGET_OS_MAC)
#include <dlfcn.h>
{
g_autofree gchar *path = NULL;