diff options
author | Max Kellermann <max@musicpd.org> | 2017-12-29 17:12:55 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-10-14 23:41:38 +0200 |
commit | 94592c14062d5afc9482d11baa401648082022c0 (patch) | |
tree | 8723d462737f883181fb1aaa3f91ee3d0add9721 /src/net | |
parent | 13ce142df137f346526de2a31a7ccbd59a903cdd (diff) |
build with Meson instead of autotools
So long, autotools! This is my last MPD related project to migrate
away from it. It has its strengths, but also very obvious weaknesses
and weirdnesses. Today, many of its quirks are not needed anymore,
and are cumbersome and slow. Now welcome our new Meson overlords!
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/meson.build | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/net/meson.build b/src/net/meson.build new file mode 100644 index 000000000..4b33e5aea --- /dev/null +++ b/src/net/meson.build @@ -0,0 +1,60 @@ +have_tcp = get_option('tcp') +conf.set('HAVE_TCP', have_tcp) + +if have_tcp and not get_option('ipv6').disabled() + if is_windows + have_ipv6 = c_compiler.has_header_symbol('winsock2.h', 'AF_INET6') + else + have_ipv6 = c_compiler.has_header_symbol('sys/socket.h', 'AF_INET6') + endif + if not have_ipv6 and get_option('ipv6').enabled() + error('IPv6 not supported by OS') + endif + + conf.set('HAVE_STRUCT_SOCKADDR_IN_SIN_LEN', c_compiler.has_member('struct sockaddr_in', 'sin_len', prefix: ''' +#ifdef _WIN32 +#include <winsock2.h> +#include <ws2tcpip.h> +#else +#include <netinet/in.h> +#endif''')) +else + have_ipv6 = false +endif +conf.set('HAVE_IPV6', have_ipv6) + +have_local_socket = not is_windows and get_option('local_socket') +conf.set('HAVE_UN', have_local_socket) + +if have_local_socket + conf.set('HAVE_STRUCT_UCRED', compiler.has_header_symbol('sys/socket.h', 'struct ucred') and compiler.has_header_symbol('sys/socket.h', 'SO_PEERCRED')) + conf.set('HAVE_GETPEEREID', compiler.has_function('getpeereid')) +endif + +if not have_tcp and not have_local_socket + error('Must enable either "tcp" or "local_socket"') +endif + +net = static_library( + 'net', + 'ToString.cxx', + 'HostParser.cxx', + 'Resolver.cxx', + 'AddressInfo.cxx', + 'StaticSocketAddress.cxx', + 'AllocatedSocketAddress.cxx', + 'IPv4Address.cxx', + 'IPv6Address.cxx', + 'SocketAddress.cxx', + 'SocketUtil.cxx', + 'SocketDescriptor.cxx', + 'SocketError.cxx', + include_directories: inc, +) + +net_dep = declare_dependency( + link_with: net, + dependencies: [ + system_dep, + ], +) |