1 /* 2 Language Independent Library 3 Copyright 1983-2008 Green Hills Software,Inc. 4 5 * This program is the property of Green Hills Software, Inc, 6 * its contents are proprietary information and no part of it 7 * is to be disclosed to anyone except employees of Green Hills 8 * Software, Inc., or as agreed in writing signed by the President 9 * of Green Hills Software, Inc. 10 */ 11 12 /* 13 The Green Hills Software Libraries have been ported to many versions of 14 Unix and other target environments, each with their major and minor 15 differences and conflicts. 16 17 Every attempt has been made to isolate these differences into indOS.c 18 and a few other files. 19 20 At present, the following target environments and flavors of Unix are 21 understood: 22 23 Only one of the following should ever be set: 24 BSD \ 25 DECMIPS \ 26 DGUX \ 27 NEXT \ 28 SCOUNIX \ imply ANYUNIX 29 SOLARIS20 / 30 SYSV / 31 SYSV40 / 32 SUNOS / 33 __linux / 34 ANOTHERUNIX / 35 ------------ 36 EMBEDDED 37 MSDOS 38 __windows 39 UNIXSYSCALLS 40 __VXWORKS 41 CHORUS 42 OSE 43 LYNX 44 Variables in the first group are intended to represent various genuine 45 Unix systems. All of these imply the variable 'ANYUNIX', which is used 46 to select the most generic features of Unix, such as directories with / 47 and system calls like fork(), exec(), link() and unlink(). 48 49 The UNIXSYSCALLS variable describes a target environment which resembles 50 Unix, but lacks the 'isatty' system call and does not handle signals. 51 It was originally implemented for the i860 APX coprocessor 52 environment, which emulates Unix under MSDOS and OS/2. 53 */ 54 #if defined(__INTEGRITY_SHARED_LIBS) 55 # define UN_BUFFERED_STD 1 56 # define POSIX_SUITE_RULES 1 57 # define VARIABLE_FILE_BUFFERS 1 58 #endif 59 /* 60 * VARIABLE_FILE_BUFFERS means that the size of buffer can be controlled 61 * via setvbuf() and __gh_bufinit. It is orthogonal to LESS_BUFFERED_IO 62 */ 63 64 /* 65 ANYBSD is any non-System V Unix system which provides these Bsd 4.3 calls: 66 rename 67 truncate 68 gettimeofday 69 vfork 70 signal/kill 71 and this library routine 72 on_exit 73 */ 74 75 #ifdef __VXWORKS /* vxWorks.h defines BSD */ 76 #undef BSD 77 #undef MSW 78 #endif 79 #if defined(MSW) 80 #error Windows 3.1 not supported 81 #endif 82 #if defined(BSD) || defined(SUNOS) 83 #define ANYBSD 84 #endif 85 86 /* ANYSYSV4 is any Unix system that is based on Unix System V.4 87 1. the timezone interface is System V and not Bsd. 88 2. the stat struct is enlarged versus either V.3 or Bsd. 89 3. weak symbols are available 90 4. the C library is a full (and correct) Ansi C implementation 91 5. truncate exists 92 6. signals are System V style, not BSD style 93 */ 94 #if defined(DGUX) || defined(SOLARIS20) || defined(SYSV40) 95 #define ANYSYSV4 96 #endif 97 98 /* ANYSYSV is any Unix system which is based on Unix System V.3 or V.4 99 1. the timezone interface is System V and not Bsd. 100 2. ANYSYSV is used with __m88k to distinguish OCS specific features 101 */ 102 #if defined(SCOUNIX) || defined(SYSV) || defined(ANYSYSV4) || defined(DECMIPS) 103 #define ANYSYSV 104 #endif 105 106 /* LIBCISANSI means a Unix system which has an Ansi compliant libc.a 107 On such systems the driver will use libc.a instead of libind.a libansi.a 108 */ 109 #if (defined(ANYSYSV4) || defined(NEXT) || defined(__VXWORKS) || \ 110 defined(DECMIPS) || defined(CHORUS) || defined(__linux) || defined(__LYNX)) 111 #define LIBCISANSI 112 #endif 113 114 #define _______UnixCount \ 115 defined(BSD) + \ 116 defined(DECMIPS) + \ 117 defined(DGUX) + \ 118 defined(NEXT) + \ 119 defined(SCOUNIX) + \ 120 defined(SOLARIS20) + \ 121 defined(SUNOS) + \ 122 defined(SYSV) + \ 123 defined(SYSV40) + \ 124 defined(__linux) + \ 125 defined(ANOTHERUNIX) 126 #define _____OtherCount \ 127 defined(EMBEDDED) + \ 128 defined(MSDOS) + \ 129 defined(__windows) + \ 130 defined(UNIXSYSCALLS) + \ 131 defined(__VXWORKS) + \ 132 defined(CHORUS) + \ 133 defined(__OSE) + \ 134 defined(__LYNX) 135 136 /* Make EMBEDDED the default */ 137 #if _______UnixCount + _____OtherCount == 0 138 #define EMBEDDED 139 #endif 140 141 /* MINIMUM_SPACE uses more compact code which is more appropriate for embedded 142 uses. Often this means dropping code which is only there for Unix 143 compatibility, or which is only relevant when we might use our libansi with 144 another vendor's libc.a 145 LESS_BUFFERED_IO is a specific space-saving change that makes sense in 146 embedded uses, but actually works on Unix as well. It is almost always used 147 together with MINIMUM_SPACE. stdin and stdout are unbuffered by default. 148 To recover the benefits of buffering, functions like printf and fwrite 149 create their own buffers and flush them before exiting. Thus, a call to 150 printf or fwrite will probably only call write() one more time than if 151 full buffering was in use. putc(), however, always calls write(). 152 Internally LESS_BUFFERED_IO means: 153 _io_buffering is ignored, except for 2 uses (fputs and printf) 154 _io_stdio_buffer is never set because malloc is never called. 155 */ 156 #if defined(EMBEDDED) && !defined(__INTEGRITY_SHARED_LIBS) 157 # define MINIMUM_SPACE 1 158 # define NO_LOCALE_DECIMAL_POINT 1 159 # if !(defined(__StarCore__) || defined(__SC3__)) && !defined(NO_LESS_BUFFERED_IO) 160 # define LESS_BUFFERED_IO 1 161 # endif 162 # define NO_INITIALIZED_DATA 1 163 /* # define APPEND_MEANS_SEEK_BEFORE_WRITE 1 */ 164 #endif 165 166 #if defined(EMBEDDED) && defined(__MLIBCALL) 167 #undef _______UnixCount 168 #undef _____OtherCount 169 #define _______UnixCount 0 170 #define _____OtherCount 1 171 #endif 172 173 #if _______UnixCount == 1 174 #define ANYUNIX 175 #elif _______UnixCount > 1 176 #error Too many Unix target environments defined 177 #endif 178 179 #if _____OtherCount > 1 180 #error Too many non-Unix target environments defined 181 #elif (_____OtherCount == 1) && defined(ANYUNIX) 182 #error Both Unix and non-Unix target environments defined 183 #endif 184 185 #if (_______UnixCount + _____OtherCount) == 0 186 #error No target environment defined 187 #endif 188 189 #if defined(EMBEDDED) 190 # if !((defined(__MC68000) || defined(__ppc)) && defined(__COFF)) && !defined(__scllc_asm) && !defined(NO_DYNAMIC_LIBS) 191 # define DYNAMIC_LONG_LONG_PRINTF 1 192 # define DYNAMIC_FLOAT_PRINTF 1 193 # define DYNAMIC_FLOAT_SCANF 1 194 # endif 195 # if !defined(NO_DYNAMIC_LIBS) 196 # define DYNAMIC_EINT1_PRINTF 1 197 # endif 198 #endif 199