Subject: [PATCH] Add support for pkg-config
Origin: https://github.com/telegramdesktop/libtgvoip/commit/4ce5e22ed2dc24e9211c4874c1dd6b05faad2a87
From: Ilya Fedin <fedin-ilja2010@ya.ru>
Date: Sun, 5 Jan 2020 12:25:31 +0400
Acked-By: Nicholas Guriev <guriev-ns@ya.ru>
Last-Modified: Mon, 22 Jun 2020 09:57:02 +0300

--- a/Makefile.am
+++ b/Makefile.am
@@ -755,6 +755,8 @@ libtgvoip_la_SOURCES = $(SRC) $(TGVOIP_H
 tgvoipincludedir = $(includedir)/tgvoip
 nobase_tgvoipinclude_HEADERS = $(TGVOIP_HDRS)
 
+pkgconfig_DATA = tgvoip.pc
+
 CXXFLAGS += -std=gnu++17 $(CFLAGS)
 if TARGET_OS_OSX
 OBJCFLAGS = $(CFLAGS)
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,8 @@ AM_INIT_AUTOMAKE([subdir-objects])
 AM_SILENT_RULES([yes])
 LT_INIT
 
+PKG_INSTALLDIR
+
 # Checks for programs.
 AC_PROG_CXX
 AC_PROG_CC
@@ -123,5 +125,5 @@ AC_FUNC_MALLOC
 AC_FUNC_REALLOC
 AC_CHECK_FUNCS([clock_gettime floor gettimeofday inet_ntoa memmove memset select socket sqrt strcasecmp strchr strerror strncasecmp strstr strtol strtoul uname])
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile tgvoip.pc])
 AC_OUTPUT
--- /dev/null
+++ b/tgvoip.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: tgvoip
+Description: VoIP library for Telegram clients
+Version: @LIBTGVOIP_MAJOR_VERSION@.@LIBTGVOIP_MINOR_VERSION@.@LIBTGVOIP_PATCH_VERSION@
+Requires.private: libcrypto opus
+Libs: -L${libdir} -ltgvoip -lpthread
+Libs.private: -ldl -lm
+Cflags: -I${includedir}/tgvoip
