diff options
author | Jim Meyering <jim@meyering.net> | 2000-06-24 12:05:08 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-06-24 12:05:08 +0000 |
commit | f89094c7de4d1e052d5bfcf7e390fba504bf1f6e (patch) | |
tree | f7fd6a3c834f580ff7647a823c150121bea6bbec | |
parent | 790705a7c111ab722e9e53b59dad12bec7a95761 (diff) | |
download | coreutils-f89094c7de4d1e052d5bfcf7e390fba504bf1f6e.tar.xz |
Revive this file -- to try out an experimental
version of AC_FUNC_STRERROR_R that may work even on BeOS, a system
for which strerror does return char*, but which lacks a conveniently
accessible declaration of the function.
-rw-r--r-- | m4/strerror_r.m4 | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/m4/strerror_r.m4 b/m4/strerror_r.m4 new file mode 100644 index 000000000..8ae4c71b9 --- /dev/null +++ b/m4/strerror_r.m4 @@ -0,0 +1,44 @@ +#serial 1000 +# Experimental replacement for the function in the latest CVS autoconf. +# Use with the error.c file in ../lib. + +undefine([AC_FUNC_STRERROR_R]) + +# AC_FUNC_STRERROR_R +# ------------------ +AC_DEFUN([AC_FUNC_STRERROR_R], +[# Check strerror_r +AC_CHECK_FUNCS([strerror_r]) +if test $ac_cv_func_strerror_r = yes; then + AC_CHECK_HEADERS(string.h) + AC_CHECK_DECLS([strerror_r]) + AC_CACHE_CHECK([for working strerror_r], + ac_cv_func_strerror_r_works, + [ + AC_TRY_COMPILE( + [ +# include <stdio.h> +# if HAVE_STRING_H +# include <string.h> +# endif +#ifndef HAVE_DECL_STRERROR_R +"this configure-time declaration test was not run" +#endif +#if !HAVE_DECL_STRERROR_R +char *strerror_r (); +#endif + ], + [ + char buf; + char x = *strerror_r (0, &buf, sizeof buf); + ], + ac_cv_func_strerror_r_works=yes, + ac_cv_func_strerror_r_works=no + ) + if test $ac_cv_func_strerror_r_works = yes; then + AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1, + [Define to 1 if `strerror_r' returns a string.]) + fi + ]) +fi +])# AC_FUNC_STRERROR_R |