curl-functions.m4 174 KB

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