removing warning about no shared object extension when compiling statically.

patch from andreas rottman (issue 36).
This commit is contained in:
Alex Shinn 2010-02-26 00:11:12 +09:00
parent 20da1b8909
commit a7ad2d547c

View file

@ -99,6 +99,13 @@
(define (eval-module name mod) (define (eval-module name mod)
(let ((env (make-environment)) (let ((env (make-environment))
(dir (module-name-prefix name))) (dir (module-name-prefix name)))
(define (load-modules files extension)
(for-each
(lambda (f)
(let ((f (string-append dir f extension)))
(cond ((find-module-file f) => (lambda (x) (load x env)))
(else (error "couldn't find include" f)))))
files))
(for-each (for-each
(lambda (x) (lambda (x)
(case (and (pair? x) (car x)) (case (and (pair? x) (car x))
@ -110,18 +117,12 @@
(%env-copy! env (module-env mod2) (cdr mod2-name+imports) (%env-copy! env (module-env mod2) (cdr mod2-name+imports)
(eq? (car x) 'import-immutable)))) (eq? (car x) 'import-immutable))))
(cdr x))) (cdr x)))
((include include-shared) ((include)
(if (cond-expand (dynamic-loading #t) (load-modules (cdr x) ""))
(else (not (eq? 'include-shared (car x))))) ((include-shared)
(for-each (cond-expand
(lambda (f) (dynamic-loading (load-modules (cdr x) *shared-object-extension*))
(let ((f (string-append (else #f)))
dir f
(if (eq? (car x) 'include) "" *shared-object-extension*))))
(cond
((find-module-file f) => (lambda (x) (load x env)))
(else (error "couldn't find include" f)))))
(cdr x))))
((body) ((body)
(for-each (lambda (expr) (eval expr env)) (cdr x))))) (for-each (lambda (expr) (eval expr env)) (cdr x)))))
(module-meta-data mod)) (module-meta-data mod))