1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
10 # This software is licensed as described in the file COPYING, which
11 # you should have received as part of this distribution. The terms
12 # are also available at https://curl.haxx.se/docs/copyright.html.
14 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 # copies of the Software, and permit persons to whom the Software is
16 # furnished to do so, under the terms of the COPYING file.
18 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 # KIND, either express or implied.
21 #***************************************************************************
23 # File version for 'aclocal' use. Keep it a single number.
28 dnl None of the CURL_CHECK_NEED_REENTRANT_* macros shall use HAVE_FOO_H to
29 dnl conditionally include header files. These macros are used early in the
30 dnl configure process much before header file availability is known.
33 dnl CURL_CHECK_NEED_REENTRANT_ERRNO
34 dnl -------------------------------------------------
35 dnl Checks if the preprocessor _REENTRANT definition
36 dnl makes errno available as a preprocessor macro.
38 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_ERRNO], [
51 if test "$tmp_errno" = "yes"; then
59 force compilation error
63 tmp_errno="errno_macro_defined"
73 force compilation error
77 tmp_errno="errno_macro_needs_reentrant"
78 tmp_need_reentrant="yes"
85 dnl CURL_CHECK_NEED_REENTRANT_GMTIME_R
86 dnl -------------------------------------------------
87 dnl Checks if the preprocessor _REENTRANT definition
88 dnl makes function gmtime_r compiler visible.
90 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GMTIME_R], [
92 AC_LANG_FUNC_LINK_TRY([gmtime_r])
98 if test "$tmp_gmtime_r" = "yes"; then
99 AC_EGREP_CPP([gmtime_r],[
100 #include <sys/types.h>
103 tmp_gmtime_r="proto_declared"
105 AC_EGREP_CPP([gmtime_r],[
107 #include <sys/types.h>
110 tmp_gmtime_r="proto_needs_reentrant"
111 tmp_need_reentrant="yes"
118 dnl CURL_CHECK_NEED_REENTRANT_LOCALTIME_R
119 dnl -------------------------------------------------
120 dnl Checks if the preprocessor _REENTRANT definition
121 dnl makes function localtime_r compiler visible.
123 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_LOCALTIME_R], [
125 AC_LANG_FUNC_LINK_TRY([localtime_r])
127 tmp_localtime_r="yes"
131 if test "$tmp_localtime_r" = "yes"; then
132 AC_EGREP_CPP([localtime_r],[
133 #include <sys/types.h>
136 tmp_localtime_r="proto_declared"
138 AC_EGREP_CPP([localtime_r],[
140 #include <sys/types.h>
143 tmp_localtime_r="proto_needs_reentrant"
144 tmp_need_reentrant="yes"
151 dnl CURL_CHECK_NEED_REENTRANT_STRERROR_R
152 dnl -------------------------------------------------
153 dnl Checks if the preprocessor _REENTRANT definition
154 dnl makes function strerror_r compiler visible.
156 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRERROR_R], [
158 AC_LANG_FUNC_LINK_TRY([strerror_r])
164 if test "$tmp_strerror_r" = "yes"; then
165 AC_EGREP_CPP([strerror_r],[
166 #include <sys/types.h>
169 tmp_strerror_r="proto_declared"
171 AC_EGREP_CPP([strerror_r],[
173 #include <sys/types.h>
176 tmp_strerror_r="proto_needs_reentrant"
177 tmp_need_reentrant="yes"
184 dnl CURL_CHECK_NEED_REENTRANT_STRTOK_R
185 dnl -------------------------------------------------
186 dnl Checks if the preprocessor _REENTRANT definition
187 dnl makes function strtok_r compiler visible.
189 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRTOK_R], [
191 AC_LANG_FUNC_LINK_TRY([strtok_r])
197 if test "$tmp_strtok_r" = "yes"; then
198 AC_EGREP_CPP([strtok_r],[
199 #include <sys/types.h>
202 tmp_strtok_r="proto_declared"
204 AC_EGREP_CPP([strtok_r],[
206 #include <sys/types.h>
209 tmp_strtok_r="proto_needs_reentrant"
210 tmp_need_reentrant="yes"
217 dnl CURL_CHECK_NEED_REENTRANT_INET_NTOA_R
218 dnl -------------------------------------------------
219 dnl Checks if the preprocessor _REENTRANT definition
220 dnl makes function inet_ntoa_r compiler visible.
222 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_INET_NTOA_R], [
224 AC_LANG_FUNC_LINK_TRY([inet_ntoa_r])
226 tmp_inet_ntoa_r="yes"
230 if test "$tmp_inet_ntoa_r" = "yes"; then
231 AC_EGREP_CPP([inet_ntoa_r],[
232 #include <sys/types.h>
233 #include <sys/socket.h>
234 #include <netinet/in.h>
235 #include <arpa/inet.h>
237 tmp_inet_ntoa_r="proto_declared"
239 AC_EGREP_CPP([inet_ntoa_r],[
241 #include <sys/types.h>
242 #include <sys/socket.h>
243 #include <netinet/in.h>
244 #include <arpa/inet.h>
246 tmp_inet_ntoa_r="proto_needs_reentrant"
247 tmp_need_reentrant="yes"
254 dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
255 dnl -------------------------------------------------
256 dnl Checks if the preprocessor _REENTRANT definition
257 dnl makes function gethostbyaddr_r compiler visible.
259 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R], [
261 AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r])
263 tmp_gethostbyaddr_r="yes"
265 tmp_gethostbyaddr_r="no"
267 if test "$tmp_gethostbyaddr_r" = "yes"; then
268 AC_EGREP_CPP([gethostbyaddr_r],[
269 #include <sys/types.h>
272 tmp_gethostbyaddr_r="proto_declared"
274 AC_EGREP_CPP([gethostbyaddr_r],[
276 #include <sys/types.h>
279 tmp_gethostbyaddr_r="proto_needs_reentrant"
280 tmp_need_reentrant="yes"
287 dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
288 dnl -------------------------------------------------
289 dnl Checks if the preprocessor _REENTRANT definition
290 dnl makes function gethostbyname_r compiler visible.
292 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [
294 AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
296 tmp_gethostbyname_r="yes"
298 tmp_gethostbyname_r="no"
300 if test "$tmp_gethostbyname_r" = "yes"; then
301 AC_EGREP_CPP([gethostbyname_r],[
302 #include <sys/types.h>
305 tmp_gethostbyname_r="proto_declared"
307 AC_EGREP_CPP([gethostbyname_r],[
309 #include <sys/types.h>
312 tmp_gethostbyname_r="proto_needs_reentrant"
313 tmp_need_reentrant="yes"
320 dnl CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
321 dnl -------------------------------------------------
322 dnl Checks if the preprocessor _REENTRANT definition
323 dnl makes function getprotobyname_r compiler visible.
325 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R], [
327 AC_LANG_FUNC_LINK_TRY([getprotobyname_r])
329 tmp_getprotobyname_r="yes"
331 tmp_getprotobyname_r="no"
333 if test "$tmp_getprotobyname_r" = "yes"; then
334 AC_EGREP_CPP([getprotobyname_r],[
335 #include <sys/types.h>
338 tmp_getprotobyname_r="proto_declared"
340 AC_EGREP_CPP([getprotobyname_r],[
342 #include <sys/types.h>
345 tmp_getprotobyname_r="proto_needs_reentrant"
346 tmp_need_reentrant="yes"
353 dnl CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R
354 dnl -------------------------------------------------
355 dnl Checks if the preprocessor _REENTRANT definition
356 dnl makes function getservbyport_r compiler visible.
358 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R], [
360 AC_LANG_FUNC_LINK_TRY([getservbyport_r])
362 tmp_getservbyport_r="yes"
364 tmp_getservbyport_r="no"
366 if test "$tmp_getservbyport_r" = "yes"; then
367 AC_EGREP_CPP([getservbyport_r],[
368 #include <sys/types.h>
371 tmp_getservbyport_r="proto_declared"
373 AC_EGREP_CPP([getservbyport_r],[
375 #include <sys/types.h>
378 tmp_getservbyport_r="proto_needs_reentrant"
379 tmp_need_reentrant="yes"
386 dnl CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R
387 dnl -------------------------------------------------
388 dnl Checks if the preprocessor _REENTRANT definition
389 dnl makes several _r functions compiler visible.
390 dnl Internal macro for CURL_CONFIGURE_REENTRANT.
392 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R], [
393 if test "$tmp_need_reentrant" = "no"; then
394 CURL_CHECK_NEED_REENTRANT_GMTIME_R
396 if test "$tmp_need_reentrant" = "no"; then
397 CURL_CHECK_NEED_REENTRANT_LOCALTIME_R
399 if test "$tmp_need_reentrant" = "no"; then
400 CURL_CHECK_NEED_REENTRANT_STRERROR_R
402 if test "$tmp_need_reentrant" = "no"; then
403 CURL_CHECK_NEED_REENTRANT_STRTOK_R
405 if test "$tmp_need_reentrant" = "no"; then
406 CURL_CHECK_NEED_REENTRANT_INET_NTOA_R
408 if test "$tmp_need_reentrant" = "no"; then
409 CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
411 if test "$tmp_need_reentrant" = "no"; then
412 CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
414 if test "$tmp_need_reentrant" = "no"; then
415 CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
417 if test "$tmp_need_reentrant" = "no"; then
418 CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R
423 dnl CURL_CHECK_NEED_REENTRANT_SYSTEM
424 dnl -------------------------------------------------
425 dnl Checks if the preprocessor _REENTRANT definition
426 dnl must be unconditionally done for this platform.
427 dnl Internal macro for CURL_CONFIGURE_REENTRANT.
429 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_SYSTEM], [
432 tmp_need_reentrant="yes"
435 tmp_need_reentrant="no"
441 dnl CURL_CHECK_NEED_THREAD_SAFE_SYSTEM
442 dnl -------------------------------------------------
443 dnl Checks if the preprocessor _THREAD_SAFE definition
444 dnl must be unconditionally done for this platform.
445 dnl Internal macro for CURL_CONFIGURE_THREAD_SAFE.
447 AC_DEFUN([CURL_CHECK_NEED_THREAD_SAFE_SYSTEM], [
449 aix[[123]].* | aix4.[[012]].*)
450 dnl aix 4.2 and older
451 tmp_need_thread_safe="no"
454 dnl AIX 4.3 and newer
455 tmp_need_thread_safe="yes"
458 tmp_need_thread_safe="no"
464 dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
465 dnl -------------------------------------------------
466 dnl This macro ensures that configuration tests done
467 dnl after this will execute with preprocessor symbol
468 dnl _REENTRANT defined. This macro also ensures that
469 dnl the generated config file defines NEED_REENTRANT
470 dnl and that in turn curl_setup.h will define _REENTRANT.
471 dnl Internal macro for CURL_CONFIGURE_REENTRANT.
473 AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [
474 AC_DEFINE(NEED_REENTRANT, 1,
475 [Define to 1 if _REENTRANT preprocessor symbol must be defined.])
476 cat >>confdefs.h <<_EOF
484 dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE
485 dnl -------------------------------------------------
486 dnl This macro ensures that configuration tests done
487 dnl after this will execute with preprocessor symbol
488 dnl _THREAD_SAFE defined. This macro also ensures that
489 dnl the generated config file defines NEED_THREAD_SAFE
490 dnl and that in turn curl_setup.h will define _THREAD_SAFE.
491 dnl Internal macro for CURL_CONFIGURE_THREAD_SAFE.
493 AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE], [
494 AC_DEFINE(NEED_THREAD_SAFE, 1,
495 [Define to 1 if _THREAD_SAFE preprocessor symbol must be defined.])
496 cat >>confdefs.h <<_EOF
498 # define _THREAD_SAFE
504 dnl CURL_CONFIGURE_REENTRANT
505 dnl -------------------------------------------------
506 dnl This first checks if the preprocessor _REENTRANT
507 dnl symbol is already defined. If it isn't currently
508 dnl defined a set of checks are performed to verify
509 dnl if its definition is required to make visible to
510 dnl the compiler a set of *_r functions. Finally, if
511 dnl _REENTRANT is already defined or needed it takes
512 dnl care of making adjustments necessary to ensure
513 dnl that it is defined equally for further configure
514 dnl tests and generated config file.
516 AC_DEFUN([CURL_CONFIGURE_REENTRANT], [
519 AC_MSG_CHECKING([if _REENTRANT is already defined])
526 force compilation error
531 tmp_reentrant_initially_defined="yes"
534 tmp_reentrant_initially_defined="no"
537 if test "$tmp_reentrant_initially_defined" = "no"; then
538 AC_MSG_CHECKING([if _REENTRANT is actually needed])
539 CURL_CHECK_NEED_REENTRANT_SYSTEM
540 if test "$tmp_need_reentrant" = "no"; then
541 CURL_CHECK_NEED_REENTRANT_ERRNO
543 if test "$tmp_need_reentrant" = "no"; then
544 CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R
546 if test "$tmp_need_reentrant" = "yes"; then
553 AC_MSG_CHECKING([if _REENTRANT is onwards defined])
554 if test "$tmp_reentrant_initially_defined" = "yes" ||
555 test "$tmp_need_reentrant" = "yes"; then
556 CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
565 dnl CURL_CONFIGURE_THREAD_SAFE
566 dnl -------------------------------------------------
567 dnl This first checks if the preprocessor _THREAD_SAFE
568 dnl symbol is already defined. If it isn't currently
569 dnl defined a set of checks are performed to verify
570 dnl if its definition is required. Finally, if
571 dnl _THREAD_SAFE is already defined or needed it takes
572 dnl care of making adjustments necessary to ensure
573 dnl that it is defined equally for further configure
574 dnl tests and generated config file.
576 AC_DEFUN([CURL_CONFIGURE_THREAD_SAFE], [
579 AC_MSG_CHECKING([if _THREAD_SAFE is already defined])
586 force compilation error
591 tmp_thread_safe_initially_defined="yes"
594 tmp_thread_safe_initially_defined="no"
597 if test "$tmp_thread_safe_initially_defined" = "no"; then
598 AC_MSG_CHECKING([if _THREAD_SAFE is actually needed])
599 CURL_CHECK_NEED_THREAD_SAFE_SYSTEM
600 if test "$tmp_need_thread_safe" = "yes"; then
607 AC_MSG_CHECKING([if _THREAD_SAFE is onwards defined])
608 if test "$tmp_thread_safe_initially_defined" = "yes" ||
609 test "$tmp_need_thread_safe" = "yes"; then
610 CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE