Artifactspublic-v0

curl

master
ply4 git calls478 ms298 KiB2 cachedprotocol v2
1530 lines42 KiBRaw
1#***************************************************************************
2# _ _ ____ _
3# Project ___| | | | _ \| |
4# / __| | | | |_) | |
5# | (__| |_| | _ <| |___
6# \___|\___/|_| \_\_____|
7#
8# Copyright (C) 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.
14# You may opt to use, copy, modify, merge, publish, distribute and/or sell
15# copies of the Software, and permit persons to whom the Software is
16# furnished to do so, under the terms of the COPYING file.
18# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19# KIND, either express or implied.
21# SPDX-License-Identifier: curl
23#***************************************************************************
25dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
26dnl -------------------------------------------------
27dnl Use the C preprocessor to find out if the given object-style symbol
28dnl is defined and get its expansion. This macro does not use default
29dnl includes even if no INCLUDES argument is given. This macro runs
30dnl silently when invoked with three arguments. If the expansion would
31dnl result in a set of double-quoted strings the returned expansion is
32dnl actually a single double-quoted string concatenating all them.
34AC_DEFUN([CURL_CHECK_DEF], [
35 AC_REQUIRE([CURL_CPP_P])
36 OLDCPPFLAGS=$CPPFLAGS
37 dnl CPPPFLAG comes from CURL_CPP_P
38 CPPFLAGS="$CPPFLAGS $CPPPFLAG"
39 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])
40 AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])
41 if test -z "$SED"; then
42 AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
43 fi
44 if test -z "$GREP"; then
45 AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
46 fi
47 ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
48 tmp_exp=""
49 AC_PREPROC_IFELSE([
50 AC_LANG_SOURCE(
51 ifelse($2,,,[$2])[[
52 #ifdef $1
53 CURL_DEF_TOKEN $1
54 #endif
55 ]])
56 ],[
57 tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
58 "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
59 "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
60 "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
61 if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
62 tmp_exp=""
63 fi
64 ])
65 if test -z "$tmp_exp"; then
66 AS_VAR_SET(ac_HaveDef, no)
67 ifelse($3,,[AC_MSG_RESULT([no])])
68 else
69 AS_VAR_SET(ac_HaveDef, yes)
70 AS_VAR_SET(ac_Def, $tmp_exp)
71 ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
72 fi
73 AS_VAR_POPDEF([ac_Def])
74 AS_VAR_POPDEF([ac_HaveDef])
75 CPPFLAGS=$OLDCPPFLAGS
76])
79dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
80dnl -------------------------------------------------
81dnl Use the C compiler to find out only if the given symbol is defined
82dnl or not, this can not find out its expansion. This macro does not use
83dnl default includes even if no INCLUDES argument is given. This macro
84dnl runs silently when invoked with three arguments.
86AC_DEFUN([CURL_CHECK_DEF_CC], [
87 AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])
88 ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
89 AC_COMPILE_IFELSE([
90 AC_LANG_SOURCE(
91 ifelse($2,,,[$2])[[
92 int main(void)
93 {
94 #ifndef $1
95 #error force compilation error
96 #endif
97 return 0;
98 }
99 ]])
100 ],[
101 tst_symbol_defined="yes"
102 ],[
103 tst_symbol_defined="no"
104 ])
105 if test "$tst_symbol_defined" = "yes"; then
106 AS_VAR_SET(ac_HaveDef, yes)
107 ifelse($3,,[AC_MSG_RESULT([yes])])
108 else
109 AS_VAR_SET(ac_HaveDef, no)
110 ifelse($3,,[AC_MSG_RESULT([no])])
111 fi
112 AS_VAR_POPDEF([ac_HaveDef])
113])
116dnl CURL_CHECK_LIB_XNET
117dnl -------------------------------------------------
118dnl Verify if X/Open network library is required.
120AC_DEFUN([CURL_CHECK_LIB_XNET], [
121 AC_MSG_CHECKING([if X/Open network library is required])
122 tst_lib_xnet_required="no"
123 AC_COMPILE_IFELSE([
124 AC_LANG_SOURCE([[
125 int main(void)
126 {
127 #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
128 #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
129 #else
130 #error force compilation error
131 #endif
132 return 0;
133 }
134 ]])
135 ],[
136 tst_lib_xnet_required="yes"
137 LIBS="-lxnet $LIBS"
138 ])
139 AC_MSG_RESULT([$tst_lib_xnet_required])
140])
143dnl CURL_CHECK_AIX_ALL_SOURCE
144dnl -------------------------------------------------
145dnl Provides a replacement of traditional AC_AIX with
146dnl an uniform behavior across all autoconf versions,
147dnl and with our own placement rules.
149AC_DEFUN([CURL_CHECK_AIX_ALL_SOURCE], [
150 AH_VERBATIM([_ALL_SOURCE],
151 [/* Define to 1 if OS is AIX. */
152#ifndef _ALL_SOURCE
153# undef _ALL_SOURCE
154#endif])
155 AC_BEFORE([$0], [AC_SYS_LARGEFILE])
156 AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])
157 AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
158 AC_EGREP_CPP([yes_this_is_aix],[
159#ifdef _AIX
160 yes_this_is_aix
161#endif
162 ],[
163 AC_MSG_RESULT([yes])
164 AC_DEFINE(_ALL_SOURCE)
165 ],[
166 AC_MSG_RESULT([no])
167 ])
168])
171dnl CURL_CHECK_NATIVE_WINDOWS
172dnl -------------------------------------------------
173dnl Check if building a native Windows target
175AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
176 AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
177 AC_COMPILE_IFELSE([
178 AC_LANG_PROGRAM([[
179 ]],[[
180 #ifdef _WIN32
181 int dummy = 1;
182 (void)dummy;
183 #else
184 #error Not a native Windows build target.
185 #endif
186 ]])
187 ],[
188 curl_cv_native_windows="yes"
189 ],[
190 curl_cv_native_windows="no"
191 ])
192 ])
193 AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "$curl_cv_native_windows" = "yes")
194])
197dnl CURL_CHECK_HEADER_LBER
198dnl -------------------------------------------------
199dnl Check for compilable and valid lber.h header,
200dnl and check if it is needed even with ldap.h
202AC_DEFUN([CURL_CHECK_HEADER_LBER], [
203 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
204 AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
205 AC_COMPILE_IFELSE([
206 AC_LANG_PROGRAM([[
207 #undef inline
208 #ifdef _WIN32
209 #ifndef WIN32_LEAN_AND_MEAN
210 #define WIN32_LEAN_AND_MEAN
211 #endif
212 #include <windows.h>
213 #else
214 #ifdef HAVE_SYS_TYPES_H
215 #include <sys/types.h>
216 #endif
217 #endif
218 #ifndef NULL
219 #define NULL (void *)0
220 #endif
221 #include <lber.h>
222 ]],[[
223 BerValue *bvp = NULL;
224 BerElement *bep = ber_init(bvp);
225 ber_free(bep, 1);
226 ]])
227 ],[
228 curl_cv_header_lber_h="yes"
229 ],[
230 curl_cv_header_lber_h="no"
231 ])
232 ])
233 if test "$curl_cv_header_lber_h" = "yes"; then
234 AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
235 [Define to 1 if you have the lber.h header file.])
237 AC_COMPILE_IFELSE([
238 AC_LANG_PROGRAM([[
239 #undef inline
240 #ifdef _WIN32
241 #ifndef WIN32_LEAN_AND_MEAN
242 #define WIN32_LEAN_AND_MEAN
243 #endif
244 #include <windows.h>
245 #else
246 #ifdef HAVE_SYS_TYPES_H
247 #include <sys/types.h>
248 #endif
249 #endif
250 #ifndef NULL
251 #define NULL (void *)0
252 #endif
253 #ifndef LDAP_DEPRECATED
254 #define LDAP_DEPRECATED 1
255 #endif
256 #include <ldap.h>
257 ]],[[
258 BerValue *bvp = NULL;
259 BerElement *bep = ber_init(bvp);
260 ber_free(bep, 1);
261 ]])
262 ],[
263 curl_cv_need_header_lber_h="no"
264 ],[
265 curl_cv_need_header_lber_h="yes"
266 ])
268 case "$curl_cv_need_header_lber_h" in
269 yes)
270 AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
271 [Define to 1 if you need the lber.h header file even with ldap.h])
272 ;;
273 esac
274 fi
275])
278dnl CURL_CHECK_HEADER_LDAP
279dnl -------------------------------------------------
280dnl Check for compilable and valid ldap.h header
282AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
283 AC_REQUIRE([CURL_CHECK_HEADER_LBER])
284 AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
285 AC_COMPILE_IFELSE([
286 AC_LANG_PROGRAM([[
287 #undef inline
288 #ifdef _WIN32
289 #ifndef WIN32_LEAN_AND_MEAN
290 #define WIN32_LEAN_AND_MEAN
291 #endif
292 #include <windows.h>
293 #else
294 #ifdef HAVE_SYS_TYPES_H
295 #include <sys/types.h>
296 #endif
297 #endif
298 #ifndef LDAP_DEPRECATED
299 #define LDAP_DEPRECATED 1
300 #endif
301 #ifdef NEED_LBER_H
302 #include <lber.h>
303 #endif
304 #include <ldap.h>
305 ]],[[
306 LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
307 int res = ldap_unbind(ldp);
308 (void)res;
309 ]])
310 ],[
311 curl_cv_header_ldap_h="yes"
312 ],[
313 curl_cv_header_ldap_h="no"
314 ])
315 ])
316 case "$curl_cv_header_ldap_h" in
317 yes)
318 AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
319 [Define to 1 if you have the ldap.h header file.])
320 ;;
321 esac
322])
325dnl CURL_CHECK_HEADER_LDAP_SSL
326dnl -------------------------------------------------
327dnl Check for compilable and valid ldap_ssl.h header
329AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
330 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])
331 AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
332 AC_COMPILE_IFELSE([
333 AC_LANG_PROGRAM([[
334 #undef inline
335 #ifdef _WIN32
336 #ifndef WIN32_LEAN_AND_MEAN
337 #define WIN32_LEAN_AND_MEAN
338 #endif
339 #include <windows.h>
340 #else
341 #ifdef HAVE_SYS_TYPES_H
342 #include <sys/types.h>
343 #endif
344 #endif
345 #ifndef LDAP_DEPRECATED
346 #define LDAP_DEPRECATED 1
347 #endif
348 #ifdef NEED_LBER_H
349 #include <lber.h>
350 #endif
351 #ifdef HAVE_LDAP_H
352 #include <ldap.h>
353 #endif
354 #include <ldap_ssl.h>
355 ]],[[
356 LDAP *ldp = ldapssl_init("0.0.0.0", LDAPS_PORT, 1);
357 (void)ldp;
358 ]])
359 ],[
360 curl_cv_header_ldap_ssl_h="yes"
361 ],[
362 curl_cv_header_ldap_ssl_h="no"
363 ])
364 ])
365 case "$curl_cv_header_ldap_ssl_h" in
366 yes)
367 AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
368 [Define to 1 if you have the ldap_ssl.h header file.])
369 ;;
370 esac
371])
374dnl CURL_CHECK_LIBS_WINLDAP
375dnl -------------------------------------------------
376dnl Check for libraries needed for WINLDAP support,
377dnl and prepended to LIBS any needed libraries.
378dnl This macro can take an optional parameter with a
379dnl whitespace separated list of libraries to check
380dnl before the WINLDAP default ones.
382AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
383 AC_REQUIRE([CURL_CHECK_HEADER_WINBER])
385 AC_MSG_CHECKING([for WINLDAP libraries])
387 u_libs=""
389 ifelse($1,,,[
390 for x_lib in $1; do
391 case "$x_lib" in
392 -l*)
393 l_lib="$x_lib"
394 ;;
395 *)
396 l_lib="-l$x_lib"
397 ;;
398 esac
399 if test -z "$u_libs"; then
400 u_libs="$l_lib"
401 else
402 u_libs="$u_libs $l_lib"
403 fi
404 done
405 ])
407 curl_cv_save_LIBS="$LIBS"
408 curl_cv_ldap_LIBS="unknown"
410 for x_nlibs in '' "$u_libs" \
411 '-lwldap32' ; do
412 if test "$curl_cv_ldap_LIBS" = "unknown"; then
413 if test -z "$x_nlibs"; then
414 LIBS="$curl_cv_save_LIBS"
415 else
416 LIBS="$x_nlibs $curl_cv_save_LIBS"
417 fi
418 AC_LINK_IFELSE([
419 AC_LANG_PROGRAM([[
420 #undef inline
421 #ifdef _WIN32
422 #ifndef WIN32_LEAN_AND_MEAN
423 #define WIN32_LEAN_AND_MEAN
424 #endif
425 #include <windows.h>
426 #include <winldap.h>
427 #ifdef HAVE_WINBER_H
428 #include <winber.h>
429 #endif
430 #endif
431 ]],[[
432 BERVAL *bvp = NULL;
433 BerElement *bep = ber_init(bvp);
434 LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
435 ULONG res = ldap_unbind(ldp);
436 ber_free(bep, 1);
437 (void)res;
438 ]])
439 ],[
440 curl_cv_ldap_LIBS="$x_nlibs"
441 ])
442 fi
443 done
445 LIBS="$curl_cv_save_LIBS"
447 case X-"$curl_cv_ldap_LIBS" in
448 X-unknown)
449 AC_MSG_RESULT([cannot find WINLDAP libraries])
450 ;;
451 X-)
452 AC_MSG_RESULT([no additional lib required])
453 ;;
454 *)
455 if test -z "$curl_cv_save_LIBS"; then
456 LIBS="$curl_cv_ldap_LIBS"
457 else
458 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
459 fi
460 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
461 ;;
462 esac
463])
466dnl CURL_CHECK_LIBS_LDAP
467dnl -------------------------------------------------
468dnl Check for libraries needed for LDAP support,
469dnl and prepended to LIBS any needed libraries.
470dnl This macro can take an optional parameter with a
471dnl whitespace separated list of libraries to check
472dnl before the default ones.
474AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
475 AC_REQUIRE([CURL_CHECK_HEADER_LDAP])
477 AC_MSG_CHECKING([for LDAP libraries])
479 u_libs=""
481 ifelse($1,,,[
482 for x_lib in $1; do
483 case "$x_lib" in
484 -l*)
485 l_lib="$x_lib"
486 ;;
487 *)
488 l_lib="-l$x_lib"
489 ;;
490 esac
491 if test -z "$u_libs"; then
492 u_libs="$l_lib"
493 else
494 u_libs="$u_libs $l_lib"
495 fi
496 done
497 ])
499 curl_cv_save_LIBS="$LIBS"
500 curl_cv_ldap_LIBS="unknown"
502 for x_nlibs in '' "$u_libs" \
503 '-lldap' \
504 '-lldap -llber' \
505 '-llber -lldap' \
506 '-lldapssl -lldapx -lldapsdk' \
507 '-lldapsdk -lldapx -lldapssl' \
508 '-lldap -llber -lssl -lcrypto'; do
510 if test "$curl_cv_ldap_LIBS" = "unknown"; then
511 if test -z "$x_nlibs"; then
512 LIBS="$curl_cv_save_LIBS"
513 else
514 LIBS="$x_nlibs $curl_cv_save_LIBS"
515 fi
516 AC_LINK_IFELSE([
517 AC_LANG_PROGRAM([[
518 #undef inline
519 #ifdef _WIN32
520 #ifndef WIN32_LEAN_AND_MEAN
521 #define WIN32_LEAN_AND_MEAN
522 #endif
523 #include <windows.h>
524 #else
525 #ifdef HAVE_SYS_TYPES_H
526 #include <sys/types.h>
527 #endif
528 #endif
529 #ifndef NULL
530 #define NULL (void *)0
531 #endif
532 #ifndef LDAP_DEPRECATED
533 #define LDAP_DEPRECATED 1
534 #endif
535 #ifdef NEED_LBER_H
536 #include <lber.h>
537 #endif
538 #ifdef HAVE_LDAP_H
539 #include <ldap.h>
540 #endif
541 ]],[[
542 BerValue *bvp = NULL;
543 BerElement *bep = ber_init(bvp);
544 LDAP *ldp = ldap_init("0.0.0.0", LDAP_PORT);
545 int res = ldap_unbind(ldp);
546 ber_free(bep, 1);
547 (void)res;
548 ]])
549 ],[
550 curl_cv_ldap_LIBS="$x_nlibs"
551 ])
552 fi
553 done
555 LIBS="$curl_cv_save_LIBS"
557 case X-"$curl_cv_ldap_LIBS" in
558 X-unknown)
559 AC_MSG_RESULT([cannot find LDAP libraries])
560 ;;
561 X-)
562 AC_MSG_RESULT([no additional lib required])
563 ;;
564 *)
565 if test -z "$curl_cv_save_LIBS"; then
566 LIBS="$curl_cv_ldap_LIBS"
567 else
568 LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
569 fi
570 dnl FIXME: Enable when ldap was detected via pkg-config
571 if false; then
572 LIBCURL_PC_REQUIRES_PRIVATE="ldap $LIBCURL_PC_REQUIRES_PRIVATE"
573 fi
574 AC_MSG_RESULT([$curl_cv_ldap_LIBS])
575 ;;
576 esac
577])
580dnl TYPE_SOCKADDR_STORAGE
581dnl -------------------------------------------------
582dnl Check for struct sockaddr_storage. Most IPv6-enabled
583dnl hosts have it, but AIX 4.3 is one known exception.
585AC_DEFUN([TYPE_SOCKADDR_STORAGE],
587 AC_CHECK_TYPE([struct sockaddr_storage],
588 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
589 [if struct sockaddr_storage is defined]), ,
590 [
591 #undef inline
592 #ifdef _WIN32
593 #ifndef WIN32_LEAN_AND_MEAN
594 #define WIN32_LEAN_AND_MEAN
595 #endif
596 #include <winsock2.h>
597 #else
598 #ifdef HAVE_SYS_TYPES_H
599 #include <sys/types.h>
600 #endif
601 #include <sys/socket.h>
602 #ifdef HAVE_NETINET_IN_H
603 #include <netinet/in.h>
604 #endif
605 #ifdef HAVE_ARPA_INET_H
606 #include <arpa/inet.h>
607 #endif
608 #endif
609 ])
610])
612dnl CURL_CHECK_FUNC_RECV
613dnl -------------------------------------------------
614dnl Test if the socket recv() function is available,
616AC_DEFUN([CURL_CHECK_FUNC_RECV], [
617 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
618 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
619 AC_CHECK_HEADERS(sys/types.h)
621 AC_MSG_CHECKING([for recv])
622 AC_LINK_IFELSE([
623 AC_LANG_PROGRAM([[
624 #undef inline
625 #ifdef _WIN32
626 #ifndef WIN32_LEAN_AND_MEAN
627 #define WIN32_LEAN_AND_MEAN
628 #endif
629 #include <winsock2.h>
630 #else
631 $curl_includes_bsdsocket
632 #ifdef HAVE_SYS_TYPES_H
633 #include <sys/types.h>
634 #endif
635 #include <sys/socket.h>
636 #endif
637 ]],[[
638 recv(0, 0, 0, 0);
639 ]])
640 ],[
641 AC_MSG_RESULT([yes])
642 curl_cv_recv="yes"
643 ],[
644 AC_MSG_RESULT([no])
645 curl_cv_recv="no"
646 ])
648 if test "$curl_cv_recv" = "yes"; then
649 AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
650 [Define to 1 if you have the recv function.])
651 curl_cv_func_recv="yes"
652 else
653 AC_MSG_ERROR([Unable to link function recv])
654 fi
655])
658dnl CURL_CHECK_FUNC_SEND
659dnl -------------------------------------------------
660dnl Test if the socket send() function is available,
662AC_DEFUN([CURL_CHECK_FUNC_SEND], [
663 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
664 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
665 AC_CHECK_HEADERS(sys/types.h)
667 AC_MSG_CHECKING([for send])
668 AC_LINK_IFELSE([
669 AC_LANG_PROGRAM([[
670 #undef inline
671 #ifdef _WIN32
672 #ifndef WIN32_LEAN_AND_MEAN
673 #define WIN32_LEAN_AND_MEAN
674 #endif
675 #include <winsock2.h>
676 #else
677 $curl_includes_bsdsocket
678 #ifdef HAVE_SYS_TYPES_H
679 #include <sys/types.h>
680 #endif
681 #include <sys/socket.h>
682 #endif
683 ]],[[
684 char s[] = "";
685 send(0, (void *)s, 0, 0);
686 ]])
687 ],[
688 AC_MSG_RESULT([yes])
689 curl_cv_send="yes"
690 ],[
691 AC_MSG_RESULT([no])
692 curl_cv_send="no"
693 ])
695 if test "$curl_cv_send" = "yes"; then
696 AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
697 [Define to 1 if you have the send function.])
698 curl_cv_func_send="yes"
699 else
700 AC_MSG_ERROR([Unable to link function send])
701 fi
702])
705dnl CURL_CHECK_STRUCT_TIMEVAL
706dnl -------------------------------------------------
707dnl Check for timeval struct
709AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
710 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
711 AC_CHECK_HEADERS(sys/types.h)
712 AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
713 AC_COMPILE_IFELSE([
714 AC_LANG_PROGRAM([[
715 #undef inline
716 #ifdef _WIN32
717 #ifndef WIN32_LEAN_AND_MEAN
718 #define WIN32_LEAN_AND_MEAN
719 #endif
720 #include <winsock2.h>
721 #else
722 #include <sys/socket.h>
723 #include <sys/time.h>
724 #endif
725 #ifdef HAVE_SYS_TYPES_H
726 #include <sys/types.h>
727 #endif
728 #include <time.h>
729 ]],[[
730 struct timeval ts;
731 ts.tv_sec = 0;
732 ts.tv_usec = 0;
733 (void)ts;
734 ]])
735 ],[
736 curl_cv_struct_timeval="yes"
737 ],[
738 curl_cv_struct_timeval="no"
739 ])
740 ])
741 case "$curl_cv_struct_timeval" in
742 yes)
743 AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
744 [Define to 1 if you have the timeval struct.])
745 ;;
746 esac
747])
750dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
751dnl -------------------------------------------------
752dnl Check if monotonic clock_gettime is available.
754AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
755 AC_CHECK_HEADERS(sys/types.h)
756 AC_MSG_CHECKING([for monotonic clock_gettime])
758 AC_COMPILE_IFELSE([
759 AC_LANG_PROGRAM([[
760 #ifdef HAVE_SYS_TYPES_H
761 #include <sys/types.h>
762 #endif
763 #ifndef _WIN32
764 #include <sys/time.h>
765 #endif
766 #include <time.h>
767 ]],[[
768 struct timespec ts;
769 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
770 (void)ts;
771 ]])
772 ],[
773 AC_MSG_RESULT([yes])
774 curl_func_clock_gettime="yes"
775 ],[
776 AC_MSG_RESULT([no])
777 curl_func_clock_gettime="no"
778 ])
780 dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
781 dnl until library linking and runtime checks for clock_gettime succeed.
782])
784dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW
785dnl -------------------------------------------------
786dnl Check if monotonic clock_gettime is available.
788AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC_RAW], [
789 AC_CHECK_HEADERS(sys/types.h)
790 AC_MSG_CHECKING([for raw monotonic clock_gettime])
792 AC_COMPILE_IFELSE([
793 AC_LANG_PROGRAM([[
794 #ifdef HAVE_SYS_TYPES_H
795 #include <sys/types.h>
796 #endif
797 #ifndef _WIN32
798 #include <sys/time.h>
799 #endif
800 #include <time.h>
801 ]],[[
802 struct timespec ts;
803 (void)clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
804 (void)ts;
805 ]])
806 ],[
807 AC_MSG_RESULT([yes])
808 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC_RAW, 1,
809 [Define to 1 if you have the clock_gettime function and raw monotonic timer.])
810 ],[
811 AC_MSG_RESULT([no])
812 ])
813])
816dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
817dnl -------------------------------------------------
818dnl If monotonic clock_gettime is available then,
819dnl check and prepended to LIBS any needed libraries.
821AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
822 AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])
824 if test "$curl_func_clock_gettime" = "yes"; then
826 AC_MSG_CHECKING([for clock_gettime in libraries])
828 curl_cv_save_LIBS="$LIBS"
829 curl_cv_gclk_LIBS="unknown"
831 for x_xlibs in '' '-lrt' '-lposix4' ; do
832 if test "$curl_cv_gclk_LIBS" = "unknown"; then
833 if test -z "$x_xlibs"; then
834 LIBS="$curl_cv_save_LIBS"
835 else
836 LIBS="$x_xlibs $curl_cv_save_LIBS"
837 fi
838 AC_LINK_IFELSE([
839 AC_LANG_PROGRAM([[
840 #ifdef HAVE_SYS_TYPES_H
841 #include <sys/types.h>
842 #endif
843 #ifndef _WIN32
844 #include <sys/time.h>
845 #endif
846 #include <time.h>
847 ]],[[
848 struct timespec ts;
849 (void)clock_gettime(CLOCK_MONOTONIC, &ts);
850 (void)ts;
851 ]])
852 ],[
853 curl_cv_gclk_LIBS="$x_xlibs"
854 ])
855 fi
856 done
858 LIBS="$curl_cv_save_LIBS"
860 case X-"$curl_cv_gclk_LIBS" in
861 X-unknown)
862 AC_MSG_RESULT([cannot find clock_gettime])
863 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
864 curl_func_clock_gettime="no"
865 ;;
866 X-)
867 AC_MSG_RESULT([no additional lib required])
868 curl_func_clock_gettime="yes"
869 ;;
870 *)
871 if test "$dontwant_rt" = "yes"; then
872 AC_MSG_WARN([needs -lrt but asked not to use it, HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
873 curl_func_clock_gettime="no"
874 else
875 if test -z "$curl_cv_save_LIBS"; then
876 LIBS="$curl_cv_gclk_LIBS"
877 else
878 LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
879 fi
880 AC_MSG_RESULT([$curl_cv_gclk_LIBS])
881 curl_func_clock_gettime="yes"
882 fi
883 ;;
884 esac
886 dnl only do runtime verification when not cross-compiling
887 if test "$cross_compiling" != "yes" &&
888 test "$curl_func_clock_gettime" = "yes"; then
889 AC_MSG_CHECKING([if monotonic clock_gettime works])
890 CURL_RUN_IFELSE([
891 AC_LANG_PROGRAM([[
892 #include <stdlib.h>
893 #ifdef HAVE_SYS_TYPES_H
894 #include <sys/types.h>
895 #endif
896 #ifndef _WIN32
897 #include <sys/time.h>
898 #endif
899 #include <time.h>
900 ]],[[
901 struct timespec ts;
902 if(0 == clock_gettime(CLOCK_MONOTONIC, &ts))
903 return 0;
904 (void)ts;
905 return 1;
906 ]])
907 ],[
908 AC_MSG_RESULT([yes])
909 ],[
910 AC_MSG_RESULT([no])
911 AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC is not defined])
912 curl_func_clock_gettime="no"
913 LIBS="$curl_cv_save_LIBS"
914 ])
915 fi
917 case "$curl_func_clock_gettime" in
918 yes)
919 AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
920 [Define to 1 if you have the clock_gettime function and monotonic timer.])
921 ;;
922 esac
923 fi
924])
927dnl CURL_CHECK_LIBS_CONNECT
928dnl -------------------------------------------------
929dnl Verify if network connect function is already available
930dnl using current libraries or if another one is required.
932AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
933 AC_REQUIRE([CURL_INCLUDES_WINSOCK2])
934 AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])
935 AC_MSG_CHECKING([for connect in libraries])
936 tst_connect_save_LIBS="$LIBS"
937 tst_connect_need_LIBS="unknown"
938 for tst_lib in '' '-lsocket' ; do
939 if test "$tst_connect_need_LIBS" = "unknown"; then
940 LIBS="$tst_lib $tst_connect_save_LIBS"
941 AC_LINK_IFELSE([
942 AC_LANG_PROGRAM([[
943 $curl_includes_winsock2
944 $curl_includes_bsdsocket
945 #if !defined(_WIN32) && !defined(HAVE_PROTO_BSDSOCKET_H)
946 int connect(int, void*, int);
947 #endif
948 ]],[[
949 if(0 != connect(0, 0, 0))
950 return 1;
951 ]])
952 ],[
953 tst_connect_need_LIBS="$tst_lib"
954 ])
955 fi
956 done
957 LIBS="$tst_connect_save_LIBS"
959 case X-"$tst_connect_need_LIBS" in
960 X-unknown)
961 AC_MSG_RESULT([cannot find connect])
962 AC_MSG_ERROR([cannot find connect function in libraries.])
963 ;;
964 X-)
965 AC_MSG_RESULT([yes])
966 ;;
967 *)
968 AC_MSG_RESULT([$tst_connect_need_LIBS])
969 LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
970 ;;
971 esac
972])
975dnl CURL_VERIFY_RUNTIMELIBS
976dnl -------------------------------------------------
977dnl Verify that the shared libs found so far can be used when running
978dnl programs, since otherwise the situation creates odd configure errors
979dnl that are misleading people.
980dnl
981dnl Make sure this test is run BEFORE the first test in the script that
982dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
983dnl macro. It must also run AFTER all lib-checking macros are complete.
985AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
987 dnl this test is of course not sensible if we are cross-compiling!
988 if test "$cross_compiling" != "yes"; then
990 dnl run a program to verify that the libs checked for previous to this
991 dnl point also is available runtime!
992 AC_MSG_CHECKING([runtime libs availability])
993 CURL_RUN_IFELSE([
994 int main(void)
995 {
996 return 0;
997 }
998 ],
999 AC_MSG_RESULT([fine]),
1000 AC_MSG_RESULT([failed])
1001 AC_MSG_ERROR([one or more libs available at link-time are not available runtime. Libs used at link-time: $LIBS])
1004 dnl if this test fails, configure has already stopped
1005 fi
1009dnl CURL_CHECK_CA_BUNDLE
1010dnl -------------------------------------------------
1011dnl Check if a default ca-bundle should be used
1012dnl
1013dnl regarding the paths this scans:
1014dnl /etc/ssl/certs/ca-certificates.crt Debian systems
1015dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
1016dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
1017dnl /usr/local/share/certs/ca-root-nss.crt MidnightBSD
1018dnl /etc/ssl/cert.pem OpenBSD, MidnightBSD (symlink)
1019dnl /etc/ssl/certs (CA path) SUSE, FreeBSD
1021AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
1023 AC_MSG_CHECKING([default CA cert bundle/path])
1025 AC_ARG_WITH(ca-bundle,
1026AS_HELP_STRING([--with-ca-bundle=FILE],
1027 [Absolute path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
1028AS_HELP_STRING([--without-ca-bundle], [Do not use a default CA bundle]),
1030 want_ca="$withval"
1031 if test "x$want_ca" = "xyes"; then
1032 AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
1033 fi
1034 ],
1035 [ want_ca="unset" ])
1036 AC_ARG_WITH(ca-path,
1037AS_HELP_STRING([--with-ca-path=DIRECTORY],
1038 [Absolute path to a directory containing CA certificates stored individually, with \
1039their filenames in a hash format. This option can be used with the OpenSSL, \
1040GnuTLS, mbedTLS and wolfSSL backends. Refer to OpenSSL c_rehash for details. \
1041(example: /etc/certificates)])
1042AS_HELP_STRING([--without-ca-path], [Do not use a default CA path]),
1044 want_capath="$withval"
1045 if test "x$want_capath" = "xyes"; then
1046 AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
1047 fi
1048 ],
1049 [ want_capath="unset"])
1051 ca_warning=" (warning: certs not found)"
1052 capath_warning=" (warning: certs not found)"
1053 check_capath=""
1055 if test "$APPLE_SECTRUST_ENABLED" = "1"; then
1056 ca_native="Apple SecTrust"
1057 elif test "$ca_native_opt" = "1"; then
1058 ca_native="yes"
1059 else
1060 ca_native="no"
1061 fi
1063 if test "x$want_ca" != "xno" && test "x$want_ca" != "xunset" &&
1064 test "x$want_capath" != "xno" && test "x$want_capath" != "xunset"; then
1065 dnl both given
1066 ca="$want_ca"
1067 capath="$want_capath"
1068 elif test "x$want_ca" != "xno" && test "x$want_ca" != "xunset"; then
1069 dnl --with-ca-bundle given
1070 ca="$want_ca"
1071 capath="no"
1072 elif test "x$want_capath" != "xno" && test "x$want_capath" != "xunset"; then
1073 dnl --with-ca-path given
1074 capath="$want_capath"
1075 ca="no"
1076 elif test "$ca_native" != "no"; then
1077 dnl native CA configured, do not look further
1078 ca="no"
1079 capath="no"
1080 else
1081 dnl First try auto-detecting a CA bundle, then a CA path.
1082 dnl Both auto-detections can be skipped by --without-ca-*
1083 ca="no"
1084 capath="no"
1085 if test "$cross_compiling" != "yes" &&
1086 test "$curl_cv_native_windows" != "yes"; then
1087 dnl NOT cross-compiling and...
1088 dnl neither of the --with-ca-* options are provided
1089 if test "x$want_ca" = "xunset"; then
1090 dnl the path we previously would have installed the curl CA bundle
1091 dnl to, and thus we now check for an already existing cert in that
1092 dnl place in case we find no other
1093 if test "x$prefix" != "xNONE"; then
1094 cac="${prefix}/share/curl/curl-ca-bundle.crt"
1095 else
1096 cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
1097 fi
1099 for a in /etc/ssl/certs/ca-certificates.crt \
1100 /etc/pki/tls/certs/ca-bundle.crt \
1101 /usr/share/ssl/certs/ca-bundle.crt \
1102 /usr/local/share/certs/ca-root-nss.crt \
1103 /etc/ssl/cert.pem \
1104 "$cac"; do
1105 if test -f "$a"; then
1106 ca="$a"
1107 break
1108 fi
1109 done
1110 fi
1111 AC_MSG_NOTICE([want $want_capath CA $ca])
1112 if test "x$want_capath" = "xunset"; then
1113 check_capath="/etc/ssl/certs"
1114 fi
1115 else
1116 dnl no option given and cross-compiling
1117 AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
1118 fi
1119 fi
1121 if test "x$ca" = "xno" || test -f "$ca"; then
1122 ca_warning=""
1123 fi
1125 if test "x$capath" != "xno"; then
1126 check_capath="$capath"
1127 fi
1129 if test -n "$check_capath"; then
1130 for a in "$check_capath"; do
1131 if test -d "$a" && ls "$a"/[[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]].0 >/dev/null 2>/dev/null; then
1132 if test "x$capath" = "xno"; then
1133 capath="$a"
1134 fi
1135 capath_warning=""
1136 break
1137 fi
1138 done
1139 fi
1141 if test "x$capath" = "xno"; then
1142 capath_warning=""
1143 fi
1145 if test "x$ca" != "xno"; then
1146 CURL_CA_BUNDLE="$ca"
1147 AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default CA bundle])
1148 AC_SUBST(CURL_CA_BUNDLE)
1149 AC_MSG_RESULT([$ca])
1150 fi
1151 if test "x$capath" != "xno"; then
1152 CURL_CA_PATH="\"$capath\""
1153 AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default CA path])
1154 AC_MSG_RESULT([$capath (capath)])
1155 fi
1156 if test "x$ca" = "xno" && test "x$capath" = "xno"; then
1157 AC_MSG_RESULT([no])
1158 fi
1160 AC_MSG_CHECKING([whether to use OpenSSL's built-in CA store])
1161 AC_ARG_WITH(ca-fallback,
1162AS_HELP_STRING([--with-ca-fallback], [Use OpenSSL's built-in CA store])
1163AS_HELP_STRING([--without-ca-fallback], [Do not use OpenSSL's built-in CA store]),
1165 if test "x$with_ca_fallback" != "xyes" && test "x$with_ca_fallback" != "xno"; then
1166 AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
1167 fi
1168 ],
1169 [ with_ca_fallback="no"])
1170 AC_MSG_RESULT([$with_ca_fallback])
1171 if test "x$with_ca_fallback" = "xyes"; then
1172 if test "$OPENSSL_ENABLED" != "1"; then
1173 AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL])
1174 fi
1175 AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use OpenSSL's built-in CA store])
1176 fi
1180dnl CURL_CHECK_CA_EMBED
1181dnl -------------------------------------------------
1182dnl Check if a ca-bundle should be embedded
1184AC_DEFUN([CURL_CHECK_CA_EMBED], [
1186 AC_MSG_CHECKING([CA cert bundle path to embed in the curl tool])
1188 AC_ARG_WITH(ca-embed,
1189AS_HELP_STRING([--with-ca-embed=FILE],
1190 [Absolute path to a file containing CA certificates to embed in the curl tool (example: /etc/ca-bundle.crt)])
1191AS_HELP_STRING([--without-ca-embed], [Do not embed a default CA bundle in the curl tool]),
1193 want_ca_embed="$withval"
1194 if test "x$want_ca_embed" = "xyes"; then
1195 AC_MSG_ERROR([--with-ca-embed=FILE requires a path to the CA bundle])
1196 fi
1197 ],
1198 [ want_ca_embed="unset" ])
1200 CURL_CA_EMBED=''
1201 if test "x$want_ca_embed" != "xno" && test "x$want_ca_embed" != "xunset" && test -f "$want_ca_embed"; then
1202 if test -n "$PERL"; then
1203 CURL_CA_EMBED="$want_ca_embed"
1204 AC_SUBST(CURL_CA_EMBED)
1205 AC_MSG_RESULT([$want_ca_embed])
1206 else
1207 AC_MSG_RESULT([no])
1208 AC_MSG_WARN([perl was not found. Cannot do CA embed.])
1209 fi
1210 else
1211 AC_MSG_RESULT([no])
1212 fi
1215dnl CURL_CHECK_WIN32_CRYPTO
1216dnl -------------------------------------------------
1217dnl Check if curl's Win32 crypto lib can be used
1219AC_DEFUN([CURL_CHECK_WIN32_CRYPTO], [
1220 AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])
1221 AC_MSG_CHECKING([whether build target supports Win32 crypto API])
1222 curl_win32_crypto_api="no"
1223 if test "$curl_cv_native_windows" = "yes" && test "$curl_cv_winuwp" != "yes"; then
1224 AC_COMPILE_IFELSE([
1225 AC_LANG_PROGRAM([[
1226 #undef inline
1227 #ifndef WIN32_LEAN_AND_MEAN
1228 #define WIN32_LEAN_AND_MEAN
1229 #endif
1230 #include <windows.h>
1231 #include <wincrypt.h>
1232 ]],[[
1233 HCRYPTPROV hCryptProv;
1234 if(CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
1235 CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) {
1236 CryptReleaseContext(hCryptProv, 0);
1238 ]])
1239 ],[
1240 curl_win32_crypto_api="yes"
1241 ])
1242 fi
1243 case "$curl_win32_crypto_api" in
1244 yes)
1245 AC_MSG_RESULT([yes])
1246 AC_DEFINE_UNQUOTED(USE_WIN32_CRYPTO, 1,
1247 [Define to 1 if you are building a Windows target with crypto API support.])
1248 USE_WIN32_CRYPTO=1
1249 ;;
1250 *)
1251 AC_MSG_RESULT([no])
1252 ;;
1253 esac
1256dnl CURL_EXPORT_PCDIR ($pcdir, [$additive])
1257dnl ------------------------
1258dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export.
1259dnl if $additive is set, extend PKG_CONFIG_PATH instead, by prepending $pcdir
1260dnl to it, to ensure that system locations are still checked. This is
1261dnl necessary for modules that depend on modules residing there
1262dnl (e.g. gnutls.pc).
1263dnl
1264dnl we need this macro to limit/expand search locations to/with a custom
1265dnl configured one.
1266dnl
1268AC_DEFUN([CURL_EXPORT_PCDIR], [
1269 if test -n "$1"; then
1270 if test -n "$2"; then
1271 dnl honor system locations
1272 PKG_CONFIG_PATH="$1${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
1273 export PKG_CONFIG_PATH
1274 else
1275 dnl ignore and override system locations
1276 PKG_CONFIG_LIBDIR="$1"
1277 export PKG_CONFIG_LIBDIR
1278 fi
1279 fi
1282dnl CURL_TRACE_PCDIR ($module, [$pcdir], [$additive])
1283dnl ------------------------
1284dnl show pkg-config module lookup details, along with a detailed errors
1285dnl message in case of failure. Supports both pkg-config and pkgconf.
1286dnl
1288AC_DEFUN([CURL_TRACE_PCDIR], [
1289 dnl Example pkgconf line:
1290 dnl libpkgconf/pkg.c:746 [pkgconf_pkg_t *pkgconf_pkg_try_specific_path(pkgconf_client_t *, [...]*)]:
1291 dnl trying path: /usr/local/lib/pkgconfig for libngtcp2_crypto_gnutls
1292 dnl Rest of strings are for catching classic pkg-config lines.
1293 trc=`CURL_EXPORT_PCDIR([$2], [$3])
1294 if test -n "$PKG_CONFIG_LIBDIR"; then
1295 echo "PKG_CONFIG_LIBDIR: '$PKG_CONFIG_LIBDIR'"
1296 fi
1297 if test -n "$PKG_CONFIG_PATH"; then
1298 echo "PKG_CONFIG_PATH: '$PKG_CONFIG_PATH'"
1299 fi
1300 $PKGCONFIG --exists --debug $1 2>&1 | \
1301 $EGREP '(trying path:|Adding directory|Looking for|Scanning directory|Cannot open directory)' | \
1302 $SED 's/^.*trying path:/trying path:/'`
1303 msg=`CURL_EXPORT_PCDIR([$2], [$3])
1304 $PKGCONFIG --exists --print-errors $1 2>&1`
1305 if test -n "$msg"; then
1306 trc=`echo "$trc"; echo '==== error:'; echo "$msg"`
1307 fi
1308 AC_MSG_NOTICE([pkg-config --exists $1 trace:
1309---- begin
1310${trc}
1311---- end])
1314dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir], [$additive])
1315dnl ------------------------
1316dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
1317dnl path to it, or 'no' if not found/present.
1318dnl
1319dnl If pkg-config is present, check that it has info about the $module or
1320dnl return "no" anyway!
1321dnl
1322dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
1323dnl
1325AC_DEFUN([CURL_CHECK_PKGCONFIG], [
1326 if test -n "$PKG_CONFIG"; then
1327 PKGCONFIG="$PKG_CONFIG"
1328 else
1329 AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
1330 [$PATH:/usr/bin:/usr/local/bin])
1331 fi
1333 if test "$PKGCONFIG" != "no"; then
1334 AC_MSG_CHECKING([for $1 options with pkg-config])
1335 dnl ask pkg-config about $1
1336 itexists=`CURL_EXPORT_PCDIR([$2], [$3])
1337 $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
1339 if test -z "$itexists"; then
1340 dnl pkg-config does not have info about the given module! set the
1341 dnl variable to 'no'
1342 AC_MSG_RESULT([no])
1343 if test -n "$CURL_TRACE_PKG_CONFIG$CURL_CI"; then
1344 CURL_TRACE_PCDIR([$1], [$2], [$3])
1345 fi
1346 PKGCONFIG="no"
1347 else
1348 AC_MSG_RESULT([found])
1349 if test -n "$CURL_TRACE_PKG_CONFIG"; then
1350 CURL_TRACE_PCDIR([$1], [$2], [$3])
1351 fi
1352 fi
1353 fi
1357dnl CURL_PREPARE_CONFIGUREHELP_PM
1358dnl -------------------------------------------------
1359dnl Prepare test harness configurehelp.pm module, defining and
1360dnl initializing some perl variables with values which are known
1361dnl when the configure script runs. For portability reasons, test
1362dnl harness needs information on how to run the C preprocessor.
1364AC_DEFUN([CURL_PREPARE_CONFIGUREHELP_PM], [
1365 AC_REQUIRE([AC_PROG_CPP])
1366 tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
1367 if test -z "$tmp_cpp"; then
1368 tmp_cpp='cpp'
1369 fi
1370 AC_SUBST(CURL_CPP, $tmp_cpp)
1374dnl CURL_PREPARE_BUILDINFO
1375dnl -------------------------------------------------
1376dnl Save build info for test runner to pick up and log
1378AC_DEFUN([CURL_PREPARE_BUILDINFO], [
1379 curl_pflags=""
1380 if test "$curl_cv_apple" = "yes"; then
1381 curl_pflags="${curl_pflags} APPLE"
1382 fi
1383 case $host in
1384 *-*-*bsd*|*-*-aix*|*-*-hpux*|*-*-interix*|*-*-irix*|*-*-linux*|*-*-solaris*|*-*-sunos*|*-apple-*|*-*-cygwin*|*-*-msys*)
1385 curl_pflags="${curl_pflags} UNIX";;
1386 esac
1387 case $host in
1388 *-*-*bsd*)
1389 curl_pflags="${curl_pflags} BSD";;
1390 esac
1391 if test "$curl_cv_android" = "yes"; then
1392 curl_pflags="${curl_pflags} ANDROID"
1393 ANDROID_PLATFORM_LEVEL=`echo "$host_os" | $SED -ne 's/.*android\(@<:@0-9@:>@*\).*/\1/p'`
1394 if test -n "${ANDROID_PLATFORM_LEVEL}"; then
1395 curl_pflags="${curl_pflags}-${ANDROID_PLATFORM_LEVEL}"
1396 fi
1397 fi
1398 if test "$curl_cv_native_windows" = "yes"; then
1399 curl_pflags="${curl_pflags} WIN32"
1400 fi
1401 if test "$curl_cv_winuwp" = "yes"; then
1402 curl_pflags="${curl_pflags} UWP"
1403 fi
1404 case $host_os in
1405 cygwin*|msys*) curl_pflags="${curl_pflags} CYGWIN";;
1406 esac
1407 case $host_os in
1408 msdos*) curl_pflags="${curl_pflags} DOS";;
1409 amiga*) curl_pflags="${curl_pflags} AMIGA";;
1410 esac
1411 if test "$compiler_id" = "GNU_C"; then
1412 curl_pflags="${curl_pflags} GCC"
1413 fi
1414 if test "$compiler_id" = "APPLECLANG"; then
1415 curl_pflags="${curl_pflags} APPLE-CLANG"
1416 elif test "$compiler_id" = "CLANG"; then
1417 curl_pflags="${curl_pflags} LLVM-CLANG"
1418 fi
1419 case $host_os in
1420 mingw*) curl_pflags="${curl_pflags} MINGW";;
1421 esac
1422 if test "$cross_compiling" = "yes"; then
1423 curl_pflags="${curl_pflags} CROSS"
1424 fi
1425 squeeze curl_pflags
1426 curl_buildinfo="
1427buildinfo.configure.tool: configure
1428buildinfo.configure.args: $ac_configure_args
1429buildinfo.host: $build
1430buildinfo.host.cpu: $build_cpu
1431buildinfo.host.os: $build_os
1432buildinfo.target: $host
1433buildinfo.target.cpu: $host_cpu
1434buildinfo.target.os: $host_os
1435buildinfo.target.flags: $curl_pflags
1436buildinfo.compiler: $compiler_id
1437buildinfo.compiler.version: $compiler_ver
1438buildinfo.sysroot: $lt_sysroot"
1442dnl CURL_CPP_P
1443dnl
1444dnl Check if $cpp -P should be used for extract define values due to gcc 5
1445dnl splitting up strings and defines between line outputs. gcc by default
1446dnl (without -P) shows TEST EINVAL TEST as
1447dnl
1448dnl # 13 "conftest.c"
1449dnl TEST
1450dnl # 13 "conftest.c" 3 4
1451dnl 22
1452dnl # 13 "conftest.c"
1453dnl TEST
1455AC_DEFUN([CURL_CPP_P], [
1456 AC_MSG_CHECKING([if cpp -P is needed])
1457 AC_EGREP_CPP([TEST.*TEST], [
1458 #include <errno.h>
1459TEST EINVAL TEST
1460 ], [cpp=no], [cpp=yes])
1461 AC_MSG_RESULT([$cpp])
1463 dnl we need cpp -P so check if it works then
1464 if test "$cpp" = "yes"; then
1465 AC_MSG_CHECKING([if cpp -P works])
1466 OLDCPPFLAGS=$CPPFLAGS
1467 CPPFLAGS="$CPPFLAGS -P"
1468 AC_EGREP_CPP([TEST.*TEST], [
1469 #include <errno.h>
1470TEST EINVAL TEST
1471 ], [cpp_p=yes], [cpp_p=no])
1472 AC_MSG_RESULT([$cpp_p])
1474 if test "$cpp_p" = "no"; then
1475 AC_MSG_WARN([failed to figure out cpp -P alternative])
1476 dnl without -P
1477 CPPPFLAG=""
1478 else
1479 dnl with -P
1480 CPPPFLAG="-P"
1481 fi
1482 dnl restore CPPFLAGS
1483 CPPFLAGS=$OLDCPPFLAGS
1484 else
1485 dnl without -P
1486 CPPPFLAG=""
1487 fi
1491dnl CURL_DARWIN_CFLAGS
1492dnl
1493dnl Set -Werror=partial-availability to detect possible breaking code
1494dnl with low deployment targets.
1495dnl
1497AC_DEFUN([CURL_DARWIN_CFLAGS], [
1498 old_CFLAGS=$CFLAGS
1499 CFLAGS="$CFLAGS -Werror=partial-availability"
1500 AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
1501 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
1502 [AC_MSG_RESULT([yes])],
1503 [AC_MSG_RESULT([no])
1504 CFLAGS=$old_CFLAGS])
1508dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
1509dnl
1510dnl Check to see if the compiler supports __builtin_available. This built-in
1511dnl compiler function first appeared in Apple LLVM 9.0.0. It is so new that, at
1512dnl the time this macro was written, the function was not yet documented. Its
1513dnl purpose is to return true if the code is running under a certain OS version
1514dnl or later.
1516AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
1517 AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
1518 AC_COMPILE_IFELSE([
1519 AC_LANG_PROGRAM([[
1520 ]],[[
1521 if(__builtin_available(macOS 10.12, iOS 5, *)) {}
1522 ]])
1523 ],[
1524 AC_MSG_RESULT([yes])
1525 AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
1526 [Define to 1 if you have the __builtin_available function.])
1527 ],[
1528 AC_MSG_RESULT([no])
1529 ])
Diagnostics4 git calls · 478 ms
CallStatusSizeTime0478 ms
discover200152 B2 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=152
git.server.agent=gitty/1.0
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch object-format
git.server.fetch=shallow filter sideband-all
git.protocol.version=2
git.pkt.frames=8
git.pkt.data=6
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=152
git.pkt.payload.max=34
ls-refs200149 B · hit3 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=3
git.response.bytes=149
git.response.cache=HIT
git.response.duration_ms=3
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=149
git.pkt.payload.max=78
git.ls_refs.count=2
git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit23 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=293470
git.response.cache=HIT
git.response.duration_ms=23
git.fetch.filter=blob:none
git.fetch.filter.requested=tree:0
git.fetch.filter.fallback=blob:none
git.fetch.filter.learned=false
git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=10
git.pkt.data=8
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=293470
git.pkt.payload.max=65516
git.sideband.band1.bytes=293354
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=87
git.pack.bytes=293354
git.pack.ofs_delta=0
git.pack.ref_delta=1
git.pack.chain.max=1
git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0
git.pack.full=86
Open pack map
fetch20011 KiB452 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=452
git.response.bytes=11184
git.response.cache=MISS
git.response.duration_ms=452
git.fetch.wants=bb4ac660d96de33b47feaf77d5f7f1b16cd59df3
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=3
git.pkt.data=2
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=11184
git.pkt.payload.max=11163
git.sideband.band1.bytes=11162
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
Ref
refs/heads/master
Commit
31c911efe5652725e930f4d2e60c9060e5f6646d
cf-ray
a5e231df6d4ea594
Request
40032324…
Protocol
v2 · sha1
Agent
gitty/1.0
Filter
advertised
Fetch
shallow filter sideband-all
Capabilities
agent ls-refs fetch object-format