Skip to content

Commit

Permalink
[configure.ac] Add the option of passing libnl path to configure scri…
Browse files Browse the repository at this point in the history
…pt (sonic-net#1824)

**What I did**
Add the option of passing custmol built libnl path to configure script

**Why I did it**
MPLS feature in sonic-buildimage requires a libnl patch to be applied before building libnl. Since this build is not installed in usual locations (/usr/lib/..) LGTM analysis fails. This change gives the option of passing libnl library location to 'configure' script and generate libraries to be linked.

In case the options are not passed, the configure script defaults to earlier behavior where it checks for LIBNL in usual locations
  • Loading branch information
smaheshm committed Jul 20, 2021
1 parent ed6786d commit c805021
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ AC_HEADER_STDC
AC_CHECK_LIB([hiredis], [redisConnect],,
AC_MSG_ERROR([libhiredis is not installed.]))

AC_CHECK_LIB([nl-genl-3], [genl_connect])

AC_CHECK_LIB([team], [team_alloc],
AM_CONDITIONAL(HAVE_LIBTEAM, true),
[AC_MSG_WARN([libteam is not installed.])
Expand Down Expand Up @@ -46,7 +44,27 @@ AC_ARG_WITH(extra-lib,
prefix where extra libraries are installed],
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])

CFLAGS_COMMON="-std=c++14 -Wall -fPIC -Wno-write-strings -I/usr/include/libnl3 -I/usr/include/swss"
AC_ARG_WITH(extra-usr-lib,
[ --with-extra-usr-lib=DIR
prefix where extra libraries are installed],
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])

AC_CHECK_LIB([nl-3], [nl_addr_alloc])
AC_CHECK_LIB([nl-genl-3], [nl_socket_get_cb])
AC_CHECK_LIB([nl-route-3], [rtnl_route_nh_get_encap_mpls_dst])
AC_CHECK_LIB([nl-nf-3], [nfnl_connect])

CFLAGS_COMMON="-std=c++14 -Wall -fPIC -Wno-write-strings -I/usr/include/swss"

AC_ARG_WITH(libnl-3.0-inc,
[ --with-libnl-3.0-inc=DIR
prefix where libnl-3.0 includes are installed],
[AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${withval}")
AC_SUBST(LIBNL_INC_DIR, "${withval}")])

if test "${with_libnl_3_0_inc+set}" != set; then
CFLAGS_COMMON+=" -I/usr/include/libnl3"
fi

CFLAGS_COMMON+=" -Werror"
CFLAGS_COMMON+=" -Wno-reorder"
Expand Down

0 comments on commit c805021

Please sign in to comment.