blob: ddfa46b5d3e4cebdfe817e8c70210e44d76384b5 [file] [log] [blame]
Souvik Ghosh43fcf4a2016-07-07 16:30:48 -07001/*
2 * This file is part of the flashrom project.
3 *
4 * Copyright (C) 2011 Carl-Daniel Hailfinger
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
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.
Souvik Ghosh43fcf4a2016-07-07 16:30:48 -070014 */
15
16/*
17 * Header file for OS checking.
18 */
19
Patrick Georgibd31cdd2017-02-03 19:16:12 +010020#include "platform.h"
21
Souvik Ghosh43fcf4a2016-07-07 16:30:48 -070022// Solaris
23#if defined (__sun) && (defined(__i386) || defined(__amd64))
24#define __FLASHROM_OS__ "SunOS"
25// OS X
26#elif defined(__MACH__) && defined(__APPLE__)
27#define __FLASHROM_OS__ "Darwin"
28// FreeBSD
29#elif defined(__FreeBSD__)
30#define __FLASHROM_OS__ "FreeBSD"
Patrick Georgibd31cdd2017-02-03 19:16:12 +010031// FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD)
32#elif defined(__FreeBSD_kernel__) && defined(__GLIBC__)
33#define __FLASHROM_OS__ "FreeBSD-glibc"
Souvik Ghosh43fcf4a2016-07-07 16:30:48 -070034// DragonFlyBSD
35#elif defined(__DragonFly__)
36#define __FLASHROM_OS__ "DragonFlyBSD"
37// NetBSD
38#elif defined(__NetBSD__)
39#define __FLASHROM_OS__ "NetBSD"
40// OpenBSD
41#elif defined(__OpenBSD__)
42#define __FLASHROM_OS__ "OpenBSD"
43// DJGPP
44#elif defined(__DJGPP__)
45#define __FLASHROM_OS__ "DOS"
46// MinGW (always has _WIN32 available)
47#elif defined(__MINGW32__)
48#define __FLASHROM_OS__ "MinGW"
49// Cygwin (usually without _WIN32)
50#elif defined( __CYGWIN__)
51#define __FLASHROM_OS__ "Cygwin"
52// libpayload
53#elif defined(__LIBPAYLOAD__)
54#define __FLASHROM_OS__ "libpayload"
Patrick Georgibd31cdd2017-02-03 19:16:12 +010055// GNU Hurd
56#elif defined(__gnu_hurd__)
57#define __FLASHROM_OS__ "Hurd"
Souvik Ghosh43fcf4a2016-07-07 16:30:48 -070058// Linux
59#elif defined(__linux__)
Patrick Georgibd31cdd2017-02-03 19:16:12 +010060 // There are various flags in use on Android apparently. __ANDROID__ seems to be the most trustworthy.
61 #if defined(__ANDROID__)
62 #define __FLASHROM_OS__ "Android"
63 #else
64 #define __FLASHROM_OS__ "Linux"
65 #endif
Souvik Ghosh43fcf4a2016-07-07 16:30:48 -070066#endif
67__FLASHROM_OS__