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(libsysdir)
AC_SUBST(schemedir)
AC_SUBST(shrext)
AC_SUBST(LIBS)
AC_SUBST(CC)
AC_OUTPUT([Makefile c/Makefile])

View File

@ -4,7 +4,8 @@
(open 'external-calls)
(open 'configure)
(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)
(call-external (get-external initializer-name))))
(config)

View File

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