aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/interpreter.py4
-rw-r--r--test cases/common/16 configure file/config4a.h.in2
-rw-r--r--test cases/common/16 configure file/config4b.h.in2
-rw-r--r--test cases/common/16 configure file/meson.build12
-rw-r--r--test cases/common/16 configure file/prog4.c6
5 files changed, 26 insertions, 0 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 454ee66..39d596f 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2344,6 +2344,10 @@ class Interpreter(InterpreterBase):
output = kwargs['output']
if not isinstance(output, str):
raise InterpreterException('Output file name must be a string')
+ if ifile_abs:
+ values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
+ outputs = mesonlib.substitute_values([output], values)
+ output = outputs[0]
if os.path.split(output)[0] != '':
raise InterpreterException('Output file name must not contain a subdirectory.')
(ofile_path, ofile_fname) = os.path.split(os.path.join(self.subdir, output))
diff --git a/test cases/common/16 configure file/config4a.h.in b/test cases/common/16 configure file/config4a.h.in
new file mode 100644
index 0000000..aafd195
--- /dev/null
+++ b/test cases/common/16 configure file/config4a.h.in
@@ -0,0 +1,2 @@
+/* Dummy file */
+#define RESULTA @ZERO@
diff --git a/test cases/common/16 configure file/config4b.h.in b/test cases/common/16 configure file/config4b.h.in
new file mode 100644
index 0000000..3408bab
--- /dev/null
+++ b/test cases/common/16 configure file/config4b.h.in
@@ -0,0 +1,2 @@
+/* Dummy file */
+#define RESULTB @ZERO@
diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build
index 8ffc28c..0d0e461 100644
--- a/test cases/common/16 configure file/meson.build
+++ b/test cases/common/16 configure file/meson.build
@@ -74,3 +74,15 @@ configure_file(output : 'config3.h',
configuration : dump)
test('Configless.', executable('dumpprog', 'dumpprog.c'))
+
+
+# Config file generation in a loop with @BASENAME@ substitution
+dump = configuration_data()
+dump.set('ZERO', 0)
+config_templates = files(['config4a.h.in', 'config4b.h.in'])
+foreach config_template : config_templates
+ configure_file(input : config_template, output : '@BASENAME@',
+ configuration : dump)
+endforeach
+
+test('Substituted', executable('prog4', 'prog4.c'))
diff --git a/test cases/common/16 configure file/prog4.c b/test cases/common/16 configure file/prog4.c
new file mode 100644
index 0000000..92dc7cb
--- /dev/null
+++ b/test cases/common/16 configure file/prog4.c
@@ -0,0 +1,6 @@
+#include <config4a.h>
+#include <config4b.h>
+
+int main(int argc, char **argv) {
+ return RESULTA + RESULTB;
+}