source: git/src/whichos.h @ affaeee

add-show-splaysline_contentsstereosvn/github/mastersvn/origin/mastersvn/survex-1_1svn/tags/1.1.14svn/tags/1.1.15svn/tags/1.1.16svn/tags/1.2.0svn/tags/1.2.1svn/tags/1.2.2svn/tags/1.2.3svn/tags/1.2.4svn/tags/1.2.5svn/tags/v1_1_10svn/tags/v1_1_11svn/tags/v1_1_12svn/tags/v1_1_13svn/tags/v1_1_7svn/tags/v1_1_8svn/tags/v1_1_9svn/trunktravis-osx
Last change on this file since affaeee was affaeee, checked in by Olly Betts <olly@…>, 14 years ago

Rework the OS== mechanism as defining WIN32 and UNIX causes problems with
third party headers which test for these defines and assume the wrong OS!

git-svn-id: file:///home/survex-svn/survex/branches/survex-1_1@3072 4b37db11-9a0c-4f06-9ece-9ab7cdaee568

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/* whichos.h  Detect which OS we're compiling for.
2 * Copyright (C) 2005 Olly Betts
3 *
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.
8 *
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.
13 *
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
17 */
18
19#ifndef SURVEX_WHICHOS_H
20#define SURVEX_WHICHOS_H
21
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
30
31#if !OS_UNIX
32# if defined WIN32 || defined _WIN32 || defined __WIN32 || defined __WIN32__
33#  define OS_WIN32 1
34# endif
35#endif
36
37#ifndef OS_UNIX
38# define OS_UNIX 0
39#endif
40
41#ifndef OS_UNIX_MACOSX
42# define OS_UNIX_MACOSX 0
43#endif
44
45#ifndef OS_WIN32
46# define OS_WIN32 0
47#endif
48
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
53
54#endif
Note: See TracBrowser for help on using the repository browser.