X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fmeson.build;h=02a42833bf7bfef5db51fdef00a441d51c756591;hb=e6111686d731af1e621ea9f38babef50610f7717;hp=484b514a0c47c7acb1458c0b4e804ab4ae65e908;hpb=244002d83466a85ac4fbb5327e26a60fe44168fd;p=tinc diff --git a/src/meson.build b/src/meson.build index 484b514a..02a42833 100644 --- a/src/meson.build +++ b/src/meson.build @@ -11,13 +11,22 @@ cdata.set_quoted('SBINDIR', dir_sbin) cdata.set('HAVE_' + os_name.to_upper(), 1) -foreach attr : ['malloc', 'nonnull', 'warn_unused_result', 'packed'] +foreach attr : ['malloc', 'nonnull', 'warn_unused_result', 'packed', 'format'] if cc.has_function_attribute(attr) cdata.set('HAVE_ATTR_' + attr.to_upper(), 1, - description: '__attribute__(@0@)'.format(attr)) + description: '__attribute__((__@0@__))'.format(attr)) endif endforeach +if cc.compiles(''' + #include + extern void *make() __attribute__((malloc(free))); + int main(void) { return 0; } +''') + cdata.set('HAVE_ATTR_MALLOC_WITH_ARG', 1, + description: 'support for __attribute__((malloc(deallocator)))') +endif + if cc.compiles(''' _Static_assert(1, "ok"); int main(void) { return 0; } @@ -53,6 +62,7 @@ check_headers = [ 'sys/ioctl.h', 'sys/mman.h', 'sys/param.h', + 'sys/random.h', 'sys/resource.h', 'sys/socket.h', 'sys/stat.h', @@ -73,8 +83,12 @@ endif check_functions = [ 'asprintf', 'daemon', + 'explicit_bzero', + 'explicit_memset', 'fchmod', + 'getentropy', 'gettimeofday', + 'memset_s', 'mlockall', 'putenv', 'strsignal', @@ -103,11 +117,14 @@ subdir('chacha-poly1305') src_lib_common = [ 'conf.c', + 'console.c', 'dropin.c', 'keys.c', 'list.c', + 'logger.c', 'names.c', 'netutl.c', + 'pidfile.c', 'script.c', 'splay_tree.c', 'sptps.c', @@ -115,7 +132,6 @@ src_lib_common = [ 'utils.c', 'version.c', 'xoshiro.c', - 'logger.c', ] src_tinc = [ @@ -152,6 +168,7 @@ src_tincd = [ 'protocol_key.c', 'protocol_misc.c', 'protocol_subnet.c', + 'proxy.c', 'raw_socket_device.c', 'route.c', 'subnet.c', @@ -163,6 +180,10 @@ deps_common = [] deps_tinc = [] deps_tincd = [cc.find_library('m', required: false)] +if os_name != 'windows' + src_lib_common += 'random.c' +endif + if os_name in ['linux', 'android'] subdir('linux') elif os_name.endswith('bsd') or os_name in ['dragonfly', 'darwin'] @@ -216,8 +237,10 @@ foreach type : check_types endif endforeach +src_getopt = [] if not cdata.has('HAVE_GETOPT_H') or not cc.has_function('getopt_long', prefix: have_prefix, args: cc_defs) - src_lib_common += ['getopt.c', 'getopt1.c'] + src_getopt = ['getopt.c', 'getopt1.c'] + src_lib_common += src_getopt endif if not opt_miniupnpc.disabled() @@ -257,6 +280,9 @@ else if not dep_readline.found() dep_readline = cc.find_library('readline', required: opt_readline, static: static) endif + if not dep_readline.found() + dep_readline = cc.find_library('libedit', required: opt_readline, static: static) + endif if dep_readline.found() and \ cc.has_header('readline/readline.h', dependencies: dep_readline) and \ cc.has_header('readline/history.h', dependencies: dep_readline) @@ -328,6 +354,10 @@ endif subdir(opt_crypto) +if opt_crypto != 'openssl' + src_lib_crypto += 'crypto.c' +endif + if opt_crypto != 'nolegacy' src_lib_crypto += ['cipher.c', 'digest.c'] endif @@ -403,7 +433,7 @@ exe_tincd = executable( exe_sptps_test = executable( 'sptps_test', - sources: 'sptps_test.c', + sources: [src_getopt, 'sptps_test.c'], dependencies: deps_lib_common, link_with: lib_common, implicit_include_directories: false, @@ -413,7 +443,7 @@ exe_sptps_test = executable( exe_sptps_keypair = executable( 'sptps_keypair', - sources: 'sptps_keypair.c', + sources: [src_getopt, 'sptps_keypair.c'], dependencies: deps_lib_common, link_with: lib_common, implicit_include_directories: false,