@@ -225,7 +225,7 @@ sub cflags {
225225 # with the warning flags, but NOT the -std=c89 flags (the latter
226226 # would break using any system header files that are strict C99).
227227 my @ccextraflags = qw( ccwarnflags) ;
228- if ($self -> {PERL_CORE }) {
228+ if ($ENV {PERL_CORE }) {
229229 for my $x (@ccextraflags ) {
230230 if (exists $Config {$x }) {
231231 $cflags {$x } = $Config {$x };
@@ -1748,47 +1748,13 @@ sub init_DIRFILESEP {
17481748}
17491749
17501750
1751- =item init_CORE
1752-
1753- Initializes PERL_CORE and PERL_SRC.
1754-
1755- =cut
1756-
1757- sub init_CORE {
1758- my ($self ) = @_ ;
1759-
1760- # Are we building the core?
1761- $self -> {PERL_CORE } = $ENV {PERL_CORE } unless exists $self -> {PERL_CORE };
1762- $self -> {PERL_CORE } = 0 unless defined $self -> {PERL_CORE };
1763-
1764- unless ($self -> {PERL_SRC }){
1765- foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting
1766- my $dir = $self -> catdir(($Updir ) x $dir_count );
1767-
1768- if (-f $self -> catfile($dir ," config_h.SH" ) &&
1769- -f $self -> catfile($dir ," perl.h" ) &&
1770- -f $self -> catfile($dir ," lib" ," strict.pm" )
1771- ) {
1772- $self -> {PERL_SRC } = $dir ;
1773- last ;
1774- }
1775- }
1776- }
1777-
1778- warn " PERL_CORE is set but I can't find your PERL_SRC!\n "
1779- if $self -> {PERL_CORE } and !$self -> {PERL_SRC };
1780-
1781- return ;
1782- }
1783-
1784-
17851751=item init_main
17861752
17871753Initializes AR, AR_STATIC_ARGS, BASEEXT, CONFIG, DISTNAME, DLBASE,
17881754EXE_EXT, FULLEXT, FULLPERL, FULLPERLRUN, FULLPERLRUNINST, INST_*,
17891755INSTALL*, INSTALLDIRS, LIB_EXT, LIBPERL_A, MAP_TARGET, NAME,
17901756OBJ_EXT, PARENT_NAME, PERL, PERL_ARCHLIB, PERL_INC, PERL_LIB,
1791- PERLRUN, PERLRUNINST, PREFIX, VERSION,
1757+ PERL_SRC, PERLRUN, PERLRUNINST, PREFIX, VERSION,
17921758VERSION_SYM, XS_VERSION.
17931759
17941760=cut
@@ -1839,6 +1805,23 @@ sub init_main {
18391805 my $inc_config_dir = dirname($INC {' Config.pm' });
18401806 my $inc_carp_dir = dirname($INC {' Carp.pm' });
18411807
1808+ unless ($self -> {PERL_SRC }){
1809+ foreach my $dir_count (1..8) { # 8 is the VMS limit for nesting
1810+ my $dir = $self -> catdir(($Updir ) x $dir_count );
1811+
1812+ if (-f $self -> catfile($dir ," config_h.SH" ) &&
1813+ -f $self -> catfile($dir ," perl.h" ) &&
1814+ -f $self -> catfile($dir ," lib" ," strict.pm" )
1815+ ) {
1816+ $self -> {PERL_SRC }=$dir ;
1817+ last ;
1818+ }
1819+ }
1820+ }
1821+
1822+ warn " PERL_CORE is set but I can't find your PERL_SRC!\n " if
1823+ $self -> {PERL_CORE } and !$self -> {PERL_SRC };
1824+
18421825 if ($self -> {PERL_SRC }){
18431826 $self -> {PERL_LIB } ||= $self -> catdir(" $self ->{PERL_SRC}" ," lib" );
18441827
@@ -2177,6 +2160,10 @@ sub init_PERL {
21772160 # * including any initial directory separator preserves the `file_name_is_absolute` property
21782161 $self -> {PERL } =~ s / ^"(\S (:\\ |:)?)/ $1 "/ if $self -> is_make_type(' dmake' );
21792162
2163+ # Are we building the core?
2164+ $self -> {PERL_CORE } = $ENV {PERL_CORE } unless exists $self -> {PERL_CORE };
2165+ $self -> {PERL_CORE } = 0 unless defined $self -> {PERL_CORE };
2166+
21802167 # Make sure perl can find itself before it's installed.
21812168 my $lib_paths = $self -> {UNINSTALLED_PERL } || $self -> {PERL_CORE }
21822169 ? ( $self -> {PERL_ARCHLIB } && $self -> {PERL_LIB } && $self -> {PERL_ARCHLIB } ne $self -> {PERL_LIB } ) ?
0 commit comments