+#ifndef strdup
+char *strdup ();
+#endif
+
+#ifndef DIRECTORY_SEPARATOR
+# define DIRECTORY_SEPARATOR '/'
+#endif
+
+#ifndef ISSLASH
+# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
+#endif
+
+#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.
+
+ DIR may be NULL, BASE must not be.