Skip to content

Commit

Permalink
Merge branch 'rh/autoconf-rhel3'
Browse files Browse the repository at this point in the history
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'
  • Loading branch information
Junio C Hamano committed Jan 14, 2015
2 parents 09deda3 + 88e0118 commit 63a0e83
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,11 @@ all::
# return NULL when it receives a bogus time_t.
#
# Define HAVE_CLOCK_GETTIME if your platform has clock_gettime in librt.
#
# Define HAVE_CLOCK_MONOTONIC if your platform has CLOCK_MONOTONIC in librt.
#
# Define NO_HMAC_CTX_CLEANUP if your OpenSSL is version 0.9.6b or earlier to
# cleanup the HMAC context with the older HMAC_cleanup function.

GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
Expand Down Expand Up @@ -1075,6 +1080,9 @@ ifndef NO_OPENSSL
ifdef NEEDS_CRYPTO_WITH_SSL
OPENSSL_LIBSSL += -lcrypto
endif
ifdef NO_HMAC_CTX_CLEANUP
BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP
endif
else
BASIC_CFLAGS += -DNO_OPENSSL
BLK_SHA1 = 1
Expand Down Expand Up @@ -1402,6 +1410,10 @@ ifdef HAVE_CLOCK_GETTIME
EXTLIBS += -lrt
endif

ifdef HAVE_CLOCK_MONOTONIC
BASIC_CFLAGS += -DHAVE_CLOCK_MONOTONIC
endif

ifeq ($(TCLTK_PATH),)
NO_TCLTK = NoThanks
endif
Expand Down
1 change: 1 addition & 0 deletions config.mak.uname
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ifeq ($(uname_S),Linux)
LIBC_CONTAINS_LIBINTL = YesPlease
HAVE_DEV_TTY = YesPlease
HAVE_CLOCK_GETTIME = YesPlease
HAVE_CLOCK_MONOTONIC = YesPlease
endif
ifeq ($(uname_S),GNU/kFreeBSD)
HAVE_ALLOCA_H = YesPlease
Expand Down
39 changes: 39 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,19 @@ AC_CHECK_TYPES([struct itimerval],
[#include <sys/time.h>])
GIT_CONF_SUBST([NO_STRUCT_ITIMERVAL])
#
# Define USE_ST_TIMESPEC=YesPlease when stat.st_mtimespec.tv_nsec exists.
# Define NO_NSEC=YesPlease when neither stat.st_mtim.tv_nsec nor
# stat.st_mtimespec.tv_nsec exists.
AC_CHECK_MEMBER([struct stat.st_mtimespec.tv_nsec])
AC_CHECK_MEMBER([struct stat.st_mtim.tv_nsec])
if test x$ac_cv_member_struct_stat_st_mtimespec_tv_nsec = xyes; then
USE_ST_TIMESPEC=YesPlease
GIT_CONF_SUBST([USE_ST_TIMESPEC])
elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes; then
NO_NSEC=YesPlease
GIT_CONF_SUBST([NO_NSEC])
fi
#
# 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=],
Expand Down Expand Up @@ -934,6 +947,32 @@ AC_CHECK_LIB([iconv], [locale_charset],
[CHARSET_LIB=-lcharset])])
GIT_CONF_SUBST([CHARSET_LIB])
#
# Define NO_HMAC_CTX_CLEANUP=YesPlease if HMAC_CTX_cleanup is missing.
AC_CHECK_LIB([crypto], [HMAC_CTX_cleanup],
[], [GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP], [YesPlease])])
#
# Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available.
GIT_CHECK_FUNC(clock_gettime,
[HAVE_CLOCK_GETTIME=YesPlease],
[HAVE_CLOCK_GETTIME=])
GIT_CONF_SUBST([HAVE_CLOCK_GETTIME])

AC_DEFUN([CLOCK_MONOTONIC_SRC], [
AC_LANG_PROGRAM([[
#include <time.h>
clockid_t id = CLOCK_MONOTONIC;
]])])

#
# Define HAVE_CLOCK_MONOTONIC=YesPlease if CLOCK_MONOTONIC is available.
AC_MSG_CHECKING([for CLOCK_MONOTONIC])
AC_COMPILE_IFELSE([CLOCK_MONOTONIC_SRC],
[AC_MSG_RESULT([yes])
HAVE_CLOCK_MONOTONIC=YesPlease],
[AC_MSG_RESULT([no])
HAVE_CLOCK_MONOTONIC=])
GIT_CONF_SUBST([HAVE_CLOCK_MONOTONIC])
#
# Define NO_SETITIMER if you don't have setitimer.
GIT_CHECK_FUNC(setitimer,
[NO_SETITIMER=],
Expand Down
3 changes: 3 additions & 0 deletions git-compat-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ extern char *gitbasename(char *);
#include <openssl/err.h>
#undef MAC_OS_X_VERSION_MIN_REQUIRED
#undef __AVAILABILITY_MACROS_USES_AVAILABILITY
#ifdef NO_HMAC_CTX_CLEANUP
#define HMAC_CTX_cleanup HMAC_cleanup
#endif
#endif

/* On most systems <netdb.h> would have given us this, but
Expand Down
2 changes: 1 addition & 1 deletion trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ int trace_want(struct trace_key *key)
return !!get_trace_fd(key);
}

#ifdef HAVE_CLOCK_GETTIME
#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC)

static inline uint64_t highres_nanos(void)
{
Expand Down

0 comments on commit 63a0e83

Please sign in to comment.