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

Last change on this file since 2720 was 2720, checked in by ansari, 20 years ago

Creation nouveau module de gestion de code BuildMgr (Reza 17 Mai 2005)

  • Property svn:executable set to *
File size: 8.3 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
7# liste des modules
8set SOPMOD = ( BaseTools SysTools SUtils TArray NTools HiStats SkyMap Samba SkyT )
9set SOPEXT = ( FitsIOServer IFFTW LinAlg XAstroPack )
10set SOPPI = ( PI PIext PIGcont )
11
12set SOPEXTOK = ( 1 1 1 1 )
13set EXTINCNAME = ( FitsIO/fitsio.h FFTW/fftw.h PASDEINC XAstro/astro.h )
14set EXTLIBNAME = ( libcfitsio.a libfftw.a liblapack.a libxastro.a )
15set ALLEXTLIBS = ( -lcfitsio '-lfftw -lrfftw' '-llapack -lblas' -lxastro )
16
17set defextinc = ( ~ /usr/include /usr/local/include )
18set defextlib = ( ~ /usr/lib /usr/local/lib )
19
20set cmdline = "$0 $*"
21# Decodage arguments
22set extpath
23unset incln
24unset mincname
25while ( $#argv > 0 )
26
27if( "$1" == "-h" ) then
28 echo 'configure [-sbase SOPHYABASE] [-scxx SOPHYACXX] [-incln] '
29 echo ' [-extp dir1 -extp dir2 ...] [-minc mymake.inc]'
30 exit -1
31endif
32if( "$1" == "-sbase" ) then
33 setenv SOPHYABASE $2
34 shift
35endif
36if( "$1" == "-scxx" ) then
37 setenv SOPHYACXX $2
38 shift
39endif
40if( "$1" == "-incln" ) then
41 set incln
42endif
43if( "$1" == "-extp" ) then
44 set extpath = ( $extpath $2 )
45 shift
46endif
47if( "$1" == "-minc" ) then
48 set mincname = ( $2 )
49 shift
50endif
51
52shift
53end
54
55# Verification generale
56if( ! $?SOPHYABASE ) then
57 echo ERROR: define SOPHYABASE or use script arguments
58 exit -2
59endif
60if( ! $?SOPHYACXX ) then
61 echo ERROR: define SOPHYACXX or use script arguments
62 echo " SOPHYACXX define the name of the C++ compiler (ex: g++ cxx ...)"
63 exit -2
64endif
65if( ! $?TMPDIR ) setenv TMPDIR /tmp
66touch $TMPDIR/tmp_test
67if( $status != 0 ) then
68 echo ERROR: no write acces in temporary directory: $TMPDIR
69 echo '----> define TMPDIR environment variable: "setenv TMPDIR ..."'
70 exit -2
71endif
72if( ! $?mincname ) then
73 set mincname = `uname`_${SOPHYACXX}_make.inc
74endif
75if( ! -e $mincname ) then
76 echo ERROR: file $mincname NOT found
77 exit -2
78endif
79if( ! -e ../BaseTools/machdefs_mkmf.h ) then
80 echo ERROR: file machdefs_mkmf.h NOT found in BaseTools
81 exit -2
82endif
83
84# creation des variables chemins sophya core
85echo " "
86echo ">>>>>> 1/ Creating directory tree under $SOPHYABASE "
87set sinc = $SOPHYABASE/include
88set slib = $SOPHYABASE/lib
89set sslb = $SOPHYABASE/slb
90set sobj = $SOPHYABASE/obj
91set sexe = $SOPHYABASE/exe
92set sconf = $sinc/SophyaConfInfo
93foreach d ( $sinc $slib $sslb $sobj $sexe $sconf )
94 if( ! -d $d ) then
95 mkdir $d
96 if( $status ) then
97 echo ERROR: creation of $d failed
98 exit -3
99 endif
100 echo Directory $d created
101 endif
102 touch $d/tmp_test
103 if( $status ) then
104 echo ERROR: no write acces to $d
105 exit -4
106 endif
107 rm -f $d/tmp_test
108end
109
110# Fichier confinfo - log e configure
111set conflog = $sconf/conf.log
112rm -f $conflog ; touch $conflog
113echo ' --- Log of SOPHYA configure script - Date= ' `date` >> $conflog
114echo "$cmdline" >> $conflog
115set inclistf = $sconf/include.list
116rm -f $inclistf ; touch $inclistf
117
118# liens ou copie des *.h
119echo " "
120echo ">>>>>> 2/ Copying include files to $sinc "
121pushd ../ > /dev/null
122set srcd = `pwd`
123foreach d ( $SOPMOD $SOPEXT $SOPPI )
124 if ( -d $d ) then
125 echo Copying include files for module $d
126 pushd $d > /dev/null
127###CMV a faire: virer le .H de $file si .h dans excludeinc du module
128 set file = ( *.h )
129 if( $?incln ) then
130 pushd $sinc > /dev/null
131####CMV-Reza Ne pas faire ??? rm -f $file
132 ln -s -f $srcd/$d/*.h ./
133 popd > /dev/null
134 else
135####CMV-Reza pushd $sinc > /dev/null
136####CMV-Reza Ne pas faire ??? rm -f $file
137####CMV-Reza popd > /dev/null
138 cp -p $file $sinc/.
139 endif
140 echo $file >> $inclistf
141 popd > /dev/null
142 endif
143end
144popd > /dev/null
145
146
147# lien des .h des librairies externes
148echo " "
149echo ">>>>>> 3/ Include files for external libraries "
150set i = 0
151while ( $i < $#SOPEXT )
152 @ i += 1
153 if( "$EXTINCNAME[$i]" == "PASDEINC" ) continue
154 if( $SOPEXTOK[$i] <= 0 ) continue
155 set nom = $EXTINCNAME[$i]:t
156 set rac = $EXTINCNAME[$i]:h
157 if( -d ../$SOPEXT[$i] ) then
158 echo "Searching include file for $SOPEXT[$i] ..."
159 foreach d ( $extpath $defextinc )
160 set duminc = `find $d -name $nom -print | head -1 `
161 set dumrep = $duminc:h
162 if ( "$dumrep" != "" ) then
163 rm -f $sinc/$rac
164 ln -f -s $dumrep $sinc/$rac
165 echo Includes for $SOPEXT[$i] found in $dumrep
166 break
167 endif
168 end
169 if ( "$dumrep" == "" ) then
170 echo WARNING: Includes for $SOPEXT[$i] NOT found
171 echo " Compilation of module $SOPEXT[$i] disabled"
172 set SOPEXTOK[$i] = 0
173 endif
174 endif
175end
176
177# liens des librairies externes
178echo " "
179echo ">>>>>> 4/ External libraries "
180set fpath = $TMPDIR/fpath
181rm -f $fpath; touch $fpath
182set extliblib
183set i = 0
184while ( $i < $#SOPEXT )
185 @ i += 1
186 if( "$EXTLIBNAME[$i]" == "PASDELIB" ) continue
187 if( $SOPEXTOK[$i] <= 0 ) continue
188 set nom = $EXTLIBNAME[$i]
189 if( -d ../$SOPEXT[$i] ) then
190 echo "Searching libraries path for $SOPEXT[$i] ..."
191 foreach d ( $extpath $defextlib )
192 set dumlib = `find $d -name $nom -print | head -1 `
193 if ( "$dumlib" != "" ) then
194 echo "-L$dumlib:h" >> $fpath
195 set extliblib = ( $extliblib $ALLEXTLIBS[$i] )
196 break
197 endif
198 end
199 if ( "$dumlib" == "" ) then
200 echo WARNING: Libraries for $SOPEXT[$i] NOT found
201 echo " Check the generated make.inc file"
202 endif
203 endif
204end
205set extlibpath = `cat $fpath | sort -u`
206echo extlibpath= $extlibpath
207echo extliblib= $extliblib
208
209# Generation de sophyamake.inc
210# On le cree dans le repertoire temporarire d'abord
211set mfile = $sinc/sophyamake.inc
212echo " "
213echo ">>>>>> 5/ Creating $mfile "
214echo "# -----------------------------------------------" > $mfile
215echo "# File make.inc - generated by SOPHYA configure" >> $mfile
216echo "# Date" `date` >> $mfile
217echo "# Seed file : $mincname " >> $mfile
218echo "# -----------------------------------------------" >> $mfile
219echo " " >> $mfile
220echo "# SOPHYA Base installation directory " >> $mfile
221echo "SOPHYABASE = $SOPHYABASE" >> $mfile
222echo " " >> $mfile
223echo 'SOPHYAINCP = $(SOPHYABASE)/include/' >> $mfile
224echo 'SOPHYAOBJP = $(SOPHYABASE)/obj/' >> $mfile
225echo 'SOPHYALIBP = $(SOPHYABASE)/lib/' >> $mfile
226echo 'SOPHYASLBP = $(SOPHYABASE)/slb/' >> $mfile
227echo 'SOPHYAEXEP = $(SOPHYABASE)/exe/' >> $mfile
228
229echo " " >> $mfile
230echo "# External libraries PATH " >> $mfile
231echo "SOPEXTLIBP = $extlibpath" >> $mfile
232echo "SOPEXTLIBLIST = $extliblib" >> $mfile
233
234echo " " >> $mfile
235cat $mincname >> $mfile
236
237ln -s $mfile $mfile:t
238
239# Copie de machdefs.h
240set mdefname = $TMPDIR/machdefs.h
241echo " "
242echo ">>>>>> 6/ Creating machdefs.h from BaseTools/machdefs_mkmf.h"
243rm -f $mdefname; touch $mdefname
244echo "/*** machdefs.h generated by SOPHYA configure ***/" >> $mdefname
245echo "#ifndef MACHDEFS_SEEN" >> $mdefname
246echo "#define MACHDEFS_SEEN" >> $mdefname
247echo "/*------ Code generation switch ---- */" >> $mdefname
248echo "/* System selector (uname) */" >> $mdefname
249set sname = `uname`
250echo "#ifndef $sname" >> $mdefname
251echo "#define $sname 1 " >> $mdefname
252echo "#endif" >> $mdefname
253echo "/* #define SO_BOUNDCHECKING 1 */" >> $mdefname
254echo " " >> $mdefname
255
256grep -v MACHDEFS_SEEN ../BaseTools/machdefs_mkmf.h >> $mdefname
257# On ne copie que si machdefs.h est different
258if (-e $sinc/machdefs.h ) then
259 diff $mdefname $sinc/machdefs.h >& /dev/null
260 if ($status != 0) then
261 cp -f -p $mdefname $sinc/machdefs.h
262 echo " file $sinc/machdefs.h changed -> replaced"
263 else
264 echo " file $sinc/machdefs.h has not changed -> kept"
265 endif
266else
267 cp -f -p $mdefname $sinc/machdefs.h
268 echo " file $sinc/machdefs.h created"
269endif
270
271
272echo " "
273echo ">>>>>> 7/ Creating object list files for shared library creation "
274set objlistname = $sconf/libsophya.objlist
275echo " 7.a/ Creating $objlistname "
276rm -rf $objlistname ; touch $objlistname
277foreach d ( $SOPMOD )
278 if ( -d ../$d ) then
279 cat ../$d/objlist.list >> $objlistname
280 endif
281end
282
283set objlistname = $sconf/libextsophya.objlist
284echo " 7.b/ Creating $objlistname "
285rm -rf $objlistname ; touch $objlistname
286foreach d ( $SOPEXT )
287 if ( -d ../$d ) then
288 cat ../$d/objlist.list >> $objlistname
289 endif
290end
291
292set objlistname = $sconf/libPI.objlist
293echo " 7.c/ Creating $objlistname "
294rm -rf $objlistname ; touch $objlistname
295foreach d ($SOPPI )
296 if ( -d ../$d ) then
297 cat ../$d/objlist.list >> $objlistname
298 endif
299end
Note: See TracBrowser for help on using the repository browser.