GSoC: Adding liburing dependency to libnbd
I think I can reuse the code below (libev part in configure.ac) and modify it for liburing, there is the libxml2 part that provides an option to disable libxml2 parts which I can reuse to provide similar behavior which is simpler the without headers and lib checks, I feel libev metho PKG_CHECK_MODULES([LIBEV], [libev], [ AC_SUBST([LIBEV_CFLAGS]) AC_SUBST([LIBEV_LIBS]) ],[ dnl no pkg-config for libev, searching manually: AC_CHECK_HEADERS([ev.h], [ AC_CHECK_LIB([ev], [ev_time], [ AC_SUBST([LIBEV_LIBS], ["-lev"]) ], [ AC_MSG_WARN([libev not found, some examples will not be compiled]) ]) ],[ AC_MSG_WARN([ev.h not found, some examples will not be compiled]) ]) ]) AS_IF([test "x$LIBEV_LIBS" != "x"], [ old_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS $LIBEV_CFLAGS -Werror=strict-aliasing -O2" AC_MSG_CHECKING([if the compiler is new enough for good aliasing rules]) AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ #include <ev.h> static void cb (struct ev_loop *l, ev_timer *t, int e) { } static ev_timer timer; ], [ ev_timer_init (&timer, cb, 0, .1); ]) ], [ AC_MSG_RESULT([yes]) ], [ AC_MSG_RESULT([no]) LIBEV_CFLAGS="$LIBEV_CFLAGS -Wno-strict-aliasing" ]) CFLAGS="$old_CFLAGS" ]) AM_CONDITIONAL([HAVE_LIBEV], [test "x$LIBEV_LIBS" != "x"])
I went with libxml2 like for now GitLab commit: https://gitlab.com/rathod-sahaab/libnbd/-/commit/e9b90859c0a286d7023efd40080... AC_ARG_WITH([liburing], [AS_HELP_STRING([--without-liburing], [disable use of liburing i.e. io_uring for asynchronus io @<:@default=check@:>@])], [], [with_liburing=check]) AS_IF([test "$with_liburing" != "no"],[ PKG_CHECK_MODULES([LIBURING], [liburing], [ AC_SUBST([LIBURING_CFLAGS]) AC_SUBST([LIBURING_LIBS]) AC_DEFINE([HAVE_LIBURING],[1],[liburing found at compile time.]) ], [ AC_MSG_WARN([liburing not found, io_uring support disabled.]) ]) ]) AM_CONDITIONAL([HAVE_LIBURING], [test "x$LIBURING_LIBS" != "x"])
On Sun, Jun 06, 2021 at 08:26:08PM +0530, Abhay Raj Singh wrote:
I went with libxml2 like for now GitLab commit: https://gitlab.com/rathod-sahaab/libnbd/-/commit/e9b90859c0a286d7023efd40080...
Yes you'll need to detect liburing using a configure test like this.
AC_ARG_WITH([liburing], [AS_HELP_STRING([--without-liburing], [disable use of liburing i.e. io_uring for asynchronus io @<:@default=check@:>@])], [], [with_liburing=check]) AS_IF([test "$with_liburing" != "no"],[ PKG_CHECK_MODULES([LIBURING], [liburing], [ AC_SUBST([LIBURING_CFLAGS]) AC_SUBST([LIBURING_LIBS]) AC_DEFINE([HAVE_LIBURING],[1],[liburing found at compile time.]) ], [ AC_MSG_WARN([liburing not found, io_uring support disabled.]) ]) ]) AM_CONDITIONAL([HAVE_LIBURING], [test "x$LIBURING_LIBS" != "x"])
Looks reasonable to me. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
participants (2)
-
Abhay Raj Singh -
Richard W.M. Jones