Remove further unwanted linker flags from perl_embed_ldflags

Remove the contents of $Config{ldflags} from ExtUtils::Embed's ldopts,
like we already do with $Config{ccdlflags}.  Those flags are the
choices of those who built the Perl installation, which are not
necessarily appropriate for building PostgreSQL.  What we really want
from ldopts are the options identifying the location and name of the
libperl library, but unfortunately it doesn't appear possible to get
that separately from the other stuff.

The motivation for this was to strip -mmacosx-version-min options.  We
already did something similar for the -arch option.  Both of those are
now covered by this more general approach.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/8c4fcb72-2574-ff7c-4c25-1f032d4a2a57%40enterprisedb.com
This commit is contained in:
Peter Eisentraut 2022-08-23 16:00:38 +02:00
parent 0f47457f11
commit b4e936859d
2 changed files with 7 additions and 7 deletions

View File

@ -81,9 +81,9 @@ AC_MSG_RESULT([$perl_embed_ccflags])
# PGAC_CHECK_PERL_EMBED_LDFLAGS # PGAC_CHECK_PERL_EMBED_LDFLAGS
# ----------------------------- # -----------------------------
# We are after Embed's ldopts, but without the subset mentioned in # We are after Embed's ldopts, but without the subset mentioned in
# Config's ccdlflags; and also without any -arch flags, which recent # Config's ccdlflags and ldflags. (Those are the choices of those who
# Apple releases put in unhelpfully. (If you want a multiarch build # built the Perl installation, which are not necessarily appropriate
# you'd better be specifying it in more places than plperl's final link.) # for building PostgreSQL.)
AC_DEFUN([PGAC_CHECK_PERL_EMBED_LDFLAGS], AC_DEFUN([PGAC_CHECK_PERL_EMBED_LDFLAGS],
[AC_REQUIRE([PGAC_PATH_PERL]) [AC_REQUIRE([PGAC_PATH_PERL])
AC_MSG_CHECKING(for flags to link embedded Perl) AC_MSG_CHECKING(for flags to link embedded Perl)
@ -99,8 +99,8 @@ if test "$PORTNAME" = "win32" ; then
fi fi
else else
pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts` pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'` pgac_tmp2=`$PERL -MConfig -e 'print "$Config{ccdlflags} $Config{ldflags}"'`
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e ["s/ -arch [-a-zA-Z0-9_]*//g"]` perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%"`
fi fi
AC_SUBST(perl_embed_ldflags)dnl AC_SUBST(perl_embed_ldflags)dnl
if test -z "$perl_embed_ldflags" ; then if test -z "$perl_embed_ldflags" ; then

4
configure vendored
View File

@ -10477,8 +10477,8 @@ if test "$PORTNAME" = "win32" ; then
fi fi
else else
pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts` pgac_tmp1=`$PERL -MExtUtils::Embed -e ldopts`
pgac_tmp2=`$PERL -MConfig -e 'print $Config{ccdlflags}'` pgac_tmp2=`$PERL -MConfig -e 'print "$Config{ccdlflags} $Config{ldflags}"'`
perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%" -e "s/ -arch [-a-zA-Z0-9_]*//g"` perl_embed_ldflags=`echo X"$pgac_tmp1" | sed -e "s/^X//" -e "s%$pgac_tmp2%%"`
fi fi
if test -z "$perl_embed_ldflags" ; then if test -z "$perl_embed_ldflags" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5