Lingfeng Yang | a2a3b0f | 2020-11-04 11:50:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * O/S-dependent (mis)feature macro definitions |
| 3 | * |
| 4 | Copyright 1991, 1998 The Open Group |
| 5 | |
| 6 | Permission to use, copy, modify, distribute, and sell this software and its |
| 7 | documentation for any purpose is hereby granted without fee, provided that |
| 8 | the above copyright notice appear in all copies and that both that |
| 9 | copyright notice and this permission notice appear in supporting |
| 10 | documentation. |
| 11 | |
| 12 | The above copyright notice and this permission notice shall be included in |
| 13 | all copies or substantial portions of the Software. |
| 14 | |
| 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 19 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 21 | |
| 22 | Except as contained in this notice, the name of The Open Group shall not be |
| 23 | used in advertising or otherwise to promote the sale, use or other dealings |
| 24 | in this Software without prior written authorization from The Open Group. |
| 25 | */ |
| 26 | |
| 27 | #ifndef _XOSDEFS_H_ |
| 28 | # define _XOSDEFS_H_ |
| 29 | |
| 30 | /* |
| 31 | * X_NOT_POSIX means does not have POSIX header files. Lack of this |
| 32 | * symbol does NOT mean that the POSIX environment is the default. |
| 33 | * You may still have to define _POSIX_SOURCE to get it. |
| 34 | */ |
| 35 | |
| 36 | |
| 37 | # ifdef _SCO_DS |
| 38 | # ifndef __SCO__ |
| 39 | # define __SCO__ |
| 40 | # endif |
| 41 | # endif |
| 42 | |
| 43 | # ifdef __i386__ |
| 44 | # ifdef SYSV |
| 45 | # if !defined(__SCO__) && \ |
| 46 | !defined(__UNIXWARE__) && !defined(__sun) |
| 47 | # if !defined(_POSIX_SOURCE) |
| 48 | # define X_NOT_POSIX |
| 49 | # endif |
| 50 | # endif |
| 51 | # endif |
| 52 | # endif |
| 53 | |
| 54 | # ifdef __sun |
| 55 | /* Imake configs define SVR4 on Solaris, but cc & gcc only define __SVR4 |
| 56 | * This check allows non-Imake configured programs to build correctly. |
| 57 | */ |
| 58 | # if defined(__SVR4) && !defined(SVR4) |
| 59 | # define SVR4 1 |
| 60 | # endif |
| 61 | # ifdef SVR4 |
| 62 | /* define this to whatever it needs to be */ |
| 63 | # define X_POSIX_C_SOURCE 199300L |
| 64 | # endif |
| 65 | # endif |
| 66 | |
| 67 | # ifdef WIN32 |
| 68 | # ifndef _POSIX_ |
| 69 | # define X_NOT_POSIX |
| 70 | # endif |
| 71 | # endif |
| 72 | |
| 73 | |
| 74 | # ifdef __APPLE__ |
| 75 | # define NULL_NOT_ZERO |
| 76 | |
| 77 | /* Defining any of these will sanitize the namespace to JUST want is defined by |
| 78 | * that particular standard. If that happens, we don't get some expected |
| 79 | * prototypes, typedefs, etc (like fd_mask). We can define _DARWIN_C_SOURCE to |
| 80 | * loosen our belts a tad. |
| 81 | */ |
| 82 | # if defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) |
| 83 | # ifndef _DARWIN_C_SOURCE |
| 84 | # define _DARWIN_C_SOURCE |
| 85 | # endif |
| 86 | # endif |
| 87 | |
| 88 | # endif |
| 89 | |
| 90 | # ifdef __GNU__ |
| 91 | # ifndef PATH_MAX |
| 92 | # define PATH_MAX 4096 |
| 93 | # endif |
| 94 | # ifndef MAXPATHLEN |
| 95 | # define MAXPATHLEN 4096 |
| 96 | # endif |
| 97 | # endif |
| 98 | |
| 99 | # if defined(__SCO__) || defined(__UNIXWARE__) |
| 100 | # ifndef PATH_MAX |
| 101 | # define PATH_MAX 1024 |
| 102 | # endif |
| 103 | # ifndef MAXPATHLEN |
| 104 | # define MAXPATHLEN 1024 |
| 105 | # endif |
| 106 | # endif |
| 107 | |
| 108 | # if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) \ |
| 109 | || defined(__APPLE__) || defined(__DragonFly__) |
| 110 | # ifndef CSRG_BASED |
| 111 | # define CSRG_BASED |
| 112 | # endif |
| 113 | # endif |
| 114 | |
| 115 | #endif /* _XOSDEFS_H_ */ |
| 116 | |