Skip to content

Commit 460b32d

Browse files
committed
build: fix broken boost chrono check on some platforms
If clock_gettime is implemented outside of libc (librt in this case), configure would fail when testing boost. Since clock_gettime is not present on all OSs, boost only uses it when it can. Check for it in librt and add it to LIBS if found, but don't fail if it's not (since boost won't be expecting it in this case). Also, reverse the link order as necessary for static libs. Note that it's possible that there are other similar cases for boost, which may be handled the same way.
1 parent afa71fb commit 460b32d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

configure.ac

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@ AC_TRY_COMPILE([#include <sys/socket.h>],
392392
[ AC_MSG_RESULT(no)]
393393
)
394394

395+
AC_SEARCH_LIBS([clock_gettime],[rt])
396+
395397
LEVELDB_CPPFLAGS=
396398
LIBLEVELDB=
397399
LIBMEMENV=
@@ -460,11 +462,8 @@ dnl after 1.56.
460462
dnl If neither is available, abort.
461463
dnl If sleep_for is used, boost_chrono becomes a requirement.
462464
if test x$ax_cv_boost_chrono = xyes; then
463-
dnl Allow passing extra needed dependency libraries for boost-chrono from static gitian build
464-
BOOST_CHRONO_LIB="$BOOST_CHRONO_LIB $BOOST_CHRONO_EXTRALIBS"
465-
466465
TEMP_LIBS="$LIBS"
467-
LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB"
466+
LIBS="$BOOST_LIBS $BOOST_CHRONO_LIB $LIBS"
468467
TEMP_CPPFLAGS="$CPPFLAGS"
469468
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
470469
AC_TRY_LINK([
@@ -486,7 +485,7 @@ fi
486485

487486
if test x$boost_sleep != xyes; then
488487
TEMP_LIBS="$LIBS"
489-
LIBS="$LIBS $BOOST_LIBS"
488+
LIBS="$BOOST_LIBS $LIBS"
490489
TEMP_CPPFLAGS="$CPPFLAGS"
491490
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
492491
AC_TRY_LINK([

0 commit comments

Comments
 (0)