blob: 49ab0b03f03d0357f9c7dc904dfa6a7ae476cdfa [file] [log] [blame]
xf.li6c8fc1e2023-08-12 00:11:09 -07001#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) 1998 - 2022, Daniel Stenberg, <daniel@haxx.se>, et al.
9#
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 https://curl.se/docs/copyright.html.
13#
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.
17#
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
20#
21# SPDX-License-Identifier: curl
22#
23#***************************************************************************
24
25# File version for 'aclocal' use. Keep it a single number.
26# serial 73
27
28
29dnl CURL_INCLUDES_ARPA_INET
30dnl -------------------------------------------------
31dnl Set up variable with list of headers that must be
32dnl included when arpa/inet.h is to be included.
33
34AC_DEFUN([CURL_INCLUDES_ARPA_INET], [
35curl_includes_arpa_inet="\
36/* includes start */
37#ifdef HAVE_SYS_TYPES_H
38# include <sys/types.h>
39#endif
40#ifdef HAVE_SYS_SOCKET_H
41# include <sys/socket.h>
42#endif
43#ifdef HAVE_NETINET_IN_H
44# include <netinet/in.h>
45#endif
46#ifdef HAVE_ARPA_INET_H
47# include <arpa/inet.h>
48#endif
49#ifdef HAVE_WINSOCK2_H
50#include <winsock2.h>
51#include <ws2tcpip.h>
52#endif
53/* includes end */"
54 AC_CHECK_HEADERS(
55 sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
56 [], [], [$curl_includes_arpa_inet])
57])
58
59
60dnl CURL_INCLUDES_FCNTL
61dnl -------------------------------------------------
62dnl Set up variable with list of headers that must be
63dnl included when fcntl.h is to be included.
64
65AC_DEFUN([CURL_INCLUDES_FCNTL], [
66curl_includes_fcntl="\
67/* includes start */
68#ifdef HAVE_SYS_TYPES_H
69# include <sys/types.h>
70#endif
71#ifdef HAVE_UNISTD_H
72# include <unistd.h>
73#endif
74#ifdef HAVE_FCNTL_H
75# include <fcntl.h>
76#endif
77/* includes end */"
78 AC_CHECK_HEADERS(
79 sys/types.h unistd.h fcntl.h,
80 [], [], [$curl_includes_fcntl])
81])
82
83
84dnl CURL_INCLUDES_IFADDRS
85dnl -------------------------------------------------
86dnl Set up variable with list of headers that must be
87dnl included when ifaddrs.h is to be included.
88
89AC_DEFUN([CURL_INCLUDES_IFADDRS], [
90curl_includes_ifaddrs="\
91/* includes start */
92#ifdef HAVE_SYS_TYPES_H
93# include <sys/types.h>
94#endif
95#ifdef HAVE_SYS_SOCKET_H
96# include <sys/socket.h>
97#endif
98#ifdef HAVE_NETINET_IN_H
99# include <netinet/in.h>
100#endif
101#ifdef HAVE_IFADDRS_H
102# include <ifaddrs.h>
103#endif
104/* includes end */"
105 AC_CHECK_HEADERS(
106 sys/types.h sys/socket.h netinet/in.h ifaddrs.h,
107 [], [], [$curl_includes_ifaddrs])
108])
109
110
111dnl CURL_INCLUDES_INTTYPES
112dnl -------------------------------------------------
113dnl Set up variable with list of headers that must be
114dnl included when inttypes.h is to be included.
115
116AC_DEFUN([CURL_INCLUDES_INTTYPES], [
117curl_includes_inttypes="\
118/* includes start */
119#ifdef HAVE_SYS_TYPES_H
120# include <sys/types.h>
121#endif
122#ifdef HAVE_STDINT_H
123# include <stdint.h>
124#endif
125#ifdef HAVE_INTTYPES_H
126# include <inttypes.h>
127#endif
128/* includes end */"
129 case $host_os in
130 irix*)
131 ac_cv_header_stdint_h="no"
132 ;;
133 esac
134 AC_CHECK_HEADERS(
135 sys/types.h stdint.h inttypes.h,
136 [], [], [$curl_includes_inttypes])
137])
138
139
140dnl CURL_INCLUDES_LIBGEN
141dnl -------------------------------------------------
142dnl Set up variable with list of headers that must be
143dnl included when libgen.h is to be included.
144
145AC_DEFUN([CURL_INCLUDES_LIBGEN], [
146curl_includes_libgen="\
147/* includes start */
148#ifdef HAVE_SYS_TYPES_H
149# include <sys/types.h>
150#endif
151#ifdef HAVE_LIBGEN_H
152# include <libgen.h>
153#endif
154/* includes end */"
155 AC_CHECK_HEADERS(
156 sys/types.h libgen.h,
157 [], [], [$curl_includes_libgen])
158])
159
160
161dnl CURL_INCLUDES_NETDB
162dnl -------------------------------------------------
163dnl Set up variable with list of headers that must be
164dnl included when netdb.h is to be included.
165
166AC_DEFUN([CURL_INCLUDES_NETDB], [
167curl_includes_netdb="\
168/* includes start */
169#ifdef HAVE_SYS_TYPES_H
170# include <sys/types.h>
171#endif
172#ifdef HAVE_NETDB_H
173# include <netdb.h>
174#endif
175/* includes end */"
176 AC_CHECK_HEADERS(
177 sys/types.h netdb.h,
178 [], [], [$curl_includes_netdb])
179])
180
181
182dnl CURL_INCLUDES_POLL
183dnl -------------------------------------------------
184dnl Set up variable with list of headers that must be
185dnl included when poll.h is to be included.
186
187AC_DEFUN([CURL_INCLUDES_POLL], [
188curl_includes_poll="\
189/* includes start */
190#ifdef HAVE_SYS_TYPES_H
191# include <sys/types.h>
192#endif
193#ifdef HAVE_POLL_H
194# include <poll.h>
195#endif
196#ifdef HAVE_SYS_POLL_H
197# include <sys/poll.h>
198#endif
199/* includes end */"
200 AC_CHECK_HEADERS(
201 sys/types.h poll.h sys/poll.h,
202 [], [], [$curl_includes_poll])
203])
204
205
206dnl CURL_INCLUDES_SETJMP
207dnl -------------------------------------------------
208dnl Set up variable with list of headers that must be
209dnl included when setjmp.h is to be included.
210
211AC_DEFUN([CURL_INCLUDES_SETJMP], [
212curl_includes_setjmp="\
213/* includes start */
214#ifdef HAVE_SYS_TYPES_H
215# include <sys/types.h>
216#endif
217#ifdef HAVE_SETJMP_H
218# include <setjmp.h>
219#endif
220/* includes end */"
221 AC_CHECK_HEADERS(
222 sys/types.h setjmp.h,
223 [], [], [$curl_includes_setjmp])
224])
225
226
227dnl CURL_INCLUDES_SIGNAL
228dnl -------------------------------------------------
229dnl Set up variable with list of headers that must be
230dnl included when signal.h is to be included.
231
232AC_DEFUN([CURL_INCLUDES_SIGNAL], [
233curl_includes_signal="\
234/* includes start */
235#ifdef HAVE_SYS_TYPES_H
236# include <sys/types.h>
237#endif
238#ifdef HAVE_SIGNAL_H
239# include <signal.h>
240#endif
241/* includes end */"
242 AC_CHECK_HEADERS(
243 sys/types.h signal.h,
244 [], [], [$curl_includes_signal])
245])
246
247
248dnl CURL_INCLUDES_SOCKET
249dnl -------------------------------------------------
250dnl Set up variable with list of headers that must be
251dnl included when socket.h is to be included.
252
253AC_DEFUN([CURL_INCLUDES_SOCKET], [
254curl_includes_socket="\
255/* includes start */
256#ifdef HAVE_SYS_TYPES_H
257# include <sys/types.h>
258#endif
259#ifdef HAVE_SOCKET_H
260# include <socket.h>
261#endif
262/* includes end */"
263 AC_CHECK_HEADERS(
264 sys/types.h socket.h,
265 [], [], [$curl_includes_socket])
266])
267
268
269dnl CURL_INCLUDES_STDLIB
270dnl -------------------------------------------------
271dnl Set up variable with list of headers that must be
272dnl included when stdlib.h is to be included.
273
274AC_DEFUN([CURL_INCLUDES_STDLIB], [
275curl_includes_stdlib="\
276/* includes start */
277#ifdef HAVE_SYS_TYPES_H
278# include <sys/types.h>
279#endif
280#ifdef HAVE_STDLIB_H
281# include <stdlib.h>
282#endif
283/* includes end */"
284 AC_CHECK_HEADERS(
285 sys/types.h stdlib.h,
286 [], [], [$curl_includes_stdlib])
287])
288
289
290dnl CURL_INCLUDES_STRING
291dnl -------------------------------------------------
292dnl Set up variable with list of headers that must be
293dnl included when string(s).h is to be included.
294
295AC_DEFUN([CURL_INCLUDES_STRING], [
296curl_includes_string="\
297/* includes start */
298#ifdef HAVE_SYS_TYPES_H
299# include <sys/types.h>
300#endif
301#ifdef HAVE_STRING_H
302# include <string.h>
303#endif
304#ifdef HAVE_STRINGS_H
305# include <strings.h>
306#endif
307/* includes end */"
308 AC_CHECK_HEADERS(
309 sys/types.h string.h strings.h,
310 [], [], [$curl_includes_string])
311])
312
313
314dnl CURL_INCLUDES_STROPTS
315dnl -------------------------------------------------
316dnl Set up variable with list of headers that must be
317dnl included when stropts.h is to be included.
318
319AC_DEFUN([CURL_INCLUDES_STROPTS], [
320curl_includes_stropts="\
321/* includes start */
322#ifdef HAVE_SYS_TYPES_H
323# include <sys/types.h>
324#endif
325#ifdef HAVE_UNISTD_H
326# include <unistd.h>
327#endif
328#ifdef HAVE_SYS_SOCKET_H
329# include <sys/socket.h>
330#endif
331#ifdef HAVE_SYS_IOCTL_H
332# include <sys/ioctl.h>
333#endif
334#ifdef HAVE_STROPTS_H
335# include <stropts.h>
336#endif
337/* includes end */"
338 AC_CHECK_HEADERS(
339 sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h,
340 [], [], [$curl_includes_stropts])
341])
342
343
344dnl CURL_INCLUDES_SYS_SOCKET
345dnl -------------------------------------------------
346dnl Set up variable with list of headers that must be
347dnl included when sys/socket.h is to be included.
348
349AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [
350curl_includes_sys_socket="\
351/* includes start */
352#ifdef HAVE_SYS_TYPES_H
353# include <sys/types.h>
354#endif
355#ifdef HAVE_SYS_SOCKET_H
356# include <sys/socket.h>
357#endif
358/* includes end */"
359 AC_CHECK_HEADERS(
360 sys/types.h sys/socket.h,
361 [], [], [$curl_includes_sys_socket])
362])
363
364
365dnl CURL_INCLUDES_SYS_TYPES
366dnl -------------------------------------------------
367dnl Set up variable with list of headers that must be
368dnl included when sys/types.h is to be included.
369
370AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [
371curl_includes_sys_types="\
372/* includes start */
373#ifdef HAVE_SYS_TYPES_H
374# include <sys/types.h>
375#endif
376/* includes end */"
377 AC_CHECK_HEADERS(
378 sys/types.h,
379 [], [], [$curl_includes_sys_types])
380])
381
382
383dnl CURL_INCLUDES_SYS_UIO
384dnl -------------------------------------------------
385dnl Set up variable with list of headers that must be
386dnl included when sys/uio.h is to be included.
387
388AC_DEFUN([CURL_INCLUDES_SYS_UIO], [
389curl_includes_sys_uio="\
390/* includes start */
391#ifdef HAVE_SYS_TYPES_H
392# include <sys/types.h>
393#endif
394#ifdef HAVE_SYS_UIO_H
395# include <sys/uio.h>
396#endif
397/* includes end */"
398 AC_CHECK_HEADERS(
399 sys/types.h sys/uio.h,
400 [], [], [$curl_includes_sys_uio])
401])
402
403
404dnl CURL_INCLUDES_SYS_XATTR
405dnl -------------------------------------------------
406dnl Set up variable with list of headers that must be
407dnl included when sys/xattr.h is to be included.
408
409AC_DEFUN([CURL_INCLUDES_SYS_XATTR], [
410curl_includes_sys_xattr="\
411/* includes start */
412#ifdef HAVE_SYS_TYPES_H
413# include <sys/types.h>
414#endif
415#ifdef HAVE_SYS_XATTR_H
416# include <sys/xattr.h>
417#endif
418/* includes end */"
419 AC_CHECK_HEADERS(
420 sys/types.h sys/xattr.h,
421 [], [], [$curl_includes_sys_xattr])
422])
423
424dnl CURL_INCLUDES_TIME
425dnl -------------------------------------------------
426dnl Set up variable with list of headers that must be
427dnl included when time.h is to be included.
428
429AC_DEFUN([CURL_INCLUDES_TIME], [
430curl_includes_time="\
431/* includes start */
432#ifdef HAVE_SYS_TYPES_H
433# include <sys/types.h>
434#endif
435#ifdef HAVE_SYS_TIME_H
436# include <sys/time.h>
437#endif
438#include <time.h>
439/* includes end */"
440 AC_CHECK_HEADERS(
441 sys/types.h sys/time.h,
442 [], [], [$curl_includes_time])
443])
444
445
446dnl CURL_INCLUDES_UNISTD
447dnl -------------------------------------------------
448dnl Set up variable with list of headers that must be
449dnl included when unistd.h is to be included.
450
451AC_DEFUN([CURL_INCLUDES_UNISTD], [
452curl_includes_unistd="\
453/* includes start */
454#ifdef HAVE_SYS_TYPES_H
455# include <sys/types.h>
456#endif
457#ifdef HAVE_UNISTD_H
458# include <unistd.h>
459#endif
460/* includes end */"
461 AC_CHECK_HEADERS(
462 sys/types.h unistd.h,
463 [], [], [$curl_includes_unistd])
464])
465
466
467dnl CURL_INCLUDES_WINSOCK2
468dnl -------------------------------------------------
469dnl Set up variable with list of headers that must be
470dnl included when winsock2.h is to be included.
471
472AC_DEFUN([CURL_INCLUDES_WINSOCK2], [
473curl_includes_winsock2="\
474/* includes start */
475#ifdef HAVE_WINDOWS_H
476# ifndef WIN32_LEAN_AND_MEAN
477# define WIN32_LEAN_AND_MEAN
478# endif
479# include <windows.h>
480# ifdef HAVE_WINSOCK2_H
481# include <winsock2.h>
482# endif
483#endif
484/* includes end */"
485 CURL_CHECK_HEADER_WINDOWS
486 CURL_CHECK_HEADER_WINSOCK2
487])
488
489
490dnl CURL_INCLUDES_WS2TCPIP
491dnl -------------------------------------------------
492dnl Set up variable with list of headers that must be
493dnl included when ws2tcpip.h is to be included.
494
495AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [
496curl_includes_ws2tcpip="\
497/* includes start */
498#ifdef HAVE_WINDOWS_H
499# ifndef WIN32_LEAN_AND_MEAN
500# define WIN32_LEAN_AND_MEAN
501# endif
502# include <windows.h>
503# ifdef HAVE_WINSOCK2_H
504# include <winsock2.h>
505# ifdef HAVE_WS2TCPIP_H
506# include <ws2tcpip.h>
507# endif
508# endif
509#endif
510/* includes end */"
511 CURL_CHECK_HEADER_WINDOWS
512 CURL_CHECK_HEADER_WINSOCK2
513 CURL_CHECK_HEADER_WS2TCPIP
514])
515
516
517dnl CURL_INCLUDES_BSDSOCKET
518dnl -------------------------------------------------
519dnl Set up variable with list of headers that must be
520dnl included when bsdsocket.h is to be included.
521
522AC_DEFUN([CURL_INCLUDES_BSDSOCKET], [
523curl_includes_bsdsocket="\
524/* includes start */
525#if defined(HAVE_PROTO_BSDSOCKET_H)
526# define __NO_NET_API
527# define __USE_INLINE__
528# include <proto/bsdsocket.h>
529# ifdef HAVE_SYS_IOCTL_H
530# include <sys/ioctl.h>
531# endif
532# ifdef __amigaos4__
533struct SocketIFace *ISocket = NULL;
534# else
535struct Library *SocketBase = NULL;
536# endif
537# define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
538#endif
539/* includes end */"
540 AC_CHECK_HEADERS(
541 proto/bsdsocket.h,
542 [], [], [$curl_includes_bsdsocket])
543])
544
545dnl CURL_INCLUDES_NETIF
546dnl -------------------------------------------------
547dnl Set up variable with list of headers that must be
548dnl included when net/if.h is to be included.
549
550AC_DEFUN([CURL_INCLUDES_NETIF], [
551curl_includes_netif="\
552/* includes start */
553#ifdef HAVE_NET_IF_H
554# include <net/if.h>
555#endif
556/* includes end */"
557 AC_CHECK_HEADERS(
558 net/if.h,
559 [], [], [$curl_includes_netif])
560])
561
562
563dnl CURL_PREPROCESS_CALLCONV
564dnl -------------------------------------------------
565dnl Set up variable with a preprocessor block which
566dnl defines function calling convention.
567
568AC_DEFUN([CURL_PREPROCESS_CALLCONV], [
569curl_preprocess_callconv="\
570/* preprocess start */
571#ifdef HAVE_WINDOWS_H
572# define FUNCALLCONV __stdcall
573#else
574# define FUNCALLCONV
575#endif
576/* preprocess end */"
577])
578
579
580dnl CURL_CHECK_FUNC_ALARM
581dnl -------------------------------------------------
582dnl Verify if alarm is available, prototyped, and
583dnl can be compiled. If all of these are true, and
584dnl usage has not been previously disallowed with
585dnl shell variable curl_disallow_alarm, then
586dnl HAVE_ALARM will be defined.
587
588AC_DEFUN([CURL_CHECK_FUNC_ALARM], [
589 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
590 #
591 tst_links_alarm="unknown"
592 tst_proto_alarm="unknown"
593 tst_compi_alarm="unknown"
594 tst_allow_alarm="unknown"
595 #
596 AC_MSG_CHECKING([if alarm can be linked])
597 AC_LINK_IFELSE([
598 AC_LANG_FUNC_LINK_TRY([alarm])
599 ],[
600 AC_MSG_RESULT([yes])
601 tst_links_alarm="yes"
602 ],[
603 AC_MSG_RESULT([no])
604 tst_links_alarm="no"
605 ])
606 #
607 if test "$tst_links_alarm" = "yes"; then
608 AC_MSG_CHECKING([if alarm is prototyped])
609 AC_EGREP_CPP([alarm],[
610 $curl_includes_unistd
611 ],[
612 AC_MSG_RESULT([yes])
613 tst_proto_alarm="yes"
614 ],[
615 AC_MSG_RESULT([no])
616 tst_proto_alarm="no"
617 ])
618 fi
619 #
620 if test "$tst_proto_alarm" = "yes"; then
621 AC_MSG_CHECKING([if alarm is compilable])
622 AC_COMPILE_IFELSE([
623 AC_LANG_PROGRAM([[
624 $curl_includes_unistd
625 ]],[[
626 if(0 != alarm(0))
627 return 1;
628 ]])
629 ],[
630 AC_MSG_RESULT([yes])
631 tst_compi_alarm="yes"
632 ],[
633 AC_MSG_RESULT([no])
634 tst_compi_alarm="no"
635 ])
636 fi
637 #
638 if test "$tst_compi_alarm" = "yes"; then
639 AC_MSG_CHECKING([if alarm usage allowed])
640 if test "x$curl_disallow_alarm" != "xyes"; then
641 AC_MSG_RESULT([yes])
642 tst_allow_alarm="yes"
643 else
644 AC_MSG_RESULT([no])
645 tst_allow_alarm="no"
646 fi
647 fi
648 #
649 AC_MSG_CHECKING([if alarm might be used])
650 if test "$tst_links_alarm" = "yes" &&
651 test "$tst_proto_alarm" = "yes" &&
652 test "$tst_compi_alarm" = "yes" &&
653 test "$tst_allow_alarm" = "yes"; then
654 AC_MSG_RESULT([yes])
655 AC_DEFINE_UNQUOTED(HAVE_ALARM, 1,
656 [Define to 1 if you have the alarm function.])
657 curl_cv_func_alarm="yes"
658 else
659 AC_MSG_RESULT([no])
660 curl_cv_func_alarm="no"
661 fi
662])
663
664
665dnl CURL_CHECK_FUNC_BASENAME
666dnl -------------------------------------------------
667dnl Verify if basename is available, prototyped, and
668dnl can be compiled. If all of these are true, and
669dnl usage has not been previously disallowed with
670dnl shell variable curl_disallow_basename, then
671dnl HAVE_BASENAME will be defined.
672
673AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [
674 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
675 AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl
676 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
677 #
678 tst_links_basename="unknown"
679 tst_proto_basename="unknown"
680 tst_compi_basename="unknown"
681 tst_allow_basename="unknown"
682 #
683 AC_MSG_CHECKING([if basename can be linked])
684 AC_LINK_IFELSE([
685 AC_LANG_FUNC_LINK_TRY([basename])
686 ],[
687 AC_MSG_RESULT([yes])
688 tst_links_basename="yes"
689 ],[
690 AC_MSG_RESULT([no])
691 tst_links_basename="no"
692 ])
693 #
694 if test "$tst_links_basename" = "yes"; then
695 AC_MSG_CHECKING([if basename is prototyped])
696 AC_EGREP_CPP([basename],[
697 $curl_includes_string
698 $curl_includes_libgen
699 $curl_includes_unistd
700 ],[
701 AC_MSG_RESULT([yes])
702 tst_proto_basename="yes"
703 ],[
704 AC_MSG_RESULT([no])
705 tst_proto_basename="no"
706 ])
707 fi
708 #
709 if test "$tst_proto_basename" = "yes"; then
710 AC_MSG_CHECKING([if basename is compilable])
711 AC_COMPILE_IFELSE([
712 AC_LANG_PROGRAM([[
713 $curl_includes_string
714 $curl_includes_libgen
715 $curl_includes_unistd
716 ]],[[
717 if(0 != basename(0))
718 return 1;
719 ]])
720 ],[
721 AC_MSG_RESULT([yes])
722 tst_compi_basename="yes"
723 ],[
724 AC_MSG_RESULT([no])
725 tst_compi_basename="no"
726 ])
727 fi
728 #
729 if test "$tst_compi_basename" = "yes"; then
730 AC_MSG_CHECKING([if basename usage allowed])
731 if test "x$curl_disallow_basename" != "xyes"; then
732 AC_MSG_RESULT([yes])
733 tst_allow_basename="yes"
734 else
735 AC_MSG_RESULT([no])
736 tst_allow_basename="no"
737 fi
738 fi
739 #
740 AC_MSG_CHECKING([if basename might be used])
741 if test "$tst_links_basename" = "yes" &&
742 test "$tst_proto_basename" = "yes" &&
743 test "$tst_compi_basename" = "yes" &&
744 test "$tst_allow_basename" = "yes"; then
745 AC_MSG_RESULT([yes])
746 AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1,
747 [Define to 1 if you have the basename function.])
748 curl_cv_func_basename="yes"
749 else
750 AC_MSG_RESULT([no])
751 curl_cv_func_basename="no"
752 fi
753])
754
755
756dnl CURL_CHECK_FUNC_CLOSESOCKET
757dnl -------------------------------------------------
758dnl Verify if closesocket is available, prototyped, and
759dnl can be compiled. If all of these are true, and
760dnl usage has not been previously disallowed with
761dnl shell variable curl_disallow_closesocket, then
762dnl HAVE_CLOSESOCKET will be defined.
763
764AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [
765 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
766 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
767 #
768 tst_links_closesocket="unknown"
769 tst_proto_closesocket="unknown"
770 tst_compi_closesocket="unknown"
771 tst_allow_closesocket="unknown"
772 #
773 AC_MSG_CHECKING([if closesocket can be linked])
774 AC_LINK_IFELSE([
775 AC_LANG_PROGRAM([[
776 $curl_includes_winsock2
777 $curl_includes_socket
778 ]],[[
779 if(0 != closesocket(0))
780 return 1;
781 ]])
782 ],[
783 AC_MSG_RESULT([yes])
784 tst_links_closesocket="yes"
785 ],[
786 AC_MSG_RESULT([no])
787 tst_links_closesocket="no"
788 ])
789 #
790 if test "$tst_links_closesocket" = "yes"; then
791 AC_MSG_CHECKING([if closesocket is prototyped])
792 AC_EGREP_CPP([closesocket],[
793 $curl_includes_winsock2
794 $curl_includes_socket
795 ],[
796 AC_MSG_RESULT([yes])
797 tst_proto_closesocket="yes"
798 ],[
799 AC_MSG_RESULT([no])
800 tst_proto_closesocket="no"
801 ])
802 fi
803 #
804 if test "$tst_proto_closesocket" = "yes"; then
805 AC_MSG_CHECKING([if closesocket is compilable])
806 AC_COMPILE_IFELSE([
807 AC_LANG_PROGRAM([[
808 $curl_includes_winsock2
809 $curl_includes_socket
810 ]],[[
811 if(0 != closesocket(0))
812 return 1;
813 ]])
814 ],[
815 AC_MSG_RESULT([yes])
816 tst_compi_closesocket="yes"
817 ],[
818 AC_MSG_RESULT([no])
819 tst_compi_closesocket="no"
820 ])
821 fi
822 #
823 if test "$tst_compi_closesocket" = "yes"; then
824 AC_MSG_CHECKING([if closesocket usage allowed])
825 if test "x$curl_disallow_closesocket" != "xyes"; then
826 AC_MSG_RESULT([yes])
827 tst_allow_closesocket="yes"
828 else
829 AC_MSG_RESULT([no])
830 tst_allow_closesocket="no"
831 fi
832 fi
833 #
834 AC_MSG_CHECKING([if closesocket might be used])
835 if test "$tst_links_closesocket" = "yes" &&
836 test "$tst_proto_closesocket" = "yes" &&
837 test "$tst_compi_closesocket" = "yes" &&
838 test "$tst_allow_closesocket" = "yes"; then
839 AC_MSG_RESULT([yes])
840 AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1,
841 [Define to 1 if you have the closesocket function.])
842 curl_cv_func_closesocket="yes"
843 else
844 AC_MSG_RESULT([no])
845 curl_cv_func_closesocket="no"
846 fi
847])
848
849
850dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
851dnl -------------------------------------------------
852dnl Verify if CloseSocket is available, prototyped, and
853dnl can be compiled. If all of these are true, and
854dnl usage has not been previously disallowed with
855dnl shell variable curl_disallow_closesocket_camel,
856dnl then HAVE_CLOSESOCKET_CAMEL will be defined.
857
858AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
859 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
860 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
861 #
862 tst_links_closesocket_camel="unknown"
863 tst_proto_closesocket_camel="unknown"
864 tst_compi_closesocket_camel="unknown"
865 tst_allow_closesocket_camel="unknown"
866 #
867 AC_MSG_CHECKING([if CloseSocket can be linked])
868 AC_LINK_IFELSE([
869 AC_LANG_PROGRAM([[
870 $curl_includes_bsdsocket
871 $curl_includes_sys_socket
872 ]],[[
873 if(0 != CloseSocket(0))
874 return 1;
875 ]])
876 ],[
877 AC_MSG_RESULT([yes])
878 tst_links_closesocket_camel="yes"
879 ],[
880 AC_MSG_RESULT([no])
881 tst_links_closesocket_camel="no"
882 ])
883 #
884 if test "$tst_links_closesocket_camel" = "yes"; then
885 AC_MSG_CHECKING([if CloseSocket is prototyped])
886 AC_EGREP_CPP([CloseSocket],[
887 $curl_includes_bsdsocket
888 $curl_includes_sys_socket
889 ],[
890 AC_MSG_RESULT([yes])
891 tst_proto_closesocket_camel="yes"
892 ],[
893 AC_MSG_RESULT([no])
894 tst_proto_closesocket_camel="no"
895 ])
896 fi
897 #
898 if test "$tst_proto_closesocket_camel" = "yes"; then
899 AC_MSG_CHECKING([if CloseSocket is compilable])
900 AC_COMPILE_IFELSE([
901 AC_LANG_PROGRAM([[
902 $curl_includes_bsdsocket
903 $curl_includes_sys_socket
904 ]],[[
905 if(0 != CloseSocket(0))
906 return 1;
907 ]])
908 ],[
909 AC_MSG_RESULT([yes])
910 tst_compi_closesocket_camel="yes"
911 ],[
912 AC_MSG_RESULT([no])
913 tst_compi_closesocket_camel="no"
914 ])
915 fi
916 #
917 if test "$tst_compi_closesocket_camel" = "yes"; then
918 AC_MSG_CHECKING([if CloseSocket usage allowed])
919 if test "x$curl_disallow_closesocket_camel" != "xyes"; then
920 AC_MSG_RESULT([yes])
921 tst_allow_closesocket_camel="yes"
922 else
923 AC_MSG_RESULT([no])
924 tst_allow_closesocket_camel="no"
925 fi
926 fi
927 #
928 AC_MSG_CHECKING([if CloseSocket might be used])
929 if test "$tst_links_closesocket_camel" = "yes" &&
930 test "$tst_proto_closesocket_camel" = "yes" &&
931 test "$tst_compi_closesocket_camel" = "yes" &&
932 test "$tst_allow_closesocket_camel" = "yes"; then
933 AC_MSG_RESULT([yes])
934 AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1,
935 [Define to 1 if you have the CloseSocket camel case function.])
936 curl_cv_func_closesocket_camel="yes"
937 else
938 AC_MSG_RESULT([no])
939 curl_cv_func_closesocket_camel="no"
940 fi
941])
942
943
944dnl CURL_CHECK_FUNC_CONNECT
945dnl -------------------------------------------------
946dnl Verify if connect is available, prototyped, and
947dnl can be compiled. If all of these are true, and
948dnl usage has not been previously disallowed with
949dnl shell variable curl_disallow_connect, then
950dnl HAVE_CONNECT will be defined.
951
952AC_DEFUN([CURL_CHECK_FUNC_CONNECT], [
953 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
954 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
955 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
956 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
957 #
958 tst_links_connect="unknown"
959 tst_proto_connect="unknown"
960 tst_compi_connect="unknown"
961 tst_allow_connect="unknown"
962 #
963 AC_MSG_CHECKING([if connect can be linked])
964 AC_LINK_IFELSE([
965 AC_LANG_PROGRAM([[
966 $curl_includes_winsock2
967 $curl_includes_bsdsocket
968 $curl_includes_sys_socket
969 $curl_includes_socket
970 ]],[[
971 if(0 != connect(0, 0, 0))
972 return 1;
973 ]])
974 ],[
975 AC_MSG_RESULT([yes])
976 tst_links_connect="yes"
977 ],[
978 AC_MSG_RESULT([no])
979 tst_links_connect="no"
980 ])
981 #
982 if test "$tst_links_connect" = "yes"; then
983 AC_MSG_CHECKING([if connect is prototyped])
984 AC_EGREP_CPP([connect],[
985 $curl_includes_winsock2
986 $curl_includes_bsdsocket
987 $curl_includes_sys_socket
988 $curl_includes_socket
989 ],[
990 AC_MSG_RESULT([yes])
991 tst_proto_connect="yes"
992 ],[
993 AC_MSG_RESULT([no])
994 tst_proto_connect="no"
995 ])
996 fi
997 #
998 if test "$tst_proto_connect" = "yes"; then
999 AC_MSG_CHECKING([if connect is compilable])
1000 AC_COMPILE_IFELSE([
1001 AC_LANG_PROGRAM([[
1002 $curl_includes_winsock2
1003 $curl_includes_bsdsocket
1004 $curl_includes_sys_socket
1005 $curl_includes_socket
1006 ]],[[
1007 if(0 != connect(0, 0, 0))
1008 return 1;
1009 ]])
1010 ],[
1011 AC_MSG_RESULT([yes])
1012 tst_compi_connect="yes"
1013 ],[
1014 AC_MSG_RESULT([no])
1015 tst_compi_connect="no"
1016 ])
1017 fi
1018 #
1019 if test "$tst_compi_connect" = "yes"; then
1020 AC_MSG_CHECKING([if connect usage allowed])
1021 if test "x$curl_disallow_connect" != "xyes"; then
1022 AC_MSG_RESULT([yes])
1023 tst_allow_connect="yes"
1024 else
1025 AC_MSG_RESULT([no])
1026 tst_allow_connect="no"
1027 fi
1028 fi
1029 #
1030 AC_MSG_CHECKING([if connect might be used])
1031 if test "$tst_links_connect" = "yes" &&
1032 test "$tst_proto_connect" = "yes" &&
1033 test "$tst_compi_connect" = "yes" &&
1034 test "$tst_allow_connect" = "yes"; then
1035 AC_MSG_RESULT([yes])
1036 AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1,
1037 [Define to 1 if you have the connect function.])
1038 curl_cv_func_connect="yes"
1039 else
1040 AC_MSG_RESULT([no])
1041 curl_cv_func_connect="no"
1042 fi
1043])
1044
1045
1046dnl CURL_CHECK_FUNC_FCNTL
1047dnl -------------------------------------------------
1048dnl Verify if fcntl is available, prototyped, and
1049dnl can be compiled. If all of these are true, and
1050dnl usage has not been previously disallowed with
1051dnl shell variable curl_disallow_fcntl, then
1052dnl HAVE_FCNTL will be defined.
1053
1054AC_DEFUN([CURL_CHECK_FUNC_FCNTL], [
1055 AC_REQUIRE([CURL_INCLUDES_FCNTL])dnl
1056 #
1057 tst_links_fcntl="unknown"
1058 tst_proto_fcntl="unknown"
1059 tst_compi_fcntl="unknown"
1060 tst_allow_fcntl="unknown"
1061 #
1062 AC_MSG_CHECKING([if fcntl can be linked])
1063 AC_LINK_IFELSE([
1064 AC_LANG_FUNC_LINK_TRY([fcntl])
1065 ],[
1066 AC_MSG_RESULT([yes])
1067 tst_links_fcntl="yes"
1068 ],[
1069 AC_MSG_RESULT([no])
1070 tst_links_fcntl="no"
1071 ])
1072 #
1073 if test "$tst_links_fcntl" = "yes"; then
1074 AC_MSG_CHECKING([if fcntl is prototyped])
1075 AC_EGREP_CPP([fcntl],[
1076 $curl_includes_fcntl
1077 ],[
1078 AC_MSG_RESULT([yes])
1079 tst_proto_fcntl="yes"
1080 ],[
1081 AC_MSG_RESULT([no])
1082 tst_proto_fcntl="no"
1083 ])
1084 fi
1085 #
1086 if test "$tst_proto_fcntl" = "yes"; then
1087 AC_MSG_CHECKING([if fcntl is compilable])
1088 AC_COMPILE_IFELSE([
1089 AC_LANG_PROGRAM([[
1090 $curl_includes_fcntl
1091 ]],[[
1092 if(0 != fcntl(0, 0, 0))
1093 return 1;
1094 ]])
1095 ],[
1096 AC_MSG_RESULT([yes])
1097 tst_compi_fcntl="yes"
1098 ],[
1099 AC_MSG_RESULT([no])
1100 tst_compi_fcntl="no"
1101 ])
1102 fi
1103 #
1104 if test "$tst_compi_fcntl" = "yes"; then
1105 AC_MSG_CHECKING([if fcntl usage allowed])
1106 if test "x$curl_disallow_fcntl" != "xyes"; then
1107 AC_MSG_RESULT([yes])
1108 tst_allow_fcntl="yes"
1109 else
1110 AC_MSG_RESULT([no])
1111 tst_allow_fcntl="no"
1112 fi
1113 fi
1114 #
1115 AC_MSG_CHECKING([if fcntl might be used])
1116 if test "$tst_links_fcntl" = "yes" &&
1117 test "$tst_proto_fcntl" = "yes" &&
1118 test "$tst_compi_fcntl" = "yes" &&
1119 test "$tst_allow_fcntl" = "yes"; then
1120 AC_MSG_RESULT([yes])
1121 AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1,
1122 [Define to 1 if you have the fcntl function.])
1123 curl_cv_func_fcntl="yes"
1124 CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
1125 else
1126 AC_MSG_RESULT([no])
1127 curl_cv_func_fcntl="no"
1128 fi
1129])
1130
1131
1132dnl CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
1133dnl -------------------------------------------------
1134dnl Verify if fcntl with status flag O_NONBLOCK is
1135dnl available, can be compiled, and seems to work. If
1136dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK
1137dnl will be defined.
1138
1139AC_DEFUN([CURL_CHECK_FUNC_FCNTL_O_NONBLOCK], [
1140 #
1141 tst_compi_fcntl_o_nonblock="unknown"
1142 tst_allow_fcntl_o_nonblock="unknown"
1143 #
1144 case $host_os in
1145 sunos4* | aix3*)
1146 dnl O_NONBLOCK does not work on these platforms
1147 curl_disallow_fcntl_o_nonblock="yes"
1148 ;;
1149 esac
1150 #
1151 if test "$curl_cv_func_fcntl" = "yes"; then
1152 AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable])
1153 AC_COMPILE_IFELSE([
1154 AC_LANG_PROGRAM([[
1155 $curl_includes_fcntl
1156 ]],[[
1157 int flags = 0;
1158 if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
1159 return 1;
1160 ]])
1161 ],[
1162 AC_MSG_RESULT([yes])
1163 tst_compi_fcntl_o_nonblock="yes"
1164 ],[
1165 AC_MSG_RESULT([no])
1166 tst_compi_fcntl_o_nonblock="no"
1167 ])
1168 fi
1169 #
1170 if test "$tst_compi_fcntl_o_nonblock" = "yes"; then
1171 AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed])
1172 if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then
1173 AC_MSG_RESULT([yes])
1174 tst_allow_fcntl_o_nonblock="yes"
1175 else
1176 AC_MSG_RESULT([no])
1177 tst_allow_fcntl_o_nonblock="no"
1178 fi
1179 fi
1180 #
1181 AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used])
1182 if test "$tst_compi_fcntl_o_nonblock" = "yes" &&
1183 test "$tst_allow_fcntl_o_nonblock" = "yes"; then
1184 AC_MSG_RESULT([yes])
1185 AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1,
1186 [Define to 1 if you have a working fcntl O_NONBLOCK function.])
1187 curl_cv_func_fcntl_o_nonblock="yes"
1188 else
1189 AC_MSG_RESULT([no])
1190 curl_cv_func_fcntl_o_nonblock="no"
1191 fi
1192])
1193
1194dnl CURL_CHECK_FUNC_FGETXATTR
1195dnl -------------------------------------------------
1196dnl Verify if fgetxattr is available, prototyped, and
1197dnl can be compiled. If all of these are true, and
1198dnl usage has not been previously disallowed with
1199dnl shell variable curl_disallow_fgetxattr, then
1200dnl HAVE_FGETXATTR will be defined.
1201
1202AC_DEFUN([CURL_CHECK_FUNC_FGETXATTR], [
1203 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
1204 #
1205 tst_links_fgetxattr="unknown"
1206 tst_proto_fgetxattr="unknown"
1207 tst_compi_fgetxattr="unknown"
1208 tst_allow_fgetxattr="unknown"
1209 tst_nargs_fgetxattr="unknown"
1210 #
1211 AC_MSG_CHECKING([if fgetxattr can be linked])
1212 AC_LINK_IFELSE([
1213 AC_LANG_FUNC_LINK_TRY([fgetxattr])
1214 ],[
1215 AC_MSG_RESULT([yes])
1216 tst_links_fgetxattr="yes"
1217 ],[
1218 AC_MSG_RESULT([no])
1219 tst_links_fgetxattr="no"
1220 ])
1221 #
1222 if test "$tst_links_fgetxattr" = "yes"; then
1223 AC_MSG_CHECKING([if fgetxattr is prototyped])
1224 AC_EGREP_CPP([fgetxattr],[
1225 $curl_includes_sys_xattr
1226 ],[
1227 AC_MSG_RESULT([yes])
1228 tst_proto_fgetxattr="yes"
1229 ],[
1230 AC_MSG_RESULT([no])
1231 tst_proto_fgetxattr="no"
1232 ])
1233 fi
1234 #
1235 if test "$tst_proto_fgetxattr" = "yes"; then
1236 if test "$tst_nargs_fgetxattr" = "unknown"; then
1237 AC_MSG_CHECKING([if fgetxattr takes 4 args.])
1238 AC_COMPILE_IFELSE([
1239 AC_LANG_PROGRAM([[
1240 $curl_includes_sys_xattr
1241 ]],[[
1242 if(0 != fgetxattr(0, 0, 0, 0))
1243 return 1;
1244 ]])
1245 ],[
1246 AC_MSG_RESULT([yes])
1247 tst_compi_fgetxattr="yes"
1248 tst_nargs_fgetxattr="4"
1249 ],[
1250 AC_MSG_RESULT([no])
1251 tst_compi_fgetxattr="no"
1252 ])
1253 fi
1254 if test "$tst_nargs_fgetxattr" = "unknown"; then
1255 AC_MSG_CHECKING([if fgetxattr takes 6 args.])
1256 AC_COMPILE_IFELSE([
1257 AC_LANG_PROGRAM([[
1258 $curl_includes_sys_xattr
1259 ]],[[
1260 if(0 != fgetxattr(0, 0, 0, 0, 0, 0))
1261 return 1;
1262 ]])
1263 ],[
1264 AC_MSG_RESULT([yes])
1265 tst_compi_fgetxattr="yes"
1266 tst_nargs_fgetxattr="6"
1267 ],[
1268 AC_MSG_RESULT([no])
1269 tst_compi_fgetxattr="no"
1270 ])
1271 fi
1272 AC_MSG_CHECKING([if fgetxattr is compilable])
1273 if test "$tst_compi_fgetxattr" = "yes"; then
1274 AC_MSG_RESULT([yes])
1275 else
1276 AC_MSG_RESULT([no])
1277 fi
1278 fi
1279 #
1280 if test "$tst_compi_fgetxattr" = "yes"; then
1281 AC_MSG_CHECKING([if fgetxattr usage allowed])
1282 if test "x$curl_disallow_fgetxattr" != "xyes"; then
1283 AC_MSG_RESULT([yes])
1284 tst_allow_fgetxattr="yes"
1285 else
1286 AC_MSG_RESULT([no])
1287 tst_allow_fgetxattr="no"
1288 fi
1289 fi
1290 #
1291 AC_MSG_CHECKING([if fgetxattr might be used])
1292 if test "$tst_links_fgetxattr" = "yes" &&
1293 test "$tst_proto_fgetxattr" = "yes" &&
1294 test "$tst_compi_fgetxattr" = "yes" &&
1295 test "$tst_allow_fgetxattr" = "yes"; then
1296 AC_MSG_RESULT([yes])
1297 AC_DEFINE_UNQUOTED(HAVE_FGETXATTR, 1,
1298 [Define to 1 if you have the fgetxattr function.])
1299 dnl AC_DEFINE_UNQUOTED(FGETXATTR_ARGS, $tst_nargs_fgetxattr,
1300 dnl [Specifies the number of arguments to fgetxattr])
1301 #
1302 if test "$tst_nargs_fgetxattr" -eq "4"; then
1303 AC_DEFINE(HAVE_FGETXATTR_4, 1, [fgetxattr() takes 4 args])
1304 elif test "$tst_nargs_fgetxattr" -eq "6"; then
1305 AC_DEFINE(HAVE_FGETXATTR_6, 1, [fgetxattr() takes 6 args])
1306 fi
1307 #
1308 curl_cv_func_fgetxattr="yes"
1309 else
1310 AC_MSG_RESULT([no])
1311 curl_cv_func_fgetxattr="no"
1312 fi
1313])
1314
1315
1316dnl CURL_CHECK_FUNC_FLISTXATTR
1317dnl -------------------------------------------------
1318dnl Verify if flistxattr is available, prototyped, and
1319dnl can be compiled. If all of these are true, and
1320dnl usage has not been previously disallowed with
1321dnl shell variable curl_disallow_flistxattr, then
1322dnl HAVE_FLISTXATTR will be defined.
1323
1324AC_DEFUN([CURL_CHECK_FUNC_FLISTXATTR], [
1325 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
1326 #
1327 tst_links_flistxattr="unknown"
1328 tst_proto_flistxattr="unknown"
1329 tst_compi_flistxattr="unknown"
1330 tst_allow_flistxattr="unknown"
1331 tst_nargs_flistxattr="unknown"
1332 #
1333 AC_MSG_CHECKING([if flistxattr can be linked])
1334 AC_LINK_IFELSE([
1335 AC_LANG_FUNC_LINK_TRY([flistxattr])
1336 ],[
1337 AC_MSG_RESULT([yes])
1338 tst_links_flistxattr="yes"
1339 ],[
1340 AC_MSG_RESULT([no])
1341 tst_links_flistxattr="no"
1342 ])
1343 #
1344 if test "$tst_links_flistxattr" = "yes"; then
1345 AC_MSG_CHECKING([if flistxattr is prototyped])
1346 AC_EGREP_CPP([flistxattr],[
1347 $curl_includes_sys_xattr
1348 ],[
1349 AC_MSG_RESULT([yes])
1350 tst_proto_flistxattr="yes"
1351 ],[
1352 AC_MSG_RESULT([no])
1353 tst_proto_flistxattr="no"
1354 ])
1355 fi
1356 #
1357 if test "$tst_proto_flistxattr" = "yes"; then
1358 if test "$tst_nargs_flistxattr" = "unknown"; then
1359 AC_MSG_CHECKING([if flistxattr takes 3 args.])
1360 AC_COMPILE_IFELSE([
1361 AC_LANG_PROGRAM([[
1362 $curl_includes_sys_xattr
1363 ]],[[
1364 if(0 != flistxattr(0, 0, 0))
1365 return 1;
1366 ]])
1367 ],[
1368 AC_MSG_RESULT([yes])
1369 tst_compi_flistxattr="yes"
1370 tst_nargs_flistxattr="3"
1371 ],[
1372 AC_MSG_RESULT([no])
1373 tst_compi_flistxattr="no"
1374 ])
1375 fi
1376 if test "$tst_nargs_flistxattr" = "unknown"; then
1377 AC_MSG_CHECKING([if flistxattr takes 4 args.])
1378 AC_COMPILE_IFELSE([
1379 AC_LANG_PROGRAM([[
1380 $curl_includes_sys_xattr
1381 ]],[[
1382 if(0 != flistxattr(0, 0, 0, 0))
1383 return 1;
1384 ]])
1385 ],[
1386 AC_MSG_RESULT([yes])
1387 tst_compi_flistxattr="yes"
1388 tst_nargs_flistxattr="4"
1389 ],[
1390 AC_MSG_RESULT([no])
1391 tst_compi_flistxattr="no"
1392 ])
1393 fi
1394 AC_MSG_CHECKING([if flistxattr is compilable])
1395 if test "$tst_compi_flistxattr" = "yes"; then
1396 AC_MSG_RESULT([yes])
1397 else
1398 AC_MSG_RESULT([no])
1399 fi
1400 fi
1401 #
1402 if test "$tst_compi_flistxattr" = "yes"; then
1403 AC_MSG_CHECKING([if flistxattr usage allowed])
1404 if test "x$curl_disallow_flistxattr" != "xyes"; then
1405 AC_MSG_RESULT([yes])
1406 tst_allow_flistxattr="yes"
1407 else
1408 AC_MSG_RESULT([no])
1409 tst_allow_flistxattr="no"
1410 fi
1411 fi
1412 #
1413 AC_MSG_CHECKING([if flistxattr might be used])
1414 if test "$tst_links_flistxattr" = "yes" &&
1415 test "$tst_proto_flistxattr" = "yes" &&
1416 test "$tst_compi_flistxattr" = "yes" &&
1417 test "$tst_allow_flistxattr" = "yes"; then
1418 AC_MSG_RESULT([yes])
1419 AC_DEFINE_UNQUOTED(HAVE_FLISTXATTR, 1,
1420 [Define to 1 if you have the flistxattr function.])
1421 dnl AC_DEFINE_UNQUOTED(FLISTXATTR_ARGS, $tst_nargs_flistxattr,
1422 dnl [Specifies the number of arguments to flistxattr])
1423 #
1424 if test "$tst_nargs_flistxattr" -eq "3"; then
1425 AC_DEFINE(HAVE_FLISTXATTR_3, 1, [flistxattr() takes 3 args])
1426 elif test "$tst_nargs_flistxattr" -eq "4"; then
1427 AC_DEFINE(HAVE_FLISTXATTR_4, 1, [flistxattr() takes 4 args])
1428 fi
1429 #
1430 curl_cv_func_flistxattr="yes"
1431 else
1432 AC_MSG_RESULT([no])
1433 curl_cv_func_flistxattr="no"
1434 fi
1435])
1436
1437
1438dnl CURL_CHECK_FUNC_FREEADDRINFO
1439dnl -------------------------------------------------
1440dnl Verify if freeaddrinfo is available, prototyped,
1441dnl and can be compiled. If all of these are true,
1442dnl and usage has not been previously disallowed with
1443dnl shell variable curl_disallow_freeaddrinfo, then
1444dnl HAVE_FREEADDRINFO will be defined.
1445
1446AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [
1447 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
1448 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
1449 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
1450 #
1451 tst_links_freeaddrinfo="unknown"
1452 tst_proto_freeaddrinfo="unknown"
1453 tst_compi_freeaddrinfo="unknown"
1454 tst_allow_freeaddrinfo="unknown"
1455 #
1456 AC_MSG_CHECKING([if freeaddrinfo can be linked])
1457 AC_LINK_IFELSE([
1458 AC_LANG_PROGRAM([[
1459 $curl_includes_ws2tcpip
1460 $curl_includes_sys_socket
1461 $curl_includes_netdb
1462 ]],[[
1463 freeaddrinfo(0);
1464 ]])
1465 ],[
1466 AC_MSG_RESULT([yes])
1467 tst_links_freeaddrinfo="yes"
1468 ],[
1469 AC_MSG_RESULT([no])
1470 tst_links_freeaddrinfo="no"
1471 ])
1472 #
1473 if test "$tst_links_freeaddrinfo" = "yes"; then
1474 AC_MSG_CHECKING([if freeaddrinfo is prototyped])
1475 AC_EGREP_CPP([freeaddrinfo],[
1476 $curl_includes_ws2tcpip
1477 $curl_includes_sys_socket
1478 $curl_includes_netdb
1479 ],[
1480 AC_MSG_RESULT([yes])
1481 tst_proto_freeaddrinfo="yes"
1482 ],[
1483 AC_MSG_RESULT([no])
1484 tst_proto_freeaddrinfo="no"
1485 ])
1486 fi
1487 #
1488 if test "$tst_proto_freeaddrinfo" = "yes"; then
1489 AC_MSG_CHECKING([if freeaddrinfo is compilable])
1490 AC_COMPILE_IFELSE([
1491 AC_LANG_PROGRAM([[
1492 $curl_includes_ws2tcpip
1493 $curl_includes_sys_socket
1494 $curl_includes_netdb
1495 ]],[[
1496 freeaddrinfo(0);
1497 ]])
1498 ],[
1499 AC_MSG_RESULT([yes])
1500 tst_compi_freeaddrinfo="yes"
1501 ],[
1502 AC_MSG_RESULT([no])
1503 tst_compi_freeaddrinfo="no"
1504 ])
1505 fi
1506 #
1507 if test "$tst_compi_freeaddrinfo" = "yes"; then
1508 AC_MSG_CHECKING([if freeaddrinfo usage allowed])
1509 if test "x$curl_disallow_freeaddrinfo" != "xyes"; then
1510 AC_MSG_RESULT([yes])
1511 tst_allow_freeaddrinfo="yes"
1512 else
1513 AC_MSG_RESULT([no])
1514 tst_allow_freeaddrinfo="no"
1515 fi
1516 fi
1517 #
1518 AC_MSG_CHECKING([if freeaddrinfo might be used])
1519 if test "$tst_links_freeaddrinfo" = "yes" &&
1520 test "$tst_proto_freeaddrinfo" = "yes" &&
1521 test "$tst_compi_freeaddrinfo" = "yes" &&
1522 test "$tst_allow_freeaddrinfo" = "yes"; then
1523 AC_MSG_RESULT([yes])
1524 AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
1525 [Define to 1 if you have the freeaddrinfo function.])
1526 curl_cv_func_freeaddrinfo="yes"
1527 else
1528 AC_MSG_RESULT([no])
1529 curl_cv_func_freeaddrinfo="no"
1530 fi
1531])
1532
1533
1534dnl CURL_CHECK_FUNC_FREMOVEXATTR
1535dnl -------------------------------------------------
1536dnl Verify if fremovexattr is available, prototyped, and
1537dnl can be compiled. If all of these are true, and
1538dnl usage has not been previously disallowed with
1539dnl shell variable curl_disallow_fremovexattr, then
1540dnl HAVE_FREMOVEXATTR will be defined.
1541
1542AC_DEFUN([CURL_CHECK_FUNC_FREMOVEXATTR], [
1543 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
1544 #
1545 tst_links_fremovexattr="unknown"
1546 tst_proto_fremovexattr="unknown"
1547 tst_compi_fremovexattr="unknown"
1548 tst_allow_fremovexattr="unknown"
1549 tst_nargs_fremovexattr="unknown"
1550 #
1551 AC_MSG_CHECKING([if fremovexattr can be linked])
1552 AC_LINK_IFELSE([
1553 AC_LANG_FUNC_LINK_TRY([fremovexattr])
1554 ],[
1555 AC_MSG_RESULT([yes])
1556 tst_links_fremovexattr="yes"
1557 ],[
1558 AC_MSG_RESULT([no])
1559 tst_links_fremovexattr="no"
1560 ])
1561 #
1562 if test "$tst_links_fremovexattr" = "yes"; then
1563 AC_MSG_CHECKING([if fremovexattr is prototyped])
1564 AC_EGREP_CPP([fremovexattr],[
1565 $curl_includes_sys_xattr
1566 ],[
1567 AC_MSG_RESULT([yes])
1568 tst_proto_fremovexattr="yes"
1569 ],[
1570 AC_MSG_RESULT([no])
1571 tst_proto_fremovexattr="no"
1572 ])
1573 fi
1574 #
1575 if test "$tst_proto_fremovexattr" = "yes"; then
1576 if test "$tst_nargs_fremovexattr" = "unknown"; then
1577 AC_MSG_CHECKING([if fremovexattr takes 2 args.])
1578 AC_COMPILE_IFELSE([
1579 AC_LANG_PROGRAM([[
1580 $curl_includes_sys_xattr
1581 ]],[[
1582 if(0 != fremovexattr(0, 0))
1583 return 1;
1584 ]])
1585 ],[
1586 AC_MSG_RESULT([yes])
1587 tst_compi_fremovexattr="yes"
1588 tst_nargs_fremovexattr="2"
1589 ],[
1590 AC_MSG_RESULT([no])
1591 tst_compi_fremovexattr="no"
1592 ])
1593 fi
1594 if test "$tst_nargs_fremovexattr" = "unknown"; then
1595 AC_MSG_CHECKING([if fremovexattr takes 3 args.])
1596 AC_COMPILE_IFELSE([
1597 AC_LANG_PROGRAM([[
1598 $curl_includes_sys_xattr
1599 ]],[[
1600 if(0 != fremovexattr(0, 0, 0))
1601 return 1;
1602 ]])
1603 ],[
1604 AC_MSG_RESULT([yes])
1605 tst_compi_fremovexattr="yes"
1606 tst_nargs_fremovexattr="3"
1607 ],[
1608 AC_MSG_RESULT([no])
1609 tst_compi_fremovexattr="no"
1610 ])
1611 fi
1612 AC_MSG_CHECKING([if fremovexattr is compilable])
1613 if test "$tst_compi_fremovexattr" = "yes"; then
1614 AC_MSG_RESULT([yes])
1615 else
1616 AC_MSG_RESULT([no])
1617 fi
1618 fi
1619 #
1620 if test "$tst_compi_fremovexattr" = "yes"; then
1621 AC_MSG_CHECKING([if fremovexattr usage allowed])
1622 if test "x$curl_disallow_fremovexattr" != "xyes"; then
1623 AC_MSG_RESULT([yes])
1624 tst_allow_fremovexattr="yes"
1625 else
1626 AC_MSG_RESULT([no])
1627 tst_allow_fremovexattr="no"
1628 fi
1629 fi
1630 #
1631 AC_MSG_CHECKING([if fremovexattr might be used])
1632 if test "$tst_links_fremovexattr" = "yes" &&
1633 test "$tst_proto_fremovexattr" = "yes" &&
1634 test "$tst_compi_fremovexattr" = "yes" &&
1635 test "$tst_allow_fremovexattr" = "yes"; then
1636 AC_MSG_RESULT([yes])
1637 AC_DEFINE_UNQUOTED(HAVE_FREMOVEXATTR, 1,
1638 [Define to 1 if you have the fremovexattr function.])
1639 dnl AC_DEFINE_UNQUOTED(FREMOVEXATTR_ARGS, $tst_nargs_fremovexattr,
1640 dnl [Specifies the number of arguments to fremovexattr])
1641 #
1642 if test "$tst_nargs_fremovexattr" -eq "2"; then
1643 AC_DEFINE(HAVE_FREMOVEXATTR_2, 1, [fremovexattr() takes 2 args])
1644 elif test "$tst_nargs_fremovexattr" -eq "3"; then
1645 AC_DEFINE(HAVE_FREMOVEXATTR_3, 1, [fremovexattr() takes 3 args])
1646 fi
1647 #
1648 curl_cv_func_fremovexattr="yes"
1649 else
1650 AC_MSG_RESULT([no])
1651 curl_cv_func_fremovexattr="no"
1652 fi
1653])
1654
1655
1656dnl CURL_CHECK_FUNC_FSETXATTR
1657dnl -------------------------------------------------
1658dnl Verify if fsetxattr is available, prototyped, and
1659dnl can be compiled. If all of these are true, and
1660dnl usage has not been previously disallowed with
1661dnl shell variable curl_disallow_fsetxattr, then
1662dnl HAVE_FSETXATTR will be defined.
1663
1664AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [
1665 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
1666 #
1667 tst_links_fsetxattr="unknown"
1668 tst_proto_fsetxattr="unknown"
1669 tst_compi_fsetxattr="unknown"
1670 tst_allow_fsetxattr="unknown"
1671 tst_nargs_fsetxattr="unknown"
1672 #
1673 AC_MSG_CHECKING([if fsetxattr can be linked])
1674 AC_LINK_IFELSE([
1675 AC_LANG_FUNC_LINK_TRY([fsetxattr])
1676 ],[
1677 AC_MSG_RESULT([yes])
1678 tst_links_fsetxattr="yes"
1679 ],[
1680 AC_MSG_RESULT([no])
1681 tst_links_fsetxattr="no"
1682 ])
1683 #
1684 if test "$tst_links_fsetxattr" = "yes"; then
1685 AC_MSG_CHECKING([if fsetxattr is prototyped])
1686 AC_EGREP_CPP([fsetxattr],[
1687 $curl_includes_sys_xattr
1688 ],[
1689 AC_MSG_RESULT([yes])
1690 tst_proto_fsetxattr="yes"
1691 ],[
1692 AC_MSG_RESULT([no])
1693 tst_proto_fsetxattr="no"
1694 ])
1695 fi
1696 #
1697 if test "$tst_proto_fsetxattr" = "yes"; then
1698 if test "$tst_nargs_fsetxattr" = "unknown"; then
1699 AC_MSG_CHECKING([if fsetxattr takes 5 args.])
1700 AC_COMPILE_IFELSE([
1701 AC_LANG_PROGRAM([[
1702 $curl_includes_sys_xattr
1703 ]],[[
1704 if(0 != fsetxattr(0, 0, 0, 0, 0))
1705 return 1;
1706 ]])
1707 ],[
1708 AC_MSG_RESULT([yes])
1709 tst_compi_fsetxattr="yes"
1710 tst_nargs_fsetxattr="5"
1711 ],[
1712 AC_MSG_RESULT([no])
1713 tst_compi_fsetxattr="no"
1714 ])
1715 fi
1716 if test "$tst_nargs_fsetxattr" = "unknown"; then
1717 AC_MSG_CHECKING([if fsetxattr takes 6 args.])
1718 AC_COMPILE_IFELSE([
1719 AC_LANG_PROGRAM([[
1720 $curl_includes_sys_xattr
1721 ]],[[
1722 if(0 != fsetxattr(0, 0, 0, 0, 0, 0))
1723 return 1;
1724 ]])
1725 ],[
1726 AC_MSG_RESULT([yes])
1727 tst_compi_fsetxattr="yes"
1728 tst_nargs_fsetxattr="6"
1729 ],[
1730 AC_MSG_RESULT([no])
1731 tst_compi_fsetxattr="no"
1732 ])
1733 fi
1734 AC_MSG_CHECKING([if fsetxattr is compilable])
1735 if test "$tst_compi_fsetxattr" = "yes"; then
1736 AC_MSG_RESULT([yes])
1737 else
1738 AC_MSG_RESULT([no])
1739 fi
1740 fi
1741 #
1742 if test "$tst_compi_fsetxattr" = "yes"; then
1743 AC_MSG_CHECKING([if fsetxattr usage allowed])
1744 if test "x$curl_disallow_fsetxattr" != "xyes"; then
1745 AC_MSG_RESULT([yes])
1746 tst_allow_fsetxattr="yes"
1747 else
1748 AC_MSG_RESULT([no])
1749 tst_allow_fsetxattr="no"
1750 fi
1751 fi
1752 #
1753 AC_MSG_CHECKING([if fsetxattr might be used])
1754 if test "$tst_links_fsetxattr" = "yes" &&
1755 test "$tst_proto_fsetxattr" = "yes" &&
1756 test "$tst_compi_fsetxattr" = "yes" &&
1757 test "$tst_allow_fsetxattr" = "yes"; then
1758 AC_MSG_RESULT([yes])
1759 AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1,
1760 [Define to 1 if you have the fsetxattr function.])
1761 dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr,
1762 dnl [Specifies the number of arguments to fsetxattr])
1763 #
1764 if test "$tst_nargs_fsetxattr" -eq "5"; then
1765 AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args])
1766 elif test "$tst_nargs_fsetxattr" -eq "6"; then
1767 AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args])
1768 fi
1769 #
1770 curl_cv_func_fsetxattr="yes"
1771 else
1772 AC_MSG_RESULT([no])
1773 curl_cv_func_fsetxattr="no"
1774 fi
1775])
1776
1777
1778dnl CURL_CHECK_FUNC_FTRUNCATE
1779dnl -------------------------------------------------
1780dnl Verify if ftruncate is available, prototyped, and
1781dnl can be compiled. If all of these are true, and
1782dnl usage has not been previously disallowed with
1783dnl shell variable curl_disallow_ftruncate, then
1784dnl HAVE_FTRUNCATE will be defined.
1785
1786AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
1787 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
1788 #
1789 tst_links_ftruncate="unknown"
1790 tst_proto_ftruncate="unknown"
1791 tst_compi_ftruncate="unknown"
1792 tst_allow_ftruncate="unknown"
1793 #
1794 AC_MSG_CHECKING([if ftruncate can be linked])
1795 AC_LINK_IFELSE([
1796 AC_LANG_FUNC_LINK_TRY([ftruncate])
1797 ],[
1798 AC_MSG_RESULT([yes])
1799 tst_links_ftruncate="yes"
1800 ],[
1801 AC_MSG_RESULT([no])
1802 tst_links_ftruncate="no"
1803 ])
1804 #
1805 if test "$tst_links_ftruncate" = "yes"; then
1806 AC_MSG_CHECKING([if ftruncate is prototyped])
1807 AC_EGREP_CPP([ftruncate],[
1808 $curl_includes_unistd
1809 ],[
1810 AC_MSG_RESULT([yes])
1811 tst_proto_ftruncate="yes"
1812 ],[
1813 AC_MSG_RESULT([no])
1814 tst_proto_ftruncate="no"
1815 ])
1816 fi
1817 #
1818 if test "$tst_proto_ftruncate" = "yes"; then
1819 AC_MSG_CHECKING([if ftruncate is compilable])
1820 AC_COMPILE_IFELSE([
1821 AC_LANG_PROGRAM([[
1822 $curl_includes_unistd
1823 ]],[[
1824 if(0 != ftruncate(0, 0))
1825 return 1;
1826 ]])
1827 ],[
1828 AC_MSG_RESULT([yes])
1829 tst_compi_ftruncate="yes"
1830 ],[
1831 AC_MSG_RESULT([no])
1832 tst_compi_ftruncate="no"
1833 ])
1834 fi
1835 #
1836 if test "$tst_compi_ftruncate" = "yes"; then
1837 AC_MSG_CHECKING([if ftruncate usage allowed])
1838 if test "x$curl_disallow_ftruncate" != "xyes"; then
1839 AC_MSG_RESULT([yes])
1840 tst_allow_ftruncate="yes"
1841 else
1842 AC_MSG_RESULT([no])
1843 tst_allow_ftruncate="no"
1844 fi
1845 fi
1846 #
1847 AC_MSG_CHECKING([if ftruncate might be used])
1848 if test "$tst_links_ftruncate" = "yes" &&
1849 test "$tst_proto_ftruncate" = "yes" &&
1850 test "$tst_compi_ftruncate" = "yes" &&
1851 test "$tst_allow_ftruncate" = "yes"; then
1852 AC_MSG_RESULT([yes])
1853 AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1,
1854 [Define to 1 if you have the ftruncate function.])
1855 curl_cv_func_ftruncate="yes"
1856 else
1857 AC_MSG_RESULT([no])
1858 curl_cv_func_ftruncate="no"
1859 fi
1860])
1861
1862
1863dnl CURL_CHECK_FUNC_GETADDRINFO
1864dnl -------------------------------------------------
1865dnl Verify if getaddrinfo is available, prototyped, can
1866dnl be compiled and seems to work. If all of these are
1867dnl true, and usage has not been previously disallowed
1868dnl with shell variable curl_disallow_getaddrinfo, then
1869dnl HAVE_GETADDRINFO will be defined. Additionally when
1870dnl HAVE_GETADDRINFO gets defined this will also attempt
1871dnl to find out if getaddrinfo happens to be threadsafe,
1872dnl defining HAVE_GETADDRINFO_THREADSAFE when true.
1873
1874AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
1875 AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
1876 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
1877 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
1878 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
1879 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
1880 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
1881 #
1882 tst_links_getaddrinfo="unknown"
1883 tst_proto_getaddrinfo="unknown"
1884 tst_compi_getaddrinfo="unknown"
1885 tst_works_getaddrinfo="unknown"
1886 tst_allow_getaddrinfo="unknown"
1887 tst_tsafe_getaddrinfo="unknown"
1888 #
1889 AC_MSG_CHECKING([if getaddrinfo can be linked])
1890 AC_LINK_IFELSE([
1891 AC_LANG_PROGRAM([[
1892 $curl_includes_ws2tcpip
1893 $curl_includes_sys_socket
1894 $curl_includes_netdb
1895 ]],[[
1896 if(0 != getaddrinfo(0, 0, 0, 0))
1897 return 1;
1898 ]])
1899 ],[
1900 AC_MSG_RESULT([yes])
1901 tst_links_getaddrinfo="yes"
1902 ],[
1903 AC_MSG_RESULT([no])
1904 tst_links_getaddrinfo="no"
1905 ])
1906 #
1907 if test "$tst_links_getaddrinfo" = "yes"; then
1908 AC_MSG_CHECKING([if getaddrinfo is prototyped])
1909 AC_EGREP_CPP([getaddrinfo],[
1910 $curl_includes_ws2tcpip
1911 $curl_includes_sys_socket
1912 $curl_includes_netdb
1913 ],[
1914 AC_MSG_RESULT([yes])
1915 tst_proto_getaddrinfo="yes"
1916 ],[
1917 AC_MSG_RESULT([no])
1918 tst_proto_getaddrinfo="no"
1919 ])
1920 fi
1921 #
1922 if test "$tst_proto_getaddrinfo" = "yes"; then
1923 AC_MSG_CHECKING([if getaddrinfo is compilable])
1924 AC_COMPILE_IFELSE([
1925 AC_LANG_PROGRAM([[
1926 $curl_includes_ws2tcpip
1927 $curl_includes_sys_socket
1928 $curl_includes_netdb
1929 ]],[[
1930 if(0 != getaddrinfo(0, 0, 0, 0))
1931 return 1;
1932 ]])
1933 ],[
1934 AC_MSG_RESULT([yes])
1935 tst_compi_getaddrinfo="yes"
1936 ],[
1937 AC_MSG_RESULT([no])
1938 tst_compi_getaddrinfo="no"
1939 ])
1940 fi
1941 #
1942 dnl only do runtime verification when not cross-compiling
1943 if test "x$cross_compiling" != "xyes" &&
1944 test "$tst_compi_getaddrinfo" = "yes"; then
1945 AC_MSG_CHECKING([if getaddrinfo seems to work])
1946 CURL_RUN_IFELSE([
1947 AC_LANG_PROGRAM([[
1948 $curl_includes_ws2tcpip
1949 $curl_includes_stdlib
1950 $curl_includes_string
1951 $curl_includes_sys_socket
1952 $curl_includes_netdb
1953 ]],[[
1954 struct addrinfo hints;
1955 struct addrinfo *ai = 0;
1956 int error;
1957
1958 #ifdef HAVE_WINSOCK2_H
1959 WSADATA wsa;
1960 if (WSAStartup(MAKEWORD(2,2), &wsa))
1961 exit(2);
1962 #endif
1963
1964 memset(&hints, 0, sizeof(hints));
1965 hints.ai_flags = AI_NUMERICHOST;
1966 hints.ai_family = AF_UNSPEC;
1967 hints.ai_socktype = SOCK_STREAM;
1968 error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
1969 if(error || !ai)
1970 exit(1); /* fail */
1971 else
1972 exit(0);
1973 ]])
1974 ],[
1975 AC_MSG_RESULT([yes])
1976 tst_works_getaddrinfo="yes"
1977 ],[
1978 AC_MSG_RESULT([no])
1979 tst_works_getaddrinfo="no"
1980 ])
1981 fi
1982 #
1983 if test "$tst_compi_getaddrinfo" = "yes" &&
1984 test "$tst_works_getaddrinfo" != "no"; then
1985 AC_MSG_CHECKING([if getaddrinfo usage allowed])
1986 if test "x$curl_disallow_getaddrinfo" != "xyes"; then
1987 AC_MSG_RESULT([yes])
1988 tst_allow_getaddrinfo="yes"
1989 else
1990 AC_MSG_RESULT([no])
1991 tst_allow_getaddrinfo="no"
1992 fi
1993 fi
1994 #
1995 AC_MSG_CHECKING([if getaddrinfo might be used])
1996 if test "$tst_links_getaddrinfo" = "yes" &&
1997 test "$tst_proto_getaddrinfo" = "yes" &&
1998 test "$tst_compi_getaddrinfo" = "yes" &&
1999 test "$tst_allow_getaddrinfo" = "yes" &&
2000 test "$tst_works_getaddrinfo" != "no"; then
2001 AC_MSG_RESULT([yes])
2002 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
2003 [Define to 1 if you have a working getaddrinfo function.])
2004 curl_cv_func_getaddrinfo="yes"
2005 else
2006 AC_MSG_RESULT([no])
2007 curl_cv_func_getaddrinfo="no"
2008 curl_cv_func_getaddrinfo_threadsafe="no"
2009 fi
2010 #
2011 if test "$curl_cv_func_getaddrinfo" = "yes"; then
2012 AC_MSG_CHECKING([if getaddrinfo is threadsafe])
2013 case $host_os in
2014 aix[[1234]].* | aix5.[[01]].*)
2015 dnl aix 5.1 and older
2016 tst_tsafe_getaddrinfo="no"
2017 ;;
2018 aix*)
2019 dnl aix 5.2 and newer
2020 tst_tsafe_getaddrinfo="yes"
2021 ;;
2022 darwin[[12345]].*)
2023 dnl darwin 5.0 and mac os x 10.1.X and older
2024 tst_tsafe_getaddrinfo="no"
2025 ;;
2026 darwin*)
2027 dnl darwin 6.0 and mac os x 10.2.X and newer
2028 tst_tsafe_getaddrinfo="yes"
2029 ;;
2030 freebsd[[1234]].* | freebsd5.[[1234]]*)
2031 dnl freebsd 5.4 and older
2032 tst_tsafe_getaddrinfo="no"
2033 ;;
2034 freebsd*)
2035 dnl freebsd 5.5 and newer
2036 tst_tsafe_getaddrinfo="yes"
2037 ;;
2038 hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*)
2039 dnl hpux 11.10 and older
2040 tst_tsafe_getaddrinfo="no"
2041 ;;
2042 hpux*)
2043 dnl hpux 11.11 and newer
2044 tst_tsafe_getaddrinfo="yes"
2045 ;;
2046 midnightbsd*)
2047 dnl all MidnightBSD versions
2048 tst_tsafe_getaddrinfo="yes"
2049 ;;
2050 netbsd[[123]].*)
2051 dnl netbsd 3.X and older
2052 tst_tsafe_getaddrinfo="no"
2053 ;;
2054 netbsd*)
2055 dnl netbsd 4.X and newer
2056 tst_tsafe_getaddrinfo="yes"
2057 ;;
2058 *bsd*)
2059 dnl All other bsd's
2060 tst_tsafe_getaddrinfo="no"
2061 ;;
2062 solaris2*)
2063 dnl solaris which have it
2064 tst_tsafe_getaddrinfo="yes"
2065 ;;
2066 esac
2067 if test "$tst_tsafe_getaddrinfo" = "unknown" &&
2068 test "$curl_cv_native_windows" = "yes"; then
2069 tst_tsafe_getaddrinfo="yes"
2070 fi
2071 if test "$tst_tsafe_getaddrinfo" = "unknown"; then
2072 CURL_CHECK_DEF_CC([h_errno], [
2073 $curl_includes_sys_socket
2074 $curl_includes_netdb
2075 ], [silent])
2076 if test "$curl_cv_have_def_h_errno" = "yes"; then
2077 tst_h_errno_macro="yes"
2078 else
2079 tst_h_errno_macro="no"
2080 fi
2081 AC_COMPILE_IFELSE([
2082 AC_LANG_PROGRAM([[
2083 $curl_includes_sys_socket
2084 $curl_includes_netdb
2085 ]],[[
2086 h_errno = 2;
2087 if(0 != h_errno)
2088 return 1;
2089 ]])
2090 ],[
2091 tst_h_errno_modifiable_lvalue="yes"
2092 ],[
2093 tst_h_errno_modifiable_lvalue="no"
2094 ])
2095 AC_COMPILE_IFELSE([
2096 AC_LANG_PROGRAM([[
2097 ]],[[
2098#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
2099 return 0;
2100#elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
2101 return 0;
2102#else
2103 force compilation error
2104#endif
2105 ]])
2106 ],[
2107 tst_h_errno_sbs_issue_7="yes"
2108 ],[
2109 tst_h_errno_sbs_issue_7="no"
2110 ])
2111 if test "$tst_h_errno_macro" = "no" &&
2112 test "$tst_h_errno_modifiable_lvalue" = "no" &&
2113 test "$tst_h_errno_sbs_issue_7" = "no"; then
2114 tst_tsafe_getaddrinfo="no"
2115 else
2116 tst_tsafe_getaddrinfo="yes"
2117 fi
2118 fi
2119 AC_MSG_RESULT([$tst_tsafe_getaddrinfo])
2120 if test "$tst_tsafe_getaddrinfo" = "yes"; then
2121 AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
2122 [Define to 1 if the getaddrinfo function is threadsafe.])
2123 curl_cv_func_getaddrinfo_threadsafe="yes"
2124 else
2125 curl_cv_func_getaddrinfo_threadsafe="no"
2126 fi
2127 fi
2128])
2129
2130
2131dnl CURL_CHECK_FUNC_GETHOSTBYNAME
2132dnl -------------------------------------------------
2133dnl Verify if gethostbyname is available, prototyped,
2134dnl and can be compiled. If all of these are true,
2135dnl and usage has not been previously disallowed with
2136dnl shell variable curl_disallow_gethostbyname, then
2137dnl HAVE_GETHOSTBYNAME will be defined.
2138
2139AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [
2140 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
2141 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
2142 #
2143 tst_links_gethostbyname="unknown"
2144 tst_proto_gethostbyname="unknown"
2145 tst_compi_gethostbyname="unknown"
2146 tst_allow_gethostbyname="unknown"
2147 #
2148 AC_MSG_CHECKING([if gethostbyname can be linked])
2149 AC_LINK_IFELSE([
2150 AC_LANG_PROGRAM([[
2151 $curl_includes_winsock2
2152 $curl_includes_bsdsocket
2153 $curl_includes_netdb
2154 ]],[[
2155 if(0 != gethostbyname(0))
2156 return 1;
2157 ]])
2158 ],[
2159 AC_MSG_RESULT([yes])
2160 tst_links_gethostbyname="yes"
2161 ],[
2162 AC_MSG_RESULT([no])
2163 tst_links_gethostbyname="no"
2164 ])
2165 #
2166 if test "$tst_links_gethostbyname" = "yes"; then
2167 AC_MSG_CHECKING([if gethostbyname is prototyped])
2168 AC_EGREP_CPP([gethostbyname],[
2169 $curl_includes_winsock2
2170 $curl_includes_bsdsocket
2171 $curl_includes_netdb
2172 ],[
2173 AC_MSG_RESULT([yes])
2174 tst_proto_gethostbyname="yes"
2175 ],[
2176 AC_MSG_RESULT([no])
2177 tst_proto_gethostbyname="no"
2178 ])
2179 fi
2180 #
2181 if test "$tst_proto_gethostbyname" = "yes"; then
2182 AC_MSG_CHECKING([if gethostbyname is compilable])
2183 AC_COMPILE_IFELSE([
2184 AC_LANG_PROGRAM([[
2185 $curl_includes_winsock2
2186 $curl_includes_bsdsocket
2187 $curl_includes_netdb
2188 ]],[[
2189 if(0 != gethostbyname(0))
2190 return 1;
2191 ]])
2192 ],[
2193 AC_MSG_RESULT([yes])
2194 tst_compi_gethostbyname="yes"
2195 ],[
2196 AC_MSG_RESULT([no])
2197 tst_compi_gethostbyname="no"
2198 ])
2199 fi
2200 #
2201 if test "$tst_compi_gethostbyname" = "yes"; then
2202 AC_MSG_CHECKING([if gethostbyname usage allowed])
2203 if test "x$curl_disallow_gethostbyname" != "xyes"; then
2204 AC_MSG_RESULT([yes])
2205 tst_allow_gethostbyname="yes"
2206 else
2207 AC_MSG_RESULT([no])
2208 tst_allow_gethostbyname="no"
2209 fi
2210 fi
2211 #
2212 AC_MSG_CHECKING([if gethostbyname might be used])
2213 if test "$tst_links_gethostbyname" = "yes" &&
2214 test "$tst_proto_gethostbyname" = "yes" &&
2215 test "$tst_compi_gethostbyname" = "yes" &&
2216 test "$tst_allow_gethostbyname" = "yes"; then
2217 AC_MSG_RESULT([yes])
2218 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
2219 [Define to 1 if you have the gethostbyname function.])
2220 curl_cv_func_gethostbyname="yes"
2221 else
2222 AC_MSG_RESULT([no])
2223 curl_cv_func_gethostbyname="no"
2224 fi
2225])
2226
2227
2228dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R
2229dnl -------------------------------------------------
2230dnl Verify if gethostbyname_r is available, prototyped,
2231dnl and can be compiled. If all of these are true, and
2232dnl usage has not been previously disallowed with
2233dnl shell variable curl_disallow_gethostbyname_r, then
2234dnl HAVE_GETHOSTBYNAME_R will be defined.
2235
2236AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [
2237 AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
2238 #
2239 tst_links_gethostbyname_r="unknown"
2240 tst_proto_gethostbyname_r="unknown"
2241 tst_compi_gethostbyname_r="unknown"
2242 tst_allow_gethostbyname_r="unknown"
2243 tst_nargs_gethostbyname_r="unknown"
2244 #
2245 AC_MSG_CHECKING([if gethostbyname_r can be linked])
2246 AC_LINK_IFELSE([
2247 AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
2248 ],[
2249 AC_MSG_RESULT([yes])
2250 tst_links_gethostbyname_r="yes"
2251 ],[
2252 AC_MSG_RESULT([no])
2253 tst_links_gethostbyname_r="no"
2254 ])
2255 #
2256 if test "$tst_links_gethostbyname_r" = "yes"; then
2257 AC_MSG_CHECKING([if gethostbyname_r is prototyped])
2258 AC_EGREP_CPP([gethostbyname_r],[
2259 $curl_includes_netdb
2260 ],[
2261 AC_MSG_RESULT([yes])
2262 tst_proto_gethostbyname_r="yes"
2263 ],[
2264 AC_MSG_RESULT([no])
2265 tst_proto_gethostbyname_r="no"
2266 ])
2267 fi
2268 #
2269 if test "$tst_proto_gethostbyname_r" = "yes"; then
2270 if test "$tst_nargs_gethostbyname_r" = "unknown"; then
2271 AC_MSG_CHECKING([if gethostbyname_r takes 3 args.])
2272 AC_COMPILE_IFELSE([
2273 AC_LANG_PROGRAM([[
2274 $curl_includes_netdb
2275 $curl_includes_bsdsocket
2276 ]],[[
2277 if(0 != gethostbyname_r(0, 0, 0))
2278 return 1;
2279 ]])
2280 ],[
2281 AC_MSG_RESULT([yes])
2282 tst_compi_gethostbyname_r="yes"
2283 tst_nargs_gethostbyname_r="3"
2284 ],[
2285 AC_MSG_RESULT([no])
2286 tst_compi_gethostbyname_r="no"
2287 ])
2288 fi
2289 if test "$tst_nargs_gethostbyname_r" = "unknown"; then
2290 AC_MSG_CHECKING([if gethostbyname_r takes 5 args.])
2291 AC_COMPILE_IFELSE([
2292 AC_LANG_PROGRAM([[
2293 $curl_includes_netdb
2294 $curl_includes_bsdsocket
2295 ]],[[
2296 if(0 != gethostbyname_r(0, 0, 0, 0, 0))
2297 return 1;
2298 ]])
2299 ],[
2300 AC_MSG_RESULT([yes])
2301 tst_compi_gethostbyname_r="yes"
2302 tst_nargs_gethostbyname_r="5"
2303 ],[
2304 AC_MSG_RESULT([no])
2305 tst_compi_gethostbyname_r="no"
2306 ])
2307 fi
2308 if test "$tst_nargs_gethostbyname_r" = "unknown"; then
2309 AC_MSG_CHECKING([if gethostbyname_r takes 6 args.])
2310 AC_COMPILE_IFELSE([
2311 AC_LANG_PROGRAM([[
2312 $curl_includes_netdb
2313 $curl_includes_bsdsocket
2314 ]],[[
2315 if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0))
2316 return 1;
2317 ]])
2318 ],[
2319 AC_MSG_RESULT([yes])
2320 tst_compi_gethostbyname_r="yes"
2321 tst_nargs_gethostbyname_r="6"
2322 ],[
2323 AC_MSG_RESULT([no])
2324 tst_compi_gethostbyname_r="no"
2325 ])
2326 fi
2327 AC_MSG_CHECKING([if gethostbyname_r is compilable])
2328 if test "$tst_compi_gethostbyname_r" = "yes"; then
2329 AC_MSG_RESULT([yes])
2330 else
2331 AC_MSG_RESULT([no])
2332 fi
2333 fi
2334 #
2335 if test "$tst_compi_gethostbyname_r" = "yes"; then
2336 AC_MSG_CHECKING([if gethostbyname_r usage allowed])
2337 if test "x$curl_disallow_gethostbyname_r" != "xyes"; then
2338 AC_MSG_RESULT([yes])
2339 tst_allow_gethostbyname_r="yes"
2340 else
2341 AC_MSG_RESULT([no])
2342 tst_allow_gethostbyname_r="no"
2343 fi
2344 fi
2345 #
2346 AC_MSG_CHECKING([if gethostbyname_r might be used])
2347 if test "$tst_links_gethostbyname_r" = "yes" &&
2348 test "$tst_proto_gethostbyname_r" = "yes" &&
2349 test "$tst_compi_gethostbyname_r" = "yes" &&
2350 test "$tst_allow_gethostbyname_r" = "yes"; then
2351 AC_MSG_RESULT([yes])
2352 AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
2353 [Define to 1 if you have the gethostbyname_r function.])
2354 dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r,
2355 dnl [Specifies the number of arguments to gethostbyname_r])
2356 #
2357 if test "$tst_nargs_gethostbyname_r" -eq "3"; then
2358 AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
2359 elif test "$tst_nargs_gethostbyname_r" -eq "5"; then
2360 AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
2361 elif test "$tst_nargs_gethostbyname_r" -eq "6"; then
2362 AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
2363 fi
2364 #
2365 curl_cv_func_gethostbyname_r="yes"
2366 else
2367 AC_MSG_RESULT([no])
2368 curl_cv_func_gethostbyname_r="no"
2369 fi
2370])
2371
2372
2373dnl CURL_CHECK_FUNC_GETHOSTNAME
2374dnl -------------------------------------------------
2375dnl Verify if gethostname is available, prototyped, and
2376dnl can be compiled. If all of these are true, and
2377dnl usage has not been previously disallowed with
2378dnl shell variable curl_disallow_gethostname, then
2379dnl HAVE_GETHOSTNAME will be defined.
2380
2381AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
2382 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
2383 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
2384 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
2385 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
2386 #
2387 tst_links_gethostname="unknown"
2388 tst_proto_gethostname="unknown"
2389 tst_compi_gethostname="unknown"
2390 tst_allow_gethostname="unknown"
2391 #
2392 AC_MSG_CHECKING([if gethostname can be linked])
2393 AC_LINK_IFELSE([
2394 AC_LANG_PROGRAM([[
2395 $curl_includes_winsock2
2396 $curl_includes_unistd
2397 $curl_includes_bsdsocket
2398 ]],[[
2399 if(0 != gethostname(0, 0))
2400 return 1;
2401 ]])
2402 ],[
2403 AC_MSG_RESULT([yes])
2404 tst_links_gethostname="yes"
2405 ],[
2406 AC_MSG_RESULT([no])
2407 tst_links_gethostname="no"
2408 ])
2409 #
2410 if test "$tst_links_gethostname" = "yes"; then
2411 AC_MSG_CHECKING([if gethostname is prototyped])
2412 AC_EGREP_CPP([gethostname],[
2413 $curl_includes_winsock2
2414 $curl_includes_unistd
2415 $curl_includes_bsdsocket
2416 ],[
2417 AC_MSG_RESULT([yes])
2418 tst_proto_gethostname="yes"
2419 ],[
2420 AC_MSG_RESULT([no])
2421 tst_proto_gethostname="no"
2422 ])
2423 fi
2424 #
2425 if test "$tst_proto_gethostname" = "yes"; then
2426 AC_MSG_CHECKING([if gethostname is compilable])
2427 AC_COMPILE_IFELSE([
2428 AC_LANG_PROGRAM([[
2429 $curl_includes_winsock2
2430 $curl_includes_unistd
2431 $curl_includes_bsdsocket
2432 ]],[[
2433 if(0 != gethostname(0, 0))
2434 return 1;
2435 ]])
2436 ],[
2437 AC_MSG_RESULT([yes])
2438 tst_compi_gethostname="yes"
2439 ],[
2440 AC_MSG_RESULT([no])
2441 tst_compi_gethostname="no"
2442 ])
2443 fi
2444 #
2445 if test "$tst_compi_gethostname" = "yes"; then
2446 AC_MSG_CHECKING([for gethostname arg 2 data type])
2447 tst_gethostname_type_arg2="unknown"
2448 for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do
2449 for tst_arg2 in 'int' 'unsigned int' 'size_t'; do
2450 if test "$tst_gethostname_type_arg2" = "unknown"; then
2451 AC_COMPILE_IFELSE([
2452 AC_LANG_PROGRAM([[
2453 $curl_includes_winsock2
2454 $curl_includes_unistd
2455 $curl_includes_bsdsocket
2456 $curl_preprocess_callconv
2457 extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
2458 ]],[[
2459 if(0 != gethostname(0, 0))
2460 return 1;
2461 ]])
2462 ],[
2463 tst_gethostname_type_arg2="$tst_arg2"
2464 ])
2465 fi
2466 done
2467 done
2468 AC_MSG_RESULT([$tst_gethostname_type_arg2])
2469 if test "$tst_gethostname_type_arg2" != "unknown"; then
2470 AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2,
2471 [Define to the type of arg 2 for gethostname.])
2472 fi
2473 fi
2474 #
2475 if test "$tst_compi_gethostname" = "yes"; then
2476 AC_MSG_CHECKING([if gethostname usage allowed])
2477 if test "x$curl_disallow_gethostname" != "xyes"; then
2478 AC_MSG_RESULT([yes])
2479 tst_allow_gethostname="yes"
2480 else
2481 AC_MSG_RESULT([no])
2482 tst_allow_gethostname="no"
2483 fi
2484 fi
2485 #
2486 AC_MSG_CHECKING([if gethostname might be used])
2487 if test "$tst_links_gethostname" = "yes" &&
2488 test "$tst_proto_gethostname" = "yes" &&
2489 test "$tst_compi_gethostname" = "yes" &&
2490 test "$tst_allow_gethostname" = "yes"; then
2491 AC_MSG_RESULT([yes])
2492 AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
2493 [Define to 1 if you have the gethostname function.])
2494 curl_cv_func_gethostname="yes"
2495 else
2496 AC_MSG_RESULT([no])
2497 curl_cv_func_gethostname="no"
2498 fi
2499])
2500
2501dnl CURL_CHECK_FUNC_GETPEERNAME
2502dnl -------------------------------------------------
2503dnl Verify if getpeername is available, prototyped, and
2504dnl can be compiled. If all of these are true, and
2505dnl usage has not been previously disallowed with
2506dnl shell variable curl_disallow_getpeername, then
2507dnl HAVE_GETPEERNAME will be defined.
2508
2509AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [
2510 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
2511 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
2512 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
2513 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
2514 #
2515 tst_links_getpeername="unknown"
2516 tst_proto_getpeername="unknown"
2517 tst_compi_getpeername="unknown"
2518 tst_allow_getpeername="unknown"
2519 #
2520 AC_MSG_CHECKING([if getpeername can be linked])
2521 AC_LINK_IFELSE([
2522 AC_LANG_PROGRAM([[
2523 $curl_includes_winsock2
2524 $curl_includes_bsdsocket
2525 $curl_includes_sys_socket
2526 ]],[[
2527 if(0 != getpeername(0, (void *)0, (void *)0))
2528 return 1;
2529 ]])
2530 ],[
2531 AC_MSG_RESULT([yes])
2532 tst_links_getpeername="yes"
2533 ],[
2534 AC_MSG_RESULT([no])
2535 tst_links_getpeername="no"
2536 ])
2537 #
2538 if test "$tst_links_getpeername" = "yes"; then
2539 AC_MSG_CHECKING([if getpeername is prototyped])
2540 AC_EGREP_CPP([getpeername],[
2541 $curl_includes_winsock2
2542 $curl_includes_bsdsocket
2543 $curl_includes_sys_socket
2544 ],[
2545 AC_MSG_RESULT([yes])
2546 tst_proto_getpeername="yes"
2547 ],[
2548 AC_MSG_RESULT([no])
2549 tst_proto_getpeername="no"
2550 ])
2551 fi
2552 #
2553 if test "$tst_proto_getpeername" = "yes"; then
2554 AC_MSG_CHECKING([if getpeername is compilable])
2555 AC_COMPILE_IFELSE([
2556 AC_LANG_PROGRAM([[
2557 $curl_includes_winsock2
2558 $curl_includes_bsdsocket
2559 $curl_includes_sys_socket
2560 ]],[[
2561 if(0 != getpeername(0, (void *)0, (void *)0))
2562 return 1;
2563 ]])
2564 ],[
2565 AC_MSG_RESULT([yes])
2566 tst_compi_getpeername="yes"
2567 ],[
2568 AC_MSG_RESULT([no])
2569 tst_compi_getpeername="no"
2570 ])
2571 fi
2572 #
2573 if test "$tst_compi_getpeername" = "yes"; then
2574 AC_MSG_CHECKING([if getpeername usage allowed])
2575 if test "x$curl_disallow_getpeername" != "xyes"; then
2576 AC_MSG_RESULT([yes])
2577 tst_allow_getpeername="yes"
2578 else
2579 AC_MSG_RESULT([no])
2580 tst_allow_getpeername="no"
2581 fi
2582 fi
2583 #
2584 AC_MSG_CHECKING([if getpeername might be used])
2585 if test "$tst_links_getpeername" = "yes" &&
2586 test "$tst_proto_getpeername" = "yes" &&
2587 test "$tst_compi_getpeername" = "yes" &&
2588 test "$tst_allow_getpeername" = "yes"; then
2589 AC_MSG_RESULT([yes])
2590 AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1,
2591 [Define to 1 if you have the getpeername function.])
2592 curl_cv_func_getpeername="yes"
2593 else
2594 AC_MSG_RESULT([no])
2595 curl_cv_func_getpeername="no"
2596 fi
2597])
2598
2599dnl CURL_CHECK_FUNC_GETSOCKNAME
2600dnl -------------------------------------------------
2601dnl Verify if getsockname is available, prototyped, and
2602dnl can be compiled. If all of these are true, and
2603dnl usage has not been previously disallowed with
2604dnl shell variable curl_disallow_getsockname, then
2605dnl HAVE_GETSOCKNAME will be defined.
2606
2607AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [
2608 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
2609 AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
2610 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
2611 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
2612 #
2613 tst_links_getsockname="unknown"
2614 tst_proto_getsockname="unknown"
2615 tst_compi_getsockname="unknown"
2616 tst_allow_getsockname="unknown"
2617 #
2618 AC_MSG_CHECKING([if getsockname can be linked])
2619 AC_LINK_IFELSE([
2620 AC_LANG_PROGRAM([[
2621 $curl_includes_winsock2
2622 $curl_includes_bsdsocket
2623 $curl_includes_sys_socket
2624 ]],[[
2625 if(0 != getsockname(0, (void *)0, (void *)0))
2626 return 1;
2627 ]])
2628 ],[
2629 AC_MSG_RESULT([yes])
2630 tst_links_getsockname="yes"
2631 ],[
2632 AC_MSG_RESULT([no])
2633 tst_links_getsockname="no"
2634 ])
2635 #
2636 if test "$tst_links_getsockname" = "yes"; then
2637 AC_MSG_CHECKING([if getsockname is prototyped])
2638 AC_EGREP_CPP([getsockname],[
2639 $curl_includes_winsock2
2640 $curl_includes_bsdsocket
2641 $curl_includes_sys_socket
2642 ],[
2643 AC_MSG_RESULT([yes])
2644 tst_proto_getsockname="yes"
2645 ],[
2646 AC_MSG_RESULT([no])
2647 tst_proto_getsockname="no"
2648 ])
2649 fi
2650 #
2651 if test "$tst_proto_getsockname" = "yes"; then
2652 AC_MSG_CHECKING([if getsockname is compilable])
2653 AC_COMPILE_IFELSE([
2654 AC_LANG_PROGRAM([[
2655 $curl_includes_winsock2
2656 $curl_includes_bsdsocket
2657 $curl_includes_sys_socket
2658 ]],[[
2659 if(0 != getsockname(0, (void *)0, (void *)0))
2660 return 1;
2661 ]])
2662 ],[
2663 AC_MSG_RESULT([yes])
2664 tst_compi_getsockname="yes"
2665 ],[
2666 AC_MSG_RESULT([no])
2667 tst_compi_getsockname="no"
2668 ])
2669 fi
2670 #
2671 if test "$tst_compi_getsockname" = "yes"; then
2672 AC_MSG_CHECKING([if getsockname usage allowed])
2673 if test "x$curl_disallow_getsockname" != "xyes"; then
2674 AC_MSG_RESULT([yes])
2675 tst_allow_getsockname="yes"
2676 else
2677 AC_MSG_RESULT([no])
2678 tst_allow_getsockname="no"
2679 fi
2680 fi
2681 #
2682 AC_MSG_CHECKING([if getsockname might be used])
2683 if test "$tst_links_getsockname" = "yes" &&
2684 test "$tst_proto_getsockname" = "yes" &&
2685 test "$tst_compi_getsockname" = "yes" &&
2686 test "$tst_allow_getsockname" = "yes"; then
2687 AC_MSG_RESULT([yes])
2688 AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1,
2689 [Define to 1 if you have the getsockname function.])
2690 curl_cv_func_getsockname="yes"
2691 else
2692 AC_MSG_RESULT([no])
2693 curl_cv_func_getsockname="no"
2694 fi
2695])
2696
2697dnl CURL_CHECK_FUNC_IF_NAMETOINDEX
2698dnl -------------------------------------------------
2699dnl Verify if if_nametoindex is available, prototyped, and
2700dnl can be compiled. If all of these are true, and
2701dnl usage has not been previously disallowed with
2702dnl shell variable curl_disallow_if_nametoindex, then
2703dnl HAVE_IF_NAMETOINDEX will be defined.
2704
2705AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [
2706 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
2707 AC_REQUIRE([CURL_INCLUDES_NETIF])dnl
2708 AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
2709 #
2710 tst_links_if_nametoindex="unknown"
2711 tst_proto_if_nametoindex="unknown"
2712 tst_compi_if_nametoindex="unknown"
2713 tst_allow_if_nametoindex="unknown"
2714 #
2715 AC_MSG_CHECKING([if if_nametoindex can be linked])
2716 AC_LINK_IFELSE([
2717 AC_LANG_PROGRAM([[
2718 $curl_includes_winsock2
2719 $curl_includes_bsdsocket
2720 #include <net/if.h>
2721 ]],[[
2722 if(0 != if_nametoindex(""))
2723 return 1;
2724 ]])
2725 ],[
2726 AC_MSG_RESULT([yes])
2727 tst_links_if_nametoindex="yes"
2728 ],[
2729 AC_MSG_RESULT([no])
2730 tst_links_if_nametoindex="no"
2731 ])
2732 #
2733 if test "$tst_links_if_nametoindex" = "yes"; then
2734 AC_MSG_CHECKING([if if_nametoindex is prototyped])
2735 AC_EGREP_CPP([if_nametoindex],[
2736 $curl_includes_winsock2
2737 $curl_includes_netif
2738 ],[
2739 AC_MSG_RESULT([yes])
2740 tst_proto_if_nametoindex="yes"
2741 ],[
2742 AC_MSG_RESULT([no])
2743 tst_proto_if_nametoindex="no"
2744 ])
2745 fi
2746 #
2747 if test "$tst_proto_if_nametoindex" = "yes"; then
2748 AC_MSG_CHECKING([if if_nametoindex is compilable])
2749 AC_COMPILE_IFELSE([
2750 AC_LANG_PROGRAM([[
2751 $curl_includes_winsock2
2752 $curl_includes_netif
2753 ]],[[
2754 if(0 != if_nametoindex(""))
2755 return 1;
2756 ]])
2757 ],[
2758 AC_MSG_RESULT([yes])
2759 tst_compi_if_nametoindex="yes"
2760 ],[
2761 AC_MSG_RESULT([no])
2762 tst_compi_if_nametoindex="no"
2763 ])
2764 fi
2765 #
2766 if test "$tst_compi_if_nametoindex" = "yes"; then
2767 AC_MSG_CHECKING([if if_nametoindex usage allowed])
2768 if test "x$curl_disallow_if_nametoindex" != "xyes"; then
2769 AC_MSG_RESULT([yes])
2770 tst_allow_if_nametoindex="yes"
2771 else
2772 AC_MSG_RESULT([no])
2773 tst_allow_if_nametoindex="no"
2774 fi
2775 fi
2776 #
2777 AC_MSG_CHECKING([if if_nametoindex might be used])
2778 if test "$tst_links_if_nametoindex" = "yes" &&
2779 test "$tst_proto_if_nametoindex" = "yes" &&
2780 test "$tst_compi_if_nametoindex" = "yes" &&
2781 test "$tst_allow_if_nametoindex" = "yes"; then
2782 AC_MSG_RESULT([yes])
2783 AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1,
2784 [Define to 1 if you have the if_nametoindex function.])
2785 curl_cv_func_if_nametoindex="yes"
2786 else
2787 AC_MSG_RESULT([no])
2788 curl_cv_func_if_nametoindex="no"
2789 fi
2790])
2791
2792
2793dnl CURL_CHECK_FUNC_GETIFADDRS
2794dnl -------------------------------------------------
2795dnl Verify if getifaddrs is available, prototyped, can
2796dnl be compiled and seems to work. If all of these are
2797dnl true, and usage has not been previously disallowed
2798dnl with shell variable curl_disallow_getifaddrs, then
2799dnl HAVE_GETIFADDRS will be defined.
2800
2801AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [
2802 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
2803 AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl
2804 #
2805 tst_links_getifaddrs="unknown"
2806 tst_proto_getifaddrs="unknown"
2807 tst_compi_getifaddrs="unknown"
2808 tst_works_getifaddrs="unknown"
2809 tst_allow_getifaddrs="unknown"
2810 #
2811 AC_MSG_CHECKING([if getifaddrs can be linked])
2812 AC_LINK_IFELSE([
2813 AC_LANG_FUNC_LINK_TRY([getifaddrs])
2814 ],[
2815 AC_MSG_RESULT([yes])
2816 tst_links_getifaddrs="yes"
2817 ],[
2818 AC_MSG_RESULT([no])
2819 tst_links_getifaddrs="no"
2820 ])
2821 #
2822 if test "$tst_links_getifaddrs" = "yes"; then
2823 AC_MSG_CHECKING([if getifaddrs is prototyped])
2824 AC_EGREP_CPP([getifaddrs],[
2825 $curl_includes_ifaddrs
2826 ],[
2827 AC_MSG_RESULT([yes])
2828 tst_proto_getifaddrs="yes"
2829 ],[
2830 AC_MSG_RESULT([no])
2831 tst_proto_getifaddrs="no"
2832 ])
2833 fi
2834 #
2835 if test "$tst_proto_getifaddrs" = "yes"; then
2836 AC_MSG_CHECKING([if getifaddrs is compilable])
2837 AC_COMPILE_IFELSE([
2838 AC_LANG_PROGRAM([[
2839 $curl_includes_ifaddrs
2840 ]],[[
2841 if(0 != getifaddrs(0))
2842 return 1;
2843 ]])
2844 ],[
2845 AC_MSG_RESULT([yes])
2846 tst_compi_getifaddrs="yes"
2847 ],[
2848 AC_MSG_RESULT([no])
2849 tst_compi_getifaddrs="no"
2850 ])
2851 fi
2852 #
2853 dnl only do runtime verification when not cross-compiling
2854 if test "x$cross_compiling" != "xyes" &&
2855 test "$tst_compi_getifaddrs" = "yes"; then
2856 AC_MSG_CHECKING([if getifaddrs seems to work])
2857 CURL_RUN_IFELSE([
2858 AC_LANG_PROGRAM([[
2859 $curl_includes_stdlib
2860 $curl_includes_ifaddrs
2861 ]],[[
2862 struct ifaddrs *ifa = 0;
2863 int error;
2864
2865 error = getifaddrs(&ifa);
2866 if(error || !ifa)
2867 exit(1); /* fail */
2868 else
2869 exit(0);
2870 ]])
2871 ],[
2872 AC_MSG_RESULT([yes])
2873 tst_works_getifaddrs="yes"
2874 ],[
2875 AC_MSG_RESULT([no])
2876 tst_works_getifaddrs="no"
2877 ])
2878 fi
2879 #
2880 if test "$tst_compi_getifaddrs" = "yes" &&
2881 test "$tst_works_getifaddrs" != "no"; then
2882 AC_MSG_CHECKING([if getifaddrs usage allowed])
2883 if test "x$curl_disallow_getifaddrs" != "xyes"; then
2884 AC_MSG_RESULT([yes])
2885 tst_allow_getifaddrs="yes"
2886 else
2887 AC_MSG_RESULT([no])
2888 tst_allow_getifaddrs="no"
2889 fi
2890 fi
2891 #
2892 AC_MSG_CHECKING([if getifaddrs might be used])
2893 if test "$tst_links_getifaddrs" = "yes" &&
2894 test "$tst_proto_getifaddrs" = "yes" &&
2895 test "$tst_compi_getifaddrs" = "yes" &&
2896 test "$tst_allow_getifaddrs" = "yes" &&
2897 test "$tst_works_getifaddrs" != "no"; then
2898 AC_MSG_RESULT([yes])
2899 AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1,
2900 [Define to 1 if you have a working getifaddrs function.])
2901 curl_cv_func_getifaddrs="yes"
2902 else
2903 AC_MSG_RESULT([no])
2904 curl_cv_func_getifaddrs="no"
2905 fi
2906])
2907
2908
2909dnl CURL_CHECK_FUNC_GETXATTR
2910dnl -------------------------------------------------
2911dnl Verify if getxattr is available, prototyped, and
2912dnl can be compiled. If all of these are true, and
2913dnl usage has not been previously disallowed with
2914dnl shell variable curl_disallow_getxattr, then
2915dnl HAVE_GETXATTR will be defined.
2916
2917AC_DEFUN([CURL_CHECK_FUNC_GETXATTR], [
2918 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
2919 #
2920 tst_links_getxattr="unknown"
2921 tst_proto_getxattr="unknown"
2922 tst_compi_getxattr="unknown"
2923 tst_allow_getxattr="unknown"
2924 tst_nargs_getxattr="unknown"
2925 #
2926 AC_MSG_CHECKING([if getxattr can be linked])
2927 AC_LINK_IFELSE([
2928 AC_LANG_FUNC_LINK_TRY([getxattr])
2929 ],[
2930 AC_MSG_RESULT([yes])
2931 tst_links_getxattr="yes"
2932 ],[
2933 AC_MSG_RESULT([no])
2934 tst_links_getxattr="no"
2935 ])
2936 #
2937 if test "$tst_links_getxattr" = "yes"; then
2938 AC_MSG_CHECKING([if getxattr is prototyped])
2939 AC_EGREP_CPP([getxattr],[
2940 $curl_includes_sys_xattr
2941 ],[
2942 AC_MSG_RESULT([yes])
2943 tst_proto_getxattr="yes"
2944 ],[
2945 AC_MSG_RESULT([no])
2946 tst_proto_getxattr="no"
2947 ])
2948 fi
2949 #
2950 if test "$tst_proto_getxattr" = "yes"; then
2951 if test "$tst_nargs_getxattr" = "unknown"; then
2952 AC_MSG_CHECKING([if getxattr takes 4 args.])
2953 AC_COMPILE_IFELSE([
2954 AC_LANG_PROGRAM([[
2955 $curl_includes_sys_xattr
2956 ]],[[
2957 if(0 != getxattr(0, 0, 0, 0))
2958 return 1;
2959 ]])
2960 ],[
2961 AC_MSG_RESULT([yes])
2962 tst_compi_getxattr="yes"
2963 tst_nargs_getxattr="4"
2964 ],[
2965 AC_MSG_RESULT([no])
2966 tst_compi_getxattr="no"
2967 ])
2968 fi
2969 if test "$tst_nargs_getxattr" = "unknown"; then
2970 AC_MSG_CHECKING([if getxattr takes 6 args.])
2971 AC_COMPILE_IFELSE([
2972 AC_LANG_PROGRAM([[
2973 $curl_includes_sys_xattr
2974 ]],[[
2975 if(0 != getxattr(0, 0, 0, 0, 0, 0))
2976 return 1;
2977 ]])
2978 ],[
2979 AC_MSG_RESULT([yes])
2980 tst_compi_getxattr="yes"
2981 tst_nargs_getxattr="6"
2982 ],[
2983 AC_MSG_RESULT([no])
2984 tst_compi_getxattr="no"
2985 ])
2986 fi
2987 AC_MSG_CHECKING([if getxattr is compilable])
2988 if test "$tst_compi_getxattr" = "yes"; then
2989 AC_MSG_RESULT([yes])
2990 else
2991 AC_MSG_RESULT([no])
2992 fi
2993 fi
2994 #
2995 if test "$tst_compi_getxattr" = "yes"; then
2996 AC_MSG_CHECKING([if getxattr usage allowed])
2997 if test "x$curl_disallow_getxattr" != "xyes"; then
2998 AC_MSG_RESULT([yes])
2999 tst_allow_getxattr="yes"
3000 else
3001 AC_MSG_RESULT([no])
3002 tst_allow_getxattr="no"
3003 fi
3004 fi
3005 #
3006 AC_MSG_CHECKING([if getxattr might be used])
3007 if test "$tst_links_getxattr" = "yes" &&
3008 test "$tst_proto_getxattr" = "yes" &&
3009 test "$tst_compi_getxattr" = "yes" &&
3010 test "$tst_allow_getxattr" = "yes"; then
3011 AC_MSG_RESULT([yes])
3012 AC_DEFINE_UNQUOTED(HAVE_GETXATTR, 1,
3013 [Define to 1 if you have the getxattr function.])
3014 dnl AC_DEFINE_UNQUOTED(GETXATTR_ARGS, $tst_nargs_getxattr,
3015 dnl [Specifies the number of arguments to getxattr])
3016 #
3017 if test "$tst_nargs_getxattr" -eq "4"; then
3018 AC_DEFINE(HAVE_GETXATTR_4, 1, [getxattr() takes 4 args])
3019 elif test "$tst_nargs_getxattr" -eq "6"; then
3020 AC_DEFINE(HAVE_GETXATTR_6, 1, [getxattr() takes 6 args])
3021 fi
3022 #
3023 curl_cv_func_getxattr="yes"
3024 else
3025 AC_MSG_RESULT([no])
3026 curl_cv_func_getxattr="no"
3027 fi
3028])
3029
3030
3031dnl CURL_CHECK_FUNC_GMTIME_R
3032dnl -------------------------------------------------
3033dnl Verify if gmtime_r is available, prototyped, can
3034dnl be compiled and seems to work. If all of these are
3035dnl true, and usage has not been previously disallowed
3036dnl with shell variable curl_disallow_gmtime_r, then
3037dnl HAVE_GMTIME_R will be defined.
3038
3039AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
3040 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
3041 AC_REQUIRE([CURL_INCLUDES_TIME])dnl
3042 #
3043 tst_links_gmtime_r="unknown"
3044 tst_proto_gmtime_r="unknown"
3045 tst_compi_gmtime_r="unknown"
3046 tst_works_gmtime_r="unknown"
3047 tst_allow_gmtime_r="unknown"
3048 #
3049 AC_MSG_CHECKING([if gmtime_r can be linked])
3050 AC_LINK_IFELSE([
3051 AC_LANG_FUNC_LINK_TRY([gmtime_r])
3052 ],[
3053 AC_MSG_RESULT([yes])
3054 tst_links_gmtime_r="yes"
3055 ],[
3056 AC_MSG_RESULT([no])
3057 tst_links_gmtime_r="no"
3058 ])
3059 #
3060 if test "$tst_links_gmtime_r" = "yes"; then
3061 AC_MSG_CHECKING([if gmtime_r is prototyped])
3062 AC_EGREP_CPP([gmtime_r],[
3063 $curl_includes_time
3064 ],[
3065 AC_MSG_RESULT([yes])
3066 tst_proto_gmtime_r="yes"
3067 ],[
3068 AC_MSG_RESULT([no])
3069 tst_proto_gmtime_r="no"
3070 ])
3071 fi
3072 #
3073 if test "$tst_proto_gmtime_r" = "yes"; then
3074 AC_MSG_CHECKING([if gmtime_r is compilable])
3075 AC_COMPILE_IFELSE([
3076 AC_LANG_PROGRAM([[
3077 $curl_includes_time
3078 ]],[[
3079 if(0 != gmtime_r(0, 0))
3080 return 1;
3081 ]])
3082 ],[
3083 AC_MSG_RESULT([yes])
3084 tst_compi_gmtime_r="yes"
3085 ],[
3086 AC_MSG_RESULT([no])
3087 tst_compi_gmtime_r="no"
3088 ])
3089 fi
3090 #
3091 dnl only do runtime verification when not cross-compiling
3092 if test "x$cross_compiling" != "xyes" &&
3093 test "$tst_compi_gmtime_r" = "yes"; then
3094 AC_MSG_CHECKING([if gmtime_r seems to work])
3095 CURL_RUN_IFELSE([
3096 AC_LANG_PROGRAM([[
3097 $curl_includes_stdlib
3098 $curl_includes_time
3099 ]],[[
3100 time_t local = 1170352587;
3101 struct tm *gmt = 0;
3102 struct tm result;
3103 gmt = gmtime_r(&local, &result);
3104 if(gmt)
3105 exit(0);
3106 else
3107 exit(1);
3108 ]])
3109 ],[
3110 AC_MSG_RESULT([yes])
3111 tst_works_gmtime_r="yes"
3112 ],[
3113 AC_MSG_RESULT([no])
3114 tst_works_gmtime_r="no"
3115 ])
3116 fi
3117 #
3118 if test "$tst_compi_gmtime_r" = "yes" &&
3119 test "$tst_works_gmtime_r" != "no"; then
3120 AC_MSG_CHECKING([if gmtime_r usage allowed])
3121 if test "x$curl_disallow_gmtime_r" != "xyes"; then
3122 AC_MSG_RESULT([yes])
3123 tst_allow_gmtime_r="yes"
3124 else
3125 AC_MSG_RESULT([no])
3126 tst_allow_gmtime_r="no"
3127 fi
3128 fi
3129 #
3130 AC_MSG_CHECKING([if gmtime_r might be used])
3131 if test "$tst_links_gmtime_r" = "yes" &&
3132 test "$tst_proto_gmtime_r" = "yes" &&
3133 test "$tst_compi_gmtime_r" = "yes" &&
3134 test "$tst_allow_gmtime_r" = "yes" &&
3135 test "$tst_works_gmtime_r" != "no"; then
3136 AC_MSG_RESULT([yes])
3137 AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
3138 [Define to 1 if you have a working gmtime_r function.])
3139 curl_cv_func_gmtime_r="yes"
3140 else
3141 AC_MSG_RESULT([no])
3142 curl_cv_func_gmtime_r="no"
3143 fi
3144])
3145
3146
3147dnl CURL_CHECK_FUNC_INET_NTOP
3148dnl -------------------------------------------------
3149dnl Verify if inet_ntop is available, prototyped, can
3150dnl be compiled and seems to work. If all of these are
3151dnl true, and usage has not been previously disallowed
3152dnl with shell variable curl_disallow_inet_ntop, then
3153dnl HAVE_INET_NTOP will be defined.
3154
3155AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
3156 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
3157 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
3158 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
3159 #
3160 tst_links_inet_ntop="unknown"
3161 tst_proto_inet_ntop="unknown"
3162 tst_compi_inet_ntop="unknown"
3163 tst_works_inet_ntop="unknown"
3164 tst_allow_inet_ntop="unknown"
3165 #
3166 AC_MSG_CHECKING([if inet_ntop can be linked])
3167 AC_LINK_IFELSE([
3168 AC_LANG_FUNC_LINK_TRY([inet_ntop])
3169 ],[
3170 AC_MSG_RESULT([yes])
3171 tst_links_inet_ntop="yes"
3172 ],[
3173 AC_MSG_RESULT([no])
3174 tst_links_inet_ntop="no"
3175 ])
3176 #
3177 if test "$tst_links_inet_ntop" = "yes"; then
3178 AC_MSG_CHECKING([if inet_ntop is prototyped])
3179 AC_EGREP_CPP([inet_ntop],[
3180 $curl_includes_arpa_inet
3181 ],[
3182 AC_MSG_RESULT([yes])
3183 tst_proto_inet_ntop="yes"
3184 ],[
3185 AC_MSG_RESULT([no])
3186 tst_proto_inet_ntop="no"
3187 ])
3188 fi
3189 #
3190 if test "$tst_proto_inet_ntop" = "yes"; then
3191 AC_MSG_CHECKING([if inet_ntop is compilable])
3192 AC_COMPILE_IFELSE([
3193 AC_LANG_PROGRAM([[
3194 $curl_includes_arpa_inet
3195 ]],[[
3196 if(0 != inet_ntop(0, 0, 0, 0))
3197 return 1;
3198 ]])
3199 ],[
3200 AC_MSG_RESULT([yes])
3201 tst_compi_inet_ntop="yes"
3202 ],[
3203 AC_MSG_RESULT([no])
3204 tst_compi_inet_ntop="no"
3205 ])
3206 fi
3207 #
3208 dnl only do runtime verification when not cross-compiling
3209 if test "x$cross_compiling" != "xyes" &&
3210 test "$tst_compi_inet_ntop" = "yes"; then
3211 AC_MSG_CHECKING([if inet_ntop seems to work])
3212 CURL_RUN_IFELSE([
3213 AC_LANG_PROGRAM([[
3214 $curl_includes_stdlib
3215 $curl_includes_arpa_inet
3216 $curl_includes_string
3217 ]],[[
3218 char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
3219 char ipv4res[sizeof "255.255.255.255"];
3220 unsigned char ipv6a[26];
3221 unsigned char ipv4a[5];
3222 char *ipv6ptr = 0;
3223 char *ipv4ptr = 0;
3224 /* - */
3225 ipv4res[0] = '\0';
3226 ipv4a[0] = 0xc0;
3227 ipv4a[1] = 0xa8;
3228 ipv4a[2] = 0x64;
3229 ipv4a[3] = 0x01;
3230 ipv4a[4] = 0x01;
3231 /* - */
3232 ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
3233 if(!ipv4ptr)
3234 exit(1); /* fail */
3235 if(ipv4ptr != ipv4res)
3236 exit(1); /* fail */
3237 if(!ipv4ptr[0])
3238 exit(1); /* fail */
3239 if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
3240 exit(1); /* fail */
3241 /* - */
3242 ipv6res[0] = '\0';
3243 memset(ipv6a, 0, sizeof(ipv6a));
3244 ipv6a[0] = 0xfe;
3245 ipv6a[1] = 0x80;
3246 ipv6a[8] = 0x02;
3247 ipv6a[9] = 0x14;
3248 ipv6a[10] = 0x4f;
3249 ipv6a[11] = 0xff;
3250 ipv6a[12] = 0xfe;
3251 ipv6a[13] = 0x0b;
3252 ipv6a[14] = 0x76;
3253 ipv6a[15] = 0xc8;
3254 ipv6a[25] = 0x01;
3255 /* - */
3256 ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
3257 if(!ipv6ptr)
3258 exit(1); /* fail */
3259 if(ipv6ptr != ipv6res)
3260 exit(1); /* fail */
3261 if(!ipv6ptr[0])
3262 exit(1); /* fail */
3263 if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
3264 exit(1); /* fail */
3265 /* - */
3266 exit(0);
3267 ]])
3268 ],[
3269 AC_MSG_RESULT([yes])
3270 tst_works_inet_ntop="yes"
3271 ],[
3272 AC_MSG_RESULT([no])
3273 tst_works_inet_ntop="no"
3274 ])
3275 fi
3276 #
3277 if test "$tst_compi_inet_ntop" = "yes" &&
3278 test "$tst_works_inet_ntop" != "no"; then
3279 AC_MSG_CHECKING([if inet_ntop usage allowed])
3280 if test "x$curl_disallow_inet_ntop" != "xyes"; then
3281 AC_MSG_RESULT([yes])
3282 tst_allow_inet_ntop="yes"
3283 else
3284 AC_MSG_RESULT([no])
3285 tst_allow_inet_ntop="no"
3286 fi
3287 fi
3288 #
3289 AC_MSG_CHECKING([if inet_ntop might be used])
3290 if test "$tst_links_inet_ntop" = "yes" &&
3291 test "$tst_proto_inet_ntop" = "yes" &&
3292 test "$tst_compi_inet_ntop" = "yes" &&
3293 test "$tst_allow_inet_ntop" = "yes" &&
3294 test "$tst_works_inet_ntop" != "no"; then
3295 AC_MSG_RESULT([yes])
3296 AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
3297 [Define to 1 if you have a IPv6 capable working inet_ntop function.])
3298 curl_cv_func_inet_ntop="yes"
3299 else
3300 AC_MSG_RESULT([no])
3301 curl_cv_func_inet_ntop="no"
3302 fi
3303])
3304
3305
3306dnl CURL_CHECK_FUNC_INET_PTON
3307dnl -------------------------------------------------
3308dnl Verify if inet_pton is available, prototyped, can
3309dnl be compiled and seems to work. If all of these are
3310dnl true, and usage has not been previously disallowed
3311dnl with shell variable curl_disallow_inet_pton, then
3312dnl HAVE_INET_PTON will be defined.
3313
3314AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
3315 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
3316 AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
3317 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
3318 #
3319 tst_links_inet_pton="unknown"
3320 tst_proto_inet_pton="unknown"
3321 tst_compi_inet_pton="unknown"
3322 tst_works_inet_pton="unknown"
3323 tst_allow_inet_pton="unknown"
3324 #
3325 AC_MSG_CHECKING([if inet_pton can be linked])
3326 AC_LINK_IFELSE([
3327 AC_LANG_FUNC_LINK_TRY([inet_pton])
3328 ],[
3329 AC_MSG_RESULT([yes])
3330 tst_links_inet_pton="yes"
3331 ],[
3332 AC_MSG_RESULT([no])
3333 tst_links_inet_pton="no"
3334 ])
3335 #
3336 if test "$tst_links_inet_pton" = "yes"; then
3337 AC_MSG_CHECKING([if inet_pton is prototyped])
3338 AC_EGREP_CPP([inet_pton],[
3339 $curl_includes_arpa_inet
3340 ],[
3341 AC_MSG_RESULT([yes])
3342 tst_proto_inet_pton="yes"
3343 ],[
3344 AC_MSG_RESULT([no])
3345 tst_proto_inet_pton="no"
3346 ])
3347 fi
3348 #
3349 if test "$tst_proto_inet_pton" = "yes"; then
3350 AC_MSG_CHECKING([if inet_pton is compilable])
3351 AC_COMPILE_IFELSE([
3352 AC_LANG_PROGRAM([[
3353 $curl_includes_arpa_inet
3354 ]],[[
3355 if(0 != inet_pton(0, 0, 0))
3356 return 1;
3357 ]])
3358 ],[
3359 AC_MSG_RESULT([yes])
3360 tst_compi_inet_pton="yes"
3361 ],[
3362 AC_MSG_RESULT([no])
3363 tst_compi_inet_pton="no"
3364 ])
3365 fi
3366 #
3367 dnl only do runtime verification when not cross-compiling
3368 if test "x$cross_compiling" != "xyes" &&
3369 test "$tst_compi_inet_pton" = "yes"; then
3370 AC_MSG_CHECKING([if inet_pton seems to work])
3371 CURL_RUN_IFELSE([
3372 AC_LANG_PROGRAM([[
3373 $curl_includes_stdlib
3374 $curl_includes_arpa_inet
3375 $curl_includes_string
3376 ]],[[
3377 unsigned char ipv6a[16+1];
3378 unsigned char ipv4a[4+1];
3379 const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
3380 const char *ipv4src = "192.168.100.1";
3381 /* - */
3382 memset(ipv4a, 1, sizeof(ipv4a));
3383 if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
3384 exit(1); /* fail */
3385 /* - */
3386 if( (ipv4a[0] != 0xc0) ||
3387 (ipv4a[1] != 0xa8) ||
3388 (ipv4a[2] != 0x64) ||
3389 (ipv4a[3] != 0x01) ||
3390 (ipv4a[4] != 0x01) )
3391 exit(1); /* fail */
3392 /* - */
3393 memset(ipv6a, 1, sizeof(ipv6a));
3394 if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
3395 exit(1); /* fail */
3396 /* - */
3397 if( (ipv6a[0] != 0xfe) ||
3398 (ipv6a[1] != 0x80) ||
3399 (ipv6a[8] != 0x02) ||
3400 (ipv6a[9] != 0x14) ||
3401 (ipv6a[10] != 0x4f) ||
3402 (ipv6a[11] != 0xff) ||
3403 (ipv6a[12] != 0xfe) ||
3404 (ipv6a[13] != 0x0b) ||
3405 (ipv6a[14] != 0x76) ||
3406 (ipv6a[15] != 0xc8) ||
3407 (ipv6a[16] != 0x01) )
3408 exit(1); /* fail */
3409 /* - */
3410 if( (ipv6a[2] != 0x0) ||
3411 (ipv6a[3] != 0x0) ||
3412 (ipv6a[4] != 0x0) ||
3413 (ipv6a[5] != 0x0) ||
3414 (ipv6a[6] != 0x0) ||
3415 (ipv6a[7] != 0x0) )
3416 exit(1); /* fail */
3417 /* - */
3418 exit(0);
3419 ]])
3420 ],[
3421 AC_MSG_RESULT([yes])
3422 tst_works_inet_pton="yes"
3423 ],[
3424 AC_MSG_RESULT([no])
3425 tst_works_inet_pton="no"
3426 ])
3427 fi
3428 #
3429 if test "$tst_compi_inet_pton" = "yes" &&
3430 test "$tst_works_inet_pton" != "no"; then
3431 AC_MSG_CHECKING([if inet_pton usage allowed])
3432 if test "x$curl_disallow_inet_pton" != "xyes"; then
3433 AC_MSG_RESULT([yes])
3434 tst_allow_inet_pton="yes"
3435 else
3436 AC_MSG_RESULT([no])
3437 tst_allow_inet_pton="no"
3438 fi
3439 fi
3440 #
3441 AC_MSG_CHECKING([if inet_pton might be used])
3442 if test "$tst_links_inet_pton" = "yes" &&
3443 test "$tst_proto_inet_pton" = "yes" &&
3444 test "$tst_compi_inet_pton" = "yes" &&
3445 test "$tst_allow_inet_pton" = "yes" &&
3446 test "$tst_works_inet_pton" != "no"; then
3447 AC_MSG_RESULT([yes])
3448 AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
3449 [Define to 1 if you have a IPv6 capable working inet_pton function.])
3450 curl_cv_func_inet_pton="yes"
3451 else
3452 AC_MSG_RESULT([no])
3453 curl_cv_func_inet_pton="no"
3454 fi
3455])
3456
3457
3458dnl CURL_CHECK_FUNC_IOCTL_FIONBIO
3459dnl -------------------------------------------------
3460dnl Verify if ioctl with the FIONBIO command is
3461dnl available, can be compiled, and seems to work. If
3462dnl all of these are true, then HAVE_IOCTL_FIONBIO
3463dnl will be defined.
3464
3465AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [
3466 #
3467 tst_compi_ioctl_fionbio="unknown"
3468 tst_allow_ioctl_fionbio="unknown"
3469 #
3470 if test "$curl_cv_func_ioctl" = "yes"; then
3471 AC_MSG_CHECKING([if ioctl FIONBIO is compilable])
3472 AC_COMPILE_IFELSE([
3473 AC_LANG_PROGRAM([[
3474 $curl_includes_stropts
3475 ]],[[
3476 int flags = 0;
3477 if(0 != ioctl(0, FIONBIO, &flags))
3478 return 1;
3479 ]])
3480 ],[
3481 AC_MSG_RESULT([yes])
3482 tst_compi_ioctl_fionbio="yes"
3483 ],[
3484 AC_MSG_RESULT([no])
3485 tst_compi_ioctl_fionbio="no"
3486 ])
3487 fi
3488 #
3489 if test "$tst_compi_ioctl_fionbio" = "yes"; then
3490 AC_MSG_CHECKING([if ioctl FIONBIO usage allowed])
3491 if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then
3492 AC_MSG_RESULT([yes])
3493 tst_allow_ioctl_fionbio="yes"
3494 else
3495 AC_MSG_RESULT([no])
3496 tst_allow_ioctl_fionbio="no"
3497 fi
3498 fi
3499 #
3500 AC_MSG_CHECKING([if ioctl FIONBIO might be used])
3501 if test "$tst_compi_ioctl_fionbio" = "yes" &&
3502 test "$tst_allow_ioctl_fionbio" = "yes"; then
3503 AC_MSG_RESULT([yes])
3504 AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1,
3505 [Define to 1 if you have a working ioctl FIONBIO function.])
3506 curl_cv_func_ioctl_fionbio="yes"
3507 else
3508 AC_MSG_RESULT([no])
3509 curl_cv_func_ioctl_fionbio="no"
3510 fi
3511])
3512
3513
3514dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
3515dnl -------------------------------------------------
3516dnl Verify if ioctl with the SIOCGIFADDR command is available,
3517dnl struct ifreq is defined, they can be compiled, and seem to
3518dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR
3519dnl will be defined.
3520
3521AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [
3522 #
3523 tst_compi_ioctl_siocgifaddr="unknown"
3524 tst_allow_ioctl_siocgifaddr="unknown"
3525 #
3526 if test "$curl_cv_func_ioctl" = "yes"; then
3527 AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable])
3528 AC_COMPILE_IFELSE([
3529 AC_LANG_PROGRAM([[
3530 $curl_includes_stropts
3531 #include <net/if.h>
3532 ]],[[
3533 struct ifreq ifr;
3534 if(0 != ioctl(0, SIOCGIFADDR, &ifr))
3535 return 1;
3536 ]])
3537 ],[
3538 AC_MSG_RESULT([yes])
3539 tst_compi_ioctl_siocgifaddr="yes"
3540 ],[
3541 AC_MSG_RESULT([no])
3542 tst_compi_ioctl_siocgifaddr="no"
3543 ])
3544 fi
3545 #
3546 if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then
3547 AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed])
3548 if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then
3549 AC_MSG_RESULT([yes])
3550 tst_allow_ioctl_siocgifaddr="yes"
3551 else
3552 AC_MSG_RESULT([no])
3553 tst_allow_ioctl_siocgifaddr="no"
3554 fi
3555 fi
3556 #
3557 AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used])
3558 if test "$tst_compi_ioctl_siocgifaddr" = "yes" &&
3559 test "$tst_allow_ioctl_siocgifaddr" = "yes"; then
3560 AC_MSG_RESULT([yes])
3561 AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1,
3562 [Define to 1 if you have a working ioctl SIOCGIFADDR function.])
3563 curl_cv_func_ioctl_siocgifaddr="yes"
3564 else
3565 AC_MSG_RESULT([no])
3566 curl_cv_func_ioctl_siocgifaddr="no"
3567 fi
3568])
3569
3570
3571dnl CURL_CHECK_FUNC_IOCTLSOCKET
3572dnl -------------------------------------------------
3573dnl Verify if ioctlsocket is available, prototyped, and
3574dnl can be compiled. If all of these are true, and
3575dnl usage has not been previously disallowed with
3576dnl shell variable curl_disallow_ioctlsocket, then
3577dnl HAVE_IOCTLSOCKET will be defined.
3578
3579AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [
3580 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
3581 #
3582 tst_links_ioctlsocket="unknown"
3583 tst_proto_ioctlsocket="unknown"
3584 tst_compi_ioctlsocket="unknown"
3585 tst_allow_ioctlsocket="unknown"
3586 #
3587 AC_MSG_CHECKING([if ioctlsocket can be linked])
3588 AC_LINK_IFELSE([
3589 AC_LANG_PROGRAM([[
3590 $curl_includes_winsock2
3591 ]],[[
3592 if(0 != ioctlsocket(0, 0, 0))
3593 return 1;
3594 ]])
3595 ],[
3596 AC_MSG_RESULT([yes])
3597 tst_links_ioctlsocket="yes"
3598 ],[
3599 AC_MSG_RESULT([no])
3600 tst_links_ioctlsocket="no"
3601 ])
3602 #
3603 if test "$tst_links_ioctlsocket" = "yes"; then
3604 AC_MSG_CHECKING([if ioctlsocket is prototyped])
3605 AC_EGREP_CPP([ioctlsocket],[
3606 $curl_includes_winsock2
3607 ],[
3608 AC_MSG_RESULT([yes])
3609 tst_proto_ioctlsocket="yes"
3610 ],[
3611 AC_MSG_RESULT([no])
3612 tst_proto_ioctlsocket="no"
3613 ])
3614 fi
3615 #
3616 if test "$tst_proto_ioctlsocket" = "yes"; then
3617 AC_MSG_CHECKING([if ioctlsocket is compilable])
3618 AC_COMPILE_IFELSE([
3619 AC_LANG_PROGRAM([[
3620 $curl_includes_winsock2
3621 ]],[[
3622 if(0 != ioctlsocket(0, 0, 0))
3623 return 1;
3624 ]])
3625 ],[
3626 AC_MSG_RESULT([yes])
3627 tst_compi_ioctlsocket="yes"
3628 ],[
3629 AC_MSG_RESULT([no])
3630 tst_compi_ioctlsocket="no"
3631 ])
3632 fi
3633 #
3634 if test "$tst_compi_ioctlsocket" = "yes"; then
3635 AC_MSG_CHECKING([if ioctlsocket usage allowed])
3636 if test "x$curl_disallow_ioctlsocket" != "xyes"; then
3637 AC_MSG_RESULT([yes])
3638 tst_allow_ioctlsocket="yes"
3639 else
3640 AC_MSG_RESULT([no])
3641 tst_allow_ioctlsocket="no"
3642 fi
3643 fi
3644 #
3645 AC_MSG_CHECKING([if ioctlsocket might be used])
3646 if test "$tst_links_ioctlsocket" = "yes" &&
3647 test "$tst_proto_ioctlsocket" = "yes" &&
3648 test "$tst_compi_ioctlsocket" = "yes" &&
3649 test "$tst_allow_ioctlsocket" = "yes"; then
3650 AC_MSG_RESULT([yes])
3651 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1,
3652 [Define to 1 if you have the ioctlsocket function.])
3653 curl_cv_func_ioctlsocket="yes"
3654 CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
3655 else
3656 AC_MSG_RESULT([no])
3657 curl_cv_func_ioctlsocket="no"
3658 fi
3659])
3660
3661
3662dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
3663dnl -------------------------------------------------
3664dnl Verify if ioctlsocket with the FIONBIO command is
3665dnl available, can be compiled, and seems to work. If
3666dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO
3667dnl will be defined.
3668
3669AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [
3670 #
3671 tst_compi_ioctlsocket_fionbio="unknown"
3672 tst_allow_ioctlsocket_fionbio="unknown"
3673 #
3674 if test "$curl_cv_func_ioctlsocket" = "yes"; then
3675 AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable])
3676 AC_COMPILE_IFELSE([
3677 AC_LANG_PROGRAM([[
3678 $curl_includes_winsock2
3679 ]],[[
3680 int flags = 0;
3681 if(0 != ioctlsocket(0, FIONBIO, &flags))
3682 return 1;
3683 ]])
3684 ],[
3685 AC_MSG_RESULT([yes])
3686 tst_compi_ioctlsocket_fionbio="yes"
3687 ],[
3688 AC_MSG_RESULT([no])
3689 tst_compi_ioctlsocket_fionbio="no"
3690 ])
3691 fi
3692 #
3693 if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then
3694 AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed])
3695 if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then
3696 AC_MSG_RESULT([yes])
3697 tst_allow_ioctlsocket_fionbio="yes"
3698 else
3699 AC_MSG_RESULT([no])
3700 tst_allow_ioctlsocket_fionbio="no"
3701 fi
3702 fi
3703 #
3704 AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used])
3705 if test "$tst_compi_ioctlsocket_fionbio" = "yes" &&
3706 test "$tst_allow_ioctlsocket_fionbio" = "yes"; then
3707 AC_MSG_RESULT([yes])
3708 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1,
3709 [Define to 1 if you have a working ioctlsocket FIONBIO function.])
3710 curl_cv_func_ioctlsocket_fionbio="yes"
3711 else
3712 AC_MSG_RESULT([no])
3713 curl_cv_func_ioctlsocket_fionbio="no"
3714 fi
3715])
3716
3717
3718dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
3719dnl -------------------------------------------------
3720dnl Verify if IoctlSocket is available, prototyped, and
3721dnl can be compiled. If all of these are true, and
3722dnl usage has not been previously disallowed with
3723dnl shell variable curl_disallow_ioctlsocket_camel,
3724dnl then HAVE_IOCTLSOCKET_CAMEL will be defined.
3725
3726AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
3727 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
3728 #
3729 tst_links_ioctlsocket_camel="unknown"
3730 tst_proto_ioctlsocket_camel="unknown"
3731 tst_compi_ioctlsocket_camel="unknown"
3732 tst_allow_ioctlsocket_camel="unknown"
3733 #
3734 AC_MSG_CHECKING([if IoctlSocket can be linked])
3735 AC_LINK_IFELSE([
3736 AC_LANG_PROGRAM([[
3737 $curl_includes_bsdsocket
3738 ]],[[
3739 IoctlSocket(0, 0, 0);
3740 ]])
3741 ],[
3742 AC_MSG_RESULT([yes])
3743 tst_links_ioctlsocket_camel="yes"
3744 ],[
3745 AC_MSG_RESULT([no])
3746 tst_links_ioctlsocket_camel="no"
3747 ])
3748 #
3749 if test "$tst_links_ioctlsocket_camel" = "yes"; then
3750 AC_MSG_CHECKING([if IoctlSocket is prototyped])
3751 AC_EGREP_CPP([IoctlSocket],[
3752 $curl_includes_bsdsocket
3753 ],[
3754 AC_MSG_RESULT([yes])
3755 tst_proto_ioctlsocket_camel="yes"
3756 ],[
3757 AC_MSG_RESULT([no])
3758 tst_proto_ioctlsocket_camel="no"
3759 ])
3760 fi
3761 #
3762 if test "$tst_proto_ioctlsocket_camel" = "yes"; then
3763 AC_MSG_CHECKING([if IoctlSocket is compilable])
3764 AC_COMPILE_IFELSE([
3765 AC_LANG_PROGRAM([[
3766 $curl_includes_bsdsocket
3767 ]],[[
3768 if(0 != IoctlSocket(0, 0, 0))
3769 return 1;
3770 ]])
3771 ],[
3772 AC_MSG_RESULT([yes])
3773 tst_compi_ioctlsocket_camel="yes"
3774 ],[
3775 AC_MSG_RESULT([no])
3776 tst_compi_ioctlsocket_camel="no"
3777 ])
3778 fi
3779 #
3780 if test "$tst_compi_ioctlsocket_camel" = "yes"; then
3781 AC_MSG_CHECKING([if IoctlSocket usage allowed])
3782 if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then
3783 AC_MSG_RESULT([yes])
3784 tst_allow_ioctlsocket_camel="yes"
3785 else
3786 AC_MSG_RESULT([no])
3787 tst_allow_ioctlsocket_camel="no"
3788 fi
3789 fi
3790 #
3791 AC_MSG_CHECKING([if IoctlSocket might be used])
3792 if test "$tst_links_ioctlsocket_camel" = "yes" &&
3793 test "$tst_proto_ioctlsocket_camel" = "yes" &&
3794 test "$tst_compi_ioctlsocket_camel" = "yes" &&
3795 test "$tst_allow_ioctlsocket_camel" = "yes"; then
3796 AC_MSG_RESULT([yes])
3797 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1,
3798 [Define to 1 if you have the IoctlSocket camel case function.])
3799 curl_cv_func_ioctlsocket_camel="yes"
3800 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
3801 else
3802 AC_MSG_RESULT([no])
3803 curl_cv_func_ioctlsocket_camel="no"
3804 fi
3805])
3806
3807
3808dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
3809dnl -------------------------------------------------
3810dnl Verify if IoctlSocket with FIONBIO command is available,
3811dnl can be compiled, and seems to work. If all of these are
3812dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined.
3813
3814AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [
3815 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
3816 #
3817 tst_compi_ioctlsocket_camel_fionbio="unknown"
3818 tst_allow_ioctlsocket_camel_fionbio="unknown"
3819 #
3820 if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then
3821 AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable])
3822 AC_COMPILE_IFELSE([
3823 AC_LANG_PROGRAM([[
3824 $curl_includes_bsdsocket
3825 ]],[[
3826 long flags = 0;
3827 if(0 != IoctlSocket(0, FIONBIO, &flags))
3828 return 1;
3829 ]])
3830 ],[
3831 AC_MSG_RESULT([yes])
3832 tst_compi_ioctlsocket_camel_fionbio="yes"
3833 ],[
3834 AC_MSG_RESULT([no])
3835 tst_compi_ioctlsocket_camel_fionbio="no"
3836 ])
3837 fi
3838 #
3839 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then
3840 AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed])
3841 if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then
3842 AC_MSG_RESULT([yes])
3843 tst_allow_ioctlsocket_camel_fionbio="yes"
3844 else
3845 AC_MSG_RESULT([no])
3846 tst_allow_ioctlsocket_camel_fionbio="no"
3847 fi
3848 fi
3849 #
3850 AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used])
3851 if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" &&
3852 test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then
3853 AC_MSG_RESULT([yes])
3854 AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1,
3855 [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.])
3856 curl_cv_func_ioctlsocket_camel_fionbio="yes"
3857 else
3858 AC_MSG_RESULT([no])
3859 curl_cv_func_ioctlsocket_camel_fionbio="no"
3860 fi
3861])
3862
3863
3864dnl CURL_CHECK_FUNC_LISTXATTR
3865dnl -------------------------------------------------
3866dnl Verify if listxattr is available, prototyped, and
3867dnl can be compiled. If all of these are true, and
3868dnl usage has not been previously disallowed with
3869dnl shell variable curl_disallow_listxattr, then
3870dnl HAVE_LISTXATTR will be defined.
3871
3872AC_DEFUN([CURL_CHECK_FUNC_LISTXATTR], [
3873 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
3874 #
3875 tst_links_listxattr="unknown"
3876 tst_proto_listxattr="unknown"
3877 tst_compi_listxattr="unknown"
3878 tst_allow_listxattr="unknown"
3879 tst_nargs_listxattr="unknown"
3880 #
3881 AC_MSG_CHECKING([if listxattr can be linked])
3882 AC_LINK_IFELSE([
3883 AC_LANG_FUNC_LINK_TRY([listxattr])
3884 ],[
3885 AC_MSG_RESULT([yes])
3886 tst_links_listxattr="yes"
3887 ],[
3888 AC_MSG_RESULT([no])
3889 tst_links_listxattr="no"
3890 ])
3891 #
3892 if test "$tst_links_listxattr" = "yes"; then
3893 AC_MSG_CHECKING([if listxattr is prototyped])
3894 AC_EGREP_CPP([listxattr],[
3895 $curl_includes_sys_xattr
3896 ],[
3897 AC_MSG_RESULT([yes])
3898 tst_proto_listxattr="yes"
3899 ],[
3900 AC_MSG_RESULT([no])
3901 tst_proto_listxattr="no"
3902 ])
3903 fi
3904 #
3905 if test "$tst_proto_listxattr" = "yes"; then
3906 if test "$tst_nargs_listxattr" = "unknown"; then
3907 AC_MSG_CHECKING([if listxattr takes 3 args.])
3908 AC_COMPILE_IFELSE([
3909 AC_LANG_PROGRAM([[
3910 $curl_includes_sys_xattr
3911 ]],[[
3912 if(0 != listxattr(0, 0, 0))
3913 return 1;
3914 ]])
3915 ],[
3916 AC_MSG_RESULT([yes])
3917 tst_compi_listxattr="yes"
3918 tst_nargs_listxattr="3"
3919 ],[
3920 AC_MSG_RESULT([no])
3921 tst_compi_listxattr="no"
3922 ])
3923 fi
3924 if test "$tst_nargs_listxattr" = "unknown"; then
3925 AC_MSG_CHECKING([if listxattr takes 4 args.])
3926 AC_COMPILE_IFELSE([
3927 AC_LANG_PROGRAM([[
3928 $curl_includes_sys_xattr
3929 ]],[[
3930 if(0 != listxattr(0, 0, 0, 0))
3931 return 1;
3932 ]])
3933 ],[
3934 AC_MSG_RESULT([yes])
3935 tst_compi_listxattr="yes"
3936 tst_nargs_listxattr="4"
3937 ],[
3938 AC_MSG_RESULT([no])
3939 tst_compi_listxattr="no"
3940 ])
3941 fi
3942 AC_MSG_CHECKING([if listxattr is compilable])
3943 if test "$tst_compi_listxattr" = "yes"; then
3944 AC_MSG_RESULT([yes])
3945 else
3946 AC_MSG_RESULT([no])
3947 fi
3948 fi
3949 #
3950 if test "$tst_compi_listxattr" = "yes"; then
3951 AC_MSG_CHECKING([if listxattr usage allowed])
3952 if test "x$curl_disallow_listxattr" != "xyes"; then
3953 AC_MSG_RESULT([yes])
3954 tst_allow_listxattr="yes"
3955 else
3956 AC_MSG_RESULT([no])
3957 tst_allow_listxattr="no"
3958 fi
3959 fi
3960 #
3961 AC_MSG_CHECKING([if listxattr might be used])
3962 if test "$tst_links_listxattr" = "yes" &&
3963 test "$tst_proto_listxattr" = "yes" &&
3964 test "$tst_compi_listxattr" = "yes" &&
3965 test "$tst_allow_listxattr" = "yes"; then
3966 AC_MSG_RESULT([yes])
3967 AC_DEFINE_UNQUOTED(HAVE_LISTXATTR, 1,
3968 [Define to 1 if you have the listxattr function.])
3969 dnl AC_DEFINE_UNQUOTED(LISTXATTR_ARGS, $tst_nargs_listxattr,
3970 dnl [Specifies the number of arguments to listxattr])
3971 #
3972 if test "$tst_nargs_listxattr" -eq "3"; then
3973 AC_DEFINE(HAVE_LISTXATTR_3, 1, [listxattr() takes 3 args])
3974 elif test "$tst_nargs_listxattr" -eq "4"; then
3975 AC_DEFINE(HAVE_LISTXATTR_4, 1, [listxattr() takes 4 args])
3976 fi
3977 #
3978 curl_cv_func_listxattr="yes"
3979 else
3980 AC_MSG_RESULT([no])
3981 curl_cv_func_listxattr="no"
3982 fi
3983])
3984
3985
3986dnl CURL_CHECK_FUNC_MEMRCHR
3987dnl -------------------------------------------------
3988dnl Verify if memrchr is available, prototyped, and
3989dnl can be compiled. If all of these are true, and
3990dnl usage has not been previously disallowed with
3991dnl shell variable curl_disallow_memrchr, then
3992dnl HAVE_MEMRCHR will be defined.
3993
3994AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [
3995 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
3996 #
3997 tst_links_memrchr="unknown"
3998 tst_macro_memrchr="unknown"
3999 tst_proto_memrchr="unknown"
4000 tst_compi_memrchr="unknown"
4001 tst_allow_memrchr="unknown"
4002 #
4003 AC_MSG_CHECKING([if memrchr can be linked])
4004 AC_LINK_IFELSE([
4005 AC_LANG_FUNC_LINK_TRY([memrchr])
4006 ],[
4007 AC_MSG_RESULT([yes])
4008 tst_links_memrchr="yes"
4009 ],[
4010 AC_MSG_RESULT([no])
4011 tst_links_memrchr="no"
4012 ])
4013 #
4014 if test "$tst_links_memrchr" = "no"; then
4015 AC_MSG_CHECKING([if memrchr seems a macro])
4016 AC_LINK_IFELSE([
4017 AC_LANG_PROGRAM([[
4018 $curl_includes_string
4019 ]],[[
4020 if(0 != memrchr(0, 0, 0))
4021 return 1;
4022 ]])
4023 ],[
4024 AC_MSG_RESULT([yes])
4025 tst_macro_memrchr="yes"
4026 ],[
4027 AC_MSG_RESULT([no])
4028 tst_macro_memrchr="no"
4029 ])
4030 fi
4031 #
4032 if test "$tst_links_memrchr" = "yes"; then
4033 AC_MSG_CHECKING([if memrchr is prototyped])
4034 AC_EGREP_CPP([memrchr],[
4035 $curl_includes_string
4036 ],[
4037 AC_MSG_RESULT([yes])
4038 tst_proto_memrchr="yes"
4039 ],[
4040 AC_MSG_RESULT([no])
4041 tst_proto_memrchr="no"
4042 ])
4043 fi
4044 #
4045 if test "$tst_proto_memrchr" = "yes" ||
4046 test "$tst_macro_memrchr" = "yes"; then
4047 AC_MSG_CHECKING([if memrchr is compilable])
4048 AC_COMPILE_IFELSE([
4049 AC_LANG_PROGRAM([[
4050 $curl_includes_string
4051 ]],[[
4052 if(0 != memrchr(0, 0, 0))
4053 return 1;
4054 ]])
4055 ],[
4056 AC_MSG_RESULT([yes])
4057 tst_compi_memrchr="yes"
4058 ],[
4059 AC_MSG_RESULT([no])
4060 tst_compi_memrchr="no"
4061 ])
4062 fi
4063 #
4064 if test "$tst_compi_memrchr" = "yes"; then
4065 AC_MSG_CHECKING([if memrchr usage allowed])
4066 if test "x$curl_disallow_memrchr" != "xyes"; then
4067 AC_MSG_RESULT([yes])
4068 tst_allow_memrchr="yes"
4069 else
4070 AC_MSG_RESULT([no])
4071 tst_allow_memrchr="no"
4072 fi
4073 fi
4074 #
4075 AC_MSG_CHECKING([if memrchr might be used])
4076 if (test "$tst_proto_memrchr" = "yes" ||
4077 test "$tst_macro_memrchr" = "yes") &&
4078 test "$tst_compi_memrchr" = "yes" &&
4079 test "$tst_allow_memrchr" = "yes"; then
4080 AC_MSG_RESULT([yes])
4081 AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1,
4082 [Define to 1 if you have the memrchr function or macro.])
4083 curl_cv_func_memrchr="yes"
4084 else
4085 AC_MSG_RESULT([no])
4086 curl_cv_func_memrchr="no"
4087 fi
4088])
4089
4090
4091dnl CURL_CHECK_FUNC_POLL
4092dnl -------------------------------------------------
4093dnl Verify if poll is available, prototyped, can
4094dnl be compiled and seems to work.
4095
4096AC_DEFUN([CURL_CHECK_FUNC_POLL], [
4097 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
4098 AC_REQUIRE([CURL_INCLUDES_POLL])dnl
4099 #
4100 tst_links_poll="unknown"
4101 tst_proto_poll="unknown"
4102 tst_compi_poll="unknown"
4103 tst_works_poll="unknown"
4104 tst_allow_poll="unknown"
4105 #
4106 case $host_os in
4107 darwin*|interix*)
4108 dnl poll() does not work on these platforms
4109 dnl Interix: "does provide poll(), but the implementing developer must
4110 dnl have been in a bad mood, because poll() only works on the /proc
4111 dnl filesystem here"
4112 dnl macOS: poll() first didn't exist, then was broken until fixed in 10.9
4113 dnl only to break again in 10.12.
4114 curl_disallow_poll="yes"
4115 tst_compi_poll="no"
4116 ;;
4117 esac
4118 #
4119 AC_MSG_CHECKING([if poll can be linked])
4120 AC_LINK_IFELSE([
4121 AC_LANG_PROGRAM([[
4122 $curl_includes_poll
4123 ]],[[
4124 if(0 != poll(0, 0, 0))
4125 return 1;
4126 ]])
4127 ],[
4128 AC_MSG_RESULT([yes])
4129 tst_links_poll="yes"
4130 ],[
4131 AC_MSG_RESULT([no])
4132 tst_links_poll="no"
4133 ])
4134 #
4135 if test "$tst_links_poll" = "yes"; then
4136 AC_MSG_CHECKING([if poll is prototyped])
4137 AC_EGREP_CPP([poll],[
4138 $curl_includes_poll
4139 ],[
4140 AC_MSG_RESULT([yes])
4141 tst_proto_poll="yes"
4142 ],[
4143 AC_MSG_RESULT([no])
4144 tst_proto_poll="no"
4145 ])
4146 fi
4147 #
4148 if test "$tst_proto_poll" = "yes"; then
4149 AC_MSG_CHECKING([if poll is compilable])
4150 AC_COMPILE_IFELSE([
4151 AC_LANG_PROGRAM([[
4152 $curl_includes_poll
4153 ]],[[
4154 if(0 != poll(0, 0, 0))
4155 return 1;
4156 ]])
4157 ],[
4158 AC_MSG_RESULT([yes])
4159 tst_compi_poll="yes"
4160 ],[
4161 AC_MSG_RESULT([no])
4162 tst_compi_poll="no"
4163 ])
4164 fi
4165 #
4166 dnl only do runtime verification when not cross-compiling
4167 if test "x$cross_compiling" != "xyes" &&
4168 test "$tst_compi_poll" = "yes"; then
4169 AC_MSG_CHECKING([if poll seems to work])
4170 CURL_RUN_IFELSE([
4171 AC_LANG_PROGRAM([[
4172 $curl_includes_stdlib
4173 $curl_includes_poll
4174 $curl_includes_time
4175 ]],[[
4176 /* detect the original poll() breakage */
4177 if(0 != poll(0, 0, 10))
4178 exit(1); /* fail */
4179 else {
4180 /* detect the 10.12 poll() breakage */
4181 struct timeval before, after;
4182 int rc;
4183 size_t us;
4184
4185 gettimeofday(&before, NULL);
4186 rc = poll(NULL, 0, 500);
4187 gettimeofday(&after, NULL);
4188
4189 us = (after.tv_sec - before.tv_sec) * 1000000 +
4190 (after.tv_usec - before.tv_usec);
4191
4192 if(us < 400000)
4193 exit(1);
4194 }
4195 ]])
4196 ],[
4197 AC_MSG_RESULT([yes])
4198 tst_works_poll="yes"
4199 ],[
4200 AC_MSG_RESULT([no])
4201 tst_works_poll="no"
4202 ])
4203 fi
4204 #
4205 if test "$tst_compi_poll" = "yes" &&
4206 test "$tst_works_poll" != "no"; then
4207 AC_MSG_CHECKING([if poll usage allowed])
4208 if test "x$curl_disallow_poll" != "xyes"; then
4209 AC_MSG_RESULT([yes])
4210 tst_allow_poll="yes"
4211 else
4212 AC_MSG_RESULT([no])
4213 tst_allow_poll="no"
4214 fi
4215 fi
4216 #
4217 AC_MSG_CHECKING([if poll might be used])
4218 if test "$tst_links_poll" = "yes" &&
4219 test "$tst_proto_poll" = "yes" &&
4220 test "$tst_compi_poll" = "yes" &&
4221 test "$tst_allow_poll" = "yes" &&
4222 test "$tst_works_poll" != "no"; then
4223 AC_MSG_RESULT([yes])
4224 AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1,
4225 [If you have a fine poll])
4226 curl_cv_func_poll="yes"
4227 else
4228 AC_MSG_RESULT([no])
4229 curl_cv_func_poll="no"
4230 fi
4231])
4232
4233
4234dnl CURL_CHECK_FUNC_REMOVEXATTR
4235dnl -------------------------------------------------
4236dnl Verify if removexattr is available, prototyped, and
4237dnl can be compiled. If all of these are true, and
4238dnl usage has not been previously disallowed with
4239dnl shell variable curl_disallow_removexattr, then
4240dnl HAVE_REMOVEXATTR will be defined.
4241
4242AC_DEFUN([CURL_CHECK_FUNC_REMOVEXATTR], [
4243 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
4244 #
4245 tst_links_removexattr="unknown"
4246 tst_proto_removexattr="unknown"
4247 tst_compi_removexattr="unknown"
4248 tst_allow_removexattr="unknown"
4249 tst_nargs_removexattr="unknown"
4250 #
4251 AC_MSG_CHECKING([if removexattr can be linked])
4252 AC_LINK_IFELSE([
4253 AC_LANG_FUNC_LINK_TRY([removexattr])
4254 ],[
4255 AC_MSG_RESULT([yes])
4256 tst_links_removexattr="yes"
4257 ],[
4258 AC_MSG_RESULT([no])
4259 tst_links_removexattr="no"
4260 ])
4261 #
4262 if test "$tst_links_removexattr" = "yes"; then
4263 AC_MSG_CHECKING([if removexattr is prototyped])
4264 AC_EGREP_CPP([removexattr],[
4265 $curl_includes_sys_xattr
4266 ],[
4267 AC_MSG_RESULT([yes])
4268 tst_proto_removexattr="yes"
4269 ],[
4270 AC_MSG_RESULT([no])
4271 tst_proto_removexattr="no"
4272 ])
4273 fi
4274 #
4275 if test "$tst_proto_removexattr" = "yes"; then
4276 if test "$tst_nargs_removexattr" = "unknown"; then
4277 AC_MSG_CHECKING([if removexattr takes 2 args.])
4278 AC_COMPILE_IFELSE([
4279 AC_LANG_PROGRAM([[
4280 $curl_includes_sys_xattr
4281 ]],[[
4282 if(0 != removexattr(0, 0))
4283 return 1;
4284 ]])
4285 ],[
4286 AC_MSG_RESULT([yes])
4287 tst_compi_removexattr="yes"
4288 tst_nargs_removexattr="2"
4289 ],[
4290 AC_MSG_RESULT([no])
4291 tst_compi_removexattr="no"
4292 ])
4293 fi
4294 if test "$tst_nargs_removexattr" = "unknown"; then
4295 AC_MSG_CHECKING([if removexattr takes 3 args.])
4296 AC_COMPILE_IFELSE([
4297 AC_LANG_PROGRAM([[
4298 $curl_includes_sys_xattr
4299 ]],[[
4300 if(0 != removexattr(0, 0, 0))
4301 return 1;
4302 ]])
4303 ],[
4304 AC_MSG_RESULT([yes])
4305 tst_compi_removexattr="yes"
4306 tst_nargs_removexattr="3"
4307 ],[
4308 AC_MSG_RESULT([no])
4309 tst_compi_removexattr="no"
4310 ])
4311 fi
4312 AC_MSG_CHECKING([if removexattr is compilable])
4313 if test "$tst_compi_removexattr" = "yes"; then
4314 AC_MSG_RESULT([yes])
4315 else
4316 AC_MSG_RESULT([no])
4317 fi
4318 fi
4319 #
4320 if test "$tst_compi_removexattr" = "yes"; then
4321 AC_MSG_CHECKING([if removexattr usage allowed])
4322 if test "x$curl_disallow_removexattr" != "xyes"; then
4323 AC_MSG_RESULT([yes])
4324 tst_allow_removexattr="yes"
4325 else
4326 AC_MSG_RESULT([no])
4327 tst_allow_removexattr="no"
4328 fi
4329 fi
4330 #
4331 AC_MSG_CHECKING([if removexattr might be used])
4332 if test "$tst_links_removexattr" = "yes" &&
4333 test "$tst_proto_removexattr" = "yes" &&
4334 test "$tst_compi_removexattr" = "yes" &&
4335 test "$tst_allow_removexattr" = "yes"; then
4336 AC_MSG_RESULT([yes])
4337 AC_DEFINE_UNQUOTED(HAVE_REMOVEXATTR, 1,
4338 [Define to 1 if you have the removexattr function.])
4339 dnl AC_DEFINE_UNQUOTED(REMOVEXATTR_ARGS, $tst_nargs_removexattr,
4340 dnl [Specifies the number of arguments to removexattr])
4341 #
4342 if test "$tst_nargs_removexattr" -eq "2"; then
4343 AC_DEFINE(HAVE_REMOVEXATTR_2, 1, [removexattr() takes 2 args])
4344 elif test "$tst_nargs_removexattr" -eq "3"; then
4345 AC_DEFINE(HAVE_REMOVEXATTR_3, 1, [removexattr() takes 3 args])
4346 fi
4347 #
4348 curl_cv_func_removexattr="yes"
4349 else
4350 AC_MSG_RESULT([no])
4351 curl_cv_func_removexattr="no"
4352 fi
4353])
4354
4355
4356dnl CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK
4357dnl -------------------------------------------------
4358dnl Verify if setsockopt with the SO_NONBLOCK command is
4359dnl available, can be compiled, and seems to work. If
4360dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK
4361dnl will be defined.
4362
4363AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [
4364 #
4365 tst_compi_setsockopt_so_nonblock="unknown"
4366 tst_allow_setsockopt_so_nonblock="unknown"
4367 #
4368 if test "$curl_cv_func_setsockopt" = "yes"; then
4369 AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable])
4370 AC_COMPILE_IFELSE([
4371 AC_LANG_PROGRAM([[
4372 $curl_includes_winsock2
4373 $curl_includes_bsdsocket
4374 $curl_includes_sys_socket
4375 ]],[[
4376 if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
4377 return 1;
4378 ]])
4379 ],[
4380 AC_MSG_RESULT([yes])
4381 tst_compi_setsockopt_so_nonblock="yes"
4382 ],[
4383 AC_MSG_RESULT([no])
4384 tst_compi_setsockopt_so_nonblock="no"
4385 ])
4386 fi
4387 #
4388 if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then
4389 AC_MSG_CHECKING([if setsockopt SO_NONBLOCK usage allowed])
4390 if test "x$curl_disallow_setsockopt_so_nonblock" != "xyes"; then
4391 AC_MSG_RESULT([yes])
4392 tst_allow_setsockopt_so_nonblock="yes"
4393 else
4394 AC_MSG_RESULT([no])
4395 tst_allow_setsockopt_so_nonblock="no"
4396 fi
4397 fi
4398 #
4399 AC_MSG_CHECKING([if setsockopt SO_NONBLOCK might be used])
4400 if test "$tst_compi_setsockopt_so_nonblock" = "yes" &&
4401 test "$tst_allow_setsockopt_so_nonblock" = "yes"; then
4402 AC_MSG_RESULT([yes])
4403 AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT_SO_NONBLOCK, 1,
4404 [Define to 1 if you have a working setsockopt SO_NONBLOCK function.])
4405 curl_cv_func_setsockopt_so_nonblock="yes"
4406 else
4407 AC_MSG_RESULT([no])
4408 curl_cv_func_setsockopt_so_nonblock="no"
4409 fi
4410])
4411
4412
4413dnl CURL_CHECK_FUNC_SETXATTR
4414dnl -------------------------------------------------
4415dnl Verify if setxattr is available, prototyped, and
4416dnl can be compiled. If all of these are true, and
4417dnl usage has not been previously disallowed with
4418dnl shell variable curl_disallow_setxattr, then
4419dnl HAVE_SETXATTR will be defined.
4420
4421AC_DEFUN([CURL_CHECK_FUNC_SETXATTR], [
4422 AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
4423 #
4424 tst_links_setxattr="unknown"
4425 tst_proto_setxattr="unknown"
4426 tst_compi_setxattr="unknown"
4427 tst_allow_setxattr="unknown"
4428 tst_nargs_setxattr="unknown"
4429 #
4430 AC_MSG_CHECKING([if setxattr can be linked])
4431 AC_LINK_IFELSE([
4432 AC_LANG_FUNC_LINK_TRY([setxattr])
4433 ],[
4434 AC_MSG_RESULT([yes])
4435 tst_links_setxattr="yes"
4436 ],[
4437 AC_MSG_RESULT([no])
4438 tst_links_setxattr="no"
4439 ])
4440 #
4441 if test "$tst_links_setxattr" = "yes"; then
4442 AC_MSG_CHECKING([if setxattr is prototyped])
4443 AC_EGREP_CPP([setxattr],[
4444 $curl_includes_sys_xattr
4445 ],[
4446 AC_MSG_RESULT([yes])
4447 tst_proto_setxattr="yes"
4448 ],[
4449 AC_MSG_RESULT([no])
4450 tst_proto_setxattr="no"
4451 ])
4452 fi
4453 #
4454 if test "$tst_proto_setxattr" = "yes"; then
4455 if test "$tst_nargs_setxattr" = "unknown"; then
4456 AC_MSG_CHECKING([if setxattr takes 5 args.])
4457 AC_COMPILE_IFELSE([
4458 AC_LANG_PROGRAM([[
4459 $curl_includes_sys_xattr
4460 ]],[[
4461 if(0 != setxattr(0, 0, 0, 0, 0))
4462 return 1;
4463 ]])
4464 ],[
4465 AC_MSG_RESULT([yes])
4466 tst_compi_setxattr="yes"
4467 tst_nargs_setxattr="5"
4468 ],[
4469 AC_MSG_RESULT([no])
4470 tst_compi_setxattr="no"
4471 ])
4472 fi
4473 if test "$tst_nargs_setxattr" = "unknown"; then
4474 AC_MSG_CHECKING([if setxattr takes 6 args.])
4475 AC_COMPILE_IFELSE([
4476 AC_LANG_PROGRAM([[
4477 $curl_includes_sys_xattr
4478 ]],[[
4479 if(0 != setxattr(0, 0, 0, 0, 0, 0))
4480 return 1;
4481 ]])
4482 ],[
4483 AC_MSG_RESULT([yes])
4484 tst_compi_setxattr="yes"
4485 tst_nargs_setxattr="6"
4486 ],[
4487 AC_MSG_RESULT([no])
4488 tst_compi_setxattr="no"
4489 ])
4490 fi
4491 AC_MSG_CHECKING([if setxattr is compilable])
4492 if test "$tst_compi_setxattr" = "yes"; then
4493 AC_MSG_RESULT([yes])
4494 else
4495 AC_MSG_RESULT([no])
4496 fi
4497 fi
4498 #
4499 if test "$tst_compi_setxattr" = "yes"; then
4500 AC_MSG_CHECKING([if setxattr usage allowed])
4501 if test "x$curl_disallow_setxattr" != "xyes"; then
4502 AC_MSG_RESULT([yes])
4503 tst_allow_setxattr="yes"
4504 else
4505 AC_MSG_RESULT([no])
4506 tst_allow_setxattr="no"
4507 fi
4508 fi
4509 #
4510 AC_MSG_CHECKING([if setxattr might be used])
4511 if test "$tst_links_setxattr" = "yes" &&
4512 test "$tst_proto_setxattr" = "yes" &&
4513 test "$tst_compi_setxattr" = "yes" &&
4514 test "$tst_allow_setxattr" = "yes"; then
4515 AC_MSG_RESULT([yes])
4516 AC_DEFINE_UNQUOTED(HAVE_SETXATTR, 1,
4517 [Define to 1 if you have the setxattr function.])
4518 dnl AC_DEFINE_UNQUOTED(SETXATTR_ARGS, $tst_nargs_setxattr,
4519 dnl [Specifies the number of arguments to setxattr])
4520 #
4521 if test "$tst_nargs_setxattr" -eq "5"; then
4522 AC_DEFINE(HAVE_SETXATTR_5, 1, [setxattr() takes 5 args])
4523 elif test "$tst_nargs_setxattr" -eq "6"; then
4524 AC_DEFINE(HAVE_SETXATTR_6, 1, [setxattr() takes 6 args])
4525 fi
4526 #
4527 curl_cv_func_setxattr="yes"
4528 else
4529 AC_MSG_RESULT([no])
4530 curl_cv_func_setxattr="no"
4531 fi
4532])
4533
4534
4535dnl CURL_CHECK_FUNC_SIGACTION
4536dnl -------------------------------------------------
4537dnl Verify if sigaction is available, prototyped, and
4538dnl can be compiled. If all of these are true, and
4539dnl usage has not been previously disallowed with
4540dnl shell variable curl_disallow_sigaction, then
4541dnl HAVE_SIGACTION will be defined.
4542
4543AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
4544 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
4545 #
4546 tst_links_sigaction="unknown"
4547 tst_proto_sigaction="unknown"
4548 tst_compi_sigaction="unknown"
4549 tst_allow_sigaction="unknown"
4550 #
4551 AC_MSG_CHECKING([if sigaction can be linked])
4552 AC_LINK_IFELSE([
4553 AC_LANG_FUNC_LINK_TRY([sigaction])
4554 ],[
4555 AC_MSG_RESULT([yes])
4556 tst_links_sigaction="yes"
4557 ],[
4558 AC_MSG_RESULT([no])
4559 tst_links_sigaction="no"
4560 ])
4561 #
4562 if test "$tst_links_sigaction" = "yes"; then
4563 AC_MSG_CHECKING([if sigaction is prototyped])
4564 AC_EGREP_CPP([sigaction],[
4565 $curl_includes_signal
4566 ],[
4567 AC_MSG_RESULT([yes])
4568 tst_proto_sigaction="yes"
4569 ],[
4570 AC_MSG_RESULT([no])
4571 tst_proto_sigaction="no"
4572 ])
4573 fi
4574 #
4575 if test "$tst_proto_sigaction" = "yes"; then
4576 AC_MSG_CHECKING([if sigaction is compilable])
4577 AC_COMPILE_IFELSE([
4578 AC_LANG_PROGRAM([[
4579 $curl_includes_signal
4580 ]],[[
4581 if(0 != sigaction(0, 0, 0))
4582 return 1;
4583 ]])
4584 ],[
4585 AC_MSG_RESULT([yes])
4586 tst_compi_sigaction="yes"
4587 ],[
4588 AC_MSG_RESULT([no])
4589 tst_compi_sigaction="no"
4590 ])
4591 fi
4592 #
4593 if test "$tst_compi_sigaction" = "yes"; then
4594 AC_MSG_CHECKING([if sigaction usage allowed])
4595 if test "x$curl_disallow_sigaction" != "xyes"; then
4596 AC_MSG_RESULT([yes])
4597 tst_allow_sigaction="yes"
4598 else
4599 AC_MSG_RESULT([no])
4600 tst_allow_sigaction="no"
4601 fi
4602 fi
4603 #
4604 AC_MSG_CHECKING([if sigaction might be used])
4605 if test "$tst_links_sigaction" = "yes" &&
4606 test "$tst_proto_sigaction" = "yes" &&
4607 test "$tst_compi_sigaction" = "yes" &&
4608 test "$tst_allow_sigaction" = "yes"; then
4609 AC_MSG_RESULT([yes])
4610 AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
4611 [Define to 1 if you have the sigaction function.])
4612 curl_cv_func_sigaction="yes"
4613 else
4614 AC_MSG_RESULT([no])
4615 curl_cv_func_sigaction="no"
4616 fi
4617])
4618
4619
4620dnl CURL_CHECK_FUNC_SIGINTERRUPT
4621dnl -------------------------------------------------
4622dnl Verify if siginterrupt is available, prototyped, and
4623dnl can be compiled. If all of these are true, and
4624dnl usage has not been previously disallowed with
4625dnl shell variable curl_disallow_siginterrupt, then
4626dnl HAVE_SIGINTERRUPT will be defined.
4627
4628AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [
4629 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
4630 #
4631 tst_links_siginterrupt="unknown"
4632 tst_proto_siginterrupt="unknown"
4633 tst_compi_siginterrupt="unknown"
4634 tst_allow_siginterrupt="unknown"
4635 #
4636 AC_MSG_CHECKING([if siginterrupt can be linked])
4637 AC_LINK_IFELSE([
4638 AC_LANG_FUNC_LINK_TRY([siginterrupt])
4639 ],[
4640 AC_MSG_RESULT([yes])
4641 tst_links_siginterrupt="yes"
4642 ],[
4643 AC_MSG_RESULT([no])
4644 tst_links_siginterrupt="no"
4645 ])
4646 #
4647 if test "$tst_links_siginterrupt" = "yes"; then
4648 AC_MSG_CHECKING([if siginterrupt is prototyped])
4649 AC_EGREP_CPP([siginterrupt],[
4650 $curl_includes_signal
4651 ],[
4652 AC_MSG_RESULT([yes])
4653 tst_proto_siginterrupt="yes"
4654 ],[
4655 AC_MSG_RESULT([no])
4656 tst_proto_siginterrupt="no"
4657 ])
4658 fi
4659 #
4660 if test "$tst_proto_siginterrupt" = "yes"; then
4661 AC_MSG_CHECKING([if siginterrupt is compilable])
4662 AC_COMPILE_IFELSE([
4663 AC_LANG_PROGRAM([[
4664 $curl_includes_signal
4665 ]],[[
4666 if(0 != siginterrupt(0, 0))
4667 return 1;
4668 ]])
4669 ],[
4670 AC_MSG_RESULT([yes])
4671 tst_compi_siginterrupt="yes"
4672 ],[
4673 AC_MSG_RESULT([no])
4674 tst_compi_siginterrupt="no"
4675 ])
4676 fi
4677 #
4678 if test "$tst_compi_siginterrupt" = "yes"; then
4679 AC_MSG_CHECKING([if siginterrupt usage allowed])
4680 if test "x$curl_disallow_siginterrupt" != "xyes"; then
4681 AC_MSG_RESULT([yes])
4682 tst_allow_siginterrupt="yes"
4683 else
4684 AC_MSG_RESULT([no])
4685 tst_allow_siginterrupt="no"
4686 fi
4687 fi
4688 #
4689 AC_MSG_CHECKING([if siginterrupt might be used])
4690 if test "$tst_links_siginterrupt" = "yes" &&
4691 test "$tst_proto_siginterrupt" = "yes" &&
4692 test "$tst_compi_siginterrupt" = "yes" &&
4693 test "$tst_allow_siginterrupt" = "yes"; then
4694 AC_MSG_RESULT([yes])
4695 AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1,
4696 [Define to 1 if you have the siginterrupt function.])
4697 curl_cv_func_siginterrupt="yes"
4698 else
4699 AC_MSG_RESULT([no])
4700 curl_cv_func_siginterrupt="no"
4701 fi
4702])
4703
4704
4705dnl CURL_CHECK_FUNC_SIGNAL
4706dnl -------------------------------------------------
4707dnl Verify if signal is available, prototyped, and
4708dnl can be compiled. If all of these are true, and
4709dnl usage has not been previously disallowed with
4710dnl shell variable curl_disallow_signal, then
4711dnl HAVE_SIGNAL will be defined.
4712
4713AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [
4714 AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
4715 #
4716 tst_links_signal="unknown"
4717 tst_proto_signal="unknown"
4718 tst_compi_signal="unknown"
4719 tst_allow_signal="unknown"
4720 #
4721 AC_MSG_CHECKING([if signal can be linked])
4722 AC_LINK_IFELSE([
4723 AC_LANG_FUNC_LINK_TRY([signal])
4724 ],[
4725 AC_MSG_RESULT([yes])
4726 tst_links_signal="yes"
4727 ],[
4728 AC_MSG_RESULT([no])
4729 tst_links_signal="no"
4730 ])
4731 #
4732 if test "$tst_links_signal" = "yes"; then
4733 AC_MSG_CHECKING([if signal is prototyped])
4734 AC_EGREP_CPP([signal],[
4735 $curl_includes_signal
4736 ],[
4737 AC_MSG_RESULT([yes])
4738 tst_proto_signal="yes"
4739 ],[
4740 AC_MSG_RESULT([no])
4741 tst_proto_signal="no"
4742 ])
4743 fi
4744 #
4745 if test "$tst_proto_signal" = "yes"; then
4746 AC_MSG_CHECKING([if signal is compilable])
4747 AC_COMPILE_IFELSE([
4748 AC_LANG_PROGRAM([[
4749 $curl_includes_signal
4750 ]],[[
4751 if(0 != signal(0, 0))
4752 return 1;
4753 ]])
4754 ],[
4755 AC_MSG_RESULT([yes])
4756 tst_compi_signal="yes"
4757 ],[
4758 AC_MSG_RESULT([no])
4759 tst_compi_signal="no"
4760 ])
4761 fi
4762 #
4763 if test "$tst_compi_signal" = "yes"; then
4764 AC_MSG_CHECKING([if signal usage allowed])
4765 if test "x$curl_disallow_signal" != "xyes"; then
4766 AC_MSG_RESULT([yes])
4767 tst_allow_signal="yes"
4768 else
4769 AC_MSG_RESULT([no])
4770 tst_allow_signal="no"
4771 fi
4772 fi
4773 #
4774 AC_MSG_CHECKING([if signal might be used])
4775 if test "$tst_links_signal" = "yes" &&
4776 test "$tst_proto_signal" = "yes" &&
4777 test "$tst_compi_signal" = "yes" &&
4778 test "$tst_allow_signal" = "yes"; then
4779 AC_MSG_RESULT([yes])
4780 AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1,
4781 [Define to 1 if you have the signal function.])
4782 curl_cv_func_signal="yes"
4783 else
4784 AC_MSG_RESULT([no])
4785 curl_cv_func_signal="no"
4786 fi
4787])
4788
4789
4790dnl CURL_CHECK_FUNC_SIGSETJMP
4791dnl -------------------------------------------------
4792dnl Verify if sigsetjmp is available, prototyped, and
4793dnl can be compiled. If all of these are true, and
4794dnl usage has not been previously disallowed with
4795dnl shell variable curl_disallow_sigsetjmp, then
4796dnl HAVE_SIGSETJMP will be defined.
4797
4798AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [
4799 AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl
4800 #
4801 tst_links_sigsetjmp="unknown"
4802 tst_macro_sigsetjmp="unknown"
4803 tst_proto_sigsetjmp="unknown"
4804 tst_compi_sigsetjmp="unknown"
4805 tst_allow_sigsetjmp="unknown"
4806 #
4807 AC_MSG_CHECKING([if sigsetjmp can be linked])
4808 AC_LINK_IFELSE([
4809 AC_LANG_FUNC_LINK_TRY([sigsetjmp])
4810 ],[
4811 AC_MSG_RESULT([yes])
4812 tst_links_sigsetjmp="yes"
4813 ],[
4814 AC_MSG_RESULT([no])
4815 tst_links_sigsetjmp="no"
4816 ])
4817 #
4818 if test "$tst_links_sigsetjmp" = "no"; then
4819 AC_MSG_CHECKING([if sigsetjmp seems a macro])
4820 AC_LINK_IFELSE([
4821 AC_LANG_PROGRAM([[
4822 $curl_includes_setjmp
4823 ]],[[
4824 sigjmp_buf env;
4825 if(0 != sigsetjmp(env, 0))
4826 return 1;
4827 ]])
4828 ],[
4829 AC_MSG_RESULT([yes])
4830 tst_macro_sigsetjmp="yes"
4831 ],[
4832 AC_MSG_RESULT([no])
4833 tst_macro_sigsetjmp="no"
4834 ])
4835 fi
4836 #
4837 if test "$tst_links_sigsetjmp" = "yes"; then
4838 AC_MSG_CHECKING([if sigsetjmp is prototyped])
4839 AC_EGREP_CPP([sigsetjmp],[
4840 $curl_includes_setjmp
4841 ],[
4842 AC_MSG_RESULT([yes])
4843 tst_proto_sigsetjmp="yes"
4844 ],[
4845 AC_MSG_RESULT([no])
4846 tst_proto_sigsetjmp="no"
4847 ])
4848 fi
4849 #
4850 if test "$tst_proto_sigsetjmp" = "yes" ||
4851 test "$tst_macro_sigsetjmp" = "yes"; then
4852 AC_MSG_CHECKING([if sigsetjmp is compilable])
4853 AC_COMPILE_IFELSE([
4854 AC_LANG_PROGRAM([[
4855 $curl_includes_setjmp
4856 ]],[[
4857 sigjmp_buf env;
4858 if(0 != sigsetjmp(env, 0))
4859 return 1;
4860 ]])
4861 ],[
4862 AC_MSG_RESULT([yes])
4863 tst_compi_sigsetjmp="yes"
4864 ],[
4865 AC_MSG_RESULT([no])
4866 tst_compi_sigsetjmp="no"
4867 ])
4868 fi
4869 #
4870 if test "$tst_compi_sigsetjmp" = "yes"; then
4871 AC_MSG_CHECKING([if sigsetjmp usage allowed])
4872 if test "x$curl_disallow_sigsetjmp" != "xyes"; then
4873 AC_MSG_RESULT([yes])
4874 tst_allow_sigsetjmp="yes"
4875 else
4876 AC_MSG_RESULT([no])
4877 tst_allow_sigsetjmp="no"
4878 fi
4879 fi
4880 #
4881 AC_MSG_CHECKING([if sigsetjmp might be used])
4882 if (test "$tst_proto_sigsetjmp" = "yes" ||
4883 test "$tst_macro_sigsetjmp" = "yes") &&
4884 test "$tst_compi_sigsetjmp" = "yes" &&
4885 test "$tst_allow_sigsetjmp" = "yes"; then
4886 AC_MSG_RESULT([yes])
4887 AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1,
4888 [Define to 1 if you have the sigsetjmp function or macro.])
4889 curl_cv_func_sigsetjmp="yes"
4890 else
4891 AC_MSG_RESULT([no])
4892 curl_cv_func_sigsetjmp="no"
4893 fi
4894])
4895
4896
4897dnl CURL_CHECK_FUNC_SOCKET
4898dnl -------------------------------------------------
4899dnl Verify if socket is available, prototyped, and
4900dnl can be compiled. If all of these are true, and
4901dnl usage has not been previously disallowed with
4902dnl shell variable curl_disallow_socket, then
4903dnl HAVE_SOCKET will be defined.
4904
4905AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [
4906 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
4907 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
4908 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
4909 #
4910 tst_links_socket="unknown"
4911 tst_proto_socket="unknown"
4912 tst_compi_socket="unknown"
4913 tst_allow_socket="unknown"
4914 #
4915 AC_MSG_CHECKING([if socket can be linked])
4916 AC_LINK_IFELSE([
4917 AC_LANG_PROGRAM([[
4918 $curl_includes_winsock2
4919 $curl_includes_bsdsocket
4920 $curl_includes_sys_socket
4921 $curl_includes_socket
4922 ]],[[
4923 if(0 != socket(0, 0, 0))
4924 return 1;
4925 ]])
4926 ],[
4927 AC_MSG_RESULT([yes])
4928 tst_links_socket="yes"
4929 ],[
4930 AC_MSG_RESULT([no])
4931 tst_links_socket="no"
4932 ])
4933 #
4934 if test "$tst_links_socket" = "yes"; then
4935 AC_MSG_CHECKING([if socket is prototyped])
4936 AC_EGREP_CPP([socket],[
4937 $curl_includes_winsock2
4938 $curl_includes_bsdsocket
4939 $curl_includes_sys_socket
4940 $curl_includes_socket
4941 ],[
4942 AC_MSG_RESULT([yes])
4943 tst_proto_socket="yes"
4944 ],[
4945 AC_MSG_RESULT([no])
4946 tst_proto_socket="no"
4947 ])
4948 fi
4949 #
4950 if test "$tst_proto_socket" = "yes"; then
4951 AC_MSG_CHECKING([if socket is compilable])
4952 AC_COMPILE_IFELSE([
4953 AC_LANG_PROGRAM([[
4954 $curl_includes_winsock2
4955 $curl_includes_bsdsocket
4956 $curl_includes_sys_socket
4957 $curl_includes_socket
4958 ]],[[
4959 if(0 != socket(0, 0, 0))
4960 return 1;
4961 ]])
4962 ],[
4963 AC_MSG_RESULT([yes])
4964 tst_compi_socket="yes"
4965 ],[
4966 AC_MSG_RESULT([no])
4967 tst_compi_socket="no"
4968 ])
4969 fi
4970 #
4971 if test "$tst_compi_socket" = "yes"; then
4972 AC_MSG_CHECKING([if socket usage allowed])
4973 if test "x$curl_disallow_socket" != "xyes"; then
4974 AC_MSG_RESULT([yes])
4975 tst_allow_socket="yes"
4976 else
4977 AC_MSG_RESULT([no])
4978 tst_allow_socket="no"
4979 fi
4980 fi
4981 #
4982 AC_MSG_CHECKING([if socket might be used])
4983 if test "$tst_links_socket" = "yes" &&
4984 test "$tst_proto_socket" = "yes" &&
4985 test "$tst_compi_socket" = "yes" &&
4986 test "$tst_allow_socket" = "yes"; then
4987 AC_MSG_RESULT([yes])
4988 AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1,
4989 [Define to 1 if you have the socket function.])
4990 curl_cv_func_socket="yes"
4991 else
4992 AC_MSG_RESULT([no])
4993 curl_cv_func_socket="no"
4994 fi
4995])
4996
4997
4998dnl CURL_CHECK_FUNC_SOCKETPAIR
4999dnl -------------------------------------------------
5000dnl Verify if socketpair is available, prototyped, and
5001dnl can be compiled. If all of these are true, and
5002dnl usage has not been previously disallowed with
5003dnl shell variable curl_disallow_socketpair, then
5004dnl HAVE_SOCKETPAIR will be defined.
5005
5006AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [
5007 AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
5008 AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
5009 #
5010 tst_links_socketpair="unknown"
5011 tst_proto_socketpair="unknown"
5012 tst_compi_socketpair="unknown"
5013 tst_allow_socketpair="unknown"
5014 #
5015 AC_MSG_CHECKING([if socketpair can be linked])
5016 AC_LINK_IFELSE([
5017 AC_LANG_FUNC_LINK_TRY([socketpair])
5018 ],[
5019 AC_MSG_RESULT([yes])
5020 tst_links_socketpair="yes"
5021 ],[
5022 AC_MSG_RESULT([no])
5023 tst_links_socketpair="no"
5024 ])
5025 #
5026 if test "$tst_links_socketpair" = "yes"; then
5027 AC_MSG_CHECKING([if socketpair is prototyped])
5028 AC_EGREP_CPP([socketpair],[
5029 $curl_includes_sys_socket
5030 $curl_includes_socket
5031 ],[
5032 AC_MSG_RESULT([yes])
5033 tst_proto_socketpair="yes"
5034 ],[
5035 AC_MSG_RESULT([no])
5036 tst_proto_socketpair="no"
5037 ])
5038 fi
5039 #
5040 if test "$tst_proto_socketpair" = "yes"; then
5041 AC_MSG_CHECKING([if socketpair is compilable])
5042 AC_COMPILE_IFELSE([
5043 AC_LANG_PROGRAM([[
5044 $curl_includes_sys_socket
5045 $curl_includes_socket
5046 ]],[[
5047 int sv[2];
5048 if(0 != socketpair(0, 0, 0, sv))
5049 return 1;
5050 ]])
5051 ],[
5052 AC_MSG_RESULT([yes])
5053 tst_compi_socketpair="yes"
5054 ],[
5055 AC_MSG_RESULT([no])
5056 tst_compi_socketpair="no"
5057 ])
5058 fi
5059 #
5060 if test "$tst_compi_socketpair" = "yes"; then
5061 AC_MSG_CHECKING([if socketpair usage allowed])
5062 if test "x$curl_disallow_socketpair" != "xyes"; then
5063 AC_MSG_RESULT([yes])
5064 tst_allow_socketpair="yes"
5065 else
5066 AC_MSG_RESULT([no])
5067 tst_allow_socketpair="no"
5068 fi
5069 fi
5070 #
5071 AC_MSG_CHECKING([if socketpair might be used])
5072 if test "$tst_links_socketpair" = "yes" &&
5073 test "$tst_proto_socketpair" = "yes" &&
5074 test "$tst_compi_socketpair" = "yes" &&
5075 test "$tst_allow_socketpair" = "yes"; then
5076 AC_MSG_RESULT([yes])
5077 AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1,
5078 [Define to 1 if you have the socketpair function.])
5079 curl_cv_func_socketpair="yes"
5080 else
5081 AC_MSG_RESULT([no])
5082 curl_cv_func_socketpair="no"
5083 fi
5084])
5085
5086
5087dnl CURL_CHECK_FUNC_STRCASECMP
5088dnl -------------------------------------------------
5089dnl Verify if strcasecmp is available, prototyped, and
5090dnl can be compiled. If all of these are true, and
5091dnl usage has not been previously disallowed with
5092dnl shell variable curl_disallow_strcasecmp, then
5093dnl HAVE_STRCASECMP will be defined.
5094
5095AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [
5096 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
5097 #
5098 tst_links_strcasecmp="unknown"
5099 tst_proto_strcasecmp="unknown"
5100 tst_compi_strcasecmp="unknown"
5101 tst_allow_strcasecmp="unknown"
5102 #
5103 AC_MSG_CHECKING([if strcasecmp can be linked])
5104 AC_LINK_IFELSE([
5105 AC_LANG_FUNC_LINK_TRY([strcasecmp])
5106 ],[
5107 AC_MSG_RESULT([yes])
5108 tst_links_strcasecmp="yes"
5109 ],[
5110 AC_MSG_RESULT([no])
5111 tst_links_strcasecmp="no"
5112 ])
5113 #
5114 if test "$tst_links_strcasecmp" = "yes"; then
5115 AC_MSG_CHECKING([if strcasecmp is prototyped])
5116 AC_EGREP_CPP([strcasecmp],[
5117 $curl_includes_string
5118 ],[
5119 AC_MSG_RESULT([yes])
5120 tst_proto_strcasecmp="yes"
5121 ],[
5122 AC_MSG_RESULT([no])
5123 tst_proto_strcasecmp="no"
5124 ])
5125 fi
5126 #
5127 if test "$tst_proto_strcasecmp" = "yes"; then
5128 AC_MSG_CHECKING([if strcasecmp is compilable])
5129 AC_COMPILE_IFELSE([
5130 AC_LANG_PROGRAM([[
5131 $curl_includes_string
5132 ]],[[
5133 if(0 != strcasecmp(0, 0))
5134 return 1;
5135 ]])
5136 ],[
5137 AC_MSG_RESULT([yes])
5138 tst_compi_strcasecmp="yes"
5139 ],[
5140 AC_MSG_RESULT([no])
5141 tst_compi_strcasecmp="no"
5142 ])
5143 fi
5144 #
5145 if test "$tst_compi_strcasecmp" = "yes"; then
5146 AC_MSG_CHECKING([if strcasecmp usage allowed])
5147 if test "x$curl_disallow_strcasecmp" != "xyes"; then
5148 AC_MSG_RESULT([yes])
5149 tst_allow_strcasecmp="yes"
5150 else
5151 AC_MSG_RESULT([no])
5152 tst_allow_strcasecmp="no"
5153 fi
5154 fi
5155 #
5156 AC_MSG_CHECKING([if strcasecmp might be used])
5157 if test "$tst_links_strcasecmp" = "yes" &&
5158 test "$tst_proto_strcasecmp" = "yes" &&
5159 test "$tst_compi_strcasecmp" = "yes" &&
5160 test "$tst_allow_strcasecmp" = "yes"; then
5161 AC_MSG_RESULT([yes])
5162 AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
5163 [Define to 1 if you have the strcasecmp function.])
5164 curl_cv_func_strcasecmp="yes"
5165 else
5166 AC_MSG_RESULT([no])
5167 curl_cv_func_strcasecmp="no"
5168 fi
5169])
5170
5171dnl CURL_CHECK_FUNC_STRCMPI
5172dnl -------------------------------------------------
5173dnl Verify if strcmpi is available, prototyped, and
5174dnl can be compiled. If all of these are true, and
5175dnl usage has not been previously disallowed with
5176dnl shell variable curl_disallow_strcmpi, then
5177dnl HAVE_STRCMPI will be defined.
5178
5179AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [
5180 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
5181 #
5182 tst_links_strcmpi="unknown"
5183 tst_proto_strcmpi="unknown"
5184 tst_compi_strcmpi="unknown"
5185 tst_allow_strcmpi="unknown"
5186 #
5187 AC_MSG_CHECKING([if strcmpi can be linked])
5188 AC_LINK_IFELSE([
5189 AC_LANG_FUNC_LINK_TRY([strcmpi])
5190 ],[
5191 AC_MSG_RESULT([yes])
5192 tst_links_strcmpi="yes"
5193 ],[
5194 AC_MSG_RESULT([no])
5195 tst_links_strcmpi="no"
5196 ])
5197 #
5198 if test "$tst_links_strcmpi" = "yes"; then
5199 AC_MSG_CHECKING([if strcmpi is prototyped])
5200 AC_EGREP_CPP([strcmpi],[
5201 $curl_includes_string
5202 ],[
5203 AC_MSG_RESULT([yes])
5204 tst_proto_strcmpi="yes"
5205 ],[
5206 AC_MSG_RESULT([no])
5207 tst_proto_strcmpi="no"
5208 ])
5209 fi
5210 #
5211 if test "$tst_proto_strcmpi" = "yes"; then
5212 AC_MSG_CHECKING([if strcmpi is compilable])
5213 AC_COMPILE_IFELSE([
5214 AC_LANG_PROGRAM([[
5215 $curl_includes_string
5216 ]],[[
5217 if(0 != strcmpi(0, 0))
5218 return 1;
5219 ]])
5220 ],[
5221 AC_MSG_RESULT([yes])
5222 tst_compi_strcmpi="yes"
5223 ],[
5224 AC_MSG_RESULT([no])
5225 tst_compi_strcmpi="no"
5226 ])
5227 fi
5228 #
5229 if test "$tst_compi_strcmpi" = "yes"; then
5230 AC_MSG_CHECKING([if strcmpi usage allowed])
5231 if test "x$curl_disallow_strcmpi" != "xyes"; then
5232 AC_MSG_RESULT([yes])
5233 tst_allow_strcmpi="yes"
5234 else
5235 AC_MSG_RESULT([no])
5236 tst_allow_strcmpi="no"
5237 fi
5238 fi
5239 #
5240 AC_MSG_CHECKING([if strcmpi might be used])
5241 if test "$tst_links_strcmpi" = "yes" &&
5242 test "$tst_proto_strcmpi" = "yes" &&
5243 test "$tst_compi_strcmpi" = "yes" &&
5244 test "$tst_allow_strcmpi" = "yes"; then
5245 AC_MSG_RESULT([yes])
5246 AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
5247 [Define to 1 if you have the strcmpi function.])
5248 curl_cv_func_strcmpi="yes"
5249 else
5250 AC_MSG_RESULT([no])
5251 curl_cv_func_strcmpi="no"
5252 fi
5253])
5254
5255
5256dnl CURL_CHECK_FUNC_STRDUP
5257dnl -------------------------------------------------
5258dnl Verify if strdup is available, prototyped, and
5259dnl can be compiled. If all of these are true, and
5260dnl usage has not been previously disallowed with
5261dnl shell variable curl_disallow_strdup, then
5262dnl HAVE_STRDUP will be defined.
5263
5264AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
5265 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
5266 #
5267 tst_links_strdup="unknown"
5268 tst_proto_strdup="unknown"
5269 tst_compi_strdup="unknown"
5270 tst_allow_strdup="unknown"
5271 #
5272 AC_MSG_CHECKING([if strdup can be linked])
5273 AC_LINK_IFELSE([
5274 AC_LANG_FUNC_LINK_TRY([strdup])
5275 ],[
5276 AC_MSG_RESULT([yes])
5277 tst_links_strdup="yes"
5278 ],[
5279 AC_MSG_RESULT([no])
5280 tst_links_strdup="no"
5281 ])
5282 #
5283 if test "$tst_links_strdup" = "yes"; then
5284 AC_MSG_CHECKING([if strdup is prototyped])
5285 AC_EGREP_CPP([strdup],[
5286 $curl_includes_string
5287 ],[
5288 AC_MSG_RESULT([yes])
5289 tst_proto_strdup="yes"
5290 ],[
5291 AC_MSG_RESULT([no])
5292 tst_proto_strdup="no"
5293 ])
5294 fi
5295 #
5296 if test "$tst_proto_strdup" = "yes"; then
5297 AC_MSG_CHECKING([if strdup is compilable])
5298 AC_COMPILE_IFELSE([
5299 AC_LANG_PROGRAM([[
5300 $curl_includes_string
5301 ]],[[
5302 if(0 != strdup(0))
5303 return 1;
5304 ]])
5305 ],[
5306 AC_MSG_RESULT([yes])
5307 tst_compi_strdup="yes"
5308 ],[
5309 AC_MSG_RESULT([no])
5310 tst_compi_strdup="no"
5311 ])
5312 fi
5313 #
5314 if test "$tst_compi_strdup" = "yes"; then
5315 AC_MSG_CHECKING([if strdup usage allowed])
5316 if test "x$curl_disallow_strdup" != "xyes"; then
5317 AC_MSG_RESULT([yes])
5318 tst_allow_strdup="yes"
5319 else
5320 AC_MSG_RESULT([no])
5321 tst_allow_strdup="no"
5322 fi
5323 fi
5324 #
5325 AC_MSG_CHECKING([if strdup might be used])
5326 if test "$tst_links_strdup" = "yes" &&
5327 test "$tst_proto_strdup" = "yes" &&
5328 test "$tst_compi_strdup" = "yes" &&
5329 test "$tst_allow_strdup" = "yes"; then
5330 AC_MSG_RESULT([yes])
5331 AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
5332 [Define to 1 if you have the strdup function.])
5333 curl_cv_func_strdup="yes"
5334 else
5335 AC_MSG_RESULT([no])
5336 curl_cv_func_strdup="no"
5337 fi
5338])
5339
5340
5341dnl CURL_CHECK_FUNC_STRERROR_R
5342dnl -------------------------------------------------
5343dnl Verify if strerror_r is available, prototyped, can be compiled and
5344dnl seems to work. If all of these are true, and usage has not been
5345dnl previously disallowed with shell variable curl_disallow_strerror_r,
5346dnl then HAVE_STRERROR_R will be defined, as well as one of
5347dnl HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R.
5348dnl
5349dnl glibc-style strerror_r:
5350dnl
5351dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize);
5352dnl
5353dnl glibc-style strerror_r returns a pointer to the error string,
5354dnl and might use the provided workbuf as a scratch area if needed. A
5355dnl quick test on a few systems shows that it's usually not used at all.
5356dnl
5357dnl POSIX-style strerror_r:
5358dnl
5359dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize);
5360dnl
5361dnl POSIX-style strerror_r returns 0 upon successful completion and the
5362dnl error string in the provided resultbuf.
5363dnl
5364
5365AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
5366 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
5367 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
5368 #
5369 tst_links_strerror_r="unknown"
5370 tst_proto_strerror_r="unknown"
5371 tst_compi_strerror_r="unknown"
5372 tst_glibc_strerror_r="unknown"
5373 tst_posix_strerror_r="unknown"
5374 tst_allow_strerror_r="unknown"
5375 tst_works_glibc_strerror_r="unknown"
5376 tst_works_posix_strerror_r="unknown"
5377 tst_glibc_strerror_r_type_arg3="unknown"
5378 tst_posix_strerror_r_type_arg3="unknown"
5379 #
5380 AC_MSG_CHECKING([if strerror_r can be linked])
5381 AC_LINK_IFELSE([
5382 AC_LANG_FUNC_LINK_TRY([strerror_r])
5383 ],[
5384 AC_MSG_RESULT([yes])
5385 tst_links_strerror_r="yes"
5386 ],[
5387 AC_MSG_RESULT([no])
5388 tst_links_strerror_r="no"
5389 ])
5390 #
5391 if test "$tst_links_strerror_r" = "yes"; then
5392 AC_MSG_CHECKING([if strerror_r is prototyped])
5393 AC_EGREP_CPP([strerror_r],[
5394 $curl_includes_string
5395 ],[
5396 AC_MSG_RESULT([yes])
5397 tst_proto_strerror_r="yes"
5398 ],[
5399 AC_MSG_RESULT([no])
5400 tst_proto_strerror_r="no"
5401 ])
5402 fi
5403 #
5404 if test "$tst_proto_strerror_r" = "yes"; then
5405 AC_MSG_CHECKING([if strerror_r is compilable])
5406 AC_COMPILE_IFELSE([
5407 AC_LANG_PROGRAM([[
5408 $curl_includes_string
5409 ]],[[
5410 if(0 != strerror_r(0, 0, 0))
5411 return 1;
5412 ]])
5413 ],[
5414 AC_MSG_RESULT([yes])
5415 tst_compi_strerror_r="yes"
5416 ],[
5417 AC_MSG_RESULT([no])
5418 tst_compi_strerror_r="no"
5419 ])
5420 fi
5421 #
5422 if test "$tst_compi_strerror_r" = "yes"; then
5423 AC_MSG_CHECKING([if strerror_r is glibc like])
5424 tst_glibc_strerror_r_type_arg3="unknown"
5425 for arg3 in 'size_t' 'int' 'unsigned int'; do
5426 if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then
5427 AC_COMPILE_IFELSE([
5428 AC_LANG_PROGRAM([[
5429 $curl_includes_string
5430 char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
5431 ]],[[
5432 if(0 != strerror_r(0, 0, 0))
5433 return 1;
5434 ]])
5435 ],[
5436 tst_glibc_strerror_r_type_arg3="$arg3"
5437 ])
5438 fi
5439 done
5440 case "$tst_glibc_strerror_r_type_arg3" in
5441 unknown)
5442 AC_MSG_RESULT([no])
5443 tst_glibc_strerror_r="no"
5444 ;;
5445 *)
5446 AC_MSG_RESULT([yes])
5447 tst_glibc_strerror_r="yes"
5448 ;;
5449 esac
5450 fi
5451 #
5452 dnl only do runtime verification when not cross-compiling
5453 if test "x$cross_compiling" != "xyes" &&
5454 test "$tst_glibc_strerror_r" = "yes"; then
5455 AC_MSG_CHECKING([if strerror_r seems to work])
5456 CURL_RUN_IFELSE([
5457 AC_LANG_PROGRAM([[
5458 $curl_includes_stdlib
5459 $curl_includes_string
5460# include <errno.h>
5461 ]],[[
5462 char buffer[1024];
5463 char *string = 0;
5464 buffer[0] = '\0';
5465 string = strerror_r(EACCES, buffer, sizeof(buffer));
5466 if(!string)
5467 exit(1); /* fail */
5468 if(!string[0])
5469 exit(1); /* fail */
5470 else
5471 exit(0);
5472 ]])
5473 ],[
5474 AC_MSG_RESULT([yes])
5475 tst_works_glibc_strerror_r="yes"
5476 ],[
5477 AC_MSG_RESULT([no])
5478 tst_works_glibc_strerror_r="no"
5479 ])
5480 fi
5481 #
5482 if test "$tst_compi_strerror_r" = "yes" &&
5483 test "$tst_works_glibc_strerror_r" != "yes"; then
5484 AC_MSG_CHECKING([if strerror_r is POSIX like])
5485 tst_posix_strerror_r_type_arg3="unknown"
5486 for arg3 in 'size_t' 'int' 'unsigned int'; do
5487 if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then
5488 AC_COMPILE_IFELSE([
5489 AC_LANG_PROGRAM([[
5490 $curl_includes_string
5491 int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
5492 ]],[[
5493 if(0 != strerror_r(0, 0, 0))
5494 return 1;
5495 ]])
5496 ],[
5497 tst_posix_strerror_r_type_arg3="$arg3"
5498 ])
5499 fi
5500 done
5501 case "$tst_posix_strerror_r_type_arg3" in
5502 unknown)
5503 AC_MSG_RESULT([no])
5504 tst_posix_strerror_r="no"
5505 ;;
5506 *)
5507 AC_MSG_RESULT([yes])
5508 tst_posix_strerror_r="yes"
5509 ;;
5510 esac
5511 fi
5512 #
5513 dnl only do runtime verification when not cross-compiling
5514 if test "x$cross_compiling" != "xyes" &&
5515 test "$tst_posix_strerror_r" = "yes"; then
5516 AC_MSG_CHECKING([if strerror_r seems to work])
5517 CURL_RUN_IFELSE([
5518 AC_LANG_PROGRAM([[
5519 $curl_includes_stdlib
5520 $curl_includes_string
5521# include <errno.h>
5522 ]],[[
5523 char buffer[1024];
5524 int error = 1;
5525 buffer[0] = '\0';
5526 error = strerror_r(EACCES, buffer, sizeof(buffer));
5527 if(error)
5528 exit(1); /* fail */
5529 if(buffer[0] == '\0')
5530 exit(1); /* fail */
5531 else
5532 exit(0);
5533 ]])
5534 ],[
5535 AC_MSG_RESULT([yes])
5536 tst_works_posix_strerror_r="yes"
5537 ],[
5538 AC_MSG_RESULT([no])
5539 tst_works_posix_strerror_r="no"
5540 ])
5541 fi
5542 #
5543 if test "$tst_works_glibc_strerror_r" = "yes"; then
5544 tst_posix_strerror_r="no"
5545 fi
5546 if test "$tst_works_posix_strerror_r" = "yes"; then
5547 tst_glibc_strerror_r="no"
5548 fi
5549 if test "$tst_glibc_strerror_r" = "yes" &&
5550 test "$tst_works_glibc_strerror_r" != "no" &&
5551 test "$tst_posix_strerror_r" != "yes"; then
5552 tst_allow_strerror_r="check"
5553 fi
5554 if test "$tst_posix_strerror_r" = "yes" &&
5555 test "$tst_works_posix_strerror_r" != "no" &&
5556 test "$tst_glibc_strerror_r" != "yes"; then
5557 tst_allow_strerror_r="check"
5558 fi
5559 if test "$tst_allow_strerror_r" = "check"; then
5560 AC_MSG_CHECKING([if strerror_r usage allowed])
5561 if test "x$curl_disallow_strerror_r" != "xyes"; then
5562 AC_MSG_RESULT([yes])
5563 tst_allow_strerror_r="yes"
5564 else
5565 AC_MSG_RESULT([no])
5566 tst_allow_strerror_r="no"
5567 fi
5568 fi
5569 #
5570 AC_MSG_CHECKING([if strerror_r might be used])
5571 if test "$tst_links_strerror_r" = "yes" &&
5572 test "$tst_proto_strerror_r" = "yes" &&
5573 test "$tst_compi_strerror_r" = "yes" &&
5574 test "$tst_allow_strerror_r" = "yes"; then
5575 AC_MSG_RESULT([yes])
5576 if test "$tst_glibc_strerror_r" = "yes"; then
5577 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
5578 [Define to 1 if you have the strerror_r function.])
5579 AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1,
5580 [Define to 1 if you have a working glibc-style strerror_r function.])
5581 fi
5582 if test "$tst_posix_strerror_r" = "yes"; then
5583 AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
5584 [Define to 1 if you have the strerror_r function.])
5585 AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1,
5586 [Define to 1 if you have a working POSIX-style strerror_r function.])
5587 fi
5588 curl_cv_func_strerror_r="yes"
5589 else
5590 AC_MSG_RESULT([no])
5591 curl_cv_func_strerror_r="no"
5592 fi
5593 #
5594 if test "$tst_compi_strerror_r" = "yes" &&
5595 test "$tst_allow_strerror_r" = "unknown"; then
5596 AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.])
5597 fi
5598 #
5599])
5600
5601
5602dnl CURL_CHECK_FUNC_STRICMP
5603dnl -------------------------------------------------
5604dnl Verify if stricmp is available, prototyped, and
5605dnl can be compiled. If all of these are true, and
5606dnl usage has not been previously disallowed with
5607dnl shell variable curl_disallow_stricmp, then
5608dnl HAVE_STRICMP will be defined.
5609
5610AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [
5611 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
5612 #
5613 tst_links_stricmp="unknown"
5614 tst_proto_stricmp="unknown"
5615 tst_compi_stricmp="unknown"
5616 tst_allow_stricmp="unknown"
5617 #
5618 AC_MSG_CHECKING([if stricmp can be linked])
5619 AC_LINK_IFELSE([
5620 AC_LANG_FUNC_LINK_TRY([stricmp])
5621 ],[
5622 AC_MSG_RESULT([yes])
5623 tst_links_stricmp="yes"
5624 ],[
5625 AC_MSG_RESULT([no])
5626 tst_links_stricmp="no"
5627 ])
5628 #
5629 if test "$tst_links_stricmp" = "yes"; then
5630 AC_MSG_CHECKING([if stricmp is prototyped])
5631 AC_EGREP_CPP([stricmp],[
5632 $curl_includes_string
5633 ],[
5634 AC_MSG_RESULT([yes])
5635 tst_proto_stricmp="yes"
5636 ],[
5637 AC_MSG_RESULT([no])
5638 tst_proto_stricmp="no"
5639 ])
5640 fi
5641 #
5642 if test "$tst_proto_stricmp" = "yes"; then
5643 AC_MSG_CHECKING([if stricmp is compilable])
5644 AC_COMPILE_IFELSE([
5645 AC_LANG_PROGRAM([[
5646 $curl_includes_string
5647 ]],[[
5648 if(0 != stricmp(0, 0))
5649 return 1;
5650 ]])
5651 ],[
5652 AC_MSG_RESULT([yes])
5653 tst_compi_stricmp="yes"
5654 ],[
5655 AC_MSG_RESULT([no])
5656 tst_compi_stricmp="no"
5657 ])
5658 fi
5659 #
5660 if test "$tst_compi_stricmp" = "yes"; then
5661 AC_MSG_CHECKING([if stricmp usage allowed])
5662 if test "x$curl_disallow_stricmp" != "xyes"; then
5663 AC_MSG_RESULT([yes])
5664 tst_allow_stricmp="yes"
5665 else
5666 AC_MSG_RESULT([no])
5667 tst_allow_stricmp="no"
5668 fi
5669 fi
5670 #
5671 AC_MSG_CHECKING([if stricmp might be used])
5672 if test "$tst_links_stricmp" = "yes" &&
5673 test "$tst_proto_stricmp" = "yes" &&
5674 test "$tst_compi_stricmp" = "yes" &&
5675 test "$tst_allow_stricmp" = "yes"; then
5676 AC_MSG_RESULT([yes])
5677 AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
5678 [Define to 1 if you have the stricmp function.])
5679 curl_cv_func_stricmp="yes"
5680 else
5681 AC_MSG_RESULT([no])
5682 curl_cv_func_stricmp="no"
5683 fi
5684])
5685
5686
5687dnl CURL_CHECK_FUNC_STRTOK_R
5688dnl -------------------------------------------------
5689dnl Verify if strtok_r is available, prototyped, and
5690dnl can be compiled. If all of these are true, and
5691dnl usage has not been previously disallowed with
5692dnl shell variable curl_disallow_strtok_r, then
5693dnl HAVE_STRTOK_R will be defined.
5694
5695AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
5696 AC_REQUIRE([CURL_INCLUDES_STRING])dnl
5697 #
5698 tst_links_strtok_r="unknown"
5699 tst_proto_strtok_r="unknown"
5700 tst_compi_strtok_r="unknown"
5701 tst_allow_strtok_r="unknown"
5702 #
5703 AC_MSG_CHECKING([if strtok_r can be linked])
5704 AC_LINK_IFELSE([
5705 AC_LANG_FUNC_LINK_TRY([strtok_r])
5706 ],[
5707 AC_MSG_RESULT([yes])
5708 tst_links_strtok_r="yes"
5709 ],[
5710 AC_MSG_RESULT([no])
5711 tst_links_strtok_r="no"
5712 ])
5713 #
5714 if test "$tst_links_strtok_r" = "yes"; then
5715 AC_MSG_CHECKING([if strtok_r is prototyped])
5716 AC_EGREP_CPP([strtok_r],[
5717 $curl_includes_string
5718 ],[
5719 AC_MSG_RESULT([yes])
5720 tst_proto_strtok_r="yes"
5721 ],[
5722 AC_MSG_RESULT([no])
5723 tst_proto_strtok_r="no"
5724 ])
5725 fi
5726 #
5727 if test "$tst_proto_strtok_r" = "yes"; then
5728 AC_MSG_CHECKING([if strtok_r is compilable])
5729 AC_COMPILE_IFELSE([
5730 AC_LANG_PROGRAM([[
5731 $curl_includes_string
5732 ]],[[
5733 if(0 != strtok_r(0, 0, 0))
5734 return 1;
5735 ]])
5736 ],[
5737 AC_MSG_RESULT([yes])
5738 tst_compi_strtok_r="yes"
5739 ],[
5740 AC_MSG_RESULT([no])
5741 tst_compi_strtok_r="no"
5742 ])
5743 fi
5744 #
5745 if test "$tst_compi_strtok_r" = "yes"; then
5746 AC_MSG_CHECKING([if strtok_r usage allowed])
5747 if test "x$curl_disallow_strtok_r" != "xyes"; then
5748 AC_MSG_RESULT([yes])
5749 tst_allow_strtok_r="yes"
5750 else
5751 AC_MSG_RESULT([no])
5752 tst_allow_strtok_r="no"
5753 fi
5754 fi
5755 #
5756 AC_MSG_CHECKING([if strtok_r might be used])
5757 if test "$tst_links_strtok_r" = "yes" &&
5758 test "$tst_proto_strtok_r" = "yes" &&
5759 test "$tst_compi_strtok_r" = "yes" &&
5760 test "$tst_allow_strtok_r" = "yes"; then
5761 AC_MSG_RESULT([yes])
5762 AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
5763 [Define to 1 if you have the strtok_r function.])
5764 curl_cv_func_strtok_r="yes"
5765 else
5766 AC_MSG_RESULT([no])
5767 curl_cv_func_strtok_r="no"
5768 fi
5769])
5770
5771
5772dnl CURL_CHECK_FUNC_STRTOLL
5773dnl -------------------------------------------------
5774dnl Verify if strtoll is available, prototyped, and
5775dnl can be compiled. If all of these are true, and
5776dnl usage has not been previously disallowed with
5777dnl shell variable curl_disallow_strtoll, then
5778dnl HAVE_STRTOLL will be defined.
5779
5780AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
5781 AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
5782 #
5783 tst_links_strtoll="unknown"
5784 tst_proto_strtoll="unknown"
5785 tst_compi_strtoll="unknown"
5786 tst_allow_strtoll="unknown"
5787 #
5788 AC_MSG_CHECKING([if strtoll can be linked])
5789 AC_LINK_IFELSE([
5790 AC_LANG_FUNC_LINK_TRY([strtoll])
5791 ],[
5792 AC_MSG_RESULT([yes])
5793 tst_links_strtoll="yes"
5794 ],[
5795 AC_MSG_RESULT([no])
5796 tst_links_strtoll="no"
5797 ])
5798 #
5799 if test "$tst_links_strtoll" = "yes"; then
5800 AC_MSG_CHECKING([if strtoll is prototyped])
5801 AC_EGREP_CPP([strtoll],[
5802 $curl_includes_stdlib
5803 ],[
5804 AC_MSG_RESULT([yes])
5805 tst_proto_strtoll="yes"
5806 ],[
5807 AC_MSG_RESULT([no])
5808 tst_proto_strtoll="no"
5809 ])
5810 fi
5811 #
5812 if test "$tst_proto_strtoll" = "yes"; then
5813 AC_MSG_CHECKING([if strtoll is compilable])
5814 AC_COMPILE_IFELSE([
5815 AC_LANG_PROGRAM([[
5816 $curl_includes_stdlib
5817 ]],[[
5818 if(0 != strtoll(0, 0, 0))
5819 return 1;
5820 ]])
5821 ],[
5822 AC_MSG_RESULT([yes])
5823 tst_compi_strtoll="yes"
5824 ],[
5825 AC_MSG_RESULT([no])
5826 tst_compi_strtoll="no"
5827 ])
5828 fi
5829 #
5830 if test "$tst_compi_strtoll" = "yes"; then
5831 AC_MSG_CHECKING([if strtoll usage allowed])
5832 if test "x$curl_disallow_strtoll" != "xyes"; then
5833 AC_MSG_RESULT([yes])
5834 tst_allow_strtoll="yes"
5835 else
5836 AC_MSG_RESULT([no])
5837 tst_allow_strtoll="no"
5838 fi
5839 fi
5840 #
5841 AC_MSG_CHECKING([if strtoll might be used])
5842 if test "$tst_links_strtoll" = "yes" &&
5843 test "$tst_proto_strtoll" = "yes" &&
5844 test "$tst_compi_strtoll" = "yes" &&
5845 test "$tst_allow_strtoll" = "yes"; then
5846 AC_MSG_RESULT([yes])
5847 AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
5848 [Define to 1 if you have the strtoll function.])
5849 curl_cv_func_strtoll="yes"
5850 else
5851 AC_MSG_RESULT([no])
5852 curl_cv_func_strtoll="no"
5853 fi
5854])
5855
5856dnl CURL_RUN_IFELSE
5857dnl -------------------------------------------------
5858dnl Wrapper macro to use instead of AC_RUN_IFELSE. It
5859dnl sets LD_LIBRARY_PATH locally for this run only, from the
5860dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH
5861dnl changes contained within this macro.
5862
5863AC_DEFUN([CURL_RUN_IFELSE], [
5864 case $host_os in
5865 darwin*)
5866 AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
5867 ;;
5868 *)
5869 old=$LD_LIBRARY_PATH
5870 LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old
5871 export LD_LIBRARY_PATH
5872 AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
5873 LD_LIBRARY_PATH=$old # restore
5874 ;;
5875 esac
5876])
5877
5878dnl CURL_COVERAGE
5879dnl --------------------------------------------------
5880dnl Switch on options and libs to build with gcc's code coverage.
5881dnl
5882
5883AC_DEFUN([CURL_COVERAGE],[
5884 AC_REQUIRE([AC_PROG_SED])
5885 AC_REQUIRE([AC_ARG_ENABLE])
5886 AC_MSG_CHECKING([for code coverage support])
5887 coverage="no"
5888 curl_coverage_msg="disabled"
5889
5890 dnl check if enabled by argument
5891 AC_ARG_ENABLE(code-coverage,
5892 AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]),
5893 coverage="$enableval")
5894
5895 dnl if not gcc switch off again
5896 AS_IF([ test "$GCC" != "yes" ], coverage="no" )
5897 AC_MSG_RESULT($coverage)
5898
5899 if test "x$coverage" = "xyes"; then
5900 curl_coverage_msg="enabled"
5901
5902 AC_CHECK_TOOL([GCOV], [gcov], [gcov])
5903 if test -z "$GCOV"; then
5904 AC_MSG_ERROR([needs gcov for code coverage])
5905 fi
5906 AC_CHECK_PROG([LCOV], [lcov], [lcov])
5907 if test -z "$LCOV"; then
5908 AC_MSG_ERROR([needs lcov for code coverage])
5909 fi
5910
5911 CPPFLAGS="$CPPFLAGS -DNDEBUG"
5912 CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
5913 LIBS="$LIBS -lgcov"
5914 fi
5915])
5916
5917dnl CURL_ATOMIC
5918dnl -------------------------------------------------------------
5919dnl Check if _Atomic works. But only check if stdatomic.h exists.
5920dnl
5921AC_DEFUN([CURL_ATOMIC],[
5922 AC_CHECK_HEADERS(stdatomic.h, [
5923 AC_MSG_CHECKING([if _Atomic is available])
5924 AC_LINK_IFELSE([
5925 AC_LANG_PROGRAM([[
5926 $curl_includes_unistd
5927 ]],[[
5928 _Atomic int i = 0;
5929 i = 4; // Force an atomic-write operation.
5930 ]])
5931 ],[
5932 AC_MSG_RESULT([yes])
5933 AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
5934 [Define to 1 if you have _Atomic support.])
5935 tst_atomic="yes"
5936 ],[
5937 AC_MSG_RESULT([no])
5938 tst_atomic="no"
5939 ])
5940 ])
5941])
5942
5943# Rewrite inspired by the functionality once provided by
5944# AX_COMPILE_CHECK_SIZEOF. Uses the switch() "trick" to find the size of the
5945# given type.
5946#
5947# This code fails to compile:
5948#
5949# switch() { case 0: case 0: }
5950#
5951# By making the second case number a boolean check, it fails to compile the
5952# test code when the boolean is false and thus creating a zero, making it a
5953# duplicated case label. If the boolean equals true, it becomes a one, the
5954# code compiles and we know it was a match.
5955#
5956# The check iterates over all possible sizes and stops as soon it compiles
5957# error-free.
5958#
5959# Usage:
5960#
5961# CURL_SIZEOF(TYPE, [HEADERS])
5962#
5963
5964AC_DEFUN([CURL_SIZEOF], [
5965 dnl The #define name to make autoheader put the name in curl_config.h.in
5966 define(TYPE, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
5967
5968 AC_MSG_CHECKING(size of $1)
5969 r=0
5970 dnl Check the sizes in a reasonable order
5971 for typesize in 8 4 2 16 1; do
5972 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
5973#include <sys/types.h>
5974$2
5975]],
5976 [switch(0) {
5977 case 0:
5978 case (sizeof($1) == $typesize):;
5979 }
5980 ]) ],
5981 [
5982 r=$typesize],
5983 [
5984 r=0])
5985 dnl get out of the loop once matched
5986 if test $r -gt 0; then
5987 break;
5988 fi
5989 done
5990 if test $r -eq 0; then
5991 AC_MSG_ERROR([Failed to find size of $1])
5992 fi
5993 AC_MSG_RESULT($r)
5994 dnl lowercase and underscore instead of space
5995 tname=$(echo "ac_cv_sizeof_$1" | tr A-Z a-z | tr " " "_")
5996 eval "$tname=$r"
5997
5998 AC_DEFINE_UNQUOTED(TYPE, [$r], [Size of $1 in number of bytes])
5999
6000])