| 1 |
|
| 2 |
/* |
| 3 |
* Copyright (c) 2018 Chris Jones <[email protected]> |
| 4 |
* Copyright (c) 2019 Michael Dickens <[email protected]> |
| 5 |
* |
| 6 |
* Permission to use, copy, modify, and distribute this software for any |
| 7 |
* purpose with or without fee is hereby granted, provided that the above |
| 8 |
* copyright notice and this permission notice appear in all copies. |
| 9 |
* |
| 10 |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 11 |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 12 |
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 13 |
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 14 |
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 15 |
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 16 |
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 |
*/ |
| 18 |
|
| 19 |
#ifndef _MACPORTS_LEGACYSUPPORTDEFS_H_ |
| 20 |
#define _MACPORTS_LEGACYSUPPORTDEFS_H_ |
| 21 |
|
| 22 |
/* Not needed -- #include "AvailabilityMacros.h" */ |
| 23 |
|
| 24 |
/* C++ extern definitions */ |
| 25 |
#if defined(__cplusplus) |
| 26 |
#define __MP__BEGIN_DECLS extern "C" { |
| 27 |
#define __MP__END_DECLS } |
| 28 |
#else |
| 29 |
#define __MP__BEGIN_DECLS |
| 30 |
#define __MP__END_DECLS |
| 31 |
#endif |
| 32 |
|
| 33 |
/* foundational defs, used later */ |
| 34 |
|
| 35 |
#if defined(__i386) |
| 36 |
#define __MP_LEGACY_SUPPORT_I386__ 1 |
| 37 |
#else |
| 38 |
#define __MP_LEGACY_SUPPORT_I386__ 0 |
| 39 |
#endif |
| 40 |
|
| 41 |
/* defines for when legacy support is required for various functions */ |
| 42 |
|
| 43 |
/* fsgetpath */ |
| 44 |
#define __MP_LEGACY_SUPPORT_FSGETPATH__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) |
| 45 |
|
| 46 |
/* **setattrlistat */ |
| 47 |
#define __MP_LEGACY_SUPPORT_SETATTRLISTAT__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) |
| 48 |
|
| 49 |
/* ** utimensat, futimens, UTIME_NOW, UTIME_OMIT */ |
| 50 |
#define __MP_LEGACY_SUPPORT_UTIMENSAT__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) |
| 51 |
|
| 52 |
/* clock_gettime */ |
| 53 |
#define __MP_LEGACY_SUPPORT_GETTIME__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) |
| 54 |
|
| 55 |
/* timespec_get */ |
| 56 |
#define __MP_LEGACY_SUPPORT_TIMESPEC_GET__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) |
| 57 |
|
| 58 |
/* **at calls */ |
| 59 |
#define __MP_LEGACY_SUPPORT_ATCALLS__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101000) |
| 60 |
|
| 61 |
/* fdopendir */ |
| 62 |
#define __MP_LEGACY_SUPPORT_FDOPENDIR__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101000) |
| 63 |
|
| 64 |
/* this header is automatically included by <net/if.h> on systems 10.9 and up. |
| 65 |
It is therefore expected to be included by most current software. */ |
| 66 |
/* <net/if.h> include <sys/socket.h> */ |
| 67 |
#define __MP_LEGACY_SUPPORT_NETIF_SOCKET_FIX__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) |
| 68 |
|
| 69 |
/* CMSG_DATA definition in <sys/socket.h> */ |
| 70 |
#define __MP_LEGACY_SUPPORT_CMSG_DATA_FIX__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 71 |
|
| 72 |
/* stpncpy */ |
| 73 |
#define __MP_LEGACY_SUPPORT_STPNCPY__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 74 |
|
| 75 |
/* strnlen */ |
| 76 |
#define __MP_LEGACY_SUPPORT_STRNLEN__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 77 |
|
| 78 |
/* strndup */ |
| 79 |
#define __MP_LEGACY_SUPPORT_STRNDUP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 80 |
|
| 81 |
/* dprintf */ |
| 82 |
#define __MP_LEGACY_SUPPORT_DPRINTF__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 83 |
|
| 84 |
/* getline */ |
| 85 |
#define __MP_LEGACY_SUPPORT_GETLINE__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 86 |
|
| 87 |
/* memmem */ |
| 88 |
#define __MP_LEGACY_SUPPORT_MEMMEM__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 89 |
|
| 90 |
/* wcsdup */ |
| 91 |
#define __MP_LEGACY_SUPPORT_WCSDUP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 92 |
|
| 93 |
/* wcsnlen */ |
| 94 |
#define __MP_LEGACY_SUPPORT_WCSNLEN__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 95 |
|
| 96 |
/* wcpcpy, wcpncpy */ |
| 97 |
#define __MP_LEGACY_SUPPORT_WCPCPY__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 98 |
|
| 99 |
/* wcsncasecmp_l, wcscasecmp_l, wcsncasecmp, wcscasecmp */ |
| 100 |
#define __MP_LEGACY_SUPPORT_WCSCASECMP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 101 |
|
| 102 |
/* llround */ |
| 103 |
#define __MP_LEGACY_SUPPORT_LLROUND__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 104 |
|
| 105 |
/* arc4random */ |
| 106 |
#define __MP_LEGACY_SUPPORT_ARC4RANDOM__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 107 |
|
| 108 |
/* getentropy */ |
| 109 |
#define __MP_LEGACY_SUPPORT_GETENTROPY__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) |
| 110 |
|
| 111 |
/* posix_memalign does not exist on < 1060 */ |
| 112 |
#define __MP_LEGACY_SUPPORT_POSIX_MEMALIGN__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 113 |
|
| 114 |
/* AI_NUMERICSERV does not exist on < 1060 */ |
| 115 |
#define __MP_LEGACY_SUPPORT_AI_NUMERICSERV__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 116 |
|
| 117 |
/* realpath() on < 1060 does not support modern NULL buffer usage */ |
| 118 |
#define __MP_LEGACY_SUPPORT_REALPATH_WRAP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 119 |
|
| 120 |
/* setattrlistat */ |
| 121 |
#define __MP_LEGACY_SUPPORT_FSETATTRLIST__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 122 |
|
| 123 |
/* localtime_r, gmtime_r, etc only declared on Tiger when _ANSI_SOURCE and _POSIX_C_SOURCE are undefined */ |
| 124 |
#define __MP_LEGACY_SUPPORT_TIME_THREAD_SAFE_FUNCTIONS__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 125 |
|
| 126 |
/* lsmod does not exist on Tiger */ |
| 127 |
#define __MP_LEGACY_SUPPORT_LSMOD__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 128 |
|
| 129 |
/* lutimes does not exist on Tiger */ |
| 130 |
#define __MP_LEGACY_SUPPORT_LUTIMES__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 131 |
|
| 132 |
/* sys/aio.h header needs adjustment to match newer SDKs */ |
| 133 |
#define __MP_LEGACY_SUPPORT_SYSAIOTIGERFIX__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 134 |
|
| 135 |
/* sysconf() is missing some functions on some systems, and may misbehave on i386 */ |
| 136 |
#define __MP_LEGACY_SUPPORT_SYSCONF_WRAP__ (__APPLE__ && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101100 \ |
| 137 |
|| __MP_LEGACY_SUPPORT_I386__)) |
| 138 |
|
| 139 |
/* pthread_rwlock_initializer is not defined on Tiger */ |
| 140 |
#define __MP_LEGACY_SUPPORT_PTHREAD_RWLOCK__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 141 |
|
| 142 |
/* STAILQ_FOREACH is not defined on Tiger*/ |
| 143 |
#define __MP_LEGACY_SUPPORT_STAILQ_FOREACH__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 144 |
|
| 145 |
/* c++11 <cmath> PPC 10.[45] and Intel 10.[4-6], GNU g++ 4.6 through 8. */ |
| 146 |
#if (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070 \ |
| 147 |
&& defined(__GNUC__) && (__GNUC__ <= 8) \ |
| 148 |
&& ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)))) |
| 149 |
#define __MP_LEGACY_SUPPORT_CXX11_CMATH__ 1 |
| 150 |
#else |
| 151 |
#define __MP_LEGACY_SUPPORT_CXX11_CMATH__ 0 |
| 152 |
#endif |
| 153 |
|
| 154 |
/* cossin */ |
| 155 |
#define __MP_LEGACY_SUPPORT_COSSIN__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) |
| 156 |
|
| 157 |
/* ffsl */ |
| 158 |
#define __MP_LEGACY_SUPPORT_FFSL__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 159 |
/* ffsll */ |
| 160 |
#define __MP_LEGACY_SUPPORT_FFSLL__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) |
| 161 |
|
| 162 |
/* fls */ |
| 163 |
#define __MP_LEGACY_SUPPORT_FLS__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 164 |
/* flsl */ |
| 165 |
#define __MP_LEGACY_SUPPORT_FLSL__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050) |
| 166 |
/* flsll */ |
| 167 |
#define __MP_LEGACY_SUPPORT_FLSLL__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) |
| 168 |
|
| 169 |
/* open_memstream */ |
| 170 |
#define __MP_LEGACY_SUPPORT_OPEN_MEMSTREAM__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) |
| 171 |
|
| 172 |
/* fmemopen */ |
| 173 |
#define __MP_LEGACY_SUPPORT_FMEMOPEN__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) |
| 174 |
|
| 175 |
/* pthread_setname_np */ |
| 176 |
#define __MP_LEGACY_SUPPORT_PTHREAD_SETNAME_NP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 177 |
|
| 178 |
/* Compound macros, bundling functionality needed by multiple single features. */ |
| 179 |
#define __MP_LEGACY_SUPPORT_NEED_ATCALL_MACROS__ (__MP_LEGACY_SUPPORT_ATCALLS__ || __MP_LEGACY_SUPPORT_SETATTRLISTAT__) |
| 180 |
|
| 181 |
#define __MP_LEGACY_SUPPORT_NEED_BEST_FCHDIR__ (__MP_LEGACY_SUPPORT_FDOPENDIR__ || __MP_LEGACY_SUPPORT_ATCALLS__ || __MP_LEGACY_SUPPORT_SETATTRLISTAT__) |
| 182 |
|
| 183 |
/* for now, just add missing typedef statements */ |
| 184 |
#define __MP_LEGACY_SUPPORT_UUID__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 185 |
|
| 186 |
/* for now, just forward call to CFPropertyListCreateWithStream */ |
| 187 |
#define __MP_LEGACY_SUPPORT_CoreFoundation__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 188 |
|
| 189 |
/* copyfile and its associated functions have gained functionality over the years */ |
| 190 |
#define __MP_LEGACY_SUPPORT_COPYFILE_WRAP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 191 |
|
| 192 |
/* _tlv_atexit and __cxa_thread_atexit */ |
| 193 |
#define __MP_LEGACY_SUPPORT_ATEXIT_WRAP__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) |
| 194 |
|
| 195 |
/* os_unfair_lock structure and its associated functions */ |
| 196 |
#define __MP_LEGACY_SUPPORT_OS_UNFAIR_LOCK__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) |
| 197 |
|
| 198 |
/* library symbol ___bzero */ |
| 199 |
#define __MP_LEGACY_SUPPORT_SYMBOL____bzero__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1060) |
| 200 |
|
| 201 |
/* library symbol _dirfd */ |
| 202 |
#define __MP_LEGACY_SUPPORT_SYMBOL__dirfd__ (__APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1080) |
| 203 |
|
| 204 |
#endif /* _MACPORTS_LEGACYSUPPORTDEFS_H_ */ |