configure 91 KB

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