aclocal.m4 161 KB

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