diff --git a/common/Makefile.am b/common/Makefile.am index d7855ccb3..5ea63f827 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -75,7 +75,7 @@ common_libswsscommon_la_SOURCES = \ common_libswsscommon_la_CXXFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(LIBNL_CFLAGS) $(CODE_COVERAGE_CXXFLAGS) common_libswsscommon_la_CPPFLAGS = $(DBGFLAGS) $(AM_CFLAGS) $(CFLAGS_COMMON) $(LIBNL_CPPFLAGS) $(CODE_COVERAGE_CPPFLAGS) -common_libswsscommon_la_LIBADD = -lpthread $(LIBNL_LIBS) $(CODE_COVERAGE_LIBS) -lzmq -lboost_serialization -luuid -lyang -ldashapi +common_libswsscommon_la_LIBADD = -lpthread $(LIBNL_LIBS) $(CODE_COVERAGE_LIBS) -lzmq -lboost_serialization -luuid -lyang common_libswsscommon_la_LDFLAGS = -Wl,-z,now $(LDFLAGS) common_swssloglevel_SOURCES = \ diff --git a/common/redisreply.cpp b/common/redisreply.cpp index 0d3048511..f5dfd83e0 100644 --- a/common/redisreply.cpp +++ b/common/redisreply.cpp @@ -1,3 +1,5 @@ +#include "config.h" + #include #include #include @@ -15,7 +17,9 @@ #include "common/rediscommand.h" #include "common/stringutility.h" +#ifdef DASH_API_INSTALLED #include +#endif using namespace std; using namespace boost; @@ -320,6 +324,7 @@ string RedisReply::to_string(redisReply *reply,const vector &commands) auto command = boost::to_upper_copy(commands[0]); +#ifdef DASH_API_INSTALLED if (commands.size() > 1) { if (reply->type == REDIS_REPLY_ARRAY @@ -331,6 +336,7 @@ string RedisReply::to_string(redisReply *reply,const vector &commands) return formatPbReply(reply->element, reply->elements, commands[1]); } } +#endif return to_string(reply, command); } diff --git a/configure.ac b/configure.ac index 33b017500..0055130f3 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,11 @@ PKG_CHECK_MODULES([LIBNL], [libnl-3.0 libnl-genl-3.0 libnl-route-3.0 libnl-nf-3. CFLAGS="$CFLAGS $LIBNL_CFLAGS" LIBS="$LIBS $LIBNL_LIBS" +AC_CHECK_LIB([dashapi], [PbBinaryToJsonString], [ + AC_DEFINE(DASH_API_INSTALLED, 1, [Define if DASH API is installed]) + LIBS="$LIBS -ldashapi" +],) + LDFLAGS="-Wl,--no-undefined $LDFLAGS" AC_SUBST([LDFLAGS])