Statistics
| Branch: | Revision:

root / configure @ 2d18e637

History | View | Annotate | Download (48.4 kB)

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