Home | History | Annotate | Download | only in curl
      1 #***************************************************************************
      2 #                                  _   _ ____  _
      3 #  Project                     ___| | | |  _ \| |
      4 #                             / __| | | | |_) | |
      5 #                            | (__| |_| |  _ <| |___
      6 #                             \___|\___/|_| \_\_____|
      7 #
      8 # Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel (a] 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 dnl Process this file with autoconf to produce a configure script.
     23 
     24 AC_PREREQ(2.57)
     25 
     26 dnl We don't know the version number "statically" so we use a dash here
     27 AC_INIT([curl], [-], [a suitable curl mailing list: https://curl.haxx.se/mail/])
     28 
     29 XC_OVR_ZZ50
     30 XC_OVR_ZZ60
     31 CURL_OVERRIDE_AUTOCONF
     32 
     33 dnl configure script copyright
     34 AC_COPYRIGHT([Copyright (c) 1998 - 2016 Daniel Stenberg, <daniel (a] haxx.se>
     35 This configure script may be copied, distributed and modified under the
     36 terms of the curl license; see COPYING for more details])
     37 
     38 AC_CONFIG_SRCDIR([lib/urldata.h])
     39 AC_CONFIG_HEADERS(lib/curl_config.h include/curl/curlbuild.h)
     40 AC_CONFIG_MACRO_DIR([m4])
     41 AM_MAINTAINER_MODE
     42 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
     43 
     44 CURL_CHECK_OPTION_DEBUG
     45 CURL_CHECK_OPTION_OPTIMIZE
     46 CURL_CHECK_OPTION_WARNINGS
     47 CURL_CHECK_OPTION_WERROR
     48 CURL_CHECK_OPTION_CURLDEBUG
     49 CURL_CHECK_OPTION_SYMBOL_HIDING
     50 CURL_CHECK_OPTION_ARES
     51 CURL_CHECK_OPTION_RT
     52 
     53 XC_CHECK_PATH_SEPARATOR
     54 
     55 #
     56 # save the configure arguments
     57 #
     58 CONFIGURE_OPTIONS="\"$ac_configure_args\""
     59 AC_SUBST(CONFIGURE_OPTIONS)
     60 
     61 CURL_CFLAG_EXTRAS=""
     62 if test X"$want_werror" = Xyes; then
     63   CURL_CFLAG_EXTRAS="-Werror"
     64 fi
     65 AC_SUBST(CURL_CFLAG_EXTRAS)
     66 
     67 dnl SED is mandatory for configure process and libtool.
     68 dnl Set it now, allowing it to be changed later.
     69 if test -z "$SED"; then
     70   dnl allow it to be overridden
     71   AC_PATH_PROG([SED], [sed], [not_found],
     72     [$PATH:/usr/bin:/usr/local/bin])
     73   if test -z "$SED" || test "$SED" = "not_found"; then
     74     AC_MSG_ERROR([sed not found in PATH. Cannot continue without sed.])
     75   fi
     76 fi
     77 AC_SUBST([SED])
     78 
     79 dnl GREP is mandatory for configure process and libtool.
     80 dnl Set it now, allowing it to be changed later.
     81 if test -z "$GREP"; then
     82   dnl allow it to be overridden
     83   AC_PATH_PROG([GREP], [grep], [not_found],
     84     [$PATH:/usr/bin:/usr/local/bin])
     85   if test -z "$GREP" || test "$GREP" = "not_found"; then
     86     AC_MSG_ERROR([grep not found in PATH. Cannot continue without grep.])
     87   fi
     88 fi
     89 AC_SUBST([GREP])
     90 
     91 dnl EGREP is mandatory for configure process and libtool.
     92 dnl Set it now, allowing it to be changed later.
     93 if test -z "$EGREP"; then
     94   dnl allow it to be overridden
     95   if echo a | ($GREP -E '(a|b)') >/dev/null 2>&1; then
     96     AC_MSG_CHECKING([for egrep])
     97     EGREP="$GREP -E"
     98     AC_MSG_RESULT([$EGREP])
     99   else
    100     AC_PATH_PROG([EGREP], [egrep], [not_found],
    101       [$PATH:/usr/bin:/usr/local/bin])
    102   fi
    103 fi
    104 if test -z "$EGREP" || test "$EGREP" = "not_found"; then
    105   AC_MSG_ERROR([egrep not found in PATH. Cannot continue without egrep.])
    106 fi
    107 AC_SUBST([EGREP])
    108 
    109 dnl AR is mandatory for configure process and libtool.
    110 dnl This is target dependent, so check it as a tool.
    111 if test -z "$AR"; then
    112   dnl allow it to be overridden
    113   AC_PATH_TOOL([AR], [ar], [not_found],
    114     [$PATH:/usr/bin:/usr/local/bin])
    115   if test -z "$AR" || test "$AR" = "not_found"; then
    116     AC_MSG_ERROR([ar not found in PATH. Cannot continue without ar.])
    117   fi
    118 fi
    119 AC_SUBST([AR])
    120 
    121 AC_SUBST(libext)
    122 
    123 dnl Remove non-configure distributed curlbuild.h
    124 if test -f ${srcdir}/include/curl/curlbuild.h; then
    125   rm -f ${srcdir}/include/curl/curlbuild.h
    126 fi
    127 
    128 dnl figure out the libcurl version
    129 CURLVERSION=`$SED -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curlver.h`
    130 XC_CHECK_PROG_CC
    131 XC_AUTOMAKE
    132 AC_MSG_CHECKING([curl version])
    133 AC_MSG_RESULT($CURLVERSION)
    134 
    135 AC_SUBST(CURLVERSION)
    136 
    137 dnl
    138 dnl we extract the numerical version for curl-config only
    139 VERSIONNUM=`$SED -ne 's/^#define LIBCURL_VERSION_NUM 0x\(.*\)/\1/p' ${srcdir}/include/curl/curlver.h`
    140 AC_SUBST(VERSIONNUM)
    141 
    142 dnl Solaris pkgadd support definitions
    143 PKGADD_PKG="HAXXcurl"
    144 PKGADD_NAME="cURL - a client that groks URLs"
    145 PKGADD_VENDOR="curl.haxx.se"
    146 AC_SUBST(PKGADD_PKG)
    147 AC_SUBST(PKGADD_NAME)
    148 AC_SUBST(PKGADD_VENDOR)
    149 
    150 dnl
    151 dnl initialize all the info variables
    152     curl_ssl_msg="no      (--with-{ssl,gnutls,nss,polarssl,mbedtls,cyassl,axtls,winssl,darwinssl} )"
    153     curl_ssh_msg="no      (--with-libssh2)"
    154    curl_zlib_msg="no      (--with-zlib)"
    155     curl_gss_msg="no      (--with-gssapi)"
    156 curl_tls_srp_msg="no      (--enable-tls-srp)"
    157     curl_res_msg="default (--enable-ares / --enable-threaded-resolver)"
    158    curl_ipv6_msg="no      (--enable-ipv6)"
    159 curl_unix_sockets_msg="no      (--enable-unix-sockets)"
    160     curl_idn_msg="no      (--with-{libidn,winidn})"
    161  curl_manual_msg="no      (--enable-manual)"
    162 curl_libcurl_msg="enabled (--disable-libcurl-option)"
    163 curl_verbose_msg="enabled (--disable-verbose)"
    164    curl_sspi_msg="no      (--enable-sspi)"
    165    curl_ldap_msg="no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)"
    166   curl_ldaps_msg="no      (--enable-ldaps)"
    167    curl_rtsp_msg="no      (--enable-rtsp)"
    168    curl_rtmp_msg="no      (--with-librtmp)"
    169   curl_mtlnk_msg="no      (--with-libmetalink)"
    170     curl_psl_msg="no      (--with-libpsl)"
    171 
    172     init_ssl_msg=${curl_ssl_msg}
    173 
    174 dnl
    175 dnl Save some initial values the user might have provided
    176 dnl
    177 INITIAL_LDFLAGS=$LDFLAGS
    178 INITIAL_LIBS=$LIBS
    179 
    180 dnl Checks for programs.
    181 
    182 dnl Our curl_off_t internal and external configure settings
    183 CURL_CONFIGURE_CURL_OFF_T
    184 
    185 dnl This defines _ALL_SOURCE for AIX
    186 CURL_CHECK_AIX_ALL_SOURCE
    187 
    188 dnl Our configure and build reentrant settings
    189 CURL_CONFIGURE_THREAD_SAFE
    190 CURL_CONFIGURE_REENTRANT
    191 
    192 dnl check for how to do large files
    193 AC_SYS_LARGEFILE
    194 
    195 XC_LIBTOOL
    196 
    197 #
    198 # Automake conditionals based on libtool related checks
    199 #
    200 
    201 AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSION_INFO],
    202   [test "x$xc_lt_shlib_use_version_info" = 'xyes'])
    203 AM_CONDITIONAL([CURL_LT_SHLIB_USE_NO_UNDEFINED],
    204   [test "x$xc_lt_shlib_use_no_undefined" = 'xyes'])
    205 AM_CONDITIONAL([CURL_LT_SHLIB_USE_MIMPURE_TEXT],
    206   [test "x$xc_lt_shlib_use_mimpure_text" = 'xyes'])
    207 
    208 #
    209 # Due to libtool and automake machinery limitations of not allowing
    210 # specifying separate CPPFLAGS or CFLAGS when compiling objects for
    211 # inclusion of these in shared or static libraries, we are forced to
    212 # build using separate configure runs for shared and static libraries
    213 # on systems where different CPPFLAGS or CFLAGS are mandatory in order
    214 # to compile objects for each kind of library. Notice that relying on
    215 # the '-DPIC' CFLAG that libtool provides is not valid given that the
    216 # user might for example choose to build static libraries with PIC.
    217 #
    218 
    219 #
    220 # Make our Makefile.am files use the staticlib CPPFLAG only when strictly
    221 # targeting a static library and not building its shared counterpart.
    222 #
    223 
    224 AM_CONDITIONAL([USE_CPPFLAG_CURL_STATICLIB],
    225   [test "x$xc_lt_build_static_only" = 'xyes'])
    226 
    227 #
    228 # Make staticlib CPPFLAG variable and its definition visible in output
    229 # files unconditionally, providing an empty definition unless strictly
    230 # targeting a static library and not building its shared counterpart.
    231 #
    232 
    233 CPPFLAG_CURL_STATICLIB=
    234 if test "x$xc_lt_build_static_only" = 'xyes'; then
    235   CPPFLAG_CURL_STATICLIB='-DCURL_STATICLIB'
    236 fi
    237 AC_SUBST([CPPFLAG_CURL_STATICLIB])
    238 
    239 
    240 # Determine whether all dependent libraries must be specified when linking
    241 if test "X$enable_shared" = "Xyes" -a "X$link_all_deplibs" = "Xno"
    242 then
    243     REQUIRE_LIB_DEPS=no
    244 else
    245     REQUIRE_LIB_DEPS=yes
    246 fi
    247 AC_SUBST(REQUIRE_LIB_DEPS)
    248 AM_CONDITIONAL(USE_EXPLICIT_LIB_DEPS, test x$REQUIRE_LIB_DEPS = xyes)
    249 
    250 dnl check if there's a way to force code inline
    251 AC_C_INLINE
    252 
    253 dnl **********************************************************************
    254 dnl platform/compiler/architecture specific checks/flags
    255 dnl **********************************************************************
    256 
    257 CURL_CHECK_COMPILER
    258 CURL_SET_COMPILER_BASIC_OPTS
    259 CURL_SET_COMPILER_DEBUG_OPTS
    260 CURL_SET_COMPILER_OPTIMIZE_OPTS
    261 CURL_SET_COMPILER_WARNING_OPTS
    262 
    263 if test "$compiler_id" = "INTEL_UNIX_C"; then
    264   #
    265   if test "$compiler_num" -ge "1000"; then
    266     dnl icc 10.X or later
    267     CFLAGS="$CFLAGS -shared-intel"
    268   elif test "$compiler_num" -ge "900"; then
    269     dnl icc 9.X specific
    270     CFLAGS="$CFLAGS -i-dynamic"
    271   fi
    272   #
    273 fi
    274 
    275 CURL_CHECK_COMPILER_HALT_ON_ERROR
    276 CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE
    277 CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
    278 CURL_CHECK_COMPILER_SYMBOL_HIDING
    279 
    280 CURL_CHECK_CURLDEBUG
    281 AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
    282 
    283 supports_unittests=yes
    284 # cross-compilation of unit tests static library/programs fails when
    285 # libcurl shared library is built. This might be due to a libtool or
    286 # automake issue. In this case we disable unit tests.
    287 if test "x$cross_compiling" != "xno" &&
    288    test "x$enable_shared" != "xno"; then
    289   supports_unittests=no
    290 fi
    291 
    292 # IRIX 6.5.24 gcc 3.3 autobuilds fail unittests library compilation due to
    293 # a problem related with OpenSSL headers and library versions not matching.
    294 # Disable unit tests while time to further investigate this is found.
    295 case $host in
    296   mips-sgi-irix6.5)
    297     if test "$compiler_id" = "GNU_C"; then
    298       supports_unittests=no
    299     fi
    300     ;;
    301 esac
    302 
    303 # All AIX autobuilds fails unit tests linking against unittests library
    304 # due to unittests library being built with no symbols or members. Libtool ?
    305 # Disable unit tests while time to further investigate this is found.
    306 case $host_os in
    307   aix*)
    308     supports_unittests=no
    309     ;;
    310 esac
    311 
    312 dnl Build unit tests when option --enable-debug is given.
    313 if test "x$want_debug" = "xyes" &&
    314    test "x$supports_unittests" = "xyes"; then
    315   want_unittests=yes
    316 else
    317   want_unittests=no
    318 fi
    319 AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
    320 
    321 dnl **********************************************************************
    322 dnl Compilation based checks should not be done before this point.
    323 dnl **********************************************************************
    324 
    325 dnl **********************************************************************
    326 dnl Make sure that our checks for headers windows.h winsock.h winsock2.h
    327 dnl and ws2tcpip.h take precedence over any other further checks which
    328 dnl could be done later using AC_CHECK_HEADER or AC_CHECK_HEADERS for
    329 dnl this specific header files. And do them before its results are used.
    330 dnl **********************************************************************
    331 
    332 CURL_CHECK_HEADER_WINDOWS
    333 CURL_CHECK_NATIVE_WINDOWS
    334 case X-"$curl_cv_native_windows" in
    335   X-yes)
    336     CURL_CHECK_HEADER_WINSOCK
    337     CURL_CHECK_HEADER_WINSOCK2
    338     CURL_CHECK_HEADER_WS2TCPIP
    339     CURL_CHECK_HEADER_WINLDAP
    340     CURL_CHECK_HEADER_WINBER
    341     ;;
    342   *)
    343     curl_cv_header_winsock_h="no"
    344     curl_cv_header_winsock2_h="no"
    345     curl_cv_header_ws2tcpip_h="no"
    346     curl_cv_header_winldap_h="no"
    347     curl_cv_header_winber_h="no"
    348     ;;
    349 esac
    350 CURL_CHECK_WIN32_LARGEFILE
    351 
    352 dnl ************************************************************
    353 dnl switch off particular protocols
    354 dnl
    355 AC_MSG_CHECKING([whether to support http])
    356 AC_ARG_ENABLE(http,
    357 AC_HELP_STRING([--enable-http],[Enable HTTP support])
    358 AC_HELP_STRING([--disable-http],[Disable HTTP support]),
    359 [ case "$enableval" in
    360   no)
    361        AC_MSG_RESULT(no)
    362        AC_DEFINE(CURL_DISABLE_HTTP, 1, [to disable HTTP])
    363        AC_MSG_WARN([disable HTTP disables FTP over proxy and RTSP])
    364        AC_SUBST(CURL_DISABLE_HTTP, [1])
    365        AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
    366        AC_SUBST(CURL_DISABLE_RTSP, [1])
    367        ;;
    368   *)   AC_MSG_RESULT(yes)
    369        ;;
    370   esac ],
    371        AC_MSG_RESULT(yes)
    372 )
    373 AC_MSG_CHECKING([whether to support ftp])
    374 AC_ARG_ENABLE(ftp,
    375 AC_HELP_STRING([--enable-ftp],[Enable FTP support])
    376 AC_HELP_STRING([--disable-ftp],[Disable FTP support]),
    377 [ case "$enableval" in
    378   no)
    379        AC_MSG_RESULT(no)
    380        AC_DEFINE(CURL_DISABLE_FTP, 1, [to disable FTP])
    381        AC_SUBST(CURL_DISABLE_FTP, [1])
    382        ;;
    383   *)   AC_MSG_RESULT(yes)
    384        ;;
    385   esac ],
    386        AC_MSG_RESULT(yes)
    387 )
    388 AC_MSG_CHECKING([whether to support file])
    389 AC_ARG_ENABLE(file,
    390 AC_HELP_STRING([--enable-file],[Enable FILE support])
    391 AC_HELP_STRING([--disable-file],[Disable FILE support]),
    392 [ case "$enableval" in
    393   no)
    394        AC_MSG_RESULT(no)
    395        AC_DEFINE(CURL_DISABLE_FILE, 1, [to disable FILE])
    396        AC_SUBST(CURL_DISABLE_FILE, [1])
    397        ;;
    398   *)   AC_MSG_RESULT(yes)
    399        ;;
    400   esac ],
    401        AC_MSG_RESULT(yes)
    402 )
    403 AC_MSG_CHECKING([whether to support ldap])
    404 AC_ARG_ENABLE(ldap,
    405 AC_HELP_STRING([--enable-ldap],[Enable LDAP support])
    406 AC_HELP_STRING([--disable-ldap],[Disable LDAP support]),
    407 [ case "$enableval" in
    408   no)
    409        AC_MSG_RESULT(no)
    410        AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
    411        AC_SUBST(CURL_DISABLE_LDAP, [1])
    412        ;;
    413   *)
    414        AC_MSG_RESULT(yes)
    415        ;;
    416   esac ],[
    417        AC_MSG_RESULT(yes) ]
    418 )
    419 AC_MSG_CHECKING([whether to support ldaps])
    420 AC_ARG_ENABLE(ldaps,
    421 AC_HELP_STRING([--enable-ldaps],[Enable LDAPS support])
    422 AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
    423 [ case "$enableval" in
    424   no)
    425        AC_MSG_RESULT(no)
    426        AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
    427        AC_SUBST(CURL_DISABLE_LDAPS, [1])
    428        ;;
    429   *)   if test "x$CURL_DISABLE_LDAP" = "x1" ; then
    430          AC_MSG_RESULT(LDAP needs to be enabled to support LDAPS)
    431          AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
    432          AC_SUBST(CURL_DISABLE_LDAPS, [1])
    433        else
    434          AC_MSG_RESULT(yes)
    435          AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
    436          AC_SUBST(HAVE_LDAP_SSL, [1])
    437        fi
    438        ;;
    439   esac ],[
    440        if test "x$CURL_DISABLE_LDAP" = "x1" ; then
    441          AC_MSG_RESULT(no)
    442          AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
    443          AC_SUBST(CURL_DISABLE_LDAPS, [1])
    444        else
    445          AC_MSG_RESULT(yes)
    446          AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
    447          AC_SUBST(HAVE_LDAP_SSL, [1])
    448        fi ]
    449 )
    450 
    451 AC_MSG_CHECKING([whether to support rtsp])
    452 AC_ARG_ENABLE(rtsp,
    453 AC_HELP_STRING([--enable-rtsp],[Enable RTSP support])
    454 AC_HELP_STRING([--disable-rtsp],[Disable RTSP support]),
    455 [ case "$enableval" in
    456   no)
    457        AC_MSG_RESULT(no)
    458        AC_DEFINE(CURL_DISABLE_RTSP, 1, [to disable RTSP])
    459        AC_SUBST(CURL_DISABLE_RTSP, [1])
    460        ;;
    461   *)   if test x$CURL_DISABLE_HTTP = x1 ; then
    462           AC_MSG_ERROR(HTTP support needs to be enabled in order to enable RTSP support!)
    463        else
    464           AC_MSG_RESULT(yes)
    465           curl_rtsp_msg="enabled"
    466        fi
    467        ;;
    468   esac ],
    469        if test "x$CURL_DISABLE_HTTP" != "x1"; then
    470           AC_MSG_RESULT(yes)
    471           curl_rtsp_msg="enabled"
    472        else
    473           AC_MSG_RESULT(no)
    474        fi
    475 )
    476 
    477 AC_MSG_CHECKING([whether to support proxies])
    478 AC_ARG_ENABLE(proxy,
    479 AC_HELP_STRING([--enable-proxy],[Enable proxy support])
    480 AC_HELP_STRING([--disable-proxy],[Disable proxy support]),
    481 [ case "$enableval" in
    482   no)
    483        AC_MSG_RESULT(no)
    484        AC_DEFINE(CURL_DISABLE_PROXY, 1, [to disable proxies])
    485        AC_SUBST(CURL_DISABLE_PROXY, [1])
    486        ;;
    487   *)   AC_MSG_RESULT(yes)
    488        ;;
    489   esac ],
    490        AC_MSG_RESULT(yes)
    491 )
    492 
    493 AC_MSG_CHECKING([whether to support dict])
    494 AC_ARG_ENABLE(dict,
    495 AC_HELP_STRING([--enable-dict],[Enable DICT support])
    496 AC_HELP_STRING([--disable-dict],[Disable DICT support]),
    497 [ case "$enableval" in
    498   no)
    499        AC_MSG_RESULT(no)
    500        AC_DEFINE(CURL_DISABLE_DICT, 1, [to disable DICT])
    501        AC_SUBST(CURL_DISABLE_DICT, [1])
    502        ;;
    503   *)   AC_MSG_RESULT(yes)
    504        ;;
    505   esac ],
    506        AC_MSG_RESULT(yes)
    507 )
    508 AC_MSG_CHECKING([whether to support telnet])
    509 AC_ARG_ENABLE(telnet,
    510 AC_HELP_STRING([--enable-telnet],[Enable TELNET support])
    511 AC_HELP_STRING([--disable-telnet],[Disable TELNET support]),
    512 [ case "$enableval" in
    513   no)
    514        AC_MSG_RESULT(no)
    515        AC_DEFINE(CURL_DISABLE_TELNET, 1, [to disable TELNET])
    516        AC_SUBST(CURL_DISABLE_TELNET, [1])
    517        ;;
    518   *)   AC_MSG_RESULT(yes)
    519        ;;
    520   esac ],
    521        AC_MSG_RESULT(yes)
    522 )
    523 AC_MSG_CHECKING([whether to support tftp])
    524 AC_ARG_ENABLE(tftp,
    525 AC_HELP_STRING([--enable-tftp],[Enable TFTP support])
    526 AC_HELP_STRING([--disable-tftp],[Disable TFTP support]),
    527 [ case "$enableval" in
    528   no)
    529        AC_MSG_RESULT(no)
    530        AC_DEFINE(CURL_DISABLE_TFTP, 1, [to disable TFTP])
    531        AC_SUBST(CURL_DISABLE_TFTP, [1])
    532        ;;
    533   *)   AC_MSG_RESULT(yes)
    534        ;;
    535   esac ],
    536        AC_MSG_RESULT(yes)
    537 )
    538 
    539 AC_MSG_CHECKING([whether to support pop3])
    540 AC_ARG_ENABLE(pop3,
    541 AC_HELP_STRING([--enable-pop3],[Enable POP3 support])
    542 AC_HELP_STRING([--disable-pop3],[Disable POP3 support]),
    543 [ case "$enableval" in
    544   no)
    545        AC_MSG_RESULT(no)
    546        AC_DEFINE(CURL_DISABLE_POP3, 1, [to disable POP3])
    547        AC_SUBST(CURL_DISABLE_POP3, [1])
    548        ;;
    549   *)   AC_MSG_RESULT(yes)
    550        ;;
    551   esac ],
    552        AC_MSG_RESULT(yes)
    553 )
    554 
    555 
    556 AC_MSG_CHECKING([whether to support imap])
    557 AC_ARG_ENABLE(imap,
    558 AC_HELP_STRING([--enable-imap],[Enable IMAP support])
    559 AC_HELP_STRING([--disable-imap],[Disable IMAP support]),
    560 [ case "$enableval" in
    561   no)
    562        AC_MSG_RESULT(no)
    563        AC_DEFINE(CURL_DISABLE_IMAP, 1, [to disable IMAP])
    564        AC_SUBST(CURL_DISABLE_IMAP, [1])
    565        ;;
    566   *)   AC_MSG_RESULT(yes)
    567        ;;
    568   esac ],
    569        AC_MSG_RESULT(yes)
    570 )
    571 
    572 
    573 AC_MSG_CHECKING([whether to support smb])
    574 AC_ARG_ENABLE(smb,
    575 AC_HELP_STRING([--enable-smb],[Enable SMB/CIFS support])
    576 AC_HELP_STRING([--disable-smb],[Disable SMB/CIFS support]),
    577 [ case "$enableval" in
    578   no)
    579        AC_MSG_RESULT(no)
    580        AC_DEFINE(CURL_DISABLE_SMB, 1, [to disable SMB/CIFS])
    581        AC_SUBST(CURL_DISABLE_SMB, [1])
    582        ;;
    583   *)   AC_MSG_RESULT(yes)
    584        ;;
    585   esac ],
    586        AC_MSG_RESULT(yes)
    587 )
    588 
    589 AC_MSG_CHECKING([whether to support smtp])
    590 AC_ARG_ENABLE(smtp,
    591 AC_HELP_STRING([--enable-smtp],[Enable SMTP support])
    592 AC_HELP_STRING([--disable-smtp],[Disable SMTP support]),
    593 [ case "$enableval" in
    594   no)
    595        AC_MSG_RESULT(no)
    596        AC_DEFINE(CURL_DISABLE_SMTP, 1, [to disable SMTP])
    597        AC_SUBST(CURL_DISABLE_SMTP, [1])
    598        ;;
    599   *)   AC_MSG_RESULT(yes)
    600        ;;
    601   esac ],
    602        AC_MSG_RESULT(yes)
    603 )
    604 
    605 AC_MSG_CHECKING([whether to support gopher])
    606 AC_ARG_ENABLE(gopher,
    607 AC_HELP_STRING([--enable-gopher],[Enable Gopher support])
    608 AC_HELP_STRING([--disable-gopher],[Disable Gopher support]),
    609 [ case "$enableval" in
    610   no)
    611        AC_MSG_RESULT(no)
    612        AC_DEFINE(CURL_DISABLE_GOPHER, 1, [to disable Gopher])
    613        AC_SUBST(CURL_DISABLE_GOPHER, [1])
    614        ;;
    615   *)   AC_MSG_RESULT(yes)
    616        ;;
    617   esac ],
    618        AC_MSG_RESULT(yes)
    619 )
    620 
    621 
    622 dnl **********************************************************************
    623 dnl Check for built-in manual
    624 dnl **********************************************************************
    625 
    626 AC_MSG_CHECKING([whether to provide built-in manual])
    627 AC_ARG_ENABLE(manual,
    628 AC_HELP_STRING([--enable-manual],[Enable built-in manual])
    629 AC_HELP_STRING([--disable-manual],[Disable built-in manual]),
    630 [ case "$enableval" in
    631   no)
    632        AC_MSG_RESULT(no)
    633        ;;
    634   *)   AC_MSG_RESULT(yes)
    635        USE_MANUAL="1"
    636        ;;
    637   esac ],
    638        AC_MSG_RESULT(yes)
    639        USE_MANUAL="1"
    640 )
    641 dnl The actual use of the USE_MANUAL variable is done much later in this
    642 dnl script to allow other actions to disable it as well.
    643 
    644 dnl ************************************************************
    645 dnl disable C code generation support
    646 dnl
    647 AC_MSG_CHECKING([whether to enable generation of C code])
    648 AC_ARG_ENABLE(libcurl_option,
    649 AC_HELP_STRING([--enable-libcurl-option],[Enable --libcurl C code generation support])
    650 AC_HELP_STRING([--disable-libcurl-option],[Disable --libcurl C code generation support]),
    651 [ case "$enableval" in
    652   no)
    653        AC_MSG_RESULT(no)
    654        AC_DEFINE(CURL_DISABLE_LIBCURL_OPTION, 1, [to disable --libcurl C code generation option])
    655        curl_libcurl_msg="no"
    656        ;;
    657   *)   AC_MSG_RESULT(yes)
    658        ;;
    659   esac ],
    660        AC_MSG_RESULT(yes)
    661 )
    662 
    663 dnl **********************************************************************
    664 dnl Checks for libraries.
    665 dnl **********************************************************************
    666 
    667 AC_MSG_CHECKING([whether to use libgcc])
    668 AC_ARG_ENABLE(libgcc,
    669 AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
    670 [ case "$enableval" in
    671   yes)
    672        LIBS="-lgcc $LIBS"
    673        AC_MSG_RESULT(yes)
    674        ;;
    675   *)   AC_MSG_RESULT(no)
    676        ;;
    677   esac ],
    678        AC_MSG_RESULT(no)
    679 )
    680 
    681 CURL_CHECK_LIB_XNET
    682 
    683 dnl gethostbyname without lib or in the nsl lib?
    684 AC_CHECK_FUNC(gethostbyname,
    685               [HAVE_GETHOSTBYNAME="1"
    686               ],
    687               [ AC_CHECK_LIB(nsl, gethostbyname,
    688                              [HAVE_GETHOSTBYNAME="1"
    689                              LIBS="-lnsl $LIBS"
    690                              ])
    691               ])
    692 
    693 if test "$HAVE_GETHOSTBYNAME" != "1"
    694 then
    695   dnl gethostbyname in the socket lib?
    696   AC_CHECK_LIB(socket, gethostbyname,
    697                [HAVE_GETHOSTBYNAME="1"
    698                LIBS="-lsocket $LIBS"
    699                ])
    700 fi
    701 
    702 if test "$HAVE_GETHOSTBYNAME" != "1"
    703 then
    704   dnl gethostbyname in the watt lib?
    705   AC_CHECK_LIB(watt, gethostbyname,
    706                [HAVE_GETHOSTBYNAME="1"
    707                CPPFLAGS="-I/dev/env/WATT_ROOT/inc"
    708                LDFLAGS="-L/dev/env/WATT_ROOT/lib"
    709                LIBS="-lwatt $LIBS"
    710                ])
    711 fi
    712 
    713 dnl At least one system has been identified to require BOTH nsl and socket
    714 dnl libs at the same time to link properly.
    715 if test "$HAVE_GETHOSTBYNAME" != "1"
    716 then
    717   AC_MSG_CHECKING([for gethostbyname with both nsl and socket libs])
    718   my_ac_save_LIBS=$LIBS
    719   LIBS="-lnsl -lsocket $LIBS"
    720   AC_LINK_IFELSE([
    721     AC_LANG_PROGRAM([[
    722     ]],[[
    723       gethostbyname();
    724     ]])
    725   ],[
    726     AC_MSG_RESULT([yes])
    727     HAVE_GETHOSTBYNAME="1"
    728   ],[
    729     AC_MSG_RESULT([no])
    730     LIBS=$my_ac_save_LIBS
    731   ])
    732 fi
    733 
    734 if test "$HAVE_GETHOSTBYNAME" != "1"
    735 then
    736   dnl This is for winsock systems
    737   if test "$curl_cv_header_windows_h" = "yes"; then
    738     if test "$curl_cv_header_winsock_h" = "yes"; then
    739       case $host in
    740         *-*-mingw32ce*)
    741           winsock_LIB="-lwinsock"
    742           ;;
    743         *)
    744           winsock_LIB="-lwsock32"
    745           ;;
    746       esac
    747     fi
    748     if test "$curl_cv_header_winsock2_h" = "yes"; then
    749       winsock_LIB="-lws2_32"
    750     fi
    751     if test ! -z "$winsock_LIB"; then
    752       my_ac_save_LIBS=$LIBS
    753       LIBS="$winsock_LIB $LIBS"
    754       AC_MSG_CHECKING([for gethostbyname in $winsock_LIB])
    755       AC_LINK_IFELSE([
    756         AC_LANG_PROGRAM([[
    757 #ifdef HAVE_WINDOWS_H
    758 #ifndef WIN32_LEAN_AND_MEAN
    759 #define WIN32_LEAN_AND_MEAN
    760 #endif
    761 #include <windows.h>
    762 #ifdef HAVE_WINSOCK2_H
    763 #include <winsock2.h>
    764 #else
    765 #ifdef HAVE_WINSOCK_H
    766 #include <winsock.h>
    767 #endif
    768 #endif
    769 #endif
    770         ]],[[
    771           gethostbyname("www.dummysite.com");
    772         ]])
    773       ],[
    774         AC_MSG_RESULT([yes])
    775         HAVE_GETHOSTBYNAME="1"
    776       ],[
    777         AC_MSG_RESULT([no])
    778         winsock_LIB=""
    779         LIBS=$my_ac_save_LIBS
    780       ])
    781     fi
    782   fi
    783 fi
    784 
    785 if test "$HAVE_GETHOSTBYNAME" != "1"
    786 then
    787   dnl This is for Minix 3.1
    788   AC_MSG_CHECKING([for gethostbyname for Minix 3])
    789   AC_LINK_IFELSE([
    790     AC_LANG_PROGRAM([[
    791 /* Older Minix versions may need <net/gen/netdb.h> here instead */
    792 #include <netdb.h>
    793     ]],[[
    794       gethostbyname("www.dummysite.com");
    795     ]])
    796   ],[
    797     AC_MSG_RESULT([yes])
    798     HAVE_GETHOSTBYNAME="1"
    799   ],[
    800     AC_MSG_RESULT([no])
    801   ])
    802 fi
    803 
    804 if test "$HAVE_GETHOSTBYNAME" != "1"
    805 then
    806   dnl This is for eCos with a stubbed DNS implementation
    807   AC_MSG_CHECKING([for gethostbyname for eCos])
    808   AC_LINK_IFELSE([
    809     AC_LANG_PROGRAM([[
    810 #include <stdio.h>
    811 #include <netdb.h>
    812     ]],[[
    813       gethostbyname("www.dummysite.com");
    814     ]])
    815   ],[
    816     AC_MSG_RESULT([yes])
    817     HAVE_GETHOSTBYNAME="1"
    818   ],[
    819     AC_MSG_RESULT([no])
    820   ])
    821 fi
    822 
    823 if test "$HAVE_GETHOSTBYNAME" != "1"
    824 then
    825   dnl gethostbyname in the network lib - for Haiku OS
    826   AC_CHECK_LIB(network, gethostbyname,
    827                [HAVE_GETHOSTBYNAME="1"
    828                LIBS="-lnetwork $LIBS"
    829                ])
    830 fi
    831 
    832 if test "$HAVE_GETHOSTBYNAME" != "1"
    833 then
    834   dnl gethostbyname in the net lib - for BeOS
    835   AC_CHECK_LIB(net, gethostbyname,
    836                [HAVE_GETHOSTBYNAME="1"
    837                LIBS="-lnet $LIBS"
    838                ])
    839 fi
    840 
    841 
    842 if test "$HAVE_GETHOSTBYNAME" != "1"; then
    843   AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
    844 fi
    845 
    846 CURL_CHECK_LIBS_CONNECT
    847 
    848 CURL_NETWORK_LIBS=$LIBS
    849 
    850 dnl **********************************************************************
    851 dnl In case that function clock_gettime with monotonic timer is available,
    852 dnl check for additional required libraries.
    853 dnl **********************************************************************
    854 CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC
    855 
    856 dnl **********************************************************************
    857 dnl The preceding library checks are all potentially useful for test
    858 dnl servers and libtest cases which require networking and clock_gettime
    859 dnl support.  Save the list of required libraries at this point for use
    860 dnl while linking those test servers and programs.
    861 dnl **********************************************************************
    862 CURL_NETWORK_AND_TIME_LIBS=$LIBS
    863 
    864 dnl **********************************************************************
    865 dnl Check for the presence of ZLIB libraries and headers
    866 dnl **********************************************************************
    867 
    868 dnl Check for & handle argument to --with-zlib.
    869 
    870 clean_CPPFLAGS=$CPPFLAGS
    871 clean_LDFLAGS=$LDFLAGS
    872 clean_LIBS=$LIBS
    873 ZLIB_LIBS=""
    874 AC_ARG_WITH(zlib,
    875 AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
    876 AC_HELP_STRING([--without-zlib],[disable use of zlib]),
    877                [OPT_ZLIB="$withval"])
    878 
    879 if test "$OPT_ZLIB" = "no" ; then
    880     AC_MSG_WARN([zlib disabled])
    881 else
    882   if test "$OPT_ZLIB" = "yes" ; then
    883     OPT_ZLIB=""
    884   fi
    885 
    886   if test -z "$OPT_ZLIB" ; then
    887     dnl check for the lib first without setting any new path, since many
    888     dnl people have it in the default path
    889 
    890     AC_CHECK_LIB(z, inflateEnd,
    891                    dnl libz found, set the variable
    892                    [HAVE_LIBZ="1"
    893                     LIBS="-lz $LIBS"],
    894                    dnl if no lib found, try /usr/local
    895                    [OPT_ZLIB="/usr/local"])
    896 
    897   fi
    898 
    899   dnl Add a nonempty path to the compiler flags
    900   if test -n "$OPT_ZLIB"; then
    901      CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
    902      LDFLAGS="$LDFLAGS -L$OPT_ZLIB/lib$libsuff"
    903   fi
    904 
    905   AC_CHECK_HEADER(zlib.h,
    906     [
    907     dnl zlib.h was found
    908     HAVE_ZLIB_H="1"
    909     dnl if the lib wasn't found already, try again with the new paths
    910     if test "$HAVE_LIBZ" != "1"; then
    911       AC_CHECK_LIB(z, gzread,
    912                    [
    913                    dnl the lib was found!
    914                    HAVE_LIBZ="1"
    915                    LIBS="-lz $LIBS"
    916                    ],
    917                    [ CPPFLAGS=$clean_CPPFLAGS
    918                    LDFLAGS=$clean_LDFLAGS])
    919     fi
    920     ],
    921     [
    922       dnl zlib.h was not found, restore the flags
    923       CPPFLAGS=$clean_CPPFLAGS
    924       LDFLAGS=$clean_LDFLAGS]
    925     )
    926 
    927   if test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" != "1"
    928   then
    929     AC_MSG_WARN([configure found only the libz lib, not the header file!])
    930     HAVE_LIBZ=""
    931     CPPFLAGS=$clean_CPPFLAGS
    932     LDFLAGS=$clean_LDFLAGS
    933     LIBS=$clean_LIBS
    934   elif test "$HAVE_LIBZ" != "1" && test "$HAVE_ZLIB_H" = "1"
    935   then
    936     AC_MSG_WARN([configure found only the libz header file, not the lib!])
    937     CPPFLAGS=$clean_CPPFLAGS
    938     LDFLAGS=$clean_LDFLAGS
    939     LIBS=$clean_LIBS
    940   elif test "$HAVE_LIBZ" = "1" && test "$HAVE_ZLIB_H" = "1"
    941   then
    942     dnl both header and lib were found!
    943     AC_SUBST(HAVE_LIBZ)
    944     AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
    945     AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
    946 
    947     ZLIB_LIBS="-lz"
    948     LIBS="-lz $clean_LIBS"
    949 
    950     dnl replace 'HAVE_LIBZ' in the automake makefile.ams
    951     AMFIXLIB="1"
    952     AC_MSG_NOTICE([found both libz and libz.h header])
    953     curl_zlib_msg="enabled"
    954   fi
    955 fi
    956 
    957 dnl set variable for use in automakefile(s)
    958 AM_CONDITIONAL(HAVE_LIBZ, test x"$AMFIXLIB" = x1)
    959 AC_SUBST(ZLIB_LIBS)
    960 
    961 dnl **********************************************************************
    962 dnl Check for LDAP
    963 dnl **********************************************************************
    964 
    965 LDAPLIBNAME=""
    966 AC_ARG_WITH(ldap-lib,
    967 AC_HELP_STRING([--with-ldap-lib=libname],[Specify name of ldap lib file]),
    968  [LDAPLIBNAME="$withval"])
    969 
    970 LBERLIBNAME=""
    971 AC_ARG_WITH(lber-lib,
    972 AC_HELP_STRING([--with-lber-lib=libname],[Specify name of lber lib file]),
    973  [LBERLIBNAME="$withval"])
    974 
    975 if test x$CURL_DISABLE_LDAP != x1 ; then
    976 
    977   CURL_CHECK_HEADER_LBER
    978   CURL_CHECK_HEADER_LDAP
    979   CURL_CHECK_HEADER_LDAPSSL
    980   CURL_CHECK_HEADER_LDAP_SSL
    981 
    982   if test -z "$LDAPLIBNAME" ; then
    983     if test "$curl_cv_native_windows" = "yes"; then
    984       dnl Windows uses a single and unique LDAP library name
    985       LDAPLIBNAME="wldap32"
    986       LBERLIBNAME="no"
    987     fi
    988   fi
    989 
    990   if test "$LDAPLIBNAME" ; then
    991     AC_CHECK_LIB("$LDAPLIBNAME", ldap_init,, [
    992       AC_MSG_WARN(["$LDAPLIBNAME" is not an LDAP library: LDAP disabled])
    993       AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
    994       AC_SUBST(CURL_DISABLE_LDAP, [1])
    995       AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
    996       AC_SUBST(CURL_DISABLE_LDAPS, [1])])
    997   else
    998     dnl Try to find the right ldap libraries for this system
    999     CURL_CHECK_LIBS_LDAP
   1000     case X-"$curl_cv_ldap_LIBS" in
   1001       X-unknown)
   1002         AC_MSG_WARN([Cannot find libraries for LDAP support: LDAP disabled])
   1003         AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
   1004         AC_SUBST(CURL_DISABLE_LDAP, [1])
   1005         AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
   1006         AC_SUBST(CURL_DISABLE_LDAPS, [1])
   1007         ;;
   1008     esac
   1009   fi
   1010 fi
   1011 
   1012 if test x$CURL_DISABLE_LDAP != x1 ; then
   1013 
   1014   if test "$LBERLIBNAME" ; then
   1015     dnl If name is "no" then don't define this library at all
   1016     dnl (it's only needed if libldap.so's dependencies are broken).
   1017     if test "$LBERLIBNAME" != "no" ; then
   1018       AC_CHECK_LIB("$LBERLIBNAME", ber_free,, [
   1019         AC_MSG_WARN(["$LBERLIBNAME" is not an LBER library: LDAP disabled])
   1020         AC_DEFINE(CURL_DISABLE_LDAP, 1, [to disable LDAP])
   1021         AC_SUBST(CURL_DISABLE_LDAP, [1])
   1022         AC_DEFINE(CURL_DISABLE_LDAPS, 1, [to disable LDAPS])
   1023         AC_SUBST(CURL_DISABLE_LDAPS, [1])])
   1024     fi
   1025   fi
   1026 fi
   1027 
   1028 if test x$CURL_DISABLE_LDAP != x1 ; then
   1029   AC_CHECK_FUNCS([ldap_url_parse ldap_init_fd])
   1030 
   1031   if test "$LDAPLIBNAME" = "wldap32"; then
   1032     curl_ldap_msg="enabled (winldap)"
   1033     AC_DEFINE(USE_WIN32_LDAP, 1, [Use Windows LDAP implementation])
   1034   else
   1035     curl_ldap_msg="enabled (OpenLDAP)"
   1036     if test "x$ac_cv_func_ldap_init_fd" = "xyes"; then
   1037       AC_DEFINE(USE_OPENLDAP, 1, [Use OpenLDAP-specific code])
   1038       AC_SUBST(USE_OPENLDAP, [1])
   1039     fi
   1040   fi
   1041 fi
   1042 
   1043 if test x$CURL_DISABLE_LDAPS != x1 ; then
   1044     curl_ldaps_msg="enabled"
   1045 fi
   1046 
   1047 dnl **********************************************************************
   1048 dnl Checks for IPv6
   1049 dnl **********************************************************************
   1050 
   1051 AC_MSG_CHECKING([whether to enable IPv6])
   1052 AC_ARG_ENABLE(ipv6,
   1053 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 (with IPv4) support])
   1054 AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
   1055 [ case "$enableval" in
   1056   no)
   1057        AC_MSG_RESULT(no)
   1058        ipv6=no
   1059        ;;
   1060   *)   AC_MSG_RESULT(yes)
   1061        ipv6=yes
   1062        ;;
   1063   esac ],
   1064 
   1065   AC_TRY_RUN([ /* is AF_INET6 available? */
   1066 #include <sys/types.h>
   1067 #ifdef HAVE_WINSOCK2_H
   1068 #include <winsock2.h>
   1069 #else
   1070 #include <sys/socket.h>
   1071 #endif
   1072 #include <stdlib.h> /* for exit() */
   1073 main()
   1074 {
   1075  if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
   1076    exit(1);
   1077  else
   1078    exit(0);
   1079 }
   1080 ],
   1081   AC_MSG_RESULT(yes)
   1082   ipv6=yes,
   1083   AC_MSG_RESULT(no)
   1084   ipv6=no,
   1085   AC_MSG_RESULT(yes)
   1086   ipv6=yes
   1087 ))
   1088 
   1089 if test "$ipv6" = "yes"; then
   1090   curl_ipv6_msg="enabled"
   1091 fi
   1092 
   1093 # Check if struct sockaddr_in6 have sin6_scope_id member
   1094 if test "$ipv6" = yes; then
   1095   AC_MSG_CHECKING([if struct sockaddr_in6 has sin6_scope_id member])
   1096   AC_TRY_COMPILE([
   1097 #include <sys/types.h>
   1098 #ifdef HAVE_WINSOCK2_H
   1099 #include <winsock2.h>
   1100 #include <ws2tcpip.h>
   1101 #else
   1102 #include <netinet/in.h>
   1103 #endif] ,
   1104   struct sockaddr_in6 s; s.sin6_scope_id = 0; , have_sin6_scope_id=yes)
   1105   if test "$have_sin6_scope_id" = yes; then
   1106     AC_MSG_RESULT([yes])
   1107     AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID, 1, [Define to 1 if struct sockaddr_in6 has the sin6_scope_id member])
   1108   else
   1109     AC_MSG_RESULT([no])
   1110   fi
   1111 fi
   1112 
   1113 dnl **********************************************************************
   1114 dnl Check if the operating system allows programs to write to their own argv[]
   1115 dnl **********************************************************************
   1116 
   1117 AC_MSG_CHECKING([if argv can be written to])
   1118 AC_RUN_IFELSE([
   1119   AC_LANG_SOURCE([[
   1120 int main(int argc, char ** argv) {
   1121     argv[0][0] = ' ';
   1122     return (argv[0][0] == ' ')?0:1;
   1123 }
   1124   ]])
   1125 ],[
   1126   curl_cv_writable_argv=yes
   1127 ],[
   1128   curl_cv_writable_argv=no
   1129 ],[
   1130   curl_cv_writable_argv=cross
   1131 ])
   1132 case $curl_cv_writable_argv in
   1133 yes)
   1134         AC_DEFINE(HAVE_WRITABLE_ARGV, 1, [Define this symbol if your OS supports changing the contents of argv])
   1135         AC_MSG_RESULT(yes)
   1136         ;;
   1137 no)
   1138         AC_MSG_RESULT(no)
   1139         ;;
   1140 *)
   1141         AC_MSG_RESULT(no)
   1142         AC_MSG_WARN([the previous check could not be made default was used])
   1143         ;;
   1144 esac
   1145 
   1146 dnl **********************************************************************
   1147 dnl Check for GSS-API libraries
   1148 dnl **********************************************************************
   1149 
   1150 dnl check for GSS-API stuff in the /usr as default
   1151 
   1152 GSSAPI_ROOT="/usr"
   1153 AC_ARG_WITH(gssapi-includes,
   1154   AC_HELP_STRING([--with-gssapi-includes=DIR],
   1155                  [Specify location of GSS-API headers]),
   1156   [ GSSAPI_INCS="-I$withval"
   1157     want_gss="yes" ]
   1158 )
   1159 
   1160 AC_ARG_WITH(gssapi-libs,
   1161   AC_HELP_STRING([--with-gssapi-libs=DIR],
   1162                  [Specify location of GSS-API libs]),
   1163   [ GSSAPI_LIB_DIR="-L$withval"
   1164     want_gss="yes" ]
   1165 )
   1166 
   1167 AC_ARG_WITH(gssapi,
   1168   AC_HELP_STRING([--with-gssapi=DIR],
   1169                  [Where to look for GSS-API]), [
   1170   GSSAPI_ROOT="$withval"
   1171   if test x"$GSSAPI_ROOT" != xno; then
   1172     want_gss="yes"
   1173     if test x"$GSSAPI_ROOT" = xyes; then
   1174       dnl if yes, then use default root
   1175       GSSAPI_ROOT="/usr"
   1176     fi
   1177   fi
   1178 ])
   1179 
   1180 : ${KRB5CONFIG:="$GSSAPI_ROOT/bin/krb5-config"}
   1181 
   1182 save_CPPFLAGS="$CPPFLAGS"
   1183 AC_MSG_CHECKING([if GSS-API support is requested])
   1184 if test x"$want_gss" = xyes; then
   1185   AC_MSG_RESULT(yes)
   1186 
   1187   if test -z "$GSSAPI_INCS"; then
   1188      if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
   1189         GSSAPI_INCS=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --cflags gssapi`
   1190      elif test -f "$KRB5CONFIG"; then
   1191         GSSAPI_INCS=`$KRB5CONFIG --cflags gssapi`
   1192      elif test "$GSSAPI_ROOT" != "yes"; then
   1193         GSSAPI_INCS="-I$GSSAPI_ROOT/include"
   1194      fi
   1195   fi
   1196 
   1197   CPPFLAGS="$CPPFLAGS $GSSAPI_INCS"
   1198 
   1199   AC_CHECK_HEADER(gss.h,
   1200     [
   1201       dnl found in the given dirs
   1202       AC_DEFINE(HAVE_GSSGNU, 1, [if you have GNU GSS])
   1203       gnu_gss=yes
   1204     ],
   1205     [
   1206       dnl not found, check Heimdal or MIT
   1207       AC_CHECK_HEADERS([gssapi/gssapi.h], [], [not_mit=1])
   1208       AC_CHECK_HEADERS(
   1209         [gssapi/gssapi_generic.h gssapi/gssapi_krb5.h],
   1210         [],
   1211         [not_mit=1],
   1212         [
   1213 AC_INCLUDES_DEFAULT
   1214 #ifdef HAVE_GSSAPI_GSSAPI_H
   1215 #include <gssapi/gssapi.h>
   1216 #endif
   1217         ])
   1218       if test "x$not_mit" = "x1"; then
   1219         dnl MIT not found, check for Heimdal
   1220         AC_CHECK_HEADER(gssapi.h,
   1221             [
   1222               dnl found
   1223               AC_DEFINE(HAVE_GSSHEIMDAL, 1, [if you have Heimdal])
   1224             ],
   1225             [
   1226               dnl no header found, disabling GSS
   1227               want_gss=no
   1228               AC_MSG_WARN(disabling GSS-API support since no header files were found)
   1229             ]
   1230           )
   1231       else
   1232         dnl MIT found
   1233         AC_DEFINE(HAVE_GSSMIT, 1, [if you have MIT Kerberos])
   1234         dnl check if we have a really old MIT Kerberos version (<= 1.2)
   1235         AC_MSG_CHECKING([if GSS-API headers declare GSS_C_NT_HOSTBASED_SERVICE])
   1236         AC_COMPILE_IFELSE([
   1237           AC_LANG_PROGRAM([[
   1238 #include <gssapi/gssapi.h>
   1239 #include <gssapi/gssapi_generic.h>
   1240 #include <gssapi/gssapi_krb5.h>
   1241           ]],[[
   1242             gss_import_name(
   1243                             (OM_uint32 *)0,
   1244                             (gss_buffer_t)0,
   1245                             GSS_C_NT_HOSTBASED_SERVICE,
   1246                             (gss_name_t *)0);
   1247           ]])
   1248         ],[
   1249           AC_MSG_RESULT([yes])
   1250         ],[
   1251           AC_MSG_RESULT([no])
   1252           AC_DEFINE(HAVE_OLD_GSSMIT, 1,
   1253             [if you have an old MIT Kerberos version, lacking GSS_C_NT_HOSTBASED_SERVICE])
   1254         ])
   1255       fi
   1256     ]
   1257   )
   1258 else
   1259   AC_MSG_RESULT(no)
   1260 fi
   1261 if test x"$want_gss" = xyes; then
   1262   AC_DEFINE(HAVE_GSSAPI, 1, [if you have GSS-API libraries])
   1263   HAVE_GSSAPI=1
   1264   curl_gss_msg="enabled (MIT Kerberos/Heimdal)"
   1265 
   1266   if test -n "$gnu_gss"; then
   1267     curl_gss_msg="enabled (GNU GSS)"
   1268     LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
   1269     LIBS="-lgss $LIBS"
   1270   elif test -z "$GSSAPI_LIB_DIR"; then
   1271      case $host in
   1272      *-*-darwin*)
   1273         LIBS="-lgssapi_krb5 -lresolv $LIBS"
   1274         ;;
   1275      *)
   1276         if test -n "$host_alias" -a -f "$GSSAPI_ROOT/bin/$host_alias-krb5-config"; then
   1277            dnl krb5-config doesn't have --libs-only-L or similar, put everything
   1278            dnl into LIBS
   1279            gss_libs=`$GSSAPI_ROOT/bin/$host_alias-krb5-config --libs gssapi`
   1280            LIBS="$gss_libs $LIBS"
   1281         elif test -f "$KRB5CONFIG"; then
   1282            dnl krb5-config doesn't have --libs-only-L or similar, put everything
   1283            dnl into LIBS
   1284            gss_libs=`$KRB5CONFIG --libs gssapi`
   1285            LIBS="$gss_libs $LIBS"
   1286         else
   1287            case $host in
   1288            *-hp-hpux*)
   1289               gss_libname="gss"
   1290               ;;
   1291            *)
   1292               gss_libname="gssapi"
   1293               ;;
   1294            esac
   1295 
   1296            if test "$GSSAPI_ROOT" != "yes"; then
   1297               LDFLAGS="$LDFLAGS -L$GSSAPI_ROOT/lib$libsuff"
   1298               LIBS="-l$gss_libname $LIBS"
   1299            else
   1300               LIBS="-l$gss_libname $LIBS"
   1301            fi
   1302         fi
   1303         ;;
   1304      esac
   1305   else
   1306      LDFLAGS="$LDFLAGS $GSSAPI_LIB_DIR"
   1307      case $host in
   1308      *-hp-hpux*)
   1309         LIBS="-lgss $LIBS"
   1310         ;;
   1311      *)
   1312         LIBS="-lgssapi $LIBS"
   1313         ;;
   1314      esac
   1315   fi
   1316 else
   1317   CPPFLAGS="$save_CPPFLAGS"
   1318 fi
   1319 
   1320 dnl -------------------------------------------------
   1321 dnl check winssl option before other SSL libraries
   1322 dnl -------------------------------------------------
   1323 
   1324 OPT_WINSSL=no
   1325 AC_ARG_WITH(winssl,dnl
   1326 AC_HELP_STRING([--with-winssl],[enable Windows native SSL/TLS])
   1327 AC_HELP_STRING([--without-winssl], [disable Windows native SSL/TLS]),
   1328   OPT_WINSSL=$withval)
   1329 
   1330 AC_MSG_CHECKING([whether to enable Windows native SSL/TLS (Windows native builds only)])
   1331 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   1332   if test "x$OPT_WINSSL" != "xno"  &&
   1333      test "x$curl_cv_native_windows" = "xyes"; then
   1334     AC_MSG_RESULT(yes)
   1335     AC_DEFINE(USE_SCHANNEL, 1, [to enable Windows native SSL/TLS support])
   1336     AC_SUBST(USE_SCHANNEL, [1])
   1337     curl_ssl_msg="enabled (Windows-native)"
   1338     WINSSL_ENABLED=1
   1339     # --with-winssl implies --enable-sspi
   1340     AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
   1341     AC_SUBST(USE_WINDOWS_SSPI, [1])
   1342     curl_sspi_msg="enabled"
   1343     LIBS="-lcrypt32 $LIBS"
   1344   else
   1345     AC_MSG_RESULT(no)
   1346   fi
   1347 else
   1348   AC_MSG_RESULT(no)
   1349 fi
   1350 
   1351 OPT_DARWINSSL=no
   1352 AC_ARG_WITH(darwinssl,dnl
   1353 AC_HELP_STRING([--with-darwinssl],[enable iOS/Mac OS X native SSL/TLS])
   1354 AC_HELP_STRING([--without-darwinssl], [disable iOS/Mac OS X native SSL/TLS]),
   1355   OPT_DARWINSSL=$withval)
   1356 
   1357 AC_MSG_CHECKING([whether to enable iOS/Mac OS X native SSL/TLS])
   1358 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   1359   if test "x$OPT_DARWINSSL" != "xno" &&
   1360      test -d "/System/Library/Frameworks/Security.framework"; then
   1361     AC_MSG_RESULT(yes)
   1362     AC_DEFINE(USE_DARWINSSL, 1, [to enable iOS/Mac OS X native SSL/TLS support])
   1363     AC_SUBST(USE_DARWINSSL, [1])
   1364     curl_ssl_msg="enabled (iOS/Mac OS X-native)"
   1365     DARWINSSL_ENABLED=1
   1366     LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security"
   1367   else
   1368     AC_MSG_RESULT(no)
   1369   fi
   1370 else
   1371   AC_MSG_RESULT(no)
   1372 fi
   1373 
   1374 dnl **********************************************************************
   1375 dnl Check for the presence of SSL libraries and headers
   1376 dnl **********************************************************************
   1377 
   1378 dnl Default to compiler & linker defaults for SSL files & libraries.
   1379 OPT_SSL=off
   1380 dnl Default to no CA bundle
   1381 ca="no"
   1382 AC_ARG_WITH(ssl,dnl
   1383 AC_HELP_STRING([--with-ssl=PATH],[Where to look for OpenSSL, PATH points to the SSL installation (default: /usr/local/ssl); when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
   1384 AC_HELP_STRING([--without-ssl], [disable OpenSSL]),
   1385   OPT_SSL=$withval)
   1386 
   1387 if test "$curl_ssl_msg" = "$init_ssl_msg" && test X"$OPT_SSL" != Xno; then
   1388   dnl backup the pre-ssl variables
   1389   CLEANLDFLAGS="$LDFLAGS"
   1390   CLEANCPPFLAGS="$CPPFLAGS"
   1391   CLEANLIBS="$LIBS"
   1392 
   1393   dnl This is for Msys/Mingw
   1394   case $host in
   1395     *-*-msys* | *-*-mingw*)
   1396       AC_MSG_CHECKING([for gdi32])
   1397       my_ac_save_LIBS=$LIBS
   1398       LIBS="-lgdi32 $LIBS"
   1399       AC_TRY_LINK([#include <windef.h>
   1400                    #include <wingdi.h>],
   1401                    [GdiFlush();],
   1402                    [ dnl worked!
   1403                    AC_MSG_RESULT([yes])],
   1404                    [ dnl failed, restore LIBS
   1405                    LIBS=$my_ac_save_LIBS
   1406                    AC_MSG_RESULT(no)]
   1407                   )
   1408       ;;
   1409   esac
   1410 
   1411   case "$OPT_SSL" in
   1412   yes)
   1413     dnl --with-ssl (without path) used
   1414     if test x$cross_compiling != xyes; then
   1415       dnl only do pkg-config magic when not cross-compiling
   1416       PKGTEST="yes"
   1417     fi
   1418     PREFIX_OPENSSL=/usr/local/ssl
   1419     LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
   1420     ;;
   1421   off)
   1422     dnl no --with-ssl option given, just check default places
   1423     if test x$cross_compiling != xyes; then
   1424       dnl only do pkg-config magic when not cross-compiling
   1425       PKGTEST="yes"
   1426     fi
   1427     PREFIX_OPENSSL=
   1428     ;;
   1429   *)
   1430     dnl check the given --with-ssl spot
   1431     PKGTEST="no"
   1432     PREFIX_OPENSSL=$OPT_SSL
   1433 
   1434     dnl Try pkg-config even when cross-compiling.  Since we
   1435     dnl specify PKG_CONFIG_LIBDIR we're only looking where
   1436     dnl the user told us to look
   1437     OPENSSL_PCDIR="$OPT_SSL/lib/pkgconfig"
   1438     AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$OPENSSL_PCDIR"])
   1439     if test -f "$OPENSSL_PCDIR/openssl.pc"; then
   1440       PKGTEST="yes"
   1441     fi
   1442 
   1443     dnl in case pkg-config comes up empty, use what we got
   1444     dnl via --with-ssl
   1445     LIB_OPENSSL="$PREFIX_OPENSSL/lib$libsuff"
   1446     if test "$PREFIX_OPENSSL" != "/usr" ; then
   1447       SSL_LDFLAGS="-L$LIB_OPENSSL"
   1448       SSL_CPPFLAGS="-I$PREFIX_OPENSSL/include"
   1449     fi
   1450     SSL_CPPFLAGS="$SSL_CPPFLAGS -I$PREFIX_OPENSSL/include/openssl"
   1451     ;;
   1452   esac
   1453 
   1454   if test "$PKGTEST" = "yes"; then
   1455 
   1456     CURL_CHECK_PKGCONFIG(openssl, [$OPENSSL_PCDIR])
   1457 
   1458     if test "$PKGCONFIG" != "no" ; then
   1459       SSL_LIBS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
   1460         $PKGCONFIG --libs-only-l openssl 2>/dev/null`
   1461 
   1462       SSL_LDFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
   1463         $PKGCONFIG --libs-only-L openssl 2>/dev/null`
   1464 
   1465       SSL_CPPFLAGS=`CURL_EXPORT_PCDIR([$OPENSSL_PCDIR]) dnl
   1466         $PKGCONFIG --cflags-only-I openssl 2>/dev/null`
   1467 
   1468       AC_SUBST(SSL_LIBS)
   1469       AC_MSG_NOTICE([pkg-config: SSL_LIBS: "$SSL_LIBS"])
   1470       AC_MSG_NOTICE([pkg-config: SSL_LDFLAGS: "$SSL_LDFLAGS"])
   1471       AC_MSG_NOTICE([pkg-config: SSL_CPPFLAGS: "$SSL_CPPFLAGS"])
   1472 
   1473       LIB_OPENSSL=`echo $SSL_LDFLAGS | sed -e 's/-L//g'`
   1474 
   1475       dnl use the values pkg-config reported.  This is here
   1476       dnl instead of below with CPPFLAGS and LDFLAGS because we only
   1477       dnl learn about this via pkg-config.  If we only have
   1478       dnl the argument to --with-ssl we don't know what
   1479       dnl additional libs may be necessary.  Hope that we
   1480       dnl don't need any.
   1481       LIBS="$SSL_LIBS $LIBS"
   1482     fi
   1483   fi
   1484 
   1485   dnl finally, set flags to use SSL
   1486   CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
   1487   LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
   1488 
   1489   AC_CHECK_LIB(crypto, HMAC_Update,[
   1490      HAVECRYPTO="yes"
   1491      LIBS="-lcrypto $LIBS"
   1492      ],[
   1493      LDFLAGS="$CLEANLDFLAGS -L$LIB_OPENSSL"
   1494      CPPFLAGS="$CLEANCPPFLAGS -I$PREFIX_OPENSSL/include/openssl -I$PREFIX_OPENSSL/include"
   1495      AC_CHECK_LIB(crypto, HMAC_Init_ex,[
   1496        HAVECRYPTO="yes"
   1497        LIBS="-lcrypto $LIBS"], [
   1498        LDFLAGS="$CLEANLDFLAGS"
   1499        CPPFLAGS="$CLEANCPPFLAGS"
   1500        LIBS="$CLEANLIBS"
   1501        ])
   1502     ])
   1503 
   1504 
   1505   if test X"$HAVECRYPTO" = X"yes"; then
   1506      AC_MSG_CHECKING([OpenSSL linking without -ldl])
   1507      saved_libs=$LIBS
   1508      AC_TRY_LINK(
   1509         [
   1510           #include <openssl/evp.h>
   1511         ],
   1512         [
   1513           SSLeay_add_all_algorithms();
   1514         ],
   1515         [
   1516           AC_MSG_RESULT(yes)
   1517           LIBS="$saved_libs"
   1518         ],
   1519         [
   1520           AC_MSG_RESULT(no)
   1521           AC_MSG_CHECKING([OpenSSL linking with -ldl])
   1522           LIBS="-ldl $LIBS"
   1523           AC_TRY_LINK(
   1524           [
   1525             #include <openssl/evp.h>
   1526           ],
   1527           [
   1528             SSLeay_add_all_algorithms();
   1529           ],
   1530           [
   1531             AC_MSG_RESULT(yes)
   1532             LIBS="$saved_libs -ldl"
   1533           ],
   1534           [
   1535             AC_MSG_RESULT(no)
   1536             LIBS="$saved_libs"
   1537           ]
   1538           )
   1539 
   1540         ]
   1541      )
   1542 
   1543   fi
   1544 
   1545   if test X"$HAVECRYPTO" = X"yes"; then
   1546     dnl This is only reasonable to do if crypto actually is there: check for
   1547     dnl SSL libs NOTE: it is important to do this AFTER the crypto lib
   1548 
   1549     AC_CHECK_LIB(ssl, SSL_connect)
   1550 
   1551     if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
   1552         dnl we didn't find the SSL lib, try the RSAglue/rsaref stuff
   1553         AC_MSG_CHECKING(for ssl with RSAglue/rsaref libs in use);
   1554         OLIBS=$LIBS
   1555         LIBS="-lRSAglue -lrsaref $LIBS"
   1556         AC_CHECK_LIB(ssl, SSL_connect)
   1557         if test "$ac_cv_lib_ssl_SSL_connect" != yes; then
   1558             dnl still no SSL_connect
   1559             AC_MSG_RESULT(no)
   1560             LIBS=$OLIBS
   1561         else
   1562             AC_MSG_RESULT(yes)
   1563         fi
   1564 
   1565     else
   1566 
   1567       dnl Have the libraries--check for OpenSSL headers
   1568       AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \
   1569                        openssl/pem.h openssl/ssl.h openssl/err.h,
   1570         curl_ssl_msg="enabled (OpenSSL)"
   1571         OPENSSL_ENABLED=1
   1572         AC_DEFINE(USE_OPENSSL, 1, [if OpenSSL is in use]))
   1573 
   1574       if test $ac_cv_header_openssl_x509_h = no; then
   1575         dnl we don't use the "action" part of the AC_CHECK_HEADERS macro
   1576         dnl since 'err.h' might in fact find a krb4 header with the same
   1577         dnl name
   1578         AC_CHECK_HEADERS(x509.h rsa.h crypto.h pem.h ssl.h err.h)
   1579 
   1580         if test $ac_cv_header_x509_h = yes &&
   1581            test $ac_cv_header_crypto_h = yes &&
   1582            test $ac_cv_header_ssl_h = yes; then
   1583           dnl three matches
   1584           curl_ssl_msg="enabled (OpenSSL)"
   1585           OPENSSL_ENABLED=1
   1586         fi
   1587       fi
   1588     fi
   1589 
   1590     if test X"$OPENSSL_ENABLED" = X"1"; then
   1591        dnl is there a pkcs12.h header present?
   1592        AC_CHECK_HEADERS(openssl/pkcs12.h)
   1593     else
   1594        LIBS="$CLEANLIBS"
   1595     fi
   1596 
   1597     if test X"$OPT_SSL" != Xoff &&
   1598        test "$OPENSSL_ENABLED" != "1"; then
   1599       AC_MSG_ERROR([OpenSSL libs and/or directories were not found where specified!])
   1600     fi
   1601   fi
   1602 
   1603   if test X"$OPENSSL_ENABLED" = X"1"; then
   1604     dnl If the ENGINE library seems to be around, check for the OpenSSL engine
   1605     dnl stuff, it is kind of "separated" from the main SSL check
   1606     AC_CHECK_FUNC(ENGINE_init,
   1607               [
   1608                 AC_CHECK_HEADERS(openssl/engine.h)
   1609                 AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
   1610               ])
   1611 
   1612     dnl These can only exist if OpenSSL exists
   1613     dnl Older versions of Cyassl (some time before 2.9.4) don't have
   1614     dnl SSL_get_shutdown (but this check won't actually detect it there
   1615     dnl as it's a macro that needs the header files be included)
   1616 
   1617     AC_CHECK_FUNCS( RAND_status \
   1618                     RAND_screen \
   1619                     RAND_egd \
   1620                     ENGINE_cleanup \
   1621                     CRYPTO_cleanup_all_ex_data \
   1622                     SSL_get_shutdown \
   1623                     SSLv2_client_method )
   1624 
   1625     AC_MSG_CHECKING([for BoringSSL])
   1626     AC_COMPILE_IFELSE([
   1627         AC_LANG_PROGRAM([[
   1628                 #include <openssl/base.h>
   1629                 ]],[[
   1630                 #ifndef OPENSSL_IS_BORINGSSL
   1631                 #error not boringssl
   1632                 #endif
   1633        ]])
   1634     ],[
   1635         AC_MSG_RESULT([yes])
   1636         AC_DEFINE_UNQUOTED(HAVE_BORINGSSL, 1,
   1637                            [Define to 1 if using BoringSSL.])
   1638         curl_ssl_msg="enabled (BoringSSL)"
   1639     ],[
   1640         AC_MSG_RESULT([no])
   1641     ])
   1642 
   1643     AC_MSG_CHECKING([for libressl])
   1644     AC_COMPILE_IFELSE([
   1645       AC_LANG_PROGRAM([[
   1646 #include <openssl/opensslv.h>
   1647       ]],[[
   1648         int dummy = LIBRESSL_VERSION_NUMBER;
   1649       ]])
   1650     ],[
   1651       AC_MSG_RESULT([yes])
   1652       AC_DEFINE_UNQUOTED(HAVE_LIBRESSL, 1,
   1653         [Define to 1 if using libressl.])
   1654       curl_ssl_msg="enabled (libressl)"
   1655     ],[
   1656       AC_MSG_RESULT([no])
   1657     ])
   1658   fi
   1659 
   1660   if test "$OPENSSL_ENABLED" = "1"; then
   1661     if test -n "$LIB_OPENSSL"; then
   1662        dnl when the ssl shared libs were found in a path that the run-time
   1663        dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
   1664        dnl to prevent further configure tests to fail due to this
   1665        if test "x$cross_compiling" != "xyes"; then
   1666          LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_OPENSSL"
   1667          export LD_LIBRARY_PATH
   1668          AC_MSG_NOTICE([Added $LIB_OPENSSL to LD_LIBRARY_PATH])
   1669        fi
   1670     fi
   1671     CURL_CHECK_OPENSSL_API
   1672   fi
   1673 
   1674 fi
   1675 
   1676 dnl **********************************************************************
   1677 dnl Check for the random seed preferences
   1678 dnl **********************************************************************
   1679 
   1680 if test X"$OPENSSL_ENABLED" = X"1"; then
   1681   AC_ARG_WITH(egd-socket,
   1682   AC_HELP_STRING([--with-egd-socket=FILE],
   1683                  [Entropy Gathering Daemon socket pathname]),
   1684       [ EGD_SOCKET="$withval" ]
   1685   )
   1686   if test -n "$EGD_SOCKET" ; then
   1687           AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET",
   1688           [your Entropy Gathering Daemon socket pathname] )
   1689   fi
   1690 
   1691   dnl Check for user-specified random device
   1692   AC_ARG_WITH(random,
   1693   AC_HELP_STRING([--with-random=FILE],
   1694                  [read randomness from FILE (default=/dev/urandom)]),
   1695       [ RANDOM_FILE="$withval" ],
   1696       [
   1697           if test x$cross_compiling != xyes; then
   1698             dnl Check for random device
   1699             AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
   1700           else
   1701             AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
   1702           fi
   1703       ]
   1704   )
   1705   if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno ; then
   1706           AC_SUBST(RANDOM_FILE)
   1707           AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
   1708           [a suitable file to read random data from])
   1709   fi
   1710 fi
   1711 
   1712 dnl ---
   1713 dnl We require OpenSSL with SRP support.
   1714 dnl ---
   1715 if test "$OPENSSL_ENABLED" = "1"; then
   1716   AC_CHECK_LIB(crypto, SRP_Calc_client_key,
   1717    [
   1718      AC_DEFINE(HAVE_OPENSSL_SRP, 1, [if you have the function SRP_Calc_client_key])
   1719      AC_SUBST(HAVE_OPENSSL_SRP, [1])
   1720    ])
   1721 fi
   1722 
   1723 dnl ----------------------------------------------------
   1724 dnl check for GnuTLS
   1725 dnl ----------------------------------------------------
   1726 
   1727 dnl Default to compiler & linker defaults for GnuTLS files & libraries.
   1728 OPT_GNUTLS=no
   1729 
   1730 AC_ARG_WITH(gnutls,dnl
   1731 AC_HELP_STRING([--with-gnutls=PATH],[where to look for GnuTLS, PATH points to the installation root])
   1732 AC_HELP_STRING([--without-gnutls], [disable GnuTLS detection]),
   1733   OPT_GNUTLS=$withval)
   1734 
   1735 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   1736 
   1737   if test X"$OPT_GNUTLS" != Xno; then
   1738 
   1739     addld=""
   1740     addlib=""
   1741     gtlslib=""
   1742     version=""
   1743     addcflags=""
   1744 
   1745     if test "x$OPT_GNUTLS" = "xyes"; then
   1746       dnl this is with no partiular path given
   1747       CURL_CHECK_PKGCONFIG(gnutls)
   1748 
   1749       if test "$PKGCONFIG" != "no" ; then
   1750         addlib=`$PKGCONFIG --libs-only-l gnutls`
   1751         addld=`$PKGCONFIG --libs-only-L gnutls`
   1752         addcflags=`$PKGCONFIG --cflags-only-I gnutls`
   1753         version=`$PKGCONFIG --modversion gnutls`
   1754         gtlslib=`echo $addld | $SED -e 's/-L//'`
   1755       else
   1756         dnl without pkg-config, we try libgnutls-config as that was how it
   1757         dnl used to be done
   1758         check=`libgnutls-config --version 2>/dev/null`
   1759         if test -n "$check"; then
   1760           addlib=`libgnutls-config --libs`
   1761           addcflags=`libgnutls-config --cflags`
   1762           version=`libgnutls-config --version`
   1763           gtlslib=`libgnutls-config --prefix`/lib$libsuff
   1764         fi
   1765       fi
   1766     else
   1767       dnl this is with a given path, first check if there's a libgnutls-config
   1768       dnl there and if not, make an educated guess
   1769       cfg=$OPT_GNUTLS/bin/libgnutls-config
   1770       check=`$cfg --version 2>/dev/null`
   1771       if test -n "$check"; then
   1772         addlib=`$cfg --libs`
   1773         addcflags=`$cfg --cflags`
   1774         version=`$cfg --version`
   1775         gtlslib=`$cfg --prefix`/lib$libsuff
   1776       else
   1777         dnl without pkg-config and libgnutls-config, we guess a lot!
   1778         addlib=-lgnutls
   1779         addld=-L$OPT_GNUTLS/lib$libsuff
   1780         addcflags=-I$OPT_GNUTLS/include
   1781         version="" # we just don't know
   1782         gtlslib=$OPT_GNUTLS/lib$libsuff
   1783       fi
   1784     fi
   1785 
   1786     if test -z "$version"; then
   1787       dnl lots of efforts, still no go
   1788       version="unknown"
   1789     fi
   1790 
   1791     if test -n "$addlib"; then
   1792 
   1793       CLEANLIBS="$LIBS"
   1794       CLEANCPPFLAGS="$CPPFLAGS"
   1795       CLEANLDFLAGS="$LDFLAGS"
   1796 
   1797       LIBS="$addlib $LIBS"
   1798       LDFLAGS="$LDFLAGS $addld"
   1799       if test "$addcflags" != "-I/usr/include"; then
   1800          CPPFLAGS="$CPPFLAGS $addcflags"
   1801       fi
   1802 
   1803       AC_CHECK_LIB(gnutls, gnutls_check_version,
   1804        [
   1805        AC_DEFINE(USE_GNUTLS, 1, [if GnuTLS is enabled])
   1806        AC_SUBST(USE_GNUTLS, [1])
   1807        GNUTLS_ENABLED=1
   1808        USE_GNUTLS="yes"
   1809        curl_ssl_msg="enabled (GnuTLS)"
   1810        ],
   1811        [
   1812          LIBS="$CLEANLIBS"
   1813          CPPFLAGS="$CLEANCPPFLAGS"
   1814        ])
   1815 
   1816       if test "x$USE_GNUTLS" = "xyes"; then
   1817         AC_MSG_NOTICE([detected GnuTLS version $version])
   1818 
   1819         if test -n "$gtlslib"; then
   1820           dnl when shared libs were found in a path that the run-time
   1821           dnl linker doesn't search through, we need to add it to
   1822           dnl LD_LIBRARY_PATH to prevent further configure tests to fail
   1823           dnl due to this
   1824           if test "x$cross_compiling" != "xyes"; then
   1825             LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$gtlslib"
   1826             export LD_LIBRARY_PATH
   1827             AC_MSG_NOTICE([Added $gtlslib to LD_LIBRARY_PATH])
   1828           fi
   1829         fi
   1830         AC_CHECK_FUNCS(gnutls_certificate_set_x509_key_file2)
   1831       fi
   1832 
   1833     fi
   1834 
   1835   fi dnl GNUTLS not disabled
   1836 
   1837 fi
   1838 
   1839 dnl ---
   1840 dnl Check which crypto backend GnuTLS uses
   1841 dnl ---
   1842 
   1843 if test "$GNUTLS_ENABLED" = "1"; then
   1844   USE_GNUTLS_NETTLE=
   1845   # First check if we can detect either crypto library via transitive linking
   1846   AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
   1847   if test "$USE_GNUTLS_NETTLE" = ""; then
   1848     AC_CHECK_LIB(gnutls, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
   1849   fi
   1850   # If not, try linking directly to both of them to see if they are available
   1851   if test "$USE_GNUTLS_NETTLE" = ""; then
   1852     AC_CHECK_LIB(nettle, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
   1853   fi
   1854   if test "$USE_GNUTLS_NETTLE" = ""; then
   1855     AC_CHECK_LIB(gcrypt, gcry_control, [ USE_GNUTLS_NETTLE=0 ])
   1856   fi
   1857   if test "$USE_GNUTLS_NETTLE" = ""; then
   1858     AC_MSG_ERROR([GnuTLS found, but neither gcrypt nor nettle found])
   1859   fi
   1860   if test "$USE_GNUTLS_NETTLE" = "1"; then
   1861     AC_DEFINE(USE_GNUTLS_NETTLE, 1, [if GnuTLS uses nettle as crypto backend])
   1862     AC_SUBST(USE_GNUTLS_NETTLE, [1])
   1863     LIBS="-lnettle $LIBS"
   1864   else
   1865     LIBS="-lgcrypt $LIBS"
   1866   fi
   1867 fi
   1868 
   1869 dnl ---
   1870 dnl We require GnuTLS with SRP support.
   1871 dnl ---
   1872 if test "$GNUTLS_ENABLED" = "1"; then
   1873   AC_CHECK_LIB(gnutls, gnutls_srp_verifier,
   1874    [
   1875      AC_DEFINE(HAVE_GNUTLS_SRP, 1, [if you have the function gnutls_srp_verifier])
   1876      AC_SUBST(HAVE_GNUTLS_SRP, [1])
   1877    ])
   1878 fi
   1879 
   1880 dnl ----------------------------------------------------
   1881 dnl check for PolarSSL
   1882 dnl ----------------------------------------------------
   1883 
   1884 dnl Default to compiler & linker defaults for PolarSSL files & libraries.
   1885 OPT_POLARSSL=no
   1886 
   1887 _cppflags=$CPPFLAGS
   1888 _ldflags=$LDFLAGS
   1889 AC_ARG_WITH(polarssl,dnl
   1890 AC_HELP_STRING([--with-polarssl=PATH],[where to look for PolarSSL, PATH points to the installation root])
   1891 AC_HELP_STRING([--without-polarssl], [disable PolarSSL detection]),
   1892   OPT_POLARSSL=$withval)
   1893 
   1894 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   1895 
   1896   if test X"$OPT_POLARSSL" != Xno; then
   1897 
   1898     if test "$OPT_POLARSSL" = "yes"; then
   1899       OPT_POLARSSL=""
   1900     fi
   1901 
   1902     if test -z "$OPT_POLARSSL" ; then
   1903       dnl check for lib first without setting any new path
   1904 
   1905       AC_CHECK_LIB(polarssl, havege_init,
   1906       dnl libpolarssl found, set the variable
   1907        [
   1908          AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
   1909          AC_SUBST(USE_POLARSSL, [1])
   1910          POLARSSL_ENABLED=1
   1911          USE_POLARSSL="yes"
   1912          curl_ssl_msg="enabled (PolarSSL)"
   1913         ])
   1914     fi
   1915 
   1916     addld=""
   1917     addlib=""
   1918     addcflags=""
   1919     polarssllib=""
   1920 
   1921     if test "x$USE_POLARSSL" != "xyes"; then
   1922       dnl add the path and test again
   1923       addld=-L$OPT_POLARSSL/lib$libsuff
   1924       addcflags=-I$OPT_POLARSSL/include
   1925       polarssllib=$OPT_POLARSSL/lib$libsuff
   1926 
   1927       LDFLAGS="$LDFLAGS $addld"
   1928       if test "$addcflags" != "-I/usr/include"; then
   1929          CPPFLAGS="$CPPFLAGS $addcflags"
   1930       fi
   1931 
   1932       AC_CHECK_LIB(polarssl, ssl_init,
   1933        [
   1934        AC_DEFINE(USE_POLARSSL, 1, [if PolarSSL is enabled])
   1935        AC_SUBST(USE_POLARSSL, [1])
   1936        POLARSSL_ENABLED=1
   1937        USE_POLARSSL="yes"
   1938        curl_ssl_msg="enabled (PolarSSL)"
   1939        ],
   1940        [
   1941          CPPFLAGS=$_cppflags
   1942          LDFLAGS=$_ldflags
   1943        ])
   1944     fi
   1945 
   1946     if test "x$USE_POLARSSL" = "xyes"; then
   1947       AC_MSG_NOTICE([detected PolarSSL])
   1948 
   1949       LIBS="-lpolarssl $LIBS"
   1950 
   1951       if test -n "$polarssllib"; then
   1952         dnl when shared libs were found in a path that the run-time
   1953         dnl linker doesn't search through, we need to add it to
   1954         dnl LD_LIBRARY_PATH to prevent further configure tests to fail
   1955         dnl due to this
   1956         if test "x$cross_compiling" != "xyes"; then
   1957           LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$polarssllib"
   1958           export LD_LIBRARY_PATH
   1959           AC_MSG_NOTICE([Added $polarssllib to LD_LIBRARY_PATH])
   1960         fi
   1961       fi
   1962     fi
   1963 
   1964   fi dnl PolarSSL not disabled
   1965 
   1966 fi
   1967 
   1968 dnl ----------------------------------------------------
   1969 dnl check for mbedTLS
   1970 dnl ----------------------------------------------------
   1971 
   1972 OPT_MBEDTLS=no
   1973 
   1974 _cppflags=$CPPFLAGS
   1975 _ldflags=$LDFLAGS
   1976 AC_ARG_WITH(mbedtls,dnl
   1977 AC_HELP_STRING([--with-mbedtls=PATH],[where to look for mbedTLS, PATH points to the installation root])
   1978 AC_HELP_STRING([--without-mbedtls], [disable mbedTLS detection]),
   1979   OPT_MBEDTLS=$withval)
   1980 
   1981 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   1982 
   1983   if test X"$OPT_MBEDTLS" != Xno; then
   1984 
   1985     if test "$OPT_MBEDTLS" = "yes"; then
   1986       OPT_MBEDTLS=""
   1987     fi
   1988 
   1989     if test -z "$OPT_MBEDTLS" ; then
   1990       dnl check for lib first without setting any new path
   1991 
   1992       AC_CHECK_LIB(mbedtls, mbedtls_havege_init,
   1993       dnl libmbedtls found, set the variable
   1994        [
   1995          AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
   1996          AC_SUBST(USE_MBEDTLS, [1])
   1997          MBEDTLS_ENABLED=1
   1998          USE_MBEDTLS="yes"
   1999          curl_ssl_msg="enabled (mbedTLS)"
   2000         ], [], -lmbedx509 -lmbedcrypto)
   2001     fi
   2002 
   2003     addld=""
   2004     addlib=""
   2005     addcflags=""
   2006     mbedtlslib=""
   2007 
   2008     if test "x$USE_MBEDTLS" != "xyes"; then
   2009       dnl add the path and test again
   2010       addld=-L$OPT_MBEDTLS/lib$libsuff
   2011       addcflags=-I$OPT_MBEDTLS/include
   2012       mbedtlslib=$OPT_MBEDTLS/lib$libsuff
   2013 
   2014       LDFLAGS="$LDFLAGS $addld"
   2015       if test "$addcflags" != "-I/usr/include"; then
   2016          CPPFLAGS="$CPPFLAGS $addcflags"
   2017       fi
   2018 
   2019       AC_CHECK_LIB(mbedtls, mbedtls_ssl_init,
   2020        [
   2021        AC_DEFINE(USE_MBEDTLS, 1, [if mbedTLS is enabled])
   2022        AC_SUBST(USE_MBEDTLS, [1])
   2023        MBEDTLS_ENABLED=1
   2024        USE_MBEDTLS="yes"
   2025        curl_ssl_msg="enabled (mbedTLS)"
   2026        ],
   2027        [
   2028          CPPFLAGS=$_cppflags
   2029          LDFLAGS=$_ldflags
   2030        ], -lmbedx509 -lmbedcrypto)
   2031     fi
   2032 
   2033     if test "x$USE_MBEDTLS" = "xyes"; then
   2034       AC_MSG_NOTICE([detected mbedTLS])
   2035 
   2036       LIBS="-lmbedtls -lmbedx509 -lmbedcrypto $LIBS"
   2037 
   2038       if test -n "$mbedtlslib"; then
   2039         dnl when shared libs were found in a path that the run-time
   2040         dnl linker doesn't search through, we need to add it to
   2041         dnl LD_LIBRARY_PATH to prevent further configure tests to fail
   2042         dnl due to this
   2043         if test "x$cross_compiling" != "xyes"; then
   2044           LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$mbedtlslib"
   2045           export LD_LIBRARY_PATH
   2046           AC_MSG_NOTICE([Added $mbedtlslib to LD_LIBRARY_PATH])
   2047         fi
   2048       fi
   2049     fi
   2050 
   2051   fi dnl mbedTLS not disabled
   2052 
   2053 fi
   2054 
   2055 dnl ----------------------------------------------------
   2056 dnl check for CyaSSL
   2057 dnl ----------------------------------------------------
   2058 
   2059 dnl Default to compiler & linker defaults for CyaSSL files & libraries.
   2060 OPT_CYASSL=no
   2061 
   2062 _cppflags=$CPPFLAGS
   2063 _ldflags=$LDFLAGS
   2064 AC_ARG_WITH(cyassl,dnl
   2065 AC_HELP_STRING([--with-cyassl=PATH],[where to look for CyaSSL, PATH points to the installation root (default: system lib default)])
   2066 AC_HELP_STRING([--without-cyassl], [disable CyaSSL detection]),
   2067   OPT_CYASSL=$withval)
   2068 
   2069 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   2070 
   2071   if test X"$OPT_CYASSL" != Xno; then
   2072 
   2073     if test "$OPT_CYASSL" = "yes"; then
   2074       OPT_CYASSL=""
   2075     fi
   2076 
   2077     dnl This should be reworked to use pkg-config instead
   2078 
   2079     cyassllibname=cyassl
   2080 
   2081     if test -z "$OPT_CYASSL" ; then
   2082       dnl check for lib in system default first
   2083 
   2084       AC_CHECK_LIB(cyassl, CyaSSL_Init,
   2085       dnl libcyassl found, set the variable
   2086        [
   2087          AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
   2088          AC_SUBST(USE_CYASSL, [1])
   2089          CYASSL_ENABLED=1
   2090          USE_CYASSL="yes"
   2091          curl_ssl_msg="enabled (CyaSSL)"
   2092         ])
   2093     fi
   2094 
   2095     addld=""
   2096     addlib=""
   2097     addcflags=""
   2098     cyassllib=""
   2099 
   2100     if test "x$USE_CYASSL" != "xyes"; then
   2101       dnl add the path and test again
   2102       addld=-L$OPT_CYASSL/lib$libsuff
   2103       addcflags=-I$OPT_CYASSL/include
   2104       cyassllib=$OPT_CYASSL/lib$libsuff
   2105 
   2106       LDFLAGS="$LDFLAGS $addld"
   2107       if test "$addcflags" != "-I/usr/include"; then
   2108          CPPFLAGS="$CPPFLAGS $addcflags"
   2109       fi
   2110 
   2111       AC_CHECK_LIB(cyassl, CyaSSL_Init,
   2112        [
   2113        AC_DEFINE(USE_CYASSL, 1, [if CyaSSL is enabled])
   2114        AC_SUBST(USE_CYASSL, [1])
   2115        CYASSL_ENABLED=1
   2116        USE_CYASSL="yes"
   2117        curl_ssl_msg="enabled (CyaSSL)"
   2118        ],
   2119        [
   2120          CPPFLAGS=$_cppflags
   2121          LDFLAGS=$_ldflags
   2122          cyassllib=""
   2123        ])
   2124     fi
   2125 
   2126     addld=""
   2127     addlib=""
   2128     addcflags=""
   2129 
   2130     if test "x$USE_CYASSL" != "xyes"; then
   2131       dnl libcyassl renamed to libwolfssl as of 3.4.0
   2132       addld=-L$OPT_CYASSL/lib$libsuff
   2133       addcflags=-I$OPT_CYASSL/include
   2134       cyassllib=$OPT_CYASSL/lib$libsuff
   2135 
   2136       LDFLAGS="$LDFLAGS $addld"
   2137       if test "$addcflags" != "-I/usr/include"; then
   2138          CPPFLAGS="$CPPFLAGS $addcflags"
   2139       fi
   2140 
   2141       cyassllibname=wolfssl
   2142       my_ac_save_LIBS="$LIBS"
   2143       LIBS="-l$cyassllibname -lm $LIBS"
   2144 
   2145       AC_MSG_CHECKING([for CyaSSL_Init in -lwolfssl])
   2146       AC_LINK_IFELSE([
   2147 	AC_LANG_PROGRAM([[
   2148 /* These aren't needed for detection and confuse WolfSSL.
   2149    They are set up properly later if it is detected.  */
   2150 #undef SIZEOF_LONG
   2151 #undef SIZEOF_LONG_LONG
   2152 #include <cyassl/ssl.h>
   2153 	]],[[
   2154 	  return CyaSSL_Init();
   2155 	]])
   2156       ],[
   2157          AC_MSG_RESULT(yes)
   2158          AC_DEFINE(USE_CYASSL, 1, [if CyaSSL/WolfSSL is enabled])
   2159          AC_SUBST(USE_CYASSL, [1])
   2160          CYASSL_ENABLED=1
   2161          USE_CYASSL="yes"
   2162          curl_ssl_msg="enabled (WolfSSL)"
   2163        ],
   2164        [
   2165          AC_MSG_RESULT(no)
   2166          CPPFLAGS=$_cppflags
   2167          LDFLAGS=$_ldflags
   2168          cyassllib=""
   2169        ])
   2170       LIBS="$my_ac_save_LIBS"
   2171     fi
   2172 
   2173     if test "x$USE_CYASSL" = "xyes"; then
   2174       AC_MSG_NOTICE([detected $cyassllibname])
   2175 
   2176       dnl cyassl/ctaocrypt/types.h needs SIZEOF_LONG_LONG defined!
   2177       AC_CHECK_SIZEOF(long long)
   2178 
   2179       dnl Versions since at least 2.6.0 may have options.h
   2180       AC_CHECK_HEADERS(cyassl/options.h)
   2181 
   2182       dnl Versions since at least 2.9.4 renamed error.h to error-ssl.h
   2183       AC_CHECK_HEADERS(cyassl/error-ssl.h)
   2184 
   2185       LIBS="-l$cyassllibname -lm $LIBS"
   2186 
   2187       if test "x$cyassllibname" = "xwolfssl"; then
   2188         dnl Recent WolfSSL versions build without SSLv3 by default
   2189         dnl WolfSSL needs configure --enable-opensslextra to have *get_peer*
   2190         AC_CHECK_FUNCS(wolfSSLv3_client_method \
   2191                        wolfSSL_CTX_UseSupportedCurve \
   2192                        wolfSSL_get_peer_certificate \
   2193                        wolfSSL_UseALPN)
   2194       else
   2195         dnl Cyassl needs configure --enable-opensslextra to have *get_peer*
   2196         AC_CHECK_FUNCS(CyaSSL_CTX_UseSupportedCurve \
   2197                        CyaSSL_get_peer_certificate)
   2198       fi
   2199 
   2200       if test -n "$cyassllib"; then
   2201         dnl when shared libs were found in a path that the run-time
   2202         dnl linker doesn't search through, we need to add it to
   2203         dnl LD_LIBRARY_PATH to prevent further configure tests to fail
   2204         dnl due to this
   2205         if test "x$cross_compiling" != "xyes"; then
   2206           LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$cyassllib"
   2207           export LD_LIBRARY_PATH
   2208           AC_MSG_NOTICE([Added $cyassllib to LD_LIBRARY_PATH])
   2209         fi
   2210       fi
   2211 
   2212     fi
   2213 
   2214   fi dnl CyaSSL not disabled
   2215 
   2216 fi
   2217 
   2218 dnl ----------------------------------------------------
   2219 dnl NSS. Only check if GnuTLS and OpenSSL are not enabled
   2220 dnl ----------------------------------------------------
   2221 
   2222 dnl Default to compiler & linker defaults for NSS files & libraries.
   2223 OPT_NSS=no
   2224 
   2225 AC_ARG_WITH(nss,dnl
   2226 AC_HELP_STRING([--with-nss=PATH],[where to look for NSS, PATH points to the installation root])
   2227 AC_HELP_STRING([--without-nss], [disable NSS detection]),
   2228   OPT_NSS=$withval)
   2229 
   2230 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   2231 
   2232   if test X"$OPT_NSS" != Xno; then
   2233 
   2234     addld=""
   2235     addlib=""
   2236     addcflags=""
   2237     nssprefix=""
   2238     version=""
   2239 
   2240     if test "x$OPT_NSS" = "xyes"; then
   2241 
   2242       CURL_CHECK_PKGCONFIG(nss)
   2243 
   2244       if test "$PKGCONFIG" != "no" ; then
   2245         addlib=`$PKGCONFIG --libs nss`
   2246         addcflags=`$PKGCONFIG --cflags nss`
   2247         version=`$PKGCONFIG --modversion nss`
   2248         nssprefix=`$PKGCONFIG --variable=prefix nss`
   2249       else
   2250         dnl Without pkg-config, we check for nss-config
   2251 
   2252         check=`nss-config --version 2>/dev/null`
   2253         if test -n "$check"; then
   2254           addlib=`nss-config --libs`
   2255           addcflags=`nss-config --cflags`
   2256           version=`nss-config --version`
   2257           nssprefix=`nss-config --prefix`
   2258         else
   2259           addlib="-lnss3"
   2260           addcflags=""
   2261           version="unknown"
   2262         fi
   2263       fi
   2264     else
   2265       NSS_PCDIR="$OPT_NSS/lib/pkgconfig"
   2266       if test -f "$NSS_PCDIR/nss.pc"; then
   2267         CURL_CHECK_PKGCONFIG(nss, [$NSS_PCDIR])
   2268         if test "$PKGCONFIG" != "no" ; then
   2269           addld=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-L nss`
   2270           addlib=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --libs-only-l nss`
   2271           addcflags=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --cflags nss`
   2272           version=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --modversion nss`
   2273           nssprefix=`CURL_EXPORT_PCDIR([$NSS_PCDIR]) $PKGCONFIG --variable=prefix nss`
   2274         fi
   2275       fi
   2276     fi
   2277 
   2278     if test -z "$addlib"; then
   2279       # Without pkg-config, we'll kludge in some defaults
   2280       AC_MSG_WARN([Using hard-wired libraries and compilation flags for NSS.])
   2281       addld="-L$OPT_NSS/lib"
   2282       addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
   2283       addcflags="-I$OPT_NSS/include"
   2284       version="unknown"
   2285       nssprefix=$OPT_NSS
   2286     fi
   2287 
   2288     CLEANLDFLAGS="$LDFLAGS"
   2289     CLEANLIBS="$LIBS"
   2290     CLEANCPPFLAGS="$CPPFLAGS"
   2291 
   2292     LDFLAGS="$addld $LDFLAGS"
   2293     LIBS="$addlib $LIBS"
   2294     if test "$addcflags" != "-I/usr/include"; then
   2295        CPPFLAGS="$CPPFLAGS $addcflags"
   2296     fi
   2297 
   2298     dnl The function SSL_VersionRangeSet() is needed to enable TLS > 1.0
   2299     AC_CHECK_LIB(nss3, SSL_VersionRangeSet,
   2300      [
   2301      AC_DEFINE(USE_NSS, 1, [if NSS is enabled])
   2302      AC_SUBST(USE_NSS, [1])
   2303      USE_NSS="yes"
   2304      NSS_ENABLED=1
   2305      curl_ssl_msg="enabled (NSS)"
   2306      ],
   2307      [
   2308        LDFLAGS="$CLEANLDFLAGS"
   2309        LIBS="$CLEANLIBS"
   2310        CPPFLAGS="$CLEANCPPFLAGS"
   2311      ])
   2312 
   2313     if test "x$USE_NSS" = "xyes"; then
   2314       AC_MSG_NOTICE([detected NSS version $version])
   2315 
   2316       dnl needed when linking the curl tool without USE_EXPLICIT_LIB_DEPS
   2317       NSS_LIBS=$addlib
   2318       AC_SUBST([NSS_LIBS])
   2319 
   2320       dnl when shared libs were found in a path that the run-time
   2321       dnl linker doesn't search through, we need to add it to
   2322       dnl LD_LIBRARY_PATH to prevent further configure tests to fail
   2323       dnl due to this
   2324       if test "x$cross_compiling" != "xyes"; then
   2325         LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$nssprefix/lib$libsuff"
   2326         export LD_LIBRARY_PATH
   2327         AC_MSG_NOTICE([Added $nssprefix/lib$libsuff to LD_LIBRARY_PATH])
   2328       fi
   2329 
   2330     fi dnl NSS found
   2331 
   2332   fi dnl NSS not disabled
   2333 
   2334 fi dnl curl_ssl_msg = init_ssl_msg
   2335 
   2336 OPT_AXTLS=off
   2337 
   2338 AC_ARG_WITH(axtls,dnl
   2339 AC_HELP_STRING([--with-axtls=PATH],[Where to look for axTLS, PATH points to the axTLS installation prefix (default: /usr/local).  Ignored if another SSL engine is selected.])
   2340 AC_HELP_STRING([--without-axtls], [disable axTLS]),
   2341   OPT_AXTLS=$withval)
   2342 
   2343 if test "$curl_ssl_msg" = "$init_ssl_msg"; then
   2344   if test X"$OPT_AXTLS" != Xno; then
   2345     dnl backup the pre-axtls variables
   2346     CLEANLDFLAGS="$LDFLAGS"
   2347     CLEANCPPFLAGS="$CPPFLAGS"
   2348     CLEANLIBS="$LIBS"
   2349 
   2350     case "$OPT_AXTLS" in
   2351     yes)
   2352       dnl --with-axtls (without path) used
   2353       PREFIX_AXTLS=/usr/local
   2354       LIB_AXTLS="$PREFIX_AXTLS/lib"
   2355       LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
   2356       CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
   2357       ;;
   2358     off)
   2359       dnl no --with-axtls option given, just check default places
   2360       PREFIX_AXTLS=
   2361       ;;
   2362     *)
   2363       dnl check the given --with-axtls spot
   2364       PREFIX_AXTLS=$OPT_AXTLS
   2365       LIB_AXTLS="$PREFIX_AXTLS/lib"
   2366       LDFLAGS="$LDFLAGS -L$LIB_AXTLS"
   2367       CPPFLAGS="$CPPFLAGS -I$PREFIX_AXTLS/include"
   2368       ;;
   2369     esac
   2370 
   2371     AC_CHECK_LIB(axtls, ssl_version,[
   2372       LIBS="-laxtls $LIBS"
   2373       AC_DEFINE(USE_AXTLS, 1, [if axTLS is enabled])
   2374       AC_SUBST(USE_AXTLS, [1])
   2375       AXTLS_ENABLED=1
   2376       USE_AXTLS="yes"
   2377       curl_ssl_msg="enabled (axTLS)"
   2378 
   2379       if test "x$cross_compiling" != "xyes"; then
   2380         LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIB_AXTLS"
   2381         export LD_LIBRARY_PATH
   2382         AC_MSG_NOTICE([Added $LIB_AXTLS to LD_LIBRARY_PATH])
   2383       fi
   2384       ],[
   2385       LDFLAGS="$CLEANLDFLAGS"
   2386       CPPFLAGS="$CLEANCPPFLAGS"
   2387       LIBS="$CLEANLIBS"
   2388     ])
   2389   fi
   2390 fi
   2391 
   2392 if test "x$OPENSSL_ENABLED$GNUTLS_ENABLED$NSS_ENABLED$POLARSSL_ENABLED$MBEDTLS_ENABLED$AXTLS_ENABLED$CYASSL_ENABLED$WINSSL_ENABLED$DARWINSSL_ENABLED" = "x"; then
   2393   AC_MSG_WARN([SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.])
   2394   AC_MSG_WARN([Use --with-ssl, --with-gnutls, --with-polarssl, --with-cyassl, --with-nss, --with-axtls, --with-winssl, or --with-darwinssl to address this.])
   2395 else
   2396   # SSL is enabled, genericly
   2397   AC_SUBST(SSL_ENABLED)
   2398   SSL_ENABLED="1"
   2399 fi
   2400 
   2401 dnl **********************************************************************
   2402 dnl Check for the CA bundle
   2403 dnl **********************************************************************
   2404 
   2405 CURL_CHECK_CA_BUNDLE
   2406 
   2407 dnl **********************************************************************
   2408 dnl Check for libpsl
   2409 dnl **********************************************************************
   2410 
   2411 AC_ARG_WITH(libpsl,
   2412            AS_HELP_STRING([--without-libpsl],
   2413            [disable support for libpsl cookie checking]),
   2414            with_libpsl=$withval,
   2415            with_libpsl=yes)
   2416 if test $with_libpsl != "no"; then
   2417   AC_SEARCH_LIBS(psl_builtin, psl,
   2418     [curl_psl_msg="yes";
   2419      AC_DEFINE([USE_LIBPSL], [1], [PSL support enabled])
   2420      ],
   2421     [curl_psl_msg="no      (libpsl not found)";
   2422      AC_MSG_WARN([libpsl was not found])
   2423      ]
   2424   )
   2425 fi
   2426 AM_CONDITIONAL([USE_LIBPSL], [test "$curl_psl_msg" = "yes"])
   2427 
   2428 dnl **********************************************************************
   2429 dnl Check for libmetalink
   2430 dnl **********************************************************************
   2431 
   2432 OPT_LIBMETALINK=no
   2433 
   2434 AC_ARG_WITH(libmetalink,dnl
   2435 AC_HELP_STRING([--with-libmetalink=PATH],[where to look for libmetalink, PATH points to the installation root])
   2436 AC_HELP_STRING([--without-libmetalink], [disable libmetalink detection]),
   2437   OPT_LIBMETALINK=$withval)
   2438 
   2439 if test X"$OPT_LIBMETALINK" != Xno; then
   2440 
   2441   addld=""
   2442   addlib=""
   2443   addcflags=""
   2444   version=""
   2445   libmetalinklib=""
   2446 
   2447   PKGTEST="no"
   2448   if test "x$OPT_LIBMETALINK" = "xyes"; then
   2449     dnl this is with no partiular path given
   2450     PKGTEST="yes"
   2451     CURL_CHECK_PKGCONFIG(libmetalink)
   2452   else
   2453     dnl When particular path is given, set PKG_CONFIG_LIBDIR using the path.
   2454     LIBMETALINK_PCDIR="$OPT_LIBMETALINK/lib/pkgconfig"
   2455     AC_MSG_NOTICE([PKG_CONFIG_LIBDIR will be set to "$LIBMETALINK_PCDIR"])
   2456     if test -f "$LIBMETALINK_PCDIR/libmetalink.pc"; then
   2457       PKGTEST="yes"
   2458     fi
   2459     if test "$PKGTEST" = "yes"; then
   2460       CURL_CHECK_PKGCONFIG(libmetalink, [$LIBMETALINK_PCDIR])
   2461     fi
   2462   fi
   2463   if test "$PKGTEST" = "yes" && test "$PKGCONFIG" != "no"; then
   2464     addlib=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
   2465       $PKGCONFIG --libs-only-l libmetalink`
   2466     addld=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
   2467       $PKGCONFIG --libs-only-L libmetalink`
   2468     addcflags=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
   2469       $PKGCONFIG --cflags-only-I libmetalink`
   2470     version=`CURL_EXPORT_PCDIR([$LIBMETALINK_PCDIR]) dnl
   2471       $PKGCONFIG --modversion libmetalink`
   2472     libmetalinklib=`echo $addld | $SED -e 's/-L//'`
   2473   fi
   2474   if test -n "$addlib"; then
   2475 
   2476     clean_CPPFLAGS="$CPPFLAGS"
   2477     clean_LDFLAGS="$LDFLAGS"
   2478     clean_LIBS="$LIBS"
   2479     CPPFLAGS="$addcflags $clean_CPPFLAGS"
   2480     LDFLAGS="$addld $clean_LDFLAGS"
   2481     LIBS="$addlib $clean_LIBS"
   2482     AC_MSG_CHECKING([if libmetalink is recent enough])
   2483     AC_LINK_IFELSE([
   2484       AC_LANG_PROGRAM([[
   2485 #       include <metalink/metalink.h>
   2486       ]],[[
   2487         if(0 != metalink_strerror(0)) /* added in 0.1.0 */
   2488           return 1;
   2489       ]])
   2490     ],[
   2491       AC_MSG_RESULT([yes ($version)])
   2492       want_metalink="yes"
   2493     ],[
   2494       AC_MSG_RESULT([no ($version)])
   2495       AC_MSG_NOTICE([libmetalink library defective or too old])
   2496       want_metalink="no"
   2497     ])
   2498     CPPFLAGS="$clean_CPPFLAGS"
   2499     LDFLAGS="$clean_LDFLAGS"
   2500     LIBS="$clean_LIBS"
   2501     if test "$want_metalink" = "yes"; then
   2502       dnl finally libmetalink will be used
   2503       AC_DEFINE(USE_METALINK, 1, [Define to enable metalink support])
   2504       LIBMETALINK_LIBS=$addlib
   2505       LIBMETALINK_LDFLAGS=$addld
   2506       LIBMETALINK_CPPFLAGS=$addcflags
   2507       AC_SUBST([LIBMETALINK_LIBS])
   2508       AC_SUBST([LIBMETALINK_LDFLAGS])
   2509       AC_SUBST([LIBMETALINK_CPPFLAGS])
   2510       curl_mtlnk_msg="enabled"
   2511     fi
   2512 
   2513   fi
   2514 fi
   2515 
   2516 dnl **********************************************************************
   2517 dnl Check for the presence of LIBSSH2 libraries and headers
   2518 dnl **********************************************************************
   2519 
   2520 dnl Default to compiler & linker defaults for LIBSSH2 files & libraries.
   2521 OPT_LIBSSH2=off
   2522 AC_ARG_WITH(libssh2,dnl
   2523 AC_HELP_STRING([--with-libssh2=PATH],[Where to look for libssh2, PATH points to the LIBSSH2 installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
   2524 AC_HELP_STRING([--without-libssh2], [disable LIBSSH2]),
   2525   OPT_LIBSSH2=$withval)
   2526 
   2527 if test X"$OPT_LIBSSH2" != Xno; then
   2528   dnl backup the pre-libssh2 variables
   2529   CLEANLDFLAGS="$LDFLAGS"
   2530   CLEANCPPFLAGS="$CPPFLAGS"
   2531   CLEANLIBS="$LIBS"
   2532 
   2533   case "$OPT_LIBSSH2" in
   2534   yes)
   2535     dnl --with-libssh2 (without path) used
   2536     CURL_CHECK_PKGCONFIG(libssh2)
   2537 
   2538     if test "$PKGCONFIG" != "no" ; then
   2539       LIB_SSH2=`$PKGCONFIG --libs-only-l libssh2`
   2540       LD_SSH2=`$PKGCONFIG --libs-only-L libssh2`
   2541       CPP_SSH2=`$PKGCONFIG --cflags-only-I libssh2`
   2542       version=`$PKGCONFIG --modversion libssh2`
   2543       DIR_SSH2=`echo $LD_SSH2 | $SED -e 's/-L//'`
   2544     fi
   2545 
   2546     ;;
   2547   off)
   2548     dnl no --with-libssh2 option given, just check default places
   2549     ;;
   2550   *)
   2551     dnl use the given --with-libssh2 spot
   2552     PREFIX_SSH2=$OPT_LIBSSH2
   2553     ;;
   2554   esac
   2555 
   2556   dnl if given with a prefix, we set -L and -I based on that
   2557   if test -n "$PREFIX_SSH2"; then
   2558     LIB_SSH2="-lssh2"
   2559     LD_SSH2=-L${PREFIX_SSH2}/lib$libsuff
   2560     CPP_SSH2=-I${PREFIX_SSH2}/include
   2561     DIR_SSH2=${PREFIX_SSH2}/lib$libsuff
   2562   fi
   2563 
   2564   LDFLAGS="$LDFLAGS $LD_SSH2"
   2565   CPPFLAGS="$CPPFLAGS $CPP_SSH2"
   2566   LIBS="$LIB_SSH2 $LIBS"
   2567 
   2568   AC_CHECK_LIB(ssh2, libssh2_channel_open_ex)
   2569 
   2570   AC_CHECK_HEADERS(libssh2.h,
   2571     curl_ssh_msg="enabled (libSSH2)"
   2572     LIBSSH2_ENABLED=1
   2573     AC_DEFINE(USE_LIBSSH2, 1, [if libSSH2 is in use])
   2574     AC_SUBST(USE_LIBSSH2, [1])
   2575   )
   2576 
   2577   if test X"$OPT_LIBSSH2" != Xoff &&
   2578      test "$LIBSSH2_ENABLED" != "1"; then
   2579     AC_MSG_ERROR([libSSH2 libs and/or directories were not found where specified!])
   2580   fi
   2581 
   2582   if test "$LIBSSH2_ENABLED" = "1"; then
   2583     if test -n "$DIR_SSH2"; then
   2584        dnl when the libssh2 shared libs were found in a path that the run-time
   2585        dnl linker doesn't search through, we need to add it to LD_LIBRARY_PATH
   2586        dnl to prevent further configure tests to fail due to this
   2587 
   2588        if test "x$cross_compiling" != "xyes"; then
   2589          LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
   2590          export LD_LIBRARY_PATH
   2591          AC_MSG_NOTICE([Added $DIR_SSH2 to LD_LIBRARY_PATH])
   2592        fi
   2593     fi
   2594   else
   2595     dnl no libssh2, revert back to clean variables
   2596     LDFLAGS=$CLEANLDFLAGS
   2597     CPPFLAGS=$CLEANCPPFLAGS
   2598     LIBS=$CLEANLIBS
   2599   fi
   2600 fi
   2601 
   2602 dnl **********************************************************************
   2603 dnl Check for the presence of LIBRTMP libraries and headers
   2604 dnl **********************************************************************
   2605 
   2606 dnl Default to compiler & linker defaults for LIBRTMP files & libraries.
   2607 OPT_LIBRTMP=off
   2608 AC_ARG_WITH(librtmp,dnl
   2609 AC_HELP_STRING([--with-librtmp=PATH],[Where to look for librtmp, PATH points to the LIBRTMP installation; when possible, set the PKG_CONFIG_PATH environment variable instead of using this option])
   2610 AC_HELP_STRING([--without-librtmp], [disable LIBRTMP]),
   2611   OPT_LIBRTMP=$withval)
   2612 
   2613 if test X"$OPT_LIBRTMP" != Xno; then
   2614   dnl backup the pre-librtmp variables
   2615   CLEANLDFLAGS="$LDFLAGS"
   2616   CLEANCPPFLAGS="$CPPFLAGS"
   2617   CLEANLIBS="$LIBS"
   2618 
   2619   case "$OPT_LIBRTMP" in
   2620   yes)
   2621     dnl --with-librtmp (without path) used
   2622     CURL_CHECK_PKGCONFIG(librtmp)
   2623 
   2624     if test "$PKGCONFIG" != "no" ; then
   2625       LIB_RTMP=`$PKGCONFIG --libs-only-l librtmp`
   2626       LD_RTMP=`$PKGCONFIG --libs-only-L librtmp`
   2627       CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
   2628       version=`$PKGCONFIG --modversion librtmp`
   2629       DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
   2630     else
   2631       dnl To avoid link errors, we do not allow --librtmp without
   2632       dnl a pkgconfig file
   2633       AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
   2634     fi
   2635 
   2636     ;;
   2637   off)
   2638     dnl no --with-librtmp option given, just check default places
   2639     LIB_RTMP="-lrtmp"
   2640     ;;
   2641   *)
   2642     dnl use the given --with-librtmp spot
   2643     PREFIX_RTMP=$OPT_LIBRTMP
   2644     ;;
   2645   esac
   2646 
   2647   dnl if given with a prefix, we set -L and -I based on that
   2648   if test -n "$PREFIX_RTMP"; then
   2649     LD_RTMP=-L${PREFIX_RTMP}/lib$libsuff
   2650     CPP_RTMP=-I${PREFIX_RTMP}/include
   2651     DIR_RTMP=${PREFIX_RTMP}/lib$libsuff
   2652   fi
   2653 
   2654   LDFLAGS="$LDFLAGS $LD_RTMP"
   2655   CPPFLAGS="$CPPFLAGS $CPP_RTMP"
   2656   LIBS="$LIB_RTMP $LIBS"
   2657 
   2658   AC_CHECK_LIB(rtmp, RTMP_Init,
   2659     [
   2660      AC_CHECK_HEADERS(librtmp/rtmp.h,
   2661         curl_rtmp_msg="enabled (librtmp)"
   2662         LIBRTMP_ENABLED=1
   2663         AC_DEFINE(USE_LIBRTMP, 1, [if librtmp is in use])
   2664         AC_SUBST(USE_LIBRTMP, [1])
   2665      )
   2666     ],
   2667       dnl not found, revert back to clean variables
   2668       LDFLAGS=$CLEANLDFLAGS
   2669       CPPFLAGS=$CLEANCPPFLAGS
   2670       LIBS=$CLEANLIBS
   2671   )
   2672 
   2673   if test X"$OPT_LIBRTMP" != Xoff &&
   2674      test "$LIBRTMP_ENABLED" != "1"; then
   2675     AC_MSG_ERROR([librtmp libs and/or directories were not found where specified!])
   2676   fi
   2677 
   2678 fi
   2679 
   2680 dnl **********************************************************************
   2681 dnl Check for linker switch for versioned symbols
   2682 dnl **********************************************************************
   2683 
   2684 versioned_symbols_flavour=
   2685 AC_MSG_CHECKING([whether versioned symbols are wanted])
   2686 AC_ARG_ENABLE(versioned-symbols,
   2687 AC_HELP_STRING([--enable-versioned-symbols], [Enable versioned symbols in shared library])
   2688 AC_HELP_STRING([--disable-versioned-symbols], [Disable versioned symbols in shared library]),
   2689 [ case "$enableval" in
   2690   yes) AC_MSG_RESULT(yes)
   2691     AC_MSG_CHECKING([if libraries can be versioned])
   2692     GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
   2693     if test -z "$GLD"; then
   2694         AC_MSG_RESULT(no)
   2695         AC_MSG_WARN([You need an ld version supporting the --version-script option])
   2696     else
   2697         AC_MSG_RESULT(yes)
   2698         if test "x$OPENSSL_ENABLED" = "x1"; then
   2699           versioned_symbols_flavour="OPENSSL_"
   2700         elif test "x$GNUTLS_ENABLED" = "x1"; then
   2701           versioned_symbols_flavour="GNUTLS_"
   2702         elif test "x$NSS_ENABLED" = "x1"; then
   2703           versioned_symbols_flavour="NSS_"
   2704         elif test "x$POLARSSL_ENABLED" = "x1"; then
   2705           versioned_symbols_flavour="POLARSSL_"
   2706         elif test "x$CYASSL_ENABLED" = "x1"; then
   2707           versioned_symbols_flavour="CYASSL_"
   2708         elif test "x$AXTLS_ENABLED" = "x1"; then
   2709           versioned_symbols_flavour="AXTLS_"
   2710         elif test "x$WINSSL_ENABLED" = "x1"; then
   2711           versioned_symbols_flavour="WINSSL_"
   2712         elif test "x$DARWINSSL_ENABLED" = "x1"; then
   2713           versioned_symbols_flavour="DARWINSSL_"
   2714         else
   2715           versioned_symbols_flavour=""
   2716         fi
   2717         versioned_symbols="yes"
   2718     fi
   2719     ;;
   2720 
   2721   *)   AC_MSG_RESULT(no)
   2722     ;;
   2723   esac
   2724 ], [
   2725 AC_MSG_RESULT(no)
   2726 ]
   2727 )
   2728 
   2729 AC_SUBST([CURL_LT_SHLIB_VERSIONED_FLAVOUR],
   2730   ["$versioned_symbols_flavour"])
   2731 AM_CONDITIONAL([CURL_LT_SHLIB_USE_VERSIONED_SYMBOLS],
   2732   [test "x$versioned_symbols" = 'xyes'])
   2733 
   2734 dnl -------------------------------------------------
   2735 dnl check winidn option before other IDN libraries
   2736 dnl -------------------------------------------------
   2737 
   2738 AC_MSG_CHECKING([whether to enable Windows native IDN (Windows native builds only)])
   2739 OPT_WINIDN="default"
   2740 AC_ARG_WITH(winidn,
   2741 AC_HELP_STRING([--with-winidn=PATH],[enable Windows native IDN])
   2742 AC_HELP_STRING([--without-winidn], [disable Windows native IDN]),
   2743   OPT_WINIDN=$withval)
   2744 case "$OPT_WINIDN" in
   2745   no|default)
   2746     dnl --without-winidn option used or configure option not specified
   2747     want_winidn="no"
   2748     AC_MSG_RESULT([no])
   2749     ;;
   2750   yes)
   2751     dnl --with-winidn option used without path
   2752     want_winidn="yes"
   2753     want_winidn_path="default"
   2754     AC_MSG_RESULT([yes])
   2755     ;;
   2756   *)
   2757     dnl --with-winidn option used with path
   2758     want_winidn="yes"
   2759     want_winidn_path="$withval"
   2760     AC_MSG_RESULT([yes ($withval)])
   2761     ;;
   2762 esac
   2763 
   2764 if test "$want_winidn" = "yes"; then
   2765   dnl winidn library support has been requested
   2766   clean_CPPFLAGS="$CPPFLAGS"
   2767   clean_LDFLAGS="$LDFLAGS"
   2768   clean_LIBS="$LIBS"
   2769   WINIDN_LIBS="-lnormaliz"
   2770   #
   2771   if test "$want_winidn_path" != "default"; then
   2772     dnl path has been specified
   2773     dnl pkg-config not available or provides no info
   2774     WINIDN_LDFLAGS="-L$want_winidn_path/lib$libsuff"
   2775     WINIDN_CPPFLAGS="-I$want_winidn_path/include"
   2776     WINIDN_DIR="$want_winidn_path/lib$libsuff"
   2777   fi
   2778   #
   2779   CPPFLAGS="$WINIDN_CPPFLAGS $CPPFLAGS"
   2780   LDFLAGS="$WINIDN_LDFLAGS $LDFLAGS"
   2781   LIBS="$WINIDN_LIBS $LIBS"
   2782   #
   2783   AC_MSG_CHECKING([if IdnToUnicode can be linked])
   2784   AC_LINK_IFELSE([
   2785     AC_LANG_FUNC_LINK_TRY([IdnToUnicode])
   2786   ],[
   2787     AC_MSG_RESULT([yes])
   2788     tst_links_winidn="yes"
   2789   ],[
   2790     AC_MSG_RESULT([no])
   2791     tst_links_winidn="no"
   2792   ])
   2793   #
   2794   if test "$tst_links_winidn" = "yes"; then
   2795     AC_DEFINE(USE_WIN32_IDN, 1, [Define to 1 if you have the `normaliz' (WinIDN) library (-lnormaliz).])
   2796     AC_DEFINE(WANT_IDN_PROTOTYPES, 1, [Define to 1 to provide own prototypes.])
   2797     AC_SUBST([IDN_ENABLED], [1])
   2798     curl_idn_msg="enabled (Windows-native)"
   2799   else
   2800     AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
   2801     CPPFLAGS="$clean_CPPFLAGS"
   2802     LDFLAGS="$clean_LDFLAGS"
   2803     LIBS="$clean_LIBS"
   2804   fi
   2805 fi
   2806 
   2807 dnl **********************************************************************
   2808 dnl Check for the presence of IDN libraries and headers
   2809 dnl **********************************************************************
   2810 
   2811 AC_MSG_CHECKING([whether to build with libidn])
   2812 OPT_IDN="default"
   2813 AC_ARG_WITH(libidn,
   2814 AC_HELP_STRING([--with-libidn=PATH],[Enable libidn usage])
   2815 AC_HELP_STRING([--without-libidn],[Disable libidn usage]),
   2816   [OPT_IDN=$withval])
   2817 case "$OPT_IDN" in
   2818   no)
   2819     dnl --without-libidn option used
   2820     want_idn="no"
   2821     AC_MSG_RESULT([no])
   2822     ;;
   2823   default)
   2824     dnl configure option not specified
   2825     want_idn="yes"
   2826     want_idn_path="default"
   2827     AC_MSG_RESULT([(assumed) yes])
   2828     ;;
   2829   yes)
   2830     dnl --with-libidn option used without path
   2831     want_idn="yes"
   2832     want_idn_path="default"
   2833     AC_MSG_RESULT([yes])
   2834     ;;
   2835   *)
   2836     dnl --with-libidn option used with path
   2837     want_idn="yes"
   2838     want_idn_path="$withval"
   2839     AC_MSG_RESULT([yes ($withval)])
   2840     ;;
   2841 esac
   2842 
   2843 if test "$want_idn" = "yes"; then
   2844   dnl idn library support has been requested
   2845   clean_CPPFLAGS="$CPPFLAGS"
   2846   clean_LDFLAGS="$LDFLAGS"
   2847   clean_LIBS="$LIBS"
   2848   PKGCONFIG="no"
   2849   #
   2850   if test "$want_idn_path" != "default"; then
   2851     dnl path has been specified
   2852     IDN_PCDIR="$want_idn_path/lib$libsuff/pkgconfig"
   2853     CURL_CHECK_PKGCONFIG(libidn, [$IDN_PCDIR])
   2854     if test "$PKGCONFIG" != "no"; then
   2855       IDN_LIBS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
   2856         $PKGCONFIG --libs-only-l libidn 2>/dev/null`
   2857       IDN_LDFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
   2858         $PKGCONFIG --libs-only-L libidn 2>/dev/null`
   2859       IDN_CPPFLAGS=`CURL_EXPORT_PCDIR([$IDN_PCDIR]) dnl
   2860         $PKGCONFIG --cflags-only-I libidn 2>/dev/null`
   2861       IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
   2862     else
   2863       dnl pkg-config not available or provides no info
   2864       IDN_LIBS="-lidn"
   2865       IDN_LDFLAGS="-L$want_idn_path/lib$libsuff"
   2866       IDN_CPPFLAGS="-I$want_idn_path/include"
   2867       IDN_DIR="$want_idn_path/lib$libsuff"
   2868     fi
   2869   else
   2870     dnl path not specified
   2871     CURL_CHECK_PKGCONFIG(libidn)
   2872     if test "$PKGCONFIG" != "no"; then
   2873       IDN_LIBS=`$PKGCONFIG --libs-only-l libidn 2>/dev/null`
   2874       IDN_LDFLAGS=`$PKGCONFIG --libs-only-L libidn 2>/dev/null`
   2875       IDN_CPPFLAGS=`$PKGCONFIG --cflags-only-I libidn 2>/dev/null`
   2876       IDN_DIR=`echo $IDN_LDFLAGS | $SED -e 's/-L//'`
   2877     else
   2878       dnl pkg-config not available or provides no info
   2879       IDN_LIBS="-lidn"
   2880     fi
   2881   fi
   2882   #
   2883   if test "$PKGCONFIG" != "no"; then
   2884     AC_MSG_NOTICE([pkg-config: IDN_LIBS: "$IDN_LIBS"])
   2885     AC_MSG_NOTICE([pkg-config: IDN_LDFLAGS: "$IDN_LDFLAGS"])
   2886     AC_MSG_NOTICE([pkg-config: IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
   2887     AC_MSG_NOTICE([pkg-config: IDN_DIR: "$IDN_DIR"])
   2888   else
   2889     AC_MSG_NOTICE([IDN_LIBS: "$IDN_LIBS"])
   2890     AC_MSG_NOTICE([IDN_LDFLAGS: "$IDN_LDFLAGS"])
   2891     AC_MSG_NOTICE([IDN_CPPFLAGS: "$IDN_CPPFLAGS"])
   2892     AC_MSG_NOTICE([IDN_DIR: "$IDN_DIR"])
   2893   fi
   2894   #
   2895   CPPFLAGS="$IDN_CPPFLAGS $CPPFLAGS"
   2896   LDFLAGS="$IDN_LDFLAGS $LDFLAGS"
   2897   LIBS="$IDN_LIBS $LIBS"
   2898   #
   2899   AC_MSG_CHECKING([if idna_to_ascii_4i can be linked])
   2900   AC_LINK_IFELSE([
   2901     AC_LANG_FUNC_LINK_TRY([idna_to_ascii_4i])
   2902   ],[
   2903     AC_MSG_RESULT([yes])
   2904     tst_links_libidn="yes"
   2905   ],[
   2906     AC_MSG_RESULT([no])
   2907     tst_links_libidn="no"
   2908   ])
   2909   if test "$tst_links_libidn" = "no"; then
   2910     AC_MSG_CHECKING([if idna_to_ascii_lz can be linked])
   2911     AC_LINK_IFELSE([
   2912       AC_LANG_FUNC_LINK_TRY([idna_to_ascii_lz])
   2913     ],[
   2914       AC_MSG_RESULT([yes])
   2915       tst_links_libidn="yes"
   2916     ],[
   2917       AC_MSG_RESULT([no])
   2918       tst_links_libidn="no"
   2919     ])
   2920   fi
   2921   #
   2922   if test "$tst_links_libidn" = "yes"; then
   2923     AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you have the `idn' library (-lidn).])
   2924     dnl different versions of libidn have different setups of these:
   2925     AC_CHECK_FUNCS( idn_free idna_strerror tld_strerror )
   2926     AC_CHECK_HEADERS( idn-free.h tld.h )
   2927     if test "x$ac_cv_header_tld_h" = "xyes"; then
   2928       AC_SUBST([IDN_ENABLED], [1])
   2929       curl_idn_msg="enabled"
   2930       if test -n "$IDN_DIR" -a "x$cross_compiling" != "xyes"; then
   2931         LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$IDN_DIR"
   2932         export LD_LIBRARY_PATH
   2933         AC_MSG_NOTICE([Added $IDN_DIR to LD_LIBRARY_PATH])
   2934       fi
   2935     else
   2936       AC_MSG_WARN([Libraries for IDN support too old: IDN disabled])
   2937       CPPFLAGS="$clean_CPPFLAGS"
   2938       LDFLAGS="$clean_LDFLAGS"
   2939       LIBS="$clean_LIBS"
   2940     fi
   2941   else
   2942     AC_MSG_WARN([Cannot find libraries for IDN support: IDN disabled])
   2943     CPPFLAGS="$clean_CPPFLAGS"
   2944     LDFLAGS="$clean_LDFLAGS"
   2945     LIBS="$clean_LIBS"
   2946   fi
   2947 fi
   2948 
   2949 
   2950 dnl Let's hope this split URL remains working:
   2951 dnl http://publibn.boulder.ibm.com/doc_link/en_US/a_doc_lib/aixprggd/ \
   2952 dnl genprogc/thread_quick_ref.htm
   2953 
   2954 
   2955 dnl **********************************************************************
   2956 dnl Check for nghttp2
   2957 dnl **********************************************************************
   2958 
   2959 OPT_H2="yes"
   2960 AC_ARG_WITH(nghttp2,
   2961 AC_HELP_STRING([--with-nghttp2=PATH],[Enable nghttp2 usage])
   2962 AC_HELP_STRING([--without-nghttp2],[Disable nghttp2 usage]),
   2963   [OPT_H2=$withval])
   2964 case "$OPT_H2" in
   2965   no)
   2966     dnl --without-nghttp2 option used
   2967     want_h2="no"
   2968     ;;
   2969   yes)
   2970     dnl --with-nghttp2 option used without path
   2971     want_h2="default"
   2972     want_h2_path=""
   2973     ;;
   2974   *)
   2975     dnl --with-nghttp2 option used with path
   2976     want_h2="yes"
   2977     want_h2_path="$withval/lib/pkgconfig"
   2978     ;;
   2979 esac
   2980 
   2981 curl_h2_msg="disabled (--with-nghttp2)"
   2982 if test X"$want_h2" != Xno; then
   2983   dnl backup the pre-nghttp2 variables
   2984   CLEANLDFLAGS="$LDFLAGS"
   2985   CLEANCPPFLAGS="$CPPFLAGS"
   2986   CLEANLIBS="$LIBS"
   2987 
   2988   CURL_CHECK_PKGCONFIG(libnghttp2, $want_h2_path)
   2989 
   2990   if test "$PKGCONFIG" != "no" ; then
   2991     LIB_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
   2992       $PKGCONFIG --libs-only-l libnghttp2`
   2993     AC_MSG_NOTICE([-l is $LIB_H2])
   2994 
   2995     CPP_H2=`CURL_EXPORT_PCDIR([$want_h2_path]) dnl
   2996       $PKGCONFIG --cflags-only-I libnghttp2`
   2997     AC_MSG_NOTICE([-I is $CPP_H2])
   2998 
   2999     LD_H2=`CURL_EXPORT_PCDIR([$want_h2_path])
   3000       $PKGCONFIG --libs-only-L libnghttp2`
   3001     AC_MSG_NOTICE([-L is $LD_H2])
   3002 
   3003     LDFLAGS="$LDFLAGS $LD_H2"
   3004     CPPFLAGS="$CPPFLAGS $CPP_H2"
   3005     LIBS="$LIB_H2 $LIBS"
   3006 
   3007     # use nghttp2_option_set_no_recv_client_magic to require nghttp2
   3008     # >= 1.0.0
   3009     AC_CHECK_LIB(nghttp2, nghttp2_option_set_no_recv_client_magic,
   3010       [
   3011        AC_CHECK_HEADERS(nghttp2/nghttp2.h,
   3012           curl_h2_msg="enabled (nghttp2)"
   3013           NGHTTP2_ENABLED=1
   3014           AC_DEFINE(USE_NGHTTP2, 1, [if nghttp2 is in use])
   3015           AC_SUBST(USE_NGHTTP2, [1])
   3016        )
   3017       ],
   3018         dnl not found, revert back to clean variables
   3019         LDFLAGS=$CLEANLDFLAGS
   3020         CPPFLAGS=$CLEANCPPFLAGS
   3021         LIBS=$CLEANLIBS
   3022     )
   3023 
   3024   else
   3025     dnl no nghttp2 pkg-config found, deal with it
   3026     if test X"$want_h2" != Xdefault; then
   3027       dnl To avoid link errors, we do not allow --with-nghttp2 without
   3028       dnl a pkgconfig file
   3029       AC_MSG_ERROR([--with-nghttp2 was specified but could not find libnghttp2 pkg-config file.])
   3030     fi
   3031   fi
   3032 
   3033 fi
   3034 
   3035 dnl **********************************************************************
   3036 dnl Check for zsh completion path
   3037 dnl **********************************************************************
   3038 
   3039 OPT_ZSH_FPATH=default
   3040 AC_ARG_WITH(zsh-functions-dir,
   3041 AC_HELP_STRING([--with-zsh-functions-dir=PATH],[Install zsh completions to PATH])
   3042 AC_HELP_STRING([--without-zsh-functions-dir],[Do not install zsh completions]),
   3043   [OPT_ZSH_FPATH=$withval])
   3044 case "$OPT_ZSH_FPATH" in
   3045   no)
   3046     dnl --without-zsh-functions-dir option used
   3047     ;;
   3048   default|yes)
   3049     dnl --with-zsh-functions-dir option used without path
   3050     ZSH_FUNCTIONS_DIR="$datarootdir/zsh/site-functions"
   3051     AC_SUBST(ZSH_FUNCTIONS_DIR)
   3052     ;;
   3053   *)
   3054     dnl --with-zsh-functions-dir option used with path
   3055     ZSH_FUNCTIONS_DIR="$withval"
   3056     AC_SUBST(ZSH_FUNCTIONS_DIR)
   3057     ;;
   3058 esac
   3059 
   3060 dnl **********************************************************************
   3061 dnl Back to "normal" configuring
   3062 dnl **********************************************************************
   3063 
   3064 dnl Checks for header files.
   3065 AC_HEADER_STDC
   3066 
   3067 CURL_CHECK_HEADER_MALLOC
   3068 CURL_CHECK_HEADER_MEMORY
   3069 
   3070 dnl Now check for the very most basic headers. Then we can use these
   3071 dnl ones as default-headers when checking for the rest!
   3072 AC_CHECK_HEADERS(
   3073         sys/types.h \
   3074         sys/time.h \
   3075         sys/select.h \
   3076         sys/socket.h \
   3077         sys/ioctl.h \
   3078         sys/uio.h \
   3079         assert.h \
   3080         unistd.h \
   3081         stdlib.h \
   3082         limits.h \
   3083         arpa/inet.h \
   3084         net/if.h \
   3085         netinet/in.h \
   3086         sys/un.h \
   3087         netinet/tcp.h \
   3088         netdb.h \
   3089         sys/sockio.h \
   3090         sys/stat.h \
   3091         sys/param.h \
   3092         termios.h \
   3093         termio.h \
   3094         sgtty.h \
   3095         fcntl.h \
   3096         alloca.h \
   3097         time.h \
   3098         io.h \
   3099         pwd.h \
   3100         utime.h \
   3101         sys/utime.h \
   3102         sys/poll.h \
   3103         poll.h \
   3104         socket.h \
   3105         sys/resource.h \
   3106         libgen.h \
   3107         locale.h \
   3108         errno.h \
   3109         stdbool.h \
   3110         arpa/tftp.h \
   3111         sys/filio.h \
   3112         sys/wait.h \
   3113         setjmp.h,
   3114 dnl to do if not found
   3115 [],
   3116 dnl to do if found
   3117 [],
   3118 dnl default includes
   3119 [
   3120 #ifdef HAVE_SYS_TYPES_H
   3121 #include <sys/types.h>
   3122 #endif
   3123 #ifdef HAVE_SYS_TIME_H
   3124 #include <sys/time.h>
   3125 #endif
   3126 #ifdef HAVE_SYS_SELECT_H
   3127 #include <sys/select.h>
   3128 #endif
   3129 #ifdef HAVE_SYS_SOCKET_H
   3130 #include <sys/socket.h>
   3131 #endif
   3132 #ifdef HAVE_NETINET_IN_H
   3133 #include <netinet/in.h>
   3134 #endif
   3135 #ifdef HAVE_SYS_UN_H
   3136 #include <sys/un.h>
   3137 #endif
   3138 ]
   3139 )
   3140 
   3141 dnl Checks for typedefs, structures, and compiler characteristics.
   3142 AC_C_CONST
   3143 CURL_CHECK_VARIADIC_MACROS
   3144 AC_TYPE_SIZE_T
   3145 AC_HEADER_TIME
   3146 CURL_CHECK_STRUCT_TIMEVAL
   3147 CURL_VERIFY_RUNTIMELIBS
   3148 
   3149 AC_CHECK_SIZEOF(off_t)
   3150 
   3151 soname_bump=no
   3152 if test x"$curl_cv_native_windows" != "xyes" &&
   3153    test $ac_cv_sizeof_off_t -ne $curl_sizeof_curl_off_t; then
   3154   AC_MSG_WARN([This libcurl built is probably not ABI compatible with previous])
   3155   AC_MSG_WARN([builds! You MUST read lib/README.curl_off_t to figure it out.])
   3156   soname_bump=yes
   3157 fi
   3158 
   3159 
   3160 AC_CHECK_TYPE(long long,
   3161    [AC_DEFINE(HAVE_LONGLONG, 1,
   3162       [Define to 1 if the compiler supports the 'long long' data type.])]
   3163    longlong="yes"
   3164 )
   3165 
   3166 if test "xyes" = "x$longlong"; then
   3167   AC_MSG_CHECKING([if numberLL works])
   3168   AC_COMPILE_IFELSE([
   3169     AC_LANG_PROGRAM([[
   3170     ]],[[
   3171       long long val = 1000LL;
   3172     ]])
   3173   ],[
   3174     AC_MSG_RESULT([yes])
   3175     AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
   3176   ],[
   3177     AC_MSG_RESULT([no])
   3178   ])
   3179 fi
   3180 
   3181 
   3182 # check for ssize_t
   3183 AC_CHECK_TYPE(ssize_t, ,
   3184    AC_DEFINE(ssize_t, int, [the signed version of size_t]))
   3185 
   3186 # check for bool type
   3187 AC_CHECK_TYPE([bool],[
   3188   AC_DEFINE(HAVE_BOOL_T, 1,
   3189     [Define to 1 if bool is an available type.])
   3190 ], ,[
   3191 #ifdef HAVE_SYS_TYPES_H
   3192 #include <sys/types.h>
   3193 #endif
   3194 #ifdef HAVE_STDBOOL_H
   3195 #include <stdbool.h>
   3196 #endif
   3197 ])
   3198 
   3199 CURL_CONFIGURE_CURL_SOCKLEN_T
   3200 
   3201 CURL_CONFIGURE_PULL_SYS_POLL
   3202 
   3203 TYPE_IN_ADDR_T
   3204 
   3205 TYPE_SOCKADDR_STORAGE
   3206 
   3207 TYPE_SIG_ATOMIC_T
   3208 
   3209 AC_TYPE_SIGNAL
   3210 
   3211 CURL_CHECK_FUNC_SELECT
   3212 
   3213 CURL_CHECK_FUNC_RECV
   3214 CURL_CHECK_FUNC_SEND
   3215 CURL_CHECK_MSG_NOSIGNAL
   3216 
   3217 CURL_CHECK_FUNC_ALARM
   3218 CURL_CHECK_FUNC_BASENAME
   3219 CURL_CHECK_FUNC_CLOSESOCKET
   3220 CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
   3221 CURL_CHECK_FUNC_CONNECT
   3222 CURL_CHECK_FUNC_FCNTL
   3223 CURL_CHECK_FUNC_FDOPEN
   3224 CURL_CHECK_FUNC_FREEADDRINFO
   3225 CURL_CHECK_FUNC_FREEIFADDRS
   3226 CURL_CHECK_FUNC_FSETXATTR
   3227 CURL_CHECK_FUNC_FTRUNCATE
   3228 CURL_CHECK_FUNC_GETADDRINFO
   3229 CURL_CHECK_FUNC_GAI_STRERROR
   3230 CURL_CHECK_FUNC_GETHOSTBYADDR
   3231 CURL_CHECK_FUNC_GETHOSTBYADDR_R
   3232 CURL_CHECK_FUNC_GETHOSTBYNAME
   3233 CURL_CHECK_FUNC_GETHOSTBYNAME_R
   3234 CURL_CHECK_FUNC_GETHOSTNAME
   3235 CURL_CHECK_FUNC_GETIFADDRS
   3236 CURL_CHECK_FUNC_GETSERVBYPORT_R
   3237 CURL_CHECK_FUNC_GMTIME_R
   3238 CURL_CHECK_FUNC_INET_NTOA_R
   3239 CURL_CHECK_FUNC_INET_NTOP
   3240 CURL_CHECK_FUNC_INET_PTON
   3241 CURL_CHECK_FUNC_IOCTL
   3242 CURL_CHECK_FUNC_IOCTLSOCKET
   3243 CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
   3244 CURL_CHECK_FUNC_LOCALTIME_R
   3245 CURL_CHECK_FUNC_MEMRCHR
   3246 CURL_CHECK_FUNC_POLL
   3247 CURL_CHECK_FUNC_SETSOCKOPT
   3248 CURL_CHECK_FUNC_SIGACTION
   3249 CURL_CHECK_FUNC_SIGINTERRUPT
   3250 CURL_CHECK_FUNC_SIGNAL
   3251 CURL_CHECK_FUNC_SIGSETJMP
   3252 CURL_CHECK_FUNC_SOCKET
   3253 CURL_CHECK_FUNC_SOCKETPAIR
   3254 CURL_CHECK_FUNC_STRCASECMP
   3255 CURL_CHECK_FUNC_STRCMPI
   3256 CURL_CHECK_FUNC_STRDUP
   3257 CURL_CHECK_FUNC_STRERROR_R
   3258 CURL_CHECK_FUNC_STRICMP
   3259 CURL_CHECK_FUNC_STRNCASECMP
   3260 CURL_CHECK_FUNC_STRNCMPI
   3261 CURL_CHECK_FUNC_STRNICMP
   3262 CURL_CHECK_FUNC_STRSTR
   3263 CURL_CHECK_FUNC_STRTOK_R
   3264 CURL_CHECK_FUNC_STRTOLL
   3265 CURL_CHECK_FUNC_WRITEV
   3266 
   3267 case $host in
   3268   *msdosdjgpp)
   3269      ac_cv_func_pipe=no
   3270      skipcheck_pipe=yes
   3271      AC_MSG_NOTICE([skip check for pipe on msdosdjgpp])
   3272     ;;
   3273 esac
   3274 
   3275 AC_CHECK_FUNCS([fork \
   3276   geteuid \
   3277   getpass_r \
   3278   getppid \
   3279   getprotobyname \
   3280   getpwuid \
   3281   getpwuid_r \
   3282   getrlimit \
   3283   gettimeofday \
   3284   if_nametoindex \
   3285   inet_addr \
   3286   perror \
   3287   pipe \
   3288   setlocale \
   3289   setmode \
   3290   setrlimit \
   3291   uname \
   3292   utime
   3293 ],[
   3294 ],[
   3295   func="$ac_func"
   3296   eval skipcheck=\$skipcheck_$func
   3297   if test "x$skipcheck" != "xyes"; then
   3298     AC_MSG_CHECKING([deeper for $func])
   3299     AC_LINK_IFELSE([
   3300       AC_LANG_PROGRAM([[
   3301       ]],[[
   3302         $func ();
   3303       ]])
   3304     ],[
   3305       AC_MSG_RESULT([yes])
   3306       eval "ac_cv_func_$func=yes"
   3307       AC_DEFINE_UNQUOTED(XC_SH_TR_CPP([HAVE_$func]), [1],
   3308         [Define to 1 if you have the $func function.])
   3309     ],[
   3310       AC_MSG_RESULT([but still no])
   3311     ])
   3312   fi
   3313 ])
   3314 
   3315 dnl Check if the getnameinfo function is available
   3316 dnl and get the types of five of its arguments.
   3317 CURL_CHECK_FUNC_GETNAMEINFO
   3318 
   3319 if test "$ipv6" = "yes"; then
   3320   if test "$curl_cv_func_getaddrinfo" = "yes"; then
   3321     AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
   3322     IPV6_ENABLED=1
   3323     AC_SUBST(IPV6_ENABLED)
   3324   fi
   3325   CURL_CHECK_NI_WITHSCOPEID
   3326 fi
   3327 
   3328 CURL_CHECK_NONBLOCKING_SOCKET
   3329 
   3330 dnl ************************************************************
   3331 dnl nroff tool stuff
   3332 dnl
   3333 
   3334 AC_PATH_PROG( PERL, perl, ,
   3335   $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
   3336 AC_SUBST(PERL)
   3337 
   3338 AC_PATH_PROGS( NROFF, gnroff nroff, ,
   3339   $PATH:/usr/bin/:/usr/local/bin )
   3340 AC_SUBST(NROFF)
   3341 
   3342 if test -n "$NROFF"; then
   3343   dnl only check for nroff options if an nroff command was found
   3344 
   3345   AC_MSG_CHECKING([how to use *nroff to get plain text from man pages])
   3346   MANOPT="-man"
   3347   mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
   3348   if test -z "$mancheck"; then
   3349     MANOPT="-mandoc"
   3350    mancheck=`echo foo | $NROFF $MANOPT 2>/dev/null`
   3351     if test -z "$mancheck"; then
   3352       MANOPT=""
   3353       AC_MSG_RESULT([failed])
   3354       AC_MSG_WARN([found no *nroff option to get plaintext from man pages])
   3355     else
   3356       AC_MSG_RESULT([$MANOPT])
   3357     fi
   3358   else
   3359     AC_MSG_RESULT([$MANOPT])
   3360   fi
   3361   AC_SUBST(MANOPT)
   3362 fi
   3363 
   3364 if test -z "$MANOPT"
   3365 then
   3366   dnl if no nroff tool was found, or no option that could convert man pages
   3367   dnl was found, then disable the built-in manual stuff
   3368   AC_MSG_WARN([disabling built-in manual])
   3369   USE_MANUAL="no";
   3370 fi
   3371 
   3372 dnl *************************************************************************
   3373 dnl If the manual variable still is set, then we go with providing a built-in
   3374 dnl manual
   3375 
   3376 if test "$USE_MANUAL" = "1"; then
   3377   AC_DEFINE(USE_MANUAL, 1, [If you want to build curl with the built-in manual])
   3378   curl_manual_msg="enabled"
   3379 fi
   3380 
   3381 dnl set variable for use in automakefile(s)
   3382 AM_CONDITIONAL(USE_MANUAL, test x"$USE_MANUAL" = x1)
   3383 
   3384 CURL_CHECK_LIB_ARES
   3385 AM_CONDITIONAL(USE_EMBEDDED_ARES, test x$embedded_ares = xyes)
   3386 
   3387 if test "x$curl_cv_native_windows" != "xyes" &&
   3388    test "x$enable_shared" = "xyes"; then
   3389   build_libhostname=yes
   3390 else
   3391   build_libhostname=no
   3392 fi
   3393 AM_CONDITIONAL(BUILD_LIBHOSTNAME, test x$build_libhostname = xyes)
   3394 
   3395 CURL_CHECK_OPTION_THREADED_RESOLVER
   3396 
   3397 if test "x$want_thres" = xyes && test "x$want_ares" = xyes; then
   3398   AC_MSG_ERROR(
   3399 [Options --enable-threaded-resolver and --enable-ares are mutually exclusive])
   3400 fi
   3401 
   3402 if test "$want_thres" = "yes" && test "$dontwant_rt" = "no"; then
   3403   AC_CHECK_HEADER(pthread.h,
   3404     [ AC_DEFINE(HAVE_PTHREAD_H, 1, [if you have <pthread.h>])
   3405       save_CFLAGS="$CFLAGS"
   3406 
   3407       dnl first check for function without lib
   3408       AC_CHECK_FUNC(pthread_create, [USE_THREADS_POSIX=1] )
   3409 
   3410       dnl if it wasn't found without lib, search for it in pthread lib
   3411       if test "$USE_THREADS_POSIX" != "1"
   3412       then
   3413         CFLAGS="$CFLAGS -pthread"
   3414         AC_CHECK_LIB(pthread, pthread_create,
   3415                      [USE_THREADS_POSIX=1],
   3416                      [ CFLAGS="$save_CFLAGS"])
   3417       fi
   3418 
   3419       if test "x$USE_THREADS_POSIX" = "x1"
   3420       then
   3421         AC_DEFINE(USE_THREADS_POSIX, 1, [if you want POSIX threaded DNS lookup])
   3422         curl_res_msg="POSIX threaded"
   3423       fi
   3424 
   3425 
   3426   ])
   3427 fi
   3428 
   3429 dnl ************************************************************
   3430 dnl disable verbose text strings
   3431 dnl
   3432 AC_MSG_CHECKING([whether to enable verbose strings])
   3433 AC_ARG_ENABLE(verbose,
   3434 AC_HELP_STRING([--enable-verbose],[Enable verbose strings])
   3435 AC_HELP_STRING([--disable-verbose],[Disable verbose strings]),
   3436 [ case "$enableval" in
   3437   no)
   3438        AC_MSG_RESULT(no)
   3439        AC_DEFINE(CURL_DISABLE_VERBOSE_STRINGS, 1, [to disable verbose strings])
   3440        curl_verbose_msg="no"
   3441        ;;
   3442   *)   AC_MSG_RESULT(yes)
   3443        ;;
   3444   esac ],
   3445        AC_MSG_RESULT(yes)
   3446 )
   3447 
   3448 dnl ************************************************************
   3449 dnl enable SSPI support
   3450 dnl
   3451 AC_MSG_CHECKING([whether to enable SSPI support (Windows native builds only)])
   3452 AC_ARG_ENABLE(sspi,
   3453 AC_HELP_STRING([--enable-sspi],[Enable SSPI])
   3454 AC_HELP_STRING([--disable-sspi],[Disable SSPI]),
   3455 [ case "$enableval" in
   3456   yes)
   3457        if test "$curl_cv_native_windows" = "yes"; then
   3458          AC_MSG_RESULT(yes)
   3459          AC_DEFINE(USE_WINDOWS_SSPI, 1, [to enable SSPI support])
   3460          AC_SUBST(USE_WINDOWS_SSPI, [1])
   3461          curl_sspi_msg="enabled"
   3462        else
   3463          AC_MSG_RESULT(no)
   3464          AC_MSG_WARN([--enable-sspi Ignored. Only supported on native Windows builds.])
   3465        fi
   3466        ;;
   3467   *)
   3468        if test "x$WINSSL_ENABLED" = "x1"; then
   3469          # --with-winssl implies --enable-sspi
   3470          AC_MSG_RESULT(yes)
   3471        else
   3472          AC_MSG_RESULT(no)
   3473        fi
   3474        ;;
   3475   esac ],
   3476        if test "x$WINSSL_ENABLED" = "x1"; then
   3477          # --with-winssl implies --enable-sspi
   3478          AC_MSG_RESULT(yes)
   3479        else
   3480          AC_MSG_RESULT(no)
   3481        fi
   3482 )
   3483 
   3484 dnl ************************************************************
   3485 dnl disable cryptographic authentication
   3486 dnl
   3487 AC_MSG_CHECKING([whether to enable cryptographic authentication methods])
   3488 AC_ARG_ENABLE(crypto-auth,
   3489 AC_HELP_STRING([--enable-crypto-auth],[Enable cryptographic authentication])
   3490 AC_HELP_STRING([--disable-crypto-auth],[Disable cryptographic authentication]),
   3491 [ case "$enableval" in
   3492   no)
   3493        AC_MSG_RESULT(no)
   3494        AC_DEFINE(CURL_DISABLE_CRYPTO_AUTH, 1, [to disable cryptographic authentication])
   3495        CURL_DISABLE_CRYPTO_AUTH=1
   3496        ;;
   3497   *)   AC_MSG_RESULT(yes)
   3498        ;;
   3499   esac ],
   3500        AC_MSG_RESULT(yes)
   3501 )
   3502 
   3503 CURL_CHECK_OPTION_NTLM_WB
   3504 
   3505 CURL_CHECK_NTLM_WB
   3506 
   3507 dnl ************************************************************
   3508 dnl disable TLS-SRP authentication
   3509 dnl
   3510 AC_MSG_CHECKING([whether to enable TLS-SRP authentication])
   3511 AC_ARG_ENABLE(tls-srp,
   3512 AC_HELP_STRING([--enable-tls-srp],[Enable TLS-SRP authentication])
   3513 AC_HELP_STRING([--disable-tls-srp],[Disable TLS-SRP authentication]),
   3514 [ case "$enableval" in
   3515   no)
   3516        AC_MSG_RESULT(no)
   3517        AC_DEFINE(CURL_DISABLE_TLS_SRP, 1, [to disable TLS-SRP authentication])
   3518        want_tls_srp=no
   3519        ;;
   3520   *)   AC_MSG_RESULT(yes)
   3521        want_tls_srp=yes
   3522        ;;
   3523   esac ],
   3524        AC_MSG_RESULT(yes)
   3525        want_tls_srp=yes
   3526 )
   3527 
   3528 if test "$want_tls_srp" = "yes" && ( test "x$HAVE_GNUTLS_SRP" = "x1" || test "x$HAVE_OPENSSL_SRP" = "x1") ; then
   3529    AC_DEFINE(USE_TLS_SRP, 1, [Use TLS-SRP authentication])
   3530    USE_TLS_SRP=1
   3531    curl_tls_srp_msg="enabled"
   3532 fi
   3533 
   3534 dnl ************************************************************
   3535 dnl disable Unix domain sockets support
   3536 dnl
   3537 AC_MSG_CHECKING([whether to enable Unix domain sockets])
   3538 AC_ARG_ENABLE(unix-sockets,
   3539 AC_HELP_STRING([--enable-unix-sockets],[Enable Unix domain sockets])
   3540 AC_HELP_STRING([--disable-unix-sockets],[Disable Unix domain sockets]),
   3541 [ case "$enableval" in
   3542   no)  AC_MSG_RESULT(no)
   3543        want_unix_sockets=no
   3544        ;;
   3545   *)   AC_MSG_RESULT(yes)
   3546        want_unix_sockets=yes
   3547        ;;
   3548   esac ], [
   3549        AC_MSG_RESULT(auto)
   3550        want_unix_sockets=auto
   3551        ]
   3552 )
   3553 if test "x$want_unix_sockets" != "xno"; then
   3554   AC_CHECK_MEMBER([struct sockaddr_un.sun_path], [
   3555     AC_DEFINE(USE_UNIX_SOCKETS, 1, [Use Unix domain sockets])
   3556     AC_SUBST(USE_UNIX_SOCKETS, [1])
   3557     curl_unix_sockets_msg="enabled"
   3558   ], [
   3559     if test "x$want_unix_sockets" = "xyes"; then
   3560       AC_MSG_ERROR([--enable-unix-sockets is not available on this platform!])
   3561     fi
   3562   ], [
   3563     #include <sys/un.h>
   3564   ])
   3565 fi
   3566 
   3567 dnl ************************************************************
   3568 dnl disable cookies support
   3569 dnl
   3570 AC_MSG_CHECKING([whether to enable support for cookies])
   3571 AC_ARG_ENABLE(cookies,
   3572 AC_HELP_STRING([--enable-cookies],[Enable cookies support])
   3573 AC_HELP_STRING([--disable-cookies],[Disable cookies support]),
   3574 [ case "$enableval" in
   3575   no)
   3576        AC_MSG_RESULT(no)
   3577        AC_DEFINE(CURL_DISABLE_COOKIES, 1, [to disable cookies support])
   3578        ;;
   3579   *)   AC_MSG_RESULT(yes)
   3580        ;;
   3581   esac ],
   3582        AC_MSG_RESULT(yes)
   3583 )
   3584 
   3585 dnl ************************************************************
   3586 dnl hiding of library internal symbols
   3587 dnl
   3588 CURL_CONFIGURE_SYMBOL_HIDING
   3589 
   3590 dnl ************************************************************
   3591 dnl enforce SONAME bump
   3592 dnl
   3593 
   3594 AC_MSG_CHECKING([whether to enforce SONAME bump])
   3595 AC_ARG_ENABLE(soname-bump,
   3596 AC_HELP_STRING([--enable-soname-bump],[Enable enforced SONAME bump])
   3597 AC_HELP_STRING([--disable-soname-bump],[Disable enforced SONAME bump]),
   3598 [ case "$enableval" in
   3599   yes)   AC_MSG_RESULT(yes)
   3600          soname_bump=yes
   3601          ;;
   3602   *)
   3603          AC_MSG_RESULT(no)
   3604          ;;
   3605   esac ],
   3606         AC_MSG_RESULT($soname_bump)
   3607 )
   3608 AM_CONDITIONAL(SONAME_BUMP, test x$soname_bump = xyes)
   3609 
   3610 dnl
   3611 dnl All the library dependencies put into $LIB apply to libcurl only.
   3612 dnl
   3613 LIBCURL_LIBS=$LIBS
   3614 
   3615 AC_SUBST(LIBCURL_LIBS)
   3616 AC_SUBST(CURL_NETWORK_LIBS)
   3617 AC_SUBST(CURL_NETWORK_AND_TIME_LIBS)
   3618 
   3619 dnl BLANK_AT_MAKETIME may be used in our Makefile.am files to blank
   3620 dnl LIBS variable used in generated makefile at makefile processing
   3621 dnl time. Doing this functionally prevents LIBS from being used for
   3622 dnl all link targets in given makefile.
   3623 BLANK_AT_MAKETIME=
   3624 AC_SUBST(BLANK_AT_MAKETIME)
   3625 
   3626 AM_CONDITIONAL(CROSSCOMPILING, test x$cross_compiling = xyes)
   3627 
   3628 dnl yes or no
   3629 ENABLE_SHARED="$enable_shared"
   3630 AC_SUBST(ENABLE_SHARED)
   3631 
   3632 dnl to let curl-config output the static libraries correctly
   3633 ENABLE_STATIC="$enable_static"
   3634 AC_SUBST(ENABLE_STATIC)
   3635 
   3636 
   3637 dnl
   3638 dnl For keeping supported features and protocols also in pkg-config file
   3639 dnl since it is more cross-compile friendly than curl-config
   3640 dnl
   3641 
   3642 if test "x$OPENSSL_ENABLED" = "x1"; then
   3643   SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
   3644 elif test -n "$SSL_ENABLED"; then
   3645   SUPPORT_FEATURES="$SUPPORT_FEATURES SSL"
   3646 fi
   3647 if test "x$IPV6_ENABLED" = "x1"; then
   3648   SUPPORT_FEATURES="$SUPPORT_FEATURES IPv6"
   3649 fi
   3650 if test "x$USE_UNIX_SOCKETS" = "x1"; then
   3651   SUPPORT_FEATURES="$SUPPORT_FEATURES UnixSockets"
   3652 fi
   3653 if test "x$HAVE_LIBZ" = "x1"; then
   3654   SUPPORT_FEATURES="$SUPPORT_FEATURES libz"
   3655 fi
   3656 if test "x$USE_ARES" = "x1" -o "x$USE_THREADS_POSIX" = "x1"; then
   3657   SUPPORT_FEATURES="$SUPPORT_FEATURES AsynchDNS"
   3658 fi
   3659 if test "x$IDN_ENABLED" = "x1"; then
   3660   SUPPORT_FEATURES="$SUPPORT_FEATURES IDN"
   3661 fi
   3662 if test "x$USE_WINDOWS_SSPI" = "x1"; then
   3663   SUPPORT_FEATURES="$SUPPORT_FEATURES SSPI"
   3664 fi
   3665 
   3666 if test "x$HAVE_GSSAPI" = "x1"; then
   3667   SUPPORT_FEATURES="$SUPPORT_FEATURES GSS-API"
   3668 fi
   3669 
   3670 if test "x$curl_psl_msg" = "xyes"; then
   3671   SUPPORT_FEATURES="$SUPPORT_FEATURES PSL"
   3672 fi
   3673 
   3674 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
   3675     \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
   3676   SUPPORT_FEATURES="$SUPPORT_FEATURES SPNEGO"
   3677 fi
   3678 
   3679 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" -a \
   3680     \( "x$HAVE_GSSAPI" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \); then
   3681   SUPPORT_FEATURES="$SUPPORT_FEATURES Kerberos"
   3682 fi
   3683 
   3684 if test "x$CURL_DISABLE_CRYPTO_AUTH" != "x1"; then
   3685   if test "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
   3686       -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
   3687       -o "x$DARWINSSL_ENABLED" = "x1"; then
   3688     SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM"
   3689 
   3690     if test "x$CURL_DISABLE_HTTP" != "x1" -a \
   3691         "x$NTLM_WB_ENABLED" = "x1"; then
   3692       SUPPORT_FEATURES="$SUPPORT_FEATURES NTLM_WB"
   3693     fi
   3694   fi
   3695 fi
   3696 
   3697 if test "x$USE_TLS_SRP" = "x1"; then
   3698   SUPPORT_FEATURES="$SUPPORT_FEATURES TLS-SRP"
   3699 fi
   3700 
   3701 if test "x$USE_NGHTTP2" = "x1"; then
   3702   SUPPORT_FEATURES="$SUPPORT_FEATURES HTTP2"
   3703 fi
   3704 
   3705 AC_SUBST(SUPPORT_FEATURES)
   3706 
   3707 dnl For supported protocols in pkg-config file
   3708 if test "x$CURL_DISABLE_HTTP" != "x1"; then
   3709   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTP"
   3710   if test "x$SSL_ENABLED" = "x1"; then
   3711     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS HTTPS"
   3712   fi
   3713 fi
   3714 if test "x$CURL_DISABLE_FTP" != "x1"; then
   3715   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTP"
   3716   if test "x$SSL_ENABLED" = "x1"; then
   3717     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FTPS"
   3718   fi
   3719 fi
   3720 if test "x$CURL_DISABLE_FILE" != "x1"; then
   3721   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS FILE"
   3722 fi
   3723 if test "x$CURL_DISABLE_TELNET" != "x1"; then
   3724   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
   3725 fi
   3726 if test "x$CURL_DISABLE_LDAP" != "x1"; then
   3727   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
   3728   if test "x$CURL_DISABLE_LDAPS" != "x1"; then
   3729     if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
   3730       (test "x$USE_OPENLDAP" != "x1"  && test "x$HAVE_LDAP_SSL" = "x1"); then
   3731       SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
   3732     fi
   3733   fi
   3734 fi
   3735 if test "x$CURL_DISABLE_DICT" != "x1"; then
   3736   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS DICT"
   3737 fi
   3738 if test "x$CURL_DISABLE_TFTP" != "x1"; then
   3739   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TFTP"
   3740 fi
   3741 if test "x$CURL_DISABLE_GOPHER" != "x1"; then
   3742   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS GOPHER"
   3743 fi
   3744 if test "x$CURL_DISABLE_POP3" != "x1"; then
   3745   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3"
   3746   if test "x$SSL_ENABLED" = "x1"; then
   3747     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS POP3S"
   3748   fi
   3749 fi
   3750 if test "x$CURL_DISABLE_IMAP" != "x1"; then
   3751   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAP"
   3752   if test "x$SSL_ENABLED" = "x1"; then
   3753     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS IMAPS"
   3754   fi
   3755 fi
   3756 if test "x$CURL_DISABLE_SMB" != "x1" \
   3757     -a "x$CURL_DISABLE_CRYPTO_AUTH" != "x1" \
   3758     -a \( "x$OPENSSL_ENABLED" = "x1" -o "x$USE_WINDOWS_SSPI" = "x1" \
   3759       -o "x$GNUTLS_ENABLED" = "x1" -o "x$NSS_ENABLED" = "x1" \
   3760       -o "x$DARWINSSL_ENABLED" = "x1" \); then
   3761   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMB"
   3762   if test "x$SSL_ENABLED" = "x1"; then
   3763     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMBS"
   3764   fi
   3765 fi
   3766 if test "x$CURL_DISABLE_SMTP" != "x1"; then
   3767   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTP"
   3768   if test "x$SSL_ENABLED" = "x1"; then
   3769     SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SMTPS"
   3770   fi
   3771 fi
   3772 if test "x$USE_LIBSSH2" = "x1"; then
   3773   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SCP"
   3774   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS SFTP"
   3775 fi
   3776 if test "x$CURL_DISABLE_RTSP" != "x1"; then
   3777   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTSP"
   3778 fi
   3779 if test "x$USE_LIBRTMP" = "x1"; then
   3780   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS RTMP"
   3781 fi
   3782 
   3783 dnl replace spaces with newlines
   3784 dnl sort the lines
   3785 dnl replace the newlines back to spaces
   3786 SUPPORT_PROTOCOLS=`echo $SUPPORT_PROTOCOLS | tr ' ' '\012' | sort | tr '\012' ' '`
   3787 
   3788 AC_SUBST(SUPPORT_PROTOCOLS)
   3789 
   3790 dnl squeeze whitespace out of some variables
   3791 
   3792 squeeze CFLAGS
   3793 squeeze CPPFLAGS
   3794 squeeze DEFS
   3795 squeeze LDFLAGS
   3796 squeeze LIBS
   3797 
   3798 squeeze LIBCURL_LIBS
   3799 squeeze CURL_NETWORK_LIBS
   3800 squeeze CURL_NETWORK_AND_TIME_LIBS
   3801 
   3802 squeeze SUPPORT_FEATURES
   3803 squeeze SUPPORT_PROTOCOLS
   3804 
   3805 XC_CHECK_BUILD_FLAGS
   3806 
   3807 if test "x$want_curldebug_assumed" = "xyes" &&
   3808   test "x$want_curldebug" = "xyes" && test "x$USE_ARES" = "x1"; then
   3809   ac_configure_args="$ac_configure_args --enable-curldebug"
   3810 fi
   3811 
   3812 AC_CONFIG_FILES([Makefile \
   3813            docs/Makefile \
   3814            docs/examples/Makefile \
   3815            docs/libcurl/Makefile \
   3816            docs/libcurl/opts/Makefile \
   3817            include/Makefile \
   3818            include/curl/Makefile \
   3819            src/Makefile \
   3820            lib/Makefile \
   3821            scripts/Makefile \
   3822            lib/libcurl.vers \
   3823            tests/Makefile \
   3824            tests/certs/Makefile \
   3825            tests/certs/scripts/Makefile \
   3826            tests/data/Makefile \
   3827            tests/server/Makefile \
   3828            tests/libtest/Makefile \
   3829            tests/unit/Makefile \
   3830            packages/Makefile \
   3831            packages/Win32/Makefile \
   3832            packages/Win32/cygwin/Makefile \
   3833            packages/Linux/Makefile \
   3834            packages/Linux/RPM/Makefile \
   3835            packages/Linux/RPM/curl.spec \
   3836            packages/Linux/RPM/curl-ssl.spec \
   3837            packages/Solaris/Makefile \
   3838            packages/EPM/curl.list \
   3839            packages/EPM/Makefile \
   3840            packages/vms/Makefile \
   3841            packages/AIX/Makefile \
   3842            packages/AIX/RPM/Makefile \
   3843            packages/AIX/RPM/curl.spec \
   3844            curl-config \
   3845            libcurl.pc
   3846 ])
   3847 AC_OUTPUT
   3848 
   3849 CURL_GENERATE_CONFIGUREHELP_PM
   3850 
   3851 XC_AMEND_DISTCLEAN([lib src tests/unit tests/server tests/libtest docs/examples])
   3852 
   3853 AC_MSG_NOTICE([Configured to build curl/libcurl:
   3854 
   3855   curl version:     ${CURLVERSION}
   3856   Host setup:       ${host}
   3857   Install prefix:   ${prefix}
   3858   Compiler:         ${CC}
   3859   SSL support:      ${curl_ssl_msg}
   3860   SSH support:      ${curl_ssh_msg}
   3861   zlib support:     ${curl_zlib_msg}
   3862   GSS-API support:  ${curl_gss_msg}
   3863   TLS-SRP support:  ${curl_tls_srp_msg}
   3864   resolver:         ${curl_res_msg}
   3865   IPv6 support:     ${curl_ipv6_msg}
   3866   Unix sockets support: ${curl_unix_sockets_msg}
   3867   IDN support:      ${curl_idn_msg}
   3868   Build libcurl:    Shared=${enable_shared}, Static=${enable_static}
   3869   Built-in manual:  ${curl_manual_msg}
   3870   --libcurl option: ${curl_libcurl_msg}
   3871   Verbose errors:   ${curl_verbose_msg}
   3872   SSPI support:     ${curl_sspi_msg}
   3873   ca cert bundle:   ${ca}${ca_warning}
   3874   ca cert path:     ${capath}${capath_warning}
   3875   ca fallback:      ${with_ca_fallback}
   3876   LDAP support:     ${curl_ldap_msg}
   3877   LDAPS support:    ${curl_ldaps_msg}
   3878   RTSP support:     ${curl_rtsp_msg}
   3879   RTMP support:     ${curl_rtmp_msg}
   3880   metalink support: ${curl_mtlnk_msg}
   3881   PSL support:      ${curl_psl_msg}
   3882   HTTP2 support:    ${curl_h2_msg}
   3883   Protocols:        ${SUPPORT_PROTOCOLS}
   3884 ])
   3885 
   3886 if test "x$soname_bump" = "xyes"; then
   3887 
   3888 cat <<EOM
   3889   SONAME bump:     yes - WARNING: this library will be built with the SONAME
   3890                    number bumped due to (a detected) ABI breakage.
   3891                    See lib/README.curl_off_t for details on this.
   3892 EOM
   3893 
   3894 fi
   3895 
   3896