summaryrefslogtreecommitdiff
path: root/hints/linux.sh
diff options
context:
space:
mode:
authorJonathan Stowe <gellyfish@gellyfish.com>2007-02-07 11:56:17 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-02-07 12:27:58 +0000
commit5d3df70f5debb91e49b4e0e6c1dec152e98e3220 (patch)
tree65fa1e9e258f3f3d448169927c8da584bf42f798 /hints/linux.sh
parent1fef4616ad97a72dc45194bd8ac11e63e518aba2 (diff)
downloadperl-5d3df70f5debb91e49b4e0e6c1dec152e98e3220.tar.gz
libdb may require pthread
Message-Id: <1170849377.13207.14.camel@coriolanus.gellyfish.com> p4raw-id: //depot/perl@30155
Diffstat (limited to 'hints/linux.sh')
-rw-r--r--hints/linux.sh43
1 files changed, 40 insertions, 3 deletions
diff --git a/hints/linux.sh b/hints/linux.sh
index 24151361ce..bd6afd29f5 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -311,9 +311,12 @@ cat > UU/usethreads.cbu <<'EOCBU'
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 @@ case "$cc" in
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