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,14 +25,20 @@
(begin (begin
(display "creating load.scm") (display "creating load.scm")
(newline) (newline)
(let ((config-data
(call-with-input-file "config-data.scm" read)))
(let ((schemedir (get-directory 'scheme #f)) (let ((schemedir (get-directory 'scheme #f))
(libdir (get-directory 'lib #f)) (libdir (get-directory 'lib #f))
(target-dir (get-directory 'base #t)) (target-dir (get-directory 'base #t))
(shared-ext (cdr (assoc 'shared-lib-extension config-data.scm)))
(sed-replace (lambda (from to) (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)
-e ,(sed-replace "@sharedmoduleext@"
(cdr (assoc 'shared-module-extension
config-data.scm)))
"load.scm.in")) "load.scm.in"))
(tgt (string-append target-dir "/load.scm"))) (tgt (string-append target-dir "/load.scm")))
(if (get-option-value 'dry-run) (if (get-option-value 'dry-run)