add support for freebsd (-lc_r for thread foo) and make sure testgthread.c compiles...
authorChris Toshok <toshok@src.gnome.org>
Mon, 11 Jan 1999 10:05:33 +0000 (10:05 +0000)
committerChris Toshok <toshok@src.gnome.org>
Mon, 11 Jan 1999 10:05:33 +0000 (10:05 +0000)
configure.in
gthread/testgthread.c

index 67c3adccf0a7af670c14f8cbe87bb1bc5bd66835..327cb0a9ca1cba20a45fce3092d097f515a06d94 100644 (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
index 8fabc5adda6e7819e4640d7ba92454b7de16cbc3..2eb5b4861d3c57c029071127f3a7662167d0d130 100644 (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)
        {