Statistics
| Branch: | Revision:

root / configure @ 834574ea

History | View | Annotate | Download (111.6 kB)

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