blob: 02bda640cfe96377b3a48a8a79cbb4dffb8dd7ca [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
malca91b8572009-10-15 01:57:14 +040016TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
bellard7d132992003-03-06 23:23:54 +000017
Loïc Minier0ba86812010-09-25 21:52:30 +020018# NB: do not call "exit" in the trap handler; this is buggy with some shells;
19# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
20trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
malc9ac81bb2008-11-29 20:09:56 +000021
Juan Quintela52166aa2009-08-03 14:46:03 +020022compile_object() {
Juan Quintelaa558ee12009-08-03 14:46:21 +020023 $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
Juan Quintela52166aa2009-08-03 14:46:03 +020024}
25
26compile_prog() {
27 local_cflags="$1"
28 local_ldflags="$2"
Juan Quintelaa558ee12009-08-03 14:46:21 +020029 $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
Juan Quintela52166aa2009-08-03 14:46:03 +020030}
31
Loïc Minier0dba6192010-01-28 21:26:51 +000032# check whether a command is available to this shell (may be either an
33# executable or a builtin)
34has() {
35 type "$1" >/dev/null 2>&1
36}
37
38# search for an executable in PATH
39path_of() {
40 local_command="$1"
41 local_ifs="$IFS"
42 local_dir=""
43
44 # pathname has a dir component?
45 if [ "${local_command#*/}" != "$local_command" ]; then
46 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
47 echo "$local_command"
48 return 0
49 fi
50 fi
51 if [ -z "$local_command" ]; then
52 return 1
53 fi
54
55 IFS=:
56 for local_dir in $PATH; do
57 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
58 echo "$local_dir/$local_command"
59 IFS="${local_ifs:-$(printf ' \t\n')}"
60 return 0
61 fi
62 done
63 # not found
64 IFS="${local_ifs:-$(printf ' \t\n')}"
65 return 1
66}
67
bellard7d132992003-03-06 23:23:54 +000068# default parameters
Juan Quintela2ff6b912009-08-03 14:45:55 +020069cpu=""
bellard1e43adf2003-09-30 20:54:24 +000070interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +000071static="no"
Juan Quintelaed968ff2009-08-03 14:46:11 +020072sparc_cpu=""
bellard7d132992003-03-06 23:23:54 +000073cross_prefix=""
74cc="gcc"
malc0c58ac12008-06-25 21:04:05 +000075audio_drv_list=""
malc4c9b53e2009-01-09 10:46:34 +000076audio_card_list="ac97 es1370 sb16"
77audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
Markus Armbrustereb852012009-10-27 18:41:44 +010078block_drv_whitelist=""
bellard7d132992003-03-06 23:23:54 +000079host_cc="gcc"
80ar="ar"
81make="make"
pbrook6a882642006-04-17 13:57:12 +000082install="install"
Anthony Liguori7aa486f2009-07-11 08:48:29 -050083objcopy="objcopy"
84ld="ld"
Hollis Blanchard52ba7842010-08-04 17:21:34 -070085strip="strip"
Juan Quintelac81da562009-08-03 14:46:24 +020086helper_cflags=""
Juan Quintela73da3752009-08-03 14:46:26 +020087libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +020088libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +020089audio_pt_int=""
malcd5631632009-10-10 01:13:41 +040090audio_win_int=""
aliguoriac0df512008-12-29 17:14:15 +000091
92# parse CC options first
93for opt do
94 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
95 case "$opt" in
96 --cross-prefix=*) cross_prefix="$optarg"
97 ;;
98 --cc=*) cc="$optarg"
99 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200100 --cpu=*) cpu="$optarg"
101 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200102 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200103 ;;
104 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
105 ;;
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200106 --sparc_cpu=*)
107 sparc_cpu="$optarg"
108 case $sparc_cpu in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200109 v7|v8|v8plus|v8plusa)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200110 cpu="sparc"
111 ;;
112 v9)
Juan Quintela50e7b1a2009-08-03 14:46:10 +0200113 cpu="sparc64"
114 ;;
115 *)
116 echo "undefined SPARC architecture. Exiting";
117 exit 1
118 ;;
119 esac
120 ;;
aliguoriac0df512008-12-29 17:14:15 +0000121 esac
122done
aliguoriac0df512008-12-29 17:14:15 +0000123# OS specific
124# Using uname is really, really broken. Once we have the right set of checks
125# we can eliminate it's usage altogether
126
127cc="${cross_prefix}${cc}"
128ar="${cross_prefix}${ar}"
Anthony Liguori7aa486f2009-07-11 08:48:29 -0500129objcopy="${cross_prefix}${objcopy}"
130ld="${cross_prefix}${ld}"
Hollis Blanchard52ba7842010-08-04 17:21:34 -0700131strip="${cross_prefix}${strip}"
aliguoriac0df512008-12-29 17:14:15 +0000132
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200133# default flags for all hosts
134QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
135CFLAGS="-g $CFLAGS"
136QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
137QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
138QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Kirill A. Shutemov84958302010-01-20 00:56:22 +0100139QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200140QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
141LDFLAGS="-g $LDFLAGS"
142
Blue Swirla21493e2010-09-18 07:01:05 +0000143gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
144gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
Blue Swirl0b65b9e2010-09-18 07:02:16 +0000145gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Blue Swirla21493e2010-09-18 07:01:05 +0000146gcc_flags="-fstack-protector-all $gcc_flags"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200147cat > $TMPC << EOF
Aurelien Jarnoaa527b62010-02-06 21:22:19 +0100148int main(void) { return 0; }
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200149EOF
150for flag in $gcc_flags; do
Aurelien Jarnoaa527b62010-02-06 21:22:19 +0100151 if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200152 QEMU_CFLAGS="$flag $QEMU_CFLAGS"
153 fi
154done
155
aliguoriac0df512008-12-29 17:14:15 +0000156# check that the C compiler works.
157cat > $TMPC <<EOF
158int main(void) {}
159EOF
160
Juan Quintela52166aa2009-08-03 14:46:03 +0200161if compile_object ; then
aliguoriac0df512008-12-29 17:14:15 +0000162 : C compiler works ok
163else
164 echo "ERROR: \"$cc\" either does not exist or does not work"
165 exit 1
166fi
167
168check_define() {
169cat > $TMPC <<EOF
170#if !defined($1)
171#error Not defined
172#endif
173int main(void) { return 0; }
174EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200175 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000176}
177
Juan Quintela2ff6b912009-08-03 14:45:55 +0200178if test ! -z "$cpu" ; then
179 # command line argument
180 :
181elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000182 cpu="i386"
183elif check_define __x86_64__ ; then
184 cpu="x86_64"
blueswir13aa9bd62008-12-31 16:55:26 +0000185elif check_define __sparc__ ; then
186 # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
187 # They must be specified using --sparc_cpu
188 if check_define __arch64__ ; then
189 cpu="sparc64"
190 else
191 cpu="sparc"
192 fi
malcfdf7ed92009-01-14 18:39:52 +0000193elif check_define _ARCH_PPC ; then
194 if check_define _ARCH_PPC64 ; then
195 cpu="ppc64"
196 else
197 cpu="ppc"
198 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200199elif check_define __mips__ ; then
200 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200201elif check_define __ia64__ ; then
202 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200203elif check_define __s390__ ; then
204 if check_define __s390x__ ; then
205 cpu="s390x"
206 else
207 cpu="s390"
208 fi
aliguoriac0df512008-12-29 17:14:15 +0000209else
malcfdf7ed92009-01-14 18:39:52 +0000210 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000211fi
212
bellard5327cf42005-01-10 23:18:50 +0000213target_list=""
bellard7d132992003-03-06 23:23:54 +0000214case "$cpu" in
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200215 alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200216 cpu="$cpu"
217 ;;
bellard7d132992003-03-06 23:23:54 +0000218 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000219 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000220 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000221 x86_64|amd64)
222 cpu="x86_64"
223 ;;
bellardba680552005-03-13 09:49:52 +0000224 armv*b)
bellard808c4952004-12-19 23:33:47 +0000225 cpu="armv4b"
226 ;;
bellardba680552005-03-13 09:49:52 +0000227 armv*l)
bellard7d132992003-03-06 23:23:54 +0000228 cpu="armv4l"
229 ;;
aurel32f54b3f92008-04-12 20:14:54 +0000230 parisc|parisc64)
231 cpu="hppa"
232 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200233 mips*)
234 cpu="mips"
235 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100236 s390)
bellardfb3e5842003-03-29 17:32:36 +0000237 cpu="s390"
238 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +0100239 s390x)
240 cpu="s390x"
241 ;;
blueswir131422552007-04-16 18:27:06 +0000242 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000243 cpu="sparc"
244 ;;
bellard7d132992003-03-06 23:23:54 +0000245 *)
Paolo Bonzinia447d4d2010-05-26 16:08:16 +0200246 echo "Unsupported CPU = $cpu"
247 exit 1
bellard7d132992003-03-06 23:23:54 +0000248 ;;
249esac
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200250
Stefan Weil3a3fb962009-11-16 19:59:18 +0100251# Default value for a variable defining feature "foo".
252# * foo="no" feature will only be used if --enable-foo arg is given
253# * foo="" feature will be searched for, and if found, will be used
254# unless --disable-foo is given
255# * foo="yes" this value will only be set by --enable-foo flag.
256# feature will searched for,
257# if not found, configure exits with error
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200258#
Stefan Weil3a3fb962009-11-16 19:59:18 +0100259# Always add --enable-foo and --disable-foo command line args.
260# Distributions want to ensure that several features are compiled in, and it
261# is impossible without a --enable-foo that exits if a feature is not found.
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200262
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200263bluez=""
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200264brlapi=""
Juan Quintela788c8192009-08-12 18:29:47 +0200265curl=""
Juan Quintelac584a6d2009-08-12 18:20:30 +0200266curses=""
Juan Quintelaa25dba12009-08-12 18:29:52 +0200267docs=""
Juan Quintela2df87df2009-08-12 18:29:54 +0200268fdt=""
Juan Quintelab31a0272009-08-12 18:29:56 +0200269kvm=""
Jan Kiszkadae50792010-01-12 19:53:48 +0100270kvm_para=""
Juan Quintelab0a47e72009-08-12 18:29:49 +0200271nptl=""
Juan Quintelac4198152009-08-12 18:29:53 +0200272sdl=""
Juan Quinteladfffc652009-08-12 18:29:57 +0200273sparse="no"
Stefan Weilee682d22009-10-01 20:10:37 +0200274uuid=""
Juan Quinteladfb278b2009-08-12 18:20:27 +0200275vde=""
Juan Quintela1be10ad2009-08-12 18:20:28 +0200276vnc_tls=""
Juan Quintelaea784e32009-08-12 18:20:29 +0200277vnc_sasl=""
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200278vnc_jpeg=""
Corentin Charyefe556a2010-07-07 20:57:56 +0200279vnc_png=""
Corentin Chary96763cf2010-07-07 20:58:06 +0200280vnc_thread="no"
Juan Quintelafc321b42009-08-12 18:29:55 +0200281xen=""
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200282linux_aio=""
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700283attr=""
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200284vhost_net=""
Juan Quinteladfb278b2009-08-12 18:20:27 +0200285
bellard7d132992003-03-06 23:23:54 +0000286gprof="no"
aurel32f8393942009-04-13 18:45:38 +0000287debug_tcg="no"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200288debug_mon="no"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100289debug="no"
aliguori1625af82009-04-05 17:41:02 +0000290strip_opt="yes"
bellard7d132992003-03-06 23:23:54 +0000291bigendian="no"
bellard67b915a2004-03-31 23:37:16 +0000292mingw32="no"
293EXESUF=""
Paolo Bonzini683035d2010-05-26 16:08:28 +0200294prefix="/usr/local"
295mandir="\${prefix}/share/man"
296datadir="\${prefix}/share/qemu"
297docdir="\${prefix}/share/doc/qemu"
298bindir="\${prefix}/bin"
299sysconfdir="\${prefix}/etc"
300confsuffix="/qemu"
bellard443f1372004-06-04 11:13:20 +0000301slirp="yes"
bellard102a52e2004-11-14 19:57:29 +0000302fmod_lib=""
303fmod_inc=""
blueswir12f6a1ab2008-08-21 18:00:53 +0000304oss_lib=""
pbrookb1a550a2006-04-16 13:28:56 +0000305bsd="no"
bellard5327cf42005-01-10 23:18:50 +0000306linux="no"
blueswir1d2c7c9b2008-11-01 14:50:20 +0000307solaris="no"
bellard05c2a3e2006-02-08 22:39:17 +0000308profiler="no"
bellard5b0753e2005-03-01 21:37:28 +0000309cocoa="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000310softmmu="yes"
ths831b7822007-01-18 20:06:33 +0000311linux_user="no"
312darwin_user="no"
blueswir184778502008-10-26 20:33:16 +0000313bsd_user="no"
Paul Brook379f6692009-07-17 12:48:08 +0100314guest_base=""
pbrookc5937222006-05-14 11:30:38 +0000315uname_release=""
aliguorie5d355d2009-04-24 18:03:15 +0000316io_thread="no"
malc8ff9cbf2008-06-23 18:33:30 +0000317mixemu="no"
aliguorieac30262008-11-05 16:28:56 +0000318kerneldir=""
malcb29fe3e2008-11-18 01:42:22 +0000319aix="no"
ths77755342008-11-27 15:45:16 +0000320blobs="yes"
pbrook4a19f1e2009-04-07 23:17:49 +0000321pkgversion=""
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300322check_utests="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300323user_pie="no"
Anthony Liguori20ff6c82009-12-09 12:59:36 -0600324zero_malloc=""
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100325trace_backend="nop"
Prerna Saxena9410b562010-07-13 09:26:32 +0100326trace_file="trace"
bellard7d132992003-03-06 23:23:54 +0000327
328# OS specific
aliguoriac0df512008-12-29 17:14:15 +0000329if check_define __linux__ ; then
330 targetos="Linux"
331elif check_define _WIN32 ; then
332 targetos='MINGW32'
blueswir1169dc5d2009-04-13 17:19:26 +0000333elif check_define __OpenBSD__ ; then
334 targetos='OpenBSD'
335elif check_define __sun__ ; then
336 targetos='SunOS'
aliguoriac0df512008-12-29 17:14:15 +0000337else
338 targetos=`uname -s`
339fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200340
bellard7d132992003-03-06 23:23:54 +0000341case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000342CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200343 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200344 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400345 audio_possible_drivers="winwave sdl"
346 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000347;;
bellard67b915a2004-03-31 23:37:16 +0000348MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200349 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400350 audio_possible_drivers="winwave dsound sdl fmod"
351 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000352;;
ths5c40d2b2007-06-23 16:03:36 +0000353GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100354 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200355 audio_drv_list="oss"
356 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000357;;
bellard7d3505c2004-05-12 19:32:15 +0000358FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200359 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100360 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200361 audio_drv_list="oss"
362 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100363 # needed for kinfo_getvmmap(3) in libutil.h
364 LIBS="-lutil $LIBS"
bellard7d3505c2004-05-12 19:32:15 +0000365;;
blueswir1c5e97232009-03-07 20:06:23 +0000366DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200367 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100368 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200369 audio_drv_list="oss"
370 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000371;;
bellard7d3505c2004-05-12 19:32:15 +0000372NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200373 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100374 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200375 audio_drv_list="oss"
376 audio_possible_drivers="oss sdl esd"
377 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000378;;
379OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200380 bsd="yes"
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100381 make="gmake"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200382 audio_drv_list="oss"
383 audio_possible_drivers="oss sdl esd"
384 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000385;;
bellard83fb7ad2004-07-05 21:25:26 +0000386Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200387 bsd="yes"
388 darwin="yes"
389 # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
390 # run 64-bit userspace code
391 if [ "$cpu" = "i386" ] ; then
malcaab85882009-02-23 14:11:10 +0000392 is_x86_64=`sysctl -n hw.optional.x86_64`
393 [ "$is_x86_64" = "1" ] && cpu=x86_64
Juan Quintela0dbfc672009-08-03 14:46:13 +0200394 fi
395 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200396 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200397 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200398 else
Juan Quintelaa558ee12009-08-03 14:46:21 +0200399 QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200400 fi
401 darwin_user="yes"
402 cocoa="yes"
403 audio_drv_list="coreaudio"
404 audio_possible_drivers="coreaudio sdl fmod"
405 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200406 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
bellard83fb7ad2004-07-05 21:25:26 +0000407;;
bellardec530c82006-04-25 22:36:06 +0000408SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200409 solaris="yes"
410 make="gmake"
411 install="ginstall"
Blue Swirlfa589482009-10-02 19:38:25 +0000412 ld="gld"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200413 needs_libsunmath="no"
414 solarisrev=`uname -r | cut -f2 -d.`
415 # have to select again, because `uname -m` returns i86pc
416 # even on an x86_64 box.
417 solariscpu=`isainfo -k`
418 if test "${solariscpu}" = "amd64" ; then
419 cpu="x86_64"
420 fi
421 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
422 if test "$solarisrev" -le 9 ; then
423 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
424 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200425 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
426 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
427 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200428 else
429 echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
430 echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
431 echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
432 echo "Studio 11 can be downloaded from www.sun.com."
433 exit 1
434 fi
thsef18c882007-09-16 22:12:39 +0000435 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200436 fi
437 if test -f /usr/include/sys/soundcard.h ; then
438 audio_drv_list="oss"
439 fi
440 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000441# needed for CMSG_ macros in sys/socket.h
442 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
443# needed for TIOCWIN* defines in termios.h
444 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200445 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Juan Quintelae174c0b2009-08-03 14:46:18 +0200446 LIBS="-lsocket -lnsl -lresolv $LIBS"
ths86b2bd92007-02-11 00:31:33 +0000447;;
malcb29fe3e2008-11-18 01:42:22 +0000448AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200449 aix="yes"
450 make="gmake"
malcb29fe3e2008-11-18 01:42:22 +0000451;;
bellard1d14ffa2005-10-30 18:58:22 +0000452*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200453 audio_drv_list="oss"
454 audio_possible_drivers="oss alsa sdl esd pa"
455 linux="yes"
456 linux_user="yes"
457 usb="linux"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200458 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000459 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200460 fi
bellardfb065182004-11-09 23:09:44 +0000461;;
bellard7d132992003-03-06 23:23:54 +0000462esac
463
bellard7d3505c2004-05-12 19:32:15 +0000464if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000465 if [ "$darwin" != "yes" ] ; then
blueswir168063642008-11-22 21:03:55 +0000466 usb="bsd"
bellard83fb7ad2004-07-05 21:25:26 +0000467 fi
blueswir184778502008-10-26 20:33:16 +0000468 bsd_user="yes"
bellard7d3505c2004-05-12 19:32:15 +0000469fi
470
Juan Quintela3457a3f2009-08-03 14:46:07 +0200471if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200472 EXESUF=".exe"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200473 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100474 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
475 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Juan Quintela884044a2009-08-03 14:46:19 +0200476 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200477 prefix="c:/Program Files/Qemu"
478 mandir="\${prefix}"
479 datadir="\${prefix}"
480 docdir="\${prefix}"
481 bindir="\${prefix}"
482 sysconfdir="\${prefix}"
483 confsuffix=""
Juan Quintela3457a3f2009-08-03 14:46:07 +0200484fi
485
bellard7d132992003-03-06 23:23:54 +0000486# find source path
pbrookad064842006-04-16 12:41:07 +0000487source_path=`dirname "$0"`
balrog59faef32008-02-03 04:22:24 +0000488source_path_used="no"
489workdir=`pwd`
pbrookad064842006-04-16 12:41:07 +0000490if [ -z "$source_path" ]; then
balrog59faef32008-02-03 04:22:24 +0000491 source_path=$workdir
pbrookad064842006-04-16 12:41:07 +0000492else
493 source_path=`cd "$source_path"; pwd`
bellard7d132992003-03-06 23:23:54 +0000494fi
pbrook724db112008-02-03 19:20:13 +0000495[ -f "$workdir/vl.c" ] || source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000496
Anthony Liguori487fefd2009-06-11 13:28:25 -0500497werror=""
bellard85aa5182007-11-11 20:17:03 +0000498
bellard7d132992003-03-06 23:23:54 +0000499for opt do
pbrooka46e4032006-04-29 23:05:22 +0000500 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000501 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000502 --help|-h) show_help=yes
503 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000504 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000505 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000506 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000507 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000508 --source-path=*) source_path="$optarg"
pbrookad064842006-04-16 12:41:07 +0000509 source_path_used="yes"
bellard7d132992003-03-06 23:23:54 +0000510 ;;
aliguoriac0df512008-12-29 17:14:15 +0000511 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000512 ;;
aliguoriac0df512008-12-29 17:14:15 +0000513 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000514 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000515 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000516 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000517 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000518 ;;
pbrook6a882642006-04-17 13:57:12 +0000519 --install=*) install="$optarg"
520 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200521 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000522 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200523 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000524 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200525 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000526 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000527 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000528 ;;
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100529 --trace-backend=*) trace_backend="$optarg"
530 ;;
Prerna Saxena9410b562010-07-13 09:26:32 +0100531 --trace-file=*) trace_file="$optarg"
532 ;;
bellard7d132992003-03-06 23:23:54 +0000533 --enable-gprof) gprof="yes"
534 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100535 --static)
536 static="yes"
537 LDFLAGS="-static $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000538 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200539 --mandir=*) mandir="$optarg"
540 ;;
541 --bindir=*) bindir="$optarg"
542 ;;
543 --datadir=*) datadir="$optarg"
544 ;;
545 --docdir=*) docdir="$optarg"
546 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100547 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600548 ;;
bellard97a847b2003-08-10 21:36:04 +0000549 --disable-sdl) sdl="no"
550 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200551 --enable-sdl) sdl="yes"
552 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000553 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000554 ;;
malcc2de5c92008-06-28 19:13:06 +0000555 --fmod-inc=*) fmod_inc="$optarg"
556 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000557 --oss-lib=*) oss_lib="$optarg"
558 ;;
malc2fa7d3b2008-07-29 12:58:44 +0000559 --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
malc0c58ac12008-06-25 21:04:05 +0000560 ;;
561 --audio-drv-list=*) audio_drv_list="$optarg"
562 ;;
Markus Armbrustereb852012009-10-27 18:41:44 +0100563 --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
564 ;;
aurel32f8393942009-04-13 18:45:38 +0000565 --enable-debug-tcg) debug_tcg="yes"
566 ;;
567 --disable-debug-tcg) debug_tcg="no"
568 ;;
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200569 --enable-debug-mon) debug_mon="yes"
570 ;;
571 --disable-debug-mon) debug_mon="no"
572 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100573 --enable-debug)
574 # Enable debugging options that aren't excessively noisy
575 debug_tcg="yes"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -0200576 debug_mon="yes"
Paul Brookf3d08ee2009-06-04 11:39:04 +0100577 debug="yes"
578 strip_opt="no"
579 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000580 --enable-sparse) sparse="yes"
581 ;;
582 --disable-sparse) sparse="no"
583 ;;
aliguori1625af82009-04-05 17:41:02 +0000584 --disable-strip) strip_opt="no"
585 ;;
ths8d5d2d42007-08-25 01:37:51 +0000586 --disable-vnc-tls) vnc_tls="no"
587 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200588 --enable-vnc-tls) vnc_tls="yes"
589 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000590 --disable-vnc-sasl) vnc_sasl="no"
591 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200592 --enable-vnc-sasl) vnc_sasl="yes"
593 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200594 --disable-vnc-jpeg) vnc_jpeg="no"
595 ;;
596 --enable-vnc-jpeg) vnc_jpeg="yes"
597 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200598 --disable-vnc-png) vnc_png="no"
599 ;;
600 --enable-vnc-png) vnc_png="yes"
601 ;;
Corentin Charybd023f92010-07-07 20:58:02 +0200602 --disable-vnc-thread) vnc_thread="no"
603 ;;
604 --enable-vnc-thread) vnc_thread="yes"
605 ;;
bellard443f1372004-06-04 11:13:20 +0000606 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000607 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200608 --disable-uuid) uuid="no"
609 ;;
610 --enable-uuid) uuid="yes"
611 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000612 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000613 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200614 --enable-vde) vde="yes"
615 ;;
aliguorie37630c2009-04-22 15:19:10 +0000616 --disable-xen) xen="no"
617 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200618 --enable-xen) xen="yes"
619 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000620 --disable-brlapi) brlapi="no"
621 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200622 --enable-brlapi) brlapi="yes"
623 ;;
balrogfb599c92008-09-28 23:49:55 +0000624 --disable-bluez) bluez="no"
625 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200626 --enable-bluez) bluez="yes"
627 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000628 --disable-kvm) kvm="no"
629 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200630 --enable-kvm) kvm="yes"
631 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000632 --enable-profiler) profiler="yes"
633 ;;
malcc2de5c92008-06-28 19:13:06 +0000634 --enable-cocoa)
635 cocoa="yes" ;
636 sdl="no" ;
637 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000638 ;;
pbrookcad25d62006-03-19 16:31:11 +0000639 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000640 ;;
pbrookcad25d62006-03-19 16:31:11 +0000641 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000642 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000643 --disable-user)
644 linux_user="no" ;
645 bsd_user="no" ;
646 darwin_user="no"
647 ;;
648 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000649 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000650 ;;
ths831b7822007-01-18 20:06:33 +0000651 --enable-linux-user) linux_user="yes"
652 ;;
653 --disable-darwin-user) darwin_user="no"
654 ;;
655 --enable-darwin-user) darwin_user="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000656 ;;
blueswir184778502008-10-26 20:33:16 +0000657 --disable-bsd-user) bsd_user="no"
658 ;;
659 --enable-bsd-user) bsd_user="yes"
660 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100661 --enable-guest-base) guest_base="yes"
662 ;;
663 --disable-guest-base) guest_base="no"
664 ;;
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300665 --enable-user-pie) user_pie="yes"
666 ;;
667 --disable-user-pie) user_pie="no"
668 ;;
pbrookc5937222006-05-14 11:30:38 +0000669 --enable-uname-release=*) uname_release="$optarg"
670 ;;
blueswir131422552007-04-16 18:27:06 +0000671 --sparc_cpu=*)
blueswir131422552007-04-16 18:27:06 +0000672 ;;
bellard85aa5182007-11-11 20:17:03 +0000673 --enable-werror) werror="yes"
674 ;;
675 --disable-werror) werror="no"
676 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000677 --disable-curses) curses="no"
678 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200679 --enable-curses) curses="yes"
680 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200681 --disable-curl) curl="no"
682 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200683 --enable-curl) curl="yes"
684 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200685 --disable-fdt) fdt="no"
686 ;;
687 --enable-fdt) fdt="yes"
688 ;;
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300689 --disable-check-utests) check_utests="no"
690 ;;
691 --enable-check-utests) check_utests="yes"
692 ;;
pbrookbd0c5662008-05-29 14:34:11 +0000693 --disable-nptl) nptl="no"
694 ;;
Juan Quintelab0a47e72009-08-12 18:29:49 +0200695 --enable-nptl) nptl="yes"
696 ;;
malc8ff9cbf2008-06-23 18:33:30 +0000697 --enable-mixemu) mixemu="yes"
698 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200699 --disable-linux-aio) linux_aio="no"
700 ;;
701 --enable-linux-aio) linux_aio="yes"
702 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700703 --disable-attr) attr="no"
704 ;;
705 --enable-attr) attr="yes"
706 ;;
aliguorie5d355d2009-04-24 18:03:15 +0000707 --enable-io-thread) io_thread="yes"
708 ;;
ths77755342008-11-27 15:45:16 +0000709 --disable-blobs) blobs="no"
710 ;;
aliguorieac30262008-11-05 16:28:56 +0000711 --kerneldir=*) kerneldir="$optarg"
712 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000713 --with-pkgversion=*) pkgversion=" ($optarg)"
714 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200715 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500716 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200717 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200718 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200719 --disable-vhost-net) vhost_net="no"
720 ;;
721 --enable-vhost-net) vhost_net="yes"
722 ;;
Paolo Bonzini6bde81c2010-05-26 16:08:27 +0200723 --*dir)
724 ;;
balrog7f1559c2007-11-17 10:24:32 +0000725 *) echo "ERROR: unknown option $opt"; show_help="yes"
726 ;;
bellard7d132992003-03-06 23:23:54 +0000727 esac
728done
729
blueswir131422552007-04-16 18:27:06 +0000730#
731# If cpu ~= sparc and sparc_cpu hasn't been defined, plug in the right
Juan Quintelaa558ee12009-08-03 14:46:21 +0200732# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
blueswir131422552007-04-16 18:27:06 +0000733#
Paul Brook379f6692009-07-17 12:48:08 +0100734host_guest_base="no"
bellard40293e52008-01-31 11:32:10 +0000735case "$cpu" in
Juan Quintelaed968ff2009-08-03 14:46:11 +0200736 sparc) case $sparc_cpu in
737 v7|v8)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200738 QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200739 ;;
740 v8plus|v8plusa)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200741 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200742 ;;
743 *) # sparc_cpu not defined in the command line
Juan Quintelaa558ee12009-08-03 14:46:21 +0200744 QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200745 esac
746 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200747 QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000748 if test "$solaris" = "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200749 QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200750 helper_cflags="-ffixed-i0"
blueswir1762e8232009-04-04 09:21:28 +0000751 fi
blueswir131422552007-04-16 18:27:06 +0000752 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +0200753 sparc64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200754 QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200755 LDFLAGS="-m64 $LDFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200756 QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
Juan Quintelaed968ff2009-08-03 14:46:11 +0200757 if test "$solaris" != "no" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200758 QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
blueswir1762e8232009-04-04 09:21:28 +0000759 fi
blueswir131422552007-04-16 18:27:06 +0000760 ;;
ths76d83bd2007-11-18 21:22:10 +0000761 s390)
Richard Henderson28d7cc42010-06-04 12:14:09 -0700762 QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
763 LDFLAGS="-m31 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700764 host_guest_base="yes"
Richard Henderson28d7cc42010-06-04 12:14:09 -0700765 ;;
766 s390x)
767 QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
768 LDFLAGS="-m64 $LDFLAGS"
Richard Henderson48bb3752010-06-28 19:15:37 -0700769 host_guest_base="yes"
ths76d83bd2007-11-18 21:22:10 +0000770 ;;
bellard40293e52008-01-31 11:32:10 +0000771 i386)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200772 QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200773 LDFLAGS="-m32 $LDFLAGS"
Juan Quintelac81da562009-08-03 14:46:24 +0200774 helper_cflags="-fomit-frame-pointer"
Paul Brook379f6692009-07-17 12:48:08 +0100775 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000776 ;;
777 x86_64)
Juan Quintelaa558ee12009-08-03 14:46:21 +0200778 QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200779 LDFLAGS="-m64 $LDFLAGS"
Paul Brook379f6692009-07-17 12:48:08 +0100780 host_guest_base="yes"
781 ;;
782 arm*)
783 host_guest_base="yes"
bellard40293e52008-01-31 11:32:10 +0000784 ;;
malcf6548c02009-07-18 10:08:40 +0400785 ppc*)
786 host_guest_base="yes"
787 ;;
Aurelien Jarnocc01cc82010-03-27 17:31:04 +0100788 mips*)
789 host_guest_base="yes"
790 ;;
Aurelien Jarno477ba622010-03-29 02:12:51 +0200791 ia64*)
792 host_guest_base="yes"
793 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -0700794 hppa*)
795 host_guest_base="yes"
796 ;;
blueswir131422552007-04-16 18:27:06 +0000797esac
798
Paul Brook379f6692009-07-17 12:48:08 +0100799[ -z "$guest_base" ] && guest_base="$host_guest_base"
800
pbrookaf5db582006-04-08 14:26:41 +0000801if test x"$show_help" = x"yes" ; then
802cat << EOF
803
804Usage: configure [options]
805Options: [defaults in brackets after descriptions]
806
807EOF
808echo "Standard options:"
809echo " --help print this message"
810echo " --prefix=PREFIX install in PREFIX [$prefix]"
811echo " --interp-prefix=PREFIX where to find shared libraries, etc."
812echo " use %M for cpu name [$interp_prefix]"
813echo " --target-list=LIST set target list [$target_list]"
814echo ""
pbrookaf5db582006-04-08 14:26:41 +0000815echo "Advanced options (experts only):"
816echo " --source-path=PATH path of source code [$source_path]"
817echo " --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]"
818echo " --cc=CC use C compiler CC [$cc]"
Paolo Bonzini0bfe8cc2010-05-26 16:08:18 +0200819echo " --host-cc=CC use C compiler CC [$host_cc] for code run at"
820echo " build time"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200821echo " --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS"
Jan Kiszkae3fc14c2009-06-30 21:29:03 +0200822echo " --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS"
pbrookaf5db582006-04-08 14:26:41 +0000823echo " --make=MAKE use specified make [$make]"
pbrook6a882642006-04-17 13:57:12 +0000824echo " --install=INSTALL use specified install [$install]"
pbrookaf5db582006-04-08 14:26:41 +0000825echo " --static enable static build [$static]"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200826echo " --mandir=PATH install man pages in PATH"
827echo " --datadir=PATH install firmware in PATH"
828echo " --docdir=PATH install documentation in PATH"
829echo " --bindir=PATH install binaries in PATH"
830echo " --sysconfdir=PATH install config in PATH/qemu"
aurel32f8393942009-04-13 18:45:38 +0000831echo " --enable-debug-tcg enable TCG debugging"
832echo " --disable-debug-tcg disable TCG debugging (default)"
Stefan Weil09695a42009-06-06 16:51:30 +0200833echo " --enable-debug enable common debug build options"
aliguori890b1652008-10-07 21:22:41 +0000834echo " --enable-sparse enable sparse checker"
835echo " --disable-sparse disable sparse checker (default)"
aliguori1625af82009-04-05 17:41:02 +0000836echo " --disable-strip disable stripping binaries"
bellard85aa5182007-11-11 20:17:03 +0000837echo " --disable-werror disable compilation abort on warning"
balrogfe8f78e2007-10-31 01:03:28 +0000838echo " --disable-sdl disable SDL"
Juan Quintelac4198152009-08-12 18:29:53 +0200839echo " --enable-sdl enable SDL"
pbrookaf5db582006-04-08 14:26:41 +0000840echo " --enable-cocoa enable COCOA (Mac OS X only)"
malcc2de5c92008-06-28 19:13:06 +0000841echo " --audio-drv-list=LIST set audio drivers list:"
842echo " Available drivers: $audio_possible_drivers"
malc4c9b53e2009-01-09 10:46:34 +0000843echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
844echo " Available cards: $audio_possible_cards"
Markus Armbrustereb852012009-10-27 18:41:44 +0100845echo " --block-drv-whitelist=L set block driver whitelist"
846echo " (affects only QEMU, not qemu-img)"
malc8ff9cbf2008-06-23 18:33:30 +0000847echo " --enable-mixemu enable mixer emulation"
aliguorie37630c2009-04-22 15:19:10 +0000848echo " --disable-xen disable xen backend driver support"
Juan Quintelafc321b42009-08-12 18:29:55 +0200849echo " --enable-xen enable xen backend driver support"
aurel322e4d9fb2008-04-08 06:01:02 +0000850echo " --disable-brlapi disable BrlAPI"
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200851echo " --enable-brlapi enable BrlAPI"
ths8d5d2d42007-08-25 01:37:51 +0000852echo " --disable-vnc-tls disable TLS encryption for VNC server"
Juan Quintela1be10ad2009-08-12 18:20:28 +0200853echo " --enable-vnc-tls enable TLS encryption for VNC server"
aliguori2f9606b2009-03-06 20:27:28 +0000854echo " --disable-vnc-sasl disable SASL encryption for VNC server"
Juan Quintelaea784e32009-08-12 18:20:29 +0200855echo " --enable-vnc-sasl enable SASL encryption for VNC server"
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200856echo " --disable-vnc-jpeg disable JPEG lossy compression for VNC server"
857echo " --enable-vnc-jpeg enable JPEG lossy compression for VNC server"
Corentin Chary96763cf2010-07-07 20:58:06 +0200858echo " --disable-vnc-png disable PNG compression for VNC server (default)"
Corentin Charyefe556a2010-07-07 20:57:56 +0200859echo " --enable-vnc-png enable PNG compression for VNC server"
Corentin Charybd023f92010-07-07 20:58:02 +0200860echo " --disable-vnc-thread disable threaded VNC server"
861echo " --enable-vnc-thread enable threaded VNC server"
pbrookaf896aa2008-03-23 00:47:42 +0000862echo " --disable-curses disable curses output"
Juan Quintelac584a6d2009-08-12 18:20:30 +0200863echo " --enable-curses enable curses output"
Alexander Graf769ce762009-05-11 17:41:42 +0200864echo " --disable-curl disable curl connectivity"
Juan Quintela788c8192009-08-12 18:29:47 +0200865echo " --enable-curl enable curl connectivity"
Juan Quintela2df87df2009-08-12 18:29:54 +0200866echo " --disable-fdt disable fdt device tree"
867echo " --enable-fdt enable fdt device tree"
Luiz Capitulino5495ed12009-08-28 15:27:28 -0300868echo " --disable-check-utests disable check unit-tests"
869echo " --enable-check-utests enable check unit-tests"
balrogfb599c92008-09-28 23:49:55 +0000870echo " --disable-bluez disable bluez stack connectivity"
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200871echo " --enable-bluez enable bluez stack connectivity"
aliguori7ba1e612008-11-05 16:04:33 +0000872echo " --disable-kvm disable KVM acceleration support"
Juan Quintelab31a0272009-08-12 18:29:56 +0200873echo " --enable-kvm enable KVM acceleration support"
pbrookbd0c5662008-05-29 14:34:11 +0000874echo " --disable-nptl disable usermode NPTL support"
Andre Przywarae5934d32009-09-16 14:29:07 +0200875echo " --enable-nptl enable usermode NPTL support"
pbrookaf5db582006-04-08 14:26:41 +0000876echo " --enable-system enable all system emulation targets"
877echo " --disable-system disable all system emulation targets"
Zachary Amsden0953a802009-07-30 00:14:59 -1000878echo " --enable-user enable supported user emulation targets"
879echo " --disable-user disable all user emulation targets"
ths831b7822007-01-18 20:06:33 +0000880echo " --enable-linux-user enable all linux usermode emulation targets"
881echo " --disable-linux-user disable all linux usermode emulation targets"
882echo " --enable-darwin-user enable all darwin usermode emulation targets"
883echo " --disable-darwin-user disable all darwin usermode emulation targets"
blueswir184778502008-10-26 20:33:16 +0000884echo " --enable-bsd-user enable all BSD usermode emulation targets"
885echo " --disable-bsd-user disable all BSD usermode emulation targets"
Paul Brook379f6692009-07-17 12:48:08 +0100886echo " --enable-guest-base enable GUEST_BASE support for usermode"
887echo " emulation targets"
888echo " --disable-guest-base disable GUEST_BASE support"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300889echo " --enable-user-pie build usermode emulation targets as PIE"
890echo " --disable-user-pie do not build usermode emulation targets as PIE"
pbrookaf5db582006-04-08 14:26:41 +0000891echo " --fmod-lib path to FMOD library"
892echo " --fmod-inc path to FMOD includes"
blueswir12f6a1ab2008-08-21 18:00:53 +0000893echo " --oss-lib path to OSS library"
pbrookc5937222006-05-14 11:30:38 +0000894echo " --enable-uname-release=R Return R for uname -r in usermode emulation"
blueswir131422552007-04-16 18:27:06 +0000895echo " --sparc_cpu=V Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
Stefan Weilee682d22009-10-01 20:10:37 +0200896echo " --disable-uuid disable uuid support"
897echo " --enable-uuid enable uuid support"
aliguorie0e6c8c02008-07-23 18:14:33 +0000898echo " --disable-vde disable support for vde network"
Juan Quinteladfb278b2009-08-12 18:20:27 +0200899echo " --enable-vde enable support for vde network"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200900echo " --disable-linux-aio disable Linux AIO support"
901echo " --enable-linux-aio enable Linux AIO support"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700902echo " --disable-attr disables attr and xattr support"
903echo " --enable-attr enable attr and xattr support"
aliguorie5d355d2009-04-24 18:03:15 +0000904echo " --enable-io-thread enable IO thread"
ths77755342008-11-27 15:45:16 +0000905echo " --disable-blobs disable installing provided firmware blobs"
aliguorieac30262008-11-05 16:28:56 +0000906echo " --kerneldir=PATH look for kernel includes in PATH"
Dirk Ullrichd2807bc2010-02-06 09:48:23 +0100907echo " --enable-docs enable documentation build"
908echo " --disable-docs disable documentation build"
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200909echo " --disable-vhost-net disable vhost-net acceleration support"
910echo " --enable-vhost-net enable vhost-net acceleration support"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +0100911echo " --trace-backend=B Trace backend nop simple ust"
Prerna Saxena9410b562010-07-13 09:26:32 +0100912echo " --trace-file=NAME Full PATH,NAME of file to store traces"
913echo " Default:trace-<pid>"
pbrookaf5db582006-04-08 14:26:41 +0000914echo ""
ths5bf08932006-12-23 00:33:26 +0000915echo "NOTE: The object files are built at the place where configure is launched"
pbrookaf5db582006-04-08 14:26:41 +0000916exit 1
917fi
918
bellardec530c82006-04-25 22:36:06 +0000919#
920# Solaris specific configure tool chain decisions
921#
922if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +0100923 if has $install; then
924 :
925 else
bellardec530c82006-04-25 22:36:06 +0000926 echo "Solaris install program not found. Use --install=/usr/ucb/install or"
927 echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
928 echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
929 exit 1
930 fi
Loïc Minier6792aa12010-01-20 11:35:54 +0100931 if test "`path_of $install`" = "/usr/sbin/install" ; then
bellardec530c82006-04-25 22:36:06 +0000932 echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
933 echo "try ginstall from the GNU fileutils available from www.blastwave.org"
934 echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
935 exit 1
936 fi
Loïc Minier6792aa12010-01-20 11:35:54 +0100937 if has ar; then
938 :
939 else
bellardec530c82006-04-25 22:36:06 +0000940 echo "Error: No path includes ar"
941 if test -f /usr/ccs/bin/ar ; then
942 echo "Add /usr/ccs/bin to your path and rerun configure"
943 fi
944 exit 1
945 fi
ths5fafdf22007-09-16 21:08:06 +0000946fi
bellardec530c82006-04-25 22:36:06 +0000947
948
bellard5327cf42005-01-10 23:18:50 +0000949if test -z "$target_list" ; then
950# these targets are portable
pbrook0a8e90f2006-03-19 14:54:16 +0000951 if [ "$softmmu" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000952 target_list="\
953i386-softmmu \
954x86_64-softmmu \
955arm-softmmu \
956cris-softmmu \
957m68k-softmmu \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200958microblaze-softmmu \
aurel322408a522008-04-20 20:19:44 +0000959mips-softmmu \
960mipsel-softmmu \
961mips64-softmmu \
962mips64el-softmmu \
963ppc-softmmu \
964ppcemb-softmmu \
965ppc64-softmmu \
966sh4-softmmu \
967sh4eb-softmmu \
968sparc-softmmu \
Igor V. Kovalenko1b64fca2009-06-23 18:04:16 +0000969sparc64-softmmu \
aurel322408a522008-04-20 20:19:44 +0000970"
pbrook0a8e90f2006-03-19 14:54:16 +0000971 fi
bellard5327cf42005-01-10 23:18:50 +0000972# the following are Linux specific
ths831b7822007-01-18 20:06:33 +0000973 if [ "$linux_user" = "yes" ] ; then
aurel322408a522008-04-20 20:19:44 +0000974 target_list="${target_list}\
975i386-linux-user \
976x86_64-linux-user \
977alpha-linux-user \
978arm-linux-user \
979armeb-linux-user \
980cris-linux-user \
981m68k-linux-user \
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +0200982microblaze-linux-user \
aurel322408a522008-04-20 20:19:44 +0000983mips-linux-user \
984mipsel-linux-user \
985ppc-linux-user \
986ppc64-linux-user \
987ppc64abi32-linux-user \
988sh4-linux-user \
989sh4eb-linux-user \
990sparc-linux-user \
991sparc64-linux-user \
992sparc32plus-linux-user \
993"
ths831b7822007-01-18 20:06:33 +0000994 fi
995# the following are Darwin specific
996 if [ "$darwin_user" = "yes" ] ; then
malc6cdc7372009-01-06 18:57:51 +0000997 target_list="$target_list i386-darwin-user ppc-darwin-user "
bellard5327cf42005-01-10 23:18:50 +0000998 fi
blueswir184778502008-10-26 20:33:16 +0000999# the following are BSD specific
1000 if [ "$bsd_user" = "yes" ] ; then
1001 target_list="${target_list}\
blueswir131fc12d2009-04-11 11:09:31 +00001002i386-bsd-user \
1003x86_64-bsd-user \
1004sparc-bsd-user \
blueswir184778502008-10-26 20:33:16 +00001005sparc64-bsd-user \
1006"
1007 fi
bellard6e20a452005-06-05 15:56:02 +00001008else
pbrookb1a550a2006-04-16 13:28:56 +00001009 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001010fi
pbrook0a8e90f2006-03-19 14:54:16 +00001011if test -z "$target_list" ; then
1012 echo "No targets enabled"
1013 exit 1
1014fi
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001015# see if system emulation was really requested
1016case " $target_list " in
1017 *"-softmmu "*) softmmu=yes
1018 ;;
1019 *) softmmu=no
1020 ;;
1021esac
bellard5327cf42005-01-10 23:18:50 +00001022
Juan Quintela249247c2009-08-12 18:20:25 +02001023feature_not_found() {
1024 feature=$1
1025
1026 echo "ERROR"
1027 echo "ERROR: User requested feature $feature"
Sebastian Herbszt9332f6a2009-09-13 21:32:54 +02001028 echo "ERROR: configure was not able to find it"
Juan Quintela249247c2009-08-12 18:20:25 +02001029 echo "ERROR"
1030 exit 1;
1031}
1032
bellard7d132992003-03-06 23:23:54 +00001033if test -z "$cross_prefix" ; then
1034
1035# ---
1036# big/little endian test
1037cat > $TMPC << EOF
1038#include <inttypes.h>
1039int main(int argc, char ** argv){
bellard1d14ffa2005-10-30 18:58:22 +00001040 volatile uint32_t i=0x01234567;
1041 return (*((uint8_t*)(&i))) == 0x67;
bellard7d132992003-03-06 23:23:54 +00001042}
1043EOF
1044
Juan Quintela52166aa2009-08-03 14:46:03 +02001045if compile_prog "" "" ; then
bellard7d132992003-03-06 23:23:54 +00001046$TMPE && bigendian="yes"
1047else
1048echo big/little test failed
1049fi
1050
1051else
1052
1053# if cross compiling, cannot launch a program, so make a static guess
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001054case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01001055 armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001056 bigendian=yes
1057 ;;
1058esac
bellard7d132992003-03-06 23:23:54 +00001059
1060fi
1061
bellardb6853692005-06-05 17:10:39 +00001062# host long bits test
1063hostlongbits="32"
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001064case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01001065 x86_64|alpha|ia64|sparc64|ppc64|s390x)
Juan Quintelaea8f20f2009-08-03 14:46:12 +02001066 hostlongbits=64
1067 ;;
1068esac
bellardb6853692005-06-05 17:10:39 +00001069
Juan Quintelab0a47e72009-08-12 18:29:49 +02001070
1071##########################################
1072# NPTL probe
1073
1074if test "$nptl" != "no" ; then
1075 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001076#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001077#include <linux/futex.h>
pbrookbd0c5662008-05-29 14:34:11 +00001078void foo()
1079{
1080#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1081#error bork
1082#endif
1083}
1084EOF
1085
Juan Quintelab0a47e72009-08-12 18:29:49 +02001086 if compile_object ; then
1087 nptl=yes
1088 else
1089 if test "$nptl" = "yes" ; then
1090 feature_not_found "nptl"
1091 fi
1092 nptl=no
1093 fi
pbrookbd0c5662008-05-29 14:34:11 +00001094fi
1095
bellard11d9f692004-04-02 20:55:59 +00001096##########################################
balrogac629222008-10-11 09:56:04 +00001097# zlib check
1098
1099cat > $TMPC << EOF
1100#include <zlib.h>
1101int main(void) { zlibVersion(); return 0; }
1102EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001103if compile_prog "" "-lz" ; then
balrogac629222008-10-11 09:56:04 +00001104 :
1105else
1106 echo
1107 echo "Error: zlib check failed"
1108 echo "Make sure to have the zlib libs and headers installed."
1109 echo
1110 exit 1
1111fi
1112
1113##########################################
aliguorie37630c2009-04-22 15:19:10 +00001114# xen probe
1115
Juan Quintelafc321b42009-08-12 18:29:55 +02001116if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001117 xen_libs="-lxenstore -lxenctrl -lxenguest"
1118 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001119#include <xenctrl.h>
1120#include <xs.h>
Christoph Eggerdf7a6072009-06-30 14:59:38 +02001121int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
aliguorie37630c2009-04-22 15:19:10 +00001122EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001123 if compile_prog "" "$xen_libs" ; then
Juan Quintelafc321b42009-08-12 18:29:55 +02001124 xen=yes
Juan Quintela3efd6322009-08-03 14:46:36 +02001125 libs_softmmu="$xen_libs $libs_softmmu"
Juan Quintelab2266be2009-07-27 16:13:16 +02001126 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001127 if test "$xen" = "yes" ; then
1128 feature_not_found "xen"
1129 fi
1130 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001131 fi
aliguorie37630c2009-04-22 15:19:10 +00001132fi
1133
1134##########################################
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001135# pkgconfig probe
1136
1137pkgconfig="${cross_prefix}pkg-config"
Loïc Minier0dba6192010-01-28 21:26:51 +00001138if ! has $pkgconfig; then
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001139 # likely not cross compiling, or hope for the best
1140 pkgconfig=pkg-config
1141fi
1142
1143##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001144# Sparse probe
1145if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001146 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001147 sparse=yes
1148 else
1149 if test "$sparse" = "yes" ; then
1150 feature_not_found "sparse"
1151 fi
1152 sparse=no
1153 fi
1154fi
1155
1156##########################################
bellard11d9f692004-04-02 20:55:59 +00001157# SDL probe
1158
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001159# Look for sdl configuration program (pkg-config or sdl-config).
1160# Prefer variant with cross prefix if cross compiling,
1161# and favour pkg-config with sdl over sdl-config.
1162if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1163 $pkgconfig sdl --modversion >/dev/null 2>&1; then
1164 sdlconfig="$pkgconfig sdl"
1165 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1166elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1167 sdlconfig="${cross_prefix}sdl-config"
1168 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1169elif $pkgconfig sdl --modversion >/dev/null 2>&1; then
Paolo Bonzini9316f802010-01-13 09:52:55 +01001170 sdlconfig="$pkgconfig sdl"
1171 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Loïc Minier0dba6192010-01-28 21:26:51 +00001172elif has sdl-config; then
Paolo Bonzini9316f802010-01-13 09:52:55 +01001173 sdlconfig='sdl-config'
1174 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001175else
1176 if test "$sdl" = "yes" ; then
1177 feature_not_found "sdl"
1178 fi
1179 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01001180fi
bellard11d9f692004-04-02 20:55:59 +00001181
Paolo Bonzini9316f802010-01-13 09:52:55 +01001182sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02001183if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001184 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00001185#include <SDL.h>
1186#undef main /* We don't want SDL to override our main() */
1187int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1188EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01001189 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08001190 if test "$static" = "yes" ; then
1191 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1192 else
1193 sdl_libs=`$sdlconfig --libs 2> /dev/null`
1194 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001195 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001196 if test "$_sdlversion" -lt 121 ; then
1197 sdl_too_old=yes
1198 else
1199 if test "$cocoa" = "no" ; then
1200 sdl=yes
1201 fi
1202 fi
aliguoricd01b4a2008-08-21 19:25:45 +00001203
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001204 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02001205 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01001206 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01001207 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1208 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02001209 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001210 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001211 :
1212 else
1213 sdl=no
1214 fi
1215 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02001216 else # sdl not found
1217 if test "$sdl" = "yes" ; then
1218 feature_not_found "sdl"
1219 fi
1220 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02001221 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02001222fi
bellard11d9f692004-04-02 20:55:59 +00001223
aliguori5368a422009-03-03 17:37:21 +00001224if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001225 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00001226#include <SDL.h>
1227#if defined(SDL_VIDEO_DRIVER_X11)
1228#include <X11/XKBlib.h>
1229#else
1230#error No x11 support
1231#endif
1232int main(void) { return 0; }
1233EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001234 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02001235 sdl_libs="$sdl_libs -lX11"
1236 fi
Juan Quintela07d9ac42009-08-03 14:46:25 +02001237 if test "$mingw32" = "yes" ; then
1238 sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1239 fi
Juan Quintela07056672009-08-03 14:46:27 +02001240 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00001241fi
1242
ths8f28f3f2007-01-05 21:25:54 +00001243##########################################
ths8d5d2d42007-08-25 01:37:51 +00001244# VNC TLS detection
Juan Quintela1be10ad2009-08-12 18:20:28 +02001245if test "$vnc_tls" != "no" ; then
1246 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00001247#include <gnutls/gnutls.h>
1248int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1249EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001250 vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1251 vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02001252 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1253 vnc_tls=yes
1254 libs_softmmu="$vnc_tls_libs $libs_softmmu"
1255 else
1256 if test "$vnc_tls" = "yes" ; then
1257 feature_not_found "vnc-tls"
aliguoriae6b5e52008-08-06 16:55:50 +00001258 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02001259 vnc_tls=no
1260 fi
ths8d5d2d42007-08-25 01:37:51 +00001261fi
1262
1263##########################################
aliguori2f9606b2009-03-06 20:27:28 +00001264# VNC SASL detection
Juan Quintela3aefa742009-08-31 17:16:43 +02001265if test "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02001266 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00001267#include <sasl/sasl.h>
1268#include <stdio.h>
1269int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1270EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02001271 # Assuming Cyrus-SASL installed in /usr prefix
1272 vnc_sasl_cflags=""
1273 vnc_sasl_libs="-lsasl2"
1274 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1275 vnc_sasl=yes
1276 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1277 else
1278 if test "$vnc_sasl" = "yes" ; then
1279 feature_not_found "vnc-sasl"
aliguori2f9606b2009-03-06 20:27:28 +00001280 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02001281 vnc_sasl=no
1282 fi
aliguori2f9606b2009-03-06 20:27:28 +00001283fi
1284
1285##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001286# VNC JPEG detection
Corentin Chary96763cf2010-07-07 20:58:06 +02001287if test "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02001288cat > $TMPC <<EOF
1289#include <stdio.h>
1290#include <jpeglib.h>
1291int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
1292EOF
1293 vnc_jpeg_cflags=""
1294 vnc_jpeg_libs="-ljpeg"
1295 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
1296 vnc_jpeg=yes
1297 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1298 else
1299 if test "$vnc_jpeg" = "yes" ; then
1300 feature_not_found "vnc-jpeg"
1301 fi
1302 vnc_jpeg=no
1303 fi
1304fi
1305
1306##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02001307# VNC PNG detection
Corentin Chary96763cf2010-07-07 20:58:06 +02001308if test "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02001309cat > $TMPC <<EOF
1310//#include <stdio.h>
1311#include <png.h>
1312int main(void) {
1313 png_structp png_ptr;
1314 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1315 return 0;
1316}
1317EOF
1318 vnc_png_cflags=""
1319 vnc_png_libs="-lpng"
1320 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1321 vnc_png=yes
1322 libs_softmmu="$vnc_png_libs $libs_softmmu"
1323 else
1324 if test "$vnc_png" = "yes" ; then
1325 feature_not_found "vnc-png"
1326 fi
1327 vnc_png=no
1328 fi
1329fi
1330
1331##########################################
aliguori76655d62009-03-06 20:27:37 +00001332# fnmatch() probe, used for ACL routines
1333fnmatch="no"
1334cat > $TMPC << EOF
1335#include <fnmatch.h>
1336int main(void)
1337{
1338 fnmatch("foo", "foo", 0);
1339 return 0;
1340}
1341EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001342if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00001343 fnmatch="yes"
1344fi
1345
1346##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02001347# uuid_generate() probe, used for vdi block driver
1348if test "$uuid" != "no" ; then
1349 uuid_libs="-luuid"
1350 cat > $TMPC << EOF
1351#include <uuid/uuid.h>
1352int main(void)
1353{
1354 uuid_t my_uuid;
1355 uuid_generate(my_uuid);
1356 return 0;
1357}
1358EOF
1359 if compile_prog "" "$uuid_libs" ; then
1360 uuid="yes"
1361 libs_softmmu="$uuid_libs $libs_softmmu"
1362 libs_tools="$uuid_libs $libs_tools"
1363 else
1364 if test "$uuid" = "yes" ; then
1365 feature_not_found "uuid"
1366 fi
1367 uuid=no
1368 fi
1369fi
1370
1371##########################################
ths8a16d272008-07-19 09:56:24 +00001372# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02001373if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001374 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00001375 cat > $TMPC << EOF
1376#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00001377int main(void)
1378{
1379 struct vde_open_args a = {0, 0, 0};
1380 vde_open("", "", &a);
1381 return 0;
1382}
ths8a16d272008-07-19 09:56:24 +00001383EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001384 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02001385 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02001386 libs_softmmu="$vde_libs $libs_softmmu"
1387 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02001388 else
1389 if test "$vde" = "yes" ; then
1390 feature_not_found "vde"
1391 fi
1392 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02001393 fi
ths8a16d272008-07-19 09:56:24 +00001394fi
1395
1396##########################################
malcc2de5c92008-06-28 19:13:06 +00001397# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00001398
malcc2de5c92008-06-28 19:13:06 +00001399audio_drv_probe()
1400{
1401 drv=$1
1402 hdr=$2
1403 lib=$3
1404 exp=$4
1405 cfl=$5
1406 cat > $TMPC << EOF
1407#include <$hdr>
1408int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00001409EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001410 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00001411 :
1412 else
1413 echo
1414 echo "Error: $drv check failed"
1415 echo "Make sure to have the $drv libs and headers installed."
1416 echo
1417 exit 1
1418 fi
1419}
1420
malc2fa7d3b2008-07-29 12:58:44 +00001421audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00001422for drv in $audio_drv_list; do
1423 case $drv in
1424 alsa)
1425 audio_drv_probe $drv alsa/asoundlib.h -lasound \
1426 "snd_pcm_t **handle; return snd_pcm_close(*handle);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001427 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001428 ;;
1429
1430 fmod)
1431 if test -z $fmod_lib || test -z $fmod_inc; then
1432 echo
1433 echo "Error: You must specify path to FMOD library and headers"
1434 echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1435 echo
1436 exit 1
1437 fi
1438 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001439 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00001440 ;;
1441
1442 esd)
1443 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001444 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001445 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00001446 ;;
malcb8e59f12008-07-02 21:03:08 +00001447
1448 pa)
Aurelien Jarno493abda2009-11-16 17:52:03 +01001449 audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
malcb8e59f12008-07-02 21:03:08 +00001450 "pa_simple *s = NULL; pa_simple_free(s); return 0;"
Aurelien Jarno493abda2009-11-16 17:52:03 +01001451 libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02001452 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00001453 ;;
1454
Juan Quintela997e6902009-08-03 14:46:29 +02001455 coreaudio)
1456 libs_softmmu="-framework CoreAudio $libs_softmmu"
1457 ;;
1458
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001459 dsound)
1460 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04001461 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02001462 ;;
1463
1464 oss)
1465 libs_softmmu="$oss_lib $libs_softmmu"
1466 ;;
1467
1468 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00001469 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1470 ;;
1471
malcd5631632009-10-10 01:13:41 +04001472 winwave)
1473 libs_softmmu="-lwinmm $libs_softmmu"
1474 audio_win_int="yes"
1475 ;;
1476
malce4c63a62008-07-19 16:15:16 +00001477 *)
malc1c9b2a52008-07-19 16:57:30 +00001478 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
malce4c63a62008-07-19 16:15:16 +00001479 echo
1480 echo "Error: Unknown driver '$drv' selected"
1481 echo "Possible drivers are: $audio_possible_drivers"
1482 echo
1483 exit 1
1484 }
1485 ;;
malcc2de5c92008-06-28 19:13:06 +00001486 esac
1487done
ths8f28f3f2007-01-05 21:25:54 +00001488
balrog4d3b6f62008-02-10 16:33:14 +00001489##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00001490# BrlAPI probe
1491
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001492if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001493 brlapi_libs="-lbrlapi"
1494 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00001495#include <brlapi.h>
1496int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1497EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001498 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02001499 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02001500 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02001501 else
1502 if test "$brlapi" = "yes" ; then
1503 feature_not_found "brlapi"
1504 fi
1505 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02001506 fi
1507fi
aurel322e4d9fb2008-04-08 06:01:02 +00001508
1509##########################################
balrog4d3b6f62008-02-10 16:33:14 +00001510# curses probe
Juan Quintela4f78ef92009-08-12 18:20:23 +02001511curses_list="-lncurses -lcurses"
balrog4d3b6f62008-02-10 16:33:14 +00001512
Juan Quintelac584a6d2009-08-12 18:20:30 +02001513if test "$curses" != "no" ; then
1514 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00001515 cat > $TMPC << EOF
1516#include <curses.h>
blueswir15a8ff3a2009-04-13 16:18:34 +00001517#ifdef __OpenBSD__
1518#define resize_term resizeterm
1519#endif
1520int main(void) { resize_term(0, 0); return curses_version(); }
balrog4d3b6f62008-02-10 16:33:14 +00001521EOF
Juan Quintela4f78ef92009-08-12 18:20:23 +02001522 for curses_lib in $curses_list; do
1523 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02001524 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02001525 libs_softmmu="$curses_lib $libs_softmmu"
1526 break
1527 fi
1528 done
Juan Quintelac584a6d2009-08-12 18:20:30 +02001529 if test "$curses_found" = "yes" ; then
1530 curses=yes
1531 else
1532 if test "$curses" = "yes" ; then
1533 feature_not_found "curses"
1534 fi
1535 curses=no
1536 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02001537fi
balrog4d3b6f62008-02-10 16:33:14 +00001538
blueswir1414f0da2008-08-15 18:20:52 +00001539##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02001540# curl probe
1541
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001542if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1543 curlconfig="$pkgconfig libcurl"
1544else
1545 curlconfig=curl-config
1546fi
1547
Juan Quintela788c8192009-08-12 18:29:47 +02001548if test "$curl" != "no" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001549 cat > $TMPC << EOF
1550#include <curl/curl.h>
1551int main(void) { return curl_easy_init(); }
1552EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01001553 curl_cflags=`$curlconfig --cflags 2>/dev/null`
1554 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02001555 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02001556 curl=yes
Juan Quintelaf0302932009-08-03 14:47:08 +02001557 libs_tools="$curl_libs $libs_tools"
1558 libs_softmmu="$curl_libs $libs_softmmu"
Juan Quintela788c8192009-08-12 18:29:47 +02001559 else
1560 if test "$curl" = "yes" ; then
1561 feature_not_found "curl"
1562 fi
1563 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02001564 fi
1565fi # test "$curl"
1566
1567##########################################
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001568# check framework probe
1569
1570if test "$check_utests" != "no" ; then
1571 cat > $TMPC << EOF
1572#include <check.h>
1573int main(void) { suite_create("qemu test"); return 0; }
1574EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001575 check_libs=`$pkgconfig --libs check`
Luiz Capitulino5495ed12009-08-28 15:27:28 -03001576 if compile_prog "" $check_libs ; then
1577 check_utests=yes
1578 libs_tools="$check_libs $libs_tools"
1579 else
1580 if test "$check_utests" = "yes" ; then
1581 feature_not_found "check"
1582 fi
1583 check_utests=no
1584 fi
1585fi # test "$check_utests"
1586
1587##########################################
balrogfb599c92008-09-28 23:49:55 +00001588# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001589if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00001590 cat > $TMPC << EOF
1591#include <bluetooth/bluetooth.h>
1592int main(void) { return bt_error(0); }
1593EOF
Paolo Bonzinif91672e2010-01-13 09:52:53 +01001594 bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1595 bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02001596 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001597 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02001598 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00001599 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02001600 if test "$bluez" = "yes" ; then
1601 feature_not_found "bluez"
1602 fi
balroge820e3f2008-09-30 02:27:44 +00001603 bluez="no"
1604 fi
balrogfb599c92008-09-28 23:49:55 +00001605fi
1606
1607##########################################
aliguori7ba1e612008-11-05 16:04:33 +00001608# kvm probe
Juan Quintelab31a0272009-08-12 18:29:56 +02001609if test "$kvm" != "no" ; then
aliguori7ba1e612008-11-05 16:04:33 +00001610 cat > $TMPC <<EOF
1611#include <linux/kvm.h>
aliguori9fd8d8d2009-01-15 21:57:30 +00001612#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
aliguori7ba1e612008-11-05 16:04:33 +00001613#error Invalid KVM version
1614#endif
aliguori9fd8d8d2009-01-15 21:57:30 +00001615#if !defined(KVM_CAP_USER_MEMORY)
1616#error Missing KVM capability KVM_CAP_USER_MEMORY
1617#endif
1618#if !defined(KVM_CAP_SET_TSS_ADDR)
1619#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1620#endif
1621#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1622#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1623#endif
aliguori7ba1e612008-11-05 16:04:33 +00001624int main(void) { return 0; }
1625EOF
aliguorieac30262008-11-05 16:28:56 +00001626 if test "$kerneldir" != "" ; then
1627 kvm_cflags=-I"$kerneldir"/include
aliguori8444eb62009-01-09 20:05:10 +00001628 if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1629 -a -d "$kerneldir/arch/x86/include" ; then
1630 kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
aliguori406b4302009-01-15 21:13:33 +00001631 elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1632 kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
Alexander Graf0e60a692009-12-05 12:44:24 +01001633 elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1634 kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
aliguori8444eb62009-01-09 20:05:10 +00001635 elif test -d "$kerneldir/arch/$cpu/include" ; then
1636 kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1637 fi
aliguorieac30262008-11-05 16:28:56 +00001638 else
Stefan Weilf038e8f2010-04-11 19:01:01 +02001639 kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
aliguorieac30262008-11-05 16:28:56 +00001640 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02001641 if compile_prog "$kvm_cflags" "" ; then
Juan Quintelab31a0272009-08-12 18:29:56 +02001642 kvm=yes
Jan Kiszkadae50792010-01-12 19:53:48 +01001643 cat > $TMPC <<EOF
1644#include <linux/kvm_para.h>
1645int main(void) { return 0; }
1646EOF
1647 if compile_prog "$kvm_cflags" "" ; then
1648 kvm_para=yes
1649 fi
aliguori7ba1e612008-11-05 16:04:33 +00001650 else
Juan Quintelab31a0272009-08-12 18:29:56 +02001651 if test "$kvm" = "yes" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001652 if has awk && has grep; then
Juan Quintelab31a0272009-08-12 18:29:56 +02001653 kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
aliguori9fd8d8d2009-01-15 21:57:30 +00001654 | grep "error: " \
1655 | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
Juan Quintelab31a0272009-08-12 18:29:56 +02001656 if test "$kvmerr" != "" ; then
1657 echo -e "${kvmerr}\n\
1658 NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1659 recent kvm-kmod from http://sourceforge.net/projects/kvm."
1660 fi
aliguori9fd8d8d2009-01-15 21:57:30 +00001661 fi
Juan Quintelab31a0272009-08-12 18:29:56 +02001662 feature_not_found "kvm"
aliguori9fd8d8d2009-01-15 21:57:30 +00001663 fi
Juan Quintelab31a0272009-08-12 18:29:56 +02001664 kvm=no
aliguori7ba1e612008-11-05 16:04:33 +00001665 fi
1666fi
1667
1668##########################################
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001669# test for vhost net
1670
1671if test "$vhost_net" != "no"; then
1672 if test "$kvm" != "no"; then
1673 cat > $TMPC <<EOF
1674 #include <linux/vhost.h>
1675 int main(void) { return 0; }
1676EOF
1677 if compile_prog "$kvm_cflags" "" ; then
1678 vhost_net=yes
1679 else
1680 if test "$vhost_net" = "yes" ; then
1681 feature_not_found "vhost-net"
1682 fi
1683 vhost_net=no
1684 fi
1685 else
1686 if test "$vhost_net" = "yes" ; then
Aurelien Jarno4021d242010-06-10 00:06:55 +02001687 echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
Michael S. Tsirkind5970052010-03-17 13:08:17 +02001688 feature_not_found "vhost-net"
1689 fi
1690 vhost_net=no
1691 fi
1692fi
1693
1694##########################################
aliguorie5d355d2009-04-24 18:03:15 +00001695# pthread probe
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001696PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00001697
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001698pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00001699cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00001700#include <pthread.h>
Sebastian Herbsztde65fe02009-05-24 22:07:53 +02001701int main(void) { pthread_create(0,0,0,0); return 0; }
blueswir1414f0da2008-08-15 18:20:52 +00001702EOF
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001703for pthread_lib in $PTHREADLIBS_LIST; do
1704 if compile_prog "" "$pthread_lib" ; then
1705 pthread=yes
1706 LIBS="$pthread_lib $LIBS"
1707 break
1708 fi
1709done
blueswir1414f0da2008-08-15 18:20:52 +00001710
Anthony Liguori4617e592009-08-25 17:21:56 -05001711if test "$mingw32" != yes -a "$pthread" = no; then
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02001712 echo
1713 echo "Error: pthread check failed"
1714 echo "Make sure to have the pthread libs and headers installed."
1715 echo
1716 exit 1
aliguorie5d355d2009-04-24 18:03:15 +00001717fi
1718
aliguoribf9298b2008-12-05 20:05:26 +00001719##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001720# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001721
1722if test "$linux_aio" != "no" ; then
1723 cat > $TMPC <<EOF
1724#include <libaio.h>
1725#include <sys/eventfd.h>
1726int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1727EOF
1728 if compile_prog "" "-laio" ; then
1729 linux_aio=yes
Paul Brook048d1792010-05-05 16:32:59 +01001730 libs_softmmu="$libs_softmmu -laio"
1731 libs_tools="$libs_tools -laio"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001732 else
1733 if test "$linux_aio" = "yes" ; then
1734 feature_not_found "linux AIO"
1735 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03001736 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02001737 fi
1738fi
1739
1740##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07001741# attr probe
1742
1743if test "$attr" != "no" ; then
1744 cat > $TMPC <<EOF
1745#include <stdio.h>
1746#include <sys/types.h>
1747#include <attr/xattr.h>
1748int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1749EOF
1750 if compile_prog "" "-lattr" ; then
1751 attr=yes
1752 LIBS="-lattr $LIBS"
1753 else
1754 if test "$attr" = "yes" ; then
1755 feature_not_found "ATTR"
1756 fi
1757 attr=no
1758 fi
1759fi
1760
1761##########################################
aliguoribf9298b2008-12-05 20:05:26 +00001762# iovec probe
1763cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00001764#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00001765#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00001766#include <unistd.h>
aliguoribf9298b2008-12-05 20:05:26 +00001767int main(void) { struct iovec iov; return 0; }
1768EOF
1769iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001770if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00001771 iovec=yes
1772fi
1773
aurel32f652e6a2008-12-16 10:43:48 +00001774##########################################
aliguoriceb42de2009-04-07 18:43:28 +00001775# preadv probe
1776cat > $TMPC <<EOF
1777#include <sys/types.h>
1778#include <sys/uio.h>
1779#include <unistd.h>
1780int main(void) { preadv; }
1781EOF
1782preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02001783if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00001784 preadv=yes
1785fi
1786
1787##########################################
aurel32f652e6a2008-12-16 10:43:48 +00001788# fdt probe
Juan Quintela2df87df2009-08-12 18:29:54 +02001789if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02001790 fdt_libs="-lfdt"
1791 cat > $TMPC << EOF
aurel32f652e6a2008-12-16 10:43:48 +00001792int main(void) { return 0; }
1793EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001794 if compile_prog "" "$fdt_libs" ; then
aurel32f652e6a2008-12-16 10:43:48 +00001795 fdt=yes
Juan Quintelae4782982009-08-03 14:46:38 +02001796 libs_softmmu="$fdt_libs $libs_softmmu"
Juan Quintela2df87df2009-08-12 18:29:54 +02001797 else
1798 if test "$fdt" = "yes" ; then
1799 feature_not_found "fdt"
1800 fi
1801 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00001802 fi
1803fi
1804
aurel323b3f24a2009-04-15 16:12:13 +00001805#
1806# Check for xxxat() functions when we are building linux-user
1807# emulator. This is done because older glibc versions don't
1808# have syscall stubs for these implemented.
1809#
1810atfile=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001811cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001812#define _ATFILE_SOURCE
1813#include <sys/types.h>
1814#include <fcntl.h>
1815#include <unistd.h>
1816
1817int
1818main(void)
1819{
1820 /* try to unlink nonexisting file */
1821 return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1822}
1823EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001824if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001825 atfile=yes
aurel323b3f24a2009-04-15 16:12:13 +00001826fi
1827
aurel3239386ac2009-04-15 19:48:17 +00001828# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00001829# emulator. This is done because older glibc versions don't
1830# have syscall stubs for these implemented. In that case we
1831# don't provide them even if kernel supports them.
1832#
1833inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03001834cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00001835#include <sys/inotify.h>
1836
1837int
1838main(void)
1839{
1840 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00001841 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00001842}
1843EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001844if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03001845 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00001846fi
1847
Riku Voipioc05c7a72010-03-26 15:25:11 +00001848inotify1=no
1849cat > $TMPC << EOF
1850#include <sys/inotify.h>
1851
1852int
1853main(void)
1854{
1855 /* try to start inotify */
1856 return inotify_init1(0);
1857}
1858EOF
1859if compile_prog "" "" ; then
1860 inotify1=yes
1861fi
1862
Riku Voipioebc996f2009-04-21 15:01:51 +03001863# check if utimensat and futimens are supported
1864utimens=no
1865cat > $TMPC << EOF
1866#define _ATFILE_SOURCE
1867#define _GNU_SOURCE
1868#include <stddef.h>
1869#include <fcntl.h>
1870
1871int main(void)
1872{
1873 utimensat(AT_FDCWD, "foo", NULL, 0);
1874 futimens(0, NULL);
1875 return 0;
1876}
1877EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001878if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03001879 utimens=yes
1880fi
1881
Riku Voipio099d6b02009-05-05 12:10:04 +03001882# check if pipe2 is there
1883pipe2=no
1884cat > $TMPC << EOF
1885#define _GNU_SOURCE
1886#include <unistd.h>
1887#include <fcntl.h>
1888
1889int main(void)
1890{
1891 int pipefd[2];
1892 pipe2(pipefd, O_CLOEXEC);
1893 return 0;
1894}
1895EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001896if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03001897 pipe2=yes
1898fi
1899
Kevin Wolf40ff6d72009-12-02 12:24:42 +01001900# check if accept4 is there
1901accept4=no
1902cat > $TMPC << EOF
1903#define _GNU_SOURCE
1904#include <sys/socket.h>
1905#include <stddef.h>
1906
1907int main(void)
1908{
1909 accept4(0, NULL, NULL, SOCK_CLOEXEC);
1910 return 0;
1911}
1912EOF
1913if compile_prog "" "" ; then
1914 accept4=yes
1915fi
1916
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301917# check if tee/splice is there. vmsplice was added same time.
1918splice=no
1919cat > $TMPC << EOF
1920#define _GNU_SOURCE
1921#include <unistd.h>
1922#include <fcntl.h>
1923#include <limits.h>
1924
1925int main(void)
1926{
1927 int len, fd;
1928 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1929 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1930 return 0;
1931}
1932EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02001933if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05301934 splice=yes
1935fi
1936
Riku Voipioc2882b92009-08-12 15:08:24 +03001937# check if eventfd is supported
1938eventfd=no
1939cat > $TMPC << EOF
1940#include <sys/eventfd.h>
1941
1942int main(void)
1943{
1944 int efd = eventfd(0, 0);
1945 return 0;
1946}
1947EOF
1948if compile_prog "" "" ; then
1949 eventfd=yes
1950fi
1951
Ulrich Hechtd0927932009-09-17 20:22:14 +03001952# check for fallocate
1953fallocate=no
1954cat > $TMPC << EOF
1955#include <fcntl.h>
1956
1957int main(void)
1958{
1959 fallocate(0, 0, 0, 0);
1960 return 0;
1961}
1962EOF
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +02001963if compile_prog "$ARCH_CFLAGS" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03001964 fallocate=yes
1965fi
1966
1967# check for dup3
1968dup3=no
1969cat > $TMPC << EOF
1970#include <unistd.h>
1971
1972int main(void)
1973{
1974 dup3(0, 0, 0);
1975 return 0;
1976}
1977EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01001978if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03001979 dup3=yes
1980fi
1981
pbrookcc8ae6d2006-04-23 17:57:59 +00001982# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02001983if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01001984 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02001985 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02001986 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02001987 if test "$docs" = "yes" ; then
1988 feature_not_found "docs"
Juan Quintela83a3ab82009-08-12 18:29:51 +02001989 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02001990 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02001991 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00001992fi
1993
Stefan Weilf514f412009-10-11 12:44:07 +02001994# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02001995byteswap_h=no
1996cat > $TMPC << EOF
1997#include <byteswap.h>
1998int main(void) { return bswap_32(0); }
1999EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002000if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002001 byteswap_h=yes
2002fi
2003
Stefan Weilf514f412009-10-11 12:44:07 +02002004# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002005bswap_h=no
2006cat > $TMPC << EOF
2007#include <sys/endian.h>
2008#include <sys/types.h>
2009#include <machine/bswap.h>
2010int main(void) { return bswap32(0); }
2011EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002012if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002013 bswap_h=yes
2014fi
2015
aliguorida93a1f2008-12-12 20:02:52 +00002016##########################################
2017# Do we need librt
2018cat > $TMPC <<EOF
2019#include <signal.h>
2020#include <time.h>
2021int main(void) { clockid_t id; return clock_gettime(id, NULL); }
2022EOF
2023
Juan Quintela52166aa2009-08-03 14:46:03 +02002024if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002025 :
Juan Quintela52166aa2009-08-03 14:46:03 +02002026elif compile_prog "" "-lrt" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02002027 LIBS="-lrt $LIBS"
aliguorida93a1f2008-12-12 20:02:52 +00002028fi
2029
Blue Swirl31ff5042009-09-12 12:33:07 +00002030if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Juan Quintela6362a532009-08-03 14:46:32 +02002031 "$aix" != "yes" ; then
2032 libs_softmmu="-lutil $libs_softmmu"
2033fi
2034
Blue Swirlde5071c2009-09-12 09:58:46 +00002035##########################################
2036# check if the compiler defines offsetof
2037
2038need_offsetof=yes
2039cat > $TMPC << EOF
2040#include <stddef.h>
2041int main(void) { struct s { int f; }; return offsetof(struct s, f); }
2042EOF
2043if compile_prog "" "" ; then
2044 need_offsetof=no
2045fi
2046
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002047##########################################
Blue Swirl747bbdf2009-10-18 16:26:06 +00002048# check if the compiler understands attribute warn_unused_result
2049#
2050# This could be smarter, but gcc -Werror does not error out even when warning
2051# about attribute warn_unused_result
2052
2053gcc_attribute_warn_unused_result=no
2054cat > $TMPC << EOF
2055#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2056#error gcc 3.3 or older
2057#endif
2058int main(void) { return 0;}
2059EOF
2060if compile_prog "" ""; then
2061 gcc_attribute_warn_unused_result=yes
2062fi
2063
2064##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002065# check if we have fdatasync
2066
2067fdatasync=no
2068cat > $TMPC << EOF
2069#include <unistd.h>
2070int main(void) { return fdatasync(0); }
2071EOF
2072if compile_prog "" "" ; then
2073 fdatasync=yes
2074fi
2075
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002076##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00002077# check if we have madvise
2078
2079madvise=no
2080cat > $TMPC << EOF
2081#include <sys/types.h>
2082#include <sys/mman.h>
2083int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2084EOF
2085if compile_prog "" "" ; then
2086 madvise=yes
2087fi
2088
2089##########################################
2090# check if we have posix_madvise
2091
2092posix_madvise=no
2093cat > $TMPC << EOF
2094#include <sys/mman.h>
2095int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2096EOF
2097if compile_prog "" "" ; then
2098 posix_madvise=yes
2099fi
2100
2101##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002102# check if trace backend exists
2103
2104sh "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
2105if test "$?" -ne 0 ; then
2106 echo
2107 echo "Error: invalid trace backend"
2108 echo "Please choose a supported trace backend."
2109 echo
2110 exit 1
2111fi
2112
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01002113##########################################
2114# For 'ust' backend, test if ust headers are present
2115if test "$trace_backend" = "ust"; then
2116 cat > $TMPC << EOF
2117#include <ust/tracepoint.h>
2118#include <ust/marker.h>
2119int main(void) { return 0; }
2120EOF
2121 if compile_prog "" "" ; then
2122 LIBS="-lust $LIBS"
2123 else
2124 echo
2125 echo "Error: Trace backend 'ust' missing libust header files"
2126 echo
2127 exit 1
2128 fi
2129fi
2130##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02002131# End of CC checks
2132# After here, no more $cc or $ld runs
2133
Juan Quintelae86ecd42009-08-03 14:45:59 +02002134if test "$debug" = "no" ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002135 CFLAGS="-O2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002136fi
Juan Quintelaa316e372009-09-30 01:10:55 +02002137
Juan Quintelae86ecd42009-08-03 14:45:59 +02002138# Consult white-list to determine whether to enable werror
2139# by default. Only enable by default for git builds
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002140z_version=`cut -f3 -d. $source_path/VERSION`
2141
Juan Quintelae86ecd42009-08-03 14:45:59 +02002142if test -z "$werror" ; then
Juan Quintelae86ecd42009-08-03 14:45:59 +02002143 if test "$z_version" = "50" -a \
2144 "$linux" = "yes" ; then
2145 werror="yes"
2146 else
2147 werror="no"
2148 fi
2149fi
2150
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002151# Disable zero malloc errors for official releases unless explicitly told to
2152# enable/disable
2153if test -z "$zero_malloc" ; then
2154 if test "$z_version" = "50" ; then
2155 zero_malloc="no"
2156 else
2157 zero_malloc="yes"
2158 fi
2159fi
2160
Juan Quintelae86ecd42009-08-03 14:45:59 +02002161if test "$werror" = "yes" ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +02002162 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002163fi
2164
2165if test "$solaris" = "no" ; then
2166 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02002167 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02002168 fi
2169fi
2170
Blue Swirl952afb72010-09-19 08:36:34 +00002171# Use ASLR, no-SEH and DEP if available
2172if test "$mingw32" = "yes" ; then
2173 for flag in --dynamicbase --no-seh --nxcompat; do
2174 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2175 LDFLAGS="-Wl,$flag $LDFLAGS"
2176 fi
2177 done
2178fi
2179
Paolo Bonzini190e9c52010-05-26 16:08:21 +02002180confdir=$sysconfdir$confsuffix
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02002181
Paolo Bonzinica35f782010-05-26 16:08:29 +02002182tools=
2183if test "$softmmu" = yes ; then
2184 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2185 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2186 tools="qemu-nbd\$(EXESUF) $tools"
2187 if [ "$check_utests" = "yes" ]; then
2188 tools="check-qint check-qstring check-qdict check-qlist $tools"
2189 tools="check-qfloat check-qjson $tools"
2190 fi
2191 fi
2192fi
2193
2194# Mac OS X ships with a broken assembler
2195roms=
2196if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2197 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2198 "$softmmu" = yes ; then
2199 roms="optionrom"
2200fi
2201
2202
bellard43ce4df2003-06-09 19:53:12 +00002203echo "Install prefix $prefix"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002204echo "BIOS directory `eval echo $datadir`"
2205echo "binary directory `eval echo $bindir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02002206echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00002207if test "$mingw32" = "no" ; then
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02002208echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00002209echo "ELF interp prefix $interp_prefix"
bellard11d9f692004-04-02 20:55:59 +00002210fi
bellard5a671352003-10-01 00:13:48 +00002211echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00002212echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00002213echo "Host C compiler $host_cc"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002214echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02002215echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02002216echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00002217echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00002218echo "install $install"
bellard43ce4df2003-06-09 19:53:12 +00002219echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00002220echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00002221echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00002222echo "tcg debug enabled $debug_tcg"
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002223echo "Mon debug enabled $debug_mon"
bellard43ce4df2003-06-09 19:53:12 +00002224echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00002225echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00002226echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00002227echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00002228echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00002229echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00002230if test "$darwin" = "yes" ; then
2231 echo "Cocoa support $cocoa"
2232fi
bellard97a847b2003-08-10 21:36:04 +00002233echo "SDL support $sdl"
balrog4d3b6f62008-02-10 16:33:14 +00002234echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02002235echo "curl support $curl"
Luiz Capitulino5495ed12009-08-28 15:27:28 -03002236echo "check support $check_utests"
bellard67b915a2004-03-31 23:37:16 +00002237echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00002238echo "Audio drivers $audio_drv_list"
2239echo "Extra audio cards $audio_card_list"
Markus Armbrustereb852012009-10-27 18:41:44 +01002240echo "Block whitelist $block_drv_whitelist"
malc8ff9cbf2008-06-23 18:33:30 +00002241echo "Mixer emulation $mixemu"
ths8d5d2d42007-08-25 01:37:51 +00002242echo "VNC TLS support $vnc_tls"
aliguori2f9606b2009-03-06 20:27:28 +00002243echo "VNC SASL support $vnc_sasl"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002244echo "VNC JPEG support $vnc_jpeg"
Corentin Charyefe556a2010-07-07 20:57:56 +02002245echo "VNC PNG support $vnc_png"
Corentin Charybd023f92010-07-07 20:58:02 +02002246echo "VNC thread $vnc_thread"
blueswir131422552007-04-16 18:27:06 +00002247if test -n "$sparc_cpu"; then
2248 echo "Target Sparc Arch $sparc_cpu"
2249fi
aliguorie37630c2009-04-22 15:19:10 +00002250echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00002251echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002252echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02002253echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00002254[ ! -z "$uname_release" ] && \
2255echo "uname -r $uname_release"
pbrookbd0c5662008-05-29 14:34:11 +00002256echo "NPTL support $nptl"
Paul Brook379f6692009-07-17 12:48:08 +01002257echo "GUEST_BASE $guest_base"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002258echo "PIE user targets $user_pie"
ths8a16d272008-07-19 09:56:24 +00002259echo "vde support $vde"
aliguorie5d355d2009-04-24 18:03:15 +00002260echo "IO thread $io_thread"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002261echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002262echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00002263echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02002264echo "KVM support $kvm"
aurel32f652e6a2008-12-16 10:43:48 +00002265echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00002266echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002267echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00002268echo "madvise $madvise"
2269echo "posix_madvise $posix_madvise"
Stefan Weilee682d22009-10-01 20:10:37 +02002270echo "uuid support $uuid"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002271echo "vhost-net support $vhost_net"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002272echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01002273echo "Trace output file $trace_file-<pid>"
bellard67b915a2004-03-31 23:37:16 +00002274
bellard97a847b2003-08-10 21:36:04 +00002275if test $sdl_too_old = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00002276echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00002277fi
bellard97a847b2003-08-10 21:36:04 +00002278
Juan Quintela98ec69a2009-07-16 18:34:18 +02002279config_host_mak="config-host.mak"
Juan Quintela4bf6b552009-07-22 22:37:40 +02002280config_host_ld="config-host.ld"
bellard97a847b2003-08-10 21:36:04 +00002281
Juan Quintela98ec69a2009-07-16 18:34:18 +02002282echo "# Automatically generated by configure - do not modify" > $config_host_mak
2283printf "# Configured with:" >> $config_host_mak
2284printf " '%s'" "$0" "$@" >> $config_host_mak
2285echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002286
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02002287echo "prefix=$prefix" >> $config_host_mak
2288echo "bindir=$bindir" >> $config_host_mak
2289echo "mandir=$mandir" >> $config_host_mak
2290echo "datadir=$datadir" >> $config_host_mak
2291echo "sysconfdir=$sysconfdir" >> $config_host_mak
2292echo "docdir=$docdir" >> $config_host_mak
Paolo Bonzini1dabe052010-05-26 16:08:25 +02002293echo "confdir=$confdir" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002294
aurel322408a522008-04-20 20:19:44 +00002295case "$cpu" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01002296 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
Juan Quintelae0da9dd2009-07-16 18:34:09 +02002297 ARCH=$cpu
aurel322408a522008-04-20 20:19:44 +00002298 ;;
Laurent Desnoguesa302c322009-07-18 14:23:39 +02002299 armv4b|armv4l)
Juan Quintela16dbd142009-07-16 18:34:08 +02002300 ARCH=arm
aurel322408a522008-04-20 20:19:44 +00002301 ;;
aurel322408a522008-04-20 20:19:44 +00002302esac
Juan Quintela98ec69a2009-07-16 18:34:18 +02002303echo "ARCH=$ARCH" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002304if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002305 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00002306fi
Luiz Capitulinob4475aa2010-02-10 23:50:03 -02002307if test "$debug_mon" = "yes" ; then
2308 echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2309fi
Paul Brookf3d08ee2009-06-04 11:39:04 +01002310if test "$debug" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002311 echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
Paul Brookf3d08ee2009-06-04 11:39:04 +01002312fi
aliguori1625af82009-04-05 17:41:02 +00002313if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07002314 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00002315fi
bellard7d132992003-03-06 23:23:54 +00002316if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02002317 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002318fi
Juan Quintela2358a492009-07-27 16:13:25 +02002319echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002320if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002321 echo "CONFIG_WIN32=y" >> $config_host_mak
pbrook210fa552007-02-27 21:04:49 +00002322else
Juan Quintela35f4df22009-07-27 16:13:07 +02002323 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00002324fi
blueswir1128ab2f2008-08-15 18:33:42 +00002325
Mark McLoughlindffcb712009-10-22 17:49:11 +01002326if test "$linux" = "yes" ; then
2327 echo "CONFIG_LINUX=y" >> $config_host_mak
2328fi
2329
bellard83fb7ad2004-07-05 21:25:26 +00002330if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002331 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00002332fi
malcb29fe3e2008-11-18 01:42:22 +00002333
2334if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002335 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00002336fi
2337
bellardec530c82006-04-25 22:36:06 +00002338if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002339 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002340 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002341 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02002342 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00002343 fi
bellardec530c82006-04-25 22:36:06 +00002344fi
bellard97a847b2003-08-10 21:36:04 +00002345if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002346 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00002347fi
bellard05c2a3e2006-02-08 22:39:17 +00002348if test $profiler = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002349 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00002350fi
bellardc20709a2004-04-21 23:27:19 +00002351if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002352 echo "CONFIG_SLIRP=y" >> $config_host_mak
Juan Quintelab6e31c12009-09-30 01:10:54 +02002353 QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
bellardc20709a2004-04-21 23:27:19 +00002354fi
ths8a16d272008-07-19 09:56:24 +00002355if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002356 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00002357fi
malc0c58ac12008-06-25 21:04:05 +00002358for card in $audio_card_list; do
pbrookf6e58892008-06-29 01:00:34 +00002359 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002360 echo "$def=y" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002361done
Juan Quintela2358a492009-07-27 16:13:25 +02002362echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002363for drv in $audio_drv_list; do
pbrookf6e58892008-06-29 01:00:34 +00002364 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002365 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00002366 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02002367 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00002368 fi
2369done
Juan Quintela67f86e82009-08-03 14:46:59 +02002370if test "$audio_pt_int" = "yes" ; then
2371 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2372fi
malcd5631632009-10-10 01:13:41 +04002373if test "$audio_win_int" = "yes" ; then
2374 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2375fi
Markus Armbrustereb852012009-10-27 18:41:44 +01002376echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002377if test "$mixemu" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002378 echo "CONFIG_MIXEMU=y" >> $config_host_mak
malc8ff9cbf2008-06-23 18:33:30 +00002379fi
ths8d5d2d42007-08-25 01:37:51 +00002380if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002381 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
Juan Quintela525061b2009-07-27 16:12:43 +02002382 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00002383fi
aliguori2f9606b2009-03-06 20:27:28 +00002384if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002385 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Juan Quintela60ddf532009-07-27 16:12:45 +02002386 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00002387fi
Corentin Chary96763cf2010-07-07 20:58:06 +02002388if test "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002389 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
2390 echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
2391fi
Corentin Chary96763cf2010-07-07 20:58:06 +02002392if test "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02002393 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2394 echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2395fi
Corentin Chary96763cf2010-07-07 20:58:06 +02002396if test "$vnc_thread" != "no" ; then
Corentin Charybd023f92010-07-07 20:58:02 +02002397 echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2398 echo "CONFIG_THREAD=y" >> $config_host_mak
2399fi
aliguori76655d62009-03-06 20:27:37 +00002400if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002401 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00002402fi
Stefan Weilee682d22009-10-01 20:10:37 +02002403if test "$uuid" = "yes" ; then
2404 echo "CONFIG_UUID=y" >> $config_host_mak
2405fi
pbrookb1a550a2006-04-16 13:28:56 +00002406qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02002407echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02002408echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002409echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002410echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02002411if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002412 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00002413fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02002414if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002415 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02002416 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002417fi
2418if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002419 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00002420fi
2421if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002422 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00002423fi
aurel323b3f24a2009-04-15 16:12:13 +00002424if test "$atfile" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002425 echo "CONFIG_ATFILE=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00002426fi
Riku Voipioebc996f2009-04-21 15:01:51 +03002427if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002428 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03002429fi
Riku Voipio099d6b02009-05-05 12:10:04 +03002430if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002431 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03002432fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01002433if test "$accept4" = "yes" ; then
2434 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2435fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302436if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002437 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05302438fi
Riku Voipioc2882b92009-08-12 15:08:24 +03002439if test "$eventfd" = "yes" ; then
2440 echo "CONFIG_EVENTFD=y" >> $config_host_mak
2441fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03002442if test "$fallocate" = "yes" ; then
2443 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2444fi
2445if test "$dup3" = "yes" ; then
2446 echo "CONFIG_DUP3=y" >> $config_host_mak
2447fi
aurel323b3f24a2009-04-15 16:12:13 +00002448if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002449 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00002450fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00002451if test "$inotify1" = "yes" ; then
2452 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2453fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02002454if test "$byteswap_h" = "yes" ; then
2455 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2456fi
2457if test "$bswap_h" = "yes" ; then
2458 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2459fi
Alexander Graf769ce762009-05-11 17:41:42 +02002460if test "$curl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002461 echo "CONFIG_CURL=y" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02002462 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02002463fi
aurel322e4d9fb2008-04-08 06:01:02 +00002464if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002465 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00002466fi
balrogfb599c92008-09-28 23:49:55 +00002467if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002468 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02002469 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00002470fi
aliguorie37630c2009-04-22 15:19:10 +00002471if test "$xen" = "yes" ; then
Juan Quintela5647eb72009-07-27 16:13:21 +02002472 echo "CONFIG_XEN=y" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00002473fi
aliguorie5d355d2009-04-24 18:03:15 +00002474if test "$io_thread" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002475 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
Corentin Charybd023f92010-07-07 20:58:02 +02002476 echo "CONFIG_THREAD=y" >> $config_host_mak
aliguorie5d355d2009-04-24 18:03:15 +00002477fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002478if test "$linux_aio" = "yes" ; then
2479 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2480fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002481if test "$attr" = "yes" ; then
2482 echo "CONFIG_ATTR=y" >> $config_host_mak
2483fi
2484if test "$linux" = "yes" ; then
2485 if test "$attr" = "yes" ; then
2486 echo "CONFIG_VIRTFS=y" >> $config_host_mak
2487 fi
2488fi
ths77755342008-11-27 15:45:16 +00002489if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02002490 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00002491fi
aliguoribf9298b2008-12-05 20:05:26 +00002492if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002493 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00002494fi
aliguoriceb42de2009-04-07 18:43:28 +00002495if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002496 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00002497fi
aurel32f652e6a2008-12-16 10:43:48 +00002498if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02002499 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00002500fi
Blue Swirlde5071c2009-09-12 09:58:46 +00002501if test "$need_offsetof" = "yes" ; then
2502 echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2503fi
Blue Swirl747bbdf2009-10-18 16:26:06 +00002504if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2505 echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2506fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00002507if test "$fdatasync" = "yes" ; then
2508 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2509fi
Andreas Färbere78815a2010-09-25 11:26:05 +00002510if test "$madvise" = "yes" ; then
2511 echo "CONFIG_MADVISE=y" >> $config_host_mak
2512fi
2513if test "$posix_madvise" = "yes" ; then
2514 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
2515fi
bellard97a847b2003-08-10 21:36:04 +00002516
bellard83fb7ad2004-07-05 21:25:26 +00002517# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00002518if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02002519 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00002520fi
2521
Juan Quintela2358a492009-07-27 16:13:25 +02002522echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00002523
Anthony Liguori20ff6c82009-12-09 12:59:36 -06002524if test "$zero_malloc" = "yes" ; then
2525 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2526fi
2527
blueswir168063642008-11-22 21:03:55 +00002528# USB host support
2529case "$usb" in
2530linux)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002531 echo "HOST_USB=linux" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002532;;
2533bsd)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002534 echo "HOST_USB=bsd" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002535;;
2536*)
Juan Quintela98ec69a2009-07-16 18:34:18 +02002537 echo "HOST_USB=stub" >> $config_host_mak
blueswir168063642008-11-22 21:03:55 +00002538;;
2539esac
2540
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01002541echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05302542if test "$trace_backend" = "simple"; then
2543 echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
2544fi
Prerna Saxena9410b562010-07-13 09:26:32 +01002545# Set the appropriate trace file.
2546if test "$trace_backend" = "simple"; then
2547 trace_file="\"$trace_file-%u\""
2548fi
2549echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
2550
Juan Quintela98ec69a2009-07-16 18:34:18 +02002551echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02002552echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002553echo "MAKE=$make" >> $config_host_mak
2554echo "INSTALL=$install" >> $config_host_mak
2555echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2556echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2557echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2558echo "CC=$cc" >> $config_host_mak
2559echo "HOST_CC=$host_cc" >> $config_host_mak
2560if test "$sparse" = "yes" ; then
2561 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
2562 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02002563 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002564fi
2565echo "AR=$ar" >> $config_host_mak
2566echo "OBJCOPY=$objcopy" >> $config_host_mak
2567echo "LD=$ld" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02002568echo "CFLAGS=$CFLAGS" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02002569echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Juan Quintelac81da562009-08-03 14:46:24 +02002570echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02002571echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Juan Quintelaa36abbb2009-08-03 14:45:56 +02002572echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2573echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02002574echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02002575echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002576echo "EXESUF=$EXESUF" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02002577
Juan Quintela4bf6b552009-07-22 22:37:40 +02002578# generate list of library paths for linker script
2579
2580$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2581
2582if test -f ${config_host_ld}~ ; then
2583 if cmp -s $config_host_ld ${config_host_ld}~ ; then
2584 mv ${config_host_ld}~ $config_host_ld
2585 else
2586 rm ${config_host_ld}~
2587 fi
2588fi
2589
Blue Swirl4d904532010-03-21 08:28:47 +00002590for d in libdis libdis-user; do
2591 mkdir -p $d
2592 rm -f $d/Makefile
2593 ln -s $source_path/Makefile.dis $d/Makefile
2594 echo > $d/config.mak
2595done
Richard Hendersond44cff22010-05-21 10:04:46 -07002596if test "$static" = "no" -a "$user_pie" = "yes" ; then
2597 echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2598fi
Blue Swirl4d904532010-03-21 08:28:47 +00002599
bellard1d14ffa2005-10-30 18:58:22 +00002600for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00002601target_dir="$target"
Juan Quintela25be210f2009-10-07 02:41:00 +02002602config_target_mak=$target_dir/config-target.mak
Blue Swirl600309b2009-07-03 17:44:00 +00002603target_arch2=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00002604target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02002605
Juan Quintelaea2d6a32009-07-16 18:34:10 +02002606case "$target_arch2" in
Alexander Graf24e804ec2009-12-05 12:44:22 +01002607 armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02002608 target_bigendian=yes
2609 ;;
2610esac
bellard97a847b2003-08-10 21:36:04 +00002611target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00002612target_user_only="no"
ths831b7822007-01-18 20:06:33 +00002613target_linux_user="no"
ths831b7822007-01-18 20:06:33 +00002614target_darwin_user="no"
blueswir184778502008-10-26 20:33:16 +00002615target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00002616case "$target" in
Blue Swirl600309b2009-07-03 17:44:00 +00002617 ${target_arch2}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00002618 target_softmmu="yes"
2619 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002620 ${target_arch2}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00002621 if test "$linux" != "yes" ; then
2622 echo "ERROR: Target '$target' is only available on a Linux host"
2623 exit 1
2624 fi
pbrook9e407a82007-05-26 16:38:53 +00002625 target_user_only="yes"
2626 target_linux_user="yes"
2627 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002628 ${target_arch2}-darwin-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00002629 if test "$darwin" != "yes" ; then
2630 echo "ERROR: Target '$target' is only available on a Darwin host"
2631 exit 1
2632 fi
pbrook9e407a82007-05-26 16:38:53 +00002633 target_user_only="yes"
2634 target_darwin_user="yes"
2635 ;;
Blue Swirl600309b2009-07-03 17:44:00 +00002636 ${target_arch2}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00002637 if test "$bsd" != "yes" ; then
Blue Swirl9c7a4202009-11-17 20:52:56 +00002638 echo "ERROR: Target '$target' is only available on a BSD host"
2639 exit 1
2640 fi
blueswir184778502008-10-26 20:33:16 +00002641 target_user_only="yes"
2642 target_bsd_user="yes"
2643 ;;
pbrook9e407a82007-05-26 16:38:53 +00002644 *)
2645 echo "ERROR: Target '$target' not recognised"
2646 exit 1
2647 ;;
2648esac
ths831b7822007-01-18 20:06:33 +00002649
bellard97a847b2003-08-10 21:36:04 +00002650mkdir -p $target_dir
bellard158142c2005-03-13 16:54:06 +00002651mkdir -p $target_dir/fpu
bellard57fec1f2008-02-01 10:50:11 +00002652mkdir -p $target_dir/tcg
Gerd Hoffmann59f2a782009-08-20 15:22:26 +02002653mkdir -p $target_dir/ide
blueswir184778502008-10-26 20:33:16 +00002654if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
bellard69de9272004-02-16 21:40:43 +00002655 mkdir -p $target_dir/nwfpe
2656fi
2657
bellardec530c82006-04-25 22:36:06 +00002658#
2659# don't use ln -sf as not all "ln -sf" over write the file/link
2660#
2661rm -f $target_dir/Makefile
2662ln -s $source_path/Makefile.target $target_dir/Makefile
2663
bellard97a847b2003-08-10 21:36:04 +00002664
Juan Quintela25be210f2009-10-07 02:41:00 +02002665echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00002666
pbrooke5fe0c52006-06-11 13:32:59 +00002667bflt="no"
pbrookbd0c5662008-05-29 14:34:11 +00002668target_nptl="no"
Blue Swirl600309b2009-07-03 17:44:00 +00002669interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
Paolo Bonzini7ee28222010-05-26 16:08:22 +02002670echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00002671gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00002672
Juan Quintela938b1ed2009-07-16 18:34:12 +02002673TARGET_ARCH="$target_arch2"
Juan Quintela6acff7d2009-07-16 18:34:15 +02002674TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02002675TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02002676
Blue Swirl600309b2009-07-03 17:44:00 +00002677case "$target_arch2" in
aurel322408a522008-04-20 20:19:44 +00002678 i386)
Paul Brook1ad21342009-05-19 16:17:58 +01002679 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002680 ;;
2681 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002682 TARGET_BASE_ARCH=i386
Paul Brook1ad21342009-05-19 16:17:58 +01002683 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002684 ;;
2685 alpha)
Paul Brook1ad21342009-05-19 16:17:58 +01002686 target_phys_bits=64
Richard Hendersona4b388f2010-04-12 16:17:22 -07002687 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002688 ;;
2689 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002690 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00002691 bflt="yes"
pbrookbd0c5662008-05-29 14:34:11 +00002692 target_nptl="yes"
pbrook56aebc82008-10-11 17:55:29 +00002693 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002694 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002695 ;;
2696 cris)
edgar_igl253bd7f2009-01-07 20:07:09 +00002697 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002698 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002699 ;;
2700 m68k)
aurel322408a522008-04-20 20:19:44 +00002701 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00002702 gdb_xml_files="cf-core.xml cf-fp.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002703 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002704 ;;
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002705 microblaze)
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02002706 bflt="yes"
2707 target_nptl="yes"
2708 target_phys_bits=32
2709 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02002710 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002711 TARGET_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02002712 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
Paul Brookf04dc722009-07-09 17:56:24 +01002713 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002714 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002715 ;;
2716 mipsn32|mipsn32el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002717 TARGET_ARCH=mipsn32
Juan Quintela6acff7d2009-07-16 18:34:15 +02002718 TARGET_BASE_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02002719 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002720 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002721 ;;
2722 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002723 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002724 TARGET_BASE_ARCH=mips
Juan Quintela25be210f2009-10-07 02:41:00 +02002725 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002726 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002727 ;;
2728 ppc)
aurel32c8b35322009-01-24 15:07:34 +00002729 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002730 target_phys_bits=32
Nathan Froydd6630702009-08-03 08:43:28 -07002731 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002732 ;;
2733 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002734 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002735 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00002736 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002737 target_phys_bits=64
Nathan Froydd6630702009-08-03 08:43:28 -07002738 target_nptl="yes"
aurel322408a522008-04-20 20:19:44 +00002739 ;;
2740 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002741 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002742 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00002743 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002744 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002745 ;;
2746 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002747 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002748 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002749 TARGET_ABI_DIR=ppc
Juan Quintela25be210f2009-10-07 02:41:00 +02002750 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00002751 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
Paul Brook1ad21342009-05-19 16:17:58 +01002752 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002753 ;;
2754 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002755 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00002756 bflt="yes"
aurel320b6d3ae2008-09-15 07:43:43 +00002757 target_nptl="yes"
Paul Brook1ad21342009-05-19 16:17:58 +01002758 target_phys_bits=32
aurel322408a522008-04-20 20:19:44 +00002759 ;;
2760 sparc)
Paul Brook1ad21342009-05-19 16:17:58 +01002761 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002762 ;;
2763 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02002764 TARGET_BASE_ARCH=sparc
Paul Brook1ad21342009-05-19 16:17:58 +01002765 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002766 ;;
2767 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02002768 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02002769 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02002770 TARGET_ABI_DIR=sparc
Juan Quintela25be210f2009-10-07 02:41:00 +02002771 echo "TARGET_ABI32=y" >> $config_target_mak
Paul Brook1ad21342009-05-19 16:17:58 +01002772 target_phys_bits=64
aurel322408a522008-04-20 20:19:44 +00002773 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01002774 s390x)
2775 target_phys_bits=64
2776 ;;
aurel322408a522008-04-20 20:19:44 +00002777 *)
2778 echo "Unsupported target CPU"
2779 exit 1
2780 ;;
2781esac
Juan Quintela25be210f2009-10-07 02:41:00 +02002782echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
Juan Quintela053dd922009-08-03 14:47:03 +02002783target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
Juan Quintela25be210f2009-10-07 02:41:00 +02002784echo "TARGET_$target_arch_name=y" >> $config_target_mak
2785echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
Juan Quintela42bc6082009-07-16 18:34:20 +02002786# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02002787if [ "$TARGET_BASE_ARCH" = "" ]; then
2788 TARGET_BASE_ARCH=$TARGET_ARCH
Juan Quintela6acff7d2009-07-16 18:34:15 +02002789fi
Juan Quintela25be210f2009-10-07 02:41:00 +02002790echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02002791if [ "$TARGET_ABI_DIR" = "" ]; then
2792 TARGET_ABI_DIR=$TARGET_ARCH
2793fi
Juan Quintela25be210f2009-10-07 02:41:00 +02002794echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002795case "$target_arch2" in
2796 i386|x86_64)
2797 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002798 echo "CONFIG_XEN=y" >> $config_target_mak
Juan Quintela1b0c87f2009-07-16 18:33:59 +02002799 fi
2800esac
Juan Quintelac59249f2009-07-16 18:34:00 +02002801case "$target_arch2" in
Alexander Graf0e60a692009-12-05 12:44:24 +01002802 i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02002803 # Make sure the target and host cpus are compatible
2804 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2805 \( "$target_arch2" = "$cpu" -o \
2806 \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
Alexander Graf5f114bc2009-07-17 13:51:42 +02002807 \( "$target_arch2" = "ppc64" -a "$cpu" = "ppc" \) -o \
Juan Quintelac59249f2009-07-16 18:34:00 +02002808 \( "$target_arch2" = "x86_64" -a "$cpu" = "i386" \) -o \
2809 \( "$target_arch2" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002810 echo "CONFIG_KVM=y" >> $config_target_mak
2811 echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
Jan Kiszkadae50792010-01-12 19:53:48 +01002812 if test "$kvm_para" = "yes"; then
2813 echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2814 fi
Michael S. Tsirkind5970052010-03-17 13:08:17 +02002815 if test $vhost_net = "yes" ; then
2816 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2817 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02002818 fi
2819esac
bellardde83cd02003-06-15 20:25:43 +00002820if test "$target_bigendian" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002821 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00002822fi
2823if test "$target_softmmu" = "yes" ; then
Paul Brookb1aa27c2010-03-01 02:27:26 +00002824 echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
Juan Quintela25be210f2009-10-07 02:41:00 +02002825 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2826 echo "LIBS+=$libs_softmmu" >> $config_target_mak
Andreas Färber0e8c9212010-01-06 20:24:05 +01002827 echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
Kirill A. Shutemov5791f452009-09-12 02:17:53 +03002828 echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
bellardde83cd02003-06-15 20:25:43 +00002829fi
bellard997344f2003-10-27 21:10:39 +00002830if test "$target_user_only" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002831 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00002832fi
ths831b7822007-01-18 20:06:33 +00002833if test "$target_linux_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002834 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00002835fi
2836if test "$target_darwin_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002837 echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00002838fi
pbrook56aebc82008-10-11 17:55:29 +00002839list=""
2840if test ! -z "$gdb_xml_files" ; then
2841 for x in $gdb_xml_files; do
2842 list="$list $source_path/gdb-xml/$x"
2843 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02002844 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00002845fi
bellardde83cd02003-06-15 20:25:43 +00002846
Juan Quintelaf57975f2009-07-16 18:34:19 +02002847case "$target_arch2" in
Richard Henderson990b3e12009-12-09 15:48:02 -08002848 alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
Juan Quintela25be210f2009-10-07 02:41:00 +02002849 echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
Juan Quintelaf57975f2009-07-16 18:34:19 +02002850 ;;
Juan Quintelad6b38932009-08-03 14:46:42 +02002851 *)
Juan Quintela25be210f2009-10-07 02:41:00 +02002852 echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
Juan Quintelad6b38932009-08-03 14:46:42 +02002853 ;;
Juan Quintelaf57975f2009-07-16 18:34:19 +02002854esac
2855
pbrooke5fe0c52006-06-11 13:32:59 +00002856if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002857 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00002858fi
pbrookbd0c5662008-05-29 14:34:11 +00002859if test "$target_user_only" = "yes" \
2860 -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002861 echo "CONFIG_USE_NPTL=y" >> $config_target_mak
pbrookbd0c5662008-05-29 14:34:11 +00002862fi
Paul Brook379f6692009-07-17 12:48:08 +01002863if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002864 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01002865fi
blueswir184778502008-10-26 20:33:16 +00002866if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002867 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00002868fi
bellard5b0753e2005-03-01 21:37:28 +00002869
Juan Quintela4afddb52009-08-03 14:46:45 +02002870# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02002871
Juan Quintela4afddb52009-08-03 14:46:45 +02002872cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02002873ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02002874
Juan Quintela57ddfbf2009-08-03 14:46:51 +02002875if test "$ARCH" = "sparc64" ; then
2876 cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
Alexander Graf24e804ec2009-12-05 12:44:22 +01002877elif test "$ARCH" = "s390x" ; then
2878 cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
Richard Henderson5d8a4f82010-06-03 17:35:17 -07002879elif test "$ARCH" = "x86_64" ; then
2880 cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
Juan Quintela57ddfbf2009-08-03 14:46:51 +02002881else
2882 cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2883fi
2884cflags="-I\$(SRC_PATH)/tcg $cflags"
2885cflags="-I\$(SRC_PATH)/fpu $cflags"
2886
Blue Swirl4d904532010-03-21 08:28:47 +00002887if test "$target_user_only" = "yes" ; then
2888 libdis_config_mak=libdis-user/config.mak
2889else
2890 libdis_config_mak=libdis/config.mak
2891fi
2892
Juan Quintela64656022009-08-03 14:46:53 +02002893for i in $ARCH $TARGET_BASE_ARCH ; do
2894 case "$i" in
2895 alpha)
Juan Quintela25be210f2009-10-07 02:41:00 +02002896 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002897 echo "CONFIG_ALPHA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002898 ;;
2899 arm)
Juan Quintela25be210f2009-10-07 02:41:00 +02002900 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002901 echo "CONFIG_ARM_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002902 ;;
2903 cris)
Juan Quintela25be210f2009-10-07 02:41:00 +02002904 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002905 echo "CONFIG_CRIS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002906 ;;
2907 hppa)
Juan Quintela25be210f2009-10-07 02:41:00 +02002908 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002909 echo "CONFIG_HPPA_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002910 ;;
2911 i386|x86_64)
Juan Quintela25be210f2009-10-07 02:41:00 +02002912 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002913 echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002914 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02002915 ia64*)
2916 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
2917 echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
2918 ;;
Juan Quintela64656022009-08-03 14:46:53 +02002919 m68k)
Juan Quintela25be210f2009-10-07 02:41:00 +02002920 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002921 echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002922 ;;
2923 microblaze)
Juan Quintela25be210f2009-10-07 02:41:00 +02002924 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002925 echo "CONFIG_MICROBLAZE_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002926 ;;
2927 mips*)
Juan Quintela25be210f2009-10-07 02:41:00 +02002928 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002929 echo "CONFIG_MIPS_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002930 ;;
2931 ppc*)
Juan Quintela25be210f2009-10-07 02:41:00 +02002932 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002933 echo "CONFIG_PPC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002934 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01002935 s390*)
Juan Quintela25be210f2009-10-07 02:41:00 +02002936 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002937 echo "CONFIG_S390_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002938 ;;
2939 sh4)
Juan Quintela25be210f2009-10-07 02:41:00 +02002940 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002941 echo "CONFIG_SH4_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002942 ;;
2943 sparc*)
Juan Quintela25be210f2009-10-07 02:41:00 +02002944 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Blue Swirl4d904532010-03-21 08:28:47 +00002945 echo "CONFIG_SPARC_DIS=y" >> $libdis_config_mak
Juan Quintela64656022009-08-03 14:46:53 +02002946 ;;
2947 esac
2948done
2949
Juan Quintela6ee71262009-08-03 14:46:47 +02002950case "$ARCH" in
2951alpha)
2952 # Ensure there's only a single GP
2953 cflags="-msmall-data $cflags"
2954;;
2955esac
2956
Juan Quintela55d9c042009-08-03 14:47:02 +02002957if test "$target_softmmu" = "yes" ; then
2958 case "$TARGET_BASE_ARCH" in
2959 arm)
2960 cflags="-DHAS_AUDIO $cflags"
2961 ;;
2962 i386|mips|ppc)
2963 cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2964 ;;
2965 esac
2966fi
2967
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002968if test "$target_user_only" = "yes" -a "$static" = "no" -a \
Blue Swirl50108932009-09-13 19:38:48 +00002969 "$user_pie" = "yes" ; then
Kirill A. Shutemov34005a02009-09-12 02:17:55 +03002970 cflags="-fpie $cflags"
2971 ldflags="-pie $ldflags"
2972fi
2973
Juan Quintela471857d2009-08-03 14:46:52 +02002974if test "$target_softmmu" = "yes" -a \( \
2975 "$TARGET_ARCH" = "microblaze" -o \
2976 "$TARGET_ARCH" = "cris" \) ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002977 echo "CONFIG_NEED_MMU=y" >> $config_target_mak
Juan Quintela471857d2009-08-03 14:46:52 +02002978fi
2979
Juan Quintelad02c1db2009-08-03 14:46:50 +02002980if test "$gprof" = "yes" ; then
Juan Quintela25be210f2009-10-07 02:41:00 +02002981 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02002982 if test "$target_linux_user" = "yes" ; then
2983 cflags="-p $cflags"
2984 ldflags="-p $ldflags"
2985 fi
2986 if test "$target_softmmu" = "yes" ; then
2987 ldflags="-p $ldflags"
Juan Quintela25be210f2009-10-07 02:41:00 +02002988 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02002989 fi
2990fi
2991
Juan Quintela6ee71262009-08-03 14:46:47 +02002992linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
Juan Quintela9b8e1112009-08-03 14:46:46 +02002993if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Juan Quintelafa282482009-07-22 22:37:39 +02002994 case "$ARCH" in
Juan Quintelafa282482009-07-22 22:37:39 +02002995 sparc)
2996 # -static is used to avoid g1/g3 usage by the dynamic linker
Juan Quintela322e5872009-08-03 14:46:44 +02002997 ldflags="$linker_script -static $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02002998 ;;
Richard Henderson4d58be02010-06-04 12:14:11 -07002999 alpha | s390x)
3000 # The default placement of the application is fine.
3001 ;;
Richard Hendersonfd76e732010-04-07 04:56:43 -07003002 *)
Juan Quintela322e5872009-08-03 14:46:44 +02003003 ldflags="$linker_script $ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02003004 ;;
3005 esac
3006fi
Juan Quintelafa282482009-07-22 22:37:39 +02003007
Juan Quintela25be210f2009-10-07 02:41:00 +02003008echo "LDFLAGS+=$ldflags" >> $config_target_mak
3009echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02003010
bellard97a847b2003-08-10 21:36:04 +00003011done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00003012
3013# build tree in object directory if source path is different from current one
3014if test "$source_path_used" = "yes" ; then
Mark McLoughline1144d02009-10-23 17:52:16 +01003015 DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003016 DIRS="$DIRS roms/seabios roms/vgabios"
Corentin Chary3e230dd2010-07-07 20:57:52 +02003017 DIRS="$DIRS fsdev ui"
bellard7d132992003-03-06 23:23:54 +00003018 FILES="Makefile tests/Makefile"
thse7daa602007-10-08 13:38:27 +00003019 FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
edgar_igle1ffb0f2008-03-01 22:23:17 +00003020 FILES="$FILES tests/test-mmap.c"
Jan Kiszka7ea78b72009-07-17 11:20:10 +02003021 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003022 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka7ea78b72009-07-17 11:20:10 +02003023 for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
3024 FILES="$FILES pc-bios/`basename $bios_file`"
3025 done
bellard7d132992003-03-06 23:23:54 +00003026 for dir in $DIRS ; do
3027 mkdir -p $dir
3028 done
bellardec530c82006-04-25 22:36:06 +00003029 # remove the link and recreate it, as not all "ln -sf" overwrite the link
bellard7d132992003-03-06 23:23:54 +00003030 for f in $FILES ; do
bellardec530c82006-04-25 22:36:06 +00003031 rm -f $f
3032 ln -s $source_path/$f $f
bellard7d132992003-03-06 23:23:54 +00003033 done
3034fi
Paul Brook1ad21342009-05-19 16:17:58 +01003035
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003036# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06003037for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003038 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01003039 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05003040 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3041 echo "CC=$cc" >> $config_mak
3042 echo "BCC=bcc" >> $config_mak
3043 echo "CPP=${cross_prefix}cpp" >> $config_mak
3044 echo "OBJCOPY=objcopy" >> $config_mak
3045 echo "IASL=iasl" >> $config_mak
3046 echo "HOST_CC=$host_cc" >> $config_mak
3047 echo "LD=$ld" >> $config_mak
3048done
3049
Paul Brook1ad21342009-05-19 16:17:58 +01003050for hwlib in 32 64; do
3051 d=libhw$hwlib
3052 mkdir -p $d
Blue Swirl9953b2f2010-03-21 19:47:05 +00003053 mkdir -p $d/ide
Paul Brook1ad21342009-05-19 16:17:58 +01003054 rm -f $d/Makefile
3055 ln -s $source_path/Makefile.hw $d/Makefile
Stefan Weil37116c82010-03-01 22:20:29 +01003056 echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
Paul Brook1ad21342009-05-19 16:17:58 +01003057done
Blue Swirladd16152009-09-27 16:26:02 +00003058
3059d=libuser
3060mkdir -p $d
3061rm -f $d/Makefile
3062ln -s $source_path/Makefile.user $d/Makefile
Kirill A. Shutemov299060a2009-12-19 15:16:08 +00003063if test "$static" = "no" -a "$user_pie" = "yes" ; then
3064 echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3065fi
Jan Kiszkab40292e2010-05-31 14:43:31 -03003066
3067if test "$docs" = "yes" ; then
3068 mkdir -p QMP
3069fi