Statistics
| Branch: | Revision:

root / configure @ 2f172849

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