Statistics
| Branch: | Revision:

root / configure @ 83e6813a

History | View | Annotate | Download (124.4 kB)

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