1 $! #!/bin/sh ---> MYCONFIG.COM
3 $! # This script is designed to provide a handy summary of the configuration
4 $! # information being used to build perl. This is especially useful if you
5 $! # are requesting help from comp.lang.perl.misc on usenet or via mail.
7 $! DCL-ified by Peter Prymmer <pvhp@lns62.lns.cornell.edu> 22-DEC-1995
8 $! DCL usage (choose one):
10 $! @MYCONFIG/OUTPUT=MYCONFIG.OUT !or
11 $! @MYCONFIG [node::][which$disk:][[dir.subdir]]CONFIG.SH !or
12 $! @MYCONFIG/OUTPUT=MYCONFIG.OUT [node::][w$disk:][[dir]]CONFIG.SH
14 $! Incorporates Charles Bailey's ideas about bootstrapping system info -
15 $! myconfig.com is now callable as a "myconfig" target in your maker and
16 $! may even work if miniperl.exe and config.sh files fail to be made.
18 $! MMK/DESCRIP=[.VMS] !(or MMS or MAKE)
19 $! does not work then try:
20 $! MMK/DESCRIP=[.VMS]/OUTPUT=MYPERLBUILD.PROBLEM !(or MMS or MAKE)
21 $! Then discuss the MYPERLBUILD.PROBLEM file with a local expert.
22 $! If that still does not work then try:
23 $! MMK/DESCRIP=[.VMS]/OUT=MYNONFIG.OUT MYCONFIG !(or MMS or MAKE)
24 $! send output (MYNONFIG.OUT) to an outside expert and ask politely for help.
26 $ ECHO = "WRITE SYS$OUTPUT "
27 $ RATHER_LONG_DEFAULT_DIRECTORY_NAME = F$ENVIRONMENT("DEFAULT")
29 $ if (p1.nes."").and.(p2.eqs."")
30 $ then RATHER_LONG_FILENAME_TO_FIND = p1 !no typo-checking (experts only)
31 $ else RATHER_LONG_FILENAME_TO_FIND = "CONFIG.SH"
34 $ RATHER_LONG_FILENAME_SEARCH = F$Search(RATHER_LONG_FILENAME_TO_FIND)
35 $ if RATHER_LONG_FILENAME_SEARCH.EQS.""
37 $ if f$parse(f$environment("DEFAULT"),,,"DIRECTORY",).NES."[000000]"
42 $ ECHO "Can't find the perl config.sh file produced by Configure"
43 $ set default 'RATHER_LONG_DEFAULT_DIRECTORY_NAME'
45 $ goto cannot_find_config_sh
49 $ open/read RATHER_LONG_CONFIG_FILE_HANDLE 'RATHER_LONG_FILENAME_SEARCH'
51 $ read/end_of_file = Done RATHER_LONG_CONFIG_FILE_HANDLE line
52 $ name = f$extract(0,f$locate("=",line),line)
53 $ start = f$locate("'",line)+1
54 $ stop = f$locate("'",line)
55 $ value = f$extract(start,stop-start,line)
56 $ if (f$locate("#",name).eqs.f$length(name)).and. -
58 (name.nes."'") - !bug in genconfig.pl (vms) for osvers='' ?
59 then $$'name' = "'" + value !$ not necessary but looks more sh-ish
63 $ close RATHER_LONG_CONFIG_FILE_HANDLE
66 $cannot_find_config_sh:
67 $! these parameters are assumed to be passed from make/mm[s|k]:
68 $! p1=$(CC), p2=$(CFLAGS), p3=$(LINKFLAGS),
69 $! p4=$(LIBS1), p5=$(LIBS2), p6=$(SOCKLIB),
70 $! p7=$(EXT), p8=$(DBG)
71 $! so assign to appropriate $var:
72 $ $cc = "'"+p1+"'" ! p1=$(CC) from make
73 $ $ccflags = "'"+p2+"'" ! p2=$(CFLAGS) from make
74 $ $ldflags = "'"+p3+"'" ! p3=$(LINKFLAGS) from make
75 $ $libs = "'"+p4+" "+p5+" "+p6+"'" ! p4$(LIBS1),p5$(LIBS2),p6$(SOCKLIB)frm make
76 $ $staticexts = "'"+p7+"'" ! p7=$(EXT) from make
78 $! hard-coded stuff (for now):
79 $ $cppflags = "'"+"'" !(vestigal)
80 $ $optimize = "'"+"'" !descrip.mms has /Optimize=2 in $(XTRACCFLAGS)
82 $! following assigns done via `dcl` calls in genconfig.pl anyway:
83 $ $osname = "'"+f$edit(f$getsyi("NODE_SWTYPE"),"COLLAPSE") !genconfig.pl has "osname='VMS'"
84 $ $osvers = f$edit(f$getsyi("VERSION")-"V","COLLAPSE")
85 $ if f$getsyi("HW_MODEL").GT.1024
86 $ then $$archname = "'VMS_AXP'" !string from descrip.mms vmsperl 12-21-95
87 $ else $$archname = "'VMS_VAX'" !string from descrip.mms vmsperl 12-21-95
90 $ if $myname.eqs."" then $$myname = f$trnlnm("ARPANET_HOST_NAME")
91 $ if $myname.eqs."" then $$myname = f$trnlnm("INTERNET_HOST_NAME")
92 $ if $myname.eqs."" then $$myname = f$trnlnm("MULTINET_HOST_NAME")
93 $ if $myname.eqs."" then $$myname = f$trnlnm("UCX$INET_HOST_NAME")
94 $ if $myname.eqs."" then $$myname = f$trnlnm("TCPWARE_DOMAINNAME")
95 $ if $myname.eqs."" then $$myname = f$trnlnm("NEWS_ADDRESS")
96 $ if $myname.eqs."" then $$myname = f$trnlnm("SYS$NODE")
97 $! Is this same as genconfig.pl ? (spacing/order unknown):
98 $ $myuname=$osname+" "+$myname+" "+$osvers+" "+F$GetSyi("HW_NAME")+"'"
99 $ $osname = $osname+"'"
100 $ $osvers = "'"+$osvers+"'"
102 $look_for_patchlevel_h:
104 $ RATHER_LONG_FILENAME_TO_FIND = "PATCHLEVEL.H"
105 $Research_patchlevel_h:
106 $ RATHER_LONG_FILENAME_SEARCH = F$Search(RATHER_LONG_FILENAME_TO_FIND)
107 $ if RATHER_LONG_FILENAME_SEARCH.EQS.""
109 $ if f$parse(f$environment("DEFAULT"),,,"DIRECTORY",).NES."[000000]"
112 $ goto Research_patchlevel_h
114 $ ECHO "Can't find the header file patchlevel.h used to make config.sh"
115 $ set default 'RATHER_LONG_DEFAULT_DIRECTORY_NAME'
116 $ goto look_for_genconfig.pl
120 $ open/read RATHER_LONG_CONFIG_FILE_HANDLE 'RATHER_LONG_FILENAME_SEARCH'
122 $ read/end_of_file = patchlevel_h_Done RATHER_LONG_CONFIG_FILE_HANDLE line
123 $ if f$locate("PERL_VERSION",line).ne.f$length(line)
125 $ line = f$edit(line,"TRIM,COMPRESS")
126 $ $PATCHLEVEL = f$element(2," ",line)
127 $ if f$type($SUBVERSION).nes."" then goto patchlevel_h_Done
129 $ if f$locate("PERL_SUBVERSION",line).ne.f$length(line)
131 $ line = f$edit(line,"TRIM,COMPRESS")
132 $ $SUBVERSION = f$element(2," ",line)
133 $ if f$type($PATCHLEVEL).nes."" then goto patchlevel_h_Done
135 $ goto read_patchlevel_h
138 $ close RATHER_LONG_CONFIG_FILE_HANDLE
139 $ if $PATCHLEVEL.eqs.""
141 $ echo "warning: PERL_VERSION was not found in ''RATHER_LONG_FILENAME_TO_FIND':"
144 $look_for_genconfig_pl:
146 $ if f$search("VMS.DIR").nes."" then set default [.vms]
147 $ RATHER_LONG_FILENAME_TO_FIND = "GENCONFIG.PL"
148 $ genconfig_pl_dir = ""
149 $Research_genconfig_pl:
150 $ RATHER_LONG_FILENAME_SEARCH = F$Search(RATHER_LONG_FILENAME_TO_FIND)
151 $ if RATHER_LONG_FILENAME_SEARCH.EQS.""
153 $ if f$parse(f$environment("DEFAULT"),,,"DIRECTORY",).NES."[000000]"
156 $ goto Research_genconfig_pl
158 $ ECHO "Can't find the perl genconfig.pl used to make config.sh"
159 $ set default 'RATHER_LONG_DEFAULT_DIRECTORY_NAME'
160 $ goto look_for_config_vms
162 $ else !genconfig.pl has been found
163 $ genconfig_pl_dir = f$parse(f$environment("DEFAULT"),,,"DIRECTORY",)
166 $ cnfg_keys = "package/hintfile/ld/dlext/d_stdstdio/"
167 $ cnfg_keys = cnfg_keys + "usevfork/usemymalloc/so/libpth/"
168 $ cnfg_keys = cnfg_keys + "dlsrc/cccdlflags/ccdlflags/lddlflags/"
170 $ cnfg_vars = "$package/$hint/$ld/$dlext/$d_stdstdio/"
171 $ cnfg_vars = cnfg_vars + "$usevfork/$usemymalloc/$so/$libpth/"
172 $ cnfg_vars = cnfg_vars + "$dlsrc/$cccdlflags/$ccdlflags/$lddlflags/"
174 $ open/read RATHER_LONG_CONFIG_FILE_HANDLE 'RATHER_LONG_FILENAME_SEARCH'
176 $ read/end_of_file = Genconfig_pl_Done RATHER_LONG_CONFIG_FILE_HANDLE line
177 $ if f$locate("=",line).ne.f$length(line) !then may be an assigment
179 $ name = f$edit( f$extract(0,f$locate("=",line),line), "COLLAPSE")
182 $ key = f$element(num,"/",cnfg_keys)
183 $ if (key .nes. "/").and.(key .nes. "") !not end of cnfg_keys
185 $ if key.eqs.name !then is key
187 $ start = f$locate("=",line)+1
188 $ stop = f$length(line)
189 $ value = f$extract(start,stop-start,line)
190 $ var = f$element(num,"/",cnfg_vars)
192 $ cnfg_keys = cnfg_keys - ("''name'/" ) !trim to shorten future matches
193 $ cnfg_vars = cnfg_vars - ("''var'/" ) !trim to shorten future matches
196 $ goto key_genconfig_pl
197 $ endif ! not end of cnfg_keys
198 $ endif ! then may be an assigment
199 $ goto read_genconfig_pl
202 $ close RATHER_LONG_CONFIG_FILE_HANDLE
203 $ if cnfg_vars.nes.""
205 $ echo "warning: the following variables were not found in ''RATHER_LONG_FILENAME_TO_FIND':"
206 $ echo "''cnfg_vars'"
209 $ if (p8.nes."").and.($ld.nes."") then $ld = $ld + " DBG='"+p8+"'"
211 $look_for_config_vms:
212 $ RATHER_LONG_FILENAME_TO_FIND = "''genconfig_pl_dir'CONFIG.VMS"
214 $Research_config_vms:
215 $ RATHER_LONG_FILENAME_SEARCH = F$Search(RATHER_LONG_FILENAME_TO_FIND)
216 $ if RATHER_LONG_FILENAME_SEARCH.EQS.""
218 $ if f$parse(f$environment("DEFAULT"),,,"DIRECTORY",).NES."[000000]"
221 $ goto Research_config_vms
223 $ ECHO "Can't find the perl config.vms used to make config.sh"
224 $ set default 'RATHER_LONG_DEFAULT_DIRECTORY_NAME'
230 $ cnfg_keys = "MEM_ALIGNBYTES/CASTNEGFLOAT/CASTFLAGS/RANDBITS/STDCHAR/"
231 $ cnfg_keys = cnfg_keys+"CASTI32/INTSIZE/VOIDFLAGS/DLSYM_NEEDS_UNDERSCORE"
233 $ cnfg_vars = "$alignbytes/$d_castneg/$castflags/$randbits/$stdchar/"
234 $ cnfg_vars = cnfg_vars+"$d_casti32/$intsize/$voidflags/$d_dlsymun/"
236 $ open/read RATHER_LONG_CONFIG_FILE_HANDLE 'RATHER_LONG_FILENAME_SEARCH'
238 $ read/end_of_file = config_vms_Done RATHER_LONG_CONFIG_FILE_HANDLE line
239 $! look for "#define" or "#undef"
240 $ if (f$length(line).ne.0).and.-
241 ((f$locate("#define",line).eq.0).or.(f$locate("#undef",line).eq.0))
243 $ line = f$edit(line,"COMPRESS, TRIM")
244 $ name = f$element(1," ",line) !macro
247 $ key = f$element(num,"/",cnfg_keys)
248 $ if (key .nes. "/").and.(key .nes. "") !not end of cnfg_keys
250 $ if key.eqs.name !then is key
252 $ var = f$element(num,"/",cnfg_vars)
253 $ cnfg_keys = cnfg_keys - ("''name'/" ) !trim to shorten future matches
254 $ cnfg_vars = cnfg_vars - ("''var'/" ) !trim to shorten future matches
255 $ if (f$locate("#undef",line).eq.0)
260 $ start = f$locate("/*",line)
261 $ if start.ne.f$length(line) !comment started
263 $ if f$locate("*/",line).ne.f$length(line) !comment stopped
264 $ then stop = f$locate("*/",line)+2
265 $ else stop = f$locate("*/",line)
267 $ comment = f$extract(start,stop-start,line)
268 $ line = line - comment
271 $ line = f$edit(line,"TRIM")
272 $ start = f$locate(key,line)+f$length(key)
273 $ stop = f$length(line)
274 $ value = f$edit(f$extract(start,stop-start,line),"TRIM")
277 $ 'var' = "'"+value+"'"
282 $ endif ! is key of interest
284 $ goto key_config_vms
285 $ endif ! not end of cnfg_keys
286 $ endif ! then may be #define or #undef of interest
287 $ goto read_config_vms
290 $ close RATHER_LONG_CONFIG_FILE_HANDLE
291 $ if cnfg_vars.nes.""
293 $ echo "warning: the following variables were not found in ''RATHER_LONG_FILENAME_TO_FIND':"
294 $ echo "''cnfg_vars'"
298 $! $spitshell = ECHO !<<!GROK!THIS!
300 $ ECHO "Summary of my ''$package' (version ''$PATCHLEVEL' subversion ''$SUBVERSION') configuration:"
302 $ ECHO " osname=''$osname', osvers=''$osvers', archname=''$archname'"
303 $ ECHO " uname=''$myuname'" !->d_has_uname?
304 $ ECHO " hint=''$hint' d_sigaction='undef'" !->hintfile?
305 $ ECHO " static exts=''$staticexts'" ! added for VMS
307 $ ECHO " cc=''$cc', optimize=''$optimize', ld=''$ld'"
308 $ ECHO " cppflags=''$cppflags'"
309 $ ECHO " ccflags =''$ccflags'" !->vms_cc_type?
310 $ ECHO " ldflags =''$ldflags'"
311 $ ECHO " stdchar=''$stdchar', d_stdstdio=''$d_stdstdio', usevfork=''$usevfork'"
312 $ ECHO " voidflags=''$voidflags', castflags=''$castflags', d_casti32=''$d_casti32', d_castneg=''$d_castneg'"
313 $ ECHO " intsize=''$intsize', alignbytes=''$alignbytes', usemymalloc=''$usemymalloc', randbits=''$randbits'"
316 $ ECHO " libpth=''$libpth'"
317 $ ECHO " libs=''$libs'"
318 $ ECHO " libc=''$libc'"
319 $ ECHO " Dynamic Linking:"
320 $ ECHO " dlsrc=''$dlsrc', dlext=''$dlext', d_dlsymun=''$d_dlsymun'"
321 $ ECHO " cccdlflags=''$cccdlflags', ccdlflags=''$ccdlflags', lddlflags=''$lddlflags'"
324 $ SET DEFAULT 'RATHER_LONG_DEFAULT_DIRECTORY_NAME'