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