Make 3.78.1 does not compile out of the (tarball) box on UnixWare 7.
It detects that nanoseconds are available but draws some wrong conclusions.
There are also two problems that should occur on all platforms with
nanoseconds file time stamps.
One problem (probably common to all platforms on which configure detects
a nanoseconds member) is `#if ST_MTIM_NSEC', which should read
`#ifdef ST_MTIM_NSEC', as it is the member name and not a numeric/
boolean literal. At least GCC 2.95.2 rejects it (correctly, I think).
This occurs in `filedef.h' and `make.h'.
Having fixed this, the tv_sec member, unlike the tv_nsec member, cannot
be acccesed, because it is nested inside a union. That means it needs a
`st__tim.' prefix (as the tv_nsec member does) on UnixWare 7.
To find this out portably, a similar configure.in mechanism will
be necessary as the one (successfully) employed for tv_nsec.
After fixing the syntactical issues, a semantical issue
becomes visible. This is a system with file timestamps to nanoseconds, but
with no function `clock_gettime'. Therefore, file_timestamp_now falls back on
using time(2) instead, so Make's notion of `now' is rounded down to seconds
granularity. Believing to be up to one second in the past means that young
files appear to have a future date.
As far as I understand, the notion of now is only used to warn about files
that were created in the future. So this is not essential for Make's operation
proper, but the spurious warnings are annoying anyway (and make the
testsuite fail):
(from the diff in the testsuite)
+ make[1]: *** Warning: File `1.inc' has modification time in the future\
(2000-03-09 16:38:52.21 > 2000-03-09 16:38:52)
+ make[1]: *** Warning: Clock skew detected. Your build may be incomplete.
For systems where file time stamps have only seconds granularity, it does not
matter, but at least otherwise file_timestamp_now should try harder to get a
finer result. I would propose falling back on gettimeofday first, in the
absence
of the clock_gettime mechanism, and only on time(2) if that fails too.
If `file_timestamp_now' is still coarser than real file time stamps,
it should increase the result by one unit of its granularity (instead of
rounding
down).
Alternatively, a stamp file could be created if that gives the highest possible
granularity. (That might solve the MsWindoze issues as well.) But this is
messy.
With all this fixed, the testsuite still fails, but I believe it is a problem
in the
testsuite. The diff for features/reinvoke is:
[ -f b ] || echo >> b
+ echo >> a
+ [ -f b ] || echo >> b
hello
I suspect the statement `&touch('a','b');' in tests/scripts/features/reinvoke.
Obviously, it is supposed to create two files with the same timestamp.
It is verly likely to do so at seconds granularity, but wrong with
nanoseconds precision.
Actually, the files don't need to have the same time stamp for the test.
It is enough if b is not newer than a.
(Switching the arguments seems messy to me, two invokations of touch
are safer.)
With the patch below it works now.
A general fix would be more work, but this illustrates at least what
needs doing. (I am not familiar with autoconf.)
*** ./tests/scripts/features/reinvoke~ Thu Sep 16 21:10:08 1999
--- ./tests/scripts/features/reinvoke Thu Mar 9 18:37:57 2000
***************
*** 65,71 ****
close(MAKEFILE);
! &touch('a','b');
sleep(2);
&touch('c');
--- 65,72 ----
close(MAKEFILE);
! &touch('b');
! &touch('a');
sleep(2);
&touch('c');
*** ./make.h~ Thu Mar 9 16:09:37 2000
--- ./make.h Thu Mar 9 16:10:27 2000
***************
*** 240,246 ****
#endif /* Standard headers. */
! #if ST_MTIM_NSEC
# if HAVE_INTTYPES_H
# include <inttypes.h>
# endif
--- 240,246 ----
#endif /* Standard headers. */
! #ifdef ST_MTIM_NSEC
# if HAVE_INTTYPES_H
# include <inttypes.h>
# endif
*** ./filedef.h~ Wed Jul 21 21:48:44 1999
--- ./filedef.h Thu Mar 9 16:37:44 2000
***************
*** 119,127 ****
extern void notice_finished_file PARAMS ((struct file *file));
! #if ST_MTIM_NSEC
# define FILE_TIMESTAMP_STAT_MODTIME(st) \
! FILE_TIMESTAMP_FROM_S_AND_NS ((st).st_mtim.tv_sec, \
(st).st_mtim.ST_MTIM_NSEC)
# define FILE_TIMESTAMPS_PER_S \
MIN ((FILE_TIMESTAMP) 1000000000, \
--- 119,127 ----
extern void notice_finished_file PARAMS ((struct file *file));
! #ifdef ST_MTIM_NSEC
# define FILE_TIMESTAMP_STAT_MODTIME(st) \
! FILE_TIMESTAMP_FROM_S_AND_NS ((st).st_mtim.st__tim.tv_sec, \
(st).st_mtim.ST_MTIM_NSEC)
# define FILE_TIMESTAMPS_PER_S \
MIN ((FILE_TIMESTAMP) 1000000000, \
*** ./file.c~ Tue Aug 24 15:28:02 1999
--- ./file.c Thu Mar 9 18:16:40 2000
***************
*** 567,573 ****
if (clock_gettime (CLOCK_REALTIME, ×pec) == 0)
return FILE_TIMESTAMP_FROM_S_AND_NS (timespec.tv_sec, timespec.tv_nsec);
#endif
! return FILE_TIMESTAMP_FROM_S_AND_NS (time ((time_t *) 0), 0);
}
void
--- 567,576 ----
if (clock_gettime (CLOCK_REALTIME, ×pec) == 0)
return FILE_TIMESTAMP_FROM_S_AND_NS (timespec.tv_sec, timespec.tv_nsec);
#endif
! /* Should try to fall back on gettimeofday here first. */
!
! /* This is the last resort. */
! return FILE_TIMESTAMP_FROM_S_AND_NS (time ((time_t *) 0) + 1, 0);
}
void
-----------------------------------------------------------------
This email is confidential and intended solely for the use of the
individual to whom it is addressed.
Any views or opinions presented are solely those of the author
and do not necessarily represent those of Thyron Limited.
If you are not the intended recipient then please be advised
that you have received this email in error and that any use,
dissemination, forwarding, printing or copying of this email
is strictly prohibited.
If you have received this email in error, please notify the
Thyron IT Administrator on +44 (0)1923 236 050 or
send an email to [EMAIL PROTECTED]
Thank You