Skip to content

Commit

Permalink
make: adding --with-sai arg to select which SAI to compile with (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
stcheng committed Apr 16, 2016
1 parent 8177924 commit 8362b9f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
10 changes: 10 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ AC_ARG_ENABLE(debug,
esac],[debug=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)

AC_ARG_WITH(sai,
[ --with-sai Compiling against specific SAI],
[case "${withval}" in
bcm) sai=bcm ;;
mlnx) sai=mlnx ;;
*) AC_MSG_ERROR(bad value ${withval} for --with-sai) ;;
esac])
AM_CONDITIONAL(SAIBCM, test x$sai = xbcm)
AM_CONDITIONAL(SAIMLNX, test x$sai = xmlnx)

CFLAGS_COMMON="-std=c++11 -Wall -fPIC -Wno-write-strings"
AC_SUBST(CFLAGS_COMMON)

Expand Down
10 changes: 9 additions & 1 deletion syncd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ else
DBGFLAGS = -g
endif

if SAIBCM
SAIFLAGS = -DBRCMSAI
endif

if SAIMLNX
SAIFLAGS = -DMLNXSAI
endif

syncd_SOURCES = syncd.cpp \
syncd_init.cpp \
syncd_notifications.cpp \
Expand All @@ -17,6 +25,6 @@ syncd_SOURCES = syncd.cpp \

syncd_CPPFLAGS = $(DBGFLAGS) $(AM_CPPFLAGS) $(CFLAGS_COMMON) \
-I$(top_srcdir)/lib/inc \
-I/usr/include/sai
-I/usr/include/sai $(SAIFLAGS)
syncd_LDADD = -lhiredis -lswsscommon -lsai -lpthread

2 changes: 2 additions & 0 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,10 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}

#ifdef BRCMSAI
std::thread bcm_diag_shell_thread = std::thread(sai_diag_shell);
bcm_diag_shell_thread.detach();
#endif /* BRCMSAI */
#else
sai_switch_api->initialize_switch(
0, // profile id
Expand Down

0 comments on commit 8362b9f

Please sign in to comment.