This is what Autoconf already does for us, so just do this. Avoids
people making typos while adding header or function checks. Because we
use a config.h.meson, such typos won't even be noticed.
Also, starting from Meson 0.36.0, the XCode 8 workaround that we use for
clock_gettime is no longer needed.
This brings us up-to-speed with the latest compatibility code from upstream
check git. For completeness, we do all the checks that upstream check does, but
we skip the snprintf/vsnprintf code because it's not straightforward (involves
running code and that is bad for cross-compilation) and not necessary for the
platforms we support anyway.
If someone really wants this, they can uncomment this and copy the relevant
checks from the check git repository.
https://bugzilla.gnome.org/show_bug.cgi?id=775870
clock_gettime was also added for iOS 10.0, so don't use it if we're
targetting an older version. That would've caused the symbol to not be
found at runtime on older devices.
Just use the default c_std used by the compiler. With GCC on Linux this
is gnu89.
Tons of errors related to time.h, signal.h, etc when using c99:
FAILED: libs/gst/check/libcheck/check@sta/check_run.c.o
cc '-Ilibs/gst/check/libcheck/check@sta' '-fdiagnostics-color=always' '-I../libs/gst/check/libcheck' '-Ilibs/gst/check/libcheck' '-I.' '-I../.' '-Ilibs/gst/check/libcheck/..' '-I../libs/gst/check/libcheck/..' '-pipe' '-Wall' '-Winvalid-pch' '-std=c99' '-DHAVE_CONFIG_H' '-fPIC' '-O2' '-g' '-fPIC' '-MMD' '-MQ' 'libs/gst/check/libcheck/check@sta/check_run.c.o' '-MF' 'libs/gst/check/libcheck/check@sta/check_run.c.o.d' -o 'libs/gst/check/libcheck/check@sta/check_run.c.o' -c ../libs/gst/check/libcheck/check_run.c
In file included from ../libs/gst/check/libcheck/check_run.c:21:0:
../libs/gst/check/libcheck/libcompat.h:167:18: warning: ‘struct itimerspec’ declared inside parameter list will not be visible outside of this definition or declaration
const struct itimerspec *new_value, struct itimerspec *old_value);
^~~~~~~~~~
../libs/gst/check/libcheck/check_run.c:98:25: error: array type has incomplete element type ‘struct sigaction’
static struct sigaction old_action[3];
^~~~~~~~~~
../libs/gst/check/libcheck/check_run.c:99:25: error: array type has incomplete element type ‘struct sigaction’
static struct sigaction new_action[3];
^~~~~~~~~~
[...]
ninja: build stopped: subcommand failed.
The change was originally made because gnu99 was causing issues on OS X.
With XCode 8, clock_gettime will be incorrectly detected as being
available regardless of what OS X version we're targetting because the
symbol is available in the .tbd library as a weak symbol.
See: https://github.com/Homebrew/homebrew-core/issues/3727#issue-170086273
It's only starting from macOS 10.12 that clock_gettime is actually
available, so we can unconditionally disable it when targetting older
versions. We cannot simply do AC_CHECK_FUNCS with -Wl,-no_weak_imports
because the autoconf check does its own prototype declaration that
doesn't trigger that compiler flag.
https://bugzilla.gnome.org/show_bug.cgi?id=772451