#!/usr/bin/env racket

#lang racket/base
(require racket/port)
(require racket/system)

(define (dst entry)
  (display entry)
  (display " -> ")
  (displayln (system-type entry)))

(define (only-for-cs entry)
  (cond [(equal? (system-type 'vm) 'chez-scheme)
     (dst entry)]))

(define (only-for-bc entry)
  (cond [(not (equal? (system-type 'vm) 'chez-scheme))
     (dst entry)]))

(define (jit-enabled)
  (cond [(not (equal? (system-type 'vm) 'chez-scheme))
     (display "bc jit -> ")
     (cond [(eval-jit-enabled) (displayln "enabled")]
           [(displayln "disabled")])]))

(displayln "")

(dst 'os)
(dst 'os*)
(dst 'arch)
(dst 'word)

(displayln "")

(displayln (string-append "version -> " (version)))
(dst 'vm)
(jit-enabled)
(only-for-bc 'gc)
(only-for-cs 'target-machine)

(displayln "")

(display (string-append "limit stack size: "
  (with-output-to-string (lambda () (system "ulimit -s")))))
(display (string-append "limit data size: "
  (with-output-to-string (lambda () (system "ulimit -d")))))
(display (string-append "limit file descriptors: "
  (with-output-to-string (lambda () (system "ulimit -n")))))

(displayln "")

(dst 'link)
(dst 'so-suffix)
(dst 'so-mode)
(dst 'fs-change)
(dst 'cross)
(dst 'machine)

(displayln "")
