From ae6221e66809d21ec9cf02045b3ba69e241d22df Mon Sep 17 00:00:00 2001
From: Martin Blix Grydeland <martin@varnish-software.com>
Date: Wed, 29 Feb 2012 17:39:48 +0100
Subject: [PATCH 4/5] Install headers needed for vmod compilation in
 datadir/varnish/include, and export these locations in the pkg_config
 file.

---
 bin/varnishd/Makefile.am |   10 +++++++---
 include/Makefile.am      |   32 +++++++++++++++++++-------------
 varnishapi.pc.in         |   11 +++++++++--
 3 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index 8a925b9..bd91dd7 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -84,12 +84,9 @@ varnishd_SOURCES = \
 	waiter/cache_waiter_ports.c 
 
 noinst_HEADERS = \
-	cache/cache.h \
 	cache/cache_backend.h \
 	cache/cache_esi.h \
-	common/common.h \
 	common/heritage.h \
-	common/params.h \
 	default_vcl.h \
 	hash/hash_slinger.h \
 	mgt/mgt.h \
@@ -99,6 +96,13 @@ noinst_HEADERS = \
 	storage/storage_persistent.h \
 	waiter/waiter.h
 
+# Headers for use with vmods
+pkgdataincludedir = $(pkgdatadir)/include
+nobase_pkgdatainclude_HEADERS = \
+	cache/cache.h \
+	common/common.h \
+	common/params.h
+
 varnishd_CFLAGS = \
 	@PCRE_CFLAGS@ \
         -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \
diff --git a/include/Makefile.am b/include/Makefile.am
index 91812fa..3faa540 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,5 +1,6 @@
 #
 
+# API headers
 nobase_pkginclude_HEADERS = \
 	tbl/acct_fields.h \
 	tbl/backend_poll.h \
@@ -26,6 +27,7 @@ nobase_pkginclude_HEADERS = \
 	vapi/vsl_int.h \
 	vcli.h
 
+# Private headers
 nobase_noinst_HEADERS = \
 	binary_heap.h \
 	compat/daemon.h \
@@ -33,38 +35,42 @@ nobase_noinst_HEADERS = \
 	compat/srandomdev.h \
 	flopen.h \
 	libvcl.h \
-	miniobj.h \
 	persistent.h \
-	vas.h \
-	vav.h \
-	vbm.h \
-	vcl.h \
 	vcli_common.h \
 	vcli_priv.h \
 	vcli_serve.h \
 	vcs_version.h \
-	vcs.h \
 	vct.h \
-	vdef.h \
 	vend.h \
 	vev.h \
 	vfil.h \
 	vin.h \
 	vlu.h \
 	vmb.h \
-	vmod_abi.h \
 	vnum.h \
 	vpf.h \
+	vsub.h \
+	vss.h \
+	vtcp.h \
+	vtim.h
+
+# Headers for use with vmods
+pkgdataincludedir = $(pkgdatadir)/include
+nobase_pkgdatainclude_HEADERS = \
+	miniobj.h \
+	vas.h \
+	vav.h \
+	vbm.h \
+	vcl.h \
+	vcs.h \
+	vmod_abi.h \
 	vqueue.h \
 	vre.h \
+	vdef.h \
 	vrt.h \
 	vrt_obj.h \
 	vsb.h \
-	vsub.h \
-	vsha256.h \
-	vss.h \
-	vtcp.h \
-	vtim.h
+	vsha256.h
 
 tbl/vrt_stv_var.h tbl/vcl_returns.h vcl.h vrt_obj.h: $(top_srcdir)/lib/libvcl/generate.py $(top_srcdir)/include/vrt.h
 	mkdir -p tbl
diff --git a/varnishapi.pc.in b/varnishapi.pc.in
index 71cda56..7f5036a 100644
--- a/varnishapi.pc.in
+++ b/varnishapi.pc.in
@@ -1,11 +1,18 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+bindir=@bindir@
+sbindir=@sbindir@
 libdir=@libdir@
 includedir=@includedir@
-vmoddir=${libdir}/varnish/vmods
+pkgincludedir=${includedir}/@PACKAGE@
+datarootdir=@datarootdir@
+datadir=@datadir@
+pkgdatadir=${datadir}/@PACKAGE@
+pkgdataincludedir=${pkgdatadir}/include
+vmoddir=${libdir}/@PACKAGE@/vmods
 
 Name: VarnishAPI
 Description: Varnish API
 Version: @PACKAGE_VERSION@
-Cflags: -I${includedir}/varnish
+Cflags: -I${includedir}/@PACKAGE@
 Libs: -L${libdir} -lvarnishapi
-- 
1.7.4.1

