Skip to content

Commit 09ad115

Browse files
committed
detect false failure of strerror_r
See tikv/jemallocator#108. In a summary, test on `strerror_r` can fail due to reasons other than `strerror_r` itself, so add an additional test to determine the failure is expected. Signed-off-by: Jay Lee <[email protected]>
1 parent d0e8e60 commit 09ad115

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

configure.ac

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,9 +2497,19 @@ JE_COMPILABLE([strerror_r returns char with gnu source], [
24972497
char *error = strerror_r(EINVAL, buffer, 100);
24982498
printf("%s\n", error);
24992499
], [je_cv_strerror_r_returns_char_with_gnu_source])
2500+
if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xno" ; then
2501+
JE_COMPILABLE([strerror_r header only], [
2502+
#include <errno.h>
2503+
#include <stdio.h>
2504+
#include <stdlib.h>
2505+
#include <string.h>
2506+
], [], [je_cv_strerror_r_header_pass])
2507+
fi
25002508
JE_CFLAGS_RESTORE()
25012509
if test "x${je_cv_strerror_r_returns_char_with_gnu_source}" = "xyes" ; then
25022510
AC_DEFINE([JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE], [ ], [ ])
2511+
elif test "x${je_cv_strerror_r_header_pass}" = "xno" ; then
2512+
AC_MSG_ERROR([cannot determine return type of strerror_r])
25032513
fi
25042514

25052515
dnl ============================================================================

0 commit comments

Comments
 (0)