Since we're checking for the existence of a header, just running the
preprocessor is enough. According to my benchmarks, doing this makes the
test roughly 2x faster.
I'm sure this will be useful for other checks too in the future.
This shaves off 7% on the configure time for glib on my machine.
This also fixes the issue that we had earlier where you had to specify
any extra headers needed to resolve symbols in the header being checked
for with `prefix`.
Also add MSVC support while doing so. Doesn't test 32-bit Windows yet
because I can't figure out how to do manual setup for function calls on
Win32 which also does symbol mangling. But this is fine for now.
We were checking for builtins explicitly like this because the ordinary
checks don't work for builtins at all. We do exactly the same check as
Autoconf and it doesn't work with Autoconf either (Autoconf is broken!)
So now we check for it in two ways: if there's no #include in prefix, we
check if `__builtin_symbol` exists (has_function allows checking for
functions without providing includes). If there's a #include, we check
if `symbol` exists.
The old method was causing problems with some buggy toolchains such as
MSYS2 which define some builtins in the C library but don't expose them
via headers which meant that `__builtin_symbol` would be found even
though `symbol` is not available.
Doing this allows people to always get the correct answer as long as
they specify the includes that are required to find a function while
also not forcing people to always specify includes to find a function
which is cumbersome.
Closes#1083
Unlike Linux and OS X, when a library is loaded, all the symbols aren't
loaded into a single namespace. You must fetch the symbol by iterating over
all loaded modules.
So, we shouldn't use /FORCE:UNRESOLVED since that is not what modules do
on Windows. Instead, we now do exactly what GModule does on Windows.
Also use `void` for functions that take no arguments.
We originally skipped on Windows for the same reason, and now we need to
do that for EPEL 7 and F23 which ship pkg-config 0.28 which doesn't have
--validate.
Closes#1129
We want compiler check arguments (-O0, -fpermissive, etc) to override
all other arguments, and we want extra_args passed in by the build file
to always override everything.
To do this properly, we must split include arguments out, append them
first, append all other arguments as usual, and then append the rest.
As part of this, we also add the compiler check flags to the
cc.compiles() and cc.links() helper functions since they also most
likely need them.
Also includes a unit test for all this.
Knowing whether a test failed to run as its prerequisites were not
available, or whether those prerequisites were available and produced
unexpected/incorrect results, is a useful differentiation.
Add support for skipped tests by testing for exit code 77, used through
autotools/piglit/etc to denote a test which detected this and decided to
skip.
The library from which we extract should have multiple sources
from which we choose a strict subset otherwise we're testing almost the
same case extracting all the objects.
This exposes a bug in how we were doing extract checking for unity
builds.
Can only test this by checking the compiler id, but that's good enough.
Disabling so we can get #995 in which will help keep the VS backend in
a better state w.r.t. other PRs.
I've opened #1004 to track this in the meantime.
The code generated manually with manygen.py must use the same CRT
compiler arguments as the final executable itself or we get an error
during linking:
MSVCRTD.lib(_chandler4gs_.obj) : error LNK2019: unresolved external symbol __except_handler4_common referenced in function __except_handler4
depuser.exe : fatal error LNK1120: 1 unresolved externals
The pkg-config version shipped with MinGW is too old, and the test is
sufficiently covered on Linux, so just skip it on Windows. We anyway do
not run the other pkg-config tests on Windows.
Need to pass -fpermissive to force C++ compilers to only warn about our
non-conformant code that tests for a symbol being defined.
Also do a simple #ifdef check first in has_header_symbol to allow
arbitrary macros to be detected which would not have been detected
earlier. This follows what AC_CHECK_DECL does.
Closes#958
All assignments in meson should be by value, so mutable objects
(i.e. environment() and configuration_data()) should be copied
automatically on assignment.
Fixes#831.
Not only does extract_all_objects() now work properly again,
extract_objects() also works if you specify a subset of sources all of
which have been compiled into a single unified object.
So, for instance, this allows you to extract all the objects
corresponding to the C sources compiled into a target consisting of
C and C++ sources.