Skip to content

Commit f58a219

Browse files
committed
build: Use pkg-config to detect libnl3 header path
The libnl3 header search paths may be specified as '-I' options in "libnl-3.0.pc" cflags. This patch can now detect it automatically. The user may set the LIBNL3_CFLAGS environment variable to override pkg-config detection during build. If pkg-config is not available, a default include path "/usr/include/libnl3" will be used. Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
1 parent 5ef62af commit f58a219

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

configure.ac

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,17 @@ esac
10371037

10381038
case "$enable_delayacct" in
10391039
check|yes)
1040+
if test "x${LIBNL3_CFLAGS+y}" = x; then
1041+
m4_ifdef([PKG_PROG_PKG_CONFIG], [
1042+
PKG_CHECK_MODULES(LIBNL3, libnl-3.0, [], [LIBNL3_CFLAGS="-I/usr/include/libnl3"])
1043+
], [
1044+
LIBNL3_CFLAGS="-I/usr/include/libnl3"
1045+
])
1046+
fi
1047+
10401048
old_CFLAGS="$CFLAGS"
1041-
CFLAGS="$CFLAGS -I/usr/include/libnl3"
1049+
# New include path searched after what user has specified
1050+
CFLAGS="$CFLAGS $LIBNL3_CFLAGS"
10421051
AC_CHECK_HEADERS([netlink/attr.h netlink/handlers.h netlink/msg.h],
10431052
[],
10441053
[if test "$enable_delayacct" = yes; then
@@ -1054,7 +1063,7 @@ case "$enable_delayacct" in
10541063
esac
10551064
if test "$enable_delayacct" = yes; then
10561065
AC_DEFINE([HAVE_DELAYACCT], [1], [Define if delay accounting support should be enabled.])
1057-
AM_CFLAGS="$AM_CFLAGS -I/usr/include/libnl3"
1066+
AM_CFLAGS="$AM_CFLAGS $LIBNL3_CFLAGS"
10581067
fi
10591068
AM_CONDITIONAL([HAVE_DELAYACCT], [test "$enable_delayacct" = yes])
10601069

0 commit comments

Comments
 (0)