kmscon: add --session-max parameter

This parameter allows to limit the maximum number of sessions to a sane
limit. Otherwise, a user could DOS a systemd by opening as many session as
they want.
This can be set to 0 to drop that limit, however, this is not recommended.
Instead, if you want an ability to add more sessions than that limit, you
should implement a flag to register_session() that overwrites the limit.
This can then be used by a safe way to register new sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon: reorganize configuration items

This just rearranges all options so they are logically grouped and in the
same order at all places. It also changes the internal variable for
"--fbdev" from "use_fbdev" to "fbdev" so all variables have the same name
as the option-names.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
conf: introduce conf_parse_file_f()

This new helper allows easily parsing arbitrary filenames. It does the
same as conf_parse_file() but allows giving filenames in printf format.

The other parsers are slightly adjusted so they can be more easily reused
by other projects.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon: drop all configs and use new /etc/kmscon/kmscon.conf

This drops all config-file support except for the new
/etc/kmscon/kmscon.conf. For backwards-compatibility, we still parse
/etc/kmscon.conf but this will be removed soon.

We want to add one kmscon-config for each seat so you can have different
configurations per seat. These will all be put into /etc/kmscon/ so we
need this directory.

We also drop ~/.kmscon.conf. This was never really useful as kmscon is a
system daemon and should not be used with user-configuration files.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon: add helpers to access kmscon_conf

We are about to introduce per-seat-configuration so we need some helper
macros that will later select the right configuration that we read from.

These helpers simply hook into the kmscon-config and return the correct
value.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon: make configuration-parser modular

This allows changing the backing-memory of a kmscon-config object. This
way, we can parse the same options into a per-seat config object.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
uterm: video: drm: do not set EGL_DISPLAY

EGL_DISPLAY is a no-op and we probably want to set EGL_PLATFORM. However,
it doesn't make any sense to set it, because EGL should be able to
properly detect the platform.
If this doesn't work on your machine, you should really try fixing your
environment before forcing this. If there are corner cases where this
doesn't work, you should file a bug against mesa.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon: implement per-seat configuration

Sorry for the huge commit, but this reworks the whole configuration
handler. We now provide conf_ctx contexts which contain a pointer to the
backing storage and the config-options that are used.

It is also possible to copy config-options now. So we can use the
main-config as default value for seat-configurations.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
conf: fix overwriting locked options during copy

If we copy entries into another context, we must not overwrite locked
entries. Furthermore, if we copy a locked entry, we must also copy that
lock.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
conf: add option-copy callback

We allow options to specify "aftercheck" callbacks but do not call them
during a copy. Therefore, we need a way to copy side-effects. As we cannot
do that generically, we now allow each option to specify such a callback.

We use it for the "all_seats" and "argv" parameters in kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon: use local configs instead of global kmscon_conf

We now have the ability to pass on local configurations so we no longer
need the global kmscon_conf.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
build: add proper dependency checking to configure.ac

We build several tools inside of this repository and we need to make sure
all dependencies are met. Furthermore, we must make sure that default
values are recognized even on dependencies.
Hence, this reworks the whole configure.ac handling and does some renaming
of the constants that are used all over the source.

We need to test this some more weeks, but it should finally be a proper
autotools handling that we can release with kmscon-6.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Merge branch 'github/master'

Merge upstream development into the config-rework.
conf: add "file" callback

The "file" callback is used to parse configuration files. If it is not
given, the string is parsed via "parse".

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
conf: call aftercheck after config-file parsing is done

We need to call afterchecks after any parsing we do. To signal that there
are no extra-arguments, we pass argv==NULL.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
conf: simplify helper macros

Instead of using "NULL, NULL, NULL, " in every macro, we now provide a
*_FULL variant which allows setting these. All other macros simply set
these to NULL by default.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
build: fix typo in wlterm dependency checking

This is just two small typos/copy-paste-errors that didn't get checked
earlier.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
shl: misc: add shl_dup_array_size() helper

This is the same as shl_dup_array() but the source might not be NULL
terminated so it takes a "size" argument.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
seat: fix closing dummy sessions

We must reset the "dummy" pointer when unregistering dummy sessions,
otherwise, we will get NULL pointer derefs.
This also prevents keyboard-input from closing dummy sessions.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
kmscon: simplify --vt handling

We can reuse all the conf_string.* functions and do not have to implement
them ourself.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>