Statistics
| Branch: | Revision:

root / configure @ 169dc5d3

History | View | Annotate | Download (51.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 7d13299d bellard
  mips)
131 7d13299d bellard
    cpu="mips"
132 7d13299d bellard
  ;;
133 fbe4f65b ths
  mips64)
134 fbe4f65b ths
    cpu="mips64"
135 fbe4f65b ths
  ;;
136 fdf7ed96 malc
  ppc)
137 fdf7ed96 malc
    cpu="ppc"
138 fdf7ed96 malc
  ;;
139 fdf7ed96 malc
  ppc64)
140 fdf7ed96 malc
    cpu="ppc64"
141 e7daa605 ths
  ;;
142 0e7b8a9f ths
  s390*)
143 fb3e5849 bellard
    cpu="s390"
144 fb3e5849 bellard
  ;;
145 3142255c blueswir1
  sparc|sun4[cdmuv])
146 ae228531 bellard
    cpu="sparc"
147 ae228531 bellard
  ;;
148 ae228531 bellard
  sparc64)
149 ae228531 bellard
    cpu="sparc64"
150 ae228531 bellard
  ;;
151 7d13299d bellard
  *)
152 7d13299d bellard
    cpu="unknown"
153 7d13299d bellard
  ;;
154 7d13299d bellard
esac
155 7d13299d bellard
gprof="no"
156 03b4fe7d aliguori
sparse="no"
157 1625af87 aliguori
strip_opt="yes"
158 7d13299d bellard
bigendian="no"
159 67b915a5 bellard
mingw32="no"
160 67b915a5 bellard
EXESUF=""
161 67b915a5 bellard
gdbstub="yes"
162 443f1376 bellard
slirp="yes"
163 e0e6c8c0 aliguori
vde="yes"
164 102a52e4 bellard
fmod_lib=""
165 102a52e4 bellard
fmod_inc=""
166 2f6a1ab0 blueswir1
oss_lib=""
167 8d5d2d4c ths
vnc_tls="yes"
168 2f9606b3 aliguori
vnc_sasl="yes"
169 b1a550a0 pbrook
bsd="no"
170 5327cf48 bellard
linux="no"
171 d2c7c9b8 blueswir1
solaris="no"
172 c9ec1fe4 bellard
kqemu="no"
173 05c2a3e7 bellard
profiler="no"
174 5b0753e0 bellard
cocoa="no"
175 97ccc689 bellard
check_gfx="yes"
176 0a8e90f4 pbrook
softmmu="yes"
177 831b7825 ths
linux_user="no"
178 831b7825 ths
darwin_user="no"
179 84778508 blueswir1
bsd_user="no"
180 cc8ae6de pbrook
build_docs="no"
181 c5937220 pbrook
uname_release=""
182 4d3b6f6e balrog
curses="yes"
183 414f0dab blueswir1
aio="yes"
184 bd0c5661 pbrook
nptl="yes"
185 8ff9cbf7 malc
mixemu="no"
186 fb599c9a balrog
bluez="yes"
187 7ba1e619 aliguori
kvm="yes"
188 eac30262 aliguori
kerneldir=""
189 b29fe3ed malc
aix="no"
190 77755340 ths
blobs="yes"
191 f652e6af aurel32
fdt="yes"
192 5368a422 aliguori
sdl_x11="no"
193 4a19f1ec pbrook
pkgversion=""
194 7d13299d bellard
195 7d13299d bellard
# OS specific
196 ac0df51d aliguori
if check_define __linux__ ; then
197 ac0df51d aliguori
  targetos="Linux"
198 ac0df51d aliguori
elif check_define _WIN32 ; then
199 ac0df51d aliguori
  targetos='MINGW32'
200 169dc5d3 blueswir1
elif check_define __OpenBSD__ ; then
201 169dc5d3 blueswir1
  targetos='OpenBSD'
202 169dc5d3 blueswir1
elif check_define __sun__ ; then
203 169dc5d3 blueswir1
  targetos='SunOS'
204 ac0df51d aliguori
else
205 ac0df51d aliguori
  targetos=`uname -s`
206 ac0df51d aliguori
fi
207 7d13299d bellard
case $targetos in
208 c326e0af bellard
CYGWIN*)
209 c326e0af bellard
mingw32="yes"
210 6f30fa85 ths
OS_CFLAGS="-mno-cygwin"
211 db8d7dd1 ths
if [ "$cpu" = "i386" ] ; then
212 db8d7dd1 ths
    kqemu="yes"
213 db8d7dd1 ths
fi
214 c2de5c91 malc
audio_possible_drivers="sdl"
215 c326e0af bellard
;;
216 67b915a5 bellard
MINGW32*)
217 67b915a5 bellard
mingw32="yes"
218 db8d7dd1 ths
if [ "$cpu" = "i386" ] ; then
219 db8d7dd1 ths
    kqemu="yes"
220 db8d7dd1 ths
fi
221 c2de5c91 malc
audio_possible_drivers="dsound sdl fmod"
222 67b915a5 bellard
;;
223 5c40d2bd ths
GNU/kFreeBSD)
224 0c58ac1c malc
audio_drv_list="oss"
225 f34af52c aurel32
audio_possible_drivers="oss sdl esd pa"
226 5c40d2bd ths
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
227 5c40d2bd ths
    kqemu="yes"
228 5c40d2bd ths
fi
229 5c40d2bd ths
;;
230 7d3505c5 bellard
FreeBSD)
231 7d3505c5 bellard
bsd="yes"
232 0c58ac1c malc
audio_drv_list="oss"
233 f34af52c aurel32
audio_possible_drivers="oss sdl esd pa"
234 e99f9060 bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
235 07f4ddbf bellard
    kqemu="yes"
236 07f4ddbf bellard
fi
237 7d3505c5 bellard
;;
238 c5e97233 blueswir1
DragonFly)
239 c5e97233 blueswir1
bsd="yes"
240 c5e97233 blueswir1
audio_drv_list="oss"
241 c5e97233 blueswir1
audio_possible_drivers="oss sdl esd pa"
242 c5e97233 blueswir1
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
243 c5e97233 blueswir1
    kqemu="yes"
244 c5e97233 blueswir1
fi
245 c5e97233 blueswir1
aio="no"
246 c5e97233 blueswir1
;;
247 7d3505c5 bellard
NetBSD)
248 7d3505c5 bellard
bsd="yes"
249 0c58ac1c malc
audio_drv_list="oss"
250 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
251 8ef92a88 blueswir1
oss_lib="-lossaudio"
252 7d3505c5 bellard
;;
253 7d3505c5 bellard
OpenBSD)
254 7d3505c5 bellard
bsd="yes"
255 128ab2ff blueswir1
openbsd="yes"
256 0c58ac1c malc
audio_drv_list="oss"
257 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
258 2f6a1ab0 blueswir1
oss_lib="-lossaudio"
259 7d3505c5 bellard
;;
260 83fb7adf bellard
Darwin)
261 83fb7adf bellard
bsd="yes"
262 83fb7adf bellard
darwin="yes"
263 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
264 aab8588a malc
if [ "$cpu" = "i386" ] ; then
265 aab8588a malc
    is_x86_64=`sysctl -n hw.optional.x86_64`
266 aab8588a malc
    [ "$is_x86_64" = "1" ] && cpu=x86_64
267 1b0f9cc2 aliguori
fi
268 1b0f9cc2 aliguori
if [ "$cpu" = "x86_64" ] ; then
269 1b0f9cc2 aliguori
    OS_CFLAGS="-arch x86_64"
270 1b0f9cc2 aliguori
    LDFLAGS="-arch x86_64"
271 1b0f9cc2 aliguori
else
272 1b0f9cc2 aliguori
    OS_CFLAGS="-mdynamic-no-pic"
273 1b0f9cc2 aliguori
fi
274 831b7825 ths
darwin_user="yes"
275 fd677642 ths
cocoa="yes"
276 0c58ac1c malc
audio_drv_list="coreaudio"
277 c2de5c91 malc
audio_possible_drivers="coreaudio sdl fmod"
278 c2c59c3e ths
OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
279 83fb7adf bellard
;;
280 ec530c81 bellard
SunOS)
281 c2b84fab ths
    solaris="yes"
282 c2b84fab ths
    make="gmake"
283 c2b84fab ths
    install="ginstall"
284 0475a5ca ths
    needs_libsunmath="no"
285 acda94b1 blueswir1
    kvm="no"
286 c2b84fab ths
    solarisrev=`uname -r | cut -f2 -d.`
287 ef18c883 ths
    # have to select again, because `uname -m` returns i86pc
288 ef18c883 ths
    # even on an x86_64 box.
289 ef18c883 ths
    solariscpu=`isainfo -k`
290 ef18c883 ths
    if test "${solariscpu}" = "amd64" ; then
291 ef18c883 ths
        cpu="x86_64"
292 ef18c883 ths
    fi
293 c2b84fab ths
    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
294 0475a5ca ths
        if test "$solarisrev" -le 9 ; then
295 0475a5ca ths
            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
296 0475a5ca ths
                needs_libsunmath="yes"
297 0475a5ca ths
            else
298 0475a5ca ths
                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
299 0475a5ca ths
                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
300 0475a5ca ths
                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
301 0475a5ca ths
                echo "Studio 11 can be downloaded from www.sun.com."
302 0475a5ca ths
                exit 1
303 0475a5ca ths
            fi
304 0475a5ca ths
        fi
305 0475a5ca ths
        if test "$solarisrev" -ge 9 ; then
306 c2b84fab ths
            kqemu="yes"
307 c2b84fab ths
        fi
308 86b2bd93 ths
    fi
309 6b4d2ba1 ths
    if test -f /usr/include/sys/soundcard.h ; then
310 0c58ac1c malc
        audio_drv_list="oss"
311 6b4d2ba1 ths
    fi
312 c2de5c91 malc
    audio_possible_drivers="oss sdl"
313 14d483ec blueswir1
    OS_CFLAGS=-std=gnu99
314 86b2bd93 ths
;;
315 b29fe3ed malc
AIX)
316 b29fe3ed malc
aix="yes"
317 b29fe3ed malc
make="gmake"
318 b29fe3ed malc
;;
319 1d14ffa9 bellard
*)
320 0c58ac1c malc
audio_drv_list="oss"
321 b8e59f18 malc
audio_possible_drivers="oss alsa sdl esd pa"
322 5327cf48 bellard
linux="yes"
323 831b7825 ths
linux_user="yes"
324 68063649 blueswir1
usb="linux"
325 07f4ddbf bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
326 c9ec1fe4 bellard
    kqemu="yes"
327 c2de5c91 malc
    audio_possible_drivers="$audio_possible_drivers fmod"
328 c9ec1fe4 bellard
fi
329 fb065187 bellard
;;
330 7d13299d bellard
esac
331 7d13299d bellard
332 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
333 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
334 83fb7adf bellard
    make="gmake"
335 68063649 blueswir1
    usb="bsd"
336 83fb7adf bellard
  fi
337 84778508 blueswir1
  bsd_user="yes"
338 7d3505c5 bellard
fi
339 7d3505c5 bellard
340 7d13299d bellard
# find source path
341 ad064840 pbrook
source_path=`dirname "$0"`
342 59faef3a balrog
source_path_used="no"
343 59faef3a balrog
workdir=`pwd`
344 ad064840 pbrook
if [ -z "$source_path" ]; then
345 59faef3a balrog
    source_path=$workdir
346 ad064840 pbrook
else
347 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
348 7d13299d bellard
fi
349 724db118 pbrook
[ -f "$workdir/vl.c" ] || source_path_used="yes"
350 7d13299d bellard
351 85aa5189 bellard
werror="no"
352 0d1e2394 bellard
# generate compile errors on warnings for development builds
353 0d1e2394 bellard
#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
354 0d1e2394 bellard
#werror="yes";
355 0d1e2394 bellard
#fi
356 85aa5189 bellard
357 7d13299d bellard
for opt do
358 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
359 7d13299d bellard
  case "$opt" in
360 2efc3265 bellard
  --help|-h) show_help=yes
361 2efc3265 bellard
  ;;
362 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
363 7d13299d bellard
  ;;
364 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
365 32ce6337 bellard
  ;;
366 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
367 ad064840 pbrook
  source_path_used="yes"
368 7d13299d bellard
  ;;
369 ac0df51d aliguori
  --cross-prefix=*)
370 7d13299d bellard
  ;;
371 ac0df51d aliguori
  --cc=*)
372 7d13299d bellard
  ;;
373 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
374 83469015 bellard
  ;;
375 b1a550a0 pbrook
  --make=*) make="$optarg"
376 7d13299d bellard
  ;;
377 6a882643 pbrook
  --install=*) install="$optarg"
378 6a882643 pbrook
  ;;
379 b1a550a0 pbrook
  --extra-cflags=*) CFLAGS="$optarg"
380 7d13299d bellard
  ;;
381 b1a550a0 pbrook
  --extra-ldflags=*) LDFLAGS="$optarg"
382 7d13299d bellard
  ;;
383 b1a550a0 pbrook
  --cpu=*) cpu="$optarg"
384 7d13299d bellard
  ;;
385 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
386 de83cd02 bellard
  ;;
387 7d13299d bellard
  --enable-gprof) gprof="yes"
388 7d13299d bellard
  ;;
389 43ce4dfe bellard
  --static) static="yes"
390 43ce4dfe bellard
  ;;
391 97a847bc bellard
  --disable-sdl) sdl="no"
392 97a847bc bellard
  ;;
393 0c58ac1c malc
  --fmod-lib=*) fmod_lib="$optarg"
394 1d14ffa9 bellard
  ;;
395 c2de5c91 malc
  --fmod-inc=*) fmod_inc="$optarg"
396 c2de5c91 malc
  ;;
397 2f6a1ab0 blueswir1
  --oss-lib=*) oss_lib="$optarg"
398 2f6a1ab0 blueswir1
  ;;
399 2fa7d3bf malc
  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
400 102a52e4 bellard
  ;;
401 0c58ac1c malc
  --audio-drv-list=*) audio_drv_list="$optarg"
402 102a52e4 bellard
  ;;
403 03b4fe7d aliguori
  --enable-sparse) sparse="yes"
404 03b4fe7d aliguori
  ;;
405 03b4fe7d aliguori
  --disable-sparse) sparse="no"
406 03b4fe7d aliguori
  ;;
407 1625af87 aliguori
  --disable-strip) strip_opt="no"
408 1625af87 aliguori
  ;;
409 8d5d2d4c ths
  --disable-vnc-tls) vnc_tls="no"
410 8d5d2d4c ths
  ;;
411 2f9606b3 aliguori
  --disable-vnc-sasl) vnc_sasl="no"
412 2f9606b3 aliguori
  ;;
413 443f1376 bellard
  --disable-slirp) slirp="no"
414 1d14ffa9 bellard
  ;;
415 e0e6c8c0 aliguori
  --disable-vde) vde="no"
416 8a16d273 ths
  ;;
417 c9ec1fe4 bellard
  --disable-kqemu) kqemu="no"
418 1d14ffa9 bellard
  ;;
419 2e4d9fb1 aurel32
  --disable-brlapi) brlapi="no"
420 2e4d9fb1 aurel32
  ;;
421 fb599c9a balrog
  --disable-bluez) bluez="no"
422 fb599c9a balrog
  ;;
423 7ba1e619 aliguori
  --disable-kvm) kvm="no"
424 7ba1e619 aliguori
  ;;
425 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
426 05c2a3e7 bellard
  ;;
427 c2de5c91 malc
  --enable-cocoa)
428 c2de5c91 malc
      cocoa="yes" ;
429 c2de5c91 malc
      sdl="no" ;
430 c2de5c91 malc
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
431 1d14ffa9 bellard
  ;;
432 97ccc689 bellard
  --disable-gfx-check) check_gfx="no"
433 97ccc689 bellard
  ;;
434 cad25d69 pbrook
  --disable-system) softmmu="no"
435 0a8e90f4 pbrook
  ;;
436 cad25d69 pbrook
  --enable-system) softmmu="yes"
437 0a8e90f4 pbrook
  ;;
438 831b7825 ths
  --disable-linux-user) linux_user="no"
439 0a8e90f4 pbrook
  ;;
440 831b7825 ths
  --enable-linux-user) linux_user="yes"
441 831b7825 ths
  ;;
442 831b7825 ths
  --disable-darwin-user) darwin_user="no"
443 831b7825 ths
  ;;
444 831b7825 ths
  --enable-darwin-user) darwin_user="yes"
445 0a8e90f4 pbrook
  ;;
446 84778508 blueswir1
  --disable-bsd-user) bsd_user="no"
447 84778508 blueswir1
  ;;
448 84778508 blueswir1
  --enable-bsd-user) bsd_user="yes"
449 84778508 blueswir1
  ;;
450 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
451 c5937220 pbrook
  ;;
452 3142255c blueswir1
  --sparc_cpu=*)
453 3142255c blueswir1
      sparc_cpu="$optarg"
454 3142255c blueswir1
      case $sparc_cpu in
455 3142255c blueswir1
        v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
456 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
457 3142255c blueswir1
        v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
458 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
459 3142255c blueswir1
        v9)    SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
460 3142255c blueswir1
                 target_cpu="sparc64"; cpu="sparc64" ;;
461 3142255c blueswir1
        *)     echo "undefined SPARC architecture. Exiting";exit 1;;
462 3142255c blueswir1
      esac
463 3142255c blueswir1
  ;;
464 85aa5189 bellard
  --enable-werror) werror="yes"
465 85aa5189 bellard
  ;;
466 85aa5189 bellard
  --disable-werror) werror="no"
467 85aa5189 bellard
  ;;
468 4d3b6f6e balrog
  --disable-curses) curses="no"
469 4d3b6f6e balrog
  ;;
470 bd0c5661 pbrook
  --disable-nptl) nptl="no"
471 bd0c5661 pbrook
  ;;
472 8ff9cbf7 malc
  --enable-mixemu) mixemu="yes"
473 8ff9cbf7 malc
  ;;
474 414f0dab blueswir1
  --disable-aio) aio="no"
475 414f0dab blueswir1
  ;;
476 77755340 ths
  --disable-blobs) blobs="no"
477 77755340 ths
  ;;
478 eac30262 aliguori
  --kerneldir=*) kerneldir="$optarg"
479 eac30262 aliguori
  ;;
480 4a19f1ec pbrook
  --with-pkgversion=*) pkgversion=" ($optarg)"
481 4a19f1ec pbrook
  ;;
482 7f1559c6 balrog
  *) echo "ERROR: unknown option $opt"; show_help="yes"
483 7f1559c6 balrog
  ;;
484 7d13299d bellard
  esac
485 7d13299d bellard
done
486 7d13299d bellard
487 6f30fa85 ths
# default flags for all hosts
488 ac41a620 blueswir1
CFLAGS="$CFLAGS -O2 -g -fno-strict-aliasing"
489 e0e36fe9 blueswir1
CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
490 6f30fa85 ths
LDFLAGS="$LDFLAGS -g"
491 85aa5189 bellard
if test "$werror" = "yes" ; then
492 85aa5189 bellard
CFLAGS="$CFLAGS -Werror"
493 85aa5189 bellard
fi
494 6f30fa85 ths
495 d2c7c9b8 blueswir1
if test "$solaris" = "no" ; then
496 d2c7c9b8 blueswir1
    if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
497 d2c7c9b8 blueswir1
        LDFLAGS="$LDFLAGS -Wl,--warn-common"
498 d2c7c9b8 blueswir1
    fi
499 49237acd blueswir1
fi
500 49237acd blueswir1
501 3142255c blueswir1
#
502 3142255c blueswir1
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
503 3142255c blueswir1
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
504 3142255c blueswir1
#
505 40293e58 bellard
case "$cpu" in
506 3142255c blueswir1
    sparc) if test -z "$sparc_cpu" ; then
507 3142255c blueswir1
               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
508 3142255c blueswir1
               ARCH_LDFLAGS="-m32"
509 3142255c blueswir1
           else
510 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
511 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
512 3142255c blueswir1
           fi
513 762e8230 blueswir1
           ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
514 762e8230 blueswir1
           if test "$solaris" = "no" ; then
515 762e8230 blueswir1
               ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
516 762e8230 blueswir1
           fi
517 3142255c blueswir1
           ;;
518 3142255c blueswir1
    sparc64) if test -z "$sparc_cpu" ; then
519 3142255c blueswir1
               ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
520 3142255c blueswir1
               ARCH_LDFLAGS="-m64"
521 3142255c blueswir1
           else
522 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
523 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
524 3142255c blueswir1
           fi
525 762e8230 blueswir1
           if test "$solaris" = "no" ; then
526 762e8230 blueswir1
               ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
527 762e8230 blueswir1
           else
528 762e8230 blueswir1
               ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
529 762e8230 blueswir1
           fi
530 3142255c blueswir1
           ;;
531 76d83bde ths
    s390)
532 76d83bde ths
           ARCH_CFLAGS="-march=z900"
533 76d83bde ths
           ;;
534 40293e58 bellard
    i386)
535 40293e58 bellard
           ARCH_CFLAGS="-m32"
536 40293e58 bellard
           ARCH_LDFLAGS="-m32"
537 40293e58 bellard
           ;;
538 40293e58 bellard
    x86_64)
539 40293e58 bellard
           ARCH_CFLAGS="-m64"
540 40293e58 bellard
           ARCH_LDFLAGS="-m64"
541 40293e58 bellard
           ;;
542 3142255c blueswir1
esac
543 3142255c blueswir1
544 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
545 af5db58e pbrook
cat << EOF
546 af5db58e pbrook
547 af5db58e pbrook
Usage: configure [options]
548 af5db58e pbrook
Options: [defaults in brackets after descriptions]
549 af5db58e pbrook
550 af5db58e pbrook
EOF
551 af5db58e pbrook
echo "Standard options:"
552 af5db58e pbrook
echo "  --help                   print this message"
553 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
554 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
555 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
556 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
557 af5db58e pbrook
echo ""
558 af5db58e pbrook
echo "kqemu kernel acceleration support:"
559 af5db58e pbrook
echo "  --disable-kqemu          disable kqemu support"
560 af5db58e pbrook
echo ""
561 af5db58e pbrook
echo "Advanced options (experts only):"
562 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
563 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
564 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
565 af5db58e pbrook
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
566 2981fa96 aurel32
echo "  --extra-cflags=CFLAGS    add C compiler flags CFLAGS"
567 2981fa96 aurel32
echo "  --extra-ldflags=LDFLAGS  add linker flags LDFLAGS"
568 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
569 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
570 af5db58e pbrook
echo "  --static                 enable static build [$static]"
571 890b1658 aliguori
echo "  --enable-sparse          enable sparse checker"
572 890b1658 aliguori
echo "  --disable-sparse         disable sparse checker (default)"
573 1625af87 aliguori
echo "  --disable-strip          disable stripping binaries"
574 85aa5189 bellard
echo "  --disable-werror         disable compilation abort on warning"
575 fe8f78e4 balrog
echo "  --disable-sdl            disable SDL"
576 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
577 c2de5c91 malc
echo "  --audio-drv-list=LIST    set audio drivers list:"
578 c2de5c91 malc
echo "                           Available drivers: $audio_possible_drivers"
579 4c9b53e3 malc
echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
580 4c9b53e3 malc
echo "                           Available cards: $audio_possible_cards"
581 8ff9cbf7 malc
echo "  --enable-mixemu          enable mixer emulation"
582 2e4d9fb1 aurel32
echo "  --disable-brlapi         disable BrlAPI"
583 8d5d2d4c ths
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
584 2f9606b3 aliguori
echo "  --disable-vnc-sasl       disable SASL encryption for VNC server"
585 af896aaa pbrook
echo "  --disable-curses         disable curses output"
586 fb599c9a balrog
echo "  --disable-bluez          disable bluez stack connectivity"
587 7ba1e619 aliguori
echo "  --disable-kvm            disable KVM acceleration support"
588 bd0c5661 pbrook
echo "  --disable-nptl           disable usermode NPTL support"
589 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
590 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
591 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
592 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
593 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
594 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
595 84778508 blueswir1
echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
596 84778508 blueswir1
echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
597 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
598 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
599 2f6a1ab0 blueswir1
echo "  --oss-lib                path to OSS library"
600 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
601 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
602 e0e6c8c0 aliguori
echo "  --disable-vde            disable support for vde network"
603 414f0dab blueswir1
echo "  --disable-aio            disable AIO support"
604 77755340 ths
echo "  --disable-blobs          disable installing provided firmware blobs"
605 eac30262 aliguori
echo "  --kerneldir=PATH         look for kernel includes in PATH"
606 af5db58e pbrook
echo ""
607 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
608 af5db58e pbrook
exit 1
609 af5db58e pbrook
fi
610 af5db58e pbrook
611 67b915a5 bellard
if test "$mingw32" = "yes" ; then
612 5327cf48 bellard
    linux="no"
613 67b915a5 bellard
    EXESUF=".exe"
614 9f059eca bellard
    oss="no"
615 cd01b4a3 aliguori
    linux_user="no"
616 84778508 blueswir1
    bsd_user="no"
617 49dc768d aliguori
    OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
618 cd01b4a3 aliguori
fi
619 cd01b4a3 aliguori
620 03b4fe7d aliguori
if test ! -x "$(which cgcc 2>/dev/null)"; then
621 03b4fe7d aliguori
    sparse="no"
622 03b4fe7d aliguori
fi
623 03b4fe7d aliguori
624 ec530c81 bellard
#
625 ec530c81 bellard
# Solaris specific configure tool chain decisions
626 ec530c81 bellard
#
627 ec530c81 bellard
if test "$solaris" = "yes" ; then
628 ec530c81 bellard
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
629 ec530c81 bellard
  if test -z "$solinst" ; then
630 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
631 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
632 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
633 ec530c81 bellard
    exit 1
634 ec530c81 bellard
  fi
635 ec530c81 bellard
  if test "$solinst" = "/usr/sbin/install" ; then
636 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
637 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
638 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
639 ec530c81 bellard
    exit 1
640 ec530c81 bellard
  fi
641 ec530c81 bellard
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
642 ec530c81 bellard
  if test -z "$sol_ar" ; then
643 ec530c81 bellard
    echo "Error: No path includes ar"
644 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
645 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
646 ec530c81 bellard
    fi
647 ec530c81 bellard
    exit 1
648 ec530c81 bellard
  fi
649 5fafdf24 ths
fi
650 ec530c81 bellard
651 ec530c81 bellard
652 5327cf48 bellard
if test -z "$target_list" ; then
653 5327cf48 bellard
# these targets are portable
654 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
655 2408a527 aurel32
        target_list="\
656 2408a527 aurel32
i386-softmmu \
657 2408a527 aurel32
x86_64-softmmu \
658 2408a527 aurel32
arm-softmmu \
659 2408a527 aurel32
cris-softmmu \
660 2408a527 aurel32
m68k-softmmu \
661 2408a527 aurel32
mips-softmmu \
662 2408a527 aurel32
mipsel-softmmu \
663 2408a527 aurel32
mips64-softmmu \
664 2408a527 aurel32
mips64el-softmmu \
665 2408a527 aurel32
ppc-softmmu \
666 2408a527 aurel32
ppcemb-softmmu \
667 2408a527 aurel32
ppc64-softmmu \
668 2408a527 aurel32
sh4-softmmu \
669 2408a527 aurel32
sh4eb-softmmu \
670 2408a527 aurel32
sparc-softmmu \
671 2408a527 aurel32
"
672 0a8e90f4 pbrook
    fi
673 5327cf48 bellard
# the following are Linux specific
674 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
675 2408a527 aurel32
        target_list="${target_list}\
676 2408a527 aurel32
i386-linux-user \
677 2408a527 aurel32
x86_64-linux-user \
678 2408a527 aurel32
alpha-linux-user \
679 2408a527 aurel32
arm-linux-user \
680 2408a527 aurel32
armeb-linux-user \
681 2408a527 aurel32
cris-linux-user \
682 2408a527 aurel32
m68k-linux-user \
683 2408a527 aurel32
mips-linux-user \
684 2408a527 aurel32
mipsel-linux-user \
685 2408a527 aurel32
ppc-linux-user \
686 2408a527 aurel32
ppc64-linux-user \
687 2408a527 aurel32
ppc64abi32-linux-user \
688 2408a527 aurel32
sh4-linux-user \
689 2408a527 aurel32
sh4eb-linux-user \
690 2408a527 aurel32
sparc-linux-user \
691 2408a527 aurel32
sparc64-linux-user \
692 2408a527 aurel32
sparc32plus-linux-user \
693 2408a527 aurel32
"
694 831b7825 ths
    fi
695 831b7825 ths
# the following are Darwin specific
696 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
697 6cdc7375 malc
        target_list="$target_list i386-darwin-user ppc-darwin-user "
698 5327cf48 bellard
    fi
699 84778508 blueswir1
# the following are BSD specific
700 84778508 blueswir1
    if [ "$bsd_user" = "yes" ] ; then
701 84778508 blueswir1
        target_list="${target_list}\
702 31fc12df blueswir1
i386-bsd-user \
703 31fc12df blueswir1
x86_64-bsd-user \
704 31fc12df blueswir1
sparc-bsd-user \
705 84778508 blueswir1
sparc64-bsd-user \
706 84778508 blueswir1
"
707 84778508 blueswir1
    fi
708 6e20a45f bellard
else
709 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
710 5327cf48 bellard
fi
711 0a8e90f4 pbrook
if test -z "$target_list" ; then
712 0a8e90f4 pbrook
    echo "No targets enabled"
713 0a8e90f4 pbrook
    exit 1
714 0a8e90f4 pbrook
fi
715 5327cf48 bellard
716 7d13299d bellard
if test -z "$cross_prefix" ; then
717 7d13299d bellard
718 7d13299d bellard
# ---
719 7d13299d bellard
# big/little endian test
720 7d13299d bellard
cat > $TMPC << EOF
721 7d13299d bellard
#include <inttypes.h>
722 7d13299d bellard
int main(int argc, char ** argv){
723 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
724 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
725 7d13299d bellard
}
726 7d13299d bellard
EOF
727 7d13299d bellard
728 178baee6 aurel32
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
729 7d13299d bellard
$TMPE && bigendian="yes"
730 7d13299d bellard
else
731 7d13299d bellard
echo big/little test failed
732 7d13299d bellard
fi
733 7d13299d bellard
734 7d13299d bellard
else
735 7d13299d bellard
736 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
737 0938cda5 aurel32
if test "$cpu" = "armv4b" \
738 f54b3f92 aurel32
     -o "$cpu" = "hppa" \
739 0938cda5 aurel32
     -o "$cpu" = "m68k" \
740 0938cda5 aurel32
     -o "$cpu" = "mips" \
741 0938cda5 aurel32
     -o "$cpu" = "mips64" \
742 fdf7ed96 malc
     -o "$cpu" = "ppc" \
743 fdf7ed96 malc
     -o "$cpu" = "ppc64" \
744 0938cda5 aurel32
     -o "$cpu" = "s390" \
745 0938cda5 aurel32
     -o "$cpu" = "sparc" \
746 0938cda5 aurel32
     -o "$cpu" = "sparc64"; then
747 7d13299d bellard
    bigendian="yes"
748 7d13299d bellard
fi
749 7d13299d bellard
750 7d13299d bellard
fi
751 7d13299d bellard
752 b6853697 bellard
# host long bits test
753 b6853697 bellard
hostlongbits="32"
754 0938cda5 aurel32
if test "$cpu" = "x86_64" \
755 0938cda5 aurel32
     -o "$cpu" = "alpha" \
756 0938cda5 aurel32
     -o "$cpu" = "ia64" \
757 fdf7ed96 malc
     -o "$cpu" = "sparc64" \
758 fdf7ed96 malc
     -o "$cpu" = "ppc64"; then
759 b6853697 bellard
    hostlongbits="64"
760 b6853697 bellard
fi
761 b6853697 bellard
762 bd0c5661 pbrook
# Check host NPTL support
763 bd0c5661 pbrook
cat > $TMPC <<EOF
764 bd0c5661 pbrook
#include <sched.h>
765 30813cea pbrook
#include <linux/futex.h>
766 bd0c5661 pbrook
void foo()
767 bd0c5661 pbrook
{
768 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
769 bd0c5661 pbrook
#error bork
770 bd0c5661 pbrook
#endif
771 bd0c5661 pbrook
}
772 bd0c5661 pbrook
EOF
773 bd0c5661 pbrook
774 8c7f7574 balrog
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
775 bd0c5661 pbrook
  :
776 bd0c5661 pbrook
else
777 bd0c5661 pbrook
   nptl="no"
778 bd0c5661 pbrook
fi
779 bd0c5661 pbrook
780 11d9f695 bellard
##########################################
781 ac62922e balrog
# zlib check
782 ac62922e balrog
783 ac62922e balrog
cat > $TMPC << EOF
784 ac62922e balrog
#include <zlib.h>
785 ac62922e balrog
int main(void) { zlibVersion(); return 0; }
786 ac62922e balrog
EOF
787 8c7f7574 balrog
if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
788 ac62922e balrog
    :
789 ac62922e balrog
else
790 ac62922e balrog
    echo
791 ac62922e balrog
    echo "Error: zlib check failed"
792 ac62922e balrog
    echo "Make sure to have the zlib libs and headers installed."
793 ac62922e balrog
    echo
794 ac62922e balrog
    exit 1
795 ac62922e balrog
fi
796 ac62922e balrog
797 ac62922e balrog
##########################################
798 11d9f695 bellard
# SDL probe
799 11d9f695 bellard
800 11d9f695 bellard
sdl_too_old=no
801 11d9f695 bellard
802 11d9f695 bellard
if test -z "$sdl" ; then
803 069b0bda ths
    sdl_config="sdl-config"
804 069b0bda ths
    sdl=no
805 069b0bda ths
    sdl_static=no
806 069b0bda ths
807 11d9f695 bellard
cat > $TMPC << EOF
808 11d9f695 bellard
#include <SDL.h>
809 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
810 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
811 11d9f695 bellard
EOF
812 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
813 cd01b4a3 aliguori
        _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
814 cd01b4a3 aliguori
        if test "$_sdlversion" -lt 121 ; then
815 cd01b4a3 aliguori
            sdl_too_old=yes
816 cd01b4a3 aliguori
        else
817 cd01b4a3 aliguori
            if test "$cocoa" = "no" ; then
818 cd01b4a3 aliguori
                sdl=yes
819 069b0bda ths
            fi
820 cd01b4a3 aliguori
        fi
821 11d9f695 bellard
822 cd01b4a3 aliguori
        # static link with sdl ?
823 cd01b4a3 aliguori
        if test "$sdl" = "yes" ; then
824 cd01b4a3 aliguori
            aa="no"
825 cd01b4a3 aliguori
            `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
826 cd01b4a3 aliguori
            sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
827 cd01b4a3 aliguori
            if [ "$aa" = "yes" ] ; then
828 cd01b4a3 aliguori
                sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
829 cd01b4a3 aliguori
            fi
830 cd01b4a3 aliguori
831 8c7f7574 balrog
            if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
832 cd01b4a3 aliguori
                sdl_static=yes
833 cd01b4a3 aliguori
            fi
834 cd01b4a3 aliguori
        fi # static link
835 cd01b4a3 aliguori
    fi # sdl compile test
836 fd677642 ths
else
837 069b0bda ths
    # Make sure to disable cocoa if sdl was set
838 069b0bda ths
    if test "$sdl" = "yes" ; then
839 069b0bda ths
       cocoa="no"
840 c2de5c91 malc
       audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
841 069b0bda ths
    fi
842 a6e022ad bellard
fi # -z $sdl
843 11d9f695 bellard
844 5368a422 aliguori
if test "$sdl" = "yes" ; then
845 5368a422 aliguori
cat > $TMPC <<EOF
846 5368a422 aliguori
#include <SDL.h>
847 5368a422 aliguori
#if defined(SDL_VIDEO_DRIVER_X11)
848 5368a422 aliguori
#include <X11/XKBlib.h>
849 5368a422 aliguori
#else
850 5368a422 aliguori
#error No x11 support
851 5368a422 aliguori
#endif
852 5368a422 aliguori
int main(void) { return 0; }
853 5368a422 aliguori
EOF
854 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
855 5368a422 aliguori
	sdl_x11="yes"
856 5368a422 aliguori
    fi
857 5368a422 aliguori
fi
858 5368a422 aliguori
859 8f28f3fb ths
##########################################
860 8d5d2d4c ths
# VNC TLS detection
861 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
862 ae6b5e5a aliguori
cat > $TMPC <<EOF
863 ae6b5e5a aliguori
#include <gnutls/gnutls.h>
864 ae6b5e5a aliguori
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
865 ae6b5e5a aliguori
EOF
866 ae6b5e5a aliguori
    vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
867 ae6b5e5a aliguori
    vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
868 ae6b5e5a aliguori
    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
869 8c7f7574 balrog
           $vnc_tls_libs > /dev/null 2> /dev/null ; then
870 ae6b5e5a aliguori
	:
871 ae6b5e5a aliguori
    else
872 ae6b5e5a aliguori
	vnc_tls="no"
873 ae6b5e5a aliguori
    fi
874 8d5d2d4c ths
fi
875 8d5d2d4c ths
876 8d5d2d4c ths
##########################################
877 2f9606b3 aliguori
# VNC SASL detection
878 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
879 2f9606b3 aliguori
cat > $TMPC <<EOF
880 2f9606b3 aliguori
#include <sasl/sasl.h>
881 2f9606b3 aliguori
#include <stdio.h>
882 2f9606b3 aliguori
int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
883 2f9606b3 aliguori
EOF
884 2f9606b3 aliguori
    # Assuming Cyrus-SASL installed in /usr prefix
885 2f9606b3 aliguori
    vnc_sasl_cflags=""
886 2f9606b3 aliguori
    vnc_sasl_libs="-lsasl2"
887 2f9606b3 aliguori
    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
888 2f9606b3 aliguori
           $vnc_sasl_libs 2> /dev/null ; then
889 2f9606b3 aliguori
	:
890 2f9606b3 aliguori
    else
891 2f9606b3 aliguori
	vnc_sasl="no"
892 2f9606b3 aliguori
    fi
893 2f9606b3 aliguori
fi
894 2f9606b3 aliguori
895 2f9606b3 aliguori
##########################################
896 76655d6d aliguori
# fnmatch() probe, used for ACL routines
897 76655d6d aliguori
fnmatch="no"
898 76655d6d aliguori
cat > $TMPC << EOF
899 76655d6d aliguori
#include <fnmatch.h>
900 76655d6d aliguori
int main(void)
901 76655d6d aliguori
{
902 76655d6d aliguori
    fnmatch("foo", "foo", 0);
903 76655d6d aliguori
    return 0;
904 76655d6d aliguori
}
905 76655d6d aliguori
EOF
906 76655d6d aliguori
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
907 76655d6d aliguori
   fnmatch="yes"
908 76655d6d aliguori
fi
909 76655d6d aliguori
910 76655d6d aliguori
##########################################
911 8a16d273 ths
# vde libraries probe
912 8a16d273 ths
if test "$vde" = "yes" ; then
913 8a16d273 ths
  cat > $TMPC << EOF
914 8a16d273 ths
#include <libvdeplug.h>
915 4a7f0e06 pbrook
int main(void)
916 4a7f0e06 pbrook
{
917 4a7f0e06 pbrook
    struct vde_open_args a = {0, 0, 0};
918 4a7f0e06 pbrook
    vde_open("", "", &a);
919 4a7f0e06 pbrook
    return 0;
920 4a7f0e06 pbrook
}
921 8a16d273 ths
EOF
922 8c7f7574 balrog
    if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
923 8a16d273 ths
        :
924 8a16d273 ths
    else
925 e0e6c8c0 aliguori
        vde="no"
926 8a16d273 ths
    fi
927 8a16d273 ths
fi
928 8a16d273 ths
929 8a16d273 ths
##########################################
930 c2de5c91 malc
# Sound support libraries probe
931 8f28f3fb ths
932 c2de5c91 malc
audio_drv_probe()
933 c2de5c91 malc
{
934 c2de5c91 malc
    drv=$1
935 c2de5c91 malc
    hdr=$2
936 c2de5c91 malc
    lib=$3
937 c2de5c91 malc
    exp=$4
938 c2de5c91 malc
    cfl=$5
939 c2de5c91 malc
        cat > $TMPC << EOF
940 c2de5c91 malc
#include <$hdr>
941 c2de5c91 malc
int main(void) { $exp }
942 8f28f3fb ths
EOF
943 8c7f7574 balrog
    if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
944 c2de5c91 malc
        :
945 c2de5c91 malc
    else
946 c2de5c91 malc
        echo
947 c2de5c91 malc
        echo "Error: $drv check failed"
948 c2de5c91 malc
        echo "Make sure to have the $drv libs and headers installed."
949 c2de5c91 malc
        echo
950 c2de5c91 malc
        exit 1
951 c2de5c91 malc
    fi
952 c2de5c91 malc
}
953 c2de5c91 malc
954 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
955 c2de5c91 malc
for drv in $audio_drv_list; do
956 c2de5c91 malc
    case $drv in
957 c2de5c91 malc
    alsa)
958 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
959 c2de5c91 malc
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
960 c2de5c91 malc
    ;;
961 c2de5c91 malc
962 c2de5c91 malc
    fmod)
963 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
964 c2de5c91 malc
        echo
965 c2de5c91 malc
        echo "Error: You must specify path to FMOD library and headers"
966 c2de5c91 malc
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
967 c2de5c91 malc
        echo
968 c2de5c91 malc
        exit 1
969 c2de5c91 malc
    fi
970 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
971 c2de5c91 malc
    ;;
972 c2de5c91 malc
973 c2de5c91 malc
    esd)
974 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
975 c2de5c91 malc
    ;;
976 b8e59f18 malc
977 b8e59f18 malc
    pa)
978 b8e59f18 malc
    audio_drv_probe $drv pulse/simple.h -lpulse-simple \
979 b8e59f18 malc
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
980 b8e59f18 malc
    ;;
981 b8e59f18 malc
982 2f6a1ab0 blueswir1
    oss|sdl|core|wav|dsound)
983 2f6a1ab0 blueswir1
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
984 2f6a1ab0 blueswir1
    ;;
985 2f6a1ab0 blueswir1
986 e4c63a6a malc
    *)
987 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
988 e4c63a6a malc
        echo
989 e4c63a6a malc
        echo "Error: Unknown driver '$drv' selected"
990 e4c63a6a malc
        echo "Possible drivers are: $audio_possible_drivers"
991 e4c63a6a malc
        echo
992 e4c63a6a malc
        exit 1
993 e4c63a6a malc
    }
994 e4c63a6a malc
    ;;
995 c2de5c91 malc
    esac
996 c2de5c91 malc
done
997 8f28f3fb ths
998 4d3b6f6e balrog
##########################################
999 2e4d9fb1 aurel32
# BrlAPI probe
1000 2e4d9fb1 aurel32
1001 2e4d9fb1 aurel32
if test -z "$brlapi" ; then
1002 2e4d9fb1 aurel32
    brlapi=no
1003 2e4d9fb1 aurel32
cat > $TMPC << EOF
1004 2e4d9fb1 aurel32
#include <brlapi.h>
1005 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1006 2e4d9fb1 aurel32
EOF
1007 178baee6 aurel32
    if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then
1008 2e4d9fb1 aurel32
	    brlapi=yes
1009 2e4d9fb1 aurel32
    fi # brlapi compile test
1010 2e4d9fb1 aurel32
fi # -z $brlapi
1011 2e4d9fb1 aurel32
1012 2e4d9fb1 aurel32
##########################################
1013 4d3b6f6e balrog
# curses probe
1014 4d3b6f6e balrog
1015 4d3b6f6e balrog
if test "$curses" = "yes" ; then
1016 4d3b6f6e balrog
  curses=no
1017 4d3b6f6e balrog
  cat > $TMPC << EOF
1018 4d3b6f6e balrog
#include <curses.h>
1019 5a8ff3aa blueswir1
#ifdef __OpenBSD__
1020 5a8ff3aa blueswir1
#define resize_term resizeterm
1021 5a8ff3aa blueswir1
#endif
1022 5a8ff3aa blueswir1
int main(void) { resize_term(0, 0); return curses_version(); }
1023 4d3b6f6e balrog
EOF
1024 178baee6 aurel32
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
1025 4d3b6f6e balrog
    curses=yes
1026 4d3b6f6e balrog
  fi
1027 4d3b6f6e balrog
fi # test "$curses"
1028 4d3b6f6e balrog
1029 414f0dab blueswir1
##########################################
1030 fb599c9a balrog
# bluez support probe
1031 fb599c9a balrog
if test "$bluez" = "yes" ; then
1032 fb599c9a balrog
  `pkg-config bluez` || bluez="no"
1033 fb599c9a balrog
fi
1034 fb599c9a balrog
if test "$bluez" = "yes" ; then
1035 e820e3f4 balrog
  cat > $TMPC << EOF
1036 e820e3f4 balrog
#include <bluetooth/bluetooth.h>
1037 e820e3f4 balrog
int main(void) { return bt_error(0); }
1038 e820e3f4 balrog
EOF
1039 fb599c9a balrog
  bluez_cflags=`pkg-config --cflags bluez`
1040 fb599c9a balrog
  bluez_libs=`pkg-config --libs bluez`
1041 17e1592d balrog
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
1042 8c7f7574 balrog
      $bluez_libs > /dev/null 2> /dev/null ; then
1043 e820e3f4 balrog
    :
1044 e820e3f4 balrog
  else
1045 e820e3f4 balrog
    bluez="no"
1046 e820e3f4 balrog
  fi
1047 fb599c9a balrog
fi
1048 fb599c9a balrog
1049 fb599c9a balrog
##########################################
1050 7ba1e619 aliguori
# kvm probe
1051 7ba1e619 aliguori
if test "$kvm" = "yes" ; then
1052 7ba1e619 aliguori
    cat > $TMPC <<EOF
1053 7ba1e619 aliguori
#include <linux/kvm.h>
1054 9fd8d8d7 aliguori
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1055 7ba1e619 aliguori
#error Invalid KVM version
1056 7ba1e619 aliguori
#endif
1057 9fd8d8d7 aliguori
#if !defined(KVM_CAP_USER_MEMORY)
1058 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_USER_MEMORY
1059 9fd8d8d7 aliguori
#endif
1060 9fd8d8d7 aliguori
#if !defined(KVM_CAP_SET_TSS_ADDR)
1061 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1062 9fd8d8d7 aliguori
#endif
1063 9fd8d8d7 aliguori
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1064 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1065 9fd8d8d7 aliguori
#endif
1066 7ba1e619 aliguori
int main(void) { return 0; }
1067 7ba1e619 aliguori
EOF
1068 eac30262 aliguori
  if test "$kerneldir" != "" ; then
1069 eac30262 aliguori
      kvm_cflags=-I"$kerneldir"/include
1070 8444eb6e aliguori
      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1071 8444eb6e aliguori
         -a -d "$kerneldir/arch/x86/include" ; then
1072 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1073 406b430d aliguori
	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1074 406b430d aliguori
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1075 8444eb6e aliguori
        elif test -d "$kerneldir/arch/$cpu/include" ; then
1076 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1077 8444eb6e aliguori
      fi
1078 eac30262 aliguori
  else
1079 eac30262 aliguori
      kvm_cflags=""
1080 eac30262 aliguori
  fi
1081 7ba1e619 aliguori
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
1082 8c7f7574 balrog
      > /dev/null 2>/dev/null ; then
1083 7ba1e619 aliguori
    :
1084 7ba1e619 aliguori
  else
1085 9fd8d8d7 aliguori
    kvm="no";
1086 9fd8d8d7 aliguori
    if [ -x "`which awk 2>/dev/null`" ] && \
1087 9fd8d8d7 aliguori
       [ -x "`which grep 2>/dev/null`" ]; then
1088 e4f5100c blueswir1
      kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
1089 9fd8d8d7 aliguori
	| grep "error: " \
1090 9fd8d8d7 aliguori
	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1091 9fd8d8d7 aliguori
      if test "$kvmerr" != "" ; then
1092 9fd8d8d7 aliguori
        kvm="no - (${kvmerr})"
1093 9fd8d8d7 aliguori
      fi
1094 9fd8d8d7 aliguori
    fi
1095 7ba1e619 aliguori
  fi
1096 7ba1e619 aliguori
fi
1097 7ba1e619 aliguori
1098 7ba1e619 aliguori
##########################################
1099 414f0dab blueswir1
# AIO probe
1100 3c529d93 aliguori
AIOLIBS=""
1101 3c529d93 aliguori
1102 414f0dab blueswir1
if test "$aio" = "yes" ; then
1103 414f0dab blueswir1
  aio=no
1104 414f0dab blueswir1
  cat > $TMPC << EOF
1105 3c529d93 aliguori
#include <pthread.h>
1106 c9db92fc blueswir1
int main(void) { pthread_mutex_t lock;  return 0; }
1107 414f0dab blueswir1
EOF
1108 414f0dab blueswir1
  if $cc $ARCH_CFLAGS -o $TMPE $AIOLIBS $TMPC 2> /dev/null ; then
1109 414f0dab blueswir1
    aio=yes
1110 3c529d93 aliguori
    AIOLIBS="-lpthread"
1111 414f0dab blueswir1
  fi
1112 414f0dab blueswir1
fi
1113 414f0dab blueswir1
1114 bf9298b9 aliguori
##########################################
1115 bf9298b9 aliguori
# iovec probe
1116 bf9298b9 aliguori
cat > $TMPC <<EOF
1117 db34f0b3 blueswir1
#include <sys/types.h>
1118 bf9298b9 aliguori
#include <sys/uio.h>
1119 db34f0b3 blueswir1
#include <unistd.h>
1120 bf9298b9 aliguori
int main(void) { struct iovec iov; return 0; }
1121 bf9298b9 aliguori
EOF
1122 bf9298b9 aliguori
iovec=no
1123 8c7f7574 balrog
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1124 bf9298b9 aliguori
  iovec=yes
1125 bf9298b9 aliguori
fi
1126 bf9298b9 aliguori
1127 f652e6af aurel32
##########################################
1128 ceb42de8 aliguori
# preadv probe
1129 ceb42de8 aliguori
cat > $TMPC <<EOF
1130 ceb42de8 aliguori
#include <sys/types.h>
1131 ceb42de8 aliguori
#include <sys/uio.h>
1132 ceb42de8 aliguori
#include <unistd.h>
1133 ceb42de8 aliguori
int main(void) { preadv; }
1134 ceb42de8 aliguori
EOF
1135 ceb42de8 aliguori
preadv=no
1136 ceb42de8 aliguori
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1137 ceb42de8 aliguori
  preadv=yes
1138 ceb42de8 aliguori
fi
1139 ceb42de8 aliguori
1140 ceb42de8 aliguori
##########################################
1141 f652e6af aurel32
# fdt probe
1142 f652e6af aurel32
if test "$fdt" = "yes" ; then
1143 f652e6af aurel32
    fdt=no
1144 f652e6af aurel32
    cat > $TMPC << EOF
1145 f652e6af aurel32
int main(void) { return 0; }
1146 f652e6af aurel32
EOF
1147 f652e6af aurel32
  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null ; then
1148 f652e6af aurel32
    fdt=yes
1149 f652e6af aurel32
  fi
1150 f652e6af aurel32
fi
1151 f652e6af aurel32
1152 cc8ae6de pbrook
# Check if tools are available to build documentation.
1153 6c591867 ths
if [ -x "`which texi2html 2>/dev/null`" ] && \
1154 6c591867 ths
   [ -x "`which pod2man 2>/dev/null`" ]; then
1155 cc8ae6de pbrook
  build_docs="yes"
1156 cc8ae6de pbrook
fi
1157 cc8ae6de pbrook
1158 da93a1fd aliguori
##########################################
1159 da93a1fd aliguori
# Do we need librt
1160 da93a1fd aliguori
cat > $TMPC <<EOF
1161 da93a1fd aliguori
#include <signal.h>
1162 da93a1fd aliguori
#include <time.h>
1163 da93a1fd aliguori
int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1164 da93a1fd aliguori
EOF
1165 da93a1fd aliguori
1166 da93a1fd aliguori
rt=no
1167 8c7f7574 balrog
if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
1168 da93a1fd aliguori
  :
1169 8c7f7574 balrog
elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
1170 da93a1fd aliguori
  rt=yes
1171 da93a1fd aliguori
fi
1172 da93a1fd aliguori
1173 da93a1fd aliguori
if test "$rt" = "yes" ; then
1174 da93a1fd aliguori
  # Hack, we should have a general purpose LIBS for this sort of thing
1175 da93a1fd aliguori
  AIOLIBS="$AIOLIBS -lrt"
1176 da93a1fd aliguori
fi
1177 da93a1fd aliguori
1178 11d9f695 bellard
if test "$mingw32" = "yes" ; then
1179 308c3593 pbrook
  if test -z "$prefix" ; then
1180 17e90973 aliguori
      prefix="c:\\\\Program Files\\\\Qemu"
1181 308c3593 pbrook
  fi
1182 308c3593 pbrook
  mansuffix=""
1183 308c3593 pbrook
  datasuffix=""
1184 308c3593 pbrook
  docsuffix=""
1185 308c3593 pbrook
  binsuffix=""
1186 11d9f695 bellard
else
1187 308c3593 pbrook
  if test -z "$prefix" ; then
1188 308c3593 pbrook
      prefix="/usr/local"
1189 308c3593 pbrook
  fi
1190 308c3593 pbrook
  mansuffix="/share/man"
1191 308c3593 pbrook
  datasuffix="/share/qemu"
1192 308c3593 pbrook
  docsuffix="/share/doc/qemu"
1193 308c3593 pbrook
  binsuffix="/bin"
1194 11d9f695 bellard
fi
1195 5a67135a bellard
1196 43ce4dfe bellard
echo "Install prefix    $prefix"
1197 308c3593 pbrook
echo "BIOS directory    $prefix$datasuffix"
1198 308c3593 pbrook
echo "binary directory  $prefix$binsuffix"
1199 11d9f695 bellard
if test "$mingw32" = "no" ; then
1200 308c3593 pbrook
echo "Manual directory  $prefix$mansuffix"
1201 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
1202 11d9f695 bellard
fi
1203 5a67135a bellard
echo "Source path       $source_path"
1204 43ce4dfe bellard
echo "C compiler        $cc"
1205 83469015 bellard
echo "Host C compiler   $host_cc"
1206 db7287ed pbrook
echo "ARCH_CFLAGS       $ARCH_CFLAGS"
1207 43ce4dfe bellard
echo "make              $make"
1208 6a882643 pbrook
echo "install           $install"
1209 43ce4dfe bellard
echo "host CPU          $cpu"
1210 de83cd02 bellard
echo "host big endian   $bigendian"
1211 97a847bc bellard
echo "target list       $target_list"
1212 43ce4dfe bellard
echo "gprof enabled     $gprof"
1213 03b4fe7d aliguori
echo "sparse enabled    $sparse"
1214 1625af87 aliguori
echo "strip binaries    $strip_opt"
1215 05c2a3e7 bellard
echo "profiler          $profiler"
1216 43ce4dfe bellard
echo "static build      $static"
1217 85aa5189 bellard
echo "-Werror enabled   $werror"
1218 5b0753e0 bellard
if test "$darwin" = "yes" ; then
1219 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
1220 5b0753e0 bellard
fi
1221 97a847bc bellard
echo "SDL support       $sdl"
1222 e4afee97 bellard
if test "$sdl" != "no" ; then
1223 e4afee97 bellard
    echo "SDL static link   $sdl_static"
1224 e4afee97 bellard
fi
1225 4d3b6f6e balrog
echo "curses support    $curses"
1226 67b915a5 bellard
echo "mingw32 support   $mingw32"
1227 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
1228 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
1229 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
1230 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
1231 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1232 8d5d2d4c ths
    echo "    TLS CFLAGS    $vnc_tls_cflags"
1233 8d5d2d4c ths
    echo "    TLS LIBS      $vnc_tls_libs"
1234 8d5d2d4c ths
fi
1235 2f9606b3 aliguori
echo "VNC SASL support  $vnc_sasl"
1236 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
1237 2f9606b3 aliguori
    echo "    SASL CFLAGS    $vnc_sasl_cflags"
1238 2f9606b3 aliguori
    echo "    SASL LIBS      $vnc_sasl_libs"
1239 2f9606b3 aliguori
fi
1240 3142255c blueswir1
if test -n "$sparc_cpu"; then
1241 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
1242 3142255c blueswir1
fi
1243 07f4ddbf bellard
echo "kqemu support     $kqemu"
1244 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
1245 cc8ae6de pbrook
echo "Documentation     $build_docs"
1246 c5937220 pbrook
[ ! -z "$uname_release" ] && \
1247 c5937220 pbrook
echo "uname -r          $uname_release"
1248 bd0c5661 pbrook
echo "NPTL support      $nptl"
1249 8a16d273 ths
echo "vde support       $vde"
1250 414f0dab blueswir1
echo "AIO support       $aio"
1251 77755340 ths
echo "Install blobs     $blobs"
1252 7ba1e619 aliguori
echo "KVM support       $kvm"
1253 f652e6af aurel32
echo "fdt support       $fdt"
1254 ceb42de8 aliguori
echo "preadv support    $preadv"
1255 67b915a5 bellard
1256 97a847bc bellard
if test $sdl_too_old = "yes"; then
1257 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
1258 7c1f25b4 bellard
fi
1259 d4742de8 malc
if [ -s $TMPSDLLOG ]; then
1260 20b40c6a ths
  echo "The error log from compiling the libSDL test is: "
1261 d4742de8 malc
  cat $TMPSDLLOG
1262 20b40c6a ths
fi
1263 24b55b96 bellard
#if test "$sdl_static" = "no"; then
1264 24b55b96 bellard
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
1265 24b55b96 bellard
#fi
1266 97a847bc bellard
config_mak="config-host.mak"
1267 97a847bc bellard
config_h="config-host.h"
1268 7d13299d bellard
1269 7c1f25b4 bellard
#echo "Creating $config_mak and $config_h"
1270 7d13299d bellard
1271 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
1272 15d9ca0f ths
1273 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
1274 fc9902d9 malc
printf "# Configured with:" >> $config_mak
1275 fd69fe2b malc
printf " '%s'" "$0" "$@" >> $config_mak
1276 fd69fe2b malc
echo >> $config_mak
1277 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
1278 7d13299d bellard
1279 97a847bc bellard
echo "prefix=$prefix" >> $config_mak
1280 308c3593 pbrook
echo "bindir=\${prefix}$binsuffix" >> $config_mak
1281 308c3593 pbrook
echo "mandir=\${prefix}$mansuffix" >> $config_mak
1282 308c3593 pbrook
echo "datadir=\${prefix}$datasuffix" >> $config_mak
1283 4ad5b06d ths
echo "docdir=\${prefix}$docsuffix" >> $config_mak
1284 308c3593 pbrook
echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
1285 97a847bc bellard
echo "MAKE=$make" >> $config_mak
1286 6a882643 pbrook
echo "INSTALL=$install" >> $config_mak
1287 97a847bc bellard
echo "CC=$cc" >> $config_mak
1288 97a847bc bellard
echo "HOST_CC=$host_cc" >> $config_mak
1289 97a847bc bellard
echo "AR=$ar" >> $config_mak
1290 40293e58 bellard
# XXX: only use CFLAGS and LDFLAGS ?  
1291 40293e58 bellard
# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
1292 40293e58 bellard
# compilation of dyngen tool (useful for win32 build on Linux host)
1293 6f30fa85 ths
echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
1294 3142255c blueswir1
echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
1295 3142255c blueswir1
echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
1296 3142255c blueswir1
echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
1297 97a847bc bellard
echo "CFLAGS=$CFLAGS" >> $config_mak
1298 97a847bc bellard
echo "LDFLAGS=$LDFLAGS" >> $config_mak
1299 67b915a5 bellard
echo "EXESUF=$EXESUF" >> $config_mak
1300 70956b77 ths
echo "AIOLIBS=$AIOLIBS" >> $config_mak
1301 2408a527 aurel32
case "$cpu" in
1302 2408a527 aurel32
  i386)
1303 2408a527 aurel32
    echo "ARCH=i386" >> $config_mak
1304 2408a527 aurel32
    echo "#define HOST_I386 1" >> $config_h
1305 2408a527 aurel32
  ;;
1306 2408a527 aurel32
  x86_64)
1307 2408a527 aurel32
    echo "ARCH=x86_64" >> $config_mak
1308 2408a527 aurel32
    echo "#define HOST_X86_64 1" >> $config_h
1309 2408a527 aurel32
  ;;
1310 2408a527 aurel32
  alpha)
1311 2408a527 aurel32
    echo "ARCH=alpha" >> $config_mak
1312 2408a527 aurel32
    echo "#define HOST_ALPHA 1" >> $config_h
1313 2408a527 aurel32
  ;;
1314 2408a527 aurel32
  armv4b)
1315 2408a527 aurel32
    echo "ARCH=arm" >> $config_mak
1316 2408a527 aurel32
    echo "#define HOST_ARM 1" >> $config_h
1317 2408a527 aurel32
  ;;
1318 2408a527 aurel32
  armv4l)
1319 2408a527 aurel32
    echo "ARCH=arm" >> $config_mak
1320 2408a527 aurel32
    echo "#define HOST_ARM 1" >> $config_h
1321 2408a527 aurel32
  ;;
1322 2408a527 aurel32
  cris)
1323 2408a527 aurel32
    echo "ARCH=cris" >> $config_mak
1324 2408a527 aurel32
    echo "#define HOST_CRIS 1" >> $config_h
1325 2408a527 aurel32
  ;;
1326 2408a527 aurel32
  hppa)
1327 2408a527 aurel32
    echo "ARCH=hppa" >> $config_mak
1328 2408a527 aurel32
    echo "#define HOST_HPPA 1" >> $config_h
1329 2408a527 aurel32
  ;;
1330 2408a527 aurel32
  ia64)
1331 2408a527 aurel32
    echo "ARCH=ia64" >> $config_mak
1332 2408a527 aurel32
    echo "#define HOST_IA64 1" >> $config_h
1333 2408a527 aurel32
  ;;
1334 2408a527 aurel32
  m68k)
1335 2408a527 aurel32
    echo "ARCH=m68k" >> $config_mak
1336 2408a527 aurel32
    echo "#define HOST_M68K 1" >> $config_h
1337 2408a527 aurel32
  ;;
1338 2408a527 aurel32
  mips)
1339 2408a527 aurel32
    echo "ARCH=mips" >> $config_mak
1340 2408a527 aurel32
    echo "#define HOST_MIPS 1" >> $config_h
1341 2408a527 aurel32
  ;;
1342 2408a527 aurel32
  mips64)
1343 2408a527 aurel32
    echo "ARCH=mips64" >> $config_mak
1344 2408a527 aurel32
    echo "#define HOST_MIPS64 1" >> $config_h
1345 2408a527 aurel32
  ;;
1346 fdf7ed96 malc
  ppc)
1347 fdf7ed96 malc
    echo "ARCH=ppc" >> $config_mak
1348 fdf7ed96 malc
    echo "#define HOST_PPC 1" >> $config_h
1349 fdf7ed96 malc
  ;;
1350 fdf7ed96 malc
  ppc64)
1351 fdf7ed96 malc
    echo "ARCH=ppc64" >> $config_mak
1352 fdf7ed96 malc
    echo "#define HOST_PPC64 1" >> $config_h
1353 2408a527 aurel32
  ;;
1354 2408a527 aurel32
  s390)
1355 2408a527 aurel32
    echo "ARCH=s390" >> $config_mak
1356 2408a527 aurel32
    echo "#define HOST_S390 1" >> $config_h
1357 2408a527 aurel32
  ;;
1358 2408a527 aurel32
  sparc)
1359 2408a527 aurel32
    echo "ARCH=sparc" >> $config_mak
1360 2408a527 aurel32
    echo "#define HOST_SPARC 1" >> $config_h
1361 2408a527 aurel32
  ;;
1362 2408a527 aurel32
  sparc64)
1363 2408a527 aurel32
    echo "ARCH=sparc64" >> $config_mak
1364 2408a527 aurel32
    echo "#define HOST_SPARC64 1" >> $config_h
1365 2408a527 aurel32
  ;;
1366 2408a527 aurel32
  *)
1367 2408a527 aurel32
    echo "Unsupported CPU = $cpu"
1368 2408a527 aurel32
    exit 1
1369 2408a527 aurel32
  ;;
1370 2408a527 aurel32
esac
1371 03b4fe7d aliguori
if test "$sparse" = "yes" ; then
1372 03b4fe7d aliguori
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_mak
1373 03b4fe7d aliguori
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_mak
1374 03b4fe7d aliguori
  echo "CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_mak
1375 03b4fe7d aliguori
fi
1376 1625af87 aliguori
if test "$strip_opt" = "yes" ; then
1377 1625af87 aliguori
  echo "STRIP_OPT=-s" >> $config_mak
1378 1625af87 aliguori
fi
1379 7d13299d bellard
if test "$bigendian" = "yes" ; then
1380 97a847bc bellard
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
1381 97a847bc bellard
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
1382 97a847bc bellard
fi
1383 b6853697 bellard
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1384 67b915a5 bellard
if test "$mingw32" = "yes" ; then
1385 67b915a5 bellard
  echo "CONFIG_WIN32=yes" >> $config_mak
1386 11d9f695 bellard
  echo "#define CONFIG_WIN32 1" >> $config_h
1387 210fa556 pbrook
else
1388 210fa556 pbrook
  cat > $TMPC << EOF
1389 210fa556 pbrook
#include <byteswap.h>
1390 210fa556 pbrook
int main(void) { return bswap_32(0); }
1391 210fa556 pbrook
EOF
1392 178baee6 aurel32
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1393 210fa556 pbrook
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1394 210fa556 pbrook
  fi
1395 1360677c blueswir1
  cat > $TMPC << EOF
1396 1360677c blueswir1
#include <sys/endian.h>
1397 1360677c blueswir1
#include <sys/types.h>
1398 1360677c blueswir1
#include <machine/bswap.h>
1399 1360677c blueswir1
int main(void) { return bswap32(0); }
1400 1360677c blueswir1
EOF
1401 178baee6 aurel32
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1402 1360677c blueswir1
    echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h
1403 1360677c blueswir1
  fi
1404 67b915a5 bellard
fi
1405 128ab2ff blueswir1
1406 128ab2ff blueswir1
if [ "$openbsd" = "yes" ] ; then
1407 128ab2ff blueswir1
  echo "#define ENOTSUP 4096" >> $config_h
1408 128ab2ff blueswir1
fi
1409 128ab2ff blueswir1
1410 83fb7adf bellard
if test "$darwin" = "yes" ; then
1411 83fb7adf bellard
  echo "CONFIG_DARWIN=yes" >> $config_mak
1412 83fb7adf bellard
  echo "#define CONFIG_DARWIN 1" >> $config_h
1413 83fb7adf bellard
fi
1414 b29fe3ed malc
1415 b29fe3ed malc
if test "$aix" = "yes" ; then
1416 b29fe3ed malc
  echo "CONFIG_AIX=yes" >> $config_mak
1417 b29fe3ed malc
  echo "#define CONFIG_AIX 1" >> $config_h
1418 b29fe3ed malc
fi
1419 b29fe3ed malc
1420 ec530c81 bellard
if test "$solaris" = "yes" ; then
1421 ec530c81 bellard
  echo "CONFIG_SOLARIS=yes" >> $config_mak
1422 38cfa06c bellard
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1423 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
1424 0475a5ca ths
    echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1425 0475a5ca ths
    echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1426 0475a5ca ths
  fi
1427 ec530c81 bellard
fi
1428 3142255c blueswir1
if test -n "$sparc_cpu"; then
1429 3142255c blueswir1
  echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1430 3142255c blueswir1
  echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1431 3142255c blueswir1
fi
1432 67b915a5 bellard
if test "$gdbstub" = "yes" ; then
1433 67b915a5 bellard
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
1434 67b915a5 bellard
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
1435 67b915a5 bellard
fi
1436 97a847bc bellard
if test "$gprof" = "yes" ; then
1437 97a847bc bellard
  echo "TARGET_GPROF=yes" >> $config_mak
1438 97a847bc bellard
  echo "#define HAVE_GPROF 1" >> $config_h
1439 97a847bc bellard
fi
1440 97a847bc bellard
if test "$static" = "yes" ; then
1441 97a847bc bellard
  echo "CONFIG_STATIC=yes" >> $config_mak
1442 50863472 bellard
  echo "#define CONFIG_STATIC 1" >> $config_h
1443 7d13299d bellard
fi
1444 05c2a3e7 bellard
if test $profiler = "yes" ; then
1445 05c2a3e7 bellard
  echo "#define CONFIG_PROFILER 1" >> $config_h
1446 05c2a3e7 bellard
fi
1447 c20709aa bellard
if test "$slirp" = "yes" ; then
1448 c20709aa bellard
  echo "CONFIG_SLIRP=yes" >> $config_mak
1449 c20709aa bellard
  echo "#define CONFIG_SLIRP 1" >> $config_h
1450 c20709aa bellard
fi
1451 8a16d273 ths
if test "$vde" = "yes" ; then
1452 8a16d273 ths
  echo "CONFIG_VDE=yes" >> $config_mak
1453 8a16d273 ths
  echo "#define CONFIG_VDE 1" >> $config_h
1454 8a16d273 ths
  echo "VDE_LIBS=-lvdeplug" >> $config_mak
1455 8a16d273 ths
fi
1456 0c58ac1c malc
for card in $audio_card_list; do
1457 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1458 0c58ac1c malc
    echo "$def=yes" >> $config_mak
1459 0c58ac1c malc
    echo "#define $def 1" >> $config_h
1460 0c58ac1c malc
done
1461 0c58ac1c malc
echo "#define AUDIO_DRIVERS \\" >> $config_h
1462 0c58ac1c malc
for drv in $audio_drv_list; do
1463 0c58ac1c malc
    echo "    &${drv}_audio_driver, \\" >>$config_h
1464 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1465 0c58ac1c malc
    echo "$def=yes" >> $config_mak
1466 923e4521 malc
    if test "$drv" = "fmod"; then
1467 0c58ac1c malc
        echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1468 0c58ac1c malc
        echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1469 2f6a1ab0 blueswir1
    elif test "$drv" = "oss"; then
1470 2f6a1ab0 blueswir1
        echo "CONFIG_OSS_LIB=$oss_lib" >> $config_mak
1471 0c58ac1c malc
    fi
1472 0c58ac1c malc
done
1473 0c58ac1c malc
echo "" >>$config_h
1474 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
1475 8ff9cbf7 malc
  echo "CONFIG_MIXEMU=yes" >> $config_mak
1476 8ff9cbf7 malc
  echo "#define CONFIG_MIXEMU 1" >> $config_h
1477 8ff9cbf7 malc
fi
1478 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1479 8d5d2d4c ths
  echo "CONFIG_VNC_TLS=yes" >> $config_mak
1480 8d5d2d4c ths
  echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1481 8d5d2d4c ths
  echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1482 8d5d2d4c ths
  echo "#define CONFIG_VNC_TLS 1" >> $config_h
1483 8d5d2d4c ths
fi
1484 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
1485 2f9606b3 aliguori
  echo "CONFIG_VNC_SASL=yes" >> $config_mak
1486 2f9606b3 aliguori
  echo "CONFIG_VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_mak
1487 2f9606b3 aliguori
  echo "CONFIG_VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_mak
1488 2f9606b3 aliguori
  echo "#define CONFIG_VNC_SASL 1" >> $config_h
1489 2f9606b3 aliguori
fi
1490 76655d6d aliguori
if test "$fnmatch" = "yes" ; then
1491 76655d6d aliguori
  echo "#define HAVE_FNMATCH_H 1" >> $config_h
1492 76655d6d aliguori
fi
1493 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
1494 b1a550a0 pbrook
echo "VERSION=$qemu_version" >>$config_mak
1495 d4b8f039 pbrook
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1496 97a847bc bellard
1497 4a19f1ec pbrook
echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_h
1498 4a19f1ec pbrook
1499 97a847bc bellard
echo "SRC_PATH=$source_path" >> $config_mak
1500 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
1501 ad064840 pbrook
  echo "VPATH=$source_path" >> $config_mak
1502 ad064840 pbrook
fi
1503 97a847bc bellard
echo "TARGET_DIRS=$target_list" >> $config_mak
1504 cc8ae6de pbrook
if [ "$build_docs" = "yes" ] ; then
1505 cc8ae6de pbrook
  echo "BUILD_DOCS=yes" >> $config_mak
1506 cc8ae6de pbrook
fi
1507 49ecc3fa bellard
if test "$static" = "yes"; then
1508 49ecc3fa bellard
  sdl1=$sdl_static
1509 49ecc3fa bellard
else
1510 49ecc3fa bellard
  sdl1=$sdl
1511 49ecc3fa bellard
fi
1512 49ecc3fa bellard
if test "$sdl1" = "yes" ; then
1513 49ecc3fa bellard
  echo "#define CONFIG_SDL 1" >> $config_h
1514 49ecc3fa bellard
  echo "CONFIG_SDL=yes" >> $config_mak
1515 49ecc3fa bellard
  if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1516 49ecc3fa bellard
    echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1517 5368a422 aliguori
  elif test "$sdl_x11" = "yes" ; then
1518 5368a422 aliguori
    echo "SDL_LIBS=`$sdl_config --libs` -lX11" >> $config_mak
1519 49ecc3fa bellard
  else
1520 49ecc3fa bellard
    echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1521 49ecc3fa bellard
  fi
1522 49ecc3fa bellard
  if [ "${aa}" = "yes" ] ; then
1523 49ecc3fa bellard
    echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1524 49ecc3fa bellard
  else
1525 49ecc3fa bellard
    echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1526 49ecc3fa bellard
  fi
1527 49ecc3fa bellard
fi
1528 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
1529 4d3b6f6e balrog
  echo "#define CONFIG_COCOA 1" >> $config_h
1530 4d3b6f6e balrog
  echo "CONFIG_COCOA=yes" >> $config_mak
1531 4d3b6f6e balrog
fi
1532 4d3b6f6e balrog
if test "$curses" = "yes" ; then
1533 4d3b6f6e balrog
  echo "#define CONFIG_CURSES 1" >> $config_h
1534 4d3b6f6e balrog
  echo "CONFIG_CURSES=yes" >> $config_mak
1535 4d3b6f6e balrog
  echo "CURSES_LIBS=-lcurses" >> $config_mak
1536 49ecc3fa bellard
fi
1537 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
1538 2e4d9fb1 aurel32
  echo "CONFIG_BRLAPI=yes" >> $config_mak
1539 2e4d9fb1 aurel32
  echo "#define CONFIG_BRLAPI 1" >> $config_h
1540 2e4d9fb1 aurel32
  echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1541 2e4d9fb1 aurel32
fi
1542 fb599c9a balrog
if test "$bluez" = "yes" ; then
1543 fb599c9a balrog
  echo "CONFIG_BLUEZ=yes" >> $config_mak
1544 fb599c9a balrog
  echo "CONFIG_BLUEZ_CFLAGS=$bluez_cflags" >> $config_mak
1545 fb599c9a balrog
  echo "CONFIG_BLUEZ_LIBS=$bluez_libs" >> $config_mak
1546 fb599c9a balrog
  echo "#define CONFIG_BLUEZ 1" >> $config_h
1547 fb599c9a balrog
fi
1548 414f0dab blueswir1
if test "$aio" = "yes" ; then
1549 414f0dab blueswir1
  echo "#define CONFIG_AIO 1" >> $config_h
1550 a3392f9b aliguori
  echo "CONFIG_AIO=yes" >> $config_mak
1551 414f0dab blueswir1
fi
1552 77755340 ths
if test "$blobs" = "yes" ; then
1553 77755340 ths
  echo "INSTALL_BLOBS=yes" >> $config_mak
1554 77755340 ths
fi
1555 bf9298b9 aliguori
if test "$iovec" = "yes" ; then
1556 bf9298b9 aliguori
  echo "#define HAVE_IOVEC 1" >> $config_h
1557 bf9298b9 aliguori
fi
1558 ceb42de8 aliguori
if test "$preadv" = "yes" ; then
1559 ceb42de8 aliguori
  echo "#define HAVE_PREADV 1" >> $config_h
1560 ceb42de8 aliguori
fi
1561 f652e6af aurel32
if test "$fdt" = "yes" ; then
1562 f652e6af aurel32
  echo "#define HAVE_FDT 1" >> $config_h
1563 f652e6af aurel32
  echo "FDT_LIBS=-lfdt" >> $config_mak
1564 f652e6af aurel32
fi
1565 97a847bc bellard
1566 83fb7adf bellard
# XXX: suppress that
1567 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
1568 43003046 bellard
  echo "#define O_LARGEFILE 0" >> $config_h
1569 43003046 bellard
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1570 179a2c19 blueswir1
  echo "#define HOST_BSD 1" >> $config_h
1571 7d3505c5 bellard
fi
1572 7d3505c5 bellard
1573 c5937220 pbrook
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1574 c5937220 pbrook
1575 68063649 blueswir1
# USB host support
1576 68063649 blueswir1
case "$usb" in
1577 68063649 blueswir1
linux)
1578 68063649 blueswir1
  echo "HOST_USB=linux" >> $config_mak
1579 68063649 blueswir1
;;
1580 68063649 blueswir1
bsd)
1581 68063649 blueswir1
  echo "HOST_USB=bsd" >> $config_mak
1582 68063649 blueswir1
;;
1583 68063649 blueswir1
*)
1584 68063649 blueswir1
  echo "HOST_USB=stub" >> $config_mak
1585 68063649 blueswir1
;;
1586 68063649 blueswir1
esac
1587 68063649 blueswir1
1588 c39e3338 pbrook
tools=
1589 c39e3338 pbrook
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1590 3dd1f8ef aliguori
  tools="qemu-img\$(EXESUF) $tools"
1591 7a5ca864 bellard
  if [ "$linux" = "yes" ] ; then
1592 3dd1f8ef aliguori
      tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1593 7a5ca864 bellard
  fi
1594 c39e3338 pbrook
fi
1595 c39e3338 pbrook
echo "TOOLS=$tools" >> $config_mak
1596 c39e3338 pbrook
1597 15d9ca0f ths
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1598 15d9ca0f ths
1599 1d14ffa9 bellard
for target in $target_list; do
1600 97a847bc bellard
target_dir="$target"
1601 97a847bc bellard
config_mak=$target_dir/config.mak
1602 97a847bc bellard
config_h=$target_dir/config.h
1603 97a847bc bellard
target_cpu=`echo $target | cut -d '-' -f 1`
1604 97a847bc bellard
target_bigendian="no"
1605 808c4954 bellard
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
1606 0938cda5 aurel32
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1607 0938cda5 aurel32
[ "$target_cpu" = "mips" ] && target_bigendian=yes
1608 0938cda5 aurel32
[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1609 0938cda5 aurel32
[ "$target_cpu" = "mips64" ] && target_bigendian=yes
1610 67867308 bellard
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
1611 d4082e95 j_mayer
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1612 22f8a8b3 j_mayer
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1613 e85e7c6e j_mayer
[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1614 908f52b0 pbrook
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1615 0938cda5 aurel32
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1616 0938cda5 aurel32
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1617 0938cda5 aurel32
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1618 97a847bc bellard
target_softmmu="no"
1619 997344f3 bellard
target_user_only="no"
1620 831b7825 ths
target_linux_user="no"
1621 831b7825 ths
target_darwin_user="no"
1622 84778508 blueswir1
target_bsd_user="no"
1623 9e407a85 pbrook
case "$target" in
1624 9e407a85 pbrook
  ${target_cpu}-softmmu)
1625 9e407a85 pbrook
    target_softmmu="yes"
1626 9e407a85 pbrook
    ;;
1627 9e407a85 pbrook
  ${target_cpu}-linux-user)
1628 9e407a85 pbrook
    target_user_only="yes"
1629 9e407a85 pbrook
    target_linux_user="yes"
1630 9e407a85 pbrook
    ;;
1631 9e407a85 pbrook
  ${target_cpu}-darwin-user)
1632 9e407a85 pbrook
    target_user_only="yes"
1633 9e407a85 pbrook
    target_darwin_user="yes"
1634 9e407a85 pbrook
    ;;
1635 84778508 blueswir1
  ${target_cpu}-bsd-user)
1636 84778508 blueswir1
    target_user_only="yes"
1637 84778508 blueswir1
    target_bsd_user="yes"
1638 84778508 blueswir1
    ;;
1639 9e407a85 pbrook
  *)
1640 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
1641 9e407a85 pbrook
    exit 1
1642 9e407a85 pbrook
    ;;
1643 9e407a85 pbrook
esac
1644 831b7825 ths
1645 97ccc689 bellard
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1646 1d14ffa9 bellard
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1647 97ccc689 bellard
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1648 9c038506 pbrook
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
1649 4d3b6f6e balrog
    echo "Note that this will disable all output from the virtual graphics card"
1650 4d3b6f6e balrog
    echo "except through VNC or curses."
1651 97ccc689 bellard
    exit 1;
1652 97ccc689 bellard
fi
1653 97ccc689 bellard
1654 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1655 97a847bc bellard
1656 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
1657 15d9ca0f ths
1658 97a847bc bellard
mkdir -p $target_dir
1659 158142c2 bellard
mkdir -p $target_dir/fpu
1660 57fec1fe bellard
mkdir -p $target_dir/tcg
1661 84778508 blueswir1
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1662 69de927c bellard
  mkdir -p $target_dir/nwfpe
1663 69de927c bellard
fi
1664 69de927c bellard
1665 ec530c81 bellard
#
1666 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
1667 ec530c81 bellard
#
1668 ec530c81 bellard
rm -f $target_dir/Makefile
1669 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
1670 ec530c81 bellard
1671 97a847bc bellard
1672 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
1673 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
1674 97a847bc bellard
1675 de83cd02 bellard
1676 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
1677 97a847bc bellard
echo "#include \"../config-host.h\"" >> $config_h
1678 1e43adfc bellard
1679 e5fe0c52 pbrook
bflt="no"
1680 cb33da57 blueswir1
elfload32="no"
1681 bd0c5661 pbrook
target_nptl="no"
1682 1e43adfc bellard
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1683 1e43adfc bellard
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1684 56aebc89 pbrook
gdb_xml_files=""
1685 97a847bc bellard
1686 5985ecee aliguori
# Make sure the target and host cpus are compatible
1687 5985ecee aliguori
if test "$kvm" = "yes" -a ! \( "$target_cpu" = "$cpu" -o \
1688 fdf7ed96 malc
  \( "$target_cpu" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1689 5985ecee aliguori
  \( "$target_cpu" = "x86_64" -a "$cpu" = "i386"   \) -o \
1690 5985ecee aliguori
  \( "$target_cpu" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
1691 7ba1e619 aliguori
  kvm="no"
1692 7ba1e619 aliguori
fi
1693 7ba1e619 aliguori
# Disable KVM for linux-user
1694 7ba1e619 aliguori
if test "$kvm" = "yes" -a "$target_softmmu" = "no" ; then
1695 7ba1e619 aliguori
  kvm="no"
1696 7ba1e619 aliguori
fi
1697 7ba1e619 aliguori
1698 2408a527 aurel32
case "$target_cpu" in
1699 2408a527 aurel32
  i386)
1700 2408a527 aurel32
    echo "TARGET_ARCH=i386" >> $config_mak
1701 2408a527 aurel32
    echo "#define TARGET_ARCH \"i386\"" >> $config_h
1702 2408a527 aurel32
    echo "#define TARGET_I386 1" >> $config_h
1703 da260249 bellard
    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1704 2408a527 aurel32
    then
1705 2408a527 aurel32
      echo "#define USE_KQEMU 1" >> $config_h
1706 2408a527 aurel32
    fi
1707 7ba1e619 aliguori
    if test "$kvm" = "yes" ; then
1708 7ba1e619 aliguori
      echo "CONFIG_KVM=yes" >> $config_mak
1709 7ba1e619 aliguori
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1710 5985ecee aliguori
      echo "#define CONFIG_KVM 1" >> $config_h
1711 7ba1e619 aliguori
    fi
1712 2408a527 aurel32
  ;;
1713 2408a527 aurel32
  x86_64)
1714 2408a527 aurel32
    echo "TARGET_ARCH=x86_64" >> $config_mak
1715 2408a527 aurel32
    echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1716 2408a527 aurel32
    echo "#define TARGET_I386 1" >> $config_h
1717 2408a527 aurel32
    echo "#define TARGET_X86_64 1" >> $config_h
1718 2408a527 aurel32
    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1719 2408a527 aurel32
    then
1720 2408a527 aurel32
      echo "#define USE_KQEMU 1" >> $config_h
1721 2408a527 aurel32
    fi
1722 7ba1e619 aliguori
    if test "$kvm" = "yes" ; then
1723 7ba1e619 aliguori
      echo "CONFIG_KVM=yes" >> $config_mak
1724 7ba1e619 aliguori
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1725 7ba1e619 aliguori
      echo "#define CONFIG_KVM 1" >> $config_h
1726 7ba1e619 aliguori
    fi
1727 2408a527 aurel32
  ;;
1728 2408a527 aurel32
  alpha)
1729 2408a527 aurel32
    echo "TARGET_ARCH=alpha" >> $config_mak
1730 2408a527 aurel32
    echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1731 2408a527 aurel32
    echo "#define TARGET_ALPHA 1" >> $config_h
1732 2408a527 aurel32
  ;;
1733 2408a527 aurel32
  arm|armeb)
1734 2408a527 aurel32
    echo "TARGET_ARCH=arm" >> $config_mak
1735 2408a527 aurel32
    echo "#define TARGET_ARCH \"arm\"" >> $config_h
1736 2408a527 aurel32
    echo "#define TARGET_ARM 1" >> $config_h
1737 2408a527 aurel32
    bflt="yes"
1738 bd0c5661 pbrook
    target_nptl="yes"
1739 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1740 2408a527 aurel32
  ;;
1741 2408a527 aurel32
  cris)
1742 2408a527 aurel32
    echo "TARGET_ARCH=cris" >> $config_mak
1743 2408a527 aurel32
    echo "#define TARGET_ARCH \"cris\"" >> $config_h
1744 2408a527 aurel32
    echo "#define TARGET_CRIS 1" >> $config_h
1745 253bd7f8 edgar_igl
    target_nptl="yes"
1746 2408a527 aurel32
  ;;
1747 2408a527 aurel32
  m68k)
1748 2408a527 aurel32
    echo "TARGET_ARCH=m68k" >> $config_mak
1749 2408a527 aurel32
    echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1750 2408a527 aurel32
    echo "#define TARGET_M68K 1" >> $config_h
1751 2408a527 aurel32
    bflt="yes"
1752 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
1753 2408a527 aurel32
  ;;
1754 2408a527 aurel32
  mips|mipsel)
1755 2408a527 aurel32
    echo "TARGET_ARCH=mips" >> $config_mak
1756 2408a527 aurel32
    echo "#define TARGET_ARCH \"mips\"" >> $config_h
1757 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1758 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1759 2408a527 aurel32
  ;;
1760 2408a527 aurel32
  mipsn32|mipsn32el)
1761 2408a527 aurel32
    echo "TARGET_ARCH=mipsn32" >> $config_mak
1762 2408a527 aurel32
    echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1763 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1764 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1765 2408a527 aurel32
  ;;
1766 2408a527 aurel32
  mips64|mips64el)
1767 2408a527 aurel32
    echo "TARGET_ARCH=mips64" >> $config_mak
1768 2408a527 aurel32
    echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1769 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1770 2408a527 aurel32
    echo "#define TARGET_MIPS64 1" >> $config_h
1771 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1772 2408a527 aurel32
  ;;
1773 2408a527 aurel32
  ppc)
1774 2408a527 aurel32
    echo "TARGET_ARCH=ppc" >> $config_mak
1775 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1776 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1777 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1778 2408a527 aurel32
  ;;
1779 2408a527 aurel32
  ppcemb)
1780 2408a527 aurel32
    echo "TARGET_ARCH=ppcemb" >> $config_mak
1781 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1782 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1783 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1784 2408a527 aurel32
    echo "#define TARGET_PPCEMB 1" >> $config_h
1785 d76d1650 aurel32
    if test "$kvm" = "yes" ; then
1786 d76d1650 aurel32
      echo "CONFIG_KVM=yes" >> $config_mak
1787 d76d1650 aurel32
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1788 d76d1650 aurel32
      echo "#define CONFIG_KVM 1" >> $config_h
1789 d76d1650 aurel32
    fi
1790 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1791 2408a527 aurel32
  ;;
1792 2408a527 aurel32
  ppc64)
1793 2408a527 aurel32
    echo "TARGET_ARCH=ppc64" >> $config_mak
1794 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1795 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1796 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1797 2408a527 aurel32
    echo "#define TARGET_PPC64 1" >> $config_h
1798 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1799 2408a527 aurel32
  ;;
1800 2408a527 aurel32
  ppc64abi32)
1801 2408a527 aurel32
    echo "TARGET_ARCH=ppc64" >> $config_mak
1802 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1803 2408a527 aurel32
    echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1804 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1805 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1806 2408a527 aurel32
    echo "#define TARGET_PPC64 1" >> $config_h
1807 2408a527 aurel32
    echo "#define TARGET_ABI32 1" >> $config_h
1808 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1809 2408a527 aurel32
  ;;
1810 2408a527 aurel32
  sh4|sh4eb)
1811 2408a527 aurel32
    echo "TARGET_ARCH=sh4" >> $config_mak
1812 2408a527 aurel32
    echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1813 2408a527 aurel32
    echo "#define TARGET_SH4 1" >> $config_h
1814 2408a527 aurel32
    bflt="yes"
1815 0b6d3ae0 aurel32
    target_nptl="yes"
1816 2408a527 aurel32
  ;;
1817 2408a527 aurel32
  sparc)
1818 2408a527 aurel32
    echo "TARGET_ARCH=sparc" >> $config_mak
1819 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1820 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1821 2408a527 aurel32
  ;;
1822 2408a527 aurel32
  sparc64)
1823 2408a527 aurel32
    echo "TARGET_ARCH=sparc64" >> $config_mak
1824 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1825 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1826 2408a527 aurel32
    echo "#define TARGET_SPARC64 1" >> $config_h
1827 2408a527 aurel32
    elfload32="yes"
1828 2408a527 aurel32
  ;;
1829 2408a527 aurel32
  sparc32plus)
1830 2408a527 aurel32
    echo "TARGET_ARCH=sparc64" >> $config_mak
1831 2408a527 aurel32
    echo "TARGET_ABI_DIR=sparc" >> $config_mak
1832 2408a527 aurel32
    echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1833 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1834 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1835 2408a527 aurel32
    echo "#define TARGET_SPARC64 1" >> $config_h
1836 2408a527 aurel32
    echo "#define TARGET_ABI32 1" >> $config_h
1837 2408a527 aurel32
  ;;
1838 2408a527 aurel32
  *)
1839 2408a527 aurel32
    echo "Unsupported target CPU"
1840 2408a527 aurel32
    exit 1
1841 2408a527 aurel32
  ;;
1842 2408a527 aurel32
esac
1843 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
1844 97a847bc bellard
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1845 97a847bc bellard
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1846 de83cd02 bellard
fi
1847 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
1848 97a847bc bellard
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
1849 97a847bc bellard
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
1850 43ce4dfe bellard
fi
1851 997344f3 bellard
if test "$target_user_only" = "yes" ; then
1852 997344f3 bellard
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
1853 997344f3 bellard
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
1854 997344f3 bellard
fi
1855 831b7825 ths
if test "$target_linux_user" = "yes" ; then
1856 831b7825 ths
  echo "CONFIG_LINUX_USER=yes" >> $config_mak
1857 831b7825 ths
  echo "#define CONFIG_LINUX_USER 1" >> $config_h
1858 831b7825 ths
fi
1859 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
1860 831b7825 ths
  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1861 831b7825 ths
  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1862 831b7825 ths
fi
1863 56aebc89 pbrook
list=""
1864 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
1865 56aebc89 pbrook
  for x in $gdb_xml_files; do
1866 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
1867 56aebc89 pbrook
  done
1868 56aebc89 pbrook
fi
1869 56aebc89 pbrook
echo "TARGET_XML_FILES=$list" >> $config_mak
1870 97a847bc bellard
1871 0938cda5 aurel32
if test "$target_cpu" = "arm" \
1872 0938cda5 aurel32
     -o "$target_cpu" = "armeb" \
1873 0938cda5 aurel32
     -o "$target_cpu" = "m68k" \
1874 0938cda5 aurel32
     -o "$target_cpu" = "mips" \
1875 0938cda5 aurel32
     -o "$target_cpu" = "mipsel" \
1876 0938cda5 aurel32
     -o "$target_cpu" = "mipsn32" \
1877 0938cda5 aurel32
     -o "$target_cpu" = "mipsn32el" \
1878 0938cda5 aurel32
     -o "$target_cpu" = "mips64" \
1879 0938cda5 aurel32
     -o "$target_cpu" = "mips64el" \
1880 3147d1e8 aurel32
     -o "$target_cpu" = "ppc" \
1881 3147d1e8 aurel32
     -o "$target_cpu" = "ppc64" \
1882 71e991fd aurel32
     -o "$target_cpu" = "ppc64abi32" \
1883 71e991fd aurel32
     -o "$target_cpu" = "ppcemb" \
1884 0938cda5 aurel32
     -o "$target_cpu" = "sparc" \
1885 0938cda5 aurel32
     -o "$target_cpu" = "sparc64" \
1886 0938cda5 aurel32
     -o "$target_cpu" = "sparc32plus"; then
1887 158142c2 bellard
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1888 158142c2 bellard
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1889 158142c2 bellard
fi
1890 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1891 e5fe0c52 pbrook
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
1892 e5fe0c52 pbrook
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
1893 e5fe0c52 pbrook
fi
1894 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
1895 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1896 bd0c5661 pbrook
  echo "#define USE_NPTL 1" >> $config_h
1897 bd0c5661 pbrook
fi
1898 cb33da57 blueswir1
# 32 bit ELF loader in addition to native 64 bit loader?
1899 cb33da57 blueswir1
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1900 cb33da57 blueswir1
  echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1901 cb33da57 blueswir1
  echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1902 cb33da57 blueswir1
fi
1903 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
1904 84778508 blueswir1
  echo "CONFIG_BSD_USER=yes" >> $config_mak
1905 84778508 blueswir1
  echo "#define CONFIG_BSD_USER 1" >> $config_h
1906 84778508 blueswir1
fi
1907 5b0753e0 bellard
1908 15d9ca0f ths
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1909 15d9ca0f ths
1910 97a847bc bellard
done # for target in $targets
1911 7d13299d bellard
1912 7d13299d bellard
# build tree in object directory if source path is different from current one
1913 7d13299d bellard
if test "$source_path_used" = "yes" ; then
1914 49ecc3fa bellard
    DIRS="tests tests/cris slirp audio"
1915 7d13299d bellard
    FILES="Makefile tests/Makefile"
1916 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1917 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
1918 7d13299d bellard
    for dir in $DIRS ; do
1919 7d13299d bellard
            mkdir -p $dir
1920 7d13299d bellard
    done
1921 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
1922 7d13299d bellard
    for f in $FILES ; do
1923 ec530c81 bellard
        rm -f $f
1924 ec530c81 bellard
        ln -s $source_path/$f $f
1925 7d13299d bellard
    done
1926 7d13299d bellard
fi