check if strptime() works correctly and disable its use if it doesn't [backport from HEAD]

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-06-14 01:10:17 +00:00
parent af81408a3e
commit 7cf8af693d
2 changed files with 14195 additions and 13586 deletions

27745
configure vendored

File diff suppressed because one or more lines are too long

View File

@@ -6085,8 +6085,7 @@ dnl ---------------------------------------------------------------------------
if test "$wxUSE_DATETIME" = "yes"; then
dnl check for strptime and for its declaration as some systems lack it
dnl FIXME: use WX_CHECK_FUNCS instead
AC_CHECK_FUNCS(strptime)
AC_CHECK_FUNC(strptime)
if test "$ac_cv_func_strptime" = "yes"; then
AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
[
@@ -6108,6 +6107,39 @@ if test "$wxUSE_DATETIME" = "yes"; then
fi
if test "$wx_cv_func_strptime_decl" = "yes"; then
AC_DEFINE(HAVE_STRPTIME_DECL)
else
wx_strptime_decl="extern char *strptime(const char *, const char *, struct tm *);"
fi
if test "$ac_cv_func_strptime" = "yes"; then
dnl strptime() behaviour doesn't conform to POSIX under Mac OS X <
dnl 10.5 and possibly other BSD variants, check that strptime() we
dnl have fails to parse format when the string doesn't match it instea
dnl of just stopping immediately and returning non-NULL
AC_CACHE_CHECK([whether strptime() fails on invalid strings],
wx_cv_func_strptime_ok,
[AC_RUN_IFELSE(
[
#include <stdlib.h>
#include <time.h>
#include "confdefs.h"
$wx_strptime_decl
int main()
{
return !!strptime("", "%x", NULL);
}
],
wx_cv_func_strptime_ok=yes,
wx_cv_func_strptime_ok=no,
dnl be pessimistic when cross-compiling
wx_cv_func_strptime_ok=no
)]
)
if test "$wx_cv_func_strptime_ok" = "yes"; then
AC_DEFINE(HAVE_STRPTIME)
fi
fi
dnl check for timezone variable