diff --git a/meson.build b/meson.build index 5a93a623e..64f44b4bd 100644 --- a/meson.build +++ b/meson.build @@ -287,22 +287,19 @@ glib_dep = declare_dependency( ] ) -if meson.is_cross_build() - distro = 'unknown' -elif run_command('test', '-e', '/etc/sysconfig/network-scripts').returncode() == 0 - distro = 'redhat' -elif run_command('test', '-e', '/etc/SuSE-release').returncode() == 0 - distro = 'suse' -elif run_command('test', '-e', '/etc/debian_version').returncode() == 0 - distro = 'debian' -elif run_command('test', '-e', '/etc/gentoo-release').returncode() == 0 - distro = 'gentoo' +enable_ifcfg_rh = get_option('ifcfg_rh') +if enable_ifcfg_rh == 'auto' + enable_ifcfg_rh = (run_command('test', '-e', '/etc/sysconfig/network-scripts').returncode() == 0) else - distro = 'unknown' + enable_ifcfg_rh = (enable_ifcfg_rh != 'false') endif -enable_ifcfg_rh = get_option('ifcfg_rh') or (distro == 'redhat') -enable_ifupdown = get_option('ifupdown') or (distro == 'debian') +enable_ifupdown = get_option('ifupdown') +if enable_ifupdown == 'auto' + enable_ifupdown = (run_command('test', '-e', '/etc/debian_version').returncode() == 0) +else + enable_ifupdown = (enable_ifupdown != 'false') +endif config_plugins_default = get_option('config_plugins_default') config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_PLUGINS', config_plugins_default) diff --git a/meson_options.txt b/meson_options.txt index cec066418..8b1d32e64 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -40,12 +40,12 @@ option('nmcli', type: 'boolean', value: true, description: 'Build nmcli') option('nmtui', type: 'boolean', value: true, description: 'Build nmtui') option('nm_cloud_setup', type: 'boolean', value: false, description: 'Build nm-cloud-setup, a tool for automatically configure networking in cloud (EXPERIMENTAL!)') option('bluez5_dun', type: 'boolean', value: false, description: 'enable Bluez5 DUN support') -option('ebpf', type: 'combo', choices : ['auto', 'true', 'false'], description: 'Enable eBPF support') +option('ebpf', type: 'combo', choices: ['auto', 'true', 'false'], description: 'Enable eBPF support') # configuration plugins option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset') -option('ifcfg_rh', type: 'boolean', value: false, description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)') -option('ifupdown', type: 'boolean', value: false, description: 'enable ifupdown configuration plugin (Debian/Ubuntu)') +option('ifcfg_rh', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'enable ifcfg-rh configuration plugin (Fedora/RHEL)') +option('ifupdown', type: 'combo', choices:['auto', 'true', 'false'], value: 'auto', description: 'enable ifupdown configuration plugin (Debian/Ubuntu)') # handlers for resolv.conf option('resolvconf', type: 'string', value: '', description: 'Enable resolvconf support')