X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fmeson.build;h=d2b76cbe108ddb4421091033213318c0b32a5ed1;hb=9a012e485a2ed5ea5a28903d93bc625767bb20b2;hp=e37c2db0d4c38f648cf298ffdac9e232ec2bed26;hpb=373b0c12d9d0e8a3b449fd18be704e28dd6403e1;p=tinc diff --git a/src/meson.build b/src/meson.build index e37c2db0..d2b76cbe 100644 --- a/src/meson.build +++ b/src/meson.build @@ -11,10 +11,21 @@ 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', @@ -205,8 +216,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() @@ -392,7 +405,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, @@ -402,7 +415,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,