]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
configure: try to use external libbpf first if --enable-xdp=yes is set
authorDaniel Salzman <daniel.salzman@nic.cz>
Mon, 7 Jun 2021 18:05:48 +0000 (20:05 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Thu, 10 Jun 2021 06:41:25 +0000 (08:41 +0200)
configure.ac

index 13e5d1d3149aa47fead824e8c6c4414d50224266..e873df08ef9656f02115ac6e25753eea65451605 100644 (file)
@@ -199,21 +199,20 @@ AC_ARG_ENABLE([xdp],
    [], [enable_xdp=auto])
 
 AS_CASE([$enable_xdp],
-   [auto],[PKG_CHECK_MODULES([libbpf],[libbpf >= 0.0.6],[enable_xdp=yes],[enable_xdp=no])],
-   [yes],[PKG_CHECK_MODULES([libelf],[libelf],[
-     AC_CHECK_FUNC([reallocarray],[
-       enable_xdp=embedded
-       embedded_libbpf_CFLAGS="-I\$(top_srcdir)/src/contrib/libbpf/include -I\$(top_srcdir)/src/contrib/libbpf/include/uapi"
-       embedded_libbpf_LIBS=$libelf_LIBS
-       libbpf_CFLAGS="-I\$(top_srcdir)/src/contrib/libbpf -I\$(top_srcdir)/src/contrib/libbpf/include/uapi"
-     ],[
-       enable_xdp=no
-       AC_MSG_WARN([reallocarray not available])
-     ])
-   ],[AC_MSG_ERROR([libelf is required])])],
-   [no],[],
-   [*],[AC_MSG_ERROR([Invalid value of --enable-xdp.]
- )])
+   [auto], [PKG_CHECK_MODULES([libbpf], [libbpf >= 0.0.6], [enable_xdp=yes], [enable_xdp=no])],
+   [yes], [PKG_CHECK_MODULES([libbpf], [libbpf >= 0.0.6], [enable_xdp=yes],
+             [PKG_CHECK_MODULES([libelf], [libelf],
+                [AC_CHECK_FUNC([reallocarray],
+                   [enable_xdp=embedded
+                    embedded_libbpf_CFLAGS="-I\$(top_srcdir)/src/contrib/libbpf/include -I\$(top_srcdir)/src/contrib/libbpf/include/uapi"
+                    embedded_libbpf_LIBS=$libelf_LIBS
+                    libbpf_CFLAGS="-I\$(top_srcdir)/src/contrib/libbpf -I\$(top_srcdir)/src/contrib/libbpf/include/uapi"],
+                   [enable_xdp=no
+                    AC_MSG_WARN([reallocarray not available])])],
+                [AC_MSG_ERROR([libelf is required])])])],
+   [no], [],
+   [*], [AC_MSG_ERROR([Invalid value of --enable-xdp.])]
+)
 AM_CONDITIONAL([EMBEDDED_LIBBPF], [test "$enable_xdp" = "embedded"])
 AM_CONDITIONAL([ENABLE_XDP], [test "$enable_xdp" != "no"])
 AC_SUBST([embedded_libbpf_CFLAGS])