curl-functions.m4 159 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000
  1. #***************************************************************************
  2. # _ _ ____ _
  3. # Project ___| | | | _ \| |
  4. # / __| | | | |_) | |
  5. # | (__| |_| | _ <| |___
  6. # \___|\___/|_| \_\_____|
  7. #
  8. # Copyright (C) 1998 - 2022, 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.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. # SPDX-License-Identifier: curl
  22. #
  23. #***************************************************************************
  24. # File version for 'aclocal' use. Keep it a single number.
  25. # serial 73
  26. dnl CURL_INCLUDES_ARPA_INET
  27. dnl -------------------------------------------------
  28. dnl Set up variable with list of headers that must be
  29. dnl included when arpa/inet.h is to be included.
  30. AC_DEFUN([CURL_INCLUDES_ARPA_INET], [
  31. curl_includes_arpa_inet="\
  32. /* includes start */
  33. #ifdef HAVE_SYS_TYPES_H
  34. # include <sys/types.h>
  35. #endif
  36. #ifdef HAVE_SYS_SOCKET_H
  37. # include <sys/socket.h>
  38. #endif
  39. #ifdef HAVE_NETINET_IN_H
  40. # include <netinet/in.h>
  41. #endif
  42. #ifdef HAVE_ARPA_INET_H
  43. # include <arpa/inet.h>
  44. #endif
  45. #ifdef HAVE_WINSOCK2_H
  46. #include <winsock2.h>
  47. #include <ws2tcpip.h>
  48. #endif
  49. /* includes end */"
  50. AC_CHECK_HEADERS(
  51. sys/types.h sys/socket.h netinet/in.h arpa/inet.h,
  52. [], [], [$curl_includes_arpa_inet])
  53. ])
  54. dnl CURL_INCLUDES_FCNTL
  55. dnl -------------------------------------------------
  56. dnl Set up variable with list of headers that must be
  57. dnl included when fcntl.h is to be included.
  58. AC_DEFUN([CURL_INCLUDES_FCNTL], [
  59. curl_includes_fcntl="\
  60. /* includes start */
  61. #ifdef HAVE_SYS_TYPES_H
  62. # include <sys/types.h>
  63. #endif
  64. #ifdef HAVE_UNISTD_H
  65. # include <unistd.h>
  66. #endif
  67. #ifdef HAVE_FCNTL_H
  68. # include <fcntl.h>
  69. #endif
  70. /* includes end */"
  71. AC_CHECK_HEADERS(
  72. sys/types.h unistd.h fcntl.h,
  73. [], [], [$curl_includes_fcntl])
  74. ])
  75. dnl CURL_INCLUDES_IFADDRS
  76. dnl -------------------------------------------------
  77. dnl Set up variable with list of headers that must be
  78. dnl included when ifaddrs.h is to be included.
  79. AC_DEFUN([CURL_INCLUDES_IFADDRS], [
  80. curl_includes_ifaddrs="\
  81. /* includes start */
  82. #ifdef HAVE_SYS_TYPES_H
  83. # include <sys/types.h>
  84. #endif
  85. #ifdef HAVE_SYS_SOCKET_H
  86. # include <sys/socket.h>
  87. #endif
  88. #ifdef HAVE_NETINET_IN_H
  89. # include <netinet/in.h>
  90. #endif
  91. #ifdef HAVE_IFADDRS_H
  92. # include <ifaddrs.h>
  93. #endif
  94. /* includes end */"
  95. AC_CHECK_HEADERS(
  96. sys/types.h sys/socket.h netinet/in.h ifaddrs.h,
  97. [], [], [$curl_includes_ifaddrs])
  98. ])
  99. dnl CURL_INCLUDES_INTTYPES
  100. dnl -------------------------------------------------
  101. dnl Set up variable with list of headers that must be
  102. dnl included when inttypes.h is to be included.
  103. AC_DEFUN([CURL_INCLUDES_INTTYPES], [
  104. curl_includes_inttypes="\
  105. /* includes start */
  106. #ifdef HAVE_SYS_TYPES_H
  107. # include <sys/types.h>
  108. #endif
  109. #ifdef HAVE_STDINT_H
  110. # include <stdint.h>
  111. #endif
  112. #ifdef HAVE_INTTYPES_H
  113. # include <inttypes.h>
  114. #endif
  115. /* includes end */"
  116. case $host_os in
  117. irix*)
  118. ac_cv_header_stdint_h="no"
  119. ;;
  120. esac
  121. AC_CHECK_HEADERS(
  122. sys/types.h stdint.h inttypes.h,
  123. [], [], [$curl_includes_inttypes])
  124. ])
  125. dnl CURL_INCLUDES_LIBGEN
  126. dnl -------------------------------------------------
  127. dnl Set up variable with list of headers that must be
  128. dnl included when libgen.h is to be included.
  129. AC_DEFUN([CURL_INCLUDES_LIBGEN], [
  130. curl_includes_libgen="\
  131. /* includes start */
  132. #ifdef HAVE_SYS_TYPES_H
  133. # include <sys/types.h>
  134. #endif
  135. #ifdef HAVE_LIBGEN_H
  136. # include <libgen.h>
  137. #endif
  138. /* includes end */"
  139. AC_CHECK_HEADERS(
  140. sys/types.h libgen.h,
  141. [], [], [$curl_includes_libgen])
  142. ])
  143. dnl CURL_INCLUDES_NETDB
  144. dnl -------------------------------------------------
  145. dnl Set up variable with list of headers that must be
  146. dnl included when netdb.h is to be included.
  147. AC_DEFUN([CURL_INCLUDES_NETDB], [
  148. curl_includes_netdb="\
  149. /* includes start */
  150. #ifdef HAVE_SYS_TYPES_H
  151. # include <sys/types.h>
  152. #endif
  153. #ifdef HAVE_NETDB_H
  154. # include <netdb.h>
  155. #endif
  156. /* includes end */"
  157. AC_CHECK_HEADERS(
  158. sys/types.h netdb.h,
  159. [], [], [$curl_includes_netdb])
  160. ])
  161. dnl CURL_INCLUDES_POLL
  162. dnl -------------------------------------------------
  163. dnl Set up variable with list of headers that must be
  164. dnl included when poll.h is to be included.
  165. AC_DEFUN([CURL_INCLUDES_POLL], [
  166. curl_includes_poll="\
  167. /* includes start */
  168. #ifdef HAVE_SYS_TYPES_H
  169. # include <sys/types.h>
  170. #endif
  171. #ifdef HAVE_POLL_H
  172. # include <poll.h>
  173. #endif
  174. #ifdef HAVE_SYS_POLL_H
  175. # include <sys/poll.h>
  176. #endif
  177. /* includes end */"
  178. AC_CHECK_HEADERS(
  179. sys/types.h poll.h sys/poll.h,
  180. [], [], [$curl_includes_poll])
  181. ])
  182. dnl CURL_INCLUDES_SETJMP
  183. dnl -------------------------------------------------
  184. dnl Set up variable with list of headers that must be
  185. dnl included when setjmp.h is to be included.
  186. AC_DEFUN([CURL_INCLUDES_SETJMP], [
  187. curl_includes_setjmp="\
  188. /* includes start */
  189. #ifdef HAVE_SYS_TYPES_H
  190. # include <sys/types.h>
  191. #endif
  192. #ifdef HAVE_SETJMP_H
  193. # include <setjmp.h>
  194. #endif
  195. /* includes end */"
  196. AC_CHECK_HEADERS(
  197. sys/types.h setjmp.h,
  198. [], [], [$curl_includes_setjmp])
  199. ])
  200. dnl CURL_INCLUDES_SIGNAL
  201. dnl -------------------------------------------------
  202. dnl Set up variable with list of headers that must be
  203. dnl included when signal.h is to be included.
  204. AC_DEFUN([CURL_INCLUDES_SIGNAL], [
  205. curl_includes_signal="\
  206. /* includes start */
  207. #ifdef HAVE_SYS_TYPES_H
  208. # include <sys/types.h>
  209. #endif
  210. #ifdef HAVE_SIGNAL_H
  211. # include <signal.h>
  212. #endif
  213. /* includes end */"
  214. AC_CHECK_HEADERS(
  215. sys/types.h signal.h,
  216. [], [], [$curl_includes_signal])
  217. ])
  218. dnl CURL_INCLUDES_SOCKET
  219. dnl -------------------------------------------------
  220. dnl Set up variable with list of headers that must be
  221. dnl included when socket.h is to be included.
  222. AC_DEFUN([CURL_INCLUDES_SOCKET], [
  223. curl_includes_socket="\
  224. /* includes start */
  225. #ifdef HAVE_SYS_TYPES_H
  226. # include <sys/types.h>
  227. #endif
  228. #ifdef HAVE_SOCKET_H
  229. # include <socket.h>
  230. #endif
  231. /* includes end */"
  232. AC_CHECK_HEADERS(
  233. sys/types.h socket.h,
  234. [], [], [$curl_includes_socket])
  235. ])
  236. dnl CURL_INCLUDES_STDLIB
  237. dnl -------------------------------------------------
  238. dnl Set up variable with list of headers that must be
  239. dnl included when stdlib.h is to be included.
  240. AC_DEFUN([CURL_INCLUDES_STDLIB], [
  241. curl_includes_stdlib="\
  242. /* includes start */
  243. #ifdef HAVE_SYS_TYPES_H
  244. # include <sys/types.h>
  245. #endif
  246. #ifdef HAVE_STDLIB_H
  247. # include <stdlib.h>
  248. #endif
  249. /* includes end */"
  250. AC_CHECK_HEADERS(
  251. sys/types.h stdlib.h,
  252. [], [], [$curl_includes_stdlib])
  253. ])
  254. dnl CURL_INCLUDES_STRING
  255. dnl -------------------------------------------------
  256. dnl Set up variable with list of headers that must be
  257. dnl included when string(s).h is to be included.
  258. AC_DEFUN([CURL_INCLUDES_STRING], [
  259. curl_includes_string="\
  260. /* includes start */
  261. #ifdef HAVE_SYS_TYPES_H
  262. # include <sys/types.h>
  263. #endif
  264. #ifdef HAVE_STRING_H
  265. # include <string.h>
  266. #endif
  267. #ifdef HAVE_STRINGS_H
  268. # include <strings.h>
  269. #endif
  270. /* includes end */"
  271. AC_CHECK_HEADERS(
  272. sys/types.h string.h strings.h,
  273. [], [], [$curl_includes_string])
  274. ])
  275. dnl CURL_INCLUDES_STROPTS
  276. dnl -------------------------------------------------
  277. dnl Set up variable with list of headers that must be
  278. dnl included when stropts.h is to be included.
  279. AC_DEFUN([CURL_INCLUDES_STROPTS], [
  280. curl_includes_stropts="\
  281. /* includes start */
  282. #ifdef HAVE_SYS_TYPES_H
  283. # include <sys/types.h>
  284. #endif
  285. #ifdef HAVE_UNISTD_H
  286. # include <unistd.h>
  287. #endif
  288. #ifdef HAVE_SYS_SOCKET_H
  289. # include <sys/socket.h>
  290. #endif
  291. #ifdef HAVE_SYS_IOCTL_H
  292. # include <sys/ioctl.h>
  293. #endif
  294. #ifdef HAVE_STROPTS_H
  295. # include <stropts.h>
  296. #endif
  297. /* includes end */"
  298. AC_CHECK_HEADERS(
  299. sys/types.h unistd.h sys/socket.h sys/ioctl.h stropts.h,
  300. [], [], [$curl_includes_stropts])
  301. ])
  302. dnl CURL_INCLUDES_SYS_SOCKET
  303. dnl -------------------------------------------------
  304. dnl Set up variable with list of headers that must be
  305. dnl included when sys/socket.h is to be included.
  306. AC_DEFUN([CURL_INCLUDES_SYS_SOCKET], [
  307. curl_includes_sys_socket="\
  308. /* includes start */
  309. #ifdef HAVE_SYS_TYPES_H
  310. # include <sys/types.h>
  311. #endif
  312. #ifdef HAVE_SYS_SOCKET_H
  313. # include <sys/socket.h>
  314. #endif
  315. /* includes end */"
  316. AC_CHECK_HEADERS(
  317. sys/types.h sys/socket.h,
  318. [], [], [$curl_includes_sys_socket])
  319. ])
  320. dnl CURL_INCLUDES_SYS_TYPES
  321. dnl -------------------------------------------------
  322. dnl Set up variable with list of headers that must be
  323. dnl included when sys/types.h is to be included.
  324. AC_DEFUN([CURL_INCLUDES_SYS_TYPES], [
  325. curl_includes_sys_types="\
  326. /* includes start */
  327. #ifdef HAVE_SYS_TYPES_H
  328. # include <sys/types.h>
  329. #endif
  330. /* includes end */"
  331. AC_CHECK_HEADERS(
  332. sys/types.h,
  333. [], [], [$curl_includes_sys_types])
  334. ])
  335. dnl CURL_INCLUDES_SYS_UIO
  336. dnl -------------------------------------------------
  337. dnl Set up variable with list of headers that must be
  338. dnl included when sys/uio.h is to be included.
  339. AC_DEFUN([CURL_INCLUDES_SYS_UIO], [
  340. curl_includes_sys_uio="\
  341. /* includes start */
  342. #ifdef HAVE_SYS_TYPES_H
  343. # include <sys/types.h>
  344. #endif
  345. #ifdef HAVE_SYS_UIO_H
  346. # include <sys/uio.h>
  347. #endif
  348. /* includes end */"
  349. AC_CHECK_HEADERS(
  350. sys/types.h sys/uio.h,
  351. [], [], [$curl_includes_sys_uio])
  352. ])
  353. dnl CURL_INCLUDES_SYS_XATTR
  354. dnl -------------------------------------------------
  355. dnl Set up variable with list of headers that must be
  356. dnl included when sys/xattr.h is to be included.
  357. AC_DEFUN([CURL_INCLUDES_SYS_XATTR], [
  358. curl_includes_sys_xattr="\
  359. /* includes start */
  360. #ifdef HAVE_SYS_TYPES_H
  361. # include <sys/types.h>
  362. #endif
  363. #ifdef HAVE_SYS_XATTR_H
  364. # include <sys/xattr.h>
  365. #endif
  366. /* includes end */"
  367. AC_CHECK_HEADERS(
  368. sys/types.h sys/xattr.h,
  369. [], [], [$curl_includes_sys_xattr])
  370. ])
  371. dnl CURL_INCLUDES_TIME
  372. dnl -------------------------------------------------
  373. dnl Set up variable with list of headers that must be
  374. dnl included when time.h is to be included.
  375. AC_DEFUN([CURL_INCLUDES_TIME], [
  376. curl_includes_time="\
  377. /* includes start */
  378. #ifdef HAVE_SYS_TYPES_H
  379. # include <sys/types.h>
  380. #endif
  381. #ifdef HAVE_SYS_TIME_H
  382. # include <sys/time.h>
  383. #endif
  384. #include <time.h>
  385. /* includes end */"
  386. AC_CHECK_HEADERS(
  387. sys/types.h sys/time.h,
  388. [], [], [$curl_includes_time])
  389. ])
  390. dnl CURL_INCLUDES_UNISTD
  391. dnl -------------------------------------------------
  392. dnl Set up variable with list of headers that must be
  393. dnl included when unistd.h is to be included.
  394. AC_DEFUN([CURL_INCLUDES_UNISTD], [
  395. curl_includes_unistd="\
  396. /* includes start */
  397. #ifdef HAVE_SYS_TYPES_H
  398. # include <sys/types.h>
  399. #endif
  400. #ifdef HAVE_UNISTD_H
  401. # include <unistd.h>
  402. #endif
  403. /* includes end */"
  404. AC_CHECK_HEADERS(
  405. sys/types.h unistd.h,
  406. [], [], [$curl_includes_unistd])
  407. ])
  408. dnl CURL_INCLUDES_WINSOCK2
  409. dnl -------------------------------------------------
  410. dnl Set up variable with list of headers that must be
  411. dnl included when winsock2.h is to be included.
  412. AC_DEFUN([CURL_INCLUDES_WINSOCK2], [
  413. curl_includes_winsock2="\
  414. /* includes start */
  415. #ifdef HAVE_WINDOWS_H
  416. # ifndef WIN32_LEAN_AND_MEAN
  417. # define WIN32_LEAN_AND_MEAN
  418. # endif
  419. # include <windows.h>
  420. # ifdef HAVE_WINSOCK2_H
  421. # include <winsock2.h>
  422. # endif
  423. #endif
  424. /* includes end */"
  425. CURL_CHECK_HEADER_WINDOWS
  426. CURL_CHECK_HEADER_WINSOCK2
  427. ])
  428. dnl CURL_INCLUDES_WS2TCPIP
  429. dnl -------------------------------------------------
  430. dnl Set up variable with list of headers that must be
  431. dnl included when ws2tcpip.h is to be included.
  432. AC_DEFUN([CURL_INCLUDES_WS2TCPIP], [
  433. curl_includes_ws2tcpip="\
  434. /* includes start */
  435. #ifdef HAVE_WINDOWS_H
  436. # ifndef WIN32_LEAN_AND_MEAN
  437. # define WIN32_LEAN_AND_MEAN
  438. # endif
  439. # include <windows.h>
  440. # ifdef HAVE_WINSOCK2_H
  441. # include <winsock2.h>
  442. # ifdef HAVE_WS2TCPIP_H
  443. # include <ws2tcpip.h>
  444. # endif
  445. # endif
  446. #endif
  447. /* includes end */"
  448. CURL_CHECK_HEADER_WINDOWS
  449. CURL_CHECK_HEADER_WINSOCK2
  450. CURL_CHECK_HEADER_WS2TCPIP
  451. ])
  452. dnl CURL_INCLUDES_BSDSOCKET
  453. dnl -------------------------------------------------
  454. dnl Set up variable with list of headers that must be
  455. dnl included when bsdsocket.h is to be included.
  456. AC_DEFUN([CURL_INCLUDES_BSDSOCKET], [
  457. curl_includes_bsdsocket="\
  458. /* includes start */
  459. #if defined(HAVE_PROTO_BSDSOCKET_H)
  460. # define __NO_NET_API
  461. # define __USE_INLINE__
  462. # include <proto/bsdsocket.h>
  463. # ifdef HAVE_SYS_IOCTL_H
  464. # include <sys/ioctl.h>
  465. # endif
  466. # ifdef __amigaos4__
  467. struct SocketIFace *ISocket = NULL;
  468. # else
  469. struct Library *SocketBase = NULL;
  470. # endif
  471. # define select(a,b,c,d,e) WaitSelect(a,b,c,d,e,0)
  472. #endif
  473. /* includes end */"
  474. AC_CHECK_HEADERS(
  475. proto/bsdsocket.h,
  476. [], [], [$curl_includes_bsdsocket])
  477. ])
  478. dnl CURL_INCLUDES_NETIF
  479. dnl -------------------------------------------------
  480. dnl Set up variable with list of headers that must be
  481. dnl included when net/if.h is to be included.
  482. AC_DEFUN([CURL_INCLUDES_NETIF], [
  483. curl_includes_netif="\
  484. /* includes start */
  485. #ifdef HAVE_NET_IF_H
  486. # include <net/if.h>
  487. #endif
  488. /* includes end */"
  489. AC_CHECK_HEADERS(
  490. net/if.h,
  491. [], [], [$curl_includes_netif])
  492. ])
  493. dnl CURL_PREPROCESS_CALLCONV
  494. dnl -------------------------------------------------
  495. dnl Set up variable with a preprocessor block which
  496. dnl defines function calling convention.
  497. AC_DEFUN([CURL_PREPROCESS_CALLCONV], [
  498. curl_preprocess_callconv="\
  499. /* preprocess start */
  500. #ifdef HAVE_WINDOWS_H
  501. # define FUNCALLCONV __stdcall
  502. #else
  503. # define FUNCALLCONV
  504. #endif
  505. /* preprocess end */"
  506. ])
  507. dnl CURL_CHECK_FUNC_ALARM
  508. dnl -------------------------------------------------
  509. dnl Verify if alarm is available, prototyped, and
  510. dnl can be compiled. If all of these are true, and
  511. dnl usage has not been previously disallowed with
  512. dnl shell variable curl_disallow_alarm, then
  513. dnl HAVE_ALARM will be defined.
  514. AC_DEFUN([CURL_CHECK_FUNC_ALARM], [
  515. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  516. #
  517. tst_links_alarm="unknown"
  518. tst_proto_alarm="unknown"
  519. tst_compi_alarm="unknown"
  520. tst_allow_alarm="unknown"
  521. #
  522. AC_MSG_CHECKING([if alarm can be linked])
  523. AC_LINK_IFELSE([
  524. AC_LANG_FUNC_LINK_TRY([alarm])
  525. ],[
  526. AC_MSG_RESULT([yes])
  527. tst_links_alarm="yes"
  528. ],[
  529. AC_MSG_RESULT([no])
  530. tst_links_alarm="no"
  531. ])
  532. #
  533. if test "$tst_links_alarm" = "yes"; then
  534. AC_MSG_CHECKING([if alarm is prototyped])
  535. AC_EGREP_CPP([alarm],[
  536. $curl_includes_unistd
  537. ],[
  538. AC_MSG_RESULT([yes])
  539. tst_proto_alarm="yes"
  540. ],[
  541. AC_MSG_RESULT([no])
  542. tst_proto_alarm="no"
  543. ])
  544. fi
  545. #
  546. if test "$tst_proto_alarm" = "yes"; then
  547. AC_MSG_CHECKING([if alarm is compilable])
  548. AC_COMPILE_IFELSE([
  549. AC_LANG_PROGRAM([[
  550. $curl_includes_unistd
  551. ]],[[
  552. if(0 != alarm(0))
  553. return 1;
  554. ]])
  555. ],[
  556. AC_MSG_RESULT([yes])
  557. tst_compi_alarm="yes"
  558. ],[
  559. AC_MSG_RESULT([no])
  560. tst_compi_alarm="no"
  561. ])
  562. fi
  563. #
  564. if test "$tst_compi_alarm" = "yes"; then
  565. AC_MSG_CHECKING([if alarm usage allowed])
  566. if test "x$curl_disallow_alarm" != "xyes"; then
  567. AC_MSG_RESULT([yes])
  568. tst_allow_alarm="yes"
  569. else
  570. AC_MSG_RESULT([no])
  571. tst_allow_alarm="no"
  572. fi
  573. fi
  574. #
  575. AC_MSG_CHECKING([if alarm might be used])
  576. if test "$tst_links_alarm" = "yes" &&
  577. test "$tst_proto_alarm" = "yes" &&
  578. test "$tst_compi_alarm" = "yes" &&
  579. test "$tst_allow_alarm" = "yes"; then
  580. AC_MSG_RESULT([yes])
  581. AC_DEFINE_UNQUOTED(HAVE_ALARM, 1,
  582. [Define to 1 if you have the alarm function.])
  583. curl_cv_func_alarm="yes"
  584. else
  585. AC_MSG_RESULT([no])
  586. curl_cv_func_alarm="no"
  587. fi
  588. ])
  589. dnl CURL_CHECK_FUNC_BASENAME
  590. dnl -------------------------------------------------
  591. dnl Verify if basename is available, prototyped, and
  592. dnl can be compiled. If all of these are true, and
  593. dnl usage has not been previously disallowed with
  594. dnl shell variable curl_disallow_basename, then
  595. dnl HAVE_BASENAME will be defined.
  596. AC_DEFUN([CURL_CHECK_FUNC_BASENAME], [
  597. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  598. AC_REQUIRE([CURL_INCLUDES_LIBGEN])dnl
  599. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  600. #
  601. tst_links_basename="unknown"
  602. tst_proto_basename="unknown"
  603. tst_compi_basename="unknown"
  604. tst_allow_basename="unknown"
  605. #
  606. AC_MSG_CHECKING([if basename can be linked])
  607. AC_LINK_IFELSE([
  608. AC_LANG_FUNC_LINK_TRY([basename])
  609. ],[
  610. AC_MSG_RESULT([yes])
  611. tst_links_basename="yes"
  612. ],[
  613. AC_MSG_RESULT([no])
  614. tst_links_basename="no"
  615. ])
  616. #
  617. if test "$tst_links_basename" = "yes"; then
  618. AC_MSG_CHECKING([if basename is prototyped])
  619. AC_EGREP_CPP([basename],[
  620. $curl_includes_string
  621. $curl_includes_libgen
  622. $curl_includes_unistd
  623. ],[
  624. AC_MSG_RESULT([yes])
  625. tst_proto_basename="yes"
  626. ],[
  627. AC_MSG_RESULT([no])
  628. tst_proto_basename="no"
  629. ])
  630. fi
  631. #
  632. if test "$tst_proto_basename" = "yes"; then
  633. AC_MSG_CHECKING([if basename is compilable])
  634. AC_COMPILE_IFELSE([
  635. AC_LANG_PROGRAM([[
  636. $curl_includes_string
  637. $curl_includes_libgen
  638. $curl_includes_unistd
  639. ]],[[
  640. if(0 != basename(0))
  641. return 1;
  642. ]])
  643. ],[
  644. AC_MSG_RESULT([yes])
  645. tst_compi_basename="yes"
  646. ],[
  647. AC_MSG_RESULT([no])
  648. tst_compi_basename="no"
  649. ])
  650. fi
  651. #
  652. if test "$tst_compi_basename" = "yes"; then
  653. AC_MSG_CHECKING([if basename usage allowed])
  654. if test "x$curl_disallow_basename" != "xyes"; then
  655. AC_MSG_RESULT([yes])
  656. tst_allow_basename="yes"
  657. else
  658. AC_MSG_RESULT([no])
  659. tst_allow_basename="no"
  660. fi
  661. fi
  662. #
  663. AC_MSG_CHECKING([if basename might be used])
  664. if test "$tst_links_basename" = "yes" &&
  665. test "$tst_proto_basename" = "yes" &&
  666. test "$tst_compi_basename" = "yes" &&
  667. test "$tst_allow_basename" = "yes"; then
  668. AC_MSG_RESULT([yes])
  669. AC_DEFINE_UNQUOTED(HAVE_BASENAME, 1,
  670. [Define to 1 if you have the basename function.])
  671. curl_cv_func_basename="yes"
  672. else
  673. AC_MSG_RESULT([no])
  674. curl_cv_func_basename="no"
  675. fi
  676. ])
  677. dnl CURL_CHECK_FUNC_CLOSESOCKET
  678. dnl -------------------------------------------------
  679. dnl Verify if closesocket is available, prototyped, and
  680. dnl can be compiled. If all of these are true, and
  681. dnl usage has not been previously disallowed with
  682. dnl shell variable curl_disallow_closesocket, then
  683. dnl HAVE_CLOSESOCKET will be defined.
  684. AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET], [
  685. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  686. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  687. #
  688. tst_links_closesocket="unknown"
  689. tst_proto_closesocket="unknown"
  690. tst_compi_closesocket="unknown"
  691. tst_allow_closesocket="unknown"
  692. #
  693. AC_MSG_CHECKING([if closesocket can be linked])
  694. AC_LINK_IFELSE([
  695. AC_LANG_PROGRAM([[
  696. $curl_includes_winsock2
  697. $curl_includes_socket
  698. ]],[[
  699. if(0 != closesocket(0))
  700. return 1;
  701. ]])
  702. ],[
  703. AC_MSG_RESULT([yes])
  704. tst_links_closesocket="yes"
  705. ],[
  706. AC_MSG_RESULT([no])
  707. tst_links_closesocket="no"
  708. ])
  709. #
  710. if test "$tst_links_closesocket" = "yes"; then
  711. AC_MSG_CHECKING([if closesocket is prototyped])
  712. AC_EGREP_CPP([closesocket],[
  713. $curl_includes_winsock2
  714. $curl_includes_socket
  715. ],[
  716. AC_MSG_RESULT([yes])
  717. tst_proto_closesocket="yes"
  718. ],[
  719. AC_MSG_RESULT([no])
  720. tst_proto_closesocket="no"
  721. ])
  722. fi
  723. #
  724. if test "$tst_proto_closesocket" = "yes"; then
  725. AC_MSG_CHECKING([if closesocket is compilable])
  726. AC_COMPILE_IFELSE([
  727. AC_LANG_PROGRAM([[
  728. $curl_includes_winsock2
  729. $curl_includes_socket
  730. ]],[[
  731. if(0 != closesocket(0))
  732. return 1;
  733. ]])
  734. ],[
  735. AC_MSG_RESULT([yes])
  736. tst_compi_closesocket="yes"
  737. ],[
  738. AC_MSG_RESULT([no])
  739. tst_compi_closesocket="no"
  740. ])
  741. fi
  742. #
  743. if test "$tst_compi_closesocket" = "yes"; then
  744. AC_MSG_CHECKING([if closesocket usage allowed])
  745. if test "x$curl_disallow_closesocket" != "xyes"; then
  746. AC_MSG_RESULT([yes])
  747. tst_allow_closesocket="yes"
  748. else
  749. AC_MSG_RESULT([no])
  750. tst_allow_closesocket="no"
  751. fi
  752. fi
  753. #
  754. AC_MSG_CHECKING([if closesocket might be used])
  755. if test "$tst_links_closesocket" = "yes" &&
  756. test "$tst_proto_closesocket" = "yes" &&
  757. test "$tst_compi_closesocket" = "yes" &&
  758. test "$tst_allow_closesocket" = "yes"; then
  759. AC_MSG_RESULT([yes])
  760. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET, 1,
  761. [Define to 1 if you have the closesocket function.])
  762. curl_cv_func_closesocket="yes"
  763. else
  764. AC_MSG_RESULT([no])
  765. curl_cv_func_closesocket="no"
  766. fi
  767. ])
  768. dnl CURL_CHECK_FUNC_CLOSESOCKET_CAMEL
  769. dnl -------------------------------------------------
  770. dnl Verify if CloseSocket is available, prototyped, and
  771. dnl can be compiled. If all of these are true, and
  772. dnl usage has not been previously disallowed with
  773. dnl shell variable curl_disallow_closesocket_camel,
  774. dnl then HAVE_CLOSESOCKET_CAMEL will be defined.
  775. AC_DEFUN([CURL_CHECK_FUNC_CLOSESOCKET_CAMEL], [
  776. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  777. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  778. #
  779. tst_links_closesocket_camel="unknown"
  780. tst_proto_closesocket_camel="unknown"
  781. tst_compi_closesocket_camel="unknown"
  782. tst_allow_closesocket_camel="unknown"
  783. #
  784. AC_MSG_CHECKING([if CloseSocket can be linked])
  785. AC_LINK_IFELSE([
  786. AC_LANG_PROGRAM([[
  787. $curl_includes_bsdsocket
  788. $curl_includes_sys_socket
  789. ]],[[
  790. if(0 != CloseSocket(0))
  791. return 1;
  792. ]])
  793. ],[
  794. AC_MSG_RESULT([yes])
  795. tst_links_closesocket_camel="yes"
  796. ],[
  797. AC_MSG_RESULT([no])
  798. tst_links_closesocket_camel="no"
  799. ])
  800. #
  801. if test "$tst_links_closesocket_camel" = "yes"; then
  802. AC_MSG_CHECKING([if CloseSocket is prototyped])
  803. AC_EGREP_CPP([CloseSocket],[
  804. $curl_includes_bsdsocket
  805. $curl_includes_sys_socket
  806. ],[
  807. AC_MSG_RESULT([yes])
  808. tst_proto_closesocket_camel="yes"
  809. ],[
  810. AC_MSG_RESULT([no])
  811. tst_proto_closesocket_camel="no"
  812. ])
  813. fi
  814. #
  815. if test "$tst_proto_closesocket_camel" = "yes"; then
  816. AC_MSG_CHECKING([if CloseSocket is compilable])
  817. AC_COMPILE_IFELSE([
  818. AC_LANG_PROGRAM([[
  819. $curl_includes_bsdsocket
  820. $curl_includes_sys_socket
  821. ]],[[
  822. if(0 != CloseSocket(0))
  823. return 1;
  824. ]])
  825. ],[
  826. AC_MSG_RESULT([yes])
  827. tst_compi_closesocket_camel="yes"
  828. ],[
  829. AC_MSG_RESULT([no])
  830. tst_compi_closesocket_camel="no"
  831. ])
  832. fi
  833. #
  834. if test "$tst_compi_closesocket_camel" = "yes"; then
  835. AC_MSG_CHECKING([if CloseSocket usage allowed])
  836. if test "x$curl_disallow_closesocket_camel" != "xyes"; then
  837. AC_MSG_RESULT([yes])
  838. tst_allow_closesocket_camel="yes"
  839. else
  840. AC_MSG_RESULT([no])
  841. tst_allow_closesocket_camel="no"
  842. fi
  843. fi
  844. #
  845. AC_MSG_CHECKING([if CloseSocket might be used])
  846. if test "$tst_links_closesocket_camel" = "yes" &&
  847. test "$tst_proto_closesocket_camel" = "yes" &&
  848. test "$tst_compi_closesocket_camel" = "yes" &&
  849. test "$tst_allow_closesocket_camel" = "yes"; then
  850. AC_MSG_RESULT([yes])
  851. AC_DEFINE_UNQUOTED(HAVE_CLOSESOCKET_CAMEL, 1,
  852. [Define to 1 if you have the CloseSocket camel case function.])
  853. curl_cv_func_closesocket_camel="yes"
  854. else
  855. AC_MSG_RESULT([no])
  856. curl_cv_func_closesocket_camel="no"
  857. fi
  858. ])
  859. dnl CURL_CHECK_FUNC_CONNECT
  860. dnl -------------------------------------------------
  861. dnl Verify if connect is available, prototyped, and
  862. dnl can be compiled. If all of these are true, and
  863. dnl usage has not been previously disallowed with
  864. dnl shell variable curl_disallow_connect, then
  865. dnl HAVE_CONNECT will be defined.
  866. AC_DEFUN([CURL_CHECK_FUNC_CONNECT], [
  867. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  868. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  869. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  870. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  871. #
  872. tst_links_connect="unknown"
  873. tst_proto_connect="unknown"
  874. tst_compi_connect="unknown"
  875. tst_allow_connect="unknown"
  876. #
  877. AC_MSG_CHECKING([if connect can be linked])
  878. AC_LINK_IFELSE([
  879. AC_LANG_PROGRAM([[
  880. $curl_includes_winsock2
  881. $curl_includes_bsdsocket
  882. $curl_includes_sys_socket
  883. $curl_includes_socket
  884. ]],[[
  885. if(0 != connect(0, 0, 0))
  886. return 1;
  887. ]])
  888. ],[
  889. AC_MSG_RESULT([yes])
  890. tst_links_connect="yes"
  891. ],[
  892. AC_MSG_RESULT([no])
  893. tst_links_connect="no"
  894. ])
  895. #
  896. if test "$tst_links_connect" = "yes"; then
  897. AC_MSG_CHECKING([if connect is prototyped])
  898. AC_EGREP_CPP([connect],[
  899. $curl_includes_winsock2
  900. $curl_includes_bsdsocket
  901. $curl_includes_sys_socket
  902. $curl_includes_socket
  903. ],[
  904. AC_MSG_RESULT([yes])
  905. tst_proto_connect="yes"
  906. ],[
  907. AC_MSG_RESULT([no])
  908. tst_proto_connect="no"
  909. ])
  910. fi
  911. #
  912. if test "$tst_proto_connect" = "yes"; then
  913. AC_MSG_CHECKING([if connect is compilable])
  914. AC_COMPILE_IFELSE([
  915. AC_LANG_PROGRAM([[
  916. $curl_includes_winsock2
  917. $curl_includes_bsdsocket
  918. $curl_includes_sys_socket
  919. $curl_includes_socket
  920. ]],[[
  921. if(0 != connect(0, 0, 0))
  922. return 1;
  923. ]])
  924. ],[
  925. AC_MSG_RESULT([yes])
  926. tst_compi_connect="yes"
  927. ],[
  928. AC_MSG_RESULT([no])
  929. tst_compi_connect="no"
  930. ])
  931. fi
  932. #
  933. if test "$tst_compi_connect" = "yes"; then
  934. AC_MSG_CHECKING([if connect usage allowed])
  935. if test "x$curl_disallow_connect" != "xyes"; then
  936. AC_MSG_RESULT([yes])
  937. tst_allow_connect="yes"
  938. else
  939. AC_MSG_RESULT([no])
  940. tst_allow_connect="no"
  941. fi
  942. fi
  943. #
  944. AC_MSG_CHECKING([if connect might be used])
  945. if test "$tst_links_connect" = "yes" &&
  946. test "$tst_proto_connect" = "yes" &&
  947. test "$tst_compi_connect" = "yes" &&
  948. test "$tst_allow_connect" = "yes"; then
  949. AC_MSG_RESULT([yes])
  950. AC_DEFINE_UNQUOTED(HAVE_CONNECT, 1,
  951. [Define to 1 if you have the connect function.])
  952. curl_cv_func_connect="yes"
  953. else
  954. AC_MSG_RESULT([no])
  955. curl_cv_func_connect="no"
  956. fi
  957. ])
  958. dnl CURL_CHECK_FUNC_FCNTL
  959. dnl -------------------------------------------------
  960. dnl Verify if fcntl is available, prototyped, and
  961. dnl can be compiled. If all of these are true, and
  962. dnl usage has not been previously disallowed with
  963. dnl shell variable curl_disallow_fcntl, then
  964. dnl HAVE_FCNTL will be defined.
  965. AC_DEFUN([CURL_CHECK_FUNC_FCNTL], [
  966. AC_REQUIRE([CURL_INCLUDES_FCNTL])dnl
  967. #
  968. tst_links_fcntl="unknown"
  969. tst_proto_fcntl="unknown"
  970. tst_compi_fcntl="unknown"
  971. tst_allow_fcntl="unknown"
  972. #
  973. AC_MSG_CHECKING([if fcntl can be linked])
  974. AC_LINK_IFELSE([
  975. AC_LANG_FUNC_LINK_TRY([fcntl])
  976. ],[
  977. AC_MSG_RESULT([yes])
  978. tst_links_fcntl="yes"
  979. ],[
  980. AC_MSG_RESULT([no])
  981. tst_links_fcntl="no"
  982. ])
  983. #
  984. if test "$tst_links_fcntl" = "yes"; then
  985. AC_MSG_CHECKING([if fcntl is prototyped])
  986. AC_EGREP_CPP([fcntl],[
  987. $curl_includes_fcntl
  988. ],[
  989. AC_MSG_RESULT([yes])
  990. tst_proto_fcntl="yes"
  991. ],[
  992. AC_MSG_RESULT([no])
  993. tst_proto_fcntl="no"
  994. ])
  995. fi
  996. #
  997. if test "$tst_proto_fcntl" = "yes"; then
  998. AC_MSG_CHECKING([if fcntl is compilable])
  999. AC_COMPILE_IFELSE([
  1000. AC_LANG_PROGRAM([[
  1001. $curl_includes_fcntl
  1002. ]],[[
  1003. if(0 != fcntl(0, 0, 0))
  1004. return 1;
  1005. ]])
  1006. ],[
  1007. AC_MSG_RESULT([yes])
  1008. tst_compi_fcntl="yes"
  1009. ],[
  1010. AC_MSG_RESULT([no])
  1011. tst_compi_fcntl="no"
  1012. ])
  1013. fi
  1014. #
  1015. if test "$tst_compi_fcntl" = "yes"; then
  1016. AC_MSG_CHECKING([if fcntl usage allowed])
  1017. if test "x$curl_disallow_fcntl" != "xyes"; then
  1018. AC_MSG_RESULT([yes])
  1019. tst_allow_fcntl="yes"
  1020. else
  1021. AC_MSG_RESULT([no])
  1022. tst_allow_fcntl="no"
  1023. fi
  1024. fi
  1025. #
  1026. AC_MSG_CHECKING([if fcntl might be used])
  1027. if test "$tst_links_fcntl" = "yes" &&
  1028. test "$tst_proto_fcntl" = "yes" &&
  1029. test "$tst_compi_fcntl" = "yes" &&
  1030. test "$tst_allow_fcntl" = "yes"; then
  1031. AC_MSG_RESULT([yes])
  1032. AC_DEFINE_UNQUOTED(HAVE_FCNTL, 1,
  1033. [Define to 1 if you have the fcntl function.])
  1034. curl_cv_func_fcntl="yes"
  1035. CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
  1036. else
  1037. AC_MSG_RESULT([no])
  1038. curl_cv_func_fcntl="no"
  1039. fi
  1040. ])
  1041. dnl CURL_CHECK_FUNC_FCNTL_O_NONBLOCK
  1042. dnl -------------------------------------------------
  1043. dnl Verify if fcntl with status flag O_NONBLOCK is
  1044. dnl available, can be compiled, and seems to work. If
  1045. dnl all of these are true, then HAVE_FCNTL_O_NONBLOCK
  1046. dnl will be defined.
  1047. AC_DEFUN([CURL_CHECK_FUNC_FCNTL_O_NONBLOCK], [
  1048. #
  1049. tst_compi_fcntl_o_nonblock="unknown"
  1050. tst_allow_fcntl_o_nonblock="unknown"
  1051. #
  1052. case $host_os in
  1053. sunos4* | aix3*)
  1054. dnl O_NONBLOCK does not work on these platforms
  1055. curl_disallow_fcntl_o_nonblock="yes"
  1056. ;;
  1057. esac
  1058. #
  1059. if test "$curl_cv_func_fcntl" = "yes"; then
  1060. AC_MSG_CHECKING([if fcntl O_NONBLOCK is compilable])
  1061. AC_COMPILE_IFELSE([
  1062. AC_LANG_PROGRAM([[
  1063. $curl_includes_fcntl
  1064. ]],[[
  1065. int flags = 0;
  1066. if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK))
  1067. return 1;
  1068. ]])
  1069. ],[
  1070. AC_MSG_RESULT([yes])
  1071. tst_compi_fcntl_o_nonblock="yes"
  1072. ],[
  1073. AC_MSG_RESULT([no])
  1074. tst_compi_fcntl_o_nonblock="no"
  1075. ])
  1076. fi
  1077. #
  1078. if test "$tst_compi_fcntl_o_nonblock" = "yes"; then
  1079. AC_MSG_CHECKING([if fcntl O_NONBLOCK usage allowed])
  1080. if test "x$curl_disallow_fcntl_o_nonblock" != "xyes"; then
  1081. AC_MSG_RESULT([yes])
  1082. tst_allow_fcntl_o_nonblock="yes"
  1083. else
  1084. AC_MSG_RESULT([no])
  1085. tst_allow_fcntl_o_nonblock="no"
  1086. fi
  1087. fi
  1088. #
  1089. AC_MSG_CHECKING([if fcntl O_NONBLOCK might be used])
  1090. if test "$tst_compi_fcntl_o_nonblock" = "yes" &&
  1091. test "$tst_allow_fcntl_o_nonblock" = "yes"; then
  1092. AC_MSG_RESULT([yes])
  1093. AC_DEFINE_UNQUOTED(HAVE_FCNTL_O_NONBLOCK, 1,
  1094. [Define to 1 if you have a working fcntl O_NONBLOCK function.])
  1095. curl_cv_func_fcntl_o_nonblock="yes"
  1096. else
  1097. AC_MSG_RESULT([no])
  1098. curl_cv_func_fcntl_o_nonblock="no"
  1099. fi
  1100. ])
  1101. dnl CURL_CHECK_FUNC_FGETXATTR
  1102. dnl -------------------------------------------------
  1103. dnl Verify if fgetxattr is available, prototyped, and
  1104. dnl can be compiled. If all of these are true, and
  1105. dnl usage has not been previously disallowed with
  1106. dnl shell variable curl_disallow_fgetxattr, then
  1107. dnl HAVE_FGETXATTR will be defined.
  1108. AC_DEFUN([CURL_CHECK_FUNC_FGETXATTR], [
  1109. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  1110. #
  1111. tst_links_fgetxattr="unknown"
  1112. tst_proto_fgetxattr="unknown"
  1113. tst_compi_fgetxattr="unknown"
  1114. tst_allow_fgetxattr="unknown"
  1115. tst_nargs_fgetxattr="unknown"
  1116. #
  1117. AC_MSG_CHECKING([if fgetxattr can be linked])
  1118. AC_LINK_IFELSE([
  1119. AC_LANG_FUNC_LINK_TRY([fgetxattr])
  1120. ],[
  1121. AC_MSG_RESULT([yes])
  1122. tst_links_fgetxattr="yes"
  1123. ],[
  1124. AC_MSG_RESULT([no])
  1125. tst_links_fgetxattr="no"
  1126. ])
  1127. #
  1128. if test "$tst_links_fgetxattr" = "yes"; then
  1129. AC_MSG_CHECKING([if fgetxattr is prototyped])
  1130. AC_EGREP_CPP([fgetxattr],[
  1131. $curl_includes_sys_xattr
  1132. ],[
  1133. AC_MSG_RESULT([yes])
  1134. tst_proto_fgetxattr="yes"
  1135. ],[
  1136. AC_MSG_RESULT([no])
  1137. tst_proto_fgetxattr="no"
  1138. ])
  1139. fi
  1140. #
  1141. if test "$tst_proto_fgetxattr" = "yes"; then
  1142. if test "$tst_nargs_fgetxattr" = "unknown"; then
  1143. AC_MSG_CHECKING([if fgetxattr takes 4 args.])
  1144. AC_COMPILE_IFELSE([
  1145. AC_LANG_PROGRAM([[
  1146. $curl_includes_sys_xattr
  1147. ]],[[
  1148. if(0 != fgetxattr(0, 0, 0, 0))
  1149. return 1;
  1150. ]])
  1151. ],[
  1152. AC_MSG_RESULT([yes])
  1153. tst_compi_fgetxattr="yes"
  1154. tst_nargs_fgetxattr="4"
  1155. ],[
  1156. AC_MSG_RESULT([no])
  1157. tst_compi_fgetxattr="no"
  1158. ])
  1159. fi
  1160. if test "$tst_nargs_fgetxattr" = "unknown"; then
  1161. AC_MSG_CHECKING([if fgetxattr takes 6 args.])
  1162. AC_COMPILE_IFELSE([
  1163. AC_LANG_PROGRAM([[
  1164. $curl_includes_sys_xattr
  1165. ]],[[
  1166. if(0 != fgetxattr(0, 0, 0, 0, 0, 0))
  1167. return 1;
  1168. ]])
  1169. ],[
  1170. AC_MSG_RESULT([yes])
  1171. tst_compi_fgetxattr="yes"
  1172. tst_nargs_fgetxattr="6"
  1173. ],[
  1174. AC_MSG_RESULT([no])
  1175. tst_compi_fgetxattr="no"
  1176. ])
  1177. fi
  1178. AC_MSG_CHECKING([if fgetxattr is compilable])
  1179. if test "$tst_compi_fgetxattr" = "yes"; then
  1180. AC_MSG_RESULT([yes])
  1181. else
  1182. AC_MSG_RESULT([no])
  1183. fi
  1184. fi
  1185. #
  1186. if test "$tst_compi_fgetxattr" = "yes"; then
  1187. AC_MSG_CHECKING([if fgetxattr usage allowed])
  1188. if test "x$curl_disallow_fgetxattr" != "xyes"; then
  1189. AC_MSG_RESULT([yes])
  1190. tst_allow_fgetxattr="yes"
  1191. else
  1192. AC_MSG_RESULT([no])
  1193. tst_allow_fgetxattr="no"
  1194. fi
  1195. fi
  1196. #
  1197. AC_MSG_CHECKING([if fgetxattr might be used])
  1198. if test "$tst_links_fgetxattr" = "yes" &&
  1199. test "$tst_proto_fgetxattr" = "yes" &&
  1200. test "$tst_compi_fgetxattr" = "yes" &&
  1201. test "$tst_allow_fgetxattr" = "yes"; then
  1202. AC_MSG_RESULT([yes])
  1203. AC_DEFINE_UNQUOTED(HAVE_FGETXATTR, 1,
  1204. [Define to 1 if you have the fgetxattr function.])
  1205. dnl AC_DEFINE_UNQUOTED(FGETXATTR_ARGS, $tst_nargs_fgetxattr,
  1206. dnl [Specifies the number of arguments to fgetxattr])
  1207. #
  1208. if test "$tst_nargs_fgetxattr" -eq "4"; then
  1209. AC_DEFINE(HAVE_FGETXATTR_4, 1, [fgetxattr() takes 4 args])
  1210. elif test "$tst_nargs_fgetxattr" -eq "6"; then
  1211. AC_DEFINE(HAVE_FGETXATTR_6, 1, [fgetxattr() takes 6 args])
  1212. fi
  1213. #
  1214. curl_cv_func_fgetxattr="yes"
  1215. else
  1216. AC_MSG_RESULT([no])
  1217. curl_cv_func_fgetxattr="no"
  1218. fi
  1219. ])
  1220. dnl CURL_CHECK_FUNC_FLISTXATTR
  1221. dnl -------------------------------------------------
  1222. dnl Verify if flistxattr is available, prototyped, and
  1223. dnl can be compiled. If all of these are true, and
  1224. dnl usage has not been previously disallowed with
  1225. dnl shell variable curl_disallow_flistxattr, then
  1226. dnl HAVE_FLISTXATTR will be defined.
  1227. AC_DEFUN([CURL_CHECK_FUNC_FLISTXATTR], [
  1228. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  1229. #
  1230. tst_links_flistxattr="unknown"
  1231. tst_proto_flistxattr="unknown"
  1232. tst_compi_flistxattr="unknown"
  1233. tst_allow_flistxattr="unknown"
  1234. tst_nargs_flistxattr="unknown"
  1235. #
  1236. AC_MSG_CHECKING([if flistxattr can be linked])
  1237. AC_LINK_IFELSE([
  1238. AC_LANG_FUNC_LINK_TRY([flistxattr])
  1239. ],[
  1240. AC_MSG_RESULT([yes])
  1241. tst_links_flistxattr="yes"
  1242. ],[
  1243. AC_MSG_RESULT([no])
  1244. tst_links_flistxattr="no"
  1245. ])
  1246. #
  1247. if test "$tst_links_flistxattr" = "yes"; then
  1248. AC_MSG_CHECKING([if flistxattr is prototyped])
  1249. AC_EGREP_CPP([flistxattr],[
  1250. $curl_includes_sys_xattr
  1251. ],[
  1252. AC_MSG_RESULT([yes])
  1253. tst_proto_flistxattr="yes"
  1254. ],[
  1255. AC_MSG_RESULT([no])
  1256. tst_proto_flistxattr="no"
  1257. ])
  1258. fi
  1259. #
  1260. if test "$tst_proto_flistxattr" = "yes"; then
  1261. if test "$tst_nargs_flistxattr" = "unknown"; then
  1262. AC_MSG_CHECKING([if flistxattr takes 3 args.])
  1263. AC_COMPILE_IFELSE([
  1264. AC_LANG_PROGRAM([[
  1265. $curl_includes_sys_xattr
  1266. ]],[[
  1267. if(0 != flistxattr(0, 0, 0))
  1268. return 1;
  1269. ]])
  1270. ],[
  1271. AC_MSG_RESULT([yes])
  1272. tst_compi_flistxattr="yes"
  1273. tst_nargs_flistxattr="3"
  1274. ],[
  1275. AC_MSG_RESULT([no])
  1276. tst_compi_flistxattr="no"
  1277. ])
  1278. fi
  1279. if test "$tst_nargs_flistxattr" = "unknown"; then
  1280. AC_MSG_CHECKING([if flistxattr takes 4 args.])
  1281. AC_COMPILE_IFELSE([
  1282. AC_LANG_PROGRAM([[
  1283. $curl_includes_sys_xattr
  1284. ]],[[
  1285. if(0 != flistxattr(0, 0, 0, 0))
  1286. return 1;
  1287. ]])
  1288. ],[
  1289. AC_MSG_RESULT([yes])
  1290. tst_compi_flistxattr="yes"
  1291. tst_nargs_flistxattr="4"
  1292. ],[
  1293. AC_MSG_RESULT([no])
  1294. tst_compi_flistxattr="no"
  1295. ])
  1296. fi
  1297. AC_MSG_CHECKING([if flistxattr is compilable])
  1298. if test "$tst_compi_flistxattr" = "yes"; then
  1299. AC_MSG_RESULT([yes])
  1300. else
  1301. AC_MSG_RESULT([no])
  1302. fi
  1303. fi
  1304. #
  1305. if test "$tst_compi_flistxattr" = "yes"; then
  1306. AC_MSG_CHECKING([if flistxattr usage allowed])
  1307. if test "x$curl_disallow_flistxattr" != "xyes"; then
  1308. AC_MSG_RESULT([yes])
  1309. tst_allow_flistxattr="yes"
  1310. else
  1311. AC_MSG_RESULT([no])
  1312. tst_allow_flistxattr="no"
  1313. fi
  1314. fi
  1315. #
  1316. AC_MSG_CHECKING([if flistxattr might be used])
  1317. if test "$tst_links_flistxattr" = "yes" &&
  1318. test "$tst_proto_flistxattr" = "yes" &&
  1319. test "$tst_compi_flistxattr" = "yes" &&
  1320. test "$tst_allow_flistxattr" = "yes"; then
  1321. AC_MSG_RESULT([yes])
  1322. AC_DEFINE_UNQUOTED(HAVE_FLISTXATTR, 1,
  1323. [Define to 1 if you have the flistxattr function.])
  1324. dnl AC_DEFINE_UNQUOTED(FLISTXATTR_ARGS, $tst_nargs_flistxattr,
  1325. dnl [Specifies the number of arguments to flistxattr])
  1326. #
  1327. if test "$tst_nargs_flistxattr" -eq "3"; then
  1328. AC_DEFINE(HAVE_FLISTXATTR_3, 1, [flistxattr() takes 3 args])
  1329. elif test "$tst_nargs_flistxattr" -eq "4"; then
  1330. AC_DEFINE(HAVE_FLISTXATTR_4, 1, [flistxattr() takes 4 args])
  1331. fi
  1332. #
  1333. curl_cv_func_flistxattr="yes"
  1334. else
  1335. AC_MSG_RESULT([no])
  1336. curl_cv_func_flistxattr="no"
  1337. fi
  1338. ])
  1339. dnl CURL_CHECK_FUNC_FREEADDRINFO
  1340. dnl -------------------------------------------------
  1341. dnl Verify if freeaddrinfo is available, prototyped,
  1342. dnl and can be compiled. If all of these are true,
  1343. dnl and usage has not been previously disallowed with
  1344. dnl shell variable curl_disallow_freeaddrinfo, then
  1345. dnl HAVE_FREEADDRINFO will be defined.
  1346. AC_DEFUN([CURL_CHECK_FUNC_FREEADDRINFO], [
  1347. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  1348. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  1349. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1350. #
  1351. tst_links_freeaddrinfo="unknown"
  1352. tst_proto_freeaddrinfo="unknown"
  1353. tst_compi_freeaddrinfo="unknown"
  1354. tst_allow_freeaddrinfo="unknown"
  1355. #
  1356. AC_MSG_CHECKING([if freeaddrinfo can be linked])
  1357. AC_LINK_IFELSE([
  1358. AC_LANG_PROGRAM([[
  1359. $curl_includes_ws2tcpip
  1360. $curl_includes_sys_socket
  1361. $curl_includes_netdb
  1362. ]],[[
  1363. freeaddrinfo(0);
  1364. ]])
  1365. ],[
  1366. AC_MSG_RESULT([yes])
  1367. tst_links_freeaddrinfo="yes"
  1368. ],[
  1369. AC_MSG_RESULT([no])
  1370. tst_links_freeaddrinfo="no"
  1371. ])
  1372. #
  1373. if test "$tst_links_freeaddrinfo" = "yes"; then
  1374. AC_MSG_CHECKING([if freeaddrinfo is prototyped])
  1375. AC_EGREP_CPP([freeaddrinfo],[
  1376. $curl_includes_ws2tcpip
  1377. $curl_includes_sys_socket
  1378. $curl_includes_netdb
  1379. ],[
  1380. AC_MSG_RESULT([yes])
  1381. tst_proto_freeaddrinfo="yes"
  1382. ],[
  1383. AC_MSG_RESULT([no])
  1384. tst_proto_freeaddrinfo="no"
  1385. ])
  1386. fi
  1387. #
  1388. if test "$tst_proto_freeaddrinfo" = "yes"; then
  1389. AC_MSG_CHECKING([if freeaddrinfo is compilable])
  1390. AC_COMPILE_IFELSE([
  1391. AC_LANG_PROGRAM([[
  1392. $curl_includes_ws2tcpip
  1393. $curl_includes_sys_socket
  1394. $curl_includes_netdb
  1395. ]],[[
  1396. freeaddrinfo(0);
  1397. ]])
  1398. ],[
  1399. AC_MSG_RESULT([yes])
  1400. tst_compi_freeaddrinfo="yes"
  1401. ],[
  1402. AC_MSG_RESULT([no])
  1403. tst_compi_freeaddrinfo="no"
  1404. ])
  1405. fi
  1406. #
  1407. if test "$tst_compi_freeaddrinfo" = "yes"; then
  1408. AC_MSG_CHECKING([if freeaddrinfo usage allowed])
  1409. if test "x$curl_disallow_freeaddrinfo" != "xyes"; then
  1410. AC_MSG_RESULT([yes])
  1411. tst_allow_freeaddrinfo="yes"
  1412. else
  1413. AC_MSG_RESULT([no])
  1414. tst_allow_freeaddrinfo="no"
  1415. fi
  1416. fi
  1417. #
  1418. AC_MSG_CHECKING([if freeaddrinfo might be used])
  1419. if test "$tst_links_freeaddrinfo" = "yes" &&
  1420. test "$tst_proto_freeaddrinfo" = "yes" &&
  1421. test "$tst_compi_freeaddrinfo" = "yes" &&
  1422. test "$tst_allow_freeaddrinfo" = "yes"; then
  1423. AC_MSG_RESULT([yes])
  1424. AC_DEFINE_UNQUOTED(HAVE_FREEADDRINFO, 1,
  1425. [Define to 1 if you have the freeaddrinfo function.])
  1426. curl_cv_func_freeaddrinfo="yes"
  1427. else
  1428. AC_MSG_RESULT([no])
  1429. curl_cv_func_freeaddrinfo="no"
  1430. fi
  1431. ])
  1432. dnl CURL_CHECK_FUNC_FREMOVEXATTR
  1433. dnl -------------------------------------------------
  1434. dnl Verify if fremovexattr is available, prototyped, and
  1435. dnl can be compiled. If all of these are true, and
  1436. dnl usage has not been previously disallowed with
  1437. dnl shell variable curl_disallow_fremovexattr, then
  1438. dnl HAVE_FREMOVEXATTR will be defined.
  1439. AC_DEFUN([CURL_CHECK_FUNC_FREMOVEXATTR], [
  1440. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  1441. #
  1442. tst_links_fremovexattr="unknown"
  1443. tst_proto_fremovexattr="unknown"
  1444. tst_compi_fremovexattr="unknown"
  1445. tst_allow_fremovexattr="unknown"
  1446. tst_nargs_fremovexattr="unknown"
  1447. #
  1448. AC_MSG_CHECKING([if fremovexattr can be linked])
  1449. AC_LINK_IFELSE([
  1450. AC_LANG_FUNC_LINK_TRY([fremovexattr])
  1451. ],[
  1452. AC_MSG_RESULT([yes])
  1453. tst_links_fremovexattr="yes"
  1454. ],[
  1455. AC_MSG_RESULT([no])
  1456. tst_links_fremovexattr="no"
  1457. ])
  1458. #
  1459. if test "$tst_links_fremovexattr" = "yes"; then
  1460. AC_MSG_CHECKING([if fremovexattr is prototyped])
  1461. AC_EGREP_CPP([fremovexattr],[
  1462. $curl_includes_sys_xattr
  1463. ],[
  1464. AC_MSG_RESULT([yes])
  1465. tst_proto_fremovexattr="yes"
  1466. ],[
  1467. AC_MSG_RESULT([no])
  1468. tst_proto_fremovexattr="no"
  1469. ])
  1470. fi
  1471. #
  1472. if test "$tst_proto_fremovexattr" = "yes"; then
  1473. if test "$tst_nargs_fremovexattr" = "unknown"; then
  1474. AC_MSG_CHECKING([if fremovexattr takes 2 args.])
  1475. AC_COMPILE_IFELSE([
  1476. AC_LANG_PROGRAM([[
  1477. $curl_includes_sys_xattr
  1478. ]],[[
  1479. if(0 != fremovexattr(0, 0))
  1480. return 1;
  1481. ]])
  1482. ],[
  1483. AC_MSG_RESULT([yes])
  1484. tst_compi_fremovexattr="yes"
  1485. tst_nargs_fremovexattr="2"
  1486. ],[
  1487. AC_MSG_RESULT([no])
  1488. tst_compi_fremovexattr="no"
  1489. ])
  1490. fi
  1491. if test "$tst_nargs_fremovexattr" = "unknown"; then
  1492. AC_MSG_CHECKING([if fremovexattr takes 3 args.])
  1493. AC_COMPILE_IFELSE([
  1494. AC_LANG_PROGRAM([[
  1495. $curl_includes_sys_xattr
  1496. ]],[[
  1497. if(0 != fremovexattr(0, 0, 0))
  1498. return 1;
  1499. ]])
  1500. ],[
  1501. AC_MSG_RESULT([yes])
  1502. tst_compi_fremovexattr="yes"
  1503. tst_nargs_fremovexattr="3"
  1504. ],[
  1505. AC_MSG_RESULT([no])
  1506. tst_compi_fremovexattr="no"
  1507. ])
  1508. fi
  1509. AC_MSG_CHECKING([if fremovexattr is compilable])
  1510. if test "$tst_compi_fremovexattr" = "yes"; then
  1511. AC_MSG_RESULT([yes])
  1512. else
  1513. AC_MSG_RESULT([no])
  1514. fi
  1515. fi
  1516. #
  1517. if test "$tst_compi_fremovexattr" = "yes"; then
  1518. AC_MSG_CHECKING([if fremovexattr usage allowed])
  1519. if test "x$curl_disallow_fremovexattr" != "xyes"; then
  1520. AC_MSG_RESULT([yes])
  1521. tst_allow_fremovexattr="yes"
  1522. else
  1523. AC_MSG_RESULT([no])
  1524. tst_allow_fremovexattr="no"
  1525. fi
  1526. fi
  1527. #
  1528. AC_MSG_CHECKING([if fremovexattr might be used])
  1529. if test "$tst_links_fremovexattr" = "yes" &&
  1530. test "$tst_proto_fremovexattr" = "yes" &&
  1531. test "$tst_compi_fremovexattr" = "yes" &&
  1532. test "$tst_allow_fremovexattr" = "yes"; then
  1533. AC_MSG_RESULT([yes])
  1534. AC_DEFINE_UNQUOTED(HAVE_FREMOVEXATTR, 1,
  1535. [Define to 1 if you have the fremovexattr function.])
  1536. dnl AC_DEFINE_UNQUOTED(FREMOVEXATTR_ARGS, $tst_nargs_fremovexattr,
  1537. dnl [Specifies the number of arguments to fremovexattr])
  1538. #
  1539. if test "$tst_nargs_fremovexattr" -eq "2"; then
  1540. AC_DEFINE(HAVE_FREMOVEXATTR_2, 1, [fremovexattr() takes 2 args])
  1541. elif test "$tst_nargs_fremovexattr" -eq "3"; then
  1542. AC_DEFINE(HAVE_FREMOVEXATTR_3, 1, [fremovexattr() takes 3 args])
  1543. fi
  1544. #
  1545. curl_cv_func_fremovexattr="yes"
  1546. else
  1547. AC_MSG_RESULT([no])
  1548. curl_cv_func_fremovexattr="no"
  1549. fi
  1550. ])
  1551. dnl CURL_CHECK_FUNC_FSETXATTR
  1552. dnl -------------------------------------------------
  1553. dnl Verify if fsetxattr is available, prototyped, and
  1554. dnl can be compiled. If all of these are true, and
  1555. dnl usage has not been previously disallowed with
  1556. dnl shell variable curl_disallow_fsetxattr, then
  1557. dnl HAVE_FSETXATTR will be defined.
  1558. AC_DEFUN([CURL_CHECK_FUNC_FSETXATTR], [
  1559. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  1560. #
  1561. tst_links_fsetxattr="unknown"
  1562. tst_proto_fsetxattr="unknown"
  1563. tst_compi_fsetxattr="unknown"
  1564. tst_allow_fsetxattr="unknown"
  1565. tst_nargs_fsetxattr="unknown"
  1566. #
  1567. AC_MSG_CHECKING([if fsetxattr can be linked])
  1568. AC_LINK_IFELSE([
  1569. AC_LANG_FUNC_LINK_TRY([fsetxattr])
  1570. ],[
  1571. AC_MSG_RESULT([yes])
  1572. tst_links_fsetxattr="yes"
  1573. ],[
  1574. AC_MSG_RESULT([no])
  1575. tst_links_fsetxattr="no"
  1576. ])
  1577. #
  1578. if test "$tst_links_fsetxattr" = "yes"; then
  1579. AC_MSG_CHECKING([if fsetxattr is prototyped])
  1580. AC_EGREP_CPP([fsetxattr],[
  1581. $curl_includes_sys_xattr
  1582. ],[
  1583. AC_MSG_RESULT([yes])
  1584. tst_proto_fsetxattr="yes"
  1585. ],[
  1586. AC_MSG_RESULT([no])
  1587. tst_proto_fsetxattr="no"
  1588. ])
  1589. fi
  1590. #
  1591. if test "$tst_proto_fsetxattr" = "yes"; then
  1592. if test "$tst_nargs_fsetxattr" = "unknown"; then
  1593. AC_MSG_CHECKING([if fsetxattr takes 5 args.])
  1594. AC_COMPILE_IFELSE([
  1595. AC_LANG_PROGRAM([[
  1596. $curl_includes_sys_xattr
  1597. ]],[[
  1598. if(0 != fsetxattr(0, 0, 0, 0, 0))
  1599. return 1;
  1600. ]])
  1601. ],[
  1602. AC_MSG_RESULT([yes])
  1603. tst_compi_fsetxattr="yes"
  1604. tst_nargs_fsetxattr="5"
  1605. ],[
  1606. AC_MSG_RESULT([no])
  1607. tst_compi_fsetxattr="no"
  1608. ])
  1609. fi
  1610. if test "$tst_nargs_fsetxattr" = "unknown"; then
  1611. AC_MSG_CHECKING([if fsetxattr takes 6 args.])
  1612. AC_COMPILE_IFELSE([
  1613. AC_LANG_PROGRAM([[
  1614. $curl_includes_sys_xattr
  1615. ]],[[
  1616. if(0 != fsetxattr(0, 0, 0, 0, 0, 0))
  1617. return 1;
  1618. ]])
  1619. ],[
  1620. AC_MSG_RESULT([yes])
  1621. tst_compi_fsetxattr="yes"
  1622. tst_nargs_fsetxattr="6"
  1623. ],[
  1624. AC_MSG_RESULT([no])
  1625. tst_compi_fsetxattr="no"
  1626. ])
  1627. fi
  1628. AC_MSG_CHECKING([if fsetxattr is compilable])
  1629. if test "$tst_compi_fsetxattr" = "yes"; then
  1630. AC_MSG_RESULT([yes])
  1631. else
  1632. AC_MSG_RESULT([no])
  1633. fi
  1634. fi
  1635. #
  1636. if test "$tst_compi_fsetxattr" = "yes"; then
  1637. AC_MSG_CHECKING([if fsetxattr usage allowed])
  1638. if test "x$curl_disallow_fsetxattr" != "xyes"; then
  1639. AC_MSG_RESULT([yes])
  1640. tst_allow_fsetxattr="yes"
  1641. else
  1642. AC_MSG_RESULT([no])
  1643. tst_allow_fsetxattr="no"
  1644. fi
  1645. fi
  1646. #
  1647. AC_MSG_CHECKING([if fsetxattr might be used])
  1648. if test "$tst_links_fsetxattr" = "yes" &&
  1649. test "$tst_proto_fsetxattr" = "yes" &&
  1650. test "$tst_compi_fsetxattr" = "yes" &&
  1651. test "$tst_allow_fsetxattr" = "yes"; then
  1652. AC_MSG_RESULT([yes])
  1653. AC_DEFINE_UNQUOTED(HAVE_FSETXATTR, 1,
  1654. [Define to 1 if you have the fsetxattr function.])
  1655. dnl AC_DEFINE_UNQUOTED(FSETXATTR_ARGS, $tst_nargs_fsetxattr,
  1656. dnl [Specifies the number of arguments to fsetxattr])
  1657. #
  1658. if test "$tst_nargs_fsetxattr" -eq "5"; then
  1659. AC_DEFINE(HAVE_FSETXATTR_5, 1, [fsetxattr() takes 5 args])
  1660. elif test "$tst_nargs_fsetxattr" -eq "6"; then
  1661. AC_DEFINE(HAVE_FSETXATTR_6, 1, [fsetxattr() takes 6 args])
  1662. fi
  1663. #
  1664. curl_cv_func_fsetxattr="yes"
  1665. else
  1666. AC_MSG_RESULT([no])
  1667. curl_cv_func_fsetxattr="no"
  1668. fi
  1669. ])
  1670. dnl CURL_CHECK_FUNC_FTRUNCATE
  1671. dnl -------------------------------------------------
  1672. dnl Verify if ftruncate is available, prototyped, and
  1673. dnl can be compiled. If all of these are true, and
  1674. dnl usage has not been previously disallowed with
  1675. dnl shell variable curl_disallow_ftruncate, then
  1676. dnl HAVE_FTRUNCATE will be defined.
  1677. AC_DEFUN([CURL_CHECK_FUNC_FTRUNCATE], [
  1678. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  1679. #
  1680. tst_links_ftruncate="unknown"
  1681. tst_proto_ftruncate="unknown"
  1682. tst_compi_ftruncate="unknown"
  1683. tst_allow_ftruncate="unknown"
  1684. #
  1685. AC_MSG_CHECKING([if ftruncate can be linked])
  1686. AC_LINK_IFELSE([
  1687. AC_LANG_FUNC_LINK_TRY([ftruncate])
  1688. ],[
  1689. AC_MSG_RESULT([yes])
  1690. tst_links_ftruncate="yes"
  1691. ],[
  1692. AC_MSG_RESULT([no])
  1693. tst_links_ftruncate="no"
  1694. ])
  1695. #
  1696. if test "$tst_links_ftruncate" = "yes"; then
  1697. AC_MSG_CHECKING([if ftruncate is prototyped])
  1698. AC_EGREP_CPP([ftruncate],[
  1699. $curl_includes_unistd
  1700. ],[
  1701. AC_MSG_RESULT([yes])
  1702. tst_proto_ftruncate="yes"
  1703. ],[
  1704. AC_MSG_RESULT([no])
  1705. tst_proto_ftruncate="no"
  1706. ])
  1707. fi
  1708. #
  1709. if test "$tst_proto_ftruncate" = "yes"; then
  1710. AC_MSG_CHECKING([if ftruncate is compilable])
  1711. AC_COMPILE_IFELSE([
  1712. AC_LANG_PROGRAM([[
  1713. $curl_includes_unistd
  1714. ]],[[
  1715. if(0 != ftruncate(0, 0))
  1716. return 1;
  1717. ]])
  1718. ],[
  1719. AC_MSG_RESULT([yes])
  1720. tst_compi_ftruncate="yes"
  1721. ],[
  1722. AC_MSG_RESULT([no])
  1723. tst_compi_ftruncate="no"
  1724. ])
  1725. fi
  1726. #
  1727. if test "$tst_compi_ftruncate" = "yes"; then
  1728. AC_MSG_CHECKING([if ftruncate usage allowed])
  1729. if test "x$curl_disallow_ftruncate" != "xyes"; then
  1730. AC_MSG_RESULT([yes])
  1731. tst_allow_ftruncate="yes"
  1732. else
  1733. AC_MSG_RESULT([no])
  1734. tst_allow_ftruncate="no"
  1735. fi
  1736. fi
  1737. #
  1738. AC_MSG_CHECKING([if ftruncate might be used])
  1739. if test "$tst_links_ftruncate" = "yes" &&
  1740. test "$tst_proto_ftruncate" = "yes" &&
  1741. test "$tst_compi_ftruncate" = "yes" &&
  1742. test "$tst_allow_ftruncate" = "yes"; then
  1743. AC_MSG_RESULT([yes])
  1744. AC_DEFINE_UNQUOTED(HAVE_FTRUNCATE, 1,
  1745. [Define to 1 if you have the ftruncate function.])
  1746. curl_cv_func_ftruncate="yes"
  1747. else
  1748. AC_MSG_RESULT([no])
  1749. curl_cv_func_ftruncate="no"
  1750. fi
  1751. ])
  1752. dnl CURL_CHECK_FUNC_GETADDRINFO
  1753. dnl -------------------------------------------------
  1754. dnl Verify if getaddrinfo is available, prototyped, can
  1755. dnl be compiled and seems to work. If all of these are
  1756. dnl true, and usage has not been previously disallowed
  1757. dnl with shell variable curl_disallow_getaddrinfo, then
  1758. dnl HAVE_GETADDRINFO will be defined. Additionally when
  1759. dnl HAVE_GETADDRINFO gets defined this will also attempt
  1760. dnl to find out if getaddrinfo happens to be threadsafe,
  1761. dnl defining HAVE_GETADDRINFO_THREADSAFE when true.
  1762. AC_DEFUN([CURL_CHECK_FUNC_GETADDRINFO], [
  1763. AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl
  1764. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  1765. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  1766. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  1767. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  1768. AC_REQUIRE([CURL_CHECK_NATIVE_WINDOWS])dnl
  1769. #
  1770. tst_links_getaddrinfo="unknown"
  1771. tst_proto_getaddrinfo="unknown"
  1772. tst_compi_getaddrinfo="unknown"
  1773. tst_works_getaddrinfo="unknown"
  1774. tst_allow_getaddrinfo="unknown"
  1775. tst_tsafe_getaddrinfo="unknown"
  1776. #
  1777. AC_MSG_CHECKING([if getaddrinfo can be linked])
  1778. AC_LINK_IFELSE([
  1779. AC_LANG_PROGRAM([[
  1780. $curl_includes_ws2tcpip
  1781. $curl_includes_sys_socket
  1782. $curl_includes_netdb
  1783. ]],[[
  1784. if(0 != getaddrinfo(0, 0, 0, 0))
  1785. return 1;
  1786. ]])
  1787. ],[
  1788. AC_MSG_RESULT([yes])
  1789. tst_links_getaddrinfo="yes"
  1790. ],[
  1791. AC_MSG_RESULT([no])
  1792. tst_links_getaddrinfo="no"
  1793. ])
  1794. #
  1795. if test "$tst_links_getaddrinfo" = "yes"; then
  1796. AC_MSG_CHECKING([if getaddrinfo is prototyped])
  1797. AC_EGREP_CPP([getaddrinfo],[
  1798. $curl_includes_ws2tcpip
  1799. $curl_includes_sys_socket
  1800. $curl_includes_netdb
  1801. ],[
  1802. AC_MSG_RESULT([yes])
  1803. tst_proto_getaddrinfo="yes"
  1804. ],[
  1805. AC_MSG_RESULT([no])
  1806. tst_proto_getaddrinfo="no"
  1807. ])
  1808. fi
  1809. #
  1810. if test "$tst_proto_getaddrinfo" = "yes"; then
  1811. AC_MSG_CHECKING([if getaddrinfo is compilable])
  1812. AC_COMPILE_IFELSE([
  1813. AC_LANG_PROGRAM([[
  1814. $curl_includes_ws2tcpip
  1815. $curl_includes_sys_socket
  1816. $curl_includes_netdb
  1817. ]],[[
  1818. if(0 != getaddrinfo(0, 0, 0, 0))
  1819. return 1;
  1820. ]])
  1821. ],[
  1822. AC_MSG_RESULT([yes])
  1823. tst_compi_getaddrinfo="yes"
  1824. ],[
  1825. AC_MSG_RESULT([no])
  1826. tst_compi_getaddrinfo="no"
  1827. ])
  1828. fi
  1829. #
  1830. dnl only do runtime verification when not cross-compiling
  1831. if test "x$cross_compiling" != "xyes" &&
  1832. test "$tst_compi_getaddrinfo" = "yes"; then
  1833. AC_MSG_CHECKING([if getaddrinfo seems to work])
  1834. CURL_RUN_IFELSE([
  1835. AC_LANG_PROGRAM([[
  1836. $curl_includes_ws2tcpip
  1837. $curl_includes_stdlib
  1838. $curl_includes_string
  1839. $curl_includes_sys_socket
  1840. $curl_includes_netdb
  1841. ]],[[
  1842. struct addrinfo hints;
  1843. struct addrinfo *ai = 0;
  1844. int error;
  1845. #ifdef HAVE_WINSOCK2_H
  1846. WSADATA wsa;
  1847. if (WSAStartup(MAKEWORD(2,2), &wsa))
  1848. exit(2);
  1849. #endif
  1850. memset(&hints, 0, sizeof(hints));
  1851. hints.ai_flags = AI_NUMERICHOST;
  1852. hints.ai_family = AF_UNSPEC;
  1853. hints.ai_socktype = SOCK_STREAM;
  1854. error = getaddrinfo("127.0.0.1", 0, &hints, &ai);
  1855. if(error || !ai)
  1856. exit(1); /* fail */
  1857. else
  1858. exit(0);
  1859. ]])
  1860. ],[
  1861. AC_MSG_RESULT([yes])
  1862. tst_works_getaddrinfo="yes"
  1863. ],[
  1864. AC_MSG_RESULT([no])
  1865. tst_works_getaddrinfo="no"
  1866. ])
  1867. fi
  1868. #
  1869. if test "$tst_compi_getaddrinfo" = "yes" &&
  1870. test "$tst_works_getaddrinfo" != "no"; then
  1871. AC_MSG_CHECKING([if getaddrinfo usage allowed])
  1872. if test "x$curl_disallow_getaddrinfo" != "xyes"; then
  1873. AC_MSG_RESULT([yes])
  1874. tst_allow_getaddrinfo="yes"
  1875. else
  1876. AC_MSG_RESULT([no])
  1877. tst_allow_getaddrinfo="no"
  1878. fi
  1879. fi
  1880. #
  1881. AC_MSG_CHECKING([if getaddrinfo might be used])
  1882. if test "$tst_links_getaddrinfo" = "yes" &&
  1883. test "$tst_proto_getaddrinfo" = "yes" &&
  1884. test "$tst_compi_getaddrinfo" = "yes" &&
  1885. test "$tst_allow_getaddrinfo" = "yes" &&
  1886. test "$tst_works_getaddrinfo" != "no"; then
  1887. AC_MSG_RESULT([yes])
  1888. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO, 1,
  1889. [Define to 1 if you have a working getaddrinfo function.])
  1890. curl_cv_func_getaddrinfo="yes"
  1891. else
  1892. AC_MSG_RESULT([no])
  1893. curl_cv_func_getaddrinfo="no"
  1894. curl_cv_func_getaddrinfo_threadsafe="no"
  1895. fi
  1896. #
  1897. if test "$curl_cv_func_getaddrinfo" = "yes"; then
  1898. AC_MSG_CHECKING([if getaddrinfo is threadsafe])
  1899. case $host_os in
  1900. aix[[1234]].* | aix5.[[01]].*)
  1901. dnl aix 5.1 and older
  1902. tst_tsafe_getaddrinfo="no"
  1903. ;;
  1904. aix*)
  1905. dnl aix 5.2 and newer
  1906. tst_tsafe_getaddrinfo="yes"
  1907. ;;
  1908. darwin[[12345]].*)
  1909. dnl darwin 5.0 and mac os x 10.1.X and older
  1910. tst_tsafe_getaddrinfo="no"
  1911. ;;
  1912. darwin*)
  1913. dnl darwin 6.0 and mac os x 10.2.X and newer
  1914. tst_tsafe_getaddrinfo="yes"
  1915. ;;
  1916. freebsd[[1234]].* | freebsd5.[[1234]]*)
  1917. dnl freebsd 5.4 and older
  1918. tst_tsafe_getaddrinfo="no"
  1919. ;;
  1920. freebsd*)
  1921. dnl freebsd 5.5 and newer
  1922. tst_tsafe_getaddrinfo="yes"
  1923. ;;
  1924. hpux[[123456789]].* | hpux10.* | hpux11.0* | hpux11.10*)
  1925. dnl hpux 11.10 and older
  1926. tst_tsafe_getaddrinfo="no"
  1927. ;;
  1928. hpux*)
  1929. dnl hpux 11.11 and newer
  1930. tst_tsafe_getaddrinfo="yes"
  1931. ;;
  1932. midnightbsd*)
  1933. dnl all MidnightBSD versions
  1934. tst_tsafe_getaddrinfo="yes"
  1935. ;;
  1936. netbsd[[123]].*)
  1937. dnl netbsd 3.X and older
  1938. tst_tsafe_getaddrinfo="no"
  1939. ;;
  1940. netbsd*)
  1941. dnl netbsd 4.X and newer
  1942. tst_tsafe_getaddrinfo="yes"
  1943. ;;
  1944. *bsd*)
  1945. dnl All other bsd's
  1946. tst_tsafe_getaddrinfo="no"
  1947. ;;
  1948. solaris2*)
  1949. dnl solaris which have it
  1950. tst_tsafe_getaddrinfo="yes"
  1951. ;;
  1952. esac
  1953. if test "$tst_tsafe_getaddrinfo" = "unknown" &&
  1954. test "$curl_cv_native_windows" = "yes"; then
  1955. tst_tsafe_getaddrinfo="yes"
  1956. fi
  1957. if test "$tst_tsafe_getaddrinfo" = "unknown"; then
  1958. CURL_CHECK_DEF_CC([h_errno], [
  1959. $curl_includes_sys_socket
  1960. $curl_includes_netdb
  1961. ], [silent])
  1962. if test "$curl_cv_have_def_h_errno" = "yes"; then
  1963. tst_h_errno_macro="yes"
  1964. else
  1965. tst_h_errno_macro="no"
  1966. fi
  1967. AC_COMPILE_IFELSE([
  1968. AC_LANG_PROGRAM([[
  1969. $curl_includes_sys_socket
  1970. $curl_includes_netdb
  1971. ]],[[
  1972. h_errno = 2;
  1973. if(0 != h_errno)
  1974. return 1;
  1975. ]])
  1976. ],[
  1977. tst_h_errno_modifiable_lvalue="yes"
  1978. ],[
  1979. tst_h_errno_modifiable_lvalue="no"
  1980. ])
  1981. AC_COMPILE_IFELSE([
  1982. AC_LANG_PROGRAM([[
  1983. ]],[[
  1984. #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
  1985. return 0;
  1986. #elif defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 700)
  1987. return 0;
  1988. #else
  1989. force compilation error
  1990. #endif
  1991. ]])
  1992. ],[
  1993. tst_h_errno_sbs_issue_7="yes"
  1994. ],[
  1995. tst_h_errno_sbs_issue_7="no"
  1996. ])
  1997. if test "$tst_h_errno_macro" = "no" &&
  1998. test "$tst_h_errno_modifiable_lvalue" = "no" &&
  1999. test "$tst_h_errno_sbs_issue_7" = "no"; then
  2000. tst_tsafe_getaddrinfo="no"
  2001. else
  2002. tst_tsafe_getaddrinfo="yes"
  2003. fi
  2004. fi
  2005. AC_MSG_RESULT([$tst_tsafe_getaddrinfo])
  2006. if test "$tst_tsafe_getaddrinfo" = "yes"; then
  2007. AC_DEFINE_UNQUOTED(HAVE_GETADDRINFO_THREADSAFE, 1,
  2008. [Define to 1 if the getaddrinfo function is threadsafe.])
  2009. curl_cv_func_getaddrinfo_threadsafe="yes"
  2010. else
  2011. curl_cv_func_getaddrinfo_threadsafe="no"
  2012. fi
  2013. fi
  2014. ])
  2015. dnl CURL_CHECK_FUNC_GETHOSTBYNAME
  2016. dnl -------------------------------------------------
  2017. dnl Verify if gethostbyname is available, prototyped,
  2018. dnl and can be compiled. If all of these are true,
  2019. dnl and usage has not been previously disallowed with
  2020. dnl shell variable curl_disallow_gethostbyname, then
  2021. dnl HAVE_GETHOSTBYNAME will be defined.
  2022. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME], [
  2023. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2024. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  2025. #
  2026. tst_links_gethostbyname="unknown"
  2027. tst_proto_gethostbyname="unknown"
  2028. tst_compi_gethostbyname="unknown"
  2029. tst_allow_gethostbyname="unknown"
  2030. #
  2031. AC_MSG_CHECKING([if gethostbyname can be linked])
  2032. AC_LINK_IFELSE([
  2033. AC_LANG_PROGRAM([[
  2034. $curl_includes_winsock2
  2035. $curl_includes_bsdsocket
  2036. $curl_includes_netdb
  2037. ]],[[
  2038. if(0 != gethostbyname(0))
  2039. return 1;
  2040. ]])
  2041. ],[
  2042. AC_MSG_RESULT([yes])
  2043. tst_links_gethostbyname="yes"
  2044. ],[
  2045. AC_MSG_RESULT([no])
  2046. tst_links_gethostbyname="no"
  2047. ])
  2048. #
  2049. if test "$tst_links_gethostbyname" = "yes"; then
  2050. AC_MSG_CHECKING([if gethostbyname is prototyped])
  2051. AC_EGREP_CPP([gethostbyname],[
  2052. $curl_includes_winsock2
  2053. $curl_includes_bsdsocket
  2054. $curl_includes_netdb
  2055. ],[
  2056. AC_MSG_RESULT([yes])
  2057. tst_proto_gethostbyname="yes"
  2058. ],[
  2059. AC_MSG_RESULT([no])
  2060. tst_proto_gethostbyname="no"
  2061. ])
  2062. fi
  2063. #
  2064. if test "$tst_proto_gethostbyname" = "yes"; then
  2065. AC_MSG_CHECKING([if gethostbyname is compilable])
  2066. AC_COMPILE_IFELSE([
  2067. AC_LANG_PROGRAM([[
  2068. $curl_includes_winsock2
  2069. $curl_includes_bsdsocket
  2070. $curl_includes_netdb
  2071. ]],[[
  2072. if(0 != gethostbyname(0))
  2073. return 1;
  2074. ]])
  2075. ],[
  2076. AC_MSG_RESULT([yes])
  2077. tst_compi_gethostbyname="yes"
  2078. ],[
  2079. AC_MSG_RESULT([no])
  2080. tst_compi_gethostbyname="no"
  2081. ])
  2082. fi
  2083. #
  2084. if test "$tst_compi_gethostbyname" = "yes"; then
  2085. AC_MSG_CHECKING([if gethostbyname usage allowed])
  2086. if test "x$curl_disallow_gethostbyname" != "xyes"; then
  2087. AC_MSG_RESULT([yes])
  2088. tst_allow_gethostbyname="yes"
  2089. else
  2090. AC_MSG_RESULT([no])
  2091. tst_allow_gethostbyname="no"
  2092. fi
  2093. fi
  2094. #
  2095. AC_MSG_CHECKING([if gethostbyname might be used])
  2096. if test "$tst_links_gethostbyname" = "yes" &&
  2097. test "$tst_proto_gethostbyname" = "yes" &&
  2098. test "$tst_compi_gethostbyname" = "yes" &&
  2099. test "$tst_allow_gethostbyname" = "yes"; then
  2100. AC_MSG_RESULT([yes])
  2101. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME, 1,
  2102. [Define to 1 if you have the gethostbyname function.])
  2103. curl_cv_func_gethostbyname="yes"
  2104. else
  2105. AC_MSG_RESULT([no])
  2106. curl_cv_func_gethostbyname="no"
  2107. fi
  2108. ])
  2109. dnl CURL_CHECK_FUNC_GETHOSTBYNAME_R
  2110. dnl -------------------------------------------------
  2111. dnl Verify if gethostbyname_r is available, prototyped,
  2112. dnl and can be compiled. If all of these are true, and
  2113. dnl usage has not been previously disallowed with
  2114. dnl shell variable curl_disallow_gethostbyname_r, then
  2115. dnl HAVE_GETHOSTBYNAME_R will be defined.
  2116. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTBYNAME_R], [
  2117. AC_REQUIRE([CURL_INCLUDES_NETDB])dnl
  2118. #
  2119. tst_links_gethostbyname_r="unknown"
  2120. tst_proto_gethostbyname_r="unknown"
  2121. tst_compi_gethostbyname_r="unknown"
  2122. tst_allow_gethostbyname_r="unknown"
  2123. tst_nargs_gethostbyname_r="unknown"
  2124. #
  2125. AC_MSG_CHECKING([if gethostbyname_r can be linked])
  2126. AC_LINK_IFELSE([
  2127. AC_LANG_FUNC_LINK_TRY([gethostbyname_r])
  2128. ],[
  2129. AC_MSG_RESULT([yes])
  2130. tst_links_gethostbyname_r="yes"
  2131. ],[
  2132. AC_MSG_RESULT([no])
  2133. tst_links_gethostbyname_r="no"
  2134. ])
  2135. #
  2136. if test "$tst_links_gethostbyname_r" = "yes"; then
  2137. AC_MSG_CHECKING([if gethostbyname_r is prototyped])
  2138. AC_EGREP_CPP([gethostbyname_r],[
  2139. $curl_includes_netdb
  2140. ],[
  2141. AC_MSG_RESULT([yes])
  2142. tst_proto_gethostbyname_r="yes"
  2143. ],[
  2144. AC_MSG_RESULT([no])
  2145. tst_proto_gethostbyname_r="no"
  2146. ])
  2147. fi
  2148. #
  2149. if test "$tst_proto_gethostbyname_r" = "yes"; then
  2150. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  2151. AC_MSG_CHECKING([if gethostbyname_r takes 3 args.])
  2152. AC_COMPILE_IFELSE([
  2153. AC_LANG_PROGRAM([[
  2154. $curl_includes_netdb
  2155. $curl_includes_bsdsocket
  2156. ]],[[
  2157. if(0 != gethostbyname_r(0, 0, 0))
  2158. return 1;
  2159. ]])
  2160. ],[
  2161. AC_MSG_RESULT([yes])
  2162. tst_compi_gethostbyname_r="yes"
  2163. tst_nargs_gethostbyname_r="3"
  2164. ],[
  2165. AC_MSG_RESULT([no])
  2166. tst_compi_gethostbyname_r="no"
  2167. ])
  2168. fi
  2169. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  2170. AC_MSG_CHECKING([if gethostbyname_r takes 5 args.])
  2171. AC_COMPILE_IFELSE([
  2172. AC_LANG_PROGRAM([[
  2173. $curl_includes_netdb
  2174. $curl_includes_bsdsocket
  2175. ]],[[
  2176. if(0 != gethostbyname_r(0, 0, 0, 0, 0))
  2177. return 1;
  2178. ]])
  2179. ],[
  2180. AC_MSG_RESULT([yes])
  2181. tst_compi_gethostbyname_r="yes"
  2182. tst_nargs_gethostbyname_r="5"
  2183. ],[
  2184. AC_MSG_RESULT([no])
  2185. tst_compi_gethostbyname_r="no"
  2186. ])
  2187. fi
  2188. if test "$tst_nargs_gethostbyname_r" = "unknown"; then
  2189. AC_MSG_CHECKING([if gethostbyname_r takes 6 args.])
  2190. AC_COMPILE_IFELSE([
  2191. AC_LANG_PROGRAM([[
  2192. $curl_includes_netdb
  2193. $curl_includes_bsdsocket
  2194. ]],[[
  2195. if(0 != gethostbyname_r(0, 0, 0, 0, 0, 0))
  2196. return 1;
  2197. ]])
  2198. ],[
  2199. AC_MSG_RESULT([yes])
  2200. tst_compi_gethostbyname_r="yes"
  2201. tst_nargs_gethostbyname_r="6"
  2202. ],[
  2203. AC_MSG_RESULT([no])
  2204. tst_compi_gethostbyname_r="no"
  2205. ])
  2206. fi
  2207. AC_MSG_CHECKING([if gethostbyname_r is compilable])
  2208. if test "$tst_compi_gethostbyname_r" = "yes"; then
  2209. AC_MSG_RESULT([yes])
  2210. else
  2211. AC_MSG_RESULT([no])
  2212. fi
  2213. fi
  2214. #
  2215. if test "$tst_compi_gethostbyname_r" = "yes"; then
  2216. AC_MSG_CHECKING([if gethostbyname_r usage allowed])
  2217. if test "x$curl_disallow_gethostbyname_r" != "xyes"; then
  2218. AC_MSG_RESULT([yes])
  2219. tst_allow_gethostbyname_r="yes"
  2220. else
  2221. AC_MSG_RESULT([no])
  2222. tst_allow_gethostbyname_r="no"
  2223. fi
  2224. fi
  2225. #
  2226. AC_MSG_CHECKING([if gethostbyname_r might be used])
  2227. if test "$tst_links_gethostbyname_r" = "yes" &&
  2228. test "$tst_proto_gethostbyname_r" = "yes" &&
  2229. test "$tst_compi_gethostbyname_r" = "yes" &&
  2230. test "$tst_allow_gethostbyname_r" = "yes"; then
  2231. AC_MSG_RESULT([yes])
  2232. AC_DEFINE_UNQUOTED(HAVE_GETHOSTBYNAME_R, 1,
  2233. [Define to 1 if you have the gethostbyname_r function.])
  2234. dnl AC_DEFINE_UNQUOTED(GETHOSTBYNAME_R_ARGS, $tst_nargs_gethostbyname_r,
  2235. dnl [Specifies the number of arguments to gethostbyname_r])
  2236. #
  2237. if test "$tst_nargs_gethostbyname_r" -eq "3"; then
  2238. AC_DEFINE(HAVE_GETHOSTBYNAME_R_3, 1, [gethostbyname_r() takes 3 args])
  2239. elif test "$tst_nargs_gethostbyname_r" -eq "5"; then
  2240. AC_DEFINE(HAVE_GETHOSTBYNAME_R_5, 1, [gethostbyname_r() takes 5 args])
  2241. elif test "$tst_nargs_gethostbyname_r" -eq "6"; then
  2242. AC_DEFINE(HAVE_GETHOSTBYNAME_R_6, 1, [gethostbyname_r() takes 6 args])
  2243. fi
  2244. #
  2245. curl_cv_func_gethostbyname_r="yes"
  2246. else
  2247. AC_MSG_RESULT([no])
  2248. curl_cv_func_gethostbyname_r="no"
  2249. fi
  2250. ])
  2251. dnl CURL_CHECK_FUNC_GETHOSTNAME
  2252. dnl -------------------------------------------------
  2253. dnl Verify if gethostname is available, prototyped, and
  2254. dnl can be compiled. If all of these are true, and
  2255. dnl usage has not been previously disallowed with
  2256. dnl shell variable curl_disallow_gethostname, then
  2257. dnl HAVE_GETHOSTNAME will be defined.
  2258. AC_DEFUN([CURL_CHECK_FUNC_GETHOSTNAME], [
  2259. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2260. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  2261. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  2262. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2263. #
  2264. tst_links_gethostname="unknown"
  2265. tst_proto_gethostname="unknown"
  2266. tst_compi_gethostname="unknown"
  2267. tst_allow_gethostname="unknown"
  2268. #
  2269. AC_MSG_CHECKING([if gethostname can be linked])
  2270. AC_LINK_IFELSE([
  2271. AC_LANG_PROGRAM([[
  2272. $curl_includes_winsock2
  2273. $curl_includes_unistd
  2274. $curl_includes_bsdsocket
  2275. ]],[[
  2276. if(0 != gethostname(0, 0))
  2277. return 1;
  2278. ]])
  2279. ],[
  2280. AC_MSG_RESULT([yes])
  2281. tst_links_gethostname="yes"
  2282. ],[
  2283. AC_MSG_RESULT([no])
  2284. tst_links_gethostname="no"
  2285. ])
  2286. #
  2287. if test "$tst_links_gethostname" = "yes"; then
  2288. AC_MSG_CHECKING([if gethostname is prototyped])
  2289. AC_EGREP_CPP([gethostname],[
  2290. $curl_includes_winsock2
  2291. $curl_includes_unistd
  2292. $curl_includes_bsdsocket
  2293. ],[
  2294. AC_MSG_RESULT([yes])
  2295. tst_proto_gethostname="yes"
  2296. ],[
  2297. AC_MSG_RESULT([no])
  2298. tst_proto_gethostname="no"
  2299. ])
  2300. fi
  2301. #
  2302. if test "$tst_proto_gethostname" = "yes"; then
  2303. AC_MSG_CHECKING([if gethostname is compilable])
  2304. AC_COMPILE_IFELSE([
  2305. AC_LANG_PROGRAM([[
  2306. $curl_includes_winsock2
  2307. $curl_includes_unistd
  2308. $curl_includes_bsdsocket
  2309. ]],[[
  2310. if(0 != gethostname(0, 0))
  2311. return 1;
  2312. ]])
  2313. ],[
  2314. AC_MSG_RESULT([yes])
  2315. tst_compi_gethostname="yes"
  2316. ],[
  2317. AC_MSG_RESULT([no])
  2318. tst_compi_gethostname="no"
  2319. ])
  2320. fi
  2321. #
  2322. if test "$tst_compi_gethostname" = "yes"; then
  2323. AC_MSG_CHECKING([for gethostname arg 2 data type])
  2324. tst_gethostname_type_arg2="unknown"
  2325. for tst_arg1 in 'char *' 'unsigned char *' 'void *'; do
  2326. for tst_arg2 in 'int' 'unsigned int' 'size_t'; do
  2327. if test "$tst_gethostname_type_arg2" = "unknown"; then
  2328. AC_COMPILE_IFELSE([
  2329. AC_LANG_PROGRAM([[
  2330. $curl_includes_winsock2
  2331. $curl_includes_unistd
  2332. $curl_includes_bsdsocket
  2333. $curl_preprocess_callconv
  2334. extern int FUNCALLCONV gethostname($tst_arg1, $tst_arg2);
  2335. ]],[[
  2336. if(0 != gethostname(0, 0))
  2337. return 1;
  2338. ]])
  2339. ],[
  2340. tst_gethostname_type_arg2="$tst_arg2"
  2341. ])
  2342. fi
  2343. done
  2344. done
  2345. AC_MSG_RESULT([$tst_gethostname_type_arg2])
  2346. if test "$tst_gethostname_type_arg2" != "unknown"; then
  2347. AC_DEFINE_UNQUOTED(GETHOSTNAME_TYPE_ARG2, $tst_gethostname_type_arg2,
  2348. [Define to the type of arg 2 for gethostname.])
  2349. fi
  2350. fi
  2351. #
  2352. if test "$tst_compi_gethostname" = "yes"; then
  2353. AC_MSG_CHECKING([if gethostname usage allowed])
  2354. if test "x$curl_disallow_gethostname" != "xyes"; then
  2355. AC_MSG_RESULT([yes])
  2356. tst_allow_gethostname="yes"
  2357. else
  2358. AC_MSG_RESULT([no])
  2359. tst_allow_gethostname="no"
  2360. fi
  2361. fi
  2362. #
  2363. AC_MSG_CHECKING([if gethostname might be used])
  2364. if test "$tst_links_gethostname" = "yes" &&
  2365. test "$tst_proto_gethostname" = "yes" &&
  2366. test "$tst_compi_gethostname" = "yes" &&
  2367. test "$tst_allow_gethostname" = "yes"; then
  2368. AC_MSG_RESULT([yes])
  2369. AC_DEFINE_UNQUOTED(HAVE_GETHOSTNAME, 1,
  2370. [Define to 1 if you have the gethostname function.])
  2371. curl_cv_func_gethostname="yes"
  2372. else
  2373. AC_MSG_RESULT([no])
  2374. curl_cv_func_gethostname="no"
  2375. fi
  2376. ])
  2377. dnl CURL_CHECK_FUNC_GETPEERNAME
  2378. dnl -------------------------------------------------
  2379. dnl Verify if getpeername is available, prototyped, and
  2380. dnl can be compiled. If all of these are true, and
  2381. dnl usage has not been previously disallowed with
  2382. dnl shell variable curl_disallow_getpeername, then
  2383. dnl HAVE_GETPEERNAME will be defined.
  2384. AC_DEFUN([CURL_CHECK_FUNC_GETPEERNAME], [
  2385. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2386. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  2387. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2388. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  2389. #
  2390. tst_links_getpeername="unknown"
  2391. tst_proto_getpeername="unknown"
  2392. tst_compi_getpeername="unknown"
  2393. tst_allow_getpeername="unknown"
  2394. #
  2395. AC_MSG_CHECKING([if getpeername can be linked])
  2396. AC_LINK_IFELSE([
  2397. AC_LANG_PROGRAM([[
  2398. $curl_includes_winsock2
  2399. $curl_includes_bsdsocket
  2400. $curl_includes_sys_socket
  2401. ]],[[
  2402. if(0 != getpeername(0, (void *)0, (void *)0))
  2403. return 1;
  2404. ]])
  2405. ],[
  2406. AC_MSG_RESULT([yes])
  2407. tst_links_getpeername="yes"
  2408. ],[
  2409. AC_MSG_RESULT([no])
  2410. tst_links_getpeername="no"
  2411. ])
  2412. #
  2413. if test "$tst_links_getpeername" = "yes"; then
  2414. AC_MSG_CHECKING([if getpeername is prototyped])
  2415. AC_EGREP_CPP([getpeername],[
  2416. $curl_includes_winsock2
  2417. $curl_includes_bsdsocket
  2418. $curl_includes_sys_socket
  2419. ],[
  2420. AC_MSG_RESULT([yes])
  2421. tst_proto_getpeername="yes"
  2422. ],[
  2423. AC_MSG_RESULT([no])
  2424. tst_proto_getpeername="no"
  2425. ])
  2426. fi
  2427. #
  2428. if test "$tst_proto_getpeername" = "yes"; then
  2429. AC_MSG_CHECKING([if getpeername is compilable])
  2430. AC_COMPILE_IFELSE([
  2431. AC_LANG_PROGRAM([[
  2432. $curl_includes_winsock2
  2433. $curl_includes_bsdsocket
  2434. $curl_includes_sys_socket
  2435. ]],[[
  2436. if(0 != getpeername(0, (void *)0, (void *)0))
  2437. return 1;
  2438. ]])
  2439. ],[
  2440. AC_MSG_RESULT([yes])
  2441. tst_compi_getpeername="yes"
  2442. ],[
  2443. AC_MSG_RESULT([no])
  2444. tst_compi_getpeername="no"
  2445. ])
  2446. fi
  2447. #
  2448. if test "$tst_compi_getpeername" = "yes"; then
  2449. AC_MSG_CHECKING([if getpeername usage allowed])
  2450. if test "x$curl_disallow_getpeername" != "xyes"; then
  2451. AC_MSG_RESULT([yes])
  2452. tst_allow_getpeername="yes"
  2453. else
  2454. AC_MSG_RESULT([no])
  2455. tst_allow_getpeername="no"
  2456. fi
  2457. fi
  2458. #
  2459. AC_MSG_CHECKING([if getpeername might be used])
  2460. if test "$tst_links_getpeername" = "yes" &&
  2461. test "$tst_proto_getpeername" = "yes" &&
  2462. test "$tst_compi_getpeername" = "yes" &&
  2463. test "$tst_allow_getpeername" = "yes"; then
  2464. AC_MSG_RESULT([yes])
  2465. AC_DEFINE_UNQUOTED(HAVE_GETPEERNAME, 1,
  2466. [Define to 1 if you have the getpeername function.])
  2467. curl_cv_func_getpeername="yes"
  2468. else
  2469. AC_MSG_RESULT([no])
  2470. curl_cv_func_getpeername="no"
  2471. fi
  2472. ])
  2473. dnl CURL_CHECK_FUNC_GETSOCKNAME
  2474. dnl -------------------------------------------------
  2475. dnl Verify if getsockname is available, prototyped, and
  2476. dnl can be compiled. If all of these are true, and
  2477. dnl usage has not been previously disallowed with
  2478. dnl shell variable curl_disallow_getsockname, then
  2479. dnl HAVE_GETSOCKNAME will be defined.
  2480. AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [
  2481. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2482. AC_REQUIRE([CURL_INCLUDES_UNISTD])dnl
  2483. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2484. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  2485. #
  2486. tst_links_getsockname="unknown"
  2487. tst_proto_getsockname="unknown"
  2488. tst_compi_getsockname="unknown"
  2489. tst_allow_getsockname="unknown"
  2490. #
  2491. AC_MSG_CHECKING([if getsockname can be linked])
  2492. AC_LINK_IFELSE([
  2493. AC_LANG_PROGRAM([[
  2494. $curl_includes_winsock2
  2495. $curl_includes_bsdsocket
  2496. $curl_includes_sys_socket
  2497. ]],[[
  2498. if(0 != getsockname(0, (void *)0, (void *)0))
  2499. return 1;
  2500. ]])
  2501. ],[
  2502. AC_MSG_RESULT([yes])
  2503. tst_links_getsockname="yes"
  2504. ],[
  2505. AC_MSG_RESULT([no])
  2506. tst_links_getsockname="no"
  2507. ])
  2508. #
  2509. if test "$tst_links_getsockname" = "yes"; then
  2510. AC_MSG_CHECKING([if getsockname is prototyped])
  2511. AC_EGREP_CPP([getsockname],[
  2512. $curl_includes_winsock2
  2513. $curl_includes_bsdsocket
  2514. $curl_includes_sys_socket
  2515. ],[
  2516. AC_MSG_RESULT([yes])
  2517. tst_proto_getsockname="yes"
  2518. ],[
  2519. AC_MSG_RESULT([no])
  2520. tst_proto_getsockname="no"
  2521. ])
  2522. fi
  2523. #
  2524. if test "$tst_proto_getsockname" = "yes"; then
  2525. AC_MSG_CHECKING([if getsockname is compilable])
  2526. AC_COMPILE_IFELSE([
  2527. AC_LANG_PROGRAM([[
  2528. $curl_includes_winsock2
  2529. $curl_includes_bsdsocket
  2530. $curl_includes_sys_socket
  2531. ]],[[
  2532. if(0 != getsockname(0, (void *)0, (void *)0))
  2533. return 1;
  2534. ]])
  2535. ],[
  2536. AC_MSG_RESULT([yes])
  2537. tst_compi_getsockname="yes"
  2538. ],[
  2539. AC_MSG_RESULT([no])
  2540. tst_compi_getsockname="no"
  2541. ])
  2542. fi
  2543. #
  2544. if test "$tst_compi_getsockname" = "yes"; then
  2545. AC_MSG_CHECKING([if getsockname usage allowed])
  2546. if test "x$curl_disallow_getsockname" != "xyes"; then
  2547. AC_MSG_RESULT([yes])
  2548. tst_allow_getsockname="yes"
  2549. else
  2550. AC_MSG_RESULT([no])
  2551. tst_allow_getsockname="no"
  2552. fi
  2553. fi
  2554. #
  2555. AC_MSG_CHECKING([if getsockname might be used])
  2556. if test "$tst_links_getsockname" = "yes" &&
  2557. test "$tst_proto_getsockname" = "yes" &&
  2558. test "$tst_compi_getsockname" = "yes" &&
  2559. test "$tst_allow_getsockname" = "yes"; then
  2560. AC_MSG_RESULT([yes])
  2561. AC_DEFINE_UNQUOTED(HAVE_GETSOCKNAME, 1,
  2562. [Define to 1 if you have the getsockname function.])
  2563. curl_cv_func_getsockname="yes"
  2564. else
  2565. AC_MSG_RESULT([no])
  2566. curl_cv_func_getsockname="no"
  2567. fi
  2568. ])
  2569. dnl CURL_CHECK_FUNC_IF_NAMETOINDEX
  2570. dnl -------------------------------------------------
  2571. dnl Verify if if_nametoindex is available, prototyped, and
  2572. dnl can be compiled. If all of these are true, and
  2573. dnl usage has not been previously disallowed with
  2574. dnl shell variable curl_disallow_if_nametoindex, then
  2575. dnl HAVE_IF_NAMETOINDEX will be defined.
  2576. AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [
  2577. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  2578. AC_REQUIRE([CURL_INCLUDES_NETIF])dnl
  2579. AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
  2580. #
  2581. tst_links_if_nametoindex="unknown"
  2582. tst_proto_if_nametoindex="unknown"
  2583. tst_compi_if_nametoindex="unknown"
  2584. tst_allow_if_nametoindex="unknown"
  2585. #
  2586. AC_MSG_CHECKING([if if_nametoindex can be linked])
  2587. AC_LINK_IFELSE([
  2588. AC_LANG_PROGRAM([[
  2589. $curl_includes_winsock2
  2590. $curl_includes_bsdsocket
  2591. #include <net/if.h>
  2592. ]],[[
  2593. if(0 != if_nametoindex(""))
  2594. return 1;
  2595. ]])
  2596. ],[
  2597. AC_MSG_RESULT([yes])
  2598. tst_links_if_nametoindex="yes"
  2599. ],[
  2600. AC_MSG_RESULT([no])
  2601. tst_links_if_nametoindex="no"
  2602. ])
  2603. #
  2604. if test "$tst_links_if_nametoindex" = "yes"; then
  2605. AC_MSG_CHECKING([if if_nametoindex is prototyped])
  2606. AC_EGREP_CPP([if_nametoindex],[
  2607. $curl_includes_winsock2
  2608. $curl_includes_netif
  2609. ],[
  2610. AC_MSG_RESULT([yes])
  2611. tst_proto_if_nametoindex="yes"
  2612. ],[
  2613. AC_MSG_RESULT([no])
  2614. tst_proto_if_nametoindex="no"
  2615. ])
  2616. fi
  2617. #
  2618. if test "$tst_proto_if_nametoindex" = "yes"; then
  2619. AC_MSG_CHECKING([if if_nametoindex is compilable])
  2620. AC_COMPILE_IFELSE([
  2621. AC_LANG_PROGRAM([[
  2622. $curl_includes_winsock2
  2623. $curl_includes_netif
  2624. ]],[[
  2625. if(0 != if_nametoindex(""))
  2626. return 1;
  2627. ]])
  2628. ],[
  2629. AC_MSG_RESULT([yes])
  2630. tst_compi_if_nametoindex="yes"
  2631. ],[
  2632. AC_MSG_RESULT([no])
  2633. tst_compi_if_nametoindex="no"
  2634. ])
  2635. fi
  2636. #
  2637. if test "$tst_compi_if_nametoindex" = "yes"; then
  2638. AC_MSG_CHECKING([if if_nametoindex usage allowed])
  2639. if test "x$curl_disallow_if_nametoindex" != "xyes"; then
  2640. AC_MSG_RESULT([yes])
  2641. tst_allow_if_nametoindex="yes"
  2642. else
  2643. AC_MSG_RESULT([no])
  2644. tst_allow_if_nametoindex="no"
  2645. fi
  2646. fi
  2647. #
  2648. AC_MSG_CHECKING([if if_nametoindex might be used])
  2649. if test "$tst_links_if_nametoindex" = "yes" &&
  2650. test "$tst_proto_if_nametoindex" = "yes" &&
  2651. test "$tst_compi_if_nametoindex" = "yes" &&
  2652. test "$tst_allow_if_nametoindex" = "yes"; then
  2653. AC_MSG_RESULT([yes])
  2654. AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1,
  2655. [Define to 1 if you have the if_nametoindex function.])
  2656. curl_cv_func_if_nametoindex="yes"
  2657. else
  2658. AC_MSG_RESULT([no])
  2659. curl_cv_func_if_nametoindex="no"
  2660. fi
  2661. ])
  2662. dnl CURL_CHECK_FUNC_GETIFADDRS
  2663. dnl -------------------------------------------------
  2664. dnl Verify if getifaddrs is available, prototyped, can
  2665. dnl be compiled and seems to work. If all of these are
  2666. dnl true, and usage has not been previously disallowed
  2667. dnl with shell variable curl_disallow_getifaddrs, then
  2668. dnl HAVE_GETIFADDRS will be defined.
  2669. AC_DEFUN([CURL_CHECK_FUNC_GETIFADDRS], [
  2670. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2671. AC_REQUIRE([CURL_INCLUDES_IFADDRS])dnl
  2672. #
  2673. tst_links_getifaddrs="unknown"
  2674. tst_proto_getifaddrs="unknown"
  2675. tst_compi_getifaddrs="unknown"
  2676. tst_works_getifaddrs="unknown"
  2677. tst_allow_getifaddrs="unknown"
  2678. #
  2679. AC_MSG_CHECKING([if getifaddrs can be linked])
  2680. AC_LINK_IFELSE([
  2681. AC_LANG_FUNC_LINK_TRY([getifaddrs])
  2682. ],[
  2683. AC_MSG_RESULT([yes])
  2684. tst_links_getifaddrs="yes"
  2685. ],[
  2686. AC_MSG_RESULT([no])
  2687. tst_links_getifaddrs="no"
  2688. ])
  2689. #
  2690. if test "$tst_links_getifaddrs" = "yes"; then
  2691. AC_MSG_CHECKING([if getifaddrs is prototyped])
  2692. AC_EGREP_CPP([getifaddrs],[
  2693. $curl_includes_ifaddrs
  2694. ],[
  2695. AC_MSG_RESULT([yes])
  2696. tst_proto_getifaddrs="yes"
  2697. ],[
  2698. AC_MSG_RESULT([no])
  2699. tst_proto_getifaddrs="no"
  2700. ])
  2701. fi
  2702. #
  2703. if test "$tst_proto_getifaddrs" = "yes"; then
  2704. AC_MSG_CHECKING([if getifaddrs is compilable])
  2705. AC_COMPILE_IFELSE([
  2706. AC_LANG_PROGRAM([[
  2707. $curl_includes_ifaddrs
  2708. ]],[[
  2709. if(0 != getifaddrs(0))
  2710. return 1;
  2711. ]])
  2712. ],[
  2713. AC_MSG_RESULT([yes])
  2714. tst_compi_getifaddrs="yes"
  2715. ],[
  2716. AC_MSG_RESULT([no])
  2717. tst_compi_getifaddrs="no"
  2718. ])
  2719. fi
  2720. #
  2721. dnl only do runtime verification when not cross-compiling
  2722. if test "x$cross_compiling" != "xyes" &&
  2723. test "$tst_compi_getifaddrs" = "yes"; then
  2724. AC_MSG_CHECKING([if getifaddrs seems to work])
  2725. CURL_RUN_IFELSE([
  2726. AC_LANG_PROGRAM([[
  2727. $curl_includes_stdlib
  2728. $curl_includes_ifaddrs
  2729. ]],[[
  2730. struct ifaddrs *ifa = 0;
  2731. int error;
  2732. error = getifaddrs(&ifa);
  2733. if(error || !ifa)
  2734. exit(1); /* fail */
  2735. else
  2736. exit(0);
  2737. ]])
  2738. ],[
  2739. AC_MSG_RESULT([yes])
  2740. tst_works_getifaddrs="yes"
  2741. ],[
  2742. AC_MSG_RESULT([no])
  2743. tst_works_getifaddrs="no"
  2744. ])
  2745. fi
  2746. #
  2747. if test "$tst_compi_getifaddrs" = "yes" &&
  2748. test "$tst_works_getifaddrs" != "no"; then
  2749. AC_MSG_CHECKING([if getifaddrs usage allowed])
  2750. if test "x$curl_disallow_getifaddrs" != "xyes"; then
  2751. AC_MSG_RESULT([yes])
  2752. tst_allow_getifaddrs="yes"
  2753. else
  2754. AC_MSG_RESULT([no])
  2755. tst_allow_getifaddrs="no"
  2756. fi
  2757. fi
  2758. #
  2759. AC_MSG_CHECKING([if getifaddrs might be used])
  2760. if test "$tst_links_getifaddrs" = "yes" &&
  2761. test "$tst_proto_getifaddrs" = "yes" &&
  2762. test "$tst_compi_getifaddrs" = "yes" &&
  2763. test "$tst_allow_getifaddrs" = "yes" &&
  2764. test "$tst_works_getifaddrs" != "no"; then
  2765. AC_MSG_RESULT([yes])
  2766. AC_DEFINE_UNQUOTED(HAVE_GETIFADDRS, 1,
  2767. [Define to 1 if you have a working getifaddrs function.])
  2768. curl_cv_func_getifaddrs="yes"
  2769. else
  2770. AC_MSG_RESULT([no])
  2771. curl_cv_func_getifaddrs="no"
  2772. fi
  2773. ])
  2774. dnl CURL_CHECK_FUNC_GETXATTR
  2775. dnl -------------------------------------------------
  2776. dnl Verify if getxattr is available, prototyped, and
  2777. dnl can be compiled. If all of these are true, and
  2778. dnl usage has not been previously disallowed with
  2779. dnl shell variable curl_disallow_getxattr, then
  2780. dnl HAVE_GETXATTR will be defined.
  2781. AC_DEFUN([CURL_CHECK_FUNC_GETXATTR], [
  2782. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  2783. #
  2784. tst_links_getxattr="unknown"
  2785. tst_proto_getxattr="unknown"
  2786. tst_compi_getxattr="unknown"
  2787. tst_allow_getxattr="unknown"
  2788. tst_nargs_getxattr="unknown"
  2789. #
  2790. AC_MSG_CHECKING([if getxattr can be linked])
  2791. AC_LINK_IFELSE([
  2792. AC_LANG_FUNC_LINK_TRY([getxattr])
  2793. ],[
  2794. AC_MSG_RESULT([yes])
  2795. tst_links_getxattr="yes"
  2796. ],[
  2797. AC_MSG_RESULT([no])
  2798. tst_links_getxattr="no"
  2799. ])
  2800. #
  2801. if test "$tst_links_getxattr" = "yes"; then
  2802. AC_MSG_CHECKING([if getxattr is prototyped])
  2803. AC_EGREP_CPP([getxattr],[
  2804. $curl_includes_sys_xattr
  2805. ],[
  2806. AC_MSG_RESULT([yes])
  2807. tst_proto_getxattr="yes"
  2808. ],[
  2809. AC_MSG_RESULT([no])
  2810. tst_proto_getxattr="no"
  2811. ])
  2812. fi
  2813. #
  2814. if test "$tst_proto_getxattr" = "yes"; then
  2815. if test "$tst_nargs_getxattr" = "unknown"; then
  2816. AC_MSG_CHECKING([if getxattr takes 4 args.])
  2817. AC_COMPILE_IFELSE([
  2818. AC_LANG_PROGRAM([[
  2819. $curl_includes_sys_xattr
  2820. ]],[[
  2821. if(0 != getxattr(0, 0, 0, 0))
  2822. return 1;
  2823. ]])
  2824. ],[
  2825. AC_MSG_RESULT([yes])
  2826. tst_compi_getxattr="yes"
  2827. tst_nargs_getxattr="4"
  2828. ],[
  2829. AC_MSG_RESULT([no])
  2830. tst_compi_getxattr="no"
  2831. ])
  2832. fi
  2833. if test "$tst_nargs_getxattr" = "unknown"; then
  2834. AC_MSG_CHECKING([if getxattr takes 6 args.])
  2835. AC_COMPILE_IFELSE([
  2836. AC_LANG_PROGRAM([[
  2837. $curl_includes_sys_xattr
  2838. ]],[[
  2839. if(0 != getxattr(0, 0, 0, 0, 0, 0))
  2840. return 1;
  2841. ]])
  2842. ],[
  2843. AC_MSG_RESULT([yes])
  2844. tst_compi_getxattr="yes"
  2845. tst_nargs_getxattr="6"
  2846. ],[
  2847. AC_MSG_RESULT([no])
  2848. tst_compi_getxattr="no"
  2849. ])
  2850. fi
  2851. AC_MSG_CHECKING([if getxattr is compilable])
  2852. if test "$tst_compi_getxattr" = "yes"; then
  2853. AC_MSG_RESULT([yes])
  2854. else
  2855. AC_MSG_RESULT([no])
  2856. fi
  2857. fi
  2858. #
  2859. if test "$tst_compi_getxattr" = "yes"; then
  2860. AC_MSG_CHECKING([if getxattr usage allowed])
  2861. if test "x$curl_disallow_getxattr" != "xyes"; then
  2862. AC_MSG_RESULT([yes])
  2863. tst_allow_getxattr="yes"
  2864. else
  2865. AC_MSG_RESULT([no])
  2866. tst_allow_getxattr="no"
  2867. fi
  2868. fi
  2869. #
  2870. AC_MSG_CHECKING([if getxattr might be used])
  2871. if test "$tst_links_getxattr" = "yes" &&
  2872. test "$tst_proto_getxattr" = "yes" &&
  2873. test "$tst_compi_getxattr" = "yes" &&
  2874. test "$tst_allow_getxattr" = "yes"; then
  2875. AC_MSG_RESULT([yes])
  2876. AC_DEFINE_UNQUOTED(HAVE_GETXATTR, 1,
  2877. [Define to 1 if you have the getxattr function.])
  2878. dnl AC_DEFINE_UNQUOTED(GETXATTR_ARGS, $tst_nargs_getxattr,
  2879. dnl [Specifies the number of arguments to getxattr])
  2880. #
  2881. if test "$tst_nargs_getxattr" -eq "4"; then
  2882. AC_DEFINE(HAVE_GETXATTR_4, 1, [getxattr() takes 4 args])
  2883. elif test "$tst_nargs_getxattr" -eq "6"; then
  2884. AC_DEFINE(HAVE_GETXATTR_6, 1, [getxattr() takes 6 args])
  2885. fi
  2886. #
  2887. curl_cv_func_getxattr="yes"
  2888. else
  2889. AC_MSG_RESULT([no])
  2890. curl_cv_func_getxattr="no"
  2891. fi
  2892. ])
  2893. dnl CURL_CHECK_FUNC_GMTIME_R
  2894. dnl -------------------------------------------------
  2895. dnl Verify if gmtime_r is available, prototyped, can
  2896. dnl be compiled and seems to work. If all of these are
  2897. dnl true, and usage has not been previously disallowed
  2898. dnl with shell variable curl_disallow_gmtime_r, then
  2899. dnl HAVE_GMTIME_R will be defined.
  2900. AC_DEFUN([CURL_CHECK_FUNC_GMTIME_R], [
  2901. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  2902. AC_REQUIRE([CURL_INCLUDES_TIME])dnl
  2903. #
  2904. tst_links_gmtime_r="unknown"
  2905. tst_proto_gmtime_r="unknown"
  2906. tst_compi_gmtime_r="unknown"
  2907. tst_works_gmtime_r="unknown"
  2908. tst_allow_gmtime_r="unknown"
  2909. #
  2910. AC_MSG_CHECKING([if gmtime_r can be linked])
  2911. AC_LINK_IFELSE([
  2912. AC_LANG_FUNC_LINK_TRY([gmtime_r])
  2913. ],[
  2914. AC_MSG_RESULT([yes])
  2915. tst_links_gmtime_r="yes"
  2916. ],[
  2917. AC_MSG_RESULT([no])
  2918. tst_links_gmtime_r="no"
  2919. ])
  2920. #
  2921. if test "$tst_links_gmtime_r" = "yes"; then
  2922. AC_MSG_CHECKING([if gmtime_r is prototyped])
  2923. AC_EGREP_CPP([gmtime_r],[
  2924. $curl_includes_time
  2925. ],[
  2926. AC_MSG_RESULT([yes])
  2927. tst_proto_gmtime_r="yes"
  2928. ],[
  2929. AC_MSG_RESULT([no])
  2930. tst_proto_gmtime_r="no"
  2931. ])
  2932. fi
  2933. #
  2934. if test "$tst_proto_gmtime_r" = "yes"; then
  2935. AC_MSG_CHECKING([if gmtime_r is compilable])
  2936. AC_COMPILE_IFELSE([
  2937. AC_LANG_PROGRAM([[
  2938. $curl_includes_time
  2939. ]],[[
  2940. if(0 != gmtime_r(0, 0))
  2941. return 1;
  2942. ]])
  2943. ],[
  2944. AC_MSG_RESULT([yes])
  2945. tst_compi_gmtime_r="yes"
  2946. ],[
  2947. AC_MSG_RESULT([no])
  2948. tst_compi_gmtime_r="no"
  2949. ])
  2950. fi
  2951. #
  2952. dnl only do runtime verification when not cross-compiling
  2953. if test "x$cross_compiling" != "xyes" &&
  2954. test "$tst_compi_gmtime_r" = "yes"; then
  2955. AC_MSG_CHECKING([if gmtime_r seems to work])
  2956. CURL_RUN_IFELSE([
  2957. AC_LANG_PROGRAM([[
  2958. $curl_includes_stdlib
  2959. $curl_includes_time
  2960. ]],[[
  2961. time_t local = 1170352587;
  2962. struct tm *gmt = 0;
  2963. struct tm result;
  2964. gmt = gmtime_r(&local, &result);
  2965. if(gmt)
  2966. exit(0);
  2967. else
  2968. exit(1);
  2969. ]])
  2970. ],[
  2971. AC_MSG_RESULT([yes])
  2972. tst_works_gmtime_r="yes"
  2973. ],[
  2974. AC_MSG_RESULT([no])
  2975. tst_works_gmtime_r="no"
  2976. ])
  2977. fi
  2978. #
  2979. if test "$tst_compi_gmtime_r" = "yes" &&
  2980. test "$tst_works_gmtime_r" != "no"; then
  2981. AC_MSG_CHECKING([if gmtime_r usage allowed])
  2982. if test "x$curl_disallow_gmtime_r" != "xyes"; then
  2983. AC_MSG_RESULT([yes])
  2984. tst_allow_gmtime_r="yes"
  2985. else
  2986. AC_MSG_RESULT([no])
  2987. tst_allow_gmtime_r="no"
  2988. fi
  2989. fi
  2990. #
  2991. AC_MSG_CHECKING([if gmtime_r might be used])
  2992. if test "$tst_links_gmtime_r" = "yes" &&
  2993. test "$tst_proto_gmtime_r" = "yes" &&
  2994. test "$tst_compi_gmtime_r" = "yes" &&
  2995. test "$tst_allow_gmtime_r" = "yes" &&
  2996. test "$tst_works_gmtime_r" != "no"; then
  2997. AC_MSG_RESULT([yes])
  2998. AC_DEFINE_UNQUOTED(HAVE_GMTIME_R, 1,
  2999. [Define to 1 if you have a working gmtime_r function.])
  3000. curl_cv_func_gmtime_r="yes"
  3001. else
  3002. AC_MSG_RESULT([no])
  3003. curl_cv_func_gmtime_r="no"
  3004. fi
  3005. ])
  3006. dnl CURL_CHECK_FUNC_INET_NTOP
  3007. dnl -------------------------------------------------
  3008. dnl Verify if inet_ntop is available, prototyped, can
  3009. dnl be compiled and seems to work. If all of these are
  3010. dnl true, and usage has not been previously disallowed
  3011. dnl with shell variable curl_disallow_inet_ntop, then
  3012. dnl HAVE_INET_NTOP will be defined.
  3013. AC_DEFUN([CURL_CHECK_FUNC_INET_NTOP], [
  3014. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  3015. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  3016. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3017. #
  3018. tst_links_inet_ntop="unknown"
  3019. tst_proto_inet_ntop="unknown"
  3020. tst_compi_inet_ntop="unknown"
  3021. tst_works_inet_ntop="unknown"
  3022. tst_allow_inet_ntop="unknown"
  3023. #
  3024. AC_MSG_CHECKING([if inet_ntop can be linked])
  3025. AC_LINK_IFELSE([
  3026. AC_LANG_FUNC_LINK_TRY([inet_ntop])
  3027. ],[
  3028. AC_MSG_RESULT([yes])
  3029. tst_links_inet_ntop="yes"
  3030. ],[
  3031. AC_MSG_RESULT([no])
  3032. tst_links_inet_ntop="no"
  3033. ])
  3034. #
  3035. if test "$tst_links_inet_ntop" = "yes"; then
  3036. AC_MSG_CHECKING([if inet_ntop is prototyped])
  3037. AC_EGREP_CPP([inet_ntop],[
  3038. $curl_includes_arpa_inet
  3039. ],[
  3040. AC_MSG_RESULT([yes])
  3041. tst_proto_inet_ntop="yes"
  3042. ],[
  3043. AC_MSG_RESULT([no])
  3044. tst_proto_inet_ntop="no"
  3045. ])
  3046. fi
  3047. #
  3048. if test "$tst_proto_inet_ntop" = "yes"; then
  3049. AC_MSG_CHECKING([if inet_ntop is compilable])
  3050. AC_COMPILE_IFELSE([
  3051. AC_LANG_PROGRAM([[
  3052. $curl_includes_arpa_inet
  3053. ]],[[
  3054. if(0 != inet_ntop(0, 0, 0, 0))
  3055. return 1;
  3056. ]])
  3057. ],[
  3058. AC_MSG_RESULT([yes])
  3059. tst_compi_inet_ntop="yes"
  3060. ],[
  3061. AC_MSG_RESULT([no])
  3062. tst_compi_inet_ntop="no"
  3063. ])
  3064. fi
  3065. #
  3066. dnl only do runtime verification when not cross-compiling
  3067. if test "x$cross_compiling" != "xyes" &&
  3068. test "$tst_compi_inet_ntop" = "yes"; then
  3069. AC_MSG_CHECKING([if inet_ntop seems to work])
  3070. CURL_RUN_IFELSE([
  3071. AC_LANG_PROGRAM([[
  3072. $curl_includes_stdlib
  3073. $curl_includes_arpa_inet
  3074. $curl_includes_string
  3075. ]],[[
  3076. char ipv6res[sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255")];
  3077. char ipv4res[sizeof "255.255.255.255"];
  3078. unsigned char ipv6a[26];
  3079. unsigned char ipv4a[5];
  3080. char *ipv6ptr = 0;
  3081. char *ipv4ptr = 0;
  3082. /* - */
  3083. ipv4res[0] = '\0';
  3084. ipv4a[0] = 0xc0;
  3085. ipv4a[1] = 0xa8;
  3086. ipv4a[2] = 0x64;
  3087. ipv4a[3] = 0x01;
  3088. ipv4a[4] = 0x01;
  3089. /* - */
  3090. ipv4ptr = inet_ntop(AF_INET, ipv4a, ipv4res, sizeof(ipv4res));
  3091. if(!ipv4ptr)
  3092. exit(1); /* fail */
  3093. if(ipv4ptr != ipv4res)
  3094. exit(1); /* fail */
  3095. if(!ipv4ptr[0])
  3096. exit(1); /* fail */
  3097. if(memcmp(ipv4res, "192.168.100.1", 13) != 0)
  3098. exit(1); /* fail */
  3099. /* - */
  3100. ipv6res[0] = '\0';
  3101. memset(ipv6a, 0, sizeof(ipv6a));
  3102. ipv6a[0] = 0xfe;
  3103. ipv6a[1] = 0x80;
  3104. ipv6a[8] = 0x02;
  3105. ipv6a[9] = 0x14;
  3106. ipv6a[10] = 0x4f;
  3107. ipv6a[11] = 0xff;
  3108. ipv6a[12] = 0xfe;
  3109. ipv6a[13] = 0x0b;
  3110. ipv6a[14] = 0x76;
  3111. ipv6a[15] = 0xc8;
  3112. ipv6a[25] = 0x01;
  3113. /* - */
  3114. ipv6ptr = inet_ntop(AF_INET6, ipv6a, ipv6res, sizeof(ipv6res));
  3115. if(!ipv6ptr)
  3116. exit(1); /* fail */
  3117. if(ipv6ptr != ipv6res)
  3118. exit(1); /* fail */
  3119. if(!ipv6ptr[0])
  3120. exit(1); /* fail */
  3121. if(memcmp(ipv6res, "fe80::214:4fff:fe0b:76c8", 24) != 0)
  3122. exit(1); /* fail */
  3123. /* - */
  3124. exit(0);
  3125. ]])
  3126. ],[
  3127. AC_MSG_RESULT([yes])
  3128. tst_works_inet_ntop="yes"
  3129. ],[
  3130. AC_MSG_RESULT([no])
  3131. tst_works_inet_ntop="no"
  3132. ])
  3133. fi
  3134. #
  3135. if test "$tst_compi_inet_ntop" = "yes" &&
  3136. test "$tst_works_inet_ntop" != "no"; then
  3137. AC_MSG_CHECKING([if inet_ntop usage allowed])
  3138. if test "x$curl_disallow_inet_ntop" != "xyes"; then
  3139. AC_MSG_RESULT([yes])
  3140. tst_allow_inet_ntop="yes"
  3141. else
  3142. AC_MSG_RESULT([no])
  3143. tst_allow_inet_ntop="no"
  3144. fi
  3145. fi
  3146. #
  3147. AC_MSG_CHECKING([if inet_ntop might be used])
  3148. if test "$tst_links_inet_ntop" = "yes" &&
  3149. test "$tst_proto_inet_ntop" = "yes" &&
  3150. test "$tst_compi_inet_ntop" = "yes" &&
  3151. test "$tst_allow_inet_ntop" = "yes" &&
  3152. test "$tst_works_inet_ntop" != "no"; then
  3153. AC_MSG_RESULT([yes])
  3154. AC_DEFINE_UNQUOTED(HAVE_INET_NTOP, 1,
  3155. [Define to 1 if you have a IPv6 capable working inet_ntop function.])
  3156. curl_cv_func_inet_ntop="yes"
  3157. else
  3158. AC_MSG_RESULT([no])
  3159. curl_cv_func_inet_ntop="no"
  3160. fi
  3161. ])
  3162. dnl CURL_CHECK_FUNC_INET_PTON
  3163. dnl -------------------------------------------------
  3164. dnl Verify if inet_pton is available, prototyped, can
  3165. dnl be compiled and seems to work. If all of these are
  3166. dnl true, and usage has not been previously disallowed
  3167. dnl with shell variable curl_disallow_inet_pton, then
  3168. dnl HAVE_INET_PTON will be defined.
  3169. AC_DEFUN([CURL_CHECK_FUNC_INET_PTON], [
  3170. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  3171. AC_REQUIRE([CURL_INCLUDES_ARPA_INET])dnl
  3172. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3173. #
  3174. tst_links_inet_pton="unknown"
  3175. tst_proto_inet_pton="unknown"
  3176. tst_compi_inet_pton="unknown"
  3177. tst_works_inet_pton="unknown"
  3178. tst_allow_inet_pton="unknown"
  3179. #
  3180. AC_MSG_CHECKING([if inet_pton can be linked])
  3181. AC_LINK_IFELSE([
  3182. AC_LANG_FUNC_LINK_TRY([inet_pton])
  3183. ],[
  3184. AC_MSG_RESULT([yes])
  3185. tst_links_inet_pton="yes"
  3186. ],[
  3187. AC_MSG_RESULT([no])
  3188. tst_links_inet_pton="no"
  3189. ])
  3190. #
  3191. if test "$tst_links_inet_pton" = "yes"; then
  3192. AC_MSG_CHECKING([if inet_pton is prototyped])
  3193. AC_EGREP_CPP([inet_pton],[
  3194. $curl_includes_arpa_inet
  3195. ],[
  3196. AC_MSG_RESULT([yes])
  3197. tst_proto_inet_pton="yes"
  3198. ],[
  3199. AC_MSG_RESULT([no])
  3200. tst_proto_inet_pton="no"
  3201. ])
  3202. fi
  3203. #
  3204. if test "$tst_proto_inet_pton" = "yes"; then
  3205. AC_MSG_CHECKING([if inet_pton is compilable])
  3206. AC_COMPILE_IFELSE([
  3207. AC_LANG_PROGRAM([[
  3208. $curl_includes_arpa_inet
  3209. ]],[[
  3210. if(0 != inet_pton(0, 0, 0))
  3211. return 1;
  3212. ]])
  3213. ],[
  3214. AC_MSG_RESULT([yes])
  3215. tst_compi_inet_pton="yes"
  3216. ],[
  3217. AC_MSG_RESULT([no])
  3218. tst_compi_inet_pton="no"
  3219. ])
  3220. fi
  3221. #
  3222. dnl only do runtime verification when not cross-compiling
  3223. if test "x$cross_compiling" != "xyes" &&
  3224. test "$tst_compi_inet_pton" = "yes"; then
  3225. AC_MSG_CHECKING([if inet_pton seems to work])
  3226. CURL_RUN_IFELSE([
  3227. AC_LANG_PROGRAM([[
  3228. $curl_includes_stdlib
  3229. $curl_includes_arpa_inet
  3230. $curl_includes_string
  3231. ]],[[
  3232. unsigned char ipv6a[16+1];
  3233. unsigned char ipv4a[4+1];
  3234. const char *ipv6src = "fe80::214:4fff:fe0b:76c8";
  3235. const char *ipv4src = "192.168.100.1";
  3236. /* - */
  3237. memset(ipv4a, 1, sizeof(ipv4a));
  3238. if(1 != inet_pton(AF_INET, ipv4src, ipv4a))
  3239. exit(1); /* fail */
  3240. /* - */
  3241. if( (ipv4a[0] != 0xc0) ||
  3242. (ipv4a[1] != 0xa8) ||
  3243. (ipv4a[2] != 0x64) ||
  3244. (ipv4a[3] != 0x01) ||
  3245. (ipv4a[4] != 0x01) )
  3246. exit(1); /* fail */
  3247. /* - */
  3248. memset(ipv6a, 1, sizeof(ipv6a));
  3249. if(1 != inet_pton(AF_INET6, ipv6src, ipv6a))
  3250. exit(1); /* fail */
  3251. /* - */
  3252. if( (ipv6a[0] != 0xfe) ||
  3253. (ipv6a[1] != 0x80) ||
  3254. (ipv6a[8] != 0x02) ||
  3255. (ipv6a[9] != 0x14) ||
  3256. (ipv6a[10] != 0x4f) ||
  3257. (ipv6a[11] != 0xff) ||
  3258. (ipv6a[12] != 0xfe) ||
  3259. (ipv6a[13] != 0x0b) ||
  3260. (ipv6a[14] != 0x76) ||
  3261. (ipv6a[15] != 0xc8) ||
  3262. (ipv6a[16] != 0x01) )
  3263. exit(1); /* fail */
  3264. /* - */
  3265. if( (ipv6a[2] != 0x0) ||
  3266. (ipv6a[3] != 0x0) ||
  3267. (ipv6a[4] != 0x0) ||
  3268. (ipv6a[5] != 0x0) ||
  3269. (ipv6a[6] != 0x0) ||
  3270. (ipv6a[7] != 0x0) )
  3271. exit(1); /* fail */
  3272. /* - */
  3273. exit(0);
  3274. ]])
  3275. ],[
  3276. AC_MSG_RESULT([yes])
  3277. tst_works_inet_pton="yes"
  3278. ],[
  3279. AC_MSG_RESULT([no])
  3280. tst_works_inet_pton="no"
  3281. ])
  3282. fi
  3283. #
  3284. if test "$tst_compi_inet_pton" = "yes" &&
  3285. test "$tst_works_inet_pton" != "no"; then
  3286. AC_MSG_CHECKING([if inet_pton usage allowed])
  3287. if test "x$curl_disallow_inet_pton" != "xyes"; then
  3288. AC_MSG_RESULT([yes])
  3289. tst_allow_inet_pton="yes"
  3290. else
  3291. AC_MSG_RESULT([no])
  3292. tst_allow_inet_pton="no"
  3293. fi
  3294. fi
  3295. #
  3296. AC_MSG_CHECKING([if inet_pton might be used])
  3297. if test "$tst_links_inet_pton" = "yes" &&
  3298. test "$tst_proto_inet_pton" = "yes" &&
  3299. test "$tst_compi_inet_pton" = "yes" &&
  3300. test "$tst_allow_inet_pton" = "yes" &&
  3301. test "$tst_works_inet_pton" != "no"; then
  3302. AC_MSG_RESULT([yes])
  3303. AC_DEFINE_UNQUOTED(HAVE_INET_PTON, 1,
  3304. [Define to 1 if you have a IPv6 capable working inet_pton function.])
  3305. curl_cv_func_inet_pton="yes"
  3306. else
  3307. AC_MSG_RESULT([no])
  3308. curl_cv_func_inet_pton="no"
  3309. fi
  3310. ])
  3311. dnl CURL_CHECK_FUNC_IOCTL_FIONBIO
  3312. dnl -------------------------------------------------
  3313. dnl Verify if ioctl with the FIONBIO command is
  3314. dnl available, can be compiled, and seems to work. If
  3315. dnl all of these are true, then HAVE_IOCTL_FIONBIO
  3316. dnl will be defined.
  3317. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_FIONBIO], [
  3318. #
  3319. tst_compi_ioctl_fionbio="unknown"
  3320. tst_allow_ioctl_fionbio="unknown"
  3321. #
  3322. if test "$curl_cv_func_ioctl" = "yes"; then
  3323. AC_MSG_CHECKING([if ioctl FIONBIO is compilable])
  3324. AC_COMPILE_IFELSE([
  3325. AC_LANG_PROGRAM([[
  3326. $curl_includes_stropts
  3327. ]],[[
  3328. int flags = 0;
  3329. if(0 != ioctl(0, FIONBIO, &flags))
  3330. return 1;
  3331. ]])
  3332. ],[
  3333. AC_MSG_RESULT([yes])
  3334. tst_compi_ioctl_fionbio="yes"
  3335. ],[
  3336. AC_MSG_RESULT([no])
  3337. tst_compi_ioctl_fionbio="no"
  3338. ])
  3339. fi
  3340. #
  3341. if test "$tst_compi_ioctl_fionbio" = "yes"; then
  3342. AC_MSG_CHECKING([if ioctl FIONBIO usage allowed])
  3343. if test "x$curl_disallow_ioctl_fionbio" != "xyes"; then
  3344. AC_MSG_RESULT([yes])
  3345. tst_allow_ioctl_fionbio="yes"
  3346. else
  3347. AC_MSG_RESULT([no])
  3348. tst_allow_ioctl_fionbio="no"
  3349. fi
  3350. fi
  3351. #
  3352. AC_MSG_CHECKING([if ioctl FIONBIO might be used])
  3353. if test "$tst_compi_ioctl_fionbio" = "yes" &&
  3354. test "$tst_allow_ioctl_fionbio" = "yes"; then
  3355. AC_MSG_RESULT([yes])
  3356. AC_DEFINE_UNQUOTED(HAVE_IOCTL_FIONBIO, 1,
  3357. [Define to 1 if you have a working ioctl FIONBIO function.])
  3358. curl_cv_func_ioctl_fionbio="yes"
  3359. else
  3360. AC_MSG_RESULT([no])
  3361. curl_cv_func_ioctl_fionbio="no"
  3362. fi
  3363. ])
  3364. dnl CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR
  3365. dnl -------------------------------------------------
  3366. dnl Verify if ioctl with the SIOCGIFADDR command is available,
  3367. dnl struct ifreq is defined, they can be compiled, and seem to
  3368. dnl work. If all of these are true, then HAVE_IOCTL_SIOCGIFADDR
  3369. dnl will be defined.
  3370. AC_DEFUN([CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR], [
  3371. #
  3372. tst_compi_ioctl_siocgifaddr="unknown"
  3373. tst_allow_ioctl_siocgifaddr="unknown"
  3374. #
  3375. if test "$curl_cv_func_ioctl" = "yes"; then
  3376. AC_MSG_CHECKING([if ioctl SIOCGIFADDR is compilable])
  3377. AC_COMPILE_IFELSE([
  3378. AC_LANG_PROGRAM([[
  3379. $curl_includes_stropts
  3380. #include <net/if.h>
  3381. ]],[[
  3382. struct ifreq ifr;
  3383. if(0 != ioctl(0, SIOCGIFADDR, &ifr))
  3384. return 1;
  3385. ]])
  3386. ],[
  3387. AC_MSG_RESULT([yes])
  3388. tst_compi_ioctl_siocgifaddr="yes"
  3389. ],[
  3390. AC_MSG_RESULT([no])
  3391. tst_compi_ioctl_siocgifaddr="no"
  3392. ])
  3393. fi
  3394. #
  3395. if test "$tst_compi_ioctl_siocgifaddr" = "yes"; then
  3396. AC_MSG_CHECKING([if ioctl SIOCGIFADDR usage allowed])
  3397. if test "x$curl_disallow_ioctl_siocgifaddr" != "xyes"; then
  3398. AC_MSG_RESULT([yes])
  3399. tst_allow_ioctl_siocgifaddr="yes"
  3400. else
  3401. AC_MSG_RESULT([no])
  3402. tst_allow_ioctl_siocgifaddr="no"
  3403. fi
  3404. fi
  3405. #
  3406. AC_MSG_CHECKING([if ioctl SIOCGIFADDR might be used])
  3407. if test "$tst_compi_ioctl_siocgifaddr" = "yes" &&
  3408. test "$tst_allow_ioctl_siocgifaddr" = "yes"; then
  3409. AC_MSG_RESULT([yes])
  3410. AC_DEFINE_UNQUOTED(HAVE_IOCTL_SIOCGIFADDR, 1,
  3411. [Define to 1 if you have a working ioctl SIOCGIFADDR function.])
  3412. curl_cv_func_ioctl_siocgifaddr="yes"
  3413. else
  3414. AC_MSG_RESULT([no])
  3415. curl_cv_func_ioctl_siocgifaddr="no"
  3416. fi
  3417. ])
  3418. dnl CURL_CHECK_FUNC_IOCTLSOCKET
  3419. dnl -------------------------------------------------
  3420. dnl Verify if ioctlsocket is available, prototyped, and
  3421. dnl can be compiled. If all of these are true, and
  3422. dnl usage has not been previously disallowed with
  3423. dnl shell variable curl_disallow_ioctlsocket, then
  3424. dnl HAVE_IOCTLSOCKET will be defined.
  3425. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET], [
  3426. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  3427. #
  3428. tst_links_ioctlsocket="unknown"
  3429. tst_proto_ioctlsocket="unknown"
  3430. tst_compi_ioctlsocket="unknown"
  3431. tst_allow_ioctlsocket="unknown"
  3432. #
  3433. AC_MSG_CHECKING([if ioctlsocket can be linked])
  3434. AC_LINK_IFELSE([
  3435. AC_LANG_PROGRAM([[
  3436. $curl_includes_winsock2
  3437. ]],[[
  3438. if(0 != ioctlsocket(0, 0, 0))
  3439. return 1;
  3440. ]])
  3441. ],[
  3442. AC_MSG_RESULT([yes])
  3443. tst_links_ioctlsocket="yes"
  3444. ],[
  3445. AC_MSG_RESULT([no])
  3446. tst_links_ioctlsocket="no"
  3447. ])
  3448. #
  3449. if test "$tst_links_ioctlsocket" = "yes"; then
  3450. AC_MSG_CHECKING([if ioctlsocket is prototyped])
  3451. AC_EGREP_CPP([ioctlsocket],[
  3452. $curl_includes_winsock2
  3453. ],[
  3454. AC_MSG_RESULT([yes])
  3455. tst_proto_ioctlsocket="yes"
  3456. ],[
  3457. AC_MSG_RESULT([no])
  3458. tst_proto_ioctlsocket="no"
  3459. ])
  3460. fi
  3461. #
  3462. if test "$tst_proto_ioctlsocket" = "yes"; then
  3463. AC_MSG_CHECKING([if ioctlsocket is compilable])
  3464. AC_COMPILE_IFELSE([
  3465. AC_LANG_PROGRAM([[
  3466. $curl_includes_winsock2
  3467. ]],[[
  3468. if(0 != ioctlsocket(0, 0, 0))
  3469. return 1;
  3470. ]])
  3471. ],[
  3472. AC_MSG_RESULT([yes])
  3473. tst_compi_ioctlsocket="yes"
  3474. ],[
  3475. AC_MSG_RESULT([no])
  3476. tst_compi_ioctlsocket="no"
  3477. ])
  3478. fi
  3479. #
  3480. if test "$tst_compi_ioctlsocket" = "yes"; then
  3481. AC_MSG_CHECKING([if ioctlsocket usage allowed])
  3482. if test "x$curl_disallow_ioctlsocket" != "xyes"; then
  3483. AC_MSG_RESULT([yes])
  3484. tst_allow_ioctlsocket="yes"
  3485. else
  3486. AC_MSG_RESULT([no])
  3487. tst_allow_ioctlsocket="no"
  3488. fi
  3489. fi
  3490. #
  3491. AC_MSG_CHECKING([if ioctlsocket might be used])
  3492. if test "$tst_links_ioctlsocket" = "yes" &&
  3493. test "$tst_proto_ioctlsocket" = "yes" &&
  3494. test "$tst_compi_ioctlsocket" = "yes" &&
  3495. test "$tst_allow_ioctlsocket" = "yes"; then
  3496. AC_MSG_RESULT([yes])
  3497. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET, 1,
  3498. [Define to 1 if you have the ioctlsocket function.])
  3499. curl_cv_func_ioctlsocket="yes"
  3500. CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  3501. else
  3502. AC_MSG_RESULT([no])
  3503. curl_cv_func_ioctlsocket="no"
  3504. fi
  3505. ])
  3506. dnl CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO
  3507. dnl -------------------------------------------------
  3508. dnl Verify if ioctlsocket with the FIONBIO command is
  3509. dnl available, can be compiled, and seems to work. If
  3510. dnl all of these are true, then HAVE_IOCTLSOCKET_FIONBIO
  3511. dnl will be defined.
  3512. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_FIONBIO], [
  3513. #
  3514. tst_compi_ioctlsocket_fionbio="unknown"
  3515. tst_allow_ioctlsocket_fionbio="unknown"
  3516. #
  3517. if test "$curl_cv_func_ioctlsocket" = "yes"; then
  3518. AC_MSG_CHECKING([if ioctlsocket FIONBIO is compilable])
  3519. AC_COMPILE_IFELSE([
  3520. AC_LANG_PROGRAM([[
  3521. $curl_includes_winsock2
  3522. ]],[[
  3523. int flags = 0;
  3524. if(0 != ioctlsocket(0, FIONBIO, &flags))
  3525. return 1;
  3526. ]])
  3527. ],[
  3528. AC_MSG_RESULT([yes])
  3529. tst_compi_ioctlsocket_fionbio="yes"
  3530. ],[
  3531. AC_MSG_RESULT([no])
  3532. tst_compi_ioctlsocket_fionbio="no"
  3533. ])
  3534. fi
  3535. #
  3536. if test "$tst_compi_ioctlsocket_fionbio" = "yes"; then
  3537. AC_MSG_CHECKING([if ioctlsocket FIONBIO usage allowed])
  3538. if test "x$curl_disallow_ioctlsocket_fionbio" != "xyes"; then
  3539. AC_MSG_RESULT([yes])
  3540. tst_allow_ioctlsocket_fionbio="yes"
  3541. else
  3542. AC_MSG_RESULT([no])
  3543. tst_allow_ioctlsocket_fionbio="no"
  3544. fi
  3545. fi
  3546. #
  3547. AC_MSG_CHECKING([if ioctlsocket FIONBIO might be used])
  3548. if test "$tst_compi_ioctlsocket_fionbio" = "yes" &&
  3549. test "$tst_allow_ioctlsocket_fionbio" = "yes"; then
  3550. AC_MSG_RESULT([yes])
  3551. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_FIONBIO, 1,
  3552. [Define to 1 if you have a working ioctlsocket FIONBIO function.])
  3553. curl_cv_func_ioctlsocket_fionbio="yes"
  3554. else
  3555. AC_MSG_RESULT([no])
  3556. curl_cv_func_ioctlsocket_fionbio="no"
  3557. fi
  3558. ])
  3559. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL
  3560. dnl -------------------------------------------------
  3561. dnl Verify if IoctlSocket is available, prototyped, and
  3562. dnl can be compiled. If all of these are true, and
  3563. dnl usage has not been previously disallowed with
  3564. dnl shell variable curl_disallow_ioctlsocket_camel,
  3565. dnl then HAVE_IOCTLSOCKET_CAMEL will be defined.
  3566. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL], [
  3567. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3568. #
  3569. tst_links_ioctlsocket_camel="unknown"
  3570. tst_proto_ioctlsocket_camel="unknown"
  3571. tst_compi_ioctlsocket_camel="unknown"
  3572. tst_allow_ioctlsocket_camel="unknown"
  3573. #
  3574. AC_MSG_CHECKING([if IoctlSocket can be linked])
  3575. AC_LINK_IFELSE([
  3576. AC_LANG_PROGRAM([[
  3577. $curl_includes_bsdsocket
  3578. ]],[[
  3579. IoctlSocket(0, 0, 0);
  3580. ]])
  3581. ],[
  3582. AC_MSG_RESULT([yes])
  3583. tst_links_ioctlsocket_camel="yes"
  3584. ],[
  3585. AC_MSG_RESULT([no])
  3586. tst_links_ioctlsocket_camel="no"
  3587. ])
  3588. #
  3589. if test "$tst_links_ioctlsocket_camel" = "yes"; then
  3590. AC_MSG_CHECKING([if IoctlSocket is prototyped])
  3591. AC_EGREP_CPP([IoctlSocket],[
  3592. $curl_includes_bsdsocket
  3593. ],[
  3594. AC_MSG_RESULT([yes])
  3595. tst_proto_ioctlsocket_camel="yes"
  3596. ],[
  3597. AC_MSG_RESULT([no])
  3598. tst_proto_ioctlsocket_camel="no"
  3599. ])
  3600. fi
  3601. #
  3602. if test "$tst_proto_ioctlsocket_camel" = "yes"; then
  3603. AC_MSG_CHECKING([if IoctlSocket is compilable])
  3604. AC_COMPILE_IFELSE([
  3605. AC_LANG_PROGRAM([[
  3606. $curl_includes_bsdsocket
  3607. ]],[[
  3608. if(0 != IoctlSocket(0, 0, 0))
  3609. return 1;
  3610. ]])
  3611. ],[
  3612. AC_MSG_RESULT([yes])
  3613. tst_compi_ioctlsocket_camel="yes"
  3614. ],[
  3615. AC_MSG_RESULT([no])
  3616. tst_compi_ioctlsocket_camel="no"
  3617. ])
  3618. fi
  3619. #
  3620. if test "$tst_compi_ioctlsocket_camel" = "yes"; then
  3621. AC_MSG_CHECKING([if IoctlSocket usage allowed])
  3622. if test "x$curl_disallow_ioctlsocket_camel" != "xyes"; then
  3623. AC_MSG_RESULT([yes])
  3624. tst_allow_ioctlsocket_camel="yes"
  3625. else
  3626. AC_MSG_RESULT([no])
  3627. tst_allow_ioctlsocket_camel="no"
  3628. fi
  3629. fi
  3630. #
  3631. AC_MSG_CHECKING([if IoctlSocket might be used])
  3632. if test "$tst_links_ioctlsocket_camel" = "yes" &&
  3633. test "$tst_proto_ioctlsocket_camel" = "yes" &&
  3634. test "$tst_compi_ioctlsocket_camel" = "yes" &&
  3635. test "$tst_allow_ioctlsocket_camel" = "yes"; then
  3636. AC_MSG_RESULT([yes])
  3637. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL, 1,
  3638. [Define to 1 if you have the IoctlSocket camel case function.])
  3639. curl_cv_func_ioctlsocket_camel="yes"
  3640. CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3641. else
  3642. AC_MSG_RESULT([no])
  3643. curl_cv_func_ioctlsocket_camel="no"
  3644. fi
  3645. ])
  3646. dnl CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO
  3647. dnl -------------------------------------------------
  3648. dnl Verify if IoctlSocket with FIONBIO command is available,
  3649. dnl can be compiled, and seems to work. If all of these are
  3650. dnl true, then HAVE_IOCTLSOCKET_CAMEL_FIONBIO will be defined.
  3651. AC_DEFUN([CURL_CHECK_FUNC_IOCTLSOCKET_CAMEL_FIONBIO], [
  3652. AC_REQUIRE([CURL_INCLUDES_BSDSOCKET])dnl
  3653. #
  3654. tst_compi_ioctlsocket_camel_fionbio="unknown"
  3655. tst_allow_ioctlsocket_camel_fionbio="unknown"
  3656. #
  3657. if test "$curl_cv_func_ioctlsocket_camel" = "yes"; then
  3658. AC_MSG_CHECKING([if IoctlSocket FIONBIO is compilable])
  3659. AC_COMPILE_IFELSE([
  3660. AC_LANG_PROGRAM([[
  3661. $curl_includes_bsdsocket
  3662. ]],[[
  3663. long flags = 0;
  3664. if(0 != IoctlSocket(0, FIONBIO, &flags))
  3665. return 1;
  3666. ]])
  3667. ],[
  3668. AC_MSG_RESULT([yes])
  3669. tst_compi_ioctlsocket_camel_fionbio="yes"
  3670. ],[
  3671. AC_MSG_RESULT([no])
  3672. tst_compi_ioctlsocket_camel_fionbio="no"
  3673. ])
  3674. fi
  3675. #
  3676. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes"; then
  3677. AC_MSG_CHECKING([if IoctlSocket FIONBIO usage allowed])
  3678. if test "x$curl_disallow_ioctlsocket_camel_fionbio" != "xyes"; then
  3679. AC_MSG_RESULT([yes])
  3680. tst_allow_ioctlsocket_camel_fionbio="yes"
  3681. else
  3682. AC_MSG_RESULT([no])
  3683. tst_allow_ioctlsocket_camel_fionbio="no"
  3684. fi
  3685. fi
  3686. #
  3687. AC_MSG_CHECKING([if IoctlSocket FIONBIO might be used])
  3688. if test "$tst_compi_ioctlsocket_camel_fionbio" = "yes" &&
  3689. test "$tst_allow_ioctlsocket_camel_fionbio" = "yes"; then
  3690. AC_MSG_RESULT([yes])
  3691. AC_DEFINE_UNQUOTED(HAVE_IOCTLSOCKET_CAMEL_FIONBIO, 1,
  3692. [Define to 1 if you have a working IoctlSocket camel case FIONBIO function.])
  3693. curl_cv_func_ioctlsocket_camel_fionbio="yes"
  3694. else
  3695. AC_MSG_RESULT([no])
  3696. curl_cv_func_ioctlsocket_camel_fionbio="no"
  3697. fi
  3698. ])
  3699. dnl CURL_CHECK_FUNC_LISTXATTR
  3700. dnl -------------------------------------------------
  3701. dnl Verify if listxattr is available, prototyped, and
  3702. dnl can be compiled. If all of these are true, and
  3703. dnl usage has not been previously disallowed with
  3704. dnl shell variable curl_disallow_listxattr, then
  3705. dnl HAVE_LISTXATTR will be defined.
  3706. AC_DEFUN([CURL_CHECK_FUNC_LISTXATTR], [
  3707. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  3708. #
  3709. tst_links_listxattr="unknown"
  3710. tst_proto_listxattr="unknown"
  3711. tst_compi_listxattr="unknown"
  3712. tst_allow_listxattr="unknown"
  3713. tst_nargs_listxattr="unknown"
  3714. #
  3715. AC_MSG_CHECKING([if listxattr can be linked])
  3716. AC_LINK_IFELSE([
  3717. AC_LANG_FUNC_LINK_TRY([listxattr])
  3718. ],[
  3719. AC_MSG_RESULT([yes])
  3720. tst_links_listxattr="yes"
  3721. ],[
  3722. AC_MSG_RESULT([no])
  3723. tst_links_listxattr="no"
  3724. ])
  3725. #
  3726. if test "$tst_links_listxattr" = "yes"; then
  3727. AC_MSG_CHECKING([if listxattr is prototyped])
  3728. AC_EGREP_CPP([listxattr],[
  3729. $curl_includes_sys_xattr
  3730. ],[
  3731. AC_MSG_RESULT([yes])
  3732. tst_proto_listxattr="yes"
  3733. ],[
  3734. AC_MSG_RESULT([no])
  3735. tst_proto_listxattr="no"
  3736. ])
  3737. fi
  3738. #
  3739. if test "$tst_proto_listxattr" = "yes"; then
  3740. if test "$tst_nargs_listxattr" = "unknown"; then
  3741. AC_MSG_CHECKING([if listxattr takes 3 args.])
  3742. AC_COMPILE_IFELSE([
  3743. AC_LANG_PROGRAM([[
  3744. $curl_includes_sys_xattr
  3745. ]],[[
  3746. if(0 != listxattr(0, 0, 0))
  3747. return 1;
  3748. ]])
  3749. ],[
  3750. AC_MSG_RESULT([yes])
  3751. tst_compi_listxattr="yes"
  3752. tst_nargs_listxattr="3"
  3753. ],[
  3754. AC_MSG_RESULT([no])
  3755. tst_compi_listxattr="no"
  3756. ])
  3757. fi
  3758. if test "$tst_nargs_listxattr" = "unknown"; then
  3759. AC_MSG_CHECKING([if listxattr takes 4 args.])
  3760. AC_COMPILE_IFELSE([
  3761. AC_LANG_PROGRAM([[
  3762. $curl_includes_sys_xattr
  3763. ]],[[
  3764. if(0 != listxattr(0, 0, 0, 0))
  3765. return 1;
  3766. ]])
  3767. ],[
  3768. AC_MSG_RESULT([yes])
  3769. tst_compi_listxattr="yes"
  3770. tst_nargs_listxattr="4"
  3771. ],[
  3772. AC_MSG_RESULT([no])
  3773. tst_compi_listxattr="no"
  3774. ])
  3775. fi
  3776. AC_MSG_CHECKING([if listxattr is compilable])
  3777. if test "$tst_compi_listxattr" = "yes"; then
  3778. AC_MSG_RESULT([yes])
  3779. else
  3780. AC_MSG_RESULT([no])
  3781. fi
  3782. fi
  3783. #
  3784. if test "$tst_compi_listxattr" = "yes"; then
  3785. AC_MSG_CHECKING([if listxattr usage allowed])
  3786. if test "x$curl_disallow_listxattr" != "xyes"; then
  3787. AC_MSG_RESULT([yes])
  3788. tst_allow_listxattr="yes"
  3789. else
  3790. AC_MSG_RESULT([no])
  3791. tst_allow_listxattr="no"
  3792. fi
  3793. fi
  3794. #
  3795. AC_MSG_CHECKING([if listxattr might be used])
  3796. if test "$tst_links_listxattr" = "yes" &&
  3797. test "$tst_proto_listxattr" = "yes" &&
  3798. test "$tst_compi_listxattr" = "yes" &&
  3799. test "$tst_allow_listxattr" = "yes"; then
  3800. AC_MSG_RESULT([yes])
  3801. AC_DEFINE_UNQUOTED(HAVE_LISTXATTR, 1,
  3802. [Define to 1 if you have the listxattr function.])
  3803. dnl AC_DEFINE_UNQUOTED(LISTXATTR_ARGS, $tst_nargs_listxattr,
  3804. dnl [Specifies the number of arguments to listxattr])
  3805. #
  3806. if test "$tst_nargs_listxattr" -eq "3"; then
  3807. AC_DEFINE(HAVE_LISTXATTR_3, 1, [listxattr() takes 3 args])
  3808. elif test "$tst_nargs_listxattr" -eq "4"; then
  3809. AC_DEFINE(HAVE_LISTXATTR_4, 1, [listxattr() takes 4 args])
  3810. fi
  3811. #
  3812. curl_cv_func_listxattr="yes"
  3813. else
  3814. AC_MSG_RESULT([no])
  3815. curl_cv_func_listxattr="no"
  3816. fi
  3817. ])
  3818. dnl CURL_CHECK_FUNC_MEMRCHR
  3819. dnl -------------------------------------------------
  3820. dnl Verify if memrchr is available, prototyped, and
  3821. dnl can be compiled. If all of these are true, and
  3822. dnl usage has not been previously disallowed with
  3823. dnl shell variable curl_disallow_memrchr, then
  3824. dnl HAVE_MEMRCHR will be defined.
  3825. AC_DEFUN([CURL_CHECK_FUNC_MEMRCHR], [
  3826. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  3827. #
  3828. tst_links_memrchr="unknown"
  3829. tst_macro_memrchr="unknown"
  3830. tst_proto_memrchr="unknown"
  3831. tst_compi_memrchr="unknown"
  3832. tst_allow_memrchr="unknown"
  3833. #
  3834. AC_MSG_CHECKING([if memrchr can be linked])
  3835. AC_LINK_IFELSE([
  3836. AC_LANG_FUNC_LINK_TRY([memrchr])
  3837. ],[
  3838. AC_MSG_RESULT([yes])
  3839. tst_links_memrchr="yes"
  3840. ],[
  3841. AC_MSG_RESULT([no])
  3842. tst_links_memrchr="no"
  3843. ])
  3844. #
  3845. if test "$tst_links_memrchr" = "no"; then
  3846. AC_MSG_CHECKING([if memrchr seems a macro])
  3847. AC_LINK_IFELSE([
  3848. AC_LANG_PROGRAM([[
  3849. $curl_includes_string
  3850. ]],[[
  3851. if(0 != memrchr(0, 0, 0))
  3852. return 1;
  3853. ]])
  3854. ],[
  3855. AC_MSG_RESULT([yes])
  3856. tst_macro_memrchr="yes"
  3857. ],[
  3858. AC_MSG_RESULT([no])
  3859. tst_macro_memrchr="no"
  3860. ])
  3861. fi
  3862. #
  3863. if test "$tst_links_memrchr" = "yes"; then
  3864. AC_MSG_CHECKING([if memrchr is prototyped])
  3865. AC_EGREP_CPP([memrchr],[
  3866. $curl_includes_string
  3867. ],[
  3868. AC_MSG_RESULT([yes])
  3869. tst_proto_memrchr="yes"
  3870. ],[
  3871. AC_MSG_RESULT([no])
  3872. tst_proto_memrchr="no"
  3873. ])
  3874. fi
  3875. #
  3876. if test "$tst_proto_memrchr" = "yes" ||
  3877. test "$tst_macro_memrchr" = "yes"; then
  3878. AC_MSG_CHECKING([if memrchr is compilable])
  3879. AC_COMPILE_IFELSE([
  3880. AC_LANG_PROGRAM([[
  3881. $curl_includes_string
  3882. ]],[[
  3883. if(0 != memrchr(0, 0, 0))
  3884. return 1;
  3885. ]])
  3886. ],[
  3887. AC_MSG_RESULT([yes])
  3888. tst_compi_memrchr="yes"
  3889. ],[
  3890. AC_MSG_RESULT([no])
  3891. tst_compi_memrchr="no"
  3892. ])
  3893. fi
  3894. #
  3895. if test "$tst_compi_memrchr" = "yes"; then
  3896. AC_MSG_CHECKING([if memrchr usage allowed])
  3897. if test "x$curl_disallow_memrchr" != "xyes"; then
  3898. AC_MSG_RESULT([yes])
  3899. tst_allow_memrchr="yes"
  3900. else
  3901. AC_MSG_RESULT([no])
  3902. tst_allow_memrchr="no"
  3903. fi
  3904. fi
  3905. #
  3906. AC_MSG_CHECKING([if memrchr might be used])
  3907. if (test "$tst_proto_memrchr" = "yes" ||
  3908. test "$tst_macro_memrchr" = "yes") &&
  3909. test "$tst_compi_memrchr" = "yes" &&
  3910. test "$tst_allow_memrchr" = "yes"; then
  3911. AC_MSG_RESULT([yes])
  3912. AC_DEFINE_UNQUOTED(HAVE_MEMRCHR, 1,
  3913. [Define to 1 if you have the memrchr function or macro.])
  3914. curl_cv_func_memrchr="yes"
  3915. else
  3916. AC_MSG_RESULT([no])
  3917. curl_cv_func_memrchr="no"
  3918. fi
  3919. ])
  3920. dnl CURL_CHECK_FUNC_POLL
  3921. dnl -------------------------------------------------
  3922. dnl Verify if poll is available, prototyped, can
  3923. dnl be compiled and seems to work.
  3924. AC_DEFUN([CURL_CHECK_FUNC_POLL], [
  3925. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  3926. AC_REQUIRE([CURL_INCLUDES_POLL])dnl
  3927. #
  3928. tst_links_poll="unknown"
  3929. tst_proto_poll="unknown"
  3930. tst_compi_poll="unknown"
  3931. tst_works_poll="unknown"
  3932. tst_allow_poll="unknown"
  3933. #
  3934. case $host_os in
  3935. darwin*|interix*)
  3936. dnl poll() does not work on these platforms
  3937. dnl Interix: "does provide poll(), but the implementing developer must
  3938. dnl have been in a bad mood, because poll() only works on the /proc
  3939. dnl filesystem here"
  3940. dnl macOS: poll() first didn't exist, then was broken until fixed in 10.9
  3941. dnl only to break again in 10.12.
  3942. curl_disallow_poll="yes"
  3943. tst_compi_poll="no"
  3944. ;;
  3945. esac
  3946. #
  3947. AC_MSG_CHECKING([if poll can be linked])
  3948. AC_LINK_IFELSE([
  3949. AC_LANG_PROGRAM([[
  3950. $curl_includes_poll
  3951. ]],[[
  3952. if(0 != poll(0, 0, 0))
  3953. return 1;
  3954. ]])
  3955. ],[
  3956. AC_MSG_RESULT([yes])
  3957. tst_links_poll="yes"
  3958. ],[
  3959. AC_MSG_RESULT([no])
  3960. tst_links_poll="no"
  3961. ])
  3962. #
  3963. if test "$tst_links_poll" = "yes"; then
  3964. AC_MSG_CHECKING([if poll is prototyped])
  3965. AC_EGREP_CPP([poll],[
  3966. $curl_includes_poll
  3967. ],[
  3968. AC_MSG_RESULT([yes])
  3969. tst_proto_poll="yes"
  3970. ],[
  3971. AC_MSG_RESULT([no])
  3972. tst_proto_poll="no"
  3973. ])
  3974. fi
  3975. #
  3976. if test "$tst_proto_poll" = "yes"; then
  3977. AC_MSG_CHECKING([if poll is compilable])
  3978. AC_COMPILE_IFELSE([
  3979. AC_LANG_PROGRAM([[
  3980. $curl_includes_poll
  3981. ]],[[
  3982. if(0 != poll(0, 0, 0))
  3983. return 1;
  3984. ]])
  3985. ],[
  3986. AC_MSG_RESULT([yes])
  3987. tst_compi_poll="yes"
  3988. ],[
  3989. AC_MSG_RESULT([no])
  3990. tst_compi_poll="no"
  3991. ])
  3992. fi
  3993. #
  3994. dnl only do runtime verification when not cross-compiling
  3995. if test "x$cross_compiling" != "xyes" &&
  3996. test "$tst_compi_poll" = "yes"; then
  3997. AC_MSG_CHECKING([if poll seems to work])
  3998. CURL_RUN_IFELSE([
  3999. AC_LANG_PROGRAM([[
  4000. $curl_includes_stdlib
  4001. $curl_includes_poll
  4002. $curl_includes_time
  4003. ]],[[
  4004. /* detect the original poll() breakage */
  4005. if(0 != poll(0, 0, 10))
  4006. exit(1); /* fail */
  4007. else {
  4008. /* detect the 10.12 poll() breakage */
  4009. struct timeval before, after;
  4010. int rc;
  4011. size_t us;
  4012. gettimeofday(&before, NULL);
  4013. rc = poll(NULL, 0, 500);
  4014. gettimeofday(&after, NULL);
  4015. us = (after.tv_sec - before.tv_sec) * 1000000 +
  4016. (after.tv_usec - before.tv_usec);
  4017. if(us < 400000)
  4018. exit(1);
  4019. }
  4020. ]])
  4021. ],[
  4022. AC_MSG_RESULT([yes])
  4023. tst_works_poll="yes"
  4024. ],[
  4025. AC_MSG_RESULT([no])
  4026. tst_works_poll="no"
  4027. ])
  4028. fi
  4029. #
  4030. if test "$tst_compi_poll" = "yes" &&
  4031. test "$tst_works_poll" != "no"; then
  4032. AC_MSG_CHECKING([if poll usage allowed])
  4033. if test "x$curl_disallow_poll" != "xyes"; then
  4034. AC_MSG_RESULT([yes])
  4035. tst_allow_poll="yes"
  4036. else
  4037. AC_MSG_RESULT([no])
  4038. tst_allow_poll="no"
  4039. fi
  4040. fi
  4041. #
  4042. AC_MSG_CHECKING([if poll might be used])
  4043. if test "$tst_links_poll" = "yes" &&
  4044. test "$tst_proto_poll" = "yes" &&
  4045. test "$tst_compi_poll" = "yes" &&
  4046. test "$tst_allow_poll" = "yes" &&
  4047. test "$tst_works_poll" != "no"; then
  4048. AC_MSG_RESULT([yes])
  4049. AC_DEFINE_UNQUOTED(HAVE_POLL_FINE, 1,
  4050. [If you have a fine poll])
  4051. curl_cv_func_poll="yes"
  4052. else
  4053. AC_MSG_RESULT([no])
  4054. curl_cv_func_poll="no"
  4055. fi
  4056. ])
  4057. dnl CURL_CHECK_FUNC_REMOVEXATTR
  4058. dnl -------------------------------------------------
  4059. dnl Verify if removexattr is available, prototyped, and
  4060. dnl can be compiled. If all of these are true, and
  4061. dnl usage has not been previously disallowed with
  4062. dnl shell variable curl_disallow_removexattr, then
  4063. dnl HAVE_REMOVEXATTR will be defined.
  4064. AC_DEFUN([CURL_CHECK_FUNC_REMOVEXATTR], [
  4065. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  4066. #
  4067. tst_links_removexattr="unknown"
  4068. tst_proto_removexattr="unknown"
  4069. tst_compi_removexattr="unknown"
  4070. tst_allow_removexattr="unknown"
  4071. tst_nargs_removexattr="unknown"
  4072. #
  4073. AC_MSG_CHECKING([if removexattr can be linked])
  4074. AC_LINK_IFELSE([
  4075. AC_LANG_FUNC_LINK_TRY([removexattr])
  4076. ],[
  4077. AC_MSG_RESULT([yes])
  4078. tst_links_removexattr="yes"
  4079. ],[
  4080. AC_MSG_RESULT([no])
  4081. tst_links_removexattr="no"
  4082. ])
  4083. #
  4084. if test "$tst_links_removexattr" = "yes"; then
  4085. AC_MSG_CHECKING([if removexattr is prototyped])
  4086. AC_EGREP_CPP([removexattr],[
  4087. $curl_includes_sys_xattr
  4088. ],[
  4089. AC_MSG_RESULT([yes])
  4090. tst_proto_removexattr="yes"
  4091. ],[
  4092. AC_MSG_RESULT([no])
  4093. tst_proto_removexattr="no"
  4094. ])
  4095. fi
  4096. #
  4097. if test "$tst_proto_removexattr" = "yes"; then
  4098. if test "$tst_nargs_removexattr" = "unknown"; then
  4099. AC_MSG_CHECKING([if removexattr takes 2 args.])
  4100. AC_COMPILE_IFELSE([
  4101. AC_LANG_PROGRAM([[
  4102. $curl_includes_sys_xattr
  4103. ]],[[
  4104. if(0 != removexattr(0, 0))
  4105. return 1;
  4106. ]])
  4107. ],[
  4108. AC_MSG_RESULT([yes])
  4109. tst_compi_removexattr="yes"
  4110. tst_nargs_removexattr="2"
  4111. ],[
  4112. AC_MSG_RESULT([no])
  4113. tst_compi_removexattr="no"
  4114. ])
  4115. fi
  4116. if test "$tst_nargs_removexattr" = "unknown"; then
  4117. AC_MSG_CHECKING([if removexattr takes 3 args.])
  4118. AC_COMPILE_IFELSE([
  4119. AC_LANG_PROGRAM([[
  4120. $curl_includes_sys_xattr
  4121. ]],[[
  4122. if(0 != removexattr(0, 0, 0))
  4123. return 1;
  4124. ]])
  4125. ],[
  4126. AC_MSG_RESULT([yes])
  4127. tst_compi_removexattr="yes"
  4128. tst_nargs_removexattr="3"
  4129. ],[
  4130. AC_MSG_RESULT([no])
  4131. tst_compi_removexattr="no"
  4132. ])
  4133. fi
  4134. AC_MSG_CHECKING([if removexattr is compilable])
  4135. if test "$tst_compi_removexattr" = "yes"; then
  4136. AC_MSG_RESULT([yes])
  4137. else
  4138. AC_MSG_RESULT([no])
  4139. fi
  4140. fi
  4141. #
  4142. if test "$tst_compi_removexattr" = "yes"; then
  4143. AC_MSG_CHECKING([if removexattr usage allowed])
  4144. if test "x$curl_disallow_removexattr" != "xyes"; then
  4145. AC_MSG_RESULT([yes])
  4146. tst_allow_removexattr="yes"
  4147. else
  4148. AC_MSG_RESULT([no])
  4149. tst_allow_removexattr="no"
  4150. fi
  4151. fi
  4152. #
  4153. AC_MSG_CHECKING([if removexattr might be used])
  4154. if test "$tst_links_removexattr" = "yes" &&
  4155. test "$tst_proto_removexattr" = "yes" &&
  4156. test "$tst_compi_removexattr" = "yes" &&
  4157. test "$tst_allow_removexattr" = "yes"; then
  4158. AC_MSG_RESULT([yes])
  4159. AC_DEFINE_UNQUOTED(HAVE_REMOVEXATTR, 1,
  4160. [Define to 1 if you have the removexattr function.])
  4161. dnl AC_DEFINE_UNQUOTED(REMOVEXATTR_ARGS, $tst_nargs_removexattr,
  4162. dnl [Specifies the number of arguments to removexattr])
  4163. #
  4164. if test "$tst_nargs_removexattr" -eq "2"; then
  4165. AC_DEFINE(HAVE_REMOVEXATTR_2, 1, [removexattr() takes 2 args])
  4166. elif test "$tst_nargs_removexattr" -eq "3"; then
  4167. AC_DEFINE(HAVE_REMOVEXATTR_3, 1, [removexattr() takes 3 args])
  4168. fi
  4169. #
  4170. curl_cv_func_removexattr="yes"
  4171. else
  4172. AC_MSG_RESULT([no])
  4173. curl_cv_func_removexattr="no"
  4174. fi
  4175. ])
  4176. dnl CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK
  4177. dnl -------------------------------------------------
  4178. dnl Verify if setsockopt with the SO_NONBLOCK command is
  4179. dnl available, can be compiled, and seems to work. If
  4180. dnl all of these are true, then HAVE_SETSOCKOPT_SO_NONBLOCK
  4181. dnl will be defined.
  4182. AC_DEFUN([CURL_CHECK_FUNC_SETSOCKOPT_SO_NONBLOCK], [
  4183. #
  4184. tst_compi_setsockopt_so_nonblock="unknown"
  4185. tst_allow_setsockopt_so_nonblock="unknown"
  4186. #
  4187. if test "$curl_cv_func_setsockopt" = "yes"; then
  4188. AC_MSG_CHECKING([if setsockopt SO_NONBLOCK is compilable])
  4189. AC_COMPILE_IFELSE([
  4190. AC_LANG_PROGRAM([[
  4191. $curl_includes_winsock2
  4192. $curl_includes_bsdsocket
  4193. $curl_includes_sys_socket
  4194. ]],[[
  4195. if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0))
  4196. return 1;
  4197. ]])
  4198. ],[
  4199. AC_MSG_RESULT([yes])
  4200. tst_compi_setsockopt_so_nonblock="yes"
  4201. ],[
  4202. AC_MSG_RESULT([no])
  4203. tst_compi_setsockopt_so_nonblock="no"
  4204. ])
  4205. fi
  4206. #
  4207. if test "$tst_compi_setsockopt_so_nonblock" = "yes"; then
  4208. AC_MSG_CHECKING([if setsockopt SO_NONBLOCK usage allowed])
  4209. if test "x$curl_disallow_setsockopt_so_nonblock" != "xyes"; then
  4210. AC_MSG_RESULT([yes])
  4211. tst_allow_setsockopt_so_nonblock="yes"
  4212. else
  4213. AC_MSG_RESULT([no])
  4214. tst_allow_setsockopt_so_nonblock="no"
  4215. fi
  4216. fi
  4217. #
  4218. AC_MSG_CHECKING([if setsockopt SO_NONBLOCK might be used])
  4219. if test "$tst_compi_setsockopt_so_nonblock" = "yes" &&
  4220. test "$tst_allow_setsockopt_so_nonblock" = "yes"; then
  4221. AC_MSG_RESULT([yes])
  4222. AC_DEFINE_UNQUOTED(HAVE_SETSOCKOPT_SO_NONBLOCK, 1,
  4223. [Define to 1 if you have a working setsockopt SO_NONBLOCK function.])
  4224. curl_cv_func_setsockopt_so_nonblock="yes"
  4225. else
  4226. AC_MSG_RESULT([no])
  4227. curl_cv_func_setsockopt_so_nonblock="no"
  4228. fi
  4229. ])
  4230. dnl CURL_CHECK_FUNC_SETXATTR
  4231. dnl -------------------------------------------------
  4232. dnl Verify if setxattr is available, prototyped, and
  4233. dnl can be compiled. If all of these are true, and
  4234. dnl usage has not been previously disallowed with
  4235. dnl shell variable curl_disallow_setxattr, then
  4236. dnl HAVE_SETXATTR will be defined.
  4237. AC_DEFUN([CURL_CHECK_FUNC_SETXATTR], [
  4238. AC_REQUIRE([CURL_INCLUDES_SYS_XATTR])dnl
  4239. #
  4240. tst_links_setxattr="unknown"
  4241. tst_proto_setxattr="unknown"
  4242. tst_compi_setxattr="unknown"
  4243. tst_allow_setxattr="unknown"
  4244. tst_nargs_setxattr="unknown"
  4245. #
  4246. AC_MSG_CHECKING([if setxattr can be linked])
  4247. AC_LINK_IFELSE([
  4248. AC_LANG_FUNC_LINK_TRY([setxattr])
  4249. ],[
  4250. AC_MSG_RESULT([yes])
  4251. tst_links_setxattr="yes"
  4252. ],[
  4253. AC_MSG_RESULT([no])
  4254. tst_links_setxattr="no"
  4255. ])
  4256. #
  4257. if test "$tst_links_setxattr" = "yes"; then
  4258. AC_MSG_CHECKING([if setxattr is prototyped])
  4259. AC_EGREP_CPP([setxattr],[
  4260. $curl_includes_sys_xattr
  4261. ],[
  4262. AC_MSG_RESULT([yes])
  4263. tst_proto_setxattr="yes"
  4264. ],[
  4265. AC_MSG_RESULT([no])
  4266. tst_proto_setxattr="no"
  4267. ])
  4268. fi
  4269. #
  4270. if test "$tst_proto_setxattr" = "yes"; then
  4271. if test "$tst_nargs_setxattr" = "unknown"; then
  4272. AC_MSG_CHECKING([if setxattr takes 5 args.])
  4273. AC_COMPILE_IFELSE([
  4274. AC_LANG_PROGRAM([[
  4275. $curl_includes_sys_xattr
  4276. ]],[[
  4277. if(0 != setxattr(0, 0, 0, 0, 0))
  4278. return 1;
  4279. ]])
  4280. ],[
  4281. AC_MSG_RESULT([yes])
  4282. tst_compi_setxattr="yes"
  4283. tst_nargs_setxattr="5"
  4284. ],[
  4285. AC_MSG_RESULT([no])
  4286. tst_compi_setxattr="no"
  4287. ])
  4288. fi
  4289. if test "$tst_nargs_setxattr" = "unknown"; then
  4290. AC_MSG_CHECKING([if setxattr takes 6 args.])
  4291. AC_COMPILE_IFELSE([
  4292. AC_LANG_PROGRAM([[
  4293. $curl_includes_sys_xattr
  4294. ]],[[
  4295. if(0 != setxattr(0, 0, 0, 0, 0, 0))
  4296. return 1;
  4297. ]])
  4298. ],[
  4299. AC_MSG_RESULT([yes])
  4300. tst_compi_setxattr="yes"
  4301. tst_nargs_setxattr="6"
  4302. ],[
  4303. AC_MSG_RESULT([no])
  4304. tst_compi_setxattr="no"
  4305. ])
  4306. fi
  4307. AC_MSG_CHECKING([if setxattr is compilable])
  4308. if test "$tst_compi_setxattr" = "yes"; then
  4309. AC_MSG_RESULT([yes])
  4310. else
  4311. AC_MSG_RESULT([no])
  4312. fi
  4313. fi
  4314. #
  4315. if test "$tst_compi_setxattr" = "yes"; then
  4316. AC_MSG_CHECKING([if setxattr usage allowed])
  4317. if test "x$curl_disallow_setxattr" != "xyes"; then
  4318. AC_MSG_RESULT([yes])
  4319. tst_allow_setxattr="yes"
  4320. else
  4321. AC_MSG_RESULT([no])
  4322. tst_allow_setxattr="no"
  4323. fi
  4324. fi
  4325. #
  4326. AC_MSG_CHECKING([if setxattr might be used])
  4327. if test "$tst_links_setxattr" = "yes" &&
  4328. test "$tst_proto_setxattr" = "yes" &&
  4329. test "$tst_compi_setxattr" = "yes" &&
  4330. test "$tst_allow_setxattr" = "yes"; then
  4331. AC_MSG_RESULT([yes])
  4332. AC_DEFINE_UNQUOTED(HAVE_SETXATTR, 1,
  4333. [Define to 1 if you have the setxattr function.])
  4334. dnl AC_DEFINE_UNQUOTED(SETXATTR_ARGS, $tst_nargs_setxattr,
  4335. dnl [Specifies the number of arguments to setxattr])
  4336. #
  4337. if test "$tst_nargs_setxattr" -eq "5"; then
  4338. AC_DEFINE(HAVE_SETXATTR_5, 1, [setxattr() takes 5 args])
  4339. elif test "$tst_nargs_setxattr" -eq "6"; then
  4340. AC_DEFINE(HAVE_SETXATTR_6, 1, [setxattr() takes 6 args])
  4341. fi
  4342. #
  4343. curl_cv_func_setxattr="yes"
  4344. else
  4345. AC_MSG_RESULT([no])
  4346. curl_cv_func_setxattr="no"
  4347. fi
  4348. ])
  4349. dnl CURL_CHECK_FUNC_SIGACTION
  4350. dnl -------------------------------------------------
  4351. dnl Verify if sigaction is available, prototyped, and
  4352. dnl can be compiled. If all of these are true, and
  4353. dnl usage has not been previously disallowed with
  4354. dnl shell variable curl_disallow_sigaction, then
  4355. dnl HAVE_SIGACTION will be defined.
  4356. AC_DEFUN([CURL_CHECK_FUNC_SIGACTION], [
  4357. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  4358. #
  4359. tst_links_sigaction="unknown"
  4360. tst_proto_sigaction="unknown"
  4361. tst_compi_sigaction="unknown"
  4362. tst_allow_sigaction="unknown"
  4363. #
  4364. AC_MSG_CHECKING([if sigaction can be linked])
  4365. AC_LINK_IFELSE([
  4366. AC_LANG_FUNC_LINK_TRY([sigaction])
  4367. ],[
  4368. AC_MSG_RESULT([yes])
  4369. tst_links_sigaction="yes"
  4370. ],[
  4371. AC_MSG_RESULT([no])
  4372. tst_links_sigaction="no"
  4373. ])
  4374. #
  4375. if test "$tst_links_sigaction" = "yes"; then
  4376. AC_MSG_CHECKING([if sigaction is prototyped])
  4377. AC_EGREP_CPP([sigaction],[
  4378. $curl_includes_signal
  4379. ],[
  4380. AC_MSG_RESULT([yes])
  4381. tst_proto_sigaction="yes"
  4382. ],[
  4383. AC_MSG_RESULT([no])
  4384. tst_proto_sigaction="no"
  4385. ])
  4386. fi
  4387. #
  4388. if test "$tst_proto_sigaction" = "yes"; then
  4389. AC_MSG_CHECKING([if sigaction is compilable])
  4390. AC_COMPILE_IFELSE([
  4391. AC_LANG_PROGRAM([[
  4392. $curl_includes_signal
  4393. ]],[[
  4394. if(0 != sigaction(0, 0, 0))
  4395. return 1;
  4396. ]])
  4397. ],[
  4398. AC_MSG_RESULT([yes])
  4399. tst_compi_sigaction="yes"
  4400. ],[
  4401. AC_MSG_RESULT([no])
  4402. tst_compi_sigaction="no"
  4403. ])
  4404. fi
  4405. #
  4406. if test "$tst_compi_sigaction" = "yes"; then
  4407. AC_MSG_CHECKING([if sigaction usage allowed])
  4408. if test "x$curl_disallow_sigaction" != "xyes"; then
  4409. AC_MSG_RESULT([yes])
  4410. tst_allow_sigaction="yes"
  4411. else
  4412. AC_MSG_RESULT([no])
  4413. tst_allow_sigaction="no"
  4414. fi
  4415. fi
  4416. #
  4417. AC_MSG_CHECKING([if sigaction might be used])
  4418. if test "$tst_links_sigaction" = "yes" &&
  4419. test "$tst_proto_sigaction" = "yes" &&
  4420. test "$tst_compi_sigaction" = "yes" &&
  4421. test "$tst_allow_sigaction" = "yes"; then
  4422. AC_MSG_RESULT([yes])
  4423. AC_DEFINE_UNQUOTED(HAVE_SIGACTION, 1,
  4424. [Define to 1 if you have the sigaction function.])
  4425. curl_cv_func_sigaction="yes"
  4426. else
  4427. AC_MSG_RESULT([no])
  4428. curl_cv_func_sigaction="no"
  4429. fi
  4430. ])
  4431. dnl CURL_CHECK_FUNC_SIGINTERRUPT
  4432. dnl -------------------------------------------------
  4433. dnl Verify if siginterrupt is available, prototyped, and
  4434. dnl can be compiled. If all of these are true, and
  4435. dnl usage has not been previously disallowed with
  4436. dnl shell variable curl_disallow_siginterrupt, then
  4437. dnl HAVE_SIGINTERRUPT will be defined.
  4438. AC_DEFUN([CURL_CHECK_FUNC_SIGINTERRUPT], [
  4439. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  4440. #
  4441. tst_links_siginterrupt="unknown"
  4442. tst_proto_siginterrupt="unknown"
  4443. tst_compi_siginterrupt="unknown"
  4444. tst_allow_siginterrupt="unknown"
  4445. #
  4446. AC_MSG_CHECKING([if siginterrupt can be linked])
  4447. AC_LINK_IFELSE([
  4448. AC_LANG_FUNC_LINK_TRY([siginterrupt])
  4449. ],[
  4450. AC_MSG_RESULT([yes])
  4451. tst_links_siginterrupt="yes"
  4452. ],[
  4453. AC_MSG_RESULT([no])
  4454. tst_links_siginterrupt="no"
  4455. ])
  4456. #
  4457. if test "$tst_links_siginterrupt" = "yes"; then
  4458. AC_MSG_CHECKING([if siginterrupt is prototyped])
  4459. AC_EGREP_CPP([siginterrupt],[
  4460. $curl_includes_signal
  4461. ],[
  4462. AC_MSG_RESULT([yes])
  4463. tst_proto_siginterrupt="yes"
  4464. ],[
  4465. AC_MSG_RESULT([no])
  4466. tst_proto_siginterrupt="no"
  4467. ])
  4468. fi
  4469. #
  4470. if test "$tst_proto_siginterrupt" = "yes"; then
  4471. AC_MSG_CHECKING([if siginterrupt is compilable])
  4472. AC_COMPILE_IFELSE([
  4473. AC_LANG_PROGRAM([[
  4474. $curl_includes_signal
  4475. ]],[[
  4476. if(0 != siginterrupt(0, 0))
  4477. return 1;
  4478. ]])
  4479. ],[
  4480. AC_MSG_RESULT([yes])
  4481. tst_compi_siginterrupt="yes"
  4482. ],[
  4483. AC_MSG_RESULT([no])
  4484. tst_compi_siginterrupt="no"
  4485. ])
  4486. fi
  4487. #
  4488. if test "$tst_compi_siginterrupt" = "yes"; then
  4489. AC_MSG_CHECKING([if siginterrupt usage allowed])
  4490. if test "x$curl_disallow_siginterrupt" != "xyes"; then
  4491. AC_MSG_RESULT([yes])
  4492. tst_allow_siginterrupt="yes"
  4493. else
  4494. AC_MSG_RESULT([no])
  4495. tst_allow_siginterrupt="no"
  4496. fi
  4497. fi
  4498. #
  4499. AC_MSG_CHECKING([if siginterrupt might be used])
  4500. if test "$tst_links_siginterrupt" = "yes" &&
  4501. test "$tst_proto_siginterrupt" = "yes" &&
  4502. test "$tst_compi_siginterrupt" = "yes" &&
  4503. test "$tst_allow_siginterrupt" = "yes"; then
  4504. AC_MSG_RESULT([yes])
  4505. AC_DEFINE_UNQUOTED(HAVE_SIGINTERRUPT, 1,
  4506. [Define to 1 if you have the siginterrupt function.])
  4507. curl_cv_func_siginterrupt="yes"
  4508. else
  4509. AC_MSG_RESULT([no])
  4510. curl_cv_func_siginterrupt="no"
  4511. fi
  4512. ])
  4513. dnl CURL_CHECK_FUNC_SIGNAL
  4514. dnl -------------------------------------------------
  4515. dnl Verify if signal is available, prototyped, and
  4516. dnl can be compiled. If all of these are true, and
  4517. dnl usage has not been previously disallowed with
  4518. dnl shell variable curl_disallow_signal, then
  4519. dnl HAVE_SIGNAL will be defined.
  4520. AC_DEFUN([CURL_CHECK_FUNC_SIGNAL], [
  4521. AC_REQUIRE([CURL_INCLUDES_SIGNAL])dnl
  4522. #
  4523. tst_links_signal="unknown"
  4524. tst_proto_signal="unknown"
  4525. tst_compi_signal="unknown"
  4526. tst_allow_signal="unknown"
  4527. #
  4528. AC_MSG_CHECKING([if signal can be linked])
  4529. AC_LINK_IFELSE([
  4530. AC_LANG_FUNC_LINK_TRY([signal])
  4531. ],[
  4532. AC_MSG_RESULT([yes])
  4533. tst_links_signal="yes"
  4534. ],[
  4535. AC_MSG_RESULT([no])
  4536. tst_links_signal="no"
  4537. ])
  4538. #
  4539. if test "$tst_links_signal" = "yes"; then
  4540. AC_MSG_CHECKING([if signal is prototyped])
  4541. AC_EGREP_CPP([signal],[
  4542. $curl_includes_signal
  4543. ],[
  4544. AC_MSG_RESULT([yes])
  4545. tst_proto_signal="yes"
  4546. ],[
  4547. AC_MSG_RESULT([no])
  4548. tst_proto_signal="no"
  4549. ])
  4550. fi
  4551. #
  4552. if test "$tst_proto_signal" = "yes"; then
  4553. AC_MSG_CHECKING([if signal is compilable])
  4554. AC_COMPILE_IFELSE([
  4555. AC_LANG_PROGRAM([[
  4556. $curl_includes_signal
  4557. ]],[[
  4558. if(0 != signal(0, 0))
  4559. return 1;
  4560. ]])
  4561. ],[
  4562. AC_MSG_RESULT([yes])
  4563. tst_compi_signal="yes"
  4564. ],[
  4565. AC_MSG_RESULT([no])
  4566. tst_compi_signal="no"
  4567. ])
  4568. fi
  4569. #
  4570. if test "$tst_compi_signal" = "yes"; then
  4571. AC_MSG_CHECKING([if signal usage allowed])
  4572. if test "x$curl_disallow_signal" != "xyes"; then
  4573. AC_MSG_RESULT([yes])
  4574. tst_allow_signal="yes"
  4575. else
  4576. AC_MSG_RESULT([no])
  4577. tst_allow_signal="no"
  4578. fi
  4579. fi
  4580. #
  4581. AC_MSG_CHECKING([if signal might be used])
  4582. if test "$tst_links_signal" = "yes" &&
  4583. test "$tst_proto_signal" = "yes" &&
  4584. test "$tst_compi_signal" = "yes" &&
  4585. test "$tst_allow_signal" = "yes"; then
  4586. AC_MSG_RESULT([yes])
  4587. AC_DEFINE_UNQUOTED(HAVE_SIGNAL, 1,
  4588. [Define to 1 if you have the signal function.])
  4589. curl_cv_func_signal="yes"
  4590. else
  4591. AC_MSG_RESULT([no])
  4592. curl_cv_func_signal="no"
  4593. fi
  4594. ])
  4595. dnl CURL_CHECK_FUNC_SIGSETJMP
  4596. dnl -------------------------------------------------
  4597. dnl Verify if sigsetjmp is available, prototyped, and
  4598. dnl can be compiled. If all of these are true, and
  4599. dnl usage has not been previously disallowed with
  4600. dnl shell variable curl_disallow_sigsetjmp, then
  4601. dnl HAVE_SIGSETJMP will be defined.
  4602. AC_DEFUN([CURL_CHECK_FUNC_SIGSETJMP], [
  4603. AC_REQUIRE([CURL_INCLUDES_SETJMP])dnl
  4604. #
  4605. tst_links_sigsetjmp="unknown"
  4606. tst_macro_sigsetjmp="unknown"
  4607. tst_proto_sigsetjmp="unknown"
  4608. tst_compi_sigsetjmp="unknown"
  4609. tst_allow_sigsetjmp="unknown"
  4610. #
  4611. AC_MSG_CHECKING([if sigsetjmp can be linked])
  4612. AC_LINK_IFELSE([
  4613. AC_LANG_FUNC_LINK_TRY([sigsetjmp])
  4614. ],[
  4615. AC_MSG_RESULT([yes])
  4616. tst_links_sigsetjmp="yes"
  4617. ],[
  4618. AC_MSG_RESULT([no])
  4619. tst_links_sigsetjmp="no"
  4620. ])
  4621. #
  4622. if test "$tst_links_sigsetjmp" = "no"; then
  4623. AC_MSG_CHECKING([if sigsetjmp seems a macro])
  4624. AC_LINK_IFELSE([
  4625. AC_LANG_PROGRAM([[
  4626. $curl_includes_setjmp
  4627. ]],[[
  4628. sigjmp_buf env;
  4629. if(0 != sigsetjmp(env, 0))
  4630. return 1;
  4631. ]])
  4632. ],[
  4633. AC_MSG_RESULT([yes])
  4634. tst_macro_sigsetjmp="yes"
  4635. ],[
  4636. AC_MSG_RESULT([no])
  4637. tst_macro_sigsetjmp="no"
  4638. ])
  4639. fi
  4640. #
  4641. if test "$tst_links_sigsetjmp" = "yes"; then
  4642. AC_MSG_CHECKING([if sigsetjmp is prototyped])
  4643. AC_EGREP_CPP([sigsetjmp],[
  4644. $curl_includes_setjmp
  4645. ],[
  4646. AC_MSG_RESULT([yes])
  4647. tst_proto_sigsetjmp="yes"
  4648. ],[
  4649. AC_MSG_RESULT([no])
  4650. tst_proto_sigsetjmp="no"
  4651. ])
  4652. fi
  4653. #
  4654. if test "$tst_proto_sigsetjmp" = "yes" ||
  4655. test "$tst_macro_sigsetjmp" = "yes"; then
  4656. AC_MSG_CHECKING([if sigsetjmp is compilable])
  4657. AC_COMPILE_IFELSE([
  4658. AC_LANG_PROGRAM([[
  4659. $curl_includes_setjmp
  4660. ]],[[
  4661. sigjmp_buf env;
  4662. if(0 != sigsetjmp(env, 0))
  4663. return 1;
  4664. ]])
  4665. ],[
  4666. AC_MSG_RESULT([yes])
  4667. tst_compi_sigsetjmp="yes"
  4668. ],[
  4669. AC_MSG_RESULT([no])
  4670. tst_compi_sigsetjmp="no"
  4671. ])
  4672. fi
  4673. #
  4674. if test "$tst_compi_sigsetjmp" = "yes"; then
  4675. AC_MSG_CHECKING([if sigsetjmp usage allowed])
  4676. if test "x$curl_disallow_sigsetjmp" != "xyes"; then
  4677. AC_MSG_RESULT([yes])
  4678. tst_allow_sigsetjmp="yes"
  4679. else
  4680. AC_MSG_RESULT([no])
  4681. tst_allow_sigsetjmp="no"
  4682. fi
  4683. fi
  4684. #
  4685. AC_MSG_CHECKING([if sigsetjmp might be used])
  4686. if (test "$tst_proto_sigsetjmp" = "yes" ||
  4687. test "$tst_macro_sigsetjmp" = "yes") &&
  4688. test "$tst_compi_sigsetjmp" = "yes" &&
  4689. test "$tst_allow_sigsetjmp" = "yes"; then
  4690. AC_MSG_RESULT([yes])
  4691. AC_DEFINE_UNQUOTED(HAVE_SIGSETJMP, 1,
  4692. [Define to 1 if you have the sigsetjmp function or macro.])
  4693. curl_cv_func_sigsetjmp="yes"
  4694. else
  4695. AC_MSG_RESULT([no])
  4696. curl_cv_func_sigsetjmp="no"
  4697. fi
  4698. ])
  4699. dnl CURL_CHECK_FUNC_SOCKET
  4700. dnl -------------------------------------------------
  4701. dnl Verify if socket is available, prototyped, and
  4702. dnl can be compiled. If all of these are true, and
  4703. dnl usage has not been previously disallowed with
  4704. dnl shell variable curl_disallow_socket, then
  4705. dnl HAVE_SOCKET will be defined.
  4706. AC_DEFUN([CURL_CHECK_FUNC_SOCKET], [
  4707. AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
  4708. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  4709. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  4710. #
  4711. tst_links_socket="unknown"
  4712. tst_proto_socket="unknown"
  4713. tst_compi_socket="unknown"
  4714. tst_allow_socket="unknown"
  4715. #
  4716. AC_MSG_CHECKING([if socket can be linked])
  4717. AC_LINK_IFELSE([
  4718. AC_LANG_PROGRAM([[
  4719. $curl_includes_winsock2
  4720. $curl_includes_bsdsocket
  4721. $curl_includes_sys_socket
  4722. $curl_includes_socket
  4723. ]],[[
  4724. if(0 != socket(0, 0, 0))
  4725. return 1;
  4726. ]])
  4727. ],[
  4728. AC_MSG_RESULT([yes])
  4729. tst_links_socket="yes"
  4730. ],[
  4731. AC_MSG_RESULT([no])
  4732. tst_links_socket="no"
  4733. ])
  4734. #
  4735. if test "$tst_links_socket" = "yes"; then
  4736. AC_MSG_CHECKING([if socket is prototyped])
  4737. AC_EGREP_CPP([socket],[
  4738. $curl_includes_winsock2
  4739. $curl_includes_bsdsocket
  4740. $curl_includes_sys_socket
  4741. $curl_includes_socket
  4742. ],[
  4743. AC_MSG_RESULT([yes])
  4744. tst_proto_socket="yes"
  4745. ],[
  4746. AC_MSG_RESULT([no])
  4747. tst_proto_socket="no"
  4748. ])
  4749. fi
  4750. #
  4751. if test "$tst_proto_socket" = "yes"; then
  4752. AC_MSG_CHECKING([if socket is compilable])
  4753. AC_COMPILE_IFELSE([
  4754. AC_LANG_PROGRAM([[
  4755. $curl_includes_winsock2
  4756. $curl_includes_bsdsocket
  4757. $curl_includes_sys_socket
  4758. $curl_includes_socket
  4759. ]],[[
  4760. if(0 != socket(0, 0, 0))
  4761. return 1;
  4762. ]])
  4763. ],[
  4764. AC_MSG_RESULT([yes])
  4765. tst_compi_socket="yes"
  4766. ],[
  4767. AC_MSG_RESULT([no])
  4768. tst_compi_socket="no"
  4769. ])
  4770. fi
  4771. #
  4772. if test "$tst_compi_socket" = "yes"; then
  4773. AC_MSG_CHECKING([if socket usage allowed])
  4774. if test "x$curl_disallow_socket" != "xyes"; then
  4775. AC_MSG_RESULT([yes])
  4776. tst_allow_socket="yes"
  4777. else
  4778. AC_MSG_RESULT([no])
  4779. tst_allow_socket="no"
  4780. fi
  4781. fi
  4782. #
  4783. AC_MSG_CHECKING([if socket might be used])
  4784. if test "$tst_links_socket" = "yes" &&
  4785. test "$tst_proto_socket" = "yes" &&
  4786. test "$tst_compi_socket" = "yes" &&
  4787. test "$tst_allow_socket" = "yes"; then
  4788. AC_MSG_RESULT([yes])
  4789. AC_DEFINE_UNQUOTED(HAVE_SOCKET, 1,
  4790. [Define to 1 if you have the socket function.])
  4791. curl_cv_func_socket="yes"
  4792. else
  4793. AC_MSG_RESULT([no])
  4794. curl_cv_func_socket="no"
  4795. fi
  4796. ])
  4797. dnl CURL_CHECK_FUNC_SOCKETPAIR
  4798. dnl -------------------------------------------------
  4799. dnl Verify if socketpair is available, prototyped, and
  4800. dnl can be compiled. If all of these are true, and
  4801. dnl usage has not been previously disallowed with
  4802. dnl shell variable curl_disallow_socketpair, then
  4803. dnl HAVE_SOCKETPAIR will be defined.
  4804. AC_DEFUN([CURL_CHECK_FUNC_SOCKETPAIR], [
  4805. AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl
  4806. AC_REQUIRE([CURL_INCLUDES_SOCKET])dnl
  4807. #
  4808. tst_links_socketpair="unknown"
  4809. tst_proto_socketpair="unknown"
  4810. tst_compi_socketpair="unknown"
  4811. tst_allow_socketpair="unknown"
  4812. #
  4813. AC_MSG_CHECKING([if socketpair can be linked])
  4814. AC_LINK_IFELSE([
  4815. AC_LANG_FUNC_LINK_TRY([socketpair])
  4816. ],[
  4817. AC_MSG_RESULT([yes])
  4818. tst_links_socketpair="yes"
  4819. ],[
  4820. AC_MSG_RESULT([no])
  4821. tst_links_socketpair="no"
  4822. ])
  4823. #
  4824. if test "$tst_links_socketpair" = "yes"; then
  4825. AC_MSG_CHECKING([if socketpair is prototyped])
  4826. AC_EGREP_CPP([socketpair],[
  4827. $curl_includes_sys_socket
  4828. $curl_includes_socket
  4829. ],[
  4830. AC_MSG_RESULT([yes])
  4831. tst_proto_socketpair="yes"
  4832. ],[
  4833. AC_MSG_RESULT([no])
  4834. tst_proto_socketpair="no"
  4835. ])
  4836. fi
  4837. #
  4838. if test "$tst_proto_socketpair" = "yes"; then
  4839. AC_MSG_CHECKING([if socketpair is compilable])
  4840. AC_COMPILE_IFELSE([
  4841. AC_LANG_PROGRAM([[
  4842. $curl_includes_sys_socket
  4843. $curl_includes_socket
  4844. ]],[[
  4845. int sv[2];
  4846. if(0 != socketpair(0, 0, 0, sv))
  4847. return 1;
  4848. ]])
  4849. ],[
  4850. AC_MSG_RESULT([yes])
  4851. tst_compi_socketpair="yes"
  4852. ],[
  4853. AC_MSG_RESULT([no])
  4854. tst_compi_socketpair="no"
  4855. ])
  4856. fi
  4857. #
  4858. if test "$tst_compi_socketpair" = "yes"; then
  4859. AC_MSG_CHECKING([if socketpair usage allowed])
  4860. if test "x$curl_disallow_socketpair" != "xyes"; then
  4861. AC_MSG_RESULT([yes])
  4862. tst_allow_socketpair="yes"
  4863. else
  4864. AC_MSG_RESULT([no])
  4865. tst_allow_socketpair="no"
  4866. fi
  4867. fi
  4868. #
  4869. AC_MSG_CHECKING([if socketpair might be used])
  4870. if test "$tst_links_socketpair" = "yes" &&
  4871. test "$tst_proto_socketpair" = "yes" &&
  4872. test "$tst_compi_socketpair" = "yes" &&
  4873. test "$tst_allow_socketpair" = "yes"; then
  4874. AC_MSG_RESULT([yes])
  4875. AC_DEFINE_UNQUOTED(HAVE_SOCKETPAIR, 1,
  4876. [Define to 1 if you have the socketpair function.])
  4877. curl_cv_func_socketpair="yes"
  4878. else
  4879. AC_MSG_RESULT([no])
  4880. curl_cv_func_socketpair="no"
  4881. fi
  4882. ])
  4883. dnl CURL_CHECK_FUNC_STRCASECMP
  4884. dnl -------------------------------------------------
  4885. dnl Verify if strcasecmp is available, prototyped, and
  4886. dnl can be compiled. If all of these are true, and
  4887. dnl usage has not been previously disallowed with
  4888. dnl shell variable curl_disallow_strcasecmp, then
  4889. dnl HAVE_STRCASECMP will be defined.
  4890. AC_DEFUN([CURL_CHECK_FUNC_STRCASECMP], [
  4891. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4892. #
  4893. tst_links_strcasecmp="unknown"
  4894. tst_proto_strcasecmp="unknown"
  4895. tst_compi_strcasecmp="unknown"
  4896. tst_allow_strcasecmp="unknown"
  4897. #
  4898. AC_MSG_CHECKING([if strcasecmp can be linked])
  4899. AC_LINK_IFELSE([
  4900. AC_LANG_FUNC_LINK_TRY([strcasecmp])
  4901. ],[
  4902. AC_MSG_RESULT([yes])
  4903. tst_links_strcasecmp="yes"
  4904. ],[
  4905. AC_MSG_RESULT([no])
  4906. tst_links_strcasecmp="no"
  4907. ])
  4908. #
  4909. if test "$tst_links_strcasecmp" = "yes"; then
  4910. AC_MSG_CHECKING([if strcasecmp is prototyped])
  4911. AC_EGREP_CPP([strcasecmp],[
  4912. $curl_includes_string
  4913. ],[
  4914. AC_MSG_RESULT([yes])
  4915. tst_proto_strcasecmp="yes"
  4916. ],[
  4917. AC_MSG_RESULT([no])
  4918. tst_proto_strcasecmp="no"
  4919. ])
  4920. fi
  4921. #
  4922. if test "$tst_proto_strcasecmp" = "yes"; then
  4923. AC_MSG_CHECKING([if strcasecmp is compilable])
  4924. AC_COMPILE_IFELSE([
  4925. AC_LANG_PROGRAM([[
  4926. $curl_includes_string
  4927. ]],[[
  4928. if(0 != strcasecmp(0, 0))
  4929. return 1;
  4930. ]])
  4931. ],[
  4932. AC_MSG_RESULT([yes])
  4933. tst_compi_strcasecmp="yes"
  4934. ],[
  4935. AC_MSG_RESULT([no])
  4936. tst_compi_strcasecmp="no"
  4937. ])
  4938. fi
  4939. #
  4940. if test "$tst_compi_strcasecmp" = "yes"; then
  4941. AC_MSG_CHECKING([if strcasecmp usage allowed])
  4942. if test "x$curl_disallow_strcasecmp" != "xyes"; then
  4943. AC_MSG_RESULT([yes])
  4944. tst_allow_strcasecmp="yes"
  4945. else
  4946. AC_MSG_RESULT([no])
  4947. tst_allow_strcasecmp="no"
  4948. fi
  4949. fi
  4950. #
  4951. AC_MSG_CHECKING([if strcasecmp might be used])
  4952. if test "$tst_links_strcasecmp" = "yes" &&
  4953. test "$tst_proto_strcasecmp" = "yes" &&
  4954. test "$tst_compi_strcasecmp" = "yes" &&
  4955. test "$tst_allow_strcasecmp" = "yes"; then
  4956. AC_MSG_RESULT([yes])
  4957. AC_DEFINE_UNQUOTED(HAVE_STRCASECMP, 1,
  4958. [Define to 1 if you have the strcasecmp function.])
  4959. curl_cv_func_strcasecmp="yes"
  4960. else
  4961. AC_MSG_RESULT([no])
  4962. curl_cv_func_strcasecmp="no"
  4963. fi
  4964. ])
  4965. dnl CURL_CHECK_FUNC_STRCMPI
  4966. dnl -------------------------------------------------
  4967. dnl Verify if strcmpi is available, prototyped, and
  4968. dnl can be compiled. If all of these are true, and
  4969. dnl usage has not been previously disallowed with
  4970. dnl shell variable curl_disallow_strcmpi, then
  4971. dnl HAVE_STRCMPI will be defined.
  4972. AC_DEFUN([CURL_CHECK_FUNC_STRCMPI], [
  4973. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  4974. #
  4975. tst_links_strcmpi="unknown"
  4976. tst_proto_strcmpi="unknown"
  4977. tst_compi_strcmpi="unknown"
  4978. tst_allow_strcmpi="unknown"
  4979. #
  4980. AC_MSG_CHECKING([if strcmpi can be linked])
  4981. AC_LINK_IFELSE([
  4982. AC_LANG_FUNC_LINK_TRY([strcmpi])
  4983. ],[
  4984. AC_MSG_RESULT([yes])
  4985. tst_links_strcmpi="yes"
  4986. ],[
  4987. AC_MSG_RESULT([no])
  4988. tst_links_strcmpi="no"
  4989. ])
  4990. #
  4991. if test "$tst_links_strcmpi" = "yes"; then
  4992. AC_MSG_CHECKING([if strcmpi is prototyped])
  4993. AC_EGREP_CPP([strcmpi],[
  4994. $curl_includes_string
  4995. ],[
  4996. AC_MSG_RESULT([yes])
  4997. tst_proto_strcmpi="yes"
  4998. ],[
  4999. AC_MSG_RESULT([no])
  5000. tst_proto_strcmpi="no"
  5001. ])
  5002. fi
  5003. #
  5004. if test "$tst_proto_strcmpi" = "yes"; then
  5005. AC_MSG_CHECKING([if strcmpi is compilable])
  5006. AC_COMPILE_IFELSE([
  5007. AC_LANG_PROGRAM([[
  5008. $curl_includes_string
  5009. ]],[[
  5010. if(0 != strcmpi(0, 0))
  5011. return 1;
  5012. ]])
  5013. ],[
  5014. AC_MSG_RESULT([yes])
  5015. tst_compi_strcmpi="yes"
  5016. ],[
  5017. AC_MSG_RESULT([no])
  5018. tst_compi_strcmpi="no"
  5019. ])
  5020. fi
  5021. #
  5022. if test "$tst_compi_strcmpi" = "yes"; then
  5023. AC_MSG_CHECKING([if strcmpi usage allowed])
  5024. if test "x$curl_disallow_strcmpi" != "xyes"; then
  5025. AC_MSG_RESULT([yes])
  5026. tst_allow_strcmpi="yes"
  5027. else
  5028. AC_MSG_RESULT([no])
  5029. tst_allow_strcmpi="no"
  5030. fi
  5031. fi
  5032. #
  5033. AC_MSG_CHECKING([if strcmpi might be used])
  5034. if test "$tst_links_strcmpi" = "yes" &&
  5035. test "$tst_proto_strcmpi" = "yes" &&
  5036. test "$tst_compi_strcmpi" = "yes" &&
  5037. test "$tst_allow_strcmpi" = "yes"; then
  5038. AC_MSG_RESULT([yes])
  5039. AC_DEFINE_UNQUOTED(HAVE_STRCMPI, 1,
  5040. [Define to 1 if you have the strcmpi function.])
  5041. curl_cv_func_strcmpi="yes"
  5042. else
  5043. AC_MSG_RESULT([no])
  5044. curl_cv_func_strcmpi="no"
  5045. fi
  5046. ])
  5047. dnl CURL_CHECK_FUNC_STRDUP
  5048. dnl -------------------------------------------------
  5049. dnl Verify if strdup is available, prototyped, and
  5050. dnl can be compiled. If all of these are true, and
  5051. dnl usage has not been previously disallowed with
  5052. dnl shell variable curl_disallow_strdup, then
  5053. dnl HAVE_STRDUP will be defined.
  5054. AC_DEFUN([CURL_CHECK_FUNC_STRDUP], [
  5055. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  5056. #
  5057. tst_links_strdup="unknown"
  5058. tst_proto_strdup="unknown"
  5059. tst_compi_strdup="unknown"
  5060. tst_allow_strdup="unknown"
  5061. #
  5062. AC_MSG_CHECKING([if strdup can be linked])
  5063. AC_LINK_IFELSE([
  5064. AC_LANG_FUNC_LINK_TRY([strdup])
  5065. ],[
  5066. AC_MSG_RESULT([yes])
  5067. tst_links_strdup="yes"
  5068. ],[
  5069. AC_MSG_RESULT([no])
  5070. tst_links_strdup="no"
  5071. ])
  5072. #
  5073. if test "$tst_links_strdup" = "yes"; then
  5074. AC_MSG_CHECKING([if strdup is prototyped])
  5075. AC_EGREP_CPP([strdup],[
  5076. $curl_includes_string
  5077. ],[
  5078. AC_MSG_RESULT([yes])
  5079. tst_proto_strdup="yes"
  5080. ],[
  5081. AC_MSG_RESULT([no])
  5082. tst_proto_strdup="no"
  5083. ])
  5084. fi
  5085. #
  5086. if test "$tst_proto_strdup" = "yes"; then
  5087. AC_MSG_CHECKING([if strdup is compilable])
  5088. AC_COMPILE_IFELSE([
  5089. AC_LANG_PROGRAM([[
  5090. $curl_includes_string
  5091. ]],[[
  5092. if(0 != strdup(0))
  5093. return 1;
  5094. ]])
  5095. ],[
  5096. AC_MSG_RESULT([yes])
  5097. tst_compi_strdup="yes"
  5098. ],[
  5099. AC_MSG_RESULT([no])
  5100. tst_compi_strdup="no"
  5101. ])
  5102. fi
  5103. #
  5104. if test "$tst_compi_strdup" = "yes"; then
  5105. AC_MSG_CHECKING([if strdup usage allowed])
  5106. if test "x$curl_disallow_strdup" != "xyes"; then
  5107. AC_MSG_RESULT([yes])
  5108. tst_allow_strdup="yes"
  5109. else
  5110. AC_MSG_RESULT([no])
  5111. tst_allow_strdup="no"
  5112. fi
  5113. fi
  5114. #
  5115. AC_MSG_CHECKING([if strdup might be used])
  5116. if test "$tst_links_strdup" = "yes" &&
  5117. test "$tst_proto_strdup" = "yes" &&
  5118. test "$tst_compi_strdup" = "yes" &&
  5119. test "$tst_allow_strdup" = "yes"; then
  5120. AC_MSG_RESULT([yes])
  5121. AC_DEFINE_UNQUOTED(HAVE_STRDUP, 1,
  5122. [Define to 1 if you have the strdup function.])
  5123. curl_cv_func_strdup="yes"
  5124. else
  5125. AC_MSG_RESULT([no])
  5126. curl_cv_func_strdup="no"
  5127. fi
  5128. ])
  5129. dnl CURL_CHECK_FUNC_STRERROR_R
  5130. dnl -------------------------------------------------
  5131. dnl Verify if strerror_r is available, prototyped, can be compiled and
  5132. dnl seems to work. If all of these are true, and usage has not been
  5133. dnl previously disallowed with shell variable curl_disallow_strerror_r,
  5134. dnl then HAVE_STRERROR_R will be defined, as well as one of
  5135. dnl HAVE_GLIBC_STRERROR_R or HAVE_POSIX_STRERROR_R.
  5136. dnl
  5137. dnl glibc-style strerror_r:
  5138. dnl
  5139. dnl char *strerror_r(int errnum, char *workbuf, size_t bufsize);
  5140. dnl
  5141. dnl glibc-style strerror_r returns a pointer to the error string,
  5142. dnl and might use the provided workbuf as a scratch area if needed. A
  5143. dnl quick test on a few systems shows that it's usually not used at all.
  5144. dnl
  5145. dnl POSIX-style strerror_r:
  5146. dnl
  5147. dnl int strerror_r(int errnum, char *resultbuf, size_t bufsize);
  5148. dnl
  5149. dnl POSIX-style strerror_r returns 0 upon successful completion and the
  5150. dnl error string in the provided resultbuf.
  5151. dnl
  5152. AC_DEFUN([CURL_CHECK_FUNC_STRERROR_R], [
  5153. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  5154. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  5155. #
  5156. tst_links_strerror_r="unknown"
  5157. tst_proto_strerror_r="unknown"
  5158. tst_compi_strerror_r="unknown"
  5159. tst_glibc_strerror_r="unknown"
  5160. tst_posix_strerror_r="unknown"
  5161. tst_allow_strerror_r="unknown"
  5162. tst_works_glibc_strerror_r="unknown"
  5163. tst_works_posix_strerror_r="unknown"
  5164. tst_glibc_strerror_r_type_arg3="unknown"
  5165. tst_posix_strerror_r_type_arg3="unknown"
  5166. #
  5167. AC_MSG_CHECKING([if strerror_r can be linked])
  5168. AC_LINK_IFELSE([
  5169. AC_LANG_FUNC_LINK_TRY([strerror_r])
  5170. ],[
  5171. AC_MSG_RESULT([yes])
  5172. tst_links_strerror_r="yes"
  5173. ],[
  5174. AC_MSG_RESULT([no])
  5175. tst_links_strerror_r="no"
  5176. ])
  5177. #
  5178. if test "$tst_links_strerror_r" = "yes"; then
  5179. AC_MSG_CHECKING([if strerror_r is prototyped])
  5180. AC_EGREP_CPP([strerror_r],[
  5181. $curl_includes_string
  5182. ],[
  5183. AC_MSG_RESULT([yes])
  5184. tst_proto_strerror_r="yes"
  5185. ],[
  5186. AC_MSG_RESULT([no])
  5187. tst_proto_strerror_r="no"
  5188. ])
  5189. fi
  5190. #
  5191. if test "$tst_proto_strerror_r" = "yes"; then
  5192. AC_MSG_CHECKING([if strerror_r is compilable])
  5193. AC_COMPILE_IFELSE([
  5194. AC_LANG_PROGRAM([[
  5195. $curl_includes_string
  5196. ]],[[
  5197. if(0 != strerror_r(0, 0, 0))
  5198. return 1;
  5199. ]])
  5200. ],[
  5201. AC_MSG_RESULT([yes])
  5202. tst_compi_strerror_r="yes"
  5203. ],[
  5204. AC_MSG_RESULT([no])
  5205. tst_compi_strerror_r="no"
  5206. ])
  5207. fi
  5208. #
  5209. if test "$tst_compi_strerror_r" = "yes"; then
  5210. AC_MSG_CHECKING([if strerror_r is glibc like])
  5211. tst_glibc_strerror_r_type_arg3="unknown"
  5212. for arg3 in 'size_t' 'int' 'unsigned int'; do
  5213. if test "$tst_glibc_strerror_r_type_arg3" = "unknown"; then
  5214. AC_COMPILE_IFELSE([
  5215. AC_LANG_PROGRAM([[
  5216. $curl_includes_string
  5217. char *strerror_r(int errnum, char *workbuf, $arg3 bufsize);
  5218. ]],[[
  5219. if(0 != strerror_r(0, 0, 0))
  5220. return 1;
  5221. ]])
  5222. ],[
  5223. tst_glibc_strerror_r_type_arg3="$arg3"
  5224. ])
  5225. fi
  5226. done
  5227. case "$tst_glibc_strerror_r_type_arg3" in
  5228. unknown)
  5229. AC_MSG_RESULT([no])
  5230. tst_glibc_strerror_r="no"
  5231. ;;
  5232. *)
  5233. AC_MSG_RESULT([yes])
  5234. tst_glibc_strerror_r="yes"
  5235. ;;
  5236. esac
  5237. fi
  5238. #
  5239. dnl only do runtime verification when not cross-compiling
  5240. if test "x$cross_compiling" != "xyes" &&
  5241. test "$tst_glibc_strerror_r" = "yes"; then
  5242. AC_MSG_CHECKING([if strerror_r seems to work])
  5243. CURL_RUN_IFELSE([
  5244. AC_LANG_PROGRAM([[
  5245. $curl_includes_stdlib
  5246. $curl_includes_string
  5247. # include <errno.h>
  5248. ]],[[
  5249. char buffer[1024];
  5250. char *string = 0;
  5251. buffer[0] = '\0';
  5252. string = strerror_r(EACCES, buffer, sizeof(buffer));
  5253. if(!string)
  5254. exit(1); /* fail */
  5255. if(!string[0])
  5256. exit(1); /* fail */
  5257. else
  5258. exit(0);
  5259. ]])
  5260. ],[
  5261. AC_MSG_RESULT([yes])
  5262. tst_works_glibc_strerror_r="yes"
  5263. ],[
  5264. AC_MSG_RESULT([no])
  5265. tst_works_glibc_strerror_r="no"
  5266. ])
  5267. fi
  5268. #
  5269. if test "$tst_compi_strerror_r" = "yes" &&
  5270. test "$tst_works_glibc_strerror_r" != "yes"; then
  5271. AC_MSG_CHECKING([if strerror_r is POSIX like])
  5272. tst_posix_strerror_r_type_arg3="unknown"
  5273. for arg3 in 'size_t' 'int' 'unsigned int'; do
  5274. if test "$tst_posix_strerror_r_type_arg3" = "unknown"; then
  5275. AC_COMPILE_IFELSE([
  5276. AC_LANG_PROGRAM([[
  5277. $curl_includes_string
  5278. int strerror_r(int errnum, char *resultbuf, $arg3 bufsize);
  5279. ]],[[
  5280. if(0 != strerror_r(0, 0, 0))
  5281. return 1;
  5282. ]])
  5283. ],[
  5284. tst_posix_strerror_r_type_arg3="$arg3"
  5285. ])
  5286. fi
  5287. done
  5288. case "$tst_posix_strerror_r_type_arg3" in
  5289. unknown)
  5290. AC_MSG_RESULT([no])
  5291. tst_posix_strerror_r="no"
  5292. ;;
  5293. *)
  5294. AC_MSG_RESULT([yes])
  5295. tst_posix_strerror_r="yes"
  5296. ;;
  5297. esac
  5298. fi
  5299. #
  5300. dnl only do runtime verification when not cross-compiling
  5301. if test "x$cross_compiling" != "xyes" &&
  5302. test "$tst_posix_strerror_r" = "yes"; then
  5303. AC_MSG_CHECKING([if strerror_r seems to work])
  5304. CURL_RUN_IFELSE([
  5305. AC_LANG_PROGRAM([[
  5306. $curl_includes_stdlib
  5307. $curl_includes_string
  5308. # include <errno.h>
  5309. ]],[[
  5310. char buffer[1024];
  5311. int error = 1;
  5312. buffer[0] = '\0';
  5313. error = strerror_r(EACCES, buffer, sizeof(buffer));
  5314. if(error)
  5315. exit(1); /* fail */
  5316. if(buffer[0] == '\0')
  5317. exit(1); /* fail */
  5318. else
  5319. exit(0);
  5320. ]])
  5321. ],[
  5322. AC_MSG_RESULT([yes])
  5323. tst_works_posix_strerror_r="yes"
  5324. ],[
  5325. AC_MSG_RESULT([no])
  5326. tst_works_posix_strerror_r="no"
  5327. ])
  5328. fi
  5329. #
  5330. if test "$tst_works_glibc_strerror_r" = "yes"; then
  5331. tst_posix_strerror_r="no"
  5332. fi
  5333. if test "$tst_works_posix_strerror_r" = "yes"; then
  5334. tst_glibc_strerror_r="no"
  5335. fi
  5336. if test "$tst_glibc_strerror_r" = "yes" &&
  5337. test "$tst_works_glibc_strerror_r" != "no" &&
  5338. test "$tst_posix_strerror_r" != "yes"; then
  5339. tst_allow_strerror_r="check"
  5340. fi
  5341. if test "$tst_posix_strerror_r" = "yes" &&
  5342. test "$tst_works_posix_strerror_r" != "no" &&
  5343. test "$tst_glibc_strerror_r" != "yes"; then
  5344. tst_allow_strerror_r="check"
  5345. fi
  5346. if test "$tst_allow_strerror_r" = "check"; then
  5347. AC_MSG_CHECKING([if strerror_r usage allowed])
  5348. if test "x$curl_disallow_strerror_r" != "xyes"; then
  5349. AC_MSG_RESULT([yes])
  5350. tst_allow_strerror_r="yes"
  5351. else
  5352. AC_MSG_RESULT([no])
  5353. tst_allow_strerror_r="no"
  5354. fi
  5355. fi
  5356. #
  5357. AC_MSG_CHECKING([if strerror_r might be used])
  5358. if test "$tst_links_strerror_r" = "yes" &&
  5359. test "$tst_proto_strerror_r" = "yes" &&
  5360. test "$tst_compi_strerror_r" = "yes" &&
  5361. test "$tst_allow_strerror_r" = "yes"; then
  5362. AC_MSG_RESULT([yes])
  5363. if test "$tst_glibc_strerror_r" = "yes"; then
  5364. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  5365. [Define to 1 if you have the strerror_r function.])
  5366. AC_DEFINE_UNQUOTED(HAVE_GLIBC_STRERROR_R, 1,
  5367. [Define to 1 if you have a working glibc-style strerror_r function.])
  5368. fi
  5369. if test "$tst_posix_strerror_r" = "yes"; then
  5370. AC_DEFINE_UNQUOTED(HAVE_STRERROR_R, 1,
  5371. [Define to 1 if you have the strerror_r function.])
  5372. AC_DEFINE_UNQUOTED(HAVE_POSIX_STRERROR_R, 1,
  5373. [Define to 1 if you have a working POSIX-style strerror_r function.])
  5374. fi
  5375. curl_cv_func_strerror_r="yes"
  5376. else
  5377. AC_MSG_RESULT([no])
  5378. curl_cv_func_strerror_r="no"
  5379. fi
  5380. #
  5381. if test "$tst_compi_strerror_r" = "yes" &&
  5382. test "$tst_allow_strerror_r" = "unknown"; then
  5383. AC_MSG_WARN([cannot determine strerror_r() style: edit lib/curl_config.h manually.])
  5384. fi
  5385. #
  5386. ])
  5387. dnl CURL_CHECK_FUNC_STRICMP
  5388. dnl -------------------------------------------------
  5389. dnl Verify if stricmp is available, prototyped, and
  5390. dnl can be compiled. If all of these are true, and
  5391. dnl usage has not been previously disallowed with
  5392. dnl shell variable curl_disallow_stricmp, then
  5393. dnl HAVE_STRICMP will be defined.
  5394. AC_DEFUN([CURL_CHECK_FUNC_STRICMP], [
  5395. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  5396. #
  5397. tst_links_stricmp="unknown"
  5398. tst_proto_stricmp="unknown"
  5399. tst_compi_stricmp="unknown"
  5400. tst_allow_stricmp="unknown"
  5401. #
  5402. AC_MSG_CHECKING([if stricmp can be linked])
  5403. AC_LINK_IFELSE([
  5404. AC_LANG_FUNC_LINK_TRY([stricmp])
  5405. ],[
  5406. AC_MSG_RESULT([yes])
  5407. tst_links_stricmp="yes"
  5408. ],[
  5409. AC_MSG_RESULT([no])
  5410. tst_links_stricmp="no"
  5411. ])
  5412. #
  5413. if test "$tst_links_stricmp" = "yes"; then
  5414. AC_MSG_CHECKING([if stricmp is prototyped])
  5415. AC_EGREP_CPP([stricmp],[
  5416. $curl_includes_string
  5417. ],[
  5418. AC_MSG_RESULT([yes])
  5419. tst_proto_stricmp="yes"
  5420. ],[
  5421. AC_MSG_RESULT([no])
  5422. tst_proto_stricmp="no"
  5423. ])
  5424. fi
  5425. #
  5426. if test "$tst_proto_stricmp" = "yes"; then
  5427. AC_MSG_CHECKING([if stricmp is compilable])
  5428. AC_COMPILE_IFELSE([
  5429. AC_LANG_PROGRAM([[
  5430. $curl_includes_string
  5431. ]],[[
  5432. if(0 != stricmp(0, 0))
  5433. return 1;
  5434. ]])
  5435. ],[
  5436. AC_MSG_RESULT([yes])
  5437. tst_compi_stricmp="yes"
  5438. ],[
  5439. AC_MSG_RESULT([no])
  5440. tst_compi_stricmp="no"
  5441. ])
  5442. fi
  5443. #
  5444. if test "$tst_compi_stricmp" = "yes"; then
  5445. AC_MSG_CHECKING([if stricmp usage allowed])
  5446. if test "x$curl_disallow_stricmp" != "xyes"; then
  5447. AC_MSG_RESULT([yes])
  5448. tst_allow_stricmp="yes"
  5449. else
  5450. AC_MSG_RESULT([no])
  5451. tst_allow_stricmp="no"
  5452. fi
  5453. fi
  5454. #
  5455. AC_MSG_CHECKING([if stricmp might be used])
  5456. if test "$tst_links_stricmp" = "yes" &&
  5457. test "$tst_proto_stricmp" = "yes" &&
  5458. test "$tst_compi_stricmp" = "yes" &&
  5459. test "$tst_allow_stricmp" = "yes"; then
  5460. AC_MSG_RESULT([yes])
  5461. AC_DEFINE_UNQUOTED(HAVE_STRICMP, 1,
  5462. [Define to 1 if you have the stricmp function.])
  5463. curl_cv_func_stricmp="yes"
  5464. else
  5465. AC_MSG_RESULT([no])
  5466. curl_cv_func_stricmp="no"
  5467. fi
  5468. ])
  5469. dnl CURL_CHECK_FUNC_STRTOK_R
  5470. dnl -------------------------------------------------
  5471. dnl Verify if strtok_r is available, prototyped, and
  5472. dnl can be compiled. If all of these are true, and
  5473. dnl usage has not been previously disallowed with
  5474. dnl shell variable curl_disallow_strtok_r, then
  5475. dnl HAVE_STRTOK_R will be defined.
  5476. AC_DEFUN([CURL_CHECK_FUNC_STRTOK_R], [
  5477. AC_REQUIRE([CURL_INCLUDES_STRING])dnl
  5478. #
  5479. tst_links_strtok_r="unknown"
  5480. tst_proto_strtok_r="unknown"
  5481. tst_compi_strtok_r="unknown"
  5482. tst_allow_strtok_r="unknown"
  5483. #
  5484. AC_MSG_CHECKING([if strtok_r can be linked])
  5485. AC_LINK_IFELSE([
  5486. AC_LANG_FUNC_LINK_TRY([strtok_r])
  5487. ],[
  5488. AC_MSG_RESULT([yes])
  5489. tst_links_strtok_r="yes"
  5490. ],[
  5491. AC_MSG_RESULT([no])
  5492. tst_links_strtok_r="no"
  5493. ])
  5494. #
  5495. if test "$tst_links_strtok_r" = "yes"; then
  5496. AC_MSG_CHECKING([if strtok_r is prototyped])
  5497. AC_EGREP_CPP([strtok_r],[
  5498. $curl_includes_string
  5499. ],[
  5500. AC_MSG_RESULT([yes])
  5501. tst_proto_strtok_r="yes"
  5502. ],[
  5503. AC_MSG_RESULT([no])
  5504. tst_proto_strtok_r="no"
  5505. ])
  5506. fi
  5507. #
  5508. if test "$tst_proto_strtok_r" = "yes"; then
  5509. AC_MSG_CHECKING([if strtok_r is compilable])
  5510. AC_COMPILE_IFELSE([
  5511. AC_LANG_PROGRAM([[
  5512. $curl_includes_string
  5513. ]],[[
  5514. if(0 != strtok_r(0, 0, 0))
  5515. return 1;
  5516. ]])
  5517. ],[
  5518. AC_MSG_RESULT([yes])
  5519. tst_compi_strtok_r="yes"
  5520. ],[
  5521. AC_MSG_RESULT([no])
  5522. tst_compi_strtok_r="no"
  5523. ])
  5524. fi
  5525. #
  5526. if test "$tst_compi_strtok_r" = "yes"; then
  5527. AC_MSG_CHECKING([if strtok_r usage allowed])
  5528. if test "x$curl_disallow_strtok_r" != "xyes"; then
  5529. AC_MSG_RESULT([yes])
  5530. tst_allow_strtok_r="yes"
  5531. else
  5532. AC_MSG_RESULT([no])
  5533. tst_allow_strtok_r="no"
  5534. fi
  5535. fi
  5536. #
  5537. AC_MSG_CHECKING([if strtok_r might be used])
  5538. if test "$tst_links_strtok_r" = "yes" &&
  5539. test "$tst_proto_strtok_r" = "yes" &&
  5540. test "$tst_compi_strtok_r" = "yes" &&
  5541. test "$tst_allow_strtok_r" = "yes"; then
  5542. AC_MSG_RESULT([yes])
  5543. AC_DEFINE_UNQUOTED(HAVE_STRTOK_R, 1,
  5544. [Define to 1 if you have the strtok_r function.])
  5545. curl_cv_func_strtok_r="yes"
  5546. else
  5547. AC_MSG_RESULT([no])
  5548. curl_cv_func_strtok_r="no"
  5549. fi
  5550. ])
  5551. dnl CURL_CHECK_FUNC_STRTOLL
  5552. dnl -------------------------------------------------
  5553. dnl Verify if strtoll is available, prototyped, and
  5554. dnl can be compiled. If all of these are true, and
  5555. dnl usage has not been previously disallowed with
  5556. dnl shell variable curl_disallow_strtoll, then
  5557. dnl HAVE_STRTOLL will be defined.
  5558. AC_DEFUN([CURL_CHECK_FUNC_STRTOLL], [
  5559. AC_REQUIRE([CURL_INCLUDES_STDLIB])dnl
  5560. #
  5561. tst_links_strtoll="unknown"
  5562. tst_proto_strtoll="unknown"
  5563. tst_compi_strtoll="unknown"
  5564. tst_allow_strtoll="unknown"
  5565. #
  5566. AC_MSG_CHECKING([if strtoll can be linked])
  5567. AC_LINK_IFELSE([
  5568. AC_LANG_FUNC_LINK_TRY([strtoll])
  5569. ],[
  5570. AC_MSG_RESULT([yes])
  5571. tst_links_strtoll="yes"
  5572. ],[
  5573. AC_MSG_RESULT([no])
  5574. tst_links_strtoll="no"
  5575. ])
  5576. #
  5577. if test "$tst_links_strtoll" = "yes"; then
  5578. AC_MSG_CHECKING([if strtoll is prototyped])
  5579. AC_EGREP_CPP([strtoll],[
  5580. $curl_includes_stdlib
  5581. ],[
  5582. AC_MSG_RESULT([yes])
  5583. tst_proto_strtoll="yes"
  5584. ],[
  5585. AC_MSG_RESULT([no])
  5586. tst_proto_strtoll="no"
  5587. ])
  5588. fi
  5589. #
  5590. if test "$tst_proto_strtoll" = "yes"; then
  5591. AC_MSG_CHECKING([if strtoll is compilable])
  5592. AC_COMPILE_IFELSE([
  5593. AC_LANG_PROGRAM([[
  5594. $curl_includes_stdlib
  5595. ]],[[
  5596. if(0 != strtoll(0, 0, 0))
  5597. return 1;
  5598. ]])
  5599. ],[
  5600. AC_MSG_RESULT([yes])
  5601. tst_compi_strtoll="yes"
  5602. ],[
  5603. AC_MSG_RESULT([no])
  5604. tst_compi_strtoll="no"
  5605. ])
  5606. fi
  5607. #
  5608. if test "$tst_compi_strtoll" = "yes"; then
  5609. AC_MSG_CHECKING([if strtoll usage allowed])
  5610. if test "x$curl_disallow_strtoll" != "xyes"; then
  5611. AC_MSG_RESULT([yes])
  5612. tst_allow_strtoll="yes"
  5613. else
  5614. AC_MSG_RESULT([no])
  5615. tst_allow_strtoll="no"
  5616. fi
  5617. fi
  5618. #
  5619. AC_MSG_CHECKING([if strtoll might be used])
  5620. if test "$tst_links_strtoll" = "yes" &&
  5621. test "$tst_proto_strtoll" = "yes" &&
  5622. test "$tst_compi_strtoll" = "yes" &&
  5623. test "$tst_allow_strtoll" = "yes"; then
  5624. AC_MSG_RESULT([yes])
  5625. AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
  5626. [Define to 1 if you have the strtoll function.])
  5627. curl_cv_func_strtoll="yes"
  5628. else
  5629. AC_MSG_RESULT([no])
  5630. curl_cv_func_strtoll="no"
  5631. fi
  5632. ])
  5633. dnl CURL_RUN_IFELSE
  5634. dnl -------------------------------------------------
  5635. dnl Wrapper macro to use instead of AC_RUN_IFELSE. It
  5636. dnl sets LD_LIBRARY_PATH locally for this run only, from the
  5637. dnl CURL_LIBRARY_PATH variable. It keeps the LD_LIBRARY_PATH
  5638. dnl changes contained within this macro.
  5639. AC_DEFUN([CURL_RUN_IFELSE], [
  5640. case $host_os in
  5641. darwin*)
  5642. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  5643. ;;
  5644. *)
  5645. old=$LD_LIBRARY_PATH
  5646. LD_LIBRARY_PATH=$CURL_LIBRARY_PATH:$old
  5647. export LD_LIBRARY_PATH
  5648. AC_RUN_IFELSE([AC_LANG_SOURCE([$1])], $2, $3, $4)
  5649. LD_LIBRARY_PATH=$old # restore
  5650. ;;
  5651. esac
  5652. ])
  5653. dnl CURL_COVERAGE
  5654. dnl --------------------------------------------------
  5655. dnl Switch on options and libs to build with gcc's code coverage.
  5656. dnl
  5657. AC_DEFUN([CURL_COVERAGE],[
  5658. AC_REQUIRE([AC_PROG_SED])
  5659. AC_REQUIRE([AC_ARG_ENABLE])
  5660. AC_MSG_CHECKING([for code coverage support])
  5661. coverage="no"
  5662. curl_coverage_msg="disabled"
  5663. dnl check if enabled by argument
  5664. AC_ARG_ENABLE(code-coverage,
  5665. AS_HELP_STRING([--enable-code-coverage], [Provide code coverage]),
  5666. coverage="$enableval")
  5667. dnl if not gcc switch off again
  5668. AS_IF([ test "$GCC" != "yes" ], coverage="no" )
  5669. AC_MSG_RESULT($coverage)
  5670. if test "x$coverage" = "xyes"; then
  5671. curl_coverage_msg="enabled"
  5672. AC_CHECK_TOOL([GCOV], [gcov], [gcov])
  5673. if test -z "$GCOV"; then
  5674. AC_MSG_ERROR([needs gcov for code coverage])
  5675. fi
  5676. AC_CHECK_PROG([LCOV], [lcov], [lcov])
  5677. if test -z "$LCOV"; then
  5678. AC_MSG_ERROR([needs lcov for code coverage])
  5679. fi
  5680. CPPFLAGS="$CPPFLAGS -DNDEBUG"
  5681. CFLAGS="$CFLAGS -O0 -g -fprofile-arcs -ftest-coverage"
  5682. LIBS="$LIBS -lgcov"
  5683. fi
  5684. ])
  5685. dnl CURL_ATOMIC
  5686. dnl -------------------------------------------------------------
  5687. dnl Check if _Atomic works. But only check if stdatomic.h exists.
  5688. dnl
  5689. AC_DEFUN([CURL_ATOMIC],[
  5690. AC_CHECK_HEADERS(stdatomic.h, [
  5691. AC_MSG_CHECKING([if _Atomic is available])
  5692. AC_LINK_IFELSE([
  5693. AC_LANG_PROGRAM([[
  5694. $curl_includes_unistd
  5695. ]],[[
  5696. _Atomic int i = 0;
  5697. i = 4; // Force an atomic-write operation.
  5698. ]])
  5699. ],[
  5700. AC_MSG_RESULT([yes])
  5701. AC_DEFINE_UNQUOTED(HAVE_ATOMIC, 1,
  5702. [Define to 1 if you have _Atomic support.])
  5703. tst_atomic="yes"
  5704. ],[
  5705. AC_MSG_RESULT([no])
  5706. tst_atomic="no"
  5707. ])
  5708. ])
  5709. ])
  5710. # Rewrite inspired by the functionality once provided by
  5711. # AX_COMPILE_CHECK_SIZEOF. Uses the switch() "trick" to find the size of the
  5712. # given type.
  5713. #
  5714. # This code fails to compile:
  5715. #
  5716. # switch() { case 0: case 0: }
  5717. #
  5718. # By making the second case number a boolean check, it fails to compile the
  5719. # test code when the boolean is false and thus creating a zero, making it a
  5720. # duplicated case label. If the boolean equals true, it becomes a one, the
  5721. # code compiles and we know it was a match.
  5722. #
  5723. # The check iterates over all possible sizes and stops as soon it compiles
  5724. # error-free.
  5725. #
  5726. # Usage:
  5727. #
  5728. # CURL_SIZEOF(TYPE, [HEADERS])
  5729. #
  5730. AC_DEFUN([CURL_SIZEOF], [
  5731. dnl The #define name to make autoheader put the name in curl_config.h.in
  5732. define(TYPE, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
  5733. AC_MSG_CHECKING(size of $1)
  5734. r=0
  5735. dnl Check the sizes in a reasonable order
  5736. for typesize in 8 4 2 16 1; do
  5737. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  5738. #include <sys/types.h>
  5739. $2
  5740. ]],
  5741. [switch(0) {
  5742. case 0:
  5743. case (sizeof($1) == $typesize):;
  5744. }
  5745. ]) ],
  5746. [
  5747. r=$typesize],
  5748. [
  5749. r=0])
  5750. dnl get out of the loop once matched
  5751. if test $r -gt 0; then
  5752. break;
  5753. fi
  5754. done
  5755. if test $r -eq 0; then
  5756. AC_MSG_ERROR([Failed to find size of $1])
  5757. fi
  5758. AC_MSG_RESULT($r)
  5759. dnl lowercase and underscore instead of space
  5760. tname=$(echo "ac_cv_sizeof_$1" | tr A-Z a-z | tr " " "_")
  5761. eval "$tname=$r"
  5762. AC_DEFINE_UNQUOTED(TYPE, [$r], [Size of $1 in number of bytes])
  5763. ])