Skip to content

Commit 8bd2c97

Browse files
reubenhwkgitster
authored andcommitted
configure.ac: check 'tv_nsec' field in 'struct stat'
Detect 'tv_nsec' field in 'struct stat' and set Makefile variable NO_NSEC appropriately. A side-effect of the above detection is that we also determine whether 'stat.st_mtimespec' is available, so, as a bonus, set the Makefile variable USE_ST_TIMESPEC, as well. Signed-off-by: Reuben Hawkins <[email protected]> Helped-by: Eric Sunshine <[email protected]> Reviewed-by: Eric Sunshine <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3d2c1bf commit 8bd2c97

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

configure.ac

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,19 @@ AC_CHECK_TYPES([struct itimerval],
754754
[#include <sys/time.h>])
755755
GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL])
756756
#
757+
# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exists.
758+
# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor
759+
# stat.st_mtimespec.tv_nsec exists.
760+
AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec])
761+
AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec])
762+
if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes; then
763+
USE_ST_TIMESPEC=YesPlease
764+
GIT_CONF_SUBST([USE_ST_TIMESPEC])
765+
elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes; then
766+
NO_NSEC=YesPlease
767+
GIT_CONF_SUBST([NO_NSEC])
768+
fi
769+
#
757770
# Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
758771
AC_CHECK_MEMBER(struct dirent.d_ino,
759772
[NO_D_INO_IN_DIRENT=],

0 commit comments

Comments
 (0)