glibc 2.27 removes crypt(3) and suggests using libxcrypt. libxcrypt requires <crypt.h> to be included. --- customize/Makefile.am | 1 + customize/crypt-c.c | 4 ++++ m4/guestfs-misc-libraries.m4 | 27 +++++++++++++++++++-------- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/customize/Makefile.am b/customize/Makefile.am index b4ec9286a..a22e25c46 100644 --- a/customize/Makefile.am +++ b/customize/Makefile.am @@ -100,6 +100,7 @@ libcustomize_a_CPPFLAGS = \ -I$(top_srcdir)/common/edit libcustomize_a_CFLAGS = \ $(WARN_CFLAGS) $(WERROR_CFLAGS) \ + $(LIBCRYPT_CFLAGS) \ $(LIBVIRT_CFLAGS) \ $(LIBXML2_CFLAGS) \ -fPIC diff --git a/customize/crypt-c.c b/customize/crypt-c.c index 70e6ea7f5..d5425cfaa 100644 --- a/customize/crypt-c.c +++ b/customize/crypt-c.c @@ -22,6 +22,10 @@ #include <stdlib.h> #include <unistd.h> +#if HAVE_CRYPT_H +#include <crypt.h> +#endif + #include <caml/alloc.h> #include <caml/memory.h> #include <caml/mlvalues.h> diff --git a/m4/guestfs-misc-libraries.m4 b/m4/guestfs-misc-libraries.m4 index 2f371873f..f05a56fb8 100644 --- a/m4/guestfs-misc-libraries.m4 +++ b/m4/guestfs-misc-libraries.m4 @@ -17,14 +17,25 @@ dnl Miscellaneous libraries used by other programs. -dnl Check if crypt() is provided by a separate library. -old_LIBS="$LIBS" -AC_SEARCH_LIBS([crypt],[crypt]) -LIBS="$old_LIBS" -if test "$ac_cv_search_crypt" = "-lcrypt" ; then - LIBCRYPT_LIBS="-lcrypt" -fi -AC_SUBST([LIBCRYPT_LIBS]) +dnl glibc 2.27 removes crypt(3) and suggests using libxcrypt. +PKG_CHECK_MODULES([LIBCRYPT], [libxcrypt], [ + AC_SUBST([LIBCRYPT_CFLAGS]) + AC_SUBST([LIBCRYPT_LIBS]) +],[ + dnl Check if crypt() is provided by another library. + old_LIBS="$LIBS" + AC_SEARCH_LIBS([crypt],[crypt]) + LIBS="$old_LIBS" + if test "$ac_cv_search_crypt" = "-lcrypt" ; then + LIBCRYPT_LIBS="-lcrypt" + fi + AC_SUBST([LIBCRYPT_LIBS]) +]) + +dnl Do we need to include <crypt.h>? +old_CFLAGS="$CFLAGS" +AC_CHECK_HEADERS([crypt.h]) +CFLAGS="$old_CFLAGS" dnl liblzma can be used by virt-builder (optional). PKG_CHECK_MODULES([LIBLZMA], [liblzma], [ -- 2.13.2