aclocal.m4 163 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776
  1. dnl***************************************************************************
  2. dnl Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. *
  3. dnl *
  4. dnl Permission is hereby granted, free of charge, to any person obtaining a *
  5. dnl copy of this software and associated documentation files (the *
  6. dnl "Software"), to deal in the Software without restriction, including *
  7. dnl without limitation the rights to use, copy, modify, merge, publish, *
  8. dnl distribute, distribute with modifications, sublicense, and/or sell *
  9. dnl copies of the Software, and to permit persons to whom the Software is *
  10. dnl furnished to do so, subject to the following conditions: *
  11. dnl *
  12. dnl The above copyright notice and this permission notice shall be included *
  13. dnl in all copies or substantial portions of the Software. *
  14. dnl *
  15. dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
  16. dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
  17. dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
  18. dnl IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  19. dnl DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  20. dnl OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
  21. dnl THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
  22. dnl *
  23. dnl Except as contained in this notice, the name(s) of the above copyright *
  24. dnl holders shall not be used in advertising or otherwise to promote the *
  25. dnl sale, use or other dealings in this Software without prior written *
  26. dnl authorization. *
  27. dnl***************************************************************************
  28. dnl
  29. dnl Author: Thomas E. Dickey 1995-on
  30. dnl
  31. dnl $Id: aclocal.m4,v 1.483 2009/02/07 19:12:17 tom Exp $
  32. dnl Macros used in NCURSES auto-configuration script.
  33. dnl
  34. dnl These macros are maintained separately from NCURSES. The copyright on
  35. dnl this file applies to the aggregation of macros and does not affect use of
  36. dnl these macros in other applications.
  37. dnl
  38. dnl See http://invisible-island.net/autoconf/ for additional information.
  39. dnl
  40. dnl ---------------------------------------------------------------------------
  41. dnl ---------------------------------------------------------------------------
  42. dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
  43. dnl -------------------
  44. dnl Inserted as requested by gettext 0.10.40
  45. dnl File from /usr/share/aclocal
  46. dnl codeset.m4
  47. dnl ====================
  48. dnl serial AM1
  49. dnl
  50. dnl From Bruno Haible.
  51. AC_DEFUN([AM_LANGINFO_CODESET],
  52. [
  53. AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
  54. [AC_TRY_LINK([#include <langinfo.h>],
  55. [char* cs = nl_langinfo(CODESET);],
  56. am_cv_langinfo_codeset=yes,
  57. am_cv_langinfo_codeset=no)
  58. ])
  59. if test $am_cv_langinfo_codeset = yes; then
  60. AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
  61. [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  62. fi
  63. ])dnl
  64. dnl ---------------------------------------------------------------------------
  65. dnl CF_ADA_INCLUDE_DIRS version: 5 updated: 2006/10/14 15:23:15
  66. dnl -------------------
  67. dnl Construct the list of include-options for the C programs in the Ada95
  68. dnl binding.
  69. AC_DEFUN([CF_ADA_INCLUDE_DIRS],
  70. [
  71. ACPPFLAGS="-I. -I../../include $ACPPFLAGS"
  72. if test "$srcdir" != "."; then
  73. ACPPFLAGS="-I\${srcdir}/../../include $ACPPFLAGS"
  74. fi
  75. if test "$GCC" != yes; then
  76. ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
  77. elif test "$includedir" != "/usr/include"; then
  78. if test "$includedir" = '${prefix}/include' ; then
  79. if test $prefix != /usr ; then
  80. ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
  81. fi
  82. else
  83. ACPPFLAGS="$ACPPFLAGS -I\${includedir}"
  84. fi
  85. fi
  86. AC_SUBST(ACPPFLAGS)
  87. ])dnl
  88. dnl ---------------------------------------------------------------------------
  89. dnl CF_ADD_CFLAGS version: 8 updated: 2009/01/06 19:33:30
  90. dnl -------------
  91. dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
  92. dnl The second parameter if given makes this macro verbose.
  93. dnl
  94. dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
  95. dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
  96. dnl confused by the quotes (which require backslashes to keep them usable).
  97. AC_DEFUN([CF_ADD_CFLAGS],
  98. [
  99. cf_fix_cppflags=no
  100. cf_new_cflags=
  101. cf_new_cppflags=
  102. cf_new_extra_cppflags=
  103. for cf_add_cflags in $1
  104. do
  105. case $cf_fix_cppflags in
  106. no)
  107. case $cf_add_cflags in #(vi
  108. -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
  109. case $cf_add_cflags in
  110. -D*)
  111. cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
  112. test "${cf_add_cflags}" != "${cf_tst_cflags}" \
  113. && test -z "${cf_tst_cflags}" \
  114. && cf_fix_cppflags=yes
  115. if test $cf_fix_cppflags = yes ; then
  116. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  117. continue
  118. elif test "${cf_tst_cflags}" = "\"'" ; then
  119. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  120. continue
  121. fi
  122. ;;
  123. esac
  124. case "$CPPFLAGS" in
  125. *$cf_add_cflags) #(vi
  126. ;;
  127. *) #(vi
  128. cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
  129. ;;
  130. esac
  131. ;;
  132. *)
  133. cf_new_cflags="$cf_new_cflags $cf_add_cflags"
  134. ;;
  135. esac
  136. ;;
  137. yes)
  138. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  139. cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
  140. test "${cf_add_cflags}" != "${cf_tst_cflags}" \
  141. && test -z "${cf_tst_cflags}" \
  142. && cf_fix_cppflags=no
  143. ;;
  144. esac
  145. done
  146. if test -n "$cf_new_cflags" ; then
  147. ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
  148. CFLAGS="$CFLAGS $cf_new_cflags"
  149. fi
  150. if test -n "$cf_new_cppflags" ; then
  151. ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
  152. CPPFLAGS="$CPPFLAGS $cf_new_cppflags"
  153. fi
  154. if test -n "$cf_new_extra_cppflags" ; then
  155. ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
  156. EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
  157. fi
  158. AC_SUBST(EXTRA_CPPFLAGS)
  159. ])dnl
  160. dnl ---------------------------------------------------------------------------
  161. dnl CF_ADD_INCDIR version: 12 updated: 2009/01/18 10:00:47
  162. dnl -------------
  163. dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
  164. dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
  165. dnl but old versions (and some misinstalled ones) need that. To make things
  166. dnl worse, gcc 3.x may give error messages if -I/usr/local/include is added to
  167. dnl the include-path).
  168. AC_DEFUN([CF_ADD_INCDIR],
  169. [
  170. if test -n "$1" ; then
  171. for cf_add_incdir in $1
  172. do
  173. while test $cf_add_incdir != /usr/include
  174. do
  175. if test -d $cf_add_incdir
  176. then
  177. cf_have_incdir=no
  178. if test -n "$CFLAGS$CPPFLAGS" ; then
  179. # a loop is needed to ensure we can add subdirs of existing dirs
  180. for cf_test_incdir in $CFLAGS $CPPFLAGS ; do
  181. if test ".$cf_test_incdir" = ".-I$cf_add_incdir" ; then
  182. cf_have_incdir=yes; break
  183. fi
  184. done
  185. fi
  186. if test "$cf_have_incdir" = no ; then
  187. if test "$cf_add_incdir" = /usr/local/include ; then
  188. if test "$GCC" = yes
  189. then
  190. cf_save_CPPFLAGS=$CPPFLAGS
  191. CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
  192. AC_TRY_COMPILE([#include <stdio.h>],
  193. [printf("Hello")],
  194. [],
  195. [cf_have_incdir=yes])
  196. CPPFLAGS=$cf_save_CPPFLAGS
  197. fi
  198. fi
  199. fi
  200. if test "$cf_have_incdir" = no ; then
  201. CF_VERBOSE(adding $cf_add_incdir to include-path)
  202. ifelse($2,,CPPFLAGS,$2)="$ifelse($2,,CPPFLAGS,$2) -I$cf_add_incdir"
  203. cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
  204. test "$cf_top_incdir" = "$cf_add_incdir" && break
  205. cf_add_incdir="$cf_top_incdir"
  206. else
  207. break
  208. fi
  209. fi
  210. done
  211. done
  212. fi
  213. ])dnl
  214. dnl ---------------------------------------------------------------------------
  215. dnl CF_ADD_LIBDIR version: 8 updated: 2009/01/18 10:01:08
  216. dnl -------------
  217. dnl Adds to the library-path
  218. dnl
  219. dnl Some machines have trouble with multiple -L options.
  220. dnl
  221. dnl $1 is the (list of) directory(s) to add
  222. dnl $2 is the optional name of the variable to update (default LDFLAGS)
  223. dnl
  224. AC_DEFUN([CF_ADD_LIBDIR],
  225. [
  226. if test -n "$1" ; then
  227. for cf_add_libdir in $1
  228. do
  229. if test $cf_add_libdir = /usr/lib ; then
  230. :
  231. elif test -d $cf_add_libdir
  232. then
  233. cf_have_libdir=no
  234. if test -n "$LDFLAGS$LIBS" ; then
  235. # a loop is needed to ensure we can add subdirs of existing dirs
  236. for cf_test_libdir in $LDFLAGS $LIBS ; do
  237. if test ".$cf_test_libdir" = ".-L$cf_add_libdir" ; then
  238. cf_have_libdir=yes; break
  239. fi
  240. done
  241. fi
  242. if test "$cf_have_libdir" = no ; then
  243. CF_VERBOSE(adding $cf_add_libdir to library-path)
  244. ifelse($2,,LDFLAGS,$2)="-L$cf_add_libdir $ifelse($2,,LDFLAGS,$2)"
  245. fi
  246. fi
  247. done
  248. fi
  249. ])dnl
  250. dnl ---------------------------------------------------------------------------
  251. dnl CF_ADD_SUBDIR_PATH version: 2 updated: 2007/07/29 10:12:59
  252. dnl ------------------
  253. dnl Append to a search-list for a nonstandard header/lib-file
  254. dnl $1 = the variable to return as result
  255. dnl $2 = the package name
  256. dnl $3 = the subdirectory, e.g., bin, include or lib
  257. dnl $4 = the directory under which we will test for subdirectories
  258. dnl $5 = a directory that we do not want $4 to match
  259. AC_DEFUN([CF_ADD_SUBDIR_PATH],
  260. [
  261. test "$4" != "$5" && \
  262. test -d "$4" && \
  263. ifelse([$5],NONE,,[(test $5 = NONE || test -d $5) &&]) {
  264. test -n "$verbose" && echo " ... testing for $3-directories under $4"
  265. test -d $4/$3 && $1="[$]$1 $4/$3"
  266. test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2"
  267. test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3"
  268. test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3"
  269. test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2"
  270. }
  271. ])dnl
  272. dnl ---------------------------------------------------------------------------
  273. dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
  274. dnl ----------------
  275. dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
  276. dnl in the sharutils 4.2 distribution.
  277. AC_DEFUN([CF_ANSI_CC_CHECK],
  278. [
  279. AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
  280. cf_cv_ansi_cc=no
  281. cf_save_CFLAGS="$CFLAGS"
  282. cf_save_CPPFLAGS="$CPPFLAGS"
  283. # Don't try gcc -ansi; that turns off useful extensions and
  284. # breaks some systems' header files.
  285. # AIX -qlanglvl=ansi
  286. # Ultrix and OSF/1 -std1
  287. # HP-UX -Aa -D_HPUX_SOURCE
  288. # SVR4 -Xc
  289. # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
  290. for cf_arg in "-DCC_HAS_PROTOS" \
  291. "" \
  292. -qlanglvl=ansi \
  293. -std1 \
  294. -Ae \
  295. "-Aa -D_HPUX_SOURCE" \
  296. -Xc
  297. do
  298. CF_ADD_CFLAGS($cf_arg)
  299. AC_TRY_COMPILE(
  300. [
  301. #ifndef CC_HAS_PROTOS
  302. #if !defined(__STDC__) || (__STDC__ != 1)
  303. choke me
  304. #endif
  305. #endif
  306. ],[
  307. int test (int i, double x);
  308. struct s1 {int (*f) (int a);};
  309. struct s2 {int (*f) (double a);};],
  310. [cf_cv_ansi_cc="$cf_arg"; break])
  311. done
  312. CFLAGS="$cf_save_CFLAGS"
  313. CPPFLAGS="$cf_save_CPPFLAGS"
  314. ])
  315. if test "$cf_cv_ansi_cc" != "no"; then
  316. if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
  317. CF_ADD_CFLAGS($cf_cv_ansi_cc)
  318. else
  319. AC_DEFINE(CC_HAS_PROTOS)
  320. fi
  321. fi
  322. ])dnl
  323. dnl ---------------------------------------------------------------------------
  324. dnl CF_ANSI_CC_REQD version: 4 updated: 2008/03/23 14:48:54
  325. dnl ---------------
  326. dnl For programs that must use an ANSI compiler, obtain compiler options that
  327. dnl will make it recognize prototypes. We'll do preprocessor checks in other
  328. dnl macros, since tools such as unproto can fake prototypes, but only part of
  329. dnl the preprocessor.
  330. AC_DEFUN([CF_ANSI_CC_REQD],
  331. [AC_REQUIRE([CF_ANSI_CC_CHECK])
  332. if test "$cf_cv_ansi_cc" = "no"; then
  333. AC_MSG_ERROR(
  334. [Your compiler does not appear to recognize prototypes.
  335. You have the following choices:
  336. a. adjust your compiler options
  337. b. get an up-to-date compiler
  338. c. use a wrapper such as unproto])
  339. fi
  340. ])dnl
  341. dnl ---------------------------------------------------------------------------
  342. dnl CF_AR_FLAGS version: 4 updated: 2009/02/07 13:42:23
  343. dnl -----------
  344. dnl Check for suitable "ar" (archiver) options for updating an archive.
  345. AC_DEFUN([CF_AR_FLAGS],[
  346. AC_REQUIRE([CF_PROG_AR])
  347. AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[
  348. cf_cv_ar_flags=unknown
  349. for cf_ar_flags in -curv curv -crv crv -cqv cqv -rv rv
  350. do
  351. rm -f conftest.$ac_cv_objext
  352. rm -f conftest.a
  353. cat >conftest.$ac_ext <<EOF
  354. #line __oline__ "configure"
  355. int testdata[[3]] = { 123, 456, 789 };
  356. EOF
  357. if AC_TRY_EVAL(ac_compile) ; then
  358. $AR $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null
  359. if test -f conftest.a ; then
  360. cf_cv_ar_flags=$cf_ar_flags
  361. break
  362. fi
  363. else
  364. CF_VERBOSE(cannot compile test-program)
  365. break
  366. fi
  367. done
  368. rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext
  369. ])
  370. test -z "$ARFLAGS" && ARFLAGS=$cf_cv_ar_flags
  371. AC_SUBST(ARFLAGS,$cf_cv_ar_flags)
  372. ])
  373. dnl ---------------------------------------------------------------------------
  374. dnl CF_AWK_BIG_PRINTF version: 3 updated: 2008/12/27 12:30:03
  375. dnl -----------------
  376. dnl Check if awk can handle big strings using printf. Some older versions of
  377. dnl awk choke on large strings passed via "%s".
  378. dnl
  379. dnl $1 = desired string size
  380. dnl $2 = variable to set with result
  381. AC_DEFUN([CF_AWK_BIG_PRINTF],
  382. [
  383. case x$AWK in #(vi
  384. x)
  385. eval $2=no
  386. ;;
  387. *) #(vi
  388. if ( ${AWK} 'BEGIN { xx = "x"; while (length(xx) < $1) { xx = xx "x"; }; printf("%s\n", xx); }' \
  389. | $AWK '{ printf "%d\n", length([$]0); }' | $AWK 'BEGIN { eqls=0; recs=0; } { recs++; if ([$]0 == 12000) eqls++; } END { if (recs != 1 || eqls != 1) exit 1; }' 2>/dev/null >/dev/null ) ; then
  390. eval $2=yes
  391. else
  392. eval $2=no
  393. fi
  394. ;;
  395. esac
  396. ])dnl
  397. dnl ---------------------------------------------------------------------------
  398. dnl CF_BOOL_DECL version: 8 updated: 2004/01/30 15:51:18
  399. dnl ------------
  400. dnl Test if 'bool' is a builtin type in the configured C++ compiler. Some
  401. dnl older compilers (e.g., gcc 2.5.8) don't support 'bool' directly; gcc
  402. dnl 2.6.3 does, in anticipation of the ANSI C++ standard.
  403. dnl
  404. dnl Treat the configuration-variable specially here, since we're directly
  405. dnl substituting its value (i.e., 1/0).
  406. dnl
  407. dnl $1 is the shell variable to store the result in, if not $cv_cv_builtin_bool
  408. AC_DEFUN([CF_BOOL_DECL],
  409. [
  410. AC_MSG_CHECKING(if we should include stdbool.h)
  411. AC_CACHE_VAL(cf_cv_header_stdbool_h,[
  412. AC_TRY_COMPILE([],[bool foo = false],
  413. [cf_cv_header_stdbool_h=0],
  414. [AC_TRY_COMPILE([
  415. #ifndef __BEOS__
  416. #include <stdbool.h>
  417. #endif
  418. ],[bool foo = false],
  419. [cf_cv_header_stdbool_h=1],
  420. [cf_cv_header_stdbool_h=0])])])
  421. if test "$cf_cv_header_stdbool_h" = 1
  422. then AC_MSG_RESULT(yes)
  423. else AC_MSG_RESULT(no)
  424. fi
  425. AC_MSG_CHECKING([for builtin bool type])
  426. AC_CACHE_VAL(ifelse($1,,cf_cv_builtin_bool,[$1]),[
  427. AC_TRY_COMPILE([
  428. #include <stdio.h>
  429. #include <sys/types.h>
  430. ],[bool x = false],
  431. [ifelse($1,,cf_cv_builtin_bool,[$1])=1],
  432. [ifelse($1,,cf_cv_builtin_bool,[$1])=0])
  433. ])
  434. if test "$ifelse($1,,cf_cv_builtin_bool,[$1])" = 1
  435. then AC_MSG_RESULT(yes)
  436. else AC_MSG_RESULT(no)
  437. fi
  438. ])dnl
  439. dnl ---------------------------------------------------------------------------
  440. dnl CF_BOOL_SIZE version: 12 updated: 2006/12/16 12:33:30
  441. dnl ------------
  442. dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type).
  443. dnl Don't bother looking for bool.h, since it's been deprecated.
  444. dnl
  445. dnl If the current compiler is C rather than C++, we get the bool definition
  446. dnl from <stdbool.h>.
  447. AC_DEFUN([CF_BOOL_SIZE],
  448. [
  449. AC_MSG_CHECKING([for size of bool])
  450. AC_CACHE_VAL(cf_cv_type_of_bool,[
  451. rm -f cf_test.out
  452. AC_TRY_RUN([
  453. #include <stdlib.h>
  454. #include <stdio.h>
  455. #if defined(__cplusplus)
  456. #ifdef HAVE_GXX_BUILTIN_H
  457. #include <g++/builtin.h>
  458. #elif HAVE_GPP_BUILTIN_H
  459. #include <gpp/builtin.h>
  460. #elif HAVE_BUILTIN_H
  461. #include <builtin.h>
  462. #endif
  463. #else
  464. #if $cf_cv_header_stdbool_h
  465. #include <stdbool.h>
  466. #endif
  467. #endif
  468. main()
  469. {
  470. FILE *fp = fopen("cf_test.out", "w");
  471. if (fp != 0) {
  472. bool x = true;
  473. if ((bool)(-x) >= 0)
  474. fputs("unsigned ", fp);
  475. if (sizeof(x) == sizeof(int)) fputs("int", fp);
  476. else if (sizeof(x) == sizeof(char)) fputs("char", fp);
  477. else if (sizeof(x) == sizeof(short))fputs("short",fp);
  478. else if (sizeof(x) == sizeof(long)) fputs("long", fp);
  479. fclose(fp);
  480. }
  481. ${cf_cv_main_return:-return}(0);
  482. }
  483. ],
  484. [cf_cv_type_of_bool=`cat cf_test.out`
  485. if test -z "$cf_cv_type_of_bool"; then
  486. cf_cv_type_of_bool=unknown
  487. fi],
  488. [cf_cv_type_of_bool=unknown],
  489. [cf_cv_type_of_bool=unknown])
  490. ])
  491. rm -f cf_test.out
  492. AC_MSG_RESULT($cf_cv_type_of_bool)
  493. if test "$cf_cv_type_of_bool" = unknown ; then
  494. case .$NCURSES_BOOL in #(vi
  495. .auto|.) NCURSES_BOOL=unsigned;;
  496. esac
  497. AC_MSG_WARN(Assuming $NCURSES_BOOL for type of bool)
  498. cf_cv_type_of_bool=$NCURSES_BOOL
  499. fi
  500. ])dnl
  501. dnl ---------------------------------------------------------------------------
  502. dnl CF_BUILD_CC version: 6 updated: 2006/10/14 15:23:15
  503. dnl -----------
  504. dnl If we're cross-compiling, allow the user to override the tools and their
  505. dnl options. The configure script is oriented toward identifying the host
  506. dnl compiler, etc., but we need a build compiler to generate parts of the
  507. dnl source.
  508. dnl
  509. dnl $1 = default for $CPPFLAGS
  510. dnl $2 = default for $LIBS
  511. AC_DEFUN([CF_BUILD_CC],[
  512. AC_REQUIRE([CF_PROG_EXT])
  513. if test "$cross_compiling" = yes ; then
  514. # defaults that we might want to override
  515. : ${BUILD_CFLAGS:=''}
  516. : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
  517. : ${BUILD_LDFLAGS:=''}
  518. : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
  519. : ${BUILD_EXEEXT:='$x'}
  520. : ${BUILD_OBJEXT:='o'}
  521. AC_ARG_WITH(build-cc,
  522. [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
  523. [BUILD_CC="$withval"],
  524. [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
  525. AC_MSG_CHECKING(for native build C compiler)
  526. AC_MSG_RESULT($BUILD_CC)
  527. AC_MSG_CHECKING(for native build C preprocessor)
  528. AC_ARG_WITH(build-cpp,
  529. [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
  530. [BUILD_CPP="$withval"],
  531. [BUILD_CPP='${BUILD_CC} -E'])
  532. AC_MSG_RESULT($BUILD_CPP)
  533. AC_MSG_CHECKING(for native build C flags)
  534. AC_ARG_WITH(build-cflags,
  535. [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
  536. [BUILD_CFLAGS="$withval"])
  537. AC_MSG_RESULT($BUILD_CFLAGS)
  538. AC_MSG_CHECKING(for native build C preprocessor-flags)
  539. AC_ARG_WITH(build-cppflags,
  540. [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
  541. [BUILD_CPPFLAGS="$withval"])
  542. AC_MSG_RESULT($BUILD_CPPFLAGS)
  543. AC_MSG_CHECKING(for native build linker-flags)
  544. AC_ARG_WITH(build-ldflags,
  545. [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
  546. [BUILD_LDFLAGS="$withval"])
  547. AC_MSG_RESULT($BUILD_LDFLAGS)
  548. AC_MSG_CHECKING(for native build linker-libraries)
  549. AC_ARG_WITH(build-libs,
  550. [ --with-build-libs=XXX the build libraries (${BUILD_LIBS})],
  551. [BUILD_LIBS="$withval"])
  552. AC_MSG_RESULT($BUILD_LIBS)
  553. # this assumes we're on Unix.
  554. BUILD_EXEEXT=
  555. BUILD_OBJEXT=o
  556. : ${BUILD_CC:='${CC}'}
  557. if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then
  558. AC_MSG_ERROR([Cross-build requires two compilers.
  559. Use --with-build-cc to specify the native compiler.])
  560. fi
  561. else
  562. : ${BUILD_CC:='${CC}'}
  563. : ${BUILD_CPP:='${CPP}'}
  564. : ${BUILD_CFLAGS:='${CFLAGS}'}
  565. : ${BUILD_CPPFLAGS:='${CPPFLAGS}'}
  566. : ${BUILD_LDFLAGS:='${LDFLAGS}'}
  567. : ${BUILD_LIBS:='${LIBS}'}
  568. : ${BUILD_EXEEXT:='$x'}
  569. : ${BUILD_OBJEXT:='o'}
  570. fi
  571. AC_SUBST(BUILD_CC)
  572. AC_SUBST(BUILD_CPP)
  573. AC_SUBST(BUILD_CFLAGS)
  574. AC_SUBST(BUILD_CPPFLAGS)
  575. AC_SUBST(BUILD_LDFLAGS)
  576. AC_SUBST(BUILD_LIBS)
  577. AC_SUBST(BUILD_EXEEXT)
  578. AC_SUBST(BUILD_OBJEXT)
  579. ])dnl
  580. dnl ---------------------------------------------------------------------------
  581. dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00
  582. dnl ---------------
  583. dnl Determine the default configuration into which we'll install ncurses. This
  584. dnl can be overridden by the user's command-line options. There's two items to
  585. dnl look for:
  586. dnl 1. the prefix (e.g., /usr)
  587. dnl 2. the header files (e.g., /usr/include/ncurses)
  588. dnl We'll look for a previous installation of ncurses and use the same defaults.
  589. dnl
  590. dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and
  591. dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's
  592. dnl programs from a vendor's.
  593. AC_DEFUN([CF_CFG_DEFAULTS],
  594. [
  595. AC_MSG_CHECKING(for prefix)
  596. if test "x$prefix" = "xNONE" ; then
  597. case "$cf_cv_system_name" in
  598. # non-vendor systems don't have a conflict
  599. openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu)
  600. prefix=/usr
  601. ;;
  602. *) prefix=$ac_default_prefix
  603. ;;
  604. esac
  605. fi
  606. AC_MSG_RESULT($prefix)
  607. if test "x$prefix" = "xNONE" ; then
  608. AC_MSG_CHECKING(for default include-directory)
  609. test -n "$verbose" && echo 1>&AC_FD_MSG
  610. for cf_symbol in \
  611. $includedir \
  612. $includedir/ncurses \
  613. $prefix/include \
  614. $prefix/include/ncurses \
  615. /usr/local/include \
  616. /usr/local/include/ncurses \
  617. /usr/include \
  618. /usr/include/ncurses
  619. do
  620. cf_dir=`eval echo $cf_symbol`
  621. if test -f $cf_dir/curses.h ; then
  622. if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then
  623. includedir="$cf_symbol"
  624. test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG
  625. break
  626. fi
  627. fi
  628. test -n "$verbose" && echo " tested $cf_dir" 1>&AC_FD_MSG
  629. done
  630. AC_MSG_RESULT($includedir)
  631. fi
  632. ])dnl
  633. dnl ---------------------------------------------------------------------------
  634. dnl CF_CGETENT version: 3 updated: 2000/08/12 23:18:52
  635. dnl ----------
  636. dnl Check if the terminal-capability database functions are available. If not,
  637. dnl ncurses has a much-reduced version.
  638. AC_DEFUN([CF_CGETENT],[
  639. AC_MSG_CHECKING(for terminal-capability database functions)
  640. AC_CACHE_VAL(cf_cv_cgetent,[
  641. AC_TRY_LINK([
  642. #include <stdlib.h>],[
  643. char temp[128];
  644. char *buf = temp;
  645. char *db_array = temp;
  646. cgetent(&buf, /* int *, */ &db_array, "vt100");
  647. cgetcap(buf, "tc", '=');
  648. cgetmatch(buf, "tc");
  649. ],
  650. [cf_cv_cgetent=yes],
  651. [cf_cv_cgetent=no])
  652. ])
  653. AC_MSG_RESULT($cf_cv_cgetent)
  654. test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT)
  655. ])dnl
  656. dnl ---------------------------------------------------------------------------
  657. dnl CF_CHECK_CACHE version: 11 updated: 2008/03/23 14:45:59
  658. dnl --------------
  659. dnl Check if we're accidentally using a cache from a different machine.
  660. dnl Derive the system name, as a check for reusing the autoconf cache.
  661. dnl
  662. dnl If we've packaged config.guess and config.sub, run that (since it does a
  663. dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
  664. dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
  665. dnl which is useful in cross-compiles.
  666. dnl
  667. dnl Note: we would use $ac_config_sub, but that is one of the places where
  668. dnl autoconf 2.5x broke compatibility with autoconf 2.13
  669. AC_DEFUN([CF_CHECK_CACHE],
  670. [
  671. if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
  672. ifelse([$1],,[AC_CANONICAL_HOST],[$1])
  673. system_name="$host_os"
  674. else
  675. system_name="`(uname -s -r) 2>/dev/null`"
  676. if test -z "$system_name" ; then
  677. system_name="`(hostname) 2>/dev/null`"
  678. fi
  679. fi
  680. test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
  681. AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
  682. test -z "$system_name" && system_name="$cf_cv_system_name"
  683. test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
  684. if test ".$system_name" != ".$cf_cv_system_name" ; then
  685. AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
  686. AC_MSG_ERROR("Please remove config.cache and try again.")
  687. fi
  688. ])dnl
  689. dnl ---------------------------------------------------------------------------
  690. dnl CF_CHECK_ERRNO version: 10 updated: 2008/08/22 16:33:22
  691. dnl --------------
  692. dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
  693. dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
  694. dnl ourselves.
  695. dnl
  696. dnl $1 = the name to check
  697. dnl $2 = the assumed type
  698. AC_DEFUN([CF_CHECK_ERRNO],
  699. [
  700. AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
  701. AC_TRY_COMPILE([
  702. #ifdef HAVE_STDLIB_H
  703. #include <stdlib.h>
  704. #endif
  705. #include <stdio.h>
  706. #include <sys/types.h>
  707. #include <errno.h> ],
  708. ifelse($2,,int,$2) x = (ifelse($2,,int,$2)) $1,
  709. [cf_cv_dcl_$1=yes],
  710. [cf_cv_dcl_$1=no])
  711. ])
  712. if test "$cf_cv_dcl_$1" = no ; then
  713. CF_UPPER(cf_result,decl_$1)
  714. AC_DEFINE_UNQUOTED($cf_result)
  715. fi
  716. # It's possible (for near-UNIX clones) that the data doesn't exist
  717. CF_CHECK_EXTERN_DATA($1,ifelse($2,,int,$2))
  718. ])dnl
  719. dnl ---------------------------------------------------------------------------
  720. dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
  721. dnl --------------------
  722. dnl Check for existence of external data in the current set of libraries. If
  723. dnl we can modify it, it's real enough.
  724. dnl $1 = the name to check
  725. dnl $2 = its type
  726. AC_DEFUN([CF_CHECK_EXTERN_DATA],
  727. [
  728. AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
  729. AC_TRY_LINK([
  730. #undef $1
  731. extern $2 $1;
  732. ],
  733. [$1 = 2],
  734. [cf_cv_have_$1=yes],
  735. [cf_cv_have_$1=no])
  736. ])
  737. if test "$cf_cv_have_$1" = yes ; then
  738. CF_UPPER(cf_result,have_$1)
  739. AC_DEFINE_UNQUOTED($cf_result)
  740. fi
  741. ])dnl
  742. dnl ---------------------------------------------------------------------------
  743. dnl CF_CHECK_GPM_WGETCH version: 1 updated: 2007/04/28 14:38:06
  744. dnl -------------------
  745. dnl Check if GPM is already linked with curses. If so - and if the linkage
  746. dnl is not "weak" - warn about this because it can create problems linking
  747. dnl applications with ncurses.
  748. AC_DEFUN([CF_CHECK_GPM_WGETCH],[
  749. AC_CHECK_LIB(gpm,Gpm_Wgetch,[
  750. AC_CACHE_CHECK(if GPM is weakly bound to curses library, cf_cv_check_gpm_wgetch,[
  751. cf_cv_check_gpm_wgetch=unknown
  752. if test "$cross_compiling" != yes ; then
  753. cat >conftest.$ac_ext <<CF_EOF
  754. #include <gpm.h>
  755. int main()
  756. {
  757. Gpm_Wgetch();
  758. ${cf_cv_main_return:-return}(0);
  759. }
  760. CF_EOF
  761. cf_save_LIBS="$LIBS"
  762. # This only works if we can look at the symbol table. If a shared
  763. # library is stripped for install, we cannot use that. So we're forced
  764. # to rely on the static library, noting that some packagers may not
  765. # include it.
  766. LIBS="-static -lgpm -dynamic $LIBS"
  767. if AC_TRY_EVAL(ac_compile) ; then
  768. if AC_TRY_EVAL(ac_link) ; then
  769. cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\<wgetch\>' | egrep '\<[[vVwW]]\>'`
  770. test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes
  771. test -z "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=no
  772. fi
  773. fi
  774. rm -f conftest*
  775. LIBS="$cf_save_LIBS"
  776. fi
  777. ])
  778. if test "$cf_cv_check_gpm_wgetch" != yes ; then
  779. AC_MSG_WARN(GPM library is already linked with curses - read the FAQ)
  780. fi
  781. ])])dnl
  782. dnl ---------------------------------------------------------------------------
  783. dnl CF_CPP_PARAM_INIT version: 4 updated: 2001/04/07 22:31:18
  784. dnl -----------------
  785. dnl Check if the C++ compiler accepts duplicate parameter initialization. This
  786. dnl is a late feature for the standard and is not in some recent compilers
  787. dnl (1999/9/11).
  788. AC_DEFUN([CF_CPP_PARAM_INIT],
  789. [
  790. if test -n "$CXX"; then
  791. AC_CACHE_CHECK(if $CXX accepts parameter initialization,cf_cv_cpp_param_init,[
  792. AC_LANG_SAVE
  793. AC_LANG_CPLUSPLUS
  794. AC_TRY_RUN([
  795. class TEST {
  796. private:
  797. int value;
  798. public:
  799. TEST(int x = 1);
  800. ~TEST();
  801. };
  802. TEST::TEST(int x = 1) // some compilers do not like second initializer
  803. {
  804. value = x;
  805. }
  806. void main() { }
  807. ],
  808. [cf_cv_cpp_param_init=yes],
  809. [cf_cv_cpp_param_init=no],
  810. [cf_cv_cpp_param_init=unknown])
  811. AC_LANG_RESTORE
  812. ])
  813. fi
  814. test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT)
  815. ])dnl
  816. dnl ---------------------------------------------------------------------------
  817. dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43
  818. dnl ------------------
  819. dnl Check if the C++ compiler accepts static_cast in generics. This appears to
  820. dnl not be supported in g++ before 3.0
  821. AC_DEFUN([CF_CPP_STATIC_CAST],
  822. [
  823. if test -n "$CXX"; then
  824. AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[
  825. AC_LANG_SAVE
  826. AC_LANG_CPLUSPLUS
  827. AC_TRY_COMPILE([
  828. class NCursesPanel
  829. {
  830. public:
  831. NCursesPanel(int nlines,
  832. int ncols,
  833. int begin_y = 0,
  834. int begin_x = 0)
  835. {
  836. }
  837. ~NCursesPanel();
  838. };
  839. template<class T> class NCursesUserPanel : public NCursesPanel
  840. {
  841. public:
  842. NCursesUserPanel (int nlines,
  843. int ncols,
  844. int begin_y = 0,
  845. int begin_x = 0,
  846. const T* p_UserData = static_cast<T*>(0))
  847. : NCursesPanel (nlines, ncols, begin_y, begin_x)
  848. {
  849. };
  850. NCursesUserPanel(const T* p_UserData = static_cast<T*>(0)) : NCursesPanel()
  851. {
  852. };
  853. virtual ~NCursesUserPanel() {};
  854. };
  855. ],[
  856. const char* p_UserData = static_cast<char*>(0)],
  857. [cf_cv_cpp_static_cast=yes],
  858. [cf_cv_cpp_static_cast=no])
  859. AC_LANG_RESTORE
  860. ])
  861. fi
  862. test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST)
  863. ])dnl
  864. dnl ---------------------------------------------------------------------------
  865. dnl CF_C_INLINE version: 2 updated: 2007/08/11 14:09:50
  866. dnl -----------
  867. dnl Check if the C compiler supports "inline".
  868. dnl $1 is the name of a shell variable to set if inline is supported
  869. dnl $2 is the threshold for gcc 4.x's option controlling maximum inline size
  870. AC_DEFUN([CF_C_INLINE],[
  871. AC_C_INLINE
  872. $1=
  873. if test "$ac_cv_c_inline" != no ; then
  874. $1=inline
  875. if test "$INTEL_COMPILER" = yes
  876. then
  877. :
  878. elif test "$GCC" = yes
  879. then
  880. AC_CACHE_CHECK(if gcc supports options to tune inlining,cf_cv_gcc_inline,[
  881. cf_save_CFLAGS=$CFLAGS
  882. CFLAGS="$CFLAGS --param max-inline-insns-single=$2"
  883. AC_TRY_COMPILE([inline int foo(void) { return 1; }],
  884. [${cf_cv_main_return:-return} foo()],
  885. [cf_cv_gcc_inline=yes],
  886. [cf_cv_gcc_inline=no])
  887. CFLAGS=$cf_save_CFLAGS
  888. ])
  889. if test "$cf_cv_gcc_inline" = yes ; then
  890. CF_ADD_CFLAGS([--param max-inline-insns-single=$2])
  891. fi
  892. fi
  893. fi
  894. AC_SUBST($1)
  895. ])dnl
  896. dnl ---------------------------------------------------------------------------
  897. dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
  898. dnl ----------
  899. dnl "dirname" is not portable, so we fake it with a shell script.
  900. AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
  901. dnl ---------------------------------------------------------------------------
  902. dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31
  903. dnl ---------------
  904. AC_DEFUN([CF_DIRS_TO_MAKE],
  905. [
  906. DIRS_TO_MAKE="lib"
  907. for cf_item in $cf_list_models
  908. do
  909. CF_OBJ_SUBDIR($cf_item,cf_subdir)
  910. for cf_item2 in $DIRS_TO_MAKE
  911. do
  912. test $cf_item2 = $cf_subdir && break
  913. done
  914. test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir"
  915. done
  916. for cf_dir in $DIRS_TO_MAKE
  917. do
  918. test ! -d $cf_dir && mkdir $cf_dir
  919. done
  920. AC_SUBST(DIRS_TO_MAKE)
  921. ])dnl
  922. dnl ---------------------------------------------------------------------------
  923. dnl CF_DISABLE_LEAKS version: 4 updated: 2006/12/16 15:10:42
  924. dnl ----------------
  925. dnl Combine no-leak checks with the libraries or tools that are used for the
  926. dnl checks.
  927. AC_DEFUN([CF_DISABLE_LEAKS],[
  928. AC_REQUIRE([CF_WITH_DMALLOC])
  929. AC_REQUIRE([CF_WITH_DBMALLOC])
  930. AC_REQUIRE([CF_WITH_VALGRIND])
  931. AC_MSG_CHECKING(if you want to perform memory-leak testing)
  932. AC_ARG_ENABLE(leaks,
  933. [ --disable-leaks test: free permanent memory, analyze leaks],
  934. [with_no_leaks=yes],
  935. : ${with_no_leaks:=no})
  936. AC_MSG_RESULT($with_no_leaks)
  937. if test "$with_no_leaks" = yes ; then
  938. AC_DEFINE(NO_LEAKS)
  939. fi
  940. ])dnl
  941. dnl ---------------------------------------------------------------------------
  942. dnl CF_ENABLE_RPATH version: 1 updated: 2008/09/13 10:22:30
  943. dnl ---------------
  944. dnl Check if the rpath option should be used, setting cache variable
  945. dnl cf_cv_ld_rpath if so.
  946. AC_DEFUN([CF_ENABLE_RPATH],
  947. [
  948. AC_MSG_CHECKING(if rpath option should be used)
  949. AC_ARG_ENABLE(rpath,
  950. [ --enable-rpath use rpath option when generating shared libraries],
  951. [cf_cv_ld_rpath=$enableval],
  952. [cf_cv_ld_rpath=no])
  953. AC_MSG_RESULT($cf_cv_ld_rpath)
  954. ])dnl
  955. dnl ---------------------------------------------------------------------------
  956. dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
  957. dnl --------
  958. dnl Check if 'errno' is declared in <errno.h>
  959. AC_DEFUN([CF_ERRNO],
  960. [
  961. CF_CHECK_ERRNO(errno)
  962. ])dnl
  963. dnl ---------------------------------------------------------------------------
  964. dnl CF_ETIP_DEFINES version: 3 updated: 2003/03/22 19:13:43
  965. dnl ---------------
  966. dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between
  967. dnl math.h and builtin.h, only for ncurses
  968. AC_DEFUN([CF_ETIP_DEFINES],
  969. [
  970. AC_MSG_CHECKING(for special defines needed for etip.h)
  971. cf_save_CXXFLAGS="$CXXFLAGS"
  972. cf_result="none"
  973. for cf_math in "" MATH_H
  974. do
  975. for cf_excp in "" MATH_EXCEPTION
  976. do
  977. CXXFLAGS="$cf_save_CXXFLAGS -I${srcdir}/c++ -I${srcdir}/menu -I${srcdir}/include"
  978. test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}"
  979. test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}"
  980. AC_TRY_COMPILE([
  981. #include <etip.h.in>
  982. ],[],[
  983. test -n "$cf_math" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_math})
  984. test -n "$cf_excp" && AC_DEFINE_UNQUOTED(ETIP_NEEDS_${cf_excp})
  985. cf_result="$cf_math $cf_excp"
  986. break
  987. ],[])
  988. done
  989. done
  990. AC_MSG_RESULT($cf_result)
  991. CXXFLAGS="$cf_save_CXXFLAGS"
  992. ])
  993. dnl ---------------------------------------------------------------------------
  994. dnl CF_FIND_LINKAGE version: 13 updated: 2008/12/24 07:59:55
  995. dnl ---------------
  996. dnl Find a library (specifically the linkage used in the code fragment),
  997. dnl searching for it if it is not already in the library path.
  998. dnl See also CF_ADD_SEARCHPATH.
  999. dnl
  1000. dnl Parameters (4-on are optional):
  1001. dnl $1 = headers for library entrypoint
  1002. dnl $2 = code fragment for library entrypoint
  1003. dnl $3 = the library name without the "-l" option or ".so" suffix.
  1004. dnl $4 = action to perform if successful (default: update CPPFLAGS, etc)
  1005. dnl $5 = action to perform if not successful
  1006. dnl $6 = module name, if not the same as the library name
  1007. dnl $7 = extra libraries
  1008. dnl
  1009. dnl Sets these variables:
  1010. dnl $cf_cv_find_linkage_$3 - yes/no according to whether linkage is found
  1011. dnl $cf_cv_header_path_$3 - include-directory if needed
  1012. dnl $cf_cv_library_path_$3 - library-directory if needed
  1013. dnl $cf_cv_library_file_$3 - library-file if needed, e.g., -l$3
  1014. AC_DEFUN([CF_FIND_LINKAGE],[
  1015. # If the linkage is not already in the $CPPFLAGS/$LDFLAGS configuration, these
  1016. # will be set on completion of the AC_TRY_LINK below.
  1017. cf_cv_header_path_$3=
  1018. cf_cv_library_path_$3=
  1019. CF_MSG_LOG([Starting [FIND_LINKAGE]($3,$6)])
  1020. AC_TRY_LINK([$1],[$2],
  1021. cf_cv_find_linkage_$3=yes,[
  1022. cf_cv_find_linkage_$3=no
  1023. CF_VERBOSE(find linkage for $3 library)
  1024. CF_MSG_LOG([Searching for headers in [FIND_LINKAGE]($3,$6)])
  1025. cf_save_CPPFLAGS="$CPPFLAGS"
  1026. cf_test_CPPFLAGS="$CPPFLAGS"
  1027. CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6]))
  1028. for cf_cv_header_path_$3 in $cf_search
  1029. do
  1030. if test -d $cf_cv_header_path_$3 ; then
  1031. CF_VERBOSE(... testing $cf_cv_header_path_$3)
  1032. CPPFLAGS="$cf_save_CPPFLAGS -I$cf_cv_header_path_$3"
  1033. AC_TRY_COMPILE([$1],[$2],[
  1034. CF_VERBOSE(... found $3 headers in $cf_cv_header_path_$3)
  1035. cf_cv_find_linkage_$3=maybe
  1036. cf_test_CPPFLAGS="$CPPFLAGS"
  1037. break],[
  1038. CPPFLAGS="$cf_save_CPPFLAGS"
  1039. ])
  1040. fi
  1041. done
  1042. if test "$cf_cv_find_linkage_$3" = maybe ; then
  1043. CF_MSG_LOG([Searching for $3 library in [FIND_LINKAGE]($3,$6)])
  1044. cf_save_LIBS="$LIBS"
  1045. cf_save_LDFLAGS="$LDFLAGS"
  1046. ifelse([$6],,,[
  1047. CPPFLAGS="$cf_test_CPPFLAGS"
  1048. LIBS="-l$3 $7 $cf_save_LIBS"
  1049. AC_TRY_LINK([$1],[$2],[
  1050. CF_VERBOSE(... found $3 library in system)
  1051. cf_cv_find_linkage_$3=yes])
  1052. CPPFLAGS="$cf_save_CPPFLAGS"
  1053. LIBS="$cf_save_LIBS"
  1054. ])
  1055. if test "$cf_cv_find_linkage_$3" != yes ; then
  1056. CF_LIBRARY_PATH(cf_search,$3)
  1057. for cf_cv_library_path_$3 in $cf_search
  1058. do
  1059. if test -d $cf_cv_library_path_$3 ; then
  1060. CF_VERBOSE(... testing $cf_cv_library_path_$3)
  1061. CPPFLAGS="$cf_test_CPPFLAGS"
  1062. LIBS="-l$3 $7 $cf_save_LIBS"
  1063. LDFLAGS="$cf_save_LDFLAGS -L$cf_cv_library_path_$3"
  1064. AC_TRY_LINK([$1],[$2],[
  1065. CF_VERBOSE(... found $3 library in $cf_cv_library_path_$3)
  1066. cf_cv_find_linkage_$3=yes
  1067. cf_cv_library_file_$3="-l$3"
  1068. break],[
  1069. CPPFLAGS="$cf_save_CPPFLAGS"
  1070. LIBS="$cf_save_LIBS"
  1071. LDFLAGS="$cf_save_LDFLAGS"
  1072. ])
  1073. fi
  1074. done
  1075. LIBS="$cf_save_LIBS"
  1076. CPPFLAGS="$cf_save_CPPFLAGS"
  1077. LDFLAGS="$cf_save_LDFLAGS"
  1078. fi
  1079. else
  1080. cf_cv_find_linkage_$3=no
  1081. fi
  1082. ],$7)
  1083. if test "$cf_cv_find_linkage_$3" = yes ; then
  1084. ifelse([$4],,[
  1085. CF_ADD_INCDIR($cf_cv_header_path_$3)
  1086. CF_ADD_LIBDIR($cf_cv_library_path_$3)
  1087. LIBS="-l$3 $LIBS"
  1088. ],[$4])
  1089. else
  1090. ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5])
  1091. fi
  1092. ])dnl
  1093. dnl ---------------------------------------------------------------------------
  1094. dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45
  1095. dnl -------------
  1096. dnl Test for dlsym() and related functions, as well as libdl.
  1097. dnl
  1098. dnl Sets
  1099. dnl $cf_have_dlsym
  1100. dnl $cf_have_libdl
  1101. AC_DEFUN([CF_FUNC_DLSYM],[
  1102. cf_have_dlsym=no
  1103. AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[
  1104. cf_have_libdl=no
  1105. AC_CHECK_LIB(dl,dlsym,[
  1106. cf_have_dlsym=yes
  1107. cf_have_libdl=yes])])
  1108. if test "$cf_have_dlsym" = yes ; then
  1109. test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS"
  1110. AC_MSG_CHECKING(whether able to link to dl*() functions)
  1111. AC_TRY_LINK([#include <dlfcn.h>],[
  1112. void *obj;
  1113. if ((obj = dlopen("filename", 0)) != 0) {
  1114. if (dlsym(obj, "symbolname") == 0) {
  1115. dlclose(obj);
  1116. }
  1117. }],[
  1118. AC_DEFINE(HAVE_LIBDL)],[
  1119. AC_MSG_ERROR(Cannot link test program for libdl)])
  1120. AC_MSG_RESULT(ok)
  1121. else
  1122. AC_MSG_ERROR(Cannot find dlsym function)
  1123. fi
  1124. ])
  1125. dnl ---------------------------------------------------------------------------
  1126. dnl CF_FUNC_MEMMOVE version: 7 updated: 2006/12/16 12:33:30
  1127. dnl ---------------
  1128. dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither
  1129. dnl is found, add our own version of memmove to the list of objects.
  1130. AC_DEFUN([CF_FUNC_MEMMOVE],
  1131. [
  1132. AC_CHECK_FUNC(memmove,,[
  1133. AC_CHECK_FUNC(bcopy,[
  1134. AC_CACHE_CHECK(if bcopy does overlapping moves,cf_cv_good_bcopy,[
  1135. AC_TRY_RUN([
  1136. int main() {
  1137. static char data[] = "abcdefghijklmnopqrstuwwxyz";
  1138. char temp[40];
  1139. bcopy(data, temp, sizeof(data));
  1140. bcopy(temp+10, temp, 15);
  1141. bcopy(temp+5, temp+15, 10);
  1142. ${cf_cv_main_return:-return} (strcmp(temp, "klmnopqrstuwwxypqrstuwwxyz"));
  1143. }
  1144. ],
  1145. [cf_cv_good_bcopy=yes],
  1146. [cf_cv_good_bcopy=no],
  1147. [cf_cv_good_bcopy=unknown])
  1148. ])
  1149. ],[cf_cv_good_bcopy=no])
  1150. if test "$cf_cv_good_bcopy" = yes ; then
  1151. AC_DEFINE(USE_OK_BCOPY)
  1152. else
  1153. AC_DEFINE(USE_MY_MEMMOVE)
  1154. fi
  1155. ])])dnl
  1156. dnl ---------------------------------------------------------------------------
  1157. dnl CF_FUNC_NANOSLEEP version: 3 updated: 2006/12/16 12:33:30
  1158. dnl -----------------
  1159. dnl Check for existence of workable nanosleep() function. Some systems, e.g.,
  1160. dnl AIX 4.x, provide a non-working version.
  1161. AC_DEFUN([CF_FUNC_NANOSLEEP],[
  1162. AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[
  1163. AC_TRY_RUN([
  1164. #include <stdio.h>
  1165. #include <errno.h>
  1166. #include <time.h>
  1167. #ifdef HAVE_SYS_TIME_H
  1168. #include <sys/time.h>
  1169. #endif
  1170. int main() {
  1171. struct timespec ts1, ts2;
  1172. int code;
  1173. ts1.tv_sec = 0;
  1174. ts1.tv_nsec = 750000000;
  1175. ts2.tv_sec = 0;
  1176. ts2.tv_nsec = 0;
  1177. errno = 0;
  1178. code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */
  1179. ${cf_cv_main_return:-return}(code != 0);
  1180. }
  1181. ],
  1182. [cf_cv_func_nanosleep=yes],
  1183. [cf_cv_func_nanosleep=no],
  1184. [cf_cv_func_nanosleep=unknown])])
  1185. test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP)
  1186. ])
  1187. dnl ---------------------------------------------------------------------------
  1188. dnl CF_FUNC_OPENPTY version: 2 updated: 2008/04/12 19:49:01
  1189. dnl ---------------
  1190. dnl Check for openpty() function, along with <pty.h> header. It may need the
  1191. dnl "util" library as well.
  1192. AC_DEFUN([CF_FUNC_OPENPTY],
  1193. [
  1194. AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no)
  1195. AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[
  1196. cf_save_LIBS="$LIBS"
  1197. test $cf_cv_lib_util = yes && LIBS="-lutil $LIBS"
  1198. for cf_header in pty.h libutil.h util.h
  1199. do
  1200. AC_TRY_LINK([
  1201. #include <$cf_header>
  1202. ],[
  1203. int x = openpty((int *)0, (int *)0, (char *)0,
  1204. (struct termios *)0, (struct winsize *)0);
  1205. ],[
  1206. cf_cv_func_openpty=$cf_header
  1207. break
  1208. ],[
  1209. cf_cv_func_openpty=no
  1210. ])
  1211. done
  1212. LIBS="$cf_save_LIBS"
  1213. ])
  1214. ])dnl
  1215. dnl ---------------------------------------------------------------------------
  1216. dnl CF_FUNC_POLL version: 4 updated: 2006/12/16 12:33:30
  1217. dnl ------------
  1218. dnl See if the poll function really works. Some platforms have poll(), but
  1219. dnl it does not work for terminals or files.
  1220. AC_DEFUN([CF_FUNC_POLL],[
  1221. AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[
  1222. AC_TRY_RUN([
  1223. #include <stdio.h>
  1224. #ifdef HAVE_POLL_H
  1225. #include <poll.h>
  1226. #else
  1227. #include <sys/poll.h>
  1228. #endif
  1229. int main() {
  1230. struct pollfd myfds;
  1231. int ret;
  1232. myfds.fd = 0;
  1233. myfds.events = POLLIN;
  1234. ret = poll(&myfds, 1, 100);
  1235. ${cf_cv_main_return:-return}(ret != 0);
  1236. }],
  1237. [cf_cv_working_poll=yes],
  1238. [cf_cv_working_poll=no],
  1239. [cf_cv_working_poll=unknown])])
  1240. test "$cf_cv_working_poll" = "yes" && AC_DEFINE(HAVE_WORKING_POLL)
  1241. ])dnl
  1242. dnl ---------------------------------------------------------------------------
  1243. dnl CF_FUNC_TERMIOS version: 2 updated: 2000/07/22 23:37:24
  1244. dnl ---------------
  1245. dnl Some old/broken variations define tcgetattr() only as a macro in
  1246. dnl termio(s).h
  1247. AC_DEFUN([CF_FUNC_TERMIOS],[
  1248. AC_REQUIRE([CF_STRUCT_TERMIOS])
  1249. AC_CACHE_CHECK(for tcgetattr, cf_cv_have_tcgetattr,[
  1250. AC_TRY_LINK([
  1251. #include <sys/types.h>
  1252. #ifdef HAVE_UNISTD_H
  1253. #include <unistd.h>
  1254. #endif
  1255. #ifdef HAVE_TERMIOS_H
  1256. #include <termios.h>
  1257. #define TTY struct termios
  1258. #else
  1259. #ifdef HAVE_TERMIO_H
  1260. #include <termio.h>
  1261. #define TTY struct termio
  1262. #endif
  1263. #endif
  1264. ],[
  1265. TTY foo;
  1266. tcgetattr(1, &foo);],
  1267. [cf_cv_have_tcgetattr=yes],
  1268. [cf_cv_have_tcgetattr=no])])
  1269. test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR)
  1270. ])dnl
  1271. dnl ---------------------------------------------------------------------------
  1272. dnl CF_FUNC_VSSCANF version: 3 updated: 2001/12/19 00:50:10
  1273. dnl ---------------
  1274. dnl Check for vsscanf() function, which is in c9x but generally not in earlier
  1275. dnl versions of C. It is in the GNU C library, and can often be simulated by
  1276. dnl other functions.
  1277. AC_DEFUN([CF_FUNC_VSSCANF],
  1278. [
  1279. AC_CACHE_CHECK(for vsscanf function or workaround,cf_cv_func_vsscanf,[
  1280. AC_TRY_LINK([
  1281. #include <stdarg.h>
  1282. #include <stdio.h>],[
  1283. va_list ap;
  1284. vsscanf("from", "%d", ap)],[cf_cv_func_vsscanf=vsscanf],[
  1285. AC_TRY_LINK([
  1286. #include <stdarg.h>
  1287. #include <stdio.h>],[
  1288. FILE strbuf;
  1289. char *str = "from";
  1290. strbuf._flag = _IOREAD;
  1291. strbuf._ptr = strbuf._base = (unsigned char *) str;
  1292. strbuf._cnt = strlen(str);
  1293. strbuf._file = _NFILE;
  1294. return (vfscanf(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=vfscanf],[
  1295. AC_TRY_LINK([
  1296. #include <stdarg.h>
  1297. #include <stdio.h>],[
  1298. FILE strbuf;
  1299. char *str = "from";
  1300. strbuf._flag = _IOREAD;
  1301. strbuf._ptr = strbuf._base = (unsigned char *) str;
  1302. strbuf._cnt = strlen(str);
  1303. strbuf._file = _NFILE;
  1304. return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[
  1305. cf_cv_func_vsscanf=no])])])])
  1306. case $cf_cv_func_vsscanf in #(vi
  1307. vsscanf) AC_DEFINE(HAVE_VSSCANF);; #(vi
  1308. vfscanf) AC_DEFINE(HAVE_VFSCANF);; #(vi
  1309. _doscan) AC_DEFINE(HAVE__DOSCAN);;
  1310. esac
  1311. ])dnl
  1312. dnl ---------------------------------------------------------------------------
  1313. dnl CF_GCC_ATTRIBUTES version: 11 updated: 2007/07/29 09:55:12
  1314. dnl -----------------
  1315. dnl Test for availability of useful gcc __attribute__ directives to quiet
  1316. dnl compiler warnings. Though useful, not all are supported -- and contrary
  1317. dnl to documentation, unrecognized directives cause older compilers to barf.
  1318. AC_DEFUN([CF_GCC_ATTRIBUTES],
  1319. [
  1320. if test "$GCC" = yes
  1321. then
  1322. cat > conftest.i <<EOF
  1323. #ifndef GCC_PRINTF
  1324. #define GCC_PRINTF 0
  1325. #endif
  1326. #ifndef GCC_SCANF
  1327. #define GCC_SCANF 0
  1328. #endif
  1329. #ifndef GCC_NORETURN
  1330. #define GCC_NORETURN /* nothing */
  1331. #endif
  1332. #ifndef GCC_UNUSED
  1333. #define GCC_UNUSED /* nothing */
  1334. #endif
  1335. EOF
  1336. if test "$GCC" = yes
  1337. then
  1338. AC_CHECKING([for $CC __attribute__ directives])
  1339. cat > conftest.$ac_ext <<EOF
  1340. #line __oline__ "${as_me-configure}"
  1341. #include "confdefs.h"
  1342. #include "conftest.h"
  1343. #include "conftest.i"
  1344. #if GCC_PRINTF
  1345. #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
  1346. #else
  1347. #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
  1348. #endif
  1349. #if GCC_SCANF
  1350. #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
  1351. #else
  1352. #define GCC_SCANFLIKE(fmt,var) /*nothing*/
  1353. #endif
  1354. extern void wow(char *,...) GCC_SCANFLIKE(1,2);
  1355. extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
  1356. extern void foo(void) GCC_NORETURN;
  1357. int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
  1358. EOF
  1359. for cf_attribute in scanf printf unused noreturn
  1360. do
  1361. CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
  1362. cf_directive="__attribute__(($cf_attribute))"
  1363. echo "checking for $CC $cf_directive" 1>&AC_FD_CC
  1364. case $cf_attribute in
  1365. scanf|printf)
  1366. cat >conftest.h <<EOF
  1367. #define GCC_$cf_ATTRIBUTE 1
  1368. EOF
  1369. ;;
  1370. *)
  1371. cat >conftest.h <<EOF
  1372. #define GCC_$cf_ATTRIBUTE $cf_directive
  1373. EOF
  1374. ;;
  1375. esac
  1376. if AC_TRY_EVAL(ac_compile); then
  1377. test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
  1378. cat conftest.h >>confdefs.h
  1379. fi
  1380. done
  1381. else
  1382. fgrep define conftest.i >>confdefs.h
  1383. fi
  1384. rm -rf conftest*
  1385. fi
  1386. ])dnl
  1387. dnl ---------------------------------------------------------------------------
  1388. dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
  1389. dnl --------------
  1390. dnl Find version of gcc
  1391. AC_DEFUN([CF_GCC_VERSION],[
  1392. AC_REQUIRE([AC_PROG_CC])
  1393. GCC_VERSION=none
  1394. if test "$GCC" = yes ; then
  1395. AC_MSG_CHECKING(version of $CC)
  1396. GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
  1397. test -z "$GCC_VERSION" && GCC_VERSION=unknown
  1398. AC_MSG_RESULT($GCC_VERSION)
  1399. fi
  1400. ])dnl
  1401. dnl ---------------------------------------------------------------------------
  1402. dnl CF_GCC_WARNINGS version: 23 updated: 2008/07/26 17:54:02
  1403. dnl ---------------
  1404. dnl Check if the compiler supports useful warning options. There's a few that
  1405. dnl we don't use, simply because they're too noisy:
  1406. dnl
  1407. dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
  1408. dnl -Wredundant-decls (system headers make this too noisy)
  1409. dnl -Wtraditional (combines too many unrelated messages, only a few useful)
  1410. dnl -Wwrite-strings (too noisy, but should review occasionally). This
  1411. dnl is enabled for ncurses using "--enable-const".
  1412. dnl -pedantic
  1413. dnl
  1414. dnl Parameter:
  1415. dnl $1 is an optional list of gcc warning flags that a particular
  1416. dnl application might want to use, e.g., "no-unused" for
  1417. dnl -Wno-unused
  1418. dnl Special:
  1419. dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
  1420. dnl
  1421. AC_DEFUN([CF_GCC_WARNINGS],
  1422. [
  1423. AC_REQUIRE([CF_GCC_VERSION])
  1424. CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
  1425. cat > conftest.$ac_ext <<EOF
  1426. #line __oline__ "${as_me-configure}"
  1427. int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
  1428. EOF
  1429. if test "$INTEL_COMPILER" = yes
  1430. then
  1431. # The "-wdXXX" options suppress warnings:
  1432. # remark #1419: external declaration in primary source file
  1433. # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
  1434. # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
  1435. # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
  1436. # remark #193: zero used for undefined preprocessing identifier
  1437. # remark #593: variable "curs_sb_left_arrow" was set but never used
  1438. # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
  1439. # remark #869: parameter "tw" was never referenced
  1440. # remark #981: operands are evaluated in unspecified order
  1441. # warning #269: invalid format string conversion
  1442. AC_CHECKING([for $CC warning options])
  1443. cf_save_CFLAGS="$CFLAGS"
  1444. EXTRA_CFLAGS="-Wall"
  1445. for cf_opt in \
  1446. wd1419 \
  1447. wd1682 \
  1448. wd1683 \
  1449. wd1684 \
  1450. wd193 \
  1451. wd279 \
  1452. wd593 \
  1453. wd810 \
  1454. wd869 \
  1455. wd981
  1456. do
  1457. CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
  1458. if AC_TRY_EVAL(ac_compile); then
  1459. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  1460. EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
  1461. fi
  1462. done
  1463. CFLAGS="$cf_save_CFLAGS"
  1464. elif test "$GCC" = yes
  1465. then
  1466. AC_CHECKING([for $CC warning options])
  1467. cf_save_CFLAGS="$CFLAGS"
  1468. EXTRA_CFLAGS="-W -Wall"
  1469. cf_warn_CONST=""
  1470. test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
  1471. for cf_opt in \
  1472. Wbad-function-cast \
  1473. Wcast-align \
  1474. Wcast-qual \
  1475. Winline \
  1476. Wmissing-declarations \
  1477. Wmissing-prototypes \
  1478. Wnested-externs \
  1479. Wpointer-arith \
  1480. Wshadow \
  1481. Wstrict-prototypes \
  1482. Wundef $cf_warn_CONST $1
  1483. do
  1484. CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
  1485. if AC_TRY_EVAL(ac_compile); then
  1486. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  1487. case $cf_opt in #(vi
  1488. Wcast-qual) #(vi
  1489. CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
  1490. ;;
  1491. Winline) #(vi
  1492. case $GCC_VERSION in
  1493. [[34]].*)
  1494. CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
  1495. continue;;
  1496. esac
  1497. ;;
  1498. esac
  1499. EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
  1500. fi
  1501. done
  1502. CFLAGS="$cf_save_CFLAGS"
  1503. fi
  1504. rm -f conftest*
  1505. AC_SUBST(EXTRA_CFLAGS)
  1506. ])dnl
  1507. dnl ---------------------------------------------------------------------------
  1508. dnl CF_GNAT_TRY_LINK version: 1 updated: 2004/08/21 19:02:08
  1509. dnl ----------------
  1510. dnl Verify that a test program compiles/links with GNAT.
  1511. dnl $cf_ada_make is set to the program that compiles/links
  1512. dnl $ADAFLAGS may be set to the GNAT flags.
  1513. dnl
  1514. dnl $1 is the text of the spec
  1515. dnl $2 is the text of the body
  1516. dnl $3 is the shell command to execute if successful
  1517. dnl $4 is the shell command to execute if not successful
  1518. AC_DEFUN([CF_GNAT_TRY_LINK],
  1519. [
  1520. rm -f conftest*
  1521. cat >>conftest.ads <<CF_EOF
  1522. $1
  1523. CF_EOF
  1524. cat >>conftest.adb <<CF_EOF
  1525. $2
  1526. CF_EOF
  1527. if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
  1528. ifelse($3,, :,[ $3])
  1529. ifelse($4,,,[else
  1530. $4])
  1531. fi
  1532. rm -f conftest*
  1533. ])dnl
  1534. dnl ---------------------------------------------------------------------------
  1535. dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08
  1536. dnl ---------------
  1537. dnl Verify that a test program compiles and runs with GNAT
  1538. dnl $cf_ada_make is set to the program that compiles/links
  1539. dnl $ADAFLAGS may be set to the GNAT flags.
  1540. dnl
  1541. dnl $1 is the text of the spec
  1542. dnl $2 is the text of the body
  1543. dnl $3 is the shell command to execute if successful
  1544. dnl $4 is the shell command to execute if not successful
  1545. AC_DEFUN([CF_GNAT_TRY_RUN],
  1546. [
  1547. rm -f conftest*
  1548. cat >>conftest.ads <<CF_EOF
  1549. $1
  1550. CF_EOF
  1551. cat >>conftest.adb <<CF_EOF
  1552. $2
  1553. CF_EOF
  1554. if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then
  1555. if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then
  1556. ifelse($3,, :,[ $3])
  1557. ifelse($4,,,[ else
  1558. $4])
  1559. fi
  1560. ifelse($4,,,[else
  1561. $4])
  1562. fi
  1563. rm -f conftest*
  1564. ])dnl
  1565. dnl ---------------------------------------------------------------------------
  1566. dnl CF_GNAT_VERSION version: 12 updated: 2006/10/14 15:23:15
  1567. dnl ---------------
  1568. dnl Verify version of GNAT.
  1569. AC_DEFUN([CF_GNAT_VERSION],
  1570. [
  1571. AC_MSG_CHECKING(for gnat version)
  1572. cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[[0-9]].[[0-9]][[0-9]]*' |\
  1573. sed -e '2,$d' -e 's/[[^0-9 \.]]//g' -e 's/^[[ ]]*//' -e 's/ .*//'`
  1574. AC_MSG_RESULT($cf_gnat_version)
  1575. case $cf_gnat_version in
  1576. 3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*)
  1577. cf_cv_prog_gnat_correct=yes
  1578. ;;
  1579. *) echo Unsupported GNAT version $cf_gnat_version. Required is 3.11 or better. Disabling Ada95 binding.
  1580. cf_cv_prog_gnat_correct=no
  1581. ;;
  1582. esac
  1583. case $cf_gnat_version in
  1584. 3.[[1-9]]*|[[4-9]].*)
  1585. cf_compile_generics=generics
  1586. cf_generic_objects="\${GENOBJS}"
  1587. ;;
  1588. *) cf_compile_generics=
  1589. cf_generic_objects=
  1590. ;;
  1591. esac
  1592. ])
  1593. dnl ---------------------------------------------------------------------------
  1594. dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
  1595. dnl -------------
  1596. dnl Check if we must define _GNU_SOURCE to get a reasonable value for
  1597. dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
  1598. dnl (or misfeature) of glibc2, which breaks portability of many applications,
  1599. dnl since it is interwoven with GNU extensions.
  1600. dnl
  1601. dnl Well, yes we could work around it...
  1602. AC_DEFUN([CF_GNU_SOURCE],
  1603. [
  1604. AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
  1605. AC_TRY_COMPILE([#include <sys/types.h>],[
  1606. #ifndef _XOPEN_SOURCE
  1607. make an error
  1608. #endif],
  1609. [cf_cv_gnu_source=no],
  1610. [cf_save="$CPPFLAGS"
  1611. CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  1612. AC_TRY_COMPILE([#include <sys/types.h>],[
  1613. #ifdef _XOPEN_SOURCE
  1614. make an error
  1615. #endif],
  1616. [cf_cv_gnu_source=no],
  1617. [cf_cv_gnu_source=yes])
  1618. CPPFLAGS="$cf_save"
  1619. ])
  1620. ])
  1621. test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  1622. ])dnl
  1623. dnl ---------------------------------------------------------------------------
  1624. dnl CF_GPP_LIBRARY version: 8 updated: 2003/02/02 01:41:46
  1625. dnl --------------
  1626. dnl If we're trying to use g++, test if libg++ is installed (a rather common
  1627. dnl problem :-). If we have the compiler but no library, we'll be able to
  1628. dnl configure, but won't be able to build the c++ demo program.
  1629. AC_DEFUN([CF_GPP_LIBRARY],
  1630. [
  1631. cf_cxx_library=unknown
  1632. case $cf_cv_system_name in #(vi
  1633. os2*) #(vi
  1634. cf_gpp_libname=gpp
  1635. ;;
  1636. *)
  1637. cf_gpp_libname=g++
  1638. ;;
  1639. esac
  1640. if test "$GXX" = yes; then
  1641. AC_MSG_CHECKING([for lib$cf_gpp_libname])
  1642. cf_save="$LIBS"
  1643. LIBS="$LIBS -l$cf_gpp_libname"
  1644. AC_TRY_LINK([
  1645. #include <$cf_gpp_libname/builtin.h>
  1646. ],
  1647. [two_arg_error_handler_t foo2 = lib_error_handler],
  1648. [cf_cxx_library=yes
  1649. CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
  1650. if test "$cf_gpp_libname" = cpp ; then
  1651. AC_DEFINE(HAVE_GPP_BUILTIN_H)
  1652. else
  1653. AC_DEFINE(HAVE_GXX_BUILTIN_H)
  1654. fi],
  1655. [AC_TRY_LINK([
  1656. #include <builtin.h>
  1657. ],
  1658. [two_arg_error_handler_t foo2 = lib_error_handler],
  1659. [cf_cxx_library=yes
  1660. CXXLIBS="$CXXLIBS -l$cf_gpp_libname"
  1661. AC_DEFINE(HAVE_BUILTIN_H)],
  1662. [cf_cxx_library=no])])
  1663. LIBS="$cf_save"
  1664. AC_MSG_RESULT($cf_cxx_library)
  1665. fi
  1666. ])dnl
  1667. dnl ---------------------------------------------------------------------------
  1668. dnl CF_GXX_VERSION version: 5 updated: 2005/08/27 09:53:42
  1669. dnl --------------
  1670. dnl Check for version of g++
  1671. AC_DEFUN([CF_GXX_VERSION],[
  1672. AC_REQUIRE([AC_PROG_CPP])
  1673. GXX_VERSION=none
  1674. if test "$GXX" = yes; then
  1675. AC_MSG_CHECKING(version of g++)
  1676. GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
  1677. test -z "$GXX_VERSION" && GXX_VERSION=unknown
  1678. AC_MSG_RESULT($GXX_VERSION)
  1679. fi
  1680. ])dnl
  1681. dnl ---------------------------------------------------------------------------
  1682. dnl CF_GXX_WARNINGS version: 5 updated: 2005/08/13 14:54:38
  1683. dnl ---------------
  1684. dnl Check if the compiler supports useful warning options.
  1685. dnl
  1686. dnl Most of gcc's options apply to g++, except:
  1687. dnl -Wbad-function-cast
  1688. dnl -Wmissing-declarations
  1689. dnl -Wnested-externs
  1690. dnl
  1691. dnl Omit a few (for now):
  1692. dnl -Winline
  1693. dnl
  1694. dnl Parameter:
  1695. dnl $1 is an optional list of g++ warning flags that a particular
  1696. dnl application might want to use, e.g., "no-unused" for
  1697. dnl -Wno-unused
  1698. dnl Special:
  1699. dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
  1700. dnl
  1701. AC_DEFUN([CF_GXX_WARNINGS],
  1702. [
  1703. CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS)
  1704. AC_REQUIRE([CF_GXX_VERSION])
  1705. AC_LANG_SAVE
  1706. AC_LANG_CPLUSPLUS
  1707. cat > conftest.$ac_ext <<EOF
  1708. #line __oline__ "configure"
  1709. int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
  1710. EOF
  1711. if test "$INTEL_CPLUSPLUS" = yes
  1712. then
  1713. # The "-wdXXX" options suppress warnings:
  1714. # remark #1419: external declaration in primary source file
  1715. # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
  1716. # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
  1717. # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
  1718. # remark #193: zero used for undefined preprocessing identifier
  1719. # remark #593: variable "curs_sb_left_arrow" was set but never used
  1720. # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
  1721. # remark #869: parameter "tw" was never referenced
  1722. # remark #981: operands are evaluated in unspecified order
  1723. # warning #269: invalid format string conversion
  1724. AC_CHECKING([for $CC warning options])
  1725. cf_save_CXXFLAGS="$CXXFLAGS"
  1726. EXTRA_CXXFLAGS="-Wall"
  1727. for cf_opt in \
  1728. wd1419 \
  1729. wd1682 \
  1730. wd1683 \
  1731. wd1684 \
  1732. wd193 \
  1733. wd279 \
  1734. wd593 \
  1735. wd810 \
  1736. wd869 \
  1737. wd981
  1738. do
  1739. CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt"
  1740. if AC_TRY_EVAL(ac_compile); then
  1741. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  1742. EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
  1743. fi
  1744. done
  1745. CXXFLAGS="$cf_save_CXXFLAGS"
  1746. elif test "$GXX" = yes
  1747. then
  1748. AC_CHECKING([for $CXX warning options])
  1749. cf_save_CXXFLAGS="$CXXFLAGS"
  1750. EXTRA_CXXFLAGS="-W -Wall"
  1751. cf_gxx_extra_warnings=""
  1752. test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings"
  1753. case "$GCC_VERSION" in
  1754. [[1-2]].*)
  1755. ;;
  1756. *)
  1757. cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++"
  1758. ;;
  1759. esac
  1760. for cf_opt in \
  1761. Wabi \
  1762. fabi-version=0 \
  1763. Woverloaded-virtual \
  1764. Wsign-promo \
  1765. Wsynth \
  1766. Wold-style-cast \
  1767. Wcast-align \
  1768. Wcast-qual \
  1769. Wmissing-prototypes \
  1770. Wpointer-arith \
  1771. Wshadow \
  1772. Wstrict-prototypes \
  1773. Wundef $cf_gxx_extra_warnings $1
  1774. do
  1775. CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt"
  1776. if AC_TRY_EVAL(ac_compile); then
  1777. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  1778. EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt"
  1779. else
  1780. test -n "$verbose" && AC_MSG_RESULT(... no -$cf_opt)
  1781. fi
  1782. done
  1783. CXXFLAGS="$cf_save_CXXFLAGS"
  1784. fi
  1785. rm -f conftest*
  1786. AC_LANG_RESTORE
  1787. AC_SUBST(EXTRA_CXXFLAGS)
  1788. ])dnl
  1789. dnl ---------------------------------------------------------------------------
  1790. dnl CF_HASHED_DB version: 3 updated: 2007/11/24 17:43:37
  1791. dnl ------------
  1792. dnl Look for an instance of the Berkeley hashed database.
  1793. dnl
  1794. dnl $1 = optional parameter, to specify install-prefix for the database.
  1795. AC_DEFUN([CF_HASHED_DB],
  1796. [
  1797. ifelse([$1],,,[
  1798. case $1 in #(vi
  1799. yes|*able*) #(vi
  1800. ;;
  1801. *)
  1802. if test -d "$1" ; then
  1803. CF_ADD_INCDIR($1/include)
  1804. CF_ADD_LIBDIR($1/lib)
  1805. fi
  1806. esac
  1807. ])
  1808. AC_CHECK_HEADER(db.h,[
  1809. CF_HASHED_DB_VERSION
  1810. if test "$cf_cv_hashed_db_version" = unknown ; then
  1811. AC_MSG_ERROR(Cannot determine version of db)
  1812. else
  1813. CF_HASHED_DB_LIBS
  1814. if test "$cf_cv_hashed_db_libs" = unknown ; then
  1815. AC_MSG_ERROR(Cannot determine library for db)
  1816. elif test "$cf_cv_hashed_db_libs" != default ; then
  1817. LIBS="-l$cf_cv_hashed_db_libs $LIBS"
  1818. fi
  1819. fi
  1820. ],[
  1821. AC_MSG_ERROR(Cannot find db.h)
  1822. ])
  1823. ])dnl
  1824. dnl ---------------------------------------------------------------------------
  1825. dnl CF_HASHED_DB_LIBS version: 8 updated: 2008/08/04 06:18:06
  1826. dnl -----------------
  1827. dnl Given that we have the header and version for hashed database, find the
  1828. dnl library information.
  1829. AC_DEFUN([CF_HASHED_DB_LIBS],
  1830. [
  1831. AC_CACHE_CHECK(for db libraries, cf_cv_hashed_db_libs,[
  1832. cf_cv_hashed_db_libs=unknown
  1833. for cf_db_libs in "" db$cf_cv_hashed_db_version db-$cf_cv_hashed_db_version db ''
  1834. do
  1835. cf_save_libs="$LIBS"
  1836. if test -n "$cf_db_libs"; then
  1837. LIBS="-l$cf_db_libs $LIBS"
  1838. fi
  1839. CF_MSG_LOG(checking for library "$cf_db_libs")
  1840. AC_TRY_LINK([
  1841. $ac_includes_default
  1842. #include <db.h>
  1843. ],[
  1844. char *path = "/tmp/foo";
  1845. #ifdef DB_VERSION_MAJOR
  1846. #if DB_VERSION_MAJOR >= 4
  1847. DB *result = 0;
  1848. db_create(&result, NULL, 0);
  1849. result->open(result,
  1850. NULL,
  1851. path,
  1852. path,
  1853. DB_HASH,
  1854. DB_CREATE,
  1855. 0644);
  1856. #elif DB_VERSION_MAJOR >= 3
  1857. DB *result = 0;
  1858. db_create(&result, NULL, 0);
  1859. result->open(result,
  1860. path,
  1861. path,
  1862. DB_HASH,
  1863. DB_CREATE,
  1864. 0644);
  1865. #elif DB_VERSION_MAJOR >= 2
  1866. DB *result = 0;
  1867. db_open(path,
  1868. DB_HASH,
  1869. DB_CREATE,
  1870. 0644,
  1871. (DB_ENV *) 0,
  1872. (DB_INFO *) 0,
  1873. &result);
  1874. #endif /* DB_VERSION_MAJOR */
  1875. #else
  1876. DB *result = dbopen(path,
  1877. 2,
  1878. 0644,
  1879. DB_HASH,
  1880. 0);
  1881. #endif
  1882. ${cf_cv_main_return:-return}(result != 0)
  1883. ],[
  1884. if test -n "$cf_db_libs" ; then
  1885. cf_cv_hashed_db_libs=$cf_db_libs
  1886. else
  1887. cf_cv_hashed_db_libs=default
  1888. fi
  1889. LIBS="$cf_save_libs"
  1890. break
  1891. ])
  1892. LIBS="$cf_save_libs"
  1893. done
  1894. ])
  1895. ])dnl
  1896. dnl ---------------------------------------------------------------------------
  1897. dnl CF_HASHED_DB_VERSION version: 3 updated: 2007/12/01 15:01:37
  1898. dnl --------------------
  1899. dnl Given that we have the header file for hashed database, find the version
  1900. dnl information.
  1901. AC_DEFUN([CF_HASHED_DB_VERSION],
  1902. [
  1903. AC_CACHE_CHECK(for version of db, cf_cv_hashed_db_version,[
  1904. cf_cv_hashed_db_version=unknown
  1905. for cf_db_version in 1 2 3 4 5
  1906. do
  1907. CF_MSG_LOG(checking for db version $cf_db_version)
  1908. AC_TRY_COMPILE([
  1909. $ac_includes_default
  1910. #include <db.h>
  1911. #ifdef DB_VERSION_MAJOR
  1912. /* db2 (DB_VERSION_MAJOR=2) has also DB_VERSION_MINOR, tested with 7 */
  1913. #if $cf_db_version == DB_VERSION_MAJOR
  1914. /* ok */
  1915. #else
  1916. make an error
  1917. #endif
  1918. #else
  1919. #if $cf_db_version == 1
  1920. /* ok: assuming this is DB 1.8.5 */
  1921. #else
  1922. make an error
  1923. #endif
  1924. #endif
  1925. ],[DBT *foo = 0],[
  1926. cf_cv_hashed_db_version=$cf_db_version
  1927. break
  1928. ])
  1929. done
  1930. ])
  1931. ])dnl
  1932. dnl ---------------------------------------------------------------------------
  1933. dnl CF_HEADER_PATH version: 9 updated: 2008/12/07 19:38:31
  1934. dnl --------------
  1935. dnl Construct a search-list of directories for a nonstandard header-file
  1936. dnl
  1937. dnl Parameters
  1938. dnl $1 = the variable to return as result
  1939. dnl $2 = the package name
  1940. AC_DEFUN([CF_HEADER_PATH],
  1941. [
  1942. cf_header_path_list=""
  1943. if test -n "${CFLAGS}${CPPFLAGS}" ; then
  1944. for cf_header_path in $CPPFLAGS $CFLAGS
  1945. do
  1946. case $cf_header_path in #(vi
  1947. -I*)
  1948. cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'`
  1949. CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE)
  1950. cf_header_path_list="$cf_header_path_list [$]$1"
  1951. ;;
  1952. esac
  1953. done
  1954. fi
  1955. CF_SUBDIR_PATH($1,$2,include)
  1956. test "$includedir" != NONE && \
  1957. test "$includedir" != "/usr/include" && \
  1958. test -d "$includedir" && {
  1959. test -d $includedir && $1="[$]$1 $includedir"
  1960. test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
  1961. }
  1962. test "$oldincludedir" != NONE && \
  1963. test "$oldincludedir" != "/usr/include" && \
  1964. test -d "$oldincludedir" && {
  1965. test -d $oldincludedir && $1="[$]$1 $oldincludedir"
  1966. test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
  1967. }
  1968. $1="$cf_header_path_list [$]$1"
  1969. ])dnl
  1970. dnl ---------------------------------------------------------------------------
  1971. dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
  1972. dnl ---------------
  1973. dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
  1974. AC_DEFUN([CF_HELP_MESSAGE],
  1975. [AC_DIVERT_HELP([$1])dnl
  1976. ])dnl
  1977. dnl ---------------------------------------------------------------------------
  1978. dnl CF_INCLUDE_DIRS version: 6 updated: 2009/01/06 19:37:40
  1979. dnl ---------------
  1980. dnl Construct the list of include-options according to whether we're building
  1981. dnl in the source directory or using '--srcdir=DIR' option. If we're building
  1982. dnl with gcc, don't append the includedir if it happens to be /usr/include,
  1983. dnl since that usually breaks gcc's shadow-includes.
  1984. AC_DEFUN([CF_INCLUDE_DIRS],
  1985. [
  1986. CPPFLAGS="$CPPFLAGS -I. -I../include"
  1987. if test "$srcdir" != "."; then
  1988. CPPFLAGS="$CPPFLAGS -I\${srcdir}/../include"
  1989. fi
  1990. if test "$GCC" != yes; then
  1991. CPPFLAGS="$CPPFLAGS -I\${includedir}"
  1992. elif test "$includedir" != "/usr/include"; then
  1993. if test "$includedir" = '${prefix}/include' ; then
  1994. if test $prefix != /usr ; then
  1995. CPPFLAGS="$CPPFLAGS -I\${includedir}"
  1996. fi
  1997. else
  1998. CPPFLAGS="$CPPFLAGS -I\${includedir}"
  1999. fi
  2000. fi
  2001. AC_SUBST(CPPFLAGS)
  2002. ])dnl
  2003. dnl ---------------------------------------------------------------------------
  2004. dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
  2005. dnl -----------------
  2006. dnl Check if the given compiler is really the Intel compiler for Linux. It
  2007. dnl tries to imitate gcc, but does not return an error when it finds a mismatch
  2008. dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
  2009. dnl
  2010. dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
  2011. dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
  2012. dnl the wrappers for gcc and g++ warnings.
  2013. dnl
  2014. dnl $1 = GCC (default) or GXX
  2015. dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
  2016. dnl $3 = CFLAGS (default) or CXXFLAGS
  2017. AC_DEFUN([CF_INTEL_COMPILER],[
  2018. ifelse($2,,INTEL_COMPILER,[$2])=no
  2019. if test "$ifelse($1,,[$1],GCC)" = yes ; then
  2020. case $host_os in
  2021. linux*|gnu*)
  2022. AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
  2023. cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
  2024. ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
  2025. AC_TRY_COMPILE([],[
  2026. #ifdef __INTEL_COMPILER
  2027. #else
  2028. make an error
  2029. #endif
  2030. ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
  2031. cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
  2032. ],[])
  2033. ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
  2034. AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
  2035. ;;
  2036. esac
  2037. fi
  2038. ])dnl
  2039. dnl ---------------------------------------------------------------------------
  2040. dnl CF_ISASCII version: 3 updated: 2000/08/12 23:18:52
  2041. dnl ----------
  2042. dnl Check if we have either a function or macro for 'isascii()'.
  2043. AC_DEFUN([CF_ISASCII],
  2044. [
  2045. AC_MSG_CHECKING(for isascii)
  2046. AC_CACHE_VAL(cf_cv_have_isascii,[
  2047. AC_TRY_LINK([#include <ctype.h>],[int x = isascii(' ')],
  2048. [cf_cv_have_isascii=yes],
  2049. [cf_cv_have_isascii=no])
  2050. ])dnl
  2051. AC_MSG_RESULT($cf_cv_have_isascii)
  2052. test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII)
  2053. ])dnl
  2054. dnl ---------------------------------------------------------------------------
  2055. dnl CF_LARGEFILE version: 7 updated: 2007/06/02 11:58:50
  2056. dnl ------------
  2057. dnl Add checks for large file support.
  2058. AC_DEFUN([CF_LARGEFILE],[
  2059. ifdef([AC_FUNC_FSEEKO],[
  2060. AC_SYS_LARGEFILE
  2061. if test "$enable_largefile" != no ; then
  2062. AC_FUNC_FSEEKO
  2063. # Normally we would collect these definitions in the config.h,
  2064. # but (like _XOPEN_SOURCE), some environments rely on having these
  2065. # defined before any of the system headers are included. Another
  2066. # case comes up with C++, e.g., on AIX the compiler compiles the
  2067. # header files by themselves before looking at the body files it is
  2068. # told to compile. For ncurses, those header files do not include
  2069. # the config.h
  2070. test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
  2071. test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
  2072. test "$ac_cv_sys_file_offset_bits" != no && CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits "
  2073. AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
  2074. AC_TRY_COMPILE([
  2075. #include <sys/types.h>
  2076. #include <dirent.h>
  2077. ],[
  2078. /* if transitional largefile support is setup, this is true */
  2079. extern struct dirent64 * readdir(DIR *);
  2080. struct dirent64 *x = readdir((DIR *)0);
  2081. struct dirent *y = readdir((DIR *)0);
  2082. int z = x - y;
  2083. ],
  2084. [cf_cv_struct_dirent64=yes],
  2085. [cf_cv_struct_dirent64=no])
  2086. ])
  2087. test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
  2088. fi
  2089. ])
  2090. ])
  2091. dnl ---------------------------------------------------------------------------
  2092. dnl CF_LDFLAGS_STATIC version: 5 updated: 2008/12/27 12:30:03
  2093. dnl -----------------
  2094. dnl Check for compiler/linker flags used to temporarily force usage of static
  2095. dnl libraries. This depends on the compiler and platform. Use this to help
  2096. dnl ensure that the linker picks up a given library based on its position in
  2097. dnl the list of linker options and libraries.
  2098. AC_DEFUN([CF_LDFLAGS_STATIC],[
  2099. if test "$GCC" = yes ; then
  2100. case $cf_cv_system_name in #(
  2101. OS/2*|os2*|aix[[4]]*) #( vi
  2102. LDFLAGS_STATIC=
  2103. LDFLAGS_SHARED=
  2104. ;;
  2105. *) #( normally, except when broken
  2106. LDFLAGS_STATIC=-static
  2107. LDFLAGS_SHARED=-dynamic
  2108. ;;
  2109. esac
  2110. else
  2111. case $cf_cv_system_name in #(
  2112. aix[[456]]*) #( from ld manpage
  2113. LDFLAGS_STATIC=-bstatic
  2114. LDFLAGS_SHARED=-bdynamic
  2115. ;;
  2116. hpux*) #( from ld manpage for hpux10.20, hpux11.11
  2117. # We could also use just "archive" and "shared".
  2118. LDFLAGS_STATIC=-Wl,-a,archive_shared
  2119. LDFLAGS_SHARED=-Wl,-a,shared_archive
  2120. ;;
  2121. irix*) #( from ld manpage IRIX64
  2122. LDFLAGS_STATIC=-Bstatic
  2123. LDFLAGS_SHARED=-Bdynamic
  2124. ;;
  2125. osf[[45]]*) #( from ld manpage osf4.0d, osf5.1
  2126. # alternative "-oldstyle_liblookup" (not in cc manpage)
  2127. LDFLAGS_STATIC=-noso
  2128. LDFLAGS_SHARED=-so_archive
  2129. ;;
  2130. solaris2*)
  2131. LDFLAGS_STATIC=-Bstatic
  2132. LDFLAGS_SHARED=-Bdynamic
  2133. ;;
  2134. esac
  2135. fi
  2136. AC_SUBST(LDFLAGS_STATIC)
  2137. AC_SUBST(LDFLAGS_SHARED)
  2138. ])
  2139. dnl ---------------------------------------------------------------------------
  2140. dnl CF_LIBRARY_PATH version: 8 updated: 2008/12/07 19:38:31
  2141. dnl ---------------
  2142. dnl Construct a search-list of directories for a nonstandard library-file
  2143. dnl
  2144. dnl Parameters
  2145. dnl $1 = the variable to return as result
  2146. dnl $2 = the package name
  2147. AC_DEFUN([CF_LIBRARY_PATH],
  2148. [
  2149. cf_library_path_list=""
  2150. if test -n "${LDFLAGS}${LIBS}" ; then
  2151. for cf_library_path in $LDFLAGS $LIBS
  2152. do
  2153. case $cf_library_path in #(vi
  2154. -L*)
  2155. cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'`
  2156. CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE)
  2157. cf_library_path_list="$cf_library_path_list [$]$1"
  2158. ;;
  2159. esac
  2160. done
  2161. fi
  2162. CF_SUBDIR_PATH($1,$2,lib)
  2163. $1="$cf_library_path_list [$]$1"
  2164. ])dnl
  2165. dnl ---------------------------------------------------------------------------
  2166. dnl CF_LIB_PREFIX version: 8 updated: 2008/09/13 11:34:16
  2167. dnl -------------
  2168. dnl Compute the library-prefix for the given host system
  2169. dnl $1 = variable to set
  2170. AC_DEFUN([CF_LIB_PREFIX],
  2171. [
  2172. case $cf_cv_system_name in #(vi
  2173. OS/2*|os2*) #(vi
  2174. LIB_PREFIX=''
  2175. ;;
  2176. *) LIB_PREFIX='lib'
  2177. ;;
  2178. esac
  2179. ifelse($1,,,[$1=$LIB_PREFIX])
  2180. AC_SUBST(LIB_PREFIX)
  2181. ])dnl
  2182. dnl ---------------------------------------------------------------------------
  2183. dnl CF_LIB_RULES version: 55 updated: 2008/12/13 16:17:38
  2184. dnl ------------
  2185. dnl Append definitions and rules for the given models to the subdirectory
  2186. dnl Makefiles, and the recursion rule for the top-level Makefile. If the
  2187. dnl subdirectory is a library-source directory, modify the LIBS_TO_MAKE list in
  2188. dnl the corresponding makefile to list the models that we'll generate.
  2189. dnl
  2190. dnl For shared libraries, make a list of symbolic links to construct when
  2191. dnl generating each library. The convention used for Linux is the simplest
  2192. dnl one:
  2193. dnl lib<name>.so ->
  2194. dnl lib<name>.so.<major> ->
  2195. dnl lib<name>.so.<maj>.<minor>
  2196. AC_DEFUN([CF_LIB_RULES],
  2197. [
  2198. CF_LIB_PREFIX(cf_prefix)
  2199. AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
  2200. if test $cf_cv_shlib_version = cygdll ; then
  2201. TINFO_NAME=$TINFO_ARG_SUFFIX
  2202. TINFO_SUFFIX=.dll
  2203. fi
  2204. for cf_dir in $SRC_SUBDIRS
  2205. do
  2206. if test ! -d $srcdir/$cf_dir ; then
  2207. continue
  2208. elif test -f $srcdir/$cf_dir/modules; then
  2209. SHARED_LIB=
  2210. LIBS_TO_MAKE=
  2211. for cf_item in $cf_LIST_MODELS
  2212. do
  2213. CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
  2214. if test $cf_item = shared ; then
  2215. if test "$cf_cv_do_symlinks" = yes ; then
  2216. case "$cf_cv_shlib_version" in #(vi
  2217. rel) #(vi
  2218. case "$cf_cv_system_name" in #(vi
  2219. darwin*)
  2220. case .${LIB_SUFFIX} in
  2221. .w*)
  2222. cf_suffix=`echo $cf_suffix | sed 's/^w//'`
  2223. cf_suffix=w'.${REL_VERSION}'"$cf_suffix"
  2224. ;;
  2225. *)
  2226. cf_suffix='.${REL_VERSION}'"$cf_suffix"
  2227. ;;
  2228. esac
  2229. ;; #(vi
  2230. *) cf_suffix="$cf_suffix"'.${REL_VERSION}' ;;
  2231. esac
  2232. ;;
  2233. abi)
  2234. case "$cf_cv_system_name" in #(vi
  2235. darwin*)
  2236. case .${LIB_SUFFIX} in
  2237. .w*)
  2238. cf_suffix=`echo $cf_suffix | sed 's/^w//'`
  2239. cf_suffix=w'.${ABI_VERSION}'"$cf_suffix"
  2240. ;;
  2241. *)
  2242. cf_suffix='.${ABI_VERSION}'"$cf_suffix"
  2243. ;;
  2244. esac
  2245. ;; #(vi
  2246. *) cf_suffix="$cf_suffix"'.${ABI_VERSION}' ;;
  2247. esac
  2248. ;;
  2249. esac
  2250. fi
  2251. # cygwin needs import library, and has unique naming convention
  2252. # use autodetected ${cf_prefix} for import lib and static lib, but
  2253. # use 'cyg' prefix for shared lib.
  2254. if test $cf_cv_shlib_version = cygdll ; then
  2255. cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'`
  2256. LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/cyg${cf_dir}${cf_cygsuf}"
  2257. continue
  2258. fi
  2259. fi
  2260. LIBS_TO_MAKE="$LIBS_TO_MAKE ../lib/${cf_prefix}${cf_dir}${cf_suffix}"
  2261. done
  2262. if test $cf_dir = ncurses ; then
  2263. cf_subsets="$LIB_SUBSETS"
  2264. cf_r_parts="$cf_subsets"
  2265. cf_liblist="$LIBS_TO_MAKE"
  2266. while test -n "$cf_r_parts"
  2267. do
  2268. cf_l_parts=`echo "$cf_r_parts" |sed -e 's/ .*$//'`
  2269. cf_r_parts=`echo "$cf_r_parts" |sed -e 's/^[[^ ]]* //'`
  2270. if test "$cf_l_parts" != "$cf_r_parts" ; then
  2271. cf_item=
  2272. case $cf_l_parts in #(vi
  2273. *termlib*) #(vi
  2274. cf_item=`echo $cf_liblist |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g`
  2275. ;;
  2276. *ticlib*)
  2277. cf_item=`echo $cf_liblist |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g`
  2278. ;;
  2279. *)
  2280. break
  2281. ;;
  2282. esac
  2283. if test -n "$cf_item"; then
  2284. LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE"
  2285. fi
  2286. else
  2287. break
  2288. fi
  2289. done
  2290. else
  2291. cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'`
  2292. fi
  2293. sed -e "s%@LIBS_TO_MAKE@%$LIBS_TO_MAKE%" \
  2294. -e "s%@SHARED_LIB@%$SHARED_LIB%" \
  2295. $cf_dir/Makefile >$cf_dir/Makefile.out
  2296. mv $cf_dir/Makefile.out $cf_dir/Makefile
  2297. $AWK -f $srcdir/mk-0th.awk \
  2298. libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" \
  2299. $srcdir/$cf_dir/modules >>$cf_dir/Makefile
  2300. for cf_subset in $cf_subsets
  2301. do
  2302. cf_subdirs=
  2303. for cf_item in $cf_LIST_MODELS
  2304. do
  2305. echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})"
  2306. CF_UPPER(cf_ITEM,$cf_item)
  2307. CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf)
  2308. CF_OBJ_SUBDIR($cf_item,cf_subdir)
  2309. # Test for case where we build libtinfo with a different name.
  2310. cf_libname=$cf_dir
  2311. if test $cf_dir = ncurses ; then
  2312. case $cf_subset in
  2313. *base*)
  2314. cf_libname=${cf_libname}$LIB_SUFFIX
  2315. ;;
  2316. *termlib*)
  2317. cf_libname=$TINFO_LIB_SUFFIX
  2318. ;;
  2319. ticlib*)
  2320. cf_libname=$TICS_LIB_SUFFIX
  2321. ;;
  2322. esac
  2323. else
  2324. cf_libname=${cf_libname}$LIB_SUFFIX
  2325. fi
  2326. if test -n "${DFT_ARG_SUFFIX}" ; then
  2327. # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX
  2328. cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"`
  2329. fi
  2330. # These dependencies really are for development, not
  2331. # builds, but they are useful in porting, too.
  2332. cf_depend="../include/ncurses_cfg.h"
  2333. if test "$srcdir" = "."; then
  2334. cf_reldir="."
  2335. else
  2336. cf_reldir="\${srcdir}"
  2337. fi
  2338. if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then
  2339. cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h"
  2340. elif test -f $srcdir/$cf_dir/curses.priv.h; then
  2341. cf_depend="$cf_depend $cf_reldir/curses.priv.h"
  2342. fi
  2343. cf_dir_suffix=
  2344. old_cf_suffix="$cf_suffix"
  2345. if test "$cf_cv_shlib_version_infix" = yes ; then
  2346. if test -n "$LIB_SUFFIX" ; then
  2347. case $LIB_SUFFIX in
  2348. w*)
  2349. cf_libname=`echo $cf_libname | sed 's/w$//'`
  2350. cf_suffix=`echo $cf_suffix | sed 's/^w//'`
  2351. cf_dir_suffix=w
  2352. ;;
  2353. esac
  2354. fi
  2355. fi
  2356. $AWK -f $srcdir/mk-1st.awk \
  2357. name=${cf_libname}${cf_dir_suffix} \
  2358. traces=$LIB_TRACING \
  2359. MODEL=$cf_ITEM \
  2360. model=$cf_subdir \
  2361. prefix=$cf_prefix \
  2362. suffix=$cf_suffix \
  2363. subset=$cf_subset \
  2364. TermlibRoot=$TINFO_NAME \
  2365. TermlibSuffix=$TINFO_SUFFIX \
  2366. ShlibVer=$cf_cv_shlib_version \
  2367. ShlibVerInfix=$cf_cv_shlib_version_infix \
  2368. ReLink=${cf_cv_do_relink-no} \
  2369. DoLinks=$cf_cv_do_symlinks \
  2370. rmSoLocs=$cf_cv_rm_so_locs \
  2371. ldconfig="$LDCONFIG" \
  2372. overwrite=$WITH_OVERWRITE \
  2373. depend="$cf_depend" \
  2374. host="$host" \
  2375. $srcdir/$cf_dir/modules >>$cf_dir/Makefile
  2376. cf_suffix="$old_cf_suffix"
  2377. for cf_subdir2 in $cf_subdirs lib
  2378. do
  2379. test $cf_subdir = $cf_subdir2 && break
  2380. done
  2381. test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \
  2382. $AWK -f $srcdir/mk-2nd.awk \
  2383. name=$cf_dir \
  2384. traces=$LIB_TRACING \
  2385. MODEL=$cf_ITEM \
  2386. model=$cf_subdir \
  2387. subset=$cf_subset \
  2388. srcdir=$srcdir \
  2389. echo=$WITH_ECHO \
  2390. crenames=$cf_cv_prog_CC_c_o \
  2391. cxxrenames=$cf_cv_prog_CXX_c_o \
  2392. $srcdir/$cf_dir/modules >>$cf_dir/Makefile
  2393. cf_subdirs="$cf_subdirs $cf_subdir"
  2394. done
  2395. done
  2396. fi
  2397. echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >>Makefile
  2398. done
  2399. for cf_dir in $SRC_SUBDIRS
  2400. do
  2401. if test ! -d $srcdir/$cf_dir ; then
  2402. continue
  2403. fi
  2404. if test -f $cf_dir/Makefile ; then
  2405. case "$cf_dir" in
  2406. Ada95) #(vi
  2407. echo 'libs \' >> Makefile
  2408. echo 'install.libs \' >> Makefile
  2409. echo 'uninstall.libs ::' >> Makefile
  2410. echo ' cd '$cf_dir' && ${MAKE} ${CF_MFLAGS} [$]@' >> Makefile
  2411. ;;
  2412. esac
  2413. fi
  2414. if test -f $srcdir/$cf_dir/modules; then
  2415. echo >> Makefile
  2416. if test -f $srcdir/$cf_dir/headers; then
  2417. cat >> Makefile <<CF_EOF
  2418. install.includes \\
  2419. uninstall.includes \\
  2420. CF_EOF
  2421. fi
  2422. if test "$cf_dir" != "c++" ; then
  2423. echo 'lint \' >> Makefile
  2424. fi
  2425. cat >> Makefile <<CF_EOF
  2426. libs \\
  2427. lintlib \\
  2428. install.libs \\
  2429. uninstall.libs \\
  2430. install.$cf_dir \\
  2431. uninstall.$cf_dir ::
  2432. cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
  2433. CF_EOF
  2434. elif test -f $srcdir/$cf_dir/headers; then
  2435. cat >> Makefile <<CF_EOF
  2436. libs \\
  2437. install.libs \\
  2438. uninstall.libs \\
  2439. install.includes \\
  2440. uninstall.includes ::
  2441. cd $cf_dir && \${MAKE} \${CF_MFLAGS} \[$]@
  2442. CF_EOF
  2443. fi
  2444. done
  2445. cat >> Makefile <<CF_EOF
  2446. install.libs uninstall.libs \\
  2447. install.data uninstall.data ::
  2448. $MAKE_TERMINFO cd misc && \${MAKE} \${CF_MFLAGS} \[$]@
  2449. CF_EOF
  2450. if test "x$cf_with_manpages" = xyes; then
  2451. cat >> Makefile <<CF_EOF
  2452. install.man \\
  2453. uninstall.man ::
  2454. cd man && \${MAKE} \${CF_MFLAGS} \[$]@
  2455. CF_EOF
  2456. fi
  2457. cat >> Makefile <<CF_EOF
  2458. distclean ::
  2459. rm -f config.cache config.log config.status Makefile include/ncurses_cfg.h
  2460. rm -f headers.sh headers.sed mk_shared_lib.sh
  2461. rm -f edit_man.* man_alias.*
  2462. rm -rf \${DIRS_TO_MAKE}
  2463. CF_EOF
  2464. # Special case: tack's manpage lives in its own directory.
  2465. if test "x$cf_with_manpages" = xyes; then
  2466. if test -d tack ; then
  2467. if test -f $srcdir/$tack.h; then
  2468. cat >> Makefile <<CF_EOF
  2469. install.man \\
  2470. uninstall.man ::
  2471. cd tack && \${MAKE} \${CF_MFLAGS} \[$]@
  2472. CF_EOF
  2473. fi
  2474. fi
  2475. fi
  2476. dnl If we're installing into a subdirectory of /usr/include, etc., we should
  2477. dnl prepend the subdirectory's name to the "#include" paths. It won't hurt
  2478. dnl anything, and will make it more standardized. It's awkward to decide this
  2479. dnl at configuration because of quoting, so we'll simply make all headers
  2480. dnl installed via a script that can do the right thing.
  2481. rm -f headers.sed headers.sh
  2482. dnl ( generating this script makes the makefiles a little tidier :-)
  2483. echo creating headers.sh
  2484. cat >headers.sh <<CF_EOF
  2485. #! /bin/sh
  2486. # This shell script is generated by the 'configure' script. It is invoked in a
  2487. # subdirectory of the build tree. It generates a sed-script in the parent
  2488. # directory that is used to adjust includes for header files that reside in a
  2489. # subdirectory of /usr/include, etc.
  2490. PRG=""
  2491. while test \[$]# != 3
  2492. do
  2493. PRG="\$PRG \[$]1"; shift
  2494. done
  2495. DST=\[$]1
  2496. REF=\[$]2
  2497. SRC=\[$]3
  2498. TMPSRC=\${TMPDIR-/tmp}/\`basename \$SRC\`\$\$
  2499. TMPSED=\${TMPDIR-/tmp}/headers.sed\$\$
  2500. echo installing \$SRC in \$DST
  2501. CF_EOF
  2502. if test $WITH_CURSES_H = yes; then
  2503. cat >>headers.sh <<CF_EOF
  2504. case \$DST in
  2505. /*/include/*)
  2506. END=\`basename \$DST\`
  2507. for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
  2508. do
  2509. NAME=\`basename \$i\`
  2510. echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
  2511. done
  2512. ;;
  2513. *)
  2514. echo "" >> \$TMPSED
  2515. ;;
  2516. esac
  2517. CF_EOF
  2518. else
  2519. cat >>headers.sh <<CF_EOF
  2520. case \$DST in
  2521. /*/include/*)
  2522. END=\`basename \$DST\`
  2523. for i in \`cat \$REF/../*/headers |fgrep -v "#"\`
  2524. do
  2525. NAME=\`basename \$i\`
  2526. if test "\$NAME" = "curses.h"
  2527. then
  2528. echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
  2529. NAME=ncurses.h
  2530. fi
  2531. echo "s/<\$NAME>/<\$END\/\$NAME>/" >> \$TMPSED
  2532. done
  2533. ;;
  2534. *)
  2535. echo "s/<curses.h>/<ncurses.h>/" >> \$TMPSED
  2536. ;;
  2537. esac
  2538. CF_EOF
  2539. fi
  2540. cat >>headers.sh <<CF_EOF
  2541. rm -f \$TMPSRC
  2542. sed -f \$TMPSED \$SRC > \$TMPSRC
  2543. NAME=\`basename \$SRC\`
  2544. CF_EOF
  2545. if test $WITH_CURSES_H != yes; then
  2546. cat >>headers.sh <<CF_EOF
  2547. test "\$NAME" = "curses.h" && NAME=ncurses.h
  2548. CF_EOF
  2549. fi
  2550. cat >>headers.sh <<CF_EOF
  2551. # Just in case someone gzip'd manpages, remove the conflicting copy.
  2552. test -f \$DST/\$NAME.gz && rm -f \$DST/\$NAME.gz
  2553. eval \$PRG \$TMPSRC \$DST/\$NAME
  2554. rm -f \$TMPSRC \$TMPSED
  2555. CF_EOF
  2556. chmod 0755 headers.sh
  2557. for cf_dir in $SRC_SUBDIRS
  2558. do
  2559. if test ! -d $srcdir/$cf_dir ; then
  2560. continue
  2561. fi
  2562. if test -f $srcdir/$cf_dir/headers; then
  2563. $AWK -f $srcdir/mk-hdr.awk \
  2564. subset="$LIB_SUBSETS" \
  2565. compat="$WITH_CURSES_H" \
  2566. $srcdir/$cf_dir/headers >>$cf_dir/Makefile
  2567. fi
  2568. if test -f $srcdir/$cf_dir/modules; then
  2569. if test "$cf_dir" != "c++" ; then
  2570. cat >>$cf_dir/Makefile <<"CF_EOF"
  2571. depend : ${AUTO_SRC}
  2572. makedepend -- ${CPPFLAGS} -- ${C_SRC}
  2573. # DO NOT DELETE THIS LINE -- make depend depends on it.
  2574. CF_EOF
  2575. fi
  2576. fi
  2577. done
  2578. ])dnl
  2579. dnl ---------------------------------------------------------------------------
  2580. dnl CF_LIB_SONAME version: 3 updated: 2006/12/16 15:55:46
  2581. dnl -------------
  2582. dnl Find the and soname for the given shared library. Set the cache variable
  2583. dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache
  2584. dnl variable to "unknown".
  2585. dnl
  2586. dnl $1 = headers
  2587. dnl $2 = code
  2588. dnl $3 = library name
  2589. AC_DEFUN([CF_LIB_SONAME],
  2590. [
  2591. AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[
  2592. cf_cv_$3_soname=unknown
  2593. if test "$cross_compiling" != yes ; then
  2594. cat >conftest.$ac_ext <<CF_EOF
  2595. $1
  2596. int main()
  2597. {
  2598. $2
  2599. ${cf_cv_main_return:-return}(0);
  2600. }
  2601. CF_EOF
  2602. cf_save_LIBS="$LIBS"
  2603. LIBS="-l$3 $LIBS"
  2604. if AC_TRY_EVAL(ac_compile) ; then
  2605. if AC_TRY_EVAL(ac_link) ; then
  2606. cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.`
  2607. test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown
  2608. fi
  2609. fi
  2610. rm -f conftest*
  2611. LIBS="$cf_save_LIBS"
  2612. fi
  2613. ])
  2614. ])
  2615. dnl ---------------------------------------------------------------------------
  2616. dnl CF_LIB_SUFFIX version: 16 updated: 2008/12/27 12:30:03
  2617. dnl -------------
  2618. dnl Compute the library file-suffix from the given model name
  2619. dnl $1 = model name
  2620. dnl $2 = variable to set (the nominal library suffix)
  2621. dnl $3 = dependency variable to set (actual filename)
  2622. dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
  2623. AC_DEFUN([CF_LIB_SUFFIX],
  2624. [
  2625. AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
  2626. case $1 in #(vi
  2627. libtool) #(vi
  2628. $2='.la'
  2629. $3=[$]$2
  2630. ;;
  2631. normal) #(vi
  2632. $2='.a'
  2633. $3=[$]$2
  2634. ;;
  2635. debug) #(vi
  2636. $2='_g.a'
  2637. $3=[$]$2
  2638. ;;
  2639. profile) #(vi
  2640. $2='_p.a'
  2641. $3=[$]$2
  2642. ;;
  2643. shared) #(vi
  2644. case $cf_cv_system_name in
  2645. aix[[56]]*) #(vi
  2646. $2='.a'
  2647. $3=[$]$2
  2648. ;;
  2649. cygwin*) #(vi
  2650. $2='.dll'
  2651. $3='.dll.a'
  2652. ;;
  2653. darwin*) #(vi
  2654. $2='.dylib'
  2655. $3=[$]$2
  2656. ;;
  2657. hpux*) #(vi
  2658. case $target in
  2659. ia64*) #(vi
  2660. $2='.so'
  2661. $3=[$]$2
  2662. ;;
  2663. *) #(vi
  2664. $2='.sl'
  2665. $3=[$]$2
  2666. ;;
  2667. esac
  2668. ;;
  2669. *) $2='.so'
  2670. $3=[$]$2
  2671. ;;
  2672. esac
  2673. esac
  2674. test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
  2675. test -n "$LIB_SUFFIX" && $3="${LIB_SUFFIX}[$]{$3}"
  2676. ])dnl
  2677. dnl ---------------------------------------------------------------------------
  2678. dnl CF_LIB_TYPE version: 4 updated: 2000/10/20 22:57:49
  2679. dnl -----------
  2680. dnl Compute the string to append to -library from the given model name
  2681. dnl $1 = model name
  2682. dnl $2 = variable to set
  2683. dnl The variable $LIB_SUFFIX, if set, prepends the variable to set.
  2684. AC_DEFUN([CF_LIB_TYPE],
  2685. [
  2686. case $1 in
  2687. libtool) $2='' ;;
  2688. normal) $2='' ;;
  2689. debug) $2='_g' ;;
  2690. profile) $2='_p' ;;
  2691. shared) $2='' ;;
  2692. esac
  2693. test -n "$LIB_SUFFIX" && $2="${LIB_SUFFIX}[$]{$2}"
  2694. ])dnl
  2695. dnl ---------------------------------------------------------------------------
  2696. dnl CF_LINK_DATAONLY version: 9 updated: 2009/01/01 20:21:38
  2697. dnl ----------------
  2698. dnl Some systems have a non-ANSI linker that doesn't pull in modules that have
  2699. dnl only data (i.e., no functions), for example NeXT. On those systems we'll
  2700. dnl have to provide wrappers for global tables to ensure they're linked
  2701. dnl properly.
  2702. AC_DEFUN([CF_LINK_DATAONLY],
  2703. [
  2704. AC_MSG_CHECKING([if data-only library module links])
  2705. AC_CACHE_VAL(cf_cv_link_dataonly,[
  2706. rm -f conftest.a
  2707. cat >conftest.$ac_ext <<EOF
  2708. #line __oline__ "configure"
  2709. int testdata[[3]] = { 123, 456, 789 };
  2710. EOF
  2711. if AC_TRY_EVAL(ac_compile) ; then
  2712. mv conftest.o data.o && \
  2713. ( $AR $ARFLAGS conftest.a data.o ) 2>&AC_FD_CC 1>/dev/null
  2714. fi
  2715. rm -f conftest.$ac_ext data.o
  2716. cat >conftest.$ac_ext <<EOF
  2717. #line __oline__ "configure"
  2718. int testfunc()
  2719. {
  2720. #if defined(NeXT)
  2721. ${cf_cv_main_return:-return}(1); /* I'm told this linker is broken */
  2722. #else
  2723. extern int testdata[[3]];
  2724. return testdata[[0]] == 123
  2725. && testdata[[1]] == 456
  2726. && testdata[[2]] == 789;
  2727. #endif
  2728. }
  2729. EOF
  2730. if AC_TRY_EVAL(ac_compile); then
  2731. mv conftest.o func.o && \
  2732. ( $AR $ARFLAGS conftest.a func.o ) 2>&AC_FD_CC 1>/dev/null
  2733. fi
  2734. rm -f conftest.$ac_ext func.o
  2735. ( eval $RANLIB conftest.a ) 2>&AC_FD_CC >/dev/null
  2736. cf_saveLIBS="$LIBS"
  2737. LIBS="conftest.a $LIBS"
  2738. AC_TRY_RUN([
  2739. int main()
  2740. {
  2741. extern int testfunc();
  2742. ${cf_cv_main_return:-return} (!testfunc());
  2743. }
  2744. ],
  2745. [cf_cv_link_dataonly=yes],
  2746. [cf_cv_link_dataonly=no],
  2747. [cf_cv_link_dataonly=unknown])
  2748. LIBS="$cf_saveLIBS"
  2749. ])
  2750. AC_MSG_RESULT($cf_cv_link_dataonly)
  2751. if test "$cf_cv_link_dataonly" = no ; then
  2752. AC_DEFINE(BROKEN_LINKER)
  2753. BROKEN_LINKER=1
  2754. fi
  2755. ])dnl
  2756. dnl ---------------------------------------------------------------------------
  2757. dnl CF_LINK_FUNCS version: 7 updated: 2006/12/16 12:33:30
  2758. dnl -------------
  2759. dnl Most Unix systems have both link and symlink, a few don't have symlink.
  2760. dnl A few non-Unix systems implement symlink, but not link.
  2761. dnl A few non-systems implement neither (or have nonfunctional versions).
  2762. AC_DEFUN([CF_LINK_FUNCS],
  2763. [
  2764. AC_CHECK_FUNCS( \
  2765. remove \
  2766. unlink )
  2767. if test "$cross_compiling" = yes ; then
  2768. AC_CHECK_FUNCS( \
  2769. link \
  2770. symlink )
  2771. else
  2772. AC_CACHE_CHECK(if link/symlink functions work,cf_cv_link_funcs,[
  2773. cf_cv_link_funcs=
  2774. for cf_func in link symlink ; do
  2775. AC_TRY_RUN([
  2776. #include <sys/types.h>
  2777. #include <sys/stat.h>
  2778. #ifdef HAVE_UNISTD_H
  2779. #include <unistd.h>
  2780. #endif
  2781. int main()
  2782. {
  2783. int fail = 0;
  2784. char *src = "config.log";
  2785. char *dst = "conftest.chk";
  2786. struct stat src_sb;
  2787. struct stat dst_sb;
  2788. stat(src, &src_sb);
  2789. fail = ($cf_func("config.log", "conftest.chk") < 0)
  2790. || (stat(dst, &dst_sb) < 0)
  2791. || (dst_sb.st_mtime != src_sb.st_mtime);
  2792. #ifdef HAVE_UNLINK
  2793. unlink(dst);
  2794. #else
  2795. remove(dst);
  2796. #endif
  2797. ${cf_cv_main_return:-return} (fail);
  2798. }
  2799. ],[
  2800. cf_cv_link_funcs="$cf_cv_link_funcs $cf_func"
  2801. eval 'ac_cv_func_'$cf_func'=yes'],[
  2802. eval 'ac_cv_func_'$cf_func'=no'],[
  2803. eval 'ac_cv_func_'$cf_func'=error'])
  2804. done
  2805. test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no
  2806. ])
  2807. test "$ac_cv_func_link" = yes && AC_DEFINE(HAVE_LINK)
  2808. test "$ac_cv_func_symlink" = yes && AC_DEFINE(HAVE_SYMLINK)
  2809. fi
  2810. ])dnl
  2811. dnl ---------------------------------------------------------------------------
  2812. dnl CF_MAIN_RETURN version: 1 updated: 2006/12/10 09:51:54
  2813. dnl --------------
  2814. dnl Check if a return from main to the shell actually returns the same exit
  2815. dnl code. This is true for almost any POSIX environment.
  2816. dnl
  2817. dnl Some very old environments did not flush stdout, etc., on an exit. That
  2818. dnl would be a useful case to test for also.
  2819. AC_DEFUN([CF_MAIN_RETURN],
  2820. [
  2821. cf_cv_main_return=return
  2822. ])dnl
  2823. dnl ---------------------------------------------------------------------------
  2824. dnl CF_MAKEFLAGS version: 12 updated: 2006/10/21 08:27:03
  2825. dnl ------------
  2826. dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make'
  2827. dnl options to lower-levels. It's very useful for "make -n" -- if we have it.
  2828. dnl (GNU 'make' does both, something POSIX 'make', which happens to make the
  2829. dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-)
  2830. AC_DEFUN([CF_MAKEFLAGS],
  2831. [
  2832. AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[
  2833. cf_cv_makeflags=''
  2834. for cf_option in '-${MAKEFLAGS}' '${MFLAGS}'
  2835. do
  2836. cat >cf_makeflags.tmp <<CF_EOF
  2837. SHELL = /bin/sh
  2838. all :
  2839. @ echo '.$cf_option'
  2840. CF_EOF
  2841. cf_result=`${MAKE-make} -k -f cf_makeflags.tmp 2>/dev/null | sed -e 's,[[ ]]*$,,'`
  2842. case "$cf_result" in
  2843. .*k)
  2844. cf_result=`${MAKE-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`
  2845. case "$cf_result" in
  2846. .*CC=*) cf_cv_makeflags=
  2847. ;;
  2848. *) cf_cv_makeflags=$cf_option
  2849. ;;
  2850. esac
  2851. break
  2852. ;;
  2853. .-) ;;
  2854. *) echo "given option \"$cf_option\", no match \"$cf_result\""
  2855. ;;
  2856. esac
  2857. done
  2858. rm -f cf_makeflags.tmp
  2859. ])
  2860. AC_SUBST(cf_cv_makeflags)
  2861. ])dnl
  2862. dnl ---------------------------------------------------------------------------
  2863. dnl CF_MAKE_TAGS version: 2 updated: 2000/10/04 09:18:40
  2864. dnl ------------
  2865. dnl Generate tags/TAGS targets for makefiles. Do not generate TAGS if we have
  2866. dnl a monocase filesystem.
  2867. AC_DEFUN([CF_MAKE_TAGS],[
  2868. AC_REQUIRE([CF_MIXEDCASE_FILENAMES])
  2869. AC_CHECK_PROG(MAKE_LOWER_TAGS, ctags, yes, no)
  2870. if test "$cf_cv_mixedcase" = yes ; then
  2871. AC_CHECK_PROG(MAKE_UPPER_TAGS, etags, yes, no)
  2872. else
  2873. MAKE_UPPER_TAGS=no
  2874. fi
  2875. if test "$MAKE_UPPER_TAGS" = yes ; then
  2876. MAKE_UPPER_TAGS=
  2877. else
  2878. MAKE_UPPER_TAGS="#"
  2879. fi
  2880. AC_SUBST(MAKE_UPPER_TAGS)
  2881. if test "$MAKE_LOWER_TAGS" = yes ; then
  2882. MAKE_LOWER_TAGS=
  2883. else
  2884. MAKE_LOWER_TAGS="#"
  2885. fi
  2886. AC_SUBST(MAKE_LOWER_TAGS)
  2887. ])dnl
  2888. dnl ---------------------------------------------------------------------------
  2889. dnl CF_MANPAGE_FORMAT version: 8 updated: 2009/01/11 20:30:50
  2890. dnl -----------------
  2891. dnl Option to allow user to override automatic configuration of manpage format.
  2892. dnl There are several special cases:
  2893. dnl
  2894. dnl gzip - man checks for, can display gzip'd files
  2895. dnl compress - man checks for, can display compressed files
  2896. dnl BSDI - files in the cat-directories are suffixed ".0"
  2897. dnl formatted - installer should format (put files in cat-directory)
  2898. dnl catonly - installer should only format, e.g., for a turnkey system.
  2899. dnl
  2900. dnl There are other configurations which this macro does not test, e.g., HPUX's
  2901. dnl compressed manpages (but uncompressed manpages are fine, and HPUX's naming
  2902. dnl convention would not match our use).
  2903. AC_DEFUN([CF_MANPAGE_FORMAT],
  2904. [
  2905. AC_REQUIRE([CF_PATHSEP])
  2906. AC_MSG_CHECKING(format of man-pages)
  2907. AC_ARG_WITH(manpage-format,
  2908. [ --with-manpage-format specify manpage-format: gzip/compress/BSDI/normal and
  2909. optionally formatted/catonly, e.g., gzip,formatted],
  2910. [MANPAGE_FORMAT=$withval],
  2911. [MANPAGE_FORMAT=unknown])
  2912. test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown
  2913. MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'`
  2914. cf_unknown=
  2915. case $MANPAGE_FORMAT in
  2916. unknown)
  2917. if test -z "$MANPATH" ; then
  2918. MANPATH="/usr/man:/usr/share/man"
  2919. fi
  2920. # look for the 'date' man-page (it's most likely to be installed!)
  2921. MANPAGE_FORMAT=
  2922. cf_preform=no
  2923. cf_catonly=yes
  2924. cf_example=date
  2925. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}"
  2926. for cf_dir in $MANPATH; do
  2927. test -z "$cf_dir" && cf_dir=/usr/man
  2928. for cf_name in $cf_dir/man*/$cf_example.[[01]]* $cf_dir/cat*/$cf_example.[[01]]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example
  2929. do
  2930. cf_test=`echo $cf_name | sed -e 's/*//'`
  2931. if test "x$cf_test" = "x$cf_name" ; then
  2932. case "$cf_name" in
  2933. *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";;
  2934. *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";;
  2935. *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";;
  2936. *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";;
  2937. esac
  2938. case "$cf_name" in
  2939. $cf_dir/man*)
  2940. cf_catonly=no
  2941. ;;
  2942. $cf_dir/cat*)
  2943. cf_preform=yes
  2944. ;;
  2945. esac
  2946. break
  2947. fi
  2948. # if we found a match in either man* or cat*, stop looking
  2949. if test -n "$MANPAGE_FORMAT" ; then
  2950. cf_found=no
  2951. test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted"
  2952. test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly"
  2953. case "$cf_name" in
  2954. $cf_dir/cat*)
  2955. cf_found=yes
  2956. ;;
  2957. esac
  2958. test $cf_found=yes && break
  2959. fi
  2960. done
  2961. # only check the first directory in $MANPATH where we find manpages
  2962. if test -n "$MANPAGE_FORMAT" ; then
  2963. break
  2964. fi
  2965. done
  2966. # if we did not find the example, just assume it is normal
  2967. test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal
  2968. IFS="$ac_save_ifs"
  2969. ;;
  2970. *)
  2971. for cf_option in $MANPAGE_FORMAT; do
  2972. case $cf_option in #(vi
  2973. gzip|compress|BSDI|normal|formatted|catonly)
  2974. ;;
  2975. *)
  2976. cf_unknown="$cf_unknown $cf_option"
  2977. ;;
  2978. esac
  2979. done
  2980. ;;
  2981. esac
  2982. AC_MSG_RESULT($MANPAGE_FORMAT)
  2983. if test -n "$cf_unknown" ; then
  2984. AC_MSG_WARN(Unexpected manpage-format $cf_unknown)
  2985. fi
  2986. ])dnl
  2987. dnl ---------------------------------------------------------------------------
  2988. dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57
  2989. dnl ------------------
  2990. dnl The Debian people have their own naming convention for manpages. This
  2991. dnl option lets us override the name of the file containing renaming, or
  2992. dnl disable it altogether.
  2993. AC_DEFUN([CF_MANPAGE_RENAMES],
  2994. [
  2995. AC_MSG_CHECKING(for manpage renaming)
  2996. AC_ARG_WITH(manpage-renames,
  2997. [ --with-manpage-renames specify manpage-renaming],
  2998. [MANPAGE_RENAMES=$withval],
  2999. [MANPAGE_RENAMES=yes])
  3000. case ".$MANPAGE_RENAMES" in #(vi
  3001. .no) #(vi
  3002. ;;
  3003. .|.yes)
  3004. # Debian 'man' program?
  3005. if test -f /etc/debian_version ; then
  3006. MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames
  3007. else
  3008. MANPAGE_RENAMES=no
  3009. fi
  3010. ;;
  3011. esac
  3012. if test "$MANPAGE_RENAMES" != no ; then
  3013. if test -f $srcdir/man/$MANPAGE_RENAMES ; then
  3014. MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES
  3015. elif test ! -f $MANPAGE_RENAMES ; then
  3016. AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES)
  3017. fi
  3018. test ! -d man && mkdir man
  3019. # Construct a sed-script to perform renaming within man-pages
  3020. if test -n "$MANPAGE_RENAMES" ; then
  3021. test ! -d man && mkdir man
  3022. sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed
  3023. fi
  3024. fi
  3025. AC_MSG_RESULT($MANPAGE_RENAMES)
  3026. AC_SUBST(MANPAGE_RENAMES)
  3027. ])dnl
  3028. dnl ---------------------------------------------------------------------------
  3029. dnl CF_MANPAGE_SYMLINKS version: 4 updated: 2003/12/13 18:01:58
  3030. dnl -------------------
  3031. dnl Some people expect each tool to make all aliases for manpages in the
  3032. dnl man-directory. This accommodates the older, less-capable implementations
  3033. dnl of 'man', and is optional.
  3034. AC_DEFUN([CF_MANPAGE_SYMLINKS],
  3035. [
  3036. AC_MSG_CHECKING(if manpage aliases will be installed)
  3037. AC_ARG_WITH(manpage-aliases,
  3038. [ --with-manpage-aliases specify manpage-aliases using .so],
  3039. [MANPAGE_ALIASES=$withval],
  3040. [MANPAGE_ALIASES=yes])
  3041. AC_MSG_RESULT($MANPAGE_ALIASES)
  3042. if test "$LN_S" = "ln -s"; then
  3043. cf_use_symlinks=yes
  3044. else
  3045. cf_use_symlinks=no
  3046. fi
  3047. MANPAGE_SYMLINKS=no
  3048. if test "$MANPAGE_ALIASES" = yes ; then
  3049. AC_MSG_CHECKING(if manpage symlinks should be used)
  3050. AC_ARG_WITH(manpage-symlinks,
  3051. [ --with-manpage-symlinks specify manpage-aliases using symlinks],
  3052. [MANPAGE_SYMLINKS=$withval],
  3053. [MANPAGE_SYMLINKS=$cf_use_symlinks])
  3054. if test "$$cf_use_symlinks" = no; then
  3055. if test "$MANPAGE_SYMLINKS" = yes ; then
  3056. AC_MSG_WARN(cannot make symlinks, will use .so files)
  3057. MANPAGE_SYMLINKS=no
  3058. fi
  3059. fi
  3060. AC_MSG_RESULT($MANPAGE_SYMLINKS)
  3061. fi
  3062. ])dnl
  3063. dnl ---------------------------------------------------------------------------
  3064. dnl CF_MANPAGE_TBL version: 3 updated: 2002/01/19 22:51:32
  3065. dnl --------------
  3066. dnl This option causes manpages to be run through tbl(1) to generate tables
  3067. dnl correctly.
  3068. AC_DEFUN([CF_MANPAGE_TBL],
  3069. [
  3070. AC_MSG_CHECKING(for manpage tbl)
  3071. AC_ARG_WITH(manpage-tbl,
  3072. [ --with-manpage-tbl specify manpage processing with tbl],
  3073. [MANPAGE_TBL=$withval],
  3074. [MANPAGE_TBL=no])
  3075. AC_MSG_RESULT($MANPAGE_TBL)
  3076. ])dnl
  3077. dnl ---------------------------------------------------------------------------
  3078. dnl CF_MAN_PAGES version: 35 updated: 2007/03/31 11:47:29
  3079. dnl ------------
  3080. dnl Try to determine if the man-pages on the system are compressed, and if
  3081. dnl so, what format is used. Use this information to construct a script that
  3082. dnl will install man-pages.
  3083. AC_DEFUN([CF_MAN_PAGES],
  3084. [
  3085. CF_HELP_MESSAGE(Options to Specify How Manpages are Installed:)
  3086. CF_MANPAGE_FORMAT
  3087. CF_MANPAGE_RENAMES
  3088. CF_MANPAGE_SYMLINKS
  3089. CF_MANPAGE_TBL
  3090. if test "$prefix" = "NONE" ; then
  3091. cf_prefix="$ac_default_prefix"
  3092. else
  3093. cf_prefix="$prefix"
  3094. fi
  3095. case "$MANPAGE_FORMAT" in # (vi
  3096. *catonly*) # (vi
  3097. cf_format=yes
  3098. cf_inboth=no
  3099. ;;
  3100. *formatted*) # (vi
  3101. cf_format=yes
  3102. cf_inboth=yes
  3103. ;;
  3104. *)
  3105. cf_format=no
  3106. cf_inboth=no
  3107. ;;
  3108. esac
  3109. test ! -d man && mkdir man
  3110. cf_so_strip=
  3111. cf_compress=
  3112. case "$MANPAGE_FORMAT" in #(vi
  3113. *compress*) #(vi
  3114. cf_so_strip="Z"
  3115. cf_compress=compress
  3116. ;;
  3117. *gzip*) #(vi
  3118. cf_so_strip="gz"
  3119. cf_compress=gzip
  3120. ;;
  3121. esac
  3122. cf_edit_man=./edit_man.sh
  3123. cf_man_alias=`pwd`/man_alias.sed
  3124. cat >$cf_edit_man <<CF_EOF
  3125. #! /bin/sh
  3126. # this script is generated by the configure-script CF_MAN_PAGES macro.
  3127. prefix="$cf_prefix"
  3128. datadir="$datadir"
  3129. NCURSES_MAJOR="$NCURSES_MAJOR"
  3130. NCURSES_MINOR="$NCURSES_MINOR"
  3131. NCURSES_PATCH="$NCURSES_PATCH"
  3132. NCURSES_OSPEED="$NCURSES_OSPEED"
  3133. TERMINFO="$TERMINFO"
  3134. MKDIRS="sh `cd $srcdir && pwd`/mkdirs.sh"
  3135. INSTALL="$INSTALL"
  3136. INSTALL_DATA="$INSTALL_DATA"
  3137. transform="$program_transform_name"
  3138. TMP=\${TMPDIR-/tmp}/man\$\$
  3139. trap "rm -f \$TMP" 0 1 2 5 15
  3140. form=\[$]1
  3141. shift || exit 1
  3142. verb=\[$]1
  3143. shift || exit 1
  3144. mandir=\[$]1
  3145. shift || exit 1
  3146. srcdir=\[$]1
  3147. top_srcdir=\[$]srcdir/..
  3148. shift || exit 1
  3149. if test "\$form" = normal ; then
  3150. if test "$cf_format" = yes ; then
  3151. if test "$cf_inboth" = no ; then
  3152. sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
  3153. exit $?
  3154. fi
  3155. fi
  3156. cf_subdir=\$mandir/man
  3157. cf_tables=$MANPAGE_TBL
  3158. else
  3159. cf_subdir=\$mandir/cat
  3160. cf_tables=yes
  3161. fi
  3162. # process the list of source-files
  3163. for i in \[$]* ; do
  3164. case \$i in #(vi
  3165. *.orig|*.rej) ;; #(vi
  3166. *.[[0-9]]*)
  3167. section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`;
  3168. if test \$verb = installing ; then
  3169. if test ! -d \$cf_subdir\${section} ; then
  3170. \$MKDIRS \$cf_subdir\$section
  3171. fi
  3172. fi
  3173. # replace variables in man page
  3174. if test ! -f $cf_man_alias ; then
  3175. cat >>$cf_man_alias <<-CF_EOF2
  3176. s,@DATADIR@,\$datadir,g
  3177. s,@TERMINFO@,\$TERMINFO,g
  3178. s,@NCURSES_MAJOR@,\$NCURSES_MAJOR,g
  3179. s,@NCURSES_MINOR@,\$NCURSES_MINOR,g
  3180. s,@NCURSES_PATCH@,\$NCURSES_PATCH,g
  3181. s,@NCURSES_OSPEED@,\$NCURSES_OSPEED,g
  3182. CF_EOF
  3183. ifelse($1,,,[
  3184. for cf_name in $1
  3185. do
  3186. cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
  3187. cf_name=`echo $cf_name|sed "$program_transform_name"`
  3188. cat >>$cf_edit_man <<-CF_EOF
  3189. s,@$cf_NAME@,$cf_name,
  3190. CF_EOF
  3191. done
  3192. ])
  3193. cat >>$cf_edit_man <<CF_EOF
  3194. CF_EOF2
  3195. echo "...made $cf_man_alias"
  3196. fi
  3197. aliases=
  3198. cf_source=\`basename \$i\`
  3199. inalias=\$cf_source
  3200. test ! -f \$inalias && inalias="\$srcdir/\$inalias"
  3201. if test ! -f \$inalias ; then
  3202. echo .. skipped \$cf_source
  3203. continue
  3204. fi
  3205. CF_EOF
  3206. if test "$MANPAGE_ALIASES" != no ; then
  3207. cat >>$cf_edit_man <<CF_EOF
  3208. aliases=\`sed -f \$top_srcdir/man/manlinks.sed \$inalias |sed -f $cf_man_alias | sort -u\`
  3209. CF_EOF
  3210. fi
  3211. if test "$MANPAGE_RENAMES" = no ; then
  3212. cat >>$cf_edit_man <<CF_EOF
  3213. # perform program transformations for section 1 man pages
  3214. if test \$section = 1 ; then
  3215. cf_target=\$cf_subdir\${section}/\`echo \$cf_source|sed "\${transform}"\`
  3216. else
  3217. cf_target=\$cf_subdir\${section}/\$cf_source
  3218. fi
  3219. CF_EOF
  3220. else
  3221. cat >>$cf_edit_man <<CF_EOF
  3222. cf_target=\`grep "^\$cf_source" $MANPAGE_RENAMES | $AWK '{print \[$]2}'\`
  3223. if test -z "\$cf_target" ; then
  3224. echo '? missing rename for '\$cf_source
  3225. cf_target="\$cf_source"
  3226. fi
  3227. cf_target="\$cf_subdir\${section}/\${cf_target}"
  3228. CF_EOF
  3229. fi
  3230. cat >>$cf_edit_man <<CF_EOF
  3231. sed -f $cf_man_alias \\
  3232. CF_EOF
  3233. if test -f $MANPAGE_RENAMES ; then
  3234. cat >>$cf_edit_man <<CF_EOF
  3235. < \$i | sed -f `pwd`/edit_man.sed >\$TMP
  3236. CF_EOF
  3237. else
  3238. cat >>$cf_edit_man <<CF_EOF
  3239. < \$i >\$TMP
  3240. CF_EOF
  3241. fi
  3242. cat >>$cf_edit_man <<CF_EOF
  3243. if test \$cf_tables = yes ; then
  3244. tbl \$TMP >\$TMP.out
  3245. mv \$TMP.out \$TMP
  3246. fi
  3247. CF_EOF
  3248. if test $with_curses_h != yes ; then
  3249. cat >>$cf_edit_man <<CF_EOF
  3250. sed -e "/\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out
  3251. mv \$TMP.out \$TMP
  3252. CF_EOF
  3253. fi
  3254. cat >>$cf_edit_man <<CF_EOF
  3255. if test \$form = format ; then
  3256. nroff -man \$TMP >\$TMP.out
  3257. mv \$TMP.out \$TMP
  3258. fi
  3259. CF_EOF
  3260. if test -n "$cf_compress" ; then
  3261. cat >>$cf_edit_man <<CF_EOF
  3262. if test \$verb = installing ; then
  3263. if ( $cf_compress -f \$TMP )
  3264. then
  3265. mv \$TMP.$cf_so_strip \$TMP
  3266. fi
  3267. fi
  3268. cf_target="\$cf_target.$cf_so_strip"
  3269. CF_EOF
  3270. fi
  3271. case "$MANPAGE_FORMAT" in #(vi
  3272. *BSDI*)
  3273. cat >>$cf_edit_man <<CF_EOF
  3274. if test \$form = format ; then
  3275. # BSDI installs only .0 suffixes in the cat directories
  3276. cf_target="\`echo \$cf_target|sed -e 's/\.[[1-9]]\+[[a-z]]*/.0/'\`"
  3277. fi
  3278. CF_EOF
  3279. ;;
  3280. esac
  3281. cat >>$cf_edit_man <<CF_EOF
  3282. suffix=\`basename \$cf_target | sed -e 's%^[[^.]]*%%'\`
  3283. if test \$verb = installing ; then
  3284. echo \$verb \$cf_target
  3285. \$INSTALL_DATA \$TMP \$cf_target
  3286. test -d \$cf_subdir\${section} &&
  3287. test -n "\$aliases" && (
  3288. cd \$cf_subdir\${section} && (
  3289. cf_source=\`echo \$cf_target |sed -e 's%^.*/\([[^/]][[^/]]*/[[^/]][[^/]]*$\)%\1%'\`
  3290. test -n "$cf_so_strip" && cf_source=\`echo \$cf_source |sed -e 's%\.$cf_so_strip\$%%'\`
  3291. cf_target=\`basename \$cf_target\`
  3292. for cf_alias in \$aliases
  3293. do
  3294. if test \$section = 1 ; then
  3295. cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
  3296. fi
  3297. if test "$MANPAGE_SYMLINKS" = yes ; then
  3298. if test -f \$cf_alias\${suffix} ; then
  3299. if ( cmp -s \$cf_target \$cf_alias\${suffix} )
  3300. then
  3301. continue
  3302. fi
  3303. fi
  3304. echo .. \$verb alias \$cf_alias\${suffix}
  3305. rm -f \$cf_alias\${suffix}
  3306. $LN_S \$cf_target \$cf_alias\${suffix}
  3307. elif test "\$cf_target" != "\$cf_alias\${suffix}" ; then
  3308. echo ".so \$cf_source" >\$TMP
  3309. CF_EOF
  3310. if test -n "$cf_compress" ; then
  3311. cat >>$cf_edit_man <<CF_EOF
  3312. if test -n "$cf_so_strip" ; then
  3313. $cf_compress -f \$TMP
  3314. mv \$TMP.$cf_so_strip \$TMP
  3315. fi
  3316. CF_EOF
  3317. fi
  3318. cat >>$cf_edit_man <<CF_EOF
  3319. echo .. \$verb alias \$cf_alias\${suffix}
  3320. rm -f \$cf_alias\${suffix}
  3321. \$INSTALL_DATA \$TMP \$cf_alias\${suffix}
  3322. fi
  3323. done
  3324. )
  3325. )
  3326. elif test \$verb = removing ; then
  3327. test -f \$cf_target && (
  3328. echo \$verb \$cf_target
  3329. rm -f \$cf_target
  3330. )
  3331. test -d \$cf_subdir\${section} &&
  3332. test -n "\$aliases" && (
  3333. cd \$cf_subdir\${section} && (
  3334. for cf_alias in \$aliases
  3335. do
  3336. if test \$section = 1 ; then
  3337. cf_alias=\`echo \$cf_alias|sed "\${transform}"\`
  3338. fi
  3339. echo .. \$verb alias \$cf_alias\${suffix}
  3340. rm -f \$cf_alias\${suffix}
  3341. done
  3342. )
  3343. )
  3344. else
  3345. # echo ".hy 0"
  3346. cat \$TMP
  3347. fi
  3348. ;;
  3349. esac
  3350. done
  3351. if test $cf_inboth = yes ; then
  3352. if test \$form != format ; then
  3353. sh \[$]0 format \$verb \$mandir \$srcdir \[$]*
  3354. fi
  3355. fi
  3356. exit 0
  3357. CF_EOF
  3358. chmod 755 $cf_edit_man
  3359. ])dnl
  3360. dnl ---------------------------------------------------------------------------
  3361. dnl CF_MATH_LIB version: 5 updated: 2000/05/28 01:39:10
  3362. dnl -----------
  3363. dnl Checks for libraries. At least one UNIX system, Apple Macintosh
  3364. dnl Rhapsody 5.5, does not have -lm. We cannot use the simpler
  3365. dnl AC_CHECK_LIB(m,sin), because that fails for C++.
  3366. AC_DEFUN([CF_MATH_LIB],
  3367. [
  3368. AC_CACHE_CHECK(if -lm needed for math functions,
  3369. cf_cv_need_libm,[
  3370. AC_TRY_LINK([
  3371. #include <stdio.h>
  3372. #include <math.h>
  3373. ],
  3374. [double x = rand(); printf("result = %g\n", ]ifelse($2,,sin(x),$2)[)],
  3375. [cf_cv_need_libm=no],
  3376. [cf_cv_need_libm=yes])])
  3377. if test "$cf_cv_need_libm" = yes
  3378. then
  3379. ifelse($1,,[
  3380. LIBS="$LIBS -lm"
  3381. ],[$1=-lm])
  3382. fi
  3383. ])
  3384. dnl ---------------------------------------------------------------------------
  3385. dnl CF_MIXEDCASE_FILENAMES version: 3 updated: 2003/09/20 17:07:55
  3386. dnl ----------------------
  3387. dnl Check if the file-system supports mixed-case filenames. If we're able to
  3388. dnl create a lowercase name and see it as uppercase, it doesn't support that.
  3389. AC_DEFUN([CF_MIXEDCASE_FILENAMES],
  3390. [
  3391. AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[
  3392. if test "$cross_compiling" = yes ; then
  3393. case $target_alias in #(vi
  3394. *-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-mingw32*|*-uwin*) #(vi
  3395. cf_cv_mixedcase=no
  3396. ;;
  3397. *)
  3398. cf_cv_mixedcase=yes
  3399. ;;
  3400. esac
  3401. else
  3402. rm -f conftest CONFTEST
  3403. echo test >conftest
  3404. if test -f CONFTEST ; then
  3405. cf_cv_mixedcase=no
  3406. else
  3407. cf_cv_mixedcase=yes
  3408. fi
  3409. rm -f conftest CONFTEST
  3410. fi
  3411. ])
  3412. test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES)
  3413. ])dnl
  3414. dnl ---------------------------------------------------------------------------
  3415. dnl CF_MKSTEMP version: 5 updated: 2006/12/16 12:33:30
  3416. dnl ----------
  3417. dnl Check for a working mkstemp. This creates two files, checks that they are
  3418. dnl successfully created and distinct (AmigaOS apparently fails on the last).
  3419. AC_DEFUN([CF_MKSTEMP],[
  3420. AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[
  3421. rm -f conftest*
  3422. AC_TRY_RUN([
  3423. #include <sys/types.h>
  3424. #include <stdlib.h>
  3425. #include <stdio.h>
  3426. #include <string.h>
  3427. #include <sys/stat.h>
  3428. int main()
  3429. {
  3430. char *tmpl = "conftestXXXXXX";
  3431. char name[2][80];
  3432. int n;
  3433. int result = 0;
  3434. int fd;
  3435. struct stat sb;
  3436. umask(077);
  3437. for (n = 0; n < 2; ++n) {
  3438. strcpy(name[n], tmpl);
  3439. if ((fd = mkstemp(name[n])) >= 0) {
  3440. if (!strcmp(name[n], tmpl)
  3441. || stat(name[n], &sb) != 0
  3442. || (sb.st_mode & S_IFMT) != S_IFREG
  3443. || (sb.st_mode & 077) != 0) {
  3444. result = 1;
  3445. }
  3446. close(fd);
  3447. }
  3448. }
  3449. if (result == 0
  3450. && !strcmp(name[0], name[1]))
  3451. result = 1;
  3452. ${cf_cv_main_return:-return}(result);
  3453. }
  3454. ],[cf_cv_func_mkstemp=yes
  3455. ],[cf_cv_func_mkstemp=no
  3456. ],[AC_CHECK_FUNC(mkstemp)
  3457. ])
  3458. ])
  3459. if test "$cf_cv_func_mkstemp" = yes ; then
  3460. AC_DEFINE(HAVE_MKSTEMP)
  3461. fi
  3462. ])dnl
  3463. dnl ---------------------------------------------------------------------------
  3464. dnl CF_MSG_LOG version: 4 updated: 2007/07/29 09:55:12
  3465. dnl ----------
  3466. dnl Write a debug message to config.log, along with the line number in the
  3467. dnl configure script.
  3468. AC_DEFUN([CF_MSG_LOG],[
  3469. echo "${as_me-configure}:__oline__: testing $* ..." 1>&AC_FD_CC
  3470. ])dnl
  3471. dnl ---------------------------------------------------------------------------
  3472. dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49
  3473. dnl ----------------
  3474. dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and
  3475. dnl warn about this.
  3476. AC_DEFUN([CF_NCURSES_ABI_6],[
  3477. if test "${with_abi_version+set}" != set; then
  3478. case $cf_cv_rel_version in
  3479. 5.*)
  3480. cf_cv_rel_version=6.0
  3481. cf_cv_abi_version=6
  3482. AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version)
  3483. ;;
  3484. esac
  3485. fi
  3486. ])dnl
  3487. dnl ---------------------------------------------------------------------------
  3488. dnl CF_NO_LEAKS_OPTION version: 4 updated: 2006/12/16 14:24:05
  3489. dnl ------------------
  3490. dnl see CF_WITH_NO_LEAKS
  3491. AC_DEFUN([CF_NO_LEAKS_OPTION],[
  3492. AC_MSG_CHECKING(if you want to use $1 for testing)
  3493. AC_ARG_WITH($1,
  3494. [$2],
  3495. [AC_DEFINE($3)ifelse([$4],,[
  3496. $4
  3497. ])
  3498. : ${with_cflags:=-g}
  3499. : ${with_no_leaks:=yes}
  3500. with_$1=yes],
  3501. [with_$1=])
  3502. AC_MSG_RESULT(${with_$1:-no})
  3503. case .$with_cflags in #(vi
  3504. .*-g*)
  3505. case .$CFLAGS in #(vi
  3506. .*-g*) #(vi
  3507. ;;
  3508. *)
  3509. CF_ADD_CFLAGS([-g])
  3510. ;;
  3511. esac
  3512. ;;
  3513. esac
  3514. ])dnl
  3515. dnl ---------------------------------------------------------------------------
  3516. dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49
  3517. dnl ----------------
  3518. dnl Check if the given variable is a number. If not, report an error.
  3519. dnl $1 is the variable
  3520. dnl $2 is the message
  3521. AC_DEFUN([CF_NUMBER_SYNTAX],[
  3522. if test -n "$1" ; then
  3523. case $1 in #(vi
  3524. [[0-9]]*) #(vi
  3525. ;;
  3526. *)
  3527. AC_MSG_ERROR($2 is not a number: $1)
  3528. ;;
  3529. esac
  3530. else
  3531. AC_MSG_ERROR($2 value is empty)
  3532. fi
  3533. ])dnl
  3534. dnl ---------------------------------------------------------------------------
  3535. dnl CF_OBJ_SUBDIR version: 4 updated: 2002/02/23 20:38:31
  3536. dnl -------------
  3537. dnl Compute the object-directory name from the given model name
  3538. AC_DEFUN([CF_OBJ_SUBDIR],
  3539. [
  3540. case $1 in
  3541. libtool) $2='obj_lo' ;;
  3542. normal) $2='objects' ;;
  3543. debug) $2='obj_g' ;;
  3544. profile) $2='obj_p' ;;
  3545. shared)
  3546. case $cf_cv_system_name in #(vi
  3547. cygwin) #(vi
  3548. $2='objects' ;;
  3549. *)
  3550. $2='obj_s' ;;
  3551. esac
  3552. esac
  3553. ])dnl
  3554. dnl ---------------------------------------------------------------------------
  3555. dnl CF_PATHSEP version: 4 updated: 2009/01/11 20:30:23
  3556. dnl ----------
  3557. dnl Provide a value for the $PATH and similar separator
  3558. AC_DEFUN([CF_PATHSEP],
  3559. [
  3560. case $cf_cv_system_name in
  3561. os2*) PATH_SEPARATOR=';' ;;
  3562. *) PATH_SEPARATOR=':' ;;
  3563. esac
  3564. ifelse($1,,,[$1=$PATH_SEPARATOR])
  3565. AC_SUBST(PATH_SEPARATOR)
  3566. ])dnl
  3567. dnl ---------------------------------------------------------------------------
  3568. dnl CF_PATH_SYNTAX version: 12 updated: 2008/03/23 14:45:59
  3569. dnl --------------
  3570. dnl Check the argument to see that it looks like a pathname. Rewrite it if it
  3571. dnl begins with one of the prefix/exec_prefix variables, and then again if the
  3572. dnl result begins with 'NONE'. This is necessary to work around autoconf's
  3573. dnl delayed evaluation of those symbols.
  3574. AC_DEFUN([CF_PATH_SYNTAX],[
  3575. if test "x$prefix" != xNONE; then
  3576. cf_path_syntax="$prefix"
  3577. else
  3578. cf_path_syntax="$ac_default_prefix"
  3579. fi
  3580. case ".[$]$1" in #(vi
  3581. .\[$]\(*\)*|.\'*\'*) #(vi
  3582. ;;
  3583. ..|./*|.\\*) #(vi
  3584. ;;
  3585. .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
  3586. ;;
  3587. .\[$]{*prefix}*) #(vi
  3588. eval $1="[$]$1"
  3589. case ".[$]$1" in #(vi
  3590. .NONE/*)
  3591. $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
  3592. ;;
  3593. esac
  3594. ;; #(vi
  3595. .no|.NONE/*)
  3596. $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
  3597. ;;
  3598. *)
  3599. ifelse($2,,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2)
  3600. ;;
  3601. esac
  3602. ])dnl
  3603. dnl ---------------------------------------------------------------------------
  3604. dnl CF_PKG_CONFIG version: 3 updated: 2009/01/25 10:55:09
  3605. dnl -------------
  3606. dnl Check for the package-config program, unless disabled by command-line.
  3607. AC_DEFUN([CF_PKG_CONFIG],
  3608. [
  3609. AC_MSG_CHECKING(if you want to use pkg-config)
  3610. AC_ARG_WITH(pkg-config,
  3611. [ --with-pkg-config{=path} enable/disable use of pkg-config],
  3612. [cf_pkg_config=$withval],
  3613. [cf_pkg_config=yes])
  3614. AC_MSG_RESULT($cf_pkg_config)
  3615. case $cf_pkg_config in #(vi
  3616. no) #(vi
  3617. PKG_CONFIG=none
  3618. ;;
  3619. yes) #(vi
  3620. AC_PATH_PROG(PKG_CONFIG, pkg-config, none)
  3621. ;;
  3622. *)
  3623. PKG_CONFIG=$withval
  3624. ;;
  3625. esac
  3626. test -z "$PKG_CONFIG" && PKG_CONFIG=none
  3627. if test "$PKG_CONFIG" != none ; then
  3628. CF_PATH_SYNTAX(PKG_CONFIG)
  3629. fi
  3630. AC_SUBST(PKG_CONFIG)
  3631. ])dnl
  3632. dnl ---------------------------------------------------------------------------
  3633. dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
  3634. dnl -----------------
  3635. dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
  3636. dnl
  3637. dnl POSIX.1-1990 _POSIX_SOURCE
  3638. dnl POSIX.1-1990 and _POSIX_SOURCE and
  3639. dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
  3640. dnl Bindings Option
  3641. dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
  3642. dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
  3643. dnl X/Open 2000 _POSIX_C_SOURCE=200112L
  3644. dnl
  3645. dnl Parameters:
  3646. dnl $1 is the nominal value for _POSIX_C_SOURCE
  3647. AC_DEFUN([CF_POSIX_C_SOURCE],
  3648. [
  3649. cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
  3650. cf_save_CFLAGS="$CFLAGS"
  3651. cf_save_CPPFLAGS="$CPPFLAGS"
  3652. CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
  3653. CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
  3654. AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
  3655. CF_MSG_LOG(if the symbol is already defined go no further)
  3656. AC_TRY_COMPILE([#include <sys/types.h>],[
  3657. #ifndef _POSIX_C_SOURCE
  3658. make an error
  3659. #endif],
  3660. [cf_cv_posix_c_source=no],
  3661. [cf_want_posix_source=no
  3662. case .$cf_POSIX_C_SOURCE in #(vi
  3663. .[[12]]??*) #(vi
  3664. cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
  3665. ;;
  3666. .2) #(vi
  3667. cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
  3668. cf_want_posix_source=yes
  3669. ;;
  3670. .*)
  3671. cf_want_posix_source=yes
  3672. ;;
  3673. esac
  3674. if test "$cf_want_posix_source" = yes ; then
  3675. AC_TRY_COMPILE([#include <sys/types.h>],[
  3676. #ifdef _POSIX_SOURCE
  3677. make an error
  3678. #endif],[],
  3679. cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
  3680. fi
  3681. CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
  3682. CFLAGS="$cf_trim_CFLAGS"
  3683. CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
  3684. CF_MSG_LOG(if the second compile does not leave our definition intact error)
  3685. AC_TRY_COMPILE([#include <sys/types.h>],[
  3686. #ifndef _POSIX_C_SOURCE
  3687. make an error
  3688. #endif],,
  3689. [cf_cv_posix_c_source=no])
  3690. CFLAGS="$cf_save_CFLAGS"
  3691. CPPFLAGS="$cf_save_CPPFLAGS"
  3692. ])
  3693. ])
  3694. if test "$cf_cv_posix_c_source" != no ; then
  3695. CFLAGS="$cf_trim_CFLAGS"
  3696. CPPFLAGS="$cf_trim_CPPFLAGS"
  3697. if test "$cf_cv_cc_u_d_options" = yes ; then
  3698. cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
  3699. sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
  3700. CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
  3701. fi
  3702. CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
  3703. fi
  3704. ])dnl
  3705. dnl ---------------------------------------------------------------------------
  3706. dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56
  3707. dnl ------------
  3708. dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles.
  3709. dnl
  3710. dnl $1 = symbol to test
  3711. dnl $2 = value (if any) to use for a predefinition
  3712. AC_DEFUN([CF_PREDEFINE],
  3713. [
  3714. AC_MSG_CHECKING(if we must define $1)
  3715. AC_TRY_COMPILE([#include <sys/types.h>
  3716. ],[
  3717. #ifndef $1
  3718. make an error
  3719. #endif],[cf_result=no],[cf_result=yes])
  3720. AC_MSG_RESULT($cf_result)
  3721. if test "$cf_result" = yes ; then
  3722. CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])"
  3723. elif test "x$2" != "x" ; then
  3724. AC_MSG_CHECKING(checking for compatible value versus $2)
  3725. AC_TRY_COMPILE([#include <sys/types.h>
  3726. ],[
  3727. #if $1-$2 < 0
  3728. make an error
  3729. #endif],[cf_result=yes],[cf_result=no])
  3730. AC_MSG_RESULT($cf_result)
  3731. if test "$cf_result" = no ; then
  3732. # perhaps we can override it - try...
  3733. CPPFLAGS="$CPPFLAGS -D$1=$2"
  3734. fi
  3735. fi
  3736. ])dnl
  3737. dnl ---------------------------------------------------------------------------
  3738. dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08
  3739. dnl ------------
  3740. dnl Append definitions and rules for the given programs to the subdirectory
  3741. dnl Makefiles, and the recursion rule for the top-level Makefile.
  3742. dnl
  3743. dnl parameters
  3744. dnl $1 = script to run
  3745. dnl $2 = list of subdirectories
  3746. dnl
  3747. dnl variables
  3748. dnl $AWK
  3749. AC_DEFUN([CF_PRG_RULES],
  3750. [
  3751. for cf_dir in $2
  3752. do
  3753. if test ! -d $srcdir/$cf_dir; then
  3754. continue
  3755. elif test -f $srcdir/$cf_dir/programs; then
  3756. $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile
  3757. fi
  3758. done
  3759. ])dnl
  3760. dnl ---------------------------------------------------------------------------
  3761. dnl CF_PROG_AR version: 1 updated: 2009/01/01 20:15:22
  3762. dnl ----------
  3763. dnl Check for archiver "ar".
  3764. AC_DEFUN([CF_PROG_AR],[
  3765. AC_CHECK_TOOL(AR, ar, ar)
  3766. ])
  3767. dnl ---------------------------------------------------------------------------
  3768. dnl CF_PROG_AWK version: 1 updated: 2006/09/16 11:40:59
  3769. dnl -----------
  3770. dnl Check for awk, ensure that the check found something.
  3771. AC_DEFUN([CF_PROG_AWK],
  3772. [
  3773. AC_PROG_AWK
  3774. test -z "$AWK" && AC_MSG_ERROR(No awk program found)
  3775. ])dnl
  3776. dnl ---------------------------------------------------------------------------
  3777. dnl CF_PROG_CC_C_O version: 2 updated: 2006/12/16 15:55:46
  3778. dnl --------------
  3779. dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that
  3780. dnl the output file can be renamed, and allows for a shell variable that can
  3781. dnl be used later. The parameter is either CC or CXX. The result is the
  3782. dnl cache variable:
  3783. dnl $cf_cv_prog_CC_c_o
  3784. dnl $cf_cv_prog_CXX_c_o
  3785. AC_DEFUN([CF_PROG_CC_C_O],
  3786. [AC_REQUIRE([AC_PROG_CC])dnl
  3787. AC_MSG_CHECKING([whether [$]$1 understands -c and -o together])
  3788. AC_CACHE_VAL(cf_cv_prog_$1_c_o,
  3789. [
  3790. cat > conftest.$ac_ext <<CF_EOF
  3791. #include <stdio.h>
  3792. int main()
  3793. {
  3794. ${cf_cv_main_return:-return}(0);
  3795. }
  3796. CF_EOF
  3797. # We do the test twice because some compilers refuse to overwrite an
  3798. # existing .o file with -o, though they will create one.
  3799. ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC'
  3800. if AC_TRY_EVAL(ac_try) &&
  3801. test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try);
  3802. then
  3803. eval cf_cv_prog_$1_c_o=yes
  3804. else
  3805. eval cf_cv_prog_$1_c_o=no
  3806. fi
  3807. rm -f conftest*
  3808. ])dnl
  3809. if test $cf_cv_prog_$1_c_o = yes; then
  3810. AC_MSG_RESULT([yes])
  3811. else
  3812. AC_MSG_RESULT([no])
  3813. fi
  3814. ])dnl
  3815. dnl ---------------------------------------------------------------------------
  3816. dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
  3817. dnl --------------
  3818. dnl Check if C (preprocessor) -U and -D options are processed in the order
  3819. dnl given rather than by type of option. Some compilers insist on apply all
  3820. dnl of the -U options after all of the -D options. Others allow mixing them,
  3821. dnl and may predefine symbols that conflict with those we define.
  3822. AC_DEFUN([CF_PROG_CC_U_D],
  3823. [
  3824. AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
  3825. cf_save_CPPFLAGS="$CPPFLAGS"
  3826. CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
  3827. AC_TRY_COMPILE([],[
  3828. #ifndef U_D_OPTIONS
  3829. make an undefined-error
  3830. #endif
  3831. #ifdef D_U_OPTIONS
  3832. make a defined-error
  3833. #endif
  3834. ],[
  3835. cf_cv_cc_u_d_options=yes],[
  3836. cf_cv_cc_u_d_options=no])
  3837. CPPFLAGS="$cf_save_CPPFLAGS"
  3838. ])
  3839. ])dnl
  3840. dnl ---------------------------------------------------------------------------
  3841. dnl CF_PROG_EGREP version: 1 updated: 2006/09/16 11:40:59
  3842. dnl -------------
  3843. dnl AC_PROG_EGREP was introduced in autoconf 2.53.
  3844. dnl This macro adds a check to ensure the script found something.
  3845. AC_DEFUN([CF_PROG_EGREP],
  3846. [AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
  3847. [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
  3848. then ac_cv_prog_egrep='grep -E'
  3849. else ac_cv_prog_egrep='egrep'
  3850. fi])
  3851. EGREP=$ac_cv_prog_egrep
  3852. AC_SUBST([EGREP])
  3853. test -z "$EGREP" && AC_MSG_ERROR(No egrep program found)
  3854. ])dnl
  3855. dnl ---------------------------------------------------------------------------
  3856. dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
  3857. dnl -----------
  3858. dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
  3859. AC_DEFUN([CF_PROG_EXT],
  3860. [
  3861. AC_REQUIRE([CF_CHECK_CACHE])
  3862. case $cf_cv_system_name in
  3863. os2*)
  3864. CFLAGS="$CFLAGS -Zmt"
  3865. CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
  3866. CXXFLAGS="$CXXFLAGS -Zmt"
  3867. # autoconf's macro sets -Zexe and suffix both, which conflict:w
  3868. LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
  3869. ac_cv_exeext=.exe
  3870. ;;
  3871. esac
  3872. AC_EXEEXT
  3873. AC_OBJEXT
  3874. PROG_EXT="$EXEEXT"
  3875. AC_SUBST(PROG_EXT)
  3876. test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
  3877. ])dnl
  3878. dnl ---------------------------------------------------------------------------
  3879. dnl CF_PROG_INSTALL version: 5 updated: 2002/12/21 22:46:07
  3880. dnl ---------------
  3881. dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the
  3882. dnl misc/tabset install won't work properly. Usually this happens only when
  3883. dnl using the fallback mkinstalldirs script
  3884. AC_DEFUN([CF_PROG_INSTALL],
  3885. [AC_PROG_INSTALL
  3886. case $INSTALL in
  3887. /*)
  3888. ;;
  3889. *)
  3890. CF_DIRNAME(cf_dir,$INSTALL)
  3891. test -z "$cf_dir" && cf_dir=.
  3892. INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'`
  3893. ;;
  3894. esac
  3895. ])dnl
  3896. dnl ---------------------------------------------------------------------------
  3897. dnl CF_PROG_LDCONFIG version: 2 updated: 2008/12/13 14:08:40
  3898. dnl ----------------
  3899. dnl Check for ldconfig, needed to fixup shared libraries that would be built
  3900. dnl and then used in the install.
  3901. AC_DEFUN([CF_PROG_LDCONFIG],[
  3902. if test "$cross_compiling" = yes ; then
  3903. LDCONFIG=:
  3904. else
  3905. case "$cf_cv_system_name" in #(vi
  3906. dragonfly*|freebsd*) #(vi
  3907. test -z "$LDCONFIG" && LDCONFIG="/sbin/ldconfig -R"
  3908. ;;
  3909. *) LDPATH=$PATH:/sbin:/usr/sbin
  3910. AC_PATH_PROG(LDCONFIG,ldconfig,,$LDPATH)
  3911. ;;
  3912. esac
  3913. fi
  3914. AC_SUBST(LDCONFIG)
  3915. ])dnl
  3916. dnl ---------------------------------------------------------------------------
  3917. dnl CF_PROG_LINT version: 1 updated: 2006/09/16 11:40:59
  3918. dnl ------------
  3919. AC_DEFUN([CF_PROG_LINT],
  3920. [
  3921. AC_CHECK_PROGS(LINT, tdlint lint alint)
  3922. AC_SUBST(LINT_OPTS)
  3923. ])dnl
  3924. dnl ---------------------------------------------------------------------------
  3925. dnl CF_REGEX version: 3 updated: 1997/11/01 14:26:01
  3926. dnl --------
  3927. dnl Attempt to determine if we've got one of the flavors of regular-expression
  3928. dnl code that we can support.
  3929. AC_DEFUN([CF_REGEX],
  3930. [
  3931. AC_MSG_CHECKING([for regular-expression headers])
  3932. AC_CACHE_VAL(cf_cv_regex,[
  3933. AC_TRY_LINK([#include <sys/types.h>
  3934. #include <regex.h>],[
  3935. regex_t *p;
  3936. int x = regcomp(p, "", 0);
  3937. int y = regexec(p, "", 0, 0, 0);
  3938. regfree(p);
  3939. ],[cf_cv_regex="regex.h"],[
  3940. AC_TRY_LINK([#include <regexp.h>],[
  3941. char *p = compile("", "", "", 0);
  3942. int x = step("", "");
  3943. ],[cf_cv_regex="regexp.h"],[
  3944. cf_save_LIBS="$LIBS"
  3945. LIBS="-lgen $LIBS"
  3946. AC_TRY_LINK([#include <regexpr.h>],[
  3947. char *p = compile("", "", "");
  3948. int x = step("", "");
  3949. ],[cf_cv_regex="regexpr.h"],[LIBS="$cf_save_LIBS"])])])
  3950. ])
  3951. AC_MSG_RESULT($cf_cv_regex)
  3952. case $cf_cv_regex in
  3953. regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS) ;;
  3954. regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS) ;;
  3955. regexpr.h) AC_DEFINE(HAVE_REGEXPR_H_FUNCS) ;;
  3956. esac
  3957. ])dnl
  3958. dnl ---------------------------------------------------------------------------
  3959. dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
  3960. dnl ----------------
  3961. dnl Remove all -U and -D options that refer to the given symbol from a list
  3962. dnl of C compiler options. This works around the problem that not all
  3963. dnl compilers process -U and -D options from left-to-right, so a -U option
  3964. dnl cannot be used to cancel the effect of a preceding -D option.
  3965. dnl
  3966. dnl $1 = target (which could be the same as the source variable)
  3967. dnl $2 = source (including '$')
  3968. dnl $3 = symbol to remove
  3969. define([CF_REMOVE_DEFINE],
  3970. [
  3971. # remove $3 symbol from $2
  3972. $1=`echo "$2" | \
  3973. sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
  3974. -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
  3975. ])dnl
  3976. dnl ---------------------------------------------------------------------------
  3977. dnl CF_REMOVE_LIB version: 1 updated: 2007/02/17 14:11:52
  3978. dnl -------------
  3979. dnl Remove the given library from the symbol
  3980. dnl
  3981. dnl $1 = target (which could be the same as the source variable)
  3982. dnl $2 = source (including '$')
  3983. dnl $3 = library to remove
  3984. define([CF_REMOVE_LIB],
  3985. [
  3986. # remove $3 library from $2
  3987. $1=`echo "$2" | sed -e 's/-l$3[[ ]]//g' -e 's/-l$3[$]//'`
  3988. ])dnl
  3989. dnl ---------------------------------------------------------------------------
  3990. dnl CF_RPATH_HACK version: 4 updated: 2008/09/13 12:53:26
  3991. dnl -------------
  3992. AC_DEFUN([CF_RPATH_HACK],
  3993. [
  3994. AC_REQUIRE([CF_SHARED_OPTS])
  3995. AC_MSG_CHECKING(for updated LDFLAGS)
  3996. if test -n "$LDFLAGS" ; then
  3997. AC_MSG_RESULT(maybe)
  3998. CF_VERBOSE(...checking LDFLAGS $LDFLAGS)
  3999. CF_VERBOSE(...checking EXTRA_LDFLAGS $EXTRA_LDFLAGS)
  4000. case "$EXTRA_LDFLAGS" in #(vi
  4001. -Wl,-rpath,*) #(vi
  4002. cf_rpath_hack="-Wl,-rpath,"
  4003. ;;
  4004. -R\ *)
  4005. cf_rpath_hack="-R "
  4006. ;;
  4007. -R*)
  4008. cf_rpath_hack="-R"
  4009. ;;
  4010. *)
  4011. cf_rpath_hack=
  4012. ;;
  4013. esac
  4014. if test -n "$cf_rpath_hack" ; then
  4015. cf_rpath_dst=
  4016. for cf_rpath_src in $LDFLAGS
  4017. do
  4018. CF_VERBOSE(Filtering $cf_rpath_src)
  4019. case $cf_rpath_src in #(vi
  4020. -L*) #(vi
  4021. if test "$cf_rpath_hack" = "-R " ; then
  4022. cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e 's%-L%-R %'`
  4023. else
  4024. cf_rpath_tmp=`echo "$cf_rpath_src" |sed -e s%-L%$cf_rpath_hack%`
  4025. fi
  4026. CF_VERBOSE(...Filter $cf_rpath_tmp)
  4027. EXTRA_LDFLAGS="$cf_rpath_tmp $EXTRA_LDFLAGS"
  4028. ;;
  4029. esac
  4030. cf_rpath_dst="$cf_rpath_dst $cf_rpath_src"
  4031. done
  4032. LDFLAGS=$cf_rpath_dst
  4033. CF_VERBOSE(...checked LDFLAGS $LDFLAGS)
  4034. CF_VERBOSE(...checked EXTRA_LDFLAGS $EXTRA_LDFLAGS)
  4035. fi
  4036. else
  4037. AC_MSG_RESULT(no)
  4038. fi
  4039. ])dnl
  4040. dnl ---------------------------------------------------------------------------
  4041. dnl CF_SHARED_OPTS version: 57 updated: 2009/01/17 16:10:05
  4042. dnl --------------
  4043. dnl --------------
  4044. dnl Attempt to determine the appropriate CC/LD options for creating a shared
  4045. dnl library.
  4046. dnl
  4047. dnl Note: ${LOCAL_LDFLAGS} is used to link executables that will run within the
  4048. dnl build-tree, i.e., by making use of the libraries that are compiled in ../lib
  4049. dnl We avoid compiling-in a ../lib path for the shared library since that can
  4050. dnl lead to unexpected results at runtime.
  4051. dnl ${LOCAL_LDFLAGS2} has the same intention but assumes that the shared libraries
  4052. dnl are compiled in ../../lib
  4053. dnl
  4054. dnl The variable 'cf_cv_do_symlinks' is used to control whether we configure
  4055. dnl to install symbolic links to the rel/abi versions of shared libraries.
  4056. dnl
  4057. dnl The variable 'cf_cv_shlib_version' controls whether we use the rel or abi
  4058. dnl version when making symbolic links.
  4059. dnl
  4060. dnl The variable 'cf_cv_shlib_version_infix' controls whether shared library
  4061. dnl version numbers are infix (ex: libncurses.<ver>.dylib) or postfix
  4062. dnl (ex: libncurses.so.<ver>).
  4063. dnl
  4064. dnl Some loaders leave 'so_locations' lying around. It's nice to clean up.
  4065. AC_DEFUN([CF_SHARED_OPTS],
  4066. [
  4067. AC_REQUIRE([CF_SUBST_NCURSES_VERSION])
  4068. LOCAL_LDFLAGS=
  4069. LOCAL_LDFLAGS2=
  4070. LD_RPATH_OPT=
  4071. LD_SHARED_OPTS=
  4072. INSTALL_LIB="-m 644"
  4073. cf_cv_do_symlinks=no
  4074. AC_MSG_CHECKING(if release/abi version should be used for shared libs)
  4075. AC_ARG_WITH(shlib-version,
  4076. [ --with-shlib-version=X Specify rel or abi version for shared libs],
  4077. [test -z "$withval" && withval=auto
  4078. case $withval in #(vi
  4079. yes) #(vi
  4080. cf_cv_shlib_version=auto
  4081. ;;
  4082. rel|abi|auto|no) #(vi
  4083. cf_cv_shlib_version=$withval
  4084. ;;
  4085. *)
  4086. AC_MSG_ERROR([option value must be one of: rel, abi, auto or no])
  4087. ;;
  4088. esac
  4089. ],[cf_cv_shlib_version=auto])
  4090. AC_MSG_RESULT($cf_cv_shlib_version)
  4091. cf_cv_rm_so_locs=no
  4092. # Some less-capable ports of gcc support only -fpic
  4093. CC_SHARED_OPTS=
  4094. if test "$GCC" = yes
  4095. then
  4096. AC_MSG_CHECKING(which $CC option to use)
  4097. cf_save_CFLAGS="$CFLAGS"
  4098. for CC_SHARED_OPTS in -fPIC -fpic ''
  4099. do
  4100. CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS"
  4101. AC_TRY_COMPILE([#include <stdio.h>],[int x = 1],[break],[])
  4102. done
  4103. AC_MSG_RESULT($CC_SHARED_OPTS)
  4104. CFLAGS="$cf_save_CFLAGS"
  4105. fi
  4106. cf_cv_shlib_version_infix=no
  4107. case $cf_cv_system_name in
  4108. aix[[56]]*)
  4109. if test "$GCC" = yes; then
  4110. CC_SHARED_OPTS=
  4111. MK_SHARED_LIB="$(CC) -shared"
  4112. fi
  4113. ;;
  4114. beos*)
  4115. MK_SHARED_LIB='${CC} ${CFLAGS} -o $[@] -Xlinker -soname=`basename $[@]` -nostart -e 0'
  4116. ;;
  4117. cygwin*)
  4118. CC_SHARED_OPTS=
  4119. MK_SHARED_LIB='sh ../mk_shared_lib.sh [$]@ [$]{CC} [$]{CFLAGS}'
  4120. cf_cv_shlib_version=cygdll
  4121. cf_cv_shlib_version_infix=cygdll
  4122. cat >mk_shared_lib.sh <<-CF_EOF
  4123. #!/bin/sh
  4124. SHARED_LIB=\[$]1
  4125. IMPORT_LIB=\`echo "\[$]1" | sed -e 's/cyg/lib/' -e 's/[[0-9]]*\.dll[$]/.dll.a/'\`
  4126. shift
  4127. cat <<-EOF
  4128. Linking shared library
  4129. ** SHARED_LIB \[$]SHARED_LIB
  4130. ** IMPORT_LIB \[$]IMPORT_LIB
  4131. EOF
  4132. exec \[$]* -shared -Wl,--out-implib=../lib/\[$]{IMPORT_LIB} -Wl,--export-all-symbols -o ../lib/\[$]{SHARED_LIB}
  4133. CF_EOF
  4134. chmod +x mk_shared_lib.sh
  4135. ;;
  4136. darwin*)
  4137. EXTRA_CFLAGS="-no-cpp-precomp"
  4138. CC_SHARED_OPTS="-dynamic"
  4139. MK_SHARED_LIB='${CC} ${CFLAGS} -dynamiclib -install_name ${libdir}/`basename $[@]` -compatibility_version ${ABI_VERSION} -current_version ${ABI_VERSION} -o $[@]'
  4140. test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=abi
  4141. cf_cv_shlib_version_infix=yes
  4142. AC_CACHE_CHECK([if ld -search_paths_first works], cf_cv_ldflags_search_paths_first, [
  4143. cf_save_LDFLAGS=$LDFLAGS
  4144. LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  4145. AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no)
  4146. LDFLAGS=$cf_save_LDFLAGS])
  4147. if test $cf_cv_ldflags_search_paths_first = yes; then
  4148. LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
  4149. fi
  4150. ;;
  4151. hpux*)
  4152. # (tested with gcc 2.7.2 -- I don't have c89)
  4153. if test "$GCC" = yes; then
  4154. LD_SHARED_OPTS='-Xlinker +b -Xlinker ${libdir}'
  4155. else
  4156. CC_SHARED_OPTS='+Z'
  4157. LD_SHARED_OPTS='-Wl,+b,${libdir}'
  4158. fi
  4159. MK_SHARED_LIB='${LD} +b ${libdir} -b -o $[@]'
  4160. # HP-UX shared libraries must be executable, and should be
  4161. # readonly to exploit a quirk in the memory manager.
  4162. INSTALL_LIB="-m 555"
  4163. ;;
  4164. irix*)
  4165. if test "$cf_cv_ld_rpath" = yes ; then
  4166. if test "$GCC" = yes; then
  4167. LD_RPATH_OPT="-Wl,-rpath,"
  4168. EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
  4169. else
  4170. LD_RPATH_OPT="-rpath "
  4171. EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS"
  4172. fi
  4173. fi
  4174. # tested with IRIX 5.2 and 'cc'.
  4175. if test "$GCC" != yes; then
  4176. CC_SHARED_OPTS='-KPIC'
  4177. MK_SHARED_LIB='${CC} -shared -rdata_shared -soname `basename $[@]` -o $[@]'
  4178. else
  4179. MK_SHARED_LIB='${CC} -shared -Wl,-soname,`basename $[@]` -o $[@]'
  4180. fi
  4181. cf_cv_rm_so_locs=yes
  4182. ;;
  4183. linux*|gnu*|k*bsd*-gnu)
  4184. if test "$DFT_LWR_MODEL" = "shared" ; then
  4185. LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
  4186. LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
  4187. fi
  4188. if test "$cf_cv_ld_rpath" = yes ; then
  4189. LD_RPATH_OPT="-Wl,-rpath,"
  4190. EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
  4191. fi
  4192. CF_SHARED_SONAME
  4193. MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
  4194. ;;
  4195. openbsd[[2-9]].*)
  4196. if test "$DFT_LWR_MODEL" = "shared" ; then
  4197. LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
  4198. LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
  4199. fi
  4200. if test "$cf_cv_ld_rpath" = yes ; then
  4201. LD_RPATH_OPT="-Wl,-rpath,"
  4202. EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
  4203. fi
  4204. CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
  4205. CF_SHARED_SONAME
  4206. MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]'
  4207. ;;
  4208. nto-qnx*|openbsd*|freebsd[[12]].*)
  4209. CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
  4210. MK_SHARED_LIB='${LD} -Bshareable -o $[@]'
  4211. test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
  4212. ;;
  4213. freebsd*)
  4214. CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
  4215. if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
  4216. LOCAL_LDFLAGS="-rpath \$(LOCAL_LIBDIR)"
  4217. LOCAL_LDFLAGS2="-rpath \${libdir} $LOCAL_LDFLAGS"
  4218. LD_RPATH_OPT="-rpath "
  4219. EXTRA_LDFLAGS="-rpath \${libdir} $EXTRA_LDFLAGS"
  4220. fi
  4221. CF_SHARED_SONAME
  4222. MK_SHARED_LIB='${LD} -shared -Bshareable -soname=`basename $[@]` -o $[@]'
  4223. ;;
  4224. netbsd*)
  4225. CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC"
  4226. test "$cf_cv_ld_rpath" = yes && LD_RPATH_OPT="-Wl,-rpath,"
  4227. if test "$DFT_LWR_MODEL" = "shared" && test "$cf_cv_ld_rpath" = yes ; then
  4228. LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
  4229. LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
  4230. EXTRA_LDFLAGS="-Wl,-rpath,\${libdir} $EXTRA_LDFLAGS"
  4231. if test "$cf_cv_shlib_version" = auto; then
  4232. if test -f /usr/libexec/ld.elf_so; then
  4233. cf_cv_shlib_version=abi
  4234. else
  4235. cf_cv_shlib_version=rel
  4236. fi
  4237. fi
  4238. CF_SHARED_SONAME
  4239. MK_SHARED_LIB='${CC} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]'
  4240. else
  4241. MK_SHARED_LIB='${LD} -shared -Bshareable -o $[@]'
  4242. fi
  4243. ;;
  4244. osf*|mls+*)
  4245. # tested with OSF/1 V3.2 and 'cc'
  4246. # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't
  4247. # link with shared libs).
  4248. MK_SHARED_LIB='${LD} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`'
  4249. case $host_os in
  4250. osf4*)
  4251. MK_SHARED_LIB="${MK_SHARED_LIB} -msym"
  4252. ;;
  4253. esac
  4254. MK_SHARED_LIB="${MK_SHARED_LIB}"' -o $[@]'
  4255. if test "$DFT_LWR_MODEL" = "shared" ; then
  4256. LOCAL_LDFLAGS="-Wl,-rpath,\$(LOCAL_LIBDIR)"
  4257. LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
  4258. fi
  4259. if test "$cf_cv_ld_rpath" = yes ; then
  4260. LD_RPATH_OPT="-rpath"
  4261. # EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
  4262. fi
  4263. cf_cv_rm_so_locs=yes
  4264. ;;
  4265. sco3.2v5*) # (also uw2* and UW7) hops 13-Apr-98
  4266. # tested with osr5.0.5
  4267. if test "$GCC" != yes; then
  4268. CC_SHARED_OPTS='-belf -KPIC'
  4269. fi
  4270. MK_SHARED_LIB='${LD} -dy -G -h `basename $[@] .${REL_VERSION}`.${ABI_VERSION} -o [$]@'
  4271. if test "$cf_cv_ld_rpath" = yes ; then
  4272. # only way is to set LD_RUN_PATH but no switch for it
  4273. RUN_PATH=$libdir
  4274. fi
  4275. test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
  4276. LINK_PROGS='LD_RUN_PATH=${libdir}'
  4277. LINK_TESTS='Pwd=`pwd`;LD_RUN_PATH=`dirname $${Pwd}`/lib'
  4278. ;;
  4279. sunos4*)
  4280. # tested with SunOS 4.1.1 and gcc 2.7.0
  4281. if test "$GCC" != yes; then
  4282. CC_SHARED_OPTS='-KPIC'
  4283. fi
  4284. MK_SHARED_LIB='${LD} -assert pure-text -o $[@]'
  4285. test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=rel
  4286. ;;
  4287. solaris2*)
  4288. # tested with SunOS 5.5.1 (solaris 2.5.1) and gcc 2.7.2
  4289. # tested with SunOS 5.10 (solaris 10) and gcc 3.4.3
  4290. if test "$DFT_LWR_MODEL" = "shared" ; then
  4291. LOCAL_LDFLAGS="-R \$(LOCAL_LIBDIR):\${libdir}"
  4292. LOCAL_LDFLAGS2="$LOCAL_LDFLAGS"
  4293. fi
  4294. if test "$cf_cv_ld_rpath" = yes ; then
  4295. LD_RPATH_OPT="-R"
  4296. EXTRA_LDFLAGS="$LOCAL_LDFLAGS $EXTRA_LDFLAGS"
  4297. fi
  4298. CF_SHARED_SONAME
  4299. if test "$GCC" != yes; then
  4300. cf_save_CFLAGS="$CFLAGS"
  4301. for cf_shared_opts in -xcode=pic13 -xcode=pic32 -Kpic -KPIC -O
  4302. do
  4303. CFLAGS="$cf_shared_opts $cf_save_CFLAGS"
  4304. AC_TRY_COMPILE([#include <stdio.h>],[printf("Hello\n");],[break])
  4305. done
  4306. CFLAGS="$cf_save_CFLAGS"
  4307. CC_SHARED_OPTS=$cf_shared_opts
  4308. MK_SHARED_LIB='${CC} -dy -G -h '$cf_cv_shared_soname' -o $[@]'
  4309. else
  4310. MK_SHARED_LIB='${CC} -shared -dy -G -h '$cf_cv_shared_soname' -o $[@]'
  4311. fi
  4312. ;;
  4313. sysv5uw7*|unix_sv*)
  4314. # tested with UnixWare 7.1.0 (gcc 2.95.2 and cc)
  4315. if test "$GCC" != yes; then
  4316. CC_SHARED_OPTS='-KPIC'
  4317. fi
  4318. MK_SHARED_LIB='${LD} -d y -G -o [$]@'
  4319. ;;
  4320. *)
  4321. CC_SHARED_OPTS='unknown'
  4322. MK_SHARED_LIB='echo unknown'
  4323. ;;
  4324. esac
  4325. # This works if the last tokens in $MK_SHARED_LIB are the -o target.
  4326. case "$cf_cv_shlib_version" in #(vi
  4327. rel|abi)
  4328. case "$MK_SHARED_LIB" in #(vi
  4329. *'-o $[@]')
  4330. test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes
  4331. ;;
  4332. *)
  4333. AC_MSG_WARN(ignored --with-shlib-version)
  4334. ;;
  4335. esac
  4336. ;;
  4337. esac
  4338. if test -n "$LD_RPATH_OPT" ; then
  4339. AC_MSG_CHECKING(if we need a space after rpath option)
  4340. cf_save_LIBS="$LIBS"
  4341. LIBS="$LIBS ${LD_RPATH_OPT}$libdir"
  4342. AC_TRY_LINK(, , cf_rpath_space=no, cf_rpath_space=yes)
  4343. LIBS="$cf_save_LIBS"
  4344. AC_MSG_RESULT($cf_rpath_space)
  4345. test "$cf_rpath_space" = yes && LD_RPATH_OPT="$LD_RPATH_OPT "
  4346. MK_SHARED_LIB="$MK_SHARED_LIB $LD_RPATH_OPT\${libdir}"
  4347. fi
  4348. AC_SUBST(CC_SHARED_OPTS)
  4349. AC_SUBST(LD_RPATH_OPT)
  4350. AC_SUBST(LD_SHARED_OPTS)
  4351. AC_SUBST(MK_SHARED_LIB)
  4352. AC_SUBST(LINK_PROGS)
  4353. AC_SUBST(LINK_TESTS)
  4354. AC_SUBST(EXTRA_LDFLAGS)
  4355. AC_SUBST(LOCAL_LDFLAGS)
  4356. AC_SUBST(LOCAL_LDFLAGS2)
  4357. AC_SUBST(INSTALL_LIB)
  4358. ])dnl
  4359. dnl ---------------------------------------------------------------------------
  4360. dnl CF_SHARED_SONAME version: 3 updated: 2008/09/08 18:34:43
  4361. dnl ----------------
  4362. dnl utility macro for CF_SHARED_OPTS, constructs "$cf_cv_shared_soname" for
  4363. dnl substitution into MK_SHARED_LIB string for the "-soname" (or similar)
  4364. dnl option.
  4365. dnl
  4366. dnl $1 is the default that should be used for "$cf_cv_shlib_version".
  4367. dnl If missing, use "rel".
  4368. define([CF_SHARED_SONAME],
  4369. [
  4370. test "$cf_cv_shlib_version" = auto && cf_cv_shlib_version=ifelse($1,,rel,$1)
  4371. if test "$cf_cv_shlib_version" = rel; then
  4372. cf_cv_shared_soname='`basename $[@] .${REL_VERSION}`.${ABI_VERSION}'
  4373. else
  4374. cf_cv_shared_soname='`basename $[@]`'
  4375. fi
  4376. ])
  4377. dnl ---------------------------------------------------------------------------
  4378. dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
  4379. dnl -----------
  4380. dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
  4381. dnl programs need this test).
  4382. dnl
  4383. dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
  4384. dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
  4385. dnl winsize declaration is left alone - we may revisit this if Apple choose to
  4386. dnl break that part of the interface as well.
  4387. AC_DEFUN([CF_SIGWINCH],
  4388. [
  4389. AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
  4390. AC_TRY_COMPILE([
  4391. #include <sys/types.h>
  4392. #include <sys/signal.h>
  4393. ],[int x = SIGWINCH],
  4394. [cf_cv_define_sigwinch=yes],
  4395. [AC_TRY_COMPILE([
  4396. #undef _XOPEN_SOURCE
  4397. #undef _POSIX_SOURCE
  4398. #undef _POSIX_C_SOURCE
  4399. #include <sys/types.h>
  4400. #include <sys/signal.h>
  4401. ],[int x = SIGWINCH],
  4402. [cf_cv_define_sigwinch=maybe],
  4403. [cf_cv_define_sigwinch=no])
  4404. ])
  4405. ])
  4406. if test "$cf_cv_define_sigwinch" = maybe ; then
  4407. AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
  4408. cf_cv_fixup_sigwinch=unknown
  4409. cf_sigwinch=32
  4410. while test $cf_sigwinch != 1
  4411. do
  4412. AC_TRY_COMPILE([
  4413. #undef _XOPEN_SOURCE
  4414. #undef _POSIX_SOURCE
  4415. #undef _POSIX_C_SOURCE
  4416. #include <sys/types.h>
  4417. #include <sys/signal.h>
  4418. ],[
  4419. #if SIGWINCH != $cf_sigwinch
  4420. make an error
  4421. #endif
  4422. int x = SIGWINCH],
  4423. [cf_cv_fixup_sigwinch=$cf_sigwinch
  4424. break])
  4425. cf_sigwinch=`expr $cf_sigwinch - 1`
  4426. done
  4427. ])
  4428. if test "$cf_cv_fixup_sigwinch" != unknown ; then
  4429. CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
  4430. fi
  4431. fi
  4432. ])dnl
  4433. dnl ---------------------------------------------------------------------------
  4434. dnl CF_SIG_ATOMIC_T version: 2 updated: 2005/09/18 17:27:12
  4435. dnl ---------------
  4436. dnl signal handler, but there are some gcc depedencies in that recommendation.
  4437. dnl Try anyway.
  4438. AC_DEFUN([CF_SIG_ATOMIC_T],
  4439. [
  4440. AC_MSG_CHECKING(for signal global datatype)
  4441. AC_CACHE_VAL(cf_cv_sig_atomic_t,[
  4442. for cf_type in \
  4443. "volatile sig_atomic_t" \
  4444. "sig_atomic_t" \
  4445. "int"
  4446. do
  4447. AC_TRY_COMPILE([
  4448. #include <sys/types.h>
  4449. #include <signal.h>
  4450. #include <stdio.h>
  4451. extern $cf_type x;
  4452. $cf_type x;
  4453. static void handler(int sig)
  4454. {
  4455. x = 5;
  4456. }],
  4457. [signal(SIGINT, handler);
  4458. x = 1],
  4459. [cf_cv_sig_atomic_t=$cf_type],
  4460. [cf_cv_sig_atomic_t=no])
  4461. test "$cf_cv_sig_atomic_t" != no && break
  4462. done
  4463. ])
  4464. AC_MSG_RESULT($cf_cv_sig_atomic_t)
  4465. test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t)
  4466. ])dnl
  4467. dnl ---------------------------------------------------------------------------
  4468. dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
  4469. dnl -------------
  4470. dnl Check for definitions & structures needed for window size-changing
  4471. dnl FIXME: check that this works with "snake" (HP-UX 10.x)
  4472. AC_DEFUN([CF_SIZECHANGE],
  4473. [
  4474. AC_REQUIRE([CF_STRUCT_TERMIOS])
  4475. AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
  4476. cf_cv_sizechange=unknown
  4477. cf_save_CPPFLAGS="$CPPFLAGS"
  4478. for cf_opts in "" "NEED_PTEM_H"
  4479. do
  4480. CPPFLAGS="$cf_save_CPPFLAGS"
  4481. test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
  4482. AC_TRY_COMPILE([#include <sys/types.h>
  4483. #ifdef HAVE_TERMIOS_H
  4484. #include <termios.h>
  4485. #else
  4486. #ifdef HAVE_TERMIO_H
  4487. #include <termio.h>
  4488. #endif
  4489. #endif
  4490. #ifdef NEED_PTEM_H
  4491. /* This is a workaround for SCO: they neglected to define struct winsize in
  4492. * termios.h -- it's only in termio.h and ptem.h
  4493. */
  4494. #include <sys/stream.h>
  4495. #include <sys/ptem.h>
  4496. #endif
  4497. #if !defined(sun) || !defined(HAVE_TERMIOS_H)
  4498. #include <sys/ioctl.h>
  4499. #endif
  4500. ],[
  4501. #ifdef TIOCGSIZE
  4502. struct ttysize win; /* FIXME: what system is this? */
  4503. int y = win.ts_lines;
  4504. int x = win.ts_cols;
  4505. #else
  4506. #ifdef TIOCGWINSZ
  4507. struct winsize win;
  4508. int y = win.ws_row;
  4509. int x = win.ws_col;
  4510. #else
  4511. no TIOCGSIZE or TIOCGWINSZ
  4512. #endif /* TIOCGWINSZ */
  4513. #endif /* TIOCGSIZE */
  4514. ],
  4515. [cf_cv_sizechange=yes],
  4516. [cf_cv_sizechange=no])
  4517. CPPFLAGS="$cf_save_CPPFLAGS"
  4518. if test "$cf_cv_sizechange" = yes ; then
  4519. echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
  4520. test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
  4521. break
  4522. fi
  4523. done
  4524. ])
  4525. if test "$cf_cv_sizechange" != no ; then
  4526. AC_DEFINE(HAVE_SIZECHANGE)
  4527. case $cf_cv_sizechange in #(vi
  4528. NEED*)
  4529. AC_DEFINE_UNQUOTED($cf_cv_sizechange )
  4530. ;;
  4531. esac
  4532. fi
  4533. ])dnl
  4534. dnl ---------------------------------------------------------------------------
  4535. dnl CF_SRC_MODULES version: 20 updated: 2008/12/27 12:30:03
  4536. dnl --------------
  4537. dnl For each parameter, test if the source-directory exists, and if it contains
  4538. dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll
  4539. dnl use in CF_LIB_RULES.
  4540. dnl
  4541. dnl This uses the configured value to make the lists SRC_SUBDIRS and
  4542. dnl SUB_MAKEFILES which are used in the makefile-generation scheme.
  4543. AC_DEFUN([CF_SRC_MODULES],
  4544. [
  4545. AC_MSG_CHECKING(for src modules)
  4546. # dependencies and linker-arguments for test-programs
  4547. TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS"
  4548. TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2"
  4549. if test "$DFT_LWR_MODEL" = "libtool"; then
  4550. TEST_ARGS="${TEST_DEPS}"
  4551. TEST_ARG2="${TEST_DEP2}"
  4552. else
  4553. TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS"
  4554. TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2"
  4555. fi
  4556. cf_cv_src_modules=
  4557. for cf_dir in $1
  4558. do
  4559. if test -f $srcdir/$cf_dir/modules; then
  4560. # We may/may not have tack in the distribution, though the
  4561. # makefile is.
  4562. if test $cf_dir = tack ; then
  4563. if test ! -f $srcdir/${cf_dir}/${cf_dir}.h; then
  4564. continue
  4565. fi
  4566. fi
  4567. if test -z "$cf_cv_src_modules"; then
  4568. cf_cv_src_modules=$cf_dir
  4569. else
  4570. cf_cv_src_modules="$cf_cv_src_modules $cf_dir"
  4571. fi
  4572. # Make the ncurses_cfg.h file record the library interface files as
  4573. # well. These are header files that are the same name as their
  4574. # directory. Ncurses is the only library that does not follow
  4575. # that pattern.
  4576. if test $cf_dir = tack ; then
  4577. continue
  4578. elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then
  4579. CF_UPPER(cf_have_include,$cf_dir)
  4580. AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H)
  4581. AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include})
  4582. TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS"
  4583. TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2"
  4584. if test "$DFT_LWR_MODEL" = "libtool"; then
  4585. TEST_ARGS="${TEST_DEPS}"
  4586. TEST_ARG2="${TEST_DEP2}"
  4587. else
  4588. TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS"
  4589. TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2"
  4590. fi
  4591. fi
  4592. fi
  4593. done
  4594. AC_MSG_RESULT($cf_cv_src_modules)
  4595. TEST_ARGS="-L${LIB_DIR} $TEST_ARGS"
  4596. TEST_ARG2="-L${LIB_2ND} $TEST_ARG2"
  4597. AC_SUBST(TEST_ARGS)
  4598. AC_SUBST(TEST_DEPS)
  4599. AC_SUBST(TEST_ARG2)
  4600. AC_SUBST(TEST_DEP2)
  4601. SRC_SUBDIRS=
  4602. if test "x$cf_with_manpages" != xno ; then
  4603. SRC_SUBDIRS="$SRC_SUBDIRS man"
  4604. fi
  4605. SRC_SUBDIRS="$SRC_SUBDIRS include"
  4606. for cf_dir in $cf_cv_src_modules
  4607. do
  4608. SRC_SUBDIRS="$SRC_SUBDIRS $cf_dir"
  4609. done
  4610. SRC_SUBDIRS="$SRC_SUBDIRS test"
  4611. test -z "$MAKE_TERMINFO" && SRC_SUBDIRS="$SRC_SUBDIRS misc"
  4612. test "$cf_with_cxx_binding" != no && SRC_SUBDIRS="$SRC_SUBDIRS c++"
  4613. ADA_SUBDIRS=
  4614. if test "$cf_cv_prog_gnat_correct" = yes && test -f $srcdir/Ada95/Makefile.in; then
  4615. SRC_SUBDIRS="$SRC_SUBDIRS Ada95"
  4616. ADA_SUBDIRS="gen src samples"
  4617. fi
  4618. SUB_MAKEFILES=
  4619. for cf_dir in $SRC_SUBDIRS
  4620. do
  4621. SUB_MAKEFILES="$SUB_MAKEFILES $cf_dir/Makefile"
  4622. done
  4623. if test -n "$ADA_SUBDIRS"; then
  4624. for cf_dir in $ADA_SUBDIRS
  4625. do
  4626. SUB_MAKEFILES="$SUB_MAKEFILES Ada95/$cf_dir/Makefile"
  4627. done
  4628. AC_SUBST(ADA_SUBDIRS)
  4629. fi
  4630. ])dnl
  4631. dnl ---------------------------------------------------------------------------
  4632. dnl CF_STDCPP_LIBRARY version: 5 updated: 2000/08/12 23:18:52
  4633. dnl -----------------
  4634. dnl Check for -lstdc++, which is GNU's standard C++ library.
  4635. AC_DEFUN([CF_STDCPP_LIBRARY],
  4636. [
  4637. if test -n "$GXX" ; then
  4638. case $cf_cv_system_name in #(vi
  4639. os2*) #(vi
  4640. cf_stdcpp_libname=stdcpp
  4641. ;;
  4642. *)
  4643. cf_stdcpp_libname=stdc++
  4644. ;;
  4645. esac
  4646. AC_CACHE_CHECK(for library $cf_stdcpp_libname,cf_cv_libstdcpp,[
  4647. cf_save="$LIBS"
  4648. LIBS="$LIBS -l$cf_stdcpp_libname"
  4649. AC_TRY_LINK([
  4650. #include <strstream.h>],[
  4651. char buf[80];
  4652. strstreambuf foo(buf, sizeof(buf))
  4653. ],
  4654. [cf_cv_libstdcpp=yes],
  4655. [cf_cv_libstdcpp=no])
  4656. LIBS="$cf_save"
  4657. ])
  4658. test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname"
  4659. fi
  4660. ])dnl
  4661. dnl ---------------------------------------------------------------------------
  4662. dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
  4663. dnl --------------
  4664. dnl Remove "-g" option from the compiler options
  4665. AC_DEFUN([CF_STRIP_G_OPT],
  4666. [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
  4667. dnl ---------------------------------------------------------------------------
  4668. dnl CF_STRUCT_SIGACTION version: 3 updated: 2000/08/12 23:18:52
  4669. dnl -------------------
  4670. dnl Check if we need _POSIX_SOURCE defined to use struct sigaction. We'll only
  4671. dnl do this if we've found the sigaction function.
  4672. dnl
  4673. dnl If needed, define SVR4_ACTION.
  4674. AC_DEFUN([CF_STRUCT_SIGACTION],[
  4675. if test "$ac_cv_func_sigaction" = yes; then
  4676. AC_MSG_CHECKING(whether sigaction needs _POSIX_SOURCE)
  4677. AC_TRY_COMPILE([
  4678. #include <sys/types.h>
  4679. #include <signal.h>],
  4680. [struct sigaction act],
  4681. [sigact_bad=no],
  4682. [
  4683. AC_TRY_COMPILE([
  4684. #define _POSIX_SOURCE
  4685. #include <sys/types.h>
  4686. #include <signal.h>],
  4687. [struct sigaction act],
  4688. [sigact_bad=yes
  4689. AC_DEFINE(SVR4_ACTION)],
  4690. [sigact_bad=unknown])])
  4691. AC_MSG_RESULT($sigact_bad)
  4692. fi
  4693. ])dnl
  4694. dnl ---------------------------------------------------------------------------
  4695. dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
  4696. dnl -----------------
  4697. dnl Some machines require _POSIX_SOURCE to completely define struct termios.
  4698. dnl If so, define SVR4_TERMIO
  4699. AC_DEFUN([CF_STRUCT_TERMIOS],[
  4700. AC_CHECK_HEADERS( \
  4701. termio.h \
  4702. termios.h \
  4703. unistd.h \
  4704. )
  4705. if test "$ISC" = yes ; then
  4706. AC_CHECK_HEADERS( sys/termio.h )
  4707. fi
  4708. if test "$ac_cv_header_termios_h" = yes ; then
  4709. case "$CFLAGS $CPPFLAGS" in
  4710. *-D_POSIX_SOURCE*)
  4711. termios_bad=dunno ;;
  4712. *) termios_bad=maybe ;;
  4713. esac
  4714. if test "$termios_bad" = maybe ; then
  4715. AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
  4716. AC_TRY_COMPILE([#include <termios.h>],
  4717. [struct termios foo; int x = foo.c_iflag],
  4718. termios_bad=no, [
  4719. AC_TRY_COMPILE([
  4720. #define _POSIX_SOURCE
  4721. #include <termios.h>],
  4722. [struct termios foo; int x = foo.c_iflag],
  4723. termios_bad=unknown,
  4724. termios_bad=yes AC_DEFINE(SVR4_TERMIO))
  4725. ])
  4726. AC_MSG_RESULT($termios_bad)
  4727. fi
  4728. fi
  4729. ])dnl
  4730. dnl ---------------------------------------------------------------------------
  4731. dnl CF_SUBDIR_PATH version: 5 updated: 2007/07/29 09:55:12
  4732. dnl --------------
  4733. dnl Construct a search-list for a nonstandard header/lib-file
  4734. dnl $1 = the variable to return as result
  4735. dnl $2 = the package name
  4736. dnl $3 = the subdirectory, e.g., bin, include or lib
  4737. AC_DEFUN([CF_SUBDIR_PATH],
  4738. [$1=""
  4739. CF_ADD_SUBDIR_PATH($1,$2,$3,/usr,$prefix)
  4740. CF_ADD_SUBDIR_PATH($1,$2,$3,$prefix,NONE)
  4741. CF_ADD_SUBDIR_PATH($1,$2,$3,/usr/local,$prefix)
  4742. CF_ADD_SUBDIR_PATH($1,$2,$3,/opt,$prefix)
  4743. CF_ADD_SUBDIR_PATH($1,$2,$3,[$]HOME,$prefix)
  4744. ])dnl
  4745. dnl ---------------------------------------------------------------------------
  4746. dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
  4747. dnl --------
  4748. dnl Shorthand macro for substituting things that the user may override
  4749. dnl with an environment variable.
  4750. dnl
  4751. dnl $1 = long/descriptive name
  4752. dnl $2 = environment variable
  4753. dnl $3 = default value
  4754. AC_DEFUN([CF_SUBST],
  4755. [AC_CACHE_VAL(cf_cv_subst_$2,[
  4756. AC_MSG_CHECKING(for $1 (symbol $2))
  4757. CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
  4758. cf_cv_subst_$2=[$]$2
  4759. AC_MSG_RESULT([$]$2)
  4760. ])
  4761. ])dnl
  4762. dnl ---------------------------------------------------------------------------
  4763. dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
  4764. dnl -----------
  4765. dnl Shorthand macro for substituting things that the user may override
  4766. dnl with an environment variable.
  4767. dnl
  4768. dnl $1 = condition to pass to "test"
  4769. dnl $2 = environment variable
  4770. dnl $3 = value if the test succeeds
  4771. dnl $4 = value if the test fails
  4772. AC_DEFUN([CF_SUBST_IF],
  4773. [
  4774. if test $1 ; then
  4775. $2=$3
  4776. ifelse($4,,,[else
  4777. $2=$4])
  4778. fi
  4779. AC_SUBST($2)
  4780. ])dnl
  4781. dnl ---------------------------------------------------------------------------
  4782. dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59
  4783. dnl ------------------------
  4784. dnl Get the version-number for use in shared-library naming, etc.
  4785. AC_DEFUN([CF_SUBST_NCURSES_VERSION],
  4786. [
  4787. AC_REQUIRE([CF_PROG_EGREP])
  4788. NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
  4789. NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
  4790. NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`"
  4791. cf_cv_abi_version=${NCURSES_MAJOR}
  4792. cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR}
  4793. dnl Show the computed version, for logging
  4794. cf_cv_timestamp=`date`
  4795. AC_MSG_RESULT(Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp))
  4796. dnl We need these values in the generated headers
  4797. AC_SUBST(NCURSES_MAJOR)
  4798. AC_SUBST(NCURSES_MINOR)
  4799. AC_SUBST(NCURSES_PATCH)
  4800. dnl We need these values in the generated makefiles
  4801. AC_SUBST(cf_cv_rel_version)
  4802. AC_SUBST(cf_cv_abi_version)
  4803. AC_SUBST(cf_cv_builtin_bool)
  4804. AC_SUBST(cf_cv_header_stdbool_h)
  4805. AC_SUBST(cf_cv_type_of_bool)dnl
  4806. ])dnl
  4807. dnl ---------------------------------------------------------------------------
  4808. dnl CF_SYS_TIME_SELECT version: 4 updated: 2000/10/04 09:18:40
  4809. dnl ------------------
  4810. dnl Check if we can include <sys/time.h> with <sys/select.h>; this breaks on
  4811. dnl older SCO configurations.
  4812. AC_DEFUN([CF_SYS_TIME_SELECT],
  4813. [
  4814. AC_MSG_CHECKING(if sys/time.h works with sys/select.h)
  4815. AC_CACHE_VAL(cf_cv_sys_time_select,[
  4816. AC_TRY_COMPILE([
  4817. #include <sys/types.h>
  4818. #ifdef HAVE_SYS_TIME_H
  4819. #include <sys/time.h>
  4820. #endif
  4821. #ifdef HAVE_SYS_SELECT_H
  4822. #include <sys/select.h>
  4823. #endif
  4824. ],[],[cf_cv_sys_time_select=yes],
  4825. [cf_cv_sys_time_select=no])
  4826. ])
  4827. AC_MSG_RESULT($cf_cv_sys_time_select)
  4828. test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT)
  4829. ])dnl
  4830. dnl ---------------------------------------------------------------------------
  4831. dnl CF_TOP_BUILDDIR version: 1 updated: 2006/10/15 16:33:23
  4832. dnl ---------------
  4833. dnl Define a top_builddir symbol, for applications that need an absolute path.
  4834. AC_DEFUN([CF_TOP_BUILDDIR],
  4835. [
  4836. top_builddir=`pwd`
  4837. AC_SUBST(top_builddir)
  4838. ])dnl
  4839. dnl ---------------------------------------------------------------------------
  4840. dnl CF_TYPEOF_CHTYPE version: 8 updated: 2006/12/16 12:33:30
  4841. dnl ----------------
  4842. dnl Determine the type we should use for chtype (and attr_t, which is treated
  4843. dnl as the same thing). We want around 32 bits, so on most machines want a
  4844. dnl long, but on newer 64-bit machines, probably want an int. If we're using
  4845. dnl wide characters, we have to have a type compatible with that, as well.
  4846. AC_DEFUN([CF_TYPEOF_CHTYPE],
  4847. [
  4848. AC_MSG_CHECKING([for type of chtype])
  4849. AC_CACHE_VAL(cf_cv_typeof_chtype,[
  4850. AC_TRY_RUN([
  4851. #define WANT_BITS 31
  4852. #include <stdio.h>
  4853. int main()
  4854. {
  4855. FILE *fp = fopen("cf_test.out", "w");
  4856. if (fp != 0) {
  4857. char *result = "long";
  4858. if (sizeof(unsigned long) > sizeof(unsigned int)) {
  4859. int n;
  4860. unsigned int x, y;
  4861. for (n = 0; n < WANT_BITS; n++) {
  4862. x = (1 << n);
  4863. y = (x >> n);
  4864. if (y != 1 || x == 0) {
  4865. x = 0;
  4866. break;
  4867. }
  4868. }
  4869. /*
  4870. * If x is nonzero, an int is big enough for the bits
  4871. * that we want.
  4872. */
  4873. result = (x != 0) ? "int" : "long";
  4874. }
  4875. fputs(result, fp);
  4876. fclose(fp);
  4877. }
  4878. ${cf_cv_main_return:-return}(0);
  4879. }
  4880. ],
  4881. [cf_cv_typeof_chtype=`cat cf_test.out`],
  4882. [cf_cv_typeof_chtype=long],
  4883. [cf_cv_typeof_chtype=long])
  4884. rm -f cf_test.out
  4885. ])
  4886. AC_MSG_RESULT($cf_cv_typeof_chtype)
  4887. AC_SUBST(cf_cv_typeof_chtype)
  4888. AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype)
  4889. ])dnl
  4890. dnl ---------------------------------------------------------------------------
  4891. dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52
  4892. dnl -----------------
  4893. dnl
  4894. AC_DEFUN([CF_TYPE_SIGACTION],
  4895. [
  4896. AC_MSG_CHECKING([for type sigaction_t])
  4897. AC_CACHE_VAL(cf_cv_type_sigaction,[
  4898. AC_TRY_COMPILE([
  4899. #include <signal.h>],
  4900. [sigaction_t x],
  4901. [cf_cv_type_sigaction=yes],
  4902. [cf_cv_type_sigaction=no])])
  4903. AC_MSG_RESULT($cf_cv_type_sigaction)
  4904. test "$cf_cv_type_sigaction" = yes && AC_DEFINE(HAVE_TYPE_SIGACTION)
  4905. ])dnl
  4906. dnl ---------------------------------------------------------------------------
  4907. dnl CF_UNSIGNED_LITERALS version: 2 updated: 1998/02/07 22:10:16
  4908. dnl --------------------
  4909. dnl Test if the compiler supports 'U' and 'L' suffixes. Only old compilers
  4910. dnl won't, but they're still there.
  4911. AC_DEFUN([CF_UNSIGNED_LITERALS],
  4912. [
  4913. AC_MSG_CHECKING([if unsigned literals are legal])
  4914. AC_CACHE_VAL(cf_cv_unsigned_literals,[
  4915. AC_TRY_COMPILE([],[long x = 1L + 1UL + 1U + 1],
  4916. [cf_cv_unsigned_literals=yes],
  4917. [cf_cv_unsigned_literals=no])
  4918. ])
  4919. AC_MSG_RESULT($cf_cv_unsigned_literals)
  4920. ])dnl
  4921. dnl ---------------------------------------------------------------------------
  4922. dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
  4923. dnl --------
  4924. dnl Make an uppercase version of a variable
  4925. dnl $1=uppercase($2)
  4926. AC_DEFUN([CF_UPPER],
  4927. [
  4928. $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
  4929. ])dnl
  4930. dnl ---------------------------------------------------------------------------
  4931. dnl CF_UTF8_LIB version: 5 updated: 2008/10/17 19:37:52
  4932. dnl -----------
  4933. dnl Check for multibyte support, and if not found, utf8 compatibility library
  4934. AC_DEFUN([CF_UTF8_LIB],
  4935. [
  4936. AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
  4937. cf_save_LIBS="$LIBS"
  4938. AC_TRY_LINK([
  4939. #include <stdlib.h>],[putwc(0,0);],
  4940. [cf_cv_utf8_lib=yes],
  4941. [CF_FIND_LINKAGE([
  4942. #include <libutf8.h>],[putwc(0,0);],utf8,
  4943. [cf_cv_utf8_lib=add-on],
  4944. [cf_cv_utf8_lib=no])
  4945. ])])
  4946. # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
  4947. # ncurses/ncursesw:
  4948. if test "$cf_cv_utf8_lib" = "add-on" ; then
  4949. AC_DEFINE(HAVE_LIBUTF8_H)
  4950. CF_ADD_INCDIR($cf_cv_header_path_utf8)
  4951. CF_ADD_LIBDIR($cf_cv_library_path_utf8)
  4952. LIBS="-lutf8 $LIBS"
  4953. fi
  4954. ])dnl
  4955. dnl ---------------------------------------------------------------------------
  4956. dnl CF_VERBOSE version: 3 updated: 2007/07/29 09:55:12
  4957. dnl ----------
  4958. dnl Use AC_VERBOSE w/o the warnings
  4959. AC_DEFUN([CF_VERBOSE],
  4960. [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
  4961. CF_MSG_LOG([$1])
  4962. ])dnl
  4963. dnl ---------------------------------------------------------------------------
  4964. dnl CF_WCHAR_TYPE version: 2 updated: 2004/01/17 19:18:20
  4965. dnl -------------
  4966. dnl Check if type wide-character type $1 is declared, and if so, which header
  4967. dnl file is needed. The second parameter is used to set a shell variable when
  4968. dnl the type is not found. The first parameter sets a shell variable for the
  4969. dnl opposite sense.
  4970. AC_DEFUN([CF_WCHAR_TYPE],
  4971. [
  4972. # This is needed on Tru64 5.0 to declare $1
  4973. AC_CACHE_CHECK(if we must include wchar.h to declare $1,cf_cv_$1,[
  4974. AC_TRY_COMPILE([
  4975. #include <stdlib.h>
  4976. #include <stdarg.h>
  4977. #include <stdio.h>
  4978. #ifdef HAVE_LIBUTF8_H
  4979. #include <libutf8.h>
  4980. #endif],
  4981. [$1 state],
  4982. [cf_cv_$1=no],
  4983. [AC_TRY_COMPILE([
  4984. #include <stdlib.h>
  4985. #include <stdarg.h>
  4986. #include <stdio.h>
  4987. #include <wchar.h>
  4988. #ifdef HAVE_LIBUTF8_H
  4989. #include <libutf8.h>
  4990. #endif],
  4991. [$1 value],
  4992. [cf_cv_$1=yes],
  4993. [cf_cv_$1=unknown])])])
  4994. if test "$cf_cv_$1" = yes ; then
  4995. AC_DEFINE(NEED_WCHAR_H)
  4996. NEED_WCHAR_H=1
  4997. fi
  4998. ifelse($2,,,[
  4999. # if we do not find $1 in either place, use substitution to provide a fallback.
  5000. if test "$cf_cv_$1" = unknown ; then
  5001. $2=1
  5002. fi
  5003. ])
  5004. ifelse($3,,,[
  5005. # if we find $1 in either place, use substitution to provide a fallback.
  5006. if test "$cf_cv_$1" != unknown ; then
  5007. $3=1
  5008. fi
  5009. ])
  5010. ])dnl
  5011. dnl ---------------------------------------------------------------------------
  5012. dnl CF_WEAK_SYMBOLS version: 1 updated: 2008/08/16 19:18:06
  5013. dnl ---------------
  5014. dnl Check for compiler-support for weak symbols.
  5015. dnl This works with "recent" gcc.
  5016. AC_DEFUN([CF_WEAK_SYMBOLS],[
  5017. AC_CACHE_CHECK(if $CC supports weak symbols,cf_cv_weak_symbols,[
  5018. AC_TRY_COMPILE([
  5019. #include <stdio.h>],
  5020. [
  5021. #if defined(__GNUC__)
  5022. # if defined __USE_ISOC99
  5023. # define _cat_pragma(exp) _Pragma(#exp)
  5024. # define _weak_pragma(exp) _cat_pragma(weak name)
  5025. # else
  5026. # define _weak_pragma(exp)
  5027. # endif
  5028. # define _declare(name) __extension__ extern __typeof__(name) name
  5029. # define weak_symbol(name) _weak_pragma(name) _declare(name) __attribute__((weak))
  5030. #endif
  5031. weak_symbol(fopen);
  5032. ],[cf_cv_weak_symbols=yes],[cf_cv_weak_symbols=no])
  5033. ])
  5034. ])dnl
  5035. dnl ---------------------------------------------------------------------------
  5036. dnl CF_WITH_ABI_VERSION version: 1 updated: 2003/09/20 18:12:49
  5037. dnl -------------------
  5038. dnl Allow library's ABI to be overridden. Generally this happens when a
  5039. dnl packager has incremented the ABI past that used in the original package,
  5040. dnl and wishes to keep doing this.
  5041. dnl
  5042. dnl $1 is the package name, if any, to derive a corresponding {package}_ABI
  5043. dnl symbol.
  5044. AC_DEFUN([CF_WITH_ABI_VERSION],[
  5045. test -z "$cf_cv_abi_version" && cf_cv_abi_version=0
  5046. AC_ARG_WITH(abi-version,
  5047. [ --with-abi-version=XXX override derived ABI version],
  5048. [AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval)
  5049. cf_cv_abi_version=$withval])
  5050. CF_NUMBER_SYNTAX($cf_cv_abi_version,ABI version)
  5051. ifelse($1,,,[
  5052. $1_ABI=$cf_cv_abi_version
  5053. ])
  5054. ])dnl
  5055. dnl ---------------------------------------------------------------------------
  5056. dnl CF_WITH_DBMALLOC version: 6 updated: 2006/12/16 14:24:05
  5057. dnl ----------------
  5058. dnl Configure-option for dbmalloc. The optional parameter is used to override
  5059. dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
  5060. AC_DEFUN([CF_WITH_DBMALLOC],[
  5061. CF_NO_LEAKS_OPTION(dbmalloc,
  5062. [ --with-dbmalloc test: use Conor Cahill's dbmalloc library],
  5063. [USE_DBMALLOC])
  5064. if test "$with_dbmalloc" = yes ; then
  5065. AC_CHECK_HEADER(dbmalloc.h,
  5066. [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))])
  5067. fi
  5068. ])dnl
  5069. dnl ---------------------------------------------------------------------------
  5070. dnl CF_WITH_DMALLOC version: 6 updated: 2006/12/16 14:24:05
  5071. dnl ---------------
  5072. dnl Configure-option for dmalloc. The optional parameter is used to override
  5073. dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests.
  5074. AC_DEFUN([CF_WITH_DMALLOC],[
  5075. CF_NO_LEAKS_OPTION(dmalloc,
  5076. [ --with-dmalloc test: use Gray Watson's dmalloc library],
  5077. [USE_DMALLOC])
  5078. if test "$with_dmalloc" = yes ; then
  5079. AC_CHECK_HEADER(dmalloc.h,
  5080. [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))])
  5081. fi
  5082. ])dnl
  5083. dnl ---------------------------------------------------------------------------
  5084. dnl CF_WITH_GPM version: 7 updated: 2008/03/23 14:48:54
  5085. dnl -----------
  5086. dnl
  5087. dnl The option parameter (if neither yes/no) is assumed to be the name of
  5088. dnl the gpm library, e.g., for dynamic loading.
  5089. AC_DEFUN([CF_WITH_GPM],
  5090. [
  5091. AC_MSG_CHECKING(if you want to link with the GPM mouse library)
  5092. AC_ARG_WITH(gpm,
  5093. [ --with-gpm use Alessandro Rubini's GPM library],
  5094. [with_gpm=$withval],
  5095. [with_gpm=maybe])
  5096. AC_MSG_RESULT($with_gpm)
  5097. if test "$with_gpm" != no ; then
  5098. AC_CHECK_HEADER(gpm.h,[
  5099. AC_DEFINE(HAVE_GPM_H)
  5100. if test "$with_gpm" != yes && test "$with_gpm" != maybe ; then
  5101. CF_VERBOSE(assuming we really have GPM library)
  5102. AC_DEFINE(HAVE_LIBGPM)
  5103. else
  5104. AC_CHECK_LIB(gpm,Gpm_Open,[:],[
  5105. AC_MSG_ERROR(Cannot link with GPM library)
  5106. fi
  5107. with_gpm=yes
  5108. ])
  5109. ],[
  5110. test "$with_gpm" != maybe && AC_MSG_WARN(Cannot find GPM header)
  5111. with_gpm=no
  5112. ])
  5113. fi
  5114. ])
  5115. dnl ---------------------------------------------------------------------------
  5116. dnl CF_WITH_LIBTOOL version: 20 updated: 2008/12/27 12:31:39
  5117. dnl ---------------
  5118. dnl Provide a configure option to incorporate libtool. Define several useful
  5119. dnl symbols for the makefile rules.
  5120. dnl
  5121. dnl The reference to AC_PROG_LIBTOOL does not normally work, since it uses
  5122. dnl macros from libtool.m4 which is in the aclocal directory of automake.
  5123. dnl Following is a simple script which turns on the AC_PROG_LIBTOOL macro.
  5124. dnl But that still does not work properly since the macro is expanded outside
  5125. dnl the CF_WITH_LIBTOOL macro:
  5126. dnl
  5127. dnl #!/bin/sh
  5128. dnl ACLOCAL=`aclocal --print-ac-dir`
  5129. dnl if test -z "$ACLOCAL" ; then
  5130. dnl echo cannot find aclocal directory
  5131. dnl exit 1
  5132. dnl elif test ! -f $ACLOCAL/libtool.m4 ; then
  5133. dnl echo cannot find libtool.m4 file
  5134. dnl exit 1
  5135. dnl fi
  5136. dnl
  5137. dnl LOCAL=aclocal.m4
  5138. dnl ORIG=aclocal.m4.orig
  5139. dnl
  5140. dnl trap "mv $ORIG $LOCAL" 0 1 2 5 15
  5141. dnl rm -f $ORIG
  5142. dnl mv $LOCAL $ORIG
  5143. dnl
  5144. dnl # sed the LIBTOOL= assignment to omit the current directory?
  5145. dnl sed -e 's/^LIBTOOL=.*/LIBTOOL=${LIBTOOL-libtool}/' $ACLOCAL/libtool.m4 >>$LOCAL
  5146. dnl cat $ORIG >>$LOCAL
  5147. dnl
  5148. dnl autoconf-257 $*
  5149. dnl
  5150. AC_DEFUN([CF_WITH_LIBTOOL],
  5151. [
  5152. ifdef([AC_PROG_LIBTOOL],,[
  5153. LIBTOOL=
  5154. ])
  5155. # common library maintenance symbols that are convenient for libtool scripts:
  5156. LIB_CREATE='${AR} -cr'
  5157. LIB_OBJECT='${OBJECTS}'
  5158. LIB_SUFFIX=.a
  5159. LIB_PREP="$RANLIB"
  5160. # symbols used to prop libtool up to enable it to determine what it should be
  5161. # doing:
  5162. LIB_CLEAN=
  5163. LIB_COMPILE=
  5164. LIB_LINK='${CC}'
  5165. LIB_INSTALL=
  5166. LIB_UNINSTALL=
  5167. AC_MSG_CHECKING(if you want to build libraries with libtool)
  5168. AC_ARG_WITH(libtool,
  5169. [ --with-libtool generate libraries with libtool],
  5170. [with_libtool=$withval],
  5171. [with_libtool=no])
  5172. AC_MSG_RESULT($with_libtool)
  5173. if test "$with_libtool" != "no"; then
  5174. ifdef([AC_PROG_LIBTOOL],[
  5175. # missing_content_AC_PROG_LIBTOOL{{
  5176. AC_PROG_LIBTOOL
  5177. # missing_content_AC_PROG_LIBTOOL}}
  5178. ],[
  5179. if test "$with_libtool" != "yes" ; then
  5180. CF_PATH_SYNTAX(with_libtool)
  5181. LIBTOOL=$with_libtool
  5182. else
  5183. AC_PATH_PROG(LIBTOOL,libtool)
  5184. fi
  5185. if test -z "$LIBTOOL" ; then
  5186. AC_MSG_ERROR(Cannot find libtool)
  5187. fi
  5188. ])dnl
  5189. LIB_CREATE='${LIBTOOL} --mode=link ${CC} -rpath ${DESTDIR}${libdir} -version-info `cut -f1 ${srcdir}/VERSION` ${LIBTOOL_OPTS} -o'
  5190. LIB_OBJECT='${OBJECTS:.o=.lo}'
  5191. LIB_SUFFIX=.la
  5192. LIB_CLEAN='${LIBTOOL} --mode=clean'
  5193. LIB_COMPILE='${LIBTOOL} --mode=compile'
  5194. LIB_LINK='${LIBTOOL} --mode=link ${CC} ${LIBTOOL_OPTS}'
  5195. LIB_INSTALL='${LIBTOOL} --mode=install'
  5196. LIB_UNINSTALL='${LIBTOOL} --mode=uninstall'
  5197. LIB_PREP=:
  5198. # Show the version of libtool
  5199. AC_MSG_CHECKING(version of libtool)
  5200. # Save the version in a cache variable - this is not entirely a good
  5201. # thing, but the version string from libtool is very ugly, and for
  5202. # bug reports it might be useful to have the original string.
  5203. cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '/^$/d' |sed -e '2,$d' -e 's/([[^)]]*)//g' -e 's/^[[^1-9]]*//' -e 's/[[^0-9.]].*//'`
  5204. AC_MSG_RESULT($cf_cv_libtool_version)
  5205. if test -z "$cf_cv_libtool_version" ; then
  5206. AC_MSG_ERROR(This is not GNU libtool)
  5207. fi
  5208. # special hack to add --tag option for C++ compiler
  5209. case $cf_cv_libtool_version in
  5210. 1.[[5-9]]*|[[2-9]]*)
  5211. LIBTOOL_CXX="$LIBTOOL --tag=CXX"
  5212. LIBTOOL="$LIBTOOL --tag=CC"
  5213. ;;
  5214. *)
  5215. LIBTOOL_CXX="$LIBTOOL"
  5216. ;;
  5217. esac
  5218. else
  5219. LIBTOOL=""
  5220. LIBTOOL_CXX=""
  5221. fi
  5222. test -z "$LIBTOOL" && ECHO_LT=
  5223. AC_SUBST(LIBTOOL)
  5224. AC_SUBST(LIBTOOL_CXX)
  5225. AC_SUBST(LIBTOOL_OPTS)
  5226. AC_SUBST(LIB_CREATE)
  5227. AC_SUBST(LIB_OBJECT)
  5228. AC_SUBST(LIB_SUFFIX)
  5229. AC_SUBST(LIB_PREP)
  5230. AC_SUBST(LIB_CLEAN)
  5231. AC_SUBST(LIB_COMPILE)
  5232. AC_SUBST(LIB_LINK)
  5233. AC_SUBST(LIB_INSTALL)
  5234. AC_SUBST(LIB_UNINSTALL)
  5235. ])dnl
  5236. dnl ---------------------------------------------------------------------------
  5237. dnl CF_WITH_PATH version: 8 updated: 2007/05/13 13:16:35
  5238. dnl ------------
  5239. dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
  5240. dnl defaulting to yes/no.
  5241. dnl
  5242. dnl $1 = option name
  5243. dnl $2 = help-text
  5244. dnl $3 = environment variable to set
  5245. dnl $4 = default value, shown in the help-message, must be a constant
  5246. dnl $5 = default value, if it's an expression & cannot be in the help-message
  5247. dnl
  5248. AC_DEFUN([CF_WITH_PATH],
  5249. [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
  5250. ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
  5251. if ifelse($5,,true,[test -n "$5"]) ; then
  5252. CF_PATH_SYNTAX(withval)
  5253. fi
  5254. $3="$withval"
  5255. AC_SUBST($3)dnl
  5256. ])dnl
  5257. dnl ---------------------------------------------------------------------------
  5258. dnl CF_WITH_PATHLIST version: 6 updated: 2009/01/11 20:30:23
  5259. dnl ----------------
  5260. dnl Process an option specifying a list of colon-separated paths.
  5261. dnl
  5262. dnl $1 = option name
  5263. dnl $2 = help-text
  5264. dnl $3 = environment variable to set
  5265. dnl $4 = default value, shown in the help-message, must be a constant
  5266. dnl $5 = default value, if it's an expression & cannot be in the help-message
  5267. dnl $6 = flag to tell if we want to define or substitute
  5268. dnl
  5269. AC_DEFUN([CF_WITH_PATHLIST],[
  5270. AC_REQUIRE([CF_PATHSEP])
  5271. AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
  5272. ifelse($4,,[withval=${$3}],[withval=${$3-ifelse($5,,$4,$5)}]))dnl
  5273. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${PATH_SEPARATOR}"
  5274. cf_dst_path=
  5275. for cf_src_path in $withval
  5276. do
  5277. CF_PATH_SYNTAX(cf_src_path)
  5278. test -n "$cf_dst_path" && cf_dst_path="${cf_dst_path}:"
  5279. cf_dst_path="${cf_dst_path}${cf_src_path}"
  5280. done
  5281. IFS="$ac_save_ifs"
  5282. ifelse($6,define,[
  5283. # Strip single quotes from the value, e.g., when it was supplied as a literal
  5284. # for $4 or $5.
  5285. case $cf_dst_path in #(vi
  5286. \'*)
  5287. cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//`
  5288. ;;
  5289. esac
  5290. cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'`
  5291. ])
  5292. eval '$3="$cf_dst_path"'
  5293. AC_SUBST($3)dnl
  5294. ])dnl
  5295. dnl ---------------------------------------------------------------------------
  5296. dnl CF_WITH_PTHREAD version: 2 updated: 2008/08/23 18:26:05
  5297. dnl ---------------
  5298. dnl Check for POSIX thread library.
  5299. AC_DEFUN([CF_WITH_PTHREAD],
  5300. [
  5301. AC_MSG_CHECKING(if you want to link with the pthread library)
  5302. AC_ARG_WITH(pthread,
  5303. [ --with-pthread use POSIX thread library],
  5304. [with_pthread=$withval],
  5305. [with_pthread=no])
  5306. AC_MSG_RESULT($with_pthread)
  5307. if test "$with_pthread" != no ; then
  5308. AC_CHECK_HEADER(pthread.h,[
  5309. AC_DEFINE(HAVE_PTHREADS_H)
  5310. AC_MSG_CHECKING(if we can link with the pthread library)
  5311. cf_save_LIBS="$LIBS"
  5312. LIBS="-lpthread $LIBS"
  5313. AC_TRY_LINK([
  5314. #include <pthread.h>
  5315. ],[
  5316. int rc = pthread_create(0,0,0,0);
  5317. ],[with_pthread=yes],[with_pthread=no])
  5318. LIBS="$cf_save_LIBS"
  5319. AC_MSG_RESULT($with_pthread)
  5320. if test "$with_pthread" = yes ; then
  5321. LIBS="-lpthread $LIBS"
  5322. AC_DEFINE(HAVE_LIBPTHREADS)
  5323. else
  5324. AC_MSG_ERROR(Cannot link with pthread library)
  5325. fi
  5326. ])
  5327. fi
  5328. ])
  5329. dnl ---------------------------------------------------------------------------
  5330. dnl CF_WITH_REL_VERSION version: 1 updated: 2003/09/20 18:12:49
  5331. dnl -------------------
  5332. dnl Allow library's release-version to be overridden. Generally this happens when a
  5333. dnl packager has incremented the release-version past that used in the original package,
  5334. dnl and wishes to keep doing this.
  5335. dnl
  5336. dnl $1 is the package name, if any, to derive corresponding {package}_MAJOR
  5337. dnl and {package}_MINOR symbols
  5338. dnl symbol.
  5339. AC_DEFUN([CF_WITH_REL_VERSION],[
  5340. test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0
  5341. AC_ARG_WITH(rel-version,
  5342. [ --with-rel-version=XXX override derived release version],
  5343. [AC_MSG_WARN(overriding release version $cf_cv_rel_version to $withval)
  5344. cf_cv_rel_version=$withval])
  5345. ifelse($1,,[
  5346. CF_NUMBER_SYNTAX($cf_cv_rel_version,Release version)
  5347. ],[
  5348. $1_MAJOR=`echo "$cf_cv_rel_version" | sed -e 's/\..*//'`
  5349. $1_MINOR=`echo "$cf_cv_rel_version" | sed -e 's/^[[^.]]*//' -e 's/^\.//' -e 's/\..*//'`
  5350. CF_NUMBER_SYNTAX([$]$1_MAJOR,Release major-version)
  5351. CF_NUMBER_SYNTAX([$]$1_MINOR,Release minor-version)
  5352. ])
  5353. ])dnl
  5354. dnl ---------------------------------------------------------------------------
  5355. dnl CF_WITH_SYSMOUSE version: 2 updated: 2003/03/22 19:13:43
  5356. dnl ----------------
  5357. dnl If we can compile with sysmouse, make it available unless it is not wanted.
  5358. AC_DEFUN([CF_WITH_SYSMOUSE],[
  5359. # not everyone has "test -c"
  5360. if test -c /dev/sysmouse 2>/dev/null ; then
  5361. AC_MSG_CHECKING(if you want to use sysmouse)
  5362. AC_ARG_WITH(sysmouse,
  5363. [ --with-sysmouse use sysmouse (FreeBSD console)],
  5364. [cf_with_sysmouse=$withval],
  5365. [cf_with_sysmouse=maybe])
  5366. if test "$cf_with_sysmouse" != no ; then
  5367. AC_TRY_COMPILE([
  5368. #include <osreldate.h>
  5369. #if (__FreeBSD_version >= 400017)
  5370. #include <sys/consio.h>
  5371. #include <sys/fbio.h>
  5372. #else
  5373. #include <machine/console.h>
  5374. #endif
  5375. ],[
  5376. struct mouse_info the_mouse;
  5377. ioctl(0, CONS_MOUSECTL, &the_mouse);
  5378. ],[cf_with_sysmouse=yes],[cf_with_sysmouse=no])
  5379. fi
  5380. AC_MSG_RESULT($cf_with_sysmouse)
  5381. test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE)
  5382. fi
  5383. ])dnl
  5384. dnl ---------------------------------------------------------------------------
  5385. dnl CF_WITH_VALGRIND version: 1 updated: 2006/12/14 18:00:21
  5386. dnl ----------------
  5387. AC_DEFUN([CF_WITH_VALGRIND],[
  5388. CF_NO_LEAKS_OPTION(valgrind,
  5389. [ --with-valgrind test: use valgrind],
  5390. [USE_VALGRIND])
  5391. ])dnl
  5392. dnl ---------------------------------------------------------------------------
  5393. dnl CF_XOPEN_SOURCE version: 28 updated: 2008/12/27 12:30:03
  5394. dnl ---------------
  5395. dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
  5396. dnl or adapt to the vendor's definitions to get equivalent functionality,
  5397. dnl without losing the common non-POSIX features.
  5398. dnl
  5399. dnl Parameters:
  5400. dnl $1 is the nominal value for _XOPEN_SOURCE
  5401. dnl $2 is the nominal value for _POSIX_C_SOURCE
  5402. AC_DEFUN([CF_XOPEN_SOURCE],[
  5403. AC_REQUIRE([CF_PROG_CC_U_D])
  5404. cf_XOPEN_SOURCE=ifelse($1,,500,$1)
  5405. cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
  5406. case $host_os in #(vi
  5407. aix[[456]]*) #(vi
  5408. CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
  5409. ;;
  5410. freebsd*|dragonfly*) #(vi
  5411. # 5.x headers associate
  5412. # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
  5413. # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
  5414. cf_POSIX_C_SOURCE=200112L
  5415. cf_XOPEN_SOURCE=600
  5416. CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
  5417. ;;
  5418. hpux*) #(vi
  5419. CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
  5420. ;;
  5421. irix[[56]].*) #(vi
  5422. CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
  5423. ;;
  5424. linux*|gnu*|mint*|k*bsd*-gnu) #(vi
  5425. CF_GNU_SOURCE
  5426. ;;
  5427. mirbsd*) #(vi
  5428. # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
  5429. ;;
  5430. netbsd*) #(vi
  5431. # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
  5432. ;;
  5433. openbsd*) #(vi
  5434. # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
  5435. ;;
  5436. osf[[45]]*) #(vi
  5437. CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
  5438. ;;
  5439. nto-qnx*) #(vi
  5440. CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
  5441. ;;
  5442. sco*) #(vi
  5443. # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
  5444. ;;
  5445. solaris*) #(vi
  5446. CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
  5447. ;;
  5448. *)
  5449. AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
  5450. AC_TRY_COMPILE([#include <sys/types.h>],[
  5451. #ifndef _XOPEN_SOURCE
  5452. make an error
  5453. #endif],
  5454. [cf_cv_xopen_source=no],
  5455. [cf_save="$CPPFLAGS"
  5456. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
  5457. AC_TRY_COMPILE([#include <sys/types.h>],[
  5458. #ifdef _XOPEN_SOURCE
  5459. make an error
  5460. #endif],
  5461. [cf_cv_xopen_source=no],
  5462. [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
  5463. CPPFLAGS="$cf_save"
  5464. ])
  5465. ])
  5466. if test "$cf_cv_xopen_source" != no ; then
  5467. CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
  5468. CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
  5469. test "$cf_cv_cc_u_d_options" = yes && \
  5470. CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
  5471. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
  5472. fi
  5473. CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
  5474. ;;
  5475. esac
  5476. ])