Statistics
| Branch: | Revision:

root / configure @ 85e8dab1

History | View | Annotate | Download (99.2 kB)

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