Statistics
| Branch: | Revision:

root / configure @ 5bc89ef6

History | View | Annotate | Download (61.1 kB)

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