diff options
author | Andy Wingo <wingo@pobox.com> | 2011-03-29 13:21:44 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-03-29 13:21:44 +0200 |
commit | 8cf49d836ff41838812cba1fd61bfce3fb877144 (patch) | |
tree | 18122aecc92e42ad9baab53933216210dc770e92 | |
parent | fb6df3ea137eabad25d70219da2c84282883b433 (diff) | |
download | guile-8cf49d836ff41838812cba1fd61bfce3fb877144.tar.gz |
fix compilation with libgc 7.0, 7.1
* configure.ac: Check for GC_pthread_exit and GC_pthread_cancel.
* libguile/gen-scmconfig.c: Write HAVE_GC_PTHREAD_CANCEL and
HAVE_GC_PTHREAD_EXIT into scmconfig.h.
* libguile/pthread-threads.h (scm_i_pthread_exit, scm_i_pthread_cancel):
Only redefine to their GC_pthread_* variants if we have those
functions, which is not the case in libgc < 7.2.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libguile/gen-scmconfig.c | 12 | ||||
-rw-r--r-- | libguile/pthread-threads.h | 11 |
3 files changed, 24 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index a254634b5..e5b83798a 100644 --- a/configure.ac +++ b/configure.ac @@ -1238,7 +1238,7 @@ save_LIBS="$LIBS" LIBS="$BDW_GC_LIBS $LIBS" CFLAGS="$BDW_GC_CFLAGS $CFLAGS" -AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active]) +AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel]) # Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not # declared, and has a different type (returning void instead of diff --git a/libguile/gen-scmconfig.c b/libguile/gen-scmconfig.c index 02633563d..97066b78e 100644 --- a/libguile/gen-scmconfig.c +++ b/libguile/gen-scmconfig.c @@ -318,6 +318,18 @@ main (int argc, char *argv[]) pf ("#define SCM_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER %d /* 0 or 1 */\n", SCM_I_GSC_NEED_BRACES_ON_PTHREAD_MUTEX_INITIALIZER); +#ifdef HAVE_GC_PTHREAD_CANCEL + pf ("#define SCM_HAVE_GC_PTHREAD_CANCEL 1 /* 0 or 1 */\n"); +#else + pf ("#define SCM_HAVE_GC_PTHREAD_CANCEL 0 /* 0 or 1 */\n"); +#endif + +#ifdef HAVE_GC_PTHREAD_EXIT + pf ("#define SCM_HAVE_GC_PTHREAD_EXIT 1 /* 0 or 1 */\n"); +#else + pf ("#define SCM_HAVE_GC_PTHREAD_EXIT 0 /* 0 or 1 */\n"); +#endif + pf ("\n\n/*** File system access ***/\n"); pf ("/* Define to 1 if `struct dirent64' is available. */\n"); diff --git a/libguile/pthread-threads.h b/libguile/pthread-threads.h index c180af252..b5fff834d 100644 --- a/libguile/pthread-threads.h +++ b/libguile/pthread-threads.h @@ -38,8 +38,19 @@ #define scm_i_pthread_self pthread_self #define scm_i_pthread_create GC_pthread_create #define scm_i_pthread_detach GC_pthread_detach + +#if SCM_HAVE_GC_PTHREAD_EXIT #define scm_i_pthread_exit GC_pthread_exit +#else +#define scm_i_pthread_exit pthread_exit +#endif + +#if SCM_HAVE_GC_PTHREAD_CANCEL #define scm_i_pthread_cancel GC_pthread_cancel +#else +#define scm_i_pthread_cancel pthread_cancel +#endif + #define scm_i_pthread_cleanup_push pthread_cleanup_push #define scm_i_pthread_cleanup_pop pthread_cleanup_pop #define scm_i_sched_yield sched_yield |