diff --git a/include/chibi/features.h b/include/chibi/features.h index ccf27b04..09926179 100644 --- a/include/chibi/features.h +++ b/include/chibi/features.h @@ -303,6 +303,43 @@ #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 */ /* gcc supports uint128_t, otherwise we need a custom struct */ #ifndef SEXP_USE_CUSTOM_LONG_LONGS diff --git a/sexp.c b/sexp.c index cc9c6fc2..8ceef0e1 100644 --- a/sexp.c +++ b/sexp.c @@ -464,6 +464,21 @@ static const char* sexp_initial_features[] = { #if SEXP_BSD "bsd", #endif +#if SEXP_DARWIN + "darwin", +#endif +#if SEXP_OPENBSD + "openbsd", +#endif +#if SEXP_FREEBSD + "freebsd", +#endif +#if SEXP_NETBSD + "netbsd", +#endif +#if SEXP_DRAGONFLY + "dragonfly", +#endif #if defined(_WIN32) "windows", #endif