From 2a5b8810bb1791ef044b9421969131bd385b8a70 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 21 Nov 2022 14:00:13 +0100 Subject: [PATCH] agetpass: Hook into build-system Signed-off-by: Guillem Jover Signed-off-by: Alejandro Colomar --- configure.ac | 15 +++++++++++++++ libmisc/Makefile.am | 1 + libmisc/agetpass.c | 2 ++ 3 files changed, 18 insertions(+) diff --git a/configure.ac b/configure.ac index 6c7d9839..a22b47bd 100644 --- a/configure.ac +++ b/configure.ac @@ -405,6 +405,21 @@ AC_SUBST(LIYESCRYPT) AC_CHECK_LIB(crypt, crypt, [LIYESCRYPT=-lcrypt], [AC_MSG_ERROR([crypt() not found])]) +AC_SEARCH_LIBS([readpassphrase], [bsd], [], [ + AC_MSG_ERROR([readpassphrase() is missing, either from libc or libbsd]) +]) +AS_IF([test "$ac_cv_search_readpassphrase" = "-lbsd"], [ + PKG_CHECK_MODULES([LIBBSD], [libbsd-overlay]) +]) +dnl Make sure either the libc or libbsd provide the header. +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $LIBBSD_CFLAGS" +AC_CHECK_HEADERS([readpassphrase.h]) +AS_IF([test "$ac_cv_header_readpassphrase_h" != "yes"], [ + AC_MSG_ERROR([readpassphrase.h is missing]) +]) +CFLAGS="$save_CFLAGS" + AC_SUBST(LIBACL) if test "$with_acl" != "no"; then AC_CHECK_HEADERS(acl/libacl.h attr/error_context.h, [acl_header="yes"], [acl_header="no"]) diff --git a/libmisc/Makefile.am b/libmisc/Makefile.am index 636cc439..c2277a02 100644 --- a/libmisc/Makefile.am +++ b/libmisc/Makefile.am @@ -5,6 +5,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir) $(ECONF_CPPFLAGS) noinst_LTLIBRARIES = libmisc.la +libmisc_la_CFLAGS = $(LIBBSD_CFLAGS) libmisc_la_SOURCES = \ addgrps.c \ age.c \ diff --git a/libmisc/agetpass.c b/libmisc/agetpass.c index 3271ea39..f4aad7a3 100644 --- a/libmisc/agetpass.c +++ b/libmisc/agetpass.c @@ -26,6 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include + #include #include #include