From feadff80117865c8711ca077c8810086cabc022f Mon Sep 17 00:00:00 2001
From: Matthias Koeppe <mkoeppe@math.ucdavis.edu>
Date: Tue, 26 Aug 2025 15:49:29 -0700
Subject: [PATCH 2/2] Makefile.in (install-src) [ecl]: Set ECLDIR

---
 Makefile.in | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile.in b/Makefile.in
index 7b86d626..da7ce9f2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -154,6 +154,10 @@ install-src:
 	echo FRICAS_VERSION='"${PACKAGE_VERSION}"' >> '${COMMAND}'.tmp
 	echo FRICAS_LISP_FLAVOR='"${FRICAS_LISP_FLAVOR}"' >> '${COMMAND}'.tmp
 	echo FRICAS_LISP_VERSION='"${FRICAS_LISP_VERSION}"' >> '${COMMAND}'.tmp
+	if [ ${FRICAS_LISP_FLAVOR} = ecl -a -z "$$ECLDIR" ]; then \
+	    echo 'ECLDIR=$$(ecl --eval "(princ (si:get-library-pathname))" --eval "(quit)")' >> '${COMMAND}'.tmp ; \
+	    echo '[ -n "$$ECLDIR" ] && export ECLDIR' >> '${COMMAND}'.tmp ; \
+	fi
 	cat $(fricas_src_srcdir)/etc/fricas >> '${COMMAND}'.tmp
 	$(INSTALL_SCRIPT) '${COMMAND}'.tmp '${COMMAND}'
 	-rm '${COMMAND}'.tmp
-- 
2.47.0

