guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pthread versus freebsd


From: Kevin Ryde
Subject: pthread versus freebsd
Date: Mon, 16 Feb 2004 10:37:10 +1000
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

The guile configury for pthreads doesn't work on freebsd, you have to
use "gcc -pthread" there, not -lpthread.  I'm looking at something
like the following, to hav that option used if it works.

Not quite sure if munging CFLAGS is the right thing to do.  Maybe CC
would be better, or maybe AM_CFLAGS.

--- configure.in.~1.230.~       2004-02-10 09:37:56.000000000 +1000
+++ configure.in        2004-02-16 10:32:42.000000000 +1000
@@ -914,12 +914,30 @@
 
 case "$with_threads" in
   "yes" | "pthread" | "pthreads" | "pthread-threads" | "")
+
+    # Note that gcc -pthread is vital on FreeBSD, there's no -lpthread
+    # normally used there, the threading stuff is in a special libc_r
+    # selected by gcc -pthread.
+    #
+    if test $GCC = yes; then
+      # try gcc -pthread
+      old_CFLAGS=$CFLAGS
+      CFLAGS="-pthread $CFLAGS"
+      AC_TRY_LINK([#include <pthread.h>], [pthread_yield();],
+        [SCM_I_GSC_USE_PTHREAD_THREADS=1
+         with_threads="pthreads"],
+        [CFLAGS=$old_CFLAGS])
+    fi
+
+    if test "$SCM_I_GSC_USE_PTHREAD_THREADS" != 1; then
+    # otherwise try just -lpthread
     AC_CHECK_LIB(pthread, main,
       LIBS="-lpthread $LIBS"
       SCM_I_GSC_USE_PTHREAD_THREADS=1
       with_threads="pthreads",
       with_threads="null")
-      
+    fi
+
     if test $GCC = yes; then
     AC_DEFINE(_THREAD_SAFE, 1,
       [Use thread safe versions of GNU Libc functions.])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]