2 # Experimental replacement for the function in the latest CVS autoconf.
3 # If the compile-test says strerror_r doesn't work, then resort to a
4 # `run'-test that works on BeOS and segfaults on DEC Unix.
5 # Use with the error.c file in ../lib.
7 undefine([AC_FUNC_STRERROR_R])
11 AC_DEFUN([AC_FUNC_STRERROR_R],
13 AC_CHECK_DECLS([strerror_r])
14 AC_CHECK_FUNCS([strerror_r])
15 if test $ac_cv_func_strerror_r = yes; then
16 AC_CHECK_HEADERS(string.h)
17 AC_CACHE_CHECK([for working strerror_r],
18 ac_cv_func_strerror_r_works,
29 char x = *strerror_r (0, buf, sizeof buf);
31 ac_cv_func_strerror_r_works=yes,
32 ac_cv_func_strerror_r_works=no
34 if test $ac_cv_func_strerror_r_works = no; then
35 # strerror_r seems not to work, but now we have to choose between
36 # systems that have relatively inaccessible declarations for the
37 # function. BeOS and DEC UNIX 4.0 fall in this category, but the
38 # former has a strerror_r that returns char*, while the latter
39 # has a strerror_r that returns `int'.
40 # This test should segfault on the DEC system.
47 extern char *strerror_r ();
53 char x = *strerror_r (0, buf, sizeof buf);
57 ac_cv_func_strerror_r_works=yes,
58 ac_cv_func_strerror_r_works=no,
59 ac_cv_func_strerror_r_works=no)
62 if test $ac_cv_func_strerror_r_works = yes; then
63 AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1,
64 [Define to 1 if `strerror_r' returns a string.])
68 ])# AC_FUNC_STRERROR_R