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 | # |
748a9306 |
9 | # Rev. 08-Mar-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 |
14 | require 'ctime.pl' || die "Couldn't execute ctime.pl: $!\n"; |
15 | |
16 | if (-f "config.vms") { $infile = "config.vms"; $outdir = "[-]"; } |
17 | elsif (-f "[.vms]config.vms") { $infile = "[.vms]config.vms"; $outdir = "[]"; } |
18 | elsif (-f "config.h") { $infile = "config.h"; $outdir = "[]";} |
19 | |
20 | if ($infile) { print "Generating Config.sh from $infile . . .\n"; } |
21 | else { die <<EndOfGasp; |
22 | Can't find config.vms or config.h to read! |
23 | Please run this script from the perl source directory or |
24 | the VMS subdirectory in the distribution. |
25 | EndOfGasp |
26 | } |
27 | $outdir = ''; |
28 | open(IN,"$infile") || die "Can't open $infile: $!\n"; |
29 | open(OUT,">${outdir}Config.sh") || die "Can't open ${outdir}Config.sh: $!\n"; |
a0d0e21e |
30 | |
31 | $time = &ctime(time()); |
748a9306 |
32 | print OUT <<EndOfIntro; |
a0d0e21e |
33 | # This file generated by GenConfig.pl on a VMS system. |
34 | # Input obtained from: |
35 | # $infile |
36 | # $0 |
37 | # Time: $time |
38 | |
39 | EndOfIntro |
40 | |
748a9306 |
41 | foreach (@ARGV) { |
42 | ($key,$val) = split('=',$_,2); |
43 | print OUT "$key=\'$val\'\n"; |
44 | if ($val =~/VMS_DO_SOCKETS/) { $dosock = 1; } |
45 | } |
46 | |
a0d0e21e |
47 | while (<IN>) { # roll through the comment header in Config.VMS |
48 | last if /^#define _config_h_/; |
49 | } |
50 | |
51 | while (<IN>) { |
52 | chop; |
53 | while (/\\\s*$/) { # pick up contination lines |
54 | my $line = $_; |
55 | $line =~ s/\\\s*$//; |
56 | $_ = <IN>; |
57 | s/^\s*//; |
58 | $_ = $line . $_; |
59 | } |
60 | next unless my ($blocked,$un,$token,$val) = m%(\/\*)?\s*\#\s*(un)?def\w*\s*([A-za-z0-9]\w+)\S*\s*(.*)%; |
61 | next if /config-skip/; |
62 | $state = ($blocked || $un) ? 'undef' : 'define'; |
63 | $token =~ tr/A-Z/a-z/; |
64 | $val =~ s%/\*.*\*/\s*%%g; $val =~ s/\s*$//; # strip off trailing comment |
65 | $val =~ s/^"//; $val =~ s/"$//; # remove end quotes |
66 | $val =~ s/","/ /g; # make signal list look nice |
748a9306 |
67 | if ($val) { print OUT "$token=\'$val\'\n"; } |
a0d0e21e |
68 | else { |
69 | $token = "d_$token" unless $token =~ /^i_/; |
748a9306 |
70 | print OUT "$token=\'$state\'\n"; |
71 | } |
a0d0e21e |
72 | } |
73 | close IN; |
74 | |
75 | while (<DATA>) { |
76 | next if /^\s*#/ or /^\s*$/; |
77 | s/#.*$//; s/\s*$//; |
78 | ($key,$val) = split('=',$_,2); |
748a9306 |
79 | print OUT "$key='$val'\n"; |
80 | eval "\$$key = '$val'"; |
81 | } |
82 | # Add in some of the architecture-dependent stuff which has to be consistent |
83 | print OUT "d_vms_do_sockets=",$dosock ? "'define'\n" : "'undef'\n"; |
84 | print OUT "d_has_sockets=",$dosock ? "'define'\n" : "'undef'\n"; |
85 | $osvers = `Write Sys\$Output F\$GetSyi("VERSION")`; |
86 | chomp $osvers; |
87 | $osvers =~ s/^V//; |
88 | print OUT "osvers='$osvers'\n"; |
89 | $hw_model = `Write Sys\$Output F\$GetSyi("HW_MODEL")`; |
90 | chomp $hw_model; |
91 | if ($hw_model > 1024) { |
92 | print OUT "arch='VMS_AXP'\n"; |
93 | print OUT "archname='VMS_AXP'\n"; |
94 | $archsufx = "AXP"; |
95 | } |
96 | else { |
97 | print OUT "arch='VMS_VAX'\n"; |
98 | print OUT "archname='VMS_VAX'\n"; |
99 | $archsufx = 'VAX'; |
a0d0e21e |
100 | } |
748a9306 |
101 | $archlib = &VMS::Filespec::vmspath($privlib); |
102 | $archlib =~ s#\]#.VMS_$archsufx\]#; |
103 | $installarchlib = &VMS::Filespec::vmspath($installprivlib); |
104 | $installarchlib =~ s#\]#.VMS_$archsufx\]#; |
105 | print OUT "archlib='$archlib'\n"; |
106 | print OUT "installarchlib='$installarchlib'\n"; |
a0d0e21e |
107 | |
108 | __END__ |
109 | |
110 | # This list is incomplete in comparison to what ends up in config.sh, but |
111 | # should contain the essentials. Some of these definitions reflect |
112 | # options chosen when building perl or site-specific data; these should |
113 | # be hand-edited appropriately. Someday, perhaps, we'll get this automated. |
114 | |
115 | # The definitions in this block are constant across most systems, and |
116 | # should only rarely need to be changed. |
117 | osname=VMS # DO NOT CHANGE THIS! Tests elsewhere depend on this to identify |
118 | # VMS. Use the 'arch' item below to specify hardware version. |
119 | CONFIG=true |
748a9306 |
120 | PATCHLEVEL=001 |
121 | ld=Link |
122 | lddlflags=/Share |
123 | ccdlflags= |
124 | cccdlflags= |
125 | libc= |
126 | ranlib= |
127 | eunicefix=: |
128 | usedl=true |
a0d0e21e |
129 | dldir=/ext/dl |
130 | dlobj=dl_vms.obj |
131 | dlsrc=dl_vms.c |
132 | so=exe |
133 | dlext=exe |
134 | libpth=/sys$share /sys$library |
135 | hintfile= |
136 | intsize=4 |
137 | alignbytes=8 |
138 | shrplib=define |
139 | signal_t=void |
140 | timetype=long |
141 | usemymalloc=n |
142 | builddir=perl_root:[000000] |
748a9306 |
143 | installprivlib=perl_root:[lib] |
144 | privlib=perl_root:[lib] |
145 | installbin=perl_root:[000000] |
a0d0e21e |
146 | |
147 | # The definitions in this block are site-specific, and will probably need to |
148 | # be changed on most systems. |
149 | myhostname=nowhere.loopback.edu |
a0d0e21e |
150 | libs= # This should list RTLs other than the C RTL and IMAGELIB (e.g. socket RTL) |