curl-functions.m4 185 KB

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