1 |
#!/bin/sh |
2 |
# ********************************************************************** |
3 |
# * @(#) cernlib |
4 |
# * * |
5 |
# * Attachment of CERN Libraries for link step * |
6 |
# * * |
7 |
# * Author: M.Marquina 91/05/10 * |
8 |
# * Change history is in CVS log files and in source 1.27 ( and older) |
9 |
# ********************************************************************** |
10 |
|
11 |
SHOPT="G:Psuv:" |
12 |
#SEQ,GETOPTD. |
13 |
|
14 |
[ -z "$CERN" ] && CERN="/cern" |
15 |
[ -z "$CERN_LEVEL" ] && gver="pro" || gver="$CERN_LEVEL" |
16 |
|
17 |
_P=0 ; _p=0 ; _u=0 ; Gsys="" |
18 |
while [ $# -gt 0 ] |
19 |
do case $1 in |
20 |
-G) Gsys=$2 ; shift ;; |
21 |
-P) _P=1 ;; |
22 |
-s) _s="is an obsolete option" ;; |
23 |
-u) _u=1 ; _p=1 ;; |
24 |
-v) gver=$2 ; shift ;; |
25 |
--) shift ; break ;; |
26 |
*) break ;; |
27 |
esac |
28 |
shift |
29 |
done |
30 |
|
31 |
|
32 |
|
33 |
CERNLIB="" |
34 |
|
35 |
liblist=`echo $* | sed -e 's/,/ /g'` |
36 |
for lib in $liblist |
37 |
do |
38 |
case $lib in |
39 |
shift) continue ;; |
40 |
-*) CERNLIB="$CERNLIB $lib" ; continue ;; |
41 |
esac |
42 |
lver=$gver |
43 |
val=`echo $lib | sed -e "s?\/? ?g"` |
44 |
set - $val |
45 |
[ $# -eq 2 -a $1 != "graflib" ] && lver=$2 |
46 |
dir=$CERN/$lver/lib |
47 |
ln=$1 |
48 |
if [ $1 = "kernlib" -o $1 = "packlib" ] ; then |
49 |
_p=1 |
50 |
fi |
51 |
[ $1 = "genlib" ] && ln="mathlib.a $dir/libphtools" |
52 |
[ $1 = "bvsl" ] && ln="mathlib" |
53 |
[ $1 = "mpalib" ] && ln="mathlib" |
54 |
[ $1 = "lapack" ] && ln="lapack3.a $dir/libblas" |
55 |
[ $1 = "pawlib" ] && ln="pawlib.a $dir/liblapack3.a $dir/libblas" |
56 |
[ $1 = "pythia" ] && ln="jetset" |
57 |
if [ $1 = "GKS" -o $1 = "gks" ] ; then |
58 |
drv="X11" ; glib="$1" ; dir="$CERN/gks/$lver/lib" |
59 |
fi |
60 |
[ $1 = "naglib" ] && dir="$CERN/nag/$lver/lib" |
61 |
if [ $1 = "graflib" ] ; then |
62 |
[ -z "$Gsys" ] && Gsys="X11" |
63 |
drv="$Gsys" |
64 |
if [ $# -gt 1 ] ; then |
65 |
drv="$2" ; Gsys="$2" |
66 |
fi |
67 |
[ $# -eq 3 ] && dir="$CERN/$3/lib" |
68 |
[ $drv = "Motif" ] && drv="X11" |
69 |
ln="$ln.a $dir/libgraf$drv" |
70 |
fi |
71 |
CERNLIB="$CERNLIB $dir/lib$ln.a" |
72 |
done |
73 |
if [ -f $CERN/$gver/lib/libpacklib_noshift.a ]; then |
74 |
[ $_p -eq 0 ] && CERNLIB="$CERNLIB $CERN/$gver/lib/libpacklib_noshift.a" |
75 |
else |
76 |
[ $_p -eq 0 ] && CERNLIB="$CERNLIB $CERN/$gver/lib/libpacklib.a" |
77 |
fi; |
78 |
|
79 |
# get system name |
80 |
[ -d /NextAdmin ] && Msys="NeXT" || Msys=`uname -s` |
81 |
case $Msys in |
82 |
SunOS) [ `uname -r | awk '{ print substr($1,1,1) }'` -ge 5 ] \ |
83 |
&& Msys="SunSol" |
84 |
;; |
85 |
*) ;; |
86 |
esac |
87 |
|
88 |
|
89 |
if [ -n "$Gsys" ] ; then |
90 |
case $Msys in |
91 |
AIX) SYSGGL="-lfgl -lgl" ; |
92 |
[ -f /usr/lib/libgP.a ] && \ |
93 |
SYSGGKS="-lgksco -lgP -lX11" ; |
94 |
SYSGMOTIF="-lXm -lXt -lX11 -lPW" ;; |
95 |
ALLIANT) SYSGX11="-lX11 -lcurses -lm" ;; |
96 |
HP-UX) if [ -d /usr/lib/X11R5 -a -d /usr/lib/Motif1.2 ] ; then |
97 |
X11="/usr/lib/X11R5" |
98 |
Motif="/usr/lib/Motif1.2" |
99 |
SYSGMOTIF="-L$Motif -lXm -L$X11 -lXt -lX11 -lm -lc -lPW" |
100 |
else |
101 |
X11="/usr/lib/X11R4" |
102 |
Motif="/usr/lib/Motif1.1" |
103 |
# Xm must appear late, else you get unresolved extrernals |
104 |
SYSGMOTIF="-L$Motif -L$X11 -lXm -lXt -lX11 -lm -lc -lPW" |
105 |
fi |
106 |
SYSGX11="-L$X11 -lX11 -lm";; |
107 |
IBMAIX) SYSGX11="-lX11 -lm" ;; |
108 |
IRIX) SYSGX11="-lX11 -lbsd" ; |
109 |
SYSGGL="-lfgl -lgl_s -lm -lbsd" ; |
110 |
SYSGMOTIF="-lXm -lXt -lX11 -lPW" |
111 |
;; |
112 |
IRIX64) SYSGX11="-lX11 -lbsd" ; |
113 |
SYSGGL="-lfgl -lgl_s -lm -lbsd" ; |
114 |
SYSGMOTIF="-lXm -lXt -lX11 -lPW" |
115 |
;; |
116 |
Linux) [ -d /usr/X386/lib ] && SYSGX11="-L/usr/X386/lib -lX11" |
117 |
[ -d /usr/X11/lib ] && SYSGX11="-L/usr/X11/lib -lX11" |
118 |
[ -d /usr/X11R6/lib ] && SYSGX11="-L/usr/X11R6/lib -lX11" |
119 |
[ -d /usr/X11R6/lib ] && SYSGMOTIF="-L/usr/X11R6/lib -lXm -lXt -lXp -lXext -lX11" |
120 |
[ `uname -m` = ppc ] && SYSGMOTIF="$SYSGMOTIF -lSM -lICE -lXpm" |
121 |
;; |
122 |
NeXT) SYSGX11="/usr/lib/X11/libX11.r" ; |
123 |
SYSGMOTIF="-lXm -lXt /usr/lib/X11/libX11.r" ;; |
124 |
OSF1) SYSGX11="-lX11 -ldnet_stub" ; |
125 |
SYSGMOTIF="-lXm -lXt -lX11 -ldnet_stub -lPW -lXmu" ;; |
126 |
SunOS) [ -d /usr/motif/lib ] && Motif="-L/usr/motif/lib" || Motif=" " |
127 |
if [ -d /usr/motif12/usr/lib ] ; then |
128 |
Motif="-L/usr/motif12/usr/lib" |
129 |
# motif12 needs X11R5 from usr/local/lib |
130 |
X11="-L/usr/local/lib" |
131 |
else |
132 |
X11="" |
133 |
fi |
134 |
SYSGMOTIF="$Motif -lXm $X11 -lXt -lX11" |
135 |
[ -f /usr/lib/libgks77.a ] && \ |
136 |
SYSGGKS="-lgks77 -lgks -lsuntool -lsunwindow -lpixrect -lm" ;; |
137 |
SunSol) [ -d /usr/motif/lib ] && Motif="-L/usr/motif/lib" || Motif=" " |
138 |
[ -d /usr/motif12/usr/lib ] && Motif="-L/usr/motif12/usr/lib" |
139 |
[ -d /usr/dt/lib ] && \ |
140 |
Motif="-L/usr/dt/lib -R/usr/dt/lib -Bdynamic" |
141 |
[ -d /usr/openwin/lib ] && X11="-L/usr/openwin/lib" || X11="" |
142 |
SYSGX11="$X11 -Bdynamic -lX11" |
143 |
SYSGMOTIF="$Motif -lXm $X11 -Bdynamic -lXt -lX11" |
144 |
[ -f /usr/lib/libgks77.a ] && \ |
145 |
SYSGGKS="-lgks77 -lgks -lsuntool -lsunwindow -lpixrect -lm" |
146 |
;; |
147 |
ULTRIX) [ -f /usr/lib/libGKS3D.a ] && \ |
148 |
SYSGGKS="-lGKS3Dforbnd -lGKS3D -lddif -ldwt -lc -lX11 -lcursesX -lm" ;; |
149 |
DomainOS) SYSGX11="" ; |
150 |
SYSGMOTIF="-L/usr/lib/X11 -lXm -lXt -lX11 -lm" ;; |
151 |
esac |
152 |
|
153 |
[ -z "$SYSGX11" ] && SYSGX11="-lX11" |
154 |
case $Gsys in |
155 |
X11) CERNLIB="$CERNLIB $SYSGX11" ;; |
156 |
Motif) [ -z "$SYSGMOTIF" ] && SYSGMOTIF="-lXm -lXt $SYSGX11" ; |
157 |
CERNLIB="$CERNLIB $SYSGMOTIF" ;; |
158 |
GPHIGS) [ -z "$SYSGPHIGS" ] && \ |
159 |
SYSGPHIGS="-L$CERN/phigs/$gver/lib -lgphigsf2c -lgphigsc" ; |
160 |
CERNLIB="$CERNLIB $SYSGPHIGS" ;; |
161 |
GKS) [ -z "$SYSGGKS" ] && \ |
162 |
SYSGGKS="-L$CERN/gks/$gver/lib -lGKS -lGKSdriv $SYSGX11" ; |
163 |
CERNLIB="$CERNLIB $SYSGGKS" ;; |
164 |
GL) CERNLIB="$CERNLIB $SYSGGL" ;; |
165 |
GPR) CERNLIB="$CERNLIB $SYSGGPR" ;; |
166 |
--) break ;; |
167 |
*) break ;; |
168 |
esac |
169 |
fi |
170 |
|
171 |
if [ $_u -eq 0 ] ; then |
172 |
# SGI needs -lsun, to see yellow pages |
173 |
# As of 5.x, the yp version is in libc, so -lsun is no longer needed. |
174 |
# GF. 18-7-96 |
175 |
# [ -f /usr/lib/libsun.a -o -f /usr/lib/libsun.so ] \ |
176 |
# && CERNLIB="$CERNLIB -lsun" |
177 |
[ -f /usr/lib/libulsock.a -o -f /usr/lib/libulsock.so ] \ |
178 |
&& CERNLIB="$CERNLIB -lulsock" |
179 |
# Solaris, many things won't link without -lsocket -lnsl |
180 |
if [ "$Msys" = "SunSol" ] ; then |
181 |
[ -f /usr/lib/libw.so -o -f /usr/lib/libw.a ] \ |
182 |
&& CERNLIB="$CERNLIB -lw" |
183 |
[ -f /usr/ccs/lib/libgen.so -o -f /usr/ccs/lib/libgen.a ] \ |
184 |
&& CERNLIB="$CERNLIB -lgen" |
185 |
[ -f /usr/lib/libsocket.so -o -f /usr/lib/libsocket.a ] \ |
186 |
&& CERNLIB="$CERNLIB -lsocket" |
187 |
[ -f /usr/lib/libnsl.so -o -f /usr/lib/libnsl.a ] \ |
188 |
&& CERNLIB="$CERNLIB -lnsl" |
189 |
[ -f /usr/lib/libintl.so -o -f /usr/lib/libintl.a ] \ |
190 |
&& CERNLIB="$CERNLIB -lintl" |
191 |
echo $CERNLIB | grep pawlib >/dev/null && \ |
192 |
CERNLIB="$CERNLIB -ldl" |
193 |
|
194 |
fi |
195 |
if [ "$Msys" = "HP-UX" ] ; then |
196 |
if [ -f /usr/lib/libU77.a -o -f /usr/lib/libU77.sl ] ; then |
197 |
CERNLIB="$CERNLIB -lU77" |
198 |
elif [ -f /opt/fortran/lib/libU77.a ] ; then |
199 |
CERNLIB="$CERNLIB /opt/fortran/lib/libU77.a" |
200 |
elif [ -f /opt/fortran/lib/libU77.sl ] ; then |
201 |
CERNLIB="$CERNLIB /opt/fortran/lib/libU77.sl" |
202 |
fi |
203 |
|
204 |
echo $CERNLIB | grep pawlib >/dev/null && \ |
205 |
CERNLIB="$CERNLIB /usr/lib/libdld.sl" |
206 |
echo $CERNLIB | grep packlib >/dev/null && \ |
207 |
[ -f /lib/pa1.1/libm.a ] && CERNLIB="$CERNLIB /lib/pa1.1/libm.a" |
208 |
fi |
209 |
if [ "$Msys" = "AIX" ] ; then |
210 |
echo $CERNLIB | grep pawlib >/dev/null && CERNLIB="$CERNLIB -lld" |
211 |
fi |
212 |
if [ "$Msys" = "Linux" ] ; then |
213 |
if [ -f $CERN/$gver/lib/libpacklib_noshift.a ]||[ -f $CERN/$gver/lib/libpacklib-shift.a ]; then |
214 |
CERNLIB="$CERNLIB -lnsl -lcrypt -ldl" |
215 |
else |
216 |
CERNLIB="$CERNLIB -lshift -lnsl -lcrypt -ldl" |
217 |
fi; |
218 |
fi |
219 |
fi |
220 |
|
221 |
|
222 |
echo $CERNLIB ; export CERNLIB |