summaryrefslogtreecommitdiff
path: root/vms
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-07-18 08:06:32 +0000
committerCharles Bailey <bailey@genetics.upenn.edu>1996-07-18 08:06:32 +0000
commit7aa5c81fb93ce6741dd5751e93d46dc87d2c1c61 (patch)
treee07d0fee270dfb0267d1284ee3ce0d2dffeb7200 /vms
parentcbb1213b3e2a5834fb0d164ad498978e5d64cffd (diff)
downloadperl-7aa5c81fb93ce6741dd5751e93d46dc87d2c1c61.tar.gz
perl 5.003_01: vms/genconfig.pl
Move several values up to initial set of declarations Determine gcc version Add several socket-dependent values Add file-type values Use names of shell vars corresponding to cpp manifests, rather then the names of the manifests themselves Add d_eunice value, since Configure equates it with VMS :-( Eliminiate list of hand-configured values
Diffstat (limited to 'vms')
-rw-r--r--vms/genconfig.pl223
1 files changed, 128 insertions, 95 deletions
diff --git a/vms/genconfig.pl b/vms/genconfig.pl
index 336c24b8da..a1df9c1362 100644
--- a/vms/genconfig.pl
+++ b/vms/genconfig.pl
@@ -6,9 +6,17 @@
# that went into your perl binary. In addition, values which change from run
# to run may be supplied on the command line as key=val pairs.
#
-# Rev. 13-Dec-1995 Charles Bailey bailey@genetics.upenn.edu
+# Rev. 23-Apr-1996 Charles Bailey bailey@genetics.upenn.edu
#
+#==== Locations of installed Perl components
+$prefix='perl_root';
+$builddir="$prefix:[000000]";
+$installbin="$prefix:[000000]";
+$installman1dir="$prefix:[man.man1]";
+$installman3dir="$prefix:[man.man3]";
+$installprivlib="$prefix:[lib]";
+
unshift(@INC,'lib'); # In case someone didn't define Perl_Root
# before the build
@@ -37,6 +45,13 @@ open(IN,"$infile") || die "Can't open $infile: $!\n";
open(OUT,">${outdir}Config.sh") || die "Can't open ${outdir}Config.sh: $!\n";
$time = localtime;
+$cf_by = (getpwuid($<))[0];
+$archsufx = `Write Sys\$Output F\$GetSyi("HW_MODEL")` > 1024 ? 'AXP' : 'VAX';
+($vers = $]) =~ tr/./_/;
+$installarchlib = VMS::Filespec::vmspath($installprivlib);
+$installarchlib =~ s#\]#.VMS_$archsufx.$vers\]#;
+($osvers = `Write Sys\$Output F\$GetSyi("VERSION")`) =~ s/^V?(\S+)\s*\n?$/$1/;
+
print OUT <<EndOfIntro;
# This file generated by GenConfig.pl on a VMS system.
# Input obtained from:
@@ -47,6 +62,11 @@ print OUT <<EndOfIntro;
package='perl5'
CONFIG='true'
cf_time='$time'
+cf_by='$cf_by'
+ccdlflags=''
+cccdlflags=''
+mab=''
+libpth='/sys\$share /sys\$library'
ld='Link'
lddlflags='/Share'
ranlib=''
@@ -58,27 +78,25 @@ intsize='4'
alignbytes='8'
shrplib='define'
usemymalloc='n'
+usevfork='true'
+useposix='false'
spitshell='write sys\$output '
+dlsrc='dl_vms.c'
+binexp='$installbin'
+man1ext='rno'
+man3ext='rno'
+arch='VMS_$archsufx'
+archname='VMS_$archsufx'
+osvers='$osvers'
+prefix='$prefix'
+builddir='$builddir'
+installbin='$installbin'
+installman1dir='$installman1dir'
+installman3dir='$installman3dir'
+installprivlib='$installprivlib'
+installarchlib='$installarchlib'
EndOfIntro
-$cf_by = (getpwuid($<))[0];
-print OUT "cf_by='$cf_by'\n";
-
-$hw_model = `Write Sys\$Output F\$GetSyi("HW_MODEL")`;
-chomp $hw_model;
-if ($hw_model > 1024) {
- print OUT "arch='VMS_AXP'\n";
- print OUT "archname='VMS_AXP'\n";
- $archsufx = "AXP";
-}
-else {
- print OUT "arch='VMS_VAX'\n";
- print OUT "archname='VMS_VAX'\n";
- $archsufx = 'VAX';
-}
-$osvers = `Write Sys\$Output F\$GetSyi("VERSION")`;
-$osvers =~ s/^V?(\S+)\s*\n?$/$1/;
-print OUT "osvers='$osvers'\n";
foreach (@ARGV) {
($key,$val) = split('=',$_,2);
if ($key eq 'cc') { # Figure out which C compiler we're using
@@ -95,9 +113,10 @@ foreach (@ARGV) {
$cctype = 'vaxc';
$d_attr = 'undef';
}
- elsif (`$val/NoObject/NoList _nla0:/Version` =~ /GNU/) {
+ elsif (`$val/NoObject/NoList _nla0:/Version` =~ /GNU C version (\S+)/) {
$cctype = 'gcc';
$d_attr = 'define';
+ print OUT "gccversion='$1'\n";
}
elsif ($archsufx eq 'VAX' &&
`$val/NoObject/NoList /prefix=all _nla0:` =~ /IVQUAL/) {
@@ -120,9 +139,22 @@ foreach (@ARGV) {
print OUT "ccflags='$ccflags'\n";
$dosock = ($ccflags =~ m!/DEF[^/]+VMS_DO_SOCKETS!i and
$ccflags !~ m!/UND[^/]+VMS_DO_SOCKETS!i);
+ print OUT "d_vms_do_sockets=",$dosock ? "'define'\n" : "'undef'\n";
+ print OUT "d_socket=",$dosock ? "'define'\n" : "'undef'\n";
+ print OUT "d_sockpair=",$dosock ? "'define'\n" : "'undef'\n";
+ print OUT "d_gethent=",$dosock ? "'define'\n" : "'undef'\n";
+ print OUT "d_select=",$dosock ? "'define'\n" : "'undef'\n";
+ print OUT "i_niin=",$dosock ? "'define'\n" : "'undef'\n";
+ print OUT "i_neterrno=",$dosock ? "'define'\n" : "'undef'\n";
next;
}
- print OUT "$key=\'$val\'\n";
+ elsif ($key eq 'exe_ext') {
+ my($nodot) = $val;
+ $nodot =~ s!\.!!;
+ print OUT "so='$nodot'\ndlext='$nodot'\n";
+ }
+ elsif ($key eq 'obj_ext') { print OUT "dlobj='dl_vms$val'\n"; }
+ print OUT "$key='$val'\n";
}
# Are there any other logicals which TCP/IP stacks use for the host name?
@@ -152,6 +184,33 @@ chomp($hwname = `Write Sys\$Output F\$GetSyi("HW_NAME")`);
$hwname = $archsufx if $hwname =~ /IVKEYW/; # *really* old VMS version
print OUT "myuname='VMS $myname $osvers $hwname'\n";
+# Before we read the C header file, find out what config.sh constants are
+# equivalent to the C preprocessor macros
+if (open(SH,"${outdir}config_h.SH")) {
+ while (<SH>) {
+ next unless m%^#(?!if).*\$%;
+ s/^#//; s!(.*?)\s*/\*.*!$1!;
+ my(@words) = split;
+ $words[1] =~ s/\(.*//; # Clip off args from macro
+ # Did we use a shell variable for the preprocessor directive?
+ if ($words[0] =~ m!^\$(\w+)!) { $pp_vars{$words[1]} = $1; }
+ if (@words > 2) { # We may also have a shell var in the value
+ shift @words; # Discard preprocessor directive
+ my($token) = shift @words; # and keep constant name
+ my($word);
+ foreach $word (@words) {
+ next unless $word =~ m!\$(\w+)!;
+ $val_vars{$token} = $1;
+ last;
+ }
+ }
+ }
+ close SH;
+}
+else { warn "Couldn't read ${outdir}config_h.SH: $!\n"; }
+$pp_vars{UNLINK_ALL_VERSIONS} = 'd_unlink_all_versions'; # VMS_specific
+
+# OK, now read the C header file, and retcon statements into config.sh
while (<IN>) { # roll through the comment header in Config.VMS
last if /config-start/;
}
@@ -165,54 +224,61 @@ while (<IN>) {
s/^\s*//;
$_ = $line . $_;
}
- next unless my ($blocked,$un,$token,$val) = m%^(\/\*)?\s*\#\s*(un)?def\w*\s*([A-za-z0-9]\w+)\S*\s*(.*)%;
- next if /config-skip/;
+ next unless my ($blocked,$un,$token,$val) =
+ m%^(\/\*)?\s*\#\s*(un)?def\w*\s+([A-Za-z0-9]\w+)\S*\s*(.*)%;
+ if (/config-skip/) {
+ delete $pp_vars{$token} if exists $pp_vars{$token};
+ delete $val_vars{$token} if exists $val_vars{$token};
+ next;
+ }
+ $val =~ s!\s*/\*.*!!; # strip off trailing comment
+ my($had_val); # Maybe a macro with args that we just #undefd or commented
+ if (!length($val) and $val_vars{$token} and ($un || $blocked)) {
+ print OUT "$val_vars{$token}=''\n";
+ delete $val_vars{$token};
+ $had_val = 1;
+ }
$state = ($blocked || $un) ? 'undef' : 'define';
- $token =~ tr/A-Z/a-z/;
- $token =~ s/_exp$/exp/; # Config.pm has 'privlibexp' etc. where config.h
- # has 'privlib_exp' etc.
- # Fixup differences between Configure vars and config.h manifests
- # This isn't comprehensize; we fix 'em as we need 'em.
- $token = 'castneg' if $token eq 'castnegfloat';
- $token = 'dlsymun' if $token eq 'dlsym_needs_underscore';
- $token = 'stdstdio' if $token eq 'use_stdio_ptr';
- $token = 'stdiobase' if $token eq 'use_stdio_base';
- $val =~ s%/\*.*\*/\s*%%g; $val =~ s/\s*$//; # strip off trailing comment
- $val =~ s/^"//; $val =~ s/"$//; # remove end quotes
- $val =~ s/","/ /g; # make signal list look nice
- if ($val) { print OUT "$token=\'$val\'\n"; }
- else {
+ if ($pp_vars{$token}) {
+ print OUT "$pp_vars{$token}='$state'\n";
+ delete $pp_vars{$token};
+ }
+ elsif (not length $val and not $had_val) {
+ # Wups -- should have been shell var for C preprocessor directive
+ warn "Constant $token not found in config_h.SH\n";
+ $token =~ tr/A-Z/a-z/;
$token = "d_$token" unless $token =~ /^i_/;
print OUT "$token='$state'\n";
}
+ next unless length $val;
+ $val =~ s/^"//; $val =~ s/"$//; # remove end quotes
+ $val =~ s/","/ /g; # make signal list look nice
+ # Library directory; convert to VMS syntax
+ $val = VMS::Filespec::vmspath($val) if ($token =~ /EXP$/);
+ if ($val_vars{$token}) {
+ print OUT "$val_vars{$token}='$val'\n";
+ if ($val_vars{$token} =~ s/exp$//) {print OUT "$val_vars{$token}='$val'\n";}
+ delete $val_vars{$token};
+ }
+ elsif (!$pp_vars{$token}) { # Haven't seen it previously, either
+ warn "Constant $token not found in config_h.SH (val=|$val|)\n";
+ $token =~ tr/A-Z/a-z/;
+ print OUT "$token='$val'\n";
+ if ($token =~ s/exp$//) {print OUT "$token='$val'\n";}
+ }
}
close IN;
+# Special case -- preprocessor manifest "VMS" is defined automatically
+# on VMS systems, but is also used erroneously by the Perl build process
+# as the manifest for the obsolete variable $d_eunice.
+print OUT "d_eunice='undef'\n"; delete $pp_vars{VMS};
-while (<DATA>) {
- next if /^\s*#/ or /^\s*$/;
- s/#.*$//; s/\s*$//;
- ($key,$val) = split('=',$_,2);
- print OUT "$key='$val'\n";
- eval "\$$key = '$val'";
+foreach (sort keys %pp_vars) {
+ warn "Didn't see $_ in $infile\n";
+}
+foreach (sort keys %val_vars) {
+ warn "Didn't see $_ in $infile(val)\n";
}
-# Add in some of the architecture-dependent stuff which has to be consistent
-print OUT "d_vms_do_sockets=",$dosock ? "'define'\n" : "'undef'\n";
-print OUT "d_has_sockets=",$dosock ? "'define'\n" : "'undef'\n";
-$archlib = &VMS::Filespec::vmspath($privlib);
-$installarchlib = &VMS::Filespec::vmspath($installprivlib);
-$sitearch = &VMS::Filespec::vmspath($sitelib);
-$archlib =~ s#\]#.VMS_$archsufx\]#;
-$sitearch =~ s#\]#.VMS_$archsufx\]#;
-print OUT "oldarchlib='$archlib'\n";
-print OUT "oldarchlibexp='$archlib'\n";
-($vers = $]) =~ tr/./_/;
-$archlib =~ s#\]#.$vers\]#;
-$installarchlib =~ s#\]#.VMS_$archsufx.$vers\]#;
-print OUT "archlib='$archlib'\n";
-print OUT "archlibexp='$archlib'\n";
-print OUT "installarchlib='$installarchlib'\n";
-print OUT "sitearch='$sitearch'\n";
-print OUT "sitearchexp='$sitearch'\n";
if (open(OPT,"${outdir}crtl.opt")) {
while (<OPT>) {
@@ -237,7 +303,7 @@ if (open(PL,"${outdir}patchlevel.h")) {
}
else { warn "Can't read ${outdir}patchlevel.h - skipping 'PATCHLEVEL'"; }
-# simple pager support for perldoc
+# simple pager support for perldoc
if (`most` =~ /IVVERB/) {
$pager = 'more';
if (`more nl:` =~ /IVVERB/) { $pager = 'type/page'; }
@@ -246,36 +312,3 @@ else { $pager = 'most'; }
print OUT "pager='$pager'\n";
close OUT;
-__END__
-
-# This list is incomplete in comparison to what ends up in config.sh, but
-# should contain the essentials. Some of these definitions reflect
-# options chosen when building perl or site-specific data; these should
-# be hand-edited appropriately. Someday, perhaps, we'll get this automated.
-
-# The definitions in this block are constant across most systems, and
-# should only rarely need to be changed.
-ccdlflags=
-cccdlflags=
-usedl=true
-dlobj=dl_vms.obj
-dlsrc=dl_vms.c
-so=exe
-dlext=exe
-libpth=/sys$share /sys$library
-usevfork=false
-castflags=0
-signal_t=void
-timetype=long
-builddir=perl_root:[000000]
-prefix=perl_root
-installprivlib=perl_root:[lib] # The *lib constants should match the
-privlib=perl_root:[lib] # equivalent *(?:ARCH)LIB_EXP constants
-sitelib=perl_root:[lib.site_perl] # in config.h
-installbin=perl_root:[000000]
-installman1dir=perl_root:[man.man1]
-installman3dir=perl_root:[man.man3]
-man1ext=rno
-man3ext=rno
-binexp=perl_root:[000000] # should be same as installbin
-useposix=false