Statistics
| Branch: | Revision:

root / configure @ 7fc5152c

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