aboutsummaryrefslogtreecommitdiff
path: root/net/mpich2/files/patch-ab
blob: 6503718924aeec4636336fcd2641f78c583cb792 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
--- util/makesharedlib.orig	Wed Jul  1 13:56:20 1998
+++ util/makesharedlib	Sat Oct 17 07:26:06 1998
@@ -10,6 +10,9 @@
 	;;
 	-kind=*) kind=`echo A$arg | sed -e 's/A-kind=//g'`
 	;;
+	-suffix=*) slsuffix=`echo A$arg | sed -e 's/A-suffix=//g'`
+	;;
+	-echo) set -x ;;
 	*)
 	echo "Unrecognized option $arg"
 	exit 1
@@ -17,42 +20,70 @@
     esac
 done
 
+if [ "$SHELL_ECHO" = "on" ] ; then 
+    set -x 
+fi
 #
 # This is the default
-if test "$kind" = "ignore" ; then
+if [ "$kind" = "ignore" ] ; then
     exit 0
 fi
 
-if test -z "$slsuffix" ; then
+if [ -z "$slsuffix" ] ; then
     slsuffix=so.1.0
+    req_slsuffix=so
+fi
+if [ -z "$req_slsuffix" ] ; then
+    req_slsuffix=$slsuffix
 fi
-if test -z "$AR" ; then
+if [ -z "$AR" ] ; then
     AR=ar
 fi
-if test -z "$LD" ; then
+if [ -z "$LD" ] ; then
     LD=ld
 fi
-if test -z "$CLINKER" ; then
-    if test -n "$CC" ; then
+if [ -z "$CLINKER" ] ; then
+    if [ -n "$CC" ] ; then
         CLINKER=$CC
     else
 	echo "No C linker or C compiler specified!"
 	exit 1
     fi
 fi
-if test -z "$SHLIBS" ; then
+if [ -z "$SHLIBS" ] ; then
     echo "No libraries specified!"
     exit 1
 fi
+#
+# Check that there are libraries 
+foundlib=0
+for libname in $SHLIBS ; do
+   libnamelocal=`basename $libname`
+   if [ -s $libnamelocal ] ; then 
+       foundlib=1
+       break
+   fi
+done
+if [ $foundlib = 0 ] ; then
+    echo "Could not find $SHLIBS"
+    exit 1
+fi
+if [ ! -d shared ] ; then 
+    mkdir shared
+fi
 case $kind in
     gcc)
     for libname in $SHLIBS ; do
         mkdir .tmp
         cd .tmp
         $AR x ../$libname
-        $CLINKER -shared -Wl,-soname,$libname.$slsuffix \
-		-o ../$libname.$slsuffix *.o
+	libbase=`basename $libname .a`
+        $CLINKER -shared -Wl,-soname,$libbase.$slsuffix \
+		-o ../shared/$libbase.$slsuffix *.o
         cd ..
+	if [ $slsuffix != $req_slsuffix ] ; then
+	    (cd shared ; ln -s $libbase.$slsuffix $libbase.$req_slsuffix )
+        fi
         rm -rf .tmp
     done
     ;;
@@ -61,8 +92,12 @@
         mkdir .tmp
         cd .tmp
         $AR x ../$libname
-        $LD -G -h $libname.$slsuffix -o ../$libname.$slsuffix *.o
+	libbase=`basename $libname .a`
+        $LD -G -h $libbase.$slsuffix -o ../shared/$libbase.$slsuffix *.o
         cd ..
+	if [ $slsuffix != $req_slsuffix ] ; then
+	    ( cd shared ; ln -s $libbase.$slsuffix $libbase.$req_slsuffix )
+        fi
         rm -rf .tmp
     done
     ;;
@@ -73,20 +108,22 @@
         mkdir .tmp
         cd .tmp
         ar x ../$libname
+	libbase=`basename $libname .a`
         nm -g -p *.o | awk '{ if ($2 == "T") { print $1 ; }}' | \
-	    sed -e 's/^\.//g' >  $libname.exp
+	    sed -e 's/^\.//g' >  $libbase.exp
         # xlC doesn't work with this!
         # cc misses the iargc/getarg libraries
-        xlf -o ../$libname.so *.o -bE:$libname.exp -bM:SRE -bnoentry
+        xlf -o ../shared/$libbase.so *.o -bE:$libbase.exp -bM:SRE -bnoentry
         # create new shared file name
-        newfile=`basename $libname`
-        newfile="${newfile}shared.a"
+        newfile="${libbase}shared.a"
         /bin/rm -f $newfile
-        ar qv $newfile ../$libname.so
+        ar qv $newfile ../shared/$libbase.so
         /bin/rm -f *.o
         cd ..
         /bin/rm -rf .tmp
     done
+    ;;
+
     *)
     echo "Unknown shared library type $kind"
     exit 1