configure 105 KB

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