From 69f00c7b2bf5066906b36f6196ed31356e3ea449 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 30 Nov 2009 10:19:36 -0500 Subject: [PATCH] Fix hash function config tests with CMake The commit "Improve portability of MD5/SHA* headers and functions" added both autotools and CMake detection of MD5, RMD, and SHA* hash functions. The commit "Move hashing function calling into a separate file" rewrote the autotools logic and changed the source to use different config macros but did not update the CMake logic. This commit updates the CMake configuration tests to produce the result macros the code expects. SVN-Revision: 1690 --- CMakeLists.txt | 57 ++++++++++--------------------------- build/cmake/config.h.in | 63 ++++++++++++++++------------------------- 2 files changed, 39 insertions(+), 81 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c6319c6e..0356c9e17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,48 +298,21 @@ ENDIF(CRYPTO_LIBRARY) # Check MD5/RMD160/SHA functions # SET(CMAKE_REQUIRED_LIBRARIES ${ADDITIONAL_LIBS}) -CHECK_FUNCTION_EXISTS(MD5_Init HAVE_MD5_Init) -IF(NOT HAVE_MD5_Init) - CHECK_FUNCTION_EXISTS(MD5Init HAVE_MD5Init) - IF(HAVE_MD5Init) - SET(MD5_Init, "MD5Init") - SET(MD5_Update, "MD5Update") - SET(MD5_Final, "MD5Final") - ENDIF(HAVE_MD5Init) -ENDIF(NOT HAVE_MD5_Init) -IF(HAVE_MD5_Init OR HAVE_MD5Init) - SET(HAVE_MD5 1) -ENDIF(HAVE_MD5_Init OR HAVE_MD5Init) -# -CHECK_FUNCTION_EXISTS(RIPEMD160_Init HAVE_RIPEMD160_Init) -IF(NOT HAVE_RIPEMD160_Init) - CHECK_FUNCTION_EXISTS(RMD160Init HAVE_RMD160Init) - IF(HAVE_RMD160Init) - SET(RIPEMD160_Init, "RMD160Init") - SET(RIPEMD160_Update, "RMD160Update") - SET(RIPEMD160_Final, "RMD160Final") - ENDIF(HAVE_RMD160Init) -ENDIF(NOT HAVE_RIPEMD160_Init) -IF(HAVE_RIPEMD160_Init OR HAVE_RMD160Init) - SET(HAVE_RMD160 1) -ENDIF(HAVE_RIPEMD160_Init OR HAVE_RMD160Init) -# -CHECK_FUNCTION_EXISTS(SHA1_Init HAVE_SHA1_Init) -IF(NOT HAVE_SHA1_Init) - CHECK_FUNCTION_EXISTS(SHA1Init HAVE_SHA1Init) - IF(HAVE_SHA1Init) - SET(SHA1_Init, "SHA1Init") - SET(SHA1_Update, "SHA1Update") - SET(SHA1_Final, "SHA1Final") - ENDIF(HAVE_SHA1Init) -ENDIF(NOT HAVE_SHA1_Init) -IF(HAVE_SHA1_Init OR HAVE_SHA1Init) - SET(HAVE_SHA1 1) -ENDIF(HAVE_SHA1_Init OR HAVE_SHA1Init) -# -CHECK_FUNCTION_EXISTS(SHA256_Init HAVE_SHA256) -CHECK_FUNCTION_EXISTS(SHA384_Init HAVE_SHA384) -CHECK_FUNCTION_EXISTS(SHA512_Init HAVE_SHA512) +IF(HAVE_MD5_H) + CHECK_SYMBOL_EXISTS(MD5Init "md5.h" HAVE_MD5INIT) +ENDIF(HAVE_MD5_H) +IF(HAVE_RMD160_H) + CHECK_SYMBOL_EXISTS(RMD160Init "rmd160.h" HAVE_RMD160INIT) +ENDIF(HAVE_RMD160_H) +IF(HAVE_SHA2_H) + CHECK_SYMBOL_EXISTS(SHA256Init "sha2.h" HAVE_SHA256INIT) + CHECK_SYMBOL_EXISTS(SHA384Init "sha2.h" HAVE_SHA384INIT) + CHECK_SYMBOL_EXISTS(SHA512Init "sha2.h" HAVE_SHA512INIT) + CHECK_SYMBOL_EXISTS(SHA256_Init "sha2.h" HAVE_SHA256_INIT) + CHECK_SYMBOL_EXISTS(SHA384_Init "sha2.h" HAVE_SHA384_INIT) + CHECK_SYMBOL_EXISTS(SHA512_Init "sha2.h" HAVE_SHA512_INIT) +ENDIF(HAVE_SHA2_H) +SET(CMAKE_REQUIRED_LIBRARIES "") # # Check functions diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index ea96372ad..98cb37d0b 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -278,8 +278,8 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LZMA_H 1 -/* Define to 1 if you have the `MD5' functions. */ -#cmakedefine HAVE_MD5 1 +/* Define to 1 if you have the `MD5Init' function. */ +#cmakedefine HAVE_MD5INIT 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_MD5_H 1 @@ -347,8 +347,8 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_RIPEMD_H 1 -/* Define to 1 if you have the `RIPEMD160' functions. */ -#cmakedefine HAVE_RMD160 1 +/* Define to 1 if you have the `RIPEMD160Init' function. */ +#cmakedefine HAVE_RMD160INIT 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_RMD160_H 1 @@ -362,14 +362,20 @@ /* Define to 1 if you have the `setlocale' function. */ #cmakedefine HAVE_SETLOCALE 1 -/* Define to 1 if you have the `SHA1' functions. */ -#cmakedefine HAVE_SHA1 1 +/* Define to 1 if you have the `SHA1Init' function. */ +#cmakedefine HAVE_SHA1INIT 1 + +/* Define to 1 if you have the `SHA1_Init' function. */ +#cmakedefine HAVE_SHA1_INIT 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SHA1_H 1 -/* Define to 1 if you have the `SHA256' functions. */ -#cmakedefine HAVE_SHA256 1 +/* Define to 1 if you have the `SHA256Init' function. */ +#cmakedefine HAVE_SHA256INIT 1 + +/* Define to 1 if you have the `SHA256_Init' function. */ +#cmakedefine HAVE_SHA256_INIT 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SHA256_H 1 @@ -377,11 +383,17 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SHA2_H 1 -/* Define to 1 if you have the `SHA384' functions. */ -#cmakedefine HAVE_SHA384 1 +/* Define to 1 if you have the `SHA384Init' function. */ +#cmakedefine HAVE_SHA384INIT 1 + +/* Define to 1 if you have the `SHA384_Init' function. */ +#cmakedefine HAVE_SHA384_INIT 1 + +/* Define to 1 if you have the `SHA512Init' function. */ +#cmakedefine HAVE_SHA512INIT 1 -/* Define to 1 if you have the `SHA512' functions. */ -#cmakedefine HAVE_SHA512 1 +/* Define to 1 if you have the `SHA512_Init' function. */ +#cmakedefine HAVE_SHA512_INIT 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SHA_H 1 @@ -602,36 +614,9 @@ . */ #cmakedefine MAJOR_IN_SYSMACROS 1 -/* Define to the generates final MD5 hash function. */ -#cmakedefine MD5_Final ${MD5_Final} - -/* Define to the initializes MD5 context function. */ -#cmakedefine MD5_Init ${MD5_Init} - -/* Define to the updates MD5 context function. */ -#cmakedefine MD5_Update ${MD5_Update} - /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #cmakedefine NO_MINUS_C_MINUS_O 1 -/* Define to the generates final RIPEMD160 hash function. */ -#cmakedefine RIPEMD160_Final ${RIPEMD160_Final} - -/* Define to the initializes RIPEMD160 context function. */ -#cmakedefine RIPEMD160_Init ${RIPEMD160_Init} - -/* Define to the updates RIPEMD160 context function. */ -#cmakedefine RIPEMD160_Update ${RIPEMD160_Update} - -/* Define to the generates final SHA1 hash function. */ -#cmakedefine SHA1_Final ${SHA1_Final} - -/* Define to the initializes SHA1 context function. */ -#cmakedefine SHA1_Init ${SHA1_Init} - -/* Define to the updates SHA1 context function. */ -#cmakedefine SHA1_Update ${SHA1_Update} - /* The size of `wchar_t', as computed by sizeof. */ #cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T} -- 2.47.3