(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.84         if (-x base/local/libs/dsds/scripts/rmlinks.csh) then
133                        base/local/libs/dsds/scripts/rmlinks.csh
134                    endif
135 arta  1.1  
136 arta  1.84         if (-x base/local/libs/soi/scripts/rmlinks.csh) then
137                        base/local/libs/soi/scripts/rmlinks.csh
138                    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.84     #######################
185                ## Site Localization ##
186                #######################
187                
188 arta  1.82     # Path to the configuration file - at some point, make this an argument to the configure script
189                set LOCALIZATIONDIR = ""
190                set RELLOCALIZATIONDIR = ""
191                set conflocal = "config.local"
192 arta  1.58 
193 arta  1.82     if (-e $conflocal) then
194                    set RELLOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal`
195                endif
196 arta  1.57 
197 arta  1.82     if ($LOCALIZATIONDIR == "") then
198                    set RELLOCALIZATIONDIR = localization
199                endif
200 arta  1.57 
201 arta  1.82     # Make the path absoluate
202                set LOCALIZATIONDIR = ${PWD}/${RELLOCALIZATIONDIR}
203 arta  1.75 
204 arta  1.84     # Reset localization.
205                if ($CLEAN == "yes") then
206                    # This script will need to read the config.local file to get the 
207                    # localization directory. Otherwise, just use JSOC/localization as the default.
208                    if (!(-d ${LOCALIZATIONDIR})) then
209                        mkdir ${LOCALIZATIONDIR}
210                        if ($? != 0) then
211                            echo "Error creating localization directory."
212                        endif
213 arta  1.57         endif
214 arta  1.71 
215 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.h) then
216                        rm ${LOCALIZATIONDIR}/drmsparams.h
217                    endif
218 arta  1.73 
219 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.mk) then
220                        rm ${LOCALIZATIONDIR}/drmsparams.mk
221                    endif
222 arta  1.71 
223 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.pm) then
224                        rm ${LOCALIZATIONDIR}/drmsparams.pm
225                    endif
226 arta  1.57 
227 arta  1.84         if (-e ${LOCALIZATIONDIR}/drmsparams.py) then
228                        rm ${LOCALIZATIONDIR}/drmsparams.py
229                    endif
230 arta  1.81 
231 arta  1.84         if (!(-e configsdp.txt)) then
232                        # This is NetDRMS.
233                        if (!(-e config.local)) then
234                            echo "Error: config.local not found. If you have a saved version of this"
235                            echo "       file from a previous installation, you should copy that into"
236                            echo "       this directory and rerun configure. Otherwise, copy the file"
237                            echo "       config.local.template to config.local and edit the config.local"
238                            echo "       file to contain site-appropriate values."
239                            echo 
240                            echo "*** IMPORTANT *** The edited config.local will contain site-specific"
241                            echo "    values that should not be modified during subsequent updates to"
242                            echo "    NetDRMS. Keep a safe copy of it somewhere outside of the DRMS"
243                            echo "    directory tree, for example in /usr/local. After each NetDRMS"
244                            echo "    update, ensure this file is in place."
245                            exit 1;
246                        endif
247 arta  1.61         endif
248 arta  1.73         
249 arta  1.83         # We now call localize.py for both Stanford and NetDRMS builds.
250                    if ($CFGSERVER == "yes") then
251                        $PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams -s
252                    else
253                        $PYBIN ./localize.py -d ${LOCALIZATIONDIR} -b drmsparams
254                    endif
255 arta  1.84     endif # End reset localization
256 arta  1.61 
257 arta  1.82     echo "Setting links to scripts..."
258 arta  1.84     if (!(-d scripts)) then
259                    mkdir scripts
260                endif
261                
262                if ($CLEAN == "yes") then 
263                    cd scripts
264 arta  1.61 
265 arta  1.84         # Sums scripts
266                    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"; } }'
267 arta  1.62 
268 arta  1.84         # Util scripts
269                    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"; } }'
270 arta  1.62 
271 arta  1.84         # Export scripts
272                    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"; } }'
273 arta  1.62 
274 arta  1.84         # DRMS / IDL-interface scripts
275                    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"; } }'
276 arta  1.62 
277 arta  1.84         # Project-specific scripts - these won't show up if you don't have the project source.
278                    if (-x ${LOCALIZATIONDIR}/configure) then
279                        ${LOCALIZATIONDIR}/configure
280                    endif
281                    cd ..
282 arta  1.82     endif
283 arta  1.62 
284 arta  1.82     echo "done"
285                echo
286 arta  1.62 
287 arta  1.82     echo "Setting links to headers..."
288 arta  1.53 
289 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.
290                # To support legacy code, we need to make a link from serverdefs.h to ${LOCALIZATIONDIR}/drmsparams.h (the replacement for serverdefs.h
291                # at Stanford) and from JSOC/base/include/localization.h to ${LOCALIZATIONDIR}/drmsparams.h (the replacement for localization.h
292                # for NetDRMs builds). However, some files are looking for JSOC/base/drms/apps/serverdefs.h (instead of JSOC/base/include, the correct path).
293                # If we make a link from JSOC/base/drms/apps/serverdefs.h to ${LOCALIZATIONDIR}/drmsparams.h, then the script below will make links from 
294                # JSOC/base/include/serverdefs.h and JSOC/include/serverdefs.h to JSOC/base/drms/apps/serverdefs.h, which then links to ${LOCALIZATIONDIR}/drmsparams.h.
295                if (!(-l base/drms/apps/serverdefs.h)) then
296 arta  1.73         cd base/drms/apps
297 arta  1.82         ln -s ../../../${RELLOCALIZATIONDIR}/drmsparams.h serverdefs.h
298 arta  1.73         cd ../../..
299 arta  1.82     endif
300 arta  1.73 
301 arta  1.82     if (!(-l base/include/localization.h)) then
302 arta  1.73         cd base/include
303 arta  1.82         ln -s ../../${RELLOCALIZATIONDIR}/drmsparams.h localization.h
304 arta  1.73         cd ../..
305 arta  1.82     endif
306 arta  1.73 
307 arta  1.84     if ($CLEAN == "yes") then 
308                    cd base/include
309                    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"; } }'
310                    cd ../..
311 arta  1.82 
312 arta  1.84         cd include
313                    if (-d ../base/include) then
314                        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"; } }'
315                    endif
316                    cd ..
317 arta  1.82     endif
318 arta  1.53 
319 arta  1.84     cd include
320 arta  1.82     # ${LOCALIZATIONDIR} is an absolute path
321                if (!(-l drmsparams.h)) then
322 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.h
323 arta  1.82     endif
324                if (!(-l drmsparams.pm)) then
325 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.pm
326 arta  1.82     endif
327                if (!(-l drmsparams.py)) then
328 arta  1.81         ln -s ../${RELLOCALIZATIONDIR}/drmsparams.py
329 arta  1.1      endif
330            
331 arta  1.82     cd ..
332                echo "done"
333                echo

Karen Tian
Powered by
ViewCVS 0.9.4