curl-functions.m4 158 KB

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