3 dnl CURL_CHECK_HEADER_WINDOWS
4 dnl -------------------------------------------------
5 dnl Check for compilable and valid windows.h header
7 AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
8 AC_CACHE_CHECK([for windows.h], [ac_cv_header_windows_h], [
12 #ifndef WIN32_LEAN_AND_MEAN
13 #define WIN32_LEAN_AND_MEAN
17 #if defined(__CYGWIN__) || defined(__CEGCC__)
18 HAVE_WINDOWS_H shall not be defined.
24 ac_cv_header_windows_h="yes"
26 ac_cv_header_windows_h="no"
29 case "$ac_cv_header_windows_h" in
31 AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
32 [Define to 1 if you have the windows.h header file.])
33 AC_DEFINE_UNQUOTED(WIN32_LEAN_AND_MEAN, 1,
34 [Define to avoid automatic inclusion of winsock.h])
40 dnl CURL_CHECK_NATIVE_WINDOWS
41 dnl -------------------------------------------------
42 dnl Check if building a native Windows target
44 AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
45 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
46 AC_CACHE_CHECK([whether build target is a native Windows one], [ac_cv_native_windows], [
47 if test "$ac_cv_header_windows_h" = "no"; then
48 ac_cv_native_windows="no"
53 #if defined(__MINGW32__) || defined(__MINGW32CE__)
56 Not a native Windows build target.
60 ac_cv_native_windows="yes"
62 ac_cv_native_windows="no"
66 case "$ac_cv_native_windows" in
68 AC_DEFINE_UNQUOTED(NATIVE_WINDOWS, 1,
69 [Define to 1 if you are building a native Windows target.])
75 dnl CURL_CHECK_HEADER_WINSOCK
76 dnl -------------------------------------------------
77 dnl Check for compilable and valid winsock.h header
79 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
80 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
81 AC_CACHE_CHECK([for winsock.h], [ac_cv_header_winsock_h], [
85 #ifndef WIN32_LEAN_AND_MEAN
86 #define WIN32_LEAN_AND_MEAN
91 #if defined(__CYGWIN__) || defined(__CEGCC__)
92 HAVE_WINSOCK_H shall not be defined.
94 int dummy=WSACleanup();
98 ac_cv_header_winsock_h="yes"
100 ac_cv_header_winsock_h="no"
103 case "$ac_cv_header_winsock_h" in
105 AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
106 [Define to 1 if you have the winsock.h header file.])
112 dnl CURL_CHECK_HEADER_WINSOCK2
113 dnl -------------------------------------------------
114 dnl Check for compilable and valid winsock2.h header
116 AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
117 AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
118 AC_CACHE_CHECK([for winsock2.h], [ac_cv_header_winsock2_h], [
122 #ifndef WIN32_LEAN_AND_MEAN
123 #define WIN32_LEAN_AND_MEAN
126 #include <winsock2.h>
128 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
129 HAVE_WINSOCK2_H shall not be defined.
131 int dummy=2*IPPROTO_ESP;
135 ac_cv_header_winsock2_h="yes"
137 ac_cv_header_winsock2_h="no"
140 case "$ac_cv_header_winsock2_h" in
142 AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
143 [Define to 1 if you have the winsock2.h header file.])
149 dnl CURL_CHECK_HEADER_WS2TCPIP
150 dnl -------------------------------------------------
151 dnl Check for compilable and valid ws2tcpip.h header
153 AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
154 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
155 AC_CACHE_CHECK([for ws2tcpip.h], [ac_cv_header_ws2tcpip_h], [
159 #ifndef WIN32_LEAN_AND_MEAN
160 #define WIN32_LEAN_AND_MEAN
163 #include <winsock2.h>
164 #include <ws2tcpip.h>
166 #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
167 HAVE_WS2TCPIP_H shall not be defined.
169 int dummy=2*IP_PKTINFO;
173 ac_cv_header_ws2tcpip_h="yes"
175 ac_cv_header_ws2tcpip_h="no"
178 case "$ac_cv_header_ws2tcpip_h" in
180 AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
181 [Define to 1 if you have the ws2tcpip.h header file.])
187 dnl CURL_CHECK_HEADER_MALLOC
188 dnl -------------------------------------------------
189 dnl Check for compilable and valid malloc.h header,
190 dnl and check if it is needed even with stdlib.h
192 AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
193 AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [
198 void *p = malloc(10);
199 void *q = calloc(10,10);
204 ac_cv_header_malloc_h="yes"
206 ac_cv_header_malloc_h="no"
209 if test "$ac_cv_header_malloc_h" = "yes"; then
210 AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
211 [Define to 1 if you have the malloc.h header file.])
217 void *p = malloc(10);
218 void *q = calloc(10,10);
223 curl_cv_need_header_malloc_h="no"
225 curl_cv_need_header_malloc_h="yes"
228 case "$curl_cv_need_header_malloc_h" in
230 AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
231 [Define to 1 if you need the malloc.h header file even with stdlib.h])
238 dnl CURL_CHECK_TYPE_SOCKLEN_T
239 dnl -------------------------------------------------
240 dnl Check for existing socklen_t type, and provide
241 dnl an equivalent type if socklen_t not available
243 AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [
244 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
245 AC_CHECK_TYPE([socklen_t], [
246 dnl socklen_t is available
247 AC_DEFINE_UNQUOTED(HAVE_SOCKLEN_T, 1,
248 [Define to 1 if socklen_t is available or a equivalent is defined.])
250 dnl socklen_t not available
251 AC_CACHE_CHECK([for socklen_t equivalent],
252 [curl_cv_socklen_t_equiv], [
253 curl_cv_socklen_t_equiv="unknown"
254 for arg1 in 'int' 'SOCKET'; do
255 for arg2 in "struct sockaddr" void; do
256 for t in int size_t unsigned long "unsigned long"; do
260 #ifdef HAVE_WINDOWS_H
261 #ifndef WIN32_LEAN_AND_MEAN
262 #define WIN32_LEAN_AND_MEAN
265 #ifdef HAVE_WINSOCK2_H
266 #include <winsock2.h>
268 #ifdef HAVE_WINSOCK_H
272 #define GETPEERNCALLCONV PASCAL
274 #ifdef HAVE_SYS_TYPES_H
275 #include <sys/types.h>
277 #ifdef HAVE_SYS_SOCKET_H
278 #include <sys/socket.h>
280 #define GETPEERNCALLCONV
282 extern int GETPEERNCALLCONV getpeername ($arg1, $arg2 *, $t *);
285 getpeername(0,0,&len);
288 curl_cv_socklen_t_equiv="$t"
295 case "$curl_cv_socklen_t_equiv" in
297 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
300 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
301 [type to use in place of socklen_t if not defined])
302 AC_DEFINE_UNQUOTED(HAVE_SOCKLEN_T, 1,
303 [Define to 1 if socklen_t is available or a equivalent is defined.])
308 #ifdef HAVE_WINDOWS_H
309 #ifndef WIN32_LEAN_AND_MEAN
310 #define WIN32_LEAN_AND_MEAN
313 #ifdef HAVE_WINSOCK2_H
314 #include <winsock2.h>
315 #ifdef HAVE_WS2TCPIP_H
316 #include <ws2tcpip.h>
320 #ifdef HAVE_SYS_TYPES_H
321 #include <sys/types.h>
323 #ifdef HAVE_SYS_SOCKET_H
324 #include <sys/socket.h>
331 dnl CURL_CHECK_FUNC_GETNAMEINFO
332 dnl -------------------------------------------------
333 dnl Test if the getnameinfo function is available,
334 dnl and check the types of five of its arguments.
335 dnl If the function succeeds HAVE_GETNAMEINFO will be
336 dnl defined, defining the types of the arguments in
337 dnl GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2,
338 dnl GETNAMEINFO_TYPE_ARG46 and GETNAMEINFO_TYPE_ARG7,
339 dnl and also defining the type qualifier of first
340 dnl argument in GETNAMEINFO_QUAL_ARG1.
342 AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [
343 AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl
344 AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl
345 AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h)
347 AC_MSG_CHECKING([for getnameinfo])
349 AC_LANG_FUNC_LINK_TRY([getnameinfo])
352 curl_cv_getnameinfo="yes"
355 curl_cv_getnameinfo="no"
358 if test "$curl_cv_getnameinfo" != "yes"; then
359 AC_MSG_CHECKING([deeper for getnameinfo])
367 curl_cv_getnameinfo="yes"
369 AC_MSG_RESULT([but still no])
370 curl_cv_getnameinfo="no"
374 if test "$curl_cv_getnameinfo" != "yes"; then
375 AC_MSG_CHECKING([deeper and deeper for getnameinfo])
379 #ifdef HAVE_WINDOWS_H
380 #ifndef WIN32_LEAN_AND_MEAN
381 #define WIN32_LEAN_AND_MEAN
384 #ifdef HAVE_WINSOCK2_H
385 #include <winsock2.h>
386 #ifdef HAVE_WS2TCPIP_H
387 #include <ws2tcpip.h>
391 #ifdef HAVE_SYS_TYPES_H
392 #include <sys/types.h>
394 #ifdef HAVE_SYS_SOCKET_H
395 #include <sys/socket.h>
402 getnameinfo(0, 0, 0, 0, 0, 0, 0);
406 curl_cv_getnameinfo="yes"
408 AC_MSG_RESULT([but still no])
409 curl_cv_getnameinfo="no"
413 if test "$curl_cv_getnameinfo" = "yes"; then
414 AC_CACHE_CHECK([types of arguments for getnameinfo],
415 [curl_cv_func_getnameinfo_args], [
416 curl_cv_func_getnameinfo_args="unknown"
417 for gni_arg1 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
418 for gni_arg2 in 'socklen_t' 'size_t' 'int'; do
419 for gni_arg46 in 'size_t' 'int' 'socklen_t' 'unsigned int' 'DWORD'; do
420 for gni_arg7 in 'int' 'unsigned int'; do
424 #ifdef HAVE_WINDOWS_H
425 #ifndef WIN32_LEAN_AND_MEAN
426 #define WIN32_LEAN_AND_MEAN
428 #if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501)
430 #define _WIN32_WINNT 0x0501
433 #ifdef HAVE_WINSOCK2_H
434 #include <winsock2.h>
435 #ifdef HAVE_WS2TCPIP_H
436 #include <ws2tcpip.h>
439 #define GNICALLCONV WSAAPI
441 #ifdef HAVE_SYS_TYPES_H
442 #include <sys/types.h>
444 #ifdef HAVE_SYS_SOCKET_H
445 #include <sys/socket.h>
452 extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2,
458 $gni_arg46 hostlen=0;
459 $gni_arg46 servlen=0;
461 int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags);
464 curl_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7"
472 if test "$curl_cv_func_getnameinfo_args" = "unknown"; then
473 AC_MSG_WARN([Cannot find proper types to use for getnameinfo args])
474 AC_MSG_WARN([HAVE_GETNAMEINFO will not be defined])
476 gni_prev_IFS=$IFS; IFS=','
477 set dummy `echo "$curl_cv_func_getnameinfo_args" | sed 's/\*/\*/g'`
481 gni_qual_type_arg1=$[1]
483 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2],
484 [Define to the type of arg 2 for getnameinfo.])
485 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3],
486 [Define to the type of args 4 and 6 for getnameinfo.])
487 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4],
488 [Define to the type of arg 7 for getnameinfo.])
492 case $prev_sh_opts in
500 case "$gni_qual_type_arg1" in
503 gni_type_arg1=`echo $gni_qual_type_arg1 | sed 's/^const //'`
507 gni_type_arg1=$gni_qual_type_arg1
511 AC_DEFINE_UNQUOTED(GETNAMEINFO_QUAL_ARG1, $gni_qual_arg1,
512 [Define to the type qualifier of arg 1 for getnameinfo.])
513 AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $gni_type_arg1,
514 [Define to the type of arg 1 for getnameinfo.])
516 case $prev_sh_opts in
524 AC_DEFINE_UNQUOTED(HAVE_GETNAMEINFO, 1,
525 [Define to 1 if you have the getnameinfo function.])
526 ac_cv_func_getnameinfo="yes"
532 dnl TYPE_SOCKADDR_STORAGE
533 dnl -------------------------------------------------
534 dnl Check for struct sockaddr_storage. Most IPv6-enabled
535 dnl hosts have it, but AIX 4.3 is one known exception.
537 AC_DEFUN([TYPE_SOCKADDR_STORAGE],
539 AC_CHECK_TYPE([struct sockaddr_storage],
540 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
541 [if struct sockaddr_storage is defined]), ,
544 #ifdef HAVE_WINDOWS_H
545 #ifndef WIN32_LEAN_AND_MEAN
546 #define WIN32_LEAN_AND_MEAN
549 #ifdef HAVE_WINSOCK2_H
550 #include <winsock2.h>
553 #ifdef HAVE_SYS_TYPES_H
554 #include <sys/types.h>
556 #ifdef HAVE_SYS_SOCKET_H
557 #include <sys/socket.h>
559 #ifdef HAVE_NETINET_IN_H
560 #include <netinet/in.h>
562 #ifdef HAVE_ARPA_INET_H
563 #include <arpa/inet.h>
570 dnl CURL_CHECK_NI_WITHSCOPEID
571 dnl -------------------------------------------------
572 dnl Check for working NI_WITHSCOPEID in getnameinfo()
574 AC_DEFUN([CURL_CHECK_NI_WITHSCOPEID], [
575 AC_REQUIRE([CURL_CHECK_FUNC_GETNAMEINFO])dnl
576 AC_REQUIRE([TYPE_SOCKADDR_STORAGE])dnl
577 AC_CHECK_HEADERS(stdio.h sys/types.h sys/socket.h \
578 netdb.h netinet/in.h arpa/inet.h)
580 AC_CACHE_CHECK([for working NI_WITHSCOPEID],
581 [ac_cv_working_ni_withscopeid], [
587 #ifdef HAVE_SYS_TYPES_H
588 #include <sys/types.h>
590 #ifdef HAVE_SYS_SOCKET_H
591 #include <sys/socket.h>
596 #ifdef HAVE_NETINET_IN_H
597 #include <netinet/in.h>
599 #ifdef HAVE_ARPA_INET_H
600 #include <arpa/inet.h>
603 #if defined(NI_WITHSCOPEID) && defined(HAVE_GETNAMEINFO)
604 #ifdef HAVE_STRUCT_SOCKADDR_STORAGE
605 struct sockaddr_storage sa;
607 unsigned char sa[256];
609 char hostbuf[NI_MAXHOST];
611 GETNAMEINFO_TYPE_ARG2 salen = (GETNAMEINFO_TYPE_ARG2)sizeof(sa);
612 GETNAMEINFO_TYPE_ARG46 hostlen = (GETNAMEINFO_TYPE_ARG46)sizeof(hostbuf);
613 GETNAMEINFO_TYPE_ARG7 flags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
614 int fd = socket(AF_INET6, SOCK_STREAM, 0);
617 return 1; /* Error creating socket */
619 rc = getsockname(fd, (GETNAMEINFO_TYPE_ARG1)&sa, &salen);
621 perror("getsockname()");
622 return 2; /* Error retrieving socket name */
624 rc = getnameinfo((GETNAMEINFO_TYPE_ARG1)&sa, salen, hostbuf, hostlen, NULL, 0, flags);
626 printf("rc = %s\n", gai_strerror(rc));
627 return 3; /* Error translating socket address */
629 return 0; /* Ok, NI_WITHSCOPEID works */
631 return 4; /* Error, NI_WITHSCOPEID not defined or no getnameinfo() */
633 ]]) # AC_LANG_PROGRAM
635 # Exit code == 0. Program worked.
636 ac_cv_working_ni_withscopeid="yes"
638 # Exit code != 0. Program failed.
639 ac_cv_working_ni_withscopeid="no"
641 # Program is not run when cross-compiling. So we assume
642 # NI_WITHSCOPEID will work if we are able to compile it.
645 #include <sys/types.h>
646 #include <sys/socket.h>
649 unsigned int dummy= NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
652 ac_cv_working_ni_withscopeid="yes"
654 ac_cv_working_ni_withscopeid="no"
655 ]) # AC_COMPILE_IFELSE
658 case "$ac_cv_working_ni_withscopeid" in
660 AC_DEFINE(HAVE_NI_WITHSCOPEID, 1,
661 [Define to 1 if NI_WITHSCOPEID exists and works.])
667 dnl CURL_CHECK_FUNC_RECV
668 dnl -------------------------------------------------
669 dnl Test if the socket recv() function is available,
670 dnl and check its return type and the types of its
671 dnl arguments. If the function succeeds HAVE_RECV
672 dnl will be defined, defining the types of the arguments
673 dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
674 dnl and RECV_TYPE_ARG4, defining the type of the function
675 dnl return value in RECV_TYPE_RETV.
677 AC_DEFUN([CURL_CHECK_FUNC_RECV], [
678 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
679 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
680 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
682 AC_MSG_CHECKING([for recv])
686 #ifdef HAVE_WINDOWS_H
687 #ifndef WIN32_LEAN_AND_MEAN
688 #define WIN32_LEAN_AND_MEAN
691 #ifdef HAVE_WINSOCK2_H
692 #include <winsock2.h>
694 #ifdef HAVE_WINSOCK_H
699 #ifdef HAVE_SYS_TYPES_H
700 #include <sys/types.h>
702 #ifdef HAVE_SYS_SOCKET_H
703 #include <sys/socket.h>
717 if test "$curl_cv_recv" = "yes"; then
718 AC_CACHE_CHECK([types of args and return type for recv],
719 [curl_cv_func_recv_args], [
720 curl_cv_func_recv_args="unknown"
721 for recv_retv in 'int' 'ssize_t'; do
722 for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
723 for recv_arg2 in 'char *' 'void *'; do
724 for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
725 for recv_arg4 in 'int' 'unsigned int'; do
729 #ifdef HAVE_WINDOWS_H
730 #ifndef WIN32_LEAN_AND_MEAN
731 #define WIN32_LEAN_AND_MEAN
734 #ifdef HAVE_WINSOCK2_H
735 #include <winsock2.h>
737 #ifdef HAVE_WINSOCK_H
741 #define RECVCALLCONV PASCAL
743 #ifdef HAVE_SYS_TYPES_H
744 #include <sys/types.h>
746 #ifdef HAVE_SYS_SOCKET_H
747 #include <sys/socket.h>
751 extern $recv_retv RECVCALLCONV recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
757 $recv_retv res = recv(s, buf, len, flags);
760 curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
769 if test "$curl_cv_func_recv_args" = "unknown"; then
770 AC_MSG_ERROR([Cannot find proper types to use for recv args])
772 recv_prev_IFS=$IFS; IFS=','
773 set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
777 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
778 [Define to the type of arg 1 for recv.])
779 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
780 [Define to the type of arg 2 for recv.])
781 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
782 [Define to the type of arg 3 for recv.])
783 AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
784 [Define to the type of arg 4 for recv.])
785 AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
786 [Define to the function return type for recv.])
788 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
789 [Define to 1 if you have the recv function.])
790 ac_cv_func_recv="yes"
793 AC_MSG_ERROR([Unable to link function recv])
798 dnl CURL_CHECK_FUNC_SEND
799 dnl -------------------------------------------------
800 dnl Test if the socket send() function is available,
801 dnl and check its return type and the types of its
802 dnl arguments. If the function succeeds HAVE_SEND
803 dnl will be defined, defining the types of the arguments
804 dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
805 dnl and SEND_TYPE_ARG4, defining the type of the function
806 dnl return value in SEND_TYPE_RETV, and also defining the
807 dnl type qualifier of second argument in SEND_QUAL_ARG2.
809 AC_DEFUN([CURL_CHECK_FUNC_SEND], [
810 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
811 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
812 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
814 AC_MSG_CHECKING([for send])
818 #ifdef HAVE_WINDOWS_H
819 #ifndef WIN32_LEAN_AND_MEAN
820 #define WIN32_LEAN_AND_MEAN
823 #ifdef HAVE_WINSOCK2_H
824 #include <winsock2.h>
826 #ifdef HAVE_WINSOCK_H
831 #ifdef HAVE_SYS_TYPES_H
832 #include <sys/types.h>
834 #ifdef HAVE_SYS_SOCKET_H
835 #include <sys/socket.h>
849 if test "$curl_cv_send" = "yes"; then
850 AC_CACHE_CHECK([types of args and return type for send],
851 [curl_cv_func_send_args], [
852 curl_cv_func_send_args="unknown"
853 for send_retv in 'int' 'ssize_t'; do
854 for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
855 for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
856 for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
857 for send_arg4 in 'int' 'unsigned int'; do
861 #ifdef HAVE_WINDOWS_H
862 #ifndef WIN32_LEAN_AND_MEAN
863 #define WIN32_LEAN_AND_MEAN
866 #ifdef HAVE_WINSOCK2_H
867 #include <winsock2.h>
869 #ifdef HAVE_WINSOCK_H
873 #define SENDCALLCONV PASCAL
875 #ifdef HAVE_SYS_TYPES_H
876 #include <sys/types.h>
878 #ifdef HAVE_SYS_SOCKET_H
879 #include <sys/socket.h>
883 extern $send_retv SENDCALLCONV send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
888 $send_retv res = send(s, 0, len, flags);
891 curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
900 if test "$curl_cv_func_send_args" = "unknown"; then
901 AC_MSG_ERROR([Cannot find proper types to use for send args])
903 send_prev_IFS=$IFS; IFS=','
904 set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
908 send_qual_type_arg2=$[2]
910 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
911 [Define to the type of arg 1 for send.])
912 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
913 [Define to the type of arg 3 for send.])
914 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
915 [Define to the type of arg 4 for send.])
916 AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
917 [Define to the function return type for send.])
921 case $prev_sh_opts in
929 case "$send_qual_type_arg2" in
932 send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
936 send_type_arg2=$send_qual_type_arg2
940 AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
941 [Define to the type qualifier of arg 2 for send.])
942 AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
943 [Define to the type of arg 2 for send.])
945 case $prev_sh_opts in
953 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
954 [Define to 1 if you have the send function.])
955 ac_cv_func_send="yes"
958 AC_MSG_ERROR([Unable to link function send])
963 dnl CURL_CHECK_MSG_NOSIGNAL
964 dnl -------------------------------------------------
965 dnl Check for MSG_NOSIGNAL
967 AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
968 AC_CHECK_HEADERS(sys/types.h sys/socket.h)
969 AC_CACHE_CHECK([for MSG_NOSIGNAL], [ac_cv_msg_nosignal], [
973 #ifdef HAVE_WINDOWS_H
974 #ifndef WIN32_LEAN_AND_MEAN
975 #define WIN32_LEAN_AND_MEAN
978 #ifdef HAVE_WINSOCK2_H
979 #include <winsock2.h>
981 #ifdef HAVE_WINSOCK_H
986 #ifdef HAVE_SYS_TYPES_H
987 #include <sys/types.h>
989 #ifdef HAVE_SYS_SOCKET_H
990 #include <sys/socket.h>
994 int flag=MSG_NOSIGNAL;
997 ac_cv_msg_nosignal="yes"
999 ac_cv_msg_nosignal="no"
1002 case "$ac_cv_msg_nosignal" in
1004 AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
1005 [Define to 1 if you have the MSG_NOSIGNAL flag.])
1011 dnl CURL_CHECK_STRUCT_TIMEVAL
1012 dnl -------------------------------------------------
1013 dnl Check for timeval struct
1015 AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
1016 AC_REQUIRE([AC_HEADER_TIME])dnl
1017 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
1018 AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
1019 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1020 AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [
1024 #ifdef HAVE_WINDOWS_H
1025 #ifndef WIN32_LEAN_AND_MEAN
1026 #define WIN32_LEAN_AND_MEAN
1028 #include <windows.h>
1029 #ifdef HAVE_WINSOCK2_H
1030 #include <winsock2.h>
1032 #ifdef HAVE_WINSOCK_H
1033 #include <winsock.h>
1037 #ifdef HAVE_SYS_TYPES_H
1038 #include <sys/types.h>
1040 #ifdef HAVE_SYS_TIME_H
1041 #include <sys/time.h>
1042 #ifdef TIME_WITH_SYS_TIME
1056 ac_cv_struct_timeval="yes"
1058 ac_cv_struct_timeval="no"
1061 case "$ac_cv_struct_timeval" in
1063 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
1064 [Define to 1 if you have the timeval struct.])
1070 dnl TYPE_SIG_ATOMIC_T
1071 dnl -------------------------------------------------
1072 dnl Check if the sig_atomic_t type is available, and
1073 dnl verify if it is already defined as volatile.
1075 AC_DEFUN([TYPE_SIG_ATOMIC_T], [
1076 AC_CHECK_HEADERS(signal.h)
1077 AC_CHECK_TYPE([sig_atomic_t],[
1078 AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
1079 [Define to 1 if sig_atomic_t is an available typedef.])
1081 #ifdef HAVE_SIGNAL_H
1085 case "$ac_cv_type_sig_atomic_t" in
1088 AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
1091 #ifdef HAVE_SIGNAL_H
1095 static volatile sig_atomic_t dummy = 0;
1099 ac_cv_sig_atomic_t_volatile="no"
1101 AC_MSG_RESULT([yes])
1102 ac_cv_sig_atomic_t_volatile="yes"
1105 if test "$ac_cv_sig_atomic_t_volatile" = "yes"; then
1106 AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
1107 [Define to 1 if sig_atomic_t is already defined as volatile.])
1114 dnl CURL_CHECK_NONBLOCKING_SOCKET
1115 dnl -------------------------------------------------
1116 dnl Check for how to set a socket to non-blocking state. There seems to exist
1117 dnl four known different ways, with the one used almost everywhere being POSIX
1118 dnl and XPG3, while the other different ways for different systems (old BSD,
1119 dnl Windows and Amiga).
1121 dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
1122 dnl O_NONBLOCK define is found but does not work. This condition is attempted
1123 dnl to get caught in this script by using an excessive number of #ifdefs...
1125 AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET], [
1126 AC_MSG_CHECKING([non-blocking sockets style])
1131 /* headers for O_NONBLOCK test */
1132 #include <sys/types.h>
1136 #if defined(sun) || defined(__sun__) || \
1137 defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1138 # if defined(__SVR4) || defined(__srv4__)
1139 # define PLATFORM_SOLARIS
1141 # define PLATFORM_SUNOS4
1144 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
1145 # define PLATFORM_AIX_V3
1148 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
1149 #error "O_NONBLOCK does not work on this platform"
1152 /* O_NONBLOCK source test */
1154 int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
1157 dnl the O_NONBLOCK test was fine
1158 nonblock="O_NONBLOCK"
1159 AC_DEFINE(HAVE_O_NONBLOCK, 1,
1160 [use O_NONBLOCK for non-blocking sockets])
1163 if test "$nonblock" = "unknown"; then
1166 /* headers for FIONBIO test */
1168 #include <stropts.h>
1170 /* FIONBIO source test (old-style unix) */
1172 int flags = ioctl(socket, FIONBIO, &flags);
1175 dnl FIONBIO test was good
1177 AC_DEFINE(HAVE_FIONBIO, 1,
1178 [use FIONBIO for non-blocking sockets])
1182 if test "$nonblock" = "unknown"; then
1185 /* headers for ioctlsocket test (Windows) */
1187 #ifdef HAVE_WINDOWS_H
1188 #ifndef WIN32_LEAN_AND_MEAN
1189 #define WIN32_LEAN_AND_MEAN
1191 #include <windows.h>
1192 #ifdef HAVE_WINSOCK2_H
1193 #include <winsock2.h>
1195 #ifdef HAVE_WINSOCK_H
1196 #include <winsock.h>
1201 /* ioctlsocket source code (Windows) */
1203 unsigned long flags = 0;
1204 sd = socket(0, 0, 0);
1205 ioctlsocket(sd, FIONBIO, &flags);
1208 dnl ioctlsocket test was good
1209 nonblock="ioctlsocket"
1210 AC_DEFINE(HAVE_IOCTLSOCKET, 1,
1211 [use ioctlsocket() for non-blocking sockets])
1215 if test "$nonblock" = "unknown"; then
1218 /* headers for IoctlSocket test (Amiga?) */
1219 #include <sys/ioctl.h>
1221 /* IoctlSocket source code (Amiga?) */
1223 int flags = IoctlSocket(socket, FIONBIO, (long)1);
1226 dnl Ioctlsocket test was good
1227 nonblock="IoctlSocket"
1228 AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1,
1229 [use Ioctlsocket() for non-blocking sockets])
1233 if test "$nonblock" = "unknown"; then
1236 /* headers for SO_NONBLOCK test (BeOS) */
1239 /* SO_NONBLOCK source code (BeOS) */
1242 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
1245 dnl the SO_NONBLOCK test was good
1246 nonblock="SO_NONBLOCK"
1247 AC_DEFINE(HAVE_SO_NONBLOCK, 1,
1248 [use SO_NONBLOCK for non-blocking sockets])
1252 AC_MSG_RESULT($nonblock)
1254 if test "$nonblock" = "unknown"; then
1255 AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1,
1256 [disabled non-blocking sockets])
1257 AC_MSG_WARN([non-block sockets disabled])
1263 dnl -------------------------------------------------
1264 dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
1265 dnl and a few other things.
1266 AC_DEFUN([TYPE_IN_ADDR_T],
1268 AC_CHECK_TYPE([in_addr_t], ,[
1269 AC_MSG_CHECKING([for in_addr_t equivalent])
1270 AC_CACHE_VAL([curl_cv_in_addr_t_equiv],
1272 curl_cv_in_addr_t_equiv=
1273 for t in "unsigned long" int size_t unsigned long; do
1277 #ifdef HAVE_WINDOWS_H
1278 #ifndef WIN32_LEAN_AND_MEAN
1279 #define WIN32_LEAN_AND_MEAN
1281 #include <windows.h>
1282 #ifdef HAVE_WINSOCK2_H
1283 #include <winsock2.h>
1285 #ifdef HAVE_WINSOCK_H
1286 #include <winsock.h>
1290 #ifdef HAVE_SYS_TYPES_H
1291 #include <sys/types.h>
1293 #ifdef HAVE_SYS_SOCKET_H
1294 #include <sys/socket.h>
1296 #ifdef HAVE_NETINET_IN_H
1297 #include <netinet/in.h>
1299 #ifdef HAVE_ARPA_INET_H
1300 #include <arpa/inet.h>
1304 $t data = inet_addr ("1.2.3.4");
1307 curl_cv_in_addr_t_equiv="$t"
1312 if test "x$curl_cv_in_addr_t_equiv" = x; then
1313 AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
1316 AC_MSG_RESULT($curl_cv_in_addr_t_equiv)
1317 AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
1318 [type to use in place of in_addr_t if not defined])],
1321 #ifdef HAVE_WINDOWS_H
1322 #ifndef WIN32_LEAN_AND_MEAN
1323 #define WIN32_LEAN_AND_MEAN
1325 #include <windows.h>
1326 #ifdef HAVE_WINSOCK2_H
1327 #include <winsock2.h>
1329 #ifdef HAVE_WINSOCK_H
1330 #include <winsock.h>
1334 #ifdef HAVE_SYS_TYPES_H
1335 #include <sys/types.h>
1337 #ifdef HAVE_SYS_SOCKET_H
1338 #include <sys/socket.h>
1340 #ifdef HAVE_NETINET_IN_H
1341 #include <netinet/in.h>
1343 #ifdef HAVE_ARPA_INET_H
1344 #include <arpa/inet.h>
1347 ]) dnl AC_CHECK_TYPE
1350 dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
1351 dnl -------------------------------------------------
1352 dnl Check if monotonic clock_gettime is available.
1354 AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
1355 AC_REQUIRE([AC_HEADER_TIME])dnl
1356 AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
1357 AC_MSG_CHECKING([for monotonic clock_gettime])
1360 #ifdef HAVE_SYS_TYPES_H
1361 #include <sys/types.h>
1363 #ifdef HAVE_SYS_TIME_H
1364 #include <sys/time.h>
1365 #ifdef TIME_WITH_SYS_TIME
1375 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1378 AC_MSG_RESULT([yes])
1379 ac_cv_func_clock_gettime="yes"
1382 ac_cv_func_clock_gettime="no"
1384 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally
1385 dnl postponed until library linking checks for clock_gettime pass.
1388 dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
1389 dnl -------------------------------------------------
1390 dnl If monotonic clock_gettime is available then,
1391 dnl check and prepended to LIBS any needed libraries.
1393 AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
1394 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
1396 if test "$ac_cv_func_clock_gettime" = "yes"; then
1398 AC_MSG_CHECKING([for clock_gettime in libraries])
1400 curl_cv_save_LIBS="$LIBS"
1401 curl_cv_gclk_LIBS="unknown"
1403 for x_xlibs in '' '-lrt' '-lposix4' ; do
1404 if test -z "$x_xlibs"; then
1405 LIBS="$curl_cv_save_LIBS"
1407 LIBS="$x_xlibs $curl_cv_save_LIBS"
1411 #ifdef HAVE_SYS_TYPES_H
1412 #include <sys/types.h>
1414 #ifdef HAVE_SYS_TIME_H
1415 #include <sys/time.h>
1416 #ifdef TIME_WITH_SYS_TIME
1426 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
1429 curl_cv_gclk_LIBS="$x_xlibs"
1434 LIBS="$curl_cv_save_LIBS"
1436 case X-"$curl_cv_gclk_LIBS" in
1438 AC_MSG_RESULT([cannot find clock_gettime])
1439 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
1440 ac_cv_func_clock_gettime="no"
1443 AC_MSG_RESULT([no additional lib required])
1444 ac_cv_func_clock_gettime="yes"
1447 if test -z "$curl_cv_save_LIBS"; then
1448 LIBS="$curl_cv_gclk_LIBS"
1450 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
1452 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
1453 ac_cv_func_clock_gettime="yes"
1457 case "$ac_cv_func_clock_gettime" in
1459 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
1460 [Define to 1 if you have the clock_gettime function and monotonic timer.])
1468 dnl **********************************************************************
1469 dnl CURL_DETECT_ICC ([ACTION-IF-YES])
1471 dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
1472 dnl sets the $ICC variable to "yes" or "no"
1473 dnl **********************************************************************
1474 AC_DEFUN([CURL_DETECT_ICC],
1477 AC_MSG_CHECKING([for icc in use])
1478 if test "$GCC" = "yes"; then
1479 dnl check if this is icc acting as gcc in disguise
1480 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
1481 dnl action if the text is found, this it has not been replaced by the
1484 dnl the text was not found, it was replaced by the cpp
1486 AC_MSG_RESULT([yes])
1490 if test "$ICC" = "no"; then
1496 dnl We create a function for detecting which compiler we use and then set as
1497 dnl pendantic compiler options as possible for that particular compiler. The
1498 dnl options are only used for debug-builds.
1500 dnl This is a copy of the original found in curl's configure script. Don't
1501 dnl modify this one, edit the one in curl and copy it back here when that one
1504 AC_DEFUN([CURL_CC_DEBUG_OPTS],
1506 if test "z$ICC" = "z"; then
1510 if test "$GCC" = "yes"; then
1512 dnl figure out gcc version!
1513 AC_MSG_CHECKING([gcc version])
1514 gccver=`$CC -dumpversion`
1515 num1=`echo $gccver | cut -d . -f1`
1516 num2=`echo $gccver | cut -d . -f2`
1517 gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
1518 AC_MSG_RESULT($gccver)
1520 if test "$ICC" = "yes"; then
1521 dnl this is icc, not gcc.
1523 dnl ICC warnings we ignore:
1524 dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
1525 dnl "invalid format string conversion"
1526 dnl * 279 warns on static conditions in while expressions
1527 dnl * 981 warns on "operands are evaluated in unspecified order"
1528 dnl * 1418 "external definition with no prior declaration"
1529 dnl * 1419 warns on "external declaration in primary source file"
1530 dnl which we know and do on purpose.
1532 WARN="-wd279,269,981,1418,1419"
1534 if test "$gccnum" -gt "600"; then
1535 dnl icc 6.0 and older doesn't have the -Wall flag
1539 dnl this is a set of options we believe *ALL* gcc versions support:
1540 WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
1542 dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
1544 if test "$gccnum" -ge "207"; then
1545 dnl gcc 2.7 or later
1546 WARN="$WARN -Wmissing-declarations"
1549 if test "$gccnum" -gt "295"; then
1550 dnl only if the compiler is newer than 2.95 since we got lots of
1551 dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
1552 dnl gcc 2.95.4 on FreeBSD 4.9!
1553 WARN="$WARN -Wundef -Wno-long-long -Wsign-compare -Wshadow -Wno-multichar"
1556 if test "$gccnum" -ge "296"; then
1557 dnl gcc 2.96 or later
1558 WARN="$WARN -Wfloat-equal"
1561 if test "$gccnum" -gt "296"; then
1562 dnl this option does not exist in 2.96
1563 WARN="$WARN -Wno-format-nonliteral"
1566 dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
1567 dnl on i686-Linux as it gives us heaps with false positives.
1568 dnl Also, on gcc 4.0.X it is totally unbearable and complains all
1569 dnl over making it unusable for generic purposes. Let's not use it.
1571 if test "$gccnum" -ge "303"; then
1572 dnl gcc 3.3 and later
1573 WARN="$WARN -Wendif-labels -Wstrict-prototypes"
1576 if test "$gccnum" -ge "304"; then
1577 # try these on gcc 3.4
1578 WARN="$WARN -Wdeclaration-after-statement"
1581 for flag in $CPPFLAGS; do
1584 dnl Include path, provide a -isystem option for the same dir
1585 dnl to prevent warnings in those dirs. The -isystem was not very
1586 dnl reliable on earlier gcc versions.
1587 add=`echo $flag | sed 's/^-I/-isystem /g'`
1595 CFLAGS="$CFLAGS $WARN"
1597 AC_MSG_NOTICE([Added this set of compiler options: $WARN])
1601 AC_MSG_NOTICE([Added no extra compiler options])
1605 dnl strip off optimizer flags
1607 for flag in $CFLAGS; do
1610 dnl echo "cut off $flag"
1613 NEWFLAGS="$NEWFLAGS $flag"
1619 ]) dnl end of AC_DEFUN()
1622 dnl This macro determines if the specified struct exists in the specified file
1624 dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found])
1626 AC_DEFUN([CARES_CHECK_STRUCT], [
1627 AC_MSG_CHECKING([for struct $2])
1628 AC_TRY_COMPILE([$1],
1630 struct $2 struct_instance;
1631 ], ac_struct="yes", ac_found="no")
1632 if test "$ac_struct" = "yes" ; then
1641 dnl This macro determines if the specified constant exists in the specified file
1643 dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found])
1645 AC_DEFUN([CARES_CHECK_CONSTANT], [
1646 AC_MSG_CHECKING([for $2])
1647 AC_EGREP_CPP(VARIABLEWASDEFINED,
1656 ], ac_constant="yes", ac_constant="no"
1658 if test "$ac_constant" = "yes" ; then
1668 dnl CARES_CHECK_GETSERVBYPORT_R
1669 dnl -------------------------------------------------
1670 dnl Test if the getservbyport_r function is available,
1671 dnl and find out how many parameters it takes.
1673 AC_DEFUN([CARES_CHECK_GETSERVBYPORT_R], [
1674 AC_MSG_CHECKING([how many arguments getservbyport_r takes])
1675 ac_func_getservbyport_r="unknown"
1683 struct servent *p3, *p6;
1684 getservbyport_r(p1, p2, p3, p4, p5, &p6);
1687 ac_func_getservbyport_r="6"
1690 if test "$ac_func_getservbyport_r" = "unknown"; then
1698 getservbyport_r(p1, p2, p3, p4, p5);
1701 ac_func_getservbyport_r="5"
1705 if test "$ac_func_getservbyport_r" = "unknown"; then
1713 struct servent_data p4;
1714 getservbyport_r(p1, p2, p3, &p4);
1717 ac_func_getservbyport_r="4"
1721 if test "$ac_func_getservbyport_r" = "unknown"; then
1722 AC_MSG_RESULT([not found])
1724 AC_MSG_RESULT($ac_func_getservbyport_r)
1725 AC_DEFINE(HAVE_GETSERVBYPORT_R, 1,
1726 [Specifies whether getservbyport_r is present])
1727 AC_DEFINE_UNQUOTED(GETSERVBYPORT_R_ARGS, $ac_func_getservbyport_r,
1728 [Specifies the number of arguments to getservbyport_r])
1729 if test "$ac_func_getservbyport_r" = "4" ; then
1730 AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, sizeof(struct servent_data),
1731 [Specifies the size of the buffer to pass to getservbyport_r])
1733 AC_DEFINE(GETSERVBYPORT_R_BUFSIZE, 4096,
1734 [Specifies the size of the buffer to pass to getservbyport_r])