--- a/meson.build	2021-06-07 19:13:34.690747549 +0800
+++ b/meson.build	2021-06-07 19:24:15.893313832 +0800
@@ -75,7 +75,7 @@
 polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.91')
 dbus_dep = dependency('dbus-1', required: false)
 dbus_glib_dep = dependency('dbus-glib-1')
-libsystemd_dep = dependency('libsystemd', required: get_option('pam'))
+libsystemd_dep = dependency(get_option('libsystemd'), required: get_option('pam'))
 pam_dep = cc.find_library('pam',
     required: get_option('pam'),
     has_headers: 'security/pam_modules.h',
@@ -116,7 +116,7 @@
 polkit_policy_directory = polkit_gobject_dep.get_pkgconfig_variable('policydir')
 
 # Tests dependencies
-pam_wrapper_dep = dependency('pam_wrapper', required: get_option('pam'))
+pam_wrapper_dep = dependency('pam_wrapper', required: get_option('pam') and get_option('test').enabled() )
 
 xmllint = find_program('xmllint', required: false)
 python3 = find_program('python3') # No meson without it!
@@ -129,11 +129,13 @@
 }
 python3_available_modules = []
 
+if get_option('test').enabled()
 foreach module, required : python3_test_modules
     if required and run_command(python3, '-c', 'import @0@'.format(module)).returncode() != 0
         error('Python3 module \'' + module + '\' required by test suite not found')
     endif
 endforeach
+endif
 
 cdata = configuration_data()
 cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
@@ -156,7 +158,9 @@
 if get_option('gtk_doc')
     subdir('doc')
 endif
-subdir('tests')
+if get_option('test').enabled()
+    subdir('tests')
+endif
 subdir('po')
 
 output = []
@@ -178,5 +182,8 @@
 output += '  Manuals: ' + get_option('man').to_string()
 output += '  GTK Doc: ' + get_option('gtk_doc').to_string()
 output += '  XML Linter ' + xmllint.found().to_string()
-
+if get_option('test').enabled()
+    output += '\nTest setup:\n'
+    output += '  With test enabled.'
+endif
 message('\n'+'\n'.join(output)+'\n')
