Statistics
| Branch: | Revision:

root / configure @ 957f1f99

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