4 dnl Determine whether the strerror_r implementation is one of
5 dnl the broken ones that returns `int' rather than `char*'.
6 dnl Actually, this tests only whether it returns a scalar
7 dnl or an array, but that should be enough.
8 dnl This is used by lib/error.c.
10 AC_DEFUN(jm_FUNC_STRERROR_R,
13 AC_CHECK_FUNCS([strerror_r])
14 if test $ac_cv_func_strerror_r = yes; then
15 AC_CHECK_HEADERS(string.h)
16 AC_CACHE_CHECK([for working strerror_r],
17 jm_cv_func_working_strerror_r,
27 int buf; /* avoiding square brackets makes this easier */
28 char x = *strerror_r (0, buf, sizeof buf);
30 jm_cv_func_working_strerror_r=yes,
31 jm_cv_func_working_strerror_r=no
33 if test $jm_cv_func_working_strerror_r = yes; then
34 AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
35 [Define to 1 if strerror_r returns a string.])