2
0

curl-functions.m4 157 KB

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