1 # Copyright the NTPsec project contributors
3 # SPDX-License-Identifier: BSD-2-Clause
5 # check to see if strerror_r has type char*
7 # streror_r() has 2 APIs.
8 # our environment doesn't make a clean choice.
10 # There is code for mystrerror() in the bottom of msyslog.c
11 # This code tried to setup a #define for STRERROR_CHAR
12 # if strerror_r() returns char* rather than int
14 # Unfortunately, this test code compiles in the other case.
15 # It generates a warning on the type conversion from char* to int,
16 # but that's only a warning, so it "works".
18 # This uses -Werror which may not be portable.
20 # Another possibility is to run the test code,
21 # and have it check for 0/NULL which the int mode should return.
28 const char *foo = strerror_r(6, buf, sizeof(buf));
34 def check_strerror(ctx
):
35 old_CFLAGS
= ctx
.env
.CFLAGS
36 ctx
.env
.CFLAGS
= ["-Werror"] + ctx
.env
.CFLAGS
38 fragment
=STRERROR_FRAG
,
39 define_name
="STRERROR_CHAR",
41 msg
="Checking if strerror_r returns char*",
43 comment
="Whether strerror_r returns char*"
45 ctx
.env
.CFLAGS
= old_CFLAGS