source: project/release/4/mpi/trunk/mpi.setup @ 27308

Last change on this file since 27308 was 27308, checked in by Ivan Raikov, 9 years ago

mpi: added support for env variable MPI_DIR in build script and version set to 1.13

File size: 1.5 KB
Line 
1;; -*- Hen -*-
2
3(define (dynld-name fn)         
4  (make-pathname #f fn ##sys#load-dynamic-extension))   
5
6(define (mpi-try-compile header ldflags cppflags)
7  (and (try-compile
8        (string-append header "\n"
9                        "int main(int argc, char **argv) { MPI_Init(&argc, &argv); return 0; }\n")
10        ldflags: ldflags
11        cflags: cppflags
12        )
13       (cons ldflags cppflags)))
14
15(define-syntax mpi-test
16  (syntax-rules ()
17    ((_ (flags ...))
18     (condition-case (mpi-try-compile flags ...)
19                     (t ()    #f)))))
20
21(define mpi-dir (get-environment-variable "MPI_DIR"))
22
23(define ld+cpp-options
24  (or
25   (and mpi-dir (mpi-test ("#include <mpi.h>"
26                           (sprintf "-lmpi -L~S" (make-pathname mpi-dir "lib") )
27                           (sprintf "-I~S -L~S"
28                                    (make-pathname mpi-dir "include")
29                                    (make-pathname mpi-dir "lib") ))
30                          ))
31   (mpi-test ("#include <mpi.h>" "-lmpi" ""))
32   (mpi-test ("#include <mpi.h>" "-lmpi" "-I/usr/include/mpi"))
33   (mpi-test ("#include <mpi.h>" "-lmpi" "-I/usr/lib/openmpi/include"))
34   (error "unable to figure out location of MPI library; try setting environment variable MPI_DIR to the proper location")))
35
36(compile -O2 -d0 -I. -s mpi.scm  -j mpi
37         -L "\"" ,(car ld+cpp-options) "\""
38         -C "\"" ,(cdr ld+cpp-options) "\"")
39(compile -O2 -d0 -s mpi.import.scm)
40
41(install-extension
42
43  ; Name of your extension:
44  'mpi
45
46  ; Files to install for your extension:
47  `(,(dynld-name "mpi") ,(dynld-name "mpi.import") )
48   
49  ; Assoc list with properties for your extension:
50  `((version 1.13)
51    ))
52
Note: See TracBrowser for help on using the repository browser.