added code from scsh-yp that looks for the libraray-name in libscx.la

This commit is contained in:
frese 2004-01-29 14:39:51 +00:00
parent 2298e207a0
commit 435103a68a
1 changed files with 66 additions and 8 deletions

View File

@ -3,14 +3,72 @@
(open 'dynamic-externals)
(open 'external-calls)
(open 'configure)
(run '(let ((initializer-name "scx_init_xlib")
(module-file (string-append "@scxlibdir@/" @scxhost@ "/libscx.so")))
(dynamic-load module-file)
(call-external (get-external initializer-name))
(if (string=? "@scxload_xft_packages@" "yes")
(begin
(call-external (get-external "scx_xft_init"))
(call-external (get-external "scx_xrender_init"))))))
(open 'signals)
(run
'(define (normalize-la-entry key val)
(let ((left-quotes-rx (rx (: bos #\')))
(right-quotes-rx (rx (: #\' eos)))
(kill-matches
(lambda (rx str)
(regexp-substitute/global #f rx str 'pre 'post))))
(cons (string->symbol key)
(kill-matches left-quotes-rx
(kill-matches right-quotes-rx val))))))
(run
'(define add-la-entry
(let ((splitter (infix-splitter (rx #\=)))
(comment-rx (rx (: bos #\#))))
(lambda (line alist)
(cond
((and (not (regexp-search? comment-rx line))
(string-index line #\=))
(let ((lst (splitter line)))
(if (= 2 (length lst))
(cons (apply normalize-la-entry lst) alist)
(error "Could not read la entry" line list))))
(else alist))))))
(run
'(define (read-libtool-la file-name)
(call-with-input-file
file-name
(lambda (port)
(let lp ((line (read-line port)) (alist '()))
(if (eof-object? line)
alist
(lp (read-line port) (add-la-entry line alist))))))))
(run '(let* ((lib-dir (string-append "@yplibdir@/" @yphost@))
(la-file-name (string-append lib-dir "/libscshyp.la"))
(initializer-name "scsh_yp_main"))
(let ((la-alist (read-libtool-la la-file-name)))
(cond
((assoc 'dlname la-alist)
=> (lambda (p)
(dynamic-load (string-append lib-dir "/" (cdr p)))
(call-external (get-external initializer-name))))
(else
(error "Could not figure out libscshyp's name" la-file-name))))))
(run '(let ((lib-dir (string-append "@scxlibdir@/" @scxhost@))
(la-file-name (string-append lib-dir "/libscx.la"))
(initializer-name "scx_init_xlib"))
(let ((la-alist (read-libtool-la la-file-name)))
(cond
((assoc 'dlname la-alist)
=> (lambda (p)
(let ((module-file (string-append lib-dir "/" (cdr p))))
(dynamic-load module-file)
(call-external (get-external initializer-name))
(if (string=? "@scxload_xft_packages@" "yes")
(begin
(call-external (get-external "scx_xft_init"))
(call-external (get-external "scx_xrender_init")))))))
(else
(error "Could not figure out libscx's name" la-file-name))))))
(config)
(load "@scxschemedir@/xlib/xlib-interfaces.scm")
(load "@scxschemedir@/xlib/xlib-packages.scm")