Skip to content

Commit 328b813

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 e167b1a commit 328b813

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
@@ -16348,6 +16348,10 @@ fi
1634816348
# On most platforms, if perl.h is there then libperl.so will be too, but at
1634916349
# this writing Debian packages them separately. There is no known reason to
1635016350
# waste cycles on separate probes for the Tcl or Python libraries, though.
16351+
# On some Red Hat platforms, the link attempt can fail if we don't use
16352+
# CFLAGS_SL while building the test program.
16353+
ac_save_CFLAGS=$CFLAGS
16354+
CFLAGS="$CFLAGS $CFLAGS_SL"
1635116355
pgac_save_LIBS=$LIBS
1635216356
LIBS="$perl_embed_ldflags"
1635316357
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libperl" >&5
@@ -16377,6 +16381,7 @@ fi
1637716381
rm -f core conftest.err conftest.$ac_objext \
1637816382
conftest$ac_exeext conftest.$ac_ext
1637916383
LIBS=$pgac_save_LIBS
16384+
CFLAGS=$ac_save_CFLAGS
1638016385
CPPFLAGS=$ac_save_CPPFLAGS
1638116386
fi
1638216387

configure.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,6 +2151,10 @@ if test "$with_perl" = yes; then
21512151
# On most platforms, if perl.h is there then libperl.so will be too, but at
21522152
# this writing Debian packages them separately. There is no known reason to
21532153
# waste cycles on separate probes for the Tcl or Python libraries, though.
2154+
# On some Red Hat platforms, the link attempt can fail if we don't use
2155+
# CFLAGS_SL while building the test program.
2156+
ac_save_CFLAGS=$CFLAGS
2157+
CFLAGS="$CFLAGS $CFLAGS_SL"
21542158
pgac_save_LIBS=$LIBS
21552159
LIBS="$perl_embed_ldflags"
21562160
AC_MSG_CHECKING([for libperl])
@@ -2162,6 +2166,7 @@ if test "$with_perl" = yes; then
21622166
[AC_MSG_RESULT(no)
21632167
AC_MSG_ERROR([libperl library is required for Perl])])
21642168
LIBS=$pgac_save_LIBS
2169+
CFLAGS=$ac_save_CFLAGS
21652170
CPPFLAGS=$ac_save_CPPFLAGS
21662171
fi
21672172

0 commit comments

Comments
 (0)