Statistics
| Branch: | Revision:

root / configure @ 785c23ae

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