diff --git a/meson.build b/meson.build index 16eb29bc5d4..37d2c368a95 100644 --- a/meson.build +++ b/meson.build @@ -81,12 +81,8 @@ endif if cc.has_argument('--std=gnu99') add_project_arguments('--std=gnu99', language: ['c', 'cpp']) - lang_opt = ['c_std=gnu99'] elif cc.has_argument('--std=c99') add_project_arguments('--std=c99', language: ['c', 'cpp']) - lang_opt = ['c_std=c99'] -else - lang_opt = [] endif # Sanitize correct usage of rz_strf() @@ -179,7 +175,7 @@ cmake_package_relative_path = run_command(py3_exe, cmake_package_prefix_dir_py, subproject_clean_error_msg = 'Subprojects are not updated. Please run `git clean -dxff subprojects/` to delete all local subprojects directories. If you want to compile against current subprojects then set option `subprojects_check=false`.' # handle capstone dependency -capstone_dep = dependency('capstone', version: '>=4.0.2', required: get_option('use_sys_capstone'), static: is_static_build, default_options: lang_opt) +capstone_dep = dependency('capstone', version: '>=4.0.2', required: get_option('use_sys_capstone'), static: is_static_build) if not capstone_dep.found() capstone_version = get_option('use_capstone_version') if fs.is_file('subprojects/capstone-' + capstone_version + '.wrap') @@ -187,7 +183,7 @@ if not capstone_dep.found() if r.returncode() == 1 and get_option('subprojects_check') error(subproject_clean_error_msg) endif - capstone_proj = subproject('capstone-' + capstone_version, default_options: ['default_library=static'] + lang_opt) + capstone_proj = subproject('capstone-' + capstone_version, default_options: ['default_library=static']) else error('Wrong capstone version selected. Please use one of the supported versions.') endif @@ -635,13 +631,13 @@ if r.returncode() == 1 and get_option('subprojects_check') error(subproject_clean_error_msg) endif -libzip_dep = dependency('libzip', required: get_option('use_sys_libzip'), static: is_static_build, default_options: lang_opt) +libzip_dep = dependency('libzip', required: get_option('use_sys_libzip'), static: is_static_build) if not libzip_dep.found() libzip_proj = subproject('libzip', default_options: [ 'default_library=static', 'static_runtime=@0@'.format(is_static_build), 'use_sys_openssl=@0@'.format(get_option('use_sys_libzip_openssl')), - ] + lang_opt) + ]) libzip_dep = libzip_proj.get_variable('libzip_dep') endif diff --git a/subprojects/packagefiles/capstone-4.0.2/meson.build b/subprojects/packagefiles/capstone-4.0.2/meson.build index 15b785d3fd1..00a2449ad33 100644 --- a/subprojects/packagefiles/capstone-4.0.2/meson.build +++ b/subprojects/packagefiles/capstone-4.0.2/meson.build @@ -3,9 +3,15 @@ project('capstone', 'c', meson_version: '>=0.55.0', default_options: [ 'c_std=c99', - ] + ], ) +cc = meson.get_compiler('c') + +if not cc.has_argument('--std=c99') && cc.has_argument('--std=gnu99') + add_project_arguments('--std=gnu99', language: ['c', 'cpp']) +endif + cs_files = [ 'arch/AArch64/AArch64BaseInfo.c', 'arch/AArch64/AArch64Disassembler.c', diff --git a/subprojects/packagefiles/capstone-5.0.1/meson.build b/subprojects/packagefiles/capstone-5.0.1/meson.build index 3281d1aea8b..a39df93660d 100644 --- a/subprojects/packagefiles/capstone-5.0.1/meson.build +++ b/subprojects/packagefiles/capstone-5.0.1/meson.build @@ -3,9 +3,15 @@ project('capstone', 'c', meson_version: '>=0.55.0', default_options: [ 'c_std=c99', - ] + ], ) +cc = meson.get_compiler('c') + +if not cc.has_argument('--std=c99') && cc.has_argument('--std=gnu99') + add_project_arguments('--std=gnu99', language: ['c', 'cpp']) +endif + cs_files = [ 'arch/AArch64/AArch64BaseInfo.c', 'arch/AArch64/AArch64Disassembler.c', diff --git a/subprojects/packagefiles/capstone-auto-sync-aarch64/meson.build b/subprojects/packagefiles/capstone-auto-sync-aarch64/meson.build index ca4d02ccbac..6950cfb80b8 100644 --- a/subprojects/packagefiles/capstone-auto-sync-aarch64/meson.build +++ b/subprojects/packagefiles/capstone-auto-sync-aarch64/meson.build @@ -6,6 +6,12 @@ project('capstone', 'c', ] ) +cc = meson.get_compiler('c') + +if not cc.has_argument('--std=c99') && cc.has_argument('--std=gnu99') + add_project_arguments('--std=gnu99', language: ['c', 'cpp']) +endif + cs_files = [ 'arch/AArch64/AArch64BaseInfo.c', 'arch/AArch64/AArch64Disassembler.c', diff --git a/subprojects/packagefiles/capstone-next/meson.build b/subprojects/packagefiles/capstone-next/meson.build index 2564cdc0a1d..9e707ea99ae 100644 --- a/subprojects/packagefiles/capstone-next/meson.build +++ b/subprojects/packagefiles/capstone-next/meson.build @@ -3,9 +3,15 @@ project('capstone', 'c', meson_version: '>=0.55.0', default_options: [ 'c_std=c99', - ] + ], ) +cc = meson.get_compiler('c') + +if not cc.has_argument('--std=c99') && cc.has_argument('--std=gnu99') + add_project_arguments('--std=gnu99', language: ['c', 'cpp']) +endif + cs_files = [ 'arch/Alpha/AlphaDisassembler.c', 'arch/Alpha/AlphaInstPrinter.c', diff --git a/subprojects/packagefiles/libzip-1.9.2/meson.build b/subprojects/packagefiles/libzip-1.9.2/meson.build index 44ca85243e8..9934dc5cfbe 100644 --- a/subprojects/packagefiles/libzip-1.9.2/meson.build +++ b/subprojects/packagefiles/libzip-1.9.2/meson.build @@ -4,13 +4,17 @@ project('libzip', 'c', meson_version: '>=0.55.0', default_options: [ 'c_std=c99', - ] + ], ) py3_exe = import('python').find_installation() cc = meson.get_compiler('c') is_static_build = get_option('static_runtime') +if not cc.has_argument('--std=c99') && cc.has_argument('--std=gnu99') + add_project_arguments('--std=gnu99', language: ['c', 'cpp']) +endif + # Create config.h file conf_data = configuration_data() zlib_dep = dependency('zlib', required: get_option('use_sys_zlib'), static: is_static_build) diff --git a/subprojects/rzar/meson.build b/subprojects/rzar/meson.build index 7ea195577de..b78686c49f6 100644 --- a/subprojects/rzar/meson.build +++ b/subprojects/rzar/meson.build @@ -1,6 +1,9 @@ project('rzar', 'c', license: 'LGPL-3.0-only', meson_version: '>=0.55.0', + default_options: [ + 'c_std=c99', + ], ) # handle ar dependency @@ -10,10 +13,8 @@ ar_files = [ cc = meson.get_compiler('c') -if cc.has_argument('--std=gnu99') +if not cc.has_argument('--std=c99') && cc.has_argument('--std=gnu99') add_project_arguments('--std=gnu99', language: ['c', 'cpp']) -elif cc.has_argument('--std=c99') - add_project_arguments('--std=c99', language: ['c', 'cpp']) endif rz_util_dep = dependency('rz_util') diff --git a/subprojects/rzwinkd/meson.build b/subprojects/rzwinkd/meson.build index 4d27a66f23d..8c523ced96c 100644 --- a/subprojects/rzwinkd/meson.build +++ b/subprojects/rzwinkd/meson.build @@ -1,10 +1,17 @@ project('rzwinkd', 'c', license: 'LGPL-3.0-only', meson_version: '>=0.55.0', + default_options: [ + 'c_std=c99', + ], ) cc = meson.get_compiler('c') +if not cc.has_argument('--std=c99') && cc.has_argument('--std=gnu99') + add_project_arguments('--std=gnu99', language: ['c', 'cpp']) +endif + winkd_files = [ 'iob_pipe.c', 'iob_net.c',