aboutsummaryrefslogtreecommitdiff
path: root/configure.scm
diff options
context:
space:
mode:
Diffstat (limited to 'configure.scm')
-rw-r--r--configure.scm50
1 files changed, 50 insertions, 0 deletions
diff --git a/configure.scm b/configure.scm
index 1a6fdde..6681f17 100644
--- a/configure.scm
+++ b/configure.scm
@@ -37,5 +37,55 @@
(display (format "no~%error: no ~a found~%"))
(exit #f))))
+(define (option-proc opt name arg result)
+ (cons (cons (string->symbol name) arg)
+ result))
+
+(define (unrecognized-option-proc opt name arg result)
+ (display (if arg
+ (format "Ignoring unrecognized option --~a=~a~%"
+ name arg)
+ (format "Ignoring unrecognized option --~a~%"
+ name)))
+ result)
+
+(define (unrecognized-argument-proc arg result)
+ (display (format "Ignoring unrecognized argument ~a~%"
+ arg))
+ result)
+
+(define processed-args
+ (match (program-arguments)
+ ((_ args ...)
+ (let* ((args (args-fold args
+ (list (option '("prefix") #t #f
+ option-proc))
+ unrecognized-option-proc
+ unrecognized-argument-proc
+ '()))
+ (prefix (or (assq-ref args 'prefix)
+ "/usr/local"))
+ (exec-prefix (or (assq-ref args 'exec-prefix)
+ prefix))
+ (libdir (or (assq-ref args 'libdir)
+ (string-append exec-prefix "/lib")))
+ (datarootdir (or (assq-ref args 'datarootdir)
+ (string-append prefix "/share"))))
+ `((libdir . ,libdir)
+ (datarootdir . ,datarootdir))))))
+
(check-for-guile-3.0)
(check-for-module '(json))
+
+(call-with-output-file "Makefile.include"
+ (lambda (port)
+ (display (format "# This file was automatically generated by configure.
+
+libdir = ~a
+datarootdir = ~a
+guile_effective_version = ~a
+"
+ (assq-ref processed-args 'libdir)
+ (assq-ref processed-args 'datarootdir)
+ (effective-version))
+ port)))