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: Paolo Bonzini
Subject: Re: [PATCH] meson.build: Don't look for libudev for static builds
Date: Fri, 2 Oct 2020 16:08:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0

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

Doing this check for all libraries is certainly a good idea.

Paolo




reply via email to

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