gallium: deduplicate os detection logic by using detect_os.h

This allows us to avoid having to rename all the PIPE_OS_* at once while
still making sure PIPE_OS_* and DETECT_OS_* are always in sync.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Eric Engestrom 2019-08-01 14:58:52 +01:00
parent 8c52bca112
commit 9a5148190a
1 changed files with 20 additions and 29 deletions

View File

@ -144,71 +144,62 @@
/*
* Auto-detect the operating system family.
*/
#include "util/detect_os.h"
#if defined(__linux__)
#if DETECT_OS_LINUX
#define PIPE_OS_LINUX
#endif
#if DETECT_OS_UNIX
#define PIPE_OS_UNIX
#endif
/*
* Android defines __linux__ so PIPE_OS_LINUX and PIPE_OS_UNIX will also be
* defined.
*/
#if defined(ANDROID)
#if DETECT_OS_ANDROID
#define PIPE_OS_ANDROID
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#if DETECT_OS_FREEBSD
#define PIPE_OS_FREEBSD
#define PIPE_OS_BSD
#define PIPE_OS_UNIX
#endif
#if defined(__OpenBSD__)
#if DETECT_OS_BSD
#define PIPE_OS_BSD
#endif
#if DETECT_OS_OPENBSD
#define PIPE_OS_OPENBSD
#define PIPE_OS_BSD
#define PIPE_OS_UNIX
#endif
#if defined(__NetBSD__)
#if DETECT_OS_NETBSD
#define PIPE_OS_NETBSD
#define PIPE_OS_BSD
#define PIPE_OS_UNIX
#endif
#if defined(__DragonFly__)
#if DETECT_OS_DRAGONFLY
#define PIPE_OS_DRAGONFLY
#define PIPE_OS_BSD
#define PIPE_OS_UNIX
#endif
#if defined(__GNU__)
#if DETECT_OS_HURD
#define PIPE_OS_HURD
#define PIPE_OS_UNIX
#endif
#if defined(__sun)
#if DETECT_OS_SOLARIS
#define PIPE_OS_SOLARIS
#define PIPE_OS_UNIX
#endif
#if defined(__APPLE__)
#if DETECT_OS_APPLE
#define PIPE_OS_APPLE
#define PIPE_OS_UNIX
#endif
#if defined(_WIN32) || defined(WIN32)
#if DETECT_OS_WINDOWS
#define PIPE_OS_WINDOWS
#endif
#if defined(__HAIKU__)
#if DETECT_OS_HAIKU
#define PIPE_OS_HAIKU
#define PIPE_OS_UNIX
#endif
#if defined(__CYGWIN__)
#if DETECT_OS_CYGWIN
#define PIPE_OS_CYGWIN
#define PIPE_OS_UNIX
#endif
#endif /* P_CONFIG_H_ */