Tweak code formatting
[survex.git] / src / whichos.h
blobf9a95b54e25e640839f6aa7bb6610689c9cd29f6
1 /* whichos.h Detect which OS we're compiling for.
2 * Copyright (C) 2005 Olly Betts
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #ifndef SURVEX_WHICHOS_H
20 #define SURVEX_WHICHOS_H
22 /* Attempt to auto-detect OS. */
23 #if (defined(unix) || defined(UNIX))
24 # define OS_UNIX 1
25 #elif defined(__GNUC__) && defined(__APPLE_CC__)
26 /* MacOS X is Unix for most purposes. */
27 # define OS_UNIX 1
28 # define OS_UNIX_MACOSX 1
29 #endif
31 #if !OS_UNIX
32 # if defined WIN32 || defined _WIN32 || defined __WIN32 || defined __WIN32__
33 # define OS_WIN32 1
34 # endif
35 #endif
37 #ifndef OS_UNIX
38 # define OS_UNIX 0
39 #endif
41 #ifndef OS_UNIX_MACOSX
42 # define OS_UNIX_MACOSX 0
43 #endif
45 #ifndef OS_WIN32
46 # define OS_WIN32 0
47 #endif
49 /* Check that we detected an OS! */
50 # if !(OS_UNIX+OS_WIN32)
51 # error Failed to detect which os to compile for
52 # endif
54 #endif