--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1197,29 +1197,27 @@ def developer_options(value):
add_old_configure_assignment('DEVELOPER_OPTIONS', developer_options)
set_config('DEVELOPER_OPTIONS', developer_options)
# Linker detection
# ==============================================================
@depends(target)
-def build_not_win_mac(target):
+def is_linker_option_enabled(target):
if target.kernel not in ('Darwin', 'WINNT', 'SunOS'):
return True
option('--enable-gold',
env='MOZ_FORCE_GOLD',
help='Enable GNU Gold Linker when it is not already the default',
- when=build_not_win_mac)
+ when=is_linker_option_enabled)
-imply_option('--enable-linker',
- depends_if('--enable-gold', when=build_not_win_mac)(lambda x: 'gold'),
- when=build_not_win_mac)
+imply_option('--enable-linker', 'gold', when='--enable-gold')
@imports('os')
@imports('shutil')
def enable_gnu_linker(enable_gold_option, c_compiler, developer_options, build_env,
toolchain_flags, linker_name):
# Used to check the kind of linker
version_check = ['-Wl,--version']
cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags
@@ -1285,20 +1283,20 @@ def enable_gnu_linker(enable_gold_option
# For other platforms without gold or the GNU linker
return namespace(
KIND='other'
)
js_option('--enable-linker', nargs=1,
choices=('bfd', 'gold', 'lld', 'other'),
help='Select the linker',
- when=build_not_win_mac)
+ when=is_linker_option_enabled)
@depends('--enable-linker', c_compiler, developer_options, check_build_environment,
- extra_toolchain_flags, when=build_not_win_mac)
+ extra_toolchain_flags, when=is_linker_option_enabled)
@checking('for linker', lambda x: x.KIND)
def select_linker(linker, c_compiler, developer_options, build_env, toolchain_flags):
linker = linker[0] if linker else 'other'
if linker in ('gold', 'bfd', 'other'):
return enable_gnu_linker(linker == 'gold', c_compiler, developer_options,
build_env, toolchain_flags, linker)
if linker == 'lld':
version_check = ['-Wl,--version']