Statistics
| Branch: | Revision:

root / configure @ d1722a27

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