diff --git a/Makefile.am b/Makefile.am index 15a8208..6f20b92 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1 @@ -SUBDIRS = c scheme - +SUBDIRS = c diff --git a/autoclean.sh b/autoclean.sh deleted file mode 100755 index 2d4a0d9..0000000 --- a/autoclean.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -rm -f config.cache config.guess config.status config.sub config.log \ - configure ltconfig ltmain.sh Makefile Makefile.in \ - aclocal.m4 depcomp install-sh ltconfig ltmain.sh missing \ - mkinstalldirs -rm -rf libltdl autom4te.cache diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index aaa670f..0000000 --- a/autogen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -./autoclean.sh - -aclocal -I . -autoconf - -libtoolize --copy --automake --ltdl -#autoheader -#touch ltconfig -automake --copy --add-missing diff --git a/c/Makefile.am b/c/Makefile.am index 6aa2b09..cfdb293 100644 --- a/c/Makefile.am +++ b/c/Makefile.am @@ -6,14 +6,14 @@ SCHEME_DIR= ../scheme FFITOOLS_DIR= ../ffi-tools CLEANFILES= $(GENERATED_CODE) -noinst_LTLIBRARIES = libscshldap.la +libsys_LTLIBRARIES= libscshldap.la -libscshldap_la_SOURCES = ldap.c $(GENERATED_CODE) -libscshldap_la_LDFLAGS= +libscshldap_la_SOURCES= ldap.c $(GENERATED_CODE) +libscshldap_la_LDFLAGS= -avoid-version -module libscshldap_la_DEPENDENCIES= $(GENERATED_CODE) $(GENERATED_CODE): $(SCSH) -lm $(FFITOOLS_DIR)/ffi-tools-package.scm \ -lm $(SCHEME_DIR)/ldap-constants.scm \ -o ldap-constants -c '(make-c-files command-line-arguments)' \ - `pwd` \ No newline at end of file + `pwd` diff --git a/configure.in b/configure.in index 2949c87..83340c3 100644 --- a/configure.in +++ b/configure.in @@ -37,6 +37,7 @@ AC_ARG_WITH(ldap-prefix, AC_SUBST(LDFLAGS, "$LDFLAGS -L${ldap_lib}") AC_SUBST(CFLAGS, "$CFLAGS -I${ldap_include}") +AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${ldap_include}") dnl Check for LDAP libraries and headers @@ -132,4 +133,4 @@ AC_SUBST(libdir) AC_SUBST(libsysdir) AC_SUBST(schemedir) AC_SUBST(CC) -AC_OUTPUT([Makefile c/Makefile scheme/Makefile]) +AC_OUTPUT([Makefile c/Makefile]) diff --git a/pkg-def.scm b/pkg-def.scm new file mode 100644 index 0000000..1e8b6ed --- /dev/null +++ b/pkg-def.scm @@ -0,0 +1,63 @@ +(define-package "ldap" (0 1 0) + ((options (ldap-prefix "Use LDAP library with prefix" "" #t #f #f))) + + (newline) + (display "Configuring, compiling and installting C-stubs") + (newline) + + (let* ((scsh-includes (include-dir)) + (build-host (get-option-value 'build)) + (prefix (string-append (get-directory 'lib #f) "/" build-host)) + (configure (append + (list "./configure" + (string-append "--prefix=" prefix) + (string-append "--with-scsh-includes=" scsh-includes) + (string-append "--build=" build-host)) + (cond ((get-option-value 'ldap-prefix) + => (lambda (prefix) + (list + (string-append "--with-ldap-prefix=" prefix)))) + (else '())))) + (make `(make install + ,(string-append "DESTDIR=" (get-option-value 'dest-dir))))) + (if (get-option-value 'dry-run) + (begin + (display configure) (newline) + (display make) (newline)) + (if (not (and (zero? (run ,configure)) + (zero? (run ,make)))) + (exit)))) + + (newline) + (display "creating load.scm") + (newline) + + (let ((schemedir (get-directory 'scheme #f)) + (libdir (get-directory 'lib #f))) + (write-to-load-script + `((user) + (load-package 'dynamic-externals) + (open 'dynamic-externals) + (open 'external-calls) + (open 'configure) + (open 'signals) + ,@(map (lambda (x) `(run ',x)) tmpl-libtool-la-reader) + (run '(let* ((lib-dir (string-append ,libdir "/" (host))) + (la-file-name (string-append lib-dir "/libscshldap.la")) + (initializer-name "scsh_ldap_main")) + (let ((la-alist (read-libtool-la la-file-name))) + (cond + ((assoc 'dlname la-alist) + => (lambda (p) + (let ((module-file (string-append lib-dir "/" (cdr p)))) + (dynamic-load module-file) + (call-external (get-external initializer-name))))) + (else + (error "Could not figure out libscshldap's name" la-file-name)))))) + (config) + (load ,(string-append schemedir "/interfaces.scm")) + (load ,(string-append schemedir "/packages.scm")) + (user)))) + + (install-directory-contents "scheme" 'scheme) +) diff --git a/scheme/Makefile.am b/scheme/Makefile.am deleted file mode 100644 index 95ec1e2..0000000 --- a/scheme/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -SCSH= @SCSH@ -scheme_SCRIPTS=load-ldap.scm - -nobase_scheme_SCRIPTS= \ - ldap.scm - -EXTRA_DIST= load-ldap.scm.in $(nobase_scheme_SCRIPTS) -GENERATED_CODE= const-gen.scm -CLEANFILES= load-ldap.scm $(GENERATED_CODE) - -$(GENERATED_CODE): - $(SCSH) -lm ffi-tools-packages.scm -lm ldap-constants.scm \ - -o ldap-constants -c '(make-c-files command-line-arguments)' \ - `pwd` - -load-ldap.scm: $(srcdir)/load-ldap.scm.in - sed -e "s|@scshldapschemedir@|`pwd`/$(srcdir)|g" \ - -e "s|@scshldaphost@||g" \ - -e "s|@scshldaplibdir@|`pwd`/../c/.libs|g" \ - $< > $@ - -install-data-hook: - sed -e "s|@scshldapschemedir@|$(schemedir)|g" \ - -e "s|@scshldaphost@|(host)|g" \ - -e "s|@scshldaplibdir@|$(libdir)|g" \ - $(srcdir)/load-ldap.scm.in \ - > $(DESTDIR)/$(schemedir)/load-ldap.scm \ No newline at end of file