Statistics
| Branch: | Revision:

root / configure @ e2a2ed06

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