Statistics
| Branch: | Revision:

root / configure @ ab4e5602

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