Statistics
| Branch: | Revision:

root / configure @ 41cb62c2

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