develooper Front page | perl.perl5.porters | Postings from February 2000

[PATCH 5.5.660]VMS build patches

From:
Dan Sugalski
Date:
February 26, 2000 16:06
Subject:
[PATCH 5.5.660]VMS build patches
Message ID:
4.3.0.20000226191119.02214e80@24.8.96.48
These patches (against one of Jarkko's config versions) fix the VMS build
issues, as well as adding in more control over how perl's
built. (Hopefully I mangled cases properly on the file names)

--- configure.com;1	Wed Feb 23 20:14:21 2000
+++ configure.com	Sat Feb 26 17:35:19 2000
@@ -19,7 +19,7 @@
  $! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  $!
  $! send suggestions to: 
-$!  Dan Sugalski <sugalskd@ous.edu>
+$!  Dan Sugalski <dan@sidhe.org>
  $! Thank you!!!!
  $!
  $! Adapted and converted from Larry Wall & Andy Dougherty's
@@ -39,8 +39,12 @@
  $ gcc_symbol = "gcc"
  $ ans = ""
  $ macros = ""
-$ use_vmsdebug_perl = "N"
+$ extra_flags = ""
+$ user_c_flags = ""
  $ use_debugging_perl = "Y"
+$ use_ieee_math = "N"
+$ be_case_sensitive = "N"
+$ use_vmsdebug_perl = "N"
  $ use_64bit = "n"
  $ C_Compiler_Replace = "CC="
  $ Thread_Live_Dangerously = "MT="
@@ -127,6 +131,8 @@
  $ Using_Gnu_C = ""
  $ Dec_C_Version = ""
  $ use_threads = "F"
+$ use_5005_threads = "N"
+$ use_ithreads = "N"
  $!
  $!: option parsing
  $ IF (P1 .NES. "")
@@ -524,7 +530,7 @@
  You have the option of continuing the configuration process, despite the
  distinct possibility that your kit is damaged, by typing 'y'es.  If you
  do, don't blame me if something goes wrong.  I advise you to type 'n'o
-and contact the author (sugalskd@ous.edu).
+and contact the author (dan@sidhe.org)
  
  $     READ SYS$COMMAND/PROMPT="Continue? [n] " ans
  $     IF ans
@@ -629,7 +635,7 @@
  Much effort has been expended to ensure that this shell script will
  run on any VMS system.  If despite that it blows up on yours, your
  best bet is to edit Configure.com and @ it again.  Whatever problems
-you have with Configure.com, let me (sugalskd@ous.edu) know how I blew
+you have with Configure.com, let me (dan@sidhe.org) know how I blew
  it.
  
  $!This installation script affects things in two ways:
@@ -1772,6 +1778,31 @@
  $   if (f$extract(0, 1, "''ans'").eqs."Y").or.(f$extract(0, 1, "''ans'").eqs."y")
  $   THEN
  $     use_threads="T"
+$!
+$     ! Shall we do the 5.005-stype threads, or IThreads?
+$     echo "As of 5.5.640, Perl has two different internal threading
+$     echo "implementations, the 5.005 version (5005threads) and an
+$     echo "interpreter-based version (ithreads) that has one
+$     echo "interpreter per thread.  Both are very experimental.  This
+$     echo "arrangement exists to help developers work out which one
+$     echo "is better.
+$     echo "
+$     echo "If you're a casual user, you probably don't want
+$     echo "interpreter-threads at this time.  There doesn't yet exist
+$     echo "a way to create threads from within Perl in this model,
+$     echo "i.e., "use Thread;" will NOT work.
+$     echo "
+$     dflt = "n"
+$     rp = "Build with Interpreter threads? [''dflt']
+$     if ans.eqs."" then ans = dflt
+$     if (f$extract(0, 1, "''ans'").eqs."Y").or.(f$extract(0, 1, "''ans'").eqs."y")
+$     THEN
+$       use_ithreads="Y"
+$       use_5005_threads="N"
+$     ELSE
+$       use_ithreads="N"
+$       use_5005_threads="Y"
+$     ENDIF
  $     ! Are they on VMS 7.1 on an alpha?
  $     if (Archname.eqs."VMS_AXP").and.("''f$extract(1,3, f$getsyi(""version""))'".ges."7.1")
  $     THEN
@@ -1795,6 +1826,51 @@
  $     ENDIF
  $   ENDIF
  $ ENDIF
+$ if archname .eqs. "VMS_AXP"
+$ then
+$!
+$! Case sensitive?
+$ echo ""
+$ echo "By default, perl (and pretty much everything else on VMS) uses
+$ echo "case-insensitive linker symbols. Which is to say, when the
+$ echo "underlying C code makes a call to a routine called Perl_foo in
+$ echo "the source, the name in the object modules or shareable images
+$ echo "is really PERL_FOO. There are some packages that use an
+$ echo "embedded perl interpreter that instead require case-sensitive
+$ echo "linker symbols.
+$ echo ""
+$ echo "If you have no idea what the heck this means, and don't have
+$ echo "any program requiring anything, choose the default
+$ echo ""
+$ dflt = be_case_sensitive
+$ rp = "Case-sensitive symbols [''dflt'] "
+$ gosub myread
+$ if ans.eqs."" then ans="''dflt'"
+$ be_case_sensitive = "''ans'"
+$!
+$! IEEE math?
+$ echo ""
+$ echo "Perl normally uses G_FLOAT format floating point numbers
+$ echo "internally, as do most things on VMS. You can, however, build
+$ echo "with IEEE floating point numbers instead if you need to.
+$ echo ""
+$ dflt = use_ieee_math
+$ rp = "Use IEEE math [''dflt'] "
+$ gosub myread
+$ if ans.eqs."" then ans="''dflt'"
+$ use_ieee_math = "''ans'"
+$ endif
+$! CC Flags
+$ echo ""
+$ echo "You can, if you need to, pass extra flags on to the C
+$ echo "compiler. In general you should only do this if you really,
+$ echo "really know what you're doing.
+$ echo ""
+$ dflt = user_c_flags
+$ rp = "Flags [''dflt'] "
+$ gosub myread
+$ if ans.eqs."" then ans="''dflt'"
+$ user_c_flags = "''ans'"
  $!
  $! Ask whether they want to use secure logical translation when tainting
  $ echo ""
@@ -1885,14 +1961,10 @@
  $ echo "
  $ echo "Which modules do you want to build into perl?"
  $! dflt = "Fcntl Errno File::Glob IO Opcode Byteloader Devel::Peek Devel::DProf Data::Dumper attrs re VMS::Stdio VMS::DCLsym B SDBM_File"
-$ dflt = "re Fcntl Errno File::Glob IO Opcode Devel::Peek Devel::DProf Data::Dumper attrs VMS::Stdio VMS::DCLsym B SDBM_File"
+$ dflt = "re Fcntl Errno File::Glob IO Opcode Devel::Peek Devel::DProf Data::Dumper attrs VMS::Stdio VMS::DCLsym B SDBM_File Thread"
  $ if Using_Dec_C.eqs."Yes"
  $ THEN
  $   dflt = dflt + " POSIX"
-$   if Use_Threads.eqs."T"
-$   THEN
-$     dflt = dflt + " Thread"
-$   ENDIF
  $ ENDIF
  $ rp = "[''dflt'] "
  $ GOSUB myread
@@ -2030,6 +2102,17 @@
  $   macros = F$EXTRACT(0,(tmp-1),macros) !miss trailing comma
  $   macros = "/macro=(" + macros  + ")"
  $ ENDIF
+$! Build up the extra C flags
+$!
+$ if use_ieee_math
+$ then
+$   extra_flags = "''extra_flags'" + "/float=ieee/ieee=denorm_results"
+$ endif
+$ if be_case_sensitive
+$ then
+$   extra_flags = "''extra_flags'" + "/Names=As_Is"
+$ endif
+$ extra_flags = "''extra_flags'" + "''user_c_flags'"
  $!
  $! Invoke the subconfig piece
  $!


--- vms/descrip_mms.template;1	Wed Feb 23 20:22:02 2000
+++ vms/descrip_mms.template	Sat Feb 26 15:27:39 2000
@@ -30,6 +30,7 @@
  ~MALLOC~
  ~CC~
  ~MT~
+~FLAGS~
  
  #: >>>>> Architecture-specific options <<<<<
  .ifdef AXE
@@ -214,7 +215,7 @@
  .endif
  
  # C preprocessor manifest "DEBUGGING" ==> perl -D, not the VMS debugger
-CFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)
+CFLAGS = $(XTRACCFLAGS)$(DBGCCFLAGS)$(FLAGS)
  # Flags for a core compile
  X2PCFLAGS = $(CFLAGS)/Define=PERL_FOR_X2P
  # Flags for an x2p compile
@@ -1174,6 +1175,8 @@
  	$(CC) $(CORECFLAGS) $(MMS$SOURCE)
  vms$(O) : vms.c $(h)
  	$(CC) $(CORECFLAGS) $(MMS$SOURCE)
+xsutils$(O) : xsutils.c $(h)
+	$(CC) $(CORECFLAGS) $(MMS$SOURCE)
  
  [.x2p]hash$(O) : [.x2p]hash.c [.x2p]EXTERN.h [.x2p]a2p.h [.x2p]hash.h [.x2p]str.h [.x2p]util.h config.h handy.h vmsish.h $(SOCKH)
  	$(CC) $(X2PCFLAGS) $(MMS$SOURCE)


--- ext/DynaLoader/dl_vms.xs;1	Wed Oct  6 17:27:36 1999
+++ ext/DynaLoader/dl_vms.xs	Sat Feb 26 16:54:44 2000
@@ -65,6 +65,12 @@
  #include <ssdef.h>
  #include <starlet.h>
  
+#if defined(VMS_WE_ARE_CASE_SENSITIVE)
+#define DL_CASE_SENSITIVE 1<<4
+#else
+#define DL_CASE_SENSITIVE 0
+#endif
+
  typedef unsigned long int vmssts;
  
  struct libref {
@@ -142,7 +148,7 @@
  {
    unsigned long int retsts;
    VAXC$ESTABLISH(findsym_handler);
-  retsts = lib$find_image_symbol(imgname,symname,entry,defspec);
+  retsts = lib$find_image_symbol(imgname,symname,entry,defspec,DL_CASE_SENSITIVE);
    return retsts;
  }
  


--- ext/DynaLoader/DynaLoader_PM.pl;1	Thu Jan 13 09:34:26 2000
+++ ext/DynaLoader/DynaLoader_PM.pl	Sat Feb 26 16:54:54 2000
@@ -220,7 +220,7 @@
      # in this perl code simply because this was the last perl code
      # it executed.
  
-    my $libref = dl_load_file($file, $module->dl_load_flags) or
+    my $libref = dl_load_file(uc($file), $module->dl_load_flags) or
  	croak("Can't load '$file' for module $module: ".dl_error());
  
      push(@dl_librefs,$libref);  # record loaded object


--- vms/gen_shrfls.pl;1	Fri Sep 17 20:34:26 1999
+++ vms/gen_shrfls.pl	Sat Feb 26 16:55:32 2000
@@ -76,6 +76,7 @@
      $use_mymalloc++ if /define\s+MYMALLOC/;
      $hide_mymalloc++ if /define\s+EMBEDMYMALLOC/;
      $use_threads++ if /define\s+USE_THREADS/;
+    $care_about_case++ if /define\s+VMS_WE_ARE_CASE_SENSITIVE/;
    }
    
    # put quotes back onto defines - they were removed by DCL on the way in
@@ -195,16 +196,16 @@
      if ($1 eq 'main' || $1 eq 'perl_init_ext') {
        print "\tskipped\n" if $debug > 1;
      }
-    else { $fcns{uc($1)}++ }
+    else { $fcns{$1}++ }
    }
  }
  
  # Go add some right up front if we need 'em
  if ($use_mymalloc) {
-  $fcns{uc('Perl_malloc')}++;
-  $fcns{uc('Perl_calloc')}++;
-  $fcns{uc('Perl_realloc')}++;
-  $fcns{uc('Perl_mfree')}++;
+  $fcns{'Perl_malloc'}++;
+  $fcns{'Perl_calloc'}++;
+  $fcns{'Perl_realloc'}++;
+  $fcns{'Perl_mfree'}++;
  }
  
  $used_expectation_enum = $used_opcode_enum = 0; # avoid warnings
@@ -313,6 +314,7 @@
    print OPTBLD "PSECT_ATTR=\$GLOBAL_RO_VARS,PIC,NOEXE,RD,NOWRT,SHR\n";
    print OPTBLD "PSECT_ATTR=\$GLOBAL_RW_VARS,PIC,NOEXE,RD,WRT,NOSHR\n";
  }
+print OPTBLD "case_sensitive=yes\n" if $care_about_case;
  foreach $var (sort (keys %vars,keys %cvars)) {
    if ($isvax) { print OPTBLD "UNIVERSAL=$var\n"; }
    else { print OPTBLD "SYMBOL_VECTOR=($var=DATA)\n"; }
@@ -364,7 +366,7 @@
  }
  close OPTATTR;
  
-$incstr = 'perl,globals';
+$incstr = 'PERL,GLOBALS';
  if ($isvax) {
    $drvrname = "Compile_shrmars.tmp_".time;
    open (DRVR,">$drvrname") or die "$0: Can't write to $drvrname: $!\n";


--- lib/ExtUtils/mksymlists.pm;1	Mon Jan 24 06:04:58 2000
+++ lib/ExtUtils/mksymlists.pm;	Sat Feb 26 16:55:13 2000
@@ -10,6 +10,12 @@
  @ISA = 'Exporter';
  @EXPORT = '&Mksymlists';
  $VERSION = substr q$Revision: 1.17 $, 10;
+BEGIN {
+    if ($^O eq 'VMS') { 
+	require Config;		# 
+	import Config;
+    }
+}			     
  
  sub Mksymlists {
      my(%spec) = @_;
@@ -34,7 +40,7 @@
                  if ($sym =~ /^boot_/) {
                      push(@{$spec{FUNCLIST}},$sym);
                      $bootseen++;
-                }
+		}
                  else { push(@{$spec{FUNCLIST}},"XS_${packprefix}_$sym"); }
              }
              push(@{$spec{FUNCLIST}},"boot_$packprefix") unless $bootseen;
@@ -173,6 +179,7 @@
      # We don't do anything to preserve order, so we won't relax
      # the GSMATCH criteria for a dynamic extension
  
+    print OPT "case_sensitive=yes\n" if $Config{d_vms_case_sensitive_symbols};
      foreach $sym (@{$data->{FUNCLIST}}) {
          my $safe = $set->addsym($sym);
          if ($isvax) { print OPT "UNIVERSAL=$safe\n" }


--- lib/ExtUtils/MM_VMS.pm;1	Mon Jan 24 06:04:56 2000
+++ lib/ExtUtils/MM_VMS.pm;	Sat Feb 26 16:55:23 2000
@@ -553,7 +553,8 @@
  	      BASEEXT PARENT_NAME DLBASE INC DEFINE LINKTYPE
  	      /	) {
  	next unless defined $self->{$tmp};
-	push @m, "$tmp = $self->{$tmp}\n";
+	push @m, "$tmp = $self->{$tmp}\n" unless $tmp =~ /BASEEXT/;
+	push @m, "$tmp = " .uc($self->{$tmp})."\n" if $tmp =~ /BASEEXT/;
      }
  
      for $tmp (qw/ XS MAN1PODS MAN3PODS PM /) {
@@ -717,7 +718,7 @@
  
      $self->{OPTIMIZE} ||= $flagoptstr || $Config{'optimize'};
      if ($self->{OPTIMIZE} !~ m!/!) {
-	if    ($self->{OPTIMIZE} =~ m!\b-g\b!) { $self->{OPTIMIZE} = '/Debug/NoOptimize' }
+	if    ($self->{OPTIMIZE} =~ m!\B-g\b!) { $self->{OPTIMIZE} = '/Debug/NoOptimize' }
  	elsif ($self->{OPTIMIZE} =~ /-O(\d*)/) {
  	    $self->{OPTIMIZE} = '/Optimize' . (defined($1) ? "=$1" : '');
  	}
@@ -1187,7 +1188,7 @@
  	my(@omods) = map { s/\.[^.]*$//;         # Trim off file type
  	                   s[\$\(\w+_EXT\)][];   # even as a macro
  	                   s/.*[:>\/\]]//;       # Trim off dir spec
-	                   $_; } split ' ', $self->eliminate_macros($self->{OBJECT});
+	                   uc($_); } split ' ', $self->eliminate_macros($self->{OBJECT});
  	my($tmp,@lines,$elt) = '';
  	my $tmp = shift @omods;
  	foreach $elt (@omods) {


--- vms/subconfigure.com;1	Thu Feb 24 01:31:39 2000
+++ vms/subconfigure.com	Sat Feb 26 15:25:59 2000
@@ -44,7 +44,13 @@
  $ ELSE
  $   Checkcc := "''Mcc'"
  $ ENDIF
-$! cc_flags = ""
+$ cc_flags = cc_flags + extra_flags
+$ if be_case_sensitive
+$ then
+$ d_vms_be_case_sensitive = "define"
+$ else
+$ d_vms_be_case_sensitive = "undef"
+$ endif
  $ if use_multiplicity .eqs. "Y"
  $ THEN
  $   perl_usemultiplicity = "define"
@@ -482,17 +488,28 @@
  $ ENDIF
  $ if ("''Use_Threads'".eqs."T")
  $ THEN
-$ perl_arch = "''perl_arch'-thread"
-$ perl_archname = "''perl_archname'-thread"
-$ perl_d_old_pthread_create_joinable = "undef"
-$ perl_old_pthread_create_joinable = " "
-$ perl_use5005threads = "define"
-$ ELSE
-$ perl_d_old_pthread_create_joinable = "undef"
-$ perl_old_pthread_create_joinable = " "
-$ perl_use5005threads = "undef"
+$   if use_5005_threads
+$   THEN
+$     perl_arch = "''perl_arch'-thread"
+$     perl_archname = "''perl_archname'-thread"
+$     perl_d_old_pthread_create_joinable = "undef"
+$     perl_old_pthread_create_joinable = " "
+$     perl_use5005threads = "define"
+$     perl_useithreads = "undef"
+$   ELSE
+$     perl_arch = "''perl_arch'-ithread"
+$     perl_archname = "''perl_archname'-ithread"
+$     perl_d_old_pthread_create_joinable = "undef"
+$     perl_old_pthread_create_joinable = " "
+$     perl_use5005threads = "undef"
+$     perl_useithreads = "define"
+$   ENDIF
+$ ELSE
+$   perl_d_old_pthread_create_joinable = "undef"
+$   perl_old_pthread_create_joinable = " "
+$   perl_use5005threads = "undef"
+$   perl_useithreads = "undef"
  $ ENDIF
-$ perl_useithreads = "undef"
  $ perl_osvers=f$edit(osvers, "TRIM")
  $ if (perl_subversion + 0).eq.0
  $ THEN
@@ -2179,7 +2196,7 @@
  $ WS "#include <iconv.h>
  $ WS "int main()
  $ WS "{"
-$ WS "  iconv_t cd;"
+$ WS "  iconv_t cd = (iconv_t)0;"
  $ WS "  char *inbuf, *outbuf;"
  $ WS "  size_t inleft, outleft;"
  $ WS "  iconv(cd, &inbuf, &inleft, &outbuf, &outleft);"
@@ -4106,6 +4123,7 @@
  $ WC "uvuformat='" + perl_uvuformat + "'"
  $ WC "uvoformat='" + perl_uvoformat + "'"
  $ WC "uvxformat='" + perl_uvxformat + "'"
+$ WC "d_vms_case_sensitive_symbols='" + d_vms_be_case_sensitive + "'"
  $!
  $! ##WRITE NEW CONSTANTS HERE##
  $!
@@ -4190,6 +4208,10 @@
  $    WRITE CONFIG "#define USE_64_BITS"
  $    WRITE CONFIG "#define USE_LONG_DOUBLE"
  $ ENDIF
+$ if be_case_sensitive
+$ then
+$    write config "#define VMS_WE_ARE_CASE_SENSITIVE"
+$ endif
  $ WRITE CONFIG "#define HAS_ENVGETENV"
  $ WRITE CONFIG "#define PERL_EXTERNAL_GLOB"
  $ CLOSE CONFIG
@@ -4253,7 +4275,8 @@
  $ echo "Writing DESCRIP.MMS"
  $!set ver
  $ define/user sys$output [-]descrip.mms
-$ mcr []munchconfig [-]config.sh descrip_mms.template "''DECC_REPLACE'" "''ARCH_TYPE'" "''GNUC_REPLACE'" "''SOCKET_REPLACE'" "''THREAD_REPLACE'" "''C_Compiler_Replace'" "''MALLOC_REPLACE'" "''Thread_Live_Dangerously'" "PV=''LocalPerlVer'"
+$ mcr []munchconfig [-]config.sh descrip_mms.template "''DECC_REPLACE'" "''ARCH_TYPE'" "''GNUC_REPLACE'" "''SOCKET_REPLACE'" "''THREAD_REPLACE'" -
+"''C_Compiler_Replace'" "''MALLOC_REPLACE'" "''Thread_Live_Dangerously'" "PV=''LocalPerlVer'" "FLAGS=FLAGS=''extra_flags'"
  $ echo "Extracting Build_Ext.Com"
  $ Create Sys$Disk:[-]Build_Ext.Com
  $ Deck/Dollar="$EndOfTpl$"

					Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                      teddy bears get drunk




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About