From c4261064d634d10fb94e9fd97a9febd8931e1ad2 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Wed, 11 Nov 1998 22:39:32 +0000 Subject: [PATCH] Add checks for -lpthread, stolen from Gtk+ configure.in. Define G_THREAD_SAFE in glibconfig.h if thread support is present. --- configure.in | 23 +++++++++++++++++++++++ gmodule/gmoduleconf.h.win32 | 6 ++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index f8c28ad34..1fbf28299 100644 --- a/configure.in +++ b/configure.in @@ -62,6 +62,7 @@ AC_ARG_ENABLE(mem_profile, [ --enable-mem-profile=[no/yes] turn on malloc profi AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]], , enable_ansi=no) +AC_ARG_WITH(threads, [ --with-threads=[posix] support threading [default=no]]) AC_MSG_CHECKING(whether to enable memory checking) if test "x$enable_mem_check" = "xyes"; then @@ -92,6 +93,19 @@ fi AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}") +glib_use_threads=no +if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then + AC_CHECK_LIB(pthread, pthread_attr_init, + glib_use_threads=yes + CFLAGS="$CFLAGS -D_REENTRANT", + # AIX has libpthreads, cause they're special. Special friends (TM) + AC_CHECK_LIB(pthreads, pthread_attr_init, + glib_use_threads=yes + CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE")) +fi +AC_MSG_CHECKING(whether to enable POSIX thread support) +AC_MSG_RESULT($glib_use_threads) + # Checks for programs. AC_PROG_CC AM_PROG_CC_STDC @@ -610,6 +624,7 @@ outfile_EOF $glib_atexit $glib_memmove $glib_defines +$glib_threads $glib_vacopy @@ -828,6 +843,14 @@ if test x$glib_working_wctype = xno; then glib_wc="\$glib_wc #define G_HAVE_BROKEN_WCTYPE 1" fi +if test x$glib_use_threads = xyes; then + glib_threads=' +#define G_THREAD_SAFE 1' +else + glib_threads=' +#undef G_THREAD_SAFE' +fi + ]) AC_OUTPUT([ diff --git a/gmodule/gmoduleconf.h.win32 b/gmodule/gmoduleconf.h.win32 index fba7be6df..9d4fcf9f7 100644 --- a/gmodule/gmoduleconf.h.win32 +++ b/gmodule/gmoduleconf.h.win32 @@ -29,12 +29,14 @@ extern "C" { #define G_MODULE_IMPL_DL 1 #define G_MODULE_IMPL_DLD 2 #define G_MODULE_IMPL_WIN32 3 -#define G_MODULE_IMPL_OS2 4 -#define G_MODULE_IMPL_BEOS 5 #define G_MODULE_IMPL G_MODULE_IMPL_WIN32 #undef G_MODULE_HAVE_DLERROR +#ifdef __LCC__ +#define G_MODULE_NEED_USCORE +#endif + #ifdef __cplusplus } #endif /* __cplusplus */