@@ -49,6 +49,37 @@ AC_DEFUN([PGAC_CHECK_PERL_CONFIGS],
49
49
[ m4_foreach ( [ pgac_item] , [ $1 ] , [ PGAC_CHECK_PERL_CONFIG(pgac_item)] ) ] )
50
50
51
51
52
+ # PGAC_CHECK_PERL_EMBED_CCFLAGS
53
+ # -----------------------------
54
+ # We selectively extract stuff from $Config{ccflags}. For debugging purposes,
55
+ # let's have the configure output report the raw ccflags value as well as the
56
+ # set of flags we chose to adopt. We don't really need anything except -D
57
+ # switches, and other sorts of compiler switches can actively break things if
58
+ # Perl was compiled with a different compiler. Moreover, although Perl likes
59
+ # to put stuff like -D_LARGEFILE_SOURCE and -D_FILE_OFFSET_BITS=64 here, it
60
+ # would be fatal to try to compile PL/Perl to a different libc ABI than core
61
+ # Postgres uses. The available information says that most symbols that affect
62
+ # Perl's own ABI begin with letters, so it's almost sufficient to adopt -D
63
+ # switches for symbols not beginning with underscore. Some exceptions are the
64
+ # Windows-specific -D_USE_32BIT_TIME_T and -D__MINGW_USE_VC2005_COMPAT; see
65
+ # Mkvcbuild.pm for details. We absorb the former when Perl reports it. Perl
66
+ # never reports the latter, and we don't attempt to deduce when it's needed.
67
+ # Consequently, we don't support using MinGW to link to MSVC-built Perl. As
68
+ # of 2017, all supported ActivePerl and Strawberry Perl are MinGW-built. If
69
+ # that changes or an MSVC-built Perl distribution becomes prominent, we can
70
+ # revisit this limitation.
71
+ AC_DEFUN ( [ PGAC_CHECK_PERL_EMBED_CCFLAGS] ,
72
+ [ AC_REQUIRE ( [ PGAC_PATH_PERL] )
73
+ AC_MSG_CHECKING ( [ for CFLAGS recommended by Perl] )
74
+ perl_ccflags=`$PERL -MConfig -e [ 'print $Config{ccflags}'] `
75
+ AC_MSG_RESULT ( [ $perl_ccflags] )
76
+ AC_MSG_CHECKING ( [ for CFLAGS to compile embedded Perl] )
77
+ perl_embed_ccflags=`$PERL -MConfig -e [ 'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[ ^_] / || $f =~ /^-D_USE_32BIT_TIME_T/)}'] `
78
+ AC_SUBST ( perl_embed_ccflags ) dnl
79
+ AC_MSG_RESULT ( [ $perl_embed_ccflags] )
80
+ ] ) # PGAC_CHECK_PERL_EMBED_CCFLAGS
81
+
82
+
52
83
# PGAC_CHECK_PERL_EMBED_LDFLAGS
53
84
# -----------------------------
54
85
# We are after Embed's ldopts, but without the subset mentioned in
@@ -59,12 +90,19 @@ AC_DEFUN([PGAC_CHECK_PERL_EMBED_LDFLAGS],
59
90
[ AC_REQUIRE ( [ PGAC_PATH_PERL] )
60
91
AC_MSG_CHECKING ( for flags to link embedded Perl )
61
92
if test "$PORTNAME" = "win32" ; then
62
- perl_lib=`basename $perl_archlibexp/CORE/perl[ [ 5-9] ] *.lib .lib`
63
- test -e "$perl_archlibexp/CORE/$perl_lib.lib" && perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
93
+ perl_lib=`basename $perl_archlibexp/CORE/perl[ [ 5-9] ] *.lib .lib`
94
+ if test -e "$perl_archlibexp/CORE/$perl_lib.lib"; then
95
+ perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
96
+ else
97
+ perl_lib=`basename $perl_archlibexp/CORE/libperl[ [ 5-9] ] *.a .a | sed 's/^lib//'`
98
+ if test -e "$perl_archlibexp/CORE/lib$perl_lib.a"; then
99
+ perl_embed_ldflags="-L$perl_archlibexp/CORE -l$perl_lib"
100
+ fi
101
+ fi
64
102
else
65
- pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
66
- pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
67
- perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e [ "s/ -arch [ -a-zA-Z0-9_] *//g"] `
103
+ pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
104
+ pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'`
105
+ perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e [ "s/ -arch [ -a-zA-Z0-9_] *//g"] `
68
106
fi
69
107
AC_SUBST ( perl_embed_ldflags ) dnl
70
108
if test -z "$perl_embed_ldflags" ; then
0 commit comments