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 */ /* Define this if fnmatch is prototyped in fnmatch.h */
#undef HAVE_FNMATCH_PROTO #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 */ /* Define this to something appropriate for declaring 0 length arrays */
#undef ZERO_LENGTH_ARRAY #undef ZERO_LENGTH_ARRAY

View file

@ -223,6 +223,24 @@ AC_TRY_COMPILE(
AC_MSG_RESULT(no) 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_MSG_CHECKING(for type of fpos_t)
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include <stdio.h>], [#include <stdio.h>],
@ -307,8 +325,8 @@ AC_FUNC_VPRINTF
AC_CHECK_FUNCS( AC_CHECK_FUNCS(
access _access \ access _access \
gethostname gethostbyname connect gettimeofday getwd mkdir _mkdir \ gethostname gethostbyname connect gettimeofday getwd mkdir _mkdir \
ftime _ftime fcntl stat putenv select socket strerror strstr \ ftime _ftime fcntl stat putenv select socket strerror strcasestr strnlen \
snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo \ strstr snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo \
getnameinfo mprotect 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) #if !defined(strncaseequal)
# define strncaseequal(a,b,c) (strncasecmp (a, b, c) == 0) # define strncaseequal(a,b,c) (strncasecmp (a, b, c) == 0)
#endif #endif
// FIXME: glibc has strcasestr, but only declares it if __USE_GNU is defined #ifdef HAVE_STRCASESTR
#if !defined(strcasestr) # ifndef HAVE_STRCASESTR_PROTO
extern char *strcasestr (const char *__haystack, const char *__needle);
# endif
#else
# define strcasestr Q_strcasestr # define strcasestr Q_strcasestr
# define need_qstring_h # define need_qstring_h
#endif #endif
// FIXME: same as above #ifdef HAVE_STRNLEN
#if !defined(strnlen) # ifndef HAVE_STRNLEN_PROTO
size_t strnlen (const char *str, size_t len);
# endif
#else
# define strnlen Q_strnlen # define strnlen Q_strnlen
# define need_qstring_h # define need_qstring_h
#endif #endif