Hi
I ran into the following issue when installing gprolog-1.5.0 when
DESTDIR is set:
In src/Makefile.in the target install directories are defined such that
DESTDIR is respected:

INSTALL_DIR    = $(DESTDIR)@INSTALL_DIR@LINKS_DIR      = $(DESTDIR)@
LINKS_DIR@DOC_DIR        = $(DESTDIR)@DOC_DIR@HTML_DIR       =
$(DESTDIR)@HTML_DIR@EXAMPLES_DIR   = $(DESTDIR)@EXAMPLES_DIR@
So far so good. However, there are special checks in the Makefile to
see if these destination directories are disabled by way of them being
set to "none", e.g:
    if test $(LINKS_DIR) != none; then ...    if test $(DOC_DIR) !=
none; then ...
    if test $(HTML_DIR) != none; then ...
    if test $(EXAMPLES_DIR) != none; then ...

If DESTDIR is set, then the above comparisons will always succeed even
if the the configure script has set the directories to none. In this
case we are comparing "$(DESTDIR)none" vs "none".
There are two ways of addressing this:

1. compare against $(DESTDIR)none. e.g:
    if test $(LINKS_DIR) != $(DESTDIR)none; then ...
2. compare the directories without DESTDIR against none. e.g:
    if test @LINKS_DIR@ != none; then ...

I've attached a patch I'm using on Gentoo Linux. (The patch applies
cleanly on top of the gprolog-1.5.0-links.patch [1]).

Thanks
Keri
[1] https://mail.gnu.org/archive/html/bug-prolog/2021-07/msg00001.html
--- gprolog-1.5.0.orig/src/Makefile.in	2021-07-07 16:06:16.000000000 -0000
+++ gprolog-1.5.0/src/Makefile.in	2021-07-10 12:49:40.967172260 -0000
@@ -85,13 +85,13 @@
 # --- Links --- #
 
 install-links: install-system uninstall-links
-	if test $(LINKS_DIR) != none; then \
+	if test @LINKS_DIR@ != none; then \
 	   ./mkinstalldirs $(LINKS_DIR); \
 	   (cd $(LINKS_DIR) ; $(LN_S) $(wildcard $(INSTALL_DIR)/bin/*) .); \
 	fi
 
 uninstall-links:
-	-if test $(LINKS_DIR) != none; then \
+	-if test @LINKS_DIR@ != none; then \
 	   (cd $(LINKS_DIR) 2>/dev/null && rm -f $(BIN_FILES)); \
 	   rmdir $(LINKS_DIR) 2>/dev/null; \
 	fi || exit 0;
@@ -100,14 +100,14 @@
 # --- Documentation --- #
 
 install-doc:
-	if test $(DOC_DIR) != none; then \
+	if test @DOC_DIR@ != none; then \
 	   ./mkinstalldirs $(DOC_DIR); \
 	   (F=`cd ../doc; echo $(DOC_FILES)`; \
 	   for i in $$F; do $(INSTALL_DATA) ../doc/$$i $(DOC_DIR); done); \
 	fi
 
 uninstall-doc:
-	-if test $(DOC_DIR) != none; then \
+	-if test @DOC_DIR@ != none; then \
 	   (cd $(DOC_DIR); rm -f $(DOC_FILES)); \
 	   rmdir $(DOC_DIR) 2>/dev/null; \
 	fi || exit 0;
@@ -116,14 +116,14 @@
 # --- HTML --- #
 
 install-html:
-	if test $(HTML_DIR) != none; then \
+	if test @HTML_DIR@ != none; then \
 	   ./mkinstalldirs $(HTML_DIR); \
 	   (F=`cd ../doc/html_node; echo $(HTML_FILES)`; \
 	   for i in $$F; do $(INSTALL_DATA) ../doc/html_node/$$i $(HTML_DIR); done); \
 	fi
 
 uninstall-html:
-	-if test $(HTML_DIR) != none; then \
+	-if test @HTML_DIR@ != none; then \
 	   (cd $(HTML_DIR); rm -f $(HTML_FILES)); \
 	   rmdir $(HTML_DIR) 2>/dev/null; \
 	fi || exit 0;
@@ -132,7 +132,7 @@
 # --- Examples --- #
 
 install-examples:
-	if test $(EXAMPLES_DIR) != none; then \
+	if test @EXAMPLES_DIR@ != none; then \
 	   ./mkinstalldirs $(EXAMPLES_DIR)/ExamplesPl; \
 	   (F=`cd ../examples/ExamplesPl; echo $(EXPL_FILES)`; \
 	   for i in $$F; do $(INSTALL_DATA) ../examples/ExamplesPl/$$i $(EXAMPLES_DIR)/ExamplesPl; done); \

Reply via email to