Move examples to doc/examples and include them in DIST

Change-Id: I0846e21ac63774939934ab629c6d7212269be9a6
diff --git a/configure.ac b/configure.ac
index e6b84fa..2b9343d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -141,6 +141,7 @@
 
 AC_CONFIG_FILES([Makefile
                  doc/Makefile
+                 doc/examples/Makefile
                  ggsn/Makefile
                  gtp/Makefile
                  lib/Makefile
diff --git a/examples/osmo-ggsn.init b/contrib/osmo-ggsn.init
similarity index 100%
rename from examples/osmo-ggsn.init
rename to contrib/osmo-ggsn.init
diff --git a/debian/osmo-ggsn.examples b/debian/osmo-ggsn.examples
index 3898d26..775b9cd 100644
--- a/debian/osmo-ggsn.examples
+++ b/debian/osmo-ggsn.examples
@@ -1,2 +1,2 @@
-examples/osmo-ggsn.conf
-examples/sgsnemu.conf
+doc/examples/osmo-ggsn.conf
+doc/examples/sgsnemu.conf
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 7e2246c..46c634e 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -2,5 +2,6 @@
 man_aux = $(man_MANS:.1=.x)
 EXTRA_DIST = $(man_MANS)
 
-
-
+SUBDIRS = \
+	examples \
+	$(NULL)
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
new file mode 100644
index 0000000..530c3fa
--- /dev/null
+++ b/doc/examples/Makefile.am
@@ -0,0 +1,22 @@
+CFG_FILES = find $(srcdir) -name '*.cfg*' | sed -e 's,^$(srcdir),,'
+
+dist-hook:
+	for f in $$($(CFG_FILES)); do \
+		j="$(distdir)/$$f" && \
+		mkdir -p "$$(dirname $$j)" && \
+		$(INSTALL_DATA) $(srcdir)/$$f $$j; \
+	done
+
+install-data-hook:
+	for f in $$($(CFG_FILES)); do \
+		j="$(DESTDIR)$(docdir)/examples/$$f" && \
+		mkdir -p "$$(dirname $$j)" && \
+		$(INSTALL_DATA) $(srcdir)/$$f $$j; \
+	done
+
+uninstall-hook:
+	@$(PRE_UNINSTALL)
+	for f in $$($(CFG_FILES)); do \
+		j="$(DESTDIR)$(docdir)/examples/$$f" && \
+		$(RM) $$j; \
+	done
diff --git a/examples/firewall b/doc/examples/firewall
similarity index 100%
rename from examples/firewall
rename to doc/examples/firewall
diff --git a/examples/osmo-ggsn.cfg b/doc/examples/osmo-ggsn.cfg
similarity index 100%
rename from examples/osmo-ggsn.cfg
rename to doc/examples/osmo-ggsn.cfg
diff --git a/examples/sgsnemu.conf b/doc/examples/sgsnemu.conf
similarity index 100%
rename from examples/sgsnemu.conf
rename to doc/examples/sgsnemu.conf