source: project/release/4/readline/trunk/readline.setup @ 32660

Last change on this file since 32660 was 32660, checked in by Alexej Magura, 4 years ago

updates for chicken 4.10

File size: 3.1 KB
Line 
1;;;; readline.setup -*- Scheme -*-
2;;;; vim:ft=scheme:
3
4(use files)
5
6(define old-files
7  (append
8    (filter (lambda (y) (or (string-suffix? ".o" y)
9                            (string-suffix? ".out" y)))
10            (find-files "./"))
11    '("readline-test" "readline.c")))
12
13;; cleans up from previous builds
14(do ((lst old-files (cdr lst)))
15  ((null? lst))
16  (display (string-append "rm -f " (car lst)))
17  (newline)
18  (delete-file* (car lst)))
19
20(define-syntax compile/error
21  ;; Required for Chicken < 4.6, which calls (reset) on (compile) error.
22  (syntax-rules ()
23    ((compile/error args ...)
24     (let ((old-reset (reset-handler)))
25       (parameterize ((reset-handler
26                       (lambda ()
27                         (parameterize ((reset-handler old-reset))
28                           (error 'compile "compilation error")))))
29         (compile args ...))))))
30
31(define rl-extra-cflags
32  (string-append
33   "-C -D_GNU_SOURCE=1"
34   " -C -std=gnu99"
35   ))
36
37(define-syntax check-rllibs
38  (syntax-rules ()
39    ((_ libs)
40     (and (print "trying: " libs)
41          (handle-exceptions e #f
42            (compile/error readline-test.scm ,rl-extra-cflags ,libs))
43          libs))))
44
45;(define curry (lambda (f . c) (lambda x (apply f (append c x)))))
46#|
47(define rl-extralib
48  (list-ref (list-index (lambda (y) (equal? #t y))
49              (list (check-rllibs " -lreadline")
50                    (check-rllibs " -lreadinline -lhistory")
51                    (check-rllibs " -lreadline -lncurses")
52                    (check-rllibs " -lreadline -lcurses")
53                    (check-rllibs " -lreadline -ltermcap")
54                    (check-rllibs " -lreadline -lhistory -lncurses")
55                    (check-rllibs " -lreadline -lhistory -lcurses")
56                    (check-rllibs " -lreadline -lhistory -ltermcap")
57                    (check-rllibs " -lreadline -lhistory -lncurses")
58                    (check-rllibs " -lreadline -lhistory -lcurses")
59                    (check-rllibs " -lreadline -lhistory -ltermcap"))))|#
60(define rl-extralib
61  (or
62    (check-rllibs "-lreadline -lhistory -ltermcap")
63    (check-rllibs "-lreadline -lhistory -lcurses")
64    (check-rllibs "-lreadline -lhistory -lncurses")
65    (check-rllibs "-lreadline -ltermcap")
66    (check-rllibs "-lreadline -lcurses")
67    (check-rllibs "-lreadline -lhistory")
68    (check-rllibs "-lreadline -lncurses")
69    (check-rllibs "-lreadline")
70    (error
71      (string-append
72        "This extension requires GNU readline.  GNU readline "
73        "may be found at ftp://ftp.gnu.org/pub/gnu/readline\n"
74        "For more information, please consult "
75        "http://wiki.call-cc.org/egg/readline#installation-problems\n"))))
76
77(compile -s -O2 readline.scm ,rl-extra-cflags ,rl-extralib)
78
79(compile -c -O2 -d0 -j readline readline.scm
80         -o readline-static.o -unit readline ,rl-extra-cflags ,rl-extralib)
81
82(compile -s -O2 -d0 readline.import.scm)
83
84(install-extension
85    'readline
86    '("readline.so" "readline.import.so" "readline-static.o")
87    `((version           "4.1.0")
88      (static            "readline-static.o")
89      (static-options    ,rl-extralib)))
Note: See TracBrowser for help on using the repository browser.