perl 5.000
[p5sagit/p5-mst-13.2.git] / vms / genconfig.pl
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
11 unshift(@INC,'lib');  # In case someone didn't define Perl_Root
12                       # before the build
13 require 'ctime.pl' || die "Couldn't execute ctime.pl: $!\n";
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";
29 select OUT;
30
31
32 $time = &ctime(time());
33 print <<EndOfIntro;
34 # This file generated by GenConfig.pl on a VMS system.
35 # Input obtained from:
36 #     $infile
37 #     $0
38 # Time: $time
39
40 EndOfIntro
41
42 while (<IN>) {  # roll through the comment header in Config.VMS
43   last if /^#define _config_h_/;
44 }
45
46 while (<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 }
67 close IN;
68
69 while (<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.
85 osname=VMS  # DO NOT CHANGE THIS! Tests elsewhere depend on this to identify
86             # VMS.  Use the 'arch' item below to specify hardware version.
87 CONFIG=true
88 PATCHLEVEL=0
89 dldir=/ext/dl
90 dlobj=dl_vms.obj
91 dlsrc=dl_vms.c
92 so=exe
93 dlext=exe
94 libpth=/sys$share /sys$library
95 hintfile=
96 intsize=4
97 alignbytes=8
98 shrplib=define
99 signal_t=void
100 timetype=long
101 usemymalloc=n
102 builddir=perl_root:[000000]
103
104 # The definitions in this block are site-specific, and will probably need to
105 # be changed on most systems.
106 myhostname=nowhere.loopback.edu
107 arch=VAX
108 osvers=5.5-2
109 cppflags=/Define=(DEBUGGING)
110 d_vms_do_sockets=undef  #=define if perl5 built with socket support
111 d_has_sockets=undef  # This should have the same value as d_vms_do_sockets
112 libs=  # This should list RTLs other than the C RTL and IMAGELIB (e.g. socket RTL)