haiku: do not add pthread arguments

Haiku has pthreads, but they are part of the standard C library, and do
not need either special compiler or linker flags.
pull/2745/head
Dylan Baker 7 years ago
parent 4ae0cadb7f
commit fc547ad05e
  1. 2
      mesonbuild/backend/backends.py
  2. 2
      mesonbuild/backend/ninjabackend.py
  3. 22
      mesonbuild/compilers/c.py
  4. 4
      mesonbuild/linkers.py
  5. 12
      mesonbuild/mesonlib.py

@ -509,7 +509,7 @@ class Backend:
# For 'automagic' deps: Boost and GTest. Also dependency('threads').
# pkg-config puts the thread flags itself via `Cflags:`
if dep.need_threads():
commands += compiler.thread_flags()
commands += compiler.thread_flags(self.environment)
# Fortran requires extra include directives.
if compiler.language == 'fortran':
for lt in target.link_targets:

@ -2430,7 +2430,7 @@ rule FORTRAN_DEP_HACK
# pkg-config puts the thread flags itself via `Cflags:`
for d in target.external_deps:
if d.need_threads():
commands += linker.thread_link_flags()
commands += linker.thread_link_flags(self.environment)
# Only non-static built targets need link args and link dependencies
if not isinstance(target, build.StaticLibrary):
commands += target.link_args

@ -16,9 +16,11 @@ import subprocess, os.path, tempfile
from .. import mlog
from .. import coredata
from ..mesonlib import EnvironmentException, version_compare, Popen_safe, listify
from ..mesonlib import for_windows, for_darwin, for_cygwin
from . import compilers
from ..mesonlib import (
EnvironmentException, version_compare, Popen_safe, listify,
for_windows, for_darwin, for_cygwin, for_haiku,
)
from .compilers import (
GCC_MINGW,
@ -281,12 +283,12 @@ class CCompiler(Compiler):
# Add compile flags needed by dependencies
args += d.get_compile_args()
if d.need_threads():
args += self.thread_flags()
args += self.thread_flags(env)
if mode == 'link':
# Add link flags needed to find dependencies
args += d.get_link_args()
if d.need_threads():
args += self.thread_link_flags()
args += self.thread_link_flags(env)
# Select a CRT if needed since we're linking
if mode == 'link':
args += self.get_linker_debug_crt_args()
@ -781,10 +783,14 @@ class CCompiler(Compiler):
return [trial]
return None
def thread_flags(self):
def thread_flags(self, env):
if for_haiku(self.is_cross, env):
return []
return ['-pthread']
def thread_link_flags(self):
def thread_link_flags(self, env):
if for_haiku(self.is_cross, env):
return []
return ['-pthread']
def has_multi_arguments(self, args, env):
@ -1005,10 +1011,10 @@ class VisualStudioCCompiler(CCompiler):
return []
# FIXME, no idea what these should be.
def thread_flags(self):
def thread_flags(self, env):
return []
def thread_link_flags(self):
def thread_link_flags(self, env):
return []
def get_options(self):

@ -48,7 +48,7 @@ class VisualStudioLinker(StaticLinker):
def build_rpath_args(self, build_dir, from_dir, rpath_paths, build_rpath, install_rpath):
return []
def thread_link_flags(self):
def thread_link_flags(self, env):
return []
def get_option_link_args(self, options):
@ -100,7 +100,7 @@ class ArLinker(StaticLinker):
def get_always_args(self):
return []
def thread_link_flags(self):
def thread_link_flags(self, env):
return []
def get_option_link_args(self, options):

@ -292,6 +292,18 @@ def for_darwin(is_cross, env):
return env.cross_info.config['host_machine']['system'] == 'darwin'
return False
def for_haiku(is_cross, env):
"""
Host machine is Haiku?
Note: 'host' is the machine on which compiled binaries will run
"""
if not is_cross:
return is_haiku()
elif env.cross_info.has_host():
return env.cross_info.config['host_machine']['system'] == 'haiku'
return False
def exe_exists(arglist):
try:
p = subprocess.Popen(arglist, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

Loading…
Cancel
Save