source: project/release/3/mpi/trunk/mpi.setup @ 10914

Last change on this file since 10914 was 10914, checked in by Ivan Raikov, 12 years ago

Version increased to 1.5

File size: 1.3 KB
Line 
1
2(define has-exports? (string>=? (chicken-version) "2.310"))
3
4(define (dynld-name fn)         
5  (make-pathname #f fn ##sys#load-dynamic-extension))   
6
7(define (mpi-try-compile header ldflags cppflags)
8  (and (try-compile
9        (string-append header "\n"
10                        "int main(int argc, char **argv) { MPI_Init(&argc, &argv); return 0; }\n")
11        ldflags: ldflags
12        cflags: cppflags
13        )
14       (cons ldflags cppflags)))
15
16(define-macro (mpi-test . rest)
17  `(or (any identity (map (lambda (p) (mpi-try-compile (first p) (second p) (third p))) ',rest))
18       (error "unable to figure out location of MPI library")))
19
20(define ld+cpp-options
21  (mpi-test ("#include <mpi.h>" "-lmpi" "")
22            ("#include <mpi.h>" "-lmpi" "-I/usr/include/mpi")
23            ("#include <mpi.h>" "-lmpi" "-I/usr/lib/openmpi/include")))
24
25(compile -O -d2 -s -o ,(dynld-name "mpi")
26         ,@(if has-exports? '(-check-imports -emit-exports mpi.exports) '())
27         mpi.scm  -lchicken -ldl  -L "\"" ,(car ld+cpp-options) "\""
28         -C "\"" ,(cdr ld+cpp-options) "\"")
29
30(run (csi -qbs mpi-eggdoc.scm > mpi.html))
31
32(install-extension
33
34  ; Name of your extension:
35  'mpi
36
37  ; Files to install for your extension:
38  `(,(dynld-name "mpi") "mpi.html"
39    ,@(if has-exports? '("mpi.exports") (list)) )
40
41  ; Assoc list with properties for your extension:
42  `((version 1.5)
43    (documentation "mpi.html")
44    ,@(if has-exports? `((exports "mpi.exports")) (list)) ))
Note: See TracBrowser for help on using the repository browser.