KOffice – TDE office suite internationalization translations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

acinclude.m4 161KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944
  1. ## -*- autoconf -*-
  2. dnl This file is part of the KDE libraries/packages
  3. dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
  4. dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
  5. dnl This file is free software; you can redistribute it and/or
  6. dnl modify it under the terms of the GNU Library General Public
  7. dnl License as published by the Free Software Foundation; either
  8. dnl version 2 of the License, or (at your option) any later version.
  9. dnl This library is distributed in the hope that it will be useful,
  10. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. dnl Library General Public License for more details.
  13. dnl You should have received a copy of the GNU Library General Public License
  14. dnl along with this library; see the file COPYING.LIB. If not, write to
  15. dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. dnl Boston, MA 02110-1301, USA.
  17. dnl IMPORTANT NOTE:
  18. dnl Please do not modify this file unless you expect your modifications to be
  19. dnl carried into every other module in the repository.
  20. dnl
  21. dnl Single-module modifications are best placed in configure.in for tdelibs
  22. dnl and tdebase or configure.in.in if present.
  23. # KDE_PATH_X_DIRECT
  24. dnl Internal subroutine of AC_PATH_X.
  25. dnl Set ac_x_includes and/or ac_x_libraries.
  26. AC_DEFUN([KDE_PATH_X_DIRECT],
  27. [
  28. AC_REQUIRE([KDE_CHECK_LIB64])
  29. if test "$ac_x_includes" = NO; then
  30. # Guess where to find include files, by looking for this one X11 .h file.
  31. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
  32. # First, try using that file with no special directory specified.
  33. AC_TRY_CPP([#include <$x_direct_test_include>],
  34. [# We can compile using X headers with no special include directory.
  35. ac_x_includes=],
  36. [# Look for the header file in a standard set of common directories.
  37. # Check X11 before X11Rn because it is often a symlink to the current release.
  38. for ac_dir in \
  39. /usr/X11/include \
  40. /usr/X11R6/include \
  41. /usr/X11R5/include \
  42. /usr/X11R4/include \
  43. \
  44. /usr/include/X11 \
  45. /usr/include/X11R6 \
  46. /usr/include/X11R5 \
  47. /usr/include/X11R4 \
  48. \
  49. /usr/local/X11/include \
  50. /usr/local/X11R6/include \
  51. /usr/local/X11R5/include \
  52. /usr/local/X11R4/include \
  53. \
  54. /usr/local/include/X11 \
  55. /usr/local/include/X11R6 \
  56. /usr/local/include/X11R5 \
  57. /usr/local/include/X11R4 \
  58. \
  59. /usr/X386/include \
  60. /usr/x386/include \
  61. /usr/XFree86/include/X11 \
  62. \
  63. /usr/include \
  64. /usr/local/include \
  65. /usr/unsupported/include \
  66. /usr/athena/include \
  67. /usr/local/x11r5/include \
  68. /usr/lpp/Xamples/include \
  69. \
  70. /usr/openwin/include \
  71. /usr/openwin/share/include \
  72. ; \
  73. do
  74. if test -r "$ac_dir/$x_direct_test_include"; then
  75. ac_x_includes=$ac_dir
  76. break
  77. fi
  78. done])
  79. fi # $ac_x_includes = NO
  80. if test "$ac_x_libraries" = NO; then
  81. # Check for the libraries.
  82. test -z "$x_direct_test_library" && x_direct_test_library=Xt
  83. test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
  84. # See if we find them without any special options.
  85. # Don't add to $LIBS permanently.
  86. ac_save_LIBS="$LIBS"
  87. LIBS="-l$x_direct_test_library $LIBS"
  88. AC_TRY_LINK([#include <X11/Intrinsic.h>], [${x_direct_test_function}(1)],
  89. [LIBS="$ac_save_LIBS"
  90. # We can link X programs with no special library path.
  91. ac_x_libraries=],
  92. [LIBS="$ac_save_LIBS"
  93. # First see if replacing the include by lib works.
  94. # Check X11 before X11Rn because it is often a symlink to the current release.
  95. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib${tdelibsuff}/` \
  96. /usr/X11/lib${tdelibsuff} \
  97. /usr/X11R6/lib${tdelibsuff} \
  98. /usr/X11R5/lib${tdelibsuff} \
  99. /usr/X11R4/lib${tdelibsuff} \
  100. \
  101. /usr/lib${tdelibsuff}/X11 \
  102. /usr/lib${tdelibsuff}/X11R6 \
  103. /usr/lib${tdelibsuff}/X11R5 \
  104. /usr/lib${tdelibsuff}/X11R4 \
  105. \
  106. /usr/local/X11/lib${tdelibsuff} \
  107. /usr/local/X11R6/lib${tdelibsuff} \
  108. /usr/local/X11R5/lib${tdelibsuff} \
  109. /usr/local/X11R4/lib${tdelibsuff} \
  110. \
  111. /usr/local/lib${tdelibsuff}/X11 \
  112. /usr/local/lib${tdelibsuff}/X11R6 \
  113. /usr/local/lib${tdelibsuff}/X11R5 \
  114. /usr/local/lib${tdelibsuff}/X11R4 \
  115. \
  116. /usr/X386/lib${tdelibsuff} \
  117. /usr/x386/lib${tdelibsuff} \
  118. /usr/XFree86/lib${tdelibsuff}/X11 \
  119. \
  120. /usr/lib${tdelibsuff} \
  121. /usr/local/lib${tdelibsuff} \
  122. /usr/unsupported/lib${tdelibsuff} \
  123. /usr/athena/lib${tdelibsuff} \
  124. /usr/local/x11r5/lib${tdelibsuff} \
  125. /usr/lpp/Xamples/lib${tdelibsuff} \
  126. /lib/usr/lib${tdelibsuff}/X11 \
  127. \
  128. /usr/openwin/lib${tdelibsuff} \
  129. /usr/openwin/share/lib${tdelibsuff} \
  130. ; \
  131. do
  132. dnl Don't even attempt the hair of trying to link an X program!
  133. for ac_extension in a so sl; do
  134. if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
  135. ac_x_libraries=$ac_dir
  136. break 2
  137. fi
  138. done
  139. done])
  140. fi # $ac_x_libraries = NO
  141. ])
  142. dnl ------------------------------------------------------------------------
  143. dnl Find a file (or one of more files in a list of dirs)
  144. dnl ------------------------------------------------------------------------
  145. dnl
  146. AC_DEFUN([AC_FIND_FILE],
  147. [
  148. $3=NO
  149. for i in $2;
  150. do
  151. for j in $1;
  152. do
  153. echo "configure: __oline__: $i/$j" >&AC_FD_CC
  154. if test -r "$i/$j"; then
  155. echo "taking that" >&AC_FD_CC
  156. $3=$i
  157. break 2
  158. fi
  159. done
  160. done
  161. ])
  162. dnl KDE_FIND_PATH(program-name, variable-name, list-of-dirs,
  163. dnl if-not-found, test-parameter, prepend-path)
  164. dnl
  165. dnl Look for program-name in list-of-dirs+$PATH.
  166. dnl If prepend-path is set, look in $PATH+list-of-dirs instead.
  167. dnl If found, $variable-name is set. If not, if-not-found is evaluated.
  168. dnl test-parameter: if set, the program is executed with this arg,
  169. dnl and only a successful exit code is required.
  170. AC_DEFUN([KDE_FIND_PATH],
  171. [
  172. AC_MSG_CHECKING([for $1])
  173. if test -n "$$2"; then
  174. kde_cv_path="$$2";
  175. else
  176. kde_cache=`echo $1 | sed 'y%./+-%__p_%'`
  177. AC_CACHE_VAL(kde_cv_path_$kde_cache,
  178. [
  179. kde_cv_path="NONE"
  180. kde_save_IFS=$IFS
  181. IFS=':'
  182. dirs=""
  183. for dir in $PATH; do
  184. dirs="$dirs $dir"
  185. done
  186. if test -z "$6"; then dnl Append dirs in PATH (default)
  187. dirs="$3 $dirs"
  188. else dnl Prepend dirs in PATH (if 6th arg is set)
  189. dirs="$dirs $3"
  190. fi
  191. IFS=$kde_save_IFS
  192. for dir in $dirs; do
  193. if test -x "$dir/$1"; then
  194. if test -n "$5"
  195. then
  196. evalstr="$dir/$1 $5 2>&1 "
  197. if eval $evalstr; then
  198. kde_cv_path="$dir/$1"
  199. break
  200. fi
  201. else
  202. kde_cv_path="$dir/$1"
  203. break
  204. fi
  205. fi
  206. done
  207. eval "kde_cv_path_$kde_cache=$kde_cv_path"
  208. ])
  209. eval "kde_cv_path=\"`echo '$kde_cv_path_'$kde_cache`\""
  210. fi
  211. if test -z "$kde_cv_path" || test "$kde_cv_path" = NONE; then
  212. AC_MSG_RESULT(not found)
  213. $4
  214. else
  215. AC_MSG_RESULT($kde_cv_path)
  216. $2=$kde_cv_path
  217. fi
  218. ])
  219. AC_DEFUN([KDE_MOC_ERROR_MESSAGE],
  220. [
  221. AC_MSG_ERROR([No Qt meta object compiler (moc) found!
  222. Please check whether you installed Qt correctly.
  223. You need to have a running moc binary.
  224. configure tried to run $ac_cv_path_moc and the test didn't
  225. succeed. If configure shouldn't have tried this one, set
  226. the environment variable MOC to the right one before running
  227. configure.
  228. ])
  229. ])
  230. AC_DEFUN([KDE_UIC_ERROR_MESSAGE],
  231. [
  232. AC_MSG_WARN([No Qt ui compiler (uic) found!
  233. Please check whether you installed Qt correctly.
  234. You need to have a running uic binary.
  235. configure tried to run $ac_cv_path_uic and the test didn't
  236. succeed. If configure shouldn't have tried this one, set
  237. the environment variable UIC to the right one before running
  238. configure.
  239. ])
  240. ])
  241. AC_DEFUN([KDE_CHECK_UIC_FLAG],
  242. [
  243. AC_MSG_CHECKING([whether uic supports -$1 ])
  244. kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
  245. AC_CACHE_VAL(kde_cv_prog_uic_$kde_cache,
  246. [
  247. cat >conftest.ui <<EOT
  248. <!DOCTYPE UI><UI version="3" stdsetdef="1"></UI>
  249. EOT
  250. ac_uic_testrun="$UIC_PATH -$1 $2 conftest.ui >/dev/null"
  251. if AC_TRY_EVAL(ac_uic_testrun); then
  252. eval "kde_cv_prog_uic_$kde_cache=yes"
  253. else
  254. eval "kde_cv_prog_uic_$kde_cache=no"
  255. fi
  256. rm -f conftest*
  257. ])
  258. if eval "test \"`echo '$kde_cv_prog_uic_'$kde_cache`\" = yes"; then
  259. AC_MSG_RESULT([yes])
  260. :
  261. $3
  262. else
  263. AC_MSG_RESULT([no])
  264. :
  265. $4
  266. fi
  267. ])
  268. dnl ------------------------------------------------------------------------
  269. dnl Find the meta object compiler and the ui compiler in the PATH,
  270. dnl in $TQTDIR/bin, and some more usual places
  271. dnl ------------------------------------------------------------------------
  272. dnl
  273. AC_DEFUN([AC_PATH_TQT_MOC_UIC],
  274. [
  275. AC_REQUIRE([KDE_CHECK_PERL])
  276. qt_bindirs=""
  277. for dir in $kde_qt_dirs; do
  278. qt_bindirs="$qt_bindirs $dir/bin $dir/src/moc"
  279. done
  280. qt_bindirs="$qt_bindirs /usr/bin /usr/X11R6/bin /usr/local/qt/bin"
  281. if test ! "$ac_qt_bindir" = "NO"; then
  282. qt_bindirs="$ac_qt_bindir $qt_bindirs"
  283. fi
  284. KDE_FIND_PATH(moc, MOC, [$qt_bindirs], [KDE_MOC_ERROR_MESSAGE])
  285. if test -z "$UIC_NOT_NEEDED"; then
  286. KDE_FIND_PATH(uic, UIC_PATH, [$qt_bindirs], [UIC_PATH=""])
  287. if test -z "$UIC_PATH" ; then
  288. KDE_UIC_ERROR_MESSAGE
  289. exit 1
  290. else
  291. UIC=$UIC_PATH
  292. if test $kde_qtver = 3; then
  293. KDE_CHECK_UIC_FLAG(L,[/nonexistent],ac_uic_supports_libpath=yes,ac_uic_supports_libpath=no)
  294. KDE_CHECK_UIC_FLAG(nounload,,ac_uic_supports_nounload=yes,ac_uic_supports_nounload=no)
  295. if test x$ac_uic_supports_libpath = xyes; then
  296. UIC="$UIC -L \$(kde_widgetdir)"
  297. fi
  298. if test x$ac_uic_supports_nounload = xyes; then
  299. UIC="$UIC -nounload"
  300. fi
  301. fi
  302. fi
  303. else
  304. UIC="echo uic not available: "
  305. fi
  306. AC_SUBST(MOC)
  307. AC_SUBST(UIC)
  308. UIC_TR="i18n"
  309. if test $kde_qtver = 3; then
  310. UIC_TR="tr2i18n"
  311. fi
  312. AC_SUBST(UIC_TR)
  313. ])
  314. AC_DEFUN([KDE_1_CHECK_PATHS],
  315. [
  316. KDE_1_CHECK_PATH_HEADERS
  317. KDE_TEST_RPATH=
  318. if test -n "$USE_RPATH"; then
  319. if test -n "$kde_libraries"; then
  320. KDE_TEST_RPATH="-R $kde_libraries"
  321. fi
  322. if test -n "$qt_libraries"; then
  323. KDE_TEST_RPATH="$KDE_TEST_RPATH -R $qt_libraries"
  324. fi
  325. if test -n "$x_libraries"; then
  326. KDE_TEST_RPATH="$KDE_TEST_RPATH -R $x_libraries"
  327. fi
  328. KDE_TEST_RPATH="$KDE_TEST_RPATH $KDE_EXTRA_RPATH"
  329. fi
  330. AC_MSG_CHECKING([for KDE libraries installed])
  331. ac_link='$LIBTOOL_SHELL --silent --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -ltdecore $LIBTQT $KDE_TEST_RPATH 1>&5'
  332. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  333. AC_MSG_RESULT(yes)
  334. else
  335. AC_MSG_ERROR([your system fails at linking a small KDE application!
  336. Check, if your compiler is installed correctly and if you have used the
  337. same compiler to compile Qt and tdelibs as you did use now.
  338. For more details about this problem, look at the end of config.log.])
  339. fi
  340. if eval `TDEDIR= ./conftest 2>&5`; then
  341. kde_result=done
  342. else
  343. kde_result=problems
  344. fi
  345. TDEDIR= ./conftest 2> /dev/null >&5 # make an echo for config.log
  346. kde_have_all_paths=yes
  347. KDE_SET_PATHS($kde_result)
  348. ])
  349. AC_DEFUN([KDE_SET_PATHS],
  350. [
  351. kde_cv_all_paths="kde_have_all_paths=\"yes\" \
  352. kde_htmldir=\"$kde_htmldir\" \
  353. kde_appsdir=\"$kde_appsdir\" \
  354. kde_icondir=\"$kde_icondir\" \
  355. kde_sounddir=\"$kde_sounddir\" \
  356. kde_datadir=\"$kde_datadir\" \
  357. kde_locale=\"$kde_locale\" \
  358. kde_cgidir=\"$kde_cgidir\" \
  359. kde_confdir=\"$kde_confdir\" \
  360. kde_kcfgdir=\"$kde_kcfgdir\" \
  361. kde_mimedir=\"$kde_mimedir\" \
  362. kde_toolbardir=\"$kde_toolbardir\" \
  363. kde_wallpaperdir=\"$kde_wallpaperdir\" \
  364. kde_templatesdir=\"$kde_templatesdir\" \
  365. kde_bindir=\"$kde_bindir\" \
  366. kde_servicesdir=\"$kde_servicesdir\" \
  367. kde_servicetypesdir=\"$kde_servicetypesdir\" \
  368. kde_moduledir=\"$kde_moduledir\" \
  369. kde_styledir=\"$kde_styledir\" \
  370. kde_widgetdir=\"$kde_widgetdir\" \
  371. xdg_appsdir=\"$xdg_appsdir\" \
  372. xdg_menudir=\"$xdg_menudir\" \
  373. xdg_directorydir=\"$xdg_directorydir\" \
  374. kde_result=$1"
  375. ])
  376. AC_DEFUN([KDE_SET_DEFAULT_PATHS],
  377. [
  378. if test "$1" = "default"; then
  379. if test -z "$kde_htmldir"; then
  380. kde_htmldir='\${datadir}/doc/HTML'
  381. fi
  382. if test -z "$kde_appsdir"; then
  383. kde_appsdir='\${datadir}/applnk'
  384. fi
  385. if test -z "$kde_icondir"; then
  386. kde_icondir='\${datadir}/icons'
  387. fi
  388. if test -z "$kde_sounddir"; then
  389. kde_sounddir='\${datadir}/sounds'
  390. fi
  391. if test -z "$kde_datadir"; then
  392. kde_datadir='\${datadir}/apps'
  393. fi
  394. if test -z "$kde_locale"; then
  395. kde_locale='\${datadir}/locale'
  396. fi
  397. if test -z "$kde_cgidir"; then
  398. kde_cgidir='\${exec_prefix}/cgi-bin'
  399. fi
  400. if test -z "$kde_confdir"; then
  401. kde_confdir='\${datadir}/config'
  402. fi
  403. if test -z "$kde_kcfgdir"; then
  404. kde_kcfgdir='\${datadir}/config.kcfg'
  405. fi
  406. if test -z "$kde_mimedir"; then
  407. kde_mimedir='\${datadir}/mimelnk'
  408. fi
  409. if test -z "$kde_toolbardir"; then
  410. kde_toolbardir='\${datadir}/toolbar'
  411. fi
  412. if test -z "$kde_wallpaperdir"; then
  413. kde_wallpaperdir='\${datadir}/wallpapers'
  414. fi
  415. if test -z "$kde_templatesdir"; then
  416. kde_templatesdir='\${datadir}/templates'
  417. fi
  418. if test -z "$kde_bindir"; then
  419. kde_bindir='\${exec_prefix}/bin'
  420. fi
  421. if test -z "$kde_servicesdir"; then
  422. kde_servicesdir='\${datadir}/services'
  423. fi
  424. if test -z "$kde_servicetypesdir"; then
  425. kde_servicetypesdir='\${datadir}/servicetypes'
  426. fi
  427. if test -z "$kde_moduledir"; then
  428. if test "$kde_qtver" = "2"; then
  429. kde_moduledir='\${libdir}/kde2'
  430. else
  431. kde_moduledir='\${libdir}/kde3'
  432. fi
  433. fi
  434. if test -z "$kde_styledir"; then
  435. kde_styledir='\${libdir}/kde3/plugins/styles'
  436. fi
  437. if test -z "$kde_widgetdir"; then
  438. kde_widgetdir='\${libdir}/kde3/plugins/designer'
  439. fi
  440. if test -z "$xdg_appsdir"; then
  441. xdg_appsdir='\${datadir}/applications/kde'
  442. fi
  443. if test -z "$xdg_menudir"; then
  444. xdg_menudir='\${sysconfdir}/xdg/menus'
  445. fi
  446. if test -z "$xdg_directorydir"; then
  447. xdg_directorydir='\${datadir}/desktop-directories'
  448. fi
  449. KDE_SET_PATHS(defaults)
  450. else
  451. if test $kde_qtver = 1; then
  452. AC_MSG_RESULT([compiling])
  453. KDE_1_CHECK_PATHS
  454. else
  455. AC_MSG_ERROR([path checking not yet supported for KDE 2])
  456. fi
  457. fi
  458. ])
  459. AC_DEFUN([KDE_CHECK_PATHS_FOR_COMPLETENESS],
  460. [ if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
  461. test -z "$kde_icondir" || test -z "$kde_sounddir" ||
  462. test -z "$kde_datadir" || test -z "$kde_locale" ||
  463. test -z "$kde_cgidir" || test -z "$kde_confdir" ||
  464. test -z "$kde_kcfgdir" ||
  465. test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
  466. test -z "$kde_wallpaperdir" || test -z "$kde_templatesdir" ||
  467. test -z "$kde_bindir" || test -z "$kde_servicesdir" ||
  468. test -z "$kde_servicetypesdir" || test -z "$kde_moduledir" ||
  469. test -z "$kde_styledir" || test -z "kde_widgetdir" ||
  470. test -z "$xdg_appsdir" || test -z "$xdg_menudir" || test -z "$xdg_directorydir" ||
  471. test "x$kde_have_all_paths" != "xyes"; then
  472. kde_have_all_paths=no
  473. fi
  474. ])
  475. AC_DEFUN([KDE_MISSING_PROG_ERROR],
  476. [
  477. AC_MSG_ERROR([The important program $1 was not found!
  478. Please check whether you installed KDE correctly.
  479. ])
  480. ])
  481. AC_DEFUN([KDE_MISSING_ARTS_ERROR],
  482. [
  483. AC_MSG_ERROR([The important program $1 was not found!
  484. Please check whether you installed aRts correctly or use
  485. --without-arts to compile without aRts support (this will remove functionality).
  486. ])
  487. ])
  488. AC_DEFUN([KDE_SET_DEFAULT_BINDIRS],
  489. [
  490. kde_default_bindirs="/usr/bin /usr/local/bin /opt/local/bin /usr/X11R6/bin /opt/kde/bin /opt/kde3/bin /usr/kde/bin /usr/local/kde/bin"
  491. test -n "$TDEDIR" && kde_default_bindirs="$TDEDIR/bin $kde_default_bindirs"
  492. if test -n "$TDEDIRS"; then
  493. kde_save_IFS=$IFS
  494. IFS=:
  495. for dir in $TDEDIRS; do
  496. kde_default_bindirs="$dir/bin $kde_default_bindirs "
  497. done
  498. IFS=$kde_save_IFS
  499. fi
  500. ])
  501. AC_DEFUN([KDE_SUBST_PROGRAMS],
  502. [
  503. AC_ARG_WITH(arts,
  504. AC_HELP_STRING([--without-arts],[build without aRts [default=no]]),
  505. [build_arts=$withval],
  506. [build_arts=yes]
  507. )
  508. AM_CONDITIONAL(include_ARTS, test "$build_arts" '!=' "no")
  509. if test "$build_arts" = "no"; then
  510. AC_DEFINE(WITHOUT_ARTS, 1, [Defined if compiling without arts])
  511. fi
  512. KDE_SET_DEFAULT_BINDIRS
  513. kde_default_bindirs="$exec_prefix/bin $prefix/bin $kde_libs_prefix/bin $kde_default_bindirs"
  514. KDE_FIND_PATH(dcopidl, DCOPIDL, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl)])
  515. KDE_FIND_PATH(dcopidl2cpp, DCOPIDL2CPP, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidl2cpp)])
  516. if test "$build_arts" '!=' "no"; then
  517. KDE_FIND_PATH(mcopidl, MCOPIDL, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(mcopidl)])
  518. KDE_FIND_PATH(artsc-config, ARTSCCONFIG, [$kde_default_bindirs], [KDE_MISSING_ARTS_ERROR(artsc-config)])
  519. fi
  520. KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs])
  521. kde32ornewer=1
  522. kde33ornewer=1
  523. if test -n "$kde_qtver" && test "$kde_qtver" -lt 3; then
  524. kde32ornewer=
  525. kde33ornewer=
  526. else
  527. if test "$kde_qtver" = "3"; then
  528. if test "$kde_qtsubver" -le 1; then
  529. kde32ornewer=
  530. fi
  531. if test "$kde_qtsubver" -le 2; then
  532. kde33ornewer=
  533. fi
  534. if test "$KDECONFIG" != "compiled"; then
  535. if test `$KDECONFIG --version | grep KDE | sed 's/KDE: \(...\).*/\1/'` = 3.2; then
  536. kde33ornewer=
  537. fi
  538. fi
  539. fi
  540. fi
  541. if test -n "$kde32ornewer"; then
  542. KDE_FIND_PATH(tdeconfig_compiler, KCONFIG_COMPILER, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(tdeconfig_compiler)])
  543. KDE_FIND_PATH(dcopidlng, DCOPIDLNG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(dcopidlng)])
  544. fi
  545. if test -n "$kde33ornewer"; then
  546. KDE_FIND_PATH(maketdewidgets, MAKETDEWIDGETS, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(maketdewidgets)])
  547. AC_SUBST(MAKETDEWIDGETS)
  548. fi
  549. KDE_FIND_PATH(xmllint, XMLLINT, [${prefix}/bin ${exec_prefix}/bin], [XMLLINT=""])
  550. if test -n "$MEINPROC" -a "$MEINPROC" != "compiled"; then
  551. kde_sharedirs="$prefix/share /opt/trinity/share /opt/trinity/share /opt/kde/share /usr/share/kde /usr/local/share /usr/share"
  552. test -n "$TDEDIR" && kde_sharedirs="$TDEDIR/share $kde_sharedirs"
  553. AC_FIND_FILE(apps/ksgmltools2/customization/tde-chunk.xsl, $kde_sharedirs, KDE_XSL_STYLESHEET)
  554. if test "$KDE_XSL_STYLESHEET" = "NO"; then
  555. KDE_XSL_STYLESHEET=""
  556. else
  557. KDE_XSL_STYLESHEET="$KDE_XSL_STYLESHEET/apps/ksgmltools2/customization/tde-chunk.xsl"
  558. fi
  559. fi
  560. DCOP_DEPENDENCIES='$(DCOPIDL)'
  561. if test -n "$kde32ornewer"; then
  562. KCFG_DEPENDENCIES='$(KCONFIG_COMPILER)'
  563. DCOP_DEPENDENCIES='$(DCOPIDL) $(DCOPIDLNG)'
  564. AC_SUBST(KCONFIG_COMPILER)
  565. AC_SUBST(KCFG_DEPENDENCIES)
  566. AC_SUBST(DCOPIDLNG)
  567. fi
  568. AC_SUBST(DCOPIDL)
  569. AC_SUBST(DCOPIDL2CPP)
  570. AC_SUBST(DCOP_DEPENDENCIES)
  571. AC_SUBST(MCOPIDL)
  572. AC_SUBST(ARTSCCONFIG)
  573. AC_SUBST(MEINPROC)
  574. AC_SUBST(KDE_XSL_STYLESHEET)
  575. AC_SUBST(XMLLINT)
  576. ])dnl
  577. AC_DEFUN([AC_CREATE_KFSSTND],
  578. [
  579. AC_REQUIRE([AC_CHECK_RPATH])
  580. AC_MSG_CHECKING([for KDE paths])
  581. kde_result=""
  582. kde_cached_paths=yes
  583. AC_CACHE_VAL(kde_cv_all_paths,
  584. [
  585. KDE_SET_DEFAULT_PATHS($1)
  586. kde_cached_paths=no
  587. ])
  588. eval "$kde_cv_all_paths"
  589. KDE_CHECK_PATHS_FOR_COMPLETENESS
  590. if test "$kde_have_all_paths" = "no" && test "$kde_cached_paths" = "yes"; then
  591. # wrong values were cached, may be, we can set better ones
  592. kde_result=
  593. kde_htmldir= kde_appsdir= kde_icondir= kde_sounddir=
  594. kde_datadir= kde_locale= kde_cgidir= kde_confdir= kde_kcfgdir=
  595. kde_mimedir= kde_toolbardir= kde_wallpaperdir= kde_templatesdir=
  596. kde_bindir= kde_servicesdir= kde_servicetypesdir= kde_moduledir=
  597. kde_have_all_paths=
  598. kde_styledir=
  599. kde_widgetdir=
  600. xdg_appsdir = xdg_menudir= xdg_directorydir=
  601. KDE_SET_DEFAULT_PATHS($1)
  602. eval "$kde_cv_all_paths"
  603. KDE_CHECK_PATHS_FOR_COMPLETENESS
  604. kde_result="$kde_result (cache overridden)"
  605. fi
  606. if test "$kde_have_all_paths" = "no"; then
  607. AC_MSG_ERROR([configure could not run a little KDE program to test the environment.
  608. Since it had compiled and linked before, it must be a strange problem on your system.
  609. Look at config.log for details. If you are not able to fix this, look at
  610. http://www.kde.org/faq/installation.html or any www.kde.org mirror.
  611. (If you're using an egcs version on Linux, you may update binutils!)
  612. ])
  613. else
  614. rm -f conftest*
  615. AC_MSG_RESULT($kde_result)
  616. fi
  617. bindir=$kde_bindir
  618. KDE_SUBST_PROGRAMS
  619. ])
  620. AC_DEFUN([AC_SUBST_KFSSTND],
  621. [
  622. AC_SUBST(kde_htmldir)
  623. AC_SUBST(kde_appsdir)
  624. AC_SUBST(kde_icondir)
  625. AC_SUBST(kde_sounddir)
  626. AC_SUBST(kde_datadir)
  627. AC_SUBST(kde_locale)
  628. AC_SUBST(kde_confdir)
  629. AC_SUBST(kde_kcfgdir)
  630. AC_SUBST(kde_mimedir)
  631. AC_SUBST(kde_wallpaperdir)
  632. AC_SUBST(kde_bindir)
  633. dnl X Desktop Group standards
  634. AC_SUBST(xdg_appsdir)
  635. AC_SUBST(xdg_menudir)
  636. AC_SUBST(xdg_directorydir)
  637. dnl for KDE 2
  638. AC_SUBST(kde_templatesdir)
  639. AC_SUBST(kde_servicesdir)
  640. AC_SUBST(kde_servicetypesdir)
  641. AC_SUBST(kde_moduledir)
  642. AC_SUBST(tdeinitdir, '$(kde_moduledir)')
  643. AC_SUBST(kde_styledir)
  644. AC_SUBST(kde_widgetdir)
  645. if test "$kde_qtver" = 1; then
  646. kde_minidir="$kde_icondir/mini"
  647. else
  648. # for KDE 1 - this breaks KDE2 apps using minidir, but
  649. # that's the plan ;-/
  650. kde_minidir="/dev/null"
  651. fi
  652. dnl AC_SUBST(kde_minidir)
  653. dnl AC_SUBST(kde_cgidir)
  654. dnl AC_SUBST(kde_toolbardir)
  655. ])
  656. AC_DEFUN([KDE_MISC_TESTS],
  657. [
  658. dnl Checks for libraries.
  659. AC_CHECK_LIB(util, main, [LIBUTIL="-lutil"]) dnl for *BSD
  660. AC_SUBST(LIBUTIL)
  661. AC_CHECK_LIB(compat, main, [LIBCOMPAT="-lcompat"]) dnl for *BSD
  662. AC_SUBST(LIBCOMPAT)
  663. kde_have_crypt=
  664. AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"; kde_have_crypt=yes],
  665. AC_CHECK_LIB(c, crypt, [kde_have_crypt=yes], [
  666. AC_MSG_WARN([you have no crypt in either libcrypt or libc.
  667. You should install libcrypt from another source or configure with PAM
  668. support])
  669. kde_have_crypt=no
  670. ]))
  671. AC_SUBST(LIBCRYPT)
  672. if test $kde_have_crypt = yes; then
  673. AC_DEFINE_UNQUOTED(HAVE_CRYPT, 1, [Defines if your system has the crypt function])
  674. fi
  675. AC_CHECK_SOCKLEN_T
  676. AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"])
  677. if test $ac_cv_lib_dnet_dnet_ntoa = no; then
  678. AC_CHECK_LIB(dnet_stub, dnet_ntoa,
  679. [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"])
  680. fi
  681. AC_CHECK_FUNC(inet_ntoa)
  682. if test $ac_cv_func_inet_ntoa = no; then
  683. AC_CHECK_LIB(nsl, inet_ntoa, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl")
  684. fi
  685. AC_CHECK_FUNC(connect)
  686. if test $ac_cv_func_connect = no; then
  687. AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", ,
  688. $X_EXTRA_LIBS)
  689. fi
  690. AC_CHECK_FUNC(remove)
  691. if test $ac_cv_func_remove = no; then
  692. AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix")
  693. fi
  694. # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
  695. AC_CHECK_FUNC(shmat, ,
  696. AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"))
  697. # more headers that need to be explicitly included on darwin
  698. AC_CHECK_HEADERS(sys/types.h stdint.h)
  699. # sys/bitypes.h is needed for uint32_t and friends on Tru64
  700. AC_CHECK_HEADERS(sys/bitypes.h)
  701. # darwin requires a poll emulation library
  702. AC_CHECK_LIB(poll, poll, LIB_POLL="-lpoll")
  703. # for some image handling on Mac OS X
  704. AC_CHECK_HEADERS(Carbon/Carbon.h)
  705. # CoreAudio framework
  706. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [
  707. AC_DEFINE(HAVE_COREAUDIO, 1, [Define if you have the CoreAudio API])
  708. FRAMEWORK_COREAUDIO="-Wl,-framework,CoreAudio"
  709. ])
  710. AC_CHECK_RES_INIT
  711. AC_SUBST(LIB_POLL)
  712. AC_SUBST(FRAMEWORK_COREAUDIO)
  713. LIBSOCKET="$X_EXTRA_LIBS"
  714. AC_SUBST(LIBSOCKET)
  715. AC_SUBST(X_EXTRA_LIBS)
  716. AC_CHECK_LIB(ucb, killpg, [LIBUCB="-lucb"]) dnl for Solaris2.4
  717. AC_SUBST(LIBUCB)
  718. case $host in dnl this *is* LynxOS specific
  719. *-*-lynxos* )
  720. AC_MSG_CHECKING([LynxOS header file wrappers])
  721. [CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"]
  722. AC_MSG_RESULT(disabled)
  723. AC_CHECK_LIB(bsd, gethostbyname, [LIBSOCKET="-lbsd"]) dnl for LynxOS
  724. ;;
  725. esac
  726. KDE_CHECK_TYPES
  727. KDE_CHECK_LIBDL
  728. KDE_CHECK_STRLCPY
  729. KDE_CHECK_PIE_SUPPORT
  730. # darwin needs this to initialize the environment
  731. AC_CHECK_HEADERS(crt_externs.h)
  732. AC_CHECK_FUNC(_NSGetEnviron, [AC_DEFINE(HAVE_NSGETENVIRON, 1, [Define if your system needs _NSGetEnviron to set up the environment])])
  733. AH_VERBATIM(_DARWIN_ENVIRON,
  734. [
  735. #if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
  736. # include <sys/time.h>
  737. # include <crt_externs.h>
  738. # define environ (*_NSGetEnviron())
  739. #endif
  740. ])
  741. AH_VERBATIM(_AIX_STRINGS_H_BZERO,
  742. [
  743. /*
  744. * AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
  745. * that defines bzero.
  746. */
  747. #if defined(_AIX)
  748. #include <strings.h>
  749. #endif
  750. ])
  751. AC_CHECK_FUNCS([vsnprintf snprintf])
  752. AH_VERBATIM(_TRU64,[
  753. /*
  754. * On HP-UX, the declaration of vsnprintf() is needed every time !
  755. */
  756. #if !defined(HAVE_VSNPRINTF) || defined(hpux)
  757. #if __STDC__
  758. #include <stdarg.h>
  759. #include <stdlib.h>
  760. #else
  761. #include <varargs.h>
  762. #endif
  763. #ifdef __cplusplus
  764. extern "C"
  765. #endif
  766. int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
  767. #ifdef __cplusplus
  768. extern "C"
  769. #endif
  770. int snprintf(char *str, size_t n, char const *fmt, ...);
  771. #endif
  772. ])
  773. ])
  774. dnl ------------------------------------------------------------------------
  775. dnl Find the header files and libraries for X-Windows. Extended the
  776. dnl macro AC_PATH_X
  777. dnl ------------------------------------------------------------------------
  778. dnl
  779. AC_DEFUN([K_PATH_X],
  780. [
  781. AC_REQUIRE([KDE_MISC_TESTS])dnl
  782. AC_REQUIRE([KDE_CHECK_LIB64])
  783. AC_ARG_ENABLE(
  784. embedded,
  785. AC_HELP_STRING([--enable-embedded],[link to Qt-embedded, don't use X]),
  786. kde_use_qt_emb=$enableval,
  787. kde_use_qt_emb=no
  788. )
  789. AC_ARG_ENABLE(
  790. qtopia,
  791. AC_HELP_STRING([--enable-qtopia],[link to Qt-embedded, link to the Qtopia Environment]),
  792. kde_use_qt_emb_palm=$enableval,
  793. kde_use_qt_emb_palm=no
  794. )
  795. AC_ARG_ENABLE(
  796. mac,
  797. AC_HELP_STRING([--enable-mac],[link to Qt/Mac (don't use X)]),
  798. kde_use_qt_mac=$enableval,
  799. kde_use_qt_mac=no
  800. )
  801. # used to disable x11-specific stuff on special platforms
  802. AM_CONDITIONAL(include_x11, test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no")
  803. if test "$kde_use_qt_emb" = "no" && test "$kde_use_qt_mac" = "no"; then
  804. AC_MSG_CHECKING(for X)
  805. AC_CACHE_VAL(kde_cv_have_x,
  806. [# One or both of the vars are not set, and there is no cached value.
  807. if test "{$x_includes+set}" = set || test "$x_includes" = NONE; then
  808. kde_x_includes=NO
  809. else
  810. kde_x_includes=$x_includes
  811. fi
  812. if test "{$x_libraries+set}" = set || test "$x_libraries" = NONE; then
  813. kde_x_libraries=NO
  814. else
  815. kde_x_libraries=$x_libraries
  816. fi
  817. # below we use the standard autoconf calls
  818. ac_x_libraries=$kde_x_libraries
  819. ac_x_includes=$kde_x_includes
  820. KDE_PATH_X_DIRECT
  821. dnl AC_PATH_X_XMKMF picks /usr/lib as the path for the X libraries.
  822. dnl Unfortunately, if compiling with the N32 ABI, this is not the correct
  823. dnl location. The correct location is /usr/lib32 or an undefined value
  824. dnl (the linker is smart enough to pick the correct default library).
  825. dnl Things work just fine if you use just AC_PATH_X_DIRECT.
  826. dnl Solaris has a similar problem. AC_PATH_X_XMKMF forces x_includes to
  827. dnl /usr/openwin/include, which doesn't work. /usr/include does work, so
  828. dnl x_includes should be left alone.
  829. case "$host" in
  830. mips-sgi-irix6*)
  831. ;;
  832. *-*-solaris*)
  833. ;;
  834. *)
  835. _AC_PATH_X_XMKMF
  836. if test -z "$ac_x_includes"; then
  837. ac_x_includes="."
  838. fi
  839. if test -z "$ac_x_libraries"; then
  840. ac_x_libraries="/usr/lib${tdelibsuff}"
  841. fi
  842. esac
  843. #from now on we use our own again
  844. # when the user already gave --x-includes, we ignore
  845. # what the standard autoconf macros told us.
  846. if test "$kde_x_includes" = NO; then
  847. kde_x_includes=$ac_x_includes
  848. fi
  849. # for --x-libraries too
  850. if test "$kde_x_libraries" = NO; then
  851. kde_x_libraries=$ac_x_libraries
  852. fi
  853. if test "$kde_x_includes" = NO; then
  854. AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
  855. fi
  856. if test "$kde_x_libraries" = NO; then
  857. AC_MSG_ERROR([Can't find X libraries. Please check your installation and add the correct paths!])
  858. fi
  859. # Record where we found X for the cache.
  860. kde_cv_have_x="have_x=yes \
  861. kde_x_includes=$kde_x_includes kde_x_libraries=$kde_x_libraries"
  862. ])dnl
  863. eval "$kde_cv_have_x"
  864. if test "$have_x" != yes; then
  865. AC_MSG_RESULT($have_x)
  866. no_x=yes
  867. else
  868. AC_MSG_RESULT([libraries $kde_x_libraries, headers $kde_x_includes])
  869. fi
  870. if test -z "$kde_x_includes" || test "x$kde_x_includes" = xNONE; then
  871. X_INCLUDES=""
  872. x_includes="."; dnl better than nothing :-
  873. else
  874. x_includes=$kde_x_includes
  875. X_INCLUDES="-I$x_includes"
  876. fi
  877. if test -z "$kde_x_libraries" || test "x$kde_x_libraries" = xNONE || test "$kde_x_libraries" = "/usr/lib"; then
  878. X_LDFLAGS=""
  879. x_libraries="/usr/lib"; dnl better than nothing :-
  880. else
  881. x_libraries=$kde_x_libraries
  882. X_LDFLAGS="-L$x_libraries"
  883. fi
  884. all_includes="$X_INCLUDES"
  885. all_libraries="$X_LDFLAGS $LDFLAGS_AS_NEEDED $LDFLAGS_NEW_DTAGS"
  886. # Check for libraries that X11R6 Xt/Xaw programs need.
  887. ac_save_LDFLAGS="$LDFLAGS"
  888. LDFLAGS="$LDFLAGS $X_LDFLAGS"
  889. # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
  890. # check for ICE first), but we must link in the order -lSM -lICE or
  891. # we get undefined symbols. So assume we have SM if we have ICE.
  892. # These have to be linked with before -lX11, unlike the other
  893. # libraries we check for below, so use a different variable.
  894. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
  895. AC_CHECK_LIB(ICE, IceConnectionNumber,
  896. [LIBSM="-lSM -lICE"], , $X_EXTRA_LIBS)
  897. LDFLAGS="$ac_save_LDFLAGS"
  898. LIB_X11='-lX11 $(LIBSOCKET)'
  899. AC_MSG_CHECKING(for libXext)
  900. AC_CACHE_VAL(kde_cv_have_libXext,
  901. [
  902. kde_ldflags_safe="$LDFLAGS"
  903. kde_libs_safe="$LIBS"
  904. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS"
  905. LIBS="-lXext -lX11 $LIBSOCKET"
  906. AC_TRY_LINK([
  907. #include <stdio.h>
  908. #ifdef STDC_HEADERS
  909. # include <stdlib.h>
  910. #endif
  911. ],
  912. [
  913. printf("hello Xext\n");
  914. ],
  915. kde_cv_have_libXext=yes,
  916. kde_cv_have_libXext=no
  917. )
  918. LDFLAGS=$kde_ldflags_safe
  919. LIBS=$kde_libs_safe
  920. ])
  921. AC_MSG_RESULT($kde_cv_have_libXext)
  922. if test "$kde_cv_have_libXext" = "no"; then
  923. AC_MSG_ERROR([We need a working libXext to proceed. Since configure
  924. can't find it itself, we stop here assuming that make wouldn't find
  925. them either.])
  926. fi
  927. LIB_XEXT="-lXext"
  928. QTE_NORTTI=""
  929. elif test "$kde_use_qt_emb" = "yes"; then
  930. dnl We're using QT Embedded
  931. CPPFLAGS=-DQWS
  932. CXXFLAGS="$CXXFLAGS -fno-rtti"
  933. QTE_NORTTI="-fno-rtti -DQWS"
  934. X_PRE_LIBS=""
  935. LIB_X11=""
  936. LIB_XEXT=""
  937. LIB_XRENDER=""
  938. LIBSM=""
  939. X_INCLUDES=""
  940. X_LDFLAGS=""
  941. x_includes=""
  942. x_libraries=""
  943. elif test "$kde_use_qt_mac" = "yes"; then
  944. dnl We're using QT/Mac (I use QT_MAC so that qglobal.h doesn't *have* to
  945. dnl be included to get the information) --Sam
  946. CXXFLAGS="$CXXFLAGS -DQT_MAC -no-cpp-precomp"
  947. CFLAGS="$CFLAGS -DQT_MAC -no-cpp-precomp"
  948. X_PRE_LIBS=""
  949. LIB_X11=""
  950. LIB_XEXT=""
  951. LIB_XRENDER=""
  952. LIBSM=""
  953. X_INCLUDES=""
  954. X_LDFLAGS=""
  955. x_includes=""
  956. x_libraries=""
  957. fi
  958. AC_SUBST(X_PRE_LIBS)
  959. AC_SUBST(LIB_X11)
  960. AC_SUBST(LIB_XRENDER)
  961. AC_SUBST(LIBSM)
  962. AC_SUBST(X_INCLUDES)
  963. AC_SUBST(X_LDFLAGS)
  964. AC_SUBST(x_includes)
  965. AC_SUBST(x_libraries)
  966. AC_SUBST(QTE_NORTTI)
  967. AC_SUBST(LIB_XEXT)
  968. ])
  969. AC_DEFUN([KDE_PRINT_QT_PROGRAM],
  970. [
  971. AC_REQUIRE([KDE_USE_TQT])
  972. cat > conftest.$ac_ext <<EOF
  973. #include "confdefs.h"
  974. #include <qglobal.h>
  975. #include <qapplication.h>
  976. EOF
  977. if test "$kde_qtver" = "2"; then
  978. cat >> conftest.$ac_ext <<EOF
  979. #include <qevent.h>
  980. #include <qstring.h>
  981. #include <qstyle.h>
  982. EOF
  983. if test $kde_qtsubver -gt 0; then
  984. cat >> conftest.$ac_ext <<EOF
  985. #if QT_VERSION < 210
  986. #error 1
  987. #endif
  988. EOF
  989. fi
  990. fi
  991. if test "$kde_qtver" = "3"; then
  992. cat >> conftest.$ac_ext <<EOF
  993. #include <qcursor.h>
  994. #include <qstylefactory.h>
  995. #include <private/qucomextra_p.h>
  996. EOF
  997. fi
  998. echo "#if ! ($kde_qt_verstring)" >> conftest.$ac_ext
  999. cat >> conftest.$ac_ext <<EOF
  1000. #error 1
  1001. #endif
  1002. int main() {
  1003. EOF
  1004. if test "$kde_qtver" = "2"; then
  1005. cat >> conftest.$ac_ext <<EOF
  1006. QStringList *t = new QStringList();
  1007. Q_UNUSED(t);
  1008. EOF
  1009. if test $kde_qtsubver -gt 0; then
  1010. cat >> conftest.$ac_ext <<EOF
  1011. QString s;
  1012. s.setLatin1("Elvis is alive", 14);
  1013. EOF
  1014. fi
  1015. fi
  1016. if test "$kde_qtver" = "3"; then
  1017. cat >> conftest.$ac_ext <<EOF
  1018. (void)QStyleFactory::create(QString::null);
  1019. QCursor c(Qt::WhatsThisCursor);
  1020. EOF
  1021. fi
  1022. cat >> conftest.$ac_ext <<EOF
  1023. return 0;
  1024. }
  1025. EOF
  1026. ])
  1027. AC_DEFUN([KDE_USE_TQT],
  1028. [
  1029. if test -z "$1"; then
  1030. # Current default Qt version: 3.3
  1031. kde_qtver=3
  1032. kde_qtsubver=3
  1033. else
  1034. kde_qtsubver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
  1035. # following is the check if subversion isnt found in passed argument
  1036. if test "$kde_qtsubver" = "$1"; then
  1037. kde_qtsubver=1
  1038. fi
  1039. kde_qtver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
  1040. if test "$kde_qtver" = "1"; then
  1041. kde_qtsubver=42
  1042. fi
  1043. fi
  1044. if test -z "$2"; then
  1045. if test "$kde_qtver" = "2"; then
  1046. if test $kde_qtsubver -gt 0; then
  1047. kde_qt_minversion=">= Qt 2.2.2"
  1048. else
  1049. kde_qt_minversion=">= Qt 2.0.2"
  1050. fi
  1051. fi
  1052. if test "$kde_qtver" = "3"; then
  1053. if test $kde_qtsubver -gt 0; then
  1054. if test $kde_qtsubver -gt 1; then
  1055. if test $kde_qtsubver -gt 2; then
  1056. kde_qt_minversion=">= Qt 3.3 and < 4.0"
  1057. else
  1058. kde_qt_minversion=">= Qt 3.2 and < 4.0"
  1059. fi
  1060. else
  1061. kde_qt_minversion=">= Qt 3.1 (20021021) and < 4.0"
  1062. fi
  1063. else
  1064. kde_qt_minversion=">= Qt 3.0 and < 4.0"
  1065. fi
  1066. fi
  1067. if test "$kde_qtver" = "1"; then
  1068. kde_qt_minversion=">= 1.42 and < 2.0"
  1069. fi
  1070. else
  1071. kde_qt_minversion="$2"
  1072. fi
  1073. if test -z "$3"; then
  1074. if test $kde_qtver = 3; then
  1075. if test $kde_qtsubver -gt 0; then
  1076. kde_qt_verstring="QT_VERSION >= 0x03@VER@00 && QT_VERSION < 0x040000"
  1077. qtsubver=`echo "00$kde_qtsubver" | sed -e 's,.*\(..\)$,\1,'`
  1078. kde_qt_verstring=`echo $kde_qt_verstring | sed -e "s,@VER@,$qtsubver,"`
  1079. else
  1080. kde_qt_verstring="QT_VERSION >= 300 && QT_VERSION < 0x040000"
  1081. fi
  1082. fi
  1083. if test $kde_qtver = 2; then
  1084. if test $kde_qtsubver -gt 0; then
  1085. kde_qt_verstring="QT_VERSION >= 222"
  1086. else
  1087. kde_qt_verstring="QT_VERSION >= 200"
  1088. fi
  1089. fi
  1090. if test $kde_qtver = 1; then
  1091. kde_qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
  1092. fi
  1093. else
  1094. kde_qt_verstring="$3"
  1095. fi
  1096. if test $kde_qtver = 4; then
  1097. kde_qt_dirs="$TQTDIR /usr/lib/qt4 /usr/lib/qt /usr/share/qt4"
  1098. fi
  1099. if test $kde_qtver = 3; then
  1100. kde_qt_dirs="$TQTDIR /usr/lib/qt3 /usr/lib/qt /usr/share/qt3"
  1101. fi
  1102. if test $kde_qtver = 2; then
  1103. kde_qt_dirs="$TQTDIR /usr/lib/qt2 /usr/lib/qt"
  1104. fi
  1105. if test $kde_qtver = 1; then
  1106. kde_qt_dirs="$TQTDIR /usr/lib/qt"
  1107. fi
  1108. ])
  1109. AC_DEFUN([KDE_CHECK_QT_DIRECT],
  1110. [
  1111. AC_REQUIRE([KDE_USE_TQT])
  1112. AC_MSG_CHECKING([if Qt compiles without flags])
  1113. AC_CACHE_VAL(kde_cv_qt_direct,
  1114. [
  1115. AC_LANG_SAVE
  1116. AC_LANG_CPLUSPLUS
  1117. ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
  1118. ac_LIBRARY_PATH="$LIBRARY_PATH"
  1119. ac_cxxflags_safe="$CXXFLAGS"
  1120. ac_ldflags_safe="$LDFLAGS"
  1121. ac_libs_safe="$LIBS"
  1122. CXXFLAGS="$CXXFLAGS -I$tqt_includes"
  1123. LDFLAGS="$LDFLAGS $X_LDFLAGS"
  1124. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1125. LIBS="$LIBTQT -lXext -lX11 $LIBSOCKET"
  1126. else
  1127. LIBS="$LIBTQT $LIBSOCKET"
  1128. fi
  1129. LD_LIBRARY_PATH=
  1130. export LD_LIBRARY_PATH
  1131. LIBRARY_PATH=
  1132. export LIBRARY_PATH
  1133. KDE_PRINT_QT_PROGRAM
  1134. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  1135. kde_cv_qt_direct="yes"
  1136. else
  1137. kde_cv_qt_direct="no"
  1138. echo "configure: failed program was:" >&AC_FD_CC
  1139. cat conftest.$ac_ext >&AC_FD_CC
  1140. fi
  1141. rm -f conftest*
  1142. CXXFLAGS="$ac_cxxflags_safe"
  1143. LDFLAGS="$ac_ldflags_safe"
  1144. LIBS="$ac_libs_safe"
  1145. LD_LIBRARY_PATH="$ac_LD_LIBRARY_PATH_safe"
  1146. export LD_LIBRARY_PATH
  1147. LIBRARY_PATH="$ac_LIBRARY_PATH"
  1148. export LIBRARY_PATH
  1149. AC_LANG_RESTORE
  1150. ])
  1151. if test "$kde_cv_qt_direct" = "yes"; then
  1152. AC_MSG_RESULT(yes)
  1153. $1
  1154. else
  1155. AC_MSG_RESULT(no)
  1156. $2
  1157. fi
  1158. ])
  1159. dnl ------------------------------------------------------------------------
  1160. dnl Try to find the Qt headers and libraries.
  1161. dnl $(QT_LDFLAGS) will be -Ltqtliblocation (if needed)
  1162. dnl and $(TQT_INCLUDES) will be -Iqthdrlocation (if needed)
  1163. dnl ------------------------------------------------------------------------
  1164. dnl
  1165. AC_DEFUN([AC_PATH_TQT_1_3],
  1166. [
  1167. AC_REQUIRE([K_PATH_X])
  1168. AC_REQUIRE([KDE_USE_TQT])
  1169. AC_REQUIRE([KDE_CHECK_LIB64])
  1170. dnl ------------------------------------------------------------------------
  1171. dnl Add configure flag to enable linking to MT version of Qt library.
  1172. dnl ------------------------------------------------------------------------
  1173. AC_ARG_ENABLE(
  1174. mt,
  1175. AC_HELP_STRING([--disable-mt],[link to non-threaded Qt (deprecated)]),
  1176. kde_use_qt_mt=$enableval,
  1177. [
  1178. if test $kde_qtver = 3; then
  1179. kde_use_qt_mt=yes
  1180. else
  1181. kde_use_qt_mt=no
  1182. fi
  1183. ]
  1184. )
  1185. USING_QT_MT=""
  1186. dnl ------------------------------------------------------------------------
  1187. dnl If we not get --disable-qt-mt then adjust some vars for the host.
  1188. dnl ------------------------------------------------------------------------
  1189. KDE_MT_LDFLAGS=
  1190. KDE_MT_LIBS=
  1191. if test "x$kde_use_qt_mt" = "xyes"; then
  1192. KDE_CHECK_THREADING
  1193. if test "x$kde_use_threading" = "xyes"; then
  1194. CPPFLAGS="$USE_THREADS -DTQT_THREAD_SUPPORT $CPPFLAGS"
  1195. KDE_MT_LDFLAGS="$USE_THREADS"
  1196. KDE_MT_LIBS="$LIBPTHREAD"
  1197. else
  1198. kde_use_qt_mt=no
  1199. fi
  1200. fi
  1201. AC_SUBST(KDE_MT_LDFLAGS)
  1202. AC_SUBST(KDE_MT_LIBS)
  1203. kde_qt_was_given=yes
  1204. dnl ------------------------------------------------------------------------
  1205. dnl If we haven't been told how to link to Qt, we work it out for ourselves.
  1206. dnl ------------------------------------------------------------------------
  1207. if test -z "$LIBTQT_GLOB"; then
  1208. if test "x$kde_use_qt_emb" = "xyes"; then
  1209. LIBTQT_GLOB="libtqte.*"
  1210. else
  1211. LIBTQT_GLOB="libtqt.*"
  1212. fi
  1213. fi
  1214. dnl ------------------------------------------------------------
  1215. dnl If we got --enable-embedded then adjust the Qt library name.
  1216. dnl ------------------------------------------------------------
  1217. if test "x$kde_use_qt_emb" = "xyes"; then
  1218. tqtlib="qte"
  1219. else
  1220. tqtlib="qt"
  1221. fi
  1222. kde_int_qt="-l$tqtlib"
  1223. if test -z "$LIBQPE"; then
  1224. dnl ------------------------------------------------------------
  1225. dnl If we got --enable-palmtop then add -lqpe to the link line
  1226. dnl ------------------------------------------------------------
  1227. if test "x$kde_use_qt_emb" = "xyes"; then
  1228. if test "x$kde_use_qt_emb_palm" = "xyes"; then
  1229. LIB_QPE="-lqpe"
  1230. else
  1231. LIB_QPE=""
  1232. fi
  1233. else
  1234. LIB_QPE=""
  1235. fi
  1236. fi
  1237. dnl ------------------------------------------------------------------------
  1238. dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
  1239. dnl ------------------------------------------------------------------------
  1240. if test "x$kde_use_qt_mt" = "xyes"; then
  1241. LIBTQT="-l$tqtlib-mt"
  1242. kde_int_qt="-l$tqtlib-mt"
  1243. LIBTQT_GLOB="lib$tqtlib-mt.*"
  1244. USING_QT_MT="using -mt"
  1245. else
  1246. LIBTQT="-l$tqtlib"
  1247. fi
  1248. if test $kde_qtver != 1; then
  1249. AC_REQUIRE([AC_FIND_PNG])
  1250. AC_REQUIRE([AC_FIND_JPEG])
  1251. LIBTQT="$LIBTQT $LIBPNG $LIBJPEG"
  1252. fi
  1253. if test $kde_qtver = 3; then
  1254. AC_REQUIRE([KDE_CHECK_LIBDL])
  1255. LIBTQT="$LIBTQT $LIBDL"
  1256. fi
  1257. AC_MSG_CHECKING([for Qt])
  1258. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1259. LIBTQT="$LIBTQT $X_PRE_LIBS -lXext -lX11 $LIBSM $LIBSOCKET"
  1260. fi
  1261. ac_tqt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
  1262. qt_libraries=""
  1263. tqt_includes=""
  1264. AC_ARG_WITH(qt-dir,
  1265. AC_HELP_STRING([--with-qt-dir=DIR],[where the root of Qt is installed ]),
  1266. [ ac_tqt_includes="$withval"/include
  1267. ac_qt_libraries="$withval"/lib${tdelibsuff}
  1268. ac_qt_bindir="$withval"/bin
  1269. ])
  1270. AC_ARG_WITH(qt-includes,
  1271. AC_HELP_STRING([--with-qt-includes=DIR],[where the Qt includes are. ]),
  1272. [
  1273. ac_tqt_includes="$withval"
  1274. ])
  1275. kde_qt_libs_given=no
  1276. AC_ARG_WITH(qt-libraries,
  1277. AC_HELP_STRING([--with-qt-libraries=DIR],[where the Qt library is installed.]),
  1278. [ ac_qt_libraries="$withval"
  1279. kde_qt_libs_given=yes
  1280. ])
  1281. AC_CACHE_VAL(ac_cv_have_qt,
  1282. [#try to guess Qt locations
  1283. qt_incdirs=""
  1284. for dir in $kde_qt_dirs; do
  1285. qt_incdirs="$qt_incdirs $dir/include $dir"
  1286. done
  1287. qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes"
  1288. if test ! "$ac_tqt_includes" = "NO"; then
  1289. qt_incdirs="$ac_tqt_includes $qt_incdirs"
  1290. fi
  1291. if test "$kde_qtver" != "1"; then
  1292. kde_qt_header=qstyle.h
  1293. else
  1294. kde_qt_header=qglobal.h
  1295. fi
  1296. AC_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
  1297. ac_tqt_includes="$qt_incdir"
  1298. qt_libdirs=""
  1299. for dir in $kde_qt_dirs; do
  1300. qt_libdirs="$qt_libdirs $dir/lib${tdelibsuff} $dir"
  1301. done
  1302. qt_libdirs="$TQTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
  1303. if test ! "$ac_qt_libraries" = "NO"; then
  1304. qt_libdir=$ac_qt_libraries
  1305. else
  1306. qt_libdirs="$ac_qt_libraries $qt_libdirs"
  1307. # if the Qt was given, the chance is too big that libtqt.* doesn't exist
  1308. qt_libdir=NONE
  1309. for dir in $qt_libdirs; do
  1310. try="ls -1 $dir/${LIBTQT_GLOB}"
  1311. if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  1312. done
  1313. fi
  1314. for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
  1315. if test -e "$a"; then
  1316. LIBTQT="$LIBTQT ${kde_int_qt}_incremental"
  1317. break
  1318. fi
  1319. done
  1320. ac_qt_libraries="$qt_libdir"
  1321. AC_LANG_SAVE
  1322. AC_LANG_CPLUSPLUS
  1323. ac_cxxflags_safe="$CXXFLAGS"
  1324. ac_ldflags_safe="$LDFLAGS"
  1325. ac_libs_safe="$LIBS"
  1326. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  1327. LDFLAGS="$LDFLAGS -L$qt_libdir $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
  1328. LIBS="$LIBS $LIBTQT $KDE_MT_LIBS"
  1329. KDE_PRINT_QT_PROGRAM
  1330. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  1331. rm -f conftest*
  1332. else
  1333. echo "configure: failed program was:" >&AC_FD_CC
  1334. cat conftest.$ac_ext >&AC_FD_CC
  1335. ac_qt_libraries="NO"
  1336. fi
  1337. rm -f conftest*
  1338. CXXFLAGS="$ac_cxxflags_safe"
  1339. LDFLAGS="$ac_ldflags_safe"
  1340. LIBS="$ac_libs_safe"
  1341. AC_LANG_RESTORE
  1342. if test "$ac_tqt_includes" = NO || test "$ac_qt_libraries" = NO; then
  1343. ac_cv_have_qt="have_qt=no"
  1344. ac_qt_notfound=""
  1345. missing_qt_mt=""
  1346. if test "$ac_tqt_includes" = NO; then
  1347. if test "$ac_qt_libraries" = NO; then
  1348. ac_qt_notfound="(headers and libraries)";
  1349. else
  1350. ac_qt_notfound="(headers)";
  1351. fi
  1352. else
  1353. if test "x$kde_use_qt_mt" = "xyes"; then
  1354. missing_qt_mt="
  1355. Make sure that you have compiled Qt with thread support!"
  1356. ac_qt_notfound="(library $tqtlib-mt)";
  1357. else
  1358. ac_qt_notfound="(library $tqtlib)";
  1359. fi
  1360. fi
  1361. AC_MSG_ERROR([Qt ($kde_qt_minversion) $ac_qt_notfound not found. Please check your installation!
  1362. For more details about this problem, look at the end of config.log.$missing_qt_mt])
  1363. else
  1364. have_qt="yes"
  1365. fi
  1366. ])
  1367. eval "$ac_cv_have_qt"
  1368. if test "$have_qt" != yes; then
  1369. AC_MSG_RESULT([$have_qt]);
  1370. else
  1371. ac_cv_have_qt="have_qt=yes \
  1372. ac_tqt_includes=$ac_tqt_includes ac_qt_libraries=$ac_qt_libraries"
  1373. AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_tqt_includes $USING_QT_MT])
  1374. qt_libraries="$ac_qt_libraries"
  1375. tqt_includes="$ac_tqt_includes"
  1376. fi
  1377. if test ! "$kde_qt_libs_given" = "yes" && test ! "$kde_qtver" = 3; then
  1378. KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
  1379. fi
  1380. AC_SUBST(qt_libraries)
  1381. AC_SUBST(tqt_includes)
  1382. if test "$tqt_includes" = "$x_includes" || test -z "$tqt_includes"; then
  1383. TQT_INCLUDES=""
  1384. else
  1385. TQT_INCLUDES="-I$tqt_includes"
  1386. all_includes="$TQT_INCLUDES $all_includes"
  1387. fi
  1388. if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
  1389. QT_LDFLAGS=""
  1390. else
  1391. QT_LDFLAGS="-L$qt_libraries"
  1392. all_libraries="$QT_LDFLAGS $all_libraries"
  1393. fi
  1394. test -z "$KDE_MT_LDFLAGS" || all_libraries="$all_libraries $KDE_MT_LDFLAGS"
  1395. AC_SUBST(TQT_INCLUDES)
  1396. AC_SUBST(QT_LDFLAGS)
  1397. AC_PATH_TQT_MOC_UIC
  1398. KDE_CHECK_QT_JPEG
  1399. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  1400. LIB_TQT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG) -lXext $(LIB_X11) $(LIBSM)'
  1401. else
  1402. LIB_TQT="$kde_int_qt $LIBJPEG_QT "'$(LIBZ) $(LIBPNG)'
  1403. fi
  1404. test -z "$KDE_MT_LIBS" || LIB_TQT="$LIB_TQT $KDE_MT_LIBS"
  1405. for a in $qt_libdir/lib`echo ${kde_int_qt} | sed 's,^-l,,'`_incremental.*; do
  1406. if test -e "$a"; then
  1407. LIB_TQT="$LIB_TQT ${kde_int_qt}_incremental"
  1408. break
  1409. fi
  1410. done
  1411. AC_SUBST(LIB_TQT)
  1412. AC_SUBST(LIB_QPE)
  1413. AC_SUBST(kde_qtver)
  1414. ])
  1415. AC_DEFUN([AC_PATH_TQT],
  1416. [
  1417. AC_PATH_TQT_1_3
  1418. ])
  1419. AC_DEFUN([KDE_CHECK_UIC_PLUGINS],
  1420. [
  1421. AC_REQUIRE([AC_PATH_TQT_MOC_UIC])
  1422. if test x$ac_uic_supports_libpath = xyes; then
  1423. AC_MSG_CHECKING([if UIC has KDE plugins available])
  1424. AC_CACHE_VAL(kde_cv_uic_plugins,
  1425. [
  1426. cat > actest.ui << EOF
  1427. <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
  1428. <class>NewConnectionDialog</class>
  1429. <widget class="QDialog">
  1430. <widget class="KLineEdit">
  1431. <property name="name">
  1432. <cstring>testInput</cstring>
  1433. </property>
  1434. </widget>
  1435. </widget>
  1436. </UI>
  1437. EOF
  1438. kde_cv_uic_plugins=no
  1439. kde_line="$UIC_PATH -L $kde_widgetdir"
  1440. if test x$ac_uic_supports_nounload = xyes; then
  1441. kde_line="$kde_line -nounload"
  1442. fi
  1443. kde_line="$kde_line -impl actest.h actest.ui > actest.cpp"
  1444. if AC_TRY_EVAL(kde_line); then
  1445. # if you're trying to debug this check and think it's incorrect,
  1446. # better check your installation. The check _is_ correct - your
  1447. # installation is not.
  1448. if test -f actest.cpp && grep klineedit actest.cpp > /dev/null; then
  1449. kde_cv_uic_plugins=yes
  1450. fi
  1451. fi
  1452. rm -f actest.ui actest.cpp
  1453. ])
  1454. AC_MSG_RESULT([$kde_cv_uic_plugins])
  1455. if test "$kde_cv_uic_plugins" != yes; then
  1456. AC_MSG_ERROR([
  1457. you need to install tdelibs first.
  1458. If you did install tdelibs, then the Qt version that is picked up by
  1459. this configure is not the same version you used to compile tdelibs.
  1460. The Qt Plugin installed by tdelibs is *ONLY* loadable if it is the
  1461. _same Qt version_, compiled with the _same compiler_ and the same Qt
  1462. configuration settings.
  1463. ])
  1464. fi
  1465. fi
  1466. ])
  1467. AC_DEFUN([KDE_CHECK_FINAL],
  1468. [
  1469. AC_ARG_ENABLE(final,
  1470. AC_HELP_STRING([--enable-final],
  1471. [build size optimized apps (experimental - needs lots of memory)]),
  1472. kde_use_final=$enableval, kde_use_final=no)
  1473. if test "x$kde_use_final" = "xyes"; then
  1474. KDE_USE_FINAL_TRUE=""
  1475. KDE_USE_FINAL_FALSE="#"
  1476. else
  1477. KDE_USE_FINAL_TRUE="#"
  1478. KDE_USE_FINAL_FALSE=""
  1479. fi
  1480. AC_SUBST(KDE_USE_FINAL_TRUE)
  1481. AC_SUBST(KDE_USE_FINAL_FALSE)
  1482. ])
  1483. AC_DEFUN([KDE_CHECK_CLOSURE],
  1484. [
  1485. AC_ARG_ENABLE(closure,
  1486. AC_HELP_STRING([--enable-closure],[delay template instantiation]),
  1487. kde_use_closure=$enableval, kde_use_closure=no)
  1488. KDE_NO_UNDEFINED=""
  1489. if test "x$kde_use_closure" = "xyes"; then
  1490. KDE_USE_CLOSURE_TRUE=""
  1491. KDE_USE_CLOSURE_FALSE="#"
  1492. # CXXFLAGS="$CXXFLAGS $REPO"
  1493. else
  1494. KDE_USE_CLOSURE_TRUE="#"
  1495. KDE_USE_CLOSURE_FALSE=""
  1496. KDE_NO_UNDEFINED=""
  1497. case $host in
  1498. *-*-linux-gnu)
  1499. KDE_CHECK_COMPILER_FLAG([Wl,--no-undefined],
  1500. [KDE_CHECK_COMPILER_FLAG([Wl,--allow-shlib-undefined],
  1501. [KDE_NO_UNDEFINED="-Wl,--no-undefined -Wl,--allow-shlib-undefined"],
  1502. [KDE_NO_UNDEFINED=""])],
  1503. [KDE_NO_UNDEFINED=""])
  1504. ;;
  1505. esac
  1506. fi
  1507. AC_SUBST(KDE_USE_CLOSURE_TRUE)
  1508. AC_SUBST(KDE_USE_CLOSURE_FALSE)
  1509. AC_SUBST(KDE_NO_UNDEFINED)
  1510. ])
  1511. dnl Check if the linker supports --enable-new-dtags and --as-needed
  1512. AC_DEFUN([KDE_CHECK_NEW_LDFLAGS],
  1513. [
  1514. AC_ARG_ENABLE(new_ldflags,
  1515. AC_HELP_STRING([--enable-new-ldflags],
  1516. [enable the new linker flags]),
  1517. kde_use_new_ldflags=$enableval,
  1518. kde_use_new_ldflags=no)
  1519. LDFLAGS_AS_NEEDED=""
  1520. LDFLAGS_NEW_DTAGS=""
  1521. if test "x$kde_use_new_ldflags" = "xyes"; then
  1522. LDFLAGS_NEW_DTAGS=""
  1523. KDE_CHECK_COMPILER_FLAG([Wl,--enable-new-dtags],
  1524. [LDFLAGS_NEW_DTAGS="-Wl,--enable-new-dtags"],)
  1525. KDE_CHECK_COMPILER_FLAG([Wl,--as-needed],
  1526. [LDFLAGS_AS_NEEDED="-Wl,--as-needed"],)
  1527. fi
  1528. AC_SUBST(LDFLAGS_AS_NEEDED)
  1529. AC_SUBST(LDFLAGS_NEW_DTAGS)
  1530. ])
  1531. AC_DEFUN([KDE_CHECK_NMCHECK],
  1532. [
  1533. AC_ARG_ENABLE(nmcheck,AC_HELP_STRING([--enable-nmcheck],[enable automatic namespace cleanness check]),
  1534. kde_use_nmcheck=$enableval, kde_use_nmcheck=no)
  1535. if test "$kde_use_nmcheck" = "yes"; then
  1536. KDE_USE_NMCHECK_TRUE=""
  1537. KDE_USE_NMCHECK_FALSE="#"
  1538. else
  1539. KDE_USE_NMCHECK_TRUE="#"
  1540. KDE_USE_NMCHECK_FALSE=""
  1541. fi
  1542. AC_SUBST(KDE_USE_NMCHECK_TRUE)
  1543. AC_SUBST(KDE_USE_NMCHECK_FALSE)
  1544. ])
  1545. AC_DEFUN([KDE_EXPAND_MAKEVAR], [
  1546. savex=$exec_prefix
  1547. test "x$exec_prefix" = xNONE && exec_prefix=$prefix
  1548. tmp=$$2
  1549. while $1=`eval echo "$tmp"`; test "x$$1" != "x$tmp"; do tmp=$$1; done
  1550. exec_prefix=$savex
  1551. ])
  1552. dnl ------------------------------------------------------------------------
  1553. dnl Now, the same with KDE
  1554. dnl $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
  1555. dnl and $(kde_includes) will be the kdehdrlocation (if needed)
  1556. dnl ------------------------------------------------------------------------
  1557. dnl
  1558. AC_DEFUN([AC_BASE_PATH_KDE],
  1559. [
  1560. AC_REQUIRE([KDE_CHECK_STL])
  1561. AC_REQUIRE([AC_PATH_TQT])dnl
  1562. AC_REQUIRE([KDE_CHECK_LIB64])
  1563. AC_CHECK_RPATH
  1564. AC_MSG_CHECKING([for KDE])
  1565. if test "${prefix}" != NONE; then
  1566. kde_includes=${includedir}
  1567. KDE_EXPAND_MAKEVAR(ac_kde_includes, includedir)
  1568. kde_libraries=${libdir}
  1569. KDE_EXPAND_MAKEVAR(ac_kde_libraries, libdir)
  1570. else
  1571. ac_kde_includes=
  1572. ac_kde_libraries=
  1573. kde_libraries=""
  1574. kde_includes=""
  1575. fi
  1576. AC_CACHE_VAL(ac_cv_have_kde,
  1577. [#try to guess kde locations
  1578. if test "$kde_qtver" = 1; then
  1579. kde_check_header="ksock.h"
  1580. kde_check_lib="libtdecore.la"
  1581. else
  1582. kde_check_header="ksharedptr.h"
  1583. kde_check_lib="libtdeio.la"
  1584. fi
  1585. if test -z "$1"; then
  1586. kde_incdirs="$kde_libs_prefix/include /usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/tde /usr/include /opt/kde3/include /opt/kde/include $x_includes $tqt_includes"
  1587. test -n "$TDEDIR" && kde_incdirs="$TDEDIR/include $TDEDIR/include/tde $TDEDIR $kde_incdirs"
  1588. kde_incdirs="$ac_kde_includes $kde_incdirs"
  1589. AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
  1590. ac_kde_includes="$kde_incdir"
  1591. if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
  1592. AC_MSG_ERROR([
  1593. in the prefix, you've chosen, are no KDE headers installed. This will fail.
  1594. So, check this please and use another prefix!])
  1595. fi
  1596. kde_libdirs="$kde_libs_prefix/lib${tdelibsuff} /usr/lib/kde/lib${tdelibsuff} /usr/local/kde/lib${tdelibsuff} /usr/kde/lib${tdelibsuff} /usr/lib${tdelibsuff}/kde /usr/lib${tdelibsuff}/kde3 /usr/lib${tdelibsuff} /usr/X11R6/lib${tdelibsuff} /usr/local/lib${tdelibsuff} /opt/kde3/lib${tdelibsuff} /opt/kde/lib${tdelibsuff} /usr/X11R6/kde/lib${tdelibsuff}"
  1597. test -n "$TDEDIR" && kde_libdirs="$TDEDIR/lib${tdelibsuff} $TDEDIR $kde_libdirs"
  1598. kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
  1599. AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
  1600. ac_kde_libraries="$kde_libdir"
  1601. kde_widgetdir=NO
  1602. dnl this might be somewhere else
  1603. AC_FIND_FILE("kde3/plugins/designer/tdewidgets.la", $kde_libdirs, kde_widgetdir)
  1604. if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
  1605. AC_MSG_ERROR([
  1606. in the prefix, you've chosen, are no KDE libraries installed. This will fail.
  1607. So, check this please and use another prefix!])
  1608. fi
  1609. if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/tdewidgets.la"; then
  1610. AC_MSG_ERROR([
  1611. I can't find the designer plugins. These are required and should have been installed
  1612. by tdelibs])
  1613. fi
  1614. if test -n "$kde_widgetdir"; then
  1615. kde_widgetdir="$kde_widgetdir/kde3/plugins/designer"
  1616. fi
  1617. if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
  1618. ac_cv_have_kde="have_kde=no"
  1619. else
  1620. ac_cv_have_kde="have_kde=yes \
  1621. ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1622. fi
  1623. else dnl test -z $1, e.g. from tdelibs
  1624. ac_cv_have_kde="have_kde=no"
  1625. fi
  1626. ])dnl
  1627. eval "$ac_cv_have_kde"
  1628. if test "$have_kde" != "yes"; then
  1629. if test "${prefix}" = NONE; then
  1630. ac_kde_prefix="$ac_default_prefix"
  1631. else
  1632. ac_kde_prefix="$prefix"
  1633. fi
  1634. if test "$exec_prefix" = NONE; then
  1635. ac_kde_exec_prefix="$ac_kde_prefix"
  1636. AC_MSG_RESULT([will be installed in $ac_kde_prefix])
  1637. else
  1638. ac_kde_exec_prefix="$exec_prefix"
  1639. AC_MSG_RESULT([will be installed in $ac_kde_prefix and $ac_kde_exec_prefix])
  1640. fi
  1641. kde_libraries="${libdir}"
  1642. kde_includes="${includedir}"
  1643. else
  1644. ac_cv_have_kde="have_kde=yes \
  1645. ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
  1646. AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
  1647. kde_libraries="$ac_kde_libraries"
  1648. kde_includes="$ac_kde_includes"
  1649. fi
  1650. AC_SUBST(kde_libraries)
  1651. AC_SUBST(kde_includes)
  1652. if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$tqt_includes" || test "$kde_includes" = "/usr/include"; then
  1653. KDE_INCLUDES=""
  1654. else
  1655. KDE_INCLUDES="-I$kde_includes"
  1656. all_includes="$KDE_INCLUDES $all_includes"
  1657. fi
  1658. KDE_DEFAULT_CXXFLAGS="-DTQT_NO_ASCII_CAST -DTQT_NO_STL -DTQT_NO_COMPAT -DTQT_NO_TRANSLATION"
  1659. KDE_LDFLAGS="-L$kde_libraries"
  1660. if test ! "$kde_libraries" = "$x_libraries" && test ! "$kde_libraries" = "$qt_libraries" ; then
  1661. all_libraries="$KDE_LDFLAGS $all_libraries"
  1662. fi
  1663. AC_SUBST(KDE_LDFLAGS)
  1664. AC_SUBST(KDE_INCLUDES)
  1665. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  1666. all_libraries="$all_libraries $USER_LDFLAGS"
  1667. all_includes="$all_includes $USER_INCLUDES"
  1668. AC_SUBST(all_includes)
  1669. AC_SUBST(all_libraries)
  1670. if test -z "$1"; then
  1671. KDE_CHECK_UIC_PLUGINS
  1672. fi
  1673. ac_kde_libraries="$kde_libdir"
  1674. AC_SUBST(AUTODIRS)
  1675. ])
  1676. AC_DEFUN([KDE_CHECK_EXTRA_LIBS],
  1677. [
  1678. AC_MSG_CHECKING(for extra includes)
  1679. AC_ARG_WITH(extra-includes,AC_HELP_STRING([--with-extra-includes=DIR],[adds non standard include paths]),
  1680. kde_use_extra_includes="$withval",
  1681. kde_use_extra_includes=NONE
  1682. )
  1683. kde_extra_includes=
  1684. if test -n "$kde_use_extra_includes" && \
  1685. test "$kde_use_extra_includes" != "NONE"; then
  1686. ac_save_ifs=$IFS
  1687. IFS=':'
  1688. for dir in $kde_use_extra_includes; do
  1689. kde_extra_includes="$kde_extra_includes $dir"
  1690. USER_INCLUDES="$USER_INCLUDES -I$dir"
  1691. done
  1692. IFS=$ac_save_ifs
  1693. kde_use_extra_includes="added"
  1694. else
  1695. kde_use_extra_includes="no"
  1696. fi
  1697. AC_SUBST(USER_INCLUDES)
  1698. AC_MSG_RESULT($kde_use_extra_includes)
  1699. kde_extra_libs=
  1700. AC_MSG_CHECKING(for extra libs)
  1701. AC_ARG_WITH(extra-libs,AC_HELP_STRING([--with-extra-libs=DIR],[adds non standard library paths]),
  1702. kde_use_extra_libs=$withval,
  1703. kde_use_extra_libs=NONE
  1704. )
  1705. if test -n "$kde_use_extra_libs" && \
  1706. test "$kde_use_extra_libs" != "NONE"; then
  1707. ac_save_ifs=$IFS
  1708. IFS=':'
  1709. for dir in $kde_use_extra_libs; do
  1710. kde_extra_libs="$kde_extra_libs $dir"
  1711. KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -R $dir"
  1712. USER_LDFLAGS="$USER_LDFLAGS -L$dir"
  1713. done
  1714. IFS=$ac_save_ifs
  1715. kde_use_extra_libs="added"
  1716. else
  1717. kde_use_extra_libs="no"
  1718. fi
  1719. AC_SUBST(USER_LDFLAGS)
  1720. AC_MSG_RESULT($kde_use_extra_libs)
  1721. ])
  1722. AC_DEFUN([KDE_1_CHECK_PATH_HEADERS],
  1723. [
  1724. AC_MSG_CHECKING([for KDE headers installed])
  1725. AC_LANG_SAVE
  1726. AC_LANG_CPLUSPLUS
  1727. cat > conftest.$ac_ext <<EOF
  1728. #ifdef STDC_HEADERS
  1729. # include <stdlib.h>
  1730. #endif
  1731. #include <stdio.h>
  1732. #include "confdefs.h"
  1733. #include <kapp.h>
  1734. int main() {
  1735. printf("kde_htmldir=\\"%s\\"\n", TDEApplication::kde_htmldir().data());
  1736. printf("kde_appsdir=\\"%s\\"\n", TDEApplication::kde_appsdir().data());
  1737. printf("kde_icondir=\\"%s\\"\n", TDEApplication::kde_icondir().data());
  1738. printf("kde_sounddir=\\"%s\\"\n", TDEApplication::kde_sounddir().data());
  1739. printf("kde_datadir=\\"%s\\"\n", TDEApplication::kde_datadir().data());
  1740. printf("kde_locale=\\"%s\\"\n", TDEApplication::kde_localedir().data());
  1741. printf("kde_cgidir=\\"%s\\"\n", TDEApplication::kde_cgidir().data());
  1742. printf("kde_confdir=\\"%s\\"\n", TDEApplication::kde_configdir().data());
  1743. printf("kde_mimedir=\\"%s\\"\n", TDEApplication::kde_mimedir().data());
  1744. printf("kde_toolbardir=\\"%s\\"\n", TDEApplication::kde_toolbardir().data());
  1745. printf("kde_wallpaperdir=\\"%s\\"\n",
  1746. TDEApplication::kde_wallpaperdir().data());
  1747. printf("kde_bindir=\\"%s\\"\n", TDEApplication::kde_bindir().data());
  1748. printf("kde_partsdir=\\"%s\\"\n", TDEApplication::kde_partsdir().data());
  1749. printf("kde_servicesdir=\\"/tmp/dummy\\"\n");
  1750. printf("kde_servicetypesdir=\\"/tmp/dummy\\"\n");
  1751. printf("kde_moduledir=\\"/tmp/dummy\\"\n");
  1752. printf("kde_styledir=\\"/tmp/dummy\\"\n");
  1753. printf("kde_widgetdir=\\"/tmp/dummy\\"\n");
  1754. printf("xdg_appsdir=\\"/tmp/dummy\\"\n");
  1755. printf("xdg_menudir=\\"/tmp/dummy\\"\n");
  1756. printf("xdg_directorydir=\\"/tmp/dummy\\"\n");
  1757. printf("kde_kcfgdir=\\"/tmp/dummy\\"\n");
  1758. return 0;
  1759. }
  1760. EOF
  1761. ac_save_CPPFLAGS=$CPPFLAGS
  1762. CPPFLAGS="$all_includes $CPPFLAGS"
  1763. if AC_TRY_EVAL(ac_compile); then
  1764. AC_MSG_RESULT(yes)
  1765. else
  1766. AC_MSG_ERROR([your system is not able to compile a small KDE application!
  1767. Check, if you installed the KDE header files correctly.
  1768. For more details about this problem, look at the end of config.log.])
  1769. fi
  1770. CPPFLAGS=$ac_save_CPPFLAGS
  1771. AC_LANG_RESTORE
  1772. ])
  1773. AC_DEFUN([KDE_CHECK_KDEQTADDON],
  1774. [
  1775. AC_MSG_CHECKING(for kde-qt-addon)
  1776. AC_CACHE_VAL(kde_cv_have_kdetqtaddon,
  1777. [
  1778. kde_ldflags_safe="$LDFLAGS"
  1779. kde_libs_safe="$LIBS"
  1780. kde_cxxflags_safe="$CXXFLAGS"
  1781. LIBS="-lkde-qt-addon $LIBTQT $LIBS"
  1782. CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/tde $all_includes"
  1783. LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
  1784. AC_TRY_LINK([
  1785. #include <qdom.h>
  1786. ],
  1787. [
  1788. QDomDocument doc;
  1789. ],
  1790. kde_cv_have_kdetqtaddon=yes,
  1791. kde_cv_have_kdetqtaddon=no
  1792. )
  1793. LDFLAGS=$kde_ldflags_safe
  1794. LIBS=$kde_libs_safe
  1795. CXXFLAGS=$kde_cxxflags_safe
  1796. ])
  1797. AC_MSG_RESULT($kde_cv_have_kdetqtaddon)
  1798. if test "$kde_cv_have_kdetqtaddon" = "no"; then
  1799. AC_MSG_ERROR([Can't find libkde-qt-addon. You need to install it first.
  1800. It is a separate package (and CVS module) named kde-qt-addon.])
  1801. fi
  1802. ])
  1803. AC_DEFUN([KDE_CREATE_LIBS_ALIASES],
  1804. [
  1805. AC_REQUIRE([KDE_MISC_TESTS])
  1806. AC_REQUIRE([KDE_CHECK_LIBDL])
  1807. AC_REQUIRE([K_PATH_X])
  1808. if test $kde_qtver = 3; then
  1809. case $host in
  1810. *cygwin*) lib_kded="-ltdeinit_kded" ;;
  1811. *) lib_kded="" ;;
  1812. esac
  1813. AC_SUBST(LIB_KDED, $lib_kded)
  1814. AC_SUBST(LIB_TDECORE, "-ltdecore")
  1815. AC_SUBST(LIB_TDEUI, "-ltdeui")
  1816. AC_SUBST(LIB_TDEIO, "-ltdeio")
  1817. AC_SUBST(LIB_KJS, "-lkjs")
  1818. AC_SUBST(LIB_SMB, "-lsmb")
  1819. AC_SUBST(LIB_KAB, "-lkab")
  1820. AC_SUBST(LIB_TDEABC, "-ltdeabc")
  1821. AC_SUBST(LIB_TDEHTML, "-ltdehtml")
  1822. AC_SUBST(LIB_TDESPELL, "-ltdespell")
  1823. AC_SUBST(LIB_TDEPARTS, "-ltdeparts")
  1824. AC_SUBST(LIB_TDEPRINT, "-ltdeprint")
  1825. AC_SUBST(LIB_TDEUTILS, "-ltdeutils")
  1826. AC_SUBST(LIB_TDEPIM, "-ltdepim")
  1827. AC_SUBST(LIB_TDEIMPROXY, "-ltdeimproxy")
  1828. AC_SUBST(LIB_KNEWSTUFF, "-lknewstuff")
  1829. AC_SUBST(LIB_TDEDNSSD, "-ltdednssd")
  1830. AC_SUBST(LIB_TDEUNITTEST, "-ltdeunittest")
  1831. # these are for backward compatibility
  1832. AC_SUBST(LIB_TDESYCOCA, "-ltdeio")
  1833. AC_SUBST(LIB_TDEFILE, "-ltdeio")
  1834. elif test $kde_qtver = 2; then
  1835. AC_SUBST(LIB_TDECORE, "-ltdecore")
  1836. AC_SUBST(LIB_TDEUI, "-ltdeui")
  1837. AC_SUBST(LIB_TDEIO, "-ltdeio")
  1838. AC_SUBST(LIB_TDESYCOCA, "-ltdesycoca")
  1839. AC_SUBST(LIB_SMB, "-lsmb")
  1840. AC_SUBST(LIB_TDEFILE, "-ltdefile")
  1841. AC_SUBST(LIB_KAB, "-lkab")
  1842. AC_SUBST(LIB_TDEHTML, "-ltdehtml")
  1843. AC_SUBST(LIB_TDESPELL, "-ltdespell")
  1844. AC_SUBST(LIB_TDEPARTS, "-ltdeparts")
  1845. AC_SUBST(LIB_TDEPRINT, "-ltdeprint")
  1846. else
  1847. AC_SUBST(LIB_TDECORE, "-ltdecore -lXext $(LIB_TQT)")
  1848. AC_SUBST(LIB_TDEUI, "-ltdeui $(LIB_TDECORE)")
  1849. AC_SUBST(LIB_KFM, "-lkfm $(LIB_TDECORE)")
  1850. AC_SUBST(LIB_TDEFILE, "-ltdefile $(LIB_KFM) $(LIB_TDEUI)")
  1851. AC_SUBST(LIB_KAB, "-lkab $(LIB_KIMGIO) $(LIB_TDECORE)")
  1852. fi
  1853. ])
  1854. AC_DEFUN([AC_PATH_KDE],
  1855. [
  1856. AC_BASE_PATH_KDE
  1857. AC_ARG_ENABLE(path-check,AC_HELP_STRING([--disable-path-check],[don't try to find out, where to install]),
  1858. [
  1859. if test "$enableval" = "no";
  1860. then ac_use_path_checking="default"
  1861. else ac_use_path_checking=""
  1862. fi
  1863. ],
  1864. [
  1865. if test "$kde_qtver" = 1;
  1866. then ac_use_path_checking=""
  1867. else ac_use_path_checking="default"
  1868. fi
  1869. ]
  1870. )
  1871. AC_CREATE_KFSSTND($ac_use_path_checking)
  1872. AC_SUBST_KFSSTND
  1873. KDE_CREATE_LIBS_ALIASES
  1874. ])
  1875. dnl KDE_CHECK_FUNC_EXT(<func>, [headers], [sample-use], [C prototype], [autoheader define], [call if found])
  1876. AC_DEFUN([KDE_CHECK_FUNC_EXT],
  1877. [
  1878. AC_MSG_CHECKING(for $1)
  1879. AC_CACHE_VAL(kde_cv_func_$1,
  1880. [
  1881. AC_LANG_SAVE
  1882. AC_LANG_CPLUSPLUS
  1883. save_CXXFLAGS="$CXXFLAGS"
  1884. kde_safe_LIBS="$LIBS"
  1885. LIBS="$LIBS $X_EXTRA_LIBS"
  1886. if test "$GXX" = "yes"; then
  1887. CXXFLAGS="$CXXFLAGS -pedantic-errors"
  1888. fi
  1889. AC_TRY_COMPILE([
  1890. $2
  1891. ],
  1892. [
  1893. $3
  1894. ],
  1895. kde_cv_func_$1=yes,
  1896. kde_cv_func_$1=no)
  1897. CXXFLAGS="$save_CXXFLAGS"
  1898. LIBS="$kde_safe_LIBS"
  1899. AC_LANG_RESTORE
  1900. ])
  1901. AC_MSG_RESULT($kde_cv_func_$1)
  1902. AC_MSG_CHECKING([if $1 needs custom prototype])
  1903. AC_CACHE_VAL(kde_cv_proto_$1,
  1904. [
  1905. if test "x$kde_cv_func_$1" = xyes; then
  1906. kde_cv_proto_$1=no
  1907. else
  1908. case "$1" in
  1909. setenv|unsetenv|usleep|random|srandom|seteuid|mkstemps|mkstemp|revoke|vsnprintf|strlcpy|strlcat)
  1910. kde_cv_proto_$1="yes - in libtdefakes"
  1911. ;;
  1912. *)
  1913. kde_cv_proto_$1=unknown
  1914. ;;
  1915. esac
  1916. fi
  1917. if test "x$kde_cv_proto_$1" = xunknown; then
  1918. AC_LANG_SAVE
  1919. AC_LANG_CPLUSPLUS
  1920. kde_safe_libs=$LIBS
  1921. LIBS="$LIBS $X_EXTRA_LIBS"
  1922. AC_TRY_LINK([
  1923. $2
  1924. extern "C" $4;
  1925. ],
  1926. [
  1927. $3
  1928. ],
  1929. [ kde_cv_func_$1=yes
  1930. kde_cv_proto_$1=yes ],
  1931. [kde_cv_proto_$1="$1 unavailable"]
  1932. )
  1933. LIBS=$kde_safe_libs
  1934. AC_LANG_RESTORE
  1935. fi
  1936. ])
  1937. AC_MSG_RESULT($kde_cv_proto_$1)
  1938. if test "x$kde_cv_func_$1" = xyes; then
  1939. AC_DEFINE(HAVE_$5, 1, [Define if you have $1])
  1940. $6
  1941. fi
  1942. if test "x$kde_cv_proto_$1" = xno; then
  1943. AC_DEFINE(HAVE_$5_PROTO, 1,
  1944. [Define if you have the $1 prototype])
  1945. fi
  1946. AH_VERBATIM([_HAVE_$5_PROTO],
  1947. [
  1948. #if !defined(HAVE_$5_PROTO)
  1949. #ifdef __cplusplus
  1950. extern "C" {
  1951. #endif
  1952. $4;
  1953. #ifdef __cplusplus
  1954. }
  1955. #endif
  1956. #endif
  1957. ])
  1958. ])
  1959. AC_DEFUN([AC_CHECK_SETENV],
  1960. [
  1961. KDE_CHECK_FUNC_EXT(setenv, [
  1962. #include <stdlib.h>
  1963. ],
  1964. [setenv("VAR", "VALUE", 1);],
  1965. [int setenv (const char *, const char *, int)],
  1966. [SETENV])
  1967. ])
  1968. AC_DEFUN([AC_CHECK_UNSETENV],
  1969. [
  1970. KDE_CHECK_FUNC_EXT(unsetenv, [
  1971. #include <stdlib.h>
  1972. ],
  1973. [unsetenv("VAR");],
  1974. [void unsetenv (const char *)],
  1975. [UNSETENV])
  1976. ])
  1977. AC_DEFUN([AC_CHECK_GETDOMAINNAME],
  1978. [
  1979. KDE_CHECK_FUNC_EXT(getdomainname, [
  1980. #include <stdlib.h>
  1981. #include <unistd.h>
  1982. #include <netdb.h>
  1983. ],
  1984. [
  1985. char buffer[200];
  1986. getdomainname(buffer, 200);
  1987. ],
  1988. [#include <sys/types.h>
  1989. int getdomainname (char *, size_t)],
  1990. [GETDOMAINNAME])
  1991. ])
  1992. AC_DEFUN([AC_CHECK_GETHOSTNAME],
  1993. [
  1994. KDE_CHECK_FUNC_EXT(gethostname, [
  1995. #include <stdlib.h>
  1996. #include <unistd.h>
  1997. ],
  1998. [
  1999. char buffer[200];
  2000. gethostname(buffer, 200);
  2001. ],
  2002. [int gethostname (char *, unsigned int)],
  2003. [GETHOSTNAME])
  2004. ])
  2005. AC_DEFUN([AC_CHECK_USLEEP],
  2006. [
  2007. KDE_CHECK_FUNC_EXT(usleep, [
  2008. #include <unistd.h>
  2009. ],
  2010. [
  2011. usleep(200);
  2012. ],
  2013. [int usleep (unsigned int)],
  2014. [USLEEP])
  2015. ])
  2016. AC_DEFUN([AC_CHECK_RANDOM],
  2017. [
  2018. KDE_CHECK_FUNC_EXT(random, [
  2019. #include <stdlib.h>
  2020. ],
  2021. [
  2022. random();
  2023. ],
  2024. [long int random(void)],
  2025. [RANDOM])
  2026. KDE_CHECK_FUNC_EXT(srandom, [
  2027. #include <stdlib.h>
  2028. ],
  2029. [
  2030. srandom(27);
  2031. ],
  2032. [void srandom(unsigned int)],
  2033. [SRANDOM])
  2034. ])
  2035. AC_DEFUN([AC_CHECK_INITGROUPS],
  2036. [
  2037. KDE_CHECK_FUNC_EXT(initgroups, [
  2038. #include <sys/types.h>
  2039. #include <unistd.h>
  2040. #include <grp.h>
  2041. ],
  2042. [
  2043. char buffer[200];
  2044. initgroups(buffer, 27);
  2045. ],
  2046. [int initgroups(const char *, gid_t)],
  2047. [INITGROUPS])
  2048. ])
  2049. AC_DEFUN([AC_CHECK_MKSTEMPS],
  2050. [
  2051. KDE_CHECK_FUNC_EXT(mkstemps, [
  2052. #include <stdlib.h>
  2053. #include <unistd.h>
  2054. ],
  2055. [
  2056. mkstemps("/tmp/aaaXXXXXX", 6);
  2057. ],
  2058. [int mkstemps(char *, int)],
  2059. [MKSTEMPS])
  2060. ])
  2061. AC_DEFUN([AC_CHECK_MKSTEMP],
  2062. [
  2063. KDE_CHECK_FUNC_EXT(mkstemp, [
  2064. #include <stdlib.h>
  2065. #include <unistd.h>
  2066. ],
  2067. [
  2068. mkstemp("/tmp/aaaXXXXXX");
  2069. ],
  2070. [int mkstemp(char *)],
  2071. [MKSTEMP])
  2072. ])
  2073. AC_DEFUN([AC_CHECK_MKDTEMP],
  2074. [
  2075. KDE_CHECK_FUNC_EXT(mkdtemp, [
  2076. #include <stdlib.h>
  2077. #include <unistd.h>
  2078. ],
  2079. [
  2080. mkdtemp("/tmp/aaaXXXXXX");
  2081. ],
  2082. [char *mkdtemp(char *)],
  2083. [MKDTEMP])
  2084. ])
  2085. AC_DEFUN([AC_CHECK_RES_INIT],
  2086. [
  2087. AC_MSG_CHECKING([if res_init needs -lresolv])
  2088. kde_libs_safe="$LIBS"
  2089. LIBS="$LIBS $X_EXTRA_LIBS -lresolv"
  2090. AC_TRY_LINK(
  2091. [
  2092. #include <sys/types.h>
  2093. #include <netinet/in.h>
  2094. #include <arpa/nameser.h>
  2095. #include <resolv.h>
  2096. ],
  2097. [
  2098. res_init();
  2099. ],
  2100. [
  2101. LIBRESOLV="-lresolv"
  2102. AC_MSG_RESULT(yes)
  2103. AC_DEFINE(HAVE_RES_INIT, 1, [Define if you have the res_init function])
  2104. ],
  2105. [ AC_MSG_RESULT(no) ]
  2106. )
  2107. LIBS=$kde_libs_safe
  2108. AC_SUBST(LIBRESOLV)
  2109. KDE_CHECK_FUNC_EXT(res_init,
  2110. [
  2111. #include <sys/types.h>
  2112. #include <netinet/in.h>
  2113. #include <arpa/nameser.h>
  2114. #include <resolv.h>
  2115. ],
  2116. [res_init()],
  2117. [int res_init(void)],
  2118. [RES_INIT])
  2119. ])
  2120. AC_DEFUN([AC_CHECK_STRLCPY],
  2121. [
  2122. KDE_CHECK_FUNC_EXT(strlcpy, [
  2123. #include <string.h>
  2124. ],
  2125. [ char buf[20];
  2126. strlcpy(buf, "KDE function test", sizeof(buf));
  2127. ],
  2128. [unsigned long strlcpy(char*, const char*, unsigned long)],
  2129. [STRLCPY])
  2130. ])
  2131. AC_DEFUN([AC_CHECK_STRLCAT],
  2132. [
  2133. KDE_CHECK_FUNC_EXT(strlcat, [
  2134. #include <string.h>
  2135. ],
  2136. [ char buf[20];
  2137. buf[0]='\0';
  2138. strlcat(buf, "KDE function test", sizeof(buf));
  2139. ],
  2140. [unsigned long strlcat(char*, const char*, unsigned long)],
  2141. [STRLCAT])
  2142. ])
  2143. AC_DEFUN([AC_CHECK_RES_QUERY],
  2144. [
  2145. KDE_CHECK_FUNC_EXT(res_query, [
  2146. #include <sys/types.h>
  2147. #include <netinet/in.h>
  2148. #include <arpa/nameser.h>
  2149. #include <resolv.h>
  2150. #include <netdb.h>
  2151. ],
  2152. [
  2153. res_query(NULL, 0, 0, NULL, 0);
  2154. ],
  2155. [int res_query(const char *, int, int, unsigned char *, int)],
  2156. [RES_QUERY])
  2157. ])
  2158. AC_DEFUN([AC_CHECK_DN_SKIPNAME],
  2159. [
  2160. KDE_CHECK_FUNC_EXT(dn_skipname, [
  2161. #include <sys/types.h>
  2162. #include <netinet/in.h>
  2163. #include <arpa/nameser.h>
  2164. #include <resolv.h>
  2165. ],
  2166. [
  2167. dn_skipname (NULL, NULL);
  2168. ],
  2169. [int dn_skipname (unsigned char *, unsigned char *)],
  2170. [DN_SKIPNAME])
  2171. ])
  2172. AC_DEFUN([AC_FIND_GIF],
  2173. [AC_MSG_CHECKING([for giflib])
  2174. AC_CACHE_VAL(ac_cv_lib_gif,
  2175. [ac_save_LIBS="$LIBS"
  2176. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2177. LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
  2178. else
  2179. LIBS="$all_libraries -lgif"
  2180. fi
  2181. AC_TRY_LINK(dnl
  2182. [
  2183. #ifdef __cplusplus
  2184. extern "C" {
  2185. #endif
  2186. int GifLastError(void);
  2187. #ifdef __cplusplus
  2188. }
  2189. #endif
  2190. /* We use char because int might match the return type of a gcc2
  2191. builtin and then its argument prototype would still apply. */
  2192. ],
  2193. [return GifLastError();],
  2194. eval "ac_cv_lib_gif=yes",
  2195. eval "ac_cv_lib_gif=no")
  2196. LIBS="$ac_save_LIBS"
  2197. ])dnl
  2198. if eval "test \"`echo $ac_cv_lib_gif`\" = yes"; then
  2199. AC_MSG_RESULT(yes)
  2200. AC_DEFINE_UNQUOTED(HAVE_LIBGIF, 1, [Define if you have libgif])
  2201. else
  2202. AC_MSG_ERROR(You need giflib30. Please install the tdesupport package)
  2203. fi
  2204. ])
  2205. AC_DEFUN([KDE_FIND_JPEG_HELPER],
  2206. [
  2207. AC_MSG_CHECKING([for libjpeg$2])
  2208. AC_CACHE_VAL(ac_cv_lib_jpeg_$1,
  2209. [
  2210. ac_save_LIBS="$LIBS"
  2211. LIBS="$all_libraries $USER_LDFLAGS -ljpeg$2 -lm"
  2212. ac_save_CFLAGS="$CFLAGS"
  2213. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2214. AC_TRY_LINK(
  2215. [
  2216. #ifdef __cplusplus
  2217. extern "C" {
  2218. #endif
  2219. void jpeg_CreateDecompress();
  2220. #ifdef __cplusplus
  2221. }
  2222. #endif
  2223. ],
  2224. [jpeg_CreateDecompress();],
  2225. eval "ac_cv_lib_jpeg_$1=-ljpeg$2",
  2226. eval "ac_cv_lib_jpeg_$1=no")
  2227. LIBS="$ac_save_LIBS"
  2228. CFLAGS="$ac_save_CFLAGS"
  2229. ])
  2230. if eval "test ! \"`echo $ac_cv_lib_jpeg_$1`\" = no"; then
  2231. LIBJPEG="$ac_cv_lib_jpeg_$1"
  2232. AC_MSG_RESULT($ac_cv_lib_jpeg_$1)
  2233. else
  2234. AC_MSG_RESULT(no)
  2235. $3
  2236. fi
  2237. ])
  2238. AC_DEFUN([AC_FIND_JPEG],
  2239. [
  2240. dnl first look for libraries
  2241. KDE_FIND_JPEG_HELPER(6b, 6b,
  2242. KDE_FIND_JPEG_HELPER(normal, [],
  2243. [
  2244. LIBJPEG=
  2245. ]
  2246. )
  2247. )
  2248. dnl then search the headers (can't use simply AC_TRY_xxx, as jpeglib.h
  2249. dnl requires system dependent includes loaded before it)
  2250. jpeg_incdirs="$includedir /usr/include /usr/local/include $kde_extra_includes"
  2251. AC_FIND_FILE(jpeglib.h, $jpeg_incdirs, jpeg_incdir)
  2252. test "x$jpeg_incdir" = xNO && jpeg_incdir=
  2253. dnl if headers _and_ libraries are missing, this is no error, and we
  2254. dnl continue with a warning (the user will get no jpeg support in tdehtml)
  2255. dnl if only one is missing, it means a configuration error, but we still
  2256. dnl only warn
  2257. if test -n "$jpeg_incdir" && test -n "$LIBJPEG" ; then
  2258. AC_DEFINE_UNQUOTED(HAVE_LIBJPEG, 1, [Define if you have libjpeg])
  2259. else
  2260. if test -n "$jpeg_incdir" || test -n "$LIBJPEG" ; then
  2261. AC_MSG_WARN([
  2262. There is an installation error in jpeg support. You seem to have only one
  2263. of either the headers _or_ the libraries installed. You may need to either
  2264. provide correct --with-extra-... options, or the development package of
  2265. libjpeg6b. You can get a source package of libjpeg from http://www.ijg.org/
  2266. Disabling JPEG support.
  2267. ])
  2268. else
  2269. AC_MSG_WARN([libjpeg not found. disable JPEG support.])
  2270. fi
  2271. jpeg_incdir=
  2272. LIBJPEG=
  2273. fi
  2274. AC_SUBST(LIBJPEG)
  2275. AH_VERBATIM(_AC_CHECK_JPEG,
  2276. [/*
  2277. * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
  2278. * headers and I'm too lazy to write a configure test as long as only
  2279. * unixware is related
  2280. */
  2281. #ifdef _UNIXWARE
  2282. #define HAVE_BOOLEAN
  2283. #endif
  2284. ])
  2285. ])
  2286. AC_DEFUN([KDE_CHECK_QT_JPEG],
  2287. [
  2288. if test -n "$LIBJPEG"; then
  2289. AC_MSG_CHECKING([if Qt needs $LIBJPEG])
  2290. AC_CACHE_VAL(kde_cv_qt_jpeg,
  2291. [
  2292. AC_LANG_SAVE
  2293. AC_LANG_CPLUSPLUS
  2294. ac_save_LIBS="$LIBS"
  2295. LIBS="$all_libraries $USER_LDFLAGS $LIBTQT"
  2296. LIBS=`echo $LIBS | sed "s/$LIBJPEG//"`
  2297. ac_save_CXXFLAGS="$CXXFLAGS"
  2298. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  2299. AC_TRY_LINK(
  2300. [#include <qapplication.h>],
  2301. [
  2302. int argc;
  2303. char** argv;
  2304. QApplication app(argc, argv);],
  2305. eval "kde_cv_qt_jpeg=no",
  2306. eval "kde_cv_qt_jpeg=yes")
  2307. LIBS="$ac_save_LIBS"
  2308. CXXFLAGS="$ac_save_CXXFLAGS"
  2309. AC_LANG_RESTORE
  2310. fi
  2311. ])
  2312. if eval "test ! \"`echo $kde_cv_qt_jpeg`\" = no"; then
  2313. AC_MSG_RESULT(yes)
  2314. LIBJPEG_QT='$(LIBJPEG)'
  2315. else
  2316. AC_MSG_RESULT(no)
  2317. LIBJPEG_QT=
  2318. fi
  2319. ])
  2320. AC_DEFUN([AC_FIND_ZLIB],
  2321. [
  2322. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2323. AC_MSG_CHECKING([for libz])
  2324. AC_CACHE_VAL(ac_cv_lib_z,
  2325. [
  2326. kde_save_LIBS="$LIBS"
  2327. LIBS="$all_libraries $USER_LDFLAGS -lz $LIBSOCKET"
  2328. kde_save_CFLAGS="$CFLAGS"
  2329. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2330. AC_TRY_LINK(dnl
  2331. [
  2332. #include<zlib.h>
  2333. ],
  2334. [
  2335. char buf[42];
  2336. gzFile f = (gzFile) 0;
  2337. /* this would segfault.. but we only link, don't run */
  2338. (void) gzgets(f, buf, sizeof(buf));
  2339. return (zlibVersion() == ZLIB_VERSION);
  2340. ],
  2341. eval "ac_cv_lib_z='-lz'",
  2342. eval "ac_cv_lib_z=no")
  2343. LIBS="$kde_save_LIBS"
  2344. CFLAGS="$kde_save_CFLAGS"
  2345. ])dnl
  2346. if test ! "$ac_cv_lib_z" = no; then
  2347. AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
  2348. LIBZ="$ac_cv_lib_z"
  2349. AC_MSG_RESULT($ac_cv_lib_z)
  2350. else
  2351. AC_MSG_ERROR(not found.
  2352. Possibly configure picks up an outdated version
  2353. installed by XFree86. Remove it from your system.
  2354. Check your installation and look into config.log)
  2355. LIBZ=""
  2356. fi
  2357. AC_SUBST(LIBZ)
  2358. ])
  2359. AC_DEFUN([KDE_TRY_TIFFLIB],
  2360. [
  2361. AC_MSG_CHECKING([for libtiff $1])
  2362. AC_CACHE_VAL(kde_cv_libtiff_$1,
  2363. [
  2364. AC_LANG_SAVE
  2365. AC_LANG_CPLUSPLUS
  2366. kde_save_LIBS="$LIBS"
  2367. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2368. LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lX11 $LIBSOCKET -lm"
  2369. else
  2370. LIBS="$all_libraries $USER_LDFLAGS -l$1 $LIBJPEG $LIBZ -lm"
  2371. fi
  2372. kde_save_CXXFLAGS="$CXXFLAGS"
  2373. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  2374. AC_TRY_LINK(dnl
  2375. [
  2376. #include<tiffio.h>
  2377. ],
  2378. [return (TIFFOpen( "", "r") == 0); ],
  2379. [
  2380. kde_cv_libtiff_$1="-l$1 $LIBJPEG $LIBZ"
  2381. ], [
  2382. kde_cv_libtiff_$1=no
  2383. ])
  2384. LIBS="$kde_save_LIBS"
  2385. CXXFLAGS="$kde_save_CXXFLAGS"
  2386. AC_LANG_RESTORE
  2387. ])
  2388. if test "$kde_cv_libtiff_$1" = "no"; then
  2389. AC_MSG_RESULT(no)
  2390. LIBTIFF=""
  2391. $3
  2392. else
  2393. LIBTIFF="$kde_cv_libtiff_$1"
  2394. AC_MSG_RESULT(yes)
  2395. AC_DEFINE_UNQUOTED(HAVE_LIBTIFF, 1, [Define if you have libtiff])
  2396. $2
  2397. fi
  2398. ])
  2399. AC_DEFUN([AC_FIND_TIFF],
  2400. [
  2401. AC_REQUIRE([K_PATH_X])
  2402. AC_REQUIRE([AC_FIND_ZLIB])
  2403. AC_REQUIRE([AC_FIND_JPEG])
  2404. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2405. KDE_TRY_TIFFLIB(tiff, [],
  2406. KDE_TRY_TIFFLIB(tiff34))
  2407. AC_SUBST(LIBTIFF)
  2408. ])
  2409. AC_DEFUN([KDE_FIND_LIBEXR],
  2410. [
  2411. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2412. AC_REQUIRE([AC_FIND_ZLIB])
  2413. AC_CACHE_VAL(ac_cv_libexr,
  2414. [
  2415. if test -z "$PKG_CONFIG"; then
  2416. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  2417. fi
  2418. AC_MSG_CHECKING([for OpenEXR libraries])
  2419. if test "$PKG_CONFIG" = "no" ; then
  2420. AC_MSG_RESULT(no)
  2421. echo "*** The pkg-config script could not be found. Make sure it is"
  2422. echo "*** in your path, or set the PKG_CONFIG environment variable"
  2423. echo "*** to the full path to pkg-config."
  2424. echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
  2425. else
  2426. if !(`$PKG_CONFIG --exists OpenEXR`) ; then
  2427. AC_MSG_RESULT(no)
  2428. EXRSTATUS=no
  2429. else
  2430. if !(`$PKG_CONFIG --atleast-version="1.1.1" OpenEXR`) ; then
  2431. AC_MSG_RESULT(no)
  2432. EXRSTATUS=old
  2433. else
  2434. kde_save_LIBS="$LIBS"
  2435. LIBS="$LIBS $all_libraries $USER_LDFLAGS `pkg-config --libs OpenEXR` $LIBZ"
  2436. AC_LANG_SAVE
  2437. AC_LANG_CPLUSPLUS
  2438. kde_save_CXXFLAGS="$CXXFLAGS"
  2439. EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR`
  2440. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS"
  2441. AC_TRY_LINK(dnl
  2442. [
  2443. #include <ImfRgbaFile.h>
  2444. ],
  2445. [
  2446. using namespace Imf;
  2447. RgbaInputFile file ("dummy");
  2448. return 0;
  2449. ],
  2450. eval "ac_cv_libexr='`pkg-config --libs OpenEXR`'",
  2451. eval "ac_cv_libexr=no"
  2452. )
  2453. LIBS="$kde_save_LIBS"
  2454. CXXFLAGS="$kde_save_CXXFLAGS"
  2455. AC_LANG_RESTORE
  2456. ])dnl
  2457. if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then
  2458. AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR])
  2459. LIB_EXR="$ac_cv_libexr"
  2460. AC_MSG_RESULT($ac_cv_libexr)
  2461. else
  2462. AC_MSG_RESULT(no)
  2463. LIB_EXR=""
  2464. fi
  2465. fi
  2466. fi
  2467. fi
  2468. AC_SUBST(LIB_EXR)
  2469. AC_SUBST(EXR_FLAGS)
  2470. ])
  2471. AC_DEFUN([AC_FIND_PNG],
  2472. [
  2473. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2474. AC_REQUIRE([AC_FIND_ZLIB])
  2475. AC_MSG_CHECKING([for libpng])
  2476. AC_CACHE_VAL(ac_cv_lib_png,
  2477. [
  2478. kde_save_LIBS="$LIBS"
  2479. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  2480. LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm -lX11 $LIBSOCKET"
  2481. else
  2482. LIBS="$LIBS $all_libraries $USER_LDFLAGS -lpng $LIBZ -lm"
  2483. fi
  2484. kde_save_CFLAGS="$CFLAGS"
  2485. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2486. AC_TRY_LINK(dnl
  2487. [
  2488. #include<png.h>
  2489. ],
  2490. [
  2491. png_structp png_ptr = png_create_read_struct( /* image ptr */
  2492. PNG_LIBPNG_VER_STRING, 0, 0, 0 );
  2493. return( png_ptr != 0 );
  2494. ],
  2495. eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
  2496. eval "ac_cv_lib_png=no"
  2497. )
  2498. LIBS="$kde_save_LIBS"
  2499. CFLAGS="$kde_save_CFLAGS"
  2500. ])dnl
  2501. if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
  2502. AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
  2503. LIBPNG="$ac_cv_lib_png"
  2504. AC_SUBST(LIBPNG)
  2505. AC_MSG_RESULT($ac_cv_lib_png)
  2506. else
  2507. AC_MSG_RESULT(no)
  2508. LIBPNG=""
  2509. AC_SUBST(LIBPNG)
  2510. fi
  2511. ])
  2512. AC_DEFUN([AC_FIND_JASPER],
  2513. [
  2514. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  2515. AC_REQUIRE([AC_FIND_JPEG])
  2516. AC_MSG_CHECKING([for jasper])
  2517. AC_CACHE_VAL(ac_cv_jasper,
  2518. [
  2519. kde_save_LIBS="$LIBS"
  2520. LIBS="$LIBS $all_libraries $USER_LDFLAGS -ljasper $LIBJPEG -lm"
  2521. kde_save_CFLAGS="$CFLAGS"
  2522. CFLAGS="$CFLAGS $all_includes $USER_INCLUDES"
  2523. AC_TRY_LINK(dnl
  2524. [
  2525. #include<jasper/jasper.h>
  2526. ],
  2527. [
  2528. return( jas_init() );
  2529. ],
  2530. eval "ac_cv_jasper='-ljasper $LIBJPEG -lm'",
  2531. eval "ac_cv_jasper=no"
  2532. )
  2533. LIBS="$kde_save_LIBS"
  2534. CFLAGS="$kde_save_CFLAGS"
  2535. ])dnl
  2536. if eval "test ! \"`echo $ac_cv_jasper`\" = no"; then
  2537. AC_DEFINE_UNQUOTED(HAVE_JASPER, 1, [Define if you have jasper])
  2538. LIB_JASPER="$ac_cv_jasper"
  2539. AC_MSG_RESULT($ac_cv_jasper)
  2540. else
  2541. AC_MSG_RESULT(no)
  2542. LIB_JASPER=""
  2543. fi
  2544. AC_SUBST(LIB_JASPER)
  2545. ])
  2546. AC_DEFUN([AC_CHECK_BOOL],
  2547. [
  2548. AC_DEFINE_UNQUOTED(HAVE_BOOL, 1, [You _must_ have bool])
  2549. ])
  2550. AC_DEFUN([KDE_CHECK_COMPILER_FLAG],
  2551. [
  2552. AC_MSG_CHECKING([whether $CXX supports -$1])
  2553. kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
  2554. AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
  2555. [
  2556. AC_LANG_SAVE
  2557. AC_LANG_CPLUSPLUS
  2558. save_CXXFLAGS="$CXXFLAGS"
  2559. CXXFLAGS="$CXXFLAGS -$1"
  2560. AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
  2561. CXXFLAGS="$save_CXXFLAGS"
  2562. AC_LANG_RESTORE
  2563. ])
  2564. if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
  2565. AC_MSG_RESULT(yes)
  2566. :
  2567. $2
  2568. else
  2569. AC_MSG_RESULT(no)
  2570. :
  2571. $3
  2572. fi
  2573. ])
  2574. AC_DEFUN([KDE_CHECK_C_COMPILER_FLAG],
  2575. [
  2576. AC_MSG_CHECKING([whether $CC supports -$1])
  2577. kde_cache=`echo $1 | sed 'y% .=/+-,%____p__%'`
  2578. AC_CACHE_VAL(kde_cv_prog_cc_$kde_cache,
  2579. [
  2580. AC_LANG_SAVE
  2581. AC_LANG_C
  2582. save_CFLAGS="$CFLAGS"
  2583. CFLAGS="$CFLAGS -$1"
  2584. AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cc_$kde_cache=yes"], [])
  2585. CFLAGS="$save_CFLAGS"
  2586. AC_LANG_RESTORE
  2587. ])
  2588. if eval "test \"`echo '$kde_cv_prog_cc_'$kde_cache`\" = yes"; then
  2589. AC_MSG_RESULT(yes)
  2590. :
  2591. $2
  2592. else
  2593. AC_MSG_RESULT(no)
  2594. :
  2595. $3
  2596. fi
  2597. ])
  2598. dnl AC_REMOVE_FORBIDDEN removes forbidden arguments from variables
  2599. dnl use: AC_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
  2600. dnl it's all white-space separated
  2601. AC_DEFUN([AC_REMOVE_FORBIDDEN],
  2602. [ __val=$$1
  2603. __forbid=" $2 "
  2604. if test -n "$__val"; then
  2605. __new=""
  2606. ac_save_IFS=$IFS
  2607. IFS=" "
  2608. for i in $__val; do
  2609. case "$__forbid" in
  2610. *" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
  2611. *) # Careful to not add spaces, where there were none, because otherwise
  2612. # libtool gets confused, if we change e.g. CXX
  2613. if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
  2614. esac
  2615. done
  2616. IFS=$ac_save_IFS
  2617. $1=$__new
  2618. fi
  2619. ])
  2620. AC_DEFUN([KDE_CHECK_FOR_BAD_COMPILER],
  2621. [
  2622. AC_MSG_CHECKING([whether $CC is blacklisted])
  2623. dnl In theory we have tu run this test against $CC and $CXX
  2624. dnl in C and in C++ mode, because its perfectly legal for
  2625. dnl the user to mix compiler versions, since C has a defined
  2626. dnl ABI.
  2627. dnl
  2628. dnl For now, we assume the user is not on crack.
  2629. AC_TRY_COMPILE([
  2630. #ifdef __GNUC__
  2631. #if __GNUC__ == 4 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 0
  2632. choke me
  2633. #endif
  2634. #endif
  2635. ], ,
  2636. kde_bad_compiler=no,
  2637. kde_bad_compiler=yes
  2638. )
  2639. AC_MSG_RESULT($kde_bad_compiler)
  2640. if test "$kde_bad_compiler" = "yes"; then
  2641. AC_MSG_ERROR([
  2642. This particular compiler version is blacklisted because it
  2643. is known to miscompile KDE. Please use a newer version, or
  2644. if that is not yet available, choose an older version.
  2645. Please do not report a bug or bother us reporting this
  2646. configure error. We know about it, and we introduced
  2647. it by intention to avoid untraceable bugs or crashes in KDE.
  2648. ])
  2649. fi
  2650. ])
  2651. AC_DEFUN([KDE_CHECK_FOR_OPT_NOINLINE_MATCH],
  2652. [
  2653. AC_CACHE_CHECK([whether system headers can cope with -O2 -fno-inline],
  2654. kde_cv_opt_noinline_match,
  2655. [
  2656. kde_cv_opt_noinline_match=irrelevant
  2657. dnl if we don't use both -O2 and -fno-inline, this check is moot
  2658. if echo "$CFLAGS" | grep -e -O2 >/dev/null 2>/dev/null \
  2659. && echo "$CFLAGS" | grep -e -fno-inline >/dev/null 2>/dev/null ; then
  2660. ac_cflags_save="$CFLAGS"
  2661. CFLAGS="$CFLAGS -D_USE_GNU"
  2662. AC_TRY_LINK([
  2663. #include <string.h>
  2664. ], [ const char *pt, *et;
  2665. et = __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p ( ";," ) && ((size_t)(const void *)(( ";," )+ 1) - (size_t)(const void *)( ";," ) == 1) ? ((__a0 =((__const char *) ( ";," ))[0], __a0 == '\0') ? ((void) ( pt ),((void *)0) ) : ((__a1 = ((__const char *) ( ";," ))[1], __a1== '\0') ? (__extension__ (__builtin_constant_p ( __a0 ) && ( __a0 ) == '\0' ? (char *) __rawmemchr ( pt , __a0) : strchr( pt , __a0 ))) : ((__a2 = ((__const char *) ( ";," ))[2], __a2 == '\0') ? __strpbrk_c2 ( pt , __a0, __a1) :(((__const char *) ( ";," ))[3] == '\0' ? __strpbrk_c3 ( pt ,__a0, __a1, __a2): strpbrk ( pt , ";," ))))) : strpbrk ( pt , ";," )); }) ;
  2666. ],
  2667. kde_cv_opt_noinline_match=yes,
  2668. kde_cv_opt_noinline_match=no
  2669. )
  2670. CFLAGS="$ac_cflags_save"
  2671. fi
  2672. ])
  2673. ])
  2674. dnl AC_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
  2675. AC_DEFUN([AC_VALIDIFY_CXXFLAGS],
  2676. [dnl
  2677. if test "x$kde_use_qt_emb" != "xyes"; then
  2678. AC_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
  2679. AC_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
  2680. else
  2681. AC_REMOVE_FORBIDDEN(CXX, [-rpath])
  2682. AC_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
  2683. fi
  2684. ])
  2685. AC_DEFUN([AC_CHECK_COMPILERS],
  2686. [
  2687. AC_ARG_ENABLE(debug,
  2688. AC_HELP_STRING([--enable-debug=ARG],[enables debug symbols (yes|no|full) [default=no]]),
  2689. [
  2690. case $enableval in
  2691. yes)
  2692. kde_use_debug_code="yes"
  2693. kde_use_debug_define=no
  2694. ;;
  2695. full)
  2696. kde_use_debug_code="full"
  2697. kde_use_debug_define=no
  2698. ;;
  2699. *)
  2700. kde_use_debug_code="no"
  2701. kde_use_debug_define=yes
  2702. ;;
  2703. esac
  2704. ],
  2705. [kde_use_debug_code="no"
  2706. kde_use_debug_define=no
  2707. ])
  2708. dnl Just for configure --help
  2709. AC_ARG_ENABLE(dummyoption,
  2710. AC_HELP_STRING([--disable-debug],
  2711. [disables debug output and debug symbols [default=no]]),
  2712. [],[])
  2713. AC_ARG_ENABLE(strict,
  2714. AC_HELP_STRING([--enable-strict],
  2715. [compiles with strict compiler options (may not work!)]),
  2716. [
  2717. if test $enableval = "no"; then
  2718. kde_use_strict_options="no"
  2719. else
  2720. kde_use_strict_options="yes"
  2721. fi
  2722. ], [kde_use_strict_options="no"])
  2723. AC_ARG_ENABLE(warnings,AC_HELP_STRING([--disable-warnings],[disables compilation with -Wall and similar]),
  2724. [
  2725. if test $enableval = "no"; then
  2726. kde_use_warnings="no"
  2727. else
  2728. kde_use_warnings="yes"
  2729. fi
  2730. ], [kde_use_warnings="yes"])
  2731. dnl enable warnings for debug build
  2732. if test "$kde_use_debug_code" != "no"; then
  2733. kde_use_warnings=yes
  2734. fi
  2735. AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[creates profiling infos [default=no]]),
  2736. [kde_use_profiling=$enableval],
  2737. [kde_use_profiling="no"]
  2738. )
  2739. dnl this prevents stupid AC_PROG_CC to add "-g" to the default CFLAGS
  2740. CFLAGS=" $CFLAGS"
  2741. AC_PROG_CC
  2742. AC_PROG_CPP
  2743. if test "$GCC" = "yes"; then
  2744. if test "$kde_use_debug_code" != "no"; then
  2745. if test $kde_use_debug_code = "full"; then
  2746. CFLAGS="-g3 -fno-inline $CFLAGS"
  2747. else
  2748. CFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CFLAGS"
  2749. fi
  2750. else
  2751. CFLAGS="-O2 $CFLAGS"
  2752. fi
  2753. fi
  2754. if test "$kde_use_debug_define" = "yes"; then
  2755. CFLAGS="-DNDEBUG $CFLAGS"
  2756. fi
  2757. case "$host" in
  2758. *-*-sysv4.2uw*) CFLAGS="-D_UNIXWARE $CFLAGS";;
  2759. *-*-sysv5uw7*) CFLAGS="-D_UNIXWARE7 $CFLAGS";;
  2760. esac
  2761. if test -z "$LDFLAGS" && test "$kde_use_debug_code" = "no" && test "$GCC" = "yes"; then
  2762. LDFLAGS=""
  2763. fi
  2764. CXXFLAGS=" $CXXFLAGS"
  2765. AC_PROG_CXX
  2766. KDE_CHECK_FOR_BAD_COMPILER
  2767. if test "$GXX" = "yes" || test "$CXX" = "KCC"; then
  2768. if test "$kde_use_debug_code" != "no"; then
  2769. if test "$CXX" = "KCC"; then
  2770. CXXFLAGS="+K0 -Wall -pedantic -W -Wpointer-arith -Wwrite-strings $CXXFLAGS"
  2771. else
  2772. if test "$kde_use_debug_code" = "full"; then
  2773. CXXFLAGS="-g3 -fno-inline $CXXFLAGS"
  2774. else
  2775. CXXFLAGS="-g -O2 -fno-schedule-insns -fno-inline $CXXFLAGS"
  2776. fi
  2777. fi
  2778. KDE_CHECK_COMPILER_FLAG(fno-builtin,[CXXFLAGS="-fno-builtin $CXXFLAGS"])
  2779. dnl convenience compiler flags
  2780. KDE_CHECK_COMPILER_FLAG(Woverloaded-virtual, [WOVERLOADED_VIRTUAL="-Woverloaded-virtual"], [WOVERLOADED_VRITUAL=""])
  2781. AC_SUBST(WOVERLOADED_VIRTUAL)
  2782. else
  2783. if test "$CXX" = "KCC"; then
  2784. CXXFLAGS="+K3 $CXXFLAGS"
  2785. else
  2786. CXXFLAGS="-O2 $CXXFLAGS"
  2787. fi
  2788. fi
  2789. fi
  2790. if test "$kde_use_debug_define" = "yes"; then
  2791. CXXFLAGS="-DNDEBUG -DNO_DEBUG $CXXFLAGS"
  2792. fi
  2793. if test "$kde_use_profiling" = "yes"; then
  2794. KDE_CHECK_COMPILER_FLAG(pg,
  2795. [
  2796. CFLAGS="-pg $CFLAGS"
  2797. CXXFLAGS="-pg $CXXFLAGS"
  2798. ])
  2799. fi
  2800. if test "$kde_use_warnings" = "yes"; then
  2801. if test "$GCC" = "yes"; then
  2802. CXXFLAGS="-Wall -W -Wpointer-arith $CXXFLAGS"
  2803. case $host in
  2804. *-*-linux-gnu)
  2805. CFLAGS="-std=iso9899:1990 -W -Wall -Wchar-subscripts -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE $CFLAGS"
  2806. CXXFLAGS="-ansi -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -Wcast-align -Wchar-subscripts $CXXFLAGS"
  2807. KDE_CHECK_COMPILER_FLAG(Wmissing-format-attribute, [CXXFLAGS="$CXXFLAGS -Wformat-security -Wmissing-format-attribute"])
  2808. KDE_CHECK_C_COMPILER_FLAG(Wmissing-format-attribute, [CFLAGS="$CFLAGS -Wformat-security -Wmissing-format-attribute"])
  2809. ;;
  2810. esac
  2811. KDE_CHECK_COMPILER_FLAG(Wundef,[CXXFLAGS="-Wundef $CXXFLAGS"])
  2812. KDE_CHECK_COMPILER_FLAG(Wno-long-long,[CXXFLAGS="-Wno-long-long $CXXFLAGS"])
  2813. dnl ### FIXME: revert for KDE 4
  2814. KDE_CHECK_COMPILER_FLAG(Wno-non-virtual-dtor,[CXXFLAGS="$CXXFLAGS -Wno-non-virtual-dtor"])
  2815. fi
  2816. fi
  2817. if test "$GXX" = "yes" && test "$kde_use_strict_options" = "yes"; then
  2818. CXXFLAGS="-Wcast-qual -Wshadow -Wcast-align $CXXFLAGS"
  2819. fi
  2820. AC_ARG_ENABLE(pch,
  2821. AC_HELP_STRING([--enable-pch],
  2822. [enables precompiled header support (currently only KCC or gcc >=3.4+unsermake) [default=no]]),
  2823. [ kde_use_pch=$enableval ],[ kde_use_pch=no ])
  2824. HAVE_GCC_VISIBILITY=0
  2825. AC_SUBST([HAVE_GCC_VISIBILITY])
  2826. if test "$GXX" = "yes"; then
  2827. gcc_no_reorder_blocks=NO
  2828. KDE_CHECK_COMPILER_FLAG(fno-reorder-blocks,[gcc_no_reorder_blocks=YES])
  2829. if test $kde_use_debug_code != "no" && \
  2830. test $kde_use_debug_code != "full" && \
  2831. test "YES" = "$gcc_no_reorder_blocks" ; then
  2832. CXXFLAGS="$CXXFLAGS -fno-reorder-blocks"
  2833. CFLAGS="$CFLAGS -fno-reorder-blocks"
  2834. fi
  2835. KDE_CHECK_COMPILER_FLAG(fno-exceptions,[CXXFLAGS="$CXXFLAGS -fno-exceptions"])
  2836. KDE_CHECK_COMPILER_FLAG(fno-check-new, [CXXFLAGS="$CXXFLAGS -fno-check-new"])
  2837. KDE_CHECK_COMPILER_FLAG(fno-common, [CXXFLAGS="$CXXFLAGS -fno-common"])
  2838. KDE_CHECK_COMPILER_FLAG(fexceptions, [USE_EXCEPTIONS="-fexceptions"], USE_EXCEPTIONS= )
  2839. ENABLE_PERMISSIVE_FLAG="-fpermissive"
  2840. if test "$kde_use_pch" = "yes"; then
  2841. AC_MSG_CHECKING(whether gcc supports precompiling c header files)
  2842. echo >conftest.h
  2843. if $CC -x c-header conftest.h >/dev/null 2>/dev/null; then
  2844. kde_gcc_supports_pch=yes
  2845. AC_MSG_RESULT(yes)
  2846. else
  2847. kde_gcc_supports_pch=no
  2848. AC_MSG_RESULT(no)
  2849. fi
  2850. if test "$kde_gcc_supports_pch" = "yes"; then
  2851. AC_MSG_CHECKING(whether gcc supports precompiling c++ header files)
  2852. if $CXX -x c++-header conftest.h >/dev/null 2>/dev/null; then
  2853. kde_gcc_supports_pch=yes
  2854. AC_MSG_RESULT(yes)
  2855. else
  2856. kde_gcc_supports_pch=no
  2857. AC_MSG_RESULT(no)
  2858. fi
  2859. fi
  2860. rm -f conftest.h conftest.h.gch
  2861. fi
  2862. KDE_CHECK_FOR_OPT_NOINLINE_MATCH
  2863. if test "x$kde_cv_opt_noinline_match" = "xno" ; then
  2864. CFLAGS="`echo "$CFLAGS" | sed "s/ -fno-inline//"`"
  2865. fi
  2866. fi
  2867. AM_CONDITIONAL(unsermake_enable_pch, test "$kde_use_pch" = "yes" && test "$kde_gcc_supports_pch" = "yes")
  2868. if test "$CXX" = "KCC"; then
  2869. dnl unfortunately we currently cannot disable exception support in KCC
  2870. dnl because doing so is binary incompatible and Qt by default links with exceptions :-(
  2871. dnl KDE_CHECK_COMPILER_FLAG(-no_exceptions,[CXXFLAGS="$CXXFLAGS --no_exceptions"])
  2872. dnl KDE_CHECK_COMPILER_FLAG(-exceptions, [USE_EXCEPTIONS="--exceptions"], USE_EXCEPTIONS= )
  2873. if test "$kde_use_pch" = "yes"; then
  2874. dnl TODO: support --pch-dir!
  2875. KDE_CHECK_COMPILER_FLAG(-pch,[CXXFLAGS="$CXXFLAGS --pch"])
  2876. dnl the below works (but the dir must exist), but it's
  2877. dnl useless for a whole package.
  2878. dnl The are precompiled headers for each source file, so when compiling
  2879. dnl from scratch, it doesn't make a difference, and they take up
  2880. dnl around ~5Mb _per_ sourcefile.
  2881. dnl KDE_CHECK_COMPILER_FLAG(-pch_dir /tmp,
  2882. dnl [CXXFLAGS="$CXXFLAGS --pch_dir `pwd`/pcheaders"])
  2883. fi
  2884. dnl this flag controls inlining. by default KCC inlines in optimisation mode
  2885. dnl all implementations that are defined inside the class {} declaration.
  2886. dnl because of templates-compatibility with broken gcc compilers, this
  2887. dnl can cause excessive inlining. This flag limits it to a sane level
  2888. KDE_CHECK_COMPILER_FLAG(-inline_keyword_space_time=6,[CXXFLAGS="$CXXFLAGS --inline_keyword_space_time=6"])
  2889. KDE_CHECK_COMPILER_FLAG(-inline_auto_space_time=2,[CXXFLAGS="$CXXFLAGS --inline_auto_space_time=2"])
  2890. KDE_CHECK_COMPILER_FLAG(-inline_implicit_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_implicit_space_time=2.0"])
  2891. KDE_CHECK_COMPILER_FLAG(-inline_generated_space_time=2.0,[CXXFLAGS="$CXXFLAGS --inline_generated_space_time=2.0"])
  2892. dnl Some source files are shared between multiple executables
  2893. dnl (or libraries) and some of those need template instantiations.
  2894. dnl In that case KCC needs to compile those sources with
  2895. dnl --one_instantiation_per_object. To make it easy for us we compile
  2896. dnl _all_ objects with that flag (--one_per is a shorthand).
  2897. KDE_CHECK_COMPILER_FLAG(-one_per, [CXXFLAGS="$CXXFLAGS --one_per"])
  2898. fi
  2899. AC_SUBST(USE_EXCEPTIONS)
  2900. dnl obsolete macro - provided to keep things going
  2901. USE_RTTI=
  2902. AC_SUBST(USE_RTTI)
  2903. case "$host" in
  2904. *-*-irix*) test "$GXX" = yes && CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $CXXFLAGS" ;;
  2905. *-*-sysv4.2uw*) CXXFLAGS="-D_UNIXWARE $CXXFLAGS";;
  2906. *-*-sysv5uw7*) CXXFLAGS="-D_UNIXWARE7 $CXXFLAGS";;
  2907. *-*-solaris*)
  2908. if test "$GXX" = yes; then
  2909. libstdcpp=`$CXX -print-file-name=libstdc++.so`
  2910. if test ! -f $libstdcpp; then
  2911. AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with KDE. Please recompile gcc with --enable-shared to receive a libstdc++.so])
  2912. fi
  2913. fi
  2914. ;;
  2915. esac
  2916. AC_VALIDIFY_CXXFLAGS
  2917. AC_PROG_CXXCPP
  2918. if test "$GCC" = yes; then
  2919. NOOPT_CFLAGS=-O0
  2920. fi
  2921. KDE_CHECK_COMPILER_FLAG(O0,[NOOPT_CXXFLAGS=-O0])
  2922. AC_ARG_ENABLE(coverage,
  2923. AC_HELP_STRING([--enable-coverage],[use gcc coverage testing]), [
  2924. if test "$am_cv_CC_dependencies_compiler_type" = "gcc3"; then
  2925. ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
  2926. ac_coverage_linker="-lgcc"
  2927. elif test "$am_cv_CC_dependencies_compiler_type" = "gcc"; then
  2928. ac_coverage_compiler="-fprofile-arcs -ftest-coverage"
  2929. ac_coverage_linker=""
  2930. else
  2931. AC_MSG_ERROR([coverage with your compiler is not supported])
  2932. fi
  2933. CFLAGS="$CFLAGS $ac_coverage_compiler"
  2934. CXXFLAGS="$CXXFLAGS $ac_coverage_compiler"
  2935. LDFLAGS="$LDFLAGS $ac_coverage_linker"
  2936. ])
  2937. AC_SUBST(NOOPT_CXXFLAGS)
  2938. AC_SUBST(NOOPT_CFLAGS)
  2939. AC_SUBST(ENABLE_PERMISSIVE_FLAG)
  2940. KDE_CHECK_NEW_LDFLAGS
  2941. KDE_CHECK_FINAL
  2942. KDE_CHECK_CLOSURE
  2943. KDE_CHECK_NMCHECK
  2944. ifdef([AM_DEPENDENCIES], AC_REQUIRE([KDE_ADD_DEPENDENCIES]), [])
  2945. ])
  2946. AC_DEFUN([KDE_CHECK_VISIBILITY_GCC_BUG],
  2947. [
  2948. AC_CACHE_CHECK([for gcc -fvisibility-inlines-hidden bug], kde_cv_val_gcc_visibility_bug,
  2949. [
  2950. AC_LANG_SAVE
  2951. AC_LANG_CPLUSPLUS
  2952. safe_CXXFLAGS=$CXXFLAGS
  2953. safe_LDFLAGS=$LDFLAGS
  2954. CXXFLAGS="$CXXFLAGS -fPIC -fvisibility-inlines-hidden -O0"
  2955. LDFLAGS="$LDFLAGS -shared -fPIC"
  2956. AC_TRY_LINK(
  2957. [
  2958. /* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19664 */
  2959. #include <string>
  2960. int some_function( void ) __attribute__ ((visibility("default")));
  2961. int some_function( void )
  2962. {
  2963. std::string s("blafasel");
  2964. return 0;
  2965. }
  2966. ], [/* elvis is alive */],
  2967. kde_cv_val_gcc_visibility_bug=no, kde_cv_val_gcc_visibility_bug=yes)
  2968. CXXFLAGS=$safe_CXXFLAGS
  2969. LDFLAGS=$safe_LDFLAGS
  2970. AC_LANG_RESTORE
  2971. ]
  2972. )
  2973. if test x$kde_cv_val_gcc_visibility_bug = xno; then
  2974. CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"
  2975. fi
  2976. ]
  2977. )
  2978. AC_DEFUN([KDE_ENABLE_HIDDEN_VISIBILITY],
  2979. [
  2980. AC_BEFORE([AC_PATH_TQT_1_3], [KDE_ENABLE_HIDDEN_VISIBILITY])
  2981. AC_MSG_CHECKING([grepping for visibility push/pop in headers])
  2982. if test "x$GXX" = "xyes"; then
  2983. AC_LANG_SAVE
  2984. AC_LANG_CPLUSPLUS
  2985. AC_EGREP_CPP(
  2986. [GCC visibility push],
  2987. [ #include <exception>
  2988. ],
  2989. [
  2990. AC_MSG_RESULT(yes)
  2991. kde_stdc_visibility_patched=yes ],
  2992. [
  2993. AC_MSG_RESULT(no)
  2994. AC_MSG_WARN([Your libstdc++ doesn't appear to be patched for
  2995. visibility support. Disabling -fvisibility=hidden])
  2996. kde_stdc_visibility_patched=no ])
  2997. AC_LANG_RESTORE
  2998. kde_have_gcc_visibility=no
  2999. KDE_CHECK_COMPILER_FLAG(fvisibility=hidden,
  3000. [
  3001. kde_have_gcc_visibility=yes
  3002. dnl the whole toolchain is just a mess, gcc is just too buggy
  3003. dnl to handle STL with visibility enabled. Lets reconsider
  3004. dnl when gcc 4.2 is out or when things get fixed in the compiler.
  3005. dnl Contact mueller@kde.org for details.
  3006. AC_ARG_ENABLE(gcc-hidden-visibility,
  3007. AC_HELP_STRING([--enable-gcc-hidden-visibility],[toolchain hidden visibility [default=no]]),
  3008. [kde_have_gcc_visibility=$enableval],
  3009. [kde_have_gcc_visibility=no])
  3010. AC_CACHE_CHECK([if Qt is patched for -fvisibility], kde_cv_val_qt_gcc_visibility_patched,
  3011. [
  3012. AC_LANG_SAVE
  3013. AC_LANG_CPLUSPLUS
  3014. safe_CXXFLAGS=$CXXFLAGS
  3015. CXXFLAGS="$CXXFLAGS $all_includes"
  3016. AC_TRY_COMPILE(
  3017. [
  3018. #include <qglobal.h>
  3019. #if Q_EXPORT - 0 != 0
  3020. /* if this compiles, then Q_EXPORT is undefined */
  3021. /* if Q_EXPORT is nonempty, this will break compilation */
  3022. #endif
  3023. ], [/* elvis is alive */],
  3024. kde_cv_val_qt_gcc_visibility_patched=no, kde_cv_val_qt_gcc_visibility_patched=yes)
  3025. CXXFLAGS=$safe_CXXFLAGS
  3026. AC_LANG_RESTORE
  3027. ]
  3028. )
  3029. if test x$kde_have_gcc_visibility = "xyes" && test x$kde_stdc_visibility_patched = "xyes" && test x$kde_cv_val_qt_gcc_visibility_patched = "xyes"; then
  3030. CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
  3031. KDE_CHECK_VISIBILITY_GCC_BUG
  3032. HAVE_GCC_VISIBILITY=1
  3033. AC_DEFINE_UNQUOTED(__KDE_HAVE_GCC_VISIBILITY, "$HAVE_GCC_VISIBILITY", [define to 1 if -fvisibility is supported])
  3034. fi
  3035. ])
  3036. fi
  3037. ])
  3038. AC_DEFUN([KDE_ADD_DEPENDENCIES],
  3039. [
  3040. [A]M_DEPENDENCIES(CC)
  3041. [A]M_DEPENDENCIES(CXX)
  3042. ])
  3043. dnl just a wrapper to clean up configure.in
  3044. AC_DEFUN([KDE_PROG_LIBTOOL],
  3045. [
  3046. AC_REQUIRE([AC_CHECK_COMPILERS])
  3047. AC_REQUIRE([AC_ENABLE_SHARED])
  3048. AC_REQUIRE([AC_ENABLE_STATIC])
  3049. AC_REQUIRE([AC_LIBTOOL_DLOPEN])
  3050. AC_REQUIRE([KDE_CHECK_LIB64])
  3051. AC_OBJEXT
  3052. AC_EXEEXT
  3053. AM_PROG_LIBTOOL
  3054. AC_LIBTOOL_CXX
  3055. LIBTOOL_SHELL="/bin/sh ./libtool"
  3056. # LIBTOOL="$LIBTOOL --silent"
  3057. KDE_PLUGIN="-avoid-version -module -no-undefined \$(KDE_NO_UNDEFINED) \$(KDE_RPATH) \$(KDE_MT_LDFLAGS)"
  3058. AC_SUBST(KDE_PLUGIN)
  3059. # This hack ensures that libtool creates shared libs for tdeunittest plugins. By default check_LTLIBRARIES makes static libs.
  3060. KDE_CHECK_PLUGIN="\$(KDE_PLUGIN) -rpath \$(libdir)"
  3061. AC_SUBST(KDE_CHECK_PLUGIN)
  3062. # we patch configure quite some so we better keep that consistent for incremental runs
  3063. AC_SUBST(AUTOCONF,'$(SHELL) $(top_srcdir)/admin/cvs.sh configure || touch configure')
  3064. ])
  3065. AC_DEFUN([KDE_CHECK_LIB64],
  3066. [
  3067. AC_ARG_ENABLE(libsuffix,
  3068. AC_HELP_STRING([--enable-libsuffix],
  3069. [/lib directory suffix (64,32,none,auto[=default])]),
  3070. tdelibsuff=$enableval, tdelibsuff="auto")
  3071. if test "$tdelibsuff" = "auto"; then
  3072. cat > conftest.c << EOF
  3073. #include <stdio.h>
  3074. int main() {
  3075. return 0;
  3076. }
  3077. EOF
  3078. tdelibsuff=`$CC conftest.c -o conftest.out; ldd conftest.out |sed -ne '/libc.so/{
  3079. s,.*/lib\([[^\/]]*\)/.*,\1,
  3080. p
  3081. }'`
  3082. rm -rf conftest.*
  3083. fi
  3084. if test "$tdelibsuff" = "no" || test "$tdelibsuff" = "none"; then
  3085. tdelibsuff=
  3086. fi
  3087. if test -z "$tdelibsuff"; then
  3088. AC_MSG_RESULT([not using lib directory suffix])
  3089. AC_DEFINE(KDELIBSUFF, [""], Suffix for lib directories)
  3090. else
  3091. if test "$libdir" = '${exec_prefix}/lib'; then
  3092. libdir="$libdir${tdelibsuff}"
  3093. AC_SUBST([libdir], ["$libdir"]) dnl ugly hack for lib64 platforms
  3094. fi
  3095. AC_DEFINE_UNQUOTED(KDELIBSUFF, ["${tdelibsuff}"], Suffix for lib directories)
  3096. AC_MSG_RESULT([using lib directory suffix $tdelibsuff])
  3097. fi
  3098. ])
  3099. AC_DEFUN([KDE_CHECK_TYPES],
  3100. [ AC_CHECK_SIZEOF(int, 4)dnl
  3101. AC_CHECK_SIZEOF(short)dnl
  3102. AC_CHECK_SIZEOF(long, 4)dnl
  3103. AC_CHECK_SIZEOF(char *, 4)dnl
  3104. ])dnl
  3105. dnl Not used - kept for compat only?
  3106. AC_DEFUN([KDE_DO_IT_ALL],
  3107. [
  3108. AC_CANONICAL_SYSTEM
  3109. AC_ARG_PROGRAM
  3110. AM_INIT_AUTOMAKE($1, $2)
  3111. AM_DISABLE_LIBRARIES
  3112. AC_PREFIX_DEFAULT(${TDEDIR:-/usr/local/kde})
  3113. AC_CHECK_COMPILERS
  3114. KDE_PROG_LIBTOOL
  3115. AM_KDE_WITH_NLS
  3116. AC_PATH_KDE
  3117. ])
  3118. AC_DEFUN([AC_CHECK_RPATH],
  3119. [
  3120. AC_MSG_CHECKING(for rpath)
  3121. AC_ARG_ENABLE(rpath,
  3122. AC_HELP_STRING([--disable-rpath],[do not use the rpath feature of ld]),
  3123. USE_RPATH=$enableval, USE_RPATH=yes)
  3124. if test -z "$KDE_RPATH" && test "$USE_RPATH" = "yes"; then
  3125. KDE_RPATH="-R \$(libdir)"
  3126. if test "$kde_libraries" != "$libdir"; then
  3127. KDE_RPATH="$KDE_RPATH -R \$(kde_libraries)"
  3128. fi
  3129. if test -n "$qt_libraries"; then
  3130. KDE_RPATH="$KDE_RPATH -R \$(qt_libraries)"
  3131. fi
  3132. dnl $x_libraries is set to /usr/lib in case
  3133. if test -n "$X_LDFLAGS"; then
  3134. X_RPATH="-R \$(x_libraries)"
  3135. KDE_RPATH="$KDE_RPATH $X_RPATH"
  3136. fi
  3137. if test -n "$KDE_EXTRA_RPATH"; then
  3138. KDE_RPATH="$KDE_RPATH \$(KDE_EXTRA_RPATH)"
  3139. fi
  3140. fi
  3141. AC_SUBST(KDE_EXTRA_RPATH)
  3142. AC_SUBST(KDE_RPATH)
  3143. AC_SUBST(X_RPATH)
  3144. AC_MSG_RESULT($USE_RPATH)
  3145. ])
  3146. dnl Check for the type of the third argument of getsockname
  3147. AC_DEFUN([AC_CHECK_SOCKLEN_T],
  3148. [
  3149. AC_MSG_CHECKING(for socklen_t)
  3150. AC_CACHE_VAL(kde_cv_socklen_t,
  3151. [
  3152. AC_LANG_PUSH(C++)
  3153. kde_cv_socklen_t=no
  3154. AC_TRY_COMPILE([
  3155. #include <sys/types.h>
  3156. #include <sys/socket.h>
  3157. ],
  3158. [
  3159. socklen_t len;
  3160. getpeername(0,0,&len);
  3161. ],
  3162. [
  3163. kde_cv_socklen_t=yes
  3164. kde_cv_socklen_t_equiv=socklen_t
  3165. ])
  3166. AC_LANG_POP(C++)
  3167. ])
  3168. AC_MSG_RESULT($kde_cv_socklen_t)
  3169. if test $kde_cv_socklen_t = no; then
  3170. AC_MSG_CHECKING([for socklen_t equivalent for socket functions])
  3171. AC_CACHE_VAL(kde_cv_socklen_t_equiv,
  3172. [
  3173. kde_cv_socklen_t_equiv=int
  3174. AC_LANG_PUSH(C++)
  3175. for t in int size_t unsigned long "unsigned long"; do
  3176. AC_TRY_COMPILE([
  3177. #include <sys/types.h>
  3178. #include <sys/socket.h>
  3179. ],
  3180. [
  3181. $t len;
  3182. getpeername(0,0,&len);
  3183. ],
  3184. [
  3185. kde_cv_socklen_t_equiv="$t"
  3186. break
  3187. ])
  3188. done
  3189. AC_LANG_POP(C++)
  3190. ])
  3191. AC_MSG_RESULT($kde_cv_socklen_t_equiv)
  3192. fi
  3193. AC_DEFINE_UNQUOTED(kde_socklen_t, $kde_cv_socklen_t_equiv,
  3194. [type to use in place of socklen_t if not defined])
  3195. AC_DEFINE_UNQUOTED(ksize_t, $kde_cv_socklen_t_equiv,
  3196. [type to use in place of socklen_t if not defined (deprecated, use kde_socklen_t)])
  3197. ])
  3198. dnl This is a merge of some macros out of the gettext aclocal.m4
  3199. dnl since we don't need anything, I took the things we need
  3200. dnl the copyright for them is:
  3201. dnl >
  3202. dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
  3203. dnl This Makefile.in is free software; the Free Software Foundation
  3204. dnl gives unlimited permission to copy and/or distribute it,
  3205. dnl with or without modifications, as long as this notice is preserved.
  3206. dnl This program is distributed in the hope that it will be useful,
  3207. dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
  3208. dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  3209. dnl PARTICULAR PURPOSE.
  3210. dnl >
  3211. dnl for this file it is relicensed under LGPL
  3212. AC_DEFUN([AM_KDE_WITH_NLS],
  3213. [
  3214. dnl If we use NLS figure out what method
  3215. AM_PATH_PROG_WITH_TEST_KDE(MSGFMT, msgfmt,
  3216. [test -n "`$ac_dir/$ac_word --version 2>&1 | grep 'GNU gettext'`"], msgfmt)
  3217. AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
  3218. if test -z "`$GMSGFMT --version 2>&1 | grep 'GNU gettext'`"; then
  3219. AC_MSG_RESULT([found msgfmt program is not GNU msgfmt; ignore it])
  3220. GMSGFMT=":"
  3221. fi
  3222. MSGFMT=$GMSGFMT
  3223. AC_SUBST(GMSGFMT)
  3224. AC_SUBST(MSGFMT)
  3225. AM_PATH_PROG_WITH_TEST_KDE(XGETTEXT, xgettext,
  3226. [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
  3227. dnl Test whether we really found GNU xgettext.
  3228. if test "$XGETTEXT" != ":"; then
  3229. dnl If it is no GNU xgettext we define it as : so that the
  3230. dnl Makefiles still can work.
  3231. if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
  3232. : ;
  3233. else
  3234. AC_MSG_RESULT(
  3235. [found xgettext programs is not GNU xgettext; ignore it])
  3236. XGETTEXT=":"
  3237. fi
  3238. fi
  3239. AC_SUBST(XGETTEXT)
  3240. ])
  3241. # Search path for a program which passes the given test.
  3242. # Ulrich Drepper <drepper@cygnus.com>, 1996.
  3243. # serial 1
  3244. # Stephan Kulow: I appended a _KDE against name conflicts
  3245. dnl AM_PATH_PROG_WITH_TEST_KDE(VARIABLE, PROG-TO-CHECK-FOR,
  3246. dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
  3247. AC_DEFUN([AM_PATH_PROG_WITH_TEST_KDE],
  3248. [# Extract the first word of "$2", so it can be a program name with args.
  3249. set dummy $2; ac_word=[$]2
  3250. AC_MSG_CHECKING([for $ac_word])
  3251. AC_CACHE_VAL(ac_cv_path_$1,
  3252. [case "[$]$1" in
  3253. /*)
  3254. ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
  3255. ;;
  3256. *)
  3257. IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
  3258. for ac_dir in ifelse([$5], , $PATH, [$5]); do
  3259. test -z "$ac_dir" && ac_dir=.
  3260. if test -f $ac_dir/$ac_word; then
  3261. if [$3]; then
  3262. ac_cv_path_$1="$ac_dir/$ac_word"
  3263. break
  3264. fi
  3265. fi
  3266. done
  3267. IFS="$ac_save_ifs"
  3268. dnl If no 4th arg is given, leave the cache variable unset,
  3269. dnl so AC_PATH_PROGS will keep looking.
  3270. ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
  3271. ])dnl
  3272. ;;
  3273. esac])dnl
  3274. $1="$ac_cv_path_$1"
  3275. if test -n "[$]$1"; then
  3276. AC_MSG_RESULT([$]$1)
  3277. else
  3278. AC_MSG_RESULT(no)
  3279. fi
  3280. AC_SUBST($1)dnl
  3281. ])
  3282. # Check whether LC_MESSAGES is available in <locale.h>.
  3283. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  3284. # serial 1
  3285. AC_DEFUN([AM_LC_MESSAGES],
  3286. [if test $ac_cv_header_locale_h = yes; then
  3287. AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
  3288. [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
  3289. am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
  3290. if test $am_cv_val_LC_MESSAGES = yes; then
  3291. AC_DEFINE(HAVE_LC_MESSAGES, 1, [Define if your locale.h file contains LC_MESSAGES])
  3292. fi
  3293. fi])
  3294. dnl From Jim Meyering.
  3295. dnl FIXME: migrate into libit.
  3296. AC_DEFUN([AM_FUNC_OBSTACK],
  3297. [AC_CACHE_CHECK([for obstacks], am_cv_func_obstack,
  3298. [AC_TRY_LINK([#include "obstack.h"],
  3299. [struct obstack *mem;obstack_free(mem,(char *) 0)],
  3300. am_cv_func_obstack=yes,
  3301. am_cv_func_obstack=no)])
  3302. if test $am_cv_func_obstack = yes; then
  3303. AC_DEFINE(HAVE_OBSTACK)
  3304. else
  3305. LIBOBJS="$LIBOBJS obstack.o"
  3306. fi
  3307. ])
  3308. dnl From Jim Meyering. Use this if you use the GNU error.[ch].
  3309. dnl FIXME: Migrate into libit
  3310. AC_DEFUN([AM_FUNC_ERROR_AT_LINE],
  3311. [AC_CACHE_CHECK([for error_at_line], am_cv_lib_error_at_line,
  3312. [AC_TRY_LINK([],[error_at_line(0, 0, "", 0, "");],
  3313. am_cv_lib_error_at_line=yes,
  3314. am_cv_lib_error_at_line=no)])
  3315. if test $am_cv_lib_error_at_line = no; then
  3316. LIBOBJS="$LIBOBJS error.o"
  3317. fi
  3318. AC_SUBST(LIBOBJS)dnl
  3319. ])
  3320. # Macro to add for using GNU gettext.
  3321. # Ulrich Drepper <drepper@cygnus.com>, 1995.
  3322. # serial 1
  3323. # Stephan Kulow: I put a KDE in it to avoid name conflicts
  3324. AC_DEFUN([AM_KDE_GNU_GETTEXT],
  3325. [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
  3326. AC_REQUIRE([AC_PROG_RANLIB])dnl
  3327. AC_REQUIRE([AC_HEADER_STDC])dnl
  3328. AC_REQUIRE([AC_TYPE_OFF_T])dnl
  3329. AC_REQUIRE([AC_TYPE_SIZE_T])dnl
  3330. AC_REQUIRE([AC_FUNC_ALLOCA])dnl
  3331. AC_REQUIRE([AC_FUNC_MMAP])dnl
  3332. AC_REQUIRE([AM_KDE_WITH_NLS])dnl
  3333. AC_CHECK_HEADERS([limits.h locale.h nl_types.h string.h values.h alloca.h])
  3334. AC_CHECK_FUNCS([getcwd munmap putenv setlocale strchr strcasecmp \
  3335. __argz_count __argz_stringify __argz_next])
  3336. AC_MSG_CHECKING(for stpcpy)
  3337. AC_CACHE_VAL(kde_cv_func_stpcpy,
  3338. [
  3339. kde_safe_cxxflags=$CXXFLAGS
  3340. CXXFLAGS="-Werror"
  3341. AC_LANG_SAVE
  3342. AC_LANG_CPLUSPLUS
  3343. AC_TRY_COMPILE([
  3344. #include <string.h>
  3345. ],
  3346. [
  3347. char buffer[200];
  3348. stpcpy(buffer, buffer);
  3349. ],
  3350. kde_cv_func_stpcpy=yes,
  3351. kde_cv_func_stpcpy=no)
  3352. AC_LANG_RESTORE
  3353. CXXFLAGS=$kde_safe_cxxflags
  3354. ])
  3355. AC_MSG_RESULT($kde_cv_func_stpcpy)
  3356. if eval "test \"`echo $kde_cv_func_stpcpy`\" = yes"; then
  3357. AC_DEFINE(HAVE_STPCPY, 1, [Define if you have stpcpy])
  3358. fi
  3359. AM_LC_MESSAGES
  3360. if test "x$CATOBJEXT" != "x"; then
  3361. if test "x$ALL_LINGUAS" = "x"; then
  3362. LINGUAS=
  3363. else
  3364. AC_MSG_CHECKING(for catalogs to be installed)
  3365. NEW_LINGUAS=
  3366. for lang in ${LINGUAS=$ALL_LINGUAS}; do
  3367. case "$ALL_LINGUAS" in
  3368. *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
  3369. esac
  3370. done
  3371. LINGUAS=$NEW_LINGUAS
  3372. AC_MSG_RESULT($LINGUAS)
  3373. fi
  3374. dnl Construct list of names of catalog files to be constructed.
  3375. if test -n "$LINGUAS"; then
  3376. for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
  3377. fi
  3378. fi
  3379. ])
  3380. AC_DEFUN([AC_HAVE_XPM],
  3381. [AC_REQUIRE_CPP()dnl
  3382. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3383. test -z "$XPM_LDFLAGS" && XPM_LDFLAGS=
  3384. test -z "$XPM_INCLUDE" && XPM_INCLUDE=
  3385. AC_ARG_WITH(xpm,AC_HELP_STRING([--without-xpm],[disable color pixmap XPM tests]),
  3386. xpm_test=$withval, xpm_test="yes")
  3387. if test "x$xpm_test" = xno; then
  3388. ac_cv_have_xpm=no
  3389. else
  3390. AC_MSG_CHECKING(for XPM)
  3391. AC_CACHE_VAL(ac_cv_have_xpm,
  3392. [
  3393. ac_save_ldflags="$LDFLAGS"
  3394. ac_save_cflags="$CFLAGS"
  3395. if test "x$kde_use_qt_emb" != "xyes" && test "x$kde_use_qt_mac" != "xyes"; then
  3396. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm -lX11 -lXext $LIBZ $LIBSOCKET"
  3397. else
  3398. LDFLAGS="$LDFLAGS $X_LDFLAGS $USER_LDFLAGS $LDFLAGS $XPM_LDFLAGS $all_libraries -lXpm $LIBZ $LIBSOCKET"
  3399. fi
  3400. CFLAGS="$CFLAGS $X_INCLUDES $USER_INCLUDES"
  3401. test -n "$XPM_INCLUDE" && CFLAGS="-I$XPM_INCLUDE $CFLAGS"
  3402. AC_TRY_LINK([#include <X11/xpm.h>],[],
  3403. ac_cv_have_xpm="yes",ac_cv_have_xpm="no")
  3404. LDFLAGS="$ac_save_ldflags"
  3405. CFLAGS="$ac_save_cflags"
  3406. ])dnl
  3407. if test "$ac_cv_have_xpm" = no; then
  3408. AC_MSG_RESULT(no)
  3409. XPM_LDFLAGS=""
  3410. XPMINC=""
  3411. $2
  3412. else
  3413. AC_DEFINE(HAVE_XPM, 1, [Define if you have XPM support])
  3414. if test "$XPM_LDFLAGS" = ""; then
  3415. XPMLIB='-lXpm $(LIB_X11)'
  3416. else
  3417. XPMLIB="-L$XPM_LDFLAGS -lXpm "'$(LIB_X11)'
  3418. fi
  3419. if test "$XPM_INCLUDE" = ""; then
  3420. XPMINC=""
  3421. else
  3422. XPMINC="-I$XPM_INCLUDE"
  3423. fi
  3424. AC_MSG_RESULT(yes)
  3425. $1
  3426. fi
  3427. fi
  3428. AC_SUBST(XPMINC)
  3429. AC_SUBST(XPMLIB)
  3430. ])
  3431. AC_DEFUN([AC_HAVE_DPMS],
  3432. [AC_REQUIRE_CPP()dnl
  3433. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3434. test -z "$DPMS_LDFLAGS" && DPMS_LDFLAGS=
  3435. test -z "$DPMS_INCLUDE" && DPMS_INCLUDE=
  3436. DPMS_LIB=
  3437. AC_ARG_WITH(dpms,AC_HELP_STRING([--without-dpms],[disable DPMS power saving]),
  3438. dpms_test=$withval, dpms_test="yes")
  3439. if test "x$dpms_test" = xno; then
  3440. ac_cv_have_dpms=no
  3441. else
  3442. AC_MSG_CHECKING(for DPMS)
  3443. dnl Note: ac_cv_have_dpms can be no, yes, or -lXdpms.
  3444. dnl 'yes' means DPMS_LIB="", '-lXdpms' means DPMS_LIB="-lXdpms".
  3445. AC_CACHE_VAL(ac_cv_have_dpms,
  3446. [
  3447. if test "x$kde_use_qt_emb" = "xyes" || test "x$kde_use_qt_mac" = "xyes"; then
  3448. AC_MSG_RESULT(no)
  3449. ac_cv_have_dpms="no"
  3450. else
  3451. ac_save_ldflags="$LDFLAGS"
  3452. ac_save_cflags="$CFLAGS"
  3453. ac_save_libs="$LIBS"
  3454. LDFLAGS="$LDFLAGS $DPMS_LDFLAGS $all_libraries"
  3455. LIBS="-lX11 -lXext $LIBSOCKET"
  3456. CFLAGS="$CFLAGS $X_INCLUDES"
  3457. test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  3458. AC_TRY_LINK([
  3459. #include <X11/Xproto.h>
  3460. #include <X11/X.h>
  3461. #include <X11/Xlib.h>
  3462. #include <X11/extensions/dpms.h>
  3463. int foo_test_dpms()
  3464. { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  3465. ac_cv_have_dpms="yes", [
  3466. LIBS="-lXdpms $LIBS"
  3467. AC_TRY_LINK([
  3468. #include <X11/Xproto.h>
  3469. #include <X11/X.h>
  3470. #include <X11/Xlib.h>
  3471. #include <X11/extensions/dpms.h>
  3472. int foo_test_dpms()
  3473. { return DPMSSetTimeouts( 0, 0, 0, 0 ); }],[],
  3474. [
  3475. ac_cv_have_dpms="-lXdpms"
  3476. ],ac_cv_have_dpms="no")
  3477. ])
  3478. LDFLAGS="$ac_save_ldflags"
  3479. CFLAGS="$ac_save_cflags"
  3480. LIBS="$ac_save_libs"
  3481. fi
  3482. ])dnl
  3483. if test "$ac_cv_have_dpms" = no; then
  3484. AC_MSG_RESULT(no)
  3485. DPMS_LDFLAGS=""
  3486. DPMSINC=""
  3487. $2
  3488. else
  3489. AC_DEFINE(HAVE_DPMS, 1, [Define if you have DPMS support])
  3490. if test "$ac_cv_have_dpms" = "-lXdpms"; then
  3491. DPMS_LIB="-lXdpms"
  3492. fi
  3493. if test "$DPMS_LDFLAGS" = ""; then
  3494. DPMSLIB="$DPMS_LIB "'$(LIB_X11)'
  3495. else
  3496. DPMSLIB="$DPMS_LDFLAGS $DPMS_LIB "'$(LIB_X11)'
  3497. fi
  3498. if test "$DPMS_INCLUDE" = ""; then
  3499. DPMSINC=""
  3500. else
  3501. DPMSINC="-I$DPMS_INCLUDE"
  3502. fi
  3503. AC_MSG_RESULT(yes)
  3504. $1
  3505. fi
  3506. fi
  3507. ac_save_cflags="$CFLAGS"
  3508. CFLAGS="$CFLAGS $X_INCLUDES"
  3509. test -n "$DPMS_INCLUDE" && CFLAGS="-I$DPMS_INCLUDE $CFLAGS"
  3510. AH_TEMPLATE(HAVE_DPMSCAPABLE_PROTO,
  3511. [Define if you have the DPMSCapable prototype in <X11/extensions/dpms.h>])
  3512. AC_CHECK_DECL(DPMSCapable,
  3513. AC_DEFINE(HAVE_DPMSCAPABLE_PROTO),,
  3514. [#include <X11/Xlib.h>
  3515. #include <X11/extensions/dpms.h>])
  3516. AH_TEMPLATE(HAVE_DPMSINFO_PROTO,
  3517. [Define if you have the DPMSInfo prototype in <X11/extensions/dpms.h>])
  3518. AC_CHECK_DECL(DPMSInfo,
  3519. AC_DEFINE(HAVE_DPMSINFO_PROTO),,
  3520. [#include <X11/Xlib.h>
  3521. #include <X11/extensions/dpms.h>])
  3522. CFLAGS="$ac_save_cflags"
  3523. AC_SUBST(DPMSINC)
  3524. AC_SUBST(DPMSLIB)
  3525. ])
  3526. AC_DEFUN([AC_HAVE_GL],
  3527. [AC_REQUIRE_CPP()dnl
  3528. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  3529. test -z "$GL_LDFLAGS" && GL_LDFLAGS=
  3530. test -z "$GL_INCLUDE" && GL_INCLUDE=
  3531. AC_ARG_WITH(gl,AC_HELP_STRING([--without-gl],[disable 3D GL modes]),
  3532. gl_test=$withval, gl_test="yes")
  3533. if test "x$kde_use_qt_emb" = "xyes"; then
  3534. # GL and Qt Embedded is a no-go for now.
  3535. ac_cv_have_gl=no
  3536. elif test "x$gl_test" = xno; then
  3537. ac_cv_have_gl=no
  3538. else
  3539. AC_MSG_CHECKING(for GL)
  3540. AC_CACHE_VAL(ac_cv_have_gl,
  3541. [
  3542. AC_LANG_SAVE
  3543. AC_LANG_CPLUSPLUS
  3544. ac_save_ldflags=$LDFLAGS
  3545. ac_save_cxxflags=$CXXFLAGS
  3546. ac_save_libs=$LIBS
  3547. LDFLAGS="$LDFLAGS $GL_LDFLAGS $X_LDFLAGS $all_libraries"
  3548. LIBS="$LIBS -lGL -lGLU"
  3549. test "x$kde_use_qt_mac" != xyes && test "x$kde_use_qt_emb" != xyes && LIBS="$LIBS -lX11"
  3550. LIBS="$LIBS $LIB_XEXT -lm $LIBSOCKET"
  3551. CXXFLAGS="$CFLAGS $X_INCLUDES"
  3552. test -n "$GL_INCLUDE" && CFLAGS="-I$GL_INCLUDE $CFLAGS"
  3553. AC_TRY_LINK([#include <GL/gl.h>
  3554. #include <GL/glu.h>
  3555. ], [],
  3556. ac_cv_have_gl="yes", ac_cv_have_gl="no")
  3557. AC_LANG_RESTORE
  3558. LDFLAGS=$ac_save_ldflags
  3559. CXXFLAGS=$ac_save_cxxflags
  3560. LIBS=$ac_save_libs
  3561. ])dnl
  3562. if test "$ac_cv_have_gl" = "no"; then
  3563. AC_MSG_RESULT(no)
  3564. GL_LDFLAGS=""
  3565. GLINC=""
  3566. $2
  3567. else
  3568. AC_DEFINE(HAVE_GL, 1, [Defines if you have GL (Mesa, OpenGL, ...)])
  3569. if test "$GL_LDFLAGS" = ""; then
  3570. GLLIB='-lGLU -lGL $(LIB_X11)'
  3571. else
  3572. GLLIB="$GL_LDFLAGS -lGLU -lGL "'$(LIB_X11)'
  3573. fi
  3574. if test "$GL_INCLUDE" = ""; then
  3575. GLINC=""
  3576. else
  3577. GLINC="-I$GL_INCLUDE"
  3578. fi
  3579. AC_MSG_RESULT($ac_cv_have_gl)
  3580. $1
  3581. fi
  3582. fi
  3583. AC_SUBST(GLINC)
  3584. AC_SUBST(GLLIB)
  3585. ])
  3586. dnl shadow password and PAM magic - maintained by ossi@kde.org
  3587. AC_DEFUN([KDE_PAM], [
  3588. AC_REQUIRE([KDE_CHECK_LIBDL])
  3589. want_pam=
  3590. AC_ARG_WITH(pam,
  3591. AC_HELP_STRING([--with-pam[=ARG]],[enable support for PAM: ARG=[yes|no|service name]]),
  3592. [ if test "x$withval" = "xyes"; then
  3593. want_pam=yes
  3594. pam_service=kde
  3595. elif test "x$withval" = "xno"; then
  3596. want_pam=no
  3597. else
  3598. want_pam=yes
  3599. pam_service=$withval
  3600. fi
  3601. ], [ pam_service=kde ])
  3602. use_pam=
  3603. PAMLIBS=
  3604. if test "x$want_pam" != xno; then
  3605. AC_CHECK_LIB(pam, pam_start, [
  3606. AC_CHECK_HEADER(security/pam_appl.h,
  3607. [ pam_header=security/pam_appl.h ],
  3608. [ AC_CHECK_HEADER(pam/pam_appl.h,
  3609. [ pam_header=pam/pam_appl.h ],
  3610. [
  3611. AC_MSG_WARN([PAM detected, but no headers found!
  3612. Make sure you have the necessary development packages installed.])
  3613. ]
  3614. )
  3615. ]
  3616. )
  3617. ], , $LIBDL)
  3618. if test -z "$pam_header"; then
  3619. if test "x$want_pam" = xyes; then
  3620. AC_MSG_ERROR([--with-pam was specified, but cannot compile with PAM!])
  3621. fi
  3622. else
  3623. AC_DEFINE(HAVE_PAM, 1, [Defines if you have PAM (Pluggable Authentication Modules)])
  3624. PAMLIBS="$PAM_MISC_LIB -lpam $LIBDL"
  3625. use_pam=yes
  3626. dnl darwin claims to be something special
  3627. if test "$pam_header" = "pam/pam_appl.h"; then
  3628. AC_DEFINE(HAVE_PAM_PAM_APPL_H, 1, [Define if your PAM headers are in pam/ instead of security/])
  3629. fi
  3630. dnl test whether struct pam_message is const (Linux) or not (Sun)
  3631. AC_MSG_CHECKING(for const pam_message)
  3632. AC_EGREP_HEADER([struct pam_message], $pam_header,
  3633. [ AC_EGREP_HEADER([const struct pam_message], $pam_header,
  3634. [AC_MSG_RESULT([const: Linux-type PAM])],
  3635. [AC_MSG_RESULT([nonconst: Sun-type PAM])
  3636. AC_DEFINE(PAM_MESSAGE_NONCONST, 1, [Define if your PAM support takes non-const arguments (Solaris)])]
  3637. )],
  3638. [AC_MSG_RESULT([not found - assume const, Linux-type PAM])])
  3639. fi
  3640. fi
  3641. AC_SUBST(PAMLIBS)
  3642. ])
  3643. dnl DEF_PAM_SERVICE(arg name, full name, define name)
  3644. AC_DEFUN([DEF_PAM_SERVICE], [
  3645. AC_ARG_WITH($1-pam,
  3646. AC_HELP_STRING([--with-$1-pam=[val]],[override PAM service from --with-pam for $2]),
  3647. [ if test "x$use_pam" = xyes; then
  3648. $3_PAM_SERVICE=$withval
  3649. else
  3650. AC_MSG_ERROR([Cannot use use --with-$1-pam, as no PAM was detected.
  3651. You may want to enforce it by using --with-pam.])
  3652. fi
  3653. ],
  3654. [ if test "x$use_pam" = xyes; then
  3655. $3_PAM_SERVICE="$pam_service"
  3656. fi
  3657. ])
  3658. if test -n "$$3_PAM_SERVICE"; then
  3659. AC_MSG_RESULT([The PAM service used by $2 will be $$3_PAM_SERVICE])
  3660. AC_DEFINE_UNQUOTED($3_PAM_SERVICE, "$$3_PAM_SERVICE", [The PAM service to be used by $2])
  3661. fi
  3662. AC_SUBST($3_PAM_SERVICE)
  3663. ])
  3664. AC_DEFUN([KDE_SHADOWPASSWD], [
  3665. AC_REQUIRE([KDE_PAM])
  3666. AC_CHECK_LIB(shadow, getspent,
  3667. [ LIBSHADOW="-lshadow"
  3668. ac_use_shadow=yes
  3669. ],
  3670. [ dnl for UnixWare
  3671. AC_CHECK_LIB(gen, getspent,
  3672. [ LIBGEN="-lgen"
  3673. ac_use_shadow=yes
  3674. ],
  3675. [ AC_CHECK_FUNC(getspent,
  3676. [ ac_use_shadow=yes ],
  3677. [ ac_use_shadow=no ])
  3678. ])
  3679. ])
  3680. AC_SUBST(LIBSHADOW)
  3681. AC_SUBST(LIBGEN)
  3682. AC_MSG_CHECKING([for shadow passwords])
  3683. AC_ARG_WITH(shadow,
  3684. AC_HELP_STRING([--with-shadow],[If you want shadow password support]),
  3685. [ if test "x$withval" != "xno"; then
  3686. use_shadow=yes
  3687. else
  3688. use_shadow=no
  3689. fi
  3690. ], [
  3691. use_shadow="$ac_use_shadow"
  3692. ])
  3693. if test "x$use_shadow" = xyes; then
  3694. AC_MSG_RESULT(yes)
  3695. AC_DEFINE(HAVE_SHADOW, 1, [Define if you use shadow passwords])
  3696. else
  3697. AC_MSG_RESULT(no)
  3698. LIBSHADOW=
  3699. LIBGEN=
  3700. fi
  3701. dnl finally make the relevant binaries setuid root, if we have shadow passwds.
  3702. dnl this still applies, if we could use it indirectly through pam.
  3703. if test "x$use_shadow" = xyes ||
  3704. ( test "x$use_pam" = xyes && test "x$ac_use_shadow" = xyes ); then
  3705. case $host in
  3706. *-*-freebsd* | *-*-netbsd* | *-*-openbsd*)
  3707. SETUIDFLAGS="-m 4755 -o root";;
  3708. *)
  3709. SETUIDFLAGS="-m 4755";;
  3710. esac
  3711. fi
  3712. AC_SUBST(SETUIDFLAGS)
  3713. ])
  3714. AC_DEFUN([KDE_PASSWDLIBS], [
  3715. AC_REQUIRE([KDE_MISC_TESTS]) dnl for LIBCRYPT
  3716. AC_REQUIRE([KDE_PAM])
  3717. AC_REQUIRE([KDE_SHADOWPASSWD])
  3718. if test "x$use_pam" = "xyes"; then
  3719. PASSWDLIBS="$PAMLIBS"
  3720. else
  3721. PASSWDLIBS="$LIBCRYPT $LIBSHADOW $LIBGEN"
  3722. fi
  3723. dnl FreeBSD uses a shadow-like setup, where /etc/passwd holds the users, but
  3724. dnl /etc/master.passwd holds the actual passwords. /etc/master.passwd requires
  3725. dnl root to read, so kcheckpass needs to be root (even when using pam, since pam
  3726. dnl may need to read /etc/master.passwd).
  3727. case $host in
  3728. *-*-freebsd*)
  3729. SETUIDFLAGS="-m 4755 -o root"
  3730. ;;
  3731. *)
  3732. ;;
  3733. esac
  3734. AC_SUBST(PASSWDLIBS)
  3735. ])
  3736. AC_DEFUN([KDE_CHECK_LIBDL],
  3737. [
  3738. AC_CHECK_LIB(dl, dlopen, [
  3739. LIBDL="-ldl"
  3740. ac_cv_have_dlfcn=yes
  3741. ])
  3742. AC_CHECK_LIB(dld, shl_unload, [
  3743. LIBDL="-ldld"
  3744. ac_cv_have_shload=yes
  3745. ])
  3746. AC_SUBST(LIBDL)
  3747. ])
  3748. AC_DEFUN([KDE_CHECK_DLOPEN],
  3749. [
  3750. KDE_CHECK_LIBDL
  3751. AC_CHECK_HEADERS(dlfcn.h dl.h)
  3752. if test "$ac_cv_header_dlfcn_h" = "no"; then
  3753. ac_cv_have_dlfcn=no
  3754. fi
  3755. if test "$ac_cv_header_dl_h" = "no"; then
  3756. ac_cv_have_shload=no
  3757. fi
  3758. dnl XXX why change enable_dlopen? its already set by autoconf's AC_ARG_ENABLE
  3759. dnl (MM)
  3760. AC_ARG_ENABLE(dlopen,
  3761. AC_HELP_STRING([--disable-dlopen],[link statically [default=no]]),
  3762. enable_dlopen=$enableval,
  3763. enable_dlopen=yes)
  3764. # override the user's opinion, if we know it better ;)
  3765. if test "$ac_cv_have_dlfcn" = "no" && test "$ac_cv_have_shload" = "no"; then
  3766. enable_dlopen=no
  3767. fi
  3768. if test "$ac_cv_have_dlfcn" = "yes"; then
  3769. AC_DEFINE_UNQUOTED(HAVE_DLFCN, 1, [Define if you have dlfcn])
  3770. fi
  3771. if test "$ac_cv_have_shload" = "yes"; then
  3772. AC_DEFINE_UNQUOTED(HAVE_SHLOAD, 1, [Define if you have shload])
  3773. fi
  3774. if test "$enable_dlopen" = no ; then
  3775. test -n "$1" && eval $1
  3776. else
  3777. test -n "$2" && eval $2
  3778. fi
  3779. ])
  3780. AC_DEFUN([KDE_CHECK_DYNAMIC_LOADING],
  3781. [
  3782. KDE_CHECK_DLOPEN(libtool_enable_shared=yes, libtool_enable_static=no)
  3783. KDE_PROG_LIBTOOL
  3784. AC_MSG_CHECKING([dynamic loading])
  3785. eval "`egrep '^build_libtool_libs=' libtool`"
  3786. if test "$build_libtool_libs" = "yes" && test "$enable_dlopen" = "yes"; then
  3787. dynamic_loading=yes
  3788. AC_DEFINE_UNQUOTED(HAVE_DYNAMIC_LOADING)
  3789. else
  3790. dynamic_loading=no
  3791. fi
  3792. AC_MSG_RESULT($dynamic_loading)
  3793. if test "$dynamic_loading" = "yes"; then
  3794. $1
  3795. else
  3796. $2
  3797. fi
  3798. ])
  3799. AC_DEFUN([KDE_ADD_INCLUDES],
  3800. [
  3801. if test -z "$1"; then
  3802. test_include="Pix.h"
  3803. else
  3804. test_include="$1"
  3805. fi
  3806. AC_MSG_CHECKING([for libg++ ($test_include)])
  3807. AC_CACHE_VAL(kde_cv_libgpp_includes,
  3808. [
  3809. kde_cv_libgpp_includes=no
  3810. for ac_dir in \
  3811. \
  3812. /usr/include/g++ \
  3813. /usr/include \
  3814. /usr/unsupported/include \
  3815. /opt/include \
  3816. $extra_include \
  3817. ; \
  3818. do
  3819. if test -r "$ac_dir/$test_include"; then
  3820. kde_cv_libgpp_includes=$ac_dir
  3821. break
  3822. fi
  3823. done
  3824. ])
  3825. AC_MSG_RESULT($kde_cv_libgpp_includes)
  3826. if test "$kde_cv_libgpp_includes" != "no"; then
  3827. all_includes="-I$kde_cv_libgpp_includes $all_includes $USER_INCLUDES"
  3828. fi
  3829. ])
  3830. ])
  3831. AC_DEFUN([KDE_CHECK_LIBPTHREAD],
  3832. [
  3833. dnl This code is here specifically to handle the
  3834. dnl various flavors of threading library on FreeBSD
  3835. dnl 4-, 5-, and 6-, and the (weird) rules around it.
  3836. dnl There may be an environment PTHREAD_LIBS that
  3837. dnl specifies what to use; otherwise, search for it.
  3838. dnl -pthread is special cased and unsets LIBPTHREAD
  3839. dnl below if found.
  3840. LIBPTHREAD=""
  3841. if test -n "$PTHREAD_LIBS"; then
  3842. if test "x$PTHREAD_LIBS" = "x-pthread" ; then
  3843. LIBPTHREAD="PTHREAD"
  3844. else
  3845. PTHREAD_LIBS_save="$PTHREAD_LIBS"
  3846. PTHREAD_LIBS=`echo "$PTHREAD_LIBS_save" | sed -e 's,^-l,,g'`
  3847. AC_MSG_CHECKING([for pthread_create in $PTHREAD_LIBS])
  3848. KDE_CHECK_LIB($PTHREAD_LIBS, pthread_create, [
  3849. LIBPTHREAD="$PTHREAD_LIBS_save"])
  3850. PTHREAD_LIBS="$PTHREAD_LIBS_save"
  3851. fi
  3852. fi
  3853. dnl Is this test really needed, in the face of the Tru64 test below?
  3854. if test -z "$LIBPTHREAD"; then
  3855. AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"])
  3856. fi
  3857. dnl This is a special Tru64 check, see BR 76171 issue #18.
  3858. if test -z "$LIBPTHREAD" ; then
  3859. AC_MSG_CHECKING([for pthread_create in -lpthread])
  3860. kde_safe_libs=$LIBS
  3861. LIBS="$LIBS -lpthread"
  3862. AC_TRY_LINK([#include <pthread.h>],[(void)pthread_create(0,0,0,0);],[
  3863. AC_MSG_RESULT(yes)
  3864. LIBPTHREAD="-lpthread"],[
  3865. AC_MSG_RESULT(no)])
  3866. LIBS=$kde_safe_libs
  3867. fi
  3868. dnl Un-special-case for FreeBSD.
  3869. if test "x$LIBPTHREAD" = "xPTHREAD" ; then
  3870. LIBPTHREAD=""
  3871. fi
  3872. AC_SUBST(LIBPTHREAD)
  3873. ])
  3874. AC_DEFUN([KDE_CHECK_PTHREAD_OPTION],
  3875. [
  3876. USE_THREADS=""
  3877. if test -z "$LIBPTHREAD"; then
  3878. KDE_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-D_THREAD_SAFE -pthread"])
  3879. fi
  3880. AH_VERBATIM(__svr_define, [
  3881. #if defined(__SVR4) && !defined(__svr4__)
  3882. #define __svr4__ 1
  3883. #endif
  3884. ])
  3885. case $host_os in
  3886. solaris*)
  3887. KDE_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
  3888. CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
  3889. ;;
  3890. freebsd*)
  3891. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE $PTHREAD_CFLAGS"
  3892. ;;
  3893. aix*)
  3894. CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
  3895. LIBPTHREAD="$LIBPTHREAD -lc_r"
  3896. ;;
  3897. linux*) CPPFLAGS="$CPPFLAGS -D_REENTRANT"
  3898. if test "$CXX" = "KCC"; then
  3899. CXXFLAGS="$CXXFLAGS --thread_safe"
  3900. NOOPT_CXXFLAGS="$NOOPT_CXXFLAGS --thread_safe"
  3901. fi
  3902. ;;
  3903. *)
  3904. ;;
  3905. esac
  3906. AC_SUBST(USE_THREADS)
  3907. AC_SUBST(LIBPTHREAD)
  3908. ])
  3909. AC_DEFUN([KDE_CHECK_THREADING],
  3910. [
  3911. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  3912. AC_REQUIRE([KDE_CHECK_PTHREAD_OPTION])
  3913. dnl default is yes if libpthread is found and no if no libpthread is available
  3914. if test -z "$LIBPTHREAD"; then
  3915. if test -z "$USE_THREADS"; then
  3916. kde_check_threading_default=no
  3917. else
  3918. kde_check_threading_default=yes
  3919. fi
  3920. else
  3921. kde_check_threading_default=yes
  3922. fi
  3923. AC_ARG_ENABLE(threading,AC_HELP_STRING([--disable-threading],[disables threading even if libpthread found]),
  3924. kde_use_threading=$enableval, kde_use_threading=$kde_check_threading_default)
  3925. if test "x$kde_use_threading" = "xyes"; then
  3926. AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])
  3927. fi
  3928. ])
  3929. AC_DEFUN([KDE_TRY_LINK_PYTHON],
  3930. [
  3931. if test "$kde_python_link_found" = no; then
  3932. if test "$1" = normal; then
  3933. AC_MSG_CHECKING(if a Python application links)
  3934. else
  3935. AC_MSG_CHECKING(if Python depends on $2)
  3936. fi
  3937. AC_CACHE_VAL(kde_cv_try_link_python_$1,
  3938. [
  3939. kde_save_cflags="$CFLAGS"
  3940. CFLAGS="$CFLAGS $PYTHONINC"
  3941. kde_save_libs="$LIBS"
  3942. LIBS="$LIBS $LIBPYTHON $2 $LIBDL $LIBSOCKET"
  3943. kde_save_ldflags="$LDFLAGS"
  3944. LDFLAGS="$LDFLAGS $PYTHONLIB"
  3945. AC_TRY_LINK(
  3946. [
  3947. #include <Python.h>
  3948. ],[
  3949. PySys_SetArgv(1, 0);
  3950. ],
  3951. [kde_cv_try_link_python_$1=yes],
  3952. [kde_cv_try_link_python_$1=no]
  3953. )
  3954. CFLAGS="$kde_save_cflags"
  3955. LIBS="$kde_save_libs"
  3956. LDFLAGS="$kde_save_ldflags"
  3957. ])
  3958. if test "$kde_cv_try_link_python_$1" = "yes"; then
  3959. AC_MSG_RESULT(yes)
  3960. kde_python_link_found=yes
  3961. if test ! "$1" = normal; then
  3962. LIBPYTHON="$LIBPYTHON $2"
  3963. fi
  3964. $3
  3965. else
  3966. AC_MSG_RESULT(no)
  3967. $4
  3968. fi
  3969. fi
  3970. ])
  3971. AC_DEFUN([KDE_CHECK_PYTHON_DIR],
  3972. [
  3973. AC_MSG_CHECKING([for Python directory])
  3974. AC_CACHE_VAL(kde_cv_pythondir,
  3975. [
  3976. if test -z "$PYTHONDIR"; then
  3977. kde_cv_pythondir=/usr/local
  3978. else
  3979. kde_cv_pythondir="$PYTHONDIR"
  3980. fi
  3981. ])
  3982. AC_ARG_WITH(pythondir,
  3983. AC_HELP_STRING([--with-pythondir=pythondir],[use python installed in pythondir]),
  3984. [
  3985. ac_python_dir=$withval
  3986. ], ac_python_dir=$kde_cv_pythondir
  3987. )
  3988. AC_MSG_RESULT($ac_python_dir)
  3989. ])
  3990. AC_DEFUN([KDE_CHECK_PYTHON_INTERN],
  3991. [
  3992. AC_REQUIRE([KDE_CHECK_LIBDL])
  3993. AC_REQUIRE([KDE_CHECK_LIBPTHREAD])
  3994. AC_REQUIRE([KDE_CHECK_PYTHON_DIR])
  3995. if test -z "$1"; then
  3996. version="1.5"
  3997. else
  3998. version="$1"
  3999. fi
  4000. AC_MSG_CHECKING([for Python$version])
  4001. python_incdirs="$ac_python_dir/include /usr/include /usr/local/include/ $kde_extra_includes"
  4002. AC_FIND_FILE(Python.h, $python_incdirs, python_incdir)
  4003. if test ! -r $python_incdir/Python.h; then
  4004. AC_FIND_FILE(python$version/Python.h, $python_incdirs, python_incdir)
  4005. python_incdir=$python_incdir/python$version
  4006. if test ! -r $python_incdir/Python.h; then
  4007. python_incdir=no
  4008. fi
  4009. fi
  4010. PYTHONINC=-I$python_incdir
  4011. python_libdirs="$ac_python_dir/lib$tdelibsuff /usr/lib$tdelibsuff /usr/local /usr/lib$tdelibsuff $kde_extra_libs"
  4012. AC_FIND_FILE(libpython$version.so, $python_libdirs, python_libdir)
  4013. if test ! -r $python_libdir/libpython$version.so; then
  4014. AC_FIND_FILE(libpython$version.a, $python_libdirs, python_libdir)
  4015. if test ! -r $python_libdir/libpython$version.a; then
  4016. AC_FIND_FILE(python$version/config/libpython$version.a, $python_libdirs, python_libdir)
  4017. python_libdir=$python_libdir/python$version/config
  4018. if test ! -r $python_libdir/libpython$version.a; then
  4019. python_libdir=no
  4020. fi
  4021. fi
  4022. fi
  4023. PYTHONLIB=-L$python_libdir
  4024. kde_orig_LIBPYTHON=$LIBPYTHON
  4025. if test -z "$LIBPYTHON"; then
  4026. LIBPYTHON=-lpython$version
  4027. fi
  4028. AC_FIND_FILE(python$version/copy.py, $python_libdirs, python_moddir)
  4029. python_moddir=$python_moddir/python$version
  4030. if test ! -r $python_moddir/copy.py; then
  4031. python_moddir=no
  4032. fi
  4033. PYTHONMODDIR=$python_moddir
  4034. AC_MSG_RESULT(header $python_incdir library $python_libdir modules $python_moddir)
  4035. if test x$python_incdir = xno || test x$python_libdir = xno || test x$python_moddir = xno; then
  4036. LIBPYTHON=$kde_orig_LIBPYTHON
  4037. test "x$PYTHONLIB" = "x-Lno" && PYTHONLIB=""
  4038. test "x$PYTHONINC" = "x-Ino" && PYTHONINC=""
  4039. $2
  4040. else
  4041. dnl Note: this test is very weak
  4042. kde_python_link_found=no
  4043. KDE_TRY_LINK_PYTHON(normal)
  4044. KDE_TRY_LINK_PYTHON(m, -lm)
  4045. KDE_TRY_LINK_PYTHON(pthread, $LIBPTHREAD)
  4046. KDE_TRY_LINK_PYTHON(tcl, -ltcl)
  4047. KDE_TRY_LINK_PYTHON(db2, -ldb2)
  4048. KDE_TRY_LINK_PYTHON(m_and_thread, [$LIBPTHREAD -lm])
  4049. KDE_TRY_LINK_PYTHON(m_and_thread_and_util, [$LIBPTHREAD -lm -lutil])
  4050. KDE_TRY_LINK_PYTHON(m_and_thread_and_db3, [$LIBPTHREAD -lm -ldb-3 -lutil])
  4051. KDE_TRY_LINK_PYTHON(pthread_and_db3, [$LIBPTHREAD -ldb-3])
  4052. KDE_TRY_LINK_PYTHON(m_and_thread_and_db, [$LIBPTHREAD -lm -ldb -ltermcap -lutil])
  4053. KDE_TRY_LINK_PYTHON(pthread_and_dl, [$LIBPTHREAD $LIBDL -lutil -lreadline -lncurses -lm])
  4054. KDE_TRY_LINK_PYTHON(pthread_and_panel_curses, [$LIBPTHREAD $LIBDL -lm -lpanel -lcurses])
  4055. KDE_TRY_LINK_PYTHON(m_and_thread_and_db_special, [$LIBPTHREAD -lm -ldb -lutil], [],
  4056. [AC_MSG_WARN([it seems, Python depends on another library.
  4057. Please set LIBPYTHON to '-lpython$version -lotherlib' before calling configure to fix this
  4058. and contact the authors to let them know about this problem])
  4059. ])
  4060. LIBPYTHON="$LIBPYTHON $LIBDL $LIBSOCKET"
  4061. AC_SUBST(PYTHONINC)
  4062. AC_SUBST(PYTHONLIB)
  4063. AC_SUBST(LIBPYTHON)
  4064. AC_SUBST(PYTHONMODDIR)
  4065. AC_DEFINE(HAVE_PYTHON, 1, [Define if you have the development files for python])
  4066. fi
  4067. ])
  4068. AC_DEFUN([KDE_CHECK_PYTHON],
  4069. [
  4070. KDE_CHECK_PYTHON_INTERN("2.5",
  4071. [KDE_CHECK_PYTHON_INTERN("2.4",
  4072. [KDE_CHECK_PYTHON_INTERN("2.3",
  4073. [KDE_CHECK_PYTHON_INTERN("2.2",
  4074. [KDE_CHECK_PYTHON_INTERN("2.1",
  4075. [KDE_CHECK_PYTHON_INTERN("2.0",
  4076. [KDE_CHECK_PYTHON_INTERN($1, $2) ])
  4077. ])
  4078. ])
  4079. ])
  4080. ])
  4081. ])
  4082. ])
  4083. AC_DEFUN([KDE_CHECK_STL],
  4084. [
  4085. AC_LANG_SAVE
  4086. AC_LANG_CPLUSPLUS
  4087. ac_save_CXXFLAGS="$CXXFLAGS"
  4088. CXXFLAGS="`echo $CXXFLAGS | sed s/-fno-exceptions//`"
  4089. AC_MSG_CHECKING([if C++ programs can be compiled])
  4090. AC_CACHE_VAL(kde_cv_stl_works,
  4091. [
  4092. AC_TRY_COMPILE([
  4093. #include <string>
  4094. using namespace std;
  4095. ],[
  4096. string astring="Hallo Welt.";
  4097. astring.erase(0, 6); // now astring is "Welt"
  4098. return 0;
  4099. ], kde_cv_stl_works=yes,
  4100. kde_cv_stl_works=no)
  4101. ])
  4102. AC_MSG_RESULT($kde_cv_stl_works)
  4103. if test "$kde_cv_stl_works" = "yes"; then
  4104. # back compatible
  4105. AC_DEFINE_UNQUOTED(HAVE_SGI_STL, 1, [Define if you have a STL implementation by SGI])
  4106. else
  4107. AC_MSG_ERROR([Your Installation isn't able to compile simple C++ programs.
  4108. Check config.log for details - if you're using a Linux distribution you might miss
  4109. a package named similar to libstdc++-dev.])
  4110. fi
  4111. CXXFLAGS="$ac_save_CXXFLAGS"
  4112. AC_LANG_RESTORE
  4113. ])
  4114. AC_DEFUN([AC_FIND_QIMGIO],
  4115. [AC_REQUIRE([AC_FIND_JPEG])
  4116. AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
  4117. AC_MSG_CHECKING([for qimgio])
  4118. AC_CACHE_VAL(ac_cv_lib_qimgio,
  4119. [
  4120. AC_LANG_SAVE
  4121. AC_LANG_CPLUSPLUS
  4122. ac_save_LIBS="$LIBS"
  4123. ac_save_CXXFLAGS="$CXXFLAGS"
  4124. LIBS="$all_libraries -lqimgio -lpng -lz $LIBJPEG $LIBTQT"
  4125. CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
  4126. AC_TRY_RUN(dnl
  4127. [
  4128. #include <qimageio.h>
  4129. #include <qstring.h>
  4130. int main() {
  4131. QString t = "hallo";
  4132. t.fill('t');
  4133. qInitImageIO();
  4134. }
  4135. ],
  4136. ac_cv_lib_qimgio=yes,
  4137. ac_cv_lib_qimgio=no,
  4138. ac_cv_lib_qimgio=no)
  4139. LIBS="$ac_save_LIBS"
  4140. CXXFLAGS="$ac_save_CXXFLAGS"
  4141. AC_LANG_RESTORE
  4142. ])dnl
  4143. if eval "test \"`echo $ac_cv_lib_qimgio`\" = yes"; then
  4144. LIBQIMGIO="-lqimgio -lpng -lz $LIBJPEG"
  4145. AC_MSG_RESULT(yes)
  4146. AC_DEFINE_UNQUOTED(HAVE_QIMGIO, 1, [Define if you have the Qt extension qimgio available])
  4147. AC_SUBST(LIBQIMGIO)
  4148. else
  4149. AC_MSG_RESULT(not found)
  4150. fi
  4151. ])
  4152. AC_DEFUN([AM_DISABLE_LIBRARIES],
  4153. [
  4154. AC_PROVIDE([AM_ENABLE_STATIC])
  4155. AC_PROVIDE([AM_ENABLE_SHARED])
  4156. enable_static=no
  4157. enable_shared=yes
  4158. ])
  4159. AC_DEFUN([AC_CHECK_UTMP_FILE],
  4160. [
  4161. AC_MSG_CHECKING([for utmp file])
  4162. AC_CACHE_VAL(kde_cv_utmp_file,
  4163. [
  4164. kde_cv_utmp_file=no
  4165. for ac_file in \
  4166. \
  4167. /var/run/utmp \
  4168. /var/adm/utmp \
  4169. /etc/utmp \
  4170. ; \
  4171. do
  4172. if test -r "$ac_file"; then
  4173. kde_cv_utmp_file=$ac_file
  4174. break
  4175. fi
  4176. done
  4177. ])
  4178. if test "$kde_cv_utmp_file" != "no"; then
  4179. AC_DEFINE_UNQUOTED(UTMP, "$kde_cv_utmp_file", [Define the file for utmp entries])
  4180. $1
  4181. AC_MSG_RESULT($kde_cv_utmp_file)
  4182. else
  4183. $2
  4184. AC_MSG_RESULT([non found])
  4185. fi
  4186. ])
  4187. AC_DEFUN([KDE_CREATE_SUBDIRSLIST],
  4188. [
  4189. DO_NOT_COMPILE="$DO_NOT_COMPILE CVS debian bsd-port admin"
  4190. TOPSUBDIRS=""
  4191. if test ! -s $srcdir/subdirs; then
  4192. dnl Note: Makefile.common creates subdirs, so this is just a fallback
  4193. files=`cd $srcdir && ls -1`
  4194. dirs=`for i in $files; do if test -d $i; then echo $i; fi; done`
  4195. for i in $dirs; do
  4196. echo $i >> $srcdir/subdirs
  4197. done
  4198. fi
  4199. ac_topsubdirs=
  4200. if test -s $srcdir/inst-apps; then
  4201. ac_topsubdirs="`cat $srcdir/inst-apps`"
  4202. elif test -s $srcdir/subdirs; then
  4203. ac_topsubdirs="`cat $srcdir/subdirs`"
  4204. fi
  4205. for i in $ac_topsubdirs; do
  4206. AC_MSG_CHECKING([if $i should be compiled])
  4207. if test -d $srcdir/$i; then
  4208. install_it="yes"
  4209. for j in $DO_NOT_COMPILE; do
  4210. if test $i = $j; then
  4211. install_it="no"
  4212. fi
  4213. done
  4214. else
  4215. install_it="no"
  4216. fi
  4217. AC_MSG_RESULT($install_it)
  4218. vari=`echo $i | sed -e 's,[[-+.@]],_,g'`
  4219. if test $install_it = "yes"; then
  4220. TOPSUBDIRS="$TOPSUBDIRS $i"
  4221. eval "$vari""_SUBDIR_included=yes"
  4222. else
  4223. eval "$vari""_SUBDIR_included=no"
  4224. fi
  4225. done
  4226. AC_SUBST(TOPSUBDIRS)
  4227. ])
  4228. AC_DEFUN([KDE_CHECK_NAMESPACES],
  4229. [
  4230. AC_MSG_CHECKING(whether C++ compiler supports namespaces)
  4231. AC_LANG_SAVE
  4232. AC_LANG_CPLUSPLUS
  4233. AC_TRY_COMPILE([
  4234. ],
  4235. [
  4236. namespace Foo {
  4237. extern int i;
  4238. namespace Bar {
  4239. extern int i;
  4240. }
  4241. }
  4242. int Foo::i = 0;
  4243. int Foo::Bar::i = 1;
  4244. ],[
  4245. AC_MSG_RESULT(yes)
  4246. AC_DEFINE(HAVE_NAMESPACES)
  4247. ], [
  4248. AC_MSG_RESULT(no)
  4249. ])
  4250. AC_LANG_RESTORE
  4251. ])
  4252. dnl ------------------------------------------------------------------------
  4253. dnl Check for S_ISSOCK macro. Doesn't exist on Unix SCO. faure@kde.org
  4254. dnl ------------------------------------------------------------------------
  4255. dnl
  4256. AC_DEFUN([AC_CHECK_S_ISSOCK],
  4257. [
  4258. AC_MSG_CHECKING(for S_ISSOCK)
  4259. AC_CACHE_VAL(ac_cv_have_s_issock,
  4260. [
  4261. AC_TRY_LINK(
  4262. [
  4263. #include <sys/stat.h>
  4264. ],
  4265. [
  4266. struct stat buff;
  4267. int b = S_ISSOCK( buff.st_mode );
  4268. ],
  4269. ac_cv_have_s_issock=yes,
  4270. ac_cv_have_s_issock=no)
  4271. ])
  4272. AC_MSG_RESULT($ac_cv_have_s_issock)
  4273. if test "$ac_cv_have_s_issock" = "yes"; then
  4274. AC_DEFINE_UNQUOTED(HAVE_S_ISSOCK, 1, [Define if sys/stat.h declares S_ISSOCK.])
  4275. fi
  4276. AH_VERBATIM(_ISSOCK,
  4277. [
  4278. #ifndef HAVE_S_ISSOCK
  4279. #define HAVE_S_ISSOCK
  4280. #define S_ISSOCK(mode) (1==0)
  4281. #endif
  4282. ])
  4283. ])
  4284. dnl ------------------------------------------------------------------------
  4285. dnl Check for MAXPATHLEN macro, defines KDEMAXPATHLEN. faure@kde.org
  4286. dnl ------------------------------------------------------------------------
  4287. dnl
  4288. AC_DEFUN([AC_CHECK_KDEMAXPATHLEN],
  4289. [
  4290. AC_MSG_CHECKING(for MAXPATHLEN)
  4291. AC_CACHE_VAL(ac_cv_maxpathlen,
  4292. [
  4293. cat > conftest.$ac_ext <<EOF
  4294. #ifdef STDC_HEADERS
  4295. # include <stdlib.h>
  4296. #endif
  4297. #include <stdio.h>
  4298. #include <sys/param.h>
  4299. #ifndef MAXPATHLEN
  4300. #define MAXPATHLEN 1024
  4301. #endif
  4302. KDE_HELLO MAXPATHLEN
  4303. EOF
  4304. ac_try="$ac_cpp conftest.$ac_ext 2>/dev/null | grep '^KDE_HELLO' >conftest.out"
  4305. if AC_TRY_EVAL(ac_try) && test -s conftest.out; then
  4306. ac_cv_maxpathlen=`sed 's#KDE_HELLO ##' conftest.out`
  4307. else
  4308. ac_cv_maxpathlen=1024
  4309. fi
  4310. rm conftest.*
  4311. ])
  4312. AC_MSG_RESULT($ac_cv_maxpathlen)
  4313. AC_DEFINE_UNQUOTED(KDEMAXPATHLEN,$ac_cv_maxpathlen, [Define a safe value for MAXPATHLEN] )
  4314. ])
  4315. AC_DEFUN([KDE_CHECK_HEADER],
  4316. [
  4317. kde_safe_cppflags=$CPPFLAGS
  4318. CPPFLAGS="$CPPFLAGS $all_includes"
  4319. AC_LANG_SAVE
  4320. AC_LANG_CPLUSPLUS
  4321. AC_CHECK_HEADER([$1], [$2], [$3], [$4])
  4322. AC_LANG_RESTORE
  4323. CPPFLAGS=$kde_safe_cppflags
  4324. ])
  4325. AC_DEFUN([KDE_CHECK_HEADERS],
  4326. [
  4327. AH_CHECK_HEADERS([$1])
  4328. AC_LANG_SAVE
  4329. kde_safe_cppflags=$CPPFLAGS
  4330. CPPFLAGS="$CPPFLAGS $all_includes"
  4331. AC_LANG_CPLUSPLUS
  4332. AC_CHECK_HEADERS([$1], [$2], [$3], [$4])
  4333. CPPFLAGS=$kde_safe_cppflags
  4334. AC_LANG_RESTORE
  4335. ])
  4336. AC_DEFUN([KDE_FAST_CONFIGURE],
  4337. [
  4338. dnl makes configure fast (needs perl)
  4339. AC_ARG_ENABLE(fast-perl, AC_HELP_STRING([--disable-fast-perl],[disable fast Makefile generation (needs perl)]),
  4340. with_fast_perl=$enableval, with_fast_perl=yes)
  4341. ])
  4342. AC_DEFUN([KDE_CONF_FILES],
  4343. [
  4344. val=
  4345. if test -f $srcdir/configure.files ; then
  4346. val=`sed -e 's%^%\$(top_srcdir)/%' $srcdir/configure.files`
  4347. fi
  4348. CONF_FILES=
  4349. if test -n "$val" ; then
  4350. for i in $val ; do
  4351. CONF_FILES="$CONF_FILES $i"
  4352. done
  4353. fi
  4354. AC_SUBST(CONF_FILES)
  4355. ])dnl
  4356. dnl This sets the prefix, for arts and tdelibs
  4357. dnl Do NOT use in any other module.
  4358. dnl It only looks at --prefix, TDEDIR and falls back to /usr/local/kde
  4359. AC_DEFUN([KDE_SET_PREFIX_CORE],
  4360. [
  4361. unset CDPATH
  4362. dnl make $TDEDIR the default for the installation
  4363. AC_PREFIX_DEFAULT(${TDEDIR:-/usr/local/kde})
  4364. if test "x$prefix" = "xNONE"; then
  4365. prefix=$ac_default_prefix
  4366. ac_configure_args="$ac_configure_args --prefix=$prefix"
  4367. fi
  4368. # And delete superfluous '/' to make compares easier
  4369. prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4370. exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4371. kde_libs_prefix='$(prefix)'
  4372. kde_libs_htmldir='$(kde_htmldir)'
  4373. AC_SUBST(kde_libs_prefix)
  4374. AC_SUBST(kde_libs_htmldir)
  4375. KDE_FAST_CONFIGURE
  4376. KDE_CONF_FILES
  4377. ])
  4378. AC_DEFUN([KDE_SET_PREFIX],
  4379. [
  4380. unset CDPATH
  4381. dnl We can't give real code to that macro, only a value.
  4382. dnl It only matters for --help, since we set the prefix in this function anyway.
  4383. AC_PREFIX_DEFAULT(${TDEDIR:-the kde prefix})
  4384. KDE_SET_DEFAULT_BINDIRS
  4385. if test "x$prefix" = "xNONE"; then
  4386. dnl no prefix given: look for tde-config in the PATH and deduce the prefix from it
  4387. KDE_FIND_PATH(tde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(tde-config)], [], prepend)
  4388. else
  4389. dnl prefix given: look for tde-config, preferrably in prefix, otherwise in PATH
  4390. kde_save_PATH="$PATH"
  4391. PATH="$exec_prefix/bin:$prefix/bin:$PATH"
  4392. KDE_FIND_PATH(tde-config, KDECONFIG, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(tde-config)], [], prepend)
  4393. PATH="$kde_save_PATH"
  4394. fi
  4395. kde_libs_prefix=`$KDECONFIG --prefix`
  4396. if test -z "$kde_libs_prefix" || test ! -x "$kde_libs_prefix"; then
  4397. AC_MSG_ERROR([$KDECONFIG --prefix outputed the non existant prefix '$kde_libs_prefix' for tdelibs.
  4398. This means it has been moved since you installed it.
  4399. This won't work. Please recompile tdelibs for the new prefix.
  4400. ])
  4401. fi
  4402. kde_libs_htmldir=`$KDECONFIG --install html --expandvars`
  4403. AC_MSG_CHECKING([where to install])
  4404. if test "x$prefix" = "xNONE"; then
  4405. prefix=$kde_libs_prefix
  4406. AC_MSG_RESULT([$prefix (as returned by tde-config)])
  4407. else
  4408. dnl --prefix was given. Compare prefixes and warn (in configure.in.bot.end) if different
  4409. given_prefix=$prefix
  4410. AC_MSG_RESULT([$prefix (as requested)])
  4411. fi
  4412. # And delete superfluous '/' to make compares easier
  4413. prefix=`echo "$prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4414. exec_prefix=`echo "$exec_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4415. given_prefix=`echo "$given_prefix" | sed 's,//*,/,g' | sed -e 's,/$,,'`
  4416. AC_SUBST(KDECONFIG)
  4417. AC_SUBST(kde_libs_prefix)
  4418. AC_SUBST(kde_libs_htmldir)
  4419. KDE_FAST_CONFIGURE
  4420. KDE_CONF_FILES
  4421. ])
  4422. pushdef([AC_PROG_INSTALL],
  4423. [
  4424. dnl our own version, testing for a -p flag
  4425. popdef([AC_PROG_INSTALL])
  4426. dnl as AC_PROG_INSTALL works as it works we first have
  4427. dnl to save if the user didn't specify INSTALL, as the
  4428. dnl autoconf one overwrites INSTALL and we have no chance to find
  4429. dnl out afterwards
  4430. test -n "$INSTALL" && kde_save_INSTALL_given=$INSTALL
  4431. test -n "$INSTALL_PROGRAM" && kde_save_INSTALL_PROGRAM_given=$INSTALL_PROGRAM
  4432. test -n "$INSTALL_SCRIPT" && kde_save_INSTALL_SCRIPT_given=$INSTALL_SCRIPT
  4433. AC_PROG_INSTALL
  4434. if test -z "$kde_save_INSTALL_given" ; then
  4435. # OK, user hasn't given any INSTALL, autoconf found one for us
  4436. # now we test, if it supports the -p flag
  4437. AC_MSG_CHECKING(for -p flag to install)
  4438. rm -f confinst.$$.* > /dev/null 2>&1
  4439. echo "Testtest" > confinst.$$.orig
  4440. ac_res=no
  4441. if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
  4442. if test -f confinst.$$.new ; then
  4443. # OK, -p seems to do no harm to install
  4444. INSTALL="${INSTALL} -p"
  4445. ac_res=yes
  4446. fi
  4447. fi
  4448. rm -f confinst.$$.*
  4449. AC_MSG_RESULT($ac_res)
  4450. fi
  4451. dnl the following tries to resolve some signs and wonders coming up
  4452. dnl with different autoconf/automake versions
  4453. dnl e.g.:
  4454. dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
  4455. dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
  4456. dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
  4457. dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
  4458. dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
  4459. dnl install-@DIR@PROGRAMS targets to explicitly use that flag
  4460. dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
  4461. dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
  4462. dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
  4463. dnl *sometimes KDE does not use the install-@DIR@PROGRAM targets from
  4464. dnl automake (due to broken Makefile.am or whatever) to install programs,
  4465. dnl and so does not see the -s flag in automake > 1.4
  4466. dnl to clean up that mess we:
  4467. dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
  4468. dnl which cleans KDE's program with automake > 1.4;
  4469. dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
  4470. dnl with automake<=1.4
  4471. dnl note that dues to this sometimes two '-s' flags are used (if KDE
  4472. dnl properly uses install-@DIR@PROGRAMS, but I don't care
  4473. dnl
  4474. dnl And to all this comes, that I even can't write in comments variable
  4475. dnl names used by automake, because it is so stupid to think I wanted to
  4476. dnl _use_ them, therefor I have written A_M_... instead of AM_
  4477. dnl hmm, I wanted to say something ... ahh yes: Arghhh.
  4478. if test -z "$kde_save_INSTALL_PROGRAM_given" ; then
  4479. INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
  4480. fi
  4481. if test -z "$kde_save_INSTALL_SCRIPT_given" ; then
  4482. INSTALL_SCRIPT='${INSTALL}'
  4483. fi
  4484. ])dnl
  4485. AC_DEFUN([KDE_LANG_CPLUSPLUS],
  4486. [AC_LANG_CPLUSPLUS
  4487. ac_link='rm -rf SunWS_cache; ${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'
  4488. pushdef([AC_LANG_CPLUSPLUS], [popdef([AC_LANG_CPLUSPLUS]) KDE_LANG_CPLUSPLUS])
  4489. ])
  4490. pushdef([AC_LANG_CPLUSPLUS],
  4491. [popdef([AC_LANG_CPLUSPLUS])
  4492. KDE_LANG_CPLUSPLUS
  4493. ])
  4494. AC_DEFUN([KDE_CHECK_LONG_LONG],
  4495. [
  4496. AC_MSG_CHECKING(for long long)
  4497. AC_CACHE_VAL(kde_cv_c_long_long,
  4498. [
  4499. AC_LANG_SAVE
  4500. AC_LANG_CPLUSPLUS
  4501. AC_TRY_LINK([], [
  4502. long long foo = 0;
  4503. foo = foo+1;
  4504. ],
  4505. kde_cv_c_long_long=yes, kde_cv_c_long_long=no)
  4506. AC_LANG_RESTORE
  4507. ])
  4508. AC_MSG_RESULT($kde_cv_c_long_long)
  4509. if test "$kde_cv_c_long_long" = yes; then
  4510. AC_DEFINE(HAVE_LONG_LONG, 1, [Define if you have long long as datatype])
  4511. fi
  4512. ])
  4513. AC_DEFUN([KDE_CHECK_LIB],
  4514. [
  4515. kde_save_LDFLAGS="$LDFLAGS"
  4516. dnl AC_CHECK_LIB modifies LIBS, so save it here
  4517. kde_save_LIBS="$LIBS"
  4518. LDFLAGS="$LDFLAGS $all_libraries"
  4519. case $host_os in
  4520. aix*) LDFLAGS="-brtl $LDFLAGS"
  4521. test "$GCC" = yes && LDFLAGS="-Wl,$LDFLAGS"
  4522. ;;
  4523. esac
  4524. AC_CHECK_LIB($1, $2, $3, $4, $5)
  4525. LDFLAGS="$kde_save_LDFLAGS"
  4526. LIBS="$kde_save_LIBS"
  4527. ])
  4528. AC_DEFUN([KDE_JAVA_PREFIX],
  4529. [
  4530. dir=`dirname "$1"`
  4531. base=`basename "$1"`
  4532. list=`ls -1 $dir 2> /dev/null`
  4533. for entry in $list; do
  4534. if test -d $dir/$entry/bin; then
  4535. case $entry in
  4536. $base)
  4537. javadirs="$javadirs $dir/$entry/bin"
  4538. ;;
  4539. esac
  4540. elif test -d $dir/$entry/jre/bin; then
  4541. case $entry in
  4542. $base)
  4543. javadirs="$javadirs $dir/$entry/jre/bin"
  4544. ;;
  4545. esac
  4546. fi
  4547. done
  4548. ])
  4549. dnl KDE_CHEC_JAVA_DIR(onlyjre)
  4550. AC_DEFUN([KDE_CHECK_JAVA_DIR],
  4551. [
  4552. AC_ARG_WITH(java,
  4553. AC_HELP_STRING([--with-java=javadir],[use java installed in javadir, --without-java disables]),
  4554. [ ac_java_dir=$withval
  4555. ], ac_java_dir=""
  4556. )
  4557. AC_MSG_CHECKING([for Java])
  4558. dnl at this point ac_java_dir is either a dir, 'no' to disable, or '' to say look in $PATH
  4559. if test "x$ac_java_dir" = "xno"; then
  4560. kde_java_bindir=no
  4561. kde_java_includedir=no
  4562. kde_java_libjvmdir=no
  4563. kde_java_libgcjdir=no
  4564. kde_java_libhpidir=no
  4565. else
  4566. if test "x$ac_java_dir" = "x"; then
  4567. dnl No option set -> collect list of candidate paths
  4568. if test -n "$JAVA_HOME"; then
  4569. KDE_JAVA_PREFIX($JAVA_HOME)
  4570. fi
  4571. KDE_JAVA_PREFIX(/usr/j2se)
  4572. KDE_JAVA_PREFIX(/usr/lib/j2se)
  4573. KDE_JAVA_PREFIX(/usr/j*dk*)
  4574. KDE_JAVA_PREFIX(/usr/lib/j*dk*)
  4575. KDE_JAVA_PREFIX(/opt/j*sdk*)
  4576. KDE_JAVA_PREFIX(/usr/lib/java*)
  4577. KDE_JAVA_PREFIX(/usr/java*)
  4578. KDE_JAVA_PREFIX(/usr/java/j*dk*)
  4579. KDE_JAVA_PREFIX(/usr/java/j*re*)
  4580. KDE_JAVA_PREFIX(/usr/lib/SunJava2*)
  4581. KDE_JAVA_PREFIX(/usr/lib/SunJava*)
  4582. KDE_JAVA_PREFIX(/usr/lib/IBMJava2*)
  4583. KDE_JAVA_PREFIX(/usr/lib/IBMJava*)
  4584. KDE_JAVA_PREFIX(/opt/java*)
  4585. kde_cv_path="NONE"
  4586. kde_save_IFS=$IFS
  4587. IFS=':'
  4588. for dir in $PATH; do
  4589. if test -d "$dir"; then
  4590. javadirs="$javadirs $dir"
  4591. fi
  4592. done
  4593. IFS=$kde_save_IFS
  4594. jredirs=
  4595. dnl Now javadirs contains a list of paths that exist, all ending with bin/
  4596. for dir in $javadirs; do
  4597. dnl Check for the java executable
  4598. if test -x "$dir/java"; then
  4599. sane_path=$(cd $dir; /bin/pwd)
  4600. dnl And also check for a libjvm.so somewhere under there
  4601. dnl Since we have to go to the parent dir, /usr/bin is excluded, /usr is too big.
  4602. if test "$sane_path" != "/usr/bin"; then
  4603. libjvmdir=`find $dir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
  4604. if test ! -f $libjvmdir/libjvm.so; then continue; fi
  4605. jredirs="$jredirs $dir"
  4606. fi
  4607. fi
  4608. done
  4609. dnl Now jredirs contains a reduced list, of paths where both java and ../**/libjvm.so was found
  4610. JAVAC=
  4611. JAVA=
  4612. kde_java_bindir=no
  4613. for dir in $jredirs; do
  4614. JAVA="$dir/java"
  4615. kde_java_bindir=$dir
  4616. if test -x "$dir/javac"; then
  4617. JAVAC="$dir/javac"
  4618. break
  4619. fi
  4620. done
  4621. if test -n "$JAVAC"; then
  4622. dnl this substitution might not work - well, we test for jni.h below
  4623. kde_java_includedir=`echo $JAVAC | sed -e 's,bin/javac$,include/,'`
  4624. else
  4625. kde_java_includedir=no
  4626. fi
  4627. else
  4628. dnl config option set
  4629. kde_java_bindir=$ac_java_dir/bin
  4630. if test -x $ac_java_dir/bin/java && test ! -x $ac_java_dir/bin/javac; then
  4631. kde_java_includedir=no
  4632. else
  4633. kde_java_includedir=$ac_java_dir/include
  4634. fi
  4635. fi
  4636. fi
  4637. dnl At this point kde_java_bindir and kde_java_includedir are either set or "no"
  4638. if test "x$kde_java_bindir" != "xno"; then
  4639. dnl Look for libjvm.so
  4640. kde_java_libjvmdir=`find $kde_java_bindir/.. -name libjvm.so | sed 's,libjvm.so,,'|head -n 1`
  4641. dnl Look for libgcj.so
  4642. kde_java_libgcjdir=`find $kde_java_bindir/.. -name libgcj.so | sed 's,libgcj.so,,'|head -n 1`
  4643. dnl Look for libhpi.so and avoid green threads
  4644. kde_java_libhpidir=`find $kde_java_bindir/.. -name libhpi.so | grep -v green | sed 's,libhpi.so,,' | head -n 1`
  4645. dnl Now check everything's fine under there
  4646. dnl the include dir is our flag for having the JDK
  4647. if test -d "$kde_java_includedir"; then
  4648. if test ! -x "$kde_java_bindir/javac"; then
  4649. AC_MSG_ERROR([javac not found under $kde_java_bindir - it seems you passed a wrong --with-java.])
  4650. fi
  4651. if test ! -x "$kde_java_bindir/javah"; then
  4652. AC_MSG_ERROR([javah not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4653. fi
  4654. if test ! -x "$kde_java_bindir/jar"; then
  4655. AC_MSG_ERROR([jar not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4656. fi
  4657. if test ! -r "$kde_java_includedir/jni.h"; then
  4658. AC_MSG_ERROR([jni.h not found under $kde_java_includedir. Use --with-java or --without-java.])
  4659. fi
  4660. jni_includes="-I$kde_java_includedir"
  4661. dnl Strange thing, jni.h requires jni_md.h which is under genunix here..
  4662. dnl and under linux here..
  4663. dnl not needed for gcj
  4664. if test "x$kde_java_libgcjdir" = "x"; then
  4665. test -d "$kde_java_includedir/linux" && jni_includes="$jni_includes -I$kde_java_includedir/linux"
  4666. test -d "$kde_java_includedir/solaris" && jni_includes="$jni_includes -I$kde_java_includedir/solaris"
  4667. test -d "$kde_java_includedir/genunix" && jni_includes="$jni_includes -I$kde_java_includedir/genunix"
  4668. fi
  4669. else
  4670. JAVAC=
  4671. jni_includes=
  4672. fi
  4673. if test "x$kde_java_libgcjdir" = "x"; then
  4674. if test ! -r "$kde_java_libjvmdir/libjvm.so"; then
  4675. AC_MSG_ERROR([libjvm.so not found under $kde_java_libjvmdir. Use --without-java.])
  4676. fi
  4677. else
  4678. if test ! -r "$kde_java_libgcjdir/libgcj.so"; then
  4679. AC_MSG_ERROR([libgcj.so not found under $kde_java_libgcjdir. Use --without-java.])
  4680. fi
  4681. fi
  4682. if test ! -x "$kde_java_bindir/java"; then
  4683. AC_MSG_ERROR([java not found under $kde_java_bindir. javac was found though! Use --with-java or --without-java.])
  4684. fi
  4685. dnl not needed for gcj compile
  4686. if test "x$kde_java_libgcjdir" = "x"; then
  4687. if test ! -r "$kde_java_libhpidir/libhpi.so"; then
  4688. AC_MSG_ERROR([libhpi.so not found under $kde_java_libhpidir. Use --without-java.])
  4689. fi
  4690. fi
  4691. if test -n "$jni_includes"; then
  4692. dnl Check for JNI version
  4693. AC_LANG_SAVE
  4694. AC_LANG_CPLUSPLUS
  4695. ac_cxxflags_safe="$CXXFLAGS"
  4696. CXXFLAGS="$CXXFLAGS $all_includes $jni_includes"
  4697. AC_TRY_COMPILE([
  4698. #include <jni.h>
  4699. ],
  4700. [
  4701. #ifndef JNI_VERSION_1_2
  4702. Syntax Error
  4703. #endif
  4704. ],[ kde_jni_works=yes ],
  4705. [ kde_jni_works=no ])
  4706. if test $kde_jni_works = no; then
  4707. AC_MSG_ERROR([Incorrect version of $kde_java_includedir/jni.h.
  4708. You need to have Java Development Kit (JDK) version 1.2.
  4709. Use --with-java to specify another location.
  4710. Use --without-java to configure without java support.
  4711. Or download a newer JDK and try again.
  4712. See e.g. http://java.sun.com/products/jdk/1.2 ])
  4713. fi
  4714. CXXFLAGS="$ac_cxxflags_safe"
  4715. AC_LANG_RESTORE
  4716. dnl All tests ok, inform and subst the variables
  4717. JAVAC=$kde_java_bindir/javac
  4718. JAVAH=$kde_java_bindir/javah
  4719. JAR=$kde_java_bindir/jar
  4720. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4721. if test "x$kde_java_libgcjdir" = "x"; then
  4722. JVMLIBS="-L$kde_java_libjvmdir -ljvm -L$kde_java_libhpidir -lhpi"
  4723. else
  4724. JVMLIBS="-L$kde_java_libgcjdir -lgcj"
  4725. fi
  4726. AC_MSG_RESULT([java JDK in $kde_java_bindir])
  4727. else
  4728. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4729. AC_MSG_RESULT([java JRE in $kde_java_bindir])
  4730. fi
  4731. elif test -d "/Library/Java/Home"; then
  4732. kde_java_bindir="/Library/Java/Home/bin"
  4733. jni_includes="-I/Library/Java/Home/include"
  4734. JAVAC=$kde_java_bindir/javac
  4735. JAVAH=$kde_java_bindir/javah
  4736. JAR=$kde_java_bindir/jar
  4737. JVMLIBS="-Wl,-framework,JavaVM"
  4738. AC_DEFINE_UNQUOTED(PATH_JAVA, "$kde_java_bindir/java", [Define where your java executable is])
  4739. AC_MSG_RESULT([Apple Java Framework])
  4740. else
  4741. AC_MSG_RESULT([none found])
  4742. fi
  4743. AC_SUBST(JAVAC)
  4744. AC_SUBST(JAVAH)
  4745. AC_SUBST(JAR)
  4746. AC_SUBST(JVMLIBS)
  4747. AC_SUBST(jni_includes)
  4748. # for backward compat
  4749. kde_cv_java_includedir=$kde_java_includedir
  4750. kde_cv_java_bindir=$kde_java_bindir
  4751. ])
  4752. dnl this is a redefinition of autoconf 2.5x's AC_FOREACH.
  4753. dnl When the argument list becomes big, as in KDE for AC_OUTPUT in
  4754. dnl big packages, m4_foreach is dog-slow. So use our own version of
  4755. dnl it. (matz@kde.org)
  4756. m4_define([mm_foreach],
  4757. [m4_pushdef([$1])_mm_foreach($@)m4_popdef([$1])])
  4758. m4_define([mm_car], [[$1]])
  4759. m4_define([mm_car2], [[$@]])
  4760. m4_define([_mm_foreach],
  4761. [m4_if(m4_quote($2), [], [],
  4762. [m4_define([$1], mm_car($2))$3[]_mm_foreach([$1],
  4763. mm_car2(m4_shift($2)),
  4764. [$3])])])
  4765. m4_define([AC_FOREACH],
  4766. [mm_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
  4767. AC_DEFUN([KDE_NEED_FLEX],
  4768. [
  4769. kde_libs_safe=$LIBS
  4770. LIBS="$LIBS $USER_LDFLAGS"
  4771. AM_PROG_LEX
  4772. LIBS=$kde_libs_safe
  4773. if test -z "$LEXLIB"; then
  4774. AC_MSG_ERROR([You need to have flex installed.])
  4775. fi
  4776. AC_SUBST(LEXLIB)
  4777. ])
  4778. AC_DEFUN([AC_PATH_TQTOPIA],
  4779. [
  4780. dnl TODO: use AC_CACHE_VAL
  4781. if test -z "$1"; then
  4782. qtopia_minver_maj=1
  4783. qtopia_minver_min=5
  4784. qtopia_minver_pat=0
  4785. else
  4786. qtopia_minver_maj=`echo "$1" | sed -e "s/^\(.*\)\..*\..*$/\1/"`
  4787. qtopia_minver_min=`echo "$1" | sed -e "s/^.*\.\(.*\)\..*$/\1/"`
  4788. qtopia_minver_pat=`echo "$1" | sed -e "s/^.*\..*\.\(.*\)$/\1/"`
  4789. fi
  4790. qtopia_minver="$qtopia_minver_maj$qtopia_minver_min$qtopia_minver_pat"
  4791. qtopia_minverstr="$qtopia_minver_maj.$qtopia_minver_min.$qtopia_minver_pat"
  4792. AC_REQUIRE([AC_PATH_TQT])
  4793. AC_MSG_CHECKING([for Qtopia])
  4794. LIB_TQTOPIA="-lqpe"
  4795. AC_SUBST(LIB_TQTOPIA)
  4796. kde_qtopia_dirs="$QPEDIR /opt/Qtopia"
  4797. ac_qtopia_incdir=NO
  4798. AC_ARG_WITH(qtopia-dir,
  4799. AC_HELP_STRING([--with-qtopia-dir=DIR],[where the root of Qtopia is installed]),
  4800. [ ac_qtopia_incdir="$withval"/include] )
  4801. qtopia_incdirs=""
  4802. for dir in $kde_qtopia_dirs; do
  4803. qtopia_incdirs="$qtopia_incdirs $dir/include"
  4804. done
  4805. if test ! "$ac_qtopia_incdir" = "NO"; then
  4806. qtopia_incdirs="$ac_qtopia_incdir $qtopia_incdirs"
  4807. fi
  4808. qtopia_incdir=""
  4809. AC_FIND_FILE(qpe/qpeapplication.h, $qtopia_incdirs, qtopia_incdir)
  4810. ac_qtopia_incdir="$qtopia_incdir"
  4811. if test -z "$qtopia_incdir"; then
  4812. AC_MSG_ERROR([Cannot find Qtopia headers. Please check your installation.])
  4813. fi
  4814. qtopia_ver_maj=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION "\(.*\)\..*\..*".*,\1,p'`;
  4815. qtopia_ver_min=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\.\(.*\)\..*".*,\1,p'`;
  4816. qtopia_ver_pat=`cat $qtopia_incdir/qpe/version.h | sed -n -e 's,.*QPE_VERSION ".*\..*\.\(.*\)".*,\1,p'`;
  4817. qtopia_ver="$qtopia_ver_maj$qtopia_ver_min$qtopia_ver_pat"
  4818. qtopia_verstr="$qtopia_ver_maj.$qtopia_ver_min.$qtopia_ver_pat"
  4819. if test "$qtopia_ver" -lt "$qtopia_minver"; then
  4820. AC_MSG_ERROR([found Qtopia version $qtopia_verstr but version $qtopia_minverstr
  4821. is required.])
  4822. fi
  4823. AC_LANG_SAVE
  4824. AC_LANG_CPLUSPLUS
  4825. ac_cxxflags_safe="$CXXFLAGS"
  4826. ac_ldflags_safe="$LDFLAGS"
  4827. ac_libs_safe="$LIBS"
  4828. CXXFLAGS="$CXXFLAGS -I$qtopia_incdir $all_includes"
  4829. LDFLAGS="$LDFLAGS $QT_LDFLAGS $all_libraries $USER_LDFLAGS $KDE_MT_LDFLAGS"
  4830. LIBS="$LIBS $LIB_TQTOPIA $LIBTQT"
  4831. cat > conftest.$ac_ext <<EOF
  4832. #include "confdefs.h"
  4833. #include <qpe/qpeapplication.h>
  4834. #include <qpe/version.h>
  4835. int main( int argc, char **argv )
  4836. {
  4837. QPEApplication app( argc, argv );
  4838. return 0;
  4839. }
  4840. EOF
  4841. if AC_TRY_EVAL(ac_link) && test -s conftest; then
  4842. rm -f conftest*
  4843. else
  4844. rm -f conftest*
  4845. AC_MSG_ERROR([Cannot link small Qtopia Application. For more details look at
  4846. the end of config.log])
  4847. fi
  4848. CXXFLAGS="$ac_cxxflags_safe"
  4849. LDFLAGS="$ac_ldflags_safe"
  4850. LIBS="$ac_libs_safe"
  4851. AC_LANG_RESTORE
  4852. QTOPIA_INCLUDES="-I$qtopia_incdir"
  4853. AC_SUBST(QTOPIA_INCLUDES)
  4854. AC_MSG_RESULT([found version $qtopia_verstr with headers at $qtopia_incdir])
  4855. ])
  4856. AC_DEFUN([KDE_INIT_DOXYGEN],
  4857. [
  4858. AC_MSG_CHECKING([for Qt docs])
  4859. kde_qtdir=
  4860. if test "${with_qt_dir+set}" = set; then
  4861. kde_qtdir="$with_qt_dir"
  4862. fi
  4863. AC_FIND_FILE(qsql.html, [ $kde_qtdir/doc/html $TQTDIR/doc/html /usr/share/doc/packages/qt3/html /usr/lib/qt/doc /usr/lib/qt3/doc /usr/lib/qt3/doc/html /usr/doc/qt3/html /usr/doc/qt3 /usr/share/doc/qt3-doc /usr/share/qt3/doc/html /usr/X11R6/share/doc/qt/html ], TQTDOCDIR)
  4864. AC_MSG_RESULT($TQTDOCDIR)
  4865. AC_SUBST(TQTDOCDIR)
  4866. KDE_FIND_PATH(dot, DOT, [], [])
  4867. if test -n "$DOT"; then
  4868. KDE_HAVE_DOT="YES"
  4869. else
  4870. KDE_HAVE_DOT="NO"
  4871. fi
  4872. AC_SUBST(KDE_HAVE_DOT)
  4873. KDE_FIND_PATH(doxygen, DOXYGEN, [], [])
  4874. AC_SUBST(DOXYGEN)
  4875. DOXYGEN_PROJECT_NAME="$1"
  4876. DOXYGEN_PROJECT_NUMBER="$2"
  4877. AC_SUBST(DOXYGEN_PROJECT_NAME)
  4878. AC_SUBST(DOXYGEN_PROJECT_NUMBER)
  4879. KDE_HAS_DOXYGEN=no
  4880. if test -n "$DOXYGEN" && test -x "$DOXYGEN" && test -f $TQTDOCDIR/qsql.html; then
  4881. KDE_HAS_DOXYGEN=yes
  4882. fi
  4883. AC_SUBST(KDE_HAS_DOXYGEN)
  4884. ])
  4885. AC_DEFUN([AC_FIND_BZIP2],
  4886. [
  4887. AC_MSG_CHECKING([for bzDecompress in libbz2])
  4888. AC_CACHE_VAL(ac_cv_lib_bzip2,
  4889. [
  4890. AC_LANG_SAVE
  4891. AC_LANG_CPLUSPLUS
  4892. kde_save_LIBS="$LIBS"
  4893. LIBS="$all_libraries $USER_LDFLAGS -lbz2 $LIBSOCKET"
  4894. kde_save_CXXFLAGS="$CXXFLAGS"
  4895. CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES"
  4896. AC_TRY_LINK(dnl
  4897. [
  4898. #define BZ_NO_STDIO
  4899. #include<bzlib.h>
  4900. ],
  4901. [ bz_stream s; (void) bzDecompress(&s); ],
  4902. eval "ac_cv_lib_bzip2='-lbz2'",
  4903. eval "ac_cv_lib_bzip2=no")
  4904. LIBS="$kde_save_LIBS"
  4905. CXXFLAGS="$kde_save_CXXFLAGS"
  4906. AC_LANG_RESTORE
  4907. ])dnl
  4908. AC_MSG_RESULT($ac_cv_lib_bzip2)
  4909. if test ! "$ac_cv_lib_bzip2" = no; then
  4910. BZIP2DIR=bzip2
  4911. LIBBZ2="$ac_cv_lib_bzip2"
  4912. AC_SUBST(LIBBZ2)
  4913. else
  4914. cxx_shared_flag=
  4915. ld_shared_flag=
  4916. KDE_CHECK_COMPILER_FLAG(shared, [
  4917. ld_shared_flag="-shared"
  4918. ])
  4919. KDE_CHECK_COMPILER_FLAG(fPIC, [
  4920. cxx_shared_flag="-fPIC"
  4921. ])
  4922. AC_MSG_CHECKING([for BZ2_bzDecompress in (shared) libbz2])
  4923. AC_CACHE_VAL(ac_cv_lib_bzip2_prefix,
  4924. [
  4925. AC_LANG_SAVE
  4926. AC_LANG_CPLUSPLUS
  4927. kde_save_LIBS="$LIBS"
  4928. LIBS="$all_libraries $USER_LDFLAGS $ld_shared_flag -lbz2 $LIBSOCKET"
  4929. kde_save_CXXFLAGS="$CXXFLAGS"
  4930. CXXFLAGS="$CFLAGS $cxx_shared_flag $all_includes $USER_INCLUDES"
  4931. AC_TRY_LINK(dnl
  4932. [
  4933. #define BZ_NO_STDIO
  4934. #include<bzlib.h>
  4935. ],
  4936. [ bz_stream s; (void) BZ2_bzDecompress(&s); ],
  4937. eval "ac_cv_lib_bzip2_prefix='-lbz2'",
  4938. eval "ac_cv_lib_bzip2_prefix=no")
  4939. LIBS="$kde_save_LIBS"
  4940. CXXFLAGS="$kde_save_CXXFLAGS"
  4941. AC_LANG_RESTORE
  4942. ])dnl
  4943. AC_MSG_RESULT($ac_cv_lib_bzip2_prefix)
  4944. if test ! "$ac_cv_lib_bzip2_prefix" = no; then
  4945. BZIP2DIR=bzip2
  4946. LIBBZ2="$ac_cv_lib_bzip2_prefix"
  4947. AC_SUBST(LIBBZ2)
  4948. AC_DEFINE(NEED_BZ2_PREFIX, 1, [Define if the libbz2 functions need the BZ2_ prefix])
  4949. dnl else, we just ignore this
  4950. fi
  4951. fi
  4952. AM_CONDITIONAL(include_BZIP2, test -n "$BZIP2DIR")
  4953. ])
  4954. dnl ------------------------------------------------------------------------
  4955. dnl Try to find the SSL headers and libraries.
  4956. dnl $(SSL_LDFLAGS) will be -Lsslliblocation (if needed)
  4957. dnl and $(SSL_INCLUDES) will be -Isslhdrlocation (if needed)
  4958. dnl ------------------------------------------------------------------------
  4959. dnl
  4960. AC_DEFUN([KDE_CHECK_SSL],
  4961. [
  4962. LIBSSL="-lssl -lcrypto"
  4963. AC_REQUIRE([KDE_CHECK_LIB64])
  4964. ac_ssl_includes=NO ac_ssl_libraries=NO
  4965. ssl_libraries=""
  4966. ssl_includes=""
  4967. AC_ARG_WITH(ssl-dir,
  4968. AC_HELP_STRING([--with-ssl-dir=DIR],[where the root of OpenSSL is installed]),
  4969. [ ac_ssl_includes="$withval"/include
  4970. ac_ssl_libraries="$withval"/lib$tdelibsuff
  4971. ])
  4972. want_ssl=yes
  4973. AC_ARG_WITH(ssl,
  4974. AC_HELP_STRING([--without-ssl],[disable SSL checks]),
  4975. [want_ssl=$withval])
  4976. if test $want_ssl = yes; then
  4977. AC_MSG_CHECKING(for OpenSSL)
  4978. AC_CACHE_VAL(ac_cv_have_ssl,
  4979. [#try to guess OpenSSL locations
  4980. ssl_incdirs="/usr/include /usr/local/include /usr/ssl/include /usr/local/ssl/include $prefix/include $kde_extra_includes"
  4981. ssl_incdirs="$ac_ssl_includes $ssl_incdirs"
  4982. AC_FIND_FILE(openssl/ssl.h, $ssl_incdirs, ssl_incdir)
  4983. ac_ssl_includes="$ssl_incdir"
  4984. ssl_libdirs="/usr/lib$tdelibsuff /usr/local/lib$tdelibsuff /usr/ssl/lib$tdelibsuff /usr/local/ssl/lib$tdelibsuff $libdir $prefix/lib$tdelibsuff $exec_prefix/lib$tdelibsuff $kde_extra_libs"
  4985. if test ! "$ac_ssl_libraries" = "NO"; then
  4986. ssl_libdirs="$ac_ssl_libraries $ssl_libdirs"
  4987. fi
  4988. test=NONE
  4989. ssl_libdir=NONE
  4990. for dir in $ssl_libdirs; do
  4991. try="ls -1 $dir/libssl*"
  4992. if test=`eval $try 2> /dev/null`; then ssl_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
  4993. done
  4994. ac_ssl_libraries="$ssl_libdir"
  4995. ac_ldflags_safe="$LDFLAGS"
  4996. ac_libs_safe="$LIBS"
  4997. LDFLAGS="$LDFLAGS -L$ssl_libdir $all_libraries"
  4998. LIBS="$LIBS $LIBSSL -lRSAglue -lrsaref"
  4999. AC_TRY_LINK(,void RSAPrivateEncrypt(void);RSAPrivateEncrypt();,
  5000. ac_ssl_rsaref="yes"
  5001. ,
  5002. ac_ssl_rsaref="no"
  5003. )
  5004. LDFLAGS="$ac_ldflags_safe"
  5005. LIBS="$ac_libs_safe"
  5006. if test "$ac_ssl_includes" = NO || test "$ac_ssl_libraries" = NO; then
  5007. have_ssl=no
  5008. else
  5009. have_ssl=yes;
  5010. fi
  5011. ])
  5012. eval "$ac_cv_have_ssl"
  5013. AC_MSG_RESULT([libraries $ac_ssl_libraries, headers $ac_ssl_includes])
  5014. AC_MSG_CHECKING([whether OpenSSL uses rsaref])
  5015. AC_MSG_RESULT($ac_ssl_rsaref)
  5016. AC_MSG_CHECKING([for easter eggs])
  5017. AC_MSG_RESULT([none found])
  5018. else
  5019. have_ssl=no
  5020. fi
  5021. if test "$have_ssl" = yes; then
  5022. AC_MSG_CHECKING(for OpenSSL version)
  5023. dnl Check for SSL version
  5024. AC_CACHE_VAL(ac_cv_ssl_version,
  5025. [
  5026. cat >conftest.$ac_ext <<EOF
  5027. #include <openssl/opensslv.h>
  5028. #include <stdio.h>
  5029. int main() {
  5030. #ifndef OPENSSL_VERSION_NUMBER
  5031. printf("ssl_version=\\"error\\"\n");
  5032. #else
  5033. if (OPENSSL_VERSION_NUMBER < 0x00906000)
  5034. printf("ssl_version=\\"old\\"\n");
  5035. else
  5036. printf("ssl_version=\\"ok\\"\n");
  5037. #endif
  5038. return (0);
  5039. }
  5040. EOF
  5041. ac_save_CPPFLAGS=$CPPFLAGS
  5042. if test "$ac_ssl_includes" != "/usr/include"; then
  5043. CPPFLAGS="$CPPFLAGS -I$ac_ssl_includes"
  5044. fi
  5045. if AC_TRY_EVAL(ac_link); then
  5046. if eval `./conftest 2>&5`; then
  5047. if test $ssl_version = error; then
  5048. AC_MSG_ERROR([$ssl_incdir/openssl/opensslv.h doesn't define OPENSSL_VERSION_NUMBER !])
  5049. else
  5050. if test $ssl_version = old; then
  5051. AC_MSG_WARN([OpenSSL version too old. Upgrade to 0.9.6 at least, see http://www.openssl.org. SSL support disabled.])
  5052. have_ssl=no
  5053. fi
  5054. fi
  5055. ac_cv_ssl_version="ssl_version=$ssl_version"
  5056. else
  5057. AC_MSG_ERROR([Your system couldn't run a small SSL test program.
  5058. Check config.log, and if you can't figure it out, send a mail to
  5059. David Faure <faure@kde.org>, attaching your config.log])
  5060. fi
  5061. else
  5062. AC_MSG_ERROR([Your system couldn't link a small SSL test program.
  5063. Check config.log, and if you can't figure it out, send a mail to
  5064. David Faure <faure@kde.org>, attaching your config.log])
  5065. fi
  5066. CPPFLAGS=$ac_save_CPPFLAGS
  5067. ])
  5068. eval "$ac_cv_ssl_version"
  5069. AC_MSG_RESULT($ssl_version)
  5070. fi
  5071. if test "$have_ssl" != yes; then
  5072. LIBSSL="";
  5073. else
  5074. AC_DEFINE(HAVE_SSL, 1, [If we are going to use OpenSSL])
  5075. ac_cv_have_ssl="have_ssl=yes \
  5076. ac_ssl_includes=$ac_ssl_includes ac_ssl_libraries=$ac_ssl_libraries ac_ssl_rsaref=$ac_ssl_rsaref"
  5077. ssl_libraries="$ac_ssl_libraries"
  5078. ssl_includes="$ac_ssl_includes"
  5079. if test "$ac_ssl_rsaref" = yes; then
  5080. LIBSSL="-lssl -lcrypto -lRSAglue -lrsaref"
  5081. fi
  5082. if test $ssl_version = "old"; then
  5083. AC_DEFINE(HAVE_OLD_SSL_API, 1, [Define if you have OpenSSL < 0.9.6])
  5084. fi
  5085. fi
  5086. SSL_INCLUDES=
  5087. if test "$ssl_includes" = "/usr/include"; then
  5088. if test -f /usr/kerberos/include/krb5.h; then
  5089. SSL_INCLUDES="-I/usr/kerberos/include"
  5090. fi
  5091. elif test "$ssl_includes" != "/usr/local/include" && test -n "$ssl_includes"; then
  5092. SSL_INCLUDES="-I$ssl_includes"
  5093. fi
  5094. if test "$ssl_libraries" = "/usr/lib" || test "$ssl_libraries" = "/usr/local/lib" || test -z "$ssl_libraries" || test "$ssl_libraries" = "NONE"; then
  5095. SSL_LDFLAGS=""
  5096. else
  5097. SSL_LDFLAGS="-L$ssl_libraries -R$ssl_libraries"
  5098. fi
  5099. AC_SUBST(SSL_INCLUDES)
  5100. AC_SUBST(SSL_LDFLAGS)
  5101. AC_SUBST(LIBSSL)
  5102. ])
  5103. AC_DEFUN([KDE_CHECK_STRLCPY],
  5104. [
  5105. AC_REQUIRE([AC_CHECK_STRLCAT])
  5106. AC_REQUIRE([AC_CHECK_STRLCPY])
  5107. AC_CHECK_SIZEOF(size_t)
  5108. AC_CHECK_SIZEOF(unsigned long)
  5109. AC_MSG_CHECKING([sizeof size_t == sizeof unsigned long])
  5110. AC_TRY_COMPILE(,[
  5111. #if SIZEOF_SIZE_T != SIZEOF_UNSIGNED_LONG
  5112. choke me
  5113. #endif
  5114. ],AC_MSG_RESULT([yes]),[
  5115. AC_MSG_RESULT(no)
  5116. AC_MSG_ERROR([
  5117. Apparently on your system our assumption sizeof size_t == sizeof unsigned long
  5118. does not apply. Please mail kde-devel@kde.org with a description of your system!
  5119. ])
  5120. ])
  5121. ])
  5122. AC_DEFUN([KDE_CHECK_BINUTILS],
  5123. [
  5124. AC_MSG_CHECKING([if ld supports unversioned version maps])
  5125. kde_save_LDFLAGS="$LDFLAGS"
  5126. LDFLAGS="$LDFLAGS -Wl,--version-script=conftest.map"
  5127. echo "{ local: extern \"C++\" { foo }; };" > conftest.map
  5128. AC_TRY_LINK([int foo;],
  5129. [
  5130. #ifdef __INTEL_COMPILER
  5131. icc apparently does not support libtools version-info and version-script
  5132. at the same time. Dunno where the bug is, but until somebody figured out,
  5133. better disable the optional version scripts.
  5134. #endif
  5135. foo = 42;
  5136. ], kde_supports_versionmaps=yes, kde_supports_versionmaps=no)
  5137. LDFLAGS="$kde_save_LDFLAGS"
  5138. rm -f conftest.map
  5139. AM_CONDITIONAL(include_VERSION_SCRIPT,
  5140. [test "$kde_supports_versionmaps" = "yes" && test "$kde_use_debug_code" = "no"])
  5141. AC_MSG_RESULT($kde_supports_versionmaps)
  5142. ])
  5143. AC_DEFUN([AM_PROG_OBJC],[
  5144. AC_CHECK_PROGS(OBJC, gcc, gcc)
  5145. test -z "$OBJC" && AC_MSG_ERROR([no acceptable objective-c gcc found in \$PATH])
  5146. if test "x${OBJCFLAGS-unset}" = xunset; then
  5147. OBJCFLAGS="-g -O2"
  5148. fi
  5149. AC_SUBST(OBJCFLAGS)
  5150. _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(OBJC)])
  5151. ])
  5152. AC_DEFUN([KDE_CHECK_PERL],
  5153. [
  5154. KDE_FIND_PATH(perl, PERL, [$bindir $exec_prefix/bin $prefix/bin], [
  5155. AC_MSG_ERROR([No Perl found in your $PATH.
  5156. We need perl to generate some code.])
  5157. ])
  5158. AC_SUBST(PERL)
  5159. ])
  5160. AC_DEFUN([KDE_CHECK_LARGEFILE],
  5161. [
  5162. AC_SYS_LARGEFILE
  5163. if test "$ac_cv_sys_file_offset_bits" != no; then
  5164. CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
  5165. fi
  5166. if test "x$ac_cv_sys_large_files" != "xno"; then
  5167. CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=1"
  5168. fi
  5169. ])
  5170. dnl A small extension to PKG_CHECK_MODULES (defined in pkg.m4.in)
  5171. dnl which allows to search for libs that get installed into the KDE prefix.
  5172. dnl
  5173. dnl Syntax: KDE_PKG_CHECK_MODULES(KSTUFF, libkexif >= 0.2 glib = 1.3.4, action-if, action-not)
  5174. dnl defines KSTUFF_LIBS, KSTUFF_CFLAGS, see pkg-config man page
  5175. dnl also defines KSTUFF_PKG_ERRORS on error
  5176. AC_DEFUN([KDE_PKG_CHECK_MODULES], [
  5177. PKG_CONFIG_PATH="$prefix/lib${tdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
  5178. if test "$prefix" != "$kde_libs_prefix"; then
  5179. PKG_CONFIG_PATH="$kde_libs_prefix/lib${tdelibsuff}/pkgconfig:$PKG_CONFIG_PATH"
  5180. fi
  5181. export PKG_CONFIG_PATH
  5182. PKG_CHECK_MODULES([$1],[$2],[$3],[$4])
  5183. ])
  5184. dnl Check for PIE support in the compiler and linker
  5185. AC_DEFUN([KDE_CHECK_PIE_SUPPORT],
  5186. [
  5187. AC_CACHE_CHECK([for PIE support], kde_cv_val_pie_support,
  5188. [
  5189. AC_LANG_SAVE
  5190. AC_LANG_CPLUSPLUS
  5191. safe_CXXFLAGS=$CXXFLAGS
  5192. safe_LDFLAGS=$LDFLAGS
  5193. CXXFLAGS="$CXXFLAGS -fPIE"
  5194. LDFLAGS="$LDFLAGS -pie"
  5195. AC_TRY_LINK([int foo;], [], [kde_cv_val_pie_support=yes], [kde_cv_val_pie_support=no])
  5196. CXXFLAGS=$safe_CXXFLAGS
  5197. LDFLAGS=$safe_LDFLAGS
  5198. AC_LANG_RESTORE
  5199. ])
  5200. AC_MSG_CHECKING(if enabling -pie/fPIE support)
  5201. AC_ARG_ENABLE(pie,
  5202. AC_HELP_STRING([--enable-pie],[platform supports PIE linking [default=detect]]),
  5203. [kde_has_pie_support=$enableval],
  5204. [kde_has_pie_support=detect])
  5205. if test "$kde_has_pie_support" = "detect"; then
  5206. kde_has_pie_support=$kde_cv_val_pie_support
  5207. fi
  5208. AC_MSG_RESULT([$kde_has_pie_support])
  5209. KDE_USE_FPIE=""
  5210. KDE_USE_PIE=""
  5211. AC_SUBST([KDE_USE_FPIE])
  5212. AC_SUBST([KDE_USE_PIE])
  5213. if test "$kde_has_pie_support" = "yes"; then
  5214. KDE_USE_FPIE="-fPIE"
  5215. KDE_USE_PIE="-pie"
  5216. fi
  5217. ])