Perl 5.001
[p5sagit/p5-mst-13.2.git] / vms / writemain.pl
CommitLineData
a0d0e21e 1#!./miniperl
2#
3# Create perlmain.c from miniperlmain.c, adding code to boot the
748a9306 4# extensions listed on the command line. In addition, create a
5# linker options file which causes the bootstrap routines for
6# these extension to be universal symbols in PerlShr.Exe.
7#
8# Last modified 29-Nov-1994 by Charles Bailey bailey@genetics.upenn.edu
a0d0e21e 9#
10
11if (-f 'miniperlmain.c') { $dir = ''; }
12elsif (-f '../miniperlmain.c') { $dir = '../'; }
13else { die "$0: Can't find miniperlmain.c\n"; }
14
15open (IN,"${dir}miniperlmain.c")
16 || die "$0: Can't open ${dir}miniperlmain.c: $!\n";
17open (OUT,">${dir}perlmain.c")
18 || die "$0: Can't open ${dir}perlmain.c: $!\n";
19
20while (<IN>) {
21 s/INTERN\.h/EXTERN\.h/;
22 print OUT;
23 last if /Do not delete this line--writemain depends on it/;
24}
25$ok = !eof(IN);
26close IN;
27
28if (!$ok) {
29 close OUT;
30 unlink "${dir}perlmain.c";
31 die "$0: Can't find marker line in ${dir}miniperlmain.c - aborting\n";
32}
33
34
748a9306 35if (@ARGV) {
36 # Allow for multiple names in one quoted group
37 @exts = split(/\s+/, join(' ',@ARGV));
a0d0e21e 38}
39
748a9306 40if (@exts) {
41 print OUT " char *file = __FILE__;\n";
42 foreach $ext (@exts) {
43 my($subname) = $ext;
44 $subname =~ s/::/__/g;
45 print OUT "extern void boot_${subname} _((CV* cv));\n"
a0d0e21e 46 }
748a9306 47 foreach $ext (@exts) {
48 my($subname) = $ext;
49 $subname =~ s/::/__/g;
50 print "Adding $ext . . .\n";
51 if ($ext eq 'DynaLoader') {
52 # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'!
53 # boot_DynaLoader is called directly in DynaLoader.pm
54 print OUT " newXS(\"${ext}::boot_${ext}\", boot_${subname}, file);\n"
55 }
56 else {
57 print OUT " newXS(\"${ext}::bootstrap\", boot_${subname}, file);\n"
58 }
a0d0e21e 59 }
60}
61
62print OUT "}\n";
63close OUT;