Define / detect explicit features for BSD platforms

This commit is contained in:
Andrew Gwozdziewycz 2019-08-02 11:33:07 -07:00
parent ac467ea314
commit e5ae89c9c6
2 changed files with 44 additions and 4 deletions

View file

@ -303,6 +303,43 @@
#endif #endif
#endif #endif
/* Detect specific BSD */
#if SEXP_BSD
#if defined(__APPLE__)
#define SEXP_DARWIN 1
#define SEXP_FREEBSD 0
#define SEXP_NETBSD 0
#define SEXP_DRAGONFLY 0
#define SEXP_OPENBSD 0
#elif defined(__FreeBSD__)
#define SEXP_DARWIN 0
#define SEXP_FREEBSD 1
#define SEXP_NETBSD 0
#define SEXP_DRAGONFLY 0
#define SEXP_OPENBSD 0
#elif defined(__NetBSD__)
#define SEXP_DARWIN 0
#define SEXP_FREEBSD 0
#define SEXP_NETBSD 1
#define SEXP_DRAGONFLY 0
#define SEXP_OPENBSD 0
#define SEXP_NETBSD 0
#elif defined(__DragonFly__)
#define SEXP_DARWIN 1
#define SEXP_FREEBSD 0
#define SEXP_NETBSD 0
#define SEXP_DRAGONFLY 1
#define SEXP_OPENBSD 0
#define SEXP_DRAGONFLY 0
#elif defined(__OpenBSD__)
#define SEXP_DARWIN 0
#define SEXP_FREEBSD 0
#define SEXP_NETBSD 0
#define SEXP_DRAGONFLY 0
#define SEXP_OPENBSD 1
#endif
#endif
/* for bignum support, need a double long to store long*long */ /* for bignum support, need a double long to store long*long */
/* gcc supports uint128_t, otherwise we need a custom struct */ /* gcc supports uint128_t, otherwise we need a custom struct */
#ifndef SEXP_USE_CUSTOM_LONG_LONGS #ifndef SEXP_USE_CUSTOM_LONG_LONGS

11
sexp.c
View file

@ -464,16 +464,19 @@ static const char* sexp_initial_features[] = {
#if SEXP_BSD #if SEXP_BSD
"bsd", "bsd",
#endif #endif
#if defined(__OpenBSD__) #if SEXP_DARWIN
"darwin",
#endif
#if SEXP_OPENBSD
"openbsd", "openbsd",
#endif #endif
#if defined(__FreeBSD__) #if SEXP_FREEBSD
"freebsd", "freebsd",
#endif #endif
#if defined(__NetBSD__) #if SEXP_NETBSD
"netbsd", "netbsd",
#endif #endif
#if defined(__DragonFly__) #if SEXP_DRAGONFLY
"dragonfly", "dragonfly",
#endif #endif
#if defined(_WIN32) #if defined(_WIN32)