curl-functions.m4 174 KB

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