From: Andre Noll <maan@tuebingen.mpg.de>
Date: Thu, 12 May 2016 18:55:26 +0000 (+0200)
Subject: build: Insist on m4 being installed.
X-Git-Tag: v0.5.6~26
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=33ba8eb22b343a76c455bb240fbbfd3dc3063f11;p=paraslash.git

build: Insist on m4 being installed.

Unlike stated in the manual, m4 is not an optional package that is
only needed on developer machines to build the html version of the
manual. Rather, the m4 macro processor is an essential requirement
because the gengetopt input files are generated with m4 from their
templates in m4/gengetopt.

This patch moves the documentation item on m4 from the development
section of the manual to the list of required packages for building
the paraslash package. It also adds a check for the m4 executable
to configure.ac to let the generated configure script fail the build
early on systems where m4 is not installed.
---

diff --git a/Makefile.in b/Makefile.in
index a8e2a8b9..61da659f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -9,6 +9,7 @@ PACKAGE_TARNAME := @PACKAGE_TARNAME@
 PACKAGE_VERSION := @PACKAGE_VERSION@
 
 INSTALL := @INSTALL@
+M4 := @M4@
 GENGETOPT := @GENGETOPT@
 HELP2MAN := @HELP2MAN@
 
diff --git a/configure.ac b/configure.ac
index 5960b087..2e4b42ce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,6 +71,10 @@ AC_PATH_PROG([GENGETOPT], [gengetopt])
 test -z "$GENGETOPT" && AC_MSG_ERROR(
 	[gengetopt is required to build this package])
 
+AC_PATH_PROG([M4], [m4])
+test -z "$M4" && AC_MSG_ERROR(
+	[The m4 macro processor is required to build this package])
+
 AC_PATH_PROG([HELP2MAN], [help2man])
 test -z "$HELP2MAN" && AC_MSG_ERROR(
 	[help2man is required to build this package])
diff --git a/m4/gengetopt/makefile b/m4/gengetopt/makefile
index 5130ddd1..0db9d10e 100644
--- a/m4/gengetopt/makefile
+++ b/m4/gengetopt/makefile
@@ -18,10 +18,10 @@ endif
 
 $(m4depdir)/%.m4d: $(m4_ggo_dir)/%.m4 | $(m4depdir)
 	@[ -z "$(Q)" ] || echo 'M4D $<'
-	$(Q) m4 -I $(m4_ggo_dir) -s $< \
+	$(Q) $(M4) -I $(m4_ggo_dir) -s $< \
 	| awk '{if ($$1 ~ /#line/) {gsub(/"/, "", $$3); if ($$3 != "$<") \
 	print "$(ggo_dir)/$(*F).ggo: " $$3}}' | sort | uniq > $@
 
 $(ggo_dir)/%.ggo: $(m4_ggo_dir)/%.m4 $(m4_ggo_dir)/header.m4 | $(ggo_dir)
 	@[ -z "$(Q)" ] || echo 'M4 $<'
-	$(Q) m4 -I $(m4_ggo_dir) $< > $@
+	$(Q) $(M4) -I $(m4_ggo_dir) $< > $@
diff --git a/web/manual.md b/web/manual.md
index 3b9c2709..43509f12 100644
--- a/web/manual.md
+++ b/web/manual.md
@@ -187,7 +187,7 @@ Requirements
 
 	git clone git://git.tuebingen.mpg.de/osl
 	cd osl && make && sudo make install && sudo ldconfig
-	sudo apt-get install autoconf libssl-dev help2man gengetopt \
+	sudo apt-get install autoconf libssl-dev help2man gengetopt m4 \
               libmad0-dev libid3tag0-dev libasound2-dev libvorbis-dev \
               libfaad-dev libspeex-dev libFLAC-dev libsamplerate-dev realpath \
               libasound2-dev libao-dev libreadline-dev libncurses-dev \
@@ -221,6 +221,9 @@ executables.
 - [help2man](ftp://ftp.gnu.org/pub/gnu/help2man) is used to create
 the man pages.
 
+- [m4](ftp://ftp.gnu.org/pub/gnu/m4/). Some source files are generated
+from templates by the m4 macro processor.
+
 Optional:
 
 - [openssl](http://www.openssl.org/) or
@@ -1825,9 +1828,6 @@ developer machine.
 paraslash development. It is necessary for cloning the git repository
 and for getting updates.
 
-- [m4](ftp://ftp.gnu.org/pub/gnu/m4/). Some input files for gengetopt
-are generated from templates by the m4 macro processor.
-
 - [autoconf](ftp://ftp.gnu.org/pub/gnu/autoconf/) GNU autoconf creates
 the configure file which is shipped in the tarballs but has to be
 generated when compiling from git.