aclocal.m4 158 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269
  1. dnl Macros for auto-configure script.
  2. dnl by T.E.Dickey <dickey@invisible-island.net>
  3. dnl and Jim Spath <jspath@mail.bcpl.lib.md.us>
  4. dnl and Philippe De Muyter <phdm@macqel.be>
  5. dnl
  6. dnl Created: 1997/1/28
  7. dnl Updated: 2006/9/2
  8. dnl
  9. dnl The autoconf used in Lynx development is GNU autoconf 2.13 or 2.52, patched
  10. dnl by Thomas Dickey. See your local GNU archives, and this URL:
  11. dnl http://invisible-island.net/autoconf/autoconf.html
  12. dnl
  13. dnl ---------------------------------------------------------------------------
  14. dnl
  15. dnl Copyright 1997-2005,2006 by Thomas E. Dickey
  16. dnl
  17. dnl Permission to use, copy, modify, and distribute this software and its
  18. dnl documentation for any purpose and without fee is hereby granted,
  19. dnl provided that the above copyright notice appear in all copies and that
  20. dnl both that copyright notice and this permission notice appear in
  21. dnl supporting documentation, and that the name of the above listed
  22. dnl copyright holder(s) not be used in advertising or publicity pertaining
  23. dnl to distribution of the software without specific, written prior
  24. dnl permission.
  25. dnl
  26. dnl THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD
  27. dnl TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  28. dnl AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE
  29. dnl LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  30. dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  31. dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  32. dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  33. dnl
  34. dnl ---------------------------------------------------------------------------
  35. dnl A few macros (the AM_xxx ones) are originally from gettext 0.10.35 (but
  36. dnl are modified), and are part of this file due to mechanical limitations of
  37. dnl autoconf.
  38. dnl ---------------------------------------------------------------------------
  39. dnl ---------------------------------------------------------------------------
  40. dnl AM_GNU_GETTEXT version: 11 updated: 2004/01/26 20:58:40
  41. dnl --------------
  42. dnl Usage: Just like AM_WITH_NLS, which see.
  43. AC_DEFUN([AM_GNU_GETTEXT],
  44. [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  45. AC_REQUIRE([AC_PROG_CC])dnl
  46. AC_REQUIRE([AC_CANONICAL_HOST])dnl
  47. AC_REQUIRE([AC_PROG_RANLIB])dnl
  48. AC_REQUIRE([AC_ISC_POSIX])dnl
  49. AC_REQUIRE([AC_HEADER_STDC])dnl
  50. AC_REQUIRE([AC_C_CONST])dnl
  51. AC_REQUIRE([AC_C_INLINE])dnl
  52. AC_REQUIRE([AC_TYPE_OFF_T])dnl
  53. AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  54. AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  55. AC_REQUIRE([AC_FUNC_MMAP])dnl
  56. AC_REQUIRE([jm_GLIBC21])dnl
  57. AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
  58. stdlib.h string.h unistd.h sys/param.h])
  59. AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
  60. getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
  61. strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
  62. AM_ICONV
  63. AM_LANGINFO_CODESET
  64. AM_LC_MESSAGES
  65. AM_WITH_NLS([$1],[$2],[$3],[$4])
  66. if test "x$CATOBJEXT" != "x"; then
  67. if test "x$ALL_LINGUAS" = "x"; then
  68. LINGUAS=
  69. else
  70. AC_MSG_CHECKING(for catalogs to be installed)
  71. NEW_LINGUAS=
  72. for presentlang in $ALL_LINGUAS; do
  73. useit=no
  74. for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
  75. # Use the presentlang catalog if desiredlang is
  76. # a. equal to presentlang, or
  77. # b. a variant of presentlang (because in this case,
  78. # presentlang can be used as a fallback for messages
  79. # which are not translated in the desiredlang catalog).
  80. case "$desiredlang" in
  81. "$presentlang"*) useit=yes;;
  82. esac
  83. done
  84. if test $useit = yes; then
  85. NEW_LINGUAS="$NEW_LINGUAS $presentlang"
  86. fi
  87. done
  88. LINGUAS=$NEW_LINGUAS
  89. AC_MSG_RESULT($LINGUAS)
  90. fi
  91. dnl Construct list of names of catalog files to be constructed.
  92. if test -n "$LINGUAS"; then
  93. for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  94. fi
  95. fi
  96. dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
  97. dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
  98. dnl Try to locate it.
  99. dnl changed mkinstalldirs to mkdirs.sh for Lynx /je spath 1998-Aug-21
  100. dnl added check for separate locations of scripts -mirabile 2004-Jan-18
  101. MKINSTALLDIRS=
  102. if test -n "$ac_aux_dir"; then
  103. MKINSTALLDIRS="$ac_aux_dir/mkdirs.sh"
  104. fi
  105. if test -z "$MKINSTALLDIRS"; then
  106. MKINSTALLDIRS="\$(top_srcdir)/mkdirs.sh"
  107. fi
  108. if test -n "$GNUSYSTEM_AUX_DIR" ; then
  109. if test -e "${GNUSYSTEM_AUX_DIR}/mkinstalldirs"; then
  110. MKINSTALLDIRS="${GNUSYSTEM_AUX_DIR}/mkinstalldirs"
  111. fi
  112. fi
  113. AC_SUBST(MKINSTALLDIRS)
  114. dnl Enable libtool support if the surrounding package wishes it.
  115. INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
  116. AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
  117. ])dnl
  118. dnl ---------------------------------------------------------------------------
  119. dnl AM_ICONV version: 4 updated: 2005/06/20 05:31:53
  120. dnl --------
  121. dnl Inserted as requested by gettext 0.10.40
  122. dnl File from /usr/share/aclocal
  123. dnl iconv.m4
  124. dnl ====================
  125. dnl serial AM2
  126. dnl
  127. dnl From Bruno Haible.
  128. AC_DEFUN([AM_ICONV],
  129. [
  130. dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
  131. dnl those with the standalone portable GNU libiconv installed).
  132. AC_ARG_WITH([libiconv-prefix],
  133. [ --with-libiconv-prefix=DIR
  134. search for libiconv in DIR/include and DIR/lib], [
  135. for dir in `echo "$withval" | tr : ' '`; do
  136. if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
  137. if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
  138. done
  139. ])
  140. AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
  141. am_cv_func_iconv="no, consider installing GNU libiconv"
  142. am_cv_lib_iconv=no
  143. AC_TRY_LINK([#include <stdlib.h>
  144. #include <iconv.h>],
  145. [iconv_t cd = iconv_open("","");
  146. iconv(cd,NULL,NULL,NULL,NULL);
  147. iconv_close(cd);],
  148. am_cv_func_iconv=yes)
  149. if test "$am_cv_func_iconv" != yes; then
  150. am_save_LIBS="$LIBS"
  151. LIBS="$LIBS -liconv"
  152. AC_TRY_LINK([#include <stdlib.h>
  153. #include <iconv.h>],
  154. [iconv_t cd = iconv_open("","");
  155. iconv(cd,NULL,NULL,NULL,NULL);
  156. iconv_close(cd);],
  157. am_cv_lib_iconv=yes
  158. am_cv_func_iconv=yes)
  159. LIBS="$am_save_LIBS"
  160. fi
  161. ])
  162. if test "$am_cv_func_iconv" = yes; then
  163. AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
  164. AC_MSG_CHECKING([for iconv declaration])
  165. AC_CACHE_VAL(am_cv_proto_iconv, [
  166. AC_TRY_COMPILE([
  167. #include <stdlib.h>
  168. #include <iconv.h>
  169. extern
  170. #ifdef __cplusplus
  171. "C"
  172. #endif
  173. #if defined(__STDC__) || defined(__cplusplus)
  174. size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
  175. #else
  176. size_t iconv();
  177. #endif
  178. ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
  179. am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
  180. am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
  181. AC_MSG_RESULT([$]{ac_t:-
  182. }[$]am_cv_proto_iconv)
  183. AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
  184. [Define as const if the declaration of iconv() needs const.])
  185. fi
  186. LIBICONV=
  187. if test "$am_cv_lib_iconv" = yes; then
  188. LIBICONV="-liconv"
  189. fi
  190. AC_SUBST(LIBICONV)
  191. ])dnl
  192. dnl ---------------------------------------------------------------------------
  193. dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42
  194. dnl -------------------
  195. dnl Inserted as requested by gettext 0.10.40
  196. dnl File from /usr/share/aclocal
  197. dnl codeset.m4
  198. dnl ====================
  199. dnl serial AM1
  200. dnl
  201. dnl From Bruno Haible.
  202. AC_DEFUN([AM_LANGINFO_CODESET],
  203. [
  204. AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
  205. [AC_TRY_LINK([#include <langinfo.h>],
  206. [char* cs = nl_langinfo(CODESET);],
  207. am_cv_langinfo_codeset=yes,
  208. am_cv_langinfo_codeset=no)
  209. ])
  210. if test $am_cv_langinfo_codeset = yes; then
  211. AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
  212. [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  213. fi
  214. ])dnl
  215. dnl ---------------------------------------------------------------------------
  216. dnl AM_LC_MESSAGES version: 4 updated: 2002/10/27 23:21:42
  217. dnl --------------
  218. dnl Inserted as requested by gettext 0.10.40
  219. dnl File from /usr/share/aclocal
  220. dnl lcmessage.m4
  221. dnl ====================
  222. dnl Check whether LC_MESSAGES is available in <locale.h>.
  223. dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
  224. dnl
  225. dnl This file can be copied and used freely without restrictions. It can
  226. dnl be used in projects which are not available under the GNU General Public
  227. dnl License or the GNU Library General Public License but which still want
  228. dnl to provide support for the GNU gettext functionality.
  229. dnl Please note that the actual code of the GNU gettext library is covered
  230. dnl by the GNU Library General Public License, and the rest of the GNU
  231. dnl gettext package package is covered by the GNU General Public License.
  232. dnl They are *not* in the public domain.
  233. dnl
  234. dnl serial 2
  235. dnl
  236. AC_DEFUN([AM_LC_MESSAGES],
  237. [if test $ac_cv_header_locale_h = yes; then
  238. AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  239. [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  240. am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  241. if test $am_cv_val_LC_MESSAGES = yes; then
  242. AC_DEFINE(HAVE_LC_MESSAGES, 1,
  243. [Define if your <locale.h> file defines LC_MESSAGES.])
  244. fi
  245. fi])dnl
  246. dnl ---------------------------------------------------------------------------
  247. dnl AM_PATH_PROG_WITH_TEST version: 7 updated: 2006/08/06 19:45:29
  248. dnl ----------------------
  249. dnl Inserted as requested by gettext 0.10.40
  250. dnl File from /usr/share/aclocal
  251. dnl progtest.m4
  252. dnl ====================
  253. dnl Search path for a program which passes the given test.
  254. dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
  255. dnl
  256. dnl This file can be copied and used freely without restrictions. It can
  257. dnl be used in projects which are not available under the GNU General Public
  258. dnl License or the GNU Library General Public License but which still want
  259. dnl to provide support for the GNU gettext functionality.
  260. dnl Please note that the actual code of the GNU gettext library is covered
  261. dnl by the GNU Library General Public License, and the rest of the GNU
  262. dnl gettext package package is covered by the GNU General Public License.
  263. dnl They are *not* in the public domain.
  264. dnl
  265. dnl serial 2
  266. dnl
  267. dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
  268. dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  269. AC_DEFUN([AM_PATH_PROG_WITH_TEST],
  270. [# Extract the first word of "$2", so it can be a program name with args.
  271. AC_REQUIRE([CF_PATHSEP])
  272. set dummy $2; ac_word=[$]2
  273. AC_MSG_CHECKING([for $ac_word])
  274. AC_CACHE_VAL(ac_cv_path_$1,
  275. [case "[$]$1" in
  276. [[\\/]*|?:[\\/]]*)
  277. ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  278. ;;
  279. *)
  280. if test -n "$PATH_SEPARATOR"; then PATHSEP="$PATH_SEPARATOR"; fi
  281. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}"
  282. for ac_dir in ifelse([$5], , $PATH, [$5]); do
  283. test -z "$ac_dir" && ac_dir=.
  284. if test -f $ac_dir/$ac_word$ac_exeext; then
  285. if [$3]; then
  286. ac_cv_path_$1="$ac_dir/$ac_word$ac_exeext"
  287. break
  288. fi
  289. fi
  290. done
  291. IFS="$ac_save_ifs"
  292. dnl If no 4th arg is given, leave the cache variable unset,
  293. dnl so AC_PATH_PROGS will keep looking.
  294. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  295. ])dnl
  296. ;;
  297. esac])dnl
  298. $1="$ac_cv_path_$1"
  299. if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
  300. AC_MSG_RESULT([$]$1)
  301. else
  302. AC_MSG_RESULT(no)
  303. fi
  304. AC_SUBST($1)dnl
  305. ])dnl
  306. dnl ---------------------------------------------------------------------------
  307. dnl AM_WITH_NLS version: 18 updated: 2006/01/22 20:26:00
  308. dnl -----------
  309. dnl Inserted as requested by gettext 0.10.40
  310. dnl File from /usr/share/aclocal
  311. dnl gettext.m4
  312. dnl ====================
  313. dnl Macro to add for using GNU gettext.
  314. dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
  315. dnl
  316. dnl This file can be copied and used freely without restrictions. It can
  317. dnl be used in projects which are not available under the GNU General Public
  318. dnl License or the GNU Library General Public License but which still want
  319. dnl to provide support for the GNU gettext functionality.
  320. dnl Please note that the actual code of the GNU gettext library is covered
  321. dnl by the GNU Library General Public License, and the rest of the GNU
  322. dnl gettext package package is covered by the GNU General Public License.
  323. dnl They are *not* in the public domain.
  324. dnl
  325. dnl serial 10
  326. dnl
  327. dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR], [ENABLED]).
  328. dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
  329. dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
  330. dnl depending on --{enable,disable}-{shared,static} and on the presence of
  331. dnl AM-DISABLE-SHARED). Otherwise, a static library
  332. dnl $(top_builddir)/intl/libintl.a will be created.
  333. dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
  334. dnl implementations (in libc or libintl) without the ngettext() function
  335. dnl will be ignored.
  336. dnl LIBDIR is used to find the intl libraries. If empty,
  337. dnl the value `$(top_builddir)/intl/' is used.
  338. dnl ENABLED is used to control the default for the related --enable-nls, since
  339. dnl not all application developers want this feature by default, e.g., lynx.
  340. dnl
  341. dnl The result of the configuration is one of three cases:
  342. dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
  343. dnl and used.
  344. dnl Catalog format: GNU --> install in $(datadir)
  345. dnl Catalog extension: .mo after installation, .gmo in source tree
  346. dnl 2) GNU gettext has been found in the system's C library.
  347. dnl Catalog format: GNU --> install in $(datadir)
  348. dnl Catalog extension: .mo after installation, .gmo in source tree
  349. dnl 3) No internationalization, always use English msgid.
  350. dnl Catalog format: none
  351. dnl Catalog extension: none
  352. dnl The use of .gmo is historical (it was needed to avoid overwriting the
  353. dnl GNU format catalogs when building on a platform with an X/Open gettext),
  354. dnl but we keep it in order not to force irrelevant filename changes on the
  355. dnl maintainers.
  356. dnl
  357. AC_DEFUN([AM_WITH_NLS],
  358. [AC_MSG_CHECKING([whether NLS is requested])
  359. dnl Default is enabled NLS
  360. ifelse([$4],,[
  361. AC_ARG_ENABLE(nls,
  362. [ --disable-nls do not use Native Language Support],
  363. USE_NLS=$enableval, USE_NLS=yes)],[
  364. AC_ARG_ENABLE(nls,
  365. [ --enable-nls use Native Language Support],
  366. USE_NLS=$enableval, USE_NLS=no)])
  367. AC_MSG_RESULT($USE_NLS)
  368. AC_SUBST(USE_NLS)
  369. BUILD_INCLUDED_LIBINTL=no
  370. USE_INCLUDED_LIBINTL=no
  371. INTLLIBS=
  372. dnl If we use NLS figure out what method
  373. if test "$USE_NLS" = "yes"; then
  374. AC_DEFINE(ENABLE_NLS, 1,
  375. [Define to 1 if translation of program messages to the user's native language
  376. is requested.])
  377. AC_MSG_CHECKING([whether included gettext is requested])
  378. AC_ARG_WITH(included-gettext,
  379. [ --with-included-gettext use the GNU gettext library included here],
  380. nls_cv_force_use_gnu_gettext=$withval,
  381. nls_cv_force_use_gnu_gettext=no)
  382. AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
  383. nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
  384. if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
  385. dnl User does not insist on using GNU NLS library. Figure out what
  386. dnl to use. If GNU gettext is available we use this. Else we have
  387. dnl to fall back to GNU NLS library.
  388. CATOBJEXT=NONE
  389. dnl Add a version number to the cache macros.
  390. define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
  391. define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
  392. CF_FIND_HEADER(libintl.h,gettext,
  393. [AC_DEFINE(HAVE_LIBINTL_H)
  394. AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
  395. [AC_TRY_LINK([#include <libintl.h>
  396. extern int _nl_msg_cat_cntr;],
  397. [bindtextdomain ("", "");
  398. return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
  399. gt_cv_func_gnugettext_libc=yes,
  400. gt_cv_func_gnugettext_libc=no)])
  401. if test "$gt_cv_func_gnugettext_libc" != "yes"; then
  402. CF_FIND_LINKAGE([#include <libintl.h>
  403. extern int _nl_msg_cat_cntr;],
  404. [bindtextdomain ("", "");
  405. return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
  406. intl,
  407. gt_cv_func_gnugettext_libintl=yes,
  408. gt_cv_func_gnugettext_libintl=no)
  409. fi
  410. dnl If an already present or preinstalled GNU gettext() is found,
  411. dnl use it. But if this macro is used in GNU gettext, and GNU
  412. dnl gettext is already preinstalled in libintl, we update this
  413. dnl libintl. (Cf. the install rule in intl/Makefile.in.)
  414. if test "$gt_cv_func_gnugettext_libc" = "yes" \
  415. || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
  416. && test "$PACKAGE" != gettext; }; then
  417. AC_DEFINE(HAVE_GETTEXT, 1,
  418. [Define if the GNU gettext() function is already present or preinstalled.])
  419. if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
  420. dnl If iconv() is in a separate libiconv library, then anyone
  421. dnl linking with libintl{.a,.so} also needs to link with
  422. dnl libiconv.
  423. INTLLIBS="-lintl $LIBICONV"
  424. fi
  425. gt_save_LIBS="$LIBS"
  426. LIBS="$LIBS $INTLLIBS"
  427. AC_CHECK_FUNCS(dcgettext)
  428. LIBS="$gt_save_LIBS"
  429. dnl Search for GNU msgfmt in the PATH.
  430. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  431. [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
  432. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  433. dnl Search for GNU xgettext in the PATH.
  434. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  435. [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
  436. CATOBJEXT=.gmo
  437. fi
  438. ])
  439. if test "$CATOBJEXT" = "NONE"; then
  440. dnl GNU gettext is not found in the C library.
  441. dnl Fall back on GNU gettext library.
  442. nls_cv_use_gnu_gettext=yes
  443. fi
  444. fi
  445. if test "$nls_cv_use_gnu_gettext" = "yes"; then
  446. if test ! -d $srcdir/intl ; then
  447. AC_MSG_ERROR(no NLS library is packaged with this application)
  448. fi
  449. dnl Mark actions used to generate GNU NLS library.
  450. INTLOBJS="\$(GETTOBJS)"
  451. AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
  452. [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
  453. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  454. AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
  455. [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
  456. AC_SUBST(MSGFMT)
  457. BUILD_INCLUDED_LIBINTL=yes
  458. USE_INCLUDED_LIBINTL=yes
  459. CATOBJEXT=.gmo
  460. INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
  461. LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
  462. fi
  463. dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  464. dnl Test whether we really found GNU msgfmt.
  465. if test "$GMSGFMT" != ":"; then
  466. dnl If it is no GNU msgfmt we define it as : so that the
  467. dnl Makefiles still can work.
  468. if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
  469. : ;
  470. else
  471. AC_MSG_RESULT(
  472. [found msgfmt program is not GNU msgfmt; ignore it])
  473. GMSGFMT=":"
  474. fi
  475. fi
  476. dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
  477. dnl Test whether we really found GNU xgettext.
  478. if test "$XGETTEXT" != ":"; then
  479. dnl If it is no GNU xgettext we define it as : so that the
  480. dnl Makefiles still can work.
  481. if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
  482. : ;
  483. else
  484. AC_MSG_RESULT(
  485. [found xgettext program is not GNU xgettext; ignore it])
  486. XGETTEXT=":"
  487. fi
  488. fi
  489. dnl We need to process the po/ directory.
  490. POSUB=po
  491. fi
  492. AC_OUTPUT_COMMANDS(
  493. [for ac_file in $CONFIG_FILES; do
  494. # Support "outfile[:infile[:infile...]]"
  495. case "$ac_file" in
  496. *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
  497. esac
  498. # PO directories have a Makefile.in generated from Makefile.inn.
  499. case "$ac_file" in */[Mm]akefile.in)
  500. # Adjust a relative srcdir.
  501. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
  502. ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
  503. ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
  504. ac_base=`basename $ac_file .in`
  505. # In autoconf-2.13 it is called $ac_given_srcdir.
  506. # In autoconf-2.50 it is called $srcdir.
  507. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
  508. case "$ac_given_srcdir" in
  509. .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
  510. /*) top_srcdir="$ac_given_srcdir" ;;
  511. *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
  512. esac
  513. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
  514. rm -f "$ac_dir/POTFILES"
  515. test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
  516. sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
  517. test -n "$as_me" && echo "$as_me: creating $ac_dir/$ac_base" || echo "creating $ac_dir/$ac_base"
  518. sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/$ac_base.in" > "$ac_dir/$ac_base"
  519. fi
  520. ;;
  521. esac
  522. done])
  523. dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
  524. dnl to 'yes' because some of the testsuite requires it.
  525. if test "$PACKAGE" = gettext; then
  526. BUILD_INCLUDED_LIBINTL=yes
  527. fi
  528. dnl intl/plural.c is generated from intl/plural.y. It requires bison,
  529. dnl because plural.y uses bison specific features. It requires at least
  530. dnl bison-1.26 because earlier versions generate a plural.c that doesn't
  531. dnl compile.
  532. dnl bison is only needed for the maintainer (who touches plural.y). But in
  533. dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
  534. dnl the rule in general Makefile. Now, some people carelessly touch the
  535. dnl files or have a broken "make" program, hence the plural.c rule will
  536. dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
  537. dnl present or too old.
  538. if test "$nls_cv_use_gnu_gettext" = "yes"; then
  539. AC_CHECK_PROGS([INTLBISON], [bison])
  540. if test -z "$INTLBISON"; then
  541. ac_verc_fail=yes
  542. else
  543. dnl Found it, now check the version.
  544. AC_MSG_CHECKING([version of bison])
  545. changequote(<<,>>)dnl
  546. ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
  547. case $ac_prog_version in
  548. '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
  549. 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
  550. changequote([,])dnl
  551. ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
  552. *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
  553. esac
  554. AC_MSG_RESULT([$ac_prog_version])
  555. fi
  556. if test $ac_verc_fail = yes; then
  557. INTLBISON=:
  558. fi
  559. fi
  560. dnl These rules are solely for the distribution goal. While doing this
  561. dnl we only have to keep exactly one list of the available catalogs
  562. dnl in configure.in.
  563. for lang in $ALL_LINGUAS; do
  564. GMOFILES="$GMOFILES $lang.gmo"
  565. POFILES="$POFILES $lang.po"
  566. done
  567. dnl Make all variables we use known to autoconf.
  568. AC_SUBST(BUILD_INCLUDED_LIBINTL)
  569. AC_SUBST(USE_INCLUDED_LIBINTL)
  570. AC_SUBST(CATALOGS)
  571. AC_SUBST(CATOBJEXT)
  572. AC_SUBST(GMOFILES)
  573. AC_SUBST(INTLLIBS)
  574. AC_SUBST(INTLOBJS)
  575. AC_SUBST(POFILES)
  576. AC_SUBST(POSUB)
  577. dnl For backward compatibility. Some configure.ins may be using this.
  578. nls_cv_header_intl=
  579. nls_cv_header_libgt=
  580. dnl For backward compatibility. Some Makefiles may be using this.
  581. DATADIRNAME=share
  582. AC_SUBST(DATADIRNAME)
  583. dnl For backward compatibility. Some Makefiles may be using this.
  584. INSTOBJEXT=.mo
  585. AC_SUBST(INSTOBJEXT)
  586. dnl For backward compatibility. Some Makefiles may be using this.
  587. GENCAT=gencat
  588. AC_SUBST(GENCAT)
  589. ])dnl
  590. dnl ---------------------------------------------------------------------------
  591. dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30
  592. dnl -------------
  593. dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS
  594. dnl The second parameter if given makes this macro verbose.
  595. dnl
  596. dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS,
  597. dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily
  598. dnl confused by the quotes (which require backslashes to keep them usable).
  599. AC_DEFUN([CF_ADD_CFLAGS],
  600. [
  601. cf_fix_cppflags=no
  602. cf_new_cflags=
  603. cf_new_cppflags=
  604. cf_new_extra_cppflags=
  605. for cf_add_cflags in $1
  606. do
  607. case $cf_fix_cppflags in
  608. no)
  609. case $cf_add_cflags in #(vi
  610. -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi
  611. case $cf_add_cflags in
  612. -D*)
  613. cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'`
  614. test "${cf_add_cflags}" != "${cf_tst_cflags}" \
  615. && test -z "${cf_tst_cflags}" \
  616. && cf_fix_cppflags=yes
  617. if test $cf_fix_cppflags = yes ; then
  618. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  619. continue
  620. elif test "${cf_tst_cflags}" = "\"'" ; then
  621. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  622. continue
  623. fi
  624. ;;
  625. esac
  626. case "$CPPFLAGS" in
  627. *$cf_add_cflags) #(vi
  628. ;;
  629. *) #(vi
  630. cf_new_cppflags="$cf_new_cppflags $cf_add_cflags"
  631. ;;
  632. esac
  633. ;;
  634. *)
  635. cf_new_cflags="$cf_new_cflags $cf_add_cflags"
  636. ;;
  637. esac
  638. ;;
  639. yes)
  640. cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags"
  641. cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'`
  642. test "${cf_add_cflags}" != "${cf_tst_cflags}" \
  643. && test -z "${cf_tst_cflags}" \
  644. && cf_fix_cppflags=no
  645. ;;
  646. esac
  647. done
  648. if test -n "$cf_new_cflags" ; then
  649. ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)])
  650. CFLAGS="$CFLAGS $cf_new_cflags"
  651. fi
  652. if test -n "$cf_new_cppflags" ; then
  653. ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)])
  654. CPPFLAGS="$cf_new_cppflags $CPPFLAGS"
  655. fi
  656. if test -n "$cf_new_extra_cppflags" ; then
  657. ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)])
  658. EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS"
  659. fi
  660. AC_SUBST(EXTRA_CPPFLAGS)
  661. ])dnl
  662. dnl ---------------------------------------------------------------------------
  663. dnl CF_ADD_INCDIR version: 4 updated: 2002/12/21 14:25:52
  664. dnl -------------
  665. dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's
  666. dnl redundant. We don't normally need to add -I/usr/local/include for gcc,
  667. dnl but old versions (and some misinstalled ones) need that. To make things
  668. dnl worse, gcc 3.x gives error messages if -I/usr/local/include is added to
  669. dnl the include-path).
  670. AC_DEFUN([CF_ADD_INCDIR],
  671. [
  672. for cf_add_incdir in $1
  673. do
  674. while true
  675. do
  676. case $cf_add_incdir in
  677. /usr/include) # (vi
  678. ;;
  679. /usr/local/include) # (vi
  680. if test "$GCC" = yes
  681. then
  682. cf_save_CPPFLAGS="$CPPFLAGS"
  683. CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
  684. AC_TRY_COMPILE([#include <stdio.h>],
  685. [printf("Hello")],
  686. [],
  687. [CPPFLAGS="$cf_save_CPPFLAGS"])
  688. fi
  689. ;;
  690. *) # (vi
  691. CPPFLAGS="$CPPFLAGS -I$cf_add_incdir"
  692. ;;
  693. esac
  694. cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'`
  695. test "$cf_top_incdir" = "$cf_add_incdir" && break
  696. cf_add_incdir="$cf_top_incdir"
  697. done
  698. done
  699. ])dnl
  700. dnl ---------------------------------------------------------------------------
  701. dnl CF_ALT_CHAR_SET version: 6 updated: 1998/11/18 14:45:34
  702. dnl ---------------
  703. dnl Check for existence of alternate-character-set support in curses, so we
  704. dnl can decide to use it for box characters.
  705. dnl
  706. AC_DEFUN([CF_ALT_CHAR_SET],
  707. [
  708. AC_MSG_CHECKING([if curses supports alternate-character set])
  709. AC_CACHE_VAL(cf_cv_alt_char_set,[
  710. for mapname in acs_map _acs_map
  711. do
  712. AC_TRY_LINK([
  713. #include <${cf_cv_ncurses_header-curses.h}>
  714. ],[chtype x = $mapname['l']; $mapname['m'] = 0],
  715. [cf_cv_alt_char_set=$mapname
  716. break],
  717. [cf_cv_alt_char_set=no])
  718. done
  719. ])
  720. AC_MSG_RESULT($cf_cv_alt_char_set)
  721. test $cf_cv_alt_char_set != no && AC_DEFINE_UNQUOTED(ALT_CHAR_SET,$cf_cv_alt_char_set)
  722. ])dnl
  723. dnl ---------------------------------------------------------------------------
  724. dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34
  725. dnl ----------------
  726. dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES'
  727. dnl in the sharutils 4.2 distribution.
  728. AC_DEFUN([CF_ANSI_CC_CHECK],
  729. [
  730. AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[
  731. cf_cv_ansi_cc=no
  732. cf_save_CFLAGS="$CFLAGS"
  733. cf_save_CPPFLAGS="$CPPFLAGS"
  734. # Don't try gcc -ansi; that turns off useful extensions and
  735. # breaks some systems' header files.
  736. # AIX -qlanglvl=ansi
  737. # Ultrix and OSF/1 -std1
  738. # HP-UX -Aa -D_HPUX_SOURCE
  739. # SVR4 -Xc
  740. # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
  741. for cf_arg in "-DCC_HAS_PROTOS" \
  742. "" \
  743. -qlanglvl=ansi \
  744. -std1 \
  745. -Ae \
  746. "-Aa -D_HPUX_SOURCE" \
  747. -Xc
  748. do
  749. CF_ADD_CFLAGS($cf_arg)
  750. AC_TRY_COMPILE(
  751. [
  752. #ifndef CC_HAS_PROTOS
  753. #if !defined(__STDC__) || (__STDC__ != 1)
  754. choke me
  755. #endif
  756. #endif
  757. ],[
  758. int test (int i, double x);
  759. struct s1 {int (*f) (int a);};
  760. struct s2 {int (*f) (double a);};],
  761. [cf_cv_ansi_cc="$cf_arg"; break])
  762. done
  763. CFLAGS="$cf_save_CFLAGS"
  764. CPPFLAGS="$cf_save_CPPFLAGS"
  765. ])
  766. if test "$cf_cv_ansi_cc" != "no"; then
  767. if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
  768. CF_ADD_CFLAGS($cf_cv_ansi_cc)
  769. else
  770. AC_DEFINE(CC_HAS_PROTOS)
  771. fi
  772. fi
  773. ])dnl
  774. dnl ---------------------------------------------------------------------------
  775. dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44
  776. dnl ---------------
  777. dnl For programs that must use an ANSI compiler, obtain compiler options that
  778. dnl will make it recognize prototypes. We'll do preprocessor checks in other
  779. dnl macros, since tools such as unproto can fake prototypes, but only part of
  780. dnl the preprocessor.
  781. AC_DEFUN([CF_ANSI_CC_REQD],
  782. [AC_REQUIRE([CF_ANSI_CC_CHECK])
  783. if test "$cf_cv_ansi_cc" = "no"; then
  784. AC_ERROR(
  785. [Your compiler does not appear to recognize prototypes.
  786. You have the following choices:
  787. a. adjust your compiler options
  788. b. get an up-to-date compiler
  789. c. use a wrapper such as unproto])
  790. fi
  791. ])dnl
  792. dnl ---------------------------------------------------------------------------
  793. dnl CF_ARG_DISABLE version: 3 updated: 1999/03/30 17:24:31
  794. dnl --------------
  795. dnl Allow user to disable a normally-on option.
  796. AC_DEFUN([CF_ARG_DISABLE],
  797. [CF_ARG_OPTION($1,[$2],[$3],[$4],yes)])dnl
  798. dnl ---------------------------------------------------------------------------
  799. dnl CF_ARG_ENABLE version: 3 updated: 1999/03/30 17:24:31
  800. dnl -------------
  801. dnl Allow user to enable a normally-off option.
  802. AC_DEFUN([CF_ARG_ENABLE],
  803. [CF_ARG_OPTION($1,[$2],[$3],[$4],no)])dnl
  804. dnl ---------------------------------------------------------------------------
  805. dnl CF_ARG_OPTION version: 3 updated: 1997/10/18 14:42:41
  806. dnl -------------
  807. dnl Restricted form of AC_ARG_ENABLE that ensures user doesn't give bogus
  808. dnl values.
  809. dnl
  810. dnl Parameters:
  811. dnl $1 = option name
  812. dnl $2 = help-string
  813. dnl $3 = action to perform if option is not default
  814. dnl $4 = action if perform if option is default
  815. dnl $5 = default option value (either 'yes' or 'no')
  816. AC_DEFUN([CF_ARG_OPTION],
  817. [AC_ARG_ENABLE($1,[$2],[test "$enableval" != ifelse($5,no,yes,no) && enableval=ifelse($5,no,no,yes)
  818. if test "$enableval" != "$5" ; then
  819. ifelse($3,,[ :]dnl
  820. ,[ $3]) ifelse($4,,,[
  821. else
  822. $4])
  823. fi],[enableval=$5 ifelse($4,,,[
  824. $4
  825. ])dnl
  826. ])])dnl
  827. dnl ---------------------------------------------------------------------------
  828. dnl CF_BOOL_DEFS version: 3 updated: 1998/04/27 20:32:33
  829. dnl ------------
  830. dnl Check if curses.h defines TRUE/FALSE (it does under SVr4).
  831. AC_DEFUN([CF_BOOL_DEFS],
  832. [
  833. AC_MSG_CHECKING(if TRUE/FALSE are defined)
  834. AC_CACHE_VAL(cf_cv_bool_defs,[
  835. AC_TRY_COMPILE([
  836. #include <${cf_cv_ncurses_header-curses.h}>
  837. #include <stdio.h>],[int x = TRUE, y = FALSE],
  838. [cf_cv_bool_defs=yes],
  839. [cf_cv_bool_defs=no])])
  840. AC_MSG_RESULT($cf_cv_bool_defs)
  841. if test "$cf_cv_bool_defs" = no ; then
  842. AC_DEFINE(TRUE,(1))
  843. AC_DEFINE(FALSE,(0))
  844. fi
  845. ])dnl
  846. dnl ---------------------------------------------------------------------------
  847. dnl CF_BUILD_CC version: 5 updated: 2005/09/24 17:55:52
  848. dnl -----------
  849. dnl If we're cross-compiling, allow the user to override the tools and their
  850. dnl options. The configure script is oriented toward identifying the host
  851. dnl compiler, etc., but we need a build compiler to generate parts of the
  852. dnl source.
  853. dnl
  854. dnl $1 = default for $CPPFLAGS
  855. dnl $2 = default for $LIBS
  856. AC_DEFUN([CF_BUILD_CC],[
  857. AC_REQUIRE([CF_PROG_EXT])
  858. if test "$cross_compiling" = yes ; then
  859. # defaults that we might want to override
  860. : ${BUILD_CFLAGS:=''}
  861. : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'}
  862. : ${BUILD_LDFLAGS:=''}
  863. : ${BUILD_LIBS:='ifelse([$2],,,[$2])'}
  864. : ${BUILD_EXEEXT:='$x'}
  865. : ${BUILD_OBJEXT:='o'}
  866. AC_ARG_WITH(build-cc,
  867. [ --with-build-cc=XXX the build C compiler ($BUILD_CC)],
  868. [BUILD_CC="$withval"],
  869. [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)])
  870. AC_MSG_CHECKING(for native build C compiler)
  871. AC_MSG_RESULT($BUILD_CC)
  872. AC_MSG_CHECKING(for native build C preprocessor)
  873. AC_ARG_WITH(build-cpp,
  874. [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)],
  875. [BUILD_CPP="$withval"],
  876. [BUILD_CPP='$(BUILD_CC) -E'])
  877. AC_MSG_RESULT($BUILD_CPP)
  878. AC_MSG_CHECKING(for native build C flags)
  879. AC_ARG_WITH(build-cflags,
  880. [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)],
  881. [BUILD_CFLAGS="$withval"])
  882. AC_MSG_RESULT($BUILD_CFLAGS)
  883. AC_MSG_CHECKING(for native build C preprocessor-flags)
  884. AC_ARG_WITH(build-cppflags,
  885. [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)],
  886. [BUILD_CPPFLAGS="$withval"])
  887. AC_MSG_RESULT($BUILD_CPPFLAGS)
  888. AC_MSG_CHECKING(for native build linker-flags)
  889. AC_ARG_WITH(build-ldflags,
  890. [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)],
  891. [BUILD_LDFLAGS="$withval"])
  892. AC_MSG_RESULT($BUILD_LDFLAGS)
  893. AC_MSG_CHECKING(for native build linker-libraries)
  894. AC_ARG_WITH(build-libs,
  895. [ --with-build-libs=XXX the build libraries ($(BUILD_LIBS)],
  896. [BUILD_LIBS="$withval"])
  897. AC_MSG_RESULT($BUILD_LIBS)
  898. # this assumes we're on Unix.
  899. BUILD_EXEEXT=
  900. BUILD_OBJEXT=o
  901. : ${BUILD_CC:='$(CC)'}
  902. if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '$(CC)' ) ; then
  903. AC_MSG_ERROR([Cross-build requires two compilers.
  904. Use --with-build-cc to specify the native compiler.])
  905. fi
  906. else
  907. : ${BUILD_CC:='$(CC)'}
  908. : ${BUILD_CPP:='$(CPP)'}
  909. : ${BUILD_CFLAGS:='$(CFLAGS)'}
  910. : ${BUILD_CPPFLAGS:='$(CPPFLAGS)'}
  911. : ${BUILD_LDFLAGS:='$(LDFLAGS)'}
  912. : ${BUILD_LIBS:='$(LIBS)'}
  913. : ${BUILD_EXEEXT:='$x'}
  914. : ${BUILD_OBJEXT:='o'}
  915. fi
  916. AC_SUBST(BUILD_CC)
  917. AC_SUBST(BUILD_CPP)
  918. AC_SUBST(BUILD_CFLAGS)
  919. AC_SUBST(BUILD_CPPFLAGS)
  920. AC_SUBST(BUILD_LDFLAGS)
  921. AC_SUBST(BUILD_LIBS)
  922. AC_SUBST(BUILD_EXEEXT)
  923. AC_SUBST(BUILD_OBJEXT)
  924. ])dnl
  925. dnl ---------------------------------------------------------------------------
  926. dnl CF_BUNDLED_INTL version: 12 updated: 2005/06/21 18:24:28
  927. dnl ---------------
  928. dnl Top-level macro for configuring an application with a bundled copy of
  929. dnl the intl and po directories for gettext.
  930. dnl
  931. dnl $1 specifies either Makefile or makefile, defaulting to the former.
  932. dnl $2 if nonempty sets the option to --enable-nls rather than to --disable-nls
  933. dnl
  934. dnl Sets variables which can be used to substitute in makefiles:
  935. dnl INTLDIR_MAKE - to make ./intl directory
  936. dnl MSG_DIR_MAKE - to make ./po directory
  937. dnl SUB_MAKEFILE - list of makefiles in ./intl, ./po directories
  938. dnl Defines
  939. dnl HAVE_LIBGETTEXT_H if we're using ./intl
  940. dnl
  941. dnl Environment:
  942. dnl ALL_LINGUAS if set, lists the root names of the ".po" files.
  943. dnl CONFIG_H assumed to be "config.h"
  944. dnl VERSION may be set, otherwise extract from "VERSION" file.
  945. dnl
  946. AC_DEFUN([CF_BUNDLED_INTL],[
  947. cf_makefile=ifelse($1,,Makefile,$1)
  948. dnl Set of available languages (based on source distribution). Note that
  949. dnl setting $LINGUAS overrides $ALL_LINGUAS. Some environments set $LINGUAS
  950. dnl rather than $LC_ALL
  951. test -z "$ALL_LINGUAS" && ALL_LINGUAS=`test -d $srcdir/po && cd $srcdir/po && echo *.po|sed -e 's/\.po//g' -e 's/*//'`
  952. # Allow override of "config.h" definition:
  953. : ${CONFIG_H=config.h}
  954. AC_SUBST(CONFIG_H)
  955. if test -z "$VERSION" ; then
  956. if test -f $srcdir/VERSION ; then
  957. VERSION=`sed -e '2,$d' $srcdir/VERSION|cut -f1`
  958. else
  959. VERSION=unknown
  960. fi
  961. fi
  962. AC_SUBST(VERSION)
  963. AM_GNU_GETTEXT(,,,[$2])
  964. INTLDIR_MAKE=
  965. MSG_DIR_MAKE=
  966. SUB_MAKEFILE=
  967. dnl this updates SUB_MAKEFILE and MSG_DIR_MAKE:
  968. CF_OUR_MESSAGES($1)
  969. if test "$USE_INCLUDED_LIBINTL" = yes ; then
  970. if test "$nls_cv_force_use_gnu_gettext" = yes ; then
  971. :
  972. elif test "$nls_cv_use_gnu_gettext" = yes ; then
  973. :
  974. else
  975. INTLDIR_MAKE="#"
  976. fi
  977. if test -z "$INTLDIR_MAKE"; then
  978. AC_DEFINE(HAVE_LIBGETTEXT_H)
  979. for cf_makefile in \
  980. $srcdir/intl/Makefile.in \
  981. $srcdir/intl/makefile.in
  982. do
  983. if test -f "$cf_makefile" ; then
  984. SUB_MAKEFILE="$SUB_MAKEFILE `echo \"${cf_makefile}\"|sed -e 's,^'$srcdir/',,' -e 's/\.in$//'`:${cf_makefile}"
  985. break
  986. fi
  987. done
  988. fi
  989. else
  990. INTLDIR_MAKE="#"
  991. if test "$USE_NLS" = yes ; then
  992. AC_CHECK_HEADERS(libintl.h)
  993. fi
  994. fi
  995. if test -z "$INTLDIR_MAKE" ; then
  996. CPPFLAGS="-I../intl $CPPFLAGS"
  997. fi
  998. dnl FIXME: we use this in lynx (the alternative is a spurious dependency upon
  999. dnl GNU make)
  1000. if test "$BUILD_INCLUDED_LIBINTL" = yes ; then
  1001. GT_YES="#"
  1002. GT_NO=
  1003. else
  1004. GT_YES=
  1005. GT_NO="#"
  1006. fi
  1007. AC_SUBST(INTLDIR_MAKE)
  1008. AC_SUBST(MSG_DIR_MAKE)
  1009. AC_SUBST(GT_YES)
  1010. AC_SUBST(GT_NO)
  1011. dnl FIXME: the underlying AM_GNU_GETTEXT macro either needs some fixes or a
  1012. dnl little documentation. It doesn't define anything so that we can ifdef our
  1013. dnl own code, except ENABLE_NLS, which is too vague to be of any use.
  1014. if test "$USE_INCLUDED_LIBINTL" = yes ; then
  1015. if test "$nls_cv_force_use_gnu_gettext" = yes ; then
  1016. AC_DEFINE(HAVE_GETTEXT)
  1017. elif test "$nls_cv_use_gnu_gettext" = yes ; then
  1018. AC_DEFINE(HAVE_GETTEXT)
  1019. fi
  1020. if test -n "$nls_cv_header_intl" ; then
  1021. AC_DEFINE(HAVE_LIBINTL_H)
  1022. fi
  1023. fi
  1024. ])dnl
  1025. dnl ---------------------------------------------------------------------------
  1026. dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31
  1027. dnl --------------
  1028. dnl Check if we're accidentally using a cache from a different machine.
  1029. dnl Derive the system name, as a check for reusing the autoconf cache.
  1030. dnl
  1031. dnl If we've packaged config.guess and config.sub, run that (since it does a
  1032. dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow
  1033. dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM
  1034. dnl which is useful in cross-compiles.
  1035. dnl
  1036. dnl Note: we would use $ac_config_sub, but that is one of the places where
  1037. dnl autoconf 2.5x broke compatibility with autoconf 2.13
  1038. AC_DEFUN([CF_CHECK_CACHE],
  1039. [
  1040. if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then
  1041. ifelse([$1],,[AC_CANONICAL_HOST],[$1])
  1042. system_name="$host_os"
  1043. else
  1044. system_name="`(uname -s -r) 2>/dev/null`"
  1045. if test -z "$system_name" ; then
  1046. system_name="`(hostname) 2>/dev/null`"
  1047. fi
  1048. fi
  1049. test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
  1050. AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
  1051. test -z "$system_name" && system_name="$cf_cv_system_name"
  1052. test -n "$cf_cv_system_name" && AC_MSG_RESULT(Configuring for $cf_cv_system_name)
  1053. if test ".$system_name" != ".$cf_cv_system_name" ; then
  1054. AC_MSG_RESULT(Cached system name ($system_name) does not agree with actual ($cf_cv_system_name))
  1055. AC_ERROR("Please remove config.cache and try again.")
  1056. fi
  1057. ])dnl
  1058. dnl ---------------------------------------------------------------------------
  1059. dnl CF_CHECK_CFLAGS version: 2 updated: 2001/12/30 19:09:58
  1060. dnl ---------------
  1061. dnl Conditionally add to $CFLAGS and $CPPFLAGS values which are derived from
  1062. dnl a build-configuration such as imake. These have the pitfall that they
  1063. dnl often contain compiler-specific options which we cannot use, mixed with
  1064. dnl preprocessor options that we usually can.
  1065. AC_DEFUN([CF_CHECK_CFLAGS],
  1066. [
  1067. CF_VERBOSE(checking additions to CFLAGS)
  1068. cf_check_cflags="$CFLAGS"
  1069. cf_check_cppflags="$CPPFLAGS"
  1070. CF_ADD_CFLAGS($1,yes)
  1071. if test "$cf_check_cflags" != "$CFLAGS" ; then
  1072. AC_TRY_LINK([#include <stdio.h>],[printf("Hello world");],,
  1073. [CF_VERBOSE(test-compile failed. Undoing change to \$CFLAGS)
  1074. if test "$cf_check_cppflags" != "$CPPFLAGS" ; then
  1075. CF_VERBOSE(but keeping change to \$CPPFLAGS)
  1076. fi
  1077. CFLAGS="$cf_check_flags"])
  1078. fi
  1079. ])dnl
  1080. dnl ---------------------------------------------------------------------------
  1081. dnl CF_CHECK_ERRNO version: 9 updated: 2001/12/30 18:03:23
  1082. dnl --------------
  1083. dnl Check for data that is usually declared in <stdio.h> or <errno.h>, e.g.,
  1084. dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it
  1085. dnl ourselves.
  1086. dnl
  1087. dnl $1 = the name to check
  1088. AC_DEFUN([CF_CHECK_ERRNO],
  1089. [
  1090. AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[
  1091. AC_TRY_COMPILE([
  1092. #ifdef HAVE_STDLIB_H
  1093. #include <stdlib.h>
  1094. #endif
  1095. #include <stdio.h>
  1096. #include <sys/types.h>
  1097. #include <errno.h> ],
  1098. [long x = (long) $1],
  1099. [cf_cv_dcl_$1=yes],
  1100. [cf_cv_dcl_$1=no])
  1101. ])
  1102. if test "$cf_cv_dcl_$1" = no ; then
  1103. CF_UPPER(cf_result,decl_$1)
  1104. AC_DEFINE_UNQUOTED($cf_result)
  1105. fi
  1106. # It's possible (for near-UNIX clones) that the data doesn't exist
  1107. CF_CHECK_EXTERN_DATA($1,int)
  1108. ])dnl
  1109. dnl ---------------------------------------------------------------------------
  1110. dnl CF_CHECK_EXTERN_DATA version: 3 updated: 2001/12/30 18:03:23
  1111. dnl --------------------
  1112. dnl Check for existence of external data in the current set of libraries. If
  1113. dnl we can modify it, it's real enough.
  1114. dnl $1 = the name to check
  1115. dnl $2 = its type
  1116. AC_DEFUN([CF_CHECK_EXTERN_DATA],
  1117. [
  1118. AC_CACHE_CHECK(if external $1 exists, cf_cv_have_$1,[
  1119. AC_TRY_LINK([
  1120. #undef $1
  1121. extern $2 $1;
  1122. ],
  1123. [$1 = 2],
  1124. [cf_cv_have_$1=yes],
  1125. [cf_cv_have_$1=no])
  1126. ])
  1127. if test "$cf_cv_have_$1" = yes ; then
  1128. CF_UPPER(cf_result,have_$1)
  1129. AC_DEFINE_UNQUOTED($cf_result)
  1130. fi
  1131. ])dnl
  1132. dnl ---------------------------------------------------------------------------
  1133. dnl CF_CHECK_FUNCDECL version: 6 updated: 1999/03/30 12:24:31
  1134. dnl -----------------
  1135. dnl Check if a function is declared by including a set of include files.
  1136. dnl Invoke the corresponding actions according to whether it is found or not.
  1137. dnl
  1138. dnl Gcc (unlike other compilers) will only warn about the miscast assignment
  1139. dnl in the first test, but most compilers will oblige with an error in the
  1140. dnl second test.
  1141. dnl
  1142. dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  1143. AC_DEFUN([CF_CHECK_FUNCDECL],
  1144. [
  1145. AC_MSG_CHECKING([for $2 declaration])
  1146. AC_CACHE_VAL(ac_cv_func_decl_$2,
  1147. [AC_TRY_COMPILE([$1],
  1148. [#ifndef ${ac_func}
  1149. extern int ${ac_func}();
  1150. #endif],[
  1151. AC_TRY_COMPILE([$1],
  1152. [#ifndef ${ac_func}
  1153. int (*p)() = ${ac_func};
  1154. #endif],[
  1155. eval "ac_cv_func_decl_$2=yes"],[
  1156. eval "ac_cv_func_decl_$2=no"])],[
  1157. eval "ac_cv_func_decl_$2=yes"])])
  1158. if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
  1159. AC_MSG_RESULT(yes)
  1160. ifelse([$3], , :, [$3])
  1161. else
  1162. AC_MSG_RESULT(no)
  1163. ifelse([$4], , , [$4
  1164. ])dnl
  1165. fi
  1166. ])dnl
  1167. dnl ---------------------------------------------------------------------------
  1168. dnl CF_CHECK_FUNCDECLS version: 4 updated: 1999/03/30 12:24:31
  1169. dnl ------------------
  1170. dnl Check if functions are declared by including a set of include files.
  1171. dnl and define DECL_XXX if not.
  1172. dnl
  1173. dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
  1174. AC_DEFUN([CF_CHECK_FUNCDECLS],
  1175. [for ac_func in $2
  1176. do
  1177. CF_CHECK_FUNCDECL([$1], $ac_func,
  1178. [$3],
  1179. [
  1180. CF_UPPER(ac_tr_func,DECL_$ac_func)
  1181. AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
  1182. done
  1183. ])dnl
  1184. dnl ---------------------------------------------------------------------------
  1185. dnl CF_CHECK_IPV6 version: 3 updated: 2004/01/22 17:38:22
  1186. dnl -------------
  1187. dnl Check for IPV6 configuration.
  1188. AC_DEFUN([CF_CHECK_IPV6],[
  1189. CF_FIND_IPV6_TYPE
  1190. CF_FIND_IPV6_LIBS
  1191. CF_FUNC_GETADDRINFO
  1192. if test "$cf_cv_getaddrinfo" != "yes"; then
  1193. if test "$cf_cv_ipv6type" != "linux"; then
  1194. AC_MSG_WARN(
  1195. [You must get working getaddrinfo() function,
  1196. or you can specify "--disable-ipv6"])
  1197. else
  1198. AC_MSG_WARN(
  1199. [The getaddrinfo() implementation on your system seems be buggy.
  1200. You should upgrade your system library to the newest version
  1201. of GNU C library (aka glibc).])
  1202. fi
  1203. fi
  1204. ])dnl
  1205. dnl ---------------------------------------------------------------------------
  1206. dnl CF_CHECK_TYPE version: 1 updated: 2005/01/01 12:49:48
  1207. dnl -------------
  1208. dnl Add a 3rd parameter to AC_CHECK_TYPE, working around autoconf 2.5x's
  1209. dnl deliberate incompatibility.
  1210. dnl $1 = name of type to check for
  1211. dnl $2 = default type
  1212. dnl $3 = additional #include's and related preprocessor lines.
  1213. AC_DEFUN([CF_CHECK_TYPE],
  1214. [
  1215. ifdef([m4_version_compare],[
  1216. AC_CHECK_TYPE([$1],ac_cv_type_$1=yes,ac_cv_type_$1=no,[$3])
  1217. ],[
  1218. AC_MSG_CHECKING(for $1)
  1219. AC_TRY_COMPILE([
  1220. #if STDC_HEADERS
  1221. #include <stdlib.h>
  1222. #include <stddef.h>
  1223. #endif
  1224. $3
  1225. ],[
  1226. static $1 dummy; if (sizeof(dummy)) return 0; else return 1;],
  1227. ac_cv_type_$1=yes,
  1228. ac_cv_type_$1=no)
  1229. AC_MSG_RESULT($ac_cv_type_$1)
  1230. ])dnl
  1231. if test $ac_cv_type_$1 = no; then
  1232. AC_DEFINE($1, $2)
  1233. fi
  1234. ])dnl
  1235. dnl ---------------------------------------------------------------------------
  1236. dnl CF_COLOR_CURSES version: 6 updated: 2002/10/27 18:21:42
  1237. dnl ---------------
  1238. dnl Check if curses supports color. (Note that while SVr3 curses supports
  1239. dnl color, it does this differently from SVr4 curses; more work would be needed
  1240. dnl to accommodate SVr3).
  1241. dnl
  1242. AC_DEFUN([CF_COLOR_CURSES],
  1243. [
  1244. AC_MSG_CHECKING(if curses supports color attributes)
  1245. AC_CACHE_VAL(cf_cv_color_curses,[
  1246. AC_TRY_LINK([
  1247. #include <${cf_cv_ncurses_header-curses.h}>
  1248. ],
  1249. [chtype x = COLOR_BLUE;
  1250. has_colors();
  1251. start_color();
  1252. #ifndef NCURSES_BROKEN
  1253. wbkgd(curscr, getbkgd(stdscr)); /* X/Open XPG4 aka SVr4 Curses */
  1254. #endif
  1255. ],
  1256. [cf_cv_color_curses=yes],
  1257. [cf_cv_color_curses=no])
  1258. ])
  1259. AC_MSG_RESULT($cf_cv_color_curses)
  1260. if test $cf_cv_color_curses = yes ; then
  1261. AC_DEFINE(COLOR_CURSES)
  1262. test ".$cf_cv_ncurses_broken" != .yes && AC_DEFINE(HAVE_GETBKGD)
  1263. fi
  1264. ])dnl
  1265. dnl ---------------------------------------------------------------------------
  1266. dnl CF_CURSES_CPPFLAGS version: 9 updated: 2006/02/04 19:44:43
  1267. dnl ------------------
  1268. dnl Look for the curses headers.
  1269. AC_DEFUN([CF_CURSES_CPPFLAGS],[
  1270. AC_CACHE_CHECK(for extra include directories,cf_cv_curses_incdir,[
  1271. cf_cv_curses_incdir=no
  1272. case $host_os in #(vi
  1273. hpux10.*) #(vi
  1274. test -d /usr/include/curses_colr && \
  1275. cf_cv_curses_incdir="-I/usr/include/curses_colr"
  1276. ;;
  1277. sunos3*|sunos4*)
  1278. test -d /usr/5lib && \
  1279. test -d /usr/5include && \
  1280. cf_cv_curses_incdir="-I/usr/5include"
  1281. ;;
  1282. esac
  1283. ])
  1284. test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS"
  1285. CF_CURSES_HEADER
  1286. CF_TERM_HEADER
  1287. ])dnl
  1288. dnl ---------------------------------------------------------------------------
  1289. dnl CF_CURSES_FUNCS version: 12 updated: 2003/11/06 19:59:57
  1290. dnl ---------------
  1291. dnl Curses-functions are a little complicated, since a lot of them are macros.
  1292. AC_DEFUN([CF_CURSES_FUNCS],
  1293. [
  1294. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1295. AC_REQUIRE([CF_XOPEN_CURSES])
  1296. AC_REQUIRE([CF_CURSES_TERM_H])
  1297. for cf_func in $1
  1298. do
  1299. CF_UPPER(cf_tr_func,$cf_func)
  1300. AC_MSG_CHECKING(for ${cf_func})
  1301. CF_MSG_LOG(${cf_func})
  1302. AC_CACHE_VAL(cf_cv_func_$cf_func,[
  1303. eval cf_result='$ac_cv_func_'$cf_func
  1304. if test ".$cf_result" != ".no"; then
  1305. AC_TRY_LINK([
  1306. #ifdef HAVE_XCURSES
  1307. #include <xcurses.h>
  1308. char * XCursesProgramName = "test";
  1309. #else
  1310. #include <${cf_cv_ncurses_header-curses.h}>
  1311. #if defined(NCURSES_VERSION) && defined(HAVE_NCURSESW_TERM_H)
  1312. #include <ncursesw/term.h>
  1313. #else
  1314. #if defined(NCURSES_VERSION) && defined(HAVE_NCURSES_TERM_H)
  1315. #include <ncurses/term.h>
  1316. #else
  1317. #ifdef HAVE_TERM_H
  1318. #include <term.h>
  1319. #endif
  1320. #endif
  1321. #endif
  1322. #endif],
  1323. [
  1324. #ifndef ${cf_func}
  1325. long foo = (long)(&${cf_func});
  1326. exit(foo == 0);
  1327. #endif
  1328. ],
  1329. [cf_result=yes],
  1330. [cf_result=no])
  1331. fi
  1332. eval 'cf_cv_func_'$cf_func'=$cf_result'
  1333. ])
  1334. # use the computed/retrieved cache-value:
  1335. eval 'cf_result=$cf_cv_func_'$cf_func
  1336. AC_MSG_RESULT($cf_result)
  1337. if test $cf_result != no; then
  1338. AC_DEFINE_UNQUOTED(HAVE_${cf_tr_func})
  1339. fi
  1340. done
  1341. ])dnl
  1342. dnl ---------------------------------------------------------------------------
  1343. dnl CF_CURSES_HEADER version: 1 updated: 2005/12/31 13:28:25
  1344. dnl ----------------
  1345. dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
  1346. dnl variations of ncurses' installs.
  1347. dnl
  1348. dnl See also CF_NCURSES_HEADER, which sets the same cache variable.
  1349. AC_DEFUN([CF_CURSES_HEADER],[
  1350. AC_CACHE_CHECK(if we have identified curses headers,cf_cv_ncurses_header,[
  1351. cf_cv_ncurses_header=none
  1352. for cf_header in \
  1353. curses.h \
  1354. ncurses.h \
  1355. ncurses/curses.h \
  1356. ncurses/ncurses.h
  1357. do
  1358. AC_TRY_COMPILE([#include <${cf_header}>],
  1359. [initscr(); tgoto("?", 0,0)],
  1360. [cf_cv_ncurses_header=$cf_header; break],[])
  1361. done
  1362. ])
  1363. if test "$cf_cv_ncurses_header" = none ; then
  1364. AC_MSG_ERROR(No curses header-files found)
  1365. fi
  1366. # cheat, to get the right #define's for HAVE_NCURSES_H, etc.
  1367. AC_CHECK_HEADERS($cf_cv_ncurses_header)
  1368. ])dnl
  1369. dnl ---------------------------------------------------------------------------
  1370. dnl CF_CURSES_LIBS version: 24 updated: 2006/02/04 19:44:43
  1371. dnl --------------
  1372. dnl Look for the curses libraries. Older curses implementations may require
  1373. dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first.
  1374. AC_DEFUN([CF_CURSES_LIBS],[
  1375. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1376. AC_MSG_CHECKING(if we have identified curses libraries)
  1377. AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  1378. [initscr(); tgoto("?", 0,0)],
  1379. cf_result=yes,
  1380. cf_result=no)
  1381. AC_MSG_RESULT($cf_result)
  1382. if test "$cf_result" = no ; then
  1383. case $host_os in #(vi
  1384. freebsd*) #(vi
  1385. AC_CHECK_LIB(mytinfo,tgoto,[LIBS="-lmytinfo $LIBS"])
  1386. ;;
  1387. hpux10.*) #(vi
  1388. AC_CHECK_LIB(cur_colr,initscr,[
  1389. LIBS="-lcur_colr $LIBS"
  1390. ac_cv_func_initscr=yes
  1391. ],[
  1392. AC_CHECK_LIB(Hcurses,initscr,[
  1393. # HP's header uses __HP_CURSES, but user claims _HP_CURSES.
  1394. LIBS="-lHcurses $LIBS"
  1395. CPPFLAGS="-D__HP_CURSES -D_HP_CURSES $CPPFLAGS"
  1396. ac_cv_func_initscr=yes
  1397. ])])
  1398. ;;
  1399. linux*) # Suse Linux does not follow /usr/lib convention
  1400. LIBS="$LIBS -L/lib"
  1401. ;;
  1402. sunos3*|sunos4*)
  1403. test -d /usr/5lib && \
  1404. LIBS="$LIBS -L/usr/5lib -lcurses -ltermcap"
  1405. ac_cv_func_initscr=yes
  1406. ;;
  1407. esac
  1408. if test ".$ac_cv_func_initscr" != .yes ; then
  1409. cf_save_LIBS="$LIBS"
  1410. cf_term_lib=""
  1411. cf_curs_lib=""
  1412. if test ".${cf_cv_ncurses_version-no}" != .no
  1413. then
  1414. cf_check_list="ncurses curses cursesX"
  1415. else
  1416. cf_check_list="cursesX curses ncurses"
  1417. fi
  1418. # Check for library containing tgoto. Do this before curses library
  1419. # because it may be needed to link the test-case for initscr.
  1420. AC_CHECK_FUNC(tgoto,[cf_term_lib=predefined],[
  1421. for cf_term_lib in $cf_check_list termcap termlib unknown
  1422. do
  1423. AC_CHECK_LIB($cf_term_lib,tgoto,[break])
  1424. done
  1425. ])
  1426. # Check for library containing initscr
  1427. test "$cf_term_lib" != predefined && test "$cf_term_lib" != unknown && LIBS="-l$cf_term_lib $cf_save_LIBS"
  1428. for cf_curs_lib in $cf_check_list xcurses jcurses unknown
  1429. do
  1430. AC_CHECK_LIB($cf_curs_lib,initscr,[break])
  1431. done
  1432. test $cf_curs_lib = unknown && AC_ERROR(no curses library found)
  1433. LIBS="-l$cf_curs_lib $cf_save_LIBS"
  1434. if test "$cf_term_lib" = unknown ; then
  1435. AC_MSG_CHECKING(if we can link with $cf_curs_lib library)
  1436. AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  1437. [initscr()],
  1438. [cf_result=yes],
  1439. [cf_result=no])
  1440. AC_MSG_RESULT($cf_result)
  1441. test $cf_result = no && AC_ERROR(Cannot link curses library)
  1442. elif test "$cf_curs_lib" = "$cf_term_lib" ; then
  1443. :
  1444. elif test "$cf_term_lib" != predefined ; then
  1445. AC_MSG_CHECKING(if we need both $cf_curs_lib and $cf_term_lib libraries)
  1446. AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  1447. [initscr(); tgoto((char *)0, 0, 0);],
  1448. [cf_result=no],
  1449. [
  1450. LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS"
  1451. AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  1452. [initscr()],
  1453. [cf_result=yes],
  1454. [cf_result=error])
  1455. ])
  1456. AC_MSG_RESULT($cf_result)
  1457. fi
  1458. fi
  1459. fi
  1460. ])dnl
  1461. dnl ---------------------------------------------------------------------------
  1462. dnl CF_CURSES_TERM_H version: 6 updated: 2003/11/06 19:59:57
  1463. dnl ----------------
  1464. dnl SVr4 curses should have term.h as well (where it puts the definitions of
  1465. dnl the low-level interface). This may not be true in old/broken implementations,
  1466. dnl as well as in misconfigured systems (e.g., gcc configured for Solaris 2.4
  1467. dnl running with Solaris 2.5.1).
  1468. AC_DEFUN([CF_CURSES_TERM_H],
  1469. [
  1470. AC_CACHE_CHECK(for term.h, cf_cv_term_header,[
  1471. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  1472. # If we found <ncurses/curses.h>, look for <ncurses/term.h>, but always look
  1473. # for <term.h> if we do not find the variant.
  1474. for cf_header in \
  1475. `echo ${cf_cv_ncurses_header-curses.h} | sed -e 's%/.*%/%'`term.h \
  1476. term.h
  1477. do
  1478. AC_TRY_COMPILE([
  1479. #include <${cf_cv_ncurses_header-curses.h}>
  1480. #include <${cf_header}>],
  1481. [WINDOW *x],
  1482. [cf_cv_term_header=$cf_header
  1483. break],
  1484. [cf_cv_term_header=no])
  1485. done
  1486. ])
  1487. case $cf_cv_term_header in #(vi
  1488. term.h) #(vi
  1489. AC_DEFINE(HAVE_TERM_H)
  1490. ;;
  1491. ncurses/term.h)
  1492. AC_DEFINE(HAVE_NCURSES_TERM_H)
  1493. ;;
  1494. ncursesw/term.h)
  1495. AC_DEFINE(HAVE_NCURSESW_TERM_H)
  1496. ;;
  1497. esac
  1498. ])dnl
  1499. dnl ---------------------------------------------------------------------------
  1500. dnl CF_CURS_PERFORMANCE version: 3 updated: 1998/04/27 20:32:33
  1501. dnl -------------------
  1502. dnl Solaris 2.x curses provides a "performance" tradeoff according to whether
  1503. dnl CURS_PERFORMANCE is defined. If defined, the implementation defines macros
  1504. dnl that access the WINDOW structure. Otherwise, function calls are used.
  1505. AC_DEFUN([CF_CURS_PERFORMANCE],
  1506. [
  1507. AC_MSG_CHECKING([for curses performance tradeoff])
  1508. AC_CACHE_VAL(cf_cv_curs_performance,[
  1509. cf_cv_curs_performance=no
  1510. AC_TRY_COMPILE([
  1511. #include <${cf_cv_ncurses_header-curses.h}>],[
  1512. #if defined(wbkgdset) && defined(clearok) && defined(getbkgd)
  1513. int x = ERR;
  1514. #else
  1515. int x = ; /* force an error */
  1516. #endif
  1517. ],[
  1518. AC_TRY_COMPILE([
  1519. #define CURS_PERFORMANCE
  1520. #include <${cf_cv_ncurses_header-curses.h}>],[
  1521. #if defined(wbkgdset) && defined(clearok) && defined(getbkgd)
  1522. int x = ; /* force an error */
  1523. #else
  1524. int x = ERR;
  1525. #endif
  1526. ],[cf_cv_curs_performance=yes])])])
  1527. AC_MSG_RESULT($cf_cv_curs_performance)
  1528. test $cf_cv_curs_performance = yes && AC_DEFINE(CURS_PERFORMANCE)
  1529. ])dnl
  1530. dnl ---------------------------------------------------------------------------
  1531. dnl CF_CURS_TOUCHLINE version: 2 updated: 2001/05/13 13:42:46
  1532. dnl -----------------
  1533. dnl Check for the flavor of the touchline function, to distinguish between BSD
  1534. dnl and SYSV. This is needed on NetBSD 1.5 which has a partial implementation
  1535. dnl of SVR4 curses.
  1536. AC_DEFUN([CF_CURS_TOUCHLINE],[
  1537. AC_CACHE_CHECK(for curses touchline function,cf_cv_curs_touchline,[
  1538. AC_TRY_LINK([
  1539. #include <${cf_cv_ncurses_header-curses.h}>],
  1540. [touchline(stdscr, 1,2,3);],
  1541. [cf_cv_curs_touchline=bsd],
  1542. [AC_TRY_LINK([
  1543. #include <${cf_cv_ncurses_header-curses.h}>],
  1544. [touchline(stdscr, 1,2);],
  1545. [cf_cv_curs_touchline=sysv],
  1546. [cf_cv_curs_touchline=bsd])])])
  1547. case "$cf_cv_curs_touchline" in #(vi
  1548. bsd) #(vi
  1549. AC_DEFINE(HAVE_BSD_TOUCHLINE)
  1550. ;;
  1551. sysv)
  1552. AC_DEFINE(HAVE_SYSV_TOUCHLINE)
  1553. ;;
  1554. esac
  1555. ])dnl
  1556. dnl ---------------------------------------------------------------------------
  1557. dnl CF_DEFINE_PROG version: 3 updated: 2002/10/27 18:21:42
  1558. dnl --------------
  1559. dnl Check for a program in the given list $3, defining the corresponding
  1560. dnl program variable $2.
  1561. dnl
  1562. AC_DEFUN([CF_DEFINE_PROG],[
  1563. AC_MSG_CHECKING(for $1)
  1564. AC_CACHE_VAL(cf_cv_$2,[
  1565. cf_cv_$2=unknown
  1566. for cv_path in $3
  1567. do
  1568. if test -f $cv_path ; then
  1569. cf_cv_$2=$cv_path
  1570. break
  1571. fi
  1572. done
  1573. ])
  1574. AC_MSG_RESULT($cf_cv_$2)
  1575. AC_DEFINE_UNQUOTED($2,"$cf_cv_$2")
  1576. ])dnl
  1577. dnl ---------------------------------------------------------------------------
  1578. dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52
  1579. dnl ----------
  1580. dnl "dirname" is not portable, so we fake it with a shell script.
  1581. AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl
  1582. dnl ---------------------------------------------------------------------------
  1583. dnl CF_DISABLE_ECHO version: 10 updated: 2003/04/17 22:27:11
  1584. dnl ---------------
  1585. dnl You can always use "make -n" to see the actual options, but it's hard to
  1586. dnl pick out/analyze warning messages when the compile-line is long.
  1587. dnl
  1588. dnl Sets:
  1589. dnl ECHO_LT - symbol to control if libtool is verbose
  1590. dnl ECHO_LD - symbol to prefix "cc -o" lines
  1591. dnl RULE_CC - symbol to put before implicit "cc -c" lines (e.g., .c.o)
  1592. dnl SHOW_CC - symbol to put before explicit "cc -c" lines
  1593. dnl ECHO_CC - symbol to put before any "cc" line
  1594. dnl
  1595. AC_DEFUN([CF_DISABLE_ECHO],[
  1596. AC_MSG_CHECKING(if you want to see long compiling messages)
  1597. CF_ARG_DISABLE(echo,
  1598. [ --disable-echo display "compiling" commands],
  1599. [
  1600. ECHO_LT='--silent'
  1601. ECHO_LD='@echo linking [$]@;'
  1602. RULE_CC=' @echo compiling [$]<'
  1603. SHOW_CC=' @echo compiling [$]@'
  1604. ECHO_CC='@'
  1605. ],[
  1606. ECHO_LT=''
  1607. ECHO_LD=''
  1608. RULE_CC='# compiling'
  1609. SHOW_CC='# compiling'
  1610. ECHO_CC=''
  1611. ])
  1612. AC_MSG_RESULT($enableval)
  1613. AC_SUBST(ECHO_LT)
  1614. AC_SUBST(ECHO_LD)
  1615. AC_SUBST(RULE_CC)
  1616. AC_SUBST(SHOW_CC)
  1617. AC_SUBST(ECHO_CC)
  1618. ])dnl
  1619. dnl ---------------------------------------------------------------------------
  1620. dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39
  1621. dnl --------
  1622. dnl Check if 'errno' is declared in <errno.h>
  1623. AC_DEFUN([CF_ERRNO],
  1624. [
  1625. CF_CHECK_ERRNO(errno)
  1626. ])dnl
  1627. dnl ---------------------------------------------------------------------------
  1628. dnl CF_FANCY_CURSES version: 4 updated: 2002/10/27 18:21:42
  1629. dnl ---------------
  1630. AC_DEFUN([CF_FANCY_CURSES],
  1631. [
  1632. AC_MSG_CHECKING(if curses supports fancy attributes)
  1633. AC_CACHE_VAL(cf_cv_fancy_curses,[
  1634. AC_TRY_LINK([
  1635. #include <${cf_cv_ncurses_header-curses.h}>
  1636. ],
  1637. [attrset(A_UNDERLINE|A_BOLD|A_REVERSE);
  1638. wattrset(stdscr, A_BLINK|A_DIM);
  1639. attroff(A_BOLD);
  1640. keypad(stdscr,TRUE);
  1641. ],
  1642. [cf_cv_fancy_curses=yes],
  1643. [cf_cv_fancy_curses=no])
  1644. ])
  1645. AC_MSG_RESULT($cf_cv_fancy_curses)
  1646. test $cf_cv_fancy_curses = yes && AC_DEFINE(FANCY_CURSES)
  1647. ])dnl
  1648. dnl ---------------------------------------------------------------------------
  1649. dnl CF_FIND_HEADER version: 1 updated: 2006/01/22 20:26:00
  1650. dnl --------------
  1651. dnl Find a header file, searching for it if it is not already in the include
  1652. dnl path.
  1653. dnl
  1654. dnl $1 = the header filename
  1655. dnl $2 = the package name
  1656. dnl $3 = action to perform if successful
  1657. dnl $4 = action to perform if not successful
  1658. AC_DEFUN([CF_FIND_HEADER],[
  1659. AC_CHECK_HEADER([$1],
  1660. cf_find_header=yes,[
  1661. cf_find_header=no
  1662. CF_HEADER_PATH(cf_search,$2)
  1663. for cf_incdir in $cf_search
  1664. do
  1665. if test -f $cf_incdir/$1 ; then
  1666. CF_ADD_CFLAGS(-I$cf_incdir)
  1667. CF_VERBOSE(... found in $cf_incdir)
  1668. cf_find_header=yes
  1669. break
  1670. fi
  1671. CF_VERBOSE(... tested $cf_incdir)
  1672. done
  1673. ])
  1674. if test "$cf_find_header" = yes ; then
  1675. ifelse([$3],,:,[$3])
  1676. ifelse([$4],,,[else
  1677. $4])
  1678. fi
  1679. ])dnl
  1680. dnl ---------------------------------------------------------------------------
  1681. dnl CF_FIND_IPV6_LIBS version: 6 updated: 2002/11/09 09:05:18
  1682. dnl -----------------
  1683. dnl Based on the IPV6 stack type, look for the corresponding library.
  1684. AC_DEFUN([CF_FIND_IPV6_LIBS],[
  1685. AC_REQUIRE([CF_FIND_IPV6_TYPE])
  1686. cf_ipv6lib=none
  1687. cf_ipv6dir=none
  1688. AC_MSG_CHECKING(for IPv6 library if required)
  1689. case $cf_cv_ipv6type in #(vi
  1690. solaris) #(vi
  1691. ;;
  1692. inria) #(vi
  1693. ;;
  1694. kame) #(vi
  1695. dnl http://www.kame.net/
  1696. cf_ipv6lib=inet6
  1697. cf_ipv6dir=v6
  1698. ;;
  1699. linux-glibc) #(vi
  1700. ;;
  1701. linux-libinet6) #(vi
  1702. dnl http://www.v6.linux.or.jp/
  1703. cf_ipv6lib=inet6
  1704. cf_ipv6dir=inet6
  1705. ;;
  1706. toshiba) #(vi
  1707. cf_ipv6lib=inet6
  1708. cf_ipv6dir=v6
  1709. ;;
  1710. v6d) #(vi
  1711. cf_ipv6lib=v6
  1712. cf_ipv6dir=v6
  1713. ;;
  1714. zeta)
  1715. cf_ipv6lib=inet6
  1716. cf_ipv6dir=v6
  1717. ;;
  1718. esac
  1719. AC_MSG_RESULT($cf_ipv6lib)
  1720. if test "$cf_ipv6lib" != "none"; then
  1721. AC_TRY_LINK([
  1722. #include <sys/types.h>
  1723. #include <netdb.h>
  1724. #include <netinet/in.h>
  1725. #include <netinet/ip6.h>],
  1726. [getaddrinfo(0, 0, 0, 0)],,[
  1727. CF_HEADER_PATH(cf_search,$cf_ipv6dir)
  1728. for cf_incdir in $cf_search
  1729. do
  1730. cf_header=$cf_incdir/netinet/ip6.h
  1731. if test -f $cf_header
  1732. then
  1733. CPPFLAGS="$CPPFLAGS -I$cf_incdir"
  1734. test -n "$verbose" && echo " ... found $cf_header" 1>&AC_FD_MSG
  1735. break
  1736. fi
  1737. test -n "$verbose" && echo " ... tested $cf_header" 1>&AC_FD_MSG
  1738. done
  1739. ])
  1740. CF_FIND_LIBRARY([$cf_ipv6lib],[$cf_ipv6dir],[
  1741. #include <sys/types.h>
  1742. #include <netdb.h>
  1743. #include <netinet/in.h>
  1744. #include <netinet/ip6.h>],
  1745. [getaddrinfo(0, 0, 0, 0)],
  1746. [getaddrinfo],
  1747. noexit)
  1748. if test $cf_found_library = no ; then
  1749. AC_MSG_ERROR(
  1750. [No $cf_ipv6lib library found, cannot continue. You must fetch lib$cf_ipv6lib.a
  1751. from an appropriate IPv6 kit and compile beforehand.])
  1752. fi
  1753. fi
  1754. ])dnl
  1755. dnl ---------------------------------------------------------------------------
  1756. dnl CF_FIND_IPV6_TYPE version: 5 updated: 2001/10/11 20:46:17
  1757. dnl -----------------
  1758. AC_DEFUN([CF_FIND_IPV6_TYPE],[
  1759. AC_CACHE_CHECK(ipv6 stack type, cf_cv_ipv6type, [
  1760. cf_cv_ipv6type=unknown
  1761. for i in solaris inria kame linux-glibc linux-libinet6 toshiba v6d zeta
  1762. do
  1763. case $i in #(vi
  1764. solaris) #(vi
  1765. if test "SunOS" = "`uname -s`"
  1766. then
  1767. if test -f /usr/include/netinet/ip6.h
  1768. then
  1769. cf_cv_ipv6type=$i
  1770. fi
  1771. fi
  1772. ;;
  1773. inria) #(vi
  1774. dnl http://www.kame.net/
  1775. AC_EGREP_CPP(yes, [
  1776. #include <netinet/in.h>
  1777. #ifdef IPV6_INRIA_VERSION
  1778. yes
  1779. #endif], [cf_cv_ipv6type=$i])
  1780. ;;
  1781. kame) #(vi
  1782. dnl http://www.kame.net/
  1783. AC_EGREP_CPP(yes, [
  1784. #include <netinet/in.h>
  1785. #ifdef __KAME__
  1786. yes
  1787. #endif], [cf_cv_ipv6type=$i])
  1788. ;;
  1789. linux-glibc) #(vi
  1790. dnl http://www.v6.linux.or.jp/
  1791. AC_EGREP_CPP(yes, [
  1792. #include <features.h>
  1793. #if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
  1794. yes
  1795. #endif], [cf_cv_ipv6type=$i])
  1796. ;;
  1797. linux-libinet6) #(vi
  1798. dnl http://www.v6.linux.or.jp/
  1799. if test -d /usr/inet6
  1800. then
  1801. cf_cv_ipv6type=$i
  1802. elif test -f /usr/include/netinet/ip6.h
  1803. then
  1804. cf_cv_ipv6type=$i
  1805. fi
  1806. ;;
  1807. toshiba) #(vi
  1808. AC_EGREP_CPP(yes, [
  1809. #include <sys/param.h>
  1810. #ifdef _TOSHIBA_INET6
  1811. yes
  1812. #endif], [cf_cv_ipv6type=$i])
  1813. ;;
  1814. v6d) #(vi
  1815. AC_EGREP_CPP(yes, [
  1816. #include </usr/local/v6/include/sys/v6config.h>
  1817. #ifdef __V6D__
  1818. yes
  1819. #endif], [cf_cv_ipv6type=$i])
  1820. ;;
  1821. zeta)
  1822. AC_EGREP_CPP(yes, [
  1823. #include <sys/param.h>
  1824. #ifdef _ZETA_MINAMI_INET6
  1825. yes
  1826. #endif], [cf_cv_ipv6type=$i])
  1827. ;;
  1828. esac
  1829. if test "$cf_cv_ipv6type" != "unknown"; then
  1830. break
  1831. fi
  1832. done
  1833. ])
  1834. ])dnl
  1835. dnl ---------------------------------------------------------------------------
  1836. dnl CF_FIND_LIBRARY version: 8 updated: 2004/11/23 20:14:58
  1837. dnl ---------------
  1838. dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We
  1839. dnl prefer a standard location, and use -L options only if we do not find the
  1840. dnl library in the standard library location(s).
  1841. dnl $1 = library name
  1842. dnl $2 = library class, usually the same as library name
  1843. dnl $3 = includes
  1844. dnl $4 = code fragment to compile/link
  1845. dnl $5 = corresponding function-name
  1846. dnl $6 = flag, nonnull if failure should not cause an error-exit
  1847. dnl
  1848. dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had
  1849. dnl to use a -L option.
  1850. AC_DEFUN([CF_FIND_LIBRARY],
  1851. [
  1852. eval 'cf_cv_have_lib_'$1'=no'
  1853. cf_libdir=""
  1854. AC_CHECK_FUNC($5,
  1855. eval 'cf_cv_have_lib_'$1'=yes',[
  1856. cf_save_LIBS="$LIBS"
  1857. AC_MSG_CHECKING(for $5 in -l$1)
  1858. LIBS="-l$1 $LIBS"
  1859. AC_TRY_LINK([$3],[$4],
  1860. [AC_MSG_RESULT(yes)
  1861. eval 'cf_cv_have_lib_'$1'=yes'
  1862. ],
  1863. [AC_MSG_RESULT(no)
  1864. CF_LIBRARY_PATH(cf_search,$2)
  1865. for cf_libdir in $cf_search
  1866. do
  1867. AC_MSG_CHECKING(for -l$1 in $cf_libdir)
  1868. LIBS="-L$cf_libdir -l$1 $cf_save_LIBS"
  1869. AC_TRY_LINK([$3],[$4],
  1870. [AC_MSG_RESULT(yes)
  1871. eval 'cf_cv_have_lib_'$1'=yes'
  1872. break],
  1873. [AC_MSG_RESULT(no)
  1874. LIBS="$cf_save_LIBS"])
  1875. done
  1876. ])
  1877. ])
  1878. eval 'cf_found_library=[$]cf_cv_have_lib_'$1
  1879. ifelse($6,,[
  1880. if test $cf_found_library = no ; then
  1881. AC_ERROR(Cannot link $1 library)
  1882. fi
  1883. ])
  1884. ])dnl
  1885. dnl ---------------------------------------------------------------------------
  1886. dnl CF_FIND_LINKAGE version: 1 updated: 2006/01/22 20:26:00
  1887. dnl ---------------
  1888. dnl Find a library, searching for it if it is not already in the library path.
  1889. dnl
  1890. dnl $1 = headers for library entrypoint
  1891. dnl $2 = code fragment for library entrypoint
  1892. dnl $3 = the library name without the "-l" option or ".so" suffix.
  1893. dnl $4 = action to perform if successful
  1894. dnl $5 = action to perform if not successful
  1895. AC_DEFUN([CF_FIND_LINKAGE],[
  1896. AC_TRY_LINK([$1],[$2],
  1897. cf_find_linkage=yes,[
  1898. cf_find_linkage=no
  1899. CF_LIBRARY_PATH(cf_search,$3)
  1900. cf_save_LIBS="$LIBS"
  1901. cf_save_LDFLAGS="$LDFLAGS"
  1902. for cf_libdir in $cf_search
  1903. do
  1904. if test -d $cf_libdir ; then
  1905. LIBS="-l$3 $cf_save_LIBS"
  1906. LDFLAGS="$cf_save_LDFLAGS -L$cf_libdir"
  1907. AC_TRY_LINK([$1],[$2],[
  1908. CF_VERBOSE(... found in $cf_libdir)
  1909. cf_find_linkage=yes
  1910. break],[
  1911. LIBS="$cf_save_LIBS"
  1912. LDFLAGS="$cf_save_LDFLAGS"])
  1913. fi
  1914. CF_VERBOSE(... tested $cf_libdir)
  1915. done
  1916. ])
  1917. if test "$cf_find_linkage" = yes ; then
  1918. ifelse([$4],,:,[$4])
  1919. ifelse([$5],,,[else
  1920. $5])
  1921. fi
  1922. ])dnl
  1923. dnl ---------------------------------------------------------------------------
  1924. dnl CF_FIONBIO version: 2 updated: 1998/02/24 06:51:46
  1925. dnl ----------
  1926. dnl Check for availability of fcntl versus ioctl(,FIONBIO,). Lynx uses this
  1927. dnl for Sequent (ptx), and it is needed for OS/2 EMX.
  1928. AC_DEFUN([CF_FIONBIO],
  1929. [
  1930. AC_CACHE_CHECK(if we should use fcntl or ioctl,cf_cv_fionbio,[
  1931. AC_TRY_LINK([
  1932. #include <sys/types.h>
  1933. #include <sys/ioctl.h>
  1934. ],[
  1935. int ret = ioctl(0, FIONBIO, (char *)0);
  1936. ],[cf_cv_fionbio=ioctl],[
  1937. AC_TRY_LINK([
  1938. #include <sys/types.h>
  1939. #if HAVE_FCNTL_H
  1940. #include <fcntl.h>
  1941. #else
  1942. #if HAVE_SYS_FCNTL_H
  1943. #include <sys/fcntl.h>
  1944. #endif
  1945. #endif],[
  1946. int ret = fcntl(0, F_SETFL, O_NONBLOCK);
  1947. ],
  1948. [cf_cv_fionbio=fcntl],
  1949. [cf_cv_fionbio=unknown])])
  1950. ])
  1951. test "$cf_cv_fionbio" = "fcntl" && AC_DEFINE(USE_FCNTL)
  1952. ])dnl
  1953. dnl ---------------------------------------------------------------------------
  1954. dnl CF_FUNC_CURSES_VERSION version: 3 updated: 2003/05/17 22:19:02
  1955. dnl ----------------------
  1956. dnl Solaris has a data item 'curses_version', which confuses AC_CHECK_FUNCS.
  1957. dnl It's a character string "SVR4", not documented.
  1958. AC_DEFUN([CF_FUNC_CURSES_VERSION],
  1959. [
  1960. AC_CACHE_CHECK(for function curses_version, cf_cv_func_curses_version,[
  1961. AC_TRY_RUN([
  1962. #include <${cf_cv_ncurses_header-curses.h}>
  1963. int main()
  1964. {
  1965. char temp[1024];
  1966. sprintf(temp, "%s\n", curses_version());
  1967. exit(0);
  1968. }]
  1969. ,[cf_cv_func_curses_version=yes]
  1970. ,[cf_cv_func_curses_version=no]
  1971. ,[cf_cv_func_curses_version=unknown])
  1972. rm -f core])
  1973. test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION)
  1974. ])
  1975. dnl ---------------------------------------------------------------------------
  1976. dnl CF_FUNC_GETADDRINFO version: 5 updated: 2000/09/28 06:18:08
  1977. dnl -------------------
  1978. dnl Look for a working version of getaddrinfo(), for IPV6 support.
  1979. AC_DEFUN([CF_FUNC_GETADDRINFO],[
  1980. AC_CACHE_CHECK(working getaddrinfo, cf_cv_getaddrinfo,[
  1981. AC_TRY_RUN([
  1982. #include <sys/types.h>
  1983. #include <netdb.h>
  1984. #include <string.h>
  1985. #include <sys/socket.h>
  1986. #include <netinet/in.h>
  1987. #define expect(a,b) if (strcmp(a,b) != 0) goto bad
  1988. int main()
  1989. {
  1990. int passive, gaierr, inet4 = 0, inet6 = 0;
  1991. struct addrinfo hints, *ai, *aitop;
  1992. char straddr[INET6_ADDRSTRLEN], strport[16];
  1993. for (passive = 0; passive <= 1; passive++) {
  1994. memset(&hints, 0, sizeof(hints));
  1995. hints.ai_family = AF_UNSPEC;
  1996. hints.ai_flags = passive ? AI_PASSIVE : 0;
  1997. hints.ai_socktype = SOCK_STREAM;
  1998. if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
  1999. (void)gai_strerror(gaierr);
  2000. goto bad;
  2001. }
  2002. for (ai = aitop; ai; ai = ai->ai_next) {
  2003. if (ai->ai_addr == NULL ||
  2004. ai->ai_addrlen == 0 ||
  2005. getnameinfo(ai->ai_addr, ai->ai_addrlen,
  2006. straddr, sizeof(straddr), strport, sizeof(strport),
  2007. NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
  2008. goto bad;
  2009. }
  2010. switch (ai->ai_family) {
  2011. case AF_INET:
  2012. expect(strport, "54321");
  2013. if (passive) {
  2014. expect(straddr, "0.0.0.0");
  2015. } else {
  2016. expect(straddr, "127.0.0.1");
  2017. }
  2018. inet4++;
  2019. break;
  2020. case AF_INET6:
  2021. expect(strport, "54321");
  2022. if (passive) {
  2023. expect(straddr, "::");
  2024. } else {
  2025. expect(straddr, "::1");
  2026. }
  2027. inet6++;
  2028. break;
  2029. case AF_UNSPEC:
  2030. goto bad;
  2031. break;
  2032. default:
  2033. /* another family support? */
  2034. break;
  2035. }
  2036. }
  2037. }
  2038. if (!(inet4 == 0 || inet4 == 2))
  2039. goto bad;
  2040. if (!(inet6 == 0 || inet6 == 2))
  2041. goto bad;
  2042. if (aitop)
  2043. freeaddrinfo(aitop);
  2044. exit(0);
  2045. bad:
  2046. if (aitop)
  2047. freeaddrinfo(aitop);
  2048. exit(1);
  2049. }
  2050. ],
  2051. [cf_cv_getaddrinfo=yes],
  2052. [cf_cv_getaddrinfo=no],
  2053. [cf_cv_getaddrinfo=unknown])
  2054. ])
  2055. if test "$cf_cv_getaddrinfo" = yes ; then
  2056. AC_DEFINE(HAVE_GAI_STRERROR)
  2057. AC_DEFINE(HAVE_GETADDRINFO)
  2058. fi
  2059. ])dnl
  2060. dnl ---------------------------------------------------------------------------
  2061. dnl CF_FUNC_LSTAT version: 2 updated: 1997/09/07 13:00:21
  2062. dnl -------------
  2063. dnl A conventional existence-check for 'lstat' won't work with the Linux
  2064. dnl version of gcc 2.7.0, since the symbol is defined only within <sys/stat.h>
  2065. dnl as an inline function.
  2066. dnl
  2067. dnl So much for portability.
  2068. AC_DEFUN([CF_FUNC_LSTAT],
  2069. [
  2070. AC_MSG_CHECKING(for lstat)
  2071. AC_CACHE_VAL(ac_cv_func_lstat,[
  2072. AC_TRY_LINK([
  2073. #include <sys/types.h>
  2074. #include <sys/stat.h>],
  2075. [lstat(".", (struct stat *)0)],
  2076. [ac_cv_func_lstat=yes],
  2077. [ac_cv_func_lstat=no])
  2078. ])
  2079. AC_MSG_RESULT($ac_cv_func_lstat )
  2080. if test $ac_cv_func_lstat = yes; then
  2081. AC_DEFINE(HAVE_LSTAT)
  2082. fi
  2083. ])dnl
  2084. dnl ---------------------------------------------------------------------------
  2085. dnl CF_FUNC_SIGACTION version: 2 updated: 1999/07/28 06:09:35
  2086. dnl -----------------
  2087. dnl Check if we have the sigaction function and related structures.
  2088. AC_DEFUN([CF_FUNC_SIGACTION],[
  2089. AC_CACHE_CHECK(for sigaction and structs,cf_cv_func_sigaction,[
  2090. AC_TRY_LINK([
  2091. #include <sys/types.h>
  2092. #include <signal.h>],
  2093. [struct sigaction act;
  2094. act.sa_handler = SIG_DFL;
  2095. #ifdef SA_RESTART
  2096. act.sa_flags |= SA_RESTART;
  2097. #endif /* SA_RESTART */
  2098. sigaction(1, &act, 0);
  2099. ],
  2100. [cf_cv_func_sigaction=yes],
  2101. [cf_cv_func_sigaction=no])
  2102. ])
  2103. test "$cf_cv_func_sigaction" = yes && AC_DEFINE(HAVE_SIGACTION)
  2104. ])dnl
  2105. dnl ---------------------------------------------------------------------------
  2106. dnl CF_FUNC_WAIT version: 2 updated: 1997/10/21 19:45:33
  2107. dnl ------------
  2108. dnl Test for the presence of <sys/wait.h>, 'union wait', arg-type of 'wait()'
  2109. dnl and/or 'waitpid()'.
  2110. dnl
  2111. dnl Note that we cannot simply grep for 'union wait' in the wait.h file,
  2112. dnl because some Posix systems turn this on only when a BSD variable is
  2113. dnl defined.
  2114. dnl
  2115. dnl I don't use AC_HEADER_SYS_WAIT, because it defines HAVE_SYS_WAIT_H, which
  2116. dnl would conflict with an attempt to test that header directly.
  2117. dnl
  2118. AC_DEFUN([CF_FUNC_WAIT],
  2119. [
  2120. AC_REQUIRE([CF_UNION_WAIT])
  2121. if test $cf_cv_type_unionwait = yes; then
  2122. AC_MSG_CHECKING(if union wait can be used as wait-arg)
  2123. AC_CACHE_VAL(cf_cv_arg_union_wait,[
  2124. AC_TRY_COMPILE($cf_wait_headers,
  2125. [union wait x; wait(&x)],
  2126. [cf_cv_arg_union_wait=yes],
  2127. [cf_cv_arg_union_wait=no])
  2128. ])
  2129. AC_MSG_RESULT($cf_cv_arg_union_wait)
  2130. test $cf_cv_arg_union_wait = yes && AC_DEFINE(WAIT_USES_UNION)
  2131. AC_MSG_CHECKING(if union wait can be used as waitpid-arg)
  2132. AC_CACHE_VAL(cf_cv_arg_union_waitpid,[
  2133. AC_TRY_COMPILE($cf_wait_headers,
  2134. [union wait x; waitpid(0, &x, 0)],
  2135. [cf_cv_arg_union_waitpid=yes],
  2136. [cf_cv_arg_union_waitpid=no])
  2137. ])
  2138. AC_MSG_RESULT($cf_cv_arg_union_waitpid)
  2139. test $cf_cv_arg_union_waitpid = yes && AC_DEFINE(WAITPID_USES_UNION)
  2140. fi
  2141. ])dnl
  2142. dnl ---------------------------------------------------------------------------
  2143. dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28
  2144. dnl -----------------
  2145. dnl Test for availability of useful gcc __attribute__ directives to quiet
  2146. dnl compiler warnings. Though useful, not all are supported -- and contrary
  2147. dnl to documentation, unrecognized directives cause older compilers to barf.
  2148. AC_DEFUN([CF_GCC_ATTRIBUTES],
  2149. [
  2150. if test "$GCC" = yes
  2151. then
  2152. cat > conftest.i <<EOF
  2153. #ifndef GCC_PRINTF
  2154. #define GCC_PRINTF 0
  2155. #endif
  2156. #ifndef GCC_SCANF
  2157. #define GCC_SCANF 0
  2158. #endif
  2159. #ifndef GCC_NORETURN
  2160. #define GCC_NORETURN /* nothing */
  2161. #endif
  2162. #ifndef GCC_UNUSED
  2163. #define GCC_UNUSED /* nothing */
  2164. #endif
  2165. EOF
  2166. if test "$GCC" = yes
  2167. then
  2168. AC_CHECKING([for $CC __attribute__ directives])
  2169. cat > conftest.$ac_ext <<EOF
  2170. #line __oline__ "configure"
  2171. #include "confdefs.h"
  2172. #include "conftest.h"
  2173. #include "conftest.i"
  2174. #if GCC_PRINTF
  2175. #define GCC_PRINTFLIKE(fmt,var) __attribute__((format(printf,fmt,var)))
  2176. #else
  2177. #define GCC_PRINTFLIKE(fmt,var) /*nothing*/
  2178. #endif
  2179. #if GCC_SCANF
  2180. #define GCC_SCANFLIKE(fmt,var) __attribute__((format(scanf,fmt,var)))
  2181. #else
  2182. #define GCC_SCANFLIKE(fmt,var) /*nothing*/
  2183. #endif
  2184. extern void wow(char *,...) GCC_SCANFLIKE(1,2);
  2185. extern void oops(char *,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN;
  2186. extern void foo(void) GCC_NORETURN;
  2187. int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; }
  2188. EOF
  2189. for cf_attribute in scanf printf unused noreturn
  2190. do
  2191. CF_UPPER(cf_ATTRIBUTE,$cf_attribute)
  2192. cf_directive="__attribute__(($cf_attribute))"
  2193. echo "checking for $CC $cf_directive" 1>&AC_FD_CC
  2194. case $cf_attribute in
  2195. scanf|printf)
  2196. cat >conftest.h <<EOF
  2197. #define GCC_$cf_ATTRIBUTE 1
  2198. EOF
  2199. ;;
  2200. *)
  2201. cat >conftest.h <<EOF
  2202. #define GCC_$cf_ATTRIBUTE $cf_directive
  2203. EOF
  2204. ;;
  2205. esac
  2206. if AC_TRY_EVAL(ac_compile); then
  2207. test -n "$verbose" && AC_MSG_RESULT(... $cf_attribute)
  2208. cat conftest.h >>confdefs.h
  2209. fi
  2210. done
  2211. else
  2212. fgrep define conftest.i >>confdefs.h
  2213. fi
  2214. rm -rf conftest*
  2215. fi
  2216. ])dnl
  2217. dnl ---------------------------------------------------------------------------
  2218. dnl CF_GCC_VERSION version: 4 updated: 2005/08/27 09:53:42
  2219. dnl --------------
  2220. dnl Find version of gcc
  2221. AC_DEFUN([CF_GCC_VERSION],[
  2222. AC_REQUIRE([AC_PROG_CC])
  2223. GCC_VERSION=none
  2224. if test "$GCC" = yes ; then
  2225. AC_MSG_CHECKING(version of $CC)
  2226. GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`"
  2227. test -z "$GCC_VERSION" && GCC_VERSION=unknown
  2228. AC_MSG_RESULT($GCC_VERSION)
  2229. fi
  2230. ])dnl
  2231. dnl ---------------------------------------------------------------------------
  2232. dnl CF_GCC_WARNINGS version: 20 updated: 2005/08/06 18:37:29
  2233. dnl ---------------
  2234. dnl Check if the compiler supports useful warning options. There's a few that
  2235. dnl we don't use, simply because they're too noisy:
  2236. dnl
  2237. dnl -Wconversion (useful in older versions of gcc, but not in gcc 2.7.x)
  2238. dnl -Wredundant-decls (system headers make this too noisy)
  2239. dnl -Wtraditional (combines too many unrelated messages, only a few useful)
  2240. dnl -Wwrite-strings (too noisy, but should review occasionally). This
  2241. dnl is enabled for ncurses using "--enable-const".
  2242. dnl -pedantic
  2243. dnl
  2244. dnl Parameter:
  2245. dnl $1 is an optional list of gcc warning flags that a particular
  2246. dnl application might want to use, e.g., "no-unused" for
  2247. dnl -Wno-unused
  2248. dnl Special:
  2249. dnl If $with_ext_const is "yes", add a check for -Wwrite-strings
  2250. dnl
  2251. AC_DEFUN([CF_GCC_WARNINGS],
  2252. [
  2253. AC_REQUIRE([CF_GCC_VERSION])
  2254. CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS)
  2255. cat > conftest.$ac_ext <<EOF
  2256. #line __oline__ "configure"
  2257. int main(int argc, char *argv[[]]) { return (argv[[argc-1]] == 0) ; }
  2258. EOF
  2259. if test "$INTEL_COMPILER" = yes
  2260. then
  2261. # The "-wdXXX" options suppress warnings:
  2262. # remark #1419: external declaration in primary source file
  2263. # remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
  2264. # remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem)
  2265. # remark #1684: conversion from pointer to same-sized integral type (potential portability problem)
  2266. # remark #193: zero used for undefined preprocessing identifier
  2267. # remark #593: variable "curs_sb_left_arrow" was set but never used
  2268. # remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits
  2269. # remark #869: parameter "tw" was never referenced
  2270. # remark #981: operands are evaluated in unspecified order
  2271. # warning #269: invalid format string conversion
  2272. AC_CHECKING([for $CC warning options])
  2273. cf_save_CFLAGS="$CFLAGS"
  2274. EXTRA_CFLAGS="-Wall"
  2275. for cf_opt in $1 \
  2276. wd1419 \
  2277. wd1682 \
  2278. wd1683 \
  2279. wd1684 \
  2280. wd193 \
  2281. wd279 \
  2282. wd593 \
  2283. wd810 \
  2284. wd869 \
  2285. wd981
  2286. do
  2287. CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
  2288. if AC_TRY_EVAL(ac_compile); then
  2289. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  2290. EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
  2291. fi
  2292. done
  2293. CFLAGS="$cf_save_CFLAGS"
  2294. elif test "$GCC" = yes
  2295. then
  2296. AC_CHECKING([for $CC warning options])
  2297. cf_save_CFLAGS="$CFLAGS"
  2298. EXTRA_CFLAGS="-W -Wall"
  2299. cf_warn_CONST=""
  2300. test "$with_ext_const" = yes && cf_warn_CONST="Wwrite-strings"
  2301. for cf_opt in \
  2302. Wbad-function-cast \
  2303. Wcast-align \
  2304. Wcast-qual \
  2305. Winline \
  2306. Wmissing-declarations \
  2307. Wmissing-prototypes \
  2308. Wnested-externs \
  2309. Wpointer-arith \
  2310. Wshadow \
  2311. Wstrict-prototypes \
  2312. Wundef $cf_warn_CONST $1
  2313. do
  2314. CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
  2315. if AC_TRY_EVAL(ac_compile); then
  2316. test -n "$verbose" && AC_MSG_RESULT(... -$cf_opt)
  2317. case $cf_opt in #(vi
  2318. Wcast-qual) #(vi
  2319. CPPFLAGS="$CPPFLAGS -DXTSTRINGDEFINES"
  2320. ;;
  2321. Winline) #(vi
  2322. case $GCC_VERSION in
  2323. 3.3*)
  2324. CF_VERBOSE(feature is broken in gcc $GCC_VERSION)
  2325. continue;;
  2326. esac
  2327. ;;
  2328. esac
  2329. EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
  2330. fi
  2331. done
  2332. CFLAGS="$cf_save_CFLAGS"
  2333. fi
  2334. rm -f conftest*
  2335. AC_SUBST(EXTRA_CFLAGS)
  2336. ])dnl
  2337. dnl ---------------------------------------------------------------------------
  2338. dnl CF_GNUTLS version: 4 updated: 2004/04/26 20:08:48
  2339. dnl ---------
  2340. dnl Check for gnutls library (TLS "is" SSL)
  2341. dnl $1 = the [optional] directory in which the library may be found
  2342. AC_DEFUN([CF_GNUTLS],[
  2343. cf_ssl_library="-lgnutls -lcrypt"
  2344. AC_MSG_CHECKING(if we know what directory gnutls is in)
  2345. case "$1" in #(vi
  2346. no) #(vi
  2347. cf_ssl_root=no
  2348. ;;
  2349. yes) #(vi
  2350. AC_CHECK_LIB(gnutls, gnutls_init,[],[
  2351. cf_ssl_root=/usr/local/gnutls
  2352. if test -d $cf_ssl_root ; then
  2353. CF_VERBOSE(assume it is in $cf_ssl_root)
  2354. else
  2355. AC_MSG_ERROR(cannot find gnutls library)
  2356. fi
  2357. ],
  2358. [-lgnutls-extra -lgnutls -lcrypt])
  2359. ;;
  2360. *)
  2361. if test -d $1 ; then
  2362. if test -d $1/include ; then
  2363. cf_ssl_root=$1
  2364. elif test -d $1/../include ; then
  2365. cf_ssl_root=$1/..
  2366. else
  2367. AC_MSG_ERROR(cannot find ssl library under $1)
  2368. fi
  2369. else
  2370. AC_MSG_WARN(expected a directory: $1)
  2371. fi
  2372. ;;
  2373. esac
  2374. AC_MSG_RESULT($cf_ssl_root)
  2375. LIBS="$cf_ssl_library $LIBS"
  2376. cf_ssl_subincs=yes
  2377. if test "$cf_ssl_root" != no ; then
  2378. cf_ssl_library="-L$cf_ssl_root/lib $cf_ssl_library"
  2379. if test -d $cf_ssl_root/include ; then
  2380. CF_ADD_CFLAGS(-I$cf_ssl_root/include)
  2381. test -d $cf_ssl_root/include/gnutls || cf_ssl_subincs=no
  2382. fi
  2383. fi
  2384. AC_CHECK_LIB(gnutls-openssl,SSL_connect,
  2385. [LIBS="-lgnutls-openssl $LIBS"],
  2386. [AC_CHECK_LIB(gnutls-extra,SSL_connect,
  2387. [LIBS="-lgnutls-extra $LIBS"],
  2388. [AC_MSG_ERROR(cannot find gnutls openssl functions)])])
  2389. if test "$cf_ssl_subincs" = yes ; then
  2390. AC_MSG_CHECKING(for gnutls include directory)
  2391. AC_TRY_COMPILE([
  2392. #include <stdio.h>
  2393. #include <gnutls/openssl.h>],
  2394. [SSL_shutdown((SSL *)0)],
  2395. [cf_openssl_incl=yes],
  2396. [cf_openssl_incl=no])
  2397. AC_MSG_RESULT($cf_openssl_incl)
  2398. test "$cf_openssl_incl" = yes && AC_DEFINE(USE_GNUTLS_INCL)
  2399. fi
  2400. AC_MSG_CHECKING(if we can link to gnutls library)
  2401. AC_TRY_LINK([
  2402. #include <stdio.h>
  2403. #ifdef USE_GNUTLS_INCL
  2404. #include <gnutls/openssl.h>
  2405. #else
  2406. #include <ssl.h>
  2407. #endif
  2408. ],
  2409. [SSL_shutdown((SSL *)0)],
  2410. [cf_ssl_library=yes],
  2411. [cf_ssl_library=no])
  2412. AC_MSG_RESULT($cf_ssl_library)
  2413. if test "$cf_ssl_library" = yes ; then
  2414. AC_DEFINE(USE_SSL)
  2415. else
  2416. AC_ERROR(Cannot link with gnutls library)
  2417. fi
  2418. AC_MSG_CHECKING(for X509 support)
  2419. AC_TRY_LINK([
  2420. #include <stdio.h>
  2421. #ifdef USE_GNUTLS_INCL
  2422. #include <gnutls/openssl.h>
  2423. #else
  2424. #include <ssl.h>
  2425. #endif
  2426. ],
  2427. [X509_verify_cert_error_string(X509_STORE_CTX_get_error(X509_STORE_CTX *0))];
  2428. [cf_x509_support=yes],
  2429. [cf_x509_support=no])
  2430. AC_MSG_RESULT($cf_x509_support)
  2431. if test "$cf_x509_support" = yes ; then
  2432. AC_DEFINE(USE_X509_SUPPORT)
  2433. fi
  2434. ])dnl
  2435. dnl ---------------------------------------------------------------------------
  2436. dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07
  2437. dnl -------------
  2438. dnl Check if we must define _GNU_SOURCE to get a reasonable value for
  2439. dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect
  2440. dnl (or misfeature) of glibc2, which breaks portability of many applications,
  2441. dnl since it is interwoven with GNU extensions.
  2442. dnl
  2443. dnl Well, yes we could work around it...
  2444. AC_DEFUN([CF_GNU_SOURCE],
  2445. [
  2446. AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
  2447. AC_TRY_COMPILE([#include <sys/types.h>],[
  2448. #ifndef _XOPEN_SOURCE
  2449. make an error
  2450. #endif],
  2451. [cf_cv_gnu_source=no],
  2452. [cf_save="$CPPFLAGS"
  2453. CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  2454. AC_TRY_COMPILE([#include <sys/types.h>],[
  2455. #ifdef _XOPEN_SOURCE
  2456. make an error
  2457. #endif],
  2458. [cf_cv_gnu_source=no],
  2459. [cf_cv_gnu_source=yes])
  2460. CPPFLAGS="$cf_save"
  2461. ])
  2462. ])
  2463. test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
  2464. ])dnl
  2465. dnl ---------------------------------------------------------------------------
  2466. dnl CF_HEADER_PATH version: 8 updated: 2002/11/10 14:46:59
  2467. dnl --------------
  2468. dnl Construct a search-list for a nonstandard header-file
  2469. AC_DEFUN([CF_HEADER_PATH],
  2470. [CF_SUBDIR_PATH($1,$2,include)
  2471. test "$includedir" != NONE && \
  2472. test "$includedir" != "/usr/include" && \
  2473. test -d "$includedir" && {
  2474. test -d $includedir && $1="[$]$1 $includedir"
  2475. test -d $includedir/$2 && $1="[$]$1 $includedir/$2"
  2476. }
  2477. test "$oldincludedir" != NONE && \
  2478. test "$oldincludedir" != "/usr/include" && \
  2479. test -d "$oldincludedir" && {
  2480. test -d $oldincludedir && $1="[$]$1 $oldincludedir"
  2481. test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2"
  2482. }
  2483. ])dnl
  2484. dnl ---------------------------------------------------------------------------
  2485. dnl CF_HELP_MESSAGE version: 3 updated: 1998/01/14 10:56:23
  2486. dnl ---------------
  2487. dnl Insert text into the help-message, for readability, from AC_ARG_WITH.
  2488. AC_DEFUN([CF_HELP_MESSAGE],
  2489. [AC_DIVERT_HELP([$1])dnl
  2490. ])dnl
  2491. dnl ---------------------------------------------------------------------------
  2492. dnl CF_INET_ADDR version: 4 updated: 1999/03/30 12:24:31
  2493. dnl ------------
  2494. dnl For Lynx, check if the libraries we have found give us inet_aton, or
  2495. dnl inet_addr. If not, try to find the latter function with -lbind or
  2496. dnl -lresolv, and put that on the end of the libraries, i.e., after the network
  2497. dnl libraries.
  2498. dnl
  2499. dnl FIXME: the inner cases will probably need work on the header files.
  2500. AC_DEFUN([CF_INET_ADDR],[
  2501. AC_CACHE_CHECK(for inet_aton function,cf_cv_have_inet_aton,[
  2502. AC_TRY_LINK([#include <sys/types.h>
  2503. #include <sys/socket.h>
  2504. #include <netinet/in.h>
  2505. #include <arpa/inet.h>
  2506. ],[inet_aton(0, (struct in_addr *)0)],
  2507. [cf_cv_have_inet_aton=yes],
  2508. [cf_cv_have_inet_aton=no])])
  2509. if test "$cf_cv_have_inet_aton" = yes ; then
  2510. AC_DEFINE(HAVE_INET_ATON)
  2511. else
  2512. AC_CACHE_CHECK(for inet_addr function,cf_cv_have_inet_addr,[
  2513. AC_TRY_LINK([#include <sys/types.h>
  2514. #include <sys/socket.h>
  2515. #include <netinet/in.h>
  2516. #include <arpa/inet.h>
  2517. ],[inet_addr(0)],
  2518. [cf_cv_have_inet_addr=yes],
  2519. [cf_cv_have_inet_addr=no])])
  2520. if test "$cf_cv_have_inet_addr" = no ; then
  2521. AC_CACHE_CHECK(for library with inet_addr,cf_cv_lib_inet_addr,[
  2522. cf_save_LIBS="$LIBS"
  2523. for cf_inetlib in -lbind -lresolv
  2524. do
  2525. LIBS="$cf_save_LIBS $cf_inetlib"
  2526. AC_TRY_LINK([#include <sys/types.h>
  2527. #include <sys/socket.h>
  2528. #include <netinet/in.h>
  2529. #include <arpa/inet.h>
  2530. ],[inet_addr(0)],
  2531. [cf_cv_lib_inet_addr=$cf_inetlib],
  2532. [cf_cv_lib_inet_addr=no])
  2533. LIBS="$cf_save_LIBS"
  2534. test "$cf_cv_lib_inet_addr" != no && break
  2535. done
  2536. ])
  2537. if test "$cf_cv_lib_inet_addr" != no ; then
  2538. LIBS="$LIBS $cf_cv_lib_inet_addr"
  2539. else
  2540. AC_MSG_WARN(Unable to find library for inet_addr function)
  2541. fi
  2542. fi
  2543. fi
  2544. ])dnl
  2545. dnl ---------------------------------------------------------------------------
  2546. dnl CF_INTEL_COMPILER version: 3 updated: 2005/08/06 18:37:29
  2547. dnl -----------------
  2548. dnl Check if the given compiler is really the Intel compiler for Linux. It
  2549. dnl tries to imitate gcc, but does not return an error when it finds a mismatch
  2550. dnl between prototypes, e.g., as exercised by CF_MISSING_CHECK.
  2551. dnl
  2552. dnl This macro should be run "soon" after AC_PROG_CC or AC_PROG_CPLUSPLUS, to
  2553. dnl ensure that it is not mistaken for gcc/g++. It is normally invoked from
  2554. dnl the wrappers for gcc and g++ warnings.
  2555. dnl
  2556. dnl $1 = GCC (default) or GXX
  2557. dnl $2 = INTEL_COMPILER (default) or INTEL_CPLUSPLUS
  2558. dnl $3 = CFLAGS (default) or CXXFLAGS
  2559. AC_DEFUN([CF_INTEL_COMPILER],[
  2560. ifelse($2,,INTEL_COMPILER,[$2])=no
  2561. if test "$ifelse($1,,[$1],GCC)" = yes ; then
  2562. case $host_os in
  2563. linux*|gnu*)
  2564. AC_MSG_CHECKING(if this is really Intel ifelse($1,GXX,C++,C) compiler)
  2565. cf_save_CFLAGS="$ifelse($3,,CFLAGS,[$3])"
  2566. ifelse($3,,CFLAGS,[$3])="$ifelse($3,,CFLAGS,[$3]) -no-gcc"
  2567. AC_TRY_COMPILE([],[
  2568. #ifdef __INTEL_COMPILER
  2569. #else
  2570. make an error
  2571. #endif
  2572. ],[ifelse($2,,INTEL_COMPILER,[$2])=yes
  2573. cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc"
  2574. ],[])
  2575. ifelse($3,,CFLAGS,[$3])="$cf_save_CFLAGS"
  2576. AC_MSG_RESULT($ifelse($2,,INTEL_COMPILER,[$2]))
  2577. ;;
  2578. esac
  2579. fi
  2580. ])dnl
  2581. dnl ---------------------------------------------------------------------------
  2582. dnl CF_LARGEFILE version: 5 updated: 2005/07/17 11:03:36
  2583. dnl ------------
  2584. dnl Add checks for large file support.
  2585. AC_DEFUN([CF_LARGEFILE],[
  2586. ifdef([AC_FUNC_FSEEKO],[
  2587. AC_FUNC_FSEEKO
  2588. AC_SYS_LARGEFILE
  2589. # Normally we would collect these definitions in the config.h,
  2590. # but (like _XOPEN_SOURCE), some environments rely on having these
  2591. # defined before any of the system headers are included. Another
  2592. # case comes up with C++, e.g., on AIX the compiler compiles the
  2593. # header files by themselves before looking at the body files it is
  2594. # told to compile. For ncurses, those header files do not include
  2595. # the config.h
  2596. test "$ac_cv_sys_large_files" != no && CPPFLAGS="$CPPFLAGS -D_LARGE_FILES "
  2597. test "$ac_cv_sys_largefile_source" != no && CPPFLAGS="$CPPFLAGS -D_LARGEFILE_SOURCE "
  2598. AC_CACHE_CHECK(whether to use struct dirent64, cf_cv_struct_dirent64,[
  2599. AC_TRY_COMPILE([
  2600. #include <sys/types.h>
  2601. #include <dirent.h>
  2602. ],[
  2603. /* if transitional largefile support is setup, this is true */
  2604. extern struct dirent64 * readdir(DIR *);
  2605. struct dirent64 *x = readdir((DIR *)0);
  2606. struct dirent *y = readdir((DIR *)0);
  2607. int z = x - y;
  2608. ],
  2609. [cf_cv_struct_dirent64=yes],
  2610. [cf_cv_struct_dirent64=no])
  2611. ])
  2612. test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64)
  2613. ])
  2614. ])
  2615. dnl ---------------------------------------------------------------------------
  2616. dnl CF_LASTLOG version: 4 updated: 2002/10/27 23:21:42
  2617. dnl ----------
  2618. dnl Check for header defining _PATH_LASTLOG, or failing that, see if the lastlog
  2619. dnl file exists.
  2620. AC_DEFUN([CF_LASTLOG],
  2621. [
  2622. AC_CHECK_HEADERS(lastlog.h paths.h)
  2623. AC_CACHE_CHECK(for lastlog path,cf_cv_path_lastlog,[
  2624. AC_TRY_COMPILE([
  2625. #include <sys/types.h>
  2626. #ifdef HAVE_LASTLOG_H
  2627. #include <lastlog.h>
  2628. #else
  2629. #ifdef HAVE_PATHS_H
  2630. #include <paths.h>
  2631. #endif
  2632. #endif],[char *path = _PATH_LASTLOG],
  2633. [cf_cv_path_lastlog="_PATH_LASTLOG"],
  2634. [if test -f /usr/adm/lastlog ; then
  2635. cf_cv_path_lastlog=/usr/adm/lastlog
  2636. else
  2637. cf_cv_path_lastlog=no
  2638. fi])
  2639. ])
  2640. test $cf_cv_path_lastlog != no && AC_DEFINE(USE_LASTLOG)
  2641. ])dnl
  2642. dnl ---------------------------------------------------------------------------
  2643. dnl CF_LIBRARY_PATH version: 7 updated: 2002/11/10 14:46:59
  2644. dnl ---------------
  2645. dnl Construct a search-list for a nonstandard library-file
  2646. AC_DEFUN([CF_LIBRARY_PATH],
  2647. [CF_SUBDIR_PATH($1,$2,lib)])dnl
  2648. dnl ---------------------------------------------------------------------------
  2649. dnl CF_LOCALE version: 4 updated: 2003/02/16 08:16:04
  2650. dnl ---------
  2651. dnl Check if we have setlocale() and its header, <locale.h>
  2652. dnl The optional parameter $1 tells what to do if we do have locale support.
  2653. AC_DEFUN([CF_LOCALE],
  2654. [
  2655. AC_MSG_CHECKING(for setlocale())
  2656. AC_CACHE_VAL(cf_cv_locale,[
  2657. AC_TRY_LINK([#include <locale.h>],
  2658. [setlocale(LC_ALL, "")],
  2659. [cf_cv_locale=yes],
  2660. [cf_cv_locale=no])
  2661. ])
  2662. AC_MSG_RESULT($cf_cv_locale)
  2663. test $cf_cv_locale = yes && { ifelse($1,,AC_DEFINE(LOCALE),[$1]) }
  2664. ])dnl
  2665. dnl ---------------------------------------------------------------------------
  2666. dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52
  2667. dnl ----------
  2668. dnl Write a debug message to config.log, along with the line number in the
  2669. dnl configure script.
  2670. AC_DEFUN([CF_MSG_LOG],[
  2671. echo "(line __oline__) testing $* ..." 1>&AC_FD_CC
  2672. ])dnl
  2673. dnl ---------------------------------------------------------------------------
  2674. dnl CF_NCURSES_BROKEN version: 6 updated: 1998/04/27 20:32:34
  2675. dnl -----------------
  2676. dnl Check for pre-1.9.9g ncurses (among other problems, the most obvious is
  2677. dnl that color combinations don't work).
  2678. AC_DEFUN([CF_NCURSES_BROKEN],
  2679. [
  2680. AC_REQUIRE([CF_NCURSES_VERSION])
  2681. if test "$cf_cv_ncurses_version" != no ; then
  2682. AC_MSG_CHECKING(for obsolete/broken version of ncurses)
  2683. AC_CACHE_VAL(cf_cv_ncurses_broken,[
  2684. AC_TRY_COMPILE([
  2685. #include <${cf_cv_ncurses_header-curses.h}>],[
  2686. #if defined(NCURSES_VERSION) && defined(wgetbkgd)
  2687. make an error
  2688. #else
  2689. int x = 1
  2690. #endif
  2691. ],
  2692. [cf_cv_ncurses_broken=no],
  2693. [cf_cv_ncurses_broken=yes])
  2694. ])
  2695. AC_MSG_RESULT($cf_cv_ncurses_broken)
  2696. if test "$cf_cv_ncurses_broken" = yes ; then
  2697. AC_MSG_WARN(hmm... you should get an up-to-date version of ncurses)
  2698. AC_DEFINE(NCURSES_BROKEN)
  2699. fi
  2700. fi
  2701. ])dnl
  2702. dnl ---------------------------------------------------------------------------
  2703. dnl CF_NCURSES_CC_CHECK version: 3 updated: 2003/01/12 18:59:28
  2704. dnl -------------------
  2705. dnl Check if we can compile with ncurses' header file
  2706. dnl $1 is the cache variable to set
  2707. dnl $2 is the header-file to include
  2708. dnl $3 is the root name (ncurses or ncursesw)
  2709. AC_DEFUN([CF_NCURSES_CC_CHECK],[
  2710. AC_TRY_COMPILE([
  2711. ]ifelse($3,ncursesw,[
  2712. #define _XOPEN_SOURCE_EXTENDED
  2713. #undef HAVE_LIBUTF8_H /* in case we used CF_UTF8_LIB */
  2714. #define HAVE_LIBUTF8_H /* to force ncurses' header file to use cchar_t */
  2715. ])[
  2716. #include <$2>],[
  2717. #ifdef NCURSES_VERSION
  2718. ]ifelse($3,ncursesw,[
  2719. #ifndef WACS_BSSB
  2720. make an error
  2721. #endif
  2722. ])[
  2723. printf("%s\n", NCURSES_VERSION);
  2724. #else
  2725. #ifdef __NCURSES_H
  2726. printf("old\n");
  2727. #else
  2728. make an error
  2729. #endif
  2730. #endif
  2731. ]
  2732. ,[$1=$cf_header]
  2733. ,[$1=no])
  2734. ])dnl
  2735. dnl ---------------------------------------------------------------------------
  2736. dnl CF_NCURSES_CPPFLAGS version: 18 updated: 2005/12/31 13:26:39
  2737. dnl -------------------
  2738. dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting
  2739. dnl the CPPFLAGS variable so we can include its header.
  2740. dnl
  2741. dnl The header files may be installed as either curses.h, or ncurses.h (would
  2742. dnl be obsolete, except that some packagers prefer this name to distinguish it
  2743. dnl from a "native" curses implementation). If not installed for overwrite,
  2744. dnl the curses.h file would be in an ncurses subdirectory (e.g.,
  2745. dnl /usr/include/ncurses), but someone may have installed overwriting the
  2746. dnl vendor's curses. Only very old versions (pre-1.9.2d, the first autoconf'd
  2747. dnl version) of ncurses don't define either __NCURSES_H or NCURSES_VERSION in
  2748. dnl the header.
  2749. dnl
  2750. dnl If the installer has set $CFLAGS or $CPPFLAGS so that the ncurses header
  2751. dnl is already in the include-path, don't even bother with this, since we cannot
  2752. dnl easily determine which file it is. In this case, it has to be <curses.h>.
  2753. dnl
  2754. dnl The optional parameter gives the root name of the library, in case it is
  2755. dnl not installed as the default curses library. That is how the
  2756. dnl wide-character version of ncurses is installed.
  2757. AC_DEFUN([CF_NCURSES_CPPFLAGS],
  2758. [AC_REQUIRE([CF_WITH_CURSES_DIR])
  2759. AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl
  2760. cf_ncuhdr_root=ifelse($1,,ncurses,$1)
  2761. test -n "$cf_cv_curses_dir" && \
  2762. test "$cf_cv_curses_dir" != "no" && \
  2763. CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS"
  2764. AC_CACHE_CHECK(for $cf_ncuhdr_root header in include-path, cf_cv_ncurses_h,[
  2765. cf_header_list="$cf_ncuhdr_root/curses.h $cf_ncuhdr_root/ncurses.h"
  2766. ( test "$cf_ncuhdr_root" = ncurses || test "$cf_ncuhdr_root" = ncursesw ) && cf_header_list="$cf_header_list curses.h ncurses.h"
  2767. for cf_header in $cf_header_list
  2768. do
  2769. CF_NCURSES_CC_CHECK(cf_cv_ncurses_h,$cf_header,$1)
  2770. test "$cf_cv_ncurses_h" != no && break
  2771. done
  2772. ])
  2773. CF_NCURSES_HEADER
  2774. CF_TERM_HEADER
  2775. # some applications need this, but should check for NCURSES_VERSION
  2776. AC_DEFINE(NCURSES)
  2777. CF_NCURSES_VERSION
  2778. ])dnl
  2779. dnl ---------------------------------------------------------------------------
  2780. dnl CF_NCURSES_HEADER version: 1 updated: 2005/12/31 13:28:37
  2781. dnl -----------------
  2782. dnl Find a "curses" header file, e.g,. "curses.h", or one of the more common
  2783. dnl variations of ncurses' installs.
  2784. dnl
  2785. dnl See also CF_CURSES_HEADER, which sets the same cache variable.
  2786. AC_DEFUN([CF_NCURSES_HEADER],[
  2787. if test "$cf_cv_ncurses_h" != no ; then
  2788. cf_cv_ncurses_header=$cf_cv_ncurses_h
  2789. else
  2790. AC_CACHE_CHECK(for $cf_ncuhdr_root include-path, cf_cv_ncurses_h2,[
  2791. test -n "$verbose" && echo
  2792. CF_HEADER_PATH(cf_search,$cf_ncuhdr_root)
  2793. test -n "$verbose" && echo search path $cf_search
  2794. cf_save2_CPPFLAGS="$CPPFLAGS"
  2795. for cf_incdir in $cf_search
  2796. do
  2797. CF_ADD_INCDIR($cf_incdir)
  2798. for cf_header in \
  2799. ncurses.h \
  2800. curses.h
  2801. do
  2802. CF_NCURSES_CC_CHECK(cf_cv_ncurses_h2,$cf_header,$1)
  2803. if test "$cf_cv_ncurses_h2" != no ; then
  2804. cf_cv_ncurses_h2=$cf_incdir/$cf_header
  2805. test -n "$verbose" && echo $ac_n " ... found $ac_c" 1>&AC_FD_MSG
  2806. break
  2807. fi
  2808. test -n "$verbose" && echo " ... tested $cf_incdir/$cf_header" 1>&AC_FD_MSG
  2809. done
  2810. CPPFLAGS="$cf_save2_CPPFLAGS"
  2811. test "$cf_cv_ncurses_h2" != no && break
  2812. done
  2813. test "$cf_cv_ncurses_h2" = no && AC_ERROR(not found)
  2814. ])
  2815. CF_DIRNAME(cf_1st_incdir,$cf_cv_ncurses_h2)
  2816. cf_cv_ncurses_header=`basename $cf_cv_ncurses_h2`
  2817. if test `basename $cf_1st_incdir` = $cf_ncuhdr_root ; then
  2818. cf_cv_ncurses_header=$cf_ncuhdr_root/$cf_cv_ncurses_header
  2819. fi
  2820. CF_ADD_INCDIR($cf_1st_incdir)
  2821. fi
  2822. # Set definitions to allow ifdef'ing for ncurses.h
  2823. case $cf_cv_ncurses_header in # (vi
  2824. *ncurses.h)
  2825. AC_DEFINE(HAVE_NCURSES_H)
  2826. ;;
  2827. esac
  2828. case $cf_cv_ncurses_header in # (vi
  2829. ncurses/curses.h|ncurses/ncurses.h)
  2830. AC_DEFINE(HAVE_NCURSES_NCURSES_H)
  2831. ;;
  2832. ncursesw/curses.h|ncursesw/ncurses.h)
  2833. AC_DEFINE(HAVE_NCURSESW_NCURSES_H)
  2834. ;;
  2835. esac
  2836. ])dnl
  2837. dnl ---------------------------------------------------------------------------
  2838. dnl CF_NCURSES_LIBS version: 12 updated: 2004/04/27 16:26:05
  2839. dnl ---------------
  2840. dnl Look for the ncurses library. This is a little complicated on Linux,
  2841. dnl because it may be linked with the gpm (general purpose mouse) library.
  2842. dnl Some distributions have gpm linked with (bsd) curses, which makes it
  2843. dnl unusable with ncurses. However, we don't want to link with gpm unless
  2844. dnl ncurses has a dependency, since gpm is normally set up as a shared library,
  2845. dnl and the linker will record a dependency.
  2846. dnl
  2847. dnl The optional parameter gives the root name of the library, in case it is
  2848. dnl not installed as the default curses library. That is how the
  2849. dnl wide-character version of ncurses is installed.
  2850. AC_DEFUN([CF_NCURSES_LIBS],
  2851. [AC_REQUIRE([CF_NCURSES_CPPFLAGS])
  2852. cf_nculib_root=ifelse($1,,ncurses,$1)
  2853. # This works, except for the special case where we find gpm, but
  2854. # ncurses is in a nonstandard location via $LIBS, and we really want
  2855. # to link gpm.
  2856. cf_ncurses_LIBS=""
  2857. cf_ncurses_SAVE="$LIBS"
  2858. AC_CHECK_LIB(gpm,Gpm_Open,
  2859. [AC_CHECK_LIB(gpm,initscr,
  2860. [LIBS="$cf_ncurses_SAVE"],
  2861. [cf_ncurses_LIBS="-lgpm"])])
  2862. case $host_os in #(vi
  2863. freebsd*)
  2864. # This is only necessary if you are linking against an obsolete
  2865. # version of ncurses (but it should do no harm, since it's static).
  2866. if test "$cf_nculib_root" = ncurses ; then
  2867. AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"])
  2868. fi
  2869. ;;
  2870. esac
  2871. LIBS="$cf_ncurses_LIBS $LIBS"
  2872. if ( test -n "$cf_cv_curses_dir" && test "$cf_cv_curses_dir" != "no" )
  2873. then
  2874. LIBS="-L$cf_cv_curses_dir/lib -l$cf_nculib_root $LIBS"
  2875. else
  2876. CF_FIND_LIBRARY($cf_nculib_root,$cf_nculib_root,
  2877. [#include <${cf_cv_ncurses_header-curses.h}>],
  2878. [initscr()],
  2879. initscr)
  2880. fi
  2881. if test -n "$cf_ncurses_LIBS" ; then
  2882. AC_MSG_CHECKING(if we can link $cf_nculib_root without $cf_ncurses_LIBS)
  2883. cf_ncurses_SAVE="$LIBS"
  2884. for p in $cf_ncurses_LIBS ; do
  2885. q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"`
  2886. if test "$q" != "$LIBS" ; then
  2887. LIBS="$q"
  2888. fi
  2889. done
  2890. AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  2891. [initscr(); mousemask(0,0); tgoto((char *)0, 0, 0);],
  2892. [AC_MSG_RESULT(yes)],
  2893. [AC_MSG_RESULT(no)
  2894. LIBS="$cf_ncurses_SAVE"])
  2895. fi
  2896. CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root)
  2897. AC_DEFINE_UNQUOTED($cf_nculib_ROOT)
  2898. ])dnl
  2899. dnl ---------------------------------------------------------------------------
  2900. dnl CF_NCURSES_VERSION version: 11 updated: 2003/11/06 19:59:57
  2901. dnl ------------------
  2902. dnl Check for the version of ncurses, to aid in reporting bugs, etc.
  2903. dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use
  2904. dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi.
  2905. AC_DEFUN([CF_NCURSES_VERSION],
  2906. [
  2907. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  2908. AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[
  2909. cf_cv_ncurses_version=no
  2910. cf_tempfile=out$$
  2911. rm -f $cf_tempfile
  2912. AC_TRY_RUN([
  2913. #include <${cf_cv_ncurses_header-curses.h}>
  2914. #include <stdio.h>
  2915. int main()
  2916. {
  2917. FILE *fp = fopen("$cf_tempfile", "w");
  2918. #ifdef NCURSES_VERSION
  2919. # ifdef NCURSES_VERSION_PATCH
  2920. fprintf(fp, "%s.%d\n", NCURSES_VERSION, NCURSES_VERSION_PATCH);
  2921. # else
  2922. fprintf(fp, "%s\n", NCURSES_VERSION);
  2923. # endif
  2924. #else
  2925. # ifdef __NCURSES_H
  2926. fprintf(fp, "old\n");
  2927. # else
  2928. make an error
  2929. # endif
  2930. #endif
  2931. exit(0);
  2932. }],[
  2933. cf_cv_ncurses_version=`cat $cf_tempfile`],,[
  2934. # This will not work if the preprocessor splits the line after the
  2935. # Autoconf token. The 'unproto' program does that.
  2936. cat > conftest.$ac_ext <<EOF
  2937. #include <${cf_cv_ncurses_header-curses.h}>
  2938. #undef Autoconf
  2939. #ifdef NCURSES_VERSION
  2940. Autoconf NCURSES_VERSION
  2941. #else
  2942. #ifdef __NCURSES_H
  2943. Autoconf "old"
  2944. #endif
  2945. ;
  2946. #endif
  2947. EOF
  2948. cf_try="$ac_cpp conftest.$ac_ext 2>&AC_FD_CC | grep '^Autoconf ' >conftest.out"
  2949. AC_TRY_EVAL(cf_try)
  2950. if test -f conftest.out ; then
  2951. cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[[^"]]*"%%' -e 's%".*%%'`
  2952. test -n "$cf_out" && cf_cv_ncurses_version="$cf_out"
  2953. rm -f conftest.out
  2954. fi
  2955. ])
  2956. rm -f $cf_tempfile
  2957. ])
  2958. test "$cf_cv_ncurses_version" = no || AC_DEFINE(NCURSES)
  2959. ])dnl
  2960. dnl ---------------------------------------------------------------------------
  2961. dnl CF_NETLIBS version: 4 updated: 1999/12/23 15:20:39
  2962. dnl ----------
  2963. dnl After checking for functions in the default $LIBS, make a further check
  2964. dnl for the functions that are netlib-related (these aren't always in the
  2965. dnl libc, etc., and have to be handled specially because there are conflicting
  2966. dnl and broken implementations.
  2967. dnl Common library requirements (in order):
  2968. dnl -lresolv -lsocket -lnsl
  2969. dnl -lnsl -lsocket
  2970. dnl -lsocket
  2971. dnl -lbsd
  2972. AC_DEFUN([CF_NETLIBS],[
  2973. cf_test_netlibs=no
  2974. AC_MSG_CHECKING(for network libraries)
  2975. AC_CACHE_VAL(cf_cv_netlibs,[
  2976. AC_MSG_RESULT(working...)
  2977. cf_cv_netlibs=""
  2978. cf_test_netlibs=yes
  2979. AC_CHECK_FUNCS(gethostname,,[
  2980. CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
  2981. CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
  2982. #
  2983. # FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but
  2984. # I don't know the entrypoints - 97/7/22 TD
  2985. # AC_HAVE_LIBRARY(inet,cf_cv_netlibs="-linet $cf_cv_netlibs")
  2986. AC_CHECK_LIB(inet, main, cf_cv_netlibs="-linet $cf_cv_netlibs")
  2987. #
  2988. if test "$ac_cv_func_lsocket" != no ; then
  2989. AC_CHECK_FUNCS(socket,,[
  2990. CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
  2991. CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
  2992. fi
  2993. #
  2994. AC_CHECK_FUNCS(gethostbyname,,[
  2995. CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
  2996. #
  2997. AC_CHECK_FUNCS(strcasecmp,,[
  2998. CF_RECHECK_FUNC(strcasecmp,resolv,cf_cv_netlibs)])
  2999. ])
  3000. LIBS="$LIBS $cf_cv_netlibs"
  3001. test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
  3002. ])dnl
  3003. dnl ---------------------------------------------------------------------------
  3004. dnl CF_NGROUPS version: 3 updated: 2001/12/27 07:55:07
  3005. dnl ----------
  3006. dnl Check for the symbol NGROUPS
  3007. AC_DEFUN([CF_NGROUPS],
  3008. [
  3009. AC_MSG_CHECKING(if NGROUPS is defined)
  3010. AC_CACHE_VAL(cf_cv_ngroups,[
  3011. AC_TRY_COMPILE([
  3012. #if HAVE_SYS_PARAM_H
  3013. #include <sys/param.h>
  3014. #endif
  3015. #if HAVE_LIMITS_H
  3016. #include <limits.h>
  3017. #endif
  3018. ],[int x = NGROUPS],
  3019. [cf_cv_ngroups=yes],
  3020. [AC_TRY_COMPILE([
  3021. #if HAVE_SYS_PARAM_H
  3022. #include <sys/param.h>
  3023. #endif
  3024. #if HAVE_LIMITS_H
  3025. #include <limits.h>
  3026. #endif
  3027. ],[int x = NGROUPS_MAX],
  3028. [cf_cv_ngroups=NGROUPS_MAX],
  3029. [cf_cv_ngroups=no])
  3030. ])
  3031. AC_MSG_RESULT($cf_cv_ngroups)
  3032. ])
  3033. if test "$cf_cv_ngroups" = no ; then
  3034. AC_DEFINE(NGROUPS,16)
  3035. elif test "$cf_cv_ngroups" = NGROUPS_MAX ; then
  3036. AC_DEFINE(NGROUPS,NGROUPS_MAX)
  3037. fi
  3038. ])dnl
  3039. dnl ---------------------------------------------------------------------------
  3040. dnl CF_OUR_MESSAGES version: 7 updated: 2004/09/12 19:45:55
  3041. dnl ---------------
  3042. dnl Check if we use the messages included with this program
  3043. dnl
  3044. dnl $1 specifies either Makefile or makefile, defaulting to the former.
  3045. dnl
  3046. dnl Sets variables which can be used to substitute in makefiles:
  3047. dnl MSG_DIR_MAKE - to make ./po directory
  3048. dnl SUB_MAKEFILE - makefile in ./po directory (see CF_BUNDLED_INTL)
  3049. dnl
  3050. AC_DEFUN([CF_OUR_MESSAGES],
  3051. [
  3052. cf_makefile=ifelse($1,,Makefile,$1)
  3053. use_our_messages=no
  3054. if test "$USE_NLS" = yes ; then
  3055. if test -d $srcdir/po ; then
  3056. AC_MSG_CHECKING(if we should use included message-library)
  3057. AC_ARG_ENABLE(included-msgs,
  3058. [ --disable-included-msgs use included messages, for i18n support],
  3059. [use_our_messages=$enableval],
  3060. [use_our_messages=yes])
  3061. fi
  3062. AC_MSG_RESULT($use_our_messages)
  3063. fi
  3064. MSG_DIR_MAKE="#"
  3065. if test "$use_our_messages" = yes
  3066. then
  3067. SUB_MAKEFILE="$SUB_MAKEFILE po/$cf_makefile.in:$srcdir/po/$cf_makefile.inn"
  3068. MSG_DIR_MAKE=
  3069. fi
  3070. AC_SUBST(MSG_DIR_MAKE)
  3071. AC_SUBST(SUB_MAKEFILE)
  3072. ])dnl
  3073. dnl ---------------------------------------------------------------------------
  3074. dnl CF_PATHSEP version: 3 updated: 2001/01/12 01:23:53
  3075. dnl ----------
  3076. dnl Provide a value for the $PATH and similar separator
  3077. AC_DEFUN([CF_PATHSEP],
  3078. [
  3079. case $cf_cv_system_name in
  3080. os2*) PATHSEP=';' ;;
  3081. *) PATHSEP=':' ;;
  3082. esac
  3083. ifelse($1,,,[$1=$PATHSEP])
  3084. AC_SUBST(PATHSEP)
  3085. ])dnl
  3086. dnl ---------------------------------------------------------------------------
  3087. dnl CF_PATH_PROG version: 6 updated: 2004/01/26 20:58:41
  3088. dnl ------------
  3089. dnl Check for a given program, defining corresponding symbol.
  3090. dnl $1 = environment variable, which is suffixed by "_PATH" in the #define.
  3091. dnl $2 = program name to find.
  3092. dnl $3 = optional list of additional program names to test.
  3093. dnl
  3094. dnl If there is more than one token in the result, #define the remaining tokens
  3095. dnl to $1_ARGS. We need this for 'install' in particular.
  3096. dnl
  3097. dnl FIXME: we should allow this to be overridden by environment variables
  3098. dnl
  3099. AC_DEFUN([CF_PATH_PROG],[
  3100. test -z "[$]$1" && $1=$2
  3101. AC_PATH_PROGS($1,[$]$1 $2 $3,[$]$1)
  3102. cf_path_prog=""
  3103. cf_path_args=""
  3104. IFS="${IFS= }"; cf_save_ifs="$IFS"
  3105. case $host_os in #(vi
  3106. os2*) #(vi
  3107. IFS="${IFS};"
  3108. ;;
  3109. *)
  3110. IFS="${IFS}:"
  3111. ;;
  3112. esac
  3113. for cf_temp in $ac_cv_path_$1
  3114. do
  3115. if test -z "$cf_path_prog" ; then
  3116. if test "$with_full_paths" = yes ; then
  3117. CF_PATH_SYNTAX(cf_temp,break)
  3118. cf_path_prog="$cf_temp"
  3119. else
  3120. cf_path_prog="`basename $cf_temp`"
  3121. fi
  3122. elif test -z "$cf_path_args" ; then
  3123. cf_path_args="$cf_temp"
  3124. else
  3125. cf_path_args="$cf_path_args $cf_temp"
  3126. fi
  3127. done
  3128. IFS="$cf_save_ifs"
  3129. if test -n "$cf_path_prog" ; then
  3130. CF_MSG_LOG(defining path for ${cf_path_prog})
  3131. AC_DEFINE_UNQUOTED($1_PATH,"$cf_path_prog")
  3132. test -n "$cf_path_args" && AC_DEFINE_UNQUOTED($1_ARGS,"$cf_path_args")
  3133. fi
  3134. ])dnl
  3135. dnl ---------------------------------------------------------------------------
  3136. dnl CF_PATH_SYNTAX version: 11 updated: 2006/09/02 08:55:46
  3137. dnl --------------
  3138. dnl Check the argument to see that it looks like a pathname. Rewrite it if it
  3139. dnl begins with one of the prefix/exec_prefix variables, and then again if the
  3140. dnl result begins with 'NONE'. This is necessary to work around autoconf's
  3141. dnl delayed evaluation of those symbols.
  3142. AC_DEFUN([CF_PATH_SYNTAX],[
  3143. if test "x$prefix" != xNONE; then
  3144. cf_path_syntax="$prefix"
  3145. else
  3146. cf_path_syntax="$ac_default_prefix"
  3147. fi
  3148. case ".[$]$1" in #(vi
  3149. .\[$]\(*\)*|.\'*\'*) #(vi
  3150. ;;
  3151. ..|./*|.\\*) #(vi
  3152. ;;
  3153. .[[a-zA-Z]]:[[\\/]]*) #(vi OS/2 EMX
  3154. ;;
  3155. .\[$]{*prefix}*) #(vi
  3156. eval $1="[$]$1"
  3157. case ".[$]$1" in #(vi
  3158. .NONE/*)
  3159. $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
  3160. ;;
  3161. esac
  3162. ;; #(vi
  3163. .no|.NONE/*)
  3164. $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%`
  3165. ;;
  3166. *)
  3167. ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2)
  3168. ;;
  3169. esac
  3170. ])dnl
  3171. dnl ---------------------------------------------------------------------------
  3172. dnl CF_PDCURSES_X11 version: 6 updated: 2002/10/27 18:21:42
  3173. dnl ---------------
  3174. dnl Configure for PDCurses' X11 library
  3175. AC_DEFUN([CF_PDCURSES_X11],[
  3176. AC_REQUIRE([CF_X_ATHENA])
  3177. LDFLAGS="$LDFLAGS $X_LIBS"
  3178. CF_CHECK_CFLAGS($X_CFLAGS)
  3179. AC_CHECK_LIB(X11,XOpenDisplay,
  3180. [LIBS="-lX11 $LIBS"],,
  3181. [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])
  3182. AC_CACHE_CHECK(for XCurses library,cf_cv_lib_XCurses,[
  3183. LIBS="-lXCurses $LIBS"
  3184. AC_TRY_LINK([
  3185. #include <xcurses.h>
  3186. char *XCursesProgramName = "test";
  3187. ],[XCursesExit();],
  3188. [cf_cv_lib_XCurses=yes],
  3189. [cf_cv_lib_XCurses=no])
  3190. ])
  3191. if test $cf_cv_lib_XCurses = yes ; then
  3192. AC_DEFINE(UNIX)
  3193. AC_DEFINE(XCURSES)
  3194. AC_DEFINE(HAVE_XCURSES)
  3195. else
  3196. AC_ERROR(Cannot link with XCurses)
  3197. fi
  3198. ])dnl
  3199. dnl ---------------------------------------------------------------------------
  3200. dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10
  3201. dnl -----------------
  3202. dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed.
  3203. dnl
  3204. dnl POSIX.1-1990 _POSIX_SOURCE
  3205. dnl POSIX.1-1990 and _POSIX_SOURCE and
  3206. dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2
  3207. dnl Bindings Option
  3208. dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L
  3209. dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L
  3210. dnl X/Open 2000 _POSIX_C_SOURCE=200112L
  3211. dnl
  3212. dnl Parameters:
  3213. dnl $1 is the nominal value for _POSIX_C_SOURCE
  3214. AC_DEFUN([CF_POSIX_C_SOURCE],
  3215. [
  3216. cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1)
  3217. cf_save_CFLAGS="$CFLAGS"
  3218. cf_save_CPPFLAGS="$CPPFLAGS"
  3219. CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE)
  3220. CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE)
  3221. AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[
  3222. CF_MSG_LOG(if the symbol is already defined go no further)
  3223. AC_TRY_COMPILE([#include <sys/types.h>],[
  3224. #ifndef _POSIX_C_SOURCE
  3225. make an error
  3226. #endif],
  3227. [cf_cv_posix_c_source=no],
  3228. [cf_want_posix_source=no
  3229. case .$cf_POSIX_C_SOURCE in #(vi
  3230. .[[12]]??*) #(vi
  3231. cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
  3232. ;;
  3233. .2) #(vi
  3234. cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE"
  3235. cf_want_posix_source=yes
  3236. ;;
  3237. .*)
  3238. cf_want_posix_source=yes
  3239. ;;
  3240. esac
  3241. if test "$cf_want_posix_source" = yes ; then
  3242. AC_TRY_COMPILE([#include <sys/types.h>],[
  3243. #ifdef _POSIX_SOURCE
  3244. make an error
  3245. #endif],[],
  3246. cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE")
  3247. fi
  3248. CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE)
  3249. CFLAGS="$cf_trim_CFLAGS"
  3250. CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source"
  3251. CF_MSG_LOG(if the second compile does not leave our definition intact error)
  3252. AC_TRY_COMPILE([#include <sys/types.h>],[
  3253. #ifndef _POSIX_C_SOURCE
  3254. make an error
  3255. #endif],,
  3256. [cf_cv_posix_c_source=no])
  3257. CFLAGS="$cf_save_CFLAGS"
  3258. CPPFLAGS="$cf_save_CPPFLAGS"
  3259. ])
  3260. ])
  3261. if test "$cf_cv_posix_c_source" != no ; then
  3262. CFLAGS="$cf_trim_CFLAGS"
  3263. CPPFLAGS="$cf_trim_CPPFLAGS"
  3264. if test "$cf_cv_cc_u_d_options" = yes ; then
  3265. cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \
  3266. sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'`
  3267. CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source"
  3268. fi
  3269. CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source"
  3270. fi
  3271. ])dnl
  3272. dnl ---------------------------------------------------------------------------
  3273. dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30
  3274. dnl --------------
  3275. dnl Check if C (preprocessor) -U and -D options are processed in the order
  3276. dnl given rather than by type of option. Some compilers insist on apply all
  3277. dnl of the -U options after all of the -D options. Others allow mixing them,
  3278. dnl and may predefine symbols that conflict with those we define.
  3279. AC_DEFUN([CF_PROG_CC_U_D],
  3280. [
  3281. AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[
  3282. cf_save_CPPFLAGS="$CPPFLAGS"
  3283. CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS"
  3284. AC_TRY_COMPILE([],[
  3285. #ifndef U_D_OPTIONS
  3286. make an undefined-error
  3287. #endif
  3288. #ifdef D_U_OPTIONS
  3289. make a defined-error
  3290. #endif
  3291. ],[
  3292. cf_cv_cc_u_d_options=yes],[
  3293. cf_cv_cc_u_d_options=no])
  3294. CPPFLAGS="$cf_save_CPPFLAGS"
  3295. ])
  3296. ])dnl
  3297. dnl ---------------------------------------------------------------------------
  3298. dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18
  3299. dnl -----------
  3300. dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX.
  3301. AC_DEFUN([CF_PROG_EXT],
  3302. [
  3303. AC_REQUIRE([CF_CHECK_CACHE])
  3304. case $cf_cv_system_name in
  3305. os2*)
  3306. CFLAGS="$CFLAGS -Zmt"
  3307. CPPFLAGS="$CPPFLAGS -D__ST_MT_ERRNO__"
  3308. CXXFLAGS="$CXXFLAGS -Zmt"
  3309. # autoconf's macro sets -Zexe and suffix both, which conflict:w
  3310. LDFLAGS="$LDFLAGS -Zmt -Zcrtdll"
  3311. ac_cv_exeext=.exe
  3312. ;;
  3313. esac
  3314. AC_EXEEXT
  3315. AC_OBJEXT
  3316. PROG_EXT="$EXEEXT"
  3317. AC_SUBST(PROG_EXT)
  3318. test -n "$PROG_EXT" && AC_DEFINE_UNQUOTED(PROG_EXT,"$PROG_EXT")
  3319. ])dnl
  3320. dnl ---------------------------------------------------------------------------
  3321. dnl CF_RECHECK_FUNC version: 3 updated: 2000/10/18 19:29:13
  3322. dnl ---------------
  3323. dnl Re-check on a function to see if we can pick it up by adding a library.
  3324. dnl $1 = function to check
  3325. dnl $2 = library to check in
  3326. dnl $3 = environment to update (e.g., $LIBS)
  3327. dnl $4 = what to do if this fails
  3328. dnl
  3329. dnl This uses 'unset' if the shell happens to support it, but leaves the
  3330. dnl configuration variable set to 'unknown' if not. This is a little better
  3331. dnl than the normal autoconf test, which gives misleading results if a test
  3332. dnl for the function is made (e.g., with AC_CHECK_FUNC) after this macro is
  3333. dnl used (autoconf does not distinguish between a null token and one that is
  3334. dnl set to 'no').
  3335. AC_DEFUN([CF_RECHECK_FUNC],[
  3336. AC_CHECK_LIB($2,$1,[
  3337. CF_UPPER(cf_tr_func,$1)
  3338. AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func)
  3339. ac_cv_func_$1=yes
  3340. if test "$cf_used_lib_$2" != yes ; then cf_used_lib_$2=yes; $3="-l$2 [$]$3"; fi],[
  3341. ac_cv_func_$1=unknown
  3342. unset ac_cv_func_$1 2>/dev/null
  3343. $4],
  3344. [[$]$3])
  3345. ])dnl
  3346. dnl ---------------------------------------------------------------------------
  3347. dnl CF_REMOVE_BROKEN version: 3 updated: 1997/11/23 14:49:44
  3348. dnl ----------------
  3349. dnl Check for broken definition of 'remove()'. This is (in particular) broken
  3350. dnl on the older version of SCO (I'd cite version if I knew where to look) by
  3351. dnl having <stdio.h> #define remove to __unlink, which appears in no library.
  3352. dnl
  3353. dnl Fortuitously, we can combine this with a more general test: do we have
  3354. dnl 'unlink()' but no 'remove()'. Note, however, that we cannot simply #define
  3355. dnl remove to unlink, but have to make a fallback function.
  3356. dnl
  3357. AC_DEFUN([CF_REMOVE_BROKEN],
  3358. [
  3359. AC_MSG_CHECKING(for broken/missing definition of remove)
  3360. AC_CACHE_VAL(cf_cv_baddef_remove,[
  3361. AC_TRY_LINK(
  3362. [#include <stdio.h>],
  3363. [remove("dummy")],
  3364. [cf_cv_baddef_remove=no],
  3365. [AC_TRY_LINK(
  3366. [#include <stdio.h>
  3367. int __unlink(name) { return unlink(name); } ],
  3368. [remove("dummy")],
  3369. [cf_cv_baddef_remove=yes],
  3370. [cf_cv_baddef_remove=unknown])
  3371. ])
  3372. ])
  3373. AC_MSG_RESULT($cf_cv_baddef_remove)
  3374. test "$cf_cv_baddef_remove" != no && AC_DEFINE(NEED_REMOVE)
  3375. ])dnl
  3376. dnl ---------------------------------------------------------------------------
  3377. dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18
  3378. dnl ----------------
  3379. dnl Remove all -U and -D options that refer to the given symbol from a list
  3380. dnl of C compiler options. This works around the problem that not all
  3381. dnl compilers process -U and -D options from left-to-right, so a -U option
  3382. dnl cannot be used to cancel the effect of a preceding -D option.
  3383. dnl
  3384. dnl $1 = target (which could be the same as the source variable)
  3385. dnl $2 = source (including '$')
  3386. dnl $3 = symbol to remove
  3387. define([CF_REMOVE_DEFINE],
  3388. [
  3389. # remove $3 symbol from $2
  3390. $1=`echo "$2" | \
  3391. sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \
  3392. -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'`
  3393. ])dnl
  3394. dnl ---------------------------------------------------------------------------
  3395. dnl CF_SET_ERRNO version: 2 updated: 2000/03/26 22:37:59
  3396. dnl ------------
  3397. dnl Check if 'errno' is declared in a fashion that lets us set it.
  3398. AC_DEFUN([CF_SET_ERRNO],
  3399. [
  3400. AC_CACHE_CHECK(if we can set errno,cf_cv_set_errno,[
  3401. AC_TRY_RUN([
  3402. #include <errno.h>
  3403. int main()
  3404. {
  3405. errno = 255;
  3406. exit(errno != 255);
  3407. }],
  3408. [cf_cv_set_errno=yes],
  3409. [cf_cv_set_errno=no],
  3410. [AC_TRY_LINK(
  3411. [#include <errno.h>],
  3412. [errno = 255],
  3413. [cf_cv_set_errno=maybe],
  3414. [cf_cv_set_errno=no])])
  3415. ])
  3416. test "$cf_cv_set_errno" != no && AC_DEFINE(CAN_SET_ERRNO)
  3417. ])dnl
  3418. dnl ---------------------------------------------------------------------------
  3419. dnl CF_SIGWINCH version: 1 updated: 2006/04/02 16:41:09
  3420. dnl -----------
  3421. dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all
  3422. dnl programs need this test).
  3423. dnl
  3424. dnl This is really a MacOS X 10.4.3 workaround. Defining _POSIX_C_SOURCE
  3425. dnl forces SIGWINCH to be undefined (breaks xterm, ncurses). Oddly, the struct
  3426. dnl winsize declaration is left alone - we may revisit this if Apple choose to
  3427. dnl break that part of the interface as well.
  3428. AC_DEFUN([CF_SIGWINCH],
  3429. [
  3430. AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[
  3431. AC_TRY_COMPILE([
  3432. #include <sys/types.h>
  3433. #include <sys/signal.h>
  3434. ],[int x = SIGWINCH],
  3435. [cf_cv_define_sigwinch=yes],
  3436. [AC_TRY_COMPILE([
  3437. #undef _XOPEN_SOURCE
  3438. #undef _POSIX_SOURCE
  3439. #undef _POSIX_C_SOURCE
  3440. #include <sys/types.h>
  3441. #include <sys/signal.h>
  3442. ],[int x = SIGWINCH],
  3443. [cf_cv_define_sigwinch=maybe],
  3444. [cf_cv_define_sigwinch=no])
  3445. ])
  3446. ])
  3447. if test "$cf_cv_define_sigwinch" = maybe ; then
  3448. AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[
  3449. cf_cv_fixup_sigwinch=unknown
  3450. cf_sigwinch=32
  3451. while test $cf_sigwinch != 1
  3452. do
  3453. AC_TRY_COMPILE([
  3454. #undef _XOPEN_SOURCE
  3455. #undef _POSIX_SOURCE
  3456. #undef _POSIX_C_SOURCE
  3457. #include <sys/types.h>
  3458. #include <sys/signal.h>
  3459. ],[
  3460. #if SIGWINCH != $cf_sigwinch
  3461. make an error
  3462. #endif
  3463. int x = SIGWINCH],
  3464. [cf_cv_fixup_sigwinch=$cf_sigwinch
  3465. break])
  3466. cf_sigwinch=`expr $cf_sigwinch - 1`
  3467. done
  3468. ])
  3469. if test "$cf_cv_fixup_sigwinch" != unknown ; then
  3470. CPPFLAGS="$CPPFLAGS -DSIGWINCH=$cf_cv_fixup_sigwinch"
  3471. fi
  3472. fi
  3473. ])dnl
  3474. dnl ---------------------------------------------------------------------------
  3475. dnl CF_SIZECHANGE version: 8 updated: 2000/11/04 12:22:16
  3476. dnl -------------
  3477. dnl Check for definitions & structures needed for window size-changing
  3478. dnl FIXME: check that this works with "snake" (HP-UX 10.x)
  3479. AC_DEFUN([CF_SIZECHANGE],
  3480. [
  3481. AC_REQUIRE([CF_STRUCT_TERMIOS])
  3482. AC_CACHE_CHECK(declaration of size-change, cf_cv_sizechange,[
  3483. cf_cv_sizechange=unknown
  3484. cf_save_CPPFLAGS="$CPPFLAGS"
  3485. for cf_opts in "" "NEED_PTEM_H"
  3486. do
  3487. CPPFLAGS="$cf_save_CPPFLAGS"
  3488. test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts"
  3489. AC_TRY_COMPILE([#include <sys/types.h>
  3490. #ifdef HAVE_TERMIOS_H
  3491. #include <termios.h>
  3492. #else
  3493. #ifdef HAVE_TERMIO_H
  3494. #include <termio.h>
  3495. #endif
  3496. #endif
  3497. #ifdef NEED_PTEM_H
  3498. /* This is a workaround for SCO: they neglected to define struct winsize in
  3499. * termios.h -- it's only in termio.h and ptem.h
  3500. */
  3501. #include <sys/stream.h>
  3502. #include <sys/ptem.h>
  3503. #endif
  3504. #if !defined(sun) || !defined(HAVE_TERMIOS_H)
  3505. #include <sys/ioctl.h>
  3506. #endif
  3507. ],[
  3508. #ifdef TIOCGSIZE
  3509. struct ttysize win; /* FIXME: what system is this? */
  3510. int y = win.ts_lines;
  3511. int x = win.ts_cols;
  3512. #else
  3513. #ifdef TIOCGWINSZ
  3514. struct winsize win;
  3515. int y = win.ws_row;
  3516. int x = win.ws_col;
  3517. #else
  3518. no TIOCGSIZE or TIOCGWINSZ
  3519. #endif /* TIOCGWINSZ */
  3520. #endif /* TIOCGSIZE */
  3521. ],
  3522. [cf_cv_sizechange=yes],
  3523. [cf_cv_sizechange=no])
  3524. CPPFLAGS="$cf_save_CPPFLAGS"
  3525. if test "$cf_cv_sizechange" = yes ; then
  3526. echo "size-change succeeded ($cf_opts)" >&AC_FD_CC
  3527. test -n "$cf_opts" && cf_cv_sizechange="$cf_opts"
  3528. break
  3529. fi
  3530. done
  3531. ])
  3532. if test "$cf_cv_sizechange" != no ; then
  3533. AC_DEFINE(HAVE_SIZECHANGE)
  3534. case $cf_cv_sizechange in #(vi
  3535. NEED*)
  3536. AC_DEFINE_UNQUOTED($cf_cv_sizechange )
  3537. ;;
  3538. esac
  3539. fi
  3540. ])dnl
  3541. dnl ---------------------------------------------------------------------------
  3542. dnl CF_SLANG_CPPFLAGS version: 7 updated: 2003/09/14 19:08:00
  3543. dnl -----------------
  3544. dnl Look for the slang header files in the standard places, adjusting the
  3545. dnl CPPFLAGS variable.
  3546. dnl
  3547. AC_DEFUN([CF_SLANG_CPPFLAGS],
  3548. [
  3549. AC_CACHE_CHECK(for slang header file,cf_cv_slang_header,[
  3550. AC_TRY_COMPILE([#include <slang.h>],
  3551. [printf("%s\n", SLANG_VERSION)],
  3552. [cf_cv_slang_header=predefined],[
  3553. CF_HEADER_PATH(cf_search,slang)
  3554. for cf_incdir in $cf_search
  3555. do
  3556. for cf_header in \
  3557. slang.h
  3558. do
  3559. echo trying $cf_incdir/$cf_header 1>&AC_FD_CC
  3560. if egrep "SLANG_VERSION" $cf_incdir/$cf_header 1>&AC_FD_CC 2>&1; then
  3561. cf_cv_slang_header=$cf_incdir/$cf_header
  3562. break
  3563. fi
  3564. done
  3565. test -n "$cf_cv_slang_header" && break
  3566. done
  3567. test -z "$cf_cv_slang_header" && AC_ERROR(not found)
  3568. ])])
  3569. AC_DEFINE(USE_SLANG)
  3570. CF_DIRNAME(cf_incdir,$cf_cv_slang_header)
  3571. case $cf_cv_slang_header in # (vi
  3572. predefined) # (vi
  3573. ;;
  3574. *)
  3575. CF_ADD_INCDIR($cf_incdir)
  3576. ;;
  3577. esac
  3578. # There's an unofficial set of patches for slang that gives it some limited
  3579. # UTF8 capability. Unfortunately it won't compile unless one defines UTF8.
  3580. AC_CACHE_CHECK(if we must define UTF8,cf_cv_slang_utf8,[
  3581. AC_TRY_COMPILE([
  3582. #include <slang.h>],
  3583. [SLtt_get_screen_size()],
  3584. [cf_cv_slang_utf8=no],
  3585. [
  3586. AC_TRY_COMPILE([
  3587. #define UTF8
  3588. #include <slang.h>],
  3589. [SLtt_get_screen_size()],
  3590. [cf_cv_slang_utf8=yes],
  3591. [cf_cv_slang_utf8=unknown])])
  3592. ])
  3593. if test "$cf_cv_slang_utf8" = yes ; then
  3594. AC_DEFINE(UTF8)
  3595. fi
  3596. ])dnl
  3597. dnl ---------------------------------------------------------------------------
  3598. dnl CF_SLANG_LIBS version: 7 updated: 2002/09/17 19:03:38
  3599. dnl -------------
  3600. dnl Look for the slang library.
  3601. AC_DEFUN([CF_SLANG_LIBS],
  3602. [
  3603. cf_slang_LIBS1="$LIBS"
  3604. CF_TERMCAP_LIBS
  3605. cf_slang_LIBS2="$LIBS"
  3606. AC_CHECK_FUNC(acos,,[CF_RECHECK_FUNC(acos,m,LIBS)])
  3607. case $host_os in #(vi
  3608. os2*)
  3609. CF_FIND_LIBRARY(video,video,
  3610. [#include <sys/video.h>],
  3611. [v_init()],
  3612. v_init)
  3613. ;;
  3614. esac
  3615. CF_FIND_LIBRARY(slang,slang,
  3616. [#include <slang.h>],
  3617. [SLtt_get_screen_size()],
  3618. SLtt_get_screen_size)
  3619. cf_slang_LIBS3="$LIBS"
  3620. AC_MSG_CHECKING(if we can link slang without termcap)
  3621. if test -n "`echo $cf_slang_LIBS1 | sed -e 's/ //g'`" ; then
  3622. cf_exclude=`echo ".$cf_slang_LIBS2" | sed -e "s%$cf_slang_LIBS1%%" -e 's%^.%%'`
  3623. else
  3624. cf_exclude="$cf_slang_LIBS2"
  3625. fi
  3626. LIBS=`echo ".$cf_slang_LIBS3" | sed -e "s%$cf_exclude%%" -e 's%^.%%'`
  3627. AC_TRY_LINK([#include <slang.h>],
  3628. [SLtt_get_screen_size()],
  3629. [cf_result=yes],
  3630. [cf_result=no])
  3631. AC_MSG_RESULT($cf_result)
  3632. test $cf_result = no && LIBS="$cf_slang_LIBS3"
  3633. ])dnl
  3634. dnl ---------------------------------------------------------------------------
  3635. dnl CF_SLANG_UNIX_DEFS version: 3 updated: 2000/05/20 11:59:59
  3636. dnl ------------------
  3637. dnl Slang's header files rely on some predefined symbols to declare variables
  3638. dnl that we might find useful. This check is needed, because those symbols
  3639. dnl are generally not available.
  3640. AC_DEFUN([CF_SLANG_UNIX_DEFS],
  3641. [
  3642. AC_REQUIRE([CF_SLANG_CPPFLAGS])
  3643. AC_REQUIRE([CF_SLANG_LIBS])
  3644. AC_CACHE_CHECK(if we must tell slang this is UNIX,cf_cv_slang_unix,[
  3645. AC_TRY_LINK([#include <slang.h>],
  3646. [
  3647. #ifdef REAL_UNIX_SYSTEM
  3648. make an error
  3649. #else
  3650. extern int SLang_TT_Baud_Rate;
  3651. SLang_TT_Baud_Rate = 1
  3652. #endif
  3653. ],
  3654. [cf_cv_slang_unix=yes],
  3655. [cf_cv_slang_unix=no])
  3656. ])
  3657. test $cf_cv_slang_unix = yes && AC_DEFINE(REAL_UNIX_SYSTEM)
  3658. ])dnl
  3659. dnl ---------------------------------------------------------------------------
  3660. dnl CF_SOCKS version: 3 updated: 2001/01/01 09:54:40
  3661. dnl --------
  3662. dnl Check for socks library
  3663. dnl $1 = the [optional] directory in which the library may be found
  3664. AC_DEFUN([CF_SOCKS],[
  3665. case "$1" in #(vi
  3666. no|yes) #(vi
  3667. ;;
  3668. *)
  3669. if test -d $1 ; then
  3670. if test -d $1/include ; then
  3671. CPPFLAGS="$CPPFLAGS -I$1/include"
  3672. LIBS="$LIBS -L$1/lib"
  3673. else
  3674. LIBS="$LIBS -L$1"
  3675. test -d $1/../include && CPPFLAGS="$CPPFLAGS -I$1/../include"
  3676. fi
  3677. else
  3678. AC_MSG_WARN(expected a directory: $1)
  3679. fi
  3680. ;;
  3681. esac
  3682. LIBS="$LIBS -lsocks"
  3683. AC_DEFINE(SOCKS)
  3684. AC_DEFINE(accept,Raccept)
  3685. AC_DEFINE(bind,Rbind)
  3686. AC_DEFINE(connect,Rconnect)
  3687. AC_DEFINE(getpeername,Rgetpeername)
  3688. AC_DEFINE(getsockname,Rgetsockname)
  3689. AC_DEFINE(listen,Rlisten)
  3690. AC_DEFINE(recvfrom,Rrecvfrom)
  3691. AC_DEFINE(select,Rselect)
  3692. AC_TRY_LINK([
  3693. #include <stdio.h>],[
  3694. accept((char *)0)],,
  3695. [AC_ERROR(Cannot link with socks library)])
  3696. ])dnl
  3697. dnl ---------------------------------------------------------------------------
  3698. dnl CF_SOCKS5 version: 7 updated: 2001/01/01 09:54:40
  3699. dnl ---------
  3700. dnl Check for socks5 configuration
  3701. dnl $1 = the [optional] directory in which the library may be found
  3702. AC_DEFUN([CF_SOCKS5],[
  3703. case "$1" in #(vi
  3704. no|yes) #(vi
  3705. ;;
  3706. *)
  3707. if test -d $1 ; then
  3708. if test -d $1/include ; then
  3709. CPPFLAGS="$CPPFLAGS -I$1/include"
  3710. LIBS="$LIBS -L$1/lib"
  3711. else
  3712. LIBS="$LIBS -L$1"
  3713. test -d $1/../include && CPPFLAGS="$CPPFLAGS -I$1/../include"
  3714. fi
  3715. else
  3716. AC_MSG_WARN(expected a directory: $1)
  3717. fi
  3718. ;;
  3719. esac
  3720. LIBS="$LIBS -lsocks5"
  3721. AC_DEFINE(USE_SOCKS5)
  3722. AC_DEFINE(SOCKS)
  3723. AC_MSG_CHECKING(if the socks library uses socks4 prefix)
  3724. cf_use_socks4=error
  3725. AC_TRY_LINK([
  3726. #include <socks.h>],[
  3727. Rinit((char *)0)],
  3728. [AC_DEFINE(USE_SOCKS4_PREFIX)
  3729. cf_use_socks4=yes],
  3730. [AC_TRY_LINK([#include <socks.h>],
  3731. [SOCKSinit((char *)0)],
  3732. [cf_use_socks4=no],
  3733. [AC_ERROR(Cannot link with socks5 library)])])
  3734. AC_MSG_RESULT($cf_use_socks4)
  3735. if test "$cf_use_socks4" = "yes" ; then
  3736. AC_DEFINE(accept,Raccept)
  3737. AC_DEFINE(bind,Rbind)
  3738. AC_DEFINE(connect,Rconnect)
  3739. AC_DEFINE(getpeername,Rgetpeername)
  3740. AC_DEFINE(getsockname,Rgetsockname)
  3741. AC_DEFINE(listen,Rlisten)
  3742. AC_DEFINE(recvfrom,Rrecvfrom)
  3743. AC_DEFINE(select,Rselect)
  3744. else
  3745. AC_DEFINE(accept,SOCKSaccept)
  3746. AC_DEFINE(getpeername,SOCKSgetpeername)
  3747. AC_DEFINE(getsockname,SOCKSgetsockname)
  3748. AC_DEFINE(recvfrom,SOCKSrecvfrom)
  3749. fi
  3750. AC_MSG_CHECKING(if socks5p.h is available)
  3751. AC_TRY_COMPILE([
  3752. #define INCLUDE_PROTOTYPES
  3753. #include <socks.h>],[
  3754. init((char *)0)],
  3755. [cf_use_socks5p_h=yes],
  3756. [cf_use_socks5p_h=no])
  3757. AC_MSG_RESULT($cf_use_socks5p_h)
  3758. test "$cf_use_socks5p_h" = yes && AC_DEFINE(INCLUDE_PROTOTYPES)
  3759. ])dnl
  3760. dnl ---------------------------------------------------------------------------
  3761. dnl CF_SRAND version: 7 updated: 2004/05/23 13:00:30
  3762. dnl --------
  3763. dnl Check for functions similar to srand() and rand(). lrand48() and random()
  3764. dnl return a 31-bit value, while rand() returns a value less than RAND_MAX
  3765. dnl which usually is only 16-bits.
  3766. dnl On MirOS, use arc4random_push() and arc4random().
  3767. AC_DEFUN([CF_SRAND],[
  3768. AC_CACHE_CHECK(for random-integer functions, cf_cv_srand_func,[
  3769. cf_cv_srand_func=unknown
  3770. for cf_func in arc4random_push/arc4random srandom/random srand48/lrand48 srand/rand
  3771. do
  3772. cf_srand_func=`echo $cf_func | sed -e 's%/.*%%'`
  3773. cf_rand_func=`echo $cf_func | sed -e 's%.*/%%'`
  3774. AC_TRY_LINK([
  3775. #ifdef HAVE_STDLIB_H
  3776. #include <stdlib.h>
  3777. #endif
  3778. #ifdef HAVE_LIMITS_H
  3779. #include <limits.h>
  3780. #endif
  3781. ],[long seed = 1; $cf_srand_func(seed); seed = $cf_rand_func()],
  3782. [cf_cv_srand_func=$cf_func
  3783. break])
  3784. done
  3785. ])
  3786. if test "$cf_cv_srand_func" != unknown ; then
  3787. AC_CACHE_CHECK(for range of random-integers, cf_cv_rand_max,[
  3788. case $cf_cv_srand_func in
  3789. srand/rand)
  3790. cf_cv_rand_max=RAND_MAX
  3791. cf_rand_max=16
  3792. ;;
  3793. arc4random_push/arc4random)
  3794. cf_cv_rand_max=0xFFFFFFFFUL
  3795. cf_rand_max=32
  3796. ;;
  3797. *)
  3798. cf_cv_rand_max=INT_MAX
  3799. cf_rand_max=31
  3800. ;;
  3801. esac
  3802. AC_TRY_COMPILE([
  3803. #ifdef HAVE_STDLIB_H
  3804. #include <stdlib.h>
  3805. #endif
  3806. #ifdef HAVE_LIMITS_H
  3807. #include <limits.h>
  3808. #endif
  3809. ],[long x = $cf_cv_rand_max],,
  3810. [cf_cv_rand_max="(1L<<$cf_rand_max)-1"])
  3811. ])
  3812. cf_srand_func=`echo $cf_func | sed -e 's%/.*%%'`
  3813. cf_rand_func=`echo $cf_func | sed -e 's%.*/%%'`
  3814. CF_UPPER(cf_rand_max,ifelse($1,,my_,$1)rand_max)
  3815. AC_DEFINE_UNQUOTED(ifelse($1,,my_,$1)srand,$cf_srand_func)
  3816. AC_DEFINE_UNQUOTED(ifelse($1,,my_,$1)rand, $cf_rand_func)
  3817. AC_DEFINE_UNQUOTED([$]cf_rand_max, $cf_cv_rand_max)
  3818. fi
  3819. ])dnl
  3820. dnl ---------------------------------------------------------------------------
  3821. dnl CF_SSL version: 5 updated: 2004/04/26 20:08:48
  3822. dnl ------
  3823. dnl Check for ssl library
  3824. dnl $1 = the [optional] directory in which the library may be found
  3825. AC_DEFUN([CF_SSL],[
  3826. cf_ssl_root=
  3827. cf_ssl_library="-lssl -lcrypto"
  3828. case "$1" in #(vi
  3829. no) #(vi
  3830. ;;
  3831. yes) #(vi
  3832. AC_CHECK_LIB(ssl, SSL_get_version,[],[
  3833. cf_ssl_root=/usr/local/ssl
  3834. if test -d $cf_ssl_root ; then
  3835. CF_VERBOSE(assume it is in $cf_ssl_root)
  3836. cf_ssl_library="-L$cf_ssl_root/lib $cf_ssl_library"
  3837. else
  3838. AC_MSG_ERROR(cannot find ssl library)
  3839. fi
  3840. ],
  3841. [-lcrypto])
  3842. ;;
  3843. *)
  3844. if test -d $1 ; then
  3845. if test -d $1/include ; then
  3846. cf_ssl_root=$1
  3847. elif test -d $1/../include ; then
  3848. cf_ssl_root=$1/..
  3849. else
  3850. AC_MSG_ERROR(cannot find ssl library under $1)
  3851. fi
  3852. cf_ssl_library="-L$cf_ssl_root/lib $cf_ssl_library"
  3853. else
  3854. AC_MSG_WARN(expected a directory: $1)
  3855. fi
  3856. ;;
  3857. esac
  3858. LIBS="$cf_ssl_library $LIBS"
  3859. cf_ssl_subincs=yes
  3860. if test -n "$cf_ssl_root" ; then
  3861. if test -d $cf_ssl_root/include ; then
  3862. CF_ADD_CFLAGS(-I$cf_ssl_root/include)
  3863. test -d $cf_ssl_root/include/openssl || cf_ssl_subincs=no
  3864. fi
  3865. fi
  3866. if test "$cf_ssl_subincs" = yes ; then
  3867. AC_MSG_CHECKING(for openssl include directory)
  3868. AC_TRY_COMPILE([
  3869. #include <stdio.h>
  3870. #include <openssl/ssl.h>],
  3871. [SSL_shutdown((SSL *)0)],
  3872. [cf_openssl_incl=yes],
  3873. [cf_openssl_incl=no])
  3874. AC_MSG_RESULT($cf_openssl_incl)
  3875. test "$cf_openssl_incl" = yes && AC_DEFINE(USE_OPENSSL_INCL)
  3876. fi
  3877. AC_MSG_CHECKING(if we can link to ssl library)
  3878. AC_TRY_LINK([
  3879. #include <stdio.h>
  3880. #ifdef USE_OPENSSL_INCL
  3881. #include <openssl/ssl.h>
  3882. #else
  3883. #include <ssl.h>
  3884. #endif
  3885. ],
  3886. [SSL_shutdown((SSL *)0)],
  3887. [cf_ssl_library=yes],
  3888. [cf_ssl_library=no])
  3889. AC_MSG_RESULT($cf_ssl_library)
  3890. if test "$cf_ssl_library" = yes ; then
  3891. AC_DEFINE(USE_SSL)
  3892. AC_DEFINE(USE_X509_SUPPORT)
  3893. else
  3894. AC_ERROR(Cannot link with ssl library)
  3895. fi
  3896. ])dnl
  3897. dnl ---------------------------------------------------------------------------
  3898. dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52
  3899. dnl --------------
  3900. dnl Remove "-g" option from the compiler options
  3901. AC_DEFUN([CF_STRIP_G_OPT],
  3902. [$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl
  3903. dnl ---------------------------------------------------------------------------
  3904. dnl CF_STRIP_O_OPT version: 3 updated: 2001/02/02 19:06:08
  3905. dnl --------------
  3906. dnl Remove "-O" option from the compiler options
  3907. AC_DEFUN([CF_STRIP_O_OPT],[
  3908. $1=`echo ${$1} | sed -e 's/-O[[1-9]]\? //' -e 's/-O[[1-9]]\?$//'`
  3909. ])dnl
  3910. dnl ---------------------------------------------------------------------------
  3911. dnl CF_STRUCT_TERMIOS version: 5 updated: 2000/11/04 12:22:46
  3912. dnl -----------------
  3913. dnl Some machines require _POSIX_SOURCE to completely define struct termios.
  3914. dnl If so, define SVR4_TERMIO
  3915. AC_DEFUN([CF_STRUCT_TERMIOS],[
  3916. AC_CHECK_HEADERS( \
  3917. termio.h \
  3918. termios.h \
  3919. unistd.h \
  3920. )
  3921. if test "$ISC" = yes ; then
  3922. AC_CHECK_HEADERS( sys/termio.h )
  3923. fi
  3924. if test "$ac_cv_header_termios_h" = yes ; then
  3925. case "$CFLAGS $CPPFLAGS" in
  3926. *-D_POSIX_SOURCE*)
  3927. termios_bad=dunno ;;
  3928. *) termios_bad=maybe ;;
  3929. esac
  3930. if test "$termios_bad" = maybe ; then
  3931. AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE)
  3932. AC_TRY_COMPILE([#include <termios.h>],
  3933. [struct termios foo; int x = foo.c_iflag],
  3934. termios_bad=no, [
  3935. AC_TRY_COMPILE([
  3936. #define _POSIX_SOURCE
  3937. #include <termios.h>],
  3938. [struct termios foo; int x = foo.c_iflag],
  3939. termios_bad=unknown,
  3940. termios_bad=yes AC_DEFINE(SVR4_TERMIO))
  3941. ])
  3942. AC_MSG_RESULT($termios_bad)
  3943. fi
  3944. fi
  3945. ])dnl
  3946. dnl ---------------------------------------------------------------------------
  3947. dnl CF_SUBDIR_PATH version: 3 updated: 2002/12/29 18:30:46
  3948. dnl --------------
  3949. dnl Construct a search-list for a nonstandard header/lib-file
  3950. dnl $1 = the variable to return as result
  3951. dnl $2 = the package name
  3952. dnl $3 = the subdirectory, e.g., bin, include or lib
  3953. AC_DEFUN([CF_SUBDIR_PATH],
  3954. [$1=""
  3955. test -d [$]HOME && {
  3956. test -n "$verbose" && echo " ... testing $3-directories under [$]HOME"
  3957. test -d [$]HOME/$3 && $1="[$]$1 [$]HOME/$3"
  3958. test -d [$]HOME/$3/$2 && $1="[$]$1 [$]HOME/$3/$2"
  3959. test -d [$]HOME/$3/$2/$3 && $1="[$]$1 [$]HOME/$3/$2/$3"
  3960. }
  3961. # For other stuff under the home directory, it should be sufficient to put
  3962. # a symbolic link for $HOME/$2 to the actual package location:
  3963. test -d [$]HOME/$2 && {
  3964. test -n "$verbose" && echo " ... testing $3-directories under [$]HOME/$2"
  3965. test -d [$]HOME/$2/$3 && $1="[$]$1 [$]HOME/$2/$3"
  3966. test -d [$]HOME/$2/$3/$2 && $1="[$]$1 [$]HOME/$2/$3/$2"
  3967. }
  3968. test "$prefix" != /usr/local && \
  3969. test -d /usr/local && {
  3970. test -n "$verbose" && echo " ... testing $3-directories under /usr/local"
  3971. test -d /usr/local/$3 && $1="[$]$1 /usr/local/$3"
  3972. test -d /usr/local/$3/$2 && $1="[$]$1 /usr/local/$3/$2"
  3973. test -d /usr/local/$3/$2/$3 && $1="[$]$1 /usr/local/$3/$2/$3"
  3974. test -d /usr/local/$2/$3 && $1="[$]$1 /usr/local/$2/$3"
  3975. test -d /usr/local/$2/$3/$2 && $1="[$]$1 /usr/local/$2/$3/$2"
  3976. }
  3977. test "$prefix" != NONE && \
  3978. test -d $prefix && {
  3979. test -n "$verbose" && echo " ... testing $3-directories under $prefix"
  3980. test -d $prefix/$3 && $1="[$]$1 $prefix/$3"
  3981. test -d $prefix/$3/$2 && $1="[$]$1 $prefix/$3/$2"
  3982. test -d $prefix/$3/$2/$3 && $1="[$]$1 $prefix/$3/$2/$3"
  3983. test -d $prefix/$2/$3 && $1="[$]$1 $prefix/$2/$3"
  3984. test -d $prefix/$2/$3/$2 && $1="[$]$1 $prefix/$2/$3/$2"
  3985. }
  3986. test "$prefix" != /opt && \
  3987. test -d /opt && {
  3988. test -n "$verbose" && echo " ... testing $3-directories under /opt"
  3989. test -d /opt/$3 && $1="[$]$1 /opt/$3"
  3990. test -d /opt/$3/$2 && $1="[$]$1 /opt/$3/$2"
  3991. test -d /opt/$3/$2/$3 && $1="[$]$1 /opt/$3/$2/$3"
  3992. test -d /opt/$2/$3 && $1="[$]$1 /opt/$2/$3"
  3993. test -d /opt/$2/$3/$2 && $1="[$]$1 /opt/$2/$3/$2"
  3994. }
  3995. test "$prefix" != /usr && \
  3996. test -d /usr && {
  3997. test -n "$verbose" && echo " ... testing $3-directories under /usr"
  3998. test -d /usr/$3 && $1="[$]$1 /usr/$3"
  3999. test -d /usr/$3/$2 && $1="[$]$1 /usr/$3/$2"
  4000. test -d /usr/$3/$2/$3 && $1="[$]$1 /usr/$3/$2/$3"
  4001. test -d /usr/$2/$3 && $1="[$]$1 /usr/$2/$3"
  4002. }
  4003. ])dnl
  4004. dnl ---------------------------------------------------------------------------
  4005. dnl CF_SUBST version: 4 updated: 2006/06/17 12:33:03
  4006. dnl --------
  4007. dnl Shorthand macro for substituting things that the user may override
  4008. dnl with an environment variable.
  4009. dnl
  4010. dnl $1 = long/descriptive name
  4011. dnl $2 = environment variable
  4012. dnl $3 = default value
  4013. AC_DEFUN([CF_SUBST],
  4014. [AC_CACHE_VAL(cf_cv_subst_$2,[
  4015. AC_MSG_CHECKING(for $1 (symbol $2))
  4016. CF_SUBST_IF([-z "[$]$2"], [$2], [$3])
  4017. cf_cv_subst_$2=[$]$2
  4018. AC_MSG_RESULT([$]$2)
  4019. ])
  4020. ])dnl
  4021. dnl ---------------------------------------------------------------------------
  4022. dnl CF_SUBST_IF version: 2 updated: 2006/06/17 12:33:03
  4023. dnl -----------
  4024. dnl Shorthand macro for substituting things that the user may override
  4025. dnl with an environment variable.
  4026. dnl
  4027. dnl $1 = condition to pass to "test"
  4028. dnl $2 = environment variable
  4029. dnl $3 = value if the test succeeds
  4030. dnl $4 = value if the test fails
  4031. AC_DEFUN([CF_SUBST_IF],
  4032. [
  4033. if test $1 ; then
  4034. $2=$3
  4035. ifelse($4,,,[else
  4036. $2=$4])
  4037. fi
  4038. AC_SUBST($2)
  4039. ])dnl
  4040. dnl ---------------------------------------------------------------------------
  4041. dnl CF_SYSTEM_MAIL_FLAGS version: 3 updated: 1998/11/18 14:45:34
  4042. dnl --------------------
  4043. AC_DEFUN([CF_SYSTEM_MAIL_FLAGS],
  4044. [
  4045. AC_MSG_CHECKING([system mail flags])
  4046. AC_CACHE_VAL(cf_cv_system_mail_flags,[
  4047. case $cf_cv_SYSTEM_MAIL in
  4048. */mmdf/*)
  4049. [cf_cv_system_mail_flags="-mlruxto,cc\\\\*"]
  4050. ;;
  4051. *)
  4052. [cf_cv_system_mail_flags="-t -oi"]
  4053. esac
  4054. ])
  4055. AC_MSG_RESULT($cf_cv_system_mail_flags)
  4056. AC_DEFINE_UNQUOTED(SYSTEM_MAIL_FLAGS, "$cf_cv_system_mail_flags")
  4057. ])dnl
  4058. dnl ---------------------------------------------------------------------------
  4059. dnl CF_SYSV_UTMP version: 5 updated: 2001/12/27 12:55:07
  4060. dnl ------------
  4061. dnl Check if this is a SYSV flavor of UTMP
  4062. AC_DEFUN([CF_SYSV_UTMP],
  4063. [
  4064. AC_CACHE_CHECK(if $cf_cv_have_utmp is SYSV flavor,cf_cv_sysv_utmp,[
  4065. test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx"
  4066. AC_TRY_LINK([
  4067. #include <sys/types.h>
  4068. #include <${cf_cv_have_utmp}.h>],[
  4069. struct $cf_cv_have_utmp x;
  4070. set${cf_prefix}ent ();
  4071. get${cf_prefix}id(&x);
  4072. put${cf_prefix}line(&x);
  4073. end${cf_prefix}ent();],
  4074. [cf_cv_sysv_utmp=yes],
  4075. [cf_cv_sysv_utmp=no])
  4076. ])
  4077. test $cf_cv_sysv_utmp = yes && AC_DEFINE(USE_SYSV_UTMP)
  4078. ])dnl
  4079. dnl ---------------------------------------------------------------------------
  4080. dnl CF_SYS_ERRLIST version: 6 updated: 2001/12/30 13:03:23
  4081. dnl --------------
  4082. dnl Check for declaration of sys_nerr and sys_errlist in one of stdio.h and
  4083. dnl errno.h. Declaration of sys_errlist on BSD4.4 interferes with our
  4084. dnl declaration. Reported by Keith Bostic.
  4085. AC_DEFUN([CF_SYS_ERRLIST],
  4086. [
  4087. CF_CHECK_ERRNO(sys_nerr)
  4088. CF_CHECK_ERRNO(sys_errlist)
  4089. ])dnl
  4090. dnl ---------------------------------------------------------------------------
  4091. dnl CF_TAR_OPTIONS version: 2 updated: 2005/08/24 20:15:11
  4092. dnl --------------
  4093. dnl This is just a list of the most common tar options, allowing for variants
  4094. dnl that can operate with the "-" standard input/output option.
  4095. AC_DEFUN([CF_TAR_OPTIONS],
  4096. [
  4097. case ifelse($1,,tar,$1) in
  4098. *pax|*pax$EXEEXT)
  4099. TAR_UP_OPTIONS="-w"
  4100. TAR_DOWN_OPTIONS="-r"
  4101. TAR_PIPE_OPTIONS=""
  4102. TAR_FILE_OPTIONS="-f"
  4103. ;;
  4104. *star|*star$EXEEXT)
  4105. TAR_UP_OPTIONS="-c -f"
  4106. TAR_DOWN_OPTIONS="-x -U -f"
  4107. TAR_PIPE_OPTIONS="-"
  4108. TAR_FILE_OPTIONS=""
  4109. ;;
  4110. *tar|*tar$EXEEXT)
  4111. # FIXME: some versions of tar require, some don't allow the "-"
  4112. TAR_UP_OPTIONS="-cf"
  4113. TAR_DOWN_OPTIONS="-xf"
  4114. TAR_PIPE_OPTIONS="-"
  4115. TAR_FILE_OPTIONS=""
  4116. ;;
  4117. esac
  4118. AC_SUBST(TAR_UP_OPTIONS)
  4119. AC_SUBST(TAR_DOWN_OPTIONS)
  4120. AC_SUBST(TAR_FILE_OPTIONS)
  4121. AC_SUBST(TAR_PIPE_OPTIONS)
  4122. ])dnl
  4123. dnl ---------------------------------------------------------------------------
  4124. dnl CF_TERMCAP_LIBS version: 10 updated: 2001/10/18 20:42:39
  4125. dnl ---------------
  4126. dnl Look for termcap libraries, or the equivalent in terminfo.
  4127. AC_DEFUN([CF_TERMCAP_LIBS],
  4128. [
  4129. AC_CACHE_VAL(cf_cv_termlib,[
  4130. cf_cv_termlib=none
  4131. AC_TRY_LINK([],[char *x=(char*)tgoto("",0,0)],
  4132. [AC_TRY_LINK([],[int x=tigetstr("")],
  4133. [cf_cv_termlib=terminfo],
  4134. [cf_cv_termlib=termcap])
  4135. CF_VERBOSE(using functions in predefined $cf_cv_termlib LIBS)
  4136. ],[
  4137. ifelse([$1],,,[
  4138. case "$1" in # (vi
  4139. ncurses*)
  4140. CF_NCURSES_CPPFLAGS($1)
  4141. CF_NCURSES_LIBS($1)
  4142. cf_cv_termlib=terminfo
  4143. ;;
  4144. esac
  4145. ])
  4146. if test "$cf_cv_termlib" = none; then
  4147. # FreeBSD's linker gives bogus results for AC_CHECK_LIB, saying that
  4148. # tgetstr lives in -lcurses when it is only an unsatisfied extern.
  4149. cf_save_LIBS="$LIBS"
  4150. for cf_lib in curses ncurses termlib termcap
  4151. do
  4152. LIBS="-l$cf_lib $cf_save_LIBS"
  4153. for cf_func in tigetstr tgetstr
  4154. do
  4155. AC_MSG_CHECKING(for $cf_func in -l$cf_lib)
  4156. AC_TRY_LINK([],[int x=$cf_func("")],[cf_result=yes],[cf_result=no])
  4157. AC_MSG_RESULT($cf_result)
  4158. if test "$cf_result" = yes ; then
  4159. if test "$cf_func" = tigetstr ; then
  4160. cf_cv_termlib=terminfo
  4161. else
  4162. cf_cv_termlib=termcap
  4163. fi
  4164. break
  4165. fi
  4166. done
  4167. test "$cf_result" = yes && break
  4168. done
  4169. test "$cf_result" = no && LIBS="$cf_save_LIBS"
  4170. fi
  4171. if test "$cf_cv_termlib" = none; then
  4172. # allow curses library for broken AIX system.
  4173. AC_CHECK_LIB(curses, initscr, [LIBS="$LIBS -lcurses" cf_cv_termlib=termcap])
  4174. AC_CHECK_LIB(termcap, tgoto, [LIBS="$LIBS -ltermcap" cf_cv_termlib=termcap])
  4175. fi
  4176. ])
  4177. if test "$cf_cv_termlib" = none; then
  4178. AC_MSG_WARN([Cannot find -ltermlib, -lcurses, or -ltermcap])
  4179. fi
  4180. ])])dnl
  4181. dnl ---------------------------------------------------------------------------
  4182. dnl CF_TERMIO_AND_CURSES version: 3 updated: 2000/12/31 19:47:37
  4183. dnl --------------------
  4184. dnl Check if including termio.h with <curses.h> dies like on sysv68
  4185. dnl FIXME: this is too Lynx-specific
  4186. AC_DEFUN([CF_TERMIO_AND_CURSES],
  4187. [
  4188. AC_CACHE_CHECK(if we can include termio.h with curses,cf_cv_termio_and_curses,[
  4189. cf_save_CFLAGS="$CPPFLAGS"
  4190. CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H -I. -I${srcdir-.} -I${srcdir-.}/src -I${srcdir-.}/WWW/Library/Implementation"
  4191. touch lynx_cfg.h
  4192. AC_TRY_COMPILE([
  4193. #include <$1>
  4194. #include <termio.h>],
  4195. [putchar(0x0a)],
  4196. [cf_cv_termio_and_curses=yes],
  4197. [cf_cv_termio_and_curses=no])
  4198. CPPFLAGS="$cf_save_CFLAGS"
  4199. rm -f lynx_cfg.h
  4200. ])
  4201. test $cf_cv_termio_and_curses = yes && AC_DEFINE(TERMIO_AND_CURSES)
  4202. ])dnl
  4203. dnl ---------------------------------------------------------------------------
  4204. dnl CF_TERMIO_AND_TERMIOS version: 2 updated: 1997/08/28 20:22:00
  4205. dnl ---------------------
  4206. dnl Check if including both termio.h and termios.h die like on DG.UX
  4207. AC_DEFUN([CF_TERMIO_AND_TERMIOS],
  4208. [
  4209. AC_MSG_CHECKING([termio.h and termios.h])
  4210. AC_CACHE_VAL(cf_cv_termio_and_termios,[
  4211. AC_TRY_COMPILE([
  4212. #if HAVE_TERMIO_H
  4213. #include <termio.h>
  4214. #endif
  4215. #if HAVE_TERMIOS_H
  4216. #include <termios.h>
  4217. #endif ],
  4218. [putchar (0x0a)],
  4219. [cf_cv_termio_and_termios=yes],
  4220. [cf_cv_termio_and_termios=no])])
  4221. AC_MSG_RESULT($cf_cv_termio_and_termios)
  4222. test $cf_cv_termio_and_termios = no && AC_DEFINE(TERMIO_AND_TERMIOS)
  4223. ])dnl
  4224. dnl ---------------------------------------------------------------------------
  4225. dnl CF_TERM_HEADER version: 1 updated: 2005/12/31 13:26:39
  4226. dnl --------------
  4227. dnl Look for term.h, which is part of X/Open curses. It defines the interface
  4228. dnl to terminfo database. Usually it is in the same include-path as curses.h,
  4229. dnl but some packagers change this, breaking various applications.
  4230. AC_DEFUN([CF_TERM_HEADER],[
  4231. AC_CACHE_CHECK(for terminfo header, cf_cv_term_header,[
  4232. case ${cf_cv_ncurses_header} in #(vi
  4233. */ncurses.h|*/ncursesw.h) #(vi
  4234. cf_term_header=`echo "$cf_cv_ncurses_header" | sed -e 's%ncurses[[^.]]*\.h$%term.h%'`
  4235. ;;
  4236. *)
  4237. cf_term_header=term.h
  4238. ;;
  4239. esac
  4240. for cf_test in $cf_term_header "ncurses/term.h" "ncursesw/term.h"
  4241. do
  4242. AC_TRY_COMPILE([#include <stdio.h>
  4243. #include <${cf_cv_ncurses_header-curses.h}>
  4244. #include <$cf_test>
  4245. ],[int x = auto_left_margin],[
  4246. cf_cv_term_header="$cf_test"],[
  4247. cf_cv_term_header=unknown
  4248. ])
  4249. test "$cf_cv_term_header" != unknown && break
  4250. done
  4251. ])
  4252. # Set definitions to allow ifdef'ing to accommodate subdirectories
  4253. case $cf_cv_term_header in # (vi
  4254. *term.h)
  4255. AC_DEFINE(HAVE_TERM_H)
  4256. ;;
  4257. esac
  4258. case $cf_cv_term_header in # (vi
  4259. ncurses/term.h) #(vi
  4260. AC_DEFINE(HAVE_NCURSES_TERM_H)
  4261. ;;
  4262. ncursesw/term.h)
  4263. AC_DEFINE(HAVE_NCURSESW_TERM_H)
  4264. ;;
  4265. esac
  4266. ])dnl
  4267. dnl ---------------------------------------------------------------------------
  4268. dnl CF_TTYTYPE version: 4 updated: 2002/10/27 18:21:42
  4269. dnl ----------
  4270. AC_DEFUN([CF_TTYTYPE],
  4271. [
  4272. AC_MSG_CHECKING(if ttytype is declared in curses library)
  4273. AC_CACHE_VAL(cf_cv_have_ttytype,[
  4274. AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>],
  4275. [char *x = &ttytype[1]; *x = 1],
  4276. [cf_cv_have_ttytype=yes],
  4277. [cf_cv_have_ttytype=no])
  4278. ])
  4279. AC_MSG_RESULT($cf_cv_have_ttytype)
  4280. test $cf_cv_have_ttytype = yes && AC_DEFINE(HAVE_TTYTYPE)
  4281. ])dnl
  4282. dnl ---------------------------------------------------------------------------
  4283. dnl CF_UNION_WAIT version: 5 updated: 1997/11/23 14:49:44
  4284. dnl -------------
  4285. dnl Check to see if the BSD-style union wait is declared. Some platforms may
  4286. dnl use this, though it is deprecated in favor of the 'int' type in Posix.
  4287. dnl Some vendors provide a bogus implementation that declares union wait, but
  4288. dnl uses the 'int' type instead; we try to spot these by checking for the
  4289. dnl associated macros.
  4290. dnl
  4291. dnl Ahem. Some implementers cast the status value to an int*, as an attempt to
  4292. dnl use the macros for either union wait or int. So we do a check compile to
  4293. dnl see if the macros are defined and apply to an int.
  4294. dnl
  4295. dnl Sets: $cf_cv_type_unionwait
  4296. dnl Defines: HAVE_TYPE_UNIONWAIT
  4297. AC_DEFUN([CF_UNION_WAIT],
  4298. [
  4299. AC_REQUIRE([CF_WAIT_HEADERS])
  4300. AC_MSG_CHECKING([for union wait])
  4301. AC_CACHE_VAL(cf_cv_type_unionwait,[
  4302. AC_TRY_LINK($cf_wait_headers,
  4303. [int x;
  4304. int y = WEXITSTATUS(x);
  4305. int z = WTERMSIG(x);
  4306. wait(&x);
  4307. ],
  4308. [cf_cv_type_unionwait=no
  4309. echo compiles ok w/o union wait 1>&AC_FD_CC
  4310. ],[
  4311. AC_TRY_LINK($cf_wait_headers,
  4312. [union wait x;
  4313. #ifdef WEXITSTATUS
  4314. int y = WEXITSTATUS(x);
  4315. #endif
  4316. #ifdef WTERMSIG
  4317. int z = WTERMSIG(x);
  4318. #endif
  4319. wait(&x);
  4320. ],
  4321. [cf_cv_type_unionwait=yes
  4322. echo compiles ok with union wait and possibly macros too 1>&AC_FD_CC
  4323. ],
  4324. [cf_cv_type_unionwait=no])])])
  4325. AC_MSG_RESULT($cf_cv_type_unionwait)
  4326. test $cf_cv_type_unionwait = yes && AC_DEFINE(HAVE_TYPE_UNIONWAIT)
  4327. ])dnl
  4328. dnl ---------------------------------------------------------------------------
  4329. dnl CF_UPPER version: 5 updated: 2001/01/29 23:40:59
  4330. dnl --------
  4331. dnl Make an uppercase version of a variable
  4332. dnl $1=uppercase($2)
  4333. AC_DEFUN([CF_UPPER],
  4334. [
  4335. $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%`
  4336. ])dnl
  4337. dnl ---------------------------------------------------------------------------
  4338. dnl CF_UTF8_LIB version: 4 updated: 2003/03/01 18:36:42
  4339. dnl -----------
  4340. dnl Check for multibyte support, and if not found, utf8 compatibility library
  4341. AC_DEFUN([CF_UTF8_LIB],
  4342. [
  4343. AC_CACHE_CHECK(for multibyte character support,cf_cv_utf8_lib,[
  4344. cf_save_LIBS="$LIBS"
  4345. AC_TRY_LINK([
  4346. #include <stdlib.h>],[putwc(0,0);],
  4347. [cf_cv_utf8_lib=yes],
  4348. [LIBS="-lutf8 $LIBS"
  4349. AC_TRY_LINK([
  4350. #include <libutf8.h>],[putwc(0,0);],
  4351. [cf_cv_utf8_lib=add-on],
  4352. [cf_cv_utf8_lib=no])
  4353. LIBS="$cf_save_LIBS"
  4354. ])])
  4355. # HAVE_LIBUTF8_H is used by ncurses if curses.h is shared between
  4356. # ncurses/ncursesw:
  4357. if test "$cf_cv_utf8_lib" = "add-on" ; then
  4358. AC_DEFINE(HAVE_LIBUTF8_H)
  4359. LIBS="-lutf8 $LIBS"
  4360. fi
  4361. ])dnl
  4362. dnl ---------------------------------------------------------------------------
  4363. dnl CF_UTMP version: 8 updated: 2002/10/27 23:21:42
  4364. dnl -------
  4365. dnl Check for UTMP/UTMPX headers
  4366. AC_DEFUN([CF_UTMP],
  4367. [
  4368. AC_REQUIRE([CF_LASTLOG])
  4369. AC_CACHE_CHECK(for utmp implementation,cf_cv_have_utmp,[
  4370. cf_cv_have_utmp=no
  4371. for cf_header in utmpx utmp ; do
  4372. cf_utmp_includes="
  4373. #include <sys/types.h>
  4374. #include <${cf_header}.h>
  4375. #define getutent getutxent
  4376. #ifdef USE_LASTLOG
  4377. #include <lastlog.h> /* may conflict with utmpx.h on Linux */
  4378. #endif
  4379. "
  4380. AC_TRY_COMPILE([$cf_utmp_includes],
  4381. [struct $cf_header x;
  4382. char *name = x.ut_name; /* utmp.h and compatible definitions */
  4383. ],
  4384. [cf_cv_have_utmp=$cf_header
  4385. break],
  4386. [
  4387. AC_TRY_COMPILE([$cf_utmp_includes],
  4388. [struct $cf_header x;
  4389. char *name = x.ut_user; /* utmpx.h must declare this */
  4390. ],
  4391. [cf_cv_have_utmp=$cf_header
  4392. break
  4393. ])])
  4394. done
  4395. ])
  4396. if test $cf_cv_have_utmp != no ; then
  4397. AC_DEFINE(HAVE_UTMP)
  4398. test $cf_cv_have_utmp = utmpx && AC_DEFINE(UTMPX_FOR_UTMP)
  4399. CF_UTMP_UT_HOST
  4400. CF_UTMP_UT_NAME
  4401. CF_UTMP_UT_XSTATUS
  4402. CF_UTMP_UT_XTIME
  4403. CF_UTMP_UT_SESSION
  4404. CF_SYSV_UTMP
  4405. fi
  4406. ])dnl
  4407. dnl ---------------------------------------------------------------------------
  4408. dnl CF_UTMP_UT_HOST version: 6 updated: 2002/10/27 23:21:42
  4409. dnl ---------------
  4410. dnl Check if UTMP/UTMPX struct defines ut_host member
  4411. AC_DEFUN([CF_UTMP_UT_HOST],
  4412. [
  4413. if test $cf_cv_have_utmp != no ; then
  4414. AC_MSG_CHECKING(if utmp.ut_host is declared)
  4415. AC_CACHE_VAL(cf_cv_have_utmp_ut_host,[
  4416. AC_TRY_COMPILE([
  4417. #include <sys/types.h>
  4418. #include <${cf_cv_have_utmp}.h>],
  4419. [struct $cf_cv_have_utmp x; char *y = &x.ut_host[0]],
  4420. [cf_cv_have_utmp_ut_host=yes],
  4421. [cf_cv_have_utmp_ut_host=no])
  4422. ])
  4423. AC_MSG_RESULT($cf_cv_have_utmp_ut_host)
  4424. test $cf_cv_have_utmp_ut_host != no && AC_DEFINE(HAVE_UTMP_UT_HOST)
  4425. fi
  4426. ])dnl
  4427. dnl ---------------------------------------------------------------------------
  4428. dnl CF_UTMP_UT_NAME version: 3 updated: 2002/10/27 23:21:42
  4429. dnl ---------------
  4430. dnl Check if UTMP/UTMPX struct defines ut_name member
  4431. AC_DEFUN([CF_UTMP_UT_NAME],
  4432. [
  4433. if test $cf_cv_have_utmp != no ; then
  4434. AC_CACHE_CHECK(if utmp.ut_name is declared,cf_cv_have_utmp_ut_name,[
  4435. cf_cv_have_utmp_ut_name=no
  4436. cf_utmp_includes="
  4437. #include <sys/types.h>
  4438. #include <${cf_cv_have_utmp}.h>
  4439. #define getutent getutxent
  4440. #ifdef USE_LASTLOG
  4441. #include <lastlog.h> /* may conflict with utmpx.h on Linux */
  4442. #endif
  4443. "
  4444. for cf_header in ut_name ut_user ; do
  4445. AC_TRY_COMPILE([$cf_utmp_includes],
  4446. [struct $cf_cv_have_utmp x;
  4447. char *name = x.$cf_header;
  4448. ],
  4449. [cf_cv_have_utmp_ut_name=$cf_header
  4450. break])
  4451. done
  4452. ])
  4453. case $cf_cv_have_utmp_ut_name in #(vi
  4454. no) #(vi
  4455. AC_MSG_ERROR(Cannot find declaration for ut.ut_name)
  4456. ;;
  4457. ut_user)
  4458. AC_DEFINE(ut_name,ut_user)
  4459. ;;
  4460. esac
  4461. fi
  4462. ])dnl
  4463. dnl ---------------------------------------------------------------------------
  4464. dnl CF_UTMP_UT_SESSION version: 4 updated: 2002/10/27 23:21:42
  4465. dnl ------------------
  4466. dnl Check if UTMP/UTMPX struct defines ut_session member
  4467. AC_DEFUN([CF_UTMP_UT_SESSION],
  4468. [
  4469. if test $cf_cv_have_utmp != no ; then
  4470. AC_CACHE_CHECK(if utmp.ut_session is declared, cf_cv_have_utmp_ut_session,[
  4471. AC_TRY_COMPILE([
  4472. #include <sys/types.h>
  4473. #include <${cf_cv_have_utmp}.h>],
  4474. [struct $cf_cv_have_utmp x; long y = x.ut_session],
  4475. [cf_cv_have_utmp_ut_session=yes],
  4476. [cf_cv_have_utmp_ut_session=no])
  4477. ])
  4478. if test $cf_cv_have_utmp_ut_session != no ; then
  4479. AC_DEFINE(HAVE_UTMP_UT_SESSION)
  4480. fi
  4481. fi
  4482. ])dnl
  4483. dnl ---------------------------------------------------------------------------
  4484. dnl CF_UTMP_UT_XSTATUS version: 3 updated: 2001/12/27 12:55:07
  4485. dnl ------------------
  4486. dnl Check for known variants on the UTMP/UTMPX struct's exit-status as reported
  4487. dnl by various people:
  4488. dnl
  4489. dnl ut_exit.__e_exit (HPUX 11 - David Ellement, also in glibc2)
  4490. dnl ut_exit.e_exit (SVR4)
  4491. dnl ut_exit.ut_e_exit (os390 - Greg Smith)
  4492. dnl ut_exit.ut_exit (Tru64 4.0f - Jeremie Petit, 4.0e - Tomas Vanhala)
  4493. dnl
  4494. dnl Note: utmp_xstatus is not a conventional compatibility definition in the
  4495. dnl system header files.
  4496. AC_DEFUN([CF_UTMP_UT_XSTATUS],
  4497. [
  4498. if test $cf_cv_have_utmp != no ; then
  4499. AC_CACHE_CHECK(for exit-status in $cf_cv_have_utmp,cf_cv_have_utmp_ut_xstatus,[
  4500. for cf_result in \
  4501. ut_exit.__e_exit \
  4502. ut_exit.e_exit \
  4503. ut_exit.ut_e_exit \
  4504. ut_exit.ut_exit
  4505. do
  4506. AC_TRY_COMPILE([
  4507. #include <sys/types.h>
  4508. #include <${cf_cv_have_utmp}.h>],
  4509. [struct $cf_cv_have_utmp x; long y = x.$cf_result = 0],
  4510. [cf_cv_have_utmp_ut_xstatus=$cf_result
  4511. break],
  4512. [cf_cv_have_utmp_ut_xstatus=no])
  4513. done
  4514. ])
  4515. if test $cf_cv_have_utmp_ut_xstatus != no ; then
  4516. AC_DEFINE(HAVE_UTMP_UT_XSTATUS)
  4517. AC_DEFINE_UNQUOTED(ut_xstatus,$cf_cv_have_utmp_ut_xstatus)
  4518. fi
  4519. fi
  4520. ])dnl
  4521. dnl ---------------------------------------------------------------------------
  4522. dnl CF_UTMP_UT_XTIME version: 6 updated: 2002/10/27 23:21:42
  4523. dnl ----------------
  4524. dnl Check if UTMP/UTMPX struct defines ut_xtime member
  4525. AC_DEFUN([CF_UTMP_UT_XTIME],
  4526. [
  4527. if test $cf_cv_have_utmp != no ; then
  4528. AC_CACHE_CHECK(if utmp.ut_xtime is declared, cf_cv_have_utmp_ut_xtime,[
  4529. AC_TRY_COMPILE([
  4530. #include <sys/types.h>
  4531. #include <${cf_cv_have_utmp}.h>],
  4532. [struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0],
  4533. [cf_cv_have_utmp_ut_xtime=yes],
  4534. [AC_TRY_COMPILE([
  4535. #include <sys/types.h>
  4536. #include <${cf_cv_have_utmp}.h>],
  4537. [struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec],
  4538. [cf_cv_have_utmp_ut_xtime=define],
  4539. [cf_cv_have_utmp_ut_xtime=no])
  4540. ])
  4541. ])
  4542. if test $cf_cv_have_utmp_ut_xtime != no ; then
  4543. AC_DEFINE(HAVE_UTMP_UT_XTIME)
  4544. if test $cf_cv_have_utmp_ut_xtime = define ; then
  4545. AC_DEFINE(ut_xtime,ut_tv.tv_sec)
  4546. fi
  4547. fi
  4548. fi
  4549. ])dnl
  4550. dnl ---------------------------------------------------------------------------
  4551. dnl CF_VARARGS version: 3 updated: 1998/12/10 20:06:29
  4552. dnl ----------
  4553. dnl Check for ANSI stdarg.h vs varargs.h. Note that some systems include
  4554. dnl <varargs.h> within <stdarg.h>.
  4555. AC_DEFUN([CF_VARARGS],
  4556. [
  4557. AC_CHECK_HEADERS(stdarg.h varargs.h)
  4558. AC_MSG_CHECKING(for standard varargs)
  4559. AC_CACHE_VAL(cf_cv_ansi_varargs,[
  4560. AC_TRY_COMPILE([
  4561. #if HAVE_STDARG_H
  4562. #include <stdarg.h>
  4563. #else
  4564. #if HAVE_VARARGS_H
  4565. #include <varargs.h>
  4566. #endif
  4567. #endif
  4568. ],
  4569. [return 0;} int foo(char *fmt,...){va_list args;va_start(args,fmt);va_end(args)],
  4570. [cf_cv_ansi_varargs=yes],
  4571. [cf_cv_ansi_varargs=no])
  4572. ])
  4573. AC_MSG_RESULT($cf_cv_ansi_varargs)
  4574. test $cf_cv_ansi_varargs = yes && AC_DEFINE(ANSI_VARARGS)
  4575. ])dnl
  4576. dnl ---------------------------------------------------------------------------
  4577. dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14
  4578. dnl ----------
  4579. dnl Use AC_VERBOSE w/o the warnings
  4580. AC_DEFUN([CF_VERBOSE],
  4581. [test -n "$verbose" && echo " $1" 1>&AC_FD_MSG
  4582. ])dnl
  4583. dnl ---------------------------------------------------------------------------
  4584. dnl CF_WAIT_HEADERS version: 2 updated: 1997/10/21 19:45:33
  4585. dnl ---------------
  4586. dnl Build up an expression $cf_wait_headers with the header files needed to
  4587. dnl compile against the prototypes for 'wait()', 'waitpid()', etc. Assume it's
  4588. dnl Posix, which uses <sys/types.h> and <sys/wait.h>, but allow SVr4 variation
  4589. dnl with <wait.h>.
  4590. AC_DEFUN([CF_WAIT_HEADERS],
  4591. [
  4592. AC_HAVE_HEADERS(sys/wait.h)
  4593. cf_wait_headers="#include <sys/types.h>
  4594. "
  4595. if test $ac_cv_header_sys_wait_h = yes; then
  4596. cf_wait_headers="$cf_wait_headers
  4597. #include <sys/wait.h>
  4598. "
  4599. else
  4600. AC_HAVE_HEADERS(wait.h)
  4601. AC_HAVE_HEADERS(waitstatus.h)
  4602. if test $ac_cv_header_wait_h = yes; then
  4603. cf_wait_headers="$cf_wait_headers
  4604. #include <wait.h>
  4605. "
  4606. fi
  4607. if test $ac_cv_header_waitstatus_h = yes; then
  4608. cf_wait_headers="$cf_wait_headers
  4609. #include <waitstatus.h>
  4610. "
  4611. fi
  4612. fi
  4613. ])dnl
  4614. dnl ---------------------------------------------------------------------------
  4615. dnl CF_WIDEC_CURSES version: 3 updated: 2001/11/18 20:52:38
  4616. dnl ---------------
  4617. dnl Check for curses implementations that can handle wide-characters
  4618. AC_DEFUN([CF_WIDEC_CURSES],
  4619. [
  4620. AC_CACHE_CHECK(if curses supports wide characters,cf_cv_widec_curses,[
  4621. AC_TRY_LINK([
  4622. #include <stdlib.h>
  4623. #include <${cf_cv_ncurses_header-curses.h}>],[
  4624. wchar_t temp[2];
  4625. wchar_t wch = 'A';
  4626. temp[0] = wch;
  4627. waddnwstr(stdscr, temp, 1);
  4628. ],
  4629. [cf_cv_widec_curses=yes],
  4630. [cf_cv_widec_curses=no])
  4631. ])
  4632. if test "$cf_cv_widec_curses" = yes ; then
  4633. AC_DEFINE(WIDEC_CURSES)
  4634. # This is needed on Tru64 5.0 to declare mbstate_t
  4635. AC_CACHE_CHECK(if we must include wchar.h to declare mbstate_t,cf_cv_widec_mbstate,[
  4636. AC_TRY_COMPILE([
  4637. #include <stdlib.h>
  4638. #include <${cf_cv_ncurses_header-curses.h}>],
  4639. [mbstate_t state],
  4640. [cf_cv_widec_mbstate=no],
  4641. [AC_TRY_COMPILE([
  4642. #include <stdlib.h>
  4643. #include <wchar.h>
  4644. #include <${cf_cv_ncurses_header-curses.h}>],
  4645. [mbstate_t state],
  4646. [cf_cv_widec_mbstate=yes],
  4647. [cf_cv_widec_mbstate=unknown])])])
  4648. if test "$cf_cv_widec_mbstate" = yes ; then
  4649. AC_DEFINE(NEED_WCHAR_H)
  4650. fi
  4651. if test "$cf_cv_widec_mbstate" != unknown ; then
  4652. AC_DEFINE(HAVE_MBSTATE_T)
  4653. fi
  4654. fi
  4655. ])dnl
  4656. dnl ---------------------------------------------------------------------------
  4657. dnl CF_WITH_BZLIB version: 2 updated: 2004/01/24 17:45:25
  4658. dnl -------------
  4659. dnl Check for libbz2 aka "bzlib"
  4660. AC_DEFUN([CF_WITH_BZLIB],[
  4661. AC_MSG_CHECKING(if we need to add -I option to get bzlib.h)
  4662. AC_TRY_COMPILE([#include <zlib.h>],[],[AC_MSG_RESULT(no)],[
  4663. AC_MSG_RESULT(yes)
  4664. CF_HEADER_PATH(cf_search,bzlib)
  4665. for cf_incdir in $cf_search
  4666. do
  4667. if test -f $cf_incdir/bzlib.h ; then
  4668. CF_ADD_CFLAGS(-I$cf_incdir)
  4669. CF_VERBOSE(... found in $cf_incdir)
  4670. break
  4671. fi
  4672. CF_VERBOSE(... tested $cf_incdir)
  4673. done
  4674. ])
  4675. CF_FIND_LIBRARY(bz2,bz2, [
  4676. #include <stdio.h>
  4677. #include <bzlib.h>],
  4678. [BZ2_bzopen("name","mode")],
  4679. BZ2_bzopen)
  4680. ])dnl
  4681. dnl ---------------------------------------------------------------------------
  4682. dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59
  4683. dnl ------------------
  4684. dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses
  4685. dnl libraries.
  4686. AC_DEFUN([CF_WITH_CURSES_DIR],[
  4687. AC_ARG_WITH(curses-dir,
  4688. [ --with-curses-dir=DIR directory in which (n)curses is installed],
  4689. [CF_PATH_SYNTAX(withval)
  4690. cf_cv_curses_dir=$withval],
  4691. [cf_cv_curses_dir=no])
  4692. ])dnl
  4693. dnl ---------------------------------------------------------------------------
  4694. dnl CF_WITH_PATH version: 7 updated: 2006/08/03 15:20:08
  4695. dnl ------------
  4696. dnl Wrapper for AC_ARG_WITH to ensure that user supplies a pathname, not just
  4697. dnl defaulting to yes/no.
  4698. dnl
  4699. dnl $1 = option name
  4700. dnl $2 = help-text
  4701. dnl $3 = environment variable to set
  4702. dnl $4 = default value, shown in the help-message, must be a constant
  4703. dnl $5 = default value, if it's an expression & cannot be in the help-message
  4704. dnl
  4705. AC_DEFUN([CF_WITH_PATH],
  4706. [AC_ARG_WITH($1,[$2 ](default: ifelse($4,,empty,$4)),,
  4707. ifelse($4,,[withval="${$3}"],[withval="${$3-ifelse($5,,$4,$5)}"]))dnl
  4708. CF_PATH_SYNTAX(withval)
  4709. $3="$withval"
  4710. AC_SUBST($3)dnl
  4711. ])dnl
  4712. dnl ---------------------------------------------------------------------------
  4713. dnl CF_WITH_ZLIB version: 1 updated: 2003/10/05 17:36:14
  4714. dnl ------------
  4715. dnl check for libz aka "zlib"
  4716. AC_DEFUN([CF_WITH_ZLIB],[
  4717. AC_MSG_CHECKING(if we need to add -I option to get zlib.h)
  4718. AC_TRY_COMPILE([#include <zlib.h>],[],[AC_MSG_RESULT(no)],[
  4719. AC_MSG_RESULT(yes)
  4720. CF_HEADER_PATH(cf_search,zlib)
  4721. for cf_incdir in $cf_search
  4722. do
  4723. if test -f $cf_incdir/zlib.h ; then
  4724. CF_ADD_CFLAGS(-I$cf_incdir)
  4725. CF_VERBOSE(... found in $cf_incdir)
  4726. break
  4727. fi
  4728. CF_VERBOSE(... tested $cf_incdir)
  4729. done
  4730. ])
  4731. CF_FIND_LIBRARY(z,z,
  4732. [#include <zlib.h>],
  4733. [gzopen("name","mode")],
  4734. gzopen)
  4735. ])dnl
  4736. dnl ---------------------------------------------------------------------------
  4737. dnl CF_XOPEN_CURSES version: 8 updated: 2003/11/07 19:47:46
  4738. dnl ---------------
  4739. dnl Test if we should define X/Open source for curses, needed on Digital Unix
  4740. dnl 4.x, to see the extended functions, but breaks on IRIX 6.x.
  4741. dnl
  4742. dnl The getbegyx() check is needed for HPUX, which omits legacy macros such
  4743. dnl as getbegy(). The latter is better design, but the former is standard.
  4744. AC_DEFUN([CF_XOPEN_CURSES],
  4745. [
  4746. AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl
  4747. AC_CACHE_CHECK(if we must define _XOPEN_SOURCE_EXTENDED,cf_cv_need_xopen_extension,[
  4748. AC_TRY_LINK([
  4749. #include <stdlib.h>
  4750. #include <${cf_cv_ncurses_header-curses.h}>],[
  4751. long x = winnstr(stdscr, "", 0);
  4752. int x1, y1;
  4753. getbegyx(stdscr, y1, x1)],
  4754. [cf_cv_need_xopen_extension=no],
  4755. [AC_TRY_LINK([
  4756. #define _XOPEN_SOURCE_EXTENDED
  4757. #include <stdlib.h>
  4758. #include <${cf_cv_ncurses_header-curses.h}>],[
  4759. long x = winnstr(stdscr, "", 0);
  4760. int x1, y1;
  4761. getbegyx(stdscr, y1, x1)],
  4762. [cf_cv_need_xopen_extension=yes],
  4763. [cf_cv_need_xopen_extension=unknown])])])
  4764. test $cf_cv_need_xopen_extension = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED"
  4765. ])dnl
  4766. dnl ---------------------------------------------------------------------------
  4767. dnl CF_XOPEN_SOURCE version: 24 updated: 2006/04/02 16:41:09
  4768. dnl ---------------
  4769. dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions,
  4770. dnl or adapt to the vendor's definitions to get equivalent functionality,
  4771. dnl without losing the common non-POSIX features.
  4772. dnl
  4773. dnl Parameters:
  4774. dnl $1 is the nominal value for _XOPEN_SOURCE
  4775. dnl $2 is the nominal value for _POSIX_C_SOURCE
  4776. AC_DEFUN([CF_XOPEN_SOURCE],[
  4777. AC_REQUIRE([CF_PROG_CC_U_D])
  4778. cf_XOPEN_SOURCE=ifelse($1,,500,$1)
  4779. cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2)
  4780. case $host_os in #(vi
  4781. aix[[45]]*) #(vi
  4782. CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE"
  4783. ;;
  4784. freebsd*) #(vi
  4785. # 5.x headers associate
  4786. # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L
  4787. # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L
  4788. cf_POSIX_C_SOURCE=200112L
  4789. cf_XOPEN_SOURCE=600
  4790. CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
  4791. ;;
  4792. hpux*) #(vi
  4793. CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE"
  4794. ;;
  4795. irix[[56]].*) #(vi
  4796. CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE"
  4797. ;;
  4798. linux*|gnu*) #(vi
  4799. CF_GNU_SOURCE
  4800. ;;
  4801. mirbsd*) #(vi
  4802. # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks <arpa/inet.h>
  4803. ;;
  4804. netbsd*) #(vi
  4805. # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw
  4806. ;;
  4807. openbsd*) #(vi
  4808. # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw
  4809. ;;
  4810. osf[[45]]*) #(vi
  4811. CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE"
  4812. ;;
  4813. nto-qnx*) #(vi
  4814. CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE"
  4815. ;;
  4816. sco*) #(vi
  4817. # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
  4818. ;;
  4819. solaris*) #(vi
  4820. CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__"
  4821. ;;
  4822. *)
  4823. AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[
  4824. AC_TRY_COMPILE([#include <sys/types.h>],[
  4825. #ifndef _XOPEN_SOURCE
  4826. make an error
  4827. #endif],
  4828. [cf_cv_xopen_source=no],
  4829. [cf_save="$CPPFLAGS"
  4830. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
  4831. AC_TRY_COMPILE([#include <sys/types.h>],[
  4832. #ifdef _XOPEN_SOURCE
  4833. make an error
  4834. #endif],
  4835. [cf_cv_xopen_source=no],
  4836. [cf_cv_xopen_source=$cf_XOPEN_SOURCE])
  4837. CPPFLAGS="$cf_save"
  4838. ])
  4839. ])
  4840. if test "$cf_cv_xopen_source" != no ; then
  4841. CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE)
  4842. CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE)
  4843. test "$cf_cv_cc_u_d_options" = yes && \
  4844. CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE"
  4845. CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source"
  4846. fi
  4847. CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE)
  4848. ;;
  4849. esac
  4850. ])
  4851. dnl ---------------------------------------------------------------------------
  4852. dnl CF_X_ATHENA version: 12 updated: 2004/06/15 21:14:41
  4853. dnl -----------
  4854. dnl Check for Xaw (Athena) libraries
  4855. dnl
  4856. dnl Sets $cf_x_athena according to the flavor of Xaw which is used.
  4857. AC_DEFUN([CF_X_ATHENA],
  4858. [AC_REQUIRE([CF_X_TOOLKIT])
  4859. cf_x_athena=${cf_x_athena-Xaw}
  4860. AC_MSG_CHECKING(if you want to link with Xaw 3d library)
  4861. withval=
  4862. AC_ARG_WITH(Xaw3d,
  4863. [ --with-Xaw3d link with Xaw 3d library])
  4864. if test "$withval" = yes ; then
  4865. cf_x_athena=Xaw3d
  4866. AC_MSG_RESULT(yes)
  4867. else
  4868. AC_MSG_RESULT(no)
  4869. fi
  4870. AC_MSG_CHECKING(if you want to link with neXT Athena library)
  4871. withval=
  4872. AC_ARG_WITH(neXtaw,
  4873. [ --with-neXtaw link with neXT Athena library])
  4874. if test "$withval" = yes ; then
  4875. cf_x_athena=neXtaw
  4876. AC_MSG_RESULT(yes)
  4877. else
  4878. AC_MSG_RESULT(no)
  4879. fi
  4880. AC_MSG_CHECKING(if you want to link with Athena-Plus library)
  4881. withval=
  4882. AC_ARG_WITH(XawPlus,
  4883. [ --with-XawPlus link with Athena-Plus library])
  4884. if test "$withval" = yes ; then
  4885. cf_x_athena=XawPlus
  4886. AC_MSG_RESULT(yes)
  4887. else
  4888. AC_MSG_RESULT(no)
  4889. fi
  4890. AC_CHECK_LIB(Xext,XextCreateExtension,
  4891. [LIBS="-lXext $LIBS"])
  4892. cf_x_athena_lib=""
  4893. CF_X_ATHENA_CPPFLAGS($cf_x_athena)
  4894. CF_X_ATHENA_LIBS($cf_x_athena)
  4895. ])dnl
  4896. dnl ---------------------------------------------------------------------------
  4897. dnl CF_X_ATHENA_CPPFLAGS version: 2 updated: 2002/10/09 20:00:37
  4898. dnl --------------------
  4899. dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
  4900. dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
  4901. AC_DEFUN([CF_X_ATHENA_CPPFLAGS],
  4902. [
  4903. cf_x_athena_root=ifelse($1,,Xaw,$1)
  4904. cf_x_athena_include=""
  4905. for cf_path in default \
  4906. /usr/contrib/X11R6 \
  4907. /usr/contrib/X11R5 \
  4908. /usr/lib/X11R5 \
  4909. /usr/local
  4910. do
  4911. if test -z "$cf_x_athena_include" ; then
  4912. cf_save="$CPPFLAGS"
  4913. cf_test=X11/$cf_x_athena_root/SimpleMenu.h
  4914. if test $cf_path != default ; then
  4915. CPPFLAGS="-I$cf_path/include $cf_save"
  4916. AC_MSG_CHECKING(for $cf_test in $cf_path)
  4917. else
  4918. AC_MSG_CHECKING(for $cf_test)
  4919. fi
  4920. AC_TRY_COMPILE([
  4921. #include <X11/Intrinsic.h>
  4922. #include <$cf_test>],[],
  4923. [cf_result=yes],
  4924. [cf_result=no])
  4925. AC_MSG_RESULT($cf_result)
  4926. if test "$cf_result" = yes ; then
  4927. cf_x_athena_include=$cf_path
  4928. break
  4929. else
  4930. CPPFLAGS="$cf_save"
  4931. fi
  4932. fi
  4933. done
  4934. if test -z "$cf_x_athena_include" ; then
  4935. AC_MSG_WARN(
  4936. [Unable to successfully find Athena header files with test program])
  4937. elif test "$cf_x_athena_include" != default ; then
  4938. CPPFLAGS="$CPPFLAGS -I$cf_x_athena_include"
  4939. fi
  4940. ])
  4941. dnl ---------------------------------------------------------------------------
  4942. dnl CF_X_ATHENA_LIBS version: 3 updated: 2003/02/16 15:24:54
  4943. dnl ----------------
  4944. dnl Normally invoked by CF_X_ATHENA, with $1 set to the appropriate flavor of
  4945. dnl the Athena widgets, e.g., Xaw, Xaw3d, neXtaw.
  4946. AC_DEFUN([CF_X_ATHENA_LIBS],
  4947. [AC_REQUIRE([CF_X_TOOLKIT])
  4948. cf_x_athena_root=ifelse($1,,Xaw,$1)
  4949. cf_x_athena_lib=""
  4950. for cf_path in default \
  4951. /usr/contrib/X11R6 \
  4952. /usr/contrib/X11R5 \
  4953. /usr/lib/X11R5 \
  4954. /usr/local
  4955. do
  4956. for cf_lib in \
  4957. "-l$cf_x_athena_root -lXmu" \
  4958. "-l$cf_x_athena_root -lXpm -lXmu" \
  4959. "-l${cf_x_athena_root}_s -lXmu_s"
  4960. do
  4961. if test -z "$cf_x_athena_lib" ; then
  4962. cf_save="$LIBS"
  4963. cf_test=XawSimpleMenuAddGlobalActions
  4964. if test $cf_path != default ; then
  4965. LIBS="-L$cf_path/lib $cf_lib $LIBS"
  4966. AC_MSG_CHECKING(for $cf_lib in $cf_path)
  4967. else
  4968. LIBS="$cf_lib $LIBS"
  4969. AC_MSG_CHECKING(for $cf_test in $cf_lib)
  4970. fi
  4971. cf_SAVE="$LIBS"
  4972. LIBS="$X_PRE_LIBS $LIBS $X_EXTRA_LIBS"
  4973. AC_TRY_LINK([],[$cf_test()],
  4974. [cf_result=yes],
  4975. [cf_result=no])
  4976. AC_MSG_RESULT($cf_result)
  4977. if test "$cf_result" = yes ; then
  4978. cf_x_athena_lib="$cf_lib"
  4979. LIBS="$cf_SAVE"
  4980. break
  4981. else
  4982. LIBS="$cf_save"
  4983. fi
  4984. fi
  4985. done
  4986. done
  4987. if test -z "$cf_x_athena_lib" ; then
  4988. AC_ERROR(
  4989. [Unable to successfully link Athena library (-l$cf_x_athena_root) with test program])
  4990. fi
  4991. CF_UPPER(cf_x_athena_LIBS,HAVE_LIB_$cf_x_athena)
  4992. AC_DEFINE_UNQUOTED($cf_x_athena_LIBS)
  4993. ])
  4994. dnl ---------------------------------------------------------------------------
  4995. dnl CF_X_TOOLKIT version: 10 updated: 2004/04/25 15:37:17
  4996. dnl ------------
  4997. dnl Check for X Toolkit libraries
  4998. dnl
  4999. AC_DEFUN([CF_X_TOOLKIT],
  5000. [
  5001. AC_REQUIRE([AC_PATH_XTRA])
  5002. AC_REQUIRE([CF_CHECK_CACHE])
  5003. # SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -`
  5004. cf_have_X_LIBS=no
  5005. LDFLAGS="$X_LIBS $LDFLAGS"
  5006. CF_CHECK_CFLAGS($X_CFLAGS)
  5007. AC_CHECK_FUNC(XOpenDisplay,,[
  5008. AC_CHECK_LIB(X11,XOpenDisplay,
  5009. [LIBS="-lX11 $LIBS"],,
  5010. [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
  5011. AC_CHECK_FUNC(XtAppInitialize,,[
  5012. AC_CHECK_LIB(Xt, XtAppInitialize,
  5013. [AC_DEFINE(HAVE_LIBXT)
  5014. cf_have_X_LIBS=Xt
  5015. LIBS="-lXt $X_PRE_LIBS $LIBS"],,
  5016. [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS])])
  5017. if test $cf_have_X_LIBS = no ; then
  5018. AC_WARN(
  5019. [Unable to successfully link X Toolkit library (-lXt) with
  5020. test program. You will have to check and add the proper libraries by hand
  5021. to makefile.])
  5022. fi
  5023. ])dnl
  5024. dnl ---------------------------------------------------------------------------
  5025. dnl jm_GLIBC21 version: 3 updated: 2002/10/27 23:21:42
  5026. dnl ----------
  5027. dnl Inserted as requested by gettext 0.10.40
  5028. dnl File from /usr/share/aclocal
  5029. dnl glibc21.m4
  5030. dnl ====================
  5031. dnl serial 2
  5032. dnl
  5033. dnl Test for the GNU C Library, version 2.1 or newer.
  5034. dnl From Bruno Haible.
  5035. AC_DEFUN([jm_GLIBC21],
  5036. [
  5037. AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
  5038. ac_cv_gnu_library_2_1,
  5039. [AC_EGREP_CPP([Lucky GNU user],
  5040. [
  5041. #include <features.h>
  5042. #ifdef __GNU_LIBRARY__
  5043. #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
  5044. Lucky GNU user
  5045. #endif
  5046. #endif
  5047. ],
  5048. ac_cv_gnu_library_2_1=yes,
  5049. ac_cv_gnu_library_2_1=no)
  5050. ]
  5051. )
  5052. AC_SUBST(GLIBC21)
  5053. GLIBC21="$ac_cv_gnu_library_2_1"
  5054. ]
  5055. )