summaryrefslogtreecommitdiff
path: root/config/perl.m4
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-08-14 11:48:59 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-08-14 11:48:59 -0400
commit5a5c2feca3fd858e70ea348822595547e6fa6c15 (patch)
treeed7be46cc31eb1416738a9f50b21ad6730fa16d9 /config/perl.m4
parentea0ca75d5d14e0c98782a2188405685af4a475a0 (diff)
downloadpostgresql-5a5c2feca3fd858e70ea348822595547e6fa6c15.tar.gz
Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant.
Commit 3c163a7fc's original choice to ignore all #define symbols whose names begin with underscore turns out to be too simplistic. On Windows, some Perl installations are built with -D_USE_32BIT_TIME_T, and we must absorb that or we get the wrong result for sizeof(PerlInterpreter). This effectively re-reverts commit ef58b87df, which injected that symbol in a hacky way, making it apply to all of Postgres not just PL/Perl. More significantly, it did so on *all* 32-bit Windows builds, even when the Perl build to be used did not select this option; so that it fails to work properly with some newer Perl builds. By making this change, we would be introducing an ABI break in 32-bit Windows builds; but fortunately we have not used type time_t in any exported Postgres APIs in a long time. So it should be OK, both for PL/Perl itself and for third-party extensions, if an extension library is built with a different _USE_32BIT_TIME_T setting than the core code. Patch by me, based on research by Ashutosh Sharma and Robert Haas. Back-patch to all supported branches, as commit 3c163a7fc was. Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
Diffstat (limited to 'config/perl.m4')
-rw-r--r--config/perl.m46
1 files changed, 4 insertions, 2 deletions
diff --git a/config/perl.m4 b/config/perl.m4
index e44ca94313..8c21d0fb39 100644
--- a/config/perl.m4
+++ b/config/perl.m4
@@ -56,7 +56,9 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
# to a different libc ABI than core Postgres uses. The available information
# says that all the symbols that affect Perl's own ABI begin with letters,
# so it should be sufficient to adopt -D switches for symbols not beginning
-# with underscore.
+# with underscore. An exception is that we need to let through
+# -D_USE_32BIT_TIME_T if it's present. (We probably could restrict that to
+# only get through on Windows, but for the moment we let it through always.)
# For debugging purposes, let's have the configure output report the raw
# ccflags value as well as the set of flags we chose to adopt.
AC_DEFUN([PGAC_CHECK_PERL_EMBED_CCFLAGS],
@@ -65,7 +67,7 @@ AC_MSG_CHECKING([for CFLAGS recommended by Perl])
perl_ccflags=`$PERL -MConfig -e ['print $Config{ccflags}']`
AC_MSG_RESULT([$perl_ccflags])
AC_MSG_CHECKING([for CFLAGS to compile embedded Perl])
-perl_embed_ccflags=`$PERL -MConfig -e ['foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/)}']`
+perl_embed_ccflags=`$PERL -MConfig -e ['foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[^_]/ || $f =~ /^-D_USE_32BIT_TIME_T/)}']`
AC_SUBST(perl_embed_ccflags)dnl
AC_MSG_RESULT([$perl_embed_ccflags])
])# PGAC_CHECK_PERL_EMBED_CCFLAGS