Statistics
| Branch: | Revision:

root / configure @ 2f7bb878

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