build: make prefix option accept a list of strings
authorStefan Becker <chemobejk@gmail.com>
Thu, 27 Jun 2019 09:22:53 +0000 (12:22 +0300)
committerStefan Becker <chemobejk@gmail.com>
Thu, 27 Jun 2019 16:52:31 +0000 (19:52 +0300)
The parameter for the ignored network interface prefix build option
accepts a comma-separated string now. This list will be converted to a
comma-separated list of string literals for the C code.

Disable the feature:

   ./configure ...
   ./configure --with-ignored-network-interface-prefix= ...
   meson setup -D ignored-network-interface-prefix= ...
   meson setup -D ignored-network-interface-prefix=[] ...

Ignore interfaces whose names start with "virbr":

   ./configure --with-ignored-network-interface-prefix=virbr ...
   meson setup -D ignored-network-interface-prefix=virbr ...

Ignore interfaces whose names start with "virbr" or "veth":

   ./configure --with-ignored-network-interface-prefix=virbr,veth ...
   meson setup -D ignored-network-interface-prefix=virbr,veth ...

configure.ac
meson.build
meson_options.txt

index 147b033..5254154 100644 (file)
@@ -395,16 +395,17 @@ AM_CONDITIONAL([ENABLE_GTK_DOC], false)
 # GObject introspection
 GOBJECT_INTROSPECTION_CHECK([1.30.0])
 
-dnl Ignore a specific network interface name prefix from the connection check
-AC_MSG_CHECKING([whether to ignore a specific network interface name prefix])
+dnl Ignore specific network interface name prefixes from the connection check
+AC_MSG_CHECKING([whether to ignore specific network interface name prefixes])
 AC_ARG_WITH([ignored-network-interface-prefix],
-  [AS_HELP_STRING([--with-ignored-network-interface-prefix=string],
-    [Ignore network interfaces whose name starts with "string" from the ICE connection
+  [AS_HELP_STRING([--with-ignored-network-interface-prefix=string@<:@,string...@:>@],
+    [Ignore network interfaces whose name starts with a string from this list in the ICE connection
      check algorithm. For example, interfaces "virbr" in the case of the virtual bridge
      handled by libvirtd, do not help in finding connectivity.])],
     [interface_prefix="$withval"])
 AS_IF([test -n "$interface_prefix"],
-  [AC_DEFINE_UNQUOTED([IGNORED_IFACE_PREFIX],["$interface_prefix"],
+  [[interface_prefix_list=`echo $interface_prefix | sed 's/,/","/g'`]
+   AC_DEFINE_UNQUOTED([IGNORED_IFACE_PREFIX],["$interface_prefix_list"],
     [Ignore this network interface prefix from the connection check])
    AC_MSG_RESULT([yes, $interface_prefix])],
   [AC_MSG_RESULT([no])])
index c685e41..114d7c6 100644 (file)
@@ -232,8 +232,12 @@ nice_incs = include_directories('.', 'agent', 'random', 'socket', 'stun')
 nice_deps = gio_deps + [gthread_dep, crypto_dep, gupnp_igd_dep] + syslibs
 
 ignored_iface_prefix = get_option('ignored-network-interface-prefix')
-if ignored_iface_prefix != ''
-  cdata.set_quoted('IGNORED_IFACE_PREFIX', ignored_iface_prefix)
+if ignored_iface_prefix != []
+  ignored_iface_prefix_quoted = []
+  foreach i : ignored_iface_prefix
+    ignored_iface_prefix_quoted += '"' + i + '"'
+  endforeach
+  cdata.set('IGNORED_IFACE_PREFIX', ','.join(ignored_iface_prefix_quoted))
 endif
 
 gir = find_program('g-ir-scanner', required : get_option('introspection'))
index d3a0ab9..9f9f7d6 100644 (file)
@@ -2,8 +2,8 @@ option('gupnp', type: 'feature', value: 'auto',
   description: 'Enable or disable GUPnP IGD support')
 option('gstreamer', type: 'feature', value: 'auto',
   description: 'Enable or disable build of GStreamer plugins')
-option('ignored-network-interface-prefix', type: 'string', value: '',
-  description: 'Ignore network interfaces whose name starts with this string in the ICE connection check algorithm. For example, "virbr" to ignore virtual bridge interfaces added by virtd, which do not help in finding connectivity.')
+option('ignored-network-interface-prefix', type: 'array', value: [],
+  description: 'Ignore network interfaces whose name starts with a string from this list in the ICE connection check algorithm. For example, "virbr" to ignore virtual bridge interfaces added by virtd, which do not help in finding connectivity.')
 option('crypto-library', type: 'combo', choices : ['auto', 'gnutls', 'openssl'], value : 'auto')
 
 # Common feature options