[Intel-gfx] [PATCH i-g-t 3/3] meson: share the configuration_data object

Daniel Vetter daniel.vetter at ffwll.ch
Fri Sep 8 15:14:48 UTC 2017


Suggested by Jani. And rename from config_h to plain config, to make
it's multi-use character a bit more obvious.

Cc: Jani Nikula <jani.nikula at intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>
---
 man/meson.build |  8 +-------
 meson.build     | 32 +++++++++++++++++---------------
 2 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/man/meson.build b/man/meson.build
index 4f9f88e87540..351d025b0152 100644
--- a/man/meson.build
+++ b/man/meson.build
@@ -18,15 +18,9 @@ manpages = [
 	'intel_vbt_decode',
 ]
 
-man_config = configuration_data()
-
-man_config.set('PACKAGE_NAME', meson.project_name())
-man_config.set('PACKAGE_VERSION', meson.project_version())
-man_config.set('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
-
 defs_rst = configure_file(input : 'defs.rst.in',
 		output : 'defs.rst',
-		configuration : man_config)
+		configuration : config)
 
 rst2man = find_program('rst2man', required : false)
 rst2man_script = find_program('rst2man.sh')
diff --git a/meson.build b/meson.build
index 4dc0645bac47..a1a104396fb1 100644
--- a/meson.build
+++ b/meson.build
@@ -30,7 +30,7 @@ inc = include_directories('lib', '.')
 
 inc_for_gtkdoc = include_directories('lib')
 
-config_h = configuration_data()
+config = configuration_data()
 
 libdrm = dependency('libdrm', version : '>=2.4.82')
 libdrm_intel = dependency('libdrm_intel', required : false)
@@ -42,24 +42,24 @@ pciaccess = dependency('pciaccess', version : '>=0.10')
 libkmod = dependency('libkmod')
 libprocps = dependency('libprocps', required : false)
 if libprocps.found()
-	config_h.set('HAVE_PROCPS', 1)
+	config.set('HAVE_PROCPS', 1)
 endif
 
 valgrind = dependency('valgrind', required : false)
 if valgrind.found()
-	config_h.set('HAVE_VALGRIND', 1)
+	config.set('HAVE_VALGRIND', 1)
 endif
 
 cairo = dependency('cairo', version : '>1.12.0', required : false)
 
 libudev = dependency('libudev', required : false)
 if libudev.found()
-	config_h.set('HAVE_UDEV', 1)
+	config.set('HAVE_UDEV', 1)
 endif
 
 glib = dependency('glib-2.0', required : false)
 if glib.found()
-	config_h.set('HAVE_GLIB', 1)
+	config.set('HAVE_GLIB', 1)
 endif
 
 libunwind = dependency('libunwind')
@@ -85,35 +85,37 @@ dlsym = cc.find_library('dl')
 zlib = cc.find_library('z')
 
 if cc.has_header('linux/kd.h')
-	config_h.set('HAVE_LINUX_KD_H', 1)
+	config.set('HAVE_LINUX_KD_H', 1)
 endif
 if cc.has_header('sys/kd.h')
-	config_h.set('HAVE_SYS_KD_H', 1)
+	config.set('HAVE_SYS_KD_H', 1)
 endif
 if cc.has_header('libgen.h')
-	config_h.set('HAVE_LIBGEN_H', 1)
+	config.set('HAVE_LIBGEN_H', 1)
 endif
 if cc.has_header('sys/io.h')
-	config_h.set('HAVE_SYS_IO_H', 1)
+	config.set('HAVE_SYS_IO_H', 1)
 endif
 if cc.has_header('cpuid.h')
 	# FIXME: Do we need the example link test from configure.ac?
-	config_h.set('HAVE_CPUID_H', 1)
+	config.set('HAVE_CPUID_H', 1)
 endif
 
 if cc.has_member('struct sysinfo', 'totalram',
 		prefix : '#include <sys/sysinfo.h>')
-	config_h.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
+	config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
 endif
 
 add_project_arguments('-D_GNU_SOURCE', language : 'c')
 add_project_arguments('-include', 'config.h', language : 'c')
 
-config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
-config_h.set_quoted('PACKAGE', meson.project_name())
-config_h.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())
+config.set('PACKAGE_NAME', meson.project_name())
+config.set_quoted('PACKAGE_VERSION', meson.project_version())
+config.set_quoted('PACKAGE', meson.project_name())
+config.set('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
+config.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())
 
-configure_file(output: 'config.h', install: false, configuration: config_h)
+configure_file(output: 'config.h', install: false, configuration: config)
 
 subdir('lib')
 subdir('tests')
-- 
2.14.1



More information about the Intel-gfx mailing list