Line | |
---|
1 | |
---|
2 | (import (chicken base) (chicken format) (chicken process-context) srfi-13 compile-file) |
---|
3 | (define args (command-line-arguments)) |
---|
4 | |
---|
5 | (define (blas-try-compile header ldflags) |
---|
6 | (and (try-compile |
---|
7 | (string-append "#include " header "\n" |
---|
8 | "int main() { cblas_ddot(0, NULL, 0, NULL, 0); return 0; }\n") |
---|
9 | ldflags: ldflags |
---|
10 | verbose: #t) |
---|
11 | ldflags )) |
---|
12 | |
---|
13 | (define-syntax blas-test |
---|
14 | (syntax-rules () |
---|
15 | ((_ (flags ...)) |
---|
16 | (condition-case (blas-try-compile flags ...) |
---|
17 | (t () #f))))) |
---|
18 | |
---|
19 | (define ld-options |
---|
20 | (or (blas-test ("<cblas.h>" "-lblas -lm")) |
---|
21 | (blas-test ("<cblas.h>" "-lcblas -lm")) |
---|
22 | (blas-test ("<gsl/gsl_cblas.h>" "-lgsl -lgslcblas -lm")) |
---|
23 | (blas-test ("<atlas/cblas.h>" "-lcblas -lm")) |
---|
24 | (blas-test ("<lapack/cblas.h>" "-lcblas -lm")) |
---|
25 | (blas-test ("<Accelerate/Accelerate.h>" "-framework Accelerate")) |
---|
26 | (error "unable to figure out location of BLAS library"))) |
---|
27 | |
---|
28 | (define cmd (intersperse (append args (list (sprintf "-L \"~A\"" ld-options))) " ")) |
---|
29 | (system (string-concatenate cmd)) |
---|
Note: See
TracBrowser
for help on using the repository browser.