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.
#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 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_32BIT_OFF_T 1
#define HAVE_ALIGNOF 1
#define HAVE_ASPRINTF 1
#define HAVE_32BIT_OFF_T 1
#define HAVE_ALIGNOF 1
#define HAVE_ASPRINTF 1
printf("#endif\n");
printf("#define CCAN_COMPILER \"%s\"\n", argv[1]);
printf("#define CCAN_CFLAGS \"%s\"\n\n", cmd + strlen(argv[1]) + 1);
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");
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");