6 .Nd manipulate compatibility settings
8 .Ev COMMAND_MODE=legacy|unix2003
10 .Ev SYSTEM_VERSION_COMPAT=1
12 .Fd #define _POSIX_C_SOURCE
13 .Fd #define _DARWIN_C_SOURCE
14 .Fd #define _NONSTD_SOURCE
18 .Fd defined(_DARWIN_FEATURE_UNIX_CONFORMANCE)
20 Setting the environment variable
22 to the value legacy causes utility programs to behave as closely to
23 Mac OS X 10.3's utility programs as possible. When in this mode all of 10.3's
24 flags are accepted, and in some cases extra flags are accepted, but no flags
25 that were used in 10.3 will have been removed or changed in meaning. Any
26 behavioral changes in this mode are documented in the LEGACY sections of the
29 Setting the environment variable
31 to the value unix2003 causes utility programs to obey the
33 standards even if doing so would alter the behavior of flags used in 10.3.
37 is case insensitive and if it is unset or set to something other than legacy
38 or unix2003 it behaves as if it were set to unix2003.
40 Setting the environment variable
41 .Ev SYSTEM_VERSION_COMPAT
42 to 1 causes the system version to be reported as 10.16 when running on macOS 11 or later.
46 for i386 causes library and kernel calls to behave as closely to Mac
47 OS X 10.3's library and kernel calls as possible. Any behavioral changes are
48 documented in the LEGACY sections of the man pages for the individual function
49 calls. Defining this macro when compiling for any other architecture will
50 result in a compilation error.
56 causes library and kernel calls to conform to the SUSv3
57 standards even if doing so would alter the behavior of functions used in 10.3.
60 also removes functions, types, and other interfaces that are not part of SUSv3
61 from the normal C namespace, unless
63 is also defined (i.e.,
67 with non-POSIX extensions).
68 In any of these cases, the
69 .Dv _DARWIN_FEATURE_UNIX_CONFORMANCE
70 feature macro will be defined to the SUS conformance level (it is undefined
73 Starting in Mac OS X 10.5, if none of the macros
78 are defined, and the environment variable
79 .Ev MACOSX_DEPLOYMENT_TARGET
80 is either undefined or set to 10.5 or greater (or equivalently, the
83 .Fl mmacosx-version-min
84 is either not specified or set to 10.5 or greater), then UNIX conformance will
85 be on by default, and non-POSIX extensions will also be available
86 (this is the equivalent of defining
87 .Dv _DARWIN_C_SOURCE ) .
88 For version values less that 10.5, UNIX conformance will be off when targeting
89 i386 (the equivalent of defining
90 .Dv _NONSTD_SOURCE ) .
92 In order to provide both legacy and conformance versions of functions, two
93 versions of affected functions are provided. Legacy variants have symbol names
94 with no suffix in order to maintain ABI compatibility. Conformance versions
95 have a $UNIX2003 suffix appended to their symbol name. These $UNIX2003
96 suffixes are automatically appended by the compiler tool-chain and should not
99 Platforms that were released after these updates only have conformance variants
100 available and do not have a $UNIX2003 suffix.
118 user defines deployment namespace conformance suffix
123 T} < 10.5 full 10.3 compatibility (none)
126 T} >= 10.5 full SUSv3 conformance $UNIX2003
129 T} (any) full 10.3 compatibility (none)
132 T} < 10.4 full 10.3 compatibility (none)
135 T} >= 10.4 full SUSv3 conformance $UNIX2003
138 T} < 10.4 strict 10.3 compatibility (none)
141 T} >= 10.4 strict SUSv3 conformance $UNIX2003
152 .Dv Newer Architectures
155 user defines deployment namespace conformance suffix
160 T} (any) full SUSv3 conformance (none)
166 T} (any) full SUSv3 conformance (none)
169 T} (any) strict SUSv3 conformance (none)
173 With COMMAND_MODE set to anything other than legacy, utility functions conform to
180 for i386, or when building for any other architecture,
181 system and library calls conform to
184 Different parts of a program can be compiled with different compatibility
186 The resultant program will normally work as expected, for example a regex
189 can be passed to the legacy
191 with no unexpected results. Some cases are less clear cut, for example
192 what does the programmer intend when they use the SUSv3
194 to compile a regex, but the legacy
196 to execute it? Any interpretation will surprise someone.