]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Meson: strerror
authorFred Morcos <fred.morcos@open-xchange.com>
Mon, 3 Jul 2023 10:34:06 +0000 (12:34 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 20 Mar 2024 12:28:25 +0000 (13:28 +0100)
meson/strerror/meson.build [new file with mode: 0644]

diff --git a/meson/strerror/meson.build b/meson/strerror/meson.build
new file mode 100644 (file)
index 0000000..7b75050
--- /dev/null
@@ -0,0 +1,24 @@
+# Strerror_r
+# Inputs: conf
+
+prog = '''
+#include <string.h>
+int main () {
+    char error_string[256];
+    char *ptr = strerror_r(-2, error_string, 256);
+    char c = *strerror_r(-2, error_string, 256);
+    return c != 0 && ptr != (void*) 0L;
+}
+'''
+
+have_strerror_r_decl = cxx.has_header_symbol('string.h', 'strerror_r')
+have_strerror_r = cxx.has_function('strerror_r', prefix: '#include <string.h>')
+strerror_r_returns_charp = have_strerror_r and cxx.compiles(prog, name: 'strerror_r() returns char *')
+
+conf.set10('HAVE_DECL_STRERROR_R', have_strerror_r_decl, description: 'Whether strerror_r is declared')
+conf.set10('HAVE_STRERROR_R', have_strerror_r, description: 'Whether strerror_r is available')
+conf.set10('STRERROR_R_CHAR_P', strerror_r_returns_charp, description: 'Whether strerror_r returns char *')
+
+summary('strerror_r decl', have_strerror_r_decl, section: 'System')
+summary('strerror_r', have_strerror_r, section: 'System')
+summary('strerror_r returns char *', strerror_r_returns_charp, section: 'System')