Browse Source

config.h: HAVE_ASPRINTF

Rusty Russell 15 years ago
parent
commit
19b3fce293
2 changed files with 9 additions and 0 deletions
  1. 1 0
      config.h
  2. 8 0
      tools/configurator/configurator.c

+ 1 - 0
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

+ 8 - 0
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 <stdio.h>\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,