2 # Experimental replacement for the function in the latest CVS autoconf.
3 # Use with the error.c file in ../lib.
5 dnl Copyright 2001 Free Software Foundation, Inc.
6 dnl This file is free software; the Free Software Foundation
7 dnl gives unlimited permission to copy and/or distribute it,
8 dnl with or without modifications, as long as this notice is preserved.
10 undefine([AC_FUNC_STRERROR_R])
14 AC_DEFUN([AC_FUNC_STRERROR_R],
15 [AC_CHECK_DECLS([strerror_r])
16 AC_CHECK_FUNCS([strerror_r])
17 AC_CACHE_CHECK([whether strerror_r returns char *],
18 ac_cv_func_strerror_r_char_p,
20 ac_cv_func_strerror_r_char_p=no
21 if test $ac_cv_have_decl_strerror_r = yes; then
22 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
25 char x = *strerror_r (0, buf, sizeof buf);
26 char *p = strerror_r (0, buf, sizeof buf);
28 ac_cv_func_strerror_r_char_p=yes)
30 # strerror_r is not declared. Choose between
31 # systems that have relatively inaccessible declarations for the
32 # function. BeOS and DEC UNIX 4.0 fall in this category, but the
33 # former has a strerror_r that returns char*, while the latter
34 # has a strerror_r that returns `int'.
35 # This test should segfault on the DEC system.
36 AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
37 extern char *strerror_r ();],
39 char x = *strerror_r (0, buf, sizeof buf);
40 exit (!isalpha (x));]])],
41 ac_cv_func_strerror_r_char_p=yes, , :)
44 if test $ac_cv_func_strerror_r_char_p = yes; then
45 AC_DEFINE([STRERROR_R_CHAR_P], 1,
46 [Define to 1 if strerror_r returns char *.])
48 ])# AC_FUNC_STRERROR_R