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

Karen Tian
Powered by
ViewCVS 0.9.4