Statistics
| Branch: | Revision:

root / configure @ 01e26b0e

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