configure 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818
  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}"
  16. TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
  17. TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
  18. TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
  19. trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
  20. # default parameters
  21. prefix=""
  22. interp_prefix="/usr/gnemul/qemu-%M"
  23. static="no"
  24. cross_prefix=""
  25. cc="gcc"
  26. audio_drv_list=""
  27. audio_card_list="ac97 es1370 sb16"
  28. audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
  29. host_cc="gcc"
  30. ar="ar"
  31. make="make"
  32. install="install"
  33. strip="strip"
  34. # parse CC options first
  35. for opt do
  36. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  37. case "$opt" in
  38. --cross-prefix=*) cross_prefix="$optarg"
  39. ;;
  40. --cc=*) cc="$optarg"
  41. ;;
  42. esac
  43. done
  44. # OS specific
  45. # Using uname is really, really broken. Once we have the right set of checks
  46. # we can eliminate it's usage altogether
  47. cc="${cross_prefix}${cc}"
  48. ar="${cross_prefix}${ar}"
  49. strip="${cross_prefix}${strip}"
  50. # check that the C compiler works.
  51. cat > $TMPC <<EOF
  52. int main(void) {}
  53. EOF
  54. if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
  55. : C compiler works ok
  56. else
  57. echo "ERROR: \"$cc\" either does not exist or does not work"
  58. exit 1
  59. fi
  60. check_define() {
  61. cat > $TMPC <<EOF
  62. #if !defined($1)
  63. #error Not defined
  64. #endif
  65. int main(void) { return 0; }
  66. EOF
  67. $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
  68. }
  69. if check_define __i386__ ; then
  70. cpu="i386"
  71. elif check_define __x86_64__ ; then
  72. cpu="x86_64"
  73. elif check_define __sparc__ ; then
  74. # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
  75. # They must be specified using --sparc_cpu
  76. if check_define __arch64__ ; then
  77. cpu="sparc64"
  78. else
  79. cpu="sparc"
  80. fi
  81. elif check_define _ARCH_PPC ; then
  82. if check_define _ARCH_PPC64 ; then
  83. cpu="ppc64"
  84. else
  85. cpu="ppc"
  86. fi
  87. else
  88. cpu=`uname -m`
  89. fi
  90. target_list=""
  91. case "$cpu" in
  92. i386|i486|i586|i686|i86pc|BePC)
  93. cpu="i386"
  94. ;;
  95. x86_64|amd64)
  96. cpu="x86_64"
  97. ;;
  98. alpha)
  99. cpu="alpha"
  100. ;;
  101. armv*b)
  102. cpu="armv4b"
  103. ;;
  104. armv*l)
  105. cpu="armv4l"
  106. ;;
  107. cris)
  108. cpu="cris"
  109. ;;
  110. parisc|parisc64)
  111. cpu="hppa"
  112. ;;
  113. ia64)
  114. cpu="ia64"
  115. ;;
  116. m68k)
  117. cpu="m68k"
  118. ;;
  119. mips)
  120. cpu="mips"
  121. ;;
  122. mips64)
  123. cpu="mips64"
  124. ;;
  125. ppc)
  126. cpu="ppc"
  127. ;;
  128. ppc64)
  129. cpu="ppc64"
  130. ;;
  131. s390*)
  132. cpu="s390"
  133. ;;
  134. sparc|sun4[cdmuv])
  135. cpu="sparc"
  136. ;;
  137. sparc64)
  138. cpu="sparc64"
  139. ;;
  140. *)
  141. cpu="unknown"
  142. ;;
  143. esac
  144. gprof="no"
  145. sparse="no"
  146. bigendian="no"
  147. mingw32="no"
  148. EXESUF=""
  149. gdbstub="yes"
  150. slirp="yes"
  151. vde="yes"
  152. fmod_lib=""
  153. fmod_inc=""
  154. oss_lib=""
  155. vnc_tls="yes"
  156. bsd="no"
  157. linux="no"
  158. solaris="no"
  159. kqemu="no"
  160. profiler="no"
  161. cocoa="no"
  162. check_gfx="yes"
  163. softmmu="yes"
  164. linux_user="no"
  165. darwin_user="no"
  166. bsd_user="no"
  167. build_docs="no"
  168. uname_release=""
  169. curses="yes"
  170. aio="yes"
  171. nptl="yes"
  172. mixemu="no"
  173. bluez="yes"
  174. kvm="yes"
  175. kerneldir=""
  176. aix="no"
  177. blobs="yes"
  178. fdt="yes"
  179. sdl_x11="no"
  180. # OS specific
  181. if check_define __linux__ ; then
  182. targetos="Linux"
  183. elif check_define _WIN32 ; then
  184. targetos='MINGW32'
  185. else
  186. targetos=`uname -s`
  187. fi
  188. case $targetos in
  189. CYGWIN*)
  190. mingw32="yes"
  191. OS_CFLAGS="-mno-cygwin"
  192. if [ "$cpu" = "i386" ] ; then
  193. kqemu="yes"
  194. fi
  195. audio_possible_drivers="sdl"
  196. ;;
  197. MINGW32*)
  198. mingw32="yes"
  199. if [ "$cpu" = "i386" ] ; then
  200. kqemu="yes"
  201. fi
  202. audio_possible_drivers="dsound sdl fmod"
  203. ;;
  204. GNU/kFreeBSD)
  205. audio_drv_list="oss"
  206. audio_possible_drivers="oss sdl esd pa"
  207. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  208. kqemu="yes"
  209. fi
  210. ;;
  211. FreeBSD)
  212. bsd="yes"
  213. audio_drv_list="oss"
  214. audio_possible_drivers="oss sdl esd pa"
  215. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  216. kqemu="yes"
  217. fi
  218. ;;
  219. NetBSD)
  220. bsd="yes"
  221. audio_drv_list="oss"
  222. audio_possible_drivers="oss sdl esd"
  223. oss_lib="-lossaudio"
  224. ;;
  225. OpenBSD)
  226. bsd="yes"
  227. openbsd="yes"
  228. audio_drv_list="oss"
  229. audio_possible_drivers="oss sdl esd"
  230. oss_lib="-lossaudio"
  231. ;;
  232. Darwin)
  233. bsd="yes"
  234. darwin="yes"
  235. # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
  236. if [ "$cpu" = "i386" ] ; then
  237. is_x86_64=`sysctl -n hw.optional.x86_64`
  238. [ "$is_x86_64" = "1" ] && cpu=x86_64
  239. fi
  240. if [ "$cpu" = "x86_64" ] ; then
  241. OS_CFLAGS="-arch x86_64"
  242. LDFLAGS="-arch x86_64"
  243. else
  244. OS_CFLAGS="-mdynamic-no-pic"
  245. fi
  246. darwin_user="yes"
  247. cocoa="yes"
  248. audio_drv_list="coreaudio"
  249. audio_possible_drivers="coreaudio sdl fmod"
  250. OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
  251. ;;
  252. SunOS)
  253. solaris="yes"
  254. make="gmake"
  255. install="ginstall"
  256. needs_libsunmath="no"
  257. solarisrev=`uname -r | cut -f2 -d.`
  258. # have to select again, because `uname -m` returns i86pc
  259. # even on an x86_64 box.
  260. solariscpu=`isainfo -k`
  261. if test "${solariscpu}" = "amd64" ; then
  262. cpu="x86_64"
  263. fi
  264. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  265. if test "$solarisrev" -le 9 ; then
  266. if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
  267. needs_libsunmath="yes"
  268. else
  269. echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
  270. echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
  271. echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
  272. echo "Studio 11 can be downloaded from www.sun.com."
  273. exit 1
  274. fi
  275. fi
  276. if test "$solarisrev" -ge 9 ; then
  277. kqemu="yes"
  278. fi
  279. fi
  280. if test -f /usr/include/sys/soundcard.h ; then
  281. audio_drv_list="oss"
  282. fi
  283. audio_possible_drivers="oss sdl"
  284. ;;
  285. AIX)
  286. aix="yes"
  287. make="gmake"
  288. ;;
  289. *)
  290. audio_drv_list="oss"
  291. audio_possible_drivers="oss alsa sdl esd pa"
  292. linux="yes"
  293. linux_user="yes"
  294. usb="linux"
  295. if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
  296. kqemu="yes"
  297. audio_possible_drivers="$audio_possible_drivers fmod"
  298. fi
  299. ;;
  300. esac
  301. if [ "$bsd" = "yes" ] ; then
  302. if [ "$darwin" != "yes" ] ; then
  303. make="gmake"
  304. usb="bsd"
  305. fi
  306. bsd_user="yes"
  307. fi
  308. # find source path
  309. source_path=`dirname "$0"`
  310. source_path_used="no"
  311. workdir=`pwd`
  312. if [ -z "$source_path" ]; then
  313. source_path=$workdir
  314. else
  315. source_path=`cd "$source_path"; pwd`
  316. fi
  317. [ -f "$workdir/vl.c" ] || source_path_used="yes"
  318. werror="no"
  319. # generate compile errors on warnings for development builds
  320. #if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
  321. #werror="yes";
  322. #fi
  323. for opt do
  324. optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
  325. case "$opt" in
  326. --help|-h) show_help=yes
  327. ;;
  328. --prefix=*) prefix="$optarg"
  329. ;;
  330. --interp-prefix=*) interp_prefix="$optarg"
  331. ;;
  332. --source-path=*) source_path="$optarg"
  333. source_path_used="yes"
  334. ;;
  335. --cross-prefix=*)
  336. ;;
  337. --cc=*)
  338. ;;
  339. --host-cc=*) host_cc="$optarg"
  340. ;;
  341. --make=*) make="$optarg"
  342. ;;
  343. --install=*) install="$optarg"
  344. ;;
  345. --extra-cflags=*) CFLAGS="$optarg"
  346. ;;
  347. --extra-ldflags=*) LDFLAGS="$optarg"
  348. ;;
  349. --cpu=*) cpu="$optarg"
  350. ;;
  351. --target-list=*) target_list="$optarg"
  352. ;;
  353. --enable-gprof) gprof="yes"
  354. ;;
  355. --static) static="yes"
  356. ;;
  357. --disable-sdl) sdl="no"
  358. ;;
  359. --fmod-lib=*) fmod_lib="$optarg"
  360. ;;
  361. --fmod-inc=*) fmod_inc="$optarg"
  362. ;;
  363. --oss-lib=*) oss_lib="$optarg"
  364. ;;
  365. --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
  366. ;;
  367. --audio-drv-list=*) audio_drv_list="$optarg"
  368. ;;
  369. --enable-sparse) sparse="yes"
  370. ;;
  371. --disable-sparse) sparse="no"
  372. ;;
  373. --disable-vnc-tls) vnc_tls="no"
  374. ;;
  375. --disable-slirp) slirp="no"
  376. ;;
  377. --disable-vde) vde="no"
  378. ;;
  379. --disable-kqemu) kqemu="no"
  380. ;;
  381. --disable-brlapi) brlapi="no"
  382. ;;
  383. --disable-bluez) bluez="no"
  384. ;;
  385. --disable-kvm) kvm="no"
  386. ;;
  387. --enable-profiler) profiler="yes"
  388. ;;
  389. --enable-cocoa)
  390. cocoa="yes" ;
  391. sdl="no" ;
  392. audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
  393. ;;
  394. --disable-gfx-check) check_gfx="no"
  395. ;;
  396. --disable-system) softmmu="no"
  397. ;;
  398. --enable-system) softmmu="yes"
  399. ;;
  400. --disable-linux-user) linux_user="no"
  401. ;;
  402. --enable-linux-user) linux_user="yes"
  403. ;;
  404. --disable-darwin-user) darwin_user="no"
  405. ;;
  406. --enable-darwin-user) darwin_user="yes"
  407. ;;
  408. --disable-bsd-user) bsd_user="no"
  409. ;;
  410. --enable-bsd-user) bsd_user="yes"
  411. ;;
  412. --enable-uname-release=*) uname_release="$optarg"
  413. ;;
  414. --sparc_cpu=*)
  415. sparc_cpu="$optarg"
  416. case $sparc_cpu in
  417. v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
  418. target_cpu="sparc"; cpu="sparc" ;;
  419. v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
  420. target_cpu="sparc"; cpu="sparc" ;;
  421. v9) SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
  422. target_cpu="sparc64"; cpu="sparc64" ;;
  423. *) echo "undefined SPARC architecture. Exiting";exit 1;;
  424. esac
  425. ;;
  426. --enable-werror) werror="yes"
  427. ;;
  428. --disable-werror) werror="no"
  429. ;;
  430. --disable-curses) curses="no"
  431. ;;
  432. --disable-nptl) nptl="no"
  433. ;;
  434. --enable-mixemu) mixemu="yes"
  435. ;;
  436. --disable-aio) aio="no"
  437. ;;
  438. --disable-blobs) blobs="no"
  439. ;;
  440. --kerneldir=*) kerneldir="$optarg"
  441. ;;
  442. *) echo "ERROR: unknown option $opt"; show_help="yes"
  443. ;;
  444. esac
  445. done
  446. # default flags for all hosts
  447. CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
  448. CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
  449. LDFLAGS="$LDFLAGS -g"
  450. if test "$werror" = "yes" ; then
  451. CFLAGS="$CFLAGS -Werror"
  452. fi
  453. if test "$solaris" = "no" ; then
  454. if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
  455. LDFLAGS="$LDFLAGS -Wl,--warn-common"
  456. fi
  457. fi
  458. #
  459. # If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
  460. # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
  461. #
  462. case "$cpu" in
  463. sparc) if test -z "$sparc_cpu" ; then
  464. ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
  465. ARCH_LDFLAGS="-m32"
  466. else
  467. ARCH_CFLAGS="${SP_CFLAGS}"
  468. ARCH_LDFLAGS="${SP_LDFLAGS}"
  469. fi
  470. ;;
  471. sparc64) if test -z "$sparc_cpu" ; then
  472. ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
  473. ARCH_LDFLAGS="-m64"
  474. else
  475. ARCH_CFLAGS="${SP_CFLAGS}"
  476. ARCH_LDFLAGS="${SP_LDFLAGS}"
  477. fi
  478. ;;
  479. s390)
  480. ARCH_CFLAGS="-march=z900"
  481. ;;
  482. i386)
  483. ARCH_CFLAGS="-m32"
  484. ARCH_LDFLAGS="-m32"
  485. ;;
  486. x86_64)
  487. ARCH_CFLAGS="-m64"
  488. ARCH_LDFLAGS="-m64"
  489. ;;
  490. esac
  491. if test x"$show_help" = x"yes" ; then
  492. cat << EOF
  493. Usage: configure [options]
  494. Options: [defaults in brackets after descriptions]
  495. EOF
  496. echo "Standard options:"
  497. echo " --help print this message"
  498. echo " --prefix=PREFIX install in PREFIX [$prefix]"
  499. echo " --interp-prefix=PREFIX where to find shared libraries, etc."
  500. echo " use %M for cpu name [$interp_prefix]"
  501. echo " --target-list=LIST set target list [$target_list]"
  502. echo ""
  503. echo "kqemu kernel acceleration support:"
  504. echo " --disable-kqemu disable kqemu support"
  505. echo ""
  506. echo "Advanced options (experts only):"
  507. echo " --source-path=PATH path of source code [$source_path]"
  508. echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
  509. echo " --cc=CC use C compiler CC [$cc]"
  510. echo " --host-cc=CC use C compiler CC [$host_cc] for dyngen etc."
  511. echo " --make=MAKE use specified make [$make]"
  512. echo " --install=INSTALL use specified install [$install]"
  513. echo " --static enable static build [$static]"
  514. echo " --enable-sparse enable sparse checker"
  515. echo " --disable-sparse disable sparse checker (default)"
  516. echo " --disable-werror disable compilation abort on warning"
  517. echo " --disable-sdl disable SDL"
  518. echo " --enable-cocoa enable COCOA (Mac OS X only)"
  519. echo " --audio-drv-list=LIST set audio drivers list:"
  520. echo " Available drivers: $audio_possible_drivers"
  521. echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
  522. echo " Available cards: $audio_possible_cards"
  523. echo " --enable-mixemu enable mixer emulation"
  524. echo " --disable-brlapi disable BrlAPI"
  525. echo " --disable-vnc-tls disable TLS encryption for VNC server"
  526. echo " --disable-curses disable curses output"
  527. echo " --disable-bluez disable bluez stack connectivity"
  528. echo " --disable-kvm disable KVM acceleration support"
  529. echo " --disable-nptl disable usermode NPTL support"
  530. echo " --enable-system enable all system emulation targets"
  531. echo " --disable-system disable all system emulation targets"
  532. echo " --enable-linux-user enable all linux usermode emulation targets"
  533. echo " --disable-linux-user disable all linux usermode emulation targets"
  534. echo " --enable-darwin-user enable all darwin usermode emulation targets"
  535. echo " --disable-darwin-user disable all darwin usermode emulation targets"
  536. echo " --enable-bsd-user enable all BSD usermode emulation targets"
  537. echo " --disable-bsd-user disable all BSD usermode emulation targets"
  538. echo " --fmod-lib path to FMOD library"
  539. echo " --fmod-inc path to FMOD includes"
  540. echo " --oss-lib path to OSS library"
  541. echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
  542. echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
  543. echo " --disable-vde disable support for vde network"
  544. echo " --disable-aio disable AIO support"
  545. echo " --disable-blobs disable installing provided firmware blobs"
  546. echo " --kerneldir=PATH look for kernel includes in PATH"
  547. echo ""
  548. echo "NOTE: The object files are built at the place where configure is launched"
  549. exit 1
  550. fi
  551. if test "$mingw32" = "yes" ; then
  552. linux="no"
  553. EXESUF=".exe"
  554. oss="no"
  555. linux_user="no"
  556. bsd_user="no"
  557. fi
  558. if test ! -x "$(which cgcc 2>/dev/null)"; then
  559. sparse="no"
  560. fi
  561. #
  562. # Solaris specific configure tool chain decisions
  563. #
  564. if test "$solaris" = "yes" ; then
  565. solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
  566. if test -z "$solinst" ; then
  567. echo "Solaris install program not found. Use --install=/usr/ucb/install or"
  568. echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
  569. echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
  570. exit 1
  571. fi
  572. if test "$solinst" = "/usr/sbin/install" ; then
  573. echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
  574. echo "try ginstall from the GNU fileutils available from www.blastwave.org"
  575. echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
  576. exit 1
  577. fi
  578. sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
  579. if test -z "$sol_ar" ; then
  580. echo "Error: No path includes ar"
  581. if test -f /usr/ccs/bin/ar ; then
  582. echo "Add /usr/ccs/bin to your path and rerun configure"
  583. fi
  584. exit 1
  585. fi
  586. fi
  587. if test -z "$target_list" ; then
  588. # these targets are portable
  589. if [ "$softmmu" = "yes" ] ; then
  590. target_list="\
  591. i386-softmmu \
  592. x86_64-softmmu \
  593. arm-softmmu \
  594. cris-softmmu \
  595. m68k-softmmu \
  596. mips-softmmu \
  597. mipsel-softmmu \
  598. mips64-softmmu \
  599. mips64el-softmmu \
  600. ppc-softmmu \
  601. ppcemb-softmmu \
  602. ppc64-softmmu \
  603. sh4-softmmu \
  604. sh4eb-softmmu \
  605. sparc-softmmu \
  606. "
  607. fi
  608. # the following are Linux specific
  609. if [ "$linux_user" = "yes" ] ; then
  610. target_list="${target_list}\
  611. i386-linux-user \
  612. x86_64-linux-user \
  613. alpha-linux-user \
  614. arm-linux-user \
  615. armeb-linux-user \
  616. cris-linux-user \
  617. m68k-linux-user \
  618. mips-linux-user \
  619. mipsel-linux-user \
  620. ppc-linux-user \
  621. ppc64-linux-user \
  622. ppc64abi32-linux-user \
  623. sh4-linux-user \
  624. sh4eb-linux-user \
  625. sparc-linux-user \
  626. sparc64-linux-user \
  627. sparc32plus-linux-user \
  628. "
  629. fi
  630. # the following are Darwin specific
  631. if [ "$darwin_user" = "yes" ] ; then
  632. target_list="$target_list i386-darwin-user ppc-darwin-user "
  633. fi
  634. # the following are BSD specific
  635. if [ "$bsd_user" = "yes" ] ; then
  636. target_list="${target_list}\
  637. sparc64-bsd-user \
  638. "
  639. fi
  640. else
  641. target_list=`echo "$target_list" | sed -e 's/,/ /g'`
  642. fi
  643. if test -z "$target_list" ; then
  644. echo "No targets enabled"
  645. exit 1
  646. fi
  647. if test -z "$cross_prefix" ; then
  648. # ---
  649. # big/little endian test
  650. cat > $TMPC << EOF
  651. #include <inttypes.h>
  652. int main(int argc, char ** argv){
  653. volatile uint32_t i=0x01234567;
  654. return (*((uint8_t*)(&i))) == 0x67;
  655. }
  656. EOF
  657. if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
  658. $TMPE && bigendian="yes"
  659. else
  660. echo big/little test failed
  661. fi
  662. else
  663. # if cross compiling, cannot launch a program, so make a static guess
  664. if test "$cpu" = "armv4b" \
  665. -o "$cpu" = "hppa" \
  666. -o "$cpu" = "m68k" \
  667. -o "$cpu" = "mips" \
  668. -o "$cpu" = "mips64" \
  669. -o "$cpu" = "ppc" \
  670. -o "$cpu" = "ppc64" \
  671. -o "$cpu" = "s390" \
  672. -o "$cpu" = "sparc" \
  673. -o "$cpu" = "sparc64"; then
  674. bigendian="yes"
  675. fi
  676. fi
  677. # host long bits test
  678. hostlongbits="32"
  679. if test "$cpu" = "x86_64" \
  680. -o "$cpu" = "alpha" \
  681. -o "$cpu" = "ia64" \
  682. -o "$cpu" = "sparc64" \
  683. -o "$cpu" = "ppc64"; then
  684. hostlongbits="64"
  685. fi
  686. # check gcc options support
  687. cat > $TMPC <<EOF
  688. int main(void) {
  689. }
  690. EOF
  691. # Check host NPTL support
  692. cat > $TMPC <<EOF
  693. #include <sched.h>
  694. #include <linux/futex.h>
  695. void foo()
  696. {
  697. #if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
  698. #error bork
  699. #endif
  700. }
  701. EOF
  702. if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
  703. :
  704. else
  705. nptl="no"
  706. fi
  707. ##########################################
  708. # zlib check
  709. cat > $TMPC << EOF
  710. #include <zlib.h>
  711. int main(void) { zlibVersion(); return 0; }
  712. EOF
  713. if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
  714. :
  715. else
  716. echo
  717. echo "Error: zlib check failed"
  718. echo "Make sure to have the zlib libs and headers installed."
  719. echo
  720. exit 1
  721. fi
  722. ##########################################
  723. # SDL probe
  724. sdl_too_old=no
  725. if test -z "$sdl" ; then
  726. sdl_config="sdl-config"
  727. sdl=no
  728. sdl_static=no
  729. cat > $TMPC << EOF
  730. #include <SDL.h>
  731. #undef main /* We don't want SDL to override our main() */
  732. int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
  733. EOF
  734. if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
  735. _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
  736. if test "$_sdlversion" -lt 121 ; then
  737. sdl_too_old=yes
  738. else
  739. if test "$cocoa" = "no" ; then
  740. sdl=yes
  741. fi
  742. fi
  743. # static link with sdl ?
  744. if test "$sdl" = "yes" ; then
  745. aa="no"
  746. `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
  747. sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
  748. if [ "$aa" = "yes" ] ; then
  749. sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
  750. fi
  751. if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
  752. sdl_static=yes
  753. fi
  754. fi # static link
  755. fi # sdl compile test
  756. else
  757. # Make sure to disable cocoa if sdl was set
  758. if test "$sdl" = "yes" ; then
  759. cocoa="no"
  760. audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
  761. fi
  762. fi # -z $sdl
  763. if test "$sdl" = "yes" ; then
  764. cat > $TMPC <<EOF
  765. #include <SDL.h>
  766. #if defined(SDL_VIDEO_DRIVER_X11)
  767. #include <X11/XKBlib.h>
  768. #else
  769. #error No x11 support
  770. #endif
  771. int main(void) { return 0; }
  772. EOF
  773. if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
  774. sdl_x11="yes"
  775. fi
  776. fi
  777. ##########################################
  778. # VNC TLS detection
  779. if test "$vnc_tls" = "yes" ; then
  780. cat > $TMPC <<EOF
  781. #include <gnutls/gnutls.h>
  782. int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
  783. EOF
  784. vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
  785. vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
  786. if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
  787. $vnc_tls_libs > /dev/null 2> /dev/null ; then
  788. :
  789. else
  790. vnc_tls="no"
  791. fi
  792. fi
  793. ##########################################
  794. # vde libraries probe
  795. if test "$vde" = "yes" ; then
  796. cat > $TMPC << EOF
  797. #include <libvdeplug.h>
  798. int main(void)
  799. {
  800. struct vde_open_args a = {0, 0, 0};
  801. vde_open("", "", &a);
  802. return 0;
  803. }
  804. EOF
  805. if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
  806. :
  807. else
  808. vde="no"
  809. fi
  810. fi
  811. ##########################################
  812. # Sound support libraries probe
  813. audio_drv_probe()
  814. {
  815. drv=$1
  816. hdr=$2
  817. lib=$3
  818. exp=$4
  819. cfl=$5
  820. cat > $TMPC << EOF
  821. #include <$hdr>
  822. int main(void) { $exp }
  823. EOF
  824. if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
  825. :
  826. else
  827. echo
  828. echo "Error: $drv check failed"
  829. echo "Make sure to have the $drv libs and headers installed."
  830. echo
  831. exit 1
  832. fi
  833. }
  834. audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
  835. for drv in $audio_drv_list; do
  836. case $drv in
  837. alsa)
  838. audio_drv_probe $drv alsa/asoundlib.h -lasound \
  839. "snd_pcm_t **handle; return snd_pcm_close(*handle);"
  840. ;;
  841. fmod)
  842. if test -z $fmod_lib || test -z $fmod_inc; then
  843. echo
  844. echo "Error: You must specify path to FMOD library and headers"
  845. echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
  846. echo
  847. exit 1
  848. fi
  849. audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
  850. ;;
  851. esd)
  852. audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
  853. ;;
  854. pa)
  855. audio_drv_probe $drv pulse/simple.h -lpulse-simple \
  856. "pa_simple *s = NULL; pa_simple_free(s); return 0;"
  857. ;;
  858. oss|sdl|core|wav|dsound)
  859. # XXX: Probes for CoreAudio, DirectSound, SDL(?)
  860. ;;
  861. *)
  862. echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
  863. echo
  864. echo "Error: Unknown driver '$drv' selected"
  865. echo "Possible drivers are: $audio_possible_drivers"
  866. echo
  867. exit 1
  868. }
  869. ;;
  870. esac
  871. done
  872. ##########################################
  873. # BrlAPI probe
  874. if test -z "$brlapi" ; then
  875. brlapi=no
  876. cat > $TMPC << EOF
  877. #include <brlapi.h>
  878. int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
  879. EOF
  880. if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
  881. brlapi=yes
  882. fi # brlapi compile test
  883. fi # -z $brlapi
  884. ##########################################
  885. # curses probe
  886. if test "$curses" = "yes" ; then
  887. curses=no
  888. cat > $TMPC << EOF
  889. #include <curses.h>
  890. int main(void) { return curses_version(); }
  891. EOF
  892. if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
  893. curses=yes
  894. fi
  895. fi # test "$curses"
  896. ##########################################
  897. # bluez support probe
  898. if test "$bluez" = "yes" ; then
  899. `pkg-config bluez` || bluez="no"
  900. fi
  901. if test "$bluez" = "yes" ; then
  902. cat > $TMPC << EOF
  903. #include <bluetooth/bluetooth.h>
  904. int main(void) { return bt_error(0); }
  905. EOF
  906. bluez_cflags=`pkg-config --cflags bluez`
  907. bluez_libs=`pkg-config --libs bluez`
  908. if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
  909. $bluez_libs > /dev/null 2> /dev/null ; then
  910. :
  911. else
  912. bluez="no"
  913. fi
  914. fi
  915. ##########################################
  916. # kvm probe
  917. if test "$kvm" = "yes" ; then
  918. cat > $TMPC <<EOF
  919. #include <linux/kvm.h>
  920. #if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
  921. #error Invalid KVM version
  922. #endif
  923. #if !defined(KVM_CAP_USER_MEMORY)
  924. #error Missing KVM capability KVM_CAP_USER_MEMORY
  925. #endif
  926. #if !defined(KVM_CAP_SET_TSS_ADDR)
  927. #error Missing KVM capability KVM_CAP_SET_TSS_ADDR
  928. #endif
  929. #if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
  930. #error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
  931. #endif
  932. int main(void) { return 0; }
  933. EOF
  934. if test "$kerneldir" != "" ; then
  935. kvm_cflags=-I"$kerneldir"/include
  936. if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
  937. -a -d "$kerneldir/arch/x86/include" ; then
  938. kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
  939. elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
  940. kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
  941. elif test -d "$kerneldir/arch/$cpu/include" ; then
  942. kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
  943. fi
  944. else
  945. kvm_cflags=""
  946. fi
  947. if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
  948. > /dev/null 2>/dev/null ; then
  949. :
  950. else
  951. kvm="no";
  952. if [ -x "`which awk 2>/dev/null`" ] && \
  953. [ -x "`which grep 2>/dev/null`" ]; then
  954. kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
  955. | grep "error: " \
  956. | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
  957. if test "$kvmerr" != "" ; then
  958. kvm="no - (${kvmerr})"
  959. fi
  960. fi
  961. fi
  962. fi
  963. ##########################################
  964. # AIO probe
  965. AIOLIBS=""
  966. if test "$aio" = "yes" ; then
  967. aio=no
  968. cat > $TMPC << EOF
  969. #include <pthread.h>
  970. int main(void) { pthread_mutex_t lock; return 0; }
  971. EOF
  972. if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
  973. aio=yes
  974. AIOLIBS="-lpthread"
  975. fi
  976. fi
  977. ##########################################
  978. # iovec probe
  979. cat > $TMPC <<EOF
  980. #include <sys/types.h>
  981. #include <sys/uio.h>
  982. #include <unistd.h>
  983. int main(void) { struct iovec iov; return 0; }
  984. EOF
  985. iovec=no
  986. if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
  987. iovec=yes
  988. fi
  989. ##########################################
  990. # fdt probe
  991. if test "$fdt" = "yes" ; then
  992. fdt=no
  993. cat > $TMPC << EOF
  994. int main(void) { return 0; }
  995. EOF
  996. if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
  997. fdt=yes
  998. fi
  999. fi
  1000. # Check if tools are available to build documentation.
  1001. if [ -x "`which texi2html 2>/dev/null`" ] && \
  1002. [ -x "`which pod2man 2>/dev/null`" ]; then
  1003. build_docs="yes"
  1004. fi
  1005. ##########################################
  1006. # Do we need librt
  1007. cat > $TMPC <<EOF
  1008. #include <signal.h>
  1009. #include <time.h>
  1010. int main(void) { clockid_t id; return clock_gettime(id, NULL); }
  1011. EOF
  1012. rt=no
  1013. if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
  1014. :
  1015. elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
  1016. rt=yes
  1017. fi
  1018. if test "$rt" = "yes" ; then
  1019. # Hack, we should have a general purpose LIBS for this sort of thing
  1020. AIOLIBS="$AIOLIBS -lrt"
  1021. fi
  1022. if test "$mingw32" = "yes" ; then
  1023. if test -z "$prefix" ; then
  1024. prefix="c:\\\\Program Files\\\\Qemu"
  1025. fi
  1026. mansuffix=""
  1027. datasuffix=""
  1028. docsuffix=""
  1029. binsuffix=""
  1030. else
  1031. if test -z "$prefix" ; then
  1032. prefix="/usr/local"
  1033. fi
  1034. mansuffix="/share/man"
  1035. datasuffix="/share/qemu"
  1036. docsuffix="/share/doc/qemu"
  1037. binsuffix="/bin"
  1038. fi
  1039. echo "Install prefix $prefix"
  1040. echo "BIOS directory $prefix$datasuffix"
  1041. echo "binary directory $prefix$binsuffix"
  1042. if test "$mingw32" = "no" ; then
  1043. echo "Manual directory $prefix$mansuffix"
  1044. echo "ELF interp prefix $interp_prefix"
  1045. fi
  1046. echo "Source path $source_path"
  1047. echo "C compiler $cc"
  1048. echo "Host C compiler $host_cc"
  1049. echo "ARCH_CFLAGS $ARCH_CFLAGS"
  1050. echo "make $make"
  1051. echo "install $install"
  1052. echo "host CPU $cpu"
  1053. echo "host big endian $bigendian"
  1054. echo "target list $target_list"
  1055. echo "gprof enabled $gprof"
  1056. echo "sparse enabled $sparse"
  1057. echo "profiler $profiler"
  1058. echo "static build $static"
  1059. echo "-Werror enabled $werror"
  1060. if test "$darwin" = "yes" ; then
  1061. echo "Cocoa support $cocoa"
  1062. fi
  1063. echo "SDL support $sdl"
  1064. if test "$sdl" != "no" ; then
  1065. echo "SDL static link $sdl_static"
  1066. fi
  1067. echo "curses support $curses"
  1068. echo "mingw32 support $mingw32"
  1069. echo "Audio drivers $audio_drv_list"
  1070. echo "Extra audio cards $audio_card_list"
  1071. echo "Mixer emulation $mixemu"
  1072. echo "VNC TLS support $vnc_tls"
  1073. if test "$vnc_tls" = "yes" ; then
  1074. echo " TLS CFLAGS $vnc_tls_cflags"
  1075. echo " TLS LIBS $vnc_tls_libs"
  1076. fi
  1077. if test -n "$sparc_cpu"; then
  1078. echo "Target Sparc Arch $sparc_cpu"
  1079. fi
  1080. echo "kqemu support $kqemu"
  1081. echo "brlapi support $brlapi"
  1082. echo "Documentation $build_docs"
  1083. [ ! -z "$uname_release" ] && \
  1084. echo "uname -r $uname_release"
  1085. echo "NPTL support $nptl"
  1086. echo "vde support $vde"
  1087. echo "AIO support $aio"
  1088. echo "Install blobs $blobs"
  1089. echo "KVM support $kvm"
  1090. echo "fdt support $fdt"
  1091. if test $sdl_too_old = "yes"; then
  1092. echo "-> Your SDL version is too old - please upgrade to have SDL support"
  1093. fi
  1094. if [ -s $TMPSDLLOG ]; then
  1095. echo "The error log from compiling the libSDL test is: "
  1096. cat $TMPSDLLOG
  1097. fi
  1098. #if test "$sdl_static" = "no"; then
  1099. # echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
  1100. #fi
  1101. config_mak="config-host.mak"
  1102. config_h="config-host.h"
  1103. #echo "Creating $config_mak and $config_h"
  1104. test -f $config_h && mv $config_h ${config_h}~
  1105. echo "# Automatically generated by configure - do not modify" > $config_mak
  1106. printf "# Configured with:" >> $config_mak
  1107. printf " '%s'" "$0" "$@" >> $config_mak
  1108. echo >> $config_mak
  1109. echo "/* Automatically generated by configure - do not modify */" > $config_h
  1110. echo "prefix=$prefix" >> $config_mak
  1111. echo "bindir=\${prefix}$binsuffix" >> $config_mak
  1112. echo "mandir=\${prefix}$mansuffix" >> $config_mak
  1113. echo "datadir=\${prefix}$datasuffix" >> $config_mak
  1114. echo "docdir=\${prefix}$docsuffix" >> $config_mak
  1115. echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
  1116. echo "MAKE=$make" >> $config_mak
  1117. echo "INSTALL=$install" >> $config_mak
  1118. echo "CC=$cc" >> $config_mak
  1119. echo "HOST_CC=$host_cc" >> $config_mak
  1120. echo "AR=$ar" >> $config_mak
  1121. echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
  1122. # XXX: only use CFLAGS and LDFLAGS ?
  1123. # XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
  1124. # compilation of dyngen tool (useful for win32 build on Linux host)
  1125. echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
  1126. echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
  1127. echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
  1128. echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
  1129. echo "CFLAGS=$CFLAGS" >> $config_mak
  1130. echo "LDFLAGS=$LDFLAGS" >> $config_mak
  1131. echo "EXESUF=$EXESUF" >> $config_mak
  1132. echo "AIOLIBS=$AIOLIBS" >> $config_mak
  1133. case "$cpu" in
  1134. i386)
  1135. echo "ARCH=i386" >> $config_mak
  1136. echo "#define HOST_I386 1" >> $config_h
  1137. ;;
  1138. x86_64)
  1139. echo "ARCH=x86_64" >> $config_mak
  1140. echo "#define HOST_X86_64 1" >> $config_h
  1141. ;;
  1142. alpha)
  1143. echo "ARCH=alpha" >> $config_mak
  1144. echo "#define HOST_ALPHA 1" >> $config_h
  1145. ;;
  1146. armv4b)
  1147. echo "ARCH=arm" >> $config_mak
  1148. echo "#define HOST_ARM 1" >> $config_h
  1149. ;;
  1150. armv4l)
  1151. echo "ARCH=arm" >> $config_mak
  1152. echo "#define HOST_ARM 1" >> $config_h
  1153. ;;
  1154. cris)
  1155. echo "ARCH=cris" >> $config_mak
  1156. echo "#define HOST_CRIS 1" >> $config_h
  1157. ;;
  1158. hppa)
  1159. echo "ARCH=hppa" >> $config_mak
  1160. echo "#define HOST_HPPA 1" >> $config_h
  1161. ;;
  1162. ia64)
  1163. echo "ARCH=ia64" >> $config_mak
  1164. echo "#define HOST_IA64 1" >> $config_h
  1165. ;;
  1166. m68k)
  1167. echo "ARCH=m68k" >> $config_mak
  1168. echo "#define HOST_M68K 1" >> $config_h
  1169. ;;
  1170. mips)
  1171. echo "ARCH=mips" >> $config_mak
  1172. echo "#define HOST_MIPS 1" >> $config_h
  1173. ;;
  1174. mips64)
  1175. echo "ARCH=mips64" >> $config_mak
  1176. echo "#define HOST_MIPS64 1" >> $config_h
  1177. ;;
  1178. ppc)
  1179. echo "ARCH=ppc" >> $config_mak
  1180. echo "#define HOST_PPC 1" >> $config_h
  1181. ;;
  1182. ppc64)
  1183. echo "ARCH=ppc64" >> $config_mak
  1184. echo "#define HOST_PPC64 1" >> $config_h
  1185. ;;
  1186. s390)
  1187. echo "ARCH=s390" >> $config_mak
  1188. echo "#define HOST_S390 1" >> $config_h
  1189. ;;
  1190. sparc)
  1191. echo "ARCH=sparc" >> $config_mak
  1192. echo "#define HOST_SPARC 1" >> $config_h
  1193. ;;
  1194. sparc64)
  1195. echo "ARCH=sparc64" >> $config_mak
  1196. echo "#define HOST_SPARC64 1" >> $config_h
  1197. ;;
  1198. *)
  1199. echo "Unsupported CPU = $cpu"
  1200. exit 1
  1201. ;;
  1202. esac
  1203. if test "$sparse" = "yes" ; then
  1204. echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_mak
  1205. echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_mak
  1206. echo "CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
  1207. fi
  1208. if test "$bigendian" = "yes" ; then
  1209. echo "WORDS_BIGENDIAN=yes" >> $config_mak
  1210. echo "#define WORDS_BIGENDIAN 1" >> $config_h
  1211. fi
  1212. echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
  1213. if test "$mingw32" = "yes" ; then
  1214. echo "CONFIG_WIN32=yes" >> $config_mak
  1215. echo "#define CONFIG_WIN32 1" >> $config_h
  1216. else
  1217. cat > $TMPC << EOF
  1218. #include <byteswap.h>
  1219. int main(void) { return bswap_32(0); }
  1220. EOF
  1221. if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
  1222. echo "#define HAVE_BYTESWAP_H 1" >> $config_h
  1223. fi
  1224. cat > $TMPC << EOF
  1225. #include <sys/endian.h>
  1226. #include <sys/types.h>
  1227. #include <machine/bswap.h>
  1228. int main(void) { return bswap32(0); }
  1229. EOF
  1230. if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
  1231. echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
  1232. fi
  1233. fi
  1234. if [ "$openbsd" = "yes" ] ; then
  1235. echo "#define ENOTSUP 4096" >> $config_h
  1236. fi
  1237. if test "$darwin" = "yes" ; then
  1238. echo "CONFIG_DARWIN=yes" >> $config_mak
  1239. echo "#define CONFIG_DARWIN 1" >> $config_h
  1240. fi
  1241. if test "$aix" = "yes" ; then
  1242. echo "CONFIG_AIX=yes" >> $config_mak
  1243. echo "#define CONFIG_AIX 1" >> $config_h
  1244. fi
  1245. if test "$solaris" = "yes" ; then
  1246. echo "CONFIG_SOLARIS=yes" >> $config_mak
  1247. echo "#define HOST_SOLARIS $solarisrev" >> $config_h
  1248. if test "$needs_libsunmath" = "yes" ; then
  1249. echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
  1250. echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
  1251. fi
  1252. fi
  1253. if test -n "$sparc_cpu"; then
  1254. echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
  1255. echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
  1256. fi
  1257. if test "$gdbstub" = "yes" ; then
  1258. echo "CONFIG_GDBSTUB=yes" >> $config_mak
  1259. echo "#define CONFIG_GDBSTUB 1" >> $config_h
  1260. fi
  1261. if test "$gprof" = "yes" ; then
  1262. echo "TARGET_GPROF=yes" >> $config_mak
  1263. echo "#define HAVE_GPROF 1" >> $config_h
  1264. fi
  1265. if test "$static" = "yes" ; then
  1266. echo "CONFIG_STATIC=yes" >> $config_mak
  1267. echo "#define CONFIG_STATIC 1" >> $config_h
  1268. fi
  1269. if test $profiler = "yes" ; then
  1270. echo "#define CONFIG_PROFILER 1" >> $config_h
  1271. fi
  1272. if test "$slirp" = "yes" ; then
  1273. echo "CONFIG_SLIRP=yes" >> $config_mak
  1274. echo "#define CONFIG_SLIRP 1" >> $config_h
  1275. fi
  1276. if test "$vde" = "yes" ; then
  1277. echo "CONFIG_VDE=yes" >> $config_mak
  1278. echo "#define CONFIG_VDE 1" >> $config_h
  1279. echo "VDE_LIBS=-lvdeplug" >> $config_mak
  1280. fi
  1281. for card in $audio_card_list; do
  1282. def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
  1283. echo "$def=yes" >> $config_mak
  1284. echo "#define $def 1" >> $config_h
  1285. done
  1286. echo "#define AUDIO_DRIVERS \\" >> $config_h
  1287. for drv in $audio_drv_list; do
  1288. echo " &${drv}_audio_driver, \\" >>$config_h
  1289. def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
  1290. echo "$def=yes" >> $config_mak
  1291. if test "$drv" = "fmod"; then
  1292. echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
  1293. echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
  1294. elif test "$drv" = "oss"; then
  1295. echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
  1296. fi
  1297. done
  1298. echo "" >>$config_h
  1299. if test "$mixemu" = "yes" ; then
  1300. echo "CONFIG_MIXEMU=yes" >> $config_mak
  1301. echo "#define CONFIG_MIXEMU 1" >> $config_h
  1302. fi
  1303. if test "$vnc_tls" = "yes" ; then
  1304. echo "CONFIG_VNC_TLS=yes" >> $config_mak
  1305. echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
  1306. echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
  1307. echo "#define CONFIG_VNC_TLS 1" >> $config_h
  1308. fi
  1309. qemu_version=`head $source_path/VERSION`
  1310. echo "VERSION=$qemu_version" >>$config_mak
  1311. echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
  1312. echo "SRC_PATH=$source_path" >> $config_mak
  1313. if [ "$source_path_used" = "yes" ]; then
  1314. echo "VPATH=$source_path" >> $config_mak
  1315. fi
  1316. echo "TARGET_DIRS=$target_list" >> $config_mak
  1317. if [ "$build_docs" = "yes" ] ; then
  1318. echo "BUILD_DOCS=yes" >> $config_mak
  1319. fi
  1320. if test "$static" = "yes"; then
  1321. sdl1=$sdl_static
  1322. else
  1323. sdl1=$sdl
  1324. fi
  1325. if test "$sdl1" = "yes" ; then
  1326. echo "#define CONFIG_SDL 1" >> $config_h
  1327. echo "CONFIG_SDL=yes" >> $config_mak
  1328. if test "$target_softmmu" = "no" -o "$static" = "yes"; then
  1329. echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
  1330. elif test "$sdl_x11" = "yes" ; then
  1331. echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
  1332. else
  1333. echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
  1334. fi
  1335. if [ "${aa}" = "yes" ] ; then
  1336. echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
  1337. else
  1338. echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
  1339. fi
  1340. fi
  1341. if test "$cocoa" = "yes" ; then
  1342. echo "#define CONFIG_COCOA 1" >> $config_h
  1343. echo "CONFIG_COCOA=yes" >> $config_mak
  1344. fi
  1345. if test "$curses" = "yes" ; then
  1346. echo "#define CONFIG_CURSES 1" >> $config_h
  1347. echo "CONFIG_CURSES=yes" >> $config_mak
  1348. echo "CURSES_LIBS=-lcurses" >> $config_mak
  1349. fi
  1350. if test "$brlapi" = "yes" ; then
  1351. echo "CONFIG_BRLAPI=yes" >> $config_mak
  1352. echo "#define CONFIG_BRLAPI 1" >> $config_h
  1353. echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
  1354. fi
  1355. if test "$bluez" = "yes" ; then
  1356. echo "CONFIG_BLUEZ=yes" >> $config_mak
  1357. echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
  1358. echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
  1359. echo "#define CONFIG_BLUEZ 1" >> $config_h
  1360. fi
  1361. if test "$aio" = "yes" ; then
  1362. echo "#define CONFIG_AIO 1" >> $config_h
  1363. echo "CONFIG_AIO=yes" >> $config_mak
  1364. fi
  1365. if test "$blobs" = "yes" ; then
  1366. echo "INSTALL_BLOBS=yes" >> $config_mak
  1367. fi
  1368. if test "$iovec" = "yes" ; then
  1369. echo "#define HAVE_IOVEC 1" >> $config_h
  1370. fi
  1371. if test "$fdt" = "yes" ; then
  1372. echo "#define HAVE_FDT 1" >> $config_h
  1373. echo "FDT_LIBS=-lfdt" >> $config_mak
  1374. fi
  1375. # XXX: suppress that
  1376. if [ "$bsd" = "yes" ] ; then
  1377. echo "#define O_LARGEFILE 0" >> $config_h
  1378. echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
  1379. echo "#define _BSD 1" >> $config_h
  1380. fi
  1381. echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
  1382. # USB host support
  1383. case "$usb" in
  1384. linux)
  1385. echo "HOST_USB=linux" >> $config_mak
  1386. ;;
  1387. bsd)
  1388. echo "HOST_USB=bsd" >> $config_mak
  1389. ;;
  1390. *)
  1391. echo "HOST_USB=stub" >> $config_mak
  1392. ;;
  1393. esac
  1394. tools=
  1395. if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
  1396. tools="qemu-img\$(EXESUF) $tools"
  1397. if [ "$linux" = "yes" ] ; then
  1398. tools="qemu-nbd\$(EXESUF) $tools"
  1399. fi
  1400. fi
  1401. echo "TOOLS=$tools" >> $config_mak
  1402. test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
  1403. for target in $target_list; do
  1404. target_dir="$target"
  1405. config_mak=$target_dir/config.mak
  1406. config_h=$target_dir/config.h
  1407. target_cpu=`echo $target | cut -d '-' -f 1`
  1408. target_bigendian="no"
  1409. [ "$target_cpu" = "armeb" ] && target_bigendian=yes
  1410. [ "$target_cpu" = "m68k" ] && target_bigendian=yes
  1411. [ "$target_cpu" = "mips" ] && target_bigendian=yes
  1412. [ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
  1413. [ "$target_cpu" = "mips64" ] && target_bigendian=yes
  1414. [ "$target_cpu" = "ppc" ] && target_bigendian=yes
  1415. [ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
  1416. [ "$target_cpu" = "ppc64" ] && target_bigendian=yes
  1417. [ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
  1418. [ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
  1419. [ "$target_cpu" = "sparc" ] && target_bigendian=yes
  1420. [ "$target_cpu" = "sparc64" ] && target_bigendian=yes
  1421. [ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
  1422. target_softmmu="no"
  1423. target_user_only="no"
  1424. target_linux_user="no"
  1425. target_darwin_user="no"
  1426. target_bsd_user="no"
  1427. case "$target" in
  1428. ${target_cpu}-softmmu)
  1429. target_softmmu="yes"
  1430. ;;
  1431. ${target_cpu}-linux-user)
  1432. target_user_only="yes"
  1433. target_linux_user="yes"
  1434. ;;
  1435. ${target_cpu}-darwin-user)
  1436. target_user_only="yes"
  1437. target_darwin_user="yes"
  1438. ;;
  1439. ${target_cpu}-bsd-user)
  1440. target_user_only="yes"
  1441. target_bsd_user="yes"
  1442. ;;
  1443. *)
  1444. echo "ERROR: Target '$target' not recognised"
  1445. exit 1
  1446. ;;
  1447. esac
  1448. if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
  1449. -a "$sdl" = "no" -a "$cocoa" = "no" ; then
  1450. echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
  1451. echo "To build QEMU without graphical output configure with --disable-gfx-check"
  1452. echo "Note that this will disable all output from the virtual graphics card"
  1453. echo "except through VNC or curses."
  1454. exit 1;
  1455. fi
  1456. #echo "Creating $config_mak, $config_h and $target_dir/Makefile"
  1457. test -f $config_h && mv $config_h ${config_h}~
  1458. mkdir -p $target_dir
  1459. mkdir -p $target_dir/fpu
  1460. mkdir -p $target_dir/tcg
  1461. if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
  1462. mkdir -p $target_dir/nwfpe
  1463. fi
  1464. #
  1465. # don't use ln -sf as not all "ln -sf" over write the file/link
  1466. #
  1467. rm -f $target_dir/Makefile
  1468. ln -s $source_path/Makefile.target $target_dir/Makefile
  1469. echo "# Automatically generated by configure - do not modify" > $config_mak
  1470. echo "/* Automatically generated by configure - do not modify */" > $config_h
  1471. echo "include ../config-host.mak" >> $config_mak
  1472. echo "#include \"../config-host.h\"" >> $config_h
  1473. bflt="no"
  1474. elfload32="no"
  1475. target_nptl="no"
  1476. interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
  1477. echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
  1478. gdb_xml_files=""
  1479. # Make sure the target and host cpus are compatible
  1480. if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
  1481. \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
  1482. \( "$target_cpu" = "x86_64" -a "$cpu" = "i386" \) -o \
  1483. \( "$target_cpu" = "i386" -a "$cpu" = "x86_64" \) \) ; then
  1484. kvm="no"
  1485. fi
  1486. # Disable KVM for linux-user
  1487. if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
  1488. kvm="no"
  1489. fi
  1490. case "$target_cpu" in
  1491. i386)
  1492. echo "TARGET_ARCH=i386" >> $config_mak
  1493. echo "#define TARGET_ARCH \"i386\"" >> $config_h
  1494. echo "#define TARGET_I386 1" >> $config_h
  1495. if test $kqemu = "yes" -a "$target_softmmu" = "yes"
  1496. then
  1497. echo "#define USE_KQEMU 1" >> $config_h
  1498. fi
  1499. if test "$kvm" = "yes" ; then
  1500. echo "CONFIG_KVM=yes" >> $config_mak
  1501. echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
  1502. echo "#define CONFIG_KVM 1" >> $config_h
  1503. fi
  1504. ;;
  1505. x86_64)
  1506. echo "TARGET_ARCH=x86_64" >> $config_mak
  1507. echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
  1508. echo "#define TARGET_I386 1" >> $config_h
  1509. echo "#define TARGET_X86_64 1" >> $config_h
  1510. if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
  1511. then
  1512. echo "#define USE_KQEMU 1" >> $config_h
  1513. fi
  1514. if test "$kvm" = "yes" ; then
  1515. echo "CONFIG_KVM=yes" >> $config_mak
  1516. echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
  1517. echo "#define CONFIG_KVM 1" >> $config_h
  1518. fi
  1519. ;;
  1520. alpha)
  1521. echo "TARGET_ARCH=alpha" >> $config_mak
  1522. echo "#define TARGET_ARCH \"alpha\"" >> $config_h
  1523. echo "#define TARGET_ALPHA 1" >> $config_h
  1524. ;;
  1525. arm|armeb)
  1526. echo "TARGET_ARCH=arm" >> $config_mak
  1527. echo "#define TARGET_ARCH \"arm\"" >> $config_h
  1528. echo "#define TARGET_ARM 1" >> $config_h
  1529. bflt="yes"
  1530. target_nptl="yes"
  1531. gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
  1532. ;;
  1533. cris)
  1534. echo "TARGET_ARCH=cris" >> $config_mak
  1535. echo "#define TARGET_ARCH \"cris\"" >> $config_h
  1536. echo "#define TARGET_CRIS 1" >> $config_h
  1537. target_nptl="yes"
  1538. ;;
  1539. m68k)
  1540. echo "TARGET_ARCH=m68k" >> $config_mak
  1541. echo "#define TARGET_ARCH \"m68k\"" >> $config_h
  1542. echo "#define TARGET_M68K 1" >> $config_h
  1543. bflt="yes"
  1544. gdb_xml_files="cf-core.xml cf-fp.xml"
  1545. ;;
  1546. mips|mipsel)
  1547. echo "TARGET_ARCH=mips" >> $config_mak
  1548. echo "#define TARGET_ARCH \"mips\"" >> $config_h
  1549. echo "#define TARGET_MIPS 1" >> $config_h
  1550. echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
  1551. ;;
  1552. mipsn32|mipsn32el)
  1553. echo "TARGET_ARCH=mipsn32" >> $config_mak
  1554. echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
  1555. echo "#define TARGET_MIPS 1" >> $config_h
  1556. echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
  1557. ;;
  1558. mips64|mips64el)
  1559. echo "TARGET_ARCH=mips64" >> $config_mak
  1560. echo "#define TARGET_ARCH \"mips64\"" >> $config_h
  1561. echo "#define TARGET_MIPS 1" >> $config_h
  1562. echo "#define TARGET_MIPS64 1" >> $config_h
  1563. echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
  1564. ;;
  1565. ppc)
  1566. echo "TARGET_ARCH=ppc" >> $config_mak
  1567. echo "#define TARGET_ARCH \"ppc\"" >> $config_h
  1568. echo "#define TARGET_PPC 1" >> $config_h
  1569. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  1570. ;;
  1571. ppcemb)
  1572. echo "TARGET_ARCH=ppcemb" >> $config_mak
  1573. echo "TARGET_ABI_DIR=ppc" >> $config_mak
  1574. echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
  1575. echo "#define TARGET_PPC 1" >> $config_h
  1576. echo "#define TARGET_PPCEMB 1" >> $config_h
  1577. if test "$kvm" = "yes" ; then
  1578. echo "CONFIG_KVM=yes" >> $config_mak
  1579. echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
  1580. echo "#define CONFIG_KVM 1" >> $config_h
  1581. fi
  1582. gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  1583. ;;
  1584. ppc64)
  1585. echo "TARGET_ARCH=ppc64" >> $config_mak
  1586. echo "TARGET_ABI_DIR=ppc" >> $config_mak
  1587. echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
  1588. echo "#define TARGET_PPC 1" >> $config_h
  1589. echo "#define TARGET_PPC64 1" >> $config_h
  1590. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  1591. ;;
  1592. ppc64abi32)
  1593. echo "TARGET_ARCH=ppc64" >> $config_mak
  1594. echo "TARGET_ABI_DIR=ppc" >> $config_mak
  1595. echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
  1596. echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
  1597. echo "#define TARGET_PPC 1" >> $config_h
  1598. echo "#define TARGET_PPC64 1" >> $config_h
  1599. echo "#define TARGET_ABI32 1" >> $config_h
  1600. gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
  1601. ;;
  1602. sh4|sh4eb)
  1603. echo "TARGET_ARCH=sh4" >> $config_mak
  1604. echo "#define TARGET_ARCH \"sh4\"" >> $config_h
  1605. echo "#define TARGET_SH4 1" >> $config_h
  1606. bflt="yes"
  1607. target_nptl="yes"
  1608. ;;
  1609. sparc)
  1610. echo "TARGET_ARCH=sparc" >> $config_mak
  1611. echo "#define TARGET_ARCH \"sparc\"" >> $config_h
  1612. echo "#define TARGET_SPARC 1" >> $config_h
  1613. ;;
  1614. sparc64)
  1615. echo "TARGET_ARCH=sparc64" >> $config_mak
  1616. echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
  1617. echo "#define TARGET_SPARC 1" >> $config_h
  1618. echo "#define TARGET_SPARC64 1" >> $config_h
  1619. elfload32="yes"
  1620. ;;
  1621. sparc32plus)
  1622. echo "TARGET_ARCH=sparc64" >> $config_mak
  1623. echo "TARGET_ABI_DIR=sparc" >> $config_mak
  1624. echo "TARGET_ARCH2=sparc32plus" >> $config_mak
  1625. echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
  1626. echo "#define TARGET_SPARC 1" >> $config_h
  1627. echo "#define TARGET_SPARC64 1" >> $config_h
  1628. echo "#define TARGET_ABI32 1" >> $config_h
  1629. ;;
  1630. *)
  1631. echo "Unsupported target CPU"
  1632. exit 1
  1633. ;;
  1634. esac
  1635. if test "$target_bigendian" = "yes" ; then
  1636. echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
  1637. echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
  1638. fi
  1639. if test "$target_softmmu" = "yes" ; then
  1640. echo "CONFIG_SOFTMMU=yes" >> $config_mak
  1641. echo "#define CONFIG_SOFTMMU 1" >> $config_h
  1642. fi
  1643. if test "$target_user_only" = "yes" ; then
  1644. echo "CONFIG_USER_ONLY=yes" >> $config_mak
  1645. echo "#define CONFIG_USER_ONLY 1" >> $config_h
  1646. fi
  1647. if test "$target_linux_user" = "yes" ; then
  1648. echo "CONFIG_LINUX_USER=yes" >> $config_mak
  1649. echo "#define CONFIG_LINUX_USER 1" >> $config_h
  1650. fi
  1651. if test "$target_darwin_user" = "yes" ; then
  1652. echo "CONFIG_DARWIN_USER=yes" >> $config_mak
  1653. echo "#define CONFIG_DARWIN_USER 1" >> $config_h
  1654. fi
  1655. list=""
  1656. if test ! -z "$gdb_xml_files" ; then
  1657. for x in $gdb_xml_files; do
  1658. list="$list $source_path/gdb-xml/$x"
  1659. done
  1660. fi
  1661. echo "TARGET_XML_FILES=$list" >> $config_mak
  1662. if test "$target_cpu" = "arm" \
  1663. -o "$target_cpu" = "armeb" \
  1664. -o "$target_cpu" = "m68k" \
  1665. -o "$target_cpu" = "mips" \
  1666. -o "$target_cpu" = "mipsel" \
  1667. -o "$target_cpu" = "mipsn32" \
  1668. -o "$target_cpu" = "mipsn32el" \
  1669. -o "$target_cpu" = "mips64" \
  1670. -o "$target_cpu" = "mips64el" \
  1671. -o "$target_cpu" = "ppc" \
  1672. -o "$target_cpu" = "ppc64" \
  1673. -o "$target_cpu" = "ppc64abi32" \
  1674. -o "$target_cpu" = "ppcemb" \
  1675. -o "$target_cpu" = "sparc" \
  1676. -o "$target_cpu" = "sparc64" \
  1677. -o "$target_cpu" = "sparc32plus"; then
  1678. echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
  1679. echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
  1680. fi
  1681. if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
  1682. echo "TARGET_HAS_BFLT=yes" >> $config_mak
  1683. echo "#define TARGET_HAS_BFLT 1" >> $config_h
  1684. fi
  1685. if test "$target_user_only" = "yes" \
  1686. -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
  1687. echo "#define USE_NPTL 1" >> $config_h
  1688. fi
  1689. # 32 bit ELF loader in addition to native 64 bit loader?
  1690. if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
  1691. echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
  1692. echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
  1693. fi
  1694. if test "$target_bsd_user" = "yes" ; then
  1695. echo "CONFIG_BSD_USER=yes" >> $config_mak
  1696. echo "#define CONFIG_BSD_USER 1" >> $config_h
  1697. fi
  1698. test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
  1699. done # for target in $targets
  1700. # build tree in object directory if source path is different from current one
  1701. if test "$source_path_used" = "yes" ; then
  1702. DIRS="tests tests/cris slirp audio"
  1703. FILES="Makefile tests/Makefile"
  1704. FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
  1705. FILES="$FILES tests/test-mmap.c"
  1706. for dir in $DIRS ; do
  1707. mkdir -p $dir
  1708. done
  1709. # remove the link and recreate it, as not all "ln -sf" overwrite the link
  1710. for f in $FILES ; do
  1711. rm -f $f
  1712. ln -s $source_path/$f $f
  1713. done
  1714. fi