On 23/01/21 14:45, Peter Maydell wrote:
On Sat, 23 Jan 2021 at 03:18, Joelle van Dyne <j...@getutm.app> wrote:
On Fri, Jan 22, 2021 at 3:17 PM Peter Maydell <peter.mayd...@linaro.org> wrote:
Can we do the "does system() exist?" check in meson.build ?
config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system'))
Unfortunately, this doesn't work for iOS, which defines system() but
throws a compile time error if you try to call it.
That's odd -- as far as I can tell the meson implementation
of has_function() does what I expected it to do, ie
"try to compile and link a little program that uses the
function, and see if it successfully links":
https://github.com/mesonbuild/meson/blob/39ede12aa5b27376341df85bc9ec254913f044bd/mesonbuild/compilers/mixins/clike.py#L791
There's some initial cleverness there too, so I guess some
part of that must be what's tripping us up.
In any case, I think we should be doing new checks in
meson.build, not configure. Paolo, what's the right
way to do a meson "really compile this program and
check it built" test?
One possibility is that you have to specify the #include in the "prefix"
argument of cc.has_function for the test to behave as the QEMU code?
If cc.has_function doesn't work, there's cc.compiles() and cc.links().
Paolo