meson: only require libelf if building radv
[mesa.git] / meson.build
index 5353a4174849334b6db5a7f027543e937e413868..97809e982891bf6074040f3d3ea0f858edeaee11 100644 (file)
 # SOFTWARE.
 
 project('mesa', ['c', 'cpp'], version : '17.3.0-devel', license : 'MIT',
-        default_options : ['c_std=c99'])
+        default_options : ['c_std=c99', 'cpp_std=c++11'])
 
 with_dri3 = true  # XXX: need a switch for this
-with_vulkan_icd_dir = get_option('vulkan_icd_dir')
+with_vulkan_icd_dir = get_option('vulkan-icd-dir')
 with_tests = get_option('build-tests')
 with_valgrind = get_option('valgrind')
 
@@ -53,10 +53,14 @@ if _vulkan_drivers != ''
 endif
 
 prog_python2 = find_program('python2')
+has_mako = run_command(prog_python2, '-c', 'import mako')
+if has_mako.returncode() != 0
+  error('Python (2.x) mako module required to build mesa.')
+endif
 
 cc = meson.get_compiler('c')
 if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
-  error('When using GCC version 4.2.0 or later required.')
+  error('When using GCC, version 4.4.6 or later is required.')
 endif
 
 # Arguments for the preprocessor, put these in a separate array from the C and
@@ -260,7 +264,6 @@ if cc.has_function('dlopen')
 else
   dep_dl = cc.find_library('dl')
 endif
-pre_args += '-DHAVE_DLOPEN'
 
 if not cc.has_function('dladdr', dependencies : dep_dl)
   error('dl library doesn\'t have dladdr')
@@ -283,7 +286,10 @@ endif
 dep_zlib = dependency('zlib', version : '>= 1.2.3')
 dep_thread = dependency('threads')
 pre_args += '-DHAVE_PTHREAD'
-dep_elf = dependency('libelf')
+dep_elf = dependency('libelf', required : false)
+if not dep_elf.found()
+  dep_elf = cc.find_library('elf', required : with_amd_vk) # TODO: clover, r600, radeonsi
+endif
 dep_expat = dependency('expat')
 # this only exists on linux so either this is linux and it will be found, or
 # its not linux and and wont