tools/configurator: set HAVE_CLOCK_GETTIME even if it's in -lrt.
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 21 Jun 2014 04:44:56 +0000 (14:14 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 23 Jun 2014 00:57:23 +0000 (10:27 +0930)
This avoids conflicts with autoconf and other config.h sources.

Based on the work by Cody P Schafer <dev@codyps.com>.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
tools/configurator/configurator.c

index 6fa88e5b071fa6d80faf1fb4cfdeca8565e77b55..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;
 };
@@ -144,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;" },
@@ -479,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;
 }