Commit d995fd66 authored by Tom Lane's avatar Tom Lane

Use CFLAGS_SL while probing linkability of libperl.

On recent Red Hat platforms (at least RHEL 8 and Fedora 30, maybe older),
configure's probe for libperl failed if the user forces CFLAGS to be -O0.
This is because some code in perl's inline.h fails to be optimized away
at -O0, and said code doesn't work if compiled without -fPIC.

To fix, add CFLAGS_SL to the compile flags used during the libperl probe.
This is a better simulation of the way that plperl is built, anyway,
so it might forestall other issues in future.

Per gripe from Kyotaro Horiguchi.  Back-patch to all supported branches,
since people might want to build older branches on these platforms.

Discussion: https://postgr.es/m/20191010.144533.263180400.horikyota.ntt@gmail.com
parent 44273ce4
...@@ -18490,6 +18490,10 @@ fi ...@@ -18490,6 +18490,10 @@ fi
# On most platforms, if perl.h is there then libperl.so will be too, but at # On most platforms, if perl.h is there then libperl.so will be too, but at
# this writing Debian packages them separately. There is no known reason to # this writing Debian packages them separately. There is no known reason to
# waste cycles on separate probes for the Tcl or Python libraries, though. # waste cycles on separate probes for the Tcl or Python libraries, though.
# On some Red Hat platforms, the link attempt can fail if we don't use
# CFLAGS_SL while building the test program.
ac_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $CFLAGS_SL"
pgac_save_LIBS=$LIBS pgac_save_LIBS=$LIBS
LIBS="$perl_embed_ldflags" LIBS="$perl_embed_ldflags"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libperl" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libperl" >&5
...@@ -18519,6 +18523,7 @@ fi ...@@ -18519,6 +18523,7 @@ fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
LIBS=$pgac_save_LIBS LIBS=$pgac_save_LIBS
CFLAGS=$ac_save_CFLAGS
CPPFLAGS=$ac_save_CPPFLAGS CPPFLAGS=$ac_save_CPPFLAGS
fi fi
......
...@@ -2253,6 +2253,10 @@ if test "$with_perl" = yes; then ...@@ -2253,6 +2253,10 @@ if test "$with_perl" = yes; then
# On most platforms, if perl.h is there then libperl.so will be too, but at # On most platforms, if perl.h is there then libperl.so will be too, but at
# this writing Debian packages them separately. There is no known reason to # this writing Debian packages them separately. There is no known reason to
# waste cycles on separate probes for the Tcl or Python libraries, though. # waste cycles on separate probes for the Tcl or Python libraries, though.
# On some Red Hat platforms, the link attempt can fail if we don't use
# CFLAGS_SL while building the test program.
ac_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $CFLAGS_SL"
pgac_save_LIBS=$LIBS pgac_save_LIBS=$LIBS
LIBS="$perl_embed_ldflags" LIBS="$perl_embed_ldflags"
AC_MSG_CHECKING([for libperl]) AC_MSG_CHECKING([for libperl])
...@@ -2264,6 +2268,7 @@ if test "$with_perl" = yes; then ...@@ -2264,6 +2268,7 @@ if test "$with_perl" = yes; then
[AC_MSG_RESULT(no) [AC_MSG_RESULT(no)
AC_MSG_ERROR([libperl library is required for Perl])]) AC_MSG_ERROR([libperl library is required for Perl])])
LIBS=$pgac_save_LIBS LIBS=$pgac_save_LIBS
CFLAGS=$ac_save_CFLAGS
CPPFLAGS=$ac_save_CPPFLAGS CPPFLAGS=$ac_save_CPPFLAGS
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment