diff --git a/ChangeLog b/ChangeLog index bb2883ac..a43a69a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-03-19 Akim Demaille + + * acfunctions.m4 (AC_FUNC_STRERROR_R): Update to + fileutils-4.0.42's. + 2001-03-19 Akim Demaille * tests/atgeneral.m4 (AT_INIT): Don't always create `empty', rather diff --git a/acfunctions.m4 b/acfunctions.m4 index 048027d6..f9bc8732 100644 --- a/acfunctions.m4 +++ b/acfunctions.m4 @@ -1283,7 +1283,8 @@ fi # AC_FUNC_STRERROR_R # ------------------ AC_DEFUN([AC_FUNC_STRERROR_R], -[AC_CHECK_FUNCS([strerror_r]) +[AC_CHECK_DECLS([strerror_r]) +AC_CHECK_FUNCS([strerror_r]) if test $ac_cv_func_strerror_r = yes; then AC_CHECK_HEADERS(string.h) AC_CACHE_CHECK([for working strerror_r], @@ -1297,14 +1298,42 @@ if test $ac_cv_func_strerror_r = yes; then # endif ], [ - char buf; - char x = *strerror_r (0, &buf, sizeof buf); + char buf[100]; + 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 = no; then + # strerror_r seems not to work, but now we have to choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + AC_TRY_RUN( + [ +# include +# include +# include + + extern char *strerror_r (); + + int + main () + { + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + exit (!isalpha (x)); + } + ], + ac_cv_func_strerror_r_works=yes, + ac_cv_func_strerror_r_works=no, + ac_cv_func_strerror_r_works=no) + fi + ]) if test $ac_cv_func_strerror_r_works = yes; then - AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1, + AC_DEFINE_UNQUOTED([HAVE_WORKING_STRERROR_R], 1, [Define to 1 if `strerror_r' returns a string.]) fi fi diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 338a074a..e49fd1be 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -55,8 +55,8 @@ This file documents the GNU Autoconf package for creating scripts to configure source code packages using templates and an @code{m4} macro package. -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000 Free Software -Foundation, Inc. +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free +Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -90,8 +90,8 @@ approved by the Foundation. @page @vskip 0pt plus 1filll -Copyright @copyright{} 1992, 93, 94, 95, 96, 98, 99, 2000 Free Software -Foundation, Inc. +Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, +2001 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 048027d6..f9bc8732 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -1283,7 +1283,8 @@ fi # AC_FUNC_STRERROR_R # ------------------ AC_DEFUN([AC_FUNC_STRERROR_R], -[AC_CHECK_FUNCS([strerror_r]) +[AC_CHECK_DECLS([strerror_r]) +AC_CHECK_FUNCS([strerror_r]) if test $ac_cv_func_strerror_r = yes; then AC_CHECK_HEADERS(string.h) AC_CACHE_CHECK([for working strerror_r], @@ -1297,14 +1298,42 @@ if test $ac_cv_func_strerror_r = yes; then # endif ], [ - char buf; - char x = *strerror_r (0, &buf, sizeof buf); + char buf[100]; + 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 = no; then + # strerror_r seems not to work, but now we have to choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + AC_TRY_RUN( + [ +# include +# include +# include + + extern char *strerror_r (); + + int + main () + { + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + exit (!isalpha (x)); + } + ], + ac_cv_func_strerror_r_works=yes, + ac_cv_func_strerror_r_works=no, + ac_cv_func_strerror_r_works=no) + fi + ]) if test $ac_cv_func_strerror_r_works = yes; then - AC_DEFINE_UNQUOTED(HAVE_WORKING_STRERROR_R, 1, + AC_DEFINE_UNQUOTED([HAVE_WORKING_STRERROR_R], 1, [Define to 1 if `strerror_r' returns a string.]) fi fi