[PATCH 07/18] libnfs: convert to meson

Paolo Bonzini posted 22 patches 5 years, 1 month ago
Only 18 patches received!
[PATCH 07/18] libnfs: convert to meson
Posted by Paolo Bonzini 5 years, 1 month ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 27 ++++-----------------------
 meson.build       |  9 ++++++---
 meson_options.txt |  2 ++
 3 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/configure b/configure
index e22c56e8f6..c404252b17 100755
--- a/configure
+++ b/configure
@@ -407,7 +407,7 @@ vss_win32_sdk="$default_feature"
 win_sdk="no"
 want_tools="$default_feature"
 libiscsi="auto"
-libnfs="$default_feature"
+libnfs="auto"
 coroutine=""
 coroutine_pool="$default_feature"
 debug_stack_usage="no"
@@ -1143,9 +1143,9 @@ for opt do
   ;;
   --enable-libiscsi) libiscsi="enabled"
   ;;
-  --disable-libnfs) libnfs="no"
+  --disable-libnfs) libnfs="disabled"
   ;;
-  --enable-libnfs) libnfs="yes"
+  --enable-libnfs) libnfs="enabled"
   ;;
   --enable-profiler) profiler="yes"
   ;;
@@ -5561,20 +5561,6 @@ if test "$have_ubsan" = "yes"; then
   QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS"
 fi
 
-##########################################
-# Do we have libnfs
-if test "$libnfs" != "no" ; then
-  if $pkg_config --atleast-version=1.9.3 libnfs; then
-    libnfs="yes"
-    libnfs_libs=$($pkg_config --libs libnfs)
-  else
-    if test "$libnfs" = "yes" ; then
-      feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
-    fi
-    libnfs="no"
-  fi
-fi
-
 ##########################################
 
 # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
@@ -6216,11 +6202,6 @@ if test "$zstd" = "yes" ; then
   echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak
 fi
 
-if test "$libnfs" = "yes" ; then
-  echo "CONFIG_LIBNFS=y" >> $config_host_mak
-  echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
-fi
-
 if test "$seccomp" = "yes"; then
   echo "CONFIG_SECCOMP=y" >> $config_host_mak
   echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
@@ -6782,7 +6763,7 @@ NINJA=$ninja $meson setup \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
-        -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
+        -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 3f53a7f1b2..0b8c9c5917 100644
--- a/meson.build
+++ b/meson.build
@@ -319,8 +319,10 @@ if 'CONFIG_LIBXML2' in config_host
                                link_args: config_host['LIBXML2_LIBS'].split())
 endif
 libnfs = not_found
-if 'CONFIG_LIBNFS' in config_host
-  libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
+if not get_option('libnfs').auto() or have_block
+  libnfs = dependency('libnfs', version: '>=1.9.3',
+                      required: get_option('libnfs'),
+                      method: 'pkg-config', static: enable_static)
 endif
 libattr = not_found
 if 'CONFIG_ATTR' in config_host
@@ -928,6 +930,7 @@ config_host_data.set('CONFIG_GLUSTERFS_ZEROFILL', glusterfs.version().version_co
 config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat)
 config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
 config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
+config_host_data.set('CONFIG_LIBNFS', libnfs.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@@ -2286,7 +2289,7 @@ summary_info += {'usb net redir':     config_host.has_key('CONFIG_USB_REDIR')}
 summary_info += {'OpenGL support':    config_host.has_key('CONFIG_OPENGL')}
 summary_info += {'OpenGL dmabufs':    config_host.has_key('CONFIG_OPENGL_DMABUF')}
 summary_info += {'libiscsi support':  libiscsi.found()}
-summary_info += {'libnfs support':    config_host.has_key('CONFIG_LIBNFS')}
+summary_info += {'libnfs support':    libnfs.found()}
 summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
 if targetos == 'windows'
   if 'WIN_SDK' in config_host
diff --git a/meson_options.txt b/meson_options.txt
index b562d4f1a6..4535bc4dc2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -52,6 +52,8 @@ option('glusterfs', type : 'feature', value : 'auto',
        description: 'Glusterfs block device driver')
 option('libiscsi', type : 'feature', value : 'auto',
        description: 'libiscsi userspace initiator')
+option('libnfs', type : 'feature', value : 'auto',
+       description: 'libnfs block device driver')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('iconv', type : 'feature', value : 'auto',
-- 
2.29.2



Re: [PATCH 07/18] libnfs: convert to meson
Posted by Marc-André Lureau 5 years, 1 month ago
On Thu, Dec 17, 2020 at 1:40 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  configure         | 27 ++++-----------------------
>  meson.build       |  9 ++++++---
>  meson_options.txt |  2 ++
>  3 files changed, 12 insertions(+), 26 deletions(-)
>
> diff --git a/configure b/configure
> index e22c56e8f6..c404252b17 100755
> --- a/configure
> +++ b/configure
> @@ -407,7 +407,7 @@ vss_win32_sdk="$default_feature"
>  win_sdk="no"
>  want_tools="$default_feature"
>  libiscsi="auto"
> -libnfs="$default_feature"
> +libnfs="auto"
>  coroutine=""
>  coroutine_pool="$default_feature"
>  debug_stack_usage="no"
> @@ -1143,9 +1143,9 @@ for opt do
>    ;;
>    --enable-libiscsi) libiscsi="enabled"
>    ;;
> -  --disable-libnfs) libnfs="no"
> +  --disable-libnfs) libnfs="disabled"
>    ;;
> -  --enable-libnfs) libnfs="yes"
> +  --enable-libnfs) libnfs="enabled"
>    ;;
>    --enable-profiler) profiler="yes"
>    ;;
> @@ -5561,20 +5561,6 @@ if test "$have_ubsan" = "yes"; then
>    QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS"
>  fi
>
> -##########################################
> -# Do we have libnfs
> -if test "$libnfs" != "no" ; then
> -  if $pkg_config --atleast-version=1.9.3 libnfs; then
> -    libnfs="yes"
> -    libnfs_libs=$($pkg_config --libs libnfs)
> -  else
> -    if test "$libnfs" = "yes" ; then
> -      feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
> -    fi
> -    libnfs="no"
> -  fi
> -fi
> -
>  ##########################################
>
>  # Exclude --warn-common with TSan to suppress warnings from the TSan
> libraries.
> @@ -6216,11 +6202,6 @@ if test "$zstd" = "yes" ; then
>    echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak
>  fi
>
> -if test "$libnfs" = "yes" ; then
> -  echo "CONFIG_LIBNFS=y" >> $config_host_mak
> -  echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
> -fi
> -
>  if test "$seccomp" = "yes"; then
>    echo "CONFIG_SECCOMP=y" >> $config_host_mak
>    echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
> @@ -6782,7 +6763,7 @@ NINJA=$ninja $meson setup \
>          -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f
> -Dvirtiofsd=$virtiofsd \
>          -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
>          -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2
> -Dlibiscsi=$libiscsi \
> -        -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
> +        -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses
> -Dlibudev=$libudev\
>          -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
>          -Dvhost_user_blk_server=$vhost_user_blk_server \
>          -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
> diff --git a/meson.build b/meson.build
> index 3f53a7f1b2..0b8c9c5917 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -319,8 +319,10 @@ if 'CONFIG_LIBXML2' in config_host
>                                 link_args:
> config_host['LIBXML2_LIBS'].split())
>  endif
>  libnfs = not_found
> -if 'CONFIG_LIBNFS' in config_host
> -  libnfs = declare_dependency(link_args:
> config_host['LIBNFS_LIBS'].split())
> +if not get_option('libnfs').auto() or have_block
> +  libnfs = dependency('libnfs', version: '>=1.9.3',
> +                      required: get_option('libnfs'),
> +                      method: 'pkg-config', static: enable_static)
>  endif
>  libattr = not_found
>  if 'CONFIG_ATTR' in config_host
> @@ -928,6 +930,7 @@ config_host_data.set('CONFIG_GLUSTERFS_ZEROFILL',
> glusterfs.version().version_co
>  config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT',
> glusterfs_ftruncate_has_stat)
>  config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT',
> glusterfs_iocb_has_stat)
>  config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
> +config_host_data.set('CONFIG_LIBNFS', libnfs.found())
>  config_host_data.set('CONFIG_SDL', sdl.found())
>  config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
>  config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER',
> have_vhost_user_blk_server)
> @@ -2286,7 +2289,7 @@ summary_info += {'usb net redir':
>  config_host.has_key('CONFIG_USB_REDIR')}
>  summary_info += {'OpenGL support':
> config_host.has_key('CONFIG_OPENGL')}
>  summary_info += {'OpenGL dmabufs':
> config_host.has_key('CONFIG_OPENGL_DMABUF')}
>  summary_info += {'libiscsi support':  libiscsi.found()}
> -summary_info += {'libnfs support':
> config_host.has_key('CONFIG_LIBNFS')}
> +summary_info += {'libnfs support':    libnfs.found()}
>  summary_info += {'build guest agent':
> config_host.has_key('CONFIG_GUEST_AGENT')}
>  if targetos == 'windows'
>    if 'WIN_SDK' in config_host
> diff --git a/meson_options.txt b/meson_options.txt
> index b562d4f1a6..4535bc4dc2 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -52,6 +52,8 @@ option('glusterfs', type : 'feature', value : 'auto',
>         description: 'Glusterfs block device driver')
>  option('libiscsi', type : 'feature', value : 'auto',
>         description: 'libiscsi userspace initiator')
> +option('libnfs', type : 'feature', value : 'auto',
> +       description: 'libnfs block device driver')
>  option('mpath', type : 'feature', value : 'auto',
>         description: 'Multipath persistent reservation passthrough')
>  option('iconv', type : 'feature', value : 'auto',
> --
> 2.29.2
>
>
>