Skip to content

Commit

Permalink
acinclude: Also support pkg-config for configuring dpdk.
Browse files Browse the repository at this point in the history
If available use dpdk pkg-config info of libdpdk to set the right
include paths.
That for example, allows packagers to provide non default include
paths in a common way (pkg-config).

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Suggested-by: Luca Boccassi <luca.boccassi@gmail.com>
Acked-by: Luca Boccassi <luca.boccassi@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
  • Loading branch information
cpaelzer authored and blp committed Aug 7, 2017
1 parent f2d3fef commit 96195c0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
6 changes: 5 additions & 1 deletion Documentation/intro/install/dpdk.rst
Expand Up @@ -124,7 +124,11 @@ has to be configured with DPDK support (``--with-dpdk``).
$ ./configure --with-dpdk=$DPDK_BUILD

where ``DPDK_BUILD`` is the path to the built DPDK library. This can be
skipped if DPDK library is installed in its default location
skipped if DPDK library is installed in its default location.

If no path is provided to ``--with-dpdk``, but a pkg-config configuration
for libdpdk is available the include paths will be generated via an
equivalent ``pkg-config --cflags libdpdk``.

.. note::
While ``--with-dpdk`` is required, you can pass any other configuration
Expand Down
17 changes: 10 additions & 7 deletions acinclude.m4
Expand Up @@ -208,16 +208,19 @@ AC_DEFUN([OVS_CHECK_DPDK], [
case "$with_dpdk" in
yes)
DPDK_AUTO_DISCOVER="true"
DPDK_INCLUDE="/usr/local/include/dpdk -I/usr/include/dpdk"
PKG_CHECK_MODULES([DPDK], [libdpdk],
[DPDK_INCLUDE="$DPDK_CFLAGS"],
[DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk"])
;;
*)
DPDK_AUTO_DISCOVER="false"
DPDK_INCLUDE="$with_dpdk/include"
DPDK_INCLUDE_PATH="$with_dpdk/include"
# If 'with_dpdk' is passed install directory, point to headers
# installed in $DESTDIR/$prefix/include/dpdk
if test ! -e "$DPDK_INCLUDE/rte_config.h" && \
test -e "$DPDK_INCLUDE/dpdk/rte_config.h"; then
DPDK_INCLUDE=$DPDK_INCLUDE/dpdk
if test -e "$DPDK_INCLUDE_PATH/rte_config.h"; then
DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH"
elif test -e "$DPDK_INCLUDE_PATH/dpdk/rte_config.h"; then
DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk"
fi
DPDK_LIB_DIR="$with_dpdk/lib"
;;
Expand All @@ -228,7 +231,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [
ovs_save_CFLAGS="$CFLAGS"
ovs_save_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS -I$DPDK_INCLUDE"
CFLAGS="$CFLAGS $DPDK_INCLUDE"
if test "$DPDK_AUTO_DISCOVER" = "false"; then
LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}"
fi
Expand Down Expand Up @@ -304,7 +307,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [
if test "$DPDK_AUTO_DISCOVER" = "false"; then
OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR"
fi
OVS_CFLAGS="$OVS_CFLAGS -I$DPDK_INCLUDE"
OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE"
OVS_ENABLE_OPTION([-mssse3])
# DPDK pmd drivers are not linked unless --whole-archive is used.
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Expand Up @@ -28,6 +28,7 @@ AC_PROG_CPP
AC_PROG_MKDIR_P
AC_PROG_FGREP
AC_PROG_EGREP
PKG_PROG_PKG_CONFIG

AC_ARG_VAR([PERL], [path to Perl interpreter])
AC_PATH_PROG([PERL], perl, no)
Expand Down

0 comments on commit 96195c0

Please sign in to comment.