On Wed, 2017-07-05 at 11:19 +0200, Christian Ehrhardt wrote:
> 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.ehrha...@canonical.com>
> Suggested-by: Luca Boccassi <luca.bocca...@gmail.com>
> ---
>  Documentation/intro/install/dpdk.rst |  6 +++++-
>  acinclude.m4                         | 18 +++++++++++-------
>  configure.ac                         |  1 +
>  3 files changed, 17 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/intro/install/dpdk.rst
> b/Documentation/intro/install/dpdk.rst
> index e83f852..097cd56 100644
> --- a/Documentation/intro/install/dpdk.rst
> +++ b/Documentation/intro/install/dpdk.rst
> @@ -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
> diff --git a/acinclude.m4 b/acinclude.m4
> index 7d7b683..3a388e2 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -199,16 +199,20 @@ 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
> -        AC_CHECK_FILE([$DPDK_INCLUDE/rte_config.h], [],
> -                      [AC_CHECK_FILE([$DPDK_INCLUDE/dpdk/rte_config.
> h],
> -                                     [DPDK_INCLUDE=$DPDK_INCLUDE/dpd
> k], [])])
> +        AC_CHECK_FILE([$DPDK_INCLUDE_PATH/rte_config.h],
> +                      [DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH"],
> +                      [AC_CHECK_FILE([$DPDK_INCLUDE_PATH/dpdk/rte_co
> nfig.h],
> +                                     [DPDK_INCLUDE="-
> I$DPDK_INCLUDE_PATH/dpdk"],
> +                                     [])])
>          DPDK_LIB_DIR="$with_dpdk/lib"
>          ;;
>      esac
> @@ -218,7 +222,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
> @@ -294,7 +298,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.
> diff --git a/configure.ac b/configure.ac
> index 6404b5f..b364f28 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -27,6 +27,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)

Acked-by: Luca Boccassi <luca.bocca...@gmail.com>
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to