configure 141 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417
  1. #!/bin/sh
  2. #
  3. # qemu configure script (c) 2003 Fabrice Bellard
  4. #
  5. # Unset some variables known to interfere with behavior of common tools,
  6. # just as autoconf does.
  7. CLICOLOR_FORCE= GREP_OPTIONS=
  8. unset CLICOLOR_FORCE GREP_OPTIONS
  9. # Temporary directory used for files created while
  10. # configure runs. Since it is in the build directory
  11. # we can safely blow away any previous version of it
  12. # (and we need not jump through hoops to try to delete
  13. # it when configure exits.)
  14. TMPDIR1="config-temp"
  15. rm -rf "${TMPDIR1}"
  16. mkdir -p "${TMPDIR1}"
  17. if [ $? -ne 0 ]; then
  18. echo "ERROR: failed to create temporary directory"
  19. exit 1
  20. fi
  21. TMPB="qemu-conf"
  22. TMPC="${TMPDIR1}/${TMPB}.c"
  23. TMPO="${TMPDIR1}/${TMPB}.o"
  24. TMPCXX="${TMPDIR1}/${TMPB}.cxx"
  25. TMPL="${TMPDIR1}/${TMPB}.lo"
  26. TMPA="${TMPDIR1}/lib${TMPB}.la"
  27. TMPE="${TMPDIR1}/${TMPB}.exe"
  28. rm -f config.log
  29. # Print a helpful header at the top of config.log
  30. echo "# QEMU configure log $(date)" >> config.log
  31. printf "# Configured with:" >> config.log
  32. printf " '%s'" "$0" "$@" >> config.log
  33. echo >> config.log
  34. echo "#" >> config.log
  35. error_exit() {
  36. echo
  37. echo "ERROR: $1"
  38. while test -n "$2"; do
  39. echo " $2"
  40. shift
  41. done
  42. echo
  43. exit 1
  44. }
  45. do_compiler() {
  46. # Run the compiler, capturing its output to the log. First argument
  47. # is compiler binary to execute.
  48. local compiler="$1"
  49. shift
  50. echo $compiler "$@" >> config.log
  51. $compiler "$@" >> config.log 2>&1 || return $?
  52. # Test passed. If this is an --enable-werror build, rerun
  53. # the test with -Werror and bail out if it fails. This
  54. # makes warning-generating-errors in configure test code
  55. # obvious to developers.
  56. if test "$werror" != "yes"; then
  57. return 0
  58. fi
  59. # Don't bother rerunning the compile if we were already using -Werror
  60. case "$*" in
  61. *-Werror*)
  62. return 0
  63. ;;
  64. esac
  65. echo $compiler -Werror "$@" >> config.log
  66. $compiler -Werror "$@" >> config.log 2>&1 && return $?
  67. error_exit "configure test passed without -Werror but failed with -Werror." \
  68. "This is probably a bug in the configure script. The failing command" \
  69. "will be at the bottom of config.log." \
  70. "You can run configure with --disable-werror to bypass this check."
  71. }
  72. do_cc() {
  73. do_compiler "$cc" "$@"
  74. }
  75. do_cxx() {
  76. do_compiler "$cxx" "$@"
  77. }
  78. update_cxxflags() {
  79. # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
  80. # options which some versions of GCC's C++ compiler complain about
  81. # because they only make sense for C programs.
  82. QEMU_CXXFLAGS=
  83. for arg in $QEMU_CFLAGS; do
  84. case $arg in
  85. -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
  86. -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
  87. ;;
  88. *)
  89. QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
  90. ;;
  91. esac
  92. done
  93. }
  94. compile_object() {
  95. do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
  96. }
  97. compile_prog() {
  98. local_cflags="$1"
  99. local_ldflags="$2"
  100. do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
  101. }
  102. do_libtool() {
  103. local mode=$1
  104. shift
  105. # Run the compiler, capturing its output to the log.
  106. echo $libtool $mode --tag=CC $cc "$@" >> config.log
  107. $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
  108. # Test passed. If this is an --enable-werror build, rerun
  109. # the test with -Werror and bail out if it fails. This
  110. # makes warning-generating-errors in configure test code
  111. # obvious to developers.
  112. if test "$werror" != "yes"; then
  113. return 0
  114. fi
  115. # Don't bother rerunning the compile if we were already using -Werror
  116. case "$*" in
  117. *-Werror*)
  118. return 0
  119. ;;
  120. esac
  121. echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
  122. $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
  123. error_exit "configure test passed without -Werror but failed with -Werror." \
  124. "This is probably a bug in the configure script. The failing command" \
  125. "will be at the bottom of config.log." \
  126. "You can run configure with --disable-werror to bypass this check."
  127. }
  128. libtool_prog() {
  129. do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
  130. do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
  131. }
  132. # symbolically link $1 to $2. Portable version of "ln -sf".
  133. symlink() {
  134. rm -rf "$2"
  135. mkdir -p "$(dirname "$2")"
  136. ln -s "$1" "$2"
  137. }
  138. # check whether a command is available to this shell (may be either an
  139. # executable or a builtin)
  140. has() {
  141. type "$1" >/dev/null 2>&1
  142. }
  143. # search for an executable in PATH
  144. path_of() {
  145. local_command="$1"
  146. local_ifs="$IFS"
  147. local_dir=""
  148. # pathname has a dir component?
  149. if [ "${local_command#*/}" != "$local_command" ]; then
  150. if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
  151. echo "$local_command"
  152. return 0
  153. fi
  154. fi
  155. if [ -z "$local_command" ]; then
  156. return 1
  157. fi
  158. IFS=:
  159. for local_dir in $PATH; do
  160. if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
  161. echo "$local_dir/$local_command"
  162. IFS="${local_ifs:-$(printf ' \t\n')}"
  163. return 0
  164. fi
  165. done
  166. # not found
  167. IFS="${local_ifs:-$(printf ' \t\n')}"
  168. return 1
  169. }
  170. have_backend () {
  171. echo "$trace_backends" | grep "$1" >/dev/null
  172. }
  173. # default parameters
  174. source_path=`dirname "$0"`
  175. cpu=""
  176. iasl="iasl"
  177. interp_prefix="/usr/gnemul/qemu-%M"
  178. static="no"
  179. cross_prefix=""
  180. audio_drv_list=""
  181. block_drv_rw_whitelist=""
  182. block_drv_ro_whitelist=""
  183. host_cc="cc"
  184. libs_softmmu=""
  185. libs_tools=""
  186. audio_pt_int=""
  187. audio_win_int=""
  188. cc_i386=i386-pc-linux-gnu-gcc
  189. libs_qga=""
  190. debug_info="yes"
  191. stack_protector=""
  192. # Don't accept a target_list environment variable.
  193. unset target_list
  194. # Default value for a variable defining feature "foo".
  195. # * foo="no" feature will only be used if --enable-foo arg is given
  196. # * foo="" feature will be searched for, and if found, will be used
  197. # unless --disable-foo is given
  198. # * foo="yes" this value will only be set by --enable-foo flag.
  199. # feature will searched for,
  200. # if not found, configure exits with error
  201. #
  202. # Always add --enable-foo and --disable-foo command line args.
  203. # Distributions want to ensure that several features are compiled in, and it
  204. # is impossible without a --enable-foo that exits if a feature is not found.
  205. bluez=""
  206. brlapi=""
  207. curl=""
  208. curses=""
  209. docs=""
  210. fdt=""
  211. netmap="no"
  212. pixman=""
  213. sdl=""
  214. sdlabi="1.2"
  215. virtfs=""
  216. vnc="yes"
  217. sparse="no"
  218. uuid=""
  219. vde=""
  220. vnc_tls=""
  221. vnc_sasl=""
  222. vnc_jpeg=""
  223. vnc_png=""
  224. vnc_ws=""
  225. xen=""
  226. xen_ctrl_version=""
  227. xen_pci_passthrough=""
  228. linux_aio=""
  229. cap_ng=""
  230. attr=""
  231. libattr=""
  232. xfs=""
  233. vhost_net="no"
  234. vhost_scsi="no"
  235. kvm="no"
  236. rdma=""
  237. gprof="no"
  238. debug_tcg="no"
  239. debug="no"
  240. strip_opt="yes"
  241. tcg_interpreter="no"
  242. bigendian="no"
  243. mingw32="no"
  244. gcov="no"
  245. gcov_tool="gcov"
  246. EXESUF=""
  247. DSOSUF=".so"
  248. LDFLAGS_SHARED="-shared"
  249. modules="no"
  250. prefix="/usr/local"
  251. mandir="\${prefix}/share/man"
  252. datadir="\${prefix}/share"
  253. qemu_docdir="\${prefix}/share/doc/qemu"
  254. bindir="\${prefix}/bin"
  255. libdir="\${prefix}/lib"
  256. libexecdir="\${prefix}/libexec"
  257. includedir="\${prefix}/include"
  258. sysconfdir="\${prefix}/etc"
  259. local_statedir="\${prefix}/var"
  260. confsuffix="/qemu"
  261. slirp="yes"
  262. fmod_lib=""
  263. fmod_inc=""
  264. oss_lib=""
  265. bsd="no"
  266. linux="no"
  267. solaris="no"
  268. profiler="no"
  269. cocoa="no"
  270. softmmu="yes"
  271. linux_user="no"
  272. bsd_user="no"
  273. guest_base="yes"
  274. aix="no"
  275. blobs="yes"
  276. pkgversion=""
  277. pie=""
  278. zero_malloc=""
  279. qom_cast_debug="yes"
  280. trace_backends="nop"
  281. trace_file="trace"
  282. spice=""
  283. rbd=""
  284. smartcard_nss=""
  285. libusb=""
  286. usb_redir=""
  287. glx=""
  288. zlib="yes"
  289. lzo=""
  290. snappy=""
  291. guest_agent=""
  292. guest_agent_with_vss="no"
  293. vss_win32_sdk=""
  294. win_sdk="no"
  295. want_tools="yes"
  296. libiscsi=""
  297. libnfs=""
  298. coroutine=""
  299. coroutine_pool=""
  300. seccomp=""
  301. glusterfs=""
  302. glusterfs_discard="no"
  303. glusterfs_zerofill="no"
  304. archipelago=""
  305. gtk=""
  306. gtkabi=""
  307. vte=""
  308. tpm="yes"
  309. libssh2=""
  310. vhdx=""
  311. quorum=""
  312. numa=""
  313. # parse CC options first
  314. for opt do
  315. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  316. case "$opt" in
  317. --cross-prefix=*) cross_prefix="$optarg"
  318. ;;
  319. --cc=*) CC="$optarg"
  320. ;;
  321. --cxx=*) CXX="$optarg"
  322. ;;
  323. --source-path=*) source_path="$optarg"
  324. ;;
  325. --cpu=*) cpu="$optarg"
  326. ;;
  327. --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
  328. EXTRA_CFLAGS="$optarg"
  329. ;;
  330. --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
  331. EXTRA_LDFLAGS="$optarg"
  332. ;;
  333. --enable-debug-info) debug_info="yes"
  334. ;;
  335. --disable-debug-info) debug_info="no"
  336. ;;
  337. esac
  338. done
  339. # OS specific
  340. # Using uname is really, really broken. Once we have the right set of checks
  341. # we can eliminate its usage altogether.
  342. # Preferred compiler:
  343. # ${CC} (if set)
  344. # ${cross_prefix}gcc (if cross-prefix specified)
  345. # system compiler
  346. if test -z "${CC}${cross_prefix}"; then
  347. cc="$host_cc"
  348. else
  349. cc="${CC-${cross_prefix}gcc}"
  350. fi
  351. if test -z "${CXX}${cross_prefix}"; then
  352. cxx="c++"
  353. else
  354. cxx="${CXX-${cross_prefix}g++}"
  355. fi
  356. ar="${AR-${cross_prefix}ar}"
  357. as="${AS-${cross_prefix}as}"
  358. cpp="${CPP-$cc -E}"
  359. objcopy="${OBJCOPY-${cross_prefix}objcopy}"
  360. ld="${LD-${cross_prefix}ld}"
  361. libtool="${LIBTOOL-${cross_prefix}libtool}"
  362. nm="${NM-${cross_prefix}nm}"
  363. strip="${STRIP-${cross_prefix}strip}"
  364. windres="${WINDRES-${cross_prefix}windres}"
  365. pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
  366. query_pkg_config() {
  367. "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
  368. }
  369. pkg_config=query_pkg_config
  370. sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
  371. sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
  372. # If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
  373. ARFLAGS="${ARFLAGS-rv}"
  374. # default flags for all hosts
  375. QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS"
  376. QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
  377. QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
  378. QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
  379. QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
  380. if test "$debug_info" = "yes"; then
  381. CFLAGS="-g $CFLAGS"
  382. LDFLAGS="-g $LDFLAGS"
  383. fi
  384. # make source path absolute
  385. source_path=`cd "$source_path"; pwd`
  386. # running configure in the source tree?
  387. # we know that's the case if configure is there.
  388. if test -f "./configure"; then
  389. pwd_is_source_path="y"
  390. else
  391. pwd_is_source_path="n"
  392. fi
  393. check_define() {
  394. cat > $TMPC <<EOF
  395. #if !defined($1)
  396. #error $1 not defined
  397. #endif
  398. int main(void) { return 0; }
  399. EOF
  400. compile_object
  401. }
  402. if check_define __linux__ ; then
  403. targetos="Linux"
  404. elif check_define _WIN32 ; then
  405. targetos='MINGW32'
  406. elif check_define __OpenBSD__ ; then
  407. targetos='OpenBSD'
  408. elif check_define __sun__ ; then
  409. targetos='SunOS'
  410. elif check_define __HAIKU__ ; then
  411. targetos='Haiku'
  412. else
  413. targetos=`uname -s`
  414. fi
  415. # Some host OSes need non-standard checks for which CPU to use.
  416. # Note that these checks are broken for cross-compilation: if you're
  417. # cross-compiling to one of these OSes then you'll need to specify
  418. # the correct CPU with the --cpu option.
  419. case $targetos in
  420. Darwin)
  421. # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
  422. # run 64-bit userspace code.
  423. # If the user didn't specify a CPU explicitly and the kernel says this is
  424. # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
  425. if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
  426. cpu="x86_64"
  427. fi
  428. ;;
  429. SunOS)
  430. # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
  431. if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
  432. cpu="x86_64"
  433. fi
  434. esac
  435. if test ! -z "$cpu" ; then
  436. # command line argument
  437. :
  438. elif check_define __i386__ ; then
  439. cpu="i386"
  440. elif check_define __x86_64__ ; then
  441. if check_define __ILP32__ ; then
  442. cpu="x32"
  443. else
  444. cpu="x86_64"
  445. fi
  446. elif check_define __sparc__ ; then
  447. if check_define __arch64__ ; then
  448. cpu="sparc64"
  449. else
  450. cpu="sparc"
  451. fi
  452. elif check_define _ARCH_PPC ; then
  453. if check_define _ARCH_PPC64 ; then
  454. cpu="ppc64"
  455. else
  456. cpu="ppc"
  457. fi
  458. elif check_define __mips__ ; then
  459. cpu="mips"
  460. elif check_define __ia64__ ; then
  461. cpu="ia64"
  462. elif check_define __s390__ ; then
  463. if check_define __s390x__ ; then
  464. cpu="s390x"
  465. else
  466. cpu="s390"
  467. fi
  468. elif check_define __arm__ ; then
  469. cpu="arm"
  470. elif check_define __aarch64__ ; then
  471. cpu="aarch64"
  472. elif check_define __hppa__ ; then
  473. cpu="hppa"
  474. else
  475. cpu=`uname -m`
  476. fi
  477. ARCH=
  478. # Normalise host CPU name and set ARCH.
  479. # Note that this case should only have supported host CPUs, not guests.
  480. case "$cpu" in
  481. ia64|ppc|ppc64|s390|s390x|sparc64|x32)
  482. cpu="$cpu"
  483. ;;
  484. i386|i486|i586|i686|i86pc|BePC)
  485. cpu="i386"
  486. ;;
  487. x86_64|amd64)
  488. cpu="x86_64"
  489. ;;
  490. armv*b|armv*l|arm)
  491. cpu="arm"
  492. ;;
  493. aarch64)
  494. cpu="aarch64"
  495. ;;
  496. mips*)
  497. cpu="mips"
  498. ;;
  499. sparc|sun4[cdmuv])
  500. cpu="sparc"
  501. ;;
  502. *)
  503. # This will result in either an error or falling back to TCI later
  504. ARCH=unknown
  505. ;;
  506. esac
  507. if test -z "$ARCH"; then
  508. ARCH="$cpu"
  509. fi
  510. # OS specific
  511. # host *BSD for user mode
  512. HOST_VARIANT_DIR=""
  513. case $targetos in
  514. CYGWIN*)
  515. mingw32="yes"
  516. QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
  517. audio_possible_drivers="winwave sdl"
  518. audio_drv_list="winwave"
  519. ;;
  520. MINGW32*)
  521. mingw32="yes"
  522. audio_possible_drivers="winwave dsound sdl fmod"
  523. audio_drv_list="winwave"
  524. ;;
  525. GNU/kFreeBSD)
  526. bsd="yes"
  527. audio_drv_list="oss"
  528. audio_possible_drivers="oss sdl esd pa"
  529. ;;
  530. FreeBSD)
  531. bsd="yes"
  532. make="${MAKE-gmake}"
  533. audio_drv_list="oss"
  534. audio_possible_drivers="oss sdl esd pa"
  535. # needed for kinfo_getvmmap(3) in libutil.h
  536. LIBS="-lutil $LIBS"
  537. netmap="" # enable netmap autodetect
  538. HOST_VARIANT_DIR="freebsd"
  539. ;;
  540. DragonFly)
  541. bsd="yes"
  542. make="${MAKE-gmake}"
  543. audio_drv_list="oss"
  544. audio_possible_drivers="oss sdl esd pa"
  545. HOST_VARIANT_DIR="dragonfly"
  546. ;;
  547. NetBSD)
  548. bsd="yes"
  549. make="${MAKE-gmake}"
  550. audio_drv_list="oss"
  551. audio_possible_drivers="oss sdl esd"
  552. oss_lib="-lossaudio"
  553. HOST_VARIANT_DIR="netbsd"
  554. ;;
  555. OpenBSD)
  556. bsd="yes"
  557. make="${MAKE-gmake}"
  558. audio_drv_list="sdl"
  559. audio_possible_drivers="sdl esd"
  560. HOST_VARIANT_DIR="openbsd"
  561. ;;
  562. Darwin)
  563. bsd="yes"
  564. darwin="yes"
  565. LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
  566. if [ "$cpu" = "x86_64" ] ; then
  567. QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
  568. LDFLAGS="-arch x86_64 $LDFLAGS"
  569. fi
  570. cocoa="yes"
  571. audio_drv_list="coreaudio"
  572. audio_possible_drivers="coreaudio sdl fmod"
  573. LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
  574. libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
  575. # Disable attempts to use ObjectiveC features in os/object.h since they
  576. # won't work when we're compiling with gcc as a C compiler.
  577. QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
  578. HOST_VARIANT_DIR="darwin"
  579. ;;
  580. SunOS)
  581. solaris="yes"
  582. make="${MAKE-gmake}"
  583. install="${INSTALL-ginstall}"
  584. ld="gld"
  585. smbd="${SMBD-/usr/sfw/sbin/smbd}"
  586. needs_libsunmath="no"
  587. solarisrev=`uname -r | cut -f2 -d.`
  588. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  589. if test "$solarisrev" -le 9 ; then
  590. if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
  591. needs_libsunmath="yes"
  592. QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
  593. LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
  594. LIBS="-lsunmath $LIBS"
  595. else
  596. error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
  597. "libsunmath from the Sun Studio compilers tools, due to a lack of" \
  598. "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
  599. "Studio 11 can be downloaded from www.sun.com."
  600. fi
  601. fi
  602. fi
  603. if test -f /usr/include/sys/soundcard.h ; then
  604. audio_drv_list="oss"
  605. fi
  606. audio_possible_drivers="oss sdl"
  607. # needed for CMSG_ macros in sys/socket.h
  608. QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
  609. # needed for TIOCWIN* defines in termios.h
  610. QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
  611. QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
  612. solarisnetlibs="-lsocket -lnsl -lresolv"
  613. LIBS="$solarisnetlibs $LIBS"
  614. libs_qga="$solarisnetlibs $libs_qga"
  615. ;;
  616. AIX)
  617. aix="yes"
  618. make="${MAKE-gmake}"
  619. ;;
  620. Haiku)
  621. haiku="yes"
  622. QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
  623. LIBS="-lposix_error_mapper -lnetwork $LIBS"
  624. ;;
  625. *)
  626. audio_drv_list="oss"
  627. audio_possible_drivers="oss alsa sdl esd pa"
  628. linux="yes"
  629. linux_user="yes"
  630. kvm="yes"
  631. vhost_net="yes"
  632. vhost_scsi="yes"
  633. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
  634. audio_possible_drivers="$audio_possible_drivers fmod"
  635. fi
  636. QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
  637. ;;
  638. esac
  639. if [ "$bsd" = "yes" ] ; then
  640. if [ "$darwin" != "yes" ] ; then
  641. bsd_user="yes"
  642. fi
  643. fi
  644. : ${make=${MAKE-make}}
  645. : ${install=${INSTALL-install}}
  646. : ${python=${PYTHON-python}}
  647. : ${smbd=${SMBD-/usr/sbin/smbd}}
  648. # Default objcc to clang if available, otherwise use CC
  649. if has clang; then
  650. objcc=clang
  651. else
  652. objcc="$cc"
  653. fi
  654. if test "$mingw32" = "yes" ; then
  655. EXESUF=".exe"
  656. DSOSUF=".dll"
  657. QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
  658. # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
  659. QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
  660. LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
  661. cat > $TMPC << EOF
  662. int main(void) { return 0; }
  663. EOF
  664. if compile_prog "" "-liberty" ; then
  665. LIBS="-liberty $LIBS"
  666. fi
  667. prefix="c:/Program Files/QEMU"
  668. mandir="\${prefix}"
  669. datadir="\${prefix}"
  670. qemu_docdir="\${prefix}"
  671. bindir="\${prefix}"
  672. sysconfdir="\${prefix}"
  673. local_statedir=
  674. confsuffix=""
  675. libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
  676. fi
  677. werror=""
  678. for opt do
  679. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  680. case "$opt" in
  681. --help|-h) show_help=yes
  682. ;;
  683. --version|-V) exec cat $source_path/VERSION
  684. ;;
  685. --prefix=*) prefix="$optarg"
  686. ;;
  687. --interp-prefix=*) interp_prefix="$optarg"
  688. ;;
  689. --source-path=*)
  690. ;;
  691. --cross-prefix=*)
  692. ;;
  693. --cc=*)
  694. ;;
  695. --host-cc=*) host_cc="$optarg"
  696. ;;
  697. --cxx=*)
  698. ;;
  699. --iasl=*) iasl="$optarg"
  700. ;;
  701. --objcc=*) objcc="$optarg"
  702. ;;
  703. --make=*) make="$optarg"
  704. ;;
  705. --install=*) install="$optarg"
  706. ;;
  707. --python=*) python="$optarg"
  708. ;;
  709. --gcov=*) gcov_tool="$optarg"
  710. ;;
  711. --smbd=*) smbd="$optarg"
  712. ;;
  713. --extra-cflags=*)
  714. ;;
  715. --extra-ldflags=*)
  716. ;;
  717. --enable-debug-info)
  718. ;;
  719. --disable-debug-info)
  720. ;;
  721. --enable-modules)
  722. modules="yes"
  723. ;;
  724. --cpu=*)
  725. ;;
  726. --target-list=*) target_list="$optarg"
  727. ;;
  728. --enable-trace-backends=*) trace_backends="$optarg"
  729. ;;
  730. # XXX: backwards compatibility
  731. --enable-trace-backend=*) trace_backends="$optarg"
  732. ;;
  733. --with-trace-file=*) trace_file="$optarg"
  734. ;;
  735. --enable-gprof) gprof="yes"
  736. ;;
  737. --enable-gcov) gcov="yes"
  738. ;;
  739. --static)
  740. static="yes"
  741. LDFLAGS="-static $LDFLAGS"
  742. QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
  743. ;;
  744. --mandir=*) mandir="$optarg"
  745. ;;
  746. --bindir=*) bindir="$optarg"
  747. ;;
  748. --libdir=*) libdir="$optarg"
  749. ;;
  750. --libexecdir=*) libexecdir="$optarg"
  751. ;;
  752. --includedir=*) includedir="$optarg"
  753. ;;
  754. --datadir=*) datadir="$optarg"
  755. ;;
  756. --with-confsuffix=*) confsuffix="$optarg"
  757. ;;
  758. --docdir=*) qemu_docdir="$optarg"
  759. ;;
  760. --sysconfdir=*) sysconfdir="$optarg"
  761. ;;
  762. --localstatedir=*) local_statedir="$optarg"
  763. ;;
  764. --sbindir=*|--sharedstatedir=*|\
  765. --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
  766. --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
  767. # These switches are silently ignored, for compatibility with
  768. # autoconf-generated configure scripts. This allows QEMU's
  769. # configure to be used by RPM and similar macros that set
  770. # lots of directory switches by default.
  771. ;;
  772. --with-system-pixman) pixman="system"
  773. ;;
  774. --without-system-pixman) pixman="internal"
  775. ;;
  776. --without-pixman) pixman="none"
  777. ;;
  778. --disable-sdl) sdl="no"
  779. ;;
  780. --enable-sdl) sdl="yes"
  781. ;;
  782. --with-sdlabi=*) sdlabi="$optarg"
  783. ;;
  784. --disable-qom-cast-debug) qom_cast_debug="no"
  785. ;;
  786. --enable-qom-cast-debug) qom_cast_debug="yes"
  787. ;;
  788. --disable-virtfs) virtfs="no"
  789. ;;
  790. --enable-virtfs) virtfs="yes"
  791. ;;
  792. --disable-vnc) vnc="no"
  793. ;;
  794. --enable-vnc) vnc="yes"
  795. ;;
  796. --fmod-lib=*) fmod_lib="$optarg"
  797. ;;
  798. --fmod-inc=*) fmod_inc="$optarg"
  799. ;;
  800. --oss-lib=*) oss_lib="$optarg"
  801. ;;
  802. --audio-drv-list=*) audio_drv_list="$optarg"
  803. ;;
  804. --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
  805. ;;
  806. --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
  807. ;;
  808. --enable-debug-tcg) debug_tcg="yes"
  809. ;;
  810. --disable-debug-tcg) debug_tcg="no"
  811. ;;
  812. --enable-debug)
  813. # Enable debugging options that aren't excessively noisy
  814. debug_tcg="yes"
  815. debug="yes"
  816. strip_opt="no"
  817. ;;
  818. --enable-sparse) sparse="yes"
  819. ;;
  820. --disable-sparse) sparse="no"
  821. ;;
  822. --disable-strip) strip_opt="no"
  823. ;;
  824. --disable-vnc-tls) vnc_tls="no"
  825. ;;
  826. --enable-vnc-tls) vnc_tls="yes"
  827. ;;
  828. --disable-vnc-sasl) vnc_sasl="no"
  829. ;;
  830. --enable-vnc-sasl) vnc_sasl="yes"
  831. ;;
  832. --disable-vnc-jpeg) vnc_jpeg="no"
  833. ;;
  834. --enable-vnc-jpeg) vnc_jpeg="yes"
  835. ;;
  836. --disable-vnc-png) vnc_png="no"
  837. ;;
  838. --enable-vnc-png) vnc_png="yes"
  839. ;;
  840. --disable-vnc-ws) vnc_ws="no"
  841. ;;
  842. --enable-vnc-ws) vnc_ws="yes"
  843. ;;
  844. --disable-slirp) slirp="no"
  845. ;;
  846. --disable-uuid) uuid="no"
  847. ;;
  848. --enable-uuid) uuid="yes"
  849. ;;
  850. --disable-vde) vde="no"
  851. ;;
  852. --enable-vde) vde="yes"
  853. ;;
  854. --disable-netmap) netmap="no"
  855. ;;
  856. --enable-netmap) netmap="yes"
  857. ;;
  858. --disable-xen) xen="no"
  859. ;;
  860. --enable-xen) xen="yes"
  861. ;;
  862. --disable-xen-pci-passthrough) xen_pci_passthrough="no"
  863. ;;
  864. --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
  865. ;;
  866. --disable-brlapi) brlapi="no"
  867. ;;
  868. --enable-brlapi) brlapi="yes"
  869. ;;
  870. --disable-bluez) bluez="no"
  871. ;;
  872. --enable-bluez) bluez="yes"
  873. ;;
  874. --disable-kvm) kvm="no"
  875. ;;
  876. --enable-kvm) kvm="yes"
  877. ;;
  878. --disable-tcg-interpreter) tcg_interpreter="no"
  879. ;;
  880. --enable-tcg-interpreter) tcg_interpreter="yes"
  881. ;;
  882. --disable-cap-ng) cap_ng="no"
  883. ;;
  884. --enable-cap-ng) cap_ng="yes"
  885. ;;
  886. --disable-spice) spice="no"
  887. ;;
  888. --enable-spice) spice="yes"
  889. ;;
  890. --disable-libiscsi) libiscsi="no"
  891. ;;
  892. --enable-libiscsi) libiscsi="yes"
  893. ;;
  894. --disable-libnfs) libnfs="no"
  895. ;;
  896. --enable-libnfs) libnfs="yes"
  897. ;;
  898. --enable-profiler) profiler="yes"
  899. ;;
  900. --disable-cocoa) cocoa="no"
  901. ;;
  902. --enable-cocoa)
  903. cocoa="yes" ;
  904. sdl="no" ;
  905. audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
  906. ;;
  907. --disable-system) softmmu="no"
  908. ;;
  909. --enable-system) softmmu="yes"
  910. ;;
  911. --disable-user)
  912. linux_user="no" ;
  913. bsd_user="no" ;
  914. ;;
  915. --enable-user) ;;
  916. --disable-linux-user) linux_user="no"
  917. ;;
  918. --enable-linux-user) linux_user="yes"
  919. ;;
  920. --disable-bsd-user) bsd_user="no"
  921. ;;
  922. --enable-bsd-user) bsd_user="yes"
  923. ;;
  924. --enable-guest-base) guest_base="yes"
  925. ;;
  926. --disable-guest-base) guest_base="no"
  927. ;;
  928. --enable-pie) pie="yes"
  929. ;;
  930. --disable-pie) pie="no"
  931. ;;
  932. --enable-werror) werror="yes"
  933. ;;
  934. --disable-werror) werror="no"
  935. ;;
  936. --enable-stack-protector) stack_protector="yes"
  937. ;;
  938. --disable-stack-protector) stack_protector="no"
  939. ;;
  940. --disable-curses) curses="no"
  941. ;;
  942. --enable-curses) curses="yes"
  943. ;;
  944. --disable-curl) curl="no"
  945. ;;
  946. --enable-curl) curl="yes"
  947. ;;
  948. --disable-fdt) fdt="no"
  949. ;;
  950. --enable-fdt) fdt="yes"
  951. ;;
  952. --disable-linux-aio) linux_aio="no"
  953. ;;
  954. --enable-linux-aio) linux_aio="yes"
  955. ;;
  956. --disable-attr) attr="no"
  957. ;;
  958. --enable-attr) attr="yes"
  959. ;;
  960. --disable-blobs) blobs="no"
  961. ;;
  962. --with-pkgversion=*) pkgversion=" ($optarg)"
  963. ;;
  964. --with-coroutine=*) coroutine="$optarg"
  965. ;;
  966. --disable-coroutine-pool) coroutine_pool="no"
  967. ;;
  968. --enable-coroutine-pool) coroutine_pool="yes"
  969. ;;
  970. --disable-docs) docs="no"
  971. ;;
  972. --enable-docs) docs="yes"
  973. ;;
  974. --disable-vhost-net) vhost_net="no"
  975. ;;
  976. --enable-vhost-net) vhost_net="yes"
  977. ;;
  978. --disable-vhost-scsi) vhost_scsi="no"
  979. ;;
  980. --enable-vhost-scsi) vhost_scsi="yes"
  981. ;;
  982. --disable-glx) glx="no"
  983. ;;
  984. --enable-glx) glx="yes"
  985. ;;
  986. --disable-rbd) rbd="no"
  987. ;;
  988. --enable-rbd) rbd="yes"
  989. ;;
  990. --disable-xfsctl) xfs="no"
  991. ;;
  992. --enable-xfsctl) xfs="yes"
  993. ;;
  994. --disable-smartcard-nss) smartcard_nss="no"
  995. ;;
  996. --enable-smartcard-nss) smartcard_nss="yes"
  997. ;;
  998. --disable-libusb) libusb="no"
  999. ;;
  1000. --enable-libusb) libusb="yes"
  1001. ;;
  1002. --disable-usb-redir) usb_redir="no"
  1003. ;;
  1004. --enable-usb-redir) usb_redir="yes"
  1005. ;;
  1006. --disable-zlib-test) zlib="no"
  1007. ;;
  1008. --disable-lzo) lzo="no"
  1009. ;;
  1010. --enable-lzo) lzo="yes"
  1011. ;;
  1012. --disable-snappy) snappy="no"
  1013. ;;
  1014. --enable-snappy) snappy="yes"
  1015. ;;
  1016. --enable-guest-agent) guest_agent="yes"
  1017. ;;
  1018. --disable-guest-agent) guest_agent="no"
  1019. ;;
  1020. --with-vss-sdk) vss_win32_sdk=""
  1021. ;;
  1022. --with-vss-sdk=*) vss_win32_sdk="$optarg"
  1023. ;;
  1024. --without-vss-sdk) vss_win32_sdk="no"
  1025. ;;
  1026. --with-win-sdk) win_sdk=""
  1027. ;;
  1028. --with-win-sdk=*) win_sdk="$optarg"
  1029. ;;
  1030. --without-win-sdk) win_sdk="no"
  1031. ;;
  1032. --enable-tools) want_tools="yes"
  1033. ;;
  1034. --disable-tools) want_tools="no"
  1035. ;;
  1036. --enable-seccomp) seccomp="yes"
  1037. ;;
  1038. --disable-seccomp) seccomp="no"
  1039. ;;
  1040. --disable-glusterfs) glusterfs="no"
  1041. ;;
  1042. --enable-glusterfs) glusterfs="yes"
  1043. ;;
  1044. --disable-archipelago) archipelago="no"
  1045. ;;
  1046. --enable-archipelago) archipelago="yes"
  1047. ;;
  1048. --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
  1049. echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
  1050. ;;
  1051. --disable-gtk) gtk="no"
  1052. ;;
  1053. --enable-gtk) gtk="yes"
  1054. ;;
  1055. --enable-rdma) rdma="yes"
  1056. ;;
  1057. --disable-rdma) rdma="no"
  1058. ;;
  1059. --with-gtkabi=*) gtkabi="$optarg"
  1060. ;;
  1061. --disable-vte) vte="no"
  1062. ;;
  1063. --enable-vte) vte="yes"
  1064. ;;
  1065. --disable-tpm) tpm="no"
  1066. ;;
  1067. --enable-tpm) tpm="yes"
  1068. ;;
  1069. --disable-libssh2) libssh2="no"
  1070. ;;
  1071. --enable-libssh2) libssh2="yes"
  1072. ;;
  1073. --enable-vhdx) vhdx="yes"
  1074. ;;
  1075. --disable-vhdx) vhdx="no"
  1076. ;;
  1077. --disable-quorum) quorum="no"
  1078. ;;
  1079. --enable-quorum) quorum="yes"
  1080. ;;
  1081. --disable-numa) numa="no"
  1082. ;;
  1083. --enable-numa) numa="yes"
  1084. ;;
  1085. *)
  1086. echo "ERROR: unknown option $opt"
  1087. echo "Try '$0 --help' for more information"
  1088. exit 1
  1089. ;;
  1090. esac
  1091. done
  1092. if ! has $python; then
  1093. error_exit "Python not found. Use --python=/path/to/python"
  1094. fi
  1095. # Note that if the Python conditional here evaluates True we will exit
  1096. # with status 1 which is a shell 'false' value.
  1097. if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
  1098. error_exit "Cannot use '$python', Python 2.4 or later is required." \
  1099. "Note that Python 3 or later is not yet supported." \
  1100. "Use --python=/path/to/python to specify a supported Python."
  1101. fi
  1102. # The -B switch was added in Python 2.6.
  1103. # If it is supplied, compiled files are not written.
  1104. # Use it for Python versions which support it.
  1105. if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
  1106. python="$python -B"
  1107. fi
  1108. case "$cpu" in
  1109. ppc)
  1110. CPU_CFLAGS="-m32"
  1111. LDFLAGS="-m32 $LDFLAGS"
  1112. ;;
  1113. ppc64)
  1114. CPU_CFLAGS="-m64"
  1115. LDFLAGS="-m64 $LDFLAGS"
  1116. ;;
  1117. sparc)
  1118. LDFLAGS="-m32 $LDFLAGS"
  1119. CPU_CFLAGS="-m32 -mcpu=ultrasparc"
  1120. ;;
  1121. sparc64)
  1122. LDFLAGS="-m64 $LDFLAGS"
  1123. CPU_CFLAGS="-m64 -mcpu=ultrasparc"
  1124. ;;
  1125. s390)
  1126. CPU_CFLAGS="-m31"
  1127. LDFLAGS="-m31 $LDFLAGS"
  1128. ;;
  1129. s390x)
  1130. CPU_CFLAGS="-m64"
  1131. LDFLAGS="-m64 $LDFLAGS"
  1132. ;;
  1133. i386)
  1134. CPU_CFLAGS="-m32"
  1135. LDFLAGS="-m32 $LDFLAGS"
  1136. cc_i386='$(CC) -m32'
  1137. ;;
  1138. x86_64)
  1139. CPU_CFLAGS="-m64"
  1140. LDFLAGS="-m64 $LDFLAGS"
  1141. cc_i386='$(CC) -m32'
  1142. ;;
  1143. x32)
  1144. CPU_CFLAGS="-mx32"
  1145. LDFLAGS="-mx32 $LDFLAGS"
  1146. cc_i386='$(CC) -m32'
  1147. ;;
  1148. # No special flags required for other host CPUs
  1149. esac
  1150. QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
  1151. EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
  1152. default_target_list=""
  1153. mak_wilds=""
  1154. if [ "$softmmu" = "yes" ]; then
  1155. mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
  1156. fi
  1157. if [ "$linux_user" = "yes" ]; then
  1158. mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
  1159. fi
  1160. if [ "$bsd_user" = "yes" ]; then
  1161. mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
  1162. fi
  1163. for config in $mak_wilds; do
  1164. default_target_list="${default_target_list} $(basename "$config" .mak)"
  1165. done
  1166. if test x"$show_help" = x"yes" ; then
  1167. cat << EOF
  1168. Usage: configure [options]
  1169. Options: [defaults in brackets after descriptions]
  1170. Standard options:
  1171. --help print this message
  1172. --prefix=PREFIX install in PREFIX [$prefix]
  1173. --interp-prefix=PREFIX where to find shared libraries, etc.
  1174. use %M for cpu name [$interp_prefix]
  1175. --target-list=LIST set target list (default: build everything)
  1176. $(echo Available targets: $default_target_list | \
  1177. fold -s -w 53 | sed -e 's/^/ /')
  1178. Advanced options (experts only):
  1179. --source-path=PATH path of source code [$source_path]
  1180. --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
  1181. --cc=CC use C compiler CC [$cc]
  1182. --iasl=IASL use ACPI compiler IASL [$iasl]
  1183. --host-cc=CC use C compiler CC [$host_cc] for code run at
  1184. build time
  1185. --cxx=CXX use C++ compiler CXX [$cxx]
  1186. --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
  1187. --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
  1188. --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
  1189. --make=MAKE use specified make [$make]
  1190. --install=INSTALL use specified install [$install]
  1191. --python=PYTHON use specified python [$python]
  1192. --smbd=SMBD use specified smbd [$smbd]
  1193. --static enable static build [$static]
  1194. --mandir=PATH install man pages in PATH
  1195. --datadir=PATH install firmware in PATH$confsuffix
  1196. --docdir=PATH install documentation in PATH$confsuffix
  1197. --bindir=PATH install binaries in PATH
  1198. --libdir=PATH install libraries in PATH
  1199. --sysconfdir=PATH install config in PATH$confsuffix
  1200. --localstatedir=PATH install local state in PATH (set at runtime on win32)
  1201. --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
  1202. --enable-modules enable modules support
  1203. --enable-debug-tcg enable TCG debugging
  1204. --disable-debug-tcg disable TCG debugging (default)
  1205. --enable-debug-info enable debugging information (default)
  1206. --disable-debug-info disable debugging information
  1207. --enable-debug enable common debug build options
  1208. --enable-sparse enable sparse checker
  1209. --disable-sparse disable sparse checker (default)
  1210. --disable-strip disable stripping binaries
  1211. --disable-werror disable compilation abort on warning
  1212. --disable-stack-protector disable compiler-provided stack protection
  1213. --disable-sdl disable SDL
  1214. --enable-sdl enable SDL
  1215. --with-sdlabi select preferred SDL ABI 1.2 or 2.0
  1216. --disable-gtk disable gtk UI
  1217. --enable-gtk enable gtk UI
  1218. --with-gtkabi select preferred GTK ABI 2.0 or 3.0
  1219. --disable-virtfs disable VirtFS
  1220. --enable-virtfs enable VirtFS
  1221. --disable-vnc disable VNC
  1222. --enable-vnc enable VNC
  1223. --disable-cocoa disable Cocoa (Mac OS X only)
  1224. --enable-cocoa enable Cocoa (default on Mac OS X)
  1225. --audio-drv-list=LIST set audio drivers list:
  1226. Available drivers: $audio_possible_drivers
  1227. --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
  1228. --block-drv-rw-whitelist=L
  1229. set block driver read-write whitelist
  1230. (affects only QEMU, not qemu-img)
  1231. --block-drv-ro-whitelist=L
  1232. set block driver read-only whitelist
  1233. (affects only QEMU, not qemu-img)
  1234. --disable-xen disable xen backend driver support
  1235. --enable-xen enable xen backend driver support
  1236. --disable-xen-pci-passthrough
  1237. --enable-xen-pci-passthrough
  1238. --disable-brlapi disable BrlAPI
  1239. --enable-brlapi enable BrlAPI
  1240. --disable-vnc-tls disable TLS encryption for VNC server
  1241. --enable-vnc-tls enable TLS encryption for VNC server
  1242. --disable-vnc-sasl disable SASL encryption for VNC server
  1243. --enable-vnc-sasl enable SASL encryption for VNC server
  1244. --disable-vnc-jpeg disable JPEG lossy compression for VNC server
  1245. --enable-vnc-jpeg enable JPEG lossy compression for VNC server
  1246. --disable-vnc-png disable PNG compression for VNC server (default)
  1247. --enable-vnc-png enable PNG compression for VNC server
  1248. --disable-vnc-ws disable Websockets support for VNC server
  1249. --enable-vnc-ws enable Websockets support for VNC server
  1250. --disable-curses disable curses output
  1251. --enable-curses enable curses output
  1252. --disable-curl disable curl connectivity
  1253. --enable-curl enable curl connectivity
  1254. --disable-fdt disable fdt device tree
  1255. --enable-fdt enable fdt device tree
  1256. --disable-bluez disable bluez stack connectivity
  1257. --enable-bluez enable bluez stack connectivity
  1258. --disable-slirp disable SLIRP userspace network connectivity
  1259. --disable-kvm disable KVM acceleration support
  1260. --enable-kvm enable KVM acceleration support
  1261. --disable-rdma disable RDMA-based migration support
  1262. --enable-rdma enable RDMA-based migration support
  1263. --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
  1264. --enable-system enable all system emulation targets
  1265. --disable-system disable all system emulation targets
  1266. --enable-user enable supported user emulation targets
  1267. --disable-user disable all user emulation targets
  1268. --enable-linux-user enable all linux usermode emulation targets
  1269. --disable-linux-user disable all linux usermode emulation targets
  1270. --enable-bsd-user enable all BSD usermode emulation targets
  1271. --disable-bsd-user disable all BSD usermode emulation targets
  1272. --enable-guest-base enable GUEST_BASE support for usermode
  1273. emulation targets
  1274. --disable-guest-base disable GUEST_BASE support
  1275. --enable-pie build Position Independent Executables
  1276. --disable-pie do not build Position Independent Executables
  1277. --fmod-lib path to FMOD library
  1278. --fmod-inc path to FMOD includes
  1279. --oss-lib path to OSS library
  1280. --cpu=CPU Build for host CPU [$cpu]
  1281. --disable-uuid disable uuid support
  1282. --enable-uuid enable uuid support
  1283. --disable-vde disable support for vde network
  1284. --enable-vde enable support for vde network
  1285. --disable-netmap disable support for netmap network
  1286. --enable-netmap enable support for netmap network
  1287. --disable-linux-aio disable Linux AIO support
  1288. --enable-linux-aio enable Linux AIO support
  1289. --disable-cap-ng disable libcap-ng support
  1290. --enable-cap-ng enable libcap-ng support
  1291. --disable-attr disable attr and xattr support
  1292. --enable-attr enable attr and xattr support
  1293. --disable-blobs disable installing provided firmware blobs
  1294. --enable-docs enable documentation build
  1295. --disable-docs disable documentation build
  1296. --disable-vhost-net disable vhost-net acceleration support
  1297. --enable-vhost-net enable vhost-net acceleration support
  1298. --enable-trace-backends=B Set trace backend
  1299. Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
  1300. --with-trace-file=NAME Full PATH,NAME of file to store traces
  1301. Default:trace-<pid>
  1302. --disable-spice disable spice
  1303. --enable-spice enable spice
  1304. --enable-rbd enable building the rados block device (rbd)
  1305. --disable-libiscsi disable iscsi support
  1306. --enable-libiscsi enable iscsi support
  1307. --disable-libnfs disable nfs support
  1308. --enable-libnfs enable nfs support
  1309. --disable-smartcard-nss disable smartcard nss support
  1310. --enable-smartcard-nss enable smartcard nss support
  1311. --disable-libusb disable libusb (for usb passthrough)
  1312. --enable-libusb enable libusb (for usb passthrough)
  1313. --disable-usb-redir disable usb network redirection support
  1314. --enable-usb-redir enable usb network redirection support
  1315. --enable-lzo enable the support of lzo compression library
  1316. --enable-snappy enable the support of snappy compression library
  1317. --disable-guest-agent disable building of the QEMU Guest Agent
  1318. --enable-guest-agent enable building of the QEMU Guest Agent
  1319. --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
  1320. --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
  1321. --disable-seccomp disable seccomp support
  1322. --enable-seccomp enable seccomp support
  1323. --with-coroutine=BACKEND coroutine backend. Supported options:
  1324. gthread, ucontext, sigaltstack, windows
  1325. --disable-coroutine-pool disable coroutine freelist (worse performance)
  1326. --enable-coroutine-pool enable coroutine freelist (better performance)
  1327. --enable-glusterfs enable GlusterFS backend
  1328. --disable-glusterfs disable GlusterFS backend
  1329. --enable-archipelago enable Archipelago backend
  1330. --disable-archipelago disable Archipelago backend
  1331. --enable-gcov enable test coverage analysis with gcov
  1332. --gcov=GCOV use specified gcov [$gcov_tool]
  1333. --disable-tpm disable TPM support
  1334. --enable-tpm enable TPM support
  1335. --disable-libssh2 disable ssh block device support
  1336. --enable-libssh2 enable ssh block device support
  1337. --disable-vhdx disable support for the Microsoft VHDX image format
  1338. --enable-vhdx enable support for the Microsoft VHDX image format
  1339. --disable-quorum disable quorum block filter support
  1340. --enable-quorum enable quorum block filter support
  1341. --disable-numa disable libnuma support
  1342. --enable-numa enable libnuma support
  1343. NOTE: The object files are built at the place where configure is launched
  1344. EOF
  1345. exit 0
  1346. fi
  1347. # Now we have handled --enable-tcg-interpreter and know we're not just
  1348. # printing the help message, bail out if the host CPU isn't supported.
  1349. if test "$ARCH" = "unknown"; then
  1350. if test "$tcg_interpreter" = "yes" ; then
  1351. echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
  1352. ARCH=tci
  1353. else
  1354. error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
  1355. fi
  1356. fi
  1357. # Consult white-list to determine whether to enable werror
  1358. # by default. Only enable by default for git builds
  1359. z_version=`cut -f3 -d. $source_path/VERSION`
  1360. if test -z "$werror" ; then
  1361. if test -d "$source_path/.git" -a \
  1362. "$linux" = "yes" ; then
  1363. werror="yes"
  1364. else
  1365. werror="no"
  1366. fi
  1367. fi
  1368. # check that the C compiler works.
  1369. cat > $TMPC <<EOF
  1370. int main(void) { return 0; }
  1371. EOF
  1372. if compile_object ; then
  1373. : C compiler works ok
  1374. else
  1375. error_exit "\"$cc\" either does not exist or does not work"
  1376. fi
  1377. # Check that the C++ compiler exists and works with the C compiler
  1378. if has $cxx; then
  1379. cat > $TMPC <<EOF
  1380. int c_function(void);
  1381. int main(void) { return c_function(); }
  1382. EOF
  1383. compile_object
  1384. cat > $TMPCXX <<EOF
  1385. extern "C" {
  1386. int c_function(void);
  1387. }
  1388. int c_function(void) { return 42; }
  1389. EOF
  1390. update_cxxflags
  1391. if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
  1392. # C++ compiler $cxx works ok with C compiler $cc
  1393. :
  1394. else
  1395. echo "C++ compiler $cxx does not work with C compiler $cc"
  1396. echo "Disabling C++ specific optional code"
  1397. cxx=
  1398. fi
  1399. else
  1400. echo "No C++ compiler available; disabling C++ specific optional code"
  1401. cxx=
  1402. fi
  1403. gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
  1404. gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
  1405. gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
  1406. gcc_flags="-Wendif-labels $gcc_flags"
  1407. gcc_flags="-Wno-initializer-overrides $gcc_flags"
  1408. gcc_flags="-Wno-string-plus-int $gcc_flags"
  1409. # Note that we do not add -Werror to gcc_flags here, because that would
  1410. # enable it for all configure tests. If a configure test failed due
  1411. # to -Werror this would just silently disable some features,
  1412. # so it's too error prone.
  1413. cat > $TMPC << EOF
  1414. int main(void) { return 0; }
  1415. EOF
  1416. for flag in $gcc_flags; do
  1417. # Use the positive sense of the flag when testing for -Wno-wombat
  1418. # support (gcc will happily accept the -Wno- form of unknown
  1419. # warning options).
  1420. optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
  1421. if compile_prog "-Werror $optflag" "" ; then
  1422. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1423. fi
  1424. done
  1425. if test "$stack_protector" != "no"; then
  1426. gcc_flags="-fstack-protector-strong -fstack-protector-all"
  1427. sp_on=0
  1428. for flag in $gcc_flags; do
  1429. # We need to check both a compile and a link, since some compiler
  1430. # setups fail only on a .c->.o compile and some only at link time
  1431. if do_cc $QEMU_CFLAGS -Werror $flag -c -o $TMPO $TMPC &&
  1432. compile_prog "-Werror $flag" ""; then
  1433. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1434. LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag"
  1435. sp_on=1
  1436. break
  1437. fi
  1438. done
  1439. if test "$stack_protector" = yes; then
  1440. if test $sp_on = 0; then
  1441. error_exit "Stack protector not supported"
  1442. fi
  1443. fi
  1444. fi
  1445. # Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
  1446. # large functions that use global variables. The bug is in all releases of
  1447. # GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
  1448. # 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
  1449. cat > $TMPC << EOF
  1450. #if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
  1451. int main(void) { return 0; }
  1452. #else
  1453. #error No bug in this compiler.
  1454. #endif
  1455. EOF
  1456. if compile_prog "-Werror -fno-gcse" "" ; then
  1457. TRANSLATE_OPT_CFLAGS=-fno-gcse
  1458. fi
  1459. if test "$static" = "yes" ; then
  1460. if test "$modules" = "yes" ; then
  1461. error_exit "static and modules are mutually incompatible"
  1462. fi
  1463. if test "$pie" = "yes" ; then
  1464. error_exit "static and pie are mutually incompatible"
  1465. else
  1466. pie="no"
  1467. fi
  1468. fi
  1469. if test "$pie" = ""; then
  1470. case "$cpu-$targetos" in
  1471. i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
  1472. ;;
  1473. *)
  1474. pie="no"
  1475. ;;
  1476. esac
  1477. fi
  1478. if test "$pie" != "no" ; then
  1479. cat > $TMPC << EOF
  1480. #ifdef __linux__
  1481. # define THREAD __thread
  1482. #else
  1483. # define THREAD
  1484. #endif
  1485. static THREAD int tls_var;
  1486. int main(void) { return tls_var; }
  1487. EOF
  1488. if compile_prog "-fPIE -DPIE" "-pie"; then
  1489. QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
  1490. LDFLAGS="-pie $LDFLAGS"
  1491. pie="yes"
  1492. if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
  1493. LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
  1494. fi
  1495. else
  1496. if test "$pie" = "yes"; then
  1497. error_exit "PIE not available due to missing toolchain support"
  1498. else
  1499. echo "Disabling PIE due to missing toolchain support"
  1500. pie="no"
  1501. fi
  1502. fi
  1503. if compile_prog "-fno-pie" "-nopie"; then
  1504. CFLAGS_NOPIE="-fno-pie"
  1505. LDFLAGS_NOPIE="-nopie"
  1506. fi
  1507. fi
  1508. # check for broken gcc and libtool in RHEL5
  1509. if test -n "$libtool" -a "$pie" != "no" ; then
  1510. cat > $TMPC <<EOF
  1511. void *f(unsigned char *buf, int len);
  1512. void *g(unsigned char *buf, int len);
  1513. void *
  1514. f(unsigned char *buf, int len)
  1515. {
  1516. return (void*)0L;
  1517. }
  1518. void *
  1519. g(unsigned char *buf, int len)
  1520. {
  1521. return f(buf, len);
  1522. }
  1523. EOF
  1524. if ! libtool_prog; then
  1525. echo "Disabling libtool due to broken toolchain support"
  1526. libtool=
  1527. fi
  1528. fi
  1529. ##########################################
  1530. # __sync_fetch_and_and requires at least -march=i486. Many toolchains
  1531. # use i686 as default anyway, but for those that don't, an explicit
  1532. # specification is necessary
  1533. if test "$cpu" = "i386"; then
  1534. cat > $TMPC << EOF
  1535. static int sfaa(int *ptr)
  1536. {
  1537. return __sync_fetch_and_and(ptr, 0);
  1538. }
  1539. int main(void)
  1540. {
  1541. int val = 42;
  1542. val = __sync_val_compare_and_swap(&val, 0, 1);
  1543. sfaa(&val);
  1544. return val;
  1545. }
  1546. EOF
  1547. if ! compile_prog "" "" ; then
  1548. QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
  1549. fi
  1550. fi
  1551. #########################################
  1552. # Solaris specific configure tool chain decisions
  1553. if test "$solaris" = "yes" ; then
  1554. if has $install; then
  1555. :
  1556. else
  1557. error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
  1558. "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
  1559. "to get ginstall which is used by default (which lives in /opt/csw/bin)"
  1560. fi
  1561. if test "`path_of $install`" = "/usr/sbin/install" ; then
  1562. error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
  1563. "try ginstall from the GNU fileutils available from www.blastwave.org" \
  1564. "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
  1565. fi
  1566. if has ar; then
  1567. :
  1568. else
  1569. if test -f /usr/ccs/bin/ar ; then
  1570. error_exit "No path includes ar" \
  1571. "Add /usr/ccs/bin to your path and rerun configure"
  1572. fi
  1573. error_exit "No path includes ar"
  1574. fi
  1575. fi
  1576. if test -z "${target_list+xxx}" ; then
  1577. target_list="$default_target_list"
  1578. else
  1579. target_list=`echo "$target_list" | sed -e 's/,/ /g'`
  1580. fi
  1581. # Check that we recognised the target name; this allows a more
  1582. # friendly error message than if we let it fall through.
  1583. for target in $target_list; do
  1584. case " $default_target_list " in
  1585. *" $target "*)
  1586. ;;
  1587. *)
  1588. error_exit "Unknown target name '$target'"
  1589. ;;
  1590. esac
  1591. done
  1592. # see if system emulation was really requested
  1593. case " $target_list " in
  1594. *"-softmmu "*) softmmu=yes
  1595. ;;
  1596. *) softmmu=no
  1597. ;;
  1598. esac
  1599. feature_not_found() {
  1600. feature=$1
  1601. remedy=$2
  1602. error_exit "User requested feature $feature" \
  1603. "configure was not able to find it." \
  1604. "$remedy"
  1605. }
  1606. # ---
  1607. # big/little endian test
  1608. cat > $TMPC << EOF
  1609. short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
  1610. short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
  1611. extern int foo(short *, short *);
  1612. int main(int argc, char *argv[]) {
  1613. return foo(big_endian, little_endian);
  1614. }
  1615. EOF
  1616. if compile_object ; then
  1617. if grep -q BiGeNdIaN $TMPO ; then
  1618. bigendian="yes"
  1619. elif grep -q LiTtLeEnDiAn $TMPO ; then
  1620. bigendian="no"
  1621. else
  1622. echo big/little test failed
  1623. fi
  1624. else
  1625. echo big/little test failed
  1626. fi
  1627. ##########################################
  1628. # L2TPV3 probe
  1629. cat > $TMPC <<EOF
  1630. #include <sys/socket.h>
  1631. #include <linux/ip.h>
  1632. int main(void) { return sizeof(struct mmsghdr); }
  1633. EOF
  1634. if compile_prog "" "" ; then
  1635. l2tpv3=yes
  1636. else
  1637. l2tpv3=no
  1638. fi
  1639. ##########################################
  1640. # pkg-config probe
  1641. if ! has "$pkg_config_exe"; then
  1642. error_exit "pkg-config binary '$pkg_config_exe' not found"
  1643. fi
  1644. ##########################################
  1645. # NPTL probe
  1646. if test "$linux_user" = "yes"; then
  1647. cat > $TMPC <<EOF
  1648. #include <sched.h>
  1649. #include <linux/futex.h>
  1650. int main(void) {
  1651. #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
  1652. #error bork
  1653. #endif
  1654. return 0;
  1655. }
  1656. EOF
  1657. if ! compile_object ; then
  1658. feature_not_found "nptl" "Install glibc and linux kernel headers."
  1659. fi
  1660. fi
  1661. ##########################################
  1662. # zlib check
  1663. if test "$zlib" != "no" ; then
  1664. cat > $TMPC << EOF
  1665. #include <zlib.h>
  1666. int main(void) { zlibVersion(); return 0; }
  1667. EOF
  1668. if compile_prog "" "-lz" ; then
  1669. :
  1670. else
  1671. error_exit "zlib check failed" \
  1672. "Make sure to have the zlib libs and headers installed."
  1673. fi
  1674. fi
  1675. LIBS="$LIBS -lz"
  1676. ##########################################
  1677. # lzo check
  1678. if test "$lzo" != "no" ; then
  1679. cat > $TMPC << EOF
  1680. #include <lzo/lzo1x.h>
  1681. int main(void) { lzo_version(); return 0; }
  1682. EOF
  1683. if compile_prog "" "-llzo2" ; then
  1684. libs_softmmu="$libs_softmmu -llzo2"
  1685. lzo="yes"
  1686. else
  1687. if test "$lzo" = "yes"; then
  1688. feature_not_found "liblzo2" "Install liblzo2 devel"
  1689. fi
  1690. lzo="no"
  1691. fi
  1692. fi
  1693. ##########################################
  1694. # snappy check
  1695. if test "$snappy" != "no" ; then
  1696. cat > $TMPC << EOF
  1697. #include <snappy-c.h>
  1698. int main(void) { snappy_max_compressed_length(4096); return 0; }
  1699. EOF
  1700. if compile_prog "" "-lsnappy" ; then
  1701. libs_softmmu="$libs_softmmu -lsnappy"
  1702. snappy="yes"
  1703. else
  1704. if test "$snappy" = "yes"; then
  1705. feature_not_found "libsnappy" "Install libsnappy devel"
  1706. fi
  1707. snappy="no"
  1708. fi
  1709. fi
  1710. ##########################################
  1711. # libseccomp check
  1712. if test "$seccomp" != "no" ; then
  1713. if test "$cpu" = "i386" || test "$cpu" = "x86_64" &&
  1714. $pkg_config --atleast-version=2.1.1 libseccomp; then
  1715. libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
  1716. QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
  1717. seccomp="yes"
  1718. else
  1719. if test "$seccomp" = "yes"; then
  1720. feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
  1721. fi
  1722. seccomp="no"
  1723. fi
  1724. fi
  1725. ##########################################
  1726. # xen probe
  1727. if test "$xen" != "no" ; then
  1728. xen_libs="-lxenstore -lxenctrl -lxenguest"
  1729. # First we test whether Xen headers and libraries are available.
  1730. # If no, we are done and there is no Xen support.
  1731. # If yes, more tests are run to detect the Xen version.
  1732. # Xen (any)
  1733. cat > $TMPC <<EOF
  1734. #include <xenctrl.h>
  1735. int main(void) {
  1736. return 0;
  1737. }
  1738. EOF
  1739. if ! compile_prog "" "$xen_libs" ; then
  1740. # Xen not found
  1741. if test "$xen" = "yes" ; then
  1742. feature_not_found "xen" "Install xen devel"
  1743. fi
  1744. xen=no
  1745. # Xen unstable
  1746. elif
  1747. cat > $TMPC <<EOF &&
  1748. #include <xenctrl.h>
  1749. #include <xenstore.h>
  1750. #include <stdint.h>
  1751. #include <xen/hvm/hvm_info_table.h>
  1752. #if !defined(HVM_MAX_VCPUS)
  1753. # error HVM_MAX_VCPUS not defined
  1754. #endif
  1755. int main(void) {
  1756. xc_interface *xc;
  1757. xs_daemon_open();
  1758. xc = xc_interface_open(0, 0, 0);
  1759. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1760. xc_gnttab_open(NULL, 0);
  1761. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  1762. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  1763. return 0;
  1764. }
  1765. EOF
  1766. compile_prog "" "$xen_libs"
  1767. then
  1768. xen_ctrl_version=420
  1769. xen=yes
  1770. elif
  1771. cat > $TMPC <<EOF &&
  1772. #include <xenctrl.h>
  1773. #include <xs.h>
  1774. #include <stdint.h>
  1775. #include <xen/hvm/hvm_info_table.h>
  1776. #if !defined(HVM_MAX_VCPUS)
  1777. # error HVM_MAX_VCPUS not defined
  1778. #endif
  1779. int main(void) {
  1780. xs_daemon_open();
  1781. xc_interface_open(0, 0, 0);
  1782. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1783. xc_gnttab_open(NULL, 0);
  1784. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  1785. return 0;
  1786. }
  1787. EOF
  1788. compile_prog "" "$xen_libs"
  1789. then
  1790. xen_ctrl_version=410
  1791. xen=yes
  1792. # Xen 4.0.0
  1793. elif
  1794. cat > $TMPC <<EOF &&
  1795. #include <xenctrl.h>
  1796. #include <xs.h>
  1797. #include <stdint.h>
  1798. #include <xen/hvm/hvm_info_table.h>
  1799. #if !defined(HVM_MAX_VCPUS)
  1800. # error HVM_MAX_VCPUS not defined
  1801. #endif
  1802. int main(void) {
  1803. struct xen_add_to_physmap xatp = {
  1804. .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
  1805. };
  1806. xs_daemon_open();
  1807. xc_interface_open();
  1808. xc_gnttab_open();
  1809. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1810. xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
  1811. return 0;
  1812. }
  1813. EOF
  1814. compile_prog "" "$xen_libs"
  1815. then
  1816. xen_ctrl_version=400
  1817. xen=yes
  1818. # Xen 3.4.0
  1819. elif
  1820. cat > $TMPC <<EOF &&
  1821. #include <xenctrl.h>
  1822. #include <xs.h>
  1823. int main(void) {
  1824. struct xen_add_to_physmap xatp = {
  1825. .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
  1826. };
  1827. xs_daemon_open();
  1828. xc_interface_open();
  1829. xc_gnttab_open();
  1830. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1831. xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
  1832. return 0;
  1833. }
  1834. EOF
  1835. compile_prog "" "$xen_libs"
  1836. then
  1837. xen_ctrl_version=340
  1838. xen=yes
  1839. # Xen 3.3.0
  1840. elif
  1841. cat > $TMPC <<EOF &&
  1842. #include <xenctrl.h>
  1843. #include <xs.h>
  1844. int main(void) {
  1845. xs_daemon_open();
  1846. xc_interface_open();
  1847. xc_gnttab_open();
  1848. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1849. return 0;
  1850. }
  1851. EOF
  1852. compile_prog "" "$xen_libs"
  1853. then
  1854. xen_ctrl_version=330
  1855. xen=yes
  1856. # Xen version unsupported
  1857. else
  1858. if test "$xen" = "yes" ; then
  1859. feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
  1860. fi
  1861. xen=no
  1862. fi
  1863. if test "$xen" = yes; then
  1864. libs_softmmu="$xen_libs $libs_softmmu"
  1865. fi
  1866. fi
  1867. if test "$xen_pci_passthrough" != "no"; then
  1868. if test "$xen" = "yes" && test "$linux" = "yes" &&
  1869. test "$xen_ctrl_version" -ge 340; then
  1870. xen_pci_passthrough=yes
  1871. else
  1872. if test "$xen_pci_passthrough" = "yes"; then
  1873. if test "$xen_ctrl_version" -lt 340; then
  1874. error_exit "User requested feature Xen PCI Passthrough" \
  1875. "This feature does not work with Xen 3.3"
  1876. fi
  1877. error_exit "User requested feature Xen PCI Passthrough" \
  1878. " but this feature requires /sys from Linux"
  1879. fi
  1880. xen_pci_passthrough=no
  1881. fi
  1882. fi
  1883. ##########################################
  1884. # libtool probe
  1885. if ! has $libtool; then
  1886. libtool=
  1887. fi
  1888. # MacOSX ships with a libtool which isn't the GNU one; weed this
  1889. # out by checking whether libtool supports the --version switch
  1890. if test -n "$libtool"; then
  1891. if ! "$libtool" --version >/dev/null 2>&1; then
  1892. libtool=
  1893. fi
  1894. fi
  1895. ##########################################
  1896. # Sparse probe
  1897. if test "$sparse" != "no" ; then
  1898. if has cgcc; then
  1899. sparse=yes
  1900. else
  1901. if test "$sparse" = "yes" ; then
  1902. feature_not_found "sparse" "Install sparse binary"
  1903. fi
  1904. sparse=no
  1905. fi
  1906. fi
  1907. ##########################################
  1908. # GTK probe
  1909. if test "$gtkabi" = ""; then
  1910. # The GTK ABI was not specified explicitly, so try whether 2.0 is available.
  1911. # Use 3.0 as a fallback if that is available.
  1912. if $pkg_config --exists "gtk+-2.0 >= 2.18.0"; then
  1913. gtkabi=2.0
  1914. elif $pkg_config --exists "gtk+-3.0 >= 3.0.0"; then
  1915. gtkabi=3.0
  1916. else
  1917. gtkabi=2.0
  1918. fi
  1919. fi
  1920. if test "$gtk" != "no"; then
  1921. gtkpackage="gtk+-$gtkabi"
  1922. gtkx11package="gtk+-x11-$gtkabi"
  1923. if test "$gtkabi" = "3.0" ; then
  1924. gtkversion="3.0.0"
  1925. else
  1926. gtkversion="2.18.0"
  1927. fi
  1928. if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
  1929. gtk_cflags=`$pkg_config --cflags $gtkpackage`
  1930. gtk_libs=`$pkg_config --libs $gtkpackage`
  1931. if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
  1932. gtk_libs="$gtk_libs -lX11"
  1933. fi
  1934. libs_softmmu="$gtk_libs $libs_softmmu"
  1935. gtk="yes"
  1936. elif test "$gtk" = "yes"; then
  1937. feature_not_found "gtk" "Install gtk2 or gtk3 devel"
  1938. else
  1939. gtk="no"
  1940. fi
  1941. fi
  1942. ##########################################
  1943. # VTE probe
  1944. if test "$vte" != "no"; then
  1945. if test "$gtkabi" = "3.0"; then
  1946. vtepackage="vte-2.90"
  1947. vteversion="0.32.0"
  1948. else
  1949. vtepackage="vte"
  1950. vteversion="0.24.0"
  1951. fi
  1952. if $pkg_config --exists "$vtepackage >= $vteversion"; then
  1953. vte_cflags=`$pkg_config --cflags $vtepackage`
  1954. vte_libs=`$pkg_config --libs $vtepackage`
  1955. libs_softmmu="$vte_libs $libs_softmmu"
  1956. vte="yes"
  1957. elif test "$vte" = "yes"; then
  1958. if test "$gtkabi" = "3.0"; then
  1959. feature_not_found "vte" "Install libvte-2.90 devel"
  1960. else
  1961. feature_not_found "vte" "Install libvte devel"
  1962. fi
  1963. else
  1964. vte="no"
  1965. fi
  1966. fi
  1967. ##########################################
  1968. # SDL probe
  1969. # Look for sdl configuration program (pkg-config or sdl-config). Try
  1970. # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
  1971. if test $sdlabi = "2.0"; then
  1972. sdl_config=$sdl2_config
  1973. sdlname=sdl2
  1974. sdlconfigname=sdl2_config
  1975. else
  1976. sdlname=sdl
  1977. sdlconfigname=sdl_config
  1978. fi
  1979. if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
  1980. sdl_config=$sdlconfigname
  1981. fi
  1982. if $pkg_config $sdlname --exists; then
  1983. sdlconfig="$pkg_config $sdlname"
  1984. _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
  1985. elif has ${sdl_config}; then
  1986. sdlconfig="$sdl_config"
  1987. _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
  1988. else
  1989. if test "$sdl" = "yes" ; then
  1990. feature_not_found "sdl" "Install SDL devel"
  1991. fi
  1992. sdl=no
  1993. fi
  1994. if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
  1995. echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
  1996. fi
  1997. sdl_too_old=no
  1998. if test "$sdl" != "no" ; then
  1999. cat > $TMPC << EOF
  2000. #include <SDL.h>
  2001. #undef main /* We don't want SDL to override our main() */
  2002. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  2003. EOF
  2004. sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
  2005. if test "$static" = "yes" ; then
  2006. sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
  2007. else
  2008. sdl_libs=`$sdlconfig --libs 2> /dev/null`
  2009. fi
  2010. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2011. if test "$_sdlversion" -lt 121 ; then
  2012. sdl_too_old=yes
  2013. else
  2014. if test "$cocoa" = "no" ; then
  2015. sdl=yes
  2016. fi
  2017. fi
  2018. # static link with sdl ? (note: sdl.pc's --static --libs is broken)
  2019. if test "$sdl" = "yes" -a "$static" = "yes" ; then
  2020. if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
  2021. sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
  2022. sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
  2023. fi
  2024. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2025. :
  2026. else
  2027. sdl=no
  2028. fi
  2029. fi # static link
  2030. else # sdl not found
  2031. if test "$sdl" = "yes" ; then
  2032. feature_not_found "sdl" "Install SDL devel"
  2033. fi
  2034. sdl=no
  2035. fi # sdl compile test
  2036. fi
  2037. if test "$sdl" = "yes" ; then
  2038. cat > $TMPC <<EOF
  2039. #include <SDL.h>
  2040. #if defined(SDL_VIDEO_DRIVER_X11)
  2041. #include <X11/XKBlib.h>
  2042. #else
  2043. #error No x11 support
  2044. #endif
  2045. int main(void) { return 0; }
  2046. EOF
  2047. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  2048. sdl_libs="$sdl_libs -lX11"
  2049. fi
  2050. libs_softmmu="$sdl_libs $libs_softmmu"
  2051. fi
  2052. ##########################################
  2053. # RDMA needs OpenFabrics libraries
  2054. if test "$rdma" != "no" ; then
  2055. cat > $TMPC <<EOF
  2056. #include <rdma/rdma_cma.h>
  2057. int main(void) { return 0; }
  2058. EOF
  2059. rdma_libs="-lrdmacm -libverbs"
  2060. if compile_prog "" "$rdma_libs" ; then
  2061. rdma="yes"
  2062. libs_softmmu="$libs_softmmu $rdma_libs"
  2063. else
  2064. if test "$rdma" = "yes" ; then
  2065. error_exit \
  2066. " OpenFabrics librdmacm/libibverbs not present." \
  2067. " Your options:" \
  2068. " (1) Fast: Install infiniband packages from your distro." \
  2069. " (2) Cleanest: Install libraries from www.openfabrics.org" \
  2070. " (3) Also: Install softiwarp if you don't have RDMA hardware"
  2071. fi
  2072. rdma="no"
  2073. fi
  2074. fi
  2075. ##########################################
  2076. # VNC TLS/WS detection
  2077. if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
  2078. cat > $TMPC <<EOF
  2079. #include <gnutls/gnutls.h>
  2080. int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
  2081. EOF
  2082. vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
  2083. vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
  2084. if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
  2085. if test "$vnc_tls" != "no" ; then
  2086. vnc_tls=yes
  2087. fi
  2088. if test "$vnc_ws" != "no" ; then
  2089. vnc_ws=yes
  2090. fi
  2091. libs_softmmu="$vnc_tls_libs $libs_softmmu"
  2092. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
  2093. else
  2094. if test "$vnc_tls" = "yes" ; then
  2095. feature_not_found "vnc-tls" "Install gnutls devel"
  2096. fi
  2097. if test "$vnc_ws" = "yes" ; then
  2098. feature_not_found "vnc-ws" "Install gnutls devel"
  2099. fi
  2100. vnc_tls=no
  2101. vnc_ws=no
  2102. fi
  2103. fi
  2104. ##########################################
  2105. # Quorum probe (check for gnutls)
  2106. if test "$quorum" != "no" ; then
  2107. cat > $TMPC <<EOF
  2108. #include <gnutls/gnutls.h>
  2109. #include <gnutls/crypto.h>
  2110. int main(void) {char data[4096], digest[32];
  2111. gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
  2112. return 0;
  2113. }
  2114. EOF
  2115. quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
  2116. quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
  2117. if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
  2118. qcow_tls=yes
  2119. libs_softmmu="$quorum_tls_libs $libs_softmmu"
  2120. libs_tools="$quorum_tls_libs $libs_softmmu"
  2121. QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
  2122. quorum="yes"
  2123. else
  2124. if test "$quorum" = "yes"; then
  2125. feature_not_found "gnutls" "gnutls > 2.10.0 required to compile Quorum"
  2126. fi
  2127. quorum="no"
  2128. fi
  2129. fi
  2130. ##########################################
  2131. # VNC SASL detection
  2132. if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
  2133. cat > $TMPC <<EOF
  2134. #include <sasl/sasl.h>
  2135. #include <stdio.h>
  2136. int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
  2137. EOF
  2138. # Assuming Cyrus-SASL installed in /usr prefix
  2139. vnc_sasl_cflags=""
  2140. vnc_sasl_libs="-lsasl2"
  2141. if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
  2142. vnc_sasl=yes
  2143. libs_softmmu="$vnc_sasl_libs $libs_softmmu"
  2144. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
  2145. else
  2146. if test "$vnc_sasl" = "yes" ; then
  2147. feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
  2148. fi
  2149. vnc_sasl=no
  2150. fi
  2151. fi
  2152. ##########################################
  2153. # VNC JPEG detection
  2154. if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
  2155. cat > $TMPC <<EOF
  2156. #include <stdio.h>
  2157. #include <jpeglib.h>
  2158. int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
  2159. EOF
  2160. vnc_jpeg_cflags=""
  2161. vnc_jpeg_libs="-ljpeg"
  2162. if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
  2163. vnc_jpeg=yes
  2164. libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
  2165. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
  2166. else
  2167. if test "$vnc_jpeg" = "yes" ; then
  2168. feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
  2169. fi
  2170. vnc_jpeg=no
  2171. fi
  2172. fi
  2173. ##########################################
  2174. # VNC PNG detection
  2175. if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
  2176. cat > $TMPC <<EOF
  2177. //#include <stdio.h>
  2178. #include <png.h>
  2179. #include <stddef.h>
  2180. int main(void) {
  2181. png_structp png_ptr;
  2182. png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  2183. return png_ptr != 0;
  2184. }
  2185. EOF
  2186. if $pkg_config libpng --exists; then
  2187. vnc_png_cflags=`$pkg_config libpng --cflags`
  2188. vnc_png_libs=`$pkg_config libpng --libs`
  2189. else
  2190. vnc_png_cflags=""
  2191. vnc_png_libs="-lpng"
  2192. fi
  2193. if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
  2194. vnc_png=yes
  2195. libs_softmmu="$vnc_png_libs $libs_softmmu"
  2196. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
  2197. else
  2198. if test "$vnc_png" = "yes" ; then
  2199. feature_not_found "vnc-png" "Install libpng devel"
  2200. fi
  2201. vnc_png=no
  2202. fi
  2203. fi
  2204. ##########################################
  2205. # fnmatch() probe, used for ACL routines
  2206. fnmatch="no"
  2207. cat > $TMPC << EOF
  2208. #include <fnmatch.h>
  2209. int main(void)
  2210. {
  2211. fnmatch("foo", "foo", 0);
  2212. return 0;
  2213. }
  2214. EOF
  2215. if compile_prog "" "" ; then
  2216. fnmatch="yes"
  2217. fi
  2218. ##########################################
  2219. # uuid_generate() probe, used for vdi block driver
  2220. # Note that on some systems (notably MacOSX) no extra library
  2221. # need be linked to get the uuid functions.
  2222. if test "$uuid" != "no" ; then
  2223. uuid_libs="-luuid"
  2224. cat > $TMPC << EOF
  2225. #include <uuid/uuid.h>
  2226. int main(void)
  2227. {
  2228. uuid_t my_uuid;
  2229. uuid_generate(my_uuid);
  2230. return 0;
  2231. }
  2232. EOF
  2233. if compile_prog "" "" ; then
  2234. uuid="yes"
  2235. elif compile_prog "" "$uuid_libs" ; then
  2236. uuid="yes"
  2237. libs_softmmu="$uuid_libs $libs_softmmu"
  2238. libs_tools="$uuid_libs $libs_tools"
  2239. else
  2240. if test "$uuid" = "yes" ; then
  2241. feature_not_found "uuid" "Install libuuid devel"
  2242. fi
  2243. uuid=no
  2244. fi
  2245. fi
  2246. if test "$vhdx" = "yes" ; then
  2247. if test "$uuid" = "no" ; then
  2248. error_exit "uuid required for VHDX support"
  2249. fi
  2250. elif test "$vhdx" != "no" ; then
  2251. if test "$uuid" = "yes" ; then
  2252. vhdx=yes
  2253. else
  2254. vhdx=no
  2255. fi
  2256. fi
  2257. ##########################################
  2258. # xfsctl() probe, used for raw-posix
  2259. if test "$xfs" != "no" ; then
  2260. cat > $TMPC << EOF
  2261. #include <stddef.h> /* NULL */
  2262. #include <xfs/xfs.h>
  2263. int main(void)
  2264. {
  2265. xfsctl(NULL, 0, 0, NULL);
  2266. return 0;
  2267. }
  2268. EOF
  2269. if compile_prog "" "" ; then
  2270. xfs="yes"
  2271. else
  2272. if test "$xfs" = "yes" ; then
  2273. feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
  2274. fi
  2275. xfs=no
  2276. fi
  2277. fi
  2278. ##########################################
  2279. # vde libraries probe
  2280. if test "$vde" != "no" ; then
  2281. vde_libs="-lvdeplug"
  2282. cat > $TMPC << EOF
  2283. #include <libvdeplug.h>
  2284. int main(void)
  2285. {
  2286. struct vde_open_args a = {0, 0, 0};
  2287. char s[] = "";
  2288. vde_open(s, s, &a);
  2289. return 0;
  2290. }
  2291. EOF
  2292. if compile_prog "" "$vde_libs" ; then
  2293. vde=yes
  2294. libs_softmmu="$vde_libs $libs_softmmu"
  2295. libs_tools="$vde_libs $libs_tools"
  2296. else
  2297. if test "$vde" = "yes" ; then
  2298. feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
  2299. fi
  2300. vde=no
  2301. fi
  2302. fi
  2303. ##########################################
  2304. # netmap support probe
  2305. # Apart from looking for netmap headers, we make sure that the host API version
  2306. # supports the netmap backend (>=11). The upper bound (15) is meant to simulate
  2307. # a minor/major version number. Minor new features will be marked with values up
  2308. # to 15, and if something happens that requires a change to the backend we will
  2309. # move above 15, submit the backend fixes and modify this two bounds.
  2310. if test "$netmap" != "no" ; then
  2311. cat > $TMPC << EOF
  2312. #include <inttypes.h>
  2313. #include <net/if.h>
  2314. #include <net/netmap.h>
  2315. #include <net/netmap_user.h>
  2316. #if (NETMAP_API < 11) || (NETMAP_API > 15)
  2317. #error
  2318. #endif
  2319. int main(void) { return 0; }
  2320. EOF
  2321. if compile_prog "" "" ; then
  2322. netmap=yes
  2323. else
  2324. if test "$netmap" = "yes" ; then
  2325. feature_not_found "netmap"
  2326. fi
  2327. netmap=no
  2328. fi
  2329. fi
  2330. ##########################################
  2331. # libcap-ng library probe
  2332. if test "$cap_ng" != "no" ; then
  2333. cap_libs="-lcap-ng"
  2334. cat > $TMPC << EOF
  2335. #include <cap-ng.h>
  2336. int main(void)
  2337. {
  2338. capng_capability_to_name(CAPNG_EFFECTIVE);
  2339. return 0;
  2340. }
  2341. EOF
  2342. if compile_prog "" "$cap_libs" ; then
  2343. cap_ng=yes
  2344. libs_tools="$cap_libs $libs_tools"
  2345. else
  2346. if test "$cap_ng" = "yes" ; then
  2347. feature_not_found "cap_ng" "Install libcap-ng devel"
  2348. fi
  2349. cap_ng=no
  2350. fi
  2351. fi
  2352. ##########################################
  2353. # Sound support libraries probe
  2354. audio_drv_probe()
  2355. {
  2356. drv=$1
  2357. hdr=$2
  2358. lib=$3
  2359. exp=$4
  2360. cfl=$5
  2361. cat > $TMPC << EOF
  2362. #include <$hdr>
  2363. int main(void) { $exp }
  2364. EOF
  2365. if compile_prog "$cfl" "$lib" ; then
  2366. :
  2367. else
  2368. error_exit "$drv check failed" \
  2369. "Make sure to have the $drv libs and headers installed."
  2370. fi
  2371. }
  2372. audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
  2373. for drv in $audio_drv_list; do
  2374. case $drv in
  2375. alsa)
  2376. audio_drv_probe $drv alsa/asoundlib.h -lasound \
  2377. "return snd_pcm_close((snd_pcm_t *)0);"
  2378. libs_softmmu="-lasound $libs_softmmu"
  2379. ;;
  2380. fmod)
  2381. if test -z $fmod_lib || test -z $fmod_inc; then
  2382. error_exit "You must specify path to FMOD library and headers" \
  2383. "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
  2384. fi
  2385. audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
  2386. libs_softmmu="$fmod_lib $libs_softmmu"
  2387. ;;
  2388. esd)
  2389. audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
  2390. libs_softmmu="-lesd $libs_softmmu"
  2391. audio_pt_int="yes"
  2392. ;;
  2393. pa)
  2394. audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
  2395. "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
  2396. libs_softmmu="-lpulse $libs_softmmu"
  2397. audio_pt_int="yes"
  2398. ;;
  2399. coreaudio)
  2400. libs_softmmu="-framework CoreAudio $libs_softmmu"
  2401. ;;
  2402. dsound)
  2403. libs_softmmu="-lole32 -ldxguid $libs_softmmu"
  2404. audio_win_int="yes"
  2405. ;;
  2406. oss)
  2407. libs_softmmu="$oss_lib $libs_softmmu"
  2408. ;;
  2409. sdl|wav)
  2410. # XXX: Probes for CoreAudio, DirectSound, SDL(?)
  2411. ;;
  2412. winwave)
  2413. libs_softmmu="-lwinmm $libs_softmmu"
  2414. audio_win_int="yes"
  2415. ;;
  2416. *)
  2417. echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
  2418. error_exit "Unknown driver '$drv' selected" \
  2419. "Possible drivers are: $audio_possible_drivers"
  2420. }
  2421. ;;
  2422. esac
  2423. done
  2424. ##########################################
  2425. # BrlAPI probe
  2426. if test "$brlapi" != "no" ; then
  2427. brlapi_libs="-lbrlapi"
  2428. cat > $TMPC << EOF
  2429. #include <brlapi.h>
  2430. #include <stddef.h>
  2431. int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
  2432. EOF
  2433. if compile_prog "" "$brlapi_libs" ; then
  2434. brlapi=yes
  2435. libs_softmmu="$brlapi_libs $libs_softmmu"
  2436. else
  2437. if test "$brlapi" = "yes" ; then
  2438. feature_not_found "brlapi" "Install brlapi devel"
  2439. fi
  2440. brlapi=no
  2441. fi
  2442. fi
  2443. ##########################################
  2444. # curses probe
  2445. if test "$curses" != "no" ; then
  2446. if test "$mingw32" = "yes" ; then
  2447. curses_list="-lpdcurses"
  2448. else
  2449. curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
  2450. fi
  2451. curses_found=no
  2452. cat > $TMPC << EOF
  2453. #include <curses.h>
  2454. int main(void) {
  2455. const char *s = curses_version();
  2456. resize_term(0, 0);
  2457. return s != 0;
  2458. }
  2459. EOF
  2460. IFS=:
  2461. for curses_lib in $curses_list; do
  2462. unset IFS
  2463. if compile_prog "" "$curses_lib" ; then
  2464. curses_found=yes
  2465. libs_softmmu="$curses_lib $libs_softmmu"
  2466. break
  2467. fi
  2468. done
  2469. unset IFS
  2470. if test "$curses_found" = "yes" ; then
  2471. curses=yes
  2472. else
  2473. if test "$curses" = "yes" ; then
  2474. feature_not_found "curses" "Install ncurses devel"
  2475. fi
  2476. curses=no
  2477. fi
  2478. fi
  2479. ##########################################
  2480. # curl probe
  2481. if test "$curl" != "no" ; then
  2482. if $pkg_config libcurl --exists; then
  2483. curlconfig="$pkg_config libcurl"
  2484. else
  2485. curlconfig=curl-config
  2486. fi
  2487. cat > $TMPC << EOF
  2488. #include <curl/curl.h>
  2489. int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
  2490. EOF
  2491. curl_cflags=`$curlconfig --cflags 2>/dev/null`
  2492. curl_libs=`$curlconfig --libs 2>/dev/null`
  2493. if compile_prog "$curl_cflags" "$curl_libs" ; then
  2494. curl=yes
  2495. else
  2496. if test "$curl" = "yes" ; then
  2497. feature_not_found "curl" "Install libcurl devel"
  2498. fi
  2499. curl=no
  2500. fi
  2501. fi # test "$curl"
  2502. ##########################################
  2503. # bluez support probe
  2504. if test "$bluez" != "no" ; then
  2505. cat > $TMPC << EOF
  2506. #include <bluetooth/bluetooth.h>
  2507. int main(void) { return bt_error(0); }
  2508. EOF
  2509. bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
  2510. bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
  2511. if compile_prog "$bluez_cflags" "$bluez_libs" ; then
  2512. bluez=yes
  2513. libs_softmmu="$bluez_libs $libs_softmmu"
  2514. else
  2515. if test "$bluez" = "yes" ; then
  2516. feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
  2517. fi
  2518. bluez="no"
  2519. fi
  2520. fi
  2521. ##########################################
  2522. # glib support probe
  2523. if test "$mingw32" = yes; then
  2524. # g_poll is required in order to integrate with the glib main loop.
  2525. glib_req_ver=2.20
  2526. else
  2527. glib_req_ver=2.12
  2528. fi
  2529. glib_modules=gthread-2.0
  2530. if test "$modules" = yes; then
  2531. glib_modules="$glib_modules gmodule-2.0"
  2532. fi
  2533. for i in $glib_modules; do
  2534. if $pkg_config --atleast-version=$glib_req_ver $i; then
  2535. glib_cflags=`$pkg_config --cflags $i`
  2536. glib_libs=`$pkg_config --libs $i`
  2537. CFLAGS="$glib_cflags $CFLAGS"
  2538. LIBS="$glib_libs $LIBS"
  2539. libs_qga="$glib_libs $libs_qga"
  2540. else
  2541. error_exit "glib-$glib_req_ver $i is required to compile QEMU"
  2542. fi
  2543. done
  2544. # g_test_trap_subprocess added in 2.38. Used by some tests.
  2545. glib_subprocess=yes
  2546. if ! $pkg_config --atleast-version=2.38 glib-2.0; then
  2547. glib_subprocess=no
  2548. fi
  2549. ##########################################
  2550. # SHA command probe for modules
  2551. if test "$modules" = yes; then
  2552. shacmd_probe="sha1sum sha1 shasum"
  2553. for c in $shacmd_probe; do
  2554. if which $c >/dev/null 2>&1; then
  2555. shacmd="$c"
  2556. break
  2557. fi
  2558. done
  2559. if test "$shacmd" = ""; then
  2560. error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
  2561. fi
  2562. fi
  2563. ##########################################
  2564. # pixman support probe
  2565. if test "$pixman" = ""; then
  2566. if test "$want_tools" = "no" -a "$softmmu" = "no"; then
  2567. pixman="none"
  2568. elif $pkg_config --atleast-version=0.21.8 pixman-1 > /dev/null 2>&1; then
  2569. pixman="system"
  2570. else
  2571. pixman="internal"
  2572. fi
  2573. fi
  2574. if test "$pixman" = "none"; then
  2575. if test "$want_tools" != "no" -o "$softmmu" != "no"; then
  2576. error_exit "pixman disabled but system emulation or tools build" \
  2577. "enabled. You can turn off pixman only if you also" \
  2578. "disable all system emulation targets and the tools" \
  2579. "build with '--disable-tools --disable-system'."
  2580. fi
  2581. pixman_cflags=
  2582. pixman_libs=
  2583. elif test "$pixman" = "system"; then
  2584. # pixman version has been checked above
  2585. pixman_cflags=`$pkg_config --cflags pixman-1`
  2586. pixman_libs=`$pkg_config --libs pixman-1`
  2587. else
  2588. if test ! -d ${source_path}/pixman/pixman; then
  2589. error_exit "pixman >= 0.21.8 not present. Your options:" \
  2590. " (1) Preferred: Install the pixman devel package (any recent" \
  2591. " distro should have packages as Xorg needs pixman too)." \
  2592. " (2) Fetch the pixman submodule, using:" \
  2593. " git submodule update --init pixman"
  2594. fi
  2595. mkdir -p pixman/pixman
  2596. pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
  2597. pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
  2598. fi
  2599. ##########################################
  2600. # libcap probe
  2601. if test "$cap" != "no" ; then
  2602. cat > $TMPC <<EOF
  2603. #include <stdio.h>
  2604. #include <sys/capability.h>
  2605. int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
  2606. EOF
  2607. if compile_prog "" "-lcap" ; then
  2608. cap=yes
  2609. else
  2610. cap=no
  2611. fi
  2612. fi
  2613. ##########################################
  2614. # pthread probe
  2615. PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
  2616. pthread=no
  2617. cat > $TMPC << EOF
  2618. #include <pthread.h>
  2619. static void *f(void *p) { return NULL; }
  2620. int main(void) {
  2621. pthread_t thread;
  2622. pthread_create(&thread, 0, f, 0);
  2623. return 0;
  2624. }
  2625. EOF
  2626. if compile_prog "" "" ; then
  2627. pthread=yes
  2628. else
  2629. for pthread_lib in $PTHREADLIBS_LIST; do
  2630. if compile_prog "" "$pthread_lib" ; then
  2631. pthread=yes
  2632. found=no
  2633. for lib_entry in $LIBS; do
  2634. if test "$lib_entry" = "$pthread_lib"; then
  2635. found=yes
  2636. break
  2637. fi
  2638. done
  2639. if test "$found" = "no"; then
  2640. LIBS="$pthread_lib $LIBS"
  2641. fi
  2642. break
  2643. fi
  2644. done
  2645. fi
  2646. if test "$mingw32" != yes -a "$pthread" = no; then
  2647. error_exit "pthread check failed" \
  2648. "Make sure to have the pthread libs and headers installed."
  2649. fi
  2650. # check for pthread_setname_np
  2651. pthread_setname_np=no
  2652. cat > $TMPC << EOF
  2653. #include <pthread.h>
  2654. static void *f(void *p) { return NULL; }
  2655. int main(void)
  2656. {
  2657. pthread_t thread;
  2658. pthread_create(&thread, 0, f, 0);
  2659. pthread_setname_np(thread, "QEMU");
  2660. return 0;
  2661. }
  2662. EOF
  2663. if compile_prog "" "$pthread_lib" ; then
  2664. pthread_setname_np=yes
  2665. fi
  2666. ##########################################
  2667. # rbd probe
  2668. if test "$rbd" != "no" ; then
  2669. cat > $TMPC <<EOF
  2670. #include <stdio.h>
  2671. #include <rbd/librbd.h>
  2672. int main(void) {
  2673. rados_t cluster;
  2674. rados_create(&cluster, NULL);
  2675. return 0;
  2676. }
  2677. EOF
  2678. rbd_libs="-lrbd -lrados"
  2679. if compile_prog "" "$rbd_libs" ; then
  2680. rbd=yes
  2681. else
  2682. if test "$rbd" = "yes" ; then
  2683. feature_not_found "rados block device" "Install librbd/ceph devel"
  2684. fi
  2685. rbd=no
  2686. fi
  2687. fi
  2688. ##########################################
  2689. # libssh2 probe
  2690. min_libssh2_version=1.2.8
  2691. if test "$libssh2" != "no" ; then
  2692. if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
  2693. libssh2_cflags=`$pkg_config libssh2 --cflags`
  2694. libssh2_libs=`$pkg_config libssh2 --libs`
  2695. libssh2=yes
  2696. else
  2697. if test "$libssh2" = "yes" ; then
  2698. error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
  2699. fi
  2700. libssh2=no
  2701. fi
  2702. fi
  2703. ##########################################
  2704. # libssh2_sftp_fsync probe
  2705. if test "$libssh2" = "yes"; then
  2706. cat > $TMPC <<EOF
  2707. #include <stdio.h>
  2708. #include <libssh2.h>
  2709. #include <libssh2_sftp.h>
  2710. int main(void) {
  2711. LIBSSH2_SESSION *session;
  2712. LIBSSH2_SFTP *sftp;
  2713. LIBSSH2_SFTP_HANDLE *sftp_handle;
  2714. session = libssh2_session_init ();
  2715. sftp = libssh2_sftp_init (session);
  2716. sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
  2717. libssh2_sftp_fsync (sftp_handle);
  2718. return 0;
  2719. }
  2720. EOF
  2721. # libssh2_cflags/libssh2_libs defined in previous test.
  2722. if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
  2723. QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
  2724. fi
  2725. fi
  2726. ##########################################
  2727. # linux-aio probe
  2728. if test "$linux_aio" != "no" ; then
  2729. cat > $TMPC <<EOF
  2730. #include <libaio.h>
  2731. #include <sys/eventfd.h>
  2732. #include <stddef.h>
  2733. int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
  2734. EOF
  2735. if compile_prog "" "-laio" ; then
  2736. linux_aio=yes
  2737. else
  2738. if test "$linux_aio" = "yes" ; then
  2739. feature_not_found "linux AIO" "Install libaio devel"
  2740. fi
  2741. linux_aio=no
  2742. fi
  2743. fi
  2744. ##########################################
  2745. # TPM passthrough is only on x86 Linux
  2746. if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
  2747. tpm_passthrough=$tpm
  2748. else
  2749. tpm_passthrough=no
  2750. fi
  2751. ##########################################
  2752. # attr probe
  2753. if test "$attr" != "no" ; then
  2754. cat > $TMPC <<EOF
  2755. #include <stdio.h>
  2756. #include <sys/types.h>
  2757. #ifdef CONFIG_LIBATTR
  2758. #include <attr/xattr.h>
  2759. #else
  2760. #include <sys/xattr.h>
  2761. #endif
  2762. int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
  2763. EOF
  2764. if compile_prog "" "" ; then
  2765. attr=yes
  2766. # Older distros have <attr/xattr.h>, and need -lattr:
  2767. elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
  2768. attr=yes
  2769. LIBS="-lattr $LIBS"
  2770. libattr=yes
  2771. else
  2772. if test "$attr" = "yes" ; then
  2773. feature_not_found "ATTR" "Install libc6 or libattr devel"
  2774. fi
  2775. attr=no
  2776. fi
  2777. fi
  2778. ##########################################
  2779. # iovec probe
  2780. cat > $TMPC <<EOF
  2781. #include <sys/types.h>
  2782. #include <sys/uio.h>
  2783. #include <unistd.h>
  2784. int main(void) { return sizeof(struct iovec); }
  2785. EOF
  2786. iovec=no
  2787. if compile_prog "" "" ; then
  2788. iovec=yes
  2789. fi
  2790. ##########################################
  2791. # preadv probe
  2792. cat > $TMPC <<EOF
  2793. #include <sys/types.h>
  2794. #include <sys/uio.h>
  2795. #include <unistd.h>
  2796. int main(void) { return preadv(0, 0, 0, 0); }
  2797. EOF
  2798. preadv=no
  2799. if compile_prog "" "" ; then
  2800. preadv=yes
  2801. fi
  2802. ##########################################
  2803. # fdt probe
  2804. # fdt support is mandatory for at least some target architectures,
  2805. # so insist on it if we're building those system emulators.
  2806. fdt_required=no
  2807. for target in $target_list; do
  2808. case $target in
  2809. aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
  2810. fdt_required=yes
  2811. ;;
  2812. esac
  2813. done
  2814. if test "$fdt_required" = "yes"; then
  2815. if test "$fdt" = "no"; then
  2816. error_exit "fdt disabled but some requested targets require it." \
  2817. "You can turn off fdt only if you also disable all the system emulation" \
  2818. "targets which need it (by specifying a cut down --target-list)."
  2819. fi
  2820. fdt=yes
  2821. fi
  2822. if test "$fdt" != "no" ; then
  2823. fdt_libs="-lfdt"
  2824. # explicitly check for libfdt_env.h as it is missing in some stable installs
  2825. cat > $TMPC << EOF
  2826. #include <libfdt_env.h>
  2827. int main(void) { return 0; }
  2828. EOF
  2829. if compile_prog "" "$fdt_libs" ; then
  2830. # system DTC is good - use it
  2831. fdt=yes
  2832. elif test -d ${source_path}/dtc/libfdt ; then
  2833. # have submodule DTC - use it
  2834. fdt=yes
  2835. dtc_internal="yes"
  2836. mkdir -p dtc
  2837. if [ "$pwd_is_source_path" != "y" ] ; then
  2838. symlink "$source_path/dtc/Makefile" "dtc/Makefile"
  2839. symlink "$source_path/dtc/scripts" "dtc/scripts"
  2840. fi
  2841. fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
  2842. fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
  2843. elif test "$fdt" = "yes" ; then
  2844. # have neither and want - prompt for system/submodule install
  2845. error_exit "DTC (libfdt) not present. Your options:" \
  2846. " (1) Preferred: Install the DTC (libfdt) devel package" \
  2847. " (2) Fetch the DTC submodule, using:" \
  2848. " git submodule update --init dtc"
  2849. else
  2850. # don't have and don't want
  2851. fdt_libs=
  2852. fdt=no
  2853. fi
  2854. fi
  2855. libs_softmmu="$libs_softmmu $fdt_libs"
  2856. ##########################################
  2857. # GLX probe, used by milkymist-tmu2
  2858. if test "$glx" != "no" ; then
  2859. glx_libs="-lGL -lX11"
  2860. cat > $TMPC << EOF
  2861. #include <X11/Xlib.h>
  2862. #include <GL/gl.h>
  2863. #include <GL/glx.h>
  2864. int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
  2865. EOF
  2866. if compile_prog "" "-lGL -lX11" ; then
  2867. glx=yes
  2868. else
  2869. if test "$glx" = "yes" ; then
  2870. feature_not_found "glx" "Install GL devel (e.g. MESA)"
  2871. fi
  2872. glx_libs=
  2873. glx=no
  2874. fi
  2875. fi
  2876. ##########################################
  2877. # archipelago probe
  2878. if test "$archipelago" != "no" ; then
  2879. cat > $TMPC <<EOF
  2880. #include <stdio.h>
  2881. #include <xseg/xseg.h>
  2882. #include <xseg/protocol.h>
  2883. int main(void) {
  2884. xseg_initialize();
  2885. return 0;
  2886. }
  2887. EOF
  2888. archipelago_libs=-lxseg
  2889. if compile_prog "" "$archipelago_libs"; then
  2890. archipelago="yes"
  2891. libs_tools="$archipelago_libs $libs_tools"
  2892. libs_softmmu="$archipelago_libs $libs_softmmu"
  2893. else
  2894. if test "$archipelago" = "yes" ; then
  2895. feature_not_found "Archipelago backend support" "Install libxseg devel"
  2896. fi
  2897. archipelago="no"
  2898. fi
  2899. fi
  2900. ##########################################
  2901. # glusterfs probe
  2902. if test "$glusterfs" != "no" ; then
  2903. if $pkg_config --atleast-version=3 glusterfs-api; then
  2904. glusterfs="yes"
  2905. glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
  2906. glusterfs_libs=`$pkg_config --libs glusterfs-api`
  2907. if $pkg_config --atleast-version=5 glusterfs-api; then
  2908. glusterfs_discard="yes"
  2909. fi
  2910. if $pkg_config --atleast-version=6 glusterfs-api; then
  2911. glusterfs_zerofill="yes"
  2912. fi
  2913. else
  2914. if test "$glusterfs" = "yes" ; then
  2915. feature_not_found "GlusterFS backend support" \
  2916. "Install glusterfs-api devel >= 3"
  2917. fi
  2918. glusterfs="no"
  2919. fi
  2920. fi
  2921. # Check for inotify functions when we are building linux-user
  2922. # emulator. This is done because older glibc versions don't
  2923. # have syscall stubs for these implemented. In that case we
  2924. # don't provide them even if kernel supports them.
  2925. #
  2926. inotify=no
  2927. cat > $TMPC << EOF
  2928. #include <sys/inotify.h>
  2929. int
  2930. main(void)
  2931. {
  2932. /* try to start inotify */
  2933. return inotify_init();
  2934. }
  2935. EOF
  2936. if compile_prog "" "" ; then
  2937. inotify=yes
  2938. fi
  2939. inotify1=no
  2940. cat > $TMPC << EOF
  2941. #include <sys/inotify.h>
  2942. int
  2943. main(void)
  2944. {
  2945. /* try to start inotify */
  2946. return inotify_init1(0);
  2947. }
  2948. EOF
  2949. if compile_prog "" "" ; then
  2950. inotify1=yes
  2951. fi
  2952. # check if utimensat and futimens are supported
  2953. utimens=no
  2954. cat > $TMPC << EOF
  2955. #define _ATFILE_SOURCE
  2956. #include <stddef.h>
  2957. #include <fcntl.h>
  2958. #include <sys/stat.h>
  2959. int main(void)
  2960. {
  2961. utimensat(AT_FDCWD, "foo", NULL, 0);
  2962. futimens(0, NULL);
  2963. return 0;
  2964. }
  2965. EOF
  2966. if compile_prog "" "" ; then
  2967. utimens=yes
  2968. fi
  2969. # check if pipe2 is there
  2970. pipe2=no
  2971. cat > $TMPC << EOF
  2972. #include <unistd.h>
  2973. #include <fcntl.h>
  2974. int main(void)
  2975. {
  2976. int pipefd[2];
  2977. return pipe2(pipefd, O_CLOEXEC);
  2978. }
  2979. EOF
  2980. if compile_prog "" "" ; then
  2981. pipe2=yes
  2982. fi
  2983. # check if accept4 is there
  2984. accept4=no
  2985. cat > $TMPC << EOF
  2986. #include <sys/socket.h>
  2987. #include <stddef.h>
  2988. int main(void)
  2989. {
  2990. accept4(0, NULL, NULL, SOCK_CLOEXEC);
  2991. return 0;
  2992. }
  2993. EOF
  2994. if compile_prog "" "" ; then
  2995. accept4=yes
  2996. fi
  2997. # check if tee/splice is there. vmsplice was added same time.
  2998. splice=no
  2999. cat > $TMPC << EOF
  3000. #include <unistd.h>
  3001. #include <fcntl.h>
  3002. #include <limits.h>
  3003. int main(void)
  3004. {
  3005. int len, fd = 0;
  3006. len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
  3007. splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
  3008. return 0;
  3009. }
  3010. EOF
  3011. if compile_prog "" "" ; then
  3012. splice=yes
  3013. fi
  3014. ##########################################
  3015. # libnuma probe
  3016. if test "$numa" != "no" ; then
  3017. cat > $TMPC << EOF
  3018. #include <numa.h>
  3019. int main(void) { return numa_available(); }
  3020. EOF
  3021. if compile_prog "" "-lnuma" ; then
  3022. numa=yes
  3023. libs_softmmu="-lnuma $libs_softmmu"
  3024. else
  3025. if test "$numa" = "yes" ; then
  3026. feature_not_found "numa" "install numactl devel"
  3027. fi
  3028. numa=no
  3029. fi
  3030. fi
  3031. ##########################################
  3032. # signalfd probe
  3033. signalfd="no"
  3034. cat > $TMPC << EOF
  3035. #include <unistd.h>
  3036. #include <sys/syscall.h>
  3037. #include <signal.h>
  3038. int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
  3039. EOF
  3040. if compile_prog "" "" ; then
  3041. signalfd=yes
  3042. fi
  3043. # check if eventfd is supported
  3044. eventfd=no
  3045. cat > $TMPC << EOF
  3046. #include <sys/eventfd.h>
  3047. int main(void)
  3048. {
  3049. return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
  3050. }
  3051. EOF
  3052. if compile_prog "" "" ; then
  3053. eventfd=yes
  3054. fi
  3055. # check for fallocate
  3056. fallocate=no
  3057. cat > $TMPC << EOF
  3058. #include <fcntl.h>
  3059. int main(void)
  3060. {
  3061. fallocate(0, 0, 0, 0);
  3062. return 0;
  3063. }
  3064. EOF
  3065. if compile_prog "" "" ; then
  3066. fallocate=yes
  3067. fi
  3068. # check for fallocate hole punching
  3069. fallocate_punch_hole=no
  3070. cat > $TMPC << EOF
  3071. #include <fcntl.h>
  3072. #include <linux/falloc.h>
  3073. int main(void)
  3074. {
  3075. fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
  3076. return 0;
  3077. }
  3078. EOF
  3079. if compile_prog "" "" ; then
  3080. fallocate_punch_hole=yes
  3081. fi
  3082. # check for posix_fallocate
  3083. posix_fallocate=no
  3084. cat > $TMPC << EOF
  3085. #include <fcntl.h>
  3086. int main(void)
  3087. {
  3088. posix_fallocate(0, 0, 0);
  3089. return 0;
  3090. }
  3091. EOF
  3092. if compile_prog "" "" ; then
  3093. posix_fallocate=yes
  3094. fi
  3095. # check for sync_file_range
  3096. sync_file_range=no
  3097. cat > $TMPC << EOF
  3098. #include <fcntl.h>
  3099. int main(void)
  3100. {
  3101. sync_file_range(0, 0, 0, 0);
  3102. return 0;
  3103. }
  3104. EOF
  3105. if compile_prog "" "" ; then
  3106. sync_file_range=yes
  3107. fi
  3108. # check for linux/fiemap.h and FS_IOC_FIEMAP
  3109. fiemap=no
  3110. cat > $TMPC << EOF
  3111. #include <sys/ioctl.h>
  3112. #include <linux/fs.h>
  3113. #include <linux/fiemap.h>
  3114. int main(void)
  3115. {
  3116. ioctl(0, FS_IOC_FIEMAP, 0);
  3117. return 0;
  3118. }
  3119. EOF
  3120. if compile_prog "" "" ; then
  3121. fiemap=yes
  3122. fi
  3123. # check for dup3
  3124. dup3=no
  3125. cat > $TMPC << EOF
  3126. #include <unistd.h>
  3127. int main(void)
  3128. {
  3129. dup3(0, 0, 0);
  3130. return 0;
  3131. }
  3132. EOF
  3133. if compile_prog "" "" ; then
  3134. dup3=yes
  3135. fi
  3136. # check for ppoll support
  3137. ppoll=no
  3138. cat > $TMPC << EOF
  3139. #include <poll.h>
  3140. int main(void)
  3141. {
  3142. struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
  3143. ppoll(&pfd, 1, 0, 0);
  3144. return 0;
  3145. }
  3146. EOF
  3147. if compile_prog "" "" ; then
  3148. ppoll=yes
  3149. fi
  3150. # check for prctl(PR_SET_TIMERSLACK , ... ) support
  3151. prctl_pr_set_timerslack=no
  3152. cat > $TMPC << EOF
  3153. #include <sys/prctl.h>
  3154. int main(void)
  3155. {
  3156. prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
  3157. return 0;
  3158. }
  3159. EOF
  3160. if compile_prog "" "" ; then
  3161. prctl_pr_set_timerslack=yes
  3162. fi
  3163. # check for epoll support
  3164. epoll=no
  3165. cat > $TMPC << EOF
  3166. #include <sys/epoll.h>
  3167. int main(void)
  3168. {
  3169. epoll_create(0);
  3170. return 0;
  3171. }
  3172. EOF
  3173. if compile_prog "" "" ; then
  3174. epoll=yes
  3175. fi
  3176. # epoll_create1 and epoll_pwait are later additions
  3177. # so we must check separately for their presence
  3178. epoll_create1=no
  3179. cat > $TMPC << EOF
  3180. #include <sys/epoll.h>
  3181. int main(void)
  3182. {
  3183. /* Note that we use epoll_create1 as a value, not as
  3184. * a function being called. This is necessary so that on
  3185. * old SPARC glibc versions where the function was present in
  3186. * the library but not declared in the header file we will
  3187. * fail the configure check. (Otherwise we will get a compiler
  3188. * warning but not an error, and will proceed to fail the
  3189. * qemu compile where we compile with -Werror.)
  3190. */
  3191. return (int)(uintptr_t)&epoll_create1;
  3192. }
  3193. EOF
  3194. if compile_prog "" "" ; then
  3195. epoll_create1=yes
  3196. fi
  3197. epoll_pwait=no
  3198. cat > $TMPC << EOF
  3199. #include <sys/epoll.h>
  3200. int main(void)
  3201. {
  3202. epoll_pwait(0, 0, 0, 0, 0);
  3203. return 0;
  3204. }
  3205. EOF
  3206. if compile_prog "" "" ; then
  3207. epoll_pwait=yes
  3208. fi
  3209. # check for sendfile support
  3210. sendfile=no
  3211. cat > $TMPC << EOF
  3212. #include <sys/sendfile.h>
  3213. int main(void)
  3214. {
  3215. return sendfile(0, 0, 0, 0);
  3216. }
  3217. EOF
  3218. if compile_prog "" "" ; then
  3219. sendfile=yes
  3220. fi
  3221. # check for timerfd support (glibc 2.8 and newer)
  3222. timerfd=no
  3223. cat > $TMPC << EOF
  3224. #include <sys/timerfd.h>
  3225. int main(void)
  3226. {
  3227. return(timerfd_create(CLOCK_REALTIME, 0));
  3228. }
  3229. EOF
  3230. if compile_prog "" "" ; then
  3231. timerfd=yes
  3232. fi
  3233. # check for setns and unshare support
  3234. setns=no
  3235. cat > $TMPC << EOF
  3236. #include <sched.h>
  3237. int main(void)
  3238. {
  3239. int ret;
  3240. ret = setns(0, 0);
  3241. ret = unshare(0);
  3242. return ret;
  3243. }
  3244. EOF
  3245. if compile_prog "" "" ; then
  3246. setns=yes
  3247. fi
  3248. # Check if tools are available to build documentation.
  3249. if test "$docs" != "no" ; then
  3250. if has makeinfo && has pod2man; then
  3251. docs=yes
  3252. else
  3253. if test "$docs" = "yes" ; then
  3254. feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
  3255. fi
  3256. docs=no
  3257. fi
  3258. fi
  3259. # Search for bswap_32 function
  3260. byteswap_h=no
  3261. cat > $TMPC << EOF
  3262. #include <byteswap.h>
  3263. int main(void) { return bswap_32(0); }
  3264. EOF
  3265. if compile_prog "" "" ; then
  3266. byteswap_h=yes
  3267. fi
  3268. # Search for bswap32 function
  3269. bswap_h=no
  3270. cat > $TMPC << EOF
  3271. #include <sys/endian.h>
  3272. #include <sys/types.h>
  3273. #include <machine/bswap.h>
  3274. int main(void) { return bswap32(0); }
  3275. EOF
  3276. if compile_prog "" "" ; then
  3277. bswap_h=yes
  3278. fi
  3279. ##########################################
  3280. # Do we have libiscsi >= 1.9.0
  3281. if test "$libiscsi" != "no" ; then
  3282. if $pkg_config --atleast-version=1.9.0 libiscsi; then
  3283. libiscsi="yes"
  3284. libiscsi_cflags=$($pkg_config --cflags libiscsi)
  3285. libiscsi_libs=$($pkg_config --libs libiscsi)
  3286. else
  3287. if test "$libiscsi" = "yes" ; then
  3288. feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
  3289. fi
  3290. libiscsi="no"
  3291. fi
  3292. fi
  3293. ##########################################
  3294. # Do we need libm
  3295. cat > $TMPC << EOF
  3296. #include <math.h>
  3297. int main(int argc, char **argv) { return isnan(sin((double)argc)); }
  3298. EOF
  3299. if compile_prog "" "" ; then
  3300. :
  3301. elif compile_prog "" "-lm" ; then
  3302. LIBS="-lm $LIBS"
  3303. libs_qga="-lm $libs_qga"
  3304. else
  3305. error_exit "libm check failed"
  3306. fi
  3307. ##########################################
  3308. # Do we need librt
  3309. # uClibc provides 2 versions of clock_gettime(), one with realtime
  3310. # support and one without. This means that the clock_gettime() don't
  3311. # need -lrt. We still need it for timer_create() so we check for this
  3312. # function in addition.
  3313. cat > $TMPC <<EOF
  3314. #include <signal.h>
  3315. #include <time.h>
  3316. int main(void) {
  3317. timer_create(CLOCK_REALTIME, NULL, NULL);
  3318. return clock_gettime(CLOCK_REALTIME, NULL);
  3319. }
  3320. EOF
  3321. if compile_prog "" "" ; then
  3322. :
  3323. # we need pthread for static linking. use previous pthread test result
  3324. elif compile_prog "" "$pthread_lib -lrt" ; then
  3325. LIBS="$LIBS -lrt"
  3326. libs_qga="$libs_qga -lrt"
  3327. fi
  3328. if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
  3329. "$aix" != "yes" -a "$haiku" != "yes" ; then
  3330. libs_softmmu="-lutil $libs_softmmu"
  3331. fi
  3332. ##########################################
  3333. # spice probe
  3334. if test "$spice" != "no" ; then
  3335. cat > $TMPC << EOF
  3336. #include <spice.h>
  3337. int main(void) { spice_server_new(); return 0; }
  3338. EOF
  3339. spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
  3340. spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
  3341. if $pkg_config --atleast-version=0.12.0 spice-server && \
  3342. $pkg_config --atleast-version=0.12.3 spice-protocol && \
  3343. compile_prog "$spice_cflags" "$spice_libs" ; then
  3344. spice="yes"
  3345. libs_softmmu="$libs_softmmu $spice_libs"
  3346. QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
  3347. spice_protocol_version=$($pkg_config --modversion spice-protocol)
  3348. spice_server_version=$($pkg_config --modversion spice-server)
  3349. else
  3350. if test "$spice" = "yes" ; then
  3351. feature_not_found "spice" \
  3352. "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
  3353. fi
  3354. spice="no"
  3355. fi
  3356. fi
  3357. # check for libcacard for smartcard support
  3358. smartcard_cflags=""
  3359. # TODO - what's the minimal nss version we support?
  3360. if test "$smartcard_nss" != "no"; then
  3361. cat > $TMPC << EOF
  3362. #include <pk11pub.h>
  3363. int main(void) { PK11_FreeSlot(0); return 0; }
  3364. EOF
  3365. # FIXME: do not include $glib_* in here
  3366. nss_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
  3367. nss_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
  3368. test_cflags="$nss_cflags"
  3369. # The header files in nss < 3.13.3 have a bug which causes them to
  3370. # emit a warning. If we're going to compile QEMU with -Werror, then
  3371. # test that the headers don't have this bug. Otherwise we would pass
  3372. # the configure test but fail to compile QEMU later.
  3373. if test "$werror" = "yes"; then
  3374. test_cflags="-Werror $test_cflags"
  3375. fi
  3376. if test -n "$libtool" &&
  3377. $pkg_config --atleast-version=3.12.8 nss && \
  3378. compile_prog "$test_cflags" "$nss_libs"; then
  3379. smartcard_nss="yes"
  3380. else
  3381. if test "$smartcard_nss" = "yes"; then
  3382. feature_not_found "nss" "Install nss devel >= 3.12.8"
  3383. fi
  3384. smartcard_nss="no"
  3385. fi
  3386. fi
  3387. # check for libusb
  3388. if test "$libusb" != "no" ; then
  3389. if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
  3390. libusb="yes"
  3391. libusb_cflags=$($pkg_config --cflags libusb-1.0)
  3392. libusb_libs=$($pkg_config --libs libusb-1.0)
  3393. QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
  3394. libs_softmmu="$libs_softmmu $libusb_libs"
  3395. else
  3396. if test "$libusb" = "yes"; then
  3397. feature_not_found "libusb" "Install libusb devel >= 1.0.13"
  3398. fi
  3399. libusb="no"
  3400. fi
  3401. fi
  3402. # check for usbredirparser for usb network redirection support
  3403. if test "$usb_redir" != "no" ; then
  3404. if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
  3405. usb_redir="yes"
  3406. usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
  3407. usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
  3408. QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
  3409. libs_softmmu="$libs_softmmu $usb_redir_libs"
  3410. else
  3411. if test "$usb_redir" = "yes"; then
  3412. feature_not_found "usb-redir" "Install usbredir devel"
  3413. fi
  3414. usb_redir="no"
  3415. fi
  3416. fi
  3417. ##########################################
  3418. # check if we have VSS SDK headers for win
  3419. if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
  3420. case "$vss_win32_sdk" in
  3421. "") vss_win32_include="-I$source_path" ;;
  3422. *\ *) # The SDK is installed in "Program Files" by default, but we cannot
  3423. # handle path with spaces. So we symlink the headers into ".sdk/vss".
  3424. vss_win32_include="-I$source_path/.sdk/vss"
  3425. symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
  3426. ;;
  3427. *) vss_win32_include="-I$vss_win32_sdk"
  3428. esac
  3429. cat > $TMPC << EOF
  3430. #define __MIDL_user_allocate_free_DEFINED__
  3431. #include <inc/win2003/vss.h>
  3432. int main(void) { return VSS_CTX_BACKUP; }
  3433. EOF
  3434. if compile_prog "$vss_win32_include" "" ; then
  3435. guest_agent_with_vss="yes"
  3436. QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
  3437. libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
  3438. else
  3439. if test "$vss_win32_sdk" != "" ; then
  3440. echo "ERROR: Please download and install Microsoft VSS SDK:"
  3441. echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
  3442. echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
  3443. echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
  3444. echo "ERROR: The headers are extracted in the directory \`inc'."
  3445. feature_not_found "VSS support"
  3446. fi
  3447. guest_agent_with_vss="no"
  3448. fi
  3449. fi
  3450. ##########################################
  3451. # lookup Windows platform SDK (if not specified)
  3452. # The SDK is needed only to build .tlb (type library) file of guest agent
  3453. # VSS provider from the source. It is usually unnecessary because the
  3454. # pre-compiled .tlb file is included.
  3455. if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
  3456. if test -z "$win_sdk"; then
  3457. programfiles="$PROGRAMFILES"
  3458. test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
  3459. if test -n "$programfiles"; then
  3460. win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
  3461. else
  3462. feature_not_found "Windows SDK"
  3463. fi
  3464. elif test "$win_sdk" = "no"; then
  3465. win_sdk=""
  3466. fi
  3467. fi
  3468. ##########################################
  3469. ##########################################
  3470. # check if we have fdatasync
  3471. fdatasync=no
  3472. cat > $TMPC << EOF
  3473. #include <unistd.h>
  3474. int main(void) {
  3475. #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
  3476. return fdatasync(0);
  3477. #else
  3478. #error Not supported
  3479. #endif
  3480. }
  3481. EOF
  3482. if compile_prog "" "" ; then
  3483. fdatasync=yes
  3484. fi
  3485. ##########################################
  3486. # check if we have madvise
  3487. madvise=no
  3488. cat > $TMPC << EOF
  3489. #include <sys/types.h>
  3490. #include <sys/mman.h>
  3491. #include <stddef.h>
  3492. int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
  3493. EOF
  3494. if compile_prog "" "" ; then
  3495. madvise=yes
  3496. fi
  3497. ##########################################
  3498. # check if we have posix_madvise
  3499. posix_madvise=no
  3500. cat > $TMPC << EOF
  3501. #include <sys/mman.h>
  3502. #include <stddef.h>
  3503. int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
  3504. EOF
  3505. if compile_prog "" "" ; then
  3506. posix_madvise=yes
  3507. fi
  3508. ##########################################
  3509. # check if we have usable SIGEV_THREAD_ID
  3510. sigev_thread_id=no
  3511. cat > $TMPC << EOF
  3512. #include <signal.h>
  3513. int main(void) {
  3514. struct sigevent ev;
  3515. ev.sigev_notify = SIGEV_THREAD_ID;
  3516. ev._sigev_un._tid = 0;
  3517. asm volatile("" : : "g"(&ev));
  3518. return 0;
  3519. }
  3520. EOF
  3521. if compile_prog "" "" ; then
  3522. sigev_thread_id=yes
  3523. fi
  3524. ##########################################
  3525. # check if trace backend exists
  3526. $python "$source_path/scripts/tracetool.py" "--backends=$trace_backends" --check-backends > /dev/null 2> /dev/null
  3527. if test "$?" -ne 0 ; then
  3528. error_exit "invalid trace backends" \
  3529. "Please choose supported trace backends."
  3530. fi
  3531. ##########################################
  3532. # For 'ust' backend, test if ust headers are present
  3533. if have_backend "ust"; then
  3534. cat > $TMPC << EOF
  3535. #include <lttng/tracepoint.h>
  3536. int main(void) { return 0; }
  3537. EOF
  3538. if compile_prog "" "" ; then
  3539. if $pkg_config lttng-ust --exists; then
  3540. lttng_ust_libs=`$pkg_config --libs lttng-ust`
  3541. else
  3542. lttng_ust_libs="-llttng-ust"
  3543. fi
  3544. if $pkg_config liburcu-bp --exists; then
  3545. urcu_bp_libs=`$pkg_config --libs liburcu-bp`
  3546. else
  3547. urcu_bp_libs="-lurcu-bp"
  3548. fi
  3549. LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
  3550. libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
  3551. else
  3552. error_exit "Trace backend 'ust' missing lttng-ust header files"
  3553. fi
  3554. fi
  3555. ##########################################
  3556. # For 'dtrace' backend, test if 'dtrace' command is present
  3557. if have_backend "dtrace"; then
  3558. if ! has 'dtrace' ; then
  3559. error_exit "dtrace command is not found in PATH $PATH"
  3560. fi
  3561. trace_backend_stap="no"
  3562. if has 'stap' ; then
  3563. trace_backend_stap="yes"
  3564. fi
  3565. fi
  3566. ##########################################
  3567. # check and set a backend for coroutine
  3568. # We prefer ucontext, but it's not always possible. The fallback
  3569. # is sigcontext. gthread is not selectable except explicitly, because
  3570. # it is not functional enough to run QEMU proper. (It is occasionally
  3571. # useful for debugging purposes.) On Windows the only valid backend
  3572. # is the Windows-specific one.
  3573. ucontext_works=no
  3574. if test "$darwin" != "yes"; then
  3575. cat > $TMPC << EOF
  3576. #include <ucontext.h>
  3577. #ifdef __stub_makecontext
  3578. #error Ignoring glibc stub makecontext which will always fail
  3579. #endif
  3580. int main(void) { makecontext(0, 0, 0); return 0; }
  3581. EOF
  3582. if compile_prog "" "" ; then
  3583. ucontext_works=yes
  3584. fi
  3585. fi
  3586. if test "$coroutine" = ""; then
  3587. if test "$mingw32" = "yes"; then
  3588. coroutine=win32
  3589. elif test "$ucontext_works" = "yes"; then
  3590. coroutine=ucontext
  3591. else
  3592. coroutine=sigaltstack
  3593. fi
  3594. else
  3595. case $coroutine in
  3596. windows)
  3597. if test "$mingw32" != "yes"; then
  3598. error_exit "'windows' coroutine backend only valid for Windows"
  3599. fi
  3600. # Unfortunately the user visible backend name doesn't match the
  3601. # coroutine-*.c filename for this case, so we have to adjust it here.
  3602. coroutine=win32
  3603. ;;
  3604. ucontext)
  3605. if test "$ucontext_works" != "yes"; then
  3606. feature_not_found "ucontext"
  3607. fi
  3608. ;;
  3609. gthread|sigaltstack)
  3610. if test "$mingw32" = "yes"; then
  3611. error_exit "only the 'windows' coroutine backend is valid for Windows"
  3612. fi
  3613. ;;
  3614. *)
  3615. error_exit "unknown coroutine backend $coroutine"
  3616. ;;
  3617. esac
  3618. fi
  3619. if test "$coroutine_pool" = ""; then
  3620. if test "$coroutine" = "gthread"; then
  3621. coroutine_pool=no
  3622. else
  3623. coroutine_pool=yes
  3624. fi
  3625. fi
  3626. if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
  3627. error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
  3628. fi
  3629. ##########################################
  3630. # check if we have open_by_handle_at
  3631. open_by_handle_at=no
  3632. cat > $TMPC << EOF
  3633. #include <fcntl.h>
  3634. #if !defined(AT_EMPTY_PATH)
  3635. # error missing definition
  3636. #else
  3637. int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
  3638. #endif
  3639. EOF
  3640. if compile_prog "" "" ; then
  3641. open_by_handle_at=yes
  3642. fi
  3643. ########################################
  3644. # check if we have linux/magic.h
  3645. linux_magic_h=no
  3646. cat > $TMPC << EOF
  3647. #include <linux/magic.h>
  3648. int main(void) {
  3649. return 0;
  3650. }
  3651. EOF
  3652. if compile_prog "" "" ; then
  3653. linux_magic_h=yes
  3654. fi
  3655. ########################################
  3656. # check whether we can disable warning option with a pragma (this is needed
  3657. # to silence warnings in the headers of some versions of external libraries).
  3658. # This test has to be compiled with -Werror as otherwise an unknown pragma is
  3659. # only a warning.
  3660. #
  3661. # If we can't selectively disable warning in the code, disable -Werror so that
  3662. # the build doesn't fail anyway.
  3663. pragma_disable_unused_but_set=no
  3664. cat > $TMPC << EOF
  3665. #pragma GCC diagnostic push
  3666. #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
  3667. #pragma GCC diagnostic ignored "-Wstrict-prototypes"
  3668. #pragma GCC diagnostic pop
  3669. int main(void) {
  3670. return 0;
  3671. }
  3672. EOF
  3673. if compile_prog "-Werror" "" ; then
  3674. pragma_diagnostic_available=yes
  3675. else
  3676. werror=no
  3677. fi
  3678. ########################################
  3679. # check if we have valgrind/valgrind.h
  3680. valgrind_h=no
  3681. cat > $TMPC << EOF
  3682. #include <valgrind/valgrind.h>
  3683. int main(void) {
  3684. return 0;
  3685. }
  3686. EOF
  3687. if compile_prog "" "" ; then
  3688. valgrind_h=yes
  3689. fi
  3690. ########################################
  3691. # check if environ is declared
  3692. has_environ=no
  3693. cat > $TMPC << EOF
  3694. #include <unistd.h>
  3695. int main(void) {
  3696. environ = 0;
  3697. return 0;
  3698. }
  3699. EOF
  3700. if compile_prog "" "" ; then
  3701. has_environ=yes
  3702. fi
  3703. ########################################
  3704. # check if cpuid.h is usable.
  3705. cpuid_h=no
  3706. cat > $TMPC << EOF
  3707. #include <cpuid.h>
  3708. int main(void) {
  3709. unsigned a, b, c, d;
  3710. int max = __get_cpuid_max(0, 0);
  3711. if (max >= 1) {
  3712. __cpuid(1, a, b, c, d);
  3713. }
  3714. if (max >= 7) {
  3715. __cpuid_count(7, 0, a, b, c, d);
  3716. }
  3717. return 0;
  3718. }
  3719. EOF
  3720. if compile_prog "" "" ; then
  3721. cpuid_h=yes
  3722. fi
  3723. ########################################
  3724. # check if __[u]int128_t is usable.
  3725. int128=no
  3726. cat > $TMPC << EOF
  3727. #if defined(__clang_major__) && defined(__clang_minor__)
  3728. # if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2))
  3729. # error __int128_t does not work in CLANG before 3.2
  3730. # endif
  3731. #endif
  3732. __int128_t a;
  3733. __uint128_t b;
  3734. int main (void) {
  3735. a = a + b;
  3736. b = a * b;
  3737. a = a * a;
  3738. return 0;
  3739. }
  3740. EOF
  3741. if compile_prog "" "" ; then
  3742. int128=yes
  3743. fi
  3744. ########################################
  3745. # check if getauxval is available.
  3746. getauxval=no
  3747. cat > $TMPC << EOF
  3748. #include <sys/auxv.h>
  3749. int main(void) {
  3750. return getauxval(AT_HWCAP) == 0;
  3751. }
  3752. EOF
  3753. if compile_prog "" "" ; then
  3754. getauxval=yes
  3755. fi
  3756. ##########################################
  3757. # End of CC checks
  3758. # After here, no more $cc or $ld runs
  3759. if test "$gcov" = "yes" ; then
  3760. CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
  3761. LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
  3762. elif test "$debug" = "no" ; then
  3763. CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
  3764. fi
  3765. ##########################################
  3766. # Do we have libnfs
  3767. if test "$libnfs" != "no" ; then
  3768. if $pkg_config --atleast-version=1.9.3 libnfs; then
  3769. libnfs="yes"
  3770. libnfs_libs=$($pkg_config --libs libnfs)
  3771. LIBS="$LIBS $libnfs_libs"
  3772. else
  3773. if test "$libnfs" = "yes" ; then
  3774. feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
  3775. fi
  3776. libnfs="no"
  3777. fi
  3778. fi
  3779. # Disable zero malloc errors for official releases unless explicitly told to
  3780. # enable/disable
  3781. if test -z "$zero_malloc" ; then
  3782. if test "$z_version" = "50" ; then
  3783. zero_malloc="no"
  3784. else
  3785. zero_malloc="yes"
  3786. fi
  3787. fi
  3788. # Now we've finished running tests it's OK to add -Werror to the compiler flags
  3789. if test "$werror" = "yes"; then
  3790. QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
  3791. fi
  3792. if test "$solaris" = "no" ; then
  3793. if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
  3794. LDFLAGS="-Wl,--warn-common $LDFLAGS"
  3795. fi
  3796. fi
  3797. # test if pod2man has --utf8 option
  3798. if pod2man --help | grep -q utf8; then
  3799. POD2MAN="pod2man --utf8"
  3800. else
  3801. POD2MAN="pod2man"
  3802. fi
  3803. # Use ASLR, no-SEH and DEP if available
  3804. if test "$mingw32" = "yes" ; then
  3805. for flag in --dynamicbase --no-seh --nxcompat; do
  3806. if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
  3807. LDFLAGS="-Wl,$flag $LDFLAGS"
  3808. fi
  3809. done
  3810. fi
  3811. qemu_confdir=$sysconfdir$confsuffix
  3812. qemu_moddir=$libdir$confsuffix
  3813. qemu_datadir=$datadir$confsuffix
  3814. qemu_localedir="$datadir/locale"
  3815. tools=""
  3816. if test "$want_tools" = "yes" ; then
  3817. tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
  3818. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
  3819. tools="qemu-nbd\$(EXESUF) $tools"
  3820. fi
  3821. fi
  3822. if test "$softmmu" = yes ; then
  3823. if test "$virtfs" != no ; then
  3824. if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
  3825. virtfs=yes
  3826. tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
  3827. else
  3828. if test "$virtfs" = yes; then
  3829. error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
  3830. fi
  3831. virtfs=no
  3832. fi
  3833. fi
  3834. fi
  3835. if [ "$guest_agent" != "no" ]; then
  3836. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
  3837. tools="qemu-ga\$(EXESUF) $tools"
  3838. if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
  3839. tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
  3840. fi
  3841. guest_agent=yes
  3842. elif [ "$guest_agent" != yes ]; then
  3843. guest_agent=no
  3844. else
  3845. error_exit "Guest agent is not supported on this platform"
  3846. fi
  3847. fi
  3848. # Mac OS X ships with a broken assembler
  3849. roms=
  3850. if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
  3851. "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
  3852. "$softmmu" = yes ; then
  3853. roms="optionrom"
  3854. fi
  3855. if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
  3856. roms="$roms spapr-rtas"
  3857. fi
  3858. if test "$cpu" = "s390x" ; then
  3859. roms="$roms s390-ccw"
  3860. fi
  3861. # Probe for the need for relocating the user-only binary.
  3862. if test "$pie" = "no" ; then
  3863. textseg_addr=
  3864. case "$cpu" in
  3865. arm | i386 | ppc* | s390* | sparc* | x86_64 | x32)
  3866. # ??? Rationale for choosing this address
  3867. textseg_addr=0x60000000
  3868. ;;
  3869. mips)
  3870. # A 256M aligned address, high in the address space, with enough
  3871. # room for the code_gen_buffer above it before the stack.
  3872. textseg_addr=0x60000000
  3873. ;;
  3874. esac
  3875. if [ -n "$textseg_addr" ]; then
  3876. cat > $TMPC <<EOF
  3877. int main(void) { return 0; }
  3878. EOF
  3879. textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
  3880. if ! compile_prog "" "$textseg_ldflags"; then
  3881. # In case ld does not support -Ttext-segment, edit the default linker
  3882. # script via sed to set the .text start addr. This is needed on FreeBSD
  3883. # at least.
  3884. $ld --verbose | sed \
  3885. -e '1,/==================================================/d' \
  3886. -e '/==================================================/,$d' \
  3887. -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
  3888. -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
  3889. textseg_ldflags="-Wl,-T../config-host.ld"
  3890. fi
  3891. fi
  3892. fi
  3893. # prepend pixman and ftd flags after all config tests are done
  3894. QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
  3895. libs_softmmu="$pixman_libs $libs_softmmu"
  3896. echo "Install prefix $prefix"
  3897. echo "BIOS directory `eval echo $qemu_datadir`"
  3898. echo "binary directory `eval echo $bindir`"
  3899. echo "library directory `eval echo $libdir`"
  3900. echo "module directory `eval echo $qemu_moddir`"
  3901. echo "libexec directory `eval echo $libexecdir`"
  3902. echo "include directory `eval echo $includedir`"
  3903. echo "config directory `eval echo $sysconfdir`"
  3904. if test "$mingw32" = "no" ; then
  3905. echo "local state directory `eval echo $local_statedir`"
  3906. echo "Manual directory `eval echo $mandir`"
  3907. echo "ELF interp prefix $interp_prefix"
  3908. else
  3909. echo "local state directory queried at runtime"
  3910. echo "Windows SDK $win_sdk"
  3911. fi
  3912. echo "Source path $source_path"
  3913. echo "C compiler $cc"
  3914. echo "Host C compiler $host_cc"
  3915. echo "C++ compiler $cxx"
  3916. echo "Objective-C compiler $objcc"
  3917. echo "ARFLAGS $ARFLAGS"
  3918. echo "CFLAGS $CFLAGS"
  3919. echo "QEMU_CFLAGS $QEMU_CFLAGS"
  3920. echo "LDFLAGS $LDFLAGS"
  3921. echo "make $make"
  3922. echo "install $install"
  3923. echo "python $python"
  3924. if test "$slirp" = "yes" ; then
  3925. echo "smbd $smbd"
  3926. fi
  3927. echo "module support $modules"
  3928. echo "host CPU $cpu"
  3929. echo "host big endian $bigendian"
  3930. echo "target list $target_list"
  3931. echo "tcg debug enabled $debug_tcg"
  3932. echo "gprof enabled $gprof"
  3933. echo "sparse enabled $sparse"
  3934. echo "strip binaries $strip_opt"
  3935. echo "profiler $profiler"
  3936. echo "static build $static"
  3937. if test "$darwin" = "yes" ; then
  3938. echo "Cocoa support $cocoa"
  3939. fi
  3940. echo "pixman $pixman"
  3941. echo "SDL support $sdl"
  3942. echo "GTK support $gtk"
  3943. echo "VTE support $vte"
  3944. echo "curses support $curses"
  3945. echo "curl support $curl"
  3946. echo "mingw32 support $mingw32"
  3947. echo "Audio drivers $audio_drv_list"
  3948. echo "Block whitelist (rw) $block_drv_rw_whitelist"
  3949. echo "Block whitelist (ro) $block_drv_ro_whitelist"
  3950. echo "VirtFS support $virtfs"
  3951. echo "VNC support $vnc"
  3952. if test "$vnc" = "yes" ; then
  3953. echo "VNC TLS support $vnc_tls"
  3954. echo "VNC SASL support $vnc_sasl"
  3955. echo "VNC JPEG support $vnc_jpeg"
  3956. echo "VNC PNG support $vnc_png"
  3957. echo "VNC WS support $vnc_ws"
  3958. fi
  3959. if test -n "$sparc_cpu"; then
  3960. echo "Target Sparc Arch $sparc_cpu"
  3961. fi
  3962. echo "xen support $xen"
  3963. echo "brlapi support $brlapi"
  3964. echo "bluez support $bluez"
  3965. echo "Documentation $docs"
  3966. echo "GUEST_BASE $guest_base"
  3967. echo "PIE $pie"
  3968. echo "vde support $vde"
  3969. echo "netmap support $netmap"
  3970. echo "Linux AIO support $linux_aio"
  3971. echo "ATTR/XATTR support $attr"
  3972. echo "Install blobs $blobs"
  3973. echo "KVM support $kvm"
  3974. echo "RDMA support $rdma"
  3975. echo "TCG interpreter $tcg_interpreter"
  3976. echo "fdt support $fdt"
  3977. echo "preadv support $preadv"
  3978. echo "fdatasync $fdatasync"
  3979. echo "madvise $madvise"
  3980. echo "posix_madvise $posix_madvise"
  3981. echo "sigev_thread_id $sigev_thread_id"
  3982. echo "uuid support $uuid"
  3983. echo "libcap-ng support $cap_ng"
  3984. echo "vhost-net support $vhost_net"
  3985. echo "vhost-scsi support $vhost_scsi"
  3986. echo "Trace backends $trace_backends"
  3987. if test "$trace_backend" = "simple"; then
  3988. echo "Trace output file $trace_file-<pid>"
  3989. fi
  3990. if test "$spice" = "yes"; then
  3991. echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
  3992. else
  3993. echo "spice support $spice"
  3994. fi
  3995. echo "rbd support $rbd"
  3996. echo "xfsctl support $xfs"
  3997. echo "nss used $smartcard_nss"
  3998. echo "libusb $libusb"
  3999. echo "usb net redir $usb_redir"
  4000. echo "GLX support $glx"
  4001. echo "libiscsi support $libiscsi"
  4002. echo "libnfs support $libnfs"
  4003. echo "build guest agent $guest_agent"
  4004. echo "QGA VSS support $guest_agent_with_vss"
  4005. echo "seccomp support $seccomp"
  4006. echo "coroutine backend $coroutine"
  4007. echo "coroutine pool $coroutine_pool"
  4008. echo "GlusterFS support $glusterfs"
  4009. echo "Archipelago support $archipelago"
  4010. echo "gcov $gcov_tool"
  4011. echo "gcov enabled $gcov"
  4012. echo "TPM support $tpm"
  4013. echo "libssh2 support $libssh2"
  4014. echo "TPM passthrough $tpm_passthrough"
  4015. echo "QOM debugging $qom_cast_debug"
  4016. echo "vhdx $vhdx"
  4017. echo "Quorum $quorum"
  4018. echo "lzo support $lzo"
  4019. echo "snappy support $snappy"
  4020. echo "NUMA host support $numa"
  4021. if test "$sdl_too_old" = "yes"; then
  4022. echo "-> Your SDL version is too old - please upgrade to have SDL support"
  4023. fi
  4024. config_host_mak="config-host.mak"
  4025. echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
  4026. echo "# Automatically generated by configure - do not modify" > $config_host_mak
  4027. echo >> $config_host_mak
  4028. echo all: >> $config_host_mak
  4029. echo "prefix=$prefix" >> $config_host_mak
  4030. echo "bindir=$bindir" >> $config_host_mak
  4031. echo "libdir=$libdir" >> $config_host_mak
  4032. echo "libexecdir=$libexecdir" >> $config_host_mak
  4033. echo "includedir=$includedir" >> $config_host_mak
  4034. echo "mandir=$mandir" >> $config_host_mak
  4035. echo "sysconfdir=$sysconfdir" >> $config_host_mak
  4036. echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
  4037. echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
  4038. echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
  4039. echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
  4040. if test "$mingw32" = "no" ; then
  4041. echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
  4042. fi
  4043. echo "qemu_helperdir=$libexecdir" >> $config_host_mak
  4044. echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
  4045. echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
  4046. echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
  4047. echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
  4048. echo "ARCH=$ARCH" >> $config_host_mak
  4049. if test "$debug_tcg" = "yes" ; then
  4050. echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
  4051. fi
  4052. if test "$strip_opt" = "yes" ; then
  4053. echo "STRIP=${strip}" >> $config_host_mak
  4054. fi
  4055. if test "$bigendian" = "yes" ; then
  4056. echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
  4057. fi
  4058. if test "$mingw32" = "yes" ; then
  4059. echo "CONFIG_WIN32=y" >> $config_host_mak
  4060. rc_version=`cat $source_path/VERSION`
  4061. version_major=${rc_version%%.*}
  4062. rc_version=${rc_version#*.}
  4063. version_minor=${rc_version%%.*}
  4064. rc_version=${rc_version#*.}
  4065. version_subminor=${rc_version%%.*}
  4066. version_micro=0
  4067. echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  4068. echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  4069. if test "$guest_agent_with_vss" = "yes" ; then
  4070. echo "CONFIG_QGA_VSS=y" >> $config_host_mak
  4071. echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
  4072. fi
  4073. else
  4074. echo "CONFIG_POSIX=y" >> $config_host_mak
  4075. fi
  4076. if test "$linux" = "yes" ; then
  4077. echo "CONFIG_LINUX=y" >> $config_host_mak
  4078. fi
  4079. if test "$darwin" = "yes" ; then
  4080. echo "CONFIG_DARWIN=y" >> $config_host_mak
  4081. fi
  4082. if test "$aix" = "yes" ; then
  4083. echo "CONFIG_AIX=y" >> $config_host_mak
  4084. fi
  4085. if test "$solaris" = "yes" ; then
  4086. echo "CONFIG_SOLARIS=y" >> $config_host_mak
  4087. echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
  4088. if test "$needs_libsunmath" = "yes" ; then
  4089. echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
  4090. fi
  4091. fi
  4092. if test "$haiku" = "yes" ; then
  4093. echo "CONFIG_HAIKU=y" >> $config_host_mak
  4094. fi
  4095. if test "$static" = "yes" ; then
  4096. echo "CONFIG_STATIC=y" >> $config_host_mak
  4097. fi
  4098. if test "$profiler" = "yes" ; then
  4099. echo "CONFIG_PROFILER=y" >> $config_host_mak
  4100. fi
  4101. if test "$slirp" = "yes" ; then
  4102. echo "CONFIG_SLIRP=y" >> $config_host_mak
  4103. echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
  4104. fi
  4105. if test "$vde" = "yes" ; then
  4106. echo "CONFIG_VDE=y" >> $config_host_mak
  4107. fi
  4108. if test "$netmap" = "yes" ; then
  4109. echo "CONFIG_NETMAP=y" >> $config_host_mak
  4110. fi
  4111. if test "$l2tpv3" = "yes" ; then
  4112. echo "CONFIG_L2TPV3=y" >> $config_host_mak
  4113. fi
  4114. if test "$cap_ng" = "yes" ; then
  4115. echo "CONFIG_LIBCAP=y" >> $config_host_mak
  4116. fi
  4117. echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
  4118. for drv in $audio_drv_list; do
  4119. def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
  4120. echo "$def=y" >> $config_host_mak
  4121. if test "$drv" = "fmod"; then
  4122. echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
  4123. fi
  4124. done
  4125. if test "$audio_pt_int" = "yes" ; then
  4126. echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
  4127. fi
  4128. if test "$audio_win_int" = "yes" ; then
  4129. echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
  4130. fi
  4131. echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
  4132. echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
  4133. if test "$vnc" = "yes" ; then
  4134. echo "CONFIG_VNC=y" >> $config_host_mak
  4135. fi
  4136. if test "$vnc_tls" = "yes" ; then
  4137. echo "CONFIG_VNC_TLS=y" >> $config_host_mak
  4138. fi
  4139. if test "$vnc_sasl" = "yes" ; then
  4140. echo "CONFIG_VNC_SASL=y" >> $config_host_mak
  4141. fi
  4142. if test "$vnc_jpeg" = "yes" ; then
  4143. echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
  4144. fi
  4145. if test "$vnc_png" = "yes" ; then
  4146. echo "CONFIG_VNC_PNG=y" >> $config_host_mak
  4147. fi
  4148. if test "$vnc_ws" = "yes" ; then
  4149. echo "CONFIG_VNC_WS=y" >> $config_host_mak
  4150. echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
  4151. fi
  4152. if test "$fnmatch" = "yes" ; then
  4153. echo "CONFIG_FNMATCH=y" >> $config_host_mak
  4154. fi
  4155. if test "$uuid" = "yes" ; then
  4156. echo "CONFIG_UUID=y" >> $config_host_mak
  4157. fi
  4158. if test "$xfs" = "yes" ; then
  4159. echo "CONFIG_XFS=y" >> $config_host_mak
  4160. fi
  4161. qemu_version=`head $source_path/VERSION`
  4162. echo "VERSION=$qemu_version" >>$config_host_mak
  4163. echo "PKGVERSION=$pkgversion" >>$config_host_mak
  4164. echo "SRC_PATH=$source_path" >> $config_host_mak
  4165. echo "TARGET_DIRS=$target_list" >> $config_host_mak
  4166. if [ "$docs" = "yes" ] ; then
  4167. echo "BUILD_DOCS=yes" >> $config_host_mak
  4168. fi
  4169. if test "$modules" = "yes"; then
  4170. # $shacmd can generate a hash started with digit, which the compiler doesn't
  4171. # like as an symbol. So prefix it with an underscore
  4172. echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
  4173. echo "CONFIG_MODULES=y" >> $config_host_mak
  4174. fi
  4175. if test "$sdl" = "yes" ; then
  4176. echo "CONFIG_SDL=y" >> $config_host_mak
  4177. echo "CONFIG_SDLABI=$sdlabi" >> $config_host_mak
  4178. echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
  4179. fi
  4180. if test "$cocoa" = "yes" ; then
  4181. echo "CONFIG_COCOA=y" >> $config_host_mak
  4182. fi
  4183. if test "$curses" = "yes" ; then
  4184. echo "CONFIG_CURSES=y" >> $config_host_mak
  4185. fi
  4186. if test "$utimens" = "yes" ; then
  4187. echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
  4188. fi
  4189. if test "$pipe2" = "yes" ; then
  4190. echo "CONFIG_PIPE2=y" >> $config_host_mak
  4191. fi
  4192. if test "$accept4" = "yes" ; then
  4193. echo "CONFIG_ACCEPT4=y" >> $config_host_mak
  4194. fi
  4195. if test "$splice" = "yes" ; then
  4196. echo "CONFIG_SPLICE=y" >> $config_host_mak
  4197. fi
  4198. if test "$eventfd" = "yes" ; then
  4199. echo "CONFIG_EVENTFD=y" >> $config_host_mak
  4200. fi
  4201. if test "$fallocate" = "yes" ; then
  4202. echo "CONFIG_FALLOCATE=y" >> $config_host_mak
  4203. fi
  4204. if test "$fallocate_punch_hole" = "yes" ; then
  4205. echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
  4206. fi
  4207. if test "$posix_fallocate" = "yes" ; then
  4208. echo "CONFIG_POSIX_FALLOCATE=y" >> $config_host_mak
  4209. fi
  4210. if test "$sync_file_range" = "yes" ; then
  4211. echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
  4212. fi
  4213. if test "$fiemap" = "yes" ; then
  4214. echo "CONFIG_FIEMAP=y" >> $config_host_mak
  4215. fi
  4216. if test "$dup3" = "yes" ; then
  4217. echo "CONFIG_DUP3=y" >> $config_host_mak
  4218. fi
  4219. if test "$ppoll" = "yes" ; then
  4220. echo "CONFIG_PPOLL=y" >> $config_host_mak
  4221. fi
  4222. if test "$prctl_pr_set_timerslack" = "yes" ; then
  4223. echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
  4224. fi
  4225. if test "$epoll" = "yes" ; then
  4226. echo "CONFIG_EPOLL=y" >> $config_host_mak
  4227. fi
  4228. if test "$epoll_create1" = "yes" ; then
  4229. echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
  4230. fi
  4231. if test "$epoll_pwait" = "yes" ; then
  4232. echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
  4233. fi
  4234. if test "$sendfile" = "yes" ; then
  4235. echo "CONFIG_SENDFILE=y" >> $config_host_mak
  4236. fi
  4237. if test "$timerfd" = "yes" ; then
  4238. echo "CONFIG_TIMERFD=y" >> $config_host_mak
  4239. fi
  4240. if test "$setns" = "yes" ; then
  4241. echo "CONFIG_SETNS=y" >> $config_host_mak
  4242. fi
  4243. if test "$inotify" = "yes" ; then
  4244. echo "CONFIG_INOTIFY=y" >> $config_host_mak
  4245. fi
  4246. if test "$inotify1" = "yes" ; then
  4247. echo "CONFIG_INOTIFY1=y" >> $config_host_mak
  4248. fi
  4249. if test "$byteswap_h" = "yes" ; then
  4250. echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
  4251. fi
  4252. if test "$bswap_h" = "yes" ; then
  4253. echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
  4254. fi
  4255. if test "$curl" = "yes" ; then
  4256. echo "CONFIG_CURL=m" >> $config_host_mak
  4257. echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
  4258. echo "CURL_LIBS=$curl_libs" >> $config_host_mak
  4259. fi
  4260. if test "$brlapi" = "yes" ; then
  4261. echo "CONFIG_BRLAPI=y" >> $config_host_mak
  4262. fi
  4263. if test "$bluez" = "yes" ; then
  4264. echo "CONFIG_BLUEZ=y" >> $config_host_mak
  4265. echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
  4266. fi
  4267. if test "glib_subprocess" = "yes" ; then
  4268. echo "CONFIG_HAS_GLIB_SUBPROCESS_TESTS=y" >> $config_host_mak
  4269. fi
  4270. echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
  4271. if test "$gtk" = "yes" ; then
  4272. echo "CONFIG_GTK=y" >> $config_host_mak
  4273. echo "CONFIG_GTKABI=$gtkabi" >> $config_host_mak
  4274. echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
  4275. fi
  4276. if test "$vte" = "yes" ; then
  4277. echo "CONFIG_VTE=y" >> $config_host_mak
  4278. echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
  4279. fi
  4280. if test "$xen" = "yes" ; then
  4281. echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
  4282. echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
  4283. fi
  4284. if test "$linux_aio" = "yes" ; then
  4285. echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
  4286. fi
  4287. if test "$attr" = "yes" ; then
  4288. echo "CONFIG_ATTR=y" >> $config_host_mak
  4289. fi
  4290. if test "$libattr" = "yes" ; then
  4291. echo "CONFIG_LIBATTR=y" >> $config_host_mak
  4292. fi
  4293. if test "$virtfs" = "yes" ; then
  4294. echo "CONFIG_VIRTFS=y" >> $config_host_mak
  4295. fi
  4296. if test "$vhost_scsi" = "yes" ; then
  4297. echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
  4298. fi
  4299. if test "$vhost_net" = "yes" ; then
  4300. echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak
  4301. fi
  4302. if test "$blobs" = "yes" ; then
  4303. echo "INSTALL_BLOBS=yes" >> $config_host_mak
  4304. fi
  4305. if test "$iovec" = "yes" ; then
  4306. echo "CONFIG_IOVEC=y" >> $config_host_mak
  4307. fi
  4308. if test "$preadv" = "yes" ; then
  4309. echo "CONFIG_PREADV=y" >> $config_host_mak
  4310. fi
  4311. if test "$fdt" = "yes" ; then
  4312. echo "CONFIG_FDT=y" >> $config_host_mak
  4313. fi
  4314. if test "$signalfd" = "yes" ; then
  4315. echo "CONFIG_SIGNALFD=y" >> $config_host_mak
  4316. fi
  4317. if test "$tcg_interpreter" = "yes" ; then
  4318. echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
  4319. fi
  4320. if test "$fdatasync" = "yes" ; then
  4321. echo "CONFIG_FDATASYNC=y" >> $config_host_mak
  4322. fi
  4323. if test "$madvise" = "yes" ; then
  4324. echo "CONFIG_MADVISE=y" >> $config_host_mak
  4325. fi
  4326. if test "$posix_madvise" = "yes" ; then
  4327. echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
  4328. fi
  4329. if test "$sigev_thread_id" = "yes" ; then
  4330. echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
  4331. fi
  4332. if test "$spice" = "yes" ; then
  4333. echo "CONFIG_SPICE=y" >> $config_host_mak
  4334. fi
  4335. if test "$smartcard_nss" = "yes" ; then
  4336. echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
  4337. echo "NSS_LIBS=$nss_libs" >> $config_host_mak
  4338. echo "NSS_CFLAGS=$nss_cflags" >> $config_host_mak
  4339. fi
  4340. if test "$libusb" = "yes" ; then
  4341. echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
  4342. fi
  4343. if test "$usb_redir" = "yes" ; then
  4344. echo "CONFIG_USB_REDIR=y" >> $config_host_mak
  4345. fi
  4346. if test "$glx" = "yes" ; then
  4347. echo "CONFIG_GLX=y" >> $config_host_mak
  4348. echo "GLX_LIBS=$glx_libs" >> $config_host_mak
  4349. fi
  4350. if test "$lzo" = "yes" ; then
  4351. echo "CONFIG_LZO=y" >> $config_host_mak
  4352. fi
  4353. if test "$snappy" = "yes" ; then
  4354. echo "CONFIG_SNAPPY=y" >> $config_host_mak
  4355. fi
  4356. if test "$libiscsi" = "yes" ; then
  4357. echo "CONFIG_LIBISCSI=m" >> $config_host_mak
  4358. echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
  4359. echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
  4360. fi
  4361. if test "$libnfs" = "yes" ; then
  4362. echo "CONFIG_LIBNFS=y" >> $config_host_mak
  4363. fi
  4364. if test "$seccomp" = "yes"; then
  4365. echo "CONFIG_SECCOMP=y" >> $config_host_mak
  4366. fi
  4367. # XXX: suppress that
  4368. if [ "$bsd" = "yes" ] ; then
  4369. echo "CONFIG_BSD=y" >> $config_host_mak
  4370. fi
  4371. if test "$zero_malloc" = "yes" ; then
  4372. echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
  4373. fi
  4374. if test "$qom_cast_debug" = "yes" ; then
  4375. echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
  4376. fi
  4377. if test "$rbd" = "yes" ; then
  4378. echo "CONFIG_RBD=m" >> $config_host_mak
  4379. echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
  4380. echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
  4381. fi
  4382. echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
  4383. if test "$coroutine_pool" = "yes" ; then
  4384. echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
  4385. else
  4386. echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
  4387. fi
  4388. if test "$open_by_handle_at" = "yes" ; then
  4389. echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
  4390. fi
  4391. if test "$linux_magic_h" = "yes" ; then
  4392. echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
  4393. fi
  4394. if test "$pragma_diagnostic_available" = "yes" ; then
  4395. echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
  4396. fi
  4397. if test "$valgrind_h" = "yes" ; then
  4398. echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
  4399. fi
  4400. if test "$has_environ" = "yes" ; then
  4401. echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
  4402. fi
  4403. if test "$cpuid_h" = "yes" ; then
  4404. echo "CONFIG_CPUID_H=y" >> $config_host_mak
  4405. fi
  4406. if test "$int128" = "yes" ; then
  4407. echo "CONFIG_INT128=y" >> $config_host_mak
  4408. fi
  4409. if test "$getauxval" = "yes" ; then
  4410. echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
  4411. fi
  4412. if test "$glusterfs" = "yes" ; then
  4413. echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
  4414. echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
  4415. echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
  4416. fi
  4417. if test "$glusterfs_discard" = "yes" ; then
  4418. echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
  4419. fi
  4420. if test "$glusterfs_zerofill" = "yes" ; then
  4421. echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
  4422. fi
  4423. if test "$archipelago" = "yes" ; then
  4424. echo "CONFIG_ARCHIPELAGO=m" >> $config_host_mak
  4425. echo "ARCHIPELAGO_LIBS=$archipelago_libs" >> $config_host_mak
  4426. fi
  4427. if test "$libssh2" = "yes" ; then
  4428. echo "CONFIG_LIBSSH2=m" >> $config_host_mak
  4429. echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
  4430. echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
  4431. fi
  4432. if test "$quorum" = "yes" ; then
  4433. echo "CONFIG_QUORUM=y" >> $config_host_mak
  4434. fi
  4435. if test "$vhdx" = "yes" ; then
  4436. echo "CONFIG_VHDX=y" >> $config_host_mak
  4437. fi
  4438. # USB host support
  4439. if test "$libusb" = "yes"; then
  4440. echo "HOST_USB=libusb legacy" >> $config_host_mak
  4441. else
  4442. echo "HOST_USB=stub" >> $config_host_mak
  4443. fi
  4444. # TPM passthrough support?
  4445. if test "$tpm" = "yes"; then
  4446. echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
  4447. if test "$tpm_passthrough" = "yes"; then
  4448. echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
  4449. fi
  4450. fi
  4451. echo "TRACE_BACKENDS=$trace_backends" >> $config_host_mak
  4452. if have_backend "nop"; then
  4453. echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
  4454. fi
  4455. if have_backend "simple"; then
  4456. echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
  4457. # Set the appropriate trace file.
  4458. trace_file="\"$trace_file-\" FMT_pid"
  4459. fi
  4460. if have_backend "stderr"; then
  4461. echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
  4462. fi
  4463. if have_backend "ust"; then
  4464. echo "CONFIG_TRACE_UST=y" >> $config_host_mak
  4465. fi
  4466. if have_backend "dtrace"; then
  4467. echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
  4468. if test "$trace_backend_stap" = "yes" ; then
  4469. echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
  4470. fi
  4471. fi
  4472. if have_backend "ftrace"; then
  4473. if test "$linux" = "yes" ; then
  4474. echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
  4475. else
  4476. feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
  4477. fi
  4478. fi
  4479. echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
  4480. if test "$rdma" = "yes" ; then
  4481. echo "CONFIG_RDMA=y" >> $config_host_mak
  4482. fi
  4483. # Hold two types of flag:
  4484. # CONFIG_THREAD_SETNAME_BYTHREAD - we've got a way of setting the name on
  4485. # a thread we have a handle to
  4486. # CONFIG_PTHREAD_SETNAME_NP - A way of doing it on a particular
  4487. # platform
  4488. if test "$pthread_setname_np" = "yes" ; then
  4489. echo "CONFIG_THREAD_SETNAME_BYTHREAD=y" >> $config_host_mak
  4490. echo "CONFIG_PTHREAD_SETNAME_NP=y" >> $config_host_mak
  4491. fi
  4492. if test "$tcg_interpreter" = "yes"; then
  4493. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
  4494. elif test "$ARCH" = "sparc64" ; then
  4495. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
  4496. elif test "$ARCH" = "s390x" ; then
  4497. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
  4498. elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
  4499. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
  4500. elif test "$ARCH" = "ppc64" ; then
  4501. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/ppc $QEMU_INCLUDES"
  4502. else
  4503. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
  4504. fi
  4505. QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
  4506. echo "TOOLS=$tools" >> $config_host_mak
  4507. echo "ROMS=$roms" >> $config_host_mak
  4508. echo "MAKE=$make" >> $config_host_mak
  4509. echo "INSTALL=$install" >> $config_host_mak
  4510. echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
  4511. echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
  4512. if test -n "$libtool"; then
  4513. echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
  4514. echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
  4515. else
  4516. echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
  4517. echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
  4518. fi
  4519. echo "PYTHON=$python" >> $config_host_mak
  4520. echo "CC=$cc" >> $config_host_mak
  4521. if $iasl -h > /dev/null 2>&1; then
  4522. echo "IASL=$iasl" >> $config_host_mak
  4523. fi
  4524. echo "CC_I386=$cc_i386" >> $config_host_mak
  4525. echo "HOST_CC=$host_cc" >> $config_host_mak
  4526. echo "CXX=$cxx" >> $config_host_mak
  4527. echo "OBJCC=$objcc" >> $config_host_mak
  4528. echo "AR=$ar" >> $config_host_mak
  4529. echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
  4530. echo "AS=$as" >> $config_host_mak
  4531. echo "CPP=$cpp" >> $config_host_mak
  4532. echo "OBJCOPY=$objcopy" >> $config_host_mak
  4533. echo "LD=$ld" >> $config_host_mak
  4534. echo "NM=$nm" >> $config_host_mak
  4535. echo "WINDRES=$windres" >> $config_host_mak
  4536. echo "LIBTOOL=$libtool" >> $config_host_mak
  4537. echo "CFLAGS=$CFLAGS" >> $config_host_mak
  4538. echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
  4539. echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
  4540. echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
  4541. if test "$sparse" = "yes" ; then
  4542. echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
  4543. echo "CXX := REAL_CC=\"\$(CXX)\" cgcc" >> $config_host_mak
  4544. echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
  4545. echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
  4546. fi
  4547. if test "$cross_prefix" != ""; then
  4548. echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
  4549. else
  4550. echo "AUTOCONF_HOST := " >> $config_host_mak
  4551. fi
  4552. echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
  4553. echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
  4554. echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
  4555. echo "LIBS+=$LIBS" >> $config_host_mak
  4556. echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
  4557. echo "EXESUF=$EXESUF" >> $config_host_mak
  4558. echo "DSOSUF=$DSOSUF" >> $config_host_mak
  4559. echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
  4560. echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
  4561. echo "POD2MAN=$POD2MAN" >> $config_host_mak
  4562. echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
  4563. if test "$gcov" = "yes" ; then
  4564. echo "CONFIG_GCOV=y" >> $config_host_mak
  4565. echo "GCOV=$gcov_tool" >> $config_host_mak
  4566. fi
  4567. # use included Linux headers
  4568. if test "$linux" = "yes" ; then
  4569. mkdir -p linux-headers
  4570. case "$cpu" in
  4571. i386|x86_64|x32)
  4572. linux_arch=x86
  4573. ;;
  4574. ppcemb|ppc|ppc64)
  4575. linux_arch=powerpc
  4576. ;;
  4577. s390x)
  4578. linux_arch=s390
  4579. ;;
  4580. aarch64)
  4581. linux_arch=arm64
  4582. ;;
  4583. mips64)
  4584. linux_arch=mips
  4585. ;;
  4586. *)
  4587. # For most CPUs the kernel architecture name and QEMU CPU name match.
  4588. linux_arch="$cpu"
  4589. ;;
  4590. esac
  4591. # For non-KVM architectures we will not have asm headers
  4592. if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
  4593. symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
  4594. fi
  4595. fi
  4596. for target in $target_list; do
  4597. target_dir="$target"
  4598. config_target_mak=$target_dir/config-target.mak
  4599. target_name=`echo $target | cut -d '-' -f 1`
  4600. target_bigendian="no"
  4601. case "$target_name" in
  4602. armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
  4603. target_bigendian=yes
  4604. ;;
  4605. esac
  4606. target_softmmu="no"
  4607. target_user_only="no"
  4608. target_linux_user="no"
  4609. target_bsd_user="no"
  4610. case "$target" in
  4611. ${target_name}-softmmu)
  4612. target_softmmu="yes"
  4613. ;;
  4614. ${target_name}-linux-user)
  4615. if test "$linux" != "yes" ; then
  4616. error_exit "Target '$target' is only available on a Linux host"
  4617. fi
  4618. target_user_only="yes"
  4619. target_linux_user="yes"
  4620. ;;
  4621. ${target_name}-bsd-user)
  4622. if test "$bsd" != "yes" ; then
  4623. error_exit "Target '$target' is only available on a BSD host"
  4624. fi
  4625. target_user_only="yes"
  4626. target_bsd_user="yes"
  4627. ;;
  4628. *)
  4629. error_exit "Target '$target' not recognised"
  4630. exit 1
  4631. ;;
  4632. esac
  4633. mkdir -p $target_dir
  4634. echo "# Automatically generated by configure - do not modify" > $config_target_mak
  4635. bflt="no"
  4636. interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
  4637. gdb_xml_files=""
  4638. TARGET_ARCH="$target_name"
  4639. TARGET_BASE_ARCH=""
  4640. TARGET_ABI_DIR=""
  4641. case "$target_name" in
  4642. i386)
  4643. ;;
  4644. x86_64)
  4645. TARGET_BASE_ARCH=i386
  4646. ;;
  4647. alpha)
  4648. ;;
  4649. arm|armeb)
  4650. TARGET_ARCH=arm
  4651. bflt="yes"
  4652. gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  4653. ;;
  4654. aarch64)
  4655. TARGET_BASE_ARCH=arm
  4656. bflt="yes"
  4657. gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  4658. ;;
  4659. cris)
  4660. ;;
  4661. lm32)
  4662. ;;
  4663. m68k)
  4664. bflt="yes"
  4665. gdb_xml_files="cf-core.xml cf-fp.xml"
  4666. ;;
  4667. microblaze|microblazeel)
  4668. TARGET_ARCH=microblaze
  4669. bflt="yes"
  4670. ;;
  4671. mips|mipsel)
  4672. TARGET_ARCH=mips
  4673. echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
  4674. ;;
  4675. mipsn32|mipsn32el)
  4676. TARGET_ARCH=mips64
  4677. TARGET_BASE_ARCH=mips
  4678. echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
  4679. echo "TARGET_ABI32=y" >> $config_target_mak
  4680. ;;
  4681. mips64|mips64el)
  4682. TARGET_ARCH=mips64
  4683. TARGET_BASE_ARCH=mips
  4684. echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
  4685. ;;
  4686. tricore)
  4687. ;;
  4688. moxie)
  4689. ;;
  4690. or32)
  4691. TARGET_ARCH=openrisc
  4692. TARGET_BASE_ARCH=openrisc
  4693. ;;
  4694. ppc)
  4695. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4696. ;;
  4697. ppcemb)
  4698. TARGET_BASE_ARCH=ppc
  4699. TARGET_ABI_DIR=ppc
  4700. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4701. ;;
  4702. ppc64)
  4703. TARGET_BASE_ARCH=ppc
  4704. TARGET_ABI_DIR=ppc
  4705. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4706. ;;
  4707. ppc64le)
  4708. TARGET_ARCH=ppc64
  4709. TARGET_BASE_ARCH=ppc
  4710. TARGET_ABI_DIR=ppc
  4711. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4712. ;;
  4713. ppc64abi32)
  4714. TARGET_ARCH=ppc64
  4715. TARGET_BASE_ARCH=ppc
  4716. TARGET_ABI_DIR=ppc
  4717. echo "TARGET_ABI32=y" >> $config_target_mak
  4718. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  4719. ;;
  4720. sh4|sh4eb)
  4721. TARGET_ARCH=sh4
  4722. bflt="yes"
  4723. ;;
  4724. sparc)
  4725. ;;
  4726. sparc64)
  4727. TARGET_BASE_ARCH=sparc
  4728. ;;
  4729. sparc32plus)
  4730. TARGET_ARCH=sparc64
  4731. TARGET_BASE_ARCH=sparc
  4732. TARGET_ABI_DIR=sparc
  4733. echo "TARGET_ABI32=y" >> $config_target_mak
  4734. ;;
  4735. s390x)
  4736. gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml"
  4737. ;;
  4738. unicore32)
  4739. ;;
  4740. xtensa|xtensaeb)
  4741. TARGET_ARCH=xtensa
  4742. ;;
  4743. *)
  4744. error_exit "Unsupported target CPU"
  4745. ;;
  4746. esac
  4747. # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
  4748. if [ "$TARGET_BASE_ARCH" = "" ]; then
  4749. TARGET_BASE_ARCH=$TARGET_ARCH
  4750. fi
  4751. symlink "$source_path/Makefile.target" "$target_dir/Makefile"
  4752. upper() {
  4753. echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
  4754. }
  4755. target_arch_name="`upper $TARGET_ARCH`"
  4756. echo "TARGET_$target_arch_name=y" >> $config_target_mak
  4757. echo "TARGET_NAME=$target_name" >> $config_target_mak
  4758. echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
  4759. if [ "$TARGET_ABI_DIR" = "" ]; then
  4760. TARGET_ABI_DIR=$TARGET_ARCH
  4761. fi
  4762. echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
  4763. if [ "$HOST_VARIANT_DIR" != "" ]; then
  4764. echo "HOST_VARIANT_DIR=$HOST_VARIANT_DIR" >> $config_target_mak
  4765. fi
  4766. case "$target_name" in
  4767. i386|x86_64)
  4768. if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
  4769. echo "CONFIG_XEN=y" >> $config_target_mak
  4770. if test "$xen_pci_passthrough" = yes; then
  4771. echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
  4772. fi
  4773. fi
  4774. ;;
  4775. *)
  4776. esac
  4777. case "$target_name" in
  4778. aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x|mipsel|mips)
  4779. # Make sure the target and host cpus are compatible
  4780. if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
  4781. \( "$target_name" = "$cpu" -o \
  4782. \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
  4783. \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
  4784. \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
  4785. \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
  4786. \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \
  4787. \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
  4788. \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
  4789. echo "CONFIG_KVM=y" >> $config_target_mak
  4790. if test "$vhost_net" = "yes" ; then
  4791. echo "CONFIG_VHOST_NET=y" >> $config_target_mak
  4792. fi
  4793. fi
  4794. esac
  4795. if test "$target_bigendian" = "yes" ; then
  4796. echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
  4797. fi
  4798. if test "$target_softmmu" = "yes" ; then
  4799. echo "CONFIG_SOFTMMU=y" >> $config_target_mak
  4800. fi
  4801. if test "$target_user_only" = "yes" ; then
  4802. echo "CONFIG_USER_ONLY=y" >> $config_target_mak
  4803. echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
  4804. fi
  4805. if test "$target_linux_user" = "yes" ; then
  4806. echo "CONFIG_LINUX_USER=y" >> $config_target_mak
  4807. fi
  4808. list=""
  4809. if test ! -z "$gdb_xml_files" ; then
  4810. for x in $gdb_xml_files; do
  4811. list="$list $source_path/gdb-xml/$x"
  4812. done
  4813. echo "TARGET_XML_FILES=$list" >> $config_target_mak
  4814. fi
  4815. if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
  4816. echo "TARGET_HAS_BFLT=y" >> $config_target_mak
  4817. fi
  4818. if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
  4819. echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
  4820. fi
  4821. if test "$target_bsd_user" = "yes" ; then
  4822. echo "CONFIG_BSD_USER=y" >> $config_target_mak
  4823. fi
  4824. # generate QEMU_CFLAGS/LDFLAGS for targets
  4825. cflags=""
  4826. ldflags=""
  4827. for i in $ARCH $TARGET_BASE_ARCH ; do
  4828. case "$i" in
  4829. alpha)
  4830. echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
  4831. echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
  4832. ;;
  4833. aarch64)
  4834. if test -n "${cxx}"; then
  4835. echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
  4836. echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
  4837. fi
  4838. ;;
  4839. arm)
  4840. echo "CONFIG_ARM_DIS=y" >> $config_target_mak
  4841. echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
  4842. if test -n "${cxx}"; then
  4843. echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
  4844. echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
  4845. fi
  4846. ;;
  4847. cris)
  4848. echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
  4849. echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
  4850. ;;
  4851. hppa)
  4852. echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
  4853. echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
  4854. ;;
  4855. i386|x86_64|x32)
  4856. echo "CONFIG_I386_DIS=y" >> $config_target_mak
  4857. echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
  4858. ;;
  4859. ia64*)
  4860. echo "CONFIG_IA64_DIS=y" >> $config_target_mak
  4861. echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
  4862. ;;
  4863. lm32)
  4864. echo "CONFIG_LM32_DIS=y" >> $config_target_mak
  4865. echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
  4866. ;;
  4867. m68k)
  4868. echo "CONFIG_M68K_DIS=y" >> $config_target_mak
  4869. echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
  4870. ;;
  4871. microblaze*)
  4872. echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
  4873. echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
  4874. ;;
  4875. mips*)
  4876. echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
  4877. echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
  4878. ;;
  4879. moxie*)
  4880. echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
  4881. echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
  4882. ;;
  4883. or32)
  4884. echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
  4885. echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
  4886. ;;
  4887. ppc*)
  4888. echo "CONFIG_PPC_DIS=y" >> $config_target_mak
  4889. echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
  4890. ;;
  4891. s390*)
  4892. echo "CONFIG_S390_DIS=y" >> $config_target_mak
  4893. echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
  4894. ;;
  4895. sh4)
  4896. echo "CONFIG_SH4_DIS=y" >> $config_target_mak
  4897. echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
  4898. ;;
  4899. sparc*)
  4900. echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
  4901. echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
  4902. ;;
  4903. xtensa*)
  4904. echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
  4905. echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
  4906. ;;
  4907. esac
  4908. done
  4909. if test "$tcg_interpreter" = "yes" ; then
  4910. echo "CONFIG_TCI_DIS=y" >> $config_target_mak
  4911. echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
  4912. fi
  4913. case "$ARCH" in
  4914. alpha)
  4915. # Ensure there's only a single GP
  4916. cflags="-msmall-data $cflags"
  4917. ;;
  4918. esac
  4919. if test "$gprof" = "yes" ; then
  4920. echo "TARGET_GPROF=yes" >> $config_target_mak
  4921. if test "$target_linux_user" = "yes" ; then
  4922. cflags="-p $cflags"
  4923. ldflags="-p $ldflags"
  4924. fi
  4925. if test "$target_softmmu" = "yes" ; then
  4926. ldflags="-p $ldflags"
  4927. echo "GPROF_CFLAGS=-p" >> $config_target_mak
  4928. fi
  4929. fi
  4930. if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
  4931. ldflags="$ldflags $textseg_ldflags"
  4932. fi
  4933. echo "LDFLAGS+=$ldflags" >> $config_target_mak
  4934. echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
  4935. done # for target in $targets
  4936. if [ "$pixman" = "internal" ]; then
  4937. echo "config-host.h: subdir-pixman" >> $config_host_mak
  4938. fi
  4939. if test "$rdma" = "yes" ; then
  4940. echo "CONFIG_RDMA=y" >> $config_host_mak
  4941. fi
  4942. if [ "$dtc_internal" = "yes" ]; then
  4943. echo "config-host.h: subdir-dtc" >> $config_host_mak
  4944. fi
  4945. if test "$numa" = "yes"; then
  4946. echo "CONFIG_NUMA=y" >> $config_host_mak
  4947. fi
  4948. # build tree in object directory in case the source is not in the current directory
  4949. DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
  4950. DIRS="$DIRS fsdev"
  4951. DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
  4952. DIRS="$DIRS roms/seabios roms/vgabios"
  4953. DIRS="$DIRS qapi-generated"
  4954. FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
  4955. FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
  4956. FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
  4957. FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
  4958. FILES="$FILES pc-bios/spapr-rtas/Makefile"
  4959. FILES="$FILES pc-bios/s390-ccw/Makefile"
  4960. FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
  4961. FILES="$FILES pc-bios/qemu-icon.bmp"
  4962. for bios_file in \
  4963. $source_path/pc-bios/*.bin \
  4964. $source_path/pc-bios/*.aml \
  4965. $source_path/pc-bios/*.rom \
  4966. $source_path/pc-bios/*.dtb \
  4967. $source_path/pc-bios/*.img \
  4968. $source_path/pc-bios/openbios-* \
  4969. $source_path/pc-bios/u-boot.* \
  4970. $source_path/pc-bios/palcode-*
  4971. do
  4972. FILES="$FILES pc-bios/`basename $bios_file`"
  4973. done
  4974. for test_file in `find $source_path/tests/acpi-test-data -type f`
  4975. do
  4976. FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
  4977. done
  4978. mkdir -p $DIRS
  4979. for f in $FILES ; do
  4980. if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
  4981. symlink "$source_path/$f" "$f"
  4982. fi
  4983. done
  4984. # temporary config to build submodules
  4985. for rom in seabios vgabios ; do
  4986. config_mak=roms/$rom/config.mak
  4987. echo "# Automatically generated by configure - do not modify" > $config_mak
  4988. echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
  4989. echo "AS=$as" >> $config_mak
  4990. echo "CC=$cc" >> $config_mak
  4991. echo "BCC=bcc" >> $config_mak
  4992. echo "CPP=$cpp" >> $config_mak
  4993. echo "OBJCOPY=objcopy" >> $config_mak
  4994. echo "IASL=$iasl" >> $config_mak
  4995. echo "LD=$ld" >> $config_mak
  4996. done
  4997. # set up qemu-iotests in this build directory
  4998. iotests_common_env="tests/qemu-iotests/common.env"
  4999. iotests_check="tests/qemu-iotests/check"
  5000. echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
  5001. echo >> "$iotests_common_env"
  5002. echo "export PYTHON='$python'" >> "$iotests_common_env"
  5003. if [ ! -e "$iotests_check" ]; then
  5004. symlink "$source_path/$iotests_check" "$iotests_check"
  5005. fi
  5006. # Save the configure command line for later reuse.
  5007. cat <<EOD >config.status
  5008. #!/bin/sh
  5009. # Generated by configure.
  5010. # Run this file to recreate the current configuration.
  5011. # Compiler output produced by configure, useful for debugging
  5012. # configure, is in config.log if it exists.
  5013. EOD
  5014. printf "exec" >>config.status
  5015. printf " '%s'" "$0" "$@" >>config.status
  5016. echo >>config.status
  5017. chmod +x config.status
  5018. rm -r "$TMPDIR1"