X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fmeson.build;h=d96dd71b4a3b7274a5e7b9ef7c3919f920d1dc60;hb=0fe69908838248c28624beb540257892db6bdcbd;hp=43f70bfab4c7af73b8278325ee912b4fed284763;hpb=34317698b8c024de5c948b6f6058730b1fdbc328;p=tinc diff --git a/src/meson.build b/src/meson.build index 43f70bfa..d96dd71b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -11,11 +11,23 @@ cdata.set_quoted('SBINDIR', dir_sbin) cdata.set('HAVE_' + os_name.to_upper(), 1) -foreach attr : ['malloc', 'nonnull', 'warn_unused_result'] - cc.has_function_attribute(attr) +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)) + endif endforeach +if cc.compiles(''' + _Static_assert(1, "ok"); + int main(void) { return 0; } +''') + cdata.set('HAVE_STATIC_ASSERT', 1, + description: 'C11 _Static_assert()') +endif + check_headers = [ + 'alloca.h', 'arpa/inet.h', 'arpa/nameser.h', 'dirent.h', @@ -48,7 +60,9 @@ check_headers = [ 'sys/types.h', 'sys/wait.h', 'syslog.h', + 'string.h', 'termios.h', + 'unistd.h', ] # 'struct msghdr' misses some required fields @@ -92,6 +106,7 @@ src_lib_common = [ 'dropin.c', 'keys.c', 'list.c', + 'logger.c', 'names.c', 'netutl.c', 'script.c', @@ -101,7 +116,6 @@ src_lib_common = [ 'utils.c', 'version.c', 'xoshiro.c', - 'logger.c', ] src_tinc = [ @@ -149,6 +163,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'] @@ -156,7 +174,7 @@ elif os_name.endswith('bsd') or os_name in ['dragonfly', 'darwin'] elif os_name == 'sunos' subdir('solaris') elif os_name == 'windows' - subdir('mingw') + subdir('windows') endif foreach h : check_headers @@ -202,8 +220,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() @@ -225,9 +245,7 @@ if not opt_miniupnpc.disabled() endif endif -if opt_curses.auto() and os_name == 'windows' - message('curses does not link under MinGW') -else +if not opt_curses.disabled() # The meta-dependency covers more alternatives, but is only available in 0.54+ curses_name = meson_version.version_compare('>=0.54') ? 'curses' : 'ncurses' dep_curses = dependency(curses_name, required: opt_curses, static: static) @@ -239,7 +257,7 @@ endif # Some distributions do not supply pkg-config files for readline if opt_readline.auto() and os_name == 'windows' - message('readline does not link under MinGW') + message('readline not available on Windows') else dep_readline = dependency('readline', required: opt_readline, static: static) if not dep_readline.found() @@ -316,6 +334,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 @@ -391,7 +413,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, @@ -401,7 +423,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,