4 # Extract info from Config.VMS, and add extra data here, to generate Config.sh
5 # Edit the static information after __END__ to reflect your site and options
6 # that went into your perl binary. In addition, values which change from run
7 # to run may be supplied on the command line as key=val pairs.
9 # Rev. 13-Dec-1995 Charles Bailey bailey@genetics.upenn.edu
12 unshift(@INC,'lib'); # In case someone didn't define Perl_Root
15 if ($ARGV[0] eq '-f') {
16 open(ARGS,$ARGV[1]) or die "Can't read data from $ARGV[1]: $!\n";
19 push(@ARGV,split(/\|/,$_));
24 if (-f "config.vms") { $infile = "config.vms"; $outdir = "[-]"; }
25 elsif (-f "[.vms]config.vms") { $infile = "[.vms]config.vms"; $outdir = "[]"; }
26 elsif (-f "config.h") { $infile = "config.h"; $outdir = "[]";}
28 if ($infile) { print "Generating Config.sh from $infile . . .\n"; }
29 else { die <<EndOfGasp;
30 Can't find config.vms or config.h to read!
31 Please run this script from the perl source directory or
32 the VMS subdirectory in the distribution.
36 open(IN,"$infile") || die "Can't open $infile: $!\n";
37 open(OUT,">${outdir}Config.sh") || die "Can't open ${outdir}Config.sh: $!\n";
40 print OUT <<EndOfIntro;
41 # This file generated by GenConfig.pl on a VMS system.
42 # Input obtained from:
61 spitshell='write sys\$output '
64 $cf_by = (getpwuid($<))[0];
65 print OUT "cf_by='$cf_by'\n";
67 $hw_model = `Write Sys\$Output F\$GetSyi("HW_MODEL")`;
69 if ($hw_model > 1024) {
70 print OUT "arch='VMS_AXP'\n";
71 print OUT "archname='VMS_AXP'\n";
75 print OUT "arch='VMS_VAX'\n";
76 print OUT "archname='VMS_VAX'\n";
79 $osvers = `Write Sys\$Output F\$GetSyi("VERSION")`;
80 $osvers =~ s/^V?(\S+)\s*\n?$/$1/;
81 print OUT "osvers='$osvers'\n";
83 ($key,$val) = split('=',$_,2);
84 if ($key eq 'cc') { # Figure out which C compiler we're using
85 my($cc,$ccflags) = split('/',$val,2);
87 $ccflags = "/$ccflags";
88 if ($ccflags =~s!/DECC!!ig) {
93 elsif ($ccflags =~s!/VAXC!!ig) {
98 elsif (`$val/NoObject/NoList _nla0:/Version` =~ /GNU/) {
102 elsif ($archsufx eq 'VAX' &&
103 `$val/NoObject/NoList /prefix=all _nla0:` =~ /IVQUAL/) {
111 print OUT "vms_cc_type='$cctype'\n";
112 print OUT "d_attribut='$d_attr'\n";
113 print OUT "cc='$cc'\n";
114 if ( ($cctype eq 'decc' and $archsufx eq 'VAX') || $cctype eq 'gcc') {
115 # gcc and DECC for VAX requires filename in /object qualifier, so we
116 # have to remove it here. Alas, this means we lose the user's
117 # object file suffix if it's not .obj.
118 $ccflags =~ s#/obj(?:ect)?=[^/\s]+##i;
120 print OUT "ccflags='$ccflags'\n";
121 $dosock = ($ccflags =~ m!/DEF[^/]+VMS_DO_SOCKETS!i and
122 $ccflags !~ m!/UND[^/]+VMS_DO_SOCKETS!i);
125 print OUT "$key=\'$val\'\n";
128 # Are there any other logicals which TCP/IP stacks use for the host name?
129 $myname = $ENV{'ARPANET_HOST_NAME'} || $ENV{'INTERNET_HOST_NAME'} ||
130 $ENV{'MULTINET_HOST_NAME'} || $ENV{'UCX$INET_HOST'} ||
131 $ENV{'TCPWARE_DOMAINNAME'} || $ENV{'NEWS_ADDRESS'};
133 ($myname) = `hostname` =~ /^(\S+)/;
134 if ($myname =~ /IVVERB/) {
135 warn "Can't determine TCP/IP hostname" if $dosock;
139 $myname = $ENV{'SYS$NODE'} unless $myname;
140 ($myhostname,$mydomain) = split(/\./,$myname,2);
141 print OUT "myhostname='$myhostname'\n" if $myhostname;
143 print OUT "mydomain='.$mydomain'\n";
144 print OUT "perladmin='$cf_by\@$myhostname.$mydomain'\n";
145 print OUT "cf_email='$cf_by\@$myhostname.$mydomain'\n";
148 print OUT "perladmin='$cf_by'\n";
149 print OUT "cf_email='$cf_by'\n";
151 chomp($hwname = `Write Sys\$Output F\$GetSyi("HW_NAME")`);
152 $hwname = $archsufx if $hwname =~ /IVKEYW/; # *really* old VMS version
153 print OUT "myuname='VMS $myname $osvers $hwname'\n";
155 while (<IN>) { # roll through the comment header in Config.VMS
156 last if /config-start/;
161 while (/\\\s*$/) { # pick up contination lines
168 next unless my ($blocked,$un,$token,$val) = m%^(\/\*)?\s*\#\s*(un)?def\w*\s*([A-za-z0-9]\w+)\S*\s*(.*)%;
169 next if /config-skip/;
170 $state = ($blocked || $un) ? 'undef' : 'define';
171 $token =~ tr/A-Z/a-z/;
172 $token =~ s/_exp$/exp/; # Config.pm has 'privlibexp' etc. where config.h
173 # has 'privlib_exp' etc.
174 # Fixup differences between Configure vars and config.h manifests
175 # This isn't comprehensize; we fix 'em as we need 'em.
176 $token = 'castneg' if $token eq 'castnegfloat';
177 $token = 'dlsymun' if $token eq 'dlsym_needs_underscore';
178 $token = 'stdstdio' if $token eq 'use_stdio_ptr';
179 $token = 'stdiobase' if $token eq 'use_stdio_base';
180 $val =~ s%/\*.*\*/\s*%%g; $val =~ s/\s*$//; # strip off trailing comment
181 $val =~ s/^"//; $val =~ s/"$//; # remove end quotes
182 $val =~ s/","/ /g; # make signal list look nice
183 if ($val) { print OUT "$token=\'$val\'\n"; }
185 $token = "d_$token" unless $token =~ /^i_/;
186 print OUT "$token='$state'\n";
192 next if /^\s*#/ or /^\s*$/;
194 ($key,$val) = split('=',$_,2);
195 print OUT "$key='$val'\n";
196 eval "\$$key = '$val'";
198 # Add in some of the architecture-dependent stuff which has to be consistent
199 print OUT "d_vms_do_sockets=",$dosock ? "'define'\n" : "'undef'\n";
200 print OUT "d_has_sockets=",$dosock ? "'define'\n" : "'undef'\n";
201 $archlib = &VMS::Filespec::vmspath($privlib);
202 $installarchlib = &VMS::Filespec::vmspath($installprivlib);
203 $sitearch = &VMS::Filespec::vmspath($sitelib);
204 $archlib =~ s#\]#.VMS_$archsufx\]#;
205 $sitearch =~ s#\]#.VMS_$archsufx\]#;
206 print OUT "oldarchlib='$archlib'\n";
207 print OUT "oldarchlibexp='$archlib'\n";
208 ($vers = $]) =~ tr/./_/;
209 $archlib =~ s#\]#.$vers\]#;
210 $installarchlib =~ s#\]#.VMS_$archsufx.$vers\]#;
211 print OUT "archlib='$archlib'\n";
212 print OUT "archlibexp='$archlib'\n";
213 print OUT "installarchlib='$installarchlib'\n";
214 print OUT "sitearch='$sitearch'\n";
215 print OUT "sitearchexp='$sitearch'\n";
217 if (open(OPT,"${outdir}crtl.opt")) {
219 next unless m#/(sha|lib)#i;
221 if (/crtl/i || /gcclib/i) { push(@crtls,$_); }
222 else { push(@libs,$_); }
225 print OUT "libs='",join(' ',@libs),"'\n";
226 push(@crtls,'(DECCRTL)') if $cctype eq 'decc';
227 print OUT "libc='",join(' ',@crtls),"'\n";
229 else { warn "Can't read ${outdir}crtl.opt - skipping 'libs' & 'libc'"; }
231 if (open(PL,"${outdir}patchlevel.h")) {
233 if (/^#define PATCHLEVEL\s+(\S+)/) { print OUT "PATCHLEVEL='$1'\n"; }
234 elsif (/^#define SUBVERSION\s+(\S+)/) { print OUT "SUBVERSION='$1'\n"; }
238 else { warn "Can't read ${outdir}patchlevel.h - skipping 'PATCHLEVEL'"; }
240 # simple pager support for perldoc
241 if (`most` =~ /IVVERB/) {
243 if (`more nl:` =~ /IVVERB/) { $pager = 'type/page'; }
245 else { $pager = 'most'; }
246 print OUT "pager='$pager'\n";
251 # This list is incomplete in comparison to what ends up in config.sh, but
252 # should contain the essentials. Some of these definitions reflect
253 # options chosen when building perl or site-specific data; these should
254 # be hand-edited appropriately. Someday, perhaps, we'll get this automated.
256 # The definitions in this block are constant across most systems, and
257 # should only rarely need to be changed.
265 libpth=/sys$share /sys$library
270 builddir=perl_root:[000000]
272 installprivlib=perl_root:[lib] # The *lib constants should match the
273 privlib=perl_root:[lib] # equivalent *(?:ARCH)LIB_EXP constants
274 sitelib=perl_root:[lib.site_perl] # in config.h
275 installbin=perl_root:[000000]
276 installman1dir=perl_root:[man.man1]
277 installman3dir=perl_root:[man.man3]
280 binexp=perl_root:[000000] # should be same as installbin