configure.ac 127 KB

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