Skip to content

Commit ca658c9

Browse files
committed
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
1 parent aa5bb82 commit ca658c9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

configure

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18615,6 +18615,10 @@ fi
1861518615
# On most platforms, if perl.h is there then libperl.so will be too, but at
1861618616
# this writing Debian packages them separately. There is no known reason to
1861718617
# waste cycles on separate probes for the Tcl or Python libraries, though.
18618+
# On some Red Hat platforms, the link attempt can fail if we don't use
18619+
# CFLAGS_SL while building the test program.
18620+
ac_save_CFLAGS=$CFLAGS
18621+
CFLAGS="$CFLAGS $CFLAGS_SL"
1861818622
pgac_save_LIBS=$LIBS
1861918623
LIBS="$perl_embed_ldflags"
1862018624
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libperl" >&5
@@ -18644,6 +18648,7 @@ fi
1864418648
rm -f core conftest.err conftest.$ac_objext \
1864518649
conftest$ac_exeext conftest.$ac_ext
1864618650
LIBS=$pgac_save_LIBS
18651+
CFLAGS=$ac_save_CFLAGS
1864718652
CPPFLAGS=$ac_save_CPPFLAGS
1864818653
fi
1864918654

configure.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,10 @@ if test "$with_perl" = yes; then
22582258
# On most platforms, if perl.h is there then libperl.so will be too, but at
22592259
# this writing Debian packages them separately. There is no known reason to
22602260
# waste cycles on separate probes for the Tcl or Python libraries, though.
2261+
# On some Red Hat platforms, the link attempt can fail if we don't use
2262+
# CFLAGS_SL while building the test program.
2263+
ac_save_CFLAGS=$CFLAGS
2264+
CFLAGS="$CFLAGS $CFLAGS_SL"
22612265
pgac_save_LIBS=$LIBS
22622266
LIBS="$perl_embed_ldflags"
22632267
AC_MSG_CHECKING([for libperl])
@@ -2269,6 +2273,7 @@ if test "$with_perl" = yes; then
22692273
[AC_MSG_RESULT(no)
22702274
AC_MSG_ERROR([libperl library is required for Perl])])
22712275
LIBS=$pgac_save_LIBS
2276+
CFLAGS=$ac_save_CFLAGS
22722277
CPPFLAGS=$ac_save_CPPFLAGS
22732278
fi
22742279

0 commit comments

Comments
 (0)