1 #***************************************************************************
3 # Project ___| | | | _ \| |
5 # | (__| |_| | _ <| |___
6 # \___|\___/|_| \_\_____|
8 # Copyright (C) 1998 - 2008, 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.
28 dnl CURL_INCLUDES_SIGNAL
29 dnl -------------------------------------------------
30 dnl Set up variable with list of headers that must be
31 dnl included when signal.h is to be included.
33 AC_DEFUN([CURL_INCLUDES_SIGNAL], [
34 curl_includes_signal="\
36 #ifdef HAVE_SYS_TYPES_H
37 # include <sys/types.h>
45 [], [], [$curl_includes_signal])
49 dnl CURL_INCLUDES_STDLIB
50 dnl -------------------------------------------------
51 dnl Set up variable with list of headers that must be
52 dnl included when stdlib.h is to be included.
54 AC_DEFUN([CURL_INCLUDES_STDLIB], [
55 curl_includes_stdlib="\
57 #ifdef HAVE_SYS_TYPES_H
58 # include <sys/types.h>
66 [], [], [$curl_includes_stdlib])
70 dnl CURL_INCLUDES_STRING
71 dnl -------------------------------------------------
72 dnl Set up variable with list of headers that must be
73 dnl included when string.h is to be included.
75 AC_DEFUN([CURL_INCLUDES_STRING], [
76 curl_includes_string="\
78 #ifdef HAVE_SYS_TYPES_H
79 # include <sys/types.h>
87 [], [], [$curl_includes_string])
91 dnl CURL_INCLUDES_TIME
92 dnl -------------------------------------------------
93 dnl Set up variable with list of headers that must be
94 dnl included when time.h is to be included.
96 AC_DEFUN([CURL_INCLUDES_TIME], [
97 AC_REQUIRE([AC_HEADER_TIME])dnl
100 #ifdef HAVE_SYS_TYPES_H
101 # include <sys/types.h>
103 #ifdef HAVE_SYS_TIME_H
104 # include <sys/time.h>
105 # ifdef TIME_WITH_SYS_TIME
115 sys/types.h sys/time.h time.h,
116 [], [], [$curl_includes_time])
120 dnl CURL_INCLUDES_UNISTD
121 dnl -------------------------------------------------
122 dnl Set up variable with list of headers that must be
123 dnl included when unistd.h is to be included.
125 AC_DEFUN([CURL_INCLUDES_UNISTD], [
126 curl_includes_unistd="\
128 #ifdef HAVE_SYS_TYPES_H
129 # include <sys/types.h>
136 sys/types.h unistd.h,
137 [], [], [$curl_includes_unistd])
141 dnl CURL_CHECK_FUNC_FTRUNCATE
142 dnl -------------------------------------------------
143 dnl Verify if ftruncate is available, prototyped, and
144 dnl can be compiled. If all of these are true, and
145 dnl usage has not been previously disallowed with
146 dnl shell variable curl_disallow_ftruncate, then
147 dnl HAVE_FTRUNCATE will be defined.
149 AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
150 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
152 tst_links_ftruncate="unknown"
153 tst_proto_ftruncate="unknown"
154 tst_compi_ftruncate="unknown"
155 tst_allow_ftruncate="unknown"
157 AC_MSG_CHECKING([if ftruncate can be linked])
159 AC_LANG_FUNC_LINK_TRY([ftruncate])
162 tst_links_ftruncate="yes"
165 tst_links_ftruncate="no"
168 if test "$tst_links_ftruncate" = "yes"; then
169 AC_MSG_CHECKING([if ftruncate is prototyped])
170 AC_EGREP_CPP([ftruncate],[
171 $curl_includes_unistd
174 tst_proto_ftruncate="yes"
177 tst_proto_ftruncate="no"
181 if test "$tst_proto_ftruncate" = "yes"; then
182 AC_MSG_CHECKING([if ftruncate is compilable])
185 $curl_includes_unistd
187 if(0 != ftruncate(0, 0))
192 tst_compi_ftruncate="yes"
195 tst_compi_ftruncate="no"
199 if test "$tst_compi_ftruncate" = "yes"; then
200 AC_MSG_CHECKING([if ftruncate usage allowed])
201 if test "x$curl_disallow_ftruncate" != "xyes"; then
203 tst_allow_ftruncate="yes"
206 tst_allow_ftruncate="no"
210 AC_MSG_CHECKING([if ftruncate might be used])
211 if test "$tst_links_ftruncate" = "yes" &&
212 test "$tst_proto_ftruncate" = "yes" &&
213 test "$tst_compi_ftruncate" = "yes" &&
214 test "$tst_allow_ftruncate" = "yes"; then
216 AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1,
217 [Define to 1 if you have the ftruncate function.])
218 ac_cv_func_ftruncate="yes"
221 ac_cv_func_ftruncate="no"
226 dnl CURL_CHECK_FUNC_GMTIME_R
227 dnl -------------------------------------------------
228 dnl Verify if gmtime_r is available, prototyped, can
229 dnl be compiled and seems to work. If all of these are
230 dnl true, and usage has not been previously disallowed
231 dnl with shell variable curl_disallow_gmtime_r, then
232 dnl HAVE_GMTIME_R will be defined.
234 AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
235 AC_REQUIRE([CURL_INCLUDES_TIME])dnl
237 tst_links_gmtime_r="unknown"
238 tst_proto_gmtime_r="unknown"
239 tst_compi_gmtime_r="unknown"
240 tst_works_gmtime_r="unknown"
241 tst_allow_gmtime_r="unknown"
243 AC_MSG_CHECKING([if gmtime_r can be linked])
245 AC_LANG_FUNC_LINK_TRY([gmtime_r])
248 tst_links_gmtime_r="yes"
251 tst_links_gmtime_r="no"
254 if test "$tst_links_gmtime_r" = "yes"; then
255 AC_MSG_CHECKING([if gmtime_r is prototyped])
256 AC_EGREP_CPP([gmtime_r],[
260 tst_proto_gmtime_r="yes"
263 tst_proto_gmtime_r="no"
267 if test "$tst_proto_gmtime_r" = "yes"; then
268 AC_MSG_CHECKING([if gmtime_r is compilable])
273 if(0 != gmtime_r(0, 0))
278 tst_compi_gmtime_r="yes"
281 tst_compi_gmtime_r="no"
285 dnl only do runtime verification when not cross-compiling
286 if test "x$cross_compiling" != "xyes" &&
287 test "$tst_compi_gmtime_r" = "yes"; then
288 AC_MSG_CHECKING([if gmtime_r seems to work])
293 time_t local = 1170352587;
296 gmt = gmtime_r(&local, &result);
304 tst_works_gmtime_r="yes"
307 tst_works_gmtime_r="no"
311 if test "$tst_works_gmtime_r" != "no"; then
312 AC_MSG_CHECKING([if gmtime_r usage allowed])
313 if test "x$curl_disallow_gmtime_r" != "xyes"; then
315 tst_allow_gmtime_r="yes"
318 tst_allow_gmtime_r="no"
322 AC_MSG_CHECKING([if gmtime_r might be used])
323 if test "$tst_links_gmtime_r" = "yes" &&
324 test "$tst_proto_gmtime_r" = "yes" &&
325 test "$tst_compi_gmtime_r" = "yes" &&
326 test "$tst_allow_gmtime_r" = "yes" &&
327 test "$tst_works_gmtime_r" != "no"; then
329 AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
330 [Define to 1 if you have a working gmtime_r function.])
331 ac_cv_func_gmtime_r="yes"
334 ac_cv_func_gmtime_r="no"
339 dnl CURL_CHECK_FUNC_SIGACTION
340 dnl -------------------------------------------------
341 dnl Verify if sigaction is available, prototyped, and
342 dnl can be compiled. If all of these are true, and
343 dnl usage has not been previously disallowed with
344 dnl shell variable curl_disallow_sigaction, then
345 dnl HAVE_SIGACTION will be defined.
347 AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
348 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
350 tst_links_sigaction="unknown"
351 tst_proto_sigaction="unknown"
352 tst_compi_sigaction="unknown"
353 tst_allow_sigaction="unknown"
355 AC_MSG_CHECKING([if sigaction can be linked])
357 AC_LANG_FUNC_LINK_TRY([sigaction])
360 tst_links_sigaction="yes"
363 tst_links_sigaction="no"
366 if test "$tst_links_sigaction" = "yes"; then
367 AC_MSG_CHECKING([if sigaction is prototyped])
368 AC_EGREP_CPP([sigaction],[
369 $curl_includes_signal
372 tst_proto_sigaction="yes"
375 tst_proto_sigaction="no"
379 if test "$tst_proto_sigaction" = "yes"; then
380 AC_MSG_CHECKING([if sigaction is compilable])
383 $curl_includes_signal
385 if(0 != sigaction(0, 0, 0))
390 tst_compi_sigaction="yes"
393 tst_compi_sigaction="no"
397 if test "$tst_compi_sigaction" = "yes"; then
398 AC_MSG_CHECKING([if sigaction usage allowed])
399 if test "x$curl_disallow_sigaction" != "xyes"; then
401 tst_allow_sigaction="yes"
404 tst_allow_sigaction="no"
408 AC_MSG_CHECKING([if sigaction might be used])
409 if test "$tst_links_sigaction" = "yes" &&
410 test "$tst_proto_sigaction" = "yes" &&
411 test "$tst_compi_sigaction" = "yes" &&
412 test "$tst_allow_sigaction" = "yes"; then
414 AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
415 [Define to 1 if you have the sigaction function.])
416 ac_cv_func_sigaction="yes"
419 ac_cv_func_sigaction="no"
424 dnl CURL_CHECK_FUNC_STRDUP
425 dnl -------------------------------------------------
426 dnl Verify if strdup is available, prototyped, and
427 dnl can be compiled. If all of these are true, and
428 dnl usage has not been previously disallowed with
429 dnl shell variable curl_disallow_strdup, then
430 dnl HAVE_STRDUP will be defined.
432 AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
433 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
435 tst_links_strdup="unknown"
436 tst_proto_strdup="unknown"
437 tst_compi_strdup="unknown"
438 tst_allow_strdup="unknown"
440 AC_MSG_CHECKING([if strdup can be linked])
442 AC_LANG_FUNC_LINK_TRY([strdup])
445 tst_links_strdup="yes"
448 tst_links_strdup="no"
451 if test "$tst_links_strdup" = "yes"; then
452 AC_MSG_CHECKING([if strdup is prototyped])
453 AC_EGREP_CPP([strdup],[
454 $curl_includes_string
457 tst_proto_strdup="yes"
460 tst_proto_strdup="no"
464 if test "$tst_proto_strdup" = "yes"; then
465 AC_MSG_CHECKING([if strdup is compilable])
468 $curl_includes_string
475 tst_compi_strdup="yes"
478 tst_compi_strdup="no"
482 if test "$tst_compi_strdup" = "yes"; then
483 AC_MSG_CHECKING([if strdup usage allowed])
484 if test "x$curl_disallow_strdup" != "xyes"; then
486 tst_allow_strdup="yes"
489 tst_allow_strdup="no"
493 AC_MSG_CHECKING([if strdup might be used])
494 if test "$tst_links_strdup" = "yes" &&
495 test "$tst_proto_strdup" = "yes" &&
496 test "$tst_compi_strdup" = "yes" &&
497 test "$tst_allow_strdup" = "yes"; then
499 AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
500 [Define to 1 if you have the strdup function.])
501 ac_cv_func_strdup="yes"
504 ac_cv_func_strdup="no"
509 dnl CURL_CHECK_FUNC_STRTOK_R
510 dnl -------------------------------------------------
511 dnl Verify if strtok_r is available, prototyped, and
512 dnl can be compiled. If all of these are true, and
513 dnl usage has not been previously disallowed with
514 dnl shell variable curl_disallow_strtok_r, then
515 dnl HAVE_STRTOK_R will be defined.
517 AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
518 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
520 tst_links_strtok_r="unknown"
521 tst_proto_strtok_r="unknown"
522 tst_compi_strtok_r="unknown"
523 tst_allow_strtok_r="unknown"
525 AC_MSG_CHECKING([if strtok_r can be linked])
527 AC_LANG_FUNC_LINK_TRY([strtok_r])
530 tst_links_strtok_r="yes"
533 tst_links_strtok_r="no"
536 if test "$tst_links_strtok_r" = "yes"; then
537 AC_MSG_CHECKING([if strtok_r is prototyped])
538 AC_EGREP_CPP([strtok_r],[
539 $curl_includes_string
542 tst_proto_strtok_r="yes"
545 tst_proto_strtok_r="no"
549 if test "$tst_proto_strtok_r" = "yes"; then
550 AC_MSG_CHECKING([if strtok_r is compilable])
553 $curl_includes_string
555 if(0 != strtok_r(0, 0, 0))
560 tst_compi_strtok_r="yes"
563 tst_compi_strtok_r="no"
567 if test "$tst_compi_strtok_r" = "yes"; then
568 AC_MSG_CHECKING([if strtok_r usage allowed])
569 if test "x$curl_disallow_strtok_r" != "xyes"; then
571 tst_allow_strtok_r="yes"
574 tst_allow_strtok_r="no"
578 AC_MSG_CHECKING([if strtok_r might be used])
579 if test "$tst_links_strtok_r" = "yes" &&
580 test "$tst_proto_strtok_r" = "yes" &&
581 test "$tst_compi_strtok_r" = "yes" &&
582 test "$tst_allow_strtok_r" = "yes"; then
584 AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
585 [Define to 1 if you have the strtok_r function.])
586 ac_cv_func_strtok_r="yes"
589 ac_cv_func_strtok_r="no"
594 dnl CURL_CHECK_FUNC_STRTOLL
595 dnl -------------------------------------------------
596 dnl Verify if strtoll is available, prototyped, and
597 dnl can be compiled. If all of these are true, and
598 dnl usage has not been previously disallowed with
599 dnl shell variable curl_disallow_strtoll, then
600 dnl HAVE_STRTOLL will be defined.
602 AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
603 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
605 tst_links_strtoll="unknown"
606 tst_proto_strtoll="unknown"
607 tst_compi_strtoll="unknown"
608 tst_allow_strtoll="unknown"
610 AC_MSG_CHECKING([if strtoll can be linked])
612 AC_LANG_FUNC_LINK_TRY([strtoll])
615 tst_links_strtoll="yes"
618 tst_links_strtoll="no"
621 if test "$tst_links_strtoll" = "yes"; then
622 AC_MSG_CHECKING([if strtoll is prototyped])
623 AC_EGREP_CPP([strtoll],[
624 $curl_includes_stdlib
627 tst_proto_strtoll="yes"
630 tst_proto_strtoll="no"
634 if test "$tst_proto_strtoll" = "yes"; then
635 AC_MSG_CHECKING([if strtoll is compilable])
638 $curl_includes_stdlib
640 if(0 != strtoll(0, 0, 0))
645 tst_compi_strtoll="yes"
648 tst_compi_strtoll="no"
652 if test "$tst_compi_strtoll" = "yes"; then
653 AC_MSG_CHECKING([if strtoll usage allowed])
654 if test "x$curl_disallow_strtoll" != "xyes"; then
656 tst_allow_strtoll="yes"
659 tst_allow_strtoll="no"
663 AC_MSG_CHECKING([if strtoll might be used])
664 if test "$tst_links_strtoll" = "yes" &&
665 test "$tst_proto_strtoll" = "yes" &&
666 test "$tst_compi_strtoll" = "yes" &&
667 test "$tst_allow_strtoll" = "yes"; then
669 AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
670 [Define to 1 if you have the strtoll function.])
671 ac_cv_func_strtoll="yes"
674 ac_cv_func_strtoll="no"