source: project/release/4/sundials/trunk/sundials.setup @ 25509

Last change on this file since 25509 was 25246, checked in by Ivan Raikov, 10 years ago

sundials version set to 1.3

File size: 2.3 KB
Line 
1;; -*- Hen -*-
2
3(define (dynld-name fn)         
4  (make-pathname #f fn ##sys#load-dynamic-extension))   
5
6(define (sundials-try-compile header ldflags cppflags)
7  (and (try-compile
8        (string-append "#include <stdlib.h>\n"
9                       "#include <stdio.h>\n"
10                       "#include <math.h>\n"
11                       header "\n"
12                       "int main(int argc, char **argv) { void *x; x = NULL; CVodeFree(&x); IDAFree(&x); printf (\"%s\\n\",SUNDIALS_PACKAGE_VERSION); return 0; }\n")
13        ldflags: ldflags
14        cflags: (string-append cppflags " -o testsundials "))
15       (cons ldflags cppflags)
16       ))
17
18(define-syntax sundials-test
19  (syntax-rules ()
20    ((_ (flags ...))
21     (condition-case (sundials-try-compile flags ...)
22                     (t ()    #f)))))
23
24(define sundials-headers
25#<<EOF
26#include <sundials/sundials_config.h>
27#include <ida/ida.h>
28#include <ida/ida_dense.h>
29#include <cvode/cvode.h>           
30#include <cvode/cvode_band.h>     
31#include <nvector/nvector_serial.h>
32EOF
33)
34
35(define ld+cpp-options
36  (or (sundials-test (sundials-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial"
37                                  ""))
38      (sundials-test (sundials-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial"
39                                  "-I/usr/include/ida -I/usr/include/cvode"))
40      (sundials-test (sundials-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial"
41                                  "-I/usr/include/sundials"))
42      (sundials-test (sundials-headers "-lblas -llapack -lsundials_ida -lsundials_cvode -lsundials_nvecserial"
43                                  "-I/opt/local/include"))
44      (error "unable to figure out location of SUNDIALS")))
45
46(define sundials-version
47  (string-split
48   (call-with-input-pipe "./testsundials"
49     (lambda (port) (->string (read port)))) "."))
50
51
52(compile -O3 -d0 -S -s sundials.scm  -j sundials  -I.
53         -L "\"" ,(car ld+cpp-options) "\""
54         -C "\"" ,(cdr ld+cpp-options)
55         -D ,(string-append "SUNDIALS_VERSION_MAJOR=" (car sundials-version))
56         -D ,(string-append "SUNDIALS_VERSION_MINOR=" (cadr sundials-version))
57         "\"")
58(compile -O3 -d0 -s sundials.import.scm)
59
60
61(install-extension
62
63  ; Name of your extension:
64  'sundials
65
66  ; Files to install for your extension:
67  `(,(dynld-name "sundials") ,(dynld-name "sundials.import") )
68
69  ; Assoc list with properties for your extension:
70  `((version 1.3)
71    ))
72
Note: See TracBrowser for help on using the repository browser.