Skip to content

Commit

Permalink
build: fix broken boost chrono check on some platforms
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
theuni committed Jul 22, 2014
1 parent afa71fb commit 460b32d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ AC_TRY_COMPILE([#include <sys/socket.h>],
[ AC_MSG_RESULT(no)]
)

AC_SEARCH_LIBS([clock_gettime],[rt])

LEVELDB_CPPFLAGS=
LIBLEVELDB=
LIBMEMENV=
Expand Down Expand Up @@ -460,11 +462,8 @@ dnl after 1.56.
dnl If neither is available, abort.
dnl If sleep_for is used, boost_chrono becomes a requirement.
if test x$ax_cv_boost_chrono = xyes; then
dnl Allow passing extra needed dependency libraries for boost-chrono from static gitian build
BOOST_CHRONO_LIB="$BOOST_CHRONO_LIB $BOOST_CHRONO_EXTRALIBS"

TEMP_LIBS="$LIBS"
LIBS="$LIBS $BOOST_LIBS $BOOST_CHRONO_LIB"
LIBS="$BOOST_LIBS $BOOST_CHRONO_LIB $LIBS"
TEMP_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
AC_TRY_LINK([
Expand All @@ -486,7 +485,7 @@ fi

if test x$boost_sleep != xyes; then
TEMP_LIBS="$LIBS"
LIBS="$LIBS $BOOST_LIBS"
LIBS="$BOOST_LIBS $LIBS"
TEMP_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
AC_TRY_LINK([
Expand Down

0 comments on commit 460b32d

Please sign in to comment.