Statistics
| Branch: | Revision:

root / configure @ 2d6ebb0c

History | View | Annotate | Download (53.6 kB)

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