From 2521a7d81c40ea83e568a7085e717228932832a3 Mon Sep 17 00:00:00 2001
From: "Timothy B. Terriberry" <tterribe@xiph.org>
Date: Tue, 1 Aug 2017 16:49:32 -0700
Subject: [PATCH] Print a useful error when pkg-config is missing

Without this check, the PKG_CHECK_MODULES() macro remains
unexpanded, which gives a syntax error when the shell reaches that
point in the configure script, even for checks which are disabled
(e.g., the OpenSSL check when using --disable-http).

Instead, explicitly check for pkg-config and give the user useful
advice on how to solve the problem if it's not found.

Thanks to eXpl0it3r for reporting a problem for which installing
pkg-config turned out to be the solution.
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 50112a5..8b4c543 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,11 @@ AM_COND_IF(OP_WIN32,
 )
 AC_SEARCH_LIBS(ftime, [compat], , [enable_http=no])
 
+m4_ifndef([PKG_PROG_PKG_CONFIG],
+  [m4_fatal([Could not locate the pkg-config autoconf macros.
+Please make sure pkg-config is installed and, if necessary, set the environment
+variable ACLOCAL="aclocal -I/path/to/pkg.m4".])])
+
 AS_IF([test "$enable_http" != "no"], [
    openssl="openssl"
    AC_DEFINE([OP_ENABLE_HTTP], [1], [Enable HTTP support])
-- 
GitLab