/* Copyright (C) 2008 Andreas Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef WOLF_SYS_H #define WOLF_SYS_H /** * @addtogroup wolf_port Porting * @{ */ /** * @file sys.h * @brief main port file with constants and flags per platform * @author Andreas Baumann */ #if defined LINUX #if OS_MAJOR_VERSION == 2 #if OS_MINOR_VERSION == 6 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_STRCASECMP #define HAVE_STRNCASECMP #define HAVE_STRINGS_H #define HAVE_SYSLOG_H #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* defined OS_MINOR_VERSION == 6 */ #else #if OS_MAJOR_VERSION == 3 #if OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <= 6 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_STRCASECMP #define HAVE_STRNCASECMP #define HAVE_STRINGS_H #define HAVE_SYSLOG_H #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* define OS_MINOR_VERSION == 0 */ #else #error unknown platform #endif /* defined OS_MAJOR_VERSION == 3 */ #endif /* defined OS_MAJOR_VERSION == 2 */ #endif /* defined LINUX */ #if defined FREEBSD #if OS_MAJOR_VERSION == 8 #if OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <=2 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_SYSLOG_H #define HAVE_STRLCPY #define MUST_DEFINE_STRLCPY_PROTOTYPE #define HAVE_STRLCAT #define MUST_DEFINE_STRLCAT_PROTOTYPE #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* defined OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <=2 */ #else #if OS_MAJOR_VERSION == 7 #if OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <= 2 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_SYSLOG_H #define HAVE_STRLCPY #define MUST_DEFINE_STRLCPY_PROTOTYPE #define HAVE_STRLCAT #define MUST_DEFINE_STRLCAT_PROTOTYPE #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* defined OS_MINOR_VERSION >= 0 && OS_MINOR_VERSION <= 2 */ #else #if OS_MAJOR_VERSION == 6 #if OS_MINOR_VERSION == 2 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_SYSLOG_H #define HAVE_STRLCPY #define MUST_DEFINE_STRLCPY_PROTOTYPE #define HAVE_STRLCAT #define MUST_DEFINE_STRLCAT_PROTOTYPE #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* defined OS_MINOR_VERSION == 2 */ #else #error unknown platform #endif /* defined OS_MAJOR_VERSION == 6 */ #endif /* defined OS_MAJOR_VERSION == 7 */ #endif /* defined OS_MAJOR_VERSION == 8 */ #endif /* defined FREEBSD */ #if defined OPENBSD #if OS_MAJOR_VERSION == 4 #if OS_MINOR_VERSION >= 2 && OS_MINOR_VERSION <= 9 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_SYSLOG_H #define HAVE_STRLCPY #define MUST_DEFINE_STRLCPY_PROTOTYPE #define HAVE_STRLCAT #define MUST_DEFINE_STRLCAT_PROTOTYPE #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* OS_MINOR_VERSION >= 2 && OS_MINOR_VERSION <= 9 */ #else #if OS_MAJOR_VERSION == 5 #else #error unknown platform #endif /* OS_MAJOR_VERSION == 5 */ #if OS_MINOR_VERSION == 0 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_SYSLOG_H #define HAVE_STRLCPY #define MUST_DEFINE_STRLCPY_PROTOTYPE #define HAVE_STRLCAT #define MUST_DEFINE_STRLCAT_PROTOTYPE #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #endif /* OS_MINOR_VERSION == 0 */ #endif /* OS_MAJOR_VERSION == 4 */ #endif /* defined OPENBSD */ #if defined NETBSD #if OS_MAJOR_VERSION == 5 #if OS_MINOR_VERSION == 0 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_STRCASECMP #define HAVE_STRNCASECMP #define HAVE_STRINGS_H #define HAVE_SYSLOG_H #define GETTEXT_NEEDS_FORMAT_ARG #define HAVE_STRLCPY #define MUST_DEFINE_STRLCPY_PROTOTYPE #define HAVE_STRLCAT #define MUST_DEFINE_STRLCAT_PROTOTYPE #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* defined OS_MINOR_VERSION == 2 */ #else /* defined OS_MAJOR_VERSION == 4 */ #if OS_MAJOR_VERSION == 4 #if OS_MINOR_VERSION == 0 #define _XOPEN_SOURCE 600 #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_VSNPRINTF #define HAVE_SNPRINTF #define HAVE_VASPRINTF #define HAVE_ASPRINTF #define HAVE_STRDUP #define HAVE_STRERROR_R #define HAVE_STRCASECMP #define HAVE_STRNCASECMP #define HAVE_STRINGS_H #define HAVE_SYSLOG_H #define GETTEXT_NEEDS_FORMAT_ARG #define HAVE_STRLCPY #define MUST_DEFINE_STRLCPY_PROTOTYPE #define HAVE_STRLCAT #define MUST_DEFINE_STRLCAT_PROTOTYPE #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* defined OS_MINOR_VERSION == 2 */ #else #error unknown platform #endif /* defined OS_MAJOR_VERSION == 4 */ #endif /* defined OS_MAJOR_VERSION == 5 */ #endif /* defined NETBSD */ #if defined SUNOS #if OS_MAJOR_VERSION == 5 #if OS_MINOR_VERSION == 8 #if !defined __cplusplus #define _XOPEN_SOURCE 600 #define __EXTENSIONS__ #endif /* Solaris 8 has a snprintf, but it doesn't work for all C99 features, * e.g. %zd for size_t */ #define HAVE_STRDUP #define HAVE_ENUM_BOOL #define HAVE_STRCASECMP #define HAVE_STRNCASECMP #define HAVE_STRINGS_H #define HAVE_SYSLOG_H #define GETTEXT_NEEDS_FORMAT_ARG #define HAVE_STRLCPY #define HAVE_STRLCAT #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #if OS_MINOR_VERSION == 10 #if !defined __cplusplus #define _XOPEN_SOURCE 600 #define __EXTENSIONS__ #endif #define HAVE_SNPRINTF #define HAVE_VSNPRINTF #define HAVE_STRDUP #define HAVE_STDBOOL_H #define HAVE_STDINT_H #define HAVE_STRERROR_R #define HAVE_STRCASECMP #define HAVE_STRNCASECMP #define HAVE_STRINGS_H #define HAVE_SYSLOG_H #define HAVE_STRLCPY #define HAVE_STRLCAT #define HAVE_GETADDRINFO #define HAVE_IPV6 #define HAVE_PTHREADS #else #error unknown platform #endif /* OS_MINOR_VERSION == 10 */ #endif /* OS_MINOR_VERSION == 8 */ #else #error unknown platform #endif /* OS_MAJOR_VERSION == 5 */ #endif /* defined SUNOS */ #if defined CYGWIN #if OS_MAJOR_VERSION == 5 #if OS_MINOR_VERSION == 0 #define _XOPEN_SOURCE 600 #define HAVE_ENUM_BOOL #define HAVE_SYSLOG_H #define HAVE_PTHREADS #else #error unknown platform #endif /* OS_MINOR_VERSION == 0 */ #else #error unknown platform #endif /* OS_MAJOR_VERSION == 5 */ #endif /* defined CYGWIN */ #if defined _WIN32 #define HAVE_ITOA #define HAVE_EVENTLOG #define HAVE_GETADDRINFO #endif /* defined _WIN32 */ /* special hacks for Microsoft Windows compilers */ #if defined _MSC_VER #endif /* defined _MSC_VER */ /* define INLINE (C99 inlining attribute is not yet known by all compilers */ #if defined _MSC_VER #define INLINE __inline #else #define INLINE inline #endif /* special hacks for GCC compilers */ /* define one version string for comparing GNU c versions */ #if defined __GNUC__ #if defined __GNUC_PATCHLEVEL__ #define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ ) #else #define GCC_VERSION ( __GNUC__ * 10000 + __GNUC_MINOR__ * 100 ) #endif #endif /* special hacks for Intel compiler */ #if defined __INTEL_COMPILER #if( __INTEL_COMPILER >= 1100 ) /* remark #981: operands are evaluated in unspecified orde, just annoying, code * gets completly funny, if we try to avoid this remark! */ #pragma warning(disable:981) #endif /* __INTEL_COMPILER >= 1100 */ #endif /* defined __INTEL_COMPILER */ /** @} */ /* @addtogroup wolf_port */ /* special hacks for the Portable C compiler */ #if defined __PCC__ /* __PRETTY_FUNCTION__ is a GNU extension, no harm if we define it to _func_ * which must be there (poluted pthreads.h header file!) */ #define __PRETTY_FUNCTION__ __func__ #define _VA_LIST_DEFINED #define __const const #define __USER_LABEL_PREFIX__ /* all GNUish macros should be ignored */ #define __attribute__(X) #endif /* defined __PCC__ **/ #endif /* ifndef WOLF_SYS_H */