configure.ac 152 KB

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