blob: ddfa46b5d3e4cebdfe817e8c70210e44d76384b5 [file] [log] [blame]
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +00001/*
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.
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000014 */
15
16/*
17 * Header file for OS checking.
18 */
19
Stefan Taunerb0eee9b2015-01-10 09:32:50 +000020#include "platform.h"
21
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000022// 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"
Carl-Daniel Hailfingera5eecda2012-02-25 22:50:21 +000031// FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD)
32#elif defined(__FreeBSD_kernel__) && defined(__GLIBC__)
33#define __FLASHROM_OS__ "FreeBSD-glibc"
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000034// 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"
Stefan Tauner8e656542016-03-06 22:32:16 +000055// GNU Hurd
56#elif defined(__gnu_hurd__)
57#define __FLASHROM_OS__ "Hurd"
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000058// Linux
59#elif defined(__linux__)
Stefan Tauner23e10b82016-01-23 16:16:49 +000060 // 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
Carl-Daniel Hailfinger33a65a02011-12-20 00:51:44 +000066#endif
67__FLASHROM_OS__