compilers/c: don't return -pthread for MacOS with any compiler
With GCC, Clang, or ICC, and for C++ Fixes #2628
This commit is contained in:
parent
ddc15e1bba
commit
6cf7d2492b
|
@ -986,12 +986,12 @@ class CCompiler(Compiler):
|
|||
return self.find_library_impl(libname, env, extra_dirs, code, libtype)
|
||||
|
||||
def thread_flags(self, env):
|
||||
if for_haiku(self.is_cross, env):
|
||||
if for_haiku(self.is_cross, env) or for_darwin(self.is_cross, env):
|
||||
return []
|
||||
return ['-pthread']
|
||||
|
||||
def thread_link_flags(self, env):
|
||||
if for_haiku(self.is_cross, env):
|
||||
if for_haiku(self.is_cross, env) or for_darwin(self.is_cross, env):
|
||||
return []
|
||||
return ['-pthread']
|
||||
|
||||
|
@ -1076,16 +1076,6 @@ class ClangCCompiler(ClangCompiler, CCompiler):
|
|||
'none')})
|
||||
return opts
|
||||
|
||||
def thread_flags(self, env):
|
||||
if for_darwin(self.is_cross, env):
|
||||
return []
|
||||
return super().thread_flags()
|
||||
|
||||
def thread_link_flags(self, env):
|
||||
if for_darwin(self.is_cross, env):
|
||||
return []
|
||||
return super().thread_link_flags()
|
||||
|
||||
def get_option_compile_args(self, options):
|
||||
args = []
|
||||
std = options['c_std']
|
||||
|
|
|
@ -37,7 +37,7 @@ import mesonbuild.coredata
|
|||
import mesonbuild.modules.gnome
|
||||
from mesonbuild.interpreter import Interpreter, ObjectHolder
|
||||
from mesonbuild.mesonlib import (
|
||||
is_windows, is_osx, is_cygwin, is_dragonflybsd, is_openbsd,
|
||||
is_windows, is_osx, is_cygwin, is_dragonflybsd, is_openbsd, is_haiku,
|
||||
windows_proof_rmtree, python_command, version_compare,
|
||||
BuildDirLock, Version
|
||||
)
|
||||
|
@ -3270,17 +3270,17 @@ class LinuxlikeTests(BasePlatformTests):
|
|||
self.assertEqual(sorted(out), sorted(['libfoo >= 1.0']))
|
||||
|
||||
out = self._run(cmd + ['--cflags-only-other']).strip().split()
|
||||
self.assertEqual(sorted(out), sorted(['-pthread', '-DCUSTOM']))
|
||||
self.check_pkg_flags_are_same(out, ['-pthread', '-DCUSTOM'])
|
||||
|
||||
out = self._run(cmd + ['--libs-only-l', '--libs-only-other']).strip().split()
|
||||
self.assertEqual(sorted(out), sorted(['-pthread', '-lcustom',
|
||||
'-llibmain', '-llibexposed']))
|
||||
self.check_pkg_flags_are_same(out, ['-pthread', '-lcustom',
|
||||
'-llibmain', '-llibexposed'])
|
||||
|
||||
out = self._run(cmd + ['--libs-only-l', '--libs-only-other', '--static']).strip().split()
|
||||
self.assertEqual(sorted(out), sorted(['-pthread', '-lcustom',
|
||||
'-llibmain', '-llibexposed',
|
||||
'-llibinternal', '-lcustom2',
|
||||
'-lfoo']))
|
||||
self.check_pkg_flags_are_same(out, ['-pthread', '-lcustom',
|
||||
'-llibmain', '-llibexposed',
|
||||
'-llibinternal', '-lcustom2',
|
||||
'-lfoo'])
|
||||
|
||||
cmd = ['pkg-config', 'requires-test']
|
||||
out = self._run(cmd + ['--print-requires']).strip().split('\n')
|
||||
|
@ -3290,6 +3290,11 @@ class LinuxlikeTests(BasePlatformTests):
|
|||
out = self._run(cmd + ['--print-requires-private']).strip().split('\n')
|
||||
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
|
||||
|
||||
def check_pkg_flags_are_same(self, output, expected):
|
||||
if is_osx() or is_haiku():
|
||||
expected = [x for x in expected if x != '-pthread']
|
||||
self.assertEqual(sorted(output), sorted(expected))
|
||||
|
||||
def test_pkg_unfound(self):
|
||||
testdir = os.path.join(self.unit_test_dir, '23 unfound pkgconfig')
|
||||
self.init(testdir)
|
||||
|
|
Loading…
Reference in New Issue