summary refs log tree commit diff stats
path: root/lib/std/sysrand.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std/sysrand.nim')
-rw-r--r--lib/std/sysrand.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/std/sysrand.nim b/lib/std/sysrand.nim
index d57f2845e..7943f2e1b 100644
--- a/lib/std/sysrand.nim
+++ b/lib/std/sysrand.nim
@@ -168,8 +168,10 @@ elif defined(windows):
     result = randomBytes(addr dest[0], size)
 
 elif defined(linux) and not defined(nimNoGetRandom) and not defined(emscripten):
-  # TODO using let, pending bootstrap >= 1.4.0
-  var SYS_getrandom {.importc: "SYS_getrandom", header: "<sys/syscall.h>".}: clong
+  when (NimMajor, NimMinor) >= (1, 4):
+    let SYS_getrandom {.importc: "SYS_getrandom", header: "<sys/syscall.h>".}: clong
+  else:
+    var SYS_getrandom {.importc: "SYS_getrandom", header: "<sys/syscall.h>".}: clong
   const syscallHeader = """#include <unistd.h>
 #include <sys/syscall.h>"""