diff --git a/Makefile.am b/Makefile.am index f3f8289..5e1226d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 < $< > $@ diff --git a/config-data.scm.in b/config-data.scm.in new file mode 100644 index 0000000..109c586 --- /dev/null +++ b/config-data.scm.in @@ -0,0 +1 @@ +((shared-module-extension "@module_extension@")) \ No newline at end of file diff --git a/configure.in b/configure.in index 3810605..0b0f82f 100644 --- a/configure.in +++ b/configure.in @@ -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]) \ No newline at end of file diff --git a/load.scm.in b/load.scm.in index 50d1a36..ba889ca 100644 --- a/load.scm.in +++ b/load.scm.in @@ -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) diff --git a/pkg-def.scm b/pkg-def.scm index 4c7af6a..a6e8045 100644 --- a/pkg-def.scm +++ b/pkg-def.scm @@ -20,26 +20,32 @@ (display make) (newline)) (and (zero? (run ,configure)) (zero? (run ,make)) (exit)))) - + (if (not (get-option-value 'non-shared-only)) (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) )