Fix pkg-config in freetype-config for cross-compiling (#51274).

* builds/unix/unix-def.in (PKG_CONFIG): New variable.
(freetype-config): Use it in sed expression.

* builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/.
diff --git a/ChangeLog b/ChangeLog
index e50665b..bc65cbb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
-2017-06-16  Werner Lemberg  <wl@gnu.org>
+2017-06-20  Tony Theodore  <tonyt@logyst.com>
+
+	Fix pkg-config in freetype-config for cross-compiling (#51274).
+
+	* builds/unix/unix-def.in (PKG_CONFIG): New variable.
+	(freetype-config): Use it in sed expression.
+
+	* builds/unix/freetype-config.in: s/pkg-config/%PKG_CONFIG%/.
+
+2017-06-20  Werner Lemberg  <wl@gnu.org>
 
 	[cff, truetype] Integer overflows.
 
diff --git a/builds/unix/freetype-config.in b/builds/unix/freetype-config.in
index 22eb837..2c1c160 100644
--- a/builds/unix/freetype-config.in
+++ b/builds/unix/freetype-config.in
@@ -14,7 +14,7 @@
 
 
 # if `pkg-config' is available, use values from `freetype2.pc'
-pkg-config --atleast-pkgconfig-version 0.24 >/dev/null 2>&1
+%PKG_CONFIG% --atleast-pkgconfig-version 0.24 >/dev/null 2>&1
 if test $? -eq 0 ; then
   # note that option `--variable' is not affected by the
   # PKG_CONFIG_SYSROOT_DIR environment variable
@@ -23,17 +23,17 @@
     export PKG_CONFIG_SYSROOT_DIR
   fi
 
-  prefix=`pkg-config --variable prefix freetype2`
-  exec_prefix=`pkg-config --variable exec_prefix freetype2`
+  prefix=`%PKG_CONFIG% --variable prefix freetype2`
+  exec_prefix=`%PKG_CONFIG% --variable exec_prefix freetype2`
 
-  includedir=`pkg-config --variable includedir freetype2`
-  libdir=`pkg-config --variable libdir freetype2`
+  includedir=`%PKG_CONFIG% --variable includedir freetype2`
+  libdir=`%PKG_CONFIG% --variable libdir freetype2`
 
-  version=`pkg-config --modversion freetype2`
+  version=`%PKG_CONFIG% --modversion freetype2`
 
-  cflags=`pkg-config --cflags freetype2`
-  dynamic_libs=`pkg-config --libs freetype2`
-  static_libs=`pkg-config --static --libs freetype2`
+  cflags=`%PKG_CONFIG% --cflags freetype2`
+  dynamic_libs=`%PKG_CONFIG% --libs freetype2`
+  static_libs=`%PKG_CONFIG% --static --libs freetype2`
 else
   prefix="%prefix%"
   exec_prefix="%exec_prefix%"
diff --git a/builds/unix/unix-def.in b/builds/unix/unix-def.in
index feae99b..34e06e3 100644
--- a/builds/unix/unix-def.in
+++ b/builds/unix/unix-def.in
@@ -62,6 +62,7 @@
 
 # Variables needed for `freetype-config' and `freetype.pc'.
 #
+PKG_CONFIG         := @PKG_CONFIG@
 REQUIRES_PRIVATE   := @REQUIRES_PRIVATE@
 LIBS_PRIVATE       := @LIBS_PRIVATE@
 LIBSSTATIC_CONFIG  := @LIBSSTATIC_CONFIG@
@@ -102,6 +103,7 @@
 $(OBJ_BUILD)/freetype-config: $(TOP_DIR)/builds/unix/freetype-config.in
 	rm -f $@ $@.tmp
 	sed -e 's|%LIBSSTATIC_CONFIG%|$(LIBSSTATIC_CONFIG)|'   \
+	    -e 's|%PKG_CONFIG%|$(PKG_CONFIG)|'                 \
 	    -e 's|%build_libtool_libs%|$(build_libtool_libs)|' \
 	    -e 's|%exec_prefix%|$(exec_prefix)|'               \
 	    -e 's|%ft_version%|$(ft_version)|'                 \