Lars Balker Rasmussen (via RT) <[EMAIL PROTECTED]> writes:

> The pthreads library seems to be missing on the FreeBSD 4.8 and 5.0
> machines I have access to.  I don't know what, if any, FreeBSD'en
> should happen to have that library...
> 
> There are two ways to link in the pthreads-stuff on FreeBSD - I have
> taken the method from the ports systems makefile to decide between them.

I have another patch from Nick Kostirya <[EMAIL PROTECTED]> which
accidently dropped off-list. He tries to solve the same issue (and
uses a similar approach). But he changed ccflags. Can someone of the
FreeBSD guys enlighten me which of these two patches is the better
one? I can apply only one.

bye
bö
Index: config/init/hints/freebsd.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/freebsd.pl,v
retrieving revision 1.1
diff -u -r1.1 freebsd.pl
--- config/init/hints/freebsd.pl	10 Oct 2003 07:43:05 -0000	1.1
+++ config/init/hints/freebsd.pl	28 Oct 2003 14:19:41 -0000
@@ -1,7 +1,31 @@
+# 500016 is the first osreldate in which one could
+# just link against libc_r without disposing of libc
+# at the same time.  500016 ... up to whatever it was
+# on the 31st of August 2003 can still be used with -pthread,
+# but it is not necessary.
+my $osreldate = `/sbin/sysctl -n kern.osreldate`;
+
 my $libs = Configure::Data->get('libs');
-if ( $libs !~ /-lpthreads/ ) {
-    $libs .= ' -lpthreads';
+	
+if ($osreldate >= 500016) {
+	# use KSE (libpthread)
+	# See http://www.freebsd.org/kse/
+	if ( $libs !~ /-lpthreads/ ) {
+		$libs .= ' -lpthreads';
+	}
+} else {
+	# use libc_r 
+	$libs =~ s/-lpthreads//;
+	
+	my $ccflags = Configure::Data->get('ccflags');
+	if ( $ccflags !~ /-pthread/ ) {
+ 	   $ccflags .= ' -pthread';
+	}
+	Configure::Data->set(
+    	ccflags => $ccflags,
+	)
 }
+
 Configure::Data->set(
     libs => $libs,
 );

Reply via email to