Use fork if available.
[p5sagit/p5-mst-13.2.git] / vms / genconfig.pl
CommitLineData
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
12unshift(@INC,'lib'); # In case someone didn't define Perl_Root
13 # before the build
14require 'ctime.pl' || die "Couldn't execute ctime.pl: $!\n";
15
16if (-f "config.vms") { $infile = "config.vms"; $outdir = "[-]"; }
17elsif (-f "[.vms]config.vms") { $infile = "[.vms]config.vms"; $outdir = "[]"; }
18elsif (-f "config.h") { $infile = "config.h"; $outdir = "[]";}
19
20if ($infile) { print "Generating Config.sh from $infile . . .\n"; }
21else { die <<EndOfGasp;
22Can'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.
25EndOfGasp
26}
27$outdir = '';
28open(IN,"$infile") || die "Can't open $infile: $!\n";
29open(OUT,">${outdir}Config.sh") || die "Can't open ${outdir}Config.sh: $!\n";
a0d0e21e 30
31$time = &ctime(time());
748a9306 32print 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
39EndOfIntro
40
748a9306 41foreach (@ARGV) {
42 ($key,$val) = split('=',$_,2);
43 print OUT "$key=\'$val\'\n";
44 if ($val =~/VMS_DO_SOCKETS/) { $dosock = 1; }
45}
46
a0d0e21e 47while (<IN>) { # roll through the comment header in Config.VMS
48 last if /^#define _config_h_/;
49}
50
51while (<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}
73close IN;
74
75while (<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
83print OUT "d_vms_do_sockets=",$dosock ? "'define'\n" : "'undef'\n";
84print OUT "d_has_sockets=",$dosock ? "'define'\n" : "'undef'\n";
85$osvers = `Write Sys\$Output F\$GetSyi("VERSION")`;
86chomp $osvers;
87$osvers =~ s/^V//;
88print OUT "osvers='$osvers'\n";
89$hw_model = `Write Sys\$Output F\$GetSyi("HW_MODEL")`;
90chomp $hw_model;
91if ($hw_model > 1024) {
92 print OUT "arch='VMS_AXP'\n";
93 print OUT "archname='VMS_AXP'\n";
94 $archsufx = "AXP";
95}
96else {
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\]#;
105print OUT "archlib='$archlib'\n";
106print 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.
117osname=VMS # DO NOT CHANGE THIS! Tests elsewhere depend on this to identify
118 # VMS. Use the 'arch' item below to specify hardware version.
119CONFIG=true
748a9306 120PATCHLEVEL=001
121ld=Link
122lddlflags=/Share
123ccdlflags=
124cccdlflags=
125libc=
126ranlib=
127eunicefix=:
128usedl=true
a0d0e21e 129dldir=/ext/dl
130dlobj=dl_vms.obj
131dlsrc=dl_vms.c
132so=exe
133dlext=exe
134libpth=/sys$share /sys$library
135hintfile=
136intsize=4
137alignbytes=8
138shrplib=define
139signal_t=void
140timetype=long
141usemymalloc=n
142builddir=perl_root:[000000]
748a9306 143installprivlib=perl_root:[lib]
144privlib=perl_root:[lib]
145installbin=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.
149myhostname=nowhere.loopback.edu
a0d0e21e 150libs= # This should list RTLs other than the C RTL and IMAGELIB (e.g. socket RTL)