Statistics
| Branch: | Revision:

root / configure @ 14015304

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