Statistics
| Branch: | Revision:

root / configure @ 93148aa5

History | View | Annotate | Download (97.9 kB)

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