Statistics
| Branch: | Revision:

root / configure @ 48bb3750

History | View | Annotate | Download (72.2 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 48bb3750 Richard Henderson
           host_guest_base="yes"
737 28d7cc49 Richard Henderson
           ;;
738 28d7cc49 Richard Henderson
    s390x)
739 28d7cc49 Richard Henderson
           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
740 28d7cc49 Richard Henderson
           LDFLAGS="-m64 $LDFLAGS"
741 48bb3750 Richard Henderson
           host_guest_base="yes"
742 76d83bde ths
           ;;
743 40293e58 bellard
    i386)
744 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
745 0c439cbf Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
746 c81da56e Juan Quintela
           helper_cflags="-fomit-frame-pointer"
747 379f6698 Paul Brook
           host_guest_base="yes"
748 40293e58 bellard
           ;;
749 40293e58 bellard
    x86_64)
750 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
751 0c439cbf Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
752 379f6698 Paul Brook
           host_guest_base="yes"
753 379f6698 Paul Brook
           ;;
754 379f6698 Paul Brook
    arm*)
755 379f6698 Paul Brook
           host_guest_base="yes"
756 40293e58 bellard
           ;;
757 f6548c0a malc
    ppc*)
758 f6548c0a malc
           host_guest_base="yes"
759 f6548c0a malc
           ;;
760 cc01cc8e Aurelien Jarno
    mips*)
761 cc01cc8e Aurelien Jarno
           host_guest_base="yes"
762 cc01cc8e Aurelien Jarno
           ;;
763 477ba620 Aurelien Jarno
    ia64*)
764 477ba620 Aurelien Jarno
           host_guest_base="yes"
765 477ba620 Aurelien Jarno
           ;;
766 fd76e73a Richard Henderson
    hppa*)
767 fd76e73a Richard Henderson
           host_guest_base="yes"
768 fd76e73a Richard Henderson
           ;;
769 3142255c blueswir1
esac
770 3142255c blueswir1
771 379f6698 Paul Brook
[ -z "$guest_base" ] && guest_base="$host_guest_base"
772 379f6698 Paul Brook
773 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
774 af5db58e pbrook
cat << EOF
775 af5db58e pbrook
776 af5db58e pbrook
Usage: configure [options]
777 af5db58e pbrook
Options: [defaults in brackets after descriptions]
778 af5db58e pbrook
779 af5db58e pbrook
EOF
780 af5db58e pbrook
echo "Standard options:"
781 af5db58e pbrook
echo "  --help                   print this message"
782 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
783 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
784 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
785 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
786 af5db58e pbrook
echo ""
787 af5db58e pbrook
echo "Advanced options (experts only):"
788 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
789 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
790 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
791 0bfe8cc0 Paolo Bonzini
echo "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
792 0bfe8cc0 Paolo Bonzini
echo "                           build time"
793 a558ee17 Juan Quintela
echo "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
794 e3fc14c3 Jan Kiszka
echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
795 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
796 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
797 af5db58e pbrook
echo "  --static                 enable static build [$static]"
798 0b24e75f Paolo Bonzini
echo "  --mandir=PATH            install man pages in PATH"
799 0b24e75f Paolo Bonzini
echo "  --datadir=PATH           install firmware in PATH"
800 0b24e75f Paolo Bonzini
echo "  --docdir=PATH            install documentation in PATH"
801 0b24e75f Paolo Bonzini
echo "  --bindir=PATH            install binaries in PATH"
802 0b24e75f Paolo Bonzini
echo "  --sysconfdir=PATH        install config in PATH/qemu"
803 f8393946 aurel32
echo "  --enable-debug-tcg       enable TCG debugging"
804 f8393946 aurel32
echo "  --disable-debug-tcg      disable TCG debugging (default)"
805 09695a4a Stefan Weil
echo "  --enable-debug           enable common debug build options"
806 890b1658 aliguori
echo "  --enable-sparse          enable sparse checker"
807 890b1658 aliguori
echo "  --disable-sparse         disable sparse checker (default)"
808 1625af87 aliguori
echo "  --disable-strip          disable stripping binaries"
809 85aa5189 bellard
echo "  --disable-werror         disable compilation abort on warning"
810 fe8f78e4 balrog
echo "  --disable-sdl            disable SDL"
811 c4198157 Juan Quintela
echo "  --enable-sdl             enable SDL"
812 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
813 c2de5c91 malc
echo "  --audio-drv-list=LIST    set audio drivers list:"
814 c2de5c91 malc
echo "                           Available drivers: $audio_possible_drivers"
815 4c9b53e3 malc
echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
816 4c9b53e3 malc
echo "                           Available cards: $audio_possible_cards"
817 eb852011 Markus Armbruster
echo "  --block-drv-whitelist=L  set block driver whitelist"
818 eb852011 Markus Armbruster
echo "                           (affects only QEMU, not qemu-img)"
819 8ff9cbf7 malc
echo "  --enable-mixemu          enable mixer emulation"
820 e37630ca aliguori
echo "  --disable-xen            disable xen backend driver support"
821 fc321b4b Juan Quintela
echo "  --enable-xen             enable xen backend driver support"
822 2e4d9fb1 aurel32
echo "  --disable-brlapi         disable BrlAPI"
823 4ffcedb6 Juan Quintela
echo "  --enable-brlapi          enable BrlAPI"
824 8d5d2d4c ths
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
825 1be10ad2 Juan Quintela
echo "  --enable-vnc-tls         enable TLS encryption for VNC server"
826 2f9606b3 aliguori
echo "  --disable-vnc-sasl       disable SASL encryption for VNC server"
827 ea784e3b Juan Quintela
echo "  --enable-vnc-sasl        enable SASL encryption for VNC server"
828 af896aaa pbrook
echo "  --disable-curses         disable curses output"
829 c584a6d0 Juan Quintela
echo "  --enable-curses          enable curses output"
830 769ce76d Alexander Graf
echo "  --disable-curl           disable curl connectivity"
831 788c8196 Juan Quintela
echo "  --enable-curl            enable curl connectivity"
832 2df87df7 Juan Quintela
echo "  --disable-fdt            disable fdt device tree"
833 2df87df7 Juan Quintela
echo "  --enable-fdt             enable fdt device tree"
834 5495ed11 Luiz Capitulino
echo "  --disable-check-utests   disable check unit-tests"
835 5495ed11 Luiz Capitulino
echo "  --enable-check-utests    enable check unit-tests"
836 fb599c9a balrog
echo "  --disable-bluez          disable bluez stack connectivity"
837 a20a6f46 Juan Quintela
echo "  --enable-bluez           enable bluez stack connectivity"
838 7ba1e619 aliguori
echo "  --disable-kvm            disable KVM acceleration support"
839 b31a0277 Juan Quintela
echo "  --enable-kvm             enable KVM acceleration support"
840 bd0c5661 pbrook
echo "  --disable-nptl           disable usermode NPTL support"
841 e5934d33 Andre Przywara
echo "  --enable-nptl            enable usermode NPTL support"
842 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
843 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
844 0953a80f Zachary Amsden
echo "  --enable-user            enable supported user emulation targets"
845 0953a80f Zachary Amsden
echo "  --disable-user           disable all user emulation targets"
846 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
847 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
848 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
849 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
850 84778508 blueswir1
echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
851 84778508 blueswir1
echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
852 379f6698 Paul Brook
echo "  --enable-guest-base      enable GUEST_BASE support for usermode"
853 379f6698 Paul Brook
echo "                           emulation targets"
854 379f6698 Paul Brook
echo "  --disable-guest-base     disable GUEST_BASE support"
855 34005a00 Kirill A. Shutemov
echo "  --enable-user-pie        build usermode emulation targets as PIE"
856 34005a00 Kirill A. Shutemov
echo "  --disable-user-pie       do not build usermode emulation targets as PIE"
857 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
858 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
859 2f6a1ab0 blueswir1
echo "  --oss-lib                path to OSS library"
860 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
861 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
862 ee682d27 Stefan Weil
echo "  --disable-uuid           disable uuid support"
863 ee682d27 Stefan Weil
echo "  --enable-uuid            enable uuid support"
864 e0e6c8c0 aliguori
echo "  --disable-vde            disable support for vde network"
865 dfb278bd Juan Quintela
echo "  --enable-vde             enable support for vde network"
866 5c6c3a6c Christoph Hellwig
echo "  --disable-linux-aio      disable Linux AIO support"
867 5c6c3a6c Christoph Hellwig
echo "  --enable-linux-aio       enable Linux AIO support"
868 758e8e38 Venkateswararao Jujjuri (JV)
echo "  --disable-attr           disables attr and xattr support"
869 758e8e38 Venkateswararao Jujjuri (JV)
echo "  --enable-attr            enable attr and xattr support"
870 e5d355d1 aliguori
echo "  --enable-io-thread       enable IO thread"
871 77755340 ths
echo "  --disable-blobs          disable installing provided firmware blobs"
872 eac30262 aliguori
echo "  --kerneldir=PATH         look for kernel includes in PATH"
873 d2807bc9 Dirk Ullrich
echo "  --enable-docs            enable documentation build"
874 d2807bc9 Dirk Ullrich
echo "  --disable-docs           disable documentation build"
875 d5970055 Michael S. Tsirkin
echo "  --disable-vhost-net      disable vhost-net acceleration support"
876 d5970055 Michael S. Tsirkin
echo "  --enable-vhost-net       enable vhost-net acceleration support"
877 af5db58e pbrook
echo ""
878 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
879 af5db58e pbrook
exit 1
880 af5db58e pbrook
fi
881 af5db58e pbrook
882 ec530c81 bellard
#
883 ec530c81 bellard
# Solaris specific configure tool chain decisions
884 ec530c81 bellard
#
885 ec530c81 bellard
if test "$solaris" = "yes" ; then
886 6792aa11 Loïc Minier
  if has $install; then
887 6792aa11 Loïc Minier
    :
888 6792aa11 Loïc Minier
  else
889 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
890 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
891 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
892 ec530c81 bellard
    exit 1
893 ec530c81 bellard
  fi
894 6792aa11 Loïc Minier
  if test "`path_of $install`" = "/usr/sbin/install" ; then
895 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
896 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
897 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
898 ec530c81 bellard
    exit 1
899 ec530c81 bellard
  fi
900 6792aa11 Loïc Minier
  if has ar; then
901 6792aa11 Loïc Minier
    :
902 6792aa11 Loïc Minier
  else
903 ec530c81 bellard
    echo "Error: No path includes ar"
904 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
905 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
906 ec530c81 bellard
    fi
907 ec530c81 bellard
    exit 1
908 ec530c81 bellard
  fi
909 5fafdf24 ths
fi
910 ec530c81 bellard
911 ec530c81 bellard
912 5327cf48 bellard
if test -z "$target_list" ; then
913 5327cf48 bellard
# these targets are portable
914 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
915 2408a527 aurel32
        target_list="\
916 2408a527 aurel32
i386-softmmu \
917 2408a527 aurel32
x86_64-softmmu \
918 2408a527 aurel32
arm-softmmu \
919 2408a527 aurel32
cris-softmmu \
920 2408a527 aurel32
m68k-softmmu \
921 72b675ca Edgar E. Iglesias
microblaze-softmmu \
922 2408a527 aurel32
mips-softmmu \
923 2408a527 aurel32
mipsel-softmmu \
924 2408a527 aurel32
mips64-softmmu \
925 2408a527 aurel32
mips64el-softmmu \
926 2408a527 aurel32
ppc-softmmu \
927 2408a527 aurel32
ppcemb-softmmu \
928 2408a527 aurel32
ppc64-softmmu \
929 2408a527 aurel32
sh4-softmmu \
930 2408a527 aurel32
sh4eb-softmmu \
931 2408a527 aurel32
sparc-softmmu \
932 1b64fcae Igor V. Kovalenko
sparc64-softmmu \
933 2408a527 aurel32
"
934 0a8e90f4 pbrook
    fi
935 5327cf48 bellard
# the following are Linux specific
936 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
937 2408a527 aurel32
        target_list="${target_list}\
938 2408a527 aurel32
i386-linux-user \
939 2408a527 aurel32
x86_64-linux-user \
940 2408a527 aurel32
alpha-linux-user \
941 2408a527 aurel32
arm-linux-user \
942 2408a527 aurel32
armeb-linux-user \
943 2408a527 aurel32
cris-linux-user \
944 2408a527 aurel32
m68k-linux-user \
945 72b675ca Edgar E. Iglesias
microblaze-linux-user \
946 2408a527 aurel32
mips-linux-user \
947 2408a527 aurel32
mipsel-linux-user \
948 2408a527 aurel32
ppc-linux-user \
949 2408a527 aurel32
ppc64-linux-user \
950 2408a527 aurel32
ppc64abi32-linux-user \
951 2408a527 aurel32
sh4-linux-user \
952 2408a527 aurel32
sh4eb-linux-user \
953 2408a527 aurel32
sparc-linux-user \
954 2408a527 aurel32
sparc64-linux-user \
955 2408a527 aurel32
sparc32plus-linux-user \
956 2408a527 aurel32
"
957 831b7825 ths
    fi
958 831b7825 ths
# the following are Darwin specific
959 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
960 6cdc7375 malc
        target_list="$target_list i386-darwin-user ppc-darwin-user "
961 5327cf48 bellard
    fi
962 84778508 blueswir1
# the following are BSD specific
963 84778508 blueswir1
    if [ "$bsd_user" = "yes" ] ; then
964 84778508 blueswir1
        target_list="${target_list}\
965 31fc12df blueswir1
i386-bsd-user \
966 31fc12df blueswir1
x86_64-bsd-user \
967 31fc12df blueswir1
sparc-bsd-user \
968 84778508 blueswir1
sparc64-bsd-user \
969 84778508 blueswir1
"
970 84778508 blueswir1
    fi
971 6e20a45f bellard
else
972 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
973 5327cf48 bellard
fi
974 0a8e90f4 pbrook
if test -z "$target_list" ; then
975 0a8e90f4 pbrook
    echo "No targets enabled"
976 0a8e90f4 pbrook
    exit 1
977 0a8e90f4 pbrook
fi
978 f55fe278 Paolo Bonzini
# see if system emulation was really requested
979 f55fe278 Paolo Bonzini
case " $target_list " in
980 f55fe278 Paolo Bonzini
  *"-softmmu "*) softmmu=yes
981 f55fe278 Paolo Bonzini
  ;;
982 f55fe278 Paolo Bonzini
  *) softmmu=no
983 f55fe278 Paolo Bonzini
  ;;
984 f55fe278 Paolo Bonzini
esac
985 5327cf48 bellard
986 249247c9 Juan Quintela
feature_not_found() {
987 249247c9 Juan Quintela
  feature=$1
988 249247c9 Juan Quintela
989 249247c9 Juan Quintela
  echo "ERROR"
990 249247c9 Juan Quintela
  echo "ERROR: User requested feature $feature"
991 9332f6a2 Sebastian Herbszt
  echo "ERROR: configure was not able to find it"
992 249247c9 Juan Quintela
  echo "ERROR"
993 249247c9 Juan Quintela
  exit 1;
994 249247c9 Juan Quintela
}
995 249247c9 Juan Quintela
996 7d13299d bellard
if test -z "$cross_prefix" ; then
997 7d13299d bellard
998 7d13299d bellard
# ---
999 7d13299d bellard
# big/little endian test
1000 7d13299d bellard
cat > $TMPC << EOF
1001 7d13299d bellard
#include <inttypes.h>
1002 7d13299d bellard
int main(int argc, char ** argv){
1003 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
1004 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
1005 7d13299d bellard
}
1006 7d13299d bellard
EOF
1007 7d13299d bellard
1008 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1009 7d13299d bellard
$TMPE && bigendian="yes"
1010 7d13299d bellard
else
1011 7d13299d bellard
echo big/little test failed
1012 7d13299d bellard
fi
1013 7d13299d bellard
1014 7d13299d bellard
else
1015 7d13299d bellard
1016 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
1017 ea8f20f8 Juan Quintela
case "$cpu" in
1018 24e804ec Alexander Graf
  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1019 ea8f20f8 Juan Quintela
    bigendian=yes
1020 ea8f20f8 Juan Quintela
  ;;
1021 ea8f20f8 Juan Quintela
esac
1022 7d13299d bellard
1023 7d13299d bellard
fi
1024 7d13299d bellard
1025 b6853697 bellard
# host long bits test
1026 b6853697 bellard
hostlongbits="32"
1027 ea8f20f8 Juan Quintela
case "$cpu" in
1028 24e804ec Alexander Graf
  x86_64|alpha|ia64|sparc64|ppc64|s390x)
1029 ea8f20f8 Juan Quintela
    hostlongbits=64
1030 ea8f20f8 Juan Quintela
  ;;
1031 ea8f20f8 Juan Quintela
esac
1032 b6853697 bellard
1033 b0a47e79 Juan Quintela
1034 b0a47e79 Juan Quintela
##########################################
1035 b0a47e79 Juan Quintela
# NPTL probe
1036 b0a47e79 Juan Quintela
1037 b0a47e79 Juan Quintela
if test "$nptl" != "no" ; then
1038 b0a47e79 Juan Quintela
  cat > $TMPC <<EOF
1039 bd0c5661 pbrook
#include <sched.h>
1040 30813cea pbrook
#include <linux/futex.h>
1041 bd0c5661 pbrook
void foo()
1042 bd0c5661 pbrook
{
1043 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1044 bd0c5661 pbrook
#error bork
1045 bd0c5661 pbrook
#endif
1046 bd0c5661 pbrook
}
1047 bd0c5661 pbrook
EOF
1048 bd0c5661 pbrook
1049 b0a47e79 Juan Quintela
  if compile_object ; then
1050 b0a47e79 Juan Quintela
    nptl=yes
1051 b0a47e79 Juan Quintela
  else
1052 b0a47e79 Juan Quintela
    if test "$nptl" = "yes" ; then
1053 b0a47e79 Juan Quintela
      feature_not_found "nptl"
1054 b0a47e79 Juan Quintela
    fi
1055 b0a47e79 Juan Quintela
    nptl=no
1056 b0a47e79 Juan Quintela
  fi
1057 bd0c5661 pbrook
fi
1058 bd0c5661 pbrook
1059 11d9f695 bellard
##########################################
1060 ac62922e balrog
# zlib check
1061 ac62922e balrog
1062 ac62922e balrog
cat > $TMPC << EOF
1063 ac62922e balrog
#include <zlib.h>
1064 ac62922e balrog
int main(void) { zlibVersion(); return 0; }
1065 ac62922e balrog
EOF
1066 52166aa0 Juan Quintela
if compile_prog "" "-lz" ; then
1067 ac62922e balrog
    :
1068 ac62922e balrog
else
1069 ac62922e balrog
    echo
1070 ac62922e balrog
    echo "Error: zlib check failed"
1071 ac62922e balrog
    echo "Make sure to have the zlib libs and headers installed."
1072 ac62922e balrog
    echo
1073 ac62922e balrog
    exit 1
1074 ac62922e balrog
fi
1075 ac62922e balrog
1076 ac62922e balrog
##########################################
1077 e37630ca aliguori
# xen probe
1078 e37630ca aliguori
1079 fc321b4b Juan Quintela
if test "$xen" != "no" ; then
1080 b2266bee Juan Quintela
  xen_libs="-lxenstore -lxenctrl -lxenguest"
1081 b2266bee Juan Quintela
  cat > $TMPC <<EOF
1082 e37630ca aliguori
#include <xenctrl.h>
1083 e37630ca aliguori
#include <xs.h>
1084 df7a607b Christoph Egger
int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1085 e37630ca aliguori
EOF
1086 52166aa0 Juan Quintela
  if compile_prog "" "$xen_libs" ; then
1087 fc321b4b Juan Quintela
    xen=yes
1088 3efd632b Juan Quintela
    libs_softmmu="$xen_libs $libs_softmmu"
1089 b2266bee Juan Quintela
  else
1090 fc321b4b Juan Quintela
    if test "$xen" = "yes" ; then
1091 fc321b4b Juan Quintela
      feature_not_found "xen"
1092 fc321b4b Juan Quintela
    fi
1093 fc321b4b Juan Quintela
    xen=no
1094 b2266bee Juan Quintela
  fi
1095 e37630ca aliguori
fi
1096 e37630ca aliguori
1097 e37630ca aliguori
##########################################
1098 f91672e5 Paolo Bonzini
# pkgconfig probe
1099 f91672e5 Paolo Bonzini
1100 f91672e5 Paolo Bonzini
pkgconfig="${cross_prefix}pkg-config"
1101 0dba6195 Loïc Minier
if ! has $pkgconfig; then
1102 f91672e5 Paolo Bonzini
  # likely not cross compiling, or hope for the best
1103 f91672e5 Paolo Bonzini
  pkgconfig=pkg-config
1104 f91672e5 Paolo Bonzini
fi
1105 f91672e5 Paolo Bonzini
1106 f91672e5 Paolo Bonzini
##########################################
1107 dfffc653 Juan Quintela
# Sparse probe
1108 dfffc653 Juan Quintela
if test "$sparse" != "no" ; then
1109 0dba6195 Loïc Minier
  if has cgcc; then
1110 dfffc653 Juan Quintela
    sparse=yes
1111 dfffc653 Juan Quintela
  else
1112 dfffc653 Juan Quintela
    if test "$sparse" = "yes" ; then
1113 dfffc653 Juan Quintela
      feature_not_found "sparse"
1114 dfffc653 Juan Quintela
    fi
1115 dfffc653 Juan Quintela
    sparse=no
1116 dfffc653 Juan Quintela
  fi
1117 dfffc653 Juan Quintela
fi
1118 dfffc653 Juan Quintela
1119 dfffc653 Juan Quintela
##########################################
1120 11d9f695 bellard
# SDL probe
1121 11d9f695 bellard
1122 fec0e3e8 Stefan Weil
# Look for sdl configuration program (pkg-config or sdl-config).
1123 fec0e3e8 Stefan Weil
# Prefer variant with cross prefix if cross compiling,
1124 fec0e3e8 Stefan Weil
# and favour pkg-config with sdl over sdl-config.
1125 fec0e3e8 Stefan Weil
if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1126 fec0e3e8 Stefan Weil
     $pkgconfig sdl --modversion >/dev/null 2>&1; then
1127 fec0e3e8 Stefan Weil
  sdlconfig="$pkgconfig sdl"
1128 fec0e3e8 Stefan Weil
  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1129 fec0e3e8 Stefan Weil
elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1130 fec0e3e8 Stefan Weil
  sdlconfig="${cross_prefix}sdl-config"
1131 fec0e3e8 Stefan Weil
  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1132 fec0e3e8 Stefan Weil
elif $pkgconfig sdl --modversion >/dev/null 2>&1; then
1133 9316f803 Paolo Bonzini
  sdlconfig="$pkgconfig sdl"
1134 9316f803 Paolo Bonzini
  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1135 0dba6195 Loïc Minier
elif has sdl-config; then
1136 9316f803 Paolo Bonzini
  sdlconfig='sdl-config'
1137 9316f803 Paolo Bonzini
  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1138 a0dfd8a4 Loïc Minier
else
1139 a0dfd8a4 Loïc Minier
  if test "$sdl" = "yes" ; then
1140 a0dfd8a4 Loïc Minier
    feature_not_found "sdl"
1141 a0dfd8a4 Loïc Minier
  fi
1142 a0dfd8a4 Loïc Minier
  sdl=no
1143 9316f803 Paolo Bonzini
fi
1144 11d9f695 bellard
1145 9316f803 Paolo Bonzini
sdl_too_old=no
1146 c4198157 Juan Quintela
if test "$sdl" != "no" ; then
1147 ac119f9d Juan Quintela
  cat > $TMPC << EOF
1148 11d9f695 bellard
#include <SDL.h>
1149 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
1150 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1151 11d9f695 bellard
EOF
1152 9316f803 Paolo Bonzini
  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
1153 74f42e18 TeLeMan
  if test "$static" = "yes" ; then
1154 74f42e18 TeLeMan
    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
1155 74f42e18 TeLeMan
  else
1156 74f42e18 TeLeMan
    sdl_libs=`$sdlconfig --libs 2> /dev/null`
1157 74f42e18 TeLeMan
  fi
1158 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1159 ac119f9d Juan Quintela
    if test "$_sdlversion" -lt 121 ; then
1160 ac119f9d Juan Quintela
      sdl_too_old=yes
1161 ac119f9d Juan Quintela
    else
1162 ac119f9d Juan Quintela
      if test "$cocoa" = "no" ; then
1163 ac119f9d Juan Quintela
        sdl=yes
1164 ac119f9d Juan Quintela
      fi
1165 ac119f9d Juan Quintela
    fi
1166 cd01b4a3 aliguori
1167 67c274d3 Paolo Bonzini
    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
1168 ac119f9d Juan Quintela
    if test "$sdl" = "yes" -a "$static" = "yes" ; then
1169 67c274d3 Paolo Bonzini
      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1170 f8aa6c7b Stefan Weil
         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1171 f8aa6c7b Stefan Weil
         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
1172 ac119f9d Juan Quintela
      fi
1173 52166aa0 Juan Quintela
      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1174 ac119f9d Juan Quintela
	:
1175 ac119f9d Juan Quintela
      else
1176 ac119f9d Juan Quintela
        sdl=no
1177 ac119f9d Juan Quintela
      fi
1178 ac119f9d Juan Quintela
    fi # static link
1179 c4198157 Juan Quintela
  else # sdl not found
1180 c4198157 Juan Quintela
    if test "$sdl" = "yes" ; then
1181 c4198157 Juan Quintela
      feature_not_found "sdl"
1182 c4198157 Juan Quintela
    fi
1183 c4198157 Juan Quintela
    sdl=no
1184 ac119f9d Juan Quintela
  fi # sdl compile test
1185 a68551bc Juan Quintela
fi
1186 11d9f695 bellard
1187 5368a422 aliguori
if test "$sdl" = "yes" ; then
1188 ac119f9d Juan Quintela
  cat > $TMPC <<EOF
1189 5368a422 aliguori
#include <SDL.h>
1190 5368a422 aliguori
#if defined(SDL_VIDEO_DRIVER_X11)
1191 5368a422 aliguori
#include <X11/XKBlib.h>
1192 5368a422 aliguori
#else
1193 5368a422 aliguori
#error No x11 support
1194 5368a422 aliguori
#endif
1195 5368a422 aliguori
int main(void) { return 0; }
1196 5368a422 aliguori
EOF
1197 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1198 ac119f9d Juan Quintela
    sdl_libs="$sdl_libs -lX11"
1199 ac119f9d Juan Quintela
  fi
1200 07d9ac44 Juan Quintela
  if test "$mingw32" = "yes" ; then
1201 07d9ac44 Juan Quintela
    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1202 07d9ac44 Juan Quintela
  fi
1203 0705667e Juan Quintela
  libs_softmmu="$sdl_libs $libs_softmmu"
1204 5368a422 aliguori
fi
1205 5368a422 aliguori
1206 8f28f3fb ths
##########################################
1207 8d5d2d4c ths
# VNC TLS detection
1208 1be10ad2 Juan Quintela
if test "$vnc_tls" != "no" ; then
1209 1be10ad2 Juan Quintela
  cat > $TMPC <<EOF
1210 ae6b5e5a aliguori
#include <gnutls/gnutls.h>
1211 ae6b5e5a aliguori
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1212 ae6b5e5a aliguori
EOF
1213 f91672e5 Paolo Bonzini
  vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1214 f91672e5 Paolo Bonzini
  vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
1215 1be10ad2 Juan Quintela
  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1216 1be10ad2 Juan Quintela
    vnc_tls=yes
1217 1be10ad2 Juan Quintela
    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1218 1be10ad2 Juan Quintela
  else
1219 1be10ad2 Juan Quintela
    if test "$vnc_tls" = "yes" ; then
1220 1be10ad2 Juan Quintela
      feature_not_found "vnc-tls"
1221 ae6b5e5a aliguori
    fi
1222 1be10ad2 Juan Quintela
    vnc_tls=no
1223 1be10ad2 Juan Quintela
  fi
1224 8d5d2d4c ths
fi
1225 8d5d2d4c ths
1226 8d5d2d4c ths
##########################################
1227 2f9606b3 aliguori
# VNC SASL detection
1228 3aefa744 Juan Quintela
if test "$vnc_sasl" != "no" ; then
1229 ea784e3b Juan Quintela
  cat > $TMPC <<EOF
1230 2f9606b3 aliguori
#include <sasl/sasl.h>
1231 2f9606b3 aliguori
#include <stdio.h>
1232 2f9606b3 aliguori
int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1233 2f9606b3 aliguori
EOF
1234 ea784e3b Juan Quintela
  # Assuming Cyrus-SASL installed in /usr prefix
1235 ea784e3b Juan Quintela
  vnc_sasl_cflags=""
1236 ea784e3b Juan Quintela
  vnc_sasl_libs="-lsasl2"
1237 ea784e3b Juan Quintela
  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1238 ea784e3b Juan Quintela
    vnc_sasl=yes
1239 ea784e3b Juan Quintela
    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1240 ea784e3b Juan Quintela
  else
1241 ea784e3b Juan Quintela
    if test "$vnc_sasl" = "yes" ; then
1242 ea784e3b Juan Quintela
      feature_not_found "vnc-sasl"
1243 2f9606b3 aliguori
    fi
1244 ea784e3b Juan Quintela
    vnc_sasl=no
1245 ea784e3b Juan Quintela
  fi
1246 2f9606b3 aliguori
fi
1247 2f9606b3 aliguori
1248 2f9606b3 aliguori
##########################################
1249 76655d6d aliguori
# fnmatch() probe, used for ACL routines
1250 76655d6d aliguori
fnmatch="no"
1251 76655d6d aliguori
cat > $TMPC << EOF
1252 76655d6d aliguori
#include <fnmatch.h>
1253 76655d6d aliguori
int main(void)
1254 76655d6d aliguori
{
1255 76655d6d aliguori
    fnmatch("foo", "foo", 0);
1256 76655d6d aliguori
    return 0;
1257 76655d6d aliguori
}
1258 76655d6d aliguori
EOF
1259 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1260 76655d6d aliguori
   fnmatch="yes"
1261 76655d6d aliguori
fi
1262 76655d6d aliguori
1263 76655d6d aliguori
##########################################
1264 ee682d27 Stefan Weil
# uuid_generate() probe, used for vdi block driver
1265 ee682d27 Stefan Weil
if test "$uuid" != "no" ; then
1266 ee682d27 Stefan Weil
  uuid_libs="-luuid"
1267 ee682d27 Stefan Weil
  cat > $TMPC << EOF
1268 ee682d27 Stefan Weil
#include <uuid/uuid.h>
1269 ee682d27 Stefan Weil
int main(void)
1270 ee682d27 Stefan Weil
{
1271 ee682d27 Stefan Weil
    uuid_t my_uuid;
1272 ee682d27 Stefan Weil
    uuid_generate(my_uuid);
1273 ee682d27 Stefan Weil
    return 0;
1274 ee682d27 Stefan Weil
}
1275 ee682d27 Stefan Weil
EOF
1276 ee682d27 Stefan Weil
  if compile_prog "" "$uuid_libs" ; then
1277 ee682d27 Stefan Weil
    uuid="yes"
1278 ee682d27 Stefan Weil
    libs_softmmu="$uuid_libs $libs_softmmu"
1279 ee682d27 Stefan Weil
    libs_tools="$uuid_libs $libs_tools"
1280 ee682d27 Stefan Weil
  else
1281 ee682d27 Stefan Weil
    if test "$uuid" = "yes" ; then
1282 ee682d27 Stefan Weil
      feature_not_found "uuid"
1283 ee682d27 Stefan Weil
    fi
1284 ee682d27 Stefan Weil
    uuid=no
1285 ee682d27 Stefan Weil
  fi
1286 ee682d27 Stefan Weil
fi
1287 ee682d27 Stefan Weil
1288 ee682d27 Stefan Weil
##########################################
1289 8a16d273 ths
# vde libraries probe
1290 dfb278bd Juan Quintela
if test "$vde" != "no" ; then
1291 4baae0ac Juan Quintela
  vde_libs="-lvdeplug"
1292 8a16d273 ths
  cat > $TMPC << EOF
1293 8a16d273 ths
#include <libvdeplug.h>
1294 4a7f0e06 pbrook
int main(void)
1295 4a7f0e06 pbrook
{
1296 4a7f0e06 pbrook
    struct vde_open_args a = {0, 0, 0};
1297 4a7f0e06 pbrook
    vde_open("", "", &a);
1298 4a7f0e06 pbrook
    return 0;
1299 4a7f0e06 pbrook
}
1300 8a16d273 ths
EOF
1301 52166aa0 Juan Quintela
  if compile_prog "" "$vde_libs" ; then
1302 4baae0ac Juan Quintela
    vde=yes
1303 8e02e54c Juan Quintela
    libs_softmmu="$vde_libs $libs_softmmu"
1304 8e02e54c Juan Quintela
    libs_tools="$vde_libs $libs_tools"
1305 dfb278bd Juan Quintela
  else
1306 dfb278bd Juan Quintela
    if test "$vde" = "yes" ; then
1307 dfb278bd Juan Quintela
      feature_not_found "vde"
1308 dfb278bd Juan Quintela
    fi
1309 dfb278bd Juan Quintela
    vde=no
1310 4baae0ac Juan Quintela
  fi
1311 8a16d273 ths
fi
1312 8a16d273 ths
1313 8a16d273 ths
##########################################
1314 c2de5c91 malc
# Sound support libraries probe
1315 8f28f3fb ths
1316 c2de5c91 malc
audio_drv_probe()
1317 c2de5c91 malc
{
1318 c2de5c91 malc
    drv=$1
1319 c2de5c91 malc
    hdr=$2
1320 c2de5c91 malc
    lib=$3
1321 c2de5c91 malc
    exp=$4
1322 c2de5c91 malc
    cfl=$5
1323 c2de5c91 malc
        cat > $TMPC << EOF
1324 c2de5c91 malc
#include <$hdr>
1325 c2de5c91 malc
int main(void) { $exp }
1326 8f28f3fb ths
EOF
1327 52166aa0 Juan Quintela
    if compile_prog "$cfl" "$lib" ; then
1328 c2de5c91 malc
        :
1329 c2de5c91 malc
    else
1330 c2de5c91 malc
        echo
1331 c2de5c91 malc
        echo "Error: $drv check failed"
1332 c2de5c91 malc
        echo "Make sure to have the $drv libs and headers installed."
1333 c2de5c91 malc
        echo
1334 c2de5c91 malc
        exit 1
1335 c2de5c91 malc
    fi
1336 c2de5c91 malc
}
1337 c2de5c91 malc
1338 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1339 c2de5c91 malc
for drv in $audio_drv_list; do
1340 c2de5c91 malc
    case $drv in
1341 c2de5c91 malc
    alsa)
1342 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1343 c2de5c91 malc
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1344 a4bf6780 Juan Quintela
    libs_softmmu="-lasound $libs_softmmu"
1345 c2de5c91 malc
    ;;
1346 c2de5c91 malc
1347 c2de5c91 malc
    fmod)
1348 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
1349 c2de5c91 malc
        echo
1350 c2de5c91 malc
        echo "Error: You must specify path to FMOD library and headers"
1351 c2de5c91 malc
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1352 c2de5c91 malc
        echo
1353 c2de5c91 malc
        exit 1
1354 c2de5c91 malc
    fi
1355 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1356 a4bf6780 Juan Quintela
    libs_softmmu="$fmod_lib $libs_softmmu"
1357 c2de5c91 malc
    ;;
1358 c2de5c91 malc
1359 c2de5c91 malc
    esd)
1360 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1361 a4bf6780 Juan Quintela
    libs_softmmu="-lesd $libs_softmmu"
1362 67f86e8e Juan Quintela
    audio_pt_int="yes"
1363 c2de5c91 malc
    ;;
1364 b8e59f18 malc
1365 b8e59f18 malc
    pa)
1366 493abda6 Aurelien Jarno
    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1367 b8e59f18 malc
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1368 493abda6 Aurelien Jarno
    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1369 67f86e8e Juan Quintela
    audio_pt_int="yes"
1370 b8e59f18 malc
    ;;
1371 b8e59f18 malc
1372 997e690a Juan Quintela
    coreaudio)
1373 997e690a Juan Quintela
      libs_softmmu="-framework CoreAudio $libs_softmmu"
1374 997e690a Juan Quintela
    ;;
1375 997e690a Juan Quintela
1376 a4bf6780 Juan Quintela
    dsound)
1377 a4bf6780 Juan Quintela
      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1378 d5631638 malc
      audio_win_int="yes"
1379 a4bf6780 Juan Quintela
    ;;
1380 a4bf6780 Juan Quintela
1381 a4bf6780 Juan Quintela
    oss)
1382 a4bf6780 Juan Quintela
      libs_softmmu="$oss_lib $libs_softmmu"
1383 a4bf6780 Juan Quintela
    ;;
1384 a4bf6780 Juan Quintela
1385 a4bf6780 Juan Quintela
    sdl|wav)
1386 2f6a1ab0 blueswir1
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1387 2f6a1ab0 blueswir1
    ;;
1388 2f6a1ab0 blueswir1
1389 d5631638 malc
    winwave)
1390 d5631638 malc
      libs_softmmu="-lwinmm $libs_softmmu"
1391 d5631638 malc
      audio_win_int="yes"
1392 d5631638 malc
    ;;
1393 d5631638 malc
1394 e4c63a6a malc
    *)
1395 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1396 e4c63a6a malc
        echo
1397 e4c63a6a malc
        echo "Error: Unknown driver '$drv' selected"
1398 e4c63a6a malc
        echo "Possible drivers are: $audio_possible_drivers"
1399 e4c63a6a malc
        echo
1400 e4c63a6a malc
        exit 1
1401 e4c63a6a malc
    }
1402 e4c63a6a malc
    ;;
1403 c2de5c91 malc
    esac
1404 c2de5c91 malc
done
1405 8f28f3fb ths
1406 4d3b6f6e balrog
##########################################
1407 2e4d9fb1 aurel32
# BrlAPI probe
1408 2e4d9fb1 aurel32
1409 4ffcedb6 Juan Quintela
if test "$brlapi" != "no" ; then
1410 eb82284f Juan Quintela
  brlapi_libs="-lbrlapi"
1411 eb82284f Juan Quintela
  cat > $TMPC << EOF
1412 2e4d9fb1 aurel32
#include <brlapi.h>
1413 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1414 2e4d9fb1 aurel32
EOF
1415 52166aa0 Juan Quintela
  if compile_prog "" "$brlapi_libs" ; then
1416 eb82284f Juan Quintela
    brlapi=yes
1417 264606b3 Juan Quintela
    libs_softmmu="$brlapi_libs $libs_softmmu"
1418 4ffcedb6 Juan Quintela
  else
1419 4ffcedb6 Juan Quintela
    if test "$brlapi" = "yes" ; then
1420 4ffcedb6 Juan Quintela
      feature_not_found "brlapi"
1421 4ffcedb6 Juan Quintela
    fi
1422 4ffcedb6 Juan Quintela
    brlapi=no
1423 eb82284f Juan Quintela
  fi
1424 eb82284f Juan Quintela
fi
1425 2e4d9fb1 aurel32
1426 2e4d9fb1 aurel32
##########################################
1427 4d3b6f6e balrog
# curses probe
1428 4f78ef9a Juan Quintela
curses_list="-lncurses -lcurses"
1429 4d3b6f6e balrog
1430 c584a6d0 Juan Quintela
if test "$curses" != "no" ; then
1431 c584a6d0 Juan Quintela
  curses_found=no
1432 4d3b6f6e balrog
  cat > $TMPC << EOF
1433 4d3b6f6e balrog
#include <curses.h>
1434 5a8ff3aa blueswir1
#ifdef __OpenBSD__
1435 5a8ff3aa blueswir1
#define resize_term resizeterm
1436 5a8ff3aa blueswir1
#endif
1437 5a8ff3aa blueswir1
int main(void) { resize_term(0, 0); return curses_version(); }
1438 4d3b6f6e balrog
EOF
1439 4f78ef9a Juan Quintela
  for curses_lib in $curses_list; do
1440 4f78ef9a Juan Quintela
    if compile_prog "" "$curses_lib" ; then
1441 c584a6d0 Juan Quintela
      curses_found=yes
1442 4f78ef9a Juan Quintela
      libs_softmmu="$curses_lib $libs_softmmu"
1443 4f78ef9a Juan Quintela
      break
1444 4f78ef9a Juan Quintela
    fi
1445 4f78ef9a Juan Quintela
  done
1446 c584a6d0 Juan Quintela
  if test "$curses_found" = "yes" ; then
1447 c584a6d0 Juan Quintela
    curses=yes
1448 c584a6d0 Juan Quintela
  else
1449 c584a6d0 Juan Quintela
    if test "$curses" = "yes" ; then
1450 c584a6d0 Juan Quintela
      feature_not_found "curses"
1451 c584a6d0 Juan Quintela
    fi
1452 c584a6d0 Juan Quintela
    curses=no
1453 c584a6d0 Juan Quintela
  fi
1454 4f78ef9a Juan Quintela
fi
1455 4d3b6f6e balrog
1456 414f0dab blueswir1
##########################################
1457 769ce76d Alexander Graf
# curl probe
1458 769ce76d Alexander Graf
1459 4e2b0658 Paolo Bonzini
if $pkgconfig libcurl --modversion >/dev/null 2>&1; then
1460 4e2b0658 Paolo Bonzini
  curlconfig="$pkgconfig libcurl"
1461 4e2b0658 Paolo Bonzini
else
1462 4e2b0658 Paolo Bonzini
  curlconfig=curl-config
1463 4e2b0658 Paolo Bonzini
fi
1464 4e2b0658 Paolo Bonzini
1465 788c8196 Juan Quintela
if test "$curl" != "no" ; then
1466 769ce76d Alexander Graf
  cat > $TMPC << EOF
1467 769ce76d Alexander Graf
#include <curl/curl.h>
1468 769ce76d Alexander Graf
int main(void) { return curl_easy_init(); }
1469 769ce76d Alexander Graf
EOF
1470 4e2b0658 Paolo Bonzini
  curl_cflags=`$curlconfig --cflags 2>/dev/null`
1471 4e2b0658 Paolo Bonzini
  curl_libs=`$curlconfig --libs 2>/dev/null`
1472 b1d5a277 Juan Quintela
  if compile_prog "$curl_cflags" "$curl_libs" ; then
1473 769ce76d Alexander Graf
    curl=yes
1474 f0302935 Juan Quintela
    libs_tools="$curl_libs $libs_tools"
1475 f0302935 Juan Quintela
    libs_softmmu="$curl_libs $libs_softmmu"
1476 788c8196 Juan Quintela
  else
1477 788c8196 Juan Quintela
    if test "$curl" = "yes" ; then
1478 788c8196 Juan Quintela
      feature_not_found "curl"
1479 788c8196 Juan Quintela
    fi
1480 788c8196 Juan Quintela
    curl=no
1481 769ce76d Alexander Graf
  fi
1482 769ce76d Alexander Graf
fi # test "$curl"
1483 769ce76d Alexander Graf
1484 769ce76d Alexander Graf
##########################################
1485 5495ed11 Luiz Capitulino
# check framework probe
1486 5495ed11 Luiz Capitulino
1487 5495ed11 Luiz Capitulino
if test "$check_utests" != "no" ; then
1488 5495ed11 Luiz Capitulino
  cat > $TMPC << EOF
1489 5495ed11 Luiz Capitulino
#include <check.h>
1490 5495ed11 Luiz Capitulino
int main(void) { suite_create("qemu test"); return 0; }
1491 5495ed11 Luiz Capitulino
EOF
1492 f91672e5 Paolo Bonzini
  check_libs=`$pkgconfig --libs check`
1493 5495ed11 Luiz Capitulino
  if compile_prog "" $check_libs ; then
1494 5495ed11 Luiz Capitulino
    check_utests=yes
1495 5495ed11 Luiz Capitulino
    libs_tools="$check_libs $libs_tools"
1496 5495ed11 Luiz Capitulino
  else
1497 5495ed11 Luiz Capitulino
    if test "$check_utests" = "yes" ; then
1498 5495ed11 Luiz Capitulino
      feature_not_found "check"
1499 5495ed11 Luiz Capitulino
    fi
1500 5495ed11 Luiz Capitulino
    check_utests=no
1501 5495ed11 Luiz Capitulino
  fi
1502 5495ed11 Luiz Capitulino
fi # test "$check_utests"
1503 5495ed11 Luiz Capitulino
1504 5495ed11 Luiz Capitulino
##########################################
1505 fb599c9a balrog
# bluez support probe
1506 a20a6f46 Juan Quintela
if test "$bluez" != "no" ; then
1507 e820e3f4 balrog
  cat > $TMPC << EOF
1508 e820e3f4 balrog
#include <bluetooth/bluetooth.h>
1509 e820e3f4 balrog
int main(void) { return bt_error(0); }
1510 e820e3f4 balrog
EOF
1511 f91672e5 Paolo Bonzini
  bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1512 f91672e5 Paolo Bonzini
  bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
1513 52166aa0 Juan Quintela
  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1514 a20a6f46 Juan Quintela
    bluez=yes
1515 e482d56a Juan Quintela
    libs_softmmu="$bluez_libs $libs_softmmu"
1516 e820e3f4 balrog
  else
1517 a20a6f46 Juan Quintela
    if test "$bluez" = "yes" ; then
1518 a20a6f46 Juan Quintela
      feature_not_found "bluez"
1519 a20a6f46 Juan Quintela
    fi
1520 e820e3f4 balrog
    bluez="no"
1521 e820e3f4 balrog
  fi
1522 fb599c9a balrog
fi
1523 fb599c9a balrog
1524 fb599c9a balrog
##########################################
1525 7ba1e619 aliguori
# kvm probe
1526 b31a0277 Juan Quintela
if test "$kvm" != "no" ; then
1527 7ba1e619 aliguori
    cat > $TMPC <<EOF
1528 7ba1e619 aliguori
#include <linux/kvm.h>
1529 9fd8d8d7 aliguori
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1530 7ba1e619 aliguori
#error Invalid KVM version
1531 7ba1e619 aliguori
#endif
1532 9fd8d8d7 aliguori
#if !defined(KVM_CAP_USER_MEMORY)
1533 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_USER_MEMORY
1534 9fd8d8d7 aliguori
#endif
1535 9fd8d8d7 aliguori
#if !defined(KVM_CAP_SET_TSS_ADDR)
1536 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1537 9fd8d8d7 aliguori
#endif
1538 9fd8d8d7 aliguori
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1539 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1540 9fd8d8d7 aliguori
#endif
1541 7ba1e619 aliguori
int main(void) { return 0; }
1542 7ba1e619 aliguori
EOF
1543 eac30262 aliguori
  if test "$kerneldir" != "" ; then
1544 eac30262 aliguori
      kvm_cflags=-I"$kerneldir"/include
1545 8444eb6e aliguori
      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1546 8444eb6e aliguori
         -a -d "$kerneldir/arch/x86/include" ; then
1547 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1548 406b430d aliguori
	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1549 406b430d aliguori
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1550 0e60a699 Alexander Graf
	elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
1551 0e60a699 Alexander Graf
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
1552 8444eb6e aliguori
        elif test -d "$kerneldir/arch/$cpu/include" ; then
1553 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1554 8444eb6e aliguori
      fi
1555 eac30262 aliguori
  else
1556 f038e8f7 Stefan Weil
    kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
1557 eac30262 aliguori
  fi
1558 52166aa0 Juan Quintela
  if compile_prog "$kvm_cflags" "" ; then
1559 b31a0277 Juan Quintela
    kvm=yes
1560 dae5079a Jan Kiszka
    cat > $TMPC <<EOF
1561 dae5079a Jan Kiszka
#include <linux/kvm_para.h>
1562 dae5079a Jan Kiszka
int main(void) { return 0; }
1563 dae5079a Jan Kiszka
EOF
1564 dae5079a Jan Kiszka
    if compile_prog "$kvm_cflags" "" ; then
1565 dae5079a Jan Kiszka
      kvm_para=yes
1566 dae5079a Jan Kiszka
    fi
1567 7ba1e619 aliguori
  else
1568 b31a0277 Juan Quintela
    if test "$kvm" = "yes" ; then
1569 0dba6195 Loïc Minier
      if has awk && has grep; then
1570 b31a0277 Juan Quintela
        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1571 9fd8d8d7 aliguori
	| grep "error: " \
1572 9fd8d8d7 aliguori
	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1573 b31a0277 Juan Quintela
        if test "$kvmerr" != "" ; then
1574 b31a0277 Juan Quintela
          echo -e "${kvmerr}\n\
1575 b31a0277 Juan Quintela
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1576 b31a0277 Juan Quintela
  recent kvm-kmod from http://sourceforge.net/projects/kvm."
1577 b31a0277 Juan Quintela
        fi
1578 9fd8d8d7 aliguori
      fi
1579 b31a0277 Juan Quintela
      feature_not_found "kvm"
1580 9fd8d8d7 aliguori
    fi
1581 b31a0277 Juan Quintela
    kvm=no
1582 7ba1e619 aliguori
  fi
1583 7ba1e619 aliguori
fi
1584 7ba1e619 aliguori
1585 7ba1e619 aliguori
##########################################
1586 d5970055 Michael S. Tsirkin
# test for vhost net
1587 d5970055 Michael S. Tsirkin
1588 d5970055 Michael S. Tsirkin
if test "$vhost_net" != "no"; then
1589 d5970055 Michael S. Tsirkin
    if test "$kvm" != "no"; then
1590 d5970055 Michael S. Tsirkin
            cat > $TMPC <<EOF
1591 d5970055 Michael S. Tsirkin
    #include <linux/vhost.h>
1592 d5970055 Michael S. Tsirkin
    int main(void) { return 0; }
1593 d5970055 Michael S. Tsirkin
EOF
1594 d5970055 Michael S. Tsirkin
            if compile_prog "$kvm_cflags" "" ; then
1595 d5970055 Michael S. Tsirkin
                vhost_net=yes
1596 d5970055 Michael S. Tsirkin
            else
1597 d5970055 Michael S. Tsirkin
                if test "$vhost_net" = "yes" ; then
1598 d5970055 Michael S. Tsirkin
                    feature_not_found "vhost-net"
1599 d5970055 Michael S. Tsirkin
                fi
1600 d5970055 Michael S. Tsirkin
                vhost_net=no
1601 d5970055 Michael S. Tsirkin
            fi
1602 d5970055 Michael S. Tsirkin
    else
1603 d5970055 Michael S. Tsirkin
            if test "$vhost_net" = "yes" ; then
1604 4021d247 Aurelien Jarno
                echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1605 d5970055 Michael S. Tsirkin
                feature_not_found "vhost-net"
1606 d5970055 Michael S. Tsirkin
            fi
1607 d5970055 Michael S. Tsirkin
            vhost_net=no
1608 d5970055 Michael S. Tsirkin
    fi
1609 d5970055 Michael S. Tsirkin
fi
1610 d5970055 Michael S. Tsirkin
1611 d5970055 Michael S. Tsirkin
##########################################
1612 e5d355d1 aliguori
# pthread probe
1613 de65fe0f Sebastian Herbszt
PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1614 3c529d93 aliguori
1615 4dd75c70 Christoph Hellwig
pthread=no
1616 e5d355d1 aliguori
cat > $TMPC << EOF
1617 3c529d93 aliguori
#include <pthread.h>
1618 de65fe0f Sebastian Herbszt
int main(void) { pthread_create(0,0,0,0); return 0; }
1619 414f0dab blueswir1
EOF
1620 4dd75c70 Christoph Hellwig
for pthread_lib in $PTHREADLIBS_LIST; do
1621 4dd75c70 Christoph Hellwig
  if compile_prog "" "$pthread_lib" ; then
1622 4dd75c70 Christoph Hellwig
    pthread=yes
1623 4dd75c70 Christoph Hellwig
    LIBS="$pthread_lib $LIBS"
1624 4dd75c70 Christoph Hellwig
    break
1625 4dd75c70 Christoph Hellwig
  fi
1626 4dd75c70 Christoph Hellwig
done
1627 414f0dab blueswir1
1628 4617e593 Anthony Liguori
if test "$mingw32" != yes -a "$pthread" = no; then
1629 4dd75c70 Christoph Hellwig
  echo
1630 4dd75c70 Christoph Hellwig
  echo "Error: pthread check failed"
1631 4dd75c70 Christoph Hellwig
  echo "Make sure to have the pthread libs and headers installed."
1632 4dd75c70 Christoph Hellwig
  echo
1633 4dd75c70 Christoph Hellwig
  exit 1
1634 e5d355d1 aliguori
fi
1635 e5d355d1 aliguori
1636 bf9298b9 aliguori
##########################################
1637 5c6c3a6c Christoph Hellwig
# linux-aio probe
1638 5c6c3a6c Christoph Hellwig
1639 5c6c3a6c Christoph Hellwig
if test "$linux_aio" != "no" ; then
1640 5c6c3a6c Christoph Hellwig
  cat > $TMPC <<EOF
1641 5c6c3a6c Christoph Hellwig
#include <libaio.h>
1642 5c6c3a6c Christoph Hellwig
#include <sys/eventfd.h>
1643 5c6c3a6c Christoph Hellwig
int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1644 5c6c3a6c Christoph Hellwig
EOF
1645 5c6c3a6c Christoph Hellwig
  if compile_prog "" "-laio" ; then
1646 5c6c3a6c Christoph Hellwig
    linux_aio=yes
1647 048d179f Paul Brook
    libs_softmmu="$libs_softmmu -laio"
1648 048d179f Paul Brook
    libs_tools="$libs_tools -laio"
1649 5c6c3a6c Christoph Hellwig
  else
1650 5c6c3a6c Christoph Hellwig
    if test "$linux_aio" = "yes" ; then
1651 5c6c3a6c Christoph Hellwig
      feature_not_found "linux AIO"
1652 5c6c3a6c Christoph Hellwig
    fi
1653 3cfcae3c Luiz Capitulino
    linux_aio=no
1654 5c6c3a6c Christoph Hellwig
  fi
1655 5c6c3a6c Christoph Hellwig
fi
1656 5c6c3a6c Christoph Hellwig
1657 5c6c3a6c Christoph Hellwig
##########################################
1658 758e8e38 Venkateswararao Jujjuri (JV)
# attr probe
1659 758e8e38 Venkateswararao Jujjuri (JV)
1660 758e8e38 Venkateswararao Jujjuri (JV)
if test "$attr" != "no" ; then
1661 758e8e38 Venkateswararao Jujjuri (JV)
  cat > $TMPC <<EOF
1662 758e8e38 Venkateswararao Jujjuri (JV)
#include <stdio.h>
1663 758e8e38 Venkateswararao Jujjuri (JV)
#include <sys/types.h>
1664 758e8e38 Venkateswararao Jujjuri (JV)
#include <attr/xattr.h>
1665 758e8e38 Venkateswararao Jujjuri (JV)
int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1666 758e8e38 Venkateswararao Jujjuri (JV)
EOF
1667 758e8e38 Venkateswararao Jujjuri (JV)
  if compile_prog "" "-lattr" ; then
1668 758e8e38 Venkateswararao Jujjuri (JV)
    attr=yes
1669 758e8e38 Venkateswararao Jujjuri (JV)
    LIBS="-lattr $LIBS"
1670 758e8e38 Venkateswararao Jujjuri (JV)
  else
1671 758e8e38 Venkateswararao Jujjuri (JV)
    if test "$attr" = "yes" ; then
1672 758e8e38 Venkateswararao Jujjuri (JV)
      feature_not_found "ATTR"
1673 758e8e38 Venkateswararao Jujjuri (JV)
    fi
1674 758e8e38 Venkateswararao Jujjuri (JV)
    attr=no
1675 758e8e38 Venkateswararao Jujjuri (JV)
  fi
1676 758e8e38 Venkateswararao Jujjuri (JV)
fi
1677 758e8e38 Venkateswararao Jujjuri (JV)
1678 758e8e38 Venkateswararao Jujjuri (JV)
##########################################
1679 bf9298b9 aliguori
# iovec probe
1680 bf9298b9 aliguori
cat > $TMPC <<EOF
1681 db34f0b3 blueswir1
#include <sys/types.h>
1682 bf9298b9 aliguori
#include <sys/uio.h>
1683 db34f0b3 blueswir1
#include <unistd.h>
1684 bf9298b9 aliguori
int main(void) { struct iovec iov; return 0; }
1685 bf9298b9 aliguori
EOF
1686 bf9298b9 aliguori
iovec=no
1687 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1688 bf9298b9 aliguori
  iovec=yes
1689 bf9298b9 aliguori
fi
1690 bf9298b9 aliguori
1691 f652e6af aurel32
##########################################
1692 ceb42de8 aliguori
# preadv probe
1693 ceb42de8 aliguori
cat > $TMPC <<EOF
1694 ceb42de8 aliguori
#include <sys/types.h>
1695 ceb42de8 aliguori
#include <sys/uio.h>
1696 ceb42de8 aliguori
#include <unistd.h>
1697 ceb42de8 aliguori
int main(void) { preadv; }
1698 ceb42de8 aliguori
EOF
1699 ceb42de8 aliguori
preadv=no
1700 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1701 ceb42de8 aliguori
  preadv=yes
1702 ceb42de8 aliguori
fi
1703 ceb42de8 aliguori
1704 ceb42de8 aliguori
##########################################
1705 f652e6af aurel32
# fdt probe
1706 2df87df7 Juan Quintela
if test "$fdt" != "no" ; then
1707 b41af4ba Juan Quintela
  fdt_libs="-lfdt"
1708 b41af4ba Juan Quintela
  cat > $TMPC << EOF
1709 f652e6af aurel32
int main(void) { return 0; }
1710 f652e6af aurel32
EOF
1711 52166aa0 Juan Quintela
  if compile_prog "" "$fdt_libs" ; then
1712 f652e6af aurel32
    fdt=yes
1713 e4782985 Juan Quintela
    libs_softmmu="$fdt_libs $libs_softmmu"
1714 2df87df7 Juan Quintela
  else
1715 2df87df7 Juan Quintela
    if test "$fdt" = "yes" ; then
1716 2df87df7 Juan Quintela
      feature_not_found "fdt"
1717 2df87df7 Juan Quintela
    fi
1718 2df87df7 Juan Quintela
    fdt=no
1719 f652e6af aurel32
  fi
1720 f652e6af aurel32
fi
1721 f652e6af aurel32
1722 3b3f24ad aurel32
#
1723 3b3f24ad aurel32
# Check for xxxat() functions when we are building linux-user
1724 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1725 3b3f24ad aurel32
# have syscall stubs for these implemented.
1726 3b3f24ad aurel32
#
1727 3b3f24ad aurel32
atfile=no
1728 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1729 3b3f24ad aurel32
#define _ATFILE_SOURCE
1730 3b3f24ad aurel32
#include <sys/types.h>
1731 3b3f24ad aurel32
#include <fcntl.h>
1732 3b3f24ad aurel32
#include <unistd.h>
1733 3b3f24ad aurel32
1734 3b3f24ad aurel32
int
1735 3b3f24ad aurel32
main(void)
1736 3b3f24ad aurel32
{
1737 3b3f24ad aurel32
	/* try to unlink nonexisting file */
1738 3b3f24ad aurel32
	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1739 3b3f24ad aurel32
}
1740 3b3f24ad aurel32
EOF
1741 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1742 67ba57f6 Riku Voipio
  atfile=yes
1743 3b3f24ad aurel32
fi
1744 3b3f24ad aurel32
1745 39386ac7 aurel32
# Check for inotify functions when we are building linux-user
1746 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1747 3b3f24ad aurel32
# have syscall stubs for these implemented.  In that case we
1748 3b3f24ad aurel32
# don't provide them even if kernel supports them.
1749 3b3f24ad aurel32
#
1750 3b3f24ad aurel32
inotify=no
1751 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1752 3b3f24ad aurel32
#include <sys/inotify.h>
1753 3b3f24ad aurel32
1754 3b3f24ad aurel32
int
1755 3b3f24ad aurel32
main(void)
1756 3b3f24ad aurel32
{
1757 3b3f24ad aurel32
	/* try to start inotify */
1758 8690e420 aurel32
	return inotify_init();
1759 3b3f24ad aurel32
}
1760 3b3f24ad aurel32
EOF
1761 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1762 67ba57f6 Riku Voipio
  inotify=yes
1763 3b3f24ad aurel32
fi
1764 3b3f24ad aurel32
1765 c05c7a73 Riku Voipio
inotify1=no
1766 c05c7a73 Riku Voipio
cat > $TMPC << EOF
1767 c05c7a73 Riku Voipio
#include <sys/inotify.h>
1768 c05c7a73 Riku Voipio
1769 c05c7a73 Riku Voipio
int
1770 c05c7a73 Riku Voipio
main(void)
1771 c05c7a73 Riku Voipio
{
1772 c05c7a73 Riku Voipio
    /* try to start inotify */
1773 c05c7a73 Riku Voipio
    return inotify_init1(0);
1774 c05c7a73 Riku Voipio
}
1775 c05c7a73 Riku Voipio
EOF
1776 c05c7a73 Riku Voipio
if compile_prog "" "" ; then
1777 c05c7a73 Riku Voipio
  inotify1=yes
1778 c05c7a73 Riku Voipio
fi
1779 c05c7a73 Riku Voipio
1780 ebc996f3 Riku Voipio
# check if utimensat and futimens are supported
1781 ebc996f3 Riku Voipio
utimens=no
1782 ebc996f3 Riku Voipio
cat > $TMPC << EOF
1783 ebc996f3 Riku Voipio
#define _ATFILE_SOURCE
1784 ebc996f3 Riku Voipio
#define _GNU_SOURCE
1785 ebc996f3 Riku Voipio
#include <stddef.h>
1786 ebc996f3 Riku Voipio
#include <fcntl.h>
1787 ebc996f3 Riku Voipio
1788 ebc996f3 Riku Voipio
int main(void)
1789 ebc996f3 Riku Voipio
{
1790 ebc996f3 Riku Voipio
    utimensat(AT_FDCWD, "foo", NULL, 0);
1791 ebc996f3 Riku Voipio
    futimens(0, NULL);
1792 ebc996f3 Riku Voipio
    return 0;
1793 ebc996f3 Riku Voipio
}
1794 ebc996f3 Riku Voipio
EOF
1795 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1796 ebc996f3 Riku Voipio
  utimens=yes
1797 ebc996f3 Riku Voipio
fi
1798 ebc996f3 Riku Voipio
1799 099d6b0f Riku Voipio
# check if pipe2 is there
1800 099d6b0f Riku Voipio
pipe2=no
1801 099d6b0f Riku Voipio
cat > $TMPC << EOF
1802 099d6b0f Riku Voipio
#define _GNU_SOURCE
1803 099d6b0f Riku Voipio
#include <unistd.h>
1804 099d6b0f Riku Voipio
#include <fcntl.h>
1805 099d6b0f Riku Voipio
1806 099d6b0f Riku Voipio
int main(void)
1807 099d6b0f Riku Voipio
{
1808 099d6b0f Riku Voipio
    int pipefd[2];
1809 099d6b0f Riku Voipio
    pipe2(pipefd, O_CLOEXEC);
1810 099d6b0f Riku Voipio
    return 0;
1811 099d6b0f Riku Voipio
}
1812 099d6b0f Riku Voipio
EOF
1813 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1814 099d6b0f Riku Voipio
  pipe2=yes
1815 099d6b0f Riku Voipio
fi
1816 099d6b0f Riku Voipio
1817 40ff6d7e Kevin Wolf
# check if accept4 is there
1818 40ff6d7e Kevin Wolf
accept4=no
1819 40ff6d7e Kevin Wolf
cat > $TMPC << EOF
1820 40ff6d7e Kevin Wolf
#define _GNU_SOURCE
1821 40ff6d7e Kevin Wolf
#include <sys/socket.h>
1822 40ff6d7e Kevin Wolf
#include <stddef.h>
1823 40ff6d7e Kevin Wolf
1824 40ff6d7e Kevin Wolf
int main(void)
1825 40ff6d7e Kevin Wolf
{
1826 40ff6d7e Kevin Wolf
    accept4(0, NULL, NULL, SOCK_CLOEXEC);
1827 40ff6d7e Kevin Wolf
    return 0;
1828 40ff6d7e Kevin Wolf
}
1829 40ff6d7e Kevin Wolf
EOF
1830 40ff6d7e Kevin Wolf
if compile_prog "" "" ; then
1831 40ff6d7e Kevin Wolf
  accept4=yes
1832 40ff6d7e Kevin Wolf
fi
1833 40ff6d7e Kevin Wolf
1834 3ce34dfb vibisreenivasan
# check if tee/splice is there. vmsplice was added same time.
1835 3ce34dfb vibisreenivasan
splice=no
1836 3ce34dfb vibisreenivasan
cat > $TMPC << EOF
1837 3ce34dfb vibisreenivasan
#define _GNU_SOURCE
1838 3ce34dfb vibisreenivasan
#include <unistd.h>
1839 3ce34dfb vibisreenivasan
#include <fcntl.h>
1840 3ce34dfb vibisreenivasan
#include <limits.h>
1841 3ce34dfb vibisreenivasan
1842 3ce34dfb vibisreenivasan
int main(void)
1843 3ce34dfb vibisreenivasan
{
1844 3ce34dfb vibisreenivasan
    int len, fd;
1845 3ce34dfb vibisreenivasan
    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1846 3ce34dfb vibisreenivasan
    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1847 3ce34dfb vibisreenivasan
    return 0;
1848 3ce34dfb vibisreenivasan
}
1849 3ce34dfb vibisreenivasan
EOF
1850 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1851 3ce34dfb vibisreenivasan
  splice=yes
1852 3ce34dfb vibisreenivasan
fi
1853 3ce34dfb vibisreenivasan
1854 c2882b96 Riku Voipio
# check if eventfd is supported
1855 c2882b96 Riku Voipio
eventfd=no
1856 c2882b96 Riku Voipio
cat > $TMPC << EOF
1857 c2882b96 Riku Voipio
#include <sys/eventfd.h>
1858 c2882b96 Riku Voipio
1859 c2882b96 Riku Voipio
int main(void)
1860 c2882b96 Riku Voipio
{
1861 c2882b96 Riku Voipio
    int efd = eventfd(0, 0);
1862 c2882b96 Riku Voipio
    return 0;
1863 c2882b96 Riku Voipio
}
1864 c2882b96 Riku Voipio
EOF
1865 c2882b96 Riku Voipio
if compile_prog "" "" ; then
1866 c2882b96 Riku Voipio
  eventfd=yes
1867 c2882b96 Riku Voipio
fi
1868 c2882b96 Riku Voipio
1869 d0927938 Ulrich Hecht
# check for fallocate
1870 d0927938 Ulrich Hecht
fallocate=no
1871 d0927938 Ulrich Hecht
cat > $TMPC << EOF
1872 d0927938 Ulrich Hecht
#include <fcntl.h>
1873 d0927938 Ulrich Hecht
1874 d0927938 Ulrich Hecht
int main(void)
1875 d0927938 Ulrich Hecht
{
1876 d0927938 Ulrich Hecht
    fallocate(0, 0, 0, 0);
1877 d0927938 Ulrich Hecht
    return 0;
1878 d0927938 Ulrich Hecht
}
1879 d0927938 Ulrich Hecht
EOF
1880 be17dc90 Michael S. Tsirkin
if compile_prog "$ARCH_CFLAGS" "" ; then
1881 d0927938 Ulrich Hecht
  fallocate=yes
1882 d0927938 Ulrich Hecht
fi
1883 d0927938 Ulrich Hecht
1884 d0927938 Ulrich Hecht
# check for dup3
1885 d0927938 Ulrich Hecht
dup3=no
1886 d0927938 Ulrich Hecht
cat > $TMPC << EOF
1887 d0927938 Ulrich Hecht
#include <unistd.h>
1888 d0927938 Ulrich Hecht
1889 d0927938 Ulrich Hecht
int main(void)
1890 d0927938 Ulrich Hecht
{
1891 d0927938 Ulrich Hecht
    dup3(0, 0, 0);
1892 d0927938 Ulrich Hecht
    return 0;
1893 d0927938 Ulrich Hecht
}
1894 d0927938 Ulrich Hecht
EOF
1895 78f5d726 Jan Kiszka
if compile_prog "" "" ; then
1896 d0927938 Ulrich Hecht
  dup3=yes
1897 d0927938 Ulrich Hecht
fi
1898 d0927938 Ulrich Hecht
1899 cc8ae6de pbrook
# Check if tools are available to build documentation.
1900 a25dba17 Juan Quintela
if test "$docs" != "no" ; then
1901 01668d98 Stefan Weil
  if has makeinfo && has pod2man; then
1902 a25dba17 Juan Quintela
    docs=yes
1903 83a3ab8b Juan Quintela
  else
1904 a25dba17 Juan Quintela
    if test "$docs" = "yes" ; then
1905 a25dba17 Juan Quintela
      feature_not_found "docs"
1906 83a3ab8b Juan Quintela
    fi
1907 a25dba17 Juan Quintela
    docs=no
1908 83a3ab8b Juan Quintela
  fi
1909 cc8ae6de pbrook
fi
1910 cc8ae6de pbrook
1911 f514f41c Stefan Weil
# Search for bswap_32 function
1912 6ae9a1f4 Juan Quintela
byteswap_h=no
1913 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1914 6ae9a1f4 Juan Quintela
#include <byteswap.h>
1915 6ae9a1f4 Juan Quintela
int main(void) { return bswap_32(0); }
1916 6ae9a1f4 Juan Quintela
EOF
1917 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1918 6ae9a1f4 Juan Quintela
  byteswap_h=yes
1919 6ae9a1f4 Juan Quintela
fi
1920 6ae9a1f4 Juan Quintela
1921 f514f41c Stefan Weil
# Search for bswap_32 function
1922 6ae9a1f4 Juan Quintela
bswap_h=no
1923 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1924 6ae9a1f4 Juan Quintela
#include <sys/endian.h>
1925 6ae9a1f4 Juan Quintela
#include <sys/types.h>
1926 6ae9a1f4 Juan Quintela
#include <machine/bswap.h>
1927 6ae9a1f4 Juan Quintela
int main(void) { return bswap32(0); }
1928 6ae9a1f4 Juan Quintela
EOF
1929 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1930 6ae9a1f4 Juan Quintela
  bswap_h=yes
1931 6ae9a1f4 Juan Quintela
fi
1932 6ae9a1f4 Juan Quintela
1933 da93a1fd aliguori
##########################################
1934 da93a1fd aliguori
# Do we need librt
1935 da93a1fd aliguori
cat > $TMPC <<EOF
1936 da93a1fd aliguori
#include <signal.h>
1937 da93a1fd aliguori
#include <time.h>
1938 da93a1fd aliguori
int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1939 da93a1fd aliguori
EOF
1940 da93a1fd aliguori
1941 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1942 07ffa4bd Juan Quintela
  :
1943 52166aa0 Juan Quintela
elif compile_prog "" "-lrt" ; then
1944 07ffa4bd Juan Quintela
  LIBS="-lrt $LIBS"
1945 da93a1fd aliguori
fi
1946 da93a1fd aliguori
1947 31ff504d Blue Swirl
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
1948 6362a53f Juan Quintela
        "$aix" != "yes" ; then
1949 6362a53f Juan Quintela
    libs_softmmu="-lutil $libs_softmmu"
1950 6362a53f Juan Quintela
fi
1951 6362a53f Juan Quintela
1952 de5071c5 Blue Swirl
##########################################
1953 de5071c5 Blue Swirl
# check if the compiler defines offsetof
1954 de5071c5 Blue Swirl
1955 de5071c5 Blue Swirl
need_offsetof=yes
1956 de5071c5 Blue Swirl
cat > $TMPC << EOF
1957 de5071c5 Blue Swirl
#include <stddef.h>
1958 de5071c5 Blue Swirl
int main(void) { struct s { int f; }; return offsetof(struct s, f); }
1959 de5071c5 Blue Swirl
EOF
1960 de5071c5 Blue Swirl
if compile_prog "" "" ; then
1961 de5071c5 Blue Swirl
    need_offsetof=no
1962 de5071c5 Blue Swirl
fi
1963 de5071c5 Blue Swirl
1964 5f6b9e8f Blue Swirl
##########################################
1965 747bbdf7 Blue Swirl
# check if the compiler understands attribute warn_unused_result
1966 747bbdf7 Blue Swirl
#
1967 747bbdf7 Blue Swirl
# This could be smarter, but gcc -Werror does not error out even when warning
1968 747bbdf7 Blue Swirl
# about attribute warn_unused_result
1969 747bbdf7 Blue Swirl
1970 747bbdf7 Blue Swirl
gcc_attribute_warn_unused_result=no
1971 747bbdf7 Blue Swirl
cat > $TMPC << EOF
1972 747bbdf7 Blue Swirl
#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
1973 747bbdf7 Blue Swirl
#error gcc 3.3 or older
1974 747bbdf7 Blue Swirl
#endif
1975 747bbdf7 Blue Swirl
int main(void) { return 0;}
1976 747bbdf7 Blue Swirl
EOF
1977 747bbdf7 Blue Swirl
if compile_prog "" ""; then
1978 747bbdf7 Blue Swirl
    gcc_attribute_warn_unused_result=yes
1979 747bbdf7 Blue Swirl
fi
1980 747bbdf7 Blue Swirl
1981 747bbdf7 Blue Swirl
##########################################
1982 5f6b9e8f Blue Swirl
# check if we have fdatasync
1983 5f6b9e8f Blue Swirl
1984 5f6b9e8f Blue Swirl
fdatasync=no
1985 5f6b9e8f Blue Swirl
cat > $TMPC << EOF
1986 5f6b9e8f Blue Swirl
#include <unistd.h>
1987 5f6b9e8f Blue Swirl
int main(void) { return fdatasync(0); }
1988 5f6b9e8f Blue Swirl
EOF
1989 5f6b9e8f Blue Swirl
if compile_prog "" "" ; then
1990 5f6b9e8f Blue Swirl
    fdatasync=yes
1991 5f6b9e8f Blue Swirl
fi
1992 5f6b9e8f Blue Swirl
1993 e86ecd4b Juan Quintela
# End of CC checks
1994 e86ecd4b Juan Quintela
# After here, no more $cc or $ld runs
1995 e86ecd4b Juan Quintela
1996 e86ecd4b Juan Quintela
if test "$debug" = "no" ; then
1997 1156c669 Juan Quintela
  CFLAGS="-O2 $CFLAGS"
1998 e86ecd4b Juan Quintela
fi
1999 a316e378 Juan Quintela
2000 e86ecd4b Juan Quintela
# Consult white-list to determine whether to enable werror
2001 e86ecd4b Juan Quintela
# by default.  Only enable by default for git builds
2002 20ff6c80 Anthony Liguori
z_version=`cut -f3 -d. $source_path/VERSION`
2003 20ff6c80 Anthony Liguori
2004 e86ecd4b Juan Quintela
if test -z "$werror" ; then
2005 e86ecd4b Juan Quintela
    if test "$z_version" = "50" -a \
2006 e86ecd4b Juan Quintela
        "$linux" = "yes" ; then
2007 e86ecd4b Juan Quintela
        werror="yes"
2008 e86ecd4b Juan Quintela
    else
2009 e86ecd4b Juan Quintela
        werror="no"
2010 e86ecd4b Juan Quintela
    fi
2011 e86ecd4b Juan Quintela
fi
2012 e86ecd4b Juan Quintela
2013 20ff6c80 Anthony Liguori
# Disable zero malloc errors for official releases unless explicitly told to
2014 20ff6c80 Anthony Liguori
# enable/disable
2015 20ff6c80 Anthony Liguori
if test -z "$zero_malloc" ; then
2016 20ff6c80 Anthony Liguori
    if test "$z_version" = "50" ; then
2017 20ff6c80 Anthony Liguori
	zero_malloc="no"
2018 20ff6c80 Anthony Liguori
    else
2019 20ff6c80 Anthony Liguori
	zero_malloc="yes"
2020 20ff6c80 Anthony Liguori
    fi
2021 20ff6c80 Anthony Liguori
fi
2022 20ff6c80 Anthony Liguori
2023 e86ecd4b Juan Quintela
if test "$werror" = "yes" ; then
2024 a558ee17 Juan Quintela
    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2025 e86ecd4b Juan Quintela
fi
2026 e86ecd4b Juan Quintela
2027 e86ecd4b Juan Quintela
if test "$solaris" = "no" ; then
2028 e86ecd4b Juan Quintela
    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
2029 1156c669 Juan Quintela
        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2030 e86ecd4b Juan Quintela
    fi
2031 e86ecd4b Juan Quintela
fi
2032 e86ecd4b Juan Quintela
2033 190e9c59 Paolo Bonzini
confdir=$sysconfdir$confsuffix
2034 e7b45cc4 Paolo Bonzini
2035 ca35f780 Paolo Bonzini
tools=
2036 ca35f780 Paolo Bonzini
if test "$softmmu" = yes ; then
2037 ca35f780 Paolo Bonzini
  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2038 ca35f780 Paolo Bonzini
  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2039 ca35f780 Paolo Bonzini
      tools="qemu-nbd\$(EXESUF) $tools"
2040 ca35f780 Paolo Bonzini
    if [ "$check_utests" = "yes" ]; then
2041 ca35f780 Paolo Bonzini
      tools="check-qint check-qstring check-qdict check-qlist $tools"
2042 ca35f780 Paolo Bonzini
      tools="check-qfloat check-qjson $tools"
2043 ca35f780 Paolo Bonzini
    fi
2044 ca35f780 Paolo Bonzini
  fi
2045 ca35f780 Paolo Bonzini
fi
2046 ca35f780 Paolo Bonzini
2047 ca35f780 Paolo Bonzini
# Mac OS X ships with a broken assembler
2048 ca35f780 Paolo Bonzini
roms=
2049 ca35f780 Paolo Bonzini
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2050 ca35f780 Paolo Bonzini
        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2051 ca35f780 Paolo Bonzini
        "$softmmu" = yes ; then
2052 ca35f780 Paolo Bonzini
  roms="optionrom"
2053 ca35f780 Paolo Bonzini
fi
2054 ca35f780 Paolo Bonzini
2055 ca35f780 Paolo Bonzini
2056 43ce4dfe bellard
echo "Install prefix    $prefix"
2057 f2b9e1e3 Paolo Bonzini
echo "BIOS directory    `eval echo $datadir`"
2058 f2b9e1e3 Paolo Bonzini
echo "binary directory  `eval echo $bindir`"
2059 1c0fd160 Aurelien Jarno
echo "config directory  `eval echo $sysconfdir`"
2060 11d9f695 bellard
if test "$mingw32" = "no" ; then
2061 f2b9e1e3 Paolo Bonzini
echo "Manual directory  `eval echo $mandir`"
2062 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
2063 11d9f695 bellard
fi
2064 5a67135a bellard
echo "Source path       $source_path"
2065 43ce4dfe bellard
echo "C compiler        $cc"
2066 83469015 bellard
echo "Host C compiler   $host_cc"
2067 0c439cbf Juan Quintela
echo "CFLAGS            $CFLAGS"
2068 a558ee17 Juan Quintela
echo "QEMU_CFLAGS       $QEMU_CFLAGS"
2069 0c439cbf Juan Quintela
echo "LDFLAGS           $LDFLAGS"
2070 43ce4dfe bellard
echo "make              $make"
2071 6a882643 pbrook
echo "install           $install"
2072 43ce4dfe bellard
echo "host CPU          $cpu"
2073 de83cd02 bellard
echo "host big endian   $bigendian"
2074 97a847bc bellard
echo "target list       $target_list"
2075 ade25b0d aurel32
echo "tcg debug enabled $debug_tcg"
2076 b4475aa2 Luiz Capitulino
echo "Mon debug enabled $debug_mon"
2077 43ce4dfe bellard
echo "gprof enabled     $gprof"
2078 03b4fe7d aliguori
echo "sparse enabled    $sparse"
2079 1625af87 aliguori
echo "strip binaries    $strip_opt"
2080 05c2a3e7 bellard
echo "profiler          $profiler"
2081 43ce4dfe bellard
echo "static build      $static"
2082 85aa5189 bellard
echo "-Werror enabled   $werror"
2083 5b0753e0 bellard
if test "$darwin" = "yes" ; then
2084 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
2085 5b0753e0 bellard
fi
2086 97a847bc bellard
echo "SDL support       $sdl"
2087 4d3b6f6e balrog
echo "curses support    $curses"
2088 769ce76d Alexander Graf
echo "curl support      $curl"
2089 5495ed11 Luiz Capitulino
echo "check support     $check_utests"
2090 67b915a5 bellard
echo "mingw32 support   $mingw32"
2091 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
2092 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
2093 eb852011 Markus Armbruster
echo "Block whitelist   $block_drv_whitelist"
2094 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
2095 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
2096 2f9606b3 aliguori
echo "VNC SASL support  $vnc_sasl"
2097 3142255c blueswir1
if test -n "$sparc_cpu"; then
2098 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
2099 3142255c blueswir1
fi
2100 e37630ca aliguori
echo "xen support       $xen"
2101 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
2102 a20a6f46 Juan Quintela
echo "bluez  support    $bluez"
2103 a25dba17 Juan Quintela
echo "Documentation     $docs"
2104 c5937220 pbrook
[ ! -z "$uname_release" ] && \
2105 c5937220 pbrook
echo "uname -r          $uname_release"
2106 bd0c5661 pbrook
echo "NPTL support      $nptl"
2107 379f6698 Paul Brook
echo "GUEST_BASE        $guest_base"
2108 34005a00 Kirill A. Shutemov
echo "PIE user targets  $user_pie"
2109 8a16d273 ths
echo "vde support       $vde"
2110 e5d355d1 aliguori
echo "IO thread         $io_thread"
2111 5c6c3a6c Christoph Hellwig
echo "Linux AIO support $linux_aio"
2112 758e8e38 Venkateswararao Jujjuri (JV)
echo "ATTR/XATTR support $attr"
2113 77755340 ths
echo "Install blobs     $blobs"
2114 b31a0277 Juan Quintela
echo "KVM support       $kvm"
2115 f652e6af aurel32
echo "fdt support       $fdt"
2116 ceb42de8 aliguori
echo "preadv support    $preadv"
2117 5f6b9e8f Blue Swirl
echo "fdatasync         $fdatasync"
2118 ee682d27 Stefan Weil
echo "uuid support      $uuid"
2119 d5970055 Michael S. Tsirkin
echo "vhost-net support $vhost_net"
2120 67b915a5 bellard
2121 97a847bc bellard
if test $sdl_too_old = "yes"; then
2122 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
2123 7c1f25b4 bellard
fi
2124 7d13299d bellard
2125 98ec69ac Juan Quintela
config_host_mak="config-host.mak"
2126 4bf6b55b Juan Quintela
config_host_ld="config-host.ld"
2127 98ec69ac Juan Quintela
2128 98ec69ac Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_host_mak
2129 98ec69ac Juan Quintela
printf "# Configured with:" >> $config_host_mak
2130 98ec69ac Juan Quintela
printf " '%s'" "$0" "$@" >> $config_host_mak
2131 98ec69ac Juan Quintela
echo >> $config_host_mak
2132 98ec69ac Juan Quintela
2133 99d7cc75 Paolo Bonzini
echo "prefix=$prefix" >> $config_host_mak
2134 99d7cc75 Paolo Bonzini
echo "bindir=$bindir" >> $config_host_mak
2135 99d7cc75 Paolo Bonzini
echo "mandir=$mandir" >> $config_host_mak
2136 99d7cc75 Paolo Bonzini
echo "datadir=$datadir" >> $config_host_mak
2137 99d7cc75 Paolo Bonzini
echo "sysconfdir=$sysconfdir" >> $config_host_mak
2138 99d7cc75 Paolo Bonzini
echo "docdir=$docdir" >> $config_host_mak
2139 1dabe05c Paolo Bonzini
echo "confdir=$confdir" >> $config_host_mak
2140 804edf29 Juan Quintela
2141 2408a527 aurel32
case "$cpu" in
2142 24e804ec Alexander Graf
  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2143 e0da9dd3 Juan Quintela
    ARCH=$cpu
2144 2408a527 aurel32
  ;;
2145 a302c32d Laurent Desnogues
  armv4b|armv4l)
2146 16dbd14f Juan Quintela
    ARCH=arm
2147 2408a527 aurel32
  ;;
2148 2408a527 aurel32
esac
2149 98ec69ac Juan Quintela
echo "ARCH=$ARCH" >> $config_host_mak
2150 f8393946 aurel32
if test "$debug_tcg" = "yes" ; then
2151 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2152 f8393946 aurel32
fi
2153 b4475aa2 Luiz Capitulino
if test "$debug_mon" = "yes" ; then
2154 b4475aa2 Luiz Capitulino
  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2155 b4475aa2 Luiz Capitulino
fi
2156 f3d08ee6 Paul Brook
if test "$debug" = "yes" ; then
2157 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2158 f3d08ee6 Paul Brook
fi
2159 1625af87 aliguori
if test "$strip_opt" = "yes" ; then
2160 98ec69ac Juan Quintela
  echo "STRIP_OPT=-s" >> $config_host_mak
2161 1625af87 aliguori
fi
2162 7d13299d bellard
if test "$bigendian" = "yes" ; then
2163 e2542fe2 Juan Quintela
  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
2164 97a847bc bellard
fi
2165 2358a494 Juan Quintela
echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
2166 67b915a5 bellard
if test "$mingw32" = "yes" ; then
2167 98ec69ac Juan Quintela
  echo "CONFIG_WIN32=y" >> $config_host_mak
2168 210fa556 pbrook
else
2169 35f4df27 Juan Quintela
  echo "CONFIG_POSIX=y" >> $config_host_mak
2170 dffcb71c Mark McLoughlin
fi
2171 dffcb71c Mark McLoughlin
2172 dffcb71c Mark McLoughlin
if test "$linux" = "yes" ; then
2173 dffcb71c Mark McLoughlin
  echo "CONFIG_LINUX=y" >> $config_host_mak
2174 67b915a5 bellard
fi
2175 128ab2ff blueswir1
2176 83fb7adf bellard
if test "$darwin" = "yes" ; then
2177 98ec69ac Juan Quintela
  echo "CONFIG_DARWIN=y" >> $config_host_mak
2178 83fb7adf bellard
fi
2179 b29fe3ed malc
2180 b29fe3ed malc
if test "$aix" = "yes" ; then
2181 98ec69ac Juan Quintela
  echo "CONFIG_AIX=y" >> $config_host_mak
2182 b29fe3ed malc
fi
2183 b29fe3ed malc
2184 ec530c81 bellard
if test "$solaris" = "yes" ; then
2185 98ec69ac Juan Quintela
  echo "CONFIG_SOLARIS=y" >> $config_host_mak
2186 2358a494 Juan Quintela
  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
2187 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
2188 75b5a697 Juan Quintela
    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
2189 0475a5ca ths
  fi
2190 ec530c81 bellard
fi
2191 97a847bc bellard
if test "$static" = "yes" ; then
2192 98ec69ac Juan Quintela
  echo "CONFIG_STATIC=y" >> $config_host_mak
2193 7d13299d bellard
fi
2194 05c2a3e7 bellard
if test $profiler = "yes" ; then
2195 2358a494 Juan Quintela
  echo "CONFIG_PROFILER=y" >> $config_host_mak
2196 05c2a3e7 bellard
fi
2197 c20709aa bellard
if test "$slirp" = "yes" ; then
2198 98ec69ac Juan Quintela
  echo "CONFIG_SLIRP=y" >> $config_host_mak
2199 b6e31c12 Juan Quintela
  QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
2200 c20709aa bellard
fi
2201 8a16d273 ths
if test "$vde" = "yes" ; then
2202 98ec69ac Juan Quintela
  echo "CONFIG_VDE=y" >> $config_host_mak
2203 8a16d273 ths
fi
2204 0c58ac1c malc
for card in $audio_card_list; do
2205 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
2206 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
2207 0c58ac1c malc
done
2208 2358a494 Juan Quintela
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
2209 0c58ac1c malc
for drv in $audio_drv_list; do
2210 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
2211 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
2212 923e4521 malc
    if test "$drv" = "fmod"; then
2213 7aac6cb1 Juan Quintela
        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2214 0c58ac1c malc
    fi
2215 0c58ac1c malc
done
2216 67f86e8e Juan Quintela
if test "$audio_pt_int" = "yes" ; then
2217 67f86e8e Juan Quintela
  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
2218 67f86e8e Juan Quintela
fi
2219 d5631638 malc
if test "$audio_win_int" = "yes" ; then
2220 d5631638 malc
  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2221 d5631638 malc
fi
2222 eb852011 Markus Armbruster
echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
2223 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
2224 98ec69ac Juan Quintela
  echo "CONFIG_MIXEMU=y" >> $config_host_mak
2225 8ff9cbf7 malc
fi
2226 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
2227 98ec69ac Juan Quintela
  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2228 525061bf Juan Quintela
  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
2229 8d5d2d4c ths
fi
2230 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
2231 98ec69ac Juan Quintela
  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
2232 60ddf533 Juan Quintela
  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
2233 2f9606b3 aliguori
fi
2234 76655d6d aliguori
if test "$fnmatch" = "yes" ; then
2235 2358a494 Juan Quintela
  echo "CONFIG_FNMATCH=y" >> $config_host_mak
2236 76655d6d aliguori
fi
2237 ee682d27 Stefan Weil
if test "$uuid" = "yes" ; then
2238 ee682d27 Stefan Weil
  echo "CONFIG_UUID=y" >> $config_host_mak
2239 ee682d27 Stefan Weil
fi
2240 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
2241 98ec69ac Juan Quintela
echo "VERSION=$qemu_version" >>$config_host_mak
2242 2358a494 Juan Quintela
echo "PKGVERSION=$pkgversion" >>$config_host_mak
2243 98ec69ac Juan Quintela
echo "SRC_PATH=$source_path" >> $config_host_mak
2244 98ec69ac Juan Quintela
echo "TARGET_DIRS=$target_list" >> $config_host_mak
2245 a25dba17 Juan Quintela
if [ "$docs" = "yes" ] ; then
2246 98ec69ac Juan Quintela
  echo "BUILD_DOCS=yes" >> $config_host_mak
2247 cc8ae6de pbrook
fi
2248 1ac88f28 Juan Quintela
if test "$sdl" = "yes" ; then
2249 98ec69ac Juan Quintela
  echo "CONFIG_SDL=y" >> $config_host_mak
2250 1ac88f28 Juan Quintela
  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2251 49ecc3fa bellard
fi
2252 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
2253 98ec69ac Juan Quintela
  echo "CONFIG_COCOA=y" >> $config_host_mak
2254 4d3b6f6e balrog
fi
2255 4d3b6f6e balrog
if test "$curses" = "yes" ; then
2256 98ec69ac Juan Quintela
  echo "CONFIG_CURSES=y" >> $config_host_mak
2257 49ecc3fa bellard
fi
2258 3b3f24ad aurel32
if test "$atfile" = "yes" ; then
2259 2358a494 Juan Quintela
  echo "CONFIG_ATFILE=y" >> $config_host_mak
2260 3b3f24ad aurel32
fi
2261 ebc996f3 Riku Voipio
if test "$utimens" = "yes" ; then
2262 2358a494 Juan Quintela
  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2263 ebc996f3 Riku Voipio
fi
2264 099d6b0f Riku Voipio
if test "$pipe2" = "yes" ; then
2265 2358a494 Juan Quintela
  echo "CONFIG_PIPE2=y" >> $config_host_mak
2266 099d6b0f Riku Voipio
fi
2267 40ff6d7e Kevin Wolf
if test "$accept4" = "yes" ; then
2268 40ff6d7e Kevin Wolf
  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
2269 40ff6d7e Kevin Wolf
fi
2270 3ce34dfb vibisreenivasan
if test "$splice" = "yes" ; then
2271 2358a494 Juan Quintela
  echo "CONFIG_SPLICE=y" >> $config_host_mak
2272 3ce34dfb vibisreenivasan
fi
2273 c2882b96 Riku Voipio
if test "$eventfd" = "yes" ; then
2274 c2882b96 Riku Voipio
  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2275 c2882b96 Riku Voipio
fi
2276 d0927938 Ulrich Hecht
if test "$fallocate" = "yes" ; then
2277 d0927938 Ulrich Hecht
  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2278 d0927938 Ulrich Hecht
fi
2279 d0927938 Ulrich Hecht
if test "$dup3" = "yes" ; then
2280 d0927938 Ulrich Hecht
  echo "CONFIG_DUP3=y" >> $config_host_mak
2281 d0927938 Ulrich Hecht
fi
2282 3b3f24ad aurel32
if test "$inotify" = "yes" ; then
2283 2358a494 Juan Quintela
  echo "CONFIG_INOTIFY=y" >> $config_host_mak
2284 3b3f24ad aurel32
fi
2285 c05c7a73 Riku Voipio
if test "$inotify1" = "yes" ; then
2286 c05c7a73 Riku Voipio
  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2287 c05c7a73 Riku Voipio
fi
2288 6ae9a1f4 Juan Quintela
if test "$byteswap_h" = "yes" ; then
2289 6ae9a1f4 Juan Quintela
  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2290 6ae9a1f4 Juan Quintela
fi
2291 6ae9a1f4 Juan Quintela
if test "$bswap_h" = "yes" ; then
2292 6ae9a1f4 Juan Quintela
  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2293 6ae9a1f4 Juan Quintela
fi
2294 769ce76d Alexander Graf
if test "$curl" = "yes" ; then
2295 98ec69ac Juan Quintela
  echo "CONFIG_CURL=y" >> $config_host_mak
2296 b1d5a277 Juan Quintela
  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2297 769ce76d Alexander Graf
fi
2298 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
2299 98ec69ac Juan Quintela
  echo "CONFIG_BRLAPI=y" >> $config_host_mak
2300 2e4d9fb1 aurel32
fi
2301 fb599c9a balrog
if test "$bluez" = "yes" ; then
2302 98ec69ac Juan Quintela
  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2303 ef7635ec Juan Quintela
  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2304 fb599c9a balrog
fi
2305 e37630ca aliguori
if test "$xen" = "yes" ; then
2306 5647eb74 Juan Quintela
  echo "CONFIG_XEN=y" >> $config_host_mak
2307 e37630ca aliguori
fi
2308 e5d355d1 aliguori
if test "$io_thread" = "yes" ; then
2309 98ec69ac Juan Quintela
  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2310 e5d355d1 aliguori
fi
2311 5c6c3a6c Christoph Hellwig
if test "$linux_aio" = "yes" ; then
2312 5c6c3a6c Christoph Hellwig
  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2313 5c6c3a6c Christoph Hellwig
fi
2314 758e8e38 Venkateswararao Jujjuri (JV)
if test "$attr" = "yes" ; then
2315 758e8e38 Venkateswararao Jujjuri (JV)
  echo "CONFIG_ATTR=y" >> $config_host_mak
2316 758e8e38 Venkateswararao Jujjuri (JV)
fi
2317 758e8e38 Venkateswararao Jujjuri (JV)
if test "$linux" = "yes" ; then
2318 758e8e38 Venkateswararao Jujjuri (JV)
  if test "$attr" = "yes" ; then
2319 758e8e38 Venkateswararao Jujjuri (JV)
    echo "CONFIG_VIRTFS=y" >> $config_host_mak
2320 758e8e38 Venkateswararao Jujjuri (JV)
  fi
2321 758e8e38 Venkateswararao Jujjuri (JV)
fi
2322 77755340 ths
if test "$blobs" = "yes" ; then
2323 98ec69ac Juan Quintela
  echo "INSTALL_BLOBS=yes" >> $config_host_mak
2324 77755340 ths
fi
2325 bf9298b9 aliguori
if test "$iovec" = "yes" ; then
2326 2358a494 Juan Quintela
  echo "CONFIG_IOVEC=y" >> $config_host_mak
2327 bf9298b9 aliguori
fi
2328 ceb42de8 aliguori
if test "$preadv" = "yes" ; then
2329 2358a494 Juan Quintela
  echo "CONFIG_PREADV=y" >> $config_host_mak
2330 ceb42de8 aliguori
fi
2331 f652e6af aurel32
if test "$fdt" = "yes" ; then
2332 3f0855b1 Juan Quintela
  echo "CONFIG_FDT=y" >> $config_host_mak
2333 f652e6af aurel32
fi
2334 de5071c5 Blue Swirl
if test "$need_offsetof" = "yes" ; then
2335 de5071c5 Blue Swirl
  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2336 de5071c5 Blue Swirl
fi
2337 747bbdf7 Blue Swirl
if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2338 747bbdf7 Blue Swirl
  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2339 747bbdf7 Blue Swirl
fi
2340 5f6b9e8f Blue Swirl
if test "$fdatasync" = "yes" ; then
2341 5f6b9e8f Blue Swirl
  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2342 5f6b9e8f Blue Swirl
fi
2343 97a847bc bellard
2344 83fb7adf bellard
# XXX: suppress that
2345 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
2346 2358a494 Juan Quintela
  echo "CONFIG_BSD=y" >> $config_host_mak
2347 7d3505c5 bellard
fi
2348 7d3505c5 bellard
2349 2358a494 Juan Quintela
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2350 c5937220 pbrook
2351 20ff6c80 Anthony Liguori
if test "$zero_malloc" = "yes" ; then
2352 20ff6c80 Anthony Liguori
  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
2353 20ff6c80 Anthony Liguori
fi
2354 20ff6c80 Anthony Liguori
2355 68063649 blueswir1
# USB host support
2356 68063649 blueswir1
case "$usb" in
2357 68063649 blueswir1
linux)
2358 98ec69ac Juan Quintela
  echo "HOST_USB=linux" >> $config_host_mak
2359 68063649 blueswir1
;;
2360 68063649 blueswir1
bsd)
2361 98ec69ac Juan Quintela
  echo "HOST_USB=bsd" >> $config_host_mak
2362 68063649 blueswir1
;;
2363 68063649 blueswir1
*)
2364 98ec69ac Juan Quintela
  echo "HOST_USB=stub" >> $config_host_mak
2365 68063649 blueswir1
;;
2366 68063649 blueswir1
esac
2367 68063649 blueswir1
2368 98ec69ac Juan Quintela
echo "TOOLS=$tools" >> $config_host_mak
2369 98ec69ac Juan Quintela
echo "ROMS=$roms" >> $config_host_mak
2370 804edf29 Juan Quintela
echo "MAKE=$make" >> $config_host_mak
2371 804edf29 Juan Quintela
echo "INSTALL=$install" >> $config_host_mak
2372 804edf29 Juan Quintela
echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2373 804edf29 Juan Quintela
echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2374 804edf29 Juan Quintela
echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2375 804edf29 Juan Quintela
echo "CC=$cc" >> $config_host_mak
2376 804edf29 Juan Quintela
echo "HOST_CC=$host_cc" >> $config_host_mak
2377 804edf29 Juan Quintela
if test "$sparse" = "yes" ; then
2378 804edf29 Juan Quintela
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
2379 804edf29 Juan Quintela
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
2380 a558ee17 Juan Quintela
  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2381 804edf29 Juan Quintela
fi
2382 804edf29 Juan Quintela
echo "AR=$ar" >> $config_host_mak
2383 804edf29 Juan Quintela
echo "OBJCOPY=$objcopy" >> $config_host_mak
2384 804edf29 Juan Quintela
echo "LD=$ld" >> $config_host_mak
2385 e2a2ed06 Juan Quintela
echo "CFLAGS=$CFLAGS" >> $config_host_mak
2386 a558ee17 Juan Quintela
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2387 c81da56e Juan Quintela
echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2388 e2a2ed06 Juan Quintela
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
2389 a36abbbb Juan Quintela
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2390 a36abbbb Juan Quintela
echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
2391 73da375e Juan Quintela
echo "LIBS+=$LIBS" >> $config_host_mak
2392 3e2e0e6b Juan Quintela
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2393 804edf29 Juan Quintela
echo "EXESUF=$EXESUF" >> $config_host_mak
2394 804edf29 Juan Quintela
2395 4bf6b55b Juan Quintela
# generate list of library paths for linker script
2396 4bf6b55b Juan Quintela
2397 4bf6b55b Juan Quintela
$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2398 4bf6b55b Juan Quintela
2399 4bf6b55b Juan Quintela
if test -f ${config_host_ld}~ ; then
2400 4bf6b55b Juan Quintela
  if cmp -s $config_host_ld ${config_host_ld}~ ; then
2401 4bf6b55b Juan Quintela
    mv ${config_host_ld}~ $config_host_ld
2402 4bf6b55b Juan Quintela
  else
2403 4bf6b55b Juan Quintela
    rm ${config_host_ld}~
2404 4bf6b55b Juan Quintela
  fi
2405 4bf6b55b Juan Quintela
fi
2406 4bf6b55b Juan Quintela
2407 4d904533 Blue Swirl
for d in libdis libdis-user; do
2408 4d904533 Blue Swirl
    mkdir -p $d
2409 4d904533 Blue Swirl
    rm -f $d/Makefile
2410 4d904533 Blue Swirl
    ln -s $source_path/Makefile.dis $d/Makefile
2411 4d904533 Blue Swirl
    echo > $d/config.mak
2412 4d904533 Blue Swirl
done
2413 d44cff22 Richard Henderson
if test "$static" = "no" -a "$user_pie" = "yes" ; then
2414 d44cff22 Richard Henderson
  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2415 d44cff22 Richard Henderson
fi
2416 4d904533 Blue Swirl
2417 1d14ffa9 bellard
for target in $target_list; do
2418 97a847bc bellard
target_dir="$target"
2419 25be210f Juan Quintela
config_target_mak=$target_dir/config-target.mak
2420 600309b6 Blue Swirl
target_arch2=`echo $target | cut -d '-' -f 1`
2421 97a847bc bellard
target_bigendian="no"
2422 1f3d3c8f Juan Quintela
2423 ea2d6a39 Juan Quintela
case "$target_arch2" in
2424 24e804ec Alexander Graf
  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2425 ea2d6a39 Juan Quintela
  target_bigendian=yes
2426 ea2d6a39 Juan Quintela
  ;;
2427 ea2d6a39 Juan Quintela
esac
2428 97a847bc bellard
target_softmmu="no"
2429 997344f3 bellard
target_user_only="no"
2430 831b7825 ths
target_linux_user="no"
2431 831b7825 ths
target_darwin_user="no"
2432 84778508 blueswir1
target_bsd_user="no"
2433 9e407a85 pbrook
case "$target" in
2434 600309b6 Blue Swirl
  ${target_arch2}-softmmu)
2435 9e407a85 pbrook
    target_softmmu="yes"
2436 9e407a85 pbrook
    ;;
2437 600309b6 Blue Swirl
  ${target_arch2}-linux-user)
2438 9c7a4202 Blue Swirl
    if test "$linux" != "yes" ; then
2439 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a Linux host"
2440 9c7a4202 Blue Swirl
      exit 1
2441 9c7a4202 Blue Swirl
    fi
2442 9e407a85 pbrook
    target_user_only="yes"
2443 9e407a85 pbrook
    target_linux_user="yes"
2444 9e407a85 pbrook
    ;;
2445 600309b6 Blue Swirl
  ${target_arch2}-darwin-user)
2446 9c7a4202 Blue Swirl
    if test "$darwin" != "yes" ; then
2447 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a Darwin host"
2448 9c7a4202 Blue Swirl
      exit 1
2449 9c7a4202 Blue Swirl
    fi
2450 9e407a85 pbrook
    target_user_only="yes"
2451 9e407a85 pbrook
    target_darwin_user="yes"
2452 9e407a85 pbrook
    ;;
2453 600309b6 Blue Swirl
  ${target_arch2}-bsd-user)
2454 9cf55765 Blue Swirl
    if test "$bsd" != "yes" ; then
2455 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a BSD host"
2456 9c7a4202 Blue Swirl
      exit 1
2457 9c7a4202 Blue Swirl
    fi
2458 84778508 blueswir1
    target_user_only="yes"
2459 84778508 blueswir1
    target_bsd_user="yes"
2460 84778508 blueswir1
    ;;
2461 9e407a85 pbrook
  *)
2462 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
2463 9e407a85 pbrook
    exit 1
2464 9e407a85 pbrook
    ;;
2465 9e407a85 pbrook
esac
2466 831b7825 ths
2467 97a847bc bellard
mkdir -p $target_dir
2468 158142c2 bellard
mkdir -p $target_dir/fpu
2469 57fec1fe bellard
mkdir -p $target_dir/tcg
2470 59f2a787 Gerd Hoffmann
mkdir -p $target_dir/ide
2471 84778508 blueswir1
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
2472 69de927c bellard
  mkdir -p $target_dir/nwfpe
2473 69de927c bellard
fi
2474 69de927c bellard
2475 ec530c81 bellard
#
2476 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
2477 ec530c81 bellard
#
2478 ec530c81 bellard
rm -f $target_dir/Makefile
2479 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
2480 ec530c81 bellard
2481 97a847bc bellard
2482 25be210f Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_target_mak
2483 de83cd02 bellard
2484 e5fe0c52 pbrook
bflt="no"
2485 bd0c5661 pbrook
target_nptl="no"
2486 600309b6 Blue Swirl
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
2487 7ee2822c Paolo Bonzini
echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
2488 56aebc89 pbrook
gdb_xml_files=""
2489 7ba1e619 aliguori
2490 938b1edd Juan Quintela
TARGET_ARCH="$target_arch2"
2491 6acff7da Juan Quintela
TARGET_BASE_ARCH=""
2492 e6e91b9c Juan Quintela
TARGET_ABI_DIR=""
2493 e73aae67 Juan Quintela
2494 600309b6 Blue Swirl
case "$target_arch2" in
2495 2408a527 aurel32
  i386)
2496 1ad2134f Paul Brook
    target_phys_bits=32
2497 2408a527 aurel32
  ;;
2498 2408a527 aurel32
  x86_64)
2499 6acff7da Juan Quintela
    TARGET_BASE_ARCH=i386
2500 1ad2134f Paul Brook
    target_phys_bits=64
2501 2408a527 aurel32
  ;;
2502 2408a527 aurel32
  alpha)
2503 1ad2134f Paul Brook
    target_phys_bits=64
2504 a4b388ff Richard Henderson
    target_nptl="yes"
2505 2408a527 aurel32
  ;;
2506 2408a527 aurel32
  arm|armeb)
2507 b498c8a0 Juan Quintela
    TARGET_ARCH=arm
2508 2408a527 aurel32
    bflt="yes"
2509 bd0c5661 pbrook
    target_nptl="yes"
2510 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2511 1ad2134f Paul Brook
    target_phys_bits=32
2512 2408a527 aurel32
  ;;
2513 2408a527 aurel32
  cris)
2514 253bd7f8 edgar_igl
    target_nptl="yes"
2515 1ad2134f Paul Brook
    target_phys_bits=32
2516 2408a527 aurel32
  ;;
2517 2408a527 aurel32
  m68k)
2518 2408a527 aurel32
    bflt="yes"
2519 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
2520 1ad2134f Paul Brook
    target_phys_bits=32
2521 2408a527 aurel32
  ;;
2522 72b675ca Edgar E. Iglesias
  microblaze)
2523 72b675ca Edgar E. Iglesias
    bflt="yes"
2524 72b675ca Edgar E. Iglesias
    target_nptl="yes"
2525 72b675ca Edgar E. Iglesias
    target_phys_bits=32
2526 72b675ca Edgar E. Iglesias
  ;;
2527 0adcffb1 Juan Quintela
  mips|mipsel)
2528 b498c8a0 Juan Quintela
    TARGET_ARCH=mips
2529 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2530 f04dc72f Paul Brook
    target_nptl="yes"
2531 1ad2134f Paul Brook
    target_phys_bits=64
2532 2408a527 aurel32
  ;;
2533 2408a527 aurel32
  mipsn32|mipsn32el)
2534 b498c8a0 Juan Quintela
    TARGET_ARCH=mipsn32
2535 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2536 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
2537 1ad2134f Paul Brook
    target_phys_bits=64
2538 2408a527 aurel32
  ;;
2539 2408a527 aurel32
  mips64|mips64el)
2540 b498c8a0 Juan Quintela
    TARGET_ARCH=mips64
2541 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2542 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
2543 1ad2134f Paul Brook
    target_phys_bits=64
2544 2408a527 aurel32
  ;;
2545 2408a527 aurel32
  ppc)
2546 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2547 1ad2134f Paul Brook
    target_phys_bits=32
2548 d6630708 Nathan Froyd
    target_nptl="yes"
2549 2408a527 aurel32
  ;;
2550 2408a527 aurel32
  ppcemb)
2551 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2552 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2553 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2554 1ad2134f Paul Brook
    target_phys_bits=64
2555 d6630708 Nathan Froyd
    target_nptl="yes"
2556 2408a527 aurel32
  ;;
2557 2408a527 aurel32
  ppc64)
2558 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2559 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2560 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2561 1ad2134f Paul Brook
    target_phys_bits=64
2562 2408a527 aurel32
  ;;
2563 2408a527 aurel32
  ppc64abi32)
2564 b498c8a0 Juan Quintela
    TARGET_ARCH=ppc64
2565 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2566 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2567 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
2568 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2569 1ad2134f Paul Brook
    target_phys_bits=64
2570 2408a527 aurel32
  ;;
2571 2408a527 aurel32
  sh4|sh4eb)
2572 b498c8a0 Juan Quintela
    TARGET_ARCH=sh4
2573 2408a527 aurel32
    bflt="yes"
2574 0b6d3ae0 aurel32
    target_nptl="yes"
2575 1ad2134f Paul Brook
    target_phys_bits=32
2576 2408a527 aurel32
  ;;
2577 2408a527 aurel32
  sparc)
2578 1ad2134f Paul Brook
    target_phys_bits=64
2579 2408a527 aurel32
  ;;
2580 2408a527 aurel32
  sparc64)
2581 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2582 1ad2134f Paul Brook
    target_phys_bits=64
2583 2408a527 aurel32
  ;;
2584 2408a527 aurel32
  sparc32plus)
2585 b498c8a0 Juan Quintela
    TARGET_ARCH=sparc64
2586 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2587 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=sparc
2588 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
2589 1ad2134f Paul Brook
    target_phys_bits=64
2590 2408a527 aurel32
  ;;
2591 24e804ec Alexander Graf
  s390x)
2592 24e804ec Alexander Graf
    target_phys_bits=64
2593 24e804ec Alexander Graf
  ;;
2594 2408a527 aurel32
  *)
2595 2408a527 aurel32
    echo "Unsupported target CPU"
2596 2408a527 aurel32
    exit 1
2597 2408a527 aurel32
  ;;
2598 2408a527 aurel32
esac
2599 25be210f Juan Quintela
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2600 053dd92e Juan Quintela
target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
2601 25be210f Juan Quintela
echo "TARGET_$target_arch_name=y" >> $config_target_mak
2602 25be210f Juan Quintela
echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
2603 42bc608b Juan Quintela
# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
2604 6acff7da Juan Quintela
if [ "$TARGET_BASE_ARCH" = "" ]; then
2605 6acff7da Juan Quintela
  TARGET_BASE_ARCH=$TARGET_ARCH
2606 6acff7da Juan Quintela
fi
2607 25be210f Juan Quintela
echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2608 e6e91b9c Juan Quintela
if [ "$TARGET_ABI_DIR" = "" ]; then
2609 e6e91b9c Juan Quintela
  TARGET_ABI_DIR=$TARGET_ARCH
2610 e6e91b9c Juan Quintela
fi
2611 25be210f Juan Quintela
echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
2612 1b0c87fc Juan Quintela
case "$target_arch2" in
2613 1b0c87fc Juan Quintela
  i386|x86_64)
2614 1b0c87fc Juan Quintela
    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2615 25be210f Juan Quintela
      echo "CONFIG_XEN=y" >> $config_target_mak
2616 1b0c87fc Juan Quintela
    fi
2617 1b0c87fc Juan Quintela
esac
2618 c59249f9 Juan Quintela
case "$target_arch2" in
2619 0e60a699 Alexander Graf
  i386|x86_64|ppcemb|ppc|ppc64|s390x)
2620 c59249f9 Juan Quintela
    # Make sure the target and host cpus are compatible
2621 c59249f9 Juan Quintela
    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2622 c59249f9 Juan Quintela
      \( "$target_arch2" = "$cpu" -o \
2623 c59249f9 Juan Quintela
      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2624 5f114bc6 Alexander Graf
      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
2625 c59249f9 Juan Quintela
      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
2626 c59249f9 Juan Quintela
      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
2627 25be210f Juan Quintela
      echo "CONFIG_KVM=y" >> $config_target_mak
2628 25be210f Juan Quintela
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2629 dae5079a Jan Kiszka
      if test "$kvm_para" = "yes"; then
2630 dae5079a Jan Kiszka
        echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2631 dae5079a Jan Kiszka
      fi
2632 d5970055 Michael S. Tsirkin
      if test $vhost_net = "yes" ; then
2633 d5970055 Michael S. Tsirkin
        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2634 d5970055 Michael S. Tsirkin
      fi
2635 c59249f9 Juan Quintela
    fi
2636 c59249f9 Juan Quintela
esac
2637 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
2638 25be210f Juan Quintela
  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
2639 de83cd02 bellard
fi
2640 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
2641 b1aa27c4 Paul Brook
  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
2642 25be210f Juan Quintela
  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2643 25be210f Juan Quintela
  echo "LIBS+=$libs_softmmu" >> $config_target_mak
2644 0e8c9214 Andreas Färber
  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
2645 5791f45b Kirill A. Shutemov
  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2646 43ce4dfe bellard
fi
2647 997344f3 bellard
if test "$target_user_only" = "yes" ; then
2648 25be210f Juan Quintela
  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2649 997344f3 bellard
fi
2650 831b7825 ths
if test "$target_linux_user" = "yes" ; then
2651 25be210f Juan Quintela
  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2652 831b7825 ths
fi
2653 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
2654 25be210f Juan Quintela
  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2655 831b7825 ths
fi
2656 56aebc89 pbrook
list=""
2657 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
2658 56aebc89 pbrook
  for x in $gdb_xml_files; do
2659 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
2660 56aebc89 pbrook
  done
2661 3d0f1517 Juan Quintela
  echo "TARGET_XML_FILES=$list" >> $config_target_mak
2662 56aebc89 pbrook
fi
2663 97a847bc bellard
2664 f57975fb Juan Quintela
case "$target_arch2" in
2665 990b3e19 Richard Henderson
  alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
2666 25be210f Juan Quintela
    echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2667 f57975fb Juan Quintela
    ;;
2668 d6b38939 Juan Quintela
  *)
2669 25be210f Juan Quintela
    echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2670 d6b38939 Juan Quintela
    ;;
2671 f57975fb Juan Quintela
esac
2672 f57975fb Juan Quintela
2673 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2674 25be210f Juan Quintela
  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2675 e5fe0c52 pbrook
fi
2676 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
2677 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2678 25be210f Juan Quintela
  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2679 bd0c5661 pbrook
fi
2680 379f6698 Paul Brook
if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2681 25be210f Juan Quintela
  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2682 379f6698 Paul Brook
fi
2683 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
2684 25be210f Juan Quintela
  echo "CONFIG_BSD_USER=y" >> $config_target_mak
2685 84778508 blueswir1
fi
2686 5b0753e0 bellard
2687 4afddb55 Juan Quintela
# generate QEMU_CFLAGS/LDFLAGS for targets
2688 fa282484 Juan Quintela
2689 4afddb55 Juan Quintela
cflags=""
2690 fa282484 Juan Quintela
ldflags=""
2691 9b8e111f Juan Quintela
2692 57ddfbf7 Juan Quintela
if test "$ARCH" = "sparc64" ; then
2693 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
2694 24e804ec Alexander Graf
elif test "$ARCH" = "s390x" ; then
2695 24e804ec Alexander Graf
  cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
2696 5d8a4f8f Richard Henderson
elif test "$ARCH" = "x86_64" ; then
2697 5d8a4f8f Richard Henderson
  cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
2698 57ddfbf7 Juan Quintela
else
2699 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2700 57ddfbf7 Juan Quintela
fi
2701 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/tcg $cflags"
2702 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/fpu $cflags"
2703 57ddfbf7 Juan Quintela
2704 4d904533 Blue Swirl
if test "$target_user_only" = "yes" ; then
2705 4d904533 Blue Swirl
    libdis_config_mak=libdis-user/config.mak
2706 4d904533 Blue Swirl
else
2707 4d904533 Blue Swirl
    libdis_config_mak=libdis/config.mak
2708 4d904533 Blue Swirl
fi
2709 4d904533 Blue Swirl
2710 64656024 Juan Quintela
for i in $ARCH $TARGET_BASE_ARCH ; do
2711 64656024 Juan Quintela
  case "$i" in
2712 64656024 Juan Quintela
  alpha)
2713 25be210f Juan Quintela
    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
2714 4d904533 Blue Swirl
    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
2715 64656024 Juan Quintela
  ;;
2716 64656024 Juan Quintela
  arm)
2717 25be210f Juan Quintela
    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
2718 4d904533 Blue Swirl
    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
2719 64656024 Juan Quintela
  ;;
2720 64656024 Juan Quintela
  cris)
2721 25be210f Juan Quintela
    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
2722 4d904533 Blue Swirl
    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
2723 64656024 Juan Quintela
  ;;
2724 64656024 Juan Quintela
  hppa)
2725 25be210f Juan Quintela
    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
2726 4d904533 Blue Swirl
    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
2727 64656024 Juan Quintela
  ;;
2728 64656024 Juan Quintela
  i386|x86_64)
2729 25be210f Juan Quintela
    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
2730 4d904533 Blue Swirl
    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
2731 64656024 Juan Quintela
  ;;
2732 903ec55c Aurelien Jarno
  ia64*)
2733 903ec55c Aurelien Jarno
    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
2734 903ec55c Aurelien Jarno
    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
2735 903ec55c Aurelien Jarno
  ;;
2736 64656024 Juan Quintela
  m68k)
2737 25be210f Juan Quintela
    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
2738 4d904533 Blue Swirl
    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
2739 64656024 Juan Quintela
  ;;
2740 64656024 Juan Quintela
  microblaze)
2741 25be210f Juan Quintela
    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
2742 4d904533 Blue Swirl
    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
2743 64656024 Juan Quintela
  ;;
2744 64656024 Juan Quintela
  mips*)
2745 25be210f Juan Quintela
    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
2746 4d904533 Blue Swirl
    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
2747 64656024 Juan Quintela
  ;;
2748 64656024 Juan Quintela
  ppc*)
2749 25be210f Juan Quintela
    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
2750 4d904533 Blue Swirl
    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
2751 64656024 Juan Quintela
  ;;
2752 24e804ec Alexander Graf
  s390*)
2753 25be210f Juan Quintela
    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
2754 4d904533 Blue Swirl
    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
2755 64656024 Juan Quintela
  ;;
2756 64656024 Juan Quintela
  sh4)
2757 25be210f Juan Quintela
    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
2758 4d904533 Blue Swirl
    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
2759 64656024 Juan Quintela
  ;;
2760 64656024 Juan Quintela
  sparc*)
2761 25be210f Juan Quintela
    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
2762 4d904533 Blue Swirl
    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
2763 64656024 Juan Quintela
  ;;
2764 64656024 Juan Quintela
  esac
2765 64656024 Juan Quintela
done
2766 64656024 Juan Quintela
2767 6ee7126f Juan Quintela
case "$ARCH" in
2768 6ee7126f Juan Quintela
alpha)
2769 6ee7126f Juan Quintela
  # Ensure there's only a single GP
2770 6ee7126f Juan Quintela
  cflags="-msmall-data $cflags"
2771 6ee7126f Juan Quintela
;;
2772 6ee7126f Juan Quintela
esac
2773 6ee7126f Juan Quintela
2774 55d9c04b Juan Quintela
if test "$target_softmmu" = "yes" ; then
2775 55d9c04b Juan Quintela
  case "$TARGET_BASE_ARCH" in
2776 55d9c04b Juan Quintela
  arm)
2777 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO $cflags"
2778 55d9c04b Juan Quintela
  ;;
2779 55d9c04b Juan Quintela
  i386|mips|ppc)
2780 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2781 55d9c04b Juan Quintela
  ;;
2782 55d9c04b Juan Quintela
  esac
2783 55d9c04b Juan Quintela
fi
2784 55d9c04b Juan Quintela
2785 34005a00 Kirill A. Shutemov
if test "$target_user_only" = "yes" -a "$static" = "no" -a \
2786 50108930 Blue Swirl
	"$user_pie" = "yes" ; then
2787 34005a00 Kirill A. Shutemov
  cflags="-fpie $cflags"
2788 34005a00 Kirill A. Shutemov
  ldflags="-pie $ldflags"
2789 34005a00 Kirill A. Shutemov
fi
2790 34005a00 Kirill A. Shutemov
2791 471857dd Juan Quintela
if test "$target_softmmu" = "yes" -a \( \
2792 471857dd Juan Quintela
        "$TARGET_ARCH" = "microblaze" -o \
2793 471857dd Juan Quintela
        "$TARGET_ARCH" = "cris" \) ; then
2794 25be210f Juan Quintela
  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2795 471857dd Juan Quintela
fi
2796 471857dd Juan Quintela
2797 d02c1db3 Juan Quintela
if test "$gprof" = "yes" ; then
2798 25be210f Juan Quintela
  echo "TARGET_GPROF=yes" >> $config_target_mak
2799 d02c1db3 Juan Quintela
  if test "$target_linux_user" = "yes" ; then
2800 d02c1db3 Juan Quintela
    cflags="-p $cflags"
2801 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
2802 d02c1db3 Juan Quintela
  fi
2803 d02c1db3 Juan Quintela
  if test "$target_softmmu" = "yes" ; then
2804 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
2805 25be210f Juan Quintela
    echo "GPROF_CFLAGS=-p" >> $config_target_mak
2806 d02c1db3 Juan Quintela
  fi
2807 d02c1db3 Juan Quintela
fi
2808 d02c1db3 Juan Quintela
2809 6ee7126f Juan Quintela
linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
2810 9b8e111f Juan Quintela
if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2811 fa282484 Juan Quintela
  case "$ARCH" in
2812 fa282484 Juan Quintela
  sparc)
2813 fa282484 Juan Quintela
    # -static is used to avoid g1/g3 usage by the dynamic linker
2814 322e5878 Juan Quintela
    ldflags="$linker_script -static $ldflags"
2815 fa282484 Juan Quintela
    ;;
2816 4d58be06 Richard Henderson
  alpha | s390x)
2817 4d58be06 Richard Henderson
    # The default placement of the application is fine.
2818 4d58be06 Richard Henderson
    ;;
2819 fd76e73a Richard Henderson
  *)
2820 322e5878 Juan Quintela
    ldflags="$linker_script $ldflags"
2821 fa282484 Juan Quintela
    ;;
2822 fa282484 Juan Quintela
  esac
2823 fa282484 Juan Quintela
fi
2824 fa282484 Juan Quintela
2825 25be210f Juan Quintela
echo "LDFLAGS+=$ldflags" >> $config_target_mak
2826 25be210f Juan Quintela
echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2827 fa282484 Juan Quintela
2828 97a847bc bellard
done # for target in $targets
2829 7d13299d bellard
2830 7d13299d bellard
# build tree in object directory if source path is different from current one
2831 7d13299d bellard
if test "$source_path_used" = "yes" ; then
2832 e1144d00 Mark McLoughlin
    DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
2833 2d9f27d2 Anthony Liguori
    DIRS="$DIRS roms/seabios roms/vgabios"
2834 74db920c Gautham R Shenoy
    DIRS="$DIRS fsdev"
2835 7d13299d bellard
    FILES="Makefile tests/Makefile"
2836 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2837 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
2838 7ea78b74 Jan Kiszka
    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2839 2d9f27d2 Anthony Liguori
    FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
2840 7ea78b74 Jan Kiszka
    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2841 7ea78b74 Jan Kiszka
        FILES="$FILES pc-bios/`basename $bios_file`"
2842 7ea78b74 Jan Kiszka
    done
2843 7d13299d bellard
    for dir in $DIRS ; do
2844 7d13299d bellard
            mkdir -p $dir
2845 7d13299d bellard
    done
2846 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
2847 7d13299d bellard
    for f in $FILES ; do
2848 ec530c81 bellard
        rm -f $f
2849 ec530c81 bellard
        ln -s $source_path/$f $f
2850 7d13299d bellard
    done
2851 7d13299d bellard
fi
2852 1ad2134f Paul Brook
2853 c34ebfdc Anthony Liguori
# temporary config to build submodules
2854 2d9f27d2 Anthony Liguori
for rom in seabios vgabios ; do
2855 c34ebfdc Anthony Liguori
    config_mak=roms/$rom/config.mak
2856 37116c89 Stefan Weil
    echo "# Automatically generated by configure - do not modify" > $config_mak
2857 c34ebfdc Anthony Liguori
    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2858 c34ebfdc Anthony Liguori
    echo "CC=$cc" >> $config_mak
2859 c34ebfdc Anthony Liguori
    echo "BCC=bcc" >> $config_mak
2860 c34ebfdc Anthony Liguori
    echo "CPP=${cross_prefix}cpp" >> $config_mak
2861 c34ebfdc Anthony Liguori
    echo "OBJCOPY=objcopy" >> $config_mak
2862 c34ebfdc Anthony Liguori
    echo "IASL=iasl" >> $config_mak
2863 c34ebfdc Anthony Liguori
    echo "HOST_CC=$host_cc" >> $config_mak
2864 c34ebfdc Anthony Liguori
    echo "LD=$ld" >> $config_mak
2865 c34ebfdc Anthony Liguori
done
2866 c34ebfdc Anthony Liguori
2867 1ad2134f Paul Brook
for hwlib in 32 64; do
2868 1ad2134f Paul Brook
  d=libhw$hwlib
2869 1ad2134f Paul Brook
  mkdir -p $d
2870 9953b2fc Blue Swirl
  mkdir -p $d/ide
2871 1ad2134f Paul Brook
  rm -f $d/Makefile
2872 1ad2134f Paul Brook
  ln -s $source_path/Makefile.hw $d/Makefile
2873 37116c89 Stefan Weil
  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
2874 1ad2134f Paul Brook
done
2875 add16157 Blue Swirl
2876 add16157 Blue Swirl
d=libuser
2877 add16157 Blue Swirl
mkdir -p $d
2878 add16157 Blue Swirl
rm -f $d/Makefile
2879 add16157 Blue Swirl
ln -s $source_path/Makefile.user $d/Makefile
2880 299060a0 Kirill A. Shutemov
if test "$static" = "no" -a "$user_pie" = "yes" ; then
2881 299060a0 Kirill A. Shutemov
  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
2882 299060a0 Kirill A. Shutemov
fi
2883 b40292e7 Jan Kiszka
2884 b40292e7 Jan Kiszka
if test "$docs" = "yes" ; then
2885 b40292e7 Jan Kiszka
  mkdir -p QMP
2886 b40292e7 Jan Kiszka
fi