;; -*- Hen -*- (define (python-try-compile header cppflags ldflags) (and (try-compile (string-append header "\n" "int main() { Py_Initialize(); return 0; }\n") ldflags: ldflags cflags: cppflags) (cons cppflags ldflags) )) (define-syntax python-test (syntax-rules () ((_ (flags ...)) (condition-case (python-try-compile flags ...) (t () #f))))) (define cpp+ld-options (or (python-test ("#include " "-I/System/Library/Frameworks/Python.framework/Headers" "-framework Python")) (python-test ("#include " "-I/usr/include/python2.5" "-lpython2.5")) (python-test ("#include " "-I/usr/include/python2.4" "-lpython2.4")) (python-test ("#include " "-I/usr/include/python2.3" "-lpython2.3")) (python-test ("#include " "" "-lpython25")) (python-test ("#include " "" "-lpython24")) (python-test ("#include " "" "-lpython23")) (python-test ("#include " "-I/usr/include/python" "-lpython")) (error "unable to figure out location of Python"))) (define c-options (car cpp+ld-options)) (define ld-options (cdr cpp+ld-options)) (define (dynld-name fn) (make-pathname #f fn ##sys#load-dynamic-extension)) (compile -O2 -d0 -I. -s pyffi.scm -j pyffi -X easyffi -L "\"" ,ld-options "\"" -C "\"" ,c-options "\"" ) (compile -O2 -d0 -s pyffi.import.scm) (run (csi -qbs pyffi-eggdoc.scm > pyffi.html)) (install-extension 'pyffi `(,(dynld-name "pyffi") ,(dynld-name "pyffi.import") ) `((version 2.11) (documentation "pyffi.html")))