hopefully fix strcasecmp and strnlen for those systems that don't hide them

This commit is contained in:
Bill Currie 2002-02-06 19:06:05 +00:00
parent 4f6e61d68b
commit d47533ad2e
3 changed files with 36 additions and 6 deletions

View file

@ -100,6 +100,12 @@
/* Define this if fnmatch is prototyped in fnmatch.h */
#undef HAVE_FNMATCH_PROTO
/* Define this if strnlen is prototyped in string.h */
#undef HAVE_STRNLEN_PROTO
/* Define this if fnmatch is prototyped in string.h */
#undef HAVE_STRCASESTR_PROTO
/* Define this to something appropriate for declaring 0 length arrays */
#undef ZERO_LENGTH_ARRAY

View file

@ -223,6 +223,24 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for strnlen in string.h)
AC_TRY_COMPILE(
[#include "string.h"],
[int (*foo)() = strnlen;],
AC_DEFINE(HAVE_STRNLEN_PROTO)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for strcasestr in string.h)
AC_TRY_COMPILE(
[#include "string.h"],
[int (*foo)() = strnlen;],
AC_DEFINE(HAVE_STRCASESTR_PROTO)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for type of fpos_t)
AC_TRY_COMPILE(
[#include <stdio.h>],
@ -307,8 +325,8 @@ AC_FUNC_VPRINTF
AC_CHECK_FUNCS(
access _access \
gethostname gethostbyname connect gettimeofday getwd mkdir _mkdir \
ftime _ftime fcntl stat putenv select socket strerror strstr \
snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo \
ftime _ftime fcntl stat putenv select socket strerror strcasestr strnlen \
strstr snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo \
getnameinfo mprotect
)

View file

@ -91,13 +91,19 @@ extern int vsnprintf(char *s, size_t maxlen, const char *format, va_list arg);
#if !defined(strncaseequal)
# define strncaseequal(a,b,c) (strncasecmp (a, b, c) == 0)
#endif
// FIXME: glibc has strcasestr, but only declares it if __USE_GNU is defined
#if !defined(strcasestr)
#ifdef HAVE_STRCASESTR
# ifndef HAVE_STRCASESTR_PROTO
extern char *strcasestr (const char *__haystack, const char *__needle);
# endif
#else
# define strcasestr Q_strcasestr
# define need_qstring_h
#endif
// FIXME: same as above
#if !defined(strnlen)
#ifdef HAVE_STRNLEN
# ifndef HAVE_STRNLEN_PROTO
size_t strnlen (const char *str, size_t len);
# endif
#else
# define strnlen Q_strnlen
# define need_qstring_h
#endif