curl-functions.m4 195 KB

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