source: Sophya/trunk/SophyaLib/BuildMgr/configure@ 2912

Last change on this file since 2912 was 2910, checked in by cmv, 20 years ago

Variables pour tenir compte des lib archive Sophya+PI cmv 17/01/2006

  • Property svn:executable set to *
File size: 12.4 KB
RevLine 
[2720]1#!/bin/csh
2# SOPHYA configuration managment script
3# C. Magneville / R. Ansari - Mai 2005
4# Exemple: ./configure -sbase /laltmp/ansari/sbase/ -scxx cxx -extp /exp/planck/ExtLibs/Include/ \
5# -extp /exp/planck/ExtLibs/OSF1-cxx/
6
[2724]7#----------------------------------------------------------------------
8#### liste des modules
[2910]9set SOPMODOK = ( 1 1 1 1 1 1 1 1 1 )
[2720]10set SOPMOD = ( BaseTools SysTools SUtils TArray NTools HiStats SkyMap Samba SkyT )
[2910]11set ALLSOPLIBS = ( '-lBaseTools' '-lSysTools' '-lSUtils' '-lTArray' '-lNTools' '-lHiStats' '-lSkyMap' '-lSamba' '-lSkyT' )
12
13set SOPPIOK = ( 1 1 1 )
[2720]14set SOPPI = ( PI PIext PIGcont )
[2910]15set ALLPILIBS = ( '-lPI' '-lPIext' '-lPIGcont' )
[2720]16
[2724]17set SOPEXT = ( FitsIOServer IFFTW LinAlg XAstroPack MinuitAdapt )
18set EXTCURNAME = ( fits fftw lapack astro minuit )
19set SOPEXTOK = ( 1 1 1 1 1 )
20set EXTINCNAME = ( FitsIO/fitsio.h FFTW/fftw.h PASDEINC XAstro/astro.h Cern/minuit.h )
21set EXTLIBNAME = ( libcfitsio.a libfftw.a liblapack.a libxastro.a libminuit.a )
22set ALLEXTLIBS = ( '-lcfitsio' '-lfftw -lrfftw' '-llapack -lblas' '-lxastro' '-lminuit' )
[2720]23
24set defextinc = ( ~ /usr/include /usr/local/include )
25set defextlib = ( ~ /usr/lib /usr/local/lib )
26
[2724]27
28#----------------------------------------------------------------------
29#### Decodage arguments
[2720]30set cmdline = "$0 $*"
31set extpath
[2724]32set extpathinc
33set extpathlib
[2720]34unset incln
35unset mincname
36while ( $#argv > 0 )
37
38if( "$1" == "-h" ) then
[2724]39 echo 'configure [-sbase SOPHYABASE] [-scxx SOPHYACXX] [-incln] [-minc mymake.inc] '
40 echo ' [-extp dir1 -extp dir2 ...] [-extip dir1 -extip dir2 ... ] [-extlp dir1 -extlp dir2 ... ]'
[2739]41 echo ' [-noextlib -noext fits -noext fftw -noext lapack -noext astro -noext minuit]'
[2720]42 exit -1
43endif
44if( "$1" == "-sbase" ) then
45 setenv SOPHYABASE $2
46 shift
47endif
48if( "$1" == "-scxx" ) then
49 setenv SOPHYACXX $2
50 shift
51endif
52if( "$1" == "-incln" ) then
53 set incln
54endif
[2724]55if( "$1" == "-minc" ) then
56 set mincname = ( $2 )
57 shift
58endif
[2720]59if( "$1" == "-extp" ) then
60 set extpath = ( $extpath $2 )
61 shift
62endif
[2724]63if( "$1" == "-extip" ) then
64 set extpathinc = ( $extpathinc $2 )
[2720]65 shift
66endif
[2724]67if( "$1" == "-extlp" ) then
68 set extpathlib = ( $extpathlib $2 )
69 shift
70endif
[2739]71if( "$1" == "-noextlib" ) then
72 set i = 0
73 while ( $i < $#SOPEXTOK )
74 @ i += 1
75 set SOPEXTOK[$i] = 0
76 end
77endif
[2724]78if( "$1" == "-noext" ) then
79 set i = 0
80 while ( $i < $#EXTCURNAME )
81 @ i += 1
82 if( "$2" == "$EXTCURNAME[$i]" ) set SOPEXTOK[$i] = 0
83 end
84 shift
85endif
[2720]86
87shift
88end
89
[2724]90
91#----------------------------------------------------------------------
92#### Verification generale
[2720]93if( ! $?SOPHYABASE ) then
94 echo ERROR: define SOPHYABASE or use script arguments
95 exit -2
96endif
97if( ! $?SOPHYACXX ) then
98 echo ERROR: define SOPHYACXX or use script arguments
99 echo " SOPHYACXX define the name of the C++ compiler (ex: g++ cxx ...)"
100 exit -2
101endif
102if( ! $?TMPDIR ) setenv TMPDIR /tmp
103touch $TMPDIR/tmp_test
104if( $status != 0 ) then
105 echo ERROR: no write acces in temporary directory: $TMPDIR
106 echo '----> define TMPDIR environment variable: "setenv TMPDIR ..."'
107 exit -2
108endif
[2724]109rm -f $TMPDIR/tmp_test
[2720]110if( ! $?mincname ) then
111 set mincname = `uname`_${SOPHYACXX}_make.inc
112endif
113if( ! -e $mincname ) then
114 echo ERROR: file $mincname NOT found
115 exit -2
116endif
117if( ! -e ../BaseTools/machdefs_mkmf.h ) then
118 echo ERROR: file machdefs_mkmf.h NOT found in BaseTools
119 exit -2
120endif
[2724]121echo SOPEXTOK: $SOPEXTOK
[2720]122
[2724]123#----------------------------------------------------------------------
124#### creation des variables chemins sophya core
[2720]125echo " "
126echo ">>>>>> 1/ Creating directory tree under $SOPHYABASE "
127set sinc = $SOPHYABASE/include
128set slib = $SOPHYABASE/lib
129set sslb = $SOPHYABASE/slb
130set sobj = $SOPHYABASE/obj
131set sexe = $SOPHYABASE/exe
132set sconf = $sinc/SophyaConfInfo
133foreach d ( $sinc $slib $sslb $sobj $sexe $sconf )
134 if( ! -d $d ) then
135 mkdir $d
136 if( $status ) then
137 echo ERROR: creation of $d failed
138 exit -3
139 endif
140 echo Directory $d created
141 endif
142 touch $d/tmp_test
143 if( $status ) then
144 echo ERROR: no write acces to $d
145 exit -4
146 endif
147 rm -f $d/tmp_test
148end
149
[2724]150
151#----------------------------------------------------------------------
152#### Fichier confinfo - log e configure
[2720]153set conflog = $sconf/conf.log
154rm -f $conflog ; touch $conflog
155echo ' --- Log of SOPHYA configure script - Date= ' `date` >> $conflog
156echo "$cmdline" >> $conflog
157set inclistf = $sconf/include.list
158rm -f $inclistf ; touch $inclistf
159
[2724]160
161#----------------------------------------------------------------------
162#### liens ou copie des *.h
[2720]163echo " "
164echo ">>>>>> 2/ Copying include files to $sinc "
[2724]165cd ../ > /dev/null
[2720]166set srcd = `pwd`
[2724]167set cpln = "cp -p "
168if( $?incln ) set cpln = "ln -s -f "
[2720]169foreach d ( $SOPMOD $SOPEXT $SOPPI )
[2724]170 if ( -d $srcd/$d ) then
[2726]171 if ( $?incln ) then
172 echo Creating link to include files for module $d
173 else
174 echo Copying include files for module $d
175 endif
176
[2724]177 cd $srcd/$d;
[2720]178 set file = ( *.h )
[2724]179 cd $sinc; if( $status == 0 ) rm -f $file
180 # on vire le .h de $file si .h dans excludeinc du module
181 cd $srcd/$d
182 if( -e excludeinc ) then
183 if( `cat excludeinc | wc -l` > 0 ) then
184 set file
185 foreach f ( *.h )
[2739]186 grep -q "$f:r\.h" excludeinc
[2724]187 if( $status != 0 ) set file = ( $file $f )
188 end
189 endif
[2720]190 endif
[2724]191 # on copie ou link dans $sinc
192 if( `echo $file | wc -w` > 0 ) then
193 foreach f ( $file )
194 $cpln $srcd/$d/$f $sinc/$f
195 end
196 endif
[2720]197 echo $file >> $inclistf
198 endif
199end
[2724]200cd $srcd/BuildMgr/.
[2720]201
202
[2724]203#----------------------------------------------------------------------
204#### lien des .h des librairies externes
[2720]205echo " "
206echo ">>>>>> 3/ Include files for external libraries "
207set i = 0
208while ( $i < $#SOPEXT )
209 @ i += 1
210 if( "$EXTINCNAME[$i]" == "PASDEINC" ) continue
211 if( $SOPEXTOK[$i] <= 0 ) continue
212 set nom = $EXTINCNAME[$i]:t
213 set rac = $EXTINCNAME[$i]:h
214 if( -d ../$SOPEXT[$i] ) then
215 echo "Searching include file for $SOPEXT[$i] ..."
[2724]216 foreach d ( $extpathinc $extpath $defextinc )
[2772]217 set duminc = `find $d -name $nom -print -follow | head -1 `
[2720]218 set dumrep = $duminc:h
219 if ( "$dumrep" != "" ) then
220 rm -f $sinc/$rac
221 ln -f -s $dumrep $sinc/$rac
222 echo Includes for $SOPEXT[$i] found in $dumrep
223 break
224 endif
225 end
226 if ( "$dumrep" == "" ) then
227 echo WARNING: Includes for $SOPEXT[$i] NOT found
228 echo " Compilation of module $SOPEXT[$i] disabled"
229 set SOPEXTOK[$i] = 0
230 endif
231 endif
232end
233
[2724]234
235#----------------------------------------------------------------------
236#### liens des librairies externes
[2720]237echo " "
[2910]238echo ">>>>>> 4.1/ External libraries "
[2720]239set fpath = $TMPDIR/fpath
240rm -f $fpath; touch $fpath
241set extliblib
242set i = 0
243while ( $i < $#SOPEXT )
244 @ i += 1
245 if( "$EXTLIBNAME[$i]" == "PASDELIB" ) continue
246 if( $SOPEXTOK[$i] <= 0 ) continue
247 set nom = $EXTLIBNAME[$i]
248 if( -d ../$SOPEXT[$i] ) then
249 echo "Searching libraries path for $SOPEXT[$i] ..."
[2724]250 foreach d ( $extpathlib $extpath $defextlib )
[2772]251 set dumlib = `find $d -name $nom -print -follow | head -1 `
[2720]252 if ( "$dumlib" != "" ) then
253 echo "-L$dumlib:h" >> $fpath
254 set extliblib = ( $extliblib $ALLEXTLIBS[$i] )
255 break
256 endif
257 end
258 if ( "$dumlib" == "" ) then
259 echo WARNING: Libraries for $SOPEXT[$i] NOT found
260 echo " Check the generated make.inc file"
261 endif
262 endif
263end
264set extlibpath = `cat $fpath | sort -u`
265echo extlibpath= $extlibpath
266echo extliblib= $extliblib
[2724]267rm -f $fpath
[2720]268
[2724]269
270#----------------------------------------------------------------------
[2910]271#### Identification des librairies archives Sophya
272echo " "
273echo ">>>>>> 4.2/ Sophya libraries archives "
274set sopmodlib
275set i = 0
276while ( $i < $#SOPMOD )
277 @ i += 1
278 if( $SOPMODOK[$i] <= 0 ) continue
279 if( -d ../$SOPMOD[$i] ) then
280 set sopmodlib = ( $sopmodlib $ALLSOPLIBS[$i] )
281 else
282 echo "WARNING: module "$SOPMOD[$i]" not found"
283 endif
284end
285echo sopmodlib= $sopmodlib
286
287echo " "
288echo ">>>>>> 4.3/ PI-Sophya libraries archives "
289set soppilib
290set i = 0
291while ( $i < $#SOPPI )
292 @ i += 1
293 if( $SOPPIOK[$i] <= 0 ) continue
294 if( -d ../$SOPPI[$i] ) then
295 set soppilib = ( $soppilib $ALLPILIBS[$i] )
296 else
297 echo "WARNING: module "$SOPPI[$i]" not found"
298 endif
299end
300echo soppilib= $soppilib
301
302#----------------------------------------------------------------------
[2724]303#### Generation de sophyamake.inc
304# On le cree dans le repertoire temporaire d'abord
[2720]305set mfile = $sinc/sophyamake.inc
[2724]306rm -f $mfile
[2720]307echo " "
[2724]308echo ">>>>>> 5/ Creating $mfile from $mincname "
[2720]309echo "# -----------------------------------------------" > $mfile
310echo "# File make.inc - generated by SOPHYA configure" >> $mfile
311echo "# Date" `date` >> $mfile
312echo "# Seed file : $mincname " >> $mfile
313echo "# -----------------------------------------------" >> $mfile
314echo " " >> $mfile
315echo "# SOPHYA Base installation directory " >> $mfile
316echo "SOPHYABASE = $SOPHYABASE" >> $mfile
317echo " " >> $mfile
318echo 'SOPHYAINCP = $(SOPHYABASE)/include/' >> $mfile
319echo 'SOPHYAOBJP = $(SOPHYABASE)/obj/' >> $mfile
320echo 'SOPHYALIBP = $(SOPHYABASE)/lib/' >> $mfile
321echo 'SOPHYASLBP = $(SOPHYABASE)/slb/' >> $mfile
322echo 'SOPHYAEXEP = $(SOPHYABASE)/exe/' >> $mfile
323
324echo " " >> $mfile
[2910]325echo "# module libraries " >> $mfile
326echo "SOPMODLIBLIST = $sopmodlib" >> $mfile
327
328echo " " >> $mfile
[2720]329echo "# External libraries PATH " >> $mfile
330echo "SOPEXTLIBP = $extlibpath" >> $mfile
331echo "SOPEXTLIBLIST = $extliblib" >> $mfile
332
333echo " " >> $mfile
[2910]334echo "# PI libraries " >> $mfile
335echo "SOPPILIBLIST = $soppilib" >> $mfile
336
337echo " " >> $mfile
[2720]338cat $mincname >> $mfile
339
[2724]340rm -f $mfile:t
[2720]341ln -s $mfile $mfile:t
342
[2724]343
344#----------------------------------------------------------------------
345#### Copie de machdefs.h
[2720]346set mdefname = $TMPDIR/machdefs.h
347echo " "
348echo ">>>>>> 6/ Creating machdefs.h from BaseTools/machdefs_mkmf.h"
349rm -f $mdefname; touch $mdefname
350echo "/*** machdefs.h generated by SOPHYA configure ***/" >> $mdefname
351echo "#ifndef MACHDEFS_SEEN" >> $mdefname
352echo "#define MACHDEFS_SEEN" >> $mdefname
353echo "/*------ Code generation switch ---- */" >> $mdefname
354echo "/* System selector (uname) */" >> $mdefname
355set sname = `uname`
356echo "#ifndef $sname" >> $mdefname
357echo "#define $sname 1 " >> $mdefname
358echo "#endif" >> $mdefname
359echo "/* #define SO_BOUNDCHECKING 1 */" >> $mdefname
[2772]360if ( "$sname" == "IRIX64" ) then
361# SGI_ARCH64 : compile avec -64 (en 64 bits)
362 echo "#define SGI_ARCH64 1 /* Compile avec -64 */" >> $mdefname
363 if ( "$SOPHYACXX" == "CC" ) then
364# __SGICC__ : flag indiquant que c'est le compilo CC de SGI
365 echo "#define __SGICC__ 1" >> $mdefname
366 endif
367endif
[2724]368
[2720]369echo " " >> $mdefname
[2724]370echo "/*------ External libraries no-use flag ---- */" >> $mdefname
371set i = 0
372while ( $i < $#SOPEXTOK )
373 @ i += 1
374 if( $SOPEXTOK[$i] > 0 ) continue
375 echo "#define SOPHYA_NO_$SOPEXT[$i]" >> $mdefname
376end
[2720]377
[2724]378echo " " >> $mdefname
379grep -v -e '#ifndef *MACHDEFS_SEEN' -e '#define *MACHDEFS_SEEN' ../BaseTools/machdefs_mkmf.h >> $mdefname
[2720]380# On ne copie que si machdefs.h est different
381if (-e $sinc/machdefs.h ) then
382 diff $mdefname $sinc/machdefs.h >& /dev/null
383 if ($status != 0) then
384 cp -f -p $mdefname $sinc/machdefs.h
385 echo " file $sinc/machdefs.h changed -> replaced"
386 else
387 echo " file $sinc/machdefs.h has not changed -> kept"
388 endif
389else
390 cp -f -p $mdefname $sinc/machdefs.h
391 echo " file $sinc/machdefs.h created"
392endif
[2724]393rm -f $mdefname
[2720]394
395
[2724]396#----------------------------------------------------------------------
397#### Creation des fichiers contenant les listes d'objets et d'includes
[2720]398echo " "
399echo ">>>>>> 7/ Creating object list files for shared library creation "
400set objlistname = $sconf/libsophya.objlist
401echo " 7.a/ Creating $objlistname "
[2724]402rm -f $objlistname ; touch $objlistname
[2751]403foreach d ( $SOPMOD )
404 rm -f $sconf/$d.conf
405 if ( ! -d ../$d ) continue
406 cat ../$d/objlist.list >> $objlistname
407 touch $sconf/$d.conf
[2720]408end
409
410set objlistname = $sconf/libextsophya.objlist
411echo " 7.b/ Creating $objlistname "
[2724]412rm -f $objlistname ; touch $objlistname
[2739]413set i = 0
414while ( $i < $#SOPEXT )
415 @ i += 1
[2751]416 set d = $SOPEXT[$i]
417 rm -f $sconf/$d.conf
[2739]418 if( $SOPEXTOK[$i] <= 0 ) continue
419 if ( ! -d ../$d ) continue
420 cat ../$d/objlist.list >> $objlistname
[2751]421 touch $sconf/$d.conf
[2739]422end
[2720]423
424set objlistname = $sconf/libPI.objlist
425echo " 7.c/ Creating $objlistname "
[2724]426rm -f $objlistname ; touch $objlistname
[2751]427foreach d ( $SOPPI )
428 rm -f $sconf/$d.conf
429 if ( ! -d ../$d ) continue
430 cat ../$d/objlist.list >> $objlistname
431 touch $sconf/$d.conf
[2720]432end
[2724]433
434
435#----------------------------------------------------------------------
436exit 0
Note: See TracBrowser for help on using the repository browser.