cmake HAVE_UNALIGNED_ACCESS examples

ceph/ceph cmake/modules/CephChecks.cmake :111

check_cxx_source_runs("
#include <cstdint>
#include <iterator>

#ifdef _WIN32
#include <winsock2.h>
#else
#include <arpa/inet.h>
#endif

uint32_t load(char* p, size_t offset)
{
  return *reinterpret_cast<uint32_t*>(p + offset);
}

bool good(uint32_t lhs, uint32_t big_endian)
{
  return lhs == ntohl(big_endian);
}

int main(int argc, char **argv)
{
  char a1[] = \"ABCDEFG\";
  uint32_t a2[] = {0x41424344,
                   0x42434445,
                   0x43444546,
                   0x44454647};
  for (size_t i = 0; i < std::size(a2); i++) {
    if (!good(load(a1, i), a2[i])) {
      return 1;
    }
  }
}"
    HAVE_UNALIGNED_ACCESS)