Commit | Line | Data |
a0d0e21e |
1 | #!/usr/bin/perl |
2 | # Habit . . . |
3 | # |
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 |
748a9306 |
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. |
a0d0e21e |
8 | # |
e518068a |
9 | # Rev. 13-Dec-1995 Charles Bailey bailey@genetics.upenn.edu |
a0d0e21e |
10 | # |
11 | |
12 | unshift(@INC,'lib'); # In case someone didn't define Perl_Root |
13 | # before the build |
a0d0e21e |
14 | |
15 | if (-f "config.vms") { $infile = "config.vms"; $outdir = "[-]"; } |
16 | elsif (-f "[.vms]config.vms") { $infile = "[.vms]config.vms"; $outdir = "[]"; } |
17 | elsif (-f "config.h") { $infile = "config.h"; $outdir = "[]";} |
18 | |
19 | if ($infile) { print "Generating Config.sh from $infile . . .\n"; } |
20 | else { die <<EndOfGasp; |
21 | Can't find config.vms or config.h to read! |
22 | Please run this script from the perl source directory or |
23 | the VMS subdirectory in the distribution. |
24 | EndOfGasp |
25 | } |
26 | $outdir = ''; |
27 | open(IN,"$infile") || die "Can't open $infile: $!\n"; |
28 | open(OUT,">${outdir}Config.sh") || die "Can't open ${outdir}Config.sh: $!\n"; |
a0d0e21e |
29 | |
e518068a |
30 | $time = localtime; |
748a9306 |
31 | print OUT <<EndOfIntro; |
a0d0e21e |
32 | # This file generated by GenConfig.pl on a VMS system. |
33 | # Input obtained from: |
34 | # $infile |
35 | # $0 |
36 | # Time: $time |
37 | |
e518068a |
38 | package='perl5' |
39 | CONFIG='true' |
40 | cf_time='$time' |
41 | osname='VMS' |
42 | ld='Link' |
43 | lddlflags='/Share' |
44 | libc='' |
45 | ranlib='' |
46 | ar='' |
47 | eunicefix=':' |
48 | hintfile='' |
49 | intsize='4' |
50 | alignbytes='8' |
51 | shrplib='define' |
52 | usemymalloc='n' |
a0d0e21e |
53 | EndOfIntro |
54 | |
e518068a |
55 | $cf_by = (getpwuid($<))[0]; |
56 | print OUT "cf_by='$cf_by'\nperladmin='$cf_by'\n"; |
57 | |
58 | $hw_model = `Write Sys\$Output F\$GetSyi("HW_MODEL")`; |
59 | chomp $hw_model; |
60 | if ($hw_model > 1024) { |
61 | print OUT "arch='VMS_AXP'\n"; |
62 | print OUT "archname='VMS_AXP'\n"; |
63 | $archsufx = "AXP"; |
64 | } |
65 | else { |
66 | print OUT "arch='VMS_VAX'\n"; |
67 | print OUT "archname='VMS_VAX'\n"; |
68 | $archsufx = 'VAX'; |
69 | } |
70 | $osvers = `Write Sys\$Output F\$GetSyi("VERSION")`; |
71 | $osvers =~ s/^V(\S+)\s*\n?$/$1/; |
72 | print OUT "osvers='$osvers'\n"; |
748a9306 |
73 | foreach (@ARGV) { |
74 | ($key,$val) = split('=',$_,2); |
e518068a |
75 | if ($key eq 'cc') { # Figure out which C compiler we're using |
76 | if (`$val/NoObject/NoList _nla0:/Version` =~ /GNU/) { |
77 | print OUT "vms_cc_type='gcc'\n"; |
78 | print OUT "d_attribut='define'\n"; |
79 | } |
80 | elsif ($archsufx eq 'VAX' && |
81 | `$val/NoObject/NoList /prefix=all _nla0:` =~ /IVQUAL/) { |
82 | print OUT "vms_cc_type='vaxc'\n"; |
83 | print OUT "d_attribut='undef'\n"; |
84 | } |
85 | else { |
86 | print OUT "vms_cc_type='decc'\n"; |
87 | print OUT "d_attribut='undef'\n"; |
88 | # DECC for VAX requires filename in /object qualifier, so we |
89 | # have to remove it here. Alas, this means we lose the user's |
90 | # object file suffix if it's not .obj. |
91 | $val =~ s#/obj(?:ect)?=[^/\s]+##i if $archsufx eq 'VAX';; |
92 | } |
93 | } |
748a9306 |
94 | print OUT "$key=\'$val\'\n"; |
e518068a |
95 | if ($val =~/VMS_DO_SOCKETS/i) { |
96 | $dosock = 1; |
97 | # Are there any other logicals which TCP/IP stacks use for the host name? |
98 | $myname = $ENV{'ARPANET_HOST_NAME'} || $ENV{'INTERNET_HOST_NAME'} || |
99 | $ENV{'MULTINET_HOST_NAME'} || $ENV{'UCX$INET_HOST'} || |
100 | $ENV{'TCPWARE_DOMAINNAME'} || $ENV{'NEWS_ADDRESS'}; |
101 | if (!$myname) { |
102 | ($myname) = `hostname` =~ /^(\S+)/; |
103 | if ($myname =~ /IVVERB/) { |
104 | warn "Can't determine TCP/IP hostname; skipping \$Config{'myhostname'}"; |
105 | } |
106 | } |
107 | print OUT "myhostname='$myname'\n" if $myname; |
108 | } |
748a9306 |
109 | } |
e518068a |
110 | if (!$dosock) { print OUT "myhostname='$ENV{'SYS$NODE'}'\n"; } |
748a9306 |
111 | |
a0d0e21e |
112 | while (<IN>) { # roll through the comment header in Config.VMS |
e518068a |
113 | last if /config-start/; |
a0d0e21e |
114 | } |
115 | |
116 | while (<IN>) { |
117 | chop; |
118 | while (/\\\s*$/) { # pick up contination lines |
119 | my $line = $_; |
120 | $line =~ s/\\\s*$//; |
121 | $_ = <IN>; |
122 | s/^\s*//; |
123 | $_ = $line . $_; |
124 | } |
125 | next unless my ($blocked,$un,$token,$val) = m%(\/\*)?\s*\#\s*(un)?def\w*\s*([A-za-z0-9]\w+)\S*\s*(.*)%; |
126 | next if /config-skip/; |
127 | $state = ($blocked || $un) ? 'undef' : 'define'; |
128 | $token =~ tr/A-Z/a-z/; |
e518068a |
129 | $token =~ s/_exp$/exp/; # Config.pm has 'privlibexp' etc. where config.h |
130 | # has 'privlib_exp' etc. |
a0d0e21e |
131 | $val =~ s%/\*.*\*/\s*%%g; $val =~ s/\s*$//; # strip off trailing comment |
132 | $val =~ s/^"//; $val =~ s/"$//; # remove end quotes |
133 | $val =~ s/","/ /g; # make signal list look nice |
748a9306 |
134 | if ($val) { print OUT "$token=\'$val\'\n"; } |
a0d0e21e |
135 | else { |
136 | $token = "d_$token" unless $token =~ /^i_/; |
e518068a |
137 | print OUT "$token='$state'\n"; |
748a9306 |
138 | } |
a0d0e21e |
139 | } |
140 | close IN; |
141 | |
142 | while (<DATA>) { |
143 | next if /^\s*#/ or /^\s*$/; |
144 | s/#.*$//; s/\s*$//; |
145 | ($key,$val) = split('=',$_,2); |
748a9306 |
146 | print OUT "$key='$val'\n"; |
147 | eval "\$$key = '$val'"; |
148 | } |
149 | # Add in some of the architecture-dependent stuff which has to be consistent |
150 | print OUT "d_vms_do_sockets=",$dosock ? "'define'\n" : "'undef'\n"; |
151 | print OUT "d_has_sockets=",$dosock ? "'define'\n" : "'undef'\n"; |
748a9306 |
152 | $archlib = &VMS::Filespec::vmspath($privlib); |
153 | $archlib =~ s#\]#.VMS_$archsufx\]#; |
154 | $installarchlib = &VMS::Filespec::vmspath($installprivlib); |
155 | $installarchlib =~ s#\]#.VMS_$archsufx\]#; |
156 | print OUT "archlib='$archlib'\n"; |
e518068a |
157 | print OUT "archlibexp='$archlib'\n"; |
748a9306 |
158 | print OUT "installarchlib='$installarchlib'\n"; |
a0d0e21e |
159 | |
e518068a |
160 | if (open(OPT,"${outdir}crtl.opt")) { |
161 | while (<OPT>) { |
162 | next unless m#/(sha|lib)#i; |
163 | chomp; |
164 | push(@libs,$_); |
165 | } |
166 | close OPT; |
167 | print OUT "libs='",join(' ',@libs),"'\n"; |
168 | } |
169 | else { warn "Can't read ${outdir}crtl.opt - skipping \$Config{'libs'}"; } |
170 | |
171 | # simple pager support for perldoc |
172 | if (`most nl:` =~ /IVVERB/) { |
173 | $pager = 'more'; |
174 | if (`more nl:` =~ /IVVERB/) { $pager = 'type/page'; } |
175 | } |
176 | else { $pager = 'most'; } |
177 | print OUT "pager='$pager'\n"; |
178 | |
179 | close OUT; |
a0d0e21e |
180 | __END__ |
181 | |
182 | # This list is incomplete in comparison to what ends up in config.sh, but |
183 | # should contain the essentials. Some of these definitions reflect |
184 | # options chosen when building perl or site-specific data; these should |
185 | # be hand-edited appropriately. Someday, perhaps, we'll get this automated. |
186 | |
187 | # The definitions in this block are constant across most systems, and |
188 | # should only rarely need to be changed. |
e518068a |
189 | PATCHLEVEL=002 |
748a9306 |
190 | ccdlflags= |
191 | cccdlflags= |
748a9306 |
192 | usedl=true |
a0d0e21e |
193 | dlobj=dl_vms.obj |
194 | dlsrc=dl_vms.c |
e518068a |
195 | d_dlsymun=undef |
a0d0e21e |
196 | so=exe |
197 | dlext=exe |
198 | libpth=/sys$share /sys$library |
e518068a |
199 | d_stdstdio=undef |
200 | usevfork=false |
201 | castflags=0 |
202 | d_castneg=define # should be same as d_castnegfloat from config.vms |
a0d0e21e |
203 | signal_t=void |
204 | timetype=long |
a0d0e21e |
205 | builddir=perl_root:[000000] |
e518068a |
206 | prefix=perl_root |
748a9306 |
207 | installprivlib=perl_root:[lib] |
208 | privlib=perl_root:[lib] |
209 | installbin=perl_root:[000000] |
e518068a |
210 | installman1dir=perl_root:[man.man1] |
211 | installman3dir=perl_root:[man.man3] |
212 | man1ext=.rno |
213 | man3ext=.rno |
214 | binexp=perl_root:[000000] # should be same as installbin |