Statistics
| Branch: | Revision:

root / configure @ 39ac8455

History | View | Annotate | Download (85.4 kB)

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