From: Roy Marples Date: Mon, 2 Jun 2014 16:31:37 +0000 (+0000) Subject: Use SHA256Init on OpenBSD .... grrr X-Git-Tag: v6.4.0~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=45a33d2f3e513869cb16ca59a3af169699301837;p=thirdparty%2Fdhcpcd.git Use SHA256Init on OpenBSD .... grrr --- diff --git a/configure b/configure index e9973f36..aacf606d 100755 --- a/configure +++ b/configure @@ -801,6 +801,7 @@ fi if [ -z "$SHA2" ]; then SHA2_LIB= + SHA2_RENAMED= printf "Testing for SHA256_Init ... " cat <_sha256.c #include @@ -826,12 +827,49 @@ EOF fi echo "$SHA2" rm -f _sha256.c _sha256 + if [ "$SHA2" = no ]; then + # Did OpenBSD really change this? grrrr + printf "Testing for SHA256Init ... " + cat <_sha256.c +#include +EOF + [ -n "$SHA2_H" ] && echo "#include <$SHA2_H>">>_sha256.c + cat <>_sha256.c +#include +int main(void) { + SHA2_CTX context; + SHA256Init(&context); + return 0; +} +EOF + # We only want to link to libmd if it exists in /lib + set -- $(ls /lib/libmd.so.* 2>/dev/null) + if $XCC _sha256.c -o _sha256 3>/dev/null; then + SHA2=yes + SHA2_RENAMED=yes + elif [ -e "$1" ] && $XCC _sha256.c -lmd -o _sha256 2>/dev/null + then + SHA2="yes (-lmd)" + SHA2_LIB=-lmd + SHA2_RENAMED=yes + else + SHA2=no + fi + echo "$SHA2" + rm -f _sha256.c _sha256 + fi fi if [ "$SHA2" = no ]; then echo "SHA256_SRC= sha256.c" >>$CONFIG_MK else echo "SHA256_SRC=" >>$CONFIG_MK echo "#define SHA2_H <$SHA2_H>" >>$CONFIG_H + if [ "$SHA2_RENAMED" = yes ]; then + echo "#define SHA256_CTX SHA2_CTX" >>$CONFIG_H + echo "#define SHA256_Init SHA256Init" >>$CONFIG_H + echo "#define SHA256_Update SHA256Update" >>$CONFIG_H + echo "#define SHA256_Final SHA256Final" >>$CONFIG_H + fi [ -n "$SHA2_LIB" ] && echo "LDADD+= $SHA2_LIB" >>$CONFIG_MK fi