curl-functions.m4 185 KB

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