[configure.ac] Fix configure checks for Mono.Native (#13395)
commitb92a1059925c5d86e8282098390e614052402d32
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 11 Mar 2019 19:36:40 +0000 (11 20:36 +0100)
committerGitHub <noreply@github.com>
Mon, 11 Mar 2019 19:36:40 +0000 (11 20:36 +0100)
tree0fdabe0696dbb2b58a411b55c09a7cd8cedd65b5
parent3537672955fb4c9750021ddf9c1f165dba4cca20
[configure.ac] Fix configure checks for Mono.Native (#13395)

When the configure checks were ported from configure.cmake in corefx
a couple of mistakes happened:

- Using AC_TRY_COMPILE instead of AC_TRY_LINK:
  CMake's check_c_source_compiles() function compiles *and* links while
  AC_TRY_COMPILE only does the former. This hides potential linking issues
  which should fail the configure check.
- Using CFLAGS="-Werror -W....":
  This works in CMake but autoconf always appends the previously defined
  CFLAGS and since we set e.g. `-Wno-undefined` some configure checks
  would fail due to an unrelated warning being treated as an error.
  We need to only promot specific warnings to errors instead.

While looking at this I also found that we were setting CFLAGS after
we already AC_SUBST() it, we need to do this very close to the end of configure.ac.
Moved some code into that last block.

Finally, Android has special cases for sendfile and arc4random_buf where
they're defined in the header but aren't actually there for certain API profiles.
For now we disable arc4random_buf on Android and add a special check for sendfile.

* Fix sendfile with 6 parameters being misdetected

We need to make sure to actually prevent the implicit prototype since
in this case sendfile with different set of parameters actually exists
so the linker wouldn't fail.

Also fixed a few other cases of wrong configure checks due to missing headers.

* Move GSS checks into the Mono.Native checks section

This allows us to have a 1:1 mapping of the checks from configure.cmake
configure.ac
external/corefx
mono/native/pal_config.h