aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/m4
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linux-generic/m4')
-rw-r--r--platform/linux-generic/m4/configure.m446
-rw-r--r--platform/linux-generic/m4/odp_dpdk.m433
-rw-r--r--platform/linux-generic/m4/odp_ipc.m49
3 files changed, 65 insertions, 23 deletions
diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4
index d3e5528c1..e1197f606 100644
--- a/platform/linux-generic/m4/configure.m4
+++ b/platform/linux-generic/m4/configure.m4
@@ -28,12 +28,56 @@ AC_LINK_IFELSE(
echo "Use newer version. For gcc > 4.7.0"
exit -1)
+dnl Check whether -latomic is needed
+use_libatomic=no
+
+AC_MSG_CHECKING(whether -latomic is needed for 64-bit atomic built-ins)
+AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([[
+ static int loc;
+ int main(void)
+ {
+ int prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
+ return 0;
+ }
+ ]])],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_RESULT(yes)
+ AC_CHECK_LIB(
+ [atomic], [__atomic_exchange_8],
+ [use_libatomic=yes],
+ [AC_MSG_FAILURE([__atomic_exchange_8 is not available])])
+ ])
+
+AC_MSG_CHECKING(whether -latomic is needed for 128-bit atomic built-ins)
+AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([[
+ static __int128 loc;
+ int main(void)
+ {
+ __int128 prev;
+ prev = __atomic_exchange_n(&loc, 7, __ATOMIC_RELAXED);
+ return 0;
+ }
+ ]])],
+ [AC_MSG_RESULT(no)],
+ [AC_MSG_RESULT(yes)
+ AC_CHECK_LIB(
+ [atomic], [__atomic_exchange_16],
+ [use_libatomic=yes],
+ [AC_MSG_CHECKING([cannot detect support for 128-bit atomics])])
+ ])
+
+if test "x$use_libatomic" = "xyes"; then
+ ATOMIC_LIBS="-latomic"
+fi
+AC_SUBST([ATOMIC_LIBS])
+
m4_include([platform/linux-generic/m4/odp_pthread.m4])
m4_include([platform/linux-generic/m4/odp_openssl.m4])
m4_include([platform/linux-generic/m4/odp_pcap.m4])
m4_include([platform/linux-generic/m4/odp_netmap.m4])
m4_include([platform/linux-generic/m4/odp_dpdk.m4])
-m4_include([platform/linux-generic/m4/odp_ipc.m4])
m4_include([platform/linux-generic/m4/odp_schedule.m4])
AC_CONFIG_FILES([platform/linux-generic/Makefile
diff --git a/platform/linux-generic/m4/odp_dpdk.m4 b/platform/linux-generic/m4/odp_dpdk.m4
index 30347dce8..58d14727b 100644
--- a/platform/linux-generic/m4/odp_dpdk.m4
+++ b/platform/linux-generic/m4/odp_dpdk.m4
@@ -2,22 +2,10 @@
# Enable DPDK support
##########################################################################
pktio_dpdk_support=no
-AC_ARG_ENABLE([dpdk_support],
- [ --enable-dpdk-support include dpdk IO support],
- [if test x$enableval = xyes; then
- pktio_dpdk_support=yes
- fi])
-
-##########################################################################
-# Set optional DPDK path
-##########################################################################
AC_ARG_WITH([dpdk-path],
-AC_HELP_STRING([--with-dpdk-path=DIR path to dpdk build directory],
- [(or in the default path if not specified).]),
+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"
- AM_LDFLAGS="$AM_LDFLAGS -L$DPDK_PATH/lib"
- LIBS="$LIBS -ldpdk -ldl -lpcap"
pktio_dpdk_support=yes],[])
##########################################################################
@@ -28,12 +16,31 @@ 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
diff --git a/platform/linux-generic/m4/odp_ipc.m4 b/platform/linux-generic/m4/odp_ipc.m4
deleted file mode 100644
index 78217e221..000000000
--- a/platform/linux-generic/m4/odp_ipc.m4
+++ /dev/null
@@ -1,9 +0,0 @@
-##########################################################################
-# Enable IPC pktio support
-##########################################################################
-AC_ARG_ENABLE([pktio_ipc_support],
- [ --enable-pktio_ipc-support include ipc IO support],
- [if test x$enableval = xyes; then
- pktio_ipc_support=yes
- ODP_CFLAGS="$ODP_CFLAGS -D_ODP_PKTIO_IPC"
- fi])