mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 18:52:09 +01:00
Add checks for -lpthread, stolen from Gtk+ configure.in.
Define G_THREAD_SAFE in glibconfig.h if thread support is present.
This commit is contained in:
parent
11376df686
commit
c4261064d6
23
configure.in
23
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([
|
||||
|
@ -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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user