Skip to content

Commit d5aab70

Browse files
committed
build: add an option for enabling glibc back-compat
Using "./configure --enable-glibc-back-compat" will attempt to be compatible with a target running glibc abi 2.9 and libstdc++ abi 3.4.
1 parent ffc6b67 commit d5aab70

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

configure.ac

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ AC_ARG_ENABLE([lcov],
108108
[use_lcov=yes],
109109
[use_lcov=no])
110110

111+
AC_ARG_ENABLE([glibc-back-compat],
112+
[AS_HELP_STRING([--enable-glibc-back-compat],
113+
[enable backwards compatibility with glibc and libstdc++])],
114+
[use_glibc_compat=$enableval],
115+
[use_glibc_compat=no])
116+
111117
AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], [])
112118

113119

@@ -319,6 +325,21 @@ fi
319325

320326
AX_CHECK_LINK_FLAG([[-Wl,--large-address-aware]], [LDFLAGS="$LDFLAGS -Wl,--large-address-aware"])
321327

328+
if test x$use_glibc_compat != xno; then
329+
330+
#__fdelt_chk's params and return type have changed from long unsigned int to long int.
331+
# See which one is present here.
332+
AC_MSG_CHECKING(__fdelt_chk type)
333+
AC_TRY_COMPILE([#define __USE_FORTIFY_LEVEL 2
334+
#include <sys/select.h>
335+
extern "C" long unsigned int __fdelt_warn(long unsigned int);],[],
336+
[ fdelt_type="long unsigned int"],
337+
[ fdelt_type="long int"])
338+
AC_MSG_RESULT($fdelt_type)
339+
AC_DEFINE_UNQUOTED(FDELT_TYPE, $fdelt_type,[parameter and return value type for __fdelt_chk])
340+
341+
fi
342+
322343
if test x$use_hardening != xno; then
323344
AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"])
324345
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"])
@@ -691,6 +712,7 @@ AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
691712
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov == xyes])
692713
AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
693714
AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
715+
AM_CONDITIONAL([GLIBC_BACK_COMPAT],[test x$use_glibc_compat = xyes])
694716

695717
AC_DEFINE(CLIENT_VERSION_MAJOR, _CLIENT_VERSION_MAJOR, [Major version])
696718
AC_DEFINE(CLIENT_VERSION_MINOR, _CLIENT_VERSION_MINOR, [Minor version])

src/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ libbitcoin_common_a_SOURCES = \
135135
version.cpp \
136136
$(BITCOIN_CORE_H)
137137

138+
if GLIBC_BACK_COMPAT
139+
libbitcoin_common_a_SOURCES += compat/glibc_compat.cpp
140+
libbitcoin_common_a_SOURCES += compat/glibcxx_compat.cpp
141+
endif
142+
138143
libbitcoin_cli_a_SOURCES = \
139144
rpcclient.cpp \
140145
$(BITCOIN_CORE_H)

0 commit comments

Comments
 (0)