| 1 | /* whichos.h |
|---|
| 2 | * Determines which OS Survex will try to compile for |
|---|
| 3 | * Copyright (C) 1993-1995,2002,2003 Olly Betts |
|---|
| 4 | * |
|---|
| 5 | * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program; if not, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | /* Built-in #define-s that identify compilers: (initals => checked) |
|---|
| 21 | * __arm (Acorn) Norcroft RISC OS ARM C vsn 4.00 (OJWB) |
|---|
| 22 | * also __CC_NORCROFT __riscos __acorn |
|---|
| 23 | * unix,UNIX Unix systems (?) |
|---|
| 24 | * __MSDOS__ Borland C++ (OJWB) |
|---|
| 25 | * [also __BORLANDC__ (version num) __TURBOC__ (version num)] |
|---|
| 26 | * __TURBOC__ Turbo C |
|---|
| 27 | * __GO32__,unix,MSDOS,__DJGPP__ |
|---|
| 28 | * DJGPP (W) (also GO32, __MSDOS__) |
|---|
| 29 | * _MSDOS, (MSDOS not ANSI) Microsoft C (OJWB) |
|---|
| 30 | * MC68000, mc68000, SOZOBON, ATARI_ST, TOS|MINIX |
|---|
| 31 | * Sozobon C (OJWB from MM's docs) |
|---|
| 32 | * MacOSX with apple modified gcc: |
|---|
| 33 | * -D__ppc__ -D__MACH__ -D__APPLE__ -D__APPLE_CC__=932 |
|---|
| 34 | */ |
|---|
| 35 | |
|---|
| 36 | #ifndef WHICHOS_H |
|---|
| 37 | # define WHICHOS_H |
|---|
| 38 | |
|---|
| 39 | /* if OS has been defined, then assume they know what they're up to */ |
|---|
| 40 | # ifndef OS |
|---|
| 41 | /* Okay, let's try to be clever and auto-detect - if OS gets defined more |
|---|
| 42 | * than once, compiler should barf and warn user |
|---|
| 43 | */ |
|---|
| 44 | # ifdef __riscos |
|---|
| 45 | # define OS RISCOS |
|---|
| 46 | # endif |
|---|
| 47 | # if (defined (_MSDOS) || defined(MSDOS) || defined(__MSDOS__)) |
|---|
| 48 | # undef unix /* DJGPP defines this */ |
|---|
| 49 | # undef MSDOS |
|---|
| 50 | # define OS MSDOS |
|---|
| 51 | # endif |
|---|
| 52 | # if (defined(unix) || defined(UNIX)) |
|---|
| 53 | # undef UNIX /* to stop it causing problems later */ |
|---|
| 54 | # define OS UNIX |
|---|
| 55 | # endif |
|---|
| 56 | # if defined(__GNUC__) && defined(__APPLE_CC__) |
|---|
| 57 | /* Mac OS X is Unix underneath */ |
|---|
| 58 | # define OS UNIX |
|---|
| 59 | # endif |
|---|
| 60 | # if (defined(ATARI_ST) || defined(TOS)) |
|---|
| 61 | # undef TOS |
|---|
| 62 | # define OS TOS |
|---|
| 63 | # endif |
|---|
| 64 | # if (defined (WIN32) || defined(__WIN32__)) |
|---|
| 65 | # undef WIN32 |
|---|
| 66 | # define OS WIN32 |
|---|
| 67 | # endif |
|---|
| 68 | /* etc ... */ |
|---|
| 69 | # endif /*!defined(OS)*/ |
|---|
| 70 | |
|---|
| 71 | /* predefine OS to be one of these (eg in the make file) to force a compile |
|---|
| 72 | * for an OS/compiler combination not support or that clashes somehow. |
|---|
| 73 | * eg with -DOS=AMIGA to predefine OS as AMIGA |
|---|
| 74 | */ |
|---|
| 75 | # define RISCOS 1 |
|---|
| 76 | # define MSDOS 2 |
|---|
| 77 | # define UNIX 3 |
|---|
| 78 | # define AMIGA 4 |
|---|
| 79 | # define TOS 5 |
|---|
| 80 | # define WIN32 6 |
|---|
| 81 | /* Just numbers, not a rating system ;) */ |
|---|
| 82 | |
|---|
| 83 | /* One last check, in case nothing worked */ |
|---|
| 84 | # ifndef OS |
|---|
| 85 | # error Sorry, do not know what OS to compile for - look at whichos.h |
|---|
| 86 | # endif |
|---|
| 87 | #endif |
|---|