qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] meson.build: Don't look for libudev for static builds


From: Peter Maydell
Subject: Re: [PATCH] meson.build: Don't look for libudev for static builds
Date: Fri, 2 Oct 2020 15:18:04 +0100

On Fri, 2 Oct 2020 at 15:08, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 02/10/20 15:09, Peter Maydell wrote:
> > This duplicates the information that the thing that depends
> > on libudev is mpath. Can we put this in a wrapper around
> > dependency() so that we could just say something like
> >   libudev = compile_checked_dependency('libudev',
> >                        required: get_option('mpath').enabled(),
> >                        static: enable_static)
> >
> > for those dependencies that want to do the "does this compile"
> > check ?
>
> No, there's no functions at all.  You can of course put the detection and
> test in a single loop:
>
>   dependencies = {}
>   ...
>   if targetos == 'linux' and (have_system or have_tools)
>     dependencies += {'libudev': 'mpath'}
>   endif
>   ...
>   skeleton = 'int main(void) { return 0; }'
>   foreach var, option: dependencies
>     dep = dependency(var,
>                      required: get_option(option).enabled(),
>                      static: enable_static)
>     if dep.found() and enable_static and not cc.links(skeleton, dependencies: 
> get_variable(var))
>       if get_option(option).enabled()
>           error('Cannot link with @0@'.format(var))
>         else
>           warning('Cannot link with @0@, disabling'.format(skeleton))
>           set_variable(var, not_found)
>         endif
>       endif
>     endif
>   endforeach

That is a lot uglier. I'm really getting fed up with Meson's
persistent "no, you can't do that" attitude :-(

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]