From: Vladimír Čunát Date: Tue, 18 Feb 2020 19:03:14 +0000 (+0100) Subject: meson: actually #define HAVE_ASPRINTF X-Git-Tag: v5.1.0~44^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4afb11d58d24ceaf9e35987abe0ef5193904cfd3;p=thirdparty%2Fknot-resolver.git meson: actually #define HAVE_ASPRINTF I believe this should now correctly enable the code iff it's needed. This commits and the parent will probably be no-op in practice. I believe distros commonly do use fortification by default, and I'm not aware of any platform with kresd and without asprintf(). I considered using `conf_data.set()` in meson, but that would require us modifying contrib/ccan/asprintf/asprintf.h to include kresconfig.h, and that seemed weird. --- diff --git a/meson.build b/meson.build index a839eb237..c6099a402 100644 --- a/meson.build +++ b/meson.build @@ -87,6 +87,9 @@ message('--- optional dependencies ---') capng = dependency('libcap-ng', required: false) openssl = dependency('openssl', required: false) +have_asprintf = meson.get_compiler('c').has_function('asprintf', + prefix: '#define _GNU_SOURCE\n#include ') + ### sendmmsg has_sendmmsg = meson.get_compiler('c').has_function('sendmmsg', prefix: '#define _GNU_SOURCE\n#include ') @@ -111,6 +114,7 @@ add_project_arguments( '-Wtype-limits', '-Wshadow', '-fvisibility=hidden', + '-DHAVE_ASPRINTF=' + have_asprintf.to_int().to_string(), language: 'c', )