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 67c3adc..327cb0a 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)
@@ -587,6 +587,9 @@ if test "x$want_threads" = xyes || test "x$want_threads" = xposix; 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
 fi
@@ -622,6 +625,10 @@ case $have_threads in
                                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
                 mutex_has_default=yes
index 8fabc5a..2eb5b48 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)
        {