From 79570401853a4490c4061e94abc97dc18edaca36 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Wed, 17 Oct 2001 16:40:22 +0000 Subject: [PATCH] New interface for building standalone programs and libraries. --- src/CHANGELOG | 14 +- src/aclocal.m4 | 5 + src/c/all_functions.d | 2 +- src/c/interpreter.d | 2 +- src/c/load.d | 10 +- src/c/main.d | 2 +- src/c/read.d | 16 +- src/cmp/cmpdefs.lsp | 5 +- src/cmp/cmpmain.lsp | 163 ++++++++++------- src/cmp/sysfun.lsp | 13 +- src/compile.lsp.in | 2 +- src/configure | 253 ++++++++++++++------------ src/configure.in | 12 +- src/doc/Makefile.in | 4 +- src/doc/devel.txi | 361 +++++++++++++++++++++++++++++++------- src/doc/user.txi | 71 ++------ src/gabriel/Makefile.in | 2 +- src/gabriel/triang-mod.cl | 9 + src/h/config.h.in | 3 + src/lsp/autoload.lsp | 4 + src/util/system.lsp | 18 +- 21 files changed, 641 insertions(+), 330 deletions(-) diff --git a/src/CHANGELOG b/src/CHANGELOG index d52b610b6..2b41b49c0 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -806,6 +806,8 @@ ECLS 0.5 - PROBE-FILE would not translate logical pathnames before checking for file existence. + - In unsafe mode, inlining AREF lead to bogus code. + * System design and portability: - Remove function_entry_table. @@ -831,12 +833,6 @@ ECLS 0.5 These definitions are lost once the function is compiled, hence the second error message. - - C::BUILD-ECLS rewritten to accept three keyword parameters: - :COMPONENTS, the object files, libraries and flags to be passed to - the compiler; :PROLOGUE-CODE, a string with C code to be executed - before initialization; and :EPILOGUE-CODE, a string with C code to - be executed after initializing Lisp. - - Reader macro '#,' has been dropped. LOAD-TIME-VALUE added to both the interpreter and the compiler. @@ -846,6 +842,12 @@ ECLS 0.5 are stored in memory. It is possible to dump documentation strings to a help file. + - New interface for building standalone programs and libraries, based + on the functions C:BUILD-ECLS, C:BUILD-STATIC-LIBRARY and + C:BUILD-SHARED-LIBRARY, all of which accept similar parameters, + :PROLOGUE-CODE, :EPILOGE-CODE, :LISP-FILES, and :LD-FLAGS. Exhaustive + documentation with examples included in the Developer's Guide. + TODO: ===== diff --git a/src/aclocal.m4 b/src/aclocal.m4 index fc554af41..c46d8a2fc 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -110,7 +110,12 @@ eval `${CPP} -D${host} ${tempcname} \ rm ${tempcname} ] AC_MSG_CHECKING(for ld flags when building shared libraries) +if test "${shared}" = "yes" -a "${SHARED_LDFLAGS}" ; then AC_MSG_RESULT([${SHARED_LDFLAGS}]) +else +shared="no"; +AC_MSG_RESULT(cannot build) +fi AC_MSG_CHECKING(for required libraries) AC_MSG_RESULT([${CLIBS}]) AC_MSG_CHECKING(for architecture) diff --git a/src/c/all_functions.d b/src/c/all_functions.d index c869340b2..f3b946fac 100644 --- a/src/c/all_functions.d +++ b/src/c/all_functions.d @@ -364,7 +364,7 @@ const struct function_info all_functions[] = { /* load.d */ {"LOAD", clLload, cl}, -#ifdef USE_DLOPEN +#ifdef ENABLE_DLOPEN {"LOAD-BINARY", siLload_binary, si}, #endif {"LOAD-SOURCE", siLload_source, si}, diff --git a/src/c/interpreter.d b/src/c/interpreter.d index 2847296fe..f62935141 100644 --- a/src/c/interpreter.d +++ b/src/c/interpreter.d @@ -33,7 +33,7 @@ cl_stack_set_size(cl_index new_size) cl_index top = cl_stack_top - cl_stack; cl_object *new_stack; - printf("*+*+*+\n"); + /*printf("*+*+*+\n");*/ if (top > new_size) FEerror("Internal error: cannot shrink stack that much.",0); diff --git a/src/c/load.d b/src/c/load.d index fe292d087..87614596e 100644 --- a/src/c/load.d +++ b/src/c/load.d @@ -32,7 +32,7 @@ cl_object @'si::*source-pathname*'; /******************************* ------- ******************************/ -#ifdef USE_DLOPEN +#ifdef ENABLE_DLOPEN @(defun si::load_binary (filename verbose print) cl_object block; cl_object basename; @@ -79,7 +79,7 @@ GO_ON: read_VV(block, block->cblock.entry); @(return Cnil) @) -#endif /* USE_DLOPEN */ +#endif /* ENABLE_DLOPEN */ @(defun si::load_source (filename verbose print) cl_object x, strm; @@ -215,18 +215,18 @@ init_load(void) #endif PDE load_source = make_si_ordinary("LOAD-SOURCE"); -#ifdef USE_DLOPEN +#ifdef ENABLE_DLOPEN load_binary = make_si_ordinary("LOAD-BINARY"); #endif SYM_VAL(@'si::*load-hooks*') = list(4, -#ifdef USE_DLOPEN +#ifdef ENABLE_DLOPEN CONS(make_simple_string("so"), load_binary), #endif CONS(make_simple_string("lsp"), load_source), CONS(make_simple_string("lisp"), load_source), CONS(Cnil, load_source)); -#ifdef USE_DLOPEN +#ifdef ENABLE_DLOPEN if (dlopen(NULL, RTLD_NOW|RTLD_GLOBAL) == NULL) printf(";;; Error dlopening self file\n;;; Error: %s\n", dlerror()); #endif diff --git a/src/c/main.d b/src/c/main.d index 7f8c24fce..f492f4efc 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -180,7 +180,7 @@ init_main(void) ADD_FEATURE("ANSI-CL"); -#ifdef USE_DLOPEN +#ifdef ENABLE_DLOPEN ADD_FEATURE("DLOPEN"); #endif diff --git a/src/c/read.d b/src/c/read.d index c2cbb706e..9db85b662 100644 --- a/src/c/read.d +++ b/src/c/read.d @@ -2294,11 +2294,9 @@ read_VV(cl_object block, void *entry) (*entry_point)(block); len = block->cblock.data_size; - if (len == 0) - return; #ifdef GBC_BOEHM - VV = block->cblock.data = alloc(len * sizeof(cl_object)); + VV = block->cblock.data = len? alloc(len * sizeof(cl_object)) : NULL; #else VV = block->cblock.data; #endif @@ -2315,11 +2313,13 @@ read_VV(cl_object block, void *entry) setup_standard_READ(); - in = make_string_input_stream(make_simple_string(block->cblock.data_text), - 0, block->cblock.data_text_size); + in = OBJNULL; if (frs_push(FRS_PROTECT, Cnil)) e = TRUE; else { + if (len == 0) goto NO_DATA; + in=make_string_input_stream(make_simple_string(block->cblock.data_text), + 0, block->cblock.data_text_size); read_VV_block = block; for (i = 0 ; i < len; i++) { sharp_eq_context = Cnil; @@ -2335,16 +2335,18 @@ read_VV(cl_object block, void *entry) } if (i < len) FEerror("Not enough data while loading binary file",0); - SYM_VAL(@'*package*') = old_package; #ifdef PDE bds_bind(@'si::*source-pathname*', VV[block->cblock.source_pathname]); #endif + NO_DATA: + SYM_VAL(@'*package*') = old_package; (*entry_point)(MAKE_FIXNUM(0)); e = FALSE; } frs_pop(); - close_stream(in, 0); + if (in != OBJNULL) + close_stream(in, 0); read_VV_block = OBJNULL; bds_unwind(old_bds_top); diff --git a/src/cmp/cmpdefs.lsp b/src/cmp/cmpdefs.lsp index 802ee6dd2..a3e620be7 100644 --- a/src/cmp/cmpdefs.lsp +++ b/src/cmp/cmpdefs.lsp @@ -37,7 +37,10 @@ *cc* *cc-optimize* build-ecls - make-library + build-static-library + build-shared-library + shared-library-pathname + static-library-pathname *suppress-compiler-warnings* *suppress-compiler-notes*)) diff --git a/src/cmp/cmpmain.lsp b/src/cmp/cmpmain.lsp index f3bbce739..2ed92b53a 100644 --- a/src/cmp/cmpmain.lsp +++ b/src/cmp/cmpmain.lsp @@ -59,45 +59,25 @@ coprocessor).") string result)) result)) -(defun library-pathname (name shared &optional(directory "./")) - (if shared - (make-pathname :name name :type "so" :defaults directory) - (make-pathname :name (concatenate 'string "lib" name) - :type "a" :defaults directory))) +(defun static-library-pathname (output-file) + (let* ((real-name (format nil "lib~A.a" (pathname-name output-file)))) + (merge-pathnames real-name output-file))) -(defun compile-file-pathname (name &key output-file) - (merge-pathnames (or output-file name) #+dlopen #P".so" #-dlopen #P".o")) +(defun shared-library-pathname (output-file) + #-dlopen + (error "Dynamically loadable libraries not supported in this system.") + #+dlopen + (let* ((real-name (format nil "~A.so" (pathname-name output-file)))) + (merge-pathnames real-name output-file))) -(defun make-library (lib objects &key (output-dir "./") (shared nil)) - (let* ((lib (string-upcase lib)) - (init-name (mapcar #'(lambda (x) (string-upcase (pathname-name x))) - objects)) - (liba (library-pathname (string-downcase lib) shared output-dir)) - (libc (make-pathname :name lib :type "c" :defaults output-dir)) - (libo (make-pathname :name lib :type "o" :defaults output-dir))) - (with-open-file (libc-file libc :direction :output) - (format libc-file - " -void -init_~A(cl_object) -{ -~{ extern void init_~A(cl_object);~%~} -~{ read_VV((void*)0,init_~A);~%~} -} -" - lib init-name init-name) - (compiler-cc libc libo) - #-dlopen - (safe-system (format nil "ar cr ~A ~A ~{~A ~}" - (namestring liba) (namestring libo) objects)) - #+dlopen - (if shared - (apply #'shared-cc (namestring liba) (namestring libo) objects) - (safe-system (format nil "ar cr ~A ~A ~{~A ~}" - (namestring liba) (namestring libo) objects))) - (delete-file (namestring libc)) - (delete-file (namestring libo))) - liba)) +(defun compile-file-pathname (name &key output-file system-p) + (let ((extension ".o")) + (unless system-p + #+dlopen + (setq extension ".so") + #-dlopen + (error "This platform only supports compiling files with :SYSTEM-P T")) + (merge-pathnames extension (or output-file name)))) (defun linker-cc (o-pathname &rest options) (safe-system @@ -120,38 +100,95 @@ init_~A(cl_object) options ""))) -(defun build-ecls (name &key components (prologue-code "") - (epilogue-code " - funcall(1,_intern(\"TOP-LEVEL\",system_package)); - return;")) - (let ((c-name (make-pathname :name name :type "c")) - (o-name (make-pathname :name name :type "o")) - (ld-flags (list "-lecls" #+CLOS "-lclos" "-llsp"))) - (with-open-file (c-file c-name :direction :output) - (format c-file " -#include \"ecls.h\" - -extern cl_object lisp_package; +(defconstant +lisp-program-main+ " +#include int main(int argc, char **argv) { +~{ extern void init_~A(cl_object);~%~} ~A cl_boot(argc, argv); - siLpackage_lock(2, lisp_package, Ct);~%" prologue-code) - (dolist (item (reverse components)) - (cond ((symbolp item) - (format c-file " init_~A();~%" (string-upcase item)) - (push (format nil "-l~A" (string-downcase item)) ld-flags)) - ((stringp item) - (push item ld-flags)) - (t - (error "compiler::build-ecls wrong argument ~A" item)))) - (format c-file "~A;~%}~%" epilogue-code)) - (compiler-cc c-name o-name) - (apply #'linker-cc name (namestring o-name) ld-flags) - (delete-file c-name) - )) +~{ read_VV((void*)0,init_~A);~%~} + ~A +}") + +(defconstant +lisp-library-main+ " +#include + +int +init_~A(cl_object foo) +{ +~{ extern void init_~A();~%~} + ~A +~{ read_VV((void*)0,init_~A);~%~} + ~A +}") + +(defun builder (target output-name &key lisp-files ld-flags (prologue-code "") + (epilogue-code (if (eq target :program) " + funcall(1,_intern(\"TOP-LEVEL\",system_package)); + return;" ""))) + (let* (init-name c-name o-name) + (when (eq target :program) + (setq ld-flags (append ld-flags '("-lecls" "-lclos" "-llsp")))) + (dolist (item (reverse lisp-files)) + (cond ((symbolp item) + (push (format nil "-l~A" (string-downcase item)) ld-flags) + (push (string-upcase item) init-name)) + (t + (push (namestring (merge-pathnames ".o" item)) ld-flags) + (setq item (pathname-name item)) + (push (string-upcase item) init-name)))) + (setq c-name (namestring (merge-pathnames ".c" output-name)) + o-name (namestring (merge-pathnames ".o" output-name))) + (ecase target + (:program + (setq output-name (namestring output-name)) + (with-open-file (c-file c-name :direction :output) + (format c-file +lisp-program-main+ init-name prologue-code init-name + epilogue-code)) + (compiler-cc c-name o-name) + (apply #'linker-cc output-name (namestring o-name) ld-flags)) + (:static-library + (when (symbolp output-name) + (setq output-name (static-library-pathname output-name))) + (let ((library-name (string-upcase (pathname-name output-name)))) + (unless (equalp (subseq library-name 0 3) "LIB") + (error "Filename ~A is not a valid library name." + output-name)) + (with-open-file (c-file c-name :direction :output) + (format c-file +lisp-library-main+ + ;; Remove the leading "lib" + (subseq library-name 3) + init-name prologue-code init-name epilogue-code))) + (compiler-cc c-name o-name) + (safe-system (format nil "ar cr ~A ~A ~{~A ~}" + output-name o-name ld-flags))) + #+dlopen + (:shared-library + (when (or (symbolp output-name) (not (pathname-type output-name))) + (setq output-name (shared-library-pathname output-name))) + (with-open-file (c-file c-name :direction :output) + (format c-file +lisp-library-main+ + "CODE" init-name prologue-code init-name epilogue-code)) + (compiler-cc c-name o-name) + (apply #'shared-cc output-name o-name ld-flags))) + ;(delete-file c-name) + (delete-file o-name) + output-name)) + +(defun build-ecls (&rest args) + (apply #'builder :program args)) + +(defun build-static-library (&rest args) + (apply #'builder :static-library args)) + +(defun build-shared-library (&rest args) + #-dlopen + (error "Dynamically loadable libraries not supported in this system.") + #+dlopen + (apply #'builder :shared-library args)) (defun compile-file (input-pathname &key (output-file 'T) diff --git a/src/cmp/sysfun.lsp b/src/cmp/sysfun.lsp index 5ba4d0de9..a99648b79 100644 --- a/src/cmp/sysfun.lsp +++ b/src/cmp/sysfun.lsp @@ -111,10 +111,16 @@ :inline-always ((t fixnum) t nil t "aref1(#0,#1)") :inline-unsafe ((t t) t nil t "aref1(#0,fix(#1))") :inline-unsafe ((t fixnum) t nil t "aref1(#0,#1)") - :inline-unsafe (((array t) t) t nil nil "(#0)->vector.self.t[fix(#1)]") :inline-unsafe (((array bit) t) fixnum nil nil "aref_bv(#0,fix(#1))") - :inline-unsafe (((array t) fixnum) t nil nil "(#0)->vector.self.t[#1]") :inline-unsafe (((array bit) fixnum) fixnum nil nil "aref_bv(#0,#1)") + :inline-unsafe (((array base-char) fixnum) t nil nil + "CODE_CHAR((#0)->string.self[#1])") + :inline-unsafe (((array long-float) fixnum) t nil nil + "make_longfloat((#0)->array.self.lf[#1])") + :inline-unsafe (((array short-float) fixnum) t nil nil + "make_shortfloat((#0)->array.self.sf[#1])") + :inline-unsafe (((array fixnum) fixnum) t nil nil + "MAKE_FIXNUM((#0)->array.self.fix[#1])") :inline-unsafe (((array base-char) fixnum) fixnum nil nil "(#0)->string.self[#1]") :inline-unsafe (((array base-char) fixnum) character nil nil @@ -124,7 +130,8 @@ :inline-unsafe (((array short-float) fixnum) short-float nil nil "(#0)->array.self.sf[#1]") :inline-unsafe (((array fixnum) fixnum) fixnum nil nil - "(#0)->array.self.fix[#1]")) + "(#0)->array.self.fix[#1]") +) (SI::ASET (T ARRAY *) NIL NIL NIL :inline-unsafe ((t t t t) t t nil "@0;aset(#1,fix(#2)*(#1)->array.dims[1]+fix(#3),#0)") diff --git a/src/compile.lsp.in b/src/compile.lsp.in index 09a697ea9..e652c5172 100644 --- a/src/compile.lsp.in +++ b/src/compile.lsp.in @@ -38,6 +38,6 @@ ;(sbt::operate-on-system clos :load) ) -(compiler::build-ecls "ecls" :components '(#+(and (not dlopen) WANTS-CMP) cmp)) +(compiler::build-ecls "ecls" :lisp-files '(#+(and (not dlopen) WANTS-CMP) cmp)) (quit) diff --git a/src/configure b/src/configure index 2addf348a..141a0e64e 100755 --- a/src/configure +++ b/src/configure @@ -21,6 +21,8 @@ ac_help="$ac_help --enable-local-gmp Use already installed GMP library." ac_help="$ac_help --with-gmp=args Configure supplied GMP library with arguments." +ac_help="$ac_help +--disable-shared Enable building dynamically loadable extensions." ac_help="$ac_help --with-x use the X Window System" @@ -574,7 +576,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:578: checking host system type" >&5 +echo "configure:580: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -636,6 +638,12 @@ else gmp_flags="" fi +# Check whether --enable-shared or --disable-shared was given. +if test "${enable_shared+set}" = set; then + enableval="$enable_shared" + shared="$enable_shared" +fi + ### ---------------------------------------------------------------------- ### Checks for programs @@ -643,7 +651,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:647: checking for $ac_word" >&5 +echo "configure:655: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -673,7 +681,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:677: checking for $ac_word" >&5 +echo "configure:685: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -724,7 +732,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:728: checking for $ac_word" >&5 +echo "configure:736: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -756,7 +764,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:760: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:768: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -767,12 +775,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 771 "configure" +#line 779 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -798,12 +806,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:802: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:810: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:807: checking whether we are using GNU C" >&5 +echo "configure:815: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -812,7 +820,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:816: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -831,7 +839,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:835: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:843: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -866,7 +874,7 @@ if test "$GCC" != "yes"; then { echo "configure: error: Cannot build ECLS without GCC" 1>&2; exit 1; } fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:870: checking how to run the C preprocessor" >&5 +echo "configure:878: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -881,13 +889,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:899: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -898,13 +906,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -915,13 +923,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:925: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -948,7 +956,7 @@ echo "$ac_t""$CPP" 1>&6 # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:952: checking for $ac_word" >&5 +echo "configure:960: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -987,7 +995,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:991: checking for a BSD compatible install" >&5 +echo "configure:999: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1040,7 +1048,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 -echo "configure:1044: checking whether ln -s works" >&5 +echo "configure:1052: checking whether ln -s works" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1061,12 +1069,12 @@ else fi # sets variable LN_S echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:1065: checking for Cygwin environment" >&5 +echo "configure:1073: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -1094,19 +1102,19 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:1098: checking for mingw32 environment" >&5 +echo "configure:1106: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -1125,7 +1133,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1129: checking for executable suffix" >&5 +echo "configure:1137: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1135,7 +1143,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.C | *.o | *.obj) ;; @@ -1156,7 +1164,7 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6 ac_exeext=$EXEEXT echo $ac_n "checking for getpwnam in -lsun""... $ac_c" 1>&6 -echo "configure:1160: checking for getpwnam in -lsun" >&5 +echo "configure:1168: checking for getpwnam in -lsun" >&5 ac_lib_var=`echo sun'_'getpwnam | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1164,7 +1172,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsun $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1207,17 +1215,17 @@ for ac_hdr in sys/resource.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1211: checking for $ac_hdr" >&5 +echo "configure:1219: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1221: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1247,17 +1255,17 @@ for ac_hdr in sys/utsname.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1251: checking for $ac_hdr" >&5 +echo "configure:1259: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1261: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1287,17 +1295,17 @@ for ac_hdr in float.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1291: checking for $ac_hdr" >&5 +echo "configure:1299: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1301: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1309: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1326,12 +1334,12 @@ done for ac_func in nanosleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1330: checking for $ac_func" >&5 +echo "configure:1338: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1379,7 +1387,7 @@ fi done echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:1383: checking for POSIXized ISC" >&5 +echo "configure:1391: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1498,19 +1506,24 @@ eval `${CPP} -D${host} ${tempcname} \ rm ${tempcname} echo $ac_n "checking for ld flags when building shared libraries""... $ac_c" 1>&6 -echo "configure:1502: checking for ld flags when building shared libraries" >&5 +echo "configure:1510: checking for ld flags when building shared libraries" >&5 +if test "${shared}" = "yes" -a "${SHARED_LDFLAGS}" ; then echo "$ac_t""${SHARED_LDFLAGS}" 1>&6 +else +shared="no"; +echo "$ac_t""cannot build" 1>&6 +fi echo $ac_n "checking for required libraries""... $ac_c" 1>&6 -echo "configure:1505: checking for required libraries" >&5 +echo "configure:1518: checking for required libraries" >&5 echo "$ac_t""${CLIBS}" 1>&6 echo $ac_n "checking for architecture""... $ac_c" 1>&6 -echo "configure:1508: checking for architecture" >&5 +echo "configure:1521: checking for architecture" >&5 echo "$ac_t""${architecture}" 1>&6 echo $ac_n "checking for software type""... $ac_c" 1>&6 -echo "configure:1511: checking for software type" >&5 +echo "configure:1524: checking for software type" >&5 echo "$ac_t""${software_type}" 1>&6 echo $ac_n "checking for software version""... $ac_c" 1>&6 -echo "configure:1514: checking for software version" >&5 +echo "configure:1527: checking for software version" >&5 echo "$ac_t""${software_version}" 1>&6 @@ -1538,6 +1551,12 @@ EOF else EXTRA_OBJS="${EXTRA_OBJS} alloc.o gbc.o" +fi +if test ${shared} = "yes"; then + cat >> confdefs.h <<\EOF +#define ENABLE_DLOPEN 1 +EOF + fi if test ${gmp} ; then cat >> confdefs.h <<\EOF @@ -1554,7 +1573,11 @@ if test ${runtime} ; then EOF else - LSP_LIBRARIES="${LSP_LIBRARIES} libcmp.a" + if test ${shared} = "yes" ; then + LSP_LIBRARIES="${LSP_LIBRARIES} cmp.so" + else + LSP_LIBRARIES="${LSP_LIBRARIES} libcmp.a" + fi fi if test ${tk} ; then TKLIBS="-ltk -ltcl -lXpm @XLIBS@" @@ -1595,13 +1618,13 @@ fi echo $ac_n "checking whether stack growns downwards""... $ac_c" 1>&6 -echo "configure:1599: checking whether stack growns downwards" >&5 +echo "configure:1622: checking whether stack growns downwards" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF @@ -1640,12 +1663,12 @@ fi echo $ac_n "checking if arguments can be accessed through vector""... $ac_c" 1>&6 -echo "configure:1644: checking if arguments can be accessed through vector" >&5 +echo "configure:1667: checking if arguments can be accessed through vector" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < @@ -1670,7 +1693,7 @@ int main() { } EOF -if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "$ac_t""yes" 1>&6 else @@ -1689,12 +1712,12 @@ fi echo $ac_n "checking appropiate type for fixnums""... $ac_c" 1>&6 -echo "configure:1693: checking appropiate type for fixnums" >&5 +echo "configure:1716: checking appropiate type for fixnums" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < int main() { @@ -1709,7 +1732,7 @@ int main() { exit(0); } EOF -if { (eval echo configure:1713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cl_fixnum=`cat conftestval` echo "$ac_t""${cl_fixnum}" 1>&6 @@ -1727,12 +1750,12 @@ rm -fr conftest* fi echo $ac_n "checking most positive fixnum""... $ac_c" 1>&6 -echo "configure:1731: checking most positive fixnum" >&5 +echo "configure:1754: checking most positive fixnum" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < int main() { @@ -1750,7 +1773,7 @@ int main() { exit(0); } EOF -if { (eval echo configure:1754: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cl_fixnum_limit=`cat conftestval` echo "$ac_t""${cl_fixnum_limit}" 1>&6 @@ -1770,14 +1793,14 @@ fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:1774: checking whether byte ordering is bigendian" >&5 +echo "configure:1797: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext < #include @@ -1788,11 +1811,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1815: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext < #include @@ -1803,7 +1826,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:1807: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -1823,7 +1846,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -1865,7 +1888,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:1869: checking for X" >&5 +echo "configure:1892: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -1927,12 +1950,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2001,14 +2024,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -2114,17 +2137,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:2118: checking whether -R must be followed by a space" >&5 +echo "configure:2141: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -2140,14 +2163,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -2179,7 +2202,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:2183: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:2206: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2187,7 +2210,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2220,7 +2243,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:2224: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:2247: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2228,7 +2251,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2266: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2268,12 +2291,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:2272: checking for gethostbyname" >&5 +echo "configure:2295: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -2317,7 +2340,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:2321: checking for gethostbyname in -lnsl" >&5 +echo "configure:2344: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2325,7 +2348,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2366,12 +2389,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:2370: checking for connect" >&5 +echo "configure:2393: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -2415,7 +2438,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:2419: checking for connect in -lsocket" >&5 +echo "configure:2442: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2423,7 +2446,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2458,12 +2481,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:2462: checking for remove" >&5 +echo "configure:2485: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2513: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -2507,7 +2530,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:2511: checking for remove in -lposix" >&5 +echo "configure:2534: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2515,7 +2538,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2550,12 +2573,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:2554: checking for shmat" >&5 +echo "configure:2577: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -2599,7 +2622,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:2603: checking for shmat in -lipc" >&5 +echo "configure:2626: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2607,7 +2630,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2651,7 +2674,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:2655: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:2678: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2659,7 +2682,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2697: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2714,7 +2737,7 @@ fi XLIBS="$XLIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS" echo $ac_n "checking checking for gmp...""... $ac_c" 1>&6 -echo "configure:2718: checking checking for gmp..." >&5 +echo "configure:2741: checking checking for gmp..." >&5 if test ${gmp} ; then echo "$ac_t""no" 1>&6 else @@ -2726,7 +2749,7 @@ else fi fi echo $ac_n "checking checking for Boehm-Weiser gc...""... $ac_c" 1>&6 -echo "configure:2730: checking checking for Boehm-Weiser gc..." >&5 +echo "configure:2753: checking checking for Boehm-Weiser gc..." >&5 if test ${boehm} ; then echo "$ac_t""yes" 1>&6 test -d gc && rm -rf gc diff --git a/src/configure.in b/src/configure.in index 5bac48ad0..aa3cdc61d 100644 --- a/src/configure.in +++ b/src/configure.in @@ -72,6 +72,9 @@ dnl threads="$enable_threads") dnl AC_ARG_ENABLE(runtime, dnl [--enable-runtime Build no compiler.], dnl runtime="$enable_runtime") +AC_ARG_ENABLE(shared, + [--disable-shared Enable building dynamically loadable extensions.], + shared="$enable_shared") ### ---------------------------------------------------------------------- ### Checks for programs @@ -149,6 +152,9 @@ if test ${boehm} ; then else EXTRA_OBJS="${EXTRA_OBJS} alloc.o gbc.o" fi +if test ${shared} = "yes"; then + AC_DEFINE(ENABLE_DLOPEN) +fi if test ${gmp} ; then AC_DEFINE(HAVE_LOCAL_GMP) else @@ -158,7 +164,11 @@ fi if test ${runtime} ; then AC_DEFINE(RUNTIME) else - LSP_LIBRARIES="${LSP_LIBRARIES} libcmp.a" + if test ${shared} = "yes" ; then + LSP_LIBRARIES="${LSP_LIBRARIES} cmp.so" + else + LSP_LIBRARIES="${LSP_LIBRARIES} libcmp.a" + fi fi if test ${tk} ; then TKLIBS="-ltk -ltcl -lXpm @XLIBS@" diff --git a/src/doc/Makefile.in b/src/doc/Makefile.in index aa9e777fb..17b91dfee 100644 --- a/src/doc/Makefile.in +++ b/src/doc/Makefile.in @@ -60,9 +60,7 @@ benchmark.html: $(srcdir)/benchmark.in.html ../gabriel/BENCHMARK echo '
'; cat ../gabriel/BENCHMARK; echo '
'; \ cat $(srcdir)/end) | $(FILTER) > $@ ../gabriel/BENCHMARK: - cd ../gabriel; \ - if (which lisp && which clisp) > /dev/null; then make; \ - else echo "No benchmarks available" > BENCHMARK; fi + echo "No benchmarks available" > $@ license.html: $(top_srcdir)/../Copyright (cat $(srcdir)/head; \ echo '
'; cat $?; echo '
'; \ diff --git a/src/doc/devel.txi b/src/doc/devel.txi index 9dd5954f2..ab9c86b81 100644 --- a/src/doc/devel.txi +++ b/src/doc/devel.txi @@ -47,17 +47,16 @@ differs from standards. @menu * Introduction:: How @ecls{} relates to C/C++. -* Building executables:: How to build executables. +* Building programs:: How to build programs using ECLS. * Lisp objects:: Dealing with lisp object from C. * The interpreter:: Understanding the interpreter. * The compiler:: How the Lisp2C translator works. -* Examples:: Examples of mixed programming. * Porting @ecls{}:: Porting @ecls{} to other architectures. @end menu @c --------------------------------------------------------------------- -@node Introduction, Building executables, Top, Top +@node Introduction, Building programs, Top, Top @chapter Introduction @ecls{} is an implementation of the @clisp{} language that is based on a kernel @@ -81,47 +80,322 @@ programs so that they can be invoked from @ecls{}. In addition, the user can write Lisp function definitions in the C language to increase runtime efficiency. -@node Building executables, Lisp objects, Introduction, Top -@chapter Building a customized image +@c --------------------------------------------------------------------- -@ecls{} can be used to control a C library, or it can be used as an embedded -language to provide some flexibility to an already existing C program. In both -cases @ecls{} should perform equally well, as far as you follow these rules: +@node Building programs, Lisp objects, Introduction, Top +@chapter Building programs + +In this chapter we describe how you can use @ecls{} to build programs and +loadable extensions that you can later on distribute to other people. +@menu +* What can @ecls{} do?:: +* Compiling files:: +* Building standalone executables:: +* Building libraries:: +* Compiler examples:: +@end menu + +@node What can @ecls{} do?, Compiling files, Building programs, Building programs +@section What can @ecls{} do? + +Some day for some reasons you will be in the need to distribute code that +has been developed using @ecls{}. In the following sections we will describe +the means that @ecls{} offers you to do so. Basically, these are the +alternatives + +@table @sc +@item Source code +You distribute your programs in source code form. This is the easiest and most +portable way, but not the fastest one. +@item Standalone programs +You translate all your lisp code to C using the @ecls{} compiler. The final +object files can be linked against other C/C++ libraries to obtain a standalone +executable. +@item You can build statically linked libraries. +You translate all your lisp code to C and combine the resulting object files +into a single library with @file{.a} extension. You can distribute this library +to other people and the final users can utilize these libraries to build +standalone programs. +@item You can build dynamically loadable libraries. +This is the most flexible way. You translate all lisp code to C and link it +against possibly other C/C++ libraries to obtain a dynamically loadable library +(file type @file{.so} under unix). This library can be loaded a startup time to +add new functionality to the @ecls{} environment. +@end table + +In several of these options, we have mentioned the possibility to include C/C++ +code. Even if this is possible, you cannot use ordinary C/C++ compilers and +makefiles to build @ecls{} extensions, let it be programs or +libraries. Briefly, you have to organize your code as follows @enumerate @item Organize the C code as a library, let it be static or dynamic. @item Build a function, say @code{mymain()}, in which the initialization phase for your library is performed. @item Group the code that interfaces to Lisp in separate C files, all of which should include @code{#include } at the beginning. -@item Let @ecls{} build the final executable. +@item Compile your lisp source files. +@item Let @ecls{} build the final executable or library. @end enumerate +@noindent +In the final step there are ways to instruct @ecls{} to call your +initialization function (@code{mymain()} in the example above). These means +are explained in the following sections. -The final step, that is building the executable should be performed within a -working @ecls{} image. The function to build customized images is -@var{c::build-ecls}. The description of this function is as follows. +@c --------------------------------------------------------------------- -@defun {c::build-ecls} {@var{image-name} @keys{} :components :prologue-code :epilogue-code} +@node Compiling files, Building standalone executables, What can @ecls{} do?, Building programs +@section Compiling files + +@ecls{} supports two types of compilation. One is bytecodes compilation. This +process is performed on-the-fly, as you load source files with lisp code. This +leads to a series of bytes for each instruction, the so called +"bytecodes". These bytecodes are interpreted in a virtual machine, which is +written in C and which is reasonably fast. + +The other type of compilation is the so-called "native" compilation. This +process consists on translating the lisp source file to C language. The +intermediate file is later compiled using a C compiler. The result is an object +file which may have different purposes. + +@table @sc +@item dynamically loadable object files +These are produced in a @ecls{} built with support for dynamically loadable +libraries (Feature @kwd{DLOPEN} is in @var{*features*}), when no extra +arguments are passed to @code{compile-file}. These object files typically have +the @file{.so} extension, and can be loaded with @code{load}. They cannot be used +to build libraries nor standalone executable programs. + +@item linkable object files +These are produced when invoking @code{compile-file} with the keyword argument +@kwd{system-p} set to true. The object file typically has the @file{.o} +extension. It cannot be loaded with @code{load}, but it can be used to build +libraries or standalone executable programs. +@end table + +@c --------------------------------------------------------------------- + +@node Building standalone executables, Building libraries, Compiling files, Building programs +@section Building standalone executables + +To build an executable you need a working @ecls{} image with the compiler. The +function to build customized images is @var{c::build-ecls}. The description of +this function is as follows. + +@defun {c:build-ecls} {@var{image-name} @keys{} @var{lisp-files} @var{ld-flags} @var{prologue-code} @var{epilogue-code}} This function builds a lisp image up from the core lisp library, plus all -listed components. Each component is either: +components listed in @var{lisp-files}. Each component is either: @itemize -@item A symbol: Names a compiled lisp library. Currenty only @code{'CMP} is -supported, which corresponds to the lisp->C translator. -@item A string: Denotes an object file, a library, or any flag which is passed -to the compiler. +@item A symbol: Names a statically linked library built from lisp code. +@item A string: Denotes an object file built from lisp code. @end itemize +@noindent +@var{ld-flags} is a list of strings with aditional parameters to be passed +to the linker. You can include here your favorite C/C++ libraries. -In order to build the lisp image, @var{c::build-ecls} first writes down a piece -of C code which initializes the lisp environment. You can customize the -initialization process by suppling code to be executed before -(@var{prologue-code}) or after (@var{epilogue-code}) setting up the lisp -environment. Typically @var{prologue-code} defaults to an empty string, while -@var{epilogue-code} invokes the classical lisp @var{top-level}. +@var{prologue-code} and @var{epilogue-code} are used to customize the +initialization process of the lisp image. In order to build the executable, +@var{c:build-ecls} first writes down a piece of C code which initializes the +lisp environment. You can customize the initialization process by suppling code +to be executed before (@var{prologue-code}) or after (@var{epilogue-code}) +setting up the lisp environment. Typically @var{prologue-code} defaults to an +empty string, while @var{epilogue-code} invokes the classical lisp +@var{top-level}. @end defun @c --------------------------------------------------------------------- -@node Lisp objects, The interpreter, Building executables, Top +@node Building libraries, Compiler examples, Building standalone executables, Building programs +@section Building libraries + +To build a library you proceed more or less the same way as with standalone +executables. There are two different functions depending on whether you need +to build static or dynamically loadable libraries. + +@defun {c:build-static-library} {@var{library-name} @keys{} @var{lisp-files} @var{prologue-code} @var{epilogue-code}} +@defunx {c:build-shared-library} {@var{library-name} @keys{} @var{lisp-files} @var{prologue-code} @var{epilogue-code} @var{ld-flags}} + +This function builds a library file up from the object files listed in +@var{lisp-files}. Each of the arguments to @var{lisp-file} must name a single +object file produced with @code{compile-file}. + +@var{library-name} is the physical pathname corresponding to the library. The +value of @var{library-name} must follow some system-specific conventions. To +make your program portable, @var{library-name} should be built using the output +of @code{c:library-pathname}. + +@var{prologue-code} and @var{epilogue-code} are strings with C code to be +executed before and after initializing the library, respectively. For +dynamically linked libraries you can also provide a list of strings in +@var{ld-flags}. These strings are additional parameters for the linker and +their purpose is to link C/C++ extensions into the library. +@end defun + +@defun {c:static-library-pathname} {@var{filename-base}} +@defunx {c:shared-library-pathname} {@var{filename-base}} + +These function outputs a valid library pathname built using @var{filename-base} +to extract the directory and part of the file name, and using the type of +library to determine the right file type. + +The output of this function is system specific. For example, under FreeBSD +@example +> (c:static-library-pathname "/this/path/mylib") +#P"/this/path/libmylib.a" +> (c:shared-library-pathname "/this/path/mylib") +#P"/this/path/mylib.so" +@end example +@end defun + +@c --------------------------------------------------------------------- + +@node Compiler examples, , Building libraries, Building programs +@section Compiler examples + +@subsection The @file{hello.lsp} file +In the follwoing examples we will use the same lisp program. You have to +create a file called @file{hello.lsp} which contains the following lines + +@example +(princ "Hello world!") +(terpri) +(quit) +@end example +@noindent +If you start @ecls{} and load this file in the Common-Lisp environment you +will see the @code{"Hello world!"} message and the interpreter will be closed. +@example +ECLS (ECoLisp-Spain) 0.4 +Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya +Copyright (C) 1993 Giuseppe Attardi +Copyright (C) 2000 Juan J. Garcia-Ripoll + ECLS is free software, and you are welcome to redistribute it +under certain conditions; see file 'Copyright' for details. +Type :h for Help. Top level. +> @b{(load "hello.lsp")} +;;; Loading hello.lsp +Hello world! +Bye. +@end example + +@subsection Example of loadable object file +You can only perform the example in this section if your @ecls{} image supports +dynamically loading of object files. This is true if you find the keyword +@kwd{dlopen} in the @var{*features*} variable. This is true, for instance, +in a typical FreeBSD or Linux box, +@example +Type :h for Help. Top level. +> @b{*features*} +(:IEEE-FLOATING-POINT :IBM-PC :I386 :BSD :UNIX :DLOPEN :ANSI-CL :CLOS + :BOEHM-GC :ECLS :COMMON) +@end example + +In this example we build a loadable extension which prints the @code{"Hello +world!"} message. First you need to create a the @file{hello.lsp} file. Next +you have to enter the @ecls{} environment and type @code{(compile-file +"hello.lsp")}. This produces a loadable object file. + +@example +Type :h for Help. Top level. +> @b{(compile-file "hello.lsp")} +;;; Loading /home/worm/lib/ecls/cmp.so +;;; Compiling hello.lsp. +;;; End of Pass 1. +;;; Calling the C compiler... +"gcc -g -O2 -Dfreebsd -O -I/home/worm/lib/ecls//h -w -c hello.c -o hello.o" +"ld -shared -o hello.so -L/home/worm/lib/ecls/ hello.o " +;;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3 +;;; Finished compiling hello.lsp. +#P"hello.so" +> @b{(load "hello")} +;;; Loading hello.so +Hello world! +Bye. +@end example + +@subsection Example of standalone program +In this example we build a standalone program which prints the @code{"Hello +world!"} message and does nothing else. First you must create the +@file{hello.lsp} file shown above. Next you have to enter the @ecls{} +environment and type @code{(compile-file "hello.lsp" :system-p t)}. This +produces an object file that can be linked agains the @ecls{} core image. + +@example +Type :h for Help. Top level. +> @b{(compile-file "hello.lsp" :system-p t)} +;;; Loading /home/worm/lib/ecls/cmp.so +;;; Compiling hello.lsp. +;;; End of Pass 1. +;;; Calling the C compiler... +"gcc -g -O2 -Dfreebsd -O -I/home/worm/lib/ecls//h -w -c hello.c -o hello.o" +;;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3 +;;; Finished compiling hello.lsp. +#P"hello.o +@end example + +@noindent +The final step is to build the executable using the @code{c:build-ecls} +instruction. +@example +> @b{(c:build-ecls "myecls" :lisp-files '("hello.o"))} +"gcc -g -O2 -Dfreebsd -O -I/home/worm/lib/ecls//h -w -c myecls.c -o myecls.o" +"gcc -w -o myecls -L/home/worm/lib/ecls/ myecls.o hello.o -lecls -lclos -llsp -lgmp -Wl,--export-dynamic -lgc -lcompat -lgmp -lm" +"myecls" +@end example +@noindent +Now you can execute this program from your favourite shell. + +@example +worm@@arrakis.es% @b{./myecls} +Hello world! +Bye. +@end example + +@subsection Example of loadable library +You can only perform the example in this section if your @ecls{} image supports +dynamically loading of object files. In this example we build a loadable +library which prints the @code{"Hello world!"} message and does nothing +else. First you must create the @file{hello.lsp} file shown above. Next you +have to enter the @ecls{} environment and type @code{(compile-file "hello.lsp" +:system-p t)}. This produces an object file that can be linked to form a loadable +library. + +@example +Type :h for Help. Top level. +> @b{(compile-file "hello.lsp" :system-p t)} +;;; Loading /home/worm/lib/ecls/cmp.so +;;; Compiling hello.lsp. +;;; End of Pass 1. +;;; Calling the C compiler... +"gcc -g -O2 -Dfreebsd -O -I/home/worm/lib/ecls//h -w -c hello.c -o hello.o" +;;; OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3 +;;; Finished compiling hello.lsp. +#P"hello.o +@end example + +@noindent +The final step is to build the library using the @code{c:build-shared-library} +instruction. +@example +> @b{(c:build-shared-library (c:shared-library-pathname "myecls") :lisp-files '("hello.o"))} +"gcc -g -O2 -Dfreebsd -O -I/home/worm/lib/ecls//h -w -c myecls.c -o myecls.o" +"gcc -w -o myecls.so -L/home/worm/lib/ecls/ myecls.o hello.o -lecls -lclos -llsp -lgmp -Wl,--export-dynamic -lgc -lcompat -lgmp -lm" +"myecls.so" +@end example +@noindent +Now you can load this extension from any @ecls{} image, even those you produce +with @code{c:build-ecls} + +@example +> (load (c:shared-library-pathname "myecls")) +;;; Loading myecls.so +Hello world! +Bye. +@end example + +@c --------------------------------------------------------------------- + +@node Lisp objects, The interpreter, Building programs, Top @chapter Manipulating lisp objects If you want to extend, fix or simply customize @ecls{} for your own needs, @@ -783,7 +1057,7 @@ Block names: FACT. ;;; The block FACT is established. @c --------------------------------------------------------------------- -@node The compiler, Examples, The interpreter, Top +@node The compiler, Porting @ecls{}, The interpreter, Top @chapter The compiler @menu @@ -1285,40 +1559,7 @@ C-type: @c --------------------------------------------------------------------- -@node Examples, Porting @ecls{}, The compiler, Top -@chapter Examples of customization - -Let us see how this all works in practice. We will assume that @ecls{} is -installed and that it works. The first example simply gives @ecls{} another -boot message. You just have to type this at the @ecls{} prompt - -@example -(c::build-ecls "myecls" - :prologue-code "printf(\"Lisp image to be initialized...\\n\");" - :epilogue-code "printf(\"...lisp image initialized!!!\\n\"); - funcall(1,_intern(\"TPL\",system_package));") -@end example - -@noindent -With the following text you have a new image: - -@example -% ./myecls -Lisp image to be initialized... -*+*+*+ -...lisp image initialized!!! -ECLS (ECoLisp-Spain) 0.4 -Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya -Copyright (C) 1993 Giuseppe Attardi -Copyright (C) 2000 Juan J. Garcia-Ripoll - ECLS is free software, and you are welcome to redistribute it -under certain conditions; see file 'Copyright' for details. -Type :h for Help. Top level. -@end example - -@c --------------------------------------------------------------------- - -@node Porting @ecls{}, , Examples, Top +@node Porting @ecls{}, , The compiler, Top @chapter Porting @ecls{} To port @ecls{} to a new architecture, the following steps are required: diff --git a/src/doc/user.txi b/src/doc/user.txi index d25070b74..31f836581 100644 --- a/src/doc/user.txi +++ b/src/doc/user.txi @@ -64,6 +64,7 @@ interface with other languages. * CLOS:: Common-Lisp's Object System. * Multithread:: Lisp lightweight processes or threads. * Everything:: All functions/variables/etc enumerated. +* :: * Bibliography:: Some interesting books. @end menu @@ -140,64 +141,26 @@ William F. Schelter improved KCL in several areas and developed Austin Kyoto @clisp{} (AKCL). Many ideas and code from AKCL have been incorporated in @ecls{}. -The following is the full list of contributors to ECoLisp: +The following is the full list of contributors to ECoLisp: Taiichi Yuasa and +Masami Hagiya (KCL), William F. Schelter (Dynamic loader, conservative Gc), +Giuseppe Attardi (Top-level, trace, stepper, compiler, CLOS, multithread), +Marcus Daniels (Linux port) Cornelis van der Laan (FreeBSD port) David Rudloff +(NeXT port) Dan Stanger, Don Cohen, and Brian Spilsbury. +We have to thank for the following pieces of software that have helped in the +development of @ecls{} @table @sc -@item Authors: - -@table @sc -@item KCL: -Taiichi Yuasa and Masami Hagiya -@item Dynamic loader: -William F. Schelter (@email{wfs@@fireant.ma.utexas.edu}) -@item Conservative GC: -William F. Schelter -@item Top-level, trace, stepper: -Giuseppe Attardi -@item Compiler: -Giuseppe Attardi -@item CLOS: -Giuseppe Attardi with excepts from PCL by Gregor Kiczales -@item Multithread: -Giuseppe Attardi, Stefano Diomedi, Tito Flagella -@item Unification: -Giuseppe Attardi, Mauro Gaspari +@item Bruno Haible +For the Cltl2-compliance test +@item Peter Van Eynde +For the ANSI-compliance test +@item Symbolic's Inc. +For the ANSI-compliant LOOP macro. @end table -@item MSDOS EMX port: -Giuseppe Attardi -@item ndmake45.exe -Make utility by D. G. Kneller - -@item MSDOS GO32 port: -Giuseppe Attardi -@item ndmake45.exe -Make utility by D. G. Kneller - -@item Linux port: -Marcus Daniels (@email{marcus@@ee.pdx.edu}) -@item FreeBSD port: -Cornelis van der Laan (@email{nils@@ims.uni-stuttgart.de}) -@item NeXT port: -David Rudloff (@email{rudloff@@steinway.u-strasbg.fr}) - -@item Other contributors: -Dan Stanger (@email{dxs@@evolving.com}), Don Cohen -(@email{donc@@ISI.EDU}), Brian Spilsbury -(@email{brian@@bizo.biz.usyd.edu.au}) -@end table - -There is no list of contributors to @ecls{}, yet, but you are free to contact me -at the following address: - -@example - Juan Jose Garcia-Ripoll (@email{worm@@arrakis.es}) - Universidad de Castilla-La Mancha - Departamento de Matematicas, - E.T.S.I. Industriales, - Av. Camilo Jose Cela, 3 - E-13071, Ciudad Real, Spain -@end example +The @ecls{} project also owes a lot to the people who have tested this program +and contributed with suggestions and error messages: Eric Marsden, Hannu +Koivisto and Jeff Bowden, and others whose name I may have omitted. @node Copyright, Installation, Credits, Introduction @section Copyright diff --git a/src/gabriel/Makefile.in b/src/gabriel/Makefile.in index b047497bd..49bae2f77 100644 --- a/src/gabriel/Makefile.in +++ b/src/gabriel/Makefile.in @@ -2,7 +2,7 @@ top_srcdir=@top_srcdir@ srcdir=@srcdir@ FILES = CMUCLc ECLSc CLISPc CMUCLi ECLSi CLISPi -LISP ?= ../ecls -eval '(setf (logical-pathname-translations "SYS") '"'"'(("SYS:*.*" "../*.*")))' +LISP ?= ../ecls -dir `pwd`/ NAME ?= ECLSc COMPILE ?= NIL diff --git a/src/gabriel/triang-mod.cl b/src/gabriel/triang-mod.cl index c32fd45e4..ecb90aac0 100644 --- a/src/gabriel/triang-mod.cl +++ b/src/gabriel/triang-mod.cl @@ -3,6 +3,9 @@ ;;; TRIANG -- Board game benchmark. +(defvar a) +(defvar b) +(defvar c) (defvar answer) (defvar final) @@ -91,5 +94,11 @@ (try i 1))) (defun testtriang () + (declare (notinline cos aref)) + (print (cos 1.0)) (triang-setup) + (print board) + (print (aref a 22)) + (print (aref b 22)) + (print (aref c 22)) (gogogo 22)) diff --git a/src/h/config.h.in b/src/h/config.h.in index 038882d76..f4b50998e 100644 --- a/src/h/config.h.in +++ b/src/h/config.h.in @@ -38,6 +38,9 @@ /* Use Boehm's garbage collector */ #undef GBC_BOEHM +/* Allow loading dynamically linked code */ +#undef ENABLE_DLOPEN + /* Undefine this if you do not want ECLS to check for circular lists */ #define ECLS_SAFE diff --git a/src/lsp/autoload.lsp b/src/lsp/autoload.lsp index d0504ce37..6d28315ce 100644 --- a/src/lsp/autoload.lsp +++ b/src/lsp/autoload.lsp @@ -79,6 +79,10 @@ after compilation." (load "SYS:cmp") (apply 'compile args)) +(defun compile-file-pathname (&rest args) + (load "SYS:cmp") + (apply 'compile-file-pathname args)) + (defun disassemble (&rest args) "Args: (&optional (thing nil) &key (h-file nil) (data-file nil)) Compiles the form specified by THING and prints the intermediate C language diff --git a/src/util/system.lsp b/src/util/system.lsp index 3518a6d6f..de95784d6 100644 --- a/src/util/system.lsp +++ b/src/util/system.lsp @@ -83,9 +83,12 @@ :type (system-fasl-extension system) :defaults (system-fasl-directory system))) -(defun make-library-pathname (system) - (compiler::library-pathname (string-downcase (system-name system)) - :directory (system-library-directory system))) +(defun make-library-pathname (system shared) + (let* ((name (string-downcase (system-name system))) + (directory (system-library-directory system)) + (output-name (merge-pathnames name directory))) + (funcall (if shared #'c:shared-library-pathname #'c:static-library-pathname) + output-name))) ;;; ---------------------------------------------------------------------- ;;; Operations on modules @@ -210,11 +213,12 @@ (objects (mapcar #'(lambda (x) (make-binary-pathname (module-name (cadr x)) system)) (remove-if-not #'(lambda (x) (eq (car x) :LOAD)) transforms))) - (library (string-downcase (system-name system)))) + (shared (eq mode :shared-library)) + (library (make-library-pathname system shared))) (print (cons library objects)) - (compiler::make-library library objects - :output-dir (system-library-directory system) - :shared (eq mode :SHARED-LIBRARY))) + (funcall (if shared #'c::build-shared-library + #'c::build-static-library) + library :lisp-files objects)) nil) (:COMPILE (make-transformations system