[syslog-ng-dev] create new package: syslog-ng-dev

this package contains everything which is required to write own module

diff --git a/Makefile.am b/Makefile.am
index ded1655..47c80d0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,9 +1,12 @@
-SUBDIRS = lib modules syslog-ng scripts tests doc contrib scl debian tgz2build
+SUBDIRS = lib modules syslog-ng scripts tests doc contrib scl debian tgz2build build
 
 ACLOCAL_AMFLAGS = -I m4 --install
 
 EXTRA_DIST = VERSION \
-	syslog-ng.spec syslog-ng.spec.in dist.conf dist.conf.in ChangeLog
+	syslog-ng.spec syslog-ng.spec.in dist.conf dist.conf.in ChangeLog syslog-ng.pc.in
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = syslog-ng.pc
 
 .PHONY: ChangeLog
 
diff --git a/build/Makefile.am b/build/Makefile.am
new file mode 100644
index 0000000..0ee1905
--- /dev/null
+++ b/build/Makefile.am
@@ -0,0 +1,5 @@
+
+EXTRA_DIST = lex-rules.am
+
+toolsdir = $(datadir)/tools
+tools_DATA = lex-rules.am ../lib/cfg-grammar.y ../lib/merge-grammar.pl
diff --git a/configure.in b/configure.in
index 39d2dc2..142162e 100644
--- a/configure.in
+++ b/configure.in
@@ -862,6 +862,8 @@ AC_SUBST(PACKAGE_SUFFIX)
 AC_OUTPUT(dist.conf
           Makefile 
 	  syslog-ng.spec
+    syslog-ng.pc
+    build/Makefile
 	  lib/Makefile 
 	  syslog-ng/Makefile 
 	  modules/Makefile 
diff --git a/debian/control b/debian/control
index a6e9c75..958498d 100644
--- a/debian/control
+++ b/debian/control
@@ -17,3 +17,14 @@ Description: Next generation logging daemon
    * filtering based on message content
    * portability
    * better network forwarding
+
+Package: syslog-ng-dev
+Architecture: any
+Depends: syslog-ng
+Section: libdevel
+Description: Next generation logging daemon dev package
+ Syslog-ng tries to fill the gaps original syslogd's were lacking:
+   * powerful configurability
+   * filtering based on message content
+   * portability
+   * better network forwarding
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d84741e..24cc4de 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,6 +9,16 @@ lib_LTLIBRARIES = libsyslog-ng.la
 libsyslog_ng_la_LIBADD = @CORE_DEPS_LIBS@
 libsyslog_ng_la_LDFLAGS = -no-undefined
 
+pkginclude_HEADERS = afinter.h center.h compat.h filter-expr-parser.h logmatcher.h \
+  logprocess.h logsource.h memtrace.h parser-expr-parser.h   serialize.h     syslog-ng.h \
+  alarms.h cfg.h control.h filter.h logmpx.h logproto.h logstamp.h messages.h persist-state.h \
+  sgroup.h tags.h apphook.h cfg-lexer.h dgroup.h gprocess.h logmsg.h logqueue.h logtransport.h \
+  misc.h plugin.h stats.h templates.h atomic.h cfg-parser.h dnscache.h gsockaddr.h logparser.h \
+  logreader.h logwriter.h msg-format.h pragma-parser.h str-format.h timeutils.h \
+  block-ref-parser.h children.h driver.h gsocket.h logpipe.h \
+  logrewrite.h mainloop.h nvtable.h rewrite-expr-parser.h \
+  syslog-names.h utils.h cfg-grammar.h cfg-lex.h
+
 libsyslog_ng_la_SOURCES = \
 	misc.c misc.h utils.c utils.h messages.c messages.h syslog-names.c syslog-names.h \
 	mainloop.c mainloop.h \
@@ -59,7 +69,7 @@ BUILT_SOURCES = cfg-lex.c cfg-lex.h cfg-grammar.c cfg-grammar.h \
 
 EXTRA_DIST = $(BUILT_SOURCES) \
 	filter-expr-grammar.ym block-ref-grammar.ym pragma-grammar.ym parser-expr-grammar.ym rewrite-expr-grammar.ym \
-	syslog-ng.h
+	syslog-ng.h merge-grammar.pl
 
 CLEAN_FILES = $(BUILT_SOURCES)
 
diff --git a/lib/merge-grammar.pl b/lib/merge-grammar.pl
index ab58cd8..305730d 100755
--- a/lib/merge-grammar.pl
+++ b/lib/merge-grammar.pl
@@ -14,8 +14,9 @@
 sub include_block
 {
     my ($start_re, $end_re) = @_;
+    $z = $ENV{'top_srcdir'}. "/lib/cfg-grammar.y";
 
-    open(GR, "<" .$ENV{'top_srcdir'}. "/lib/cfg-grammar.y") || die "Error opening cfg-grammar.y";
+    open(GR, "<" .$z) || die "Error opening cfg-grammar.y: ".$z;
 
     my $decl_started = 0;
     while (<GR>) {
@@ -43,4 +44,4 @@ while (<>) {
     else {
         print;
     }
-}
\ No newline at end of file
+}
diff --git a/syslog-ng.pc.in b/syslog-ng.pc.in
new file mode 100644
index 0000000..0df6e64
--- /dev/null
+++ b/syslog-ng.pc.in
@@ -0,0 +1,13 @@
+# Package Information for pkg-config
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+toolsdir=@datadir@/tools
+
+Name: syslog-ng-dev
+Description: Dev package for syslog-ng module
+Version: @VERSION@
+Requires: glib-2.0
+Libs: -L${libdir} @GLIB_LIBS@
+Cflags: -I${includedir}/syslog-ng
diff --git a/tgz2build/Makefile.am b/tgz2build/Makefile.am
index 25ba638..8cc7b4b 100644
--- a/tgz2build/Makefile.am
+++ b/tgz2build/Makefile.am
@@ -1,2 +1,2 @@
 
-EXTRA_DIST = syslog-ng.files rules  tgz2deps
+EXTRA_DIST = syslog-ng.files syslog-ng-dev.files rules rules.conf tgz2deps
diff --git a/tgz2build/rules b/tgz2build/rules
index ce8ce87..7a34acb 100644
--- a/tgz2build/rules
+++ b/tgz2build/rules
@@ -1,4 +1,6 @@
 #!/usr/bin/make -f
+include tgz2build/rules.conf
+
 STAMPDIR=tgz2build/stamps
 DOCDIR=$(PREFIX)/doc
 
diff --git a/tgz2build/rules.conf b/tgz2build/rules.conf
new file mode 100644
index 0000000..37e8908
--- /dev/null
+++ b/tgz2build/rules.conf
@@ -0,0 +1,2 @@
+LIBPKGNAME=syslog-ng
+DEVPKGNAME=syslog-ng-dev
diff --git a/tgz2build/syslog-ng-dev.files b/tgz2build/syslog-ng-dev.files
new file mode 100644
index 0000000..bca3f44
--- /dev/null
+++ b/tgz2build/syslog-ng-dev.files
@@ -0,0 +1,5 @@
+opt/syslog-ng/include/*
+opt/syslog-ng/lib/pkgconfig/*
+opt/syslog-ng/lib/*.a
+opt/syslog-ng/lib/*.la
+opt/syslog-ng/lib/*.so*
