1diff --git a/gdata/tests/meson.build b/gdata/tests/meson.build
2index 05184deb..3a9392d4 100644
3--- a/gdata/tests/meson.build
4+++ b/gdata/tests/meson.build
5@@ -1,5 +1,12 @@
6-tests_execdir = gdata_libexecdir / 'installed-tests' / gdata_name
7-tests_metadir = gdata_datadir / 'installed-tests' / gdata_name
8+tests_bindir = get_option('installed_test_bindir') / 'installed-tests' / gdata_name
9+if tests_bindir == ''
10+ test_bindir = gdata_libexecdir / 'installed-tests' / gdata_name
11+endif
12+
13+tests_datadir = get_option('installed_test_datadir') / 'installed-tests' / gdata_name
14+if tests_datadir == ''
15+ tests_datadir = gdata_datadir / 'installed-tests' / gdata_name
16+endif
17
18 tests_sources = files(
19 'common.c',
20@@ -49,7 +56,7 @@ foreach test_name, extra_args: tests
21 dependencies: common_deps + extra_args.get('dependencies', []),
22 sources: tests_sources,
23 install: install_tests and not should_fail,
24- install_dir: tests_execdir,
25+ install_dir: tests_bindir,
26 )
27
28 test(
29@@ -65,7 +72,7 @@ if install_tests
30 should_fail = extra_args.get('should_fail', false)
31 tests_conf = {
32 'TEST_TYPE': 'session',
33- 'TEST_ABS_PATH': gdata_prefix / tests_execdir / test_name,
34+ 'TEST_ABS_PATH': tests_bindir / test_name,
35 }
36
37 configure_file (
38@@ -73,13 +80,13 @@ if install_tests
39 output: test_name + '.test',
40 configuration: tests_conf,
41 install: not should_fail,
42- install_dir: tests_metadir,
43+ install_dir: tests_datadir,
44 )
45 endforeach
46
47 install_subdir(
48 'traces',
49- install_dir: tests_execdir,
50+ install_dir: tests_bindir,
51 )
52
53 test_data = [
54@@ -98,6 +105,6 @@ if install_tests
55
56 install_data(
57 test_data,
58- install_dir: tests_execdir,
59+ install_dir: tests_bindir,
60 )
61 endif
62diff --git a/meson.build b/meson.build
63index 50441abb..5fc773b1 100644
64--- a/meson.build
65+++ b/meson.build
66@@ -20,9 +20,9 @@ gdata_api_version_minor = 0
67
68 # Define the install directories
69 gdata_prefix = get_option('prefix')
70-gdata_datadir = get_option('datadir')
71-gdata_libexecdir = get_option('libexecdir')
72-gdata_includedir = get_option('includedir')
73+gdata_datadir = gdata_prefix / get_option('datadir')
74+gdata_libexecdir = gdata_prefix / get_option('libexecdir')
75+gdata_includedir = gdata_prefix / get_option('includedir')
76
77 gdata_include_subdir = gdata_name / 'gdata'
78
79diff --git a/meson_options.txt b/meson_options.txt
80index 25cc6b55..6fc2cfa3 100644
81--- a/meson_options.txt
82+++ b/meson_options.txt
83@@ -43,3 +43,11 @@ option('vapi',
84 type: 'boolean',
85 value: true,
86 description: 'Enable creation of vapi files')
87+
88+option('installed_test_datadir', type: 'string',
89+ value: '',
90+ description: 'Installation directory for data files in tests')
91+
92+option('installed_test_bindir', type: 'string',
93+ value: '',
94+ description: 'Installation directory for binary files in tests')