qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] meson: move libmpathpersist test
Date: Wed, 16 Sep 2020 19:09:08 +0200	[thread overview]
Message-ID: <d9b12d18-c008-514d-b29c-23621f206788@redhat.com> (raw)
In-Reply-To: <20200916162621.100141-3-pbonzini@redhat.com>

On 16/09/2020 18.26, Paolo Bonzini wrote:
> This is the first compiler/linker test that has been moved to Meson.
> Add more section headings to keep things clearer.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure         | 77 +++------------------------------------------
>  meson.build       | 80 ++++++++++++++++++++++++++++++++++++++++++-----
>  meson_options.txt |  2 ++
>  3 files changed, 78 insertions(+), 81 deletions(-)
[...]
> diff --git a/meson.build b/meson.build
> index 5092aec439..60ef988d9d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -86,6 +86,14 @@ if 'SPARSE_CFLAGS' in config_host
>                         'compile_commands.json'])
>  endif
>  
> +###########################################
> +# Target-specific checks and dependencies #
> +###########################################
> +
> +if targetos != 'linux' and get_option('mpath').enabled()
> +  error('Multipath is supported only on Linux')
> +endif
> +
>  m = cc.find_library('m', required: false)
>  util = cc.find_library('util', required: false)
>  winmm = []
> @@ -117,6 +125,11 @@ elif targetos == 'haiku'
>              cc.find_library('network'),
>              cc.find_library('bsd')]
>  endif
> +
> +################
> +# Dependencies #
> +################
> +
>  # The path to glib.h is added to all compilation commands.  This was
>  # grandfathered in from the QEMU Makefiles.
>  add_project_arguments(config_host['GLIB_CFLAGS'].split(),
> @@ -223,10 +236,6 @@ if 'CONFIG_SPICE' in config_host
>                               link_args: config_host['SPICE_LIBS'].split())
>  endif
>  rt = cc.find_library('rt', required: false)
> -libmpathpersist = not_found
> -if config_host.has_key('CONFIG_MPATH')
> -  libmpathpersist = cc.find_library('mpathpersist')
> -endif
>  libdl = not_found
>  if 'CONFIG_PLUGIN' in config_host
>    libdl = cc.find_library('dl', required: true)
> @@ -257,9 +266,62 @@ if 'CONFIG_CURL' in config_host
>                              link_args: config_host['CURL_LIBS'].split())
>  endif
>  libudev = not_found
> -if target_os == 'linux'
> -  libudev = dependency('libudev', static: enable_static)
> +if targetos == 'linux'
> +  libudev = dependency('libudev',
> +                       required: get_option('mpath'),
> +                       static: enable_static)
> +endif
> +
> +mpathpersist = not_found
> +if targetos == 'linux' and not get_option('mpath').disabled()
> +  libmultipath = cc.find_library('multipath',
> +                                 required: get_option('mpath'),
> +                                 static: enable_static)
> +  libmpathpersist = cc.find_library('mpathpersist',
> +                                    required: get_option('mpath'),
> +                                    static: enable_static)
> +  if libmultipath.found() and libmpathpersist.found() and libudev.found()
> +    if cc.links('''
> +      #include <libudev.h>
> +      #include <mpath_persist.h>
> +      unsigned mpath_mx_alloc_len = 1024;
> +      int logsink;
> +      static struct config *multipath_conf;
> +      extern struct udev *udev;
> +      extern struct config *get_multipath_config(void);
> +      extern void put_multipath_config(struct config *conf);
> +      struct udev *udev;
> +      struct config *get_multipath_config(void) { return multipath_conf; }
> +      void put_multipath_config(struct config *conf) { }
> +      int main(void) {
> +          udev = udev_new();
> +          multipath_conf = mpath_lib_init();
> +          return 0;
> +      }''', dependencies: [libmultipath, libmpathpersist, libudev])
> +      mpathpersist = declare_dependency(dependencies: [libmultipath, libmpathpersist, libudev])
> +      mpathpersist_new_api = true
> +    elif cc.links('''
> +      #include <libudev.h>
> +      #include <mpath_persist.h>
> +      unsigned mpath_mx_alloc_len = 1024;
> +      int logsink;
> +      int main(void) {
> +          struct udev *udev = udev_new();
> +          mpath_lib_init(udev);
> +          return 0;
> +      }''', dependencies: [libmultipath, libmpathpersist, libudev])
> +      mpathpersist = declare_dependency(dependencies: [libmultipath, libmpathpersist, libudev])
> +      mpathpersist_new_api = false
> +    else
> +      if get_option('mpath').enabled()
> +        error('Cannot detect libmpathpersist API')
> +      else
> +        warning('Cannot detect libmpathpersist API, disabling')
> +      endif
> +    endif
> +  endif
>  endif
> +

I just gave this a try on my laptop, but I'm seeing:

../../devel/qemu/meson.build:508:17: ERROR: Unknown variable
"mpathpersist_new_api".

... I guess it should only be printed if mpathpersist.found() ?

 Thomas



  reply	other threads:[~2020-09-16 17:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 16:26 [PATCH 0/2] meson: move libmpathpersist test Paolo Bonzini
2020-09-16 16:26 ` [PATCH 1/2] meson: move libudev test Paolo Bonzini
2020-09-16 16:26 ` [PATCH 2/2] meson: move libmpathpersist test Paolo Bonzini
2020-09-16 17:09   ` Thomas Huth [this message]
2020-09-16 17:17     ` Paolo Bonzini
2020-09-17  9:59 ` [PATCH 0/2] " Thomas Huth
2020-09-17 10:36   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d9b12d18-c008-514d-b29c-23621f206788@redhat.com \
    --to=thuth@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).