Skip to content

Commit 63a0e83

Browse files
committed
Merge branch 'rh/autoconf-rhel3'
Build update for older RHEL. * rh/autoconf-rhel3: configure.ac: check for HMAC_CTX_cleanup configure.ac: check for clock_gettime and CLOCK_MONOTONIC configure.ac: check 'tv_nsec' field in 'struct stat'
2 parents 09deda3 + 88e0118 commit 63a0e83

File tree

5 files changed

+56
-1
lines changed

5 files changed

+56
-1
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,11 @@ all::
343343
# return NULL when it receives a bogus time_t.
344344
#
345345
# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
346+
#
347+
# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC in librt.
348+
#
349+
# Define NO_HMAC_CTX_CLEANUP if your OpenSSL is version 0.9.6b or earlier to
350+
# cleanup the HMAC context with the older HMAC_cleanup function.
346351

347352
GIT-VERSION-FILE: FORCE
348353
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1075,6 +1080,9 @@ ifndef NO_OPENSSL
10751080
ifdef NEEDS_CRYPTO_WITH_SSL
10761081
OPENSSL_LIBSSL += -lcrypto
10771082
endif
1083+
ifdef NO_HMAC_CTX_CLEANUP
1084+
BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP
1085+
endif
10781086
else
10791087
BASIC_CFLAGS += -DNO_OPENSSL
10801088
BLK_SHA1 = 1
@@ -1402,6 +1410,10 @@ ifdef HAVE_CLOCK_GETTIME
14021410
EXTLIBS += -lrt
14031411
endif
14041412

1413+
ifdef HAVE_CLOCK_MONOTONIC
1414+
BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
1415+
endif
1416+
14051417
ifeq ($(TCLTK_PATH),)
14061418
NO_TCLTK = NoThanks
14071419
endif

config.mak.uname

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ifeq ($(uname_S),Linux)
3535
LIBC_CONTAINS_LIBINTL = YesPlease
3636
HAVE_DEV_TTY = YesPlease
3737
HAVE_CLOCK_GETTIME = YesPlease
38+
HAVE_CLOCK_MONOTONIC = YesPlease
3839
endif
3940
ifeq ($(uname_S),GNU/kFreeBSD)
4041
HAVE_ALLOCA_H = YesPlease

configure.ac

Lines changed: 39 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=],
@@ -934,6 +947,32 @@ AC_CHECK_LIB([iconv], [locale_charset],
934947
[CHARSET_LIB=-lcharset])])
935948
GIT_CONF_SUBST([CHARSET_LIB])
936949
#
950+
# Define NO_HMAC_CTX_CLEANUP=YesPlease if HMAC_CTX_cleanup is missing.
951+
AC_CHECK_LIB([crypto], [HMAC_CTX_cleanup],
952+
[], [GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP], [YesPlease])])
953+
#
954+
# Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available.
955+
GIT_CHECK_FUNC(clock_gettime,
956+
[HAVE_CLOCK_GETTIME=YesPlease],
957+
[HAVE_CLOCK_GETTIME=])
958+
GIT_CONF_SUBST([HAVE_CLOCK_GETTIME])
959+
960+
AC_DEFUN([CLOCK_MONOTONIC_SRC], [
961+
AC_LANG_PROGRAM([[
962+
#include <time.h>
963+
clockid_t id = CLOCK_MONOTONIC;
964+
]])])
965+
966+
#
967+
# Define HAVE_CLOCK_MONOTONIC=YesPlease if CLOCK_MONOTONIC is available.
968+
AC_MSG_CHECKING([for CLOCK_MONOTONIC])
969+
AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC],
970+
[AC_MSG_RESULT([yes])
971+
HAVE_CLOCK_MONOTONIC=YesPlease],
972+
[AC_MSG_RESULT([no])
973+
HAVE_CLOCK_MONOTONIC=])
974+
GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC])
975+
#
937976
# Define NO_SETITIMER if you don't have setitimer.
938977
GIT_CHECK_FUNC(setitimer,
939978
[NO_SETITIMER=],

git-compat-util.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ extern char *gitbasename(char *);
218218
#include <openssl/err.h>
219219
#undef MAC_OS_X_VERSION_MIN_REQUIRED
220220
#undef __AVAILABILITY_MACROS_USES_AVAILABILITY
221+
#ifdef NO_HMAC_CTX_CLEANUP
222+
#define HMAC_CTX_cleanup HMAC_cleanup
223+
#endif
221224
#endif
222225

223226
/* On most systems <netdb.h> would have given us this, but

trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ int trace_want(struct trace_key *key)
322322
return !!get_trace_fd(key);
323323
}
324324

325-
#ifdef HAVE_CLOCK_GETTIME
325+
#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC)
326326

327327
static inline uint64_t highres_nanos(void)
328328
{

0 commit comments

Comments
 (0)