summaryrefslogtreecommitdiff
path: root/makedef.pl
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2022-12-06 08:10:53 -0700
committerYves Orton <demerphq@gmail.com>2022-12-10 10:28:11 +0100
commit7431637bf3a19079844d2138cc323dff00008e46 (patch)
tree0ee20f83ed7c16c61c502f537990a9314f78979a /makedef.pl
parent89201293f5ef3baa81db1f0ade5ddc1bc0500877 (diff)
downloadperl-7431637bf3a19079844d2138cc323dff00008e46.tar.gz
makedef.pl: Create $define{WIN32} etc
A portion of makedef.pl must manually be kept in sync with changes to portions of perl.h. Prior to this commit, you had to remember that #ifdef WIN32 from perl.h had to be translated to a completely different paradigm for use in this file. This commit fixes that, which can help prepare the way for future programmatic syncing of the two files.
Diffstat (limited to 'makedef.pl')
-rw-r--r--makedef.pl16
1 files changed, 11 insertions, 5 deletions
diff --git a/makedef.pl b/makedef.pl
index 78bd0fd72c..00270c25fc 100644
--- a/makedef.pl
+++ b/makedef.pl
@@ -66,8 +66,13 @@ BEGIN {
die "PLATFORM must be one of: @PLATFORM\n"
unless exists $PLATFORM{$ARGS{PLATFORM}};
}
+
use constant PLATFORM => $ARGS{PLATFORM};
+# This makes us able to use, e.g., $define{WIN32}, so you don't have to
+# remember what things came from %ARGS.
+$define{uc $ARGS{'PLATFORM'}} = 1;
+
require "./$ARGS{TARG_DIR}regen/embed_lib.pl";
# Is the following guard strictly necessary? Added during refactoring
@@ -110,6 +115,7 @@ close(CFG);
#==========================================================================
# perl.h logic duplication begins
+
if ($define{USE_ITHREADS}) {
if (!$define{MULTIPLICITY}) {
$define{MULTIPLICITY} = 1;
@@ -120,7 +126,7 @@ $define{MULTIPLICITY} ||=
$define{USE_ITHREADS} ||
$define{PERL_IMPLICIT_CONTEXT} ;
-if ($define{USE_ITHREADS} && PLATFORM ne 'win32') {
+if ($define{USE_ITHREADS} && ! $define{WIN32}) {
$define{USE_REENTRANT_API} = 1;
}
@@ -155,8 +161,8 @@ if ( $define{HAS_POSIX_2008_LOCALE}
if ($define{USE_LOCALE_THREADS} && ! $define{NO_THREAD_SAFE_LOCALE})
{
if ( $define{USE_POSIX_2008_LOCALE}
- || (PLATFORM eq 'win32' && ( $cctype !~ /\D/
- && $cctype >= 80)))
+ || ($define{WIN32} && ( $cctype !~ /\D/
+ && $cctype >= 80)))
{
$define{USE_THREAD_SAFE_LOCALE} = 1;
}
@@ -175,7 +181,7 @@ if ($define{USE_POSIX_2008_LOCALE} && ! $define{USE_QUERYLOCALE})
$define{USE_PL_CUR_LC_ALL} = 1;
}
-if (PLATFORM eq 'win32' && $define{USE_THREAD_SAFE_LOCALE})
+if ($define{WIN32} && $define{USE_THREAD_SAFE_LOCALE})
{
$define{USE_PL_CUR_LC_ALL} = 1;
@@ -185,7 +191,7 @@ if (PLATFORM eq 'win32' && $define{USE_THREAD_SAFE_LOCALE})
}
if ($define{MULTIPLICITY} && ( $define{USE_POSIX_2008_LOCALE}
- || ( PLATFORM eq 'win32'
+ || ( $define{WIN32}
&& $define{USE_THREAD_SAFE_LOCALE})))
{
$define{USE_PERL_SWITCH_LOCALE_CONTEXT}