1From 49e3ffcbe267691dfbf24c91417aa296e7412146 Mon Sep 17 00:00:00 2001 2From: Fabrice Fontaine <fontaine.fabrice@gmail.com> 3Date: Sun, 29 Aug 2021 21:15:57 +0200 4Subject: [PATCH] configure.ac: also search libcrypt through pkg-config 5 6libxcrypt provides a libcrypt.pc file so use it if available as this 7will allow to retrieve the library path (e.g. 8-L/home/buildroot/output/host//riscv64-buildroot-linux-musl/sysroot/usr/lib) 9which is useful when cross-compiling and will avoid the following build 10failure on buildroot: 11 12/home/buildroot/autobuild/run/instance-3/output-1/host/opt/ext-toolchain/bin/../lib/gcc/riscv64-buildroot-linux-musl/10.2.0/../../../../riscv64-buildroot-linux-musl/bin/ld: .libs/passverify.o: in function `.L30': 13passverify.c:(.text+0x368): undefined reference to `crypt_checksalt' 14 15Fixes: 16 - http://autobuild.buildroot.org/results/20b14e222b35c2d1269960075832b784ba81aa1a 17 18Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> 19[Retrieved from: 20https://github.com/linux-pam/linux-pam/commit/49e3ffcbe267691dfbf24c91417aa296e7412146] 21--- 22 configure.ac | 13 ++++++++++--- 23 1 file changed, 10 insertions(+), 3 deletions(-) 24 25diff --git a/configure.ac b/configure.ac 26index d464884c..c06bc7dd 100644 27--- a/configure.ac 28+++ b/configure.ac 29@@ -363,8 +363,14 @@ AC_CHECK_HEADERS(crypt.h) 30 31 BACKUP_LIBS=$LIBS 32 LIBCRYPT="" 33-AC_SEARCH_LIBS([crypt_gensalt_rn],[crypt]) 34-case "$ac_cv_search_crypt_gensalt_rn" in 35+PKG_CHECK_MODULES([CRYPT], [libcrypt], [ 36+ CFLAGS="$CFLAGS $CRYPT_CFLAGS" 37+ CPPFLAGS="$CPPFLAGS $CRYPT_CFLAGS" 38+ LIBS="$LIBS $CRYPT_LIBS" 39+ LIBCRYPT="$CRYPT_LIBS" 40+], [ 41+ AC_SEARCH_LIBS([crypt_gensalt_rn],[crypt]) 42+ case "$ac_cv_search_crypt_gensalt_rn" in 43 -l*) LIBCRYPT="$ac_cv_search_crypt_gensalt_rn" ;; 44 no) AC_SEARCH_LIBS([crypt_r],[crypt]) 45 case "$ac_cv_search_crypt_r" in 46@@ -374,7 +380,8 @@ case "$ac_cv_search_crypt_gensalt_rn" in 47 -l*) LIBCRYPT="$ac_cv_search_crypt" ;; 48 esac ;; 49 esac ;; 50-esac 51+ esac 52+]) 53 AC_CHECK_FUNCS([crypt_r]) 54 LIBS=$BACKUP_LIBS 55 AC_SUBST(LIBCRYPT) 56