>> I had t add a #include <sys/time.h> to get fe-misc.c to compile on my Debian
>> GNU/Linux 2.0 machine.
> Do you have the #include <time.h> line, and you need sys/time.h too?
Now that he mentions it, I've seen the same thing on Linux boxen:
you need to include both <time.h> and <sys/time.h>. (I think the
latter pulls in some definitions needed to use select() on that OS.)
Sorry for not remembering about it. On my OS <time.h> just includes
<sys/time.h> ...
The Autoconf manual says:
- Macro: AC_HEADER_TIME
If a program may include both `time.h' and `sys/time.h', define
`TIME_WITH_SYS_TIME'. On some older systems, `sys/time.h'
includes `time.h', but `time.h' is not protected against multiple
inclusion, so programs should not explicitly include both files.
This macro is useful in programs that use, for example, `struct
timeval' or `struct timezone' as well as `struct tm'. It is best
used in conjunction with `HAVE_SYS_TIME_H', which can be checked
for using `AC_CHECK_HEADERS(sys/time.h)'.
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
I notice that configure.in invokes AC_HEADER_TIME, but does not check
for existence of <sys/time.h> ... and neither of these symbols are
getting exported into config.h anyway. But that's probably the most
robust advice you're going to find.
regards, tom lane