+#include <stdlib.h>
+#include <string.h>
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifndef strdup
+char *strdup ();
+#endif
+
+#include "dirname.h"
+#include "xalloc.h"
+#include "path-concat.h"
+
+/* Concatenate two pathname components, DIR and BASE, in
+ newly-allocated storage and return the result. Return 0 if out of
+ memory. Add a slash between DIR and BASE in the result if neither
+ would contribute one. If each would contribute at least one, elide
+ one from the end of DIR. Otherwise, simply concatenate DIR and
+ BASE. In any case, if BASE_IN_RESULT is non-NULL, set
+ *BASE_IN_RESULT to point to the copy of BASE in the returned
+ concatenation.