]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
build: Fix message digest library checks
authorGuillem Jover <guillem@hadrons.org>
Tue, 9 Feb 2021 05:02:46 +0000 (06:02 +0100)
committerGuillem Jover <guillem@hadrons.org>
Tue, 9 Feb 2021 05:23:38 +0000 (06:23 +0100)
They were not failing when not finding the SHA-2 functions and
were hardcoding -lmd regardless of what library had been found.

configure.ac

index f100045f3918e7519b2b85f08e049a5c0c4466db..7afc7af57fb6436470779769c1f07fb86909e1e3 100644 (file)
@@ -65,11 +65,18 @@ AM_CONDITIONAL([HAVE_LIBTESTU01],
 
 saved_LIBS="$LIBS"
 AC_SEARCH_LIBS([MD5Update], [md], [
-  AC_SEARCH_LIBS([SHA512Update], [md], [
-    MD_LIBS="-lmd"
+  AS_IF([test "x$ac_cv_search_MD5Update" != "xnone required"], [
+    MD_LIBS="$ac_cv_search_MD5Update"
   ])
 ], [
-  AC_MSG_ERROR([cannot find required message digest functions in libc or libmd])
+  AC_MSG_ERROR([cannot find required MD5 functions in libc or libmd])
+])
+AC_SEARCH_LIBS([SHA512Update], [md], [
+  AS_IF([test "x$ac_cv_search_SHA512Update" != "xnone required"], [
+    MD_LIBS="$ac_cv_search_SHA512Update"
+  ])
+], [
+  AC_MSG_ERROR([cannot find required SHA-2 functions in libc or libmd])
 ])
 AC_SUBST([MD_LIBS])
 LIBS="$saved_LIBS"