Statistics
| Branch: | Revision:

root / configure @ de5071c5

History | View | Annotate | Download (61.6 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 3aefa744 Juan Quintela
if test "$vnc_sasl" != "no" ; 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 3cfcae3c Luiz Capitulino
    linux_aio=no
1358 5c6c3a6c Christoph Hellwig
  fi
1359 5c6c3a6c Christoph Hellwig
fi
1360 5c6c3a6c Christoph Hellwig
1361 5c6c3a6c Christoph Hellwig
##########################################
1362 bf9298b9 aliguori
# iovec probe
1363 bf9298b9 aliguori
cat > $TMPC <<EOF
1364 db34f0b3 blueswir1
#include <sys/types.h>
1365 bf9298b9 aliguori
#include <sys/uio.h>
1366 db34f0b3 blueswir1
#include <unistd.h>
1367 bf9298b9 aliguori
int main(void) { struct iovec iov; return 0; }
1368 bf9298b9 aliguori
EOF
1369 bf9298b9 aliguori
iovec=no
1370 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1371 bf9298b9 aliguori
  iovec=yes
1372 bf9298b9 aliguori
fi
1373 bf9298b9 aliguori
1374 f652e6af aurel32
##########################################
1375 ceb42de8 aliguori
# preadv probe
1376 ceb42de8 aliguori
cat > $TMPC <<EOF
1377 ceb42de8 aliguori
#include <sys/types.h>
1378 ceb42de8 aliguori
#include <sys/uio.h>
1379 ceb42de8 aliguori
#include <unistd.h>
1380 ceb42de8 aliguori
int main(void) { preadv; }
1381 ceb42de8 aliguori
EOF
1382 ceb42de8 aliguori
preadv=no
1383 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1384 ceb42de8 aliguori
  preadv=yes
1385 ceb42de8 aliguori
fi
1386 ceb42de8 aliguori
1387 ceb42de8 aliguori
##########################################
1388 f652e6af aurel32
# fdt probe
1389 2df87df7 Juan Quintela
if test "$fdt" != "no" ; then
1390 b41af4ba Juan Quintela
  fdt_libs="-lfdt"
1391 b41af4ba Juan Quintela
  cat > $TMPC << EOF
1392 f652e6af aurel32
int main(void) { return 0; }
1393 f652e6af aurel32
EOF
1394 52166aa0 Juan Quintela
  if compile_prog "" "$fdt_libs" ; then
1395 f652e6af aurel32
    fdt=yes
1396 e4782985 Juan Quintela
    libs_softmmu="$fdt_libs $libs_softmmu"
1397 2df87df7 Juan Quintela
  else
1398 2df87df7 Juan Quintela
    if test "$fdt" = "yes" ; then
1399 2df87df7 Juan Quintela
      feature_not_found "fdt"
1400 2df87df7 Juan Quintela
    fi
1401 2df87df7 Juan Quintela
    fdt=no
1402 f652e6af aurel32
  fi
1403 f652e6af aurel32
fi
1404 f652e6af aurel32
1405 3b3f24ad aurel32
#
1406 3b3f24ad aurel32
# Check for xxxat() functions when we are building linux-user
1407 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1408 3b3f24ad aurel32
# have syscall stubs for these implemented.
1409 3b3f24ad aurel32
#
1410 3b3f24ad aurel32
atfile=no
1411 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1412 3b3f24ad aurel32
#define _ATFILE_SOURCE
1413 3b3f24ad aurel32
#include <sys/types.h>
1414 3b3f24ad aurel32
#include <fcntl.h>
1415 3b3f24ad aurel32
#include <unistd.h>
1416 3b3f24ad aurel32
1417 3b3f24ad aurel32
int
1418 3b3f24ad aurel32
main(void)
1419 3b3f24ad aurel32
{
1420 3b3f24ad aurel32
	/* try to unlink nonexisting file */
1421 3b3f24ad aurel32
	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1422 3b3f24ad aurel32
}
1423 3b3f24ad aurel32
EOF
1424 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1425 67ba57f6 Riku Voipio
  atfile=yes
1426 3b3f24ad aurel32
fi
1427 3b3f24ad aurel32
1428 39386ac7 aurel32
# Check for inotify functions when we are building linux-user
1429 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1430 3b3f24ad aurel32
# have syscall stubs for these implemented.  In that case we
1431 3b3f24ad aurel32
# don't provide them even if kernel supports them.
1432 3b3f24ad aurel32
#
1433 3b3f24ad aurel32
inotify=no
1434 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1435 3b3f24ad aurel32
#include <sys/inotify.h>
1436 3b3f24ad aurel32
1437 3b3f24ad aurel32
int
1438 3b3f24ad aurel32
main(void)
1439 3b3f24ad aurel32
{
1440 3b3f24ad aurel32
	/* try to start inotify */
1441 8690e420 aurel32
	return inotify_init();
1442 3b3f24ad aurel32
}
1443 3b3f24ad aurel32
EOF
1444 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1445 67ba57f6 Riku Voipio
  inotify=yes
1446 3b3f24ad aurel32
fi
1447 3b3f24ad aurel32
1448 ebc996f3 Riku Voipio
# check if utimensat and futimens are supported
1449 ebc996f3 Riku Voipio
utimens=no
1450 ebc996f3 Riku Voipio
cat > $TMPC << EOF
1451 ebc996f3 Riku Voipio
#define _ATFILE_SOURCE
1452 ebc996f3 Riku Voipio
#define _GNU_SOURCE
1453 ebc996f3 Riku Voipio
#include <stddef.h>
1454 ebc996f3 Riku Voipio
#include <fcntl.h>
1455 ebc996f3 Riku Voipio
1456 ebc996f3 Riku Voipio
int main(void)
1457 ebc996f3 Riku Voipio
{
1458 ebc996f3 Riku Voipio
    utimensat(AT_FDCWD, "foo", NULL, 0);
1459 ebc996f3 Riku Voipio
    futimens(0, NULL);
1460 ebc996f3 Riku Voipio
    return 0;
1461 ebc996f3 Riku Voipio
}
1462 ebc996f3 Riku Voipio
EOF
1463 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1464 ebc996f3 Riku Voipio
  utimens=yes
1465 ebc996f3 Riku Voipio
fi
1466 ebc996f3 Riku Voipio
1467 099d6b0f Riku Voipio
# check if pipe2 is there
1468 099d6b0f Riku Voipio
pipe2=no
1469 099d6b0f Riku Voipio
cat > $TMPC << EOF
1470 099d6b0f Riku Voipio
#define _GNU_SOURCE
1471 099d6b0f Riku Voipio
#include <unistd.h>
1472 099d6b0f Riku Voipio
#include <fcntl.h>
1473 099d6b0f Riku Voipio
1474 099d6b0f Riku Voipio
int main(void)
1475 099d6b0f Riku Voipio
{
1476 099d6b0f Riku Voipio
    int pipefd[2];
1477 099d6b0f Riku Voipio
    pipe2(pipefd, O_CLOEXEC);
1478 099d6b0f Riku Voipio
    return 0;
1479 099d6b0f Riku Voipio
}
1480 099d6b0f Riku Voipio
EOF
1481 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1482 099d6b0f Riku Voipio
  pipe2=yes
1483 099d6b0f Riku Voipio
fi
1484 099d6b0f Riku Voipio
1485 3ce34dfb vibisreenivasan
# check if tee/splice is there. vmsplice was added same time.
1486 3ce34dfb vibisreenivasan
splice=no
1487 3ce34dfb vibisreenivasan
cat > $TMPC << EOF
1488 3ce34dfb vibisreenivasan
#define _GNU_SOURCE
1489 3ce34dfb vibisreenivasan
#include <unistd.h>
1490 3ce34dfb vibisreenivasan
#include <fcntl.h>
1491 3ce34dfb vibisreenivasan
#include <limits.h>
1492 3ce34dfb vibisreenivasan
1493 3ce34dfb vibisreenivasan
int main(void)
1494 3ce34dfb vibisreenivasan
{
1495 3ce34dfb vibisreenivasan
    int len, fd;
1496 3ce34dfb vibisreenivasan
    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1497 3ce34dfb vibisreenivasan
    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1498 3ce34dfb vibisreenivasan
    return 0;
1499 3ce34dfb vibisreenivasan
}
1500 3ce34dfb vibisreenivasan
EOF
1501 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1502 3ce34dfb vibisreenivasan
  splice=yes
1503 3ce34dfb vibisreenivasan
fi
1504 3ce34dfb vibisreenivasan
1505 c2882b96 Riku Voipio
# check if eventfd is supported
1506 c2882b96 Riku Voipio
eventfd=no
1507 c2882b96 Riku Voipio
cat > $TMPC << EOF
1508 c2882b96 Riku Voipio
#include <sys/eventfd.h>
1509 c2882b96 Riku Voipio
1510 c2882b96 Riku Voipio
int main(void)
1511 c2882b96 Riku Voipio
{
1512 c2882b96 Riku Voipio
    int efd = eventfd(0, 0);
1513 c2882b96 Riku Voipio
    return 0;
1514 c2882b96 Riku Voipio
}
1515 c2882b96 Riku Voipio
EOF
1516 c2882b96 Riku Voipio
if compile_prog "" "" ; then
1517 c2882b96 Riku Voipio
  eventfd=yes
1518 c2882b96 Riku Voipio
fi
1519 c2882b96 Riku Voipio
1520 cc8ae6de pbrook
# Check if tools are available to build documentation.
1521 a25dba17 Juan Quintela
if test "$docs" != "no" ; then
1522 83a3ab8b Juan Quintela
  if test -x "`which texi2html 2>/dev/null`" -a \
1523 83a3ab8b Juan Quintela
          -x "`which pod2man 2>/dev/null`" ; then
1524 a25dba17 Juan Quintela
    docs=yes
1525 83a3ab8b Juan Quintela
  else
1526 a25dba17 Juan Quintela
    if test "$docs" = "yes" ; then
1527 a25dba17 Juan Quintela
      feature_not_found "docs"
1528 83a3ab8b Juan Quintela
    fi
1529 a25dba17 Juan Quintela
    docs=no
1530 83a3ab8b Juan Quintela
  fi
1531 cc8ae6de pbrook
fi
1532 cc8ae6de pbrook
1533 6ae9a1f4 Juan Quintela
# Search for bsawp_32 function
1534 6ae9a1f4 Juan Quintela
byteswap_h=no
1535 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1536 6ae9a1f4 Juan Quintela
#include <byteswap.h>
1537 6ae9a1f4 Juan Quintela
int main(void) { return bswap_32(0); }
1538 6ae9a1f4 Juan Quintela
EOF
1539 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1540 6ae9a1f4 Juan Quintela
  byteswap_h=yes
1541 6ae9a1f4 Juan Quintela
fi
1542 6ae9a1f4 Juan Quintela
1543 6ae9a1f4 Juan Quintela
# Search for bsawp_32 function
1544 6ae9a1f4 Juan Quintela
bswap_h=no
1545 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1546 6ae9a1f4 Juan Quintela
#include <sys/endian.h>
1547 6ae9a1f4 Juan Quintela
#include <sys/types.h>
1548 6ae9a1f4 Juan Quintela
#include <machine/bswap.h>
1549 6ae9a1f4 Juan Quintela
int main(void) { return bswap32(0); }
1550 6ae9a1f4 Juan Quintela
EOF
1551 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1552 6ae9a1f4 Juan Quintela
  bswap_h=yes
1553 6ae9a1f4 Juan Quintela
fi
1554 6ae9a1f4 Juan Quintela
1555 da93a1fd aliguori
##########################################
1556 da93a1fd aliguori
# Do we need librt
1557 da93a1fd aliguori
cat > $TMPC <<EOF
1558 da93a1fd aliguori
#include <signal.h>
1559 da93a1fd aliguori
#include <time.h>
1560 da93a1fd aliguori
int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1561 da93a1fd aliguori
EOF
1562 da93a1fd aliguori
1563 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1564 07ffa4bd Juan Quintela
  :
1565 52166aa0 Juan Quintela
elif compile_prog "" "-lrt" ; then
1566 07ffa4bd Juan Quintela
  LIBS="-lrt $LIBS"
1567 da93a1fd aliguori
fi
1568 da93a1fd aliguori
1569 a36abbbb Juan Quintela
# Determine what linker flags to use to force archive inclusion
1570 a36abbbb Juan Quintela
check_linker_flags()
1571 a36abbbb Juan Quintela
{
1572 a36abbbb Juan Quintela
    w2=
1573 a36abbbb Juan Quintela
    if test "$2" ; then
1574 a36abbbb Juan Quintela
	w2=-Wl,$2
1575 a36abbbb Juan Quintela
    fi
1576 52166aa0 Juan Quintela
    compile_prog "" "-Wl,$1 ${w2}"
1577 a36abbbb Juan Quintela
}
1578 a36abbbb Juan Quintela
1579 a36abbbb Juan Quintela
cat > $TMPC << EOF
1580 a36abbbb Juan Quintela
int main(void) { }
1581 a36abbbb Juan Quintela
EOF
1582 a36abbbb Juan Quintela
if check_linker_flags --whole-archive --no-whole-archive ; then
1583 a36abbbb Juan Quintela
    # GNU ld
1584 a36abbbb Juan Quintela
    arlibs_begin="-Wl,--whole-archive"
1585 a36abbbb Juan Quintela
    arlibs_end="-Wl,--no-whole-archive"
1586 a36abbbb Juan Quintela
elif check_linker_flags -z,allextract -z,defaultextract ; then
1587 a36abbbb Juan Quintela
    # Solaris ld
1588 a36abbbb Juan Quintela
    arlibs_begin"=-Wl,-z,allextract"
1589 a36abbbb Juan Quintela
    arlibs_end="-Wl,-z,defaultextract"
1590 a36abbbb Juan Quintela
elif check_linker_flags -all_load ; then
1591 a36abbbb Juan Quintela
    # Mac OS X
1592 a36abbbb Juan Quintela
    arlibs_begin="-all_load"
1593 a36abbbb Juan Quintela
    arlibs_end=""
1594 a36abbbb Juan Quintela
else
1595 a36abbbb Juan Quintela
    echo "Error: your linker does not support --whole-archive or -z."
1596 a36abbbb Juan Quintela
    echo "Please report to qemu-devel@nongnu.org"
1597 a36abbbb Juan Quintela
    exit 1
1598 a36abbbb Juan Quintela
fi
1599 a36abbbb Juan Quintela
1600 6362a53f Juan Quintela
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaries" != yes -a \
1601 6362a53f Juan Quintela
        "$aix" != "yes" ; then
1602 6362a53f Juan Quintela
    libs_softmmu="-lutil $libs_softmmu"
1603 6362a53f Juan Quintela
fi
1604 6362a53f Juan Quintela
1605 de5071c5 Blue Swirl
##########################################
1606 de5071c5 Blue Swirl
# check if the compiler defines offsetof
1607 de5071c5 Blue Swirl
1608 de5071c5 Blue Swirl
need_offsetof=yes
1609 de5071c5 Blue Swirl
cat > $TMPC << EOF
1610 de5071c5 Blue Swirl
#include <stddef.h>
1611 de5071c5 Blue Swirl
int main(void) { struct s { int f; }; return offsetof(struct s, f); }
1612 de5071c5 Blue Swirl
EOF
1613 de5071c5 Blue Swirl
if compile_prog "" "" ; then
1614 de5071c5 Blue Swirl
    need_offsetof=no
1615 de5071c5 Blue Swirl
fi
1616 de5071c5 Blue Swirl
1617 e86ecd4b Juan Quintela
# End of CC checks
1618 e86ecd4b Juan Quintela
# After here, no more $cc or $ld runs
1619 e86ecd4b Juan Quintela
1620 e86ecd4b Juan Quintela
# default flags for all hosts
1621 a558ee17 Juan Quintela
QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
1622 a558ee17 Juan Quintela
CFLAGS="-g $CFLAGS"
1623 e86ecd4b Juan Quintela
if test "$debug" = "no" ; then
1624 1156c669 Juan Quintela
  CFLAGS="-O2 $CFLAGS"
1625 e86ecd4b Juan Quintela
fi
1626 867c16fd Juan Quintela
QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
1627 867c16fd Juan Quintela
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
1628 6c90361a Juan Quintela
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
1629 6c90361a Juan Quintela
QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
1630 6c90361a Juan Quintela
QEMU_CFLAGS="-I. -I\$(SRC_PATH) -MMD -MP -MT \$@ $QEMU_CFLAGS"
1631 1156c669 Juan Quintela
LDFLAGS="-g $LDFLAGS"
1632 e86ecd4b Juan Quintela
1633 e86ecd4b Juan Quintela
# Consult white-list to determine whether to enable werror
1634 e86ecd4b Juan Quintela
# by default.  Only enable by default for git builds
1635 e86ecd4b Juan Quintela
if test -z "$werror" ; then
1636 e86ecd4b Juan Quintela
    z_version=`cut -f3 -d. $source_path/VERSION`
1637 e86ecd4b Juan Quintela
    if test "$z_version" = "50" -a \
1638 e86ecd4b Juan Quintela
        "$linux" = "yes" ; then
1639 e86ecd4b Juan Quintela
        werror="yes"
1640 e86ecd4b Juan Quintela
    else
1641 e86ecd4b Juan Quintela
        werror="no"
1642 e86ecd4b Juan Quintela
    fi
1643 e86ecd4b Juan Quintela
fi
1644 e86ecd4b Juan Quintela
1645 e86ecd4b Juan Quintela
if test "$werror" = "yes" ; then
1646 a558ee17 Juan Quintela
    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
1647 e86ecd4b Juan Quintela
fi
1648 e86ecd4b Juan Quintela
1649 e86ecd4b Juan Quintela
if test "$solaris" = "no" ; then
1650 e86ecd4b Juan Quintela
    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1651 1156c669 Juan Quintela
        LDFLAGS="-Wl,--warn-common $LDFLAGS"
1652 e86ecd4b Juan Quintela
    fi
1653 e86ecd4b Juan Quintela
fi
1654 e86ecd4b Juan Quintela
1655 11d9f695 bellard
if test "$mingw32" = "yes" ; then
1656 308c3593 pbrook
  if test -z "$prefix" ; then
1657 55418b96 Stefan Weil
      prefix="c:/Program Files/Qemu"
1658 308c3593 pbrook
  fi
1659 308c3593 pbrook
  mansuffix=""
1660 308c3593 pbrook
  datasuffix=""
1661 308c3593 pbrook
  docsuffix=""
1662 308c3593 pbrook
  binsuffix=""
1663 11d9f695 bellard
else
1664 308c3593 pbrook
  if test -z "$prefix" ; then
1665 308c3593 pbrook
      prefix="/usr/local"
1666 308c3593 pbrook
  fi
1667 308c3593 pbrook
  mansuffix="/share/man"
1668 308c3593 pbrook
  datasuffix="/share/qemu"
1669 308c3593 pbrook
  docsuffix="/share/doc/qemu"
1670 308c3593 pbrook
  binsuffix="/bin"
1671 11d9f695 bellard
fi
1672 5a67135a bellard
1673 43ce4dfe bellard
echo "Install prefix    $prefix"
1674 308c3593 pbrook
echo "BIOS directory    $prefix$datasuffix"
1675 308c3593 pbrook
echo "binary directory  $prefix$binsuffix"
1676 11d9f695 bellard
if test "$mingw32" = "no" ; then
1677 308c3593 pbrook
echo "Manual directory  $prefix$mansuffix"
1678 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
1679 11d9f695 bellard
fi
1680 5a67135a bellard
echo "Source path       $source_path"
1681 43ce4dfe bellard
echo "C compiler        $cc"
1682 83469015 bellard
echo "Host C compiler   $host_cc"
1683 0c439cbf Juan Quintela
echo "CFLAGS            $CFLAGS"
1684 a558ee17 Juan Quintela
echo "QEMU_CFLAGS       $QEMU_CFLAGS"
1685 0c439cbf Juan Quintela
echo "LDFLAGS           $LDFLAGS"
1686 43ce4dfe bellard
echo "make              $make"
1687 6a882643 pbrook
echo "install           $install"
1688 43ce4dfe bellard
echo "host CPU          $cpu"
1689 de83cd02 bellard
echo "host big endian   $bigendian"
1690 97a847bc bellard
echo "target list       $target_list"
1691 ade25b0d aurel32
echo "tcg debug enabled $debug_tcg"
1692 43ce4dfe bellard
echo "gprof enabled     $gprof"
1693 03b4fe7d aliguori
echo "sparse enabled    $sparse"
1694 1625af87 aliguori
echo "strip binaries    $strip_opt"
1695 05c2a3e7 bellard
echo "profiler          $profiler"
1696 43ce4dfe bellard
echo "static build      $static"
1697 85aa5189 bellard
echo "-Werror enabled   $werror"
1698 5b0753e0 bellard
if test "$darwin" = "yes" ; then
1699 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
1700 5b0753e0 bellard
fi
1701 97a847bc bellard
echo "SDL support       $sdl"
1702 4d3b6f6e balrog
echo "curses support    $curses"
1703 769ce76d Alexander Graf
echo "curl support      $curl"
1704 5495ed11 Luiz Capitulino
echo "check support     $check_utests"
1705 67b915a5 bellard
echo "mingw32 support   $mingw32"
1706 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
1707 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
1708 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
1709 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
1710 2f9606b3 aliguori
echo "VNC SASL support  $vnc_sasl"
1711 3142255c blueswir1
if test -n "$sparc_cpu"; then
1712 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
1713 3142255c blueswir1
fi
1714 e37630ca aliguori
echo "xen support       $xen"
1715 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
1716 a20a6f46 Juan Quintela
echo "bluez  support    $bluez"
1717 a25dba17 Juan Quintela
echo "Documentation     $docs"
1718 c5937220 pbrook
[ ! -z "$uname_release" ] && \
1719 c5937220 pbrook
echo "uname -r          $uname_release"
1720 bd0c5661 pbrook
echo "NPTL support      $nptl"
1721 379f6698 Paul Brook
echo "GUEST_BASE        $guest_base"
1722 8a16d273 ths
echo "vde support       $vde"
1723 e5d355d1 aliguori
echo "IO thread         $io_thread"
1724 5c6c3a6c Christoph Hellwig
echo "Linux AIO support $linux_aio"
1725 77755340 ths
echo "Install blobs     $blobs"
1726 b31a0277 Juan Quintela
echo "KVM support       $kvm"
1727 f652e6af aurel32
echo "fdt support       $fdt"
1728 ceb42de8 aliguori
echo "preadv support    $preadv"
1729 67b915a5 bellard
1730 97a847bc bellard
if test $sdl_too_old = "yes"; then
1731 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
1732 7c1f25b4 bellard
fi
1733 7d13299d bellard
1734 98ec69ac Juan Quintela
config_host_mak="config-host.mak"
1735 98ec69ac Juan Quintela
config_host_h="config-host.h"
1736 4bf6b55b Juan Quintela
config_host_ld="config-host.ld"
1737 98ec69ac Juan Quintela
1738 98ec69ac Juan Quintela
#echo "Creating $config_host_mak and $config_host_h"
1739 98ec69ac Juan Quintela
1740 98ec69ac Juan Quintela
test -f $config_host_h && mv $config_host_h ${config_host_h}~
1741 98ec69ac Juan Quintela
1742 98ec69ac Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_host_mak
1743 98ec69ac Juan Quintela
printf "# Configured with:" >> $config_host_mak
1744 98ec69ac Juan Quintela
printf " '%s'" "$0" "$@" >> $config_host_mak
1745 98ec69ac Juan Quintela
echo >> $config_host_mak
1746 98ec69ac Juan Quintela
1747 2358a494 Juan Quintela
echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
1748 804edf29 Juan Quintela
1749 2408a527 aurel32
case "$cpu" in
1750 c62bbcd3 Andrzej Zaborowski
  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
1751 e0da9dd3 Juan Quintela
    ARCH=$cpu
1752 2408a527 aurel32
  ;;
1753 a302c32d Laurent Desnogues
  armv4b|armv4l)
1754 16dbd14f Juan Quintela
    ARCH=arm
1755 2408a527 aurel32
  ;;
1756 2408a527 aurel32
  *)
1757 2408a527 aurel32
    echo "Unsupported CPU = $cpu"
1758 2408a527 aurel32
    exit 1
1759 2408a527 aurel32
  ;;
1760 2408a527 aurel32
esac
1761 98ec69ac Juan Quintela
echo "ARCH=$ARCH" >> $config_host_mak
1762 f8393946 aurel32
if test "$debug_tcg" = "yes" ; then
1763 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
1764 f8393946 aurel32
fi
1765 f3d08ee6 Paul Brook
if test "$debug" = "yes" ; then
1766 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
1767 f3d08ee6 Paul Brook
fi
1768 1625af87 aliguori
if test "$strip_opt" = "yes" ; then
1769 98ec69ac Juan Quintela
  echo "STRIP_OPT=-s" >> $config_host_mak
1770 1625af87 aliguori
fi
1771 7d13299d bellard
if test "$bigendian" = "yes" ; then
1772 e2542fe2 Juan Quintela
  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
1773 97a847bc bellard
fi
1774 2358a494 Juan Quintela
echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
1775 67b915a5 bellard
if test "$mingw32" = "yes" ; then
1776 98ec69ac Juan Quintela
  echo "CONFIG_WIN32=y" >> $config_host_mak
1777 210fa556 pbrook
else
1778 35f4df27 Juan Quintela
  echo "CONFIG_POSIX=y" >> $config_host_mak
1779 67b915a5 bellard
fi
1780 128ab2ff blueswir1
1781 83fb7adf bellard
if test "$darwin" = "yes" ; then
1782 98ec69ac Juan Quintela
  echo "CONFIG_DARWIN=y" >> $config_host_mak
1783 83fb7adf bellard
fi
1784 b29fe3ed malc
1785 b29fe3ed malc
if test "$aix" = "yes" ; then
1786 98ec69ac Juan Quintela
  echo "CONFIG_AIX=y" >> $config_host_mak
1787 b29fe3ed malc
fi
1788 b29fe3ed malc
1789 ec530c81 bellard
if test "$solaris" = "yes" ; then
1790 98ec69ac Juan Quintela
  echo "CONFIG_SOLARIS=y" >> $config_host_mak
1791 2358a494 Juan Quintela
  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
1792 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
1793 75b5a697 Juan Quintela
    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
1794 0475a5ca ths
  fi
1795 ec530c81 bellard
fi
1796 97a847bc bellard
if test "$static" = "yes" ; then
1797 98ec69ac Juan Quintela
  echo "CONFIG_STATIC=y" >> $config_host_mak
1798 1156c669 Juan Quintela
  LDFLAGS="-static $LDFLAGS"
1799 7d13299d bellard
fi
1800 05c2a3e7 bellard
if test $profiler = "yes" ; then
1801 2358a494 Juan Quintela
  echo "CONFIG_PROFILER=y" >> $config_host_mak
1802 05c2a3e7 bellard
fi
1803 c20709aa bellard
if test "$slirp" = "yes" ; then
1804 98ec69ac Juan Quintela
  echo "CONFIG_SLIRP=y" >> $config_host_mak
1805 4de67f2f Juan Quintela
  CFLAGS="-I\$(SRC_PATH)/slirp $CFLAGS"
1806 c20709aa bellard
fi
1807 8a16d273 ths
if test "$vde" = "yes" ; then
1808 98ec69ac Juan Quintela
  echo "CONFIG_VDE=y" >> $config_host_mak
1809 8a16d273 ths
fi
1810 0c58ac1c malc
for card in $audio_card_list; do
1811 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1812 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
1813 0c58ac1c malc
done
1814 2358a494 Juan Quintela
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
1815 0c58ac1c malc
for drv in $audio_drv_list; do
1816 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1817 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
1818 923e4521 malc
    if test "$drv" = "fmod"; then
1819 7aac6cb1 Juan Quintela
        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
1820 0c58ac1c malc
    fi
1821 0c58ac1c malc
done
1822 67f86e8e Juan Quintela
if test "$audio_pt_int" = "yes" ; then
1823 67f86e8e Juan Quintela
  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
1824 67f86e8e Juan Quintela
fi
1825 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
1826 98ec69ac Juan Quintela
  echo "CONFIG_MIXEMU=y" >> $config_host_mak
1827 8ff9cbf7 malc
fi
1828 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1829 98ec69ac Juan Quintela
  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
1830 525061bf Juan Quintela
  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1831 8d5d2d4c ths
fi
1832 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
1833 98ec69ac Juan Quintela
  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
1834 60ddf533 Juan Quintela
  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1835 2f9606b3 aliguori
fi
1836 76655d6d aliguori
if test "$fnmatch" = "yes" ; then
1837 2358a494 Juan Quintela
  echo "CONFIG_FNMATCH=y" >> $config_host_mak
1838 76655d6d aliguori
fi
1839 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
1840 98ec69ac Juan Quintela
echo "VERSION=$qemu_version" >>$config_host_mak
1841 2358a494 Juan Quintela
echo "PKGVERSION=$pkgversion" >>$config_host_mak
1842 98ec69ac Juan Quintela
echo "SRC_PATH=$source_path" >> $config_host_mak
1843 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
1844 98ec69ac Juan Quintela
  echo "VPATH=$source_path" >> $config_host_mak
1845 ad064840 pbrook
fi
1846 98ec69ac Juan Quintela
echo "TARGET_DIRS=$target_list" >> $config_host_mak
1847 a25dba17 Juan Quintela
if [ "$docs" = "yes" ] ; then
1848 98ec69ac Juan Quintela
  echo "BUILD_DOCS=yes" >> $config_host_mak
1849 cc8ae6de pbrook
fi
1850 1ac88f28 Juan Quintela
if test "$sdl" = "yes" ; then
1851 98ec69ac Juan Quintela
  echo "CONFIG_SDL=y" >> $config_host_mak
1852 1ac88f28 Juan Quintela
  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
1853 49ecc3fa bellard
fi
1854 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
1855 98ec69ac Juan Quintela
  echo "CONFIG_COCOA=y" >> $config_host_mak
1856 4d3b6f6e balrog
fi
1857 4d3b6f6e balrog
if test "$curses" = "yes" ; then
1858 98ec69ac Juan Quintela
  echo "CONFIG_CURSES=y" >> $config_host_mak
1859 49ecc3fa bellard
fi
1860 3b3f24ad aurel32
if test "$atfile" = "yes" ; then
1861 2358a494 Juan Quintela
  echo "CONFIG_ATFILE=y" >> $config_host_mak
1862 3b3f24ad aurel32
fi
1863 ebc996f3 Riku Voipio
if test "$utimens" = "yes" ; then
1864 2358a494 Juan Quintela
  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
1865 ebc996f3 Riku Voipio
fi
1866 099d6b0f Riku Voipio
if test "$pipe2" = "yes" ; then
1867 2358a494 Juan Quintela
  echo "CONFIG_PIPE2=y" >> $config_host_mak
1868 099d6b0f Riku Voipio
fi
1869 3ce34dfb vibisreenivasan
if test "$splice" = "yes" ; then
1870 2358a494 Juan Quintela
  echo "CONFIG_SPLICE=y" >> $config_host_mak
1871 3ce34dfb vibisreenivasan
fi
1872 c2882b96 Riku Voipio
if test "$eventfd" = "yes" ; then
1873 c2882b96 Riku Voipio
  echo "CONFIG_EVENTFD=y" >> $config_host_mak
1874 c2882b96 Riku Voipio
fi
1875 3b3f24ad aurel32
if test "$inotify" = "yes" ; then
1876 2358a494 Juan Quintela
  echo "CONFIG_INOTIFY=y" >> $config_host_mak
1877 3b3f24ad aurel32
fi
1878 6ae9a1f4 Juan Quintela
if test "$byteswap_h" = "yes" ; then
1879 6ae9a1f4 Juan Quintela
  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
1880 6ae9a1f4 Juan Quintela
fi
1881 6ae9a1f4 Juan Quintela
if test "$bswap_h" = "yes" ; then
1882 6ae9a1f4 Juan Quintela
  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
1883 6ae9a1f4 Juan Quintela
fi
1884 769ce76d Alexander Graf
if test "$curl" = "yes" ; then
1885 98ec69ac Juan Quintela
  echo "CONFIG_CURL=y" >> $config_host_mak
1886 b1d5a277 Juan Quintela
  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
1887 769ce76d Alexander Graf
fi
1888 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
1889 98ec69ac Juan Quintela
  echo "CONFIG_BRLAPI=y" >> $config_host_mak
1890 2e4d9fb1 aurel32
fi
1891 fb599c9a balrog
if test "$bluez" = "yes" ; then
1892 98ec69ac Juan Quintela
  echo "CONFIG_BLUEZ=y" >> $config_host_mak
1893 ef7635ec Juan Quintela
  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
1894 fb599c9a balrog
fi
1895 e37630ca aliguori
if test "$xen" = "yes" ; then
1896 5647eb74 Juan Quintela
  echo "CONFIG_XEN=y" >> $config_host_mak
1897 e37630ca aliguori
fi
1898 e5d355d1 aliguori
if test "$io_thread" = "yes" ; then
1899 98ec69ac Juan Quintela
  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
1900 e5d355d1 aliguori
fi
1901 5c6c3a6c Christoph Hellwig
if test "$linux_aio" = "yes" ; then
1902 5c6c3a6c Christoph Hellwig
  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
1903 5c6c3a6c Christoph Hellwig
fi
1904 77755340 ths
if test "$blobs" = "yes" ; then
1905 98ec69ac Juan Quintela
  echo "INSTALL_BLOBS=yes" >> $config_host_mak
1906 77755340 ths
fi
1907 bf9298b9 aliguori
if test "$iovec" = "yes" ; then
1908 2358a494 Juan Quintela
  echo "CONFIG_IOVEC=y" >> $config_host_mak
1909 bf9298b9 aliguori
fi
1910 ceb42de8 aliguori
if test "$preadv" = "yes" ; then
1911 2358a494 Juan Quintela
  echo "CONFIG_PREADV=y" >> $config_host_mak
1912 ceb42de8 aliguori
fi
1913 f652e6af aurel32
if test "$fdt" = "yes" ; then
1914 3f0855b1 Juan Quintela
  echo "CONFIG_FDT=y" >> $config_host_mak
1915 f652e6af aurel32
fi
1916 de5071c5 Blue Swirl
if test "$need_offsetof" = "yes" ; then
1917 de5071c5 Blue Swirl
  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
1918 de5071c5 Blue Swirl
fi
1919 97a847bc bellard
1920 83fb7adf bellard
# XXX: suppress that
1921 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
1922 2358a494 Juan Quintela
  echo "CONFIG_BSD=y" >> $config_host_mak
1923 7d3505c5 bellard
fi
1924 7d3505c5 bellard
1925 2358a494 Juan Quintela
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
1926 c5937220 pbrook
1927 68063649 blueswir1
# USB host support
1928 68063649 blueswir1
case "$usb" in
1929 68063649 blueswir1
linux)
1930 98ec69ac Juan Quintela
  echo "HOST_USB=linux" >> $config_host_mak
1931 68063649 blueswir1
;;
1932 68063649 blueswir1
bsd)
1933 98ec69ac Juan Quintela
  echo "HOST_USB=bsd" >> $config_host_mak
1934 68063649 blueswir1
;;
1935 68063649 blueswir1
*)
1936 98ec69ac Juan Quintela
  echo "HOST_USB=stub" >> $config_host_mak
1937 68063649 blueswir1
;;
1938 68063649 blueswir1
esac
1939 68063649 blueswir1
1940 c39e3338 pbrook
tools=
1941 c39e3338 pbrook
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1942 3dd1f8ef aliguori
  tools="qemu-img\$(EXESUF) $tools"
1943 7a5ca864 bellard
  if [ "$linux" = "yes" ] ; then
1944 3dd1f8ef aliguori
      tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1945 5495ed11 Luiz Capitulino
    if [ "$check_utests" = "yes" ]; then
1946 7b8c51ad Luiz Capitulino
      tools="check-qint check-qstring check-qdict $tools"
1947 5495ed11 Luiz Capitulino
    fi
1948 c32d766a Stefan Weil
  elif test "$mingw32" = "yes" ; then
1949 c32d766a Stefan Weil
      tools="qemu-io\$(EXESUF) $tools"
1950 7a5ca864 bellard
  fi
1951 c39e3338 pbrook
fi
1952 98ec69ac Juan Quintela
echo "TOOLS=$tools" >> $config_host_mak
1953 c39e3338 pbrook
1954 161294d8 Juan Quintela
# Mac OS X ships with a broken assembler
1955 253d0942 Alexander Graf
roms=
1956 161294d8 Juan Quintela
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
1957 161294d8 Juan Quintela
        "$targetos" != "Darwin" ; then
1958 c05ac895 Paul Brook
  roms="optionrom"
1959 253d0942 Alexander Graf
fi
1960 98ec69ac Juan Quintela
echo "ROMS=$roms" >> $config_host_mak
1961 253d0942 Alexander Graf
1962 804edf29 Juan Quintela
echo "prefix=$prefix" >> $config_host_mak
1963 804edf29 Juan Quintela
echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
1964 804edf29 Juan Quintela
echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
1965 804edf29 Juan Quintela
echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
1966 804edf29 Juan Quintela
echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
1967 804edf29 Juan Quintela
echo "MAKE=$make" >> $config_host_mak
1968 804edf29 Juan Quintela
echo "INSTALL=$install" >> $config_host_mak
1969 804edf29 Juan Quintela
echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
1970 804edf29 Juan Quintela
echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
1971 804edf29 Juan Quintela
echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
1972 804edf29 Juan Quintela
echo "CC=$cc" >> $config_host_mak
1973 804edf29 Juan Quintela
echo "HOST_CC=$host_cc" >> $config_host_mak
1974 804edf29 Juan Quintela
if test "$sparse" = "yes" ; then
1975 804edf29 Juan Quintela
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
1976 804edf29 Juan Quintela
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
1977 a558ee17 Juan Quintela
  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
1978 804edf29 Juan Quintela
fi
1979 804edf29 Juan Quintela
echo "AR=$ar" >> $config_host_mak
1980 804edf29 Juan Quintela
echo "OBJCOPY=$objcopy" >> $config_host_mak
1981 804edf29 Juan Quintela
echo "LD=$ld" >> $config_host_mak
1982 e2a2ed06 Juan Quintela
echo "CFLAGS=$CFLAGS" >> $config_host_mak
1983 a558ee17 Juan Quintela
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
1984 c81da56e Juan Quintela
echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
1985 e2a2ed06 Juan Quintela
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
1986 a36abbbb Juan Quintela
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
1987 a36abbbb Juan Quintela
echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
1988 73da375e Juan Quintela
echo "LIBS+=$LIBS" >> $config_host_mak
1989 3e2e0e6b Juan Quintela
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
1990 804edf29 Juan Quintela
echo "EXESUF=$EXESUF" >> $config_host_mak
1991 804edf29 Juan Quintela
1992 2358a494 Juan Quintela
echo "/* Automatically generated by configure - do not modify */" > $config_host_h
1993 2358a494 Juan Quintela
1994 aa0cba4a malc
/bin/sh $source_path/create_config < $config_host_mak >> $config_host_h
1995 2358a494 Juan Quintela
1996 98ec69ac Juan Quintela
if test -f ${config_host_h}~ ; then
1997 98ec69ac Juan Quintela
  if cmp -s $config_host_h ${config_host_h}~ ; then
1998 98ec69ac Juan Quintela
    mv ${config_host_h}~ $config_host_h
1999 370ab986 Paul Brook
  else
2000 98ec69ac Juan Quintela
    rm ${config_host_h}~
2001 370ab986 Paul Brook
  fi
2002 370ab986 Paul Brook
fi
2003 370ab986 Paul Brook
2004 4bf6b55b Juan Quintela
# generate list of library paths for linker script
2005 4bf6b55b Juan Quintela
2006 4bf6b55b Juan Quintela
$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2007 4bf6b55b Juan Quintela
2008 4bf6b55b Juan Quintela
if test -f ${config_host_ld}~ ; then
2009 4bf6b55b Juan Quintela
  if cmp -s $config_host_ld ${config_host_ld}~ ; then
2010 4bf6b55b Juan Quintela
    mv ${config_host_ld}~ $config_host_ld
2011 4bf6b55b Juan Quintela
  else
2012 4bf6b55b Juan Quintela
    rm ${config_host_ld}~
2013 4bf6b55b Juan Quintela
  fi
2014 4bf6b55b Juan Quintela
fi
2015 4bf6b55b Juan Quintela
2016 1d14ffa9 bellard
for target in $target_list; do
2017 97a847bc bellard
target_dir="$target"
2018 97a847bc bellard
config_mak=$target_dir/config.mak
2019 97a847bc bellard
config_h=$target_dir/config.h
2020 600309b6 Blue Swirl
target_arch2=`echo $target | cut -d '-' -f 1`
2021 97a847bc bellard
target_bigendian="no"
2022 ea2d6a39 Juan Quintela
case "$target_arch2" in
2023 ea2d6a39 Juan Quintela
  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
2024 ea2d6a39 Juan Quintela
  target_bigendian=yes
2025 ea2d6a39 Juan Quintela
  ;;
2026 ea2d6a39 Juan Quintela
esac
2027 97a847bc bellard
target_softmmu="no"
2028 997344f3 bellard
target_user_only="no"
2029 831b7825 ths
target_linux_user="no"
2030 831b7825 ths
target_darwin_user="no"
2031 84778508 blueswir1
target_bsd_user="no"
2032 9e407a85 pbrook
case "$target" in
2033 600309b6 Blue Swirl
  ${target_arch2}-softmmu)
2034 9e407a85 pbrook
    target_softmmu="yes"
2035 9e407a85 pbrook
    ;;
2036 600309b6 Blue Swirl
  ${target_arch2}-linux-user)
2037 9e407a85 pbrook
    target_user_only="yes"
2038 9e407a85 pbrook
    target_linux_user="yes"
2039 9e407a85 pbrook
    ;;
2040 600309b6 Blue Swirl
  ${target_arch2}-darwin-user)
2041 9e407a85 pbrook
    target_user_only="yes"
2042 9e407a85 pbrook
    target_darwin_user="yes"
2043 9e407a85 pbrook
    ;;
2044 600309b6 Blue Swirl
  ${target_arch2}-bsd-user)
2045 84778508 blueswir1
    target_user_only="yes"
2046 84778508 blueswir1
    target_bsd_user="yes"
2047 84778508 blueswir1
    ;;
2048 9e407a85 pbrook
  *)
2049 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
2050 9e407a85 pbrook
    exit 1
2051 9e407a85 pbrook
    ;;
2052 9e407a85 pbrook
esac
2053 831b7825 ths
2054 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
2055 97a847bc bellard
2056 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
2057 15d9ca0f ths
2058 97a847bc bellard
mkdir -p $target_dir
2059 158142c2 bellard
mkdir -p $target_dir/fpu
2060 57fec1fe bellard
mkdir -p $target_dir/tcg
2061 59f2a787 Gerd Hoffmann
mkdir -p $target_dir/ide
2062 84778508 blueswir1
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
2063 69de927c bellard
  mkdir -p $target_dir/nwfpe
2064 69de927c bellard
fi
2065 69de927c bellard
2066 ec530c81 bellard
#
2067 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
2068 ec530c81 bellard
#
2069 ec530c81 bellard
rm -f $target_dir/Makefile
2070 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
2071 ec530c81 bellard
2072 97a847bc bellard
2073 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
2074 de83cd02 bellard
2075 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
2076 1e43adfc bellard
2077 e5fe0c52 pbrook
bflt="no"
2078 cb33da57 blueswir1
elfload32="no"
2079 bd0c5661 pbrook
target_nptl="no"
2080 600309b6 Blue Swirl
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
2081 42bc608b Juan Quintela
echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak
2082 56aebc89 pbrook
gdb_xml_files=""
2083 7ba1e619 aliguori
2084 938b1edd Juan Quintela
TARGET_ARCH="$target_arch2"
2085 6acff7da Juan Quintela
TARGET_BASE_ARCH=""
2086 e6e91b9c Juan Quintela
TARGET_ABI_DIR=""
2087 e73aae67 Juan Quintela
2088 600309b6 Blue Swirl
case "$target_arch2" in
2089 2408a527 aurel32
  i386)
2090 1ad2134f Paul Brook
    target_phys_bits=32
2091 2408a527 aurel32
  ;;
2092 2408a527 aurel32
  x86_64)
2093 6acff7da Juan Quintela
    TARGET_BASE_ARCH=i386
2094 1ad2134f Paul Brook
    target_phys_bits=64
2095 2408a527 aurel32
  ;;
2096 2408a527 aurel32
  alpha)
2097 1ad2134f Paul Brook
    target_phys_bits=64
2098 2408a527 aurel32
  ;;
2099 2408a527 aurel32
  arm|armeb)
2100 b498c8a0 Juan Quintela
    TARGET_ARCH=arm
2101 2408a527 aurel32
    bflt="yes"
2102 bd0c5661 pbrook
    target_nptl="yes"
2103 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2104 1ad2134f Paul Brook
    target_phys_bits=32
2105 2408a527 aurel32
  ;;
2106 2408a527 aurel32
  cris)
2107 253bd7f8 edgar_igl
    target_nptl="yes"
2108 1ad2134f Paul Brook
    target_phys_bits=32
2109 2408a527 aurel32
  ;;
2110 2408a527 aurel32
  m68k)
2111 2408a527 aurel32
    bflt="yes"
2112 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
2113 1ad2134f Paul Brook
    target_phys_bits=32
2114 2408a527 aurel32
  ;;
2115 72b675ca Edgar E. Iglesias
  microblaze)
2116 72b675ca Edgar E. Iglesias
    bflt="yes"
2117 72b675ca Edgar E. Iglesias
    target_nptl="yes"
2118 72b675ca Edgar E. Iglesias
    target_phys_bits=32
2119 72b675ca Edgar E. Iglesias
  ;;
2120 0adcffb1 Juan Quintela
  mips|mipsel)
2121 b498c8a0 Juan Quintela
    TARGET_ARCH=mips
2122 42bc608b Juan Quintela
    echo "TARGET_ABI_MIPSO32=y" >> $config_mak
2123 f04dc72f Paul Brook
    target_nptl="yes"
2124 1ad2134f Paul Brook
    target_phys_bits=64
2125 2408a527 aurel32
  ;;
2126 2408a527 aurel32
  mipsn32|mipsn32el)
2127 b498c8a0 Juan Quintela
    TARGET_ARCH=mipsn32
2128 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2129 42bc608b Juan Quintela
    echo "TARGET_ABI_MIPSN32=y" >> $config_mak
2130 1ad2134f Paul Brook
    target_phys_bits=64
2131 2408a527 aurel32
  ;;
2132 2408a527 aurel32
  mips64|mips64el)
2133 b498c8a0 Juan Quintela
    TARGET_ARCH=mips64
2134 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2135 42bc608b Juan Quintela
    echo "TARGET_ABI_MIPSN64=y" >> $config_mak
2136 1ad2134f Paul Brook
    target_phys_bits=64
2137 2408a527 aurel32
  ;;
2138 2408a527 aurel32
  ppc)
2139 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2140 1ad2134f Paul Brook
    target_phys_bits=32
2141 d6630708 Nathan Froyd
    target_nptl="yes"
2142 2408a527 aurel32
  ;;
2143 2408a527 aurel32
  ppcemb)
2144 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2145 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2146 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2147 1ad2134f Paul Brook
    target_phys_bits=64
2148 d6630708 Nathan Froyd
    target_nptl="yes"
2149 2408a527 aurel32
  ;;
2150 2408a527 aurel32
  ppc64)
2151 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2152 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2153 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2154 1ad2134f Paul Brook
    target_phys_bits=64
2155 2408a527 aurel32
  ;;
2156 2408a527 aurel32
  ppc64abi32)
2157 b498c8a0 Juan Quintela
    TARGET_ARCH=ppc64
2158 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2159 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2160 42bc608b Juan Quintela
    echo "TARGET_ABI32=y" >> $config_mak
2161 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2162 1ad2134f Paul Brook
    target_phys_bits=64
2163 2408a527 aurel32
  ;;
2164 2408a527 aurel32
  sh4|sh4eb)
2165 b498c8a0 Juan Quintela
    TARGET_ARCH=sh4
2166 2408a527 aurel32
    bflt="yes"
2167 0b6d3ae0 aurel32
    target_nptl="yes"
2168 1ad2134f Paul Brook
    target_phys_bits=32
2169 2408a527 aurel32
  ;;
2170 2408a527 aurel32
  sparc)
2171 1ad2134f Paul Brook
    target_phys_bits=64
2172 2408a527 aurel32
  ;;
2173 2408a527 aurel32
  sparc64)
2174 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2175 2408a527 aurel32
    elfload32="yes"
2176 1ad2134f Paul Brook
    target_phys_bits=64
2177 2408a527 aurel32
  ;;
2178 2408a527 aurel32
  sparc32plus)
2179 b498c8a0 Juan Quintela
    TARGET_ARCH=sparc64
2180 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2181 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=sparc
2182 42bc608b Juan Quintela
    echo "TARGET_ABI32=y" >> $config_mak
2183 1ad2134f Paul Brook
    target_phys_bits=64
2184 2408a527 aurel32
  ;;
2185 2408a527 aurel32
  *)
2186 2408a527 aurel32
    echo "Unsupported target CPU"
2187 2408a527 aurel32
    exit 1
2188 2408a527 aurel32
  ;;
2189 2408a527 aurel32
esac
2190 b498c8a0 Juan Quintela
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak
2191 053dd92e Juan Quintela
target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
2192 053dd92e Juan Quintela
echo "TARGET_$target_arch_name=y" >> $config_mak
2193 0adcffb1 Juan Quintela
echo "TARGET_ARCH2=$target_arch2" >> $config_mak
2194 42bc608b Juan Quintela
# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
2195 6acff7da Juan Quintela
if [ "$TARGET_BASE_ARCH" = "" ]; then
2196 6acff7da Juan Quintela
  TARGET_BASE_ARCH=$TARGET_ARCH
2197 6acff7da Juan Quintela
fi
2198 6acff7da Juan Quintela
echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak
2199 e6e91b9c Juan Quintela
if [ "$TARGET_ABI_DIR" = "" ]; then
2200 e6e91b9c Juan Quintela
  TARGET_ABI_DIR=$TARGET_ARCH
2201 e6e91b9c Juan Quintela
fi
2202 e6e91b9c Juan Quintela
echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_mak
2203 1ad2134f Paul Brook
if [ $target_phys_bits -lt $hostlongbits ] ; then
2204 1ad2134f Paul Brook
  target_phys_bits=$hostlongbits
2205 1ad2134f Paul Brook
fi
2206 1b0c87fc Juan Quintela
case "$target_arch2" in
2207 1b0c87fc Juan Quintela
  i386|x86_64)
2208 1b0c87fc Juan Quintela
    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2209 1b0c87fc Juan Quintela
      echo "CONFIG_XEN=y" >> $config_mak
2210 1b0c87fc Juan Quintela
    fi
2211 1b0c87fc Juan Quintela
esac
2212 c59249f9 Juan Quintela
case "$target_arch2" in
2213 5f114bc6 Alexander Graf
  i386|x86_64|ppcemb|ppc|ppc64)
2214 c59249f9 Juan Quintela
    # Make sure the target and host cpus are compatible
2215 c59249f9 Juan Quintela
    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2216 c59249f9 Juan Quintela
      \( "$target_arch2" = "$cpu" -o \
2217 c59249f9 Juan Quintela
      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2218 5f114bc6 Alexander Graf
      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
2219 c59249f9 Juan Quintela
      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
2220 c59249f9 Juan Quintela
      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
2221 c59249f9 Juan Quintela
      echo "CONFIG_KVM=y" >> $config_mak
2222 c59249f9 Juan Quintela
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
2223 c59249f9 Juan Quintela
    fi
2224 c59249f9 Juan Quintela
esac
2225 1ad2134f Paul Brook
echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
2226 42bc608b Juan Quintela
echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak
2227 1ad2134f Paul Brook
echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2228 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
2229 42bc608b Juan Quintela
  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_mak
2230 de83cd02 bellard
fi
2231 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
2232 e34af2ce Juan Quintela
  echo "CONFIG_SOFTMMU=y" >> $config_mak
2233 73da375e Juan Quintela
  echo "LIBS+=$libs_softmmu" >> $config_mak
2234 43ce4dfe bellard
fi
2235 997344f3 bellard
if test "$target_user_only" = "yes" ; then
2236 e34af2ce Juan Quintela
  echo "CONFIG_USER_ONLY=y" >> $config_mak
2237 997344f3 bellard
fi
2238 831b7825 ths
if test "$target_linux_user" = "yes" ; then
2239 e34af2ce Juan Quintela
  echo "CONFIG_LINUX_USER=y" >> $config_mak
2240 831b7825 ths
fi
2241 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
2242 e34af2ce Juan Quintela
  echo "CONFIG_DARWIN_USER=y" >> $config_mak
2243 831b7825 ths
fi
2244 56aebc89 pbrook
list=""
2245 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
2246 56aebc89 pbrook
  for x in $gdb_xml_files; do
2247 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
2248 56aebc89 pbrook
  done
2249 56aebc89 pbrook
fi
2250 56aebc89 pbrook
echo "TARGET_XML_FILES=$list" >> $config_mak
2251 97a847bc bellard
2252 f57975fb Juan Quintela
case "$target_arch2" in
2253 f57975fb Juan Quintela
  arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
2254 f57975fb Juan Quintela
    echo "CONFIG_SOFTFLOAT=y" >> $config_mak
2255 f57975fb Juan Quintela
    ;;
2256 d6b38939 Juan Quintela
  *)
2257 d6b38939 Juan Quintela
    echo "CONFIG_NOSOFTFLOAT=y" >> $config_mak
2258 d6b38939 Juan Quintela
    ;;
2259 f57975fb Juan Quintela
esac
2260 f57975fb Juan Quintela
2261 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2262 e34af2ce Juan Quintela
  echo "TARGET_HAS_BFLT=y" >> $config_mak
2263 e5fe0c52 pbrook
fi
2264 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
2265 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2266 2f7bb878 Juan Quintela
  echo "CONFIG_USE_NPTL=y" >> $config_mak
2267 bd0c5661 pbrook
fi
2268 cb33da57 blueswir1
# 32 bit ELF loader in addition to native 64 bit loader?
2269 cb33da57 blueswir1
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2270 e34af2ce Juan Quintela
  echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak
2271 cb33da57 blueswir1
fi
2272 379f6698 Paul Brook
if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2273 379f6698 Paul Brook
  echo "CONFIG_USE_GUEST_BASE=y" >> $config_mak
2274 379f6698 Paul Brook
fi
2275 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
2276 e34af2ce Juan Quintela
  echo "CONFIG_BSD_USER=y" >> $config_mak
2277 84778508 blueswir1
fi
2278 5b0753e0 bellard
2279 4afddb55 Juan Quintela
# generate QEMU_CFLAGS/LDFLAGS for targets
2280 fa282484 Juan Quintela
2281 4afddb55 Juan Quintela
cflags=""
2282 fa282484 Juan Quintela
ldflags=""
2283 9b8e111f Juan Quintela
2284 57ddfbf7 Juan Quintela
if test "$ARCH" = "sparc64" ; then
2285 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
2286 57ddfbf7 Juan Quintela
else
2287 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2288 57ddfbf7 Juan Quintela
fi
2289 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/tcg $cflags"
2290 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/fpu $cflags"
2291 57ddfbf7 Juan Quintela
2292 64656024 Juan Quintela
for i in $ARCH $TARGET_BASE_ARCH ; do
2293 64656024 Juan Quintela
  case "$i" in
2294 64656024 Juan Quintela
  alpha)
2295 64656024 Juan Quintela
    echo "CONFIG_ALPHA_DIS=y"  >> $config_mak
2296 64656024 Juan Quintela
  ;;
2297 64656024 Juan Quintela
  arm)
2298 64656024 Juan Quintela
    echo "CONFIG_ARM_DIS=y"  >> $config_mak
2299 64656024 Juan Quintela
  ;;
2300 64656024 Juan Quintela
  cris)
2301 64656024 Juan Quintela
    echo "CONFIG_CRIS_DIS=y"  >> $config_mak
2302 64656024 Juan Quintela
  ;;
2303 64656024 Juan Quintela
  hppa)
2304 64656024 Juan Quintela
    echo "CONFIG_HPPA_DIS=y"  >> $config_mak
2305 64656024 Juan Quintela
  ;;
2306 64656024 Juan Quintela
  i386|x86_64)
2307 64656024 Juan Quintela
    echo "CONFIG_I386_DIS=y"  >> $config_mak
2308 64656024 Juan Quintela
  ;;
2309 64656024 Juan Quintela
  m68k)
2310 64656024 Juan Quintela
    echo "CONFIG_M68K_DIS=y"  >> $config_mak
2311 64656024 Juan Quintela
  ;;
2312 64656024 Juan Quintela
  microblaze)
2313 64656024 Juan Quintela
    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_mak
2314 64656024 Juan Quintela
  ;;
2315 64656024 Juan Quintela
  mips*)
2316 64656024 Juan Quintela
    echo "CONFIG_MIPS_DIS=y"  >> $config_mak
2317 64656024 Juan Quintela
  ;;
2318 64656024 Juan Quintela
  ppc*)
2319 64656024 Juan Quintela
    echo "CONFIG_PPC_DIS=y"  >> $config_mak
2320 64656024 Juan Quintela
  ;;
2321 64656024 Juan Quintela
  s390)
2322 64656024 Juan Quintela
    echo "CONFIG_S390_DIS=y"  >> $config_mak
2323 64656024 Juan Quintela
  ;;
2324 64656024 Juan Quintela
  sh4)
2325 64656024 Juan Quintela
    echo "CONFIG_SH4_DIS=y"  >> $config_mak
2326 64656024 Juan Quintela
  ;;
2327 64656024 Juan Quintela
  sparc*)
2328 64656024 Juan Quintela
    echo "CONFIG_SPARC_DIS=y"  >> $config_mak
2329 64656024 Juan Quintela
  ;;
2330 64656024 Juan Quintela
  esac
2331 64656024 Juan Quintela
done
2332 64656024 Juan Quintela
2333 6ee7126f Juan Quintela
case "$ARCH" in
2334 6ee7126f Juan Quintela
alpha)
2335 6ee7126f Juan Quintela
  # Ensure there's only a single GP
2336 6ee7126f Juan Quintela
  cflags="-msmall-data $cflags"
2337 6ee7126f Juan Quintela
;;
2338 c60d0afa Juan Quintela
ia64)
2339 c60d0afa Juan Quintela
  cflags="-mno-sdata $cflags"
2340 c60d0afa Juan Quintela
;;
2341 6ee7126f Juan Quintela
esac
2342 6ee7126f Juan Quintela
2343 55d9c04b Juan Quintela
if test "$target_softmmu" = "yes" ; then
2344 55d9c04b Juan Quintela
  case "$TARGET_BASE_ARCH" in
2345 55d9c04b Juan Quintela
  arm)
2346 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO $cflags"
2347 55d9c04b Juan Quintela
  ;;
2348 55d9c04b Juan Quintela
  i386|mips|ppc)
2349 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2350 55d9c04b Juan Quintela
  ;;
2351 55d9c04b Juan Quintela
  esac
2352 55d9c04b Juan Quintela
fi
2353 55d9c04b Juan Quintela
2354 471857dd Juan Quintela
if test "$target_softmmu" = "yes" -a \( \
2355 471857dd Juan Quintela
        "$TARGET_ARCH" = "microblaze" -o \
2356 471857dd Juan Quintela
        "$TARGET_ARCH" = "cris" \) ; then
2357 471857dd Juan Quintela
  echo "CONFIG_NEED_MMU=y" >> $config_mak
2358 471857dd Juan Quintela
fi
2359 471857dd Juan Quintela
2360 d02c1db3 Juan Quintela
if test "$gprof" = "yes" ; then
2361 d02c1db3 Juan Quintela
  echo "TARGET_GPROF=yes" >> $config_mak
2362 d02c1db3 Juan Quintela
  if test "$target_linux_user" = "yes" ; then
2363 d02c1db3 Juan Quintela
    cflags="-p $cflags"
2364 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
2365 d02c1db3 Juan Quintela
  fi
2366 d02c1db3 Juan Quintela
  if test "$target_softmmu" = "yes" ; then
2367 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
2368 f622d8a3 Juan Quintela
    echo "GPROF_CFLAGS=-p" >> $config_mak
2369 d02c1db3 Juan Quintela
  fi
2370 d02c1db3 Juan Quintela
fi
2371 d02c1db3 Juan Quintela
2372 6ee7126f Juan Quintela
linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
2373 9b8e111f Juan Quintela
if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2374 fa282484 Juan Quintela
  case "$ARCH" in
2375 fa282484 Juan Quintela
  i386)
2376 fa282484 Juan Quintela
    if test "$gprof" = "yes" -o "$static" = "yes" ; then
2377 322e5878 Juan Quintela
      ldflags="$linker_script $ldflags"
2378 fa282484 Juan Quintela
    else
2379 fa282484 Juan Quintela
      # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
2380 fa282484 Juan Quintela
      # that the kernel ELF loader considers as an executable. I think this
2381 fa282484 Juan Quintela
      # is the simplest way to make it self virtualizable!
2382 322e5878 Juan Quintela
      ldflags="-Wl,-shared $ldflags"
2383 fa282484 Juan Quintela
    fi
2384 fa282484 Juan Quintela
    ;;
2385 fa282484 Juan Quintela
  sparc)
2386 fa282484 Juan Quintela
    # -static is used to avoid g1/g3 usage by the dynamic linker
2387 322e5878 Juan Quintela
    ldflags="$linker_script -static $ldflags"
2388 fa282484 Juan Quintela
    ;;
2389 fa282484 Juan Quintela
  ia64)
2390 322e5878 Juan Quintela
    ldflags="-Wl,-G0 $linker_script -static $ldflags"
2391 fa282484 Juan Quintela
    ;;
2392 fa282484 Juan Quintela
  x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
2393 322e5878 Juan Quintela
    ldflags="$linker_script $ldflags"
2394 fa282484 Juan Quintela
    ;;
2395 fa282484 Juan Quintela
  esac
2396 fa282484 Juan Quintela
fi
2397 fa282484 Juan Quintela
if test "$target_softmmu" = "yes" ; then
2398 fa282484 Juan Quintela
  case "$ARCH" in
2399 fa282484 Juan Quintela
  ia64)
2400 322e5878 Juan Quintela
    ldflags="-Wl,-G0 $linker_script -static $ldflags"
2401 fa282484 Juan Quintela
    ;;
2402 fa282484 Juan Quintela
  esac
2403 fa282484 Juan Quintela
fi
2404 fa282484 Juan Quintela
2405 07dac55d Juan Quintela
echo "LDFLAGS+=$ldflags" >> $config_mak
2406 4afddb55 Juan Quintela
echo "QEMU_CFLAGS+=$cflags" >> $config_mak
2407 fa282484 Juan Quintela
2408 2358a494 Juan Quintela
echo "/* Automatically generated by configure - do not modify */" > $config_h
2409 2358a494 Juan Quintela
echo "#include \"../config-host.h\"" >> $config_h
2410 2358a494 Juan Quintela
2411 aa0cba4a malc
/bin/sh $source_path/create_config < $config_mak >> $config_h
2412 42bc608b Juan Quintela
2413 a900c002 Juan Quintela
if test -f ${config_h}~ ; then
2414 a900c002 Juan Quintela
  if cmp -s $config_h ${config_h}~ ; then
2415 a900c002 Juan Quintela
    mv ${config_h}~ $config_h
2416 a900c002 Juan Quintela
  else
2417 a900c002 Juan Quintela
    rm ${config_h}~
2418 a900c002 Juan Quintela
  fi
2419 a900c002 Juan Quintela
fi
2420 15d9ca0f ths
2421 97a847bc bellard
done # for target in $targets
2422 7d13299d bellard
2423 7d13299d bellard
# build tree in object directory if source path is different from current one
2424 7d13299d bellard
if test "$source_path_used" = "yes" ; then
2425 253d0942 Alexander Graf
    DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
2426 c34ebfdc Anthony Liguori
    DIRS="$DIRS roms/pcbios roms/seabios roms/vgabios"
2427 7d13299d bellard
    FILES="Makefile tests/Makefile"
2428 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2429 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
2430 7ea78b74 Jan Kiszka
    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2431 c34ebfdc Anthony Liguori
    FILES="$FILES roms/pcbios/Makefile roms/seabios/Makefile roms/vgabios/Makefile"
2432 7ea78b74 Jan Kiszka
    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2433 7ea78b74 Jan Kiszka
        FILES="$FILES pc-bios/`basename $bios_file`"
2434 7ea78b74 Jan Kiszka
    done
2435 7d13299d bellard
    for dir in $DIRS ; do
2436 7d13299d bellard
            mkdir -p $dir
2437 7d13299d bellard
    done
2438 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
2439 7d13299d bellard
    for f in $FILES ; do
2440 ec530c81 bellard
        rm -f $f
2441 ec530c81 bellard
        ln -s $source_path/$f $f
2442 7d13299d bellard
    done
2443 7d13299d bellard
fi
2444 1ad2134f Paul Brook
2445 c34ebfdc Anthony Liguori
# temporary config to build submodules
2446 c34ebfdc Anthony Liguori
for rom in seabios vgabios pcbios; do
2447 c34ebfdc Anthony Liguori
    config_mak=roms/$rom/config.mak
2448 c34ebfdc Anthony Liguori
    echo "# Automatically generated by configure - do not modify" >> $config_mak
2449 c34ebfdc Anthony Liguori
    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2450 c34ebfdc Anthony Liguori
    echo "CC=$cc" >> $config_mak
2451 c34ebfdc Anthony Liguori
    echo "BCC=bcc" >> $config_mak
2452 c34ebfdc Anthony Liguori
    echo "CPP=${cross_prefix}cpp" >> $config_mak
2453 c34ebfdc Anthony Liguori
    echo "OBJCOPY=objcopy" >> $config_mak
2454 c34ebfdc Anthony Liguori
    echo "IASL=iasl" >> $config_mak
2455 c34ebfdc Anthony Liguori
    echo "HOST_CC=$host_cc" >> $config_mak
2456 c34ebfdc Anthony Liguori
    echo "LD=$ld" >> $config_mak
2457 c34ebfdc Anthony Liguori
done
2458 c34ebfdc Anthony Liguori
2459 1ad2134f Paul Brook
for hwlib in 32 64; do
2460 1ad2134f Paul Brook
  d=libhw$hwlib
2461 1ad2134f Paul Brook
  mkdir -p $d
2462 1ad2134f Paul Brook
  rm -f $d/Makefile
2463 1ad2134f Paul Brook
  ln -s $source_path/Makefile.hw $d/Makefile
2464 1ad2134f Paul Brook
  echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2465 a558ee17 Juan Quintela
  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2466 1ad2134f Paul Brook
done