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 http://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.
22 #***************************************************************************
24 # File version for 'aclocal' use. Keep it a single number.
29 dnl None of the CURL_CHECK_NEED_REENTRANT_* macros shall use HAVE_FOO_H to
30 dnl conditionally include header files. These macros are used early in the
31 dnl configure process much before header file availability is known.
34 dnl CURL_CHECK_NEED_REENTRANT_ERRNO
35 dnl -------------------------------------------------
36 dnl Checks if the preprocessor _REENTRANT definition
37 dnl makes errno available as a preprocessor macro.
39 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_ERRNO], [
52 if test "$tmp_errno" = "yes"; then
60 force compilation error
64 tmp_errno="errno_macro_defined"
74 force compilation error
78 tmp_errno="errno_macro_needs_reentrant"
79 tmp_need_reentrant="yes"
86 dnl CURL_CHECK_NEED_REENTRANT_GMTIME_R
87 dnl -------------------------------------------------
88 dnl Checks if the preprocessor _REENTRANT definition
89 dnl makes function gmtime_r compiler visible.
91 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GMTIME_R], [
93 AC_LANG_FUNC_LINK_TRY([gmtime_r])
99 if test "$tmp_gmtime_r" = "yes"; then
100 AC_EGREP_CPP([gmtime_r],[
101 #include <sys/types.h>
104 tmp_gmtime_r="proto_declared"
106 AC_EGREP_CPP([gmtime_r],[
108 #include <sys/types.h>
111 tmp_gmtime_r="proto_needs_reentrant"
112 tmp_need_reentrant="yes"
119 dnl CURL_CHECK_NEED_REENTRANT_LOCALTIME_R
120 dnl -------------------------------------------------
121 dnl Checks if the preprocessor _REENTRANT definition
122 dnl makes function localtime_r compiler visible.
124 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_LOCALTIME_R], [
126 AC_LANG_FUNC_LINK_TRY([localtime_r])
128 tmp_localtime_r="yes"
132 if test "$tmp_localtime_r" = "yes"; then
133 AC_EGREP_CPP([localtime_r],[
134 #include <sys/types.h>
137 tmp_localtime_r="proto_declared"
139 AC_EGREP_CPP([localtime_r],[
141 #include <sys/types.h>
144 tmp_localtime_r="proto_needs_reentrant"
145 tmp_need_reentrant="yes"
152 dnl CURL_CHECK_NEED_REENTRANT_STRERROR_R
153 dnl -------------------------------------------------
154 dnl Checks if the preprocessor _REENTRANT definition
155 dnl makes function strerror_r compiler visible.
157 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRERROR_R], [
159 AC_LANG_FUNC_LINK_TRY([strerror_r])
165 if test "$tmp_strerror_r" = "yes"; then
166 AC_EGREP_CPP([strerror_r],[
167 #include <sys/types.h>
170 tmp_strerror_r="proto_declared"
172 AC_EGREP_CPP([strerror_r],[
174 #include <sys/types.h>
177 tmp_strerror_r="proto_needs_reentrant"
178 tmp_need_reentrant="yes"
185 dnl CURL_CHECK_NEED_REENTRANT_STRTOK_R
186 dnl -------------------------------------------------
187 dnl Checks if the preprocessor _REENTRANT definition
188 dnl makes function strtok_r compiler visible.
190 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_STRTOK_R], [
192 AC_LANG_FUNC_LINK_TRY([strtok_r])
198 if test "$tmp_strtok_r" = "yes"; then
199 AC_EGREP_CPP([strtok_r],[
200 #include <sys/types.h>
203 tmp_strtok_r="proto_declared"
205 AC_EGREP_CPP([strtok_r],[
207 #include <sys/types.h>
210 tmp_strtok_r="proto_needs_reentrant"
211 tmp_need_reentrant="yes"
218 dnl CURL_CHECK_NEED_REENTRANT_INET_NTOA_R
219 dnl -------------------------------------------------
220 dnl Checks if the preprocessor _REENTRANT definition
221 dnl makes function inet_ntoa_r compiler visible.
223 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_INET_NTOA_R], [
225 AC_LANG_FUNC_LINK_TRY([inet_ntoa_r])
227 tmp_inet_ntoa_r="yes"
231 if test "$tmp_inet_ntoa_r" = "yes"; then
232 AC_EGREP_CPP([inet_ntoa_r],[
233 #include <sys/types.h>
234 #include <sys/socket.h>
235 #include <netinet/in.h>
236 #include <arpa/inet.h>
238 tmp_inet_ntoa_r="proto_declared"
240 AC_EGREP_CPP([inet_ntoa_r],[
242 #include <sys/types.h>
243 #include <sys/socket.h>
244 #include <netinet/in.h>
245 #include <arpa/inet.h>
247 tmp_inet_ntoa_r="proto_needs_reentrant"
248 tmp_need_reentrant="yes"
255 dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
256 dnl -------------------------------------------------
257 dnl Checks if the preprocessor _REENTRANT definition
258 dnl makes function gethostbyaddr_r compiler visible.
260 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R], [
262 AC_LANG_FUNC_LINK_TRY([gethostbyaddr_r])
264 tmp_gethostbyaddr_r="yes"
266 tmp_gethostbyaddr_r="no"
268 if test "$tmp_gethostbyaddr_r" = "yes"; then
269 AC_EGREP_CPP([gethostbyaddr_r],[
270 #include <sys/types.h>
273 tmp_gethostbyaddr_r="proto_declared"
275 AC_EGREP_CPP([gethostbyaddr_r],[
277 #include <sys/types.h>
280 tmp_gethostbyaddr_r="proto_needs_reentrant"
281 tmp_need_reentrant="yes"
288 dnl CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
289 dnl -------------------------------------------------
290 dnl Checks if the preprocessor _REENTRANT definition
291 dnl makes function gethostbyname_r compiler visible.
293 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R], [
295 AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
297 tmp_gethostbyname_r="yes"
299 tmp_gethostbyname_r="no"
301 if test "$tmp_gethostbyname_r" = "yes"; then
302 AC_EGREP_CPP([gethostbyname_r],[
303 #include <sys/types.h>
306 tmp_gethostbyname_r="proto_declared"
308 AC_EGREP_CPP([gethostbyname_r],[
310 #include <sys/types.h>
313 tmp_gethostbyname_r="proto_needs_reentrant"
314 tmp_need_reentrant="yes"
321 dnl CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
322 dnl -------------------------------------------------
323 dnl Checks if the preprocessor _REENTRANT definition
324 dnl makes function getprotobyname_r compiler visible.
326 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R], [
328 AC_LANG_FUNC_LINK_TRY([getprotobyname_r])
330 tmp_getprotobyname_r="yes"
332 tmp_getprotobyname_r="no"
334 if test "$tmp_getprotobyname_r" = "yes"; then
335 AC_EGREP_CPP([getprotobyname_r],[
336 #include <sys/types.h>
339 tmp_getprotobyname_r="proto_declared"
341 AC_EGREP_CPP([getprotobyname_r],[
343 #include <sys/types.h>
346 tmp_getprotobyname_r="proto_needs_reentrant"
347 tmp_need_reentrant="yes"
354 dnl CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R
355 dnl -------------------------------------------------
356 dnl Checks if the preprocessor _REENTRANT definition
357 dnl makes function getservbyport_r compiler visible.
359 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R], [
361 AC_LANG_FUNC_LINK_TRY([getservbyport_r])
363 tmp_getservbyport_r="yes"
365 tmp_getservbyport_r="no"
367 if test "$tmp_getservbyport_r" = "yes"; then
368 AC_EGREP_CPP([getservbyport_r],[
369 #include <sys/types.h>
372 tmp_getservbyport_r="proto_declared"
374 AC_EGREP_CPP([getservbyport_r],[
376 #include <sys/types.h>
379 tmp_getservbyport_r="proto_needs_reentrant"
380 tmp_need_reentrant="yes"
387 dnl CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R
388 dnl -------------------------------------------------
389 dnl Checks if the preprocessor _REENTRANT definition
390 dnl makes several _r functions compiler visible.
391 dnl Internal macro for CURL_CONFIGURE_REENTRANT.
393 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R], [
394 if test "$tmp_need_reentrant" = "no"; then
395 CURL_CHECK_NEED_REENTRANT_GMTIME_R
397 if test "$tmp_need_reentrant" = "no"; then
398 CURL_CHECK_NEED_REENTRANT_LOCALTIME_R
400 if test "$tmp_need_reentrant" = "no"; then
401 CURL_CHECK_NEED_REENTRANT_STRERROR_R
403 if test "$tmp_need_reentrant" = "no"; then
404 CURL_CHECK_NEED_REENTRANT_STRTOK_R
406 if test "$tmp_need_reentrant" = "no"; then
407 CURL_CHECK_NEED_REENTRANT_INET_NTOA_R
409 if test "$tmp_need_reentrant" = "no"; then
410 CURL_CHECK_NEED_REENTRANT_GETHOSTBYADDR_R
412 if test "$tmp_need_reentrant" = "no"; then
413 CURL_CHECK_NEED_REENTRANT_GETHOSTBYNAME_R
415 if test "$tmp_need_reentrant" = "no"; then
416 CURL_CHECK_NEED_REENTRANT_GETPROTOBYNAME_R
418 if test "$tmp_need_reentrant" = "no"; then
419 CURL_CHECK_NEED_REENTRANT_GETSERVBYPORT_R
424 dnl CURL_CHECK_NEED_REENTRANT_SYSTEM
425 dnl -------------------------------------------------
426 dnl Checks if the preprocessor _REENTRANT definition
427 dnl must be unconditionally done for this platform.
428 dnl Internal macro for CURL_CONFIGURE_REENTRANT.
430 AC_DEFUN([CURL_CHECK_NEED_REENTRANT_SYSTEM], [
433 tmp_need_reentrant="yes"
436 tmp_need_reentrant="no"
442 dnl CURL_CHECK_NEED_THREAD_SAFE_SYSTEM
443 dnl -------------------------------------------------
444 dnl Checks if the preprocessor _THREAD_SAFE definition
445 dnl must be unconditionally done for this platform.
446 dnl Internal macro for CURL_CONFIGURE_THREAD_SAFE.
448 AC_DEFUN([CURL_CHECK_NEED_THREAD_SAFE_SYSTEM], [
450 aix[[123]].* | aix4.[[012]].*)
451 dnl aix 4.2 and older
452 tmp_need_thread_safe="no"
455 dnl AIX 4.3 and newer
456 tmp_need_thread_safe="yes"
459 tmp_need_thread_safe="no"
465 dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
466 dnl -------------------------------------------------
467 dnl This macro ensures that configuration tests done
468 dnl after this will execute with preprocessor symbol
469 dnl _REENTRANT defined. This macro also ensures that
470 dnl the generated config file defines NEED_REENTRANT
471 dnl and that in turn setup.h will define _REENTRANT.
472 dnl Internal macro for CURL_CONFIGURE_REENTRANT.
474 AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [
475 AC_DEFINE(NEED_REENTRANT, 1,
476 [Define to 1 if _REENTRANT preprocessor symbol must be defined.])
477 cat >>confdefs.h <<_EOF
485 dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE
486 dnl -------------------------------------------------
487 dnl This macro ensures that configuration tests done
488 dnl after this will execute with preprocessor symbol
489 dnl _THREAD_SAFE defined. This macro also ensures that
490 dnl the generated config file defines NEED_THREAD_SAFE
491 dnl and that in turn setup.h will define _THREAD_SAFE.
492 dnl Internal macro for CURL_CONFIGURE_THREAD_SAFE.
494 AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE], [
495 AC_DEFINE(NEED_THREAD_SAFE, 1,
496 [Define to 1 if _THREAD_SAFE preprocessor symbol must be defined.])
497 cat >>confdefs.h <<_EOF
499 # define _THREAD_SAFE
505 dnl CURL_CONFIGURE_REENTRANT
506 dnl -------------------------------------------------
507 dnl This first checks if the preprocessor _REENTRANT
508 dnl symbol is already defined. If it isn't currently
509 dnl defined a set of checks are performed to verify
510 dnl if its definition is required to make visible to
511 dnl the compiler a set of *_r functions. Finally, if
512 dnl _REENTRANT is already defined or needed it takes
513 dnl care of making adjustments necessary to ensure
514 dnl that it is defined equally for further configure
515 dnl tests and generated config file.
517 AC_DEFUN([CURL_CONFIGURE_REENTRANT], [
520 AC_MSG_CHECKING([if _REENTRANT is already defined])
527 force compilation error
532 tmp_reentrant_initially_defined="yes"
535 tmp_reentrant_initially_defined="no"
538 if test "$tmp_reentrant_initially_defined" = "no"; then
539 AC_MSG_CHECKING([if _REENTRANT is actually needed])
540 CURL_CHECK_NEED_REENTRANT_SYSTEM
541 if test "$tmp_need_reentrant" = "no"; then
542 CURL_CHECK_NEED_REENTRANT_ERRNO
544 if test "$tmp_need_reentrant" = "no"; then
545 CURL_CHECK_NEED_REENTRANT_FUNCTIONS_R
547 if test "$tmp_need_reentrant" = "yes"; then
554 AC_MSG_CHECKING([if _REENTRANT is onwards defined])
555 if test "$tmp_reentrant_initially_defined" = "yes" ||
556 test "$tmp_need_reentrant" = "yes"; then
557 CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
566 dnl CURL_CONFIGURE_THREAD_SAFE
567 dnl -------------------------------------------------
568 dnl This first checks if the preprocessor _THREAD_SAFE
569 dnl symbol is already defined. If it isn't currently
570 dnl defined a set of checks are performed to verify
571 dnl if its definition is required. Finally, if
572 dnl _THREAD_SAFE is already defined or needed it takes
573 dnl care of making adjustments necessary to ensure
574 dnl that it is defined equally for further configure
575 dnl tests and generated config file.
577 AC_DEFUN([CURL_CONFIGURE_THREAD_SAFE], [
580 AC_MSG_CHECKING([if _THREAD_SAFE is already defined])
587 force compilation error
592 tmp_thread_safe_initially_defined="yes"
595 tmp_thread_safe_initially_defined="no"
598 if test "$tmp_thread_safe_initially_defined" = "no"; then
599 AC_MSG_CHECKING([if _THREAD_SAFE is actually needed])
600 CURL_CHECK_NEED_THREAD_SAFE_SYSTEM
601 if test "$tmp_need_thread_safe" = "yes"; then
608 AC_MSG_CHECKING([if _THREAD_SAFE is onwards defined])
609 if test "$tmp_thread_safe_initially_defined" = "yes" ||
610 test "$tmp_need_thread_safe" = "yes"; then
611 CURL_CONFIGURE_FROM_NOW_ON_WITH_THREAD_SAFE