Skip to content

Commit

Permalink
Add extra parameter to pass vendor LDFLAGS for libsai.so (#1291)
Browse files Browse the repository at this point in the history
Since vendor libsai.so may require some extra libs we need
to pass this as a param for linker
  • Loading branch information
kcudnik authored Sep 16, 2023
1 parent 8046908 commit cfa8da4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,17 @@ CXXFLAGS="$SAVED_FLAGS"

AC_SUBST(CXXFLAGS_COMMON)

AC_ARG_WITH(extra-libsai-ldflags,
[ --with-extra-libsai-ldflags=FLAGS
extra libsai.so flags for vendor library],
[AC_SUBST(EXTRA_LIBSAI_LDFLAGS, "${withval}")])

AC_SUBST(SAIINC, "-I\$(top_srcdir)/SAI/inc -I\$(top_srcdir)/SAI/experimental -I\$(top_srcdir)/SAI/meta")

AM_COND_IF([SYNCD], [
AM_COND_IF([SAIVS], [], [
SAVED_FLAGS="$CXXFLAGS"
CXXFLAGS="-Xlinker --no-as-needed -lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta"
CXXFLAGS="-Xlinker --no-as-needed -lsai -I$srcdir/SAI/inc -I$srcdir/SAI/experimental -I$srcdir/SAI/meta $EXTRA_LIBSAI_LDFLAGS"
AC_CHECK_FUNCS(sai_query_api_version, [
AC_MSG_CHECKING([SAI headers API version and library version check])
AC_TRY_RUN([
Expand Down
2 changes: 1 addition & 1 deletion saidiscovery/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ saidiscovery_SOURCES = saidiscovery.cpp
saidiscovery_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
saidiscovery_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
saidiscovery_LDADD = -lhiredis -lswsscommon $(top_srcdir)/syncd/libSyncd.a $(SAILIB) -lpthread \
-L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
-L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) $(EXTRA_LIBSAI_LDFLAGS)
2 changes: 1 addition & 1 deletion saisdkdump/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ endif
saisdkdump_SOURCES = saisdkdump.cpp
saisdkdump_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
saisdkdump_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS)
saisdkdump_LDADD = -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS)
saisdkdump_LDADD = -lhiredis -lswsscommon $(SAILIB) -lpthread -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta -lzmq $(CODE_COVERAGE_LIBS) $(EXTRA_LIBSAI_LDFLAGS)
2 changes: 1 addition & 1 deletion syncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ endif
syncd_CPPFLAGS = $(CODE_COVERAGE_CPPFLAGS)
syncd_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) $(CODE_COVERAGE_CXXFLAGS) $(CFLAGS_ASAN)
syncd_LDADD = libSyncd.a $(top_srcdir)/lib/libSaiRedis.a -L$(top_srcdir)/meta/.libs -lsaimetadata -lsaimeta \
-ldl -lhiredis -lswsscommon $(SAILIB) -lpthread -lzmq $(CODE_COVERAGE_LIBS)
-ldl -lhiredis -lswsscommon $(SAILIB) -lpthread -lzmq $(CODE_COVERAGE_LIBS) $(EXTRA_LIBSAI_LDFLAGS)
syncd_LDFLAGS = $(LDFLAGS_ASAN) -rdynamic

if SAITHRIFT
Expand Down

0 comments on commit cfa8da4

Please sign in to comment.