guile-devel
[Top][All Lists]
Advanced

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

Re: pthread versus freebsd


From: Kevin Ryde
Subject: Re: pthread versus freebsd
Date: Sat, 20 Mar 2004 08:15:20 +1000
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Well, I've got doubts about the way gcc -pthread should be setup, so
I've added the entry below to the TODO file, and left it at that.

FreeBSD doesn't spring into life with just this change anyway, so
it'll all have to wait.

--- TODO.~1.106.~       2003-11-15 06:45:14.000000000 +1000
+++ TODO        2004-03-20 08:15:03.000000000 +1000
@@ -90,6 +90,42 @@
 
 
 - Eventually
+  - Select pthreads compile with "gcc -pthread" when available, with
+    something like the block below in configure.in.
+
+    This is almost certainly the right way to get pthreads, but
+    consideration needs to be given to application compiles.  Will an
+    application need to compile and/or link with the same "gcc
+    -pthread"?  On systems like FreeBSD where -pthread changes the
+    libc used then very likely yes.  Emitting such an option from the
+    guile-config script would, however, make that script compiler
+    dependent, which would be undesirable.
+
+      # "gcc -pthread" is supposedly the way to get the right defines and
+      # libraries on pretty much all systems where it makes sense (though the
+      # gcc 3.3 manual only seems to describe it for a couple of targets).
+      #
+      # On FreeBSD, gcc -pthread is vital, there's no -lpthread on that system,
+      # instead -pthread option selects the special libc_r C library.
+      #
+      # Forcibly adding -pthread to user-selected CFLAGS is a bit rude, user
+      # stuff ought to be left alone.  But adding ensures we get what we need,
+      # and it's actually quite convenient if the user is just setting
+      # optimization options or whatever.
+      #
+      if test $GCC = yes; then
+        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 that didn't work then try just -lpthread.
+      #
+      if test "$SCM_I_GSC_USE_PTHREAD_THREADS" != 1; then
+        ...
 
   - pretty-print #:width can lower the allowed width, but cannot
     increase it, max-expr-width (50) appears to be a hard limit.

reply via email to

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