summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-09-07 17:12:31 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2018-09-13 11:49:25 +0200
commit2fd7559819c2de392d6964cacc0032d2066d0d6e (patch)
tree45153dca06d9e0ddb2de9ebcc4168f5f63f11f4e /meson.build
parent36b0e46146ec7f67acb365e83e306d781f198d1c (diff)
downloadNetworkManager-2fd7559819c2de392d6964cacc0032d2066d0d6e.tar.gz
build: meson: uniform handling of rc managers
Handle all rc managers paths through the same code.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build71
1 files changed, 32 insertions, 39 deletions
diff --git a/meson.build b/meson.build
index bac71fdf9f..433bc1a1f7 100644
--- a/meson.build
+++ b/meson.build
@@ -579,39 +579,41 @@ if enable_ovs
assert(jansson_dep.found(), 'jansson is needed for OpenVSwitch integration. Use -Dovs=false to disable it')
endif
-# resolvconf and netconfig support
-locations = get_option('resolvconf')
-enable_resolvconf = (locations != ['no'])
-if enable_resolvconf
- resolvconf = find_program(locations, required: false)
- enable_resolvconf = resolvconf.found()
-
- if enable_resolvconf
- config_h.set_quoted('RESOLVCONF_PATH', resolvconf.path())
+# DNS resolv.conf managers
+config_dns_rc_manager_default = get_option('config_dns_rc_manager_default')
+config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
+resolv_conf_summary = ''
+foreach prog_name : ['resolvconf', 'netconfig']
+ prog_path = get_option(prog_name)
+ prog_enable = (prog_path != 'no')
+
+ if prog_enable
+ if prog_path == ''
+ prog = find_program(prog_name,
+ '/usr/' + prog_name,
+ '/usr/sbin/' + prog_name,
+ '/usr/local/sbin' + prog_name,
+ required : false)
+ if prog.found()
+ prog_path = prog.path()
+ else
+ prog_enable = false
+ endif
+ endif
endif
-endif
-
-locations = get_option('netconfig')
-enable_netconfig = (locations != ['no'])
-if enable_netconfig
- netconfig = find_program(locations, required: false)
- enable_netconfig = netconfig.found()
- if enable_netconfig
- config_h.set_quoted('NETCONFIG_PATH', netconfig.path())
+ if prog_enable
+ config_h.set_quoted(prog_name.to_upper() + '_PATH', prog_path)
+ elif config_dns_rc_manager_default == prog_name
+ error(prog_name + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting')
endif
-endif
-config_dns_rc_manager_default = get_option('config_dns_rc_manager_default')
-if config_dns_rc_manager_default == 'resolvconf' and not enable_resolvconf
- error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting')
-endif
-
-if config_dns_rc_manager_default == 'netconfig' and not enable_netconfig
- error(config_dns_rc_manager_default + ' has not been enabled. Please don\'t disable it or use another configuration option for main.rc-manager setting')
-endif
-
-config_h.set_quoted('NM_CONFIG_DEFAULT_MAIN_RC_MANAGER', config_dns_rc_manager_default)
+ resolv_conf_summary += ' ' + prog_name + ': ' + prog_enable.to_string()
+ if prog_enable
+ resolv_conf_summary += ' ' + prog_path
+ endif
+ resolv_conf_summary += '\n'
+endforeach
# external misc tools paths
default_paths = ['/sbin', '/usr/sbin']
@@ -951,16 +953,7 @@ output += '\nConfiguration_plugins (main.plugins=' + config_plugins_default + ')
output += ' ibft: ' + enable_ibft.to_string() + '\n'
output += ' ifcfg-rh: ' + enable_ifcfg_rh.to_string() + '\n'
output += ' ifupdown: ' + enable_ifupdown.to_string() + '\n'
-output += '\nHandlers for /etc/resolv.conf:\n'
-output += ' resolvconf: ' + enable_resolvconf.to_string()
-if enable_resolvconf
- output += ' ' + resolvconf.path()
-endif
-output += '\n'
-output += ' netconfig: ' + enable_netconfig.to_string()
-if enable_netconfig
- output += ' ' + netconfig.path()
-endif
+output += '\nHandlers for /etc/resolv.conf:\n' + resolv_conf_summary
output += '\n'
output += ' config-dns-rc-manager-default: ' + config_dns_rc_manager_default + '\n'
output += '\nDHCP clients (default ' + config_dhcp_default + '):\n' + dhcp_summary