add support for freebsd (-lc_r for thread foo) and make sure testgthread.c compiles on platforms with rand_r.

This commit is contained in:
Chris Toshok 1999-01-11 10:05:33 +00:00
parent 5eeca0d62d
commit f4a2520f38
2 changed files with 14 additions and 1 deletions

View File

@ -254,7 +254,7 @@ AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H))
AC_CHECK_HEADER(alloca.h, glib_have_alloca_h=yes, glib_have_alloca_h=no)
# Check for some functions
AC_CHECK_FUNCS(localtime_r lstat strerror strsignal memmove vsnprintf vasprintf strcasecmp strncasecmp poll)
AC_CHECK_FUNCS(localtime_r rand_r lstat strerror strsignal memmove vsnprintf vasprintf strcasecmp strncasecmp poll)
# Check for sys_errlist
AC_MSG_CHECKING(for sys_errlist)
@ -586,6 +586,9 @@ if test "x$want_threads" = xyes || test "x$want_threads" = xposix; then
if test "x$have_threads" = xnone; then
AC_CHECK_LIB(pthreads, pthread_attr_init, have_threads=posix)
fi
if test "x$have_threads" = xnone; then
AC_CHECK_LIB(c_r, pthread_attr_init, have_threads=posix)
fi
if test "x$have_threads" = xnone; then
AC_CHECK_FUNC(pthread_attr_init, have_threads=posix)
fi
@ -621,6 +624,10 @@ case $have_threads in
AC_CHECK_LIB(pthreads, pthread_attr_init,
G_THREAD_LIBS="-lpthreads")
fi
if test "x$G_THREAD_LIBS" = xerror; then
AC_CHECK_LIB(c_r, pthread_attr_init,
G_THREAD_LIBS="-lc_r")
fi
if test "x$G_THREAD_LIBS" = xerror; then
AC_CHECK_FUNC(pthread_attr_init, G_THREAD_LIBS="")
fi

View File

@ -1,3 +1,5 @@
#include "config.h"
#include <stdlib.h>
#define main testglib_main
@ -163,7 +165,11 @@ test_private_func (void *data)
wait_thread (1);
while (i < TEST_PRIVATE_ROUNDS)
{
#ifdef HAVE_RAND_R
guint random_value = rand_r (&seed) % 10000;
#else
guint random_value = rand() % 10000;
#endif
guint *data = g_static_private_get (&private_key);
if (!data)
{