Changeset 14401 in project for release/4/glpk/trunk/glpk.setup


Ignore:
Timestamp:
04/24/09 01:38:46 (11 years ago)
Author:
Ivan Raikov
Message:

glpk ported to Chicken 4

Location:
release/4/glpk
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/4/glpk/trunk/glpk.setup

    r10875 r14401  
    1 
    2 (define has-exports? (string>=? (chicken-version) "2.310"))
     1;; -*- Hen -*-
    32
    43(define (dynld-name fn)         
     
    87  (and (try-compile
    98        (string-append header "\n"
    10                         "int main(int argc, char **argv) { glp_create_prob(); return 0; }\n")
     9                       "int main(int argc, char **argv) { glp_create_prob(); return 0; }\n")
    1110        ldflags: ldflags
    12         cflags: cppflags
    13         )
     11        cflags: cppflags)
    1412       (cons ldflags cppflags)))
    1513
    16 (define-macro (glpk-test . rest)
    17   `(or (any identity (map (lambda (p) (glpk-try-compile (first p) (second p) (third p))) ',rest))
    18        (error "unable to figure out location of GLPK library")))
     14(define-syntax glpk-test
     15  (syntax-rules ()
     16    ((_ (flags ...))
     17     (condition-case (glpk-try-compile flags ...)
     18                     (t ()    #f)))))
    1919
    2020(define ld+cpp-options
    21   (glpk-test ("#include <glpk.h>" "-lglpk" "-I.")
    22              ("#include <glpk.h>" "-lglpk" "-I. -I/usr/include/glpk")
    23              ("#include <glpk.h>" "-lglpk" "-I. -I/opt/local/include")))
     21  (or (glpk-test ("#include <glpk.h>" "-lglpk" "-I."))
     22      (glpk-test ("#include <glpk.h>" "-lglpk" "-I. -I/usr/include/glpk"))
     23      (glpk-test ("#include <glpk.h>" "-lglpk" "-I. -I/opt/local/include"))
     24      (error "unable to figure out location of GLPK library")))
    2425
    25 (compile -O -d2 -s -o ,(dynld-name "glpk")
    26          ,@(if has-exports? '(-check-imports -emit-exports glpk.exports) '())
    27          glpk.scm  -lchicken -ldl  -L "\"" ,(car ld+cpp-options) "\""
     26(compile -O2 -d0 -I. -s glpk.scm  -j glpk
     27         -L "\"" ,(car ld+cpp-options) "\""
    2828         -C "\"" ,(cdr ld+cpp-options) "\"")
     29(compile -O2 -d0 -s glpk.import.scm)
    2930
    30 (run (csi -qbs glpk-eggdoc.scm > glpk.html))
     31(run (csi -s glpk-eggdoc.scm > glpk.html))
    3132
    3233(install-extension
     
    3637
    3738  ; Files to install for your extension:
    38   `(,(dynld-name "glpk") )
     39  `(,(dynld-name "glpk") ,(dynld-name "glpk.import") )
    3940
    4041  ; Assoc list with properties for your extension:
    41   `((version 1.1)
    42     (documentation "glpk.html")
    43     ,@(if has-exports? `((exports "glpk.exports")) (list)) ))
     42  `((version 1.2)
     43    (documentation "glpk.html")))
Note: See TracChangeset for help on using the changeset viewer.