Skip to content

Commit c805021

Browse files
authored
[configure.ac] Add the option of passing libnl path to configure script (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
1 parent ed6786d commit c805021

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

configure.ac

+21-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ AC_HEADER_STDC
1313
AC_CHECK_LIB([hiredis], [redisConnect],,
1414
AC_MSG_ERROR([libhiredis is not installed.]))
1515

16-
AC_CHECK_LIB([nl-genl-3], [genl_connect])
17-
1816
AC_CHECK_LIB([team], [team_alloc],
1917
AM_CONDITIONAL(HAVE_LIBTEAM, true),
2018
[AC_MSG_WARN([libteam is not installed.])
@@ -46,7 +44,27 @@ AC_ARG_WITH(extra-lib,
4644
prefix where extra libraries are installed],
4745
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])
4846

49-
CFLAGS_COMMON="-std=c++14 -Wall -fPIC -Wno-write-strings -I/usr/include/libnl3 -I/usr/include/swss"
47+
AC_ARG_WITH(extra-usr-lib,
48+
[ --with-extra-usr-lib=DIR
49+
prefix where extra libraries are installed],
50+
[AC_SUBST(LDFLAGS, "$LDFLAGS -L${withval}")])
51+
52+
AC_CHECK_LIB([nl-3], [nl_addr_alloc])
53+
AC_CHECK_LIB([nl-genl-3], [nl_socket_get_cb])
54+
AC_CHECK_LIB([nl-route-3], [rtnl_route_nh_get_encap_mpls_dst])
55+
AC_CHECK_LIB([nl-nf-3], [nfnl_connect])
56+
57+
CFLAGS_COMMON="-std=c++14 -Wall -fPIC -Wno-write-strings -I/usr/include/swss"
58+
59+
AC_ARG_WITH(libnl-3.0-inc,
60+
[ --with-libnl-3.0-inc=DIR
61+
prefix where libnl-3.0 includes are installed],
62+
[AC_SUBST(CPPFLAGS, "$CPPFLAGS -I${withval}")
63+
AC_SUBST(LIBNL_INC_DIR, "${withval}")])
64+
65+
if test "${with_libnl_3_0_inc+set}" != set; then
66+
CFLAGS_COMMON+=" -I/usr/include/libnl3"
67+
fi
5068

5169
CFLAGS_COMMON+=" -Werror"
5270
CFLAGS_COMMON+=" -Wno-reorder"

0 commit comments

Comments
 (0)