Statistics
| Branch: | Revision:

root / configure @ 1ad2134f

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