Originally from #ghc on freenode, 2018-12-16:
Most of the checks seem to actually be no-ops for cross-compilation.
checking for working strnlen is just hardcoded to "yes" on all targets but AIX (in similar other cases, it just prints "guessing yes").
checking size of int *, it does a binary search as you say, and NOT invoke the compiled programs.
It does it by generating a static array with known size, like arr[1 - 2 * (sizeof(int*) <= BINARY_SEARCH_VAR)], so that the static size is either  or [-1]. C compilers happen to complain about arrays of negative static size, so that's how it figures that out.
To see this, I use for compilation of GNU hello, the following added to