curl-functions.m4 174 KB

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