1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

MSVC: Test whether 32-bit Perl needs -D_USE_32BIT_TIME_T.

Commits 5a5c2feca3 and
b5178c5d08 introduced support for modern
MSVC-built, 32-bit Perl, but they broke use of MinGW-built, 32-bit Perl
distributions like Strawberry Perl and modern ActivePerl.  Perl has no
robust means to report whether it expects a -D_USE_32BIT_TIME_T ABI, so
test this.  Back-patch to 9.3 (all supported versions).

The chief alternative was a heuristic of adding -D_USE_32BIT_TIME_T when
$Config{gccversion} is nonempty.  That banks on every gcc-built Perl
using the same ABI.  gcc could change its default ABI the way MSVC once
did, and one could build Perl with gcc and the non-default ABI.

The GNU make build system could benefit from a similar test, without
which it does not support MSVC-built Perl.  For now, just add a comment.
Most users taking the special step of building Perl with MSVC probably
build PostgreSQL with MSVC.

Discussion: https://postgr.es/m/20171130041441.GA3161526@rfd.leadboat.com
This commit is contained in:
Noah Misch
2017-12-08 18:06:05 -08:00
parent 005ac298b1
commit 65a00f3035
2 changed files with 158 additions and 42 deletions

View File

@ -48,19 +48,23 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
# PGAC_CHECK_PERL_EMBED_CCFLAGS
# -----------------------------
# We selectively extract stuff from $Config{ccflags}. We don't really need
# anything except -D switches, and other sorts of compiler switches can
# actively break things if Perl was compiled with a different compiler.
# Moreover, although Perl likes to put stuff like -D_LARGEFILE_SOURCE and
# -D_FILE_OFFSET_BITS=64 here, it would be fatal to try to compile PL/Perl
# 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. 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.
# We selectively extract stuff from $Config{ccflags}. 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. We don't really need anything except -D
# switches, and other sorts of compiler switches can actively break things if
# Perl was compiled with a different compiler. Moreover, although Perl likes
# to put stuff like -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 here, it
# would be fatal to try to compile PL/Perl to a different libc ABI than core
# Postgres uses. The available information says that most symbols that affect
# Perl's own ABI begin with letters, so it's almost sufficient to adopt -D
# switches for symbols not beginning with underscore. Some exceptions are the
# Windows-specific -D_USE_32BIT_TIME_T and -D__MINGW_USE_VC2005_COMPAT; see
# Mkvcbuild.pm for details. We absorb the former when Perl reports it. Perl
# never reports the latter, and we don't attempt to deduce when it's needed.
# Consequently, we don't support using MinGW to link to MSVC-built Perl. As
# of 2017, all supported ActivePerl and Strawberry Perl are MinGW-built. If
# that changes or an MSVC-built Perl distribution becomes prominent, we can
# revisit this limitation.
AC_DEFUN([PGAC_CHECK_PERL_EMBED_CCFLAGS],
[AC_REQUIRE([PGAC_PATH_PERL])
AC_MSG_CHECKING([for CFLAGS recommended by Perl])