summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-10-29 22:32:14 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-10-29 22:32:14 -0700
commit5f5d7f2e69b9f80dcbbe3f6e0626e4664db70364 (patch)
tree11ac8b173852faa53fc0e3bbf2194ba058f0b0cc /configure
parent6896d02e5bdb2deb0f0b3d3becfe55dd9981a78b (diff)
downloadtxr-5f5d7f2e69b9f80dcbbe3f6e0626e4664db70364.tar.gz
txr-5f5d7f2e69b9f80dcbbe3f6e0626e4664db70364.tar.bz2
txr-5f5d7f2e69b9f80dcbbe3f6e0626e4664db70364.zip
stat: support high resolution time stamps.
* configure (have_sys_stat): New variable. Set to y when our test detects <sys/stat.h>. New test added for the presence of high resolution time stamps in struct stat. If we have these, we #define HAVE_STAT_NSEC 1 in config.h. * share/txr/stdlib/path-test.tl (path-newer): Compare nanosecond parts of the modification time if the seconds are equal, improving the resolution of the test. * sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s): New symbol variables. (stat_to_struct): If nanosecond resolution is available, set the new nanosecond slots from the three tv_nsec fields in struct stat. Otherwise, set the new slots to zero. (sysif_init): Initialize the new symbol variables. Add the three new slots to the stat struct. * sysif.c (atime_nsec_s, mtime_nsec_s, ctime_nsec_s): Declared. * txr.1: Documented new atime-nsec, mtime-nsec and ctime-nsec slots of stat structure. Added note to path-newer mentioning high resolution support.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure23
1 files changed, 23 insertions, 0 deletions
diff --git a/configure b/configure
index ba3c6f4d..5d31d359 100755
--- a/configure
+++ b/configure
@@ -127,6 +127,7 @@ debug_support=y
gen_gc=y
have_dbl_decimal_dig=
have_unistd=
+have_sys_stat=
have_sys_types=
have_sys_time=
have_makedev=
@@ -1609,10 +1610,32 @@ int main(void)
if conftest ; then
printf "yes\n"
printf "#define HAVE_SYS_STAT 1\n" >> config.h
+ have_sys_stat=y
else
printf "no\n"
fi
+if [ "$have_sys_stat" ] ; then
+ printf "Checking for sub-second resolution time in struct stat ... "
+
+ cat > conftest.c <<!
+
+#include <sys/stat.h>
+
+struct stat s;
+
+int main(void)
+{
+ return s.st_mtim.tv_nsec != 0;
+}
+!
+ if conftest ; then
+ printf "yes\n"
+ printf "#define HAVE_STAT_NSEC 1\n" >> config.h
+ else
+ printf "no\n"
+ fi
+fi
#
# environ