 meson.build       | 6 ++++++
 meson_options.txt | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/meson.build b/meson.build
index 842d5f5b5..1daa3b067 100644
--- a/meson.build
+++ b/meson.build
@@ -484,6 +484,11 @@ if systemd_dep.found() and systemduserunitdir == ''
   systemduserunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir')
 endif

+libelogind_dep = dependency('libelogind', required : get_option('elogind'))
+if libelogind_dep.found()
+  cdata.set('HAVE_SYSTEMD_LOGIN', 1)
+endif
+
 x11_dep = dependency('x11-xcb', required : get_option('x11'))
 if x11_dep.found()
   xcb_dep  = dependency('xcb',  required : true, version : '>= 1.6')
@@ -701,6 +706,7 @@ summary = [
   'Enable udev:                   @0@'.format(udev_dep.found()),
   '  Enable HAL->udev compat:     @0@'.format(get_option('hal-compat')),
   'Enable systemd:                @0@'.format(libsystemd_dep.found()),
+  'Enable elogind:                @0@'.format(libelogind_dep.found()),
 #  'Enable TCP Wrappers:           @0@'.format(${ENABLE_TCPWRAP}),
   'Enable libsamplerate:          @0@'.format(samplerate_dep.found()),
   'Enable IPv6:                   @0@'.format(get_option('ipv6')),
diff --git a/meson_options.txt b/meson_options.txt
index e54caf5cf..5fbb513c0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -126,6 +126,9 @@ option('udev',
 option('x11',
        type : 'feature', value : 'auto',
        description : 'Optional X11 support')
+option('elogind',
+       type : 'feature', value : 'auto',
+       description : 'Optional elogind support')

 # Echo cancellation

