| 1 | /* |
|---|
| 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. |
|---|
| 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | /* |
|---|
| 21 | * Header file for OS checking. |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | // Solaris |
|---|
| 25 | #if defined (__sun) && (defined(__i386) || defined(__amd64)) |
|---|
| 26 | #define __FLASHROM_OS__ "SunOS" |
|---|
| 27 | // OS X |
|---|
| 28 | #elif defined(__MACH__) && defined(__APPLE__) |
|---|
| 29 | #define __FLASHROM_OS__ "Darwin" |
|---|
| 30 | // FreeBSD |
|---|
| 31 | #elif defined(__FreeBSD__) |
|---|
| 32 | #define __FLASHROM_OS__ "FreeBSD" |
|---|
| 33 | // FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD) |
|---|
| 34 | #elif defined(__FreeBSD_kernel__) && defined(__GLIBC__) |
|---|
| 35 | #define __FLASHROM_OS__ "FreeBSD-glibc" |
|---|
| 36 | // DragonFlyBSD |
|---|
| 37 | #elif defined(__DragonFly__) |
|---|
| 38 | #define __FLASHROM_OS__ "DragonFlyBSD" |
|---|
| 39 | // NetBSD |
|---|
| 40 | #elif defined(__NetBSD__) |
|---|
| 41 | #define __FLASHROM_OS__ "NetBSD" |
|---|
| 42 | // OpenBSD |
|---|
| 43 | #elif defined(__OpenBSD__) |
|---|
| 44 | #define __FLASHROM_OS__ "OpenBSD" |
|---|
| 45 | // DJGPP |
|---|
| 46 | #elif defined(__DJGPP__) |
|---|
| 47 | #define __FLASHROM_OS__ "DOS" |
|---|
| 48 | // MinGW (always has _WIN32 available) |
|---|
| 49 | #elif defined(__MINGW32__) |
|---|
| 50 | #define __FLASHROM_OS__ "MinGW" |
|---|
| 51 | // Cygwin (usually without _WIN32) |
|---|
| 52 | #elif defined( __CYGWIN__) |
|---|
| 53 | #define __FLASHROM_OS__ "Cygwin" |
|---|
| 54 | // libpayload |
|---|
| 55 | #elif defined(__LIBPAYLOAD__) |
|---|
| 56 | #define __FLASHROM_OS__ "libpayload" |
|---|
| 57 | // Linux |
|---|
| 58 | #elif defined(__linux__) |
|---|
| 59 | #define __FLASHROM_OS__ "Linux" |
|---|
| 60 | #endif |
|---|
| 61 | __FLASHROM_OS__ |
|---|