has_function: Only ignore prototype when no includes are specified
has_function: Only ignore prototype when no includes are specified

The Autoconf-style check we were doing gives false positives when the
linker uses the prototype defined in the SDK header to decide whether
a function is available or not.

For example, with macOS 10.12, clock_gettime is now implemented
(alongwith other functions). These functions are always defined in the
XCode 8 SDK as weak imports and you're supposed to do a runtime check to
see if the symbols are available and use fallback code if they aren't.

The linker will always successfully link if you use one of those symbols
(without a runtime fallback) even if you target an older OS X version
with -mmacosx-version-min. This is the intended behaviour by Apple.

But this makes has_function useless because to test if the symbol is
available, we must know at link-time whether it is available.

To force the linker to do the check at link-time you must use
'-Wl,-no_weak_imports` *and* use the prototype in time.h which has an
availability macro which tells the linker whether the symbol is
available or not based on the -mmacosx-version-min flag.

An autoconf-style check would override this prototype and use its own
which would result in the linker thinking that the function is always
available (a false positive). Worse, this would manifest at runtime and
might not be picked up immediately.

We now use the function prototype in the user-provided includes if the
'prefix' kwarg contains a `#include` and use the old Autoconf-style
check if not. I've tested that the configure checks done by GStreamer
and GLib are completely unaffected by this; at least on Linux.

The next commit will also add `-Wl,-no_weak_imports` to extra_args by
default so that Meson avoids this mess completely. We always want this
because the user would not do a has_function check if they have
a runtime fallback for the function in their code.

fmuellner/meson,ernestask/meson,becm/meson,pexip/meson,jeandet/meson,aaronp24/meson,pexip/meson,becm/meson,aaronp24/meson,wberrier/meson,thiblahute/meson,centricular/meson,QuLogic/meson,mesonbuild/meson,thiblahute/meson,MathieuDuponchelle/meson,becm/meson,mesonbuild/meson,MathieuDuponchelle/meson,becm/meson,rhd/meson,wberrier/meson,rhd/meson,trhd/meson,trhd/meson,mesonbuild/meson,trhd/meson,jpakkane/meson,mesonbuild/meson,jpakkane/meson,jpakkane/meson,ernestask/meson,becm/meson,pexip/meson,QuLogic/meson,jpakkane/meson,fmuellner/meson,jeandet/meson,rhd/meson,fmuellner/meson,trhd/meson,rhd/meson,thiblahute/meson,trhd/meson,thiblahute/meson,jeandet/meson,fmuellner/meson,aaronp24/meson,becm/meson,ernestask/meson,aaronp24/meson,aaronp24/meson,aaronp24/meson,mesonbuild/meson,fmuellner/meson,pexip/meson,centricular/meson,MathieuDuponchelle/meson,becm/meson,rhd/meson,ernestask/meson,jeandet/meson,centricular/meson,trhd/meson,thiblahute/meson,trhd/meson,trhd/meson,mesonbuild/meson,pexip/meson,jeandet/meson,mesonbuild/meson,pexip/meson,wberrier/meson,jeandet/meson,aaronp24/meson,QuLogic/meson,becm/meson,ernestask/meson,mesonbuild/meson,fmuellner/meson,wberrier/meson,MathieuDuponchelle/meson,pexip/meson,centricular/meson,pexip/meson,QuLogic/meson,jpakkane/meson,jeandet/meson,MathieuDuponchelle/meson,jeandet/meson,becm/meson,MathieuDuponchelle/meson,pexip/meson,trhd/meson,wberrier/meson,thiblahute/meson,wberrier/meson,jpakkane/meson,centricular/meson,centricular/meson,rhd/meson,ernestask/meson,pexip/meson,becm/meson,QuLogic/meson,wberrier/meson,MathieuDuponchelle/meson,MathieuDuponchelle/meson,ernestask/meson,QuLogic/meson,QuLogic/meson,mesonbuild/meson,jpakkane/meson,wberrier/meson,thiblahute/meson,ernestask/meson,QuLogic/meson,ernestask/meson,jpakkane/meson,thiblahute/meson,jeandet/meson,aaronp24/meson,centricular/meson,rhd/meson,rhd/meson,fmuellner/meson,fmuellner/meson,jpakkane/meson,aaronp24/meson,fmuellner/meson,MathieuDuponchelle/meson,QuLogic/meson,thiblahute/meson,centricular/meson,mesonbuild/meson