configure.ac 114 KB

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