source: project/release/3/readline/readline.setup @ 9164

Last change on this file since 9164 was 9164, checked in by elf, 12 years ago

new version. fixed multiple sessions clobbering each others histories.

File size: 1.8 KB
Line 
1;;;; readline.setup -*- Scheme -*-
2
3(define test #<<EOF
4#include <stdio.h>
5#include <readline/readline.h>
6#include <readline/history.h>
7int main() { char *c = readline("foo"); return 0; }
8EOF
9)
10
11(define test-gnu #<<EOF
12#include <stdio.h>
13#include <readline/readline.h>
14#include <readline/history.h>
15int main() { return history_truncate_file("foo", 0); }
16EOF
17)
18
19;; Grab compiler and linker flags passed by csc.
20(define (csc-flags opt)
21  (string-append "`" (make-pathname (program-path) "csc") " " opt "`"))
22(define *csc-cflags* (csc-flags "-cflags"))
23(define *csc-ldflags* (csc-flags "-ldflags"))
24
25;; Try compiling with added csc cflags and ldflags; primarily so
26;; we pick up -I and -L and find the correct libraries.
27(define (try-compile/flags code #!key (cflags "") (ldflags ""))
28  (try-compile code
29               cflags: (conc *csc-cflags* " " cflags)
30               ldflags: (conc *csc-ldflags* " " ldflags)))
31
32(define librl
33  (cond [(try-compile/flags test ldflags: "-lreadline -ltermcap") '-ltermcap]
34        [(try-compile/flags test ldflags: "-lreadline -lcurses") '-lcurses]
35        [else '-lncurses] ) )
36
37(unless (try-compile/flags test-gnu ldflags: (conc "-lreadline " librl))
38  (error #<<EOF
39This extension requires GNU readline; we found a non-GNU readline
40such as libedit.  Please install GNU readline.  For more information,
41consult http://chicken.wiki.br/readline#Installation%20problems.
42EOF
43))
44
45(compile -s -O2 -d0 readline.scm -L -lreadline -emit-exports readline.exports -L
46         ,librl)
47(compile -c -O2 -d0 readline.scm -o readline-static.o -unit readline)
48
49(install-extension
50  'readline
51 '("readline.so" "readline.html" "readline-static.o")
52 `((version 1.93)
53   (static "readline-static.o")
54   (static-options ,(conc "-lreadline " librl))
55   (exports "readline.exports")
56   (documentation "readline.html")))
Note: See TracBrowser for help on using the repository browser.