hostname: refactor, cleanup and test coverage

This is a largish patch that contains multiple changes to the hostname
module.  The intentions of this patch are:

  * port new functionality from PE, which is essentially custom-domain()
  * make the code easier to follow and define clear semantics of all
    functions and test it via a unit test program
  * add the foundations of a custom-domain() option that can be used to
    override the local domain name
  * introduction of global_init/deinit function pairs
  * add two new functions that convert a hostname from fqdn to short and
    vice versa

Although it'd be better to split this patch along these lines, however
splitting it up is not really easy because of the internal dependencies, and
that the original was written as a single iteration. Essentially internal
steps would need to be rewritten from scratch.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
host-resolve: use hostname provided functions instead of global variables directly

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
cfg: implement custom-domain() setting

The custom-domain() global option allows the administrator to override the
local domain name used by syslog-ng.  It affects all locally generated
messages.

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
host-resolve: factor out normalize_hostname()

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
host-resolve: introduce HostResolveOptions

This patch adds HostResolveOptions to contain all resolver related
configuration options.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
stomp: rearrange headers to match syslog-ng conventions

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
host-resolve: reindent error messages

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
host-resolve: only declare resolve_lock if needed

This patch avoids the declaration of resolv_lock if not needed.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
mainloop: factor out the query of the number of processors into a separate function

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
compat: Move into a subdirectory

In preparation for splitting up compat.c, move it and the header to a
subdirectory.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
lib/compat/: Split compat.c into smaller files

Instead of having one monolithic file for all compat functions, separate
them by topic (by function, except in case of pread/pwrite).

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
gprocess: introduce g_process_get_mode() to query the current execution mode

Signed-off-by: Viktor Juhasz <jviktor@balabit.hu>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
.travis.yml: Update for the new branch structure

Update the Travis-CI control file for the new branch structure.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>