configure.ac 175 KB

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