>From 75c2a975fe1f9cf6ee6edef83c028c0df3db7fa2 Mon Sep 17 00:00:00 2001
From: Patrick Ohly <patrick.ohly@intel.com>
Date: Tue, 23 Jul 2013 13:22:01 +0200
Subject: [PATCH 2/2] autotools: fix out-of-tree compilation

Compiling with builddir != srcdir failed because
a) glib-mkenums did not find its input files when called
   outside of the srcdir.
b) The C files using the header files did not find them
   in the builddir, because they relied on include with double
   quotes.

Fixed with explicit $(srcdir) and -I.
---
 src/common/Makefile.am |    5 +++--
 src/daemon/Makefile.am |    8 ++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 46e1668..367539b 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -13,14 +13,14 @@ BUILT_SOURCES = \
 GSIGNOND_INCLUDE_DIR=$(top_srcdir)/include/gsignond
 
 gsignond-plugin-enum-types.h: gsignond-enum.h.template $(GSIGNOND_INCLUDE_DIR)/gsignond-plugin-interface.h
-	$(GLIB_MKENUMS) --template gsignond-enum.h.template \
+	$(GLIB_MKENUMS) --template $(srcdir)/gsignond-enum.h.template \
                     --fhead "#ifndef GSIGNOND_PLUGIN_ENUM_TYPES_H_\n#define GSIGNOND_PLUGIND_ENUM_TYPES_H_\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS" \
                     --identifier-prefix gsignond \
                     --ftail "\nG_END_DECLS\n\n#endif\n" \
                     $(GSIGNOND_INCLUDE_DIR)/gsignond-plugin-interface.h > $@
 
 gsignond-plugin-enum-types.c: gsignond-enum.c.template $(GSIGNOND_INCLUDE_DIR)/gsignond-plugin-interface.h
-	$(GLIB_MKENUMS) --template gsignond-enum.c.template \
+	$(GLIB_MKENUMS) --template $(srcdir)/gsignond-enum.c.template \
                     --fhead "#include \"gsignond-plugin-enum-types.h\"\n" \
                     --identifier-prefix gsignond \
                     $(GSIGNOND_INCLUDE_DIR)/gsignond-plugin-interface.h > $@
@@ -30,6 +30,7 @@ libgsignond_common_la_CPPFLAGS = \
     -I$(top_builddir) \
     -I$(top_srcdir)/src \
     -I$(top_srcdir)/include \
+    -I. \
     $(GSIGNOND_CFLAGS) \
     -DGSIGNOND_PLUGINS_DIR='"$(pluginsdir)"' \
     -DGSIGNOND_EXTENSIONS_DIR='"$(extensionsdir)"' \
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index af61924..e34ed20 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -13,13 +13,13 @@ gsignond-identity-enum-types.h: $(top_srcdir)/src/common/gsignond-enum.h.templat
                     --fhead "#ifndef GSIGNOND_IDENTITY_ENUM_TYPES_H_\n#define GSIGNOND_IDENTITY_ENUM_TYPES_H_\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS" \
                     --identifier-prefix gsignond \
                     --ftail "\nG_END_DECLS\n\n#endif\n" \
-                    gsignond-identity.h > $@
+                    $(srcdir)/gsignond-identity.h > $@
 
 gsignond-identity-enum-types.c: $(top_srcdir)/src/common/gsignond-enum.c.template gsignond-identity.h
 	$(GLIB_MKENUMS) --template $(top_srcdir)/src/common/gsignond-enum.c.template \
                     --fhead "#include \"gsignond-identity-enum-types.h\"\n" \
                     --identifier-prefix gsignond \
-                    gsignond-identity.h > $@
+                    $(srcdir)/gsignond-identity.h > $@
 
 gsignond_includedir = $(includedir)/gsignond
 gsignond_pubhdr = ../../include/gsignond
@@ -58,6 +58,10 @@ gsignond_SOURCES = \
     $(BUILT_SOURCES) \
     $(NULL)
 
+gsignond_CPPFLAGS = \
+    -I. \
+    $(NULL)
+
 gsignond_CFLAGS = \
     -I$(top_builddir) \
     -I$(top_srcdir)/include/ \
-- 
1.7.10.4

