meson: Do not enable USE_ELF_TLS for FreeBSD
[mesa.git] / meson.build
index 8d89bf9781ef64f4888f54f527a1c226f663e810..7d0373f375377a64aad93d6f8b33317a73c0e2b3 100644 (file)
@@ -181,7 +181,7 @@ with_dri_r200 = dri_drivers.contains('r200')
 with_dri_nouveau = dri_drivers.contains('nouveau')
 with_dri_swrast = dri_drivers.contains('swrast')
 
-with_dri = dri_drivers.length() != 0 and dri_drivers != ['']
+with_dri = dri_drivers.length() != 0
 
 gallium_drivers = get_option('gallium-drivers')
 if gallium_drivers.contains('auto')
@@ -228,7 +228,7 @@ with_gallium_swr = gallium_drivers.contains('swr')
 with_gallium_lima = gallium_drivers.contains('lima')
 with_gallium_zink = gallium_drivers.contains('zink')
 
-with_gallium = gallium_drivers.length() != 0 and gallium_drivers != ['']
+with_gallium = gallium_drivers.length() != 0
 
 if with_gallium and system_has_kms_drm
   _glx = get_option('glx')
@@ -261,7 +261,7 @@ endif
 with_intel_vk = _vulkan_drivers.contains('intel')
 with_amd_vk = _vulkan_drivers.contains('amd')
 with_freedreno_vk = _vulkan_drivers.contains('freedreno')
-with_any_vk = _vulkan_drivers.length() != 0 and _vulkan_drivers != ['']
+with_any_vk = _vulkan_drivers.length() != 0
 
 if with_dri_swrast and (with_gallium_softpipe or with_gallium_swr)
   error('Only one swrast provider can be built')
@@ -314,13 +314,7 @@ with_platform_haiku = _platforms.contains('haiku')
 with_platform_surfaceless = _platforms.contains('surfaceless')
 with_platform_windows = _platforms.contains('windows')
 
-with_platforms = false
-if _platforms.length() != 0 and _platforms != ['']
-  # sanity check that list contains no empty strings
-  if _platforms.contains('')
-    error('Invalid argument list given to -Dplatforms, please fix.')
-  endif
-  with_platforms = true
+if _platforms.length() != 0
   egl_native_platform = _platforms[0]
 endif
 
@@ -399,14 +393,14 @@ endif
 if _egl == 'auto'
   with_egl = (
     not ['darwin', 'windows'].contains(host_machine.system()) and
-    with_dri and with_shared_glapi and with_platforms
+    with_dri and with_shared_glapi and _platforms.length() != 0
   )
 elif _egl == 'enabled'
   if not with_dri
     error('EGL requires dri')
   elif not with_shared_glapi
     error('EGL requires shared-glapi')
-  elif not with_platforms
+  elif _platforms.length() == 0
     error('No platforms specified, consider -Dplatforms=drm,x11,surfaceless at least')
   elif not ['disabled', 'dri'].contains(with_glx)
     error('EGL requires dri, but a GLX is being built without dri')
@@ -428,7 +422,7 @@ if with_egl and not (with_platform_drm or with_platform_surfaceless or with_plat
 endif
 
 # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
-if host_machine.system() != 'windows' and (not with_platform_android or get_option('platform-sdk-version') >= 29)
+if not ['windows', 'freebsd'].contains(host_machine.system()) and (not with_platform_android or get_option('platform-sdk-version') >= 29)
   pre_args += '-DUSE_ELF_TLS'
 endif
 
@@ -783,7 +777,6 @@ if _power8 != 'disabled'
 endif
 
 _opencl = get_option('gallium-opencl')
-clover_cpp_std = []
 if _opencl != 'disabled'
   if not with_gallium
     error('OpenCL Clover implementation requires at least one gallium driver.')
@@ -802,14 +795,6 @@ if _opencl != 'disabled'
     dep_spirv_tools = null_dep
     dep_llvmspirvlib = null_dep
   endif
-
-  if host_machine.cpu_family().startswith('ppc') and cpp.compiles('''
-      #if !defined(__VEC__) || !defined(__ALTIVEC__)
-      #error "AltiVec not enabled"
-      #endif''',
-      name : 'Altivec')
-    clover_cpp_std += ['cpp_std=gnu++11']
-  endif
 else
   dep_clc = null_dep
   dep_spirv_tools = null_dep
@@ -915,9 +900,6 @@ if _shader_cache != 'disabled'
     with_shader_cache = true
   endif
 endif
-if with_amd_vk and not with_shader_cache
-  error('Radv requires shader cache support')
-endif
 
 # Check for GCC style builtins
 foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
@@ -1208,7 +1190,14 @@ if (cc.has_header_symbol('sys/mkdev.h', 'major') and
   pre_args += '-DMAJOR_IN_MKDEV'
 endif
 
-foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
+if not ['linux'].contains(host_machine.system())
+  # Deprecated on Linux and requires <sys/types.h> on FreeBSD and OpenBSD
+  if cc.check_header('sys/sysctl.h', prefix : '#include <sys/types.h>')
+    pre_args += '-DHAVE_SYS_SYSCTL_H'
+  endif
+endif
+
+foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
   if cc.check_header(h)
     pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
   endif
@@ -1898,7 +1887,7 @@ if with_egl
   lines += 'EGL drivers:     ' + ' '.join(egl_drivers)
 endif
 lines += 'GBM:             ' + (with_gbm ? 'yes' : 'no')
-if with_platforms
+if _platforms.length() != 0
   lines += 'EGL/Vulkan/VL platforms:   ' + ' '.join(_platforms)
 endif