@@ -473,19 +473,10 @@ if targetos != 'darwin'
473
473
warn_flags += [' -Wthread-safety' ]
474
474
endif
475
475
476
- # Check that the C++ compiler exists and works with the C compiler.
477
- link_language = ' c'
478
- linker = cc
476
+ # Set up C++ compiler flags
479
477
qemu_cxxflags = []
480
478
if ' cpp' in all_languages
481
479
qemu_cxxflags = [' -D__STDC_LIMIT_MACROS' , ' -D__STDC_CONSTANT_MACROS' , ' -D__STDC_FORMAT_MACROS' ] + qemu_cflags
482
- if cxx.links(files (' scripts/main.c' ), args : qemu_cflags)
483
- link_language = ' cpp'
484
- linker = cxx
485
- else
486
- message (' C++ compiler does not work with C compiler' )
487
- message (' Disabling C++-specific optional code' )
488
- endif
489
480
endif
490
481
491
482
# clang does not support glibc + FORTIFY_SOURCE (is it still true?)
@@ -1600,7 +1591,7 @@ if not get_option('snappy').auto() or have_system
1600
1591
snappy = cc.find_library (' snappy' , has_headers : [' snappy-c.h' ],
1601
1592
required : get_option (' snappy' ))
1602
1593
endif
1603
- if snappy.found() and not linker .links('''
1594
+ if snappy.found() and not cc .links('''
1604
1595
#include <snappy-c.h>
1605
1596
int main(void) { snappy_max_compressed_length(4096); return 0; }''' , dependencies : snappy)
1606
1597
snappy = not_found
@@ -2746,7 +2737,7 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol(
2746
2737
2747
2738
have_vss = false
2748
2739
have_vss_sdk = false # old xp/2003 SDK
2749
- if targetos == ' windows' and link_language == ' cpp'
2740
+ if targetos == ' windows' and ' cpp' in all_languages
2750
2741
have_vss = cxx.compiles('''
2751
2742
#define __MIDL_user_allocate_free_DEFINED__
2752
2743
#include <vss.h>
@@ -3827,7 +3818,6 @@ foreach target : target_dirs
3827
3818
c_args : c_args,
3828
3819
dependencies : arch_deps + deps + exe[' dependencies' ],
3829
3820
objects : lib.extract_all_objects(recursive : true ),
3830
- link_language : link_language,
3831
3821
link_depends : [block_syms, qemu_syms] + exe.get(' link_depends' , []),
3832
3822
link_args : link_args,
3833
3823
win_subsystem : exe[' win_subsystem' ])
@@ -4061,7 +4051,7 @@ summary_info += {'host CPU': cpu}
4061
4051
summary_info += {' host endianness' : build_machine .endian()}
4062
4052
summary_info += {' C compiler' : ' ' .join(meson .get_compiler(' c' ).cmd_array())}
4063
4053
summary_info += {' Host C compiler' : ' ' .join(meson .get_compiler(' c' , native : true ).cmd_array())}
4064
- if link_language == ' cpp'
4054
+ if ' cpp' in all_languages
4065
4055
summary_info += {' C++ compiler' : ' ' .join(meson .get_compiler(' cpp' ).cmd_array())}
4066
4056
else
4067
4057
summary_info += {' C++ compiler' : false }
@@ -4074,13 +4064,13 @@ if get_option('optimization') != 'plain'
4074
4064
option_cflags += [' -O' + get_option (' optimization' )]
4075
4065
endif
4076
4066
summary_info += {' CFLAGS' : ' ' .join(get_option (' c_args' ) + option_cflags)}
4077
- if link_language == ' cpp'
4067
+ if ' cpp' in all_languages
4078
4068
summary_info += {' CXXFLAGS' : ' ' .join(get_option (' cpp_args' ) + option_cflags)}
4079
4069
endif
4080
4070
if targetos == ' darwin'
4081
4071
summary_info += {' OBJCFLAGS' : ' ' .join(get_option (' objc_args' ) + option_cflags)}
4082
4072
endif
4083
- link_args = get_option (link_language + ' _link_args ' )
4073
+ link_args = get_option (' c_link_args ' )
4084
4074
if link_args.length() > 0
4085
4075
summary_info += {' LDFLAGS' : ' ' .join(link_args)}
4086
4076
endif
0 commit comments