1 # This File keeps the contents of miniperlmain.c.
3 # It was generated automatically by minimod.PL from the contents
4 # of miniperlmain.c. Don't edit this file!
6 # ANY CHANGES MADE HERE WILL BE LOST!
10 package ExtUtils
::Miniperl
;
13 @EXPORT = qw(&writemain);
18 * Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
19 * 2004, 2005 by Larry Wall and others
21 * You may distribute under the terms of either the GNU General Public
22 * License or the Artistic License, as specified in the README file.
27 * "The Road goes ever on and on, down from the door where it began."
30 /* This file contains the main() function for the perl interpreter.
31 * Note that miniperlmain.c contains main() for the 'miniperl' binary,
32 * while perlmain.c contains main() for the 'perl' binary.
34 * Miniperl is like perl except that it does not support dynamic loading,
35 * and in fact is used to build the dynamic modules needed for the 'real'
41 /* sbrk is limited to first heap segment so make it big */
42 #pragma runopts(HEAP(8M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
44 #pragma runopts(HEAP(2M,500K,ANYWHERE,KEEP,8K,4K) STACK(,,ANY,) ALL31(ON))
50 #define PERL_IN_MINIPERLMAIN_C
53 static void xs_init (pTHX);
54 static PerlInterpreter *my_perl;
56 #if defined (__MINT__) || defined (atarist)
57 /* The Atari operating system doesn't have a dynamic stack. The
58 stack size is determined from this value. */
59 long _stksize = 64 * 1024;
63 main(int argc, char **argv, char **env)
67 #ifndef PERL_USE_SAFE_PUTENV
68 PL_use_safe_putenv = 0;
69 #endif /* PERL_USE_SAFE_PUTENV */
71 #ifdef PERL_GLOBAL_STRUCT
72 #define PERLVAR(var,type) /**/
73 #define PERLVARA(var,type) /**/
74 #define PERLVARI(var,type,init) PL_Vars.var = init;
75 #define PERLVARIC(var,type,init) PL_Vars.var = init;
83 /* if user wants control of gprof profiling off by default */
84 /* noop unless Configure is given -Accflags=-DPERL_GPROF_CONTROL */
85 PERL_GPROF_MONCONTROL(0);
87 PERL_SYS_INIT3(&argc,&argv,&env);
89 #if defined(USE_5005THREADS) || defined(USE_ITHREADS)
90 /* XXX Ideally, this should really be happening in perl_alloc() or
91 * perl_construct() to keep libperl.a transparently fork()-safe.
92 * It is currently done here only because Apache/mod_perl have
93 * problems due to lack of a call to cancel pthread_atfork()
94 * handlers when shared objects that contain the handlers may
95 * be dlclose()d. This forces applications that embed perl to
96 * call PTHREAD_ATFORK() explicitly, but if and only if it hasn't
97 * been called at least once before in the current process.
98 * --GSAR 2001-07-20 */
99 PTHREAD_ATFORK(Perl_atfork_lock,
105 my_perl = perl_alloc();
108 perl_construct(my_perl);
109 PL_perl_destruct_level = 0;
111 PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
112 exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);
116 exitstatus = perl_destruct(my_perl);
126 /* Register any extra external extensions */
138 * c-indentation-style: bsd
140 * indent-tabs-mode: t
143 * ex: set ts=8 sts=4 sw=4 noet:
151 my($dl) = canon
('/','DynaLoader');
155 my($pname) = canon
('/', $_);
157 ($mname = $pname) =~ s!/!::!g;
158 ($cname = $pname) =~ s!/!__!g;
159 print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n";
162 my ($tail1,$tail2) = ( $tail =~ /\A(.*\n)(\s*\}.*)\Z/s );
165 print "\tconst char file[] = __FILE__;\n";
166 print "\tdXSUB_SYS;\n" if $] > 5.002;
169 my($pname) = canon
('/', $_);
170 my($mname, $cname, $ccode);
171 ($mname = $pname) =~ s!/!::!g;
172 ($cname = $pname) =~ s!/!__!g;
175 # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'!
176 # boot_DynaLoader is called directly in DynaLoader.pm
177 $ccode = "\t/* DynaLoader is a special case */\n
178 \tnewXS(\"${mname}::boot_${cname}\", boot_${cname}, file);\n";
179 print $ccode unless $SEEN{$ccode}++;
181 $ccode = "\tnewXS(\"${mname}::bootstrap\", boot_${cname}, file);\n";
182 print $ccode unless $SEEN{$ccode}++;
192 # might be X::Y or lib/auto/X/Y/Y.a
194 s
:^(lib
|ext
)/(auto/)?
::;
197 grep(s
:/:$as:, @ext) if ($as ne '/');
206 ExtUtils::Miniperl, writemain - write the C code for perlmain.c
210 C<use ExtUtils::Miniperl;>
212 C<writemain(@directories);>
216 This whole module is written when perl itself is built from a script
217 called minimod.PL. In case you want to patch it, please patch
218 minimod.PL in the perl distribution instead.
220 writemain() takes an argument list of directories containing archive
221 libraries that relate to perl modules and should be linked into a new
222 perl binary. It writes to STDOUT a corresponding perlmain.c file that
223 is a plain C file containing all the bootstrap code to make the
224 modules associated with the libraries available from within perl.
226 The typical usage is from within a Makefile generated by
227 ExtUtils::MakeMaker. So under normal circumstances you won't have to
228 deal with this module directly
.
232 L<ExtUtils::MakeMaker>