fi
dnl Checks for header files.
-AC_CHECK_HEADERS([crypt.h sys/param.h sys/socket.h])
+AC_CHECK_HEADERS([crypt.h sys/param.h sys/socket.h libgen.h])
dnl ucred.h may have prereqs
AC_CHECK_HEADERS([sys/ucred.h], [], [], [
#ifdef HAVE_SYS_TYPES_H
])
dnl Checks for library functions.
-AC_CHECK_FUNCS(strlcpy strlcat getpeereid getpeerucred)
+AC_CHECK_FUNCS(strlcpy strlcat getpeereid getpeerucred basename)
AC_SEARCH_LIBS(crypt, crypt, [], AC_MSG_ERROR([crypt not found]))
AC_SEARCH_LIBS(clock_gettime, rt)
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
/* how to specify array with unknown length */
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
#ifndef HAVE_GETPEEREID
int getpeereid(int fd, uid_t *uid_p, gid_t *gid_p) _MUSTCHECK;
#endif
+#ifndef HAVE_BASENAME
+const char *basename(const char *path);
+#endif
/*
* memcpy() optimization - improves hash.c.
}
#endif /* !HAVE_GETPEEREID */
+#ifndef HAVE_BASENAME
+const char *basename(const char *path)
+{
+ const char *p;
+ if (path == NULL || path[0] == 0)
+ return ".";
+ if ((p = strrchr(path, '/')) != NULL)
+ return p[1] ? p + 1 : p;
+ return path;
+}
+#endif
+