Figure out shared module extension with automake/autoconf/libtool/whatever

This commit is contained in:
eknauel 2004-01-26 09:12:25 +00:00
parent 51c369e3d0
commit e52a9c88bd
5 changed files with 34 additions and 17 deletions

View File

@ -1 +1,9 @@
SUBDIRS= c SUBDIRS = c
BUILT_SOURCES = config-data.scm
CLEANFILES = $(BUILT_SOURCES)
config-data.scm: config-data.scm.in
module=yes; \
eval shared_module_ext="@shrext@"; \
sed -e s/@module_extension@/$$shared_module_ext/g < $< > $@

1
config-data.scm.in Normal file
View File

@ -0,0 +1 @@
((shared-module-extension "@module_extension@"))

View File

@ -41,6 +41,7 @@ libsysdir='${prefix}'
AC_SUBST(libdir) AC_SUBST(libdir)
AC_SUBST(libsysdir) AC_SUBST(libsysdir)
AC_SUBST(schemedir) AC_SUBST(schemedir)
AC_SUBST(shrext)
AC_SUBST(LIBS) AC_SUBST(LIBS)
AC_SUBST(CC) AC_SUBST(CC)
AC_OUTPUT([Makefile c/Makefile]) AC_OUTPUT([Makefile c/Makefile])

View File

@ -4,7 +4,8 @@
(open 'external-calls) (open 'external-calls)
(open 'configure) (open 'configure)
(run '(let ((initializer-name "scsh_yp_main") (run '(let ((initializer-name "scsh_yp_main")
(module-file (string-append "@yplibsysdir@/" @yphost@ "/libscshyp.so"))) (module-file (string-append "@yplibdir@/" @yphost@
"/libscshyp" "@sharedmoduleext@")))
(dynamic-load module-file) (dynamic-load module-file)
(call-external (get-external initializer-name)))) (call-external (get-external initializer-name))))
(config) (config)

View File

@ -25,21 +25,27 @@
(begin (begin
(display "creating load.scm") (display "creating load.scm")
(newline) (newline)
(let ((schemedir (get-directory 'scheme #f)) (let ((config-data
(libdir (get-directory 'lib #f)) (call-with-input-file "config-data.scm" read)))
(target-dir (get-directory 'base #t)) (let ((schemedir (get-directory 'scheme #f))
(sed-replace (lambda (from to) (libdir (get-directory 'lib #f))
(target-dir (get-directory 'base #t))
(shared-ext (cdr (assoc 'shared-lib-extension config-data.scm)))
(sed-replace (lambda (from to)
(string-append "s|" from "|" to "|g")))) (string-append "s|" from "|" to "|g"))))
(let ((cmd `(sed -e ,(sed-replace "@ypschemedir@" schemedir) (let ((cmd `(sed -e ,(sed-replace "@ypschemedir@" schemedir)
-e ,(sed-replace "@yphost@" "(host)") -e ,(sed-replace "@yphost@" "(host)")
-e ,(sed-replace "@yplibdir@" libdir) -e ,(sed-replace "@yplibdir@" libdir)
"load.scm.in")) -e ,(sed-replace "@sharedmoduleext@"
(tgt (string-append target-dir "/load.scm"))) (cdr (assoc 'shared-module-extension
(if (get-option-value 'dry-run) config-data.scm)))
(begin "load.scm.in"))
(display cmd) (display " > ") (display tgt) (tgt (string-append target-dir "/load.scm")))
(newline)) (if (get-option-value 'dry-run)
(or (zero? (run ,cmd (> ,tgt))) (exit))))))) (begin
(display cmd) (display " > ") (display tgt)
(newline))
(or (zero? (run ,cmd (> ,tgt))) (exit)))))))
(install-directory-contents "scheme" 'scheme) (install-directory-contents "scheme" 'scheme)
) )