Change 30155 by [EMAIL PROTECTED] on 2007/02/07 12:27:58
Subject: [PATCH hints/linux.sh] libdb may require pthread
From: Jonathan Stowe <[email protected]>
Date: Wed, 07 Feb 2007 11:56:17 +0000
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/hints/linux.sh#63 edit
Differences ...
==== //depot/perl/hints/linux.sh#63 (text) ====
Index: perl/hints/linux.sh
--- perl/hints/linux.sh#62~28979~ 2006-10-10 04:20:19.000000000 -0700
+++ perl/hints/linux.sh 2007-02-07 04:27:58.000000000 -0800
@@ -311,9 +311,12 @@
case "$usethreads" in
$define|true|[yY]*)
ccflags="-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS $ccflags"
- set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
- shift
- libswanted="$*"
+ if echo $libswanted | grep -v pthread >/dev/null
+ then
+ set `echo X "$libswanted "| sed -e 's/ c / pthread c /'`
+ shift
+ libswanted="$*"
+ fi
# Somehow at least in Debian 2.2 these manage to escape
# the #define forest of <features.h> and <time.h> so that
@@ -372,3 +375,37 @@
d_dlerror='define'
;;
esac
+
+# Under some circumstances libdb can get built in such a way as to
+# need pthread explicitly linked.
+
+libdb_needs_pthread="N"
+
+if echo " $libswanted " | grep -v " pthread " >/dev/null
+then
+ if echo " $libswanted " | grep " db " >/dev/null
+ then
+ for DBDIR in $glibpth
+ do
+ DBLIB="$DBDIR/libdb.so"
+ if [ -f $DBLIB ]
+ then
+ if nm -u $DBLIB | grep pthread >/dev/null
+ then
+ if ldd $DBLIB | grep pthread >/dev/null
+ then
+ libdb_needs_pthread="N"
+ else
+ libdb_needs_pthread="Y"
+ fi
+ fi
+ fi
+ done
+ fi
+fi
+
+case "$libdb_needs_pthread" in
+ "Y")
+ libswanted="$libswanted pthread"
+ ;;
+esac
End of Patch.