aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/m4/odp_dpdk.m4
blob: 58d14727b09ca87d4a8f7d81f05c4365eed732fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
##########################################################################
# Enable DPDK support
##########################################################################
pktio_dpdk_support=no
AC_ARG_WITH([dpdk-path],
AC_HELP_STRING([--with-dpdk-path=DIR   path to dpdk build directory]),
    [DPDK_PATH=$withval
    AM_CPPFLAGS="$AM_CPPFLAGS -msse4.2 -isystem $DPDK_PATH/include"
    pktio_dpdk_support=yes],[])

##########################################################################
# Save and set temporary compilation flags
##########################################################################
OLD_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS"

##########################################################################
# Check for DPDK availability
#
# DPDK pmd drivers are not linked unless the --whole-archive option is
# used. No spaces are allowed between the --whole-arhive flags.
##########################################################################
if test x$pktio_dpdk_support = xyes
then
    AC_CHECK_HEADERS([rte_config.h], [],
        [AC_MSG_FAILURE(["can't find DPDK header"])])

    DPDK_PMD=--whole-archive,
    for filename in $with_dpdk_path/lib/*.a; do
        cur_driver=`echo $(basename "$filename" .a) | \
            sed -n 's/^\(librte_pmd_\)/-lrte_pmd_/p' | sed -n 's/$/,/p'`
        # rte_pmd_nfp has external dependencies which break linking
        if test "$cur_driver" = "-lrte_pmd_nfp,"; then
            echo "skip linking rte_pmd_nfp"
        else
            DPDK_PMD+=$cur_driver
        fi
    done
    DPDK_PMD+=--no-whole-archive

    ODP_CFLAGS="$ODP_CFLAGS -DODP_PKTIO_DPDK"
    AM_LDFLAGS="$AM_LDFLAGS -L$DPDK_PATH/lib -Wl,$DPDK_PMD"
    LIBS="$LIBS -ldpdk -ldl -lpcap"
else
    pktio_dpdk_support=no
fi

##########################################################################
# Restore old saved variables
##########################################################################
CPPFLAGS=$OLD_CPPFLAGS