Commit a7833f26c4ac45cafe1dffdcd7f7dcfd6493161c

Hugh McMaster 2018-03-07T22:23:54

Make installation of `freetype-config' optional (#53093). Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>

diff --git a/ChangeLog b/ChangeLog
index ee07320..1711e72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-03-08  Hugh McMaster  <hugh.mcmaster@outlook.com>
+
+	Make installation of `freetype-config' optional (#53093).
+
+	* bulds/unix/configure.raw: Add option `--enable-freetype-config'
+	and set `INSTALL_FT2_CONFIG'.
+	* builds/unix/unix-def.in (INSTALL_FT2_CONFIG): Define.
+	* builds/unix/install.mk (install): Handle it.
+
 2018-03-05  Werner Lemberg  <wl@gnu.org>
 
 	Make `ftlcdfil.c' part of the `base' module.
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 48e0f40..1b4aa2c 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -177,6 +177,15 @@ fi
 
 CPPFLAGS="${orig_CPPFLAGS}"
 
+AC_ARG_ENABLE([freetype-config],
+  AS_HELP_STRING([--enable-freetype-config], [install freetype-config]),
+  [case "${enableval}" in
+    yes) enable_freetype_config="TRUE" ;;
+    no)  enable_freetype_config="FALSE" ;;
+    *)   AC_MSG_ERROR([unknown value '${enableval}' passed with --enable-freetype-config]) ;;
+   esac], [enable_freetype_config="FALSE"])
+
+AC_SUBST(INSTALL_FT2_CONFIG, [$enable_freetype_config])
 
 # checks for library functions
 
diff --git a/builds/unix/install.mk b/builds/unix/install.mk
index d89064e..8942451 100644
--- a/builds/unix/install.mk
+++ b/builds/unix/install.mk
@@ -39,9 +39,11 @@ install: $(PROJECT_LIBRARY)
 	$(MKINSTALLDIRS) $(DESTDIR)$(libdir)                               \
                          $(DESTDIR)$(libdir)/pkgconfig                     \
                          $(DESTDIR)$(includedir)/freetype2/freetype/config \
-                         $(DESTDIR)$(bindir)                               \
-                         $(DESTDIR)$(datadir)/aclocal                      \
+                         $(DESTDIR)$(datadir)/aclocal
+ifeq ($(INSTALL_FT2_CONFIG),TRUE)
+	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)                               \
                          $(DESTDIR)$(mandir)/man1
+endif
 	$(LIBTOOL) --mode=install $(INSTALL)                             \
                                   $(PROJECT_LIBRARY) $(DESTDIR)$(libdir)
 	-for P in $(PUBLIC_H) ; do                           \
@@ -52,7 +54,7 @@ install: $(PROJECT_LIBRARY)
           $(INSTALL_DATA)                                           \
             $$P $(DESTDIR)$(includedir)/freetype2/freetype/config ; \
         done
-	$(INSTALL_DATA) $(TOP_DIR)/include/ft2build.h  \
+	$(INSTALL_DATA) $(TOP_DIR)/include/ft2build.h                  \
           $(DESTDIR)$(includedir)/freetype2/ft2build.h
 	$(INSTALL_DATA) $(OBJ_BUILD)/ftconfig.h                        \
           $(DESTDIR)$(includedir)/freetype2/freetype/config/ftconfig.h
@@ -60,14 +62,16 @@ install: $(PROJECT_LIBRARY)
           $(DESTDIR)$(includedir)/freetype2/freetype/config/ftmodule.h
 	$(INSTALL_DATA) $(OBJ_BUILD)/ftoption.h                        \
           $(DESTDIR)$(includedir)/freetype2/freetype/config/ftoption.h
-	$(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config \
-          $(DESTDIR)$(bindir)/freetype-config
-	$(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4 \
+	$(INSTALL_SCRIPT) -m 644 $(BUILD_DIR)/freetype2.m4             \
           $(DESTDIR)$(datadir)/aclocal/freetype2.m4
-	$(INSTALL_SCRIPT) -m 644 $(OBJ_BUILD)/freetype2.pc \
+	$(INSTALL_SCRIPT) -m 644 $(OBJ_BUILD)/freetype2.pc             \
           $(DESTDIR)$(libdir)/pkgconfig/freetype2.pc
-	$(INSTALL_DATA) $(TOP_DIR)/docs/freetype-config.1 \
+ifeq ($(INSTALL_FT2_CONFIG),TRUE)
+	$(INSTALL_SCRIPT) -m 755 $(OBJ_BUILD)/freetype-config          \
+          $(DESTDIR)$(bindir)/freetype-config
+	$(INSTALL_DATA) $(TOP_DIR)/docs/freetype-config.1              \
           $(DESTDIR)$(mandir)/man1/freetype-config.1
+endif
 
 
 uninstall:
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index 059a061..6957053 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -145,6 +145,9 @@ $(OBJ_BUILD)/freetype2.pc: $(TOP_DIR)/builds/unix/freetype2.in
 	chmod a-w $@.tmp
 	mv $@.tmp $@
 
+# defines whether we should install `freetype-config' or not
+INSTALL_FT2_CONFIG = @INSTALL_FT2_CONFIG@
+
 all install: $(OBJ_BUILD)/freetype-config \
      $(OBJ_BUILD)/freetype2.pc