cvsuser 03/11/19 07:37:19
Modified: config/init/hints freebsd.pl
Log:
Fix pthread Configure on FreeBSD as discussed in issue #24333
Courtesy of "Lars Balker Rasmussen" <[EMAIL PROTECTED]>
and "Nick Kostirya" <[EMAIL PROTECTED]>
Revision Changes Path
1.2 +23 -2 parrot/config/init/hints/freebsd.pl
Index: freebsd.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/freebsd.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- freebsd.pl 10 Oct 2003 07:43:05 -0000 1.1
+++ freebsd.pl 19 Nov 2003 15:37:18 -0000 1.2
@@ -1,7 +1,28 @@
my $libs = Configure::Data->get('libs');
-if ( $libs !~ /-lpthreads/ ) {
- $libs .= ' -lpthreads';
+
+# get rid of old pthread-stuff, if any
+$libs =~ s/(-lpthreads|-lc_r)\b\s*//g;
+
+# The following test is from FreeBSD's /usr/ports/Mk/bsd.port.mk,
+# which must be assumed to do the right thing.
+
+my $osversion;
+if (-e "/sbin/sysctl") {
+ $osversion = `/sbin/sysctl -n kern.osreldate`;
}
+else {
+ $osversion = `/usr/sbin/sysctl -n kern.osreldate`;
+}
+chomp $osversion;
+
+if ($osversion < 500016) {
+ $libs .= ' -pthread';
+}
+else {
+ $libs =~ s/-lc\b\s*//;
+ $libs .= ' -lc_r';
+}
+
Configure::Data->set(
libs => $libs,
);