build: Split libmd dependency due to MD5 functions from SHA requirements To be able to rework the md5 deprecation logic, we need to detangle when we depend on libmd due to requiring MD5 functions, which might be otherwise provided by libc, or when we require SHA functions for the internal getentropy() implementation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
diff --git a/configure.ac b/configure.ac
index 806b7d3..f40b1af 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,7 +110,7 @@ AC_SEARCH_LIBS([dlsym], [dl], [
])
AC_SEARCH_LIBS([MD5Update], [md], [
AS_IF([test "x$ac_cv_search_MD5Update" != "xnone required"], [
- LIBBSD_LIBS="$LIBBSD_LIBS $ac_cv_search_MD5Update"
+ MD5_LIBS="$MD5_LIBS $ac_cv_search_MD5Update"
])
], [
AC_MSG_ERROR([cannot find required MD5 functions in libc or libmd])
@@ -250,6 +250,7 @@ AC_CHECK_FUNCS([clearenv dirfd fopencookie __fpurge \
pstat_getproc sysconf])
AM_CONDITIONAL([HAVE_GETENTROPY], [test "x$ac_cv_func_getentropy" = "xtrue"])
+AC_SUBST([MD5_LIBS])
AC_SUBST([LIBBSD_LIBS])
AC_CONFIG_FILES([
diff --git a/src/Makefile.am b/src/Makefile.am
index fe9d1e6..d3f0162 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,6 +52,7 @@ libbsd_la_DEPENDENCIES = \
$(libbsd_la_included_sources) \
libbsd.map
libbsd_la_LIBADD = \
+ $(MD5_LIBS) \
$(LIBBSD_LIBS) \
$(nil)
libbsd_la_LDFLAGS = \
diff --git a/src/libbsd-overlay.pc.in b/src/libbsd-overlay.pc.in
index 01b7ea5..0455f22 100644
--- a/src/libbsd-overlay.pc.in
+++ b/src/libbsd-overlay.pc.in
@@ -8,5 +8,5 @@ Description: Utility functions from BSD systems (overlay)
Version: @VERSION@
URL: https://libbsd.freedesktop.org/
Libs: -L${libdir} -lbsd
-Libs.private: @LIBBSD_LIBS@
+Libs.private: @LIBBSD_LIBS@ @MD5_LIBS@
Cflags: -isystem ${includedir}/bsd -DLIBBSD_OVERLAY
diff --git a/src/libbsd.pc.in b/src/libbsd.pc.in
index 2c0ac17..4bca715 100644
--- a/src/libbsd.pc.in
+++ b/src/libbsd.pc.in
@@ -8,5 +8,5 @@ Description: Utility functions from BSD systems
Version: @VERSION@
URL: https://libbsd.freedesktop.org/
Libs: -L${libdir} -lbsd
-Libs.private: @LIBBSD_LIBS@
+Libs.private: @LIBBSD_LIBS@ @MD5_LIBS@
Cflags: -I${includedir}