aboutsummaryrefslogtreecommitdiff
path: root/ares
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-07-24 18:02:44 +0000
committerYang Tse <yangsita@gmail.com>2008-07-24 18:02:44 +0000
commit7fdeb14e6de9cb8cfa8040656de1df869e8ef2ff (patch)
treeda554727ba928e9689a8ad6eca37ed26c11a5e65 /ares
parent8a323f835499c7b62677012128be5b4685b65f1b (diff)
add checks for strtok_r and getprotobyname_r
Diffstat (limited to 'ares')
-rw-r--r--ares/reentrant.m4184
1 files changed, 184 insertions, 0 deletions
diff --git a/ares/reentrant.m4 b/ares/reentrant.m4
index 8cc3968f5..01d2136a7 100644
--- a/ares/reentrant.m4
+++ b/ares/reentrant.m4
@@ -75,6 +75,81 @@ AC_DEFUN([CHECK_NEED_REENTRANT_STRERROR_R], [
])
+dnl CHECK_NEED_REENTRANT_STRTOK_R
+dnl -------------------------------------------------
+dnl Checks if the preprocessor _REENTRANT definition
+dnl makes function strtok_r compiler visible.
+
+AC_DEFUN([CHECK_NEED_REENTRANT_STRTOK_R], [
+ #
+ AC_MSG_NOTICE([DEBUG:])
+ AC_MSG_NOTICE([DEBUG:])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([strtok_r])
+ ],[
+ AC_MSG_NOTICE([DEBUG: strtok_r links... yes])
+ tmp_strtok_r="yes"
+ ],[
+ AC_MSG_NOTICE([DEBUG: strtok_r links... no])
+ tmp_strtok_r="no"
+ ])
+ #
+ if test "$tmp_strtok_r" = "yes"; then
+ AC_EGREP_CPP([strtok_r],[
+#include <sys/types.h>
+#include <string.h>
+ ],[
+ AC_MSG_NOTICE([DEBUG: strtok_r proto... without our definition])
+ tmp_strtok_r="proto_wout_def"
+ ],[
+ AC_EGREP_CPP([strtok_r],[
+#define _REENTRANT
+#include <sys/types.h>
+#include <string.h>
+ ],[
+ AC_MSG_NOTICE([DEBUG: strtok_r proto... with our _reentrant])
+ tmp_strtok_r="proto_with_def"
+ ],[
+ AC_MSG_NOTICE([DEBUG: strtok_r proto... not found])
+ ])
+ ])
+ fi
+ #
+ if test "$tmp_strtok_r" = "proto_wout_def"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <string.h>
+ ]],[[
+ strtok_r(0, 0, 0);
+ ]])
+ ],[
+ AC_MSG_NOTICE([DEBUG: strtok_r proto wout finds... 3 args])
+ tmp_strtok_r="done"
+ ])
+ fi
+ #
+ if test "$tmp_strtok_r" = "proto_with_def"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#define _REENTRANT
+#include <sys/types.h>
+#include <string.h>
+ ]],[[
+ strtok_r(0, 0, 0);
+ ]])
+ ],[
+ AC_MSG_NOTICE([DEBUG: strtok_r proto with finds... 3 args])
+ tmp_strtok_r="needs_reentrant"
+ ])
+ fi
+ #
+ if test "$tmp_strtok_r" = "needs_reentrant"; then
+ ac_cv_need_reentrant="yes"
+ fi
+])
+
+
dnl CHECK_NEED_REENTRANT_LOCALTIME_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
@@ -596,6 +671,107 @@ AC_DEFUN([CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [
])
+dnl CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
+dnl -------------------------------------------------
+dnl Checks if the preprocessor _REENTRANT definition
+dnl makes function getprotobyname_r compiler visible.
+
+AC_DEFUN([CHECK_NEED_REENTRANT_GETPROTOBYNAME_R], [
+ #
+ AC_MSG_NOTICE([DEBUG:])
+ AC_LINK_IFELSE([
+ AC_LANG_FUNC_LINK_TRY([getprotobyname_r])
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r links... yes])
+ tmp_getprotobyname_r="yes"
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r links... no])
+ tmp_getprotobyname_r="no"
+ ])
+ #
+ if test "$tmp_getprotobyname_r" = "yes"; then
+ AC_EGREP_CPP([getprotobyname_r],[
+#include <sys/types.h>
+#include <netdb.h>
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r proto... without our definition])
+ tmp_getprotobyname_r="proto_wout_def"
+ ],[
+ AC_EGREP_CPP([getprotobyname_r],[
+#define _REENTRANT
+#include <sys/types.h>
+#include <netdb.h>
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r proto... with our _reentrant])
+ tmp_getprotobyname_r="proto_with_def"
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r proto... not found])
+ ])
+ ])
+ fi
+ #
+ if test "$tmp_getprotobyname_r" = "proto_wout_def"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <netdb.h>
+ ]],[[
+ getprotobyname_r(0, 0, 0, 0);
+ ]])
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r proto wout finds... 4 args])
+ tmp_getprotobyname_r="done"
+ ])
+ fi
+ if test "$tmp_getprotobyname_r" = "proto_wout_def"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#include <sys/types.h>
+#include <netdb.h>
+ ]],[[
+ getprotobyname_r(0, 0, 0, 0, 0);
+ ]])
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r proto wout finds... 5 args])
+ tmp_getprotobyname_r="done"
+ ])
+ fi
+ #
+ if test "$tmp_getprotobyname_r" = "proto_with_def"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#define _REENTRANT
+#include <sys/types.h>
+#include <netdb.h>
+ ]],[[
+ getprotobyname_r(0, 0, 0, 0);
+ ]])
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r proto with finds... 4 args])
+ tmp_getprotobyname_r="needs_reentrant"
+ ])
+ fi
+ if test "$tmp_getprotobyname_r" = "proto_with_def"; then
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+#define _REENTRANT
+#include <sys/types.h>
+#include <netdb.h>
+ ]],[[
+ getprotobyname_r(0, 0, 0, 0, 0);
+ ]])
+ ],[
+ AC_MSG_NOTICE([DEBUG: getprotobyname_r proto with finds... 5 args])
+ tmp_getprotobyname_r="needs_reentrant"
+ ])
+ fi
+ #
+ if test "$tmp_getprotobyname_r" = "needs_reentrant"; then
+ ac_cv_need_reentrant="yes"
+ fi
+])
+
+
dnl CHECK_NEED_REENTRANT_GETSERVBYPORT_R
dnl -------------------------------------------------
dnl Checks if the preprocessor _REENTRANT definition
@@ -735,6 +911,9 @@ AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R], [
CHECK_NEED_REENTRANT_STRERROR_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
+ CHECK_NEED_REENTRANT_STRTOK_R
+ fi
+ if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_LOCALTIME_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
@@ -750,17 +929,22 @@ AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R], [
CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
fi
if test "$ac_cv_need_reentrant" = "no"; then
+ CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
+ fi
+ if test "$ac_cv_need_reentrant" = "no"; then
CHECK_NEED_REENTRANT_GETSERVBYPORT_R
fi
])
AC_DEFUN([CHECK_NEED_REENTRANT_FUNCTIONS_R_DEBUG], [
CHECK_NEED_REENTRANT_STRERROR_R
+ CHECK_NEED_REENTRANT_STRTOK_R
CHECK_NEED_REENTRANT_LOCALTIME_R
CHECK_NEED_REENTRANT_GMTIME_R
CHECK_NEED_REENTRANT_INET_NTOA_R
CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
+ CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
CHECK_NEED_REENTRANT_GETSERVBYPORT_R
])