Statistics
| Branch: | Revision:

root / configure @ a540f158

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