git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup
  2015-01-07 20:23 ` v2 patches for fixes on RHEL3 Reuben Hawkins
@ 2015-01-07 20:23   ` Reuben Hawkins
  2015-01-07 21:46     ` Eric Sunshine
  0 siblings, 1 reply; 8+ messages in thread
From: Reuben Hawkins @ 2015-01-07 20:23 UTC (permalink / raw)
  To: git; +Cc: Reuben Hawkins

OpenSSL version 0.9.6b and before defined the function HMAC_cleanup.
Newer versions define HMAC_CTX_cleanup.  Check for HMAC_CTX_cleanup and
fall back to HMAC_cleanup when the newer function is missing.
---
 Makefile          | 3 +++
 configure.ac      | 7 +++++++
 git-compat-util.h | 3 +++
 3 files changed, 13 insertions(+)

diff --git a/Makefile b/Makefile
index af551a0..d3c2b58 100644
--- a/Makefile
+++ b/Makefile
@@ -1059,6 +1059,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
diff --git a/configure.ac b/configure.ac
index 424dec5..c282663 100644
--- a/configure.ac
+++ b/configure.ac
@@ -923,6 +923,13 @@ 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],
+	[NO_HMAC_CTX_CLEANUP=],
+	[NO_HMAC_CTX_CLEANUP=YesPlease],
+	[])
+GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP])
+#
 # Define HAVE_CLOCK_GETTIME=YesPlease if clock_gettime is available.
 GIT_CHECK_FUNC(clock_gettime,
 [HAVE_CLOCK_GETTIME=YesPlease],
diff --git a/git-compat-util.h b/git-compat-util.h
index 400e921..2fdca2d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -213,6 +213,9 @@ extern char *gitbasename(char *);
 #ifndef NO_OPENSSL
 #include <openssl/ssl.h>
 #include <openssl/err.h>
+#ifdef NO_HMAC_CTX_CLEANUP
+#define HMAC_CTX_cleanup HMAC_cleanup
+#endif
 #endif
 
 /* On most systems <netdb.h> would have given us this, but
-- 
2.2.0.68.g8f72f0c.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup
  2015-01-07 20:23   ` [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup Reuben Hawkins
@ 2015-01-07 21:46     ` Eric Sunshine
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sunshine @ 2015-01-07 21:46 UTC (permalink / raw)
  To: Reuben Hawkins; +Cc: Git List

On Wed, Jan 7, 2015 at 3:23 PM, Reuben Hawkins <reubenhwk@gmail.com> wrote:
> OpenSSL version 0.9.6b and before defined the function HMAC_cleanup.
> Newer versions define HMAC_CTX_cleanup.  Check for HMAC_CTX_cleanup and
> fall back to HMAC_cleanup when the newer function is missing.

Missing sign-off.

Overall, these patches are nicely improved from the previous round. A
few more comments below...

> ---
>  Makefile          | 3 +++
>  configure.ac      | 7 +++++++
>  git-compat-util.h | 3 +++
>  3 files changed, 13 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index af551a0..d3c2b58 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1059,6 +1059,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

You need to document this new Makefile variable (NO_HMAC_CTX_CLEANUP)
at the top of Makefile (as mentioned in my previous review[1]).

[1]: http://article.gmane.org/gmane.comp.version-control.git/261631

>  else
>         BASIC_CFLAGS += -DNO_OPENSSL
>         BLK_SHA1 = 1
> diff --git a/configure.ac b/configure.ac
> index 424dec5..c282663 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -923,6 +923,13 @@ 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],
> +       [NO_HMAC_CTX_CLEANUP=],
> +       [NO_HMAC_CTX_CLEANUP=YesPlease],
> +       [])
> +GIT_CONF_SUBST([NO_HMAC_CTX_CLEANUP])

It is customary to drop empty trailing arguments in m4.

Also, you can simplify this entire check to:

    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],

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat'
@ 2015-01-08 20:00 Reuben Hawkins
  2015-01-08 20:00 ` [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC Reuben Hawkins
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Reuben Hawkins @ 2015-01-08 20:00 UTC (permalink / raw)
  To: git; +Cc: Reuben Hawkins

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 <reubenhwk@gmail.com>
---
 configure.ac | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/configure.ac b/configure.ac
index 6af9647..210eb4e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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=],
-- 
2.2.0.68.g8f72f0c.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC
  2015-01-08 20:00 [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat' Reuben Hawkins
@ 2015-01-08 20:00 ` Reuben Hawkins
  2015-01-09  5:36   ` Eric Sunshine
  2015-01-08 20:00 ` [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup Reuben Hawkins
  2015-01-09  5:36 ` [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat' Eric Sunshine
  2 siblings, 1 reply; 8+ messages in thread
From: Reuben Hawkins @ 2015-01-08 20:00 UTC (permalink / raw)
  To: git; +Cc: Reuben Hawkins

The checks will override and unset YesPlease settings for HAVE_CLOCK_GETTIME
and HAVE_CLOCK_MONOTONIC in config.mak.uname.

CLOCK_MONOTONIC isn't available on RHEL3, but there are still RHEL3 systems
being used in production.

Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>
---
 Makefile         |  6 ++++++
 config.mak.uname |  1 +
 configure.ac     | 22 ++++++++++++++++++++++
 trace.c          |  2 +-
 4 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 7482a4d..57e33f2 100644
--- a/Makefile
+++ b/Makefile
@@ -339,6 +339,8 @@ 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.
 
 GIT-VERSION-FILE: FORCE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1382,6 +1384,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
diff --git a/config.mak.uname b/config.mak.uname
index a2f380f..926773e 100644
--- a/config.mak.uname
+++ b/config.mak.uname
@@ -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
diff --git a/configure.ac b/configure.ac
index 210eb4e..c3293b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -924,6 +924,28 @@ AC_CHECK_LIB([iconv], [locale_charset],
                      [CHARSET_LIB=-lcharset])])
 GIT_CONF_SUBST([CHARSET_LIB])
 #
+# 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=],
diff --git a/trace.c b/trace.c
index 4778608..bfbd48f 100644
--- a/trace.c
+++ b/trace.c
@@ -324,7 +324,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)
 {
-- 
2.2.0.68.g8f72f0c.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup
  2015-01-08 20:00 [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat' Reuben Hawkins
  2015-01-08 20:00 ` [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC Reuben Hawkins
@ 2015-01-08 20:00 ` Reuben Hawkins
  2015-01-09  5:37   ` Eric Sunshine
  2015-01-09  5:36 ` [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat' Eric Sunshine
  2 siblings, 1 reply; 8+ messages in thread
From: Reuben Hawkins @ 2015-01-08 20:00 UTC (permalink / raw)
  To: git; +Cc: Reuben Hawkins

OpenSSL version 0.9.6b and before defined the function HMAC_cleanup.
Newer versions define HMAC_CTX_cleanup.  Check for HMAC_CTX_cleanup and
fall back to HMAC_cleanup when the newer function is missing.

Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>
---
 Makefile          | 6 ++++++
 configure.ac      | 4 ++++
 git-compat-util.h | 3 +++
 3 files changed, 13 insertions(+)

diff --git a/Makefile b/Makefile
index 57e33f2..2ce1f1f 100644
--- a/Makefile
+++ b/Makefile
@@ -341,6 +341,9 @@ all::
 # 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
@@ -1061,6 +1064,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
diff --git a/configure.ac b/configure.ac
index c3293b9..9c66c3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -924,6 +924,10 @@ 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],
diff --git a/git-compat-util.h b/git-compat-util.h
index 400e921..2fdca2d 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -213,6 +213,9 @@ extern char *gitbasename(char *);
 #ifndef NO_OPENSSL
 #include <openssl/ssl.h>
 #include <openssl/err.h>
+#ifdef NO_HMAC_CTX_CLEANUP
+#define HMAC_CTX_cleanup HMAC_cleanup
+#endif
 #endif
 
 /* On most systems <netdb.h> would have given us this, but
-- 
2.2.0.68.g8f72f0c.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat'
  2015-01-08 20:00 [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat' Reuben Hawkins
  2015-01-08 20:00 ` [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC Reuben Hawkins
  2015-01-08 20:00 ` [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup Reuben Hawkins
@ 2015-01-09  5:36 ` Eric Sunshine
  2 siblings, 0 replies; 8+ messages in thread
From: Eric Sunshine @ 2015-01-09  5:36 UTC (permalink / raw)
  To: Reuben Hawkins; +Cc: Git List

On Thu, Jan 8, 2015 at 3:00 PM, Reuben Hawkins <reubenhwk@gmail.com> wrote:
> 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 <reubenhwk@gmail.com>

These patches may or may not deserve a Helped-by:.

With or without the Helped-by: and the minor style fix-up below...

Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>

Thanks for the perseverance.

For convenience of other reviewers: This is v3. v1 through v3 are
threaded together here:
http://thread.gmane.org/gmane.comp.version-control.git/261619

> ---
> diff --git a/configure.ac b/configure.ac
> index 6af9647..210eb4e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -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

Style: For consistency with all other 'if' conditionals in
configure.ac, drop the space before the semicolon.

> +       USE_ST_TIMESPEC=YesPlease
> +       GIT_CONF_SUBST([USE_ST_TIMESPEC])
> +elif test x$ac_cv_member_struct_stat_st_mtim_tv_nsec != xyes ; then

Ditto.

> +       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=],
> --
> 2.2.0.68.g8f72f0c.dirty

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC
  2015-01-08 20:00 ` [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC Reuben Hawkins
@ 2015-01-09  5:36   ` Eric Sunshine
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sunshine @ 2015-01-09  5:36 UTC (permalink / raw)
  To: Reuben Hawkins; +Cc: Git List

On Thu, Jan 8, 2015 at 3:00 PM, Reuben Hawkins <reubenhwk@gmail.com> wrote:
> The checks will override and unset YesPlease settings for HAVE_CLOCK_GETTIME
> and HAVE_CLOCK_MONOTONIC in config.mak.uname.

I find this hard to grok and would rewrite it as:

    Set or clear Makefile variables HAVE_CLOCK_GETTIME and
    HAVE_CLOCK_MONOTONIC based upon results of the checks (overriding
    default values from config.mak.uname).

> CLOCK_MONOTONIC isn't available on RHEL3, but there are still RHEL3 systems
> being used in production.
>
> Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>

With or without the minor rewrite above...

Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>

> ---
> diff --git a/Makefile b/Makefile
> index 7482a4d..57e33f2 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -339,6 +339,8 @@ 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.
>
>  GIT-VERSION-FILE: FORCE
>         @$(SHELL_PATH) ./GIT-VERSION-GEN
> @@ -1382,6 +1384,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
> diff --git a/config.mak.uname b/config.mak.uname
> index a2f380f..926773e 100644
> --- a/config.mak.uname
> +++ b/config.mak.uname
> @@ -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
> diff --git a/configure.ac b/configure.ac
> index 210eb4e..c3293b9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -924,6 +924,28 @@ AC_CHECK_LIB([iconv], [locale_charset],
>                       [CHARSET_LIB=-lcharset])])
>  GIT_CONF_SUBST([CHARSET_LIB])
>  #
> +# 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=],
> diff --git a/trace.c b/trace.c
> index 4778608..bfbd48f 100644
> --- a/trace.c
> +++ b/trace.c
> @@ -324,7 +324,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)
>  {
> --
> 2.2.0.68.g8f72f0c.dirty

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup
  2015-01-08 20:00 ` [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup Reuben Hawkins
@ 2015-01-09  5:37   ` Eric Sunshine
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Sunshine @ 2015-01-09  5:37 UTC (permalink / raw)
  To: Reuben Hawkins; +Cc: Git List

On Thu, Jan 8, 2015 at 3:00 PM, Reuben Hawkins <reubenhwk@gmail.com> wrote:
> OpenSSL version 0.9.6b and before defined the function HMAC_cleanup.
> Newer versions define HMAC_CTX_cleanup.  Check for HMAC_CTX_cleanup and
> fall back to HMAC_cleanup when the newer function is missing.
>
> Signed-off-by: Reuben Hawkins <reubenhwk@gmail.com>

Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>

Note that this patch has a minor and simple-to-resolve conflict with
b195aa00c1 (git-compat-util: suppress unavoidable Apple-specific
deprecation warnings; 2014-12-16) which was just promoted to master.
Junio may resolve it locally or ask you to re-send.

> ---
> diff --git a/Makefile b/Makefile
> index 57e33f2..2ce1f1f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -341,6 +341,9 @@ all::
>  # 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
> @@ -1061,6 +1064,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
> diff --git a/configure.ac b/configure.ac
> index c3293b9..9c66c3e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -924,6 +924,10 @@ 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],
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 400e921..2fdca2d 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -213,6 +213,9 @@ extern char *gitbasename(char *);
>  #ifndef NO_OPENSSL
>  #include <openssl/ssl.h>
>  #include <openssl/err.h>
> +#ifdef NO_HMAC_CTX_CLEANUP
> +#define HMAC_CTX_cleanup HMAC_cleanup
> +#endif
>  #endif
>
>  /* On most systems <netdb.h> would have given us this, but
> --
> 2.2.0.68.g8f72f0c.dirty

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-09  5:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 20:00 [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat' Reuben Hawkins
2015-01-08 20:00 ` [PATCH 2/3] configure.ac: check for clock_gettime and CLOCK_MONOTONIC Reuben Hawkins
2015-01-09  5:36   ` Eric Sunshine
2015-01-08 20:00 ` [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup Reuben Hawkins
2015-01-09  5:37   ` Eric Sunshine
2015-01-09  5:36 ` [PATCH 1/3] configure.ac: check 'tv_nsec' field in 'struct stat' Eric Sunshine
  -- strict thread matches above, loose matches on Subject: below --
2014-12-21 21:28 [PATCH 3/3] configure.ac,imap-send.c: check HMAC_CTX_cleanup Eric Sunshine
2015-01-07 20:23 ` v2 patches for fixes on RHEL3 Reuben Hawkins
2015-01-07 20:23   ` [PATCH 3/3] configure.ac: check for HMAC_CTX_cleanup Reuben Hawkins
2015-01-07 21:46     ` Eric Sunshine

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).