Changes introduced by
72862c2abc0bc6e87de08918bf21a7fc8fc4b1f7 moved the
default configuration from within `bin/named` to a central place
`bin/includes`.
The default configuration is conditioned by several compile-time macro.
While for most of them it's fine because they are defined in the global
`config.h` file included by default to all binaries (by meson), one
specific is not defined here. `HAVE_SO_REUSEPORT_LB` was defined in
`lib/isc/include/isc/netmgr.h` which is of course not included in
`bin/includes/defaultconfig.h`.
As a result, reuseport was disabled for all platform by default, even
the supported ones. This fixes the problem by checking if reuseport is
available on the platform from meson `config.h` generation directly,
which makes `HAVE_SO_REUSEPORT_LB` available everywhere.
/* Add -DISC_NETMGR_TRACE=1 to CFLAGS for detailed reference tracing */
-#if defined(SO_REUSEPORT_LB) || (defined(SO_REUSEPORT) && defined(__linux__))
-#define HAVE_SO_REUSEPORT_LB 1
-#endif
-
/*
* Convenience macros to specify on how many threads should socket listen
*/
message('likely non-glibc on linux, disabling recvmmsg')
endif
+## detect reuseport
+if cc.has_header_symbol('sys/socket.h', 'SO_REUSEPORT') and host_machine.system() == 'linux'
+ config.set('HAVE_SO_REUSEPORT_LB', 1)
+elif cc.has_header_symbol('sys/socket.h', 'SO_REUSEPORT_LB')
+ config.set('HAVE_SO_REUSEPORT_LB', 1)
+endif
+
## userspace-rcu
urcu_dep = [dependency('liburcu-cds', version: '>=0.10.0')]
if rcu_flavor == 'membarrier'