From: Rusty Russell Date: Sun, 24 May 2015 10:03:05 +0000 (+0930) Subject: tools: add HAVE_UNALIGNED_ACCESS test. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=7011546929cfc537028eb4fd091104b383b5c86f;hp=c951c9d9d730ee021eb76e7d87301b0634e0147d tools: add HAVE_UNALIGNED_ACCESS test. Signed-off-by: Rusty Russell --- diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index dd5587c3..f4edb8ee 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -277,6 +277,13 @@ static struct test tests[] = { "#include \n" }, { "HAVE_TYPEOF", INSIDE_MAIN, NULL, NULL, "__typeof__(argc) i; i = argc; return i == argc ? 0 : 1;" }, + { "HAVE_UNALIGNED_ACCESS", DEFINES_EVERYTHING|EXECUTE, NULL, NULL, + "#include \n" + "int main(int argc, char *argv[]) {\n" + " char pad[sizeof(int *) * 1];\n" + " strncpy(pad, argv[0], sizeof(pad));\n" + " return *(int *)(pad) == *(int *)(pad + 1);\n" + "}\n" }, { "HAVE_UTIME", DEFINES_FUNC, NULL, NULL, "#include \n" "#include \n"