perl 5.000
[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
6# that went into your perl binary.
7#
8# Rev. 30-Sep-1994 Charles Bailey bailey@genetics.upenn.edu
9#
10
11unshift(@INC,'lib'); # In case someone didn't define Perl_Root
12 # before the build
13require 'ctime.pl' || die "Couldn't execute ctime.pl: $!\n";
14
15if (-f "config.vms") { $infile = "config.vms"; $outdir = "[-]"; }
16elsif (-f "[.vms]config.vms") { $infile = "[.vms]config.vms"; $outdir = "[]"; }
17elsif (-f "config.h") { $infile = "config.h"; $outdir = "[]";}
18
19if ($infile) { print "Generating Config.sh from $infile . . .\n"; }
20else { die <<EndOfGasp;
21Can'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.
24EndOfGasp
25}
26$outdir = '';
27open(IN,"$infile") || die "Can't open $infile: $!\n";
28open(OUT,">${outdir}Config.sh") || die "Can't open ${outdir}Config.sh: $!\n";
29select OUT;
30
31
32$time = &ctime(time());
33print <<EndOfIntro;
34# This file generated by GenConfig.pl on a VMS system.
35# Input obtained from:
36# $infile
37# $0
38# Time: $time
39
40EndOfIntro
41
42while (<IN>) { # roll through the comment header in Config.VMS
43 last if /^#define _config_h_/;
44}
45
46while (<IN>) {
47 chop;
48 while (/\\\s*$/) { # pick up contination lines
49 my $line = $_;
50 $line =~ s/\\\s*$//;
51 $_ = <IN>;
52 s/^\s*//;
53 $_ = $line . $_;
54 }
55 next unless my ($blocked,$un,$token,$val) = m%(\/\*)?\s*\#\s*(un)?def\w*\s*([A-za-z0-9]\w+)\S*\s*(.*)%;
56 next if /config-skip/;
57 $state = ($blocked || $un) ? 'undef' : 'define';
58 $token =~ tr/A-Z/a-z/;
59 $val =~ s%/\*.*\*/\s*%%g; $val =~ s/\s*$//; # strip off trailing comment
60 $val =~ s/^"//; $val =~ s/"$//; # remove end quotes
61 $val =~ s/","/ /g; # make signal list look nice
62 if ($val) { print "$token=\'$val\'\n"; }
63 else {
64 $token = "d_$token" unless $token =~ /^i_/;
65 print "$token=\'$state\'\n"; }
66}
67close IN;
68
69while (<DATA>) {
70 next if /^\s*#/ or /^\s*$/;
71 s/#.*$//; s/\s*$//;
72 ($key,$val) = split('=',$_,2);
73 print "$key=\'$val\'\n";
74}
75
76__END__
77
78# This list is incomplete in comparison to what ends up in config.sh, but
79# should contain the essentials. Some of these definitions reflect
80# options chosen when building perl or site-specific data; these should
81# be hand-edited appropriately. Someday, perhaps, we'll get this automated.
82
83# The definitions in this block are constant across most systems, and
84# should only rarely need to be changed.
85osname=VMS # DO NOT CHANGE THIS! Tests elsewhere depend on this to identify
86 # VMS. Use the 'arch' item below to specify hardware version.
87CONFIG=true
88PATCHLEVEL=0
89dldir=/ext/dl
90dlobj=dl_vms.obj
91dlsrc=dl_vms.c
92so=exe
93dlext=exe
94libpth=/sys$share /sys$library
95hintfile=
96intsize=4
97alignbytes=8
98shrplib=define
99signal_t=void
100timetype=long
101usemymalloc=n
102builddir=perl_root:[000000]
103
104# The definitions in this block are site-specific, and will probably need to
105# be changed on most systems.
106myhostname=nowhere.loopback.edu
107arch=VAX
108osvers=5.5-2
109cppflags=/Define=(DEBUGGING)
110d_vms_do_sockets=undef #=define if perl5 built with socket support
111d_has_sockets=undef # This should have the same value as d_vms_do_sockets
112libs= # This should list RTLs other than the C RTL and IMAGELIB (e.g. socket RTL)