chiark
/
gitweb
/
~mdw
/
clg
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f942a38
)
Added support for pkg-config
author
espen
<espen>
Sun, 29 Apr 2001 20:12:56 +0000
(20:12 +0000)
committer
espen
<espen>
Sun, 29 Apr 2001 20:12:56 +0000
(20:12 +0000)
tools/config.lisp
patch
|
blob
|
blame
|
history
diff --git
a/tools/config.lisp
b/tools/config.lisp
index fa335fa9e7b9a5923c11ded340ecad42f498dbfb..0b776e0b7f966a7df01824647df099cb17d24bd0 100644
(file)
--- a/
tools/config.lisp
+++ b/
tools/config.lisp
@@
-1,16
+1,25
@@
-(defun configure-cflags (config-program)
+(defparameter *pkg-config* "/usr/bin/pkg-config")
+
+(defun split-string (string &key (start 0) end)
+ (let ((position (position #\sp string :start start :end end)))
+ (if position
+ (cons
+ (subseq string start position)
+ (split-string string :start (1+ position) :end end))
+ (list (subseq string start end)))))
+
+(defun run-pkg-config (package &rest options)
(let ((process
(run-program
(let ((process
(run-program
-
config-program '("--cflags"
) :wait t :output :stream)))
+
*pkg-config* (cons package options
) :wait t :output :stream)))
(unless process
(unless process
- (error "Unable to run %A" config-program))
- (labels ((split (string)
- (let ((position (position #\sp string)))
- (if position
- (cons
- (subseq string 0 position)
- (split (subseq string (1+ position))))
- (list string)))))
+ (error "Unable to run ~A" *pkg-config*))
+ (unless (zerop (process-exit-code process))
+ (error "~A: ~A" *pkg-config* (read-line (process-output process))))
(prog1
(prog1
- (split (read-line (process-output process)))
- (process-close process)))))
+ (delete-if #'(lambda (str) (string= str "")) (split-string (read-line (process-output process))))
+ (process-close process))))
+
+
+(defun pkg-cflags (package)
+ (run-pkg-config package "--cflags"))