6 dnl CARES_CHECK_NEED_REENTRANT_GMTIME_R
7 dnl -------------------------------------------------
8 dnl Checks if the preprocessor _REENTRANT definition
9 dnl makes function gmtime_r compiler visible.
11 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GMTIME_R], [
13 AC_LANG_FUNC_LINK_TRY([gmtime_r])
19 if test "$tmp_gmtime_r" = "yes"; then
20 AC_EGREP_CPP([gmtime_r],[
21 #include <sys/types.h>
24 tmp_gmtime_r="proto_declared"
26 AC_EGREP_CPP([gmtime_r],[
28 #include <sys/types.h>
31 tmp_gmtime_r="proto_needs_reentrant"
32 tmp_need_reentrant="yes"
39 dnl CARES_CHECK_NEED_REENTRANT_LOCALTIME_R
40 dnl -------------------------------------------------
41 dnl Checks if the preprocessor _REENTRANT definition
42 dnl makes function localtime_r compiler visible.
44 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_LOCALTIME_R], [
46 AC_LANG_FUNC_LINK_TRY([localtime_r])
52 if test "$tmp_localtime_r" = "yes"; then
53 AC_EGREP_CPP([localtime_r],[
54 #include <sys/types.h>
57 tmp_localtime_r="proto_declared"
59 AC_EGREP_CPP([localtime_r],[
61 #include <sys/types.h>
64 tmp_localtime_r="proto_needs_reentrant"
65 tmp_need_reentrant="yes"
72 dnl CARES_CHECK_NEED_REENTRANT_STRERROR_R
73 dnl -------------------------------------------------
74 dnl Checks if the preprocessor _REENTRANT definition
75 dnl makes function strerror_r compiler visible.
77 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_STRERROR_R], [
79 AC_LANG_FUNC_LINK_TRY([strerror_r])
85 if test "$tmp_strerror_r" = "yes"; then
86 AC_EGREP_CPP([strerror_r],[
87 #include <sys/types.h>
90 tmp_strerror_r="proto_declared"
92 AC_EGREP_CPP([strerror_r],[
94 #include <sys/types.h>
97 tmp_strerror_r="proto_needs_reentrant"
98 tmp_need_reentrant="yes"
105 dnl CARES_CHECK_NEED_REENTRANT_STRTOK_R
106 dnl -------------------------------------------------
107 dnl Checks if the preprocessor _REENTRANT definition
108 dnl makes function strtok_r compiler visible.
110 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_STRTOK_R], [
112 AC_LANG_FUNC_LINK_TRY([strtok_r])
118 if test "$tmp_strtok_r" = "yes"; then
119 AC_EGREP_CPP([strtok_r],[
120 #include <sys/types.h>
123 tmp_strtok_r="proto_declared"
125 AC_EGREP_CPP([strtok_r],[
127 #include <sys/types.h>
130 tmp_strtok_r="proto_needs_reentrant"
131 tmp_need_reentrant="yes"
138 dnl CARES_CHECK_NEED_REENTRANT_INET_NTOA_R
139 dnl -------------------------------------------------
140 dnl Checks if the preprocessor _REENTRANT definition
141 dnl makes function inet_ntoa_r compiler visible.
143 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_INET_NTOA_R], [
145 AC_LANG_FUNC_LINK_TRY([inet_ntoa_r])
147 tmp_inet_ntoa_r="yes"
151 if test "$tmp_inet_ntoa_r" = "yes"; then
152 AC_EGREP_CPP([inet_ntoa_r],[
153 #include <sys/types.h>
154 #include <sys/socket.h>
155 #include <netinet/in.h>
156 #include <arpa/inet.h>
158 tmp_inet_ntoa_r="proto_declared"
160 AC_EGREP_CPP([inet_ntoa_r],[
162 #include <sys/types.h>
163 #include <sys/socket.h>
164 #include <netinet/in.h>
165 #include <arpa/inet.h>
167 tmp_inet_ntoa_r="proto_needs_reentrant"
168 tmp_need_reentrant="yes"
175 dnl CARES_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
176 dnl -------------------------------------------------
177 dnl Checks if the preprocessor _REENTRANT definition
178 dnl makes function gethostbyaddr_r compiler visible.
180 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R], [
182 AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r])
184 tmp_gethostbyaddr_r="yes"
186 tmp_gethostbyaddr_r="no"
188 if test "$tmp_gethostbyaddr_r" = "yes"; then
189 AC_EGREP_CPP([gethostbyaddr_r],[
190 #include <sys/types.h>
193 tmp_gethostbyaddr_r="proto_declared"
195 AC_EGREP_CPP([gethostbyaddr_r],[
197 #include <sys/types.h>
200 tmp_gethostbyaddr_r="proto_needs_reentrant"
201 tmp_need_reentrant="yes"
208 dnl CARES_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
209 dnl -------------------------------------------------
210 dnl Checks if the preprocessor _REENTRANT definition
211 dnl makes function gethostbyname_r compiler visible.
213 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [
215 AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
217 tmp_gethostbyname_r="yes"
219 tmp_gethostbyname_r="no"
221 if test "$tmp_gethostbyname_r" = "yes"; then
222 AC_EGREP_CPP([gethostbyname_r],[
223 #include <sys/types.h>
226 tmp_gethostbyname_r="proto_declared"
228 AC_EGREP_CPP([gethostbyname_r],[
230 #include <sys/types.h>
233 tmp_gethostbyname_r="proto_needs_reentrant"
234 tmp_need_reentrant="yes"
241 dnl CARES_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
242 dnl -------------------------------------------------
243 dnl Checks if the preprocessor _REENTRANT definition
244 dnl makes function getprotobyname_r compiler visible.
246 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R], [
248 AC_LANG_FUNC_LINK_TRY([getprotobyname_r])
250 tmp_getprotobyname_r="yes"
252 tmp_getprotobyname_r="no"
254 if test "$tmp_getprotobyname_r" = "yes"; then
255 AC_EGREP_CPP([getprotobyname_r],[
256 #include <sys/types.h>
259 tmp_getprotobyname_r="proto_declared"
261 AC_EGREP_CPP([getprotobyname_r],[
263 #include <sys/types.h>
266 tmp_getprotobyname_r="proto_needs_reentrant"
267 tmp_need_reentrant="yes"
274 dnl CARES_CHECK_NEED_REENTRANT_GETSERVBYPORT_R
275 dnl -------------------------------------------------
276 dnl Checks if the preprocessor _REENTRANT definition
277 dnl makes function getservbyport_r compiler visible.
279 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_GETSERVBYPORT_R], [
281 AC_LANG_FUNC_LINK_TRY([getservbyport_r])
283 tmp_getservbyport_r="yes"
285 tmp_getservbyport_r="no"
287 if test "$tmp_getservbyport_r" = "yes"; then
288 AC_EGREP_CPP([getservbyport_r],[
289 #include <sys/types.h>
292 tmp_getservbyport_r="proto_declared"
294 AC_EGREP_CPP([getservbyport_r],[
296 #include <sys/types.h>
299 tmp_getservbyport_r="proto_needs_reentrant"
300 tmp_need_reentrant="yes"
307 dnl CARES_CHECK_NEED_REENTRANT_FUNCTIONS_R
308 dnl -------------------------------------------------
309 dnl Checks if the preprocessor _REENTRANT definition
310 dnl makes several _r functions compiler visible.
311 dnl Internal macro for CARES_CONFIGURE_REENTRANT.
313 AC_DEFUN([CARES_CHECK_NEED_REENTRANT_FUNCTIONS_R], [
315 tmp_need_reentrant="no"
317 if test "$tmp_need_reentrant" = "no"; then
318 CARES_CHECK_NEED_REENTRANT_GMTIME_R
320 if test "$tmp_need_reentrant" = "no"; then
321 CARES_CHECK_NEED_REENTRANT_LOCALTIME_R
323 if test "$tmp_need_reentrant" = "no"; then
324 CARES_CHECK_NEED_REENTRANT_STRERROR_R
326 if test "$tmp_need_reentrant" = "no"; then
327 CARES_CHECK_NEED_REENTRANT_STRTOK_R
329 if test "$tmp_need_reentrant" = "no"; then
330 CARES_CHECK_NEED_REENTRANT_INET_NTOA_R
332 if test "$tmp_need_reentrant" = "no"; then
333 CARES_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
335 if test "$tmp_need_reentrant" = "no"; then
336 CARES_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
338 if test "$tmp_need_reentrant" = "no"; then
339 CARES_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
341 if test "$tmp_need_reentrant" = "no"; then
342 CARES_CHECK_NEED_REENTRANT_GETSERVBYPORT_R
347 dnl CARES_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
348 dnl -------------------------------------------------
349 dnl This macro ensures that configuration tests done
350 dnl after this will execute with preprocessor symbol
351 dnl _REENTRANT defined. This macro also ensures that
352 dnl the generated config file defines NEED_REENTRANT
353 dnl and that in turn setup.h will define _REENTRANT.
354 dnl Internal macro for CARES_CONFIGURE_REENTRANT.
356 AC_DEFUN([CARES_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [
357 AC_DEFINE([NEED_REENTRANT], [1],
358 [Define to 1 if _REENTRANT preprocessor symbol must be defined.])
359 cat >>confdefs.h <<_ACEOF
367 dnl CARES_CONFIGURE_REENTRANT
368 dnl -------------------------------------------------
369 dnl This first checks if the preprocessor _REENTRANT
370 dnl symbol is already defined. If it isn't currently
371 dnl defined a set of checks are performed to verify
372 dnl if its definition is required to make visible to
373 dnl the compiler a set of *_r functions. Finally, if
374 dnl _REENTRANT is already defined or needed it takes
375 dnl care of making adjustments necessary to ensure
376 dnl that it is defined equally for further configure
377 dnl tests and generated config file.
379 AC_DEFUN([CARES_CONFIGURE_REENTRANT], [
382 AC_MSG_CHECKING([if _REENTRANT is already defined])
389 force compilation error
394 tmp_reentrant_initially_defined="yes"
397 tmp_reentrant_initially_defined="no"
400 if test "$tmp_reentrant_initially_defined" = "no"; then
401 AC_MSG_CHECKING([if _REENTRANT is actually needed])
402 CARES_CHECK_NEED_REENTRANT_FUNCTIONS_R
403 if test "$tmp_need_reentrant" = "yes"; then
410 AC_MSG_CHECKING([if _REENTRANT is onwards defined])
411 if test "$tmp_reentrant_initially_defined" = "yes" ||
412 test "$tmp_need_reentrant" = "yes"; then
413 CARES_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT