Statistics
| Branch: | Revision:

root / configure @ 44dc0ca3

History | View | Annotate | Download (90.8 kB)

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