From f2ab7ade00853b5da62ad3973ed008a7ce376f5c Mon Sep 17 00:00:00 2001 From: jgarcia Date: Wed, 26 Apr 2006 10:02:15 +0000 Subject: [PATCH] ECL now builds against third-party versions of the Boehm-Weiser garbage collector --- src/CHANGELOG | 5 + src/c/alloc_2.d | 28 ++--- src/configure | 317 +++++++++++++++++++++++++++++++++++++++++++++-- src/configure.in | 39 +++--- src/h/page.h | 1 - 5 files changed, 348 insertions(+), 42 deletions(-) diff --git a/src/CHANGELOG b/src/CHANGELOG index 870886b0f..57808e82e 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -103,6 +103,11 @@ ECL 0.9i - SOCKET-MAKE-STREAM now takes an argument :BUFFERING-MODE with the same effect as SI::SET-BUFFERING-MODE's argument. + - ECL can be built against locally installed copies of the Boehm-Weiser + garbage collector, as far as they are recent. This has been checked with + OpenBSD & Ubuntu. You may need to supply appropiate LDFLAGS & CFLAGS for the + configuration to detect the headers. + * MOP compatibility: - SLOT-VALUE, SLOT-BOUNDP, etc, together with MOP SLOT*-USING-CLASS generic diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d index cf7e7ba15..abd97d2e9 100644 --- a/src/c/alloc_2.d +++ b/src/c/alloc_2.d @@ -18,9 +18,6 @@ #include #include #include -#include -#include -#include #ifdef GBC_BOEHM @@ -63,6 +60,7 @@ finalize(GC_PTR _o, GC_PTR _data) if (o->stream.file != NULL) fclose(o->stream.file); o->stream.file = NULL; + o->stream.buffer = NULL; break; #ifdef ECL_THREADS case t_lock: @@ -268,16 +266,16 @@ ecl_mark_env(struct cl_env_struct *env) { #if 1 if (env->stack) { - GC_push_conditional((ptr_t)env->stack, (ptr_t)env->stack_top, 1); - GC_set_mark_bit((ptr_t)env->stack); + GC_push_conditional((GC_PTR)env->stack, (GC_PTR)env->stack_top, 1); + GC_set_mark_bit((GC_PTR)env->stack); } if (env->frs_top) { - GC_push_conditional((ptr_t)env->frs_org, (ptr_t)(env->frs_top+1), 1); - GC_set_mark_bit((ptr_t)env->frs_org); + GC_push_conditional((GC_PTR)env->frs_org, (GC_PTR)(env->frs_top+1), 1); + GC_set_mark_bit((GC_PTR)env->frs_org); } if (env->bds_top) { - GC_push_conditional((ptr_t)env->bds_org, (ptr_t)(env->bds_top+1), 1); - GC_set_mark_bit((ptr_t)env->bds_org); + GC_push_conditional((GC_PTR)env->bds_org, (GC_PTR)(env->bds_top+1), 1); + GC_set_mark_bit((GC_PTR)env->bds_org); } #endif #if 0 @@ -297,7 +295,7 @@ ecl_mark_env(struct cl_env_struct *env) GC_set_mark_bit((void *)env); #else /* When not using threads, "env" is a statically allocated structure. */ - GC_push_all((ptr_t)env, (ptr_t)(env + 1)); + GC_push_all((GC_PTR)env, (GC_PTR)(env + 1)); #endif #endif } @@ -312,14 +310,14 @@ stacks_scanner() for (i = 0; i < l->vector.fillp; i++) { cl_object dll = l->vector.self.t[i]; if (dll->cblock.locked) { - GC_push_conditional((ptr_t)dll, (ptr_t)(&dll->cblock + 1), 1); - GC_set_mark_bit((ptr_t)dll); + GC_push_conditional((GC_PTR)dll, (GC_PTR)(&dll->cblock + 1), 1); + GC_set_mark_bit((GC_PTR)dll); } } - GC_set_mark_bit((ptr_t)l->vector.self.t); + GC_set_mark_bit((GC_PTR)l->vector.self.t); } - GC_push_all((ptr_t)(&cl_core), (ptr_t)(&cl_core + 1)); - GC_push_all((ptr_t)cl_symbols, (ptr_t)(cl_symbols + cl_num_symbols_in_core)); + GC_push_all((GC_PTR)(&cl_core), (GC_PTR)(&cl_core + 1)); + GC_push_all((GC_PTR)cl_symbols, (GC_PTR)(cl_symbols + cl_num_symbols_in_core)); #ifdef ECL_THREADS l = cl_core.processes; if (l == OBJNULL) { diff --git a/src/configure b/src/configure index 47d4febd4..4189c91d2 100755 --- a/src/configure +++ b/src/configure @@ -9814,27 +9814,322 @@ LSP_FEATURES="(cons :wants-rt ${LSP_FEATURES})" fi -if test ${enable_boehm} = "included"; then - { echo "$as_me:$LINENO: Configuring included Boehm GC library:" >&5 +case "${enable_boehm}" in + included) + { echo "$as_me:$LINENO: Configuring included Boehm GC library:" >&5 echo "$as_me: Configuring included Boehm GC library:" >&6;} - test -d gc && rm -rf gc - if mkdir gc; then + test -d gc && rm -rf gc + if mkdir gc; then (destdir=`${PWDCMD}`; cd gc; \ CC="${CC} ${PICFLAG}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \ $srcdir/gc/configure --disable-shared --prefix=${destdir} \ --includedir=${destdir}/ecl/gc/ --libdir=${destdir} --build=${build_alias} \ --host=${host_alias} ${boehm_configure_flags}) - ECL_BOEHM_GC_HEADER='ecl/gc/gc.h' + ECL_BOEHM_GC_HEADER='ecl/gc/gc.h' + else + { { echo "$as_me:$LINENO: error: Unable to create 'gc' directory" >&5 +echo "$as_me: error: Unable to create 'gc' directory" >&2;} + { (exit 1); exit 1; }; } + fi + ;; + system) + if test "${ac_cv_header_gc_h+set}" = set; then + echo "$as_me:$LINENO: checking for gc.h" >&5 +echo $ECHO_N "checking for gc.h... $ECHO_C" >&6 +if test "${ac_cv_header_gc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_gc_h" >&5 +echo "${ECHO_T}$ac_cv_header_gc_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking gc.h usability" >&5 +echo $ECHO_N "checking gc.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking gc.h presence" >&5 +echo $ECHO_N "checking gc.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else - if test -f /usr/include/gc/gc.h -o test -f /usr/local/include/gc/gc.h; then - ECL_BOEHM_GC_HEADER='gc/gc.h' - else - ECL_BOEHM_GC_HEADER='gc.h' - fi + ac_cpp_err= fi else - ECL_BOEHM_GC_HEADER='none' + ac_cpp_err=yes fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: gc.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: gc.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: gc.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: gc.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: gc.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: gc.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: gc.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: gc.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: gc.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: gc.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: gc.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: gc.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: gc.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: gc.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: gc.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: gc.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------ ## +## Report this to the ecl lists. ## +## ------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for gc.h" >&5 +echo $ECHO_N "checking for gc.h... $ECHO_C" >&6 +if test "${ac_cv_header_gc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_gc_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_gc_h" >&5 +echo "${ECHO_T}$ac_cv_header_gc_h" >&6 + +fi +if test $ac_cv_header_gc_h = yes; then + ECL_BOEHM_GC_HEADER='gc.h' +fi + + + if test -z "$ECL_BOEHM_GC_HEADER"; then + if test "${ac_cv_header_gc_gc_h+set}" = set; then + echo "$as_me:$LINENO: checking for gc/gc.h" >&5 +echo $ECHO_N "checking for gc/gc.h... $ECHO_C" >&6 +if test "${ac_cv_header_gc_gc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_gc_gc_h" >&5 +echo "${ECHO_T}$ac_cv_header_gc_gc_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking gc/gc.h usability" >&5 +echo $ECHO_N "checking gc/gc.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking gc/gc.h presence" >&5 +echo $ECHO_N "checking gc/gc.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: gc/gc.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: gc/gc.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: gc/gc.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: gc/gc.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: gc/gc.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: gc/gc.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: gc/gc.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: gc/gc.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: gc/gc.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: gc/gc.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: gc/gc.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------ ## +## Report this to the ecl lists. ## +## ------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for gc/gc.h" >&5 +echo $ECHO_N "checking for gc/gc.h... $ECHO_C" >&6 +if test "${ac_cv_header_gc_gc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_gc_gc_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_gc_gc_h" >&5 +echo "${ECHO_T}$ac_cv_header_gc_gc_h" >&6 + +fi +if test $ac_cv_header_gc_gc_h = yes; then + ECL_BOEHM_GC_HEADER='gc/gc.h' +fi + + + fi + if test -z "$ECL_BOEHM_GC_HEADER"; then + { { echo "$as_me:$LINENO: error: Boehm-Weiser garbage collector's headers not found" >&5 +echo "$as_me: error: Boehm-Weiser garbage collector's headers not found" >&2;} + { (exit 1); exit 1; }; } + fi + ;; + no) + ECL_BOEHM_GC_HEADER='none';; + *) + { { echo "$as_me:$LINENO: error: Not a valid argument for --enable-boehm $enable_boehm" >&5 +echo "$as_me: error: Not a valid argument for --enable-boehm $enable_boehm" >&2;} + { (exit 1); exit 1; }; };; +esac if test "${with_gmp}" = "no" ; then diff --git a/src/configure.in b/src/configure.in index 3ed34ca31..f2b2d1a2c 100644 --- a/src/configure.in +++ b/src/configure.in @@ -459,26 +459,35 @@ fi dnl ---------------------------------------------------------------------- dnl Configure included Boehm GC if needed AC_SUBST(ECL_BOEHM_GC_HEADER) -if test ${enable_boehm} = "included"; then - AC_MSG_NOTICE([Configuring included Boehm GC library:]) - test -d gc && rm -rf gc - if mkdir gc; then +case "${enable_boehm}" in + included) + AC_MSG_NOTICE([Configuring included Boehm GC library:]) + test -d gc && rm -rf gc + if mkdir gc; then (destdir=`${PWDCMD}`; cd gc; \ CC="${CC} ${PICFLAG}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \ $srcdir/gc/configure --disable-shared --prefix=${destdir} \ --includedir=${destdir}/ecl/gc/ --libdir=${destdir} --build=${build_alias} \ --host=${host_alias} ${boehm_configure_flags}) - ECL_BOEHM_GC_HEADER='ecl/gc/gc.h' - else - if test -f /usr/include/gc/gc.h -o test -f /usr/local/include/gc/gc.h; then - ECL_BOEHM_GC_HEADER='gc/gc.h' - else - ECL_BOEHM_GC_HEADER='gc.h' - fi - fi -else - ECL_BOEHM_GC_HEADER='none' -fi + ECL_BOEHM_GC_HEADER='ecl/gc/gc.h' + else + AC_MSG_ERROR([Unable to create 'gc' directory]) + fi + ;; + system) + AC_CHECK_HEADER([gc.h],[ECL_BOEHM_GC_HEADER='gc.h'],[],[]) + if test -z "$ECL_BOEHM_GC_HEADER"; then + AC_CHECK_HEADER([gc/gc.h],[ECL_BOEHM_GC_HEADER='gc/gc.h'],[],[]) + fi + if test -z "$ECL_BOEHM_GC_HEADER"; then + AC_MSG_ERROR([Boehm-Weiser garbage collector's headers not found]) + fi + ;; + no) + ECL_BOEHM_GC_HEADER='none';; + *) + AC_MSG_ERROR([Not a valid argument for --enable-boehm $enable_boehm]);; +esac dnl ---------------------------------------------------------------------- dnl Configure local GMP if needed diff --git a/src/h/page.h b/src/h/page.h index 013f473a4..38ecf860a 100644 --- a/src/h/page.h +++ b/src/h/page.h @@ -24,7 +24,6 @@ extern "C" { #ifdef ECL_THREADS #define GC_THREADS #endif -#include "gc.h" extern struct typemanager { const char *tm_name;