From: Paul Eggert Date: Mon, 22 Oct 2001 17:42:32 +0000 (+0000) Subject: (AC_FUNC_STRERROR_R): Rename ac_cv_func_strerror_r_works to X-Git-Tag: AUTOCONF-2.52f~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5210e0c90babeabcd35ddc73378913c2d83dca9e;p=thirdparty%2Fautoconf.git (AC_FUNC_STRERROR_R): Rename ac_cv_func_strerror_r_works to ac_cv_func_strerror_r_char_p, and rename HAVE_WORKING_STRERROR_R to STRERROR_R_CHAR_P, since POSIX decided to standardize on the int flavor of strerror_r. Always do char* test, as there's no reason not to. Assign to a char* var, to catch strerror_r that returns int*. --- diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 911d5f077..fd1180c6f 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -1216,19 +1216,20 @@ AU_ALIAS([AM_FUNC_STRTOD], [AC_FUNC_STRTOD]) AC_DEFUN([AC_FUNC_STRERROR_R], [AC_CHECK_DECLS([strerror_r]) AC_CHECK_FUNCS([strerror_r]) -if test $ac_cv_func_strerror_r = yes; then - AC_CACHE_CHECK([for working strerror_r], - ac_cv_func_strerror_r_works, +AC_CACHE_CHECK([whether strerror_r returns char *], + ac_cv_func_strerror_r_char_p, [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], - [[ - 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 + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [[ + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + ]])], + ac_cv_func_strerror_r_char_p=yes) + else + # strerror_r is not declared. 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 @@ -1239,15 +1240,12 @@ if test $ac_cv_func_strerror_r = yes; then [[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) + ac_cv_func_strerror_r_char_p=yes, , :) fi ]) - 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 +if test $ac_cv_func_strerror_r_char_p = yes; then + AC_DEFINE([STRERROR_R_CHAR_P], 1, + [Define to 1 if strerror_r returns char *.]) fi ])# AC_FUNC_STRERROR_R