This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/apicheck.pl: Handle const parameters
[perl5.git] / configpm
index 09b9e67..88f0150 100755 (executable)
--- a/configpm
+++ b/configpm
@@ -35,7 +35,7 @@ usage: $0  [ options ]
 EOF
 
 use strict;
-use vars qw(%Config $Config_SH_expanded);
+our (%Config, $Config_SH_expanded);
 
 my $how_many_common = 22;
 
@@ -155,7 +155,7 @@ $config_txt .= sprintf << 'EOT', $], $export_funcs;
 package Config;
 use strict;
 use warnings;
-use vars '%%Config', '$VERSION';
+our ( %%Config, $VERSION );
 
 $VERSION = "%s";
 
@@ -212,6 +212,19 @@ my $in_v     = 0;
 my %Data     = ();
 my $quote;
 
+# These variables were set in older versions of Perl, but are no longer needed
+# by the core. However, some CPAN modules may rely on them; in particular, Tk
+# (at least up to version 804.034) fails to build without them. We force them
+# to be emitted to Config_heavy.pl for backcompat with such modules (and we may
+# find that this set needs to be extended in future). See RT#132347.
+my @v_forced = map "$_\n", split /\n+/, <<'EOT';
+i_limits='define'
+i_stdlib='define'
+i_string='define'
+i_time='define'
+prototype='define'
+EOT
+
 
 my %seen_quotes;
 {
@@ -319,7 +332,7 @@ die if $@;
 
 # Calculation for the keys for byteorder
 # This is somewhat grim, but I need to run fetch_string here.
-our $Config_SH_expanded = join "\n", '', @v_others;
+$Config_SH_expanded = join "\n", '', @v_others;
 
 my $t = fetch_string ({}, 'ivtype');
 my $s = fetch_string ({}, 'ivsize');
@@ -456,7 +469,7 @@ $heavy_txt .= sprintf <<'ENDOFBEG', $osname, $osname, $from, $osname, $env_cygwi
 package Config;
 use strict;
 use warnings;
-use vars '%%Config';
+our %%Config;
 
 sub bincompat_options {
     return split ' ', (Internals::V())[0];
@@ -561,13 +574,15 @@ local *_ = \my $a;
 $_ = <<'!END!';
 EOT
 #proper lexicographical order of the keys
+my %seen_var;
 $heavy_txt .= join('',
     map { $_->[-1] }
     sort {$a->[0] cmp $b->[0] }
+    grep { !$seen_var{ $_->[0] }++ }
     map {
         /^([^=]+)/ ? [ $1, $_ ]
                    : [ $_, $_ ] # shouldnt happen
-    } @v_others
+    } @v_others, @v_forced
 ) . "!END!\n";
 
 # Only need the dynamic byteorder code in Config.pm if 'byteorder' is one of
@@ -845,6 +860,8 @@ open(CONFIG_POD, '>', $Config_POD) or die "Can't open $Config_POD: $!";
 print CONFIG_POD <<'ENDOFTAIL';
 =head1 NAME
 
+=for comment  Generated by configpm.  Any changes made here will be lost!
+
 Config - access Perl configuration information
 
 =head1 SYNOPSIS
@@ -1008,16 +1025,12 @@ sub process {
       print CONFIG_POD <<EOF if $text;
 =back
 
-=cut
-
 EOF
       print CONFIG_POD <<EOF;
 =head2 $c
 
 =over 4
 
-=cut
-
 EOF
      $text = 1;
     }