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