aclocal.m4 212 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003
  1. dnl $LynxId: aclocal.m4,v 1.210 2014/01/11 17:09:11 tom Exp $
  2. dnl Macros for auto-configure script.
  3. dnl by Thomas E. Dickey <dickey@invisible-island.net>
  4. dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
  5. dnl and Philippe De Muyter <phdm@macqel.be>
  6. dnl
  7. dnl Created: 1997/01/28
  8. dnl
  9. dnl The autoconf used in Lynx development is GNU autoconf 2.13 or 2.52, patched
  10. dnl by Thomas Dickey. See your local GNU archives, and this URL:
  11. dnl http://invisible-island.net/autoconf/autoconf.html
  12. dnl
  13. dnl ---------------------------------------------------------------------------
  14. dnl
  15. dnl Copyright 1997-2013,2014 by Thomas E. Dickey
  16. dnl
  17. dnl Permission to use, copy, modify, and distribute this software and its
  18. dnl documentation for any purpose and without fee is hereby granted,
  19. dnl provided that the above copyright notice appear in all copies and that
  20. dnl both that copyright notice and this permission notice appear in
  21. dnl supporting documentation, and that the name of the above listed
  22. dnl copyright holder(s) not be used in advertising or publicity pertaining
  23. dnl to distribution of the software without specific, written prior
  24. dnl permission.
  25. dnl
  26. dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
  27. dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  28. dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
  29. dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  30. dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  31. dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  32. dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33. dnl
  34. dnl ---------------------------------------------------------------------------
  35. dnl A few macros (the AM_xxx ones) are originally from gettext 0.10.35 (but
  36. dnl are modified), and are part of this file due to mechanical limitations of
  37. dnl autoconf.
  38. dnl ---------------------------------------------------------------------------
  39. dnl ---------------------------------------------------------------------------
  40. dnl AM_GNU_GETTEXT version: 13 updated: 2012/11/09 05:47:26
  41. dnl --------------
  42. dnl Usage: Just like AM_WITH_NLS, which see.
  43. AC_DEFUN([AM_GNU_GETTEXT],
  44. [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  45. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  46. AC_REQUIRE([AC_PROG_RANLIB])dnl
  47. AC_REQUIRE([AC_HEADER_STDC])dnl
  48. AC_REQUIRE([AC_C_INLINE])dnl
  49. AC_REQUIRE([AC_TYPE_OFF_T])dnl
  50. AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  51. AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  52. AC_REQUIRE([AC_FUNC_MMAP])dnl
  53. AC_REQUIRE([jm_GLIBC21])dnl
  54. AC_REQUIRE([CF_PROG_CC])dnl
  55. AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
  56. stdlib.h string.h unistd.h sys/param.h])
  57. AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
  58. getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
  59. strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
  60. AM_ICONV
  61. AM_LANGINFO_CODESET
  62. AM_LC_MESSAGES
  63. AM_WITH_NLS([$1],[$2],[$3],[$4])
  64. if test "x$CATOBJEXT" != "x"; then
  65. if test "x$ALL_LINGUAS" = "x"; then
  66. LINGUAS=
  67. else
  68. AC_MSG_CHECKING(for catalogs to be installed)
  69. NEW_LINGUAS=
  70. for presentlang in $ALL_LINGUAS; do
  71. useit=no
  72. for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
  73. # Use the presentlang catalog if desiredlang is
  74. # a. equal to presentlang, or
  75. # b. a variant of presentlang (because in this case,
  76. # presentlang can be used as a fallback for messages
  77. # which are not translated in the desiredlang catalog).
  78. case "$desiredlang" in
  79. "$presentlang"*) useit=yes;;
  80. esac
  81. done
  82. if test $useit = yes; then
  83. NEW_LINGUAS="$NEW_LINGUAS $presentlang"
  84. fi
  85. done
  86. LINGUAS=$NEW_LINGUAS
  87. AC_MSG_RESULT($LINGUAS)
  88. fi
  89. dnl Construct list of names of catalog files to be constructed.
  90. if test -n "$LINGUAS"; then
  91. for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  92. fi
  93. fi
  94. dnl Enable libtool support if the surrounding package wishes it.
  95. INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
  96. AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
  97. ])dnl
  98. dnl ---------------------------------------------------------------------------
  99. dnl AM_ICONV version: 12 updated: 2007/07/30 19:12:03
  100. dnl --------
  101. dnl Inserted as requested by gettext 0.10.40
  102. dnl File from /usr/share/aclocal
  103. dnl iconv.m4
  104. dnl ====================
  105. dnl serial AM2
  106. dnl
  107. dnl From Bruno Haible.
  108. dnl
  109. dnl ====================
  110. dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
  111. dnl range of locations searched. Retain the same cache-variable naming to
  112. dnl allow reuse with the other gettext macros -Thomas E Dickey
  113. AC_DEFUN([AM_ICONV],
  114. [
  115. dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  116. dnl those with the standalone portable GNU libiconv installed).
  117. AC_ARG_WITH([libiconv-prefix],
  118. [ --with-libiconv-prefix=DIR
  119. search for libiconv in DIR/include and DIR/lib], [
  120. CF_ADD_OPTIONAL_PATH($withval, libiconv)
  121. ])
  122. AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
  123. CF_FIND_LINKAGE(CF__ICONV_HEAD,
  124. CF__ICONV_BODY,
  125. iconv,
  126. am_cv_func_iconv=yes,
  127. am_cv_func_iconv=["no, consider installing GNU libiconv"])])
  128. if test "$am_cv_func_iconv" = yes; then
  129. AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
  130. AC_CACHE_CHECK([if the declaration of iconv() needs const.],
  131. am_cv_proto_iconv_const,[
  132. AC_TRY_COMPILE(CF__ICONV_HEAD [
  133. extern
  134. #ifdef __cplusplus
  135. "C"
  136. #endif
  137. #if defined(__STDC__) || defined(__cplusplus)
  138. size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  139. #else
  140. size_t iconv();
  141. #endif
  142. ],[], am_cv_proto_iconv_const=no,
  143. am_cv_proto_iconv_const=yes)])
  144. if test "$am_cv_proto_iconv_const" = yes ; then
  145. am_cv_proto_iconv_arg1="const"
  146. else
  147. am_cv_proto_iconv_arg1=""
  148. fi
  149. AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
  150. [Define as const if the declaration of iconv() needs const.])
  151. fi
  152. LIBICONV=
  153. if test "$cf_cv_find_linkage_iconv" = yes; then
  154. CF_ADD_INCDIR($cf_cv_header_path_iconv)
  155. if test -n "$cf_cv_library_file_iconv" ; then
  156. LIBICONV="-liconv"
  157. CF_ADD_LIBDIR($cf_cv_library_path_iconv)
  158. fi
  159. fi
  160. AC_SUBST(LIBICONV)
  161. ])dnl
  162. dnl ---------------------------------------------------------------------------
  163. dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
  164. dnl -------------------
  165. dnl Inserted as requested by gettext 0.10.40
  166. dnl File from /usr/share/aclocal
  167. dnl codeset.m4
  168. dnl ====================
  169. dnl serial AM1
  170. dnl
  171. dnl From Bruno Haible.
  172. AC_DEFUN([AM_LANGINFO_CODESET],
  173. [
  174. AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
  175. [AC_TRY_LINK([#include <langinfo.h>],
  176. [char* cs = nl_langinfo(CODESET);],
  177. am_cv_langinfo_codeset=yes,
  178. am_cv_langinfo_codeset=no)
  179. ])
  180. if test $am_cv_langinfo_codeset = yes; then
  181. AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
  182. [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  183. fi
  184. ])dnl
  185. dnl ---------------------------------------------------------------------------
  186. dnl AM_LC_MESSAGES version: 4 updated: 2002/10/27 23:21:42
  187. dnl --------------
  188. dnl Inserted as requested by gettext 0.10.40
  189. dnl File from /usr/share/aclocal
  190. dnl lcmessage.m4
  191. dnl ====================
  192. dnl Check whether LC_MESSAGES is available in <locale.h>.
  193. dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
  194. dnl
  195. dnl This file can be copied and used freely without restrictions. It can
  196. dnl be used in projects which are not available under the GNU General Public
  197. dnl License or the GNU Library General Public License but which still want
  198. dnl to provide support for the GNU gettext functionality.
  199. dnl Please note that the actual code of the GNU gettext library is covered
  200. dnl by the GNU Library General Public License, and the rest of the GNU
  201. dnl gettext package package is covered by the GNU General Public License.
  202. dnl They are *not* in the public domain.
  203. dnl
  204. dnl serial 2
  205. dnl
  206. AC_DEFUN([AM_LC_MESSAGES],
  207. [if test $ac_cv_header_locale_h = yes; then
  208. AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  209. [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  210. am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  211. if test $am_cv_val_LC_MESSAGES = yes; then
  212. AC_DEFINE(HAVE_LC_MESSAGES, 1,
  213. [Define if your <locale.h> file defines LC_MESSAGES.])
  214. fi
  215. fi])dnl
  216. dnl ---------------------------------------------------------------------------
  217. dnl AM_PATH_PROG_WITH_TEST version: 8 updated: 2009/01/11 20:31:12
  218. dnl ----------------------
  219. dnl Inserted as requested by gettext 0.10.40
  220. dnl File from /usr/share/aclocal
  221. dnl progtest.m4
  222. dnl ====================
  223. dnl Search path for a program which passes the given test.
  224. dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
  225. dnl
  226. dnl This file can be copied and used freely without restrictions. It can
  227. dnl be used in projects which are not available under the GNU General Public
  228. dnl License or the GNU Library General Public License but which still want
  229. dnl to provide support for the GNU gettext functionality.
  230. dnl Please note that the actual code of the GNU gettext library is covered
  231. dnl by the GNU Library General Public License, and the rest of the GNU
  232. dnl gettext package package is covered by the GNU General Public License.
  233. dnl They are *not* in the public domain.
  234. dnl
  235. dnl serial 2
  236. dnl
  237. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
  238. dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  239. AC_DEFUN([AM_PATH_PROG_WITH_TEST],
  240. [# Extract the first word of "$2", so it can be a program name with args.
  241. AC_REQUIRE([CF_PATHSEP])
  242. set dummy $2; ac_word=[$]2
  243. AC_MSG_CHECKING([for $ac_word])
  244. AC_CACHE_VAL(ac_cv_path_$1,
  245. [case "[$]$1" in
  246. [[\\/]*|?:[\\/]]*)
  247. ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  248. ;;
  249. *)
  250. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
  251. for ac_dir in ifelse([$5], , $PATH, [$5]); do
  252. test -z "$ac_dir" && ac_dir=.
  253. if test -f $ac_dir/$ac_word$ac_exeext; then
  254. if [$3]; then
  255. ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext"
  256. break
  257. fi
  258. fi
  259. done
  260. IFS="$ac_save_ifs"
  261. dnl If no 4th arg is given, leave the cache variable unset,
  262. dnl so AC_PATH_PROGS will keep looking.
  263. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  264. ])dnl
  265. ;;
  266. esac])dnl
  267. $1="$ac_cv_path_$1"
  268. if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
  269. AC_MSG_RESULT([$]$1)
  270. else
  271. AC_MSG_RESULT(no)
  272. fi
  273. AC_SUBST($1)dnl
  274. ])dnl
  275. dnl ---------------------------------------------------------------------------
  276. dnl AM_WITH_NLS version: 25 updated: 2012/10/06 08:57:51
  277. dnl -----------
  278. dnl Inserted as requested by gettext 0.10.40
  279. dnl File from /usr/share/aclocal
  280. dnl gettext.m4
  281. dnl ====================
  282. dnl Macro to add for using GNU gettext.
  283. dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
  284. dnl ====================
  285. dnl Modified to use CF_FIND_LINKAGE and CF_ADD_SEARCHPATH, to broaden the
  286. dnl range of locations searched. Retain the same cache-variable naming to
  287. dnl allow reuse with the other gettext macros -Thomas E Dickey
  288. dnl ====================
  289. dnl
  290. dnl This file can be copied and used freely without restrictions. It can
  291. dnl be used in projects which are not available under the GNU General Public
  292. dnl License or the GNU Library General Public License but which still want
  293. dnl to provide support for the GNU gettext functionality.
  294. dnl Please note that the actual code of the GNU gettext library is covered
  295. dnl by the GNU Library General Public License, and the rest of the GNU
  296. dnl gettext package package is covered by the GNU General Public License.
  297. dnl They are *not* in the public domain.
  298. dnl
  299. dnl serial 10
  300. dnl
  301. dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]).
  302. dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
  303. dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
  304. dnl depending on --{enable,disable}-{shared,static} and on the presence of
  305. dnl AM-DISABLE-SHARED). Otherwise, a static library
  306. dnl $(top_builddir)/intl/libintl.a will be created.
  307. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
  308. dnl implementations (in libc or libintl) without the ngettext() function
  309. dnl will be ignored.
  310. dnl LIBDIR is used to find the intl libraries. If empty,
  311. dnl the value `$(top_builddir)/intl/' is used.
  312. dnl ENABLED is used to control the default for the related --enable-nls, since
  313. dnl not all application developers want this feature by default, e.g., lynx.
  314. dnl
  315. dnl The result of the configuration is one of three cases:
  316. dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
  317. dnl and used.
  318. dnl Catalog format: GNU --> install in $(datadir)
  319. dnl Catalog extension: .mo after installation, .gmo in source tree
  320. dnl 2) GNU gettext has been found in the system's C library.
  321. dnl Catalog format: GNU --> install in $(datadir)
  322. dnl Catalog extension: .mo after installation, .gmo in source tree
  323. dnl 3) No internationalization, always use English msgid.
  324. dnl Catalog format: none
  325. dnl Catalog extension: none
  326. dnl The use of .gmo is historical (it was needed to avoid overwriting the
  327. dnl GNU format catalogs when building on a platform with an X/Open gettext),
  328. dnl but we keep it in order not to force irrelevant filename changes on the
  329. dnl maintainers.
  330. dnl
  331. AC_DEFUN([AM_WITH_NLS],
  332. [AC_MSG_CHECKING([whether NLS is requested])
  333. dnl Default is enabled NLS
  334. ifelse([$4],,[
  335. AC_ARG_ENABLE(nls,
  336. [ --disable-nls do not use Native Language Support],
  337. USE_NLS=$enableval, USE_NLS=yes)],[
  338. AC_ARG_ENABLE(nls,
  339. [ --enable-nls use Native Language Support],
  340. USE_NLS=$enableval, USE_NLS=no)])
  341. AC_MSG_RESULT($USE_NLS)
  342. AC_SUBST(USE_NLS)
  343. BUILD_INCLUDED_LIBINTL=no
  344. USE_INCLUDED_LIBINTL=no
  345. INTLLIBS=
  346. dnl If we use NLS figure out what method
  347. if test "$USE_NLS" = "yes"; then
  348. AC_DEFINE(ENABLE_NLS, 1,
  349. [Define to 1 if translation of program messages to the user's native language
  350. is requested.])
  351. AC_MSG_CHECKING([whether included gettext is requested])
  352. AC_ARG_WITH(included-gettext,
  353. [ --with-included-gettext use the GNU gettext library included here],
  354. nls_cv_force_use_gnu_gettext=$withval,
  355. nls_cv_force_use_gnu_gettext=no)
  356. AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
  357. nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  358. if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  359. dnl User does not insist on using GNU NLS library. Figure out what
  360. dnl to use. If GNU gettext is available we use this. Else we have
  361. dnl to fall back to GNU NLS library.
  362. CATOBJEXT=NONE
  363. cf_save_LIBS_1="$LIBS"
  364. CF_ADD_LIBS($LIBICONV)
  365. AC_CACHE_CHECK([for libintl.h and gettext()], cf_cv_func_gettext,[
  366. CF_FIND_LINKAGE(CF__INTL_HEAD,
  367. CF__INTL_BODY,
  368. intl,
  369. cf_cv_func_gettext=yes,
  370. cf_cv_func_gettext=no)
  371. ])
  372. LIBS="$cf_save_LIBS_1"
  373. if test "$cf_cv_func_gettext" = yes ; then
  374. AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have libintl.h])
  375. dnl If an already present or preinstalled GNU gettext() is found,
  376. dnl use it. But if this macro is used in GNU gettext, and GNU
  377. dnl gettext is already preinstalled in libintl, we update this
  378. dnl libintl. (Cf. the install rule in intl/Makefile.in.)
  379. if test "$PACKAGE" != gettext; then
  380. AC_DEFINE(HAVE_GETTEXT, 1,
  381. [Define if the GNU gettext() function is already present or preinstalled.])
  382. CF_ADD_INCDIR($cf_cv_header_path_intl)
  383. if test -n "$cf_cv_library_file_intl" ; then
  384. dnl If iconv() is in a separate libiconv library, then anyone
  385. dnl linking with libintl{.a,.so} also needs to link with
  386. dnl libiconv.
  387. INTLLIBS="$cf_cv_library_file_intl $LIBICONV"
  388. CF_ADD_LIBDIR($cf_cv_library_path_intl,INTLLIBS)
  389. fi
  390. gt_save_LIBS="$LIBS"
  391. LIBS="$LIBS $INTLLIBS"
  392. AC_CHECK_FUNCS(dcgettext)
  393. LIBS="$gt_save_LIBS"
  394. dnl Search for GNU msgfmt in the PATH.
  395. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  396. [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
  397. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  398. dnl Search for GNU xgettext in the PATH.
  399. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  400. [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
  401. CATOBJEXT=.gmo
  402. fi
  403. fi
  404. if test "$CATOBJEXT" = "NONE"; then
  405. dnl GNU gettext is not found in the C library.
  406. dnl Fall back on GNU gettext library.
  407. nls_cv_use_gnu_gettext=yes
  408. fi
  409. fi
  410. if test "$nls_cv_use_gnu_gettext" = "yes"; then
  411. if test ! -d $srcdir/intl ; then
  412. AC_MSG_ERROR(no NLS library is packaged with this application)
  413. fi
  414. dnl Mark actions used to generate GNU NLS library.
  415. INTLOBJS="\$(GETTOBJS)"
  416. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  417. [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
  418. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  419. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  420. [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
  421. AC_SUBST(MSGFMT)
  422. BUILD_INCLUDED_LIBINTL=yes
  423. USE_INCLUDED_LIBINTL=yes
  424. CATOBJEXT=.gmo
  425. INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
  426. LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
  427. fi
  428. dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  429. dnl Test whether we really found GNU msgfmt.
  430. if test "$GMSGFMT" != ":"; then
  431. dnl If it is no GNU msgfmt we define it as : so that the
  432. dnl Makefiles still can work.
  433. if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
  434. : ;
  435. else
  436. AC_MSG_RESULT(
  437. [found msgfmt program is not GNU msgfmt; ignore it])
  438. GMSGFMT=":"
  439. fi
  440. fi
  441. dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  442. dnl Test whether we really found GNU xgettext.
  443. if test "$XGETTEXT" != ":"; then
  444. dnl If it is no GNU xgettext we define it as : so that the
  445. dnl Makefiles still can work.
  446. if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
  447. : ;
  448. else
  449. AC_MSG_RESULT(
  450. [found xgettext program is not GNU xgettext; ignore it])
  451. XGETTEXT=":"
  452. fi
  453. fi
  454. dnl We need to process the po/ directory.
  455. POSUB=po
  456. fi
  457. AC_OUTPUT_COMMANDS(
  458. [for ac_file in $CONFIG_FILES; do
  459. # Support "outfile[:infile[:infile...]]"
  460. case "$ac_file" in
  461. *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  462. esac
  463. # PO directories have a Makefile.in generated from Makefile.inn.
  464. case "$ac_file" in */[Mm]akefile.in)
  465. # Adjust a relative srcdir.
  466. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
  467. ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
  468. ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
  469. ac_base=`basename $ac_file .in`
  470. # In autoconf-2.13 it is called $ac_given_srcdir.
  471. # In autoconf-2.50 it is called $srcdir.
  472. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
  473. case "$ac_given_srcdir" in
  474. .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
  475. /*) top_srcdir="$ac_given_srcdir" ;;
  476. *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
  477. esac
  478. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
  479. rm -f "$ac_dir/POTFILES"
  480. test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
  481. sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
  482. test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base"
  483. sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base"
  484. fi
  485. ;;
  486. esac
  487. done])
  488. dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
  489. dnl to 'yes' because some of the testsuite requires it.
  490. if test "$PACKAGE" = gettext; then
  491. BUILD_INCLUDED_LIBINTL=yes
  492. fi
  493. dnl intl/plural.c is generated from intl/plural.y. It requires bison,
  494. dnl because plural.y uses bison specific features. It requires at least
  495. dnl bison-1.26 because earlier versions generate a plural.c that doesn't
  496. dnl compile.
  497. dnl bison is only needed for the maintainer (who touches plural.y). But in
  498. dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
  499. dnl the rule in general Makefile. Now, some people carelessly touch the
  500. dnl files or have a broken "make" program, hence the plural.c rule will
  501. dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
  502. dnl present or too old.
  503. if test "$nls_cv_use_gnu_gettext" = "yes"; then
  504. AC_CHECK_PROGS([INTLBISON], [bison])
  505. if test -z "$INTLBISON"; then
  506. ac_verc_fail=yes
  507. else
  508. dnl Found it, now check the version.
  509. AC_MSG_CHECKING([version of bison])
  510. changequote(<<,>>)dnl
  511. ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
  512. case $ac_prog_version in
  513. '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  514. 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
  515. changequote([,])dnl
  516. ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  517. *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  518. esac
  519. AC_MSG_RESULT([$ac_prog_version])
  520. fi
  521. if test $ac_verc_fail = yes; then
  522. INTLBISON=:
  523. fi
  524. fi
  525. dnl These rules are solely for the distribution goal. While doing this
  526. dnl we only have to keep exactly one list of the available catalogs
  527. dnl in configure.in.
  528. for lang in $ALL_LINGUAS; do
  529. GMOFILES="$GMOFILES $lang.gmo"
  530. POFILES="$POFILES $lang.po"
  531. done
  532. dnl Make all variables we use known to autoconf.
  533. AC_SUBST(BUILD_INCLUDED_LIBINTL)
  534. AC_SUBST(USE_INCLUDED_LIBINTL)
  535. AC_SUBST(CATALOGS)
  536. AC_SUBST(CATOBJEXT)
  537. AC_SUBST(GMOFILES)
  538. AC_SUBST(INTLLIBS)
  539. AC_SUBST(INTLOBJS)
  540. AC_SUBST(POFILES)
  541. AC_SUBST(POSUB)
  542. dnl For backward compatibility. Some configure.ins may be using this.
  543. nls_cv_header_intl=
  544. nls_cv_header_libgt=
  545. dnl For backward compatibility. Some Makefiles may be using this.
  546. DATADIRNAME=share
  547. AC_SUBST(DATADIRNAME)
  548. dnl For backward compatibility. Some Makefiles may be using this.
  549. INSTOBJEXT=.mo
  550. AC_SUBST(INSTOBJEXT)
  551. dnl For backward compatibility. Some Makefiles may be using this.
  552. GENCAT=gencat
  553. AC_SUBST(GENCAT)
  554. ])dnl
  555. dnl ---------------------------------------------------------------------------
  556. dnl CF_ACVERSION_CHECK version: 4 updated: 2013/03/04 19:52:56
  557. dnl ------------------
  558. dnl Conditionally generate script according to whether we're using a given autoconf.
  559. dnl
  560. dnl $1 = version to compare against
  561. dnl $2 = code to use if AC_ACVERSION is at least as high as $1.
  562. dnl $3 = code to use if AC_ACVERSION is older than $1.
  563. define([CF_ACVERSION_CHECK],
  564. [
  565. ifdef([AC_ACVERSION], ,[m4_copy([m4_PACKAGE_VERSION],[AC_ACVERSION])])dnl
  566. ifdef([m4_version_compare],
  567. [m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, [$3], [$2])],
  568. [CF_ACVERSION_COMPARE(
  569. AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])),
  570. AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), AC_ACVERSION, [$2], [$3])])])dnl
  571. dnl ---------------------------------------------------------------------------
  572. dnl CF_ACVERSION_COMPARE version: 3 updated: 2012/10/03 18:39:53
  573. dnl --------------------
  574. dnl CF_ACVERSION_COMPARE(MAJOR1, MINOR1, TERNARY1,
  575. dnl MAJOR2, MINOR2, TERNARY2,
  576. dnl PRINTABLE2, not FOUND, FOUND)
  577. define([CF_ACVERSION_COMPARE],
  578. [ifelse(builtin([eval], [$2 < $5]), 1,
  579. [ifelse([$8], , ,[$8])],
  580. [ifelse([$9], , ,[$9])])])dnl
  581. dnl ---------------------------------------------------------------------------
  582. dnl CF_ADD_CFLAGS version: 10 updated: 2010/05/26 05:38:42
  583. dnl -------------
  584. dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
  585. dnl The second parameter if given makes this macro verbose.
  586. dnl
  587. dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
  588. dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
  589. dnl confused by the quotes (which require backslashes to keep them usable).
  590. AC_DEFUN([CF_ADD_CFLAGS],
  591. [
  592. cf_fix_cppflags=no
  593. cf_new_cflags=
  594. cf_new_cppflags=
  595. cf_new_extra_cppflags=
  596. for cf_add_cflags in $1
  597. do
  598. case $cf_fix_cppflags in
  599. no)
  600. case $cf_add_cflags in #(vi
  601. -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
  602. case $cf_add_cflags in
  603. -D*)
  604. cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
  605. test "${cf_add_cflags}" != "${cf_tst_cflags}" \
  606. && test -z "${cf_tst_cflags}" \
  607. && cf_fix_cppflags=yes
  608. if test $cf_fix_cppflags = yes ; then
  609. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  610. continue
  611. elif test "${cf_tst_cflags}" = "\"'" ; then
  612. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  613. continue
  614. fi
  615. ;;
  616. esac
  617. case "$CPPFLAGS" in
  618. *$cf_add_cflags) #(vi
  619. ;;
  620. *) #(vi
  621. case $cf_add_cflags in #(vi
  622. -D*)
  623. cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'`
  624. CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags)
  625. ;;
  626. esac
  627. cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
  628. ;;
  629. esac
  630. ;;
  631. *)
  632. cf_new_cflags="$cf_new_cflags $cf_add_cflags"
  633. ;;
  634. esac
  635. ;;
  636. yes)
  637. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  638. cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
  639. test "${cf_add_cflags}" != "${cf_tst_cflags}" \
  640. && test -z "${cf_tst_cflags}" \
  641. && cf_fix_cppflags=no
  642. ;;
  643. esac
  644. done
  645. if test -n "$cf_new_cflags" ; then
  646. ifelse([$2],,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
  647. CFLAGS="$CFLAGS $cf_new_cflags"
  648. fi
  649. if test -n "$cf_new_cppflags" ; then
  650. ifelse([$2],,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
  651. CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
  652. fi
  653. if test -n "$cf_new_extra_cppflags" ; then
  654. ifelse([$2],,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
  655. EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
  656. fi
  657. AC_SUBST(EXTRA_CPPFLAGS)
  658. ])dnl
  659. dnl ---------------------------------------------------------------------------
  660. dnl CF_ADD_INCDIR version: 13 updated: 2010/05/26 16:44:57
  661. dnl -------------
  662. dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
  663. dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
  664. dnl but old versions (and some misinstalled ones) need that. To make things
  665. dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
  666. dnl the include-path).
  667. AC_DEFUN([CF_ADD_INCDIR],
  668. [
  669. if test -n "$1" ; then
  670. for cf_add_incdir in $1
  671. do
  672. while test $cf_add_incdir != /usr/include
  673. do
  674. if test -d $cf_add_incdir
  675. then
  676. cf_have_incdir=no
  677. if test -n "$CFLAGS$CPPFLAGS" ; then
  678. # a loop is needed to ensure we can add subdirs of existing dirs
  679. for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
  680. if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
  681. cf_have_incdir=yes; break
  682. fi
  683. done
  684. fi
  685. if test "$cf_have_incdir" = no ; then
  686. if test "$cf_add_incdir" = /usr/local/include ; then
  687. if test "$GCC" = yes
  688. then
  689. cf_save_CPPFLAGS=$CPPFLAGS
  690. CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
  691. AC_TRY_COMPILE([#include <stdio.h>],
  692. [printf("Hello")],
  693. [],
  694. [cf_have_incdir=yes])
  695. CPPFLAGS=$cf_save_CPPFLAGS
  696. fi
  697. fi
  698. fi
  699. if test "$cf_have_incdir" = no ; then
  700. CF_VERBOSE(adding $cf_add_incdir to include-path)
  701. ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir"
  702. cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
  703. test "$cf_top_incdir" = "$cf_add_incdir" && break
  704. cf_add_incdir="$cf_top_incdir"
  705. else
  706. break
  707. fi
  708. fi
  709. done
  710. done
  711. fi
  712. ])dnl
  713. dnl ---------------------------------------------------------------------------
  714. dnl CF_ADD_LIB version: 2 updated: 2010/06/02 05:03:05
  715. dnl ----------
  716. dnl Add a library, used to enforce consistency.
  717. dnl
  718. dnl $1 = library to add, without the "-l"
  719. dnl $2 = variable to update (default $LIBS)
  720. AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl
  721. dnl ---------------------------------------------------------------------------
  722. dnl CF_ADD_LIBDIR version: 9 updated: 2010/05/26 16:44:57
  723. dnl -------------
  724. dnl Adds to the library-path
  725. dnl
  726. dnl Some machines have trouble with multiple -L options.
  727. dnl
  728. dnl $1 is the (list of) directory(s) to add
  729. dnl $2 is the optional name of the variable to update (default LDFLAGS)
  730. dnl
  731. AC_DEFUN([CF_ADD_LIBDIR],
  732. [
  733. if test -n "$1" ; then
  734. for cf_add_libdir in $1
  735. do
  736. if test $cf_add_libdir = /usr/lib ; then
  737. :
  738. elif test -d $cf_add_libdir
  739. then
  740. cf_have_libdir=no
  741. if test -n "$LDFLAGS$LIBS" ; then
  742. # a loop is needed to ensure we can add subdirs of existing dirs
  743. for cf_test_libdir in $LDFLAGS $LIBS ; do
  744. if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
  745. cf_have_libdir=yes; break
  746. fi
  747. done
  748. fi
  749. if test "$cf_have_libdir" = no ; then
  750. CF_VERBOSE(adding $cf_add_libdir to library-path)
  751. ifelse([$2],,LDFLAGS,[$2])="-L$cf_add_libdir $ifelse([$2],,LDFLAGS,[$2])"
  752. fi
  753. fi
  754. done
  755. fi
  756. ])dnl
  757. dnl ---------------------------------------------------------------------------
  758. dnl CF_ADD_LIBS version: 1 updated: 2010/06/02 05:03:05
  759. dnl -----------
  760. dnl Add one or more libraries, used to enforce consistency.
  761. dnl
  762. dnl $1 = libraries to add, with the "-l", etc.
  763. dnl $2 = variable to update (default $LIBS)
  764. AC_DEFUN([CF_ADD_LIBS],[ifelse($2,,LIBS,[$2])="$1 [$]ifelse($2,,LIBS,[$2])"])dnl
  765. dnl ---------------------------------------------------------------------------
  766. dnl CF_ADD_LIB_AFTER version: 3 updated: 2013/07/09 21:27:22
  767. dnl ----------------
  768. dnl Add a given library after another, e.g., following the one it satisfies a
  769. dnl dependency for.
  770. dnl
  771. dnl $1 = the first library
  772. dnl $2 = its dependency
  773. AC_DEFUN([CF_ADD_LIB_AFTER],[
  774. CF_VERBOSE(...before $LIBS)
  775. LIBS=`echo "$LIBS" | sed -e "s/[[ ]][[ ]]*/ /g" -e "s%$1 %$1 $2 %" -e 's% % %g'`
  776. CF_VERBOSE(...after $LIBS)
  777. ])dnl
  778. dnl ---------------------------------------------------------------------------
  779. dnl CF_ADD_OPTIONAL_PATH version: 1 updated: 2007/07/29 12:33:33
  780. dnl --------------------
  781. dnl Add an optional search-path to the compile/link variables.
  782. dnl See CF_WITH_PATH
  783. dnl
  784. dnl $1 = shell variable containing the result of --with-XXX=[DIR]
  785. dnl $2 = module to look for.
  786. AC_DEFUN([CF_ADD_OPTIONAL_PATH],[
  787. case "$1" in #(vi
  788. no) #(vi
  789. ;;
  790. yes) #(vi
  791. ;;
  792. *)
  793. CF_ADD_SEARCHPATH([$1], [AC_MSG_ERROR(cannot find $2 under $1)])
  794. ;;
  795. esac
  796. ])dnl
  797. dnl ---------------------------------------------------------------------------
  798. dnl CF_ADD_SEARCHPATH version: 5 updated: 2009/01/11 20:40:21
  799. dnl -----------------
  800. dnl Set $CPPFLAGS and $LDFLAGS with the directories given via the parameter.
  801. dnl They can be either the common root of include- and lib-directories, or the
  802. dnl lib-directory (to allow for things like lib64 directories).
  803. dnl See also CF_FIND_LINKAGE.
  804. dnl
  805. dnl $1 is the list of colon-separated directory names to search.
  806. dnl $2 is the action to take if a parameter does not yield a directory.
  807. AC_DEFUN([CF_ADD_SEARCHPATH],
  808. [
  809. AC_REQUIRE([CF_PATHSEP])
  810. for cf_searchpath in `echo "$1" | tr $PATH_SEPARATOR ' '`; do
  811. if test -d $cf_searchpath/include; then
  812. CF_ADD_INCDIR($cf_searchpath/include)
  813. elif test -d $cf_searchpath/../include ; then
  814. CF_ADD_INCDIR($cf_searchpath/../include)
  815. ifelse([$2],,,[else
  816. $2])
  817. fi
  818. if test -d $cf_searchpath/lib; then
  819. CF_ADD_LIBDIR($cf_searchpath/lib)
  820. elif test -d $cf_searchpath ; then
  821. CF_ADD_LIBDIR($cf_searchpath)
  822. ifelse([$2],,,[else
  823. $2])
  824. fi
  825. done
  826. ])
  827. dnl ---------------------------------------------------------------------------
  828. dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05
  829. dnl ------------------
  830. dnl Append to a search-list for a nonstandard header/lib-file
  831. dnl $1 = the variable to return as result
  832. dnl $2 = the package name
  833. dnl $3 = the subdirectory, e.g., bin, include or lib
  834. dnl $4 = the directory under which we will test for subdirectories
  835. dnl $5 = a directory that we do not want $4 to match
  836. AC_DEFUN([CF_ADD_SUBDIR_PATH],
  837. [
  838. test "x$4" != "x$5" && \
  839. test -d "$4" && \
  840. ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) {
  841. test -n "$verbose" && echo " ... testing for $3-directories under $4"
  842. test -d $4/$3 && $1="[$]$1 $4/$3"
  843. test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
  844. test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
  845. test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
  846. test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
  847. }
  848. ])dnl
  849. dnl ---------------------------------------------------------------------------
  850. dnl CF_ALT_CHAR_SET version: 8 updated: 2012/11/08 20:57:52
  851. dnl ---------------
  852. dnl Check for existence of alternate-character-set support in curses, so we
  853. dnl can decide to use it for box characters.
  854. dnl
  855. AC_DEFUN([CF_ALT_CHAR_SET],
  856. [
  857. AC_MSG_CHECKING([if curses supports alternate-character set])
  858. AC_CACHE_VAL(cf_cv_alt_char_set,[
  859. for mapname in acs_map _acs_map
  860. do
  861. AC_TRY_LINK([
  862. #include <${cf_cv_ncurses_header:-curses.h}>
  863. ],[chtype x = $mapname['l']; $mapname['m'] = 0],
  864. [cf_cv_alt_char_set=$mapname
  865. break],
  866. [cf_cv_alt_char_set=no])
  867. done
  868. ])
  869. AC_MSG_RESULT($cf_cv_alt_char_set)
  870. test $cf_cv_alt_char_set != no && AC_DEFINE_UNQUOTED(ALT_CHAR_SET,$cf_cv_alt_char_set,[Define to 1 if if curses supports alternate-character set])
  871. ])dnl
  872. dnl ---------------------------------------------------------------------------
  873. dnl CF_ANSI_CC_CHECK version: 13 updated: 2012/10/06 11:17:15
  874. dnl ----------------
  875. dnl This was originally adapted from the macros 'fp_PROG_CC_STDC' and
  876. dnl 'fp_C_PROTOTYPES' in the sharutils 4.2 distribution.
  877. AC_DEFUN([CF_ANSI_CC_CHECK],
  878. [
  879. CF_CC_ENV_FLAGS
  880. AC_CACHE_CHECK(for ${CC:-cc} option to accept ANSI C, cf_cv_ansi_cc,[
  881. cf_cv_ansi_cc=no
  882. cf_save_CFLAGS="$CFLAGS"
  883. cf_save_CPPFLAGS="$CPPFLAGS"
  884. # Don't try gcc -ansi; that turns off useful extensions and
  885. # breaks some systems' header files.
  886. # AIX -qlanglvl=ansi
  887. # Ultrix and OSF/1 -std1
  888. # HP-UX -Aa -D_HPUX_SOURCE
  889. # SVR4 -Xc
  890. # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
  891. for cf_arg in "-DCC_HAS_PROTOS" \
  892. "" \
  893. -qlanglvl=ansi \
  894. -std1 \
  895. -Ae \
  896. "-Aa -D_HPUX_SOURCE" \
  897. -Xc
  898. do
  899. CF_ADD_CFLAGS($cf_arg)
  900. AC_TRY_COMPILE(
  901. [
  902. #ifndef CC_HAS_PROTOS
  903. #if !defined(__STDC__) || (__STDC__ != 1)
  904. choke me
  905. #endif
  906. #endif
  907. ],[
  908. int test (int i, double x);
  909. struct s1 {int (*f) (int a);};
  910. struct s2 {int (*f) (double a);};],
  911. [cf_cv_ansi_cc="$cf_arg"; break])
  912. done
  913. CFLAGS="$cf_save_CFLAGS"
  914. CPPFLAGS="$cf_save_CPPFLAGS"
  915. ])
  916. if test "$cf_cv_ansi_cc" != "no"; then
  917. if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
  918. CF_ADD_CFLAGS($cf_cv_ansi_cc)
  919. else
  920. AC_DEFINE(CC_HAS_PROTOS,1,[Define to 1 if C compiler supports prototypes])
  921. fi
  922. fi
  923. ])dnl
  924. dnl ---------------------------------------------------------------------------
  925. dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
  926. dnl ---------------
  927. dnl For programs that must use an ANSI compiler, obtain compiler options that
  928. dnl will make it recognize prototypes. We'll do preprocessor checks in other
  929. dnl macros, since tools such as unproto can fake prototypes, but only part of
  930. dnl the preprocessor.
  931. AC_DEFUN([CF_ANSI_CC_REQD],
  932. [AC_REQUIRE([CF_ANSI_CC_CHECK])
  933. if test "$cf_cv_ansi_cc" = "no"; then
  934. AC_MSG_ERROR(
  935. [Your compiler does not appear to recognize prototypes.
  936. You have the following choices:
  937. a. adjust your compiler options
  938. b. get an up-to-date compiler
  939. c. use a wrapper such as unproto])
  940. fi
  941. ])dnl
  942. dnl ---------------------------------------------------------------------------
  943. dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
  944. dnl --------------
  945. dnl Allow user to disable a normally-on option.
  946. AC_DEFUN([CF_ARG_DISABLE],
  947. [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
  948. dnl ---------------------------------------------------------------------------
  949. dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
  950. dnl -------------
  951. dnl Allow user to enable a normally-off option.
  952. AC_DEFUN([CF_ARG_ENABLE],
  953. [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
  954. dnl ---------------------------------------------------------------------------
  955. dnl CF_ARG_OPTION version: 4 updated: 2010/05/26 05:38:42
  956. dnl -------------
  957. dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
  958. dnl values.
  959. dnl
  960. dnl Parameters:
  961. dnl $1 = option name
  962. dnl $2 = help-string
  963. dnl $3 = action to perform if option is not default
  964. dnl $4 = action if perform if option is default
  965. dnl $5 = default option value (either 'yes' or 'no')
  966. AC_DEFUN([CF_ARG_OPTION],
  967. [AC_ARG_ENABLE([$1],[$2],[test "$enableval" != ifelse([$5],no,yes,no) && enableval=ifelse([$5],no,no,yes)
  968. if test "$enableval" != "$5" ; then
  969. ifelse([$3],,[ :]dnl
  970. ,[ $3]) ifelse([$4],,,[
  971. else
  972. $4])
  973. fi],[enableval=$5 ifelse([$4],,,[
  974. $4
  975. ])dnl
  976. ])])dnl
  977. dnl ---------------------------------------------------------------------------
  978. dnl CF_AR_FLAGS version: 5 updated: 2010/05/20 20:24:29
  979. dnl -----------
  980. dnl Check for suitable "ar" (archiver) options for updating an archive.
  981. AC_DEFUN([CF_AR_FLAGS],[
  982. AC_REQUIRE([CF_PROG_AR])
  983. AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
  984. cf_cv_ar_flags=unknown
  985. for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv
  986. do
  987. # check if $ARFLAGS already contains this choice
  988. if test "x$ARFLAGS" != "x" ; then
  989. cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"`
  990. if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then
  991. cf_cv_ar_flags=
  992. break
  993. fi
  994. fi
  995. rm -f conftest.$ac_cv_objext
  996. rm -f conftest.a
  997. cat >conftest.$ac_ext <<EOF
  998. #line __oline__ "configure"
  999. int testdata[[3]] = { 123, 456, 789 };
  1000. EOF
  1001. if AC_TRY_EVAL(ac_compile) ; then
  1002. echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC
  1003. $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
  1004. if test -f conftest.a ; then
  1005. cf_cv_ar_flags=$cf_ar_flags
  1006. break
  1007. fi
  1008. else
  1009. CF_VERBOSE(cannot compile test-program)
  1010. break
  1011. fi
  1012. done
  1013. rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
  1014. ])
  1015. if test -n "$ARFLAGS" ; then
  1016. if test -n "$cf_cv_ar_flags" ; then
  1017. ARFLAGS="$ARFLAGS $cf_cv_ar_flags"
  1018. fi
  1019. else
  1020. ARFLAGS=$cf_cv_ar_flags
  1021. fi
  1022. AC_SUBST(ARFLAGS)
  1023. ])
  1024. dnl ---------------------------------------------------------------------------
  1025. dnl CF_BOOL_DEFS version: 5 updated: 2012/11/08 20:57:52
  1026. dnl ------------
  1027. dnl Check if curses.h defines TRUE/FALSE (it does under SVr4).
  1028. AC_DEFUN([CF_BOOL_DEFS],
  1029. [
  1030. AC_MSG_CHECKING(if TRUE/FALSE are defined)
  1031. AC_CACHE_VAL(cf_cv_bool_defs,[
  1032. AC_TRY_COMPILE([
  1033. #include <${cf_cv_ncurses_header:-curses.h}>
  1034. #include <stdio.h>],[int x = TRUE, y = FALSE],
  1035. [cf_cv_bool_defs=yes],
  1036. [cf_cv_bool_defs=no])])
  1037. AC_MSG_RESULT($cf_cv_bool_defs)
  1038. if test "$cf_cv_bool_defs" = no ; then
  1039. AC_DEFINE(TRUE,(1),[Define to TRUE if curses.h does not define])
  1040. AC_DEFINE(FALSE,(0),[Define to FALSE if curses.h does not define])
  1041. fi
  1042. ])dnl
  1043. dnl ---------------------------------------------------------------------------
  1044. dnl CF_BUILD_CC version: 7 updated: 2012/10/06 15:31:55
  1045. dnl -----------
  1046. dnl If we're cross-compiling, allow the user to override the tools and their
  1047. dnl options. The configure script is oriented toward identifying the host
  1048. dnl compiler, etc., but we need a build compiler to generate parts of the
  1049. dnl source.
  1050. dnl
  1051. dnl $1 = default for $CPPFLAGS
  1052. dnl $2 = default for $LIBS
  1053. AC_DEFUN([CF_BUILD_CC],[
  1054. CF_ACVERSION_CHECK(2.52,,
  1055. [AC_REQUIRE([CF_PROG_EXT])])
  1056. if test "$cross_compiling" = yes ; then
  1057. # defaults that we might want to override
  1058. : ${BUILD_CFLAGS:=''}
  1059. : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
  1060. : ${BUILD_LDFLAGS:=''}
  1061. : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
  1062. : ${BUILD_EXEEXT:='$x'}
  1063. : ${BUILD_OBJEXT:='o'}
  1064. AC_ARG_WITH(build-cc,
  1065. [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
  1066. [BUILD_CC="$withval"],
  1067. [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
  1068. AC_MSG_CHECKING(for native build C compiler)
  1069. AC_MSG_RESULT($BUILD_CC)
  1070. AC_MSG_CHECKING(for native build C preprocessor)
  1071. AC_ARG_WITH(build-cpp,
  1072. [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
  1073. [BUILD_CPP="$withval"],
  1074. [BUILD_CPP='${BUILD_CC} -E'])
  1075. AC_MSG_RESULT($BUILD_CPP)
  1076. AC_MSG_CHECKING(for native build C flags)
  1077. AC_ARG_WITH(build-cflags,
  1078. [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
  1079. [BUILD_CFLAGS="$withval"])
  1080. AC_MSG_RESULT($BUILD_CFLAGS)
  1081. AC_MSG_CHECKING(for native build C preprocessor-flags)
  1082. AC_ARG_WITH(build-cppflags,
  1083. [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
  1084. [BUILD_CPPFLAGS="$withval"])
  1085. AC_MSG_RESULT($BUILD_CPPFLAGS)
  1086. AC_MSG_CHECKING(for native build linker-flags)
  1087. AC_ARG_WITH(build-ldflags,
  1088. [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
  1089. [BUILD_LDFLAGS="$withval"])
  1090. AC_MSG_RESULT($BUILD_LDFLAGS)
  1091. AC_MSG_CHECKING(for native build linker-libraries)
  1092. AC_ARG_WITH(build-libs,
  1093. [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
  1094. [BUILD_LIBS="$withval"])
  1095. AC_MSG_RESULT($BUILD_LIBS)
  1096. # this assumes we're on Unix.
  1097. BUILD_EXEEXT=
  1098. BUILD_OBJEXT=o
  1099. : ${BUILD_CC:='${CC}'}
  1100. if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
  1101. AC_MSG_ERROR([Cross-build requires two compilers.
  1102. Use --with-build-cc to specify the native compiler.])
  1103. fi
  1104. else
  1105. : ${BUILD_CC:='${CC}'}
  1106. : ${BUILD_CPP:='${CPP}'}
  1107. : ${BUILD_CFLAGS:='${CFLAGS}'}
  1108. : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
  1109. : ${BUILD_LDFLAGS:='${LDFLAGS}'}
  1110. : ${BUILD_LIBS:='${LIBS}'}
  1111. : ${BUILD_EXEEXT:='$x'}
  1112. : ${BUILD_OBJEXT:='o'}
  1113. fi
  1114. AC_SUBST(BUILD_CC)
  1115. AC_SUBST(BUILD_CPP)
  1116. AC_SUBST(BUILD_CFLAGS)
  1117. AC_SUBST(BUILD_CPPFLAGS)
  1118. AC_SUBST(BUILD_LDFLAGS)
  1119. AC_SUBST(BUILD_LIBS)
  1120. AC_SUBST(BUILD_EXEEXT)
  1121. AC_SUBST(BUILD_OBJEXT)
  1122. ])dnl
  1123. dnl ---------------------------------------------------------------------------
  1124. dnl CF_BUNDLED_INTL version: 17 updated: 2012/10/06 08:57:51
  1125. dnl ---------------
  1126. dnl Top-level macro for configuring an application with a bundled copy of
  1127. dnl the intl and po directories for gettext.
  1128. dnl
  1129. dnl $1 specifies either Makefile or makefile, defaulting to the former.
  1130. dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
  1131. dnl
  1132. dnl Sets variables which can be used to substitute in makefiles:
  1133. dnl GT_YES - "#" comment unless building intl library, otherwise empty
  1134. dnl GT_NO - "#" comment if building intl library, otherwise empty
  1135. dnl INTLDIR_MAKE - to make ./intl directory
  1136. dnl MSG_DIR_MAKE - to make ./po directory
  1137. dnl SUB_MAKEFILE - list of makefiles in ./intl, ./po directories
  1138. dnl
  1139. dnl Defines:
  1140. dnl HAVE_LIBGETTEXT_H if we're using ./intl
  1141. dnl NLS_TEXTDOMAIN
  1142. dnl
  1143. dnl Environment:
  1144. dnl ALL_LINGUAS if set, lists the root names of the ".po" files.
  1145. dnl CONFIG_H assumed to be "config.h"
  1146. dnl PACKAGE must be set, used as default for textdomain
  1147. dnl VERSION may be set, otherwise extract from "VERSION" file.
  1148. dnl
  1149. AC_DEFUN([CF_BUNDLED_INTL],[
  1150. cf_makefile=ifelse($1,,Makefile,$1)
  1151. dnl Set of available languages (based on source distribution). Note that
  1152. dnl setting $LINGUAS overrides $ALL_LINGUAS. Some environments set $LINGUAS
  1153. dnl rather than $LC_ALL
  1154. test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
  1155. # Allow override of "config.h" definition:
  1156. : ${CONFIG_H:=config.h}
  1157. AC_SUBST(CONFIG_H)
  1158. if test -z "$PACKAGE" ; then
  1159. AC_MSG_ERROR([[CF_BUNDLED_INTL] used without setting [PACKAGE] variable])
  1160. fi
  1161. if test -z "$VERSION" ; then
  1162. if test -f $srcdir/VERSION ; then
  1163. VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
  1164. else
  1165. VERSION=unknown
  1166. fi
  1167. fi
  1168. AC_SUBST(VERSION)
  1169. AM_GNU_GETTEXT(,,,[$2])
  1170. if test "$USE_NLS" = yes ; then
  1171. AC_ARG_WITH(textdomain,
  1172. [ --with-textdomain=PKG NLS text-domain (default is package name)],
  1173. [NLS_TEXTDOMAIN=$withval],
  1174. [NLS_TEXTDOMAIN=$PACKAGE])
  1175. AC_DEFINE_UNQUOTED(NLS_TEXTDOMAIN,"$NLS_TEXTDOMAIN",[Define to the nls textdomain value])
  1176. AC_SUBST(NLS_TEXTDOMAIN)
  1177. fi
  1178. INTLDIR_MAKE=
  1179. MSG_DIR_MAKE=
  1180. SUB_MAKEFILE=
  1181. dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
  1182. CF_OUR_MESSAGES($1)
  1183. if test "$USE_INCLUDED_LIBINTL" = yes ; then
  1184. if test "$nls_cv_force_use_gnu_gettext" = yes ; then
  1185. :
  1186. elif test "$nls_cv_use_gnu_gettext" = yes ; then
  1187. :
  1188. else
  1189. INTLDIR_MAKE="#"
  1190. fi
  1191. if test -z "$INTLDIR_MAKE"; then
  1192. AC_DEFINE(HAVE_LIBGETTEXT_H,1,[Define to 1 if we have libgettext.h])
  1193. for cf_makefile in \
  1194. $srcdir/intl/Makefile.in \
  1195. $srcdir/intl/makefile.in
  1196. do
  1197. if test -f "$cf_makefile" ; then
  1198. SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
  1199. break
  1200. fi
  1201. done
  1202. fi
  1203. else
  1204. INTLDIR_MAKE="#"
  1205. if test "$USE_NLS" = yes ; then
  1206. AC_CHECK_HEADERS(libintl.h)
  1207. fi
  1208. fi
  1209. if test -z "$INTLDIR_MAKE" ; then
  1210. CPPFLAGS="$CPPFLAGS -I../intl"
  1211. fi
  1212. dnl FIXME: we use this in lynx (the alternative is a spurious dependency upon
  1213. dnl GNU make)
  1214. if test "$BUILD_INCLUDED_LIBINTL" = yes ; then
  1215. GT_YES="#"
  1216. GT_NO=
  1217. else
  1218. GT_YES=
  1219. GT_NO="#"
  1220. fi
  1221. AC_SUBST(INTLDIR_MAKE)
  1222. AC_SUBST(MSG_DIR_MAKE)
  1223. AC_SUBST(GT_YES)
  1224. AC_SUBST(GT_NO)
  1225. dnl FIXME: the underlying AM_GNU_GETTEXT macro either needs some fixes or a
  1226. dnl little documentation. It doesn't define anything so that we can ifdef our
  1227. dnl own code, except ENABLE_NLS, which is too vague to be of any use.
  1228. if test "$USE_INCLUDED_LIBINTL" = yes ; then
  1229. if test "$nls_cv_force_use_gnu_gettext" = yes ; then
  1230. AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
  1231. elif test "$nls_cv_use_gnu_gettext" = yes ; then
  1232. AC_DEFINE(HAVE_GETTEXT,1,[Define to 1 if we have gettext function])
  1233. fi
  1234. if test -n "$nls_cv_header_intl" ; then
  1235. AC_DEFINE(HAVE_LIBINTL_H,1,[Define to 1 if we have header-file for libintl])
  1236. fi
  1237. fi
  1238. ])dnl
  1239. dnl ---------------------------------------------------------------------------
  1240. dnl CF_CC_ENV_FLAGS version: 1 updated: 2012/10/03 05:25:49
  1241. dnl ---------------
  1242. dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content
  1243. dnl into CC. This will not help with broken scripts that wrap the compiler with
  1244. dnl options, but eliminates a more common category of user confusion.
  1245. AC_DEFUN([CF_CC_ENV_FLAGS],
  1246. [
  1247. # This should have been defined by AC_PROG_CC
  1248. : ${CC:=cc}
  1249. AC_MSG_CHECKING(\$CC variable)
  1250. case "$CC" in #(vi
  1251. *[[\ \ ]]-[[IUD]]*)
  1252. AC_MSG_RESULT(broken)
  1253. AC_MSG_WARN(your environment misuses the CC variable to hold CFLAGS/CPPFLAGS options)
  1254. # humor him...
  1255. cf_flags=`echo "$CC" | sed -e 's/^[[^ ]]*[[ ]]//'`
  1256. CC=`echo "$CC" | sed -e 's/[[ ]].*//'`
  1257. CF_ADD_CFLAGS($cf_flags)
  1258. ;;
  1259. *)
  1260. AC_MSG_RESULT(ok)
  1261. ;;
  1262. esac
  1263. ])dnl
  1264. dnl ---------------------------------------------------------------------------
  1265. dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03
  1266. dnl --------------
  1267. dnl Check if we're accidentally using a cache from a different machine.
  1268. dnl Derive the system name, as a check for reusing the autoconf cache.
  1269. dnl
  1270. dnl If we've packaged config.guess and config.sub, run that (since it does a
  1271. dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
  1272. dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
  1273. dnl which is useful in cross-compiles.
  1274. dnl
  1275. dnl Note: we would use $ac_config_sub, but that is one of the places where
  1276. dnl autoconf 2.5x broke compatibility with autoconf 2.13
  1277. AC_DEFUN([CF_CHECK_CACHE],
  1278. [
  1279. if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
  1280. ifelse([$1],,[AC_CANONICAL_HOST],[$1])
  1281. system_name="$host_os"
  1282. else
  1283. system_name="`(uname -s -r) 2>/dev/null`"
  1284. if test -z "$system_name" ; then
  1285. system_name="`(hostname) 2>/dev/null`"
  1286. fi
  1287. fi
  1288. test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name",[Define to the system name.])
  1289. AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
  1290. test -z "$system_name" && system_name="$cf_cv_system_name"
  1291. test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
  1292. if test ".$system_name" != ".$cf_cv_system_name" ; then
  1293. AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
  1294. AC_MSG_ERROR("Please remove config.cache and try again.")
  1295. fi
  1296. ])dnl
  1297. dnl ---------------------------------------------------------------------------
  1298. dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
  1299. dnl ---------------
  1300. dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
  1301. dnl a build-configuration such as imake. These have the pitfall that they
  1302. dnl often contain compiler-specific options which we cannot use, mixed with
  1303. dnl preprocessor options that we usually can.
  1304. AC_DEFUN([CF_CHECK_CFLAGS],
  1305. [
  1306. CF_VERBOSE(checking additions to CFLAGS)
  1307. cf_check_cflags="$CFLAGS"
  1308. cf_check_cppflags="$CPPFLAGS"
  1309. CF_ADD_CFLAGS($1,yes)
  1310. if test "$cf_check_cflags" != "$CFLAGS" ; then
  1311. AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
  1312. [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
  1313. if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
  1314. CF_VERBOSE(but keeping change to \$CPPFLAGS)
  1315. fi
  1316. CFLAGS="$cf_check_flags"])
  1317. fi
  1318. ])dnl
  1319. dnl ---------------------------------------------------------------------------
  1320. dnl CF_CHECK_ERRNO version: 11 updated: 2010/05/26 05:38:42
  1321. dnl --------------
  1322. dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
  1323. dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
  1324. dnl ourselves.
  1325. dnl
  1326. dnl $1 = the name to check
  1327. dnl $2 = the assumed type
  1328. AC_DEFUN([CF_CHECK_ERRNO],
  1329. [
  1330. AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
  1331. AC_TRY_COMPILE([
  1332. #ifdef HAVE_STDLIB_H
  1333. #include <stdlib.h>
  1334. #endif
  1335. #include <stdio.h>
  1336. #include <sys/types.h>
  1337. #include <errno.h> ],
  1338. ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1,
  1339. [cf_cv_dcl_$1=yes],
  1340. [cf_cv_dcl_$1=no])
  1341. ])
  1342. if test "$cf_cv_dcl_$1" = no ; then
  1343. CF_UPPER(cf_result,decl_$1)
  1344. AC_DEFINE_UNQUOTED($cf_result)
  1345. fi
  1346. # It's possible (for near-UNIX clones) that the data doesn't exist
  1347. CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2]))
  1348. ])dnl
  1349. dnl ---------------------------------------------------------------------------
  1350. dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
  1351. dnl --------------------
  1352. dnl Check for existence of external data in the current set of libraries. If
  1353. dnl we can modify it, it's real enough.
  1354. dnl $1 = the name to check
  1355. dnl $2 = its type
  1356. AC_DEFUN([CF_CHECK_EXTERN_DATA],
  1357. [
  1358. AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
  1359. AC_TRY_LINK([
  1360. #undef $1
  1361. extern $2 $1;
  1362. ],
  1363. [$1 = 2],
  1364. [cf_cv_have_$1=yes],
  1365. [cf_cv_have_$1=no])
  1366. ])
  1367. if test "$cf_cv_have_$1" = yes ; then
  1368. CF_UPPER(cf_result,have_$1)
  1369. AC_DEFINE_UNQUOTED($cf_result)
  1370. fi
  1371. ])dnl
  1372. dnl ---------------------------------------------------------------------------
  1373. dnl CF_CHECK_FUNCDECL version: 7 updated: 2009/10/15 19:39:18
  1374. dnl -----------------
  1375. dnl Check if a function is declared by including a set of include files.
  1376. dnl Invoke the corresponding actions according to whether it is found or not.
  1377. dnl
  1378. dnl Gcc (unlike other compilers) will only warn about the miscast assignment
  1379. dnl in the first test, but most compilers will oblige with an error in the
  1380. dnl second test.
  1381. dnl
  1382. dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  1383. AC_DEFUN([CF_CHECK_FUNCDECL],
  1384. [
  1385. AC_MSG_CHECKING([for $2 declaration])
  1386. AC_CACHE_VAL(ac_cv_func_decl_$2,
  1387. [AC_TRY_COMPILE([$1],
  1388. [#ifndef $2
  1389. extern int $2();
  1390. #endif],[
  1391. AC_TRY_COMPILE([$1],
  1392. [#ifndef $2
  1393. int (*p)() = $2;
  1394. #endif],[
  1395. eval "ac_cv_func_decl_$2=yes"],[
  1396. eval "ac_cv_func_decl_$2=no"])],[
  1397. eval "ac_cv_func_decl_$2=yes"])])
  1398. if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
  1399. AC_MSG_RESULT(yes)
  1400. ifelse([$3], , :, [$3])
  1401. else
  1402. AC_MSG_RESULT(no)
  1403. ifelse([$4], , , [$4
  1404. ])dnl
  1405. fi
  1406. ])dnl
  1407. dnl ---------------------------------------------------------------------------
  1408. dnl CF_CHECK_FUNCDECLS version: 4 updated: 1999/03/30 12:24:31
  1409. dnl ------------------
  1410. dnl Check if functions are declared by including a set of include files.
  1411. dnl and define DECL_XXX if not.
  1412. dnl
  1413. dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  1414. AC_DEFUN([CF_CHECK_FUNCDECLS],
  1415. [for ac_func in $2
  1416. do
  1417. CF_CHECK_FUNCDECL([$1], $ac_func,
  1418. [$3],
  1419. [
  1420. CF_UPPER(ac_tr_func,DECL_$ac_func)
  1421. AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
  1422. done
  1423. ])dnl
  1424. dnl ---------------------------------------------------------------------------
  1425. dnl CF_CHECK_IPV6 version: 3 updated: 2004/01/22 17:38:22
  1426. dnl -------------
  1427. dnl Check for IPV6 configuration.
  1428. AC_DEFUN([CF_CHECK_IPV6],[
  1429. CF_FIND_IPV6_TYPE
  1430. CF_FIND_IPV6_LIBS
  1431. CF_FUNC_GETADDRINFO
  1432. if test "$cf_cv_getaddrinfo" != "yes"; then
  1433. if test "$cf_cv_ipv6type" != "linux"; then
  1434. AC_MSG_WARN(
  1435. [You must get working getaddrinfo() function,
  1436. or you can specify "--disable-ipv6"])
  1437. else
  1438. AC_MSG_WARN(
  1439. [The getaddrinfo() implementation on your system seems be buggy.
  1440. You should upgrade your system library to the newest version
  1441. of GNU C library (aka glibc).])
  1442. fi
  1443. fi
  1444. ])dnl
  1445. dnl ---------------------------------------------------------------------------
  1446. dnl CF_CHECK_SIZEOF version: 1 updated: 2012/08/10 11:32:08
  1447. dnl ---------------
  1448. dnl Improve on AC_CHECK_SIZEOF for cases when the build-environment is
  1449. dnl deficient, e.g., if someone tries to build in busybox. Use the second
  1450. dnl parameter as the fallback value.
  1451. dnl
  1452. dnl By the way, 2.13/2.52 differ in AC_CHECK_SIZEOF regarding the types they
  1453. dnl can detect; the former includes only stdio.h for types while the latter
  1454. dnl includes several header files.
  1455. AC_DEFUN([CF_CHECK_SIZEOF],[
  1456. AC_CHECK_SIZEOF([$1],[$2])
  1457. if test "${ac_cv_type_$1:+set}" = set; then
  1458. if test "${ac_cv_sizeof_$1:+set}" != set; then
  1459. AC_MSG_WARN(using $2 for sizeof $1)
  1460. ac_cv_sizeof_$1=$2
  1461. elif test "x${ac_cv_sizeof_$1}" = x0; then
  1462. AC_MSG_WARN([sizeof $1 not found, using $2])
  1463. ac_cv_sizeof_$1=$2
  1464. fi
  1465. fi
  1466. ])dnl
  1467. dnl ---------------------------------------------------------------------------
  1468. dnl CF_CHECK_SSL_X509 version: 4 updated: 2008/12/11 19:00:39
  1469. dnl -----------------
  1470. dnl Check for X509 support in the SSL library.
  1471. define([CF_CHECK_SSL_X509],[
  1472. AC_MSG_CHECKING(for X509 support)
  1473. AC_TRY_LINK(CF__SSL_HEAD [
  1474. #include <openssl/x509.h>],
  1475. [X509_verify_cert_error_string(X509_STORE_CTX_get_error(NULL))],
  1476. [cf_x509_support=yes],
  1477. [cf_x509_support=no])
  1478. AC_MSG_RESULT($cf_x509_support)
  1479. if test "$cf_x509_support" = yes ; then
  1480. AC_DEFINE(USE_X509_SUPPORT)
  1481. fi
  1482. ])dnl
  1483. dnl ---------------------------------------------------------------------------
  1484. dnl CF_CHECK_TYPE version: 3 updated: 2012/10/04 05:24:07
  1485. dnl -------------
  1486. dnl Add a 3rd parameter to AC_CHECK_TYPE, working around autoconf 2.5x's
  1487. dnl deliberate incompatibility.
  1488. dnl $1 = name of type to check for
  1489. dnl $2 = default type
  1490. dnl $3 = additional #include's and related preprocessor lines.
  1491. ifdef([m4_HAS_AC_CT_FOURARGS], [m4_undefine([m4_HAS_AC_CT_FOURARGS])])dnl
  1492. ifelse(m4_PACKAGE_VERSION, [fnord_acsalt], [],
  1493. [ifdef([m4_version_compare],[m4_define([m4_HAS_AC_CT_FOURARGS])])])dnl
  1494. AC_DEFUN([CF_CHECK_TYPE],
  1495. [
  1496. ifdef([m4_HAS_AC_CT_FOURARGS],[
  1497. AC_CHECK_TYPE([$1],ac_cv_type_$1=yes,ac_cv_type_$1=no,[$3])
  1498. ],[
  1499. AC_MSG_CHECKING(for $1)
  1500. AC_TRY_COMPILE([
  1501. #if STDC_HEADERS
  1502. #include <stdlib.h>
  1503. #include <stddef.h>
  1504. #endif
  1505. $3
  1506. ],[
  1507. static $1 dummy; if (sizeof(dummy)) return 0; else return 1;],
  1508. ac_cv_type_$1=yes,
  1509. ac_cv_type_$1=no)
  1510. AC_MSG_RESULT($ac_cv_type_$1)
  1511. ])dnl
  1512. if test $ac_cv_type_$1 = no; then
  1513. AC_DEFINE($1, $2, Define to $2 if $1 is not declared)
  1514. fi
  1515. ])dnl
  1516. dnl ---------------------------------------------------------------------------
  1517. dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35
  1518. dnl -----------------
  1519. dnl Check if the given compiler is really clang. clang's C driver defines
  1520. dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does
  1521. dnl not ignore some gcc options.
  1522. dnl
  1523. dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
  1524. dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
  1525. dnl the wrappers for gcc and g++ warnings.
  1526. dnl
  1527. dnl $1 = GCC (default) or GXX
  1528. dnl $2 = CLANG_COMPILER (default)
  1529. dnl $3 = CFLAGS (default) or CXXFLAGS
  1530. AC_DEFUN([CF_CLANG_COMPILER],[
  1531. ifelse([$2],,CLANG_COMPILER,[$2])=no
  1532. if test "$ifelse([$1],,[$1],GCC)" = yes ; then
  1533. AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler)
  1534. cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
  1535. ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments"
  1536. AC_TRY_COMPILE([],[
  1537. #ifdef __clang__
  1538. #else
  1539. make an error
  1540. #endif
  1541. ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes
  1542. cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments"
  1543. ],[])
  1544. ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
  1545. AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2]))
  1546. fi
  1547. ])
  1548. dnl ---------------------------------------------------------------------------
  1549. dnl CF_COLOR_CURSES version: 8 updated: 2012/11/08 20:57:52
  1550. dnl ---------------
  1551. dnl Check if curses supports color. (Note that while SVr3 curses supports
  1552. dnl color, it does this differently from SVr4 curses; more work would be needed
  1553. dnl to accommodate SVr3).
  1554. dnl
  1555. AC_DEFUN([CF_COLOR_CURSES],
  1556. [
  1557. AC_MSG_CHECKING(if curses supports color attributes)
  1558. AC_CACHE_VAL(cf_cv_color_curses,[
  1559. AC_TRY_LINK([
  1560. #include <${cf_cv_ncurses_header:-curses.h}>
  1561. ],
  1562. [chtype x = COLOR_BLUE;
  1563. has_colors();
  1564. start_color();
  1565. #ifndef NCURSES_BROKEN
  1566. wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
  1567. #endif
  1568. ],
  1569. [cf_cv_color_curses=yes],
  1570. [cf_cv_color_curses=no])
  1571. ])
  1572. AC_MSG_RESULT($cf_cv_color_curses)
  1573. if test $cf_cv_color_curses = yes ; then
  1574. AC_DEFINE(COLOR_CURSES,1,[Define to 1 if if curses supports color attributes])
  1575. test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD,1,[Define to 1 if curses has getbkgd function])
  1576. fi
  1577. ])dnl
  1578. dnl ---------------------------------------------------------------------------
  1579. dnl CF_CURSES_CHTYPE version: 8 updated: 2012/10/06 08:57:51
  1580. dnl ----------------
  1581. dnl Test if curses defines 'chtype' (usually a 'long' type for SysV curses).
  1582. AC_DEFUN([CF_CURSES_CHTYPE],
  1583. [
  1584. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1585. AC_CACHE_CHECK(for chtype typedef,cf_cv_chtype_decl,[
  1586. AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
  1587. [chtype foo],
  1588. [cf_cv_chtype_decl=yes],
  1589. [cf_cv_chtype_decl=no])])
  1590. if test $cf_cv_chtype_decl = yes ; then
  1591. AC_DEFINE(HAVE_TYPE_CHTYPE,1,[Define to 1 if chtype is declared])
  1592. AC_CACHE_CHECK(if chtype is scalar or struct,cf_cv_chtype_type,[
  1593. AC_TRY_COMPILE([#include <${cf_cv_ncurses_header:-curses.h}>],
  1594. [chtype foo; long x = foo],
  1595. [cf_cv_chtype_type=scalar],
  1596. [cf_cv_chtype_type=struct])])
  1597. if test $cf_cv_chtype_type = scalar ; then
  1598. AC_DEFINE(TYPE_CHTYPE_IS_SCALAR,1,[Define to 1 if chtype is a scaler/integer])
  1599. fi
  1600. fi
  1601. ])dnl
  1602. dnl ---------------------------------------------------------------------------
  1603. dnl CF_CURSES_CONFIG version: 2 updated: 2006/10/29 11:06:27
  1604. dnl ----------------
  1605. dnl Tie together the configure-script macros for curses. It may be ncurses,
  1606. dnl but unless asked, we do not make a special search for ncurses. However,
  1607. dnl still check for the ncurses version number, for use in other macros.
  1608. AC_DEFUN([CF_CURSES_CONFIG],
  1609. [
  1610. CF_CURSES_CPPFLAGS
  1611. CF_NCURSES_VERSION
  1612. CF_CURSES_LIBS
  1613. ])dnl
  1614. dnl ---------------------------------------------------------------------------
  1615. dnl CF_CURSES_CPPFLAGS version: 11 updated: 2011/04/09 14:51:08
  1616. dnl ------------------
  1617. dnl Look for the curses headers.
  1618. AC_DEFUN([CF_CURSES_CPPFLAGS],[
  1619. AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
  1620. cf_cv_curses_incdir=no
  1621. case $host_os in #(vi
  1622. hpux10.*) #(vi
  1623. if test "x$cf_cv_screen" = "xcurses_colr"
  1624. then
  1625. test -d /usr/include/curses_colr && \
  1626. cf_cv_curses_incdir="-I/usr/include/curses_colr"
  1627. fi
  1628. ;;
  1629. sunos3*|sunos4*)
  1630. if test "x$cf_cv_screen" = "xcurses_5lib"
  1631. then
  1632. test -d /usr/5lib && \
  1633. test -d /usr/5include && \
  1634. cf_cv_curses_incdir="-I/usr/5include"
  1635. fi
  1636. ;;
  1637. esac
  1638. ])
  1639. test "$cf_cv_curses_incdir" != no && CPPFLAGS="$CPPFLAGS $cf_cv_curses_incdir"
  1640. CF_CURSES_HEADER
  1641. CF_TERM_HEADER
  1642. ])dnl
  1643. dnl ---------------------------------------------------------------------------
  1644. dnl CF_CURSES_FUNCS version: 17 updated: 2011/05/14 16:07:29
  1645. dnl ---------------
  1646. dnl Curses-functions are a little complicated, since a lot of them are macros.
  1647. AC_DEFUN([CF_CURSES_FUNCS],
  1648. [
  1649. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1650. AC_REQUIRE([CF_XOPEN_CURSES])
  1651. AC_REQUIRE([CF_CURSES_TERM_H])
  1652. AC_REQUIRE([CF_CURSES_UNCTRL_H])
  1653. for cf_func in $1
  1654. do
  1655. CF_UPPER(cf_tr_func,$cf_func)
  1656. AC_MSG_CHECKING(for ${cf_func})
  1657. CF_MSG_LOG(${cf_func})
  1658. AC_CACHE_VAL(cf_cv_func_$cf_func,[
  1659. eval cf_result='$ac_cv_func_'$cf_func
  1660. if test ".$cf_result" != ".no"; then
  1661. AC_TRY_LINK(CF__CURSES_HEAD,
  1662. [
  1663. #ifndef ${cf_func}
  1664. long foo = (long)(&${cf_func});
  1665. if (foo + 1234 > 5678)
  1666. ${cf_cv_main_return:-return}(foo);
  1667. #endif
  1668. ],
  1669. [cf_result=yes],
  1670. [cf_result=no])
  1671. fi
  1672. eval 'cf_cv_func_'$cf_func'=$cf_result'
  1673. ])
  1674. # use the computed/retrieved cache-value:
  1675. eval 'cf_result=$cf_cv_func_'$cf_func
  1676. AC_MSG_RESULT($cf_result)
  1677. if test $cf_result != no; then
  1678. AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
  1679. fi
  1680. done
  1681. ])dnl
  1682. dnl ---------------------------------------------------------------------------
  1683. dnl CF_CURSES_HEADER version: 3 updated: 2011/05/01 19:47:45
  1684. dnl ----------------
  1685. dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
  1686. dnl variations of ncurses' installs.
  1687. dnl
  1688. dnl $1 = ncurses when looking for ncurses, or is empty
  1689. AC_DEFUN([CF_CURSES_HEADER],[
  1690. AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
  1691. cf_cv_ncurses_header=none
  1692. for cf_header in ifelse($1,,,[ \
  1693. $1/ncurses.h \
  1694. $1/curses.h]) \
  1695. ncurses.h \
  1696. curses.h ifelse($1,,[ncurses/ncurses.h ncurses/curses.h])
  1697. do
  1698. AC_TRY_COMPILE([#include <${cf_header}>],
  1699. [initscr(); tgoto("?", 0,0)],
  1700. [cf_cv_ncurses_header=$cf_header; break],[])
  1701. done
  1702. ])
  1703. if test "$cf_cv_ncurses_header" = none ; then
  1704. AC_MSG_ERROR(No curses header-files found)
  1705. fi
  1706. # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
  1707. AC_CHECK_HEADERS($cf_cv_ncurses_header)
  1708. ])dnl
  1709. dnl ---------------------------------------------------------------------------
  1710. dnl CF_CURSES_LIBS version: 37 updated: 2013/02/09 17:33:50
  1711. dnl --------------
  1712. dnl Look for the curses libraries. Older curses implementations may require
  1713. dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
  1714. AC_DEFUN([CF_CURSES_LIBS],[
  1715. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1716. AC_MSG_CHECKING(if we have identified curses libraries)
  1717. AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
  1718. [initscr(); tgoto("?", 0,0)],
  1719. cf_result=yes,
  1720. cf_result=no)
  1721. AC_MSG_RESULT($cf_result)
  1722. if test "$cf_result" = no ; then
  1723. case $host_os in #(vi
  1724. freebsd*) #(vi
  1725. AC_CHECK_LIB(mytinfo,tgoto,[CF_ADD_LIBS(-lmytinfo)])
  1726. ;;
  1727. hpux10.*) #(vi
  1728. # Looking at HPUX 10.20, the Hcurses library is the oldest (1997), cur_colr
  1729. # next (1998), and xcurses "newer" (2000). There is no header file for
  1730. # Hcurses; the subdirectory curses_colr has the headers (curses.h and
  1731. # term.h) for cur_colr
  1732. if test "x$cf_cv_screen" = "xcurses_colr"
  1733. then
  1734. AC_CHECK_LIB(cur_colr,initscr,[
  1735. CF_ADD_LIBS(-lcur_colr)
  1736. ac_cv_func_initscr=yes
  1737. ],[
  1738. AC_CHECK_LIB(Hcurses,initscr,[
  1739. # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
  1740. CF_ADD_LIBS(-lHcurses)
  1741. CPPFLAGS="$CPPFLAGS -D__HP_CURSES -D_HP_CURSES"
  1742. ac_cv_func_initscr=yes
  1743. ])])
  1744. fi
  1745. ;;
  1746. linux*)
  1747. case `arch 2>/dev/null` in
  1748. x86_64)
  1749. if test -d /lib64
  1750. then
  1751. CF_ADD_LIBDIR(/lib64)
  1752. else
  1753. CF_ADD_LIBDIR(/lib)
  1754. fi
  1755. ;;
  1756. *)
  1757. CF_ADD_LIBDIR(/lib)
  1758. ;;
  1759. esac
  1760. ;;
  1761. sunos3*|sunos4*)
  1762. if test "x$cf_cv_screen" = "xcurses_5lib"
  1763. then
  1764. if test -d /usr/5lib ; then
  1765. CF_ADD_LIBDIR(/usr/5lib)
  1766. CF_ADD_LIBS(-lcurses -ltermcap)
  1767. fi
  1768. fi
  1769. ac_cv_func_initscr=yes
  1770. ;;
  1771. esac
  1772. if test ".$ac_cv_func_initscr" != .yes ; then
  1773. cf_save_LIBS="$LIBS"
  1774. if test ".${cf_cv_ncurses_version:-no}" != .no
  1775. then
  1776. cf_check_list="ncurses curses cursesX"
  1777. else
  1778. cf_check_list="cursesX curses ncurses"
  1779. fi
  1780. # Check for library containing tgoto. Do this before curses library
  1781. # because it may be needed to link the test-case for initscr.
  1782. if test "x$cf_term_lib" = x
  1783. then
  1784. AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
  1785. for cf_term_lib in $cf_check_list otermcap termcap tinfo termlib unknown
  1786. do
  1787. AC_CHECK_LIB($cf_term_lib,tgoto,[break])
  1788. done
  1789. ])
  1790. fi
  1791. # Check for library containing initscr
  1792. test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
  1793. if test "x$cf_curs_lib" = x
  1794. then
  1795. for cf_curs_lib in $cf_check_list xcurses jcurses pdcurses unknown
  1796. do
  1797. AC_CHECK_LIB($cf_curs_lib,initscr,[break])
  1798. done
  1799. fi
  1800. test $cf_curs_lib = unknown && AC_MSG_ERROR(no curses library found)
  1801. LIBS="-l$cf_curs_lib $cf_save_LIBS"
  1802. if test "$cf_term_lib" = unknown ; then
  1803. AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
  1804. AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
  1805. [initscr()],
  1806. [cf_result=yes],
  1807. [cf_result=no])
  1808. AC_MSG_RESULT($cf_result)
  1809. test $cf_result = no && AC_MSG_ERROR(Cannot link curses library)
  1810. elif test "$cf_curs_lib" = "$cf_term_lib" ; then
  1811. :
  1812. elif test "$cf_term_lib" != predefined ; then
  1813. AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
  1814. AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
  1815. [initscr(); tgoto((char *)0, 0, 0);],
  1816. [cf_result=no],
  1817. [
  1818. LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
  1819. AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
  1820. [initscr()],
  1821. [cf_result=yes],
  1822. [cf_result=error])
  1823. ])
  1824. AC_MSG_RESULT($cf_result)
  1825. fi
  1826. fi
  1827. fi
  1828. ])dnl
  1829. dnl ---------------------------------------------------------------------------
  1830. dnl CF_CURSES_TERM_H version: 10 updated: 2012/10/06 08:57:51
  1831. dnl ----------------
  1832. dnl SVr4 curses should have term.h as well (where it puts the definitions of
  1833. dnl the low-level interface). This may not be true in old/broken implementations,
  1834. dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
  1835. dnl running with Solaris 2.5.1).
  1836. AC_DEFUN([CF_CURSES_TERM_H],
  1837. [
  1838. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1839. AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
  1840. # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
  1841. # for <term.h> if we do not find the variant.
  1842. cf_header_list="term.h ncurses/term.h ncursesw/term.h"
  1843. case ${cf_cv_ncurses_header:-curses.h} in #(vi
  1844. */*)
  1845. cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`term.h
  1846. cf_header_list="$cf_header_item $cf_header_list"
  1847. ;;
  1848. esac
  1849. for cf_header in $cf_header_list
  1850. do
  1851. AC_TRY_COMPILE([
  1852. #include <${cf_cv_ncurses_header:-curses.h}>
  1853. #include <${cf_header}>],
  1854. [WINDOW *x],
  1855. [cf_cv_term_header=$cf_header
  1856. break],
  1857. [cf_cv_term_header=no])
  1858. done
  1859. case $cf_cv_term_header in #(vi
  1860. no)
  1861. # If curses is ncurses, some packagers still mess it up by trying to make
  1862. # us use GNU termcap. This handles the most common case.
  1863. for cf_header in ncurses/term.h ncursesw/term.h
  1864. do
  1865. AC_TRY_COMPILE([
  1866. #include <${cf_cv_ncurses_header:-curses.h}>
  1867. #ifdef NCURSES_VERSION
  1868. #include <${cf_header}>
  1869. #else
  1870. make an error
  1871. #endif],
  1872. [WINDOW *x],
  1873. [cf_cv_term_header=$cf_header
  1874. break],
  1875. [cf_cv_term_header=no])
  1876. done
  1877. ;;
  1878. esac
  1879. ])
  1880. case $cf_cv_term_header in #(vi
  1881. term.h) #(vi
  1882. AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
  1883. ;;
  1884. ncurses/term.h) #(vi
  1885. AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
  1886. ;;
  1887. ncursesw/term.h)
  1888. AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
  1889. ;;
  1890. esac
  1891. ])dnl
  1892. dnl ---------------------------------------------------------------------------
  1893. dnl CF_CURSES_UNCTRL_H version: 3 updated: 2013/11/03 06:26:10
  1894. dnl ------------------
  1895. dnl Any X/Open curses implementation must have unctrl.h, but ncurses packages
  1896. dnl may put it in a subdirectory (along with ncurses' other headers, of
  1897. dnl course). Packages which put the headers in inconsistent locations are
  1898. dnl broken).
  1899. AC_DEFUN([CF_CURSES_UNCTRL_H],
  1900. [
  1901. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1902. AC_CACHE_CHECK(for unctrl.h, cf_cv_unctrl_header,[
  1903. # If we found <ncurses/curses.h>, look for <ncurses/unctrl.h>, but always look
  1904. # for <unctrl.h> if we do not find the variant.
  1905. cf_header_list="unctrl.h ncurses/unctrl.h ncursesw/unctrl.h"
  1906. case ${cf_cv_ncurses_header:-curses.h} in #(vi
  1907. */*)
  1908. cf_header_item=`echo ${cf_cv_ncurses_header:-curses.h} | sed -e 's%\..*%%' -e 's%/.*%/%'`unctrl.h
  1909. cf_header_list="$cf_header_item $cf_header_list"
  1910. ;;
  1911. esac
  1912. for cf_header in $cf_header_list
  1913. do
  1914. AC_TRY_COMPILE([
  1915. #include <${cf_cv_ncurses_header:-curses.h}>
  1916. #include <${cf_header}>],
  1917. [WINDOW *x],
  1918. [cf_cv_unctrl_header=$cf_header
  1919. break],
  1920. [cf_cv_unctrl_header=no])
  1921. done
  1922. ])
  1923. case $cf_cv_unctrl_header in #(vi
  1924. no)
  1925. AC_MSG_WARN(unctrl.h header not found)
  1926. ;;
  1927. esac
  1928. case $cf_cv_unctrl_header in #(vi
  1929. unctrl.h) #(vi
  1930. AC_DEFINE(HAVE_UNCTRL_H,1,[Define to 1 if we have unctrl.h])
  1931. ;;
  1932. ncurses/unctrl.h) #(vi
  1933. AC_DEFINE(HAVE_NCURSES_UNCTRL_H,1,[Define to 1 if we have ncurses/unctrl.h])
  1934. ;;
  1935. ncursesw/unctrl.h)
  1936. AC_DEFINE(HAVE_NCURSESW_UNCTRL_H,1,[Define to 1 if we have ncursesw/unctrl.h])
  1937. ;;
  1938. esac
  1939. ])dnl
  1940. dnl ---------------------------------------------------------------------------
  1941. dnl CF_CURS_PERFORMANCE version: 5 updated: 2012/11/08 20:57:52
  1942. dnl -------------------
  1943. dnl Solaris 2.x curses provides a "performance" tradeoff according to whether
  1944. dnl CURS_PERFORMANCE is defined. If defined, the implementation defines macros
  1945. dnl that access the WINDOW structure. Otherwise, function calls are used.
  1946. AC_DEFUN([CF_CURS_PERFORMANCE],
  1947. [
  1948. AC_MSG_CHECKING([for curses performance tradeoff])
  1949. AC_CACHE_VAL(cf_cv_curs_performance,[
  1950. cf_cv_curs_performance=no
  1951. AC_TRY_COMPILE([
  1952. #include <${cf_cv_ncurses_header:-curses.h}>],[
  1953. #if defined(wbkgdset) && defined(clearok) && defined(getbkgd)
  1954. int x = ERR;
  1955. #else
  1956. int x = ; /* force an error */
  1957. #endif
  1958. ],[
  1959. AC_TRY_COMPILE([
  1960. #define CURS_PERFORMANCE
  1961. #include <${cf_cv_ncurses_header:-curses.h}>],[
  1962. #if defined(wbkgdset) && defined(clearok) && defined(getbkgd)
  1963. int x = ; /* force an error */
  1964. #else
  1965. int x = ERR;
  1966. #endif
  1967. ],[cf_cv_curs_performance=yes])])])
  1968. AC_MSG_RESULT($cf_cv_curs_performance)
  1969. test $cf_cv_curs_performance = yes && AC_DEFINE(CURS_PERFORMANCE,1,[Define to 1 ifr curses performance tradeoff available])
  1970. ])dnl
  1971. dnl ---------------------------------------------------------------------------
  1972. dnl CF_CURS_TOUCHLINE version: 4 updated: 2012/11/08 20:57:52
  1973. dnl -----------------
  1974. dnl Check for the flavor of the touchline function, to distinguish between BSD
  1975. dnl and SYSV. This is needed on NetBSD 1.5 which has a partial implementation
  1976. dnl of SVR4 curses.
  1977. AC_DEFUN([CF_CURS_TOUCHLINE],[
  1978. AC_CACHE_CHECK(for curses touchline function,cf_cv_curs_touchline,[
  1979. AC_TRY_LINK([
  1980. #include <${cf_cv_ncurses_header:-curses.h}>],
  1981. [touchline(stdscr, 1,2,3);],
  1982. [cf_cv_curs_touchline=bsd],
  1983. [AC_TRY_LINK([
  1984. #include <${cf_cv_ncurses_header:-curses.h}>],
  1985. [touchline(stdscr, 1,2);],
  1986. [cf_cv_curs_touchline=sysv],
  1987. [cf_cv_curs_touchline=bsd])])])
  1988. case "$cf_cv_curs_touchline" in #(vi
  1989. bsd) #(vi
  1990. AC_DEFINE(HAVE_BSD_TOUCHLINE,1,[Define to 1 if curses has bsd-style touchline])
  1991. ;;
  1992. sysv)
  1993. AC_DEFINE(HAVE_SYSV_TOUCHLINE,1,[Define to 1 if curses has sysv-style touchline])
  1994. ;;
  1995. esac
  1996. ])dnl
  1997. dnl ---------------------------------------------------------------------------
  1998. dnl CF_DEFINE_PROG version: 4 updated: 2012/11/08 20:57:52
  1999. dnl --------------
  2000. dnl Check for a program in the given list $3, defining the corresponding
  2001. dnl program variable $2.
  2002. dnl
  2003. AC_DEFUN([CF_DEFINE_PROG],[
  2004. AC_MSG_CHECKING(for $1)
  2005. AC_CACHE_VAL(cf_cv_$2,[
  2006. cf_cv_$2=unknown
  2007. for cv_path in $3
  2008. do
  2009. if test -f $cv_path ; then
  2010. cf_cv_$2=$cv_path
  2011. break
  2012. fi
  2013. done
  2014. ])
  2015. AC_MSG_RESULT($cf_cv_$2)
  2016. AC_DEFINE_UNQUOTED($2,"$cf_cv_$2",[Define to program from list])
  2017. ])dnl
  2018. dnl ---------------------------------------------------------------------------
  2019. dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
  2020. dnl ----------
  2021. dnl "dirname" is not portable, so we fake it with a shell script.
  2022. AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
  2023. dnl ---------------------------------------------------------------------------
  2024. dnl CF_DISABLE_ECHO version: 12 updated: 2012/10/06 16:30:28
  2025. dnl ---------------
  2026. dnl You can always use "make -n" to see the actual options, but it's hard to
  2027. dnl pick out/analyze warning messages when the compile-line is long.
  2028. dnl
  2029. dnl Sets:
  2030. dnl ECHO_LT - symbol to control if libtool is verbose
  2031. dnl ECHO_LD - symbol to prefix "cc -o" lines
  2032. dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
  2033. dnl SHOW_CC - symbol to put before explicit "cc -c" lines
  2034. dnl ECHO_CC - symbol to put before any "cc" line
  2035. dnl
  2036. AC_DEFUN([CF_DISABLE_ECHO],[
  2037. AC_MSG_CHECKING(if you want to see long compiling messages)
  2038. CF_ARG_DISABLE(echo,
  2039. [ --disable-echo do not display "compiling" commands],
  2040. [
  2041. ECHO_LT='--silent'
  2042. ECHO_LD='@echo linking [$]@;'
  2043. RULE_CC='@echo compiling [$]<'
  2044. SHOW_CC='@echo compiling [$]@'
  2045. ECHO_CC='@'
  2046. ],[
  2047. ECHO_LT=''
  2048. ECHO_LD=''
  2049. RULE_CC=''
  2050. SHOW_CC=''
  2051. ECHO_CC=''
  2052. ])
  2053. AC_MSG_RESULT($enableval)
  2054. AC_SUBST(ECHO_LT)
  2055. AC_SUBST(ECHO_LD)
  2056. AC_SUBST(RULE_CC)
  2057. AC_SUBST(SHOW_CC)
  2058. AC_SUBST(ECHO_CC)
  2059. ])dnl
  2060. dnl ---------------------------------------------------------------------------
  2061. dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33
  2062. dnl ---------------------
  2063. dnl The rpath-hack makes it simpler to build programs, particularly with the
  2064. dnl *BSD ports which may have essential libraries in unusual places. But it
  2065. dnl can interfere with building an executable for the base system. Use this
  2066. dnl option in that case.
  2067. AC_DEFUN([CF_DISABLE_RPATH_HACK],
  2068. [
  2069. AC_MSG_CHECKING(if rpath-hack should be disabled)
  2070. CF_ARG_DISABLE(rpath-hack,
  2071. [ --disable-rpath-hack don't add rpath options for additional libraries],
  2072. [cf_disable_rpath_hack=yes],
  2073. [cf_disable_rpath_hack=no])
  2074. AC_MSG_RESULT($cf_disable_rpath_hack)
  2075. if test "$cf_disable_rpath_hack" = no ; then
  2076. CF_RPATH_HACK
  2077. fi
  2078. ])
  2079. dnl ---------------------------------------------------------------------------
  2080. dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
  2081. dnl --------
  2082. dnl Check if 'errno' is declared in <errno.h>
  2083. AC_DEFUN([CF_ERRNO],
  2084. [
  2085. CF_CHECK_ERRNO(errno)
  2086. ])dnl
  2087. dnl ---------------------------------------------------------------------------
  2088. dnl CF_FANCY_CURSES version: 6 updated: 2012/11/08 20:57:52
  2089. dnl ---------------
  2090. AC_DEFUN([CF_FANCY_CURSES],
  2091. [
  2092. AC_MSG_CHECKING(if curses supports fancy attributes)
  2093. AC_CACHE_VAL(cf_cv_fancy_curses,[
  2094. AC_TRY_LINK([
  2095. #include <${cf_cv_ncurses_header:-curses.h}>
  2096. ],
  2097. [attrset(A_UNDERLINE|A_BOLD|A_REVERSE);
  2098. wattrset(stdscr, A_BLINK|A_DIM);
  2099. attroff(A_BOLD);
  2100. keypad(stdscr,TRUE);
  2101. ],
  2102. [cf_cv_fancy_curses=yes],
  2103. [cf_cv_fancy_curses=no])
  2104. ])
  2105. AC_MSG_RESULT($cf_cv_fancy_curses)
  2106. test $cf_cv_fancy_curses = yes && AC_DEFINE(FANCY_CURSES,1,[Define to 1 if curses supports fancy attributes])
  2107. ])dnl
  2108. dnl ---------------------------------------------------------------------------
  2109. dnl CF_FIND_IPV6_LIBS version: 7 updated: 2007/07/29 13:35:20
  2110. dnl -----------------
  2111. dnl Based on the IPV6 stack type, look for the corresponding library.
  2112. AC_DEFUN([CF_FIND_IPV6_LIBS],[
  2113. AC_REQUIRE([CF_FIND_IPV6_TYPE])
  2114. cf_ipv6lib=none
  2115. cf_ipv6dir=none
  2116. AC_MSG_CHECKING(for IPv6 library if required)
  2117. case $cf_cv_ipv6type in #(vi
  2118. solaris) #(vi
  2119. ;;
  2120. inria) #(vi
  2121. ;;
  2122. kame) #(vi
  2123. dnl http://www.kame.net/
  2124. cf_ipv6lib=inet6
  2125. cf_ipv6dir=v6
  2126. ;;
  2127. linux-glibc) #(vi
  2128. ;;
  2129. linux-libinet6) #(vi
  2130. dnl http://www.v6.linux.or.jp/
  2131. cf_ipv6lib=inet6
  2132. cf_ipv6dir=inet6
  2133. ;;
  2134. toshiba) #(vi
  2135. cf_ipv6lib=inet6
  2136. cf_ipv6dir=v6
  2137. ;;
  2138. v6d) #(vi
  2139. cf_ipv6lib=v6
  2140. cf_ipv6dir=v6
  2141. ;;
  2142. zeta)
  2143. cf_ipv6lib=inet6
  2144. cf_ipv6dir=v6
  2145. ;;
  2146. esac
  2147. AC_MSG_RESULT($cf_ipv6lib)
  2148. if test "$cf_ipv6lib" != "none"; then
  2149. AC_TRY_LINK([
  2150. #include <sys/types.h>
  2151. #include <netdb.h>
  2152. #include <netinet/in.h>
  2153. #include <netinet/ip6.h>],
  2154. [getaddrinfo(0, 0, 0, 0)],,[
  2155. CF_HEADER_PATH(cf_search,$cf_ipv6dir)
  2156. for cf_incdir in $cf_search
  2157. do
  2158. cf_header=$cf_incdir/netinet/ip6.h
  2159. if test -f $cf_header
  2160. then
  2161. CF_ADD_INCDIR($cf_incdir)
  2162. test -n "$verbose" && echo " ... found $cf_header" 1>&AC_FD_MSG
  2163. break
  2164. fi
  2165. test -n "$verbose" && echo " ... tested $cf_header" 1>&AC_FD_MSG
  2166. done
  2167. ])
  2168. CF_FIND_LIBRARY([$cf_ipv6lib],[$cf_ipv6dir],[
  2169. #include <sys/types.h>
  2170. #include <netdb.h>
  2171. #include <netinet/in.h>
  2172. #include <netinet/ip6.h>],
  2173. [getaddrinfo(0, 0, 0, 0)],
  2174. [getaddrinfo],
  2175. noexit)
  2176. if test $cf_found_library = no ; then
  2177. AC_MSG_ERROR(
  2178. [No $cf_ipv6lib library found, cannot continue. You must fetch lib$cf_ipv6lib.a
  2179. from an appropriate IPv6 kit and compile beforehand.])
  2180. fi
  2181. fi
  2182. ])dnl
  2183. dnl ---------------------------------------------------------------------------
  2184. dnl CF_FIND_IPV6_TYPE version: 5 updated: 2001/10/11 20:46:17
  2185. dnl -----------------
  2186. AC_DEFUN([CF_FIND_IPV6_TYPE],[
  2187. AC_CACHE_CHECK(ipv6 stack type, cf_cv_ipv6type, [
  2188. cf_cv_ipv6type=unknown
  2189. for i in solaris inria kame linux-glibc linux-libinet6 toshiba v6d zeta
  2190. do
  2191. case $i in #(vi
  2192. solaris) #(vi
  2193. if test "SunOS" = "`uname -s`"
  2194. then
  2195. if test -f /usr/include/netinet/ip6.h
  2196. then
  2197. cf_cv_ipv6type=$i
  2198. fi
  2199. fi
  2200. ;;
  2201. inria) #(vi
  2202. dnl http://www.kame.net/
  2203. AC_EGREP_CPP(yes, [
  2204. #include <netinet/in.h>
  2205. #ifdef IPV6_INRIA_VERSION
  2206. yes
  2207. #endif], [cf_cv_ipv6type=$i])
  2208. ;;
  2209. kame) #(vi
  2210. dnl http://www.kame.net/
  2211. AC_EGREP_CPP(yes, [
  2212. #include <netinet/in.h>
  2213. #ifdef __KAME__
  2214. yes
  2215. #endif], [cf_cv_ipv6type=$i])
  2216. ;;
  2217. linux-glibc) #(vi
  2218. dnl http://www.v6.linux.or.jp/
  2219. AC_EGREP_CPP(yes, [
  2220. #include <features.h>
  2221. #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
  2222. yes
  2223. #endif], [cf_cv_ipv6type=$i])
  2224. ;;
  2225. linux-libinet6) #(vi
  2226. dnl http://www.v6.linux.or.jp/
  2227. if test -d /usr/inet6
  2228. then
  2229. cf_cv_ipv6type=$i
  2230. elif test -f /usr/include/netinet/ip6.h
  2231. then
  2232. cf_cv_ipv6type=$i
  2233. fi
  2234. ;;
  2235. toshiba) #(vi
  2236. AC_EGREP_CPP(yes, [
  2237. #include <sys/param.h>
  2238. #ifdef _TOSHIBA_INET6
  2239. yes
  2240. #endif], [cf_cv_ipv6type=$i])
  2241. ;;
  2242. v6d) #(vi
  2243. AC_EGREP_CPP(yes, [
  2244. #include </usr/local/v6/include/sys/v6config.h>
  2245. #ifdef __V6D__
  2246. yes
  2247. #endif], [cf_cv_ipv6type=$i])
  2248. ;;
  2249. zeta)
  2250. AC_EGREP_CPP(yes, [
  2251. #include <sys/param.h>
  2252. #ifdef _ZETA_MINAMI_INET6
  2253. yes
  2254. #endif], [cf_cv_ipv6type=$i])
  2255. ;;
  2256. esac
  2257. if test "$cf_cv_ipv6type" != "unknown"; then
  2258. break
  2259. fi
  2260. done
  2261. ])
  2262. ])dnl
  2263. dnl ---------------------------------------------------------------------------
  2264. dnl CF_FIND_LIBRARY version: 9 updated: 2008/03/23 14:48:54
  2265. dnl ---------------
  2266. dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
  2267. dnl prefer a standard location, and use -L options only if we do not find the
  2268. dnl library in the standard library location(s).
  2269. dnl $1 = library name
  2270. dnl $2 = library class, usually the same as library name
  2271. dnl $3 = includes
  2272. dnl $4 = code fragment to compile/link
  2273. dnl $5 = corresponding function-name
  2274. dnl $6 = flag, nonnull if failure should not cause an error-exit
  2275. dnl
  2276. dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
  2277. dnl to use a -L option.
  2278. AC_DEFUN([CF_FIND_LIBRARY],
  2279. [
  2280. eval 'cf_cv_have_lib_'$1'=no'
  2281. cf_libdir=""
  2282. AC_CHECK_FUNC($5,
  2283. eval 'cf_cv_have_lib_'$1'=yes',[
  2284. cf_save_LIBS="$LIBS"
  2285. AC_MSG_CHECKING(for $5 in -l$1)
  2286. LIBS="-l$1 $LIBS"
  2287. AC_TRY_LINK([$3],[$4],
  2288. [AC_MSG_RESULT(yes)
  2289. eval 'cf_cv_have_lib_'$1'=yes'
  2290. ],
  2291. [AC_MSG_RESULT(no)
  2292. CF_LIBRARY_PATH(cf_search,$2)
  2293. for cf_libdir in $cf_search
  2294. do
  2295. AC_MSG_CHECKING(for -l$1 in $cf_libdir)
  2296. LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
  2297. AC_TRY_LINK([$3],[$4],
  2298. [AC_MSG_RESULT(yes)
  2299. eval 'cf_cv_have_lib_'$1'=yes'
  2300. break],
  2301. [AC_MSG_RESULT(no)
  2302. LIBS="$cf_save_LIBS"])
  2303. done
  2304. ])
  2305. ])
  2306. eval 'cf_found_library=[$]cf_cv_have_lib_'$1
  2307. ifelse($6,,[
  2308. if test $cf_found_library = no ; then
  2309. AC_MSG_ERROR(Cannot link $1 library)
  2310. fi
  2311. ])
  2312. ])dnl
  2313. dnl ---------------------------------------------------------------------------
  2314. dnl CF_FIND_LINKAGE version: 19 updated: 2010/05/29 16:31:02
  2315. dnl ---------------
  2316. dnl Find a library (specifically the linkage used in the code fragment),
  2317. dnl searching for it if it is not already in the library path.
  2318. dnl See also CF_ADD_SEARCHPATH.
  2319. dnl
  2320. dnl Parameters (4-on are optional):
  2321. dnl $1 = headers for library entrypoint
  2322. dnl $2 = code fragment for library entrypoint
  2323. dnl $3 = the library name without the "-l" option or ".so" suffix.
  2324. dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
  2325. dnl $5 = action to perform if not successful
  2326. dnl $6 = module name, if not the same as the library name
  2327. dnl $7 = extra libraries
  2328. dnl
  2329. dnl Sets these variables:
  2330. dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
  2331. dnl $cf_cv_header_path_$3 - include-directory if needed
  2332. dnl $cf_cv_library_path_$3 - library-directory if needed
  2333. dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
  2334. AC_DEFUN([CF_FIND_LINKAGE],[
  2335. # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
  2336. # will be set on completion of the AC_TRY_LINK below.
  2337. cf_cv_header_path_$3=
  2338. cf_cv_library_path_$3=
  2339. CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
  2340. cf_save_LIBS="$LIBS"
  2341. AC_TRY_LINK([$1],[$2],[
  2342. cf_cv_find_linkage_$3=yes
  2343. cf_cv_header_path_$3=/usr/include
  2344. cf_cv_library_path_$3=/usr/lib
  2345. ],[
  2346. LIBS="-l$3 $7 $cf_save_LIBS"
  2347. AC_TRY_LINK([$1],[$2],[
  2348. cf_cv_find_linkage_$3=yes
  2349. cf_cv_header_path_$3=/usr/include
  2350. cf_cv_library_path_$3=/usr/lib
  2351. cf_cv_library_file_$3="-l$3"
  2352. ],[
  2353. cf_cv_find_linkage_$3=no
  2354. LIBS="$cf_save_LIBS"
  2355. CF_VERBOSE(find linkage for $3 library)
  2356. CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
  2357. cf_save_CPPFLAGS="$CPPFLAGS"
  2358. cf_test_CPPFLAGS="$CPPFLAGS"
  2359. CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
  2360. for cf_cv_header_path_$3 in $cf_search
  2361. do
  2362. if test -d $cf_cv_header_path_$3 ; then
  2363. CF_VERBOSE(... testing $cf_cv_header_path_$3)
  2364. CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
  2365. AC_TRY_COMPILE([$1],[$2],[
  2366. CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
  2367. cf_cv_find_linkage_$3=maybe
  2368. cf_test_CPPFLAGS="$CPPFLAGS"
  2369. break],[
  2370. CPPFLAGS="$cf_save_CPPFLAGS"
  2371. ])
  2372. fi
  2373. done
  2374. if test "$cf_cv_find_linkage_$3" = maybe ; then
  2375. CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
  2376. cf_save_LIBS="$LIBS"
  2377. cf_save_LDFLAGS="$LDFLAGS"
  2378. ifelse([$6],,,[
  2379. CPPFLAGS="$cf_test_CPPFLAGS"
  2380. LIBS="-l$3 $7 $cf_save_LIBS"
  2381. AC_TRY_LINK([$1],[$2],[
  2382. CF_VERBOSE(... found $3 library in system)
  2383. cf_cv_find_linkage_$3=yes])
  2384. CPPFLAGS="$cf_save_CPPFLAGS"
  2385. LIBS="$cf_save_LIBS"
  2386. ])
  2387. if test "$cf_cv_find_linkage_$3" != yes ; then
  2388. CF_LIBRARY_PATH(cf_search,$3)
  2389. for cf_cv_library_path_$3 in $cf_search
  2390. do
  2391. if test -d $cf_cv_library_path_$3 ; then
  2392. CF_VERBOSE(... testing $cf_cv_library_path_$3)
  2393. CPPFLAGS="$cf_test_CPPFLAGS"
  2394. LIBS="-l$3 $7 $cf_save_LIBS"
  2395. LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
  2396. AC_TRY_LINK([$1],[$2],[
  2397. CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
  2398. cf_cv_find_linkage_$3=yes
  2399. cf_cv_library_file_$3="-l$3"
  2400. break],[
  2401. CPPFLAGS="$cf_save_CPPFLAGS"
  2402. LIBS="$cf_save_LIBS"
  2403. LDFLAGS="$cf_save_LDFLAGS"
  2404. ])
  2405. fi
  2406. done
  2407. CPPFLAGS="$cf_save_CPPFLAGS"
  2408. LDFLAGS="$cf_save_LDFLAGS"
  2409. fi
  2410. else
  2411. cf_cv_find_linkage_$3=no
  2412. fi
  2413. ],$7)
  2414. ])
  2415. LIBS="$cf_save_LIBS"
  2416. if test "$cf_cv_find_linkage_$3" = yes ; then
  2417. ifelse([$4],,[
  2418. CF_ADD_INCDIR($cf_cv_header_path_$3)
  2419. CF_ADD_LIBDIR($cf_cv_library_path_$3)
  2420. CF_ADD_LIB($3)
  2421. ],[$4])
  2422. else
  2423. ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
  2424. fi
  2425. ])dnl
  2426. dnl ---------------------------------------------------------------------------
  2427. dnl CF_FIONBIO version: 3 updated: 2012/11/08 20:57:52
  2428. dnl ----------
  2429. dnl Check for availability of fcntl versus ioctl(,FIONBIO,). Lynx uses this
  2430. dnl for Sequent (ptx), and it is needed for OS/2 EMX.
  2431. AC_DEFUN([CF_FIONBIO],
  2432. [
  2433. AC_CACHE_CHECK(if we should use fcntl or ioctl,cf_cv_fionbio,[
  2434. AC_TRY_LINK([
  2435. #include <sys/types.h>
  2436. #include <sys/ioctl.h>
  2437. ],[
  2438. int ret = ioctl(0, FIONBIO, (char *)0);
  2439. ],[cf_cv_fionbio=ioctl],[
  2440. AC_TRY_LINK([
  2441. #include <sys/types.h>
  2442. #if HAVE_FCNTL_H
  2443. #include <fcntl.h>
  2444. #else
  2445. #if HAVE_SYS_FCNTL_H
  2446. #include <sys/fcntl.h>
  2447. #endif
  2448. #endif],[
  2449. int ret = fcntl(0, F_SETFL, O_NONBLOCK);
  2450. ],
  2451. [cf_cv_fionbio=fcntl],
  2452. [cf_cv_fionbio=unknown])])
  2453. ])
  2454. test "$cf_cv_fionbio" = "fcntl" && AC_DEFINE(USE_FCNTL,1,[Define to 1 if we should use fcntl])
  2455. ])dnl
  2456. dnl ---------------------------------------------------------------------------
  2457. dnl CF_FUNC_CURSES_VERSION version: 6 updated: 2012/10/06 16:39:58
  2458. dnl ----------------------
  2459. dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
  2460. dnl It's a character string "SVR4", not documented.
  2461. AC_DEFUN([CF_FUNC_CURSES_VERSION],
  2462. [
  2463. AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
  2464. AC_TRY_RUN([
  2465. #include <${cf_cv_ncurses_header:-curses.h}>
  2466. int main()
  2467. {
  2468. char temp[1024];
  2469. sprintf(temp, "%s\n", curses_version());
  2470. ${cf_cv_main_return:-return}(0);
  2471. }]
  2472. ,[cf_cv_func_curses_version=yes]
  2473. ,[cf_cv_func_curses_version=no]
  2474. ,[cf_cv_func_curses_version=unknown])
  2475. rm -f core])
  2476. test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION,1,[Define to 1 if we have curses_version function])
  2477. ])
  2478. dnl ---------------------------------------------------------------------------
  2479. dnl CF_FUNC_GETADDRINFO version: 8 updated: 2012/11/08 20:57:52
  2480. dnl -------------------
  2481. dnl Look for a working version of getaddrinfo(), for IPV6 support.
  2482. AC_DEFUN([CF_FUNC_GETADDRINFO],[
  2483. AC_CACHE_CHECK(working getaddrinfo, cf_cv_getaddrinfo,[
  2484. AC_TRY_RUN([
  2485. #include <sys/types.h>
  2486. #include <netdb.h>
  2487. #include <string.h>
  2488. #include <sys/socket.h>
  2489. #include <netinet/in.h>
  2490. #define expect(a,b) if (strcmp(a,b) != 0) goto bad
  2491. int main()
  2492. {
  2493. int passive, gaierr, inet4 = 0, inet6 = 0;
  2494. struct addrinfo hints, *ai, *aitop;
  2495. char straddr[INET6_ADDRSTRLEN], strport[16];
  2496. for (passive = 0; passive <= 1; passive++) {
  2497. memset(&hints, 0, sizeof(hints));
  2498. hints.ai_family = AF_UNSPEC;
  2499. hints.ai_flags = passive ? AI_PASSIVE : 0;
  2500. hints.ai_socktype = SOCK_STREAM;
  2501. if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
  2502. (void)gai_strerror(gaierr);
  2503. goto bad;
  2504. }
  2505. for (ai = aitop; ai; ai = ai->ai_next) {
  2506. if (ai->ai_addr == NULL ||
  2507. ai->ai_addrlen == 0 ||
  2508. getnameinfo(ai->ai_addr, ai->ai_addrlen,
  2509. straddr, sizeof(straddr), strport, sizeof(strport),
  2510. NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
  2511. goto bad;
  2512. }
  2513. switch (ai->ai_family) {
  2514. case AF_INET:
  2515. expect(strport, "54321");
  2516. if (passive) {
  2517. expect(straddr, "0.0.0.0");
  2518. } else {
  2519. expect(straddr, "127.0.0.1");
  2520. }
  2521. inet4++;
  2522. break;
  2523. case AF_INET6:
  2524. expect(strport, "54321");
  2525. if (passive) {
  2526. expect(straddr, "::");
  2527. } else {
  2528. expect(straddr, "::1");
  2529. }
  2530. inet6++;
  2531. break;
  2532. case AF_UNSPEC:
  2533. goto bad;
  2534. break;
  2535. default:
  2536. /* another family support? */
  2537. break;
  2538. }
  2539. }
  2540. }
  2541. if (!(inet4 == 0 || inet4 == 2))
  2542. goto bad;
  2543. if (!(inet6 == 0 || inet6 == 2))
  2544. goto bad;
  2545. if (aitop)
  2546. freeaddrinfo(aitop);
  2547. ${cf_cv_main_return:-return}(0);
  2548. bad:
  2549. if (aitop)
  2550. freeaddrinfo(aitop);
  2551. ${cf_cv_main_return:-return}(1);
  2552. }
  2553. ],
  2554. [cf_cv_getaddrinfo=yes],
  2555. [cf_cv_getaddrinfo=no],
  2556. [cf_cv_getaddrinfo=unknown])
  2557. ])
  2558. if test "$cf_cv_getaddrinfo" = yes ; then
  2559. AC_DEFINE(HAVE_GAI_STRERROR,1,[Define to 1 if we have gai_strerror function])
  2560. AC_DEFINE(HAVE_GETADDRINFO,1,[Define to 1 if we have getaddrinfo function])
  2561. fi
  2562. ])dnl
  2563. dnl ---------------------------------------------------------------------------
  2564. dnl CF_FUNC_LSTAT version: 3 updated: 2012/11/08 20:57:52
  2565. dnl -------------
  2566. dnl A conventional existence-check for 'lstat' won't work with the Linux
  2567. dnl version of gcc 2.7.0, since the symbol is defined only within <sys/stat.h>
  2568. dnl as an inline function.
  2569. dnl
  2570. dnl So much for portability.
  2571. AC_DEFUN([CF_FUNC_LSTAT],
  2572. [
  2573. AC_MSG_CHECKING(for lstat)
  2574. AC_CACHE_VAL(ac_cv_func_lstat,[
  2575. AC_TRY_LINK([
  2576. #include <sys/types.h>
  2577. #include <sys/stat.h>],
  2578. [lstat(".", (struct stat *)0)],
  2579. [ac_cv_func_lstat=yes],
  2580. [ac_cv_func_lstat=no])
  2581. ])
  2582. AC_MSG_RESULT($ac_cv_func_lstat )
  2583. if test $ac_cv_func_lstat = yes; then
  2584. AC_DEFINE(HAVE_LSTAT,1,[Define to 1 if we have lstat])
  2585. fi
  2586. ])dnl
  2587. dnl ---------------------------------------------------------------------------
  2588. dnl CF_FUNC_SIGACTION version: 3 updated: 2012/11/08 20:57:52
  2589. dnl -----------------
  2590. dnl Check if we have the sigaction function and related structures.
  2591. AC_DEFUN([CF_FUNC_SIGACTION],[
  2592. AC_CACHE_CHECK(for sigaction and structs,cf_cv_func_sigaction,[
  2593. AC_TRY_LINK([
  2594. #include <sys/types.h>
  2595. #include <signal.h>],
  2596. [struct sigaction act;
  2597. act.sa_handler = SIG_DFL;
  2598. #ifdef SA_RESTART
  2599. act.sa_flags |= SA_RESTART;
  2600. #endif /* SA_RESTART */
  2601. sigaction(1, &act, 0);
  2602. ],
  2603. [cf_cv_func_sigaction=yes],
  2604. [cf_cv_func_sigaction=no])
  2605. ])
  2606. test "$cf_cv_func_sigaction" = yes && AC_DEFINE(HAVE_SIGACTION,1,[Define to 1 if we have sigaction])
  2607. ])dnl
  2608. dnl ---------------------------------------------------------------------------
  2609. dnl CF_FUNC_WAIT version: 3 updated: 2012/10/06 08:57:51
  2610. dnl ------------
  2611. dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
  2612. dnl and/or 'waitpid()'.
  2613. dnl
  2614. dnl Note that we cannot simply grep for 'union wait' in the wait.h file,
  2615. dnl because some Posix systems turn this on only when a BSD variable is
  2616. dnl defined.
  2617. dnl
  2618. dnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which
  2619. dnl would conflict with an attempt to test that header directly.
  2620. dnl
  2621. AC_DEFUN([CF_FUNC_WAIT],
  2622. [
  2623. AC_REQUIRE([CF_UNION_WAIT])
  2624. if test $cf_cv_type_unionwait = yes; then
  2625. AC_MSG_CHECKING(if union wait can be used as wait-arg)
  2626. AC_CACHE_VAL(cf_cv_arg_union_wait,[
  2627. AC_TRY_COMPILE($cf_wait_headers,
  2628. [union wait x; wait(&x)],
  2629. [cf_cv_arg_union_wait=yes],
  2630. [cf_cv_arg_union_wait=no])
  2631. ])
  2632. AC_MSG_RESULT($cf_cv_arg_union_wait)
  2633. test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION,1,[Define to 1 if wait() uses a union parameter])
  2634. AC_MSG_CHECKING(if union wait can be used as waitpid-arg)
  2635. AC_CACHE_VAL(cf_cv_arg_union_waitpid,[
  2636. AC_TRY_COMPILE($cf_wait_headers,
  2637. [union wait x; waitpid(0, &x, 0)],
  2638. [cf_cv_arg_union_waitpid=yes],
  2639. [cf_cv_arg_union_waitpid=no])
  2640. ])
  2641. AC_MSG_RESULT($cf_cv_arg_union_waitpid)
  2642. test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION,1,[Define to 1 if waitpid() uses a union parameter])
  2643. fi
  2644. ])dnl
  2645. dnl ---------------------------------------------------------------------------
  2646. dnl CF_GCC_ATTRIBUTES version: 16 updated: 2012/10/02 20:55:03
  2647. dnl -----------------
  2648. dnl Test for availability of useful gcc __attribute__ directives to quiet
  2649. dnl compiler warnings. Though useful, not all are supported -- and contrary
  2650. dnl to documentation, unrecognized directives cause older compilers to barf.
  2651. AC_DEFUN([CF_GCC_ATTRIBUTES],
  2652. [
  2653. if test "$GCC" = yes
  2654. then
  2655. cat > conftest.i <<EOF
  2656. #ifndef GCC_PRINTF
  2657. #define GCC_PRINTF 0
  2658. #endif
  2659. #ifndef GCC_SCANF
  2660. #define GCC_SCANF 0
  2661. #endif
  2662. #ifndef GCC_NORETURN
  2663. #define GCC_NORETURN /* nothing */
  2664. #endif
  2665. #ifndef GCC_UNUSED
  2666. #define GCC_UNUSED /* nothing */
  2667. #endif
  2668. EOF
  2669. if test "$GCC" = yes
  2670. then
  2671. AC_CHECKING([for $CC __attribute__ directives])
  2672. cat > conftest.$ac_ext <<EOF
  2673. #line __oline__ "${as_me:-configure}"
  2674. #include "confdefs.h"
  2675. #include "conftest.h"
  2676. #include "conftest.i"
  2677. #if GCC_PRINTF
  2678. #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
  2679. #else
  2680. #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
  2681. #endif
  2682. #if GCC_SCANF
  2683. #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
  2684. #else
  2685. #define GCC_SCANFLIKE(fmt,var) /*nothing*/
  2686. #endif
  2687. extern void wow(char *,...) GCC_SCANFLIKE(1,2);
  2688. extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
  2689. extern void foo(void) GCC_NORETURN;
  2690. int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
  2691. EOF
  2692. cf_printf_attribute=no
  2693. cf_scanf_attribute=no
  2694. for cf_attribute in scanf printf unused noreturn
  2695. do
  2696. CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
  2697. cf_directive="__attribute__(($cf_attribute))"
  2698. echo "checking for $CC $cf_directive" 1>&AC_FD_CC
  2699. case $cf_attribute in #(vi
  2700. printf) #(vi
  2701. cf_printf_attribute=yes
  2702. cat >conftest.h <<EOF
  2703. #define GCC_$cf_ATTRIBUTE 1
  2704. EOF
  2705. ;;
  2706. scanf) #(vi
  2707. cf_scanf_attribute=yes
  2708. cat >conftest.h <<EOF
  2709. #define GCC_$cf_ATTRIBUTE 1
  2710. EOF
  2711. ;;
  2712. *) #(vi
  2713. cat >conftest.h <<EOF
  2714. #define GCC_$cf_ATTRIBUTE $cf_directive
  2715. EOF
  2716. ;;
  2717. esac
  2718. if AC_TRY_EVAL(ac_compile); then
  2719. test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
  2720. cat conftest.h >>confdefs.h
  2721. case $cf_attribute in #(vi
  2722. noreturn) #(vi
  2723. AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc])
  2724. ;;
  2725. printf) #(vi
  2726. cf_value='/* nothing */'
  2727. if test "$cf_printf_attribute" != no ; then
  2728. cf_value='__attribute__((format(printf,fmt,var)))'
  2729. AC_DEFINE(GCC_PRINTF,1,[Define to 1 if the compiler supports gcc-like printf attribute.])
  2730. fi
  2731. AC_DEFINE_UNQUOTED(GCC_PRINTFLIKE(fmt,var),$cf_value,[Define to printf-attribute for gcc])
  2732. ;;
  2733. scanf) #(vi
  2734. cf_value='/* nothing */'
  2735. if test "$cf_scanf_attribute" != no ; then
  2736. cf_value='__attribute__((format(scanf,fmt,var)))'
  2737. AC_DEFINE(GCC_SCANF,1,[Define to 1 if the compiler supports gcc-like scanf attribute.])
  2738. fi
  2739. AC_DEFINE_UNQUOTED(GCC_SCANFLIKE(fmt,var),$cf_value,[Define to sscanf-attribute for gcc])
  2740. ;;
  2741. unused) #(vi
  2742. AC_DEFINE_UNQUOTED(GCC_UNUSED,$cf_directive,[Define to unused-attribute for gcc])
  2743. ;;
  2744. esac
  2745. fi
  2746. done
  2747. else
  2748. fgrep define conftest.i >>confdefs.h
  2749. fi
  2750. rm -rf conftest*
  2751. fi
  2752. ])dnl
  2753. dnl ---------------------------------------------------------------------------
  2754. dnl CF_GCC_VERSION version: 7 updated: 2012/10/18 06:46:33
  2755. dnl --------------
  2756. dnl Find version of gcc
  2757. AC_DEFUN([CF_GCC_VERSION],[
  2758. AC_REQUIRE([AC_PROG_CC])
  2759. GCC_VERSION=none
  2760. if test "$GCC" = yes ; then
  2761. AC_MSG_CHECKING(version of $CC)
  2762. GCC_VERSION="`${CC} --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(GCC[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
  2763. test -z "$GCC_VERSION" && GCC_VERSION=unknown
  2764. AC_MSG_RESULT($GCC_VERSION)
  2765. fi
  2766. ])dnl
  2767. dnl ---------------------------------------------------------------------------
  2768. dnl CF_GCC_WARNINGS version: 31 updated: 2013/11/19 19:23:35
  2769. dnl ---------------
  2770. dnl Check if the compiler supports useful warning options. There's a few that
  2771. dnl we don't use, simply because they're too noisy:
  2772. dnl
  2773. dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
  2774. dnl -Wredundant-decls (system headers make this too noisy)
  2775. dnl -Wtraditional (combines too many unrelated messages, only a few useful)
  2776. dnl -Wwrite-strings (too noisy, but should review occasionally). This
  2777. dnl is enabled for ncurses using "--enable-const".
  2778. dnl -pedantic
  2779. dnl
  2780. dnl Parameter:
  2781. dnl $1 is an optional list of gcc warning flags that a particular
  2782. dnl application might want to use, e.g., "no-unused" for
  2783. dnl -Wno-unused
  2784. dnl Special:
  2785. dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
  2786. dnl
  2787. AC_DEFUN([CF_GCC_WARNINGS],
  2788. [
  2789. AC_REQUIRE([CF_GCC_VERSION])
  2790. CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
  2791. CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS)
  2792. cat > conftest.$ac_ext <<EOF
  2793. #line __oline__ "${as_me:-configure}"
  2794. int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
  2795. EOF
  2796. if test "$INTEL_COMPILER" = yes
  2797. then
  2798. # The "-wdXXX" options suppress warnings:
  2799. # remark #1419: external declaration in primary source file
  2800. # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
  2801. # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
  2802. # remark #193: zero used for undefined preprocessing identifier
  2803. # remark #593: variable "curs_sb_left_arrow" was set but never used
  2804. # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
  2805. # remark #869: parameter "tw" was never referenced
  2806. # remark #981: operands are evaluated in unspecified order
  2807. # warning #279: controlling expression is constant
  2808. AC_CHECKING([for $CC warning options])
  2809. cf_save_CFLAGS="$CFLAGS"
  2810. EXTRA_CFLAGS="-Wall"
  2811. for cf_opt in \
  2812. wd1419 \
  2813. wd1683 \
  2814. wd1684 \
  2815. wd193 \
  2816. wd593 \
  2817. wd279 \
  2818. wd810 \
  2819. wd869 \
  2820. wd981
  2821. do
  2822. CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
  2823. if AC_TRY_EVAL(ac_compile); then
  2824. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  2825. EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
  2826. fi
  2827. done
  2828. CFLAGS="$cf_save_CFLAGS"
  2829. elif test "$GCC" = yes
  2830. then
  2831. AC_CHECKING([for $CC warning options])
  2832. cf_save_CFLAGS="$CFLAGS"
  2833. EXTRA_CFLAGS=
  2834. cf_warn_CONST=""
  2835. test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
  2836. cf_gcc_warnings="Wignored-qualifiers Wlogical-op Wvarargs"
  2837. test "x$CLANG_COMPILER" = xyes && cf_gcc_warnings=
  2838. for cf_opt in W Wall \
  2839. Wbad-function-cast \
  2840. Wcast-align \
  2841. Wcast-qual \
  2842. Wdeclaration-after-statement \
  2843. Wextra \
  2844. Winline \
  2845. Wmissing-declarations \
  2846. Wmissing-prototypes \
  2847. Wnested-externs \
  2848. Wpointer-arith \
  2849. Wshadow \
  2850. Wstrict-prototypes \
  2851. Wundef $cf_gcc_warnings $cf_warn_CONST $1
  2852. do
  2853. CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
  2854. if AC_TRY_EVAL(ac_compile); then
  2855. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  2856. case $cf_opt in #(vi
  2857. Wcast-qual) #(vi
  2858. CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
  2859. ;;
  2860. Winline) #(vi
  2861. case $GCC_VERSION in
  2862. [[34]].*)
  2863. CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
  2864. continue;;
  2865. esac
  2866. ;;
  2867. Wpointer-arith) #(vi
  2868. case $GCC_VERSION in
  2869. [[12]].*)
  2870. CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
  2871. continue;;
  2872. esac
  2873. ;;
  2874. esac
  2875. EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
  2876. fi
  2877. done
  2878. CFLAGS="$cf_save_CFLAGS"
  2879. fi
  2880. rm -rf conftest*
  2881. AC_SUBST(EXTRA_CFLAGS)
  2882. ])dnl
  2883. dnl ---------------------------------------------------------------------------
  2884. dnl CF_GNUTLS version: 22 updated: 2012/11/08 20:57:52
  2885. dnl ---------
  2886. dnl Check for gnutls library (TLS "is" SSL)
  2887. dnl $1 = the [optional] directory in which the library may be found
  2888. dnl $2 = the [optional] stub file to provide OpenSSL compatibility
  2889. AC_DEFUN([CF_GNUTLS],[
  2890. AC_REQUIRE([CF_PKG_CONFIG])
  2891. cf_cv_have_gnutls=no
  2892. cf_cv_pkg_config_ssl=no
  2893. CF_ADD_OPTIONAL_PATH($1, [ssl library])
  2894. cf_pkg_gnutls=none
  2895. if test "x$PKG_CONFIG" != xnone; then
  2896. cf_pkg_gnutls=ifelse([$2],,gnutls-openssl,gnutls)
  2897. case $1 in #(vi
  2898. no) #(vi
  2899. ;;
  2900. yes) # if no explicit directory given, try pkg-config
  2901. CF_VERBOSE(checking pkg-config for $cf_pkg_gnutls)
  2902. if "$PKG_CONFIG" --exists $cf_pkg_gnutls ; then
  2903. CF_VERBOSE(... found $cf_pkg_gnutls in pkg-config)
  2904. cf_cv_have_gnutls=yes
  2905. cf_cv_pkg_config_ssl=yes
  2906. cf_cflags_ssl=`$PKG_CONFIG --cflags $cf_pkg_gnutls`
  2907. cf_libs_ssl=`$PKG_CONFIG --libs $cf_pkg_gnutls`
  2908. if test -n "$cf_cflags_ssl" ; then
  2909. case "$cf_cflags_ssl" in #(vi
  2910. *-I*) #(vi
  2911. cf_cv_header_path_gnutls=`echo "$cf_cflags_ssl" | sed -e 's/^.*-I//' -e 's/ .*//'`
  2912. ;;
  2913. *)
  2914. cf_cv_header_path_gnutls=/usr/include
  2915. ;;
  2916. esac
  2917. if test -d $cf_cv_header_path_gnutls/gnutls ; then
  2918. cf_cv_header_path_gnutls=$cf_cv_header_path_gnutls/gnutls
  2919. fi
  2920. CF_ADD_CFLAGS($cf_cflags_ssl)
  2921. fi
  2922. if test -n "$cf_libs_ssl" ; then
  2923. case "x$cf_libs_ssl" in #(vi
  2924. *-L*) #(vi
  2925. cf_cv_library_path_gnutls=`echo "$cf_libs_ssl" | sed -e 's/^.*-L//' -e 's/ .*//'`
  2926. ;;
  2927. *)
  2928. cf_cv_library_path_gnutls=/usr/lib
  2929. ;;
  2930. esac
  2931. CF_VERBOSE(adding $cf_libs_ssl to LIBS)
  2932. CF_ADD_LIBS($cf_libs_ssl)
  2933. fi
  2934. else
  2935. CF_VERBOSE(... did not find $cf_pkg_gnutls in pkg-config)
  2936. cf_pkg_gnutls=none
  2937. fi
  2938. ;;
  2939. esac
  2940. fi
  2941. ifelse([$2],,
  2942. [AC_DEFINE(USE_GNUTLS_INCL,1,[Define to 1 if we should include gnutls headers])],
  2943. [AC_DEFINE(USE_GNUTLS_FUNCS,1,[Define to 1 if we should use gnutls functions])])
  2944. if test "$cf_cv_have_gnutls" = no ; then
  2945. cf_gnutls_CPPFLAGS=$CPPFLAGS
  2946. CF_FIND_LINKAGE(CF__SSL_HEAD,
  2947. CF__SSL_BODY,
  2948. gnutls,
  2949. cf_cv_have_gnutls=yes,
  2950. cf_cv_have_gnutls=no,
  2951. ,
  2952. ifelse([$2],,[-lgnutls-openssl -lgnutls-extra -lgnutls -lgcrypt],[-lgnutls -lgcrypt]))
  2953. CPPFLAGS=$cf_gnutls_CPPFLAGS
  2954. fi
  2955. if test "$cf_cv_have_gnutls" = yes ; then
  2956. if test -n "$cf_cv_header_path_gnutls" ; then
  2957. AC_DEFINE(USE_SSL)
  2958. case $cf_cv_header_path_gnutls in
  2959. /usr/include/gnutls)
  2960. ;;
  2961. *)
  2962. CF_ADD_INCDIR($cf_cv_header_path_gnutls)
  2963. ;;
  2964. esac
  2965. fi
  2966. if test -n "$cf_cv_library_path_gnutls" ; then
  2967. CF_ADD_LIBDIR($cf_cv_library_path_gnutls)
  2968. fi
  2969. CF_ADD_LIBS(-lgnutls -lgcrypt)
  2970. ifelse([$2],,
  2971. [if test "$cf_pkg_gnutls" = none ; then
  2972. AC_CHECK_LIB(gnutls-openssl,SSL_connect,
  2973. [CF_ADD_LIBS(-lgnutls-openssl)],
  2974. [AC_CHECK_LIB(gnutls-extra,SSL_connect,
  2975. [CF_ADD_LIBS(-lgnutls-extra)],
  2976. [AC_MSG_ERROR(cannot find gnutls openssl functions)])])
  2977. fi],[EXTRA_OBJS="$EXTRA_OBJS $2"])
  2978. CF_CHECK_SSL_X509
  2979. fi
  2980. ])dnl
  2981. dnl ---------------------------------------------------------------------------
  2982. dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
  2983. dnl -------------
  2984. dnl Check if we must define _GNU_SOURCE to get a reasonable value for
  2985. dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
  2986. dnl (or misfeature) of glibc2, which breaks portability of many applications,
  2987. dnl since it is interwoven with GNU extensions.
  2988. dnl
  2989. dnl Well, yes we could work around it...
  2990. AC_DEFUN([CF_GNU_SOURCE],
  2991. [
  2992. AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
  2993. AC_TRY_COMPILE([#include <sys/types.h>],[
  2994. #ifndef _XOPEN_SOURCE
  2995. make an error
  2996. #endif],
  2997. [cf_cv_gnu_source=no],
  2998. [cf_save="$CPPFLAGS"
  2999. CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  3000. AC_TRY_COMPILE([#include <sys/types.h>],[
  3001. #ifdef _XOPEN_SOURCE
  3002. make an error
  3003. #endif],
  3004. [cf_cv_gnu_source=no],
  3005. [cf_cv_gnu_source=yes])
  3006. CPPFLAGS="$cf_save"
  3007. ])
  3008. ])
  3009. test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  3010. ])dnl
  3011. dnl ---------------------------------------------------------------------------
  3012. dnl CF_HEADER_PATH version: 12 updated: 2010/05/05 05:22:40
  3013. dnl --------------
  3014. dnl Construct a search-list of directories for a nonstandard header-file
  3015. dnl
  3016. dnl Parameters
  3017. dnl $1 = the variable to return as result
  3018. dnl $2 = the package name
  3019. AC_DEFUN([CF_HEADER_PATH],
  3020. [
  3021. $1=
  3022. # collect the current set of include-directories from compiler flags
  3023. cf_header_path_list=""
  3024. if test -n "${CFLAGS}${CPPFLAGS}" ; then
  3025. for cf_header_path in $CPPFLAGS $CFLAGS
  3026. do
  3027. case $cf_header_path in #(vi
  3028. -I*)
  3029. cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
  3030. CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
  3031. cf_header_path_list="$cf_header_path_list [$]$1"
  3032. ;;
  3033. esac
  3034. done
  3035. fi
  3036. # add the variations for the package we are looking for
  3037. CF_SUBDIR_PATH($1,$2,include)
  3038. test "$includedir" != NONE && \
  3039. test "$includedir" != "/usr/include" && \
  3040. test -d "$includedir" && {
  3041. test -d $includedir && $1="[$]$1 $includedir"
  3042. test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
  3043. }
  3044. test "$oldincludedir" != NONE && \
  3045. test "$oldincludedir" != "/usr/include" && \
  3046. test -d "$oldincludedir" && {
  3047. test -d $oldincludedir && $1="[$]$1 $oldincludedir"
  3048. test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
  3049. }
  3050. $1="[$]$1 $cf_header_path_list"
  3051. ])dnl
  3052. dnl ---------------------------------------------------------------------------
  3053. dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
  3054. dnl ---------------
  3055. dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
  3056. AC_DEFUN([CF_HELP_MESSAGE],
  3057. [AC_DIVERT_HELP([$1])dnl
  3058. ])dnl
  3059. dnl ---------------------------------------------------------------------------
  3060. dnl CF_INET_ADDR version: 7 updated: 2013/10/08 17:47:05
  3061. dnl ------------
  3062. dnl For Lynx, check if the libraries we have found give us inet_aton, or
  3063. dnl inet_addr. If not, try to find the latter function with -lbind or
  3064. dnl -lresolv, and put that on the end of the libraries, i.e., after the network
  3065. dnl libraries.
  3066. dnl
  3067. dnl FIXME: the inner cases will probably need work on the header files.
  3068. AC_DEFUN([CF_INET_ADDR],[
  3069. AC_CACHE_CHECK(for inet_aton function,cf_cv_have_inet_aton,[
  3070. AC_TRY_LINK(CF__INET_HEAD,[inet_aton(0, (struct in_addr *)0)],
  3071. [cf_cv_have_inet_aton=yes],
  3072. [cf_cv_have_inet_aton=no])])
  3073. if test "$cf_cv_have_inet_aton" = yes ; then
  3074. AC_DEFINE(HAVE_INET_ATON,1,[Define to 1 if we have inet_aton])
  3075. else
  3076. AC_CACHE_CHECK(for inet_addr function,cf_cv_have_inet_addr,[
  3077. AC_TRY_LINK(CF__INET_HEAD,[inet_addr(0)],
  3078. [cf_cv_have_inet_addr=yes],
  3079. [cf_cv_have_inet_addr=no])])
  3080. if test "$cf_cv_have_inet_addr" = no ; then
  3081. AC_CACHE_CHECK(for library with inet_addr,cf_cv_lib_inet_addr,[
  3082. cf_save_LIBS="$LIBS"
  3083. for cf_inetlib in -lbind -lresolv
  3084. do
  3085. LIBS="$cf_save_LIBS $cf_inetlib"
  3086. AC_TRY_LINK([#include <sys/types.h>
  3087. #include <sys/socket.h>
  3088. #include <netinet/in.h>
  3089. #include <arpa/inet.h>
  3090. ],[inet_addr(0)],
  3091. [cf_cv_lib_inet_addr=$cf_inetlib],
  3092. [cf_cv_lib_inet_addr=no])
  3093. LIBS="$cf_save_LIBS"
  3094. test "$cf_cv_lib_inet_addr" != no && break
  3095. done
  3096. ])
  3097. if test "$cf_cv_lib_inet_addr" != no ; then
  3098. CF_ADD_LIBS($cf_cv_lib_inet_addr)
  3099. else
  3100. AC_MSG_WARN(Unable to find library for inet_addr function)
  3101. fi
  3102. fi
  3103. fi
  3104. ])dnl
  3105. dnl ---------------------------------------------------------------------------
  3106. dnl CF_INTEL_COMPILER version: 5 updated: 2013/02/10 10:41:05
  3107. dnl -----------------
  3108. dnl Check if the given compiler is really the Intel compiler for Linux. It
  3109. dnl tries to imitate gcc, but does not return an error when it finds a mismatch
  3110. dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
  3111. dnl
  3112. dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
  3113. dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
  3114. dnl the wrappers for gcc and g++ warnings.
  3115. dnl
  3116. dnl $1 = GCC (default) or GXX
  3117. dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
  3118. dnl $3 = CFLAGS (default) or CXXFLAGS
  3119. AC_DEFUN([CF_INTEL_COMPILER],[
  3120. AC_REQUIRE([AC_CANONICAL_HOST])
  3121. ifelse([$2],,INTEL_COMPILER,[$2])=no
  3122. if test "$ifelse([$1],,[$1],GCC)" = yes ; then
  3123. case $host_os in
  3124. linux*|gnu*)
  3125. AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler)
  3126. cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])"
  3127. ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -no-gcc"
  3128. AC_TRY_COMPILE([],[
  3129. #ifdef __INTEL_COMPILER
  3130. #else
  3131. make an error
  3132. #endif
  3133. ],[ifelse([$2],,INTEL_COMPILER,[$2])=yes
  3134. cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
  3135. ],[])
  3136. ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS"
  3137. AC_MSG_RESULT($ifelse([$2],,INTEL_COMPILER,[$2]))
  3138. ;;
  3139. esac
  3140. fi
  3141. ])dnl
  3142. dnl ---------------------------------------------------------------------------
  3143. dnl CF_LARGEFILE version: 8 updated: 2012/10/06 08:57:51
  3144. dnl ------------
  3145. dnl Add checks for large file support.
  3146. AC_DEFUN([CF_LARGEFILE],[
  3147. ifdef([AC_FUNC_FSEEKO],[
  3148. AC_SYS_LARGEFILE
  3149. if test "$enable_largefile" != no ; then
  3150. AC_FUNC_FSEEKO
  3151. # Normally we would collect these definitions in the config.h,
  3152. # but (like _XOPEN_SOURCE), some environments rely on having these
  3153. # defined before any of the system headers are included. Another
  3154. # case comes up with C++, e.g., on AIX the compiler compiles the
  3155. # header files by themselves before looking at the body files it is
  3156. # told to compile. For ncurses, those header files do not include
  3157. # the config.h
  3158. test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
  3159. test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
  3160. test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
  3161. AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
  3162. AC_TRY_COMPILE([
  3163. #include <sys/types.h>
  3164. #include <dirent.h>
  3165. ],[
  3166. /* if transitional largefile support is setup, this is true */
  3167. extern struct dirent64 * readdir(DIR *);
  3168. struct dirent64 *x = readdir((DIR *)0);
  3169. struct dirent *y = readdir((DIR *)0);
  3170. int z = x - y;
  3171. ],
  3172. [cf_cv_struct_dirent64=yes],
  3173. [cf_cv_struct_dirent64=no])
  3174. ])
  3175. test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64,1,[Define to 1 if we have struct dirent64])
  3176. fi
  3177. ])
  3178. ])
  3179. dnl ---------------------------------------------------------------------------
  3180. dnl CF_LASTLOG version: 5 updated: 2012/10/04 20:12:20
  3181. dnl ----------
  3182. dnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog
  3183. dnl file exists.
  3184. AC_DEFUN([CF_LASTLOG],
  3185. [
  3186. AC_CHECK_HEADERS(lastlog.h paths.h)
  3187. AC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[
  3188. AC_TRY_COMPILE([
  3189. #include <sys/types.h>
  3190. #ifdef HAVE_LASTLOG_H
  3191. #include <lastlog.h>
  3192. #else
  3193. #ifdef HAVE_PATHS_H
  3194. #include <paths.h>
  3195. #endif
  3196. #endif],[char *path = _PATH_LASTLOG],
  3197. [cf_cv_path_lastlog="_PATH_LASTLOG"],
  3198. [if test -f /usr/adm/lastlog ; then
  3199. cf_cv_path_lastlog=/usr/adm/lastlog
  3200. else
  3201. cf_cv_path_lastlog=no
  3202. fi])
  3203. ])
  3204. test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG,1,[Define to 1 if we can define lastlog pathname])
  3205. ])dnl
  3206. dnl ---------------------------------------------------------------------------
  3207. dnl CF_LD_RPATH_OPT version: 5 updated: 2011/07/17 14:48:41
  3208. dnl ---------------
  3209. dnl For the given system and compiler, find the compiler flags to pass to the
  3210. dnl loader to use the "rpath" feature.
  3211. AC_DEFUN([CF_LD_RPATH_OPT],
  3212. [
  3213. AC_REQUIRE([CF_CHECK_CACHE])
  3214. LD_RPATH_OPT=
  3215. AC_MSG_CHECKING(for an rpath option)
  3216. case $cf_cv_system_name in #(vi
  3217. irix*) #(vi
  3218. if test "$GCC" = yes; then
  3219. LD_RPATH_OPT="-Wl,-rpath,"
  3220. else
  3221. LD_RPATH_OPT="-rpath "
  3222. fi
  3223. ;;
  3224. linux*|gnu*|k*bsd*-gnu) #(vi
  3225. LD_RPATH_OPT="-Wl,-rpath,"
  3226. ;;
  3227. openbsd[[2-9]].*|mirbsd*) #(vi
  3228. LD_RPATH_OPT="-Wl,-rpath,"
  3229. ;;
  3230. dragonfly*|freebsd*) #(vi
  3231. LD_RPATH_OPT="-rpath "
  3232. ;;
  3233. netbsd*) #(vi
  3234. LD_RPATH_OPT="-Wl,-rpath,"
  3235. ;;
  3236. osf*|mls+*) #(vi
  3237. LD_RPATH_OPT="-rpath "
  3238. ;;
  3239. solaris2*) #(vi
  3240. LD_RPATH_OPT="-R"
  3241. ;;
  3242. *)
  3243. ;;
  3244. esac
  3245. AC_MSG_RESULT($LD_RPATH_OPT)
  3246. case "x$LD_RPATH_OPT" in #(vi
  3247. x-R*)
  3248. AC_MSG_CHECKING(if we need a space after rpath option)
  3249. cf_save_LIBS="$LIBS"
  3250. CF_ADD_LIBS(${LD_RPATH_OPT}$libdir)
  3251. AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
  3252. LIBS="$cf_save_LIBS"
  3253. AC_MSG_RESULT($cf_rpath_space)
  3254. test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
  3255. ;;
  3256. esac
  3257. ])dnl
  3258. dnl ---------------------------------------------------------------------------
  3259. dnl CF_LIBRARY_PATH version: 9 updated: 2010/03/28 12:52:50
  3260. dnl ---------------
  3261. dnl Construct a search-list of directories for a nonstandard library-file
  3262. dnl
  3263. dnl Parameters
  3264. dnl $1 = the variable to return as result
  3265. dnl $2 = the package name
  3266. AC_DEFUN([CF_LIBRARY_PATH],
  3267. [
  3268. $1=
  3269. cf_library_path_list=""
  3270. if test -n "${LDFLAGS}${LIBS}" ; then
  3271. for cf_library_path in $LDFLAGS $LIBS
  3272. do
  3273. case $cf_library_path in #(vi
  3274. -L*)
  3275. cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
  3276. CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
  3277. cf_library_path_list="$cf_library_path_list [$]$1"
  3278. ;;
  3279. esac
  3280. done
  3281. fi
  3282. CF_SUBDIR_PATH($1,$2,lib)
  3283. $1="$cf_library_path_list [$]$1"
  3284. ])dnl
  3285. dnl ---------------------------------------------------------------------------
  3286. dnl CF_LOCALE version: 5 updated: 2012/10/06 11:17:15
  3287. dnl ---------
  3288. dnl Check if we have setlocale() and its header, <locale.h>
  3289. dnl The optional parameter $1 tells what to do if we do have locale support.
  3290. AC_DEFUN([CF_LOCALE],
  3291. [
  3292. AC_MSG_CHECKING(for setlocale())
  3293. AC_CACHE_VAL(cf_cv_locale,[
  3294. AC_TRY_LINK([#include <locale.h>],
  3295. [setlocale(LC_ALL, "")],
  3296. [cf_cv_locale=yes],
  3297. [cf_cv_locale=no])
  3298. ])
  3299. AC_MSG_RESULT($cf_cv_locale)
  3300. test $cf_cv_locale = yes && { ifelse($1,,AC_DEFINE(LOCALE,1,[Define to 1 if we have locale support]),[$1]) }
  3301. ])dnl
  3302. dnl ---------------------------------------------------------------------------
  3303. dnl CF_MAKEFLAGS version: 14 updated: 2011/03/31 19:29:46
  3304. dnl ------------
  3305. dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
  3306. dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
  3307. dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
  3308. dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
  3309. AC_DEFUN([CF_MAKEFLAGS],
  3310. [
  3311. AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
  3312. cf_cv_makeflags=''
  3313. for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
  3314. do
  3315. cat >cf_makeflags.tmp <<CF_EOF
  3316. SHELL = /bin/sh
  3317. all :
  3318. @ echo '.$cf_option'
  3319. CF_EOF
  3320. cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'`
  3321. case "$cf_result" in
  3322. .*k)
  3323. cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
  3324. case "$cf_result" in
  3325. .*CC=*) cf_cv_makeflags=
  3326. ;;
  3327. *) cf_cv_makeflags=$cf_option
  3328. ;;
  3329. esac
  3330. break
  3331. ;;
  3332. .-) ;;
  3333. *) echo "given option \"$cf_option\", no match \"$cf_result\""
  3334. ;;
  3335. esac
  3336. done
  3337. rm -f cf_makeflags.tmp
  3338. ])
  3339. AC_SUBST(cf_cv_makeflags)
  3340. ])dnl
  3341. dnl ---------------------------------------------------------------------------
  3342. dnl CF_MAKE_TAGS version: 6 updated: 2010/10/23 15:52:32
  3343. dnl ------------
  3344. dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
  3345. dnl a monocase filesystem.
  3346. AC_DEFUN([CF_MAKE_TAGS],[
  3347. AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
  3348. AC_CHECK_PROGS(CTAGS, exctags ctags)
  3349. AC_CHECK_PROGS(ETAGS, exetags etags)
  3350. AC_CHECK_PROG(MAKE_LOWER_TAGS, ${CTAGS:-ctags}, yes, no)
  3351. if test "$cf_cv_mixedcase" = yes ; then
  3352. AC_CHECK_PROG(MAKE_UPPER_TAGS, ${ETAGS:-etags}, yes, no)
  3353. else
  3354. MAKE_UPPER_TAGS=no
  3355. fi
  3356. if test "$MAKE_UPPER_TAGS" = yes ; then
  3357. MAKE_UPPER_TAGS=
  3358. else
  3359. MAKE_UPPER_TAGS="#"
  3360. fi
  3361. if test "$MAKE_LOWER_TAGS" = yes ; then
  3362. MAKE_LOWER_TAGS=
  3363. else
  3364. MAKE_LOWER_TAGS="#"
  3365. fi
  3366. AC_SUBST(CTAGS)
  3367. AC_SUBST(ETAGS)
  3368. AC_SUBST(MAKE_UPPER_TAGS)
  3369. AC_SUBST(MAKE_LOWER_TAGS)
  3370. ])dnl
  3371. dnl ---------------------------------------------------------------------------
  3372. dnl CF_MATH_LIB version: 8 updated: 2010/05/29 16:31:02
  3373. dnl -----------
  3374. dnl Checks for libraries. At least one UNIX system, Apple Macintosh
  3375. dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
  3376. dnl AC_CHECK_LIB(m,sin), because that fails for C++.
  3377. AC_DEFUN([CF_MATH_LIB],
  3378. [
  3379. AC_CACHE_CHECK(if -lm needed for math functions,
  3380. cf_cv_need_libm,[
  3381. AC_TRY_LINK([
  3382. #include <stdio.h>
  3383. #include <math.h>
  3384. ],
  3385. [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)],
  3386. [cf_cv_need_libm=no],
  3387. [cf_cv_need_libm=yes])])
  3388. if test "$cf_cv_need_libm" = yes
  3389. then
  3390. ifelse($1,,[
  3391. CF_ADD_LIB(m)
  3392. ],[$1=-lm])
  3393. fi
  3394. ])
  3395. dnl ---------------------------------------------------------------------------
  3396. dnl CF_MIXEDCASE_FILENAMES version: 6 updated: 2013/10/08 17:47:05
  3397. dnl ----------------------
  3398. dnl Check if the file-system supports mixed-case filenames. If we're able to
  3399. dnl create a lowercase name and see it as uppercase, it doesn't support that.
  3400. AC_DEFUN([CF_MIXEDCASE_FILENAMES],
  3401. [
  3402. AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
  3403. if test "$cross_compiling" = yes ; then
  3404. case $target_alias in #(vi
  3405. *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) #(vi
  3406. cf_cv_mixedcase=no
  3407. ;;
  3408. *)
  3409. cf_cv_mixedcase=yes
  3410. ;;
  3411. esac
  3412. else
  3413. rm -f conftest CONFTEST
  3414. echo test >conftest
  3415. if test -f CONFTEST ; then
  3416. cf_cv_mixedcase=no
  3417. else
  3418. cf_cv_mixedcase=yes
  3419. fi
  3420. rm -f conftest CONFTEST
  3421. fi
  3422. ])
  3423. test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.])
  3424. ])dnl
  3425. dnl ---------------------------------------------------------------------------
  3426. dnl CF_MSG_LOG version: 5 updated: 2010/10/23 15:52:32
  3427. dnl ----------
  3428. dnl Write a debug message to config.log, along with the line number in the
  3429. dnl configure script.
  3430. AC_DEFUN([CF_MSG_LOG],[
  3431. echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
  3432. ])dnl
  3433. dnl ---------------------------------------------------------------------------
  3434. dnl CF_NCURSES_BROKEN version: 8 updated: 2012/11/08 20:57:52
  3435. dnl -----------------
  3436. dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is
  3437. dnl that color combinations don't work).
  3438. AC_DEFUN([CF_NCURSES_BROKEN],
  3439. [
  3440. AC_REQUIRE([CF_NCURSES_VERSION])
  3441. if test "$cf_cv_ncurses_version" != no ; then
  3442. AC_MSG_CHECKING(for obsolete/broken version of ncurses)
  3443. AC_CACHE_VAL(cf_cv_ncurses_broken,[
  3444. AC_TRY_COMPILE([
  3445. #include <${cf_cv_ncurses_header:-curses.h}>],[
  3446. #if defined(NCURSES_VERSION) && defined(wgetbkgd)
  3447. make an error
  3448. #else
  3449. int x = 1
  3450. #endif
  3451. ],
  3452. [cf_cv_ncurses_broken=no],
  3453. [cf_cv_ncurses_broken=yes])
  3454. ])
  3455. AC_MSG_RESULT($cf_cv_ncurses_broken)
  3456. if test "$cf_cv_ncurses_broken" = yes ; then
  3457. AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses)
  3458. AC_DEFINE(NCURSES_BROKEN,1,[Define to 1 if you have an obsolete version of ncurses])
  3459. fi
  3460. fi
  3461. ])dnl
  3462. dnl ---------------------------------------------------------------------------
  3463. dnl CF_NCURSES_CC_CHECK version: 4 updated: 2007/07/29 10:39:05
  3464. dnl -------------------
  3465. dnl Check if we can compile with ncurses' header file
  3466. dnl $1 is the cache variable to set
  3467. dnl $2 is the header-file to include
  3468. dnl $3 is the root name (ncurses or ncursesw)
  3469. AC_DEFUN([CF_NCURSES_CC_CHECK],[
  3470. AC_TRY_COMPILE([
  3471. ]ifelse($3,ncursesw,[
  3472. #define _XOPEN_SOURCE_EXTENDED
  3473. #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
  3474. #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
  3475. ])[
  3476. #include <$2>],[
  3477. #ifdef NCURSES_VERSION
  3478. ]ifelse($3,ncursesw,[
  3479. #ifndef WACS_BSSB
  3480. make an error
  3481. #endif
  3482. ])[
  3483. printf("%s\n", NCURSES_VERSION);
  3484. #else
  3485. #ifdef __NCURSES_H
  3486. printf("old\n");
  3487. #else
  3488. make an error
  3489. #endif
  3490. #endif
  3491. ]
  3492. ,[$1=$2]
  3493. ,[$1=no])
  3494. ])dnl
  3495. dnl ---------------------------------------------------------------------------
  3496. dnl CF_NCURSES_CONFIG version: 10 updated: 2012/10/06 08:57:51
  3497. dnl -----------------
  3498. dnl Tie together the configure-script macros for ncurses.
  3499. dnl Prefer the "-config" script from ncurses 6.x, to simplify analysis.
  3500. dnl Allow that to be overridden using the $NCURSES_CONFIG environment variable.
  3501. dnl
  3502. dnl $1 is the root library name (default: "ncurses")
  3503. AC_DEFUN([CF_NCURSES_CONFIG],
  3504. [
  3505. cf_ncuconfig_root=ifelse($1,,ncurses,$1)
  3506. echo "Looking for ${cf_ncuconfig_root}-config"
  3507. CF_ACVERSION_CHECK(2.52,
  3508. [AC_CHECK_TOOLS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)],
  3509. [AC_PATH_PROGS(NCURSES_CONFIG, ${cf_ncuconfig_root}6-config ${cf_ncuconfig_root}5-config, none)])
  3510. if test "$NCURSES_CONFIG" != none ; then
  3511. CPPFLAGS="$CPPFLAGS `$NCURSES_CONFIG --cflags`"
  3512. CF_ADD_LIBS(`$NCURSES_CONFIG --libs`)
  3513. # even with config script, some packages use no-override for curses.h
  3514. CF_CURSES_HEADER(ifelse($1,,ncurses,$1))
  3515. dnl like CF_NCURSES_CPPFLAGS
  3516. AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
  3517. dnl like CF_NCURSES_LIBS
  3518. CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_ncuconfig_root)
  3519. AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
  3520. dnl like CF_NCURSES_VERSION
  3521. cf_cv_ncurses_version=`$NCURSES_CONFIG --version`
  3522. else
  3523. CF_NCURSES_CPPFLAGS(ifelse($1,,ncurses,$1))
  3524. CF_NCURSES_LIBS(ifelse($1,,ncurses,$1))
  3525. fi
  3526. ])dnl
  3527. dnl ---------------------------------------------------------------------------
  3528. dnl CF_NCURSES_CPPFLAGS version: 21 updated: 2012/10/06 08:57:51
  3529. dnl -------------------
  3530. dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
  3531. dnl the CPPFLAGS variable so we can include its header.
  3532. dnl
  3533. dnl The header files may be installed as either curses.h, or ncurses.h (would
  3534. dnl be obsolete, except that some packagers prefer this name to distinguish it
  3535. dnl from a "native" curses implementation). If not installed for overwrite,
  3536. dnl the curses.h file would be in an ncurses subdirectory (e.g.,
  3537. dnl /usr/include/ncurses), but someone may have installed overwriting the
  3538. dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
  3539. dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
  3540. dnl the header.
  3541. dnl
  3542. dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
  3543. dnl is already in the include-path, don't even bother with this, since we cannot
  3544. dnl easily determine which file it is. In this case, it has to be <curses.h>.
  3545. dnl
  3546. dnl The optional parameter gives the root name of the library, in case it is
  3547. dnl not installed as the default curses library. That is how the
  3548. dnl wide-character version of ncurses is installed.
  3549. AC_DEFUN([CF_NCURSES_CPPFLAGS],
  3550. [AC_REQUIRE([CF_WITH_CURSES_DIR])
  3551. AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
  3552. cf_ncuhdr_root=ifelse($1,,ncurses,$1)
  3553. test -n "$cf_cv_curses_dir" && \
  3554. test "$cf_cv_curses_dir" != "no" && { \
  3555. CF_ADD_INCDIR($cf_cv_curses_dir/include/$cf_ncuhdr_root)
  3556. }
  3557. AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
  3558. cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
  3559. ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
  3560. for cf_header in $cf_header_list
  3561. do
  3562. CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
  3563. test "$cf_cv_ncurses_h" != no && break
  3564. done
  3565. ])
  3566. CF_NCURSES_HEADER
  3567. CF_TERM_HEADER
  3568. # some applications need this, but should check for NCURSES_VERSION
  3569. AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
  3570. CF_NCURSES_VERSION
  3571. ])dnl
  3572. dnl ---------------------------------------------------------------------------
  3573. dnl CF_NCURSES_HEADER version: 3 updated: 2012/10/06 08:57:51
  3574. dnl -----------------
  3575. dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
  3576. dnl variations of ncurses' installs.
  3577. dnl
  3578. dnl See also CF_CURSES_HEADER, which sets the same cache variable.
  3579. AC_DEFUN([CF_NCURSES_HEADER],[
  3580. if test "$cf_cv_ncurses_h" != no ; then
  3581. cf_cv_ncurses_header=$cf_cv_ncurses_h
  3582. else
  3583. AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
  3584. test -n "$verbose" && echo
  3585. CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
  3586. test -n "$verbose" && echo search path $cf_search
  3587. cf_save2_CPPFLAGS="$CPPFLAGS"
  3588. for cf_incdir in $cf_search
  3589. do
  3590. CF_ADD_INCDIR($cf_incdir)
  3591. for cf_header in \
  3592. ncurses.h \
  3593. curses.h
  3594. do
  3595. CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
  3596. if test "$cf_cv_ncurses_h2" != no ; then
  3597. cf_cv_ncurses_h2=$cf_incdir/$cf_header
  3598. test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
  3599. break
  3600. fi
  3601. test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
  3602. done
  3603. CPPFLAGS="$cf_save2_CPPFLAGS"
  3604. test "$cf_cv_ncurses_h2" != no && break
  3605. done
  3606. test "$cf_cv_ncurses_h2" = no && AC_MSG_ERROR(not found)
  3607. ])
  3608. CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
  3609. cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
  3610. if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
  3611. cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
  3612. fi
  3613. CF_ADD_INCDIR($cf_1st_incdir)
  3614. fi
  3615. # Set definitions to allow ifdef'ing for ncurses.h
  3616. case $cf_cv_ncurses_header in # (vi
  3617. *ncurses.h)
  3618. AC_DEFINE(HAVE_NCURSES_H,1,[Define to 1 if we have ncurses.h])
  3619. ;;
  3620. esac
  3621. case $cf_cv_ncurses_header in # (vi
  3622. ncurses/curses.h|ncurses/ncurses.h)
  3623. AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Define to 1 if we have ncurses/ncurses.h])
  3624. ;;
  3625. ncursesw/curses.h|ncursesw/ncurses.h)
  3626. AC_DEFINE(HAVE_NCURSESW_NCURSES_H,1,[Define to 1 if we have ncursesw/ncurses.h])
  3627. ;;
  3628. esac
  3629. ])dnl
  3630. dnl ---------------------------------------------------------------------------
  3631. dnl CF_NCURSES_LIBS version: 16 updated: 2010/11/20 17:02:38
  3632. dnl ---------------
  3633. dnl Look for the ncurses library. This is a little complicated on Linux,
  3634. dnl because it may be linked with the gpm (general purpose mouse) library.
  3635. dnl Some distributions have gpm linked with (bsd) curses, which makes it
  3636. dnl unusable with ncurses. However, we don't want to link with gpm unless
  3637. dnl ncurses has a dependency, since gpm is normally set up as a shared library,
  3638. dnl and the linker will record a dependency.
  3639. dnl
  3640. dnl The optional parameter gives the root name of the library, in case it is
  3641. dnl not installed as the default curses library. That is how the
  3642. dnl wide-character version of ncurses is installed.
  3643. AC_DEFUN([CF_NCURSES_LIBS],
  3644. [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
  3645. cf_nculib_root=ifelse($1,,ncurses,$1)
  3646. # This works, except for the special case where we find gpm, but
  3647. # ncurses is in a nonstandard location via $LIBS, and we really want
  3648. # to link gpm.
  3649. cf_ncurses_LIBS=""
  3650. cf_ncurses_SAVE="$LIBS"
  3651. AC_CHECK_LIB(gpm,Gpm_Open,
  3652. [AC_CHECK_LIB(gpm,initscr,
  3653. [LIBS="$cf_ncurses_SAVE"],
  3654. [cf_ncurses_LIBS="-lgpm"])])
  3655. case $host_os in #(vi
  3656. freebsd*)
  3657. # This is only necessary if you are linking against an obsolete
  3658. # version of ncurses (but it should do no harm, since it's static).
  3659. if test "$cf_nculib_root" = ncurses ; then
  3660. AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
  3661. fi
  3662. ;;
  3663. esac
  3664. CF_ADD_LIBS($cf_ncurses_LIBS)
  3665. if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
  3666. then
  3667. CF_ADD_LIBS(-l$cf_nculib_root)
  3668. else
  3669. CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
  3670. [#include <${cf_cv_ncurses_header:-curses.h}>],
  3671. [initscr()],
  3672. initscr)
  3673. fi
  3674. if test -n "$cf_ncurses_LIBS" ; then
  3675. AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
  3676. cf_ncurses_SAVE="$LIBS"
  3677. for p in $cf_ncurses_LIBS ; do
  3678. q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
  3679. if test "$q" != "$LIBS" ; then
  3680. LIBS="$q"
  3681. fi
  3682. done
  3683. AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
  3684. [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
  3685. [AC_MSG_RESULT(yes)],
  3686. [AC_MSG_RESULT(no)
  3687. LIBS="$cf_ncurses_SAVE"])
  3688. fi
  3689. CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
  3690. AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
  3691. ])dnl
  3692. dnl ---------------------------------------------------------------------------
  3693. dnl CF_NCURSES_VERSION version: 14 updated: 2012/10/06 08:57:51
  3694. dnl ------------------
  3695. dnl Check for the version of ncurses, to aid in reporting bugs, etc.
  3696. dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
  3697. dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
  3698. AC_DEFUN([CF_NCURSES_VERSION],
  3699. [
  3700. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  3701. AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
  3702. cf_cv_ncurses_version=no
  3703. cf_tempfile=out$$
  3704. rm -f $cf_tempfile
  3705. AC_TRY_RUN([
  3706. #include <${cf_cv_ncurses_header:-curses.h}>
  3707. #include <stdio.h>
  3708. int main()
  3709. {
  3710. FILE *fp = fopen("$cf_tempfile", "w");
  3711. #ifdef NCURSES_VERSION
  3712. # ifdef NCURSES_VERSION_PATCH
  3713. fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
  3714. # else
  3715. fprintf(fp, "%s\n", NCURSES_VERSION);
  3716. # endif
  3717. #else
  3718. # ifdef __NCURSES_H
  3719. fprintf(fp, "old\n");
  3720. # else
  3721. make an error
  3722. # endif
  3723. #endif
  3724. ${cf_cv_main_return:-return}(0);
  3725. }],[
  3726. cf_cv_ncurses_version=`cat $cf_tempfile`],,[
  3727. # This will not work if the preprocessor splits the line after the
  3728. # Autoconf token. The 'unproto' program does that.
  3729. cat > conftest.$ac_ext <<EOF
  3730. #include <${cf_cv_ncurses_header:-curses.h}>
  3731. #undef Autoconf
  3732. #ifdef NCURSES_VERSION
  3733. Autoconf NCURSES_VERSION
  3734. #else
  3735. #ifdef __NCURSES_H
  3736. Autoconf "old"
  3737. #endif
  3738. ;
  3739. #endif
  3740. EOF
  3741. cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
  3742. AC_TRY_EVAL(cf_try)
  3743. if test -f conftest.out ; then
  3744. cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
  3745. test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
  3746. rm -f conftest.out
  3747. fi
  3748. ])
  3749. rm -f $cf_tempfile
  3750. ])
  3751. test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES,1,[Define to 1 if we are using ncurses headers/libraries])
  3752. ])dnl
  3753. dnl ---------------------------------------------------------------------------
  3754. dnl CF_NETLIBS version: 10 updated: 2013/10/08 17:47:05
  3755. dnl ----------
  3756. dnl After checking for functions in the default $LIBS, make a further check
  3757. dnl for the functions that are netlib-related (these aren't always in the
  3758. dnl libc, etc., and have to be handled specially because there are conflicting
  3759. dnl and broken implementations.
  3760. dnl Common library requirements (in order):
  3761. dnl -lresolv -lsocket -lnsl
  3762. dnl -lnsl -lsocket
  3763. dnl -lsocket
  3764. dnl -lbsd
  3765. dnl -lnetwork
  3766. AC_DEFUN([CF_NETLIBS],[
  3767. cf_test_netlibs=no
  3768. AC_MSG_CHECKING(for network libraries)
  3769. AC_CACHE_VAL(cf_cv_netlibs,[
  3770. AC_MSG_RESULT(working...)
  3771. cf_cv_netlibs=""
  3772. cf_test_netlibs=yes
  3773. case $host_os in #(vi
  3774. mingw*) # (vi
  3775. AC_CHECK_HEADERS( windows.h winsock.h winsock2.h )
  3776. if test "$ac_cv_header_winsock2_h" = "yes" ; then
  3777. cf_winsock_lib="-lws2_32"
  3778. elif test "$ac_cv_header_winsock_h" = "yes" ; then
  3779. cf_winsock_lib="-lwsock32"
  3780. fi
  3781. cf_save_LIBS="$LIBS"
  3782. CF_ADD_LIBS($cf_winsock_lib)
  3783. AC_TRY_LINK([
  3784. #ifdef HAVE_WINDOWS_H
  3785. #undef WIN32_LEAN_AND_MEAN
  3786. #define WIN32_LEAN_AND_MEAN
  3787. #include <windows.h>
  3788. #ifdef HAVE_WINSOCK2_H
  3789. #include <winsock2.h>
  3790. #else
  3791. #ifdef HAVE_WINSOCK_H
  3792. #include <winsock.h>
  3793. #endif
  3794. #endif
  3795. #endif
  3796. ],[
  3797. char buffer[1024];
  3798. gethostname(buffer, sizeof(buffer));],
  3799. [cf_cv_netlibs="$cf_winsock_lib $cf_cv_netlibs"],
  3800. [AC_MSG_ERROR(Cannot link against winsock library)])
  3801. LIBS="$cf_save_LIBS"
  3802. ;;
  3803. *)
  3804. AC_CHECK_FUNCS(gethostname,,[
  3805. CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
  3806. CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
  3807. AC_CHECK_LIB(inet, main, cf_cv_netlibs="-linet $cf_cv_netlibs")
  3808. if test "$ac_cv_func_lsocket" != no ; then
  3809. AC_CHECK_FUNCS(socket,,[
  3810. CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
  3811. CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
  3812. fi
  3813. AC_CHECK_FUNCS(gethostbyname,,[
  3814. CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
  3815. AC_CHECK_FUNCS(inet_ntoa,,[
  3816. CF_RECHECK_FUNC(inet_ntoa,nsl,cf_cv_netlibs)])
  3817. AC_CHECK_FUNCS(gethostbyname,,[
  3818. CF_RECHECK_FUNC(gethostbyname,network,cf_cv_netlibs)])
  3819. AC_CHECK_FUNCS(strcasecmp,,[
  3820. CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)])
  3821. ;;
  3822. esac
  3823. ])
  3824. case $cf_cv_netlibs in #(vi
  3825. *ws2_32*)
  3826. AC_DEFINE(USE_WINSOCK2_H,1,[Define to 1 if we should include winsock2.h])
  3827. ;;
  3828. esac
  3829. CF_ADD_LIBS($cf_cv_netlibs)
  3830. test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
  3831. ])dnl
  3832. dnl ---------------------------------------------------------------------------
  3833. dnl CF_NGROUPS version: 4 updated: 2012/11/08 20:57:52
  3834. dnl ----------
  3835. dnl Check for the symbol NGROUPS
  3836. AC_DEFUN([CF_NGROUPS],
  3837. [
  3838. AC_MSG_CHECKING(if NGROUPS is defined)
  3839. AC_CACHE_VAL(cf_cv_ngroups,[
  3840. AC_TRY_COMPILE([
  3841. #if HAVE_SYS_PARAM_H
  3842. #include <sys/param.h>
  3843. #endif
  3844. #if HAVE_LIMITS_H
  3845. #include <limits.h>
  3846. #endif
  3847. ],[int x = NGROUPS],
  3848. [cf_cv_ngroups=yes],
  3849. [AC_TRY_COMPILE([
  3850. #if HAVE_SYS_PARAM_H
  3851. #include <sys/param.h>
  3852. #endif
  3853. #if HAVE_LIMITS_H
  3854. #include <limits.h>
  3855. #endif
  3856. ],[int x = NGROUPS_MAX],
  3857. [cf_cv_ngroups=NGROUPS_MAX],
  3858. [cf_cv_ngroups=no])
  3859. ])
  3860. AC_MSG_RESULT($cf_cv_ngroups)
  3861. ])
  3862. if test "$cf_cv_ngroups" = no ; then
  3863. AC_DEFINE(NGROUPS,16,[Define to maximum number of groups])
  3864. elif test "$cf_cv_ngroups" = NGROUPS_MAX ; then
  3865. AC_DEFINE(NGROUPS,NGROUPS_MAX)
  3866. fi
  3867. ])dnl
  3868. dnl ---------------------------------------------------------------------------
  3869. dnl CF_NO_LEAKS_OPTION version: 5 updated: 2012/10/02 20:55:03
  3870. dnl ------------------
  3871. dnl see CF_WITH_NO_LEAKS
  3872. AC_DEFUN([CF_NO_LEAKS_OPTION],[
  3873. AC_MSG_CHECKING(if you want to use $1 for testing)
  3874. AC_ARG_WITH($1,
  3875. [$2],
  3876. [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[
  3877. $4
  3878. ])
  3879. : ${with_cflags:=-g}
  3880. : ${with_no_leaks:=yes}
  3881. with_$1=yes],
  3882. [with_$1=])
  3883. AC_MSG_RESULT(${with_$1:-no})
  3884. case .$with_cflags in #(vi
  3885. .*-g*)
  3886. case .$CFLAGS in #(vi
  3887. .*-g*) #(vi
  3888. ;;
  3889. *)
  3890. CF_ADD_CFLAGS([-g])
  3891. ;;
  3892. esac
  3893. ;;
  3894. esac
  3895. ])dnl
  3896. dnl ---------------------------------------------------------------------------
  3897. dnl CF_NSS_COMPAT version: 4 updated: 2012/11/08 20:57:52
  3898. dnl -------------
  3899. dnl Check for NSS compatible SSL libraries
  3900. dnl $1 = the [optional] directory in which the library may be found
  3901. AC_DEFUN([CF_NSS_COMPAT],[
  3902. check=`pkg-config --version 2>/dev/null`
  3903. if test -n "$check" ; then
  3904. cf_ssl_library=`pkg-config --libs nss`
  3905. cf_ssl_cflags=`pkg-config --cflags nss`
  3906. else
  3907. # Without pkg-config, we'll kludge in some defaults
  3908. cf_ssl_library="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
  3909. cf_ssl_cflags="-I/usr/include/nss3 -I/usr/include/nspr4"
  3910. fi
  3911. cf_ssl_library="-lnss_compat_ossl $cf_ssl_library"
  3912. case "$1" in #(vi
  3913. no) #(vi
  3914. cf_ssl_root=
  3915. ;;
  3916. yes) #(vi
  3917. AC_CHECK_LIB(nss_compat_ossl, SSL_get_version,[],[
  3918. cf_ssl_root=/usr/local/nss_compat_ossl
  3919. if test -d $cf_ssl_root ; then
  3920. CF_VERBOSE(assume it is in $cf_ssl_root)
  3921. cf_ssl_library="-L$cf_ssl_root/lib $cf_ssl_library"
  3922. else
  3923. AC_MSG_ERROR(cannot find NSS compilant libraries)
  3924. fi
  3925. ],
  3926. [-lnss_compat_ossl])
  3927. ;;
  3928. *)
  3929. if test -d $1 ; then
  3930. if test -d $1/include ; then
  3931. cf_ssl_root=$1
  3932. elif test -d $1/../include ; then
  3933. cf_ssl_root=$1/..
  3934. else
  3935. AC_MSG_ERROR(cannot find NSS compilant library under $1)
  3936. fi
  3937. cf_ssl_library="-L$cf_ssl_root/lib $cf_ssl_library"
  3938. else
  3939. AC_MSG_WARN(expected a directory: $1)
  3940. fi
  3941. ;;
  3942. esac
  3943. CF_ADD_LIBS($cf_ssl_library)
  3944. cf_ssl_subincs=yes
  3945. if test -n "$cf_ssl_root" ; then
  3946. if test -d $cf_ssl_root/include ; then
  3947. cf_ssl_cflags="-I$cf_ssl_root/include $cf_ssl_cflags"
  3948. test -d $cf_ssl_root/include/nss_compat_ossl || cf_ssl_subincs=no
  3949. fi
  3950. fi
  3951. CF_ADD_CFLAGS($cf_ssl_cflags)
  3952. if test "$cf_ssl_subincs" = yes ; then
  3953. AC_MSG_CHECKING(for NSS compilant include directory)
  3954. AC_TRY_COMPILE([
  3955. #include <stdio.h>
  3956. #include <nss_compat_ossl/nss_compat_ossl.h>],
  3957. [SSL_shutdown((SSL *)0)],
  3958. [cf_ssl_incl=yes],
  3959. [cf_ssl_incl=no])
  3960. AC_MSG_RESULT($cf_ssl_incl)
  3961. test "$cf_ssl_incl" = yes && AC_DEFINE(USE_NSS_COMPAT_INCL,1,[Define to 1 if we should use nss compatibility header])
  3962. fi
  3963. AC_MSG_CHECKING(if we can link to NSS compilant library)
  3964. AC_TRY_LINK([
  3965. #include <stdio.h>
  3966. #ifdef USE_NSS_COMPAT_INCL
  3967. #include <nss_compat_ossl/nss_compat_ossl.h>
  3968. #else
  3969. #include <ssl.h>
  3970. #endif
  3971. ],
  3972. [SSL_shutdown((SSL *)0)],
  3973. [cf_ssl_library=yes],
  3974. [cf_ssl_library=no])
  3975. AC_MSG_RESULT($cf_ssl_library)
  3976. if test "$cf_ssl_library" = yes ; then
  3977. AC_DEFINE(USE_SSL,1,[Define to 1 if we should use SSL])
  3978. AC_DEFINE(USE_X509_SUPPORT,1,[Define to 1 if the SSL library provides X509 support])
  3979. else
  3980. AC_MSG_ERROR(Cannot link with NSS compilant libraries)
  3981. fi
  3982. ])dnl
  3983. dnl ---------------------------------------------------------------------------
  3984. dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
  3985. dnl ---------------
  3986. dnl Check if we use the messages included with this program
  3987. dnl
  3988. dnl $1 specifies either Makefile or makefile, defaulting to the former.
  3989. dnl
  3990. dnl Sets variables which can be used to substitute in makefiles:
  3991. dnl MSG_DIR_MAKE - to make ./po directory
  3992. dnl SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL)
  3993. dnl
  3994. AC_DEFUN([CF_OUR_MESSAGES],
  3995. [
  3996. cf_makefile=ifelse($1,,Makefile,$1)
  3997. use_our_messages=no
  3998. if test "$USE_NLS" = yes ; then
  3999. if test -d $srcdir/po ; then
  4000. AC_MSG_CHECKING(if we should use included message-library)
  4001. AC_ARG_ENABLE(included-msgs,
  4002. [ --disable-included-msgs use included messages, for i18n support],
  4003. [use_our_messages=$enableval],
  4004. [use_our_messages=yes])
  4005. fi
  4006. AC_MSG_RESULT($use_our_messages)
  4007. fi
  4008. MSG_DIR_MAKE="#"
  4009. if test "$use_our_messages" = yes
  4010. then
  4011. SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
  4012. MSG_DIR_MAKE=
  4013. fi
  4014. AC_SUBST(MSG_DIR_MAKE)
  4015. AC_SUBST(SUB_MAKEFILE)
  4016. ])dnl
  4017. dnl ---------------------------------------------------------------------------
  4018. dnl CF_PATHSEP version: 6 updated: 2012/09/29 18:38:12
  4019. dnl ----------
  4020. dnl Provide a value for the $PATH and similar separator (or amend the value
  4021. dnl as provided in autoconf 2.5x).
  4022. AC_DEFUN([CF_PATHSEP],
  4023. [
  4024. AC_MSG_CHECKING(for PATH separator)
  4025. case $cf_cv_system_name in
  4026. os2*) PATH_SEPARATOR=';' ;;
  4027. *) ${PATH_SEPARATOR:=':'} ;;
  4028. esac
  4029. ifelse([$1],,,[$1=$PATH_SEPARATOR])
  4030. AC_SUBST(PATH_SEPARATOR)
  4031. AC_MSG_RESULT($PATH_SEPARATOR)
  4032. ])dnl
  4033. dnl ---------------------------------------------------------------------------
  4034. dnl CF_PATH_PROG version: 9 updated: 2012/10/04 20:12:20
  4035. dnl ------------
  4036. dnl Check for a given program, defining corresponding symbol.
  4037. dnl $1 = environment variable, which is suffixed by "_PATH" in the #define.
  4038. dnl $2 = program name to find.
  4039. dnl $3 = optional list of additional program names to test.
  4040. dnl
  4041. dnl If there is more than one token in the result, #define the remaining tokens
  4042. dnl to $1_ARGS. We need this for 'install' in particular.
  4043. dnl
  4044. dnl FIXME: we should allow this to be overridden by environment variables
  4045. dnl
  4046. AC_DEFUN([CF_PATH_PROG],[
  4047. AC_REQUIRE([CF_PATHSEP])
  4048. test -z "[$]$1" && $1=$2
  4049. AC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1)
  4050. cf_path_prog=""
  4051. cf_path_args=""
  4052. IFS="${IFS:- }"; cf_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR"
  4053. for cf_temp in $ac_cv_path_$1
  4054. do
  4055. if test -z "$cf_path_prog" ; then
  4056. if test "$with_full_paths" = yes ; then
  4057. CF_PATH_SYNTAX(cf_temp,break)
  4058. cf_path_prog="$cf_temp"
  4059. else
  4060. cf_path_prog="`basename $cf_temp`"
  4061. fi
  4062. elif test -z "$cf_path_args" ; then
  4063. cf_path_args="$cf_temp"
  4064. else
  4065. cf_path_args="$cf_path_args $cf_temp"
  4066. fi
  4067. done
  4068. IFS="$cf_save_ifs"
  4069. if test -n "$cf_path_prog" ; then
  4070. CF_MSG_LOG(defining path for ${cf_path_prog})
  4071. AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog",Define to pathname $1)
  4072. test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args",Define to provide args for $1)
  4073. fi
  4074. ])dnl
  4075. dnl ---------------------------------------------------------------------------
  4076. dnl CF_PATH_SYNTAX version: 14 updated: 2012/06/19 20:58:54
  4077. dnl --------------
  4078. dnl Check the argument to see that it looks like a pathname. Rewrite it if it
  4079. dnl begins with one of the prefix/exec_prefix variables, and then again if the
  4080. dnl result begins with 'NONE'. This is necessary to work around autoconf's
  4081. dnl delayed evaluation of those symbols.
  4082. AC_DEFUN([CF_PATH_SYNTAX],[
  4083. if test "x$prefix" != xNONE; then
  4084. cf_path_syntax="$prefix"
  4085. else
  4086. cf_path_syntax="$ac_default_prefix"
  4087. fi
  4088. case ".[$]$1" in #(vi
  4089. .\[$]\(*\)*|.\'*\'*) #(vi
  4090. ;;
  4091. ..|./*|.\\*) #(vi
  4092. ;;
  4093. .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
  4094. ;;
  4095. .\[$]{*prefix}*|.\[$]{*dir}*) #(vi
  4096. eval $1="[$]$1"
  4097. case ".[$]$1" in #(vi
  4098. .NONE/*)
  4099. $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
  4100. ;;
  4101. esac
  4102. ;; #(vi
  4103. .no|.NONE/*)
  4104. $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
  4105. ;;
  4106. *)
  4107. ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
  4108. ;;
  4109. esac
  4110. ])dnl
  4111. dnl ---------------------------------------------------------------------------
  4112. dnl CF_PDCURSES_W32 version: 1 updated: 2013/10/07 06:13:11
  4113. dnl ---------------
  4114. dnl Configure for PDCurses' Win32 library, checking for definitions as well
  4115. dnl which are needed to use its header file correctly.
  4116. AC_DEFUN([CF_PDCURSES_W32],[
  4117. AC_CHECK_LIB(pdcurses,initscr,[
  4118. CF_ADD_LIBS(-lpdcurses)
  4119. cf_cv_term_header=no
  4120. cf_cv_unctrl_header=no
  4121. AC_CHECK_FUNC(winwstr,[AC_DEFINE(PDC_WIDE)])
  4122. AC_CHECK_FUNC(pdcurses_dll_iname,[AC_DEFINE(PDC_DLL_BUILD)])
  4123. ])
  4124. ])dnl
  4125. dnl ---------------------------------------------------------------------------
  4126. dnl CF_PDCURSES_X11 version: 13 updated: 2012/10/06 16:39:58
  4127. dnl ---------------
  4128. dnl Configure for PDCurses' X11 library
  4129. AC_DEFUN([CF_PDCURSES_X11],[
  4130. AC_REQUIRE([CF_X_ATHENA])
  4131. CF_ACVERSION_CHECK(2.52,
  4132. [AC_CHECK_TOOLS(XCURSES_CONFIG, xcurses-config, none)],
  4133. [AC_PATH_PROGS(XCURSES_CONFIG, xcurses-config, none)])
  4134. if test "$XCURSES_CONFIG" != none ; then
  4135. CPPFLAGS="$CPPFLAGS `$XCURSES_CONFIG --cflags`"
  4136. CF_ADD_LIBS(`$XCURSES_CONFIG --libs`)
  4137. cf_cv_lib_XCurses=yes
  4138. else
  4139. LDFLAGS="$LDFLAGS $X_LIBS"
  4140. CF_CHECK_CFLAGS($X_CFLAGS)
  4141. AC_CHECK_LIB(X11,XOpenDisplay,
  4142. [CF_ADD_LIBS(-lX11)],,
  4143. [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
  4144. AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
  4145. CF_ADD_LIBS(-lXCurses)
  4146. AC_TRY_LINK([
  4147. #include <xcurses.h>
  4148. char *XCursesProgramName = "test";
  4149. ],[XCursesExit();],
  4150. [cf_cv_lib_XCurses=yes],
  4151. [cf_cv_lib_XCurses=no])
  4152. ])
  4153. fi
  4154. if test $cf_cv_lib_XCurses = yes ; then
  4155. AC_DEFINE(UNIX,1,[Define to 1 if using PDCurses on Unix])
  4156. AC_DEFINE(XCURSES,1,[Define to 1 if using PDCurses on Unix])
  4157. AC_CHECK_HEADER(xcurses.h, AC_DEFINE(HAVE_XCURSES,1,[Define to 1 if using PDCurses on Unix]))
  4158. else
  4159. AC_MSG_ERROR(Cannot link with XCurses)
  4160. fi
  4161. ])dnl
  4162. dnl ---------------------------------------------------------------------------
  4163. dnl CF_PKG_CONFIG version: 7 updated: 2011/04/29 04:53:22
  4164. dnl -------------
  4165. dnl Check for the package-config program, unless disabled by command-line.
  4166. AC_DEFUN([CF_PKG_CONFIG],
  4167. [
  4168. AC_MSG_CHECKING(if you want to use pkg-config)
  4169. AC_ARG_WITH(pkg-config,
  4170. [ --with-pkg-config{=path} enable/disable use of pkg-config],
  4171. [cf_pkg_config=$withval],
  4172. [cf_pkg_config=yes])
  4173. AC_MSG_RESULT($cf_pkg_config)
  4174. case $cf_pkg_config in #(vi
  4175. no) #(vi
  4176. PKG_CONFIG=none
  4177. ;;
  4178. yes) #(vi
  4179. CF_ACVERSION_CHECK(2.52,
  4180. [AC_PATH_TOOL(PKG_CONFIG, pkg-config, none)],
  4181. [AC_PATH_PROG(PKG_CONFIG, pkg-config, none)])
  4182. ;;
  4183. *)
  4184. PKG_CONFIG=$withval
  4185. ;;
  4186. esac
  4187. test -z "$PKG_CONFIG" && PKG_CONFIG=none
  4188. if test "$PKG_CONFIG" != none ; then
  4189. CF_PATH_SYNTAX(PKG_CONFIG)
  4190. fi
  4191. AC_SUBST(PKG_CONFIG)
  4192. ])dnl
  4193. dnl ---------------------------------------------------------------------------
  4194. dnl CF_POSIX_C_SOURCE version: 8 updated: 2010/05/26 05:38:42
  4195. dnl -----------------
  4196. dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
  4197. dnl
  4198. dnl POSIX.1-1990 _POSIX_SOURCE
  4199. dnl POSIX.1-1990 and _POSIX_SOURCE and
  4200. dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
  4201. dnl Bindings Option
  4202. dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
  4203. dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
  4204. dnl X/Open 2000 _POSIX_C_SOURCE=200112L
  4205. dnl
  4206. dnl Parameters:
  4207. dnl $1 is the nominal value for _POSIX_C_SOURCE
  4208. AC_DEFUN([CF_POSIX_C_SOURCE],
  4209. [
  4210. cf_POSIX_C_SOURCE=ifelse([$1],,199506L,[$1])
  4211. cf_save_CFLAGS="$CFLAGS"
  4212. cf_save_CPPFLAGS="$CPPFLAGS"
  4213. CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
  4214. CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
  4215. AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
  4216. CF_MSG_LOG(if the symbol is already defined go no further)
  4217. AC_TRY_COMPILE([#include <sys/types.h>],[
  4218. #ifndef _POSIX_C_SOURCE
  4219. make an error
  4220. #endif],
  4221. [cf_cv_posix_c_source=no],
  4222. [cf_want_posix_source=no
  4223. case .$cf_POSIX_C_SOURCE in #(vi
  4224. .[[12]]??*) #(vi
  4225. cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
  4226. ;;
  4227. .2) #(vi
  4228. cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
  4229. cf_want_posix_source=yes
  4230. ;;
  4231. .*)
  4232. cf_want_posix_source=yes
  4233. ;;
  4234. esac
  4235. if test "$cf_want_posix_source" = yes ; then
  4236. AC_TRY_COMPILE([#include <sys/types.h>],[
  4237. #ifdef _POSIX_SOURCE
  4238. make an error
  4239. #endif],[],
  4240. cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
  4241. fi
  4242. CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
  4243. CFLAGS="$cf_trim_CFLAGS"
  4244. CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
  4245. CF_MSG_LOG(if the second compile does not leave our definition intact error)
  4246. AC_TRY_COMPILE([#include <sys/types.h>],[
  4247. #ifndef _POSIX_C_SOURCE
  4248. make an error
  4249. #endif],,
  4250. [cf_cv_posix_c_source=no])
  4251. CFLAGS="$cf_save_CFLAGS"
  4252. CPPFLAGS="$cf_save_CPPFLAGS"
  4253. ])
  4254. ])
  4255. if test "$cf_cv_posix_c_source" != no ; then
  4256. CFLAGS="$cf_trim_CFLAGS"
  4257. CPPFLAGS="$cf_trim_CPPFLAGS"
  4258. CF_ADD_CFLAGS($cf_cv_posix_c_source)
  4259. fi
  4260. ])dnl
  4261. dnl ---------------------------------------------------------------------------
  4262. dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
  4263. dnl ----------
  4264. dnl Check for archiver "ar".
  4265. AC_DEFUN([CF_PROG_AR],[
  4266. AC_CHECK_TOOL(AR, ar, ar)
  4267. ])
  4268. dnl ---------------------------------------------------------------------------
  4269. dnl CF_PROG_CC version: 3 updated: 2012/10/06 15:31:55
  4270. dnl ----------
  4271. dnl standard check for CC, plus followup sanity checks
  4272. dnl $1 = optional parameter to pass to AC_PROG_CC to specify compiler name
  4273. AC_DEFUN([CF_PROG_CC],[
  4274. ifelse($1,,[AC_PROG_CC],[AC_PROG_CC($1)])
  4275. CF_GCC_VERSION
  4276. CF_ACVERSION_CHECK(2.52,
  4277. [AC_PROG_CC_STDC],
  4278. [CF_ANSI_CC_REQD])
  4279. CF_CC_ENV_FLAGS
  4280. ])dnl
  4281. dnl ---------------------------------------------------------------------------
  4282. dnl CF_PROG_EXT version: 11 updated: 2012/10/06 08:57:51
  4283. dnl -----------
  4284. dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
  4285. AC_DEFUN([CF_PROG_EXT],
  4286. [
  4287. AC_REQUIRE([CF_CHECK_CACHE])
  4288. case $cf_cv_system_name in
  4289. os2*)
  4290. CFLAGS="$CFLAGS -Zmt"
  4291. CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
  4292. CXXFLAGS="$CXXFLAGS -Zmt"
  4293. # autoconf's macro sets -Zexe and suffix both, which conflict:w
  4294. LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
  4295. ac_cv_exeext=.exe
  4296. ;;
  4297. esac
  4298. AC_EXEEXT
  4299. AC_OBJEXT
  4300. PROG_EXT="$EXEEXT"
  4301. AC_SUBST(PROG_EXT)
  4302. test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT",[Define to the program extension (normally blank)])
  4303. ])dnl
  4304. dnl ---------------------------------------------------------------------------
  4305. dnl CF_PROG_LINT version: 2 updated: 2009/08/12 04:43:14
  4306. dnl ------------
  4307. AC_DEFUN([CF_PROG_LINT],
  4308. [
  4309. AC_CHECK_PROGS(LINT, tdlint lint alint splint lclint)
  4310. AC_SUBST(LINT_OPTS)
  4311. ])dnl
  4312. dnl ---------------------------------------------------------------------------
  4313. dnl CF_PROG_RANLIB version: 1 updated: 2009/01/01 20:15:22
  4314. dnl --------------
  4315. dnl Check for ranlib.
  4316. dnl
  4317. dnl TODO: make this conditionally depend on autoconf version, since the later
  4318. dnl versions of autoconf use check-tool.
  4319. AC_DEFUN([CF_PROG_RANLIB],[
  4320. AC_CHECK_TOOL(RANLIB, ranlib, ':')
  4321. ])
  4322. dnl ---------------------------------------------------------------------------
  4323. dnl CF_RECHECK_FUNC version: 3 updated: 2000/10/18 19:29:13
  4324. dnl ---------------
  4325. dnl Re-check on a function to see if we can pick it up by adding a library.
  4326. dnl $1 = function to check
  4327. dnl $2 = library to check in
  4328. dnl $3 = environment to update (e.g., $LIBS)
  4329. dnl $4 = what to do if this fails
  4330. dnl
  4331. dnl This uses 'unset' if the shell happens to support it, but leaves the
  4332. dnl configuration variable set to 'unknown' if not. This is a little better
  4333. dnl than the normal autoconf test, which gives misleading results if a test
  4334. dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
  4335. dnl used (autoconf does not distinguish between a null token and one that is
  4336. dnl set to 'no').
  4337. AC_DEFUN([CF_RECHECK_FUNC],[
  4338. AC_CHECK_LIB($2,$1,[
  4339. CF_UPPER(cf_tr_func,$1)
  4340. AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func)
  4341. ac_cv_func_$1=yes
  4342. if test "$cf_used_lib_$2" != yes ; then cf_used_lib_$2=yes; $3="-l$2 [$]$3"; fi],[
  4343. ac_cv_func_$1=unknown
  4344. unset ac_cv_func_$1 2>/dev/null
  4345. $4],
  4346. [[$]$3])
  4347. ])dnl
  4348. dnl ---------------------------------------------------------------------------
  4349. dnl CF_REMOVE_BROKEN version: 4 updated: 2012/11/08 20:57:52
  4350. dnl ----------------
  4351. dnl Check for broken definition of 'remove()'. This is (in particular) broken
  4352. dnl on the older version of SCO (I'd cite version if I knew where to look) by
  4353. dnl having <stdio.h> #define remove to __unlink, which appears in no library.
  4354. dnl
  4355. dnl Fortuitously, we can combine this with a more general test: do we have
  4356. dnl 'unlink()' but no 'remove()'. Note, however, that we cannot simply #define
  4357. dnl remove to unlink, but have to make a fallback function.
  4358. dnl
  4359. AC_DEFUN([CF_REMOVE_BROKEN],
  4360. [
  4361. AC_MSG_CHECKING(for broken/missing definition of remove)
  4362. AC_CACHE_VAL(cf_cv_baddef_remove,[
  4363. AC_TRY_LINK(
  4364. [#include <stdio.h>],
  4365. [remove("dummy")],
  4366. [cf_cv_baddef_remove=no],
  4367. [AC_TRY_LINK(
  4368. [#include <stdio.h>
  4369. int __unlink(name) { return unlink(name); } ],
  4370. [remove("dummy")],
  4371. [cf_cv_baddef_remove=yes],
  4372. [cf_cv_baddef_remove=unknown])
  4373. ])
  4374. ])
  4375. AC_MSG_RESULT($cf_cv_baddef_remove)
  4376. test "$cf_cv_baddef_remove" != no && AC_DEFINE(NEED_REMOVE,1,[Define to 1 if we should use remove rather than unlink])
  4377. ])dnl
  4378. dnl ---------------------------------------------------------------------------
  4379. dnl CF_REMOVE_DEFINE version: 3 updated: 2010/01/09 11:05:50
  4380. dnl ----------------
  4381. dnl Remove all -U and -D options that refer to the given symbol from a list
  4382. dnl of C compiler options. This works around the problem that not all
  4383. dnl compilers process -U and -D options from left-to-right, so a -U option
  4384. dnl cannot be used to cancel the effect of a preceding -D option.
  4385. dnl
  4386. dnl $1 = target (which could be the same as the source variable)
  4387. dnl $2 = source (including '$')
  4388. dnl $3 = symbol to remove
  4389. define([CF_REMOVE_DEFINE],
  4390. [
  4391. $1=`echo "$2" | \
  4392. sed -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[[ ]]/ /g' \
  4393. -e 's/-[[UD]]'"$3"'\(=[[^ ]]*\)\?[$]//g'`
  4394. ])dnl
  4395. dnl ---------------------------------------------------------------------------
  4396. dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00
  4397. dnl -------------
  4398. AC_DEFUN([CF_RPATH_HACK],
  4399. [
  4400. AC_REQUIRE([CF_LD_RPATH_OPT])
  4401. AC_MSG_CHECKING(for updated LDFLAGS)
  4402. if test -n "$LD_RPATH_OPT" ; then
  4403. AC_MSG_RESULT(maybe)
  4404. AC_CHECK_PROGS(cf_ldd_prog,ldd,no)
  4405. cf_rpath_list="/usr/lib /lib"
  4406. if test "$cf_ldd_prog" != no
  4407. then
  4408. cf_rpath_oops=
  4409. AC_TRY_LINK([#include <stdio.h>],
  4410. [printf("Hello");],
  4411. [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq`
  4412. cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`])
  4413. # If we passed the link-test, but get a "not found" on a given library,
  4414. # this could be due to inept reconfiguration of gcc to make it only
  4415. # partly honor /usr/local/lib (or whatever). Sometimes this behavior
  4416. # is intentional, e.g., installing gcc in /usr/bin and suppressing the
  4417. # /usr/local libraries.
  4418. if test -n "$cf_rpath_oops"
  4419. then
  4420. for cf_rpath_src in $cf_rpath_oops
  4421. do
  4422. for cf_rpath_dir in \
  4423. /usr/local \
  4424. /usr/pkg \
  4425. /opt/sfw
  4426. do
  4427. if test -f $cf_rpath_dir/lib/$cf_rpath_src
  4428. then
  4429. CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src)
  4430. LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib"
  4431. break
  4432. fi
  4433. done
  4434. done
  4435. fi
  4436. fi
  4437. CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
  4438. CF_RPATH_HACK_2(LDFLAGS)
  4439. CF_RPATH_HACK_2(LIBS)
  4440. CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
  4441. else
  4442. AC_MSG_RESULT(no)
  4443. fi
  4444. AC_SUBST(EXTRA_LDFLAGS)
  4445. ])dnl
  4446. dnl ---------------------------------------------------------------------------
  4447. dnl CF_RPATH_HACK_2 version: 6 updated: 2010/04/17 16:31:24
  4448. dnl ---------------
  4449. dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to
  4450. dnl EXTRA_LDFLAGS for each -L option found.
  4451. dnl
  4452. dnl $cf_rpath_list contains a list of directories to ignore.
  4453. dnl
  4454. dnl $1 = variable name to update. The LDFLAGS variable should be the only one,
  4455. dnl but LIBS often has misplaced -L options.
  4456. AC_DEFUN([CF_RPATH_HACK_2],
  4457. [
  4458. CF_VERBOSE(...checking $1 [$]$1)
  4459. cf_rpath_dst=
  4460. for cf_rpath_src in [$]$1
  4461. do
  4462. case $cf_rpath_src in #(vi
  4463. -L*) #(vi
  4464. # check if this refers to a directory which we will ignore
  4465. cf_rpath_skip=no
  4466. if test -n "$cf_rpath_list"
  4467. then
  4468. for cf_rpath_item in $cf_rpath_list
  4469. do
  4470. if test "x$cf_rpath_src" = "x-L$cf_rpath_item"
  4471. then
  4472. cf_rpath_skip=yes
  4473. break
  4474. fi
  4475. done
  4476. fi
  4477. if test "$cf_rpath_skip" = no
  4478. then
  4479. # transform the option
  4480. if test "$LD_RPATH_OPT" = "-R " ; then
  4481. cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%-R %"`
  4482. else
  4483. cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e "s%-L%$LD_RPATH_OPT%"`
  4484. fi
  4485. # if we have not already added this, add it now
  4486. cf_rpath_tst=`echo "$EXTRA_LDFLAGS" | sed -e "s%$cf_rpath_tmp %%"`
  4487. if test "x$cf_rpath_tst" = "x$EXTRA_LDFLAGS"
  4488. then
  4489. CF_VERBOSE(...Filter $cf_rpath_src ->$cf_rpath_tmp)
  4490. EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
  4491. fi
  4492. fi
  4493. ;;
  4494. esac
  4495. cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
  4496. done
  4497. $1=$cf_rpath_dst
  4498. CF_VERBOSE(...checked $1 [$]$1)
  4499. AC_SUBST(EXTRA_LDFLAGS)
  4500. ])dnl
  4501. dnl ---------------------------------------------------------------------------
  4502. dnl CF_SET_ERRNO version: 5 updated: 2012/11/08 20:57:52
  4503. dnl ------------
  4504. dnl Check if 'errno' is declared in a fashion that lets us set it.
  4505. AC_DEFUN([CF_SET_ERRNO],
  4506. [
  4507. AC_CACHE_CHECK(if we can set errno,cf_cv_set_errno,[
  4508. AC_TRY_RUN([
  4509. #include <errno.h>
  4510. int main()
  4511. {
  4512. errno = 255;
  4513. ${cf_cv_main_return:-return}(errno != 255);
  4514. }],
  4515. [cf_cv_set_errno=yes],
  4516. [cf_cv_set_errno=no],
  4517. [AC_TRY_LINK(
  4518. [#include <errno.h>],
  4519. [errno = 255],
  4520. [cf_cv_set_errno=maybe],
  4521. [cf_cv_set_errno=no])])
  4522. ])
  4523. test "$cf_cv_set_errno" != no && AC_DEFINE(CAN_SET_ERRNO,1,[Define to 1 if we can set errno])
  4524. ])dnl
  4525. dnl ---------------------------------------------------------------------------
  4526. dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
  4527. dnl -----------
  4528. dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
  4529. dnl programs need this test).
  4530. dnl
  4531. dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
  4532. dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
  4533. dnl winsize declaration is left alone - we may revisit this if Apple choose to
  4534. dnl break that part of the interface as well.
  4535. AC_DEFUN([CF_SIGWINCH],
  4536. [
  4537. AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
  4538. AC_TRY_COMPILE([
  4539. #include <sys/types.h>
  4540. #include <sys/signal.h>
  4541. ],[int x = SIGWINCH],
  4542. [cf_cv_define_sigwinch=yes],
  4543. [AC_TRY_COMPILE([
  4544. #undef _XOPEN_SOURCE
  4545. #undef _POSIX_SOURCE
  4546. #undef _POSIX_C_SOURCE
  4547. #include <sys/types.h>
  4548. #include <sys/signal.h>
  4549. ],[int x = SIGWINCH],
  4550. [cf_cv_define_sigwinch=maybe],
  4551. [cf_cv_define_sigwinch=no])
  4552. ])
  4553. ])
  4554. if test "$cf_cv_define_sigwinch" = maybe ; then
  4555. AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
  4556. cf_cv_fixup_sigwinch=unknown
  4557. cf_sigwinch=32
  4558. while test $cf_sigwinch != 1
  4559. do
  4560. AC_TRY_COMPILE([
  4561. #undef _XOPEN_SOURCE
  4562. #undef _POSIX_SOURCE
  4563. #undef _POSIX_C_SOURCE
  4564. #include <sys/types.h>
  4565. #include <sys/signal.h>
  4566. ],[
  4567. #if SIGWINCH != $cf_sigwinch
  4568. make an error
  4569. #endif
  4570. int x = SIGWINCH],
  4571. [cf_cv_fixup_sigwinch=$cf_sigwinch
  4572. break])
  4573. cf_sigwinch=`expr $cf_sigwinch - 1`
  4574. done
  4575. ])
  4576. if test "$cf_cv_fixup_sigwinch" != unknown ; then
  4577. CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
  4578. fi
  4579. fi
  4580. ])dnl
  4581. dnl ---------------------------------------------------------------------------
  4582. dnl CF_SIZECHANGE version: 9 updated: 2012/10/06 11:17:15
  4583. dnl -------------
  4584. dnl Check for definitions & structures needed for window size-changing
  4585. dnl FIXME: check that this works with "snake" (HP-UX 10.x)
  4586. AC_DEFUN([CF_SIZECHANGE],
  4587. [
  4588. AC_REQUIRE([CF_STRUCT_TERMIOS])
  4589. AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
  4590. cf_cv_sizechange=unknown
  4591. cf_save_CPPFLAGS="$CPPFLAGS"
  4592. for cf_opts in "" "NEED_PTEM_H"
  4593. do
  4594. CPPFLAGS="$cf_save_CPPFLAGS"
  4595. test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
  4596. AC_TRY_COMPILE([#include <sys/types.h>
  4597. #ifdef HAVE_TERMIOS_H
  4598. #include <termios.h>
  4599. #else
  4600. #ifdef HAVE_TERMIO_H
  4601. #include <termio.h>
  4602. #endif
  4603. #endif
  4604. #ifdef NEED_PTEM_H
  4605. /* This is a workaround for SCO: they neglected to define struct winsize in
  4606. * termios.h -- it's only in termio.h and ptem.h
  4607. */
  4608. #include <sys/stream.h>
  4609. #include <sys/ptem.h>
  4610. #endif
  4611. #if !defined(sun) || !defined(HAVE_TERMIOS_H)
  4612. #include <sys/ioctl.h>
  4613. #endif
  4614. ],[
  4615. #ifdef TIOCGSIZE
  4616. struct ttysize win; /* FIXME: what system is this? */
  4617. int y = win.ts_lines;
  4618. int x = win.ts_cols;
  4619. #else
  4620. #ifdef TIOCGWINSZ
  4621. struct winsize win;
  4622. int y = win.ws_row;
  4623. int x = win.ws_col;
  4624. #else
  4625. no TIOCGSIZE or TIOCGWINSZ
  4626. #endif /* TIOCGWINSZ */
  4627. #endif /* TIOCGSIZE */
  4628. ],
  4629. [cf_cv_sizechange=yes],
  4630. [cf_cv_sizechange=no])
  4631. CPPFLAGS="$cf_save_CPPFLAGS"
  4632. if test "$cf_cv_sizechange" = yes ; then
  4633. echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
  4634. test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
  4635. break
  4636. fi
  4637. done
  4638. ])
  4639. if test "$cf_cv_sizechange" != no ; then
  4640. AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechar declarations are provided])
  4641. case $cf_cv_sizechange in #(vi
  4642. NEED*)
  4643. AC_DEFINE_UNQUOTED($cf_cv_sizechange )
  4644. ;;
  4645. esac
  4646. fi
  4647. ])dnl
  4648. dnl ---------------------------------------------------------------------------
  4649. dnl CF_SLANG_CPPFLAGS version: 10 updated: 2012/11/08 20:57:52
  4650. dnl -----------------
  4651. dnl Look for the slang header files in the standard places, adjusting the
  4652. dnl CPPFLAGS variable.
  4653. dnl
  4654. dnl $1 = parameter to search for "slang2" class, e.g., for pkgsrc.
  4655. AC_DEFUN([CF_SLANG_CPPFLAGS],
  4656. [
  4657. AC_CACHE_CHECK(for $1 header file,cf_cv_$1_header,[
  4658. cf_cv_$1_header=no
  4659. AC_TRY_COMPILE([#include <slang.h>],
  4660. [printf("%s\n", SLANG_VERSION)],
  4661. [cf_cv_$1_header=predefined],[
  4662. CF_HEADER_PATH(cf_search,$1)
  4663. for cf_incdir in $cf_search
  4664. do
  4665. for cf_header in \
  4666. slang.h
  4667. do
  4668. echo trying $cf_incdir/$cf_header 1>&AC_FD_CC
  4669. if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&AC_FD_CC 2>&1; then
  4670. cf_cv_$1_header=$cf_incdir/$cf_header
  4671. break
  4672. fi
  4673. done
  4674. test "$cf_cv_$1_header" != no && break
  4675. done
  4676. ])])
  4677. if test "x$cf_cv_$1_header" != xno
  4678. then
  4679. AC_DEFINE(USE_SLANG,1,[Define to 1 if we should use s-lang library])
  4680. CF_DIRNAME(cf_incdir,$cf_cv_$1_header)
  4681. case $cf_cv_$1_header in # (vi
  4682. predefined) # (vi
  4683. ;;
  4684. *)
  4685. CF_ADD_INCDIR($cf_incdir)
  4686. ;;
  4687. esac
  4688. fi
  4689. ])dnl
  4690. dnl ---------------------------------------------------------------------------
  4691. dnl CF_SLANG_LIBS version: 8 updated: 2010/04/03 15:30:05
  4692. dnl -------------
  4693. dnl Look for the slang library.
  4694. dnl
  4695. dnl $1 = the actual library name, usually "slang"
  4696. AC_DEFUN([CF_SLANG_LIBS],
  4697. [
  4698. cf_slang_LIBS1="$LIBS"
  4699. CF_TERMCAP_LIBS
  4700. cf_slang_LIBS2="$LIBS"
  4701. AC_CHECK_FUNC(acos,,[CF_RECHECK_FUNC(acos,m,LIBS)])
  4702. case $host_os in #(vi
  4703. os2*)
  4704. CF_FIND_LIBRARY(video,video,
  4705. [#include <sys/video.h>],
  4706. [v_init()],
  4707. v_init)
  4708. ;;
  4709. esac
  4710. CF_FIND_LIBRARY($1,$1,
  4711. [#include <slang.h>],
  4712. [SLtt_get_screen_size()],
  4713. SLtt_get_screen_size)
  4714. cf_slang_LIBS3="$LIBS"
  4715. AC_MSG_CHECKING(if we can link $1 without termcap)
  4716. if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then
  4717. cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s%$cf_slang_LIBS1%%" -e 's%^.%%'`
  4718. else
  4719. cf_exclude="$cf_slang_LIBS2"
  4720. fi
  4721. LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s%$cf_exclude%%" -e 's%^.%%'`
  4722. AC_TRY_LINK([#include <slang.h>],
  4723. [SLtt_get_screen_size()],
  4724. [cf_result=yes],
  4725. [cf_result=no])
  4726. AC_MSG_RESULT($cf_result)
  4727. test $cf_result = no && LIBS="$cf_slang_LIBS3"
  4728. ])dnl
  4729. dnl ---------------------------------------------------------------------------
  4730. dnl CF_SLANG_UNIX_DEFS version: 6 updated: 2012/11/08 20:57:52
  4731. dnl ------------------
  4732. dnl Slang's header files rely on some predefined symbols to declare variables
  4733. dnl that we might find useful. This check is needed, because those symbols
  4734. dnl are generally not available.
  4735. AC_DEFUN([CF_SLANG_UNIX_DEFS],
  4736. [
  4737. CF_SLANG_CPPFLAGS(slang)
  4738. if test "x$cf_cv_slang_header" != xno
  4739. then
  4740. CF_SLANG_LIBS(slang)
  4741. else
  4742. CF_SLANG_CPPFLAGS(slang2)
  4743. if test "x$cf_cv_slang2_header" != xno
  4744. then
  4745. CF_SLANG_LIBS(slang2)
  4746. else
  4747. AC_MSG_ERROR(cannot find slang headers)
  4748. fi
  4749. fi
  4750. # There's an unofficial set of patches for slang that gives it some limited
  4751. # UTF8 capability. Unfortunately it won't compile unless one defines UTF8.
  4752. AC_CACHE_CHECK(if we must define UTF8,cf_cv_slang_utf8,[
  4753. AC_TRY_COMPILE([#include <slang.h>],
  4754. [SLtt_get_screen_size()],
  4755. [cf_cv_slang_utf8=no],
  4756. [
  4757. AC_TRY_COMPILE([
  4758. #define UTF8
  4759. #include <slang.h>],
  4760. [SLtt_get_screen_size()],
  4761. [cf_cv_slang_utf8=yes],
  4762. [cf_cv_slang_utf8=unknown])])
  4763. ])
  4764. if test "$cf_cv_slang_utf8" = yes ; then
  4765. AC_DEFINE(UTF8,1,[Define to 1 if we must define UTF-8 for s-lang headers])
  4766. fi
  4767. AC_CACHE_CHECK(if we must tell slang this is UNIX,cf_cv_slang_unix,[
  4768. AC_TRY_LINK([#include <slang.h>],
  4769. [
  4770. #ifdef REAL_UNIX_SYSTEM
  4771. make an error
  4772. #else
  4773. extern int SLang_TT_Baud_Rate;
  4774. SLang_TT_Baud_Rate = 1
  4775. #endif
  4776. ],
  4777. [cf_cv_slang_unix=yes],
  4778. [cf_cv_slang_unix=no])
  4779. ])
  4780. test $cf_cv_slang_unix = yes && AC_DEFINE(REAL_UNIX_SYSTEM,1,[Define to 1 if we must define REAL_UNIX_SYSTEM to compile with s-lang headers])
  4781. CF_CHECK_TYPE(SLsmg_Color_Type,int,[#include <slang.h>])
  4782. CF_CHECK_TYPE(SLtt_Char_Type,unsigned long,[#include <slang.h>])
  4783. ])dnl
  4784. dnl ---------------------------------------------------------------------------
  4785. dnl CF_SOCKS version: 9 updated: 2012/11/08 20:57:52
  4786. dnl --------
  4787. dnl Check for socks library
  4788. dnl $1 = the [optional] directory in which the library may be found
  4789. AC_DEFUN([CF_SOCKS],[
  4790. CF_ADD_OPTIONAL_PATH($1, [socks library])
  4791. CF_FIND_LINKAGE([
  4792. #include <stdio.h>
  4793. ],[
  4794. Raccept((char *)0)
  4795. ],
  4796. socks)
  4797. if test "x$cf_cv_find_linkage_socks" = "xyes" ; then
  4798. AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library])
  4799. AC_DEFINE(accept,Raccept,[Define to override function name if using socks library])
  4800. AC_DEFINE(bind,Rbind,[Define to override function name if using socks library])
  4801. AC_DEFINE(connect,Rconnect,[Define to override function name if using socks library])
  4802. AC_DEFINE(getpeername,Rgetpeername,[Define to override function name if using socks library])
  4803. AC_DEFINE(getsockname,Rgetsockname,[Define to override function name if using socks library])
  4804. AC_DEFINE(listen,Rlisten,[Define to override function name if using socks library])
  4805. AC_DEFINE(recvfrom,Rrecvfrom,[Define to override function name if using socks library])
  4806. AC_DEFINE(select,Rselect,[Define to override function name if using socks library])
  4807. else
  4808. AC_MSG_ERROR(cannot link with socks library)
  4809. fi
  4810. ])dnl
  4811. dnl ---------------------------------------------------------------------------
  4812. dnl CF_SOCKS5 version: 12 updated: 2012/11/08 20:57:52
  4813. dnl ---------
  4814. dnl Check for socks5 configuration
  4815. dnl $1 = the [optional] directory in which the library may be found
  4816. AC_DEFUN([CF_SOCKS5],[
  4817. CF_ADD_OPTIONAL_PATH($1, [socks5 library])
  4818. CF_ADD_LIBS(-lsocks5)
  4819. AC_DEFINE(USE_SOCKS5,1,[Define to 1 if we are using socks5 library])
  4820. AC_DEFINE(SOCKS,1,[Define to 1 if we are using socks library])
  4821. AC_MSG_CHECKING(if the socks library uses socks4 prefix)
  4822. cf_use_socks4=error
  4823. AC_TRY_LINK([
  4824. #include <socks.h>],[
  4825. Rinit((char *)0)],
  4826. [AC_DEFINE(USE_SOCKS4_PREFIX,1,[Define to 1 if socks library uses socks4 prefix])
  4827. cf_use_socks4=yes],
  4828. [AC_TRY_LINK([#include <socks.h>],
  4829. [SOCKSinit((char *)0)],
  4830. [cf_use_socks4=no],
  4831. [AC_MSG_ERROR(Cannot link with socks5 library)])])
  4832. AC_MSG_RESULT($cf_use_socks4)
  4833. if test "$cf_use_socks4" = "yes" ; then
  4834. AC_DEFINE(accept,Raccept)
  4835. AC_DEFINE(bind,Rbind)
  4836. AC_DEFINE(connect,Rconnect)
  4837. AC_DEFINE(getpeername,Rgetpeername)
  4838. AC_DEFINE(getsockname,Rgetsockname)
  4839. AC_DEFINE(listen,Rlisten)
  4840. AC_DEFINE(recvfrom,Rrecvfrom)
  4841. AC_DEFINE(select,Rselect)
  4842. else
  4843. AC_DEFINE(accept,SOCKSaccept)
  4844. AC_DEFINE(getpeername,SOCKSgetpeername)
  4845. AC_DEFINE(getsockname,SOCKSgetsockname)
  4846. AC_DEFINE(recvfrom,SOCKSrecvfrom)
  4847. fi
  4848. AC_MSG_CHECKING(if socks5p.h is available)
  4849. AC_TRY_COMPILE([
  4850. #define INCLUDE_PROTOTYPES
  4851. #include <socks.h>],[
  4852. init((char *)0)],
  4853. [cf_use_socks5p_h=yes],
  4854. [cf_use_socks5p_h=no])
  4855. AC_MSG_RESULT($cf_use_socks5p_h)
  4856. test "$cf_use_socks5p_h" = yes && AC_DEFINE(INCLUDE_PROTOTYPES,1,[Define to 1 if needed to declare prototypes in socks headers])
  4857. ])dnl
  4858. dnl ---------------------------------------------------------------------------
  4859. dnl CF_SRAND version: 11 updated: 2012/10/31 07:00:16
  4860. dnl --------
  4861. dnl Check for functions similar to srand() and rand(). lrand48() and random()
  4862. dnl return a 31-bit value, while rand() returns a value less than RAND_MAX
  4863. dnl which usually is only 16-bits.
  4864. dnl
  4865. dnl On MirOS, use arc4random_push() and arc4random().
  4866. dnl Some systems support an asymmetric variation of this interface.
  4867. dnl
  4868. dnl $1 = optional prefix for resulting shell variables. The default "my_"
  4869. dnl gives $my_srand and $my_rand to the caller, as well as MY_RAND_MAX.
  4870. dnl These are all AC_SUBST'd and AC_DEFINE'd.
  4871. AC_DEFUN([CF_SRAND],[
  4872. AC_CACHE_CHECK(for random-integer functions, cf_cv_srand_func,[
  4873. cf_cv_srand_func=unknown
  4874. for cf_func in arc4random_push/arc4random arc4random_stir/arc4random srandom/random srand48/lrand48 srand/rand
  4875. do
  4876. CF_SRAND_PARSE($cf_func,cf_srand_func,cf_rand_func)
  4877. AC_TRY_LINK([
  4878. #ifdef HAVE_STDLIB_H
  4879. #include <stdlib.h>
  4880. #endif
  4881. #ifdef HAVE_LIMITS_H
  4882. #include <limits.h>
  4883. #endif
  4884. ],[long seed = 1; $cf_srand_func(seed); seed = $cf_rand_func()],
  4885. [cf_cv_srand_func=$cf_func
  4886. break])
  4887. done
  4888. ])
  4889. if test "$cf_cv_srand_func" != unknown ; then
  4890. AC_CACHE_CHECK(for range of random-integers, cf_cv_rand_max,[
  4891. case $cf_cv_srand_func in
  4892. srand/rand)
  4893. cf_cv_rand_max=RAND_MAX
  4894. cf_rand_max=16
  4895. ;;
  4896. */arc4random)
  4897. cf_cv_rand_max=0xFFFFFFFFUL
  4898. cf_rand_max=32
  4899. ;;
  4900. *)
  4901. cf_cv_rand_max=INT_MAX
  4902. cf_rand_max=31
  4903. ;;
  4904. esac
  4905. AC_TRY_COMPILE([
  4906. #ifdef HAVE_STDLIB_H
  4907. #include <stdlib.h>
  4908. #endif
  4909. #ifdef HAVE_LIMITS_H
  4910. #include <limits.h>
  4911. #endif
  4912. ],[long x = $cf_cv_rand_max],,
  4913. [cf_cv_rand_max="(1L<<$cf_rand_max)-1"])
  4914. ])
  4915. case $cf_cv_srand_func in
  4916. */arc4random)
  4917. AC_MSG_CHECKING(if <bsd/stdlib.h> should be included)
  4918. AC_TRY_COMPILE([#include <bsd/stdlib.h>],
  4919. [void *arc4random(int);
  4920. void *x = arc4random(1)],
  4921. [cf_bsd_stdlib_h=no],
  4922. [AC_TRY_COMPILE([#include <bsd/stdlib.h>],
  4923. [unsigned x = arc4random()],
  4924. [cf_bsd_stdlib_h=yes],
  4925. [cf_bsd_stdlib_h=no])])
  4926. AC_MSG_RESULT($cf_bsd_stdlib_h)
  4927. if test "$cf_bsd_stdlib_h" = yes
  4928. then
  4929. AC_DEFINE(HAVE_BSD_STDLIB_H,1,[Define to 1 if bsd/stdlib.h header should be used])
  4930. else
  4931. AC_MSG_CHECKING(if <bsd/random.h> should be included)
  4932. AC_TRY_COMPILE([#include <bsd/random.h>],
  4933. [void *arc4random(int);
  4934. void *x = arc4random(1)],
  4935. [cf_bsd_random_h=no],
  4936. [AC_TRY_COMPILE([#include <bsd/random.h>],
  4937. [unsigned x = arc4random()],
  4938. [cf_bsd_random_h=yes],
  4939. [cf_bsd_random_h=no])])
  4940. AC_MSG_RESULT($cf_bsd_random_h)
  4941. if test "$cf_bsd_random_h" = yes
  4942. then
  4943. AC_DEFINE(HAVE_BSD_RANDOM_H,1,[Define to 1 if bsd/random.h header should be used])
  4944. else
  4945. AC_MSG_WARN(no header file found for arc4random)
  4946. fi
  4947. fi
  4948. ;;
  4949. esac
  4950. CF_SRAND_PARSE($cf_func,cf_srand_func,cf_rand_func)
  4951. CF_UPPER(cf_rand_max,ifelse($1,,my_,$1)rand_max)
  4952. AC_DEFINE_UNQUOTED(ifelse($1,,my_,$1)srand,$cf_srand_func,[Define to the name for the srand function])
  4953. AC_DEFINE_UNQUOTED(ifelse($1,,my_,$1)rand, $cf_rand_func,[Define to the name for the rand function])
  4954. AC_DEFINE_UNQUOTED([$]cf_rand_max, $cf_cv_rand_max,[Define to the name for the RAND_MAX constant])
  4955. fi
  4956. ])dnl
  4957. dnl ---------------------------------------------------------------------------
  4958. dnl CF_SRAND_PARSE version: 1 updated: 2007/04/22 12:01:07
  4959. dnl --------------
  4960. dnl Parse the loop variable for CF_SRAND, with a workaround for asymmetric
  4961. dnl variations.
  4962. define([CF_SRAND_PARSE],[
  4963. $2=`echo $1 | sed -e 's%/.*%%'`
  4964. $3=`echo $1 | sed -e 's%.*/%%'`
  4965. case [$]$2 in #(vi
  4966. arc4random_stir)
  4967. $2='(void)'
  4968. ;;
  4969. esac
  4970. ])dnl
  4971. dnl ---------------------------------------------------------------------------
  4972. dnl CF_SSL version: 24 updated: 2014/01/11 12:06:14
  4973. dnl ------
  4974. dnl Check for ssl library
  4975. dnl $1 = [optional] directory in which the library may be found, set by AC_ARG_WITH
  4976. AC_DEFUN([CF_SSL],[
  4977. AC_REQUIRE([CF_PKG_CONFIG])
  4978. cf_cv_have_ssl=no
  4979. cf_cv_pkg_config_ssl=no
  4980. # command-line option, etc., override default behavior
  4981. CF_ADD_OPTIONAL_PATH($1, [ssl library])
  4982. if test "x$PKG_CONFIG" != xnone; then
  4983. case $1 in #(vi
  4984. no) #(vi
  4985. ;;
  4986. yes) # if no explicit directory given, try pkg-config
  4987. cf_cv_pkg_ssl=
  4988. for cf_try_package in openssl libssl
  4989. do
  4990. AC_MSG_CHECKING(pkg-config for $cf_try_package)
  4991. if "$PKG_CONFIG" --exists $cf_try_package ; then
  4992. cf_cv_pkg_ssl=$cf_try_package
  4993. AC_MSG_RESULT(yes)
  4994. break
  4995. else
  4996. AC_MSG_RESULT(no)
  4997. fi
  4998. done
  4999. if test -n "$cf_cv_pkg_ssl" ; then
  5000. cf_cv_have_ssl=yes
  5001. cf_cv_pkg_config_ssl=yes
  5002. cf_cflags_ssl=`$PKG_CONFIG --cflags $cf_cv_pkg_ssl`
  5003. cf_libs_ssl=`$PKG_CONFIG --libs $cf_cv_pkg_ssl`
  5004. if test -n "$cf_cflags_ssl" ; then
  5005. case "$cf_cflags_ssl" in #(vi
  5006. *-I*) #(vi
  5007. cf_cv_header_path_ssl=`echo "$cf_cflags_ssl" | sed -e 's/^.*-I//' -e 's/ .*//'`
  5008. ;;
  5009. *)
  5010. cf_cv_header_path_ssl=/usr/include
  5011. ;;
  5012. esac
  5013. CF_ADD_CFLAGS($cf_cflags_ssl)
  5014. # workaround for broken openssl package using kerberos
  5015. case "$cf_cflags_ssl" in #(vi
  5016. *kerberos*)
  5017. cf_cv_have_ssl=maybe
  5018. ;;
  5019. esac
  5020. else
  5021. cf_cv_header_path_ssl=/usr/include
  5022. fi
  5023. if test -d $cf_cv_header_path_ssl/openssl ; then
  5024. cf_cv_header_path_ssl=$cf_cv_header_path_ssl/openssl
  5025. fi
  5026. if test -n "$cf_libs_ssl" ; then
  5027. case "x$cf_libs_ssl" in #(vi
  5028. *-L*) #(vi
  5029. cf_cv_library_path_ssl=`echo "$cf_libs_ssl" | sed -e 's/^.*-L//' -e 's/ .*//'`
  5030. ;;
  5031. *)
  5032. cf_cv_library_path_ssl=/usr/lib
  5033. ;;
  5034. esac
  5035. CF_VERBOSE(adding $cf_libs_ssl to LIBS)
  5036. CF_ADD_LIBS($cf_libs_ssl)
  5037. fi
  5038. fi
  5039. ;;
  5040. esac
  5041. fi
  5042. if test "$cf_cv_have_ssl" != yes; then
  5043. case $host_os in #(vi
  5044. mingw*) #(vi
  5045. cf_extra_ssl_libs="-lcrypto -lgdi32"
  5046. ;;
  5047. *)
  5048. # openssl 0.9.6 and up use dynamic loading for engines.
  5049. cf_extra_ssl_libs="-lcrypto"
  5050. case "x$LIBS" in #(vi
  5051. *-ldl) #(vi
  5052. ;;
  5053. *)
  5054. AC_CHECK_LIB(dl,dlsym,
  5055. [cf_extra_ssl_libs="$cf_extra_ssl_libs -ldl"])
  5056. ;;
  5057. esac
  5058. ;;
  5059. esac
  5060. CF_FIND_LINKAGE(CF__SSL_HEAD,
  5061. CF__SSL_BODY,
  5062. ssl,
  5063. cf_cv_have_ssl=yes,
  5064. cf_cv_have_ssl=no,
  5065. openssl,
  5066. $cf_extra_ssl_libs)
  5067. if test "$cf_cv_pkg_config_ssl" != yes ; then
  5068. if test "$cf_cv_have_ssl" = yes ; then
  5069. if test -n "$cf_cv_library_path_ssl" ; then
  5070. CF_ADD_LIBDIR($cf_cv_library_path_ssl)
  5071. fi
  5072. CF_ADD_LIBS(-lssl $cf_extra_ssl_libs)
  5073. if test -n "$cf_cv_header_path_ssl" ; then
  5074. case $cf_cv_header_path_ssl in #(vi
  5075. /usr/include/openssl) #(vi
  5076. ;;
  5077. *)
  5078. CF_ADD_INCDIR($cf_cv_header_path_ssl)
  5079. ;;
  5080. esac
  5081. fi
  5082. fi
  5083. fi
  5084. fi
  5085. if test "$cf_cv_have_ssl" = yes ; then
  5086. AC_DEFINE(USE_SSL,1,[Define to 1 if we are using SSL])
  5087. if test -n "$cf_cv_header_path_ssl" ; then
  5088. CF_VERBOSE(checking ssl header-path $cf_cv_header_path_ssl)
  5089. case $cf_cv_header_path_ssl in #(vi
  5090. */openssl)
  5091. AC_DEFINE(USE_OPENSSL_INCL,1,[Define to 1 if we are using OpenSSL headers])
  5092. ;;
  5093. esac
  5094. fi
  5095. CF_CHECK_SSL_X509
  5096. fi
  5097. ])dnl
  5098. dnl ---------------------------------------------------------------------------
  5099. dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
  5100. dnl --------------
  5101. dnl Remove "-g" option from the compiler options
  5102. AC_DEFUN([CF_STRIP_G_OPT],
  5103. [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
  5104. dnl ---------------------------------------------------------------------------
  5105. dnl CF_STRIP_O_OPT version: 3 updated: 2001/02/02 19:06:08
  5106. dnl --------------
  5107. dnl Remove "-O" option from the compiler options
  5108. AC_DEFUN([CF_STRIP_O_OPT],[
  5109. $1=`echo ${$1} | sed -e 's/-O[[1-9]]\? //' -e 's/-O[[1-9]]\?$//'`
  5110. ])dnl
  5111. dnl ---------------------------------------------------------------------------
  5112. dnl CF_STRUCT_TERMIOS version: 7 updated: 2012/10/06 17:56:13
  5113. dnl -----------------
  5114. dnl Some machines require _POSIX_SOURCE to completely define struct termios.
  5115. AC_DEFUN([CF_STRUCT_TERMIOS],[
  5116. AC_REQUIRE([CF_XOPEN_SOURCE])
  5117. AC_CHECK_HEADERS( \
  5118. termio.h \
  5119. termios.h \
  5120. unistd.h \
  5121. )
  5122. if test "$ISC" = yes ; then
  5123. AC_CHECK_HEADERS( sys/termio.h )
  5124. fi
  5125. if test "$ac_cv_header_termios_h" = yes ; then
  5126. case "$CFLAGS $CPPFLAGS" in
  5127. *-D_POSIX_SOURCE*)
  5128. termios_bad=dunno ;;
  5129. *) termios_bad=maybe ;;
  5130. esac
  5131. if test "$termios_bad" = maybe ; then
  5132. AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
  5133. AC_TRY_COMPILE([#include <termios.h>],
  5134. [struct termios foo; int x = foo.c_iflag],
  5135. termios_bad=no, [
  5136. AC_TRY_COMPILE([
  5137. #define _POSIX_SOURCE
  5138. #include <termios.h>],
  5139. [struct termios foo; int x = foo.c_iflag],
  5140. termios_bad=unknown,
  5141. termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE]))
  5142. ])
  5143. AC_MSG_RESULT($termios_bad)
  5144. fi
  5145. fi
  5146. ])dnl
  5147. dnl ---------------------------------------------------------------------------
  5148. dnl CF_SUBDIR_PATH version: 6 updated: 2010/04/21 06:20:50
  5149. dnl --------------
  5150. dnl Construct a search-list for a nonstandard header/lib-file
  5151. dnl $1 = the variable to return as result
  5152. dnl $2 = the package name
  5153. dnl $3 = the subdirectory, e.g., bin, include or lib
  5154. AC_DEFUN([CF_SUBDIR_PATH],
  5155. [
  5156. $1=
  5157. CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
  5158. CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
  5159. CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
  5160. CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
  5161. CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
  5162. ])dnl
  5163. dnl ---------------------------------------------------------------------------
  5164. dnl CF_SYSTEM_MAIL_FLAGS version: 4 updated: 2012/11/08 20:57:52
  5165. dnl --------------------
  5166. AC_DEFUN([CF_SYSTEM_MAIL_FLAGS],
  5167. [
  5168. AC_MSG_CHECKING([system mail flags])
  5169. AC_CACHE_VAL(cf_cv_system_mail_flags,[
  5170. case $cf_cv_SYSTEM_MAIL in
  5171. */mmdf/*)
  5172. [cf_cv_system_mail_flags="-mlruxto,cc\\\\*"]
  5173. ;;
  5174. *)
  5175. [cf_cv_system_mail_flags="-t -oi"]
  5176. esac
  5177. ])
  5178. AC_MSG_RESULT($cf_cv_system_mail_flags)
  5179. AC_DEFINE_UNQUOTED(SYSTEM_MAIL_FLAGS, "$cf_cv_system_mail_flags",[Define to value used for system mail-flags])
  5180. ])dnl
  5181. dnl ---------------------------------------------------------------------------
  5182. dnl CF_SYSV_UTMP version: 6 updated: 2012/10/04 20:12:20
  5183. dnl ------------
  5184. dnl Check if this is a SYSV flavor of UTMP
  5185. AC_DEFUN([CF_SYSV_UTMP],
  5186. [
  5187. AC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[
  5188. test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx"
  5189. AC_TRY_LINK([
  5190. #include <sys/types.h>
  5191. #include <${cf_cv_have_utmp}.h>],[
  5192. struct $cf_cv_have_utmp x;
  5193. set${cf_prefix}ent ();
  5194. get${cf_prefix}id(&x);
  5195. put${cf_prefix}line(&x);
  5196. end${cf_prefix}ent();],
  5197. [cf_cv_sysv_utmp=yes],
  5198. [cf_cv_sysv_utmp=no])
  5199. ])
  5200. test $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP,1,[Define to 1 if utmp is SYSV flavor])
  5201. ])dnl
  5202. dnl ---------------------------------------------------------------------------
  5203. dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23
  5204. dnl --------------
  5205. dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and
  5206. dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our
  5207. dnl declaration. Reported by Keith Bostic.
  5208. AC_DEFUN([CF_SYS_ERRLIST],
  5209. [
  5210. CF_CHECK_ERRNO(sys_nerr)
  5211. CF_CHECK_ERRNO(sys_errlist)
  5212. ])dnl
  5213. dnl ---------------------------------------------------------------------------
  5214. dnl CF_TAR_OPTIONS version: 2 updated: 2005/08/24 20:15:11
  5215. dnl --------------
  5216. dnl This is just a list of the most common tar options, allowing for variants
  5217. dnl that can operate with the "-" standard input/output option.
  5218. AC_DEFUN([CF_TAR_OPTIONS],
  5219. [
  5220. case ifelse($1,,tar,$1) in
  5221. *pax|*pax$EXEEXT)
  5222. TAR_UP_OPTIONS="-w"
  5223. TAR_DOWN_OPTIONS="-r"
  5224. TAR_PIPE_OPTIONS=""
  5225. TAR_FILE_OPTIONS="-f"
  5226. ;;
  5227. *star|*star$EXEEXT)
  5228. TAR_UP_OPTIONS="-c -f"
  5229. TAR_DOWN_OPTIONS="-x -U -f"
  5230. TAR_PIPE_OPTIONS="-"
  5231. TAR_FILE_OPTIONS=""
  5232. ;;
  5233. *tar|*tar$EXEEXT)
  5234. # FIXME: some versions of tar require, some don't allow the "-"
  5235. TAR_UP_OPTIONS="-cf"
  5236. TAR_DOWN_OPTIONS="-xf"
  5237. TAR_PIPE_OPTIONS="-"
  5238. TAR_FILE_OPTIONS=""
  5239. ;;
  5240. esac
  5241. AC_SUBST(TAR_UP_OPTIONS)
  5242. AC_SUBST(TAR_DOWN_OPTIONS)
  5243. AC_SUBST(TAR_FILE_OPTIONS)
  5244. AC_SUBST(TAR_PIPE_OPTIONS)
  5245. ])dnl
  5246. dnl ---------------------------------------------------------------------------
  5247. dnl CF_TERMCAP_LIBS version: 14 updated: 2012/07/07 21:02:48
  5248. dnl ---------------
  5249. dnl Look for termcap libraries, or the equivalent in terminfo.
  5250. dnl
  5251. dnl The optional parameter may be "ncurses", "ncursesw".
  5252. AC_DEFUN([CF_TERMCAP_LIBS],
  5253. [
  5254. AC_CACHE_VAL(cf_cv_termlib,[
  5255. cf_cv_termlib=none
  5256. AC_TRY_LINK([],[char *x=(char*)tgoto("",0,0)],
  5257. [AC_TRY_LINK([],[int x=tigetstr("")],
  5258. [cf_cv_termlib=terminfo],
  5259. [cf_cv_termlib=termcap])
  5260. CF_VERBOSE(using functions in predefined $cf_cv_termlib LIBS)
  5261. ],[
  5262. ifelse([$1],,,[
  5263. case "$1" in # (vi
  5264. ncurses*)
  5265. CF_NCURSES_CONFIG($1)
  5266. cf_cv_termlib=terminfo
  5267. ;;
  5268. esac
  5269. ])
  5270. if test "$cf_cv_termlib" = none; then
  5271. # FreeBSD's linker gives bogus results for AC_CHECK_LIB, saying that
  5272. # tgetstr lives in -lcurses when it is only an unsatisfied extern.
  5273. cf_save_LIBS="$LIBS"
  5274. for cf_lib in tinfo curses ncurses termlib termcap
  5275. do
  5276. LIBS="-l$cf_lib $cf_save_LIBS"
  5277. for cf_func in tigetstr tgetstr
  5278. do
  5279. AC_MSG_CHECKING(for $cf_func in -l$cf_lib)
  5280. AC_TRY_LINK([],[int x=$cf_func("")],[cf_result=yes],[cf_result=no])
  5281. AC_MSG_RESULT($cf_result)
  5282. if test "$cf_result" = yes ; then
  5283. if test "$cf_func" = tigetstr ; then
  5284. cf_cv_termlib=terminfo
  5285. else
  5286. cf_cv_termlib=termcap
  5287. fi
  5288. break
  5289. fi
  5290. done
  5291. test "$cf_result" = yes && break
  5292. done
  5293. test "$cf_result" = no && LIBS="$cf_save_LIBS"
  5294. fi
  5295. if test "$cf_cv_termlib" = none; then
  5296. # allow curses library for broken AIX system.
  5297. AC_CHECK_LIB(curses, initscr, [CF_ADD_LIBS(-lcurses)])
  5298. AC_CHECK_LIB(termcap, tgoto, [CF_ADD_LIBS(-ltermcap) cf_cv_termlib=termcap])
  5299. fi
  5300. ])
  5301. if test "$cf_cv_termlib" = none; then
  5302. AC_MSG_WARN([Cannot find -ltermlib, -lcurses, or -ltermcap])
  5303. fi
  5304. ])])dnl
  5305. dnl ---------------------------------------------------------------------------
  5306. dnl CF_TERMIO_AND_CURSES version: 5 updated: 2012/11/08 20:57:52
  5307. dnl --------------------
  5308. dnl Check if including termio.h with <curses.h> dies like on sysv68
  5309. dnl FIXME: this is too Lynx-specific
  5310. AC_DEFUN([CF_TERMIO_AND_CURSES],
  5311. [
  5312. AC_CACHE_CHECK(if we can include termio.h with curses,cf_cv_termio_and_curses,[
  5313. cf_save_CFLAGS="$CPPFLAGS"
  5314. CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I. -I${srcdir:-.} -I${srcdir:-.}/src -I${srcdir:-.}/WWW/Library/Implementation"
  5315. touch lynx_cfg.h
  5316. AC_TRY_COMPILE([
  5317. #include <$1>
  5318. #include <termio.h>],
  5319. [putchar(0x0a)],
  5320. [cf_cv_termio_and_curses=yes],
  5321. [cf_cv_termio_and_curses=no])
  5322. CPPFLAGS="$cf_save_CFLAGS"
  5323. rm -f lynx_cfg.h
  5324. ])
  5325. test $cf_cv_termio_and_curses = yes && AC_DEFINE(TERMIO_AND_CURSES,1,[Define to 1 if we can include termio.h with curses.h])
  5326. ])dnl
  5327. dnl ---------------------------------------------------------------------------
  5328. dnl CF_TERMIO_AND_TERMIOS version: 3 updated: 2012/11/08 20:57:52
  5329. dnl ---------------------
  5330. dnl Check if including both termio.h and termios.h die like on DG.UX
  5331. AC_DEFUN([CF_TERMIO_AND_TERMIOS],
  5332. [
  5333. AC_MSG_CHECKING([termio.h and termios.h])
  5334. AC_CACHE_VAL(cf_cv_termio_and_termios,[
  5335. AC_TRY_COMPILE([
  5336. #if HAVE_TERMIO_H
  5337. #include <termio.h>
  5338. #endif
  5339. #if HAVE_TERMIOS_H
  5340. #include <termios.h>
  5341. #endif ],
  5342. [putchar (0x0a)],
  5343. [cf_cv_termio_and_termios=yes],
  5344. [cf_cv_termio_and_termios=no])])
  5345. AC_MSG_RESULT($cf_cv_termio_and_termios)
  5346. test $cf_cv_termio_and_termios = no && AC_DEFINE(TERMIO_AND_TERMIOS,1,[Define to 1 if we can include termio.h and termios.h])
  5347. ])dnl
  5348. dnl ---------------------------------------------------------------------------
  5349. dnl CF_TERM_HEADER version: 3 updated: 2012/10/06 08:57:51
  5350. dnl --------------
  5351. dnl Look for term.h, which is part of X/Open curses. It defines the interface
  5352. dnl to terminfo database. Usually it is in the same include-path as curses.h,
  5353. dnl but some packagers change this, breaking various applications.
  5354. AC_DEFUN([CF_TERM_HEADER],[
  5355. AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
  5356. case ${cf_cv_ncurses_header} in #(vi
  5357. */ncurses.h|*/ncursesw.h) #(vi
  5358. cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
  5359. ;;
  5360. *)
  5361. cf_term_header=term.h
  5362. ;;
  5363. esac
  5364. for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
  5365. do
  5366. AC_TRY_COMPILE([#include <stdio.h>
  5367. #include <${cf_cv_ncurses_header:-curses.h}>
  5368. #include <$cf_test>
  5369. ],[int x = auto_left_margin],[
  5370. cf_cv_term_header="$cf_test"],[
  5371. cf_cv_term_header=unknown
  5372. ])
  5373. test "$cf_cv_term_header" != unknown && break
  5374. done
  5375. ])
  5376. # Set definitions to allow ifdef'ing to accommodate subdirectories
  5377. case $cf_cv_term_header in # (vi
  5378. *term.h)
  5379. AC_DEFINE(HAVE_TERM_H,1,[Define to 1 if we have term.h])
  5380. ;;
  5381. esac
  5382. case $cf_cv_term_header in # (vi
  5383. ncurses/term.h) #(vi
  5384. AC_DEFINE(HAVE_NCURSES_TERM_H,1,[Define to 1 if we have ncurses/term.h])
  5385. ;;
  5386. ncursesw/term.h)
  5387. AC_DEFINE(HAVE_NCURSESW_TERM_H,1,[Define to 1 if we have ncursesw/term.h])
  5388. ;;
  5389. esac
  5390. ])dnl
  5391. dnl ---------------------------------------------------------------------------
  5392. dnl CF_TM_GMTOFF version: 3 updated: 2012/11/08 20:57:52
  5393. dnl ------------
  5394. dnl Check if the tm-struct defines the '.tm_gmtoff' member (useful in decoding
  5395. dnl dates).
  5396. AC_DEFUN([CF_TM_GMTOFF],
  5397. [
  5398. AC_MSG_CHECKING([for tm.tm_gmtoff])
  5399. AC_CACHE_VAL(cf_cv_tm_gmtoff,[
  5400. AC_TRY_COMPILE([
  5401. #ifdef TIME_WITH_SYS_TIME
  5402. # include <sys/time.h>
  5403. # include <time.h>
  5404. #else
  5405. # ifdef HAVE_SYS_TIME_H
  5406. # include <sys/time.h>
  5407. # else
  5408. # include <time.h>
  5409. # endif
  5410. #endif
  5411. ],[
  5412. struct tm foo;
  5413. long bar = foo.tm_gmtoff],
  5414. [cf_cv_tm_gmtoff=yes],
  5415. [cf_cv_tm_gmtoff=no])])
  5416. AC_MSG_RESULT($cf_cv_tm_gmtoff)
  5417. test $cf_cv_tm_gmtoff = no && AC_DEFINE(DONT_HAVE_TM_GMTOFF,1,[Define to 1 if the tm-struct defines .tm_gmtoff member])
  5418. ])dnl
  5419. dnl ---------------------------------------------------------------------------
  5420. dnl CF_TRIM_X_LIBS version: 2 updated: 2013/07/09 21:27:22
  5421. dnl --------------
  5422. dnl Trim extra base X libraries added as a workaround for inconsistent library
  5423. dnl dependencies returned by "new" pkg-config files.
  5424. AC_DEFUN([CF_TRIM_X_LIBS],[
  5425. for cf_trim_lib in Xmu Xt X11
  5426. do
  5427. case "$LIBS" in
  5428. *-l$cf_trim_lib\ *-l$cf_trim_lib*)
  5429. LIBS=`echo "$LIBS " | sed -e 's/ / /g' -e 's%-l'"$cf_trim_lib"' %%' -e 's/ $//'`
  5430. CF_VERBOSE(..trimmed $LIBS)
  5431. ;;
  5432. esac
  5433. done
  5434. ])
  5435. dnl ---------------------------------------------------------------------------
  5436. dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06
  5437. dnl -----------------
  5438. dnl This is a simple wrapper to use for pkg-config, for libraries which may be
  5439. dnl available in that form.
  5440. dnl
  5441. dnl $1 = package name
  5442. dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS
  5443. dnl $3 = logic to use if pkg-config does not have the package
  5444. AC_DEFUN([CF_TRY_PKG_CONFIG],[
  5445. AC_REQUIRE([CF_PKG_CONFIG])
  5446. if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then
  5447. CF_VERBOSE(found package $1)
  5448. cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`"
  5449. cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`"
  5450. CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs)
  5451. CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs)
  5452. CF_ADD_CFLAGS($cf_pkgconfig_incs)
  5453. CF_ADD_LIBS($cf_pkgconfig_libs)
  5454. ifelse([$2],,:,[$2])
  5455. else
  5456. cf_pkgconfig_incs=
  5457. cf_pkgconfig_libs=
  5458. ifelse([$3],,:,[$3])
  5459. fi
  5460. ])
  5461. dnl ---------------------------------------------------------------------------
  5462. dnl CF_TRY_XOPEN_SOURCE version: 1 updated: 2011/10/30 17:09:50
  5463. dnl -------------------
  5464. dnl If _XOPEN_SOURCE is not defined in the compile environment, check if we
  5465. dnl can define it successfully.
  5466. AC_DEFUN([CF_TRY_XOPEN_SOURCE],[
  5467. AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
  5468. AC_TRY_COMPILE([
  5469. #include <stdlib.h>
  5470. #include <string.h>
  5471. #include <sys/types.h>
  5472. ],[
  5473. #ifndef _XOPEN_SOURCE
  5474. make an error
  5475. #endif],
  5476. [cf_cv_xopen_source=no],
  5477. [cf_save="$CPPFLAGS"
  5478. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
  5479. AC_TRY_COMPILE([
  5480. #include <stdlib.h>
  5481. #include <string.h>
  5482. #include <sys/types.h>
  5483. ],[
  5484. #ifdef _XOPEN_SOURCE
  5485. make an error
  5486. #endif],
  5487. [cf_cv_xopen_source=no],
  5488. [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
  5489. CPPFLAGS="$cf_save"
  5490. ])
  5491. ])
  5492. if test "$cf_cv_xopen_source" != no ; then
  5493. CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
  5494. CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
  5495. cf_temp_xopen_source="-D_XOPEN_SOURCE=$cf_cv_xopen_source"
  5496. CF_ADD_CFLAGS($cf_temp_xopen_source)
  5497. fi
  5498. ])
  5499. dnl ---------------------------------------------------------------------------
  5500. dnl CF_TTYTYPE version: 6 updated: 2012/11/08 20:57:52
  5501. dnl ----------
  5502. AC_DEFUN([CF_TTYTYPE],
  5503. [
  5504. AC_MSG_CHECKING(if ttytype is declared in curses library)
  5505. AC_CACHE_VAL(cf_cv_have_ttytype,[
  5506. AC_TRY_LINK([#include <${cf_cv_ncurses_header:-curses.h}>],
  5507. [char *x = &ttytype[1]; *x = 1],
  5508. [cf_cv_have_ttytype=yes],
  5509. [cf_cv_have_ttytype=no])
  5510. ])
  5511. AC_MSG_RESULT($cf_cv_have_ttytype)
  5512. test $cf_cv_have_ttytype = yes && AC_DEFINE(HAVE_TTYTYPE,1,[Define to 1 if ttytype is declared in curses library])
  5513. ])dnl
  5514. dnl ---------------------------------------------------------------------------
  5515. dnl CF_TYPE_LONG_LONG version: 3 updated: 2012/11/08 20:57:52
  5516. dnl -----------------
  5517. dnl Check for long long type.
  5518. AC_DEFUN([CF_TYPE_LONG_LONG],[
  5519. AC_CACHE_CHECK(for long long type,cf_cv_type_long_long,[
  5520. cat >conftest.$ac_ext <<_CFEOF
  5521. #include "confdefs.h"
  5522. int
  5523. main (void)
  5524. {
  5525. long long foo = 123456789123456789LL;
  5526. return (foo == 0);
  5527. }
  5528. _CFEOF
  5529. (eval [$]ac_compile) 2>conftest.err
  5530. ac_status=$?
  5531. if test $ac_status = 0 && test -s conftest.err
  5532. then
  5533. fgrep warning conftest.err >/dev/null 2>&1 && ac_status=1
  5534. fi
  5535. if test $ac_status != 0
  5536. then
  5537. cf_cv_type_long_long=no
  5538. else
  5539. cf_cv_type_long_long=yes
  5540. fi
  5541. test -s conftest.err && cat conftest.err >&5
  5542. rm -f conftest*
  5543. ])
  5544. if test "$cf_cv_type_long_long" = yes ; then
  5545. AC_DEFINE(HAVE_LONG_LONG,1,[Define to 1 if compiler supports long long type])
  5546. fi
  5547. ])dnl
  5548. dnl ---------------------------------------------------------------------------
  5549. dnl CF_UNION_WAIT version: 6 updated: 2012/10/06 08:57:51
  5550. dnl -------------
  5551. dnl Check to see if the BSD-style union wait is declared. Some platforms may
  5552. dnl use this, though it is deprecated in favor of the 'int' type in Posix.
  5553. dnl Some vendors provide a bogus implementation that declares union wait, but
  5554. dnl uses the 'int' type instead; we try to spot these by checking for the
  5555. dnl associated macros.
  5556. dnl
  5557. dnl Ahem. Some implementers cast the status value to an int*, as an attempt to
  5558. dnl use the macros for either union wait or int. So we do a check compile to
  5559. dnl see if the macros are defined and apply to an int.
  5560. dnl
  5561. dnl Sets: $cf_cv_type_unionwait
  5562. dnl Defines: HAVE_TYPE_UNIONWAIT
  5563. AC_DEFUN([CF_UNION_WAIT],
  5564. [
  5565. AC_REQUIRE([CF_WAIT_HEADERS])
  5566. AC_MSG_CHECKING([for union wait])
  5567. AC_CACHE_VAL(cf_cv_type_unionwait,[
  5568. AC_TRY_LINK($cf_wait_headers,
  5569. [int x;
  5570. int y = WEXITSTATUS(x);
  5571. int z = WTERMSIG(x);
  5572. wait(&x);
  5573. ],
  5574. [cf_cv_type_unionwait=no
  5575. echo compiles ok w/o union wait 1>&AC_FD_CC
  5576. ],[
  5577. AC_TRY_LINK($cf_wait_headers,
  5578. [union wait x;
  5579. #ifdef WEXITSTATUS
  5580. int y = WEXITSTATUS(x);
  5581. #endif
  5582. #ifdef WTERMSIG
  5583. int z = WTERMSIG(x);
  5584. #endif
  5585. wait(&x);
  5586. ],
  5587. [cf_cv_type_unionwait=yes
  5588. echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
  5589. ],
  5590. [cf_cv_type_unionwait=no])])])
  5591. AC_MSG_RESULT($cf_cv_type_unionwait)
  5592. test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT,1,[Define to 1 if type unionwait is declared])
  5593. ])dnl
  5594. dnl ---------------------------------------------------------------------------
  5595. dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
  5596. dnl --------
  5597. dnl Make an uppercase version of a variable
  5598. dnl $1=uppercase($2)
  5599. AC_DEFUN([CF_UPPER],
  5600. [
  5601. $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
  5602. ])dnl
  5603. dnl ---------------------------------------------------------------------------
  5604. dnl CF_UTF8_LIB version: 8 updated: 2012/10/06 08:57:51
  5605. dnl -----------
  5606. dnl Check for multibyte support, and if not found, utf8 compatibility library
  5607. AC_DEFUN([CF_UTF8_LIB],
  5608. [
  5609. AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
  5610. cf_save_LIBS="$LIBS"
  5611. AC_TRY_LINK([
  5612. #include <stdlib.h>],[putwc(0,0);],
  5613. [cf_cv_utf8_lib=yes],
  5614. [CF_FIND_LINKAGE([
  5615. #include <libutf8.h>],[putwc(0,0);],utf8,
  5616. [cf_cv_utf8_lib=add-on],
  5617. [cf_cv_utf8_lib=no])
  5618. ])])
  5619. # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
  5620. # ncurses/ncursesw:
  5621. if test "$cf_cv_utf8_lib" = "add-on" ; then
  5622. AC_DEFINE(HAVE_LIBUTF8_H,1,[Define to 1 if we should include libutf8.h])
  5623. CF_ADD_INCDIR($cf_cv_header_path_utf8)
  5624. CF_ADD_LIBDIR($cf_cv_library_path_utf8)
  5625. CF_ADD_LIBS($cf_cv_library_file_utf8)
  5626. fi
  5627. ])dnl
  5628. dnl ---------------------------------------------------------------------------
  5629. dnl CF_UTMP version: 10 updated: 2012/10/04 20:12:20
  5630. dnl -------
  5631. dnl Check for UTMP/UTMPX headers
  5632. AC_DEFUN([CF_UTMP],
  5633. [
  5634. AC_REQUIRE([CF_LASTLOG])
  5635. AC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[
  5636. cf_cv_have_utmp=no
  5637. for cf_header in utmpx utmp ; do
  5638. cf_utmp_includes="
  5639. #include <sys/types.h>
  5640. #include <${cf_header}.h>
  5641. #define getutent getutxent
  5642. #ifdef USE_LASTLOG
  5643. #include <lastlog.h> /* may conflict with utmpx.h on Linux */
  5644. #endif
  5645. "
  5646. AC_TRY_COMPILE([$cf_utmp_includes],
  5647. [struct $cf_header x;
  5648. char *name = x.ut_name; /* utmp.h and compatible definitions */
  5649. ],
  5650. [cf_cv_have_utmp=$cf_header
  5651. break],
  5652. [
  5653. AC_TRY_COMPILE([$cf_utmp_includes],
  5654. [struct $cf_header x;
  5655. char *name = x.ut_user; /* utmpx.h must declare this */
  5656. ],
  5657. [cf_cv_have_utmp=$cf_header
  5658. break
  5659. ])])
  5660. done
  5661. ])
  5662. if test $cf_cv_have_utmp != no ; then
  5663. AC_DEFINE(HAVE_UTMP,1,[Define to 1 if the utmp interface is available])
  5664. test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP,1,[Define if we have utmpx interface])
  5665. CF_UTMP_UT_HOST
  5666. CF_UTMP_UT_SYSLEN
  5667. CF_UTMP_UT_NAME
  5668. CF_UTMP_UT_XSTATUS
  5669. CF_UTMP_UT_XTIME
  5670. CF_UTMP_UT_SESSION
  5671. CF_SYSV_UTMP
  5672. fi
  5673. ])dnl
  5674. dnl ---------------------------------------------------------------------------
  5675. dnl CF_UTMP_UT_HOST version: 8 updated: 2012/10/04 20:12:20
  5676. dnl ---------------
  5677. dnl Check if UTMP/UTMPX struct defines ut_host member
  5678. AC_DEFUN([CF_UTMP_UT_HOST],
  5679. [
  5680. if test $cf_cv_have_utmp != no ; then
  5681. AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_host is declared)
  5682. AC_CACHE_VAL(cf_cv_have_utmp_ut_host,[
  5683. AC_TRY_COMPILE([
  5684. #include <sys/types.h>
  5685. #include <${cf_cv_have_utmp}.h>],
  5686. [struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]],
  5687. [cf_cv_have_utmp_ut_host=yes],
  5688. [cf_cv_have_utmp_ut_host=no])
  5689. ])
  5690. AC_MSG_RESULT($cf_cv_have_utmp_ut_host)
  5691. test $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST,1,[Define to 1 if UTMP/UTMPX struct defines ut_host member])
  5692. fi
  5693. ])dnl
  5694. dnl ---------------------------------------------------------------------------
  5695. dnl CF_UTMP_UT_NAME version: 5 updated: 2012/10/04 20:12:20
  5696. dnl ---------------
  5697. dnl Check if UTMP/UTMPX struct defines ut_name member
  5698. AC_DEFUN([CF_UTMP_UT_NAME],
  5699. [
  5700. if test $cf_cv_have_utmp != no ; then
  5701. AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_name is declared,cf_cv_have_utmp_ut_name,[
  5702. cf_cv_have_utmp_ut_name=no
  5703. cf_utmp_includes="
  5704. #include <sys/types.h>
  5705. #include <${cf_cv_have_utmp}.h>
  5706. #define getutent getutxent
  5707. #ifdef USE_LASTLOG
  5708. #include <lastlog.h> /* may conflict with utmpx.h on Linux */
  5709. #endif
  5710. "
  5711. for cf_header in ut_name ut_user ; do
  5712. AC_TRY_COMPILE([$cf_utmp_includes],
  5713. [struct $cf_cv_have_utmp x;
  5714. char *name = x.$cf_header;
  5715. ],
  5716. [cf_cv_have_utmp_ut_name=$cf_header
  5717. break])
  5718. done
  5719. ])
  5720. case $cf_cv_have_utmp_ut_name in #(vi
  5721. no) #(vi
  5722. AC_MSG_ERROR(Cannot find declaration for ut.ut_name)
  5723. ;;
  5724. ut_user)
  5725. AC_DEFINE(ut_name,ut_user,[Define to rename UTMP/UTMPX struct ut_name member])
  5726. ;;
  5727. esac
  5728. fi
  5729. ])dnl
  5730. dnl ---------------------------------------------------------------------------
  5731. dnl CF_UTMP_UT_SESSION version: 6 updated: 2012/10/04 20:12:20
  5732. dnl ------------------
  5733. dnl Check if UTMP/UTMPX struct defines ut_session member
  5734. AC_DEFUN([CF_UTMP_UT_SESSION],
  5735. [
  5736. if test $cf_cv_have_utmp != no ; then
  5737. AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_session is declared, cf_cv_have_utmp_ut_session,[
  5738. AC_TRY_COMPILE([
  5739. #include <sys/types.h>
  5740. #include <${cf_cv_have_utmp}.h>],
  5741. [struct $cf_cv_have_utmp x; long y = x.ut_session],
  5742. [cf_cv_have_utmp_ut_session=yes],
  5743. [cf_cv_have_utmp_ut_session=no])
  5744. ])
  5745. if test $cf_cv_have_utmp_ut_session != no ; then
  5746. AC_DEFINE(HAVE_UTMP_UT_SESSION,1,[Define to 1 if UTMP/UTMPX struct defines ut_session member])
  5747. fi
  5748. fi
  5749. ])dnl
  5750. dnl ---------------------------------------------------------------------------
  5751. dnl CF_UTMP_UT_SYSLEN version: 2 updated: 2012/10/04 20:12:20
  5752. dnl -----------------
  5753. dnl Check if UTMP/UTMPX struct defines ut_syslen member
  5754. AC_DEFUN([CF_UTMP_UT_SYSLEN],
  5755. [
  5756. if test $cf_cv_have_utmp != no ; then
  5757. AC_MSG_CHECKING(if ${cf_cv_have_utmp}.ut_syslen is declared)
  5758. AC_CACHE_VAL(cf_cv_have_utmp_ut_syslen,[
  5759. AC_TRY_COMPILE([
  5760. #include <sys/types.h>
  5761. #include <${cf_cv_have_utmp}.h>],
  5762. [struct $cf_cv_have_utmp x; int y = x.ut_syslen],
  5763. [cf_cv_have_utmp_ut_syslen=yes],
  5764. [cf_cv_have_utmp_ut_syslen=no])
  5765. ])
  5766. AC_MSG_RESULT($cf_cv_have_utmp_ut_syslen)
  5767. test $cf_cv_have_utmp_ut_syslen != no && AC_DEFINE(HAVE_UTMP_UT_SYSLEN,1,[Define to 1 if UTMP/UTMPX struct defines ut_syslen member])
  5768. fi
  5769. ])dnl
  5770. dnl ---------------------------------------------------------------------------
  5771. dnl CF_UTMP_UT_XSTATUS version: 4 updated: 2012/10/04 20:12:20
  5772. dnl ------------------
  5773. dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported
  5774. dnl by various people:
  5775. dnl
  5776. dnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2)
  5777. dnl ut_exit.e_exit (SVR4)
  5778. dnl ut_exit.ut_e_exit (os390 - Greg Smith)
  5779. dnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala)
  5780. dnl
  5781. dnl Note: utmp_xstatus is not a conventional compatibility definition in the
  5782. dnl system header files.
  5783. AC_DEFUN([CF_UTMP_UT_XSTATUS],
  5784. [
  5785. if test $cf_cv_have_utmp != no ; then
  5786. AC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[
  5787. for cf_result in \
  5788. ut_exit.__e_exit \
  5789. ut_exit.e_exit \
  5790. ut_exit.ut_e_exit \
  5791. ut_exit.ut_exit
  5792. do
  5793. AC_TRY_COMPILE([
  5794. #include <sys/types.h>
  5795. #include <${cf_cv_have_utmp}.h>],
  5796. [struct $cf_cv_have_utmp x; long y = x.$cf_result = 0],
  5797. [cf_cv_have_utmp_ut_xstatus=$cf_result
  5798. break],
  5799. [cf_cv_have_utmp_ut_xstatus=no])
  5800. done
  5801. ])
  5802. if test $cf_cv_have_utmp_ut_xstatus != no ; then
  5803. AC_DEFINE(HAVE_UTMP_UT_XSTATUS,1,[Define to 1 if UTMP/UTMPX has exit-status member])
  5804. AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus,[Define if needed to rename member ut_xstatus of UTMP/UTMPX])
  5805. fi
  5806. fi
  5807. ])dnl
  5808. dnl ---------------------------------------------------------------------------
  5809. dnl CF_UTMP_UT_XTIME version: 9 updated: 2012/10/04 20:12:20
  5810. dnl ----------------
  5811. dnl Check if UTMP/UTMPX struct defines ut_xtime member
  5812. AC_DEFUN([CF_UTMP_UT_XTIME],
  5813. [
  5814. if test $cf_cv_have_utmp != no ; then
  5815. AC_CACHE_CHECK(if ${cf_cv_have_utmp}.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[
  5816. AC_TRY_COMPILE([
  5817. #include <sys/types.h>
  5818. #include <${cf_cv_have_utmp}.h>],
  5819. [struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0],
  5820. [cf_cv_have_utmp_ut_xtime=yes],
  5821. [AC_TRY_COMPILE([
  5822. #include <sys/types.h>
  5823. #include <${cf_cv_have_utmp}.h>],
  5824. [struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec],
  5825. [cf_cv_have_utmp_ut_xtime=define],
  5826. [cf_cv_have_utmp_ut_xtime=no])
  5827. ])
  5828. ])
  5829. if test $cf_cv_have_utmp_ut_xtime != no ; then
  5830. AC_DEFINE(HAVE_UTMP_UT_XTIME,1,[Define to 1 if UTMP/UTMPX struct defines ut_xtime member])
  5831. if test $cf_cv_have_utmp_ut_xtime = define ; then
  5832. AC_DEFINE(ut_xtime,ut_tv.tv_sec,[Define if needed to alternate name for utmpx.ut_xtime member])
  5833. fi
  5834. fi
  5835. fi
  5836. ])dnl
  5837. dnl ---------------------------------------------------------------------------
  5838. dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
  5839. dnl ----------
  5840. dnl Use AC_VERBOSE w/o the warnings
  5841. AC_DEFUN([CF_VERBOSE],
  5842. [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
  5843. CF_MSG_LOG([$1])
  5844. ])dnl
  5845. dnl ---------------------------------------------------------------------------
  5846. dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
  5847. dnl ---------------
  5848. dnl Build up an expression $cf_wait_headers with the header files needed to
  5849. dnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's
  5850. dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
  5851. dnl with <wait.h>.
  5852. AC_DEFUN([CF_WAIT_HEADERS],
  5853. [
  5854. AC_HAVE_HEADERS(sys/wait.h)
  5855. cf_wait_headers="#include <sys/types.h>
  5856. "
  5857. if test $ac_cv_header_sys_wait_h = yes; then
  5858. cf_wait_headers="$cf_wait_headers
  5859. #include <sys/wait.h>
  5860. "
  5861. else
  5862. AC_HAVE_HEADERS(wait.h)
  5863. AC_HAVE_HEADERS(waitstatus.h)
  5864. if test $ac_cv_header_wait_h = yes; then
  5865. cf_wait_headers="$cf_wait_headers
  5866. #include <wait.h>
  5867. "
  5868. fi
  5869. if test $ac_cv_header_waitstatus_h = yes; then
  5870. cf_wait_headers="$cf_wait_headers
  5871. #include <waitstatus.h>
  5872. "
  5873. fi
  5874. fi
  5875. ])dnl
  5876. dnl ---------------------------------------------------------------------------
  5877. dnl CF_WIDEC_CURSES version: 5 updated: 2012/11/08 20:57:52
  5878. dnl ---------------
  5879. dnl Check for curses implementations that can handle wide-characters
  5880. AC_DEFUN([CF_WIDEC_CURSES],
  5881. [
  5882. AC_CACHE_CHECK(if curses supports wide characters,cf_cv_widec_curses,[
  5883. AC_TRY_LINK([
  5884. #include <stdlib.h>
  5885. #include <${cf_cv_ncurses_header:-curses.h}>],[
  5886. wchar_t temp[2];
  5887. wchar_t wch = 'A';
  5888. temp[0] = wch;
  5889. waddnwstr(stdscr, temp, 1);
  5890. ],
  5891. [cf_cv_widec_curses=yes],
  5892. [cf_cv_widec_curses=no])
  5893. ])
  5894. if test "$cf_cv_widec_curses" = yes ; then
  5895. AC_DEFINE(WIDEC_CURSES,1,[Define to 1 if curses supports wide characters])
  5896. # This is needed on Tru64 5.0 to declare mbstate_t
  5897. AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_widec_mbstate,[
  5898. AC_TRY_COMPILE([
  5899. #include <stdlib.h>
  5900. #include <${cf_cv_ncurses_header:-curses.h}>],
  5901. [mbstate_t state],
  5902. [cf_cv_widec_mbstate=no],
  5903. [AC_TRY_COMPILE([
  5904. #include <stdlib.h>
  5905. #include <wchar.h>
  5906. #include <${cf_cv_ncurses_header:-curses.h}>],
  5907. [mbstate_t state],
  5908. [cf_cv_widec_mbstate=yes],
  5909. [cf_cv_widec_mbstate=unknown])])])
  5910. if test "$cf_cv_widec_mbstate" = yes ; then
  5911. AC_DEFINE(NEED_WCHAR_H,1,[Define to 1 if we must include wchar.h])
  5912. fi
  5913. if test "$cf_cv_widec_mbstate" != unknown ; then
  5914. AC_DEFINE(HAVE_MBSTATE_T,1,[Define to 1 if we have mbstate_t type])
  5915. fi
  5916. fi
  5917. ])dnl
  5918. dnl ---------------------------------------------------------------------------
  5919. dnl CF_WITH_BZLIB version: 4 updated: 2007/07/29 13:19:54
  5920. dnl -------------
  5921. dnl Check for libbz2 aka "bzlib"
  5922. dnl
  5923. dnl $1 = optional path for headers/library
  5924. AC_DEFUN([CF_WITH_BZLIB],[
  5925. CF_ADD_OPTIONAL_PATH($1)
  5926. CF_FIND_LINKAGE([
  5927. #include <stdio.h>
  5928. #include <bzlib.h>
  5929. ],[
  5930. BZ2_bzopen("name","mode")
  5931. ],bz2,,,bzlib)
  5932. ])dnl
  5933. dnl ---------------------------------------------------------------------------
  5934. dnl CF_WITH_CURSES_DIR version: 3 updated: 2010/11/20 17:02:38
  5935. dnl ------------------
  5936. dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
  5937. dnl libraries.
  5938. AC_DEFUN([CF_WITH_CURSES_DIR],[
  5939. AC_MSG_CHECKING(for specific curses-directory)
  5940. AC_ARG_WITH(curses-dir,
  5941. [ --with-curses-dir=DIR directory in which (n)curses is installed],
  5942. [cf_cv_curses_dir=$withval],
  5943. [cf_cv_curses_dir=no])
  5944. AC_MSG_RESULT($cf_cv_curses_dir)
  5945. if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
  5946. then
  5947. CF_PATH_SYNTAX(withval)
  5948. if test -d "$cf_cv_curses_dir"
  5949. then
  5950. CF_ADD_INCDIR($cf_cv_curses_dir/include)
  5951. CF_ADD_LIBDIR($cf_cv_curses_dir/lib)
  5952. fi
  5953. fi
  5954. ])dnl
  5955. dnl ---------------------------------------------------------------------------
  5956. dnl CF_WITH_DBMALLOC version: 7 updated: 2010/06/21 17:26:47
  5957. dnl ----------------
  5958. dnl Configure-option for dbmalloc. The optional parameter is used to override
  5959. dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
  5960. AC_DEFUN([CF_WITH_DBMALLOC],[
  5961. CF_NO_LEAKS_OPTION(dbmalloc,
  5962. [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
  5963. [USE_DBMALLOC])
  5964. if test "$with_dbmalloc" = yes ; then
  5965. AC_CHECK_HEADER(dbmalloc.h,
  5966. [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse([$1],,[],[,$1]))])
  5967. fi
  5968. ])dnl
  5969. dnl ---------------------------------------------------------------------------
  5970. dnl CF_WITH_DMALLOC version: 7 updated: 2010/06/21 17:26:47
  5971. dnl ---------------
  5972. dnl Configure-option for dmalloc. The optional parameter is used to override
  5973. dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
  5974. AC_DEFUN([CF_WITH_DMALLOC],[
  5975. CF_NO_LEAKS_OPTION(dmalloc,
  5976. [ --with-dmalloc test: use Gray Watson's dmalloc library],
  5977. [USE_DMALLOC])
  5978. if test "$with_dmalloc" = yes ; then
  5979. AC_CHECK_HEADER(dmalloc.h,
  5980. [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse([$1],,[],[,$1]))])
  5981. fi
  5982. ])dnl
  5983. dnl ---------------------------------------------------------------------------
  5984. dnl CF_WITH_IDNA version: 9 updated: 2012/11/08 20:57:52
  5985. dnl ------------
  5986. dnl Check for libidn, use it if found.
  5987. dnl
  5988. dnl $1 = optional path for headers/library
  5989. AC_DEFUN([CF_WITH_IDNA],[
  5990. CF_ADD_OPTIONAL_PATH($1)
  5991. CF_FIND_LINKAGE([
  5992. #include <stdio.h>
  5993. #include <idna.h>
  5994. ],[
  5995. char *output = 0;
  5996. int code = idna_to_ascii_8z("name", &output, IDNA_USE_STD3_ASCII_RULES);
  5997. ],idn,,,,[$LIBICONV])
  5998. if test "x$cf_cv_find_linkage_idn" = xyes ; then
  5999. AC_DEFINE(USE_IDNA,1,[Define to 1 if we should use IDNA library])
  6000. fi
  6001. ])dnl
  6002. dnl ---------------------------------------------------------------------------
  6003. dnl CF_WITH_PATH version: 11 updated: 2012/09/29 15:04:19
  6004. dnl ------------
  6005. dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
  6006. dnl defaulting to yes/no.
  6007. dnl
  6008. dnl $1 = option name
  6009. dnl $2 = help-text
  6010. dnl $3 = environment variable to set
  6011. dnl $4 = default value, shown in the help-message, must be a constant
  6012. dnl $5 = default value, if it's an expression & cannot be in the help-message
  6013. dnl
  6014. AC_DEFUN([CF_WITH_PATH],
  6015. [AC_ARG_WITH($1,[$2 ](default: ifelse([$4],,empty,[$4])),,
  6016. ifelse([$4],,[withval="${$3}"],[withval="${$3:-ifelse([$5],,[$4],[$5])}"]))dnl
  6017. if ifelse([$5],,true,[test -n "$5"]) ; then
  6018. CF_PATH_SYNTAX(withval)
  6019. fi
  6020. eval $3="$withval"
  6021. AC_SUBST($3)dnl
  6022. ])dnl
  6023. dnl ---------------------------------------------------------------------------
  6024. dnl CF_WITH_ZLIB version: 4 updated: 2011/05/28 12:10:58
  6025. dnl ------------
  6026. dnl check for libz aka "zlib"
  6027. AC_DEFUN([CF_WITH_ZLIB],[
  6028. CF_ADD_OPTIONAL_PATH($1)
  6029. CF_FIND_LINKAGE([
  6030. #include <zlib.h>
  6031. ],[
  6032. gzopen("name","mode")
  6033. ],z,,,zlib)
  6034. AC_CHECK_FUNCS( \
  6035. zError \
  6036. )
  6037. ])dnl
  6038. dnl ---------------------------------------------------------------------------
  6039. dnl CF_XOPEN_CURSES version: 11 updated: 2011/01/18 18:15:30
  6040. dnl ---------------
  6041. dnl Test if we should define X/Open source for curses, needed on Digital Unix
  6042. dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
  6043. dnl
  6044. dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
  6045. dnl as getbegy(). The latter is better design, but the former is standard.
  6046. AC_DEFUN([CF_XOPEN_CURSES],
  6047. [
  6048. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  6049. AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
  6050. AC_TRY_LINK([
  6051. #include <stdlib.h>
  6052. #include <${cf_cv_ncurses_header:-curses.h}>],[
  6053. #if defined(NCURSES_VERSION_PATCH)
  6054. #if (NCURSES_VERSION_PATCH < 20100501) && (NCURSES_VERSION_PATCH >= 20100403)
  6055. make an error
  6056. #endif
  6057. #endif
  6058. long x = winnstr(stdscr, "", 0);
  6059. int x1, y1;
  6060. getbegyx(stdscr, y1, x1)],
  6061. [cf_cv_need_xopen_extension=no],
  6062. [AC_TRY_LINK([
  6063. #define _XOPEN_SOURCE_EXTENDED
  6064. #include <stdlib.h>
  6065. #include <${cf_cv_ncurses_header:-curses.h}>],[
  6066. #ifdef NCURSES_VERSION
  6067. cchar_t check;
  6068. int check2 = curs_set((int)sizeof(check));
  6069. #endif
  6070. long x = winnstr(stdscr, "", 0);
  6071. int x1, y1;
  6072. getbegyx(stdscr, y1, x1)],
  6073. [cf_cv_need_xopen_extension=yes],
  6074. [cf_cv_need_xopen_extension=unknown])])])
  6075. test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
  6076. ])dnl
  6077. dnl ---------------------------------------------------------------------------
  6078. dnl CF_XOPEN_SOURCE version: 45 updated: 2013/09/07 14:06:25
  6079. dnl ---------------
  6080. dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
  6081. dnl or adapt to the vendor's definitions to get equivalent functionality,
  6082. dnl without losing the common non-POSIX features.
  6083. dnl
  6084. dnl Parameters:
  6085. dnl $1 is the nominal value for _XOPEN_SOURCE
  6086. dnl $2 is the nominal value for _POSIX_C_SOURCE
  6087. AC_DEFUN([CF_XOPEN_SOURCE],[
  6088. AC_REQUIRE([AC_CANONICAL_HOST])
  6089. cf_XOPEN_SOURCE=ifelse([$1],,500,[$1])
  6090. cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2])
  6091. cf_xopen_source=
  6092. case $host_os in #(vi
  6093. aix[[4-7]]*) #(vi
  6094. cf_xopen_source="-D_ALL_SOURCE"
  6095. ;;
  6096. cygwin|msys) #(vi
  6097. cf_XOPEN_SOURCE=600
  6098. ;;
  6099. darwin[[0-8]].*) #(vi
  6100. cf_xopen_source="-D_APPLE_C_SOURCE"
  6101. ;;
  6102. darwin*) #(vi
  6103. cf_xopen_source="-D_DARWIN_C_SOURCE"
  6104. cf_XOPEN_SOURCE=
  6105. ;;
  6106. freebsd*|dragonfly*) #(vi
  6107. # 5.x headers associate
  6108. # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
  6109. # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
  6110. cf_POSIX_C_SOURCE=200112L
  6111. cf_XOPEN_SOURCE=600
  6112. cf_xopen_source="-D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
  6113. ;;
  6114. hpux11*) #(vi
  6115. cf_xopen_source="-D_HPUX_SOURCE -D_XOPEN_SOURCE=500"
  6116. ;;
  6117. hpux*) #(vi
  6118. cf_xopen_source="-D_HPUX_SOURCE"
  6119. ;;
  6120. irix[[56]].*) #(vi
  6121. cf_xopen_source="-D_SGI_SOURCE"
  6122. cf_XOPEN_SOURCE=
  6123. ;;
  6124. linux*|gnu*|mint*|k*bsd*-gnu) #(vi
  6125. CF_GNU_SOURCE
  6126. ;;
  6127. mirbsd*) #(vi
  6128. # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <sys/select.h> and other headers which use u_int / u_short types
  6129. cf_XOPEN_SOURCE=
  6130. CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
  6131. ;;
  6132. netbsd*) #(vi
  6133. cf_xopen_source="-D_NETBSD_SOURCE" # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
  6134. ;;
  6135. openbsd[[4-9]]*) #(vi
  6136. # setting _XOPEN_SOURCE lower than 500 breaks g++ compile with wchar.h, needed for ncursesw
  6137. cf_xopen_source="-D_BSD_SOURCE"
  6138. cf_XOPEN_SOURCE=600
  6139. ;;
  6140. openbsd*) #(vi
  6141. # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
  6142. ;;
  6143. osf[[45]]*) #(vi
  6144. cf_xopen_source="-D_OSF_SOURCE"
  6145. ;;
  6146. nto-qnx*) #(vi
  6147. cf_xopen_source="-D_QNX_SOURCE"
  6148. ;;
  6149. sco*) #(vi
  6150. # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
  6151. ;;
  6152. solaris2.*) #(vi
  6153. cf_xopen_source="-D__EXTENSIONS__"
  6154. ;;
  6155. *)
  6156. CF_TRY_XOPEN_SOURCE
  6157. CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
  6158. ;;
  6159. esac
  6160. if test -n "$cf_xopen_source" ; then
  6161. CF_ADD_CFLAGS($cf_xopen_source)
  6162. fi
  6163. dnl In anything but the default case, we may have system-specific setting
  6164. dnl which is still not guaranteed to provide all of the entrypoints that
  6165. dnl _XOPEN_SOURCE would yield.
  6166. if test -n "$cf_XOPEN_SOURCE" && test -z "$cf_cv_xopen_source" ; then
  6167. AC_MSG_CHECKING(if _XOPEN_SOURCE really is set)
  6168. AC_TRY_COMPILE([#include <stdlib.h>],[
  6169. #ifndef _XOPEN_SOURCE
  6170. make an error
  6171. #endif],
  6172. [cf_XOPEN_SOURCE_set=yes],
  6173. [cf_XOPEN_SOURCE_set=no])
  6174. AC_MSG_RESULT($cf_XOPEN_SOURCE_set)
  6175. if test $cf_XOPEN_SOURCE_set = yes
  6176. then
  6177. AC_TRY_COMPILE([#include <stdlib.h>],[
  6178. #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE
  6179. make an error
  6180. #endif],
  6181. [cf_XOPEN_SOURCE_set_ok=yes],
  6182. [cf_XOPEN_SOURCE_set_ok=no])
  6183. if test $cf_XOPEN_SOURCE_set_ok = no
  6184. then
  6185. AC_MSG_WARN(_XOPEN_SOURCE is lower than requested)
  6186. fi
  6187. else
  6188. CF_TRY_XOPEN_SOURCE
  6189. fi
  6190. fi
  6191. ])
  6192. dnl ---------------------------------------------------------------------------
  6193. dnl CF_X_ATHENA version: 21 updated: 2013/07/06 21:27:06
  6194. dnl -----------
  6195. dnl Check for Xaw (Athena) libraries
  6196. dnl
  6197. dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
  6198. AC_DEFUN([CF_X_ATHENA],
  6199. [
  6200. cf_x_athena=${cf_x_athena:-Xaw}
  6201. AC_MSG_CHECKING(if you want to link with Xaw 3d library)
  6202. withval=
  6203. AC_ARG_WITH(Xaw3d,
  6204. [ --with-Xaw3d link with Xaw 3d library])
  6205. if test "$withval" = yes ; then
  6206. cf_x_athena=Xaw3d
  6207. AC_MSG_RESULT(yes)
  6208. else
  6209. AC_MSG_RESULT(no)
  6210. fi
  6211. AC_MSG_CHECKING(if you want to link with neXT Athena library)
  6212. withval=
  6213. AC_ARG_WITH(neXtaw,
  6214. [ --with-neXtaw link with neXT Athena library])
  6215. if test "$withval" = yes ; then
  6216. cf_x_athena=neXtaw
  6217. AC_MSG_RESULT(yes)
  6218. else
  6219. AC_MSG_RESULT(no)
  6220. fi
  6221. AC_MSG_CHECKING(if you want to link with Athena-Plus library)
  6222. withval=
  6223. AC_ARG_WITH(XawPlus,
  6224. [ --with-XawPlus link with Athena-Plus library])
  6225. if test "$withval" = yes ; then
  6226. cf_x_athena=XawPlus
  6227. AC_MSG_RESULT(yes)
  6228. else
  6229. AC_MSG_RESULT(no)
  6230. fi
  6231. cf_x_athena_lib=""
  6232. if test "$PKG_CONFIG" != none ; then
  6233. cf_athena_list=
  6234. test "$cf_x_athena" = Xaw && cf_athena_list="xaw8 xaw7 xaw6"
  6235. for cf_athena_pkg in \
  6236. $cf_athena_list \
  6237. ${cf_x_athena} \
  6238. ${cf_x_athena}-devel \
  6239. lib${cf_x_athena} \
  6240. lib${cf_x_athena}-devel
  6241. do
  6242. CF_TRY_PKG_CONFIG($cf_athena_pkg,[
  6243. cf_x_athena_lib="$cf_pkgconfig_libs"
  6244. CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
  6245. AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
  6246. CF_TRIM_X_LIBS
  6247. AC_CACHE_CHECK(for usable $cf_x_athena/Xmu package,cf_cv_xaw_compat,[
  6248. AC_TRY_LINK([
  6249. #include <X11/Xmu/CharSet.h>
  6250. ],[
  6251. int check = XmuCompareISOLatin1("big", "small")
  6252. ],[cf_cv_xaw_compat=yes],[cf_cv_xaw_compat=no])])
  6253. if test "$cf_cv_xaw_compat" = no
  6254. then
  6255. # workaround for broken ".pc" files...
  6256. case "$cf_x_athena_lib" in #(vi
  6257. *-lXmu*) #(vi
  6258. ;;
  6259. *)
  6260. CF_VERBOSE(work around broken package)
  6261. cf_save_xmu="$LIBS"
  6262. cf_first_lib=`echo "$cf_save_xmu" | sed -e 's/^[ ][ ]*//' -e 's/ .*//'`
  6263. CF_TRY_PKG_CONFIG(xmu,[
  6264. LIBS="$cf_save_xmu"
  6265. CF_ADD_LIB_AFTER($cf_first_lib,$cf_pkgconfig_libs)
  6266. ],[
  6267. CF_ADD_LIB_AFTER($cf_first_lib,-lXmu)
  6268. ])
  6269. CF_TRIM_X_LIBS
  6270. ;;
  6271. esac
  6272. fi
  6273. break])
  6274. done
  6275. fi
  6276. if test -z "$cf_x_athena_lib" ; then
  6277. CF_X_EXT
  6278. CF_X_TOOLKIT
  6279. CF_X_ATHENA_CPPFLAGS($cf_x_athena)
  6280. CF_X_ATHENA_LIBS($cf_x_athena)
  6281. fi
  6282. ])dnl
  6283. dnl ---------------------------------------------------------------------------
  6284. dnl CF_X_ATHENA_CPPFLAGS version: 5 updated: 2010/05/26 17:35:30
  6285. dnl --------------------
  6286. dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
  6287. dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
  6288. AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
  6289. [
  6290. cf_x_athena_root=ifelse([$1],,Xaw,[$1])
  6291. cf_x_athena_inc=""
  6292. for cf_path in default \
  6293. /usr/contrib/X11R6 \
  6294. /usr/contrib/X11R5 \
  6295. /usr/lib/X11R5 \
  6296. /usr/local
  6297. do
  6298. if test -z "$cf_x_athena_inc" ; then
  6299. cf_save="$CPPFLAGS"
  6300. cf_test=X11/$cf_x_athena_root/SimpleMenu.h
  6301. if test $cf_path != default ; then
  6302. CPPFLAGS="$cf_save -I$cf_path/include"
  6303. AC_MSG_CHECKING(for $cf_test in $cf_path)
  6304. else
  6305. AC_MSG_CHECKING(for $cf_test)
  6306. fi
  6307. AC_TRY_COMPILE([
  6308. #include <X11/Intrinsic.h>
  6309. #include <$cf_test>],[],
  6310. [cf_result=yes],
  6311. [cf_result=no])
  6312. AC_MSG_RESULT($cf_result)
  6313. if test "$cf_result" = yes ; then
  6314. cf_x_athena_inc=$cf_path
  6315. break
  6316. else
  6317. CPPFLAGS="$cf_save"
  6318. fi
  6319. fi
  6320. done
  6321. if test -z "$cf_x_athena_inc" ; then
  6322. AC_MSG_WARN(
  6323. [Unable to successfully find Athena header files with test program])
  6324. elif test "$cf_x_athena_inc" != default ; then
  6325. CPPFLAGS="$CPPFLAGS -I$cf_x_athena_inc"
  6326. fi
  6327. ])
  6328. dnl ---------------------------------------------------------------------------
  6329. dnl CF_X_ATHENA_LIBS version: 12 updated: 2011/07/17 19:55:02
  6330. dnl ----------------
  6331. dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
  6332. dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
  6333. AC_DEFUN([CF_X_ATHENA_LIBS],
  6334. [AC_REQUIRE([CF_X_TOOLKIT])
  6335. cf_x_athena_root=ifelse([$1],,Xaw,[$1])
  6336. cf_x_athena_lib=""
  6337. for cf_path in default \
  6338. /usr/contrib/X11R6 \
  6339. /usr/contrib/X11R5 \
  6340. /usr/lib/X11R5 \
  6341. /usr/local
  6342. do
  6343. for cf_lib in \
  6344. ${cf_x_athena_root} \
  6345. ${cf_x_athena_root}7 \
  6346. ${cf_x_athena_root}6
  6347. do
  6348. for cf_libs in \
  6349. "-l$cf_lib -lXmu" \
  6350. "-l$cf_lib -lXpm -lXmu" \
  6351. "-l${cf_lib}_s -lXmu_s"
  6352. do
  6353. if test -z "$cf_x_athena_lib" ; then
  6354. cf_save="$LIBS"
  6355. cf_test=XawSimpleMenuAddGlobalActions
  6356. if test $cf_path != default ; then
  6357. CF_ADD_LIBS(-L$cf_path/lib $cf_libs)
  6358. AC_MSG_CHECKING(for $cf_libs in $cf_path)
  6359. else
  6360. CF_ADD_LIBS($cf_libs)
  6361. AC_MSG_CHECKING(for $cf_test in $cf_libs)
  6362. fi
  6363. AC_TRY_LINK([
  6364. #include <X11/Intrinsic.h>
  6365. #include <X11/$cf_x_athena_root/SimpleMenu.h>
  6366. ],[
  6367. $cf_test((XtAppContext) 0)],
  6368. [cf_result=yes],
  6369. [cf_result=no])
  6370. AC_MSG_RESULT($cf_result)
  6371. if test "$cf_result" = yes ; then
  6372. cf_x_athena_lib="$cf_libs"
  6373. break
  6374. fi
  6375. LIBS="$cf_save"
  6376. fi
  6377. done # cf_libs
  6378. test -n "$cf_x_athena_lib" && break
  6379. done # cf_lib
  6380. done
  6381. if test -z "$cf_x_athena_lib" ; then
  6382. AC_MSG_ERROR(
  6383. [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
  6384. fi
  6385. CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
  6386. AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
  6387. ])
  6388. dnl ---------------------------------------------------------------------------
  6389. dnl CF_X_EXT version: 3 updated: 2010/06/02 05:03:05
  6390. dnl --------
  6391. AC_DEFUN([CF_X_EXT],[
  6392. CF_TRY_PKG_CONFIG(Xext,,[
  6393. AC_CHECK_LIB(Xext,XextCreateExtension,
  6394. [CF_ADD_LIB(Xext)])])
  6395. ])dnl
  6396. dnl ---------------------------------------------------------------------------
  6397. dnl CF_X_TOOLKIT version: 21 updated: 2012/10/04 06:57:36
  6398. dnl ------------
  6399. dnl Check for X Toolkit libraries
  6400. dnl
  6401. AC_DEFUN([CF_X_TOOLKIT],
  6402. [
  6403. AC_REQUIRE([AC_PATH_XTRA])
  6404. AC_REQUIRE([CF_CHECK_CACHE])
  6405. cf_have_X_LIBS=no
  6406. CF_TRY_PKG_CONFIG(xt,[
  6407. case "x$LIBS" in #(vi
  6408. *-lX11*) #(vi
  6409. ;;
  6410. *)
  6411. # we have an "xt" package, but it may omit Xt's dependency on X11
  6412. AC_CACHE_CHECK(for usable X dependency,cf_cv_xt_x11_compat,[
  6413. AC_TRY_LINK([
  6414. #include <X11/Xlib.h>
  6415. ],[
  6416. int rc1 = XDrawLine((Display*) 0, (Drawable) 0, (GC) 0, 0, 0, 0, 0);
  6417. int rc2 = XClearWindow((Display*) 0, (Window) 0);
  6418. int rc3 = XMoveWindow((Display*) 0, (Window) 0, 0, 0);
  6419. int rc4 = XMoveResizeWindow((Display*)0, (Window)0, 0, 0, 0, 0);
  6420. ],[cf_cv_xt_x11_compat=yes],[cf_cv_xt_x11_compat=no])])
  6421. if test "$cf_cv_xt_x11_compat" = no
  6422. then
  6423. CF_VERBOSE(work around broken X11 dependency)
  6424. # 2010/11/19 - good enough until a working Xt on Xcb is delivered.
  6425. CF_TRY_PKG_CONFIG(x11,,[CF_ADD_LIB_AFTER(-lXt,-lX11)])
  6426. fi
  6427. ;;
  6428. esac
  6429. AC_CACHE_CHECK(for usable X Toolkit package,cf_cv_xt_ice_compat,[
  6430. AC_TRY_LINK([
  6431. #include <X11/Shell.h>
  6432. ],[int num = IceConnectionNumber(0)
  6433. ],[cf_cv_xt_ice_compat=yes],[cf_cv_xt_ice_compat=no])])
  6434. if test "$cf_cv_xt_ice_compat" = no
  6435. then
  6436. # workaround for broken ".pc" files used for X Toolkit.
  6437. case "x$X_PRE_LIBS" in #(vi
  6438. *-lICE*)
  6439. case "x$LIBS" in #(vi
  6440. *-lICE*) #(vi
  6441. ;;
  6442. *)
  6443. CF_VERBOSE(work around broken ICE dependency)
  6444. CF_TRY_PKG_CONFIG(ice,
  6445. [CF_TRY_PKG_CONFIG(sm)],
  6446. [CF_ADD_LIB_AFTER(-lXt,$X_PRE_LIBS)])
  6447. ;;
  6448. esac
  6449. ;;
  6450. esac
  6451. fi
  6452. cf_have_X_LIBS=yes
  6453. ],[
  6454. LDFLAGS="$X_LIBS $LDFLAGS"
  6455. CF_CHECK_CFLAGS($X_CFLAGS)
  6456. AC_CHECK_FUNC(XOpenDisplay,,[
  6457. AC_CHECK_LIB(X11,XOpenDisplay,
  6458. [CF_ADD_LIB(X11)],,
  6459. [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
  6460. AC_CHECK_FUNC(XtAppInitialize,,[
  6461. AC_CHECK_LIB(Xt, XtAppInitialize,
  6462. [AC_DEFINE(HAVE_LIBXT,1,[Define to 1 if we can compile with the Xt library])
  6463. cf_have_X_LIBS=Xt
  6464. LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS"],,
  6465. [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
  6466. ])
  6467. if test $cf_have_X_LIBS = no ; then
  6468. AC_MSG_WARN(
  6469. [Unable to successfully link X Toolkit library (-lXt) with
  6470. test program. You will have to check and add the proper libraries by hand
  6471. to makefile.])
  6472. fi
  6473. ])dnl
  6474. dnl ---------------------------------------------------------------------------
  6475. dnl CF__CURSES_HEAD version: 2 updated: 2010/10/23 15:54:49
  6476. dnl ---------------
  6477. dnl Define a reusable chunk which includes <curses.h> and <term.h> when they
  6478. dnl are both available.
  6479. define([CF__CURSES_HEAD],[
  6480. #ifdef HAVE_XCURSES
  6481. #include <xcurses.h>
  6482. char * XCursesProgramName = "test";
  6483. #else
  6484. #include <${cf_cv_ncurses_header:-curses.h}>
  6485. #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
  6486. #include <ncursesw/term.h>
  6487. #elif defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
  6488. #include <ncurses/term.h>
  6489. #elif defined(HAVE_TERM_H)
  6490. #include <term.h>
  6491. #endif
  6492. #endif
  6493. ])
  6494. dnl ---------------------------------------------------------------------------
  6495. dnl CF__ICONV_BODY version: 2 updated: 2007/07/26 17:35:47
  6496. dnl --------------
  6497. dnl Test-code needed for iconv compile-checks
  6498. define([CF__ICONV_BODY],[
  6499. iconv_t cd = iconv_open("","");
  6500. iconv(cd,NULL,NULL,NULL,NULL);
  6501. iconv_close(cd);]
  6502. )dnl
  6503. dnl ---------------------------------------------------------------------------
  6504. dnl CF__ICONV_HEAD version: 1 updated: 2007/07/26 15:57:03
  6505. dnl --------------
  6506. dnl Header-files needed for iconv compile-checks
  6507. define([CF__ICONV_HEAD],[
  6508. #include <stdlib.h>
  6509. #include <iconv.h>]
  6510. )dnl
  6511. dnl ---------------------------------------------------------------------------
  6512. dnl CF__INET_HEAD version: 1 updated: 2013/10/08 17:47:05
  6513. dnl -------------
  6514. dnl Header-files needed for inet.h compile-checks
  6515. define([CF__INET_HEAD],[
  6516. #if defined(__MINGW32__)
  6517. #undef WIN32_LEAN_AND_MEAN
  6518. #define WIN32_LEAN_AND_MEAN
  6519. #include <windows.h>
  6520. #ifdef HAVE_WINSOCK2_H
  6521. #include <winsock2.h>
  6522. #else
  6523. #ifdef HAVE_WINSOCK_H
  6524. #include <winsock.h>
  6525. #endif
  6526. #endif
  6527. #else
  6528. #include <sys/types.h>
  6529. #include <sys/socket.h>
  6530. #include <netinet/in.h>
  6531. #include <arpa/inet.h>
  6532. #endif
  6533. ])dnl
  6534. dnl ---------------------------------------------------------------------------
  6535. dnl CF__INTL_BODY version: 1 updated: 2007/07/26 17:35:47
  6536. dnl -------------
  6537. dnl Test-code needed for libintl compile-checks
  6538. dnl $1 = parameter 2 from AM_WITH_NLS
  6539. define([CF__INTL_BODY],[
  6540. bindtextdomain ("", "");
  6541. return (int) gettext ("")
  6542. ifelse([$1], need-ngettext, [ + (int) ngettext ("", "", 0)], [])
  6543. [ + _nl_msg_cat_cntr]
  6544. ])
  6545. dnl ---------------------------------------------------------------------------
  6546. dnl CF__INTL_HEAD version: 1 updated: 2007/07/26 17:35:47
  6547. dnl -------------
  6548. dnl Header-files needed for libintl compile-checks
  6549. define([CF__INTL_HEAD],[
  6550. #include <libintl.h>
  6551. extern int _nl_msg_cat_cntr;
  6552. ])dnl
  6553. dnl ---------------------------------------------------------------------------
  6554. dnl CF__SSL_BODY version: 2 updated: 2008/04/13 10:56:06
  6555. dnl ------------
  6556. dnl Body for test-compile of SSL code.
  6557. define([CF__SSL_BODY],[
  6558. #ifdef USE_GNUTLS_FUNCS
  6559. gnutls_global_init();
  6560. #else
  6561. SSL_shutdown((SSL *)0)
  6562. #endif
  6563. ])dnl
  6564. dnl ---------------------------------------------------------------------------
  6565. dnl CF__SSL_HEAD version: 2 updated: 2008/04/13 10:56:06
  6566. dnl ------------
  6567. dnl Headers for test-compile of SSL code.
  6568. define([CF__SSL_HEAD],[
  6569. #include <stdio.h>
  6570. #if defined(USE_OPENSSL_INCL)
  6571. #include <openssl/ssl.h>
  6572. #elif defined(USE_GNUTLS_FUNCS)
  6573. #include <gnutls/gnutls.h>
  6574. #elif defined(USE_GNUTLS_INCL)
  6575. #include <gnutls/openssl.h>
  6576. #else
  6577. #include <ssl.h>
  6578. #endif
  6579. ])dnl
  6580. dnl ---------------------------------------------------------------------------
  6581. dnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42
  6582. dnl ----------
  6583. dnl Inserted as requested by gettext 0.10.40
  6584. dnl File from /usr/share/aclocal
  6585. dnl glibc21.m4
  6586. dnl ====================
  6587. dnl serial 2
  6588. dnl
  6589. dnl Test for the GNU C Library, version 2.1 or newer.
  6590. dnl From Bruno Haible.
  6591. AC_DEFUN([jm_GLIBC21],
  6592. [
  6593. AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
  6594. ac_cv_gnu_library_2_1,
  6595. [AC_EGREP_CPP([Lucky GNU user],
  6596. [
  6597. #include <features.h>
  6598. #ifdef __GNU_LIBRARY__
  6599. #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
  6600. Lucky GNU user
  6601. #endif
  6602. #endif
  6603. ],
  6604. ac_cv_gnu_library_2_1=yes,
  6605. ac_cv_gnu_library_2_1=no)
  6606. ]
  6607. )
  6608. AC_SUBST(GLIBC21)
  6609. GLIBC21="$ac_cv_gnu_library_2_1"
  6610. ]
  6611. )