Support case-sensitive symbols usage in linker
[p5sagit/p5-mst-13.2.git] / vms / gen_shrfls.pl
index 3e70372..35cab2f 100644 (file)
@@ -74,6 +74,9 @@ if ($docc) {
   while(<CONFIG>) {
     $debugging_enabled++ if /define\s+DEBUGGING/;
     $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
@@ -188,7 +191,7 @@ sub scan_func {
   my($line) = @_;
 
   print "\tchecking for global routine\n" if $debug > 1;
-  if ( $line =~ /(\w+)\s+\(/ ) {
+  if ( $line =~ /(\w+)\s*\(/ ) {
     print "\troutine name is \\$1\\\n" if $debug > 1;
     if ($1 eq 'main' || $1 eq 'perl_init_ext') {
       print "\tskipped\n" if $debug > 1;
@@ -306,10 +309,12 @@ if ($isvax) {
     or die "$0: Can't write to ${dir}perlshr_gbl${marord}.mar: $!\n";
   print MAR "\t.title perlshr_gbl$marord\n";
 }
+
 unless ($isgcc) {
   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"; }
@@ -361,7 +366,7 @@ else {
 }
 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";
@@ -391,9 +396,26 @@ if ($isvax) {
 # Initial hack to permit building of compatible shareable images for a
 # given version of Perl.
 if ($ENV{PERLSHR_USE_GSMATCH}) {
-  my $major = int($] * 1000)                        & 0xFF;  # range 0..255
-  my $minor = int(($] * 1000 - $major) * 100 + 0.5) & 0xFF;  # range 0..255
-  print OPTBLD "GSMATCH=LEQUAL,$major,$minor\n";
+  if ($ENV{PERLSHR_USE_GSMATCH} eq 'INCLUDE_COMPILE_OPTIONS') {
+    # Build up a major ID. Since it can only be 8 bits, we encode the version
+    # number in the top four bits and use the bottom four for build options
+    # that'll cause incompatibilities
+    ($ver, $sub) = $] =~ /\.(\d\d\d)(\d\d)/;
+    $gsmatch = ($sub >= 50) ? "equal" : "lequal"; # Force an equal match for
+                                                 # dev, but be more forgiving
+                                                 # for releases
+
+    $ver *=16;
+    $ver += 8 if $debugging_enabled;   # If DEBUGGING is set
+    $ver += 4 if $use_threads;         # if we're threaded
+    $ver += 2 if $use_mymalloc;                # if we're using perl's malloc
+    print OPTBLD "GSMATCH=$gsmatch,$ver,$sub\n";
+  }
+  else {
+    my $major = int($] * 1000)                        & 0xFF;  # range 0..255
+    my $minor = int(($] * 1000 - $major) * 100 + 0.5) & 0xFF;  # range 0..255
+    print OPTBLD "GSMATCH=LEQUAL,$major,$minor\n";
+  }
   print OPTBLD 'CLUSTER=$$TRANSFER_VECTOR,,',
                map(",$_$objsuffix",@symfiles), "\n";
 }