Merge pull request #554 from apg/apg/bsd-feature-expansion

Add features for the various BSDs.
This commit is contained in:
Alex Shinn 2019-08-03 11:45:43 +08:00 committed by GitHub
commit a01de232b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 0 deletions

View file

@ -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

15
sexp.c
View file

@ -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