This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.git] / makedef.pl
index 1dcb9fa..e9d522d 100644 (file)
@@ -36,6 +36,24 @@ my %PLATFORM;
 defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
 exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
 
+if ($PLATFORM eq 'win32' or $PLATFORM eq "aix") {
+       # Add the compile-time options that miniperl was built with to %define.
+       # On Win32 these are not the same options as perl itself will be built
+       # with since miniperl is built with a canned config (one of the win32/
+       # config_H.*) and none of the BUILDOPT's that are set in the makefiles,
+       # but they do include some #define's that are hard-coded in various
+       # source files and header files and don't include any BUILDOPT's that
+       # the user might have chosen to disable because the canned configs are
+       # minimal configs that don't include any of those options.
+       my $config = `$^X -Ilib -V`;
+       my($options) = $config =~ /^  Compile-time options: (.*?)\n^  \S/ms;
+       $options =~ s/\s+/ /g;
+       print STDERR "Options: ($options)\n";
+       foreach (split /\s+/, $options) {
+               $define{$_} = 1;
+       }
+}
+
 my %exportperlmalloc =
     (
        Perl_malloc             =>      "malloc",
@@ -55,6 +73,7 @@ my $global_sym  = "global.sym";
 my $pp_sym      = "pp.sym";
 my $globvar_sym = "globvar.sym";
 my $perlio_sym  = "perlio.sym";
+my $static_ext = "";
 
 if ($PLATFORM eq 'aix') {
     # Nothing for now.
@@ -88,6 +107,13 @@ unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' ||
     }
     close(CFG);
 }
+if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
+    open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
+    if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
+        $static_ext = $1;
+    }
+    close(CFG);
+}
 
 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
 while (<CFG>) {
@@ -123,8 +149,9 @@ if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
 
 my $sym_ord = 0;
 
+print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
+
 if ($PLATFORM =~ /^win(?:32|ce)$/) {
-    warn join(' ',keys %define)."\n";
     ($dll = ($define{PERL_DLL} || "perl58")) =~ s/\.dll$//i;
     print "LIBRARY $dll\n";
     print "DESCRIPTION 'Perl interpreter'\n";
@@ -221,7 +248,6 @@ if ($PLATFORM eq 'win32') {
                     PL_linestart
                     PL_modcount
                     PL_pending_ident
-                    PL_sortcxix
                     PL_sublex_info
                     PL_timesbuf
                     main
@@ -259,6 +285,7 @@ if ($PLATFORM eq 'win32') {
                     Perl_getenv_len
                     Perl_my_pclose
                     Perl_my_popen
+                    Perl_my_sprintf
                     )];
 }
 else {
@@ -279,7 +306,6 @@ if ($PLATFORM eq 'wince') {
                     PL_linestart
                     PL_modcount
                     PL_pending_ident
-                    PL_sortcxix
                     PL_sublex_info
                     PL_timesbuf
                     PL_collation_ix
@@ -296,7 +322,6 @@ if ($PLATFORM eq 'wince') {
                     Perl_sv_collxfrm
                     setgid
                     setuid
-                    win32_async_check
                     win32_free_childdir
                     win32_free_childenv
                     win32_get_childdir
@@ -337,6 +362,7 @@ if ($PLATFORM eq 'wince') {
                     Perl_getenv_len
                     Perl_my_pclose
                     Perl_my_popen
+                    Perl_my_sprintf
                     )];
 }
 elsif ($PLATFORM eq 'aix') {
@@ -379,6 +405,8 @@ elsif ($PLATFORM eq 'os2') {
                    dlsym
                    dlerror
                    dlclose
+                   dup2
+                   dup
                    my_tmpfile
                    my_tmpnam
                    my_flock
@@ -389,6 +417,8 @@ elsif ($PLATFORM eq 'os2') {
                    my_getpwent
                    my_setpwent
                    my_endpwent
+                   fork_with_resources
+                   croak_with_os2error
                    setgrent
                    endgrent
                    getgrent
@@ -398,6 +428,10 @@ elsif ($PLATFORM eq 'os2') {
                    nthreads_cond
                    os2_cond_wait
                    os2_stat
+                   os2_execname
+                   async_mssleep
+                   msCounter
+                   InfoTable
                    pthread_join
                    pthread_create
                    pthread_detach
@@ -473,7 +507,6 @@ elsif ($PLATFORM eq 'netware') {
                        PL_linestart
                        PL_modcount
                        PL_pending_ident
-                       PL_sortcxix
                        PL_sublex_info
                        PL_timesbuf
                        main
@@ -548,12 +581,19 @@ unless ($define{'DEBUGGING'}) {
                    Perl_debstack
                    Perl_debstackptrs
                    Perl_sv_peek
+                   Perl_hv_assert
                    PL_block_type
                    PL_watchaddr
                    PL_watchok
                    )];
 }
 
+if ($define{'PERL_IMPLICIT_CONTEXT'}) {
+    skip_symbols [qw(
+                   PL_sig_sv
+                   )];
+}
+
 if ($define{'PERL_IMPLICIT_SYS'}) {
     skip_symbols [qw(
                    Perl_getenv_len
@@ -595,6 +635,8 @@ if ($define{'MYMALLOC'}) {
                    Perl_get_mstats
                    Perl_strdup
                    Perl_putenv
+                   MallocCfg_ptr
+                   MallocCfgP_ptr
                    )];
     if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
        emit_symbols [qw(
@@ -613,9 +655,17 @@ else {
                    Perl_dump_mstats
                    Perl_get_mstats
                    Perl_malloced_size
+                   MallocCfg_ptr
+                   MallocCfgP_ptr
                    )];
 }
 
+if ($define{'PERL_USE_SAFE_PUTENV'}) {
+    skip_symbols [qw(
+                   PL_use_safe_putenv
+                  )];
+}
+
 unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
     skip_symbols [qw(
                    PL_thr_key
@@ -654,6 +704,8 @@ unless ($define{'USE_5005THREADS'}) {
 unless ($define{'USE_ITHREADS'}) {
     skip_symbols [qw(
                    PL_ptr_table
+                   PL_pte_root
+                   PL_pte_arenaroot
                    PL_op_mutex
                    PL_regex_pad
                    PL_regex_padav
@@ -671,6 +723,7 @@ unless ($define{'USE_ITHREADS'}) {
                    Perl_mg_dup
                    Perl_re_dup
                    Perl_sv_dup
+                   Perl_rvpv_dup
                    Perl_sys_intern_dup
                    Perl_ptr_table_clear
                    Perl_ptr_table_fetch
@@ -689,6 +742,7 @@ unless ($define{'USE_ITHREADS'}) {
                    Perl_sharedsv_thrcnt_dec
                    Perl_sharedsv_thrcnt_inc
                    Perl_sharedsv_unlock
+                   Perl_stashpv_hvname_match
                    )];
 }
 
@@ -726,6 +780,8 @@ unless ($define{'PL_OP_SLAB_ALLOC'}) {
                      PL_OpPtr
                      PL_OpSlab
                      PL_OpSpace
+                    Perl_Slab_Alloc
+                    Perl_Slab_Free
                     )];
 }
 
@@ -733,6 +789,32 @@ unless ($define{'THREADS_HAVE_PIDS'}) {
     skip_symbols [qw(PL_ppid)];
 }
 
+unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
+    skip_symbols [qw(
+                   PL_dumper_fd
+                   )];
+}
+unless ($define{'PERL_DONT_CREATE_GVSV'}) {
+    skip_symbols [qw(
+                    Perl_gv_SVadd
+                   )];
+}
+if ($define{'SPRINTF_RETURNS_STRLEN'}) {
+    skip_symbols [qw(
+                    Perl_my_sprintf
+                   )];
+}
+
+# Ideally this would also check SA_SIGINFO, but there doesn't seem to be an
+# easy way to find that out from here. Fix it if it breaks because there is
+# a platform where the logic here doesn't work, *and* the export lists have to
+# be accurate there.
+unless ($define{'d_sigaction'}) {
+    skip_symbols [qw(
+                   Perl_csighandler_va
+                   )];
+}
+
 sub readvar {
     my $file = shift;
     my $proc = shift || sub { "PL_$_[2]" };
@@ -767,73 +849,75 @@ my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
 # These are in _addition to_ the public face of the abstraction
 # and need to be exported to allow XS modules to implement layers
 my @layer_syms = qw(
-                        PerlIOBase_clearerr
-                        PerlIOBase_close
-                        PerlIOBase_dup
-                        PerlIOBase_eof
-                        PerlIOBase_error
-                        PerlIOBase_fileno
-                        PerlIOBase_pushed
-                        PerlIOBase_binmode
-                        PerlIOBase_popped
-                        PerlIOBase_read
-                        PerlIOBase_setlinebuf
-                        PerlIOBase_unread
-                        PerlIOBuf_bufsiz
-                        PerlIOBuf_fill
-                        PerlIOBuf_flush
-                        PerlIOBuf_get_base
-                        PerlIOBuf_get_cnt
-                        PerlIOBuf_get_ptr
-                        PerlIOBuf_open
-                        PerlIOBuf_pushed
-                        PerlIOBuf_popped
-                        PerlIOBuf_read
-                        PerlIOBuf_seek
-                        PerlIOBuf_set_ptrcnt
-                        PerlIOBuf_tell
-                        PerlIOBuf_unread
-                        PerlIOBuf_write
-                        PerlIO_debug
-                        PerlIO_allocate
-                        PerlIO_apply_layera
-                        PerlIO_apply_layers
-                        PerlIO_arg_fetch
-                        PerlIO_define_layer
-                        PerlIO_modestr
-                        PerlIO_parse_layers
-                        PerlIO_layer_fetch
-                        PerlIO_list_free
-                        PerlIO_apply_layera
-                        PerlIO_pending
-                        PerlIO_push
-                        PerlIO_pop
-                        PerlIO_sv_dup
-                        PerlIO_perlio
-
-Perl_PerlIO_clearerr
-Perl_PerlIO_close
-Perl_PerlIO_eof
-Perl_PerlIO_error
-Perl_PerlIO_fileno
-Perl_PerlIO_fill
-Perl_PerlIO_flush
-Perl_PerlIO_get_base
-Perl_PerlIO_get_bufsiz
-Perl_PerlIO_get_cnt
-Perl_PerlIO_get_ptr
-Perl_PerlIO_read
-Perl_PerlIO_seek
-Perl_PerlIO_set_cnt
-Perl_PerlIO_set_ptrcnt
-Perl_PerlIO_setlinebuf
-Perl_PerlIO_stderr
-Perl_PerlIO_stdin
-Perl_PerlIO_stdout
-Perl_PerlIO_tell
-Perl_PerlIO_unread
-Perl_PerlIO_write
-
+                   PerlIOBase_binmode
+                   PerlIOBase_clearerr
+                   PerlIOBase_close
+                   PerlIOBase_dup
+                   PerlIOBase_eof
+                   PerlIOBase_error
+                   PerlIOBase_fileno
+                   PerlIOBase_noop_fail
+                   PerlIOBase_noop_ok
+                   PerlIOBase_popped
+                   PerlIOBase_pushed
+                   PerlIOBase_read
+                   PerlIOBase_setlinebuf
+                   PerlIOBase_unread
+                   PerlIOBuf_bufsiz
+                   PerlIOBuf_close
+                   PerlIOBuf_dup
+                   PerlIOBuf_fill
+                   PerlIOBuf_flush
+                   PerlIOBuf_get_base
+                   PerlIOBuf_get_cnt
+                   PerlIOBuf_get_ptr
+                   PerlIOBuf_open
+                   PerlIOBuf_popped
+                   PerlIOBuf_pushed
+                   PerlIOBuf_read
+                   PerlIOBuf_seek
+                   PerlIOBuf_set_ptrcnt
+                   PerlIOBuf_tell
+                   PerlIOBuf_unread
+                   PerlIOBuf_write
+                   PerlIO_allocate
+                   PerlIO_apply_layera
+                   PerlIO_apply_layers
+                   PerlIO_arg_fetch
+                   PerlIO_debug
+                   PerlIO_define_layer
+                   PerlIO_isutf8
+                   PerlIO_layer_fetch
+                   PerlIO_list_free
+                   PerlIO_modestr
+                   PerlIO_parse_layers
+                   PerlIO_pending
+                   PerlIO_perlio
+                   PerlIO_pop
+                   PerlIO_push
+                   PerlIO_sv_dup
+                   Perl_PerlIO_clearerr
+                   Perl_PerlIO_close
+                   Perl_PerlIO_eof
+                   Perl_PerlIO_error
+                   Perl_PerlIO_fileno
+                   Perl_PerlIO_fill
+                   Perl_PerlIO_flush
+                   Perl_PerlIO_get_base
+                   Perl_PerlIO_get_bufsiz
+                   Perl_PerlIO_get_cnt
+                   Perl_PerlIO_get_ptr
+                   Perl_PerlIO_read
+                   Perl_PerlIO_seek
+                   Perl_PerlIO_set_cnt
+                   Perl_PerlIO_set_ptrcnt
+                   Perl_PerlIO_setlinebuf
+                   Perl_PerlIO_stderr
+                   Perl_PerlIO_stdin
+                   Perl_PerlIO_stdout
+                   Perl_PerlIO_tell
+                   Perl_PerlIO_unread
+                   Perl_PerlIO_write
 );
 if ($PLATFORM eq 'netware') {
     push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
@@ -848,6 +932,7 @@ if ($define{'USE_PERLIO'}) {
     if ($define{'USE_SFIO'}) {
        # Old legacy non-stdio "PerlIO"
        skip_symbols \@layer_syms;
+       skip_symbols [qw(perlsio_binmode)];
        # SFIO defines most of the PerlIO routines as macros
        # So undo most of what $perlio_sym has just done - d'oh !
        # Perhaps it would be better to list the ones which do exist
@@ -925,12 +1010,14 @@ if ($define{'USE_PERLIO'}) {
     else {
        # PerlIO with layers - export implementation
        emit_symbols \@layer_syms;
+       emit_symbols [qw(perlsio_binmode)];
     }
 } else {
        # -Uuseperlio
        # Skip the PerlIO layer symbols - although
        # nothing should have exported them any way
        skip_symbols \@layer_syms;
+       skip_symbols [qw(perlsio_binmode)];
         skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)];
 
        # Also do NOT add abstraction symbols from $perlio_sym
@@ -1004,6 +1091,7 @@ if ($PLATFORM =~ /^win(?:32|ce)$/) {
                            Perl_init_os_extras
                            Perl_thread_create
                            Perl_win32_init
+                           Perl_win32_term
                            RunPerl
                            win32_async_check
                            win32_errno
@@ -1016,6 +1104,7 @@ if ($PLATFORM =~ /^win(?:32|ce)$/) {
                            win32_pclose
                            win32_rename
                            win32_setmode
+                           win32_chsize
                            win32_lseek
                            win32_tell
                            win32_dup
@@ -1159,6 +1248,9 @@ if ($PLATFORM =~ /^win(?:32|ce)$/) {
     {
        try_symbol($symbol);
     }
+    if ($CCTYPE eq "BORLAND") {
+       try_symbol('_matherr');
+    }
 }
 elsif ($PLATFORM eq 'os2') {
     open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
@@ -1322,6 +1414,15 @@ foreach my $symbol (qw(
     }
 }
 
+# records of type boot_module for statically linked modules (except Dynaloader)
+$static_ext =~ s/\//__/g;
+$static_ext =~ s/\bDynaLoader\b//;
+my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
+foreach my $symbol (@stat_mods)
+    {
+       try_symbol($symbol);
+    }
+
 # Now all symbols should be defined because
 # next we are going to output them.
 
@@ -1330,7 +1431,14 @@ foreach my $symbol (sort keys %export) {
 }
 
 if ($PLATFORM eq 'os2') {
-       print "; LAST_ORDINAL=$sym_ord\n";
+       print <<EOP;
+    dll_perlmain=main
+    fill_extLibpath
+    dir_subst
+    Perl_OS2_handler_install
+
+; LAST_ORDINAL=$sym_ord
+EOP
 }
 
 sub emit_symbol {
@@ -1404,4 +1512,3 @@ PerlIO_sprintf
 PerlIO_sv_dup
 PerlIO_tmpfile
 PerlIO_vsprintf
-perlsio_binmode