X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=vms%2Fgenconfig.pl;h=e500e760a275f210d91a52a5101787da1cae83f2;hb=f7aaccc209ec5f90cb29b7b4871f5abef7db50d5;hp=ca15aa7943346c83865b70814b8d16ac9325b301;hpb=748a93069b3d16374a9859d1456065dd3ae11394;p=p5sagit%2Fp5-mst-13.2.git diff --git a/vms/genconfig.pl b/vms/genconfig.pl index ca15aa7..e500e76 100644 --- a/vms/genconfig.pl +++ b/vms/genconfig.pl @@ -6,12 +6,31 @@ # 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. 08-Mar-1995 Charles Bailey bailey@genetics.upenn.edu +# Rev. 16-Feb-1998 Charles Bailey bailey@newman.upenn.edu # +#==== Locations of installed Perl components +$prefix='perl_root'; +$builddir="$prefix:[000000]"; +$installbin="$prefix:[000000]"; +$installscript="$prefix:[000000]"; +$installman1dir="$prefix:[man.man1]"; +$installman3dir="$prefix:[man.man3]"; +$installprivlib="$prefix:[lib]"; +$installsitelib="$prefix:[lib.site_perl]"; + unshift(@INC,'lib'); # In case someone didn't define Perl_Root # before the build -require 'ctime.pl' || die "Couldn't execute ctime.pl: $!\n"; + +if ($ARGV[0] eq '-f') { + open(ARGS,$ARGV[1]) or die "Can't read data from $ARGV[1]: $!\n"; + @ARGV = (); + while () { + chomp; + push(@ARGV,split(/\|/,$_)); + } + close ARGS; +} if (-f "config.vms") { $infile = "config.vms"; $outdir = "[-]"; } elsif (-f "[.vms]config.vms") { $infile = "[.vms]config.vms"; $outdir = "[]"; } @@ -28,7 +47,16 @@ $outdir = ''; open(IN,"$infile") || die "Can't open $infile: $!\n"; open(OUT,">${outdir}Config.sh") || die "Can't open ${outdir}Config.sh: $!\n"; -$time = &ctime(time()); +$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\]#; +$installsitearch = VMS::Filespec::vmspath($installsitelib); +$installsitearch =~ s#\]#.VMS_$archsufx\]#; +($osvers = `Write Sys\$Output F\$GetSyi("VERSION")`) =~ s/^V?(\S+)\s*\n?$/$1/; + print OUT <= 5.2 and $vmsver >= 7) { $rtlnew = 'define'; } + else { $rtlnew = 'undef'; } + } + else { $rtlhas = $rtlnew = 'undef'; print OUT "useposix='false'\n"; } + foreach (qw[ d_stdstdio d_stdio_ptr_lval d_stdio_cnt_lval d_stdiobase + d_locconv d_setlocale i_locale d_mbstowcs d_mbtowc + d_wcstombs d_wctomb d_mblen d_mktime d_strcoll d_strxfrm ]) { + print OUT "$_='$rtlhas'\n"; + } + foreach (qw[ d_gettimeod d_uname d_truncate d_wait4 d_index + d_pathconf d_fpathconf d_sysconf d_sigsetjmp ]) { + print OUT "$_='$rtlnew'\n"; + } + next; + } + 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? +$myname = $ENV{'ARPANET_HOST_NAME'} || $ENV{'INTERNET_HOST_NAME'} || + $ENV{'MULTINET_HOST_NAME'} || $ENV{'UCX$INET_HOST'} || + $ENV{'TCPWARE_DOMAINNAME'} || $ENV{'NEWS_ADDRESS'}; +if (!$myname) { + ($myname) = `hostname` =~ /^(\S+)/; + if ($myname =~ /IVVERB/) { + warn "Can't determine TCP/IP hostname" if $dosock; + $myname = ''; + } +} +$myname = $ENV{'SYS$NODE'} unless $myname; +($myhostname,$mydomain) = split(/\./,$myname,2); +print OUT "myhostname='$myhostname'\n" if $myhostname; +if ($mydomain) { + print OUT "mydomain='.$mydomain'\n"; + print OUT "perladmin='$cf_by\@$myhostname.$mydomain'\n"; + print OUT "cf_email='$cf_by\@$myhostname.$mydomain'\n"; +} +else { + print OUT "perladmin='$cf_by'\n"; + print OUT "cf_email='$cf_by'\n"; +} +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 () { + 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 () { # roll through the comment header in Config.VMS - last if /^#define _config_h_/; + last if /config-start/; } while () { @@ -57,94 +311,105 @@ while () { 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" unless exists $done{$val_vars{$token}}; + $done{$val_vars{$token}}++; + delete $val_vars{$token}; + $had_val = 1; + } $state = ($blocked || $un) ? 'undef' : 'define'; - $token =~ tr/A-Z/a-z/; - $val =~ s%/\*.*\*/\s*%%g; $val =~ s/\s*$//; # strip off trailing comment + if ($pp_vars{$token}) { + print OUT "$pp_vars{$token}='$state'\n" unless exists $done{$pp_vars{$token}}; + $done{$pp_vars{$token}}++; + 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 = lc $token; + $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 - if ($val) { print OUT "$token=\'$val\'\n"; } - else { - $token = "d_$token" unless $token =~ /^i_/; - print OUT "$token=\'$state\'\n"; + # 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" unless exists $done{$val_vars{$token}}; + if ($val_vars{$token} =~ s/exp$//) { + print OUT "$val_vars{$token}='$val'\n" unless exists $done{$val_vars{$token}};; + } + $done{$val_vars{$token}}++; + 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 = lc $token; + 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 () { - next if /^\s*#/ or /^\s*$/; - s/#.*$//; s/\s*$//; - ($key,$val) = split('=',$_,2); - print OUT "$key='$val'\n"; - eval "\$$key = '$val'"; +# XXX temporary -- USE_THREADS is currently on CC command line +delete $pp_vars{'USE_THREADS'}; + +foreach (sort keys %pp_vars) { + warn "Didn't see $_ in $infile\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"; -$osvers = `Write Sys\$Output F\$GetSyi("VERSION")`; -chomp $osvers; -$osvers =~ s/^V//; -print OUT "osvers='$osvers'\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"; +foreach (sort keys %val_vars) { + warn "Didn't see $_ in $infile(val)\n"; } -else { - print OUT "arch='VMS_VAX'\n"; - print OUT "archname='VMS_VAX'\n"; - $archsufx = 'VAX'; + +if (open(OPT,"${outdir}crtl.opt")) { + while () { + next unless m#/(sha|lib)#i; + chomp; + if (/crtl/i || /gcclib/i) { push(@crtls,$_); } + else { push(@libs,$_); } + } + close OPT; + print OUT "libs='",join(' ',@libs),"'\n"; + push(@crtls,'(DECCRTL)') if $cctype eq 'decc'; + print OUT "libc='",join(' ',@crtls),"'\n"; } -$archlib = &VMS::Filespec::vmspath($privlib); -$archlib =~ s#\]#.VMS_$archsufx\]#; -$installarchlib = &VMS::Filespec::vmspath($installprivlib); -$installarchlib =~ s#\]#.VMS_$archsufx\]#; -print OUT "archlib='$archlib'\n"; -print OUT "installarchlib='$installarchlib'\n"; - -__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. -osname=VMS # DO NOT CHANGE THIS! Tests elsewhere depend on this to identify - # VMS. Use the 'arch' item below to specify hardware version. -CONFIG=true -PATCHLEVEL=001 -ld=Link -lddlflags=/Share -ccdlflags= -cccdlflags= -libc= -ranlib= -eunicefix=: -usedl=true -dldir=/ext/dl -dlobj=dl_vms.obj -dlsrc=dl_vms.c -so=exe -dlext=exe -libpth=/sys$share /sys$library -hintfile= -intsize=4 -alignbytes=8 -shrplib=define -signal_t=void -timetype=long -usemymalloc=n -builddir=perl_root:[000000] -installprivlib=perl_root:[lib] -privlib=perl_root:[lib] -installbin=perl_root:[000000] - -# The definitions in this block are site-specific, and will probably need to -# be changed on most systems. -myhostname=nowhere.loopback.edu -libs= # This should list RTLs other than the C RTL and IMAGELIB (e.g. socket RTL) +else { warn "Can't read ${outdir}crtl.opt - skipping 'libs' & 'libc'"; } + +if (open(PL,"${outdir}patchlevel.h")) { + while () { + if (/^#define PERL_VERSION\s+(\S+)/) { + print OUT "PERL_VERSION='$1'\n"; + print OUT "PATCHLEVEL='$1'\n"; # XXX compat + } + elsif (/^#define PERL_SUBVERSION\s+(\S+)/) { + print OUT "PERL_SUBVERSION='$1'\n"; + print OUT "SUBVERSION='$1'\n"; # XXX compat + } + } + close PL; +} +else { warn "Can't read ${outdir}patchlevel.h - skipping 'PATCHLEVEL'"; } + +# simple pager support for perldoc +if (`most not..file` =~ /IVVERB/) { + $pager = 'more'; + if (`more nl:` =~ /IVVERB/) { $pager = 'type/page'; } +} +else { $pager = 'most'; } +print OUT "pager='$pager'\n"; + +close OUT;