--- a/m4macros/ax_crypto.m4
+++ b/m4macros/ax_crypto.m4
@@ -454,7 +454,7 @@ EOF
     dnl Check availability of SHA-2
     AC_MSG_CHECKING([support of SHA-2])
     LIBS_SAVED=${LIBS}
-    LIBS="$LIBS $CRYPTO_LIBS"
+    LIBS="$LIBS $CRYPTO_LIBS -lpthread"
     CPPFLAGS_SAVED=${CPPFLAGS}
     CPPFLAGS="$CRYPTO_INCLUDES $CPPFLAGS"
     AC_LINK_IFELSE(
