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
Line 
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
7#----------------------------------------------------------------------
8#### liste des modules
9set SOPMODOK = ( 1 1 1 1 1 1 1 1 1 )
10set SOPMOD = ( BaseTools SysTools SUtils TArray NTools HiStats SkyMap Samba SkyT )
11set ALLSOPLIBS = ( '-lBaseTools' '-lSysTools' '-lSUtils' '-lTArray' '-lNTools' '-lHiStats' '-lSkyMap' '-lSamba' '-lSkyT' )
12
13set SOPPIOK = ( 1 1 1 )
14set SOPPI = ( PI PIext PIGcont )
15set ALLPILIBS = ( '-lPI' '-lPIext' '-lPIGcont' )
16
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' )
23
24set defextinc = ( ~ /usr/include /usr/local/include )
25set defextlib = ( ~ /usr/lib /usr/local/lib )
26
27
28#----------------------------------------------------------------------
29#### Decodage arguments
30set cmdline = "$0 $*"
31set extpath
32set extpathinc
33set extpathlib
34unset incln
35unset mincname
36while ( $#argv > 0 )
37
38if( "$1" == "-h" ) then
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 ... ]'
41 echo ' [-noextlib -noext fits -noext fftw -noext lapack -noext astro -noext minuit]'
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
55if( "$1" == "-minc" ) then
56 set mincname = ( $2 )
57 shift
58endif
59if( "$1" == "-extp" ) then
60 set extpath = ( $extpath $2 )
61 shift
62endif
63if( "$1" == "-extip" ) then
64 set extpathinc = ( $extpathinc $2 )
65 shift
66endif
67if( "$1" == "-extlp" ) then
68 set extpathlib = ( $extpathlib $2 )
69 shift
70endif
71if( "$1" == "-noextlib" ) then
72 set i = 0
73 while ( $i < $#SOPEXTOK )
74 @ i += 1
75 set SOPEXTOK[$i] = 0
76 end
77endif
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
86
87shift
88end
89
90
91#----------------------------------------------------------------------
92#### Verification generale
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
109rm -f $TMPDIR/tmp_test
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
121echo SOPEXTOK: $SOPEXTOK
122
123#----------------------------------------------------------------------
124#### creation des variables chemins sophya core
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
150
151#----------------------------------------------------------------------
152#### Fichier confinfo - log e configure
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
160
161#----------------------------------------------------------------------
162#### liens ou copie des *.h
163echo " "
164echo ">>>>>> 2/ Copying include files to $sinc "
165cd ../ > /dev/null
166set srcd = `pwd`
167set cpln = "cp -p "
168if( $?incln ) set cpln = "ln -s -f "
169foreach d ( $SOPMOD $SOPEXT $SOPPI )
170 if ( -d $srcd/$d ) then
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
177 cd $srcd/$d;
178 set file = ( *.h )
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 )
186 grep -q "$f:r\.h" excludeinc
187 if( $status != 0 ) set file = ( $file $f )
188 end
189 endif
190 endif
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
197 echo $file >> $inclistf
198 endif
199end
200cd $srcd/BuildMgr/.
201
202
203#----------------------------------------------------------------------
204#### lien des .h des librairies externes
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] ..."
216 foreach d ( $extpathinc $extpath $defextinc )
217 set duminc = `find $d -name $nom -print -follow | head -1 `
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
234
235#----------------------------------------------------------------------
236#### liens des librairies externes
237echo " "
238echo ">>>>>> 4.1/ External libraries "
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] ..."
250 foreach d ( $extpathlib $extpath $defextlib )
251 set dumlib = `find $d -name $nom -print -follow | head -1 `
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
267rm -f $fpath
268
269
270#----------------------------------------------------------------------
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#----------------------------------------------------------------------
303#### Generation de sophyamake.inc
304# On le cree dans le repertoire temporaire d'abord
305set mfile = $sinc/sophyamake.inc
306rm -f $mfile
307echo " "
308echo ">>>>>> 5/ Creating $mfile from $mincname "
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
325echo "# module libraries " >> $mfile
326echo "SOPMODLIBLIST = $sopmodlib" >> $mfile
327
328echo " " >> $mfile
329echo "# External libraries PATH " >> $mfile
330echo "SOPEXTLIBP = $extlibpath" >> $mfile
331echo "SOPEXTLIBLIST = $extliblib" >> $mfile
332
333echo " " >> $mfile
334echo "# PI libraries " >> $mfile
335echo "SOPPILIBLIST = $soppilib" >> $mfile
336
337echo " " >> $mfile
338cat $mincname >> $mfile
339
340rm -f $mfile:t
341ln -s $mfile $mfile:t
342
343
344#----------------------------------------------------------------------
345#### Copie de machdefs.h
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
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
368
369echo " " >> $mdefname
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
377
378echo " " >> $mdefname
379grep -v -e '#ifndef *MACHDEFS_SEEN' -e '#define *MACHDEFS_SEEN' ../BaseTools/machdefs_mkmf.h >> $mdefname
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
393rm -f $mdefname
394
395
396#----------------------------------------------------------------------
397#### Creation des fichiers contenant les listes d'objets et d'includes
398echo " "
399echo ">>>>>> 7/ Creating object list files for shared library creation "
400set objlistname = $sconf/libsophya.objlist
401echo " 7.a/ Creating $objlistname "
402rm -f $objlistname ; touch $objlistname
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
408end
409
410set objlistname = $sconf/libextsophya.objlist
411echo " 7.b/ Creating $objlistname "
412rm -f $objlistname ; touch $objlistname
413set i = 0
414while ( $i < $#SOPEXT )
415 @ i += 1
416 set d = $SOPEXT[$i]
417 rm -f $sconf/$d.conf
418 if( $SOPEXTOK[$i] <= 0 ) continue
419 if ( ! -d ../$d ) continue
420 cat ../$d/objlist.list >> $objlistname
421 touch $sconf/$d.conf
422end
423
424set objlistname = $sconf/libPI.objlist
425echo " 7.c/ Creating $objlistname "
426rm -f $objlistname ; touch $objlistname
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
432end
433
434
435#----------------------------------------------------------------------
436exit 0
Note: See TracBrowser for help on using the repository browser.