configure.ac: check for HMAC_CTX_cleanup

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Reuben Hawkins committed Jan 8, 2015 at 12:00 UTC 88e011814b9498ee1170d82462a19f72a86f9d82
3 files changed +13
Makefile
+6
@@ -345,6 +345,9 @@ all::
345 # 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.
351
352 GIT-VERSION-FILE: FORCE
353 @$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1077,6 +1080,9 @@ ifndef NO_OPENSSL
1080 ifdef NEEDS_CRYPTO_WITH_SSL
1081 OPENSSL_LIBSSL += -lcrypto
1082 endif
1083 + ifdef NO_HMAC_CTX_CLEANUP
1084 + BASIC_CFLAGS += -DNO_HMAC_CTX_CLEANUP
1085 + endif
1086 else
1087 BASIC_CFLAGS += -DNO_OPENSSL
1088 BLK_SHA1 = 1
configure.ac
+4
@@ -947,6 +947,10 @@ AC_CHECK_LIB([iconv], [locale_charset],
947 [CHARSET_LIB=-lcharset])])
948 GIT_CONF_SUBST([CHARSET_LIB])
949 #
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],
git-compat-util.h
+3
@@ -214,6 +214,9 @@ extern char *gitbasename(char *);
214 #ifndef NO_OPENSSL
215 #include <openssl/ssl.h>
216 #include <openssl/err.h>
217 +#ifdef NO_HMAC_CTX_CLEANUP
218 +#define HMAC_CTX_cleanup HMAC_cleanup
219 +#endif
220 #endif
221
222 /* On most systems <netdb.h> would have given us this, but