aboutsummaryrefslogtreecommitdiff
path: root/acinclude.m4
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-09-12 01:16:26 +0000
committerYang Tse <yangsita@gmail.com>2008-09-12 01:16:26 +0000
commitb93ad10fa518cf49bcffaa55eb00df97310e8734 (patch)
tree5148687fc386a0b4fc0f818db2efd34761cb2376 /acinclude.m4
parent28e2007767054351a914941ab09374bfa7dfa381 (diff)
improve detection of fdopen() and strerror_r()
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m4109
1 files changed, 0 insertions, 109 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index a12784285..4d42be49e 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -2620,115 +2620,6 @@ AC_DEFUN([CURL_CHECK_LOCALTIME_R],
AC_MSG_RESULT(no))])])
])
-dnl
-dnl This function checks for strerror_r(). If it isn't found at first, it
-dnl retries with _THREAD_SAFE defined, as that is what AIX seems to require
-dnl in order to find this function.
-dnl
-dnl If the function is found, it will then proceed to check how the function
-dnl actually works: glibc-style or POSIX-style.
-dnl
-dnl glibc:
-dnl char *strerror_r(int errnum, char *buf, size_t n);
-dnl
-dnl What this one does is to return the error string (no surprises there),
-dnl but it doesn't usually copy anything into buf! The 'buf' and 'n'
-dnl parameters are only meant as an optional working area, in case strerror_r
-dnl needs it. A quick test on a few systems shows that it's generally not
-dnl touched at all.
-dnl
-dnl POSIX:
-dnl int strerror_r(int errnum, char *buf, size_t n);
-dnl
-AC_DEFUN([CURL_CHECK_STRERROR_R],
-[
- AC_CHECK_FUNCS(strerror_r)
-
- if test "x$ac_cv_func_strerror_r" = "xyes"; then
-
- AC_MSG_CHECKING(whether strerror_r is declared)
- AC_EGREP_CPP(strerror_r,[
-#undef _REENTRANT
-#include <string.h>],[
- AC_MSG_RESULT(yes)],[
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(whether strerror_r with -D_REENTRANT is declared)
- AC_EGREP_CPP(strerror_r,[
-#undef _REENTRANT
-#define _REENTRANT
-#include <string.h>],[
- AC_MSG_RESULT(yes)],
- AC_MSG_RESULT(no)
- AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
- ) dnl with _THREAD_SAFE
- ]) dnl plain cpp for it
-
- dnl determine if this strerror_r() is glibc or POSIX
- AC_MSG_CHECKING([for a glibc strerror_r API])
- AC_TRY_RUN([
-#include <string.h>
-#include <errno.h>
-int
-main () {
- char buffer[1024]; /* big enough to play with */
- char *string =
- strerror_r(EACCES, buffer, sizeof(buffer));
- /* this should've returned a string */
- if(!string || !string[0])
- return 99;
- return 0;
-}
-],
- GLIBC_STRERROR_R="1"
- AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
- AC_MSG_RESULT([yes]),
- AC_MSG_RESULT([no]),
-
- dnl Use an inferior method of strerror_r detection while cross-compiling
- AC_EGREP_CPP(yes, [
-#include <features.h>
-#ifdef __GLIBC__
-yes
-#endif
-],
- dnl looks like glibc, so assume a glibc-style strerror_r()
- GLIBC_STRERROR_R="1"
- AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
- AC_MSG_RESULT([yes]),
- AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
- ) dnl while cross-compiling
- )
-
- if test -z "$GLIBC_STRERROR_R"; then
-
- AC_MSG_CHECKING([for a POSIX strerror_r API])
- AC_TRY_RUN([
-#include <string.h>
-#include <errno.h>
-int
-main () {
- char buffer[1024]; /* big enough to play with */
- int error =
- strerror_r(EACCES, buffer, sizeof(buffer));
- /* This should've returned zero, and written an error string in the
- buffer.*/
- if(!buffer[0] || error)
- return 99;
- return 0;
-}
-],
- AC_DEFINE(HAVE_POSIX_STRERROR_R, 1, [we have a POSIX-style strerror_r()])
- AC_MSG_RESULT([yes]),
- AC_MSG_RESULT([no]) ,
- dnl cross-compiling!
- AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
- )
-
- fi dnl if not using glibc API
-
- fi dnl we have a strerror_r
-
-])
AC_DEFUN([CURL_CHECK_INET_NTOA_R],
[