configure 96 KB

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