From 3c133bd677200442628d441422c73e65e290f3d8 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 27 Jul 2019 11:29:40 -0500 Subject: [PATCH] Add more values for (os/which) Some bsd flavors. --- auxlib/cook.janet | 5 +++-- src/core/os.c | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/auxlib/cook.janet b/auxlib/cook.janet index 484d235b..042fbad6 100644 --- a/auxlib/cook.janet +++ b/auxlib/cook.janet @@ -296,11 +296,12 @@ (def lflags [;(opt opts :lflags default-lflags) ;(if (opts :static) [] dynamic-lflags) ;(if standalone (case (os/which) - :posix ["-ldl" "-lm"] :macos ["-ldl" "-lm"] :windows [] :linux ["-lm" "-ldl" "-lrt"] - []) [])]) + :openbsd ["-lm"] + #default + ["-ldl" "-lm"]) [])]) (rule target objects (print "linking " target "...") (if is-win diff --git a/src/core/os.c b/src/core/os.c index bd718ae0..0d529c1a 100644 --- a/src/core/os.c +++ b/src/core/os.c @@ -75,6 +75,12 @@ static Janet os_which(int32_t argc, Janet *argv) { return janet_ckeywordv("web"); #elif defined(__linux__) return janet_ckeywordv("linux"); +#elif define(__FreeBSD__) + return janet_ckeywordv("freebsd"); +#elif define(__NetBSD__) + return janet_ckeywordv("netbsd"); +#elif define(__OpenBSD__) + return janet_ckeywordv("openbsd"); #else return janet_ckeywordv("posix"); #endif @@ -763,10 +769,13 @@ static const JanetReg os_cfuns[] = { "os/which", os_which, JDOC("(os/which)\n\n" "Check the current operating system. Returns one of:\n\n" - "\t:windows - Microsoft Windows\n" - "\t:macos - Apple macos\n" + "\t:windows\n" + "\t:macos\n" "\t:web - Web assembly (emscripten)\n" - "\t:linux - Linux\n" + "\t:linux\n" + "\t:freebsd\n" + "\t:openbsd\n" + "\t:netbsd\n" "\t:posix - A POSIX compatible system (default)") }, {