configure 101 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023
  1. #!/bin/sh
  2. #
  3. # qemu configure script (c) 2003 Fabrice Bellard
  4. #
  5. # set temporary file name
  6. if test ! -z "$TMPDIR" ; then
  7. TMPDIR1="${TMPDIR}"
  8. elif test ! -z "$TEMPDIR" ; then
  9. TMPDIR1="${TEMPDIR}"
  10. else
  11. TMPDIR1="/tmp"
  12. fi
  13. TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
  14. TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
  15. TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
  16. # NB: do not call "exit" in the trap handler; this is buggy with some shells;
  17. # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
  18. trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
  19. rm -f config.log
  20. # Print a helpful header at the top of config.log
  21. echo "# QEMU configure log $(date)" >> config.log
  22. printf "# Configured with:" >> config.log
  23. printf " '%s'" "$0" "$@" >> config.log
  24. echo >> config.log
  25. echo "#" >> config.log
  26. compile_object() {
  27. echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
  28. $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
  29. }
  30. compile_prog() {
  31. local_cflags="$1"
  32. local_ldflags="$2"
  33. echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
  34. $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
  35. }
  36. # symbolically link $1 to $2. Portable version of "ln -sf".
  37. symlink() {
  38. rm -rf "$2"
  39. ln -s "$1" "$2"
  40. }
  41. # check whether a command is available to this shell (may be either an
  42. # executable or a builtin)
  43. has() {
  44. type "$1" >/dev/null 2>&1
  45. }
  46. # search for an executable in PATH
  47. path_of() {
  48. local_command="$1"
  49. local_ifs="$IFS"
  50. local_dir=""
  51. # pathname has a dir component?
  52. if [ "${local_command#*/}" != "$local_command" ]; then
  53. if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
  54. echo "$local_command"
  55. return 0
  56. fi
  57. fi
  58. if [ -z "$local_command" ]; then
  59. return 1
  60. fi
  61. IFS=:
  62. for local_dir in $PATH; do
  63. if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
  64. echo "$local_dir/$local_command"
  65. IFS="${local_ifs:-$(printf ' \t\n')}"
  66. return 0
  67. fi
  68. done
  69. # not found
  70. IFS="${local_ifs:-$(printf ' \t\n')}"
  71. return 1
  72. }
  73. # default parameters
  74. source_path=`dirname "$0"`
  75. cpu=""
  76. interp_prefix="/usr/gnemul/qemu-%M"
  77. static="no"
  78. sparc_cpu=""
  79. cross_prefix=""
  80. audio_drv_list=""
  81. audio_card_list="ac97 es1370 sb16 hda"
  82. audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
  83. block_drv_whitelist=""
  84. host_cc="gcc"
  85. helper_cflags=""
  86. libs_softmmu=""
  87. libs_tools=""
  88. audio_pt_int=""
  89. audio_win_int=""
  90. cc_i386=i386-pc-linux-gnu-gcc
  91. libs_qga=""
  92. debug_info="yes"
  93. target_list=""
  94. # Default value for a variable defining feature "foo".
  95. # * foo="no" feature will only be used if --enable-foo arg is given
  96. # * foo="" feature will be searched for, and if found, will be used
  97. # unless --disable-foo is given
  98. # * foo="yes" this value will only be set by --enable-foo flag.
  99. # feature will searched for,
  100. # if not found, configure exits with error
  101. #
  102. # Always add --enable-foo and --disable-foo command line args.
  103. # Distributions want to ensure that several features are compiled in, and it
  104. # is impossible without a --enable-foo that exits if a feature is not found.
  105. bluez=""
  106. brlapi=""
  107. curl=""
  108. curses=""
  109. docs=""
  110. fdt=""
  111. nptl=""
  112. sdl=""
  113. virtfs=""
  114. vnc="yes"
  115. sparse="no"
  116. uuid=""
  117. vde=""
  118. vnc_tls=""
  119. vnc_sasl=""
  120. vnc_jpeg=""
  121. vnc_png=""
  122. vnc_thread="no"
  123. xen=""
  124. xen_ctrl_version=""
  125. linux_aio=""
  126. cap_ng=""
  127. attr=""
  128. libattr=""
  129. xfs=""
  130. vhost_net="no"
  131. kvm="no"
  132. gprof="no"
  133. debug_tcg="no"
  134. debug_mon="no"
  135. debug="no"
  136. strip_opt="yes"
  137. tcg_interpreter="no"
  138. bigendian="no"
  139. mingw32="no"
  140. EXESUF=""
  141. prefix="/usr/local"
  142. mandir="\${prefix}/share/man"
  143. datadir="\${prefix}/share"
  144. qemu_docdir="\${prefix}/share/doc/qemu"
  145. bindir="\${prefix}/bin"
  146. libdir="\${prefix}/lib"
  147. includedir="\${prefix}/include"
  148. sysconfdir="\${prefix}/etc"
  149. confsuffix="/qemu"
  150. slirp="yes"
  151. fmod_lib=""
  152. fmod_inc=""
  153. oss_lib=""
  154. bsd="no"
  155. linux="no"
  156. solaris="no"
  157. profiler="no"
  158. cocoa="no"
  159. softmmu="yes"
  160. linux_user="no"
  161. bsd_user="no"
  162. guest_base=""
  163. uname_release=""
  164. mixemu="no"
  165. aix="no"
  166. blobs="yes"
  167. pkgversion=""
  168. pie=""
  169. zero_malloc=""
  170. trace_backend="nop"
  171. trace_file="trace"
  172. spice=""
  173. rbd=""
  174. smartcard=""
  175. smartcard_nss=""
  176. usb_redir=""
  177. opengl=""
  178. zlib="yes"
  179. guest_agent="yes"
  180. libiscsi=""
  181. coroutine=""
  182. # parse CC options first
  183. for opt do
  184. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  185. case "$opt" in
  186. --cross-prefix=*) cross_prefix="$optarg"
  187. ;;
  188. --cc=*) CC="$optarg"
  189. ;;
  190. --source-path=*) source_path="$optarg"
  191. ;;
  192. --cpu=*) cpu="$optarg"
  193. ;;
  194. --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
  195. ;;
  196. --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
  197. ;;
  198. --enable-debug-info) debug_info="yes"
  199. ;;
  200. --disable-debug-info) debug_info="no"
  201. ;;
  202. --sparc_cpu=*)
  203. sparc_cpu="$optarg"
  204. case $sparc_cpu in
  205. v7|v8|v8plus|v8plusa)
  206. cpu="sparc"
  207. ;;
  208. v9)
  209. cpu="sparc64"
  210. ;;
  211. *)
  212. echo "undefined SPARC architecture. Exiting";
  213. exit 1
  214. ;;
  215. esac
  216. ;;
  217. esac
  218. done
  219. # OS specific
  220. # Using uname is really, really broken. Once we have the right set of checks
  221. # we can eliminate its usage altogether.
  222. cc="${CC-${cross_prefix}gcc}"
  223. ar="${AR-${cross_prefix}ar}"
  224. objcopy="${OBJCOPY-${cross_prefix}objcopy}"
  225. ld="${LD-${cross_prefix}ld}"
  226. libtool="${LIBTOOL-${cross_prefix}libtool}"
  227. strip="${STRIP-${cross_prefix}strip}"
  228. windres="${WINDRES-${cross_prefix}windres}"
  229. pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
  230. query_pkg_config() {
  231. "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
  232. }
  233. pkg_config=query_pkg_config
  234. sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
  235. # default flags for all hosts
  236. QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
  237. QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
  238. QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
  239. QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
  240. QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
  241. QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
  242. if test "$debug_info" = "yes"; then
  243. CFLAGS="-g $CFLAGS"
  244. LDFLAGS="-g $LDFLAGS"
  245. fi
  246. # make source path absolute
  247. source_path=`cd "$source_path"; pwd`
  248. check_define() {
  249. cat > $TMPC <<EOF
  250. #if !defined($1)
  251. #error $1 not defined
  252. #endif
  253. int main(void) { return 0; }
  254. EOF
  255. compile_object
  256. }
  257. if check_define __linux__ ; then
  258. targetos="Linux"
  259. elif check_define _WIN32 ; then
  260. targetos='MINGW32'
  261. elif check_define __OpenBSD__ ; then
  262. targetos='OpenBSD'
  263. elif check_define __sun__ ; then
  264. targetos='SunOS'
  265. elif check_define __HAIKU__ ; then
  266. targetos='Haiku'
  267. else
  268. targetos=`uname -s`
  269. fi
  270. # Some host OSes need non-standard checks for which CPU to use.
  271. # Note that these checks are broken for cross-compilation: if you're
  272. # cross-compiling to one of these OSes then you'll need to specify
  273. # the correct CPU with the --cpu option.
  274. case $targetos in
  275. Darwin)
  276. # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
  277. # run 64-bit userspace code.
  278. # If the user didn't specify a CPU explicitly and the kernel says this is
  279. # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
  280. if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
  281. cpu="x86_64"
  282. fi
  283. ;;
  284. SunOS)
  285. # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
  286. if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
  287. cpu="x86_64"
  288. fi
  289. esac
  290. if test ! -z "$cpu" ; then
  291. # command line argument
  292. :
  293. elif check_define __i386__ ; then
  294. cpu="i386"
  295. elif check_define __x86_64__ ; then
  296. cpu="x86_64"
  297. elif check_define __sparc__ ; then
  298. # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
  299. # They must be specified using --sparc_cpu
  300. if check_define __arch64__ ; then
  301. cpu="sparc64"
  302. else
  303. cpu="sparc"
  304. fi
  305. elif check_define _ARCH_PPC ; then
  306. if check_define _ARCH_PPC64 ; then
  307. cpu="ppc64"
  308. else
  309. cpu="ppc"
  310. fi
  311. elif check_define __mips__ ; then
  312. cpu="mips"
  313. elif check_define __ia64__ ; then
  314. cpu="ia64"
  315. elif check_define __s390__ ; then
  316. if check_define __s390x__ ; then
  317. cpu="s390x"
  318. else
  319. cpu="s390"
  320. fi
  321. elif check_define __arm__ ; then
  322. cpu="arm"
  323. elif check_define __hppa__ ; then
  324. cpu="hppa"
  325. else
  326. cpu=`uname -m`
  327. fi
  328. ARCH=
  329. # Normalise host CPU name and set ARCH.
  330. # Note that this case should only have supported host CPUs, not guests.
  331. case "$cpu" in
  332. ia64|ppc|ppc64|s390|s390x|sparc64)
  333. cpu="$cpu"
  334. ;;
  335. i386|i486|i586|i686|i86pc|BePC)
  336. cpu="i386"
  337. ;;
  338. x86_64|amd64)
  339. cpu="x86_64"
  340. ;;
  341. armv*b|armv*l|arm)
  342. cpu="arm"
  343. ;;
  344. hppa|parisc|parisc64)
  345. cpu="hppa"
  346. ;;
  347. mips*)
  348. cpu="mips"
  349. ;;
  350. sparc|sun4[cdmuv])
  351. cpu="sparc"
  352. ;;
  353. *)
  354. # This will result in either an error or falling back to TCI later
  355. ARCH=unknown
  356. ;;
  357. esac
  358. if test -z "$ARCH"; then
  359. ARCH="$cpu"
  360. fi
  361. # OS specific
  362. case $targetos in
  363. CYGWIN*)
  364. mingw32="yes"
  365. QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
  366. audio_possible_drivers="winwave sdl"
  367. audio_drv_list="winwave"
  368. ;;
  369. MINGW32*)
  370. mingw32="yes"
  371. audio_possible_drivers="winwave dsound sdl fmod"
  372. audio_drv_list="winwave"
  373. ;;
  374. GNU/kFreeBSD)
  375. bsd="yes"
  376. audio_drv_list="oss"
  377. audio_possible_drivers="oss sdl esd pa"
  378. ;;
  379. FreeBSD)
  380. bsd="yes"
  381. make="${MAKE-gmake}"
  382. audio_drv_list="oss"
  383. audio_possible_drivers="oss sdl esd pa"
  384. # needed for kinfo_getvmmap(3) in libutil.h
  385. LIBS="-lutil $LIBS"
  386. ;;
  387. DragonFly)
  388. bsd="yes"
  389. make="${MAKE-gmake}"
  390. audio_drv_list="oss"
  391. audio_possible_drivers="oss sdl esd pa"
  392. ;;
  393. NetBSD)
  394. bsd="yes"
  395. make="${MAKE-gmake}"
  396. audio_drv_list="oss"
  397. audio_possible_drivers="oss sdl esd"
  398. oss_lib="-lossaudio"
  399. ;;
  400. OpenBSD)
  401. bsd="yes"
  402. make="${MAKE-gmake}"
  403. audio_drv_list="oss"
  404. audio_possible_drivers="oss sdl esd"
  405. oss_lib="-lossaudio"
  406. ;;
  407. Darwin)
  408. bsd="yes"
  409. darwin="yes"
  410. if [ "$cpu" = "x86_64" ] ; then
  411. QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
  412. LDFLAGS="-arch x86_64 $LDFLAGS"
  413. else
  414. QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
  415. fi
  416. cocoa="yes"
  417. audio_drv_list="coreaudio"
  418. audio_possible_drivers="coreaudio sdl fmod"
  419. LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
  420. libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
  421. ;;
  422. SunOS)
  423. solaris="yes"
  424. make="${MAKE-gmake}"
  425. install="${INSTALL-ginstall}"
  426. ld="gld"
  427. smbd="${SMBD-/usr/sfw/sbin/smbd}"
  428. needs_libsunmath="no"
  429. solarisrev=`uname -r | cut -f2 -d.`
  430. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  431. if test "$solarisrev" -le 9 ; then
  432. if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
  433. needs_libsunmath="yes"
  434. QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
  435. LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
  436. LIBS="-lsunmath $LIBS"
  437. else
  438. echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
  439. echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
  440. echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
  441. echo "Studio 11 can be downloaded from www.sun.com."
  442. exit 1
  443. fi
  444. fi
  445. fi
  446. if test -f /usr/include/sys/soundcard.h ; then
  447. audio_drv_list="oss"
  448. fi
  449. audio_possible_drivers="oss sdl"
  450. # needed for CMSG_ macros in sys/socket.h
  451. QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
  452. # needed for TIOCWIN* defines in termios.h
  453. QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
  454. QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
  455. solarisnetlibs="-lsocket -lnsl -lresolv"
  456. LIBS="$solarisnetlibs $LIBS"
  457. libs_qga="$solarisnetlibs $libs_qga"
  458. ;;
  459. AIX)
  460. aix="yes"
  461. make="${MAKE-gmake}"
  462. ;;
  463. Haiku)
  464. haiku="yes"
  465. QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
  466. LIBS="-lposix_error_mapper -lnetwork $LIBS"
  467. ;;
  468. *)
  469. audio_drv_list="oss"
  470. audio_possible_drivers="oss alsa sdl esd pa"
  471. linux="yes"
  472. linux_user="yes"
  473. usb="linux"
  474. kvm="yes"
  475. vhost_net="yes"
  476. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  477. audio_possible_drivers="$audio_possible_drivers fmod"
  478. fi
  479. ;;
  480. esac
  481. if [ "$bsd" = "yes" ] ; then
  482. if [ "$darwin" != "yes" ] ; then
  483. usb="bsd"
  484. bsd_user="yes"
  485. fi
  486. fi
  487. : ${make=${MAKE-make}}
  488. : ${install=${INSTALL-install}}
  489. : ${python=${PYTHON-python}}
  490. : ${smbd=${SMBD-/usr/sbin/smbd}}
  491. if test "$mingw32" = "yes" ; then
  492. EXESUF=".exe"
  493. QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
  494. # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
  495. QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
  496. LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
  497. cat > $TMPC << EOF
  498. int main(void) { return 0; }
  499. EOF
  500. if compile_prog "" "-liberty" ; then
  501. LIBS="-liberty $LIBS"
  502. fi
  503. prefix="c:/Program Files/QEMU"
  504. mandir="\${prefix}"
  505. datadir="\${prefix}"
  506. qemu_docdir="\${prefix}"
  507. bindir="\${prefix}"
  508. sysconfdir="\${prefix}"
  509. confsuffix=""
  510. libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
  511. fi
  512. werror=""
  513. for opt do
  514. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  515. case "$opt" in
  516. --help|-h) show_help=yes
  517. ;;
  518. --version|-V) exec cat $source_path/VERSION
  519. ;;
  520. --prefix=*) prefix="$optarg"
  521. ;;
  522. --interp-prefix=*) interp_prefix="$optarg"
  523. ;;
  524. --source-path=*)
  525. ;;
  526. --cross-prefix=*)
  527. ;;
  528. --cc=*)
  529. ;;
  530. --host-cc=*) host_cc="$optarg"
  531. ;;
  532. --make=*) make="$optarg"
  533. ;;
  534. --install=*) install="$optarg"
  535. ;;
  536. --python=*) python="$optarg"
  537. ;;
  538. --smbd=*) smbd="$optarg"
  539. ;;
  540. --extra-cflags=*)
  541. ;;
  542. --extra-ldflags=*)
  543. ;;
  544. --enable-debug-info)
  545. ;;
  546. --disable-debug-info)
  547. ;;
  548. --cpu=*)
  549. ;;
  550. --target-list=*) target_list="$optarg"
  551. ;;
  552. --enable-trace-backend=*) trace_backend="$optarg"
  553. ;;
  554. --with-trace-file=*) trace_file="$optarg"
  555. ;;
  556. --enable-gprof) gprof="yes"
  557. ;;
  558. --static)
  559. static="yes"
  560. LDFLAGS="-static $LDFLAGS"
  561. QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
  562. ;;
  563. --mandir=*) mandir="$optarg"
  564. ;;
  565. --bindir=*) bindir="$optarg"
  566. ;;
  567. --libdir=*) libdir="$optarg"
  568. ;;
  569. --includedir=*) includedir="$optarg"
  570. ;;
  571. --datadir=*) datadir="$optarg"
  572. ;;
  573. --with-confsuffix=*) confsuffix="$optarg"
  574. ;;
  575. --docdir=*) qemu_docdir="$optarg"
  576. ;;
  577. --sysconfdir=*) sysconfdir="$optarg"
  578. ;;
  579. --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
  580. --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
  581. --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
  582. # These switches are silently ignored, for compatibility with
  583. # autoconf-generated configure scripts. This allows QEMU's
  584. # configure to be used by RPM and similar macros that set
  585. # lots of directory switches by default.
  586. ;;
  587. --disable-sdl) sdl="no"
  588. ;;
  589. --enable-sdl) sdl="yes"
  590. ;;
  591. --disable-virtfs) virtfs="no"
  592. ;;
  593. --enable-virtfs) virtfs="yes"
  594. ;;
  595. --disable-vnc) vnc="no"
  596. ;;
  597. --enable-vnc) vnc="yes"
  598. ;;
  599. --fmod-lib=*) fmod_lib="$optarg"
  600. ;;
  601. --fmod-inc=*) fmod_inc="$optarg"
  602. ;;
  603. --oss-lib=*) oss_lib="$optarg"
  604. ;;
  605. --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
  606. ;;
  607. --audio-drv-list=*) audio_drv_list="$optarg"
  608. ;;
  609. --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
  610. ;;
  611. --enable-debug-tcg) debug_tcg="yes"
  612. ;;
  613. --disable-debug-tcg) debug_tcg="no"
  614. ;;
  615. --enable-debug-mon) debug_mon="yes"
  616. ;;
  617. --disable-debug-mon) debug_mon="no"
  618. ;;
  619. --enable-debug)
  620. # Enable debugging options that aren't excessively noisy
  621. debug_tcg="yes"
  622. debug_mon="yes"
  623. debug="yes"
  624. strip_opt="no"
  625. ;;
  626. --enable-sparse) sparse="yes"
  627. ;;
  628. --disable-sparse) sparse="no"
  629. ;;
  630. --disable-strip) strip_opt="no"
  631. ;;
  632. --disable-vnc-tls) vnc_tls="no"
  633. ;;
  634. --enable-vnc-tls) vnc_tls="yes"
  635. ;;
  636. --disable-vnc-sasl) vnc_sasl="no"
  637. ;;
  638. --enable-vnc-sasl) vnc_sasl="yes"
  639. ;;
  640. --disable-vnc-jpeg) vnc_jpeg="no"
  641. ;;
  642. --enable-vnc-jpeg) vnc_jpeg="yes"
  643. ;;
  644. --disable-vnc-png) vnc_png="no"
  645. ;;
  646. --enable-vnc-png) vnc_png="yes"
  647. ;;
  648. --disable-vnc-thread) vnc_thread="no"
  649. ;;
  650. --enable-vnc-thread) vnc_thread="yes"
  651. ;;
  652. --disable-slirp) slirp="no"
  653. ;;
  654. --disable-uuid) uuid="no"
  655. ;;
  656. --enable-uuid) uuid="yes"
  657. ;;
  658. --disable-vde) vde="no"
  659. ;;
  660. --enable-vde) vde="yes"
  661. ;;
  662. --disable-xen) xen="no"
  663. ;;
  664. --enable-xen) xen="yes"
  665. ;;
  666. --disable-brlapi) brlapi="no"
  667. ;;
  668. --enable-brlapi) brlapi="yes"
  669. ;;
  670. --disable-bluez) bluez="no"
  671. ;;
  672. --enable-bluez) bluez="yes"
  673. ;;
  674. --disable-kvm) kvm="no"
  675. ;;
  676. --enable-kvm) kvm="yes"
  677. ;;
  678. --disable-tcg-interpreter) tcg_interpreter="no"
  679. ;;
  680. --enable-tcg-interpreter) tcg_interpreter="yes"
  681. ;;
  682. --disable-cap-ng) cap_ng="no"
  683. ;;
  684. --enable-cap-ng) cap_ng="yes"
  685. ;;
  686. --disable-spice) spice="no"
  687. ;;
  688. --enable-spice) spice="yes"
  689. ;;
  690. --disable-libiscsi) libiscsi="no"
  691. ;;
  692. --enable-libiscsi) libiscsi="yes"
  693. ;;
  694. --enable-profiler) profiler="yes"
  695. ;;
  696. --disable-cocoa) cocoa="no"
  697. ;;
  698. --enable-cocoa)
  699. cocoa="yes" ;
  700. sdl="no" ;
  701. audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
  702. ;;
  703. --disable-system) softmmu="no"
  704. ;;
  705. --enable-system) softmmu="yes"
  706. ;;
  707. --disable-user)
  708. linux_user="no" ;
  709. bsd_user="no" ;
  710. ;;
  711. --enable-user) ;;
  712. --disable-linux-user) linux_user="no"
  713. ;;
  714. --enable-linux-user) linux_user="yes"
  715. ;;
  716. --disable-bsd-user) bsd_user="no"
  717. ;;
  718. --enable-bsd-user) bsd_user="yes"
  719. ;;
  720. --enable-guest-base) guest_base="yes"
  721. ;;
  722. --disable-guest-base) guest_base="no"
  723. ;;
  724. --enable-pie) pie="yes"
  725. ;;
  726. --disable-pie) pie="no"
  727. ;;
  728. --enable-uname-release=*) uname_release="$optarg"
  729. ;;
  730. --sparc_cpu=*)
  731. ;;
  732. --enable-werror) werror="yes"
  733. ;;
  734. --disable-werror) werror="no"
  735. ;;
  736. --disable-curses) curses="no"
  737. ;;
  738. --enable-curses) curses="yes"
  739. ;;
  740. --disable-curl) curl="no"
  741. ;;
  742. --enable-curl) curl="yes"
  743. ;;
  744. --disable-fdt) fdt="no"
  745. ;;
  746. --enable-fdt) fdt="yes"
  747. ;;
  748. --disable-nptl) nptl="no"
  749. ;;
  750. --enable-nptl) nptl="yes"
  751. ;;
  752. --enable-mixemu) mixemu="yes"
  753. ;;
  754. --disable-linux-aio) linux_aio="no"
  755. ;;
  756. --enable-linux-aio) linux_aio="yes"
  757. ;;
  758. --disable-attr) attr="no"
  759. ;;
  760. --enable-attr) attr="yes"
  761. ;;
  762. --disable-blobs) blobs="no"
  763. ;;
  764. --with-pkgversion=*) pkgversion=" ($optarg)"
  765. ;;
  766. --with-coroutine=*) coroutine="$optarg"
  767. ;;
  768. --disable-docs) docs="no"
  769. ;;
  770. --enable-docs) docs="yes"
  771. ;;
  772. --disable-vhost-net) vhost_net="no"
  773. ;;
  774. --enable-vhost-net) vhost_net="yes"
  775. ;;
  776. --disable-opengl) opengl="no"
  777. ;;
  778. --enable-opengl) opengl="yes"
  779. ;;
  780. --disable-rbd) rbd="no"
  781. ;;
  782. --enable-rbd) rbd="yes"
  783. ;;
  784. --disable-xfsctl) xfs="no"
  785. ;;
  786. --enable-xfsctl) xfs="yes"
  787. ;;
  788. --disable-smartcard) smartcard="no"
  789. ;;
  790. --enable-smartcard) smartcard="yes"
  791. ;;
  792. --disable-smartcard-nss) smartcard_nss="no"
  793. ;;
  794. --enable-smartcard-nss) smartcard_nss="yes"
  795. ;;
  796. --disable-usb-redir) usb_redir="no"
  797. ;;
  798. --enable-usb-redir) usb_redir="yes"
  799. ;;
  800. --disable-zlib-test) zlib="no"
  801. ;;
  802. --enable-guest-agent) guest_agent="yes"
  803. ;;
  804. --disable-guest-agent) guest_agent="no"
  805. ;;
  806. *) echo "ERROR: unknown option $opt"; show_help="yes"
  807. ;;
  808. esac
  809. done
  810. #
  811. # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
  812. # QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
  813. #
  814. host_guest_base="no"
  815. case "$cpu" in
  816. sparc) case $sparc_cpu in
  817. v7|v8)
  818. QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
  819. ;;
  820. v8plus|v8plusa)
  821. QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
  822. ;;
  823. *) # sparc_cpu not defined in the command line
  824. QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
  825. esac
  826. LDFLAGS="-m32 $LDFLAGS"
  827. QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
  828. if test "$solaris" = "no" ; then
  829. QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
  830. helper_cflags="-ffixed-i0"
  831. fi
  832. ;;
  833. sparc64)
  834. QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
  835. LDFLAGS="-m64 $LDFLAGS"
  836. QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
  837. if test "$solaris" != "no" ; then
  838. QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
  839. fi
  840. ;;
  841. s390)
  842. QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
  843. LDFLAGS="-m31 $LDFLAGS"
  844. host_guest_base="yes"
  845. ;;
  846. s390x)
  847. QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
  848. LDFLAGS="-m64 $LDFLAGS"
  849. host_guest_base="yes"
  850. ;;
  851. i386)
  852. QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
  853. LDFLAGS="-m32 $LDFLAGS"
  854. cc_i386='$(CC) -m32'
  855. helper_cflags="-fomit-frame-pointer"
  856. host_guest_base="yes"
  857. ;;
  858. x86_64)
  859. QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
  860. LDFLAGS="-m64 $LDFLAGS"
  861. cc_i386='$(CC) -m32'
  862. host_guest_base="yes"
  863. ;;
  864. arm*)
  865. host_guest_base="yes"
  866. ;;
  867. ppc*)
  868. host_guest_base="yes"
  869. ;;
  870. mips*)
  871. host_guest_base="yes"
  872. ;;
  873. ia64*)
  874. host_guest_base="yes"
  875. ;;
  876. hppa*)
  877. host_guest_base="yes"
  878. ;;
  879. unicore32*)
  880. host_guest_base="yes"
  881. ;;
  882. esac
  883. [ -z "$guest_base" ] && guest_base="$host_guest_base"
  884. default_target_list=""
  885. # these targets are portable
  886. if [ "$softmmu" = "yes" ] ; then
  887. default_target_list="\
  888. i386-softmmu \
  889. x86_64-softmmu \
  890. alpha-softmmu \
  891. arm-softmmu \
  892. cris-softmmu \
  893. lm32-softmmu \
  894. m68k-softmmu \
  895. microblaze-softmmu \
  896. microblazeel-softmmu \
  897. mips-softmmu \
  898. mipsel-softmmu \
  899. mips64-softmmu \
  900. mips64el-softmmu \
  901. ppc-softmmu \
  902. ppcemb-softmmu \
  903. ppc64-softmmu \
  904. sh4-softmmu \
  905. sh4eb-softmmu \
  906. sparc-softmmu \
  907. sparc64-softmmu \
  908. s390x-softmmu \
  909. xtensa-softmmu \
  910. xtensaeb-softmmu \
  911. "
  912. fi
  913. # the following are Linux specific
  914. if [ "$linux_user" = "yes" ] ; then
  915. default_target_list="${default_target_list}\
  916. i386-linux-user \
  917. x86_64-linux-user \
  918. alpha-linux-user \
  919. arm-linux-user \
  920. armeb-linux-user \
  921. cris-linux-user \
  922. m68k-linux-user \
  923. microblaze-linux-user \
  924. microblazeel-linux-user \
  925. mips-linux-user \
  926. mipsel-linux-user \
  927. ppc-linux-user \
  928. ppc64-linux-user \
  929. ppc64abi32-linux-user \
  930. sh4-linux-user \
  931. sh4eb-linux-user \
  932. sparc-linux-user \
  933. sparc64-linux-user \
  934. sparc32plus-linux-user \
  935. unicore32-linux-user \
  936. s390x-linux-user \
  937. "
  938. fi
  939. # the following are BSD specific
  940. if [ "$bsd_user" = "yes" ] ; then
  941. default_target_list="${default_target_list}\
  942. i386-bsd-user \
  943. x86_64-bsd-user \
  944. sparc-bsd-user \
  945. sparc64-bsd-user \
  946. "
  947. fi
  948. if test x"$show_help" = x"yes" ; then
  949. cat << EOF
  950. Usage: configure [options]
  951. Options: [defaults in brackets after descriptions]
  952. EOF
  953. echo "Standard options:"
  954. echo " --help print this message"
  955. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  956. echo " --interp-prefix=PREFIX where to find shared libraries, etc."
  957. echo " use %M for cpu name [$interp_prefix]"
  958. echo " --target-list=LIST set target list (default: build everything)"
  959. echo "Available targets: $default_target_list" | \
  960. fold -s -w 53 | sed -e 's/^/ /'
  961. echo ""
  962. echo "Advanced options (experts only):"
  963. echo " --source-path=PATH path of source code [$source_path]"
  964. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  965. echo " --cc=CC use C compiler CC [$cc]"
  966. echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
  967. echo " build time"
  968. echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
  969. echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
  970. echo " --make=MAKE use specified make [$make]"
  971. echo " --install=INSTALL use specified install [$install]"
  972. echo " --python=PYTHON use specified python [$python]"
  973. echo " --smbd=SMBD use specified smbd [$smbd]"
  974. echo " --static enable static build [$static]"
  975. echo " --mandir=PATH install man pages in PATH"
  976. echo " --datadir=PATH install firmware in PATH$confsuffix"
  977. echo " --docdir=PATH install documentation in PATH$confsuffix"
  978. echo " --bindir=PATH install binaries in PATH"
  979. echo " --sysconfdir=PATH install config in PATH$confsuffix"
  980. echo " --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
  981. echo " --enable-debug-tcg enable TCG debugging"
  982. echo " --disable-debug-tcg disable TCG debugging (default)"
  983. echo " --enable-debug enable common debug build options"
  984. echo " --enable-sparse enable sparse checker"
  985. echo " --disable-sparse disable sparse checker (default)"
  986. echo " --disable-strip disable stripping binaries"
  987. echo " --disable-werror disable compilation abort on warning"
  988. echo " --disable-sdl disable SDL"
  989. echo " --enable-sdl enable SDL"
  990. echo " --disable-virtfs disable VirtFS"
  991. echo " --enable-virtfs enable VirtFS"
  992. echo " --disable-vnc disable VNC"
  993. echo " --enable-vnc enable VNC"
  994. echo " --disable-cocoa disable Cocoa (Mac OS X only)"
  995. echo " --enable-cocoa enable Cocoa (default on Mac OS X)"
  996. echo " --audio-drv-list=LIST set audio drivers list:"
  997. echo " Available drivers: $audio_possible_drivers"
  998. echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
  999. echo " Available cards: $audio_possible_cards"
  1000. echo " --block-drv-whitelist=L set block driver whitelist"
  1001. echo " (affects only QEMU, not qemu-img)"
  1002. echo " --enable-mixemu enable mixer emulation"
  1003. echo " --disable-xen disable xen backend driver support"
  1004. echo " --enable-xen enable xen backend driver support"
  1005. echo " --disable-brlapi disable BrlAPI"
  1006. echo " --enable-brlapi enable BrlAPI"
  1007. echo " --disable-vnc-tls disable TLS encryption for VNC server"
  1008. echo " --enable-vnc-tls enable TLS encryption for VNC server"
  1009. echo " --disable-vnc-sasl disable SASL encryption for VNC server"
  1010. echo " --enable-vnc-sasl enable SASL encryption for VNC server"
  1011. echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
  1012. echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
  1013. echo " --disable-vnc-png disable PNG compression for VNC server (default)"
  1014. echo " --enable-vnc-png enable PNG compression for VNC server"
  1015. echo " --disable-vnc-thread disable threaded VNC server"
  1016. echo " --enable-vnc-thread enable threaded VNC server"
  1017. echo " --disable-curses disable curses output"
  1018. echo " --enable-curses enable curses output"
  1019. echo " --disable-curl disable curl connectivity"
  1020. echo " --enable-curl enable curl connectivity"
  1021. echo " --disable-fdt disable fdt device tree"
  1022. echo " --enable-fdt enable fdt device tree"
  1023. echo " --disable-bluez disable bluez stack connectivity"
  1024. echo " --enable-bluez enable bluez stack connectivity"
  1025. echo " --disable-slirp disable SLIRP userspace network connectivity"
  1026. echo " --disable-kvm disable KVM acceleration support"
  1027. echo " --enable-kvm enable KVM acceleration support"
  1028. echo " --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
  1029. echo " --disable-nptl disable usermode NPTL support"
  1030. echo " --enable-nptl enable usermode NPTL support"
  1031. echo " --enable-system enable all system emulation targets"
  1032. echo " --disable-system disable all system emulation targets"
  1033. echo " --enable-user enable supported user emulation targets"
  1034. echo " --disable-user disable all user emulation targets"
  1035. echo " --enable-linux-user enable all linux usermode emulation targets"
  1036. echo " --disable-linux-user disable all linux usermode emulation targets"
  1037. echo " --enable-bsd-user enable all BSD usermode emulation targets"
  1038. echo " --disable-bsd-user disable all BSD usermode emulation targets"
  1039. echo " --enable-guest-base enable GUEST_BASE support for usermode"
  1040. echo " emulation targets"
  1041. echo " --disable-guest-base disable GUEST_BASE support"
  1042. echo " --enable-pie build Position Independent Executables"
  1043. echo " --disable-pie do not build Position Independent Executables"
  1044. echo " --fmod-lib path to FMOD library"
  1045. echo " --fmod-inc path to FMOD includes"
  1046. echo " --oss-lib path to OSS library"
  1047. echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
  1048. echo " --cpu=CPU Build for host CPU [$cpu]"
  1049. echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
  1050. echo " --disable-uuid disable uuid support"
  1051. echo " --enable-uuid enable uuid support"
  1052. echo " --disable-vde disable support for vde network"
  1053. echo " --enable-vde enable support for vde network"
  1054. echo " --disable-linux-aio disable Linux AIO support"
  1055. echo " --enable-linux-aio enable Linux AIO support"
  1056. echo " --disable-cap-ng disable libcap-ng support"
  1057. echo " --enable-cap-ng enable libcap-ng support"
  1058. echo " --disable-attr disables attr and xattr support"
  1059. echo " --enable-attr enable attr and xattr support"
  1060. echo " --disable-blobs disable installing provided firmware blobs"
  1061. echo " --enable-docs enable documentation build"
  1062. echo " --disable-docs disable documentation build"
  1063. echo " --disable-vhost-net disable vhost-net acceleration support"
  1064. echo " --enable-vhost-net enable vhost-net acceleration support"
  1065. echo " --enable-trace-backend=B Set trace backend"
  1066. echo " Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
  1067. echo " --with-trace-file=NAME Full PATH,NAME of file to store traces"
  1068. echo " Default:trace-<pid>"
  1069. echo " --disable-spice disable spice"
  1070. echo " --enable-spice enable spice"
  1071. echo " --enable-rbd enable building the rados block device (rbd)"
  1072. echo " --disable-libiscsi disable iscsi support"
  1073. echo " --enable-libiscsi enable iscsi support"
  1074. echo " --disable-smartcard disable smartcard support"
  1075. echo " --enable-smartcard enable smartcard support"
  1076. echo " --disable-smartcard-nss disable smartcard nss support"
  1077. echo " --enable-smartcard-nss enable smartcard nss support"
  1078. echo " --disable-usb-redir disable usb network redirection support"
  1079. echo " --enable-usb-redir enable usb network redirection support"
  1080. echo " --disable-guest-agent disable building of the QEMU Guest Agent"
  1081. echo " --enable-guest-agent enable building of the QEMU Guest Agent"
  1082. echo " --with-coroutine=BACKEND coroutine backend. Supported options:"
  1083. echo " gthread, ucontext, sigaltstack, windows"
  1084. echo ""
  1085. echo "NOTE: The object files are built at the place where configure is launched"
  1086. exit 1
  1087. fi
  1088. # Now we have handled --enable-tcg-interpreter and know we're not just
  1089. # printing the help message, bail out if the host CPU isn't supported.
  1090. if test "$ARCH" = "unknown"; then
  1091. if test "$tcg_interpreter" = "yes" ; then
  1092. echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
  1093. ARCH=tci
  1094. else
  1095. echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
  1096. exit 1
  1097. fi
  1098. fi
  1099. # check that the C compiler works.
  1100. cat > $TMPC <<EOF
  1101. int main(void) { return 0; }
  1102. EOF
  1103. if compile_object ; then
  1104. : C compiler works ok
  1105. else
  1106. echo "ERROR: \"$cc\" either does not exist or does not work"
  1107. exit 1
  1108. fi
  1109. gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
  1110. gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
  1111. gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
  1112. gcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
  1113. cat > $TMPC << EOF
  1114. int main(void) { return 0; }
  1115. EOF
  1116. for flag in $gcc_flags; do
  1117. if compile_prog "-Werror $flag" "" ; then
  1118. QEMU_CFLAGS="$QEMU_CFLAGS $flag"
  1119. fi
  1120. done
  1121. if test "$static" = "yes" ; then
  1122. if test "$pie" = "yes" ; then
  1123. echo "static and pie are mutually incompatible"
  1124. exit 1
  1125. else
  1126. pie="no"
  1127. fi
  1128. fi
  1129. if test "$pie" = ""; then
  1130. case "$cpu-$targetos" in
  1131. i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
  1132. ;;
  1133. *)
  1134. pie="no"
  1135. ;;
  1136. esac
  1137. fi
  1138. if test "$pie" != "no" ; then
  1139. cat > $TMPC << EOF
  1140. #ifdef __linux__
  1141. # define THREAD __thread
  1142. #else
  1143. # define THREAD
  1144. #endif
  1145. static THREAD int tls_var;
  1146. int main(void) { return tls_var; }
  1147. EOF
  1148. if compile_prog "-fPIE -DPIE" "-pie"; then
  1149. QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
  1150. LDFLAGS="-pie $LDFLAGS"
  1151. pie="yes"
  1152. if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
  1153. LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
  1154. fi
  1155. else
  1156. if test "$pie" = "yes"; then
  1157. echo "PIE not available due to missing toolchain support"
  1158. exit 1
  1159. else
  1160. echo "Disabling PIE due to missing toolchain support"
  1161. pie="no"
  1162. fi
  1163. fi
  1164. fi
  1165. #
  1166. # Solaris specific configure tool chain decisions
  1167. #
  1168. if test "$solaris" = "yes" ; then
  1169. if has $install; then
  1170. :
  1171. else
  1172. echo "Solaris install program not found. Use --install=/usr/ucb/install or"
  1173. echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
  1174. echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
  1175. exit 1
  1176. fi
  1177. if test "`path_of $install`" = "/usr/sbin/install" ; then
  1178. echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
  1179. echo "try ginstall from the GNU fileutils available from www.blastwave.org"
  1180. echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
  1181. exit 1
  1182. fi
  1183. if has ar; then
  1184. :
  1185. else
  1186. echo "Error: No path includes ar"
  1187. if test -f /usr/ccs/bin/ar ; then
  1188. echo "Add /usr/ccs/bin to your path and rerun configure"
  1189. fi
  1190. exit 1
  1191. fi
  1192. fi
  1193. if ! has $python; then
  1194. echo "Python not found. Use --python=/path/to/python"
  1195. exit 1
  1196. fi
  1197. # Note that if the Python conditional here evaluates True we will exit
  1198. # with status 1 which is a shell 'false' value.
  1199. if ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
  1200. echo "Cannot use '$python', Python 2.4 or later is required."
  1201. echo "Note that Python 3 or later is not yet supported."
  1202. echo "Use --python=/path/to/python to specify a supported Python."
  1203. exit 1
  1204. fi
  1205. if test -z "$target_list" ; then
  1206. target_list="$default_target_list"
  1207. else
  1208. target_list=`echo "$target_list" | sed -e 's/,/ /g'`
  1209. fi
  1210. if test -z "$target_list" ; then
  1211. echo "No targets enabled"
  1212. exit 1
  1213. fi
  1214. # see if system emulation was really requested
  1215. case " $target_list " in
  1216. *"-softmmu "*) softmmu=yes
  1217. ;;
  1218. *) softmmu=no
  1219. ;;
  1220. esac
  1221. feature_not_found() {
  1222. feature=$1
  1223. echo "ERROR"
  1224. echo "ERROR: User requested feature $feature"
  1225. echo "ERROR: configure was not able to find it"
  1226. echo "ERROR"
  1227. exit 1;
  1228. }
  1229. if test -z "$cross_prefix" ; then
  1230. # ---
  1231. # big/little endian test
  1232. cat > $TMPC << EOF
  1233. #include <inttypes.h>
  1234. int main(int argc, char ** argv){
  1235. volatile uint32_t i=0x01234567;
  1236. return (*((uint8_t*)(&i))) == 0x67;
  1237. }
  1238. EOF
  1239. if compile_prog "" "" ; then
  1240. $TMPE && bigendian="yes"
  1241. else
  1242. echo big/little test failed
  1243. fi
  1244. else
  1245. # if cross compiling, cannot launch a program, so make a static guess
  1246. case "$cpu" in
  1247. arm)
  1248. # ARM can be either way; ask the compiler which one we are
  1249. if check_define __ARMEB__; then
  1250. bigendian=yes
  1251. fi
  1252. ;;
  1253. hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
  1254. bigendian=yes
  1255. ;;
  1256. esac
  1257. fi
  1258. ##########################################
  1259. # NPTL probe
  1260. if test "$nptl" != "no" ; then
  1261. cat > $TMPC <<EOF
  1262. #include <sched.h>
  1263. #include <linux/futex.h>
  1264. int main(void) {
  1265. #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
  1266. #error bork
  1267. #endif
  1268. return 0;
  1269. }
  1270. EOF
  1271. if compile_object ; then
  1272. nptl=yes
  1273. else
  1274. if test "$nptl" = "yes" ; then
  1275. feature_not_found "nptl"
  1276. fi
  1277. nptl=no
  1278. fi
  1279. fi
  1280. ##########################################
  1281. # zlib check
  1282. if test "$zlib" != "no" ; then
  1283. cat > $TMPC << EOF
  1284. #include <zlib.h>
  1285. int main(void) { zlibVersion(); return 0; }
  1286. EOF
  1287. if compile_prog "" "-lz" ; then
  1288. :
  1289. else
  1290. echo
  1291. echo "Error: zlib check failed"
  1292. echo "Make sure to have the zlib libs and headers installed."
  1293. echo
  1294. exit 1
  1295. fi
  1296. fi
  1297. ##########################################
  1298. # xen probe
  1299. if test "$xen" != "no" ; then
  1300. xen_libs="-lxenstore -lxenctrl -lxenguest"
  1301. # First we test whether Xen headers and libraries are available.
  1302. # If no, we are done and there is no Xen support.
  1303. # If yes, more tests are run to detect the Xen version.
  1304. # Xen (any)
  1305. cat > $TMPC <<EOF
  1306. #include <xenctrl.h>
  1307. #include <xs.h>
  1308. int main(void) {
  1309. return 0;
  1310. }
  1311. EOF
  1312. if ! compile_prog "" "$xen_libs" ; then
  1313. # Xen not found
  1314. if test "$xen" = "yes" ; then
  1315. feature_not_found "xen"
  1316. fi
  1317. xen=no
  1318. # Xen unstable
  1319. elif (
  1320. cat > $TMPC <<EOF
  1321. #include <xenctrl.h>
  1322. #include <xs.h>
  1323. #include <stdint.h>
  1324. #include <xen/hvm/hvm_info_table.h>
  1325. #if !defined(HVM_MAX_VCPUS)
  1326. # error HVM_MAX_VCPUS not defined
  1327. #endif
  1328. int main(void) {
  1329. xc_interface *xc;
  1330. xs_daemon_open();
  1331. xc = xc_interface_open(0, 0, 0);
  1332. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1333. xc_gnttab_open(NULL, 0);
  1334. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  1335. xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
  1336. return 0;
  1337. }
  1338. EOF
  1339. compile_prog "" "$xen_libs"
  1340. ) ; then
  1341. xen_ctrl_version=420
  1342. xen=yes
  1343. elif (
  1344. cat > $TMPC <<EOF
  1345. #include <xenctrl.h>
  1346. #include <xs.h>
  1347. #include <stdint.h>
  1348. #include <xen/hvm/hvm_info_table.h>
  1349. #if !defined(HVM_MAX_VCPUS)
  1350. # error HVM_MAX_VCPUS not defined
  1351. #endif
  1352. int main(void) {
  1353. xc_interface *xc;
  1354. xs_daemon_open();
  1355. xc = xc_interface_open(0, 0, 0);
  1356. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1357. xc_gnttab_open(NULL, 0);
  1358. xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
  1359. return 0;
  1360. }
  1361. EOF
  1362. compile_prog "" "$xen_libs"
  1363. ) ; then
  1364. xen_ctrl_version=410
  1365. xen=yes
  1366. # Xen 4.0.0
  1367. elif (
  1368. cat > $TMPC <<EOF
  1369. #include <xenctrl.h>
  1370. #include <xs.h>
  1371. #include <stdint.h>
  1372. #include <xen/hvm/hvm_info_table.h>
  1373. #if !defined(HVM_MAX_VCPUS)
  1374. # error HVM_MAX_VCPUS not defined
  1375. #endif
  1376. int main(void) {
  1377. struct xen_add_to_physmap xatp = {
  1378. .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
  1379. };
  1380. xs_daemon_open();
  1381. xc_interface_open();
  1382. xc_gnttab_open();
  1383. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1384. xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
  1385. return 0;
  1386. }
  1387. EOF
  1388. compile_prog "" "$xen_libs"
  1389. ) ; then
  1390. xen_ctrl_version=400
  1391. xen=yes
  1392. # Xen 3.4.0
  1393. elif (
  1394. cat > $TMPC <<EOF
  1395. #include <xenctrl.h>
  1396. #include <xs.h>
  1397. int main(void) {
  1398. struct xen_add_to_physmap xatp = {
  1399. .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
  1400. };
  1401. xs_daemon_open();
  1402. xc_interface_open();
  1403. xc_gnttab_open();
  1404. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1405. xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
  1406. return 0;
  1407. }
  1408. EOF
  1409. compile_prog "" "$xen_libs"
  1410. ) ; then
  1411. xen_ctrl_version=340
  1412. xen=yes
  1413. # Xen 3.3.0
  1414. elif (
  1415. cat > $TMPC <<EOF
  1416. #include <xenctrl.h>
  1417. #include <xs.h>
  1418. int main(void) {
  1419. xs_daemon_open();
  1420. xc_interface_open();
  1421. xc_gnttab_open();
  1422. xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
  1423. return 0;
  1424. }
  1425. EOF
  1426. compile_prog "" "$xen_libs"
  1427. ) ; then
  1428. xen_ctrl_version=330
  1429. xen=yes
  1430. # Xen version unsupported
  1431. else
  1432. if test "$xen" = "yes" ; then
  1433. feature_not_found "xen (unsupported version)"
  1434. fi
  1435. xen=no
  1436. fi
  1437. if test "$xen" = yes; then
  1438. libs_softmmu="$xen_libs $libs_softmmu"
  1439. fi
  1440. fi
  1441. ##########################################
  1442. # pkg-config probe
  1443. if ! has "$pkg_config_exe"; then
  1444. echo "Error: pkg-config binary '$pkg_config_exe' not found"
  1445. exit 1
  1446. fi
  1447. ##########################################
  1448. # libtool probe
  1449. if ! has $libtool; then
  1450. libtool=
  1451. fi
  1452. ##########################################
  1453. # Sparse probe
  1454. if test "$sparse" != "no" ; then
  1455. if has cgcc; then
  1456. sparse=yes
  1457. else
  1458. if test "$sparse" = "yes" ; then
  1459. feature_not_found "sparse"
  1460. fi
  1461. sparse=no
  1462. fi
  1463. fi
  1464. ##########################################
  1465. # SDL probe
  1466. # Look for sdl configuration program (pkg-config or sdl-config). Try
  1467. # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
  1468. if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
  1469. sdl_config=sdl-config
  1470. fi
  1471. if $pkg_config sdl --modversion >/dev/null 2>&1; then
  1472. sdlconfig="$pkg_config sdl"
  1473. _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
  1474. elif has ${sdl_config}; then
  1475. sdlconfig="$sdl_config"
  1476. _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
  1477. else
  1478. if test "$sdl" = "yes" ; then
  1479. feature_not_found "sdl"
  1480. fi
  1481. sdl=no
  1482. fi
  1483. if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
  1484. echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
  1485. fi
  1486. sdl_too_old=no
  1487. if test "$sdl" != "no" ; then
  1488. cat > $TMPC << EOF
  1489. #include <SDL.h>
  1490. #undef main /* We don't want SDL to override our main() */
  1491. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  1492. EOF
  1493. sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
  1494. if test "$static" = "yes" ; then
  1495. sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
  1496. else
  1497. sdl_libs=`$sdlconfig --libs 2> /dev/null`
  1498. fi
  1499. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  1500. if test "$_sdlversion" -lt 121 ; then
  1501. sdl_too_old=yes
  1502. else
  1503. if test "$cocoa" = "no" ; then
  1504. sdl=yes
  1505. fi
  1506. fi
  1507. # static link with sdl ? (note: sdl.pc's --static --libs is broken)
  1508. if test "$sdl" = "yes" -a "$static" = "yes" ; then
  1509. if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
  1510. sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
  1511. sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
  1512. fi
  1513. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  1514. :
  1515. else
  1516. sdl=no
  1517. fi
  1518. fi # static link
  1519. else # sdl not found
  1520. if test "$sdl" = "yes" ; then
  1521. feature_not_found "sdl"
  1522. fi
  1523. sdl=no
  1524. fi # sdl compile test
  1525. fi
  1526. if test "$sdl" = "yes" ; then
  1527. cat > $TMPC <<EOF
  1528. #include <SDL.h>
  1529. #if defined(SDL_VIDEO_DRIVER_X11)
  1530. #include <X11/XKBlib.h>
  1531. #else
  1532. #error No x11 support
  1533. #endif
  1534. int main(void) { return 0; }
  1535. EOF
  1536. if compile_prog "$sdl_cflags" "$sdl_libs" ; then
  1537. sdl_libs="$sdl_libs -lX11"
  1538. fi
  1539. libs_softmmu="$sdl_libs $libs_softmmu"
  1540. fi
  1541. ##########################################
  1542. # VNC TLS detection
  1543. if test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
  1544. cat > $TMPC <<EOF
  1545. #include <gnutls/gnutls.h>
  1546. int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
  1547. EOF
  1548. vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
  1549. vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
  1550. if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
  1551. vnc_tls=yes
  1552. libs_softmmu="$vnc_tls_libs $libs_softmmu"
  1553. else
  1554. if test "$vnc_tls" = "yes" ; then
  1555. feature_not_found "vnc-tls"
  1556. fi
  1557. vnc_tls=no
  1558. fi
  1559. fi
  1560. ##########################################
  1561. # VNC SASL detection
  1562. if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
  1563. cat > $TMPC <<EOF
  1564. #include <sasl/sasl.h>
  1565. #include <stdio.h>
  1566. int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
  1567. EOF
  1568. # Assuming Cyrus-SASL installed in /usr prefix
  1569. vnc_sasl_cflags=""
  1570. vnc_sasl_libs="-lsasl2"
  1571. if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
  1572. vnc_sasl=yes
  1573. libs_softmmu="$vnc_sasl_libs $libs_softmmu"
  1574. else
  1575. if test "$vnc_sasl" = "yes" ; then
  1576. feature_not_found "vnc-sasl"
  1577. fi
  1578. vnc_sasl=no
  1579. fi
  1580. fi
  1581. ##########################################
  1582. # VNC JPEG detection
  1583. if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
  1584. cat > $TMPC <<EOF
  1585. #include <stdio.h>
  1586. #include <jpeglib.h>
  1587. int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
  1588. EOF
  1589. vnc_jpeg_cflags=""
  1590. vnc_jpeg_libs="-ljpeg"
  1591. if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
  1592. vnc_jpeg=yes
  1593. libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
  1594. else
  1595. if test "$vnc_jpeg" = "yes" ; then
  1596. feature_not_found "vnc-jpeg"
  1597. fi
  1598. vnc_jpeg=no
  1599. fi
  1600. fi
  1601. ##########################################
  1602. # VNC PNG detection
  1603. if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
  1604. cat > $TMPC <<EOF
  1605. //#include <stdio.h>
  1606. #include <png.h>
  1607. #include <stddef.h>
  1608. int main(void) {
  1609. png_structp png_ptr;
  1610. png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  1611. return 0;
  1612. }
  1613. EOF
  1614. if $pkg_config libpng --modversion >/dev/null 2>&1; then
  1615. vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
  1616. vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
  1617. else
  1618. vnc_png_cflags=""
  1619. vnc_png_libs="-lpng"
  1620. fi
  1621. if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
  1622. vnc_png=yes
  1623. libs_softmmu="$vnc_png_libs $libs_softmmu"
  1624. QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
  1625. else
  1626. if test "$vnc_png" = "yes" ; then
  1627. feature_not_found "vnc-png"
  1628. fi
  1629. vnc_png=no
  1630. fi
  1631. fi
  1632. ##########################################
  1633. # fnmatch() probe, used for ACL routines
  1634. fnmatch="no"
  1635. cat > $TMPC << EOF
  1636. #include <fnmatch.h>
  1637. int main(void)
  1638. {
  1639. fnmatch("foo", "foo", 0);
  1640. return 0;
  1641. }
  1642. EOF
  1643. if compile_prog "" "" ; then
  1644. fnmatch="yes"
  1645. fi
  1646. ##########################################
  1647. # uuid_generate() probe, used for vdi block driver
  1648. if test "$uuid" != "no" ; then
  1649. uuid_libs="-luuid"
  1650. cat > $TMPC << EOF
  1651. #include <uuid/uuid.h>
  1652. int main(void)
  1653. {
  1654. uuid_t my_uuid;
  1655. uuid_generate(my_uuid);
  1656. return 0;
  1657. }
  1658. EOF
  1659. if compile_prog "" "$uuid_libs" ; then
  1660. uuid="yes"
  1661. libs_softmmu="$uuid_libs $libs_softmmu"
  1662. libs_tools="$uuid_libs $libs_tools"
  1663. else
  1664. if test "$uuid" = "yes" ; then
  1665. feature_not_found "uuid"
  1666. fi
  1667. uuid=no
  1668. fi
  1669. fi
  1670. ##########################################
  1671. # xfsctl() probe, used for raw-posix
  1672. if test "$xfs" != "no" ; then
  1673. cat > $TMPC << EOF
  1674. #include <stddef.h> /* NULL */
  1675. #include <xfs/xfs.h>
  1676. int main(void)
  1677. {
  1678. xfsctl(NULL, 0, 0, NULL);
  1679. return 0;
  1680. }
  1681. EOF
  1682. if compile_prog "" "" ; then
  1683. xfs="yes"
  1684. else
  1685. if test "$xfs" = "yes" ; then
  1686. feature_not_found "xfs"
  1687. fi
  1688. xfs=no
  1689. fi
  1690. fi
  1691. ##########################################
  1692. # vde libraries probe
  1693. if test "$vde" != "no" ; then
  1694. vde_libs="-lvdeplug"
  1695. cat > $TMPC << EOF
  1696. #include <libvdeplug.h>
  1697. int main(void)
  1698. {
  1699. struct vde_open_args a = {0, 0, 0};
  1700. vde_open("", "", &a);
  1701. return 0;
  1702. }
  1703. EOF
  1704. if compile_prog "" "$vde_libs" ; then
  1705. vde=yes
  1706. libs_softmmu="$vde_libs $libs_softmmu"
  1707. libs_tools="$vde_libs $libs_tools"
  1708. else
  1709. if test "$vde" = "yes" ; then
  1710. feature_not_found "vde"
  1711. fi
  1712. vde=no
  1713. fi
  1714. fi
  1715. ##########################################
  1716. # libcap-ng library probe
  1717. if test "$cap_ng" != "no" ; then
  1718. cap_libs="-lcap-ng"
  1719. cat > $TMPC << EOF
  1720. #include <cap-ng.h>
  1721. int main(void)
  1722. {
  1723. capng_capability_to_name(CAPNG_EFFECTIVE);
  1724. return 0;
  1725. }
  1726. EOF
  1727. if compile_prog "" "$cap_libs" ; then
  1728. cap_ng=yes
  1729. libs_tools="$cap_libs $libs_tools"
  1730. else
  1731. if test "$cap_ng" = "yes" ; then
  1732. feature_not_found "cap_ng"
  1733. fi
  1734. cap_ng=no
  1735. fi
  1736. fi
  1737. ##########################################
  1738. # Sound support libraries probe
  1739. audio_drv_probe()
  1740. {
  1741. drv=$1
  1742. hdr=$2
  1743. lib=$3
  1744. exp=$4
  1745. cfl=$5
  1746. cat > $TMPC << EOF
  1747. #include <$hdr>
  1748. int main(void) { $exp }
  1749. EOF
  1750. if compile_prog "$cfl" "$lib" ; then
  1751. :
  1752. else
  1753. echo
  1754. echo "Error: $drv check failed"
  1755. echo "Make sure to have the $drv libs and headers installed."
  1756. echo
  1757. exit 1
  1758. fi
  1759. }
  1760. audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
  1761. for drv in $audio_drv_list; do
  1762. case $drv in
  1763. alsa)
  1764. audio_drv_probe $drv alsa/asoundlib.h -lasound \
  1765. "snd_pcm_t **handle; return snd_pcm_close(*handle);"
  1766. libs_softmmu="-lasound $libs_softmmu"
  1767. ;;
  1768. fmod)
  1769. if test -z $fmod_lib || test -z $fmod_inc; then
  1770. echo
  1771. echo "Error: You must specify path to FMOD library and headers"
  1772. echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
  1773. echo
  1774. exit 1
  1775. fi
  1776. audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
  1777. libs_softmmu="$fmod_lib $libs_softmmu"
  1778. ;;
  1779. esd)
  1780. audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
  1781. libs_softmmu="-lesd $libs_softmmu"
  1782. audio_pt_int="yes"
  1783. ;;
  1784. pa)
  1785. audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
  1786. "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
  1787. libs_softmmu="-lpulse $libs_softmmu"
  1788. audio_pt_int="yes"
  1789. ;;
  1790. coreaudio)
  1791. libs_softmmu="-framework CoreAudio $libs_softmmu"
  1792. ;;
  1793. dsound)
  1794. libs_softmmu="-lole32 -ldxguid $libs_softmmu"
  1795. audio_win_int="yes"
  1796. ;;
  1797. oss)
  1798. libs_softmmu="$oss_lib $libs_softmmu"
  1799. ;;
  1800. sdl|wav)
  1801. # XXX: Probes for CoreAudio, DirectSound, SDL(?)
  1802. ;;
  1803. winwave)
  1804. libs_softmmu="-lwinmm $libs_softmmu"
  1805. audio_win_int="yes"
  1806. ;;
  1807. *)
  1808. echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
  1809. echo
  1810. echo "Error: Unknown driver '$drv' selected"
  1811. echo "Possible drivers are: $audio_possible_drivers"
  1812. echo
  1813. exit 1
  1814. }
  1815. ;;
  1816. esac
  1817. done
  1818. ##########################################
  1819. # BrlAPI probe
  1820. if test "$brlapi" != "no" ; then
  1821. brlapi_libs="-lbrlapi"
  1822. cat > $TMPC << EOF
  1823. #include <brlapi.h>
  1824. #include <stddef.h>
  1825. int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
  1826. EOF
  1827. if compile_prog "" "$brlapi_libs" ; then
  1828. brlapi=yes
  1829. libs_softmmu="$brlapi_libs $libs_softmmu"
  1830. else
  1831. if test "$brlapi" = "yes" ; then
  1832. feature_not_found "brlapi"
  1833. fi
  1834. brlapi=no
  1835. fi
  1836. fi
  1837. ##########################################
  1838. # curses probe
  1839. if test "$mingw32" = "yes" ; then
  1840. curses_list="-lpdcurses"
  1841. else
  1842. curses_list="-lncurses -lcurses"
  1843. fi
  1844. if test "$curses" != "no" ; then
  1845. curses_found=no
  1846. cat > $TMPC << EOF
  1847. #include <curses.h>
  1848. int main(void) {
  1849. const char *s = curses_version();
  1850. resize_term(0, 0);
  1851. return s != 0;
  1852. }
  1853. EOF
  1854. for curses_lib in $curses_list; do
  1855. if compile_prog "" "$curses_lib" ; then
  1856. curses_found=yes
  1857. libs_softmmu="$curses_lib $libs_softmmu"
  1858. break
  1859. fi
  1860. done
  1861. if test "$curses_found" = "yes" ; then
  1862. curses=yes
  1863. else
  1864. if test "$curses" = "yes" ; then
  1865. feature_not_found "curses"
  1866. fi
  1867. curses=no
  1868. fi
  1869. fi
  1870. ##########################################
  1871. # curl probe
  1872. if $pkg_config libcurl --modversion >/dev/null 2>&1; then
  1873. curlconfig="$pkg_config libcurl"
  1874. else
  1875. curlconfig=curl-config
  1876. fi
  1877. if test "$curl" != "no" ; then
  1878. cat > $TMPC << EOF
  1879. #include <curl/curl.h>
  1880. int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
  1881. EOF
  1882. curl_cflags=`$curlconfig --cflags 2>/dev/null`
  1883. curl_libs=`$curlconfig --libs 2>/dev/null`
  1884. if compile_prog "$curl_cflags" "$curl_libs" ; then
  1885. curl=yes
  1886. libs_tools="$curl_libs $libs_tools"
  1887. libs_softmmu="$curl_libs $libs_softmmu"
  1888. else
  1889. if test "$curl" = "yes" ; then
  1890. feature_not_found "curl"
  1891. fi
  1892. curl=no
  1893. fi
  1894. fi # test "$curl"
  1895. ##########################################
  1896. # bluez support probe
  1897. if test "$bluez" != "no" ; then
  1898. cat > $TMPC << EOF
  1899. #include <bluetooth/bluetooth.h>
  1900. int main(void) { return bt_error(0); }
  1901. EOF
  1902. bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
  1903. bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
  1904. if compile_prog "$bluez_cflags" "$bluez_libs" ; then
  1905. bluez=yes
  1906. libs_softmmu="$bluez_libs $libs_softmmu"
  1907. else
  1908. if test "$bluez" = "yes" ; then
  1909. feature_not_found "bluez"
  1910. fi
  1911. bluez="no"
  1912. fi
  1913. fi
  1914. ##########################################
  1915. # glib support probe
  1916. if test "$mingw32" = yes; then
  1917. # g_poll is required in order to integrate with the glib main loop.
  1918. glib_req_ver=2.20
  1919. else
  1920. glib_req_ver=2.12
  1921. fi
  1922. if $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
  1923. then
  1924. glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
  1925. glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
  1926. LIBS="$glib_libs $LIBS"
  1927. libs_qga="$glib_libs $libs_qga"
  1928. else
  1929. echo "glib-$glib_req_ver required to compile QEMU"
  1930. exit 1
  1931. fi
  1932. ##########################################
  1933. # libcap probe
  1934. if test "$cap" != "no" ; then
  1935. cat > $TMPC <<EOF
  1936. #include <stdio.h>
  1937. #include <sys/capability.h>
  1938. int main(void) { cap_t caps; caps = cap_init(); }
  1939. EOF
  1940. if compile_prog "" "-lcap" ; then
  1941. cap=yes
  1942. else
  1943. cap=no
  1944. fi
  1945. fi
  1946. ##########################################
  1947. # pthread probe
  1948. PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
  1949. pthread=no
  1950. cat > $TMPC << EOF
  1951. #include <pthread.h>
  1952. static void *f(void *p) { return NULL; }
  1953. int main(void) {
  1954. pthread_t thread;
  1955. pthread_create(&thread, 0, f, 0);
  1956. return 0;
  1957. }
  1958. EOF
  1959. if compile_prog "" "" ; then
  1960. pthread=yes
  1961. else
  1962. for pthread_lib in $PTHREADLIBS_LIST; do
  1963. if compile_prog "" "$pthread_lib" ; then
  1964. pthread=yes
  1965. found=no
  1966. for lib_entry in $LIBS; do
  1967. if test "$lib_entry" = "$pthread_lib"; then
  1968. found=yes
  1969. break
  1970. fi
  1971. done
  1972. if test "$found" = "no"; then
  1973. LIBS="$pthread_lib $LIBS"
  1974. fi
  1975. break
  1976. fi
  1977. done
  1978. fi
  1979. if test "$mingw32" != yes -a "$pthread" = no; then
  1980. echo
  1981. echo "Error: pthread check failed"
  1982. echo "Make sure to have the pthread libs and headers installed."
  1983. echo
  1984. exit 1
  1985. fi
  1986. ##########################################
  1987. # rbd probe
  1988. if test "$rbd" != "no" ; then
  1989. cat > $TMPC <<EOF
  1990. #include <stdio.h>
  1991. #include <rbd/librbd.h>
  1992. int main(void) {
  1993. rados_t cluster;
  1994. rados_create(&cluster, NULL);
  1995. return 0;
  1996. }
  1997. EOF
  1998. rbd_libs="-lrbd -lrados"
  1999. if compile_prog "" "$rbd_libs" ; then
  2000. rbd=yes
  2001. libs_tools="$rbd_libs $libs_tools"
  2002. libs_softmmu="$rbd_libs $libs_softmmu"
  2003. else
  2004. if test "$rbd" = "yes" ; then
  2005. feature_not_found "rados block device"
  2006. fi
  2007. rbd=no
  2008. fi
  2009. fi
  2010. ##########################################
  2011. # linux-aio probe
  2012. if test "$linux_aio" != "no" ; then
  2013. cat > $TMPC <<EOF
  2014. #include <libaio.h>
  2015. #include <sys/eventfd.h>
  2016. #include <stddef.h>
  2017. int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
  2018. EOF
  2019. if compile_prog "" "-laio" ; then
  2020. linux_aio=yes
  2021. libs_softmmu="$libs_softmmu -laio"
  2022. libs_tools="$libs_tools -laio"
  2023. else
  2024. if test "$linux_aio" = "yes" ; then
  2025. feature_not_found "linux AIO"
  2026. fi
  2027. linux_aio=no
  2028. fi
  2029. fi
  2030. ##########################################
  2031. # attr probe
  2032. if test "$attr" != "no" ; then
  2033. cat > $TMPC <<EOF
  2034. #include <stdio.h>
  2035. #include <sys/types.h>
  2036. #ifdef CONFIG_LIBATTR
  2037. #include <attr/xattr.h>
  2038. #else
  2039. #include <sys/xattr.h>
  2040. #endif
  2041. int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
  2042. EOF
  2043. if compile_prog "" "" ; then
  2044. attr=yes
  2045. # Older distros have <attr/xattr.h>, and need -lattr:
  2046. elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
  2047. attr=yes
  2048. LIBS="-lattr $LIBS"
  2049. libattr=yes
  2050. else
  2051. if test "$attr" = "yes" ; then
  2052. feature_not_found "ATTR"
  2053. fi
  2054. attr=no
  2055. fi
  2056. fi
  2057. ##########################################
  2058. # iovec probe
  2059. cat > $TMPC <<EOF
  2060. #include <sys/types.h>
  2061. #include <sys/uio.h>
  2062. #include <unistd.h>
  2063. int main(void) { return sizeof(struct iovec); }
  2064. EOF
  2065. iovec=no
  2066. if compile_prog "" "" ; then
  2067. iovec=yes
  2068. fi
  2069. ##########################################
  2070. # preadv probe
  2071. cat > $TMPC <<EOF
  2072. #include <sys/types.h>
  2073. #include <sys/uio.h>
  2074. #include <unistd.h>
  2075. int main(void) { return preadv == preadv; }
  2076. EOF
  2077. preadv=no
  2078. if compile_prog "" "" ; then
  2079. preadv=yes
  2080. fi
  2081. ##########################################
  2082. # fdt probe
  2083. if test "$fdt" != "no" ; then
  2084. fdt_libs="-lfdt"
  2085. cat > $TMPC << EOF
  2086. int main(void) { return 0; }
  2087. EOF
  2088. if compile_prog "" "$fdt_libs" ; then
  2089. fdt=yes
  2090. else
  2091. if test "$fdt" = "yes" ; then
  2092. feature_not_found "fdt"
  2093. fi
  2094. fdt_libs=
  2095. fdt=no
  2096. fi
  2097. fi
  2098. ##########################################
  2099. # opengl probe, used by milkymist-tmu2
  2100. if test "$opengl" != "no" ; then
  2101. opengl_libs="-lGL"
  2102. cat > $TMPC << EOF
  2103. #include <X11/Xlib.h>
  2104. #include <GL/gl.h>
  2105. #include <GL/glx.h>
  2106. int main(void) { return GL_VERSION != 0; }
  2107. EOF
  2108. if compile_prog "" "-lGL" ; then
  2109. opengl=yes
  2110. else
  2111. if test "$opengl" = "yes" ; then
  2112. feature_not_found "opengl"
  2113. fi
  2114. opengl_libs=
  2115. opengl=no
  2116. fi
  2117. fi
  2118. #
  2119. # Check for xxxat() functions when we are building linux-user
  2120. # emulator. This is done because older glibc versions don't
  2121. # have syscall stubs for these implemented.
  2122. #
  2123. atfile=no
  2124. cat > $TMPC << EOF
  2125. #define _ATFILE_SOURCE
  2126. #include <sys/types.h>
  2127. #include <fcntl.h>
  2128. #include <unistd.h>
  2129. int
  2130. main(void)
  2131. {
  2132. /* try to unlink nonexisting file */
  2133. return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
  2134. }
  2135. EOF
  2136. if compile_prog "" "" ; then
  2137. atfile=yes
  2138. fi
  2139. # Check for inotify functions when we are building linux-user
  2140. # emulator. This is done because older glibc versions don't
  2141. # have syscall stubs for these implemented. In that case we
  2142. # don't provide them even if kernel supports them.
  2143. #
  2144. inotify=no
  2145. cat > $TMPC << EOF
  2146. #include <sys/inotify.h>
  2147. int
  2148. main(void)
  2149. {
  2150. /* try to start inotify */
  2151. return inotify_init();
  2152. }
  2153. EOF
  2154. if compile_prog "" "" ; then
  2155. inotify=yes
  2156. fi
  2157. inotify1=no
  2158. cat > $TMPC << EOF
  2159. #include <sys/inotify.h>
  2160. int
  2161. main(void)
  2162. {
  2163. /* try to start inotify */
  2164. return inotify_init1(0);
  2165. }
  2166. EOF
  2167. if compile_prog "" "" ; then
  2168. inotify1=yes
  2169. fi
  2170. # check if utimensat and futimens are supported
  2171. utimens=no
  2172. cat > $TMPC << EOF
  2173. #define _ATFILE_SOURCE
  2174. #include <stddef.h>
  2175. #include <fcntl.h>
  2176. int main(void)
  2177. {
  2178. utimensat(AT_FDCWD, "foo", NULL, 0);
  2179. futimens(0, NULL);
  2180. return 0;
  2181. }
  2182. EOF
  2183. if compile_prog "" "" ; then
  2184. utimens=yes
  2185. fi
  2186. # check if pipe2 is there
  2187. pipe2=no
  2188. cat > $TMPC << EOF
  2189. #include <unistd.h>
  2190. #include <fcntl.h>
  2191. int main(void)
  2192. {
  2193. int pipefd[2];
  2194. pipe2(pipefd, O_CLOEXEC);
  2195. return 0;
  2196. }
  2197. EOF
  2198. if compile_prog "" "" ; then
  2199. pipe2=yes
  2200. fi
  2201. # check if accept4 is there
  2202. accept4=no
  2203. cat > $TMPC << EOF
  2204. #include <sys/socket.h>
  2205. #include <stddef.h>
  2206. int main(void)
  2207. {
  2208. accept4(0, NULL, NULL, SOCK_CLOEXEC);
  2209. return 0;
  2210. }
  2211. EOF
  2212. if compile_prog "" "" ; then
  2213. accept4=yes
  2214. fi
  2215. # check if tee/splice is there. vmsplice was added same time.
  2216. splice=no
  2217. cat > $TMPC << EOF
  2218. #include <unistd.h>
  2219. #include <fcntl.h>
  2220. #include <limits.h>
  2221. int main(void)
  2222. {
  2223. int len, fd = 0;
  2224. len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
  2225. splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
  2226. return 0;
  2227. }
  2228. EOF
  2229. if compile_prog "" "" ; then
  2230. splice=yes
  2231. fi
  2232. ##########################################
  2233. # signalfd probe
  2234. signalfd="no"
  2235. cat > $TMPC << EOF
  2236. #include <unistd.h>
  2237. #include <sys/syscall.h>
  2238. #include <signal.h>
  2239. int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
  2240. EOF
  2241. if compile_prog "" "" ; then
  2242. signalfd=yes
  2243. fi
  2244. # check if eventfd is supported
  2245. eventfd=no
  2246. cat > $TMPC << EOF
  2247. #include <sys/eventfd.h>
  2248. int main(void)
  2249. {
  2250. return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
  2251. }
  2252. EOF
  2253. if compile_prog "" "" ; then
  2254. eventfd=yes
  2255. fi
  2256. # check for fallocate
  2257. fallocate=no
  2258. cat > $TMPC << EOF
  2259. #include <fcntl.h>
  2260. int main(void)
  2261. {
  2262. fallocate(0, 0, 0, 0);
  2263. return 0;
  2264. }
  2265. EOF
  2266. if compile_prog "" "" ; then
  2267. fallocate=yes
  2268. fi
  2269. # check for sync_file_range
  2270. sync_file_range=no
  2271. cat > $TMPC << EOF
  2272. #include <fcntl.h>
  2273. int main(void)
  2274. {
  2275. sync_file_range(0, 0, 0, 0);
  2276. return 0;
  2277. }
  2278. EOF
  2279. if compile_prog "" "" ; then
  2280. sync_file_range=yes
  2281. fi
  2282. # check for linux/fiemap.h and FS_IOC_FIEMAP
  2283. fiemap=no
  2284. cat > $TMPC << EOF
  2285. #include <sys/ioctl.h>
  2286. #include <linux/fs.h>
  2287. #include <linux/fiemap.h>
  2288. int main(void)
  2289. {
  2290. ioctl(0, FS_IOC_FIEMAP, 0);
  2291. return 0;
  2292. }
  2293. EOF
  2294. if compile_prog "" "" ; then
  2295. fiemap=yes
  2296. fi
  2297. # check for dup3
  2298. dup3=no
  2299. cat > $TMPC << EOF
  2300. #include <unistd.h>
  2301. int main(void)
  2302. {
  2303. dup3(0, 0, 0);
  2304. return 0;
  2305. }
  2306. EOF
  2307. if compile_prog "" "" ; then
  2308. dup3=yes
  2309. fi
  2310. # check for epoll support
  2311. epoll=no
  2312. cat > $TMPC << EOF
  2313. #include <sys/epoll.h>
  2314. int main(void)
  2315. {
  2316. epoll_create(0);
  2317. return 0;
  2318. }
  2319. EOF
  2320. if compile_prog "" "" ; then
  2321. epoll=yes
  2322. fi
  2323. # epoll_create1 and epoll_pwait are later additions
  2324. # so we must check separately for their presence
  2325. epoll_create1=no
  2326. cat > $TMPC << EOF
  2327. #include <sys/epoll.h>
  2328. int main(void)
  2329. {
  2330. /* Note that we use epoll_create1 as a value, not as
  2331. * a function being called. This is necessary so that on
  2332. * old SPARC glibc versions where the function was present in
  2333. * the library but not declared in the header file we will
  2334. * fail the configure check. (Otherwise we will get a compiler
  2335. * warning but not an error, and will proceed to fail the
  2336. * qemu compile where we compile with -Werror.)
  2337. */
  2338. return epoll_create1 == epoll_create1;
  2339. }
  2340. EOF
  2341. if compile_prog "" "" ; then
  2342. epoll_create1=yes
  2343. fi
  2344. epoll_pwait=no
  2345. cat > $TMPC << EOF
  2346. #include <sys/epoll.h>
  2347. int main(void)
  2348. {
  2349. epoll_pwait(0, 0, 0, 0, 0);
  2350. return 0;
  2351. }
  2352. EOF
  2353. if compile_prog "" "" ; then
  2354. epoll_pwait=yes
  2355. fi
  2356. # Check if tools are available to build documentation.
  2357. if test "$docs" != "no" ; then
  2358. if has makeinfo && has pod2man; then
  2359. docs=yes
  2360. else
  2361. if test "$docs" = "yes" ; then
  2362. feature_not_found "docs"
  2363. fi
  2364. docs=no
  2365. fi
  2366. fi
  2367. # Search for bswap_32 function
  2368. byteswap_h=no
  2369. cat > $TMPC << EOF
  2370. #include <byteswap.h>
  2371. int main(void) { return bswap_32(0); }
  2372. EOF
  2373. if compile_prog "" "" ; then
  2374. byteswap_h=yes
  2375. fi
  2376. # Search for bswap_32 function
  2377. bswap_h=no
  2378. cat > $TMPC << EOF
  2379. #include <sys/endian.h>
  2380. #include <sys/types.h>
  2381. #include <machine/bswap.h>
  2382. int main(void) { return bswap32(0); }
  2383. EOF
  2384. if compile_prog "" "" ; then
  2385. bswap_h=yes
  2386. fi
  2387. ##########################################
  2388. # Do we have libiscsi
  2389. # We check for iscsi_unmap_sync() to make sure we have a
  2390. # recent enough version of libiscsi.
  2391. if test "$libiscsi" != "no" ; then
  2392. cat > $TMPC << EOF
  2393. #include <stdio.h>
  2394. #include <iscsi/iscsi.h>
  2395. int main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
  2396. EOF
  2397. if compile_prog "-Werror" "-liscsi" ; then
  2398. libiscsi="yes"
  2399. LIBS="$LIBS -liscsi"
  2400. else
  2401. if test "$libiscsi" = "yes" ; then
  2402. feature_not_found "libiscsi"
  2403. fi
  2404. libiscsi="no"
  2405. fi
  2406. fi
  2407. ##########################################
  2408. # Do we need librt
  2409. cat > $TMPC <<EOF
  2410. #include <signal.h>
  2411. #include <time.h>
  2412. int main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
  2413. EOF
  2414. if compile_prog "" "" ; then
  2415. :
  2416. elif compile_prog "" "-lrt" ; then
  2417. LIBS="-lrt $LIBS"
  2418. fi
  2419. if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
  2420. "$aix" != "yes" -a "$haiku" != "yes" ; then
  2421. libs_softmmu="-lutil $libs_softmmu"
  2422. fi
  2423. ##########################################
  2424. # spice probe
  2425. if test "$spice" != "no" ; then
  2426. cat > $TMPC << EOF
  2427. #include <spice.h>
  2428. int main(void) { spice_server_new(); return 0; }
  2429. EOF
  2430. spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
  2431. spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
  2432. if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \
  2433. $pkg_config --atleast-version=0.8.1 spice-protocol > /dev/null 2>&1 && \
  2434. compile_prog "$spice_cflags" "$spice_libs" ; then
  2435. spice="yes"
  2436. libs_softmmu="$libs_softmmu $spice_libs"
  2437. QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
  2438. else
  2439. if test "$spice" = "yes" ; then
  2440. feature_not_found "spice"
  2441. fi
  2442. spice="no"
  2443. fi
  2444. fi
  2445. # check for libcacard for smartcard support
  2446. if test "$smartcard" != "no" ; then
  2447. smartcard="yes"
  2448. smartcard_cflags=""
  2449. # TODO - what's the minimal nss version we support?
  2450. if test "$smartcard_nss" != "no"; then
  2451. cat > $TMPC << EOF
  2452. #include <pk11pub.h>
  2453. int main(void) { PK11_FreeSlot(0); return 0; }
  2454. EOF
  2455. smartcard_cflags="-I\$(SRC_PATH)/libcacard"
  2456. libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
  2457. libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
  2458. if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
  2459. compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then
  2460. smartcard_nss="yes"
  2461. QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
  2462. libs_softmmu="$libcacard_libs $libs_softmmu"
  2463. else
  2464. if test "$smartcard_nss" = "yes"; then
  2465. feature_not_found "nss"
  2466. fi
  2467. smartcard_nss="no"
  2468. fi
  2469. fi
  2470. fi
  2471. if test "$smartcard" = "no" ; then
  2472. smartcard_nss="no"
  2473. fi
  2474. # check for usbredirparser for usb network redirection support
  2475. if test "$usb_redir" != "no" ; then
  2476. if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then
  2477. usb_redir="yes"
  2478. usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
  2479. usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
  2480. QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
  2481. LIBS="$LIBS $usb_redir_libs"
  2482. else
  2483. if test "$usb_redir" = "yes"; then
  2484. feature_not_found "usb-redir"
  2485. fi
  2486. usb_redir="no"
  2487. fi
  2488. fi
  2489. ##########################################
  2490. ##########################################
  2491. # check if we have fdatasync
  2492. fdatasync=no
  2493. cat > $TMPC << EOF
  2494. #include <unistd.h>
  2495. int main(void) {
  2496. #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
  2497. return fdatasync(0);
  2498. #else
  2499. #error Not supported
  2500. #endif
  2501. }
  2502. EOF
  2503. if compile_prog "" "" ; then
  2504. fdatasync=yes
  2505. fi
  2506. ##########################################
  2507. # check if we have madvise
  2508. madvise=no
  2509. cat > $TMPC << EOF
  2510. #include <sys/types.h>
  2511. #include <sys/mman.h>
  2512. #include <stddef.h>
  2513. int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
  2514. EOF
  2515. if compile_prog "" "" ; then
  2516. madvise=yes
  2517. fi
  2518. ##########################################
  2519. # check if we have posix_madvise
  2520. posix_madvise=no
  2521. cat > $TMPC << EOF
  2522. #include <sys/mman.h>
  2523. #include <stddef.h>
  2524. int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
  2525. EOF
  2526. if compile_prog "" "" ; then
  2527. posix_madvise=yes
  2528. fi
  2529. ##########################################
  2530. # check if trace backend exists
  2531. $python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
  2532. if test "$?" -ne 0 ; then
  2533. echo
  2534. echo "Error: invalid trace backend"
  2535. echo "Please choose a supported trace backend."
  2536. echo
  2537. exit 1
  2538. fi
  2539. ##########################################
  2540. # For 'ust' backend, test if ust headers are present
  2541. if test "$trace_backend" = "ust"; then
  2542. cat > $TMPC << EOF
  2543. #include <ust/tracepoint.h>
  2544. #include <ust/marker.h>
  2545. int main(void) { return 0; }
  2546. EOF
  2547. if compile_prog "" "" ; then
  2548. LIBS="-lust -lurcu-bp $LIBS"
  2549. libs_qga="-lust -lurcu-bp $libs_qga"
  2550. else
  2551. echo
  2552. echo "Error: Trace backend 'ust' missing libust header files"
  2553. echo
  2554. exit 1
  2555. fi
  2556. fi
  2557. ##########################################
  2558. # For 'dtrace' backend, test if 'dtrace' command is present
  2559. if test "$trace_backend" = "dtrace"; then
  2560. if ! has 'dtrace' ; then
  2561. echo
  2562. echo "Error: dtrace command is not found in PATH $PATH"
  2563. echo
  2564. exit 1
  2565. fi
  2566. trace_backend_stap="no"
  2567. if has 'stap' ; then
  2568. trace_backend_stap="yes"
  2569. fi
  2570. fi
  2571. ##########################################
  2572. # __sync_fetch_and_and requires at least -march=i486. Many toolchains
  2573. # use i686 as default anyway, but for those that don't, an explicit
  2574. # specification is necessary
  2575. if test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
  2576. cat > $TMPC << EOF
  2577. int sfaa(unsigned *ptr)
  2578. {
  2579. return __sync_fetch_and_and(ptr, 0);
  2580. }
  2581. int main(int argc, char **argv)
  2582. {
  2583. int val = 42;
  2584. sfaa(&val);
  2585. return val;
  2586. }
  2587. EOF
  2588. if ! compile_prog "" "" ; then
  2589. CFLAGS+="-march=i486"
  2590. fi
  2591. fi
  2592. ##########################################
  2593. # check and set a backend for coroutine
  2594. # default is ucontext, but always fallback to gthread
  2595. # windows autodetected by make
  2596. if test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
  2597. if test "$darwin" != "yes"; then
  2598. cat > $TMPC << EOF
  2599. #include <ucontext.h>
  2600. #ifdef __stub_makecontext
  2601. #error Ignoring glibc stub makecontext which will always fail
  2602. #endif
  2603. int main(void) { makecontext(0, 0, 0); return 0; }
  2604. EOF
  2605. if compile_prog "" "" ; then
  2606. coroutine_backend=ucontext
  2607. else
  2608. coroutine_backend=gthread
  2609. fi
  2610. else
  2611. echo "Silently falling back into gthread backend under darwin"
  2612. fi
  2613. elif test "$coroutine" = "gthread" ; then
  2614. coroutine_backend=gthread
  2615. elif test "$coroutine" = "windows" ; then
  2616. coroutine_backend=windows
  2617. elif test "$coroutine" = "sigaltstack" ; then
  2618. coroutine_backend=sigaltstack
  2619. else
  2620. echo
  2621. echo "Error: unknown coroutine backend $coroutine"
  2622. echo
  2623. exit 1
  2624. fi
  2625. ##########################################
  2626. # check if we have open_by_handle_at
  2627. open_by_hande_at=no
  2628. cat > $TMPC << EOF
  2629. #include <fcntl.h>
  2630. #if !defined(AT_EMPTY_PATH)
  2631. # error missing definition
  2632. #else
  2633. int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
  2634. #endif
  2635. EOF
  2636. if compile_prog "" "" ; then
  2637. open_by_handle_at=yes
  2638. fi
  2639. ########################################
  2640. # check if we have linux/magic.h
  2641. linux_magic_h=no
  2642. cat > $TMPC << EOF
  2643. #include <linux/magic.h>
  2644. int main(void) {
  2645. return 0;
  2646. }
  2647. EOF
  2648. if compile_prog "" "" ; then
  2649. linux_magic_h=yes
  2650. fi
  2651. ########################################
  2652. # check if environ is declared
  2653. has_environ=no
  2654. cat > $TMPC << EOF
  2655. #include <unistd.h>
  2656. int main(void) {
  2657. environ = environ;
  2658. return 0;
  2659. }
  2660. EOF
  2661. if compile_prog "" "" ; then
  2662. has_environ=yes
  2663. fi
  2664. ##########################################
  2665. # End of CC checks
  2666. # After here, no more $cc or $ld runs
  2667. if test "$debug" = "no" ; then
  2668. CFLAGS="-O2 $CFLAGS"
  2669. fi
  2670. # Consult white-list to determine whether to enable werror
  2671. # by default. Only enable by default for git builds
  2672. z_version=`cut -f3 -d. $source_path/VERSION`
  2673. if test -z "$werror" ; then
  2674. if test "$z_version" = "50" -a \
  2675. "$linux" = "yes" ; then
  2676. werror="yes"
  2677. else
  2678. werror="no"
  2679. fi
  2680. fi
  2681. # Disable zero malloc errors for official releases unless explicitly told to
  2682. # enable/disable
  2683. if test -z "$zero_malloc" ; then
  2684. if test "$z_version" = "50" ; then
  2685. zero_malloc="no"
  2686. else
  2687. zero_malloc="yes"
  2688. fi
  2689. fi
  2690. if test "$werror" = "yes" ; then
  2691. QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
  2692. fi
  2693. if test "$solaris" = "no" ; then
  2694. if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
  2695. LDFLAGS="-Wl,--warn-common $LDFLAGS"
  2696. fi
  2697. fi
  2698. # test if pod2man has --utf8 option
  2699. if pod2man --help | grep -q utf8; then
  2700. POD2MAN="pod2man --utf8"
  2701. else
  2702. POD2MAN="pod2man"
  2703. fi
  2704. # Use ASLR, no-SEH and DEP if available
  2705. if test "$mingw32" = "yes" ; then
  2706. for flag in --dynamicbase --no-seh --nxcompat; do
  2707. if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
  2708. LDFLAGS="-Wl,$flag $LDFLAGS"
  2709. fi
  2710. done
  2711. fi
  2712. qemu_confdir=$sysconfdir$confsuffix
  2713. qemu_datadir=$datadir$confsuffix
  2714. tools=
  2715. if test "$softmmu" = yes ; then
  2716. tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
  2717. if test "$virtfs" != no ; then
  2718. if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
  2719. virtfs=yes
  2720. tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
  2721. else
  2722. if test "$virtfs" = yes; then
  2723. echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
  2724. exit 1
  2725. fi
  2726. virtfs=no
  2727. fi
  2728. fi
  2729. if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
  2730. tools="qemu-nbd\$(EXESUF) $tools"
  2731. if [ "$guest_agent" = "yes" ]; then
  2732. tools="qemu-ga\$(EXESUF) $tools"
  2733. fi
  2734. fi
  2735. fi
  2736. # Mac OS X ships with a broken assembler
  2737. roms=
  2738. if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
  2739. "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
  2740. "$softmmu" = yes ; then
  2741. roms="optionrom"
  2742. fi
  2743. if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
  2744. roms="$roms spapr-rtas"
  2745. fi
  2746. echo "Install prefix $prefix"
  2747. echo "BIOS directory `eval echo $qemu_datadir`"
  2748. echo "binary directory `eval echo $bindir`"
  2749. echo "library directory `eval echo $libdir`"
  2750. echo "include directory `eval echo $includedir`"
  2751. echo "config directory `eval echo $sysconfdir`"
  2752. if test "$mingw32" = "no" ; then
  2753. echo "Manual directory `eval echo $mandir`"
  2754. echo "ELF interp prefix $interp_prefix"
  2755. fi
  2756. echo "Source path $source_path"
  2757. echo "C compiler $cc"
  2758. echo "Host C compiler $host_cc"
  2759. echo "CFLAGS $CFLAGS"
  2760. echo "QEMU_CFLAGS $QEMU_CFLAGS"
  2761. echo "LDFLAGS $LDFLAGS"
  2762. echo "make $make"
  2763. echo "install $install"
  2764. echo "python $python"
  2765. if test "$slirp" = "yes" ; then
  2766. echo "smbd $smbd"
  2767. fi
  2768. echo "host CPU $cpu"
  2769. echo "host big endian $bigendian"
  2770. echo "target list $target_list"
  2771. echo "tcg debug enabled $debug_tcg"
  2772. echo "Mon debug enabled $debug_mon"
  2773. echo "gprof enabled $gprof"
  2774. echo "sparse enabled $sparse"
  2775. echo "strip binaries $strip_opt"
  2776. echo "profiler $profiler"
  2777. echo "static build $static"
  2778. echo "-Werror enabled $werror"
  2779. if test "$darwin" = "yes" ; then
  2780. echo "Cocoa support $cocoa"
  2781. fi
  2782. echo "SDL support $sdl"
  2783. echo "curses support $curses"
  2784. echo "curl support $curl"
  2785. echo "mingw32 support $mingw32"
  2786. echo "Audio drivers $audio_drv_list"
  2787. echo "Extra audio cards $audio_card_list"
  2788. echo "Block whitelist $block_drv_whitelist"
  2789. echo "Mixer emulation $mixemu"
  2790. echo "VirtFS support $virtfs"
  2791. echo "VNC support $vnc"
  2792. if test "$vnc" = "yes" ; then
  2793. echo "VNC TLS support $vnc_tls"
  2794. echo "VNC SASL support $vnc_sasl"
  2795. echo "VNC JPEG support $vnc_jpeg"
  2796. echo "VNC PNG support $vnc_png"
  2797. echo "VNC thread $vnc_thread"
  2798. fi
  2799. if test -n "$sparc_cpu"; then
  2800. echo "Target Sparc Arch $sparc_cpu"
  2801. fi
  2802. echo "xen support $xen"
  2803. echo "brlapi support $brlapi"
  2804. echo "bluez support $bluez"
  2805. echo "Documentation $docs"
  2806. [ ! -z "$uname_release" ] && \
  2807. echo "uname -r $uname_release"
  2808. echo "NPTL support $nptl"
  2809. echo "GUEST_BASE $guest_base"
  2810. echo "PIE $pie"
  2811. echo "vde support $vde"
  2812. echo "Linux AIO support $linux_aio"
  2813. echo "ATTR/XATTR support $attr"
  2814. echo "Install blobs $blobs"
  2815. echo "KVM support $kvm"
  2816. echo "TCG interpreter $tcg_interpreter"
  2817. echo "fdt support $fdt"
  2818. echo "preadv support $preadv"
  2819. echo "fdatasync $fdatasync"
  2820. echo "madvise $madvise"
  2821. echo "posix_madvise $posix_madvise"
  2822. echo "uuid support $uuid"
  2823. echo "libcap-ng support $cap_ng"
  2824. echo "vhost-net support $vhost_net"
  2825. echo "Trace backend $trace_backend"
  2826. echo "Trace output file $trace_file-<pid>"
  2827. echo "spice support $spice"
  2828. echo "rbd support $rbd"
  2829. echo "xfsctl support $xfs"
  2830. echo "nss used $smartcard_nss"
  2831. echo "usb net redir $usb_redir"
  2832. echo "OpenGL support $opengl"
  2833. echo "libiscsi support $libiscsi"
  2834. echo "build guest agent $guest_agent"
  2835. echo "coroutine backend $coroutine_backend"
  2836. if test "$sdl_too_old" = "yes"; then
  2837. echo "-> Your SDL version is too old - please upgrade to have SDL support"
  2838. fi
  2839. config_host_mak="config-host.mak"
  2840. config_host_ld="config-host.ld"
  2841. echo "# Automatically generated by configure - do not modify" > $config_host_mak
  2842. printf "# Configured with:" >> $config_host_mak
  2843. printf " '%s'" "$0" "$@" >> $config_host_mak
  2844. echo >> $config_host_mak
  2845. echo all: >> $config_host_mak
  2846. echo "prefix=$prefix" >> $config_host_mak
  2847. echo "bindir=$bindir" >> $config_host_mak
  2848. echo "libdir=$libdir" >> $config_host_mak
  2849. echo "includedir=$includedir" >> $config_host_mak
  2850. echo "mandir=$mandir" >> $config_host_mak
  2851. echo "sysconfdir=$sysconfdir" >> $config_host_mak
  2852. echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
  2853. echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
  2854. echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
  2855. echo "libexecdir=\${prefix}/libexec" >> $config_host_mak
  2856. echo "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
  2857. echo "ARCH=$ARCH" >> $config_host_mak
  2858. if test "$debug_tcg" = "yes" ; then
  2859. echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
  2860. fi
  2861. if test "$debug_mon" = "yes" ; then
  2862. echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
  2863. fi
  2864. if test "$debug" = "yes" ; then
  2865. echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
  2866. fi
  2867. if test "$strip_opt" = "yes" ; then
  2868. echo "STRIP=${strip}" >> $config_host_mak
  2869. fi
  2870. if test "$bigendian" = "yes" ; then
  2871. echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
  2872. fi
  2873. if test "$mingw32" = "yes" ; then
  2874. echo "CONFIG_WIN32=y" >> $config_host_mak
  2875. rc_version=`cat $source_path/VERSION`
  2876. version_major=${rc_version%%.*}
  2877. rc_version=${rc_version#*.}
  2878. version_minor=${rc_version%%.*}
  2879. rc_version=${rc_version#*.}
  2880. version_subminor=${rc_version%%.*}
  2881. version_micro=0
  2882. echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  2883. echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
  2884. else
  2885. echo "CONFIG_POSIX=y" >> $config_host_mak
  2886. fi
  2887. if test "$linux" = "yes" ; then
  2888. echo "CONFIG_LINUX=y" >> $config_host_mak
  2889. fi
  2890. if test "$darwin" = "yes" ; then
  2891. echo "CONFIG_DARWIN=y" >> $config_host_mak
  2892. fi
  2893. if test "$aix" = "yes" ; then
  2894. echo "CONFIG_AIX=y" >> $config_host_mak
  2895. fi
  2896. if test "$solaris" = "yes" ; then
  2897. echo "CONFIG_SOLARIS=y" >> $config_host_mak
  2898. echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
  2899. if test "$needs_libsunmath" = "yes" ; then
  2900. echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
  2901. fi
  2902. fi
  2903. if test "$haiku" = "yes" ; then
  2904. echo "CONFIG_HAIKU=y" >> $config_host_mak
  2905. fi
  2906. if test "$static" = "yes" ; then
  2907. echo "CONFIG_STATIC=y" >> $config_host_mak
  2908. fi
  2909. if test "$profiler" = "yes" ; then
  2910. echo "CONFIG_PROFILER=y" >> $config_host_mak
  2911. fi
  2912. if test "$slirp" = "yes" ; then
  2913. echo "CONFIG_SLIRP=y" >> $config_host_mak
  2914. echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
  2915. QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
  2916. fi
  2917. if test "$vde" = "yes" ; then
  2918. echo "CONFIG_VDE=y" >> $config_host_mak
  2919. fi
  2920. if test "$cap_ng" = "yes" ; then
  2921. echo "CONFIG_LIBCAP=y" >> $config_host_mak
  2922. fi
  2923. for card in $audio_card_list; do
  2924. def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
  2925. echo "$def=y" >> $config_host_mak
  2926. done
  2927. echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
  2928. for drv in $audio_drv_list; do
  2929. def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
  2930. echo "$def=y" >> $config_host_mak
  2931. if test "$drv" = "fmod"; then
  2932. echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
  2933. fi
  2934. done
  2935. if test "$audio_pt_int" = "yes" ; then
  2936. echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
  2937. fi
  2938. if test "$audio_win_int" = "yes" ; then
  2939. echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
  2940. fi
  2941. echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
  2942. if test "$mixemu" = "yes" ; then
  2943. echo "CONFIG_MIXEMU=y" >> $config_host_mak
  2944. fi
  2945. if test "$vnc" = "yes" ; then
  2946. echo "CONFIG_VNC=y" >> $config_host_mak
  2947. fi
  2948. if test "$vnc_tls" = "yes" ; then
  2949. echo "CONFIG_VNC_TLS=y" >> $config_host_mak
  2950. echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
  2951. fi
  2952. if test "$vnc_sasl" = "yes" ; then
  2953. echo "CONFIG_VNC_SASL=y" >> $config_host_mak
  2954. echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
  2955. fi
  2956. if test "$vnc_jpeg" = "yes" ; then
  2957. echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
  2958. echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
  2959. fi
  2960. if test "$vnc_png" = "yes" ; then
  2961. echo "CONFIG_VNC_PNG=y" >> $config_host_mak
  2962. echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
  2963. fi
  2964. if test "$vnc_thread" = "yes" ; then
  2965. echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
  2966. fi
  2967. if test "$fnmatch" = "yes" ; then
  2968. echo "CONFIG_FNMATCH=y" >> $config_host_mak
  2969. fi
  2970. if test "$uuid" = "yes" ; then
  2971. echo "CONFIG_UUID=y" >> $config_host_mak
  2972. fi
  2973. if test "$xfs" = "yes" ; then
  2974. echo "CONFIG_XFS=y" >> $config_host_mak
  2975. fi
  2976. qemu_version=`head $source_path/VERSION`
  2977. echo "VERSION=$qemu_version" >>$config_host_mak
  2978. echo "PKGVERSION=$pkgversion" >>$config_host_mak
  2979. echo "SRC_PATH=$source_path" >> $config_host_mak
  2980. echo "TARGET_DIRS=$target_list" >> $config_host_mak
  2981. if [ "$docs" = "yes" ] ; then
  2982. echo "BUILD_DOCS=yes" >> $config_host_mak
  2983. fi
  2984. if test "$sdl" = "yes" ; then
  2985. echo "CONFIG_SDL=y" >> $config_host_mak
  2986. echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
  2987. fi
  2988. if test "$cocoa" = "yes" ; then
  2989. echo "CONFIG_COCOA=y" >> $config_host_mak
  2990. fi
  2991. if test "$curses" = "yes" ; then
  2992. echo "CONFIG_CURSES=y" >> $config_host_mak
  2993. fi
  2994. if test "$atfile" = "yes" ; then
  2995. echo "CONFIG_ATFILE=y" >> $config_host_mak
  2996. fi
  2997. if test "$utimens" = "yes" ; then
  2998. echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
  2999. fi
  3000. if test "$pipe2" = "yes" ; then
  3001. echo "CONFIG_PIPE2=y" >> $config_host_mak
  3002. fi
  3003. if test "$accept4" = "yes" ; then
  3004. echo "CONFIG_ACCEPT4=y" >> $config_host_mak
  3005. fi
  3006. if test "$splice" = "yes" ; then
  3007. echo "CONFIG_SPLICE=y" >> $config_host_mak
  3008. fi
  3009. if test "$eventfd" = "yes" ; then
  3010. echo "CONFIG_EVENTFD=y" >> $config_host_mak
  3011. fi
  3012. if test "$fallocate" = "yes" ; then
  3013. echo "CONFIG_FALLOCATE=y" >> $config_host_mak
  3014. fi
  3015. if test "$sync_file_range" = "yes" ; then
  3016. echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
  3017. fi
  3018. if test "$fiemap" = "yes" ; then
  3019. echo "CONFIG_FIEMAP=y" >> $config_host_mak
  3020. fi
  3021. if test "$dup3" = "yes" ; then
  3022. echo "CONFIG_DUP3=y" >> $config_host_mak
  3023. fi
  3024. if test "$epoll" = "yes" ; then
  3025. echo "CONFIG_EPOLL=y" >> $config_host_mak
  3026. fi
  3027. if test "$epoll_create1" = "yes" ; then
  3028. echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
  3029. fi
  3030. if test "$epoll_pwait" = "yes" ; then
  3031. echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
  3032. fi
  3033. if test "$inotify" = "yes" ; then
  3034. echo "CONFIG_INOTIFY=y" >> $config_host_mak
  3035. fi
  3036. if test "$inotify1" = "yes" ; then
  3037. echo "CONFIG_INOTIFY1=y" >> $config_host_mak
  3038. fi
  3039. if test "$byteswap_h" = "yes" ; then
  3040. echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
  3041. fi
  3042. if test "$bswap_h" = "yes" ; then
  3043. echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
  3044. fi
  3045. if test "$curl" = "yes" ; then
  3046. echo "CONFIG_CURL=y" >> $config_host_mak
  3047. echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
  3048. fi
  3049. if test "$brlapi" = "yes" ; then
  3050. echo "CONFIG_BRLAPI=y" >> $config_host_mak
  3051. fi
  3052. if test "$bluez" = "yes" ; then
  3053. echo "CONFIG_BLUEZ=y" >> $config_host_mak
  3054. echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
  3055. fi
  3056. echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
  3057. if test "$xen" = "yes" ; then
  3058. echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
  3059. echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
  3060. fi
  3061. if test "$linux_aio" = "yes" ; then
  3062. echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
  3063. fi
  3064. if test "$attr" = "yes" ; then
  3065. echo "CONFIG_ATTR=y" >> $config_host_mak
  3066. fi
  3067. if test "$libattr" = "yes" ; then
  3068. echo "CONFIG_LIBATTR=y" >> $config_host_mak
  3069. fi
  3070. if test "$virtfs" = "yes" ; then
  3071. echo "CONFIG_VIRTFS=y" >> $config_host_mak
  3072. fi
  3073. if test "$blobs" = "yes" ; then
  3074. echo "INSTALL_BLOBS=yes" >> $config_host_mak
  3075. fi
  3076. if test "$iovec" = "yes" ; then
  3077. echo "CONFIG_IOVEC=y" >> $config_host_mak
  3078. fi
  3079. if test "$preadv" = "yes" ; then
  3080. echo "CONFIG_PREADV=y" >> $config_host_mak
  3081. fi
  3082. if test "$fdt" = "yes" ; then
  3083. echo "CONFIG_FDT=y" >> $config_host_mak
  3084. fi
  3085. if test "$signalfd" = "yes" ; then
  3086. echo "CONFIG_SIGNALFD=y" >> $config_host_mak
  3087. fi
  3088. if test "$tcg_interpreter" = "yes" ; then
  3089. echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
  3090. fi
  3091. if test "$fdatasync" = "yes" ; then
  3092. echo "CONFIG_FDATASYNC=y" >> $config_host_mak
  3093. fi
  3094. if test "$madvise" = "yes" ; then
  3095. echo "CONFIG_MADVISE=y" >> $config_host_mak
  3096. fi
  3097. if test "$posix_madvise" = "yes" ; then
  3098. echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
  3099. fi
  3100. if test "$spice" = "yes" ; then
  3101. echo "CONFIG_SPICE=y" >> $config_host_mak
  3102. fi
  3103. if test "$smartcard" = "yes" ; then
  3104. echo "CONFIG_SMARTCARD=y" >> $config_host_mak
  3105. fi
  3106. if test "$smartcard_nss" = "yes" ; then
  3107. echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
  3108. echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
  3109. echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
  3110. fi
  3111. if test "$usb_redir" = "yes" ; then
  3112. echo "CONFIG_USB_REDIR=y" >> $config_host_mak
  3113. fi
  3114. if test "$opengl" = "yes" ; then
  3115. echo "CONFIG_OPENGL=y" >> $config_host_mak
  3116. fi
  3117. if test "$libiscsi" = "yes" ; then
  3118. echo "CONFIG_LIBISCSI=y" >> $config_host_mak
  3119. fi
  3120. # XXX: suppress that
  3121. if [ "$bsd" = "yes" ] ; then
  3122. echo "CONFIG_BSD=y" >> $config_host_mak
  3123. fi
  3124. echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
  3125. if test "$zero_malloc" = "yes" ; then
  3126. echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
  3127. fi
  3128. if test "$rbd" = "yes" ; then
  3129. echo "CONFIG_RBD=y" >> $config_host_mak
  3130. fi
  3131. if test "$coroutine_backend" = "ucontext" ; then
  3132. echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
  3133. elif test "$coroutine_backend" = "sigaltstack" ; then
  3134. echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
  3135. fi
  3136. if test "$open_by_handle_at" = "yes" ; then
  3137. echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
  3138. fi
  3139. if test "$linux_magic_h" = "yes" ; then
  3140. echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
  3141. fi
  3142. if test "$has_environ" = "yes" ; then
  3143. echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
  3144. fi
  3145. # USB host support
  3146. case "$usb" in
  3147. linux)
  3148. echo "HOST_USB=linux" >> $config_host_mak
  3149. ;;
  3150. bsd)
  3151. echo "HOST_USB=bsd" >> $config_host_mak
  3152. ;;
  3153. *)
  3154. echo "HOST_USB=stub" >> $config_host_mak
  3155. ;;
  3156. esac
  3157. # use default implementation for tracing backend-specific routines
  3158. trace_default=yes
  3159. echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
  3160. if test "$trace_backend" = "nop"; then
  3161. echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
  3162. fi
  3163. if test "$trace_backend" = "simple"; then
  3164. echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
  3165. trace_default=no
  3166. # Set the appropriate trace file.
  3167. trace_file="\"$trace_file-\" FMT_pid"
  3168. fi
  3169. if test "$trace_backend" = "stderr"; then
  3170. echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
  3171. trace_default=no
  3172. fi
  3173. if test "$trace_backend" = "ust"; then
  3174. echo "CONFIG_TRACE_UST=y" >> $config_host_mak
  3175. fi
  3176. if test "$trace_backend" = "dtrace"; then
  3177. echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
  3178. if test "$trace_backend_stap" = "yes" ; then
  3179. echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
  3180. fi
  3181. fi
  3182. echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
  3183. if test "$trace_default" = "yes"; then
  3184. echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
  3185. fi
  3186. echo "TOOLS=$tools" >> $config_host_mak
  3187. echo "ROMS=$roms" >> $config_host_mak
  3188. echo "MAKE=$make" >> $config_host_mak
  3189. echo "INSTALL=$install" >> $config_host_mak
  3190. echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
  3191. echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
  3192. echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
  3193. echo "PYTHON=$python" >> $config_host_mak
  3194. echo "CC=$cc" >> $config_host_mak
  3195. echo "CC_I386=$cc_i386" >> $config_host_mak
  3196. echo "HOST_CC=$host_cc" >> $config_host_mak
  3197. echo "AR=$ar" >> $config_host_mak
  3198. echo "OBJCOPY=$objcopy" >> $config_host_mak
  3199. echo "LD=$ld" >> $config_host_mak
  3200. echo "WINDRES=$windres" >> $config_host_mak
  3201. echo "LIBTOOL=$libtool" >> $config_host_mak
  3202. echo "CFLAGS=$CFLAGS" >> $config_host_mak
  3203. echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
  3204. echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
  3205. if test "$sparse" = "yes" ; then
  3206. echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
  3207. echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
  3208. echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
  3209. fi
  3210. echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
  3211. echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
  3212. echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
  3213. echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
  3214. echo "LIBS+=$LIBS" >> $config_host_mak
  3215. echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
  3216. echo "EXESUF=$EXESUF" >> $config_host_mak
  3217. echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
  3218. echo "POD2MAN=$POD2MAN" >> $config_host_mak
  3219. # generate list of library paths for linker script
  3220. $ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
  3221. if test -f ${config_host_ld}~ ; then
  3222. if cmp -s $config_host_ld ${config_host_ld}~ ; then
  3223. mv ${config_host_ld}~ $config_host_ld
  3224. else
  3225. rm ${config_host_ld}~
  3226. fi
  3227. fi
  3228. for d in libdis libdis-user; do
  3229. mkdir -p $d
  3230. symlink "$source_path/Makefile.dis" "$d/Makefile"
  3231. echo > $d/config.mak
  3232. done
  3233. # use included Linux headers
  3234. if test "$linux" = "yes" ; then
  3235. mkdir -p linux-headers
  3236. case "$cpu" in
  3237. i386|x86_64)
  3238. symlink "$source_path/linux-headers/asm-x86" linux-headers/asm
  3239. ;;
  3240. ppcemb|ppc|ppc64)
  3241. symlink "$source_path/linux-headers/asm-powerpc" linux-headers/asm
  3242. ;;
  3243. s390x)
  3244. symlink "$source_path/linux-headers/asm-s390" linux-headers/asm
  3245. ;;
  3246. esac
  3247. fi
  3248. for target in $target_list; do
  3249. target_dir="$target"
  3250. config_target_mak=$target_dir/config-target.mak
  3251. target_arch2=`echo $target | cut -d '-' -f 1`
  3252. target_bigendian="no"
  3253. case "$target_arch2" in
  3254. armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
  3255. target_bigendian=yes
  3256. ;;
  3257. esac
  3258. target_softmmu="no"
  3259. target_user_only="no"
  3260. target_linux_user="no"
  3261. target_bsd_user="no"
  3262. case "$target" in
  3263. ${target_arch2}-softmmu)
  3264. target_softmmu="yes"
  3265. ;;
  3266. ${target_arch2}-linux-user)
  3267. if test "$linux" != "yes" ; then
  3268. echo "ERROR: Target '$target' is only available on a Linux host"
  3269. exit 1
  3270. fi
  3271. target_user_only="yes"
  3272. target_linux_user="yes"
  3273. ;;
  3274. ${target_arch2}-bsd-user)
  3275. if test "$bsd" != "yes" ; then
  3276. echo "ERROR: Target '$target' is only available on a BSD host"
  3277. exit 1
  3278. fi
  3279. target_user_only="yes"
  3280. target_bsd_user="yes"
  3281. ;;
  3282. *)
  3283. echo "ERROR: Target '$target' not recognised"
  3284. exit 1
  3285. ;;
  3286. esac
  3287. mkdir -p $target_dir
  3288. mkdir -p $target_dir/fpu
  3289. mkdir -p $target_dir/tcg
  3290. mkdir -p $target_dir/ide
  3291. mkdir -p $target_dir/usb
  3292. mkdir -p $target_dir/9pfs
  3293. mkdir -p $target_dir/kvm
  3294. if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
  3295. mkdir -p $target_dir/nwfpe
  3296. fi
  3297. symlink "$source_path/Makefile.target" "$target_dir/Makefile"
  3298. echo "# Automatically generated by configure - do not modify" > $config_target_mak
  3299. bflt="no"
  3300. target_nptl="no"
  3301. interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
  3302. gdb_xml_files=""
  3303. target_short_alignment=2
  3304. target_int_alignment=4
  3305. target_long_alignment=4
  3306. target_llong_alignment=8
  3307. target_libs_softmmu=
  3308. TARGET_ARCH="$target_arch2"
  3309. TARGET_BASE_ARCH=""
  3310. TARGET_ABI_DIR=""
  3311. case "$target_arch2" in
  3312. i386)
  3313. target_phys_bits=64
  3314. ;;
  3315. x86_64)
  3316. TARGET_BASE_ARCH=i386
  3317. target_phys_bits=64
  3318. target_long_alignment=8
  3319. ;;
  3320. alpha)
  3321. target_phys_bits=64
  3322. target_long_alignment=8
  3323. target_nptl="yes"
  3324. ;;
  3325. arm|armeb)
  3326. TARGET_ARCH=arm
  3327. bflt="yes"
  3328. target_nptl="yes"
  3329. gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  3330. target_phys_bits=32
  3331. target_llong_alignment=4
  3332. target_libs_softmmu="$fdt_libs"
  3333. ;;
  3334. cris)
  3335. target_nptl="yes"
  3336. target_phys_bits=32
  3337. ;;
  3338. lm32)
  3339. target_phys_bits=32
  3340. target_libs_softmmu="$opengl_libs"
  3341. ;;
  3342. m68k)
  3343. bflt="yes"
  3344. gdb_xml_files="cf-core.xml cf-fp.xml"
  3345. target_phys_bits=32
  3346. target_int_alignment=2
  3347. target_long_alignment=2
  3348. target_llong_alignment=2
  3349. ;;
  3350. microblaze|microblazeel)
  3351. TARGET_ARCH=microblaze
  3352. bflt="yes"
  3353. target_nptl="yes"
  3354. target_phys_bits=32
  3355. target_libs_softmmu="$fdt_libs"
  3356. ;;
  3357. mips|mipsel)
  3358. TARGET_ARCH=mips
  3359. echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
  3360. target_nptl="yes"
  3361. target_phys_bits=64
  3362. ;;
  3363. mipsn32|mipsn32el)
  3364. TARGET_ARCH=mipsn32
  3365. TARGET_BASE_ARCH=mips
  3366. echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
  3367. target_phys_bits=64
  3368. ;;
  3369. mips64|mips64el)
  3370. TARGET_ARCH=mips64
  3371. TARGET_BASE_ARCH=mips
  3372. echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
  3373. target_phys_bits=64
  3374. target_long_alignment=8
  3375. ;;
  3376. ppc)
  3377. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  3378. target_phys_bits=64
  3379. target_nptl="yes"
  3380. target_libs_softmmu="$fdt_libs"
  3381. ;;
  3382. ppcemb)
  3383. TARGET_BASE_ARCH=ppc
  3384. TARGET_ABI_DIR=ppc
  3385. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  3386. target_phys_bits=64
  3387. target_nptl="yes"
  3388. target_libs_softmmu="$fdt_libs"
  3389. ;;
  3390. ppc64)
  3391. TARGET_BASE_ARCH=ppc
  3392. TARGET_ABI_DIR=ppc
  3393. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  3394. target_phys_bits=64
  3395. target_long_alignment=8
  3396. target_libs_softmmu="$fdt_libs"
  3397. ;;
  3398. ppc64abi32)
  3399. TARGET_ARCH=ppc64
  3400. TARGET_BASE_ARCH=ppc
  3401. TARGET_ABI_DIR=ppc
  3402. echo "TARGET_ABI32=y" >> $config_target_mak
  3403. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  3404. target_phys_bits=64
  3405. target_libs_softmmu="$fdt_libs"
  3406. ;;
  3407. sh4|sh4eb)
  3408. TARGET_ARCH=sh4
  3409. bflt="yes"
  3410. target_nptl="yes"
  3411. target_phys_bits=32
  3412. ;;
  3413. sparc)
  3414. target_phys_bits=64
  3415. ;;
  3416. sparc64)
  3417. TARGET_BASE_ARCH=sparc
  3418. target_phys_bits=64
  3419. target_long_alignment=8
  3420. ;;
  3421. sparc32plus)
  3422. TARGET_ARCH=sparc64
  3423. TARGET_BASE_ARCH=sparc
  3424. TARGET_ABI_DIR=sparc
  3425. echo "TARGET_ABI32=y" >> $config_target_mak
  3426. target_phys_bits=64
  3427. ;;
  3428. s390x)
  3429. target_nptl="yes"
  3430. target_phys_bits=64
  3431. target_long_alignment=8
  3432. ;;
  3433. unicore32)
  3434. target_phys_bits=32
  3435. ;;
  3436. xtensa|xtensaeb)
  3437. TARGET_ARCH=xtensa
  3438. target_phys_bits=32
  3439. ;;
  3440. *)
  3441. echo "Unsupported target CPU"
  3442. exit 1
  3443. ;;
  3444. esac
  3445. case "$target_arch2" in
  3446. alpha | sparc*)
  3447. echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
  3448. ;;
  3449. esac
  3450. echo "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
  3451. echo "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
  3452. echo "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
  3453. echo "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
  3454. echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
  3455. target_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
  3456. echo "TARGET_$target_arch_name=y" >> $config_target_mak
  3457. echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
  3458. # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
  3459. if [ "$TARGET_BASE_ARCH" = "" ]; then
  3460. TARGET_BASE_ARCH=$TARGET_ARCH
  3461. fi
  3462. echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
  3463. if [ "$TARGET_ABI_DIR" = "" ]; then
  3464. TARGET_ABI_DIR=$TARGET_ARCH
  3465. fi
  3466. echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
  3467. case "$target_arch2" in
  3468. i386|x86_64)
  3469. if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
  3470. target_phys_bits=64
  3471. echo "CONFIG_XEN=y" >> $config_target_mak
  3472. else
  3473. echo "CONFIG_NO_XEN=y" >> $config_target_mak
  3474. fi
  3475. ;;
  3476. *)
  3477. echo "CONFIG_NO_XEN=y" >> $config_target_mak
  3478. esac
  3479. case "$target_arch2" in
  3480. i386|x86_64|ppcemb|ppc|ppc64|s390x)
  3481. # Make sure the target and host cpus are compatible
  3482. if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
  3483. \( "$target_arch2" = "$cpu" -o \
  3484. \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
  3485. \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
  3486. \( "$target_arch2" = "ppc" -a "$cpu" = "ppc64" \) -o \
  3487. \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
  3488. \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
  3489. \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
  3490. echo "CONFIG_KVM=y" >> $config_target_mak
  3491. if test "$vhost_net" = "yes" ; then
  3492. echo "CONFIG_VHOST_NET=y" >> $config_target_mak
  3493. fi
  3494. fi
  3495. esac
  3496. if test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
  3497. echo "CONFIG_PSERIES=y" >> $config_target_mak
  3498. fi
  3499. if test "$target_bigendian" = "yes" ; then
  3500. echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
  3501. fi
  3502. if test "$target_softmmu" = "yes" ; then
  3503. echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
  3504. echo "CONFIG_SOFTMMU=y" >> $config_target_mak
  3505. echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
  3506. echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
  3507. echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
  3508. if test "$smartcard_nss" = "yes" ; then
  3509. echo "subdir-$target: subdir-libcacard" >> $config_host_mak
  3510. fi
  3511. fi
  3512. if test "$target_user_only" = "yes" ; then
  3513. echo "CONFIG_USER_ONLY=y" >> $config_target_mak
  3514. echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
  3515. fi
  3516. if test "$target_linux_user" = "yes" ; then
  3517. echo "CONFIG_LINUX_USER=y" >> $config_target_mak
  3518. fi
  3519. list=""
  3520. if test ! -z "$gdb_xml_files" ; then
  3521. for x in $gdb_xml_files; do
  3522. list="$list $source_path/gdb-xml/$x"
  3523. done
  3524. echo "TARGET_XML_FILES=$list" >> $config_target_mak
  3525. fi
  3526. if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
  3527. echo "TARGET_HAS_BFLT=y" >> $config_target_mak
  3528. fi
  3529. if test "$target_user_only" = "yes" \
  3530. -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
  3531. echo "CONFIG_USE_NPTL=y" >> $config_target_mak
  3532. fi
  3533. if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
  3534. echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
  3535. fi
  3536. if test "$target_bsd_user" = "yes" ; then
  3537. echo "CONFIG_BSD_USER=y" >> $config_target_mak
  3538. fi
  3539. # generate QEMU_CFLAGS/LDFLAGS for targets
  3540. cflags=""
  3541. includes=""
  3542. ldflags=""
  3543. if test "$tcg_interpreter" = "yes"; then
  3544. includes="-I\$(SRC_PATH)/tcg/tci $includes"
  3545. elif test "$ARCH" = "sparc64" ; then
  3546. includes="-I\$(SRC_PATH)/tcg/sparc $includes"
  3547. elif test "$ARCH" = "s390x" ; then
  3548. includes="-I\$(SRC_PATH)/tcg/s390 $includes"
  3549. elif test "$ARCH" = "x86_64" ; then
  3550. includes="-I\$(SRC_PATH)/tcg/i386 $includes"
  3551. else
  3552. includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
  3553. fi
  3554. includes="-I\$(SRC_PATH)/tcg $includes"
  3555. if test "$linux" = "yes" ; then
  3556. includes="-I\$(SRC_PATH)/linux-headers $includes"
  3557. fi
  3558. if test "$target_user_only" = "yes" ; then
  3559. libdis_config_mak=libdis-user/config.mak
  3560. else
  3561. libdis_config_mak=libdis/config.mak
  3562. fi
  3563. for i in $ARCH $TARGET_BASE_ARCH ; do
  3564. case "$i" in
  3565. alpha)
  3566. echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
  3567. echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
  3568. ;;
  3569. arm)
  3570. echo "CONFIG_ARM_DIS=y" >> $config_target_mak
  3571. echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
  3572. ;;
  3573. cris)
  3574. echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
  3575. echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
  3576. ;;
  3577. hppa)
  3578. echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
  3579. echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
  3580. ;;
  3581. i386|x86_64)
  3582. echo "CONFIG_I386_DIS=y" >> $config_target_mak
  3583. echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
  3584. ;;
  3585. ia64*)
  3586. echo "CONFIG_IA64_DIS=y" >> $config_target_mak
  3587. echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
  3588. ;;
  3589. lm32)
  3590. echo "CONFIG_LM32_DIS=y" >> $config_target_mak
  3591. echo "CONFIG_LM32_DIS=y" >> $libdis_config_mak
  3592. ;;
  3593. m68k)
  3594. echo "CONFIG_M68K_DIS=y" >> $config_target_mak
  3595. echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
  3596. ;;
  3597. microblaze*)
  3598. echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
  3599. echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
  3600. ;;
  3601. mips*)
  3602. echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
  3603. echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
  3604. ;;
  3605. ppc*)
  3606. echo "CONFIG_PPC_DIS=y" >> $config_target_mak
  3607. echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
  3608. ;;
  3609. s390*)
  3610. echo "CONFIG_S390_DIS=y" >> $config_target_mak
  3611. echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
  3612. ;;
  3613. sh4)
  3614. echo "CONFIG_SH4_DIS=y" >> $config_target_mak
  3615. echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
  3616. ;;
  3617. sparc*)
  3618. echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
  3619. echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
  3620. ;;
  3621. xtensa*)
  3622. echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
  3623. echo "CONFIG_XTENSA_DIS=y" >> $libdis_config_mak
  3624. ;;
  3625. esac
  3626. done
  3627. if test "$tcg_interpreter" = "yes" ; then
  3628. echo "CONFIG_TCI_DIS=y" >> $config_target_mak
  3629. echo "CONFIG_TCI_DIS=y" >> $libdis_config_mak
  3630. fi
  3631. case "$ARCH" in
  3632. alpha)
  3633. # Ensure there's only a single GP
  3634. cflags="-msmall-data $cflags"
  3635. ;;
  3636. esac
  3637. if test "$target_softmmu" = "yes" ; then
  3638. case "$TARGET_BASE_ARCH" in
  3639. arm)
  3640. cflags="-DHAS_AUDIO $cflags"
  3641. ;;
  3642. lm32)
  3643. cflags="-DHAS_AUDIO $cflags"
  3644. ;;
  3645. i386|mips|ppc)
  3646. cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
  3647. ;;
  3648. esac
  3649. fi
  3650. if test "$target_softmmu" = "yes" -a \( \
  3651. "$TARGET_ARCH" = "microblaze" -o \
  3652. "$TARGET_ARCH" = "cris" \) ; then
  3653. echo "CONFIG_NEED_MMU=y" >> $config_target_mak
  3654. fi
  3655. if test "$gprof" = "yes" ; then
  3656. echo "TARGET_GPROF=yes" >> $config_target_mak
  3657. if test "$target_linux_user" = "yes" ; then
  3658. cflags="-p $cflags"
  3659. ldflags="-p $ldflags"
  3660. fi
  3661. if test "$target_softmmu" = "yes" ; then
  3662. ldflags="-p $ldflags"
  3663. echo "GPROF_CFLAGS=-p" >> $config_target_mak
  3664. fi
  3665. fi
  3666. if test "$ARCH" = "tci"; then
  3667. linker_script=""
  3668. else
  3669. linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
  3670. fi
  3671. if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
  3672. case "$ARCH" in
  3673. sparc)
  3674. # -static is used to avoid g1/g3 usage by the dynamic linker
  3675. ldflags="$linker_script -static $ldflags"
  3676. ;;
  3677. alpha | s390x)
  3678. # The default placement of the application is fine.
  3679. ;;
  3680. *)
  3681. ldflags="$linker_script $ldflags"
  3682. ;;
  3683. esac
  3684. fi
  3685. echo "LDFLAGS+=$ldflags" >> $config_target_mak
  3686. echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
  3687. echo "QEMU_INCLUDES+=$includes" >> $config_target_mak
  3688. done # for target in $targets
  3689. # build tree in object directory in case the source is not in the current directory
  3690. DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
  3691. DIRS="$DIRS slirp audio block net pc-bios/optionrom"
  3692. DIRS="$DIRS pc-bios/spapr-rtas"
  3693. DIRS="$DIRS roms/seabios roms/vgabios"
  3694. DIRS="$DIRS fsdev ui usb"
  3695. DIRS="$DIRS qapi qapi-generated"
  3696. DIRS="$DIRS qga trace qom"
  3697. FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
  3698. FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
  3699. FILES="$FILES tests/tcg/lm32/Makefile"
  3700. FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
  3701. FILES="$FILES pc-bios/spapr-rtas/Makefile"
  3702. FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
  3703. for bios_file in \
  3704. $source_path/pc-bios/*.bin \
  3705. $source_path/pc-bios/*.rom \
  3706. $source_path/pc-bios/*.dtb \
  3707. $source_path/pc-bios/openbios-* \
  3708. $source_path/pc-bios/palcode-*
  3709. do
  3710. FILES="$FILES pc-bios/`basename $bios_file`"
  3711. done
  3712. mkdir -p $DIRS
  3713. for f in $FILES ; do
  3714. if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
  3715. symlink "$source_path/$f" "$f"
  3716. fi
  3717. done
  3718. # temporary config to build submodules
  3719. for rom in seabios vgabios ; do
  3720. config_mak=roms/$rom/config.mak
  3721. echo "# Automatically generated by configure - do not modify" > $config_mak
  3722. echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
  3723. echo "CC=$cc" >> $config_mak
  3724. echo "BCC=bcc" >> $config_mak
  3725. echo "CPP=${cross_prefix}cpp" >> $config_mak
  3726. echo "OBJCOPY=objcopy" >> $config_mak
  3727. echo "IASL=iasl" >> $config_mak
  3728. echo "LD=$ld" >> $config_mak
  3729. done
  3730. for hwlib in 32 64; do
  3731. d=libhw$hwlib
  3732. mkdir -p $d
  3733. mkdir -p $d/ide
  3734. mkdir -p $d/usb
  3735. symlink "$source_path/Makefile.hw" "$d/Makefile"
  3736. mkdir -p $d/9pfs
  3737. echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
  3738. done
  3739. if [ "$source_path" != `pwd` ]; then
  3740. # out of tree build
  3741. mkdir -p libcacard
  3742. symlink "$source_path/libcacard/Makefile" libcacard/Makefile
  3743. fi
  3744. d=libuser
  3745. mkdir -p $d
  3746. mkdir -p $d/trace
  3747. mkdir -p $d/qom
  3748. symlink "$source_path/Makefile.user" "$d/Makefile"
  3749. if test "$docs" = "yes" ; then
  3750. mkdir -p QMP
  3751. fi