-# include <stdio.h>
-# include <stdlib.h>
-# include <stdarg.h>
-static inline int vasprintf (char **strp, const char *fmt, va_list ap)
-{
- int len = vsnprintf (NULL, 0, fmt, ap) + 1;
- char *res = (char *)malloc (len);
- if (res == NULL)
- return -1;
- *strp = res;
- return vsprintf (res, fmt, ap);
-}
+# include <stdarg.h> /* va_list */
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef HAVE_STRDUP
+char *strdup (const char *);
+#endif
+
+#ifndef HAVE_VASPRINTF
+int vasprintf (char **, const char *, va_list);