Statistics
| Branch: | Revision:

root / configure @ 6b331efb

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