]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dpdk: edit configure.ac to include DPDK compilation option
authorLukas Sismis <lukas.sismis@gmail.com>
Sun, 29 Aug 2021 21:43:14 +0000 (23:43 +0200)
committerVictor Julien <vjulien@oisf.net>
Tue, 14 Dec 2021 11:37:20 +0000 (12:37 +0100)
Add a build flag --enable-dpdk to support DPDK parts in the source code.

configure.ac

index e6e036d8b783c18ac7514febbec78e9a9687a10f..037adda17007f34d6baf940c215c8441eff45564 100644 (file)
             [[#include <linux/net_tstamp.h>]])
     ])
 
+  # DPDK support
+    AC_ARG_ENABLE(dpdk,
+            AS_HELP_STRING([--enable-dpdk], [Enable DPDK support [default=no]]),
+                        [enable_dpdk=$enableval],[enable_dpdk=no])
+    AS_IF([test "x$enable_dpdk" = "xyes"], [
+        AC_CHECK_LIB(numa, numa_available,, [numa_found="no"])
+        if test "$numa_found" = "no"; then
+            echo
+            echo "  ERROR! libnuma not found by pkg-config, go get it"
+            echo "      from http://github.com/numactl/numactl or your distribution:"
+            echo "          Ubuntu: apt-get install libnuma-dev"
+            echo "          Fedora: dnf install numactl-devel"
+            echo "          CentOS/RHEL: yum install numactl-devel"
+            echo
+            exit 1
+        fi
+
+        AC_DEFINE([HAVE_DPDK],[1],(DPDK support enabled))
+        PKG_CHECK_EXISTS(libdpdk >= 20.11, [pkgconfig_libdpdk_above20=yes], )
+        if test "$pkgconfig_libdpdk_above20" = "yes"; then
+            AC_DEFINE([HAVE_STRLCAT],[1],[STRLCAT is predefined by DPDK 20.11+])
+            AC_DEFINE([HAVE_STRLCPY],[1],[STRLCPY is predefined by DPDK 20.11+])
+        fi
+
+        PKG_CHECK_EXISTS(libdpdk >= 19.11, , [with_pkgconfig_libdpdk=no])
+        if test "$with_pkgconfig_libdpdk" = "no"; then
+            echo
+            echo "   ERROR! libdpdk >= 19.11 not found by pkg-config, go get it"
+            echo "   from https://www.dpdk.org/ or your distribution:"
+            echo
+            echo "   Ubuntu: apt-get install dpdk-dev"
+            echo "   Fedora: dnf install dpdk-devel"
+            echo "   CentOS/RHEL: yum install dpdk-devel"
+            echo
+            exit 1
+        fi
+        CFLAGS="${CFLAGS} `pkg-config --cflags libdpdk`"
+        LIBS="${LIBS} -Wl,-R,`pkg-config --libs-only-L libdpdk | cut -c 3-` -lnuma `pkg-config --libs libdpdk`"
+    ])
+
   # Netmap support
     AC_ARG_ENABLE(netmap,
             AS_HELP_STRING([--enable-netmap], [Enable Netmap support]),[enable_netmap=$enableval],[enable_netmap=no])
@@ -2518,6 +2558,7 @@ AC_OUTPUT
 
 SURICATA_BUILD_CONF="Suricata Configuration:
   AF_PACKET support:                       ${enable_af_packet}
+  DPDK support:                            ${enable_dpdk}
   eBPF support:                            ${enable_ebpf}
   XDP support:                             ${have_xdp}
   PF_RING support:                         ${enable_pfring}