From 19b3fce293761bc300ac7bb57136772c8ae7b8fd Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 1 Mar 2011 23:19:20 +1030 Subject: [PATCH] config.h: HAVE_ASPRINTF --- config.h | 1 + tools/configurator/configurator.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/config.h b/config.h index 9d354869..4cd3f2ed 100644 --- a/config.h +++ b/config.h @@ -6,6 +6,7 @@ #define CCAN_CFLAGS "-g -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations" #define HAVE_ALIGNOF 1 +#define HAVE_ASPRINTF 1 #define HAVE_ATTRIBUTE_COLD 1 #define HAVE_ATTRIBUTE_CONST 1 #define HAVE_ATTRIBUTE_MAY_ALIAS 1 diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 4972e9e1..85842ced 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -38,6 +38,14 @@ struct test { static struct test tests[] = { { "HAVE_ALIGNOF", INSIDE_MAIN, NULL, "return __alignof__(double) > 0 ? 0 : 1;" }, + { "HAVE_ASPRINTF", DEFINES_FUNC, NULL, + "#define _GNU_SOURCE\n" + "#include \n" + "static char *func(int x) {" + " char *p;\n" + " if (asprintf(&p, \"%u\", x) == -1) p = NULL;" + " return p;\n" + "}" }, { "HAVE_ATTRIBUTE_COLD", DEFINES_FUNC, NULL, "static int __attribute__((cold)) func(int x) { return x; }" }, { "HAVE_ATTRIBUTE_CONST", DEFINES_FUNC, NULL, -- 2.39.2