Statistics
| Branch: | Revision:

root / configure @ 0834c9ea

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