add 'installhtml*dir' to win32 config templates
[p5sagit/p5-mst-13.2.git] / win32 / config_sh.PL
index e62e47f..45c1ba4 100644 (file)
@@ -5,11 +5,28 @@ while (@ARGV && $ARGV[0] =~ /^([\w_]+)=(.*)$/)
   shift(@ARGV);
  }
 
-@opt{'PATCHLEVEL','SUBVERSION'} = ($] =~ /\.0*([1-9]+)(\d\d)$/);
+if ($] =~ /\.(\d\d\d)?(\d\d)?$/) { # should always be true
+  $opt{PATCHLEVEL} = int($1 || 0);
+  $opt{SUBVERSION} = $2 || '00';
+}
+
+$opt{'cf_by'} = $ENV{USERNAME} unless $opt{'cf_by'};
+$opt{'cf_email'} = $opt{'cf_by'} . '@' . (gethostbyname('localhost'))[0]
+       unless $opt{'cf_email'};
+$opt{'usemymalloc'} = 'y' if $opt{'d_mymalloc'} eq 'define';
+
 while (<>)
  {
   s/~([\w_]+)~/$opt{$1}/g;
-  $_ = "$1='$opt{$1}'\n" if (/^([\w_]+)=/ && exists($opt{$1}));
+  if (/^([\w_]+)=(.*)$/) {
+    # this depends on cf_time being empty in the template (or we'll get a loop)
+    if ($1 eq 'cf_time') {
+      $_ = "$1='" . localtime(time) . "'\n" if $2 =~ /^\s*'\s*'/;
+    }
+    elsif (exists $opt{$1}) {
+      $_ = "$1='$opt{$1}'\n";
+    }
+  }
   print;
  }