diff --git a/ChangeLog b/ChangeLog index d5cc7166e9..66c29deb73 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-07-09 Derek Atkins + + * configure.in: change (and comment out) checks for pthreads + * macros/acx_pthread.m4: change pthread search (should be removed) + * src/engine/guid.c: remove pthread code and just use a static buffer. + (pthread code is kept within some #ifdef's, just in case we decide to + put it back in later). + 2003-07-09 Christian Stimming * README: Added remark about gnucash-docs. diff --git a/configure.in b/configure.in index e3c1935315..b481c718ff 100644 --- a/configure.in +++ b/configure.in @@ -73,17 +73,28 @@ AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) -# checks for pthreads -ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"]) -if test $enable_threads != "pthread"; then - AC_MSG_ERROR([unable to find pthreads, currently this is required]) -else - AC_DEFINE(HAVE_PTHREAD,1, - [Define if you have POSIX threads libraries and header files.]) - LIBS="$PTHREAD_LIBS $LIBS" - CFLAGS="$PTHREAD_CFLAGS $CFLAGS" - CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS" -fi +# # checks for the pthreads library +# have_pthread=no +# for i in pthreads lthread pthread; do +# if test "x$have_pthread" = xno; then +# AC_CHECK_LIB($i, pthread_once, [ +# PTHREAD_LIBS=-l$i +# have_pthread=yes +# ]) +# fi +# done +# +# # Hmm, maybe it's just in libc? +# if test "x$have_pthread" = xno; then +# AC_CHECK_FUNC(pthread_once, [ have_pthread=yes ]) +# fi +# +# # Do we HAVE threads?!? +# if test "x$have_pthread" = xno; then +# AC_MSG_ERROR([unable to find pthreads on your system. Sorry.]) +# fi +# +# AC_SUBST(PTHREAD_LIBS) AC_ISC_POSIX AC_C_BIGENDIAN diff --git a/macros/acx_pthread.m4 b/macros/acx_pthread.m4 index 53cffc68c3..e9e89ebf8c 100644 --- a/macros/acx_pthread.m4 +++ b/macros/acx_pthread.m4 @@ -74,7 +74,9 @@ fi # C compiler flags, and other items are library names, except for "none" # which indicates that we try without any flags at all. -acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" +#acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt" + +acx_pthread_flags="pthreads none lthread pthread" # The ordering *is* (sometimes) important. Some notes on the # individual items follow: diff --git a/src/engine/guid.c b/src/engine/guid.c index 98a662f45c..cd0ee1a2b5 100644 --- a/src/engine/guid.c +++ b/src/engine/guid.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include @@ -59,9 +58,12 @@ static gboolean guid_initialized = FALSE; static struct md5_ctx guid_context; static GMemChunk *guid_memchunk = NULL; +#if USING_THREADS /* guid_to_string uses a thread local buffer. These are used to set it up */ +#include static pthread_key_t guid_buffer_key; static pthread_once_t guid_buffer_key_once = PTHREAD_ONCE_INIT; +#endif /* This static indicates the debugging module that this .o belongs to. */ static short module = MOD_ENGINE; @@ -541,19 +543,25 @@ badstring: } /* Allocate the key */ +#if USING_THREADS static void guid_buffer_key_alloc(void) { pthread_key_create(&guid_buffer_key, NULL /* Never freed */); pthread_setspecific(guid_buffer_key, malloc(GUID_ENCODING_LENGTH+1)); } +#endif const char * guid_to_string(const GUID * guid) { +#if USING_THREADS char *string; pthread_once(&guid_buffer_key_once, guid_buffer_key_alloc); string = pthread_getspecific(guid_buffer_key); +#else + static char string[64]; +#endif encode_md5_data(guid->data, string); string[GUID_ENCODING_LENGTH] = '\0';