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_STDIO
50 dnl -------------------------------------------------
51 dnl Set up variable with list of headers that must be
52 dnl included when stdio.h is to be included.
54 AC_DEFUN([CURL_INCLUDES_STDIO], [
55 curl_includes_stdio="\
57 #ifdef HAVE_SYS_TYPES_H
58 # include <sys/types.h>
66 [], [], [$curl_includes_stdio])
70 dnl CURL_INCLUDES_STDLIB
71 dnl -------------------------------------------------
72 dnl Set up variable with list of headers that must be
73 dnl included when stdlib.h is to be included.
75 AC_DEFUN([CURL_INCLUDES_STDLIB], [
76 curl_includes_stdlib="\
78 #ifdef HAVE_SYS_TYPES_H
79 # include <sys/types.h>
87 [], [], [$curl_includes_stdlib])
91 dnl CURL_INCLUDES_STRING
92 dnl -------------------------------------------------
93 dnl Set up variable with list of headers that must be
94 dnl included when string(s).h is to be included.
96 AC_DEFUN([CURL_INCLUDES_STRING], [
97 curl_includes_string="\
99 #ifdef HAVE_SYS_TYPES_H
100 # include <sys/types.h>
105 #ifdef HAVE_STRINGS_H
106 # include <strings.h>
110 sys/types.h string.h strings.h,
111 [], [], [$curl_includes_string])
115 dnl CURL_INCLUDES_TIME
116 dnl -------------------------------------------------
117 dnl Set up variable with list of headers that must be
118 dnl included when time.h is to be included.
120 AC_DEFUN([CURL_INCLUDES_TIME], [
121 AC_REQUIRE([AC_HEADER_TIME])dnl
122 curl_includes_time="\
124 #ifdef HAVE_SYS_TYPES_H
125 # include <sys/types.h>
127 #ifdef HAVE_SYS_TIME_H
128 # include <sys/time.h>
129 # ifdef TIME_WITH_SYS_TIME
139 sys/types.h sys/time.h time.h,
140 [], [], [$curl_includes_time])
144 dnl CURL_INCLUDES_UNISTD
145 dnl -------------------------------------------------
146 dnl Set up variable with list of headers that must be
147 dnl included when unistd.h is to be included.
149 AC_DEFUN([CURL_INCLUDES_UNISTD], [
150 curl_includes_unistd="\
152 #ifdef HAVE_SYS_TYPES_H
153 # include <sys/types.h>
160 sys/types.h unistd.h,
161 [], [], [$curl_includes_unistd])
165 dnl CURL_CHECK_FUNC_FDOPEN
166 dnl -------------------------------------------------
167 dnl Verify if fdopen is available, prototyped, and
168 dnl can be compiled. If all of these are true, and
169 dnl usage has not been previously disallowed with
170 dnl shell variable curl_disallow_fdopen, then
171 dnl HAVE_FDOPEN will be defined.
173 AC_DEFUN([CURL_CHECK_FUNC_FDOPEN], [
174 AC_REQUIRE([CURL_INCLUDES_STDIO])dnl
176 tst_links_fdopen="unknown"
177 tst_proto_fdopen="unknown"
178 tst_compi_fdopen="unknown"
179 tst_allow_fdopen="unknown"
181 AC_MSG_CHECKING([if fdopen can be linked])
183 AC_LANG_FUNC_LINK_TRY([fdopen])
186 tst_links_fdopen="yes"
189 tst_links_fdopen="no"
192 if test "$tst_links_fdopen" = "yes"; then
193 AC_MSG_CHECKING([if fdopen is prototyped])
194 AC_EGREP_CPP([fdopen],[
198 tst_proto_fdopen="yes"
201 tst_proto_fdopen="no"
205 if test "$tst_proto_fdopen" = "yes"; then
206 AC_MSG_CHECKING([if fdopen is compilable])
211 if(0 != fdopen(0, 0))
216 tst_compi_fdopen="yes"
219 tst_compi_fdopen="no"
220 dnl temporary debug tracing follows
222 sed 's/^/cc-fail> /' conftest.err >&6
227 if test "$tst_compi_fdopen" = "yes"; then
228 AC_MSG_CHECKING([if fdopen usage allowed])
229 if test "x$curl_disallow_fdopen" != "xyes"; then
231 tst_allow_fdopen="yes"
234 tst_allow_fdopen="no"
238 AC_MSG_CHECKING([if fdopen might be used])
239 if test "$tst_links_fdopen" = "yes" &&
240 test "$tst_proto_fdopen" = "yes" &&
241 test "$tst_compi_fdopen" = "yes" &&
242 test "$tst_allow_fdopen" = "yes"; then
244 AC_DEFINE_UNQUOTED(HAVE_FDOPEN, 1,
245 [Define to 1 if you have the fdopen function.])
246 ac_cv_func_fdopen="yes"
249 ac_cv_func_fdopen="no"
254 dnl CURL_CHECK_FUNC_FTRUNCATE
255 dnl -------------------------------------------------
256 dnl Verify if ftruncate is available, prototyped, and
257 dnl can be compiled. If all of these are true, and
258 dnl usage has not been previously disallowed with
259 dnl shell variable curl_disallow_ftruncate, then
260 dnl HAVE_FTRUNCATE will be defined.
262 AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
263 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
265 tst_links_ftruncate="unknown"
266 tst_proto_ftruncate="unknown"
267 tst_compi_ftruncate="unknown"
268 tst_allow_ftruncate="unknown"
270 AC_MSG_CHECKING([if ftruncate can be linked])
272 AC_LANG_FUNC_LINK_TRY([ftruncate])
275 tst_links_ftruncate="yes"
278 tst_links_ftruncate="no"
281 if test "$tst_links_ftruncate" = "yes"; then
282 AC_MSG_CHECKING([if ftruncate is prototyped])
283 AC_EGREP_CPP([ftruncate],[
284 $curl_includes_unistd
287 tst_proto_ftruncate="yes"
290 tst_proto_ftruncate="no"
294 if test "$tst_proto_ftruncate" = "yes"; then
295 AC_MSG_CHECKING([if ftruncate is compilable])
298 $curl_includes_unistd
300 if(0 != ftruncate(0, 0))
305 tst_compi_ftruncate="yes"
308 tst_compi_ftruncate="no"
312 if test "$tst_compi_ftruncate" = "yes"; then
313 AC_MSG_CHECKING([if ftruncate usage allowed])
314 if test "x$curl_disallow_ftruncate" != "xyes"; then
316 tst_allow_ftruncate="yes"
319 tst_allow_ftruncate="no"
323 AC_MSG_CHECKING([if ftruncate might be used])
324 if test "$tst_links_ftruncate" = "yes" &&
325 test "$tst_proto_ftruncate" = "yes" &&
326 test "$tst_compi_ftruncate" = "yes" &&
327 test "$tst_allow_ftruncate" = "yes"; then
329 AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1,
330 [Define to 1 if you have the ftruncate function.])
331 ac_cv_func_ftruncate="yes"
334 ac_cv_func_ftruncate="no"
339 dnl CURL_CHECK_FUNC_GMTIME_R
340 dnl -------------------------------------------------
341 dnl Verify if gmtime_r is available, prototyped, can
342 dnl be compiled and seems to work. If all of these are
343 dnl true, and usage has not been previously disallowed
344 dnl with shell variable curl_disallow_gmtime_r, then
345 dnl HAVE_GMTIME_R will be defined.
347 AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
348 AC_REQUIRE([CURL_INCLUDES_TIME])dnl
350 tst_links_gmtime_r="unknown"
351 tst_proto_gmtime_r="unknown"
352 tst_compi_gmtime_r="unknown"
353 tst_works_gmtime_r="unknown"
354 tst_allow_gmtime_r="unknown"
356 AC_MSG_CHECKING([if gmtime_r can be linked])
358 AC_LANG_FUNC_LINK_TRY([gmtime_r])
361 tst_links_gmtime_r="yes"
364 tst_links_gmtime_r="no"
367 if test "$tst_links_gmtime_r" = "yes"; then
368 AC_MSG_CHECKING([if gmtime_r is prototyped])
369 AC_EGREP_CPP([gmtime_r],[
373 tst_proto_gmtime_r="yes"
376 tst_proto_gmtime_r="no"
380 if test "$tst_proto_gmtime_r" = "yes"; then
381 AC_MSG_CHECKING([if gmtime_r is compilable])
386 if(0 != gmtime_r(0, 0))
391 tst_compi_gmtime_r="yes"
394 tst_compi_gmtime_r="no"
398 dnl only do runtime verification when not cross-compiling
399 if test "x$cross_compiling" != "xyes" &&
400 test "$tst_compi_gmtime_r" = "yes"; then
401 AC_MSG_CHECKING([if gmtime_r seems to work])
406 time_t local = 1170352587;
409 gmt = gmtime_r(&local, &result);
417 tst_works_gmtime_r="yes"
420 tst_works_gmtime_r="no"
424 if test "$tst_compi_gmtime_r" = "yes" &&
425 test "$tst_works_gmtime_r" != "no"; then
426 AC_MSG_CHECKING([if gmtime_r usage allowed])
427 if test "x$curl_disallow_gmtime_r" != "xyes"; then
429 tst_allow_gmtime_r="yes"
432 tst_allow_gmtime_r="no"
436 AC_MSG_CHECKING([if gmtime_r might be used])
437 if test "$tst_links_gmtime_r" = "yes" &&
438 test "$tst_proto_gmtime_r" = "yes" &&
439 test "$tst_compi_gmtime_r" = "yes" &&
440 test "$tst_allow_gmtime_r" = "yes" &&
441 test "$tst_works_gmtime_r" != "no"; then
443 AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
444 [Define to 1 if you have a working gmtime_r function.])
445 ac_cv_func_gmtime_r="yes"
448 ac_cv_func_gmtime_r="no"
453 dnl CURL_CHECK_FUNC_SIGACTION
454 dnl -------------------------------------------------
455 dnl Verify if sigaction is available, prototyped, and
456 dnl can be compiled. If all of these are true, and
457 dnl usage has not been previously disallowed with
458 dnl shell variable curl_disallow_sigaction, then
459 dnl HAVE_SIGACTION will be defined.
461 AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
462 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
464 tst_links_sigaction="unknown"
465 tst_proto_sigaction="unknown"
466 tst_compi_sigaction="unknown"
467 tst_allow_sigaction="unknown"
469 AC_MSG_CHECKING([if sigaction can be linked])
471 AC_LANG_FUNC_LINK_TRY([sigaction])
474 tst_links_sigaction="yes"
477 tst_links_sigaction="no"
480 if test "$tst_links_sigaction" = "yes"; then
481 AC_MSG_CHECKING([if sigaction is prototyped])
482 AC_EGREP_CPP([sigaction],[
483 $curl_includes_signal
486 tst_proto_sigaction="yes"
489 tst_proto_sigaction="no"
493 if test "$tst_proto_sigaction" = "yes"; then
494 AC_MSG_CHECKING([if sigaction is compilable])
497 $curl_includes_signal
499 if(0 != sigaction(0, 0, 0))
504 tst_compi_sigaction="yes"
507 tst_compi_sigaction="no"
511 if test "$tst_compi_sigaction" = "yes"; then
512 AC_MSG_CHECKING([if sigaction usage allowed])
513 if test "x$curl_disallow_sigaction" != "xyes"; then
515 tst_allow_sigaction="yes"
518 tst_allow_sigaction="no"
522 AC_MSG_CHECKING([if sigaction might be used])
523 if test "$tst_links_sigaction" = "yes" &&
524 test "$tst_proto_sigaction" = "yes" &&
525 test "$tst_compi_sigaction" = "yes" &&
526 test "$tst_allow_sigaction" = "yes"; then
528 AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
529 [Define to 1 if you have the sigaction function.])
530 ac_cv_func_sigaction="yes"
533 ac_cv_func_sigaction="no"
538 dnl CURL_CHECK_FUNC_STRCASECMP
539 dnl -------------------------------------------------
540 dnl Verify if strcasecmp is available, prototyped, and
541 dnl can be compiled. If all of these are true, and
542 dnl usage has not been previously disallowed with
543 dnl shell variable curl_disallow_strcasecmp, then
544 dnl HAVE_STRCASECMP will be defined.
546 AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [
547 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
549 tst_links_strcasecmp="unknown"
550 tst_proto_strcasecmp="unknown"
551 tst_compi_strcasecmp="unknown"
552 tst_allow_strcasecmp="unknown"
554 AC_MSG_CHECKING([if strcasecmp can be linked])
556 AC_LANG_FUNC_LINK_TRY([strcasecmp])
559 tst_links_strcasecmp="yes"
562 tst_links_strcasecmp="no"
565 if test "$tst_links_strcasecmp" = "yes"; then
566 AC_MSG_CHECKING([if strcasecmp is prototyped])
567 AC_EGREP_CPP([strcasecmp],[
568 $curl_includes_string
571 tst_proto_strcasecmp="yes"
574 tst_proto_strcasecmp="no"
578 if test "$tst_proto_strcasecmp" = "yes"; then
579 AC_MSG_CHECKING([if strcasecmp is compilable])
582 $curl_includes_string
584 if(0 != strcasecmp(0, 0))
589 tst_compi_strcasecmp="yes"
592 tst_compi_strcasecmp="no"
596 if test "$tst_compi_strcasecmp" = "yes"; then
597 AC_MSG_CHECKING([if strcasecmp usage allowed])
598 if test "x$curl_disallow_strcasecmp" != "xyes"; then
600 tst_allow_strcasecmp="yes"
603 tst_allow_strcasecmp="no"
607 AC_MSG_CHECKING([if strcasecmp might be used])
608 if test "$tst_links_strcasecmp" = "yes" &&
609 test "$tst_proto_strcasecmp" = "yes" &&
610 test "$tst_compi_strcasecmp" = "yes" &&
611 test "$tst_allow_strcasecmp" = "yes"; then
613 AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
614 [Define to 1 if you have the strcasecmp function.])
615 ac_cv_func_strcasecmp="yes"
618 ac_cv_func_strcasecmp="no"
623 dnl CURL_CHECK_FUNC_STRCASESTR
624 dnl -------------------------------------------------
625 dnl Verify if strcasestr is available, prototyped, and
626 dnl can be compiled. If all of these are true, and
627 dnl usage has not been previously disallowed with
628 dnl shell variable curl_disallow_strcasestr, then
629 dnl HAVE_STRCASESTR will be defined.
631 AC_DEFUN([CURL_CHECK_FUNC_STRCASESTR], [
632 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
634 tst_links_strcasestr="unknown"
635 tst_proto_strcasestr="unknown"
636 tst_compi_strcasestr="unknown"
637 tst_allow_strcasestr="unknown"
639 AC_MSG_CHECKING([if strcasestr can be linked])
641 AC_LANG_FUNC_LINK_TRY([strcasestr])
644 tst_links_strcasestr="yes"
647 tst_links_strcasestr="no"
650 if test "$tst_links_strcasestr" = "yes"; then
651 AC_MSG_CHECKING([if strcasestr is prototyped])
652 AC_EGREP_CPP([strcasestr],[
653 $curl_includes_string
656 tst_proto_strcasestr="yes"
659 tst_proto_strcasestr="no"
663 if test "$tst_proto_strcasestr" = "yes"; then
664 AC_MSG_CHECKING([if strcasestr is compilable])
667 $curl_includes_string
669 if(0 != strcasestr(0, 0))
674 tst_compi_strcasestr="yes"
677 tst_compi_strcasestr="no"
681 if test "$tst_compi_strcasestr" = "yes"; then
682 AC_MSG_CHECKING([if strcasestr usage allowed])
683 if test "x$curl_disallow_strcasestr" != "xyes"; then
685 tst_allow_strcasestr="yes"
688 tst_allow_strcasestr="no"
692 AC_MSG_CHECKING([if strcasestr might be used])
693 if test "$tst_links_strcasestr" = "yes" &&
694 test "$tst_proto_strcasestr" = "yes" &&
695 test "$tst_compi_strcasestr" = "yes" &&
696 test "$tst_allow_strcasestr" = "yes"; then
698 AC_DEFINE_UNQUOTED(HAVE_STRCASESTR, 1,
699 [Define to 1 if you have the strcasestr function.])
700 ac_cv_func_strcasestr="yes"
703 ac_cv_func_strcasestr="no"
708 dnl CURL_CHECK_FUNC_STRCMPI
709 dnl -------------------------------------------------
710 dnl Verify if strcmpi is available, prototyped, and
711 dnl can be compiled. If all of these are true, and
712 dnl usage has not been previously disallowed with
713 dnl shell variable curl_disallow_strcmpi, then
714 dnl HAVE_STRCMPI will be defined.
716 AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [
717 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
719 tst_links_strcmpi="unknown"
720 tst_proto_strcmpi="unknown"
721 tst_compi_strcmpi="unknown"
722 tst_allow_strcmpi="unknown"
724 AC_MSG_CHECKING([if strcmpi can be linked])
726 AC_LANG_FUNC_LINK_TRY([strcmpi])
729 tst_links_strcmpi="yes"
732 tst_links_strcmpi="no"
735 if test "$tst_links_strcmpi" = "yes"; then
736 AC_MSG_CHECKING([if strcmpi is prototyped])
737 AC_EGREP_CPP([strcmpi],[
738 $curl_includes_string
741 tst_proto_strcmpi="yes"
744 tst_proto_strcmpi="no"
748 if test "$tst_proto_strcmpi" = "yes"; then
749 AC_MSG_CHECKING([if strcmpi is compilable])
752 $curl_includes_string
754 if(0 != strcmpi(0, 0))
759 tst_compi_strcmpi="yes"
762 tst_compi_strcmpi="no"
766 if test "$tst_compi_strcmpi" = "yes"; then
767 AC_MSG_CHECKING([if strcmpi usage allowed])
768 if test "x$curl_disallow_strcmpi" != "xyes"; then
770 tst_allow_strcmpi="yes"
773 tst_allow_strcmpi="no"
777 AC_MSG_CHECKING([if strcmpi might be used])
778 if test "$tst_links_strcmpi" = "yes" &&
779 test "$tst_proto_strcmpi" = "yes" &&
780 test "$tst_compi_strcmpi" = "yes" &&
781 test "$tst_allow_strcmpi" = "yes"; then
783 AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
784 [Define to 1 if you have the strcmpi function.])
785 ac_cv_func_strcmpi="yes"
788 ac_cv_func_strcmpi="no"
793 dnl CURL_CHECK_FUNC_STRDUP
794 dnl -------------------------------------------------
795 dnl Verify if strdup is available, prototyped, and
796 dnl can be compiled. If all of these are true, and
797 dnl usage has not been previously disallowed with
798 dnl shell variable curl_disallow_strdup, then
799 dnl HAVE_STRDUP will be defined.
801 AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
802 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
804 tst_links_strdup="unknown"
805 tst_proto_strdup="unknown"
806 tst_compi_strdup="unknown"
807 tst_allow_strdup="unknown"
809 AC_MSG_CHECKING([if strdup can be linked])
811 AC_LANG_FUNC_LINK_TRY([strdup])
814 tst_links_strdup="yes"
817 tst_links_strdup="no"
820 if test "$tst_links_strdup" = "yes"; then
821 AC_MSG_CHECKING([if strdup is prototyped])
822 AC_EGREP_CPP([strdup],[
823 $curl_includes_string
826 tst_proto_strdup="yes"
829 tst_proto_strdup="no"
833 if test "$tst_proto_strdup" = "yes"; then
834 AC_MSG_CHECKING([if strdup is compilable])
837 $curl_includes_string
844 tst_compi_strdup="yes"
847 tst_compi_strdup="no"
851 if test "$tst_compi_strdup" = "yes"; then
852 AC_MSG_CHECKING([if strdup usage allowed])
853 if test "x$curl_disallow_strdup" != "xyes"; then
855 tst_allow_strdup="yes"
858 tst_allow_strdup="no"
862 AC_MSG_CHECKING([if strdup might be used])
863 if test "$tst_links_strdup" = "yes" &&
864 test "$tst_proto_strdup" = "yes" &&
865 test "$tst_compi_strdup" = "yes" &&
866 test "$tst_allow_strdup" = "yes"; then
868 AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
869 [Define to 1 if you have the strdup function.])
870 ac_cv_func_strdup="yes"
873 ac_cv_func_strdup="no"
878 dnl CURL_CHECK_FUNC_STRERROR_R
879 dnl -------------------------------------------------
880 dnl Verify if strerror_r is available, prototyped, can be compiled and
881 dnl seems to work. If all of these are true, and usage has not been
882 dnl previously disallowed with shell variable curl_disallow_strerror_r,
883 dnl then HAVE_STRERROR_R and STRERROR_R_TYPE_ARG3 will be defined, as
884 dnl well as one of HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R.
886 dnl glibc-style strerror_r:
888 dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize);
890 dnl glibc-style strerror_r returns a pointer to the the error string,
891 dnl and might use the provided workbuf as a scratch area if needed. A
892 dnl quick test on a few systems shows that it's usually not used at all.
894 dnl POSIX-style strerror_r:
896 dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize);
898 dnl POSIX-style strerror_r returns 0 upon successful completion and the
899 dnl error string in the provided resultbuf.
902 AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
903 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
905 tst_links_strerror_r="unknown"
906 tst_proto_strerror_r="unknown"
907 tst_compi_strerror_r="unknown"
908 tst_glibc_strerror_r="unknown"
909 tst_posix_strerror_r="unknown"
910 tst_allow_strerror_r="unknown"
911 tst_works_glibc_strerror_r="unknown"
912 tst_works_posix_strerror_r="unknown"
913 tst_glibc_strerror_r_type_arg3="unknown"
914 tst_posix_strerror_r_type_arg3="unknown"
916 AC_MSG_CHECKING([if strerror_r can be linked])
918 AC_LANG_FUNC_LINK_TRY([strerror_r])
921 tst_links_strerror_r="yes"
924 tst_links_strerror_r="no"
927 if test "$tst_links_strerror_r" = "yes"; then
928 AC_MSG_CHECKING([if strerror_r is prototyped])
929 AC_EGREP_CPP([strerror_r],[
930 $curl_includes_string
933 tst_proto_strerror_r="yes"
936 tst_proto_strerror_r="no"
940 if test "$tst_proto_strerror_r" = "yes"; then
941 AC_MSG_CHECKING([if strerror_r is compilable])
944 $curl_includes_string
946 if(0 != strerror_r(0, 0, 0))
951 tst_compi_strerror_r="yes"
954 tst_compi_strerror_r="no"
958 if test "$tst_compi_strerror_r" = "yes"; then
959 AC_MSG_CHECKING([if strerror_r is glibc like])
960 tst_glibc_strerror_r_type_arg3="unknown"
961 for arg3 in 'size_t' 'int' 'unsigned int'; do
962 if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then
965 $curl_includes_string
967 char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
968 if(0 != strerror_r(0, 0, 0))
972 tst_glibc_strerror_r_type_arg3="$arg3"
976 case "$tst_glibc_strerror_r_type_arg3" in
979 tst_glibc_strerror_r="no"
983 tst_glibc_strerror_r="yes"
988 dnl only do runtime verification when not cross-compiling
989 if test "x$cross_compiling" != "xyes" &&
990 test "$tst_glibc_strerror_r" = "yes"; then
991 AC_MSG_CHECKING([if strerror_r seems to work])
994 $curl_includes_string
1000 string = strerror_r(EACCES, buffer, sizeof(buffer));
1009 AC_MSG_RESULT([yes])
1010 tst_works_glibc_strerror_r="yes"
1013 tst_works_glibc_strerror_r="no"
1017 if test "$tst_compi_strerror_r" = "yes" &&
1018 test "$tst_works_glibc_strerror_r" != "yes"; then
1019 AC_MSG_CHECKING([if strerror_r is POSIX like])
1020 tst_posix_strerror_r_type_arg3="unknown"
1021 for arg3 in 'size_t' 'int' 'unsigned int'; do
1022 if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then
1025 $curl_includes_string
1027 int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
1028 if(0 != strerror_r(0, 0, 0))
1032 tst_posix_strerror_r_type_arg3="$arg3"
1036 case "$tst_posix_strerror_r_type_arg3" in
1039 tst_posix_strerror_r="no"
1042 AC_MSG_RESULT([yes])
1043 tst_posix_strerror_r="yes"
1048 dnl only do runtime verification when not cross-compiling
1049 if test "x$cross_compiling" != "xyes" &&
1050 test "$tst_posix_strerror_r" = "yes"; then
1051 AC_MSG_CHECKING([if strerror_r seems to work])
1054 $curl_includes_string
1060 error = strerror_r(EACCES, buffer, sizeof(buffer));
1063 if(buffer[0] == '\0')
1069 AC_MSG_RESULT([yes])
1070 tst_works_posix_strerror_r="yes"
1073 tst_works_posix_strerror_r="no"
1077 if test "$tst_glibc_strerror_r" = "yes" &&
1078 test "$tst_works_glibc_strerror_r" != "no" &&
1079 test "$tst_posix_strerror_r" != "yes"; then
1080 tst_allow_strerror_r="check"
1082 if test "$tst_posix_strerror_r" = "yes" &&
1083 test "$tst_works_posix_strerror_r" != "no" &&
1084 test "$tst_glibc_strerror_r" != "yes"; then
1085 tst_allow_strerror_r="check"
1087 if test "$tst_allow_strerror_r" = "check"; then
1088 AC_MSG_CHECKING([if strerror_r usage allowed])
1089 if test "x$curl_disallow_strerror_r" != "xyes"; then
1090 AC_MSG_RESULT([yes])
1091 tst_allow_strerror_r="yes"
1094 tst_allow_strerror_r="no"
1098 AC_MSG_CHECKING([if strerror_r might be used])
1099 if test "$tst_links_strerror_r" = "yes" &&
1100 test "$tst_proto_strerror_r" = "yes" &&
1101 test "$tst_compi_strerror_r" = "yes" &&
1102 test "$tst_allow_strerror_r" = "yes"; then
1103 AC_MSG_RESULT([yes])
1104 if test "$tst_glibc_strerror_r" = "yes"; then
1105 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
1106 [Define to 1 if you have the strerror_r function.])
1107 AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1,
1108 [Define to 1 if you have a working glibc-style strerror_r function.])
1109 AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_glibc_strerror_r_type_arg3,
1110 [Define to the type of arg 3 for strerror_r.])
1112 if test "$tst_posix_strerror_r" = "yes"; then
1113 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
1114 [Define to 1 if you have the strerror_r function.])
1115 AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1,
1116 [Define to 1 if you have a working POSIX-style strerror_r function.])
1117 AC_DEFINE_UNQUOTED(STRERROR_R_TYPE_ARG3, $tst_posix_strerror_r_type_arg3,
1118 [Define to the type of arg 3 for strerror_r.])
1120 ac_cv_func_strerror_r="yes"
1123 ac_cv_func_strerror_r="no"
1126 if test "$tst_compi_strerror_r" = "yes" &&
1127 test "$tst_allow_strerror_r" = "unknown"; then
1128 AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually.])
1134 dnl CURL_CHECK_FUNC_STRICMP
1135 dnl -------------------------------------------------
1136 dnl Verify if stricmp is available, prototyped, and
1137 dnl can be compiled. If all of these are true, and
1138 dnl usage has not been previously disallowed with
1139 dnl shell variable curl_disallow_stricmp, then
1140 dnl HAVE_STRICMP will be defined.
1142 AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [
1143 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
1145 tst_links_stricmp="unknown"
1146 tst_proto_stricmp="unknown"
1147 tst_compi_stricmp="unknown"
1148 tst_allow_stricmp="unknown"
1150 AC_MSG_CHECKING([if stricmp can be linked])
1152 AC_LANG_FUNC_LINK_TRY([stricmp])
1154 AC_MSG_RESULT([yes])
1155 tst_links_stricmp="yes"
1158 tst_links_stricmp="no"
1161 if test "$tst_links_stricmp" = "yes"; then
1162 AC_MSG_CHECKING([if stricmp is prototyped])
1163 AC_EGREP_CPP([stricmp],[
1164 $curl_includes_string
1166 AC_MSG_RESULT([yes])
1167 tst_proto_stricmp="yes"
1170 tst_proto_stricmp="no"
1174 if test "$tst_proto_stricmp" = "yes"; then
1175 AC_MSG_CHECKING([if stricmp is compilable])
1178 $curl_includes_string
1180 if(0 != stricmp(0, 0))
1184 AC_MSG_RESULT([yes])
1185 tst_compi_stricmp="yes"
1188 tst_compi_stricmp="no"
1192 if test "$tst_compi_stricmp" = "yes"; then
1193 AC_MSG_CHECKING([if stricmp usage allowed])
1194 if test "x$curl_disallow_stricmp" != "xyes"; then
1195 AC_MSG_RESULT([yes])
1196 tst_allow_stricmp="yes"
1199 tst_allow_stricmp="no"
1203 AC_MSG_CHECKING([if stricmp might be used])
1204 if test "$tst_links_stricmp" = "yes" &&
1205 test "$tst_proto_stricmp" = "yes" &&
1206 test "$tst_compi_stricmp" = "yes" &&
1207 test "$tst_allow_stricmp" = "yes"; then
1208 AC_MSG_RESULT([yes])
1209 AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
1210 [Define to 1 if you have the stricmp function.])
1211 ac_cv_func_stricmp="yes"
1214 ac_cv_func_stricmp="no"
1219 dnl CURL_CHECK_FUNC_STRLCAT
1220 dnl -------------------------------------------------
1221 dnl Verify if strlcat is available, prototyped, and
1222 dnl can be compiled. If all of these are true, and
1223 dnl usage has not been previously disallowed with
1224 dnl shell variable curl_disallow_strlcat, then
1225 dnl HAVE_STRLCAT will be defined.
1227 AC_DEFUN([CURL_CHECK_FUNC_STRLCAT], [
1228 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
1230 tst_links_strlcat="unknown"
1231 tst_proto_strlcat="unknown"
1232 tst_compi_strlcat="unknown"
1233 tst_allow_strlcat="unknown"
1235 AC_MSG_CHECKING([if strlcat can be linked])
1237 AC_LANG_FUNC_LINK_TRY([strlcat])
1239 AC_MSG_RESULT([yes])
1240 tst_links_strlcat="yes"
1243 tst_links_strlcat="no"
1246 if test "$tst_links_strlcat" = "yes"; then
1247 AC_MSG_CHECKING([if strlcat is prototyped])
1248 AC_EGREP_CPP([strlcat],[
1249 $curl_includes_string
1251 AC_MSG_RESULT([yes])
1252 tst_proto_strlcat="yes"
1255 tst_proto_strlcat="no"
1259 if test "$tst_proto_strlcat" = "yes"; then
1260 AC_MSG_CHECKING([if strlcat is compilable])
1263 $curl_includes_string
1265 if(0 != strlcat(0, 0, 0))
1269 AC_MSG_RESULT([yes])
1270 tst_compi_strlcat="yes"
1273 tst_compi_strlcat="no"
1277 if test "$tst_compi_strlcat" = "yes"; then
1278 AC_MSG_CHECKING([if strlcat usage allowed])
1279 if test "x$curl_disallow_strlcat" != "xyes"; then
1280 AC_MSG_RESULT([yes])
1281 tst_allow_strlcat="yes"
1284 tst_allow_strlcat="no"
1288 AC_MSG_CHECKING([if strlcat might be used])
1289 if test "$tst_links_strlcat" = "yes" &&
1290 test "$tst_proto_strlcat" = "yes" &&
1291 test "$tst_compi_strlcat" = "yes" &&
1292 test "$tst_allow_strlcat" = "yes"; then
1293 AC_MSG_RESULT([yes])
1294 AC_DEFINE_UNQUOTED(HAVE_STRLCAT, 1,
1295 [Define to 1 if you have the strlcat function.])
1296 ac_cv_func_strlcat="yes"
1299 ac_cv_func_strlcat="no"
1304 dnl CURL_CHECK_FUNC_STRNCASECMP
1305 dnl -------------------------------------------------
1306 dnl Verify if strncasecmp is available, prototyped, and
1307 dnl can be compiled. If all of these are true, and
1308 dnl usage has not been previously disallowed with
1309 dnl shell variable curl_disallow_strncasecmp, then
1310 dnl HAVE_STRNCASECMP will be defined.
1312 AC_DEFUN([CURL_CHECK_FUNC_STRNCASECMP], [
1313 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
1315 tst_links_strncasecmp="unknown"
1316 tst_proto_strncasecmp="unknown"
1317 tst_compi_strncasecmp="unknown"
1318 tst_allow_strncasecmp="unknown"
1320 AC_MSG_CHECKING([if strncasecmp can be linked])
1322 AC_LANG_FUNC_LINK_TRY([strncasecmp])
1324 AC_MSG_RESULT([yes])
1325 tst_links_strncasecmp="yes"
1328 tst_links_strncasecmp="no"
1331 if test "$tst_links_strncasecmp" = "yes"; then
1332 AC_MSG_CHECKING([if strncasecmp is prototyped])
1333 AC_EGREP_CPP([strncasecmp],[
1334 $curl_includes_string
1336 AC_MSG_RESULT([yes])
1337 tst_proto_strncasecmp="yes"
1340 tst_proto_strncasecmp="no"
1344 if test "$tst_proto_strncasecmp" = "yes"; then
1345 AC_MSG_CHECKING([if strncasecmp is compilable])
1348 $curl_includes_string
1350 if(0 != strncasecmp(0, 0, 0))
1354 AC_MSG_RESULT([yes])
1355 tst_compi_strncasecmp="yes"
1358 tst_compi_strncasecmp="no"
1362 if test "$tst_compi_strncasecmp" = "yes"; then
1363 AC_MSG_CHECKING([if strncasecmp usage allowed])
1364 if test "x$curl_disallow_strncasecmp" != "xyes"; then
1365 AC_MSG_RESULT([yes])
1366 tst_allow_strncasecmp="yes"
1369 tst_allow_strncasecmp="no"
1373 AC_MSG_CHECKING([if strncasecmp might be used])
1374 if test "$tst_links_strncasecmp" = "yes" &&
1375 test "$tst_proto_strncasecmp" = "yes" &&
1376 test "$tst_compi_strncasecmp" = "yes" &&
1377 test "$tst_allow_strncasecmp" = "yes"; then
1378 AC_MSG_RESULT([yes])
1379 AC_DEFINE_UNQUOTED(HAVE_STRNCASECMP, 1,
1380 [Define to 1 if you have the strncasecmp function.])
1381 ac_cv_func_strncasecmp="yes"
1384 ac_cv_func_strncasecmp="no"
1389 dnl CURL_CHECK_FUNC_STRNCMPI
1390 dnl -------------------------------------------------
1391 dnl Verify if strncmpi is available, prototyped, and
1392 dnl can be compiled. If all of these are true, and
1393 dnl usage has not been previously disallowed with
1394 dnl shell variable curl_disallow_strncmpi, then
1395 dnl HAVE_STRNCMPI will be defined.
1397 AC_DEFUN([CURL_CHECK_FUNC_STRNCMPI], [
1398 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
1400 tst_links_strncmpi="unknown"
1401 tst_proto_strncmpi="unknown"
1402 tst_compi_strncmpi="unknown"
1403 tst_allow_strncmpi="unknown"
1405 AC_MSG_CHECKING([if strncmpi can be linked])
1407 AC_LANG_FUNC_LINK_TRY([strncmpi])
1409 AC_MSG_RESULT([yes])
1410 tst_links_strncmpi="yes"
1413 tst_links_strncmpi="no"
1416 if test "$tst_links_strncmpi" = "yes"; then
1417 AC_MSG_CHECKING([if strncmpi is prototyped])
1418 AC_EGREP_CPP([strncmpi],[
1419 $curl_includes_string
1421 AC_MSG_RESULT([yes])
1422 tst_proto_strncmpi="yes"
1425 tst_proto_strncmpi="no"
1429 if test "$tst_proto_strncmpi" = "yes"; then
1430 AC_MSG_CHECKING([if strncmpi is compilable])
1433 $curl_includes_string
1435 if(0 != strncmpi(0, 0))
1439 AC_MSG_RESULT([yes])
1440 tst_compi_strncmpi="yes"
1443 tst_compi_strncmpi="no"
1447 if test "$tst_compi_strncmpi" = "yes"; then
1448 AC_MSG_CHECKING([if strncmpi usage allowed])
1449 if test "x$curl_disallow_strncmpi" != "xyes"; then
1450 AC_MSG_RESULT([yes])
1451 tst_allow_strncmpi="yes"
1454 tst_allow_strncmpi="no"
1458 AC_MSG_CHECKING([if strncmpi might be used])
1459 if test "$tst_links_strncmpi" = "yes" &&
1460 test "$tst_proto_strncmpi" = "yes" &&
1461 test "$tst_compi_strncmpi" = "yes" &&
1462 test "$tst_allow_strncmpi" = "yes"; then
1463 AC_MSG_RESULT([yes])
1464 AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1,
1465 [Define to 1 if you have the strncmpi function.])
1466 ac_cv_func_strncmpi="yes"
1469 ac_cv_func_strncmpi="no"
1474 dnl CURL_CHECK_FUNC_STRNICMP
1475 dnl -------------------------------------------------
1476 dnl Verify if strnicmp is available, prototyped, and
1477 dnl can be compiled. If all of these are true, and
1478 dnl usage has not been previously disallowed with
1479 dnl shell variable curl_disallow_strnicmp, then
1480 dnl HAVE_STRNICMP will be defined.
1482 AC_DEFUN([CURL_CHECK_FUNC_STRNICMP], [
1483 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
1485 tst_links_strnicmp="unknown"
1486 tst_proto_strnicmp="unknown"
1487 tst_compi_strnicmp="unknown"
1488 tst_allow_strnicmp="unknown"
1490 AC_MSG_CHECKING([if strnicmp can be linked])
1492 AC_LANG_FUNC_LINK_TRY([strnicmp])
1494 AC_MSG_RESULT([yes])
1495 tst_links_strnicmp="yes"
1498 tst_links_strnicmp="no"
1501 if test "$tst_links_strnicmp" = "yes"; then
1502 AC_MSG_CHECKING([if strnicmp is prototyped])
1503 AC_EGREP_CPP([strnicmp],[
1504 $curl_includes_string
1506 AC_MSG_RESULT([yes])
1507 tst_proto_strnicmp="yes"
1510 tst_proto_strnicmp="no"
1514 if test "$tst_proto_strnicmp" = "yes"; then
1515 AC_MSG_CHECKING([if strnicmp is compilable])
1518 $curl_includes_string
1520 if(0 != strnicmp(0, 0))
1524 AC_MSG_RESULT([yes])
1525 tst_compi_strnicmp="yes"
1528 tst_compi_strnicmp="no"
1532 if test "$tst_compi_strnicmp" = "yes"; then
1533 AC_MSG_CHECKING([if strnicmp usage allowed])
1534 if test "x$curl_disallow_strnicmp" != "xyes"; then
1535 AC_MSG_RESULT([yes])
1536 tst_allow_strnicmp="yes"
1539 tst_allow_strnicmp="no"
1543 AC_MSG_CHECKING([if strnicmp might be used])
1544 if test "$tst_links_strnicmp" = "yes" &&
1545 test "$tst_proto_strnicmp" = "yes" &&
1546 test "$tst_compi_strnicmp" = "yes" &&
1547 test "$tst_allow_strnicmp" = "yes"; then
1548 AC_MSG_RESULT([yes])
1549 AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1,
1550 [Define to 1 if you have the strnicmp function.])
1551 ac_cv_func_strnicmp="yes"
1554 ac_cv_func_strnicmp="no"
1559 dnl CURL_CHECK_FUNC_STRTOK_R
1560 dnl -------------------------------------------------
1561 dnl Verify if strtok_r is available, prototyped, and
1562 dnl can be compiled. If all of these are true, and
1563 dnl usage has not been previously disallowed with
1564 dnl shell variable curl_disallow_strtok_r, then
1565 dnl HAVE_STRTOK_R will be defined.
1567 AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
1568 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
1570 tst_links_strtok_r="unknown"
1571 tst_proto_strtok_r="unknown"
1572 tst_compi_strtok_r="unknown"
1573 tst_allow_strtok_r="unknown"
1575 AC_MSG_CHECKING([if strtok_r can be linked])
1577 AC_LANG_FUNC_LINK_TRY([strtok_r])
1579 AC_MSG_RESULT([yes])
1580 tst_links_strtok_r="yes"
1583 tst_links_strtok_r="no"
1586 if test "$tst_links_strtok_r" = "yes"; then
1587 AC_MSG_CHECKING([if strtok_r is prototyped])
1588 AC_EGREP_CPP([strtok_r],[
1589 $curl_includes_string
1591 AC_MSG_RESULT([yes])
1592 tst_proto_strtok_r="yes"
1595 tst_proto_strtok_r="no"
1599 if test "$tst_proto_strtok_r" = "yes"; then
1600 AC_MSG_CHECKING([if strtok_r is compilable])
1603 $curl_includes_string
1605 if(0 != strtok_r(0, 0, 0))
1609 AC_MSG_RESULT([yes])
1610 tst_compi_strtok_r="yes"
1613 tst_compi_strtok_r="no"
1614 dnl temporary debug tracing follows
1616 sed 's/^/cc-fail> /' conftest.err >&6
1621 if test "$tst_compi_strtok_r" = "yes"; then
1622 AC_MSG_CHECKING([if strtok_r usage allowed])
1623 if test "x$curl_disallow_strtok_r" != "xyes"; then
1624 AC_MSG_RESULT([yes])
1625 tst_allow_strtok_r="yes"
1628 tst_allow_strtok_r="no"
1632 AC_MSG_CHECKING([if strtok_r might be used])
1633 if test "$tst_links_strtok_r" = "yes" &&
1634 test "$tst_proto_strtok_r" = "yes" &&
1635 test "$tst_compi_strtok_r" = "yes" &&
1636 test "$tst_allow_strtok_r" = "yes"; then
1637 AC_MSG_RESULT([yes])
1638 AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
1639 [Define to 1 if you have the strtok_r function.])
1640 ac_cv_func_strtok_r="yes"
1643 ac_cv_func_strtok_r="no"
1648 dnl CURL_CHECK_FUNC_STRTOLL
1649 dnl -------------------------------------------------
1650 dnl Verify if strtoll is available, prototyped, and
1651 dnl can be compiled. If all of these are true, and
1652 dnl usage has not been previously disallowed with
1653 dnl shell variable curl_disallow_strtoll, then
1654 dnl HAVE_STRTOLL will be defined.
1656 AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
1657 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
1659 tst_links_strtoll="unknown"
1660 tst_proto_strtoll="unknown"
1661 tst_compi_strtoll="unknown"
1662 tst_allow_strtoll="unknown"
1664 AC_MSG_CHECKING([if strtoll can be linked])
1666 AC_LANG_FUNC_LINK_TRY([strtoll])
1668 AC_MSG_RESULT([yes])
1669 tst_links_strtoll="yes"
1672 tst_links_strtoll="no"
1675 if test "$tst_links_strtoll" = "yes"; then
1676 AC_MSG_CHECKING([if strtoll is prototyped])
1677 AC_EGREP_CPP([strtoll],[
1678 $curl_includes_stdlib
1680 AC_MSG_RESULT([yes])
1681 tst_proto_strtoll="yes"
1684 tst_proto_strtoll="no"
1688 if test "$tst_proto_strtoll" = "yes"; then
1689 AC_MSG_CHECKING([if strtoll is compilable])
1692 $curl_includes_stdlib
1694 if(0 != strtoll(0, 0, 0))
1698 AC_MSG_RESULT([yes])
1699 tst_compi_strtoll="yes"
1702 tst_compi_strtoll="no"
1703 dnl temporary debug tracing follows
1705 sed 's/^/cc-fail> /' conftest.err >&6
1710 if test "$tst_compi_strtoll" = "yes"; then
1711 AC_MSG_CHECKING([if strtoll usage allowed])
1712 if test "x$curl_disallow_strtoll" != "xyes"; then
1713 AC_MSG_RESULT([yes])
1714 tst_allow_strtoll="yes"
1717 tst_allow_strtoll="no"
1721 AC_MSG_CHECKING([if strtoll might be used])
1722 if test "$tst_links_strtoll" = "yes" &&
1723 test "$tst_proto_strtoll" = "yes" &&
1724 test "$tst_compi_strtoll" = "yes" &&
1725 test "$tst_allow_strtoll" = "yes"; then
1726 AC_MSG_RESULT([yes])
1727 AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
1728 [Define to 1 if you have the strtoll function.])
1729 ac_cv_func_strtoll="yes"
1732 ac_cv_func_strtoll="no"