Statistics
| Branch: | Revision:

root / configure @ 8c43a6f0

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