diff options
author | drh <drh@noemail.net> | 2015-04-13 23:05:28 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-04-13 23:05:28 +0000 |
commit | 6bca6511666674870a081f05eec9f708ac1ce072 (patch) | |
tree | c085e69093d61d5ddf904635edbb4b1b4118614e /src/os_unix.c | |
parent | 2647dfa2928aaa3907680d55c1df94b1d8c40eea (diff) | |
download | sqlite-6bca6511666674870a081f05eec9f708ac1ce072.tar.gz sqlite-6bca6511666674870a081f05eec9f708ac1ce072.zip |
Add #ifdef magic for HAVE_GETHOSTUUID so that the build will hopefully now
work on more verions of MacOS with SQLITE_ENABLE_LOCKING_STYLE turned on.
FossilOrigin-Name: 211411d02c0729c9af0e3cc7e4910db2e7e0d08e
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 1d867d7cd..188c02533 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -91,6 +91,17 @@ # include <sys/param.h> #endif /* SQLITE_ENABLE_LOCKING_STYLE */ +#if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \ + (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000)) +# if (!defined(TARGET_OS_EMBEDDED) || (TARGET_OS_EMBEDDED==0)) \ + && (!defined(TARGET_IPHONE_SIMULATOR) || (TARGET_IPHONE_SIMULATOR==0)) +# define HAVE_GETHOSTUUID 1 +# else +# warning "gethostuuid() is disabled." +# endif +#endif + + #if OS_VXWORKS # include <sys/ioctl.h> # include <semaphore.h> @@ -6602,8 +6613,10 @@ int sqlite3_hostid_num = 0; #define PROXY_HOSTIDLEN 16 /* conch file host id length */ +#ifdef HAVE_GETHOSTUUID /* Not always defined in the headers as it ought to be */ extern int gethostuuid(uuid_t id, const struct timespec *wait); +#endif /* get the host ID via gethostuuid(), pHostID must point to PROXY_HOSTIDLEN ** bytes of writable memory. @@ -6611,8 +6624,7 @@ extern int gethostuuid(uuid_t id, const struct timespec *wait); static int proxyGetHostID(unsigned char *pHostID, int *pError){ assert(PROXY_HOSTIDLEN == sizeof(uuid_t)); memset(pHostID, 0, PROXY_HOSTIDLEN); -# if defined(__APPLE__) && ((__MAC_OS_X_VERSION_MIN_REQUIRED > 1050) || \ - (__IPHONE_OS_VERSION_MIN_REQUIRED > 2000)) +#ifdef HAVE_GETHOSTUUID { struct timespec timeout = {1, 0}; /* 1 sec timeout */ if( gethostuuid(pHostID, &timeout) ){ |