X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=tools%2Fconfigurator%2Fconfigurator.c;h=7b3403a9d96d50ca43b25abcc0143808f95e1cab;hb=e37b906781eeddb89d2ba6c5c39e9d20e4111c18;hp=3d2b16f5938eb6dca042778439b8c94ef77d6f4d;hpb=7d21fec7d95839ea07c4389232b1f2e4c5fc8251;p=ccan diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 3d2b16f5..7b3403a9 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -38,6 +38,11 @@ struct test { }; static struct test tests[] = { + { "HAVE_32BIT_OFF_T", DEFINES_EVERYTHING|EXECUTE, NULL, + "#include \n" + "int main(int argc, char *argv[]) {\n" + " return sizeof(off_t) == 4 ? 0 : 1;\n" + "}\n" }, { "HAVE_ALIGNOF", INSIDE_MAIN, NULL, "return __alignof__(double) > 0 ? 0 : 1;" }, { "HAVE_ASPRINTF", DEFINES_FUNC, NULL, @@ -95,6 +100,13 @@ static struct test tests[] = { { "HAVE_COMPOUND_LITERALS", INSIDE_MAIN, NULL, "int *foo = (int[]) { 1, 2, 3, 4 };\n" "return foo[0] ? 0 : 1;" }, + { "HAVE_FILE_OFFSET_BITS", DEFINES_EVERYTHING|EXECUTE, + "HAVE_32BIT_OFF_T", + "#define _FILE_OFFSET_BITS 64\n" + "#include \n" + "int main(int argc, char *argv[]) {\n" + " return sizeof(off_t) == 8 ? 0 : 1;\n" + "}\n" }, { "HAVE_FOR_LOOP_DECLARATION", INSIDE_MAIN, NULL, "for (int i = 0; i < argc; i++) { return 0; };\n" "return 1;" }, @@ -104,6 +116,7 @@ static struct test tests[] = { "#include \n" "static int func(void) { return getpagesize(); }" }, { "HAVE_ISBLANK", DEFINES_FUNC, NULL, + "#define _GNU_SOURCE\n" "#include \n" "static int func(void) { return isblank(' '); }" }, { "HAVE_LITTLE_ENDIAN", INSIDE_MAIN|EXECUTE, NULL, @@ -381,7 +394,9 @@ int main(int argc, const char *argv[]) printf("/* Generated by CCAN configurator */\n" "#ifndef CCAN_CONFIG_H\n" "#define CCAN_CONFIG_H\n"); + printf("#ifndef _GNU_SOURCE\n"); printf("#define _GNU_SOURCE /* Always use GNU extensions. */\n"); + printf("#endif\n"); printf("#define CCAN_COMPILER \"%s\"\n", argv[1]); printf("#define CCAN_CFLAGS \"%s\"\n\n", cmd + strlen(argv[1]) + 1); for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)