From 25d35625ebd8e41756751cbb069dd607fc9fc49f Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sun, 28 Nov 2021 22:40:58 +0100 Subject: [PATCH] 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. --- configure.ac | 3 ++- src/Makefile.am | 1 + src/libbsd-overlay.pc.in | 2 +- src/libbsd.pc.in | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) 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}