140 |
(string-append program-name |
(string-append program-name |
141 |
" link: arguments to subcommand not yet implemented"))) |
" link: arguments to subcommand not yet implemented"))) |
142 |
|
|
143 |
(let* ((flags |
(let ((libdir (get-build-info 'libdir)) |
144 |
(let loop ((libs |
(other-flags |
145 |
;; Get the string of linker flags we used to build |
(let loop ((libs |
146 |
;; Guile, and break it up into a list. |
;; Get the string of linker flags we used to build |
147 |
(separate-fields-discarding-char #\space |
;; Guile, and break it up into a list. |
148 |
(get-build-info 'LIBS) |
(separate-fields-discarding-char #\space |
149 |
list))) |
(get-build-info 'LIBS) |
150 |
|
list))) |
151 |
(cond |
|
152 |
((null? libs) '()) |
(cond |
153 |
|
((null? libs) '()) |
154 |
;; Turn any "FOO/libBAR.a" elements into "-lBAR". |
|
155 |
((match-lib (car libs)) |
;; Turn any "FOO/libBAR.a" elements into "-lBAR". |
156 |
=> (lambda (bar) |
((match-lib (car libs)) |
157 |
(cons (string-append "-l" bar) |
=> (lambda (bar) |
158 |
(loop (cdr libs))))) |
(cons (string-append "-l" bar) |
159 |
|
(loop (cdr libs))))) |
160 |
;; Remove any empty strings that may have seeped in there. |
|
161 |
((string=? (car libs) "") (loop (cdr libs))) |
;; Remove any empty strings that may have seeped in there. |
162 |
|
((string=? (car libs) "") (loop (cdr libs))) |
163 |
(else (cons (car libs) (loop (cdr libs))))))) |
|
164 |
|
(else (cons (car libs) (loop (cdr libs)))))))) |
165 |
;; Include libguile itself in the list, along with the |
|
166 |
;; directory it was installed in. |
;; Include libguile itself in the list, along with the directory |
167 |
(flags (cons (string-append "-L" (get-build-info 'libdir)) |
;; it was installed in, but do *not* add /usr/lib since that may |
168 |
(cons "-lguile" flags)))) |
;; prevent other programs from specifying non-/usr/lib versions |
169 |
|
;; via their foo-config scripts. If *any* app puts -L/usr/lib in |
170 |
|
;; the output of its foo-config script then it may prevent the use |
171 |
|
;; a non-/usr/lib install of anything that also has a /usr/lib |
172 |
|
;; install. For now we hard-code /usr/lib, but later maybe we can |
173 |
|
;; do something more dynamic (i.e. what do we need. |
174 |
|
|
175 |
;; Display the flags, separated by spaces. |
;; Display the flags, separated by spaces. |
176 |
(display-separated flags) |
(if (or (string=? libdir "/usr/lib") |
177 |
|
(string=? libdir "/usr/lib/")) |
178 |
|
(display-separated (cons "-lguile" other-flags)) |
179 |
|
(display-separated (cons |
180 |
|
(string-append "-L" (get-build-info 'libdir)) |
181 |
|
(cons "-lguile" other-flags)))) |
182 |
(newline))) |
(newline))) |
183 |
|
|
184 |
(define (help-link) |
(define (help-link) |
201 |
(error |
(error |
202 |
(string-append program-name |
(string-append program-name |
203 |
" compile: no arguments expected"))) |
" compile: no arguments expected"))) |
204 |
(display-line "-I" (get-build-info 'includedir))) |
|
205 |
|
;; See gcc manual wrt fixincludes. Search for "Use of |
206 |
|
;; `-I/usr/include' may cause trouble." For now we hard-code this. |
207 |
|
;; Later maybe we can do something more dynamic. |
208 |
|
(if (not (string=? (get-build-info 'includedir) "/usr/include")) |
209 |
|
(display-line "-I" (get-build-info 'includedir)))) |
210 |
|
|
211 |
(define (help-compile) |
(define (help-compile) |
212 |
(let ((dle display-line-error)) |
(let ((dle display-line-error)) |
273 |
(newline port)) |
(newline port)) |
274 |
|
|
275 |
(define (display-separated args) |
(define (display-separated args) |
276 |
(let loop ((args args)) |
(if (not (null? args)) |
277 |
(cond ((null? args)) |
(begin |
278 |
((null? (cdr args)) (display (car args))) |
(display (car args)) |
279 |
(else (display (car args)) |
(for-each |
280 |
(display " ") |
(lambda (arg) (display " ") (display arg)) |
281 |
(loop (cdr args)))))) |
(cdr args))))) |
282 |
|
|
283 |
|
|
284 |
;;;; the command table |
;;;; the command table |