On 02/10/20 14:35, Peter Maydell wrote: > > It would be better to do the "see if a static library is present" > test. This isn't too hard to do in configure (compare that > six line fix to the detection of libgio). Hopefully it is > not too hard to do in meson ?
Yes, something like: if enable_static skeleton = 'int main(void) { return 0; }' if not cc.links(skeleton, dependencies: libudev) if get_option('mpath').enabled() error('Cannot link with libudev') else warning('Cannot link with libudev, disabling') libudev = not_found endif endif endif endif It can be done in meson.build also for dependencies that are still detected in configure, and we can place it in a loop if we want to do many tests like these: if enable_static dependencies = {'libudev': 'mpath', ...} skeleton = 'int main(void) { return 0; }' foreach var, option: dependencies if 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 endif This way we don't have 500 lines of this kind of test. Paolo