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:
36
configure.in
36
configure.in
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user