(file) Return to configure CVS log (file) (dir) Up to [Development] / JSOC

  1 arta  1.1 #! /bin/csh -f
  2           
  3 arta  1.78 # The system configuration for configure script
  4 arta  1.64 set PERLBIN = ""
  5 arta  1.73 set PYBIN = ""
  6 arta  1.64 
  7            if ($PERLBIN == "") then
  8 arta  1.74     if (-x /home/jsoc/bin/linux_x86_64/activeperl) then
  9 arta  1.70         set PERLBIN = "/home/jsoc/bin/linux_x86_64/activeperl"
 10 arta  1.74     else
 11                    set PERLBIN = "perl"
 12                endif
 13            endif
 14            
 15            if ($PYBIN == "") then
 16                if (-x /home/jsoc/bin/linux_x86_64/activepython) then
 17 arta  1.73         set PYBIN = "/home/jsoc/bin/linux_x86_64/activepython"
 18 arta  1.64     else
 19 arta  1.73         set PYBIN = "python"
 20 arta  1.64     endif
 21            endif
 22            
 23 arta  1.26 # set up $JSOC_MACHINE
 24            set JSOC_MACHINE = `build/jsoc_machine.csh`
 25            echo "Machine type is $JSOC_MACHINE"
 26            echo ""
 27 arta  1.24 
 28 arta  1.82 # Clean by default.
 29            set CLEAN = "yes"
 30 arta  1.61 set PROJCONFIG = ""
 31            set CLEANCMD = "d"
 32 arta  1.79 set CFGSERVER = "no"
 33            set CFGSERVERARG = "s"
 34 arta  1.60 set CUSTOMDEFSFILE = ""
 35            
 36 arta  1.64 foreach THEARG ($argv)
 37                set LITERALSTR = '{ my($argin) = "'${THEARG}'"; my($flagout); $flagout = ($argin =~ /^-(.+)/)[0]; print $flagout; }'
 38                set FLAG = `$PERLBIN -e "$LITERALSTR"`
 39                
 40 arta  1.61     if ($FLAG == $CLEANCMD) then
 41 arta  1.82         set CLEAN = "no"
 42 arta  1.79     else if ($FLAG == $CFGSERVERARG) then
 43                    set CFGSERVER = "yes"
 44 arta  1.64     else if (-e $THEARG) then
 45                    set PROJCONFIG = $THEARG
 46 arta  1.1      endif
 47            end
 48            
 49 arta  1.64 # Usage:
 50 arta  1.82 #   configure [ -d ] [ -s ] [ <project config file> ]
 51 arta  1.64 
 52 arta  1.63 # Backward compatibility - remove the links to the old make files in projconf
 53            if (-d proj) then	 
 54                cd proj	 
 55                if (-e configure) then	 
 56                    rm configure	 
 57                endif	 
 58                if (-e make_basic.mk) then	 
 59                    rm make_basic.mk	 
 60                endif	 
 61                if (-e Rules.mk) then	 
 62                    rm Rules.mk	 
 63                endif	 
 64                if (-e target.mk) then	 
 65                    rm target.mk	 
 66                endif	 
 67                cd ..	 
 68            endif
 69            
 70 arta  1.82     # Always clean up links to man pages and re-create them.
 71                echo -n "Removing links to man pages..."
 72 arta  1.47     if (-e man) then
 73            	rm -rf man
 74                endif
 75 arta  1.1      echo "done"
 76            
 77 arta  1.82     if ($CLEAN == "yes") then
 78                    echo -n "Removing links in base/include to headers..."
 79                    # Links in base/include
 80                    if (-d base/include) then
 81                        cd base/include
 82                        find . -name "*.h" -exec rm {} \;
 83                        cd ../..
 84                    endif
 85                    echo "done"
 86 arta  1.73 
 87 arta  1.82         # Special link from base/drms/apps/serverdefs.h to localization/drmsparams.h
 88                    echo -n "Removing link to serverdefs.h..."
 89                    if (-e base/drms/apps) then
 90                        cd base/drms/apps
 91                        rm serverdefs.h
 92                        cd ../../..
 93                    endif
 94                    echo "done"
 95 arta  1.19 
 96 arta  1.82         # Links in include
 97                    echo -n "Removing links in include to headers..."
 98                    if (-d include) then
 99                        cd include
100                        find . -name "*.h" -exec rm {} \;
101                        find . -name "drmsparams*" -exec rm {} \;
102                        cd ..
103                    endif
104                    echo "done"
105 arta  1.1  
106 arta  1.82         echo -n "Removing links to scripts..."
107                    # Links in scripts
108                    if (-d scripts) then
109                        cd scripts
110                        if ($? == 0) then
111                            find . -type l -exec rm {} \;
112                        endif
113                        cd ..
114 arta  1.81         endif
115 arta  1.82         echo "done"
116                # End clean flag
117 arta  1.1      endif
118            
119 arta  1.82     # Always clean-up links to jsds and re-create them.
120 arta  1.1      echo -n "Removing links to jsds..."
121                if (-d jsds) then
122 arta  1.47 	cd jsds
123 arta  1.81         if ($? == 0) then
124                        find . -type l -exec rm {} \;
125                    endif
126 arta  1.47 	cd ..
127 arta  1.1      endif
128                echo "done"
129                echo
130            
131                if ($CLEAN == "yes") then
132 arta  1.10 	if (-x base/local/libs/dsds/scripts/rmlinks.csh) then
133            	    base/local/libs/dsds/scripts/rmlinks.csh
134 arta  1.1  	endif
135            
136 arta  1.10 	if (-x base/local/libs/soi/scripts/rmlinks.csh) then
137            	    base/local/libs/soi/scripts/rmlinks.csh
138 arta  1.1  	endif
139 arta  1.82     endif
140            
141                # Make include directories here, since they are used by multiple script blocks below
142                if (!(-d base/include)) then
143                    mkdir -p base/include
144                endif
145 arta  1.53 
146 arta  1.82     if (!(-d include)) then
147                    mkdir -p include
148                endif
149 arta  1.53 
150 arta  1.82     echo "Setting links to man pages..."
151                if (-d /home/jsoc/man) then
152                   if (!(-e man)) then
153            	    ln -s /home/jsoc/man man
154 arta  1.13 	endif
155 arta  1.82     endif
156                echo "done"
157                echo
158 arta  1.1  	
159 arta  1.82     echo "Setting links to jsds..."
160                if (!(-d jsds)) then
161                    mkdir jsds
162                endif
163                cd jsds
164                find ../base \( -name \*.jsd -exec ln -s {} . \; -a -exec echo "  " {} " OK" \; \) -o \( -name \*.jsd -exec echo "  " {} " ERROR - couldn't create link" \; \)
165                cd ..
166                echo "done"
167                echo
168            
169                # generate links for DSDS/SOI dynamic libraries - only do this if 
170                # user's environment has access to /home/soi/CM
171                if (-d /home/soi/CM/include && -d /home/soi/CM/src) then
172                    if (-x base/local/libs/dsds/scripts/genlinks.csh) then
173                        base/local/libs/dsds/scripts/genlinks.csh
174                    endif
175 arta  1.14 
176 arta  1.82 	if (-x base/local/libs/soi/scripts/genlinks.csh) then
177                 	    base/local/libs/soi/scripts/genlinks.csh
178 arta  1.1  	endif
179 arta  1.82     endif
180 arta  1.53 
181 arta  1.82     echo "done"
182                echo
183 arta  1.57 
184 arta  1.82     # Site Localization
185 arta  1.57 
186 arta  1.82     # Path to the configuration file - at some point, make this an argument to the configure script
187                set LOCALIZATIONDIR = ""
188                set RELLOCALIZATIONDIR = ""
189                set conflocal = "config.local"
190 arta  1.58 
191 arta  1.82     if (-e $conflocal) then
192                    set RELLOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal`
193                endif
194 arta  1.57 
195 arta  1.82     if ($LOCALIZATIONDIR == "") then
196                    set RELLOCALIZATIONDIR = localization
197                endif
198 arta  1.57 
199 arta  1.82     # Make the path absoluate
200                set LOCALIZATIONDIR = ${PWD}/${RELLOCALIZATIONDIR}
201 arta  1.75 
202 arta  1.82     # Eventually, dump all these generated files into a user-specified location.
203                # This script will need to read the config.local file to get the 
204                # localization directory. Otherwise, just use JSOC/localization as the default.
205                if (!(-d ${LOCALIZATIONDIR})) then
206                    mkdir ${LOCALIZATIONDIR}
207                    if ($? != 0) then
208                        echo "Error creating localization directory."
209 arta  1.57         endif
210 arta  1.82     endif
211 arta  1.71 
212 arta  1.82     if (-e ${LOCALIZATIONDIR}/drmsparams.h) then
213                    rm ${LOCALIZATIONDIR}/drmsparams.h
214                endif
215 arta  1.73 
216 arta  1.82     if (-e ${LOCALIZATIONDIR}/drmsparams.mk) then
217                    rm ${LOCALIZATIONDIR}/drmsparams.mk
218                endif
219 arta  1.71 
220 arta  1.82     if (-e ${LOCALIZATIONDIR}/drmsparams.pm) then
221                    rm ${LOCALIZATIONDIR}/drmsparams.pm
222                endif
223 arta  1.57 
224 arta  1.82     if (-e ${LOCALIZATIONDIR}/drmsparams.py) then
225                    rm ${LOCALIZATIONDIR}/drmsparams.py
226                endif
227 arta  1.81 
228 arta  1.82     # Must create the scripts subdirectory before the call to gen_init.csh
229                if (!(-d scripts)) then
230                    mkdir scripts
231                endif
232 arta  1.81 
233 arta  1.82     if (!(-e configsdp.txt)) then
234                    # This is NetDRMS.
235                    if (!(-e config.local)) then
236                        echo "Error: config.local not found. If you have a saved version of this"
237                        echo "       file from a previous installation, you should copy that into"
238                        echo "       this directory and rerun configure. Otherwise, copy the file"
239                        echo "       config.local.template to config.local and edit the config.local"
240                        echo "       file to contain site-appropriate values."
241                        echo 
242                        echo "*** IMPORTANT *** The edited config.local will contain site-specific"
243                        echo "    values that should not be modified during subsequent updates to"
244                        echo "    NetDRMS. Keep a safe copy of it somewhere outside of the DRMS"
245                        echo "    directory tree, for example in /usr/local. After each NetDRMS"
246                        echo "    update, ensure this file is in place."
247                        exit 1;
248 arta  1.61         endif
249 arta  1.82     endif
250 arta  1.73         
251 arta  1.82     # We now call localize.py for both Stanford and NetDRMS builds.
252                if ($CFGSERVER == "yes") then
253                    $PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams -s
254                else
255                    $PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams
256                endif
257 arta  1.61 
258 arta  1.82     echo "Setting links to scripts..."
259                cd scripts
260 arta  1.61 
261 arta  1.82     # Sums scripts
262                find ../base/sums/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print "   " . $path . " OK\n"; } else { print "   " . $path . " ERROR - could not create link\n"; } }'
263 arta  1.62 
264 arta  1.82     # Util scripts
265                find ../base/util/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print "   " . $path . " OK\n"; } else { print "   " . $path . " ERROR - could not create link\n"; } }'
266 arta  1.62 
267 arta  1.82     # Export scripts
268                find ../base/export/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print "   " . $path . " OK\n"; } else { print "   " . $path . " ERROR - could not create link\n"; } }'
269 arta  1.62 
270 arta  1.82     # DRMS / IDL-interface scripts
271                find ../base/drms/scripts -mindepth 1 -path \*CVS -prune -o -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print "   " . $path . " OK\n"; } else { print "   " . $path . " ERROR - could not create link\n"; } }'
272 arta  1.62 
273 arta  1.82     # Project-specific scripts - these won't show up if you don't have the project source.
274                if (-x ${LOCALIZATIONDIR}/configure) then
275                    ${LOCALIZATIONDIR}/configure
276                endif
277 arta  1.62 
278 arta  1.82     cd ..
279                echo "done"
280                echo
281 arta  1.62 
282 arta  1.82     echo "Setting links to headers..."
283 arta  1.53 
284 arta  1.82     # When localize.py was added, we removed the repository version of serverdefs.h, and we stopped generating JSOC/base/include/localization.h.
285                # To support legacy code, we need to make a link from serverdefs.h to ${LOCALIZATIONDIR}/drmsparams.h (the replacement for serverdefs.h
286                # at Stanford) and from JSOC/base/include/localization.h to ${LOCALIZATIONDIR}/drmsparams.h (the replacement for localization.h
287                # for NetDRMs builds). However, some files are looking for JSOC/base/drms/apps/serverdefs.h (instead of JSOC/base/include, the correct path).
288                # If we make a link from JSOC/base/drms/apps/serverdefs.h to ${LOCALIZATIONDIR}/drmsparams.h, then the script below will make links from 
289                # JSOC/base/include/serverdefs.h and JSOC/include/serverdefs.h to JSOC/base/drms/apps/serverdefs.h, which then links to ${LOCALIZATIONDIR}/drmsparams.h.
290                if (!(-l base/drms/apps/serverdefs.h)) then
291 arta  1.73         cd base/drms/apps
292 arta  1.82         ln -s ../../../${RELLOCALIZATIONDIR}/drmsparams.h serverdefs.h
293 arta  1.73         cd ../../..
294 arta  1.82     endif
295 arta  1.73 
296 arta  1.82     if (!(-l base/include/localization.h)) then
297 arta  1.73         cd base/include
298 arta  1.82         ln -s ../../${RELLOCALIZATIONDIR}/drmsparams.h localization.h
299 arta  1.73         cd ../..
300 arta  1.82     endif
301 arta  1.73 
302 arta  1.82     cd base/include
303                find .. -path '../include' -prune -o -name \*.h -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print "   " . $path . " OK\n"; } else { print "   " . $path . " ERROR - could not create link\n"; } }'
304                cd ../..
305            
306                cd include
307                if (-d ../base/include) then
308                    find ../base/include -name \*.h -print | ${PERLBIN} -MFile::Basename -n -e 'my($bn) = basename($_); chomp($bn); my($path) = $_; chomp($path); if (!(-e $bn)) { `ln -s $_`; if ($? >> 8 == 0) { print "   " . $path . " OK\n"; } else { print "   " . $path . " ERROR - could not create link\n"; } }'
309                endif
310 arta  1.53 
311 arta  1.82     # ${LOCALIZATIONDIR} is an absolute path
312                if (!(-l drmsparams.h)) then
313 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.h
314 arta  1.82     endif
315                if (!(-l drmsparams.pm)) then
316 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.pm
317 arta  1.82     endif
318                if (!(-l drmsparams.py)) then
319 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.py
320 arta  1.1      endif
321            
322 arta  1.82     cd ..
323                echo "done"
324                echo

Karen Tian
Powered by
ViewCVS 0.9.4