conditionally build strnlen if needed.

it is only used by strndup

prodded by Sortie@
This commit is contained in:
Brent Cook 2014-08-02 21:43:56 -05:00
parent c95574be92
commit 00b51d5c25
3 changed files with 9 additions and 0 deletions

View File

@ -72,6 +72,11 @@ AC_CHECK_FUNC(strndup,
AC_DEFINE(NO_STRNDUP)
AM_CONDITIONAL(NO_STRNDUP, true))
AC_CHECK_FUNC(strnlen,
AM_CONDITIONAL(NO_STRNLEN, false),
AC_DEFINE(NO_STRNLEN)
AM_CONDITIONAL(NO_STRNLEN, true))
AC_CHECK_FUNC(asprintf,
AM_CONDITIONAL(NO_ASPRINTF, false),
AC_DEFINE(NO_ASPRINTF)

View File

@ -35,8 +35,10 @@ endif
if NO_STRNDUP
libcompat_la_SOURCES += compat/strndup.c
if NO_STRNLEN
libcompat_la_SOURCES += compat/strnlen.c
endif
endif
if NO_ASPRINTF
libcompat_la_SOURCES += compat/bsd-asprintf.c

View File

@ -22,8 +22,10 @@ size_t strlcat(char *dst, const char *src, size_t siz);
#ifdef NO_STRNDUP
char * strndup(const char *str, size_t maxlen);
#ifdef NO_STRNLEN
size_t strnlen(const char *str, size_t maxlen);
#endif
#endif
#ifdef NO_EXPLICIT_BZERO
void explicit_bzero(void *, size_t);