Annotation of embedaddon/curl/acinclude.m4, revision 1.1
1.1 ! misho 1: #***************************************************************************
! 2: # _ _ ____ _
! 3: # Project ___| | | | _ \| |
! 4: # / __| | | | |_) | |
! 5: # | (__| |_| | _ <| |___
! 6: # \___|\___/|_| \_\_____|
! 7: #
! 8: # Copyright (C) 1998 - 2020, 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.haxx.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: #***************************************************************************
! 22:
! 23: dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
! 24: dnl -------------------------------------------------
! 25: dnl Use the C preprocessor to find out if the given object-style symbol
! 26: dnl is defined and get its expansion. This macro will not use default
! 27: dnl includes even if no INCLUDES argument is given. This macro will run
! 28: dnl silently when invoked with three arguments. If the expansion would
! 29: dnl result in a set of double-quoted strings the returned expansion will
! 30: dnl actually be a single double-quoted string concatenating all them.
! 31:
! 32: AC_DEFUN([CURL_CHECK_DEF], [
! 33: AC_REQUIRE([CURL_CPP_P])dnl
! 34: OLDCPPFLAGS=$CPPFLAGS
! 35: # CPPPFLAG comes from CURL_CPP_P
! 36: CPPFLAGS="$CPPFLAGS $CPPPFLAG"
! 37: AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
! 38: AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
! 39: if test -z "$SED"; then
! 40: AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
! 41: fi
! 42: if test -z "$GREP"; then
! 43: AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
! 44: fi
! 45: ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
! 46: tmp_exp=""
! 47: AC_PREPROC_IFELSE([
! 48: AC_LANG_SOURCE(
! 49: ifelse($2,,,[$2])[[
! 50: #ifdef $1
! 51: CURL_DEF_TOKEN $1
! 52: #endif
! 53: ]])
! 54: ],[
! 55: tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
! 56: "$GREP" CURL_DEF_TOKEN 2>/dev/null | \
! 57: "$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
! 58: "$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
! 59: if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
! 60: tmp_exp=""
! 61: fi
! 62: ])
! 63: if test -z "$tmp_exp"; then
! 64: AS_VAR_SET(ac_HaveDef, no)
! 65: ifelse($3,,[AC_MSG_RESULT([no])])
! 66: else
! 67: AS_VAR_SET(ac_HaveDef, yes)
! 68: AS_VAR_SET(ac_Def, $tmp_exp)
! 69: ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
! 70: fi
! 71: AS_VAR_POPDEF([ac_Def])dnl
! 72: AS_VAR_POPDEF([ac_HaveDef])dnl
! 73: CPPFLAGS=$OLDCPPFLAGS
! 74: ])
! 75:
! 76:
! 77: dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT])
! 78: dnl -------------------------------------------------
! 79: dnl Use the C compiler to find out only if the given symbol is defined
! 80: dnl or not, this can not find out its expansion. This macro will not use
! 81: dnl default includes even if no INCLUDES argument is given. This macro
! 82: dnl will run silently when invoked with three arguments.
! 83:
! 84: AC_DEFUN([CURL_CHECK_DEF_CC], [
! 85: AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
! 86: ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])])
! 87: AC_COMPILE_IFELSE([
! 88: AC_LANG_SOURCE(
! 89: ifelse($2,,,[$2])[[
! 90: int main (void)
! 91: {
! 92: #ifdef $1
! 93: return 0;
! 94: #else
! 95: force compilation error
! 96: #endif
! 97: }
! 98: ]])
! 99: ],[
! 100: tst_symbol_defined="yes"
! 101: ],[
! 102: tst_symbol_defined="no"
! 103: ])
! 104: if test "$tst_symbol_defined" = "yes"; then
! 105: AS_VAR_SET(ac_HaveDef, yes)
! 106: ifelse($3,,[AC_MSG_RESULT([yes])])
! 107: else
! 108: AS_VAR_SET(ac_HaveDef, no)
! 109: ifelse($3,,[AC_MSG_RESULT([no])])
! 110: fi
! 111: AS_VAR_POPDEF([ac_HaveDef])dnl
! 112: ])
! 113:
! 114:
! 115: dnl CURL_CHECK_LIB_XNET
! 116: dnl -------------------------------------------------
! 117: dnl Verify if X/Open network library is required.
! 118:
! 119: AC_DEFUN([CURL_CHECK_LIB_XNET], [
! 120: AC_MSG_CHECKING([if X/Open network library is required])
! 121: tst_lib_xnet_required="no"
! 122: AC_COMPILE_IFELSE([
! 123: AC_LANG_SOURCE([[
! 124: int main (void)
! 125: {
! 126: #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600)
! 127: return 0;
! 128: #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED)
! 129: return 0;
! 130: #else
! 131: force compilation error
! 132: #endif
! 133: }
! 134: ]])
! 135: ],[
! 136: tst_lib_xnet_required="yes"
! 137: LIBS="-lxnet $LIBS"
! 138: ])
! 139: AC_MSG_RESULT([$tst_lib_xnet_required])
! 140: ])
! 141:
! 142:
! 143: dnl CURL_CHECK_AIX_ALL_SOURCE
! 144: dnl -------------------------------------------------
! 145: dnl Provides a replacement of traditional AC_AIX with
! 146: dnl an uniform behaviour across all autoconf versions,
! 147: dnl and with our own placement rules.
! 148:
! 149: AC_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])dnl
! 156: AC_BEFORE([$0], [CURL_CONFIGURE_REENTRANT])dnl
! 157: AC_BEFORE([$0], [CURL_CONFIGURE_PULL_SYS_POLL])dnl
! 158: AC_MSG_CHECKING([if OS is AIX (to define _ALL_SOURCE)])
! 159: AC_EGREP_CPP([yes_this_is_aix],[
! 160: #ifdef _AIX
! 161: yes_this_is_aix
! 162: #endif
! 163: ],[
! 164: AC_MSG_RESULT([yes])
! 165: AC_DEFINE(_ALL_SOURCE)
! 166: ],[
! 167: AC_MSG_RESULT([no])
! 168: ])
! 169: ])
! 170:
! 171:
! 172: dnl CURL_CHECK_HEADER_WINDOWS
! 173: dnl -------------------------------------------------
! 174: dnl Check for compilable and valid windows.h header
! 175:
! 176: AC_DEFUN([CURL_CHECK_HEADER_WINDOWS], [
! 177: AC_CACHE_CHECK([for windows.h], [curl_cv_header_windows_h], [
! 178: AC_COMPILE_IFELSE([
! 179: AC_LANG_PROGRAM([[
! 180: #undef inline
! 181: #ifndef WIN32_LEAN_AND_MEAN
! 182: #define WIN32_LEAN_AND_MEAN
! 183: #endif
! 184: #include <windows.h>
! 185: ]],[[
! 186: #if defined(__CYGWIN__) || defined(__CEGCC__)
! 187: HAVE_WINDOWS_H shall not be defined.
! 188: #else
! 189: int dummy=2*WINVER;
! 190: #endif
! 191: ]])
! 192: ],[
! 193: curl_cv_header_windows_h="yes"
! 194: ],[
! 195: curl_cv_header_windows_h="no"
! 196: ])
! 197: ])
! 198: case "$curl_cv_header_windows_h" in
! 199: yes)
! 200: AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1,
! 201: [Define to 1 if you have the windows.h header file.])
! 202: ;;
! 203: esac
! 204: ])
! 205:
! 206:
! 207: dnl CURL_CHECK_NATIVE_WINDOWS
! 208: dnl -------------------------------------------------
! 209: dnl Check if building a native Windows target
! 210:
! 211: AC_DEFUN([CURL_CHECK_NATIVE_WINDOWS], [
! 212: AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
! 213: AC_CACHE_CHECK([whether build target is a native Windows one], [curl_cv_native_windows], [
! 214: if test "$curl_cv_header_windows_h" = "no"; then
! 215: curl_cv_native_windows="no"
! 216: else
! 217: AC_COMPILE_IFELSE([
! 218: AC_LANG_PROGRAM([[
! 219: ]],[[
! 220: #if defined(__MINGW32__) || defined(__MINGW32CE__) || \
! 221: (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64)))
! 222: int dummy=1;
! 223: #else
! 224: Not a native Windows build target.
! 225: #endif
! 226: ]])
! 227: ],[
! 228: curl_cv_native_windows="yes"
! 229: ],[
! 230: curl_cv_native_windows="no"
! 231: ])
! 232: fi
! 233: ])
! 234: AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$curl_cv_native_windows" = xyes)
! 235: ])
! 236:
! 237:
! 238: dnl CURL_CHECK_HEADER_WINSOCK
! 239: dnl -------------------------------------------------
! 240: dnl Check for compilable and valid winsock.h header
! 241:
! 242: AC_DEFUN([CURL_CHECK_HEADER_WINSOCK], [
! 243: AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
! 244: AC_CACHE_CHECK([for winsock.h], [curl_cv_header_winsock_h], [
! 245: AC_COMPILE_IFELSE([
! 246: AC_LANG_PROGRAM([[
! 247: #undef inline
! 248: #ifndef WIN32_LEAN_AND_MEAN
! 249: #define WIN32_LEAN_AND_MEAN
! 250: #endif
! 251: #include <windows.h>
! 252: #include <winsock.h>
! 253: ]],[[
! 254: #if defined(__CYGWIN__) || defined(__CEGCC__)
! 255: HAVE_WINSOCK_H shall not be defined.
! 256: #else
! 257: int dummy=WSACleanup();
! 258: #endif
! 259: ]])
! 260: ],[
! 261: curl_cv_header_winsock_h="yes"
! 262: ],[
! 263: curl_cv_header_winsock_h="no"
! 264: ])
! 265: ])
! 266: case "$curl_cv_header_winsock_h" in
! 267: yes)
! 268: AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1,
! 269: [Define to 1 if you have the winsock.h header file.])
! 270: ;;
! 271: esac
! 272: ])
! 273:
! 274:
! 275: dnl CURL_CHECK_HEADER_WINSOCK2
! 276: dnl -------------------------------------------------
! 277: dnl Check for compilable and valid winsock2.h header
! 278:
! 279: AC_DEFUN([CURL_CHECK_HEADER_WINSOCK2], [
! 280: AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
! 281: AC_CACHE_CHECK([for winsock2.h], [curl_cv_header_winsock2_h], [
! 282: AC_COMPILE_IFELSE([
! 283: AC_LANG_PROGRAM([[
! 284: #undef inline
! 285: #ifndef WIN32_LEAN_AND_MEAN
! 286: #define WIN32_LEAN_AND_MEAN
! 287: #endif
! 288: #include <windows.h>
! 289: #include <winsock2.h>
! 290: ]],[[
! 291: #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
! 292: HAVE_WINSOCK2_H shall not be defined.
! 293: #else
! 294: int dummy=2*IPPROTO_ESP;
! 295: #endif
! 296: ]])
! 297: ],[
! 298: curl_cv_header_winsock2_h="yes"
! 299: ],[
! 300: curl_cv_header_winsock2_h="no"
! 301: ])
! 302: ])
! 303: case "$curl_cv_header_winsock2_h" in
! 304: yes)
! 305: AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1,
! 306: [Define to 1 if you have the winsock2.h header file.])
! 307: ;;
! 308: esac
! 309: ])
! 310:
! 311:
! 312: dnl CURL_CHECK_HEADER_WS2TCPIP
! 313: dnl -------------------------------------------------
! 314: dnl Check for compilable and valid ws2tcpip.h header
! 315:
! 316: AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [
! 317: AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
! 318: AC_CACHE_CHECK([for ws2tcpip.h], [curl_cv_header_ws2tcpip_h], [
! 319: AC_COMPILE_IFELSE([
! 320: AC_LANG_PROGRAM([[
! 321: #undef inline
! 322: #ifndef WIN32_LEAN_AND_MEAN
! 323: #define WIN32_LEAN_AND_MEAN
! 324: #endif
! 325: #include <windows.h>
! 326: #include <winsock2.h>
! 327: #include <ws2tcpip.h>
! 328: ]],[[
! 329: #if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__)
! 330: HAVE_WS2TCPIP_H shall not be defined.
! 331: #else
! 332: int dummy=2*IP_PKTINFO;
! 333: #endif
! 334: ]])
! 335: ],[
! 336: curl_cv_header_ws2tcpip_h="yes"
! 337: ],[
! 338: curl_cv_header_ws2tcpip_h="no"
! 339: ])
! 340: ])
! 341: case "$curl_cv_header_ws2tcpip_h" in
! 342: yes)
! 343: AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1,
! 344: [Define to 1 if you have the ws2tcpip.h header file.])
! 345: ;;
! 346: esac
! 347: ])
! 348:
! 349:
! 350: dnl CURL_CHECK_HEADER_WINLDAP
! 351: dnl -------------------------------------------------
! 352: dnl Check for compilable and valid winldap.h header
! 353:
! 354: AC_DEFUN([CURL_CHECK_HEADER_WINLDAP], [
! 355: AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
! 356: AC_CACHE_CHECK([for winldap.h], [curl_cv_header_winldap_h], [
! 357: AC_COMPILE_IFELSE([
! 358: AC_LANG_PROGRAM([[
! 359: #undef inline
! 360: #ifdef HAVE_WINDOWS_H
! 361: #ifndef WIN32_LEAN_AND_MEAN
! 362: #define WIN32_LEAN_AND_MEAN
! 363: #endif
! 364: #include <windows.h>
! 365: #endif
! 366: #include <winldap.h>
! 367: ]],[[
! 368: #if defined(__CYGWIN__) || defined(__CEGCC__)
! 369: HAVE_WINLDAP_H shall not be defined.
! 370: #else
! 371: LDAP *ldp = ldap_init("dummy", LDAP_PORT);
! 372: ULONG res = ldap_unbind(ldp);
! 373: #endif
! 374: ]])
! 375: ],[
! 376: curl_cv_header_winldap_h="yes"
! 377: ],[
! 378: curl_cv_header_winldap_h="no"
! 379: ])
! 380: ])
! 381: case "$curl_cv_header_winldap_h" in
! 382: yes)
! 383: AC_DEFINE_UNQUOTED(HAVE_WINLDAP_H, 1,
! 384: [Define to 1 if you have the winldap.h header file.])
! 385: ;;
! 386: esac
! 387: ])
! 388:
! 389:
! 390: dnl CURL_CHECK_HEADER_WINBER
! 391: dnl -------------------------------------------------
! 392: dnl Check for compilable and valid winber.h header
! 393:
! 394: AC_DEFUN([CURL_CHECK_HEADER_WINBER], [
! 395: AC_REQUIRE([CURL_CHECK_HEADER_WINLDAP])dnl
! 396: AC_CACHE_CHECK([for winber.h], [curl_cv_header_winber_h], [
! 397: AC_COMPILE_IFELSE([
! 398: AC_LANG_PROGRAM([[
! 399: #undef inline
! 400: #ifdef HAVE_WINDOWS_H
! 401: #ifndef WIN32_LEAN_AND_MEAN
! 402: #define WIN32_LEAN_AND_MEAN
! 403: #endif
! 404: #include <windows.h>
! 405: #endif
! 406: #include <winldap.h>
! 407: #include <winber.h>
! 408: ]],[[
! 409: #if defined(__CYGWIN__) || defined(__CEGCC__)
! 410: HAVE_WINBER_H shall not be defined.
! 411: #else
! 412: BERVAL *bvp = NULL;
! 413: BerElement *bep = ber_init(bvp);
! 414: ber_free(bep, 1);
! 415: #endif
! 416: ]])
! 417: ],[
! 418: curl_cv_header_winber_h="yes"
! 419: ],[
! 420: curl_cv_header_winber_h="no"
! 421: ])
! 422: ])
! 423: case "$curl_cv_header_winber_h" in
! 424: yes)
! 425: AC_DEFINE_UNQUOTED(HAVE_WINBER_H, 1,
! 426: [Define to 1 if you have the winber.h header file.])
! 427: ;;
! 428: esac
! 429: ])
! 430:
! 431:
! 432: dnl CURL_CHECK_HEADER_LBER
! 433: dnl -------------------------------------------------
! 434: dnl Check for compilable and valid lber.h header,
! 435: dnl and check if it is needed even with ldap.h
! 436:
! 437: AC_DEFUN([CURL_CHECK_HEADER_LBER], [
! 438: AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
! 439: AC_CACHE_CHECK([for lber.h], [curl_cv_header_lber_h], [
! 440: AC_COMPILE_IFELSE([
! 441: AC_LANG_PROGRAM([[
! 442: #undef inline
! 443: #ifdef HAVE_WINDOWS_H
! 444: #ifndef WIN32_LEAN_AND_MEAN
! 445: #define WIN32_LEAN_AND_MEAN
! 446: #endif
! 447: #include <windows.h>
! 448: #else
! 449: #ifdef HAVE_SYS_TYPES_H
! 450: #include <sys/types.h>
! 451: #endif
! 452: #endif
! 453: #ifndef NULL
! 454: #define NULL (void *)0
! 455: #endif
! 456: #include <lber.h>
! 457: ]],[[
! 458: BerValue *bvp = NULL;
! 459: BerElement *bep = ber_init(bvp);
! 460: ber_free(bep, 1);
! 461: ]])
! 462: ],[
! 463: curl_cv_header_lber_h="yes"
! 464: ],[
! 465: curl_cv_header_lber_h="no"
! 466: ])
! 467: ])
! 468: if test "$curl_cv_header_lber_h" = "yes"; then
! 469: AC_DEFINE_UNQUOTED(HAVE_LBER_H, 1,
! 470: [Define to 1 if you have the lber.h header file.])
! 471: #
! 472: AC_COMPILE_IFELSE([
! 473: AC_LANG_PROGRAM([[
! 474: #undef inline
! 475: #ifdef HAVE_WINDOWS_H
! 476: #ifndef WIN32_LEAN_AND_MEAN
! 477: #define WIN32_LEAN_AND_MEAN
! 478: #endif
! 479: #include <windows.h>
! 480: #else
! 481: #ifdef HAVE_SYS_TYPES_H
! 482: #include <sys/types.h>
! 483: #endif
! 484: #endif
! 485: #ifndef NULL
! 486: #define NULL (void *)0
! 487: #endif
! 488: #ifndef LDAP_DEPRECATED
! 489: #define LDAP_DEPRECATED 1
! 490: #endif
! 491: #include <ldap.h>
! 492: ]],[[
! 493: BerValue *bvp = NULL;
! 494: BerElement *bep = ber_init(bvp);
! 495: ber_free(bep, 1);
! 496: ]])
! 497: ],[
! 498: curl_cv_need_header_lber_h="no"
! 499: ],[
! 500: curl_cv_need_header_lber_h="yes"
! 501: ])
! 502: #
! 503: case "$curl_cv_need_header_lber_h" in
! 504: yes)
! 505: AC_DEFINE_UNQUOTED(NEED_LBER_H, 1,
! 506: [Define to 1 if you need the lber.h header file even with ldap.h])
! 507: ;;
! 508: esac
! 509: fi
! 510: ])
! 511:
! 512:
! 513: dnl CURL_CHECK_HEADER_LDAP
! 514: dnl -------------------------------------------------
! 515: dnl Check for compilable and valid ldap.h header
! 516:
! 517: AC_DEFUN([CURL_CHECK_HEADER_LDAP], [
! 518: AC_REQUIRE([CURL_CHECK_HEADER_LBER])dnl
! 519: AC_CACHE_CHECK([for ldap.h], [curl_cv_header_ldap_h], [
! 520: AC_COMPILE_IFELSE([
! 521: AC_LANG_PROGRAM([[
! 522: #undef inline
! 523: #ifdef HAVE_WINDOWS_H
! 524: #ifndef WIN32_LEAN_AND_MEAN
! 525: #define WIN32_LEAN_AND_MEAN
! 526: #endif
! 527: #include <windows.h>
! 528: #else
! 529: #ifdef HAVE_SYS_TYPES_H
! 530: #include <sys/types.h>
! 531: #endif
! 532: #endif
! 533: #ifndef LDAP_DEPRECATED
! 534: #define LDAP_DEPRECATED 1
! 535: #endif
! 536: #ifdef NEED_LBER_H
! 537: #include <lber.h>
! 538: #endif
! 539: #include <ldap.h>
! 540: ]],[[
! 541: LDAP *ldp = ldap_init("dummy", LDAP_PORT);
! 542: int res = ldap_unbind(ldp);
! 543: ]])
! 544: ],[
! 545: curl_cv_header_ldap_h="yes"
! 546: ],[
! 547: curl_cv_header_ldap_h="no"
! 548: ])
! 549: ])
! 550: case "$curl_cv_header_ldap_h" in
! 551: yes)
! 552: AC_DEFINE_UNQUOTED(HAVE_LDAP_H, 1,
! 553: [Define to 1 if you have the ldap.h header file.])
! 554: ;;
! 555: esac
! 556: ])
! 557:
! 558:
! 559: dnl CURL_CHECK_HEADER_LDAP_SSL
! 560: dnl -------------------------------------------------
! 561: dnl Check for compilable and valid ldap_ssl.h header
! 562:
! 563: AC_DEFUN([CURL_CHECK_HEADER_LDAP_SSL], [
! 564: AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
! 565: AC_CACHE_CHECK([for ldap_ssl.h], [curl_cv_header_ldap_ssl_h], [
! 566: AC_COMPILE_IFELSE([
! 567: AC_LANG_PROGRAM([[
! 568: #undef inline
! 569: #ifdef HAVE_WINDOWS_H
! 570: #ifndef WIN32_LEAN_AND_MEAN
! 571: #define WIN32_LEAN_AND_MEAN
! 572: #endif
! 573: #include <windows.h>
! 574: #else
! 575: #ifdef HAVE_SYS_TYPES_H
! 576: #include <sys/types.h>
! 577: #endif
! 578: #endif
! 579: #ifndef LDAP_DEPRECATED
! 580: #define LDAP_DEPRECATED 1
! 581: #endif
! 582: #ifdef NEED_LBER_H
! 583: #include <lber.h>
! 584: #endif
! 585: #ifdef HAVE_LDAP_H
! 586: #include <ldap.h>
! 587: #endif
! 588: #include <ldap_ssl.h>
! 589: ]],[[
! 590: LDAP *ldp = ldapssl_init("dummy", LDAPS_PORT, 1);
! 591: ]])
! 592: ],[
! 593: curl_cv_header_ldap_ssl_h="yes"
! 594: ],[
! 595: curl_cv_header_ldap_ssl_h="no"
! 596: ])
! 597: ])
! 598: case "$curl_cv_header_ldap_ssl_h" in
! 599: yes)
! 600: AC_DEFINE_UNQUOTED(HAVE_LDAP_SSL_H, 1,
! 601: [Define to 1 if you have the ldap_ssl.h header file.])
! 602: ;;
! 603: esac
! 604: ])
! 605:
! 606:
! 607: dnl CURL_CHECK_HEADER_LDAPSSL
! 608: dnl -------------------------------------------------
! 609: dnl Check for compilable and valid ldapssl.h header
! 610:
! 611: AC_DEFUN([CURL_CHECK_HEADER_LDAPSSL], [
! 612: AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
! 613: AC_CACHE_CHECK([for ldapssl.h], [curl_cv_header_ldapssl_h], [
! 614: AC_COMPILE_IFELSE([
! 615: AC_LANG_PROGRAM([[
! 616: #undef inline
! 617: #ifdef HAVE_WINDOWS_H
! 618: #ifndef WIN32_LEAN_AND_MEAN
! 619: #define WIN32_LEAN_AND_MEAN
! 620: #endif
! 621: #include <windows.h>
! 622: #else
! 623: #ifdef HAVE_SYS_TYPES_H
! 624: #include <sys/types.h>
! 625: #endif
! 626: #endif
! 627: #ifndef NULL
! 628: #define NULL (void *)0
! 629: #endif
! 630: #ifndef LDAP_DEPRECATED
! 631: #define LDAP_DEPRECATED 1
! 632: #endif
! 633: #ifdef NEED_LBER_H
! 634: #include <lber.h>
! 635: #endif
! 636: #ifdef HAVE_LDAP_H
! 637: #include <ldap.h>
! 638: #endif
! 639: #include <ldapssl.h>
! 640: ]],[[
! 641: char *cert_label = NULL;
! 642: LDAP *ldp = ldap_ssl_init("dummy", LDAPS_PORT, cert_label);
! 643: ]])
! 644: ],[
! 645: curl_cv_header_ldapssl_h="yes"
! 646: ],[
! 647: curl_cv_header_ldapssl_h="no"
! 648: ])
! 649: ])
! 650: case "$curl_cv_header_ldapssl_h" in
! 651: yes)
! 652: AC_DEFINE_UNQUOTED(HAVE_LDAPSSL_H, 1,
! 653: [Define to 1 if you have the ldapssl.h header file.])
! 654: ;;
! 655: esac
! 656: ])
! 657:
! 658:
! 659: dnl CURL_CHECK_LIBS_WINLDAP
! 660: dnl -------------------------------------------------
! 661: dnl Check for libraries needed for WINLDAP support,
! 662: dnl and prepended to LIBS any needed libraries.
! 663: dnl This macro can take an optional parameter with a
! 664: dnl white space separated list of libraries to check
! 665: dnl before the WINLDAP default ones.
! 666:
! 667: AC_DEFUN([CURL_CHECK_LIBS_WINLDAP], [
! 668: AC_REQUIRE([CURL_CHECK_HEADER_WINBER])dnl
! 669: #
! 670: AC_MSG_CHECKING([for WINLDAP libraries])
! 671: #
! 672: u_libs=""
! 673: #
! 674: ifelse($1,,,[
! 675: for x_lib in $1; do
! 676: case "$x_lib" in
! 677: -l*)
! 678: l_lib="$x_lib"
! 679: ;;
! 680: *)
! 681: l_lib="-l$x_lib"
! 682: ;;
! 683: esac
! 684: if test -z "$u_libs"; then
! 685: u_libs="$l_lib"
! 686: else
! 687: u_libs="$u_libs $l_lib"
! 688: fi
! 689: done
! 690: ])
! 691: #
! 692: curl_cv_save_LIBS="$LIBS"
! 693: curl_cv_ldap_LIBS="unknown"
! 694: #
! 695: for x_nlibs in '' "$u_libs" \
! 696: '-lwldap32' ; do
! 697: if test "$curl_cv_ldap_LIBS" = "unknown"; then
! 698: if test -z "$x_nlibs"; then
! 699: LIBS="$curl_cv_save_LIBS"
! 700: else
! 701: LIBS="$x_nlibs $curl_cv_save_LIBS"
! 702: fi
! 703: AC_LINK_IFELSE([
! 704: AC_LANG_PROGRAM([[
! 705: #undef inline
! 706: #ifdef HAVE_WINDOWS_H
! 707: #ifndef WIN32_LEAN_AND_MEAN
! 708: #define WIN32_LEAN_AND_MEAN
! 709: #endif
! 710: #include <windows.h>
! 711: #ifdef HAVE_WINLDAP_H
! 712: #include <winldap.h>
! 713: #endif
! 714: #ifdef HAVE_WINBER_H
! 715: #include <winber.h>
! 716: #endif
! 717: #endif
! 718: ]],[[
! 719: BERVAL *bvp = NULL;
! 720: BerElement *bep = ber_init(bvp);
! 721: LDAP *ldp = ldap_init("dummy", LDAP_PORT);
! 722: ULONG res = ldap_unbind(ldp);
! 723: ber_free(bep, 1);
! 724: ]])
! 725: ],[
! 726: curl_cv_ldap_LIBS="$x_nlibs"
! 727: ])
! 728: fi
! 729: done
! 730: #
! 731: LIBS="$curl_cv_save_LIBS"
! 732: #
! 733: case X-"$curl_cv_ldap_LIBS" in
! 734: X-unknown)
! 735: AC_MSG_RESULT([cannot find WINLDAP libraries])
! 736: ;;
! 737: X-)
! 738: AC_MSG_RESULT([no additional lib required])
! 739: ;;
! 740: *)
! 741: if test -z "$curl_cv_save_LIBS"; then
! 742: LIBS="$curl_cv_ldap_LIBS"
! 743: else
! 744: LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
! 745: fi
! 746: AC_MSG_RESULT([$curl_cv_ldap_LIBS])
! 747: ;;
! 748: esac
! 749: #
! 750: ])
! 751:
! 752:
! 753: dnl CURL_CHECK_LIBS_LDAP
! 754: dnl -------------------------------------------------
! 755: dnl Check for libraries needed for LDAP support,
! 756: dnl and prepended to LIBS any needed libraries.
! 757: dnl This macro can take an optional parameter with a
! 758: dnl white space separated list of libraries to check
! 759: dnl before the default ones.
! 760:
! 761: AC_DEFUN([CURL_CHECK_LIBS_LDAP], [
! 762: AC_REQUIRE([CURL_CHECK_HEADER_LDAP])dnl
! 763: #
! 764: AC_MSG_CHECKING([for LDAP libraries])
! 765: #
! 766: u_libs=""
! 767: #
! 768: ifelse($1,,,[
! 769: for x_lib in $1; do
! 770: case "$x_lib" in
! 771: -l*)
! 772: l_lib="$x_lib"
! 773: ;;
! 774: *)
! 775: l_lib="-l$x_lib"
! 776: ;;
! 777: esac
! 778: if test -z "$u_libs"; then
! 779: u_libs="$l_lib"
! 780: else
! 781: u_libs="$u_libs $l_lib"
! 782: fi
! 783: done
! 784: ])
! 785: #
! 786: curl_cv_save_LIBS="$LIBS"
! 787: curl_cv_ldap_LIBS="unknown"
! 788: #
! 789: for x_nlibs in '' "$u_libs" \
! 790: '-lldap' \
! 791: '-lldap -llber' \
! 792: '-llber -lldap' \
! 793: '-lldapssl -lldapx -lldapsdk' \
! 794: '-lldapsdk -lldapx -lldapssl' \
! 795: '-lldap -llber -lssl -lcrypto' ; do
! 796:
! 797: if test "$curl_cv_ldap_LIBS" = "unknown"; then
! 798: if test -z "$x_nlibs"; then
! 799: LIBS="$curl_cv_save_LIBS"
! 800: else
! 801: LIBS="$x_nlibs $curl_cv_save_LIBS"
! 802: fi
! 803: AC_LINK_IFELSE([
! 804: AC_LANG_PROGRAM([[
! 805: #undef inline
! 806: #ifdef HAVE_WINDOWS_H
! 807: #ifndef WIN32_LEAN_AND_MEAN
! 808: #define WIN32_LEAN_AND_MEAN
! 809: #endif
! 810: #include <windows.h>
! 811: #else
! 812: #ifdef HAVE_SYS_TYPES_H
! 813: #include <sys/types.h>
! 814: #endif
! 815: #endif
! 816: #ifndef NULL
! 817: #define NULL (void *)0
! 818: #endif
! 819: #ifndef LDAP_DEPRECATED
! 820: #define LDAP_DEPRECATED 1
! 821: #endif
! 822: #ifdef NEED_LBER_H
! 823: #include <lber.h>
! 824: #endif
! 825: #ifdef HAVE_LDAP_H
! 826: #include <ldap.h>
! 827: #endif
! 828: ]],[[
! 829: BerValue *bvp = NULL;
! 830: BerElement *bep = ber_init(bvp);
! 831: LDAP *ldp = ldap_init("dummy", LDAP_PORT);
! 832: int res = ldap_unbind(ldp);
! 833: ber_free(bep, 1);
! 834: ]])
! 835: ],[
! 836: curl_cv_ldap_LIBS="$x_nlibs"
! 837: ])
! 838: fi
! 839: done
! 840: #
! 841: LIBS="$curl_cv_save_LIBS"
! 842: #
! 843: case X-"$curl_cv_ldap_LIBS" in
! 844: X-unknown)
! 845: AC_MSG_RESULT([cannot find LDAP libraries])
! 846: ;;
! 847: X-)
! 848: AC_MSG_RESULT([no additional lib required])
! 849: ;;
! 850: *)
! 851: if test -z "$curl_cv_save_LIBS"; then
! 852: LIBS="$curl_cv_ldap_LIBS"
! 853: else
! 854: LIBS="$curl_cv_ldap_LIBS $curl_cv_save_LIBS"
! 855: fi
! 856: AC_MSG_RESULT([$curl_cv_ldap_LIBS])
! 857: ;;
! 858: esac
! 859: #
! 860: ])
! 861:
! 862:
! 863: dnl CURL_CHECK_HEADER_MALLOC
! 864: dnl -------------------------------------------------
! 865: dnl Check for compilable and valid malloc.h header,
! 866: dnl and check if it is needed even with stdlib.h
! 867:
! 868: AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [
! 869: AC_CACHE_CHECK([for malloc.h], [curl_cv_header_malloc_h], [
! 870: AC_COMPILE_IFELSE([
! 871: AC_LANG_PROGRAM([[
! 872: #include <malloc.h>
! 873: ]],[[
! 874: void *p = malloc(10);
! 875: void *q = calloc(10,10);
! 876: free(p);
! 877: free(q);
! 878: ]])
! 879: ],[
! 880: curl_cv_header_malloc_h="yes"
! 881: ],[
! 882: curl_cv_header_malloc_h="no"
! 883: ])
! 884: ])
! 885: if test "$curl_cv_header_malloc_h" = "yes"; then
! 886: AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1,
! 887: [Define to 1 if you have the malloc.h header file.])
! 888: #
! 889: AC_COMPILE_IFELSE([
! 890: AC_LANG_PROGRAM([[
! 891: #include <stdlib.h>
! 892: ]],[[
! 893: void *p = malloc(10);
! 894: void *q = calloc(10,10);
! 895: free(p);
! 896: free(q);
! 897: ]])
! 898: ],[
! 899: curl_cv_need_header_malloc_h="no"
! 900: ],[
! 901: curl_cv_need_header_malloc_h="yes"
! 902: ])
! 903: #
! 904: case "$curl_cv_need_header_malloc_h" in
! 905: yes)
! 906: AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1,
! 907: [Define to 1 if you need the malloc.h header file even with stdlib.h])
! 908: ;;
! 909: esac
! 910: fi
! 911: ])
! 912:
! 913:
! 914: dnl CURL_CHECK_HEADER_MEMORY
! 915: dnl -------------------------------------------------
! 916: dnl Check for compilable and valid memory.h header,
! 917: dnl and check if it is needed even with stdlib.h for
! 918: dnl memory related functions.
! 919:
! 920: AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [
! 921: AC_CACHE_CHECK([for memory.h], [curl_cv_header_memory_h], [
! 922: AC_COMPILE_IFELSE([
! 923: AC_LANG_PROGRAM([[
! 924: #include <memory.h>
! 925: ]],[[
! 926: void *p = malloc(10);
! 927: void *q = calloc(10,10);
! 928: free(p);
! 929: free(q);
! 930: ]])
! 931: ],[
! 932: curl_cv_header_memory_h="yes"
! 933: ],[
! 934: curl_cv_header_memory_h="no"
! 935: ])
! 936: ])
! 937: if test "$curl_cv_header_memory_h" = "yes"; then
! 938: AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1,
! 939: [Define to 1 if you have the memory.h header file.])
! 940: #
! 941: AC_COMPILE_IFELSE([
! 942: AC_LANG_PROGRAM([[
! 943: #include <stdlib.h>
! 944: ]],[[
! 945: void *p = malloc(10);
! 946: void *q = calloc(10,10);
! 947: free(p);
! 948: free(q);
! 949: ]])
! 950: ],[
! 951: curl_cv_need_header_memory_h="no"
! 952: ],[
! 953: curl_cv_need_header_memory_h="yes"
! 954: ])
! 955: #
! 956: case "$curl_cv_need_header_memory_h" in
! 957: yes)
! 958: AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1,
! 959: [Define to 1 if you need the memory.h header file even with stdlib.h])
! 960: ;;
! 961: esac
! 962: fi
! 963: ])
! 964:
! 965: dnl TYPE_SOCKADDR_STORAGE
! 966: dnl -------------------------------------------------
! 967: dnl Check for struct sockaddr_storage. Most IPv6-enabled
! 968: dnl hosts have it, but AIX 4.3 is one known exception.
! 969:
! 970: AC_DEFUN([TYPE_SOCKADDR_STORAGE],
! 971: [
! 972: AC_CHECK_TYPE([struct sockaddr_storage],
! 973: AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
! 974: [if struct sockaddr_storage is defined]), ,
! 975: [
! 976: #undef inline
! 977: #ifdef HAVE_WINDOWS_H
! 978: #ifndef WIN32_LEAN_AND_MEAN
! 979: #define WIN32_LEAN_AND_MEAN
! 980: #endif
! 981: #include <windows.h>
! 982: #ifdef HAVE_WINSOCK2_H
! 983: #include <winsock2.h>
! 984: #endif
! 985: #else
! 986: #ifdef HAVE_SYS_TYPES_H
! 987: #include <sys/types.h>
! 988: #endif
! 989: #ifdef HAVE_SYS_SOCKET_H
! 990: #include <sys/socket.h>
! 991: #endif
! 992: #ifdef HAVE_NETINET_IN_H
! 993: #include <netinet/in.h>
! 994: #endif
! 995: #ifdef HAVE_ARPA_INET_H
! 996: #include <arpa/inet.h>
! 997: #endif
! 998: #endif
! 999: ])
! 1000: ])
! 1001:
! 1002: dnl CURL_CHECK_FUNC_RECV
! 1003: dnl -------------------------------------------------
! 1004: dnl Test if the socket recv() function is available,
! 1005: dnl and check its return type and the types of its
! 1006: dnl arguments. If the function succeeds HAVE_RECV
! 1007: dnl will be defined, defining the types of the arguments
! 1008: dnl in RECV_TYPE_ARG1, RECV_TYPE_ARG2, RECV_TYPE_ARG3
! 1009: dnl and RECV_TYPE_ARG4, defining the type of the function
! 1010: dnl return value in RECV_TYPE_RETV.
! 1011:
! 1012: AC_DEFUN([CURL_CHECK_FUNC_RECV], [
! 1013: AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
! 1014: AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
! 1015: AC_CHECK_HEADERS(sys/types.h sys/socket.h)
! 1016: #
! 1017: AC_MSG_CHECKING([for recv])
! 1018: AC_LINK_IFELSE([
! 1019: AC_LANG_PROGRAM([[
! 1020: #undef inline
! 1021: #ifdef HAVE_WINDOWS_H
! 1022: #ifndef WIN32_LEAN_AND_MEAN
! 1023: #define WIN32_LEAN_AND_MEAN
! 1024: #endif
! 1025: #include <windows.h>
! 1026: #ifdef HAVE_WINSOCK2_H
! 1027: #include <winsock2.h>
! 1028: #else
! 1029: #ifdef HAVE_WINSOCK_H
! 1030: #include <winsock.h>
! 1031: #endif
! 1032: #endif
! 1033: #else
! 1034: #ifdef HAVE_PROTO_BSDSOCKET_H
! 1035: #include <proto/bsdsocket.h>
! 1036: struct Library *SocketBase = NULL;
! 1037: #endif
! 1038: #ifdef HAVE_SYS_TYPES_H
! 1039: #include <sys/types.h>
! 1040: #endif
! 1041: #ifdef HAVE_SYS_SOCKET_H
! 1042: #include <sys/socket.h>
! 1043: #endif
! 1044: #endif
! 1045: ]],[[
! 1046: recv(0, 0, 0, 0);
! 1047: ]])
! 1048: ],[
! 1049: AC_MSG_RESULT([yes])
! 1050: curl_cv_recv="yes"
! 1051: ],[
! 1052: AC_MSG_RESULT([no])
! 1053: curl_cv_recv="no"
! 1054: ])
! 1055: #
! 1056: if test "$curl_cv_recv" = "yes"; then
! 1057: AC_CACHE_CHECK([types of args and return type for recv],
! 1058: [curl_cv_func_recv_args], [
! 1059: curl_cv_func_recv_args="unknown"
! 1060: for recv_retv in 'int' 'ssize_t'; do
! 1061: for recv_arg1 in 'int' 'ssize_t' 'SOCKET'; do
! 1062: for recv_arg2 in 'char *' 'void *'; do
! 1063: for recv_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
! 1064: for recv_arg4 in 'int' 'unsigned int'; do
! 1065: if test "$curl_cv_func_recv_args" = "unknown"; then
! 1066: AC_COMPILE_IFELSE([
! 1067: AC_LANG_PROGRAM([[
! 1068: #undef inline
! 1069: #ifdef HAVE_WINDOWS_H
! 1070: #ifndef WIN32_LEAN_AND_MEAN
! 1071: #define WIN32_LEAN_AND_MEAN
! 1072: #endif
! 1073: #include <windows.h>
! 1074: #ifdef HAVE_WINSOCK2_H
! 1075: #include <winsock2.h>
! 1076: #else
! 1077: #ifdef HAVE_WINSOCK_H
! 1078: #include <winsock.h>
! 1079: #endif
! 1080: #endif
! 1081: #define RECVCALLCONV PASCAL
! 1082: #else
! 1083: #ifdef HAVE_PROTO_BSDSOCKET_H
! 1084: #include <proto/bsdsocket.h>
! 1085: struct Library *SocketBase = NULL;
! 1086: #endif
! 1087: #ifdef HAVE_SYS_TYPES_H
! 1088: #include <sys/types.h>
! 1089: #endif
! 1090: #ifdef HAVE_SYS_SOCKET_H
! 1091: #include <sys/socket.h>
! 1092: #endif
! 1093: #define RECVCALLCONV
! 1094: #endif
! 1095: #ifndef HAVE_PROTO_BSDSOCKET_H
! 1096: extern $recv_retv RECVCALLCONV
! 1097: recv($recv_arg1, $recv_arg2, $recv_arg3, $recv_arg4);
! 1098: #endif
! 1099: ]],[[
! 1100: $recv_arg1 s=0;
! 1101: $recv_arg2 buf=0;
! 1102: $recv_arg3 len=0;
! 1103: $recv_arg4 flags=0;
! 1104: $recv_retv res = recv(s, buf, len, flags);
! 1105: ]])
! 1106: ],[
! 1107: curl_cv_func_recv_args="$recv_arg1,$recv_arg2,$recv_arg3,$recv_arg4,$recv_retv"
! 1108: ])
! 1109: fi
! 1110: done
! 1111: done
! 1112: done
! 1113: done
! 1114: done
! 1115: ]) # AC-CACHE-CHECK
! 1116: if test "$curl_cv_func_recv_args" = "unknown"; then
! 1117: AC_MSG_ERROR([Cannot find proper types to use for recv args])
! 1118: else
! 1119: recv_prev_IFS=$IFS; IFS=','
! 1120: set dummy `echo "$curl_cv_func_recv_args" | sed 's/\*/\*/g'`
! 1121: IFS=$recv_prev_IFS
! 1122: shift
! 1123: #
! 1124: AC_DEFINE_UNQUOTED(RECV_TYPE_ARG1, $[1],
! 1125: [Define to the type of arg 1 for recv.])
! 1126: AC_DEFINE_UNQUOTED(RECV_TYPE_ARG2, $[2],
! 1127: [Define to the type of arg 2 for recv.])
! 1128: AC_DEFINE_UNQUOTED(RECV_TYPE_ARG3, $[3],
! 1129: [Define to the type of arg 3 for recv.])
! 1130: AC_DEFINE_UNQUOTED(RECV_TYPE_ARG4, $[4],
! 1131: [Define to the type of arg 4 for recv.])
! 1132: AC_DEFINE_UNQUOTED(RECV_TYPE_RETV, $[5],
! 1133: [Define to the function return type for recv.])
! 1134: #
! 1135: AC_DEFINE_UNQUOTED(HAVE_RECV, 1,
! 1136: [Define to 1 if you have the recv function.])
! 1137: curl_cv_func_recv="yes"
! 1138: fi
! 1139: else
! 1140: AC_MSG_ERROR([Unable to link function recv])
! 1141: fi
! 1142: ])
! 1143:
! 1144:
! 1145: dnl CURL_CHECK_FUNC_SEND
! 1146: dnl -------------------------------------------------
! 1147: dnl Test if the socket send() function is available,
! 1148: dnl and check its return type and the types of its
! 1149: dnl arguments. If the function succeeds HAVE_SEND
! 1150: dnl will be defined, defining the types of the arguments
! 1151: dnl in SEND_TYPE_ARG1, SEND_TYPE_ARG2, SEND_TYPE_ARG3
! 1152: dnl and SEND_TYPE_ARG4, defining the type of the function
! 1153: dnl return value in SEND_TYPE_RETV, and also defining the
! 1154: dnl type qualifier of second argument in SEND_QUAL_ARG2.
! 1155:
! 1156: AC_DEFUN([CURL_CHECK_FUNC_SEND], [
! 1157: AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
! 1158: AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
! 1159: AC_CHECK_HEADERS(sys/types.h sys/socket.h)
! 1160: #
! 1161: AC_MSG_CHECKING([for send])
! 1162: AC_LINK_IFELSE([
! 1163: AC_LANG_PROGRAM([[
! 1164: #undef inline
! 1165: #ifdef HAVE_WINDOWS_H
! 1166: #ifndef WIN32_LEAN_AND_MEAN
! 1167: #define WIN32_LEAN_AND_MEAN
! 1168: #endif
! 1169: #include <windows.h>
! 1170: #ifdef HAVE_WINSOCK2_H
! 1171: #include <winsock2.h>
! 1172: #else
! 1173: #ifdef HAVE_WINSOCK_H
! 1174: #include <winsock.h>
! 1175: #endif
! 1176: #endif
! 1177: #else
! 1178: #ifdef HAVE_PROTO_BSDSOCKET_H
! 1179: #include <proto/bsdsocket.h>
! 1180: struct Library *SocketBase = NULL;
! 1181: #endif
! 1182: #ifdef HAVE_SYS_TYPES_H
! 1183: #include <sys/types.h>
! 1184: #endif
! 1185: #ifdef HAVE_SYS_SOCKET_H
! 1186: #include <sys/socket.h>
! 1187: #endif
! 1188: #endif
! 1189: ]],[[
! 1190: send(0, 0, 0, 0);
! 1191: ]])
! 1192: ],[
! 1193: AC_MSG_RESULT([yes])
! 1194: curl_cv_send="yes"
! 1195: ],[
! 1196: AC_MSG_RESULT([no])
! 1197: curl_cv_send="no"
! 1198: ])
! 1199: #
! 1200: if test "$curl_cv_send" = "yes"; then
! 1201: AC_CACHE_CHECK([types of args and return type for send],
! 1202: [curl_cv_func_send_args], [
! 1203: curl_cv_func_send_args="unknown"
! 1204: for send_retv in 'int' 'ssize_t'; do
! 1205: for send_arg1 in 'int' 'ssize_t' 'SOCKET'; do
! 1206: for send_arg2 in 'char *' 'void *' 'const char *' 'const void *'; do
! 1207: for send_arg3 in 'size_t' 'int' 'socklen_t' 'unsigned int'; do
! 1208: for send_arg4 in 'int' 'unsigned int'; do
! 1209: if test "$curl_cv_func_send_args" = "unknown"; then
! 1210: AC_COMPILE_IFELSE([
! 1211: AC_LANG_PROGRAM([[
! 1212: #undef inline
! 1213: #ifdef HAVE_WINDOWS_H
! 1214: #ifndef WIN32_LEAN_AND_MEAN
! 1215: #define WIN32_LEAN_AND_MEAN
! 1216: #endif
! 1217: #include <windows.h>
! 1218: #ifdef HAVE_WINSOCK2_H
! 1219: #include <winsock2.h>
! 1220: #else
! 1221: #ifdef HAVE_WINSOCK_H
! 1222: #include <winsock.h>
! 1223: #endif
! 1224: #endif
! 1225: #define SENDCALLCONV PASCAL
! 1226: #else
! 1227: #ifdef HAVE_PROTO_BSDSOCKET_H
! 1228: #include <proto/bsdsocket.h>
! 1229: struct Library *SocketBase = NULL;
! 1230: #endif
! 1231: #ifdef HAVE_SYS_TYPES_H
! 1232: #include <sys/types.h>
! 1233: #endif
! 1234: #ifdef HAVE_SYS_SOCKET_H
! 1235: #include <sys/socket.h>
! 1236: #endif
! 1237: #define SENDCALLCONV
! 1238: #endif
! 1239: #ifndef HAVE_PROTO_BSDSOCKET_H
! 1240: extern $send_retv SENDCALLCONV
! 1241: send($send_arg1, $send_arg2, $send_arg3, $send_arg4);
! 1242: #endif
! 1243: ]],[[
! 1244: $send_arg1 s=0;
! 1245: $send_arg3 len=0;
! 1246: $send_arg4 flags=0;
! 1247: $send_retv res = send(s, 0, len, flags);
! 1248: ]])
! 1249: ],[
! 1250: curl_cv_func_send_args="$send_arg1,$send_arg2,$send_arg3,$send_arg4,$send_retv"
! 1251: ])
! 1252: fi
! 1253: done
! 1254: done
! 1255: done
! 1256: done
! 1257: done
! 1258: ]) # AC-CACHE-CHECK
! 1259: if test "$curl_cv_func_send_args" = "unknown"; then
! 1260: AC_MSG_ERROR([Cannot find proper types to use for send args])
! 1261: else
! 1262: send_prev_IFS=$IFS; IFS=','
! 1263: set dummy `echo "$curl_cv_func_send_args" | sed 's/\*/\*/g'`
! 1264: IFS=$send_prev_IFS
! 1265: shift
! 1266: #
! 1267: send_qual_type_arg2=$[2]
! 1268: #
! 1269: AC_DEFINE_UNQUOTED(SEND_TYPE_ARG1, $[1],
! 1270: [Define to the type of arg 1 for send.])
! 1271: AC_DEFINE_UNQUOTED(SEND_TYPE_ARG3, $[3],
! 1272: [Define to the type of arg 3 for send.])
! 1273: AC_DEFINE_UNQUOTED(SEND_TYPE_ARG4, $[4],
! 1274: [Define to the type of arg 4 for send.])
! 1275: AC_DEFINE_UNQUOTED(SEND_TYPE_RETV, $[5],
! 1276: [Define to the function return type for send.])
! 1277: #
! 1278: prev_sh_opts=$-
! 1279: #
! 1280: case $prev_sh_opts in
! 1281: *f*)
! 1282: ;;
! 1283: *)
! 1284: set -f
! 1285: ;;
! 1286: esac
! 1287: #
! 1288: case "$send_qual_type_arg2" in
! 1289: const*)
! 1290: send_qual_arg2=const
! 1291: send_type_arg2=`echo $send_qual_type_arg2 | sed 's/^const //'`
! 1292: ;;
! 1293: *)
! 1294: send_qual_arg2=
! 1295: send_type_arg2=$send_qual_type_arg2
! 1296: ;;
! 1297: esac
! 1298: #
! 1299: AC_DEFINE_UNQUOTED(SEND_QUAL_ARG2, $send_qual_arg2,
! 1300: [Define to the type qualifier of arg 2 for send.])
! 1301: AC_DEFINE_UNQUOTED(SEND_TYPE_ARG2, $send_type_arg2,
! 1302: [Define to the type of arg 2 for send.])
! 1303: #
! 1304: case $prev_sh_opts in
! 1305: *f*)
! 1306: ;;
! 1307: *)
! 1308: set +f
! 1309: ;;
! 1310: esac
! 1311: #
! 1312: AC_DEFINE_UNQUOTED(HAVE_SEND, 1,
! 1313: [Define to 1 if you have the send function.])
! 1314: curl_cv_func_send="yes"
! 1315: fi
! 1316: else
! 1317: AC_MSG_ERROR([Unable to link function send])
! 1318: fi
! 1319: ])
! 1320:
! 1321: dnl CURL_CHECK_MSG_NOSIGNAL
! 1322: dnl -------------------------------------------------
! 1323: dnl Check for MSG_NOSIGNAL
! 1324:
! 1325: AC_DEFUN([CURL_CHECK_MSG_NOSIGNAL], [
! 1326: AC_CHECK_HEADERS(sys/types.h sys/socket.h)
! 1327: AC_CACHE_CHECK([for MSG_NOSIGNAL], [curl_cv_msg_nosignal], [
! 1328: AC_COMPILE_IFELSE([
! 1329: AC_LANG_PROGRAM([[
! 1330: #undef inline
! 1331: #ifdef HAVE_WINDOWS_H
! 1332: #ifndef WIN32_LEAN_AND_MEAN
! 1333: #define WIN32_LEAN_AND_MEAN
! 1334: #endif
! 1335: #include <windows.h>
! 1336: #ifdef HAVE_WINSOCK2_H
! 1337: #include <winsock2.h>
! 1338: #else
! 1339: #ifdef HAVE_WINSOCK_H
! 1340: #include <winsock.h>
! 1341: #endif
! 1342: #endif
! 1343: #else
! 1344: #ifdef HAVE_PROTO_BSDSOCKET_H
! 1345: #include <proto/bsdsocket.h>
! 1346: struct Library *SocketBase = NULL;
! 1347: #endif
! 1348: #ifdef HAVE_SYS_TYPES_H
! 1349: #include <sys/types.h>
! 1350: #endif
! 1351: #ifdef HAVE_SYS_SOCKET_H
! 1352: #include <sys/socket.h>
! 1353: #endif
! 1354: #endif
! 1355: ]],[[
! 1356: int flag=MSG_NOSIGNAL;
! 1357: ]])
! 1358: ],[
! 1359: curl_cv_msg_nosignal="yes"
! 1360: ],[
! 1361: curl_cv_msg_nosignal="no"
! 1362: ])
! 1363: ])
! 1364: case "$curl_cv_msg_nosignal" in
! 1365: yes)
! 1366: AC_DEFINE_UNQUOTED(HAVE_MSG_NOSIGNAL, 1,
! 1367: [Define to 1 if you have the MSG_NOSIGNAL flag.])
! 1368: ;;
! 1369: esac
! 1370: ])
! 1371:
! 1372:
! 1373: dnl CURL_CHECK_STRUCT_TIMEVAL
! 1374: dnl -------------------------------------------------
! 1375: dnl Check for timeval struct
! 1376:
! 1377: AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [
! 1378: AC_REQUIRE([AC_HEADER_TIME])dnl
! 1379: AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl
! 1380: AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl
! 1381: AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h)
! 1382: AC_CACHE_CHECK([for struct timeval], [curl_cv_struct_timeval], [
! 1383: AC_COMPILE_IFELSE([
! 1384: AC_LANG_PROGRAM([[
! 1385: #undef inline
! 1386: #ifdef HAVE_WINDOWS_H
! 1387: #ifndef WIN32_LEAN_AND_MEAN
! 1388: #define WIN32_LEAN_AND_MEAN
! 1389: #endif
! 1390: #include <windows.h>
! 1391: #ifdef HAVE_WINSOCK2_H
! 1392: #include <winsock2.h>
! 1393: #else
! 1394: #ifdef HAVE_WINSOCK_H
! 1395: #include <winsock.h>
! 1396: #endif
! 1397: #endif
! 1398: #endif
! 1399: #ifdef HAVE_SYS_TYPES_H
! 1400: #include <sys/types.h>
! 1401: #endif
! 1402: #ifdef HAVE_SYS_TIME_H
! 1403: #include <sys/time.h>
! 1404: #ifdef TIME_WITH_SYS_TIME
! 1405: #include <time.h>
! 1406: #endif
! 1407: #else
! 1408: #ifdef HAVE_TIME_H
! 1409: #include <time.h>
! 1410: #endif
! 1411: #endif
! 1412: #ifdef HAVE_SYS_SOCKET_H
! 1413: #include <sys/socket.h>
! 1414: #endif
! 1415: ]],[[
! 1416: struct timeval ts;
! 1417: ts.tv_sec = 0;
! 1418: ts.tv_usec = 0;
! 1419: ]])
! 1420: ],[
! 1421: curl_cv_struct_timeval="yes"
! 1422: ],[
! 1423: curl_cv_struct_timeval="no"
! 1424: ])
! 1425: ])
! 1426: case "$curl_cv_struct_timeval" in
! 1427: yes)
! 1428: AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMEVAL, 1,
! 1429: [Define to 1 if you have the timeval struct.])
! 1430: ;;
! 1431: esac
! 1432: ])
! 1433:
! 1434:
! 1435: dnl TYPE_SIG_ATOMIC_T
! 1436: dnl -------------------------------------------------
! 1437: dnl Check if the sig_atomic_t type is available, and
! 1438: dnl verify if it is already defined as volatile.
! 1439:
! 1440: AC_DEFUN([TYPE_SIG_ATOMIC_T], [
! 1441: AC_CHECK_HEADERS(signal.h)
! 1442: AC_CHECK_TYPE([sig_atomic_t],[
! 1443: AC_DEFINE(HAVE_SIG_ATOMIC_T, 1,
! 1444: [Define to 1 if sig_atomic_t is an available typedef.])
! 1445: ], ,[
! 1446: #ifdef HAVE_SIGNAL_H
! 1447: #include <signal.h>
! 1448: #endif
! 1449: ])
! 1450: case "$ac_cv_type_sig_atomic_t" in
! 1451: yes)
! 1452: #
! 1453: AC_MSG_CHECKING([if sig_atomic_t is already defined as volatile])
! 1454: AC_LINK_IFELSE([
! 1455: AC_LANG_PROGRAM([[
! 1456: #ifdef HAVE_SIGNAL_H
! 1457: #include <signal.h>
! 1458: #endif
! 1459: ]],[[
! 1460: static volatile sig_atomic_t dummy = 0;
! 1461: ]])
! 1462: ],[
! 1463: AC_MSG_RESULT([no])
! 1464: curl_cv_sig_atomic_t_volatile="no"
! 1465: ],[
! 1466: AC_MSG_RESULT([yes])
! 1467: curl_cv_sig_atomic_t_volatile="yes"
! 1468: ])
! 1469: #
! 1470: if test "$curl_cv_sig_atomic_t_volatile" = "yes"; then
! 1471: AC_DEFINE(HAVE_SIG_ATOMIC_T_VOLATILE, 1,
! 1472: [Define to 1 if sig_atomic_t is already defined as volatile.])
! 1473: fi
! 1474: ;;
! 1475: esac
! 1476: ])
! 1477:
! 1478:
! 1479: dnl TYPE_IN_ADDR_T
! 1480: dnl -------------------------------------------------
! 1481: dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
! 1482: dnl and a few other things.
! 1483:
! 1484: AC_DEFUN([TYPE_IN_ADDR_T], [
! 1485: AC_CHECK_TYPE([in_addr_t], ,[
! 1486: dnl in_addr_t not available
! 1487: AC_CACHE_CHECK([for in_addr_t equivalent],
! 1488: [curl_cv_in_addr_t_equiv], [
! 1489: curl_cv_in_addr_t_equiv="unknown"
! 1490: for t in "unsigned long" int size_t unsigned long; do
! 1491: if test "$curl_cv_in_addr_t_equiv" = "unknown"; then
! 1492: AC_LINK_IFELSE([
! 1493: AC_LANG_PROGRAM([[
! 1494: #undef inline
! 1495: #ifdef HAVE_WINDOWS_H
! 1496: #ifndef WIN32_LEAN_AND_MEAN
! 1497: #define WIN32_LEAN_AND_MEAN
! 1498: #endif
! 1499: #include <windows.h>
! 1500: #ifdef HAVE_WINSOCK2_H
! 1501: #include <winsock2.h>
! 1502: #else
! 1503: #ifdef HAVE_WINSOCK_H
! 1504: #include <winsock.h>
! 1505: #endif
! 1506: #endif
! 1507: #else
! 1508: #ifdef HAVE_SYS_TYPES_H
! 1509: #include <sys/types.h>
! 1510: #endif
! 1511: #ifdef HAVE_SYS_SOCKET_H
! 1512: #include <sys/socket.h>
! 1513: #endif
! 1514: #ifdef HAVE_NETINET_IN_H
! 1515: #include <netinet/in.h>
! 1516: #endif
! 1517: #ifdef HAVE_ARPA_INET_H
! 1518: #include <arpa/inet.h>
! 1519: #endif
! 1520: #endif
! 1521: ]],[[
! 1522: $t data = inet_addr ("1.2.3.4");
! 1523: ]])
! 1524: ],[
! 1525: curl_cv_in_addr_t_equiv="$t"
! 1526: ])
! 1527: fi
! 1528: done
! 1529: ])
! 1530: case "$curl_cv_in_addr_t_equiv" in
! 1531: unknown)
! 1532: AC_MSG_ERROR([Cannot find a type to use in place of in_addr_t])
! 1533: ;;
! 1534: *)
! 1535: AC_DEFINE_UNQUOTED(in_addr_t, $curl_cv_in_addr_t_equiv,
! 1536: [Type to use in place of in_addr_t when system does not provide it.])
! 1537: ;;
! 1538: esac
! 1539: ],[
! 1540: #undef inline
! 1541: #ifdef HAVE_WINDOWS_H
! 1542: #ifndef WIN32_LEAN_AND_MEAN
! 1543: #define WIN32_LEAN_AND_MEAN
! 1544: #endif
! 1545: #include <windows.h>
! 1546: #ifdef HAVE_WINSOCK2_H
! 1547: #include <winsock2.h>
! 1548: #else
! 1549: #ifdef HAVE_WINSOCK_H
! 1550: #include <winsock.h>
! 1551: #endif
! 1552: #endif
! 1553: #else
! 1554: #ifdef HAVE_SYS_TYPES_H
! 1555: #include <sys/types.h>
! 1556: #endif
! 1557: #ifdef HAVE_SYS_SOCKET_H
! 1558: #include <sys/socket.h>
! 1559: #endif
! 1560: #ifdef HAVE_NETINET_IN_H
! 1561: #include <netinet/in.h>
! 1562: #endif
! 1563: #ifdef HAVE_ARPA_INET_H
! 1564: #include <arpa/inet.h>
! 1565: #endif
! 1566: #endif
! 1567: ])
! 1568: ])
! 1569:
! 1570:
! 1571: dnl CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC
! 1572: dnl -------------------------------------------------
! 1573: dnl Check if monotonic clock_gettime is available.
! 1574:
! 1575: AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
! 1576: AC_REQUIRE([AC_HEADER_TIME])dnl
! 1577: AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
! 1578: AC_MSG_CHECKING([for monotonic clock_gettime])
! 1579: #
! 1580: if test "x$dontwant_rt" = "xno" ; then
! 1581: AC_COMPILE_IFELSE([
! 1582: AC_LANG_PROGRAM([[
! 1583: #ifdef HAVE_SYS_TYPES_H
! 1584: #include <sys/types.h>
! 1585: #endif
! 1586: #ifdef HAVE_SYS_TIME_H
! 1587: #include <sys/time.h>
! 1588: #ifdef TIME_WITH_SYS_TIME
! 1589: #include <time.h>
! 1590: #endif
! 1591: #else
! 1592: #ifdef HAVE_TIME_H
! 1593: #include <time.h>
! 1594: #endif
! 1595: #endif
! 1596: ]],[[
! 1597: struct timespec ts;
! 1598: (void)clock_gettime(CLOCK_MONOTONIC, &ts);
! 1599: ]])
! 1600: ],[
! 1601: AC_MSG_RESULT([yes])
! 1602: curl_func_clock_gettime="yes"
! 1603: ],[
! 1604: AC_MSG_RESULT([no])
! 1605: curl_func_clock_gettime="no"
! 1606: ])
! 1607: fi
! 1608: dnl Definition of HAVE_CLOCK_GETTIME_MONOTONIC is intentionally postponed
! 1609: dnl until library linking and run-time checks for clock_gettime succeed.
! 1610: ])
! 1611:
! 1612:
! 1613: dnl CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
! 1614: dnl -------------------------------------------------
! 1615: dnl If monotonic clock_gettime is available then,
! 1616: dnl check and prepended to LIBS any needed libraries.
! 1617:
! 1618: AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
! 1619: AC_REQUIRE([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC])dnl
! 1620: #
! 1621: if test "$curl_func_clock_gettime" = "yes"; then
! 1622: #
! 1623: AC_MSG_CHECKING([for clock_gettime in libraries])
! 1624: #
! 1625: curl_cv_save_LIBS="$LIBS"
! 1626: curl_cv_gclk_LIBS="unknown"
! 1627: #
! 1628: for x_xlibs in '' '-lrt' '-lposix4' ; do
! 1629: if test "$curl_cv_gclk_LIBS" = "unknown"; then
! 1630: if test -z "$x_xlibs"; then
! 1631: LIBS="$curl_cv_save_LIBS"
! 1632: else
! 1633: LIBS="$x_xlibs $curl_cv_save_LIBS"
! 1634: fi
! 1635: AC_LINK_IFELSE([
! 1636: AC_LANG_PROGRAM([[
! 1637: #ifdef HAVE_SYS_TYPES_H
! 1638: #include <sys/types.h>
! 1639: #endif
! 1640: #ifdef HAVE_SYS_TIME_H
! 1641: #include <sys/time.h>
! 1642: #ifdef TIME_WITH_SYS_TIME
! 1643: #include <time.h>
! 1644: #endif
! 1645: #else
! 1646: #ifdef HAVE_TIME_H
! 1647: #include <time.h>
! 1648: #endif
! 1649: #endif
! 1650: ]],[[
! 1651: struct timespec ts;
! 1652: (void)clock_gettime(CLOCK_MONOTONIC, &ts);
! 1653: ]])
! 1654: ],[
! 1655: curl_cv_gclk_LIBS="$x_xlibs"
! 1656: ])
! 1657: fi
! 1658: done
! 1659: #
! 1660: LIBS="$curl_cv_save_LIBS"
! 1661: #
! 1662: case X-"$curl_cv_gclk_LIBS" in
! 1663: X-unknown)
! 1664: AC_MSG_RESULT([cannot find clock_gettime])
! 1665: AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
! 1666: curl_func_clock_gettime="no"
! 1667: ;;
! 1668: X-)
! 1669: AC_MSG_RESULT([no additional lib required])
! 1670: curl_func_clock_gettime="yes"
! 1671: ;;
! 1672: *)
! 1673: if test -z "$curl_cv_save_LIBS"; then
! 1674: LIBS="$curl_cv_gclk_LIBS"
! 1675: else
! 1676: LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
! 1677: fi
! 1678: AC_MSG_RESULT([$curl_cv_gclk_LIBS])
! 1679: curl_func_clock_gettime="yes"
! 1680: ;;
! 1681: esac
! 1682: #
! 1683: dnl only do runtime verification when not cross-compiling
! 1684: if test "x$cross_compiling" != "xyes" &&
! 1685: test "$curl_func_clock_gettime" = "yes"; then
! 1686: AC_MSG_CHECKING([if monotonic clock_gettime works])
! 1687: CURL_RUN_IFELSE([
! 1688: AC_LANG_PROGRAM([[
! 1689: #ifdef HAVE_STDLIB_H
! 1690: #include <stdlib.h>
! 1691: #endif
! 1692: #ifdef HAVE_SYS_TYPES_H
! 1693: #include <sys/types.h>
! 1694: #endif
! 1695: #ifdef HAVE_SYS_TIME_H
! 1696: #include <sys/time.h>
! 1697: #ifdef TIME_WITH_SYS_TIME
! 1698: #include <time.h>
! 1699: #endif
! 1700: #else
! 1701: #ifdef HAVE_TIME_H
! 1702: #include <time.h>
! 1703: #endif
! 1704: #endif
! 1705: ]],[[
! 1706: struct timespec ts;
! 1707: if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
! 1708: exit(0);
! 1709: else
! 1710: exit(1);
! 1711: ]])
! 1712: ],[
! 1713: AC_MSG_RESULT([yes])
! 1714: ],[
! 1715: AC_MSG_RESULT([no])
! 1716: AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
! 1717: curl_func_clock_gettime="no"
! 1718: LIBS="$curl_cv_save_LIBS"
! 1719: ])
! 1720: fi
! 1721: #
! 1722: case "$curl_func_clock_gettime" in
! 1723: yes)
! 1724: AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
! 1725: [Define to 1 if you have the clock_gettime function and monotonic timer.])
! 1726: ;;
! 1727: esac
! 1728: #
! 1729: fi
! 1730: #
! 1731: ])
! 1732:
! 1733:
! 1734: dnl CURL_CHECK_LIBS_CONNECT
! 1735: dnl -------------------------------------------------
! 1736: dnl Verify if network connect function is already available
! 1737: dnl using current libraries or if another one is required.
! 1738:
! 1739: AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [
! 1740: AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
! 1741: AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
! 1742: AC_MSG_CHECKING([for connect in libraries])
! 1743: tst_connect_save_LIBS="$LIBS"
! 1744: tst_connect_need_LIBS="unknown"
! 1745: for tst_lib in '' '-lsocket' ; do
! 1746: if test "$tst_connect_need_LIBS" = "unknown"; then
! 1747: LIBS="$tst_lib $tst_connect_save_LIBS"
! 1748: AC_LINK_IFELSE([
! 1749: AC_LANG_PROGRAM([[
! 1750: $curl_includes_winsock2
! 1751: $curl_includes_bsdsocket
! 1752: #if !defined(HAVE_WINDOWS_H) && !defined(HAVE_PROTO_BSDSOCKET_H)
! 1753: int connect(int, void*, int);
! 1754: #endif
! 1755: ]],[[
! 1756: if(0 != connect(0, 0, 0))
! 1757: return 1;
! 1758: ]])
! 1759: ],[
! 1760: tst_connect_need_LIBS="$tst_lib"
! 1761: ])
! 1762: fi
! 1763: done
! 1764: LIBS="$tst_connect_save_LIBS"
! 1765: #
! 1766: case X-"$tst_connect_need_LIBS" in
! 1767: X-unknown)
! 1768: AC_MSG_RESULT([cannot find connect])
! 1769: AC_MSG_ERROR([cannot find connect function in libraries.])
! 1770: ;;
! 1771: X-)
! 1772: AC_MSG_RESULT([yes])
! 1773: ;;
! 1774: *)
! 1775: AC_MSG_RESULT([$tst_connect_need_LIBS])
! 1776: LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS"
! 1777: ;;
! 1778: esac
! 1779: ])
! 1780:
! 1781:
! 1782: dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
! 1783: dnl -------------------------------------------------
! 1784: dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
! 1785: dnl symbol that can be further used in custom template configuration
! 1786: dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third
! 1787: dnl argument for the description. Symbol definitions done with this
! 1788: dnl macro are intended to be exclusively used in handcrafted *.h.in
! 1789: dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one
! 1790: dnl prevents autoheader generation and insertion of symbol template
! 1791: dnl stub and definition into the first configuration header file. Do
! 1792: dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each
! 1793: dnl one serves different functional needs.
! 1794:
! 1795: AC_DEFUN([CURL_DEFINE_UNQUOTED], [
! 1796: cat >>confdefs.h <<_EOF
! 1797: [@%:@define] $1 ifelse($#, 2, [$2], 1)
! 1798: _EOF
! 1799: ])
! 1800:
! 1801: dnl CURL_CONFIGURE_PULL_SYS_POLL
! 1802: dnl -------------------------------------------------
! 1803: dnl The need for the sys/poll.h inclusion arises mainly to properly
! 1804: dnl interface AIX systems which define macros 'events' and 'revents'.
! 1805:
! 1806: AC_DEFUN([CURL_CONFIGURE_PULL_SYS_POLL], [
! 1807: AC_REQUIRE([CURL_INCLUDES_POLL])dnl
! 1808: #
! 1809: tst_poll_events_macro_defined="unknown"
! 1810: #
! 1811: AC_COMPILE_IFELSE([
! 1812: AC_LANG_PROGRAM([[
! 1813: $curl_includes_poll
! 1814: ]],[[
! 1815: #if defined(events) || defined(revents)
! 1816: return 0;
! 1817: #else
! 1818: force compilation error
! 1819: #endif
! 1820: ]])
! 1821: ],[
! 1822: tst_poll_events_macro_defined="yes"
! 1823: ],[
! 1824: tst_poll_events_macro_defined="no"
! 1825: ])
! 1826: #
! 1827: if test "$tst_poll_events_macro_defined" = "yes"; then
! 1828: if test "x$ac_cv_header_sys_poll_h" = "xyes"; then
! 1829: CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_POLL_H])
! 1830: fi
! 1831: fi
! 1832: #
! 1833: ])
! 1834:
! 1835:
! 1836: dnl CURL_CHECK_FUNC_SELECT
! 1837: dnl -------------------------------------------------
! 1838: dnl Test if the socket select() function is available,
! 1839: dnl and check its return type and the types of its
! 1840: dnl arguments. If the function succeeds HAVE_SELECT
! 1841: dnl will be defined, defining the types of the
! 1842: dnl arguments in SELECT_TYPE_ARG1, SELECT_TYPE_ARG234
! 1843: dnl and SELECT_TYPE_ARG5, defining the type of the
! 1844: dnl function return value in SELECT_TYPE_RETV, and
! 1845: dnl also defining the type qualifier of fifth argument
! 1846: dnl in SELECT_QUAL_ARG5.
! 1847:
! 1848: AC_DEFUN([CURL_CHECK_FUNC_SELECT], [
! 1849: AC_REQUIRE([CURL_CHECK_STRUCT_TIMEVAL])dnl
! 1850: AC_CHECK_HEADERS(sys/select.h sys/socket.h)
! 1851: #
! 1852: AC_MSG_CHECKING([for select])
! 1853: AC_LINK_IFELSE([
! 1854: AC_LANG_PROGRAM([[
! 1855: #undef inline
! 1856: #ifdef HAVE_WINDOWS_H
! 1857: #ifndef WIN32_LEAN_AND_MEAN
! 1858: #define WIN32_LEAN_AND_MEAN
! 1859: #endif
! 1860: #include <windows.h>
! 1861: #ifdef HAVE_WINSOCK2_H
! 1862: #include <winsock2.h>
! 1863: #else
! 1864: #ifdef HAVE_WINSOCK_H
! 1865: #include <winsock.h>
! 1866: #endif
! 1867: #endif
! 1868: #endif
! 1869: #ifdef HAVE_SYS_TYPES_H
! 1870: #include <sys/types.h>
! 1871: #endif
! 1872: #ifdef HAVE_SYS_TIME_H
! 1873: #include <sys/time.h>
! 1874: #ifdef TIME_WITH_SYS_TIME
! 1875: #include <time.h>
! 1876: #endif
! 1877: #else
! 1878: #ifdef HAVE_TIME_H
! 1879: #include <time.h>
! 1880: #endif
! 1881: #endif
! 1882: #ifndef HAVE_WINDOWS_H
! 1883: #ifdef HAVE_PROTO_BSDSOCKET_H
! 1884: #include <proto/bsdsocket.h>
! 1885: struct Library *SocketBase = NULL;
! 1886: #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
! 1887: #endif
! 1888: #ifdef HAVE_SYS_SELECT_H
! 1889: #include <sys/select.h>
! 1890: #elif defined(HAVE_UNISTD_H)
! 1891: #include <unistd.h>
! 1892: #endif
! 1893: #ifdef HAVE_SYS_SOCKET_H
! 1894: #include <sys/socket.h>
! 1895: #endif
! 1896: #endif
! 1897: ]],[[
! 1898: select(0, 0, 0, 0, 0);
! 1899: ]])
! 1900: ],[
! 1901: AC_MSG_RESULT([yes])
! 1902: curl_cv_select="yes"
! 1903: ],[
! 1904: AC_MSG_RESULT([no])
! 1905: curl_cv_select="no"
! 1906: ])
! 1907: #
! 1908: if test "$curl_cv_select" = "yes"; then
! 1909: AC_CACHE_CHECK([types of args and return type for select],
! 1910: [curl_cv_func_select_args], [
! 1911: curl_cv_func_select_args="unknown"
! 1912: for sel_retv in 'int' 'ssize_t'; do
! 1913: for sel_arg1 in 'int' 'ssize_t' 'size_t' 'unsigned long int' 'unsigned int'; do
! 1914: for sel_arg234 in 'fd_set *' 'int *' 'void *'; do
! 1915: for sel_arg5 in 'struct timeval *' 'const struct timeval *'; do
! 1916: if test "$curl_cv_func_select_args" = "unknown"; then
! 1917: AC_COMPILE_IFELSE([
! 1918: AC_LANG_PROGRAM([[
! 1919: #undef inline
! 1920: #ifdef HAVE_WINDOWS_H
! 1921: #ifndef WIN32_LEAN_AND_MEAN
! 1922: #define WIN32_LEAN_AND_MEAN
! 1923: #endif
! 1924: #include <windows.h>
! 1925: #ifdef HAVE_WINSOCK2_H
! 1926: #include <winsock2.h>
! 1927: #else
! 1928: #ifdef HAVE_WINSOCK_H
! 1929: #include <winsock.h>
! 1930: #endif
! 1931: #endif
! 1932: #define SELECTCALLCONV PASCAL
! 1933: #endif
! 1934: #ifdef HAVE_SYS_TYPES_H
! 1935: #include <sys/types.h>
! 1936: #endif
! 1937: #ifdef HAVE_SYS_TIME_H
! 1938: #include <sys/time.h>
! 1939: #ifdef TIME_WITH_SYS_TIME
! 1940: #include <time.h>
! 1941: #endif
! 1942: #else
! 1943: #ifdef HAVE_TIME_H
! 1944: #include <time.h>
! 1945: #endif
! 1946: #endif
! 1947: #ifndef HAVE_WINDOWS_H
! 1948: #ifdef HAVE_PROTO_BSDSOCKET_H
! 1949: #include <proto/bsdsocket.h>
! 1950: struct Library *SocketBase = NULL;
! 1951: #define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
! 1952: #endif
! 1953: #ifdef HAVE_SYS_SELECT_H
! 1954: #include <sys/select.h>
! 1955: #elif defined(HAVE_UNISTD_H)
! 1956: #include <unistd.h>
! 1957: #endif
! 1958: #ifdef HAVE_SYS_SOCKET_H
! 1959: #include <sys/socket.h>
! 1960: #endif
! 1961: #define SELECTCALLCONV
! 1962: #endif
! 1963: #ifndef HAVE_STRUCT_TIMEVAL
! 1964: struct timeval {
! 1965: long tv_sec;
! 1966: long tv_usec;
! 1967: };
! 1968: #endif
! 1969: #ifndef HAVE_PROTO_BSDSOCKET_H
! 1970: extern $sel_retv SELECTCALLCONV
! 1971: select($sel_arg1,
! 1972: $sel_arg234,
! 1973: $sel_arg234,
! 1974: $sel_arg234,
! 1975: $sel_arg5);
! 1976: #endif
! 1977: ]],[[
! 1978: $sel_arg1 nfds=0;
! 1979: $sel_arg234 rfds=0;
! 1980: $sel_arg234 wfds=0;
! 1981: $sel_arg234 efds=0;
! 1982: $sel_retv res = select(nfds, rfds, wfds, efds, 0);
! 1983: ]])
! 1984: ],[
! 1985: curl_cv_func_select_args="$sel_arg1,$sel_arg234,$sel_arg5,$sel_retv"
! 1986: ])
! 1987: fi
! 1988: done
! 1989: done
! 1990: done
! 1991: done
! 1992: ]) # AC-CACHE-CHECK
! 1993: if test "$curl_cv_func_select_args" = "unknown"; then
! 1994: AC_MSG_WARN([Cannot find proper types to use for select args])
! 1995: AC_MSG_WARN([HAVE_SELECT will not be defined])
! 1996: else
! 1997: select_prev_IFS=$IFS; IFS=','
! 1998: set dummy `echo "$curl_cv_func_select_args" | sed 's/\*/\*/g'`
! 1999: IFS=$select_prev_IFS
! 2000: shift
! 2001: #
! 2002: sel_qual_type_arg5=$[3]
! 2003: #
! 2004: AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1],
! 2005: [Define to the type of arg 1 for select.])
! 2006: AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, $[2],
! 2007: [Define to the type of args 2, 3 and 4 for select.])
! 2008: AC_DEFINE_UNQUOTED(SELECT_TYPE_RETV, $[4],
! 2009: [Define to the function return type for select.])
! 2010: #
! 2011: prev_sh_opts=$-
! 2012: #
! 2013: case $prev_sh_opts in
! 2014: *f*)
! 2015: ;;
! 2016: *)
! 2017: set -f
! 2018: ;;
! 2019: esac
! 2020: #
! 2021: case "$sel_qual_type_arg5" in
! 2022: const*)
! 2023: sel_qual_arg5=const
! 2024: sel_type_arg5=`echo $sel_qual_type_arg5 | sed 's/^const //'`
! 2025: ;;
! 2026: *)
! 2027: sel_qual_arg5=
! 2028: sel_type_arg5=$sel_qual_type_arg5
! 2029: ;;
! 2030: esac
! 2031: #
! 2032: AC_DEFINE_UNQUOTED(SELECT_QUAL_ARG5, $sel_qual_arg5,
! 2033: [Define to the type qualifier of arg 5 for select.])
! 2034: AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, $sel_type_arg5,
! 2035: [Define to the type of arg 5 for select.])
! 2036: #
! 2037: case $prev_sh_opts in
! 2038: *f*)
! 2039: ;;
! 2040: *)
! 2041: set +f
! 2042: ;;
! 2043: esac
! 2044: #
! 2045: AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
! 2046: [Define to 1 if you have the select function.])
! 2047: curl_cv_func_select="yes"
! 2048: fi
! 2049: fi
! 2050: ])
! 2051:
! 2052:
! 2053: dnl CURL_VERIFY_RUNTIMELIBS
! 2054: dnl -------------------------------------------------
! 2055: dnl Verify that the shared libs found so far can be used when running
! 2056: dnl programs, since otherwise the situation will create odd configure errors
! 2057: dnl that are misleading people.
! 2058: dnl
! 2059: dnl Make sure this test is run BEFORE the first test in the script that
! 2060: dnl runs anything, which at the time of this writing is the AC_CHECK_SIZEOF
! 2061: dnl macro. It must also run AFTER all lib-checking macros are complete.
! 2062:
! 2063: AC_DEFUN([CURL_VERIFY_RUNTIMELIBS], [
! 2064:
! 2065: dnl this test is of course not sensible if we are cross-compiling!
! 2066: if test "x$cross_compiling" != xyes; then
! 2067:
! 2068: dnl just run a program to verify that the libs checked for previous to this
! 2069: dnl point also is available run-time!
! 2070: AC_MSG_CHECKING([run-time libs availability])
! 2071: CURL_RUN_IFELSE([
! 2072: int main()
! 2073: {
! 2074: return 0;
! 2075: }
! 2076: ],
! 2077: AC_MSG_RESULT([fine]),
! 2078: AC_MSG_RESULT([failed])
! 2079: AC_MSG_ERROR([one or more libs available at link-time are not available run-time. Libs used at link-time: $LIBS])
! 2080: )
! 2081:
! 2082: dnl if this test fails, configure has already stopped
! 2083: fi
! 2084: ])
! 2085:
! 2086:
! 2087: dnl CURL_CHECK_VARIADIC_MACROS
! 2088: dnl -------------------------------------------------
! 2089: dnl Check compiler support of variadic macros
! 2090:
! 2091: AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
! 2092: AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
! 2093: [curl_cv_variadic_macros_c99], [
! 2094: AC_COMPILE_IFELSE([
! 2095: AC_LANG_PROGRAM([[
! 2096: #define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
! 2097: #define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
! 2098: int fun3(int arg1, int arg2, int arg3);
! 2099: int fun2(int arg1, int arg2);
! 2100: int fun3(int arg1, int arg2, int arg3)
! 2101: { return arg1 + arg2 + arg3; }
! 2102: int fun2(int arg1, int arg2)
! 2103: { return arg1 + arg2; }
! 2104: ]],[[
! 2105: int res3 = c99_vmacro3(1, 2, 3);
! 2106: int res2 = c99_vmacro2(1, 2);
! 2107: ]])
! 2108: ],[
! 2109: curl_cv_variadic_macros_c99="yes"
! 2110: ],[
! 2111: curl_cv_variadic_macros_c99="no"
! 2112: ])
! 2113: ])
! 2114: case "$curl_cv_variadic_macros_c99" in
! 2115: yes)
! 2116: AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
! 2117: [Define to 1 if compiler supports C99 variadic macro style.])
! 2118: ;;
! 2119: esac
! 2120: AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
! 2121: [curl_cv_variadic_macros_gcc], [
! 2122: AC_COMPILE_IFELSE([
! 2123: AC_LANG_PROGRAM([[
! 2124: #define gcc_vmacro3(first, args...) fun3(first, args)
! 2125: #define gcc_vmacro2(first, args...) fun2(first, args)
! 2126: int fun3(int arg1, int arg2, int arg3);
! 2127: int fun2(int arg1, int arg2);
! 2128: int fun3(int arg1, int arg2, int arg3)
! 2129: { return arg1 + arg2 + arg3; }
! 2130: int fun2(int arg1, int arg2)
! 2131: { return arg1 + arg2; }
! 2132: ]],[[
! 2133: int res3 = gcc_vmacro3(1, 2, 3);
! 2134: int res2 = gcc_vmacro2(1, 2);
! 2135: ]])
! 2136: ],[
! 2137: curl_cv_variadic_macros_gcc="yes"
! 2138: ],[
! 2139: curl_cv_variadic_macros_gcc="no"
! 2140: ])
! 2141: ])
! 2142: case "$curl_cv_variadic_macros_gcc" in
! 2143: yes)
! 2144: AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
! 2145: [Define to 1 if compiler supports old gcc variadic macro style.])
! 2146: ;;
! 2147: esac
! 2148: ])
! 2149:
! 2150:
! 2151: dnl CURL_CHECK_CA_BUNDLE
! 2152: dnl -------------------------------------------------
! 2153: dnl Check if a default ca-bundle should be used
! 2154: dnl
! 2155: dnl regarding the paths this will scan:
! 2156: dnl /etc/ssl/certs/ca-certificates.crt Debian systems
! 2157: dnl /etc/pki/tls/certs/ca-bundle.crt Redhat and Mandriva
! 2158: dnl /usr/share/ssl/certs/ca-bundle.crt old(er) Redhat
! 2159: dnl /usr/local/share/certs/ca-root-nss.crt FreeBSD
! 2160: dnl /etc/ssl/cert.pem OpenBSD, FreeBSD (symlink)
! 2161: dnl /etc/ssl/certs/ (ca path) SUSE
! 2162:
! 2163: AC_DEFUN([CURL_CHECK_CA_BUNDLE], [
! 2164:
! 2165: AC_MSG_CHECKING([default CA cert bundle/path])
! 2166:
! 2167: AC_ARG_WITH(ca-bundle,
! 2168: AC_HELP_STRING([--with-ca-bundle=FILE],
! 2169: [Path to a file containing CA certificates (example: /etc/ca-bundle.crt)])
! 2170: AC_HELP_STRING([--without-ca-bundle], [Don't use a default CA bundle]),
! 2171: [
! 2172: want_ca="$withval"
! 2173: if test "x$want_ca" = "xyes"; then
! 2174: AC_MSG_ERROR([--with-ca-bundle=FILE requires a path to the CA bundle])
! 2175: fi
! 2176: ],
! 2177: [ want_ca="unset" ])
! 2178: AC_ARG_WITH(ca-path,
! 2179: AC_HELP_STRING([--with-ca-path=DIRECTORY],
! 2180: [Path to a directory containing CA certificates stored individually, with \
! 2181: their filenames in a hash format. This option can be used with the OpenSSL, \
! 2182: GnuTLS and mbedTLS backends. Refer to OpenSSL c_rehash for details. \
! 2183: (example: /etc/certificates)])
! 2184: AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]),
! 2185: [
! 2186: want_capath="$withval"
! 2187: if test "x$want_capath" = "xyes"; then
! 2188: AC_MSG_ERROR([--with-ca-path=DIRECTORY requires a path to the CA path directory])
! 2189: fi
! 2190: ],
! 2191: [ want_capath="unset"])
! 2192:
! 2193: ca_warning=" (warning: certs not found)"
! 2194: capath_warning=" (warning: certs not found)"
! 2195: check_capath=""
! 2196:
! 2197: if test "x$want_ca" != "xno" -a "x$want_ca" != "xunset" -a \
! 2198: "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
! 2199: dnl both given
! 2200: ca="$want_ca"
! 2201: capath="$want_capath"
! 2202: elif test "x$want_ca" != "xno" -a "x$want_ca" != "xunset"; then
! 2203: dnl --with-ca-bundle given
! 2204: ca="$want_ca"
! 2205: capath="no"
! 2206: elif test "x$want_capath" != "xno" -a "x$want_capath" != "xunset"; then
! 2207: dnl --with-ca-path given
! 2208: if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1" -a "x$MBEDTLS_ENABLED" != "x1"; then
! 2209: AC_MSG_ERROR([--with-ca-path only works with OpenSSL, GnuTLS or mbedTLS])
! 2210: fi
! 2211: capath="$want_capath"
! 2212: ca="no"
! 2213: else
! 2214: dnl first try autodetecting a CA bundle , then a CA path
! 2215: dnl both autodetections can be skipped by --without-ca-*
! 2216: ca="no"
! 2217: capath="no"
! 2218: if test "x$cross_compiling" != "xyes"; then
! 2219: dnl NOT cross-compiling and...
! 2220: dnl neither of the --with-ca-* options are provided
! 2221: if test "x$want_ca" = "xunset"; then
! 2222: dnl the path we previously would have installed the curl ca bundle
! 2223: dnl to, and thus we now check for an already existing cert in that
! 2224: dnl place in case we find no other
! 2225: if test "x$prefix" != xNONE; then
! 2226: cac="${prefix}/share/curl/curl-ca-bundle.crt"
! 2227: else
! 2228: cac="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
! 2229: fi
! 2230:
! 2231: for a in /etc/ssl/certs/ca-certificates.crt \
! 2232: /etc/pki/tls/certs/ca-bundle.crt \
! 2233: /usr/share/ssl/certs/ca-bundle.crt \
! 2234: /usr/local/share/certs/ca-root-nss.crt \
! 2235: /etc/ssl/cert.pem \
! 2236: "$cac"; do
! 2237: if test -f "$a"; then
! 2238: ca="$a"
! 2239: break
! 2240: fi
! 2241: done
! 2242: fi
! 2243: if test "x$want_capath" = "xunset" -a "x$ca" = "xno" -a \
! 2244: "x$OPENSSL_ENABLED" = "x1"; then
! 2245: check_capath="/etc/ssl/certs/"
! 2246: fi
! 2247: else
! 2248: dnl no option given and cross-compiling
! 2249: AC_MSG_WARN([skipped the ca-cert path detection when cross-compiling])
! 2250: fi
! 2251: fi
! 2252:
! 2253: if test "x$ca" = "xno" || test -f "$ca"; then
! 2254: ca_warning=""
! 2255: fi
! 2256:
! 2257: if test "x$capath" != "xno"; then
! 2258: check_capath="$capath"
! 2259: fi
! 2260:
! 2261: if test ! -z "$check_capath"; then
! 2262: for a in "$check_capath"; do
! 2263: 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
! 2264: if test "x$capath" = "xno"; then
! 2265: capath="$a"
! 2266: fi
! 2267: capath_warning=""
! 2268: break
! 2269: fi
! 2270: done
! 2271: fi
! 2272:
! 2273: if test "x$capath" = "xno"; then
! 2274: capath_warning=""
! 2275: fi
! 2276:
! 2277: if test "x$ca" != "xno"; then
! 2278: CURL_CA_BUNDLE='"'$ca'"'
! 2279: AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [Location of default ca bundle])
! 2280: AC_SUBST(CURL_CA_BUNDLE)
! 2281: AC_MSG_RESULT([$ca])
! 2282: fi
! 2283: if test "x$capath" != "xno"; then
! 2284: CURL_CA_PATH="\"$capath\""
! 2285: AC_DEFINE_UNQUOTED(CURL_CA_PATH, "$capath", [Location of default ca path])
! 2286: AC_MSG_RESULT([$capath (capath)])
! 2287: fi
! 2288: if test "x$ca" = "xno" && test "x$capath" = "xno"; then
! 2289: AC_MSG_RESULT([no])
! 2290: fi
! 2291:
! 2292: AC_MSG_CHECKING([whether to use builtin CA store of SSL library])
! 2293: AC_ARG_WITH(ca-fallback,
! 2294: AC_HELP_STRING([--with-ca-fallback], [Use the built in CA store of the SSL library])
! 2295: AC_HELP_STRING([--without-ca-fallback], [Don't use the built in CA store of the SSL library]),
! 2296: [
! 2297: if test "x$with_ca_fallback" != "xyes" -a "x$with_ca_fallback" != "xno"; then
! 2298: AC_MSG_ERROR([--with-ca-fallback only allows yes or no as parameter])
! 2299: fi
! 2300: ],
! 2301: [ with_ca_fallback="no"])
! 2302: AC_MSG_RESULT([$with_ca_fallback])
! 2303: if test "x$with_ca_fallback" = "xyes"; then
! 2304: if test "x$OPENSSL_ENABLED" != "x1" -a "x$GNUTLS_ENABLED" != "x1"; then
! 2305: AC_MSG_ERROR([--with-ca-fallback only works with OpenSSL or GnuTLS])
! 2306: fi
! 2307: AC_DEFINE_UNQUOTED(CURL_CA_FALLBACK, 1, [define "1" to use built in CA store of SSL library ])
! 2308: fi
! 2309: ])
! 2310:
! 2311: dnl CURL_CHECK_WIN32_LARGEFILE
! 2312: dnl -------------------------------------------------
! 2313: dnl Check if curl's WIN32 large file will be used
! 2314:
! 2315: AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
! 2316: AC_REQUIRE([CURL_CHECK_HEADER_WINDOWS])dnl
! 2317: AC_MSG_CHECKING([whether build target supports WIN32 file API])
! 2318: curl_win32_file_api="no"
! 2319: if test "$curl_cv_header_windows_h" = "yes"; then
! 2320: if test x"$enable_largefile" != "xno"; then
! 2321: AC_COMPILE_IFELSE([
! 2322: AC_LANG_PROGRAM([[
! 2323: ]],[[
! 2324: #if !defined(_WIN32_WCE) && \
! 2325: (defined(__MINGW32__) || \
! 2326: (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))))
! 2327: int dummy=1;
! 2328: #else
! 2329: WIN32 large file API not supported.
! 2330: #endif
! 2331: ]])
! 2332: ],[
! 2333: curl_win32_file_api="win32_large_files"
! 2334: ])
! 2335: fi
! 2336: if test "$curl_win32_file_api" = "no"; then
! 2337: AC_COMPILE_IFELSE([
! 2338: AC_LANG_PROGRAM([[
! 2339: ]],[[
! 2340: #if defined(_WIN32_WCE) || defined(__MINGW32__) || defined(_MSC_VER)
! 2341: int dummy=1;
! 2342: #else
! 2343: WIN32 small file API not supported.
! 2344: #endif
! 2345: ]])
! 2346: ],[
! 2347: curl_win32_file_api="win32_small_files"
! 2348: ])
! 2349: fi
! 2350: fi
! 2351: case "$curl_win32_file_api" in
! 2352: win32_large_files)
! 2353: AC_MSG_RESULT([yes (large file enabled)])
! 2354: AC_DEFINE_UNQUOTED(USE_WIN32_LARGE_FILES, 1,
! 2355: [Define to 1 if you are building a Windows target with large file support.])
! 2356: ;;
! 2357: win32_small_files)
! 2358: AC_MSG_RESULT([yes (large file disabled)])
! 2359: AC_DEFINE_UNQUOTED(USE_WIN32_SMALL_FILES, 1,
! 2360: [Define to 1 if you are building a Windows target without large file support.])
! 2361: ;;
! 2362: *)
! 2363: AC_MSG_RESULT([no])
! 2364: ;;
! 2365: esac
! 2366: ])
! 2367:
! 2368: dnl CURL_EXPORT_PCDIR ($pcdir)
! 2369: dnl ------------------------
! 2370: dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
! 2371: dnl
! 2372: dnl we need this macro since pkg-config distinguishes among empty and unset
! 2373: dnl variable while checking PKG_CONFIG_LIBDIR
! 2374: dnl
! 2375:
! 2376: AC_DEFUN([CURL_EXPORT_PCDIR], [
! 2377: if test -n "$1"; then
! 2378: PKG_CONFIG_LIBDIR="$1"
! 2379: export PKG_CONFIG_LIBDIR
! 2380: fi
! 2381: ])
! 2382:
! 2383: dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
! 2384: dnl ------------------------
! 2385: dnl search for the pkg-config tool. Set the PKGCONFIG variable to hold the
! 2386: dnl path to it, or 'no' if not found/present.
! 2387: dnl
! 2388: dnl If pkg-config is present, check that it has info about the $module or
! 2389: dnl return "no" anyway!
! 2390: dnl
! 2391: dnl Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
! 2392: dnl
! 2393:
! 2394: AC_DEFUN([CURL_CHECK_PKGCONFIG], [
! 2395: if test -n "$PKG_CONFIG"; then
! 2396: PKGCONFIG="$PKG_CONFIG"
! 2397: else
! 2398: AC_PATH_TOOL([PKGCONFIG], [pkg-config], [no],
! 2399: [$PATH:/usr/bin:/usr/local/bin])
! 2400: fi
! 2401:
! 2402: if test "x$PKGCONFIG" != "xno"; then
! 2403: AC_MSG_CHECKING([for $1 options with pkg-config])
! 2404: dnl ask pkg-config about $1
! 2405: itexists=`CURL_EXPORT_PCDIR([$2]) dnl
! 2406: $PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
! 2407:
! 2408: if test -z "$itexists"; then
! 2409: dnl pkg-config does not have info about the given module! set the
! 2410: dnl variable to 'no'
! 2411: PKGCONFIG="no"
! 2412: AC_MSG_RESULT([no])
! 2413: else
! 2414: AC_MSG_RESULT([found])
! 2415: fi
! 2416: fi
! 2417: ])
! 2418:
! 2419:
! 2420: dnl CURL_GENERATE_CONFIGUREHELP_PM
! 2421: dnl -------------------------------------------------
! 2422: dnl Generate test harness configurehelp.pm module, defining and
! 2423: dnl initializing some perl variables with values which are known
! 2424: dnl when the configure script runs. For portability reasons, test
! 2425: dnl harness needs information on how to run the C preprocessor.
! 2426:
! 2427: AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
! 2428: AC_REQUIRE([AC_PROG_CPP])dnl
! 2429: tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
! 2430: if test -z "$tmp_cpp"; then
! 2431: tmp_cpp='cpp'
! 2432: fi
! 2433: cat >./tests/configurehelp.pm <<_EOF
! 2434: [@%:@] This is a generated file. Do not edit.
! 2435:
! 2436: package configurehelp;
! 2437:
! 2438: use strict;
! 2439: use warnings;
! 2440: use Exporter;
! 2441:
! 2442: use vars qw(
! 2443: @ISA
! 2444: @EXPORT_OK
! 2445: \$Cpreprocessor
! 2446: );
! 2447:
! 2448: @ISA = qw(Exporter);
! 2449:
! 2450: @EXPORT_OK = qw(
! 2451: \$Cpreprocessor
! 2452: );
! 2453:
! 2454: \$Cpreprocessor = '$tmp_cpp';
! 2455:
! 2456: 1;
! 2457: _EOF
! 2458: ])
! 2459:
! 2460: dnl CURL_CPP_P
! 2461: dnl
! 2462: dnl Check if $cpp -P should be used for extract define values due to gcc 5
! 2463: dnl splitting up strings and defines between line outputs. gcc by default
! 2464: dnl (without -P) will show TEST EINVAL TEST as
! 2465: dnl
! 2466: dnl # 13 "conftest.c"
! 2467: dnl TEST
! 2468: dnl # 13 "conftest.c" 3 4
! 2469: dnl 22
! 2470: dnl # 13 "conftest.c"
! 2471: dnl TEST
! 2472:
! 2473: AC_DEFUN([CURL_CPP_P], [
! 2474: AC_MSG_CHECKING([if cpp -P is needed])
! 2475: AC_EGREP_CPP([TEST.*TEST], [
! 2476: #include <errno.h>
! 2477: TEST EINVAL TEST
! 2478: ], [cpp=no], [cpp=yes])
! 2479: AC_MSG_RESULT([$cpp])
! 2480:
! 2481: dnl we need cpp -P so check if it works then
! 2482: if test "x$cpp" = "xyes"; then
! 2483: AC_MSG_CHECKING([if cpp -P works])
! 2484: OLDCPPFLAGS=$CPPFLAGS
! 2485: CPPFLAGS="$CPPFLAGS -P"
! 2486: AC_EGREP_CPP([TEST.*TEST], [
! 2487: #include <errno.h>
! 2488: TEST EINVAL TEST
! 2489: ], [cpp_p=yes], [cpp_p=no])
! 2490: AC_MSG_RESULT([$cpp_p])
! 2491:
! 2492: if test "x$cpp_p" = "xno"; then
! 2493: AC_MSG_WARN([failed to figure out cpp -P alternative])
! 2494: # without -P
! 2495: CPPPFLAG=""
! 2496: else
! 2497: # with -P
! 2498: CPPPFLAG="-P"
! 2499: fi
! 2500: dnl restore CPPFLAGS
! 2501: CPPFLAGS=$OLDCPPFLAGS
! 2502: else
! 2503: # without -P
! 2504: CPPPFLAG=""
! 2505: fi
! 2506: ])
! 2507:
! 2508:
! 2509: dnl CURL_MAC_CFLAGS
! 2510: dnl
! 2511: dnl Check if -mmacosx-version-min, -miphoneos-version-min or any
! 2512: dnl similar are set manually, otherwise do. And set
! 2513: dnl -Werror=partial-availability.
! 2514: dnl
! 2515:
! 2516: AC_DEFUN([CURL_MAC_CFLAGS], [
! 2517:
! 2518: tst_cflags="no"
! 2519: case $host_os in
! 2520: darwin*)
! 2521: tst_cflags="yes"
! 2522: ;;
! 2523: esac
! 2524:
! 2525: AC_MSG_CHECKING([for good-to-use Mac CFLAGS])
! 2526: AC_MSG_RESULT([$tst_cflags]);
! 2527:
! 2528: if test "$tst_cflags" = "yes"; then
! 2529: AC_MSG_CHECKING([for *version-min in CFLAGS])
! 2530: min=""
! 2531: if test -z "$(echo $CFLAGS | grep m.*os.*-version-min)"; then
! 2532: min="-mmacosx-version-min=10.8"
! 2533: CFLAGS="$CFLAGS $min"
! 2534: fi
! 2535: if test -z "$min"; then
! 2536: AC_MSG_RESULT([set by user])
! 2537: else
! 2538: AC_MSG_RESULT([$min set])
! 2539: fi
! 2540:
! 2541: old_CFLAGS=$CFLAGS
! 2542: CFLAGS="$CFLAGS -Werror=partial-availability"
! 2543: AC_MSG_CHECKING([whether $CC accepts -Werror=partial-availability])
! 2544: AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
! 2545: [AC_MSG_RESULT([yes])],
! 2546: [AC_MSG_RESULT([no])
! 2547: CFLAGS=$old_CFLAGS])
! 2548: fi
! 2549:
! 2550: ])
! 2551:
! 2552:
! 2553: dnl CURL_SUPPORTS_BUILTIN_AVAILABLE
! 2554: dnl
! 2555: dnl Check to see if the compiler supports __builtin_available. This built-in
! 2556: dnl compiler function first appeared in Apple LLVM 9.0.0. It's so new that, at
! 2557: dnl the time this macro was written, the function was not yet documented. Its
! 2558: dnl purpose is to return true if the code is running under a certain OS version
! 2559: dnl or later.
! 2560:
! 2561: AC_DEFUN([CURL_SUPPORTS_BUILTIN_AVAILABLE], [
! 2562: AC_MSG_CHECKING([to see if the compiler supports __builtin_available()])
! 2563: AC_COMPILE_IFELSE([
! 2564: AC_LANG_PROGRAM([[
! 2565: #include <stdlib.h>
! 2566: ]],[[
! 2567: if (__builtin_available(macOS 10.8, iOS 5.0, *)) {}
! 2568: ]])
! 2569: ],[
! 2570: AC_MSG_RESULT([yes])
! 2571: AC_DEFINE_UNQUOTED(HAVE_BUILTIN_AVAILABLE, 1,
! 2572: [Define to 1 if you have the __builtin_available function.])
! 2573: ],[
! 2574: AC_MSG_RESULT([no])
! 2575: ])
! 2576: ])
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>