Browse Source

configurator: define HAVE_CCAN.

An interesting case came up with the tdb2 code in SAMBA recently.  It's a
public library, and it doesn't want to be dependent on CCAN, but the header
uses cast and typesafe_cb for extra type safety.

A good solution to this is to put dummy versions under !HAVE_CCAN.  Of course,
any CCAN config.h should define HAVE_CCAN.
Rusty Russell 14 years ago
parent
commit
98b8ada203
2 changed files with 3 additions and 0 deletions
  1. 1 0
      config.h
  2. 2 0
      tools/configurator/configurator.c

+ 1 - 0
config.h

@@ -7,6 +7,7 @@
 #define CCAN_COMPILER "cc"
 #define CCAN_CFLAGS "-g3 -ggdb -Wall -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wwrite-strings -DCCAN_STR_DEBUG=1"
 
+#define HAVE_CCAN 1
 #define HAVE_32BIT_OFF_T 1
 #define HAVE_ALIGNOF 1
 #define HAVE_ASPRINTF 1

+ 2 - 0
tools/configurator/configurator.c

@@ -440,6 +440,8 @@ int main(int argc, const char *argv[])
 	printf("#endif\n");
 	printf("#define CCAN_COMPILER \"%s\"\n", argv[1]);
 	printf("#define CCAN_CFLAGS \"%s\"\n\n", cmd + strlen(argv[1]) + 1);
+	/* This one implies "#include <ccan/..." works, eg. for tdb2.h */
+	printf("#define HAVE_CCAN 1\n");
 	for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
 		printf("#define %s %u\n", tests[i].name, tests[i].answer);
 	printf("#endif /* CCAN_CONFIG_H */\n");