Statistics
| Branch: | Revision:

root / configure @ 758e8e38

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