Statistics
| Branch: | Revision:

root / configure @ 22d07038

History | View | Annotate | Download (100.3 kB)

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