diff --git a/Makefile.in b/Makefile.in index c6b2ed43c2..9f3f707fde 100644 --- a/Makefile.in +++ b/Makefile.in @@ -10,6 +10,7 @@ GO = @GO@ GOFMT = @GOFMT@ GOROOT = @GOROOT@ AUTORECONF = @AUTORECONF@ +LRT_LDFLAG = @LRT_LDFLAG@ # or 386, arm arch = amd64 CGO_ENABLED = 1 @@ -128,7 +129,7 @@ ifeq ($(rocksdb),yes) GO_BUILD_TAGS += rocksdb storage_engines += $(rocksdb_deps) CGO_CFLAGS += -I$(rocksdb_dir)/include -CGO_LDFLAGS += -L$(rocksdb_dir) -lrocksdb +CGO_LDFLAGS += -L$(rocksdb_dir) -lrocksdb $(LRT_LDFLAG) endif CGO_CFLAGS += -I$(leveldb_dir)/include -I$(hyperleveldb_dir)/include CGO_LDFLAGS += -L$(leveldb_dir) -L$(hyperleveldb_dir)/.libs -L$(snappy_dir)/.libs -lleveldb -lhyperleveldb -lsnappy @@ -181,7 +182,7 @@ ifeq ($(uname_S),Linux) bash -c "cd $(rocksdb_dir); \ wget -O $(rocksdb_file) https://github.com/facebook/rocksdb/archive/$(rocksdb_file); \ tar --strip-components=1 -xvzf $(rocksdb_file); \ - CFLAGS='-I$(snappy_dir) $(cflags)' CXXFLAGS='-I$(snappy_dir) $(cflags)' LDFLAGS='-L$(snappy_dir)/.libs' $(MAKE) librocksdb.a" + CFLAGS='-I$(snappy_dir) $(cflags)' CXXFLAGS='-I$(snappy_dir) $(cflags)' LDFLAGS='-L$(snappy_dir)/.libs $(LRT_LDFLAG)' $(MAKE) librocksdb.a" endif $(hyperleveldb_deps): $(snappy_deps) diff --git a/configure b/configure index c2c2fdd933..a6fb9f6de5 100755 --- a/configure +++ b/configure @@ -593,6 +593,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +LRT_LDFLAG with_flex with_bison AUTORECONF @@ -1797,6 +1798,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Extract the first word of "protoc", so it can be a program name with args. set dummy protoc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -2927,6 +2929,68 @@ else as_fn_error $? "\"cannot find libbz2\"" "$LINENO" 5 fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +$as_echo_n "checking for library containing clock_gettime... " >&6; } +if ${ac_cv_search_clock_gettime+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_clock_gettime=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_clock_gettime+:} false; then : + break +fi +done +if ${ac_cv_search_clock_gettime+:} false; then : + +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +$as_echo "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +else + as_fn_error $? "\"Cannot find an implementation of clock_gettime\"" "$LINENO" 5 +fi + + +if test x"${ac_cv_search_clock_gettime}" != x"none required"; then + LRT_LDFLAG=${ac_cv_search_clock_gettime} +fi if test x"${with_bison}" == x""; then # Extract the first word of "bison", so it can be a program name with args. diff --git a/configure.ac b/configure.ac index cdb20e9df4..6ce22c37ab 100644 --- a/configure.ac +++ b/configure.ac @@ -6,6 +6,7 @@ AC_SUBST(GOROOT) AC_SUBST(AUTORECONF) AC_SUBST(with_bison) AC_SUBST(with_flex) +AC_SUBST(LRT_LDFLAG) AC_PATH_PROG(PROTOC, protoc, "notfound") if test x"${PROTOC}" == x"notfound"; then AC_MSG_ERROR([Please install protobuf before trying to build Influxdb]) @@ -47,6 +48,11 @@ if test x"${AUTORECONF}" == x"notfound"; then fi AC_CHECK_LIB(z, gzdopen,,AC_MSG_ERROR("cannot find libz")) AC_CHECK_LIB(bz2, BZ2_bzReadOpen,,AC_MSG_ERROR("cannot find libbz2")) +AC_SEARCH_LIBS(clock_gettime,rt,,AC_MSG_ERROR("Cannot find an implementation of clock_gettime")) + +if test x"${ac_cv_search_clock_gettime}" != x"none required"; then + LRT_LDFLAG=${ac_cv_search_clock_gettime} +fi if test x"${with_bison}" == x""; then AC_PATH_PROG(with_bison, bison, "notfound")