aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2017-11-23 20:22:04 -0800
committerNoah Misch <noah@leadboat.com>2017-11-23 20:25:08 -0800
commitda8eae56eb4eee9515d6ada512a3ec7bb57c9ffb (patch)
tree25fd4dc5ffb2131cdd00efb4dd6d49e88a23b72f /src
parentc703aa6258997d22ca7338bc221c31ff83feefb7 (diff)
downloadpostgresql-da8eae56eb4eee9515d6ada512a3ec7bb57c9ffb.tar.gz
postgresql-da8eae56eb4eee9515d6ada512a3ec7bb57c9ffb.zip
Support linking with MinGW-built Perl.
This is necessary for ActivePerl 5.18 onwards and for Strawberry Perl. It is not sufficient for 32-bit builds with newer Visual Studio; these fail with error LINK2026. Back-patch to 9.3 (all supported versions). Reported by Victor Wagner. Discussion: https://postgr.es/m/20160326154321.7754ab8f@wagner.wagner.home
Diffstat (limited to 'src')
-rw-r--r--src/pl/plperl/plperl.h8
-rw-r--r--src/tools/msvc/Mkvcbuild.pm5
2 files changed, 11 insertions, 2 deletions
diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h
index 56b41ed1cc0..7069b50a297 100644
--- a/src/pl/plperl/plperl.h
+++ b/src/pl/plperl/plperl.h
@@ -42,6 +42,14 @@
#undef vsnprintf
#endif
+/*
+ * ActivePerl 5.18 and later are MinGW-built, and their headers use GCC's
+ * __inline__. Translate to something MSVC recognizes.
+ */
+#ifdef _MSC_VER
+#define __inline__ inline
+#endif
+
/*
* Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index b437aa8831e..92374e23166 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -606,9 +606,10 @@ sub mkvcbuild
}
}
$plperl->AddReference($postgres);
+ my $perl_path = $solution->{options}->{perl} . '\lib\CORE\*perl*';
+ # ActivePerl 5.16 provided perl516.lib; 5.18 provided libperl518.a
my @perl_libs =
- grep { /perl\d+.lib$/ }
- glob($solution->{options}->{perl} . '\lib\CORE\perl*.lib');
+ grep { /perl\d+\.lib$|libperl\d+\.a$/ } glob($perl_path);
if (@perl_libs == 1)
{
$plperl->AddLibrary($perl_libs[0]);