;; -*- Hen -*- (define (dynld-name fn) (make-pathname #f fn ##sys#load-dynamic-extension)) (define (sundials-try-compile header ldflags cppflags) (and (try-compile (string-append "#include \n" "#include \n" header "\n" "int main(int argc, char **argv) { CVodeFree(NULL); IDAFree(NULL); return 0; }\n") ldflags: ldflags cflags: cppflags) (cons ldflags cppflags))) (define-syntax sundials-test (syntax-rules () ((_ (flags ...)) (condition-case (sundials-try-compile flags ...) (t () #f))))) (define ida-headers #< #include #include #include #include EOF ) (define ld+cpp-options (or (sundials-test (ida-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial" "")) (sundials-test (ida-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial" "-I/usr/include/ida -I/usr/include/cvode")) (sundials-test (ida-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial" "-I/usr/include/sundials")) (sundials-test (ida-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial" "-I/opt/local/include")) (error "unable to figure out location of SUNDIALS"))) (compile -O3 -d0 -S -s sundials.scm -j sundials -I. -L "\"" ,(car ld+cpp-options) "\"" -C "\"" ,(cdr ld+cpp-options) "\"") (compile -O3 -d0 -s sundials.import.scm) (install-extension ; Name of your extension: 'sundials ; Files to install for your extension: `(,(dynld-name "sundials") ,(dynld-name "sundials.import") ) ; Assoc list with properties for your extension: `((version 1.0) ))