Mercurial > repo
diff src/ploki/config.h @ 4223:ac0403686959
<oerjan> rm -rf src/ploki; mv ploki src
author | HackBot |
---|---|
date | Fri, 20 Dec 2013 22:18:50 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ploki/config.h Fri Dec 20 22:18:50 2013 +0000 @@ -0,0 +1,114 @@ +#ifndef CONFIG_H_ +#define CONFIG_H_ + +#ifdef DEBUGGING + #define DEBUG(x) x + #define DEBUG_P 1 +#else + #define DEBUG(x) + #define DEBUG_P 0 + #define NDEBUG 1 +#endif + +#if defined _WIN32 || defined __WIN32__ || defined WIN32 + #define DIR_END "\\/" +#elif defined __unix__ || defined __linux__ || defined __unix || defined unix + #define DIR_END "/" +#else + /* XXX */ + #define DIR_END 0 +#endif + +#if defined __POSIX__ || defined __unix__ || defined __linux__ || defined __unix || defined unix + #define HAVE_SLEEP_P 1 + #define SLEEP_HEADER <unistd.h> + #define DO_SLEEP pause() +#elif defined _WIN32 || defined __WIN32__ || defined WIN32 + #define HAVE_SLEEP_P 1 + #define SLEEP_HEADER <windows.h> + #define DO_SLEEP Sleep(INFINITE) +#else + #define HAVE_SLEEP_P 0 + #define DO_SLEEP ((void)0) +#endif + +#if defined __linux__ || defined __sun__ || defined __sun + #define HAVE_DEV_URANDOM_P 1 +#else + #define HAVE_DEV_URANDOM_P 0 +#endif + +#ifndef INC_PREFIX + #if defined __unix__ || defined __linux__ || defined __unix || defined unix + #define INC_PREFIX "/usr/local/lib/ploki/" + #else + #define INC_PREFIX 0 + #endif +#endif + +#define INC_PREFIX_LIST \ +{ \ + "", \ + INC_PREFIX, \ + 0 \ +} + +#if defined __STDC_VERSION__ && __STDC_VERSION__ + 0 >= 199901L + #define HAVE_C99_P 1 + #define HAVE_C99(x) x +#else + #define HAVE_C99_P 0 + #define HAVE_C99(x) +#endif + +#ifdef __GNUC__ + #define HAVE_GCC_P 1 + #define HAVE_GCC(x) x +#else + #define HAVE_GCC_P 0 + #define HAVE_GCC(x) +#endif + +#if HAVE_GCC_P + #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ > 2 + #define ATTR(x) __attribute__(x) + #else + #define ATTR(x) + #endif + + #if __GNUC__ == 2 && __GNUC_MINOR__ >= 96 || __GNUC__ > 2 + #define ATTR_MALLOC __attribute__((__malloc__)) + #define ATTR_PURE __attribute__((__pure__)) + #else + #define ATTR_MALLOC + #define ATTR_PURE + #endif +#else + #define ATTR(x) + #define ATTR_MALLOC + #define ATTR_PURE +#endif + +#define ATTR_UNUSED ATTR((__unused__)) +#define ATTR_NORETURN ATTR((__noreturn__)) +#define ATTR_SPRINTF ATTR((__format__(__printf__, 2, 3))) +#define ATTR_CONST ATTR((__const__)) + +#if HAVE_C99_P + #define HAVE_VSNPRINTF(x) x + #define HAVE_VSNPRINTF_P 1 +#elif defined __GLIBC__ + #include <features.h> + #if defined __USE_BSD || defined __USE_ISOC99 || defined __USE_UNIX98 + #define HAVE_VSNPRINTF(x) x + #define HAVE_VSNPRINTF_P 1 + #else + #define HAVE_VSNPRINTF(x) + #define HAVE_VSNPRINTF_P 0 + #endif +#else + #define HAVE_VSNPRINTF(x) + #define HAVE_VSNPRINTF_P 0 +#endif + +#endif /* CONFIG_H_ */