@@ -473,19 +473,10 @@ if targetos != 'darwin'
473473 warn_flags += [' -Wthread-safety' ]
474474endif
475475
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
479477qemu_cxxflags = []
480478if ' cpp' in all_languages
481479 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
489480endif
490481
491482# clang does not support glibc + FORTIFY_SOURCE (is it still true?)
@@ -1600,7 +1591,7 @@ if not get_option('snappy').auto() or have_system
16001591 snappy = cc.find_library (' snappy' , has_headers : [' snappy-c.h' ],
16011592 required : get_option (' snappy' ))
16021593endif
1603- if snappy.found() and not linker .links('''
1594+ if snappy.found() and not cc .links('''
16041595 #include <snappy-c.h>
16051596 int main(void) { snappy_max_compressed_length(4096); return 0; }''' , dependencies : snappy)
16061597 snappy = not_found
@@ -2746,7 +2737,7 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol(
27462737
27472738have_vss = false
27482739have_vss_sdk = false # old xp/2003 SDK
2749- if targetos == ' windows' and link_language == ' cpp'
2740+ if targetos == ' windows' and ' cpp' in all_languages
27502741 have_vss = cxx.compiles('''
27512742 #define __MIDL_user_allocate_free_DEFINED__
27522743 #include <vss.h>
@@ -3827,7 +3818,6 @@ foreach target : target_dirs
38273818 c_args : c_args,
38283819 dependencies : arch_deps + deps + exe[' dependencies' ],
38293820 objects : lib.extract_all_objects(recursive : true ),
3830- link_language : link_language,
38313821 link_depends : [block_syms, qemu_syms] + exe.get(' link_depends' , []),
38323822 link_args : link_args,
38333823 win_subsystem : exe[' win_subsystem' ])
@@ -4061,7 +4051,7 @@ summary_info += {'host CPU': cpu}
40614051summary_info += {' host endianness' : build_machine .endian()}
40624052summary_info += {' C compiler' : ' ' .join(meson .get_compiler(' c' ).cmd_array())}
40634053summary_info += {' Host C compiler' : ' ' .join(meson .get_compiler(' c' , native : true ).cmd_array())}
4064- if link_language == ' cpp'
4054+ if ' cpp' in all_languages
40654055 summary_info += {' C++ compiler' : ' ' .join(meson .get_compiler(' cpp' ).cmd_array())}
40664056else
40674057 summary_info += {' C++ compiler' : false }
@@ -4074,13 +4064,13 @@ if get_option('optimization') != 'plain'
40744064 option_cflags += [' -O' + get_option (' optimization' )]
40754065endif
40764066summary_info += {' CFLAGS' : ' ' .join(get_option (' c_args' ) + option_cflags)}
4077- if link_language == ' cpp'
4067+ if ' cpp' in all_languages
40784068 summary_info += {' CXXFLAGS' : ' ' .join(get_option (' cpp_args' ) + option_cflags)}
40794069endif
40804070if targetos == ' darwin'
40814071 summary_info += {' OBJCFLAGS' : ' ' .join(get_option (' objc_args' ) + option_cflags)}
40824072endif
4083- link_args = get_option (link_language + ' _link_args ' )
4073+ link_args = get_option (' c_link_args ' )
40844074if link_args.length() > 0
40854075 summary_info += {' LDFLAGS' : ' ' .join(link_args)}
40864076endif
0 commit comments