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

  1 arta  1.1 #! /bin/csh -f
  2           
  3 arta  1.64 # system configuration for configure script
  4            set PERLBIN = ""
  5            
  6            if ($PERLBIN == "") then
  7                if (-e configsdp.txt) then
  8                    # at stanford, use 
  9 arta  1.70         set PERLBIN = "/home/jsoc/bin/linux_x86_64/activeperl"
 10 arta  1.64     else
 11                    set PERLBIN = "perl"
 12                endif
 13            endif
 14            
 15 arta  1.26 # set up $JSOC_MACHINE
 16            set JSOC_MACHINE = `build/jsoc_machine.csh`
 17            echo "Machine type is $JSOC_MACHINE"
 18            echo ""
 19 arta  1.24 
 20 arta  1.1  set CLEAN = "no"
 21 arta  1.61 set PROJCONFIG = ""
 22            set CLEANCMD = "d"
 23 arta  1.1  
 24 arta  1.60 set CUSTOMDEFSFILE = ""
 25            
 26 arta  1.64 foreach THEARG ($argv)
 27                set LITERALSTR = '{ my($argin) = "'${THEARG}'"; my($flagout); $flagout = ($argin =~ /^-(.+)/)[0]; print $flagout; }'
 28                set FLAG = `$PERLBIN -e "$LITERALSTR"`
 29                
 30 arta  1.61     if ($FLAG == $CLEANCMD) then
 31 arta  1.64         set CLEAN = "yes"
 32                else if (-e $THEARG) then
 33                    set PROJCONFIG = $THEARG
 34 arta  1.1      endif
 35            end
 36            
 37 arta  1.64 # Usage:
 38            #   configure [ -c ] [ <project config file> ]
 39            
 40 arta  1.63 # Backward compatibility - remove the links to the old make files in projconf
 41            if (-d proj) then	 
 42                cd proj	 
 43                if (-e configure) then	 
 44                    rm configure	 
 45                endif	 
 46                if (-e make_basic.mk) then	 
 47                    rm make_basic.mk	 
 48                endif	 
 49                if (-e Rules.mk) then	 
 50                    rm Rules.mk	 
 51                endif	 
 52                if (-e target.mk) then	 
 53                    rm target.mk	 
 54                endif	 
 55                cd ..	 
 56            endif
 57            
 58 arta  1.1      echo -n "Remove links to man pages..."
 59 arta  1.47     if (-e man) then
 60            	rm -rf man
 61                endif
 62 arta  1.1      echo "done"
 63            
 64                echo -n "Removing links to headers..."
 65 arta  1.10     if (-d base/include) then
 66 arta  1.47 	cd base/include
 67            	find . -name "*.h" -exec rm {} \;
 68            	cd ../..
 69 arta  1.1      endif
 70 arta  1.19 
 71                if (-d include) then
 72 arta  1.47 	cd include
 73            	find . -name "*.h" -exec rm {} \;
 74            	cd ..
 75 arta  1.19     endif
 76 arta  1.1      echo "done"
 77            
 78                echo -n "Removing links to scripts..."
 79                if (-d scripts) then
 80 arta  1.47 	cd scripts
 81            	find . -name "*" -exec rm {} \;
 82            	cd ..
 83 arta  1.1      endif
 84                echo "done"
 85            
 86                echo -n "Removing links to jsds..."
 87                if (-d jsds) then
 88 arta  1.47 	cd jsds
 89            	find . -name "*" -exec rm {} \;
 90            	cd ..
 91 arta  1.1      endif
 92                echo "done"
 93            
 94                echo
 95            
 96                if ($CLEAN == "yes") then
 97 arta  1.10 	if (-x base/local/libs/dsds/scripts/rmlinks.csh) then
 98            	    base/local/libs/dsds/scripts/rmlinks.csh
 99 arta  1.1  	endif
100            
101 arta  1.10 	if (-x base/local/libs/soi/scripts/rmlinks.csh) then
102            	    base/local/libs/soi/scripts/rmlinks.csh
103 arta  1.1  	endif
104                else
105 arta  1.53         # Make include directories here, since they are used by multiple script blocks below
106                    if (!(-d base/include)) then
107                        mkdir -p base/include
108                    endif
109            
110                    if (!(-d include)) then
111                        mkdir -p include
112                    endif
113            
114 arta  1.13 	echo "Setting links to man pages..."
115            	if (-d /home/jsoc/man) then
116            	    if (!(-e man)) then
117            		ln -s /home/jsoc/man man
118            	    endif
119            	endif
120 arta  1.1  	echo "done"
121 arta  1.52         echo
122 arta  1.1  	
123            	echo "Setting links to jsds..."
124 arta  1.47 	if (!(-d jsds)) then
125            	    mkdir jsds
126            	endif
127 arta  1.1  	cd jsds
128 arta  1.10 	find ../base \( -name \*.jsd -exec ln -s {} . \; -a -exec echo "  " {} " OK" \; \) -o \( -name \*.jsd -exec echo "  " {} " ERROR - couldn't create link" \; \)
129 arta  1.1  	cd ..
130            	echo "done"
131            	echo
132 arta  1.14 
133 arta  1.1  	# generate links for DSDS/SOI dynamic libraries - only do this if 
134            	# user's environment has access to /home/soi/CM
135            	if (-d /home/soi/CM/include && -d /home/soi/CM/src) then
136 arta  1.10 	    if (-x base/local/libs/dsds/scripts/genlinks.csh) then
137            		base/local/libs/dsds/scripts/genlinks.csh
138 arta  1.1  	    endif
139            
140 arta  1.10 	    if (-x base/local/libs/soi/scripts/genlinks.csh) then
141            		base/local/libs/soi/scripts/genlinks.csh
142 arta  1.1  	    endif
143            	endif
144 arta  1.53 
145 arta  1.57 	echo "done"
146            	echo
147            
148 arta  1.53         # Site Localization
149 arta  1.57 
150                    # Path to the configuration file - at some point, make this an argument to the configure script
151 arta  1.58         set LOCALIZATIONDIR = ""
152 arta  1.57         set conflocal = "config.local"
153 arta  1.58 
154                    if (-e $conflocal) then
155                        set LOCALIZATIONDIR = `perl -n -e 'if ($_ =~ /^LOCALIZATIONDIR\s+(.+)/) { print $1; }' $conflocal`
156                    endif
157 arta  1.57 
158                    if ($LOCALIZATIONDIR == "") then
159                        set LOCALIZATIONDIR = ${PWD}/localization
160                    endif
161            
162                    # Eventually, dump all these generated files into a user-specified location.
163                    # This script will need to read the config.local file to get the 
164                    # localization directory. Otherwise, just use JSOC/localization as the default.
165                    # We should put custom.mk in the localization directory too.
166                    if (!(-d ${LOCALIZATIONDIR})) then
167                        mkdir ${LOCALIZATIONDIR}
168                        if ($? != 0) then
169                            echo "Error creating localization directory."
170                        endif
171                    endif
172 arta  1.71 
173                    # TEMPORARILY create a link from ${LOCALIZATIONDIR}/drmsparams.h to JSOC/base/libs/perl/JSOC_DB_INFO_INCLUDE.pl
174 arta  1.72         cd ${LOCALIZATIONDIR}
175                    rm -f drmsparams.pm
176                    ln -s ../base/libs/perl/JSOC_DB_INFO_INCLUDE.pl drmsparams.pm
177                    cd ..
178 arta  1.57         
179 arta  1.71 
180 arta  1.57         if (-e ${LOCALIZATIONDIR}/custom.mk) then
181                        rm ${LOCALIZATIONDIR}/custom.mk
182                    endif
183            
184 arta  1.65         # Must create the scripts subdirectory before the call to gen_init.csh
185                    if (!(-d scripts)) then
186            	    mkdir scripts
187            	endif
188            
189 arta  1.61         if (!(-e configsdp.txt)) then
190 arta  1.66             # This is NetDRMS.
191 arta  1.53             if (!(-e config.local)) then
192                            echo "Error: config.local not found. If you have a saved version of this"
193                            echo "       file from a previous installation, you should copy that into"
194                            echo "       this directory and rerun configure. Otherwise, copy the file"
195                            echo "       config.local.template to config.local and edit the config.local"
196                            echo "       file to contain site-appropriate values."
197                            echo 
198                            echo "*** IMPORTANT *** The edited config.local will contain site-specific"
199                            echo "    values that should not be modified during subsequent updates to"
200                            echo "    NetDRMS. Keep a safe copy of it somewhere outside of the DRMS"
201                            echo "    directory tree, for example in /usr/local. After each NetDRMS"
202                            echo "    update, ensure this file is in place."
203 arta  1.54                 exit 1;
204 arta  1.53             else
205 arta  1.57                 echo "CUSTOM_DEFINES = __LOCALIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk
206 arta  1.67 
207                            set CUSTOMDEFSFILE = "base/include/localization.h"
208                            echo "*** generating $CUSTOMDEFSFILE ***"
209                            cat /dev/null > $CUSTOMDEFSFILE
210                            echo '#ifndef __LOCALIZATION_H' >> $CUSTOMDEFSFILE
211                            echo '#define __LOCALIZATION_H' >> $CUSTOMDEFSFILE
212 arta  1.53                 ./gen_init.csh
213 arta  1.60 
214 arta  1.66                 # Non-customizable parameters. There are certain features that are not
215                            # present in NetDRMS, but that are present in the SDP JSOC version of DRMS.
216                            # Set defines needed to accomplish this here.
217                            # NetDRMS sites do not have DSDS.
218 arta  1.67                 echo '#define DSDS_SUPPORT (0)' >> $CUSTOMDEFSFILE
219                            echo '#endif' >> $CUSTOMDEFSFILE
220 arta  1.60 
221                            # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection 
222 arta  1.61                 # in perl. It also reads configdsp.txt (if it exists) to set the default Stanford values for certain make variables
223 arta  1.64                 $PERLBIN ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk -c${CUSTOMDEFSFILE}
224 arta  1.60 
225                            # must follow moreconfigure.pl, because moreconfigure.pl will possibly set the compiler make variables,
226                            # which are then referenced by lines in custom.mk generated by customizemake.pl.
227 arta  1.64                 $PERLBIN ./customizemake.pl ./config.local ${LOCALIZATIONDIR}
228 arta  1.53             endif
229                    else if (-e config.local) then
230 arta  1.66             # This is Stanford.
231            
232 arta  1.53             # config.local is optional at Stanford, but it won't necessarily contain the same information that 
233                        # a NetDRMS config.local contains. The first section contains items that will override the
234                        # the items in serverdefs.h. The second section contains items used to populate custom.mk, 
235                        # which causes make systems variables to be defined that override the default make behavior
236                        # (such as overriding the name of the directory to which binary data are written - linux_x86_64_n02
237                        # instead of linux_x86_64, for example).
238            
239                        # Override the defaults defined in serverdefs.h (don't use gen_init.csh as it does several things, 
240                        # most of which are relevant only to non-SU NetDRMS sites). This script causes all 
241                        # items included in config.local to override those defined in serverdefs.h, but not all
242                        # items need be specified in config.local.
243 arta  1.60             echo "CUSTOM_DEFINES = __CUSTOMIZED_DEFS__" >> ${LOCALIZATIONDIR}/custom.mk
244 arta  1.64             $PERLBIN ./customizedefs.pl
245 arta  1.60 
246                        set CUSTOMDEFSFILE = "base/include/customizeddefs.h"
247            
248                        # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection 
249 arta  1.61             # in perl. It also reads configsdp.txt (if it exists) to set the default Stanford values for certain make variables
250 arta  1.64             $PERLBIN ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk -c${CUSTOMDEFSFILE}
251 arta  1.53 
252                        # update custom.mk with data from config.local
253 arta  1.60             # must follow moreconfigure.pl, because moreconfigure.pl will possibly set the compiler make variables,
254                        # which are then referenced by lines in custom.mk generated by customizemake.pl.
255 arta  1.64             $PERLBIN ./customizemake.pl ./config.local ${LOCALIZATIONDIR}
256 arta  1.60         else
257                        # run moreconfigure.pl - this script is written in perl because it is easier to do the compiler detection 
258 arta  1.61             # in perl. It also reads configsdp.txt (if it exists) to set the default Stanford values for certain make variables
259 arta  1.64             $PERLBIN ./moreconfigure.pl -d${LOCALIZATIONDIR} -fcustom.mk 
260                    endif
261            
262                    # Figure out if this is a custom checkout
263                    set CUSTCO = "no"
264                    set LITERALSTR = '{ open(CFG, "<'${LOCALIZATIONDIR}'/dlset.txt") || die "BAD"; my $line = <CFG>; chomp($line); print $line; }'
265                    set CUSTCO = `$PERLBIN -e "$LITERALSTR"`
266            
267                    if (${CUSTCO} == "BAD") then
268                        echo "Unable to open checkout state file ${LOCALIZATIONDIR}/dlset.txt"
269                        exit 1
270                    else if (${CUSTCO} == "custom") then
271                        set CUSTCO = "yes"
272 arta  1.53         endif
273            
274 arta  1.61         if (${PROJCONFIG} == "") then
275 arta  1.64             if (${CUSTCO} == "yes") then
276                            echo "Must provide configuration file as an argument to this configure script"
277                            exit 1;
278                        endif
279 arta  1.61             if (-e configsdp.txt) then
280                            set PROJCONFIG = configsdp.txt
281                        endif
282                    endif
283            
284                    if (${PROJCONFIG} != "") then
285 arta  1.64             echo "Running project configuration [${PERLBIN} configproj.pl -c${PROJCONFIG} -d${LOCALIZATIONDIR}]."
286                        ${PERLBIN} configproj.pl -c${PROJCONFIG} -d${LOCALIZATIONDIR}
287 arta  1.61         endif
288            
289 arta  1.62 	echo "Setting links to scripts..."
290            	cd scripts
291            
292            	# Sums scripts
293            	find ../base/sums/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo "  " {} " OK" \; \) -o -exec echo "  " {} " ERROR - couldn't create link" \;
294            
295            	# Util scripts
296            	find ../base/util/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo "  " {} " OK" \; \) -o -exec echo "  " {} " ERROR - couldn't create link" \;
297            
298                    # Export scripts
299            	find ../base/export/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo "  " {} " OK" \; \) -o -exec echo "  " {} " ERROR - couldn't create link" \;
300            
301            	# DRMS / IDL-interface scripts
302            	find ../base/drms/scripts -mindepth 1 \( -path \*CVS -prune -o -exec ln -s {} . \; -a -exec echo "  " {} " OK" \; \) -o -exec echo "  " {} " ERROR - couldn't create link" \;
303            
304            	# Project-specific scripts - these won't show up if you don't have the project source.
305            	if (-x ${LOCALIZATIONDIR}/configure) then
306            	    ${LOCALIZATIONDIR}/configure
307            	endif
308            
309            	cd ..
310 arta  1.62 	echo "done"
311            	echo
312            
313 arta  1.53         echo "Setting links to headers..."
314            
315                    cd base/include
316                    find .. -path '../include' -prune -o -name \*.h  \( \( -exec ln -s {} . \; -a -exec echo "  " {} " OK" \; \) -o -exec echo "  " {} " ERROR - couldn't create link" \; \)
317                    cd ../..
318            
319                    cd include
320                    if (-d ../base/include) then
321                        find ../base/include -name \*.h -exec ln -s {} . \;
322                    endif
323                    cd ..
324                    echo "done"
325                    echo
326            
327 arta  1.55         # Custom make variable values - these will override the values set in moreconfigure.pl
328 arta  1.53         # echo "JSOC_COMPILER = gcc" >> custom.mk
329                    # echo "JSOC_FCOMPILER = gfortran" >> custom.mk
330 arta  1.55         # echo "DRMS_DEFAULT_RETENTION = -10" >> custom.mk
331 arta  1.53 
332 arta  1.1      endif
333            
334 arta  1.33 

Karen Tian
Powered by
ViewCVS 0.9.4