@@ -49,6 +49,31 @@ 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}. We don't really need
55
+ # anything except -D switches, and other sorts of compiler switches can
56
+ # actively break things if Perl was compiled with a different compiler.
57
+ # Moreover, although Perl likes to put stuff like -D_LARGEFILE_SOURCE and
58
+ # -D_FILE_OFFSET_BITS=64 here, it would be fatal to try to compile PL/Perl
59
+ # to a different libc ABI than core Postgres uses. The available information
60
+ # says that all the symbols that affect Perl's own ABI begin with letters,
61
+ # so it should be sufficient to adopt -D switches for symbols not beginning
62
+ # with underscore.
63
+ # For debugging purposes, let's have the configure output report the raw
64
+ # ccflags value as well as the set of flags we chose to adopt.
65
+ AC_DEFUN ( [ PGAC_CHECK_PERL_EMBED_CCFLAGS] ,
66
+ [ AC_REQUIRE ( [ PGAC_PATH_PERL] )
67
+ AC_MSG_CHECKING ( [ for CFLAGS recommended by Perl] )
68
+ perl_ccflags=`$PERL -MConfig -e [ 'print $Config{ccflags}'] `
69
+ AC_MSG_RESULT ( [ $perl_ccflags] )
70
+ AC_MSG_CHECKING ( [ for CFLAGS to compile embedded Perl] )
71
+ perl_embed_ccflags=`$PERL -MConfig -e [ 'foreach $f (split(" ",$Config{ccflags})) {print $f, " " if ($f =~ /^-D[ ^_] /)}'] `
72
+ AC_SUBST ( perl_embed_ccflags ) dnl
73
+ AC_MSG_RESULT ( [ $perl_embed_ccflags] )
74
+ ] ) # PGAC_CHECK_PERL_EMBED_CCFLAGS
75
+
76
+
52
77
# PGAC_CHECK_PERL_EMBED_LDFLAGS
53
78
# -----------------------------
54
79
# We are after Embed's ldopts, but without the subset mentioned in
0 commit comments