UNIXworkcode

1 /******************************************************************************* 2 * * 3 * system.h -- Compile Time Configuration Header File * 4 * * 5 * Copyright (C) 2001 Scott Tringali * 6 * * 7 * This is free software; you can redistribute it and/or modify it under the * 8 * terms of the GNU General Public License as published by the Free Software * 9 * Foundation; either version 2 of the License, or (at your option) any later * 10 * version. In addition, you may distribute version of this program linked to * 11 * Motif or Open Motif. See README for details. * 12 * * 13 * This software is distributed in the hope that it will be useful, but WITHOUT * 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * 16 * for more details. * 17 * * 18 * You should have received a copy of the GNU General Public License along with * 19 * software; if not, write to the Free Software Foundation, Inc., 59 Temple * 20 * Place, Suite 330, Boston, MA 02111-1307 USA * 21 * * 22 * Nirvana Text Editor * 23 * July 23, 2001 * 24 * * 25 * Written by Scott Tringali, http://www.tringali.org * 26 * * 27 *******************************************************************************/ 28 29 30 #ifndef NEDIT_SYSTEM_H_INCLUDED 31 #define NEDIT_SYSTEM_H_INCLUDED 32 33 /* 34 Determine which machine we were compiled with. This isn't as accurate 35 as calling uname(), which is preferred. However, this gets us very close 36 for a majority of the machines out there, and doesn't require any games 37 with make. 38 39 A better, but trickier solution, is to run uname at compile time, capture 40 the string, and place it in the executable. 41 42 Please update this with the proper symbols for your compiler/CPU. It 43 may take a little sleuthing to find out what the correct symbol is. 44 Better compilers/OSs document the symbols they define, but not all do. 45 Usually, the correct ones are prepended with an _ or __, as this is 46 namespace is reserved by ANSI C for the compiler implementation. 47 48 The order is important for the x86 macros. Some compilers will 49 simultanenously define __i386 and __pentium, so we pick the highest one. 50 51 Some of the info below derived from these excellent references: 52 53 http://www.fortran-2000.com/ArnaudRecipes/Version.html 54 http://predef.sourceforge.net/ 55 */ 56 57 #if defined(__alpha) || defined (_M_ALPHA) 58 # define COMPILE_MACHINE "Alpha" 59 60 #elif defined(__mips) 61 # define COMPILE_MACHINE "MIPS" 62 63 #elif defined(__sparc) 64 # define COMPILE_MACHINE "Sparc" 65 66 #elif defined(__sparcv9) 67 # define COMPILE_MACHINE "Sparc64" 68 69 #elif defined(__hppa) 70 # define COMPILE_MACHINE "PA-RISC" 71 72 #elif defined(__ALTIVEC__) 73 # define COMPILE_MACHINE "PowerPC Altivec" 74 75 #elif defined(__POWERPC__) || defined(__ppc__) || defined(__powerpc__) || defined(_POWER) 76 # define COMPILE_MACHINE "PowerPC" 77 78 #elif defined(__x86_64) || defined(_x86_64) 79 # define COMPILE_MACHINE "x86-64" 80 81 #elif defined(__IA64) || defined(__ia64) 82 # define COMPILE_MACHINE "IA64" 83 84 #elif defined(__k6) || defined(__k6__) 85 # define COMPILE_MACHINE "K6" 86 87 #elif defined(__athlon) || defined(__athlon__) 88 # define COMPILE_MACHINE "Athlon" 89 90 #elif defined(__pentium4) || defined(__pentium4__) 91 # define COMPILE_MACHINE "Pentium IV" 92 93 #elif defined(__pentium3) || defined(__pentium3__) 94 # define COMPILE_MACHINE "Pentium III" 95 96 #elif defined(__pentium2) || defined(__pentium2__) 97 # define COMPILE_MACHINE "Pentium II" 98 99 #elif defined(__pentiumpro) || defined(__pentiumpro__) 100 # define COMPILE_MACHINE "Pentium Pro" 101 102 #elif defined(__pentium) || defined(__pentium__) 103 # define COMPILE_MACHINE "Pentium" 104 105 #elif defined(__i486) || defined(__i486__) 106 # define COMPILE_MACHINE "486" 107 108 #elif defined(__i386) || defined(__i386__) 109 # define COMPILE_MACHINE "386" 110 111 #elif defined(_M_IX86) || defined(_X86_) || defined (__x86__) 112 # define COMPILE_MACHINE "x86" 113 114 #elif defined(__VAX) 115 # define COMPILE_MACHINE "VAX" /* Untested, please verify */ 116 117 #else 118 # define COMPILE_MACHINE "Unknown" 119 #endif 120 121 122 123 #if defined(__osf__) 124 # define COMPILE_OS "Tru64/Digital Unix" 125 126 #elif defined(__sun) 127 # define COMPILE_OS "Solaris" 128 129 #elif defined(__hpux) 130 # define COMPILE_OS "HP/UX" 131 132 #elif defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 133 # define COMPILE_OS "Win32" 134 135 #elif defined(__sgi) 136 # define COMPILE_OS "IRIX" 137 138 #elif defined(__Lynx__) 139 # define COMPILE_OS "Lynx" 140 141 #elif defined(__linux__) 142 # define COMPILE_OS "Linux" 143 144 #elif defined(_AIX) 145 # define COMPILE_OS "AIX" 146 147 #elif defined(__VMS) /* Untested, please verify */ 148 # define COMPILE_OS "VMS" 149 150 #elif defined(__FreeBSD__) 151 # define COMPILE_OS "FreeBSD" 152 153 #elif defined(__OpenBSD__) /* Untested, please verify */ 154 # define COMPILE_OS "OpenBSD" 155 156 #elif defined(__NetBSD__) /* Untested, please verify */ 157 # define COMPILE_OS "NetBSD" 158 159 #elif defined(__bsdi) /* Untested, please verify */ 160 # define COMPILE_OS "BSDI" 161 162 #elif defined(__ultrix) /* Untested, please verify */ 163 # define COMPILE_OS "Ultrix" 164 165 #elif defined(__EMX__) /* I think this should be __OS2__ */ 166 # define COMPILE_OS "OS/2" 167 168 #elif defined(__APPLE__) || defined(__MACOSX__) 169 # define COMPILE_OS "MacOS X" 170 171 #elif defined(__UNIXWARE__) 172 # define COMPILE_OS "UnixWare" 173 174 #elif defined(__unix__) /* Unknown Unix, next to last */ 175 # define COMPILE_OS "Unix" 176 177 #else 178 # define COMPILE_OS "Unknown" 179 #endif 180 181 182 183 #if defined (__DECC) 184 # define COMPILE_COMPILER "DEC C" 185 186 #elif defined (__DECCXX) 187 # define COMPILE_COMPILER "DEC C++" 188 189 #elif defined (__APOGEE) 190 # define COMPILE_COMPILER "Apogee" 191 192 #elif defined (__SUNPRO_C) 193 # define COMPILE_COMPILER "Sun Studio C" /* aka Sun WorkShop, Sun ONE studio, Forte, Sun Studio, ARGH! */ 194 195 #elif defined (__SUNPRO_CC) 196 # define COMPILE_COMPILER "Sun Studio C++" /* aka Sun WorkShop, Sun ONE studio, Forte, Sun Studio, ARGH! */ 197 198 #elif defined (__LCC__) 199 # define COMPILE_COMPILER "LCC" 200 201 #elif defined (_MSC_VER) 202 # define COMPILE_COMPILER "Microsoft C" 203 204 #elif defined (__BORLANDC__) 205 # define COMPILE_COMPILER "Borland C" 206 207 #elif defined (__sgi) && defined (_COMPILER_VERSION) 208 # define COMPILE_COMPILER "SGI MipsPro" 209 210 #elif defined (__xlC__) /* Unix version of IBM C */ 211 # define COMPILE_COMPILER "IBM xlC" 212 213 #elif defined (__IBMC__) 214 # define COMPILE_COMPILER "IBM C" /* PC (OS/2, Windows) versions */ 215 216 #elif defined (__HP_cc) 217 # define COMPILE_COMPILER "HP cc" 218 219 #elif defined (__HP_aCC) 220 # define COMPILE_COMPILER "HP aCC" 221 222 #elif defined (__KCC) 223 # define COMPILE_COMPILER "KAI C++" 224 225 #elif defined (__MWERKS__) 226 # define COMPILE_COMPILER "Metrowerks CodeWarrior" 227 228 #elif defined (__WATCOMC__) 229 # define COMPILE_COMPILER "Watcom C/C++" 230 231 #elif defined (__INTEL_COMPILER) 232 # define COMPILE_COMPILER "Intel C++" 233 234 #elif defined (__clang__) 235 # define COMPILE_COMPILER "Clang" 236 237 #elif defined (__llvm__) 238 # define COMPILE_COMPILER "LLVM" 239 240 /* GCC needs to be near the bottom of this list, because Intel and Clang have GCC 241 command-line emulation modes. */ 242 243 #elif defined(__GNUC__) 244 # define COMPILE_COMPILER "GNU C" 245 246 /* The next few entries are last-ditch efforts to guess the compiler, if 247 no compiler macro exists. These need to be at the end of the list, 248 after all the compilers we really recognize. */ 249 250 #elif defined (__hpux) /* HP has no indentifier, so guessing here */ 251 # define COMPILE_COMPILER "HP C [?]" 252 253 #elif defined (__sgi) /* Same for old versions of SGI cc */ 254 # define COMPILE_COMPILER "SGI MipsPro [?]" 255 256 #else 257 # define COMPILE_COMPILER "Unknown" /* Must be last */ 258 #endif 259 260 #endif /* NEDIT_SYSTEM_H_INCLUDED */ 261