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

Last change on this file since 3180 was 3180, checked in by cmv, 19 years ago

modifs suite a la suppression de CodeMinuit et MinuitAdapt cmv 07/02/2007

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