Statistics
| Branch: | Revision:

root / configure @ 992aeb8e

History | View | Annotate | Download (109 kB)

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