From 14a3169af35615164323851176aeb9043ff4f2ca Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Sat, 2 Jan 2010 16:16:24 +0100
Subject: [PATCH] Restructured handling of Dovecot includes in makefiles.

---
 configure.in                                  | 25 ++++++++-----------
 src/lib-sieve-tool/Makefile.am                |  3 ++-
 src/lib-sieve/Makefile.am                     |  2 +-
 src/lib-sieve/plugins/body/Makefile.am        |  2 +-
 .../comparator-i-ascii-numeric/Makefile.am    |  2 +-
 src/lib-sieve/plugins/copy/Makefile.am        |  2 +-
 src/lib-sieve/plugins/date/Makefile.am        |  2 +-
 src/lib-sieve/plugins/enotify/Makefile.am     |  2 +-
 src/lib-sieve/plugins/environment/Makefile.am |  2 +-
 src/lib-sieve/plugins/imap4flags/Makefile.am  |  2 +-
 src/lib-sieve/plugins/include/Makefile.am     |  2 +-
 src/lib-sieve/plugins/mailbox/Makefile.am     |  2 +-
 src/lib-sieve/plugins/notify/Makefile.am      |  3 +--
 src/lib-sieve/plugins/regex/Makefile.am       |  2 +-
 src/lib-sieve/plugins/relational/Makefile.am  |  2 +-
 .../plugins/spamvirustest/Makefile.am         |  2 +-
 src/lib-sieve/plugins/subaddress/Makefile.am  |  2 +-
 src/lib-sieve/plugins/vacation/Makefile.am    |  2 +-
 src/lib-sieve/plugins/variables/Makefile.am   |  2 +-
 src/plugins/lda-sieve/Makefile.am             |  3 ++-
 src/sieve-tools/Makefile.am                   |  3 ++-
 src/sieve-tools/debug/Makefile.am             |  2 +-
 src/testsuite/Makefile.am                     |  3 ++-
 23 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/configure.in b/configure.in
index 0f01ac740..7c91b4310 100644
--- a/configure.in
+++ b/configure.in
@@ -102,26 +102,22 @@ if test $have_dovecot_sources = yes; then
   LIBDOVECOT='$(dovecot_libdir)/src/lib-dovecot/libdovecot.la'
   LIBDOVECOT_STORAGE='$(dovecot_libdir)/src/lib-storage/libdovecot-storage.la'
 
-  SIEVE_DOVECOT_INCLUDE=' \
+  LIBDOVECOT_INCLUDE=' \
     -I$(dovecot_incdir) \
     -I$(dovecot_incdir)/src/lib \
     -I$(dovecot_incdir)/src/lib-mail \
-    -I$(dovecot_incdir)/src/lib-storage'
-
-  SIEVE_LIB_DOVECOT_INCLUDE=${SIEVE_DOVECOT_INCLUDE}' \
+    -I$(dovecot_incdir)/src/lib-storage \
     -I$(dovecot_incdir)/src/lib-imap \
     -I$(dovecot_incdir)/src/lib-master'
 
-  SIEVE_LDA_DOVECOT_INCLUDE=${SIEVE_DOVECOT_INCLUDE}' \
+  LIBDOVECOT_LDA_INCLUDE=' \
     -I$(dovecot_incdir)/src/lib-dict \
     -I$(dovecot_incdir)/src/lib-lda \
     -I$(dovecot_incdir)/src/lda'
 
-  SIEVE_TOOL_DOVECOT_INCLUDE=${SIEVE_DOVECOT_INCLUDE}' \
+  LIBDOVECOT_STORAGE_INCLUDE=' \
     -I$(dovecot_incdir)/src/lib-settings \
-    -I$(dovecot_incdir)/src/lib-imap \
     -I$(dovecot_incdir)/src/lib-index \
-    -I$(dovecot_incdir)/src/lib-master \
     -I$(dovecot_incdir)/src/lib-storage/index \
     -I$(dovecot_incdir)/src/lib-storage/index/raw'
 else
@@ -133,10 +129,9 @@ else
   LIBDOVECOT='$(dovecot_libdir)/libdovecot.la'
   LIBDOVECOT_STORAGE='$(dovecot_libdir)/libdovecot-storage.la'
 
-  SIEVE_DOVECOT_INCLUDE='-I$(dovecot_incdir)'
-  SIEVE_LIB_DOVECOT_INCLUDE=${SIEVE_DOVECOT_INCLUDE}
-  SIEVE_LDA_DOVECOT_INCLUDE=${SIEVE_DOVECOT_INCLUDE}
-  SIEVE_TOOL_DOVECOT_INCLUDE=${SIEVE_DOVECOT_INCLUDE}
+  LIBDOVECOT_INCLUDE='-I$(dovecot_incdir)'
+  LIBDOVECOT_LDA_INCLUDE='-I$(dovecot_incdir)'
+  LIBDOVECOT_STORAGE_INCLUDE='-I$(dovecot_incdir)'
 fi
 
 dovecot_pkglibexecdir='$(libexecdir)/dovecot'
@@ -155,9 +150,9 @@ AC_SUBST(dovecot_docdir)
 
 AC_SUBST(LIBDOVECOT)
 AC_SUBST(LIBDOVECOT_STORAGE)
-AC_SUBST(SIEVE_LDA_DOVECOT_INCLUDE)
-AC_SUBST(SIEVE_LIB_DOVECOT_INCLUDE)
-AC_SUBST(SIEVE_TOOL_DOVECOT_INCLUDE)
+AC_SUBST(LIBDOVECOT_INCLUDE)
+AC_SUBST(LIBDOVECOT_LDA_INCLUDE)
+AC_SUBST(LIBDOVECOT_STORAGE_INCLUDE)
 
 AC_CONFIG_FILES([
 Makefile
diff --git a/src/lib-sieve-tool/Makefile.am b/src/lib-sieve-tool/Makefile.am
index 29ac0cb37..1df28a078 100644
--- a/src/lib-sieve-tool/Makefile.am
+++ b/src/lib-sieve-tool/Makefile.am
@@ -2,7 +2,8 @@ noinst_LTLIBRARIES = libsieve-tool.la
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib-sieve \
-	$(SIEVE_TOOL_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE) \
+	$(LIBDOVECOT_STORAGE_INCLUDE)
 
 libsieve_tool_la_SOURCES = \
 	sieve-tool.c \
diff --git a/src/lib-sieve/Makefile.am b/src/lib-sieve/Makefile.am
index 6ef551aa1..5157c7ce4 100644
--- a/src/lib-sieve/Makefile.am
+++ b/src/lib-sieve/Makefile.am
@@ -3,7 +3,7 @@ SUBDIRS = plugins
 dovecot_pkglib_LTLIBRARIES = libdovecot-sieve.la
 
 AM_CPPFLAGS = \
-	$(SIEVE_LIB_DOVECOT_INCLUDE) \
+	$(LIBDOVECOT_INCLUDE) \
 	-DMODULEDIR=\""$(moduledir)"\"
 
 tests = \
diff --git a/src/lib-sieve/plugins/body/Makefile.am b/src/lib-sieve/plugins/body/Makefile.am
index 1739a0ca5..9074541a6 100644
--- a/src/lib-sieve/plugins/body/Makefile.am
+++ b/src/lib-sieve/plugins/body/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_body.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 tsts = \
 	tst-body.c
diff --git a/src/lib-sieve/plugins/comparator-i-ascii-numeric/Makefile.am b/src/lib-sieve/plugins/comparator-i-ascii-numeric/Makefile.am
index 32510647f..c0b1626a2 100644
--- a/src/lib-sieve/plugins/comparator-i-ascii-numeric/Makefile.am
+++ b/src/lib-sieve/plugins/comparator-i-ascii-numeric/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_comparator-i-ascii-numeric.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 libsieve_ext_comparator_i_ascii_numeric_la_SOURCES = \
 	ext-cmp-i-ascii-numeric.c
diff --git a/src/lib-sieve/plugins/copy/Makefile.am b/src/lib-sieve/plugins/copy/Makefile.am
index 13c4bae68..fb5d11839 100644
--- a/src/lib-sieve/plugins/copy/Makefile.am
+++ b/src/lib-sieve/plugins/copy/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_copy.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 libsieve_ext_copy_la_SOURCES = \
 	ext-copy.c
diff --git a/src/lib-sieve/plugins/date/Makefile.am b/src/lib-sieve/plugins/date/Makefile.am
index c240558e8..5e959a167 100644
--- a/src/lib-sieve/plugins/date/Makefile.am
+++ b/src/lib-sieve/plugins/date/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_date.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 tests = \
 	tst-date.c
diff --git a/src/lib-sieve/plugins/enotify/Makefile.am b/src/lib-sieve/plugins/enotify/Makefile.am
index 23e9857ad..662bf4dc1 100644
--- a/src/lib-sieve/plugins/enotify/Makefile.am
+++ b/src/lib-sieve/plugins/enotify/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libsieve_ext_enotify.la
 AM_CPPFLAGS = \
 	-I../../ \
 	-I../variables \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 commands = \
 	cmd-notify.c
diff --git a/src/lib-sieve/plugins/environment/Makefile.am b/src/lib-sieve/plugins/environment/Makefile.am
index ddb90f313..2dbe522de 100644
--- a/src/lib-sieve/plugins/environment/Makefile.am
+++ b/src/lib-sieve/plugins/environment/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_environment.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 tests = \
 	tst-environment.c
diff --git a/src/lib-sieve/plugins/imap4flags/Makefile.am b/src/lib-sieve/plugins/imap4flags/Makefile.am
index 3debfd022..867ec831f 100644
--- a/src/lib-sieve/plugins/imap4flags/Makefile.am
+++ b/src/lib-sieve/plugins/imap4flags/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libsieve_ext_imap4flags.la
 AM_CPPFLAGS = \
 	-I../../ \
     -I../variables \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 commands = \
 	cmd-flag.c
diff --git a/src/lib-sieve/plugins/include/Makefile.am b/src/lib-sieve/plugins/include/Makefile.am
index 4955115cb..9d0f164e5 100644
--- a/src/lib-sieve/plugins/include/Makefile.am
+++ b/src/lib-sieve/plugins/include/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libsieve_ext_include.la
 AM_CPPFLAGS = \
 	-I../../ \
 	-I../variables \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 cmds = \
 	cmd-include.c \
diff --git a/src/lib-sieve/plugins/mailbox/Makefile.am b/src/lib-sieve/plugins/mailbox/Makefile.am
index b0d1f9ac7..79739dba3 100644
--- a/src/lib-sieve/plugins/mailbox/Makefile.am
+++ b/src/lib-sieve/plugins/mailbox/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_mailbox.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 tags = \
 	tag-mailbox-create.c
diff --git a/src/lib-sieve/plugins/notify/Makefile.am b/src/lib-sieve/plugins/notify/Makefile.am
index 0bde0ed4f..bb343ebf3 100644
--- a/src/lib-sieve/plugins/notify/Makefile.am
+++ b/src/lib-sieve/plugins/notify/Makefile.am
@@ -2,8 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_notify.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	-I../variables \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 commands = \
 	cmd-notify.c \
diff --git a/src/lib-sieve/plugins/regex/Makefile.am b/src/lib-sieve/plugins/regex/Makefile.am
index 13f334b07..9cc7ef16a 100644
--- a/src/lib-sieve/plugins/regex/Makefile.am
+++ b/src/lib-sieve/plugins/regex/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_regex.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 libsieve_ext_regex_la_SOURCES = \
 	mcht-regex.c \
diff --git a/src/lib-sieve/plugins/relational/Makefile.am b/src/lib-sieve/plugins/relational/Makefile.am
index c71837140..59a177009 100644
--- a/src/lib-sieve/plugins/relational/Makefile.am
+++ b/src/lib-sieve/plugins/relational/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_relational.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 libsieve_ext_relational_la_SOURCES = \
 	ext-relational-common.c \
diff --git a/src/lib-sieve/plugins/spamvirustest/Makefile.am b/src/lib-sieve/plugins/spamvirustest/Makefile.am
index 9edb0d3fc..3117517f3 100644
--- a/src/lib-sieve/plugins/spamvirustest/Makefile.am
+++ b/src/lib-sieve/plugins/spamvirustest/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_spamvirustest.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 tests = \
 	tst-spamvirustest.c
diff --git a/src/lib-sieve/plugins/subaddress/Makefile.am b/src/lib-sieve/plugins/subaddress/Makefile.am
index 5f2970237..49fcf718d 100644
--- a/src/lib-sieve/plugins/subaddress/Makefile.am
+++ b/src/lib-sieve/plugins/subaddress/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_subaddress.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 libsieve_ext_subaddress_la_SOURCES = \
 	ext-subaddress.c
diff --git a/src/lib-sieve/plugins/vacation/Makefile.am b/src/lib-sieve/plugins/vacation/Makefile.am
index 95c7cf1d6..40639eff2 100644
--- a/src/lib-sieve/plugins/vacation/Makefile.am
+++ b/src/lib-sieve/plugins/vacation/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_vacation.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 cmds = \
 	cmd-vacation.c
diff --git a/src/lib-sieve/plugins/variables/Makefile.am b/src/lib-sieve/plugins/variables/Makefile.am
index dd0e64e5c..f3d456420 100644
--- a/src/lib-sieve/plugins/variables/Makefile.am
+++ b/src/lib-sieve/plugins/variables/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_variables.la
 
 AM_CPPFLAGS = \
 	-I../../ \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 cmds = \
 	cmd-set.c
diff --git a/src/plugins/lda-sieve/Makefile.am b/src/plugins/lda-sieve/Makefile.am
index 9009ddd76..fb5940b7e 100644
--- a/src/plugins/lda-sieve/Makefile.am
+++ b/src/plugins/lda-sieve/Makefile.am
@@ -1,6 +1,7 @@
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib-sieve \
-	$(SIEVE_LDA_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE) \
+	$(LIBDOVECOT_LDA_INCLUDE)
 
 lib90_sieve_plugin_la_LDFLAGS = -module -avoid-version
 
diff --git a/src/sieve-tools/Makefile.am b/src/sieve-tools/Makefile.am
index 3b2e674f8..7a046e722 100644
--- a/src/sieve-tools/Makefile.am
+++ b/src/sieve-tools/Makefile.am
@@ -10,7 +10,8 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib-sieve \
 	-I$(top_srcdir)/src/lib-sieve-tool \
 	-I./debug \
-	$(SIEVE_TOOL_DOVECOT_INCLUDE) 
+	$(LIBDOVECOT_INCLUDE) \
+	$(LIBDOVECOT_STORAGE_INCLUDE)
 
 libs = \
 	$(top_srcdir)/src/lib-sieve/libdovecot-sieve.la \
diff --git a/src/sieve-tools/debug/Makefile.am b/src/sieve-tools/debug/Makefile.am
index e621b9919..3d1014acb 100644
--- a/src/sieve-tools/debug/Makefile.am
+++ b/src/sieve-tools/debug/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libsieve_ext_debug.la
 
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib-sieve \
-	$(SIEVE_LIB_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE)
 
 commands = \
 	cmd-debug-print.c
diff --git a/src/testsuite/Makefile.am b/src/testsuite/Makefile.am
index e69e6dbbf..e1f9ebd09 100644
--- a/src/testsuite/Makefile.am
+++ b/src/testsuite/Makefile.am
@@ -3,7 +3,8 @@ noinst_PROGRAMS = testsuite
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/src/lib-sieve \
 	-I$(top_srcdir)/src/lib-sieve-tool \
-	$(SIEVE_TOOL_DOVECOT_INCLUDE)
+	$(LIBDOVECOT_INCLUDE) \
+	$(LIBDOVECOT_STORAGE_INCLUDE)
 
 testsuite_LDFLAGS = -export-dynamic
 
-- 
GitLab