changeset 7058:ad2aaf824128

[project @ 2007-10-24 06:15:39 by jwe]
author jwe
date Wed, 24 Oct 2007 06:15:40 +0000
parents c344920f9e9d
children 8d57f66e35b8
files ChangeLog aclocal.m4 configure.in liboctave/ChangeLog liboctave/oct-time.cc liboctave/strptime.c
diffstat 6 files changed, 40 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Oct 24 04:39:57 2007 +0000
+++ b/ChangeLog	Wed Oct 24 06:15:40 2007 +0000
@@ -1,3 +1,8 @@
+2007-10-24  John W. Eaton  <jwe@octave.org>
+
+	* aclocal.m4 (OCTAVE_STRPTIME_BROKEN): New macro.
+	* configure.in: Use it.
+
 2007-10-23  John W. Eaton  <jwe@octave.org>
 
 	* configure.in: When checking for -lf2c, set F2CLIBS instad of
--- a/aclocal.m4	Wed Oct 24 04:39:57 2007 +0000
+++ b/aclocal.m4	Wed Oct 24 06:15:40 2007 +0000
@@ -117,6 +117,33 @@
 AC_LANG_POP(C++)
 ])
 dnl
+dnl Check for broken strptime
+dnl
+AC_DEFUN(OCTAVE_STRPTIME_BROKEN,
+[AC_CACHE_CHECK([whether strptime is broken],
+octave_cv_strptime_broken,
+[AC_LANG_PUSH(C)
+AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#define _XOPEN_SOURCE
+#if defined (HAVE_SYS_TYPES_H)
+#include <sys/types.h>
+#if defined (HAVE_UNISTD_H)
+#include <unistd.h>
+#endif
+#endif
+#include <stdio.h>
+#include <time.h>
+]], [[
+struct tm t;
+char *q = strptime ("09/13", "%m/%d/%y", &t);
+return q ? 1 : 0;
+]])], [octave_cv_strptime_broken=no], [octave_cv_strptime_broken=yes])])
+if test $octave_cv_strptime_broken = yes; then
+AC_DEFINE(OCTAVE_HAVE_BROKEN_STRPTIME, 1, [Define if strptime is broken on your system])
+fi
+AC_LANG_POP(C)
+])
+dnl
 dnl The following test is from Karl Berry's Kpathseach library.  I'm
 dnl including it here in case we someday want to make the use of
 dnl kpathsea optional.
--- a/configure.in	Wed Oct 24 04:39:57 2007 +0000
+++ b/configure.in	Wed Oct 24 06:15:40 2007 +0000
@@ -29,7 +29,7 @@
 EXTERN_CXXFLAGS="$CXXFLAGS"
 
 AC_INIT
-AC_REVISION($Revision: 1.584 $)
+AC_REVISION($Revision: 1.585 $)
 AC_PREREQ(2.57)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -1493,6 +1493,7 @@
   ;;
 esac
 
+OCTAVE_STRPTIME_BROKEN
 OCTAVE_SMART_PUTENV
 
 case "$canonical_host_type" in
--- a/liboctave/ChangeLog	Wed Oct 24 04:39:57 2007 +0000
+++ b/liboctave/ChangeLog	Wed Oct 24 06:15:40 2007 +0000
@@ -1,3 +1,7 @@
+2007-10-24  John W. Eaton  <jwe@octave.org>
+
+	* strptime.c: Also compile if OCTAVE_HAVE_BROKEN_STRPTIME is defined.
+
 2007-10-23  John W. Eaton  <jwe@octave.org>
 
 	* CRowVector.cc (operator * const ComplexRowVector&, const
--- a/liboctave/oct-time.cc	Wed Oct 24 04:39:57 2007 +0000
+++ b/liboctave/oct-time.cc	Wed Oct 24 06:15:40 2007 +0000
@@ -379,7 +379,7 @@
   octave_base_tm::init (&t);
 
 #if defined (HAVE_STRUCT_TM_TM_ZONE)
-  delete ps;
+  delete [] ps;
 #endif
 }
 
--- a/liboctave/strptime.c	Wed Oct 24 04:39:57 2007 +0000
+++ b/liboctave/strptime.c	Wed Oct 24 06:15:40 2007 +0000
@@ -27,7 +27,7 @@
 # include <config.h>
 #endif
 
-#ifndef HAVE_STRPTIME
+#if ! defined (HAVE_STRPTIME) || defined (OCTAVE_HAVE_BROKEN_STRPTIME)
 
 #include <ctype.h>
 #ifdef _LIBC