Statistics
| Branch: | Revision:

root / configure @ feature-archipelago

History | View | Annotate | Download (134.3 kB)

1 7d13299d bellard
#!/bin/sh
2 7d13299d bellard
#
3 3ef693a0 bellard
# qemu configure script (c) 2003 Fabrice Bellard
4 7d13299d bellard
#
5 7d13299d bellard
# set temporary file name
6 7d13299d bellard
if test ! -z "$TMPDIR" ; then
7 7d13299d bellard
    TMPDIR1="${TMPDIR}"
8 7d13299d bellard
elif test ! -z "$TEMPDIR" ; then
9 7d13299d bellard
    TMPDIR1="${TEMPDIR}"
10 7d13299d bellard
else
11 7d13299d bellard
    TMPDIR1="/tmp"
12 7d13299d bellard
fi
13 7d13299d bellard
14 3ef693a0 bellard
TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 66518bf6 Don Slutz
TMPB="qemu-conf-${RANDOM}-$$-${RANDOM}"
16 66518bf6 Don Slutz
TMPO="${TMPDIR1}/${TMPB}.o"
17 66518bf6 Don Slutz
TMPL="${TMPDIR1}/${TMPB}.lo"
18 66518bf6 Don Slutz
TMPA="${TMPDIR1}/lib${TMPB}.la"
19 a91b857c malc
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
20 7d13299d bellard
21 0ba8681e Loïc Minier
# NB: do not call "exit" in the trap handler; this is buggy with some shells;
22 0ba8681e Loïc Minier
# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
23 0ba8681e Loïc Minier
trap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
24 da1d85e3 Gerd Hoffmann
rm -f config.log
25 9ac81bbb malc
26 b48e3611 Peter Maydell
# Print a helpful header at the top of config.log
27 b48e3611 Peter Maydell
echo "# QEMU configure log $(date)" >> config.log
28 979ae168 Peter Maydell
printf "# Configured with:" >> config.log
29 979ae168 Peter Maydell
printf " '%s'" "$0" "$@" >> config.log
30 979ae168 Peter Maydell
echo >> config.log
31 b48e3611 Peter Maydell
echo "#" >> config.log
32 b48e3611 Peter Maydell
33 bdf523e6 Stefan Weil
# Save the configure command line for later reuse.
34 bdf523e6 Stefan Weil
cat <<EOD >config.status
35 bdf523e6 Stefan Weil
#!/bin/sh
36 bdf523e6 Stefan Weil
# Generated by configure.
37 bdf523e6 Stefan Weil
# Run this file to recreate the current configuration.
38 bdf523e6 Stefan Weil
# Compiler output produced by configure, useful for debugging
39 bdf523e6 Stefan Weil
# configure, is in config.log if it exists.
40 bdf523e6 Stefan Weil
EOD
41 bdf523e6 Stefan Weil
printf "exec" >>config.status
42 bdf523e6 Stefan Weil
printf " '%s'" "$0" "$@" >>config.status
43 bdf523e6 Stefan Weil
echo >>config.status
44 bdf523e6 Stefan Weil
chmod +x config.status
45 bdf523e6 Stefan Weil
46 76ad07a4 Peter Maydell
error_exit() {
47 76ad07a4 Peter Maydell
    echo
48 76ad07a4 Peter Maydell
    echo "ERROR: $1"
49 76ad07a4 Peter Maydell
    while test -n "$2"; do
50 76ad07a4 Peter Maydell
        echo "       $2"
51 76ad07a4 Peter Maydell
        shift
52 76ad07a4 Peter Maydell
    done
53 76ad07a4 Peter Maydell
    echo
54 76ad07a4 Peter Maydell
    exit 1
55 76ad07a4 Peter Maydell
}
56 76ad07a4 Peter Maydell
57 8dc38a78 Peter Maydell
do_cc() {
58 8dc38a78 Peter Maydell
    # Run the compiler, capturing its output to the log.
59 8dc38a78 Peter Maydell
    echo $cc "$@" >> config.log
60 8dc38a78 Peter Maydell
    $cc "$@" >> config.log 2>&1 || return $?
61 8dc38a78 Peter Maydell
    # Test passed. If this is an --enable-werror build, rerun
62 8dc38a78 Peter Maydell
    # the test with -Werror and bail out if it fails. This
63 8dc38a78 Peter Maydell
    # makes warning-generating-errors in configure test code
64 8dc38a78 Peter Maydell
    # obvious to developers.
65 8dc38a78 Peter Maydell
    if test "$werror" != "yes"; then
66 8dc38a78 Peter Maydell
        return 0
67 8dc38a78 Peter Maydell
    fi
68 8dc38a78 Peter Maydell
    # Don't bother rerunning the compile if we were already using -Werror
69 8dc38a78 Peter Maydell
    case "$*" in
70 8dc38a78 Peter Maydell
        *-Werror*)
71 8dc38a78 Peter Maydell
           return 0
72 8dc38a78 Peter Maydell
        ;;
73 8dc38a78 Peter Maydell
    esac
74 8dc38a78 Peter Maydell
    echo $cc -Werror "$@" >> config.log
75 8dc38a78 Peter Maydell
    $cc -Werror "$@" >> config.log 2>&1 && return $?
76 76ad07a4 Peter Maydell
    error_exit "configure test passed without -Werror but failed with -Werror." \
77 76ad07a4 Peter Maydell
        "This is probably a bug in the configure script. The failing command" \
78 76ad07a4 Peter Maydell
        "will be at the bottom of config.log." \
79 76ad07a4 Peter Maydell
        "You can run configure with --disable-werror to bypass this check."
80 8dc38a78 Peter Maydell
}
81 8dc38a78 Peter Maydell
82 52166aa0 Juan Quintela
compile_object() {
83 8dc38a78 Peter Maydell
  do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
84 52166aa0 Juan Quintela
}
85 52166aa0 Juan Quintela
86 52166aa0 Juan Quintela
compile_prog() {
87 52166aa0 Juan Quintela
  local_cflags="$1"
88 52166aa0 Juan Quintela
  local_ldflags="$2"
89 8dc38a78 Peter Maydell
  do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
90 52166aa0 Juan Quintela
}
91 52166aa0 Juan Quintela
92 66518bf6 Don Slutz
do_libtool() {
93 66518bf6 Don Slutz
    local mode=$1
94 66518bf6 Don Slutz
    shift
95 66518bf6 Don Slutz
    # Run the compiler, capturing its output to the log.
96 66518bf6 Don Slutz
    echo $libtool $mode --tag=CC $cc "$@" >> config.log
97 66518bf6 Don Slutz
    $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
98 66518bf6 Don Slutz
    # Test passed. If this is an --enable-werror build, rerun
99 66518bf6 Don Slutz
    # the test with -Werror and bail out if it fails. This
100 66518bf6 Don Slutz
    # makes warning-generating-errors in configure test code
101 66518bf6 Don Slutz
    # obvious to developers.
102 66518bf6 Don Slutz
    if test "$werror" != "yes"; then
103 66518bf6 Don Slutz
        return 0
104 66518bf6 Don Slutz
    fi
105 66518bf6 Don Slutz
    # Don't bother rerunning the compile if we were already using -Werror
106 66518bf6 Don Slutz
    case "$*" in
107 66518bf6 Don Slutz
        *-Werror*)
108 66518bf6 Don Slutz
           return 0
109 66518bf6 Don Slutz
        ;;
110 66518bf6 Don Slutz
    esac
111 66518bf6 Don Slutz
    echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
112 66518bf6 Don Slutz
    $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
113 66518bf6 Don Slutz
    error_exit "configure test passed without -Werror but failed with -Werror." \
114 66518bf6 Don Slutz
        "This is probably a bug in the configure script. The failing command" \
115 66518bf6 Don Slutz
        "will be at the bottom of config.log." \
116 66518bf6 Don Slutz
        "You can run configure with --disable-werror to bypass this check."
117 66518bf6 Don Slutz
}
118 66518bf6 Don Slutz
119 66518bf6 Don Slutz
libtool_prog() {
120 66518bf6 Don Slutz
    do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
121 66518bf6 Don Slutz
    do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
122 66518bf6 Don Slutz
}
123 66518bf6 Don Slutz
124 11568d6d Paolo Bonzini
# symbolically link $1 to $2.  Portable version of "ln -sf".
125 11568d6d Paolo Bonzini
symlink() {
126 72b8b5a1 Stefan Weil
  rm -rf "$2"
127 ec5b06d7 Anthony Liguori
  mkdir -p "$(dirname "$2")"
128 72b8b5a1 Stefan Weil
  ln -s "$1" "$2"
129 11568d6d Paolo Bonzini
}
130 11568d6d Paolo Bonzini
131 0dba6195 Loïc Minier
# check whether a command is available to this shell (may be either an
132 0dba6195 Loïc Minier
# executable or a builtin)
133 0dba6195 Loïc Minier
has() {
134 0dba6195 Loïc Minier
    type "$1" >/dev/null 2>&1
135 0dba6195 Loïc Minier
}
136 0dba6195 Loïc Minier
137 0dba6195 Loïc Minier
# search for an executable in PATH
138 0dba6195 Loïc Minier
path_of() {
139 0dba6195 Loïc Minier
    local_command="$1"
140 0dba6195 Loïc Minier
    local_ifs="$IFS"
141 0dba6195 Loïc Minier
    local_dir=""
142 0dba6195 Loïc Minier
143 0dba6195 Loïc Minier
    # pathname has a dir component?
144 0dba6195 Loïc Minier
    if [ "${local_command#*/}" != "$local_command" ]; then
145 0dba6195 Loïc Minier
        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
146 0dba6195 Loïc Minier
            echo "$local_command"
147 0dba6195 Loïc Minier
            return 0
148 0dba6195 Loïc Minier
        fi
149 0dba6195 Loïc Minier
    fi
150 0dba6195 Loïc Minier
    if [ -z "$local_command" ]; then
151 0dba6195 Loïc Minier
        return 1
152 0dba6195 Loïc Minier
    fi
153 0dba6195 Loïc Minier
154 0dba6195 Loïc Minier
    IFS=:
155 0dba6195 Loïc Minier
    for local_dir in $PATH; do
156 0dba6195 Loïc Minier
        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
157 0dba6195 Loïc Minier
            echo "$local_dir/$local_command"
158 0dba6195 Loïc Minier
            IFS="${local_ifs:-$(printf ' \t\n')}"
159 0dba6195 Loïc Minier
            return 0
160 0dba6195 Loïc Minier
        fi
161 0dba6195 Loïc Minier
    done
162 0dba6195 Loïc Minier
    # not found
163 0dba6195 Loïc Minier
    IFS="${local_ifs:-$(printf ' \t\n')}"
164 0dba6195 Loïc Minier
    return 1
165 0dba6195 Loïc Minier
}
166 0dba6195 Loïc Minier
167 7d13299d bellard
# default parameters
168 ca4deeb1 Paolo Bonzini
source_path=`dirname "$0"`
169 2ff6b91e Juan Quintela
cpu=""
170 a31a8642 Michael S. Tsirkin
iasl="iasl"
171 1e43adfc bellard
interp_prefix="/usr/gnemul/qemu-%M"
172 43ce4dfe bellard
static="no"
173 7d13299d bellard
cross_prefix=""
174 0c58ac1c malc
audio_drv_list=""
175 b64ec4e4 Fam Zheng
block_drv_rw_whitelist=""
176 b64ec4e4 Fam Zheng
block_drv_ro_whitelist=""
177 e49d021e Peter Maydell
host_cc="cc"
178 73da375e Juan Quintela
libs_softmmu=""
179 3e2e0e6b Juan Quintela
libs_tools=""
180 67f86e8e Juan Quintela
audio_pt_int=""
181 d5631638 malc
audio_win_int=""
182 2b2e59e6 Paolo Bonzini
cc_i386=i386-pc-linux-gnu-gcc
183 957f1f99 Michael Roth
libs_qga=""
184 5bc62e01 Gerd Hoffmann
debug_info="yes"
185 ac0df51d aliguori
186 afb63ebd Stefan Weil
# Don't accept a target_list environment variable.
187 afb63ebd Stefan Weil
unset target_list
188 377529c0 Paolo Bonzini
189 377529c0 Paolo Bonzini
# Default value for a variable defining feature "foo".
190 377529c0 Paolo Bonzini
#  * foo="no"  feature will only be used if --enable-foo arg is given
191 377529c0 Paolo Bonzini
#  * foo=""    feature will be searched for, and if found, will be used
192 377529c0 Paolo Bonzini
#              unless --disable-foo is given
193 377529c0 Paolo Bonzini
#  * foo="yes" this value will only be set by --enable-foo flag.
194 377529c0 Paolo Bonzini
#              feature will searched for,
195 377529c0 Paolo Bonzini
#              if not found, configure exits with error
196 377529c0 Paolo Bonzini
#
197 377529c0 Paolo Bonzini
# Always add --enable-foo and --disable-foo command line args.
198 377529c0 Paolo Bonzini
# Distributions want to ensure that several features are compiled in, and it
199 377529c0 Paolo Bonzini
# is impossible without a --enable-foo that exits if a feature is not found.
200 377529c0 Paolo Bonzini
201 377529c0 Paolo Bonzini
bluez=""
202 377529c0 Paolo Bonzini
brlapi=""
203 377529c0 Paolo Bonzini
curl=""
204 377529c0 Paolo Bonzini
curses=""
205 377529c0 Paolo Bonzini
docs=""
206 377529c0 Paolo Bonzini
fdt=""
207 58952137 Vincenzo Maffione
netmap="no"
208 e2134eb9 Gerd Hoffmann
pixman=""
209 377529c0 Paolo Bonzini
sdl=""
210 983eef5a Meador Inge
virtfs=""
211 821601ea Jes Sorensen
vnc="yes"
212 377529c0 Paolo Bonzini
sparse="no"
213 377529c0 Paolo Bonzini
uuid=""
214 377529c0 Paolo Bonzini
vde=""
215 377529c0 Paolo Bonzini
vnc_tls=""
216 377529c0 Paolo Bonzini
vnc_sasl=""
217 377529c0 Paolo Bonzini
vnc_jpeg=""
218 377529c0 Paolo Bonzini
vnc_png=""
219 7536ee4b Tim Hardeck
vnc_ws=""
220 377529c0 Paolo Bonzini
xen=""
221 d5b93ddf Anthony PERARD
xen_ctrl_version=""
222 eb6fda0f Anthony PERARD
xen_pci_passthrough=""
223 377529c0 Paolo Bonzini
linux_aio=""
224 47e98658 Corey Bryant
cap_ng=""
225 377529c0 Paolo Bonzini
attr=""
226 4f26f2b6 Avi Kivity
libattr=""
227 377529c0 Paolo Bonzini
xfs=""
228 377529c0 Paolo Bonzini
229 d41a75a2 Brad
vhost_net="no"
230 5e9be92d Nicholas Bellinger
vhost_scsi="no"
231 d41a75a2 Brad
kvm="no"
232 2da776db Michael R. Hines
rdma=""
233 377529c0 Paolo Bonzini
gprof="no"
234 377529c0 Paolo Bonzini
debug_tcg="no"
235 377529c0 Paolo Bonzini
debug="no"
236 377529c0 Paolo Bonzini
strip_opt="yes"
237 9195b2c2 Stefan Weil
tcg_interpreter="no"
238 377529c0 Paolo Bonzini
bigendian="no"
239 377529c0 Paolo Bonzini
mingw32="no"
240 1d728c39 Blue Swirl
gcov="no"
241 1d728c39 Blue Swirl
gcov_tool="gcov"
242 377529c0 Paolo Bonzini
EXESUF=""
243 17969268 Fam Zheng
DSOSUF=".so"
244 17969268 Fam Zheng
LDFLAGS_SHARED="-shared"
245 17969268 Fam Zheng
modules="no"
246 377529c0 Paolo Bonzini
prefix="/usr/local"
247 377529c0 Paolo Bonzini
mandir="\${prefix}/share/man"
248 528ae5b8 Eduardo Habkost
datadir="\${prefix}/share"
249 850da188 Eduardo Habkost
qemu_docdir="\${prefix}/share/doc/qemu"
250 377529c0 Paolo Bonzini
bindir="\${prefix}/bin"
251 3aa5d2be Alon Levy
libdir="\${prefix}/lib"
252 8bf188aa Michael Tokarev
libexecdir="\${prefix}/libexec"
253 0f94d6da Alon Levy
includedir="\${prefix}/include"
254 377529c0 Paolo Bonzini
sysconfdir="\${prefix}/etc"
255 785c23ae Luiz Capitulino
local_statedir="\${prefix}/var"
256 377529c0 Paolo Bonzini
confsuffix="/qemu"
257 377529c0 Paolo Bonzini
slirp="yes"
258 377529c0 Paolo Bonzini
fmod_lib=""
259 377529c0 Paolo Bonzini
fmod_inc=""
260 377529c0 Paolo Bonzini
oss_lib=""
261 377529c0 Paolo Bonzini
bsd="no"
262 377529c0 Paolo Bonzini
linux="no"
263 377529c0 Paolo Bonzini
solaris="no"
264 377529c0 Paolo Bonzini
profiler="no"
265 377529c0 Paolo Bonzini
cocoa="no"
266 377529c0 Paolo Bonzini
softmmu="yes"
267 377529c0 Paolo Bonzini
linux_user="no"
268 377529c0 Paolo Bonzini
bsd_user="no"
269 30163d89 Peter Maydell
guest_base="yes"
270 377529c0 Paolo Bonzini
uname_release=""
271 377529c0 Paolo Bonzini
aix="no"
272 377529c0 Paolo Bonzini
blobs="yes"
273 377529c0 Paolo Bonzini
pkgversion=""
274 40d6444e Avi Kivity
pie=""
275 377529c0 Paolo Bonzini
zero_malloc=""
276 3556c233 Paolo Bonzini
qom_cast_debug="yes"
277 377529c0 Paolo Bonzini
trace_backend="nop"
278 377529c0 Paolo Bonzini
trace_file="trace"
279 377529c0 Paolo Bonzini
spice=""
280 377529c0 Paolo Bonzini
rbd=""
281 111a38b0 Robert Relyea
smartcard_nss=""
282 2b2325ff Gerd Hoffmann
libusb=""
283 69354a83 Hans de Goede
usb_redir=""
284 b1e5fff4 Michael Walle
glx=""
285 1ece9905 Alon Levy
zlib="yes"
286 607dacd0 qiaonuohan
lzo="no"
287 607dacd0 qiaonuohan
snappy="no"
288 e8ef31a3 Michael Tokarev
guest_agent=""
289 d9840e25 Tomoki Sekiyama
guest_agent_with_vss="no"
290 d9840e25 Tomoki Sekiyama
vss_win32_sdk=""
291 d9840e25 Tomoki Sekiyama
win_sdk="no"
292 4b1c11fd Daniel P. Berrange
want_tools="yes"
293 c589b249 Ronnie Sahlberg
libiscsi=""
294 6542aa9c Peter Lieven
libnfs=""
295 519175a2 Alex Barcelo
coroutine=""
296 70c60c08 Stefan Hajnoczi
coroutine_pool=""
297 f794573e Eduardo Otubo
seccomp=""
298 eb100396 Bharata B Rao
glusterfs=""
299 0c14fb47 Bharata B Rao
glusterfs_discard="no"
300 7c815372 Bharata B Rao
glusterfs_zerofill="no"
301 d0277315 Chrysostomos Nanakos
archipelago=""
302 583f6e7b Stefan Hajnoczi
virtio_blk_data_plane=""
303 a4ccabcf Anthony Liguori
gtk=""
304 528de90a Daniel P. Berrange
gtkabi="2.0"
305 ab214c29 Stefan Berger
tpm="no"
306 0a12ec87 Richard W.M. Jones
libssh2=""
307 4f18b782 Jeff Cody
vhdx=""
308 95c6bff3 Benoît Canet
quorum="no"
309 377529c0 Paolo Bonzini
310 ac0df51d aliguori
# parse CC options first
311 ac0df51d aliguori
for opt do
312 ac0df51d aliguori
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
313 ac0df51d aliguori
  case "$opt" in
314 ac0df51d aliguori
  --cross-prefix=*) cross_prefix="$optarg"
315 ac0df51d aliguori
  ;;
316 3d8df640 Paolo Bonzini
  --cc=*) CC="$optarg"
317 ac0df51d aliguori
  ;;
318 83f73fce Tomoki Sekiyama
  --cxx=*) CXX="$optarg"
319 83f73fce Tomoki Sekiyama
  ;;
320 ca4deeb1 Paolo Bonzini
  --source-path=*) source_path="$optarg"
321 ca4deeb1 Paolo Bonzini
  ;;
322 2ff6b91e Juan Quintela
  --cpu=*) cpu="$optarg"
323 2ff6b91e Juan Quintela
  ;;
324 a558ee17 Juan Quintela
  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
325 f9943cd5 Gerd Hoffmann
                    EXTRA_CFLAGS="$optarg"
326 e2a2ed06 Juan Quintela
  ;;
327 e2a2ed06 Juan Quintela
  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
328 f9943cd5 Gerd Hoffmann
                     EXTRA_LDFLAGS="$optarg"
329 e2a2ed06 Juan Quintela
  ;;
330 5bc62e01 Gerd Hoffmann
  --enable-debug-info) debug_info="yes"
331 5bc62e01 Gerd Hoffmann
  ;;
332 5bc62e01 Gerd Hoffmann
  --disable-debug-info) debug_info="no"
333 5bc62e01 Gerd Hoffmann
  ;;
334 ac0df51d aliguori
  esac
335 ac0df51d aliguori
done
336 ac0df51d aliguori
# OS specific
337 ac0df51d aliguori
# Using uname is really, really broken.  Once we have the right set of checks
338 93148aa5 Stefan Weil
# we can eliminate its usage altogether.
339 ac0df51d aliguori
340 e49d021e Peter Maydell
# Preferred compiler:
341 e49d021e Peter Maydell
#  ${CC} (if set)
342 e49d021e Peter Maydell
#  ${cross_prefix}gcc (if cross-prefix specified)
343 e49d021e Peter Maydell
#  system compiler
344 e49d021e Peter Maydell
if test -z "${CC}${cross_prefix}"; then
345 e49d021e Peter Maydell
  cc="$host_cc"
346 e49d021e Peter Maydell
else
347 e49d021e Peter Maydell
  cc="${CC-${cross_prefix}gcc}"
348 e49d021e Peter Maydell
fi
349 e49d021e Peter Maydell
350 83f73fce Tomoki Sekiyama
if test -z "${CXX}${cross_prefix}"; then
351 83f73fce Tomoki Sekiyama
  cxx="c++"
352 83f73fce Tomoki Sekiyama
else
353 83f73fce Tomoki Sekiyama
  cxx="${CXX-${cross_prefix}g++}"
354 83f73fce Tomoki Sekiyama
fi
355 83f73fce Tomoki Sekiyama
356 b3198cc2 Stuart Yoder
ar="${AR-${cross_prefix}ar}"
357 3dd46c78 Blue Swirl
as="${AS-${cross_prefix}as}"
358 3dd46c78 Blue Swirl
cpp="${CPP-$cc -E}"
359 b3198cc2 Stuart Yoder
objcopy="${OBJCOPY-${cross_prefix}objcopy}"
360 b3198cc2 Stuart Yoder
ld="${LD-${cross_prefix}ld}"
361 3f534581 Brad
libtool="${LIBTOOL-${cross_prefix}libtool}"
362 b3198cc2 Stuart Yoder
strip="${STRIP-${cross_prefix}strip}"
363 b3198cc2 Stuart Yoder
windres="${WINDRES-${cross_prefix}windres}"
364 17884d7b Sergei Trofimovich
pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
365 17884d7b Sergei Trofimovich
query_pkg_config() {
366 17884d7b Sergei Trofimovich
    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
367 17884d7b Sergei Trofimovich
}
368 17884d7b Sergei Trofimovich
pkg_config=query_pkg_config
369 b3198cc2 Stuart Yoder
sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
370 ac0df51d aliguori
371 45d285ab Peter Maydell
# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
372 45d285ab Peter Maydell
ARFLAGS="${ARFLAGS-rv}"
373 45d285ab Peter Maydell
374 be17dc90 Michael S. Tsirkin
# default flags for all hosts
375 be17dc90 Michael S. Tsirkin
QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
376 f9188227 Mike Frysinger
QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
377 c95e3080 Kevin Wolf
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
378 be17dc90 Michael S. Tsirkin
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
379 6b4c305c Paolo Bonzini
QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
380 5bc62e01 Gerd Hoffmann
if test "$debug_info" = "yes"; then
381 5bc62e01 Gerd Hoffmann
    CFLAGS="-g $CFLAGS"
382 5bc62e01 Gerd Hoffmann
    LDFLAGS="-g $LDFLAGS"
383 5bc62e01 Gerd Hoffmann
fi
384 be17dc90 Michael S. Tsirkin
385 ca4deeb1 Paolo Bonzini
# make source path absolute
386 ca4deeb1 Paolo Bonzini
source_path=`cd "$source_path"; pwd`
387 ca4deeb1 Paolo Bonzini
388 ac0df51d aliguori
check_define() {
389 ac0df51d aliguori
cat > $TMPC <<EOF
390 ac0df51d aliguori
#if !defined($1)
391 fd786e1a Peter Maydell
#error $1 not defined
392 ac0df51d aliguori
#endif
393 ac0df51d aliguori
int main(void) { return 0; }
394 ac0df51d aliguori
EOF
395 52166aa0 Juan Quintela
  compile_object
396 ac0df51d aliguori
}
397 ac0df51d aliguori
398 bbea4050 Peter Maydell
if check_define __linux__ ; then
399 bbea4050 Peter Maydell
  targetos="Linux"
400 bbea4050 Peter Maydell
elif check_define _WIN32 ; then
401 bbea4050 Peter Maydell
  targetos='MINGW32'
402 bbea4050 Peter Maydell
elif check_define __OpenBSD__ ; then
403 bbea4050 Peter Maydell
  targetos='OpenBSD'
404 bbea4050 Peter Maydell
elif check_define __sun__ ; then
405 bbea4050 Peter Maydell
  targetos='SunOS'
406 bbea4050 Peter Maydell
elif check_define __HAIKU__ ; then
407 bbea4050 Peter Maydell
  targetos='Haiku'
408 bbea4050 Peter Maydell
else
409 bbea4050 Peter Maydell
  targetos=`uname -s`
410 bbea4050 Peter Maydell
fi
411 bbea4050 Peter Maydell
412 bbea4050 Peter Maydell
# Some host OSes need non-standard checks for which CPU to use.
413 bbea4050 Peter Maydell
# Note that these checks are broken for cross-compilation: if you're
414 bbea4050 Peter Maydell
# cross-compiling to one of these OSes then you'll need to specify
415 bbea4050 Peter Maydell
# the correct CPU with the --cpu option.
416 bbea4050 Peter Maydell
case $targetos in
417 bbea4050 Peter Maydell
Darwin)
418 bbea4050 Peter Maydell
  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
419 bbea4050 Peter Maydell
  # run 64-bit userspace code.
420 bbea4050 Peter Maydell
  # If the user didn't specify a CPU explicitly and the kernel says this is
421 bbea4050 Peter Maydell
  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
422 bbea4050 Peter Maydell
  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
423 bbea4050 Peter Maydell
    cpu="x86_64"
424 bbea4050 Peter Maydell
  fi
425 bbea4050 Peter Maydell
  ;;
426 bbea4050 Peter Maydell
SunOS)
427 bbea4050 Peter Maydell
  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
428 bbea4050 Peter Maydell
  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
429 bbea4050 Peter Maydell
    cpu="x86_64"
430 bbea4050 Peter Maydell
  fi
431 bbea4050 Peter Maydell
esac
432 bbea4050 Peter Maydell
433 2ff6b91e Juan Quintela
if test ! -z "$cpu" ; then
434 2ff6b91e Juan Quintela
  # command line argument
435 2ff6b91e Juan Quintela
  :
436 2ff6b91e Juan Quintela
elif check_define __i386__ ; then
437 ac0df51d aliguori
  cpu="i386"
438 ac0df51d aliguori
elif check_define __x86_64__ ; then
439 c72b26ec Richard Henderson
  if check_define __ILP32__ ; then
440 c72b26ec Richard Henderson
    cpu="x32"
441 c72b26ec Richard Henderson
  else
442 c72b26ec Richard Henderson
    cpu="x86_64"
443 c72b26ec Richard Henderson
  fi
444 3aa9bd6c blueswir1
elif check_define __sparc__ ; then
445 3aa9bd6c blueswir1
  if check_define __arch64__ ; then
446 3aa9bd6c blueswir1
    cpu="sparc64"
447 3aa9bd6c blueswir1
  else
448 3aa9bd6c blueswir1
    cpu="sparc"
449 3aa9bd6c blueswir1
  fi
450 fdf7ed96 malc
elif check_define _ARCH_PPC ; then
451 fdf7ed96 malc
  if check_define _ARCH_PPC64 ; then
452 fdf7ed96 malc
    cpu="ppc64"
453 fdf7ed96 malc
  else
454 fdf7ed96 malc
    cpu="ppc"
455 fdf7ed96 malc
  fi
456 afa05235 Aurelien Jarno
elif check_define __mips__ ; then
457 afa05235 Aurelien Jarno
  cpu="mips"
458 477ba620 Aurelien Jarno
elif check_define __ia64__ ; then
459 477ba620 Aurelien Jarno
  cpu="ia64"
460 d66ed0ea Aurelien Jarno
elif check_define __s390__ ; then
461 d66ed0ea Aurelien Jarno
  if check_define __s390x__ ; then
462 d66ed0ea Aurelien Jarno
    cpu="s390x"
463 d66ed0ea Aurelien Jarno
  else
464 d66ed0ea Aurelien Jarno
    cpu="s390"
465 d66ed0ea Aurelien Jarno
  fi
466 21d89f84 Peter Maydell
elif check_define __arm__ ; then
467 21d89f84 Peter Maydell
  cpu="arm"
468 1f080313 Claudio Fontana
elif check_define __aarch64__ ; then
469 1f080313 Claudio Fontana
  cpu="aarch64"
470 f28ffed5 Brad
elif check_define __hppa__ ; then
471 f28ffed5 Brad
  cpu="hppa"
472 ac0df51d aliguori
else
473 fdf7ed96 malc
  cpu=`uname -m`
474 ac0df51d aliguori
fi
475 ac0df51d aliguori
476 359bc95d Peter Maydell
ARCH=
477 359bc95d Peter Maydell
# Normalise host CPU name and set ARCH.
478 359bc95d Peter Maydell
# Note that this case should only have supported host CPUs, not guests.
479 7d13299d bellard
case "$cpu" in
480 c72b26ec Richard Henderson
  ia64|ppc|ppc64|s390|s390x|sparc64|x32)
481 ea8f20f8 Juan Quintela
    cpu="$cpu"
482 ea8f20f8 Juan Quintela
  ;;
483 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
484 97a847bc bellard
    cpu="i386"
485 7d13299d bellard
  ;;
486 aaa5fa14 aurel32
  x86_64|amd64)
487 aaa5fa14 aurel32
    cpu="x86_64"
488 aaa5fa14 aurel32
  ;;
489 21d89f84 Peter Maydell
  armv*b|armv*l|arm)
490 21d89f84 Peter Maydell
    cpu="arm"
491 7d13299d bellard
  ;;
492 1f080313 Claudio Fontana
  aarch64)
493 1f080313 Claudio Fontana
    cpu="aarch64"
494 1f080313 Claudio Fontana
  ;;
495 afa05235 Aurelien Jarno
  mips*)
496 afa05235 Aurelien Jarno
    cpu="mips"
497 afa05235 Aurelien Jarno
  ;;
498 3142255c blueswir1
  sparc|sun4[cdmuv])
499 ae228531 bellard
    cpu="sparc"
500 ae228531 bellard
  ;;
501 7d13299d bellard
  *)
502 359bc95d Peter Maydell
    # This will result in either an error or falling back to TCI later
503 359bc95d Peter Maydell
    ARCH=unknown
504 7d13299d bellard
  ;;
505 7d13299d bellard
esac
506 359bc95d Peter Maydell
if test -z "$ARCH"; then
507 359bc95d Peter Maydell
  ARCH="$cpu"
508 359bc95d Peter Maydell
fi
509 e2d52ad3 Juan Quintela
510 7d13299d bellard
# OS specific
511 0dbfc675 Juan Quintela
512 7d13299d bellard
case $targetos in
513 c326e0af bellard
CYGWIN*)
514 0dbfc675 Juan Quintela
  mingw32="yes"
515 a558ee17 Juan Quintela
  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
516 d5631638 malc
  audio_possible_drivers="winwave sdl"
517 d5631638 malc
  audio_drv_list="winwave"
518 c326e0af bellard
;;
519 67b915a5 bellard
MINGW32*)
520 0dbfc675 Juan Quintela
  mingw32="yes"
521 d5631638 malc
  audio_possible_drivers="winwave dsound sdl fmod"
522 d5631638 malc
  audio_drv_list="winwave"
523 67b915a5 bellard
;;
524 5c40d2bd ths
GNU/kFreeBSD)
525 a167ba50 Aurelien Jarno
  bsd="yes"
526 0dbfc675 Juan Quintela
  audio_drv_list="oss"
527 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
528 5c40d2bd ths
;;
529 7d3505c5 bellard
FreeBSD)
530 0dbfc675 Juan Quintela
  bsd="yes"
531 0db4a067 Paolo Bonzini
  make="${MAKE-gmake}"
532 0dbfc675 Juan Quintela
  audio_drv_list="oss"
533 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
534 f01576f1 Juergen Lock
  # needed for kinfo_getvmmap(3) in libutil.h
535 f01576f1 Juergen Lock
  LIBS="-lutil $LIBS"
536 58952137 Vincenzo Maffione
  netmap=""  # enable netmap autodetect
537 7d3505c5 bellard
;;
538 c5e97233 blueswir1
DragonFly)
539 0dbfc675 Juan Quintela
  bsd="yes"
540 0db4a067 Paolo Bonzini
  make="${MAKE-gmake}"
541 0dbfc675 Juan Quintela
  audio_drv_list="oss"
542 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
543 c5e97233 blueswir1
;;
544 7d3505c5 bellard
NetBSD)
545 0dbfc675 Juan Quintela
  bsd="yes"
546 0db4a067 Paolo Bonzini
  make="${MAKE-gmake}"
547 0dbfc675 Juan Quintela
  audio_drv_list="oss"
548 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd"
549 0dbfc675 Juan Quintela
  oss_lib="-lossaudio"
550 7d3505c5 bellard
;;
551 7d3505c5 bellard
OpenBSD)
552 0dbfc675 Juan Quintela
  bsd="yes"
553 0db4a067 Paolo Bonzini
  make="${MAKE-gmake}"
554 4f6ab397 Brad Smith
  audio_drv_list="sdl"
555 4f6ab397 Brad Smith
  audio_possible_drivers="sdl esd"
556 7d3505c5 bellard
;;
557 83fb7adf bellard
Darwin)
558 0dbfc675 Juan Quintela
  bsd="yes"
559 0dbfc675 Juan Quintela
  darwin="yes"
560 17969268 Fam Zheng
  LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
561 0dbfc675 Juan Quintela
  if [ "$cpu" = "x86_64" ] ; then
562 a558ee17 Juan Quintela
    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
563 0c439cbf Juan Quintela
    LDFLAGS="-arch x86_64 $LDFLAGS"
564 0dbfc675 Juan Quintela
  fi
565 0dbfc675 Juan Quintela
  cocoa="yes"
566 0dbfc675 Juan Quintela
  audio_drv_list="coreaudio"
567 0dbfc675 Juan Quintela
  audio_possible_drivers="coreaudio sdl fmod"
568 0dbfc675 Juan Quintela
  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
569 7973f21c Juan Quintela
  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
570 a0b7cf6b Peter Maydell
  # Disable attempts to use ObjectiveC features in os/object.h since they
571 a0b7cf6b Peter Maydell
  # won't work when we're compiling with gcc as a C compiler.
572 a0b7cf6b Peter Maydell
  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
573 83fb7adf bellard
;;
574 ec530c81 bellard
SunOS)
575 0dbfc675 Juan Quintela
  solaris="yes"
576 0db4a067 Paolo Bonzini
  make="${MAKE-gmake}"
577 0db4a067 Paolo Bonzini
  install="${INSTALL-ginstall}"
578 fa58948d Blue Swirl
  ld="gld"
579 e2d8830e Brad
  smbd="${SMBD-/usr/sfw/sbin/smbd}"
580 0dbfc675 Juan Quintela
  needs_libsunmath="no"
581 0dbfc675 Juan Quintela
  solarisrev=`uname -r | cut -f2 -d.`
582 0dbfc675 Juan Quintela
  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
583 0dbfc675 Juan Quintela
    if test "$solarisrev" -le 9 ; then
584 0dbfc675 Juan Quintela
      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
585 0dbfc675 Juan Quintela
        needs_libsunmath="yes"
586 f14bfdf9 Juan Quintela
        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
587 f14bfdf9 Juan Quintela
        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
588 f14bfdf9 Juan Quintela
        LIBS="-lsunmath $LIBS"
589 0dbfc675 Juan Quintela
      else
590 76ad07a4 Peter Maydell
        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
591 76ad07a4 Peter Maydell
            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
592 76ad07a4 Peter Maydell
            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
593 76ad07a4 Peter Maydell
            "Studio 11 can be downloaded from www.sun.com."
594 0dbfc675 Juan Quintela
      fi
595 86b2bd93 ths
    fi
596 0dbfc675 Juan Quintela
  fi
597 0dbfc675 Juan Quintela
  if test -f /usr/include/sys/soundcard.h ; then
598 0dbfc675 Juan Quintela
    audio_drv_list="oss"
599 0dbfc675 Juan Quintela
  fi
600 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl"
601 d741429a Blue Swirl
# needed for CMSG_ macros in sys/socket.h
602 d741429a Blue Swirl
  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
603 d741429a Blue Swirl
# needed for TIOCWIN* defines in termios.h
604 d741429a Blue Swirl
  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
605 a558ee17 Juan Quintela
  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
606 560d375f Andreas Färber
  solarisnetlibs="-lsocket -lnsl -lresolv"
607 560d375f Andreas Färber
  LIBS="$solarisnetlibs $LIBS"
608 560d375f Andreas Färber
  libs_qga="$solarisnetlibs $libs_qga"
609 86b2bd93 ths
;;
610 b29fe3ed malc
AIX)
611 0dbfc675 Juan Quintela
  aix="yes"
612 0db4a067 Paolo Bonzini
  make="${MAKE-gmake}"
613 b29fe3ed malc
;;
614 179cf400 Andreas Färber
Haiku)
615 179cf400 Andreas Färber
  haiku="yes"
616 179cf400 Andreas Färber
  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
617 179cf400 Andreas Färber
  LIBS="-lposix_error_mapper -lnetwork $LIBS"
618 179cf400 Andreas Färber
;;
619 1d14ffa9 bellard
*)
620 0dbfc675 Juan Quintela
  audio_drv_list="oss"
621 0dbfc675 Juan Quintela
  audio_possible_drivers="oss alsa sdl esd pa"
622 0dbfc675 Juan Quintela
  linux="yes"
623 0dbfc675 Juan Quintela
  linux_user="yes"
624 af2be207 Jan Kiszka
  kvm="yes"
625 af2be207 Jan Kiszka
  vhost_net="yes"
626 5e9be92d Nicholas Bellinger
  vhost_scsi="yes"
627 c72b26ec Richard Henderson
  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
628 c2de5c91 malc
    audio_possible_drivers="$audio_possible_drivers fmod"
629 0dbfc675 Juan Quintela
  fi
630 a585140d Alexey Kardashevskiy
  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
631 fb065187 bellard
;;
632 7d13299d bellard
esac
633 7d13299d bellard
634 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
635 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
636 08de3949 Andreas Färber
    bsd_user="yes"
637 83fb7adf bellard
  fi
638 7d3505c5 bellard
fi
639 7d3505c5 bellard
640 0db4a067 Paolo Bonzini
: ${make=${MAKE-make}}
641 0db4a067 Paolo Bonzini
: ${install=${INSTALL-install}}
642 52510f8b Stefan Weil
: ${python=${PYTHON-python}}
643 e2d8830e Brad
: ${smbd=${SMBD-/usr/sbin/smbd}}
644 0db4a067 Paolo Bonzini
645 3c4a4d0d Peter Maydell
# Default objcc to clang if available, otherwise use CC
646 3c4a4d0d Peter Maydell
if has clang; then
647 3c4a4d0d Peter Maydell
  objcc=clang
648 3c4a4d0d Peter Maydell
else
649 3c4a4d0d Peter Maydell
  objcc="$cc"
650 3c4a4d0d Peter Maydell
fi
651 3c4a4d0d Peter Maydell
652 3457a3f8 Juan Quintela
if test "$mingw32" = "yes" ; then
653 3457a3f8 Juan Quintela
  EXESUF=".exe"
654 17969268 Fam Zheng
  DSOSUF=".dll"
655 a558ee17 Juan Quintela
  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
656 e94a7936 Stefan Weil
  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
657 e94a7936 Stefan Weil
  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
658 f7cf5d5b Stefan Weil
  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
659 f7cf5d5b Stefan Weil
cat > $TMPC << EOF
660 f7cf5d5b Stefan Weil
int main(void) { return 0; }
661 f7cf5d5b Stefan Weil
EOF
662 f7cf5d5b Stefan Weil
  if compile_prog "" "-liberty" ; then
663 f7cf5d5b Stefan Weil
    LIBS="-liberty $LIBS"
664 f7cf5d5b Stefan Weil
  fi
665 c5ec15ea Stefan Weil
  prefix="c:/Program Files/QEMU"
666 683035de Paolo Bonzini
  mandir="\${prefix}"
667 528ae5b8 Eduardo Habkost
  datadir="\${prefix}"
668 850da188 Eduardo Habkost
  qemu_docdir="\${prefix}"
669 683035de Paolo Bonzini
  bindir="\${prefix}"
670 683035de Paolo Bonzini
  sysconfdir="\${prefix}"
671 5a699bbb Laszlo Ersek
  local_statedir=
672 683035de Paolo Bonzini
  confsuffix=""
673 368542b8 Stefan Hajnoczi
  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
674 3457a3f8 Juan Quintela
fi
675 3457a3f8 Juan Quintela
676 487fefdb Anthony Liguori
werror=""
677 85aa5189 bellard
678 7d13299d bellard
for opt do
679 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
680 7d13299d bellard
  case "$opt" in
681 2efc3265 bellard
  --help|-h) show_help=yes
682 2efc3265 bellard
  ;;
683 99123e13 Mike Frysinger
  --version|-V) exec cat $source_path/VERSION
684 99123e13 Mike Frysinger
  ;;
685 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
686 7d13299d bellard
  ;;
687 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
688 32ce6337 bellard
  ;;
689 ca4deeb1 Paolo Bonzini
  --source-path=*)
690 7d13299d bellard
  ;;
691 ac0df51d aliguori
  --cross-prefix=*)
692 7d13299d bellard
  ;;
693 ac0df51d aliguori
  --cc=*)
694 7d13299d bellard
  ;;
695 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
696 83469015 bellard
  ;;
697 83f73fce Tomoki Sekiyama
  --cxx=*)
698 83f73fce Tomoki Sekiyama
  ;;
699 e007dbec Michael S. Tsirkin
  --iasl=*) iasl="$optarg"
700 e007dbec Michael S. Tsirkin
  ;;
701 3c4a4d0d Peter Maydell
  --objcc=*) objcc="$optarg"
702 3c4a4d0d Peter Maydell
  ;;
703 b1a550a0 pbrook
  --make=*) make="$optarg"
704 7d13299d bellard
  ;;
705 6a882643 pbrook
  --install=*) install="$optarg"
706 6a882643 pbrook
  ;;
707 c886edfb Blue Swirl
  --python=*) python="$optarg"
708 c886edfb Blue Swirl
  ;;
709 1d728c39 Blue Swirl
  --gcov=*) gcov_tool="$optarg"
710 1d728c39 Blue Swirl
  ;;
711 e2d8830e Brad
  --smbd=*) smbd="$optarg"
712 e2d8830e Brad
  ;;
713 e2a2ed06 Juan Quintela
  --extra-cflags=*)
714 7d13299d bellard
  ;;
715 e2a2ed06 Juan Quintela
  --extra-ldflags=*)
716 7d13299d bellard
  ;;
717 5bc62e01 Gerd Hoffmann
  --enable-debug-info)
718 5bc62e01 Gerd Hoffmann
  ;;
719 5bc62e01 Gerd Hoffmann
  --disable-debug-info)
720 5bc62e01 Gerd Hoffmann
  ;;
721 17969268 Fam Zheng
  --enable-modules)
722 17969268 Fam Zheng
      modules="yes"
723 17969268 Fam Zheng
  ;;
724 2ff6b91e Juan Quintela
  --cpu=*)
725 7d13299d bellard
  ;;
726 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
727 de83cd02 bellard
  ;;
728 74242e0f Paolo Bonzini
  --enable-trace-backend=*) trace_backend="$optarg"
729 94a420b1 Stefan Hajnoczi
  ;;
730 74242e0f Paolo Bonzini
  --with-trace-file=*) trace_file="$optarg"
731 9410b56c Prerna Saxena
  ;;
732 7d13299d bellard
  --enable-gprof) gprof="yes"
733 7d13299d bellard
  ;;
734 1d728c39 Blue Swirl
  --enable-gcov) gcov="yes"
735 1d728c39 Blue Swirl
  ;;
736 79427693 Loïc Minier
  --static)
737 79427693 Loïc Minier
    static="yes"
738 79427693 Loïc Minier
    LDFLAGS="-static $LDFLAGS"
739 17884d7b Sergei Trofimovich
    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
740 43ce4dfe bellard
  ;;
741 0b24e75f Paolo Bonzini
  --mandir=*) mandir="$optarg"
742 0b24e75f Paolo Bonzini
  ;;
743 0b24e75f Paolo Bonzini
  --bindir=*) bindir="$optarg"
744 0b24e75f Paolo Bonzini
  ;;
745 3aa5d2be Alon Levy
  --libdir=*) libdir="$optarg"
746 3aa5d2be Alon Levy
  ;;
747 8bf188aa Michael Tokarev
  --libexecdir=*) libexecdir="$optarg"
748 8bf188aa Michael Tokarev
  ;;
749 0f94d6da Alon Levy
  --includedir=*) includedir="$optarg"
750 0f94d6da Alon Levy
  ;;
751 528ae5b8 Eduardo Habkost
  --datadir=*) datadir="$optarg"
752 0b24e75f Paolo Bonzini
  ;;
753 023d3d67 Eduardo Habkost
  --with-confsuffix=*) confsuffix="$optarg"
754 023d3d67 Eduardo Habkost
  ;;
755 850da188 Eduardo Habkost
  --docdir=*) qemu_docdir="$optarg"
756 0b24e75f Paolo Bonzini
  ;;
757 ca2fb938 Andre Przywara
  --sysconfdir=*) sysconfdir="$optarg"
758 07381cc1 Anthony Liguori
  ;;
759 785c23ae Luiz Capitulino
  --localstatedir=*) local_statedir="$optarg"
760 785c23ae Luiz Capitulino
  ;;
761 785c23ae Luiz Capitulino
  --sbindir=*|--sharedstatedir=*|\
762 023ddd74 Max Filippov
  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
763 023ddd74 Max Filippov
  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
764 023ddd74 Max Filippov
    # These switches are silently ignored, for compatibility with
765 023ddd74 Max Filippov
    # autoconf-generated configure scripts. This allows QEMU's
766 023ddd74 Max Filippov
    # configure to be used by RPM and similar macros that set
767 023ddd74 Max Filippov
    # lots of directory switches by default.
768 023ddd74 Max Filippov
  ;;
769 e2134eb9 Gerd Hoffmann
  --with-system-pixman) pixman="system"
770 e2134eb9 Gerd Hoffmann
  ;;
771 e2134eb9 Gerd Hoffmann
  --without-system-pixman) pixman="internal"
772 e2134eb9 Gerd Hoffmann
  ;;
773 74880fe2 Robert Schiele
  --without-pixman) pixman="none"
774 74880fe2 Robert Schiele
  ;;
775 97a847bc bellard
  --disable-sdl) sdl="no"
776 97a847bc bellard
  ;;
777 c4198157 Juan Quintela
  --enable-sdl) sdl="yes"
778 c4198157 Juan Quintela
  ;;
779 3556c233 Paolo Bonzini
  --disable-qom-cast-debug) qom_cast_debug="no"
780 3556c233 Paolo Bonzini
  ;;
781 3556c233 Paolo Bonzini
  --enable-qom-cast-debug) qom_cast_debug="yes"
782 3556c233 Paolo Bonzini
  ;;
783 983eef5a Meador Inge
  --disable-virtfs) virtfs="no"
784 983eef5a Meador Inge
  ;;
785 983eef5a Meador Inge
  --enable-virtfs) virtfs="yes"
786 983eef5a Meador Inge
  ;;
787 821601ea Jes Sorensen
  --disable-vnc) vnc="no"
788 821601ea Jes Sorensen
  ;;
789 821601ea Jes Sorensen
  --enable-vnc) vnc="yes"
790 821601ea Jes Sorensen
  ;;
791 0c58ac1c malc
  --fmod-lib=*) fmod_lib="$optarg"
792 1d14ffa9 bellard
  ;;
793 c2de5c91 malc
  --fmod-inc=*) fmod_inc="$optarg"
794 c2de5c91 malc
  ;;
795 2f6a1ab0 blueswir1
  --oss-lib=*) oss_lib="$optarg"
796 2f6a1ab0 blueswir1
  ;;
797 0c58ac1c malc
  --audio-drv-list=*) audio_drv_list="$optarg"
798 102a52e4 bellard
  ;;
799 b64ec4e4 Fam Zheng
  --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
800 b64ec4e4 Fam Zheng
  ;;
801 b64ec4e4 Fam Zheng
  --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
802 eb852011 Markus Armbruster
  ;;
803 f8393946 aurel32
  --enable-debug-tcg) debug_tcg="yes"
804 f8393946 aurel32
  ;;
805 f8393946 aurel32
  --disable-debug-tcg) debug_tcg="no"
806 f8393946 aurel32
  ;;
807 f3d08ee6 Paul Brook
  --enable-debug)
808 f3d08ee6 Paul Brook
      # Enable debugging options that aren't excessively noisy
809 f3d08ee6 Paul Brook
      debug_tcg="yes"
810 f3d08ee6 Paul Brook
      debug="yes"
811 f3d08ee6 Paul Brook
      strip_opt="no"
812 f3d08ee6 Paul Brook
  ;;
813 03b4fe7d aliguori
  --enable-sparse) sparse="yes"
814 03b4fe7d aliguori
  ;;
815 03b4fe7d aliguori
  --disable-sparse) sparse="no"
816 03b4fe7d aliguori
  ;;
817 1625af87 aliguori
  --disable-strip) strip_opt="no"
818 1625af87 aliguori
  ;;
819 8d5d2d4c ths
  --disable-vnc-tls) vnc_tls="no"
820 8d5d2d4c ths
  ;;
821 1be10ad2 Juan Quintela
  --enable-vnc-tls) vnc_tls="yes"
822 1be10ad2 Juan Quintela
  ;;
823 2f9606b3 aliguori
  --disable-vnc-sasl) vnc_sasl="no"
824 2f9606b3 aliguori
  ;;
825 ea784e3b Juan Quintela
  --enable-vnc-sasl) vnc_sasl="yes"
826 ea784e3b Juan Quintela
  ;;
827 2f6f5c7a Corentin Chary
  --disable-vnc-jpeg) vnc_jpeg="no"
828 2f6f5c7a Corentin Chary
  ;;
829 2f6f5c7a Corentin Chary
  --enable-vnc-jpeg) vnc_jpeg="yes"
830 2f6f5c7a Corentin Chary
  ;;
831 efe556ad Corentin Chary
  --disable-vnc-png) vnc_png="no"
832 efe556ad Corentin Chary
  ;;
833 efe556ad Corentin Chary
  --enable-vnc-png) vnc_png="yes"
834 efe556ad Corentin Chary
  ;;
835 7536ee4b Tim Hardeck
  --disable-vnc-ws) vnc_ws="no"
836 7536ee4b Tim Hardeck
  ;;
837 7536ee4b Tim Hardeck
  --enable-vnc-ws) vnc_ws="yes"
838 7536ee4b Tim Hardeck
  ;;
839 443f1376 bellard
  --disable-slirp) slirp="no"
840 1d14ffa9 bellard
  ;;
841 ee682d27 Stefan Weil
  --disable-uuid) uuid="no"
842 ee682d27 Stefan Weil
  ;;
843 ee682d27 Stefan Weil
  --enable-uuid) uuid="yes"
844 ee682d27 Stefan Weil
  ;;
845 e0e6c8c0 aliguori
  --disable-vde) vde="no"
846 8a16d273 ths
  ;;
847 dfb278bd Juan Quintela
  --enable-vde) vde="yes"
848 dfb278bd Juan Quintela
  ;;
849 58952137 Vincenzo Maffione
  --disable-netmap) netmap="no"
850 58952137 Vincenzo Maffione
  ;;
851 58952137 Vincenzo Maffione
  --enable-netmap) netmap="yes"
852 58952137 Vincenzo Maffione
  ;;
853 e37630ca aliguori
  --disable-xen) xen="no"
854 e37630ca aliguori
  ;;
855 fc321b4b Juan Quintela
  --enable-xen) xen="yes"
856 fc321b4b Juan Quintela
  ;;
857 eb6fda0f Anthony PERARD
  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
858 eb6fda0f Anthony PERARD
  ;;
859 eb6fda0f Anthony PERARD
  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
860 eb6fda0f Anthony PERARD
  ;;
861 2e4d9fb1 aurel32
  --disable-brlapi) brlapi="no"
862 2e4d9fb1 aurel32
  ;;
863 4ffcedb6 Juan Quintela
  --enable-brlapi) brlapi="yes"
864 4ffcedb6 Juan Quintela
  ;;
865 fb599c9a balrog
  --disable-bluez) bluez="no"
866 fb599c9a balrog
  ;;
867 a20a6f46 Juan Quintela
  --enable-bluez) bluez="yes"
868 a20a6f46 Juan Quintela
  ;;
869 7ba1e619 aliguori
  --disable-kvm) kvm="no"
870 7ba1e619 aliguori
  ;;
871 b31a0277 Juan Quintela
  --enable-kvm) kvm="yes"
872 b31a0277 Juan Quintela
  ;;
873 9195b2c2 Stefan Weil
  --disable-tcg-interpreter) tcg_interpreter="no"
874 9195b2c2 Stefan Weil
  ;;
875 9195b2c2 Stefan Weil
  --enable-tcg-interpreter) tcg_interpreter="yes"
876 9195b2c2 Stefan Weil
  ;;
877 47e98658 Corey Bryant
  --disable-cap-ng)  cap_ng="no"
878 47e98658 Corey Bryant
  ;;
879 47e98658 Corey Bryant
  --enable-cap-ng) cap_ng="yes"
880 47e98658 Corey Bryant
  ;;
881 cd4ec0b4 Gerd Hoffmann
  --disable-spice) spice="no"
882 cd4ec0b4 Gerd Hoffmann
  ;;
883 cd4ec0b4 Gerd Hoffmann
  --enable-spice) spice="yes"
884 cd4ec0b4 Gerd Hoffmann
  ;;
885 c589b249 Ronnie Sahlberg
  --disable-libiscsi) libiscsi="no"
886 c589b249 Ronnie Sahlberg
  ;;
887 c589b249 Ronnie Sahlberg
  --enable-libiscsi) libiscsi="yes"
888 c589b249 Ronnie Sahlberg
  ;;
889 6542aa9c Peter Lieven
  --disable-libnfs) libnfs="no"
890 6542aa9c Peter Lieven
  ;;
891 6542aa9c Peter Lieven
  --enable-libnfs) libnfs="yes"
892 6542aa9c Peter Lieven
  ;;
893 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
894 05c2a3e7 bellard
  ;;
895 14821030 Pavel Borzenkov
  --disable-cocoa) cocoa="no"
896 14821030 Pavel Borzenkov
  ;;
897 c2de5c91 malc
  --enable-cocoa)
898 c2de5c91 malc
      cocoa="yes" ;
899 c2de5c91 malc
      sdl="no" ;
900 c2de5c91 malc
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
901 1d14ffa9 bellard
  ;;
902 cad25d69 pbrook
  --disable-system) softmmu="no"
903 0a8e90f4 pbrook
  ;;
904 cad25d69 pbrook
  --enable-system) softmmu="yes"
905 0a8e90f4 pbrook
  ;;
906 0953a80f Zachary Amsden
  --disable-user)
907 0953a80f Zachary Amsden
      linux_user="no" ;
908 0953a80f Zachary Amsden
      bsd_user="no" ;
909 0953a80f Zachary Amsden
  ;;
910 0953a80f Zachary Amsden
  --enable-user) ;;
911 831b7825 ths
  --disable-linux-user) linux_user="no"
912 0a8e90f4 pbrook
  ;;
913 831b7825 ths
  --enable-linux-user) linux_user="yes"
914 831b7825 ths
  ;;
915 84778508 blueswir1
  --disable-bsd-user) bsd_user="no"
916 84778508 blueswir1
  ;;
917 84778508 blueswir1
  --enable-bsd-user) bsd_user="yes"
918 84778508 blueswir1
  ;;
919 379f6698 Paul Brook
  --enable-guest-base) guest_base="yes"
920 379f6698 Paul Brook
  ;;
921 379f6698 Paul Brook
  --disable-guest-base) guest_base="no"
922 379f6698 Paul Brook
  ;;
923 40d6444e Avi Kivity
  --enable-pie) pie="yes"
924 34005a00 Kirill A. Shutemov
  ;;
925 40d6444e Avi Kivity
  --disable-pie) pie="no"
926 34005a00 Kirill A. Shutemov
  ;;
927 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
928 c5937220 pbrook
  ;;
929 85aa5189 bellard
  --enable-werror) werror="yes"
930 85aa5189 bellard
  ;;
931 85aa5189 bellard
  --disable-werror) werror="no"
932 85aa5189 bellard
  ;;
933 4d3b6f6e balrog
  --disable-curses) curses="no"
934 4d3b6f6e balrog
  ;;
935 c584a6d0 Juan Quintela
  --enable-curses) curses="yes"
936 c584a6d0 Juan Quintela
  ;;
937 769ce76d Alexander Graf
  --disable-curl) curl="no"
938 769ce76d Alexander Graf
  ;;
939 788c8196 Juan Quintela
  --enable-curl) curl="yes"
940 788c8196 Juan Quintela
  ;;
941 2df87df7 Juan Quintela
  --disable-fdt) fdt="no"
942 2df87df7 Juan Quintela
  ;;
943 2df87df7 Juan Quintela
  --enable-fdt) fdt="yes"
944 2df87df7 Juan Quintela
  ;;
945 5c6c3a6c Christoph Hellwig
  --disable-linux-aio) linux_aio="no"
946 5c6c3a6c Christoph Hellwig
  ;;
947 5c6c3a6c Christoph Hellwig
  --enable-linux-aio) linux_aio="yes"
948 5c6c3a6c Christoph Hellwig
  ;;
949 758e8e38 Venkateswararao Jujjuri (JV)
  --disable-attr) attr="no"
950 758e8e38 Venkateswararao Jujjuri (JV)
  ;;
951 758e8e38 Venkateswararao Jujjuri (JV)
  --enable-attr) attr="yes"
952 758e8e38 Venkateswararao Jujjuri (JV)
  ;;
953 77755340 ths
  --disable-blobs) blobs="no"
954 77755340 ths
  ;;
955 4a19f1ec pbrook
  --with-pkgversion=*) pkgversion=" ($optarg)"
956 4a19f1ec pbrook
  ;;
957 519175a2 Alex Barcelo
  --with-coroutine=*) coroutine="$optarg"
958 519175a2 Alex Barcelo
  ;;
959 70c60c08 Stefan Hajnoczi
  --disable-coroutine-pool) coroutine_pool="no"
960 70c60c08 Stefan Hajnoczi
  ;;
961 70c60c08 Stefan Hajnoczi
  --enable-coroutine-pool) coroutine_pool="yes"
962 70c60c08 Stefan Hajnoczi
  ;;
963 a25dba17 Juan Quintela
  --disable-docs) docs="no"
964 70ec5dc0 Anthony Liguori
  ;;
965 a25dba17 Juan Quintela
  --enable-docs) docs="yes"
966 83a3ab8b Juan Quintela
  ;;
967 d5970055 Michael S. Tsirkin
  --disable-vhost-net) vhost_net="no"
968 d5970055 Michael S. Tsirkin
  ;;
969 d5970055 Michael S. Tsirkin
  --enable-vhost-net) vhost_net="yes"
970 d5970055 Michael S. Tsirkin
  ;;
971 5e9be92d Nicholas Bellinger
  --disable-vhost-scsi) vhost_scsi="no"
972 5e9be92d Nicholas Bellinger
  ;;
973 5e9be92d Nicholas Bellinger
  --enable-vhost-scsi) vhost_scsi="yes"
974 5e9be92d Nicholas Bellinger
  ;;
975 b1e5fff4 Michael Walle
  --disable-glx) glx="no"
976 20ff075b Michael Walle
  ;;
977 b1e5fff4 Michael Walle
  --enable-glx) glx="yes"
978 20ff075b Michael Walle
  ;;
979 f27aaf4b Christian Brunner
  --disable-rbd) rbd="no"
980 f27aaf4b Christian Brunner
  ;;
981 f27aaf4b Christian Brunner
  --enable-rbd) rbd="yes"
982 f27aaf4b Christian Brunner
  ;;
983 8c84cf11 Sergei Trofimovich
  --disable-xfsctl) xfs="no"
984 8c84cf11 Sergei Trofimovich
  ;;
985 8c84cf11 Sergei Trofimovich
  --enable-xfsctl) xfs="yes"
986 8c84cf11 Sergei Trofimovich
  ;;
987 111a38b0 Robert Relyea
  --disable-smartcard-nss) smartcard_nss="no"
988 111a38b0 Robert Relyea
  ;;
989 111a38b0 Robert Relyea
  --enable-smartcard-nss) smartcard_nss="yes"
990 111a38b0 Robert Relyea
  ;;
991 2b2325ff Gerd Hoffmann
  --disable-libusb) libusb="no"
992 2b2325ff Gerd Hoffmann
  ;;
993 2b2325ff Gerd Hoffmann
  --enable-libusb) libusb="yes"
994 2b2325ff Gerd Hoffmann
  ;;
995 69354a83 Hans de Goede
  --disable-usb-redir) usb_redir="no"
996 69354a83 Hans de Goede
  ;;
997 69354a83 Hans de Goede
  --enable-usb-redir) usb_redir="yes"
998 69354a83 Hans de Goede
  ;;
999 1ece9905 Alon Levy
  --disable-zlib-test) zlib="no"
1000 1ece9905 Alon Levy
  ;;
1001 607dacd0 qiaonuohan
  --enable-lzo) lzo="yes"
1002 607dacd0 qiaonuohan
  ;;
1003 607dacd0 qiaonuohan
  --enable-snappy) snappy="yes"
1004 607dacd0 qiaonuohan
  ;;
1005 d138cee9 Michael Roth
  --enable-guest-agent) guest_agent="yes"
1006 d138cee9 Michael Roth
  ;;
1007 d138cee9 Michael Roth
  --disable-guest-agent) guest_agent="no"
1008 d138cee9 Michael Roth
  ;;
1009 d9840e25 Tomoki Sekiyama
  --with-vss-sdk) vss_win32_sdk=""
1010 d9840e25 Tomoki Sekiyama
  ;;
1011 d9840e25 Tomoki Sekiyama
  --with-vss-sdk=*) vss_win32_sdk="$optarg"
1012 d9840e25 Tomoki Sekiyama
  ;;
1013 d9840e25 Tomoki Sekiyama
  --without-vss-sdk) vss_win32_sdk="no"
1014 d9840e25 Tomoki Sekiyama
  ;;
1015 d9840e25 Tomoki Sekiyama
  --with-win-sdk) win_sdk=""
1016 d9840e25 Tomoki Sekiyama
  ;;
1017 d9840e25 Tomoki Sekiyama
  --with-win-sdk=*) win_sdk="$optarg"
1018 d9840e25 Tomoki Sekiyama
  ;;
1019 d9840e25 Tomoki Sekiyama
  --without-win-sdk) win_sdk="no"
1020 d9840e25 Tomoki Sekiyama
  ;;
1021 4b1c11fd Daniel P. Berrange
  --enable-tools) want_tools="yes"
1022 4b1c11fd Daniel P. Berrange
  ;;
1023 4b1c11fd Daniel P. Berrange
  --disable-tools) want_tools="no"
1024 4b1c11fd Daniel P. Berrange
  ;;
1025 f794573e Eduardo Otubo
  --enable-seccomp) seccomp="yes"
1026 f794573e Eduardo Otubo
  ;;
1027 f794573e Eduardo Otubo
  --disable-seccomp) seccomp="no"
1028 f794573e Eduardo Otubo
  ;;
1029 eb100396 Bharata B Rao
  --disable-glusterfs) glusterfs="no"
1030 eb100396 Bharata B Rao
  ;;
1031 eb100396 Bharata B Rao
  --enable-glusterfs) glusterfs="yes"
1032 eb100396 Bharata B Rao
  ;;
1033 d0277315 Chrysostomos Nanakos
  --disable-archipelago) archipelago="no"
1034 d0277315 Chrysostomos Nanakos
  ;;
1035 d0277315 Chrysostomos Nanakos
  --enable-archipelago) archipelago="yes"
1036 d0277315 Chrysostomos Nanakos
  ;;
1037 583f6e7b Stefan Hajnoczi
  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
1038 583f6e7b Stefan Hajnoczi
  ;;
1039 583f6e7b Stefan Hajnoczi
  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
1040 583f6e7b Stefan Hajnoczi
  ;;
1041 a4ccabcf Anthony Liguori
  --disable-gtk) gtk="no"
1042 a4ccabcf Anthony Liguori
  ;;
1043 a4ccabcf Anthony Liguori
  --enable-gtk) gtk="yes"
1044 a4ccabcf Anthony Liguori
  ;;
1045 2da776db Michael R. Hines
  --enable-rdma) rdma="yes"
1046 2da776db Michael R. Hines
  ;;
1047 2da776db Michael R. Hines
  --disable-rdma) rdma="no"
1048 2da776db Michael R. Hines
  ;;
1049 528de90a Daniel P. Berrange
  --with-gtkabi=*) gtkabi="$optarg"
1050 528de90a Daniel P. Berrange
  ;;
1051 ab214c29 Stefan Berger
  --enable-tpm) tpm="yes"
1052 ab214c29 Stefan Berger
  ;;
1053 0a12ec87 Richard W.M. Jones
  --disable-libssh2) libssh2="no"
1054 0a12ec87 Richard W.M. Jones
  ;;
1055 0a12ec87 Richard W.M. Jones
  --enable-libssh2) libssh2="yes"
1056 0a12ec87 Richard W.M. Jones
  ;;
1057 4f18b782 Jeff Cody
  --enable-vhdx) vhdx="yes"
1058 4f18b782 Jeff Cody
  ;;
1059 4f18b782 Jeff Cody
  --disable-vhdx) vhdx="no"
1060 4f18b782 Jeff Cody
  ;;
1061 95c6bff3 Benoît Canet
  --disable-quorum) quorum="no"
1062 95c6bff3 Benoît Canet
  ;;
1063 95c6bff3 Benoît Canet
  --enable-quorum) quorum="yes"
1064 95c6bff3 Benoît Canet
  ;;
1065 7f1559c6 balrog
  *) echo "ERROR: unknown option $opt"; show_help="yes"
1066 7f1559c6 balrog
  ;;
1067 7d13299d bellard
  esac
1068 7d13299d bellard
done
1069 7d13299d bellard
1070 f6f0b7d9 Stefan Weil
if ! has $python; then
1071 f6f0b7d9 Stefan Weil
  error_exit "Python not found. Use --python=/path/to/python"
1072 f6f0b7d9 Stefan Weil
fi
1073 f6f0b7d9 Stefan Weil
1074 f6f0b7d9 Stefan Weil
# Note that if the Python conditional here evaluates True we will exit
1075 f6f0b7d9 Stefan Weil
# with status 1 which is a shell 'false' value.
1076 f6f0b7d9 Stefan Weil
if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1077 f6f0b7d9 Stefan Weil
  error_exit "Cannot use '$python', Python 2.4 or later is required." \
1078 f6f0b7d9 Stefan Weil
      "Note that Python 3 or later is not yet supported." \
1079 f6f0b7d9 Stefan Weil
      "Use --python=/path/to/python to specify a supported Python."
1080 f6f0b7d9 Stefan Weil
fi
1081 f6f0b7d9 Stefan Weil
1082 f6f0b7d9 Stefan Weil
# The -B switch was added in Python 2.6.
1083 f6f0b7d9 Stefan Weil
# If it is supplied, compiled files are not written.
1084 f6f0b7d9 Stefan Weil
# Use it for Python versions which support it.
1085 f6f0b7d9 Stefan Weil
if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1086 f6f0b7d9 Stefan Weil
  python="$python -B"
1087 f6f0b7d9 Stefan Weil
fi
1088 f6f0b7d9 Stefan Weil
1089 40293e58 bellard
case "$cpu" in
1090 e3608d66 Richard Henderson
    ppc)
1091 e3608d66 Richard Henderson
           CPU_CFLAGS="-m32"
1092 e3608d66 Richard Henderson
           LDFLAGS="-m32 $LDFLAGS"
1093 e3608d66 Richard Henderson
           ;;
1094 e3608d66 Richard Henderson
    ppc64)
1095 e3608d66 Richard Henderson
           CPU_CFLAGS="-m64"
1096 e3608d66 Richard Henderson
           LDFLAGS="-m64 $LDFLAGS"
1097 e3608d66 Richard Henderson
           ;;
1098 9b9c37c3 Richard Henderson
    sparc)
1099 ed968ff1 Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
1100 79f3b12f Peter Crosthwaite
           CPU_CFLAGS="-m32 -mcpu=ultrasparc"
1101 3142255c blueswir1
           ;;
1102 ed968ff1 Juan Quintela
    sparc64)
1103 ed968ff1 Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
1104 79f3b12f Peter Crosthwaite
           CPU_CFLAGS="-m64 -mcpu=ultrasparc"
1105 3142255c blueswir1
           ;;
1106 76d83bde ths
    s390)
1107 79f3b12f Peter Crosthwaite
           CPU_CFLAGS="-m31 -march=z990"
1108 28d7cc49 Richard Henderson
           LDFLAGS="-m31 $LDFLAGS"
1109 28d7cc49 Richard Henderson
           ;;
1110 28d7cc49 Richard Henderson
    s390x)
1111 79f3b12f Peter Crosthwaite
           CPU_CFLAGS="-m64 -march=z990"
1112 28d7cc49 Richard Henderson
           LDFLAGS="-m64 $LDFLAGS"
1113 76d83bde ths
           ;;
1114 40293e58 bellard
    i386)
1115 79f3b12f Peter Crosthwaite
           CPU_CFLAGS="-m32"
1116 0c439cbf Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
1117 2b2e59e6 Paolo Bonzini
           cc_i386='$(CC) -m32'
1118 40293e58 bellard
           ;;
1119 40293e58 bellard
    x86_64)
1120 79f3b12f Peter Crosthwaite
           CPU_CFLAGS="-m64"
1121 0c439cbf Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
1122 2b2e59e6 Paolo Bonzini
           cc_i386='$(CC) -m32'
1123 d2fbca94 Guan Xuetao
           ;;
1124 c72b26ec Richard Henderson
    x32)
1125 c72b26ec Richard Henderson
           CPU_CFLAGS="-mx32"
1126 c72b26ec Richard Henderson
           LDFLAGS="-mx32 $LDFLAGS"
1127 c72b26ec Richard Henderson
           cc_i386='$(CC) -m32'
1128 c72b26ec Richard Henderson
           ;;
1129 30163d89 Peter Maydell
    # No special flags required for other host CPUs
1130 3142255c blueswir1
esac
1131 3142255c blueswir1
1132 79f3b12f Peter Crosthwaite
QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1133 79f3b12f Peter Crosthwaite
EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1134 79f3b12f Peter Crosthwaite
1135 60e0df25 Peter Maydell
default_target_list=""
1136 60e0df25 Peter Maydell
1137 6e92f823 Peter Maydell
mak_wilds=""
1138 6e92f823 Peter Maydell
1139 6e92f823 Peter Maydell
if [ "$softmmu" = "yes" ]; then
1140 6e92f823 Peter Maydell
    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
1141 60e0df25 Peter Maydell
fi
1142 6e92f823 Peter Maydell
if [ "$linux_user" = "yes" ]; then
1143 6e92f823 Peter Maydell
    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
1144 60e0df25 Peter Maydell
fi
1145 6e92f823 Peter Maydell
if [ "$bsd_user" = "yes" ]; then
1146 6e92f823 Peter Maydell
    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
1147 60e0df25 Peter Maydell
fi
1148 60e0df25 Peter Maydell
1149 6e92f823 Peter Maydell
for config in $mak_wilds; do
1150 6e92f823 Peter Maydell
    default_target_list="${default_target_list} $(basename "$config" .mak)"
1151 6e92f823 Peter Maydell
done
1152 6e92f823 Peter Maydell
1153 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
1154 af5db58e pbrook
cat << EOF
1155 af5db58e pbrook
1156 af5db58e pbrook
Usage: configure [options]
1157 af5db58e pbrook
Options: [defaults in brackets after descriptions]
1158 af5db58e pbrook
1159 08fb77ed Stefan Weil
Standard options:
1160 08fb77ed Stefan Weil
  --help                   print this message
1161 08fb77ed Stefan Weil
  --prefix=PREFIX          install in PREFIX [$prefix]
1162 08fb77ed Stefan Weil
  --interp-prefix=PREFIX   where to find shared libraries, etc.
1163 08fb77ed Stefan Weil
                           use %M for cpu name [$interp_prefix]
1164 08fb77ed Stefan Weil
  --target-list=LIST       set target list (default: build everything)
1165 08fb77ed Stefan Weil
$(echo Available targets: $default_target_list | \
1166 08fb77ed Stefan Weil
  fold -s -w 53 | sed -e 's/^/                           /')
1167 08fb77ed Stefan Weil
1168 08fb77ed Stefan Weil
Advanced options (experts only):
1169 08fb77ed Stefan Weil
  --source-path=PATH       path of source code [$source_path]
1170 08fb77ed Stefan Weil
  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
1171 08fb77ed Stefan Weil
  --cc=CC                  use C compiler CC [$cc]
1172 08fb77ed Stefan Weil
  --iasl=IASL              use ACPI compiler IASL [$iasl]
1173 08fb77ed Stefan Weil
  --host-cc=CC             use C compiler CC [$host_cc] for code run at
1174 08fb77ed Stefan Weil
                           build time
1175 08fb77ed Stefan Weil
  --cxx=CXX                use C++ compiler CXX [$cxx]
1176 08fb77ed Stefan Weil
  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
1177 08fb77ed Stefan Weil
  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS
1178 08fb77ed Stefan Weil
  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
1179 08fb77ed Stefan Weil
  --make=MAKE              use specified make [$make]
1180 08fb77ed Stefan Weil
  --install=INSTALL        use specified install [$install]
1181 08fb77ed Stefan Weil
  --python=PYTHON          use specified python [$python]
1182 08fb77ed Stefan Weil
  --smbd=SMBD              use specified smbd [$smbd]
1183 08fb77ed Stefan Weil
  --static                 enable static build [$static]
1184 08fb77ed Stefan Weil
  --mandir=PATH            install man pages in PATH
1185 08fb77ed Stefan Weil
  --datadir=PATH           install firmware in PATH$confsuffix
1186 08fb77ed Stefan Weil
  --docdir=PATH            install documentation in PATH$confsuffix
1187 08fb77ed Stefan Weil
  --bindir=PATH            install binaries in PATH
1188 08fb77ed Stefan Weil
  --libdir=PATH            install libraries in PATH
1189 08fb77ed Stefan Weil
  --sysconfdir=PATH        install config in PATH$confsuffix
1190 08fb77ed Stefan Weil
  --localstatedir=PATH     install local state in PATH (set at runtime on win32)
1191 e26110cf Fam Zheng
  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
1192 17969268 Fam Zheng
  --enable-modules         enable modules support
1193 08fb77ed Stefan Weil
  --enable-debug-tcg       enable TCG debugging
1194 08fb77ed Stefan Weil
  --disable-debug-tcg      disable TCG debugging (default)
1195 08fb77ed Stefan Weil
  --enable-debug-info       enable debugging information (default)
1196 08fb77ed Stefan Weil
  --disable-debug-info      disable debugging information
1197 08fb77ed Stefan Weil
  --enable-debug           enable common debug build options
1198 08fb77ed Stefan Weil
  --enable-sparse          enable sparse checker
1199 08fb77ed Stefan Weil
  --disable-sparse         disable sparse checker (default)
1200 08fb77ed Stefan Weil
  --disable-strip          disable stripping binaries
1201 08fb77ed Stefan Weil
  --disable-werror         disable compilation abort on warning
1202 08fb77ed Stefan Weil
  --disable-sdl            disable SDL
1203 08fb77ed Stefan Weil
  --enable-sdl             enable SDL
1204 08fb77ed Stefan Weil
  --disable-gtk            disable gtk UI
1205 08fb77ed Stefan Weil
  --enable-gtk             enable gtk UI
1206 08fb77ed Stefan Weil
  --disable-virtfs         disable VirtFS
1207 08fb77ed Stefan Weil
  --enable-virtfs          enable VirtFS
1208 08fb77ed Stefan Weil
  --disable-vnc            disable VNC
1209 08fb77ed Stefan Weil
  --enable-vnc             enable VNC
1210 08fb77ed Stefan Weil
  --disable-cocoa          disable Cocoa (Mac OS X only)
1211 08fb77ed Stefan Weil
  --enable-cocoa           enable Cocoa (default on Mac OS X)
1212 08fb77ed Stefan Weil
  --audio-drv-list=LIST    set audio drivers list:
1213 08fb77ed Stefan Weil
                           Available drivers: $audio_possible_drivers
1214 08fb77ed Stefan Weil
  --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L
1215 08fb77ed Stefan Weil
  --block-drv-rw-whitelist=L
1216 08fb77ed Stefan Weil
                           set block driver read-write whitelist
1217 08fb77ed Stefan Weil
                           (affects only QEMU, not qemu-img)
1218 08fb77ed Stefan Weil
  --block-drv-ro-whitelist=L
1219 08fb77ed Stefan Weil
                           set block driver read-only whitelist
1220 08fb77ed Stefan Weil
                           (affects only QEMU, not qemu-img)
1221 08fb77ed Stefan Weil
  --disable-xen            disable xen backend driver support
1222 08fb77ed Stefan Weil
  --enable-xen             enable xen backend driver support
1223 08fb77ed Stefan Weil
  --disable-xen-pci-passthrough
1224 08fb77ed Stefan Weil
  --enable-xen-pci-passthrough
1225 08fb77ed Stefan Weil
  --disable-brlapi         disable BrlAPI
1226 08fb77ed Stefan Weil
  --enable-brlapi          enable BrlAPI
1227 08fb77ed Stefan Weil
  --disable-vnc-tls        disable TLS encryption for VNC server
1228 08fb77ed Stefan Weil
  --enable-vnc-tls         enable TLS encryption for VNC server
1229 08fb77ed Stefan Weil
  --disable-vnc-sasl       disable SASL encryption for VNC server
1230 08fb77ed Stefan Weil
  --enable-vnc-sasl        enable SASL encryption for VNC server
1231 08fb77ed Stefan Weil
  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server
1232 08fb77ed Stefan Weil
  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server
1233 08fb77ed Stefan Weil
  --disable-vnc-png        disable PNG compression for VNC server (default)
1234 08fb77ed Stefan Weil
  --enable-vnc-png         enable PNG compression for VNC server
1235 08fb77ed Stefan Weil
  --disable-vnc-ws         disable Websockets support for VNC server
1236 08fb77ed Stefan Weil
  --enable-vnc-ws          enable Websockets support for VNC server
1237 08fb77ed Stefan Weil
  --disable-curses         disable curses output
1238 08fb77ed Stefan Weil
  --enable-curses          enable curses output
1239 08fb77ed Stefan Weil
  --disable-curl           disable curl connectivity
1240 08fb77ed Stefan Weil
  --enable-curl            enable curl connectivity
1241 08fb77ed Stefan Weil
  --disable-fdt            disable fdt device tree
1242 08fb77ed Stefan Weil
  --enable-fdt             enable fdt device tree
1243 08fb77ed Stefan Weil
  --disable-bluez          disable bluez stack connectivity
1244 08fb77ed Stefan Weil
  --enable-bluez           enable bluez stack connectivity
1245 08fb77ed Stefan Weil
  --disable-slirp          disable SLIRP userspace network connectivity
1246 08fb77ed Stefan Weil
  --disable-kvm            disable KVM acceleration support
1247 08fb77ed Stefan Weil
  --enable-kvm             enable KVM acceleration support
1248 08fb77ed Stefan Weil
  --disable-rdma           disable RDMA-based migration support
1249 08fb77ed Stefan Weil
  --enable-rdma            enable RDMA-based migration support
1250 08fb77ed Stefan Weil
  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1251 08fb77ed Stefan Weil
  --enable-system          enable all system emulation targets
1252 08fb77ed Stefan Weil
  --disable-system         disable all system emulation targets
1253 08fb77ed Stefan Weil
  --enable-user            enable supported user emulation targets
1254 08fb77ed Stefan Weil
  --disable-user           disable all user emulation targets
1255 08fb77ed Stefan Weil
  --enable-linux-user      enable all linux usermode emulation targets
1256 08fb77ed Stefan Weil
  --disable-linux-user     disable all linux usermode emulation targets
1257 08fb77ed Stefan Weil
  --enable-bsd-user        enable all BSD usermode emulation targets
1258 08fb77ed Stefan Weil
  --disable-bsd-user       disable all BSD usermode emulation targets
1259 08fb77ed Stefan Weil
  --enable-guest-base      enable GUEST_BASE support for usermode
1260 08fb77ed Stefan Weil
                           emulation targets
1261 08fb77ed Stefan Weil
  --disable-guest-base     disable GUEST_BASE support
1262 08fb77ed Stefan Weil
  --enable-pie             build Position Independent Executables
1263 08fb77ed Stefan Weil
  --disable-pie            do not build Position Independent Executables
1264 08fb77ed Stefan Weil
  --fmod-lib               path to FMOD library
1265 08fb77ed Stefan Weil
  --fmod-inc               path to FMOD includes
1266 08fb77ed Stefan Weil
  --oss-lib                path to OSS library
1267 08fb77ed Stefan Weil
  --enable-uname-release=R Return R for uname -r in usermode emulation
1268 08fb77ed Stefan Weil
  --cpu=CPU                Build for host CPU [$cpu]
1269 08fb77ed Stefan Weil
  --disable-uuid           disable uuid support
1270 08fb77ed Stefan Weil
  --enable-uuid            enable uuid support
1271 08fb77ed Stefan Weil
  --disable-vde            disable support for vde network
1272 08fb77ed Stefan Weil
  --enable-vde             enable support for vde network
1273 08fb77ed Stefan Weil
  --disable-netmap         disable support for netmap network
1274 08fb77ed Stefan Weil
  --enable-netmap          enable support for netmap network
1275 08fb77ed Stefan Weil
  --disable-linux-aio      disable Linux AIO support
1276 08fb77ed Stefan Weil
  --enable-linux-aio       enable Linux AIO support
1277 08fb77ed Stefan Weil
  --disable-cap-ng         disable libcap-ng support
1278 08fb77ed Stefan Weil
  --enable-cap-ng          enable libcap-ng support
1279 08fb77ed Stefan Weil
  --disable-attr           disables attr and xattr support
1280 08fb77ed Stefan Weil
  --enable-attr            enable attr and xattr support
1281 08fb77ed Stefan Weil
  --disable-blobs          disable installing provided firmware blobs
1282 08fb77ed Stefan Weil
  --enable-docs            enable documentation build
1283 08fb77ed Stefan Weil
  --disable-docs           disable documentation build
1284 08fb77ed Stefan Weil
  --disable-vhost-net      disable vhost-net acceleration support
1285 08fb77ed Stefan Weil
  --enable-vhost-net       enable vhost-net acceleration support
1286 08fb77ed Stefan Weil
  --enable-trace-backend=B Set trace backend
1287 08fb77ed Stefan Weil
                           Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1288 08fb77ed Stefan Weil
  --with-trace-file=NAME   Full PATH,NAME of file to store traces
1289 08fb77ed Stefan Weil
                           Default:trace-<pid>
1290 08fb77ed Stefan Weil
  --disable-spice          disable spice
1291 08fb77ed Stefan Weil
  --enable-spice           enable spice
1292 08fb77ed Stefan Weil
  --enable-rbd             enable building the rados block device (rbd)
1293 08fb77ed Stefan Weil
  --disable-libiscsi       disable iscsi support
1294 08fb77ed Stefan Weil
  --enable-libiscsi        enable iscsi support
1295 6542aa9c Peter Lieven
  --disable-libnfs         disable nfs support
1296 6542aa9c Peter Lieven
  --enable-libnfs          enable nfs support
1297 08fb77ed Stefan Weil
  --disable-smartcard-nss  disable smartcard nss support
1298 08fb77ed Stefan Weil
  --enable-smartcard-nss   enable smartcard nss support
1299 08fb77ed Stefan Weil
  --disable-libusb         disable libusb (for usb passthrough)
1300 08fb77ed Stefan Weil
  --enable-libusb          enable libusb (for usb passthrough)
1301 08fb77ed Stefan Weil
  --disable-usb-redir      disable usb network redirection support
1302 08fb77ed Stefan Weil
  --enable-usb-redir       enable usb network redirection support
1303 607dacd0 qiaonuohan
  --enable-lzo             enable the support of lzo compression library
1304 607dacd0 qiaonuohan
  --enable-snappy          enable the support of snappy compression library
1305 08fb77ed Stefan Weil
  --disable-guest-agent    disable building of the QEMU Guest Agent
1306 08fb77ed Stefan Weil
  --enable-guest-agent     enable building of the QEMU Guest Agent
1307 08fb77ed Stefan Weil
  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
1308 08fb77ed Stefan Weil
  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)
1309 08fb77ed Stefan Weil
  --disable-seccomp        disable seccomp support
1310 08fb77ed Stefan Weil
  --enable-seccomp         enables seccomp support
1311 08fb77ed Stefan Weil
  --with-coroutine=BACKEND coroutine backend. Supported options:
1312 08fb77ed Stefan Weil
                           gthread, ucontext, sigaltstack, windows
1313 08fb77ed Stefan Weil
  --disable-coroutine-pool disable coroutine freelist (worse performance)
1314 08fb77ed Stefan Weil
  --enable-coroutine-pool  enable coroutine freelist (better performance)
1315 08fb77ed Stefan Weil
  --enable-glusterfs       enable GlusterFS backend
1316 08fb77ed Stefan Weil
  --disable-glusterfs      disable GlusterFS backend
1317 d0277315 Chrysostomos Nanakos
  --enable-archipelago     enable Archipelago backend
1318 d0277315 Chrysostomos Nanakos
  --disable-archipelago    disable Archipelago backend
1319 08fb77ed Stefan Weil
  --enable-gcov            enable test coverage analysis with gcov
1320 08fb77ed Stefan Weil
  --gcov=GCOV              use specified gcov [$gcov_tool]
1321 08fb77ed Stefan Weil
  --enable-tpm             enable TPM support
1322 08fb77ed Stefan Weil
  --disable-libssh2        disable ssh block device support
1323 08fb77ed Stefan Weil
  --enable-libssh2         enable ssh block device support
1324 08fb77ed Stefan Weil
  --disable-vhdx           disables support for the Microsoft VHDX image format
1325 08fb77ed Stefan Weil
  --enable-vhdx            enable support for the Microsoft VHDX image format
1326 95c6bff3 Benoît Canet
  --disable-quorum         disable quorum block filter support
1327 95c6bff3 Benoît Canet
  --enable-quorum          enable quorum block filter support
1328 08fb77ed Stefan Weil
1329 08fb77ed Stefan Weil
NOTE: The object files are built at the place where configure is launched
1330 af5db58e pbrook
EOF
1331 af5db58e pbrook
exit 1
1332 af5db58e pbrook
fi
1333 af5db58e pbrook
1334 359bc95d Peter Maydell
# Now we have handled --enable-tcg-interpreter and know we're not just
1335 359bc95d Peter Maydell
# printing the help message, bail out if the host CPU isn't supported.
1336 359bc95d Peter Maydell
if test "$ARCH" = "unknown"; then
1337 359bc95d Peter Maydell
    if test "$tcg_interpreter" = "yes" ; then
1338 359bc95d Peter Maydell
        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1339 359bc95d Peter Maydell
        ARCH=tci
1340 359bc95d Peter Maydell
    else
1341 76ad07a4 Peter Maydell
        error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1342 359bc95d Peter Maydell
    fi
1343 359bc95d Peter Maydell
fi
1344 359bc95d Peter Maydell
1345 8d05095c Paolo Bonzini
# check that the C compiler works.
1346 8d05095c Paolo Bonzini
cat > $TMPC <<EOF
1347 75cafad7 Stefan Weil
int main(void) { return 0; }
1348 8d05095c Paolo Bonzini
EOF
1349 8d05095c Paolo Bonzini
1350 8d05095c Paolo Bonzini
if compile_object ; then
1351 8d05095c Paolo Bonzini
  : C compiler works ok
1352 8d05095c Paolo Bonzini
else
1353 76ad07a4 Peter Maydell
    error_exit "\"$cc\" either does not exist or does not work"
1354 8d05095c Paolo Bonzini
fi
1355 8d05095c Paolo Bonzini
1356 98b21dcd Peter Maydell
# Check that the C++ compiler exists and works with the C compiler
1357 98b21dcd Peter Maydell
if has $cxx; then
1358 98b21dcd Peter Maydell
    cat > $TMPC <<EOF
1359 98b21dcd Peter Maydell
int c_function(void);
1360 98b21dcd Peter Maydell
int main(void) { return c_function(); }
1361 98b21dcd Peter Maydell
EOF
1362 98b21dcd Peter Maydell
1363 98b21dcd Peter Maydell
    compile_object
1364 98b21dcd Peter Maydell
1365 98b21dcd Peter Maydell
    cat > $TMPC <<EOF
1366 98b21dcd Peter Maydell
extern "C" {
1367 98b21dcd Peter Maydell
   int c_function(void);
1368 98b21dcd Peter Maydell
}
1369 98b21dcd Peter Maydell
int c_function(void) { return 42; }
1370 98b21dcd Peter Maydell
EOF
1371 98b21dcd Peter Maydell
1372 98b21dcd Peter Maydell
    if (cc=$cxx do_cc $QEMU_CFLAGS -o $TMPE $TMPC $TMPO $LDFLAGS); then
1373 98b21dcd Peter Maydell
        # C++ compiler $cxx works ok with C compiler $cc
1374 98b21dcd Peter Maydell
        :
1375 98b21dcd Peter Maydell
    else
1376 98b21dcd Peter Maydell
        echo "C++ compiler $cxx does not work with C compiler $cc"
1377 98b21dcd Peter Maydell
        echo "Disabling C++ specific optional code"
1378 98b21dcd Peter Maydell
        cxx=
1379 98b21dcd Peter Maydell
    fi
1380 98b21dcd Peter Maydell
else
1381 98b21dcd Peter Maydell
    echo "No C++ compiler available; disabling C++ specific optional code"
1382 98b21dcd Peter Maydell
    cxx=
1383 98b21dcd Peter Maydell
fi
1384 98b21dcd Peter Maydell
1385 417c9d72 Alexander Graf
# Consult white-list to determine whether to enable werror
1386 417c9d72 Alexander Graf
# by default.  Only enable by default for git builds
1387 417c9d72 Alexander Graf
z_version=`cut -f3 -d. $source_path/VERSION`
1388 417c9d72 Alexander Graf
1389 417c9d72 Alexander Graf
if test -z "$werror" ; then
1390 6c8fec83 Andreas Färber
    if test -d "$source_path/.git" -a \
1391 417c9d72 Alexander Graf
        "$linux" = "yes" ; then
1392 417c9d72 Alexander Graf
        werror="yes"
1393 417c9d72 Alexander Graf
    else
1394 417c9d72 Alexander Graf
        werror="no"
1395 417c9d72 Alexander Graf
    fi
1396 417c9d72 Alexander Graf
fi
1397 417c9d72 Alexander Graf
1398 8d05095c Paolo Bonzini
gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1399 8d05095c Paolo Bonzini
gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1400 8d05095c Paolo Bonzini
gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1401 37746c5e Marc-André Lureau
gcc_flags="-Wendif-labels $gcc_flags"
1402 c1556a81 Peter Maydell
gcc_flags="-Wno-initializer-overrides $gcc_flags"
1403 71429097 Peter Maydell
gcc_flags="-Wno-string-plus-int $gcc_flags"
1404 6ca026cb Peter Maydell
# Note that we do not add -Werror to gcc_flags here, because that would
1405 6ca026cb Peter Maydell
# enable it for all configure tests. If a configure test failed due
1406 6ca026cb Peter Maydell
# to -Werror this would just silently disable some features,
1407 6ca026cb Peter Maydell
# so it's too error prone.
1408 8d05095c Paolo Bonzini
cat > $TMPC << EOF
1409 8d05095c Paolo Bonzini
int main(void) { return 0; }
1410 8d05095c Paolo Bonzini
EOF
1411 8d05095c Paolo Bonzini
for flag in $gcc_flags; do
1412 a1d29d6c Peter Maydell
    # Use the positive sense of the flag when testing for -Wno-wombat
1413 a1d29d6c Peter Maydell
    # support (gcc will happily accept the -Wno- form of unknown
1414 a1d29d6c Peter Maydell
    # warning options).
1415 a1d29d6c Peter Maydell
    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1416 a1d29d6c Peter Maydell
    if compile_prog "-Werror $optflag" "" ; then
1417 8d05095c Paolo Bonzini
	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1418 8d05095c Paolo Bonzini
    fi
1419 8d05095c Paolo Bonzini
done
1420 8d05095c Paolo Bonzini
1421 37746c5e Marc-André Lureau
if compile_prog "-Werror -fstack-protector-all" "" ; then
1422 37746c5e Marc-André Lureau
    QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
1423 37746c5e Marc-André Lureau
    LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
1424 37746c5e Marc-André Lureau
fi
1425 37746c5e Marc-André Lureau
1426 cbdd1999 Paolo Bonzini
# Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1427 cbdd1999 Paolo Bonzini
# large functions that use global variables.  The bug is in all releases of
1428 cbdd1999 Paolo Bonzini
# GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1429 cbdd1999 Paolo Bonzini
# 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1430 cbdd1999 Paolo Bonzini
cat > $TMPC << EOF
1431 cbdd1999 Paolo Bonzini
#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1432 cbdd1999 Paolo Bonzini
int main(void) { return 0; }
1433 cbdd1999 Paolo Bonzini
#else
1434 cbdd1999 Paolo Bonzini
#error No bug in this compiler.
1435 cbdd1999 Paolo Bonzini
#endif
1436 cbdd1999 Paolo Bonzini
EOF
1437 cbdd1999 Paolo Bonzini
if compile_prog "-Werror -fno-gcse" "" ; then
1438 cbdd1999 Paolo Bonzini
  TRANSLATE_OPT_CFLAGS=-fno-gcse
1439 cbdd1999 Paolo Bonzini
fi
1440 cbdd1999 Paolo Bonzini
1441 40d6444e Avi Kivity
if test "$static" = "yes" ; then
1442 aa0d1f44 Paolo Bonzini
  if test "$modules" = "yes" ; then
1443 aa0d1f44 Paolo Bonzini
    error_exit "static and modules are mutually incompatible"
1444 aa0d1f44 Paolo Bonzini
  fi
1445 40d6444e Avi Kivity
  if test "$pie" = "yes" ; then
1446 76ad07a4 Peter Maydell
    error_exit "static and pie are mutually incompatible"
1447 40d6444e Avi Kivity
  else
1448 40d6444e Avi Kivity
    pie="no"
1449 40d6444e Avi Kivity
  fi
1450 40d6444e Avi Kivity
fi
1451 40d6444e Avi Kivity
1452 40d6444e Avi Kivity
if test "$pie" = ""; then
1453 40d6444e Avi Kivity
  case "$cpu-$targetos" in
1454 c72b26ec Richard Henderson
    i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
1455 40d6444e Avi Kivity
      ;;
1456 40d6444e Avi Kivity
    *)
1457 40d6444e Avi Kivity
      pie="no"
1458 40d6444e Avi Kivity
      ;;
1459 40d6444e Avi Kivity
  esac
1460 40d6444e Avi Kivity
fi
1461 40d6444e Avi Kivity
1462 40d6444e Avi Kivity
if test "$pie" != "no" ; then
1463 40d6444e Avi Kivity
  cat > $TMPC << EOF
1464 21d4a791 Avi Kivity
1465 21d4a791 Avi Kivity
#ifdef __linux__
1466 21d4a791 Avi Kivity
#  define THREAD __thread
1467 21d4a791 Avi Kivity
#else
1468 21d4a791 Avi Kivity
#  define THREAD
1469 21d4a791 Avi Kivity
#endif
1470 21d4a791 Avi Kivity
1471 21d4a791 Avi Kivity
static THREAD int tls_var;
1472 21d4a791 Avi Kivity
1473 21d4a791 Avi Kivity
int main(void) { return tls_var; }
1474 21d4a791 Avi Kivity
1475 40d6444e Avi Kivity
EOF
1476 40d6444e Avi Kivity
  if compile_prog "-fPIE -DPIE" "-pie"; then
1477 40d6444e Avi Kivity
    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1478 40d6444e Avi Kivity
    LDFLAGS="-pie $LDFLAGS"
1479 40d6444e Avi Kivity
    pie="yes"
1480 40d6444e Avi Kivity
    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1481 40d6444e Avi Kivity
      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1482 40d6444e Avi Kivity
    fi
1483 40d6444e Avi Kivity
  else
1484 40d6444e Avi Kivity
    if test "$pie" = "yes"; then
1485 76ad07a4 Peter Maydell
      error_exit "PIE not available due to missing toolchain support"
1486 40d6444e Avi Kivity
    else
1487 40d6444e Avi Kivity
      echo "Disabling PIE due to missing toolchain support"
1488 40d6444e Avi Kivity
      pie="no"
1489 40d6444e Avi Kivity
    fi
1490 40d6444e Avi Kivity
  fi
1491 46eef33b Brad
1492 46eef33b Brad
  if compile_prog "-fno-pie" "-nopie"; then
1493 46eef33b Brad
    CFLAGS_NOPIE="-fno-pie"
1494 46eef33b Brad
    LDFLAGS_NOPIE="-nopie"
1495 46eef33b Brad
  fi
1496 40d6444e Avi Kivity
fi
1497 40d6444e Avi Kivity
1498 66518bf6 Don Slutz
# check for broken gcc and libtool in RHEL5
1499 66518bf6 Don Slutz
if test -n "$libtool" -a "$pie" != "no" ; then
1500 66518bf6 Don Slutz
  cat > $TMPC <<EOF
1501 66518bf6 Don Slutz
1502 66518bf6 Don Slutz
void *f(unsigned char *buf, int len);
1503 66518bf6 Don Slutz
void *g(unsigned char *buf, int len);
1504 66518bf6 Don Slutz
1505 66518bf6 Don Slutz
void *
1506 66518bf6 Don Slutz
f(unsigned char *buf, int len)
1507 66518bf6 Don Slutz
{
1508 66518bf6 Don Slutz
    return (void*)0L;
1509 66518bf6 Don Slutz
}
1510 66518bf6 Don Slutz
1511 66518bf6 Don Slutz
void *
1512 66518bf6 Don Slutz
g(unsigned char *buf, int len)
1513 66518bf6 Don Slutz
{
1514 66518bf6 Don Slutz
    return f(buf, len);
1515 66518bf6 Don Slutz
}
1516 66518bf6 Don Slutz
1517 66518bf6 Don Slutz
EOF
1518 66518bf6 Don Slutz
  if ! libtool_prog; then
1519 66518bf6 Don Slutz
    echo "Disabling libtool due to broken toolchain support"
1520 66518bf6 Don Slutz
    libtool=
1521 66518bf6 Don Slutz
  fi
1522 66518bf6 Don Slutz
fi
1523 66518bf6 Don Slutz
1524 09dada40 Paolo Bonzini
##########################################
1525 09dada40 Paolo Bonzini
# __sync_fetch_and_and requires at least -march=i486. Many toolchains
1526 09dada40 Paolo Bonzini
# use i686 as default anyway, but for those that don't, an explicit
1527 09dada40 Paolo Bonzini
# specification is necessary
1528 09dada40 Paolo Bonzini
1529 09dada40 Paolo Bonzini
if test "$cpu" = "i386"; then
1530 09dada40 Paolo Bonzini
  cat > $TMPC << EOF
1531 09dada40 Paolo Bonzini
static int sfaa(int *ptr)
1532 09dada40 Paolo Bonzini
{
1533 09dada40 Paolo Bonzini
  return __sync_fetch_and_and(ptr, 0);
1534 09dada40 Paolo Bonzini
}
1535 09dada40 Paolo Bonzini
1536 09dada40 Paolo Bonzini
int main(void)
1537 09dada40 Paolo Bonzini
{
1538 09dada40 Paolo Bonzini
  int val = 42;
1539 1405b629 Stefan Weil
  val = __sync_val_compare_and_swap(&val, 0, 1);
1540 09dada40 Paolo Bonzini
  sfaa(&val);
1541 09dada40 Paolo Bonzini
  return val;
1542 09dada40 Paolo Bonzini
}
1543 09dada40 Paolo Bonzini
EOF
1544 09dada40 Paolo Bonzini
  if ! compile_prog "" "" ; then
1545 09dada40 Paolo Bonzini
    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1546 09dada40 Paolo Bonzini
  fi
1547 09dada40 Paolo Bonzini
fi
1548 09dada40 Paolo Bonzini
1549 09dada40 Paolo Bonzini
#########################################
1550 ec530c81 bellard
# Solaris specific configure tool chain decisions
1551 09dada40 Paolo Bonzini
1552 ec530c81 bellard
if test "$solaris" = "yes" ; then
1553 6792aa11 Loïc Minier
  if has $install; then
1554 6792aa11 Loïc Minier
    :
1555 6792aa11 Loïc Minier
  else
1556 76ad07a4 Peter Maydell
    error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1557 76ad07a4 Peter Maydell
        "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1558 76ad07a4 Peter Maydell
        "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1559 ec530c81 bellard
  fi
1560 6792aa11 Loïc Minier
  if test "`path_of $install`" = "/usr/sbin/install" ; then
1561 76ad07a4 Peter Maydell
    error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1562 76ad07a4 Peter Maydell
        "try ginstall from the GNU fileutils available from www.blastwave.org" \
1563 76ad07a4 Peter Maydell
        "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1564 ec530c81 bellard
  fi
1565 6792aa11 Loïc Minier
  if has ar; then
1566 6792aa11 Loïc Minier
    :
1567 6792aa11 Loïc Minier
  else
1568 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
1569 76ad07a4 Peter Maydell
      error_exit "No path includes ar" \
1570 76ad07a4 Peter Maydell
          "Add /usr/ccs/bin to your path and rerun configure"
1571 ec530c81 bellard
    fi
1572 76ad07a4 Peter Maydell
    error_exit "No path includes ar"
1573 ec530c81 bellard
  fi
1574 5fafdf24 ths
fi
1575 ec530c81 bellard
1576 afb63ebd Stefan Weil
if test -z "${target_list+xxx}" ; then
1577 121afa9e Anthony Liguori
    target_list="$default_target_list"
1578 121afa9e Anthony Liguori
else
1579 121afa9e Anthony Liguori
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
1580 121afa9e Anthony Liguori
fi
1581 25b48338 Peter Maydell
1582 25b48338 Peter Maydell
# Check that we recognised the target name; this allows a more
1583 25b48338 Peter Maydell
# friendly error message than if we let it fall through.
1584 25b48338 Peter Maydell
for target in $target_list; do
1585 25b48338 Peter Maydell
    case " $default_target_list " in
1586 25b48338 Peter Maydell
        *" $target "*)
1587 25b48338 Peter Maydell
            ;;
1588 25b48338 Peter Maydell
        *)
1589 25b48338 Peter Maydell
            error_exit "Unknown target name '$target'"
1590 25b48338 Peter Maydell
            ;;
1591 25b48338 Peter Maydell
    esac
1592 25b48338 Peter Maydell
done
1593 25b48338 Peter Maydell
1594 f55fe278 Paolo Bonzini
# see if system emulation was really requested
1595 f55fe278 Paolo Bonzini
case " $target_list " in
1596 f55fe278 Paolo Bonzini
  *"-softmmu "*) softmmu=yes
1597 f55fe278 Paolo Bonzini
  ;;
1598 f55fe278 Paolo Bonzini
  *) softmmu=no
1599 f55fe278 Paolo Bonzini
  ;;
1600 f55fe278 Paolo Bonzini
esac
1601 5327cf48 bellard
1602 249247c9 Juan Quintela
feature_not_found() {
1603 249247c9 Juan Quintela
  feature=$1
1604 21684af0 Stewart Smith
  remedy=$2
1605 249247c9 Juan Quintela
1606 76ad07a4 Peter Maydell
  error_exit "User requested feature $feature" \
1607 21684af0 Stewart Smith
      "configure was not able to find it." \
1608 21684af0 Stewart Smith
      "$remedy"
1609 249247c9 Juan Quintela
}
1610 249247c9 Juan Quintela
1611 7d13299d bellard
# ---
1612 7d13299d bellard
# big/little endian test
1613 7d13299d bellard
cat > $TMPC << EOF
1614 61cc919f Mike Frysinger
short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1615 61cc919f Mike Frysinger
short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1616 61cc919f Mike Frysinger
extern int foo(short *, short *);
1617 61cc919f Mike Frysinger
int main(int argc, char *argv[]) {
1618 61cc919f Mike Frysinger
    return foo(big_endian, little_endian);
1619 7d13299d bellard
}
1620 7d13299d bellard
EOF
1621 7d13299d bellard
1622 61cc919f Mike Frysinger
if compile_object ; then
1623 61cc919f Mike Frysinger
    if grep -q BiGeNdIaN $TMPO ; then
1624 61cc919f Mike Frysinger
        bigendian="yes"
1625 61cc919f Mike Frysinger
    elif grep -q LiTtLeEnDiAn $TMPO ; then
1626 61cc919f Mike Frysinger
        bigendian="no"
1627 61cc919f Mike Frysinger
    else
1628 61cc919f Mike Frysinger
        echo big/little test failed
1629 21d89f84 Peter Maydell
    fi
1630 61cc919f Mike Frysinger
else
1631 61cc919f Mike Frysinger
    echo big/little test failed
1632 7d13299d bellard
fi
1633 7d13299d bellard
1634 b0a47e79 Juan Quintela
##########################################
1635 779ab5e3 Stefan Weil
# pkg-config probe
1636 779ab5e3 Stefan Weil
1637 779ab5e3 Stefan Weil
if ! has "$pkg_config_exe"; then
1638 76ad07a4 Peter Maydell
  error_exit "pkg-config binary '$pkg_config_exe' not found"
1639 779ab5e3 Stefan Weil
fi
1640 779ab5e3 Stefan Weil
1641 779ab5e3 Stefan Weil
##########################################
1642 b0a47e79 Juan Quintela
# NPTL probe
1643 b0a47e79 Juan Quintela
1644 24cb36a6 Peter Maydell
if test "$linux_user" = "yes"; then
1645 b0a47e79 Juan Quintela
  cat > $TMPC <<EOF
1646 bd0c5661 pbrook
#include <sched.h>
1647 30813cea pbrook
#include <linux/futex.h>
1648 182eacc0 Stefan Weil
int main(void) {
1649 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1650 bd0c5661 pbrook
#error bork
1651 bd0c5661 pbrook
#endif
1652 182eacc0 Stefan Weil
  return 0;
1653 bd0c5661 pbrook
}
1654 bd0c5661 pbrook
EOF
1655 24cb36a6 Peter Maydell
  if ! compile_object ; then
1656 21684af0 Stewart Smith
    feature_not_found "nptl" "Install glibc and linux kernel headers."
1657 b0a47e79 Juan Quintela
  fi
1658 bd0c5661 pbrook
fi
1659 bd0c5661 pbrook
1660 11d9f695 bellard
##########################################
1661 ac62922e balrog
# zlib check
1662 ac62922e balrog
1663 1ece9905 Alon Levy
if test "$zlib" != "no" ; then
1664 1ece9905 Alon Levy
    cat > $TMPC << EOF
1665 ac62922e balrog
#include <zlib.h>
1666 ac62922e balrog
int main(void) { zlibVersion(); return 0; }
1667 ac62922e balrog
EOF
1668 1ece9905 Alon Levy
    if compile_prog "" "-lz" ; then
1669 1ece9905 Alon Levy
        :
1670 1ece9905 Alon Levy
    else
1671 76ad07a4 Peter Maydell
        error_exit "zlib check failed" \
1672 76ad07a4 Peter Maydell
            "Make sure to have the zlib libs and headers installed."
1673 1ece9905 Alon Levy
    fi
1674 ac62922e balrog
fi
1675 eb0ecd5a Will Newton
LIBS="$LIBS -lz"
1676 ac62922e balrog
1677 ac62922e balrog
##########################################
1678 607dacd0 qiaonuohan
# lzo check
1679 607dacd0 qiaonuohan
1680 607dacd0 qiaonuohan
if test "$lzo" != "no" ; then
1681 607dacd0 qiaonuohan
    cat > $TMPC << EOF
1682 607dacd0 qiaonuohan
#include <lzo/lzo1x.h>
1683 607dacd0 qiaonuohan
int main(void) { lzo_version(); return 0; }
1684 607dacd0 qiaonuohan
EOF
1685 607dacd0 qiaonuohan
    if compile_prog "" "-llzo2" ; then
1686 607dacd0 qiaonuohan
        :
1687 607dacd0 qiaonuohan
    else
1688 607dacd0 qiaonuohan
        error_exit "lzo check failed" \
1689 607dacd0 qiaonuohan
            "Make sure to have the lzo libs and headers installed."
1690 607dacd0 qiaonuohan
    fi
1691 607dacd0 qiaonuohan
1692 607dacd0 qiaonuohan
    libs_softmmu="$libs_softmmu -llzo2"
1693 607dacd0 qiaonuohan
fi
1694 607dacd0 qiaonuohan
1695 607dacd0 qiaonuohan
##########################################
1696 607dacd0 qiaonuohan
# snappy check
1697 607dacd0 qiaonuohan
1698 607dacd0 qiaonuohan
if test "$snappy" != "no" ; then
1699 607dacd0 qiaonuohan
    cat > $TMPC << EOF
1700 607dacd0 qiaonuohan
#include <snappy-c.h>
1701 607dacd0 qiaonuohan
int main(void) { snappy_max_compressed_length(4096); return 0; }
1702 607dacd0 qiaonuohan
EOF
1703 607dacd0 qiaonuohan
    if compile_prog "" "-lsnappy" ; then
1704 607dacd0 qiaonuohan
        :
1705 607dacd0 qiaonuohan
    else
1706 607dacd0 qiaonuohan
        error_exit "snappy check failed" \
1707 607dacd0 qiaonuohan
            "Make sure to have the snappy libs and headers installed."
1708 607dacd0 qiaonuohan
    fi
1709 607dacd0 qiaonuohan
1710 607dacd0 qiaonuohan
    libs_softmmu="$libs_softmmu -lsnappy"
1711 607dacd0 qiaonuohan
fi
1712 607dacd0 qiaonuohan
1713 607dacd0 qiaonuohan
##########################################
1714 f794573e Eduardo Otubo
# libseccomp check
1715 f794573e Eduardo Otubo
1716 f794573e Eduardo Otubo
if test "$seccomp" != "no" ; then
1717 65d5d3f9 Stefan Weil
    if $pkg_config --atleast-version=2.1.0 libseccomp; then
1718 b4451996 Michael Tokarev
        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1719 372e47e9 Andreas Färber
        QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1720 f794573e Eduardo Otubo
	seccomp="yes"
1721 f794573e Eduardo Otubo
    else
1722 f794573e Eduardo Otubo
	if test "$seccomp" = "yes"; then
1723 21684af0 Stewart Smith
            feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
1724 f794573e Eduardo Otubo
	fi
1725 e84d5956 Yann E. MORIN
	seccomp="no"
1726 f794573e Eduardo Otubo
    fi
1727 f794573e Eduardo Otubo
fi
1728 f794573e Eduardo Otubo
##########################################
1729 e37630ca aliguori
# xen probe
1730 e37630ca aliguori
1731 fc321b4b Juan Quintela
if test "$xen" != "no" ; then
1732 b2266bee Juan Quintela
  xen_libs="-lxenstore -lxenctrl -lxenguest"
1733 d5b93ddf Anthony PERARD
1734 50ced5b3 Stefan Weil
  # First we test whether Xen headers and libraries are available.
1735 50ced5b3 Stefan Weil
  # If no, we are done and there is no Xen support.
1736 50ced5b3 Stefan Weil
  # If yes, more tests are run to detect the Xen version.
1737 50ced5b3 Stefan Weil
1738 50ced5b3 Stefan Weil
  # Xen (any)
1739 b2266bee Juan Quintela
  cat > $TMPC <<EOF
1740 e37630ca aliguori
#include <xenctrl.h>
1741 50ced5b3 Stefan Weil
int main(void) {
1742 50ced5b3 Stefan Weil
  return 0;
1743 50ced5b3 Stefan Weil
}
1744 50ced5b3 Stefan Weil
EOF
1745 50ced5b3 Stefan Weil
  if ! compile_prog "" "$xen_libs" ; then
1746 50ced5b3 Stefan Weil
    # Xen not found
1747 50ced5b3 Stefan Weil
    if test "$xen" = "yes" ; then
1748 21684af0 Stewart Smith
      feature_not_found "xen" "Install xen devel"
1749 50ced5b3 Stefan Weil
    fi
1750 50ced5b3 Stefan Weil
    xen=no
1751 50ced5b3 Stefan Weil
1752 50ced5b3 Stefan Weil
  # Xen unstable
1753 69deef08 Peter Maydell
  elif
1754 69deef08 Peter Maydell
      cat > $TMPC <<EOF &&
1755 50ced5b3 Stefan Weil
#include <xenctrl.h>
1756 e108a3c1 Anthony PERARD
#include <xenstore.h>
1757 d5b93ddf Anthony PERARD
#include <stdint.h>
1758 d5b93ddf Anthony PERARD
#include <xen/hvm/hvm_info_table.h>
1759 d5b93ddf Anthony PERARD
#if !defined(HVM_MAX_VCPUS)
1760 d5b93ddf Anthony PERARD
# error HVM_MAX_VCPUS not defined
1761 d5b93ddf Anthony PERARD
#endif
1762 d5b93ddf Anthony PERARD
int main(void) {
1763 d5b93ddf Anthony PERARD
  xc_interface *xc;
1764 d5b93ddf Anthony PERARD
  xs_daemon_open();
1765 d5b93ddf Anthony PERARD
  xc = xc_interface_open(0, 0, 0);
1766 d5b93ddf Anthony PERARD
  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1767 d5b93ddf Anthony PERARD
  xc_gnttab_open(NULL, 0);
1768 b87de24e Anthony PERARD
  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1769 8688e065 Stefano Stabellini
  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1770 8688e065 Stefano Stabellini
  return 0;
1771 8688e065 Stefano Stabellini
}
1772 8688e065 Stefano Stabellini
EOF
1773 8688e065 Stefano Stabellini
      compile_prog "" "$xen_libs"
1774 69deef08 Peter Maydell
    then
1775 8688e065 Stefano Stabellini
    xen_ctrl_version=420
1776 8688e065 Stefano Stabellini
    xen=yes
1777 8688e065 Stefano Stabellini
1778 69deef08 Peter Maydell
  elif
1779 69deef08 Peter Maydell
      cat > $TMPC <<EOF &&
1780 8688e065 Stefano Stabellini
#include <xenctrl.h>
1781 8688e065 Stefano Stabellini
#include <xs.h>
1782 8688e065 Stefano Stabellini
#include <stdint.h>
1783 8688e065 Stefano Stabellini
#include <xen/hvm/hvm_info_table.h>
1784 8688e065 Stefano Stabellini
#if !defined(HVM_MAX_VCPUS)
1785 8688e065 Stefano Stabellini
# error HVM_MAX_VCPUS not defined
1786 8688e065 Stefano Stabellini
#endif
1787 8688e065 Stefano Stabellini
int main(void) {
1788 8688e065 Stefano Stabellini
  xs_daemon_open();
1789 9b4c0b56 Peter Maydell
  xc_interface_open(0, 0, 0);
1790 8688e065 Stefano Stabellini
  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1791 8688e065 Stefano Stabellini
  xc_gnttab_open(NULL, 0);
1792 8688e065 Stefano Stabellini
  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1793 d5b93ddf Anthony PERARD
  return 0;
1794 d5b93ddf Anthony PERARD
}
1795 e37630ca aliguori
EOF
1796 50ced5b3 Stefan Weil
      compile_prog "" "$xen_libs"
1797 69deef08 Peter Maydell
    then
1798 d5b93ddf Anthony PERARD
    xen_ctrl_version=410
1799 fc321b4b Juan Quintela
    xen=yes
1800 d5b93ddf Anthony PERARD
1801 d5b93ddf Anthony PERARD
  # Xen 4.0.0
1802 69deef08 Peter Maydell
  elif
1803 69deef08 Peter Maydell
      cat > $TMPC <<EOF &&
1804 d5b93ddf Anthony PERARD
#include <xenctrl.h>
1805 d5b93ddf Anthony PERARD
#include <xs.h>
1806 d5b93ddf Anthony PERARD
#include <stdint.h>
1807 d5b93ddf Anthony PERARD
#include <xen/hvm/hvm_info_table.h>
1808 d5b93ddf Anthony PERARD
#if !defined(HVM_MAX_VCPUS)
1809 d5b93ddf Anthony PERARD
# error HVM_MAX_VCPUS not defined
1810 d5b93ddf Anthony PERARD
#endif
1811 d5b93ddf Anthony PERARD
int main(void) {
1812 b87de24e Anthony PERARD
  struct xen_add_to_physmap xatp = {
1813 b87de24e Anthony PERARD
    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1814 b87de24e Anthony PERARD
  };
1815 d5b93ddf Anthony PERARD
  xs_daemon_open();
1816 d5b93ddf Anthony PERARD
  xc_interface_open();
1817 d5b93ddf Anthony PERARD
  xc_gnttab_open();
1818 d5b93ddf Anthony PERARD
  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1819 b87de24e Anthony PERARD
  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1820 d5b93ddf Anthony PERARD
  return 0;
1821 d5b93ddf Anthony PERARD
}
1822 d5b93ddf Anthony PERARD
EOF
1823 d5b93ddf Anthony PERARD
      compile_prog "" "$xen_libs"
1824 69deef08 Peter Maydell
    then
1825 d5b93ddf Anthony PERARD
    xen_ctrl_version=400
1826 d5b93ddf Anthony PERARD
    xen=yes
1827 d5b93ddf Anthony PERARD
1828 b87de24e Anthony PERARD
  # Xen 3.4.0
1829 69deef08 Peter Maydell
  elif
1830 69deef08 Peter Maydell
      cat > $TMPC <<EOF &&
1831 b87de24e Anthony PERARD
#include <xenctrl.h>
1832 b87de24e Anthony PERARD
#include <xs.h>
1833 b87de24e Anthony PERARD
int main(void) {
1834 b87de24e Anthony PERARD
  struct xen_add_to_physmap xatp = {
1835 b87de24e Anthony PERARD
    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1836 b87de24e Anthony PERARD
  };
1837 b87de24e Anthony PERARD
  xs_daemon_open();
1838 b87de24e Anthony PERARD
  xc_interface_open();
1839 b87de24e Anthony PERARD
  xc_gnttab_open();
1840 b87de24e Anthony PERARD
  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1841 b87de24e Anthony PERARD
  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1842 b87de24e Anthony PERARD
  return 0;
1843 b87de24e Anthony PERARD
}
1844 b87de24e Anthony PERARD
EOF
1845 b87de24e Anthony PERARD
      compile_prog "" "$xen_libs"
1846 69deef08 Peter Maydell
    then
1847 b87de24e Anthony PERARD
    xen_ctrl_version=340
1848 b87de24e Anthony PERARD
    xen=yes
1849 b87de24e Anthony PERARD
1850 b87de24e Anthony PERARD
  # Xen 3.3.0
1851 69deef08 Peter Maydell
  elif
1852 69deef08 Peter Maydell
      cat > $TMPC <<EOF &&
1853 d5b93ddf Anthony PERARD
#include <xenctrl.h>
1854 d5b93ddf Anthony PERARD
#include <xs.h>
1855 d5b93ddf Anthony PERARD
int main(void) {
1856 d5b93ddf Anthony PERARD
  xs_daemon_open();
1857 d5b93ddf Anthony PERARD
  xc_interface_open();
1858 d5b93ddf Anthony PERARD
  xc_gnttab_open();
1859 d5b93ddf Anthony PERARD
  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1860 d5b93ddf Anthony PERARD
  return 0;
1861 d5b93ddf Anthony PERARD
}
1862 d5b93ddf Anthony PERARD
EOF
1863 d5b93ddf Anthony PERARD
      compile_prog "" "$xen_libs"
1864 69deef08 Peter Maydell
    then
1865 d5b93ddf Anthony PERARD
    xen_ctrl_version=330
1866 d5b93ddf Anthony PERARD
    xen=yes
1867 d5b93ddf Anthony PERARD
1868 50ced5b3 Stefan Weil
  # Xen version unsupported
1869 b2266bee Juan Quintela
  else
1870 fc321b4b Juan Quintela
    if test "$xen" = "yes" ; then
1871 21684af0 Stewart Smith
      feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
1872 fc321b4b Juan Quintela
    fi
1873 fc321b4b Juan Quintela
    xen=no
1874 b2266bee Juan Quintela
  fi
1875 d5b93ddf Anthony PERARD
1876 d5b93ddf Anthony PERARD
  if test "$xen" = yes; then
1877 d5b93ddf Anthony PERARD
    libs_softmmu="$xen_libs $libs_softmmu"
1878 d5b93ddf Anthony PERARD
  fi
1879 e37630ca aliguori
fi
1880 e37630ca aliguori
1881 eb6fda0f Anthony PERARD
if test "$xen_pci_passthrough" != "no"; then
1882 eb6fda0f Anthony PERARD
  if test "$xen" = "yes" && test "$linux" = "yes" &&
1883 eb6fda0f Anthony PERARD
    test "$xen_ctrl_version" -ge 340; then
1884 eb6fda0f Anthony PERARD
    xen_pci_passthrough=yes
1885 eb6fda0f Anthony PERARD
  else
1886 eb6fda0f Anthony PERARD
    if test "$xen_pci_passthrough" = "yes"; then
1887 eb6fda0f Anthony PERARD
      if test "$xen_ctrl_version" -lt 340; then
1888 76ad07a4 Peter Maydell
        error_exit "User requested feature Xen PCI Passthrough" \
1889 76ad07a4 Peter Maydell
            "This feature does not work with Xen 3.3"
1890 eb6fda0f Anthony PERARD
      fi
1891 76ad07a4 Peter Maydell
      error_exit "User requested feature Xen PCI Passthrough" \
1892 76ad07a4 Peter Maydell
          " but this feature requires /sys from Linux"
1893 eb6fda0f Anthony PERARD
    fi
1894 eb6fda0f Anthony PERARD
    xen_pci_passthrough=no
1895 eb6fda0f Anthony PERARD
  fi
1896 eb6fda0f Anthony PERARD
fi
1897 eb6fda0f Anthony PERARD
1898 e37630ca aliguori
##########################################
1899 44dc0ca3 Alon Levy
# libtool probe
1900 44dc0ca3 Alon Levy
1901 3f534581 Brad
if ! has $libtool; then
1902 44dc0ca3 Alon Levy
    libtool=
1903 44dc0ca3 Alon Levy
fi
1904 44dc0ca3 Alon Levy
1905 8e515b12 Peter Maydell
# MacOSX ships with a libtool which isn't the GNU one; weed this
1906 8e515b12 Peter Maydell
# out by checking whether libtool supports the --version switch
1907 8e515b12 Peter Maydell
if test -n "$libtool"; then
1908 8e515b12 Peter Maydell
  if ! "$libtool" --version >/dev/null 2>&1; then
1909 8e515b12 Peter Maydell
    libtool=
1910 8e515b12 Peter Maydell
  fi
1911 8e515b12 Peter Maydell
fi
1912 8e515b12 Peter Maydell
1913 44dc0ca3 Alon Levy
##########################################
1914 dfffc653 Juan Quintela
# Sparse probe
1915 dfffc653 Juan Quintela
if test "$sparse" != "no" ; then
1916 0dba6195 Loïc Minier
  if has cgcc; then
1917 dfffc653 Juan Quintela
    sparse=yes
1918 dfffc653 Juan Quintela
  else
1919 dfffc653 Juan Quintela
    if test "$sparse" = "yes" ; then
1920 21684af0 Stewart Smith
      feature_not_found "sparse" "Install sparse binary"
1921 dfffc653 Juan Quintela
    fi
1922 dfffc653 Juan Quintela
    sparse=no
1923 dfffc653 Juan Quintela
  fi
1924 dfffc653 Juan Quintela
fi
1925 dfffc653 Juan Quintela
1926 dfffc653 Juan Quintela
##########################################
1927 a4ccabcf Anthony Liguori
# GTK probe
1928 a4ccabcf Anthony Liguori
1929 a4ccabcf Anthony Liguori
if test "$gtk" != "no"; then
1930 528de90a Daniel P. Berrange
    gtkpackage="gtk+-$gtkabi"
1931 528de90a Daniel P. Berrange
    if test "$gtkabi" = "3.0" ; then
1932 528de90a Daniel P. Berrange
      gtkversion="3.0.0"
1933 528de90a Daniel P. Berrange
      vtepackage="vte-2.90"
1934 528de90a Daniel P. Berrange
      vteversion="0.32.0"
1935 528de90a Daniel P. Berrange
    else
1936 528de90a Daniel P. Berrange
      gtkversion="2.18.0"
1937 528de90a Daniel P. Berrange
      vtepackage="vte"
1938 528de90a Daniel P. Berrange
      vteversion="0.24.0"
1939 528de90a Daniel P. Berrange
    fi
1940 0d185e63 Peter Maydell
    if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1941 0d185e63 Peter Maydell
        if test "$gtk" = "yes" ; then
1942 21684af0 Stewart Smith
            feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
1943 0d185e63 Peter Maydell
        fi
1944 0d185e63 Peter Maydell
        gtk="no"
1945 0d185e63 Peter Maydell
    elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
1946 0d185e63 Peter Maydell
        if test "$gtk" = "yes" ; then
1947 0d185e63 Peter Maydell
            error_exit "libvte not found (required for gtk support)"
1948 0d185e63 Peter Maydell
        fi
1949 0d185e63 Peter Maydell
        gtk="no"
1950 0d185e63 Peter Maydell
    else
1951 ca871ec8 Stefan Weil
	gtk_cflags=`$pkg_config --cflags $gtkpackage`
1952 ca871ec8 Stefan Weil
	gtk_libs=`$pkg_config --libs $gtkpackage`
1953 ca871ec8 Stefan Weil
	vte_cflags=`$pkg_config --cflags $vtepackage`
1954 ca871ec8 Stefan Weil
	vte_libs=`$pkg_config --libs $vtepackage`
1955 a4ccabcf Anthony Liguori
	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1956 a4ccabcf Anthony Liguori
	gtk="yes"
1957 a4ccabcf Anthony Liguori
    fi
1958 a4ccabcf Anthony Liguori
fi
1959 a4ccabcf Anthony Liguori
1960 a4ccabcf Anthony Liguori
##########################################
1961 11d9f695 bellard
# SDL probe
1962 11d9f695 bellard
1963 3ec87ffe Paolo Bonzini
# Look for sdl configuration program (pkg-config or sdl-config).  Try
1964 3ec87ffe Paolo Bonzini
# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1965 3ec87ffe Paolo Bonzini
if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1966 3ec87ffe Paolo Bonzini
  sdl_config=sdl-config
1967 3ec87ffe Paolo Bonzini
fi
1968 3ec87ffe Paolo Bonzini
1969 65d5d3f9 Stefan Weil
if $pkg_config sdl --exists; then
1970 a8bd70ad Paolo Bonzini
  sdlconfig="$pkg_config sdl"
1971 9316f803 Paolo Bonzini
  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1972 3ec87ffe Paolo Bonzini
elif has ${sdl_config}; then
1973 3ec87ffe Paolo Bonzini
  sdlconfig="$sdl_config"
1974 9316f803 Paolo Bonzini
  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1975 a0dfd8a4 Loïc Minier
else
1976 a0dfd8a4 Loïc Minier
  if test "$sdl" = "yes" ; then
1977 21684af0 Stewart Smith
    feature_not_found "sdl" "Install SDL devel"
1978 a0dfd8a4 Loïc Minier
  fi
1979 a0dfd8a4 Loïc Minier
  sdl=no
1980 9316f803 Paolo Bonzini
fi
1981 29e5bada Scott Wood
if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
1982 3ec87ffe Paolo Bonzini
  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
1983 3ec87ffe Paolo Bonzini
fi
1984 11d9f695 bellard
1985 9316f803 Paolo Bonzini
sdl_too_old=no
1986 c4198157 Juan Quintela
if test "$sdl" != "no" ; then
1987 ac119f9d Juan Quintela
  cat > $TMPC << EOF
1988 11d9f695 bellard
#include <SDL.h>
1989 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
1990 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1991 11d9f695 bellard
EOF
1992 9316f803 Paolo Bonzini
  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1993 74f42e18 TeLeMan
  if test "$static" = "yes" ; then
1994 74f42e18 TeLeMan
    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1995 74f42e18 TeLeMan
  else
1996 74f42e18 TeLeMan
    sdl_libs=`$sdlconfig --libs 2> /dev/null`
1997 74f42e18 TeLeMan
  fi
1998 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1999 ac119f9d Juan Quintela
    if test "$_sdlversion" -lt 121 ; then
2000 ac119f9d Juan Quintela
      sdl_too_old=yes
2001 ac119f9d Juan Quintela
    else
2002 ac119f9d Juan Quintela
      if test "$cocoa" = "no" ; then
2003 ac119f9d Juan Quintela
        sdl=yes
2004 ac119f9d Juan Quintela
      fi
2005 ac119f9d Juan Quintela
    fi
2006 cd01b4a3 aliguori
2007 67c274d3 Paolo Bonzini
    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
2008 ac119f9d Juan Quintela
    if test "$sdl" = "yes" -a "$static" = "yes" ; then
2009 67c274d3 Paolo Bonzini
      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
2010 f8aa6c7b Stefan Weil
         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2011 f8aa6c7b Stefan Weil
         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
2012 ac119f9d Juan Quintela
      fi
2013 52166aa0 Juan Quintela
      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2014 ac119f9d Juan Quintela
	:
2015 ac119f9d Juan Quintela
      else
2016 ac119f9d Juan Quintela
        sdl=no
2017 ac119f9d Juan Quintela
      fi
2018 ac119f9d Juan Quintela
    fi # static link
2019 c4198157 Juan Quintela
  else # sdl not found
2020 c4198157 Juan Quintela
    if test "$sdl" = "yes" ; then
2021 21684af0 Stewart Smith
      feature_not_found "sdl" "Install SDL devel"
2022 c4198157 Juan Quintela
    fi
2023 c4198157 Juan Quintela
    sdl=no
2024 ac119f9d Juan Quintela
  fi # sdl compile test
2025 a68551bc Juan Quintela
fi
2026 11d9f695 bellard
2027 5368a422 aliguori
if test "$sdl" = "yes" ; then
2028 ac119f9d Juan Quintela
  cat > $TMPC <<EOF
2029 5368a422 aliguori
#include <SDL.h>
2030 5368a422 aliguori
#if defined(SDL_VIDEO_DRIVER_X11)
2031 5368a422 aliguori
#include <X11/XKBlib.h>
2032 5368a422 aliguori
#else
2033 5368a422 aliguori
#error No x11 support
2034 5368a422 aliguori
#endif
2035 5368a422 aliguori
int main(void) { return 0; }
2036 5368a422 aliguori
EOF
2037 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
2038 ac119f9d Juan Quintela
    sdl_libs="$sdl_libs -lX11"
2039 ac119f9d Juan Quintela
  fi
2040 0705667e Juan Quintela
  libs_softmmu="$sdl_libs $libs_softmmu"
2041 5368a422 aliguori
fi
2042 5368a422 aliguori
2043 8f28f3fb ths
##########################################
2044 2da776db Michael R. Hines
# RDMA needs OpenFabrics libraries
2045 2da776db Michael R. Hines
if test "$rdma" != "no" ; then
2046 2da776db Michael R. Hines
  cat > $TMPC <<EOF
2047 2da776db Michael R. Hines
#include <rdma/rdma_cma.h>
2048 2da776db Michael R. Hines
int main(void) { return 0; }
2049 2da776db Michael R. Hines
EOF
2050 2da776db Michael R. Hines
  rdma_libs="-lrdmacm -libverbs"
2051 2da776db Michael R. Hines
  if compile_prog "" "$rdma_libs" ; then
2052 2da776db Michael R. Hines
    rdma="yes"
2053 2da776db Michael R. Hines
    libs_softmmu="$libs_softmmu $rdma_libs"
2054 2da776db Michael R. Hines
  else
2055 2da776db Michael R. Hines
    if test "$rdma" = "yes" ; then
2056 2da776db Michael R. Hines
        error_exit \
2057 2da776db Michael R. Hines
            " OpenFabrics librdmacm/libibverbs not present." \
2058 2da776db Michael R. Hines
            " Your options:" \
2059 2da776db Michael R. Hines
            "  (1) Fast: Install infiniband packages from your distro." \
2060 2da776db Michael R. Hines
            "  (2) Cleanest: Install libraries from www.openfabrics.org" \
2061 2da776db Michael R. Hines
            "  (3) Also: Install softiwarp if you don't have RDMA hardware"
2062 2da776db Michael R. Hines
    fi
2063 2da776db Michael R. Hines
    rdma="no"
2064 2da776db Michael R. Hines
  fi
2065 2da776db Michael R. Hines
fi
2066 2da776db Michael R. Hines
2067 2da776db Michael R. Hines
##########################################
2068 7536ee4b Tim Hardeck
# VNC TLS/WS detection
2069 7536ee4b Tim Hardeck
if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
2070 1be10ad2 Juan Quintela
  cat > $TMPC <<EOF
2071 ae6b5e5a aliguori
#include <gnutls/gnutls.h>
2072 ae6b5e5a aliguori
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2073 ae6b5e5a aliguori
EOF
2074 a8bd70ad Paolo Bonzini
  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2075 a8bd70ad Paolo Bonzini
  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2076 1be10ad2 Juan Quintela
  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
2077 7536ee4b Tim Hardeck
    if test "$vnc_tls" != "no" ; then
2078 7536ee4b Tim Hardeck
      vnc_tls=yes
2079 7536ee4b Tim Hardeck
    fi
2080 7536ee4b Tim Hardeck
    if test "$vnc_ws" != "no" ; then
2081 7536ee4b Tim Hardeck
      vnc_ws=yes
2082 7536ee4b Tim Hardeck
    fi
2083 1be10ad2 Juan Quintela
    libs_softmmu="$vnc_tls_libs $libs_softmmu"
2084 ca273d58 Paolo Bonzini
    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
2085 1be10ad2 Juan Quintela
  else
2086 1be10ad2 Juan Quintela
    if test "$vnc_tls" = "yes" ; then
2087 21684af0 Stewart Smith
      feature_not_found "vnc-tls" "Install gnutls devel"
2088 ae6b5e5a aliguori
    fi
2089 7536ee4b Tim Hardeck
    if test "$vnc_ws" = "yes" ; then
2090 21684af0 Stewart Smith
      feature_not_found "vnc-ws" "Install gnutls devel"
2091 7536ee4b Tim Hardeck
    fi
2092 1be10ad2 Juan Quintela
    vnc_tls=no
2093 7536ee4b Tim Hardeck
    vnc_ws=no
2094 1be10ad2 Juan Quintela
  fi
2095 8d5d2d4c ths
fi
2096 8d5d2d4c ths
2097 8d5d2d4c ths
##########################################
2098 95c6bff3 Benoît Canet
# Quorum probe (check for gnutls)
2099 95c6bff3 Benoît Canet
if test "$quorum" != "no" ; then
2100 95c6bff3 Benoît Canet
cat > $TMPC <<EOF
2101 95c6bff3 Benoît Canet
#include <gnutls/gnutls.h>
2102 95c6bff3 Benoît Canet
#include <gnutls/crypto.h>
2103 95c6bff3 Benoît Canet
int main(void) {char data[4096], digest[32];
2104 95c6bff3 Benoît Canet
gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2105 95c6bff3 Benoît Canet
return 0;
2106 95c6bff3 Benoît Canet
}
2107 95c6bff3 Benoît Canet
EOF
2108 95c6bff3 Benoît Canet
quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2109 95c6bff3 Benoît Canet
quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2110 95c6bff3 Benoît Canet
if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2111 95c6bff3 Benoît Canet
  qcow_tls=yes
2112 95c6bff3 Benoît Canet
  libs_softmmu="$quorum_tls_libs $libs_softmmu"
2113 95c6bff3 Benoît Canet
  libs_tools="$quorum_tls_libs $libs_softmmu"
2114 95c6bff3 Benoît Canet
  QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2115 95c6bff3 Benoît Canet
else
2116 95c6bff3 Benoît Canet
  echo "gnutls > 2.10.0 required to compile Quorum"
2117 95c6bff3 Benoît Canet
  exit 1
2118 95c6bff3 Benoît Canet
fi
2119 95c6bff3 Benoît Canet
fi
2120 95c6bff3 Benoît Canet
2121 95c6bff3 Benoît Canet
##########################################
2122 2f9606b3 aliguori
# VNC SASL detection
2123 821601ea Jes Sorensen
if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
2124 ea784e3b Juan Quintela
  cat > $TMPC <<EOF
2125 2f9606b3 aliguori
#include <sasl/sasl.h>
2126 2f9606b3 aliguori
#include <stdio.h>
2127 2f9606b3 aliguori
int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2128 2f9606b3 aliguori
EOF
2129 ea784e3b Juan Quintela
  # Assuming Cyrus-SASL installed in /usr prefix
2130 ea784e3b Juan Quintela
  vnc_sasl_cflags=""
2131 ea784e3b Juan Quintela
  vnc_sasl_libs="-lsasl2"
2132 ea784e3b Juan Quintela
  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2133 ea784e3b Juan Quintela
    vnc_sasl=yes
2134 ea784e3b Juan Quintela
    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
2135 ca273d58 Paolo Bonzini
    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
2136 ea784e3b Juan Quintela
  else
2137 ea784e3b Juan Quintela
    if test "$vnc_sasl" = "yes" ; then
2138 21684af0 Stewart Smith
      feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
2139 2f9606b3 aliguori
    fi
2140 ea784e3b Juan Quintela
    vnc_sasl=no
2141 ea784e3b Juan Quintela
  fi
2142 2f9606b3 aliguori
fi
2143 2f9606b3 aliguori
2144 2f9606b3 aliguori
##########################################
2145 2f6f5c7a Corentin Chary
# VNC JPEG detection
2146 821601ea Jes Sorensen
if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
2147 2f6f5c7a Corentin Chary
cat > $TMPC <<EOF
2148 2f6f5c7a Corentin Chary
#include <stdio.h>
2149 2f6f5c7a Corentin Chary
#include <jpeglib.h>
2150 2f6f5c7a Corentin Chary
int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2151 2f6f5c7a Corentin Chary
EOF
2152 2f6f5c7a Corentin Chary
    vnc_jpeg_cflags=""
2153 2f6f5c7a Corentin Chary
    vnc_jpeg_libs="-ljpeg"
2154 2f6f5c7a Corentin Chary
  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2155 2f6f5c7a Corentin Chary
    vnc_jpeg=yes
2156 2f6f5c7a Corentin Chary
    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
2157 ca273d58 Paolo Bonzini
    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
2158 2f6f5c7a Corentin Chary
  else
2159 2f6f5c7a Corentin Chary
    if test "$vnc_jpeg" = "yes" ; then
2160 21684af0 Stewart Smith
      feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
2161 2f6f5c7a Corentin Chary
    fi
2162 2f6f5c7a Corentin Chary
    vnc_jpeg=no
2163 2f6f5c7a Corentin Chary
  fi
2164 2f6f5c7a Corentin Chary
fi
2165 2f6f5c7a Corentin Chary
2166 2f6f5c7a Corentin Chary
##########################################
2167 efe556ad Corentin Chary
# VNC PNG detection
2168 821601ea Jes Sorensen
if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
2169 efe556ad Corentin Chary
cat > $TMPC <<EOF
2170 efe556ad Corentin Chary
//#include <stdio.h>
2171 efe556ad Corentin Chary
#include <png.h>
2172 832ce9c2 Scott Wood
#include <stddef.h>
2173 efe556ad Corentin Chary
int main(void) {
2174 efe556ad Corentin Chary
    png_structp png_ptr;
2175 efe556ad Corentin Chary
    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
2176 7edc3fed Peter Maydell
    return png_ptr != 0;
2177 efe556ad Corentin Chary
}
2178 efe556ad Corentin Chary
EOF
2179 65d5d3f9 Stefan Weil
  if $pkg_config libpng --exists; then
2180 ca871ec8 Stefan Weil
    vnc_png_cflags=`$pkg_config libpng --cflags`
2181 ca871ec8 Stefan Weil
    vnc_png_libs=`$pkg_config libpng --libs`
2182 9af8025e Brad
  else
2183 efe556ad Corentin Chary
    vnc_png_cflags=""
2184 efe556ad Corentin Chary
    vnc_png_libs="-lpng"
2185 9af8025e Brad
  fi
2186 efe556ad Corentin Chary
  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2187 efe556ad Corentin Chary
    vnc_png=yes
2188 efe556ad Corentin Chary
    libs_softmmu="$vnc_png_libs $libs_softmmu"
2189 9af8025e Brad
    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
2190 efe556ad Corentin Chary
  else
2191 efe556ad Corentin Chary
    if test "$vnc_png" = "yes" ; then
2192 21684af0 Stewart Smith
      feature_not_found "vnc-png" "Install libpng devel"
2193 efe556ad Corentin Chary
    fi
2194 efe556ad Corentin Chary
    vnc_png=no
2195 efe556ad Corentin Chary
  fi
2196 efe556ad Corentin Chary
fi
2197 efe556ad Corentin Chary
2198 efe556ad Corentin Chary
##########################################
2199 76655d6d aliguori
# fnmatch() probe, used for ACL routines
2200 76655d6d aliguori
fnmatch="no"
2201 76655d6d aliguori
cat > $TMPC << EOF
2202 76655d6d aliguori
#include <fnmatch.h>
2203 76655d6d aliguori
int main(void)
2204 76655d6d aliguori
{
2205 76655d6d aliguori
    fnmatch("foo", "foo", 0);
2206 76655d6d aliguori
    return 0;
2207 76655d6d aliguori
}
2208 76655d6d aliguori
EOF
2209 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2210 76655d6d aliguori
   fnmatch="yes"
2211 76655d6d aliguori
fi
2212 76655d6d aliguori
2213 76655d6d aliguori
##########################################
2214 ee682d27 Stefan Weil
# uuid_generate() probe, used for vdi block driver
2215 2d16c8e9 Peter Maydell
# Note that on some systems (notably MacOSX) no extra library
2216 2d16c8e9 Peter Maydell
# need be linked to get the uuid functions.
2217 ee682d27 Stefan Weil
if test "$uuid" != "no" ; then
2218 ee682d27 Stefan Weil
  uuid_libs="-luuid"
2219 ee682d27 Stefan Weil
  cat > $TMPC << EOF
2220 ee682d27 Stefan Weil
#include <uuid/uuid.h>
2221 ee682d27 Stefan Weil
int main(void)
2222 ee682d27 Stefan Weil
{
2223 ee682d27 Stefan Weil
    uuid_t my_uuid;
2224 ee682d27 Stefan Weil
    uuid_generate(my_uuid);
2225 ee682d27 Stefan Weil
    return 0;
2226 ee682d27 Stefan Weil
}
2227 ee682d27 Stefan Weil
EOF
2228 2d16c8e9 Peter Maydell
  if compile_prog "" "" ; then
2229 2d16c8e9 Peter Maydell
    uuid="yes"
2230 2d16c8e9 Peter Maydell
  elif compile_prog "" "$uuid_libs" ; then
2231 ee682d27 Stefan Weil
    uuid="yes"
2232 ee682d27 Stefan Weil
    libs_softmmu="$uuid_libs $libs_softmmu"
2233 ee682d27 Stefan Weil
    libs_tools="$uuid_libs $libs_tools"
2234 ee682d27 Stefan Weil
  else
2235 ee682d27 Stefan Weil
    if test "$uuid" = "yes" ; then
2236 21684af0 Stewart Smith
      feature_not_found "uuid" "Install libuuid devel"
2237 ee682d27 Stefan Weil
    fi
2238 ee682d27 Stefan Weil
    uuid=no
2239 ee682d27 Stefan Weil
  fi
2240 ee682d27 Stefan Weil
fi
2241 ee682d27 Stefan Weil
2242 4f18b782 Jeff Cody
if test "$vhdx" = "yes" ; then
2243 4f18b782 Jeff Cody
    if test "$uuid" = "no" ; then
2244 4f18b782 Jeff Cody
        error_exit "uuid required for VHDX support"
2245 4f18b782 Jeff Cody
    fi
2246 4f18b782 Jeff Cody
elif test "$vhdx" != "no" ; then
2247 4f18b782 Jeff Cody
    if test "$uuid" = "yes" ; then
2248 4f18b782 Jeff Cody
        vhdx=yes
2249 4f18b782 Jeff Cody
    else
2250 4f18b782 Jeff Cody
        vhdx=no
2251 4f18b782 Jeff Cody
    fi
2252 4f18b782 Jeff Cody
fi
2253 4f18b782 Jeff Cody
2254 ee682d27 Stefan Weil
##########################################
2255 dce512de Christoph Hellwig
# xfsctl() probe, used for raw-posix
2256 dce512de Christoph Hellwig
if test "$xfs" != "no" ; then
2257 dce512de Christoph Hellwig
  cat > $TMPC << EOF
2258 ffc41d10 Stefan Weil
#include <stddef.h>  /* NULL */
2259 dce512de Christoph Hellwig
#include <xfs/xfs.h>
2260 dce512de Christoph Hellwig
int main(void)
2261 dce512de Christoph Hellwig
{
2262 dce512de Christoph Hellwig
    xfsctl(NULL, 0, 0, NULL);
2263 dce512de Christoph Hellwig
    return 0;
2264 dce512de Christoph Hellwig
}
2265 dce512de Christoph Hellwig
EOF
2266 dce512de Christoph Hellwig
  if compile_prog "" "" ; then
2267 dce512de Christoph Hellwig
    xfs="yes"
2268 dce512de Christoph Hellwig
  else
2269 dce512de Christoph Hellwig
    if test "$xfs" = "yes" ; then
2270 21684af0 Stewart Smith
      feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
2271 dce512de Christoph Hellwig
    fi
2272 dce512de Christoph Hellwig
    xfs=no
2273 dce512de Christoph Hellwig
  fi
2274 dce512de Christoph Hellwig
fi
2275 dce512de Christoph Hellwig
2276 dce512de Christoph Hellwig
##########################################
2277 8a16d273 ths
# vde libraries probe
2278 dfb278bd Juan Quintela
if test "$vde" != "no" ; then
2279 4baae0ac Juan Quintela
  vde_libs="-lvdeplug"
2280 8a16d273 ths
  cat > $TMPC << EOF
2281 8a16d273 ths
#include <libvdeplug.h>
2282 4a7f0e06 pbrook
int main(void)
2283 4a7f0e06 pbrook
{
2284 4a7f0e06 pbrook
    struct vde_open_args a = {0, 0, 0};
2285 fea08e08 Peter Maydell
    char s[] = "";
2286 fea08e08 Peter Maydell
    vde_open(s, s, &a);
2287 4a7f0e06 pbrook
    return 0;
2288 4a7f0e06 pbrook
}
2289 8a16d273 ths
EOF
2290 52166aa0 Juan Quintela
  if compile_prog "" "$vde_libs" ; then
2291 4baae0ac Juan Quintela
    vde=yes
2292 8e02e54c Juan Quintela
    libs_softmmu="$vde_libs $libs_softmmu"
2293 8e02e54c Juan Quintela
    libs_tools="$vde_libs $libs_tools"
2294 dfb278bd Juan Quintela
  else
2295 dfb278bd Juan Quintela
    if test "$vde" = "yes" ; then
2296 21684af0 Stewart Smith
      feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
2297 dfb278bd Juan Quintela
    fi
2298 dfb278bd Juan Quintela
    vde=no
2299 4baae0ac Juan Quintela
  fi
2300 8a16d273 ths
fi
2301 8a16d273 ths
2302 8a16d273 ths
##########################################
2303 0a985b37 Vincenzo Maffione
# netmap support probe
2304 0a985b37 Vincenzo Maffione
# Apart from looking for netmap headers, we make sure that the host API version
2305 0a985b37 Vincenzo Maffione
# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2306 0a985b37 Vincenzo Maffione
# a minor/major version number. Minor new features will be marked with values up
2307 0a985b37 Vincenzo Maffione
# to 15, and if something happens that requires a change to the backend we will
2308 0a985b37 Vincenzo Maffione
# move above 15, submit the backend fixes and modify this two bounds.
2309 58952137 Vincenzo Maffione
if test "$netmap" != "no" ; then
2310 58952137 Vincenzo Maffione
  cat > $TMPC << EOF
2311 58952137 Vincenzo Maffione
#include <inttypes.h>
2312 58952137 Vincenzo Maffione
#include <net/if.h>
2313 58952137 Vincenzo Maffione
#include <net/netmap.h>
2314 58952137 Vincenzo Maffione
#include <net/netmap_user.h>
2315 0a985b37 Vincenzo Maffione
#if (NETMAP_API < 11) || (NETMAP_API > 15)
2316 0a985b37 Vincenzo Maffione
#error
2317 0a985b37 Vincenzo Maffione
#endif
2318 58952137 Vincenzo Maffione
int main(void) { return 0; }
2319 58952137 Vincenzo Maffione
EOF
2320 58952137 Vincenzo Maffione
  if compile_prog "" "" ; then
2321 58952137 Vincenzo Maffione
    netmap=yes
2322 58952137 Vincenzo Maffione
  else
2323 58952137 Vincenzo Maffione
    if test "$netmap" = "yes" ; then
2324 58952137 Vincenzo Maffione
      feature_not_found "netmap"
2325 58952137 Vincenzo Maffione
    fi
2326 58952137 Vincenzo Maffione
    netmap=no
2327 58952137 Vincenzo Maffione
  fi
2328 58952137 Vincenzo Maffione
fi
2329 58952137 Vincenzo Maffione
2330 58952137 Vincenzo Maffione
##########################################
2331 47e98658 Corey Bryant
# libcap-ng library probe
2332 47e98658 Corey Bryant
if test "$cap_ng" != "no" ; then
2333 47e98658 Corey Bryant
  cap_libs="-lcap-ng"
2334 47e98658 Corey Bryant
  cat > $TMPC << EOF
2335 47e98658 Corey Bryant
#include <cap-ng.h>
2336 47e98658 Corey Bryant
int main(void)
2337 47e98658 Corey Bryant
{
2338 47e98658 Corey Bryant
    capng_capability_to_name(CAPNG_EFFECTIVE);
2339 47e98658 Corey Bryant
    return 0;
2340 47e98658 Corey Bryant
}
2341 47e98658 Corey Bryant
EOF
2342 47e98658 Corey Bryant
  if compile_prog "" "$cap_libs" ; then
2343 47e98658 Corey Bryant
    cap_ng=yes
2344 47e98658 Corey Bryant
    libs_tools="$cap_libs $libs_tools"
2345 47e98658 Corey Bryant
  else
2346 47e98658 Corey Bryant
    if test "$cap_ng" = "yes" ; then
2347 21684af0 Stewart Smith
      feature_not_found "cap_ng" "Install libcap-ng devel"
2348 47e98658 Corey Bryant
    fi
2349 47e98658 Corey Bryant
    cap_ng=no
2350 47e98658 Corey Bryant
  fi
2351 47e98658 Corey Bryant
fi
2352 47e98658 Corey Bryant
2353 47e98658 Corey Bryant
##########################################
2354 c2de5c91 malc
# Sound support libraries probe
2355 8f28f3fb ths
2356 c2de5c91 malc
audio_drv_probe()
2357 c2de5c91 malc
{
2358 c2de5c91 malc
    drv=$1
2359 c2de5c91 malc
    hdr=$2
2360 c2de5c91 malc
    lib=$3
2361 c2de5c91 malc
    exp=$4
2362 c2de5c91 malc
    cfl=$5
2363 c2de5c91 malc
        cat > $TMPC << EOF
2364 c2de5c91 malc
#include <$hdr>
2365 c2de5c91 malc
int main(void) { $exp }
2366 8f28f3fb ths
EOF
2367 52166aa0 Juan Quintela
    if compile_prog "$cfl" "$lib" ; then
2368 c2de5c91 malc
        :
2369 c2de5c91 malc
    else
2370 76ad07a4 Peter Maydell
        error_exit "$drv check failed" \
2371 76ad07a4 Peter Maydell
            "Make sure to have the $drv libs and headers installed."
2372 c2de5c91 malc
    fi
2373 c2de5c91 malc
}
2374 c2de5c91 malc
2375 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2376 c2de5c91 malc
for drv in $audio_drv_list; do
2377 c2de5c91 malc
    case $drv in
2378 c2de5c91 malc
    alsa)
2379 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
2380 e35bcb0c Stefan Weil
        "return snd_pcm_close((snd_pcm_t *)0);"
2381 a4bf6780 Juan Quintela
    libs_softmmu="-lasound $libs_softmmu"
2382 c2de5c91 malc
    ;;
2383 c2de5c91 malc
2384 c2de5c91 malc
    fmod)
2385 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
2386 76ad07a4 Peter Maydell
        error_exit "You must specify path to FMOD library and headers" \
2387 76ad07a4 Peter Maydell
            "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
2388 c2de5c91 malc
    fi
2389 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2390 a4bf6780 Juan Quintela
    libs_softmmu="$fmod_lib $libs_softmmu"
2391 c2de5c91 malc
    ;;
2392 c2de5c91 malc
2393 c2de5c91 malc
    esd)
2394 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2395 a4bf6780 Juan Quintela
    libs_softmmu="-lesd $libs_softmmu"
2396 67f86e8e Juan Quintela
    audio_pt_int="yes"
2397 c2de5c91 malc
    ;;
2398 b8e59f18 malc
2399 b8e59f18 malc
    pa)
2400 a394aed2 Marc-André Lureau
    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2401 a394aed2 Marc-André Lureau
        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2402 a394aed2 Marc-André Lureau
    libs_softmmu="-lpulse $libs_softmmu"
2403 67f86e8e Juan Quintela
    audio_pt_int="yes"
2404 b8e59f18 malc
    ;;
2405 b8e59f18 malc
2406 997e690a Juan Quintela
    coreaudio)
2407 997e690a Juan Quintela
      libs_softmmu="-framework CoreAudio $libs_softmmu"
2408 997e690a Juan Quintela
    ;;
2409 997e690a Juan Quintela
2410 a4bf6780 Juan Quintela
    dsound)
2411 a4bf6780 Juan Quintela
      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2412 d5631638 malc
      audio_win_int="yes"
2413 a4bf6780 Juan Quintela
    ;;
2414 a4bf6780 Juan Quintela
2415 a4bf6780 Juan Quintela
    oss)
2416 a4bf6780 Juan Quintela
      libs_softmmu="$oss_lib $libs_softmmu"
2417 a4bf6780 Juan Quintela
    ;;
2418 a4bf6780 Juan Quintela
2419 a4bf6780 Juan Quintela
    sdl|wav)
2420 2f6a1ab0 blueswir1
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2421 2f6a1ab0 blueswir1
    ;;
2422 2f6a1ab0 blueswir1
2423 d5631638 malc
    winwave)
2424 d5631638 malc
      libs_softmmu="-lwinmm $libs_softmmu"
2425 d5631638 malc
      audio_win_int="yes"
2426 d5631638 malc
    ;;
2427 d5631638 malc
2428 e4c63a6a malc
    *)
2429 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
2430 76ad07a4 Peter Maydell
        error_exit "Unknown driver '$drv' selected" \
2431 76ad07a4 Peter Maydell
            "Possible drivers are: $audio_possible_drivers"
2432 e4c63a6a malc
    }
2433 e4c63a6a malc
    ;;
2434 c2de5c91 malc
    esac
2435 c2de5c91 malc
done
2436 8f28f3fb ths
2437 4d3b6f6e balrog
##########################################
2438 2e4d9fb1 aurel32
# BrlAPI probe
2439 2e4d9fb1 aurel32
2440 4ffcedb6 Juan Quintela
if test "$brlapi" != "no" ; then
2441 eb82284f Juan Quintela
  brlapi_libs="-lbrlapi"
2442 eb82284f Juan Quintela
  cat > $TMPC << EOF
2443 2e4d9fb1 aurel32
#include <brlapi.h>
2444 832ce9c2 Scott Wood
#include <stddef.h>
2445 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2446 2e4d9fb1 aurel32
EOF
2447 52166aa0 Juan Quintela
  if compile_prog "" "$brlapi_libs" ; then
2448 eb82284f Juan Quintela
    brlapi=yes
2449 264606b3 Juan Quintela
    libs_softmmu="$brlapi_libs $libs_softmmu"
2450 4ffcedb6 Juan Quintela
  else
2451 4ffcedb6 Juan Quintela
    if test "$brlapi" = "yes" ; then
2452 21684af0 Stewart Smith
      feature_not_found "brlapi" "Install brlapi devel"
2453 4ffcedb6 Juan Quintela
    fi
2454 4ffcedb6 Juan Quintela
    brlapi=no
2455 eb82284f Juan Quintela
  fi
2456 eb82284f Juan Quintela
fi
2457 2e4d9fb1 aurel32
2458 2e4d9fb1 aurel32
##########################################
2459 4d3b6f6e balrog
# curses probe
2460 a3605bf6 Michael Tokarev
if test "$curses" != "no" ; then
2461 a3605bf6 Michael Tokarev
  if test "$mingw32" = "yes" ; then
2462 e095e2f3 Stefan Weil
    curses_list="-lpdcurses"
2463 a3605bf6 Michael Tokarev
  else
2464 cfeda5f4 Ed Maste
    curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2465 a3605bf6 Michael Tokarev
  fi
2466 c584a6d0 Juan Quintela
  curses_found=no
2467 4d3b6f6e balrog
  cat > $TMPC << EOF
2468 4d3b6f6e balrog
#include <curses.h>
2469 ef9a2524 Stefan Weil
int main(void) {
2470 ef9a2524 Stefan Weil
  const char *s = curses_version();
2471 ef9a2524 Stefan Weil
  resize_term(0, 0);
2472 ef9a2524 Stefan Weil
  return s != 0;
2473 ef9a2524 Stefan Weil
}
2474 4d3b6f6e balrog
EOF
2475 ecbe251f Vadim Evard
  IFS=:
2476 4f78ef9a Juan Quintela
  for curses_lib in $curses_list; do
2477 ecbe251f Vadim Evard
    unset IFS
2478 4f78ef9a Juan Quintela
    if compile_prog "" "$curses_lib" ; then
2479 c584a6d0 Juan Quintela
      curses_found=yes
2480 4f78ef9a Juan Quintela
      libs_softmmu="$curses_lib $libs_softmmu"
2481 4f78ef9a Juan Quintela
      break
2482 4f78ef9a Juan Quintela
    fi
2483 4f78ef9a Juan Quintela
  done
2484 ecbe251f Vadim Evard
  unset IFS
2485 c584a6d0 Juan Quintela
  if test "$curses_found" = "yes" ; then
2486 c584a6d0 Juan Quintela
    curses=yes
2487 c584a6d0 Juan Quintela
  else
2488 c584a6d0 Juan Quintela
    if test "$curses" = "yes" ; then
2489 21684af0 Stewart Smith
      feature_not_found "curses" "Install ncurses devel"
2490 c584a6d0 Juan Quintela
    fi
2491 c584a6d0 Juan Quintela
    curses=no
2492 c584a6d0 Juan Quintela
  fi
2493 4f78ef9a Juan Quintela
fi
2494 4d3b6f6e balrog
2495 414f0dab blueswir1
##########################################
2496 769ce76d Alexander Graf
# curl probe
2497 788c8196 Juan Quintela
if test "$curl" != "no" ; then
2498 65d5d3f9 Stefan Weil
  if $pkg_config libcurl --exists; then
2499 a3605bf6 Michael Tokarev
    curlconfig="$pkg_config libcurl"
2500 a3605bf6 Michael Tokarev
  else
2501 a3605bf6 Michael Tokarev
    curlconfig=curl-config
2502 a3605bf6 Michael Tokarev
  fi
2503 769ce76d Alexander Graf
  cat > $TMPC << EOF
2504 769ce76d Alexander Graf
#include <curl/curl.h>
2505 0b862ced Peter Maydell
int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2506 769ce76d Alexander Graf
EOF
2507 4e2b0658 Paolo Bonzini
  curl_cflags=`$curlconfig --cflags 2>/dev/null`
2508 4e2b0658 Paolo Bonzini
  curl_libs=`$curlconfig --libs 2>/dev/null`
2509 b1d5a277 Juan Quintela
  if compile_prog "$curl_cflags" "$curl_libs" ; then
2510 769ce76d Alexander Graf
    curl=yes
2511 788c8196 Juan Quintela
  else
2512 788c8196 Juan Quintela
    if test "$curl" = "yes" ; then
2513 21684af0 Stewart Smith
      feature_not_found "curl" "Install libcurl devel"
2514 788c8196 Juan Quintela
    fi
2515 788c8196 Juan Quintela
    curl=no
2516 769ce76d Alexander Graf
  fi
2517 769ce76d Alexander Graf
fi # test "$curl"
2518 769ce76d Alexander Graf
2519 769ce76d Alexander Graf
##########################################
2520 fb599c9a balrog
# bluez support probe
2521 a20a6f46 Juan Quintela
if test "$bluez" != "no" ; then
2522 e820e3f4 balrog
  cat > $TMPC << EOF
2523 e820e3f4 balrog
#include <bluetooth/bluetooth.h>
2524 e820e3f4 balrog
int main(void) { return bt_error(0); }
2525 e820e3f4 balrog
EOF
2526 a8bd70ad Paolo Bonzini
  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2527 a8bd70ad Paolo Bonzini
  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
2528 52166aa0 Juan Quintela
  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2529 a20a6f46 Juan Quintela
    bluez=yes
2530 e482d56a Juan Quintela
    libs_softmmu="$bluez_libs $libs_softmmu"
2531 e820e3f4 balrog
  else
2532 a20a6f46 Juan Quintela
    if test "$bluez" = "yes" ; then
2533 21684af0 Stewart Smith
      feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
2534 a20a6f46 Juan Quintela
    fi
2535 e820e3f4 balrog
    bluez="no"
2536 e820e3f4 balrog
  fi
2537 fb599c9a balrog
fi
2538 fb599c9a balrog
2539 fb599c9a balrog
##########################################
2540 e18df141 Anthony Liguori
# glib support probe
2541 a52d28af Paolo Bonzini
2542 a52d28af Paolo Bonzini
if test "$mingw32" = yes; then
2543 a52d28af Paolo Bonzini
    # g_poll is required in order to integrate with the glib main loop.
2544 a52d28af Paolo Bonzini
    glib_req_ver=2.20
2545 a52d28af Paolo Bonzini
else
2546 a52d28af Paolo Bonzini
    glib_req_ver=2.12
2547 a52d28af Paolo Bonzini
fi
2548 aa0d1f44 Paolo Bonzini
glib_modules=gthread-2.0
2549 aa0d1f44 Paolo Bonzini
if test "$modules" = yes; then
2550 aa0d1f44 Paolo Bonzini
    glib_modules="$glib_modules gmodule-2.0"
2551 aa0d1f44 Paolo Bonzini
fi
2552 e26110cf Fam Zheng
2553 aa0d1f44 Paolo Bonzini
for i in $glib_modules; do
2554 e26110cf Fam Zheng
    if $pkg_config --atleast-version=$glib_req_ver $i; then
2555 e26110cf Fam Zheng
        glib_cflags=`$pkg_config --cflags $i`
2556 e26110cf Fam Zheng
        glib_libs=`$pkg_config --libs $i`
2557 e26110cf Fam Zheng
        CFLAGS="$glib_cflags $CFLAGS"
2558 e26110cf Fam Zheng
        LIBS="$glib_libs $LIBS"
2559 e26110cf Fam Zheng
        libs_qga="$glib_libs $libs_qga"
2560 e26110cf Fam Zheng
    else
2561 e26110cf Fam Zheng
        error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2562 e26110cf Fam Zheng
    fi
2563 e26110cf Fam Zheng
done
2564 e26110cf Fam Zheng
2565 e26110cf Fam Zheng
##########################################
2566 e26110cf Fam Zheng
# SHA command probe for modules
2567 e26110cf Fam Zheng
if test "$modules" = yes; then
2568 e26110cf Fam Zheng
    shacmd_probe="sha1sum sha1 shasum"
2569 e26110cf Fam Zheng
    for c in $shacmd_probe; do
2570 e26110cf Fam Zheng
        if which $c &>/dev/null; then
2571 e26110cf Fam Zheng
            shacmd="$c"
2572 e26110cf Fam Zheng
            break
2573 e26110cf Fam Zheng
        fi
2574 e26110cf Fam Zheng
    done
2575 e26110cf Fam Zheng
    if test "$shacmd" = ""; then
2576 e26110cf Fam Zheng
        error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2577 e26110cf Fam Zheng
    fi
2578 e18df141 Anthony Liguori
fi
2579 e18df141 Anthony Liguori
2580 e18df141 Anthony Liguori
##########################################
2581 e2134eb9 Gerd Hoffmann
# pixman support probe
2582 e2134eb9 Gerd Hoffmann
2583 e2134eb9 Gerd Hoffmann
if test "$pixman" = ""; then
2584 74880fe2 Robert Schiele
  if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2585 74880fe2 Robert Schiele
    pixman="none"
2586 74880fe2 Robert Schiele
  elif $pkg_config pixman-1 > /dev/null 2>&1; then
2587 e2134eb9 Gerd Hoffmann
    pixman="system"
2588 e2134eb9 Gerd Hoffmann
  else
2589 e2134eb9 Gerd Hoffmann
    pixman="internal"
2590 e2134eb9 Gerd Hoffmann
  fi
2591 e2134eb9 Gerd Hoffmann
fi
2592 74880fe2 Robert Schiele
if test "$pixman" = "none"; then
2593 74880fe2 Robert Schiele
  if test "$want_tools" != "no" -o "$softmmu" != "no"; then
2594 76ad07a4 Peter Maydell
    error_exit "pixman disabled but system emulation or tools build" \
2595 76ad07a4 Peter Maydell
        "enabled.  You can turn off pixman only if you also" \
2596 76ad07a4 Peter Maydell
        "disable all system emulation targets and the tools" \
2597 76ad07a4 Peter Maydell
        "build with '--disable-tools --disable-system'."
2598 74880fe2 Robert Schiele
  fi
2599 74880fe2 Robert Schiele
  pixman_cflags=
2600 74880fe2 Robert Schiele
  pixman_libs=
2601 74880fe2 Robert Schiele
elif test "$pixman" = "system"; then
2602 ca871ec8 Stefan Weil
  pixman_cflags=`$pkg_config --cflags pixman-1`
2603 ca871ec8 Stefan Weil
  pixman_libs=`$pkg_config --libs pixman-1`
2604 e2134eb9 Gerd Hoffmann
else
2605 e2134eb9 Gerd Hoffmann
  if test ! -d ${source_path}/pixman/pixman; then
2606 76ad07a4 Peter Maydell
    error_exit "pixman not present. Your options:" \
2607 76ad07a4 Peter Maydell
        "  (1) Preferred: Install the pixman devel package (any recent" \
2608 76ad07a4 Peter Maydell
        "      distro should have packages as Xorg needs pixman too)." \
2609 76ad07a4 Peter Maydell
        "  (2) Fetch the pixman submodule, using:" \
2610 76ad07a4 Peter Maydell
        "      git submodule update --init pixman"
2611 e2134eb9 Gerd Hoffmann
  fi
2612 5ca9388a Gerd Hoffmann
  mkdir -p pixman/pixman
2613 5ca9388a Gerd Hoffmann
  pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2614 5ca9388a Gerd Hoffmann
  pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2615 e2134eb9 Gerd Hoffmann
fi
2616 e2134eb9 Gerd Hoffmann
2617 e2134eb9 Gerd Hoffmann
##########################################
2618 17bff52b M. Mohan Kumar
# libcap probe
2619 17bff52b M. Mohan Kumar
2620 17bff52b M. Mohan Kumar
if test "$cap" != "no" ; then
2621 17bff52b M. Mohan Kumar
  cat > $TMPC <<EOF
2622 17bff52b M. Mohan Kumar
#include <stdio.h>
2623 17bff52b M. Mohan Kumar
#include <sys/capability.h>
2624 cc939743 Stefan Weil
int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
2625 17bff52b M. Mohan Kumar
EOF
2626 17bff52b M. Mohan Kumar
  if compile_prog "" "-lcap" ; then
2627 17bff52b M. Mohan Kumar
    cap=yes
2628 17bff52b M. Mohan Kumar
  else
2629 17bff52b M. Mohan Kumar
    cap=no
2630 17bff52b M. Mohan Kumar
  fi
2631 17bff52b M. Mohan Kumar
fi
2632 17bff52b M. Mohan Kumar
2633 17bff52b M. Mohan Kumar
##########################################
2634 e5d355d1 aliguori
# pthread probe
2635 4b29ec41 Brad
PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
2636 3c529d93 aliguori
2637 4dd75c70 Christoph Hellwig
pthread=no
2638 e5d355d1 aliguori
cat > $TMPC << EOF
2639 3c529d93 aliguori
#include <pthread.h>
2640 7a42bbe4 Stefan Weil
static void *f(void *p) { return NULL; }
2641 7a42bbe4 Stefan Weil
int main(void) {
2642 7a42bbe4 Stefan Weil
  pthread_t thread;
2643 7a42bbe4 Stefan Weil
  pthread_create(&thread, 0, f, 0);
2644 7a42bbe4 Stefan Weil
  return 0;
2645 7a42bbe4 Stefan Weil
}
2646 414f0dab blueswir1
EOF
2647 bd00d539 Andreas Färber
if compile_prog "" "" ; then
2648 bd00d539 Andreas Färber
  pthread=yes
2649 bd00d539 Andreas Färber
else
2650 bd00d539 Andreas Färber
  for pthread_lib in $PTHREADLIBS_LIST; do
2651 bd00d539 Andreas Färber
    if compile_prog "" "$pthread_lib" ; then
2652 bd00d539 Andreas Färber
      pthread=yes
2653 e3c56761 Peter Portante
      found=no
2654 e3c56761 Peter Portante
      for lib_entry in $LIBS; do
2655 e3c56761 Peter Portante
        if test "$lib_entry" = "$pthread_lib"; then
2656 e3c56761 Peter Portante
          found=yes
2657 e3c56761 Peter Portante
          break
2658 e3c56761 Peter Portante
        fi
2659 e3c56761 Peter Portante
      done
2660 e3c56761 Peter Portante
      if test "$found" = "no"; then
2661 e3c56761 Peter Portante
        LIBS="$pthread_lib $LIBS"
2662 e3c56761 Peter Portante
      fi
2663 bd00d539 Andreas Färber
      break
2664 bd00d539 Andreas Färber
    fi
2665 bd00d539 Andreas Färber
  done
2666 bd00d539 Andreas Färber
fi
2667 414f0dab blueswir1
2668 4617e593 Anthony Liguori
if test "$mingw32" != yes -a "$pthread" = no; then
2669 76ad07a4 Peter Maydell
  error_exit "pthread check failed" \
2670 76ad07a4 Peter Maydell
      "Make sure to have the pthread libs and headers installed."
2671 e5d355d1 aliguori
fi
2672 e5d355d1 aliguori
2673 bf9298b9 aliguori
##########################################
2674 f27aaf4b Christian Brunner
# rbd probe
2675 f27aaf4b Christian Brunner
if test "$rbd" != "no" ; then
2676 f27aaf4b Christian Brunner
  cat > $TMPC <<EOF
2677 f27aaf4b Christian Brunner
#include <stdio.h>
2678 ad32e9c0 Josh Durgin
#include <rbd/librbd.h>
2679 f27aaf4b Christian Brunner
int main(void) {
2680 ad32e9c0 Josh Durgin
    rados_t cluster;
2681 ad32e9c0 Josh Durgin
    rados_create(&cluster, NULL);
2682 f27aaf4b Christian Brunner
    return 0;
2683 f27aaf4b Christian Brunner
}
2684 f27aaf4b Christian Brunner
EOF
2685 ad32e9c0 Josh Durgin
  rbd_libs="-lrbd -lrados"
2686 ad32e9c0 Josh Durgin
  if compile_prog "" "$rbd_libs" ; then
2687 ad32e9c0 Josh Durgin
    rbd=yes
2688 f27aaf4b Christian Brunner
  else
2689 f27aaf4b Christian Brunner
    if test "$rbd" = "yes" ; then
2690 21684af0 Stewart Smith
      feature_not_found "rados block device" "Install librbd/ceph devel"
2691 f27aaf4b Christian Brunner
    fi
2692 f27aaf4b Christian Brunner
    rbd=no
2693 f27aaf4b Christian Brunner
  fi
2694 f27aaf4b Christian Brunner
fi
2695 f27aaf4b Christian Brunner
2696 f27aaf4b Christian Brunner
##########################################
2697 0a12ec87 Richard W.M. Jones
# libssh2 probe
2698 4fc16838 Richard W.M. Jones
min_libssh2_version=1.2.8
2699 0a12ec87 Richard W.M. Jones
if test "$libssh2" != "no" ; then
2700 65d5d3f9 Stefan Weil
  if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
2701 0a12ec87 Richard W.M. Jones
    libssh2_cflags=`$pkg_config libssh2 --cflags`
2702 0a12ec87 Richard W.M. Jones
    libssh2_libs=`$pkg_config libssh2 --libs`
2703 0a12ec87 Richard W.M. Jones
    libssh2=yes
2704 0a12ec87 Richard W.M. Jones
  else
2705 0a12ec87 Richard W.M. Jones
    if test "$libssh2" = "yes" ; then
2706 4fc16838 Richard W.M. Jones
      error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
2707 0a12ec87 Richard W.M. Jones
    fi
2708 0a12ec87 Richard W.M. Jones
    libssh2=no
2709 0a12ec87 Richard W.M. Jones
  fi
2710 0a12ec87 Richard W.M. Jones
fi
2711 0a12ec87 Richard W.M. Jones
2712 0a12ec87 Richard W.M. Jones
##########################################
2713 9a2d462e Richard W.M. Jones
# libssh2_sftp_fsync probe
2714 9a2d462e Richard W.M. Jones
2715 9a2d462e Richard W.M. Jones
if test "$libssh2" = "yes"; then
2716 9a2d462e Richard W.M. Jones
  cat > $TMPC <<EOF
2717 9a2d462e Richard W.M. Jones
#include <stdio.h>
2718 9a2d462e Richard W.M. Jones
#include <libssh2.h>
2719 9a2d462e Richard W.M. Jones
#include <libssh2_sftp.h>
2720 9a2d462e Richard W.M. Jones
int main(void) {
2721 9a2d462e Richard W.M. Jones
    LIBSSH2_SESSION *session;
2722 9a2d462e Richard W.M. Jones
    LIBSSH2_SFTP *sftp;
2723 9a2d462e Richard W.M. Jones
    LIBSSH2_SFTP_HANDLE *sftp_handle;
2724 9a2d462e Richard W.M. Jones
    session = libssh2_session_init ();
2725 9a2d462e Richard W.M. Jones
    sftp = libssh2_sftp_init (session);
2726 9a2d462e Richard W.M. Jones
    sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2727 9a2d462e Richard W.M. Jones
    libssh2_sftp_fsync (sftp_handle);
2728 9a2d462e Richard W.M. Jones
    return 0;
2729 9a2d462e Richard W.M. Jones
}
2730 9a2d462e Richard W.M. Jones
EOF
2731 9a2d462e Richard W.M. Jones
  # libssh2_cflags/libssh2_libs defined in previous test.
2732 9a2d462e Richard W.M. Jones
  if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2733 9a2d462e Richard W.M. Jones
    QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2734 9a2d462e Richard W.M. Jones
  fi
2735 9a2d462e Richard W.M. Jones
fi
2736 9a2d462e Richard W.M. Jones
2737 9a2d462e Richard W.M. Jones
##########################################
2738 5c6c3a6c Christoph Hellwig
# linux-aio probe
2739 5c6c3a6c Christoph Hellwig
2740 5c6c3a6c Christoph Hellwig
if test "$linux_aio" != "no" ; then
2741 5c6c3a6c Christoph Hellwig
  cat > $TMPC <<EOF
2742 5c6c3a6c Christoph Hellwig
#include <libaio.h>
2743 5c6c3a6c Christoph Hellwig
#include <sys/eventfd.h>
2744 832ce9c2 Scott Wood
#include <stddef.h>
2745 5c6c3a6c Christoph Hellwig
int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2746 5c6c3a6c Christoph Hellwig
EOF
2747 5c6c3a6c Christoph Hellwig
  if compile_prog "" "-laio" ; then
2748 5c6c3a6c Christoph Hellwig
    linux_aio=yes
2749 5c6c3a6c Christoph Hellwig
  else
2750 5c6c3a6c Christoph Hellwig
    if test "$linux_aio" = "yes" ; then
2751 21684af0 Stewart Smith
      feature_not_found "linux AIO" "Install libaio devel"
2752 5c6c3a6c Christoph Hellwig
    fi
2753 3cfcae3c Luiz Capitulino
    linux_aio=no
2754 5c6c3a6c Christoph Hellwig
  fi
2755 5c6c3a6c Christoph Hellwig
fi
2756 5c6c3a6c Christoph Hellwig
2757 5c6c3a6c Christoph Hellwig
##########################################
2758 3b8acc11 Paolo Bonzini
# TPM passthrough is only on x86 Linux
2759 3b8acc11 Paolo Bonzini
2760 3b8acc11 Paolo Bonzini
if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2761 3b8acc11 Paolo Bonzini
  tpm_passthrough=$tpm
2762 3b8acc11 Paolo Bonzini
else
2763 3b8acc11 Paolo Bonzini
  tpm_passthrough=no
2764 3b8acc11 Paolo Bonzini
fi
2765 3b8acc11 Paolo Bonzini
2766 3b8acc11 Paolo Bonzini
##########################################
2767 583f6e7b Stefan Hajnoczi
# adjust virtio-blk-data-plane based on linux-aio
2768 583f6e7b Stefan Hajnoczi
2769 583f6e7b Stefan Hajnoczi
if test "$virtio_blk_data_plane" = "yes" -a \
2770 583f6e7b Stefan Hajnoczi
	"$linux_aio" != "yes" ; then
2771 76ad07a4 Peter Maydell
  error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2772 583f6e7b Stefan Hajnoczi
elif test -z "$virtio_blk_data_plane" ; then
2773 583f6e7b Stefan Hajnoczi
  virtio_blk_data_plane=$linux_aio
2774 583f6e7b Stefan Hajnoczi
fi
2775 583f6e7b Stefan Hajnoczi
2776 583f6e7b Stefan Hajnoczi
##########################################
2777 758e8e38 Venkateswararao Jujjuri (JV)
# attr probe
2778 758e8e38 Venkateswararao Jujjuri (JV)
2779 758e8e38 Venkateswararao Jujjuri (JV)
if test "$attr" != "no" ; then
2780 758e8e38 Venkateswararao Jujjuri (JV)
  cat > $TMPC <<EOF
2781 758e8e38 Venkateswararao Jujjuri (JV)
#include <stdio.h>
2782 758e8e38 Venkateswararao Jujjuri (JV)
#include <sys/types.h>
2783 f2338fb4 Pavel Borzenkov
#ifdef CONFIG_LIBATTR
2784 f2338fb4 Pavel Borzenkov
#include <attr/xattr.h>
2785 f2338fb4 Pavel Borzenkov
#else
2786 4f26f2b6 Avi Kivity
#include <sys/xattr.h>
2787 f2338fb4 Pavel Borzenkov
#endif
2788 758e8e38 Venkateswararao Jujjuri (JV)
int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2789 758e8e38 Venkateswararao Jujjuri (JV)
EOF
2790 4f26f2b6 Avi Kivity
  if compile_prog "" "" ; then
2791 4f26f2b6 Avi Kivity
    attr=yes
2792 4f26f2b6 Avi Kivity
  # Older distros have <attr/xattr.h>, and need -lattr:
2793 f2338fb4 Pavel Borzenkov
  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2794 758e8e38 Venkateswararao Jujjuri (JV)
    attr=yes
2795 758e8e38 Venkateswararao Jujjuri (JV)
    LIBS="-lattr $LIBS"
2796 4f26f2b6 Avi Kivity
    libattr=yes
2797 758e8e38 Venkateswararao Jujjuri (JV)
  else
2798 758e8e38 Venkateswararao Jujjuri (JV)
    if test "$attr" = "yes" ; then
2799 21684af0 Stewart Smith
      feature_not_found "ATTR" "Install libc6 or libattr devel"
2800 758e8e38 Venkateswararao Jujjuri (JV)
    fi
2801 758e8e38 Venkateswararao Jujjuri (JV)
    attr=no
2802 758e8e38 Venkateswararao Jujjuri (JV)
  fi
2803 758e8e38 Venkateswararao Jujjuri (JV)
fi
2804 758e8e38 Venkateswararao Jujjuri (JV)
2805 758e8e38 Venkateswararao Jujjuri (JV)
##########################################
2806 bf9298b9 aliguori
# iovec probe
2807 bf9298b9 aliguori
cat > $TMPC <<EOF
2808 db34f0b3 blueswir1
#include <sys/types.h>
2809 bf9298b9 aliguori
#include <sys/uio.h>
2810 db34f0b3 blueswir1
#include <unistd.h>
2811 f91f9bee Stefan Weil
int main(void) { return sizeof(struct iovec); }
2812 bf9298b9 aliguori
EOF
2813 bf9298b9 aliguori
iovec=no
2814 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2815 bf9298b9 aliguori
  iovec=yes
2816 bf9298b9 aliguori
fi
2817 bf9298b9 aliguori
2818 f652e6af aurel32
##########################################
2819 ceb42de8 aliguori
# preadv probe
2820 ceb42de8 aliguori
cat > $TMPC <<EOF
2821 ceb42de8 aliguori
#include <sys/types.h>
2822 ceb42de8 aliguori
#include <sys/uio.h>
2823 ceb42de8 aliguori
#include <unistd.h>
2824 c075a723 Blue Swirl
int main(void) { return preadv(0, 0, 0, 0); }
2825 ceb42de8 aliguori
EOF
2826 ceb42de8 aliguori
preadv=no
2827 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2828 ceb42de8 aliguori
  preadv=yes
2829 ceb42de8 aliguori
fi
2830 ceb42de8 aliguori
2831 ceb42de8 aliguori
##########################################
2832 f652e6af aurel32
# fdt probe
2833 e169e1e1 Peter Maydell
# fdt support is mandatory for at least some target architectures,
2834 e169e1e1 Peter Maydell
# so insist on it if we're building those system emulators.
2835 e169e1e1 Peter Maydell
fdt_required=no
2836 e169e1e1 Peter Maydell
for target in $target_list; do
2837 e169e1e1 Peter Maydell
  case $target in
2838 6a49fa95 Alexander Graf
    aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
2839 e169e1e1 Peter Maydell
      fdt_required=yes
2840 e169e1e1 Peter Maydell
    ;;
2841 e169e1e1 Peter Maydell
  esac
2842 e169e1e1 Peter Maydell
done
2843 e169e1e1 Peter Maydell
2844 e169e1e1 Peter Maydell
if test "$fdt_required" = "yes"; then
2845 e169e1e1 Peter Maydell
  if test "$fdt" = "no"; then
2846 e169e1e1 Peter Maydell
    error_exit "fdt disabled but some requested targets require it." \
2847 e169e1e1 Peter Maydell
      "You can turn off fdt only if you also disable all the system emulation" \
2848 e169e1e1 Peter Maydell
      "targets which need it (by specifying a cut down --target-list)."
2849 e169e1e1 Peter Maydell
  fi
2850 e169e1e1 Peter Maydell
  fdt=yes
2851 e169e1e1 Peter Maydell
fi
2852 e169e1e1 Peter Maydell
2853 2df87df7 Juan Quintela
if test "$fdt" != "no" ; then
2854 b41af4ba Juan Quintela
  fdt_libs="-lfdt"
2855 96ce6545 Peter Crosthwaite
  # explicitly check for libfdt_env.h as it is missing in some stable installs
2856 b41af4ba Juan Quintela
  cat > $TMPC << EOF
2857 96ce6545 Peter Crosthwaite
#include <libfdt_env.h>
2858 f652e6af aurel32
int main(void) { return 0; }
2859 f652e6af aurel32
EOF
2860 52166aa0 Juan Quintela
  if compile_prog "" "$fdt_libs" ; then
2861 a540f158 Peter Crosthwaite
    # system DTC is good - use it
2862 f652e6af aurel32
    fdt=yes
2863 a540f158 Peter Crosthwaite
  elif test -d ${source_path}/dtc/libfdt ; then
2864 a540f158 Peter Crosthwaite
    # have submodule DTC - use it
2865 a540f158 Peter Crosthwaite
    fdt=yes
2866 a540f158 Peter Crosthwaite
    dtc_internal="yes"
2867 a540f158 Peter Crosthwaite
    mkdir -p dtc
2868 a540f158 Peter Crosthwaite
    if [ "$source_path" != `pwd` ] ; then
2869 a540f158 Peter Crosthwaite
       symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2870 a540f158 Peter Crosthwaite
       symlink "$source_path/dtc/scripts" "dtc/scripts"
2871 2df87df7 Juan Quintela
    fi
2872 a540f158 Peter Crosthwaite
    fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2873 a540f158 Peter Crosthwaite
    fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2874 a540f158 Peter Crosthwaite
  elif test "$fdt" = "yes" ; then
2875 a540f158 Peter Crosthwaite
    # have neither and want - prompt for system/submodule install
2876 3f281822 Stewart Smith
    error_exit "DTC (libfdt) not present. Your options:" \
2877 3f281822 Stewart Smith
        "  (1) Preferred: Install the DTC (libfdt) devel package" \
2878 a540f158 Peter Crosthwaite
        "  (2) Fetch the DTC submodule, using:" \
2879 a540f158 Peter Crosthwaite
        "      git submodule update --init dtc"
2880 a540f158 Peter Crosthwaite
  else
2881 a540f158 Peter Crosthwaite
    # don't have and don't want
2882 de3a354a Michael Walle
    fdt_libs=
2883 2df87df7 Juan Quintela
    fdt=no
2884 f652e6af aurel32
  fi
2885 f652e6af aurel32
fi
2886 f652e6af aurel32
2887 a540f158 Peter Crosthwaite
libs_softmmu="$libs_softmmu $fdt_libs"
2888 a540f158 Peter Crosthwaite
2889 20ff075b Michael Walle
##########################################
2890 b1e5fff4 Michael Walle
# GLX probe, used by milkymist-tmu2
2891 b1e5fff4 Michael Walle
if test "$glx" != "no" ; then
2892 b1e5fff4 Michael Walle
  glx_libs="-lGL -lX11"
2893 20ff075b Michael Walle
  cat > $TMPC << EOF
2894 20ff075b Michael Walle
#include <X11/Xlib.h>
2895 20ff075b Michael Walle
#include <GL/gl.h>
2896 20ff075b Michael Walle
#include <GL/glx.h>
2897 d3fcbb16 Michael Walle
int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
2898 20ff075b Michael Walle
EOF
2899 d3fcbb16 Michael Walle
  if compile_prog "" "-lGL -lX11" ; then
2900 b1e5fff4 Michael Walle
    glx=yes
2901 20ff075b Michael Walle
  else
2902 b1e5fff4 Michael Walle
    if test "$glx" = "yes" ; then
2903 21684af0 Stewart Smith
      feature_not_found "glx" "Install GL devel (e.g. MESA)"
2904 20ff075b Michael Walle
    fi
2905 b1e5fff4 Michael Walle
    glx_libs=
2906 b1e5fff4 Michael Walle
    glx=no
2907 20ff075b Michael Walle
  fi
2908 20ff075b Michael Walle
fi
2909 20ff075b Michael Walle
2910 d0277315 Chrysostomos Nanakos
2911 d0277315 Chrysostomos Nanakos
##########################################
2912 d0277315 Chrysostomos Nanakos
# archipelago probe
2913 d0277315 Chrysostomos Nanakos
if test "$archipelago" != "no" ; then
2914 d0277315 Chrysostomos Nanakos
    archipelago="yes"
2915 d0277315 Chrysostomos Nanakos
    archipelago_libs=-lxseg
2916 d0277315 Chrysostomos Nanakos
    libs_tools="$archipelago_libs $libs_tools"
2917 d0277315 Chrysostomos Nanakos
    libs_softmmu="$archipelago_libs $libs_softmmu"
2918 d0277315 Chrysostomos Nanakos
fi
2919 d0277315 Chrysostomos Nanakos
2920 d0277315 Chrysostomos Nanakos
2921 eb100396 Bharata B Rao
##########################################
2922 eb100396 Bharata B Rao
# glusterfs probe
2923 eb100396 Bharata B Rao
if test "$glusterfs" != "no" ; then
2924 65d5d3f9 Stefan Weil
  if $pkg_config --atleast-version=3 glusterfs-api; then
2925 e01bee08 Bharata B Rao
    glusterfs="yes"
2926 ca871ec8 Stefan Weil
    glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2927 ca871ec8 Stefan Weil
    glusterfs_libs=`$pkg_config --libs glusterfs-api`
2928 65d5d3f9 Stefan Weil
    if $pkg_config --atleast-version=5 glusterfs-api; then
2929 0c14fb47 Bharata B Rao
      glusterfs_discard="yes"
2930 0c14fb47 Bharata B Rao
    fi
2931 7c815372 Bharata B Rao
    if $pkg_config --atleast-version=6 glusterfs-api; then
2932 7c815372 Bharata B Rao
      glusterfs_zerofill="yes"
2933 7c815372 Bharata B Rao
    fi
2934 eb100396 Bharata B Rao
  else
2935 eb100396 Bharata B Rao
    if test "$glusterfs" = "yes" ; then
2936 21684af0 Stewart Smith
      feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
2937 eb100396 Bharata B Rao
    fi
2938 e01bee08 Bharata B Rao
    glusterfs="no"
2939 eb100396 Bharata B Rao
  fi
2940 eb100396 Bharata B Rao
fi
2941 eb100396 Bharata B Rao
2942 39386ac7 aurel32
# Check for inotify functions when we are building linux-user
2943 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
2944 3b3f24ad aurel32
# have syscall stubs for these implemented.  In that case we
2945 3b3f24ad aurel32
# don't provide them even if kernel supports them.
2946 3b3f24ad aurel32
#
2947 3b3f24ad aurel32
inotify=no
2948 67ba57f6 Riku Voipio
cat > $TMPC << EOF
2949 3b3f24ad aurel32
#include <sys/inotify.h>
2950 3b3f24ad aurel32
2951 3b3f24ad aurel32
int
2952 3b3f24ad aurel32
main(void)
2953 3b3f24ad aurel32
{
2954 3b3f24ad aurel32
	/* try to start inotify */
2955 8690e420 aurel32
	return inotify_init();
2956 3b3f24ad aurel32
}
2957 3b3f24ad aurel32
EOF
2958 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2959 67ba57f6 Riku Voipio
  inotify=yes
2960 3b3f24ad aurel32
fi
2961 3b3f24ad aurel32
2962 c05c7a73 Riku Voipio
inotify1=no
2963 c05c7a73 Riku Voipio
cat > $TMPC << EOF
2964 c05c7a73 Riku Voipio
#include <sys/inotify.h>
2965 c05c7a73 Riku Voipio
2966 c05c7a73 Riku Voipio
int
2967 c05c7a73 Riku Voipio
main(void)
2968 c05c7a73 Riku Voipio
{
2969 c05c7a73 Riku Voipio
    /* try to start inotify */
2970 c05c7a73 Riku Voipio
    return inotify_init1(0);
2971 c05c7a73 Riku Voipio
}
2972 c05c7a73 Riku Voipio
EOF
2973 c05c7a73 Riku Voipio
if compile_prog "" "" ; then
2974 c05c7a73 Riku Voipio
  inotify1=yes
2975 c05c7a73 Riku Voipio
fi
2976 c05c7a73 Riku Voipio
2977 ebc996f3 Riku Voipio
# check if utimensat and futimens are supported
2978 ebc996f3 Riku Voipio
utimens=no
2979 ebc996f3 Riku Voipio
cat > $TMPC << EOF
2980 ebc996f3 Riku Voipio
#define _ATFILE_SOURCE
2981 ebc996f3 Riku Voipio
#include <stddef.h>
2982 ebc996f3 Riku Voipio
#include <fcntl.h>
2983 3014ee00 Peter Maydell
#include <sys/stat.h>
2984 ebc996f3 Riku Voipio
2985 ebc996f3 Riku Voipio
int main(void)
2986 ebc996f3 Riku Voipio
{
2987 ebc996f3 Riku Voipio
    utimensat(AT_FDCWD, "foo", NULL, 0);
2988 ebc996f3 Riku Voipio
    futimens(0, NULL);
2989 ebc996f3 Riku Voipio
    return 0;
2990 ebc996f3 Riku Voipio
}
2991 ebc996f3 Riku Voipio
EOF
2992 52166aa0 Juan Quintela
if compile_prog "" "" ; then
2993 ebc996f3 Riku Voipio
  utimens=yes
2994 ebc996f3 Riku Voipio
fi
2995 ebc996f3 Riku Voipio
2996 099d6b0f Riku Voipio
# check if pipe2 is there
2997 099d6b0f Riku Voipio
pipe2=no
2998 099d6b0f Riku Voipio
cat > $TMPC << EOF
2999 099d6b0f Riku Voipio
#include <unistd.h>
3000 099d6b0f Riku Voipio
#include <fcntl.h>
3001 099d6b0f Riku Voipio
3002 099d6b0f Riku Voipio
int main(void)
3003 099d6b0f Riku Voipio
{
3004 099d6b0f Riku Voipio
    int pipefd[2];
3005 9bca8162 Bruce Rogers
    return pipe2(pipefd, O_CLOEXEC);
3006 099d6b0f Riku Voipio
}
3007 099d6b0f Riku Voipio
EOF
3008 52166aa0 Juan Quintela
if compile_prog "" "" ; then
3009 099d6b0f Riku Voipio
  pipe2=yes
3010 099d6b0f Riku Voipio
fi
3011 099d6b0f Riku Voipio
3012 40ff6d7e Kevin Wolf
# check if accept4 is there
3013 40ff6d7e Kevin Wolf
accept4=no
3014 40ff6d7e Kevin Wolf
cat > $TMPC << EOF
3015 40ff6d7e Kevin Wolf
#include <sys/socket.h>
3016 40ff6d7e Kevin Wolf
#include <stddef.h>
3017 40ff6d7e Kevin Wolf
3018 40ff6d7e Kevin Wolf
int main(void)
3019 40ff6d7e Kevin Wolf
{
3020 40ff6d7e Kevin Wolf
    accept4(0, NULL, NULL, SOCK_CLOEXEC);
3021 40ff6d7e Kevin Wolf
    return 0;
3022 40ff6d7e Kevin Wolf
}
3023 40ff6d7e Kevin Wolf
EOF
3024 40ff6d7e Kevin Wolf
if compile_prog "" "" ; then
3025 40ff6d7e Kevin Wolf
  accept4=yes
3026 40ff6d7e Kevin Wolf
fi
3027 40ff6d7e Kevin Wolf
3028 3ce34dfb vibisreenivasan
# check if tee/splice is there. vmsplice was added same time.
3029 3ce34dfb vibisreenivasan
splice=no
3030 3ce34dfb vibisreenivasan
cat > $TMPC << EOF
3031 3ce34dfb vibisreenivasan
#include <unistd.h>
3032 3ce34dfb vibisreenivasan
#include <fcntl.h>
3033 3ce34dfb vibisreenivasan
#include <limits.h>
3034 3ce34dfb vibisreenivasan
3035 3ce34dfb vibisreenivasan
int main(void)
3036 3ce34dfb vibisreenivasan
{
3037 66ea0f22 Stefan Weil
    int len, fd = 0;
3038 3ce34dfb vibisreenivasan
    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3039 3ce34dfb vibisreenivasan
    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3040 3ce34dfb vibisreenivasan
    return 0;
3041 3ce34dfb vibisreenivasan
}
3042 3ce34dfb vibisreenivasan
EOF
3043 52166aa0 Juan Quintela
if compile_prog "" "" ; then
3044 3ce34dfb vibisreenivasan
  splice=yes
3045 3ce34dfb vibisreenivasan
fi
3046 3ce34dfb vibisreenivasan
3047 dcc38d1c Marcelo Tosatti
##########################################
3048 dcc38d1c Marcelo Tosatti
# signalfd probe
3049 dcc38d1c Marcelo Tosatti
signalfd="no"
3050 dcc38d1c Marcelo Tosatti
cat > $TMPC << EOF
3051 dcc38d1c Marcelo Tosatti
#include <unistd.h>
3052 dcc38d1c Marcelo Tosatti
#include <sys/syscall.h>
3053 dcc38d1c Marcelo Tosatti
#include <signal.h>
3054 dcc38d1c Marcelo Tosatti
int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3055 dcc38d1c Marcelo Tosatti
EOF
3056 dcc38d1c Marcelo Tosatti
3057 dcc38d1c Marcelo Tosatti
if compile_prog "" "" ; then
3058 dcc38d1c Marcelo Tosatti
  signalfd=yes
3059 dcc38d1c Marcelo Tosatti
fi
3060 dcc38d1c Marcelo Tosatti
3061 c2882b96 Riku Voipio
# check if eventfd is supported
3062 c2882b96 Riku Voipio
eventfd=no
3063 c2882b96 Riku Voipio
cat > $TMPC << EOF
3064 c2882b96 Riku Voipio
#include <sys/eventfd.h>
3065 c2882b96 Riku Voipio
3066 c2882b96 Riku Voipio
int main(void)
3067 c2882b96 Riku Voipio
{
3068 55cc7f3e Stefan Weil
    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
3069 c2882b96 Riku Voipio
}
3070 c2882b96 Riku Voipio
EOF
3071 c2882b96 Riku Voipio
if compile_prog "" "" ; then
3072 c2882b96 Riku Voipio
  eventfd=yes
3073 c2882b96 Riku Voipio
fi
3074 c2882b96 Riku Voipio
3075 d0927938 Ulrich Hecht
# check for fallocate
3076 d0927938 Ulrich Hecht
fallocate=no
3077 d0927938 Ulrich Hecht
cat > $TMPC << EOF
3078 d0927938 Ulrich Hecht
#include <fcntl.h>
3079 d0927938 Ulrich Hecht
3080 d0927938 Ulrich Hecht
int main(void)
3081 d0927938 Ulrich Hecht
{
3082 d0927938 Ulrich Hecht
    fallocate(0, 0, 0, 0);
3083 d0927938 Ulrich Hecht
    return 0;
3084 d0927938 Ulrich Hecht
}
3085 d0927938 Ulrich Hecht
EOF
3086 8fb03151 Peter Maydell
if compile_prog "" "" ; then
3087 d0927938 Ulrich Hecht
  fallocate=yes
3088 d0927938 Ulrich Hecht
fi
3089 d0927938 Ulrich Hecht
3090 3d4fa43e Kusanagi Kouichi
# check for fallocate hole punching
3091 3d4fa43e Kusanagi Kouichi
fallocate_punch_hole=no
3092 3d4fa43e Kusanagi Kouichi
cat > $TMPC << EOF
3093 3d4fa43e Kusanagi Kouichi
#include <fcntl.h>
3094 3d4fa43e Kusanagi Kouichi
#include <linux/falloc.h>
3095 3d4fa43e Kusanagi Kouichi
3096 3d4fa43e Kusanagi Kouichi
int main(void)
3097 3d4fa43e Kusanagi Kouichi
{
3098 3d4fa43e Kusanagi Kouichi
    fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3099 3d4fa43e Kusanagi Kouichi
    return 0;
3100 3d4fa43e Kusanagi Kouichi
}
3101 3d4fa43e Kusanagi Kouichi
EOF
3102 3d4fa43e Kusanagi Kouichi
if compile_prog "" "" ; then
3103 3d4fa43e Kusanagi Kouichi
  fallocate_punch_hole=yes
3104 3d4fa43e Kusanagi Kouichi
fi
3105 3d4fa43e Kusanagi Kouichi
3106 c727f47d Peter Maydell
# check for sync_file_range
3107 c727f47d Peter Maydell
sync_file_range=no
3108 c727f47d Peter Maydell
cat > $TMPC << EOF
3109 c727f47d Peter Maydell
#include <fcntl.h>
3110 c727f47d Peter Maydell
3111 c727f47d Peter Maydell
int main(void)
3112 c727f47d Peter Maydell
{
3113 c727f47d Peter Maydell
    sync_file_range(0, 0, 0, 0);
3114 c727f47d Peter Maydell
    return 0;
3115 c727f47d Peter Maydell
}
3116 c727f47d Peter Maydell
EOF
3117 8fb03151 Peter Maydell
if compile_prog "" "" ; then
3118 c727f47d Peter Maydell
  sync_file_range=yes
3119 c727f47d Peter Maydell
fi
3120 c727f47d Peter Maydell
3121 dace20dc Peter Maydell
# check for linux/fiemap.h and FS_IOC_FIEMAP
3122 dace20dc Peter Maydell
fiemap=no
3123 dace20dc Peter Maydell
cat > $TMPC << EOF
3124 dace20dc Peter Maydell
#include <sys/ioctl.h>
3125 dace20dc Peter Maydell
#include <linux/fs.h>
3126 dace20dc Peter Maydell
#include <linux/fiemap.h>
3127 dace20dc Peter Maydell
3128 dace20dc Peter Maydell
int main(void)
3129 dace20dc Peter Maydell
{
3130 dace20dc Peter Maydell
    ioctl(0, FS_IOC_FIEMAP, 0);
3131 dace20dc Peter Maydell
    return 0;
3132 dace20dc Peter Maydell
}
3133 dace20dc Peter Maydell
EOF
3134 8fb03151 Peter Maydell
if compile_prog "" "" ; then
3135 dace20dc Peter Maydell
  fiemap=yes
3136 dace20dc Peter Maydell
fi
3137 dace20dc Peter Maydell
3138 d0927938 Ulrich Hecht
# check for dup3
3139 d0927938 Ulrich Hecht
dup3=no
3140 d0927938 Ulrich Hecht
cat > $TMPC << EOF
3141 d0927938 Ulrich Hecht
#include <unistd.h>
3142 d0927938 Ulrich Hecht
3143 d0927938 Ulrich Hecht
int main(void)
3144 d0927938 Ulrich Hecht
{
3145 d0927938 Ulrich Hecht
    dup3(0, 0, 0);
3146 d0927938 Ulrich Hecht
    return 0;
3147 d0927938 Ulrich Hecht
}
3148 d0927938 Ulrich Hecht
EOF
3149 78f5d726 Jan Kiszka
if compile_prog "" "" ; then
3150 d0927938 Ulrich Hecht
  dup3=yes
3151 d0927938 Ulrich Hecht
fi
3152 d0927938 Ulrich Hecht
3153 4e0c6529 Alex Bligh
# check for ppoll support
3154 4e0c6529 Alex Bligh
ppoll=no
3155 4e0c6529 Alex Bligh
cat > $TMPC << EOF
3156 4e0c6529 Alex Bligh
#include <poll.h>
3157 4e0c6529 Alex Bligh
3158 4e0c6529 Alex Bligh
int main(void)
3159 4e0c6529 Alex Bligh
{
3160 4e0c6529 Alex Bligh
    struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3161 4e0c6529 Alex Bligh
    ppoll(&pfd, 1, 0, 0);
3162 4e0c6529 Alex Bligh
    return 0;
3163 4e0c6529 Alex Bligh
}
3164 4e0c6529 Alex Bligh
EOF
3165 4e0c6529 Alex Bligh
if compile_prog "" "" ; then
3166 4e0c6529 Alex Bligh
  ppoll=yes
3167 4e0c6529 Alex Bligh
fi
3168 4e0c6529 Alex Bligh
3169 cd758dd0 Alex Bligh
# check for prctl(PR_SET_TIMERSLACK , ... ) support
3170 cd758dd0 Alex Bligh
prctl_pr_set_timerslack=no
3171 cd758dd0 Alex Bligh
cat > $TMPC << EOF
3172 cd758dd0 Alex Bligh
#include <sys/prctl.h>
3173 cd758dd0 Alex Bligh
3174 cd758dd0 Alex Bligh
int main(void)
3175 cd758dd0 Alex Bligh
{
3176 cd758dd0 Alex Bligh
    prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3177 cd758dd0 Alex Bligh
    return 0;
3178 cd758dd0 Alex Bligh
}
3179 cd758dd0 Alex Bligh
EOF
3180 cd758dd0 Alex Bligh
if compile_prog "" "" ; then
3181 cd758dd0 Alex Bligh
  prctl_pr_set_timerslack=yes
3182 cd758dd0 Alex Bligh
fi
3183 cd758dd0 Alex Bligh
3184 3b6edd16 Peter Maydell
# check for epoll support
3185 3b6edd16 Peter Maydell
epoll=no
3186 3b6edd16 Peter Maydell
cat > $TMPC << EOF
3187 3b6edd16 Peter Maydell
#include <sys/epoll.h>
3188 3b6edd16 Peter Maydell
3189 3b6edd16 Peter Maydell
int main(void)
3190 3b6edd16 Peter Maydell
{
3191 3b6edd16 Peter Maydell
    epoll_create(0);
3192 3b6edd16 Peter Maydell
    return 0;
3193 3b6edd16 Peter Maydell
}
3194 3b6edd16 Peter Maydell
EOF
3195 8fb03151 Peter Maydell
if compile_prog "" "" ; then
3196 3b6edd16 Peter Maydell
  epoll=yes
3197 3b6edd16 Peter Maydell
fi
3198 3b6edd16 Peter Maydell
3199 3b6edd16 Peter Maydell
# epoll_create1 and epoll_pwait are later additions
3200 3b6edd16 Peter Maydell
# so we must check separately for their presence
3201 3b6edd16 Peter Maydell
epoll_create1=no
3202 3b6edd16 Peter Maydell
cat > $TMPC << EOF
3203 3b6edd16 Peter Maydell
#include <sys/epoll.h>
3204 3b6edd16 Peter Maydell
3205 3b6edd16 Peter Maydell
int main(void)
3206 3b6edd16 Peter Maydell
{
3207 19e83f6b Peter Maydell
    /* Note that we use epoll_create1 as a value, not as
3208 19e83f6b Peter Maydell
     * a function being called. This is necessary so that on
3209 19e83f6b Peter Maydell
     * old SPARC glibc versions where the function was present in
3210 19e83f6b Peter Maydell
     * the library but not declared in the header file we will
3211 19e83f6b Peter Maydell
     * fail the configure check. (Otherwise we will get a compiler
3212 19e83f6b Peter Maydell
     * warning but not an error, and will proceed to fail the
3213 19e83f6b Peter Maydell
     * qemu compile where we compile with -Werror.)
3214 19e83f6b Peter Maydell
     */
3215 c075a723 Blue Swirl
    return (int)(uintptr_t)&epoll_create1;
3216 3b6edd16 Peter Maydell
}
3217 3b6edd16 Peter Maydell
EOF
3218 8fb03151 Peter Maydell
if compile_prog "" "" ; then
3219 3b6edd16 Peter Maydell
  epoll_create1=yes
3220 3b6edd16 Peter Maydell
fi
3221 3b6edd16 Peter Maydell
3222 3b6edd16 Peter Maydell
epoll_pwait=no
3223 3b6edd16 Peter Maydell
cat > $TMPC << EOF
3224 3b6edd16 Peter Maydell
#include <sys/epoll.h>
3225 3b6edd16 Peter Maydell
3226 3b6edd16 Peter Maydell
int main(void)
3227 3b6edd16 Peter Maydell
{
3228 3b6edd16 Peter Maydell
    epoll_pwait(0, 0, 0, 0, 0);
3229 3b6edd16 Peter Maydell
    return 0;
3230 3b6edd16 Peter Maydell
}
3231 3b6edd16 Peter Maydell
EOF
3232 8fb03151 Peter Maydell
if compile_prog "" "" ; then
3233 3b6edd16 Peter Maydell
  epoll_pwait=yes
3234 3b6edd16 Peter Maydell
fi
3235 3b6edd16 Peter Maydell
3236 a8fd1aba Peter Maydell
# check for sendfile support
3237 a8fd1aba Peter Maydell
sendfile=no
3238 a8fd1aba Peter Maydell
cat > $TMPC << EOF
3239 a8fd1aba Peter Maydell
#include <sys/sendfile.h>
3240 a8fd1aba Peter Maydell
3241 a8fd1aba Peter Maydell
int main(void)
3242 a8fd1aba Peter Maydell
{
3243 a8fd1aba Peter Maydell
    return sendfile(0, 0, 0, 0);
3244 a8fd1aba Peter Maydell
}
3245 a8fd1aba Peter Maydell
EOF
3246 a8fd1aba Peter Maydell
if compile_prog "" "" ; then
3247 a8fd1aba Peter Maydell
  sendfile=yes
3248 a8fd1aba Peter Maydell
fi
3249 a8fd1aba Peter Maydell
3250 cc8ae6de pbrook
# Check if tools are available to build documentation.
3251 a25dba17 Juan Quintela
if test "$docs" != "no" ; then
3252 01668d98 Stefan Weil
  if has makeinfo && has pod2man; then
3253 a25dba17 Juan Quintela
    docs=yes
3254 83a3ab8b Juan Quintela
  else
3255 a25dba17 Juan Quintela
    if test "$docs" = "yes" ; then
3256 21684af0 Stewart Smith
      feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
3257 83a3ab8b Juan Quintela
    fi
3258 a25dba17 Juan Quintela
    docs=no
3259 83a3ab8b Juan Quintela
  fi
3260 cc8ae6de pbrook
fi
3261 cc8ae6de pbrook
3262 f514f41c Stefan Weil
# Search for bswap_32 function
3263 6ae9a1f4 Juan Quintela
byteswap_h=no
3264 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
3265 6ae9a1f4 Juan Quintela
#include <byteswap.h>
3266 6ae9a1f4 Juan Quintela
int main(void) { return bswap_32(0); }
3267 6ae9a1f4 Juan Quintela
EOF
3268 52166aa0 Juan Quintela
if compile_prog "" "" ; then
3269 6ae9a1f4 Juan Quintela
  byteswap_h=yes
3270 6ae9a1f4 Juan Quintela
fi
3271 6ae9a1f4 Juan Quintela
3272 75f13596 Stefan Weil
# Search for bswap32 function
3273 6ae9a1f4 Juan Quintela
bswap_h=no
3274 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
3275 6ae9a1f4 Juan Quintela
#include <sys/endian.h>
3276 6ae9a1f4 Juan Quintela
#include <sys/types.h>
3277 6ae9a1f4 Juan Quintela
#include <machine/bswap.h>
3278 6ae9a1f4 Juan Quintela
int main(void) { return bswap32(0); }
3279 6ae9a1f4 Juan Quintela
EOF
3280 52166aa0 Juan Quintela
if compile_prog "" "" ; then
3281 6ae9a1f4 Juan Quintela
  bswap_h=yes
3282 6ae9a1f4 Juan Quintela
fi
3283 6ae9a1f4 Juan Quintela
3284 da93a1fd aliguori
##########################################
3285 c589b249 Ronnie Sahlberg
# Do we have libiscsi
3286 063c3378 Peter Lieven
# We check for iscsi_write16_sync() to make sure we have a
3287 063c3378 Peter Lieven
# at least version 1.4.0 of libiscsi.
3288 c589b249 Ronnie Sahlberg
if test "$libiscsi" != "no" ; then
3289 c589b249 Ronnie Sahlberg
  cat > $TMPC << EOF
3290 fa6acb0c Ronnie Sahlberg
#include <stdio.h>
3291 c589b249 Ronnie Sahlberg
#include <iscsi/iscsi.h>
3292 063c3378 Peter Lieven
int main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
3293 c589b249 Ronnie Sahlberg
EOF
3294 65d5d3f9 Stefan Weil
  if $pkg_config --atleast-version=1.7.0 libiscsi; then
3295 3c33ea96 Paolo Bonzini
    libiscsi="yes"
3296 ca871ec8 Stefan Weil
    libiscsi_cflags=$($pkg_config --cflags libiscsi)
3297 ca871ec8 Stefan Weil
    libiscsi_libs=$($pkg_config --libs libiscsi)
3298 3c33ea96 Paolo Bonzini
  elif compile_prog "" "-liscsi" ; then
3299 c589b249 Ronnie Sahlberg
    libiscsi="yes"
3300 6ebc91e5 Fam Zheng
    libiscsi_libs="-liscsi"
3301 c589b249 Ronnie Sahlberg
  else
3302 c589b249 Ronnie Sahlberg
    if test "$libiscsi" = "yes" ; then
3303 21684af0 Stewart Smith
      feature_not_found "libiscsi" "Install libiscsi devel"
3304 c589b249 Ronnie Sahlberg
    fi
3305 c589b249 Ronnie Sahlberg
    libiscsi="no"
3306 c589b249 Ronnie Sahlberg
  fi
3307 c589b249 Ronnie Sahlberg
fi
3308 c589b249 Ronnie Sahlberg
3309 219c2521 Stefan Weil
# We also need to know the API version because there was an
3310 219c2521 Stefan Weil
# API change from 1.4.0 to 1.5.0.
3311 219c2521 Stefan Weil
if test "$libiscsi" = "yes"; then
3312 219c2521 Stefan Weil
  cat >$TMPC <<EOF
3313 219c2521 Stefan Weil
#include <iscsi/iscsi.h>
3314 219c2521 Stefan Weil
int main(void)
3315 219c2521 Stefan Weil
{
3316 219c2521 Stefan Weil
  iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3317 219c2521 Stefan Weil
  return 0;
3318 219c2521 Stefan Weil
}
3319 219c2521 Stefan Weil
EOF
3320 219c2521 Stefan Weil
  if compile_prog "" "-liscsi"; then
3321 219c2521 Stefan Weil
    libiscsi_version="1.4.0"
3322 219c2521 Stefan Weil
  fi
3323 219c2521 Stefan Weil
fi
3324 c589b249 Ronnie Sahlberg
3325 c589b249 Ronnie Sahlberg
##########################################
3326 8bacde8d Natanael Copa
# Do we need libm
3327 8bacde8d Natanael Copa
cat > $TMPC << EOF
3328 8bacde8d Natanael Copa
#include <math.h>
3329 8bacde8d Natanael Copa
int main(void) { return isnan(sin(0.0)); }
3330 8bacde8d Natanael Copa
EOF
3331 8bacde8d Natanael Copa
if compile_prog "" "" ; then
3332 8bacde8d Natanael Copa
  :
3333 8bacde8d Natanael Copa
elif compile_prog "" "-lm" ; then
3334 8bacde8d Natanael Copa
  LIBS="-lm $LIBS"
3335 8bacde8d Natanael Copa
  libs_qga="-lm $libs_qga"
3336 8bacde8d Natanael Copa
else
3337 76ad07a4 Peter Maydell
  error_exit "libm check failed"
3338 8bacde8d Natanael Copa
fi
3339 8bacde8d Natanael Copa
3340 8bacde8d Natanael Copa
##########################################
3341 da93a1fd aliguori
# Do we need librt
3342 8bacde8d Natanael Copa
# uClibc provides 2 versions of clock_gettime(), one with realtime
3343 8bacde8d Natanael Copa
# support and one without. This means that the clock_gettime() don't
3344 8bacde8d Natanael Copa
# need -lrt. We still need it for timer_create() so we check for this
3345 8bacde8d Natanael Copa
# function in addition.
3346 da93a1fd aliguori
cat > $TMPC <<EOF
3347 da93a1fd aliguori
#include <signal.h>
3348 da93a1fd aliguori
#include <time.h>
3349 8bacde8d Natanael Copa
int main(void) {
3350 8bacde8d Natanael Copa
  timer_create(CLOCK_REALTIME, NULL, NULL);
3351 8bacde8d Natanael Copa
  return clock_gettime(CLOCK_REALTIME, NULL);
3352 8bacde8d Natanael Copa
}
3353 da93a1fd aliguori
EOF
3354 da93a1fd aliguori
3355 52166aa0 Juan Quintela
if compile_prog "" "" ; then
3356 07ffa4bd Juan Quintela
  :
3357 8bacde8d Natanael Copa
# we need pthread for static linking. use previous pthread test result
3358 8bacde8d Natanael Copa
elif compile_prog "" "-lrt $pthread_lib" ; then
3359 07ffa4bd Juan Quintela
  LIBS="-lrt $LIBS"
3360 8bacde8d Natanael Copa
  libs_qga="-lrt $libs_qga"
3361 da93a1fd aliguori
fi
3362 da93a1fd aliguori
3363 31ff504d Blue Swirl
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3364 179cf400 Andreas Färber
        "$aix" != "yes" -a "$haiku" != "yes" ; then
3365 6362a53f Juan Quintela
    libs_softmmu="-lutil $libs_softmmu"
3366 6362a53f Juan Quintela
fi
3367 6362a53f Juan Quintela
3368 de5071c5 Blue Swirl
##########################################
3369 cd4ec0b4 Gerd Hoffmann
# spice probe
3370 cd4ec0b4 Gerd Hoffmann
if test "$spice" != "no" ; then
3371 cd4ec0b4 Gerd Hoffmann
  cat > $TMPC << EOF
3372 cd4ec0b4 Gerd Hoffmann
#include <spice.h>
3373 cd4ec0b4 Gerd Hoffmann
int main(void) { spice_server_new(); return 0; }
3374 cd4ec0b4 Gerd Hoffmann
EOF
3375 710fc4f5 Jiri Denemark
  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3376 710fc4f5 Jiri Denemark
  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
3377 65d5d3f9 Stefan Weil
  if $pkg_config --atleast-version=0.12.0 spice-server && \
3378 65d5d3f9 Stefan Weil
     $pkg_config --atleast-version=0.12.3 spice-protocol && \
3379 cd4ec0b4 Gerd Hoffmann
     compile_prog "$spice_cflags" "$spice_libs" ; then
3380 cd4ec0b4 Gerd Hoffmann
    spice="yes"
3381 cd4ec0b4 Gerd Hoffmann
    libs_softmmu="$libs_softmmu $spice_libs"
3382 cd4ec0b4 Gerd Hoffmann
    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
3383 2e0e3c39 Alon Levy
    spice_protocol_version=$($pkg_config --modversion spice-protocol)
3384 2e0e3c39 Alon Levy
    spice_server_version=$($pkg_config --modversion spice-server)
3385 cd4ec0b4 Gerd Hoffmann
  else
3386 cd4ec0b4 Gerd Hoffmann
    if test "$spice" = "yes" ; then
3387 21684af0 Stewart Smith
      feature_not_found "spice" "Install spice-server and spice-protocol devel"
3388 cd4ec0b4 Gerd Hoffmann
    fi
3389 cd4ec0b4 Gerd Hoffmann
    spice="no"
3390 cd4ec0b4 Gerd Hoffmann
  fi
3391 cd4ec0b4 Gerd Hoffmann
fi
3392 cd4ec0b4 Gerd Hoffmann
3393 111a38b0 Robert Relyea
# check for libcacard for smartcard support
3394 afd347ab Paolo Bonzini
smartcard_cflags=""
3395 afd347ab Paolo Bonzini
# TODO - what's the minimal nss version we support?
3396 afd347ab Paolo Bonzini
if test "$smartcard_nss" != "no"; then
3397 afd347ab Paolo Bonzini
  cat > $TMPC << EOF
3398 5f01e06f Sergei Trofimovich
#include <pk11pub.h>
3399 5f01e06f Sergei Trofimovich
int main(void) { PK11_FreeSlot(0); return 0; }
3400 5f01e06f Sergei Trofimovich
EOF
3401 afd347ab Paolo Bonzini
    smartcard_includes="-I\$(SRC_PATH)/libcacard"
3402 afd347ab Paolo Bonzini
    libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3403 afd347ab Paolo Bonzini
    libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3404 afd347ab Paolo Bonzini
    test_cflags="$libcacard_cflags"
3405 afd347ab Paolo Bonzini
    # The header files in nss < 3.13.3 have a bug which causes them to
3406 afd347ab Paolo Bonzini
    # emit a warning. If we're going to compile QEMU with -Werror, then
3407 afd347ab Paolo Bonzini
    # test that the headers don't have this bug. Otherwise we would pass
3408 afd347ab Paolo Bonzini
    # the configure test but fail to compile QEMU later.
3409 afd347ab Paolo Bonzini
    if test "$werror" = "yes"; then
3410 afd347ab Paolo Bonzini
        test_cflags="-Werror $test_cflags"
3411 afd347ab Paolo Bonzini
    fi
3412 b6fc675b Paolo Bonzini
    if test -n "$libtool" &&
3413 65d5d3f9 Stefan Weil
       $pkg_config --atleast-version=3.12.8 nss && \
3414 afd347ab Paolo Bonzini
      compile_prog "$test_cflags" "$libcacard_libs"; then
3415 afd347ab Paolo Bonzini
        smartcard_nss="yes"
3416 afd347ab Paolo Bonzini
        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
3417 afd347ab Paolo Bonzini
        QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3418 afd347ab Paolo Bonzini
        libs_softmmu="$libcacard_libs $libs_softmmu"
3419 afd347ab Paolo Bonzini
    else
3420 afd347ab Paolo Bonzini
        if test "$smartcard_nss" = "yes"; then
3421 afd347ab Paolo Bonzini
            feature_not_found "nss"
3422 111a38b0 Robert Relyea
        fi
3423 afd347ab Paolo Bonzini
        smartcard_nss="no"
3424 111a38b0 Robert Relyea
    fi
3425 111a38b0 Robert Relyea
fi
3426 111a38b0 Robert Relyea
3427 2b2325ff Gerd Hoffmann
# check for libusb
3428 2b2325ff Gerd Hoffmann
if test "$libusb" != "no" ; then
3429 65d5d3f9 Stefan Weil
    if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
3430 2b2325ff Gerd Hoffmann
        libusb="yes"
3431 ca871ec8 Stefan Weil
        libusb_cflags=$($pkg_config --cflags libusb-1.0)
3432 ca871ec8 Stefan Weil
        libusb_libs=$($pkg_config --libs libusb-1.0)
3433 2b2325ff Gerd Hoffmann
        QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3434 2b2325ff Gerd Hoffmann
        libs_softmmu="$libs_softmmu $libusb_libs"
3435 2b2325ff Gerd Hoffmann
    else
3436 2b2325ff Gerd Hoffmann
        if test "$libusb" = "yes"; then
3437 21684af0 Stewart Smith
            feature_not_found "libusb" "Install libusb devel"
3438 2b2325ff Gerd Hoffmann
        fi
3439 2b2325ff Gerd Hoffmann
        libusb="no"
3440 2b2325ff Gerd Hoffmann
    fi
3441 2b2325ff Gerd Hoffmann
fi
3442 2b2325ff Gerd Hoffmann
3443 69354a83 Hans de Goede
# check for usbredirparser for usb network redirection support
3444 69354a83 Hans de Goede
if test "$usb_redir" != "no" ; then
3445 65d5d3f9 Stefan Weil
    if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
3446 69354a83 Hans de Goede
        usb_redir="yes"
3447 ca871ec8 Stefan Weil
        usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3448 ca871ec8 Stefan Weil
        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
3449 69354a83 Hans de Goede
        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
3450 56ab2ad1 Aurelien Jarno
        libs_softmmu="$libs_softmmu $usb_redir_libs"
3451 69354a83 Hans de Goede
    else
3452 69354a83 Hans de Goede
        if test "$usb_redir" = "yes"; then
3453 21684af0 Stewart Smith
            feature_not_found "usb-redir" "Install usbredir devel"
3454 69354a83 Hans de Goede
        fi
3455 69354a83 Hans de Goede
        usb_redir="no"
3456 69354a83 Hans de Goede
    fi
3457 69354a83 Hans de Goede
fi
3458 69354a83 Hans de Goede
3459 cd4ec0b4 Gerd Hoffmann
##########################################
3460 d9840e25 Tomoki Sekiyama
# check if we have VSS SDK headers for win
3461 d9840e25 Tomoki Sekiyama
3462 d9840e25 Tomoki Sekiyama
if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3463 d9840e25 Tomoki Sekiyama
  case "$vss_win32_sdk" in
3464 d9840e25 Tomoki Sekiyama
    "")   vss_win32_include="-I$source_path" ;;
3465 d9840e25 Tomoki Sekiyama
    *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3466 d9840e25 Tomoki Sekiyama
          # handle path with spaces. So we symlink the headers into ".sdk/vss".
3467 d9840e25 Tomoki Sekiyama
          vss_win32_include="-I$source_path/.sdk/vss"
3468 d9840e25 Tomoki Sekiyama
	  symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3469 d9840e25 Tomoki Sekiyama
	  ;;
3470 d9840e25 Tomoki Sekiyama
    *)    vss_win32_include="-I$vss_win32_sdk"
3471 d9840e25 Tomoki Sekiyama
  esac
3472 d9840e25 Tomoki Sekiyama
  cat > $TMPC << EOF
3473 d9840e25 Tomoki Sekiyama
#define __MIDL_user_allocate_free_DEFINED__
3474 d9840e25 Tomoki Sekiyama
#include <inc/win2003/vss.h>
3475 d9840e25 Tomoki Sekiyama
int main(void) { return VSS_CTX_BACKUP; }
3476 d9840e25 Tomoki Sekiyama
EOF
3477 d9840e25 Tomoki Sekiyama
  if compile_prog "$vss_win32_include" "" ; then
3478 d9840e25 Tomoki Sekiyama
    guest_agent_with_vss="yes"
3479 d9840e25 Tomoki Sekiyama
    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3480 d9840e25 Tomoki Sekiyama
    libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3481 d9840e25 Tomoki Sekiyama
  else
3482 d9840e25 Tomoki Sekiyama
    if test "$vss_win32_sdk" != "" ; then
3483 d9840e25 Tomoki Sekiyama
      echo "ERROR: Please download and install Microsoft VSS SDK:"
3484 d9840e25 Tomoki Sekiyama
      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3485 d9840e25 Tomoki Sekiyama
      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3486 d9840e25 Tomoki Sekiyama
      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
3487 d9840e25 Tomoki Sekiyama
      echo "ERROR: The headers are extracted in the directory \`inc'."
3488 d9840e25 Tomoki Sekiyama
      feature_not_found "VSS support"
3489 d9840e25 Tomoki Sekiyama
    fi
3490 d9840e25 Tomoki Sekiyama
    guest_agent_with_vss="no"
3491 d9840e25 Tomoki Sekiyama
  fi
3492 d9840e25 Tomoki Sekiyama
fi
3493 d9840e25 Tomoki Sekiyama
3494 d9840e25 Tomoki Sekiyama
##########################################
3495 d9840e25 Tomoki Sekiyama
# lookup Windows platform SDK (if not specified)
3496 d9840e25 Tomoki Sekiyama
# The SDK is needed only to build .tlb (type library) file of guest agent
3497 d9840e25 Tomoki Sekiyama
# VSS provider from the source. It is usually unnecessary because the
3498 d9840e25 Tomoki Sekiyama
# pre-compiled .tlb file is included.
3499 d9840e25 Tomoki Sekiyama
3500 d9840e25 Tomoki Sekiyama
if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3501 d9840e25 Tomoki Sekiyama
  if test -z "$win_sdk"; then
3502 d9840e25 Tomoki Sekiyama
    programfiles="$PROGRAMFILES"
3503 d9840e25 Tomoki Sekiyama
    test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3504 d9840e25 Tomoki Sekiyama
    if test -n "$programfiles"; then
3505 d9840e25 Tomoki Sekiyama
      win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3506 d9840e25 Tomoki Sekiyama
    else
3507 d9840e25 Tomoki Sekiyama
      feature_not_found "Windows SDK"
3508 d9840e25 Tomoki Sekiyama
    fi
3509 d9840e25 Tomoki Sekiyama
  elif test "$win_sdk" = "no"; then
3510 d9840e25 Tomoki Sekiyama
    win_sdk=""
3511 d9840e25 Tomoki Sekiyama
  fi
3512 d9840e25 Tomoki Sekiyama
fi
3513 d9840e25 Tomoki Sekiyama
3514 d9840e25 Tomoki Sekiyama
##########################################
3515 cd4ec0b4 Gerd Hoffmann
3516 747bbdf7 Blue Swirl
##########################################
3517 5f6b9e8f Blue Swirl
# check if we have fdatasync
3518 5f6b9e8f Blue Swirl
3519 5f6b9e8f Blue Swirl
fdatasync=no
3520 5f6b9e8f Blue Swirl
cat > $TMPC << EOF
3521 5f6b9e8f Blue Swirl
#include <unistd.h>
3522 d1722a27 Alexandre Raymond
int main(void) {
3523 d1722a27 Alexandre Raymond
#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3524 d1722a27 Alexandre Raymond
return fdatasync(0);
3525 d1722a27 Alexandre Raymond
#else
3526 e172fe11 Stefan Weil
#error Not supported
3527 d1722a27 Alexandre Raymond
#endif
3528 d1722a27 Alexandre Raymond
}
3529 5f6b9e8f Blue Swirl
EOF
3530 5f6b9e8f Blue Swirl
if compile_prog "" "" ; then
3531 5f6b9e8f Blue Swirl
    fdatasync=yes
3532 5f6b9e8f Blue Swirl
fi
3533 5f6b9e8f Blue Swirl
3534 94a420b1 Stefan Hajnoczi
##########################################
3535 e78815a5 Andreas Färber
# check if we have madvise
3536 e78815a5 Andreas Färber
3537 e78815a5 Andreas Färber
madvise=no
3538 e78815a5 Andreas Färber
cat > $TMPC << EOF
3539 e78815a5 Andreas Färber
#include <sys/types.h>
3540 e78815a5 Andreas Färber
#include <sys/mman.h>
3541 832ce9c2 Scott Wood
#include <stddef.h>
3542 e78815a5 Andreas Färber
int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3543 e78815a5 Andreas Färber
EOF
3544 e78815a5 Andreas Färber
if compile_prog "" "" ; then
3545 e78815a5 Andreas Färber
    madvise=yes
3546 e78815a5 Andreas Färber
fi
3547 e78815a5 Andreas Färber
3548 e78815a5 Andreas Färber
##########################################
3549 e78815a5 Andreas Färber
# check if we have posix_madvise
3550 e78815a5 Andreas Färber
3551 e78815a5 Andreas Färber
posix_madvise=no
3552 e78815a5 Andreas Färber
cat > $TMPC << EOF
3553 e78815a5 Andreas Färber
#include <sys/mman.h>
3554 832ce9c2 Scott Wood
#include <stddef.h>
3555 e78815a5 Andreas Färber
int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3556 e78815a5 Andreas Färber
EOF
3557 e78815a5 Andreas Färber
if compile_prog "" "" ; then
3558 e78815a5 Andreas Färber
    posix_madvise=yes
3559 e78815a5 Andreas Färber
fi
3560 e78815a5 Andreas Färber
3561 e78815a5 Andreas Färber
##########################################
3562 1e9737da Richard Henderson
# check if we have usable SIGEV_THREAD_ID
3563 1e9737da Richard Henderson
3564 1e9737da Richard Henderson
sigev_thread_id=no
3565 1e9737da Richard Henderson
cat > $TMPC << EOF
3566 1e9737da Richard Henderson
#include <signal.h>
3567 1e9737da Richard Henderson
int main(void) {
3568 1e9737da Richard Henderson
  struct sigevent ev;
3569 1e9737da Richard Henderson
  ev.sigev_notify = SIGEV_THREAD_ID;
3570 1e9737da Richard Henderson
  ev._sigev_un._tid = 0;
3571 1e9737da Richard Henderson
  asm volatile("" : : "g"(&ev));
3572 1e9737da Richard Henderson
  return 0;
3573 1e9737da Richard Henderson
}
3574 1e9737da Richard Henderson
EOF
3575 1e9737da Richard Henderson
if compile_prog "" "" ; then
3576 1e9737da Richard Henderson
    sigev_thread_id=yes
3577 1e9737da Richard Henderson
fi
3578 1e9737da Richard Henderson
3579 1e9737da Richard Henderson
##########################################
3580 94a420b1 Stefan Hajnoczi
# check if trace backend exists
3581 94a420b1 Stefan Hajnoczi
3582 650ab98d Lluís Vilanova
$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
3583 94a420b1 Stefan Hajnoczi
if test "$?" -ne 0 ; then
3584 76ad07a4 Peter Maydell
  error_exit "invalid trace backend" \
3585 76ad07a4 Peter Maydell
      "Please choose a supported trace backend."
3586 94a420b1 Stefan Hajnoczi
fi
3587 94a420b1 Stefan Hajnoczi
3588 7e24e92a Stefan Hajnoczi
##########################################
3589 7e24e92a Stefan Hajnoczi
# For 'ust' backend, test if ust headers are present
3590 7e24e92a Stefan Hajnoczi
if test "$trace_backend" = "ust"; then
3591 7e24e92a Stefan Hajnoczi
  cat > $TMPC << EOF
3592 bf15f63c Mohamad Gebai
#include <lttng/tracepoint.h>
3593 7e24e92a Stefan Hajnoczi
int main(void) { return 0; }
3594 7e24e92a Stefan Hajnoczi
EOF
3595 7e24e92a Stefan Hajnoczi
  if compile_prog "" "" ; then
3596 bf15f63c Mohamad Gebai
    if $pkg_config lttng-ust --exists; then
3597 bf15f63c Mohamad Gebai
      lttng_ust_libs=`$pkg_config --libs lttng-ust`
3598 bf15f63c Mohamad Gebai
    else
3599 bf15f63c Mohamad Gebai
      lttng_ust_libs="-llttng-ust"
3600 bf15f63c Mohamad Gebai
    fi
3601 bf15f63c Mohamad Gebai
    if $pkg_config liburcu-bp --exists; then
3602 bf15f63c Mohamad Gebai
      urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3603 bf15f63c Mohamad Gebai
    else
3604 bf15f63c Mohamad Gebai
      urcu_bp_libs="-lurcu-bp"
3605 bf15f63c Mohamad Gebai
    fi
3606 bf15f63c Mohamad Gebai
3607 bf15f63c Mohamad Gebai
    LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3608 bf15f63c Mohamad Gebai
    libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
3609 7e24e92a Stefan Hajnoczi
  else
3610 bf15f63c Mohamad Gebai
    error_exit "Trace backend 'ust' missing lttng-ust header files"
3611 7e24e92a Stefan Hajnoczi
  fi
3612 7e24e92a Stefan Hajnoczi
fi
3613 b3d08c02 Daniel P. Berrange
3614 b3d08c02 Daniel P. Berrange
##########################################
3615 b3d08c02 Daniel P. Berrange
# For 'dtrace' backend, test if 'dtrace' command is present
3616 b3d08c02 Daniel P. Berrange
if test "$trace_backend" = "dtrace"; then
3617 b3d08c02 Daniel P. Berrange
  if ! has 'dtrace' ; then
3618 76ad07a4 Peter Maydell
    error_exit "dtrace command is not found in PATH $PATH"
3619 b3d08c02 Daniel P. Berrange
  fi
3620 c276b17d Daniel P. Berrange
  trace_backend_stap="no"
3621 c276b17d Daniel P. Berrange
  if has 'stap' ; then
3622 c276b17d Daniel P. Berrange
    trace_backend_stap="yes"
3623 c276b17d Daniel P. Berrange
  fi
3624 b3d08c02 Daniel P. Berrange
fi
3625 b3d08c02 Daniel P. Berrange
3626 7e24e92a Stefan Hajnoczi
##########################################
3627 519175a2 Alex Barcelo
# check and set a backend for coroutine
3628 d0e2fce5 Aneesh Kumar K.V
3629 7c2acc70 Peter Maydell
# We prefer ucontext, but it's not always possible. The fallback
3630 7c2acc70 Peter Maydell
# is sigcontext. gthread is not selectable except explicitly, because
3631 7c2acc70 Peter Maydell
# it is not functional enough to run QEMU proper. (It is occasionally
3632 7c2acc70 Peter Maydell
# useful for debugging purposes.)  On Windows the only valid backend
3633 7c2acc70 Peter Maydell
# is the Windows-specific one.
3634 7c2acc70 Peter Maydell
3635 7c2acc70 Peter Maydell
ucontext_works=no
3636 7c2acc70 Peter Maydell
if test "$darwin" != "yes"; then
3637 7c2acc70 Peter Maydell
  cat > $TMPC << EOF
3638 d0e2fce5 Aneesh Kumar K.V
#include <ucontext.h>
3639 cdf84806 Peter Maydell
#ifdef __stub_makecontext
3640 cdf84806 Peter Maydell
#error Ignoring glibc stub makecontext which will always fail
3641 cdf84806 Peter Maydell
#endif
3642 75cafad7 Stefan Weil
int main(void) { makecontext(0, 0, 0); return 0; }
3643 d0e2fce5 Aneesh Kumar K.V
EOF
3644 7c2acc70 Peter Maydell
  if compile_prog "" "" ; then
3645 7c2acc70 Peter Maydell
    ucontext_works=yes
3646 7c2acc70 Peter Maydell
  fi
3647 7c2acc70 Peter Maydell
fi
3648 7c2acc70 Peter Maydell
3649 7c2acc70 Peter Maydell
if test "$coroutine" = ""; then
3650 7c2acc70 Peter Maydell
  if test "$mingw32" = "yes"; then
3651 7c2acc70 Peter Maydell
    coroutine=win32
3652 7c2acc70 Peter Maydell
  elif test "$ucontext_works" = "yes"; then
3653 7c2acc70 Peter Maydell
    coroutine=ucontext
3654 7c2acc70 Peter Maydell
  else
3655 7c2acc70 Peter Maydell
    coroutine=sigaltstack
3656 d0e2fce5 Aneesh Kumar K.V
  fi
3657 519175a2 Alex Barcelo
else
3658 7c2acc70 Peter Maydell
  case $coroutine in
3659 7c2acc70 Peter Maydell
  windows)
3660 7c2acc70 Peter Maydell
    if test "$mingw32" != "yes"; then
3661 7c2acc70 Peter Maydell
      error_exit "'windows' coroutine backend only valid for Windows"
3662 7c2acc70 Peter Maydell
    fi
3663 7c2acc70 Peter Maydell
    # Unfortunately the user visible backend name doesn't match the
3664 7c2acc70 Peter Maydell
    # coroutine-*.c filename for this case, so we have to adjust it here.
3665 7c2acc70 Peter Maydell
    coroutine=win32
3666 7c2acc70 Peter Maydell
    ;;
3667 7c2acc70 Peter Maydell
  ucontext)
3668 7c2acc70 Peter Maydell
    if test "$ucontext_works" != "yes"; then
3669 7c2acc70 Peter Maydell
      feature_not_found "ucontext"
3670 7c2acc70 Peter Maydell
    fi
3671 7c2acc70 Peter Maydell
    ;;
3672 7c2acc70 Peter Maydell
  gthread|sigaltstack)
3673 7c2acc70 Peter Maydell
    if test "$mingw32" = "yes"; then
3674 7c2acc70 Peter Maydell
      error_exit "only the 'windows' coroutine backend is valid for Windows"
3675 7c2acc70 Peter Maydell
    fi
3676 7c2acc70 Peter Maydell
    ;;
3677 7c2acc70 Peter Maydell
  *)
3678 7c2acc70 Peter Maydell
    error_exit "unknown coroutine backend $coroutine"
3679 7c2acc70 Peter Maydell
    ;;
3680 7c2acc70 Peter Maydell
  esac
3681 d0e2fce5 Aneesh Kumar K.V
fi
3682 d0e2fce5 Aneesh Kumar K.V
3683 70c60c08 Stefan Hajnoczi
if test "$coroutine_pool" = ""; then
3684 70c60c08 Stefan Hajnoczi
  if test "$coroutine" = "gthread"; then
3685 70c60c08 Stefan Hajnoczi
    coroutine_pool=no
3686 70c60c08 Stefan Hajnoczi
  else
3687 70c60c08 Stefan Hajnoczi
    coroutine_pool=yes
3688 70c60c08 Stefan Hajnoczi
  fi
3689 70c60c08 Stefan Hajnoczi
fi
3690 70c60c08 Stefan Hajnoczi
if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3691 70c60c08 Stefan Hajnoczi
  error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3692 70c60c08 Stefan Hajnoczi
fi
3693 70c60c08 Stefan Hajnoczi
3694 d0e2fce5 Aneesh Kumar K.V
##########################################
3695 d2042378 Aneesh Kumar K.V
# check if we have open_by_handle_at
3696 d2042378 Aneesh Kumar K.V
3697 4e1797f9 Stefan Weil
open_by_handle_at=no
3698 d2042378 Aneesh Kumar K.V
cat > $TMPC << EOF
3699 d2042378 Aneesh Kumar K.V
#include <fcntl.h>
3700 acc55ba8 Stefan Weil
#if !defined(AT_EMPTY_PATH)
3701 acc55ba8 Stefan Weil
# error missing definition
3702 acc55ba8 Stefan Weil
#else
3703 75cafad7 Stefan Weil
int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3704 acc55ba8 Stefan Weil
#endif
3705 d2042378 Aneesh Kumar K.V
EOF
3706 d2042378 Aneesh Kumar K.V
if compile_prog "" "" ; then
3707 d2042378 Aneesh Kumar K.V
    open_by_handle_at=yes
3708 d2042378 Aneesh Kumar K.V
fi
3709 d2042378 Aneesh Kumar K.V
3710 e06a765e Harsh Prateek Bora
########################################
3711 e06a765e Harsh Prateek Bora
# check if we have linux/magic.h
3712 e06a765e Harsh Prateek Bora
3713 e06a765e Harsh Prateek Bora
linux_magic_h=no
3714 e06a765e Harsh Prateek Bora
cat > $TMPC << EOF
3715 e06a765e Harsh Prateek Bora
#include <linux/magic.h>
3716 e06a765e Harsh Prateek Bora
int main(void) {
3717 75cafad7 Stefan Weil
  return 0;
3718 e06a765e Harsh Prateek Bora
}
3719 e06a765e Harsh Prateek Bora
EOF
3720 e06a765e Harsh Prateek Bora
if compile_prog "" "" ; then
3721 e06a765e Harsh Prateek Bora
    linux_magic_h=yes
3722 e06a765e Harsh Prateek Bora
fi
3723 e06a765e Harsh Prateek Bora
3724 8ab1bf12 Luiz Capitulino
########################################
3725 c95e3080 Kevin Wolf
# check whether we can disable warning option with a pragma (this is needed
3726 c95e3080 Kevin Wolf
# to silence warnings in the headers of some versions of external libraries).
3727 c95e3080 Kevin Wolf
# This test has to be compiled with -Werror as otherwise an unknown pragma is
3728 c95e3080 Kevin Wolf
# only a warning.
3729 c95e3080 Kevin Wolf
#
3730 c95e3080 Kevin Wolf
# If we can't selectively disable warning in the code, disable -Werror so that
3731 c95e3080 Kevin Wolf
# the build doesn't fail anyway.
3732 c95e3080 Kevin Wolf
3733 06d71fa1 Peter Maydell
pragma_disable_unused_but_set=no
3734 06d71fa1 Peter Maydell
cat > $TMPC << EOF
3735 e6f53fd5 Markus Armbruster
#pragma GCC diagnostic push
3736 06d71fa1 Peter Maydell
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3737 c95e3080 Kevin Wolf
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
3738 e6f53fd5 Markus Armbruster
#pragma GCC diagnostic pop
3739 c95e3080 Kevin Wolf
3740 06d71fa1 Peter Maydell
int main(void) {
3741 06d71fa1 Peter Maydell
    return 0;
3742 06d71fa1 Peter Maydell
}
3743 06d71fa1 Peter Maydell
EOF
3744 06d71fa1 Peter Maydell
if compile_prog "-Werror" "" ; then
3745 cc6e3ca9 Gerd Hoffmann
    pragma_diagnostic_available=yes
3746 c95e3080 Kevin Wolf
else
3747 c95e3080 Kevin Wolf
    werror=no
3748 06d71fa1 Peter Maydell
fi
3749 06d71fa1 Peter Maydell
3750 06d71fa1 Peter Maydell
########################################
3751 62fe8331 Christian Borntraeger
# check if we have valgrind/valgrind.h and valgrind/memcheck.h
3752 3f4349dc Kevin Wolf
3753 3f4349dc Kevin Wolf
valgrind_h=no
3754 3f4349dc Kevin Wolf
cat > $TMPC << EOF
3755 3f4349dc Kevin Wolf
#include <valgrind/valgrind.h>
3756 62fe8331 Christian Borntraeger
#include <valgrind/memcheck.h>
3757 3f4349dc Kevin Wolf
int main(void) {
3758 3f4349dc Kevin Wolf
  return 0;
3759 3f4349dc Kevin Wolf
}
3760 3f4349dc Kevin Wolf
EOF
3761 3f4349dc Kevin Wolf
if compile_prog "" "" ; then
3762 3f4349dc Kevin Wolf
    valgrind_h=yes
3763 3f4349dc Kevin Wolf
fi
3764 3f4349dc Kevin Wolf
3765 3f4349dc Kevin Wolf
########################################
3766 8ab1bf12 Luiz Capitulino
# check if environ is declared
3767 8ab1bf12 Luiz Capitulino
3768 8ab1bf12 Luiz Capitulino
has_environ=no
3769 8ab1bf12 Luiz Capitulino
cat > $TMPC << EOF
3770 8ab1bf12 Luiz Capitulino
#include <unistd.h>
3771 8ab1bf12 Luiz Capitulino
int main(void) {
3772 c075a723 Blue Swirl
    environ = 0;
3773 8ab1bf12 Luiz Capitulino
    return 0;
3774 8ab1bf12 Luiz Capitulino
}
3775 8ab1bf12 Luiz Capitulino
EOF
3776 8ab1bf12 Luiz Capitulino
if compile_prog "" "" ; then
3777 8ab1bf12 Luiz Capitulino
    has_environ=yes
3778 8ab1bf12 Luiz Capitulino
fi
3779 8ab1bf12 Luiz Capitulino
3780 76a347e1 Richard Henderson
########################################
3781 76a347e1 Richard Henderson
# check if cpuid.h is usable.
3782 76a347e1 Richard Henderson
3783 76a347e1 Richard Henderson
cpuid_h=no
3784 76a347e1 Richard Henderson
cat > $TMPC << EOF
3785 76a347e1 Richard Henderson
#include <cpuid.h>
3786 76a347e1 Richard Henderson
int main(void) {
3787 774d566c Peter Maydell
    unsigned a, b, c, d;
3788 774d566c Peter Maydell
    int max = __get_cpuid_max(0, 0);
3789 774d566c Peter Maydell
3790 774d566c Peter Maydell
    if (max >= 1) {
3791 774d566c Peter Maydell
        __cpuid(1, a, b, c, d);
3792 774d566c Peter Maydell
    }
3793 774d566c Peter Maydell
3794 774d566c Peter Maydell
    if (max >= 7) {
3795 774d566c Peter Maydell
        __cpuid_count(7, 0, a, b, c, d);
3796 774d566c Peter Maydell
    }
3797 774d566c Peter Maydell
3798 774d566c Peter Maydell
    return 0;
3799 76a347e1 Richard Henderson
}
3800 76a347e1 Richard Henderson
EOF
3801 76a347e1 Richard Henderson
if compile_prog "" "" ; then
3802 76a347e1 Richard Henderson
    cpuid_h=yes
3803 76a347e1 Richard Henderson
fi
3804 76a347e1 Richard Henderson
3805 f540166b Richard Henderson
########################################
3806 f540166b Richard Henderson
# check if __[u]int128_t is usable.
3807 f540166b Richard Henderson
3808 f540166b Richard Henderson
int128=no
3809 f540166b Richard Henderson
cat > $TMPC << EOF
3810 f540166b Richard Henderson
__int128_t a;
3811 f540166b Richard Henderson
__uint128_t b;
3812 f540166b Richard Henderson
int main (void) {
3813 f540166b Richard Henderson
  a = a + b;
3814 f540166b Richard Henderson
  b = a * b;
3815 464e3671 Peter Maydell
  a = a * a;
3816 f540166b Richard Henderson
  return 0;
3817 f540166b Richard Henderson
}
3818 f540166b Richard Henderson
EOF
3819 f540166b Richard Henderson
if compile_prog "" "" ; then
3820 f540166b Richard Henderson
    int128=yes
3821 f540166b Richard Henderson
fi
3822 76a347e1 Richard Henderson
3823 1e6e9aca Richard Henderson
########################################
3824 1e6e9aca Richard Henderson
# check if getauxval is available.
3825 1e6e9aca Richard Henderson
3826 1e6e9aca Richard Henderson
getauxval=no
3827 1e6e9aca Richard Henderson
cat > $TMPC << EOF
3828 1e6e9aca Richard Henderson
#include <sys/auxv.h>
3829 1e6e9aca Richard Henderson
int main(void) {
3830 1e6e9aca Richard Henderson
  return getauxval(AT_HWCAP) == 0;
3831 1e6e9aca Richard Henderson
}
3832 1e6e9aca Richard Henderson
EOF
3833 1e6e9aca Richard Henderson
if compile_prog "" "" ; then
3834 1e6e9aca Richard Henderson
    getauxval=yes
3835 1e6e9aca Richard Henderson
fi
3836 1e6e9aca Richard Henderson
3837 d2042378 Aneesh Kumar K.V
##########################################
3838 e86ecd4b Juan Quintela
# End of CC checks
3839 e86ecd4b Juan Quintela
# After here, no more $cc or $ld runs
3840 e86ecd4b Juan Quintela
3841 1d728c39 Blue Swirl
if test "$gcov" = "yes" ; then
3842 1d728c39 Blue Swirl
  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3843 1d728c39 Blue Swirl
  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3844 1d728c39 Blue Swirl
elif test "$debug" = "no" ; then
3845 e600cdf3 Michal Privoznik
  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
3846 e86ecd4b Juan Quintela
fi
3847 a316e378 Juan Quintela
3848 6542aa9c Peter Lieven
##########################################
3849 6542aa9c Peter Lieven
# Do we have libnfs
3850 6542aa9c Peter Lieven
if test "$libnfs" != "no" ; then
3851 6542aa9c Peter Lieven
  if $pkg_config --atleast-version=1.9.2 libnfs; then
3852 6542aa9c Peter Lieven
    libnfs="yes"
3853 6542aa9c Peter Lieven
    libnfs_libs=$($pkg_config --libs libnfs)
3854 6542aa9c Peter Lieven
    LIBS="$LIBS $libnfs_libs"
3855 6542aa9c Peter Lieven
  else
3856 6542aa9c Peter Lieven
    if test "$libnfs" = "yes" ; then
3857 6542aa9c Peter Lieven
      feature_not_found "libnfs"
3858 6542aa9c Peter Lieven
    fi
3859 6542aa9c Peter Lieven
    libnfs="no"
3860 6542aa9c Peter Lieven
  fi
3861 6542aa9c Peter Lieven
fi
3862 1d728c39 Blue Swirl
3863 20ff6c80 Anthony Liguori
# Disable zero malloc errors for official releases unless explicitly told to
3864 20ff6c80 Anthony Liguori
# enable/disable
3865 20ff6c80 Anthony Liguori
if test -z "$zero_malloc" ; then
3866 20ff6c80 Anthony Liguori
    if test "$z_version" = "50" ; then
3867 20ff6c80 Anthony Liguori
	zero_malloc="no"
3868 20ff6c80 Anthony Liguori
    else
3869 20ff6c80 Anthony Liguori
	zero_malloc="yes"
3870 20ff6c80 Anthony Liguori
    fi
3871 20ff6c80 Anthony Liguori
fi
3872 20ff6c80 Anthony Liguori
3873 6ca026cb Peter Maydell
# Now we've finished running tests it's OK to add -Werror to the compiler flags
3874 6ca026cb Peter Maydell
if test "$werror" = "yes"; then
3875 6ca026cb Peter Maydell
    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3876 6ca026cb Peter Maydell
fi
3877 6ca026cb Peter Maydell
3878 e86ecd4b Juan Quintela
if test "$solaris" = "no" ; then
3879 e86ecd4b Juan Quintela
    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
3880 1156c669 Juan Quintela
        LDFLAGS="-Wl,--warn-common $LDFLAGS"
3881 e86ecd4b Juan Quintela
    fi
3882 e86ecd4b Juan Quintela
fi
3883 e86ecd4b Juan Quintela
3884 94dd53c5 Gerd Hoffmann
# test if pod2man has --utf8 option
3885 94dd53c5 Gerd Hoffmann
if pod2man --help | grep -q utf8; then
3886 94dd53c5 Gerd Hoffmann
    POD2MAN="pod2man --utf8"
3887 94dd53c5 Gerd Hoffmann
else
3888 94dd53c5 Gerd Hoffmann
    POD2MAN="pod2man"
3889 94dd53c5 Gerd Hoffmann
fi
3890 94dd53c5 Gerd Hoffmann
3891 952afb71 Blue Swirl
# Use ASLR, no-SEH and DEP if available
3892 952afb71 Blue Swirl
if test "$mingw32" = "yes" ; then
3893 952afb71 Blue Swirl
    for flag in --dynamicbase --no-seh --nxcompat; do
3894 952afb71 Blue Swirl
        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3895 952afb71 Blue Swirl
            LDFLAGS="-Wl,$flag $LDFLAGS"
3896 952afb71 Blue Swirl
        fi
3897 952afb71 Blue Swirl
    done
3898 952afb71 Blue Swirl
fi
3899 952afb71 Blue Swirl
3900 10ea68b3 Eduardo Habkost
qemu_confdir=$sysconfdir$confsuffix
3901 e26110cf Fam Zheng
qemu_moddir=$libdir$confsuffix
3902 528ae5b8 Eduardo Habkost
qemu_datadir=$datadir$confsuffix
3903 834574ea Anthony Liguori
qemu_localedir="$datadir/locale"
3904 e7b45cc4 Paolo Bonzini
3905 4b1c11fd Daniel P. Berrange
tools=""
3906 4b1c11fd Daniel P. Berrange
if test "$want_tools" = "yes" ; then
3907 ca35f780 Paolo Bonzini
  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
3908 4b1c11fd Daniel P. Berrange
  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3909 4b1c11fd Daniel P. Berrange
    tools="qemu-nbd\$(EXESUF) $tools"
3910 4b1c11fd Daniel P. Berrange
  fi
3911 4b1c11fd Daniel P. Berrange
fi
3912 4b1c11fd Daniel P. Berrange
if test "$softmmu" = yes ; then
3913 983eef5a Meador Inge
  if test "$virtfs" != no ; then
3914 aabfd88d Andreas Färber
    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3915 aabfd88d Andreas Färber
      virtfs=yes
3916 aabfd88d Andreas Färber
      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3917 aabfd88d Andreas Färber
    else
3918 aabfd88d Andreas Färber
      if test "$virtfs" = yes; then
3919 76ad07a4 Peter Maydell
        error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3920 983eef5a Meador Inge
      fi
3921 17500370 Andreas Färber
      virtfs=no
3922 aabfd88d Andreas Färber
    fi
3923 17bff52b M. Mohan Kumar
  fi
3924 e8ef31a3 Michael Tokarev
fi
3925 e8ef31a3 Michael Tokarev
if [ "$guest_agent" != "no" ]; then
3926 b39297ae Tomoki Sekiyama
  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
3927 48ff7a62 Michael Roth
      tools="qemu-ga\$(EXESUF) $tools"
3928 b39297ae Tomoki Sekiyama
      if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3929 b39297ae Tomoki Sekiyama
        tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3930 b39297ae Tomoki Sekiyama
      fi
3931 e8ef31a3 Michael Tokarev
      guest_agent=yes
3932 e8ef31a3 Michael Tokarev
  elif [ "$guest_agent" != yes ]; then
3933 e8ef31a3 Michael Tokarev
      guest_agent=no
3934 e8ef31a3 Michael Tokarev
  else
3935 e8ef31a3 Michael Tokarev
      error_exit "Guest agent is not supported on this platform"
3936 ca35f780 Paolo Bonzini
  fi
3937 00c705fb Paolo Bonzini
fi
3938 ca35f780 Paolo Bonzini
3939 ca35f780 Paolo Bonzini
# Mac OS X ships with a broken assembler
3940 ca35f780 Paolo Bonzini
roms=
3941 ca35f780 Paolo Bonzini
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3942 ca35f780 Paolo Bonzini
        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3943 ca35f780 Paolo Bonzini
        "$softmmu" = yes ; then
3944 ca35f780 Paolo Bonzini
  roms="optionrom"
3945 ca35f780 Paolo Bonzini
fi
3946 d0384d1d Andreas Färber
if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
3947 39ac8455 David Gibson
  roms="$roms spapr-rtas"
3948 39ac8455 David Gibson
fi
3949 ca35f780 Paolo Bonzini
3950 9933c305 Christian Borntraeger
if test "$cpu" = "s390x" ; then
3951 9933c305 Christian Borntraeger
  roms="$roms s390-ccw"
3952 9933c305 Christian Borntraeger
fi
3953 9933c305 Christian Borntraeger
3954 964c6fa1 Richard Henderson
# Probe for the need for relocating the user-only binary.
3955 964c6fa1 Richard Henderson
if test "$pie" = "no" ; then
3956 964c6fa1 Richard Henderson
  textseg_addr=
3957 964c6fa1 Richard Henderson
  case "$cpu" in
3958 c72b26ec Richard Henderson
    arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
3959 964c6fa1 Richard Henderson
      textseg_addr=0x60000000
3960 964c6fa1 Richard Henderson
      ;;
3961 964c6fa1 Richard Henderson
    mips)
3962 964c6fa1 Richard Henderson
      textseg_addr=0x400000
3963 964c6fa1 Richard Henderson
      ;;
3964 964c6fa1 Richard Henderson
  esac
3965 964c6fa1 Richard Henderson
  if [ -n "$textseg_addr" ]; then
3966 964c6fa1 Richard Henderson
    cat > $TMPC <<EOF
3967 964c6fa1 Richard Henderson
    int main(void) { return 0; }
3968 964c6fa1 Richard Henderson
EOF
3969 964c6fa1 Richard Henderson
    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3970 964c6fa1 Richard Henderson
    if ! compile_prog "" "$textseg_ldflags"; then
3971 964c6fa1 Richard Henderson
      # In case ld does not support -Ttext-segment, edit the default linker
3972 964c6fa1 Richard Henderson
      # script via sed to set the .text start addr.  This is needed on FreeBSD
3973 964c6fa1 Richard Henderson
      # at least.
3974 964c6fa1 Richard Henderson
      $ld --verbose | sed \
3975 964c6fa1 Richard Henderson
        -e '1,/==================================================/d' \
3976 964c6fa1 Richard Henderson
        -e '/==================================================/,$d' \
3977 964c6fa1 Richard Henderson
        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3978 964c6fa1 Richard Henderson
        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3979 964c6fa1 Richard Henderson
      textseg_ldflags="-Wl,-T../config-host.ld"
3980 964c6fa1 Richard Henderson
    fi
3981 964c6fa1 Richard Henderson
  fi
3982 964c6fa1 Richard Henderson
fi
3983 964c6fa1 Richard Henderson
3984 5ca9388a Gerd Hoffmann
# add pixman flags after all config tests are done
3985 a540f158 Peter Crosthwaite
QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
3986 5ca9388a Gerd Hoffmann
libs_softmmu="$libs_softmmu $pixman_libs"
3987 5ca9388a Gerd Hoffmann
3988 43ce4dfe bellard
echo "Install prefix    $prefix"
3989 c00b2808 Eduardo Habkost
echo "BIOS directory    `eval echo $qemu_datadir`"
3990 f2b9e1e3 Paolo Bonzini
echo "binary directory  `eval echo $bindir`"
3991 3aa5d2be Alon Levy
echo "library directory `eval echo $libdir`"
3992 e26110cf Fam Zheng
echo "module directory  `eval echo $qemu_moddir`"
3993 8bf188aa Michael Tokarev
echo "libexec directory `eval echo $libexecdir`"
3994 0f94d6da Alon Levy
echo "include directory `eval echo $includedir`"
3995 1c0fd160 Aurelien Jarno
echo "config directory  `eval echo $sysconfdir`"
3996 11d9f695 bellard
if test "$mingw32" = "no" ; then
3997 5a699bbb Laszlo Ersek
echo "local state directory   `eval echo $local_statedir`"
3998 f2b9e1e3 Paolo Bonzini
echo "Manual directory  `eval echo $mandir`"
3999 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
4000 5a699bbb Laszlo Ersek
else
4001 5a699bbb Laszlo Ersek
echo "local state directory   queried at runtime"
4002 d9840e25 Tomoki Sekiyama
echo "Windows SDK       $win_sdk"
4003 11d9f695 bellard
fi
4004 5a67135a bellard
echo "Source path       $source_path"
4005 43ce4dfe bellard
echo "C compiler        $cc"
4006 83469015 bellard
echo "Host C compiler   $host_cc"
4007 83f73fce Tomoki Sekiyama
echo "C++ compiler      $cxx"
4008 3c4a4d0d Peter Maydell
echo "Objective-C compiler $objcc"
4009 45d285ab Peter Maydell
echo "ARFLAGS           $ARFLAGS"
4010 0c439cbf Juan Quintela
echo "CFLAGS            $CFLAGS"
4011 a558ee17 Juan Quintela
echo "QEMU_CFLAGS       $QEMU_CFLAGS"
4012 0c439cbf Juan Quintela
echo "LDFLAGS           $LDFLAGS"
4013 43ce4dfe bellard
echo "make              $make"
4014 6a882643 pbrook
echo "install           $install"
4015 c886edfb Blue Swirl
echo "python            $python"
4016 e2d8830e Brad
if test "$slirp" = "yes" ; then
4017 e2d8830e Brad
    echo "smbd              $smbd"
4018 e2d8830e Brad
fi
4019 17969268 Fam Zheng
echo "module support    $modules"
4020 43ce4dfe bellard
echo "host CPU          $cpu"
4021 de83cd02 bellard
echo "host big endian   $bigendian"
4022 97a847bc bellard
echo "target list       $target_list"
4023 ade25b0d aurel32
echo "tcg debug enabled $debug_tcg"
4024 43ce4dfe bellard
echo "gprof enabled     $gprof"
4025 03b4fe7d aliguori
echo "sparse enabled    $sparse"
4026 1625af87 aliguori
echo "strip binaries    $strip_opt"
4027 05c2a3e7 bellard
echo "profiler          $profiler"
4028 43ce4dfe bellard
echo "static build      $static"
4029 85aa5189 bellard
echo "-Werror enabled   $werror"
4030 5b0753e0 bellard
if test "$darwin" = "yes" ; then
4031 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
4032 5b0753e0 bellard
fi
4033 e2134eb9 Gerd Hoffmann
echo "pixman            $pixman"
4034 97a847bc bellard
echo "SDL support       $sdl"
4035 a4ccabcf Anthony Liguori
echo "GTK support       $gtk"
4036 4d3b6f6e balrog
echo "curses support    $curses"
4037 769ce76d Alexander Graf
echo "curl support      $curl"
4038 67b915a5 bellard
echo "mingw32 support   $mingw32"
4039 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
4040 b64ec4e4 Fam Zheng
echo "Block whitelist (rw) $block_drv_rw_whitelist"
4041 b64ec4e4 Fam Zheng
echo "Block whitelist (ro) $block_drv_ro_whitelist"
4042 983eef5a Meador Inge
echo "VirtFS support    $virtfs"
4043 821601ea Jes Sorensen
echo "VNC support       $vnc"
4044 821601ea Jes Sorensen
if test "$vnc" = "yes" ; then
4045 821601ea Jes Sorensen
    echo "VNC TLS support   $vnc_tls"
4046 821601ea Jes Sorensen
    echo "VNC SASL support  $vnc_sasl"
4047 821601ea Jes Sorensen
    echo "VNC JPEG support  $vnc_jpeg"
4048 821601ea Jes Sorensen
    echo "VNC PNG support   $vnc_png"
4049 7536ee4b Tim Hardeck
    echo "VNC WS support    $vnc_ws"
4050 821601ea Jes Sorensen
fi
4051 3142255c blueswir1
if test -n "$sparc_cpu"; then
4052 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
4053 3142255c blueswir1
fi
4054 e37630ca aliguori
echo "xen support       $xen"
4055 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
4056 a20a6f46 Juan Quintela
echo "bluez  support    $bluez"
4057 a25dba17 Juan Quintela
echo "Documentation     $docs"
4058 c5937220 pbrook
[ ! -z "$uname_release" ] && \
4059 c5937220 pbrook
echo "uname -r          $uname_release"
4060 379f6698 Paul Brook
echo "GUEST_BASE        $guest_base"
4061 40d6444e Avi Kivity
echo "PIE               $pie"
4062 8a16d273 ths
echo "vde support       $vde"
4063 58952137 Vincenzo Maffione
echo "netmap support    $netmap"
4064 5c6c3a6c Christoph Hellwig
echo "Linux AIO support $linux_aio"
4065 758e8e38 Venkateswararao Jujjuri (JV)
echo "ATTR/XATTR support $attr"
4066 77755340 ths
echo "Install blobs     $blobs"
4067 b31a0277 Juan Quintela
echo "KVM support       $kvm"
4068 2da776db Michael R. Hines
echo "RDMA support      $rdma"
4069 9195b2c2 Stefan Weil
echo "TCG interpreter   $tcg_interpreter"
4070 f652e6af aurel32
echo "fdt support       $fdt"
4071 ceb42de8 aliguori
echo "preadv support    $preadv"
4072 5f6b9e8f Blue Swirl
echo "fdatasync         $fdatasync"
4073 e78815a5 Andreas Färber
echo "madvise           $madvise"
4074 e78815a5 Andreas Färber
echo "posix_madvise     $posix_madvise"
4075 1e9737da Richard Henderson
echo "sigev_thread_id   $sigev_thread_id"
4076 ee682d27 Stefan Weil
echo "uuid support      $uuid"
4077 47e98658 Corey Bryant
echo "libcap-ng support $cap_ng"
4078 d5970055 Michael S. Tsirkin
echo "vhost-net support $vhost_net"
4079 5e9be92d Nicholas Bellinger
echo "vhost-scsi support $vhost_scsi"
4080 94a420b1 Stefan Hajnoczi
echo "Trace backend     $trace_backend"
4081 9410b56c Prerna Saxena
echo "Trace output file $trace_file-<pid>"
4082 2e0e3c39 Alon Levy
echo "spice support     $spice ($spice_protocol_version/$spice_server_version)"
4083 f27aaf4b Christian Brunner
echo "rbd support       $rbd"
4084 dce512de Christoph Hellwig
echo "xfsctl support    $xfs"
4085 111a38b0 Robert Relyea
echo "nss used          $smartcard_nss"
4086 2b2325ff Gerd Hoffmann
echo "libusb            $libusb"
4087 69354a83 Hans de Goede
echo "usb net redir     $usb_redir"
4088 b1e5fff4 Michael Walle
echo "GLX support       $glx"
4089 219c2521 Stefan Weil
if test "$libiscsi_version" = "1.4.0"; then
4090 219c2521 Stefan Weil
echo "libiscsi support  $libiscsi (1.4.0)"
4091 219c2521 Stefan Weil
else
4092 c589b249 Ronnie Sahlberg
echo "libiscsi support  $libiscsi"
4093 219c2521 Stefan Weil
fi
4094 6542aa9c Peter Lieven
echo "libnfs support    $libnfs"
4095 d138cee9 Michael Roth
echo "build guest agent $guest_agent"
4096 d9840e25 Tomoki Sekiyama
echo "QGA VSS support   $guest_agent_with_vss"
4097 f794573e Eduardo Otubo
echo "seccomp support   $seccomp"
4098 7c2acc70 Peter Maydell
echo "coroutine backend $coroutine"
4099 70c60c08 Stefan Hajnoczi
echo "coroutine pool    $coroutine_pool"
4100 eb100396 Bharata B Rao
echo "GlusterFS support $glusterfs"
4101 d0277315 Chrysostomos Nanakos
echo "Archipelago support $archipelago"
4102 583f6e7b Stefan Hajnoczi
echo "virtio-blk-data-plane $virtio_blk_data_plane"
4103 1d728c39 Blue Swirl
echo "gcov              $gcov_tool"
4104 1d728c39 Blue Swirl
echo "gcov enabled      $gcov"
4105 ab214c29 Stefan Berger
echo "TPM support       $tpm"
4106 0a12ec87 Richard W.M. Jones
echo "libssh2 support   $libssh2"
4107 3b8acc11 Paolo Bonzini
echo "TPM passthrough   $tpm_passthrough"
4108 3556c233 Paolo Bonzini
echo "QOM debugging     $qom_cast_debug"
4109 4f18b782 Jeff Cody
echo "vhdx              $vhdx"
4110 95c6bff3 Benoît Canet
echo "Quorum            $quorum"
4111 607dacd0 qiaonuohan
echo "lzo support       $lzo"
4112 607dacd0 qiaonuohan
echo "snappy support    $snappy"
4113 67b915a5 bellard
4114 1ba16968 Stefan Weil
if test "$sdl_too_old" = "yes"; then
4115 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
4116 7c1f25b4 bellard
fi
4117 7d13299d bellard
4118 98ec69ac Juan Quintela
config_host_mak="config-host.mak"
4119 98ec69ac Juan Quintela
4120 dbd99ae3 Stefan Weil
echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4121 dbd99ae3 Stefan Weil
4122 98ec69ac Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_host_mak
4123 98ec69ac Juan Quintela
echo >> $config_host_mak
4124 98ec69ac Juan Quintela
4125 e6c3b0f7 Paolo Bonzini
echo all: >> $config_host_mak
4126 99d7cc75 Paolo Bonzini
echo "prefix=$prefix" >> $config_host_mak
4127 99d7cc75 Paolo Bonzini
echo "bindir=$bindir" >> $config_host_mak
4128 3aa5d2be Alon Levy
echo "libdir=$libdir" >> $config_host_mak
4129 8bf188aa Michael Tokarev
echo "libexecdir=$libexecdir" >> $config_host_mak
4130 0f94d6da Alon Levy
echo "includedir=$includedir" >> $config_host_mak
4131 99d7cc75 Paolo Bonzini
echo "mandir=$mandir" >> $config_host_mak
4132 99d7cc75 Paolo Bonzini
echo "sysconfdir=$sysconfdir" >> $config_host_mak
4133 22d07038 Eduardo Habkost
echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
4134 9afa52ce Eduardo Habkost
echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4135 9afa52ce Eduardo Habkost
echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
4136 e26110cf Fam Zheng
echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
4137 5a699bbb Laszlo Ersek
if test "$mingw32" = "no" ; then
4138 5a699bbb Laszlo Ersek
  echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4139 5a699bbb Laszlo Ersek
fi
4140 f354b1a1 Michael Tokarev
echo "qemu_helperdir=$libexecdir" >> $config_host_mak
4141 f9943cd5 Gerd Hoffmann
echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4142 f9943cd5 Gerd Hoffmann
echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
4143 834574ea Anthony Liguori
echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
4144 f544a488 Paolo Bonzini
echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
4145 804edf29 Juan Quintela
4146 98ec69ac Juan Quintela
echo "ARCH=$ARCH" >> $config_host_mak
4147 727e5283 Paolo Bonzini
4148 f8393946 aurel32
if test "$debug_tcg" = "yes" ; then
4149 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
4150 f8393946 aurel32
fi
4151 1625af87 aliguori
if test "$strip_opt" = "yes" ; then
4152 52ba784d Hollis Blanchard
  echo "STRIP=${strip}" >> $config_host_mak
4153 1625af87 aliguori
fi
4154 7d13299d bellard
if test "$bigendian" = "yes" ; then
4155 e2542fe2 Juan Quintela
  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
4156 97a847bc bellard
fi
4157 67b915a5 bellard
if test "$mingw32" = "yes" ; then
4158 98ec69ac Juan Quintela
  echo "CONFIG_WIN32=y" >> $config_host_mak
4159 9fe6de94 Blue Swirl
  rc_version=`cat $source_path/VERSION`
4160 9fe6de94 Blue Swirl
  version_major=${rc_version%%.*}
4161 9fe6de94 Blue Swirl
  rc_version=${rc_version#*.}
4162 9fe6de94 Blue Swirl
  version_minor=${rc_version%%.*}
4163 9fe6de94 Blue Swirl
  rc_version=${rc_version#*.}
4164 9fe6de94 Blue Swirl
  version_subminor=${rc_version%%.*}
4165 9fe6de94 Blue Swirl
  version_micro=0
4166 9fe6de94 Blue Swirl
  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4167 9fe6de94 Blue Swirl
  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4168 d9840e25 Tomoki Sekiyama
  if test "$guest_agent_with_vss" = "yes" ; then
4169 d9840e25 Tomoki Sekiyama
    echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4170 d9840e25 Tomoki Sekiyama
    echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4171 d9840e25 Tomoki Sekiyama
  fi
4172 210fa556 pbrook
else
4173 35f4df27 Juan Quintela
  echo "CONFIG_POSIX=y" >> $config_host_mak
4174 dffcb71c Mark McLoughlin
fi
4175 dffcb71c Mark McLoughlin
4176 dffcb71c Mark McLoughlin
if test "$linux" = "yes" ; then
4177 dffcb71c Mark McLoughlin
  echo "CONFIG_LINUX=y" >> $config_host_mak
4178 67b915a5 bellard
fi
4179 128ab2ff blueswir1
4180 83fb7adf bellard
if test "$darwin" = "yes" ; then
4181 98ec69ac Juan Quintela
  echo "CONFIG_DARWIN=y" >> $config_host_mak
4182 83fb7adf bellard
fi
4183 b29fe3ed malc
4184 b29fe3ed malc
if test "$aix" = "yes" ; then
4185 98ec69ac Juan Quintela
  echo "CONFIG_AIX=y" >> $config_host_mak
4186 b29fe3ed malc
fi
4187 b29fe3ed malc
4188 ec530c81 bellard
if test "$solaris" = "yes" ; then
4189 98ec69ac Juan Quintela
  echo "CONFIG_SOLARIS=y" >> $config_host_mak
4190 2358a494 Juan Quintela
  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
4191 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
4192 75b5a697 Juan Quintela
    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
4193 0475a5ca ths
  fi
4194 ec530c81 bellard
fi
4195 179cf400 Andreas Färber
if test "$haiku" = "yes" ; then
4196 179cf400 Andreas Färber
  echo "CONFIG_HAIKU=y" >> $config_host_mak
4197 179cf400 Andreas Färber
fi
4198 97a847bc bellard
if test "$static" = "yes" ; then
4199 98ec69ac Juan Quintela
  echo "CONFIG_STATIC=y" >> $config_host_mak
4200 7d13299d bellard
fi
4201 1ba16968 Stefan Weil
if test "$profiler" = "yes" ; then
4202 2358a494 Juan Quintela
  echo "CONFIG_PROFILER=y" >> $config_host_mak
4203 05c2a3e7 bellard
fi
4204 c20709aa bellard
if test "$slirp" = "yes" ; then
4205 98ec69ac Juan Quintela
  echo "CONFIG_SLIRP=y" >> $config_host_mak
4206 e2d8830e Brad
  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
4207 c20709aa bellard
fi
4208 8a16d273 ths
if test "$vde" = "yes" ; then
4209 98ec69ac Juan Quintela
  echo "CONFIG_VDE=y" >> $config_host_mak
4210 8a16d273 ths
fi
4211 58952137 Vincenzo Maffione
if test "$netmap" = "yes" ; then
4212 58952137 Vincenzo Maffione
  echo "CONFIG_NETMAP=y" >> $config_host_mak
4213 58952137 Vincenzo Maffione
fi
4214 47e98658 Corey Bryant
if test "$cap_ng" = "yes" ; then
4215 47e98658 Corey Bryant
  echo "CONFIG_LIBCAP=y" >> $config_host_mak
4216 47e98658 Corey Bryant
fi
4217 2358a494 Juan Quintela
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
4218 0c58ac1c malc
for drv in $audio_drv_list; do
4219 bb55b712 Stefan Weil
    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
4220 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
4221 923e4521 malc
    if test "$drv" = "fmod"; then
4222 7aac6cb1 Juan Quintela
        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
4223 0c58ac1c malc
    fi
4224 0c58ac1c malc
done
4225 67f86e8e Juan Quintela
if test "$audio_pt_int" = "yes" ; then
4226 67f86e8e Juan Quintela
  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4227 67f86e8e Juan Quintela
fi
4228 d5631638 malc
if test "$audio_win_int" = "yes" ; then
4229 d5631638 malc
  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4230 d5631638 malc
fi
4231 b64ec4e4 Fam Zheng
echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4232 b64ec4e4 Fam Zheng
echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
4233 821601ea Jes Sorensen
if test "$vnc" = "yes" ; then
4234 821601ea Jes Sorensen
  echo "CONFIG_VNC=y" >> $config_host_mak
4235 821601ea Jes Sorensen
fi
4236 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
4237 98ec69ac Juan Quintela
  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
4238 8d5d2d4c ths
fi
4239 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
4240 98ec69ac Juan Quintela
  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
4241 2f9606b3 aliguori
fi
4242 821601ea Jes Sorensen
if test "$vnc_jpeg" = "yes" ; then
4243 2f6f5c7a Corentin Chary
  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
4244 2f6f5c7a Corentin Chary
fi
4245 821601ea Jes Sorensen
if test "$vnc_png" = "yes" ; then
4246 efe556ad Corentin Chary
  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
4247 efe556ad Corentin Chary
fi
4248 7536ee4b Tim Hardeck
if test "$vnc_ws" = "yes" ; then
4249 7536ee4b Tim Hardeck
  echo "CONFIG_VNC_WS=y" >> $config_host_mak
4250 7536ee4b Tim Hardeck
  echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4251 7536ee4b Tim Hardeck
fi
4252 76655d6d aliguori
if test "$fnmatch" = "yes" ; then
4253 2358a494 Juan Quintela
  echo "CONFIG_FNMATCH=y" >> $config_host_mak
4254 76655d6d aliguori
fi
4255 ee682d27 Stefan Weil
if test "$uuid" = "yes" ; then
4256 ee682d27 Stefan Weil
  echo "CONFIG_UUID=y" >> $config_host_mak
4257 ee682d27 Stefan Weil
fi
4258 dce512de Christoph Hellwig
if test "$xfs" = "yes" ; then
4259 dce512de Christoph Hellwig
  echo "CONFIG_XFS=y" >> $config_host_mak
4260 dce512de Christoph Hellwig
fi
4261 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
4262 98ec69ac Juan Quintela
echo "VERSION=$qemu_version" >>$config_host_mak
4263 2358a494 Juan Quintela
echo "PKGVERSION=$pkgversion" >>$config_host_mak
4264 98ec69ac Juan Quintela
echo "SRC_PATH=$source_path" >> $config_host_mak
4265 98ec69ac Juan Quintela
echo "TARGET_DIRS=$target_list" >> $config_host_mak
4266 a25dba17 Juan Quintela
if [ "$docs" = "yes" ] ; then
4267 98ec69ac Juan Quintela
  echo "BUILD_DOCS=yes" >> $config_host_mak
4268 cc8ae6de pbrook
fi
4269 17969268 Fam Zheng
if test "$modules" = "yes"; then
4270 e26110cf Fam Zheng
  # $shacmd can generate a hash started with digit, which the compiler doesn't
4271 e26110cf Fam Zheng
  # like as an symbol. So prefix it with an underscore
4272 e26110cf Fam Zheng
  echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
4273 17969268 Fam Zheng
  echo "CONFIG_MODULES=y" >> $config_host_mak
4274 17969268 Fam Zheng
fi
4275 1ac88f28 Juan Quintela
if test "$sdl" = "yes" ; then
4276 98ec69ac Juan Quintela
  echo "CONFIG_SDL=y" >> $config_host_mak
4277 1ac88f28 Juan Quintela
  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
4278 49ecc3fa bellard
fi
4279 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
4280 98ec69ac Juan Quintela
  echo "CONFIG_COCOA=y" >> $config_host_mak
4281 4d3b6f6e balrog
fi
4282 4d3b6f6e balrog
if test "$curses" = "yes" ; then
4283 98ec69ac Juan Quintela
  echo "CONFIG_CURSES=y" >> $config_host_mak
4284 49ecc3fa bellard
fi
4285 ebc996f3 Riku Voipio
if test "$utimens" = "yes" ; then
4286 2358a494 Juan Quintela
  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
4287 ebc996f3 Riku Voipio
fi
4288 099d6b0f Riku Voipio
if test "$pipe2" = "yes" ; then
4289 2358a494 Juan Quintela
  echo "CONFIG_PIPE2=y" >> $config_host_mak
4290 099d6b0f Riku Voipio
fi
4291 40ff6d7e Kevin Wolf
if test "$accept4" = "yes" ; then
4292 40ff6d7e Kevin Wolf
  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4293 40ff6d7e Kevin Wolf
fi
4294 3ce34dfb vibisreenivasan
if test "$splice" = "yes" ; then
4295 2358a494 Juan Quintela
  echo "CONFIG_SPLICE=y" >> $config_host_mak
4296 3ce34dfb vibisreenivasan
fi
4297 c2882b96 Riku Voipio
if test "$eventfd" = "yes" ; then
4298 c2882b96 Riku Voipio
  echo "CONFIG_EVENTFD=y" >> $config_host_mak
4299 c2882b96 Riku Voipio
fi
4300 d0927938 Ulrich Hecht
if test "$fallocate" = "yes" ; then
4301 d0927938 Ulrich Hecht
  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4302 d0927938 Ulrich Hecht
fi
4303 3d4fa43e Kusanagi Kouichi
if test "$fallocate_punch_hole" = "yes" ; then
4304 3d4fa43e Kusanagi Kouichi
  echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4305 3d4fa43e Kusanagi Kouichi
fi
4306 c727f47d Peter Maydell
if test "$sync_file_range" = "yes" ; then
4307 c727f47d Peter Maydell
  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4308 c727f47d Peter Maydell
fi
4309 dace20dc Peter Maydell
if test "$fiemap" = "yes" ; then
4310 dace20dc Peter Maydell
  echo "CONFIG_FIEMAP=y" >> $config_host_mak
4311 dace20dc Peter Maydell
fi
4312 d0927938 Ulrich Hecht
if test "$dup3" = "yes" ; then
4313 d0927938 Ulrich Hecht
  echo "CONFIG_DUP3=y" >> $config_host_mak
4314 d0927938 Ulrich Hecht
fi
4315 4e0c6529 Alex Bligh
if test "$ppoll" = "yes" ; then
4316 4e0c6529 Alex Bligh
  echo "CONFIG_PPOLL=y" >> $config_host_mak
4317 4e0c6529 Alex Bligh
fi
4318 cd758dd0 Alex Bligh
if test "$prctl_pr_set_timerslack" = "yes" ; then
4319 cd758dd0 Alex Bligh
  echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4320 cd758dd0 Alex Bligh
fi
4321 3b6edd16 Peter Maydell
if test "$epoll" = "yes" ; then
4322 3b6edd16 Peter Maydell
  echo "CONFIG_EPOLL=y" >> $config_host_mak
4323 3b6edd16 Peter Maydell
fi
4324 3b6edd16 Peter Maydell
if test "$epoll_create1" = "yes" ; then
4325 3b6edd16 Peter Maydell
  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4326 3b6edd16 Peter Maydell
fi
4327 3b6edd16 Peter Maydell
if test "$epoll_pwait" = "yes" ; then
4328 3b6edd16 Peter Maydell
  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4329 3b6edd16 Peter Maydell
fi
4330 a8fd1aba Peter Maydell
if test "$sendfile" = "yes" ; then
4331 a8fd1aba Peter Maydell
  echo "CONFIG_SENDFILE=y" >> $config_host_mak
4332 a8fd1aba Peter Maydell
fi
4333 3b3f24ad aurel32
if test "$inotify" = "yes" ; then
4334 2358a494 Juan Quintela
  echo "CONFIG_INOTIFY=y" >> $config_host_mak
4335 3b3f24ad aurel32
fi
4336 c05c7a73 Riku Voipio
if test "$inotify1" = "yes" ; then
4337 c05c7a73 Riku Voipio
  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4338 c05c7a73 Riku Voipio
fi
4339 6ae9a1f4 Juan Quintela
if test "$byteswap_h" = "yes" ; then
4340 6ae9a1f4 Juan Quintela
  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4341 6ae9a1f4 Juan Quintela
fi
4342 6ae9a1f4 Juan Quintela
if test "$bswap_h" = "yes" ; then
4343 6ae9a1f4 Juan Quintela
  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4344 6ae9a1f4 Juan Quintela
fi
4345 769ce76d Alexander Graf
if test "$curl" = "yes" ; then
4346 d3399d7c Fam Zheng
  echo "CONFIG_CURL=m" >> $config_host_mak
4347 b1d5a277 Juan Quintela
  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
4348 6ebc91e5 Fam Zheng
  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
4349 769ce76d Alexander Graf
fi
4350 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
4351 98ec69ac Juan Quintela
  echo "CONFIG_BRLAPI=y" >> $config_host_mak
4352 2e4d9fb1 aurel32
fi
4353 fb599c9a balrog
if test "$bluez" = "yes" ; then
4354 98ec69ac Juan Quintela
  echo "CONFIG_BLUEZ=y" >> $config_host_mak
4355 ef7635ec Juan Quintela
  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
4356 fb599c9a balrog
fi
4357 e18df141 Anthony Liguori
echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
4358 a4ccabcf Anthony Liguori
if test "$gtk" = "yes" ; then
4359 a4ccabcf Anthony Liguori
  echo "CONFIG_GTK=y" >> $config_host_mak
4360 a4ccabcf Anthony Liguori
  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4361 a4ccabcf Anthony Liguori
  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4362 a4ccabcf Anthony Liguori
fi
4363 e37630ca aliguori
if test "$xen" = "yes" ; then
4364 6dbd588a Jan Kiszka
  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4365 d5b93ddf Anthony PERARD
  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4366 e37630ca aliguori
fi
4367 5c6c3a6c Christoph Hellwig
if test "$linux_aio" = "yes" ; then
4368 5c6c3a6c Christoph Hellwig
  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4369 5c6c3a6c Christoph Hellwig
fi
4370 758e8e38 Venkateswararao Jujjuri (JV)
if test "$attr" = "yes" ; then
4371 758e8e38 Venkateswararao Jujjuri (JV)
  echo "CONFIG_ATTR=y" >> $config_host_mak
4372 758e8e38 Venkateswararao Jujjuri (JV)
fi
4373 4f26f2b6 Avi Kivity
if test "$libattr" = "yes" ; then
4374 4f26f2b6 Avi Kivity
  echo "CONFIG_LIBATTR=y" >> $config_host_mak
4375 4f26f2b6 Avi Kivity
fi
4376 983eef5a Meador Inge
if test "$virtfs" = "yes" ; then
4377 983eef5a Meador Inge
  echo "CONFIG_VIRTFS=y" >> $config_host_mak
4378 758e8e38 Venkateswararao Jujjuri (JV)
fi
4379 5e9be92d Nicholas Bellinger
if test "$vhost_scsi" = "yes" ; then
4380 5e9be92d Nicholas Bellinger
  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4381 5e9be92d Nicholas Bellinger
fi
4382 77755340 ths
if test "$blobs" = "yes" ; then
4383 98ec69ac Juan Quintela
  echo "INSTALL_BLOBS=yes" >> $config_host_mak
4384 77755340 ths
fi
4385 bf9298b9 aliguori
if test "$iovec" = "yes" ; then
4386 2358a494 Juan Quintela
  echo "CONFIG_IOVEC=y" >> $config_host_mak
4387 bf9298b9 aliguori
fi
4388 ceb42de8 aliguori
if test "$preadv" = "yes" ; then
4389 2358a494 Juan Quintela
  echo "CONFIG_PREADV=y" >> $config_host_mak
4390 ceb42de8 aliguori
fi
4391 f652e6af aurel32
if test "$fdt" = "yes" ; then
4392 3f0855b1 Juan Quintela
  echo "CONFIG_FDT=y" >> $config_host_mak
4393 f652e6af aurel32
fi
4394 dcc38d1c Marcelo Tosatti
if test "$signalfd" = "yes" ; then
4395 dcc38d1c Marcelo Tosatti
  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4396 dcc38d1c Marcelo Tosatti
fi
4397 9195b2c2 Stefan Weil
if test "$tcg_interpreter" = "yes" ; then
4398 9195b2c2 Stefan Weil
  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4399 9195b2c2 Stefan Weil
fi
4400 5f6b9e8f Blue Swirl
if test "$fdatasync" = "yes" ; then
4401 5f6b9e8f Blue Swirl
  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4402 5f6b9e8f Blue Swirl
fi
4403 e78815a5 Andreas Färber
if test "$madvise" = "yes" ; then
4404 e78815a5 Andreas Färber
  echo "CONFIG_MADVISE=y" >> $config_host_mak
4405 e78815a5 Andreas Färber
fi
4406 e78815a5 Andreas Färber
if test "$posix_madvise" = "yes" ; then
4407 e78815a5 Andreas Färber
  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4408 e78815a5 Andreas Färber
fi
4409 1e9737da Richard Henderson
if test "$sigev_thread_id" = "yes" ; then
4410 1e9737da Richard Henderson
  echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4411 1e9737da Richard Henderson
fi
4412 97a847bc bellard
4413 cd4ec0b4 Gerd Hoffmann
if test "$spice" = "yes" ; then
4414 cd4ec0b4 Gerd Hoffmann
  echo "CONFIG_SPICE=y" >> $config_host_mak
4415 cd4ec0b4 Gerd Hoffmann
fi
4416 36707144 Alon Levy
4417 111a38b0 Robert Relyea
if test "$smartcard_nss" = "yes" ; then
4418 111a38b0 Robert Relyea
  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
4419 ad4cf3f6 Paul Brook
  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4420 ad4cf3f6 Paul Brook
  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
4421 111a38b0 Robert Relyea
fi
4422 111a38b0 Robert Relyea
4423 2b2325ff Gerd Hoffmann
if test "$libusb" = "yes" ; then
4424 2b2325ff Gerd Hoffmann
  echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4425 2b2325ff Gerd Hoffmann
fi
4426 2b2325ff Gerd Hoffmann
4427 69354a83 Hans de Goede
if test "$usb_redir" = "yes" ; then
4428 69354a83 Hans de Goede
  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4429 69354a83 Hans de Goede
fi
4430 69354a83 Hans de Goede
4431 b1e5fff4 Michael Walle
if test "$glx" = "yes" ; then
4432 b1e5fff4 Michael Walle
  echo "CONFIG_GLX=y" >> $config_host_mak
4433 2b6b7099 Paolo Bonzini
  echo "GLX_LIBS=$glx_libs" >> $config_host_mak
4434 20ff075b Michael Walle
fi
4435 20ff075b Michael Walle
4436 607dacd0 qiaonuohan
if test "$lzo" = "yes" ; then
4437 607dacd0 qiaonuohan
  echo "CONFIG_LZO=y" >> $config_host_mak
4438 607dacd0 qiaonuohan
fi
4439 607dacd0 qiaonuohan
4440 607dacd0 qiaonuohan
if test "$snappy" = "yes" ; then
4441 607dacd0 qiaonuohan
  echo "CONFIG_SNAPPY=y" >> $config_host_mak
4442 607dacd0 qiaonuohan
fi
4443 607dacd0 qiaonuohan
4444 c589b249 Ronnie Sahlberg
if test "$libiscsi" = "yes" ; then
4445 d3399d7c Fam Zheng
  echo "CONFIG_LIBISCSI=m" >> $config_host_mak
4446 219c2521 Stefan Weil
  if test "$libiscsi_version" = "1.4.0"; then
4447 219c2521 Stefan Weil
    echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4448 219c2521 Stefan Weil
  fi
4449 6ebc91e5 Fam Zheng
  echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
4450 6ebc91e5 Fam Zheng
  echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
4451 c589b249 Ronnie Sahlberg
fi
4452 c589b249 Ronnie Sahlberg
4453 6542aa9c Peter Lieven
if test "$libnfs" = "yes" ; then
4454 6542aa9c Peter Lieven
  echo "CONFIG_LIBNFS=y" >> $config_host_mak
4455 6542aa9c Peter Lieven
fi
4456 6542aa9c Peter Lieven
4457 f794573e Eduardo Otubo
if test "$seccomp" = "yes"; then
4458 f794573e Eduardo Otubo
  echo "CONFIG_SECCOMP=y" >> $config_host_mak
4459 f794573e Eduardo Otubo
fi
4460 f794573e Eduardo Otubo
4461 83fb7adf bellard
# XXX: suppress that
4462 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
4463 2358a494 Juan Quintela
  echo "CONFIG_BSD=y" >> $config_host_mak
4464 7d3505c5 bellard
fi
4465 7d3505c5 bellard
4466 2358a494 Juan Quintela
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
4467 c5937220 pbrook
4468 20ff6c80 Anthony Liguori
if test "$zero_malloc" = "yes" ; then
4469 20ff6c80 Anthony Liguori
  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4470 20ff6c80 Anthony Liguori
fi
4471 3556c233 Paolo Bonzini
if test "$qom_cast_debug" = "yes" ; then
4472 3556c233 Paolo Bonzini
  echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4473 3556c233 Paolo Bonzini
fi
4474 f27aaf4b Christian Brunner
if test "$rbd" = "yes" ; then
4475 d3399d7c Fam Zheng
  echo "CONFIG_RBD=m" >> $config_host_mak
4476 6ebc91e5 Fam Zheng
  echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
4477 6ebc91e5 Fam Zheng
  echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
4478 d0e2fce5 Aneesh Kumar K.V
fi
4479 d0e2fce5 Aneesh Kumar K.V
4480 7c2acc70 Peter Maydell
echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
4481 70c60c08 Stefan Hajnoczi
if test "$coroutine_pool" = "yes" ; then
4482 70c60c08 Stefan Hajnoczi
  echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4483 70c60c08 Stefan Hajnoczi
else
4484 70c60c08 Stefan Hajnoczi
  echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4485 70c60c08 Stefan Hajnoczi
fi
4486 20ff6c80 Anthony Liguori
4487 d2042378 Aneesh Kumar K.V
if test "$open_by_handle_at" = "yes" ; then
4488 d2042378 Aneesh Kumar K.V
  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4489 d2042378 Aneesh Kumar K.V
fi
4490 d2042378 Aneesh Kumar K.V
4491 e06a765e Harsh Prateek Bora
if test "$linux_magic_h" = "yes" ; then
4492 e06a765e Harsh Prateek Bora
  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4493 8ab1bf12 Luiz Capitulino
fi
4494 8ab1bf12 Luiz Capitulino
4495 cc6e3ca9 Gerd Hoffmann
if test "$pragma_diagnostic_available" = "yes" ; then
4496 cc6e3ca9 Gerd Hoffmann
  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
4497 06d71fa1 Peter Maydell
fi
4498 06d71fa1 Peter Maydell
4499 3f4349dc Kevin Wolf
if test "$valgrind_h" = "yes" ; then
4500 3f4349dc Kevin Wolf
  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4501 3f4349dc Kevin Wolf
fi
4502 3f4349dc Kevin Wolf
4503 8ab1bf12 Luiz Capitulino
if test "$has_environ" = "yes" ; then
4504 8ab1bf12 Luiz Capitulino
  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
4505 e06a765e Harsh Prateek Bora
fi
4506 e06a765e Harsh Prateek Bora
4507 76a347e1 Richard Henderson
if test "$cpuid_h" = "yes" ; then
4508 76a347e1 Richard Henderson
  echo "CONFIG_CPUID_H=y" >> $config_host_mak
4509 76a347e1 Richard Henderson
fi
4510 76a347e1 Richard Henderson
4511 f540166b Richard Henderson
if test "$int128" = "yes" ; then
4512 f540166b Richard Henderson
  echo "CONFIG_INT128=y" >> $config_host_mak
4513 f540166b Richard Henderson
fi
4514 f540166b Richard Henderson
4515 1e6e9aca Richard Henderson
if test "$getauxval" = "yes" ; then
4516 1e6e9aca Richard Henderson
  echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4517 1e6e9aca Richard Henderson
fi
4518 1e6e9aca Richard Henderson
4519 eb100396 Bharata B Rao
if test "$glusterfs" = "yes" ; then
4520 d3399d7c Fam Zheng
  echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
4521 6ebc91e5 Fam Zheng
  echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
4522 6ebc91e5 Fam Zheng
  echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
4523 0c14fb47 Bharata B Rao
fi
4524 0c14fb47 Bharata B Rao
4525 0c14fb47 Bharata B Rao
if test "$glusterfs_discard" = "yes" ; then
4526 0c14fb47 Bharata B Rao
  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
4527 eb100396 Bharata B Rao
fi
4528 e06a765e Harsh Prateek Bora
4529 7c815372 Bharata B Rao
if test "$glusterfs_zerofill" = "yes" ; then
4530 7c815372 Bharata B Rao
  echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4531 7c815372 Bharata B Rao
fi
4532 7c815372 Bharata B Rao
4533 d0277315 Chrysostomos Nanakos
if test "$archipelago" = "yes" ; then
4534 d0277315 Chrysostomos Nanakos
  echo "CONFIG_ARCHIPELAGO=y" >> $config_host_mak
4535 d0277315 Chrysostomos Nanakos
fi
4536 d0277315 Chrysostomos Nanakos
4537 0a12ec87 Richard W.M. Jones
if test "$libssh2" = "yes" ; then
4538 d3399d7c Fam Zheng
  echo "CONFIG_LIBSSH2=m" >> $config_host_mak
4539 6ebc91e5 Fam Zheng
  echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4540 6ebc91e5 Fam Zheng
  echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
4541 0a12ec87 Richard W.M. Jones
fi
4542 0a12ec87 Richard W.M. Jones
4543 95c6bff3 Benoît Canet
if test "$quorum" = "yes" ; then
4544 95c6bff3 Benoît Canet
  echo "CONFIG_QUORUM=y" >> $config_host_mak
4545 95c6bff3 Benoît Canet
fi
4546 95c6bff3 Benoît Canet
4547 583f6e7b Stefan Hajnoczi
if test "$virtio_blk_data_plane" = "yes" ; then
4548 6e790746 Paolo Bonzini
  echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
4549 583f6e7b Stefan Hajnoczi
fi
4550 583f6e7b Stefan Hajnoczi
4551 4f18b782 Jeff Cody
if test "$vhdx" = "yes" ; then
4552 4f18b782 Jeff Cody
  echo "CONFIG_VHDX=y" >> $config_host_mak
4553 4f18b782 Jeff Cody
fi
4554 4f18b782 Jeff Cody
4555 68063649 blueswir1
# USB host support
4556 b5613fdc Gerd Hoffmann
if test "$libusb" = "yes"; then
4557 b5613fdc Gerd Hoffmann
  echo "HOST_USB=libusb legacy" >> $config_host_mak
4558 b5613fdc Gerd Hoffmann
else
4559 98ec69ac Juan Quintela
  echo "HOST_USB=stub" >> $config_host_mak
4560 b5613fdc Gerd Hoffmann
fi
4561 68063649 blueswir1
4562 3b8acc11 Paolo Bonzini
# TPM passthrough support?
4563 3b8acc11 Paolo Bonzini
if test "$tpm" = "yes"; then
4564 3b8acc11 Paolo Bonzini
  echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4565 3b8acc11 Paolo Bonzini
  if test "$tpm_passthrough" = "yes"; then
4566 3b8acc11 Paolo Bonzini
    echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4567 3b8acc11 Paolo Bonzini
  fi
4568 3b8acc11 Paolo Bonzini
fi
4569 3b8acc11 Paolo Bonzini
4570 e4858974 Lluís
# use default implementation for tracing backend-specific routines
4571 e4858974 Lluís
trace_default=yes
4572 94a420b1 Stefan Hajnoczi
echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
4573 6d8a764e Lluís
if test "$trace_backend" = "nop"; then
4574 6d8a764e Lluís
  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
4575 22890ab5 Prerna Saxena
fi
4576 9410b56c Prerna Saxena
if test "$trace_backend" = "simple"; then
4577 6d8a764e Lluís
  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
4578 e4858974 Lluís
  trace_default=no
4579 6d8a764e Lluís
  # Set the appropriate trace file.
4580 953ffe0f Andreas Färber
  trace_file="\"$trace_file-\" FMT_pid"
4581 9410b56c Prerna Saxena
fi
4582 6d8a764e Lluís
if test "$trace_backend" = "stderr"; then
4583 6d8a764e Lluís
  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
4584 9a82b6a5 Lluís
  trace_default=no
4585 6d8a764e Lluís
fi
4586 6d8a764e Lluís
if test "$trace_backend" = "ust"; then
4587 6d8a764e Lluís
  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4588 6d8a764e Lluís
fi
4589 6d8a764e Lluís
if test "$trace_backend" = "dtrace"; then
4590 6d8a764e Lluís
  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4591 6d8a764e Lluís
  if test "$trace_backend_stap" = "yes" ; then
4592 6d8a764e Lluís
    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4593 6d8a764e Lluís
  fi
4594 c276b17d Daniel P. Berrange
fi
4595 781e9545 Eiichi Tsukata
if test "$trace_backend" = "ftrace"; then
4596 781e9545 Eiichi Tsukata
  if test "$linux" = "yes" ; then
4597 781e9545 Eiichi Tsukata
    echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4598 781e9545 Eiichi Tsukata
    trace_default=no
4599 781e9545 Eiichi Tsukata
  else
4600 21684af0 Stewart Smith
    feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
4601 781e9545 Eiichi Tsukata
  fi
4602 781e9545 Eiichi Tsukata
fi
4603 9410b56c Prerna Saxena
echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
4604 e4858974 Lluís
if test "$trace_default" = "yes"; then
4605 e4858974 Lluís
  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4606 e4858974 Lluís
fi
4607 9410b56c Prerna Saxena
4608 2da776db Michael R. Hines
if test "$rdma" = "yes" ; then
4609 2da776db Michael R. Hines
  echo "CONFIG_RDMA=y" >> $config_host_mak
4610 2da776db Michael R. Hines
fi
4611 2da776db Michael R. Hines
4612 5b5e3037 Paolo Bonzini
if test "$tcg_interpreter" = "yes"; then
4613 5b5e3037 Paolo Bonzini
  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4614 5b5e3037 Paolo Bonzini
elif test "$ARCH" = "sparc64" ; then
4615 5b5e3037 Paolo Bonzini
  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4616 5b5e3037 Paolo Bonzini
elif test "$ARCH" = "s390x" ; then
4617 5b5e3037 Paolo Bonzini
  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
4618 c72b26ec Richard Henderson
elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
4619 5b5e3037 Paolo Bonzini
  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4620 5b5e3037 Paolo Bonzini
else
4621 5b5e3037 Paolo Bonzini
  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4622 5b5e3037 Paolo Bonzini
fi
4623 5b5e3037 Paolo Bonzini
QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4624 5b5e3037 Paolo Bonzini
4625 98ec69ac Juan Quintela
echo "TOOLS=$tools" >> $config_host_mak
4626 98ec69ac Juan Quintela
echo "ROMS=$roms" >> $config_host_mak
4627 804edf29 Juan Quintela
echo "MAKE=$make" >> $config_host_mak
4628 804edf29 Juan Quintela
echo "INSTALL=$install" >> $config_host_mak
4629 1901cb14 Brad
echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4630 1901cb14 Brad
echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
4631 21655882 Paolo Bonzini
if test -n "$libtool"; then
4632 21655882 Paolo Bonzini
  echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4633 21655882 Paolo Bonzini
  echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4634 21655882 Paolo Bonzini
else
4635 21655882 Paolo Bonzini
  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4636 21655882 Paolo Bonzini
  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4637 21655882 Paolo Bonzini
fi
4638 c886edfb Blue Swirl
echo "PYTHON=$python" >> $config_host_mak
4639 804edf29 Juan Quintela
echo "CC=$cc" >> $config_host_mak
4640 a31a8642 Michael S. Tsirkin
if $iasl -h > /dev/null 2>&1; then
4641 a31a8642 Michael S. Tsirkin
  echo "IASL=$iasl" >> $config_host_mak
4642 a31a8642 Michael S. Tsirkin
fi
4643 2b2e59e6 Paolo Bonzini
echo "CC_I386=$cc_i386" >> $config_host_mak
4644 804edf29 Juan Quintela
echo "HOST_CC=$host_cc" >> $config_host_mak
4645 83f73fce Tomoki Sekiyama
echo "CXX=$cxx" >> $config_host_mak
4646 3c4a4d0d Peter Maydell
echo "OBJCC=$objcc" >> $config_host_mak
4647 804edf29 Juan Quintela
echo "AR=$ar" >> $config_host_mak
4648 45d285ab Peter Maydell
echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
4649 3dd46c78 Blue Swirl
echo "AS=$as" >> $config_host_mak
4650 3dd46c78 Blue Swirl
echo "CPP=$cpp" >> $config_host_mak
4651 804edf29 Juan Quintela
echo "OBJCOPY=$objcopy" >> $config_host_mak
4652 804edf29 Juan Quintela
echo "LD=$ld" >> $config_host_mak
4653 9fe6de94 Blue Swirl
echo "WINDRES=$windres" >> $config_host_mak
4654 44dc0ca3 Alon Levy
echo "LIBTOOL=$libtool" >> $config_host_mak
4655 e2a2ed06 Juan Quintela
echo "CFLAGS=$CFLAGS" >> $config_host_mak
4656 46eef33b Brad
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
4657 a558ee17 Juan Quintela
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
4658 f9728943 Paolo Bonzini
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
4659 e39f0062 Paolo Bonzini
if test "$sparse" = "yes" ; then
4660 e39f0062 Paolo Bonzini
  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
4661 e39f0062 Paolo Bonzini
  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
4662 e39f0062 Paolo Bonzini
  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4663 e39f0062 Paolo Bonzini
fi
4664 42da6041 Gerd Hoffmann
if test "$cross_prefix" != ""; then
4665 42da6041 Gerd Hoffmann
  echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
4666 42da6041 Gerd Hoffmann
else
4667 42da6041 Gerd Hoffmann
  echo "AUTOCONF_HOST := "                             >> $config_host_mak
4668 42da6041 Gerd Hoffmann
fi
4669 e2a2ed06 Juan Quintela
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
4670 46eef33b Brad
echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
4671 37746c5e Marc-André Lureau
echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
4672 73da375e Juan Quintela
echo "LIBS+=$LIBS" >> $config_host_mak
4673 3e2e0e6b Juan Quintela
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
4674 804edf29 Juan Quintela
echo "EXESUF=$EXESUF" >> $config_host_mak
4675 17969268 Fam Zheng
echo "DSOSUF=$DSOSUF" >> $config_host_mak
4676 17969268 Fam Zheng
echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
4677 957f1f99 Michael Roth
echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
4678 94dd53c5 Gerd Hoffmann
echo "POD2MAN=$POD2MAN" >> $config_host_mak
4679 cbdd1999 Paolo Bonzini
echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
4680 1d728c39 Blue Swirl
if test "$gcov" = "yes" ; then
4681 1d728c39 Blue Swirl
  echo "CONFIG_GCOV=y" >> $config_host_mak
4682 1d728c39 Blue Swirl
  echo "GCOV=$gcov_tool" >> $config_host_mak
4683 1d728c39 Blue Swirl
fi
4684 804edf29 Juan Quintela
4685 6efd7517 Peter Maydell
# use included Linux headers
4686 6efd7517 Peter Maydell
if test "$linux" = "yes" ; then
4687 a307beb6 Andreas Färber
  mkdir -p linux-headers
4688 6efd7517 Peter Maydell
  case "$cpu" in
4689 c72b26ec Richard Henderson
  i386|x86_64|x32)
4690 08312a63 Peter Maydell
    linux_arch=x86
4691 6efd7517 Peter Maydell
    ;;
4692 6efd7517 Peter Maydell
  ppcemb|ppc|ppc64)
4693 08312a63 Peter Maydell
    linux_arch=powerpc
4694 6efd7517 Peter Maydell
    ;;
4695 6efd7517 Peter Maydell
  s390x)
4696 08312a63 Peter Maydell
    linux_arch=s390
4697 08312a63 Peter Maydell
    ;;
4698 1f080313 Claudio Fontana
  aarch64)
4699 1f080313 Claudio Fontana
    linux_arch=arm64
4700 1f080313 Claudio Fontana
    ;;
4701 08312a63 Peter Maydell
  *)
4702 08312a63 Peter Maydell
    # For most CPUs the kernel architecture name and QEMU CPU name match.
4703 08312a63 Peter Maydell
    linux_arch="$cpu"
4704 6efd7517 Peter Maydell
    ;;
4705 6efd7517 Peter Maydell
  esac
4706 08312a63 Peter Maydell
    # For non-KVM architectures we will not have asm headers
4707 08312a63 Peter Maydell
    if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4708 08312a63 Peter Maydell
      symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4709 08312a63 Peter Maydell
    fi
4710 6efd7517 Peter Maydell
fi
4711 6efd7517 Peter Maydell
4712 1d14ffa9 bellard
for target in $target_list; do
4713 97a847bc bellard
target_dir="$target"
4714 25be210f Juan Quintela
config_target_mak=$target_dir/config-target.mak
4715 c1799a84 Paolo Bonzini
target_name=`echo $target | cut -d '-' -f 1`
4716 97a847bc bellard
target_bigendian="no"
4717 1f3d3c8f Juan Quintela
4718 c1799a84 Paolo Bonzini
case "$target_name" in
4719 d15a9c23 Anthony Green
  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
4720 ea2d6a39 Juan Quintela
  target_bigendian=yes
4721 ea2d6a39 Juan Quintela
  ;;
4722 ea2d6a39 Juan Quintela
esac
4723 97a847bc bellard
target_softmmu="no"
4724 997344f3 bellard
target_user_only="no"
4725 831b7825 ths
target_linux_user="no"
4726 84778508 blueswir1
target_bsd_user="no"
4727 9e407a85 pbrook
case "$target" in
4728 c1799a84 Paolo Bonzini
  ${target_name}-softmmu)
4729 9e407a85 pbrook
    target_softmmu="yes"
4730 9e407a85 pbrook
    ;;
4731 c1799a84 Paolo Bonzini
  ${target_name}-linux-user)
4732 9c7a4202 Blue Swirl
    if test "$linux" != "yes" ; then
4733 76ad07a4 Peter Maydell
      error_exit "Target '$target' is only available on a Linux host"
4734 9c7a4202 Blue Swirl
    fi
4735 9e407a85 pbrook
    target_user_only="yes"
4736 9e407a85 pbrook
    target_linux_user="yes"
4737 9e407a85 pbrook
    ;;
4738 c1799a84 Paolo Bonzini
  ${target_name}-bsd-user)
4739 9cf55765 Blue Swirl
    if test "$bsd" != "yes" ; then
4740 76ad07a4 Peter Maydell
      error_exit "Target '$target' is only available on a BSD host"
4741 9c7a4202 Blue Swirl
    fi
4742 84778508 blueswir1
    target_user_only="yes"
4743 84778508 blueswir1
    target_bsd_user="yes"
4744 84778508 blueswir1
    ;;
4745 9e407a85 pbrook
  *)
4746 76ad07a4 Peter Maydell
    error_exit "Target '$target' not recognised"
4747 9e407a85 pbrook
    exit 1
4748 9e407a85 pbrook
    ;;
4749 9e407a85 pbrook
esac
4750 831b7825 ths
4751 97a847bc bellard
mkdir -p $target_dir
4752 25be210f Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_target_mak
4753 de83cd02 bellard
4754 e5fe0c52 pbrook
bflt="no"
4755 c1799a84 Paolo Bonzini
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
4756 56aebc89 pbrook
gdb_xml_files=""
4757 7ba1e619 aliguori
4758 c1799a84 Paolo Bonzini
TARGET_ARCH="$target_name"
4759 6acff7da Juan Quintela
TARGET_BASE_ARCH=""
4760 e6e91b9c Juan Quintela
TARGET_ABI_DIR=""
4761 e73aae67 Juan Quintela
4762 c1799a84 Paolo Bonzini
case "$target_name" in
4763 2408a527 aurel32
  i386)
4764 2408a527 aurel32
  ;;
4765 2408a527 aurel32
  x86_64)
4766 6acff7da Juan Quintela
    TARGET_BASE_ARCH=i386
4767 2408a527 aurel32
  ;;
4768 2408a527 aurel32
  alpha)
4769 2408a527 aurel32
  ;;
4770 2408a527 aurel32
  arm|armeb)
4771 b498c8a0 Juan Quintela
    TARGET_ARCH=arm
4772 2408a527 aurel32
    bflt="yes"
4773 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
4774 2408a527 aurel32
  ;;
4775 6a49fa95 Alexander Graf
  aarch64)
4776 6a49fa95 Alexander Graf
    TARGET_BASE_ARCH=arm
4777 6a49fa95 Alexander Graf
    bflt="yes"
4778 6a669427 Peter Maydell
    gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
4779 6a49fa95 Alexander Graf
  ;;
4780 2408a527 aurel32
  cris)
4781 2408a527 aurel32
  ;;
4782 613a22c9 Michael Walle
  lm32)
4783 613a22c9 Michael Walle
  ;;
4784 2408a527 aurel32
  m68k)
4785 2408a527 aurel32
    bflt="yes"
4786 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
4787 2408a527 aurel32
  ;;
4788 877fdc12 Edgar E. Iglesias
  microblaze|microblazeel)
4789 877fdc12 Edgar E. Iglesias
    TARGET_ARCH=microblaze
4790 72b675ca Edgar E. Iglesias
    bflt="yes"
4791 72b675ca Edgar E. Iglesias
  ;;
4792 0adcffb1 Juan Quintela
  mips|mipsel)
4793 b498c8a0 Juan Quintela
    TARGET_ARCH=mips
4794 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
4795 2408a527 aurel32
  ;;
4796 2408a527 aurel32
  mipsn32|mipsn32el)
4797 597e2cec Richard Henderson
    TARGET_ARCH=mips64
4798 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
4799 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4800 597e2cec Richard Henderson
    echo "TARGET_ABI32=y" >> $config_target_mak
4801 2408a527 aurel32
  ;;
4802 2408a527 aurel32
  mips64|mips64el)
4803 b498c8a0 Juan Quintela
    TARGET_ARCH=mips64
4804 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
4805 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
4806 2408a527 aurel32
  ;;
4807 d15a9c23 Anthony Green
  moxie)
4808 d15a9c23 Anthony Green
  ;;
4809 e67db06e Jia Liu
  or32)
4810 e67db06e Jia Liu
    TARGET_ARCH=openrisc
4811 e67db06e Jia Liu
    TARGET_BASE_ARCH=openrisc
4812 e67db06e Jia Liu
  ;;
4813 2408a527 aurel32
  ppc)
4814 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4815 2408a527 aurel32
  ;;
4816 2408a527 aurel32
  ppcemb)
4817 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
4818 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
4819 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4820 2408a527 aurel32
  ;;
4821 2408a527 aurel32
  ppc64)
4822 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
4823 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
4824 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4825 2408a527 aurel32
  ;;
4826 2408a527 aurel32
  ppc64abi32)
4827 b498c8a0 Juan Quintela
    TARGET_ARCH=ppc64
4828 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
4829 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
4830 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
4831 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4832 2408a527 aurel32
  ;;
4833 2408a527 aurel32
  sh4|sh4eb)
4834 b498c8a0 Juan Quintela
    TARGET_ARCH=sh4
4835 2408a527 aurel32
    bflt="yes"
4836 2408a527 aurel32
  ;;
4837 2408a527 aurel32
  sparc)
4838 2408a527 aurel32
  ;;
4839 2408a527 aurel32
  sparc64)
4840 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
4841 2408a527 aurel32
  ;;
4842 2408a527 aurel32
  sparc32plus)
4843 b498c8a0 Juan Quintela
    TARGET_ARCH=sparc64
4844 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
4845 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=sparc
4846 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
4847 2408a527 aurel32
  ;;
4848 24e804ec Alexander Graf
  s390x)
4849 24e804ec Alexander Graf
  ;;
4850 d2fbca94 Guan Xuetao
  unicore32)
4851 d2fbca94 Guan Xuetao
  ;;
4852 cfa550c6 Max Filippov
  xtensa|xtensaeb)
4853 cfa550c6 Max Filippov
    TARGET_ARCH=xtensa
4854 cfa550c6 Max Filippov
  ;;
4855 2408a527 aurel32
  *)
4856 76ad07a4 Peter Maydell
    error_exit "Unsupported target CPU"
4857 2408a527 aurel32
  ;;
4858 2408a527 aurel32
esac
4859 5e8861a0 Paolo Bonzini
# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4860 5e8861a0 Paolo Bonzini
if [ "$TARGET_BASE_ARCH" = "" ]; then
4861 5e8861a0 Paolo Bonzini
  TARGET_BASE_ARCH=$TARGET_ARCH
4862 5e8861a0 Paolo Bonzini
fi
4863 5e8861a0 Paolo Bonzini
4864 5e8861a0 Paolo Bonzini
symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4865 5e8861a0 Paolo Bonzini
4866 99afc91d Daniel P. Berrange
upper() {
4867 99afc91d Daniel P. Berrange
    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4868 99afc91d Daniel P. Berrange
}
4869 99afc91d Daniel P. Berrange
4870 99afc91d Daniel P. Berrange
target_arch_name="`upper $TARGET_ARCH`"
4871 25be210f Juan Quintela
echo "TARGET_$target_arch_name=y" >> $config_target_mak
4872 c1799a84 Paolo Bonzini
echo "TARGET_NAME=$target_name" >> $config_target_mak
4873 25be210f Juan Quintela
echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4874 e6e91b9c Juan Quintela
if [ "$TARGET_ABI_DIR" = "" ]; then
4875 e6e91b9c Juan Quintela
  TARGET_ABI_DIR=$TARGET_ARCH
4876 e6e91b9c Juan Quintela
fi
4877 25be210f Juan Quintela
echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
4878 c1799a84 Paolo Bonzini
case "$target_name" in
4879 1b0c87fc Juan Quintela
  i386|x86_64)
4880 1b0c87fc Juan Quintela
    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
4881 25be210f Juan Quintela
      echo "CONFIG_XEN=y" >> $config_target_mak
4882 eb6fda0f Anthony PERARD
      if test "$xen_pci_passthrough" = yes; then
4883 eb6fda0f Anthony PERARD
        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4884 eb6fda0f Anthony PERARD
      fi
4885 1b0c87fc Juan Quintela
    fi
4886 59d21e53 Alexander Graf
    ;;
4887 59d21e53 Alexander Graf
  *)
4888 1b0c87fc Juan Quintela
esac
4889 c1799a84 Paolo Bonzini
case "$target_name" in
4890 70a5f682 Peter Maydell
  aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4891 c59249f9 Juan Quintela
    # Make sure the target and host cpus are compatible
4892 c59249f9 Juan Quintela
    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4893 c1799a84 Paolo Bonzini
      \( "$target_name" = "$cpu" -o \
4894 c1799a84 Paolo Bonzini
      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4895 c1799a84 Paolo Bonzini
      \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4896 c1799a84 Paolo Bonzini
      \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4897 c1799a84 Paolo Bonzini
      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4898 c1799a84 Paolo Bonzini
      \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
4899 c1799a84 Paolo Bonzini
      \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
4900 25be210f Juan Quintela
      echo "CONFIG_KVM=y" >> $config_target_mak
4901 1ba16968 Stefan Weil
      if test "$vhost_net" = "yes" ; then
4902 d5970055 Michael S. Tsirkin
        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4903 d5970055 Michael S. Tsirkin
      fi
4904 c59249f9 Juan Quintela
    fi
4905 c59249f9 Juan Quintela
esac
4906 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
4907 25be210f Juan Quintela
  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
4908 de83cd02 bellard
fi
4909 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
4910 25be210f Juan Quintela
  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4911 43ce4dfe bellard
fi
4912 997344f3 bellard
if test "$target_user_only" = "yes" ; then
4913 25be210f Juan Quintela
  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4914 a2c80be9 Stefan Weil
  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4915 997344f3 bellard
fi
4916 831b7825 ths
if test "$target_linux_user" = "yes" ; then
4917 25be210f Juan Quintela
  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4918 831b7825 ths
fi
4919 56aebc89 pbrook
list=""
4920 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
4921 56aebc89 pbrook
  for x in $gdb_xml_files; do
4922 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
4923 56aebc89 pbrook
  done
4924 3d0f1517 Juan Quintela
  echo "TARGET_XML_FILES=$list" >> $config_target_mak
4925 56aebc89 pbrook
fi
4926 97a847bc bellard
4927 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
4928 25be210f Juan Quintela
  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4929 e5fe0c52 pbrook
fi
4930 379f6698 Paul Brook
if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
4931 25be210f Juan Quintela
  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4932 379f6698 Paul Brook
fi
4933 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
4934 25be210f Juan Quintela
  echo "CONFIG_BSD_USER=y" >> $config_target_mak
4935 84778508 blueswir1
fi
4936 5b0753e0 bellard
4937 4afddb55 Juan Quintela
# generate QEMU_CFLAGS/LDFLAGS for targets
4938 fa282484 Juan Quintela
4939 4afddb55 Juan Quintela
cflags=""
4940 fa282484 Juan Quintela
ldflags=""
4941 9b8e111f Juan Quintela
4942 64656024 Juan Quintela
for i in $ARCH $TARGET_BASE_ARCH ; do
4943 64656024 Juan Quintela
  case "$i" in
4944 64656024 Juan Quintela
  alpha)
4945 25be210f Juan Quintela
    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
4946 76cad711 Paolo Bonzini
    echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
4947 64656024 Juan Quintela
  ;;
4948 64656024 Juan Quintela
  arm)
4949 25be210f Juan Quintela
    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
4950 76cad711 Paolo Bonzini
    echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
4951 999b53ec Claudio Fontana
    if test -n "${cxx}"; then
4952 999b53ec Claudio Fontana
      echo "CONFIG_ARM_A64_DIS=y"  >> $config_target_mak
4953 999b53ec Claudio Fontana
      echo "CONFIG_ARM_A64_DIS=y"  >> config-all-disas.mak
4954 999b53ec Claudio Fontana
    fi
4955 64656024 Juan Quintela
  ;;
4956 64656024 Juan Quintela
  cris)
4957 25be210f Juan Quintela
    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
4958 76cad711 Paolo Bonzini
    echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
4959 64656024 Juan Quintela
  ;;
4960 64656024 Juan Quintela
  hppa)
4961 25be210f Juan Quintela
    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
4962 76cad711 Paolo Bonzini
    echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
4963 64656024 Juan Quintela
  ;;
4964 c72b26ec Richard Henderson
  i386|x86_64|x32)
4965 25be210f Juan Quintela
    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
4966 76cad711 Paolo Bonzini
    echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
4967 64656024 Juan Quintela
  ;;
4968 903ec55c Aurelien Jarno
  ia64*)
4969 903ec55c Aurelien Jarno
    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
4970 76cad711 Paolo Bonzini
    echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4971 903ec55c Aurelien Jarno
  ;;
4972 79368f49 Michael Walle
  lm32)
4973 79368f49 Michael Walle
    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
4974 76cad711 Paolo Bonzini
    echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
4975 79368f49 Michael Walle
  ;;
4976 64656024 Juan Quintela
  m68k)
4977 25be210f Juan Quintela
    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
4978 76cad711 Paolo Bonzini
    echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
4979 64656024 Juan Quintela
  ;;
4980 877fdc12 Edgar E. Iglesias
  microblaze*)
4981 25be210f Juan Quintela
    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
4982 76cad711 Paolo Bonzini
    echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
4983 64656024 Juan Quintela
  ;;
4984 64656024 Juan Quintela
  mips*)
4985 25be210f Juan Quintela
    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
4986 76cad711 Paolo Bonzini
    echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
4987 64656024 Juan Quintela
  ;;
4988 d15a9c23 Anthony Green
  moxie*)
4989 d15a9c23 Anthony Green
    echo "CONFIG_MOXIE_DIS=y"  >> $config_target_mak
4990 d15a9c23 Anthony Green
    echo "CONFIG_MOXIE_DIS=y"  >> config-all-disas.mak
4991 d15a9c23 Anthony Green
  ;;
4992 e67db06e Jia Liu
  or32)
4993 e67db06e Jia Liu
    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
4994 76cad711 Paolo Bonzini
    echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4995 e67db06e Jia Liu
  ;;
4996 64656024 Juan Quintela
  ppc*)
4997 25be210f Juan Quintela
    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
4998 76cad711 Paolo Bonzini
    echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
4999 64656024 Juan Quintela
  ;;
5000 24e804ec Alexander Graf
  s390*)
5001 25be210f Juan Quintela
    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
5002 76cad711 Paolo Bonzini
    echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
5003 64656024 Juan Quintela
  ;;
5004 64656024 Juan Quintela
  sh4)
5005 25be210f Juan Quintela
    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
5006 76cad711 Paolo Bonzini
    echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
5007 64656024 Juan Quintela
  ;;
5008 64656024 Juan Quintela
  sparc*)
5009 25be210f Juan Quintela
    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
5010 76cad711 Paolo Bonzini
    echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
5011 64656024 Juan Quintela
  ;;
5012 cfa550c6 Max Filippov
  xtensa*)
5013 cfa550c6 Max Filippov
    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
5014 76cad711 Paolo Bonzini
    echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
5015 cfa550c6 Max Filippov
  ;;
5016 64656024 Juan Quintela
  esac
5017 64656024 Juan Quintela
done
5018 9195b2c2 Stefan Weil
if test "$tcg_interpreter" = "yes" ; then
5019 9195b2c2 Stefan Weil
  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
5020 76cad711 Paolo Bonzini
  echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
5021 9195b2c2 Stefan Weil
fi
5022 64656024 Juan Quintela
5023 6ee7126f Juan Quintela
case "$ARCH" in
5024 6ee7126f Juan Quintela
alpha)
5025 6ee7126f Juan Quintela
  # Ensure there's only a single GP
5026 6ee7126f Juan Quintela
  cflags="-msmall-data $cflags"
5027 6ee7126f Juan Quintela
;;
5028 6ee7126f Juan Quintela
esac
5029 6ee7126f Juan Quintela
5030 d02c1db3 Juan Quintela
if test "$gprof" = "yes" ; then
5031 25be210f Juan Quintela
  echo "TARGET_GPROF=yes" >> $config_target_mak
5032 d02c1db3 Juan Quintela
  if test "$target_linux_user" = "yes" ; then
5033 d02c1db3 Juan Quintela
    cflags="-p $cflags"
5034 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
5035 d02c1db3 Juan Quintela
  fi
5036 d02c1db3 Juan Quintela
  if test "$target_softmmu" = "yes" ; then
5037 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
5038 25be210f Juan Quintela
    echo "GPROF_CFLAGS=-p" >> $config_target_mak
5039 d02c1db3 Juan Quintela
  fi
5040 d02c1db3 Juan Quintela
fi
5041 d02c1db3 Juan Quintela
5042 9b8e111f Juan Quintela
if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
5043 964c6fa1 Richard Henderson
  ldflags="$ldflags $textseg_ldflags"
5044 fa282484 Juan Quintela
fi
5045 fa282484 Juan Quintela
5046 25be210f Juan Quintela
echo "LDFLAGS+=$ldflags" >> $config_target_mak
5047 25be210f Juan Quintela
echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
5048 fa282484 Juan Quintela
5049 97a847bc bellard
done # for target in $targets
5050 7d13299d bellard
5051 b776eca1 Gerd Hoffmann
if [ "$pixman" = "internal" ]; then
5052 b776eca1 Gerd Hoffmann
  echo "config-host.h: subdir-pixman" >> $config_host_mak
5053 b776eca1 Gerd Hoffmann
fi
5054 b776eca1 Gerd Hoffmann
5055 2da776db Michael R. Hines
if test "$rdma" = "yes" ; then
5056 2da776db Michael R. Hines
echo "CONFIG_RDMA=y" >> $config_host_mak
5057 2da776db Michael R. Hines
fi
5058 2da776db Michael R. Hines
5059 a540f158 Peter Crosthwaite
if [ "$dtc_internal" = "yes" ]; then
5060 a540f158 Peter Crosthwaite
  echo "config-host.h: subdir-dtc" >> $config_host_mak
5061 a540f158 Peter Crosthwaite
fi
5062 a540f158 Peter Crosthwaite
5063 d1807a4f Paolo Bonzini
# build tree in object directory in case the source is not in the current directory
5064 f93296ea Wenchao Xia
DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
5065 2b170eff Michael Tokarev
DIRS="$DIRS fsdev"
5066 9933c305 Christian Borntraeger
DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
5067 d1807a4f Paolo Bonzini
DIRS="$DIRS roms/seabios roms/vgabios"
5068 2dee8d54 Paolo Bonzini
DIRS="$DIRS qapi-generated"
5069 c09015dd Anthony Liguori
FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5070 c09015dd Anthony Liguori
FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
5071 aaa2ebc5 Andreas Färber
FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
5072 d1807a4f Paolo Bonzini
FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
5073 446b9165 Andreas Färber
FILES="$FILES pc-bios/spapr-rtas/Makefile"
5074 9933c305 Christian Borntraeger
FILES="$FILES pc-bios/s390-ccw/Makefile"
5075 d1807a4f Paolo Bonzini
FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
5076 4652b792 Jan Kiszka
FILES="$FILES pc-bios/qemu-icon.bmp"
5077 753d11f2 Richard Henderson
for bios_file in \
5078 753d11f2 Richard Henderson
    $source_path/pc-bios/*.bin \
5079 5acc2ec0 Gerd Hoffmann
    $source_path/pc-bios/*.aml \
5080 753d11f2 Richard Henderson
    $source_path/pc-bios/*.rom \
5081 753d11f2 Richard Henderson
    $source_path/pc-bios/*.dtb \
5082 e89e33e1 Dominik Dingel
    $source_path/pc-bios/*.img \
5083 753d11f2 Richard Henderson
    $source_path/pc-bios/openbios-* \
5084 753d11f2 Richard Henderson
    $source_path/pc-bios/palcode-*
5085 753d11f2 Richard Henderson
do
5086 d1807a4f Paolo Bonzini
    FILES="$FILES pc-bios/`basename $bios_file`"
5087 d1807a4f Paolo Bonzini
done
5088 c2304b52 Marcel Apfelbaum
for test_file in `find $source_path/tests/acpi-test-data -type f`
5089 c2304b52 Marcel Apfelbaum
do
5090 c2304b52 Marcel Apfelbaum
    FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5091 c2304b52 Marcel Apfelbaum
done
5092 d1807a4f Paolo Bonzini
mkdir -p $DIRS
5093 d1807a4f Paolo Bonzini
for f in $FILES ; do
5094 72b8b5a1 Stefan Weil
    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
5095 f9245e10 Peter Maydell
        symlink "$source_path/$f" "$f"
5096 f9245e10 Peter Maydell
    fi
5097 d1807a4f Paolo Bonzini
done
5098 1ad2134f Paul Brook
5099 c34ebfdc Anthony Liguori
# temporary config to build submodules
5100 2d9f27d2 Anthony Liguori
for rom in seabios vgabios ; do
5101 c34ebfdc Anthony Liguori
    config_mak=roms/$rom/config.mak
5102 37116c89 Stefan Weil
    echo "# Automatically generated by configure - do not modify" > $config_mak
5103 c34ebfdc Anthony Liguori
    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
5104 3dd46c78 Blue Swirl
    echo "AS=$as" >> $config_mak
5105 c34ebfdc Anthony Liguori
    echo "CC=$cc" >> $config_mak
5106 c34ebfdc Anthony Liguori
    echo "BCC=bcc" >> $config_mak
5107 3dd46c78 Blue Swirl
    echo "CPP=$cpp" >> $config_mak
5108 c34ebfdc Anthony Liguori
    echo "OBJCOPY=objcopy" >> $config_mak
5109 a31a8642 Michael S. Tsirkin
    echo "IASL=$iasl" >> $config_mak
5110 c34ebfdc Anthony Liguori
    echo "LD=$ld" >> $config_mak
5111 c34ebfdc Anthony Liguori
done
5112 c34ebfdc Anthony Liguori
5113 b40292e7 Jan Kiszka
if test "$docs" = "yes" ; then
5114 b40292e7 Jan Kiszka
  mkdir -p QMP
5115 b40292e7 Jan Kiszka
fi