1 #***************************************************************************
4 # Copyright (C) 2008 by Daniel Stenberg et al
6 # Permission to use, copy, modify, and distribute this software and its
7 # documentation for any purpose and without fee is hereby granted, provided
8 # that the above copyright notice appear in all copies and that both that
9 # copyright notice and this permission notice appear in supporting
10 # documentation, and that the name of M.I.T. not be used in advertising or
11 # publicity pertaining to distribution of the software without specific,
12 # written prior permission. M.I.T. makes no representations about the
13 # suitability of this software for any purpose. It is provided "as is"
14 # without express or implied warranty.
16 #***************************************************************************
18 # File version for 'aclocal' use. Keep it a single number.
22 dnl CARES_INCLUDES_ARPA_INET
23 dnl -------------------------------------------------
24 dnl Set up variable with list of headers that must be
25 dnl included when arpa/inet.h is to be included.
27 AC_DEFUN([CARES_INCLUDES_ARPA_INET], [
28 cares_includes_arpa_inet="\
30 #ifdef HAVE_SYS_TYPES_H
31 # include <sys/types.h>
33 #ifdef HAVE_SYS_SOCKET_H
34 # include <sys/socket.h>
36 #ifdef HAVE_NETINET_IN_H
37 # include <netinet/in.h>
39 #ifdef HAVE_ARPA_INET_H
40 # include <arpa_inet.h>
44 sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
45 [], [], [$cares_includes_arpa_inet])
49 dnl CARES_INCLUDES_NETDB
50 dnl -------------------------------------------------
51 dnl Set up variable with list of headers that must be
52 dnl included when netdb.h is to be included.
54 AC_DEFUN([CARES_INCLUDES_NETDB], [
55 cares_includes_netdb="\
57 #ifdef HAVE_SYS_TYPES_H
58 # include <sys/types.h>
66 [], [], [$cares_includes_netdb])
70 dnl CARES_INCLUDES_STRING
71 dnl -------------------------------------------------
72 dnl Set up variable with list of headers that must be
73 dnl included when string(s).h is to be included.
75 AC_DEFUN([CARES_INCLUDES_STRING], [
76 cares_includes_string="\
78 #ifdef HAVE_SYS_TYPES_H
79 # include <sys/types.h>
89 sys/types.h string.h strings.h,
90 [], [], [$cares_includes_string])
94 dnl CARES_INCLUDES_SYS_UIO
95 dnl -------------------------------------------------
96 dnl Set up variable with list of headers that must be
97 dnl included when sys/uio.h is to be included.
99 AC_DEFUN([CARES_INCLUDES_SYS_UIO], [
100 cares_includes_sys_uio="\
102 #ifdef HAVE_SYS_TYPES_H
103 # include <sys/types.h>
105 #ifdef HAVE_SYS_UIO_H
106 # include <sys/uio.h>
110 sys/types.h sys/uio.h,
111 [], [], [$cares_includes_sys_uio])
115 dnl CARES_INCLUDES_UNISTD
116 dnl -------------------------------------------------
117 dnl Set up variable with list of headers that must be
118 dnl included when unistd.h is to be included.
120 AC_DEFUN([CARES_INCLUDES_UNISTD], [
121 cares_includes_unistd="\
123 #ifdef HAVE_SYS_TYPES_H
124 # include <sys/types.h>
131 sys/types.h unistd.h,
132 [], [], [$cares_includes_unistd])
136 dnl CARES_INCLUDES_WINSOCK2
137 dnl -------------------------------------------------
138 dnl Set up variable with list of headers that must be
139 dnl included when winsock(2).h is to be included.
141 AC_DEFUN([CARES_INCLUDES_WINSOCK2], [
142 cares_includes_winsock2="\
144 #ifdef HAVE_WINDOWS_H
145 # ifndef WIN32_LEAN_AND_MEAN
146 # define WIN32_LEAN_AND_MEAN
148 # include <windows.h>
149 # ifdef HAVE_WINSOCK2_H
150 # include <winsock2.h>
152 # ifdef HAVE_WINSOCK_H
153 # include <winsock.h>
158 CURL_CHECK_HEADER_WINDOWS
159 CURL_CHECK_HEADER_WINSOCK
160 CURL_CHECK_HEADER_WINSOCK2
164 dnl CARES_CHECK_FUNC_GETHOSTNAME
165 dnl -------------------------------------------------
166 dnl Verify if gethostname is available, prototyped, and
167 dnl can be compiled. If all of these are true, and
168 dnl usage has not been previously disallowed with
169 dnl shell variable cares_disallow_gethostname, then
170 dnl HAVE_GETHOSTNAME will be defined.
172 AC_DEFUN([CARES_CHECK_FUNC_GETHOSTNAME], [
173 AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl
174 AC_REQUIRE([CARES_INCLUDES_UNISTD])dnl
176 tst_links_gethostname="unknown"
177 tst_proto_gethostname="unknown"
178 tst_compi_gethostname="unknown"
179 tst_allow_gethostname="unknown"
181 AC_MSG_CHECKING([if gethostname can be linked])
184 $cares_includes_winsock2
185 $cares_includes_unistd
187 if(0 != gethostname(0, 0))
192 tst_links_gethostname="yes"
195 tst_links_gethostname="no"
198 if test "$tst_links_gethostname" = "yes"; then
199 AC_MSG_CHECKING([if gethostname is prototyped])
200 AC_EGREP_CPP([gethostname],[
201 $cares_includes_winsock2
202 $cares_includes_unistd
205 tst_proto_gethostname="yes"
208 tst_proto_gethostname="no"
212 if test "$tst_proto_gethostname" = "yes"; then
213 AC_MSG_CHECKING([if gethostname is compilable])
216 $cares_includes_winsock2
217 $cares_includes_unistd
219 if(0 != gethostname(0, 0))
224 tst_compi_gethostname="yes"
227 tst_compi_gethostname="no"
231 if test "$tst_compi_gethostname" = "yes"; then
232 AC_MSG_CHECKING([if gethostname usage allowed])
233 if test "x$cares_disallow_gethostname" != "xyes"; then
235 tst_allow_gethostname="yes"
238 tst_allow_gethostname="no"
242 AC_MSG_CHECKING([if gethostname might be used])
243 if test "$tst_links_gethostname" = "yes" &&
244 test "$tst_proto_gethostname" = "yes" &&
245 test "$tst_compi_gethostname" = "yes" &&
246 test "$tst_allow_gethostname" = "yes"; then
248 AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
249 [Define to 1 if you have the gethostname function.])
250 ac_cv_func_gethostname="yes"
253 ac_cv_func_gethostname="no"
258 dnl CARES_CHECK_FUNC_GETSERVBYPORT_R
259 dnl -------------------------------------------------
260 dnl Verify if getservbyport_r is available, prototyped,
261 dnl and can be compiled. If all of these are true, and
262 dnl usage has not been previously disallowed with
263 dnl shell variable cares_disallow_getservbyport_r, then
264 dnl HAVE_GETSERVBYPORT_R will be defined.
266 AC_DEFUN([CARES_CHECK_FUNC_GETSERVBYPORT_R], [
267 AC_REQUIRE([CARES_INCLUDES_NETDB])dnl
269 tst_links_getservbyport_r="unknown"
270 tst_proto_getservbyport_r="unknown"
271 tst_compi_getservbyport_r="unknown"
272 tst_allow_getservbyport_r="unknown"
273 tst_nargs_getservbyport_r="unknown"
275 AC_MSG_CHECKING([if getservbyport_r can be linked])
277 AC_LANG_FUNC_LINK_TRY([getservbyport_r])
280 tst_links_getservbyport_r="yes"
283 tst_links_getservbyport_r="no"
286 if test "$tst_links_getservbyport_r" = "yes"; then
287 AC_MSG_CHECKING([if getservbyport_r is prototyped])
288 AC_EGREP_CPP([getservbyport_r],[
289 $cares_includes_netdb
292 tst_proto_getservbyport_r="yes"
295 tst_proto_getservbyport_r="no"
299 if test "$tst_proto_getservbyport_r" = "yes"; then
300 if test "$tst_nargs_getservbyport_r" = "unknown"; then
301 AC_MSG_CHECKING([if getservbyport_r takes 4 args.])
304 $cares_includes_netdb
306 if(0 != getservbyport_r(0, 0, 0, 0))
311 tst_compi_getservbyport_r="yes"
312 tst_nargs_getservbyport_r="4"
315 tst_compi_getservbyport_r="no"
318 if test "$tst_nargs_getservbyport_r" = "unknown"; then
319 AC_MSG_CHECKING([if getservbyport_r takes 5 args.])
322 $cares_includes_netdb
324 if(0 != getservbyport_r(0, 0, 0, 0, 0))
329 tst_compi_getservbyport_r="yes"
330 tst_nargs_getservbyport_r="5"
333 tst_compi_getservbyport_r="no"
336 if test "$tst_nargs_getservbyport_r" = "unknown"; then
337 AC_MSG_CHECKING([if getservbyport_r takes 6 args.])
340 $cares_includes_netdb
342 if(0 != getservbyport_r(0, 0, 0, 0, 0, 0))
347 tst_compi_getservbyport_r="yes"
348 tst_nargs_getservbyport_r="6"
351 tst_compi_getservbyport_r="no"
354 AC_MSG_CHECKING([if getservbyport_r is compilable])
355 if test "$tst_compi_getservbyport_r" = "yes"; then
362 if test "$tst_compi_getservbyport_r" = "yes"; then
363 AC_MSG_CHECKING([if getservbyport_r usage allowed])
364 if test "x$cares_disallow_getservbyport_r" != "xyes"; then
366 tst_allow_getservbyport_r="yes"
369 tst_allow_getservbyport_r="no"
373 AC_MSG_CHECKING([if getservbyport_r might be used])
374 if test "$tst_links_getservbyport_r" = "yes" &&
375 test "$tst_proto_getservbyport_r" = "yes" &&
376 test "$tst_compi_getservbyport_r" = "yes" &&
377 test "$tst_allow_getservbyport_r" = "yes"; then
379 AC_DEFINE_UNQUOTED(HAVE_GETSERVBYPORT_R, 1,
380 [Define to 1 if you have the getservbyport_r function.])
381 AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $tst_nargs_getservbyport_r,
382 [Specifies the number of arguments to getservbyport_r])
383 if test "$tst_nargs_getservbyport_r" -eq "4"; then
384 AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data),
385 [Specifies the size of the buffer to pass to getservbyport_r])
387 AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096,
388 [Specifies the size of the buffer to pass to getservbyport_r])
390 ac_cv_func_getservbyport_r="yes"
393 ac_cv_func_getservbyport_r="no"
398 dnl CARES_CHECK_FUNC_INET_NTOP
399 dnl -------------------------------------------------
400 dnl Verify if inet_ntop is available, prototyped, can
401 dnl be compiled and seems to work. If all of these are
402 dnl true, and usage has not been previously disallowed
403 dnl with shell variable cares_disallow_inet_ntop, then
404 dnl HAVE_INET_NTOP will be defined.
406 AC_DEFUN([CARES_CHECK_FUNC_INET_NTOP], [
407 AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl
408 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
410 tst_links_inet_ntop="unknown"
411 tst_proto_inet_ntop="unknown"
412 tst_compi_inet_ntop="unknown"
413 tst_works_inet_ntop="unknown"
414 tst_allow_inet_ntop="unknown"
416 AC_MSG_CHECKING([if inet_ntop can be linked])
418 AC_LANG_FUNC_LINK_TRY([inet_ntop])
421 tst_links_inet_ntop="yes"
424 tst_links_inet_ntop="no"
427 if test "$tst_links_inet_ntop" = "yes"; then
428 AC_MSG_CHECKING([if inet_ntop is prototyped])
429 AC_EGREP_CPP([inet_ntop],[
430 $cares_includes_arpa_inet
433 tst_proto_inet_ntop="yes"
436 tst_proto_inet_ntop="no"
440 if test "$tst_proto_inet_ntop" = "yes"; then
441 AC_MSG_CHECKING([if inet_ntop is compilable])
444 $cares_includes_arpa_inet
446 if(0 != inet_ntop(0, 0, 0, 0))
451 tst_compi_inet_ntop="yes"
454 tst_compi_inet_ntop="no"
458 dnl only do runtime verification when not cross-compiling
459 if test "x$cross_compiling" != "xyes" &&
460 test "$tst_compi_inet_ntop" = "yes"; then
461 AC_MSG_CHECKING([if inet_ntop seems to work])
464 $cares_includes_arpa_inet
465 $cares_includes_string
467 char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
468 char ipv4res[sizeof "255.255.255.255"];
469 unsigned char ipv6a[26];
470 unsigned char ipv4a[5];
481 ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
484 if(ipv4ptr != ipv4res)
488 if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
492 memset(ipv6a, 0, sizeof(ipv6a));
505 ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
508 if(ipv6ptr != ipv6res)
512 if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
519 tst_works_inet_ntop="yes"
522 tst_works_inet_ntop="no"
526 if test "$tst_compi_inet_ntop" = "yes" &&
527 test "$tst_works_inet_ntop" != "no"; then
528 AC_MSG_CHECKING([if inet_ntop usage allowed])
529 if test "x$cares_disallow_inet_ntop" != "xyes"; then
531 tst_allow_inet_ntop="yes"
534 tst_allow_inet_ntop="no"
538 AC_MSG_CHECKING([if inet_ntop might be used])
539 if test "$tst_links_inet_ntop" = "yes" &&
540 test "$tst_proto_inet_ntop" = "yes" &&
541 test "$tst_compi_inet_ntop" = "yes" &&
542 test "$tst_allow_inet_ntop" = "yes" &&
543 test "$tst_works_inet_ntop" != "no"; then
545 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
546 [Define to 1 if you have a IPv6 capable working inet_ntop function.])
547 ac_cv_func_inet_ntop="yes"
550 ac_cv_func_inet_ntop="no"
555 dnl CARES_CHECK_FUNC_INET_PTON
556 dnl -------------------------------------------------
557 dnl Verify if inet_pton is available, prototyped, can
558 dnl be compiled and seems to work. If all of these are
559 dnl true, and usage has not been previously disallowed
560 dnl with shell variable cares_disallow_inet_pton, then
561 dnl HAVE_INET_PTON will be defined.
563 AC_DEFUN([CARES_CHECK_FUNC_INET_PTON], [
564 AC_REQUIRE([CARES_INCLUDES_ARPA_INET])dnl
565 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
567 tst_links_inet_pton="unknown"
568 tst_proto_inet_pton="unknown"
569 tst_compi_inet_pton="unknown"
570 tst_works_inet_pton="unknown"
571 tst_allow_inet_pton="unknown"
573 AC_MSG_CHECKING([if inet_pton can be linked])
575 AC_LANG_FUNC_LINK_TRY([inet_pton])
578 tst_links_inet_pton="yes"
581 tst_links_inet_pton="no"
584 if test "$tst_links_inet_pton" = "yes"; then
585 AC_MSG_CHECKING([if inet_pton is prototyped])
586 AC_EGREP_CPP([inet_pton],[
587 $cares_includes_arpa_inet
590 tst_proto_inet_pton="yes"
593 tst_proto_inet_pton="no"
597 if test "$tst_proto_inet_pton" = "yes"; then
598 AC_MSG_CHECKING([if inet_pton is compilable])
601 $cares_includes_arpa_inet
603 if(0 != inet_pton(0, 0, 0))
608 tst_compi_inet_pton="yes"
611 tst_compi_inet_pton="no"
615 dnl only do runtime verification when not cross-compiling
616 if test "x$cross_compiling" != "xyes" &&
617 test "$tst_compi_inet_pton" = "yes"; then
618 AC_MSG_CHECKING([if inet_pton seems to work])
621 $cares_includes_arpa_inet
622 $cares_includes_string
624 unsigned char ipv6a[26];
625 unsigned char ipv4a[5];
626 const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
627 const char *ipv4src = "192.168.100.1";
629 memset(ipv4a, 1, sizeof(ipv4a));
630 if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
633 if( (ipv4a[0] != 0xc0) ||
634 (ipv4a[1] != 0xa8) ||
635 (ipv4a[2] != 0x64) ||
636 (ipv4a[3] != 0x01) ||
640 memset(ipv6a, 1, sizeof(ipv6a));
641 if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
645 memset(ipv6a, 0, sizeof(ipv6a));
646 if( (ipv6a[0] != 0xfe) ||
647 (ipv6a[1] != 0x80) ||
648 (ipv6a[8] != 0x02) ||
649 (ipv6a[9] != 0x14) ||
650 (ipv6a[10] != 0x4f) ||
651 (ipv6a[11] != 0xff) ||
652 (ipv6a[12] != 0xfe) ||
653 (ipv6a[13] != 0x0b) ||
654 (ipv6a[14] != 0x76) ||
655 (ipv6a[15] != 0xc8) ||
656 (ipv6a[25] != 0x01) )
659 if( (ipv6a[2] != 0x0) ||
665 (ipv6a[16] != 0x0) ||
666 (ipv6a[17] != 0x0) ||
667 (ipv6a[18] != 0x0) ||
668 (ipv6a[19] != 0x0) ||
669 (ipv6a[20] != 0x0) ||
670 (ipv6a[21] != 0x0) ||
671 (ipv6a[22] != 0x0) ||
672 (ipv6a[23] != 0x0) ||
680 tst_works_inet_pton="yes"
683 tst_works_inet_pton="no"
687 if test "$tst_compi_inet_pton" = "yes" &&
688 test "$tst_works_inet_pton" != "no"; then
689 AC_MSG_CHECKING([if inet_pton usage allowed])
690 if test "x$cares_disallow_inet_pton" != "xyes"; then
692 tst_allow_inet_pton="yes"
695 tst_allow_inet_pton="no"
699 AC_MSG_CHECKING([if inet_pton might be used])
700 if test "$tst_links_inet_pton" = "yes" &&
701 test "$tst_proto_inet_pton" = "yes" &&
702 test "$tst_compi_inet_pton" = "yes" &&
703 test "$tst_allow_inet_pton" = "yes" &&
704 test "$tst_works_inet_pton" != "no"; then
706 AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
707 [Define to 1 if you have a IPv6 capable working inet_pton function.])
708 ac_cv_func_inet_pton="yes"
711 ac_cv_func_inet_pton="no"
716 dnl CARES_CHECK_FUNC_STRCASECMP
717 dnl -------------------------------------------------
718 dnl Verify if strcasecmp is available, prototyped, and
719 dnl can be compiled. If all of these are true, and
720 dnl usage has not been previously disallowed with
721 dnl shell variable cares_disallow_strcasecmp, then
722 dnl HAVE_STRCASECMP will be defined.
724 AC_DEFUN([CARES_CHECK_FUNC_STRCASECMP], [
725 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
727 tst_links_strcasecmp="unknown"
728 tst_proto_strcasecmp="unknown"
729 tst_compi_strcasecmp="unknown"
730 tst_allow_strcasecmp="unknown"
732 AC_MSG_CHECKING([if strcasecmp can be linked])
734 AC_LANG_FUNC_LINK_TRY([strcasecmp])
737 tst_links_strcasecmp="yes"
740 tst_links_strcasecmp="no"
743 if test "$tst_links_strcasecmp" = "yes"; then
744 AC_MSG_CHECKING([if strcasecmp is prototyped])
745 AC_EGREP_CPP([strcasecmp],[
746 $cares_includes_string
749 tst_proto_strcasecmp="yes"
752 tst_proto_strcasecmp="no"
756 if test "$tst_proto_strcasecmp" = "yes"; then
757 AC_MSG_CHECKING([if strcasecmp is compilable])
760 $cares_includes_string
762 if(0 != strcasecmp(0, 0))
767 tst_compi_strcasecmp="yes"
770 tst_compi_strcasecmp="no"
774 if test "$tst_compi_strcasecmp" = "yes"; then
775 AC_MSG_CHECKING([if strcasecmp usage allowed])
776 if test "x$cares_disallow_strcasecmp" != "xyes"; then
778 tst_allow_strcasecmp="yes"
781 tst_allow_strcasecmp="no"
785 AC_MSG_CHECKING([if strcasecmp might be used])
786 if test "$tst_links_strcasecmp" = "yes" &&
787 test "$tst_proto_strcasecmp" = "yes" &&
788 test "$tst_compi_strcasecmp" = "yes" &&
789 test "$tst_allow_strcasecmp" = "yes"; then
791 AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
792 [Define to 1 if you have the strcasecmp function.])
793 ac_cv_func_strcasecmp="yes"
796 ac_cv_func_strcasecmp="no"
801 dnl CARES_CHECK_FUNC_STRCMPI
802 dnl -------------------------------------------------
803 dnl Verify if strcmpi is available, prototyped, and
804 dnl can be compiled. If all of these are true, and
805 dnl usage has not been previously disallowed with
806 dnl shell variable cares_disallow_strcmpi, then
807 dnl HAVE_STRCMPI will be defined.
809 AC_DEFUN([CARES_CHECK_FUNC_STRCMPI], [
810 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
812 tst_links_strcmpi="unknown"
813 tst_proto_strcmpi="unknown"
814 tst_compi_strcmpi="unknown"
815 tst_allow_strcmpi="unknown"
817 AC_MSG_CHECKING([if strcmpi can be linked])
819 AC_LANG_FUNC_LINK_TRY([strcmpi])
822 tst_links_strcmpi="yes"
825 tst_links_strcmpi="no"
828 if test "$tst_links_strcmpi" = "yes"; then
829 AC_MSG_CHECKING([if strcmpi is prototyped])
830 AC_EGREP_CPP([strcmpi],[
831 $cares_includes_string
834 tst_proto_strcmpi="yes"
837 tst_proto_strcmpi="no"
841 if test "$tst_proto_strcmpi" = "yes"; then
842 AC_MSG_CHECKING([if strcmpi is compilable])
845 $cares_includes_string
847 if(0 != strcmpi(0, 0))
852 tst_compi_strcmpi="yes"
855 tst_compi_strcmpi="no"
859 if test "$tst_compi_strcmpi" = "yes"; then
860 AC_MSG_CHECKING([if strcmpi usage allowed])
861 if test "x$cares_disallow_strcmpi" != "xyes"; then
863 tst_allow_strcmpi="yes"
866 tst_allow_strcmpi="no"
870 AC_MSG_CHECKING([if strcmpi might be used])
871 if test "$tst_links_strcmpi" = "yes" &&
872 test "$tst_proto_strcmpi" = "yes" &&
873 test "$tst_compi_strcmpi" = "yes" &&
874 test "$tst_allow_strcmpi" = "yes"; then
876 AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
877 [Define to 1 if you have the strcmpi function.])
878 ac_cv_func_strcmpi="yes"
881 ac_cv_func_strcmpi="no"
886 dnl CARES_CHECK_FUNC_STRDUP
887 dnl -------------------------------------------------
888 dnl Verify if strdup is available, prototyped, and
889 dnl can be compiled. If all of these are true, and
890 dnl usage has not been previously disallowed with
891 dnl shell variable cares_disallow_strdup, then
892 dnl HAVE_STRDUP will be defined.
894 AC_DEFUN([CARES_CHECK_FUNC_STRDUP], [
895 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
897 tst_links_strdup="unknown"
898 tst_proto_strdup="unknown"
899 tst_compi_strdup="unknown"
900 tst_allow_strdup="unknown"
902 AC_MSG_CHECKING([if strdup can be linked])
904 AC_LANG_FUNC_LINK_TRY([strdup])
907 tst_links_strdup="yes"
910 tst_links_strdup="no"
913 if test "$tst_links_strdup" = "yes"; then
914 AC_MSG_CHECKING([if strdup is prototyped])
915 AC_EGREP_CPP([strdup],[
916 $cares_includes_string
919 tst_proto_strdup="yes"
922 tst_proto_strdup="no"
926 if test "$tst_proto_strdup" = "yes"; then
927 AC_MSG_CHECKING([if strdup is compilable])
930 $cares_includes_string
937 tst_compi_strdup="yes"
940 tst_compi_strdup="no"
944 if test "$tst_compi_strdup" = "yes"; then
945 AC_MSG_CHECKING([if strdup usage allowed])
946 if test "x$cares_disallow_strdup" != "xyes"; then
948 tst_allow_strdup="yes"
951 tst_allow_strdup="no"
955 AC_MSG_CHECKING([if strdup might be used])
956 if test "$tst_links_strdup" = "yes" &&
957 test "$tst_proto_strdup" = "yes" &&
958 test "$tst_compi_strdup" = "yes" &&
959 test "$tst_allow_strdup" = "yes"; then
961 AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
962 [Define to 1 if you have the strdup function.])
963 ac_cv_func_strdup="yes"
966 ac_cv_func_strdup="no"
971 dnl CARES_CHECK_FUNC_STRICMP
972 dnl -------------------------------------------------
973 dnl Verify if stricmp is available, prototyped, and
974 dnl can be compiled. If all of these are true, and
975 dnl usage has not been previously disallowed with
976 dnl shell variable cares_disallow_stricmp, then
977 dnl HAVE_STRICMP will be defined.
979 AC_DEFUN([CARES_CHECK_FUNC_STRICMP], [
980 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
982 tst_links_stricmp="unknown"
983 tst_proto_stricmp="unknown"
984 tst_compi_stricmp="unknown"
985 tst_allow_stricmp="unknown"
987 AC_MSG_CHECKING([if stricmp can be linked])
989 AC_LANG_FUNC_LINK_TRY([stricmp])
992 tst_links_stricmp="yes"
995 tst_links_stricmp="no"
998 if test "$tst_links_stricmp" = "yes"; then
999 AC_MSG_CHECKING([if stricmp is prototyped])
1000 AC_EGREP_CPP([stricmp],[
1001 $cares_includes_string
1003 AC_MSG_RESULT([yes])
1004 tst_proto_stricmp="yes"
1007 tst_proto_stricmp="no"
1011 if test "$tst_proto_stricmp" = "yes"; then
1012 AC_MSG_CHECKING([if stricmp is compilable])
1015 $cares_includes_string
1017 if(0 != stricmp(0, 0))
1021 AC_MSG_RESULT([yes])
1022 tst_compi_stricmp="yes"
1025 tst_compi_stricmp="no"
1029 if test "$tst_compi_stricmp" = "yes"; then
1030 AC_MSG_CHECKING([if stricmp usage allowed])
1031 if test "x$cares_disallow_stricmp" != "xyes"; then
1032 AC_MSG_RESULT([yes])
1033 tst_allow_stricmp="yes"
1036 tst_allow_stricmp="no"
1040 AC_MSG_CHECKING([if stricmp might be used])
1041 if test "$tst_links_stricmp" = "yes" &&
1042 test "$tst_proto_stricmp" = "yes" &&
1043 test "$tst_compi_stricmp" = "yes" &&
1044 test "$tst_allow_stricmp" = "yes"; then
1045 AC_MSG_RESULT([yes])
1046 AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
1047 [Define to 1 if you have the stricmp function.])
1048 ac_cv_func_stricmp="yes"
1051 ac_cv_func_stricmp="no"
1056 dnl CARES_CHECK_FUNC_STRNCASECMP
1057 dnl -------------------------------------------------
1058 dnl Verify if strncasecmp is available, prototyped, and
1059 dnl can be compiled. If all of these are true, and
1060 dnl usage has not been previously disallowed with
1061 dnl shell variable cares_disallow_strncasecmp, then
1062 dnl HAVE_STRNCASECMP will be defined.
1064 AC_DEFUN([CARES_CHECK_FUNC_STRNCASECMP], [
1065 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
1067 tst_links_strncasecmp="unknown"
1068 tst_proto_strncasecmp="unknown"
1069 tst_compi_strncasecmp="unknown"
1070 tst_allow_strncasecmp="unknown"
1072 AC_MSG_CHECKING([if strncasecmp can be linked])
1074 AC_LANG_FUNC_LINK_TRY([strncasecmp])
1076 AC_MSG_RESULT([yes])
1077 tst_links_strncasecmp="yes"
1080 tst_links_strncasecmp="no"
1083 if test "$tst_links_strncasecmp" = "yes"; then
1084 AC_MSG_CHECKING([if strncasecmp is prototyped])
1085 AC_EGREP_CPP([strncasecmp],[
1086 $cares_includes_string
1088 AC_MSG_RESULT([yes])
1089 tst_proto_strncasecmp="yes"
1092 tst_proto_strncasecmp="no"
1096 if test "$tst_proto_strncasecmp" = "yes"; then
1097 AC_MSG_CHECKING([if strncasecmp is compilable])
1100 $cares_includes_string
1102 if(0 != strncasecmp(0, 0, 0))
1106 AC_MSG_RESULT([yes])
1107 tst_compi_strncasecmp="yes"
1110 tst_compi_strncasecmp="no"
1114 if test "$tst_compi_strncasecmp" = "yes"; then
1115 AC_MSG_CHECKING([if strncasecmp usage allowed])
1116 if test "x$cares_disallow_strncasecmp" != "xyes"; then
1117 AC_MSG_RESULT([yes])
1118 tst_allow_strncasecmp="yes"
1121 tst_allow_strncasecmp="no"
1125 AC_MSG_CHECKING([if strncasecmp might be used])
1126 if test "$tst_links_strncasecmp" = "yes" &&
1127 test "$tst_proto_strncasecmp" = "yes" &&
1128 test "$tst_compi_strncasecmp" = "yes" &&
1129 test "$tst_allow_strncasecmp" = "yes"; then
1130 AC_MSG_RESULT([yes])
1131 AC_DEFINE_UNQUOTED(HAVE_STRNCASECMP, 1,
1132 [Define to 1 if you have the strncasecmp function.])
1133 ac_cv_func_strncasecmp="yes"
1136 ac_cv_func_strncasecmp="no"
1141 dnl CARES_CHECK_FUNC_STRNCMPI
1142 dnl -------------------------------------------------
1143 dnl Verify if strncmpi is available, prototyped, and
1144 dnl can be compiled. If all of these are true, and
1145 dnl usage has not been previously disallowed with
1146 dnl shell variable cares_disallow_strncmpi, then
1147 dnl HAVE_STRNCMPI will be defined.
1149 AC_DEFUN([CARES_CHECK_FUNC_STRNCMPI], [
1150 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
1152 tst_links_strncmpi="unknown"
1153 tst_proto_strncmpi="unknown"
1154 tst_compi_strncmpi="unknown"
1155 tst_allow_strncmpi="unknown"
1157 AC_MSG_CHECKING([if strncmpi can be linked])
1159 AC_LANG_FUNC_LINK_TRY([strncmpi])
1161 AC_MSG_RESULT([yes])
1162 tst_links_strncmpi="yes"
1165 tst_links_strncmpi="no"
1168 if test "$tst_links_strncmpi" = "yes"; then
1169 AC_MSG_CHECKING([if strncmpi is prototyped])
1170 AC_EGREP_CPP([strncmpi],[
1171 $cares_includes_string
1173 AC_MSG_RESULT([yes])
1174 tst_proto_strncmpi="yes"
1177 tst_proto_strncmpi="no"
1181 if test "$tst_proto_strncmpi" = "yes"; then
1182 AC_MSG_CHECKING([if strncmpi is compilable])
1185 $cares_includes_string
1187 if(0 != strncmpi(0, 0))
1191 AC_MSG_RESULT([yes])
1192 tst_compi_strncmpi="yes"
1195 tst_compi_strncmpi="no"
1199 if test "$tst_compi_strncmpi" = "yes"; then
1200 AC_MSG_CHECKING([if strncmpi usage allowed])
1201 if test "x$cares_disallow_strncmpi" != "xyes"; then
1202 AC_MSG_RESULT([yes])
1203 tst_allow_strncmpi="yes"
1206 tst_allow_strncmpi="no"
1210 AC_MSG_CHECKING([if strncmpi might be used])
1211 if test "$tst_links_strncmpi" = "yes" &&
1212 test "$tst_proto_strncmpi" = "yes" &&
1213 test "$tst_compi_strncmpi" = "yes" &&
1214 test "$tst_allow_strncmpi" = "yes"; then
1215 AC_MSG_RESULT([yes])
1216 AC_DEFINE_UNQUOTED(HAVE_STRNCMPI, 1,
1217 [Define to 1 if you have the strncmpi function.])
1218 ac_cv_func_strncmpi="yes"
1221 ac_cv_func_strncmpi="no"
1226 dnl CARES_CHECK_FUNC_STRNICMP
1227 dnl -------------------------------------------------
1228 dnl Verify if strnicmp is available, prototyped, and
1229 dnl can be compiled. If all of these are true, and
1230 dnl usage has not been previously disallowed with
1231 dnl shell variable cares_disallow_strnicmp, then
1232 dnl HAVE_STRNICMP will be defined.
1234 AC_DEFUN([CARES_CHECK_FUNC_STRNICMP], [
1235 AC_REQUIRE([CARES_INCLUDES_STRING])dnl
1237 tst_links_strnicmp="unknown"
1238 tst_proto_strnicmp="unknown"
1239 tst_compi_strnicmp="unknown"
1240 tst_allow_strnicmp="unknown"
1242 AC_MSG_CHECKING([if strnicmp can be linked])
1244 AC_LANG_FUNC_LINK_TRY([strnicmp])
1246 AC_MSG_RESULT([yes])
1247 tst_links_strnicmp="yes"
1250 tst_links_strnicmp="no"
1253 if test "$tst_links_strnicmp" = "yes"; then
1254 AC_MSG_CHECKING([if strnicmp is prototyped])
1255 AC_EGREP_CPP([strnicmp],[
1256 $cares_includes_string
1258 AC_MSG_RESULT([yes])
1259 tst_proto_strnicmp="yes"
1262 tst_proto_strnicmp="no"
1266 if test "$tst_proto_strnicmp" = "yes"; then
1267 AC_MSG_CHECKING([if strnicmp is compilable])
1270 $cares_includes_string
1272 if(0 != strnicmp(0, 0))
1276 AC_MSG_RESULT([yes])
1277 tst_compi_strnicmp="yes"
1280 tst_compi_strnicmp="no"
1284 if test "$tst_compi_strnicmp" = "yes"; then
1285 AC_MSG_CHECKING([if strnicmp usage allowed])
1286 if test "x$cares_disallow_strnicmp" != "xyes"; then
1287 AC_MSG_RESULT([yes])
1288 tst_allow_strnicmp="yes"
1291 tst_allow_strnicmp="no"
1295 AC_MSG_CHECKING([if strnicmp might be used])
1296 if test "$tst_links_strnicmp" = "yes" &&
1297 test "$tst_proto_strnicmp" = "yes" &&
1298 test "$tst_compi_strnicmp" = "yes" &&
1299 test "$tst_allow_strnicmp" = "yes"; then
1300 AC_MSG_RESULT([yes])
1301 AC_DEFINE_UNQUOTED(HAVE_STRNICMP, 1,
1302 [Define to 1 if you have the strnicmp function.])
1303 ac_cv_func_strnicmp="yes"
1306 ac_cv_func_strnicmp="no"
1311 dnl CARES_CHECK_FUNC_WRITEV
1312 dnl -------------------------------------------------
1313 dnl Verify if writev is available, prototyped, and
1314 dnl can be compiled. If all of these are true, and
1315 dnl usage has not been previously disallowed with
1316 dnl shell variable cares_disallow_writev, then
1317 dnl HAVE_WRITEV will be defined.
1319 AC_DEFUN([CARES_CHECK_FUNC_WRITEV], [
1320 AC_REQUIRE([CARES_INCLUDES_SYS_UIO])dnl
1322 tst_links_writev="unknown"
1323 tst_proto_writev="unknown"
1324 tst_compi_writev="unknown"
1325 tst_allow_writev="unknown"
1327 AC_MSG_CHECKING([if writev can be linked])
1329 AC_LANG_FUNC_LINK_TRY([writev])
1331 AC_MSG_RESULT([yes])
1332 tst_links_writev="yes"
1335 tst_links_writev="no"
1338 if test "$tst_links_writev" = "yes"; then
1339 AC_MSG_CHECKING([if writev is prototyped])
1340 AC_EGREP_CPP([writev],[
1341 $cares_includes_sys_uio
1343 AC_MSG_RESULT([yes])
1344 tst_proto_writev="yes"
1347 tst_proto_writev="no"
1351 if test "$tst_proto_writev" = "yes"; then
1352 AC_MSG_CHECKING([if writev is compilable])
1355 $cares_includes_sys_uio
1357 if(0 != writev(0, 0, 0))
1361 AC_MSG_RESULT([yes])
1362 tst_compi_writev="yes"
1365 tst_compi_writev="no"
1369 if test "$tst_compi_writev" = "yes"; then
1370 AC_MSG_CHECKING([if writev usage allowed])
1371 if test "x$cares_disallow_writev" != "xyes"; then
1372 AC_MSG_RESULT([yes])
1373 tst_allow_writev="yes"
1376 tst_allow_writev="no"
1380 AC_MSG_CHECKING([if writev might be used])
1381 if test "$tst_links_writev" = "yes" &&
1382 test "$tst_proto_writev" = "yes" &&
1383 test "$tst_compi_writev" = "yes" &&
1384 test "$tst_allow_writev" = "yes"; then
1385 AC_MSG_RESULT([yes])
1386 AC_DEFINE_UNQUOTED(HAVE_WRITEV, 1,
1387 [Define to 1 if you have the writev function.])
1388 ac_cv_func_writev="yes"
1391 ac_cv_func_writev="no"