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.
This commit is contained in:
Peter Williams 2023-04-17 21:35:08 -04:00
parent 9f111c3416
commit bb19523a0a

View File

@ -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;