don't declare strptime() ourselves if the system already does it, we might have a slightly different declaration and this causes problems
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35699 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
83
configure
vendored
83
configure
vendored
@@ -38965,6 +38965,89 @@ _ACEOF
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if test "$ac_cv_func_strptime" = "yes"; then
|
||||||
|
echo "$as_me:$LINENO: checking for strptime declaration" >&5
|
||||||
|
echo $ECHO_N "checking for strptime declaration... $ECHO_C" >&6
|
||||||
|
if test "${wx_cv_func_strptime_decl+set}" = set; then
|
||||||
|
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||||
|
else
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ac_ext=cc
|
||||||
|
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||||
|
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||||
|
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
struct tm t;
|
||||||
|
strptime("foo", "bar", &t);
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
|
(eval $ac_compile) 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; } &&
|
||||||
|
{ ac_try='test -s conftest.$ac_objext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
wx_cv_func_strptime_decl=yes
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
wx_cv_func_strptime_decl=no
|
||||||
|
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
ac_ext=c
|
||||||
|
ac_cpp='$CPP $CPPFLAGS'
|
||||||
|
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||||
|
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||||
|
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fi
|
||||||
|
echo "$as_me:$LINENO: result: $wx_cv_func_strptime_decl" >&5
|
||||||
|
echo "${ECHO_T}$wx_cv_func_strptime_decl" >&6
|
||||||
|
fi
|
||||||
|
if test "$wx_cv_func_strptime_decl" = "yes"; then
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define HAVE_STRPTIME_DECL 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$as_me:$LINENO: checking for timezone variable in <time.h>" >&5
|
echo "$as_me:$LINENO: checking for timezone variable in <time.h>" >&5
|
||||||
echo $ECHO_N "checking for timezone variable in <time.h>... $ECHO_C" >&6
|
echo $ECHO_N "checking for timezone variable in <time.h>... $ECHO_C" >&6
|
||||||
|
27
configure.in
27
configure.in
@@ -5436,11 +5436,34 @@ fi
|
|||||||
|
|
||||||
dnl ---------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
dnl time/date functions
|
dnl time/date functions
|
||||||
dnl ------------------------------------------------------------------------
|
dnl ---------------------------------------------------------------------------
|
||||||
|
|
||||||
if test "$wxUSE_DATETIME" = "yes"; then
|
if test "$wxUSE_DATETIME" = "yes"; then
|
||||||
dnl check for strptime
|
dnl check for strptime and for its declaration as some systems lack it
|
||||||
AC_CHECK_FUNCS(strptime)
|
AC_CHECK_FUNCS(strptime)
|
||||||
|
if test "$ac_cv_func_strptime" = "yes"; then
|
||||||
|
AC_CACHE_CHECK([for strptime declaration], wx_cv_func_strptime_decl,
|
||||||
|
[
|
||||||
|
AC_LANG_SAVE
|
||||||
|
AC_LANG_CPLUSPLUS
|
||||||
|
AC_TRY_COMPILE(
|
||||||
|
[
|
||||||
|
#include <time.h>
|
||||||
|
],
|
||||||
|
[
|
||||||
|
struct tm t;
|
||||||
|
strptime("foo", "bar", &t);
|
||||||
|
],
|
||||||
|
wx_cv_func_strptime_decl=yes,
|
||||||
|
wx_cv_func_strptime_decl=no
|
||||||
|
)
|
||||||
|
AC_LANG_RESTORE
|
||||||
|
]
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
if test "$wx_cv_func_strptime_decl" = "yes"; then
|
||||||
|
AC_DEFINE(HAVE_STRPTIME_DECL)
|
||||||
|
fi
|
||||||
|
|
||||||
dnl check for timezone variable
|
dnl check for timezone variable
|
||||||
dnl doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
|
dnl doesn't exist under Darwin / Mac OS X which uses tm_gmtoff instead
|
||||||
|
@@ -392,9 +392,9 @@ static wxString CallStrftime(const wxChar *format, const tm* tm)
|
|||||||
|
|
||||||
#ifdef HAVE_STRPTIME
|
#ifdef HAVE_STRPTIME
|
||||||
|
|
||||||
// glibc2 doesn't define this in the headers unless _XOPEN_SOURCE is defined
|
#if wxUSE_UNIX && !defined(HAVE_STRPTIME_DECL)
|
||||||
// which, unfortunately, wreaks havoc elsewhere
|
// configure detected that we had strptime() but not its declaration,
|
||||||
#if defined(__GLIBC__) && (__GLIBC__ == 2)
|
// provide it ourselves
|
||||||
extern "C" char *strptime(const char *, const char *, struct tm *);
|
extern "C" char *strptime(const char *, const char *, struct tm *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user