From df43975b759384a68a14a5881feb4673e952587d Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Sat, 3 Oct 2020 07:24:16 +0200
Subject: [PATCH] Fix broken ./configure --without-gui (again)

---
 Makefile.am                  |  2 +-
 configure.ac                 |  2 +-
 doc/automake.mk              |  9 +++++++++
 src/ui/automake.mk           |  2 --
 src/ui/gui/automake.mk       | 13 +++----------
 src/ui/gui/icons/automake.mk |  2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b2df75983b..3a71973ca3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -86,11 +86,11 @@ DIST_HOOKS += generate-changelog
 include $(top_srcdir)/build-aux/automake.mk
 include $(top_srcdir)/po/automake.mk
 include $(top_srcdir)/lib/automake.mk
-include $(top_srcdir)/doc/automake.mk
 include $(top_srcdir)/examples/automake.mk
 include $(top_srcdir)/src/automake.mk
 include $(top_srcdir)/utilities/automake.mk
 include $(top_srcdir)/tests/automake.mk
+include $(top_srcdir)/doc/automake.mk
 
 if WITH_PERL_MODULE
 include $(top_srcdir)/perl-module/automake.mk
diff --git a/configure.ac b/configure.ac
index 27a4c87af3..c23dc6bcd1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,7 +119,7 @@ AC_ARG_WITH([gui],
   [AS_HELP_STRING([--without-gui],
                   [Don't build the PSPPIRE GUI (using GTK+)])],
   [], [with_gui=yes])
-AM_CONDITIONAL([HAVE_GUI],
+AM_CONDITIONAL([building_gui],
                [test "$with_cairo" != no && test "$with_gui" != "no"])
 if test "$with_cairo" != no && test "$with_gui" != "no"; then
   PKG_CHECK_MODULES([GTHREAD], [gthread-2.0], [],
diff --git a/doc/automake.mk b/doc/automake.mk
index 976b584507..5bdfaa6754 100644
--- a/doc/automake.mk
+++ b/doc/automake.mk
@@ -95,3 +95,12 @@ CLEANFILES += pspp-dev.dvi $(docbook_DATA)
 
 doc: $(INFO_DEPS) $(DVIS) $(PDFS) $(PSS) $(HTMLS) $(dist_docbook_DATA)
 PHONY += doc
+
+$(top_srcdir)/doc/help-pages-list: $(UI_FILES)
+	 $(AM_V_GEN)cat $^ | grep '"help[-_]page"' | \
+   $(SED) -e 's% *<property name="help[-_]page">\([^<]*\)</property>%//*[@id='"'"'\1'"'"']%' \
+	-e 's%#%'"'"']/*[@id='"'"'%g' > $@,tmp
+	test -s $@,tmp
+	mv $@,tmp $@
+
+EXTRA_DIST += doc/help-pages-list
diff --git a/src/ui/automake.mk b/src/ui/automake.mk
index a531cf3c74..239ed4e302 100644
--- a/src/ui/automake.mk
+++ b/src/ui/automake.mk
@@ -17,9 +17,7 @@
 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
 
 include $(top_srcdir)/src/ui/terminal/automake.mk
-if HAVE_GUI
 include $(top_srcdir)/src/ui/gui/automake.mk
-endif
 
 noinst_LTLIBRARIES += src/ui/libuicommon.la
 
diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk
index 37dbdb4e82..fec10f5538 100644
--- a/src/ui/gui/automake.mk
+++ b/src/ui/gui/automake.mk
@@ -68,16 +68,7 @@ UI_FILES = \
 	src/ui/gui/var-type-dialog.ui \
 	src/ui/gui/weight.ui
 
-
-$(top_srcdir)/doc/help-pages-list: $(UI_FILES)
-	 $(AM_V_GEN)cat $^ | grep '"help[-_]page"' | \
-   $(SED) -e 's% *<property name="help[-_]page">\([^<]*\)</property>%//*[@id='"'"'\1'"'"']%' \
-	-e 's%#%'"'"']/*[@id='"'"'%g' > $@,tmp
-	test -s $@,tmp
-	mv $@,tmp $@
-
-EXTRA_DIST += doc/help-pages-list
-
+if building_gui
 
 EXTRA_DIST += \
 	src/ui/gui/org.fsf.pspp.metainfo.xml.in \
@@ -473,3 +464,5 @@ glade-tools: src/ui/gui/glade-wrapper src/ui/gui/libpsppire-glade.la
 # EXTRA_pkgLTLIBRARIES if DESTDIR is set.  It should not do that.
 install-EXTRA_pkgLTLIBRARIES:
 	true
+
+endif
diff --git a/src/ui/gui/icons/automake.mk b/src/ui/gui/icons/automake.mk
index f124b1c658..35d2331821 100644
--- a/src/ui/gui/icons/automake.mk
+++ b/src/ui/gui/icons/automake.mk
@@ -74,7 +74,7 @@ uninstall-icons:
 INSTALL_DATA_HOOKS += install-icons install-ext-icons
 UNINSTALL_DATA_HOOKS += uninstall-icons uninstall-ext-icons
 
-if HAVE_GUI
+if building_gui
 nodist_src_ui_gui_psppire_DATA = src/ui/gui/icons/splash.png
 
 src/ui/gui/icons/splash.png: $(top_srcdir)/src/ui/gui/icons/splash-t.png $(top_srcdir)/src/ui/gui/icons/splash-r.png Makefile
-- 
2.30.2