diff options
author | Jonas 'Sortie' Termansen <sortie@maxsi.org> | 2014-08-29 09:42:37 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-08-29 12:23:41 -0700 |
commit | a7d3e070bd549e4f747a6948575aa3340d4b4c84 (patch) | |
tree | ea522ee43ed81de0d621a1106b579a9b2042dab0 | |
parent | 2fe4d0abe7bc260967c89353ec18d65c71802bb5 (diff) | |
download | git-a7d3e070bd549e4f747a6948575aa3340d4b4c84.tar.gz |
autoconf: check for struct timespec
This type will be used in a following commit.
This type was not previously used by git. This can cause trouble for
people on systems without struct timespec if they only rely on
config.mak.uname. They will need to set NO_STRUCT_TIMESPEC manually.
Signed-off-by: Jonas 'Sortie' Termansen <sortie@maxsi.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | config.mak.uname | 2 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | git-compat-util.h | 7 |
4 files changed, 21 insertions, 0 deletions
@@ -184,6 +184,8 @@ all:: # # Define NO_TIMER_T if you don't have timer_t. # +# Define NO_STRUCT_TIMESPEC if you don't have struct timespec +# # Define NO_STRUCT_ITIMERVAL if you don't have struct itimerval # This also implies NO_SETITIMER # @@ -1343,6 +1345,9 @@ endif ifdef NO_TIMER_T COMPAT_CFLAGS += -DNO_TIMER_T endif +ifdef NO_STRUCT_TIMESPEC + COMPAT_CFLAGS += -DNO_STRUCT_TIMESPEC +endif ifdef NO_STRUCT_ITIMERVAL COMPAT_CFLAGS += -DNO_STRUCT_ITIMERVAL NO_SETITIMER = YesPlease diff --git a/config.mak.uname b/config.mak.uname index c14aba3e6b..b8b8d0a8fa 100644 --- a/config.mak.uname +++ b/config.mak.uname @@ -357,6 +357,7 @@ ifeq ($(uname_S),Windows) DEFAULT_HELP_FORMAT = html NO_D_INO_IN_DIRENT = YesPlease NO_TIMER_T = UnfortunatelyYes + NO_STRUCT_TIMESPEC = UnfortunatelyYes CC = compat/vcbuild/scripts/clink.pl AR = compat/vcbuild/scripts/lib.pl @@ -507,6 +508,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) DEFAULT_HELP_FORMAT = html NO_D_INO_IN_DIRENT = YesPlease NO_TIMER_T = UnfortunatelyYes + NO_STRUCT_TIMESPEC = UnfortunatelyYes COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -D_USE_32BIT_TIME_T -DNOGDI -Icompat -Icompat/win32 COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\" COMPAT_OBJS += compat/mingw.o compat/winansi.o \ diff --git a/configure.ac b/configure.ac index 126af58365..bed8fe9c95 100644 --- a/configure.ac +++ b/configure.ac @@ -762,6 +762,13 @@ AC_CHECK_TYPES([timer_t], #include <time.h>]) GIT_CONF_SUBST([NO_TIMER_T]) # +# Define NO_STRUCT_TIMESPEC if you don't have struct timespec. +AC_CHECK_TYPES([struct timespec], +[NO_STRUCT_TIMESPEC=], +[NO_STRUCT_TIMESPEC=UnfortunatelyYes], +[#include <sys/time.h>]) +GIT_CONF_SUBST([NO_STRUCT_TIMESPEC]) +# # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent. AC_CHECK_MEMBER(struct dirent.d_ino, [NO_D_INO_IN_DIRENT=], diff --git a/git-compat-util.h b/git-compat-util.h index e0e7a62b64..e9e7e5451a 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -191,6 +191,13 @@ extern int compat_mkdir_wo_trailing_slash(const char*, mode_t); typedef int timer_t; #endif +#ifdef NO_STRUCT_TIMESPEC +struct timespec { + time_t tv_sec; + long tv_nsec; +}; +#endif + #ifdef NO_STRUCT_ITIMERVAL struct itimerval { struct timeval it_interval; |