configure.ac 185 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565
  1. dnl Autoconf script for GNU Emacs
  2. dnl To rebuild the 'configure' script from this, execute the command
  3. dnl autoconf
  4. dnl in the directory containing this script.
  5. dnl If you changed any AC_DEFINES, also run autoheader.
  6. dnl
  7. dnl Copyright (C) 1994-1996, 1999-2017 Free Software Foundation, Inc.
  8. dnl
  9. dnl This file is part of GNU Emacs.
  10. dnl
  11. dnl GNU Emacs is free software: you can redistribute it and/or modify
  12. dnl it under the terms of the GNU General Public License as published by
  13. dnl the Free Software Foundation, either version 3 of the License, or
  14. dnl (at your option) any later version.
  15. dnl
  16. dnl GNU Emacs is distributed in the hope that it will be useful,
  17. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. dnl GNU General Public License for more details.
  20. dnl
  21. dnl You should have received a copy of the GNU General Public License
  22. dnl along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  23. AC_PREREQ(2.65)
  24. dnl Note this is parsed by (at least) make-dist and lisp/cedet/ede/emacs.el.
  25. AC_INIT(GNU Emacs, 26.0.50, bug-gnu-emacs@gnu.org)
  26. dnl Set emacs_config_options to the options of 'configure', quoted for the shell,
  27. dnl and then quoted again for a C string. Separate options with spaces.
  28. dnl Add some environment variables, if they were passed via the environment
  29. dnl rather than on the command-line.
  30. emacs_config_options=
  31. optsep=
  32. dnl This is the documented way to record the args passed to configure,
  33. dnl rather than $ac_configure_args.
  34. for opt in "$@" CFLAGS CPPFLAGS LDFLAGS; do
  35. case $opt in
  36. -n | --no-create | --no-recursion)
  37. continue ;;
  38. CFLAGS | CPPFLAGS | LDFLAGS)
  39. eval 'test "${'$opt'+set}" = set' || continue
  40. case " $*" in
  41. *" $opt="*) continue ;;
  42. esac
  43. eval opt=$opt=\$$opt ;;
  44. esac
  45. emacs_shell_specials=$IFS\''"#$&()*;<>?@<:@\\`{|~'
  46. case $opt in
  47. *[["$emacs_shell_specials"]]*)
  48. case $opt in
  49. *\'*)
  50. emacs_quote_apostrophes="s/'/'\\\\''/g"
  51. opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_apostrophes"` ;;
  52. esac
  53. opt="'$opt'"
  54. case $opt in
  55. *[['"\\']]*)
  56. emacs_quote_for_c='s/[["\\]]/\\&/g; $!s/$/\\n\\/'
  57. opt=`AS_ECHO(["$opt"]) | sed "$emacs_quote_for_c"` ;;
  58. esac ;;
  59. esac
  60. AS_VAR_APPEND([emacs_config_options], ["$optsep$opt"])
  61. optsep=' '
  62. done
  63. AC_CONFIG_HEADERS(src/config.h:src/config.in)
  64. AC_CONFIG_SRCDIR(src/lisp.h)
  65. AC_CONFIG_AUX_DIR(build-aux)
  66. AC_CONFIG_MACRO_DIR(m4)
  67. xcsdkdir=
  68. AC_CHECK_PROGS(XCRUN, [xcrun])
  69. if test -n "$XCRUN"; then
  70. if test -z "$MAKE"; then
  71. dnl Call the variable MAKE_PROG, not MAKE, to avoid confusion with
  72. dnl the usual MAKE variable that 'make' itself uses.
  73. AC_CHECK_PROG([MAKE_PROG], [make], [yes])
  74. if test -z "$MAKE_PROG"; then
  75. MAKE="$XCRUN MAKE"
  76. export MAKE
  77. xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
  78. fi
  79. fi
  80. fi
  81. dnl Check for GNU Make and possibly set MAKE.
  82. [emacs_check_gnu_make ()
  83. {
  84. emacs_makeout=`($1 --version) 2>/dev/null` &&
  85. case $emacs_makeout in
  86. 'GNU Make '3.8[1-9]* | 'GNU Make '3.9[0-9]* | \
  87. 'GNU Make '3.[1-9][0-9][0-9]* | 'GNU Make '[4-9]* | 'GNU Make '[1-9][0-9]* )
  88. ac_path_MAKE_found=:;;
  89. esac
  90. }]
  91. AC_CACHE_CHECK([for GNU Make], [ac_cv_path_MAKE],
  92. [ac_path_MAKE_found=false
  93. if test -n "$MAKE"; then
  94. emacs_check_gnu_make "$MAKE"
  95. ac_cv_path_MAKE=$MAKE
  96. else
  97. emacs_tried_make=false
  98. emacs_tried_gmake=false
  99. emacs_tried_gnumake=false
  100. AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake gnumake],
  101. [[emacs_check_gnu_make "$ac_path_MAKE"
  102. if $ac_path_MAKE_found; then
  103. # Use the fully-qualified program name only if the basename
  104. # would not resolve to it.
  105. if eval \$emacs_tried_$ac_prog; then
  106. ac_cv_path_MAKE=$ac_path_MAKE
  107. else
  108. ac_cv_path_MAKE=$ac_prog
  109. fi
  110. fi
  111. eval emacs_tried_$ac_prog=:]])
  112. fi])
  113. $ac_path_MAKE_found || {
  114. AC_MSG_ERROR([[Building Emacs requires GNU Make, at least version 3.81.
  115. If you have it installed under another name, configure with 'MAKE=...'.
  116. For example, run '$0 MAKE=gnu-make'.]])
  117. }
  118. MAKE=$ac_cv_path_MAKE
  119. export MAKE
  120. dnl Canonicalize the configuration name.
  121. AC_CANONICAL_HOST
  122. case $host in
  123. *-mingw*)
  124. if test -z "$host_alias"; then
  125. # No --host argument was given to 'configure'; therefore $host
  126. # was set to a default value based on the build platform. But
  127. # this default value may be wrong if we are building from a
  128. # 64-bit MSYS[2] pre-configured to build 32-bit MinGW programs.
  129. # Therefore, we'll try to get the right host platform from the
  130. # compiler's target.
  131. AC_MSG_CHECKING([the compiler's target])
  132. if test -z "$CC"; then
  133. cc=gcc
  134. else
  135. cc=$CC
  136. fi
  137. cc_target=`$cc -v 2>&1 | sed -n 's/Target: //p'`
  138. case "$cc_target" in
  139. *-*) host=$cc_target
  140. ;;
  141. "") AC_MSG_ERROR([Impossible to obtain $cc compiler target.
  142. Please explicitly provide --host.])
  143. ;;
  144. *) AC_MSG_WARN([Compiler reported non-standard target.
  145. Defaulting to $host.])
  146. ;;
  147. esac
  148. AC_MSG_RESULT([$host])
  149. fi
  150. . $srcdir/nt/mingw-cfg.site
  151. case $srcdir in
  152. /* | ?:*)
  153. # srcdir is an absolute path. In this case, force the format
  154. # "/c/foo/bar", to simplify later conversions to native Windows
  155. # format ("c:/foo/bar").
  156. srcdir=`cd "${srcdir}" && pwd -W`
  157. # 'eval' pacifies strict POSIX non-MinGW shells (Bug#18612).
  158. eval 'srcdir="/${srcdir:0:1}${srcdir:2}"'
  159. ;;
  160. esac;;
  161. esac
  162. canonical=$host
  163. configuration=${host_alias-${build_alias-$host}}
  164. emacs_uname_r=`uname -r`
  165. dnl Support for --program-prefix, --program-suffix and
  166. dnl --program-transform-name options
  167. AC_ARG_PROGRAM
  168. dnl It is important that variables on the RHS not be expanded here,
  169. dnl hence the single quotes. This is per the GNU coding standards, see
  170. dnl (autoconf) Installation Directory Variables
  171. dnl See also epaths.h below.
  172. lispdir='${datadir}/emacs/${version}/lisp'
  173. standardlisppath='${lispdir}'
  174. locallisppath='${datadir}/emacs/${version}/site-lisp:'\
  175. '${datadir}/emacs/site-lisp'
  176. lisppath='${locallisppath}:${standardlisppath}'
  177. etcdir='${datadir}/emacs/${version}/etc'
  178. archlibdir='${libexecdir}/emacs/${version}/${configuration}'
  179. etcdocdir='${datadir}/emacs/${version}/etc'
  180. gamedir='${localstatedir}/games/emacs'
  181. dnl Special option to disable the most of other options.
  182. AC_ARG_WITH(all,
  183. [AS_HELP_STRING([--without-all],
  184. [omit almost all features and build
  185. small executable with minimal dependencies])],
  186. [with_features=$withval],
  187. [with_features=yes])
  188. dnl OPTION_DEFAULT_OFF(NAME, HELP-STRING)
  189. dnl Create a new --with option that defaults to being disabled.
  190. dnl NAME is the base name of the option. The shell variable with_NAME
  191. dnl will be set to either the user's value (if the option is
  192. dnl specified; 'yes' for a plain --with-NAME) or to 'no' (if the
  193. dnl option is not specified). Note that the shell variable name is
  194. dnl constructed as autoconf does, by replacing non-alphanumeric
  195. dnl characters with "_".
  196. dnl HELP-STRING is the help text for the option.
  197. AC_DEFUN([OPTION_DEFAULT_OFF], [dnl
  198. AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl
  199. m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl
  200. ])dnl
  201. dnl OPTION_DEFAULT_ON(NAME, HELP-STRING)
  202. dnl Create a new --with option that defaults to $with_features.
  203. dnl NAME is the base name of the option. The shell variable with_NAME
  204. dnl will be set either to 'no' (for a plain --without-NAME) or to
  205. dnl 'yes' (if the option is not specified). Note that the shell
  206. dnl variable name is constructed as autoconf does, by replacing
  207. dnl non-alphanumeric characters with "_".
  208. dnl HELP-STRING is the help text for the option.
  209. AC_DEFUN([OPTION_DEFAULT_ON], [dnl
  210. AC_ARG_WITH([$1],[AS_HELP_STRING([--without-$1],[$2])],[],[dnl
  211. m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=$with_features])dnl
  212. ])dnl
  213. # FIXME: The default options '--without-mailutils --with-pop' result
  214. # in a movemail implementation that supports only unencrypted POP3
  215. # connections. Encrypted connections should be the default.
  216. AC_ARG_WITH([mailutils],
  217. [AS_HELP_STRING([--with-mailutils],
  218. [rely on GNU Mailutils, so that the --without-pop through --with-mailhost
  219. options are irrelevant; this is the default if GNU Mailutils is
  220. installed])],
  221. [],
  222. [with_mailutils=$with_features
  223. if test "$with_mailutils" = yes; then
  224. (movemail --version) >/dev/null 2>&1 || with_mailutils=no
  225. fi])
  226. if test "$with_mailutils" = no; then
  227. with_mailutils=
  228. fi
  229. AC_SUBST([with_mailutils])
  230. OPTION_DEFAULT_ON([pop],
  231. [don't support POP mail retrieval with movemail (--without-pop or
  232. --with-mailutils is recommended, as movemail POP is insecure)])
  233. if test "$with_pop" = yes; then
  234. AC_DEFINE(MAIL_USE_POP)
  235. fi
  236. AH_TEMPLATE(MAIL_USE_POP, [Define to support POP mail retrieval.])dnl
  237. OPTION_DEFAULT_OFF([kerberos],[support Kerberos-authenticated POP])
  238. if test "$with_kerberos" != no; then
  239. AC_DEFINE(KERBEROS)
  240. fi
  241. AH_TEMPLATE(KERBEROS,
  242. [Define to support Kerberos-authenticated POP mail retrieval.])dnl
  243. OPTION_DEFAULT_OFF([kerberos5],[support Kerberos version 5 authenticated POP])
  244. if test "${with_kerberos5}" != no; then
  245. if test "${with_kerberos}" = no; then
  246. with_kerberos=yes
  247. AC_DEFINE(KERBEROS)
  248. fi
  249. AC_DEFINE(KERBEROS5, 1, [Define to use Kerberos 5 instead of Kerberos 4.])
  250. fi
  251. OPTION_DEFAULT_OFF([hesiod],[support Hesiod to get the POP server host])
  252. dnl FIXME hesiod support may not be present, so it seems like an error
  253. dnl to define, or at least use, this unconditionally.
  254. if test "$with_hesiod" != no; then
  255. AC_DEFINE(HESIOD, 1, [Define to support using a Hesiod database to find the POP server.])
  256. fi
  257. OPTION_DEFAULT_OFF([mail-unlink],[unlink, rather than empty, mail spool after reading])
  258. if test "$with_mail_unlink" != no; then
  259. AC_DEFINE(MAIL_UNLINK_SPOOL, 1, [Define to unlink, rather than empty, mail spool after reading.])
  260. fi
  261. AC_ARG_WITH([mailhost],[AS_HELP_STRING([--with-mailhost=HOSTNAME],
  262. [string giving default POP mail host])],
  263. AC_DEFINE_UNQUOTED(MAILHOST, ["$withval"], [String giving fallback POP mail host.]))
  264. AC_ARG_WITH([sound],[AS_HELP_STRING([--with-sound=VALUE],
  265. [compile with sound support (VALUE one of: yes, alsa, oss, bsd-ossaudio, no;
  266. default yes). Only for GNU/Linux, FreeBSD, NetBSD, MinGW, Cygwin.])],
  267. [ case "${withval}" in
  268. yes|no|alsa|oss|bsd-ossaudio) val=$withval ;;
  269. *) AC_MSG_ERROR(['--with-sound=$withval' is invalid;
  270. this option's value should be 'yes', 'no', 'alsa', 'oss', or 'bsd-ossaudio'.])
  271. ;;
  272. esac
  273. with_sound=$val
  274. ],
  275. [with_sound=$with_features])
  276. dnl FIXME currently it is not the last.
  277. dnl This should be the last --with option, because --with-x is
  278. dnl added later on when we find the file name of X, and it's best to
  279. dnl keep them together visually.
  280. AC_ARG_WITH([x-toolkit],[AS_HELP_STRING([--with-x-toolkit=KIT],
  281. [use an X toolkit (KIT one of: yes or gtk, gtk2, gtk3, lucid or athena, motif, no)])],
  282. [ case "${withval}" in
  283. y | ye | yes ) val=gtk ;;
  284. n | no ) val=no ;;
  285. l | lu | luc | luci | lucid ) val=lucid ;;
  286. a | at | ath | athe | athen | athena ) val=athena ;;
  287. m | mo | mot | moti | motif ) val=motif ;;
  288. g | gt | gtk ) val=gtk ;;
  289. gtk2 ) val=gtk2 ;;
  290. gtk3 ) val=gtk3 ;;
  291. * )
  292. AC_MSG_ERROR(['--with-x-toolkit=$withval' is invalid;
  293. this option's value should be 'yes', 'no', 'lucid', 'athena', 'motif', 'gtk',
  294. 'gtk2' or 'gtk3'. 'yes' and 'gtk' are synonyms.
  295. 'athena' and 'lucid' are synonyms.])
  296. ;;
  297. esac
  298. with_x_toolkit=$val
  299. ])
  300. OPTION_DEFAULT_OFF([wide-int], [prefer wide Emacs integers (typically 62-bit); allows buffer and string size up to 2GB on 32-bit hosts, at the cost of 10% to 30% slowdown of Lisp interpreter and larger memory footprint])
  301. if test "$with_wide_int" = yes; then
  302. AC_DEFINE([WIDE_EMACS_INT], 1, [Use long long for EMACS_INT if available.])
  303. fi
  304. dnl _ON results in a '--without' option in the --help output, so
  305. dnl the help text should refer to "don't compile", etc.
  306. with_xpm_set=${with_xpm+set}
  307. OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
  308. OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
  309. OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
  310. OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
  311. OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
  312. OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
  313. OPTION_DEFAULT_ON([libsystemd],[don't compile with libsystemd support])
  314. OPTION_DEFAULT_OFF([cairo],[compile with Cairo drawing (experimental)])
  315. OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
  316. OPTION_DEFAULT_ON([imagemagick],[don't compile with ImageMagick image support])
  317. OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
  318. OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
  319. OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])
  320. OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
  321. OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
  322. OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
  323. AC_ARG_WITH([ns],[AS_HELP_STRING([--with-ns],
  324. [use Nextstep (macOS Cocoa or GNUstep) windowing system.
  325. On by default on macOS.])],[],[with_ns=maybe])
  326. OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build])
  327. OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
  328. OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
  329. AC_ARG_WITH([gconf],[AS_HELP_STRING([--with-gconf],
  330. [compile with Gconf support (Gsettings replaces this)])],[],[with_gconf=maybe])
  331. OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
  332. OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
  333. OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
  334. OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support])
  335. OPTION_DEFAULT_OFF([modules],[compile with dynamic modules support])
  336. OPTION_DEFAULT_ON([threads],[don't compile with elisp threading support])
  337. AC_ARG_WITH([file-notification],[AS_HELP_STRING([--with-file-notification=LIB],
  338. [use a file notification library (LIB one of: yes, inotify, kqueue, gfile, w32, no)])],
  339. [ case "${withval}" in
  340. y | ye | yes ) val=yes ;;
  341. n | no ) val=no ;;
  342. i | in | ino | inot | inoti | inotif | inotify ) val=inotify ;;
  343. k | kq | kqu | kque | kqueu | kqueue ) val=kqueue ;;
  344. g | gf | gfi | gfil | gfile ) val=gfile ;;
  345. w | w3 | w32 ) val=w32 ;;
  346. * ) AC_MSG_ERROR(['--with-file-notification=$withval' is invalid;
  347. this option's value should be 'yes', 'no', 'inotify', 'kqueue', 'gfile' or 'w32'.
  348. 'yes' is a synonym for 'w32' on MS-Windows, for 'no' on Nextstep,
  349. otherwise for the first of 'inotify', 'kqueue' or 'gfile' that is usable.])
  350. ;;
  351. esac
  352. with_file_notification=$val
  353. ],
  354. [with_file_notification=$with_features])
  355. OPTION_DEFAULT_OFF([xwidgets],
  356. [enable use of some gtk widgets in Emacs buffers (requires gtk3)])
  357. ## For the times when you want to build Emacs but don't have
  358. ## a suitable makeinfo, and can live without the manuals.
  359. dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
  360. OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
  361. ## Makefile.in needs the cache file name.
  362. AC_SUBST(cache_file)
  363. ## This is an option because I do not know if all info/man support
  364. ## compressed files, nor how to test if they do so.
  365. OPTION_DEFAULT_ON([compress-install],
  366. [don't compress some files (.el, .info, etc.) when installing. Equivalent to:
  367. make GZIP_PROG= install])
  368. AC_ARG_WITH(gameuser,dnl
  369. [AS_HELP_STRING([--with-gameuser=USER_OR_GROUP],
  370. [user for shared game score files.
  371. An argument prefixed by ':' specifies a group instead.])])
  372. gameuser=
  373. gamegroup=
  374. case ${with_gameuser} in
  375. '' | no) ;;
  376. yes) gamegroup=games ;;
  377. :*) gamegroup=${with_gameuser#:} ;;
  378. *) gameuser=${with_gameuser} ;;
  379. esac
  380. AC_ARG_WITH([gnustep-conf],dnl
  381. [AS_HELP_STRING([--with-gnustep-conf=FILENAME],
  382. [name of GNUstep configuration file to use on systems where the command
  383. 'gnustep-config' does not work; default $GNUSTEP_CONFIG_FILE, or
  384. /etc/GNUstep/GNUstep.conf])])
  385. test "X${with_gnustep_conf}" != X && test "${with_gnustep_conf}" != yes && \
  386. GNUSTEP_CONFIG_FILE="${with_gnustep_conf}"
  387. test "X$GNUSTEP_CONFIG_FILE" = "X" && \
  388. GNUSTEP_CONFIG_FILE=/etc/GNUstep/GNUstep.conf
  389. AC_ARG_ENABLE(ns-self-contained,
  390. [AS_HELP_STRING([--disable-ns-self-contained],
  391. [disable self contained build under NeXTstep])],
  392. EN_NS_SELF_CONTAINED=$enableval,
  393. EN_NS_SELF_CONTAINED=yes)
  394. locallisppathset=no
  395. AC_ARG_ENABLE(locallisppath,
  396. [AS_HELP_STRING([--enable-locallisppath=PATH],
  397. [directories Emacs should search for lisp files specific
  398. to this site])],
  399. if test "${enableval}" = "no"; then
  400. locallisppath=
  401. elif test "${enableval}" != "yes"; then
  402. locallisppath=${enableval} locallisppathset=yes
  403. fi)
  404. AC_ARG_ENABLE(checking,
  405. [AS_HELP_STRING([--enable-checking@<:@=LIST@:>@],
  406. [enable expensive run-time checks. With LIST,
  407. enable only specific categories of checks.
  408. Categories are: all,yes,no.
  409. Flags are: stringbytes, stringoverrun, stringfreelist,
  410. xmallocoverrun, conslist, glyphs])],
  411. [ac_checking_flags="${enableval}"],[])
  412. IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="$IFS,"
  413. for check in $ac_checking_flags
  414. do
  415. case $check in
  416. # these set all the flags to specific states
  417. yes) ac_enable_checking=1 ;;
  418. no) ac_enable_checking= ;
  419. ac_gc_check_stringbytes= ;
  420. ac_gc_check_string_overrun= ;
  421. ac_gc_check_string_free_list= ;
  422. ac_xmalloc_overrun= ;
  423. ac_gc_check_cons_list= ;
  424. ac_glyphs_debug= ;;
  425. all) ac_enable_checking=1 ;
  426. ac_gc_check_stringbytes=1 ;
  427. ac_gc_check_string_overrun=1 ;
  428. ac_gc_check_string_free_list=1 ;
  429. ac_xmalloc_overrun=1 ;
  430. ac_gc_check_cons_list=1 ;
  431. ac_glyphs_debug=1 ;;
  432. # these enable particular checks
  433. stringbytes) ac_gc_check_stringbytes=1 ;;
  434. stringoverrun) ac_gc_check_string_overrun=1 ;;
  435. stringfreelist) ac_gc_check_string_free_list=1 ;;
  436. xmallocoverrun) ac_xmalloc_overrun=1 ;;
  437. conslist) ac_gc_check_cons_list=1 ;;
  438. glyphs) ac_glyphs_debug=1 ;;
  439. *) AC_MSG_ERROR(unknown check category $check) ;;
  440. esac
  441. done
  442. IFS="$ac_save_IFS"
  443. if test x$ac_enable_checking != x ; then
  444. AC_DEFINE(ENABLE_CHECKING, 1,
  445. [Define to 1 if expensive run-time data type and consistency checks are enabled.])
  446. fi
  447. if test x$ac_gc_check_stringbytes != x ; then
  448. AC_DEFINE(GC_CHECK_STRING_BYTES, 1,
  449. [Define this temporarily to hunt a bug. If defined, the size of
  450. strings is redundantly recorded in sdata structures so that it can
  451. be compared to the sizes recorded in Lisp strings.])
  452. fi
  453. if test x$ac_gc_check_string_overrun != x ; then
  454. AC_DEFINE(GC_CHECK_STRING_OVERRUN, 1,
  455. [Define this to check for short string overrun.])
  456. fi
  457. if test x$ac_gc_check_string_free_list != x ; then
  458. AC_DEFINE(GC_CHECK_STRING_FREE_LIST, 1,
  459. [Define this to check the string free list.])
  460. fi
  461. if test x$ac_xmalloc_overrun != x ; then
  462. AC_DEFINE(XMALLOC_OVERRUN_CHECK, 1,
  463. [Define this to check for malloc buffer overrun.])
  464. fi
  465. if test x$ac_gc_check_cons_list != x ; then
  466. AC_DEFINE(GC_CHECK_CONS_LIST, 1,
  467. [Define this to check for errors in cons list.])
  468. fi
  469. if test x$ac_glyphs_debug != x ; then
  470. AC_DEFINE(GLYPH_DEBUG, 1,
  471. [Define this to enable glyphs debugging code.])
  472. fi
  473. dnl The name of this option is unfortunate. It predates, and has no
  474. dnl relation to, the "sampling-based elisp profiler" added in 24.3.
  475. dnl Actually, it stops it working.
  476. dnl http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00393.html
  477. AC_ARG_ENABLE(profiling,
  478. [AS_HELP_STRING([--enable-profiling],
  479. [build emacs with low-level, gprof profiling support.
  480. Mainly useful for debugging Emacs itself. May not work on
  481. all platforms. Stops profiler.el working.])],
  482. [ac_enable_profiling="${enableval}"],[])
  483. if test x$ac_enable_profiling != x ; then
  484. PROFILING_CFLAGS="-DPROFILING=1 -pg"
  485. else
  486. PROFILING_CFLAGS=
  487. fi
  488. AC_SUBST(PROFILING_CFLAGS)
  489. AC_ARG_ENABLE(autodepend,
  490. [AS_HELP_STRING([--enable-autodepend],
  491. [automatically generate dependencies to .h-files.
  492. Requires gcc, enabled if found.])],
  493. [ac_enable_autodepend="${enableval}"],[ac_enable_autodepend=yes])
  494. AC_ARG_ENABLE(gtk-deprecation-warnings,
  495. [AS_HELP_STRING([--enable-gtk-deprecation-warnings],
  496. [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
  497. [ac_enable_gtk_deprecation_warnings="${enableval}"],[])
  498. BUILD_DETAILS=
  499. AC_ARG_ENABLE([build-details],
  500. [AS_HELP_STRING([--disable-build-details],
  501. [Make the build more deterministic by omitting host
  502. names, time stamps, etc. from the output.])],
  503. [test "$enableval" = no && BUILD_DETAILS=--no-build-details])
  504. AC_SUBST([BUILD_DETAILS])
  505. dnl This used to use changequote, but, apart from 'changequote is evil'
  506. dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
  507. dnl the great gob of text. Thus it's not processed for possible expansion.
  508. dnl Just make sure the brackets remain balanced.
  509. dnl
  510. dnl Since Emacs can't find matching pairs of quotes, boundaries are
  511. dnl indicated by comments.
  512. dnl quotation begins
  513. [
  514. ### If you add support for a new configuration, add code to this
  515. ### switch statement to recognize your configuration name and select
  516. ### the appropriate opsys.
  517. ### As far as handling version numbers on operating systems is
  518. ### concerned, make sure things will fail in a fixable way. If
  519. ### /etc/MACHINES doesn't say anything about version numbers, be
  520. ### prepared to handle anything reasonably. If version numbers
  521. ### matter, be sure /etc/MACHINES says something about it.
  522. opsys='' unported=no
  523. case "${canonical}" in
  524. ## GNU/Linux and similar ports
  525. *-*-linux* )
  526. opsys=gnu-linux
  527. ;;
  528. ## FreeBSD ports
  529. *-*-freebsd* )
  530. opsys=freebsd
  531. ;;
  532. ## DragonFly ports
  533. *-*-dragonfly* )
  534. opsys=dragonfly
  535. ;;
  536. ## FreeBSD kernel + glibc based userland
  537. *-*-kfreebsd*gnu* )
  538. opsys=gnu-kfreebsd
  539. ;;
  540. ## NetBSD ports
  541. *-*-netbsd* )
  542. opsys=netbsd
  543. ;;
  544. ## OpenBSD ports
  545. *-*-openbsd* | *-*-mirbsd* )
  546. opsys=openbsd
  547. ;;
  548. ## Apple Darwin / macOS
  549. *-apple-darwin* )
  550. case "${canonical}" in
  551. *-apple-darwin[0-9].*) unported=yes ;;
  552. i[3456]86-* | x86_64-* ) ;;
  553. * ) unported=yes ;;
  554. esac
  555. opsys=darwin
  556. ## FIXME: Find a way to use Fink if available (Bug#11507).
  557. ;;
  558. ## Chromium Native Client
  559. *-nacl )
  560. opsys=nacl
  561. ;;
  562. ## Cygwin ports
  563. *-*-cygwin )
  564. opsys=cygwin
  565. ;;
  566. ## HP 9000 series 700 and 800, running HP/UX
  567. hppa*-hp-hpux10.2* )
  568. opsys=hpux10-20
  569. ;;
  570. hppa*-hp-hpux1[1-9]* )
  571. opsys=hpux11
  572. CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
  573. ;;
  574. ## IBM machines
  575. rs6000-ibm-aix4.[23]* )
  576. opsys=aix4-2
  577. ;;
  578. powerpc-ibm-aix4.[23]* )
  579. opsys=aix4-2
  580. ;;
  581. rs6000-ibm-aix[56]* )
  582. opsys=aix4-2
  583. ;;
  584. powerpc-ibm-aix[5-9]* | powerpc-ibm-aix[1-9][0-9]* )
  585. opsys=aix4-2
  586. ;;
  587. ## Suns
  588. *-sun-solaris* \
  589. | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
  590. | x86_64-*-solaris2* | x86_64-*-sunos5*)
  591. case "${canonical}" in
  592. i[3456]86-*-* ) ;;
  593. amd64-*-*|x86_64-*-*) ;;
  594. sparc* ) ;;
  595. * ) unported=yes ;;
  596. esac
  597. case "${canonical}" in
  598. *-sunos5.[1-9][0-9]* | *-solaris2.[1-9][0-9]* )
  599. opsys=sol2-10
  600. emacs_check_sunpro_c=yes
  601. ;;
  602. *-sunos5.[1-5]* | *-solaris2.[1-5]* ) unported=yes ;;
  603. ## Note that Emacs 23.1's NEWS said the following would be dropped.
  604. *-sunos5.6* | *-solaris2.6* )
  605. opsys=sol2-6
  606. RANLIB="ar -ts"
  607. ;;
  608. ## 5.7 EOL Aug 2008, 5.8 EOL Mar 2012.
  609. *-sunos5.[7-9]* | *-solaris2.[7-9]* )
  610. opsys=sol2-6
  611. emacs_check_sunpro_c=yes
  612. ;;
  613. esac
  614. ## Watch out for a compiler that we know will not work.
  615. case "${canonical}" in
  616. *-solaris* | *-sunos5* )
  617. if [ "x$CC" = x/usr/ucb/cc ]; then
  618. ## /usr/ucb/cc doesn't work;
  619. ## we should find some other compiler that does work.
  620. unset CC
  621. fi
  622. ;;
  623. *) ;;
  624. esac
  625. ;;
  626. ## Intel 386 machines where we don't care about the manufacturer.
  627. i[3456]86-*-* )
  628. case "${canonical}" in
  629. *-darwin* ) opsys=darwin ;;
  630. *-mingw* )
  631. opsys=mingw32
  632. # MinGW overrides and adds some system headers in nt/inc.
  633. GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
  634. ;;
  635. *-sysv4.2uw* ) opsys=unixware ;;
  636. *-sysv5uw* ) opsys=unixware ;;
  637. *-sysv5OpenUNIX* ) opsys=unixware ;;
  638. ## Otherwise, we'll fall through to the generic opsys code at the bottom.
  639. esac
  640. ;;
  641. # MinGW64
  642. x86_64-*-* )
  643. case "${canonical}" in
  644. *-mingw* )
  645. opsys=mingw32
  646. # MinGW overrides and adds some system headers in nt/inc.
  647. GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
  648. ;;
  649. ## Otherwise, we'll fall through to the generic opsys code at the bottom.
  650. esac
  651. ;;
  652. * )
  653. unported=yes
  654. ;;
  655. esac
  656. ### If the code above didn't choose an operating system, just choose
  657. ### an operating system based on the configuration name. You really
  658. ### only want to use this when you have no idea what the right
  659. ### operating system is; if you know what operating systems a machine
  660. ### runs, it's cleaner to make it explicit in the case statement
  661. ### above.
  662. if test x"${opsys}" = x; then
  663. case "${canonical}" in
  664. *-gnu* ) opsys=gnu ;;
  665. * )
  666. unported=yes
  667. ;;
  668. esac
  669. fi
  670. ]
  671. dnl quotation ends
  672. if test $unported = yes; then
  673. AC_MSG_ERROR([Emacs does not support '${canonical}' systems.
  674. If you think it should, please send a report to ${PACKAGE_BUGREPORT}.
  675. Check 'etc/MACHINES' for recognized configuration names.])
  676. fi
  677. #### Choose a compiler.
  678. dnl Don't bother to test for C89.
  679. AC_DEFUN([_AC_PROG_CC_C89], [$2])
  680. dnl Sets GCC=yes if using gcc.
  681. AC_PROG_CC([gcc cc cl clang "$XCRUN gcc" "$XCRUN clang"])
  682. if test -n "$XCRUN"; then
  683. AC_CHECK_PROGS(AR, [ar "$XCRUN ar"])
  684. test -n "$AR" && export AR
  685. fi
  686. dnl Emacs needs C99 or later.
  687. gl_PROG_CC_C99
  688. AC_PROG_CC_C_O
  689. if test x$GCC = xyes; then
  690. test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
  691. fi
  692. # Avoid gnulib's tests for -lcrypto, so that there's no static dependency on it.
  693. AC_DEFUN([gl_CRYPTO_CHECK])
  694. # Avoid gnulib's tests for HAVE_WORKING_O_NOATIME and HAVE_WORKING_O_NOFOLLOW,
  695. # as we don't use them.
  696. AC_DEFUN([gl_FCNTL_O_FLAGS])
  697. # Avoid gnulib's test for pthread_sigmask.
  698. funcs=
  699. for func in $ac_func_list; do
  700. test $func = pthread_sigmask || AS_VAR_APPEND([funcs], [" $func"])
  701. done
  702. ac_func_list=$funcs
  703. # Use the system putenv even if it lacks GNU features, as we don't need them,
  704. # and the gnulib replacement runs afoul of a FreeBSD 10.1 bug; see Bug#19874.
  705. AC_CHECK_FUNCS_ONCE([putenv])
  706. AC_DEFUN([gl_FUNC_PUTENV],
  707. [test "$ac_cv_func_putenv" = yes || REPLACE_PUTENV=1])
  708. # Emacs does not use the wchar or wctype-h modules.
  709. AC_DEFUN([gt_TYPE_WINT_T],
  710. [GNULIB_OVERRIDES_WINT_T=0
  711. AC_SUBST([GNULIB_OVERRIDES_WINT_T])])
  712. # Initialize gnulib right after choosing the compiler.
  713. dnl Amongst other things, this sets AR and ARFLAGS.
  714. gl_EARLY
  715. if test "$ac_test_CFLAGS" != set; then
  716. # It's helpful to have C macros available to GDB, so prefer -g3 to -g
  717. # if -g3 works and the user does not specify CFLAGS.
  718. # This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
  719. case $CFLAGS in
  720. '-g')
  721. emacs_g3_CFLAGS='-g3';;
  722. '-g -O2')
  723. emacs_g3_CFLAGS='-g3 -O2';;
  724. *)
  725. emacs_g3_CFLAGS='';;
  726. esac
  727. if test -n "$emacs_g3_CFLAGS"; then
  728. emacs_save_CFLAGS=$CFLAGS
  729. CFLAGS=$emacs_g3_CFLAGS
  730. AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS],
  731. [emacs_cv_prog_cc_g3],
  732. [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  733. [emacs_cv_prog_cc_g3=yes],
  734. [emacs_cv_prog_cc_g3=no])])
  735. if test $emacs_cv_prog_cc_g3 != yes; then
  736. CFLAGS=$emacs_save_CFLAGS
  737. fi
  738. if test $opsys = mingw32; then
  739. CFLAGS="$CFLAGS -gdwarf-2"
  740. fi
  741. fi
  742. case $CFLAGS in
  743. *-O*) ;;
  744. *)
  745. # No optimization flag was inferred for this non-GCC compiler.
  746. # Try -O. This is needed for xlc on AIX; see Bug#14258.
  747. emacs_save_CFLAGS=$CFLAGS
  748. test -z "$CFLAGS" || CFLAGS="$CFLAGS "
  749. CFLAGS=${CFLAGS}-O
  750. AC_CACHE_CHECK([whether $CC accepts -O],
  751. [emacs_cv_prog_cc_o],
  752. [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
  753. [emacs_cv_prog_cc_o=yes],
  754. [emacs_cv_prog_cc_o=no])])
  755. if test $emacs_cv_prog_cc_o != yes; then
  756. CFLAGS=$emacs_save_CFLAGS
  757. fi ;;
  758. esac
  759. fi
  760. # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
  761. # ---------------------------------------------------------------------------
  762. # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
  763. # Otherwise, run RUN-IF-NOT-FOUND.
  764. AC_DEFUN([gl_GCC_VERSION_IFELSE],
  765. [AC_PREPROC_IFELSE(
  766. [AC_LANG_PROGRAM(
  767. [[
  768. #if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
  769. /* ok */
  770. #else
  771. # error "your version of gcc is older than $1.$2"
  772. #endif
  773. ]]),
  774. ], [$3], [$4])
  775. ]
  776. )
  777. AC_ARG_ENABLE([gcc-warnings],
  778. [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
  779. [control generation of GCC warnings. The TYPE 'yes'
  780. means to fail if any warnings are issued; 'warn-only'
  781. means issue warnings without failing (default for
  782. developer builds); 'no' means disable warnings
  783. (default for non-developer builds).])],
  784. [case $enableval in
  785. yes|no|warn-only) ;;
  786. *) AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
  787. esac
  788. gl_gcc_warnings=$enableval],
  789. [# By default, use 'warn-only' if it looks like the invoker of 'configure'
  790. # is a developer as opposed to a builder. This is most likely true
  791. # if GCC is recent enough and there is a .git directory or file;
  792. # however, if there is also a .tarball-version file it is probably
  793. # just a release imported into Git for patch management.
  794. gl_gcc_warnings=no
  795. if test -e "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then
  796. gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])
  797. fi])
  798. AC_ARG_ENABLE([check-lisp-object-type],
  799. [AS_HELP_STRING([--enable-check-lisp-object-type],
  800. [Enable compile-time checks for the Lisp_Object data type,
  801. which can catch some bugs during development.
  802. The default is "no" if --enable-gcc-warnings is "no".])])
  803. if test "${enable_check_lisp_object_type-$gl_gcc_warnings}" != "no"; then
  804. AC_DEFINE([CHECK_LISP_OBJECT_TYPE], 1,
  805. [Define to enable compile-time checks for the Lisp_Object data type.])
  806. fi
  807. # clang is unduly picky about some things.
  808. AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
  809. [AC_COMPILE_IFELSE(
  810. [AC_LANG_PROGRAM([[
  811. #ifndef __clang__
  812. error "not clang";
  813. #endif
  814. ]])],
  815. [emacs_cv_clang=yes],
  816. [emacs_cv_clang=no])])
  817. WERROR_CFLAGS=
  818. # When compiling with GCC, prefer -isystem to -I when including system
  819. # include files, to avoid generating useless diagnostics for the files.
  820. AS_IF([test $gl_gcc_warnings = no],
  821. [
  822. isystem='-I'
  823. AS_IF([test "$emacs_cv_clang" = yes],
  824. [
  825. # Turn off some warnings if supported.
  826. gl_WARN_ADD([-Wno-switch])
  827. gl_WARN_ADD([-Wno-pointer-sign])
  828. gl_WARN_ADD([-Wno-string-plus-int])
  829. gl_WARN_ADD([-Wno-unknown-attributes])
  830. ])
  831. ],[
  832. isystem='-isystem '
  833. # This, $nw, is the list of warnings we disable.
  834. nw=
  835. case $with_x_toolkit in
  836. lucid | athena | motif)
  837. # Old toolkits mishandle 'const'.
  838. nw="$nw -Wwrite-strings"
  839. ;;
  840. esac
  841. AS_IF([test $gl_gcc_warnings = yes],
  842. [WERROR_CFLAGS=-Werror])
  843. nw="$nw -Wduplicated-branches" # Too many false alarms
  844. nw="$nw -Wformat-overflow=2" # False alarms due to GCC bug 80776
  845. nw="$nw -Wsystem-headers" # Don't let system headers trigger warnings
  846. nw="$nw -Woverlength-strings" # Not a problem these days
  847. nw="$nw -Wformat-nonliteral" # we do this a lot
  848. nw="$nw -Wvla" # Emacs uses <vla.h>.
  849. nw="$nw -Wswitch-default" # Too many warnings for now
  850. nw="$nw -Wunused-const-variable=2" # lisp.h declares const objects.
  851. nw="$nw -Winline" # OK to ignore 'inline'
  852. nw="$nw -Wstrict-overflow" # OK to optimize assuming that
  853. # signed overflow has undefined behavior
  854. nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning
  855. nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
  856. nw="$nw -Wbad-function-cast" # These casts are no worse than others.
  857. # Emacs doesn't care about shadowing; see
  858. # <http://lists.gnu.org/archive/html/emacs-diffs/2011-11/msg00265.html>.
  859. nw="$nw -Wshadow"
  860. # Emacs's use of alloca inhibits protecting the stack.
  861. nw="$nw -Wstack-protector"
  862. # Emacs's use of partly-const functions such as Fgnutls_available_p
  863. # make this option problematic.
  864. nw="$nw -Wsuggest-attribute=const"
  865. # Emacs's use of partly-pure functions such as CHECK_TYPE make this
  866. # option problematic.
  867. nw="$nw -Wsuggest-attribute=pure"
  868. # This part is merely for shortening the command line,
  869. # since -Wall implies -Wswitch.
  870. nw="$nw -Wswitch"
  871. # This part is merely for shortening the command line,
  872. # since -Wno-FOO needs to be added below regardless.
  873. nw="$nw -Wmissing-field-initializers"
  874. nw="$nw -Woverride-init"
  875. nw="$nw -Wtype-limits"
  876. nw="$nw -Wunused-parameter"
  877. if test "$emacs_cv_clang" = yes; then
  878. nw="$nw -Wcast-align"
  879. nw="$nw -Wdouble-promotion"
  880. nw="$nw -Wmissing-braces"
  881. fi
  882. # This causes too much noise in the MinGW build
  883. if test $opsys = mingw32; then
  884. nw="$nw -Wpointer-sign"
  885. fi
  886. gl_MANYWARN_ALL_GCC([ws])
  887. gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
  888. for w in $ws; do
  889. gl_WARN_ADD([$w])
  890. done
  891. gl_WARN_ADD([-Wredundant-decls]) # Prefer this, as we don't use Bison.
  892. gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
  893. gl_WARN_ADD([-Wno-override-init]) # More trouble than it is worth
  894. gl_WARN_ADD([-Wno-sign-compare]) # Too many warnings for now
  895. gl_WARN_ADD([-Wno-type-limits]) # Too many warnings for now
  896. gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
  897. gl_WARN_ADD([-Wno-format-nonliteral])
  898. # clang is unduly picky about braces.
  899. if test "$emacs_cv_clang" = yes; then
  900. gl_WARN_ADD([-Wno-missing-braces])
  901. fi
  902. # This causes too much noise in the MinGW build
  903. if test $opsys = mingw32; then
  904. gl_WARN_ADD([-Wno-pointer-sign])
  905. fi
  906. AC_DEFINE([GCC_LINT], [1], [Define to 1 if --enable-gcc-warnings.])
  907. AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
  908. AH_VERBATIM([GNULIB_PORTCHECK_FORTIFY_SOURCE],
  909. [/* Enable compile-time and run-time bounds-checking, and some warnings,
  910. without upsetting glibc 2.15+. */
  911. #if (defined GNULIB_PORTCHECK && !defined _FORTIFY_SOURCE \
  912. && defined __OPTIMIZE__ && __OPTIMIZE__)
  913. # define _FORTIFY_SOURCE 2
  914. #endif
  915. ])
  916. ])
  917. # clang is picky about these regardless of whether
  918. # --enable-gcc-warnings is specified.
  919. if test "$emacs_cv_clang" = yes; then
  920. gl_WARN_ADD([-Wno-initializer-overrides])
  921. gl_WARN_ADD([-Wno-tautological-compare])
  922. gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
  923. fi
  924. # Use a slightly smaller set of warning options for lib/.
  925. nw=
  926. nw="$nw -Wunused-macros"
  927. gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
  928. AC_SUBST([WERROR_CFLAGS])
  929. AC_SUBST([GNULIB_WARN_CFLAGS])
  930. edit_cflags="
  931. s,///*,/,g
  932. s/^/ /
  933. s/ -I/ $isystem/g
  934. s/^ //
  935. "
  936. AC_ARG_ENABLE(link-time-optimization,
  937. [AS_HELP_STRING([--enable-link-time-optimization],
  938. [build with link-time optimization
  939. (experimental; see INSTALL)])],
  940. if test "${enableval}" != "no"; then
  941. ac_lto_supported=no
  942. if test "$emacs_cv_clang" = yes; then
  943. AC_MSG_CHECKING([whether link-time optimization is supported by clang])
  944. GOLD_PLUGIN=`$CC -print-file-name=LLVMgold.so 2>/dev/null`
  945. if test -x "$GOLD_PLUGIN"; then
  946. LTO="-flto"
  947. fi
  948. elif test x$GCC = xyes; then
  949. AC_MSG_CHECKING([whether link-time optimization is supported by gcc])
  950. CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
  951. if test x$CPUS != x; then
  952. LTO="-flto=$CPUS"
  953. else
  954. LTO="-flto"
  955. fi
  956. else
  957. AC_MSG_ERROR([Link-time optimization is not supported with your compiler.])
  958. fi
  959. if test -z "$LTO"; then
  960. ac_lto_supported=no
  961. else
  962. old_CFLAGS=$CFLAGS
  963. CFLAGS="$CFLAGS $LTO"
  964. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  965. [ac_lto_supported=yes], [ac_lto_supported=no])
  966. CFLAGS="$old_CFLAGS"
  967. fi
  968. AC_MSG_RESULT([$ac_lto_supported])
  969. if test "$ac_lto_supported" = "yes"; then
  970. CFLAGS="$CFLAGS $LTO"
  971. if test "$emacs_cv_clang" = yes; then
  972. AC_MSG_WARN([Please read INSTALL before using link-time optimization with clang])
  973. # WARNING: 'ar --plugin ...' doesn't work without
  974. # command, so plugin name is appended to ARFLAGS.
  975. ARFLAGS="cru --plugin $GOLD_PLUGIN"
  976. RANLIB="$RANLIB --plugin $GOLD_PLUGIN"
  977. else
  978. dnl The following is needed for GCC 4.9.0. The GCC 4.9.0 release notes
  979. dnl suggest that instead of -ffat-lto-objects we should use gcc-ar and
  980. dnl gcc-ranlib in place of ar and ranlib, but gcc-ar makes /usr/bin/ar
  981. dnl dump core on Fedora 20, so play it safe for now.
  982. gl_COMPILER_OPTION_IF([-ffat-lto-objects],
  983. [CFLAGS="$CFLAGS -ffat-lto-objects"])
  984. fi
  985. fi
  986. fi)
  987. dnl Automake replacements.
  988. AC_DEFUN([AM_CONDITIONAL],
  989. [$2 && $1=1 || $1=
  990. AC_SUBST([$1])])
  991. dnl Prefer silent make output. For verbose output, use
  992. dnl 'configure --disable-silent-rules' or 'make V=1' .
  993. dnl This code is adapted from Automake.
  994. dnl Although it can be simplified now that GNU Make is assumed,
  995. dnl the simplification hasn't been done yet.
  996. AC_ARG_ENABLE([silent-rules],
  997. [AS_HELP_STRING(
  998. [--disable-silent-rules],
  999. [verbose build output (undo: "make V=0")])])
  1000. if test "$enable_silent_rules" = no; then
  1001. AM_DEFAULT_VERBOSITY=1
  1002. else
  1003. AM_DEFAULT_VERBOSITY=0
  1004. fi
  1005. AM_V='$(V)'
  1006. AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
  1007. AC_SUBST([AM_V])
  1008. AC_SUBST([AM_DEFAULT_V])
  1009. AC_SUBST([AM_DEFAULT_VERBOSITY])
  1010. dnl Some other nice autoconf tests.
  1011. AC_PROG_INSTALL
  1012. dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
  1013. dnl AC_PROG_MKDIR_P
  1014. dnl if test "x$RANLIB" = x; then
  1015. dnl AC_PROG_RANLIB
  1016. dnl fi
  1017. dnl Sadly, AC_PROG_LN_S is too restrictive. It also tests whether links
  1018. dnl can be made to directories. This is not relevant for our usage, and
  1019. dnl excludes some cases that work fine for us. Eg MS Windows or files
  1020. dnl hosted on AFS, both examples where simple links work, but links to
  1021. dnl directories fail. We use a cut-down version instead.
  1022. dnl AC_PROG_LN_S
  1023. AC_CACHE_CHECK([command to symlink files in the same directory], [emacs_cv_ln_s_fileonly],
  1024. [rm -f conf$$ conf$$.file
  1025. emacs_cv_ln_s_fileonly='cp -p'
  1026. dnl On MinGW, ensure we will call the MSYS /bin/ln.exe, not some
  1027. dnl random program in the current directory.
  1028. if (echo >conf$$.file) 2>/dev/null; then
  1029. if ln -s conf$$.file conf$$ 2>/dev/null; then
  1030. if test "$opsys" = "mingw32"; then
  1031. emacs_cv_ln_s_fileonly='/bin/ln -s'
  1032. else
  1033. emacs_cv_ln_s_fileonly='ln -s'
  1034. fi
  1035. elif ln conf$$.file conf$$ 2>/dev/null; then
  1036. if test "$opsys" = "mingw32"; then
  1037. emacs_cv_ln_s_fileonly=/bin/ln
  1038. else
  1039. emacs_cv_ln_s_fileonly=ln
  1040. fi
  1041. fi
  1042. fi
  1043. rm -f conf$$ conf$$.file])
  1044. LN_S_FILEONLY=$emacs_cv_ln_s_fileonly
  1045. AC_SUBST(LN_S_FILEONLY)
  1046. dnl AC_PROG_LN_S sets LN_S to 'cp -pR' for MinGW, on the premise that 'ln'
  1047. dnl doesn't support links to directories, as in "ln file dir". But that
  1048. dnl use is non-portable, and OTOH MinGW wants to use hard links for Emacs
  1049. dnl executables at "make install" time.
  1050. dnl See http://lists.gnu.org/archive/html/emacs-devel/2013-04/msg00475.html
  1051. dnl for more details.
  1052. if test "$opsys" = "mingw32"; then
  1053. LN_S="/bin/ln"
  1054. fi
  1055. dnl On some Debian versions, "install-info" prints irritating messages
  1056. dnl "This is not dpkg install-info anymore, but GNU install-info"
  1057. dnl if called via an absolute file name.
  1058. dnl Use the entirely-identical-but-quieter ginstall-info instead if present.
  1059. dnl Sadly some people may have an old ginstall-info installed on
  1060. dnl non-Debian systems, so we can't use this.
  1061. dnl AC_PATH_PROGS(INSTALL_INFO, [ginstall-info install-info], :,
  1062. dnl $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
  1063. AC_PATH_PROG(INSTALL_INFO, install-info, :,
  1064. $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
  1065. dnl Don't use GZIP, which is used by gzip for additional parameters.
  1066. AC_PATH_PROG(GZIP_PROG, gzip)
  1067. test $with_compress_install != yes && test -n "$GZIP_PROG" && \
  1068. GZIP_PROG=" # $GZIP_PROG # (disabled by configure --without-compress-install)"
  1069. AC_CACHE_CHECK([for 'find' args to delete a file],
  1070. [emacs_cv_find_delete],
  1071. [if touch conftest.tmp && find conftest.tmp -delete 2>/dev/null &&
  1072. test ! -f conftest.tmp
  1073. then emacs_cv_find_delete="-delete"
  1074. else emacs_cv_find_delete="-exec rm -f {} ';'"
  1075. fi])
  1076. FIND_DELETE=$emacs_cv_find_delete
  1077. AC_SUBST([FIND_DELETE])
  1078. PAXCTL_dumped=
  1079. PAXCTL_notdumped=
  1080. if test $opsys = gnu-linux; then
  1081. if test "${SETFATTR+set}" != set; then
  1082. AC_CACHE_CHECK([for setfattr],
  1083. [emacs_cv_prog_setfattr],
  1084. [touch conftest.tmp
  1085. if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
  1086. emacs_cv_prog_setfattr=yes
  1087. else
  1088. emacs_cv_prog_setfattr=no
  1089. fi])
  1090. if test "$emacs_cv_prog_setfattr" = yes; then
  1091. PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
  1092. SETFATTR=setfattr
  1093. else
  1094. SETFATTR=
  1095. fi
  1096. rm -f conftest.tmp
  1097. AC_SUBST([SETFATTR])
  1098. fi
  1099. fi
  1100. case $opsys,$PAXCTL_notdumped,$emacs_uname_r in
  1101. gnu-linux,,* | netbsd,,[0-7].*)
  1102. AC_PATH_PROG([PAXCTL], [paxctl], [],
  1103. [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
  1104. if test -n "$PAXCTL"; then
  1105. if test "$opsys" = netbsd; then
  1106. PAXCTL_dumped='$(PAXCTL) +a'
  1107. PAXCTL_notdumped=$PAXCTL_dumped
  1108. else
  1109. AC_MSG_CHECKING([whether binaries have a PT_PAX_FLAGS header])
  1110. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  1111. [if $PAXCTL -v conftest$EXEEXT >/dev/null 2>&1; then
  1112. AC_MSG_RESULT([yes])
  1113. else
  1114. AC_MSG_RESULT([no])
  1115. PAXCTL=
  1116. fi])
  1117. if test -n "$PAXCTL"; then
  1118. PAXCTL_dumped='$(PAXCTL) -zex'
  1119. PAXCTL_notdumped='$(PAXCTL) -r'
  1120. fi
  1121. fi
  1122. fi;;
  1123. esac
  1124. AC_SUBST([PAXCTL_dumped])
  1125. AC_SUBST([PAXCTL_notdumped])
  1126. ## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals.
  1127. if test "${MAKEINFO:=makeinfo}" != "no"; then
  1128. case `($MAKEINFO --version) 2>/dev/null` in
  1129. *' (GNU texinfo) '4.1[[3-9]]* | \
  1130. *' (GNU texinfo) '[[5-9]]* | \
  1131. *' (GNU texinfo) '[[1-9][0-9]]* ) ;;
  1132. *) MAKEINFO=no;;
  1133. esac
  1134. fi
  1135. ## Makeinfo is unusual. For a released Emacs, the manuals are
  1136. ## pre-built, and not deleted by the normal clean rules. makeinfo is
  1137. ## therefore in the category of "special tools" not normally required, which
  1138. ## configure does not have to check for (eg autoconf itself).
  1139. ## In a repository checkout on the other hand, the manuals are not included.
  1140. ## So makeinfo is a requirement to build from the repository, and configure
  1141. ## should test for it as it does for any other build requirement.
  1142. ## We use the presence of $srcdir/info/emacs to distinguish a release,
  1143. ## with pre-built manuals, from a repository checkout.
  1144. HAVE_MAKEINFO=yes
  1145. if test "$MAKEINFO" = "no"; then
  1146. MAKEINFO=makeinfo
  1147. if test "x${with_makeinfo}" = "xno"; then
  1148. HAVE_MAKEINFO=no
  1149. elif test ! -e "$srcdir/info/emacs" && test ! -e "$srcdir/info/emacs.info"; then
  1150. AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.13, and your
  1151. source tree does not seem to have pre-built manuals in the 'info' directory.
  1152. Either install a suitable version of makeinfo, or re-run configure
  1153. with the '--without-makeinfo' option to build without the manuals.] )
  1154. fi
  1155. fi
  1156. AC_SUBST([MAKEINFO])
  1157. AC_SUBST(HAVE_MAKEINFO)
  1158. if test $opsys = mingw32; then
  1159. DOCMISC_W32=efaq-w32
  1160. else
  1161. DOCMISC_W32=
  1162. fi
  1163. AC_SUBST(DOCMISC_W32)
  1164. dnl Add our options to ac_link now, after it is set up.
  1165. if test x$GCC = xyes; then
  1166. test "x$GCC_LINK_TEST_OPTIONS" != x && \
  1167. ac_link="$ac_link $GCC_LINK_TEST_OPTIONS"
  1168. else
  1169. test "x$NON_GCC_LINK_TEST_OPTIONS" != x && \
  1170. ac_link="$ac_link $NON_GCC_LINK_TEST_OPTIONS"
  1171. fi
  1172. dnl We need -znocombreloc if we're using a relatively recent GNU ld.
  1173. dnl If we can link with the flag, it shouldn't do any harm anyhow.
  1174. dnl Treat GCC specially since it just gives a non-fatal 'unrecognized option'
  1175. dnl if not built to support GNU ld.
  1176. dnl For a long time, -znocombreloc was added to LDFLAGS rather than
  1177. dnl LD_SWITCH_SYSTEM_TEMACS. That is:
  1178. dnl * inappropriate, as LDFLAGS is a user option but this is essential.
  1179. dnl Eg "make LDFLAGS=... all" could run into problems,
  1180. dnl http://bugs.debian.org/684788
  1181. dnl * unnecessary, since temacs is the only thing that actually needs it.
  1182. dnl Indeed this is where it was originally, prior to:
  1183. dnl http://lists.gnu.org/archive/html/emacs-pretest-bug/2004-03/msg00170.html
  1184. if test x$GCC = xyes; then
  1185. LDFLAGS_NOCOMBRELOC="-Wl,-znocombreloc"
  1186. else
  1187. LDFLAGS_NOCOMBRELOC="-znocombreloc"
  1188. fi
  1189. AC_CACHE_CHECK([for -znocombreloc], [emacs_cv_znocombreloc],
  1190. [late_LDFLAGS="$LDFLAGS"
  1191. LDFLAGS="$LDFLAGS $LDFLAGS_NOCOMBRELOC"
  1192. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
  1193. [emacs_cv_znocombreloc=yes], [emacs_cv_znocombreloc=no])
  1194. LDFLAGS="$late_LDFLAGS"])
  1195. if test x$emacs_cv_znocombreloc = xno; then
  1196. LDFLAGS_NOCOMBRELOC=
  1197. fi
  1198. AC_CACHE_CHECK([whether addresses are sanitized],
  1199. [emacs_cv_sanitize_address],
  1200. [AC_COMPILE_IFELSE(
  1201. [AC_LANG_PROGRAM(
  1202. [[#ifndef __has_feature
  1203. #define __has_feature(f) 0
  1204. #endif
  1205. #if defined __SANITIZE_ADDRESS__ || __has_feature (address_sanitizer)
  1206. #else
  1207. error "Addresses are not sanitized.";
  1208. #endif
  1209. ]])],
  1210. [emacs_cv_sanitize_address=yes],
  1211. [emacs_cv_sanitize_address=no])])
  1212. dnl The function dump-emacs will not be defined and temacs will do
  1213. dnl (load "loadup") automatically unless told otherwise.
  1214. test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
  1215. case "$opsys" in
  1216. nacl) CANNOT_DUMP=yes ;;
  1217. esac
  1218. if test "$CANNOT_DUMP" = "yes"; then
  1219. AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.])
  1220. elif test "$emacs_cv_sanitize_address" = yes; then
  1221. AC_MSG_WARN([[Addresses are sanitized; suggest CANNOT_DUMP=yes]])
  1222. fi
  1223. AC_SUBST(CANNOT_DUMP)
  1224. UNEXEC_OBJ=unexelf.o
  1225. case "$opsys" in
  1226. # MSDOS uses unexcoff.o
  1227. aix4-2)
  1228. UNEXEC_OBJ=unexaix.o
  1229. ;;
  1230. cygwin)
  1231. UNEXEC_OBJ=unexcw.o
  1232. ;;
  1233. darwin)
  1234. UNEXEC_OBJ=unexmacosx.o
  1235. ;;
  1236. hpux10-20 | hpux11)
  1237. UNEXEC_OBJ=unexhp9k800.o
  1238. ;;
  1239. mingw32)
  1240. UNEXEC_OBJ=unexw32.o
  1241. ;;
  1242. sol2-10)
  1243. # Use the Solaris dldump() function, called from unexsol.c, to dump
  1244. # emacs, instead of the generic ELF dump code found in unexelf.c.
  1245. # The resulting binary has a complete symbol table, and is better
  1246. # for debugging and other observability tools (debuggers, pstack, etc).
  1247. #
  1248. # If you encounter a problem using dldump(), please consider sending
  1249. # a message to the OpenSolaris tools-linking mailing list:
  1250. # http://mail.opensolaris.org/mailman/listinfo/tools-linking
  1251. #
  1252. # It is likely that dldump() works with older Solaris too, but this has
  1253. # not been tested, so for now this change is for Solaris 10 or newer.
  1254. UNEXEC_OBJ=unexsol.o
  1255. ;;
  1256. esac
  1257. test "$CANNOT_DUMP" = "yes" && UNEXEC_OBJ=
  1258. LD_SWITCH_SYSTEM=
  1259. case "$opsys" in
  1260. freebsd|dragonfly)
  1261. ## Let 'ld' find image libs and similar things in /usr/local/lib.
  1262. ## The system compiler, GCC, has apparently been modified to not
  1263. ## look there, contrary to what a stock GCC would do.
  1264. ### It's not our place to do this. See bug#10313#17.
  1265. ### LD_SWITCH_SYSTEM=-L/usr/local/lib
  1266. :
  1267. ;;
  1268. gnu-linux)
  1269. ## cpp test was "ifdef __mips__", but presumably this is equivalent...
  1270. case $host_cpu in mips*) LD_SWITCH_SYSTEM="-G 0";; esac
  1271. ;;
  1272. netbsd)
  1273. ### It's not our place to do this. See bug#10313#17.
  1274. ### LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
  1275. :
  1276. ;;
  1277. openbsd)
  1278. ## Han Boetes <han@boetes.org> says this is necessary,
  1279. ## otherwise Emacs dumps core on elf systems.
  1280. LD_SWITCH_SYSTEM="-Z"
  1281. ;;
  1282. esac
  1283. AC_SUBST(LD_SWITCH_SYSTEM)
  1284. ac_link="$ac_link $LD_SWITCH_SYSTEM"
  1285. ## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
  1286. ## which has not been defined yet. When this was handled with cpp,
  1287. ## it was expanded to null when configure sourced the s/*.h file.
  1288. ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
  1289. ## FIXME it would be cleaner to put this in LD_SWITCH_SYSTEM_TEMACS
  1290. ## (or somesuch), but because it is supposed to go at the _front_
  1291. ## of LD_SWITCH_SYSTEM, we cannot do that in exactly the same way.
  1292. ## Compare with the gnu-linux case below, which added to the end
  1293. ## of LD_SWITCH_SYSTEM, and so can instead go at the front of
  1294. ## LD_SWITCH_SYSTEM_TEMACS.
  1295. case "$opsys" in
  1296. netbsd|openbsd)
  1297. LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
  1298. esac
  1299. C_SWITCH_MACHINE=
  1300. case $canonical in
  1301. alpha*)
  1302. AC_CHECK_DECL([__ELF__])
  1303. if test "$ac_cv_have_decl___ELF__" = "yes"; then
  1304. ## With ELF, make sure that all common symbols get allocated to in the
  1305. ## data section. Otherwise, the dump of temacs may miss variables in
  1306. ## the shared library that have been initialized. For example, with
  1307. ## GNU libc, __malloc_initialized would normally be resolved to the
  1308. ## shared library's .bss section, which is fatal.
  1309. if test "x$GCC" = "xyes"; then
  1310. C_SWITCH_MACHINE="-fno-common"
  1311. else
  1312. AC_MSG_ERROR([Non-GCC compilers are not supported.])
  1313. fi
  1314. else
  1315. dnl This was the unexalpha.c case. Removed in 24.1, 2010-07-24,
  1316. dnl albeit under the mistaken assumption that said file
  1317. dnl was no longer used.
  1318. AC_MSG_ERROR([Non-ELF systems are not supported since Emacs 24.1.])
  1319. fi
  1320. ;;
  1321. esac
  1322. AC_SUBST(C_SWITCH_MACHINE)
  1323. AC_SUBST(UNEXEC_OBJ)
  1324. C_SWITCH_SYSTEM=
  1325. ## Some programs in src produce warnings saying certain subprograms
  1326. ## are too complex and need a MAXMEM value greater than 2000 for
  1327. ## additional optimization. --nils@exp-math.uni-essen.de
  1328. test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
  1329. C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
  1330. if test "$opsys" = "mingw32"; then
  1331. case "$canonical" in
  1332. x86_64-*-mingw*) C_SWITCH_SYSTEM="-mtune=generic" ;;
  1333. *) C_SWITCH_SYSTEM="-mtune=pentium4" ;;
  1334. esac
  1335. fi
  1336. ## gnu-linux might need -D_BSD_SOURCE on old libc5 systems.
  1337. ## It is redundant in glibc2, since we define _GNU_SOURCE.
  1338. AC_SUBST(C_SWITCH_SYSTEM)
  1339. LIBS_SYSTEM=
  1340. case "$opsys" in
  1341. ## IBM's X11R5 uses -lIM and -liconv in AIX 3.2.2.
  1342. aix4-2) LIBS_SYSTEM="-lrts -lIM -liconv" ;;
  1343. freebsd|dragonfly) LIBS_SYSTEM="-lutil" ;;
  1344. hpux*) LIBS_SYSTEM="-l:libdld.sl" ;;
  1345. sol2*) LIBS_SYSTEM="-lsocket -lnsl" ;;
  1346. ## Motif needs -lgen.
  1347. unixware) LIBS_SYSTEM="-lsocket -lnsl -lelf -lgen" ;;
  1348. esac
  1349. AC_SUBST(LIBS_SYSTEM)
  1350. ### Make sure subsequent tests use flags consistent with the build flags.
  1351. if test x"${OVERRIDE_CPPFLAGS}" != x; then
  1352. CPPFLAGS="${OVERRIDE_CPPFLAGS}"
  1353. else
  1354. CPPFLAGS="$C_SWITCH_SYSTEM $C_SWITCH_MACHINE $CPPFLAGS"
  1355. fi
  1356. # Suppress obsolescent Autoconf test for size_t; Emacs assumes C99 or better.
  1357. AC_DEFUN([AC_TYPE_SIZE_T])
  1358. # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
  1359. AC_DEFUN([AC_TYPE_UID_T])
  1360. # sqrt and other floating-point functions such as fmod and frexp
  1361. # are found in -lm on many systems.
  1362. OLD_LIBS=$LIBS
  1363. AC_SEARCH_LIBS([sqrt], [m])
  1364. if test "X$LIBS" = "X$OLD_LIBS"; then
  1365. LIB_MATH=
  1366. else
  1367. LIB_MATH=$ac_cv_search_sqrt
  1368. fi
  1369. LIBS=$OLD_LIBS
  1370. dnl Current possibilities handled by sed (aix4-2 -> aix,
  1371. dnl gnu-linux -> gnu/linux, etc.):
  1372. dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux.
  1373. dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
  1374. SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
  1375. case $opsys in
  1376. cygwin )
  1377. LIB_MATH=
  1378. ;;
  1379. darwin )
  1380. ## Adding -lm confuses the dynamic linker, so omit it.
  1381. LIB_MATH=
  1382. ;;
  1383. freebsd | dragonfly )
  1384. SYSTEM_TYPE=berkeley-unix
  1385. ;;
  1386. gnu-linux | gnu-kfreebsd )
  1387. ;;
  1388. hpux10-20 | hpux11 )
  1389. ;;
  1390. mingw32 )
  1391. LIB_MATH=
  1392. SYSTEM_TYPE=windows-nt
  1393. ;;
  1394. dnl NB this may be adjusted below.
  1395. netbsd | openbsd )
  1396. SYSTEM_TYPE=berkeley-unix
  1397. ;;
  1398. sol2* | unixware )
  1399. SYSTEM_TYPE=usg-unix-v
  1400. ;;
  1401. esac
  1402. AC_SUBST(LIB_MATH)
  1403. AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
  1404. [The type of system you are compiling for; sets 'system-type'.])
  1405. AC_SUBST([SYSTEM_TYPE])
  1406. pre_PKG_CONFIG_CFLAGS=$CFLAGS
  1407. pre_PKG_CONFIG_LIBS=$LIBS
  1408. PKG_PROG_PKG_CONFIG(0.9.0)
  1409. dnl EMACS_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4)
  1410. dnl acts like PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4,
  1411. dnl HAVE_GSTUFF=yes, HAVE_GSTUFF=no) -- see pkg-config man page --
  1412. dnl except that it postprocesses CFLAGS as needed for --enable-gcc-warnings.
  1413. dnl EMACS_CHECK_MODULES accepts optional 3rd and 4th arguments that
  1414. dnl can take the place of the default HAVE_GSTUFF=yes and HAVE_GSTUFF=no
  1415. dnl actions.
  1416. AC_DEFUN([EMACS_CHECK_MODULES],
  1417. [PKG_CHECK_MODULES([$1], [$2],
  1418. [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
  1419. m4_default([$3], [HAVE_$1=yes])],
  1420. [m4_default([$4], [HAVE_$1=no])])])
  1421. HAVE_SOUND=no
  1422. if test "${with_sound}" != "no"; then
  1423. # Sound support for GNU/Linux, the free BSDs, MinGW, and Cygwin.
  1424. AC_CHECK_HEADERS([machine/soundcard.h sys/soundcard.h soundcard.h mmsystem.h],
  1425. have_sound_header=yes, [], [
  1426. #ifdef __MINGW32__
  1427. #define WIN32_LEAN_AND_MEAN
  1428. #include <windows.h>
  1429. #endif
  1430. ])
  1431. test "${with_sound}" = "oss" && test "${have_sound_header}" != "yes" && \
  1432. AC_MSG_ERROR([OSS sound support requested but not found.])
  1433. if test "${with_sound}" = "bsd-ossaudio" || test "${with_sound}" = "yes"; then
  1434. # Emulation library used on NetBSD.
  1435. AC_CHECK_LIB(ossaudio, _oss_ioctl, LIBSOUND=-lossaudio, LIBSOUND=)
  1436. test "${with_sound}" = "bsd-ossaudio" && test -z "$LIBSOUND" && \
  1437. AC_MSG_ERROR([bsd-ossaudio sound support requested but not found.])
  1438. dnl FIXME? If we did find ossaudio, should we set with_sound=bsd-ossaudio?
  1439. dnl Traditionally, we go on to check for alsa too. Does that make sense?
  1440. fi
  1441. AC_SUBST(LIBSOUND)
  1442. if test "${with_sound}" = "alsa" || test "${with_sound}" = "yes"; then
  1443. ALSA_REQUIRED=1.0.0
  1444. ALSA_MODULES="alsa >= $ALSA_REQUIRED"
  1445. EMACS_CHECK_MODULES([ALSA], [$ALSA_MODULES])
  1446. if test $HAVE_ALSA = yes; then
  1447. SAVE_CFLAGS="$CFLAGS"
  1448. SAVE_LIBS="$LIBS"
  1449. CFLAGS="$ALSA_CFLAGS $CFLAGS"
  1450. LIBS="$ALSA_LIBS $LIBS"
  1451. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <asoundlib.h>]], [[snd_lib_error_set_handler (0);]])],
  1452. emacs_alsa_normal=yes,
  1453. emacs_alsa_normal=no)
  1454. if test "$emacs_alsa_normal" != yes; then
  1455. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <alsa/asoundlib.h>]],
  1456. [[snd_lib_error_set_handler (0);]])],
  1457. emacs_alsa_subdir=yes,
  1458. emacs_alsa_subdir=no)
  1459. if test "$emacs_alsa_subdir" != yes; then
  1460. AC_MSG_ERROR([pkg-config found alsa, but it does not compile. See config.log for error messages.])
  1461. fi
  1462. ALSA_CFLAGS="$ALSA_CFLAGS -DALSA_SUBDIR_INCLUDE"
  1463. fi
  1464. CFLAGS="$SAVE_CFLAGS"
  1465. LIBS="$SAVE_LIBS"
  1466. LIBSOUND="$LIBSOUND $ALSA_LIBS"
  1467. CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS"
  1468. AC_DEFINE(HAVE_ALSA, 1, [Define to 1 if ALSA is available.])
  1469. elif test "${with_sound}" = "alsa"; then
  1470. AC_MSG_ERROR([ALSA sound support requested but not found.])
  1471. fi
  1472. fi dnl with_sound = alsa|yes
  1473. dnl Define HAVE_SOUND if we have sound support. We know it works and
  1474. dnl compiles only on the specified platforms. For others, it
  1475. dnl probably doesn't make sense to try.
  1476. dnl FIXME So surely we should bypass this whole section if not using
  1477. dnl one of these platforms?
  1478. if test x$have_sound_header = xyes || test $HAVE_ALSA = yes; then
  1479. case "$opsys" in
  1480. dnl defined __FreeBSD__ || defined __NetBSD__ || defined __linux__
  1481. dnl Adjust the --with-sound help text if you change this.
  1482. gnu-linux|freebsd|netbsd|mingw32|cygwin)
  1483. AC_DEFINE(HAVE_SOUND, 1, [Define to 1 if you have sound support.])
  1484. HAVE_SOUND=yes
  1485. ;;
  1486. esac
  1487. fi
  1488. AC_SUBST(CFLAGS_SOUND)
  1489. fi
  1490. dnl checks for header files
  1491. AC_CHECK_HEADERS_ONCE(
  1492. linux/fs.h
  1493. malloc.h
  1494. sys/systeminfo.h
  1495. sys/sysinfo.h
  1496. coff.h pty.h
  1497. sys/resource.h
  1498. sys/utsname.h pwd.h utmp.h util.h sys/prctl.h)
  1499. AC_CACHE_CHECK([for ADDR_NO_RANDOMIZE],
  1500. [emacs_cv_personality_addr_no_randomize],
  1501. [AC_COMPILE_IFELSE(
  1502. [AC_LANG_PROGRAM([[#include <sys/personality.h>]],
  1503. [[personality (personality (0xffffffff)
  1504. | ADDR_NO_RANDOMIZE)]])],
  1505. [emacs_cv_personality_addr_no_randomize=yes],
  1506. [emacs_cv_personality_addr_no_randomize=no])])
  1507. if test $emacs_cv_personality_addr_no_randomize = yes; then
  1508. AC_DEFINE([HAVE_PERSONALITY_ADDR_NO_RANDOMIZE], [1],
  1509. [Define to 1 if personality flag ADDR_NO_RANDOMIZE exists.])
  1510. fi
  1511. # Note that Solaris has sys/sysinfo.h which defines struct
  1512. # sysinfo as well. To make sure that we're using GNU/Linux
  1513. # sysinfo, we explicitly set one of its fields.
  1514. if test "$ac_cv_header_sys_sysinfo_h" = yes; then
  1515. AC_CACHE_CHECK([if Linux sysinfo may be used], [emacs_cv_linux_sysinfo],
  1516. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
  1517. [[struct sysinfo si;
  1518. si.totalram = 0;
  1519. sysinfo (&si)]])],
  1520. emacs_cv_linux_sysinfo=yes, emacs_cv_linux_sysinfo=no)])
  1521. if test $emacs_cv_linux_sysinfo = yes; then
  1522. AC_DEFINE([HAVE_LINUX_SYSINFO], 1, [Define to 1 if you have Linux sysinfo function.])
  1523. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/sysinfo.h>]],
  1524. [[struct sysinfo si; return si.mem_unit]])],
  1525. AC_DEFINE(LINUX_SYSINFO_UNIT, 1,
  1526. [Define to 1 if Linux sysinfo sizes are in multiples of mem_unit bytes.]))
  1527. fi
  1528. fi
  1529. dnl On Solaris 8 there's a compilation warning for term.h because
  1530. dnl it doesn't define 'bool'.
  1531. AC_CHECK_HEADERS(term.h, , , -)
  1532. AC_HEADER_TIME
  1533. AC_CHECK_DECLS([sys_siglist], [], [], [[#include <signal.h>
  1534. ]])
  1535. if test $ac_cv_have_decl_sys_siglist != yes; then
  1536. # For Tru64, at least:
  1537. AC_CHECK_DECLS([__sys_siglist], [], [], [[#include <signal.h>
  1538. ]])
  1539. fi
  1540. AC_HEADER_SYS_WAIT
  1541. AC_CHECK_HEADERS_ONCE(sys/socket.h)
  1542. AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
  1543. #if HAVE_SYS_SOCKET_H
  1544. #include <sys/socket.h>
  1545. #endif])
  1546. AC_CHECK_HEADERS(ifaddrs.h, , , [AC_INCLUDES_DEFAULT
  1547. #if HAVE_SYS_SOCKET_H
  1548. #include <sys/socket.h>
  1549. #endif])
  1550. AC_CHECK_HEADERS(net/if_dl.h, , , [AC_INCLUDES_DEFAULT
  1551. #if HAVE_SYS_SOCKET_H
  1552. #include <sys/socket.h>
  1553. #endif])
  1554. dnl checks for structure members
  1555. AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
  1556. struct ifreq.ifr_netmask, struct ifreq.ifr_broadaddr,
  1557. struct ifreq.ifr_addr,
  1558. struct ifreq.ifr_addr.sa_len], , ,
  1559. [AC_INCLUDES_DEFAULT
  1560. #if HAVE_SYS_SOCKET_H
  1561. #include <sys/socket.h>
  1562. #endif
  1563. #if HAVE_NET_IF_H
  1564. #include <net/if.h>
  1565. #endif])
  1566. dnl Check for endianness.
  1567. dnl AC_C_BIGENDIAN is done by gnulib.
  1568. dnl check for Make feature
  1569. AUTO_DEPEND=no
  1570. AUTODEPEND_PARENTS='lib src'
  1571. dnl check if we have GCC and autodepend is on.
  1572. if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
  1573. AC_CACHE_CHECK([whether gcc understands -MMD -MF], [emacs_cv_autodepend],
  1574. [SAVE_CFLAGS="$CFLAGS"
  1575. CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
  1576. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
  1577. [emacs_cv_autodepend=yes], [emacs_cv_autodepend=no])
  1578. CFLAGS="$SAVE_CFLAGS"
  1579. test -f deps.d || emacs_cv_autodepend=no
  1580. rm -rf deps.d])
  1581. if test $emacs_cv_autodepend = yes; then
  1582. AUTO_DEPEND=yes
  1583. fi
  1584. fi
  1585. AC_SUBST(AUTO_DEPEND)
  1586. #### Choose a window system.
  1587. ## We leave window_system equal to none if
  1588. ## we end up building without one. Any new window system should
  1589. ## set window_system to an appropriate value and add objects to
  1590. ## window-system-specific substs.
  1591. window_system=none
  1592. AC_PATH_X
  1593. if test "$no_x" != yes; then
  1594. window_system=x11
  1595. fi
  1596. LD_SWITCH_X_SITE_RPATH=
  1597. if test "${x_libraries}" != NONE; then
  1598. if test -n "${x_libraries}"; then
  1599. LD_SWITCH_X_SITE=-L`AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -L/g'`
  1600. LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`
  1601. AS_ECHO(["$x_libraries"]) | sed -e 's/:/ -Wl,-rpath,/g'
  1602. `
  1603. fi
  1604. x_default_search_path=""
  1605. x_search_path=${x_libraries}
  1606. if test -z "${x_search_path}"; then
  1607. x_search_path=/usr/lib
  1608. fi
  1609. for x_library in `AS_ECHO(["$x_search_path:"]) | \
  1610. sed -e "s/:/ /g" -e p -e "s:/lib[[^ /]]* :/share :g"`; do
  1611. x_search_path="\
  1612. ${x_library}/X11/%L/%T/%N%C%S:\
  1613. ${x_library}/X11/%l/%T/%N%C%S:\
  1614. ${x_library}/X11/%T/%N%C%S:\
  1615. ${x_library}/X11/%L/%T/%N%S:\
  1616. ${x_library}/X11/%l/%T/%N%S:\
  1617. ${x_library}/X11/%T/%N%S"
  1618. if test x"${x_default_search_path}" = x; then
  1619. x_default_search_path=${x_search_path}
  1620. else
  1621. x_default_search_path="${x_search_path}:${x_default_search_path}"
  1622. fi
  1623. done
  1624. fi
  1625. AC_SUBST(LD_SWITCH_X_SITE_RPATH)
  1626. if test "${x_includes}" != NONE && test -n "${x_includes}"; then
  1627. C_SWITCH_X_SITE=$isystem`AS_ECHO(["$x_includes"]) | sed -e "s/:/ $isystem/g"`
  1628. fi
  1629. if test x"${x_includes}" = x; then
  1630. bitmapdir=/usr/include/X11/bitmaps
  1631. else
  1632. # accumulate include directories that have X11 bitmap subdirectories
  1633. bmd_acc=
  1634. for bmd in `AS_ECHO(["$x_includes"]) | sed -e 's/:/ /g'`; do
  1635. if test -d "${bmd}/X11/bitmaps"; then
  1636. bmd_acc="${bmd_acc}:${bmd}/X11/bitmaps"
  1637. fi
  1638. if test -d "${bmd}/bitmaps"; then
  1639. bmd_acc="${bmd_acc}:${bmd}/bitmaps"
  1640. fi
  1641. done
  1642. bitmapdir=${bmd_acc#:}
  1643. fi
  1644. test "${with_ns}" = maybe && test "${opsys}" != darwin && with_ns=no
  1645. HAVE_NS=no
  1646. NS_GNUSTEP_CONFIG=no
  1647. NS_IMPL_COCOA=no
  1648. NS_IMPL_GNUSTEP=no
  1649. tmp_CPPFLAGS="$CPPFLAGS"
  1650. tmp_CFLAGS="$CFLAGS"
  1651. CPPFLAGS="$CPPFLAGS -x objective-c"
  1652. CFLAGS="$CFLAGS -x objective-c"
  1653. GNU_OBJC_CFLAGS=
  1654. LIBS_GNUSTEP=
  1655. if test "${with_ns}" != no; then
  1656. if test "${opsys}" = darwin; then
  1657. NS_IMPL_COCOA=yes
  1658. ns_appdir=`pwd`/nextstep/Emacs.app
  1659. ns_appbindir=${ns_appdir}/Contents/MacOS
  1660. ns_appresdir=${ns_appdir}/Contents/Resources
  1661. ns_appsrc=Cocoa/Emacs.base
  1662. ns_fontfile=macfont.o
  1663. elif flags=$( (gnustep-config --objc-flags) 2>/dev/null); then
  1664. NS_IMPL_GNUSTEP=yes
  1665. NS_GNUSTEP_CONFIG=yes
  1666. GNU_OBJC_CFLAGS=$flags
  1667. LIBS_GNUSTEP=$(gnustep-config --gui-libs) || exit
  1668. elif test -f $GNUSTEP_CONFIG_FILE; then
  1669. NS_IMPL_GNUSTEP=yes
  1670. dnl FIXME sourcing this several times in subshells seems inefficient.
  1671. GNUSTEP_SYSTEM_HEADERS=$(
  1672. . $GNUSTEP_CONFIG_FILE
  1673. AS_ECHO(["$GNUSTEP_SYSTEM_HEADERS"])
  1674. )
  1675. GNUSTEP_SYSTEM_LIBRARIES=$(
  1676. . $GNUSTEP_CONFIG_FILE
  1677. AS_ECHO(["$GNUSTEP_SYSTEM_LIBRARIES"])
  1678. )
  1679. dnl I seemed to need these as well with GNUstep-startup 0.25.
  1680. GNUSTEP_LOCAL_HEADERS=$(
  1681. . $GNUSTEP_CONFIG_FILE
  1682. AS_ECHO(["$GNUSTEP_LOCAL_HEADERS"])
  1683. )
  1684. GNUSTEP_LOCAL_LIBRARIES=$(
  1685. . $GNUSTEP_CONFIG_FILE
  1686. AS_ECHO(["$GNUSTEP_LOCAL_LIBRARIES"])
  1687. )
  1688. test "x${GNUSTEP_LOCAL_HEADERS}" != "x" && \
  1689. GNUSTEP_LOCAL_HEADERS="-I${GNUSTEP_LOCAL_HEADERS}"
  1690. test "x${GNUSTEP_LOCAL_LIBRARIES}" != "x" && \
  1691. GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
  1692. CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
  1693. CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
  1694. LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
  1695. LIBS_GNUSTEP="-lgnustep-gui -lgnustep-base -lobjc -lpthread"
  1696. dnl GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS to 0 or 1.
  1697. dnl If they had chosen to either define it or not, we could have
  1698. dnl just used AC_CHECK_DECL here.
  1699. AC_CACHE_CHECK(if GNUstep defines BASE_NATIVE_OBJC_EXCEPTIONS,
  1700. emacs_cv_objc_exceptions,
  1701. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <GNUstepBase/GSConfig.h>]],
  1702. [[#if defined BASE_NATIVE_OBJC_EXCEPTIONS && BASE_NATIVE_OBJC_EXCEPTIONS > 0
  1703. 1;
  1704. #else
  1705. fail;
  1706. #endif]])], emacs_cv_objc_exceptions=yes, emacs_cv_objc_exceptions=no ) )
  1707. if test $emacs_cv_objc_exceptions = yes; then
  1708. dnl _NATIVE_OBJC_EXCEPTIONS is used by the GNUstep headers.
  1709. AC_DEFINE(_NATIVE_OBJC_EXCEPTIONS, 1,
  1710. [Define if GNUstep uses ObjC exceptions.])
  1711. GNU_OBJC_CFLAGS="-fobjc-exceptions"
  1712. fi
  1713. fi
  1714. if test $NS_IMPL_GNUSTEP = yes; then
  1715. ns_appdir=`pwd`/nextstep/Emacs.app
  1716. ns_appbindir=${ns_appdir}
  1717. ns_appresdir=${ns_appdir}/Resources
  1718. ns_appsrc=GNUstep/Emacs.base
  1719. ns_fontfile=nsfont.o
  1720. fi
  1721. dnl This is only used while we test the NS headers, it gets reset below.
  1722. CPPFLAGS="$CPPFLAGS $GNU_OBJC_CFLAGS"
  1723. CFLAGS="$CFLAGS $GNU_OBJC_CFLAGS"
  1724. AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
  1725. [AC_MSG_ERROR([The include files (AppKit/AppKit.h etc) that
  1726. are required for a Nextstep build are missing or cannot be compiled.
  1727. Either fix this, or re-configure with the option '--without-ns'.])])
  1728. macfont_file=""
  1729. if test "${NS_IMPL_COCOA}" = "yes"; then
  1730. AC_MSG_CHECKING([for Mac OS X 10.6 or newer])
  1731. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <AppKit/AppKit.h>],
  1732. [
  1733. #ifdef MAC_OS_X_VERSION_MAX_ALLOWED
  1734. #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
  1735. ; /* OK */
  1736. #else
  1737. error "Mac OS X 10.6 or newer required";
  1738. #endif
  1739. #endif
  1740. ])],
  1741. ns_osx_have_106=yes,
  1742. ns_osx_have_106=no)
  1743. AC_MSG_RESULT([$ns_osx_have_106])
  1744. if test $ns_osx_have_106 = no; then
  1745. AC_MSG_ERROR([Mac OS X 10.6 or newer is required]);
  1746. fi
  1747. fi
  1748. fi
  1749. AC_SUBST(LIBS_GNUSTEP)
  1750. INSTALL_ARCH_INDEP_EXTRA=install-etc
  1751. ns_self_contained=no
  1752. NS_OBJ=
  1753. NS_OBJC_OBJ=
  1754. if test "${HAVE_NS}" = yes; then
  1755. if test "$with_toolkit_scroll_bars" = "no"; then
  1756. AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for Nextstep.])
  1757. fi
  1758. window_system=nextstep
  1759. # set up packaging dirs
  1760. if test "${EN_NS_SELF_CONTAINED}" = yes; then
  1761. ns_self_contained=yes
  1762. prefix=${ns_appresdir}
  1763. exec_prefix=${ns_appbindir}
  1764. dnl This one isn't really used, only archlibdir is.
  1765. libexecdir="\${ns_appbindir}/libexec"
  1766. archlibdir="\${ns_appbindir}/libexec"
  1767. etcdocdir="\${ns_appresdir}/etc"
  1768. etcdir="\${ns_appresdir}/etc"
  1769. dnl FIXME maybe set datarootdir instead.
  1770. dnl That would also get applications, icons, man.
  1771. infodir="\${ns_appresdir}/info"
  1772. mandir="\${ns_appresdir}/man"
  1773. lispdir="\${ns_appresdir}/lisp"
  1774. test "$locallisppathset" = no && locallisppath=""
  1775. INSTALL_ARCH_INDEP_EXTRA=
  1776. fi
  1777. NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o $ns_fontfile"
  1778. fi
  1779. CFLAGS="$tmp_CFLAGS"
  1780. CPPFLAGS="$tmp_CPPFLAGS"
  1781. AC_SUBST(INSTALL_ARCH_INDEP_EXTRA)
  1782. AC_SUBST(ns_self_contained)
  1783. AC_SUBST(NS_OBJ)
  1784. AC_SUBST(NS_OBJC_OBJ)
  1785. if test "${HAVE_NS}" = yes; then
  1786. AC_CACHE_CHECK(
  1787. [if the Objective C compiler supports instancetype],
  1788. [emacs_cv_objc_instancetype],
  1789. [AC_LANG_PUSH([Objective C])
  1790. AC_COMPILE_IFELSE(
  1791. [AC_LANG_SOURCE([[@interface Test
  1792. + (instancetype)test;
  1793. @end]])],
  1794. emacs_cv_objc_instancetype=yes,
  1795. emacs_cv_objc_instancetype=no)
  1796. AC_LANG_POP([Objective C])])
  1797. if test x$emacs_cv_objc_instancetype = xyes ; then
  1798. AC_DEFINE(NATIVE_OBJC_INSTANCETYPE, 1,
  1799. [Define if ObjC compiler supports instancetype natively.])
  1800. fi
  1801. fi
  1802. HAVE_W32=no
  1803. W32_OBJ=
  1804. W32_LIBS=
  1805. EMACSRES=
  1806. CLIENTRES=
  1807. CLIENTW=
  1808. W32_RES_LINK=
  1809. EMACS_MANIFEST=
  1810. if test "${with_w32}" != no; then
  1811. case "${opsys}" in
  1812. cygwin)
  1813. AC_CHECK_HEADER([windows.h], [HAVE_W32=yes],
  1814. [AC_MSG_ERROR(['--with-w32' was specified, but windows.h
  1815. cannot be found.])])
  1816. ;;
  1817. mingw32)
  1818. ## Using --with-w32 with MinGW is a no-op, but we allow it.
  1819. ;;
  1820. *)
  1821. AC_MSG_ERROR([Using w32 with an autotools build is only supported for Cygwin and MinGW32.])
  1822. ;;
  1823. esac
  1824. fi
  1825. if test "${opsys}" = "mingw32"; then
  1826. AC_CACHE_CHECK([whether Windows API headers are recent enough], [emacs_cv_w32api],
  1827. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1828. #include <windows.h>
  1829. #include <usp10.h>]],
  1830. [[PIMAGE_NT_HEADERS pHeader;
  1831. PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(pHeader)]])],
  1832. [emacs_cv_w32api=yes], [emacs_cv_w32api=no])])
  1833. if test "${emacs_cv_w32api}" = "no"; then
  1834. AC_MSG_ERROR([the Windows API headers are too old to support this build.])
  1835. fi
  1836. HAVE_W32=${emacs_cv_w32api}
  1837. fi
  1838. FIRSTFILE_OBJ=
  1839. NTDIR=
  1840. LIBS_ECLIENT=
  1841. LIB_WSOCK32=
  1842. NTLIB=
  1843. CM_OBJ="cm.o"
  1844. XARGS_LIMIT=
  1845. if test "${HAVE_W32}" = "yes"; then
  1846. AC_DEFINE(HAVE_NTGUI, 1, [Define to use native MS Windows GUI.])
  1847. if test "$with_toolkit_scroll_bars" = "no"; then
  1848. AC_MSG_ERROR([Non-toolkit scroll bars are not implemented for w32 build.])
  1849. fi
  1850. AC_CHECK_TOOL(WINDRES, [windres],
  1851. [AC_MSG_ERROR([No resource compiler found.])])
  1852. W32_OBJ="w32fns.o w32menu.o w32reg.o w32font.o w32term.o"
  1853. W32_OBJ="$W32_OBJ w32xfns.o w32select.o w32uniscribe.o"
  1854. EMACSRES="emacs.res"
  1855. case "$canonical" in
  1856. x86_64-*-*) EMACS_MANIFEST="emacs-x64.manifest" ;;
  1857. *) EMACS_MANIFEST="emacs-x86.manifest" ;;
  1858. esac
  1859. dnl Construct something of the form "24,4,0,0" with 4 components.
  1860. comma_version=`echo "${PACKAGE_VERSION}.0.0" | sed -e 's/\./,/g' -e 's/^\([[^,]]*,[[^,]]*,[[^,]]*,[[^,]]*\).*/\1/'`
  1861. comma_space_version=`echo "$comma_version" | sed 's/,/, /g'`
  1862. AC_SUBST(comma_version)
  1863. AC_SUBST(comma_space_version)
  1864. AC_CONFIG_FILES([nt/emacs.rc nt/emacsclient.rc])
  1865. if test "${opsys}" = "cygwin"; then
  1866. W32_LIBS="$W32_LIBS -lkernel32 -luser32 -lgdi32 -lole32 -lcomdlg32"
  1867. W32_LIBS="$W32_LIBS -lusp10 -lcomctl32 -lwinspool"
  1868. # Tell the linker that emacs.res is an object (which we compile from
  1869. # the rc file), not a linker script.
  1870. W32_RES_LINK="-Wl,emacs.res"
  1871. else
  1872. W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
  1873. W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
  1874. W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32 -lusp10"
  1875. W32_RES_LINK="\$(EMACSRES)"
  1876. CLIENTRES="emacsclient.res"
  1877. CLIENTW="emacsclientw\$(EXEEXT)"
  1878. FIRSTFILE_OBJ=firstfile.o
  1879. NTDIR=nt
  1880. CM_OBJ=
  1881. LIBS_ECLIENT="-lcomctl32"
  1882. LIB_WSOCK32="-lwsock32"
  1883. NTLIB="ntlib.$ac_objext"
  1884. XARGS_LIMIT="-s 10000"
  1885. fi
  1886. fi
  1887. AC_SUBST(W32_OBJ)
  1888. AC_SUBST(W32_LIBS)
  1889. AC_SUBST(EMACSRES)
  1890. AC_SUBST(EMACS_MANIFEST)
  1891. AC_SUBST(CLIENTRES)
  1892. AC_SUBST(CLIENTW)
  1893. AC_SUBST(W32_RES_LINK)
  1894. AC_SUBST(FIRSTFILE_OBJ)
  1895. AC_SUBST(NTDIR)
  1896. AC_SUBST(CM_OBJ)
  1897. AC_SUBST(LIBS_ECLIENT)
  1898. AC_SUBST(LIB_WSOCK32)
  1899. AC_SUBST(NTLIB)
  1900. AC_SUBST(XARGS_LIMIT)
  1901. if test "${HAVE_W32}" = "yes"; then
  1902. window_system=w32
  1903. with_xft=no
  1904. fi
  1905. ## $window_system is now set to the window system we will
  1906. ## ultimately use.
  1907. term_header=
  1908. HAVE_X_WINDOWS=no
  1909. HAVE_X11=no
  1910. USE_X_TOOLKIT=none
  1911. case "${window_system}" in
  1912. x11 )
  1913. HAVE_X_WINDOWS=yes
  1914. HAVE_X11=yes
  1915. term_header=xterm.h
  1916. case "${with_x_toolkit}" in
  1917. athena | lucid ) USE_X_TOOLKIT=LUCID ;;
  1918. motif ) USE_X_TOOLKIT=MOTIF ;;
  1919. gtk ) with_gtk=yes
  1920. term_header=gtkutil.h
  1921. dnl Don't set this for GTK. A lot of tests below assumes Xt when
  1922. dnl USE_X_TOOLKIT is set.
  1923. USE_X_TOOLKIT=none ;;
  1924. gtk2 ) with_gtk2=yes
  1925. term_header=gtkutil.h
  1926. USE_X_TOOLKIT=none ;;
  1927. gtk3 ) with_gtk3=yes
  1928. term_header=gtkutil.h
  1929. USE_X_TOOLKIT=none ;;
  1930. no ) USE_X_TOOLKIT=none ;;
  1931. dnl If user did not say whether to use a toolkit, make this decision later:
  1932. dnl use the toolkit if we have gtk, or X11R5 or newer.
  1933. * ) USE_X_TOOLKIT=maybe ;;
  1934. esac
  1935. ;;
  1936. nextstep )
  1937. term_header=nsterm.h
  1938. ;;
  1939. w32 )
  1940. term_header=w32term.h
  1941. ;;
  1942. esac
  1943. if test "$window_system" = none && test "X$with_x" != "Xno"; then
  1944. AC_CHECK_PROG(HAVE_XSERVER, X, true, false)
  1945. if test "$HAVE_XSERVER" = true ||
  1946. test -n "$DISPLAY" ||
  1947. {
  1948. for emacs_libX11 in /usr/lib/libX11.*; do break; done
  1949. test "$emacs_libX11" != '/usr/lib/libX11.*'
  1950. }
  1951. then
  1952. AC_MSG_ERROR([You seem to be running X, but no X development libraries
  1953. were found. You should install the relevant development files for X
  1954. and for the toolkit you want, such as Gtk+ or Motif. Also make
  1955. sure you have development files for image handling, i.e.
  1956. tiff, gif, jpeg, png and xpm.
  1957. If you are sure you want Emacs compiled without X window support, pass
  1958. --without-x
  1959. to configure.])
  1960. fi
  1961. fi
  1962. # Does the opsystem file prohibit the use of the GNU malloc?
  1963. # Assume not, until told otherwise.
  1964. GNU_MALLOC=yes
  1965. AC_CACHE_CHECK(
  1966. [whether malloc is Doug Lea style],
  1967. [emacs_cv_var_doug_lea_malloc],
  1968. [emacs_cv_var_doug_lea_malloc=no
  1969. dnl Hooks do not work with address sanitization.
  1970. if test "$emacs_cv_sanitize_address" != yes; then
  1971. AC_LINK_IFELSE(
  1972. [AC_LANG_PROGRAM(
  1973. [[#include <malloc.h>
  1974. static void hook (void) {}]],
  1975. [[malloc_set_state (malloc_get_state ());
  1976. __after_morecore_hook = hook;
  1977. __malloc_initialize_hook = hook;]])],
  1978. [emacs_cv_var_doug_lea_malloc=yes])
  1979. fi])
  1980. doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
  1981. hybrid_malloc=
  1982. system_malloc=yes
  1983. test "$CANNOT_DUMP" = yes ||
  1984. case "$opsys" in
  1985. ## darwin ld insists on the use of malloc routines in the System framework.
  1986. darwin | mingw32 | nacl | sol2-10) ;;
  1987. cygwin) hybrid_malloc=yes
  1988. system_malloc= ;;
  1989. *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
  1990. esac
  1991. if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
  1992. && test "${UNEXEC_OBJ}" = unexelf.o; then
  1993. hybrid_malloc=yes
  1994. fi
  1995. GMALLOC_OBJ=
  1996. HYBRID_MALLOC=
  1997. if test "${system_malloc}" = "yes"; then
  1998. AC_DEFINE([SYSTEM_MALLOC], 1,
  1999. [Define to 1 to use the system memory allocator, even if it is not
  2000. Doug Lea style.])
  2001. GNU_MALLOC=no
  2002. GNU_MALLOC_reason="
  2003. (The GNU allocators don't work with this system configuration.)"
  2004. VMLIMIT_OBJ=
  2005. elif test "$hybrid_malloc" = yes; then
  2006. AC_DEFINE(HYBRID_MALLOC, 1,
  2007. [Define to use gmalloc before dumping and the system malloc after.])
  2008. HYBRID_MALLOC=1
  2009. GNU_MALLOC=no
  2010. GNU_MALLOC_reason=" (only before dumping)"
  2011. GMALLOC_OBJ=gmalloc.o
  2012. VMLIMIT_OBJ=
  2013. else
  2014. test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
  2015. VMLIMIT_OBJ=vm-limit.o
  2016. AC_CHECK_HEADERS([sys/vlimit.h])
  2017. AC_CACHE_CHECK([for data_start], [emacs_cv_data_start],
  2018. [AC_LINK_IFELSE(
  2019. [AC_LANG_PROGRAM(
  2020. [[extern char data_start[]; char ch;]],
  2021. [[return data_start < &ch;]])],
  2022. [emacs_cv_data_start=yes],
  2023. [emacs_cv_data_start=no])])
  2024. if test $emacs_cv_data_start = yes; then
  2025. AC_DEFINE([HAVE_DATA_START], 1,
  2026. [Define to 1 if data_start is the address of the start
  2027. of the main data segment.])
  2028. fi
  2029. fi
  2030. AC_SUBST([HYBRID_MALLOC])
  2031. AC_SUBST(GMALLOC_OBJ)
  2032. AC_SUBST(VMLIMIT_OBJ)
  2033. if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then
  2034. if test "$GNU_MALLOC" = yes ; then
  2035. GNU_MALLOC_reason="
  2036. (Using Doug Lea's new malloc from the GNU C Library.)"
  2037. fi
  2038. AC_DEFINE(DOUG_LEA_MALLOC, 1,
  2039. [Define to 1 if the system memory allocator is Doug Lea style,
  2040. with malloc hooks and malloc_set_state.])
  2041. ## Use mmap directly for allocating larger buffers.
  2042. ## FIXME this comes from src/s/{gnu,gnu-linux}.h:
  2043. ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif
  2044. ## Does the AC_FUNC_MMAP test below make this check unnecessary?
  2045. case "$opsys" in
  2046. mingw32|gnu*) REL_ALLOC=no ;;
  2047. esac
  2048. fi
  2049. if test x"${REL_ALLOC}" = x; then
  2050. REL_ALLOC=${GNU_MALLOC}
  2051. fi
  2052. use_mmap_for_buffers=no
  2053. case "$opsys" in
  2054. mingw32) use_mmap_for_buffers=yes ;;
  2055. esac
  2056. AC_FUNC_MMAP
  2057. if test $use_mmap_for_buffers = yes; then
  2058. AC_DEFINE(USE_MMAP_FOR_BUFFERS, 1, [Define to use mmap to allocate buffer text.])
  2059. REL_ALLOC=no
  2060. fi
  2061. LIBS="$LIBS_SYSTEM $LIBS"
  2062. dnl FIXME replace main with a function we actually want from this library.
  2063. AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
  2064. dnl Check for the POSIX thread library.
  2065. LIB_PTHREAD=
  2066. AC_CHECK_HEADERS_ONCE(pthread.h)
  2067. if test "$ac_cv_header_pthread_h" && test "$opsys" != "mingw32"; then
  2068. AC_CACHE_CHECK([for pthread library],
  2069. [emacs_cv_pthread_lib],
  2070. [emacs_cv_pthread_lib=no
  2071. OLD_LIBS=$LIBS
  2072. for emacs_pthread_lib in 'none needed' -lpthread; do
  2073. case $emacs_pthread_lib in
  2074. -*) LIBS="$OLD_LIBS $emacs_pthread_lib";;
  2075. esac
  2076. AC_LINK_IFELSE(
  2077. [AC_LANG_PROGRAM(
  2078. [[#include <pthread.h>
  2079. #include <signal.h>
  2080. sigset_t old_mask, new_mask;
  2081. void noop (void) {}]],
  2082. [[pthread_t th = pthread_self ();
  2083. int status = 0;
  2084. status += pthread_create (&th, 0, 0, 0);
  2085. status += pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask);
  2086. status += pthread_kill (th, 0);
  2087. #if ! (defined SYSTEM_MALLOC || defined HYBRID_MALLOC \
  2088. || defined DOUG_LEA_MALLOC)
  2089. /* Test for pthread_atfork only if gmalloc uses it,
  2090. as older-style hosts like MirBSD 10 lack it. */
  2091. status += pthread_atfork (noop, noop, noop);
  2092. #endif
  2093. return status;]])],
  2094. [emacs_cv_pthread_lib=$emacs_pthread_lib])
  2095. LIBS=$OLD_LIBS
  2096. if test "$emacs_cv_pthread_lib" != no; then
  2097. break
  2098. fi
  2099. done])
  2100. if test "$emacs_cv_pthread_lib" != no; then
  2101. AC_DEFINE([HAVE_PTHREAD], 1, [Define to 1 if you have POSIX threads.])
  2102. case $emacs_cv_pthread_lib in
  2103. -*) LIB_PTHREAD=$emacs_cv_pthread_lib;;
  2104. esac
  2105. ac_cv_func_pthread_sigmask=yes
  2106. # Some systems optimize for single-threaded programs by default, and
  2107. # need special flags to disable these optimizations. For example, the
  2108. # definition of 'errno' in <errno.h>.
  2109. case $opsys in
  2110. hpux* | sol*)
  2111. AC_DEFINE([_REENTRANT], 1,
  2112. [Define to 1 if your system requires this in multithreaded code.]);;
  2113. aix4-2)
  2114. AC_DEFINE([_THREAD_SAFE], 1,
  2115. [Define to 1 if your system requires this in multithreaded code.]);;
  2116. esac
  2117. fi
  2118. fi
  2119. AC_SUBST([LIB_PTHREAD])
  2120. AC_MSG_CHECKING([for thread support])
  2121. threads_enabled=no
  2122. if test "$with_threads" = yes; then
  2123. if test "$emacs_cv_pthread_lib" != no; then
  2124. AC_DEFINE(THREADS_ENABLED, 1,
  2125. [Define to 1 if you want elisp thread support.])
  2126. threads_enabled=yes
  2127. elif test "${opsys}" = "mingw32"; then
  2128. dnl MinGW can do native Windows threads even without pthreads
  2129. AC_DEFINE(THREADS_ENABLED, 1,
  2130. [Define to 1 if you want elisp thread support.])
  2131. threads_enabled=yes
  2132. fi
  2133. fi
  2134. AC_MSG_RESULT([$threads_enabled])
  2135. dnl Check for need for bigtoc support on IBM AIX
  2136. case ${host_os} in
  2137. aix*)
  2138. AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
  2139. case $GCC in
  2140. yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
  2141. *) gdb_cv_bigtoc=-bbigtoc ;;
  2142. esac
  2143. LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
  2144. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[int i;]])], [], [gdb_cv_bigtoc=])
  2145. ])
  2146. ;;
  2147. esac
  2148. # Change CFLAGS, CPPFLAGS, and LIBS temporarily so that C_SWITCH_X_SITE
  2149. # is for the tests that follow. We set them back later on.
  2150. REAL_CFLAGS="$CFLAGS"
  2151. REAL_CPPFLAGS="$CPPFLAGS"
  2152. REAL_LIBS="$LIBS"
  2153. if test "${HAVE_X11}" = "yes"; then
  2154. DEFS="$C_SWITCH_X_SITE $DEFS"
  2155. LDFLAGS="$LDFLAGS $LD_SWITCH_X_SITE"
  2156. LIBS="-lX11 $LIBS"
  2157. CFLAGS="$C_SWITCH_X_SITE $CFLAGS"
  2158. CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
  2159. # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
  2160. # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
  2161. # but it's more convenient here to set LD_RUN_PATH since this
  2162. # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
  2163. if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
  2164. LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
  2165. export LD_RUN_PATH
  2166. fi
  2167. if test "${opsys}" = "gnu-linux"; then
  2168. AC_CACHE_CHECK([whether X on GNU/Linux needs -b to link], [emacs_cv_b_link],
  2169. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
  2170. [[XOpenDisplay ("foo");]])],
  2171. [xgnu_linux_first_failure=no],
  2172. [xgnu_linux_first_failure=yes])
  2173. if test "${xgnu_linux_first_failure}" = "yes"; then
  2174. OLD_CPPFLAGS="$CPPFLAGS"
  2175. OLD_LIBS="$LIBS"
  2176. CPPFLAGS="$CPPFLAGS -b i486-linuxaout"
  2177. LIBS="$LIBS -b i486-linuxaout"
  2178. AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
  2179. [[XOpenDisplay ("foo");]])],
  2180. [xgnu_linux_second_failure=no],
  2181. [xgnu_linux_second_failure=yes])
  2182. if test "${xgnu_linux_second_failure}" = "yes"; then
  2183. # If we get the same failure with -b, there is no use adding -b.
  2184. # So leave it out. This plays safe.
  2185. emacs_cv_b_link=no
  2186. else
  2187. emacs_cv_b_link=yes
  2188. fi
  2189. CPPFLAGS=$OLD_CPPFLAGS
  2190. LIBS=$OLD_LIBS
  2191. else
  2192. emacs_cv_b_link=no
  2193. fi])
  2194. if test "x$emacs_cv_b_link" = xyes ; then
  2195. LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -b i486-linuxaout"
  2196. C_SWITCH_X_SITE="$C_SWITCH_X_SITE -b i486-linuxaout"
  2197. fi
  2198. fi
  2199. # Reportedly, some broken Solaris systems have XKBlib.h but are missing
  2200. # header files included from there.
  2201. AC_CACHE_CHECK([for Xkb], [emacs_cv_xkb],
  2202. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>
  2203. #include <X11/XKBlib.h>]],
  2204. [[XkbDescPtr kb = XkbGetKeyboard (0, XkbAllComponentsMask, XkbUseCoreKbd);]])],
  2205. emacs_cv_xkb=yes, emacs_cv_xkb=no)])
  2206. if test $emacs_cv_xkb = yes; then
  2207. AC_DEFINE(HAVE_XKB, 1, [Define to 1 if you have the Xkb extension.])
  2208. fi
  2209. AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
  2210. XScreenNumberOfScreen)
  2211. fi
  2212. if test "${window_system}" = "x11"; then
  2213. AC_MSG_CHECKING(X11 version 6)
  2214. AC_CACHE_VAL(emacs_cv_x11_version_6,
  2215. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]],
  2216. [[#if XlibSpecificationRelease < 6
  2217. fail;
  2218. #endif
  2219. ]])], emacs_cv_x11_version_6=yes, emacs_cv_x11_version_6=no)])
  2220. if test $emacs_cv_x11_version_6 = yes; then
  2221. AC_MSG_RESULT(6 or newer)
  2222. AC_DEFINE(HAVE_X11R6, 1,
  2223. [Define to 1 if you have the X11R6 or newer version of Xlib.])
  2224. AC_DEFINE(HAVE_X_I18N, 1, [Define if you have usable i18n support.])
  2225. ## inoue@ainet.or.jp says Solaris has a bug related to X11R6-style
  2226. ## XIM support.
  2227. case "$opsys" in
  2228. sol2-*) : ;;
  2229. *) AC_DEFINE(HAVE_X11R6_XIM, 1,
  2230. [Define if you have usable X11R6-style XIM support.])
  2231. ;;
  2232. esac
  2233. else
  2234. AC_MSG_RESULT(before 6)
  2235. fi
  2236. fi
  2237. ### Use -lrsvg-2 if available, unless '--with-rsvg=no' is specified.
  2238. HAVE_RSVG=no
  2239. if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${opsys}" = "mingw32"; then
  2240. if test "${with_rsvg}" != "no"; then
  2241. RSVG_REQUIRED=2.11.0
  2242. RSVG_MODULE="librsvg-2.0 >= $RSVG_REQUIRED"
  2243. EMACS_CHECK_MODULES([RSVG], [$RSVG_MODULE])
  2244. AC_SUBST(RSVG_CFLAGS)
  2245. AC_SUBST(RSVG_LIBS)
  2246. if test $HAVE_RSVG = yes; then
  2247. AC_DEFINE(HAVE_RSVG, 1, [Define to 1 if using librsvg.])
  2248. CFLAGS="$CFLAGS $RSVG_CFLAGS"
  2249. # Windows loads librsvg dynamically
  2250. if test "${opsys}" = "mingw32"; then
  2251. RSVG_LIBS=
  2252. fi
  2253. fi
  2254. fi
  2255. fi
  2256. HAVE_IMAGEMAGICK=no
  2257. if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then
  2258. if test "${with_imagemagick}" != "no"; then
  2259. ## 6.3.5 is the earliest version known to work; see Bug#17339.
  2260. ## 6.8.2 makes Emacs crash; see Bug#13867.
  2261. ## 7 and later have not been ported to; See Bug#25967.
  2262. IMAGEMAGICK_MODULE="Wand >= 6.3.5 Wand != 6.8.2 Wand < 7"
  2263. EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE])
  2264. if test $HAVE_IMAGEMAGICK = yes; then
  2265. OLD_CFLAGS=$CFLAGS
  2266. OLD_LIBS=$LIBS
  2267. CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
  2268. LIBS="$IMAGEMAGICK_LIBS $LIBS"
  2269. AC_CHECK_FUNCS([MagickRelinquishMemory MagickExportImagePixels \
  2270. MagickMergeImageLayers MagickAutoOrientImage])
  2271. CFLAGS=$OLD_CFLAGS
  2272. LIBS=$OLD_LIBS
  2273. # Check that ImageMagick links. It does not link on Fedora 25
  2274. # with './configure CC=clang', as pkg-config outputs flags like
  2275. # -lomp that work for GCC but not Clang.
  2276. if test "$ac_cv_func_MagickRelinquishMemory" != yes; then
  2277. HAVE_IMAGEMAGICK=no
  2278. fi
  2279. fi
  2280. if test $HAVE_IMAGEMAGICK = yes; then
  2281. AC_DEFINE([HAVE_IMAGEMAGICK], 1, [Define to 1 if using ImageMagick.])
  2282. else
  2283. IMAGEMAGICK_CFLAGS=
  2284. IMAGEMAGICK_LIBS=
  2285. fi
  2286. AC_SUBST([IMAGEMAGICK_CFLAGS])
  2287. AC_SUBST([IMAGEMAGICK_LIBS])
  2288. fi
  2289. fi
  2290. AC_CHECK_LIB(anl, getaddrinfo_a, HAVE_GETADDRINFO_A=yes)
  2291. if test "${HAVE_GETADDRINFO_A}" = "yes"; then
  2292. AC_DEFINE(HAVE_GETADDRINFO_A, 1,
  2293. [Define to 1 if you have getaddrinfo_a for asynchronous DNS resolution.])
  2294. GETADDRINFO_A_LIBS="-lanl"
  2295. AC_SUBST(GETADDRINFO_A_LIBS)
  2296. fi
  2297. HAVE_GTK=no
  2298. GTK_OBJ=
  2299. gtk_term_header=$term_header
  2300. check_gtk2=no
  2301. gtk3_pkg_errors=
  2302. if test "${opsys}" != "mingw32"; then
  2303. if test "${with_gtk3}" = "yes" || test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
  2304. GLIB_REQUIRED=2.28
  2305. GTK_REQUIRED=3.0
  2306. GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
  2307. dnl Checks for libraries.
  2308. EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
  2309. [pkg_check_gtk=yes], [pkg_check_gtk=no])
  2310. if test "$pkg_check_gtk" = "no" && test "$with_gtk3" = "yes"; then
  2311. AC_MSG_ERROR($GTK_PKG_ERRORS)
  2312. fi
  2313. if test "$pkg_check_gtk" = "yes"; then
  2314. AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.])
  2315. GTK_OBJ=emacsgtkfixed.o
  2316. gtk_term_header=gtkutil.h
  2317. USE_GTK_TOOLKIT="GTK3"
  2318. if test "x$ac_enable_gtk_deprecation_warnings" = x; then
  2319. AC_DEFINE([GDK_DISABLE_DEPRECATION_WARNINGS], [1],
  2320. [Define to 1 to disable GTK+/GDK deprecation warnings.])
  2321. AC_DEFINE([GLIB_DISABLE_DEPRECATION_WARNINGS], [1],
  2322. [Define to 1 to disable Glib deprecation warnings.])
  2323. fi
  2324. else
  2325. check_gtk2=yes
  2326. gtk3_pkg_errors="$GTK_PKG_ERRORS "
  2327. fi
  2328. fi
  2329. if test "${with_gtk2}" = "yes" || test "$check_gtk2" = "yes"; then
  2330. GLIB_REQUIRED=2.10
  2331. GTK_REQUIRED=2.10
  2332. GTK_MODULES="gtk+-2.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
  2333. dnl Checks for libraries.
  2334. EMACS_CHECK_MODULES([GTK], [$GTK_MODULES],
  2335. [pkg_check_gtk=yes], [pkg_check_gtk=no])
  2336. if test "$pkg_check_gtk" = "no" &&
  2337. { test "$with_gtk" = yes || test "$with_gtk2" = "yes"; }
  2338. then
  2339. AC_MSG_ERROR($gtk3_pkg_errors$GTK_PKG_ERRORS)
  2340. fi
  2341. test "$pkg_check_gtk" = "yes" && USE_GTK_TOOLKIT="GTK2"
  2342. fi
  2343. fi
  2344. OLD_CFLAGS=$CFLAGS
  2345. OLD_LIBS=$LIBS
  2346. if test x"$pkg_check_gtk" = xyes; then
  2347. AC_SUBST(GTK_LIBS)
  2348. CFLAGS="$CFLAGS $GTK_CFLAGS"
  2349. LIBS="$GTK_LIBS $LIBS"
  2350. dnl Try to compile a simple GTK program.
  2351. AC_CACHE_CHECK([whether GTK compiles], [emacs_cv_gtk_compiles],
  2352. [AC_LINK_IFELSE(
  2353. [AC_LANG_PROGRAM(
  2354. [[/* Check the Gtk and Glib APIs. */
  2355. #include <gtk/gtk.h>
  2356. #include <glib-object.h>
  2357. static void
  2358. callback (GObject *go, GParamSpec *spec, gpointer user_data)
  2359. {}
  2360. ]],
  2361. [[
  2362. GtkSettings *gs = 0;
  2363. /* Use G_CALLBACK to make sure function pointers can be cast to void *;
  2364. strict C prohibits this. Use gtk_main_iteration to test that the
  2365. libraries are there. */
  2366. if (g_signal_handler_find (G_OBJECT (gs), G_SIGNAL_MATCH_FUNC,
  2367. 0, 0, 0, G_CALLBACK (callback), 0))
  2368. gtk_main_iteration ();
  2369. ]])],
  2370. [emacs_cv_gtk_compiles=yes], [emacs_cv_gtk_compiles=no])])
  2371. if test "${emacs_cv_gtk_compiles}" != "yes"; then
  2372. GTK_OBJ=
  2373. if test "$USE_X_TOOLKIT" != "maybe"; then
  2374. AC_MSG_ERROR([Gtk+ wanted, but it does not compile, see config.log. Maybe some x11-devel files missing?]);
  2375. fi
  2376. else
  2377. C_SWITCH_X_SITE="$C_SWITCH_X_SITE $GTK_CFLAGS"
  2378. HAVE_GTK=yes
  2379. AC_DEFINE(USE_GTK, 1, [Define to 1 if using GTK.])
  2380. GTK_OBJ="gtkutil.o $GTK_OBJ"
  2381. term_header=$gtk_term_header
  2382. USE_X_TOOLKIT=none
  2383. AC_MSG_WARN([[Your version of Gtk+ will have problems with
  2384. closing open displays. This is no problem if you just use
  2385. one display, but if you use more than one and close one of them
  2386. Emacs may crash.
  2387. See http://bugzilla.gnome.org/show_bug.cgi?id=85715]])
  2388. fi
  2389. fi
  2390. AC_SUBST(GTK_OBJ)
  2391. if test "${HAVE_GTK}" = "yes"; then
  2392. dnl GTK scrollbars resemble toolkit scrollbars a lot, so to avoid
  2393. dnl a lot if #ifdef:s, say we have toolkit scrollbars.
  2394. if test "$with_toolkit_scroll_bars" != no; then
  2395. with_toolkit_scroll_bars=yes
  2396. fi
  2397. dnl Check if we have the old file selection dialog declared and
  2398. dnl in the link library. In 2.x it may be in the library,
  2399. dnl but not declared if deprecated featured has been selected out.
  2400. dnl AC_CHECK_DECL checks for a macro, so check for GTK_TYPE_FILE_SELECTION.
  2401. HAVE_GTK_FILE_SELECTION=no
  2402. AC_CHECK_DECL(GTK_TYPE_FILE_SELECTION, HAVE_GTK_FILE_SELECTION=yes,
  2403. HAVE_GTK_FILE_SELECTION=no, [AC_INCLUDES_DEFAULT
  2404. #include <gtk/gtk.h>])
  2405. if test "$HAVE_GTK_FILE_SELECTION" = yes; then
  2406. AC_CHECK_FUNCS(gtk_file_selection_new)
  2407. fi
  2408. dnl Same as above for gtk_handle_box.
  2409. HAVE_GTK_HANDLE_BOX=no
  2410. AC_CHECK_DECL(GTK_TYPE_HANDLE_BOX, HAVE_GTK_HANDLE_BOX=yes,
  2411. HAVE_GTK_HANDLE_BOX=no, [AC_INCLUDES_DEFAULT
  2412. #include <gtk/gtk.h>])
  2413. if test "$HAVE_GTK_HANDLE_BOX" = yes; then
  2414. AC_CHECK_FUNCS(gtk_handle_box_new)
  2415. fi
  2416. dnl Same as above for gtk_tearoff_menu_item.
  2417. HAVE_GTK_TEAROFF_MENU_ITEM=no
  2418. AC_CHECK_DECL(GTK_TYPE_TEAROFF_MENU_ITEM, HAVE_GTK_TEAROFF_MENU_ITEM=yes,
  2419. HAVE_GTK_TEAROFF_MENU_ITEM=no, [AC_INCLUDES_DEFAULT
  2420. #include <gtk/gtk.h>])
  2421. if test "$HAVE_GTK_TEAROFF_MENU_ITEM" = yes; then
  2422. AC_CHECK_FUNCS(gtk_tearoff_menu_item_new)
  2423. fi
  2424. dnl Check for functions introduced in 2.14 and later.
  2425. AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
  2426. gtk_dialog_get_action_area gtk_widget_get_sensitive \
  2427. gtk_widget_get_mapped gtk_adjustment_get_page_size \
  2428. gtk_orientable_set_orientation \
  2429. gtk_window_set_has_resize_grip)
  2430. term_header=gtkutil.h
  2431. fi
  2432. dnl Enable xwidgets if GTK3 and WebKitGTK+ are available.
  2433. HAVE_XWIDGETS=no
  2434. XWIDGETS_OBJ=
  2435. if test "$with_xwidgets" != "no"; then
  2436. test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none" ||
  2437. AC_MSG_ERROR([xwidgets requested but gtk3 not used.])
  2438. WEBKIT_REQUIRED=2.12
  2439. WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
  2440. EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
  2441. HAVE_XWIDGETS=$HAVE_WEBKIT
  2442. test $HAVE_XWIDGETS = yes ||
  2443. AC_MSG_ERROR([xwidgets requested but WebKitGTK+ not found.])
  2444. XWIDGETS_OBJ=xwidget.o
  2445. AC_DEFINE([HAVE_XWIDGETS], 1, [Define to 1 if you have xwidgets support.])
  2446. fi
  2447. AC_SUBST(XWIDGETS_OBJ)
  2448. CFLAGS=$OLD_CFLAGS
  2449. LIBS=$OLD_LIBS
  2450. dnl D-Bus has been tested under GNU/Linux only. Must be adapted for
  2451. dnl other platforms.
  2452. HAVE_DBUS=no
  2453. DBUS_OBJ=
  2454. if test "${with_dbus}" = "yes"; then
  2455. EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0])
  2456. if test "$HAVE_DBUS" = yes; then
  2457. AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
  2458. dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
  2459. dnl dbus_type_is_valid and dbus_validate_* have been introduced in
  2460. dnl D-Bus 1.5.12.
  2461. OLD_LIBS=$LIBS
  2462. LIBS="$LIBS $DBUS_LIBS"
  2463. AC_CHECK_FUNCS(dbus_watch_get_unix_fd \
  2464. dbus_type_is_valid \
  2465. dbus_validate_bus_name \
  2466. dbus_validate_path \
  2467. dbus_validate_interface \
  2468. dbus_validate_member)
  2469. LIBS=$OLD_LIBS
  2470. DBUS_OBJ=dbusbind.o
  2471. fi
  2472. fi
  2473. AC_SUBST(DBUS_CFLAGS)
  2474. AC_SUBST(DBUS_LIBS)
  2475. AC_SUBST(DBUS_OBJ)
  2476. dnl GSettings has been tested under GNU/Linux only.
  2477. HAVE_GSETTINGS=no
  2478. if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then
  2479. EMACS_CHECK_MODULES([GSETTINGS], [gio-2.0 >= 2.26])
  2480. if test "$HAVE_GSETTINGS" = "yes"; then
  2481. old_CFLAGS=$CFLAGS
  2482. CFLAGS="$CFLAGS $GSETTINGS_CFLAGS"
  2483. old_LIBS=$LIBS
  2484. LIBS="$LIBS $GSETTINGS_LIBS"
  2485. AC_CACHE_CHECK([whether GSettings is in gio], [emacs_cv_gsettings_in_gio],
  2486. [AC_LINK_IFELSE(
  2487. [AC_LANG_PROGRAM(
  2488. [[/* Check that gsettings really is present. */
  2489. #include <glib-object.h>
  2490. #include <gio/gio.h>
  2491. ]],
  2492. [[
  2493. GSettings *settings;
  2494. GVariant *val = g_settings_get_value (settings, "");
  2495. ]])],
  2496. [emacs_cv_gsettings_in_gio=yes], [emacs_cv_gsettings_in_gio=no])])
  2497. if test "$emacs_cv_gsettings_in_gio" = "yes"; then
  2498. AC_DEFINE(HAVE_GSETTINGS, 1, [Define to 1 if using GSettings.])
  2499. SETTINGS_CFLAGS="$GSETTINGS_CFLAGS"
  2500. SETTINGS_LIBS="$GSETTINGS_LIBS"
  2501. test "$with_gconf" = "yes" || with_gconf=no
  2502. fi
  2503. CFLAGS=$old_CFLAGS
  2504. LIBS=$old_LIBS
  2505. fi
  2506. fi
  2507. dnl GConf has been tested under GNU/Linux only.
  2508. dnl The version is really arbitrary, it is about the same age as Gtk+ 2.6.
  2509. HAVE_GCONF=no
  2510. if test "${HAVE_X11}" = "yes" && test "${with_gconf}" != "no"; then
  2511. EMACS_CHECK_MODULES([GCONF], [gconf-2.0 >= 2.13])
  2512. if test "$HAVE_GCONF" = yes; then
  2513. AC_DEFINE(HAVE_GCONF, 1, [Define to 1 if using GConf.])
  2514. dnl Newer GConf doesn't link with g_objects, so this is not defined.
  2515. SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS"
  2516. SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS"
  2517. fi
  2518. fi
  2519. if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then
  2520. EMACS_CHECK_MODULES([GOBJECT], [gobject-2.0 >= 2.0])
  2521. if test "$HAVE_GOBJECT" = "yes"; then
  2522. SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS"
  2523. SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS"
  2524. fi
  2525. SAVE_CFLAGS="$CFLAGS"
  2526. SAVE_LIBS="$LIBS"
  2527. CFLAGS="$SETTINGS_CFLAGS $CFLAGS"
  2528. LIBS="$SETTINGS_LIBS $LIBS"
  2529. CFLAGS="$SAVE_CFLAGS"
  2530. LIBS="$SAVE_LIBS"
  2531. fi
  2532. AC_SUBST(SETTINGS_CFLAGS)
  2533. AC_SUBST(SETTINGS_LIBS)
  2534. dnl SELinux is available for GNU/Linux only.
  2535. HAVE_LIBSELINUX=no
  2536. LIBSELINUX_LIBS=
  2537. if test "${with_selinux}" = "yes"; then
  2538. AC_CHECK_LIB([selinux], [lgetfilecon], HAVE_LIBSELINUX=yes, HAVE_LIBSELINUX=no)
  2539. if test "$HAVE_LIBSELINUX" = yes; then
  2540. AC_DEFINE(HAVE_LIBSELINUX, 1, [Define to 1 if using SELinux.])
  2541. LIBSELINUX_LIBS=-lselinux
  2542. fi
  2543. fi
  2544. AC_SUBST(LIBSELINUX_LIBS)
  2545. HAVE_GNUTLS=no
  2546. if test "${with_gnutls}" = "yes" ; then
  2547. EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.2],
  2548. [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no])
  2549. if test "${HAVE_GNUTLS}" = "yes"; then
  2550. AC_DEFINE(HAVE_GNUTLS, 1, [Define if using GnuTLS.])
  2551. fi
  2552. # Windows loads GnuTLS dynamically
  2553. if test "${opsys}" = "mingw32"; then
  2554. LIBGNUTLS_LIBS=
  2555. fi
  2556. fi
  2557. AC_SUBST(LIBGNUTLS_LIBS)
  2558. AC_SUBST(LIBGNUTLS_CFLAGS)
  2559. HAVE_LIBSYSTEMD=no
  2560. if test "${with_libsystemd}" = "yes" ; then
  2561. dnl This code has been tested with libsystemd 222 and later.
  2562. dnl FIXME: Find the earliest version number for which Emacs should work,
  2563. dnl and change '222' to that number.
  2564. EMACS_CHECK_MODULES([LIBSYSTEMD], [libsystemd >= 222],
  2565. [HAVE_LIBSYSTEMD=yes], [HAVE_LIBSYSTEMD=no])
  2566. if test "${HAVE_LIBSYSTEMD}" = "yes"; then
  2567. AC_DEFINE(HAVE_LIBSYSTEMD, 1, [Define if using libsystemd.])
  2568. fi
  2569. fi
  2570. AC_SUBST(LIBSYSTEMD_LIBS)
  2571. AC_SUBST(LIBSYSTEMD_CFLAGS)
  2572. NOTIFY_OBJ=
  2573. NOTIFY_SUMMARY=no
  2574. dnl MS Windows native file monitor is available for mingw32 only.
  2575. case $with_file_notification,$opsys in
  2576. w32,cygwin)
  2577. AC_MSG_ERROR(['--with-file-notification=w32' was specified, but
  2578. this is only supported on MS-Windows native and MinGW32 builds.
  2579. Consider using gfile instead.])
  2580. ;;
  2581. w32,* | yes,mingw32)
  2582. AC_CHECK_HEADER(windows.h)
  2583. if test "$ac_cv_header_windows_h" = yes ; then
  2584. AC_DEFINE(HAVE_W32NOTIFY, 1, [Define to 1 to use w32notify.])
  2585. NOTIFY_OBJ=w32notify.o
  2586. NOTIFY_SUMMARY="yes (w32)"
  2587. fi ;;
  2588. esac
  2589. dnl inotify is available only on GNU/Linux.
  2590. case $with_file_notification,$NOTIFY_OBJ in
  2591. inotify, | yes,)
  2592. AC_CHECK_HEADER(sys/inotify.h)
  2593. if test "$ac_cv_header_sys_inotify_h" = yes ; then
  2594. AC_CHECK_FUNC(inotify_init1)
  2595. if test "$ac_cv_func_inotify_init1" = yes; then
  2596. AC_DEFINE(HAVE_INOTIFY, 1, [Define to 1 to use inotify.])
  2597. NOTIFY_OBJ=inotify.o
  2598. NOTIFY_SUMMARY="yes -lglibc (inotify)"
  2599. fi
  2600. fi ;;
  2601. esac
  2602. dnl kqueue is available on BSD-like systems.
  2603. case $with_file_notification,$NOTIFY_OBJ in
  2604. kqueue,* | yes,)
  2605. EMACS_CHECK_MODULES([KQUEUE], [libkqueue])
  2606. if test "$HAVE_KQUEUE" = "yes"; then
  2607. AC_DEFINE(HAVE_KQUEUE, 1, [Define to 1 to use kqueue.])
  2608. CPPFLAGS="$CPPFLAGS -I/usr/include/kqueue"
  2609. NOTIFY_CFLAGS=$KQUEUE_CFLAGS
  2610. NOTIFY_LIBS=$KQUEUE_LIBS
  2611. NOTIFY_OBJ=kqueue.o
  2612. NOTIFY_SUMMARY="yes -lkqueue"
  2613. else
  2614. AC_SEARCH_LIBS(kqueue, [])
  2615. if test "$ac_cv_search_kqueue" != no; then
  2616. AC_DEFINE(HAVE_KQUEUE, 1, [Define to 1 to use kqueue.])
  2617. NOTIFY_OBJ=kqueue.o
  2618. NOTIFY_SUMMARY="yes (kqueue)"
  2619. fi
  2620. fi ;;
  2621. esac
  2622. dnl g_file_monitor exists since glib 2.18. G_FILE_MONITOR_EVENT_MOVED
  2623. dnl has been added in glib 2.24. It has been tested under
  2624. dnl GNU/Linux only.
  2625. case $with_file_notification,$NOTIFY_OBJ in
  2626. gfile,* | yes,)
  2627. if test "${HAVE_NS}" = yes; then
  2628. AC_MSG_ERROR(['--with-file-notification=gfile' is not supported in NextStep builds.
  2629. Consider kqueue instead.])
  2630. else
  2631. EMACS_CHECK_MODULES([GFILENOTIFY], [gio-2.0 >= 2.24])
  2632. if test "$HAVE_GFILENOTIFY" = "yes"; then
  2633. AC_DEFINE(HAVE_GFILENOTIFY, 1, [Define to 1 if using GFile.])
  2634. NOTIFY_CFLAGS=$GFILENOTIFY_CFLAGS
  2635. NOTIFY_LIBS=$GFILENOTIFY_LIBS
  2636. NOTIFY_OBJ=gfilenotify.o
  2637. NOTIFY_SUMMARY="yes -lgio (gfile)"
  2638. fi
  2639. fi ;;
  2640. esac
  2641. case $with_file_notification,$NOTIFY_OBJ in
  2642. yes,* | no,* | *,?*) ;;
  2643. *) AC_MSG_ERROR([File notification '$with_file_notification' requested but requirements not found.]) ;;
  2644. esac
  2645. if test -n "$NOTIFY_OBJ"; then
  2646. AC_DEFINE(USE_FILE_NOTIFY, 1, [Define to 1 if using file notifications.])
  2647. fi
  2648. AC_SUBST(NOTIFY_CFLAGS)
  2649. AC_SUBST(NOTIFY_LIBS)
  2650. AC_SUBST(NOTIFY_OBJ)
  2651. dnl Do not put whitespace before the #include statements below.
  2652. dnl Older compilers (eg sunos4 cc) choke on it.
  2653. HAVE_XAW3D=no
  2654. LUCID_LIBW=
  2655. if test x"${USE_X_TOOLKIT}" = xmaybe || test x"${USE_X_TOOLKIT}" = xLUCID; then
  2656. if test "$with_xaw3d" != no; then
  2657. AC_CACHE_VAL(emacs_cv_xaw3d,
  2658. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  2659. #include <X11/Intrinsic.h>
  2660. #include <X11/Xaw3d/Simple.h>]],
  2661. [[]])],
  2662. [AC_CHECK_LIB(Xaw3d, XawScrollbarSetThumb,
  2663. emacs_cv_xaw3d=yes, emacs_cv_xaw3d=no)],
  2664. emacs_cv_xaw3d=no)])
  2665. else
  2666. emacs_cv_xaw3d=no
  2667. fi
  2668. if test $emacs_cv_xaw3d = yes; then
  2669. AC_MSG_CHECKING(for xaw3d)
  2670. AC_MSG_RESULT([yes; using Lucid toolkit])
  2671. USE_X_TOOLKIT=LUCID
  2672. HAVE_XAW3D=yes
  2673. LUCID_LIBW=-lXaw3d
  2674. AC_DEFINE(HAVE_XAW3D, 1,
  2675. [Define to 1 if you have the Xaw3d library (-lXaw3d).])
  2676. else
  2677. AC_MSG_CHECKING(for xaw3d)
  2678. AC_MSG_RESULT(no)
  2679. AC_MSG_CHECKING(for libXaw)
  2680. AC_CACHE_VAL(emacs_cv_xaw,
  2681. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  2682. #include <X11/Intrinsic.h>
  2683. #include <X11/Xaw/Simple.h>]],
  2684. [[]])],
  2685. emacs_cv_xaw=yes,
  2686. emacs_cv_xaw=no)])
  2687. if test $emacs_cv_xaw = yes; then
  2688. AC_MSG_RESULT([yes; using Lucid toolkit])
  2689. USE_X_TOOLKIT=LUCID
  2690. LUCID_LIBW=-lXaw
  2691. elif test x"${USE_X_TOOLKIT}" = xLUCID; then
  2692. AC_MSG_ERROR([Lucid toolkit requires X11/Xaw include files])
  2693. else
  2694. AC_MSG_ERROR([No X toolkit could be found.
  2695. If you are sure you want Emacs compiled without an X toolkit, pass
  2696. --with-x-toolkit=no
  2697. to configure. Otherwise, install the development libraries for the toolkit
  2698. that you want to use (e.g. Gtk+) and re-run configure.])
  2699. fi
  2700. fi
  2701. fi
  2702. X_TOOLKIT_TYPE=$USE_X_TOOLKIT
  2703. LIBXTR6=
  2704. LIBXMU=
  2705. if test "${USE_X_TOOLKIT}" != "none"; then
  2706. AC_MSG_CHECKING(X11 toolkit version)
  2707. AC_CACHE_VAL(emacs_cv_x11_toolkit_version_6,
  2708. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Intrinsic.h>]],
  2709. [[#if XtSpecificationRelease < 6
  2710. fail;
  2711. #endif
  2712. ]])], emacs_cv_x11_toolkit_version_6=yes, emacs_cv_x11_toolkit_version_6=no)])
  2713. HAVE_X11XTR6=$emacs_cv_x11_toolkit_version_6
  2714. if test $emacs_cv_x11_toolkit_version_6 = yes; then
  2715. AC_MSG_RESULT(6 or newer)
  2716. AC_DEFINE(HAVE_X11XTR6, 1,
  2717. [Define to 1 if you have the X11R6 or newer version of Xt.])
  2718. LIBXTR6="-lSM -lICE"
  2719. case "$opsys" in
  2720. ## Use libw.a along with X11R6 Xt.
  2721. unixware) LIBXTR6="$LIBXTR6 -lw" ;;
  2722. esac
  2723. else
  2724. AC_MSG_RESULT(before 6)
  2725. fi
  2726. dnl If using toolkit, check whether libXmu.a exists.
  2727. dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
  2728. OLDLIBS="$LIBS"
  2729. if test x$HAVE_X11XTR6 = xyes; then
  2730. OTHERLIBS='-lXt -lSM -lICE'
  2731. else
  2732. OTHERLIBS='-lXt'
  2733. fi
  2734. AC_SEARCH_LIBS([XmuConvertStandardSelection], [Xmu], [], [], [$OTHERLIBS])
  2735. if test "X$LIBS" != "X$OLDLIBS"; then
  2736. LIBXMU=$ac_cv_search_XmuConvertStandardSelection
  2737. fi
  2738. LIBS=$OLDLIBS
  2739. dnl ac_cv_search_XmuConvertStandardSelection is also referenced below.
  2740. fi
  2741. AC_SUBST(LIBXTR6)
  2742. AC_SUBST(LIBXMU)
  2743. LIBXP=
  2744. if test "${USE_X_TOOLKIT}" = "MOTIF"; then
  2745. # OpenMotif may be installed in such a way on some GNU/Linux systems.
  2746. if test -d /usr/include/openmotif; then
  2747. CPPFLAGS="-I/usr/include/openmotif $CPPFLAGS"
  2748. emacs_cv_openmotif=yes
  2749. case "$canonical" in
  2750. x86_64-*-linux-gnu* | powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*)
  2751. test -d /usr/lib64/openmotif && LDFLAGS="-L/usr/lib64/openmotif $LDFLAGS"
  2752. ;;
  2753. *)
  2754. test -d /usr/lib/openmotif && LDFLAGS="-L/usr/lib/openmotif $LDFLAGS"
  2755. esac
  2756. else
  2757. emacs_cv_openmotif=no
  2758. fi
  2759. AC_CACHE_CHECK(for (Open)Motif version 2.1, emacs_cv_motif_version_2_1,
  2760. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <Xm/Xm.h>]],
  2761. [[#if XmVERSION > 2 || (XmVERSION == 2 && XmREVISION >= 1)
  2762. int x = 5;
  2763. #else
  2764. Motif version prior to 2.1.
  2765. #endif]])],
  2766. emacs_cv_motif_version_2_1=yes, emacs_cv_motif_version_2_1=no)])
  2767. if test $emacs_cv_motif_version_2_1 = yes; then
  2768. AC_CHECK_LIB(Xp, XpCreateContext, LIBXP=-lXp)
  2769. if test x$emacs_cv_openmotif = xyes; then
  2770. REAL_CPPFLAGS="-I/usr/include/openmotif $REAL_CPPFLAGS"
  2771. fi
  2772. else
  2773. AC_CACHE_CHECK(for LessTif where some systems put it, emacs_cv_lesstif,
  2774. # We put this in CFLAGS temporarily to precede other -I options
  2775. # that might be in CFLAGS temporarily.
  2776. # We put this in CPPFLAGS where it precedes the other -I options.
  2777. OLD_CPPFLAGS=$CPPFLAGS
  2778. OLD_CFLAGS=$CFLAGS
  2779. CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CPPFLAGS"
  2780. CFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $CFLAGS"
  2781. [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include </usr/X11R6/LessTif/Motif1.2/include/Xm/Xm.h>]],
  2782. [[int x = 5;]])],
  2783. emacs_cv_lesstif=yes, emacs_cv_lesstif=no)])
  2784. if test $emacs_cv_lesstif = yes; then
  2785. # Make sure this -I option remains in CPPFLAGS after it is set
  2786. # back to REAL_CPPFLAGS.
  2787. # There is no need to change REAL_CFLAGS, because REAL_CFLAGS does not
  2788. # have those other -I options anyway. Ultimately, having this
  2789. # directory ultimately in CPPFLAGS will be enough.
  2790. REAL_CPPFLAGS="-I/usr/X11R6/LessTif/Motif1.2/include $REAL_CPPFLAGS"
  2791. LDFLAGS="-L/usr/X11R6/LessTif/Motif1.2/lib $LDFLAGS"
  2792. else
  2793. CFLAGS=$OLD_CFLAGS
  2794. CPPFLAGS=$OLD_CPPFLAGS
  2795. fi
  2796. fi
  2797. AC_CHECK_HEADER([Xm/BulletinB.h], [],
  2798. [AC_MSG_ERROR([Motif toolkit requested but requirements not found.])])
  2799. fi
  2800. dnl Use toolkit scroll bars if configured for GTK or X toolkit and either
  2801. dnl using Motif or Xaw3d is available, and unless
  2802. dnl --with-toolkit-scroll-bars=no was specified.
  2803. AH_TEMPLATE(USE_TOOLKIT_SCROLL_BARS,
  2804. [Define to 1 if we should use toolkit scroll bars.])dnl
  2805. USE_TOOLKIT_SCROLL_BARS=no
  2806. if test "${with_toolkit_scroll_bars}" != "no"; then
  2807. if test "${USE_X_TOOLKIT}" != "none"; then
  2808. if test "${USE_X_TOOLKIT}" = "MOTIF"; then
  2809. AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
  2810. HAVE_XAW3D=no
  2811. USE_TOOLKIT_SCROLL_BARS=yes
  2812. elif test "${HAVE_XAW3D}" = "yes" || test "${USE_X_TOOLKIT}" = "LUCID"; then
  2813. AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
  2814. USE_TOOLKIT_SCROLL_BARS=yes
  2815. fi
  2816. elif test "${HAVE_GTK}" = "yes"; then
  2817. AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
  2818. USE_TOOLKIT_SCROLL_BARS=yes
  2819. elif test "${HAVE_NS}" = "yes"; then
  2820. AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
  2821. USE_TOOLKIT_SCROLL_BARS=yes
  2822. elif test "${HAVE_W32}" = "yes"; then
  2823. AC_DEFINE(USE_TOOLKIT_SCROLL_BARS)
  2824. USE_TOOLKIT_SCROLL_BARS=yes
  2825. fi
  2826. fi
  2827. dnl See if XIM is available.
  2828. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2829. #include <X11/Xlib.h>
  2830. #include <X11/Xresource.h>]],
  2831. [[XIMProc callback;]])],
  2832. [HAVE_XIM=yes
  2833. AC_DEFINE(HAVE_XIM, 1, [Define to 1 if XIM is available])],
  2834. HAVE_XIM=no)
  2835. dnl '--with-xim' now controls only the initial value of use_xim at run time.
  2836. if test "${with_xim}" != "no"; then
  2837. AC_DEFINE(USE_XIM, 1,
  2838. [Define to 1 if we should use XIM, if it is available.])
  2839. fi
  2840. if test "${HAVE_XIM}" != "no"; then
  2841. late_CFLAGS=$CFLAGS
  2842. if test "$GCC" = yes; then
  2843. CFLAGS="$CFLAGS --pedantic-errors"
  2844. fi
  2845. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2846. #include <X11/Xlib.h>
  2847. #include <X11/Xresource.h>]],
  2848. [[Display *display;
  2849. XrmDatabase db;
  2850. char *res_name;
  2851. char *res_class;
  2852. XIMProc callback;
  2853. XPointer *client_data;
  2854. #ifndef __GNUC__
  2855. /* If we're not using GCC, it's probably not XFree86, and this is
  2856. probably right, but we can't use something like --pedantic-errors. */
  2857. extern Bool XRegisterIMInstantiateCallback(Display*, XrmDatabase, char*,
  2858. char*, XIMProc, XPointer*);
  2859. #endif
  2860. (void)XRegisterIMInstantiateCallback(display, db, res_name, res_class, callback,
  2861. client_data);]])],
  2862. [emacs_cv_arg6_star=yes])
  2863. AH_TEMPLATE(XRegisterIMInstantiateCallback_arg6,
  2864. [Define to the type of the 6th arg of XRegisterIMInstantiateCallback,
  2865. either XPointer or XPointer*.])dnl
  2866. if test "$emacs_cv_arg6_star" = yes; then
  2867. AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer*])
  2868. else
  2869. AC_DEFINE(XRegisterIMInstantiateCallback_arg6, [XPointer])
  2870. fi
  2871. CFLAGS=$late_CFLAGS
  2872. fi
  2873. ### Start of font-backend (under any platform) section.
  2874. # (nothing here yet -- this is a placeholder)
  2875. ### End of font-backend (under any platform) section.
  2876. ### Start of font-backend (under X11) section.
  2877. if test "${HAVE_X11}" = "yes"; then
  2878. ## Use -lXft if available, unless '--with-xft=no'.
  2879. HAVE_XFT=maybe
  2880. if test "x${with_x}" = "xno"; then
  2881. with_xft="no";
  2882. fi
  2883. if test "$with_xft" != no; then
  2884. EMACS_CHECK_MODULES([FONTCONFIG], [fontconfig >= 2.2.0])
  2885. with_xft=$HAVE_FONTCONFIG
  2886. fi
  2887. if test "x${with_xft}" != "xno"; then
  2888. EMACS_CHECK_MODULES([XFT], [xft >= 0.13.0], [], [HAVE_XFT=no])
  2889. ## Because xftfont.c uses XRenderQueryExtension, we also
  2890. ## need to link to -lXrender.
  2891. HAVE_XRENDER=no
  2892. AC_CHECK_LIB(Xrender, XRenderQueryExtension, HAVE_XRENDER=yes)
  2893. if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
  2894. OLD_CPPFLAGS="$CPPFLAGS"
  2895. OLD_CFLAGS="$CFLAGS"
  2896. OLD_LIBS="$LIBS"
  2897. CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
  2898. CFLAGS="$CFLAGS $XFT_CFLAGS"
  2899. XFT_LIBS="-lXrender $XFT_LIBS"
  2900. LIBS="$XFT_LIBS $LIBS"
  2901. AC_CHECK_HEADER(X11/Xft/Xft.h,
  2902. AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS) , ,
  2903. [[#include <X11/X.h>]])
  2904. if test "${HAVE_XFT}" = "yes"; then
  2905. AC_DEFINE(HAVE_XFT, 1, [Define to 1 if you have the Xft library.])
  2906. AC_SUBST(XFT_LIBS)
  2907. C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
  2908. fi # "${HAVE_XFT}" = "yes"
  2909. CPPFLAGS=$OLD_CPPFLAGS
  2910. CFLAGS=$OLD_CFLAGS
  2911. LIBS=$OLD_LIBS
  2912. fi # "$HAVE_XFT" != no
  2913. fi # "x${with_xft}" != "xno"
  2914. ## We used to allow building with FreeType and without Xft.
  2915. ## However, the ftx font backend driver is not in good shape.
  2916. if test "$HAVE_XFT" != "yes"; then
  2917. dnl For the "Does Emacs use" message at the end.
  2918. HAVE_XFT=no
  2919. HAVE_FREETYPE=no
  2920. else
  2921. dnl Strict linkers fail with
  2922. dnl ftfont.o: undefined reference to symbol 'FT_New_Face'
  2923. dnl if -lfreetype is not specified.
  2924. dnl The following is needed to set FREETYPE_LIBS.
  2925. EMACS_CHECK_MODULES([FREETYPE], [freetype2])
  2926. test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype)
  2927. fi
  2928. HAVE_LIBOTF=no
  2929. if test "${HAVE_FREETYPE}" = "yes"; then
  2930. AC_DEFINE(HAVE_FREETYPE, 1,
  2931. [Define to 1 if using the freetype and fontconfig libraries.])
  2932. if test "${with_libotf}" != "no"; then
  2933. EMACS_CHECK_MODULES([LIBOTF], [libotf])
  2934. if test "$HAVE_LIBOTF" = "yes"; then
  2935. AC_DEFINE(HAVE_LIBOTF, 1, [Define to 1 if using libotf.])
  2936. AC_CHECK_LIB(otf, OTF_get_variation_glyphs,
  2937. HAVE_OTF_GET_VARIATION_GLYPHS=yes,
  2938. HAVE_OTF_GET_VARIATION_GLYPHS=no)
  2939. if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
  2940. AC_DEFINE(HAVE_OTF_GET_VARIATION_GLYPHS, 1,
  2941. [Define to 1 if libotf has OTF_get_variation_glyphs.])
  2942. fi
  2943. fi
  2944. fi
  2945. dnl FIXME should there be an error if HAVE_FREETYPE != yes?
  2946. dnl Does the new font backend require it, or can it work without it?
  2947. fi
  2948. HAVE_M17N_FLT=no
  2949. if test "${HAVE_LIBOTF}" = yes; then
  2950. if test "${with_m17n_flt}" != "no"; then
  2951. EMACS_CHECK_MODULES([M17N_FLT], [m17n-flt])
  2952. if test "$HAVE_M17N_FLT" = "yes"; then
  2953. AC_DEFINE(HAVE_M17N_FLT, 1, [Define to 1 if using libm17n-flt.])
  2954. fi
  2955. fi
  2956. fi
  2957. else
  2958. HAVE_XFT=no
  2959. HAVE_FREETYPE=no
  2960. HAVE_LIBOTF=no
  2961. HAVE_M17N_FLT=no
  2962. fi
  2963. ### End of font-backend (under X11) section.
  2964. AC_SUBST(FREETYPE_CFLAGS)
  2965. AC_SUBST(FREETYPE_LIBS)
  2966. AC_SUBST(FONTCONFIG_CFLAGS)
  2967. AC_SUBST(FONTCONFIG_LIBS)
  2968. AC_SUBST(LIBOTF_CFLAGS)
  2969. AC_SUBST(LIBOTF_LIBS)
  2970. AC_SUBST(M17N_FLT_CFLAGS)
  2971. AC_SUBST(M17N_FLT_LIBS)
  2972. HAVE_CAIRO=no
  2973. if test "${HAVE_X11}" = "yes"; then
  2974. if test "${with_cairo}" != "no"; then
  2975. CAIRO_REQUIRED=1.12.0
  2976. CAIRO_MODULE="cairo >= $CAIRO_REQUIRED"
  2977. EMACS_CHECK_MODULES(CAIRO, $CAIRO_MODULE)
  2978. if test $HAVE_CAIRO = yes; then
  2979. AC_DEFINE(USE_CAIRO, 1, [Define to 1 if using cairo.])
  2980. else
  2981. AC_MSG_ERROR([cairo requested but not found.])
  2982. fi
  2983. CFLAGS="$CFLAGS $CAIRO_CFLAGS"
  2984. LIBS="$LIBS $CAIRO_LIBS"
  2985. AC_SUBST(CAIRO_CFLAGS)
  2986. AC_SUBST(CAIRO_LIBS)
  2987. fi
  2988. fi
  2989. if test "${HAVE_X11}" = "yes"; then
  2990. AC_CHECK_HEADER(X11/Xlib-xcb.h,
  2991. AC_CHECK_LIB(xcb, xcb_translate_coordinates, HAVE_XCB=yes))
  2992. if test "${HAVE_XCB}" = "yes"; then
  2993. AC_CHECK_LIB(X11-xcb, XGetXCBConnection, HAVE_X11_XCB=yes)
  2994. if test "${HAVE_X11_XCB}" = "yes"; then
  2995. AC_DEFINE(USE_XCB, 1,
  2996. [Define to 1 if you have the XCB library and X11-XCB library for mixed
  2997. X11/XCB programming.])
  2998. XCB_LIBS="-lX11-xcb -lxcb"
  2999. AC_SUBST(XCB_LIBS)
  3000. fi
  3001. fi
  3002. fi
  3003. ### Use -lXpm if available, unless '--with-xpm=no'.
  3004. ### mingw32 doesn't use -lXpm, since it loads the library dynamically.
  3005. ### The Cygwin-w32 build uses <noX/xpm.h> instead of <X11/xpm.h>, so
  3006. ### we need to set LDFLAGS accordingly.
  3007. HAVE_XPM=no
  3008. LIBXPM=
  3009. if test "${HAVE_W32}" = "yes" && test "${opsys}" = "cygwin"; then
  3010. if test "${with_xpm}" != "no"; then
  3011. SAVE_LDFLAGS="$LDFLAGS"
  3012. LDFLAGS="$LDFLAGS -L/usr/lib/noX"
  3013. AC_CHECK_HEADER(noX/xpm.h,
  3014. [AC_CHECK_LIB(Xpm, XpmReadFileToImage, HAVE_XPM=yes)])
  3015. if test "${HAVE_XPM}" = "yes"; then
  3016. AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
  3017. [emacs_cv_cpp_xpm_return_alloc_pixels],
  3018. [AC_EGREP_CPP(no_return_alloc_pixels,
  3019. [#include "noX/xpm.h"
  3020. #ifndef XpmReturnAllocPixels
  3021. no_return_alloc_pixels
  3022. #endif
  3023. ], emacs_cv_cpp_xpm_return_alloc_pixels=no,
  3024. emacs_cv_cpp_xpm_return_alloc_pixels=yes)])
  3025. if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
  3026. HAVE_XPM=no
  3027. LDFLAGS="$SAVE_LDFLAGS"
  3028. fi
  3029. fi
  3030. fi
  3031. if test "${HAVE_XPM}" = "yes"; then
  3032. AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
  3033. LIBXPM=-lXpm
  3034. fi
  3035. fi
  3036. if test "${HAVE_X11}" = "yes"; then
  3037. dnl Avoid Xpm on AIX unless requested, as it crashes; see Bug#17598.
  3038. test "$opsys$with_xpm_set" = aix4-2 && with_xpm=no
  3039. if test "${with_xpm}" != "no"; then
  3040. AC_CHECK_HEADER(X11/xpm.h,
  3041. [AC_CHECK_LIB(Xpm, XpmReadFileToPixmap, HAVE_XPM=yes, , -lX11)])
  3042. if test "${HAVE_XPM}" = "yes"; then
  3043. AC_CACHE_CHECK([for XpmReturnAllocPixels preprocessor define],
  3044. [emacs_cv_cpp_xpm_return_alloc_pixels],
  3045. [AC_EGREP_CPP(no_return_alloc_pixels,
  3046. [#include "noX/xpm.h"
  3047. #ifndef XpmReturnAllocPixels
  3048. no_return_alloc_pixels
  3049. #endif
  3050. ], emacs_cv_cpp_xpm_return_alloc_pixels=no,
  3051. emacs_cv_cpp_xpm_return_alloc_pixels=yes)])
  3052. if test "$emacs_cv_cpp_xpm_return_alloc_pixels" = "no"; then
  3053. HAVE_XPM=no
  3054. fi
  3055. fi
  3056. fi
  3057. if test "${HAVE_XPM}" = "yes"; then
  3058. AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
  3059. LIBXPM=-lXpm
  3060. elif test "$opsys,$LUCID_LIBW" = aix4-2,-lXaw; then
  3061. dnl AIX -lXaw needs -lXpm linked too; see Bug#17598 Message#152.
  3062. LIBXPM=-lXpm
  3063. fi
  3064. fi
  3065. ### FIXME: Perhaps regroup to minimize code duplication due to MinGW's
  3066. ### slightly different requirements wrt image libraries (it doesn't
  3067. ### use -lXpm because it loads the xpm shared library dynamically at
  3068. ### run time).
  3069. if test "${opsys}" = "mingw32"; then
  3070. if test "${with_xpm}" != "no"; then
  3071. AC_CHECK_HEADER(X11/xpm.h, HAVE_XPM=yes, HAVE_XPM=no, [
  3072. #define FOR_MSW 1])
  3073. fi
  3074. if test "${HAVE_XPM}" = "yes"; then
  3075. AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
  3076. fi
  3077. fi
  3078. AC_SUBST(LIBXPM)
  3079. ### Use -ljpeg if available, unless '--with-jpeg=no'.
  3080. HAVE_JPEG=no
  3081. LIBJPEG=
  3082. if test "${with_jpeg}" != "no"; then
  3083. AC_CACHE_CHECK([for jpeglib 6b or later],
  3084. [emacs_cv_jpeglib],
  3085. [OLD_LIBS=$LIBS
  3086. for emacs_cv_jpeglib in yes -ljpeg no; do
  3087. case $emacs_cv_jpeglib in
  3088. yes) ;;
  3089. no) break;;
  3090. *) LIBS="$LIBS $emacs_cv_jpeglib";;
  3091. esac
  3092. AC_LINK_IFELSE(
  3093. [AC_LANG_PROGRAM(
  3094. [[#undef HAVE_STDLIB_H /* Avoid config.h/jpeglib.h collision. */
  3095. #include <stdio.h> /* jpeglib.h needs FILE and size_t. */
  3096. #include <jpeglib.h>
  3097. #include <jerror.h>
  3098. char verify[JPEG_LIB_VERSION < 62 ? -1 : 1];
  3099. struct jpeg_decompress_struct cinfo;
  3100. ]],
  3101. [[
  3102. jpeg_create_decompress (&cinfo);
  3103. WARNMS (&cinfo, JWRN_JPEG_EOF);
  3104. jpeg_destroy_decompress (&cinfo);
  3105. ]])],
  3106. [emacs_link_ok=yes],
  3107. [emacs_link_ok=no])
  3108. LIBS=$OLD_LIBS
  3109. test $emacs_link_ok = yes && break
  3110. done])
  3111. if test "$emacs_cv_jpeglib" != no; then
  3112. HAVE_JPEG=yes
  3113. AC_DEFINE([HAVE_JPEG], 1,
  3114. [Define to 1 if you have the jpeg library (typically -ljpeg).])
  3115. ### mingw32 doesn't use -ljpeg, since it loads the library
  3116. ### dynamically when needed, and doesn't want a run-time
  3117. ### dependency on the jpeglib DLL.
  3118. test "$emacs_cv_jpeglib" != yes && test "${opsys}" != "mingw32" \
  3119. && LIBJPEG=$emacs_cv_jpeglib
  3120. fi
  3121. fi
  3122. AC_SUBST(LIBJPEG)
  3123. HAVE_ZLIB=no
  3124. LIBZ=
  3125. if test "${with_zlib}" != "no"; then
  3126. OLIBS=$LIBS
  3127. AC_SEARCH_LIBS([inflateEnd], [z], [HAVE_ZLIB=yes])
  3128. LIBS=$OLIBS
  3129. case $ac_cv_search_inflateEnd in
  3130. -*) LIBZ=$ac_cv_search_inflateEnd ;;
  3131. esac
  3132. fi
  3133. if test "${HAVE_ZLIB}" = "yes"; then
  3134. AC_DEFINE([HAVE_ZLIB], 1, [Define to 1 if you have the zlib library (-lz).])
  3135. ### mingw32 doesn't use -lz, since it loads the library dynamically.
  3136. if test "${opsys}" = "mingw32"; then
  3137. LIBZ=
  3138. fi
  3139. fi
  3140. AC_SUBST(LIBZ)
  3141. ### Dynamic modules support
  3142. LIBMODULES=
  3143. HAVE_MODULES=no
  3144. MODULES_OBJ=
  3145. case $opsys in
  3146. cygwin|mingw32) MODULES_SUFFIX=".dll" ;;
  3147. *) MODULES_SUFFIX=".so" ;;
  3148. esac
  3149. if test "${with_modules}" != "no"; then
  3150. case $opsys in
  3151. gnu|gnu-linux)
  3152. LIBMODULES="-ldl"
  3153. HAVE_MODULES=yes
  3154. ;;
  3155. cygwin|mingw32|darwin)
  3156. HAVE_MODULES=yes
  3157. ;;
  3158. *)
  3159. # BSD systems have dlopen in libc.
  3160. AC_CHECK_FUNC([dlopen], [HAVE_MODULES=yes])
  3161. ;;
  3162. esac
  3163. if test "${HAVE_MODULES}" = no; then
  3164. AC_MSG_ERROR([Dynamic modules are not supported on your system])
  3165. else
  3166. SAVE_LIBS=$LIBS
  3167. LIBS="$LIBS $LIBMODULES"
  3168. AC_CHECK_FUNCS([dladdr dlfunc])
  3169. LIBS=$SAVE_LIBS
  3170. fi
  3171. fi
  3172. if test "${HAVE_MODULES}" = yes; then
  3173. MODULES_OBJ="dynlib.o emacs-module.o"
  3174. AC_DEFINE(HAVE_MODULES, 1, [Define to 1 if dynamic modules are enabled])
  3175. AC_DEFINE_UNQUOTED(MODULES_SUFFIX, "$MODULES_SUFFIX",
  3176. [System extension for dynamic libraries])
  3177. fi
  3178. AC_SUBST(MODULES_OBJ)
  3179. AC_SUBST(LIBMODULES)
  3180. AC_SUBST(HAVE_MODULES)
  3181. AC_SUBST(MODULES_SUFFIX)
  3182. AC_CONFIG_FILES([src/emacs-module.h])
  3183. AC_SUBST_FILE([module_env_snippet_25])
  3184. AC_SUBST_FILE([module_env_snippet_26])
  3185. module_env_snippet_25="$srcdir/src/module-env-25.h"
  3186. module_env_snippet_26="$srcdir/src/module-env-26.h"
  3187. ### Use -lpng if available, unless '--with-png=no'.
  3188. HAVE_PNG=no
  3189. LIBPNG=
  3190. PNG_CFLAGS=
  3191. if test "${NS_IMPL_COCOA}" = yes; then
  3192. : # Nothing to do
  3193. elif test "${with_png}" != no; then
  3194. # mingw32 loads the library dynamically.
  3195. if test "$opsys" = mingw32; then
  3196. AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
  3197. elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
  3198. AC_MSG_CHECKING([for png])
  3199. png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
  3200. png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
  3201. # libpng-config does not work; configure by hand.
  3202. # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
  3203. # in /usr/include/libpng.
  3204. if test -r /usr/include/libpng/png.h &&
  3205. test ! -r /usr/include/png.h; then
  3206. png_cflags=-I/usr/include/libpng
  3207. else
  3208. png_cflags=
  3209. fi
  3210. png_ldflags='-lpng'
  3211. }
  3212. SAVE_CFLAGS=$CFLAGS
  3213. SAVE_LIBS=$LIBS
  3214. CFLAGS="$CFLAGS $png_cflags"
  3215. LIBS="$png_ldflags -lz -lm $LIBS"
  3216. AC_LINK_IFELSE(
  3217. [AC_LANG_PROGRAM([[#include <png.h>]],
  3218. [[return !png_get_channels (0, 0);]])],
  3219. [HAVE_PNG=yes
  3220. PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
  3221. LIBPNG=$png_ldflags
  3222. # $LIBPNG requires explicit -lz in some cases.
  3223. # We don't know what those cases are, exactly, so play it safe and
  3224. # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
  3225. if test -n "$LIBPNG" && test -z "$LIBZ"; then
  3226. LIBPNG="$LIBPNG -lz"
  3227. fi])
  3228. CFLAGS=$SAVE_CFLAGS
  3229. LIBS=$SAVE_LIBS
  3230. AC_MSG_RESULT([$HAVE_PNG])
  3231. fi
  3232. fi
  3233. if test $HAVE_PNG = yes; then
  3234. AC_DEFINE([HAVE_PNG], [1], [Define to 1 if you have the png library.])
  3235. SAVE_CFLAGS=$CFLAGS
  3236. CFLAGS="$CFLAGS $PNG_CFLAGS"
  3237. AC_CHECK_DECL([png_longjmp],
  3238. [],
  3239. [AC_DEFINE([PNG_DEPSTRUCT], [],
  3240. [Define to empty to suppress deprecation warnings when building
  3241. with --enable-gcc-warnings and with libpng versions before 1.5,
  3242. which lack png_longjmp.])],
  3243. [[#include <png.h>
  3244. ]])
  3245. CFLAGS=$SAVE_CFLAGS
  3246. fi
  3247. AC_SUBST(LIBPNG)
  3248. AC_SUBST(PNG_CFLAGS)
  3249. ### Use -ltiff if available, unless '--with-tiff=no'.
  3250. ### mingw32 doesn't use -ltiff, since it loads the library dynamically.
  3251. HAVE_TIFF=no
  3252. LIBTIFF=
  3253. if test "${opsys}" = "mingw32"; then
  3254. if test "${with_tiff}" != "no"; then
  3255. AC_CHECK_HEADER(tiffio.h, HAVE_TIFF=yes, HAVE_TIFF=no)
  3256. fi
  3257. if test "${HAVE_TIFF}" = "yes"; then
  3258. AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
  3259. fi
  3260. elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
  3261. if test "${with_tiff}" != "no"; then
  3262. AC_CHECK_HEADER(tiffio.h,
  3263. [tifflibs="-lz -lm"
  3264. # At least one tiff package requires the jpeg library.
  3265. if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
  3266. AC_CHECK_LIB(tiff, TIFFGetVersion, HAVE_TIFF=yes, , $tifflibs)])
  3267. fi
  3268. if test "${HAVE_TIFF}" = "yes"; then
  3269. AC_DEFINE(HAVE_TIFF, 1, [Define to 1 if you have the tiff library (-ltiff).])
  3270. dnl FIXME -lz -lm, as per libpng?
  3271. LIBTIFF=-ltiff
  3272. fi
  3273. fi
  3274. AC_SUBST(LIBTIFF)
  3275. ### Use -lgif or -lungif if available, unless '--with-gif=no'.
  3276. ### mingw32 doesn't use -lgif/-lungif, since it loads the library dynamically.
  3277. HAVE_GIF=no
  3278. LIBGIF=
  3279. if test "${opsys}" = "mingw32"; then
  3280. if test "${with_gif}" != "no"; then
  3281. AC_CHECK_HEADER(gif_lib.h, HAVE_GIF=yes, HAVE_GIF=no)
  3282. fi
  3283. if test "${HAVE_GIF}" = "yes"; then
  3284. AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
  3285. fi
  3286. elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
  3287. || test "${HAVE_W32}" = "yes"; then
  3288. AC_CHECK_HEADER(gif_lib.h,
  3289. # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
  3290. # Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
  3291. [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
  3292. [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])])
  3293. if test "$HAVE_GIF" = yes; then
  3294. LIBGIF=-lgif
  3295. elif test "$HAVE_GIF" = maybe; then
  3296. # If gif_lib.h but no libgif, try libungif.
  3297. AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
  3298. test "$HAVE_GIF" = yes && LIBGIF=-lungif
  3299. fi
  3300. if test "${HAVE_GIF}" = "yes"; then
  3301. AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
  3302. fi
  3303. fi
  3304. AC_SUBST(LIBGIF)
  3305. dnl Check for required libraries.
  3306. MISSING=
  3307. WITH_NO=
  3308. if test "${HAVE_X11}" = "yes"; then
  3309. test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
  3310. MISSING="libXpm" && WITH_NO="--with-xpm=no"
  3311. test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
  3312. MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
  3313. test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
  3314. MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
  3315. test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
  3316. MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
  3317. test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
  3318. MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
  3319. fi
  3320. test "${with_gnutls}" != "no" && test "${HAVE_GNUTLS}" != "yes" &&
  3321. MISSING="$MISSING gnutls" && WITH_NO="$WITH_NO --with-gnutls=no"
  3322. if test "X${MISSING}" != X; then
  3323. AC_MSG_ERROR([The following required libraries were not found:
  3324. $MISSING
  3325. Maybe some development libraries/packages are missing?
  3326. If you don't want to link with them give
  3327. $WITH_NO
  3328. as options to configure])
  3329. fi
  3330. ### Use -lgpm if available, unless '--with-gpm=no'.
  3331. HAVE_GPM=no
  3332. LIBGPM=
  3333. if test "${with_gpm}" != "no"; then
  3334. AC_CHECK_HEADER(gpm.h,
  3335. [AC_CHECK_LIB(gpm, Gpm_Open, HAVE_GPM=yes)])
  3336. if test "${HAVE_GPM}" = "yes"; then
  3337. AC_DEFINE(HAVE_GPM, 1, [Define to 1 if you have the gpm library (-lgpm).])
  3338. LIBGPM=-lgpm
  3339. fi
  3340. fi
  3341. AC_SUBST(LIBGPM)
  3342. dnl Check for malloc/malloc.h on darwin
  3343. AC_CHECK_HEADERS_ONCE(malloc/malloc.h)
  3344. GNUSTEP_CFLAGS=
  3345. ### Use NeXTstep API to implement GUI.
  3346. if test "${HAVE_NS}" = "yes"; then
  3347. AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on macOS.])
  3348. if test "${NS_IMPL_COCOA}" = "yes"; then
  3349. AC_DEFINE(NS_IMPL_COCOA, 1, [Define to 1 if you are using NS windowing under macOS.])
  3350. fi
  3351. if test "${NS_IMPL_GNUSTEP}" = "yes"; then
  3352. AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
  3353. if test $NS_GNUSTEP_CONFIG != yes; then
  3354. # See also .m.o rule in src/Makefile.in. */
  3355. # FIXME: are all these flags really needed? Document here why. */
  3356. GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
  3357. ## Extra CFLAGS applied to src/*.m files.
  3358. GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE"
  3359. fi
  3360. fi
  3361. OTHER_FILES=ns-app
  3362. fi
  3363. ### Use session management (-lSM -lICE) if available
  3364. HAVE_X_SM=no
  3365. LIBXSM=
  3366. if test "${HAVE_X11}" = "yes"; then
  3367. AC_CHECK_HEADER(X11/SM/SMlib.h,
  3368. [AC_CHECK_LIB(SM, SmcOpenConnection, HAVE_X_SM=yes, , -lICE)])
  3369. if test "${HAVE_X_SM}" = "yes"; then
  3370. AC_DEFINE(HAVE_X_SM, 1, [Define to 1 if you have the SM library (-lSM).])
  3371. LIBXSM="-lSM -lICE"
  3372. fi
  3373. fi
  3374. AC_SUBST(LIBXSM)
  3375. ### Use XRandr (-lXrandr) if available
  3376. HAVE_XRANDR=no
  3377. if test "${HAVE_X11}" = "yes"; then
  3378. XRANDR_REQUIRED=1.2.2
  3379. XRANDR_MODULES="xrandr >= $XRANDR_REQUIRED"
  3380. EMACS_CHECK_MODULES([XRANDR], [$XRANDR_MODULES])
  3381. if test $HAVE_XRANDR = no; then
  3382. # Test old way in case pkg-config doesn't have it (older machines).
  3383. # Include Xrender.h by hand to work around bug in older Xrandr.h
  3384. # (e.g. RHEL5) and silence (harmless) configure warning (bug#18465).
  3385. AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  3386. [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)],
  3387. [], [AC_INCLUDES_DEFAULT
  3388. #include <X11/extensions/Xrender.h>])
  3389. if test $HAVE_XRANDR = yes; then
  3390. XRANDR_LIBS=-lXrandr
  3391. fi
  3392. fi
  3393. if test $HAVE_XRANDR = yes; then
  3394. AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.])
  3395. fi
  3396. fi
  3397. AC_SUBST(XRANDR_CFLAGS)
  3398. AC_SUBST(XRANDR_LIBS)
  3399. ### Use Xinerama (-lXinerama) if available
  3400. HAVE_XINERAMA=no
  3401. if test "${HAVE_X11}" = "yes"; then
  3402. XINERAMA_REQUIRED=1.0.2
  3403. XINERAMA_MODULES="xinerama >= $XINERAMA_REQUIRED"
  3404. EMACS_CHECK_MODULES([XINERAMA], [$XINERAMA_MODULES])
  3405. if test $HAVE_XINERAMA = no; then
  3406. # Test old way in case pkg-config doesn't have it (older machines).
  3407. AC_CHECK_HEADER(X11/extensions/Xinerama.h,
  3408. [AC_CHECK_LIB(Xinerama, XineramaQueryExtension, HAVE_XINERAMA=yes)])
  3409. if test $HAVE_XINERAMA = yes; then
  3410. XINERAMA_LIBS=-lXinerama
  3411. fi
  3412. fi
  3413. if test $HAVE_XINERAMA = yes; then
  3414. AC_DEFINE(HAVE_XINERAMA, 1, [Define to 1 if you have the Xinerama extension.])
  3415. fi
  3416. fi
  3417. AC_SUBST(XINERAMA_CFLAGS)
  3418. AC_SUBST(XINERAMA_LIBS)
  3419. ### Use Xfixes (-lXfixes) if available
  3420. HAVE_XFIXES=no
  3421. if test "${HAVE_X11}" = "yes"; then
  3422. XFIXES_REQUIRED=4.0.0
  3423. XFIXES_MODULES="xfixes >= $XFIXES_REQUIRED"
  3424. EMACS_CHECK_MODULES([XFIXES], [$XFIXES_MODULES])
  3425. if test $HAVE_XFIXES = no; then
  3426. # Test old way in case pkg-config doesn't have it (older machines).
  3427. AC_CHECK_HEADER(X11/extensions/Xfixes.h,
  3428. [AC_CHECK_LIB(Xfixes, XFixesHideCursor, HAVE_XFIXES=yes)])
  3429. if test $HAVE_XFIXES = yes; then
  3430. XFIXES_LIBS=-lXfixes
  3431. fi
  3432. fi
  3433. if test $HAVE_XFIXES = yes; then
  3434. AC_DEFINE(HAVE_XFIXES, 1, [Define to 1 if you have the Xfixes extension.])
  3435. fi
  3436. fi
  3437. AC_SUBST(XFIXES_CFLAGS)
  3438. AC_SUBST(XFIXES_LIBS)
  3439. ### Use Xdbe (-lXdbe) if available
  3440. HAVE_XDBE=no
  3441. if test "${HAVE_X11}" = "yes"; then
  3442. AC_CHECK_HEADER(X11/extensions/Xdbe.h,
  3443. [AC_CHECK_LIB(Xext, XdbeAllocateBackBufferName, HAVE_XDBE=yes)],
  3444. [],
  3445. [#include <X11/Xlib.h>
  3446. ])
  3447. if test $HAVE_XDBE = yes; then
  3448. XDBE_LIBS=-lXext
  3449. fi
  3450. if test $HAVE_XDBE = yes; then
  3451. AC_DEFINE(HAVE_XDBE, 1, [Define to 1 if you have the Xdbe extension.])
  3452. fi
  3453. fi
  3454. AC_SUBST(XDBE_CFLAGS)
  3455. AC_SUBST(XDBE_LIBS)
  3456. ### Use libxml (-lxml2) if available
  3457. ### mingw32 doesn't use -lxml2, since it loads the library dynamically.
  3458. HAVE_LIBXML2=no
  3459. if test "${with_xml2}" != "no"; then
  3460. ### I'm not sure what the version number should be, so I just guessed.
  3461. EMACS_CHECK_MODULES([LIBXML2], [libxml-2.0 > 2.6.17])
  3462. # Built-in libxml2 on OS X 10.8 lacks libxml-2.0.pc.
  3463. if test "${HAVE_LIBXML2}" != "yes" && test "$opsys" = "darwin"; then
  3464. SAVE_CPPFLAGS="$CPPFLAGS"
  3465. if test -z "$xcsdkdir" -a -n "$XCRUN" -a ! -d /usr/include; then
  3466. dnl /usr/include is not found. Try Xcode SDK dir if it is sane.
  3467. xcsdkdir=`$XCRUN --show-sdk-path 2>/dev/null`
  3468. case $xcsdkdir in
  3469. *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
  3470. xcsdkdir="" ;;
  3471. esac
  3472. fi
  3473. CPPFLAGS="$CPPFLAGS -I$xcsdkdir/usr/include/libxml2"
  3474. AC_CHECK_HEADER(libxml/HTMLparser.h,
  3475. [AC_CHECK_DECL(HTML_PARSE_RECOVER, HAVE_LIBXML2=yes, ,
  3476. [#include <libxml/HTMLparser.h>])])
  3477. CPPFLAGS="$SAVE_CPPFLAGS"
  3478. if test "${HAVE_LIBXML2}" = "yes"; then
  3479. LIBXML2_CFLAGS="-I'$xcsdkdir/usr/include/libxml2'"
  3480. LIBXML2_LIBS="-lxml2"
  3481. fi
  3482. fi
  3483. if test "${HAVE_LIBXML2}" = "yes"; then
  3484. if test "${opsys}" != "mingw32"; then
  3485. AC_CHECK_LIB(xml2, htmlReadMemory, HAVE_LIBXML2=yes, HAVE_LIBXML2=no,
  3486. [$LIBXML2_LIBS])
  3487. else
  3488. LIBXML2_LIBS=""
  3489. fi
  3490. if test "${HAVE_LIBXML2}" = "yes"; then
  3491. AC_DEFINE(HAVE_LIBXML2, 1, [Define to 1 if you have the libxml library (-lxml2).])
  3492. else
  3493. LIBXML2_LIBS=""
  3494. LIBXML2_CFLAGS=""
  3495. fi
  3496. fi
  3497. fi
  3498. AC_SUBST(LIBXML2_LIBS)
  3499. AC_SUBST(LIBXML2_CFLAGS)
  3500. BLESSMAIL_TARGET=
  3501. LIBS_MAIL=
  3502. if test ! "$with_mailutils"; then
  3503. # Check for mail-locking functions in a "mail" library. Probably this should
  3504. # have the same check as for liblockfile below.
  3505. AC_CHECK_LIB([mail], [maillock], [have_mail=yes], [have_mail=no])
  3506. if test $have_mail = yes; then
  3507. LIBS_MAIL=-lmail
  3508. AC_DEFINE([HAVE_LIBMAIL], [1],
  3509. [Define to 1 if you have the 'mail' library (-lmail).])
  3510. OLD_LIBS=$LIBS
  3511. LIBS="$LIBS_MAIL $LIBS"
  3512. AC_CHECK_FUNCS([touchlock])
  3513. LIBS=$OLD_LIBS
  3514. fi
  3515. dnl Debian, at least:
  3516. AC_CHECK_LIB([lockfile], [maillock], [have_lockfile=yes], [have_lockfile=no])
  3517. if test $have_lockfile = yes; then
  3518. LIBS_MAIL=-llockfile
  3519. AC_DEFINE([HAVE_LIBLOCKFILE], [1],
  3520. [Define to 1 if you have the 'lockfile' library (-llockfile).])
  3521. else
  3522. # If we have the shared liblockfile, assume we must use it for mail
  3523. # locking (e.g. Debian). If we couldn't link against liblockfile
  3524. # (no liblockfile.a installed), ensure that we don't need to.
  3525. dnl This works for files generally, not just executables.
  3526. dnl Should we look elsewhere for it? Maybe examine /etc/ld.so.conf?
  3527. AC_CHECK_PROG([liblockfile], [liblockfile.so], [yes], [no],
  3528. [/usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH])
  3529. if test "$ac_cv_prog_liblockfile" = yes; then
  3530. AC_MSG_ERROR([Shared liblockfile found but can't link against it.
  3531. This probably means that movemail could lose mail.
  3532. There may be a 'development' package to install containing liblockfile.])
  3533. fi
  3534. fi
  3535. AC_CHECK_HEADERS([maillock.h])
  3536. ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
  3537. ## interlock access to the mail spool. The alternative is a lock file named
  3538. ## /usr/spool/mail/$USER.lock.
  3539. mail_lock=no
  3540. case $opsys in
  3541. aix4-2) mail_lock="lockf" ;;
  3542. gnu|freebsd|dragonfly|netbsd|openbsd|darwin) mail_lock="flock" ;;
  3543. ## On GNU/Linux systems, both methods are used by various mail programs.
  3544. ## I assume most people are using newer mailers that have heard of flock.
  3545. ## Change this if you need to.
  3546. ## Debian contains a patch which says: "On Debian/GNU/Linux systems,
  3547. ## configure gets the right answers, and that means *NOT* using flock.
  3548. ## Using flock is guaranteed to be the wrong thing. See Debian Policy
  3549. ## for details." and then uses '#ifdef DEBIAN'. Unfortunately the
  3550. ## Debian maintainer hasn't provided a clean fix for Emacs.
  3551. ## movemail.c will use 'maillock' when MAILDIR, HAVE_LIBMAIL and
  3552. ## HAVE_MAILLOCK_H are defined, so the following appears to be the
  3553. ## correct logic. -- fx
  3554. ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
  3555. ## liblockfile is a Free Software replacement for libmail, used on
  3556. ## Debian systems and elsewhere. -rfr.
  3557. gnu-*)
  3558. mail_lock="flock"
  3559. if test $have_mail = yes || test $have_lockfile = yes; then
  3560. test $ac_cv_header_maillock_h = yes && mail_lock=no
  3561. fi ;;
  3562. mingw32)
  3563. mail_lock="none-needed" ;;
  3564. esac
  3565. case $mail_lock in
  3566. flock) AC_DEFINE([MAIL_USE_FLOCK], [1],
  3567. [Define if the mailer uses flock to interlock the mail spool.]);;
  3568. lockf) AC_DEFINE([MAIL_USE_LOCKF], [1],
  3569. [Define if the mailer uses lockf to interlock the mail spool.]);;
  3570. none-needed) ;;
  3571. *) BLESSMAIL_TARGET="need-blessmail" ;;
  3572. esac
  3573. fi
  3574. AC_SUBST([BLESSMAIL_TARGET])
  3575. AC_SUBST([LIBS_MAIL])
  3576. OLD_LIBS=$LIBS
  3577. LIBS="$LIB_PTHREAD $LIB_MATH $LIBS"
  3578. AC_CHECK_FUNCS(accept4 fchdir gethostname \
  3579. getrusage get_current_dir_name \
  3580. lrand48 random rint trunc \
  3581. select getpagesize setlocale newlocale \
  3582. getrlimit setrlimit shutdown \
  3583. pthread_sigmask strsignal setitimer \
  3584. sendto recvfrom getsockname getifaddrs freeifaddrs \
  3585. gai_strerror sync \
  3586. getpwent endpwent getgrent endgrent \
  3587. cfmakeraw cfsetspeed __executable_start log2 prctl)
  3588. LIBS=$OLD_LIBS
  3589. dnl No need to check for posix_memalign if aligned_alloc works.
  3590. AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
  3591. AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])
  3592. dnl Cannot use AC_CHECK_FUNCS
  3593. AC_CACHE_CHECK([for __builtin_frame_address],
  3594. [emacs_cv_func___builtin_frame_address],
  3595. [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_frame_address (0);])],
  3596. [emacs_cv_func___builtin_frame_address=yes],
  3597. [emacs_cv_func___builtin_frame_address=no])])
  3598. if test $emacs_cv_func___builtin_frame_address = yes; then
  3599. AC_DEFINE([HAVE___BUILTIN_FRAME_ADDRESS], 1,
  3600. [Define to 1 if you have the '__builtin_frame_address' function.])
  3601. fi
  3602. AC_CACHE_CHECK([for __builtin_unwind_init],
  3603. emacs_cv_func___builtin_unwind_init,
  3604. [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_unwind_init ();])],
  3605. emacs_cv_func___builtin_unwind_init=yes,
  3606. emacs_cv_func___builtin_unwind_init=no)])
  3607. if test $emacs_cv_func___builtin_unwind_init = yes; then
  3608. AC_DEFINE(HAVE___BUILTIN_UNWIND_INIT, 1,
  3609. [Define to 1 if you have the '__builtin_unwind_init' function.])
  3610. fi
  3611. AC_CHECK_HEADERS_ONCE(sys/un.h)
  3612. AC_FUNC_FSEEKO
  3613. # UNIX98 PTYs.
  3614. AC_CHECK_FUNCS(grantpt)
  3615. # PTY-related GNU extensions.
  3616. AC_CHECK_FUNCS(getpt posix_openpt)
  3617. dnl Run a test program that contains a call to tputs, a call that is
  3618. dnl never executed. This tests whether a pre-'main' dynamic linker
  3619. dnl works with the library. It's too much trouble to actually call
  3620. dnl tputs in the test program, due to portability hassles. When
  3621. dnl cross-compiling, assume the test program will run if it links.
  3622. AC_DEFUN([tputs_link_source], [
  3623. AC_LANG_SOURCE(
  3624. [[extern void tputs (const char *, int, int (*)(int));
  3625. int main (int argc, char **argv)
  3626. {
  3627. if (argc == 10000)
  3628. tputs (argv[0], 0, 0);
  3629. return 0;
  3630. }]])
  3631. ])
  3632. # Check this now, so that we will NOT find the above functions in ncurses.
  3633. # That is because we have not set up to link ncurses in lib-src.
  3634. # It's better to believe a function is not available
  3635. # than to expect to find it in ncurses.
  3636. # Also we need tputs and friends to be able to build at all.
  3637. AC_CACHE_CHECK([for library containing tputs], [emacs_cv_tputs_lib],
  3638. [if test "${opsys}" = "mingw32"; then
  3639. emacs_cv_tputs_lib='none required'
  3640. else
  3641. # Maybe curses should be tried earlier?
  3642. # See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
  3643. for tputs_library in '' tinfo ncurses terminfo termcap curses; do
  3644. OLIBS=$LIBS
  3645. if test -z "$tputs_library"; then
  3646. emacs_cv_tputs_lib='none required'
  3647. else
  3648. emacs_cv_tputs_lib=-l$tputs_library
  3649. LIBS="$emacs_cv_tputs_lib $LIBS"
  3650. fi
  3651. AC_RUN_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no],
  3652. [AC_LINK_IFELSE([tputs_link_source], [], [emacs_cv_tputs_lib=no])])
  3653. LIBS=$OLIBS
  3654. if test "X$emacs_cv_tputs_lib" != Xno; then
  3655. break
  3656. fi
  3657. done
  3658. fi])
  3659. AS_CASE(["$emacs_cv_tputs_lib"],
  3660. [no], [AC_MSG_ERROR([The required function 'tputs' was not found in any library.
  3661. The following libraries were tried (in order):
  3662. libtinfo, libncurses, libterminfo, libtermcap, libcurses
  3663. Please try installing whichever of these libraries is most appropriate
  3664. for your system, together with its header files.
  3665. For example, a libncurses-dev(el) or similar package.])],
  3666. [-l*], [LIBS_TERMCAP=$emacs_cv_tputs_lib],
  3667. [*], [LIBS_TERMCAP=])
  3668. ## Use termcap instead of terminfo?
  3669. ## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
  3670. TERMINFO=yes
  3671. ## FIXME? In the cases below where we unconditionally set
  3672. ## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
  3673. ## if that was found above to have tputs.
  3674. ## Should we use the gnu* logic everywhere?
  3675. case "$opsys" in
  3676. ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
  3677. ## The ncurses library has been moved out of the System framework in
  3678. ## Mac OS X 10.2. So if configure detects it, set the command-line
  3679. ## option to use it.
  3680. darwin) LIBS_TERMCAP="-lncurses" ;;
  3681. gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
  3682. freebsd)
  3683. AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
  3684. AC_CACHE_VAL(emacs_cv_freebsd_terminfo,
  3685. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <osreldate.h>]],
  3686. [[#if __FreeBSD_version < 400000
  3687. fail;
  3688. #endif
  3689. ]])], emacs_cv_freebsd_terminfo=yes, emacs_cv_freebsd_terminfo=no)])
  3690. AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
  3691. if test $emacs_cv_freebsd_terminfo = yes; then
  3692. LIBS_TERMCAP="-lncurses"
  3693. else
  3694. TERMINFO=no
  3695. LIBS_TERMCAP="-ltermcap"
  3696. fi
  3697. ;;
  3698. mingw32)
  3699. TERMINFO=no
  3700. LIBS_TERMCAP=
  3701. ;;
  3702. netbsd)
  3703. if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
  3704. TERMINFO=no
  3705. LIBS_TERMCAP="-ltermcap"
  3706. fi
  3707. ;;
  3708. openbsd | dragonfly) LIBS_TERMCAP="-lncurses" ;;
  3709. ## hpux: Make sure we get select from libc rather than from libcurses
  3710. ## because libcurses on HPUX 10.10 has a broken version of select.
  3711. ## We used to use -lc -lcurses, but this may be cleaner.
  3712. ## FIXME? But TERMINFO = yes on hpux (it used to be explicitly
  3713. # set that way, now it uses the default). Isn't this a contradiction?
  3714. hpux*) LIBS_TERMCAP="-ltermcap" ;;
  3715. esac
  3716. TERMCAP_OBJ=tparam.o
  3717. if test $TERMINFO = yes; then
  3718. AC_DEFINE(TERMINFO, 1, [Define to 1 if you use terminfo instead of termcap.])
  3719. TERMCAP_OBJ=terminfo.o
  3720. fi
  3721. if test "X$LIBS_TERMCAP" = "X-lncurses"; then
  3722. AC_DEFINE(USE_NCURSES, 1, [Define to 1 if you use ncurses.])
  3723. fi
  3724. AC_SUBST(LIBS_TERMCAP)
  3725. AC_SUBST(TERMCAP_OBJ)
  3726. # GNU/Linux-specific timer functions.
  3727. AC_CACHE_CHECK([for timerfd interface], [emacs_cv_have_timerfd],
  3728. [AC_COMPILE_IFELSE(
  3729. [AC_LANG_PROGRAM([[#include <sys/timerfd.h>
  3730. ]],
  3731. [[timerfd_create (CLOCK_REALTIME,
  3732. TFD_CLOEXEC | TFD_NONBLOCK);
  3733. timerfd_settime (0, TFD_TIMER_ABSTIME, 0, 0);]])],
  3734. [emacs_cv_have_timerfd=yes],
  3735. [emacs_cv_have_timerfd=no])])
  3736. if test "$emacs_cv_have_timerfd" = yes; then
  3737. AC_DEFINE([HAVE_TIMERFD], 1,
  3738. [Define to 1 if timerfd functions are supported as in GNU/Linux.])
  3739. fi
  3740. # Alternate stack for signal handlers.
  3741. AC_CACHE_CHECK([whether signals can be handled on alternate stack],
  3742. [emacs_cv_alternate_stack],
  3743. [AC_COMPILE_IFELSE(
  3744. [AC_LANG_PROGRAM([[#include <signal.h>
  3745. ]],
  3746. [[stack_t ss;
  3747. struct sigaction sa;
  3748. ss.ss_sp = malloc (SIGSTKSZ);
  3749. ss.ss_size = SIGSTKSZ;
  3750. sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
  3751. sigaltstack (&ss, 0);
  3752. sigaction (SIGSEGV, &sa, 0);]])],
  3753. [emacs_cv_alternate_stack=yes],
  3754. [emacs_cv_alternate_stack=no])])
  3755. # Do we need the Hesiod library to provide the support routines?
  3756. dnl FIXME? Should we be skipping this on Darwin too?
  3757. LIBHESIOD=
  3758. LIBRESOLV=
  3759. if test "$with_hesiod" != no ; then
  3760. # Don't set $LIBS here -- see comments above. FIXME which comments?
  3761. resolv=no
  3762. AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
  3763. [AC_CHECK_LIB(resolv, res_send, resolv=yes,
  3764. [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
  3765. if test "$resolv" = yes ; then
  3766. RESOLVLIB=-lresolv
  3767. else
  3768. RESOLVLIB=
  3769. fi
  3770. hesiod=no
  3771. AC_CHECK_FUNC(hes_getmailhost, , [AC_CHECK_LIB(hesiod, hes_getmailhost,
  3772. hesiod=yes, :, $RESOLVLIB)])
  3773. if test x"$hesiod" = xyes; then
  3774. LIBHESIOD=-lhesiod
  3775. LIBRESOLV=$RESOLVLIB
  3776. fi
  3777. fi
  3778. AC_SUBST(LIBHESIOD)
  3779. AC_SUBST(LIBRESOLV)
  3780. # These tell us which Kerberos-related libraries to use.
  3781. COM_ERRLIB=
  3782. CRYPTOLIB=
  3783. KRB5LIB=
  3784. DESLIB=
  3785. KRB4LIB=
  3786. if test "${with_kerberos}" != no; then
  3787. OLD_LIBS=$LIBS
  3788. AC_CHECK_LIB(com_err, com_err, have_com_err=yes, have_com_err=no)
  3789. if test $have_com_err = yes; then
  3790. COM_ERRLIB=-lcom_err
  3791. LIBS="$COM_ERRLIB $LIBS"
  3792. fi
  3793. AC_CHECK_LIB(crypto, mit_des_cbc_encrypt, have_crypto=yes, have_crypto=no)
  3794. if test $have_crypto = yes; then
  3795. CRYPTOLIB=-lcrypto
  3796. LIBS="$CRYPTOLIB $LIBS"
  3797. fi
  3798. AC_CHECK_LIB(k5crypto, mit_des_cbc_encrypt, have_k5crypto=yes, have_k5crypto=no)
  3799. if test $have_k5crypto = yes; then
  3800. CRYPTOLIB=-lk5crypto
  3801. LIBS="$CRYPTOLIB $LIBS"
  3802. fi
  3803. AC_CHECK_LIB(krb5, krb5_init_context, have_krb5=yes, have_krb5=no)
  3804. if test $have_krb5=yes; then
  3805. KRB5LIB=-lkrb5
  3806. LIBS="$KRB5LIB $LIBS"
  3807. fi
  3808. dnl FIXME Simplify. Does not match 22 logic, thanks to default_off?
  3809. if test "${with_kerberos5}" = no; then
  3810. AC_CHECK_LIB(des425, des_cbc_encrypt, have_des425=yes, have_des425=no )
  3811. if test $have_des425 = yes; then
  3812. DESLIB=-ldes425
  3813. LIBS="$DESLIB $LIBS"
  3814. else
  3815. AC_CHECK_LIB(des, des_cbc_encrypt, have_des=yes, have_des=no)
  3816. if test $have_des = yes; then
  3817. DESLIB=-ldes
  3818. LIBS="$DESLIB $LIBS"
  3819. fi
  3820. fi
  3821. AC_CHECK_LIB(krb4, krb_get_cred, have_krb4=yes, have_krb4=no)
  3822. if test $have_krb4 = yes; then
  3823. KRB4LIB=-lkrb4
  3824. LIBS="$KRB4LIB $LIBS"
  3825. else
  3826. AC_CHECK_LIB(krb, krb_get_cred, have_krb=yes, have_krb=no)
  3827. if test $have_krb = yes; then
  3828. KRB4LIB=-lkrb
  3829. LIBS="$KRB4LIB $LIBS"
  3830. fi
  3831. fi
  3832. fi
  3833. if test "${with_kerberos5}" != no; then
  3834. AC_CHECK_HEADERS(krb5.h,
  3835. [AC_CHECK_MEMBERS([krb5_error.text, krb5_error.e_text],,,
  3836. [#include <krb5.h>])])
  3837. else
  3838. AC_CHECK_HEADERS(krb.h,,
  3839. [AC_CHECK_HEADERS(kerberosIV/krb.h,,
  3840. [AC_CHECK_HEADERS(kerberos/krb.h)])])
  3841. fi
  3842. AC_CHECK_HEADERS(com_err.h)
  3843. LIBS=$OLD_LIBS
  3844. fi
  3845. AC_SUBST(COM_ERRLIB)
  3846. AC_SUBST(CRYPTOLIB)
  3847. AC_SUBST(KRB5LIB)
  3848. AC_SUBST(DESLIB)
  3849. AC_SUBST(KRB4LIB)
  3850. AC_CHECK_HEADERS(valgrind/valgrind.h)
  3851. AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
  3852. AC_CHECK_FUNCS_ONCE([sbrk])
  3853. ok_so_far=yes
  3854. AC_CHECK_FUNC(socket, , ok_so_far=no)
  3855. if test $ok_so_far = yes; then
  3856. AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
  3857. fi
  3858. if test $ok_so_far = yes; then
  3859. AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
  3860. fi
  3861. if test $ok_so_far = yes; then
  3862. dnl Fixme: Not used. Should this be HAVE_SOCKETS?
  3863. AC_DEFINE(HAVE_INET_SOCKETS, 1,
  3864. [Define to 1 if you have inet sockets.])
  3865. fi
  3866. AC_FUNC_FORK
  3867. AC_CHECK_FUNCS(snprintf)
  3868. dnl Check for glib. This differs from other library checks in that
  3869. dnl Emacs need not link to glib unless some other library is already
  3870. dnl linking to glib. Although glib provides no facilities that Emacs
  3871. dnl needs for its own purposes, when glib is present Emacs needs to
  3872. dnl use primitives like g_main_context_query to avoid clashing with
  3873. dnl glib at a low level.
  3874. dnl
  3875. dnl Check this late, since it depends on $GTK_CFLAGS etc.
  3876. XGSELOBJ=
  3877. AC_CACHE_CHECK([whether GLib is linked in], [emacs_cv_links_glib],
  3878. [OLDCFLAGS="$CFLAGS"
  3879. OLDLIBS="$LIBS"
  3880. CFLAGS="$CFLAGS $GTK_CFLAGS $RSVG_CFLAGS $DBUS_CFLAGS $SETTINGS_CFLAGS"
  3881. LIBS="$LIBS $GTK_LIBS $RSVG_LIBS $DBUS_LIBS $SETTINGS_LIBS"
  3882. CFLAGS="$CFLAGS $NOTIFY_CFLAGS $CAIRO_CFLAGS"
  3883. LIBS="$LIBS $NOTIFY_LIBS $CAIRO_LIBS"
  3884. AC_LINK_IFELSE([AC_LANG_PROGRAM(
  3885. [[#include <glib.h>
  3886. ]],
  3887. [[g_print ("Hello world");]])],
  3888. [emacs_cv_links_glib=yes],
  3889. [emacs_cv_links_glib=no])
  3890. CFLAGS="$OLDCFLAGS"
  3891. LIBS="$OLDLIBS"])
  3892. if test "${emacs_cv_links_glib}" = "yes"; then
  3893. AC_DEFINE(HAVE_GLIB, 1, [Define to 1 if GLib is linked in.])
  3894. if test "$HAVE_NS" = no;then
  3895. XGSELOBJ=xgselect.o
  3896. fi
  3897. fi
  3898. AC_SUBST(XGSELOBJ)
  3899. dnl Adapted from Haible's version.
  3900. AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
  3901. [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
  3902. [[char* cs = nl_langinfo(CODESET);]])],
  3903. emacs_cv_langinfo_codeset=yes,
  3904. emacs_cv_langinfo_codeset=no)
  3905. ])
  3906. if test $emacs_cv_langinfo_codeset = yes; then
  3907. AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
  3908. [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
  3909. fi
  3910. AC_TYPE_MBSTATE_T
  3911. dnl Fixme: AC_SYS_POSIX_TERMIOS should probably be used, but it's not clear
  3912. dnl how the tty code is related to POSIX and/or other versions of termios.
  3913. dnl The following looks like a useful start.
  3914. dnl
  3915. dnl AC_SYS_POSIX_TERMIOS
  3916. dnl if test $ac_cv_sys_posix_termios = yes; then
  3917. dnl AC_DEFINE(HAVE_TERMIOS, 1, [Define to 1 if you have POSIX-style functions
  3918. dnl and macros for terminal control.])
  3919. dnl AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
  3920. dnl fi
  3921. dnl Turned on June 1996 supposing nobody will mind it.
  3922. dnl MinGW emulates passwd database, so this feature doesn't make sense there.
  3923. if test "${opsys}" != "mingw32"; then
  3924. AC_DEFINE(AMPERSAND_FULL_NAME, 1, [Define to use the convention that &
  3925. in the full name stands for the login id.])
  3926. fi
  3927. dnl Everybody supports this, except MS.
  3928. dnl Seems like the kind of thing we should be testing for, though.
  3929. ## Note: PTYs are broken on darwin <6. Use at your own risk.
  3930. if test "${opsys}" != "mingw32"; then
  3931. AC_DEFINE(HAVE_PTYS, 1, [Define if the system supports pty devices.])
  3932. fi
  3933. dnl Everybody supports this, except MS-DOS.
  3934. dnl Seems like the kind of thing we should be testing for, though.
  3935. dnl Compare with HAVE_INET_SOCKETS (which is unused...) above.
  3936. AC_DEFINE(HAVE_SOCKETS, 1, [Define if the system supports
  3937. 4.2-compatible sockets.])
  3938. AH_TEMPLATE(INTERNAL_TERMINAL, [This is substituted when $TERM is "internal".])
  3939. AH_TEMPLATE(NULL_DEVICE, [Name of the file to open to get
  3940. a null file, or a data sink.])
  3941. if test "${opsys}" = "mingw32"; then
  3942. AC_DEFINE(NULL_DEVICE, ["NUL:"])
  3943. else
  3944. AC_DEFINE(NULL_DEVICE, ["/dev/null"])
  3945. fi
  3946. if test "${opsys}" = "mingw32"; then
  3947. SEPCHAR=';'
  3948. else
  3949. SEPCHAR=':'
  3950. fi
  3951. AC_DEFINE_UNQUOTED(SEPCHAR, ['$SEPCHAR'], [Character that separates PATH elements.])
  3952. dnl This is for MinGW, and is used in test/Makefile.in.
  3953. dnl The MSYS Bash has heuristics for replacing ':' with ';' when it
  3954. dnl decides that a command-line argument to be passed to a MinGW program
  3955. dnl is a PATH-style list of directories. But that heuristics plays it
  3956. dnl safe, and only does the replacement when it is _absolutely_ sure it
  3957. dnl sees a colon-separated list of file names; e.g. ":." is left alone,
  3958. dnl which breaks in-tree builds. So we do this manually instead.
  3959. dnl Note that we cannot rely on PATH_SEPARATOR, as that one will always
  3960. dnl be computed as ':' in MSYS Bash.
  3961. AC_SUBST(SEPCHAR)
  3962. dnl Everybody supports this, except MS-DOS.
  3963. AC_DEFINE(subprocesses, 1, [Define to enable asynchronous subprocesses.])
  3964. AC_DEFINE(USER_FULL_NAME, [pw->pw_gecos], [How to get a user's full name.])
  3965. AC_DEFINE(DIRECTORY_SEP, ['/'],
  3966. [Character that separates directories in a file name.])
  3967. if test "${opsys}" = "mingw32"; then
  3968. AC_DEFINE(IS_DEVICE_SEP(_c_), [((_c_) == ':')],
  3969. [Returns true if character is a device separator.])
  3970. AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == '/' || (_c_) == '\\')],
  3971. [Returns true if character is a directory separator.])
  3972. AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP(_c_))],
  3973. [Returns true if character is any form of separator.])
  3974. else
  3975. AC_DEFINE(IS_DEVICE_SEP(_c_), 0,
  3976. [Returns true if character is a device separator.])
  3977. AC_DEFINE(IS_DIRECTORY_SEP(_c_), [((_c_) == DIRECTORY_SEP)],
  3978. [Returns true if character is a directory separator.])
  3979. AC_DEFINE(IS_ANY_SEP(_c_), [(IS_DIRECTORY_SEP (_c_))],
  3980. [Returns true if character is any form of separator.])
  3981. fi
  3982. if test "$USE_X_TOOLKIT" != "none"; then
  3983. have_editres=yes
  3984. case $opsys in
  3985. hpux*)
  3986. dnl Assar Westerlund <assar@sics.se> says this is necessary
  3987. dnl for HP-UX 10.20, and that it works for HP-UX 0 as well.
  3988. have_editres=no
  3989. ;;
  3990. esac
  3991. if test "$have_editres" != no && test ! -z "$LIBXMU"; then
  3992. OLDLIBS="$LIBS"
  3993. dnl See libXmu.a check above.
  3994. if test x$HAVE_X11XTR6 = xyes; then
  3995. LIBS="-lXt -lSM -lICE $LIBXMU"
  3996. else
  3997. OTHERLIBS="-lXt -$LIBXMU"
  3998. fi
  3999. AC_TRY_LINK(
  4000. [#include <X11/Intrinsic.h>
  4001. #include <X11/Xmu/Editres.h>],
  4002. [_XEditResCheckMessages (0, 0, 0, 0);],
  4003. [AC_DEFINE([X_TOOLKIT_EDITRES], 1,
  4004. [Define to 1 if we should use XEditRes.])])
  4005. LIBS=$OLDLIBS
  4006. fi
  4007. fi
  4008. case $opsys in
  4009. sol2* | unixware )
  4010. dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
  4011. dnl instead, there's a system variable _sys_nsig. Unfortunately, we
  4012. dnl need the constant to dimension an array. So wire in the appropriate
  4013. dnl value here.
  4014. AC_DEFINE(NSIG_MINIMUM, 32, [Minimum value of NSIG.])
  4015. ;;
  4016. esac
  4017. emacs_broken_SIGIO=no
  4018. case $opsys in
  4019. dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
  4020. dnl See eg <http://article.gmane.org/gmane.os.openbsd.ports/46831>.
  4021. hpux* | nacl | openbsd | sol2* | unixware )
  4022. emacs_broken_SIGIO=yes
  4023. ;;
  4024. aix4-2)
  4025. dnl On AIX Emacs uses the gmalloc.c malloc implementation. But given
  4026. dnl the way this system works, libc functions that return malloced
  4027. dnl memory use the libc malloc implementation. Calling xfree or
  4028. dnl xrealloc on the results of such functions results in a crash.
  4029. dnl
  4030. dnl One solution for this could be to define SYSTEM_MALLOC in configure,
  4031. dnl but that does not currently work on this system.
  4032. dnl
  4033. dnl It is possible to completely override the malloc implementation on
  4034. dnl AIX, but that involves putting the malloc functions in a shared
  4035. dnl library and setting the MALLOCTYPE environment variable to point to
  4036. dnl that shared library.
  4037. dnl
  4038. dnl Emacs currently calls xrealloc on the results of get_current_dir name,
  4039. dnl to avoid a crash just use the Emacs implementation for that function.
  4040. dnl
  4041. dnl FIXME We could change the AC_CHECK_FUNCS call near the start
  4042. dnl of this file, so that we do not check for get_current_dir_name
  4043. dnl on AIX. But that might be fragile if something else ends
  4044. dnl up testing for get_current_dir_name as a dependency.
  4045. AC_DEFINE(BROKEN_GET_CURRENT_DIR_NAME, 1, [Define if
  4046. get_current_dir_name should not be used.])
  4047. ;;
  4048. freebsd)
  4049. dnl Circumvent a bug in FreeBSD. In the following sequence of
  4050. dnl writes/reads on a PTY, read(2) returns bogus data:
  4051. dnl
  4052. dnl write(2) 1022 bytes
  4053. dnl write(2) 954 bytes, get EAGAIN
  4054. dnl read(2) 1024 bytes in process_read_output
  4055. dnl read(2) 11 bytes in process_read_output
  4056. dnl
  4057. dnl That is, read(2) returns more bytes than have ever been written
  4058. dnl successfully. The 1033 bytes read are the 1022 bytes written
  4059. dnl successfully after processing (for example with CRs added if the
  4060. dnl terminal is set up that way which it is here). The same bytes will
  4061. dnl be seen again in a later read(2), without the CRs.
  4062. AC_DEFINE(BROKEN_PTY_READ_AFTER_EAGAIN, 1, [Define on FreeBSD to
  4063. work around an issue when reading from a PTY.])
  4064. ;;
  4065. esac
  4066. case $opsys in
  4067. gnu-* | sol2-10 )
  4068. dnl FIXME Can't we test if this exists (eg /proc/$$)?
  4069. AC_DEFINE(HAVE_PROCFS, 1, [Define if you have the /proc filesystem.])
  4070. ;;
  4071. esac
  4072. case $opsys in
  4073. darwin | dragonfly | freebsd | netbsd | openbsd )
  4074. AC_DEFINE(DONT_REOPEN_PTY, 1, [Define if process.c does not need to
  4075. close a pty to make it a controlling terminal (it is already a
  4076. controlling terminal of the subprocess, because we did ioctl TIOCSCTTY).])
  4077. ;;
  4078. esac
  4079. dnl FIXME Surely we can test for this rather than hard-code it.
  4080. case $opsys in
  4081. netbsd | openbsd) sound_device="/dev/audio" ;;
  4082. *) sound_device="/dev/dsp" ;;
  4083. esac
  4084. dnl Used in sound.c
  4085. AC_DEFINE_UNQUOTED(DEFAULT_SOUND_DEVICE, "$sound_device",
  4086. [Name of the default sound device.])
  4087. dnl Emacs can read input using SIGIO and buffering characters itself,
  4088. dnl or using CBREAK mode and making C-g cause SIGINT.
  4089. dnl The choice is controlled by the variable interrupt_input.
  4090. dnl
  4091. dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
  4092. dnl
  4093. dnl Emacs uses the presence of the USABLE_SIGIO macro
  4094. dnl to indicate whether or not signal-driven I/O is possible. It uses
  4095. dnl INTERRUPT_INPUT to decide whether to use it by default.
  4096. dnl
  4097. dnl SIGIO can be used only on systems that implement it (4.2 and 4.3).
  4098. dnl CBREAK mode has two disadvantages
  4099. dnl 1) At least in 4.2, it is impossible to handle the Meta key properly.
  4100. dnl I hear that in system V this problem does not exist.
  4101. dnl 2) Control-G causes output to be discarded.
  4102. dnl I do not know whether this can be fixed in system V.
  4103. dnl
  4104. dnl Another method of doing input is planned but not implemented.
  4105. dnl It would have Emacs fork off a separate process
  4106. dnl to read the input and send it to the true Emacs process
  4107. dnl through a pipe.
  4108. case $opsys in
  4109. darwin | gnu-linux | gnu-kfreebsd )
  4110. AC_DEFINE(INTERRUPT_INPUT, 1, [Define to read input using SIGIO.])
  4111. ;;
  4112. esac
  4113. dnl If the system's imake configuration file defines 'NeedWidePrototypes'
  4114. dnl as 'NO', we must define NARROWPROTO manually. Such a define is
  4115. dnl generated in the Makefile generated by 'xmkmf'. If we don't define
  4116. dnl NARROWPROTO, we will see the wrong function prototypes for X functions
  4117. dnl taking float or double parameters.
  4118. case $opsys in
  4119. cygwin|gnu|gnu-linux|gnu-kfreebsd|freebsd|netbsd|openbsd)
  4120. AC_DEFINE(NARROWPROTO, 1, [Define if system's imake configuration
  4121. file defines 'NeedWidePrototypes' as 'NO'.])
  4122. ;;
  4123. esac
  4124. dnl Used in process.c, this must be a loop, even if it only runs once.
  4125. AH_TEMPLATE(PTY_ITERATION, [How to iterate over PTYs.])
  4126. dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
  4127. dnl trying suffixes 0-16.
  4128. AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
  4129. first PTY, if PTYs are supported.])
  4130. AH_TEMPLATE(PTY_OPEN, [How to open a PTY, if non-standard.])
  4131. AH_TEMPLATE(PTY_NAME_SPRINTF, [How to get the device name of the control
  4132. end of a PTY, if non-standard.])
  4133. AH_TEMPLATE(PTY_TTY_NAME_SPRINTF, [How to get device name of the tty
  4134. end of a PTY, if non-standard.])
  4135. case $opsys in
  4136. aix4-2 )
  4137. AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)])
  4138. dnl You allocate a pty by opening /dev/ptc to get the master side.
  4139. dnl To get the name of the slave side, you just ttyname() the master side.
  4140. AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");])
  4141. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));])
  4142. ;;
  4143. cygwin )
  4144. AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
  4145. dnl multi-line AC_DEFINEs are hard. :(
  4146. AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (false)])
  4147. AC_DEFINE(PTY_NAME_SPRINTF, [])
  4148. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
  4149. ;;
  4150. gnu | openbsd )
  4151. AC_DEFINE(FIRST_PTY_LETTER, ['p'])
  4152. ;;
  4153. gnu-linux | gnu-kfreebsd | dragonfly | freebsd | netbsd | darwin | nacl )
  4154. dnl if HAVE_GRANTPT
  4155. if test "x$ac_cv_func_grantpt" = xyes; then
  4156. AC_DEFINE(UNIX98_PTYS, 1, [Define if the system has Unix98 PTYs.])
  4157. AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
  4158. dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD
  4159. dnl to prevent sigchld_handler from intercepting the child's death.
  4160. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
  4161. dnl if HAVE_POSIX_OPENPT
  4162. if test "x$ac_cv_func_posix_openpt" = xyes; then
  4163. AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (false)])
  4164. AC_DEFINE(PTY_NAME_SPRINTF, [])
  4165. dnl if HAVE_GETPT
  4166. elif test "x$ac_cv_func_getpt" = xyes; then
  4167. AC_DEFINE(PTY_OPEN, [fd = getpt ()])
  4168. AC_DEFINE(PTY_NAME_SPRINTF, [])
  4169. else
  4170. AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
  4171. fi
  4172. else
  4173. AC_DEFINE(FIRST_PTY_LETTER, ['p'])
  4174. fi
  4175. ;;
  4176. hpux*)
  4177. AC_DEFINE(FIRST_PTY_LETTER, ['p'])
  4178. AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);])
  4179. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);])
  4180. ;;
  4181. sol2* )
  4182. dnl On SysVr4, grantpt(3) forks a subprocess, so do not use
  4183. dnl O_CLOEXEC when opening the pty, and keep the SIGCHLD handler
  4184. dnl from intercepting that death. If any child but grantpt's should die
  4185. dnl within, it should be caught after sigrelse(2).
  4186. AC_DEFINE(PTY_OPEN, [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
  4187. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
  4188. ;;
  4189. unixware )
  4190. dnl Comments are as per sol2*.
  4191. AC_DEFINE(PTY_OPEN, [fd = open (pty_name, O_RDWR | O_NONBLOCK)])
  4192. AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
  4193. ;;
  4194. esac
  4195. case $opsys in
  4196. sol2* | unixware )
  4197. dnl This change means that we don't loop through allocate_pty too
  4198. dnl many times in the (rare) event of a failure.
  4199. AC_DEFINE(FIRST_PTY_LETTER, ['z'])
  4200. AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
  4201. dnl Push various streams modules onto a PTY channel. Used in process.c.
  4202. AC_DEFINE(SETUP_SLAVE_PTY, [if (ioctl (forkin, I_PUSH, "ptem") == -1) fatal ("ioctl I_PUSH ptem"); if (ioctl (forkin, I_PUSH, "ldterm") == -1) fatal ("ioctl I_PUSH ldterm"); if (ioctl (forkin, I_PUSH, "ttcompat") == -1) fatal ("ioctl I_PUSH ttcompat");], [How to set up a slave PTY, if needed.])
  4203. ;;
  4204. esac
  4205. AH_TEMPLATE(SIGNALS_VIA_CHARACTERS, [Make process_send_signal work by
  4206. "typing" a signal character on the pty.])
  4207. case $opsys in
  4208. dnl Perry Smith <pedz@ddivt1.austin.ibm.com> says this is correct for AIX.
  4209. aix4-2 | cygwin | gnu | dragonfly | freebsd | netbsd | openbsd | darwin )
  4210. AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
  4211. ;;
  4212. dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
  4213. dnl FIXME Does gnu-kfreebsd have linux/version.h? It seems unlikely...
  4214. gnu-linux | gnu-kfreebsd )
  4215. AC_CACHE_CHECK([for signals via characters], [emacs_cv_signals_via_chars],
  4216. [AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
  4217. #include <linux/version.h>
  4218. #if LINUX_VERSION_CODE < 0x20400
  4219. # error "Linux version too old"
  4220. #endif
  4221. ]], [[]])], emacs_cv_signals_via_chars=yes, emacs_cv_signals_via_chars=no)])
  4222. test "$emacs_cv_signals_via_chars" = yes && AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
  4223. ;;
  4224. esac
  4225. AH_TEMPLATE(TAB3, [Undocumented.])
  4226. case $opsys in
  4227. darwin) AC_DEFINE(TAB3, OXTABS) ;;
  4228. gnu | dragonfly | freebsd | netbsd | openbsd )
  4229. AC_DEFINE(TABDLY, OXTABS, [Undocumented.])
  4230. AC_DEFINE(TAB3, OXTABS)
  4231. ;;
  4232. gnu-linux | gnu-kfreebsd )
  4233. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
  4234. #ifndef __ia64__
  4235. # error "not ia64"
  4236. #endif
  4237. ]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
  4238. [do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (false)],
  4239. [Mark a secondary stack, like the register stack on the ia64.]), [])
  4240. ;;
  4241. hpux*)
  4242. AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call
  4243. run_time_remap; for HPUX.])
  4244. ;;
  4245. esac
  4246. dnl This won't be used automatically yet. We also need to know, at least,
  4247. dnl that the stack is continuous.
  4248. AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all
  4249. registers relevant for conservative garbage collection in the jmp_buf.])
  4250. case $opsys in
  4251. dnl Not all the architectures are tested, but there are Debian packages
  4252. dnl for SCM and/or Guile on them, so the technique must work. See also
  4253. dnl comments in alloc.c concerning setjmp and gcc.
  4254. dnl Fixme: it's probably safe to just use the GCC conditional below.
  4255. gnu-linux | gnu-kfreebsd )
  4256. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
  4257. #if defined __i386__ || defined __sparc__ || defined __mc68000__ \
  4258. || defined __alpha__ || defined __mips__ || defined __s390__ \
  4259. || defined __arm__ || defined __powerpc__ || defined __amd64__ \
  4260. || defined __ia64__ || defined __sh__
  4261. /* ok */
  4262. #else
  4263. # error "setjmp not known to work on this arch"
  4264. #endif
  4265. ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1))
  4266. ;;
  4267. esac
  4268. if test x$GCC = xyes; then
  4269. dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
  4270. AC_DEFINE(GC_SETJMP_WORKS, 1)
  4271. else
  4272. case $opsys in
  4273. aix* | dragonfly | freebsd | netbsd | openbsd | sol2* )
  4274. AC_DEFINE(GC_SETJMP_WORKS, 1)
  4275. ;;
  4276. esac
  4277. fi dnl GCC?
  4278. dnl In a weird quirk, MS runtime uses _setjmp and longjmp.
  4279. AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp],
  4280. [AC_LINK_IFELSE(
  4281. [AC_LANG_PROGRAM(
  4282. [[#include <setjmp.h>
  4283. #ifdef __MINGW32__
  4284. # define _longjmp longjmp
  4285. #endif
  4286. ]],
  4287. [[jmp_buf j;
  4288. if (! _setjmp (j))
  4289. _longjmp (j, 1);]])],
  4290. [emacs_cv_func__setjmp=yes],
  4291. [emacs_cv_func__setjmp=no])])
  4292. if test $emacs_cv_func__setjmp = yes; then
  4293. AC_DEFINE([HAVE__SETJMP], 1, [Define to 1 if _setjmp and _longjmp work.])
  4294. fi
  4295. # We need to preserve signal mask to handle C stack overflows.
  4296. AC_CACHE_CHECK([for sigsetjmp], [emacs_cv_func_sigsetjmp],
  4297. [AC_LINK_IFELSE(
  4298. [AC_LANG_PROGRAM(
  4299. [[#include <setjmp.h>
  4300. ]],
  4301. [[sigjmp_buf j;
  4302. if (! sigsetjmp (j, 1))
  4303. siglongjmp (j, 1);]])],
  4304. [emacs_cv_func_sigsetjmp=yes],
  4305. [emacs_cv_func_sigsetjmp=no])])
  4306. if test $emacs_cv_func_sigsetjmp = yes; then
  4307. AC_DEFINE([HAVE_SIGSETJMP], 1,
  4308. [Define to 1 if sigsetjmp and siglongjmp work.])
  4309. fi
  4310. case $emacs_cv_func_sigsetjmp,$emacs_cv_alternate_stack,$opsys in
  4311. yes,yes,* | *,*,mingw32)
  4312. AC_DEFINE([HAVE_STACK_OVERFLOW_HANDLING], 1,
  4313. [Define to 1 if C stack overflow can be handled in some cases.]);;
  4314. esac
  4315. case $opsys in
  4316. sol2* | unixware )
  4317. dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY
  4318. dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs,
  4319. dnl and this is all we need.
  4320. AC_DEFINE(TIOCSIGSEND, TIOCSIGNAL, [Some platforms redefine this.])
  4321. ;;
  4322. esac
  4323. case $opsys in
  4324. hpux* | sol2* )
  4325. dnl Used in xfaces.c.
  4326. AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on
  4327. some systems, where it requires time.h.])
  4328. ;;
  4329. esac
  4330. dnl Define symbols to identify the version of Unix this is.
  4331. dnl Define all the symbols that apply correctly.
  4332. AH_TEMPLATE(DOS_NT, [Define if the system is MS DOS or MS Windows.])
  4333. AH_TEMPLATE(MSDOS, [Define if the system is MS DOS.])
  4334. AH_TEMPLATE(USG, [Define if the system is compatible with System III.])
  4335. AH_TEMPLATE(USG5_4, [Define if the system is compatible with System V Release 4.])
  4336. case $opsys in
  4337. aix4-2)
  4338. AC_DEFINE(USG, [])
  4339. dnl This symbol should be defined on AIX Version 3 ???????
  4340. AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
  4341. #ifndef _AIX
  4342. # error "_AIX not defined"
  4343. #endif
  4344. ]], [[]])], [], AC_DEFINE(_AIX, [], [Define if the system is AIX.]))
  4345. ;;
  4346. cygwin)
  4347. AC_DEFINE(CYGWIN, 1, [Define if the system is Cygwin.])
  4348. ;;
  4349. darwin)
  4350. dnl Not __APPLE__, as this may not be defined on non-macOS Darwin.
  4351. dnl Not DARWIN, because Panther and lower CoreFoundation.h use DARWIN to
  4352. dnl distinguish macOS from pure Darwin.
  4353. AC_DEFINE(DARWIN_OS, [], [Define if the system is Darwin.])
  4354. ;;
  4355. gnu-linux | gnu-kfreebsd )
  4356. AC_DEFINE(USG, [])
  4357. AC_DEFINE(GNU_LINUX, [], [Define if ths system is compatible with GNU/Linux.])
  4358. ;;
  4359. hpux*)
  4360. AC_DEFINE(USG, [])
  4361. AC_DEFINE(HPUX, [], [Define if the system is HPUX.])
  4362. ;;
  4363. mingw32)
  4364. AC_DEFINE(DOS_NT, [])
  4365. AC_DEFINE(WINDOWSNT, 1, [Define if compiling for native MS Windows.])
  4366. if test "x$ac_enable_checking" != "x" ; then
  4367. AC_DEFINE(EMACSDEBUG, 1, [Define to 1 to enable w32 debug facilities.])
  4368. fi
  4369. ;;
  4370. sol2*)
  4371. AC_DEFINE(USG, [])
  4372. AC_DEFINE(USG5_4, [])
  4373. AC_DEFINE(SOLARIS2, [], [Define if the system is Solaris.])
  4374. ;;
  4375. unixware)
  4376. AC_DEFINE(USG, [])
  4377. AC_DEFINE(USG5_4, [])
  4378. ;;
  4379. esac
  4380. AC_CACHE_CHECK([for usable FIONREAD], [emacs_cv_usable_FIONREAD],
  4381. [case $opsys in
  4382. aix4-2 | nacl)
  4383. dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
  4384. emacs_cv_usable_FIONREAD=no
  4385. ;;
  4386. mingw32)
  4387. emacs_cv_usable_FIONREAD=yes
  4388. ;;
  4389. *)
  4390. AC_COMPILE_IFELSE(
  4391. [AC_LANG_PROGRAM([[#include <sys/types.h>
  4392. #include <sys/ioctl.h>
  4393. #ifdef USG5_4
  4394. # include <sys/filio.h>
  4395. #endif
  4396. ]],
  4397. [[int foo = ioctl (0, FIONREAD, &foo);]])],
  4398. [emacs_cv_usable_FIONREAD=yes],
  4399. [emacs_cv_usable_FIONREAD=no])
  4400. ;;
  4401. esac])
  4402. if test $emacs_cv_usable_FIONREAD = yes; then
  4403. AC_DEFINE([USABLE_FIONREAD], [1], [Define to 1 if FIONREAD is usable.])
  4404. if test $emacs_broken_SIGIO = no; then
  4405. AC_CACHE_CHECK([for usable SIGIO], [emacs_cv_usable_SIGIO],
  4406. [AC_COMPILE_IFELSE(
  4407. [AC_LANG_PROGRAM([[#include <fcntl.h>
  4408. #include <signal.h>
  4409. ]],
  4410. [[int foo = SIGIO | F_SETFL | FASYNC;]])],
  4411. [emacs_cv_usable_SIGIO=yes],
  4412. [emacs_cv_usable_SIGIO=no])],
  4413. [emacs_cv_usable_SIGIO=yes],
  4414. [emacs_cv_usable_SIGIO=no])
  4415. if test $emacs_cv_usable_SIGIO = yes; then
  4416. AC_DEFINE([USABLE_SIGIO], [1], [Define to 1 if SIGIO is usable.])
  4417. fi
  4418. fi
  4419. fi
  4420. case $opsys in
  4421. hpux11)
  4422. dnl It works to open the pty's tty in the parent (Emacs), then
  4423. dnl close and reopen it in the child.
  4424. AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it
  4425. works to open a pty's tty in the parent process, then close and
  4426. reopen it in the child.])
  4427. ;;
  4428. sol2-10)
  4429. AC_DEFINE(_STRUCTURED_PROC, 1, [Needed for system_process_attributes
  4430. on Solaris.])
  4431. ;;
  4432. esac
  4433. # Set up the CFLAGS for real compilation, so we can substitute it.
  4434. CFLAGS="$REAL_CFLAGS"
  4435. CPPFLAGS="$REAL_CPPFLAGS"
  4436. LIBS="$REAL_LIBS"
  4437. ## Hack to detect a buggy GCC version.
  4438. if test "$GCC" = yes && \
  4439. $CC --version 2> /dev/null | grep 'gcc.* 4.5.0' >/dev/null; then
  4440. case $CFLAGS in
  4441. *-fno-optimize-sibling-calls*) ;;
  4442. *-O@<:@23@:>@*)
  4443. AC_MSG_ERROR([GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS.]);;
  4444. esac
  4445. fi
  4446. version=$PACKAGE_VERSION
  4447. copyright="Copyright (C) 2017 Free Software Foundation, Inc."
  4448. AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
  4449. [Short copyright string for this version of Emacs.])
  4450. AC_SUBST(copyright)
  4451. ### Specify what sort of things we'll be editing into Makefile and config.h.
  4452. ### Use configuration here uncanonicalized to avoid exceeding size limits.
  4453. AC_SUBST(version)
  4454. AC_SUBST(configuration)
  4455. ## Unused?
  4456. AC_SUBST(canonical)
  4457. AC_SUBST(srcdir)
  4458. AC_SUBST(prefix)
  4459. AC_SUBST(exec_prefix)
  4460. AC_SUBST(bindir)
  4461. AC_SUBST(datadir)
  4462. AC_SUBST(sharedstatedir)
  4463. AC_SUBST(libexecdir)
  4464. AC_SUBST(mandir)
  4465. AC_SUBST(infodir)
  4466. AC_SUBST(lispdir)
  4467. AC_SUBST(standardlisppath)
  4468. AC_SUBST(locallisppath)
  4469. AC_SUBST(lisppath)
  4470. AC_SUBST(x_default_search_path)
  4471. AC_SUBST(etcdir)
  4472. AC_SUBST(archlibdir)
  4473. AC_SUBST(etcdocdir)
  4474. AC_SUBST(bitmapdir)
  4475. AC_SUBST(gamedir)
  4476. AC_SUBST(gameuser)
  4477. AC_SUBST(gamegroup)
  4478. ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
  4479. ## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the
  4480. ## end of LIBX_BASE, but nothing ever set it.
  4481. AC_SUBST(LD_SWITCH_X_SITE)
  4482. AC_SUBST(C_SWITCH_X_SITE)
  4483. AC_SUBST(GNUSTEP_CFLAGS)
  4484. AC_SUBST(CFLAGS)
  4485. ## Used in lwlib/Makefile.in.
  4486. AC_SUBST(X_TOOLKIT_TYPE)
  4487. AC_SUBST(ns_appdir)
  4488. AC_SUBST(ns_appbindir)
  4489. AC_SUBST(ns_appresdir)
  4490. AC_SUBST(ns_appsrc)
  4491. AC_SUBST(GNU_OBJC_CFLAGS)
  4492. AC_SUBST(OTHER_FILES)
  4493. if test -n "${term_header}"; then
  4494. AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}",
  4495. [Define to the header for the built-in window system.])
  4496. fi
  4497. AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}",
  4498. [Define to the canonical Emacs configuration name.])
  4499. AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${emacs_config_options}",
  4500. [Define to the options passed to configure.])
  4501. XMENU_OBJ=
  4502. XOBJ=
  4503. FONT_OBJ=
  4504. if test "${HAVE_X_WINDOWS}" = "yes" ; then
  4505. AC_DEFINE(HAVE_X_WINDOWS, 1,
  4506. [Define to 1 if you want to use the X window system.])
  4507. XMENU_OBJ=xmenu.o
  4508. XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o"
  4509. FONT_OBJ=xfont.o
  4510. if test "$HAVE_CAIRO" = "yes"; then
  4511. FONT_OBJ="ftfont.o ftcrfont.o"
  4512. elif test "$HAVE_XFT" = "yes"; then
  4513. FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o"
  4514. elif test "$HAVE_FREETYPE" = "yes"; then
  4515. FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o"
  4516. fi
  4517. AC_SUBST(FONT_OBJ)
  4518. fi
  4519. AC_SUBST(XMENU_OBJ)
  4520. AC_SUBST(XOBJ)
  4521. AC_SUBST(FONT_OBJ)
  4522. WIDGET_OBJ=
  4523. MOTIF_LIBW=
  4524. if test "${USE_X_TOOLKIT}" != "none" ; then
  4525. WIDGET_OBJ=widget.o
  4526. AC_DEFINE(USE_X_TOOLKIT, 1, [Define to 1 if using an X toolkit.])
  4527. if test "${USE_X_TOOLKIT}" = "LUCID"; then
  4528. AC_DEFINE(USE_LUCID, 1, [Define to 1 if using the Lucid X toolkit.])
  4529. elif test "${USE_X_TOOLKIT}" = "MOTIF"; then
  4530. AC_DEFINE(USE_MOTIF, 1, [Define to 1 if using the Motif X toolkit.])
  4531. MOTIF_LIBW=-lXm
  4532. case "$opsys" in
  4533. gnu-linux)
  4534. ## Paul Abrahams <abrahams at equinox.shaysnet.com> says this is needed.
  4535. MOTIF_LIBW="$MOTIF_LIBW -lXpm"
  4536. ;;
  4537. unixware)
  4538. ## Richard Anthony Ryan <ryanr at ellingtn.ftc.nrcs.usda.gov>
  4539. ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2.
  4540. MOTIF_LIBW="MOTIF_LIBW -lXimp"
  4541. ;;
  4542. aix4-2)
  4543. ## olson@mcs.anl.gov says -li18n is needed by -lXm.
  4544. MOTIF_LIBW="$MOTIF_LIBW -li18n"
  4545. ;;
  4546. esac
  4547. MOTIF_LIBW="$MOTIF_LIBW $LIBXP"
  4548. fi
  4549. fi
  4550. AC_SUBST(WIDGET_OBJ)
  4551. TOOLKIT_LIBW=
  4552. case "$USE_X_TOOLKIT" in
  4553. MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;;
  4554. LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;;
  4555. none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS" ;;
  4556. esac
  4557. if test "$HAVE_XWIDGETS" = "yes"; then
  4558. TOOLKIT_LIBW="$TOOLKIT_LIBW -lXcomposite"
  4559. fi
  4560. AC_SUBST(TOOLKIT_LIBW)
  4561. if test "${opsys}" != "mingw32"; then
  4562. if test "$USE_X_TOOLKIT" = "none"; then
  4563. LIBXT_OTHER="\$(LIBXSM)"
  4564. else
  4565. LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext"
  4566. fi
  4567. fi
  4568. AC_SUBST(LIBXT_OTHER)
  4569. if test "${HAVE_X11}" = "yes" ; then
  4570. AC_DEFINE(HAVE_X11, 1,
  4571. [Define to 1 if you want to use version 11 of X windows.])
  4572. LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)"
  4573. else
  4574. LIBX_OTHER=
  4575. fi
  4576. AC_SUBST(LIBX_OTHER)
  4577. HAVE_OLDXMENU=no
  4578. if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; then
  4579. LIBXMENU=
  4580. elif test "$USE_X_TOOLKIT" = none; then
  4581. HAVE_OLDXMENU=yes
  4582. LIBXMENU='$(oldXMenudir)/libXMenu11.a'
  4583. AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu"
  4584. else
  4585. LIBXMENU='$(lwlibdir)/liblw.a'
  4586. AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib"
  4587. fi
  4588. AC_SUBST(LIBXMENU)
  4589. AC_CACHE_CHECK([for struct alignment],
  4590. [emacs_cv_struct_alignment],
  4591. [AC_COMPILE_IFELSE(
  4592. [AC_LANG_PROGRAM([[#include <stddef.h>
  4593. struct __attribute__ ((aligned (8))) s { char c; };
  4594. struct t { char c; struct s s; };
  4595. char verify[offsetof (struct t, s) == 8 ? 1 : -1];
  4596. ]])],
  4597. [emacs_cv_struct_alignment=yes],
  4598. [emacs_cv_struct_alignment=no])])
  4599. if test "$emacs_cv_struct_alignment" = yes; then
  4600. AC_DEFINE([HAVE_STRUCT_ATTRIBUTE_ALIGNED], 1,
  4601. [Define to 1 if 'struct __attribute__ ((aligned (N)))' aligns the
  4602. structure to an N-byte boundary.])
  4603. fi
  4604. if test "${GNU_MALLOC}" = "yes" ; then
  4605. AC_DEFINE(GNU_MALLOC, 1,
  4606. [Define to 1 if you want to use the GNU memory allocator.])
  4607. fi
  4608. RALLOC_OBJ=
  4609. if test "${REL_ALLOC}" = "yes" ; then
  4610. AC_DEFINE(REL_ALLOC, 1,
  4611. [Define REL_ALLOC if you want to use the relocating allocator for
  4612. buffer space.])
  4613. test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o
  4614. fi
  4615. AC_SUBST(RALLOC_OBJ)
  4616. if test "$opsys" = "cygwin"; then
  4617. CYGWIN_OBJ="cygw32.o"
  4618. ## Cygwin differs because of its unexec().
  4619. PRE_ALLOC_OBJ=
  4620. POST_ALLOC_OBJ=lastfile.o
  4621. elif test "$opsys" = "mingw32"; then
  4622. CYGWIN_OBJ=
  4623. PRE_ALLOC_OBJ=
  4624. POST_ALLOC_OBJ=lastfile.o
  4625. else
  4626. CYGWIN_OBJ=
  4627. PRE_ALLOC_OBJ=lastfile.o
  4628. POST_ALLOC_OBJ=
  4629. fi
  4630. AC_SUBST(CYGWIN_OBJ)
  4631. AC_SUBST(PRE_ALLOC_OBJ)
  4632. AC_SUBST(POST_ALLOC_OBJ)
  4633. dnl Call this 'FORTIFY_SOUR' so that it sorts before the 'FORTIFY_SOURCE'
  4634. dnl verbatim defined above. The tricky name is apropos, as this hack
  4635. dnl makes Fortify go sour!
  4636. AH_VERBATIM([FORTIFY_SOUR],
  4637. [/* Without the following workaround, Emacs runs slowly on OS X 10.8.
  4638. The workaround disables some useful run-time checking, so it
  4639. should be conditional to the platforms with the performance bug.
  4640. Perhaps Apple will fix this some day; also see m4/extern-inline.m4. */
  4641. #if defined __APPLE__ && defined __GNUC__
  4642. # ifndef _DONT_USE_CTYPE_INLINE_
  4643. # define _DONT_USE_CTYPE_INLINE_
  4644. # endif
  4645. # ifndef _FORTIFY_SOURCE
  4646. # define _FORTIFY_SOURCE 0
  4647. # endif
  4648. #endif
  4649. ])
  4650. # If user asks to omit features, disable optional features that gnulib
  4651. # might otherwise enable.
  4652. if test "$with_features" = no && test "$enable_acl" != yes; then
  4653. enable_acl=no
  4654. fi
  4655. # Configure gnulib. Although this does not affect CFLAGS or LIBS permanently.
  4656. # it temporarily reverts them to their pre-pkg-config values,
  4657. # because gnulib needs to work with both src (which uses the
  4658. # pkg-config stuff) and lib-src (which does not). For example, gnulib
  4659. # may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
  4660. # and it therefore needs to run in an environment where LIBS does not
  4661. # already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
  4662. # for some package unrelated to lib-src.
  4663. SAVE_CFLAGS=$CFLAGS
  4664. SAVE_LIBS=$LIBS
  4665. CFLAGS=$pre_PKG_CONFIG_CFLAGS
  4666. LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
  4667. gl_ASSERT_NO_GNULIB_POSIXCHECK
  4668. gl_ASSERT_NO_GNULIB_TESTS
  4669. gl_INIT
  4670. CFLAGS=$SAVE_CFLAGS
  4671. LIBS=$SAVE_LIBS
  4672. if test "${opsys}" = "mingw32"; then
  4673. CPPFLAGS="$CPPFLAGS -DUSE_CRT_DLL=1 -I \${abs_top_srcdir}/nt/inc"
  4674. # Remove unneeded switches from the value of CC that goes to Makefiles
  4675. CC=`AS_ECHO(["$CC"]) | sed -e "s,$GCC_TEST_OPTIONS,,"`
  4676. fi
  4677. case "$opsys" in
  4678. aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
  4679. cygwin) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000" ;;
  4680. darwin)
  4681. ## The -headerpad option tells ld (see man page) to leave room at the
  4682. ## end of the header for adding load commands. Needed for dumping.
  4683. ## 0x1000 is enough for roughly 52 load commands on the x86_64
  4684. ## architecture (where they are 78 bytes each). The actual number of
  4685. ## load commands added is not consistent but normally ranges from
  4686. ## about 14 to about 34. Setting it high gets us plenty of slop and
  4687. ## only costs about 1.5K of wasted binary space.
  4688. headerpad_extra=1000
  4689. if test "$HAVE_NS" = "yes"; then
  4690. libs_nsgui="-framework AppKit"
  4691. if test "$NS_IMPL_COCOA" = "yes"; then
  4692. libs_nsgui="$libs_nsgui -framework IOKit"
  4693. fi
  4694. else
  4695. libs_nsgui=
  4696. fi
  4697. LD_SWITCH_SYSTEM_TEMACS="-fno-pie -prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra"
  4698. ## This is here because src/Makefile.in did some extra fiddling around
  4699. ## with LD_SWITCH_SYSTEM. It seems cleaner to put this in
  4700. ## LD_SWITCH_SYSTEM_TEMACS instead,
  4701. test "x$LD_SWITCH_SYSTEM" = "x" && test "x$GCC" != "xyes" && \
  4702. LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
  4703. ;;
  4704. ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
  4705. ## find X at run-time.
  4706. ## When handled by cpp, this was in LD_SWITCH_SYSTEM. However, at the
  4707. ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
  4708. ## had not yet been defined and was expanded to null. Hence LD_SWITCH_SYSTEM
  4709. ## had different values in configure (in ac_link) and src/Makefile.in.
  4710. ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
  4711. gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
  4712. mingw32)
  4713. ## Is it any better under MinGW64 to relocate emacs into higher addresses?
  4714. case "$canonical" in
  4715. x86_64-*-*) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x400000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
  4716. *) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000 -Wl,-heap,0x00100000 -Wl,-image-base,0x01000000 -Wl,-entry,__start -Wl,-Map,./temacs.map" ;;
  4717. esac
  4718. ;;
  4719. *) LD_SWITCH_SYSTEM_TEMACS= ;;
  4720. esac
  4721. # -no-pie or -nopie fixes a temacs segfault on Gentoo, OpenBSD,
  4722. # Ubuntu, and other systems with "hardened" GCC configurations for
  4723. # some reason (Bug#18784). We don't know why this works, but not
  4724. # segfaulting is better than segfaulting. Use ac_c_werror_flag=yes
  4725. # when trying the option, otherwise clang keeps warning that it does
  4726. # not understand it, and pre-4.6 GCC has a similar problem
  4727. # (Bug#20338). Prefer -no-pie to -nopie, as -no-pie is the
  4728. # spelling used by GCC 6.1.0 and later (Bug#24682).
  4729. AC_CACHE_CHECK(
  4730. [for $CC option to disable position independent executables],
  4731. [emacs_cv_prog_cc_no_pie],
  4732. [emacs_save_c_werror_flag=$ac_c_werror_flag
  4733. emacs_save_LDFLAGS=$LDFLAGS
  4734. ac_c_werror_flag=yes
  4735. for emacs_cv_prog_cc_no_pie in -no-pie -nopie no; do
  4736. test $emacs_cv_prog_cc_no_pie = no && break
  4737. LDFLAGS="$emacs_save_LDFLAGS $emacs_cv_prog_cc_no_pie"
  4738. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [break])
  4739. done
  4740. ac_c_werror_flag=$emacs_save_c_werror_flag
  4741. LDFLAGS=$emacs_save_LDFLAGS])
  4742. if test "$emacs_cv_prog_cc_no_pie" != no; then
  4743. LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS $emacs_cv_prog_cc_no_pie"
  4744. fi
  4745. if test x$ac_enable_profiling != x ; then
  4746. case $opsys in
  4747. *freebsd | gnu-linux) ;;
  4748. *) LD_SWITCH_SYSTEM_TEMACS="$LD_SWITCH_SYSTEM_TEMACS -pg" ;;
  4749. esac
  4750. fi
  4751. LD_SWITCH_SYSTEM_TEMACS="$LDFLAGS_NOCOMBRELOC $LD_SWITCH_SYSTEM_TEMACS"
  4752. AC_SUBST(LD_SWITCH_SYSTEM_TEMACS)
  4753. ## Common for all window systems
  4754. if test "$window_system" != "none"; then
  4755. AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.])
  4756. AC_DEFINE(POLL_FOR_INPUT, 1, [Define if you poll periodically to detect C-g.])
  4757. WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o"
  4758. fi
  4759. AC_SUBST(WINDOW_SYSTEM_OBJ)
  4760. AH_TOP([/* GNU Emacs site configuration template file.
  4761. Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2017
  4762. Free Software Foundation, Inc.
  4763. This file is part of GNU Emacs.
  4764. GNU Emacs is free software: you can redistribute it and/or modify
  4765. it under the terms of the GNU General Public License as published by
  4766. the Free Software Foundation, either version 3 of the License, or (at
  4767. your option) any later version.
  4768. GNU Emacs is distributed in the hope that it will be useful,
  4769. but WITHOUT ANY WARRANTY; without even the implied warranty of
  4770. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  4771. GNU General Public License for more details.
  4772. You should have received a copy of the GNU General Public License
  4773. along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
  4774. /* No code in Emacs #includes config.h twice, but some bits of code
  4775. intended to work with other packages as well (like gmalloc.c)
  4776. think they can include it as many times as they like. */
  4777. #ifndef EMACS_CONFIG_H
  4778. #define EMACS_CONFIG_H
  4779. ])dnl
  4780. AH_BOTTOM([#include <conf_post.h>
  4781. #endif /* EMACS_CONFIG_H */
  4782. /*
  4783. Local Variables:
  4784. mode: c
  4785. End:
  4786. */
  4787. ])dnl
  4788. #### Report on what we decided to do.
  4789. #### Report GTK as a toolkit, even if it doesn't use Xt.
  4790. #### It makes printing result more understandable as using GTK sets
  4791. #### toolkit_scroll_bars to yes by default.
  4792. if test "${HAVE_GTK}" = "yes"; then
  4793. USE_X_TOOLKIT="$USE_GTK_TOOLKIT"
  4794. fi
  4795. if test $USE_ACL -ne 0; then
  4796. ACL_SUMMARY="yes $LIB_ACL"
  4797. else
  4798. ACL_SUMMARY=no
  4799. fi
  4800. emacs_standard_dirs='Standard dirs'
  4801. AS_ECHO(["
  4802. Configured for '${canonical}'.
  4803. Where should the build process find the source code? ${srcdir}
  4804. What compiler should emacs be built with? ${CC} ${CFLAGS}
  4805. Should Emacs use the GNU version of malloc? ${GNU_MALLOC}${GNU_MALLOC_reason}
  4806. Should Emacs use a relocating allocator for buffers? ${REL_ALLOC}
  4807. Should Emacs use mmap(2) for buffer allocation? $use_mmap_for_buffers
  4808. What window system should Emacs use? ${window_system}
  4809. What toolkit should Emacs use? ${USE_X_TOOLKIT}
  4810. Where do we find X Windows header files? ${x_includes:-$emacs_standard_dirs}
  4811. Where do we find X Windows libraries? ${x_libraries:-$emacs_standard_dirs}"])
  4812. optsep=
  4813. emacs_config_features=
  4814. for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS \
  4815. GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT \
  4816. LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS X_TOOLKIT OLDXMENU X11 NS MODULES \
  4817. XWIDGETS LIBSYSTEMD CANNOT_DUMP; do
  4818. case $opt in
  4819. CANNOT_DUMP) eval val=\${$opt} ;;
  4820. NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;;
  4821. TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;;
  4822. *) eval val=\${HAVE_$opt} ;;
  4823. esac
  4824. case x$val in
  4825. xno|xnone|x) continue ;;
  4826. esac
  4827. case $opt in
  4828. X_TOOLKIT)
  4829. case $val in
  4830. GTK*|LUCID|MOTIF) opt=$val ;;
  4831. *) continue ;;
  4832. esac
  4833. ;;
  4834. esac
  4835. AS_VAR_APPEND([emacs_config_features], ["$optsep$opt"])
  4836. optsep=' '
  4837. done
  4838. AC_DEFINE_UNQUOTED(EMACS_CONFIG_FEATURES, "${emacs_config_features}",
  4839. [Summary of some of the main features enabled by configure.])
  4840. AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D}
  4841. Does Emacs use -lXpm? ${HAVE_XPM}
  4842. Does Emacs use -ljpeg? ${HAVE_JPEG}
  4843. Does Emacs use -ltiff? ${HAVE_TIFF}
  4844. Does Emacs use a gif library? ${HAVE_GIF} $LIBGIF
  4845. Does Emacs use a png library? ${HAVE_PNG} $LIBPNG
  4846. Does Emacs use -lrsvg-2? ${HAVE_RSVG}
  4847. Does Emacs use cairo? ${HAVE_CAIRO}
  4848. Does Emacs use imagemagick (version 6)? ${HAVE_IMAGEMAGICK}
  4849. Does Emacs support sound? ${HAVE_SOUND}
  4850. Does Emacs use -lgpm? ${HAVE_GPM}
  4851. Does Emacs use -ldbus? ${HAVE_DBUS}
  4852. Does Emacs use -lgconf? ${HAVE_GCONF}
  4853. Does Emacs use GSettings? ${HAVE_GSETTINGS}
  4854. Does Emacs use a file notification library? ${NOTIFY_SUMMARY}
  4855. Does Emacs use access control lists? ${ACL_SUMMARY}
  4856. Does Emacs use -lselinux? ${HAVE_LIBSELINUX}
  4857. Does Emacs use -lgnutls? ${HAVE_GNUTLS}
  4858. Does Emacs use -lxml2? ${HAVE_LIBXML2}
  4859. Does Emacs use -lfreetype? ${HAVE_FREETYPE}
  4860. Does Emacs use -lm17n-flt? ${HAVE_M17N_FLT}
  4861. Does Emacs use -lotf? ${HAVE_LIBOTF}
  4862. Does Emacs use -lxft? ${HAVE_XFT}
  4863. Does Emacs use -lsystemd? ${HAVE_LIBSYSTEMD}
  4864. Does Emacs directly use zlib? ${HAVE_ZLIB}
  4865. Does Emacs have dynamic modules support? ${HAVE_MODULES}
  4866. Does Emacs use toolkit scroll bars? ${USE_TOOLKIT_SCROLL_BARS}
  4867. Does Emacs support Xwidgets (requires gtk3)? ${HAVE_XWIDGETS}
  4868. Does Emacs have threading support in lisp? ${threads_enabled}
  4869. "])
  4870. if test -n "${EMACSDATA}"; then
  4871. AS_ECHO([" Environment variable EMACSDATA set to: $EMACSDATA"])
  4872. fi
  4873. if test -n "${EMACSDOC}"; then
  4874. AS_ECHO([" Environment variable EMACSDOC set to: $EMACSDOC"])
  4875. fi
  4876. echo
  4877. if test "$HAVE_NS" = "yes"; then
  4878. echo
  4879. AS_ECHO(["You must run \"${MAKE-make} install\" in order to test the built application.
  4880. The installed application will go to nextstep/Emacs.app and can be
  4881. run or moved from there."])
  4882. if test "$EN_NS_SELF_CONTAINED" = "yes"; then
  4883. echo "The application will be fully self-contained."
  4884. else
  4885. AS_ECHO(["The lisp resources for the application will be installed under ${prefix}.
  4886. You may need to run \"${MAKE-make} install\" with sudo. The application will fail
  4887. to run if these resources are not installed."])
  4888. fi
  4889. echo
  4890. fi
  4891. case $opsys,$emacs_uname_r in
  4892. cygwin,1.5.*)
  4893. AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
  4894. echo
  4895. ;;
  4896. esac
  4897. # Remove any trailing slashes in these variables.
  4898. case $prefix in
  4899. */) prefix=`AS_DIRNAME(["$prefix."])`;;
  4900. esac
  4901. case $exec_prefix in
  4902. */) exec_prefix=`AS_DIRNAME(["$exec_prefix."])`;;
  4903. esac
  4904. if test "$HAVE_NS" = "yes"; then
  4905. if test "$NS_IMPL_GNUSTEP" = yes; then
  4906. AC_CONFIG_FILES([nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist:nextstep/templates/Info-gnustep.plist.in \
  4907. nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop:nextstep/templates/Emacs.desktop.in])
  4908. ns_check_file=Resources/Info-gnustep.plist
  4909. else
  4910. AC_CONFIG_FILES([nextstep/Cocoa/Emacs.base/Contents/Info.plist:nextstep/templates/Info.plist.in \
  4911. nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:nextstep/templates/InfoPlist.strings.in])
  4912. ns_check_file=Contents/Info.plist
  4913. fi
  4914. AC_SUBST(ns_check_file)
  4915. fi
  4916. AC_CONFIG_FILES([Makefile lib/gnulib.mk])
  4917. dnl config.status treats $srcdir specially, so I think this is ok...
  4918. AC_CONFIG_FILES([$srcdir/doc/man/emacs.1])
  4919. m4_define([subdir_makefiles],
  4920. [lib/Makefile lib-src/Makefile oldXMenu/Makefile doc/emacs/Makefile doc/misc/Makefile doc/lispintro/Makefile doc/lispref/Makefile src/Makefile lwlib/Makefile lisp/Makefile leim/Makefile nextstep/Makefile nt/Makefile])
  4921. SUBDIR_MAKEFILES="subdir_makefiles"
  4922. AC_CONFIG_FILES(subdir_makefiles)
  4923. dnl test/ is not present in release tarfiles.
  4924. opt_makefile=test/Makefile
  4925. if test -f "$srcdir/$opt_makefile.in"; then
  4926. SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
  4927. dnl Again, it's best not to use a variable. Though you can add
  4928. dnl ", [], [opt_makefile='$opt_makefile']" and it should work.
  4929. AC_CONFIG_FILES([test/Makefile])
  4930. fi
  4931. dnl The admin/ directory used to be excluded from tarfiles.
  4932. if test -d $srcdir/admin; then
  4933. SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES admin/charsets/Makefile admin/unidata/Makefile admin/grammars/Makefile"
  4934. AC_CONFIG_FILES([admin/charsets/Makefile])
  4935. AC_CONFIG_FILES([admin/unidata/Makefile])
  4936. AC_CONFIG_FILES([admin/grammars/Makefile])
  4937. fi dnl -d admin
  4938. SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
  4939. AC_SUBST(SUBDIR_MAKEFILES_IN)
  4940. dnl You might wonder (I did) why epaths.h is generated by running make,
  4941. dnl rather than just letting configure generate it from epaths.in.
  4942. dnl One reason is that the various paths are not fully expanded (see above);
  4943. dnl e.g., gamedir='${localstatedir}/games/emacs'.
  4944. dnl Secondly, the GNU Coding standards require that one should be able
  4945. dnl to run 'make prefix=/some/where/else' and override the values set
  4946. dnl by configure. This also explains the 'move-if-change' test and
  4947. dnl the use of force in the 'epaths-force' rule in Makefile.in.
  4948. AC_CONFIG_COMMANDS([src/epaths.h], [
  4949. if test "${opsys}" = "mingw32"; then
  4950. ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force-w32
  4951. else
  4952. ${MAKE-make} MAKEFILE_NAME=do-not-make-Makefile epaths-force
  4953. fi || AC_MSG_ERROR(['src/epaths.h' could not be made.])
  4954. ], [GCC="$GCC" CPPFLAGS="$CPPFLAGS" opsys="$opsys"])
  4955. dnl NB we have to cheat and use the ac_... version because abs_top_srcdir
  4956. dnl is not yet set, sigh. Or we could use ../$srcdir/src/.gdbinit,
  4957. dnl or a symlink?
  4958. AC_CONFIG_COMMANDS([src/.gdbinit], [
  4959. if test ! -f src/.gdbinit && test -f "$srcdir/src/.gdbinit"; then
  4960. AS_ECHO(["source $ac_abs_top_srcdir/src/.gdbinit"]) > src/.gdbinit
  4961. fi
  4962. ])
  4963. dnl Perhaps this would be better named doc-emacs-emacsver.texi?
  4964. dnl See comments for etc-refcards-emacsver.tex.
  4965. dnl Since we get a doc/emacs directory generated anyway, for the Makefile,
  4966. dnl it is not quite the same. But we are generating in $srcdir.
  4967. AC_CONFIG_COMMANDS([doc/emacs/emacsver.texi], [
  4968. ${MAKE-make} -s --no-print-directory -C doc/emacs doc-emacsver || \
  4969. AC_MSG_ERROR(['doc/emacs/emacsver.texi' could not be made.])
  4970. ])
  4971. dnl If we give this the more natural name, etc/refcards/emacsver.texi,
  4972. dnl then a directory etc/refcards is created in the build directory,
  4973. dnl which is probably harmless, but confusing (in out-of-tree builds).
  4974. dnl (If we were to generate etc/refcards/Makefile, this might change.)
  4975. dnl It is really $srcdir/etc/refcards/emacsver.tex that we generate.
  4976. AC_CONFIG_COMMANDS([etc-refcards-emacsver.tex], [
  4977. ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile etc-emacsver || \
  4978. AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.])
  4979. ])
  4980. if test $AUTO_DEPEND = yes; then
  4981. for dir in $AUTODEPEND_PARENTS; do
  4982. AS_MKDIR_P([$dir/deps])
  4983. done
  4984. fi
  4985. AC_OUTPUT
  4986. if test ! "$with_mailutils"; then
  4987. if test "$with_pop" = yes; then
  4988. AC_MSG_WARN([This configuration installs a 'movemail' program
  4989. that retrieves POP3 email via only insecure channels.
  4990. To omit insecure POP3, you can use '$0 --without-pop'.])
  4991. fi
  4992. case $opsys in
  4993. mingw32)
  4994. # Don't suggest GNU Mailutils, as it hasn't been ported.
  4995. ;;
  4996. *)
  4997. emacs_fix_movemail="use '$0 --with-mailutils'"
  4998. case `(movemail --version) 2>/dev/null` in
  4999. *Mailutils*) ;;
  5000. *) emacs_fix_movemail="install GNU Mailutils
  5001. <http://mailutils.org> and $emacs_fix_movemail";;
  5002. esac
  5003. AC_MSG_NOTICE([You might want to $emacs_fix_movemail.]);;
  5004. esac
  5005. fi
  5006. test "$MAKE" = make || AC_MSG_NOTICE([Now you can run '$MAKE'.])