]> git.ozlabs.org Git - ccan/commitdiff
tools: add HAVE_UNALIGNED_ACCESS test.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 24 May 2015 10:03:05 +0000 (19:33 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Sun, 24 May 2015 10:03:32 +0000 (19:33 +0930)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/configurator/configurator.c

index dd5587c3b556c31eaa6b2a5887e684d375530e0f..f4edb8ee1b214dbf97106bffe91335b12d5737ac 100644 (file)
@@ -277,6 +277,13 @@ static struct test tests[] = {
          "#include <sys/termios.h>\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 <string.h>\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 <sys/types.h>\n"
          "#include <utime.h>\n"