autoload replacement used in ugarit added by alaricsp on Tue Sep 24 10:46:46 2013

 (define (get-bindings-from-module egg module bindings)
   (let* ((vektor (gensym))
          (rekuire-extension (gensym))
           `(module ,(gensym) ()
                      (only scheme vector require-extension quote) ; quote shouldn't need to be here
                      (vector ,vektor) (require-extension ,rekuire-extension)))
                    (,rekuire-extension ,module)
                    (,vektor ,@bindings))))
      exn (if ((condition-predicate 'syntax) exn)
              (signal (make-composite-condition
                       (make-property-condition 'exn
                                                (sprintf "This feature depends upon the optional module ~a being installed. Please install it with 'chicken-install -s ~a'." module egg))
                       (make-property-condition 'unsupported-feature
                                                'egg egg
                                                'module module
                                                'bindings bindings)))
              (signal exn))
      (eval expression))))

 ;; FIXME: Write a macro to generate these for us.

 (define (autoload-lzma!)
   (let ((real-bindings
          (get-bindings-from-module 'lzma 'lzma '(compress decompress))))
     (set! lzma:compress (vector-ref real-bindings 0))
     (set! lzma:decompress (vector-ref real-bindings 1))))

 (define lzma:compress
   (lambda args
     (apply lzma:compress args)))

 (define lzma:decompress
   (lambda args
     (apply lzma:decompress args)))