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
and configure with:
CC=arm-linux-gnueabihf-gcc ./configure --build i686-pc-linux-gnu --host arm-linux-gnueabihf
and then look at
checking size of int *, which shows some of the iterations of the binary search below.
Required packages for this ARM cross-compilation are on Ubuntu 16.04:
sudo apt-get install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev