diff options
author | Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> | 2017-10-17 12:37:25 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2017-12-08 16:19:25 +0300 |
commit | aab8ff7237c117e9ed63a8b7d595aca7f5665ff9 (patch) | |
tree | 7ab493ddfb798979edd8817f7084fc8460e1bf87 /m4 | |
parent | c15a810b7a47f2e07200f83aa534163ca06e2b16 (diff) |
configure: separate common DPDK check to odp_dpdk.m4
Separate DPDK macros to top-level file so that they can be reused by
other implementations (like ODP-DPDK).
Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>
Reviewed-and-tested-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'm4')
-rw-r--r-- | m4/odp_dpdk.m4 | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/m4/odp_dpdk.m4 b/m4/odp_dpdk.m4 new file mode 100644 index 000000000..636170a7f --- /dev/null +++ b/m4/odp_dpdk.m4 @@ -0,0 +1,49 @@ +# ODP_DPDK_PMDS(DPDK_DRIVER_PATH) +# ------------------------------- +# Build a list of DPDK PMD drivers in DPDK_PMDS variable +AC_DEFUN([ODP_DPDK_PMDS], [dnl +AS_VAR_SET([DPDK_PMDS], [-Wl,--whole-archive,]) +for filename in "$1"/librte_pmd_*.a; do +cur_driver=`basename "$filename" .a | sed -e 's/^lib//'` +# rte_pmd_nfp has external dependencies which break linking +if test "$cur_driver" = "rte_pmd_nfp"; then + echo "skip linking rte_pmd_nfp" +else + AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,]) +fi +done +AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive]) +AC_SUBST([DPDK_PMDS]) +]) + +# ODP_DPDK_CHECK(CPPFLAGS, LDFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# ----------------------------------------------------------------------- +# Check for DPDK availability +AC_DEFUN([ODP_DPDK_CHECK], [dnl +########################################################################## +# Save and set temporary compilation flags +########################################################################## +OLD_LDFLAGS=$LDFLAGS +OLD_LIBS=$LIBS +OLD_CPPFLAGS=$CPPFLAGS +LDFLAGS="$2 $LDFLAGS" +CPPFLAGS="$1 $CPPFLAGS" + +dpdk_check_ok=yes + +AC_CHECK_HEADERS([rte_config.h], [], + [dpdk_check_ok=no]) + +AC_CHECK_LIB([dpdk], [rte_eal_init], [], + [dpdk_check_ok=no], [-ldl -lpthread -lnuma]) +AS_IF([test "x$dpdk_check_ok" != "xno"], + [m4_default([$3], [:])], + [m4_default([$4], [:])]) + +########################################################################## +# Restore old saved variables +########################################################################## +LDFLAGS=$OLD_LDFLAGS +LIBS=$OLD_LIBS +CPPFLAGS=$OLD_CPPFLAGS +]) |