]> git.ozlabs.org Git - ccan/blobdiff - tools/configurator/configurator.c
tools/configurator: set HAVE_CLOCK_GETTIME even if it's in -lrt.
[ccan] / tools / configurator / configurator.c
index 5ba8cb0bb0c780a54849a8137187d22b647a62da..5ccc8c914dc83a41680cc3429da414f323a49b6a 100644 (file)
@@ -55,6 +55,7 @@ struct test {
        const char *depends;
        const char *link;
        const char *fragment;
+       const char *overrides; /* On success, force this to '1' */
        bool done;
        bool answer;
 };
@@ -79,6 +80,8 @@ static struct test tests[] = {
          "static int __attribute__((cold)) func(int x) { return x; }" },
        { "HAVE_ATTRIBUTE_CONST", DEFINES_FUNC, NULL, NULL,
          "static int __attribute__((const)) func(int x) { return x; }" },
+       { "HAVE_ATTRIBUTE_PURE", DEFINES_FUNC, NULL, NULL,
+         "static int __attribute__((pure)) func(int x) { return x; }" },
        { "HAVE_ATTRIBUTE_MAY_ALIAS", OUTSIDE_MAIN, NULL, NULL,
          "typedef short __attribute__((__may_alias__)) short_a;" },
        { "HAVE_ATTRIBUTE_NORETURN", DEFINES_FUNC, NULL, NULL,
@@ -142,7 +145,9 @@ static struct test tests[] = {
          "     struct timespec ts;\n"
          "     clock_gettime(CLOCK_REALTIME, &ts);\n"
          "     return ts;\n"
-         "}\n" },
+         "}\n",
+         /* This means HAVE_CLOCK_GETTIME, too */
+         "HAVE_CLOCK_GETTIME" },
        { "HAVE_COMPOUND_LITERALS", INSIDE_MAIN, NULL, NULL,
          "int *foo = (int[]) { 1, 2, 3, 4 };\n"
          "return foo[0] ? 0 : 1;" },
@@ -477,6 +482,12 @@ static bool run_test(const char *cmd, struct test *test)
                test->answer = (status == 0);
        }
        test->done = true;
+
+       if (test->answer && test->overrides) {
+               struct test *override = find_test(test->overrides);
+               override->done = true;
+               override->answer = true;
+       }
        return test->answer;
 }