From ee3be7a6ec399ac5df0e699b11c547fceef0b29f Mon Sep 17 00:00:00 2001
From: Patrick McDermott <patrick.mcdermott@libiquity.com>
Date: Fri, 22 Mar 2019 16:24:03 -0400
Subject: configure.ac, Makefile.am: Find ldconfig

---
diff --git a/Makefile.am b/Makefile.am
index 83a33fc..9ad8673 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,6 +70,7 @@ do_subst = sed \
 	-e 's|[@]SH[@]|$(SH)|g' \
 	-e 's|[@]READELF[@]|$(READELF)|g' \
 	-e 's|[@]OPKG[@]|$(OPKG)|g' \
+	-e 's|[@]LDCONFIG[@]|$(LDCONFIG)|g' \
 	-e 's|[@]multiarch_libdir[@]|$(multiarch_libdir)|g' \
 	-e 's|[@]library_path[@]|$(library_path)|g' \
 	-e 's|[@]bindir[@]|$(bindir)|g' \
diff --git a/configure.ac b/configure.ac
index f1d0966..882f920 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,6 +97,31 @@ AC_ARG_WITH(
 	]
 )
 
+AC_ARG_WITH(
+	[ldconfig],
+	[AS_HELP_STRING([--with-ldconfig=PATH], [path to ldconfig])],
+	[
+		case "${withval}" in
+			'yes'|'')
+				AC_MSG_ERROR(
+					[--with-ldconfig requires an argument])
+				;;
+			'no')
+				AC_MSG_ERROR([ldconfig is required])
+				;;
+			*)
+				LDCONFIG="${withval}"
+				;;
+		esac
+	],
+	[
+		AC_PATH_PROG([LDCONFIG], [ldconfig])
+		if test -z "${LDCONFIG}"; then
+			AC_MSG_ERROR([ldconfig not found])
+		fi
+	]
+)
+
 AC_ARG_ENABLE(
 	[multiarch-libdir],
 	[AS_HELP_STRING(
--
cgit v0.9.1