old-configure.in 176 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370
  1. dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*-
  2. dnl vi: set tabstop=4 shiftwidth=4 expandtab syntax=m4:
  3. dnl This Source Code Form is subject to the terms of the Mozilla Public
  4. dnl License, v. 2.0. If a copy of the MPL was not distributed with this
  5. dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
  6. dnl Process this file with autoconf to produce a configure script.
  7. dnl ========================================================
  8. AC_PREREQ(2.13)
  9. AC_INIT(config/config.mk)
  10. AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
  11. AC_CANONICAL_SYSTEM
  12. dnl ========================================================
  13. dnl =
  14. dnl = Don't change the following two lines. Doing so breaks:
  15. dnl =
  16. dnl = CFLAGS="-foo" ./configure
  17. dnl =
  18. dnl ========================================================
  19. CFLAGS="${CFLAGS=}"
  20. CPPFLAGS="${CPPFLAGS=}"
  21. CXXFLAGS="${CXXFLAGS=}"
  22. LDFLAGS="${LDFLAGS=}"
  23. HOST_CFLAGS="${HOST_CFLAGS=}"
  24. HOST_CXXFLAGS="${HOST_CXXFLAGS=}"
  25. HOST_LDFLAGS="${HOST_LDFLAGS=}"
  26. dnl ========================================================
  27. dnl = Preserve certain environment flags passed to configure
  28. dnl = We want sub projects to receive the same flags
  29. dnl = untainted by this configure script
  30. dnl ========================================================
  31. _SUBDIR_CC="$CC"
  32. _SUBDIR_CXX="$CXX"
  33. _SUBDIR_CFLAGS="$CFLAGS"
  34. _SUBDIR_CPPFLAGS="$CPPFLAGS"
  35. _SUBDIR_CXXFLAGS="$CXXFLAGS"
  36. _SUBDIR_LDFLAGS="$LDFLAGS"
  37. _SUBDIR_HOST_CC="$HOST_CC"
  38. _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
  39. _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
  40. _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
  41. _SUBDIR_CONFIG_ARGS="$ac_configure_args"
  42. dnl Set the version number of the libs included with mozilla
  43. dnl ========================================================
  44. MOZJPEG=62
  45. MOZPNG=10625
  46. NSPR_VERSION=4
  47. NSPR_MINVER=4.20
  48. NSS_VERSION=3
  49. dnl Set the minimum version of toolkit libs used by mozilla
  50. dnl ========================================================
  51. GLIB_VERSION=2.22
  52. # 2_26 is the earliest version we can set GLIB_VERSION_MIN_REQUIRED.
  53. # The macro won't be used when compiling with earlier versions anyway.
  54. GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26
  55. GIO_VERSION=2.22
  56. CAIRO_VERSION=1.10
  57. GTK2_VERSION=2.18.0
  58. GTK3_VERSION=3.4.0
  59. GDK_VERSION_MAX_ALLOWED=GDK_VERSION_3_4
  60. WINDRES_VERSION=2.14.90
  61. W32API_VERSION=3.14
  62. GNOMEUI_VERSION=2.2.0
  63. GCONF_VERSION=1.2.1
  64. STARTUP_NOTIFICATION_VERSION=0.8
  65. DBUS_VERSION=0.60
  66. SQLITE_VERSION=3.36.0
  67. dnl Set various checks
  68. dnl ========================================================
  69. MISSING_X=
  70. dnl Initialize the Pthread test variables early so they can be
  71. dnl overridden by each platform.
  72. dnl ========================================================
  73. MOZ_USE_PTHREADS=
  74. _PTHREAD_LDFLAGS=""
  75. dnl Do not allow objdir == srcdir builds.
  76. dnl ==============================================================
  77. _topsrcdir=`cd \`dirname $0\`; pwd -W 2>/dev/null || pwd -P`
  78. _objdir=`pwd -P`
  79. MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd -P`
  80. DIST="$MOZ_BUILD_ROOT/dist"
  81. MOZ_DEFAULT_COMPILER
  82. case "$target" in
  83. *-linux*)
  84. AC_PATH_PROG(OBJCOPY,objcopy)
  85. ;;
  86. esac
  87. AC_SUBST(ANDROID_SOURCE)
  88. AC_SUBST(ANDROID_PACKAGE_NAME)
  89. AC_SUBST(OBJCOPY)
  90. dnl ========================================================
  91. dnl Checks for compilers.
  92. dnl ========================================================
  93. dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
  94. AR_FLAGS='crs $@'
  95. if test "$COMPILE_ENVIRONMENT"; then
  96. if test "$target" != "$host"; then
  97. MOZ_CROSS_COMPILER
  98. else
  99. AC_PROG_CC
  100. case "$target" in
  101. *-mingw*)
  102. # Work around the conftest.exe access problem on Windows
  103. sleep 2
  104. esac
  105. AC_PROG_CXX
  106. AC_PROG_RANLIB
  107. MOZ_PATH_PROGS(AS, $AS as, $CC)
  108. AC_CHECK_PROGS(AR, ar, :)
  109. AC_CHECK_PROGS(LD, ld, :)
  110. AC_CHECK_PROGS(STRIP, strip, :)
  111. AC_CHECK_PROGS(WINDRES, windres, :)
  112. AC_CHECK_PROGS(OTOOL, otool, :)
  113. if test -z "$HOST_RANLIB"; then
  114. HOST_RANLIB="$RANLIB"
  115. fi
  116. if test -z "$HOST_AR"; then
  117. HOST_AR="$AR"
  118. fi
  119. if test -z "$HOST_AR_FLAGS"; then
  120. HOST_AR_FLAGS="$AR_FLAGS"
  121. fi
  122. fi
  123. if test -n "$MOZ_WINCONSOLE"; then
  124. AC_DEFINE(MOZ_WINCONSOLE)
  125. fi
  126. MOZ_TOOL_VARIABLES
  127. dnl ========================================================
  128. dnl Special win32 checks
  129. dnl ========================================================
  130. WINVER=601
  131. case "$target" in
  132. *-mingw*)
  133. if test "$GCC" != "yes"; then
  134. # Check to see if we are really running in a msvc environemnt
  135. _WIN32_MSVC=1
  136. AC_CHECK_PROGS(MIDL, midl)
  137. # Make sure compilers are valid
  138. CFLAGS="$CFLAGS -TC -nologo"
  139. CXXFLAGS="$CXXFLAGS -TP -nologo"
  140. AC_LANG_SAVE
  141. AC_LANG_C
  142. AC_TRY_COMPILE([#include <stdio.h>],
  143. [ printf("Hello World\n"); ],,
  144. AC_MSG_ERROR([\$(CC) test failed. You must have MS VC++ in your path to build.]) )
  145. AC_LANG_CPLUSPLUS
  146. AC_TRY_COMPILE([#include <new.h>],
  147. [ unsigned *test = new unsigned(42); ],,
  148. AC_MSG_ERROR([\$(CXX) test failed. You must have MS VC++ in your path to build.]) )
  149. AC_LANG_RESTORE
  150. changequote(,)
  151. _MSVC_VER_FILTER='s|.*[^!-~]([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
  152. changequote([,])
  153. _MSC_VER=`echo ${CC_VERSION} | cut -c 1-2,4-5`
  154. AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
  155. AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
  156. AC_DEFINE(_USE_MATH_DEFINES) # Otherwise MSVC's math.h doesn't #define M_PI.
  157. case "$CC_VERSION" in
  158. 19*)
  159. _CC_SUITE=14
  160. MSVS_VERSION=2015
  161. MSVC_C_RUNTIME_DLL=vcruntime140.dll
  162. MSVC_CXX_RUNTIME_DLL=msvcp140.dll
  163. MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
  164. if test -n "$MSVC_HAS_DIA_SDK"; then
  165. AC_DEFINE(MSVC_HAS_DIA_SDK)
  166. fi
  167. # C5026: move constructor was implicitly defined as deleted
  168. CXXFLAGS="$CXXFLAGS -wd5026"
  169. # C5027: move assignment operator was implicitly defined as deleted
  170. CXXFLAGS="$CXXFLAGS -wd5027"
  171. # -Zc:sizedDealloc- disables C++14 global sized deallocation (see bug 1160146)
  172. CXXFLAGS="$CXXFLAGS -Zc:sizedDealloc-"
  173. # C4752: We explicitly use AVX instructions in only some libs, not global
  174. # This is a pointless "helpful warning" to use /arch:AVX which we don't want.
  175. CFLAGS="$CFLAGS -wd4752"
  176. CXXFLAGS="$CXXFLAGS -wd4752"
  177. # https://connect.microsoft.com/VisualStudio/feedback/details/888527/warnings-on-dbghelp-h
  178. # for dbghelp.h, imagehlp.h, and shobj.h
  179. # C4091: 'typedef ': ignored on left of '' when no variable is declared
  180. CFLAGS="$CFLAGS -wd4091"
  181. CXXFLAGS="$CXXFLAGS -wd4091"
  182. # This is intended as a temporary hack to support building with VS2015.
  183. # 'noexcept' used with no exception handling mode specified;
  184. # termination on exception is not guaranteed. Specify /EHsc
  185. CXXFLAGS="$CXXFLAGS -wd4577"
  186. if test -n "$WIN_UCRT_REDIST_DIR"; then
  187. if test ! -d "$WIN_UCRT_REDIST_DIR"; then
  188. AC_MSG_ERROR([Invalid Windows UCRT Redist directory: ${WIN_UCRT_REDIST_DIR}])
  189. fi
  190. WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
  191. fi
  192. ;;
  193. esac
  194. AC_SUBST(MSVS_VERSION)
  195. AC_SUBST(MSVC_HAS_DIA_SDK)
  196. AC_SUBST(MSVC_C_RUNTIME_DLL)
  197. AC_SUBST(MSVC_CXX_RUNTIME_DLL)
  198. AC_DEFINE(HAVE_SEH_EXCEPTIONS)
  199. if test -n "$WIN32_REDIST_DIR"; then
  200. if test ! -d "$WIN32_REDIST_DIR"; then
  201. AC_MSG_ERROR([Invalid Win32 Redist directory: ${WIN32_REDIST_DIR}])
  202. fi
  203. WIN32_REDIST_DIR=`cd "$WIN32_REDIST_DIR" && pwd -W`
  204. fi
  205. # Check linker version
  206. _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
  207. _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
  208. if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
  209. AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION, does not match the compiler suite version, $_CC_SUITE.])
  210. fi
  211. INCREMENTAL_LINKER=1
  212. # Set midl environment
  213. case "$target" in
  214. i*86-*)
  215. MIDL_FLAGS="${MIDL_FLAGS} -env win32"
  216. ;;
  217. x86_64-*)
  218. MIDL_FLAGS="${MIDL_FLAGS} -env x64"
  219. ;;
  220. esac
  221. unset _MSVC_VER_FILTER
  222. AC_CACHE_CHECK(for overridable _RAISE,
  223. ac_cv_have__RAISE,
  224. [
  225. AC_LANG_SAVE
  226. AC_LANG_CPLUSPLUS
  227. _SAVE_CXXFLAGS="$CXXFLAGS"
  228. CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
  229. AC_TRY_COMPILE([#include <xstddef>
  230. #undef _RAISE
  231. #define _RAISE(x) externallyDefinedFunction((x).what())
  232. #include <vector>
  233. ],
  234. [std::vector<int> v; return v.at(1);],
  235. ac_cv_have__RAISE="no",
  236. ac_cv_have__RAISE="yes")
  237. CXXFLAGS="$_SAVE_CXXFLAGS"
  238. AC_LANG_RESTORE
  239. ])
  240. if test "$ac_cv_have__RAISE" = "yes"; then
  241. WRAP_STL_INCLUDES=1
  242. MOZ_MSVC_STL_WRAP_RAISE=1
  243. AC_DEFINE(MOZ_MSVC_STL_WRAP_RAISE)
  244. else
  245. AC_MSG_ERROR([Gecko exception wrapping doesn't understand your your MSVC/SDK. Please file a bug describing this error and your build configuration.])
  246. fi
  247. if test "$WRAP_STL_INCLUDES" = "1"; then
  248. STL_FLAGS="-I${DIST}/stl_wrappers"
  249. fi
  250. CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
  251. CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
  252. else
  253. # Check w32api version
  254. _W32API_MAJOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $1 }'`
  255. _W32API_MINOR_VERSION=`echo $W32API_VERSION | $AWK -F\. '{ print $2 }'`
  256. AC_MSG_CHECKING([for w32api version >= $W32API_VERSION])
  257. AC_TRY_COMPILE([#include <w32api.h>],
  258. #if (__W32API_MAJOR_VERSION < $_W32API_MAJOR_VERSION) || \
  259. (__W32API_MAJOR_VERSION == $_W32API_MAJOR_VERSION && \
  260. __W32API_MINOR_VERSION < $_W32API_MINOR_VERSION)
  261. #error "test failed."
  262. #endif
  263. , [ res=yes ], [ res=no ])
  264. AC_MSG_RESULT([$res])
  265. if test "$res" != "yes"; then
  266. AC_MSG_ERROR([w32api version $W32API_VERSION or higher required.])
  267. fi
  268. # Check windres version
  269. AC_MSG_CHECKING([for windres version >= $WINDRES_VERSION])
  270. _WINDRES_VERSION=`${WINDRES} --version 2>&1 | grep -i windres 2>/dev/null | $AWK '{ print $3 }'`
  271. AC_MSG_RESULT([$_WINDRES_VERSION])
  272. _WINDRES_MAJOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
  273. _WINDRES_MINOR_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
  274. _WINDRES_RELEASE_VERSION=`echo $_WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
  275. WINDRES_MAJOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $1 }'`
  276. WINDRES_MINOR_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $2 }'`
  277. WINDRES_RELEASE_VERSION=`echo $WINDRES_VERSION | $AWK -F\. '{ print $3 }'`
  278. if test "$_WINDRES_MAJOR_VERSION" -lt "$WINDRES_MAJOR_VERSION" -o \
  279. "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
  280. "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
  281. "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
  282. "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
  283. "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
  284. then
  285. AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
  286. fi
  287. AC_CHECK_PROGS(MIDL, $target-widl widl)
  288. if test -n "$MIDL"; then
  289. case "$target" in
  290. i*86-*)
  291. MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
  292. ;;
  293. x86_64-*)
  294. MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
  295. ;;
  296. esac
  297. fi
  298. # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
  299. # causing problems with local implementations with the same name.
  300. AC_DEFINE(STRSAFE_NO_DEPRECATE)
  301. fi # !GNU_CC
  302. AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
  303. AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
  304. # Require OS features provided by IE 6.0 SP2 (XP SP2)
  305. AC_DEFINE_UNQUOTED(_WIN32_IE,0x0603)
  306. ;;
  307. esac
  308. if test -n "$_WIN32_MSVC"; then
  309. SKIP_PATH_CHECKS=1
  310. SKIP_COMPILER_CHECKS=1
  311. SKIP_LIBRARY_CHECKS=1
  312. # Since we're skipping compiler and library checks, hard-code
  313. # some facts here.
  314. AC_DEFINE(HAVE_IO_H)
  315. AC_DEFINE(HAVE_ISATTY)
  316. fi
  317. fi # COMPILE_ENVIRONMENT
  318. AC_SUBST(MIDL_FLAGS)
  319. AC_SUBST(_MSC_VER)
  320. AC_SUBST(GNU_AS)
  321. AC_SUBST(GNU_LD)
  322. AC_SUBST(GNU_CC)
  323. AC_SUBST(GNU_CXX)
  324. AC_SUBST(STL_FLAGS)
  325. AC_SUBST(WRAP_STL_INCLUDES)
  326. AC_SUBST(MOZ_MSVC_STL_WRAP_RAISE)
  327. dnl ========================================================
  328. dnl Checks for programs.
  329. dnl ========================================================
  330. if test "$COMPILE_ENVIRONMENT"; then
  331. dnl ========================================================
  332. dnl = Mac OS X toolchain support
  333. dnl ========================================================
  334. dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
  335. dnl that a universal binary is being produced.
  336. AC_SUBST(UNIVERSAL_BINARY)
  337. MOZ_ARG_WITH_STRING(unify-dist,
  338. [ --with-unify-dist=dir Location of the dist directory to unify with at packaging time (Mac OS X universal build only)],
  339. UNIFY_DIST=$withval)
  340. if test -n "$UNIVERSAL_BINARY"; then
  341. if test -z "$UNIFY_DIST"; then
  342. AC_MSG_ERROR([You need to provide the --with-unify-dist=dir argument when performing a universal build])
  343. fi
  344. case "$UNIFY_DIST" in
  345. /*)
  346. ;;
  347. *)
  348. UNIFY_DIST="${MOZ_BUILD_ROOT}/${UNIFY_DIST}"
  349. ;;
  350. esac
  351. fi
  352. AC_SUBST(UNIFY_DIST)
  353. dnl ========================================================
  354. dnl = Mac OS X SDK support
  355. dnl ========================================================
  356. MACOS_SDK_DIR=
  357. MOZ_ARG_WITH_STRING(macos-sdk,
  358. [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)],
  359. MACOS_SDK_DIR=$withval)
  360. MACOS_PRIVATE_FRAMEWORKS_DIR_DEFAULTED=
  361. MOZ_ARG_WITH_STRING(macos-private-frameworks,
  362. [ --with-macos-private-frameworks=dir Location of private frameworks to use (Mac OS X only)],
  363. MACOS_PRIVATE_FRAMEWORKS_DIR=$withval,
  364. MACOS_PRIVATE_FRAMEWORKS_DIR=/System/Library/PrivateFrameworks
  365. MACOS_PRIVATE_FRAMEWORKS_DEFAULTED=1)
  366. if test -z "${MACOS_PRIVATE_FRAMEWORKS_DEFAULTED}"; then
  367. if test -z "$CROSS_COMPILE"; then
  368. AC_MSG_WARN([You should only be using --with-macos-private-frameworks when cross-compiling.])
  369. fi
  370. if test ! -d "$MACOS_PRIVATE_FRAMEWORKS_DIR"; then
  371. AC_MSG_ERROR([PrivateFrameworks directory not found.])
  372. fi
  373. fi
  374. dnl MACOS_SDK_DIR will be set to the SDK location whenever one is in use.
  375. AC_SUBST(MACOS_SDK_DIR)
  376. AC_SUBST(MACOS_PRIVATE_FRAMEWORKS_DIR)
  377. if test "$MACOS_SDK_DIR"; then
  378. dnl Sync this section with the ones in NSPR and NSS.
  379. dnl Changes to the cross environment here need to be accounted for in
  380. dnl the libIDL checks (below) and xpidl build.
  381. if test ! -d "$MACOS_SDK_DIR"; then
  382. AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must
  383. specify a valid SDK. SDKs are installed when the optional cross-development
  384. tools are selected during the Xcode/Developer Tools installation.])
  385. fi
  386. CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}"
  387. CXXFLAGS="$CXXFLAGS -isysroot ${MACOS_SDK_DIR}"
  388. dnl CPP/CXXCPP needs to be set for MOZ_CHECK_HEADER.
  389. CPP="$CPP -isysroot ${MACOS_SDK_DIR}"
  390. CXXCPP="$CXXCPP -isysroot ${MACOS_SDK_DIR}"
  391. AC_LANG_SAVE
  392. AC_MSG_CHECKING([for valid compiler/Mac OS X SDK combination])
  393. AC_LANG_CPLUSPLUS
  394. AC_TRY_COMPILE([#include <new>],[],
  395. result=yes,
  396. result=no)
  397. AC_LANG_RESTORE
  398. AC_MSG_RESULT($result)
  399. if test "$result" = "no" ; then
  400. AC_MSG_ERROR([The selected compiler and Mac OS X SDK are incompatible.])
  401. fi
  402. fi
  403. AC_PATH_XTRA
  404. XCFLAGS="$X_CFLAGS"
  405. fi # COMPILE_ENVIRONMENT
  406. dnl ========================================================
  407. dnl set the defaults first
  408. dnl ========================================================
  409. AS_BIN=$AS
  410. AR_EXTRACT='$(AR) x'
  411. AS='$(CC)'
  412. AS_DASH_C_FLAG='-c'
  413. DLL_PREFIX=lib
  414. LIB_PREFIX=lib
  415. DLL_SUFFIX=.so
  416. OBJ_SUFFIX=o
  417. LIB_SUFFIX=a
  418. IMPORT_LIB_SUFFIX=
  419. DIRENT_INO=d_ino
  420. MOZ_USER_DIR=".mozilla"
  421. MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
  422. MOZ_FS_LAYOUT=unix
  423. dnl Configure platform-specific CPU architecture compiler options.
  424. dnl ==============================================================
  425. if test "$COMPILE_ENVIRONMENT"; then
  426. MOZ_ARCH_OPTS
  427. else
  428. if test "$OS_TARGET" = "Android"; then
  429. dnl Default Android builds to ARMv7.
  430. MOZ_ARCH=armv7-a
  431. fi
  432. fi # COMPILE_ENVIRONMENT
  433. dnl ========================================================
  434. dnl Suppress Clang Argument Warnings
  435. dnl ========================================================
  436. if test -n "${CLANG_CC}${CLANG_CL}"; then
  437. _WARNINGS_CFLAGS="-Qunused-arguments ${_WARNINGS_CFLAGS}"
  438. CPPFLAGS="-Qunused-arguments ${CPPFLAGS}"
  439. fi
  440. if test -n "${CLANG_CXX}${CLANG_CL}"; then
  441. _WARNINGS_CXXFLAGS="-Qunused-arguments ${_WARNINGS_CXXFLAGS}"
  442. fi
  443. if test -n "$COMPILE_ENVIRONMENT"; then
  444. MOZ_CONFIG_SANITIZE
  445. fi
  446. dnl ========================================================
  447. dnl GNU specific defaults
  448. dnl ========================================================
  449. if test "$GNU_CC"; then
  450. MMX_FLAGS="-mmmx"
  451. SSE_FLAGS="-msse"
  452. SSE2_FLAGS="-msse2"
  453. SSSE3_FLAGS="-mssse3"
  454. # FIXME: Let us build with strict aliasing. bug 414641.
  455. CFLAGS="$CFLAGS -fno-strict-aliasing"
  456. MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
  457. MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-h,$(DSO_SONAME) -o $@'
  458. WARNINGS_AS_ERRORS='-Werror'
  459. DSO_CFLAGS=''
  460. DSO_PIC_CFLAGS='-fPIC'
  461. ASFLAGS="$ASFLAGS -fPIC"
  462. AC_MSG_CHECKING([for --noexecstack option to as])
  463. _SAVE_CFLAGS=$CFLAGS
  464. CFLAGS="$CFLAGS -Wa,--noexecstack"
  465. AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
  466. [ASFLAGS="$ASFLAGS -Wa,--noexecstack"],
  467. AC_MSG_RESULT([no]))
  468. CFLAGS=$_SAVE_CFLAGS
  469. AC_MSG_CHECKING([for -z noexecstack option to ld])
  470. _SAVE_LDFLAGS=$LDFLAGS
  471. LDFLAGS="$LDFLAGS -Wl,-z,noexecstack"
  472. AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
  473. AC_MSG_RESULT([no])
  474. LDFLAGS=$_SAVE_LDFLAGS)
  475. AC_MSG_CHECKING([for -z text option to ld])
  476. _SAVE_LDFLAGS=$LDFLAGS
  477. LDFLAGS="$LDFLAGS -Wl,-z,text"
  478. AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  479. [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,text"],
  480. AC_MSG_RESULT([no])
  481. LDFLAGS=$_SAVE_LDFLAGS)
  482. AC_MSG_CHECKING([for --build-id option to ld])
  483. _SAVE_LDFLAGS=$LDFLAGS
  484. LDFLAGS="$LDFLAGS -Wl,--build-id"
  485. AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  486. [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,--build-id"],
  487. AC_MSG_RESULT([no])
  488. LDFLAGS=$_SAVE_LDFLAGS)
  489. AC_MSG_CHECKING([for --ignore-unresolved-symbol option to ld])
  490. HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=
  491. _SAVE_LDFLAGS=$LDFLAGS
  492. LDFLAGS="$LDFLAGS -Wl,--ignore-unresolved-symbol,environ"
  493. AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  494. [HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED=1],
  495. AC_MSG_RESULT([no]))
  496. LDFLAGS=$_SAVE_LDFLAGS
  497. # Check for -mssse3 on $CC
  498. AC_MSG_CHECKING([if toolchain supports -mssse3 option])
  499. HAVE_TOOLCHAIN_SUPPORT_MSSSE3=
  500. _SAVE_CFLAGS=$CFLAGS
  501. CFLAGS="$CFLAGS -mssse3"
  502. AC_TRY_COMPILE([asm ("pmaddubsw %xmm2,%xmm3");],,AC_MSG_RESULT([yes])
  503. [HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1],
  504. AC_MSG_RESULT([no]))
  505. CFLAGS=$_SAVE_CFLAGS
  506. # Check for -msse4.1 on $CC
  507. AC_MSG_CHECKING([if toolchain supports -msse4.1 option])
  508. HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=
  509. _SAVE_CFLAGS=$CFLAGS
  510. CFLAGS="$CFLAGS -msse4.1"
  511. AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes])
  512. [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1],
  513. AC_MSG_RESULT([no]))
  514. CFLAGS=$_SAVE_CFLAGS
  515. case "${CPU_ARCH}" in
  516. x86 | x86_64)
  517. AC_MSG_CHECKING(for x86 AVX2 asm support in compiler)
  518. AC_TRY_COMPILE([],
  519. [asm volatile ("vpermq \$0xd8,%ymm0,%ymm0 \n");],
  520. result="yes", result="no")
  521. AC_MSG_RESULT("$result")
  522. if test "$result" = "yes"; then
  523. HAVE_X86_AVX2=1
  524. fi
  525. ;;
  526. ppc*)
  527. AC_MSG_CHECKING([whether we can enable AltiVec support])
  528. HAVE_ALTIVEC=
  529. _SAVE_CFLAGS=$CFLAGS
  530. CFLAGS="$CFLAGS -maltivec"
  531. AC_TRY_COMPILE(,,AC_MSG_RESULT([yes])
  532. [HAVE_ALTIVEC=1],
  533. AC_MSG_RESULT([no]))
  534. CFLAGS=$_SAVE_CFLAGS
  535. ;;
  536. esac
  537. DSO_LDOPTS='-shared'
  538. if test "$GCC_USE_GNU_LD"; then
  539. # Some tools like ASan use a runtime library that is only
  540. # linked against executables, so we must allow undefined
  541. # symbols for shared objects in some cases.
  542. if test -z "$MOZ_NO_WLZDEFS"; then
  543. # Don't allow undefined symbols in libraries
  544. DSO_LDOPTS="$DSO_LDOPTS -Wl,-z,defs"
  545. # BSDs need `environ' exposed for posix_spawn (bug 753046)
  546. case "$OS_TARGET" in
  547. DragonFly|FreeBSD|NetBSD|OpenBSD)
  548. if test -n "$HAVE_LINKER_SUPPORT_IGNORE_UNRESOLVED"; then
  549. DSO_LDOPTS="$DSO_LDOPTS -Wl,--ignore-unresolved-symbol,environ"
  550. else
  551. DSO_LDOPTS="$DSO_LDOPTS -Wl,--warn-unresolved-symbols"
  552. fi
  553. ;;
  554. esac
  555. fi
  556. fi
  557. _DEFINES_CFLAGS='-include $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
  558. _USE_CPP_INCLUDE_FLAG=1
  559. ASFLAGS="$ASFLAGS $_DEFINES_CFLAGS"
  560. else
  561. MKSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
  562. MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
  563. DSO_LDOPTS='-shared'
  564. if test "$GNU_LD"; then
  565. # Don't allow undefined symbols in libraries
  566. DSO_LDOPTS="$DSO_LDOPTS -z defs"
  567. fi
  568. DSO_CFLAGS=''
  569. DSO_PIC_CFLAGS='-KPIC'
  570. _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  571. fi
  572. if test "$GNU_CXX"; then
  573. # FIXME: Let us build with strict aliasing. bug 414641.
  574. CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-strict-aliasing"
  575. _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -include $(topobjdir)/mozilla-config.h'
  576. _USE_CPP_INCLUDE_FLAG=1
  577. else
  578. _DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
  579. fi
  580. dnl ========================================================
  581. dnl = Use Valgrind
  582. dnl ========================================================
  583. MOZ_ARG_ENABLE_BOOL(valgrind,
  584. [ --enable-valgrind Enable Valgrind integration hooks (default=no)],
  585. MOZ_VALGRIND=1,
  586. MOZ_VALGRIND= )
  587. if test -n "$MOZ_VALGRIND"; then
  588. MOZ_CHECK_HEADER([valgrind/valgrind.h], [],
  589. AC_MSG_ERROR(
  590. [--enable-valgrind specified but Valgrind is not installed]))
  591. AC_DEFINE(MOZ_VALGRIND)
  592. fi
  593. AC_SUBST(MOZ_VALGRIND)
  594. # For profiling builds keep the symbol information
  595. if test "$MOZ_PROFILING" -a -z "$STRIP_FLAGS"; then
  596. case "$OS_TARGET" in
  597. Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
  598. STRIP_FLAGS="--strip-debug"
  599. ;;
  600. esac
  601. fi
  602. dnl ========================================================
  603. dnl System overrides of the defaults for host
  604. dnl ========================================================
  605. case "$host" in
  606. *mingw*)
  607. if test -n "$_WIN32_MSVC"; then
  608. HOST_AR=lib
  609. HOST_AR_FLAGS='-NOLOGO -OUT:$@'
  610. HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
  611. HOST_RANLIB='echo ranlib'
  612. else
  613. HOST_CFLAGS="$HOST_CFLAGS -mwindows"
  614. fi
  615. HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
  616. HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  617. HOST_BIN_SUFFIX=.exe
  618. case "${host_cpu}" in
  619. i*86)
  620. if test -n "$_WIN32_MSVC"; then
  621. HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X86"
  622. fi
  623. ;;
  624. x86_64)
  625. if test -n "$_WIN32_MSVC"; then
  626. HOST_LDFLAGS="$HOST_LDFLAGS -MACHINE:X64"
  627. fi
  628. HOST_CFLAGS="$HOST_CFLAGS -D_AMD64_"
  629. ;;
  630. esac
  631. ;;
  632. *-linux*|*-kfreebsd*-gnu|*-gnu*)
  633. HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  634. HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
  635. ;;
  636. *)
  637. HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
  638. HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
  639. ;;
  640. esac
  641. dnl ==============================================================
  642. dnl Get mozilla version from central milestone file
  643. dnl ==============================================================
  644. MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
  645. MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
  646. MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
  647. if test -z "$MOZILLA_VERSION"; then
  648. AC_MSG_ERROR([failed to read version info from milestone file])
  649. fi
  650. AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
  651. AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)
  652. AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION,"$MOZILLA_UAVERSION")
  653. AC_DEFINE_UNQUOTED(MOZILLA_UAVERSION_U,$MOZILLA_UAVERSION)
  654. AC_SUBST(MOZILLA_SYMBOLVERSION)
  655. AC_SUBST(MOZILLA_UAVERSION)
  656. AC_SUBST(MOZILLA_UAVERSION_U)
  657. MOZ_DOING_LTO(lto_is_enabled)
  658. dnl ========================================================
  659. dnl System overrides of the defaults for target
  660. dnl ========================================================
  661. case "$target" in
  662. *-*linux*)
  663. if test "$GNU_CC" -o "$GNU_CXX"; then
  664. MOZ_PGO_OPTIMIZE_FLAGS="-O3"
  665. MOZ_OPTIMIZE_FLAGS="-O2"
  666. if test -z "$CLANG_CC"; then
  667. MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
  668. fi
  669. fi
  670. case "${target_cpu}" in
  671. alpha*)
  672. CFLAGS="$CFLAGS -mieee"
  673. CXXFLAGS="$CXXFLAGS -mieee"
  674. ;;
  675. esac
  676. ;;
  677. *-mingw*)
  678. DSO_CFLAGS=
  679. DSO_PIC_CFLAGS=
  680. DLL_SUFFIX=.dll
  681. RC=rc.exe
  682. # certain versions of cygwin's makedepend barf on the
  683. # #include <string> vs -I./dist/include/string issue so don't use it
  684. if test -n "$GNU_CC" -o -n "$CLANG_CC"; then
  685. CC="$CC -mwindows"
  686. CXX="$CXX -mwindows"
  687. CPP="$CPP -mwindows"
  688. CFLAGS="$CFLAGS -mms-bitfields"
  689. CXXFLAGS="$CXXFLAGS -mms-bitfields"
  690. DSO_LDOPTS='-shared'
  691. MKSHLIB='$(CXX) $(DSO_LDOPTS) -o $@'
  692. MKCSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
  693. RC='$(WINDRES)'
  694. # Use static libgcc and libstdc++
  695. LDFLAGS="$LDFLAGS -static"
  696. NSPR_LDFLAGS="$NSPR_LDFLAGS -static-libgcc"
  697. # Use temp file for windres (bug 213281)
  698. RCFLAGS='-O coff --use-temp-file'
  699. # mingw doesn't require kernel32, user32, and advapi32 explicitly
  700. LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32"
  701. MOZ_FIX_LINK_PATHS=
  702. DLL_PREFIX=
  703. IMPORT_LIB_SUFFIX=a
  704. WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
  705. WIN32_GUI_EXE_LDFLAGS=-mwindows
  706. # GCC/binutils can't link to a function if we try to include dllexport function
  707. # in the same library as dllimport caller. To work around it, we build NSPR
  708. # and NSS with -mnop-fun-dllimport flag. The drawback of this solution is that
  709. # function thunks need to be generated for cross-DLL calls.
  710. MOZ_FOLD_LIBS_FLAGS=-mnop-fun-dllimport
  711. else
  712. TARGET_COMPILER_ABI=msvc
  713. HOST_LD='$(LD)'
  714. if test "$AS_BIN"; then
  715. AS="$(basename "$AS_BIN")"
  716. fi
  717. AR='lib'
  718. AR_FLAGS='-NOLOGO -OUT:$@'
  719. AR_EXTRACT=
  720. RANLIB='echo not_ranlib'
  721. STRIP='echo not_strip'
  722. PKG_SKIP_STRIP=1
  723. OBJ_SUFFIX=obj
  724. LIB_SUFFIX=lib
  725. DLL_PREFIX=
  726. LIB_PREFIX=
  727. IMPORT_LIB_SUFFIX=lib
  728. MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  729. MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
  730. WIN32_SUBSYSTEM_VERSION=6.01
  731. WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
  732. WIN32_GUI_EXE_LDFLAGS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
  733. DSO_LDOPTS=-SUBSYSTEM:WINDOWS,$WIN32_SUBSYSTEM_VERSION
  734. _USE_CPP_INCLUDE_FLAG=1
  735. _DEFINES_CFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
  736. _DEFINES_CXXFLAGS='-FI $(topobjdir)/mozilla-config.h -DMOZILLA_CLIENT'
  737. CFLAGS="$CFLAGS -W3 -Gy -Zc:inline"
  738. CXXFLAGS="$CXXFLAGS -W3 -Gy -Zc:inline"
  739. if test -z "$CLANG_CL"; then
  740. CFLAGS="$CFLAGS -utf-8"
  741. CXXFLAGS="$CXXFLAGS -utf-8"
  742. fi
  743. if test "$CPU_ARCH" = "x86"; then
  744. changequote(,)
  745. dnl VS2012+ defaults to -arch:SSE2. We want to target nothing
  746. dnl more recent, so no need to set it explicitly in the default
  747. dnl case.
  748. changequote([,])
  749. SSE_FLAGS="-arch:SSE"
  750. SSE2_FLAGS="-arch:SSE2"
  751. dnl MSVC allows the use of intrinsics without any flags
  752. dnl and doesn't have a separate arch for SSSE3
  753. SSSE3_FLAGS="-arch:SSE2"
  754. fi
  755. dnl clang-cl requires appropriate flags to enable SSSE3 support
  756. dnl on all architectures.
  757. if test -n "$CLANG_CL"; then
  758. SSSE3_FLAGS="-mssse3"
  759. fi
  760. dnl VS2013+ requires -FS when parallel building by make -jN.
  761. dnl If nothing, compiler sometimes causes C1041 error.
  762. CFLAGS="$CFLAGS -FS"
  763. CXXFLAGS="$CXXFLAGS -FS"
  764. dnl VS2013+ supports -Gw for better linker optimizations.
  765. dnl http://blogs.msdn.com/b/vcblog/archive/2013/09/11/introducing-gw-compiler-switch.aspx
  766. dnl Disabled on ASan because it causes false-positive ODR violations.
  767. if test -z "$MOZ_ASAN"; then
  768. CFLAGS="$CFLAGS -Gw"
  769. CXXFLAGS="$CXXFLAGS -Gw"
  770. fi
  771. # khuey says we can safely ignore MSVC warning C4251
  772. # MSVC warning C4244 (implicit type conversion may lose data) warns
  773. # and requires workarounds for perfectly valid code. Also, GCC/clang
  774. # don't warn about it by default. So for consistency/sanity, we turn
  775. # it off on MSVC, too.
  776. # MSVC warning C4267 warns for narrowing type conversions from size_t
  777. # to 32-bit integer types on 64-bit platforms. Since this is virtually
  778. # the same thing as C4244, we disable C4267, too.
  779. # MSVC warning C4345 warns of newly conformant behavior as of VS2003.
  780. # MSVC warning C4351 warns of newly conformant behavior as of VS2005.
  781. # MSVC warning C4800 warns when a value is implicitly cast to bool,
  782. # because this also forces narrowing to a single byte, which can be a
  783. # perf hit. But this matters so little in practice (and often we want
  784. # that behavior) that it's better to turn it off.
  785. # MSVC warning wd4595 warns non-member operator new or delete functions
  786. # may not be declared inline, as of VS2015 Update 2.
  787. CFLAGS="$CFLAGS -wd4244 -wd4267"
  788. CXXFLAGS="$CXXFLAGS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4800 -wd4595"
  789. if test -n "$CLANG_CL"; then
  790. # XXX We should combine some of these with our generic GCC-style
  791. # warning checks.
  792. #
  793. # Suppress the clang-cl warning for the inline 'new' and 'delete' in mozalloc
  794. CXXFLAGS="$CXXFLAGS -Wno-inline-new-delete"
  795. # We use offsetof on non-POD objects all the time.
  796. # We also suppress this warning on other platforms.
  797. CXXFLAGS="$CXXFLAGS -Wno-invalid-offsetof"
  798. # MFBT thinks clang-cl supports constexpr, which it does, but
  799. # not everything in Windows C++ headers supports constexpr
  800. # as we might expect until MSVC 2015, so turn off this warning
  801. # for now.
  802. CXXFLAGS="$CXXFLAGS -Wno-invalid-constexpr"
  803. # This warns for reasonable things like:
  804. # enum { X = 0xffffffffU };
  805. # which is annoying for IDL headers.
  806. CXXFLAGS="$CXXFLAGS -Wno-microsoft-enum-value"
  807. # This warns for cases that would be reached by the Microsoft
  808. # #include rules, but also currently warns on cases that would
  809. # *also* be reached by standard C++ include rules. That
  810. # behavior doesn't seem useful, so we turn it off.
  811. CXXFLAGS="$CXXFLAGS -Wno-microsoft-include"
  812. # We normally error out on unknown pragmas, but since clang-cl
  813. # claims to be MSVC, it would be difficult to add
  814. # #if defined(_MSC_VER) && !defined(__clang__) everywhere we
  815. # use such pragmas, so just ignore them.
  816. CFLAGS="$CFLAGS -Wno-unknown-pragmas"
  817. CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas"
  818. # We get errors about various #pragma intrinsic directives from
  819. # clang-cl, and we don't need to hear about those.
  820. CFLAGS="$CFLAGS -Wno-ignored-pragmas"
  821. CXXFLAGS="$CXXFLAGS -Wno-ignored-pragmas"
  822. # clang-cl's Intrin.h marks things like _ReadWriteBarrier
  823. # as __attribute((__deprecated__)). This is nice to know,
  824. # but since we don't get the equivalent warning from MSVC,
  825. # let's just ignore it.
  826. CFLAGS="$CFLAGS -Wno-deprecated-declarations"
  827. CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"
  828. # We use a function like:
  829. # __declspec(noreturn) __inline void f() {}
  830. # which -Winvalid-noreturn complains about. Again, MSVC seems
  831. # OK with it, so let's silence the warning.
  832. CFLAGS="$CFLAGS -Wno-invalid-noreturn"
  833. CXXFLAGS="$CXXFLAGS -Wno-invalid-noreturn"
  834. # Missing |override| on virtual function declarations isn't
  835. # something that MSVC currently warns about.
  836. CXXFLAGS="$CXXFLAGS -Wno-inconsistent-missing-override"
  837. # We use -DHAS_EXCEPTIONS=0, which removes the |throw()|
  838. # declaration on |operator delete(void*)|. However, clang-cl
  839. # must internally declare |operator delete(void*)| differently,
  840. # which causes this warning for virtually every file in the
  841. # tree. clang-cl doesn't support -fno-exceptions or equivalent,
  842. # so there doesn't seem to be any way to convince clang-cl to
  843. # declare |delete| differently. Therefore, suppress this
  844. # warning.
  845. CXXFLAGS="$CXXFLAGS -Wno-implicit-exception-spec-mismatch"
  846. # At least one MSVC header and several headers in-tree have
  847. # unused typedefs, so turn this on.
  848. CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"
  849. # Several JS engine header files use __declspec(dllimport) on
  850. # classes, and clang-cl helpfully warns about its non-support
  851. # for such cases. We're not particularly worried about that,
  852. # so ignore that warning.
  853. CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"
  854. fi
  855. # make 'foo == bar;' error out
  856. CFLAGS="$CFLAGS -we4553"
  857. CXXFLAGS="$CXXFLAGS -we4553"
  858. LIBS="$LIBS kernel32.lib user32.lib gdi32.lib winmm.lib wsock32.lib advapi32.lib secur32.lib"
  859. MOZ_DEBUG_LDFLAGS='-DEBUG -DEBUGTYPE:CV'
  860. WARNINGS_AS_ERRORS='-WX'
  861. MOZ_OPTIMIZE_FLAGS='-O1 -Oi'
  862. MOZ_FIX_LINK_PATHS=
  863. num_cores=$($PYTHON -c 'import multiprocessing; print(min(8,multiprocessing.cpu_count()))')
  864. cgthreads="-CGTHREADS:${num_cores}"
  865. LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT -DYNAMICBASE -OPT:REF -OPT:ICF=${num_cores} $cgthreads"
  866. if test -z "$DEVELOPER_OPTIONS"; then
  867. LDFLAGS="$LDFLAGS -RELEASE"
  868. fi
  869. dnl For profile-guided optimization
  870. PROFILE_GEN_CFLAGS="-GL"
  871. PROFILE_GEN_LDFLAGS="-LTCG:PGINSTRUMENT"
  872. dnl XXX: PGO builds can fail with warnings treated as errors,
  873. dnl specifically "no profile data available" appears to be
  874. dnl treated as an error sometimes. This might be a consequence
  875. dnl of using WARNINGS_AS_ERRORS in some modules, combined
  876. dnl with the linker doing most of the work in the whole-program
  877. dnl optimization/PGO case. I think it's probably a compiler bug,
  878. dnl but we work around it here.
  879. PROFILE_USE_CFLAGS="-GL -wd4624 -wd4952"
  880. dnl XXX: should be -LTCG:PGOPTIMIZE, but that fails on libxul.
  881. dnl Probably also a compiler bug, but what can you do?
  882. PROFILE_USE_LDFLAGS="-LTCG:PGUPDATE"
  883. RCFLAGS="-nologo"
  884. dnl Minimum required VS version supports SSSE3, SSE4.1 and AVX2.
  885. HAVE_TOOLCHAIN_SUPPORT_MSSSE3=1
  886. HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1
  887. HAVE_X86_AVX2=1
  888. fi
  889. AC_DEFINE(WIN32_LEAN_AND_MEAN)
  890. dnl See http://support.microsoft.com/kb/143208 to use STL
  891. AC_DEFINE(NOMINMAX)
  892. BIN_SUFFIX='.exe'
  893. MOZ_USER_DIR="Mozilla"
  894. case "$host_os" in
  895. cygwin*|msvc*|mks*)
  896. AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
  897. ;;
  898. esac
  899. case "$target" in
  900. i*86-*)
  901. if test -n "$GNU_CC"; then
  902. CFLAGS="$CFLAGS -mstackrealign -fno-keep-inline-dllexport"
  903. CXXFLAGS="$CXXFLAGS -mstackrealign -fno-keep-inline-dllexport"
  904. LDFLAGS="$LDFLAGS -Wl,--enable-stdcall-fixup -Wl,--large-address-aware"
  905. else
  906. DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X86"
  907. LDFLAGS="$LDFLAGS -SAFESEH"
  908. fi
  909. AC_DEFINE(_X86_)
  910. ;;
  911. x86_64-*)
  912. if test -n "$_WIN32_MSVC"; then
  913. DSO_LDOPTS="$DSO_LDOPTS -MACHINE:X64"
  914. fi
  915. AC_DEFINE(_AMD64_)
  916. ;;
  917. *)
  918. AC_DEFINE(_CPU_ARCH_NOT_DEFINED)
  919. ;;
  920. esac
  921. ;;
  922. *-netbsd*)
  923. DSO_CFLAGS=''
  924. CFLAGS="$CFLAGS -Dunix"
  925. CXXFLAGS="$CXXFLAGS -Dunix"
  926. if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
  927. DLL_SUFFIX=".so"
  928. DSO_PIC_CFLAGS='-fPIC -DPIC'
  929. DSO_LDOPTS='-shared'
  930. BIN_FLAGS='-Wl,--export-dynamic'
  931. else
  932. DSO_PIC_CFLAGS='-fPIC -DPIC'
  933. DLL_SUFFIX=".so.1.0"
  934. DSO_LDOPTS='-shared'
  935. fi
  936. # This will fail on a.out systems prior to 1.5.1_ALPHA.
  937. if test "$LIBRUNPATH"; then
  938. DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
  939. fi
  940. MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
  941. MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -Wl,-soname,$(DSO_SONAME) -o $@'
  942. ;;
  943. *-openbsd*)
  944. if test "$SO_VERSION"; then
  945. DLL_SUFFIX=".so.$SO_VERSION"
  946. else
  947. DLL_SUFFIX=".so.1.0"
  948. fi
  949. if test -z "$X11BASE"; then
  950. X11BASE=/usr/X11R6
  951. fi
  952. MOZ_FIX_LINK_PATHS="$MOZ_FIX_LINK_PATHS -Wl,-rpath-link,${X11BASE}/lib"
  953. DSO_CFLAGS=''
  954. DSO_PIC_CFLAGS='-fPIC'
  955. DSO_LDOPTS='-shared -fPIC'
  956. if test "$LIBRUNPATH"; then
  957. DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
  958. fi
  959. ;;
  960. i*86-*-solaris*)
  961. MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib"
  962. ;;
  963. x86_64-*-solaris*)
  964. MOZ_FIX_LINK_PATHS="-L${DIST}/bin -R'\$\$ORIGIN':/usr/gcc/7/lib/amd64"
  965. ;;
  966. esac
  967. AC_SUBST_LIST(MMX_FLAGS)
  968. AC_SUBST_LIST(SSE_FLAGS)
  969. AC_SUBST_LIST(SSE2_FLAGS)
  970. AC_SUBST_LIST(SSSE3_FLAGS)
  971. AC_SUBST(MOZ_LINKER)
  972. if test -n "$MOZ_LINKER"; then
  973. AC_DEFINE(MOZ_LINKER)
  974. MOZ_LINKER_EXTRACT=1
  975. AC_CHECK_PROGS(XZ, xz)
  976. fi
  977. dnl Only one oddball right now (QNX), but this gives us flexibility
  978. dnl if any other platforms need to override this in the future.
  979. AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
  980. dnl ========================================================
  981. dnl = Flags to strip unused symbols from .so components and
  982. dnl = to export jemalloc symbols when linking a program
  983. dnl ========================================================
  984. case "$target" in
  985. *-linux*|*-kfreebsd*-gnu|*-gnu*)
  986. MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  987. ;;
  988. *-mingw*)
  989. if test -n "$GNU_CC"; then
  990. MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
  991. fi
  992. ;;
  993. esac
  994. if test -z "$COMPILE_ENVIRONMENT"; then
  995. SKIP_COMPILER_CHECKS=1
  996. SKIP_LIBRARY_CHECKS=1
  997. PKG_SKIP_STRIP=1
  998. MOZ_DEBUGGING_OPTS
  999. else
  1000. MOZ_COMPILER_OPTS
  1001. fi # COMPILE_ENVIRONMENT
  1002. if test -z "$SKIP_COMPILER_CHECKS"; then
  1003. dnl Checks for typedefs, structures, and compiler characteristics.
  1004. dnl ========================================================
  1005. AC_C_CONST
  1006. AC_TYPE_MODE_T
  1007. AC_TYPE_OFF_T
  1008. AC_TYPE_PID_T
  1009. AC_TYPE_SIZE_T
  1010. AC_LANG_CPLUSPLUS
  1011. AC_LANG_C
  1012. AC_LANG_CPLUSPLUS
  1013. MOZ_CXX11
  1014. AC_LANG_C
  1015. case "${OS_TARGET}" in
  1016. *)
  1017. STL_FLAGS="-I${DIST}/stl_wrappers"
  1018. WRAP_STL_INCLUDES=1
  1019. ;;
  1020. esac
  1021. dnl Checks for header files.
  1022. dnl ========================================================
  1023. AC_HEADER_DIRENT
  1024. case "$target_os" in
  1025. bitrig*|dragonfly*|freebsd*|openbsd*)
  1026. # for stuff like -lXshm
  1027. CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"
  1028. ;;
  1029. esac
  1030. dnl Check for sin_len and sin6_len - used by SCTP; only appears in Mac/*BSD generally
  1031. AC_CACHE_CHECK(for sockaddr_in.sin_len,
  1032. ac_cv_sockaddr_in_sin_len,
  1033. [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  1034. #include <sys/types.h>
  1035. #endif
  1036. #include <netinet/in.h>
  1037. struct sockaddr_in x;
  1038. void *foo = (void*) &x.sin_len;],
  1039. [],
  1040. [ac_cv_sockaddr_in_sin_len=true],
  1041. [ac_cv_sockaddr_in_sin_len=false])])
  1042. if test "$ac_cv_sockaddr_in_sin_len" = true ; then
  1043. AC_DEFINE(HAVE_SIN_LEN)
  1044. dnl HAVE_CONN_LEN must be the same as HAVE_SIN_LEN (and HAVE_SIN6_LEN too)
  1045. AC_DEFINE(HAVE_SCONN_LEN)
  1046. fi
  1047. AC_CACHE_CHECK(for sockaddr_in6.sin6_len,
  1048. ac_cv_sockaddr_in6_sin6_len,
  1049. [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  1050. #include <sys/types.h>
  1051. #endif
  1052. #include <netinet/in.h>
  1053. struct sockaddr_in6 x;
  1054. void *foo = (void*) &x.sin6_len;],
  1055. [],
  1056. [ac_cv_sockaddr_in6_sin6_len=true],
  1057. [ac_cv_sockaddr_in6_sin6_len=false])])
  1058. if test "$ac_cv_sockaddr_in6_sin6_len" = true ; then
  1059. AC_DEFINE(HAVE_SIN6_LEN)
  1060. fi
  1061. AC_CACHE_CHECK(for sockaddr.sa_len,
  1062. ac_cv_sockaddr_sa_len,
  1063. [AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
  1064. #include <sys/types.h>
  1065. #endif
  1066. #include <sys/socket.h>
  1067. struct sockaddr x;
  1068. void *foo = (void*) &x.sa_len;],
  1069. [],
  1070. [ac_cv_sockaddr_sa_len=true],
  1071. [ac_cv_sockaddr_sa_len=false])])
  1072. if test "$ac_cv_sockaddr_sa_len" = true ; then
  1073. AC_DEFINE(HAVE_SA_LEN)
  1074. fi
  1075. MOZ_ARG_ENABLE_BOOL(dtrace,
  1076. [ --enable-dtrace build with dtrace support if available (default=no)],
  1077. [enable_dtrace="yes"],)
  1078. if test "x$enable_dtrace" = "xyes"; then
  1079. MOZ_CHECK_HEADER(sys/sdt.h, HAVE_DTRACE=1)
  1080. if test -n "$HAVE_DTRACE"; then
  1081. AC_DEFINE(INCLUDE_MOZILLA_DTRACE)
  1082. else
  1083. AC_MSG_ERROR([dtrace enabled but sys/sdt.h not found]);
  1084. fi
  1085. fi
  1086. AC_SUBST(HAVE_DTRACE)
  1087. dnl Checks for libraries.
  1088. dnl ========================================================
  1089. AC_CHECK_LIB(c_r, gethostbyname_r)
  1090. case $target in
  1091. *)
  1092. AC_SEARCH_LIBS(dlopen, dl,
  1093. MOZ_CHECK_HEADER(dlfcn.h,
  1094. AC_DEFINE(HAVE_DLOPEN)))
  1095. ;;
  1096. esac
  1097. _SAVE_CFLAGS="$CFLAGS"
  1098. CFLAGS="$CFLAGS -D_GNU_SOURCE"
  1099. AC_CHECK_FUNCS(dladdr memmem)
  1100. CFLAGS="$_SAVE_CFLAGS"
  1101. if test ! "$GNU_CXX"; then
  1102. AC_CHECK_LIB(C, demangle)
  1103. fi
  1104. AC_CHECK_LIB(socket, socket)
  1105. XLDFLAGS="$X_LIBS"
  1106. XLIBS="$X_EXTRA_LIBS"
  1107. dnl ========================================================
  1108. dnl Checks for X libraries.
  1109. dnl Ordering is important.
  1110. dnl Xt is dependent upon SM as of X11R6
  1111. dnl ========================================================
  1112. if test -n "$MOZ_X11"; then
  1113. AC_DEFINE_UNQUOTED(FUNCPROTO,15)
  1114. _SAVE_LDFLAGS="$LDFLAGS"
  1115. _SAVE_LIBS="$LIBS"
  1116. LDFLAGS="$XLDFLAGS $LDFLAGS"
  1117. AC_CHECK_LIB(X11, XDrawLines, [XLIBS="-lX11 $XLIBS"],
  1118. [MISSING_X="$MISSING_X -lX11"], $XLIBS)
  1119. AC_CHECK_LIB(Xext, XextAddDisplay, [XEXT_LIBS="-lXext"],
  1120. [MISSING_X="$MISSING_X -lXext"], $XLIBS)
  1121. AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt"], [
  1122. unset ac_cv_lib_Xt_XtFree
  1123. AC_CHECK_LIB(ICE, IceFlush, [XT_LIBS="-lICE $XT_LIBS"],, $XT_LIBS $XLIBS)
  1124. AC_CHECK_LIB(SM, SmcCloseConnection, [XT_LIBS="-lSM $XT_LIBS"],, $XT_LIBS $XLIBS)
  1125. AC_CHECK_LIB(Xt, XtFree, [ XT_LIBS="-lXt $XT_LIBS"],
  1126. [MISSING_X="$MISSING_X -lXt"], $X_PRE_LIBS $XT_LIBS $XLIBS)
  1127. ])
  1128. dnl ========================================================
  1129. dnl = Check for xcb
  1130. dnl ========================================================
  1131. AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
  1132. [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
  1133. AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
  1134. [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
  1135. AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
  1136. [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
  1137. dnl ========================================================
  1138. dnl = Check for Xss
  1139. dnl ========================================================
  1140. MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1141. AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
  1142. [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
  1143. AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
  1144. LDFLAGS="$_SAVE_LDFLAGS"
  1145. LIBS="$_SAVE_LIBS"
  1146. fi # $MOZ_X11
  1147. AC_SUBST_LIST(XCFLAGS)
  1148. AC_SUBST_LIST(XLDFLAGS)
  1149. AC_SUBST_LIST(XLIBS)
  1150. AC_SUBST_LIST(XEXT_LIBS)
  1151. AC_SUBST_LIST(XT_LIBS)
  1152. AC_SUBST_LIST(XSS_LIBS)
  1153. dnl ========================================================
  1154. dnl = pthread support
  1155. dnl ========================================================
  1156. AC_CHECK_LIB(pthreads, pthread_create,
  1157. MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthreads",
  1158. AC_CHECK_LIB(pthread, pthread_create,
  1159. MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread",
  1160. AC_CHECK_LIB(c_r, pthread_create,
  1161. MOZ_USE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r",
  1162. AC_CHECK_LIB(c, pthread_create,
  1163. MOZ_USE_PTHREADS=1
  1164. )
  1165. )
  1166. )
  1167. )
  1168. dnl ========================================================
  1169. dnl Check the command line for --with-pthreads
  1170. dnl ========================================================
  1171. MOZ_ARG_WITH_BOOL(pthreads,
  1172. [ --with-pthreads Force use of system pthread library with NSPR ],
  1173. [ if test "$MOZ_USE_PTHREADS"x = x; then
  1174. AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
  1175. fi],
  1176. MOZ_USE_PTHREADS=
  1177. _PTHREAD_LDFLAGS=
  1178. )
  1179. dnl ========================================================
  1180. dnl Do the platform specific pthread hackery
  1181. dnl ========================================================
  1182. if test "$MOZ_USE_PTHREADS"x != x
  1183. then
  1184. dnl
  1185. dnl See if -pthread is supported.
  1186. dnl
  1187. rm -f conftest*
  1188. ac_cv_have_dash_pthread=no
  1189. AC_MSG_CHECKING(whether ${CC-cc} accepts -pthread)
  1190. echo 'int main() { return 0; }' | cat > conftest.c
  1191. ${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
  1192. if test $? -eq 0; then
  1193. if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthread`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  1194. ac_cv_have_dash_pthread=yes
  1195. case "$target_os" in
  1196. freebsd*)
  1197. # Freebsd doesn't use -pthread for compiles, it uses them for linking
  1198. ;;
  1199. *)
  1200. CFLAGS="$CFLAGS -pthread"
  1201. CXXFLAGS="$CXXFLAGS -pthread"
  1202. ;;
  1203. esac
  1204. fi
  1205. fi
  1206. rm -f conftest*
  1207. AC_MSG_RESULT($ac_cv_have_dash_pthread)
  1208. dnl
  1209. dnl See if -pthreads is supported.
  1210. dnl
  1211. ac_cv_have_dash_pthreads=no
  1212. if test "$ac_cv_have_dash_pthread" = "no"; then
  1213. AC_MSG_CHECKING(whether ${CC-cc} accepts -pthreads)
  1214. echo 'int main() { return 0; }' | cat > conftest.c
  1215. ${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
  1216. if test $? -eq 0; then
  1217. if test -z "`egrep -i '(unrecognize|unknown)' conftest.out | grep pthreads`" -a -z "`egrep -i '(error|incorrect)' conftest.out`" ; then
  1218. ac_cv_have_dash_pthreads=yes
  1219. CFLAGS="$CFLAGS -pthreads"
  1220. CXXFLAGS="$CXXFLAGS -pthreads"
  1221. fi
  1222. fi
  1223. rm -f conftest*
  1224. AC_MSG_RESULT($ac_cv_have_dash_pthreads)
  1225. fi
  1226. case "$target" in
  1227. *-*-freebsd*)
  1228. AC_DEFINE(_REENTRANT)
  1229. AC_DEFINE(_THREAD_SAFE)
  1230. dnl -pthread links in -lpthread, so don't specify it explicitly.
  1231. if test "$ac_cv_have_dash_pthread" = "yes"; then
  1232. _PTHREAD_LDFLAGS="-pthread"
  1233. fi
  1234. ;;
  1235. *-*-openbsd*|*-*-bsdi*)
  1236. AC_DEFINE(_REENTRANT)
  1237. AC_DEFINE(_THREAD_SAFE)
  1238. dnl -pthread links in -lc_r, so don't specify it explicitly.
  1239. if test "$ac_cv_have_dash_pthread" = "yes"; then
  1240. _PTHREAD_LDFLAGS="-pthread"
  1241. fi
  1242. ;;
  1243. *-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
  1244. AC_DEFINE(_REENTRANT)
  1245. ;;
  1246. esac
  1247. LDFLAGS="${_PTHREAD_LDFLAGS} ${LDFLAGS}"
  1248. AC_SUBST(MOZ_USE_PTHREADS)
  1249. MOZ_CHECK_HEADERS(pthread.h)
  1250. fi
  1251. dnl Checks for library functions.
  1252. dnl ========================================================
  1253. AC_PROG_GCC_TRADITIONAL
  1254. AC_FUNC_MEMCMP
  1255. AC_CHECK_FUNCS(stat64 lstat64 truncate64 statvfs64 statvfs statfs64 statfs getpagesize gmtime_r localtime_r arc4random arc4random_buf mallinfo gettid lchown setpriority strerror syscall)
  1256. dnl check for clock_gettime(), the CLOCK_MONOTONIC clock
  1257. AC_CACHE_CHECK(for clock_gettime(CLOCK_MONOTONIC),
  1258. ac_cv_clock_monotonic,
  1259. [for libs in "" -lrt; do
  1260. _SAVE_LIBS="$LIBS"
  1261. LIBS="$LIBS $libs"
  1262. AC_TRY_LINK([#include <time.h>],
  1263. [ struct timespec ts;
  1264. clock_gettime(CLOCK_MONOTONIC, &ts); ],
  1265. ac_cv_clock_monotonic=$libs
  1266. LIBS="$_SAVE_LIBS"
  1267. break,
  1268. ac_cv_clock_monotonic=no)
  1269. LIBS="$_SAVE_LIBS"
  1270. done])
  1271. if test "$ac_cv_clock_monotonic" != "no"; then
  1272. HAVE_CLOCK_MONOTONIC=1
  1273. REALTIME_LIBS=$ac_cv_clock_monotonic
  1274. AC_DEFINE(HAVE_CLOCK_MONOTONIC)
  1275. AC_SUBST(HAVE_CLOCK_MONOTONIC)
  1276. AC_SUBST_LIST(REALTIME_LIBS)
  1277. fi
  1278. AC_CACHE_CHECK(for pthread_cond_timedwait_monotonic_np,
  1279. ac_cv_pthread_cond_timedwait_monotonic_np,
  1280. AC_TRY_LINK([#include <pthread.h>],
  1281. [pthread_cond_timedwait_monotonic_np(0, 0, 0);],
  1282. ac_cv_pthread_cond_timewait_monotonic_np=yes,
  1283. ac_cv_pthread_cond_timewait_monotonic_np=no))
  1284. if test "$ac_cv_pthread_cond_timewait_monotonic_np" != "no"; then
  1285. AC_DEFINE(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
  1286. fi
  1287. dnl check for wcrtomb/mbrtowc
  1288. dnl =======================================================================
  1289. if test -z "$MACOS_DEPLOYMENT_TARGET" || test "$MACOS_DEPLOYMENT_TARGET" -ge "100300"; then
  1290. AC_LANG_SAVE
  1291. AC_LANG_CPLUSPLUS
  1292. AC_CACHE_CHECK(for wcrtomb,
  1293. ac_cv_have_wcrtomb,
  1294. [AC_TRY_LINK([#include <wchar.h>],
  1295. [mbstate_t ps={0};wcrtomb(0,'f',&ps);],
  1296. ac_cv_have_wcrtomb="yes",
  1297. ac_cv_have_wcrtomb="no")])
  1298. if test "$ac_cv_have_wcrtomb" = "yes"; then
  1299. AC_DEFINE(HAVE_WCRTOMB)
  1300. fi
  1301. AC_CACHE_CHECK(for mbrtowc,
  1302. ac_cv_have_mbrtowc,
  1303. [AC_TRY_LINK([#include <wchar.h>],
  1304. [mbstate_t ps={0};mbrtowc(0,0,0,&ps);],
  1305. ac_cv_have_mbrtowc="yes",
  1306. ac_cv_have_mbrtowc="no")])
  1307. if test "$ac_cv_have_mbrtowc" = "yes"; then
  1308. AC_DEFINE(HAVE_MBRTOWC)
  1309. fi
  1310. AC_LANG_RESTORE
  1311. fi
  1312. AC_CACHE_CHECK(
  1313. [for res_ninit()],
  1314. ac_cv_func_res_ninit,
  1315. [if test "$OS_TARGET" = NetBSD -o "$OS_TARGET" = OpenBSD; then
  1316. dnl no need for res_ninit() on NetBSD and OpenBSD
  1317. ac_cv_func_res_ninit=no
  1318. else
  1319. AC_TRY_LINK([
  1320. #ifdef linux
  1321. #define _BSD_SOURCE 1
  1322. #endif
  1323. #include <sys/types.h>
  1324. #include <netinet/in.h>
  1325. #include <arpa/nameser.h>
  1326. #include <resolv.h>
  1327. ],
  1328. [int foo = res_ninit(&_res);],
  1329. [ac_cv_func_res_ninit=yes],
  1330. [ac_cv_func_res_ninit=no])
  1331. fi
  1332. ])
  1333. if test "$ac_cv_func_res_ninit" = "yes"; then
  1334. AC_DEFINE(HAVE_RES_NINIT)
  1335. dnl must add the link line we do something as foolish as this... dougt
  1336. dnl else
  1337. dnl AC_CHECK_LIB(bind, res_ninit, AC_DEFINE(HAVE_RES_NINIT),
  1338. dnl AC_CHECK_LIB(resolv, res_ninit, AC_DEFINE(HAVE_RES_NINIT)))
  1339. fi
  1340. AC_LANG_CPLUSPLUS
  1341. ICONV_LIBS=
  1342. AC_CHECK_LIB(c, iconv, [ICONV_LIBS=],
  1343. AC_CHECK_LIB(iconv, iconv, [ICONV_LIBS="-liconv"],
  1344. AC_CHECK_LIB(iconv, libiconv, [ICONV_LIBS="-liconv"])))
  1345. _SAVE_LIBS=$LIBS
  1346. LIBS="$LIBS $ICONV_LIBS"
  1347. AC_CACHE_CHECK(
  1348. [for iconv()],
  1349. ac_cv_func_iconv,
  1350. [AC_TRY_LINK([
  1351. #include <stdlib.h>
  1352. #include <iconv.h>
  1353. ],
  1354. [
  1355. iconv_t h = iconv_open("", "");
  1356. iconv(h, NULL, NULL, NULL, NULL);
  1357. iconv_close(h);
  1358. ],
  1359. [ac_cv_func_iconv=yes],
  1360. [ac_cv_func_iconv=no]
  1361. )]
  1362. )
  1363. if test "$ac_cv_func_iconv" = "yes"; then
  1364. AC_DEFINE(HAVE_ICONV)
  1365. LIBICONV="$ICONV_LIBS"
  1366. AC_CACHE_CHECK(
  1367. [for iconv() with const input],
  1368. ac_cv_func_const_iconv,
  1369. [AC_TRY_COMPILE([
  1370. #include <stdlib.h>
  1371. #include <iconv.h>
  1372. ],
  1373. [
  1374. const char *input = "testing";
  1375. iconv_t h = iconv_open("", "");
  1376. iconv(h, &input, NULL, NULL, NULL);
  1377. iconv_close(h);
  1378. ],
  1379. [ac_cv_func_const_iconv=yes],
  1380. [ac_cv_func_const_iconv=no]
  1381. )]
  1382. )
  1383. if test "$ac_cv_func_const_iconv" = "yes"; then
  1384. AC_DEFINE(HAVE_ICONV_WITH_CONST_INPUT)
  1385. fi
  1386. fi
  1387. LIBS=$_SAVE_LIBS
  1388. AC_SUBST_LIST(ICONV_LIBS)
  1389. AM_LANGINFO_CODESET
  1390. AC_LANG_C
  1391. dnl **********************
  1392. dnl *** va_copy checks ***
  1393. AC_CACHE_CHECK([for an implementation of va_copy()],
  1394. ac_cv_va_copy,
  1395. [AC_TRY_COMPILE([#include <stdarg.h>
  1396. #include <stdlib.h>
  1397. void f (int i, ...) {
  1398. va_list args1, args2;
  1399. va_start (args1, i);
  1400. va_copy (args2, args1);
  1401. if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  1402. exit (1);
  1403. va_end (args1); va_end (args2);
  1404. }],
  1405. [f(0, 42); return 0],
  1406. [ac_cv_va_copy=yes],
  1407. [ac_cv_va_copy=no]
  1408. )]
  1409. )
  1410. AC_CACHE_CHECK([whether va_list can be copied by value],
  1411. ac_cv_va_val_copy,
  1412. [AC_TRY_COMPILE([#include <stdarg.h>
  1413. #include <stdlib.h>
  1414. void f (int i, ...) {
  1415. va_list args1, args2;
  1416. va_start (args1, i);
  1417. args2 = args1;
  1418. if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
  1419. exit (1);
  1420. va_end (args1); va_end (args2);
  1421. }],
  1422. [f(0, 42); return 0],
  1423. [ac_cv_va_val_copy=yes],
  1424. [ac_cv_va_val_copy=no],
  1425. )]
  1426. )
  1427. if test "x$ac_cv_va_copy" = "xyes"; then
  1428. AC_DEFINE(VA_COPY, va_copy)
  1429. AC_DEFINE(HAVE_VA_COPY)
  1430. fi
  1431. if test "x$ac_cv_va_val_copy" = "xno"; then
  1432. AC_DEFINE(HAVE_VA_LIST_AS_ARRAY)
  1433. fi
  1434. dnl ===================================================================
  1435. dnl ========================================================
  1436. dnl Put your C++ language/feature checks below
  1437. dnl ========================================================
  1438. AC_LANG_CPLUSPLUS
  1439. ARM_ABI_PREFIX=
  1440. if test "$GNU_CC"; then
  1441. if test "$CPU_ARCH" = "arm" ; then
  1442. AC_CACHE_CHECK(for ARM EABI,
  1443. ac_cv_gcc_arm_eabi,
  1444. [AC_TRY_COMPILE([],
  1445. [
  1446. #if defined(__ARM_EABI__)
  1447. return 0;
  1448. #else
  1449. #error Not ARM EABI.
  1450. #endif
  1451. ],
  1452. ac_cv_gcc_arm_eabi="yes",
  1453. ac_cv_gcc_arm_eabi="no")])
  1454. if test "$ac_cv_gcc_arm_eabi" = "yes"; then
  1455. HAVE_ARM_EABI=1
  1456. ARM_ABI_PREFIX=eabi-
  1457. else
  1458. ARM_ABI_PREFIX=oabi-
  1459. fi
  1460. fi
  1461. TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
  1462. fi
  1463. dnl Check to see if we can resolve ambiguity with |using|.
  1464. AC_CACHE_CHECK(whether the C++ \"using\" keyword resolves ambiguity,
  1465. ac_cv_cpp_ambiguity_resolving_using,
  1466. [AC_TRY_COMPILE(class X {
  1467. public: int go(const X&) {return 3;}
  1468. int jo(const X&) {return 3;}
  1469. };
  1470. class Y : public X {
  1471. public: int go(int) {return 2;}
  1472. int jo(int) {return 2;}
  1473. using X::jo;
  1474. private: using X::go;
  1475. };,
  1476. X x; Y y; y.jo(x);,
  1477. ac_cv_cpp_ambiguity_resolving_using=yes,
  1478. ac_cv_cpp_ambiguity_resolving_using=no)])
  1479. if test "$ac_cv_cpp_ambiguity_resolving_using" = yes ; then
  1480. AC_DEFINE(HAVE_CPP_AMBIGUITY_RESOLVING_USING)
  1481. fi
  1482. dnl See if a dynamic_cast to void* gives the most derived object.
  1483. AC_CACHE_CHECK(for C++ dynamic_cast to void*,
  1484. ac_cv_cpp_dynamic_cast_void_ptr,
  1485. [AC_TRY_RUN([class X { int i; public: virtual ~X() { } };
  1486. class Y { int j; public: virtual ~Y() { } };
  1487. class Z : public X, public Y { int k; };
  1488. int main() {
  1489. Z mdo;
  1490. X *subx = (X*)&mdo;
  1491. Y *suby = (Y*)&mdo;
  1492. return !((((void*)&mdo != (void*)subx) &&
  1493. ((void*)&mdo == dynamic_cast<void*>(subx))) ||
  1494. (((void*)&mdo != (void*)suby) &&
  1495. ((void*)&mdo == dynamic_cast<void*>(suby))));
  1496. }],
  1497. ac_cv_cpp_dynamic_cast_void_ptr=yes,
  1498. ac_cv_cpp_dynamic_cast_void_ptr=no,
  1499. ac_cv_cpp_dynamic_cast_void_ptr=no)])
  1500. if test "$ac_cv_cpp_dynamic_cast_void_ptr" = yes ; then
  1501. AC_DEFINE(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
  1502. fi
  1503. # try harder, when checking for __thread support, see bug 521750 comment #33 and below
  1504. # We pass MOZ_OPTIMIZE_LDFLAGS to the linker because if dead_strip is
  1505. # enabled, the linker in xcode 4.1 will crash. Without this it would crash when
  1506. # linking XUL.
  1507. _SAVE_LDFLAGS=$LDFLAGS
  1508. LDFLAGS="$LDFLAGS $DSO_PIC_CFLAGS $DSO_LDOPTS $MOZ_OPTIMIZE_LDFLAGS"
  1509. AC_CACHE_CHECK(for __thread keyword for TLS variables,
  1510. ac_cv_thread_keyword,
  1511. [AC_TRY_LINK([__thread bool tlsIsMainThread = false;],
  1512. [return tlsIsMainThread;],
  1513. ac_cv_thread_keyword=yes,
  1514. ac_cv_thread_keyword=no)])
  1515. LDFLAGS=$_SAVE_LDFLAGS
  1516. # The custom dynamic linker doesn't support TLS variables
  1517. MOZ_TLS=
  1518. if test "$ac_cv_thread_keyword" = yes -a "$MOZ_LINKER" != 1; then
  1519. # mips builds fail with TLS variables because of a binutils bug.
  1520. # See bug 528687
  1521. # OpenBSD doesn't have TLS support, and the test succeeds with clang++
  1522. case "${target}" in
  1523. mips*-*)
  1524. :
  1525. ;;
  1526. *-openbsd*)
  1527. :
  1528. ;;
  1529. *)
  1530. AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
  1531. MOZ_TLS=1
  1532. ;;
  1533. esac
  1534. fi
  1535. dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
  1536. if test -n "$MOZ_LINKER"; then
  1537. if test "$CPU_ARCH" = arm; then
  1538. dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
  1539. if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
  1540. LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
  1541. _SUBDIR_LDFLAGS="$_SUBDIR_LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
  1542. fi
  1543. fi
  1544. dnl gold emits wrong sysv-style elf hash tables when building both sysv and
  1545. dnl style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597
  1546. dnl Since the linker only understands the sysv ones, no need to build the
  1547. dnl gnu style tables anyways.
  1548. LDFLAGS="$LDFLAGS -Wl,--hash-style=sysv"
  1549. fi
  1550. dnl The custom linker doesn't support text relocations, but NDK >= r6b
  1551. dnl creates some (http://code.google.com/p/android/issues/detail?id=23203)
  1552. dnl We however want to avoid these text relocations, and this can be done
  1553. dnl by making gcc not link crtbegin and crtend. In the broken NDKs, crtend
  1554. dnl doesn't contain anything at all, beside placeholders for some sections,
  1555. dnl and crtbegin only contains a finalizer function that calls
  1556. dnl __cxa_finalize. The custom linker actually takes care of calling
  1557. dnl __cxa_finalize when the library doesn't call it itself, which makes it
  1558. dnl safe not to link crtbegin. Besides, previous versions of the NDK didn't
  1559. dnl link crtbegin and crtend at all.
  1560. if test -n "$MOZ_LINKER" -a "$OS_TARGET" = "Android"; then
  1561. AC_CACHE_CHECK([whether the CRT objects have text relocations],
  1562. ac_cv_crt_has_text_relocations,
  1563. [echo 'int foo() { return 0; }' > conftest.cpp
  1564. if AC_TRY_COMMAND(${CXX-g++} -o conftest${DLL_SUFFIX} $CXXFLAGS $DSO_LDOPTS $LDFLAGS conftest.cpp $LIBS 1>&5) &&
  1565. test -s conftest${DLL_SUFFIX}; then
  1566. if ${TOOLCHAIN_PREFIX}readelf -d conftest${DLL_SUFFIX} | grep TEXTREL > /dev/null; then
  1567. ac_cv_crt_has_text_relocations=yes
  1568. else
  1569. ac_cv_crt_has_text_relocations=no
  1570. fi
  1571. else
  1572. AC_ERROR([couldn't compile a simple C file])
  1573. fi
  1574. rm -rf conftest*])
  1575. if test "$ac_cv_crt_has_text_relocations" = yes; then
  1576. dnl While we want libraries to skip the CRT files, we don't want
  1577. dnl executables to be treated the same way. We thus set the flag
  1578. dnl in DSO_LDOPTS and not LDFLAGS. However, to pass it to nspr,
  1579. dnl we need to use LDFLAGS because nspr doesn't inherit DSO_LDOPTS.
  1580. dnl Using LDFLAGS in nspr is safe, since we only really build
  1581. dnl libraries there.
  1582. DSO_LDOPTS="$DSO_LDOPTS -nostartfiles"
  1583. NSPR_LDFLAGS="$NSPR_LDFLAGS -nostartfiles"
  1584. fi
  1585. fi
  1586. dnl See if compiler supports some gcc-style attributes
  1587. AC_CACHE_CHECK(for __attribute__((always_inline)),
  1588. ac_cv_attribute_always_inline,
  1589. [AC_TRY_COMPILE([inline void f(void) __attribute__((always_inline));],
  1590. [],
  1591. ac_cv_attribute_always_inline=yes,
  1592. ac_cv_attribute_always_inline=no)])
  1593. dnl End of C++ language/feature checks
  1594. AC_LANG_C
  1595. dnl ========================================================
  1596. dnl = Internationalization checks
  1597. dnl ========================================================
  1598. dnl
  1599. dnl Internationalization and Locale support is different
  1600. dnl on various UNIX platforms. Checks for specific i18n
  1601. dnl features go here.
  1602. dnl check for LC_MESSAGES
  1603. AC_CACHE_CHECK(for LC_MESSAGES,
  1604. ac_cv_i18n_lc_messages,
  1605. [AC_TRY_COMPILE([#include <locale.h>],
  1606. [int category = LC_MESSAGES;],
  1607. ac_cv_i18n_lc_messages=yes,
  1608. ac_cv_i18n_lc_messages=no)])
  1609. if test "$ac_cv_i18n_lc_messages" = yes; then
  1610. AC_DEFINE(HAVE_I18N_LC_MESSAGES)
  1611. fi
  1612. AC_HAVE_FUNCS(localeconv)
  1613. fi # ! SKIP_COMPILER_CHECKS
  1614. if test -n "${COMPILE_ENVIRONMENT}"; then
  1615. MOZ_CHECK_ALLOCATOR
  1616. fi
  1617. TARGET_XPCOM_ABI=
  1618. if test -n "${CPU_ARCH}" -a -n "${TARGET_COMPILER_ABI}"; then
  1619. TARGET_XPCOM_ABI="${CPU_ARCH}-${TARGET_COMPILER_ABI}"
  1620. AC_DEFINE_UNQUOTED(TARGET_XPCOM_ABI, ["${TARGET_XPCOM_ABI}"])
  1621. fi
  1622. dnl We can't run TRY_COMPILE tests on Windows, so hard-code some
  1623. dnl features that Windows actually does support.
  1624. if test -n "$SKIP_COMPILER_CHECKS"; then
  1625. dnl Windows has malloc.h
  1626. AC_DEFINE(MALLOC_H, [<malloc.h>])
  1627. AC_DEFINE(HAVE_FORCEINLINE)
  1628. AC_DEFINE(HAVE_LOCALECONV)
  1629. fi # SKIP_COMPILER_CHECKS
  1630. dnl Mozilla specific options
  1631. dnl ========================================================
  1632. dnl The macros used for command line options
  1633. dnl are defined in build/autoconf/altoptions.m4.
  1634. dnl ========================================================
  1635. dnl =
  1636. dnl = Check for external package dependencies
  1637. dnl =
  1638. dnl ========================================================
  1639. MOZ_ARG_HEADER(External Packages)
  1640. case "$OS_TARGET" in
  1641. WINNT)
  1642. MOZ_FOLD_LIBS=1
  1643. ;;
  1644. *)
  1645. MOZ_FOLD_LIBS=
  1646. ;;
  1647. esac
  1648. MOZ_CONFIG_NSPR()
  1649. # TODO: We need to find a better place to define this include
  1650. NSS_CFLAGS="-I${DIST}/include/nss"
  1651. AC_SUBST(NSS_CFLAGS)
  1652. if test -z "$SKIP_LIBRARY_CHECKS"; then
  1653. dnl system JPEG support
  1654. dnl ========================================================
  1655. MOZ_ARG_WITH_STRING(system-jpeg,
  1656. [ --with-system-jpeg[=PFX]
  1657. Use system libjpeg [installed at prefix PFX]],
  1658. JPEG_DIR=$withval)
  1659. _SAVE_CFLAGS=$CFLAGS
  1660. _SAVE_LDFLAGS=$LDFLAGS
  1661. _SAVE_LIBS=$LIBS
  1662. if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
  1663. CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
  1664. LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
  1665. fi
  1666. if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
  1667. MOZ_SYSTEM_JPEG=
  1668. else
  1669. AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
  1670. fi
  1671. if test "$MOZ_SYSTEM_JPEG" = 1; then
  1672. AC_TRY_COMPILE([ #include <stdio.h>
  1673. #include <sys/types.h>
  1674. #include <jpeglib.h> ],
  1675. [ #if JPEG_LIB_VERSION < $MOZJPEG
  1676. #error "Insufficient JPEG library version ($MOZJPEG required)."
  1677. #endif
  1678. #ifndef JCS_EXTENSIONS
  1679. #error "libjpeg-turbo JCS_EXTENSIONS required"
  1680. #endif
  1681. ],
  1682. MOZ_SYSTEM_JPEG=1,
  1683. AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
  1684. fi
  1685. CFLAGS=$_SAVE_CFLAGS
  1686. LDFLAGS=$_SAVE_LDFLAGS
  1687. LIBS=$_SAVE_LIBS
  1688. if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
  1689. MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
  1690. MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
  1691. fi
  1692. fi # SKIP_LIBRARY_CHECKS
  1693. dnl system ZLIB support
  1694. dnl ========================================================
  1695. MOZ_ZLIB_CHECK([1.2.3])
  1696. if test "$MOZ_LINKER" = 1 -a "$MOZ_SYSTEM_ZLIB" != 1; then
  1697. AC_MSG_ERROR([Custom dynamic linker requires --with-system-zlib])
  1698. fi
  1699. if test -z "$SKIP_LIBRARY_CHECKS"; then
  1700. dnl system BZIP2 Support
  1701. dnl ========================================================
  1702. MOZ_ARG_WITH_STRING(system-bz2,
  1703. [ --with-system-bz2[=PFX]
  1704. Use system libbz2 [installed at prefix PFX]],
  1705. BZ2_DIR=$withval)
  1706. _SAVE_CFLAGS=$CFLAGS
  1707. _SAVE_LDFLAGS=$LDFLAGS
  1708. _SAVE_LIBS=$LIBS
  1709. if test -n "${BZ2_DIR}" -a "${BZ2_DIR}" != "yes"; then
  1710. CFLAGS="-I${BZ2_DIR}/include $CFLAGS"
  1711. LDFLAGS="-L${BZ2_DIR}/lib $LDFLAGS"
  1712. fi
  1713. if test -z "$BZ2_DIR" -o "$BZ2_DIR" = no; then
  1714. MOZ_SYSTEM_BZ2=
  1715. else
  1716. AC_CHECK_LIB(bz2, BZ2_bzread, [MOZ_SYSTEM_BZ2=1 MOZ_BZ2_LIBS="-lbz2"],
  1717. [MOZ_SYSTEM_BZ2= MOZ_BZ2_CFLAGS= MOZ_BZ2_LIBS=])
  1718. fi
  1719. CFLAGS=$_SAVE_CFLAGS
  1720. LDFLAGS=$_SAVE_LDFLAGS
  1721. LIBS=$_SAVE_LIBS
  1722. if test "${BZ2_DIR}" -a -d "${BZ2_DIR}" -a "$MOZ_SYSTEM_BZ2" = 1; then
  1723. MOZ_BZ2_CFLAGS="-I${BZ2_DIR}/include"
  1724. MOZ_BZ2_LIBS="-L${BZ2_DIR}/lib ${MOZ_BZ2_LIBS}"
  1725. fi
  1726. fi # SKIP_LIBRARY_CHECKS
  1727. dnl ========================================================
  1728. dnl =
  1729. dnl = Application
  1730. dnl =
  1731. dnl ========================================================
  1732. MOZ_ARG_HEADER(Application)
  1733. ENABLE_TESTS=
  1734. ENABLE_SYSTEM_EXTENSION_DIRS=1
  1735. MOZ_BRANDING_DIRECTORY=
  1736. MOZ_OFFICIAL_BRANDING=
  1737. MC_OFFICIAL=
  1738. MOZ_FEEDS=1
  1739. MOZ_AUTH_EXTENSION=1
  1740. if test "$MOZ_IOS"; then
  1741. MOZ_AUTH_EXTENSION=
  1742. fi
  1743. MOZ_RAW=
  1744. MOZ_AV1=
  1745. MOZ_VORBIS=
  1746. MOZ_TREMOR=
  1747. MOZ_SAMPLE_TYPE_FLOAT32=
  1748. MOZ_SAMPLE_TYPE_S16=
  1749. MOZ_WEBRTC=
  1750. MOZ_PEERCONNECTION=
  1751. MOZ_SRTP=
  1752. MOZ_WEBRTC_SIGNALING=
  1753. MOZ_WEBRTC_ASSERT_ALWAYS=1
  1754. MOZ_WEBRTC_HARDWARE_AEC_NS=
  1755. MOZ_SCTP=
  1756. MOZ_VPX_ERROR_CONCEALMENT=
  1757. VPX_USE_YASM=
  1758. VPX_ASFLAGS=
  1759. VPX_AS_CONVERSION=
  1760. VPX_X86_ASM=
  1761. VPX_ARM_ASM=
  1762. LIBJPEG_TURBO_AS=
  1763. LIBJPEG_TURBO_ASFLAGS=
  1764. MOZ_GAMEPAD=
  1765. MOZ_PREF_EXTENSIONS=1
  1766. MOZ_REFLOW_PERF=
  1767. MOZ_SAFE_BROWSING=
  1768. MOZ_SPELLCHECK=1
  1769. MOZ_TOOLKIT_SEARCH=1
  1770. MOZ_UI_LOCALE=en-US
  1771. MOZ_UNIVERSALCHARDET=1
  1772. MOZ_URL_CLASSIFIER=
  1773. MOZ_XUL=1
  1774. MOZ_ZIPWRITER=1
  1775. MOZ_NO_SMART_CARDS=
  1776. MOZ_NECKO_WIFI=1
  1777. NECKO_COOKIES=1
  1778. MOZ_USE_NATIVE_POPUP_WINDOWS=
  1779. MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
  1780. ACCESSIBILITY=1
  1781. MOZ_TIME_MANAGER=
  1782. MOZ_AUDIO_CHANNEL_MANAGER=
  1783. MOZ_JETPACK=1
  1784. MOZ_DEVTOOLS_SERVER=1
  1785. MOZ_DEVTOOLS=
  1786. MOZ_PLACES=1
  1787. MOZ_SECURITY_SQLSTORE=
  1788. MOZ_SERVICES_HEALTHREPORT=1
  1789. MOZ_SERVICES_SYNC=1
  1790. MOZ_USERINFO=1
  1791. NSS_DISABLE_DBM=
  1792. MOZ_MAILNEWS=
  1793. MOZ_MAILNEWS_OAUTH2=
  1794. MOZ_LDAP_XPCOM=
  1795. MOZ_MORK=
  1796. MOZ_MAPI_SUPPORT=
  1797. MOZ_INCOMPLETE_EXTERNAL_LINKAGE=
  1798. MOZ_CAN_DRAW_IN_TITLEBAR=
  1799. case "$target_os" in
  1800. mingw*)
  1801. NS_ENABLE_TSF=1
  1802. AC_DEFINE(NS_ENABLE_TSF)
  1803. ;;
  1804. esac
  1805. dnl ========================================================
  1806. dnl = Vendor override
  1807. dnl ========================================================
  1808. MOZ_ARG_ENABLE_BOOL(official-vendor,
  1809. [ --enable-official-vendor This is an official release build.],
  1810. MC_OFFICIAL=1,
  1811. MC_OFFICIAL=)
  1812. dnl ========================================================
  1813. dnl = Trademarked Branding
  1814. dnl ========================================================
  1815. MOZ_ARG_ENABLE_BOOL(official-branding,
  1816. [ --enable-official-branding
  1817. Enable Official Branding
  1818. Do not distribute builds with
  1819. --enable-official-branding unless you have
  1820. permission to use our trademarks!],
  1821. MOZ_OFFICIAL_BRANDING=1,
  1822. MOZ_OFFICIAL_BRANDING=)
  1823. # Allow the application to influence configure with a confvars.sh script.
  1824. AC_MSG_CHECKING([if app-specific confvars.sh exists])
  1825. if test -f "${srcdir}/${MOZ_BUILD_APP}/confvars.sh" ; then
  1826. AC_MSG_RESULT([${srcdir}/${MOZ_BUILD_APP}/confvars.sh])
  1827. . "${srcdir}/${MOZ_BUILD_APP}/confvars.sh"
  1828. else
  1829. AC_MSG_RESULT([no])
  1830. fi
  1831. # Allow someone to change MOZ_APP_NAME and MOZ_APP_BASENAME in mozconfig
  1832. MOZ_ARG_WITH_STRING(app-name,
  1833. [--with-app-name=APPNAME sets MOZ_APP_NAME to APPNAME],
  1834. WITH_APP_NAME=$withval,
  1835. )
  1836. if test -n "$WITH_APP_NAME" ; then
  1837. MOZ_APP_NAME="$WITH_APP_NAME"
  1838. fi
  1839. MOZ_ARG_WITH_STRING(app-basename,
  1840. [--with-app-basename=BASENAME sets MOZ_APP_BASENAME to BASENAME],
  1841. WITH_APP_BASENAME=$withval,
  1842. )
  1843. if test -n "$WITH_APP_BASENAME" ; then
  1844. MOZ_APP_BASENAME="$WITH_APP_BASENAME"
  1845. fi
  1846. dnl ========================================================
  1847. dnl =
  1848. dnl = Toolkit Options
  1849. dnl =
  1850. dnl ========================================================
  1851. MOZ_ARG_HEADER(Toolkit Options)
  1852. dnl ========================================================
  1853. dnl = Enable the toolkit as needed =
  1854. dnl ========================================================
  1855. case "$MOZ_WIDGET_TOOLKIT" in
  1856. cocoa)
  1857. LDFLAGS="$LDFLAGS -framework Cocoa -lobjc"
  1858. # Use -Wl as a trick to avoid -framework and framework names from
  1859. # being separated by AC_SUBST_LIST.
  1860. TK_LIBS='-Wl,-framework,CoreLocation -Wl,-framework,QuartzCore -Wl,-framework,Carbon -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,AddressBook -Wl,-framework,OpenGL -Wl,-framework,Security -Wl,-framework,ServiceManagement'
  1861. TK_CFLAGS=""
  1862. CFLAGS="$CFLAGS $TK_CFLAGS"
  1863. CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
  1864. MOZ_USER_DIR="Mozilla"
  1865. MOZ_FS_LAYOUT=bundle
  1866. ;;
  1867. uikit)
  1868. LDFLAGS="$LDFLAGS -framework UIKit -lobjc"
  1869. TK_CFLAGS=""
  1870. TK_LIBS='-Wl,-framework,Foundation -Wl,-framework,CoreFoundation -Wl,-framework,CoreGraphics -Wl,-framework,CoreText -Wl,-framework,AVFoundation -Wl,-framework,AudioToolbox -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo -Wl,-framework,OpenGLES -Wl,-framework,QuartzCore'
  1871. CFLAGS="$CFLAGS $TK_CFLAGS"
  1872. CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
  1873. MOZ_USER_DIR="Mozilla"
  1874. MOZ_FS_LAYOUT=bundle
  1875. ;;
  1876. esac
  1877. dnl there are a lot of tests on MOZ_ENABLE_GTK below, that are more convenient
  1878. dnl to keep that way than testing against MOZ_WIDGET_TOOLKIT
  1879. case "$MOZ_WIDGET_TOOLKIT" in
  1880. gtk*)
  1881. MOZ_ENABLE_GTK=1
  1882. ;;
  1883. esac
  1884. if test "$COMPILE_ENVIRONMENT"; then
  1885. if test "$MOZ_WIDGET_TOOLKIT" = gtk3; then
  1886. PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
  1887. MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
  1888. TK_CFLAGS=$MOZ_GTK3_CFLAGS
  1889. TK_LIBS=$MOZ_GTK3_LIBS
  1890. dnl GDK_VERSION_MIN_REQUIRED is not set here as GDK3 deprecated warnings
  1891. dnl are suppressed by widget/gtk/compat-gtk3/gdk/gdkversionmacros.h.
  1892. AC_DEFINE_UNQUOTED(GDK_VERSION_MAX_ALLOWED,$GDK_VERSION_MAX_ALLOWED)
  1893. GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32
  1894. fi
  1895. if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
  1896. GLIB_VERSION_MAX_ALLOWED=$GLIB_VERSION_MIN_REQUIRED
  1897. fi
  1898. if test "$MOZ_ENABLE_GTK"; then
  1899. if test "$MOZ_X11"; then
  1900. GDK_PACKAGES=gdk-x11-2.0
  1901. fi
  1902. AC_DEFINE_UNQUOTED(GLIB_VERSION_MIN_REQUIRED,$GLIB_VERSION_MIN_REQUIRED)
  1903. AC_DEFINE_UNQUOTED(GLIB_VERSION_MAX_ALLOWED,$GLIB_VERSION_MAX_ALLOWED)
  1904. PKG_CHECK_MODULES(MOZ_GTK2, gtk+-2.0 >= $GTK2_VERSION gtk+-unix-print-2.0 glib-2.0 >= $GLIB_VERSION gobject-2.0 $GDK_PACKAGES)
  1905. MOZ_GTK2_CFLAGS="-I${_topsrcdir}/widget/gtk/compat $MOZ_GTK2_CFLAGS"
  1906. fi
  1907. if test "$MOZ_WIDGET_TOOLKIT" = gtk2; then
  1908. TK_CFLAGS=$MOZ_GTK2_CFLAGS
  1909. TK_LIBS=$MOZ_GTK2_LIBS
  1910. fi
  1911. fi # COMPILE_ENVIRONMENT
  1912. AC_SUBST(MOZ_FS_LAYOUT)
  1913. dnl ========================================================
  1914. dnl = startup-notification support module
  1915. dnl ========================================================
  1916. if test "$MOZ_ENABLE_GTK"
  1917. then
  1918. MOZ_ENABLE_STARTUP_NOTIFICATION=
  1919. MOZ_ARG_ENABLE_BOOL(startup-notification,
  1920. [ --enable-startup-notification
  1921. Enable startup-notification support (default: disabled) ],
  1922. MOZ_ENABLE_STARTUP_NOTIFICATION=force,
  1923. MOZ_ENABLE_STARTUP_NOTIFICATION=)
  1924. if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"
  1925. then
  1926. PKG_CHECK_MODULES(MOZ_STARTUP_NOTIFICATION,
  1927. libstartup-notification-1.0 >= $STARTUP_NOTIFICATION_VERSION,
  1928. [MOZ_ENABLE_STARTUP_NOTIFICATION=1], [
  1929. if test "$MOZ_ENABLE_STARTUP_NOTIFICATION" = "force"
  1930. then
  1931. AC_MSG_ERROR([* * * Could not find startup-notification >= $STARTUP_NOTIFICATION_VERSION])
  1932. fi
  1933. MOZ_ENABLE_STARTUP_NOTIFICATION=
  1934. ])
  1935. fi
  1936. if test "$MOZ_ENABLE_STARTUP_NOTIFICATION"; then
  1937. AC_DEFINE(MOZ_ENABLE_STARTUP_NOTIFICATION)
  1938. fi
  1939. TK_LIBS="$TK_LIBS $MOZ_STARTUP_NOTIFICATION_LIBS"
  1940. fi
  1941. AC_SUBST(MOZ_ENABLE_STARTUP_NOTIFICATION)
  1942. AC_SUBST_LIST(TK_CFLAGS)
  1943. AC_SUBST_LIST(TK_LIBS)
  1944. AC_SUBST(MOC)
  1945. AC_SUBST(RCC)
  1946. dnl ========================================================
  1947. dnl =
  1948. dnl = Components & Features
  1949. dnl =
  1950. dnl ========================================================
  1951. MOZ_ARG_HEADER(Components and Features)
  1952. dnl ========================================================
  1953. dnl = Localization
  1954. dnl ========================================================
  1955. MOZ_ARG_ENABLE_STRING(ui-locale,
  1956. [ --enable-ui-locale=ab-CD
  1957. Select the user interface locale (default: en-US)],
  1958. MOZ_UI_LOCALE=$enableval )
  1959. AC_SUBST(MOZ_UI_LOCALE)
  1960. AC_SUBST(MOZ_OFFICIAL_BRANDING)
  1961. if test -n "$MOZ_OFFICIAL_BRANDING"; then
  1962. if test -z "$MOZ_OFFICIAL_BRANDING_DIRECTORY"; then
  1963. AC_MSG_ERROR([You must specify MOZ_OFFICIAL_BRANDING_DIRECTORY to use --enable-official-branding.])
  1964. else
  1965. MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
  1966. AC_DEFINE(MOZ_OFFICIAL_BRANDING)
  1967. dnl Using official branding implies an official release build.
  1968. MC_OFFICIAL=1
  1969. fi
  1970. fi
  1971. AC_SUBST(MC_OFFICIAL)
  1972. if test -n "$MC_OFFICIAL"; then
  1973. AC_DEFINE(MC_OFFICIAL)
  1974. fi
  1975. MOZ_ARG_WITH_STRING(branding,
  1976. [ --with-branding=dir Use branding from the specified directory.],
  1977. MOZ_BRANDING_DIRECTORY=$withval)
  1978. REAL_BRANDING_DIRECTORY="${MOZ_BRANDING_DIRECTORY}"
  1979. if test -z "$REAL_BRANDING_DIRECTORY"; then
  1980. REAL_BRANDING_DIRECTORY=${MOZ_BUILD_APP}/branding/nightly
  1981. fi
  1982. if test -f "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
  1983. . "${_topsrcdir}/$REAL_BRANDING_DIRECTORY/configure.sh"
  1984. elif test -f "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"; then
  1985. . "${EXTERNAL_SOURCE_DIR}/$REAL_BRANDING_DIRECTORY/configure.sh"
  1986. fi
  1987. AC_SUBST(MOZ_BRANDING_DIRECTORY)
  1988. dnl ========================================================
  1989. dnl = Private Build
  1990. dnl ========================================================
  1991. MOZ_ARG_ENABLE_BOOL(private-build,
  1992. [ --enable-private-build Enable private builds
  1993. This allows you to build with official
  1994. branding for personal use only using any
  1995. build time configuration.],
  1996. MC_PRIVATE_BUILD=1,
  1997. MC_PRIVATE_BUILD=)
  1998. AC_SUBST(MC_PRIVATE_BUILD)
  1999. if test -n "$MC_PRIVATE_BUILD"; then
  2000. AC_DEFINE(MC_PRIVATE_BUILD)
  2001. fi
  2002. dnl ========================================================
  2003. dnl = Distribution ID
  2004. dnl ========================================================
  2005. MOZ_ARG_WITH_STRING(distribution-id,
  2006. [ --with-distribution-id=ID
  2007. Set distribution-specific id (default=org.mozilla)],
  2008. [ val=`echo $withval`
  2009. MOZ_DISTRIBUTION_ID="$val"])
  2010. if test -z "$MOZ_DISTRIBUTION_ID"; then
  2011. MOZ_DISTRIBUTION_ID="org.mozilla"
  2012. fi
  2013. AC_DEFINE_UNQUOTED(MOZ_DISTRIBUTION_ID,"$MOZ_DISTRIBUTION_ID")
  2014. AC_SUBST(MOZ_DISTRIBUTION_ID)
  2015. dnl ========================================================
  2016. dnl = GIO and GConf support module
  2017. dnl ========================================================
  2018. if test "$MOZ_X11"
  2019. then
  2020. dnl build the GIO extension by default only when the
  2021. dnl GTK2 toolkit is in use.
  2022. if test "$MOZ_ENABLE_GTK"
  2023. then
  2024. MOZ_ENABLE_GIO=1
  2025. MOZ_ENABLE_GCONF=1
  2026. fi
  2027. dnl ========================================================
  2028. dnl = GIO support module
  2029. dnl ========================================================
  2030. MOZ_ARG_DISABLE_BOOL(gio,
  2031. [ --disable-gio Disable GIO support],
  2032. MOZ_ENABLE_GIO=,
  2033. MOZ_ENABLE_GIO=force)
  2034. if test "$MOZ_ENABLE_GIO" -a "$MOZ_ENABLE_GTK"
  2035. then
  2036. if test "$MOZ_WIDGET_TOOLKIT" = gtk2
  2037. then
  2038. PKG_CHECK_MODULES(_GTKCHECK, gtk+-2.0 >= 2.14, ,
  2039. [AC_MSG_ERROR([* * * Could not find gtk+-2.0 > 2.14. Required for build with gio.])])
  2040. fi
  2041. PKG_CHECK_MODULES(MOZ_GIO, gio-2.0 >= $GIO_VERSION,[
  2042. MOZ_GIO_LIBS=`echo $MOZ_GIO_LIBS | sed 's/-llinc\>//'`
  2043. MOZ_ENABLE_GIO=1
  2044. AC_DEFINE(MOZ_ENABLE_GIO)
  2045. ],[
  2046. if test "$MOZ_ENABLE_GIO" = "force"
  2047. then
  2048. AC_MSG_ERROR([* * * Could not find gio-2.0 >= $GIO_VERSION])
  2049. fi
  2050. MOZ_ENABLE_GIO=
  2051. ])
  2052. fi
  2053. AC_SUBST(MOZ_ENABLE_GIO)
  2054. dnl ========================================================
  2055. dnl = GConf support module
  2056. dnl ========================================================
  2057. MOZ_ARG_DISABLE_BOOL(gconf,
  2058. [ --disable-gconf Disable Gconf support ],
  2059. MOZ_ENABLE_GCONF=,
  2060. MOZ_ENABLE_GCONF=1)
  2061. if test "$MOZ_ENABLE_GCONF"
  2062. then
  2063. PKG_CHECK_MODULES(MOZ_GCONF, gconf-2.0 >= $GCONF_VERSION gobject-2.0 ,[
  2064. MOZ_GCONF_LIBS=`$PKG_CONFIG --libs gobject-2.0`
  2065. MOZ_ENABLE_GCONF=1
  2066. ],[
  2067. if test -n "$MOZ_ENABLE_GCONF";
  2068. then
  2069. AC_MSG_ERROR([* * * Could not find gconf-2.0 ])
  2070. else
  2071. AC_MSG_WARN([Many automated tests will fail with --disable-gconf. See bug 1167201.])
  2072. fi
  2073. ])
  2074. fi
  2075. if test "$MOZ_ENABLE_GCONF"; then
  2076. AC_DEFINE(MOZ_ENABLE_GCONF)
  2077. fi
  2078. AC_SUBST(MOZ_ENABLE_GCONF)
  2079. fi
  2080. dnl ========================================================
  2081. dnl = libproxy support
  2082. dnl ========================================================
  2083. if test "$MOZ_ENABLE_GTK"
  2084. then
  2085. MOZ_ENABLE_LIBPROXY=
  2086. MOZ_ARG_ENABLE_BOOL(libproxy,
  2087. [ --enable-libproxy Enable libproxy support ],
  2088. MOZ_ENABLE_LIBPROXY=1,
  2089. MOZ_ENABLE_LIBPROXY=)
  2090. if test "$MOZ_ENABLE_LIBPROXY"
  2091. then
  2092. PKG_CHECK_MODULES(MOZ_LIBPROXY, libproxy-1.0)
  2093. AC_DEFINE(MOZ_ENABLE_LIBPROXY)
  2094. fi
  2095. fi
  2096. AC_SUBST(MOZ_ENABLE_LIBPROXY)
  2097. dnl ========================================================
  2098. dnl = libgnomeui support module
  2099. dnl ========================================================
  2100. if test "$MOZ_ENABLE_GTK"
  2101. then
  2102. MOZ_ARG_ENABLE_BOOL(gnomeui,
  2103. [ --enable-gnomeui Enable libgnomeui instead of GIO & GTK for icon theme support ],
  2104. MOZ_ENABLE_GNOMEUI=force,
  2105. MOZ_ENABLE_GNOMEUI=)
  2106. if test "$MOZ_ENABLE_GNOMEUI"
  2107. then
  2108. PKG_CHECK_MODULES(MOZ_GNOMEUI, libgnomeui-2.0 >= $GNOMEUI_VERSION,
  2109. [
  2110. MOZ_ENABLE_GNOMEUI=1
  2111. ],[
  2112. if test "$MOZ_ENABLE_GNOMEUI" = "force"
  2113. then
  2114. AC_MSG_ERROR([* * * Could not find libgnomeui-2.0 >= $GNOMEUI_VERSION])
  2115. fi
  2116. MOZ_ENABLE_GNOMEUI=
  2117. ])
  2118. fi
  2119. if test "$MOZ_ENABLE_GNOMEUI"; then
  2120. AC_DEFINE(MOZ_ENABLE_GNOMEUI)
  2121. fi
  2122. fi
  2123. AC_SUBST(MOZ_ENABLE_GNOMEUI)
  2124. dnl ========================================================
  2125. dnl = dbus support
  2126. dnl ========================================================
  2127. if test "$MOZ_ENABLE_GTK"
  2128. then
  2129. MOZ_ENABLE_DBUS=1
  2130. MOZ_ARG_DISABLE_BOOL(dbus,
  2131. [ --disable-dbus Disable dbus support ],
  2132. MOZ_ENABLE_DBUS=,
  2133. MOZ_ENABLE_DBUS=1)
  2134. if test "$MOZ_ENABLE_DBUS"
  2135. then
  2136. PKG_CHECK_MODULES(MOZ_DBUS, dbus-1 >= $DBUS_VERSION)
  2137. PKG_CHECK_MODULES(MOZ_DBUS_GLIB, dbus-glib-1 >= $DBUS_VERSION)
  2138. AC_DEFINE(MOZ_ENABLE_DBUS)
  2139. fi
  2140. fi
  2141. AC_SUBST(MOZ_ENABLE_DBUS)
  2142. dnl =========================================================
  2143. dnl = Whether to exclude hyphenations files in the build
  2144. dnl =========================================================
  2145. if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
  2146. AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
  2147. fi
  2148. dnl ========================================================
  2149. dnl accessibility support on by default on all platforms
  2150. dnl ========================================================
  2151. MOZ_ARG_DISABLE_BOOL(accessibility,
  2152. [ --disable-accessibility Disable accessibility support],
  2153. ACCESSIBILITY=,
  2154. ACCESSIBILITY=1 )
  2155. if test "$ACCESSIBILITY"; then
  2156. case "$target" in
  2157. *-mingw*)
  2158. if test -z "$MIDL"; then
  2159. if test "$GCC" != "yes"; then
  2160. AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
  2161. else
  2162. AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
  2163. fi
  2164. fi
  2165. esac
  2166. AC_DEFINE(ACCESSIBILITY)
  2167. fi
  2168. dnl ========================================================
  2169. dnl Accessibility is required for the linuxgl widget
  2170. dnl backend
  2171. dnl ========================================================
  2172. if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
  2173. AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
  2174. fi
  2175. dnl Turn off webrtc for OS's we don't handle yet, but allow
  2176. dnl --enable-webrtc to override. Can disable for everything in
  2177. dnl the master list above.
  2178. if test -n "$MOZ_WEBRTC"; then
  2179. case "$target" in
  2180. *-linux*|*-mingw*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*)
  2181. dnl Leave enabled
  2182. ;;
  2183. *)
  2184. dnl default to disabled for all others
  2185. MOZ_WEBRTC=
  2186. ;;
  2187. esac
  2188. fi
  2189. AC_TRY_COMPILE([#include <linux/ethtool.h>],
  2190. [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
  2191. MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
  2192. AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
  2193. # target_arch is from {ia32|x64|arm|ppc}
  2194. case "$CPU_ARCH" in
  2195. x86_64 | arm | aarch64 | x86 | ppc* | ia64)
  2196. :
  2197. ;;
  2198. *)
  2199. # unsupported arch for webrtc
  2200. MOZ_WEBRTC=
  2201. ;;
  2202. esac
  2203. dnl =========================================================
  2204. dnl = NSS DBM (BerkeleyDB) Support
  2205. dnl = NOTE: Because we don't expressly control the name of
  2206. dnl = this var --disable-dbm means NSS_DISABLE_DBM=1
  2207. dnl =========================================================
  2208. MOZ_ARG_DISABLE_BOOL(dbm,
  2209. [ --disable-dbm Disable DBM support in nss],
  2210. NSS_DISABLE_DBM=1,
  2211. NSS_DISABLE_DBM=)
  2212. if test -n "$NSS_DISABLE_DBM"; then
  2213. AC_DEFINE(NSS_DISABLE_DBM)
  2214. fi
  2215. AC_SUBST(NSS_DISABLE_DBM)
  2216. dnl =========================================================
  2217. dnl = NSS SQL storage format
  2218. dnl =========================================================
  2219. MOZ_ARG_ENABLE_BOOL(security-sqlstore,
  2220. [ --enable-security-sqlstore Enable the use of SQL storage for NSS],
  2221. MOZ_SECURITY_SQLSTORE=1,
  2222. MOZ_SECURITY_SQLSTORE=)
  2223. if test -n "$NSS_DISABLE_DBM" -a -z "$MOZ_SECURITY_SQLSTORE"; then
  2224. AC_MSG_ERROR([DBM storage support is required if not using NSS SQL storage])
  2225. fi
  2226. if test -n "$MOZ_SECURITY_SQLSTORE"; then
  2227. AC_DEFINE(MOZ_SECURITY_SQLSTORE)
  2228. fi
  2229. AC_SUBST(MOZ_SECURITY_SQLSTORE)
  2230. dnl =========================================================
  2231. dnl = Don't fold mailnews related comps into libXUL
  2232. dnl =========================================================
  2233. MOZ_ARG_ENABLE_BOOL(incomplete-external-linkage,
  2234. [ --enable-incomplete-external-linkage Don't fold *comps into libXUL which is currently badly busted so don't even bother with it ],
  2235. MOZ_INCOMPLETE_EXTERNAL_LINKAGE=1,
  2236. MOZ_INCOMPLETE_EXTERNAL_LINKAGE= )
  2237. AC_SUBST(MOZ_INCOMPLETE_EXTERNAL_LINKAGE)
  2238. dnl ========================================================
  2239. dnl = Enable MailNews
  2240. dnl ========================================================
  2241. MOZ_ARG_ENABLE_BOOL(mailnews,
  2242. [ --enable-mailnews Enable the mailnews core backend],
  2243. MOZ_MAILNEWS=1,
  2244. MOZ_MAILNEWS=)
  2245. if test -n "$MOZ_MAILNEWS"; then
  2246. MOZ_MORK=1
  2247. MOZ_LDAP_XPCOM=1
  2248. if test "$OS_ARCH" == "WINNT"; then
  2249. MOZ_MAPI_SUPPORT=1
  2250. else
  2251. MOZ_MOVEMAIL=1
  2252. HAVE_MOVEMAIL=1
  2253. AC_DEFINE(HAVE_MOVEMAIL)
  2254. fi
  2255. AC_DEFINE(MOZ_MAILNEWS)
  2256. AC_DEFINE(MOZ_MORK)
  2257. fi
  2258. AC_SUBST(MOZ_MAILNEWS)
  2259. AC_SUBST(MOZ_MORK)
  2260. AC_SUBST(MOZ_MOVEMAIL)
  2261. dnl =========================================================
  2262. dnl = Mailnews OAuth2 Support
  2263. dnl =========================================================
  2264. MOZ_ARG_DISABLE_BOOL(mailnews-oauth2,
  2265. [ --disable-mailnews-oauth2 Disable oauth2 support in mailnews],
  2266. MOZ_MAILNEWS_OAUTH2=,
  2267. MOZ_MAILNEWS_OAUTH2=1)
  2268. if test -n "$MOZ_MAILNEWS_OAUTH2"; then
  2269. AC_DEFINE(MOZ_MAILNEWS_OAUTH2)
  2270. fi
  2271. AC_SUBST(MOZ_MAILNEWS_OAUTH2)
  2272. dnl =========================================================
  2273. dnl = LDAP
  2274. dnl =========================================================
  2275. MOZ_ARG_DISABLE_BOOL(ldap,
  2276. [ --disable-ldap Disable LDAP support],
  2277. MOZ_LDAP_XPCOM= )
  2278. if test -n "$MOZ_LDAP_XPCOM"; then
  2279. AC_DEFINE(MOZ_LDAP_XPCOM)
  2280. fi
  2281. AC_SUBST(MOZ_LDAP_XPCOM)
  2282. dnl =========================================================
  2283. dnl = MAPI support (Windows only)
  2284. dnl =========================================================
  2285. MOZ_ARG_DISABLE_BOOL(mapi,
  2286. [ --disable-mapi Disable MAPI support],
  2287. MOZ_MAPI_SUPPORT= )
  2288. if test -n "$MOZ_MAPI_SUPPORT"; then
  2289. AC_DEFINE(MOZ_MAPI_SUPPORT)
  2290. fi
  2291. AC_SUBST(MOZ_MAPI_SUPPORT)
  2292. dnl ========================================================
  2293. dnl = Client drawing in titlebar
  2294. dnl ========================================================
  2295. if test -n "$MOZ_CAN_DRAW_IN_TITLEBAR"; then
  2296. case "$OS_TARGET" in
  2297. WINNT)
  2298. AC_DEFINE(MOZ_CAN_DRAW_IN_TITLEBAR)
  2299. ;;
  2300. *)
  2301. AC_MSG_ERROR([Drawing in the titlebar is only supported on Windows targets])
  2302. ;;
  2303. esac
  2304. fi
  2305. AC_SUBST(MOZ_CAN_DRAW_IN_TITLEBAR)
  2306. dnl ========================================================
  2307. dnl = Enable WebRTC code
  2308. dnl ========================================================
  2309. MOZ_ARG_ENABLE_BOOL(webrtc,
  2310. [ --enable-webrtc Enable support for WebRTC],
  2311. MOZ_WEBRTC=1,
  2312. MOZ_WEBRTC=)
  2313. if test -n "$MOZ_WEBRTC"; then
  2314. AC_DEFINE(MOZ_WEBRTC)
  2315. dnl MOZ_WEBRTC_ASSERT_ALWAYS turns on a number of safety asserts in
  2316. dnl opt/production builds (via MOZ_CRASH())
  2317. AC_DEFINE(MOZ_WEBRTC_ASSERT_ALWAYS)
  2318. MOZ_RAW=1
  2319. MOZ_VPX_ERROR_CONCEALMENT=1
  2320. dnl enable once Signaling lands
  2321. MOZ_WEBRTC_SIGNALING=1
  2322. AC_DEFINE(MOZ_WEBRTC_SIGNALING)
  2323. dnl enable once PeerConnection lands
  2324. MOZ_PEERCONNECTION=1
  2325. AC_DEFINE(MOZ_PEERCONNECTION)
  2326. MOZ_SCTP=1
  2327. MOZ_SRTP=1
  2328. AC_DEFINE(MOZ_SCTP)
  2329. AC_DEFINE(MOZ_SRTP)
  2330. if test -n "$MOZ_X11"; then
  2331. MOZ_WEBRTC_X11_LIBS="-lXext -lXdamage -lXfixes -lXcomposite"
  2332. fi
  2333. else
  2334. MOZ_SYNTH_PICO=
  2335. fi
  2336. dnl ========================================================
  2337. dnl = Force hardware AEC, disable webrtc.org AEC
  2338. dnl ========================================================
  2339. MOZ_ARG_ENABLE_BOOL(hardware-aec-ns,
  2340. [ --enable-hardware-aec-ns Enable support for hardware AEC and noise suppression],
  2341. MOZ_WEBRTC_HARDWARE_AEC_NS=1,
  2342. MOZ_WEBRTC_HARDWARE_AEC_NS=)
  2343. if test -n "$MOZ_WEBRTC_HARDWARE_AEC_NS"; then
  2344. AC_DEFINE(MOZ_WEBRTC_HARDWARE_AEC_NS)
  2345. fi
  2346. AC_SUBST(MOZ_WEBRTC)
  2347. AC_SUBST(MOZ_WEBRTC_SIGNALING)
  2348. AC_SUBST(MOZ_PEERCONNECTION)
  2349. AC_SUBST(MOZ_WEBRTC_ASSERT_ALWAYS)
  2350. AC_SUBST(MOZ_WEBRTC_HARDWARE_AEC_NS)
  2351. AC_SUBST(MOZ_SCTP)
  2352. AC_SUBST(MOZ_SRTP)
  2353. AC_SUBST_LIST(MOZ_WEBRTC_X11_LIBS)
  2354. dnl Use integers over floats for audio on Android
  2355. dnl (regarless of the CPU architecture, because audio
  2356. dnl backends for those platforms don't support floats. We also
  2357. dnl use integers on ARM with other OS, because it's more efficient.
  2358. if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
  2359. MOZ_SAMPLE_TYPE_S16=1
  2360. AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
  2361. AC_SUBST(MOZ_SAMPLE_TYPE_S16)
  2362. else
  2363. MOZ_SAMPLE_TYPE_FLOAT32=1
  2364. AC_DEFINE(MOZ_SAMPLE_TYPE_FLOAT32)
  2365. AC_SUBST(MOZ_SAMPLE_TYPE_FLOAT32)
  2366. fi
  2367. dnl ========================================================
  2368. dnl = Enable Raw Codecs
  2369. dnl ========================================================
  2370. MOZ_ARG_ENABLE_BOOL(raw,
  2371. [ --enable-raw Enable support for RAW media],
  2372. MOZ_RAW=1,
  2373. MOZ_RAW=)
  2374. if test -n "$MOZ_RAW"; then
  2375. AC_DEFINE(MOZ_RAW)
  2376. fi
  2377. AC_SUBST(MOZ_RAW)
  2378. dnl ========================================================
  2379. dnl = Enable Libaom AV1 Codec
  2380. dnl ========================================================
  2381. MOZ_ARG_ENABLE_BOOL(av1,
  2382. [ --enable-av1 Enable libaom for av1 video support],
  2383. MOZ_AV1=1,
  2384. MOZ_AV1=)
  2385. if test -n "$MOZ_AV1"; then
  2386. AC_DEFINE(MOZ_AV1)
  2387. fi
  2388. AC_SUBST(MOZ_AV1)
  2389. dnl ========================================================
  2390. dnl = Apple platform decoder support
  2391. dnl ========================================================
  2392. if test "$COMPILE_ENVIRONMENT"; then
  2393. if test -n "$MOZ_APPLEMEDIA"; then
  2394. # hack in frameworks for fmp4 - see bug 1029974
  2395. # We load VideoToolbox and CoreMedia dynamically, so they don't appear here.
  2396. LDFLAGS="$LDFLAGS -framework AudioToolbox"
  2397. dnl Verify CoreMedia is available.
  2398. AC_CHECK_HEADER([CoreMedia/CoreMedia.h], [],
  2399. [AC_MSG_ERROR([MacOS X 10.7 SDK or later is required])])
  2400. fi
  2401. fi # COMPILE_ENVIRONMENT
  2402. dnl ========================================================
  2403. dnl = EME support
  2404. dnl ========================================================
  2405. MOZ_ARG_ENABLE_BOOL(eme,
  2406. [ --enable-eme Enable support for Encrypted Media Extensions ],
  2407. MOZ_EME=1,
  2408. MOZ_EME=)
  2409. if test -n "$MOZ_EME"; then
  2410. if test -z "$MOZ_FMP4"; then
  2411. AC_MSG_ERROR([Encrypted Media Extension support requires Fragmented MP4 support])
  2412. fi
  2413. AC_DEFINE(MOZ_EME)
  2414. fi
  2415. AC_SUBST(MOZ_EME)
  2416. MOZ_LIBVPX_CFLAGS=
  2417. MOZ_LIBVPX_LIBS=
  2418. if test -n "$MOZ_VPX_ERROR_CONCEALMENT" ; then
  2419. AC_DEFINE(MOZ_VPX_ERROR_CONCEALMENT)
  2420. fi
  2421. AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS)
  2422. AC_SUBST_LIST(MOZ_LIBVPX_LIBS)
  2423. if test "$MOZ_SAMPLE_TYPE_FLOAT32"; then
  2424. MOZ_VORBIS=1
  2425. else
  2426. MOZ_TREMOR=1
  2427. fi
  2428. if test -z "$MOZ_SYSTEM_LIBVPX"; then
  2429. dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
  2430. dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32.
  2431. dnl We currently require gcc on all arm platforms.
  2432. dnl See if we have assembly on this platform.
  2433. case "$OS_ARCH:$CPU_ARCH" in
  2434. WINNT:x86_64)
  2435. VPX_USE_YASM=1
  2436. VPX_X86_ASM=1
  2437. ;;
  2438. WINNT:x86)
  2439. dnl Check for yasm 1.1 or greater.
  2440. if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then
  2441. AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
  2442. elif test -n "$COMPILE_ENVIRONMENT" -a "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
  2443. AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
  2444. else
  2445. VPX_USE_YASM=1
  2446. VPX_X86_ASM=1
  2447. dnl The encoder needs obj_int_extract to get asm offsets.
  2448. fi # COMPILE_ENVIRONMENT and others
  2449. ;;
  2450. *:arm*)
  2451. if test -n "$GNU_AS" ; then
  2452. dnl These flags are a lie; they're just used to enable the requisite
  2453. dnl opcodes; actual arch detection is done at runtime.
  2454. VPX_ASFLAGS="-march=armv7-a -mfpu=neon"
  2455. VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
  2456. VPX_ARM_ASM=1
  2457. dnl Building with -mfpu=neon requires either the "softfp" or the
  2458. dnl "hardfp" ABI. Depending on the compiler's default target, and the
  2459. dnl CFLAGS, the default ABI might be neither, in which case it is the
  2460. dnl "softfloat" ABI.
  2461. dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
  2462. dnl we can safely mix code built with both ABIs. So, if we detect
  2463. dnl that compiling uses the "softfloat" ABI, force the use of the
  2464. dnl "softfp" ABI instead.
  2465. dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the
  2466. dnl "softfloat" ABI, not the "softfp" ABI.
  2467. dnl Note: VPX_ASFLAGS is also used in CFLAGS.
  2468. AC_TRY_COMPILE([],
  2469. [#ifndef __SOFTFP__
  2470. #error "compiler target supports -mfpu=neon, so we don't have to add extra flags"
  2471. #endif],
  2472. VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp"
  2473. )
  2474. fi
  2475. ;;
  2476. *:x86)
  2477. if $CC -E -dM -</dev/null | grep -q __ELF__; then
  2478. VPX_USE_YASM=1
  2479. VPX_X86_ASM=1
  2480. fi
  2481. ;;
  2482. *:x86_64)
  2483. if $CC -E -dM -</dev/null | grep -q __ELF__; then
  2484. VPX_USE_YASM=1
  2485. VPX_X86_ASM=1
  2486. fi
  2487. ;;
  2488. esac
  2489. if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_USE_YASM" -a -z "$YASM"; then
  2490. AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
  2491. fi # COMPILE_ENVIRONMENT and others
  2492. if test -n "$VPX_USE_YASM" && test "$OS_ARCH:$CPU_ARCH" != "WINNT:x86_64"; then
  2493. VPX_ASFLAGS="-DPIC"
  2494. fi
  2495. if test -n "$VPX_X86_ASM"; then
  2496. AC_DEFINE(VPX_X86_ASM)
  2497. elif test -n "$VPX_ARM_ASM"; then
  2498. AC_DEFINE(VPX_ARM_ASM)
  2499. else
  2500. AC_MSG_WARN([No assembler or assembly support for libvpx. Using unoptimized C routines.])
  2501. fi
  2502. dnl native libvpx no longer has vpx_mem_set_functions
  2503. AC_DEFINE(MOZ_VPX_NO_MEM_REPORTING)
  2504. fi
  2505. dnl ========================================================
  2506. dnl = Handle dependent MEDIA defines
  2507. dnl ========================================================
  2508. if test -n "$MOZ_VORBIS" -a -n "$MOZ_TREMOR"; then
  2509. AC_MSG_ERROR([MOZ_VORBIS and MOZ_TREMOR are mutually exclusive! The build system should not allow them both to be set, but they are. Please file a bug at https://bugzilla.mozilla.org/])
  2510. fi
  2511. if test -n "$MOZ_VORBIS"; then
  2512. AC_DEFINE(MOZ_VORBIS)
  2513. fi
  2514. if test -n "$MOZ_TREMOR"; then
  2515. AC_DEFINE(MOZ_TREMOR)
  2516. fi
  2517. MOZ_WEBM_ENCODER=1
  2518. AC_DEFINE(MOZ_WEBM_ENCODER)
  2519. AC_SUBST(MOZ_WEBM_ENCODER)
  2520. dnl ==================================
  2521. dnl = Check alsa availability on Linux
  2522. dnl ==================================
  2523. dnl If using Linux, enable the alsa library by default
  2524. if test "$OS_TARGET" = "Linux"; then
  2525. MOZ_ALSA=1
  2526. fi
  2527. MOZ_ARG_ENABLE_BOOL(alsa,
  2528. [ --enable-alsa Enable Alsa support (default on Linux)],
  2529. MOZ_ALSA=1,
  2530. MOZ_ALSA=)
  2531. if test -n "$MOZ_ALSA"; then
  2532. PKG_CHECK_MODULES(MOZ_ALSA, alsa, ,
  2533. [echo "$MOZ_ALSA_PKG_ERRORS"
  2534. AC_MSG_ERROR([You need ALSA for audio output on Linux.])])
  2535. fi
  2536. AC_SUBST(MOZ_ALSA)
  2537. dnl ========================================================
  2538. dnl = Disable PulseAudio
  2539. dnl ========================================================
  2540. dnl If using Desktop Linux, ensure that the PA library is available
  2541. case "$OS_TARGET" in
  2542. WINNT)
  2543. ;;
  2544. *)
  2545. MOZ_PULSEAUDIO=1
  2546. ;;
  2547. esac
  2548. MOZ_ARG_DISABLE_BOOL(pulseaudio,
  2549. [ --disable-pulseaudio Disable PulseAudio support],
  2550. MOZ_PULSEAUDIO=,
  2551. MOZ_PULSEAUDIO=1)
  2552. if test -n "$MOZ_PULSEAUDIO"; then
  2553. AC_DEFINE(MOZ_PULSEAUDIO)
  2554. PKG_CHECK_MODULES(MOZ_PULSEAUDIO, libpulse, ,
  2555. [echo "$MOZ_PULSEAUDIO_PKG_ERRORS"
  2556. AC_MSG_ERROR([Building pulseaudio audio backend requires libpulse development package])])
  2557. fi
  2558. AC_SUBST(MOZ_PULSEAUDIO)
  2559. dnl ========================================================
  2560. dnl = Enable sndio
  2561. dnl ========================================================
  2562. MOZ_ARG_ENABLE_BOOL(sndio,
  2563. [ --enable-sndio Enable sndio support],
  2564. MOZ_SNDIO=1,
  2565. MOZ_SNDIO= )
  2566. if test -n "$MOZ_SNDIO"; then
  2567. AC_DEFINE(MOZ_SNDIO)
  2568. MOZ_CHECK_HEADER([sndio.h], [],
  2569. AC_MSG_ERROR(
  2570. [--enable-sndio specified but it requires sndio development headers]))
  2571. AC_DEFINE(MOZ_SNDIO)
  2572. fi
  2573. AC_SUBST(MOZ_SNDIO)
  2574. dnl ========================================================
  2575. dnl NegotiateAuth
  2576. dnl ========================================================
  2577. MOZ_ARG_DISABLE_BOOL(negotiateauth,
  2578. [ --disable-negotiateauth Disable GSS-API negotiation ],
  2579. MOZ_AUTH_EXTENSION=,
  2580. MOZ_AUTH_EXTENSION=1 )
  2581. if test -n "$MOZ_IOS" -a -n "$MOZ_AUTH_EXTENSION"; then
  2582. AC_MSG_ERROR([negotiateauth is not supported on iOS.])
  2583. fi
  2584. dnl ========================================================
  2585. dnl Pref extensions (autoconfig)
  2586. dnl ========================================================
  2587. MOZ_ARG_DISABLE_BOOL(pref-extensions,
  2588. [ --disable-pref-extensions
  2589. Disable pref extensions such as autoconfig],
  2590. MOZ_PREF_EXTENSIONS=,
  2591. MOZ_PREF_EXTENSIONS=1 )
  2592. dnl ========================================================
  2593. dnl Searching of system directories for extensions.
  2594. dnl Note: this switch is meant to be used for test builds
  2595. dnl whose behavior should not depend on what happens to be
  2596. dnl installed on the local machine.
  2597. dnl ========================================================
  2598. MOZ_ARG_DISABLE_BOOL(system-extension-dirs,
  2599. [ --disable-system-extension-dirs
  2600. Disable searching system- and account-global
  2601. directories for extensions of any kind; use
  2602. only profile-specific extension directories],
  2603. ENABLE_SYSTEM_EXTENSION_DIRS=,
  2604. ENABLE_SYSTEM_EXTENSION_DIRS=1 )
  2605. if test "$ENABLE_SYSTEM_EXTENSION_DIRS"; then
  2606. AC_DEFINE(ENABLE_SYSTEM_EXTENSION_DIRS)
  2607. fi
  2608. dnl ========================================================
  2609. dnl = Universalchardet
  2610. dnl ========================================================
  2611. MOZ_ARG_DISABLE_BOOL(universalchardet,
  2612. [ --disable-universalchardet
  2613. Disable universal encoding detection],
  2614. MOZ_UNIVERSALCHARDET=,
  2615. MOZ_UNIVERSALCHARDET=1 )
  2616. dnl ========================================================
  2617. dnl = ANGLE OpenGL->D3D translator for WebGL
  2618. dnl = * only applies to win32
  2619. dnl ========================================================
  2620. MOZ_ANGLE_RENDERER=
  2621. MOZ_D3D_CPU_SUFFIX=
  2622. MOZ_HAS_WINSDK_WITH_D3D=
  2623. MOZ_D3DCOMPILER_VISTA_DLL=
  2624. MOZ_D3DCOMPILER_VISTA_DLL_PATH=
  2625. if test "$COMPILE_ENVIRONMENT" ; then
  2626. case "$target_os" in
  2627. *mingw*)
  2628. MOZ_ANGLE_RENDERER=1
  2629. ;;
  2630. esac
  2631. # The DirectX SDK libraries are split into x86 and x64 sub-directories
  2632. case "${target_cpu}" in
  2633. i*86)
  2634. MOZ_D3D_CPU_SUFFIX=x86
  2635. ;;
  2636. x86_64)
  2637. MOZ_D3D_CPU_SUFFIX=x64
  2638. ;;
  2639. esac
  2640. # This is potentially set in external mozconfig files; if it's set,
  2641. # then the build exposes the "webgl" context name, which is reserved
  2642. # for conformant implementations.
  2643. if test -n "$MOZ_WEBGL_CONFORMANT"; then
  2644. AC_DEFINE(MOZ_WEBGL_CONFORMANT)
  2645. fi
  2646. dnl ========================================================
  2647. dnl D3D compiler DLL
  2648. dnl ========================================================
  2649. MOZ_FOUND_D3D_COMPILERS=
  2650. if test -n "$MOZ_ANGLE_RENDERER"; then
  2651. if test -z "$MOZ_D3D_CPU_SUFFIX"; then
  2652. AC_MSG_ERROR([Couldn't determine MOZ_D3D_CPU_SUFFIX.])
  2653. fi
  2654. ######################################
  2655. # Find _46+ for use by Vista+.
  2656. # Find a D3D compiler DLL in a Windows SDK.
  2657. MOZ_D3DCOMPILER_VISTA_DLL=
  2658. case "$MOZ_WINSDK_MAXVER" in
  2659. 0x0603*|0x0A00*)
  2660. MOZ_D3DCOMPILER_VISTA_DLL=d3dcompiler_47.dll
  2661. AC_MSG_RESULT([Found D3D compiler in Windows SDK.])
  2662. ;;
  2663. esac
  2664. if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
  2665. # We have a name, now track down the path.
  2666. if test -n "$WINDOWSSDKDIR"; then
  2667. MOZ_D3DCOMPILER_VISTA_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_D3D_CPU_SUFFIX/$MOZ_D3DCOMPILER_VISTA_DLL"
  2668. if test -f "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
  2669. AC_MSG_RESULT([Found MOZ_D3DCOMPILER_VISTA_DLL_PATH: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
  2670. MOZ_HAS_WINSDK_WITH_D3D=1
  2671. else
  2672. AC_MSG_RESULT([MOZ_D3DCOMPILER_VISTA_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_VISTA_DLL_PATH])
  2673. AC_MSG_ERROR([Windows SDK at "$WINDOWSSDKDIR" appears broken. Try updating to MozillaBuild 1.9 final or higher.])
  2674. MOZ_D3DCOMPILER_VISTA_DLL_PATH=
  2675. fi
  2676. else
  2677. AC_MSG_RESULT([Windows SDK not found.])
  2678. fi
  2679. else
  2680. AC_MSG_ERROR([Couldn't find Windows SDK 8.1 or higher needed for ANGLE.])
  2681. fi
  2682. if test -z "$MOZ_D3DCOMPILER_VISTA_DLL_PATH"; then
  2683. MOZ_D3DCOMPILER_VISTA_DLL=
  2684. fi
  2685. # On mingw, check if headers are provided by toolchain.
  2686. if test -n "$GNU_CC"; then
  2687. MOZ_CHECK_HEADER(d3d10.h, MOZ_HAS_WINSDK_WITH_D3D=1)
  2688. fi
  2689. ######################################
  2690. # Check that we found what we needed.
  2691. MOZ_FOUND_A_D3D_COMPILER=
  2692. if test -n "$MOZ_D3DCOMPILER_VISTA_DLL"; then
  2693. MOZ_FOUND_A_D3D_COMPILER=1
  2694. AC_MSG_RESULT([Found d3dcompiler DLL for Vista+: $MOZ_D3DCOMPILER_VISTA_DLL])
  2695. fi
  2696. if test -z "$CROSS_COMPILE"; then
  2697. if test -z "MOZ_FOUND_A_D3D_COMPILER"; then
  2698. AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL.])
  2699. fi
  2700. fi
  2701. fi # MOZ_ANGLE_RENDERER
  2702. fi # COMPILE_ENVIRONMENT
  2703. dnl ========================================================
  2704. dnl Gamepad support
  2705. dnl ========================================================
  2706. MOZ_GAMEPAD_BACKEND=stub
  2707. MOZ_ARG_ENABLE_BOOL(gamepad,
  2708. [ --enable-gamepad Enable gamepad support],
  2709. MOZ_GAMEPAD=1,
  2710. MOZ_GAMEPAD=)
  2711. if test "$MOZ_GAMEPAD"; then
  2712. case "$OS_TARGET" in
  2713. WINNT)
  2714. MOZ_GAMEPAD_BACKEND=windows
  2715. ;;
  2716. Linux)
  2717. MOZ_CHECK_HEADER([linux/joystick.h])
  2718. if test "$ac_cv_header_linux_joystick_h" != "yes"; then
  2719. AC_MSG_ERROR([Can't find header linux/joystick.h, needed for gamepad support. Please install Linux kernel headers or reconfigure with --disable-gamepad to disable gamepad support.])
  2720. fi
  2721. MOZ_GAMEPAD_BACKEND=linux
  2722. ;;
  2723. Android)
  2724. MOZ_GAMEPAD_BACKEND=android
  2725. ;;
  2726. *)
  2727. ;;
  2728. esac
  2729. AC_DEFINE(MOZ_GAMEPAD)
  2730. fi
  2731. AC_SUBST(MOZ_GAMEPAD)
  2732. AC_SUBST(MOZ_GAMEPAD_BACKEND)
  2733. dnl ========================================================
  2734. dnl = libjpeg-turbo configuration
  2735. dnl ========================================================
  2736. MOZ_LIBJPEG_TURBO=
  2737. LIBJPEG_TURBO_USE_YASM=
  2738. if test -z "$MOZ_SYSTEM_JPEG"; then
  2739. MOZ_LIBJPEG_TURBO=1
  2740. fi
  2741. MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
  2742. [ --disable-libjpeg-turbo Disable optimized jpeg decoding routines],
  2743. MOZ_LIBJPEG_TURBO=,
  2744. MOZ_LIBJPEG_TURBO=1)
  2745. if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
  2746. AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
  2747. fi
  2748. dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
  2749. dnl files.
  2750. if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
  2751. dnl Do we support libjpeg-turbo on this platform?
  2752. case "$OS_ARCH:$CPU_ARCH" in
  2753. WINNT:x86)
  2754. LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
  2755. ;;
  2756. WINNT:x86_64)
  2757. LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
  2758. ;;
  2759. *:arm)
  2760. LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
  2761. ;;
  2762. *:aarch64)
  2763. LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
  2764. ;;
  2765. *:mips32)
  2766. LIBJPEG_TURBO_ASFLAGS="-mdspr2"
  2767. ;;
  2768. *:x86)
  2769. if $CC -E -dM -</dev/null | grep -q __ELF__; then
  2770. LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
  2771. fi
  2772. ;;
  2773. *:x86_64)
  2774. if $CC -E -dM -</dev/null | grep -q __ELF__; then
  2775. LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
  2776. fi
  2777. ;;
  2778. esac
  2779. fi
  2780. if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
  2781. case "$CPU_ARCH" in
  2782. dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
  2783. dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
  2784. dnl it doesn't exist or we have too old of a version.
  2785. x86_64|x86)
  2786. LIBJPEG_TURBO_USE_YASM=1
  2787. if test -z "$YASM" ; then
  2788. AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed. Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
  2789. fi
  2790. dnl Check that we have the right yasm version. We require 1.0.1 or newer
  2791. dnl on Linux and 1.1 or newer everywhere else.
  2792. if test "$OS_ARCH" = "Linux" ; then
  2793. if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
  2794. AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
  2795. fi
  2796. else
  2797. if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
  2798. AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder. See https://developer.mozilla.org/en/YASM for more details.])
  2799. fi
  2800. fi
  2801. ;;
  2802. esac
  2803. fi
  2804. dnl ========================================================
  2805. dnl = libav-fft configuration
  2806. dnl ========================================================
  2807. MOZ_LIBAV_FFT=
  2808. dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
  2809. dnl 32-bit linux/os x have text relocation issues.
  2810. case "$OS_ARCH:$CPU_ARCH" in
  2811. WINNT:x86)
  2812. MOZ_LIBAV_FFT=1
  2813. ;;
  2814. *:x86_64)
  2815. MOZ_LIBAV_FFT=1
  2816. ;;
  2817. esac
  2818. dnl Detect if we can use yasm to compile libav's assembly
  2819. if test -n "$MOZ_LIBAV_FFT" -a -n "$COMPILE_ENVIRONMENT"; then
  2820. AC_DEFINE(MOZ_LIBAV_FFT)
  2821. dnl Do we support libav-fft on this platform?
  2822. case "$OS_ARCH:$CPU_ARCH" in
  2823. WINNT:x86)
  2824. LIBAV_FFT_ASFLAGS="-DPIC -DWIN32"
  2825. ;;
  2826. WINNT:x86_64)
  2827. LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
  2828. ;;
  2829. *:x86_64)
  2830. if $CC -E -dM -</dev/null | grep -q __ELF__; then
  2831. LIBAV_FFT_ASFLAGS="-D__x86_64__ -DPIC -DELF"
  2832. fi
  2833. ;;
  2834. *)
  2835. AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
  2836. ;;
  2837. esac
  2838. fi
  2839. if test -n "$LIBAV_FFT_ASFLAGS"; then
  2840. dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
  2841. dnl check for Yasm, and error out if it doesn't exist or we have too old of a
  2842. dnl version.
  2843. if test -z "$YASM" ; then
  2844. AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
  2845. fi
  2846. dnl Check that we have the right yasm version. We require 1.0.1 or newer
  2847. dnl on Linux and 1.1 or newer everywhere else.
  2848. if test "$OS_ARCH" = "Linux" ; then
  2849. if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
  2850. AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
  2851. fi
  2852. else
  2853. if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
  2854. AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
  2855. fi
  2856. fi
  2857. elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
  2858. dnl Warn if we're not building either libav or opendl-max optimized routines.
  2859. AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
  2860. fi
  2861. dnl ========================================================
  2862. dnl = FFmpeg's ffvpx configuration
  2863. dnl ========================================================
  2864. MOZ_FFVPX=
  2865. dnl Build ffvpx on 32-bit Windows and all supported 64-bit platforms.
  2866. dnl 32-bit *nix has performance issues due to not supporting assembly decoder.
  2867. case "$OS_ARCH:$CPU_ARCH" in
  2868. WINNT:x86)
  2869. MOZ_FFVPX=1
  2870. ;;
  2871. *:x86_64)
  2872. MOZ_FFVPX=1
  2873. ;;
  2874. esac
  2875. dnl Use same conditional as MOZ_LIBAV_FFT to enable FFmpeg's ffvpx assembly decoder.
  2876. if test -n "$MOZ_LIBAV_FFT"; then
  2877. FFVPX_ASFLAGS=$LIBAV_FFT_ASFLAGS
  2878. fi
  2879. if test -n "$MOZ_FFVPX"; then
  2880. AC_DEFINE(MOZ_FFVPX)
  2881. fi
  2882. dnl ========================================================
  2883. dnl = Enable compilation of specific extension modules
  2884. dnl ========================================================
  2885. MOZ_ARG_ENABLE_STRING(extensions,
  2886. [ --enable-extensions Enable extensions],
  2887. [ for option in `echo $enableval | sed 's/,/ /g'`; do
  2888. if test "$option" = "yes" -o "$option" = "all"; then
  2889. AC_MSG_ERROR([--enable-extensions=$option is no longer supported.])
  2890. elif test "$option" = "no" -o "$option" = "none"; then
  2891. MOZ_EXTENSIONS=""
  2892. elif test "$option" = "default"; then
  2893. MOZ_EXTENSIONS="$MOZ_EXTENSIONS $MOZ_EXTENSIONS_DEFAULT"
  2894. elif test `echo "$option" | grep -c \^-` != 0; then
  2895. option=`echo $option | sed 's/^-//'`
  2896. MOZ_EXTENSIONS=`echo "$MOZ_EXTENSIONS" | sed "s/ ${option}//"`
  2897. else
  2898. MOZ_EXTENSIONS="$MOZ_EXTENSIONS $option"
  2899. fi
  2900. done],
  2901. MOZ_EXTENSIONS="$MOZ_EXTENSIONS_DEFAULT")
  2902. if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  2903. # Suppress warning on non-X11 platforms
  2904. if test -n "$MOZ_X11"; then
  2905. AC_MSG_WARN([Removing gio from MOZ_EXTENSIONS due to --disable-gio.])
  2906. fi
  2907. MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  2908. fi
  2909. if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
  2910. MOZ_GIO_COMPONENT=1
  2911. MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
  2912. fi
  2913. AC_SUBST(MOZ_GIO_COMPONENT)
  2914. dnl Ensure every extension exists, to avoid mostly-inscrutable error messages
  2915. dnl when trying to build a nonexistent extension.
  2916. for extension in $MOZ_EXTENSIONS; do
  2917. if test ! -d "${srcdir}/extensions/${extension}"; then
  2918. AC_MSG_ERROR([Unrecognized extension provided to --enable-extensions: ${extension}.])
  2919. fi
  2920. done
  2921. if test -n "$MOZ_USE_NATIVE_POPUP_WINDOWS"; then
  2922. AC_DEFINE(MOZ_USE_NATIVE_POPUP_WINDOWS)
  2923. fi
  2924. if test -n "$MOZ_TREE_FREETYPE"; then
  2925. MOZ_ENABLE_CAIRO_FT=1
  2926. FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
  2927. CAIRO_FT_CFLAGS="-I$_topsrcdir/modules/freetype2/include"
  2928. AC_SUBST_LIST(CAIRO_FT_CFLAGS)
  2929. fi
  2930. AC_CHECK_PROGS(WGET, wget, "")
  2931. AC_SUBST(WGET)
  2932. dnl ========================================================
  2933. dnl Bundled fonts on desktop platforms
  2934. dnl ========================================================
  2935. MOZ_ARG_ENABLE_BOOL(bundled-fonts,
  2936. [ --enable-bundled-fonts Enable support for bundled fonts on desktop platforms],
  2937. MOZ_BUNDLED_FONTS=1,
  2938. MOZ_BUNDLED_FONTS=)
  2939. if test -n "$MOZ_BUNDLED_FONTS"; then
  2940. AC_DEFINE(MOZ_BUNDLED_FONTS)
  2941. fi
  2942. AC_SUBST(MOZ_BUNDLED_FONTS)
  2943. dnl ========================================================
  2944. dnl Verify MAR signatures
  2945. dnl ========================================================
  2946. MOZ_ARG_ENABLE_BOOL(verify-mar,
  2947. [ --enable-verify-mar Enable verifying MAR signatures],
  2948. MOZ_VERIFY_MAR_SIGNATURE=1,
  2949. MOZ_VERIFY_MAR_SIGNATURE= )
  2950. if test -n "$MOZ_VERIFY_MAR_SIGNATURE"; then
  2951. AC_DEFINE(MOZ_VERIFY_MAR_SIGNATURE)
  2952. fi
  2953. dnl ========================================================
  2954. dnl Enable building the signmar program.
  2955. dnl This option is much different than the --enable-verify-mar option.
  2956. dnl --enable-verify-mar is for enabling the verification check on MAR
  2957. dnl files in the updater. The --enable-signmar option is for building
  2958. dnl the signmar program.
  2959. dnl ========================================================
  2960. MOZ_ARG_ENABLE_BOOL(signmar,
  2961. [ --enable-signmar Enable building the signmar program],
  2962. MOZ_ENABLE_SIGNMAR=1,
  2963. MOZ_ENABLE_SIGNMAR= )
  2964. if test -n "$MOZ_ENABLE_SIGNMAR"; then
  2965. if test -z "$COMPILE_ENVIRONMENT" ; then
  2966. AC_MSG_WARN([Cannot --enable-signmar with --disable-compile-environment])
  2967. MOZ_ENABLE_SIGNMAR=
  2968. else
  2969. AC_DEFINE(MOZ_ENABLE_SIGNMAR)
  2970. fi
  2971. fi
  2972. dnl ========================================================
  2973. dnl Updater
  2974. dnl ========================================================
  2975. if test "$MOZ_IOS"; then
  2976. MOZ_UPDATER=
  2977. fi
  2978. MOZ_ARG_ENABLE_BOOL(updater,
  2979. [ --enable-updater Enable building of internal updater],
  2980. MOZ_UPDATER=1,
  2981. MOZ_UPDATER= )
  2982. if test -n "$MOZ_UPDATER"; then
  2983. AC_DEFINE(MOZ_UPDATER)
  2984. fi
  2985. dnl ========================================================
  2986. dnl Build the tests?
  2987. dnl ========================================================
  2988. MOZ_ARG_ENABLE_BOOL(tests,
  2989. [ --enable-tests Build test libraries & programs],
  2990. ENABLE_TESTS=1,
  2991. ENABLE_TESTS= )
  2992. if test -n "$ENABLE_TESTS"; then
  2993. GTEST_HAS_RTTI=0
  2994. AC_DEFINE(ENABLE_TESTS)
  2995. AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
  2996. AC_SUBST(GTEST_HAS_RTTI)
  2997. if test -n "$_WIN32_MSVC"; then
  2998. AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
  2999. fi
  3000. if test "${OS_TARGET}" = "Android"; then
  3001. AC_DEFINE(GTEST_OS_LINUX_ANDROID)
  3002. AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
  3003. AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
  3004. AC_SUBST(GTEST_OS_LINUX_ANDROID)
  3005. AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
  3006. AC_SUBST(GTEST_HAS_CLONE)
  3007. fi
  3008. fi
  3009. dnl ========================================================
  3010. dnl parental controls (for Windows Vista)
  3011. dnl ========================================================
  3012. MOZ_ARG_DISABLE_BOOL(parental-controls,
  3013. [ --disable-parental-controls
  3014. Do not build parental controls],
  3015. MOZ_DISABLE_PARENTAL_CONTROLS=1,
  3016. MOZ_DISABLE_PARENTAL_CONTROLS=)
  3017. if test -n "$MOZ_DISABLE_PARENTAL_CONTROLS"; then
  3018. AC_DEFINE(MOZ_DISABLE_PARENTAL_CONTROLS)
  3019. fi
  3020. AC_SUBST(MOZ_DISABLE_PARENTAL_CONTROLS)
  3021. dnl ========================================================
  3022. dnl = Disable smartcard support
  3023. dnl ========================================================
  3024. if test -n "$MOZ_NO_SMART_CARDS"; then
  3025. AC_DEFINE(MOZ_NO_SMART_CARDS)
  3026. fi
  3027. AC_SUBST(MOZ_NO_SMART_CARDS)
  3028. dnl ========================================================
  3029. dnl =
  3030. dnl = Module specific options
  3031. dnl =
  3032. dnl ========================================================
  3033. MOZ_ARG_HEADER(Individual module options)
  3034. dnl ========================================================
  3035. dnl = Disable feed handling components
  3036. dnl ========================================================
  3037. MOZ_ARG_DISABLE_BOOL(feeds,
  3038. [ --disable-feeds Disable feed handling and processing components],
  3039. MOZ_FEEDS=,
  3040. MOZ_FEEDS=1 )
  3041. if test -n "$MOZ_FEEDS"; then
  3042. AC_DEFINE(MOZ_FEEDS)
  3043. else
  3044. if test "$MOZ_BUILD_APP" = "browser"; then
  3045. AC_MSG_ERROR([Cannot build Firefox with --disable-feeds.])
  3046. fi
  3047. fi
  3048. dnl ========================================================
  3049. dnl = Enable Google safe browsing (anti-phishing)
  3050. dnl ========================================================
  3051. MOZ_ARG_ENABLE_BOOL(safe-browsing,
  3052. [ --enable-safe-browsing Enable safe browsing (anti-phishing) implementation],
  3053. MOZ_SAFE_BROWSING=1,
  3054. MOZ_SAFE_BROWSING= )
  3055. if test -n "$MOZ_SAFE_BROWSING"; then
  3056. AC_DEFINE(MOZ_SAFE_BROWSING)
  3057. fi
  3058. AC_SUBST(MOZ_SAFE_BROWSING)
  3059. dnl ========================================================
  3060. dnl = Enable url-classifier
  3061. dnl ========================================================
  3062. dnl Implicitly enabled by default if building with safe-browsing
  3063. if test -n "$MOZ_SAFE_BROWSING"; then
  3064. MOZ_URL_CLASSIFIER=1
  3065. fi
  3066. MOZ_ARG_ENABLE_BOOL(url-classifier,
  3067. [ --enable-url-classifier Enable url classifier module],
  3068. MOZ_URL_CLASSIFIER=1,
  3069. MOZ_URL_CLASSIFIER= )
  3070. if test -n "$MOZ_URL_CLASSIFIER"; then
  3071. AC_DEFINE(MOZ_URL_CLASSIFIER)
  3072. fi
  3073. AC_SUBST(MOZ_URL_CLASSIFIER)
  3074. dnl ========================================================
  3075. dnl = Disable zipwriter
  3076. dnl ========================================================
  3077. MOZ_ARG_DISABLE_BOOL(zipwriter,
  3078. [ --disable-zipwriter Disable zipwriter component],
  3079. MOZ_ZIPWRITER=,
  3080. MOZ_ZIPWRITER=1 )
  3081. AC_SUBST(MOZ_ZIPWRITER)
  3082. dnl ========================================================
  3083. dnl = faststripe theme
  3084. dnl ========================================================
  3085. MOZ_ARG_ENABLE_BOOL(faststripe,
  3086. [ --enable-faststripe Use faststripe theme],
  3087. MOZ_THEME_FASTSTRIPE=1,
  3088. MOZ_THEME_FASTSTRIPE= )
  3089. AC_SUBST(MOZ_THEME_FASTSTRIPE)
  3090. dnl ========================================================
  3091. dnl =
  3092. dnl = Feature options that require extra sources to be pulled
  3093. dnl =
  3094. dnl ========================================================
  3095. dnl MOZ_ARG_HEADER(Features that require extra sources)
  3096. dnl ========================================================
  3097. dnl =
  3098. dnl = Runtime debugging and Optimization Options
  3099. dnl =
  3100. dnl ========================================================
  3101. MOZ_ARG_HEADER(Runtime debugging and Optimizations)
  3102. dnl ========================================================
  3103. dnl = Enable code optimization. ON by default.
  3104. dnl ========================================================
  3105. if test -z "$MOZ_OPTIMIZE_FLAGS"; then
  3106. MOZ_OPTIMIZE_FLAGS="-O"
  3107. fi
  3108. MOZ_ARG_ENABLE_STRING(optimize,
  3109. [ --disable-optimize Disable compiler optimization
  3110. --enable-optimize=[OPT] Specify compiler optimization flags [OPT=-O]],
  3111. [ if test "$enableval" != "no"; then
  3112. MOZ_OPTIMIZE=1
  3113. if test -n "$enableval" -a "$enableval" != "yes"; then
  3114. MOZ_OPTIMIZE_FLAGS=`echo "$enableval" | sed -e 's|\\\ | |g'`
  3115. MOZ_OPTIMIZE=2
  3116. fi
  3117. else
  3118. MOZ_OPTIMIZE=
  3119. fi ], MOZ_OPTIMIZE=1)
  3120. MOZ_SET_FRAMEPTR_FLAGS
  3121. if test "$COMPILE_ENVIRONMENT"; then
  3122. if test -n "$MOZ_OPTIMIZE"; then
  3123. AC_MSG_CHECKING([for valid C compiler optimization flags])
  3124. _SAVE_CFLAGS=$CFLAGS
  3125. CFLAGS="$CFLAGS $MOZ_OPTIMIZE_FLAGS"
  3126. AC_TRY_COMPILE([#include <stdio.h>],
  3127. [printf("Hello World\n");],
  3128. _results=yes,
  3129. _results=no)
  3130. AC_MSG_RESULT([$_results])
  3131. if test "$_results" = "no"; then
  3132. AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
  3133. fi
  3134. CFLAGS=$_SAVE_CFLAGS
  3135. fi
  3136. fi # COMPILE_ENVIRONMENT
  3137. AC_SUBST(MOZ_OPTIMIZE)
  3138. AC_SUBST(MOZ_FRAMEPTR_FLAGS)
  3139. AC_SUBST(MOZ_OPTIMIZE_FLAGS)
  3140. AC_SUBST(MOZ_OPTIMIZE_LDFLAGS)
  3141. AC_SUBST_LIST(MOZ_ALLOW_HEAP_EXECUTE_FLAGS)
  3142. AC_SUBST(MOZ_PGO_OPTIMIZE_FLAGS)
  3143. dnl ========================================================
  3144. dnl = Disable treating compiler warnings as errors
  3145. dnl ========================================================
  3146. if test -z "$MOZ_ENABLE_WARNINGS_AS_ERRORS"; then
  3147. WARNINGS_AS_ERRORS=''
  3148. fi
  3149. dnl ========================================================
  3150. dnl = Enable runtime logging
  3151. dnl ========================================================
  3152. AC_DEFINE(MOZ_LOGGING)
  3153. AC_DEFINE(FORCE_PR_LOG)
  3154. dnl ========================================================
  3155. dnl = This will enable logging of addref, release, ctor, dtor.
  3156. dnl ========================================================
  3157. _ENABLE_LOGREFCNT=42
  3158. MOZ_ARG_ENABLE_BOOL(logrefcnt,
  3159. [ --enable-logrefcnt Enable logging of refcounts (default=debug) ],
  3160. _ENABLE_LOGREFCNT=1,
  3161. _ENABLE_LOGREFCNT= )
  3162. if test "$_ENABLE_LOGREFCNT" = "1"; then
  3163. AC_DEFINE(FORCE_BUILD_REFCNT_LOGGING)
  3164. elif test -z "$_ENABLE_LOGREFCNT"; then
  3165. AC_DEFINE(NO_BUILD_REFCNT_LOGGING)
  3166. fi
  3167. dnl ========================================================
  3168. dnl moz_dump_painting
  3169. dnl ========================================================
  3170. MOZ_ARG_ENABLE_BOOL(dump-painting,
  3171. [ --enable-dump-painting Enable paint debugging.],
  3172. MOZ_DUMP_PAINTING=1,
  3173. MOZ_DUMP_PAINTING= )
  3174. if test -n "$MOZ_DUMP_PAINTING"; then
  3175. AC_DEFINE(MOZ_DUMP_PAINTING)
  3176. AC_DEFINE(MOZ_LAYERS_HAVE_LOG)
  3177. fi
  3178. if test -n "$MOZ_DEBUG"; then
  3179. AC_DEFINE(MOZ_DUMP_PAINTING)
  3180. fi
  3181. case "${OS_TARGET}" in
  3182. WINNT)
  3183. MOZ_GLUE_IN_PROGRAM=
  3184. ;;
  3185. *)
  3186. dnl On !Windows, we only want to link executables against mozglue
  3187. MOZ_GLUE_IN_PROGRAM=1
  3188. AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
  3189. ;;
  3190. esac
  3191. if test -n "$MOZ_REPLACE_MALLOC"; then
  3192. dnl Replace-malloc Mac linkage quirks
  3193. if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
  3194. AC_CACHE_CHECK([how to do weak dynamic linking],
  3195. ac_cv_weak_dynamic_linking,
  3196. [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
  3197. if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
  3198. test -s conftest${DLL_SUFFIX}; then
  3199. dnl There are several ways the linker can put link edit rules in a binary:
  3200. dnl - classic info only (for OSX < 10.6)
  3201. dnl - dyld info only
  3202. dnl - both
  3203. if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
  3204. _CLASSIC_INFO=
  3205. else
  3206. _CLASSIC_INFO=1
  3207. fi
  3208. if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
  3209. _DYLD_INFO=1
  3210. else
  3211. _DYLD_INFO=
  3212. fi
  3213. dnl With classic info, we need to build with -flat_namespace.
  3214. dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
  3215. dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
  3216. dnl forgets to set the weak flag in the dyld info.
  3217. dnl See http://glandium.org/blog/?p=2764 for more details.
  3218. dnl
  3219. dnl Values for ac_cv_weak_dynamic_linking, and subsequently
  3220. dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
  3221. dnl - "flat namespace" when -flat_namespace alone is needed
  3222. dnl - "dummy library" when a dummy library and -flat_namespace are needed
  3223. dnl - "compiler support" when nothing is needed
  3224. if test -n "$_DYLD_INFO" && dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
  3225. if test -n "$_CLASSIC_INFO"; then
  3226. ac_cv_weak_dynamic_linking="flat namespace"
  3227. else
  3228. ac_cv_weak_dynamic_linking="compiler support"
  3229. fi
  3230. else
  3231. if test -n "$_DYLD_INFO"; then
  3232. ac_cv_weak_dynamic_linking="dummy library"
  3233. else
  3234. ac_cv_weak_dynamic_linking="flat namespace"
  3235. fi
  3236. fi
  3237. else
  3238. AC_ERROR([couldn't compile a simple C file])
  3239. fi
  3240. rm -rf conftest*])
  3241. MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
  3242. fi
  3243. fi
  3244. AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
  3245. dnl ========================================================
  3246. dnl = Jemalloc build setup
  3247. dnl ========================================================
  3248. if test -z "$MOZ_MEMORY"; then
  3249. case "${target}" in
  3250. *-mingw*)
  3251. if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
  3252. AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])
  3253. fi
  3254. ;;
  3255. esac
  3256. else
  3257. if test "x$MOZ_DEBUG" = "x1"; then
  3258. AC_DEFINE(MOZ_MEMORY_DEBUG)
  3259. fi
  3260. dnl The generic feature tests that determine how to compute ncpus are long and
  3261. dnl complicated. Therefore, simply define special cpp variables for the
  3262. dnl platforms we have special knowledge of.
  3263. case "${target}" in
  3264. *-mingw*)
  3265. export MOZ_NO_DEBUG_RTL=1
  3266. ;;
  3267. esac
  3268. fi # MOZ_MEMORY
  3269. AC_SUBST(MOZ_GLUE_IN_PROGRAM)
  3270. # Allow the application to provide a subconfigure script.
  3271. # This should be after 'export MOZ_NO_DEBUG_RTL=1' since
  3272. # ldap/c-sdk/configure refers to the enviroment value.
  3273. if test -f "${srcdir}/${MOZ_BUILD_APP}/configure.in" ; then
  3274. do_output_subdirs() {
  3275. if test -n "$_subconfigure_subdirs"; then
  3276. AC_MSG_ERROR([Cannot specify more than one sub-sub-configure])
  3277. fi
  3278. _subconfigure_subdir="$1"
  3279. _subconfigure_config_args="$ac_configure_args"
  3280. }
  3281. tmpscript=`$PYTHON -c 'import os, tempfile; print tempfile.mktemp(prefix="subscript.").replace(os.sep, "/")'` || exit 1
  3282. ${TOOLCHAIN_PREFIX}m4 "${srcdir}/build/autoconf/subconfigure.m4" \
  3283. "${srcdir}/build/autoconf/altoptions.m4" \
  3284. "${srcdir}/${MOZ_BUILD_APP}/configure.in" > $tmpscript
  3285. . $tmpscript
  3286. rm -f $tmpscript
  3287. fi
  3288. AC_SUBST_LIST(MOZ_GLUE_WRAP_LDFLAGS)
  3289. export MOZ_GLUE_WRAP_LDFLAGS
  3290. dnl ========================================================
  3291. dnl = Enable using the clang plugin to build
  3292. dnl ========================================================
  3293. MOZ_CONFIG_CLANG_PLUGIN
  3294. dnl ========================================================
  3295. dnl = Enable stripping of libs & executables
  3296. dnl ========================================================
  3297. MOZ_ARG_ENABLE_BOOL(strip,
  3298. [ --enable-strip Enable stripping of libs & executables ],
  3299. ENABLE_STRIP=1,
  3300. ENABLE_STRIP= )
  3301. dnl ========================================================
  3302. dnl = Enable stripping of libs & executables when packaging
  3303. dnl ========================================================
  3304. MOZ_ARG_ENABLE_BOOL(install-strip,
  3305. [ --enable-install-strip Enable stripping of libs & executables when packaging ],
  3306. PKG_SKIP_STRIP= ,
  3307. PKG_SKIP_STRIP=1)
  3308. dnl ========================================================
  3309. dnl = --disable-elf-hack
  3310. dnl ========================================================
  3311. USE_ELF_HACK=1
  3312. MOZ_ARG_DISABLE_BOOL(elf-hack,
  3313. [ --disable-elf-hack Disable elf hacks],
  3314. [USE_ELF_HACK=],
  3315. [USE_ELF_HACK=1])
  3316. # Only enable elfhack where supported
  3317. if test "$USE_ELF_HACK" = 1; then
  3318. case "${HOST_OS_ARCH},${OS_ARCH}" in
  3319. Linux,Linux)
  3320. case "${CPU_ARCH}" in
  3321. arm | x86 | x86_64)
  3322. USE_ELF_HACK=1
  3323. ;;
  3324. *)
  3325. USE_ELF_HACK=
  3326. ;;
  3327. esac
  3328. ;;
  3329. *)
  3330. USE_ELF_HACK=
  3331. ;;
  3332. esac
  3333. fi
  3334. if test -n "$COMPILE_ENVIRONMENT" -a -n "$USE_ELF_HACK"; then
  3335. dnl PT_GNU_RELRO segment makes the dynamic linker set a read-only flag on
  3336. dnl memory addresses it maps to. The result is that by the time elfhack
  3337. dnl kicks in, it is not possible to apply relocations because of that,
  3338. dnl thus elfhack effectively skips relocations inside the PT_GNU_RELRO
  3339. dnl segment. It makes elfhack mostly useless, so considering the problems
  3340. dnl we have we PT_GNU_RELRO (e.g. bug 664366), and until elfhack can deal
  3341. dnl with PT_GNU_RELRO segments, it's just simpler to disable elfhack when
  3342. dnl the linker creates PT_GNU_RELRO segments. However, when we do want
  3343. dnl elfhack enabled, disable PT_GNU_RELRO instead.
  3344. AC_CACHE_CHECK([whether linker creates PT_GNU_RELRO segments],
  3345. LINK_WITH_PT_GNU_RELRO,
  3346. [echo "int main() {return 0;}" > conftest.${ac_ext}
  3347. if AC_TRY_COMMAND(${CC-cc} -o conftest${ac_exeext} $LDFLAGS conftest.${ac_ext} $LIBS 1>&2) &&
  3348. test -s conftest${ac_exeext}; then
  3349. if ${TOOLCHAIN_PREFIX}readelf -l conftest${ac_exeext} | grep GNU_RELRO > /dev/null; then
  3350. LINK_WITH_PT_GNU_RELRO=yes
  3351. else
  3352. LINK_WITH_PT_GNU_RELRO=no
  3353. fi
  3354. else
  3355. dnl We really don't expect to get here, but just in case
  3356. AC_ERROR([couldn't compile a simple C file])
  3357. fi
  3358. rm -rf conftest*])
  3359. if test "$LINK_WITH_PT_GNU_RELRO" = yes; then
  3360. if test "$USE_ELF_HACK" = F; then
  3361. AC_MSG_CHECKING([for -z norelro option to ld])
  3362. _SAVE_LDFLAGS=$LDFLAGS
  3363. LDFLAGS="$LDFLAGS -Wl,-z,norelro"
  3364. AC_TRY_LINK(,,AC_MSG_RESULT([yes])
  3365. [NSPR_LDFLAGS="$NSPR_LDFLAGS -Wl,-z,norelro"],
  3366. AC_ERROR([--enable-elf-hack is not compatible with a linker creating a PT_GNU_RELRO segment and that doesn't support the "-z norelro" option.]))
  3367. USE_ELF_HACK=1
  3368. else
  3369. AC_MSG_WARN([Disabling elfhack])
  3370. USE_ELF_HACK=
  3371. fi
  3372. fi
  3373. fi # COMPILE_ENVIRONMENT and others.
  3374. dnl ========================================================
  3375. dnl = libstdc++ compatibility hacks
  3376. dnl ========================================================
  3377. STDCXX_COMPAT=
  3378. MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
  3379. [ --enable-stdcxx-compat Enable compatibility with older libstdc++],
  3380. STDCXX_COMPAT=1)
  3381. if test -n "$STDCXX_COMPAT"; then
  3382. eval $(CXX="$CXX" HOST_CXX="$HOST_CXX" $PYTHON -m mozbuild.configure.libstdcxx)
  3383. AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
  3384. AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
  3385. CXXFLAGS="$CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
  3386. HOST_CXXFLAGS="$HOST_CXXFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
  3387. fi
  3388. dnl ========================================================
  3389. dnl = frontend JS debug mode
  3390. dnl ========================================================
  3391. MOZ_ARG_ENABLE_BOOL(debug-js-modules,
  3392. [ --enable-debug-js-modules Enable debug mode for frontend JS libraries],
  3393. DEBUG_JS_MODULES=1,
  3394. DEBUG_JS_MODULES=)
  3395. AC_SUBST(DEBUG_JS_MODULES)
  3396. dnl ========================================================
  3397. dnl = Don't precompile the startup cache
  3398. dnl ========================================================
  3399. MOZ_DISABLE_PRECOMPILED_STARTUPCACHE=
  3400. MOZ_ARG_DISABLE_BOOL(precompiled-startupcache,
  3401. [ --disable-precompiled-startupcache Don't precompile the startup cache ],
  3402. MOZ_DISABLE_PRECOMPILED_STARTUPCACHE=1,
  3403. MOZ_DISABLE_PRECOMPILED_STARTUPCACHE= )
  3404. if test -n "$MOZ_DISABLE_PRECOMPILED_STARTUPCACHE"; then
  3405. AC_DEFINE(MOZ_DISABLE_PRECOMPILED_STARTUPCACHE)
  3406. fi
  3407. AC_SUBST(MOZ_DISABLE_PRECOMPILED_STARTUPCACHE)
  3408. dnl ========================================================
  3409. dnl =
  3410. dnl = Profiling and Instrumenting
  3411. dnl =
  3412. dnl ========================================================
  3413. MOZ_ARG_HEADER(Profiling and Instrumenting)
  3414. dnl ========================================================
  3415. dnl = Enable TaskTracer
  3416. dnl ========================================================
  3417. MOZ_ARG_ENABLE_BOOL(tasktracer,
  3418. [ --enable-tasktracer Set compile flags necessary for using TaskTracer],
  3419. MOZ_TASK_TRACER=1,
  3420. MOZ_TASK_TRACER= )
  3421. if test -n "$MOZ_TASK_TRACER"; then
  3422. AC_DEFINE(MOZ_TASK_TRACER)
  3423. AC_SUBST(MOZ_TASK_TRACER)
  3424. fi
  3425. dnl ========================================================
  3426. dnl Turn on reflow counting
  3427. dnl ========================================================
  3428. MOZ_ARG_ENABLE_BOOL(reflow-perf,
  3429. [ --enable-reflow-perf Enable reflow performance tracing],
  3430. MOZ_REFLOW_PERF=1,
  3431. MOZ_REFLOW_PERF= )
  3432. if test -n "$MOZ_REFLOW_PERF"; then
  3433. AC_DEFINE(MOZ_REFLOW_PERF)
  3434. fi
  3435. dnl ========================================================
  3436. dnl = Horizon build options - set default preferences for
  3437. dnl the horizon project. Horizon is a browser built on
  3438. dnl top of the graphene runtime.
  3439. dnl ========================================================
  3440. if test -n "$MOZ_HORIZON"; then
  3441. AC_DEFINE(MOZ_HORIZON)
  3442. fi
  3443. AC_SUBST(MOZ_HORIZON)
  3444. dnl ========================================================
  3445. dnl = Offer a way to disable the startup cache
  3446. dnl ========================================================
  3447. MOZ_ARG_DISABLE_BOOL(startupcache,
  3448. [ --disable-startupcache Disable startup cache ],
  3449. MOZ_DISABLE_STARTUPCACHE=1,
  3450. MOZ_DISABLE_STARTUPCACHE=)
  3451. if test -n "$MOZ_DISABLE_STARTUPCACHE"; then
  3452. AC_DEFINE(MOZ_DISABLE_STARTUPCACHE)
  3453. fi
  3454. AC_SUBST(MOZ_DISABLE_STARTUPCACHE)
  3455. dnl =========================================
  3456. dnl = Enable packaging Gaia with B2G desktop
  3457. dnl =========================================
  3458. if test -n "$GAIADIR" -a ! -d "$GAIADIR" ; then
  3459. AC_MSG_ERROR([GAIADIR '$GAIADIR' isn't a valid directory])
  3460. fi
  3461. AC_SUBST(GAIADIR)
  3462. if test -n "$GAIADIR" ; then
  3463. AC_DEFINE(PACKAGE_GAIA)
  3464. fi
  3465. if test -n "$FXOS_SIMULATOR" -a -z "$GAIADIR" ; then
  3466. AC_MSG_ERROR([FXOS_SIMULATOR=1 requires GAIADIR to be defined])
  3467. fi
  3468. if test -n "$FXOS_SIMULATOR" ; then
  3469. AC_DEFINE(FXOS_SIMULATOR)
  3470. AC_SUBST(FXOS_SIMULATOR)
  3471. fi
  3472. dnl ========================================================
  3473. dnl = Enable Pico Speech Synthesis
  3474. dnl ========================================================
  3475. MOZ_ARG_ENABLE_BOOL(synth-pico,
  3476. [ --enable-synth-pico Set compile flags necessary for compiling Pico Web Speech API ],
  3477. MOZ_SYNTH_PICO=1,
  3478. MOZ_SYNTH_PICO= )
  3479. if test -n "$MOZ_SYNTH_PICO"; then
  3480. AC_DEFINE(MOZ_SYNTH_PICO)
  3481. fi
  3482. AC_SUBST(MOZ_SYNTH_PICO)
  3483. dnl ========================================================
  3484. dnl = Enable Support for Time Manager API
  3485. dnl ========================================================
  3486. if test -n "$MOZ_TIME_MANAGER"; then
  3487. AC_DEFINE(MOZ_TIME_MANAGER)
  3488. fi
  3489. AC_SUBST(MOZ_TIME_MANAGER)
  3490. dnl ========================================================
  3491. dnl = Enable Support for AudioChannelManager API
  3492. dnl ========================================================
  3493. if test -n "$MOZ_AUDIO_CHANNEL_MANAGER"; then
  3494. AC_DEFINE(MOZ_AUDIO_CHANNEL_MANAGER)
  3495. fi
  3496. AC_SUBST(MOZ_AUDIO_CHANNEL_MANAGER)
  3497. dnl ========================================================
  3498. dnl = Enable Support for Secure Element API
  3499. dnl ========================================================
  3500. MOZ_SECUREELEMENT=1,
  3501. if test -n "$MOZ_SECUREELEMENT"; then
  3502. AC_DEFINE(MOZ_SECUREELEMENT)
  3503. fi
  3504. AC_SUBST(MOZ_SECUREELEMENT)
  3505. dnl ========================================================
  3506. dnl = Support for demangling undefined symbols
  3507. dnl ========================================================
  3508. if test -z "$SKIP_LIBRARY_CHECKS"; then
  3509. AC_LANG_SAVE
  3510. AC_LANG_CPLUSPLUS
  3511. AC_CHECK_FUNCS(__cxa_demangle, HAVE_DEMANGLE=1, HAVE_DEMANGLE=)
  3512. AC_LANG_RESTORE
  3513. fi
  3514. # Demangle only for debug or DMD builds
  3515. MOZ_DEMANGLE_SYMBOLS=
  3516. if test "$HAVE_DEMANGLE" && test "$MOZ_DEBUG"; then
  3517. MOZ_DEMANGLE_SYMBOLS=1
  3518. AC_DEFINE(MOZ_DEMANGLE_SYMBOLS)
  3519. fi
  3520. AC_SUBST(MOZ_DEMANGLE_SYMBOLS)
  3521. dnl ========================================================
  3522. dnl = Support for gcc stack unwinding (from gcc 3.3)
  3523. dnl ========================================================
  3524. if test -z "$SKIP_LIBRARY_CHECKS"; then
  3525. AC_LANG_SAVE
  3526. AC_LANG_CPLUSPLUS
  3527. MOZ_CHECK_HEADER(unwind.h, AC_CHECK_FUNCS(_Unwind_Backtrace))
  3528. AC_LANG_RESTORE
  3529. fi
  3530. dnl ========================================================
  3531. dnl JIT observers
  3532. dnl ========================================================
  3533. MOZ_ARG_WITH_STRING(jitreport-granularity,
  3534. [ --jitreport-granularity=N
  3535. Default granularity at which to report JIT code
  3536. to external tools
  3537. 0 - no info
  3538. 1 - code ranges for whole functions only
  3539. 2 - per-line information
  3540. 3 - per-op information],
  3541. JITREPORT_GRANULARITY=$withval,
  3542. JITREPORT_GRANULARITY=3)
  3543. AC_DEFINE_UNQUOTED(JS_DEFAULT_JITREPORT_GRANULARITY, $JITREPORT_GRANULARITY)
  3544. dnl ========================================================
  3545. dnl = Disable Mozilla's versions of RIL and Geolocation
  3546. dnl ========================================================
  3547. MOZ_ARG_DISABLE_BOOL(mozril-geoloc,
  3548. [ --disable-mozril-geoloc Disable Mozilla's RIL and geolocation],
  3549. DISABLE_MOZ_RIL_GEOLOC=1,
  3550. DISABLE_MOZ_RIL_GEOLOC= )
  3551. if test -n "$DISABLE_MOZ_RIL_GEOLOC"; then
  3552. AC_DEFINE(DISABLE_MOZ_RIL_GEOLOC)
  3553. fi
  3554. AC_SUBST(DISABLE_MOZ_RIL_GEOLOC)
  3555. dnl ========================================================
  3556. dnl =
  3557. dnl = Misc. Options
  3558. dnl =
  3559. dnl ========================================================
  3560. MOZ_ARG_HEADER(Misc. Options)
  3561. dnl =========================================================
  3562. dnl = Chrome format
  3563. dnl =========================================================
  3564. MOZ_ARG_ENABLE_STRING([chrome-format],
  3565. [ --enable-chrome-format=jar|flat|omni
  3566. Select FORMAT of chrome files during packaging],
  3567. MOZ_CHROME_FILE_FORMAT=`echo $enableval | tr A-Z a-z`)
  3568. if test -z "$MOZ_CHROME_FILE_FORMAT"; then
  3569. MOZ_CHROME_FILE_FORMAT=omni
  3570. fi
  3571. if test "$MOZ_CHROME_FILE_FORMAT" = "symlink"; then
  3572. AC_MSG_ERROR([--enable-chrome-format=symlink has been deprecated. It is now used by default in $DIST/bin on platforms that support it])
  3573. fi
  3574. if test "$MOZ_CHROME_FILE_FORMAT" != "jar" &&
  3575. test "$MOZ_CHROME_FILE_FORMAT" != "flat" &&
  3576. test "$MOZ_CHROME_FILE_FORMAT" != "omni"; then
  3577. AC_MSG_ERROR([--enable-chrome-format must be set to either jar, flat, or omni])
  3578. fi
  3579. dnl =========================================================
  3580. dnl = Chrome compression
  3581. dnl =========================================================
  3582. MOZ_ARG_ENABLE_STRING([chrome-compression],
  3583. [ --enable-chrome-compression=none|deflate|brotli
  3584. Select COMPRESSION type of chrome files during packaging],
  3585. JAR_COMPRESSION=`echo $enableval | tr A-Z a-z`)
  3586. if test -z "$JAR_COMPRESSION"; then
  3587. JAR_COMPRESSION=deflate
  3588. fi
  3589. if test "$JAR_COMPRESSION" != "none" &&
  3590. test "$JAR_COMPRESSION" != "deflate" &&
  3591. test "$JAR_COMPRESSION" != "brotli"; then
  3592. AC_MSG_ERROR([--enable-chrome-compression must be set to either none, deflate, or brotli])
  3593. fi
  3594. dnl =========================================================
  3595. dnl Omnijar packaging (bug 552121)
  3596. dnl =========================================================
  3597. dnl Omnijar packaging is compatible with flat packaging.
  3598. dnl In unpackaged builds, omnijar looks for files as if
  3599. dnl things were flat packaged. After packaging, all files
  3600. dnl are loaded from a single jar. MOZ_CHROME_FILE_FORMAT
  3601. dnl is set to flat since putting files into jars is only
  3602. dnl done during packaging with omnijar.
  3603. if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
  3604. MOZ_OMNIJAR=1
  3605. AC_DEFINE(MOZ_OMNIJAR)
  3606. fi
  3607. # Allow someone to change OMNIJAR_NAME in mozconfig
  3608. MOZ_ARG_WITH_STRING(chrome-name,
  3609. [ --with-chrome-name=CHROMENAME
  3610. Set chrome jar name (default=omni.ja)],
  3611. [ val=`echo $withval`
  3612. OMNIJAR_NAME="$val"])
  3613. # Default Omni Jar Name
  3614. if test -z "$OMNIJAR_NAME" ; then
  3615. OMNIJAR_NAME=omni.ja
  3616. fi
  3617. MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
  3618. if test "$OS_ARCH" = "WINNT"; then
  3619. MOZ_CHROME_FILE_FORMAT=flat
  3620. else
  3621. MOZ_CHROME_FILE_FORMAT=symlink
  3622. fi
  3623. AC_SUBST(JAR_COMPRESSION)
  3624. AC_SUBST(OMNIJAR_NAME)
  3625. AC_SUBST(MOZ_OMNIJAR)
  3626. AC_SUBST(MOZ_PACKAGER_FORMAT)
  3627. AC_SUBST(MOZ_CHROME_FILE_FORMAT)
  3628. dnl ========================================================
  3629. dnl = Disable Jetpack
  3630. dnl ========================================================
  3631. MOZ_ARG_DISABLE_BOOL(jetpack,
  3632. [ --disable-jetpack Disable Jetpack Support Code],
  3633. MOZ_JETPACK=,
  3634. MOZ_JETPACK=1)
  3635. if test -n "$MOZ_JETPACK"; then
  3636. AC_DEFINE(MOZ_JETPACK)
  3637. fi
  3638. AC_SUBST(MOZ_JETPACK)
  3639. dnl ========================================================
  3640. dnl = Disable Mozilla Developer Tools (server)
  3641. dnl ========================================================
  3642. MOZ_ARG_DISABLE_BOOL(devtools-server,
  3643. [ --disable-devtools-server Disable Mozilla Developer Tools (server)],
  3644. MOZ_DEVTOOLS_SERVER=,
  3645. MOZ_DEVTOOLS_SERVER=1)
  3646. if test -n "$MOZ_DEVTOOLS_SERVER"; then
  3647. if test ! -n "$MOZ_JETPACK"; then
  3648. AC_MSG_ERROR("Jetpack is required to include the Developer Tools Server")
  3649. fi
  3650. AC_DEFINE(MOZ_DEVTOOLS_SERVER)
  3651. fi
  3652. AC_SUBST(MOZ_DEVTOOLS_SERVER)
  3653. dnl ========================================================
  3654. dnl = Disable Mozilla Developer Tools (client)
  3655. dnl ========================================================
  3656. MOZ_ARG_ENABLE_BOOL(devtools,
  3657. [ --enable-devtools Enable Mozilla Developer Tools (client)],
  3658. MOZ_DEVTOOLS=1,
  3659. MOZ_DEVTOOLS=)
  3660. if test -n "$MOZ_DEVTOOLS"; then
  3661. if test ! -n "$MOZ_DEVTOOLS_SERVER"; then
  3662. AC_MSG_ERROR("The Developer Tools Server is required to include the client")
  3663. fi
  3664. AC_DEFINE(MOZ_DEVTOOLS)
  3665. fi
  3666. AC_SUBST(MOZ_DEVTOOLS)
  3667. dnl ========================================================
  3668. dnl = Disable nsUserInfo
  3669. dnl ========================================================
  3670. MOZ_ARG_DISABLE_BOOL(userinfo,
  3671. [ --disable-userinfo Disable nsUserInfo (default=enabled)],
  3672. MOZ_USERINFO=,
  3673. MOZ_USERINFO=1)
  3674. if test -n "$MOZ_USERINFO"; then
  3675. AC_DEFINE(MOZ_USERINFO)
  3676. fi
  3677. AC_SUBST(MOZ_USERINFO)
  3678. dnl ========================================================
  3679. dnl = Define default location for MOZILLA_FIVE_HOME
  3680. dnl ========================================================
  3681. MOZ_ARG_WITH_STRING(default-mozilla-five-home,
  3682. [ --with-default-mozilla-five-home
  3683. Set the default value for MOZILLA_FIVE_HOME],
  3684. [ val=`echo $withval`
  3685. AC_DEFINE_UNQUOTED(MOZ_DEFAULT_MOZILLA_FIVE_HOME,"$val") ])
  3686. dnl ========================================================
  3687. dnl = Location of the mozilla user directory (default is ~/.mozilla).],
  3688. dnl ========================================================
  3689. MOZ_ARG_WITH_STRING(user-appdir,
  3690. [ --with-user-appdir=DIR Set user-specific appdir (default=.mozilla)],
  3691. [ val=`echo $withval`
  3692. if echo "$val" | grep "\/" >/dev/null; then
  3693. AC_MSG_ERROR("Homedir must be single relative path.")
  3694. else
  3695. MOZ_USER_DIR="$val"
  3696. fi])
  3697. AC_DEFINE_UNQUOTED(MOZ_USER_DIR,"$MOZ_USER_DIR")
  3698. dnl ========================================================
  3699. dnl = Doxygen configuration
  3700. dnl ========================================================
  3701. dnl Use commas to specify multiple dirs to this arg
  3702. MOZ_DOC_INPUT_DIRS='./dist/include ./dist/idl'
  3703. MOZ_ARG_WITH_STRING(doc-input-dirs,
  3704. [ --with-doc-input-dirs=DIRS
  3705. Header/idl dirs to create docs from],
  3706. [ MOZ_DOC_INPUT_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
  3707. AC_SUBST(MOZ_DOC_INPUT_DIRS)
  3708. dnl Use commas to specify multiple dirs to this arg
  3709. MOZ_DOC_INCLUDE_DIRS='./dist/include ./dist/include/nspr'
  3710. MOZ_ARG_WITH_STRING(doc-include-dirs,
  3711. [ --with-doc-include-dirs=DIRS
  3712. Include dirs to preprocess doc headers],
  3713. [ MOZ_DOC_INCLUDE_DIRS=`echo "$withval" | sed "s/,/ /g"` ] )
  3714. AC_SUBST(MOZ_DOC_INCLUDE_DIRS)
  3715. MOZ_DOC_OUTPUT_DIR='./dist/docs'
  3716. MOZ_ARG_WITH_STRING(doc-output-dir,
  3717. [ --with-doc-output-dir=DIR
  3718. Dir to generate docs into],
  3719. [ MOZ_DOC_OUTPUT_DIR=$withval ] )
  3720. AC_SUBST(MOZ_DOC_OUTPUT_DIR)
  3721. if test -z "$SKIP_COMPILER_CHECKS"; then
  3722. dnl ========================================================
  3723. dnl =
  3724. dnl = Compiler Options
  3725. dnl =
  3726. dnl ========================================================
  3727. MOZ_ARG_HEADER(Compiler Options)
  3728. dnl ========================================================
  3729. dnl Check for gcc -pipe support
  3730. dnl ========================================================
  3731. AC_MSG_CHECKING([for -pipe support])
  3732. if test -n "$GNU_CC" -a -n "$GNU_CXX"; then
  3733. dnl Any gcc that supports firefox supports -pipe.
  3734. CFLAGS="$CFLAGS -pipe"
  3735. CXXFLAGS="$CXXFLAGS -pipe"
  3736. AC_MSG_RESULT([yes])
  3737. else
  3738. AC_MSG_RESULT([no])
  3739. fi
  3740. dnl ========================================================
  3741. dnl Profile guided optimization (gcc checks)
  3742. dnl ========================================================
  3743. dnl Test for profiling options
  3744. dnl Under gcc 3.4+, use -fprofile-generate/-fprofile-use
  3745. _SAVE_CFLAGS="$CFLAGS"
  3746. CFLAGS="$CFLAGS -fprofile-generate -fprofile-correction"
  3747. AC_MSG_CHECKING([whether C compiler supports -fprofile-generate])
  3748. AC_TRY_COMPILE([], [return 0;],
  3749. [ PROFILE_GEN_CFLAGS="-fprofile-generate"
  3750. result="yes" ], result="no")
  3751. AC_MSG_RESULT([$result])
  3752. if test $result = "yes"; then
  3753. PROFILE_GEN_LDFLAGS="-fprofile-generate"
  3754. PROFILE_USE_CFLAGS="-fprofile-use -fprofile-correction -Wcoverage-mismatch"
  3755. PROFILE_USE_LDFLAGS="-fprofile-use"
  3756. fi
  3757. CFLAGS="$_SAVE_CFLAGS"
  3758. AC_SUBST(PROFILE_GEN_CFLAGS)
  3759. AC_SUBST(PROFILE_GEN_LDFLAGS)
  3760. AC_SUBST(PROFILE_USE_CFLAGS)
  3761. AC_SUBST(PROFILE_USE_LDFLAGS)
  3762. fi # ! SKIP_COMPILER_CHECKS
  3763. AC_DEFINE(CPP_THROW_NEW, [throw()])
  3764. AC_LANG_C
  3765. if test "$COMPILE_ENVIRONMENT"; then
  3766. MOZ_EXPAND_LIBS
  3767. fi # COMPILE_ENVIRONMENT
  3768. dnl ========================================================
  3769. dnl =
  3770. dnl = Build depencency options
  3771. dnl =
  3772. dnl ========================================================
  3773. MOZ_ARG_HEADER(Build dependencies)
  3774. if test "$GNU_CC" -a "$GNU_CXX"; then
  3775. _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
  3776. else
  3777. dnl Don't override this for MSVC
  3778. if test -z "$_WIN32_MSVC"; then
  3779. _USE_CPP_INCLUDE_FLAG=
  3780. _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  3781. _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
  3782. else
  3783. echo '#include <stdio.h>' > dummy-hello.c
  3784. changequote(,)
  3785. dnl This output is localized, split at the first double space or colon and space.
  3786. _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
  3787. CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
  3788. _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
  3789. changequote([,])
  3790. if ! test -e "$_CL_STDIO_PATH"; then
  3791. AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
  3792. fi
  3793. if test -z "$CL_INCLUDES_PREFIX"; then
  3794. AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
  3795. fi
  3796. AC_SUBST(CL_INCLUDES_PREFIX)
  3797. rm -f dummy-hello.c
  3798. dnl Make sure that the build system can handle non-ASCII characters
  3799. dnl in environment variables to prevent it from breaking silently on
  3800. dnl non-English systems.
  3801. NONASCII=$'\241\241'
  3802. AC_SUBST(NONASCII)
  3803. fi
  3804. fi
  3805. dnl ========================================================
  3806. dnl =
  3807. dnl = Static Build Options
  3808. dnl =
  3809. dnl ========================================================
  3810. MOZ_ARG_HEADER(Static build options)
  3811. # Option to enable shared gkmedias on other target operating systems.
  3812. # This is overriden for Windows regardless if it is set or not.
  3813. MOZ_ARG_ENABLE_BOOL(shared-media,
  3814. [ --enable-shared-media Build GKMedias as a shared lib],
  3815. GKMEDIAS_SHARED_LIBRARY=1,
  3816. GKMEDIAS_SHARED_LIBRARY=)
  3817. # We want gkmedias always be enabled on Windows regardless of the enable bool.
  3818. if test "$OS_ARCH" = "WINNT"; then
  3819. GKMEDIAS_SHARED_LIBRARY=1
  3820. fi
  3821. if test -n "$GKMEDIAS_SHARED_LIBRARY"; then
  3822. AC_DEFINE(GKMEDIAS_SHARED_LIBRARY)
  3823. fi
  3824. AC_SUBST(GKMEDIAS_SHARED_LIBRARY)
  3825. # Shared JS or gkmedias needs zlib in mozglue
  3826. if test -z "$MOZ_SYSTEM_ZLIB"; then
  3827. # XXX: Currently JS_SHARED_LIBRARY lives in mozconfigure
  3828. if test -n "$JS_SHARED_LIBRARY" -o "$GKMEDIAS_SHARED_LIBRARY"; then
  3829. ZLIB_IN_MOZGLUE=1
  3830. AC_DEFINE(ZLIB_IN_MOZGLUE)
  3831. fi
  3832. fi
  3833. AC_SUBST(ZLIB_IN_MOZGLUE)
  3834. dnl ========================================================
  3835. dnl =
  3836. dnl = Standalone module options
  3837. dnl =
  3838. dnl ========================================================
  3839. MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
  3840. dnl Check for GLib.
  3841. dnl ========================================================
  3842. if test -z "$SKIP_PATH_CHECKS"; then
  3843. if test -z "${GLIB_CFLAGS}" -o -z "${GLIB_LIBS}" ; then
  3844. if test "$MOZ_ENABLE_GTK" ; then
  3845. PKG_CHECK_MODULES(GLIB, glib-2.0 >= 1.3.7 gobject-2.0)
  3846. fi
  3847. fi
  3848. fi
  3849. if test -z "${GLIB_GMODULE_LIBS}" \
  3850. -a -n "${GLIB_CONFIG}"\
  3851. -a "${GLIB_CONFIG}" != no\
  3852. ; then
  3853. GLIB_GMODULE_LIBS=`$GLIB_CONFIG gmodule --libs`
  3854. fi
  3855. AC_SUBST_LIST(GLIB_GMODULE_LIBS)
  3856. if test "$USE_FC_FREETYPE"; then
  3857. if test "$COMPILE_ENVIRONMENT"; then
  3858. dnl ========================================================
  3859. dnl = Check for freetype2 functionality
  3860. dnl ========================================================
  3861. if test "$_HAVE_FREETYPE2" -a -z "$MOZ_TREE_FREETYPE"; then
  3862. _SAVE_LIBS="$LIBS"
  3863. _SAVE_CFLAGS="$CFLAGS"
  3864. LIBS="$LIBS $FT2_LIBS"
  3865. CFLAGS="$CFLAGS $FT2_CFLAGS"
  3866. AC_CACHE_CHECK(for FT_Bitmap_Size.y_ppem,
  3867. ac_cv_member_FT_Bitmap_Size_y_ppem,
  3868. [AC_TRY_COMPILE([#include <ft2build.h>
  3869. #include FT_FREETYPE_H],
  3870. [FT_Bitmap_Size s;
  3871. if (sizeof s.y_ppem) return 0;
  3872. return 1],
  3873. ac_cv_member_FT_Bitmap_Size_y_ppem=yes,
  3874. ac_cv_member_FT_Bitmap_Size_y_ppem=no)])
  3875. if test "$ac_cv_member_FT_Bitmap_Size_y_ppem" = yes; then
  3876. HAVE_FT_BITMAP_SIZE_Y_PPEM=1
  3877. else
  3878. HAVE_FT_BITMAP_SIZE_Y_PPEM=0
  3879. fi
  3880. AC_DEFINE_UNQUOTED(HAVE_FT_BITMAP_SIZE_Y_PPEM,
  3881. $HAVE_FT_BITMAP_SIZE_Y_PPEM,
  3882. [FT_Bitmap_Size structure includes y_ppem field])
  3883. AC_CHECK_FUNCS(FT_GlyphSlot_Embolden FT_Load_Sfnt_Table)
  3884. LIBS="$_SAVE_LIBS"
  3885. CFLAGS="$_SAVE_CFLAGS"
  3886. fi
  3887. _SAVE_CPPFLAGS="$CPPFLAGS"
  3888. CPPFLAGS="$CPPFLAGS $FT2_CFLAGS $XCFLAGS"
  3889. MOZ_CHECK_HEADERS([fontconfig/fcfreetype.h], ,
  3890. [AC_MSG_ERROR(Can't find header fontconfig/fcfreetype.h.)], [#include <fontconfig/fontconfig.h>])
  3891. CPPFLAGS="$_SAVE_CPPFLAGS"
  3892. fi
  3893. fi
  3894. dnl ========================================================
  3895. dnl Check for pixman and cairo
  3896. dnl ========================================================
  3897. MOZ_TREE_CAIRO=1
  3898. MOZ_ARG_ENABLE_BOOL(system-cairo,
  3899. [ --enable-system-cairo Use system cairo (located with pkgconfig)],
  3900. MOZ_TREE_CAIRO=,
  3901. MOZ_TREE_CAIRO=1 )
  3902. MOZ_TREE_PIXMAN=1
  3903. MOZ_ARG_ENABLE_BOOL(system-pixman,
  3904. [ --enable-system-pixman Use system pixman (located with pkgconfig)],
  3905. MOZ_TREE_PIXMAN=,
  3906. MOZ_TREE_PIXMAN=force,
  3907. MOZ_TREE_PIXMAN=1 )
  3908. # System cairo depends on system pixman
  3909. if test "$MOZ_TREE_PIXMAN" = "force"; then
  3910. if test -z "$MOZ_TREE_CAIRO"; then
  3911. AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.])
  3912. else
  3913. MOZ_TREE_PIXMAN=1
  3914. fi
  3915. elif test -z "$MOZ_TREE_CAIRO"; then
  3916. MOZ_TREE_PIXMAN=
  3917. fi
  3918. if test "$MOZ_TREE_PIXMAN"; then
  3919. AC_DEFINE(MOZ_TREE_PIXMAN)
  3920. else
  3921. PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2)
  3922. fi
  3923. if test "$MOZ_TREE_CAIRO"; then
  3924. MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo"
  3925. AC_DEFINE(MOZ_TREE_CAIRO)
  3926. if test "$OS_ARCH" = "WINNT"; then
  3927. # For now we assume that we will have a uint64_t available through
  3928. # one of the above headers or mozstdint.h.
  3929. AC_DEFINE(HAVE_UINT64_T)
  3930. fi
  3931. # Define macros for cairo-features.h
  3932. TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
  3933. if test "$MOZ_X11"; then
  3934. XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
  3935. XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
  3936. PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1"
  3937. fi
  3938. if test "$_HAVE_FREETYPE2"; then
  3939. FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
  3940. MOZ_ENABLE_CAIRO_FT=1
  3941. CAIRO_FT_CFLAGS="$FT2_CFLAGS"
  3942. fi
  3943. case "$MOZ_WIDGET_TOOLKIT" in
  3944. cocoa | uikit)
  3945. QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
  3946. QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1"
  3947. QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1"
  3948. ;;
  3949. windows)
  3950. WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1"
  3951. WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1"
  3952. WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1"
  3953. WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1"
  3954. MOZ_ENABLE_D2D_SURFACE=1
  3955. MOZ_ENABLE_DWRITE_FONT=1
  3956. if test "$COMPILE_ENVIRONMENT"; then
  3957. MOZ_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
  3958. dnl D3D10 Layers depend on D2D Surfaces.
  3959. if test -n "$WIN32_D2D_SURFACE_FEATURE"; then
  3960. MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
  3961. fi
  3962. fi
  3963. ;;
  3964. esac
  3965. if test "$USE_FC_FREETYPE"; then
  3966. FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
  3967. fi
  3968. AC_SUBST(MOZ_ENABLE_CAIRO_FT)
  3969. AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
  3970. AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
  3971. AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
  3972. AC_SUBST(MOZ_ENABLE_D3D10_LAYER)
  3973. AC_SUBST(PS_SURFACE_FEATURE)
  3974. AC_SUBST(SVG_SURFACE_FEATURE)
  3975. AC_SUBST(XLIB_SURFACE_FEATURE)
  3976. AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
  3977. AC_SUBST(QUARTZ_SURFACE_FEATURE)
  3978. AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
  3979. AC_SUBST(WIN32_SURFACE_FEATURE)
  3980. AC_SUBST(OS2_SURFACE_FEATURE)
  3981. AC_SUBST(DIRECTFB_SURFACE_FEATURE)
  3982. AC_SUBST(FT_FONT_FEATURE)
  3983. AC_SUBST(FC_FONT_FEATURE)
  3984. AC_SUBST(WIN32_FONT_FEATURE)
  3985. AC_SUBST(WIN32_DWRITE_FONT_FEATURE)
  3986. AC_SUBST(WIN32_D2D_SURFACE_FEATURE)
  3987. AC_SUBST(QUARTZ_FONT_FEATURE)
  3988. AC_SUBST(PNG_FUNCTIONS_FEATURE)
  3989. AC_SUBST(QT_SURFACE_FEATURE)
  3990. AC_SUBST(TEE_SURFACE_FEATURE)
  3991. if test "$MOZ_X11"; then
  3992. MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender"
  3993. fi
  3994. CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
  3995. else
  3996. PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION)
  3997. MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS"
  3998. MOZ_CAIRO_LIBS="$CAIRO_LIBS"
  3999. PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION)
  4000. if test "$MOZ_X11"; then
  4001. PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION)
  4002. MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS"
  4003. MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS"
  4004. MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS"
  4005. fi
  4006. fi
  4007. case "$MOZ_WIDGET_TOOLKIT" in
  4008. android)
  4009. TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS"
  4010. TK_LIBS="$MOZ_CAIRO_LIBS $MOZ_PIXMAN_LIBS"
  4011. ;;
  4012. esac
  4013. AC_SUBST(MOZ_TREE_CAIRO)
  4014. AC_SUBST_LIST(MOZ_CAIRO_CFLAGS)
  4015. AC_SUBST_LIST(MOZ_CAIRO_LIBS)
  4016. AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
  4017. AC_SUBST(MOZ_TREE_PIXMAN)
  4018. dnl ========================================================
  4019. dnl disable xul
  4020. dnl ========================================================
  4021. MOZ_ARG_DISABLE_BOOL(xul,
  4022. [ --disable-xul Disable XUL],
  4023. MOZ_XUL= )
  4024. if test "$MOZ_XUL"; then
  4025. AC_DEFINE(MOZ_XUL)
  4026. else
  4027. dnl remove extensions that require XUL
  4028. MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's/inspector//' -e 's/irc//' -e 's/tasks//'`
  4029. fi
  4030. AC_SUBST(MOZ_XUL)
  4031. dnl ========================================================
  4032. dnl necko configuration options
  4033. dnl ========================================================
  4034. dnl
  4035. dnl option to disable necko's wifi scanner
  4036. dnl
  4037. MOZ_ARG_DISABLE_BOOL(necko-wifi,
  4038. [ --disable-necko-wifi Disable necko wifi scanner],
  4039. MOZ_NECKO_WIFI=,
  4040. MOZ_NECKO_WIFI=1)
  4041. if test "$MOZ_NECKO_WIFI"; then
  4042. case "$OS_TARGET" in
  4043. DragonFly|FreeBSD|WINNT)
  4044. NECKO_WIFI=1
  4045. ;;
  4046. Linux)
  4047. NECKO_WIFI=1
  4048. NECKO_WIFI_DBUS=1
  4049. ;;
  4050. esac
  4051. fi
  4052. if test "$NECKO_WIFI"; then
  4053. if test -z "$MOZ_ENABLE_DBUS" -a -n "$NECKO_WIFI_DBUS"; then
  4054. AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi])
  4055. fi
  4056. AC_DEFINE(NECKO_WIFI)
  4057. _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_WIFI"
  4058. fi
  4059. AC_SUBST(NECKO_WIFI)
  4060. AC_SUBST(NECKO_WIFI_DBUS)
  4061. dnl
  4062. dnl option to disable cookies
  4063. dnl
  4064. MOZ_ARG_DISABLE_BOOL(cookies,
  4065. [ --disable-cookies Disable cookie support],
  4066. NECKO_COOKIES=,
  4067. NECKO_COOKIES=1)
  4068. AC_SUBST(NECKO_COOKIES)
  4069. if test "$NECKO_COOKIES"; then
  4070. AC_DEFINE(NECKO_COOKIES)
  4071. _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES NECKO_COOKIES"
  4072. fi
  4073. dnl
  4074. dnl Always build Marionette if not Android or B2G
  4075. dnl
  4076. if test "$OS_TARGET" != "Android"; then
  4077. AC_DEFINE(ENABLE_MARIONETTE)
  4078. fi
  4079. AC_SUBST(ENABLE_MARIONETTE)
  4080. if test "$ENABLE_MARIONETTE"; then
  4081. AC_DEFINE(ENABLE_MARIONETTE)
  4082. fi
  4083. dnl ========================================================
  4084. dnl =
  4085. dnl = Miscellaneous (former toolkit/moz.configure)
  4086. dnl =
  4087. dnl ========================================================
  4088. dnl Build Places if required
  4089. AC_SUBST(MOZ_PLACES)
  4090. if test "$MOZ_PLACES"; then
  4091. AC_DEFINE(MOZ_PLACES)
  4092. fi
  4093. dnl Build Firefox Health Reporter Service
  4094. AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
  4095. if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
  4096. AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
  4097. fi
  4098. dnl Build Sync Services if required
  4099. AC_SUBST(MOZ_SERVICES_SYNC)
  4100. if test -n "$MOZ_SERVICES_SYNC"; then
  4101. AC_DEFINE(MOZ_SERVICES_SYNC)
  4102. fi
  4103. dnl ========================================================
  4104. if test "$MOZ_DEBUG"; then
  4105. MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
  4106. fi
  4107. dnl ========================================================
  4108. dnl =
  4109. dnl = Maintainer debug option (no --enable equivalent)
  4110. dnl =
  4111. dnl ========================================================
  4112. AC_SUBST(AR)
  4113. AC_SUBST(AR_FLAGS)
  4114. AC_SUBST(AR_EXTRACT)
  4115. AC_SUBST(AS)
  4116. AC_SUBST(ASFLAGS)
  4117. AC_SUBST(AS_DASH_C_FLAG)
  4118. AC_SUBST(LD)
  4119. AC_SUBST(RC)
  4120. AC_SUBST(RCFLAGS)
  4121. AC_SUBST(WINDRES)
  4122. AC_SUBST(IMPLIB)
  4123. AC_SUBST(FILTER)
  4124. AC_SUBST(BIN_FLAGS)
  4125. AC_SUBST(MOZ_AUTH_EXTENSION)
  4126. AC_SUBST(MOZ_PREF_EXTENSIONS)
  4127. AC_SUBST(MOZ_DEBUG)
  4128. AC_SUBST(MOZ_DEBUG_LDFLAGS)
  4129. AC_SUBST(WARNINGS_AS_ERRORS)
  4130. AC_SUBST_SET(MOZ_EXTENSIONS)
  4131. AC_SUBST(LIBICONV)
  4132. AC_SUBST(MOZ_TOOLKIT_SEARCH)
  4133. AC_SUBST(MOZ_FEEDS)
  4134. AC_SUBST(ENABLE_TESTS)
  4135. AC_SUBST(MOZ_UNIVERSALCHARDET)
  4136. AC_SUBST(ACCESSIBILITY)
  4137. AC_SUBST(MOZ_SPELLCHECK)
  4138. AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
  4139. AC_SUBST(MOZ_ENABLE_SIGNMAR)
  4140. AC_SUBST(MOZ_UPDATER)
  4141. AC_SUBST(MOZ_ANGLE_RENDERER)
  4142. AC_SUBST(MOZ_D3D_CPU_SUFFIX)
  4143. AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
  4144. AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL)
  4145. AC_SUBST(MOZ_D3DCOMPILER_VISTA_DLL_PATH)
  4146. AC_SUBST(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
  4147. AC_SUBST(ENABLE_STRIP)
  4148. AC_SUBST(PKG_SKIP_STRIP)
  4149. AC_SUBST(STRIP_FLAGS)
  4150. AC_SUBST(USE_ELF_HACK)
  4151. AC_SUBST(INCREMENTAL_LINKER)
  4152. AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS)
  4153. AC_SUBST(MOZ_FIX_LINK_PATHS)
  4154. AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
  4155. AC_SUBST(MOZ_LINKER_EXTRACT)
  4156. AC_SUBST(MOZ_JSDOWNLOADS)
  4157. if test -n "$MOZ_JSDOWNLOADS"; then
  4158. AC_DEFINE(MOZ_JSDOWNLOADS)
  4159. fi
  4160. dnl ========================================================
  4161. dnl = Mac bundle name prefix
  4162. dnl ========================================================
  4163. MOZ_ARG_WITH_STRING(macbundlename-prefix,
  4164. [ --with-macbundlename-prefix=prefix
  4165. Prefix for MOZ_MACBUNDLE_NAME],
  4166. [ MOZ_MACBUNDLE_NAME_PREFIX="$withval"])
  4167. MOZ_MACBUNDLE_NAME=$MOZ_APP_DISPLAYNAME
  4168. if test "$MOZ_MACBUNDLE_NAME_PREFIX"; then
  4169. MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME_PREFIX} ${MOZ_MACBUNDLE_NAME}"
  4170. fi
  4171. if test "$MOZ_DEBUG"; then
  4172. MOZ_MACBUNDLE_NAME="${MOZ_MACBUNDLE_NAME}Debug.app"
  4173. else
  4174. MOZ_MACBUNDLE_NAME=${MOZ_MACBUNDLE_NAME}.app
  4175. fi
  4176. AC_SUBST(MOZ_MACBUNDLE_NAME)
  4177. dnl Mac bundle identifier (based on MOZ_APP_DISPLAYNAME)
  4178. MOZ_MACBUNDLE_ID=`echo $MOZ_APP_DISPLAYNAME | tr '[A-Z]' '[a-z]'`
  4179. MOZ_MACBUNDLE_ID=${MOZ_DISTRIBUTION_ID}.${MOZ_MACBUNDLE_ID}
  4180. if test "$MOZ_DEBUG"; then
  4181. MOZ_MACBUNDLE_ID=${MOZ_MACBUNDLE_ID}debug
  4182. fi
  4183. AC_DEFINE_UNQUOTED(MOZ_MACBUNDLE_ID,$MOZ_MACBUNDLE_ID)
  4184. AC_SUBST(MOZ_MACBUNDLE_ID)
  4185. dnl ========================================================
  4186. dnl = Child Process Name for IPC
  4187. dnl ========================================================
  4188. if test "$MOZ_WIDGET_TOOLKIT" != "android"; then
  4189. MOZ_CHILD_PROCESS_NAME="plugin-container${BIN_SUFFIX}"
  4190. else
  4191. # We want to let Android unpack the file at install time, but it only does
  4192. # so if the file is named libsomething.so. The lib/ path is also required
  4193. # because the unpacked file will be under the lib/ subdirectory and will
  4194. # need to be executed from that path.
  4195. MOZ_CHILD_PROCESS_NAME="libplugin-container.so"
  4196. MOZ_CHILD_PROCESS_NAME_PIE="libplugin-container-pie.so"
  4197. AC_SUBST(MOZ_CHILD_PROCESS_NAME_PIE)
  4198. fi
  4199. MOZ_CHILD_PROCESS_BUNDLE="plugin-container.app/Contents/MacOS/"
  4200. AC_SUBST(MOZ_CHILD_PROCESS_NAME)
  4201. AC_SUBST(MOZ_CHILD_PROCESS_BUNDLE)
  4202. # The following variables are available to branding and application
  4203. # configuration ($BRANDING/configure.sh and $APPLICATION/confvars.sh):
  4204. # - MOZ_APP_VENDOR: Used for application.ini's "Vendor" field, which also
  4205. # impacts profile location and user-visible fields.
  4206. # - MOZ_APP_BASENAME: Typically stays consistent for multiple branded
  4207. # versions of a given application (e.g. Aurora and Firefox both use
  4208. # "Firefox"), but may vary for full rebrandings (e.g. Iceweasel). Used
  4209. # for application.ini's "Name" field, which controls profile location in
  4210. # the absence of a "Profile" field (see below), and various system
  4211. # integration hooks (Unix remoting, Windows MessageWindow name, etc.)
  4212. # - MOZ_APP_DISPLAYNAME: Used in user-visible fields (DLL properties,
  4213. # Mac Bundle name, Updater, Installer), it is typically used for nightly
  4214. # builds (e.g. Aurora for Firefox).
  4215. # - MOZ_APP_VERSION: Defines the application version number.
  4216. # - MOZ_APP_VERSION_DISPLAY: Defines the application version number. Used
  4217. # in the "About" window. If not set, defaults to MOZ_APP_VERSION.
  4218. # - MOZ_APP_NAME: Used for e.g. the binary program file name. If not set,
  4219. # defaults to a lowercase form of MOZ_APP_BASENAME.
  4220. # - MOZ_APP_REMOTINGNAME: Used for the internal program name, which affects
  4221. # profile name and remoting. If not set, defaults to MOZ_APP_NAME.
  4222. # - MOZ_APP_PROFILE: When set, used for application.ini's
  4223. # "Profile" field, which controls profile location.
  4224. # - MOZ_APP_ID: When set, used for application.ini's "ID" field, and
  4225. # crash reporter server url.
  4226. # - MOZ_APP_ANDROID_VERSION_CODE: On Android, "android:versionCode" for
  4227. # the main application is set to the value of this variable. If not
  4228. # set, it falls back to a Mozilla-specific value derived from the
  4229. # build ID.
  4230. # - MOZ_PROFILE_MIGRATOR: When set, enables profile migrator.
  4231. if test -z "$MOZ_APP_NAME"; then
  4232. MOZ_APP_NAME=`echo $MOZ_APP_BASENAME | tr A-Z a-z`
  4233. fi
  4234. if test -z "$MOZ_APP_REMOTINGNAME"; then
  4235. MOZ_APP_REMOTINGNAME=$MOZ_APP_NAME
  4236. fi
  4237. if test -z "$MOZ_APP_VERSION_DISPLAY"; then
  4238. MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
  4239. fi
  4240. if test -z "$ANDROID_PACKAGE_NAME" ; then
  4241. ANDROID_PACKAGE_NAME="org.mozilla.$MOZ_APP_NAME"
  4242. fi
  4243. # For extensions and langpacks, we require a max version that is compatible
  4244. # across security releases. MOZ_APP_MAXVERSION is our method for doing that.
  4245. # 24.0a1 and 24.0a2 aren't affected
  4246. # 24.0 becomes 24.*
  4247. # 24.1.1 becomes 24.*
  4248. IS_ALPHA=`echo $MOZ_APP_VERSION | grep a`
  4249. if test -z "$IS_ALPHA"; then
  4250. changequote(,)
  4251. if test "$(basename $MOZ_BUILD_APP)" = "suite"; then
  4252. MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\.[0-9]*\).*|\1|"`.*
  4253. else
  4254. MOZ_APP_MAXVERSION=`echo $MOZ_APP_VERSION | sed "s|\(^[0-9]*\).*|\1|"`.*
  4255. fi
  4256. changequote([,])
  4257. else
  4258. MOZ_APP_MAXVERSION=$MOZ_APP_VERSION
  4259. fi
  4260. AC_SUBST(MOZ_APP_NAME)
  4261. AC_SUBST(MOZ_APP_REMOTINGNAME)
  4262. AC_SUBST(MOZ_APP_DISPLAYNAME)
  4263. AC_SUBST(MOZ_APP_BASENAME)
  4264. AC_SUBST(MOZ_APP_VENDOR)
  4265. AC_SUBST(MOZ_APP_PROFILE)
  4266. AC_SUBST(MOZ_APP_ID)
  4267. AC_SUBST(MOZ_APP_ANDROID_VERSION_CODE)
  4268. AC_SUBST(MAR_CHANNEL_ID)
  4269. AC_SUBST(ACCEPTED_MAR_CHANNEL_IDS)
  4270. AC_SUBST(MOZ_PROFILE_MIGRATOR)
  4271. AC_DEFINE_UNQUOTED(MOZ_APP_UA_NAME, "$MOZ_APP_UA_NAME")
  4272. AC_SUBST(MOZ_APP_UA_NAME)
  4273. AC_DEFINE_UNQUOTED(MOZ_APP_UA_VERSION, "$MOZ_APP_VERSION")
  4274. AC_SUBST(MOZ_APP_VERSION)
  4275. AC_SUBST(MOZ_APP_VERSION_DISPLAY)
  4276. AC_SUBST(MOZ_APP_MAXVERSION)
  4277. AC_SUBST(MOZ_UA_OS_AGNOSTIC)
  4278. if test -n "$MOZ_UA_OS_AGNOSTIC"; then
  4279. AC_DEFINE(MOZ_UA_OS_AGNOSTIC)
  4280. fi
  4281. AC_SUBST(MOZ_APP_STATIC_INI)
  4282. AC_DEFINE_UNQUOTED(MOZ_UA_BUILDID, "$MOZ_UA_BUILDID")
  4283. AC_SUBST(MOZ_UA_BUILDID)
  4284. AC_SUBST(MOZ_PKG_SPECIAL)
  4285. AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
  4286. AC_SUBST(MOZILLA_OFFICIAL)
  4287. if test "$MOZILLA_OFFICIAL"; then
  4288. AC_DEFINE(MOZILLA_OFFICIAL)
  4289. # Build revisions should always be present in official Mozilla builds
  4290. MOZ_INCLUDE_SOURCE_INFO=1
  4291. fi
  4292. # External builds (specifically Ubuntu) may drop the hg repo information, so we allow to
  4293. # explicitly set the repository and changeset information in.
  4294. AC_SUBST(MOZ_SOURCE_REPO)
  4295. AC_SUBST(MOZ_SOURCE_CHANGESET)
  4296. AC_SUBST(MOZ_INCLUDE_SOURCE_INFO)
  4297. if test "$MOZ_TELEMETRY_REPORTING"; then
  4298. AC_DEFINE(MOZ_TELEMETRY_REPORTING)
  4299. # Enable Telemetry by default for nightly and aurora channels
  4300. if test -z "$RELEASE_OR_BETA"; then
  4301. AC_DEFINE(MOZ_TELEMETRY_ON_BY_DEFAULT)
  4302. fi
  4303. fi
  4304. dnl If we have any service that uploads data (and requires data submission
  4305. dnl policy alert), set MOZ_DATA_REPORTING.
  4306. dnl We need SUBST for build system and DEFINE for xul preprocessor.
  4307. if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT"; then
  4308. MOZ_DATA_REPORTING=1
  4309. AC_DEFINE(MOZ_DATA_REPORTING)
  4310. AC_SUBST(MOZ_DATA_REPORTING)
  4311. fi
  4312. dnl win32 options
  4313. AC_SUBST(WIN32_REDIST_DIR)
  4314. AC_SUBST(WIN_UCRT_REDIST_DIR)
  4315. dnl ========================================================
  4316. dnl ICU Support
  4317. dnl ========================================================
  4318. if test "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
  4319. USE_ICU=1
  4320. fi
  4321. MOZ_CONFIG_ICU()
  4322. dnl Echo the CFLAGS to remove extra whitespace.
  4323. CFLAGS=`echo \
  4324. $_WARNINGS_CFLAGS \
  4325. $CFLAGS`
  4326. CXXFLAGS=`echo \
  4327. $_WARNINGS_CXXFLAGS \
  4328. $CXXFLAGS`
  4329. COMPILE_CFLAGS=`echo \
  4330. $_DEFINES_CFLAGS \
  4331. $COMPILE_CFLAGS`
  4332. COMPILE_CXXFLAGS=`echo \
  4333. $_DEFINES_CXXFLAGS \
  4334. $COMPILE_CXXFLAGS`
  4335. HOST_CFLAGS=`echo \
  4336. $HOST_CFLAGS`
  4337. HOST_CXXFLAGS=`echo \
  4338. $HOST_CXXFLAGS`
  4339. AC_SUBST(_DEPEND_CFLAGS)
  4340. AC_SUBST(MOZ_SYSTEM_JPEG)
  4341. AC_SUBST(MOZ_SYSTEM_PNG)
  4342. AC_SUBST(MOZ_SYSTEM_BZ2)
  4343. AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
  4344. AC_SUBST_LIST(MOZ_JPEG_LIBS)
  4345. AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
  4346. AC_SUBST_LIST(MOZ_BZ2_LIBS)
  4347. AC_SUBST_LIST(MOZ_PNG_CFLAGS)
  4348. AC_SUBST_LIST(MOZ_PNG_LIBS)
  4349. HOST_CMFLAGS=-fobjc-exceptions
  4350. HOST_CMMFLAGS=-fobjc-exceptions
  4351. OS_COMPILE_CMFLAGS=-fobjc-exceptions
  4352. OS_COMPILE_CMMFLAGS=-fobjc-exceptions
  4353. if test "$MOZ_WIDGET_TOOLKIT" = uikit; then
  4354. OS_COMPILE_CMFLAGS="$OS_COMPILE_CMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
  4355. OS_COMPILE_CMMFLAGS="$OS_COMPILE_CMMFLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch"
  4356. fi
  4357. AC_SUBST(HOST_CMFLAGS)
  4358. AC_SUBST(HOST_CMMFLAGS)
  4359. AC_SUBST(OS_COMPILE_CMFLAGS)
  4360. AC_SUBST(OS_COMPILE_CMMFLAGS)
  4361. OS_CFLAGS="$CFLAGS"
  4362. OS_CXXFLAGS="$CXXFLAGS"
  4363. OS_CPPFLAGS="$CPPFLAGS"
  4364. OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
  4365. OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
  4366. OS_LDFLAGS="$LDFLAGS"
  4367. OS_LIBS="$LIBS"
  4368. AC_SUBST(OS_CFLAGS)
  4369. AC_SUBST(OS_CXXFLAGS)
  4370. AC_SUBST(OS_CPPFLAGS)
  4371. AC_SUBST(OS_COMPILE_CFLAGS)
  4372. AC_SUBST(OS_COMPILE_CXXFLAGS)
  4373. AC_SUBST(OS_LDFLAGS)
  4374. AC_SUBST(OS_LIBS)
  4375. AC_SUBST(HOST_CC)
  4376. AC_SUBST(HOST_CXX)
  4377. AC_SUBST(HOST_CFLAGS)
  4378. AC_SUBST(HOST_CPPFLAGS)
  4379. AC_SUBST(HOST_CXXFLAGS)
  4380. AC_SUBST(HOST_LDFLAGS)
  4381. AC_SUBST(HOST_OPTIMIZE_FLAGS)
  4382. AC_SUBST(HOST_AR)
  4383. AC_SUBST(HOST_AR_FLAGS)
  4384. AC_SUBST(HOST_LD)
  4385. AC_SUBST(HOST_RANLIB)
  4386. AC_SUBST(HOST_BIN_SUFFIX)
  4387. AC_SUBST(TARGET_XPCOM_ABI)
  4388. AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
  4389. AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
  4390. AC_SUBST(HAVE_X86_AVX2)
  4391. AC_SUBST(HAVE_ALTIVEC)
  4392. AC_SUBST(GCC_USE_GNU_LD)
  4393. AC_SUBST(WRAP_LDFLAGS)
  4394. AC_SUBST(MKSHLIB)
  4395. AC_SUBST(MKCSHLIB)
  4396. AC_SUBST(DSO_CFLAGS)
  4397. AC_SUBST(DSO_PIC_CFLAGS)
  4398. AC_SUBST(DSO_LDOPTS)
  4399. AC_SUBST(LIB_PREFIX)
  4400. AC_SUBST(DLL_PREFIX)
  4401. AC_SUBST(DLL_SUFFIX)
  4402. AC_DEFINE_UNQUOTED(MOZ_DLL_SUFFIX, "$DLL_SUFFIX")
  4403. AC_SUBST(LIB_SUFFIX)
  4404. AC_SUBST(OBJ_SUFFIX)
  4405. AC_SUBST(BIN_SUFFIX)
  4406. AC_SUBST(IMPORT_LIB_SUFFIX)
  4407. AC_SUBST(USE_N32)
  4408. AC_SUBST(CC_VERSION)
  4409. AC_SUBST(NS_ENABLE_TSF)
  4410. AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
  4411. AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
  4412. AC_SUBST(MOZ_VORBIS)
  4413. AC_SUBST(MOZ_TREMOR)
  4414. AC_SUBST(MOZ_FFVPX)
  4415. AC_SUBST_LIST(FFVPX_ASFLAGS)
  4416. AC_SUBST(MOZ_VPX_ERROR_CONCEALMENT)
  4417. AC_SUBST(VPX_USE_YASM)
  4418. AC_SUBST_LIST(VPX_ASFLAGS)
  4419. AC_SUBST(VPX_AS_CONVERSION)
  4420. AC_SUBST(VPX_X86_ASM)
  4421. AC_SUBST(VPX_ARM_ASM)
  4422. AC_SUBST(MOZ_CODE_COVERAGE)
  4423. AC_SUBST(LIBJPEG_TURBO_USE_YASM)
  4424. AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
  4425. AC_SUBST(MOZ_LIBAV_FFT)
  4426. AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
  4427. AC_SUBST(MOZ_PACKAGE_JSSHELL)
  4428. AC_SUBST(MOZ_FOLD_LIBS)
  4429. AC_SUBST(MOZ_FOLD_LIBS_FLAGS)
  4430. AC_SUBST(SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE)
  4431. AC_SUBST(DMG_TOOL)
  4432. dnl Host JavaScript runtime, if any, to use during cross compiles.
  4433. AC_SUBST(JS_BINARY)
  4434. AC_SUBST(NSS_EXTRA_SYMBOLS_FILE)
  4435. if test -n "$COMPILE_ENVIRONMENT"; then
  4436. AC_CHECK_FUNCS(posix_fadvise posix_fallocate)
  4437. dnl Check for missing components
  4438. if test "$MOZ_X11"; then
  4439. dnl ====================================================
  4440. dnl = Check if X headers exist
  4441. dnl ====================================================
  4442. _SAVE_CFLAGS=$CFLAGS
  4443. CFLAGS="$CFLAGS $XCFLAGS"
  4444. AC_TRY_COMPILE([
  4445. #include <stdio.h>
  4446. #include <stdlib.h>
  4447. #include <X11/Xlib.h>
  4448. #include <X11/Intrinsic.h>
  4449. #include <X11/extensions/XShm.h>
  4450. ],
  4451. [
  4452. Display *dpy = 0;
  4453. if ((dpy = XOpenDisplay(NULL)) == NULL) {
  4454. fprintf(stderr, ": can't open %s\n", XDisplayName(NULL));
  4455. exit(1);
  4456. }
  4457. ], [],
  4458. [ AC_MSG_ERROR([Can't find X headers (install libxt-dev (Debian/Ubuntu), libXt-devel (Fedora), or xorg-x11-libXt-devel (SuSE)).]) ])
  4459. CFLAGS="$_SAVE_CFLAGS"
  4460. if test -n "$MISSING_X"; then
  4461. AC_MSG_ERROR([ Could not find the following X libraries: $MISSING_X ]);
  4462. fi
  4463. fi # MOZ_X11
  4464. fi # COMPILE_ENVIRONMENT
  4465. dnl Set various defines and substitutions
  4466. dnl ========================================================
  4467. if test "$MOZ_DEBUG"; then
  4468. AC_DEFINE(MOZ_REFLOW_PERF)
  4469. AC_DEFINE(MOZ_REFLOW_PERF_DSP)
  4470. fi
  4471. if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK" ; then
  4472. AC_DEFINE(MOZ_ACCESSIBILITY_ATK)
  4473. ATK_FULL_VERSION=`$PKG_CONFIG --modversion atk`
  4474. ATK_MAJOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
  4475. ATK_MINOR_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
  4476. ATK_REV_VERSION=`echo ${ATK_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
  4477. AC_DEFINE_UNQUOTED(ATK_MAJOR_VERSION, $ATK_MAJOR_VERSION)
  4478. AC_DEFINE_UNQUOTED(ATK_MINOR_VERSION, $ATK_MINOR_VERSION)
  4479. AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
  4480. fi
  4481. if test "$MOZ_DEBUG"; then
  4482. A11Y_LOG=1
  4483. fi
  4484. case "$MOZ_UPDATE_CHANNEL" in
  4485. aurora|beta|release|esr)
  4486. ;;
  4487. *)
  4488. A11Y_LOG=1
  4489. ;;
  4490. esac
  4491. AC_SUBST(A11Y_LOG)
  4492. if test -n "$A11Y_LOG"; then
  4493. AC_DEFINE(A11Y_LOG)
  4494. fi
  4495. AC_SUBST(MOZILLA_VERSION)
  4496. dnl ========================================================
  4497. dnl Directive 4
  4498. dnl ========================================================
  4499. DIRECTIVE4_LIST="
  4500. MOZ_OFFICIAL_BRANDING=$MOZ_OFFICIAL_BRANDING
  4501. MOZ_BRANDING_DIRECTORY=$MOZ_BRANDING_DIRECTORY
  4502. MC_BASILISK=$MC_BASILISK
  4503. MC_PALEMOON=$MC_PALEMOON
  4504. MOZ_EME=$MOZ_EME
  4505. MOZ_WEBRTC=$MOZ_WEBRTC
  4506. MOZ_SYSTEM_JPEG=$MOZ_SYSTEM_JPEG
  4507. MOZ_SYSTEM_ZLIB=$MOZ_SYSTEM_ZLIB
  4508. MOZ_SYSTEM_BZ2=$MOZ_SYSTEM_BZ2
  4509. MOZ_SYSTEM_PNG=$MOZ_SYSTEM_PNG
  4510. MOZ_SYSTEM_LIBVPX=$MOZ_SYSTEM_LIBVPX
  4511. MOZ_SYSTEM_SQLITE=$MOZ_SYSTEM_SQLITE
  4512. MOZ_SYSTEM_JEMALLOC=$MOZ_SYSTEM_JEMALLOC"
  4513. DIRECTIVE4=`$PYTHON $_topsrcdir/build/directive4.py $DIRECTIVE4_LIST`
  4514. if test -n "$DIRECTIVE4"; then
  4515. if test -n "$MC_PRIVATE_BUILD"; then
  4516. AC_MSG_WARN([Private Build - The configuration you have chosen to use with official branding deviates from official build configuration. Your build is thus for personal and private use only and must not be (re)distributed - Please see: http://www.palemoon.org/redist.shtml])
  4517. else
  4518. AC_MSG_ERROR([Branding Violation - Please see: http://www.palemoon.org/redist.shtml])
  4519. fi
  4520. fi
  4521. AC_SUBST(DIRECTIVE4)
  4522. dnl Spit out some output
  4523. dnl ========================================================
  4524. dnl The following defines are used by xpcom
  4525. _NON_GLOBAL_ACDEFINES="$_NON_GLOBAL_ACDEFINES
  4526. CPP_THROW_NEW
  4527. HAVE_CPP_AMBIGUITY_RESOLVING_USING
  4528. HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR
  4529. HAVE_CPP_PARTIAL_SPECIALIZATION
  4530. HAVE_GETPAGESIZE
  4531. HAVE_ICONV
  4532. HAVE_ICONV_WITH_CONST_INPUT
  4533. HAVE_MBRTOWC
  4534. HAVE_WCRTOMB
  4535. HAVE_STATVFS64
  4536. HAVE_STATVFS
  4537. HAVE_STATFS64
  4538. HAVE_STATFS
  4539. HAVE_SYS_STATVFS_H
  4540. HAVE_SYS_STATFS_H
  4541. HAVE_SYS_VFS_H
  4542. HAVE_SYS_MOUNT_H
  4543. "
  4544. dnl ========================================================
  4545. dnl Determine options to use for running the preprocessor.
  4546. dnl ========================================================
  4547. if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
  4548. PREPROCESS_OPTION="-P -Fi"
  4549. else
  4550. PREPROCESS_OPTION="-E -o "
  4551. fi
  4552. AC_SUBST(PREPROCESS_OPTION)
  4553. # Avoid using obsolete NSPR features
  4554. AC_DEFINE(NO_NSPR_10_SUPPORT)
  4555. # Don't build NSS libpkix
  4556. NSS_DISABLE_LIBPKIX=1
  4557. AC_SUBST(NSS_DISABLE_LIBPKIX)
  4558. MOZ_CREATE_CONFIG_STATUS()
  4559. # Run freetype configure script
  4560. if test "$MOZ_TREE_FREETYPE"; then
  4561. export CFLAGS="$CFLAGS $MOZ_DEBUG_FLAGS -std=c99"
  4562. export CPPFLAGS="$CPPFLAGS $MOZ_DEBUG_FLAGS"
  4563. export CXXFLAGS="$CXXFLAGS $MOZ_DEBUG_FLAGS"
  4564. export LDFLAGS="$LDFLAGS $MOZ_DEBUG_LDFLAGS"
  4565. # Spaces in the *_CFLAGS and *_LIBS variables are intentionally placed
  4566. # to force freetype to use our settings rather than autodetecting
  4567. if test -n "$MOZ_SYSTEM_PNG"; then
  4568. export LIBPNG_CFLAGS="$MOZ_PNG_CFLAGS "
  4569. else
  4570. export LIBPNG_CFLAGS="-I$_objdir/dist/include"
  4571. fi
  4572. export LIBPNG_LIBS="$MOZ_PNG_LIBS "
  4573. export ZLIB_CFLAGS="$MOZ_ZLIB_CFLAGS "
  4574. export ZLIB_LIBS="$MOZ_ZLIB_LIBS "
  4575. export CONFIG_FILES="unix-cc.mk:unix-cc.in unix-def.mk:unix-def.in freetype-config freetype2.pc:freetype2.in"
  4576. ac_configure_args="$ac_configure_args --host=$target --disable-shared --with-pic=yes --with-zlib=yes --without-bzip2 --with-png=yes --without-harfbuzz"
  4577. if ! test -e modules; then
  4578. mkdir modules
  4579. fi
  4580. # Only export CC, CXX and RANLIB for the subconfigure, and avoid spilling
  4581. # that further down the road.
  4582. (export CC CXX RANLIB;
  4583. AC_OUTPUT_SUBDIRS(modules/freetype2)
  4584. ) || exit 1
  4585. fi
  4586. if test -z "$direct_nspr_config"; then
  4587. dnl ========================================================
  4588. dnl = Setup a nice relatively clean build environment for
  4589. dnl = sub-configures.
  4590. dnl ========================================================
  4591. CC="$_SUBDIR_CC"
  4592. CXX="$_SUBDIR_CXX"
  4593. CFLAGS="$_SUBDIR_CFLAGS"
  4594. CPPFLAGS="$_SUBDIR_CPPFLAGS"
  4595. CXXFLAGS="$_SUBDIR_CXXFLAGS"
  4596. LDFLAGS="$_SUBDIR_LDFLAGS"
  4597. HOST_CC="$_SUBDIR_HOST_CC"
  4598. HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
  4599. HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
  4600. HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
  4601. RC=
  4602. fi
  4603. unset MAKEFILES
  4604. unset CONFIG_FILES
  4605. # Run all configure scripts specified by a subconfigure
  4606. if test -n "$_subconfigure_subdir"; then
  4607. _save_srcdir="$srcdir"
  4608. srcdir="$srcdir/.."
  4609. _save_ac_configure_args="$ac_configure_args"
  4610. ac_configure_args="$_subconfigure_config_args"
  4611. AC_OUTPUT_SUBDIRS_NOW("$_subconfigure_subdir",$cache_file)
  4612. ac_configure_args="$_save_ac_configure_args"
  4613. srcdir="$_save_srcdir"
  4614. fi
  4615. if test "$COMPILE_ENVIRONMENT"; then
  4616. export WRAP_LDFLAGS
  4617. dnl ========================================================
  4618. dnl = Setup a nice relatively clean build environment for
  4619. dnl = sub-configures.
  4620. dnl ========================================================
  4621. CC="$_SUBDIR_CC"
  4622. CXX="$_SUBDIR_CXX"
  4623. CFLAGS="$_SUBDIR_CFLAGS"
  4624. CPPFLAGS="$_SUBDIR_CPPFLAGS"
  4625. CXXFLAGS="$_SUBDIR_CXXFLAGS"
  4626. LDFLAGS="$_SUBDIR_LDFLAGS"
  4627. HOST_CC="$_SUBDIR_HOST_CC"
  4628. HOST_CFLAGS="$_SUBDIR_HOST_CFLAGS"
  4629. HOST_CXXFLAGS="$_SUBDIR_HOST_CXXFLAGS"
  4630. HOST_LDFLAGS="$_SUBDIR_HOST_LDFLAGS"
  4631. RC=
  4632. # Run the SpiderMonkey 'configure' script.
  4633. dist=$MOZ_BUILD_ROOT/dist
  4634. ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  4635. # --with-system-nspr will have been converted into the relevant $NSPR_CFLAGS
  4636. # and $NSPR_LIBS.
  4637. ac_configure_args="`echo $ac_configure_args | sed -e 's/--with-system-nspr\S* *//'`"
  4638. if test "$_INTL_API" = no; then
  4639. ac_configure_args="$ac_configure_args --without-intl-api"
  4640. fi
  4641. if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
  4642. ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'"
  4643. ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'"
  4644. fi
  4645. ac_configure_args="$ac_configure_args --prefix=$dist"
  4646. if test -n "$ZLIB_IN_MOZGLUE"; then
  4647. MOZ_ZLIB_LIBS=
  4648. fi
  4649. export MOZ_SYSTEM_ZLIB
  4650. export MOZ_ZLIB_CFLAGS
  4651. export MOZ_ZLIB_LIBS
  4652. export MOZ_APP_NAME
  4653. export MOZ_APP_REMOTINGNAME
  4654. export MOZILLA_CENTRAL_PATH=$_topsrcdir
  4655. export STLPORT_CPPFLAGS
  4656. export STLPORT_LIBS
  4657. unset MOZ_BUILD_APP
  4658. export DIST
  4659. export MOZ_LINKER
  4660. export ZLIB_IN_MOZGLUE
  4661. export AR
  4662. export RANLIB
  4663. export CPP
  4664. export CC
  4665. export CXX
  4666. export LD
  4667. export ARFLAGS
  4668. export CPPFLAGS
  4669. export CFLAGS
  4670. export CXXFLAGS
  4671. export LDFLAGS
  4672. export HOST_CC
  4673. export HOST_CXX
  4674. export HOST_CFLAGS
  4675. export HOST_CPPFLAGS
  4676. export HOST_CXXFLAGS
  4677. export HOST_LDFLAGS
  4678. if ! test -e js; then
  4679. mkdir js
  4680. fi
  4681. ac_configure_args="$ac_configure_args JS_STANDALONE="
  4682. AC_OUTPUT_SUBDIRS(js/src,$cache_file)
  4683. ac_configure_args="$_SUBDIR_CONFIG_ARGS"
  4684. fi # COMPILE_ENVIRONMENT
  4685. dnl we need to run config.status after js/src subconfigure because we're
  4686. dnl traversing its moz.build and we need its config.status for that.
  4687. dnl However, writing our own config.status needs to happen before
  4688. dnl subconfigures because the setup surrounding subconfigures alters
  4689. dnl many AC_SUBSTed variables.
  4690. MOZ_RUN_ALL_SUBCONFIGURES()
  4691. rm -fr confdefs* $ac_clean_files