Statistics
| Branch: | Revision:

root / configure @ 636aa200

History | View | Annotate | Download (56.1 kB)

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