[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

oct-time.cc on an alpha

From: John W. Eaton
Subject: oct-time.cc on an alpha
Date: Wed, 23 Feb 2000 15:34:04 -0600 (CST)

On 23-Feb-2000, A. Scottedward Hodel <address@hidden> wrote:

| I'm updating my gcc/g++ to 2.95.2 so that I can compile the latest Octave
| CVS archives.
| Compiling liboctave/oct-time.cc gives errors:
| oct-time.cc:182: `struct tm' has no member named `tm_zone'
| oct-time.cc: In method `void octave_base_tm::init(void *)':
| oct-time.cc:229: `struct tm' has no member named `tm_zone'
| oct-time.cc: In method `void octave_strptime::init(const string &, const
| string &)':
| oct-time.cc:273: `struct tm' has no member named `tm_zone'
| There was previously an error near line 80 of this file.  I worked my way
| back to time.h on my system, which defines struct tm with:
| #ifdef _OSF_SOURCE
|         long    tm_gmtoff;
|         char    *tm_zone;
| #else
|         long    __tm_gmtoff;
|         char    *__tm_zone;
| #endif
| It's not clear to me why this doesn't cause problems in the configure
| script.

Feature tests for Octave are done with the C compiler.  In the old
days, the results of the tests were mostly correct, even if they were
going to be used in C++ sources.  But now C++ compilers are picky and
it may cause some trouble.  Recently, my approach has been to shove
all the non-standard C/C++ stuff off in C-language files where the
environment is a bit more forgiving.  The alternative solution of
checking for features using the C++ compiler doesn't seem as
desireable to me, because if the compiler is picky and the header
files are not quite right for C++, you will probably not see all the
features that your system really has.

The configure test for the tm_zone field in `struct tm' is:

  #include "confdefs.h"
  #include <sys/types.h>
  #include <$ac_cv_struct_tm>
  int main() {
  struct tm tm; tm.tm_zone;
  ; return 0; }

and $ac_cv_struct_tm is either time.h or sys/time.h.  The contents of
confdefs.h depends on what has been discovered up to this point in the
configure script, but I don't think it matters.  Can you compile

  #include <sys/types.h>
  #include <time.h>
  int main() { struct tm tm; tm.tm_zone; return 0; }

on your system with the C compiler?  What about if you use
<sys/time.h>?  What happens if you repeat the test with the C++

On the DEC Alpha system that I have access to (running DU 4.0E, I
think), it appears that _OSF_SOURCE is defined automatically (in
standards.h, included by time.h and sys/time.h) when I compile with
gcc or g++ (2.95.2).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]