+ { "HAVE_OPENMP", "#pragma omp and -fopenmp support",
+ "INSIDE_MAIN|EXECUTE|MAY_NOT_COMPILE", NULL, NULL,
+ "int i;\n"
+ "#pragma omp parallel for\n"
+ "for(i = 0; i < 0; i++) {};\n"
+ "return 0;\n",
+ "-Werror -fopenmp" },
+ { "HAVE_VALGRIND_MEMCHECK_H", "<valgrind/memcheck.h>",
+ "OUTSIDE_MAIN", NULL, NULL,
+ "#include <valgrind/memcheck.h>\n" },
+ { "HAVE_UCONTEXT", "working <ucontext.h",
+ "DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE",
+ NULL, NULL,
+ "#include <ucontext.h>\n"
+ "static int x = 0;\n"
+ "static char stack[2048];\n"
+ "static ucontext_t a, b;\n"
+ "static void fn(void) {\n"
+ " x |= 2;\n"
+ " setcontext(&b);\n"
+ " x |= 4;\n"
+ "}\n"
+ "int main(void) {\n"
+ " x |= 1;\n"
+ " getcontext(&a);\n"
+ " a.uc_stack.ss_sp = stack;\n"
+ " a.uc_stack.ss_size = sizeof(stack);\n"
+ " makecontext(&a, fn, 0);\n"
+ " swapcontext(&b, &a);\n"
+ " return (x == 3) ? 0 : 1;\n"
+ "}\n"
+ },
+ { "HAVE_POINTER_SAFE_MAKECONTEXT", "passing pointers via makecontext()",
+ "DEFINES_EVERYTHING|EXECUTE|MAY_NOT_COMPILE",
+ "HAVE_UCONTEXT", NULL,
+ "#include <stddef.h>\n"
+ "#include <ucontext.h>\n"
+ "static int worked = 0;\n"
+ "static char stack[8192];\n"
+ "static ucontext_t a, b;\n"
+ "static void fn(void *p, void *q) {\n"
+ " void *cp = &worked;\n"
+ " void *cq = (void *)(~((ptrdiff_t)cp));\n"
+ " if ((p == cp) && (q == cq))\n"
+ " worked = 1;\n"
+ " setcontext(&b);\n"
+ "}\n"
+ "int main(void) {\n"
+ " void *ap = &worked;\n"
+ " void *aq = (void *)(~((ptrdiff_t)ap));\n"
+ " getcontext(&a);\n"
+ " a.uc_stack.ss_sp = stack;\n"
+ " a.uc_stack.ss_size = sizeof(stack);\n"
+ " makecontext(&a, (void (*)(void))fn, 2, ap, aq);\n"
+ " swapcontext(&b, &a);\n"
+ " return worked ? 0 : 1;\n"
+ "}\n"
+ },
+ { "HAVE_BUILTIN_CPU_SUPPORTS", "__builtin_cpu_supports()",
+ "DEFINES_FUNC", NULL, NULL,
+ "#include <stdbool.h>\n"
+ "static bool func(void) {\n"
+ " return __builtin_cpu_supports(\"mmx\");\n"
+ "}"
+ },
+ { "HAVE_CLOSEFROM", "closefrom() offered by system",
+ "DEFINES_EVERYTHING", NULL, NULL,
+ "#include <stdlib.h>\n"
+ "#include <unistd.h>\n"
+ "int main(void) {\n"
+ " closefrom(STDERR_FILENO + 1);\n"
+ " return 0;\n"
+ "}\n"
+ },
+ { "HAVE_F_CLOSEM", "F_CLOSEM defined for fctnl.",
+ "DEFINES_EVERYTHING", NULL, NULL,
+ "#include <fcntl.h>\n"
+ "#include <unistd.h>\n"
+ "int main(void) {\n"
+ " int res = fcntl(STDERR_FILENO + 1, F_CLOSEM, 0);\n"
+ " return res < 0;\n"
+ "}\n"
+ },
+ { "HAVE_NR_CLOSE_RANGE", "close_range syscall available as __NR_close_range.",
+ "DEFINES_EVERYTHING", NULL, NULL,
+ "#include <limits.h>\n"
+ "#include <sys/syscall.h>\n"
+ "#include <unistd.h>\n"
+ "int main(void) {\n"
+ " int res = syscall(__NR_close_range, STDERR_FILENO + 1, INT_MAX, 0);\n"
+ " return res < 0;\n"
+ "}\n"
+ },
+ { "HAVE_F_MAXFD", "F_MAXFD defined for fcntl.",
+ "DEFINES_EVERYTHING", NULL, NULL,
+ "#include <fcntl.h>\n"
+ "#include <unistd.h>\n"
+ "int main(void) {\n"
+ " int res = fcntl(0, F_MAXFD);\n"
+ " return res < 0;\n"
+ "}\n"
+ },