1diff --git a/libmalcontent/tests/meson.build b/libmalcontent/tests/meson.build
2index 610bc35..13e0713 100644
3--- a/libmalcontent/tests/meson.build
4+++ b/libmalcontent/tests/meson.build
5@@ -72,9 +72,9 @@ test_programs = [
6 ], deps],
7 ]
8
9-installed_tests_metadir = join_paths(datadir, 'installed-tests',
10+installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests',
11 'libmalcontent-' + libmalcontent_api_version)
12-installed_tests_execdir = join_paths(libexecdir, 'installed-tests',
13+installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests',
14 'libmalcontent-' + libmalcontent_api_version)
15
16 foreach program: test_programs
17@@ -105,4 +105,4 @@ foreach program: test_programs
18 env: envs,
19 args: ['--tap'],
20 )
21-endforeach
22\ No newline at end of file
23+endforeach
24diff --git a/meson_options.txt b/meson_options.txt
25index d516c70..583cb94 100644
26--- a/meson_options.txt
27+++ b/meson_options.txt
28@@ -4,6 +4,12 @@ option(
29 value: false,
30 description: 'enable installed tests'
31 )
32+option(
33+ 'installed_test_prefix',
34+ type: 'string',
35+ value: '',
36+ description: 'Prefix for installed tests'
37+)
38 option(
39 'pamlibdir',
40 type: 'string',
41diff --git a/pam/tests/meson.build b/pam/tests/meson.build
42index 0560dcb..a74dab2 100644
43--- a/pam/tests/meson.build
44+++ b/pam/tests/meson.build
45@@ -12,9 +12,9 @@ test_programs = [
46 ['pam_malcontent', [], deps],
47 ]
48
49-installed_tests_metadir = join_paths(datadir, 'installed-tests',
50+installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests',
51 'libmalcontent-' + libmalcontent_api_version)
52-installed_tests_execdir = join_paths(libexecdir, 'installed-tests',
53+installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests',
54 'libmalcontent-' + libmalcontent_api_version)
55
56 foreach program: test_programs