(import (chicken base) (chicken format) (chicken process) (chicken process-context) srfi-13 compile-file) (define args (command-line-arguments)) (define (gsl-try-compile header ldflags) (and (try-compile (string-append "#include " header "\n" "int main() { cblas_ddot(0, NULL, 0, NULL, 0); return 0; }\n") ldflags: ldflags verbose: #t) ldflags )) (define-syntax gsl-test (syntax-rules () ((_ (flags ...)) (condition-case (gsl-try-compile flags ...) (t () #f))))) (define ld-options (or (gsl-test ("" "-lgsl -lgslcblas -lm")) (error "unable to figure out location of GSL library"))) (define cmd (intersperse (append args (list (sprintf "-L \"~A\"" ld-options))) " ")) (system (string-concatenate cmd))