Statistics
| Branch: | Revision:

root / configure @ 2fa7d3bf

History | View | Annotate | Download (40.7 kB)

1 7d13299d bellard
#!/bin/sh
2 7d13299d bellard
#
3 3ef693a0 bellard
# qemu configure script (c) 2003 Fabrice Bellard
4 7d13299d bellard
#
5 7d13299d bellard
# set temporary file name
6 7d13299d bellard
if test ! -z "$TMPDIR" ; then
7 7d13299d bellard
    TMPDIR1="${TMPDIR}"
8 7d13299d bellard
elif test ! -z "$TEMPDIR" ; then
9 7d13299d bellard
    TMPDIR1="${TEMPDIR}"
10 7d13299d bellard
else
11 7d13299d bellard
    TMPDIR1="/tmp"
12 7d13299d bellard
fi
13 7d13299d bellard
14 3ef693a0 bellard
TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
15 3ef693a0 bellard
TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16 3ef693a0 bellard
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
17 3ef693a0 bellard
TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
18 7d13299d bellard
19 7d13299d bellard
# default parameters
20 11d9f695 bellard
prefix=""
21 1e43adfc bellard
interp_prefix="/usr/gnemul/qemu-%M"
22 43ce4dfe bellard
static="no"
23 7d13299d bellard
cross_prefix=""
24 7d13299d bellard
cc="gcc"
25 328a4240 pbrook
gcc3_search="yes"
26 fe8f78e4 balrog
gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
27 0c58ac1c malc
audio_drv_list=""
28 0c58ac1c malc
audio_card_list=""
29 7d13299d bellard
host_cc="gcc"
30 7d13299d bellard
ar="ar"
31 7d13299d bellard
make="make"
32 6a882643 pbrook
install="install"
33 7d13299d bellard
strip="strip"
34 7d13299d bellard
cpu=`uname -m`
35 5327cf48 bellard
target_list=""
36 7d13299d bellard
case "$cpu" in
37 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
38 97a847bc bellard
    cpu="i386"
39 7d13299d bellard
  ;;
40 aaa5fa14 aurel32
  x86_64|amd64)
41 aaa5fa14 aurel32
    cpu="x86_64"
42 aaa5fa14 aurel32
  ;;
43 aaa5fa14 aurel32
  alpha)
44 aaa5fa14 aurel32
    cpu="alpha"
45 aaa5fa14 aurel32
  ;;
46 ba68055e bellard
  armv*b)
47 808c4954 bellard
    cpu="armv4b"
48 808c4954 bellard
  ;;
49 ba68055e bellard
  armv*l)
50 7d13299d bellard
    cpu="armv4l"
51 7d13299d bellard
  ;;
52 aaa5fa14 aurel32
  cris)
53 aaa5fa14 aurel32
    cpu="cris"
54 7d13299d bellard
  ;;
55 f54b3f92 aurel32
  parisc|parisc64)
56 f54b3f92 aurel32
    cpu="hppa"
57 f54b3f92 aurel32
  ;;
58 aaa5fa14 aurel32
  ia64)
59 aaa5fa14 aurel32
    cpu="ia64"
60 aaa5fa14 aurel32
  ;;
61 aaa5fa14 aurel32
  m68k)
62 aaa5fa14 aurel32
    cpu="m68k"
63 7d13299d bellard
  ;;
64 7d13299d bellard
  mips)
65 7d13299d bellard
    cpu="mips"
66 7d13299d bellard
  ;;
67 fbe4f65b ths
  mips64)
68 fbe4f65b ths
    cpu="mips64"
69 fbe4f65b ths
  ;;
70 aaa5fa14 aurel32
  "Power Macintosh"|ppc|ppc64)
71 aaa5fa14 aurel32
    cpu="powerpc"
72 e7daa605 ths
  ;;
73 0e7b8a9f ths
  s390*)
74 fb3e5849 bellard
    cpu="s390"
75 fb3e5849 bellard
  ;;
76 3142255c blueswir1
  sparc|sun4[cdmuv])
77 ae228531 bellard
    cpu="sparc"
78 ae228531 bellard
  ;;
79 ae228531 bellard
  sparc64)
80 ae228531 bellard
    cpu="sparc64"
81 ae228531 bellard
  ;;
82 7d13299d bellard
  *)
83 7d13299d bellard
    cpu="unknown"
84 7d13299d bellard
  ;;
85 7d13299d bellard
esac
86 7d13299d bellard
gprof="no"
87 7d13299d bellard
bigendian="no"
88 67b915a5 bellard
mingw32="no"
89 67b915a5 bellard
EXESUF=""
90 67b915a5 bellard
gdbstub="yes"
91 443f1376 bellard
slirp="yes"
92 e0e6c8c0 aliguori
vde="yes"
93 102a52e4 bellard
fmod_lib=""
94 102a52e4 bellard
fmod_inc=""
95 8d5d2d4c ths
vnc_tls="yes"
96 b1a550a0 pbrook
bsd="no"
97 5327cf48 bellard
linux="no"
98 c9ec1fe4 bellard
kqemu="no"
99 05c2a3e7 bellard
profiler="no"
100 5b0753e0 bellard
cocoa="no"
101 97ccc689 bellard
check_gfx="yes"
102 1aff381f bellard
check_gcc="yes"
103 0a8e90f4 pbrook
softmmu="yes"
104 831b7825 ths
linux_user="no"
105 831b7825 ths
darwin_user="no"
106 cc8ae6de pbrook
build_docs="no"
107 c5937220 pbrook
uname_release=""
108 4d3b6f6e balrog
curses="yes"
109 bd0c5661 pbrook
nptl="yes"
110 8ff9cbf7 malc
mixemu="no"
111 7d13299d bellard
112 7d13299d bellard
# OS specific
113 7d13299d bellard
targetos=`uname -s`
114 7d13299d bellard
case $targetos in
115 c326e0af bellard
CYGWIN*)
116 c326e0af bellard
mingw32="yes"
117 6f30fa85 ths
OS_CFLAGS="-mno-cygwin"
118 db8d7dd1 ths
if [ "$cpu" = "i386" ] ; then
119 db8d7dd1 ths
    kqemu="yes"
120 db8d7dd1 ths
fi
121 c2de5c91 malc
audio_possible_drivers="sdl"
122 c326e0af bellard
;;
123 67b915a5 bellard
MINGW32*)
124 67b915a5 bellard
mingw32="yes"
125 db8d7dd1 ths
if [ "$cpu" = "i386" ] ; then
126 db8d7dd1 ths
    kqemu="yes"
127 db8d7dd1 ths
fi
128 c2de5c91 malc
audio_possible_drivers="dsound sdl fmod"
129 67b915a5 bellard
;;
130 5c40d2bd ths
GNU/kFreeBSD)
131 0c58ac1c malc
audio_drv_list="oss"
132 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
133 5c40d2bd ths
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
134 5c40d2bd ths
    kqemu="yes"
135 5c40d2bd ths
fi
136 5c40d2bd ths
;;
137 7d3505c5 bellard
FreeBSD)
138 7d3505c5 bellard
bsd="yes"
139 0c58ac1c malc
audio_drv_list="oss"
140 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
141 e99f9060 bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
142 07f4ddbf bellard
    kqemu="yes"
143 07f4ddbf bellard
fi
144 7d3505c5 bellard
;;
145 7d3505c5 bellard
NetBSD)
146 7d3505c5 bellard
bsd="yes"
147 0c58ac1c malc
audio_drv_list="oss"
148 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
149 7d3505c5 bellard
;;
150 7d3505c5 bellard
OpenBSD)
151 7d3505c5 bellard
bsd="yes"
152 0c58ac1c malc
audio_drv_list="oss"
153 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
154 7d3505c5 bellard
;;
155 83fb7adf bellard
Darwin)
156 83fb7adf bellard
bsd="yes"
157 83fb7adf bellard
darwin="yes"
158 831b7825 ths
darwin_user="yes"
159 fd677642 ths
cocoa="yes"
160 0c58ac1c malc
audio_drv_list="coreaudio"
161 c2de5c91 malc
audio_possible_drivers="coreaudio sdl fmod"
162 6f30fa85 ths
OS_CFLAGS="-mdynamic-no-pic"
163 c2c59c3e ths
OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
164 83fb7adf bellard
;;
165 ec530c81 bellard
SunOS)
166 c2b84fab ths
    solaris="yes"
167 c2b84fab ths
    make="gmake"
168 c2b84fab ths
    install="ginstall"
169 0475a5ca ths
    needs_libsunmath="no"
170 c2b84fab ths
    solarisrev=`uname -r | cut -f2 -d.`
171 ef18c883 ths
    # have to select again, because `uname -m` returns i86pc
172 ef18c883 ths
    # even on an x86_64 box.
173 ef18c883 ths
    solariscpu=`isainfo -k`
174 ef18c883 ths
    if test "${solariscpu}" = "amd64" ; then
175 ef18c883 ths
        cpu="x86_64"
176 ef18c883 ths
    fi
177 c2b84fab ths
    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
178 0475a5ca ths
        if test "$solarisrev" -le 9 ; then
179 0475a5ca ths
            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
180 0475a5ca ths
                needs_libsunmath="yes"
181 0475a5ca ths
            else
182 0475a5ca ths
                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
183 0475a5ca ths
                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
184 0475a5ca ths
                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
185 0475a5ca ths
                echo "Studio 11 can be downloaded from www.sun.com."
186 0475a5ca ths
                exit 1
187 0475a5ca ths
            fi
188 0475a5ca ths
        fi
189 0475a5ca ths
        if test "$solarisrev" -ge 9 ; then
190 c2b84fab ths
            kqemu="yes"
191 c2b84fab ths
        fi
192 86b2bd93 ths
    fi
193 6b4d2ba1 ths
    if test -f /usr/include/sys/soundcard.h ; then
194 0c58ac1c malc
        audio_drv_list="oss"
195 6b4d2ba1 ths
    fi
196 c2de5c91 malc
    audio_possible_drivers="oss sdl"
197 86b2bd93 ths
;;
198 1d14ffa9 bellard
*)
199 0c58ac1c malc
audio_drv_list="oss"
200 b8e59f18 malc
audio_possible_drivers="oss alsa sdl esd pa"
201 5327cf48 bellard
linux="yes"
202 831b7825 ths
linux_user="yes"
203 07f4ddbf bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
204 c9ec1fe4 bellard
    kqemu="yes"
205 c2de5c91 malc
    audio_possible_drivers="$audio_possible_drivers fmod"
206 c9ec1fe4 bellard
fi
207 fb065187 bellard
;;
208 7d13299d bellard
esac
209 7d13299d bellard
210 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
211 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
212 83fb7adf bellard
    make="gmake"
213 83fb7adf bellard
  fi
214 7d3505c5 bellard
fi
215 7d3505c5 bellard
216 7d13299d bellard
# find source path
217 ad064840 pbrook
source_path=`dirname "$0"`
218 59faef3a balrog
source_path_used="no"
219 59faef3a balrog
workdir=`pwd`
220 ad064840 pbrook
if [ -z "$source_path" ]; then
221 59faef3a balrog
    source_path=$workdir
222 ad064840 pbrook
else
223 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
224 7d13299d bellard
fi
225 724db118 pbrook
[ -f "$workdir/vl.c" ] || source_path_used="yes"
226 7d13299d bellard
227 85aa5189 bellard
werror="no"
228 0d1e2394 bellard
# generate compile errors on warnings for development builds
229 0d1e2394 bellard
#if grep cvs $source_path/VERSION > /dev/null 2>&1 ; then
230 0d1e2394 bellard
#werror="yes";
231 0d1e2394 bellard
#fi
232 85aa5189 bellard
233 7d13299d bellard
for opt do
234 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
235 7d13299d bellard
  case "$opt" in
236 2efc3265 bellard
  --help|-h) show_help=yes
237 2efc3265 bellard
  ;;
238 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
239 7d13299d bellard
  ;;
240 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
241 32ce6337 bellard
  ;;
242 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
243 ad064840 pbrook
  source_path_used="yes"
244 7d13299d bellard
  ;;
245 b1a550a0 pbrook
  --cross-prefix=*) cross_prefix="$optarg"
246 7d13299d bellard
  ;;
247 b1a550a0 pbrook
  --cc=*) cc="$optarg"
248 328a4240 pbrook
  gcc3_search="no"
249 7d13299d bellard
  ;;
250 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
251 83469015 bellard
  ;;
252 b1a550a0 pbrook
  --make=*) make="$optarg"
253 7d13299d bellard
  ;;
254 6a882643 pbrook
  --install=*) install="$optarg"
255 6a882643 pbrook
  ;;
256 b1a550a0 pbrook
  --extra-cflags=*) CFLAGS="$optarg"
257 7d13299d bellard
  ;;
258 b1a550a0 pbrook
  --extra-ldflags=*) LDFLAGS="$optarg"
259 7d13299d bellard
  ;;
260 b1a550a0 pbrook
  --cpu=*) cpu="$optarg"
261 7d13299d bellard
  ;;
262 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
263 de83cd02 bellard
  ;;
264 7d13299d bellard
  --enable-gprof) gprof="yes"
265 7d13299d bellard
  ;;
266 43ce4dfe bellard
  --static) static="yes"
267 43ce4dfe bellard
  ;;
268 97a847bc bellard
  --disable-sdl) sdl="no"
269 97a847bc bellard
  ;;
270 0c58ac1c malc
  --fmod-lib=*) fmod_lib="$optarg"
271 1d14ffa9 bellard
  ;;
272 c2de5c91 malc
  --fmod-inc=*) fmod_inc="$optarg"
273 c2de5c91 malc
  ;;
274 2fa7d3bf malc
  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
275 102a52e4 bellard
  ;;
276 0c58ac1c malc
  --audio-drv-list=*) audio_drv_list="$optarg"
277 102a52e4 bellard
  ;;
278 8d5d2d4c ths
  --disable-vnc-tls) vnc_tls="no"
279 8d5d2d4c ths
  ;;
280 b93aebec bellard
  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
281 1d14ffa9 bellard
  ;;
282 443f1376 bellard
  --disable-slirp) slirp="no"
283 1d14ffa9 bellard
  ;;
284 e0e6c8c0 aliguori
  --disable-vde) vde="no"
285 8a16d273 ths
  ;;
286 c9ec1fe4 bellard
  --disable-kqemu) kqemu="no"
287 1d14ffa9 bellard
  ;;
288 2e4d9fb1 aurel32
  --disable-brlapi) brlapi="no"
289 2e4d9fb1 aurel32
  ;;
290 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
291 05c2a3e7 bellard
  ;;
292 c2de5c91 malc
  --enable-cocoa)
293 c2de5c91 malc
      cocoa="yes" ;
294 c2de5c91 malc
      sdl="no" ;
295 c2de5c91 malc
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
296 1d14ffa9 bellard
  ;;
297 97ccc689 bellard
  --disable-gfx-check) check_gfx="no"
298 97ccc689 bellard
  ;;
299 1aff381f bellard
  --disable-gcc-check) check_gcc="no"
300 1aff381f bellard
  ;;
301 cad25d69 pbrook
  --disable-system) softmmu="no"
302 0a8e90f4 pbrook
  ;;
303 cad25d69 pbrook
  --enable-system) softmmu="yes"
304 0a8e90f4 pbrook
  ;;
305 831b7825 ths
  --disable-linux-user) linux_user="no"
306 0a8e90f4 pbrook
  ;;
307 831b7825 ths
  --enable-linux-user) linux_user="yes"
308 831b7825 ths
  ;;
309 831b7825 ths
  --disable-darwin-user) darwin_user="no"
310 831b7825 ths
  ;;
311 831b7825 ths
  --enable-darwin-user) darwin_user="yes"
312 0a8e90f4 pbrook
  ;;
313 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
314 c5937220 pbrook
  ;;
315 3142255c blueswir1
  --sparc_cpu=*)
316 3142255c blueswir1
      sparc_cpu="$optarg"
317 3142255c blueswir1
      case $sparc_cpu in
318 3142255c blueswir1
        v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
319 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
320 3142255c blueswir1
        v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
321 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
322 3142255c blueswir1
        v9)    SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
323 3142255c blueswir1
                 target_cpu="sparc64"; cpu="sparc64" ;;
324 3142255c blueswir1
        *)     echo "undefined SPARC architecture. Exiting";exit 1;;
325 3142255c blueswir1
      esac
326 3142255c blueswir1
  ;;
327 85aa5189 bellard
  --enable-werror) werror="yes"
328 85aa5189 bellard
  ;;
329 85aa5189 bellard
  --disable-werror) werror="no"
330 85aa5189 bellard
  ;;
331 4d3b6f6e balrog
  --disable-curses) curses="no"
332 4d3b6f6e balrog
  ;;
333 bd0c5661 pbrook
  --disable-nptl) nptl="no"
334 bd0c5661 pbrook
  ;;
335 8ff9cbf7 malc
  --enable-mixemu) mixemu="yes"
336 8ff9cbf7 malc
  ;;
337 7f1559c6 balrog
  *) echo "ERROR: unknown option $opt"; show_help="yes"
338 7f1559c6 balrog
  ;;
339 7d13299d bellard
  esac
340 7d13299d bellard
done
341 7d13299d bellard
342 209afb9e ths
if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
343 209afb9e ths
    AIOLIBS=
344 209afb9e ths
else
345 4259e1a5 ths
    # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
346 4259e1a5 ths
    AIOLIBS="-lrt -lpthread"
347 209afb9e ths
fi
348 209afb9e ths
349 6f30fa85 ths
# default flags for all hosts
350 6f30fa85 ths
CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
351 6f30fa85 ths
LDFLAGS="$LDFLAGS -g"
352 85aa5189 bellard
if test "$werror" = "yes" ; then
353 85aa5189 bellard
CFLAGS="$CFLAGS -Werror"
354 85aa5189 bellard
fi
355 6f30fa85 ths
356 3142255c blueswir1
#
357 3142255c blueswir1
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
358 3142255c blueswir1
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
359 3142255c blueswir1
#
360 40293e58 bellard
case "$cpu" in
361 3142255c blueswir1
    sparc) if test -z "$sparc_cpu" ; then
362 3142255c blueswir1
               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
363 3142255c blueswir1
               ARCH_LDFLAGS="-m32"
364 3142255c blueswir1
           else
365 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
366 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
367 3142255c blueswir1
           fi
368 3142255c blueswir1
           ;;
369 3142255c blueswir1
    sparc64) if test -z "$sparc_cpu" ; then
370 3142255c blueswir1
               ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
371 3142255c blueswir1
               ARCH_LDFLAGS="-m64"
372 3142255c blueswir1
           else
373 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
374 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
375 3142255c blueswir1
           fi
376 3142255c blueswir1
           ;;
377 76d83bde ths
    s390)
378 76d83bde ths
           ARCH_CFLAGS="-march=z900"
379 76d83bde ths
           ;;
380 40293e58 bellard
    i386)
381 40293e58 bellard
           ARCH_CFLAGS="-m32"
382 40293e58 bellard
           ARCH_LDFLAGS="-m32"
383 40293e58 bellard
           ;;
384 40293e58 bellard
    x86_64)
385 40293e58 bellard
           ARCH_CFLAGS="-m64"
386 40293e58 bellard
           ARCH_LDFLAGS="-m64"
387 40293e58 bellard
           ;;
388 3142255c blueswir1
esac
389 3142255c blueswir1
390 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
391 af5db58e pbrook
cat << EOF
392 af5db58e pbrook
393 af5db58e pbrook
Usage: configure [options]
394 af5db58e pbrook
Options: [defaults in brackets after descriptions]
395 af5db58e pbrook
396 af5db58e pbrook
EOF
397 af5db58e pbrook
echo "Standard options:"
398 af5db58e pbrook
echo "  --help                   print this message"
399 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
400 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
401 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
402 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
403 af5db58e pbrook
echo ""
404 af5db58e pbrook
echo "kqemu kernel acceleration support:"
405 af5db58e pbrook
echo "  --disable-kqemu          disable kqemu support"
406 af5db58e pbrook
echo ""
407 af5db58e pbrook
echo "Advanced options (experts only):"
408 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
409 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
410 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
411 af5db58e pbrook
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
412 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
413 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
414 af5db58e pbrook
echo "  --static                 enable static build [$static]"
415 85aa5189 bellard
echo "  --disable-werror         disable compilation abort on warning"
416 fe8f78e4 balrog
echo "  --disable-sdl            disable SDL"
417 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
418 af5db58e pbrook
echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
419 c2de5c91 malc
echo "  --audio-drv-list=LIST    set audio drivers list:"
420 c2de5c91 malc
echo "                           Available drivers: $audio_possible_drivers"
421 c2de5c91 malc
echo "  --audio-card-list=LIST   set list of additional emulated audio cards"
422 c2de5c91 malc
echo "                           Available cards: ac97 adlib cs4231a gus"
423 8ff9cbf7 malc
echo "  --enable-mixemu          enable mixer emulation"
424 2e4d9fb1 aurel32
echo "  --disable-brlapi         disable BrlAPI"
425 8d5d2d4c ths
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
426 af896aaa pbrook
echo "  --disable-curses         disable curses output"
427 bd0c5661 pbrook
echo "  --disable-nptl           disable usermode NPTL support"
428 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
429 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
430 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
431 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
432 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
433 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
434 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
435 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
436 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
437 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
438 e0e6c8c0 aliguori
echo "  --disable-vde            disable support for vde network"
439 af5db58e pbrook
echo ""
440 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
441 af5db58e pbrook
exit 1
442 af5db58e pbrook
fi
443 af5db58e pbrook
444 7d13299d bellard
cc="${cross_prefix}${cc}"
445 7d13299d bellard
ar="${cross_prefix}${ar}"
446 7d13299d bellard
strip="${cross_prefix}${strip}"
447 7d13299d bellard
448 064aae13 pbrook
# check that the C compiler works.
449 064aae13 pbrook
cat > $TMPC <<EOF
450 064aae13 pbrook
int main(void) {}
451 064aae13 pbrook
EOF
452 064aae13 pbrook
453 db7287ed pbrook
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
454 064aae13 pbrook
  : C compiler works ok
455 064aae13 pbrook
else
456 064aae13 pbrook
    echo "ERROR: \"$cc\" either does not exist or does not work"
457 064aae13 pbrook
    exit 1
458 a7350fa1 bellard
fi
459 a7350fa1 bellard
460 67b915a5 bellard
if test "$mingw32" = "yes" ; then
461 5327cf48 bellard
    linux="no"
462 67b915a5 bellard
    EXESUF=".exe"
463 9f059eca bellard
    oss="no"
464 67b915a5 bellard
fi
465 67b915a5 bellard
466 5fafdf24 ths
# Check for gcc4, error if pre-gcc4
467 328a4240 pbrook
if test "$check_gcc" = "yes" ; then
468 328a4240 pbrook
    cat > $TMPC <<EOF
469 328a4240 pbrook
#if __GNUC__ < 4
470 328a4240 pbrook
#error gcc3
471 328a4240 pbrook
#endif
472 328a4240 pbrook
int main(){return 0;}
473 328a4240 pbrook
EOF
474 db7287ed pbrook
    if "$cc" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
475 328a4240 pbrook
	echo "WARNING: \"$cc\" looks like gcc 4.x"
476 328a4240 pbrook
	found_compat_cc="no"
477 328a4240 pbrook
	if test "$gcc3_search" = "yes" ; then
478 328a4240 pbrook
	    echo "Looking for gcc 3.x"
479 328a4240 pbrook
	    for compat_cc in $gcc3_list ; do
480 d4af3de2 balrog
		if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
481 328a4240 pbrook
		    echo "Found \"$compat_cc\""
482 1124426a pbrook
		    cc="$cross_prefix$compat_cc"
483 328a4240 pbrook
		    found_compat_cc="yes"
484 328a4240 pbrook
		    break
485 328a4240 pbrook
		fi
486 328a4240 pbrook
	    done
487 328a4240 pbrook
	    if test "$found_compat_cc" = "no" ; then
488 328a4240 pbrook
		echo "gcc 3.x not found!"
489 328a4240 pbrook
	    fi
490 328a4240 pbrook
	fi
491 328a4240 pbrook
	if test "$found_compat_cc" = "no" ; then
492 328a4240 pbrook
	    echo "QEMU is known to have problems when compiled with gcc 4.x"
493 328a4240 pbrook
	    echo "It is recommended that you use gcc 3.x to build QEMU"
494 328a4240 pbrook
	    echo "To use this compiler anyway, configure with --disable-gcc-check"
495 328a4240 pbrook
	    exit 1;
496 328a4240 pbrook
	fi
497 328a4240 pbrook
    fi
498 328a4240 pbrook
fi
499 328a4240 pbrook
500 ec530c81 bellard
#
501 ec530c81 bellard
# Solaris specific configure tool chain decisions
502 ec530c81 bellard
#
503 ec530c81 bellard
if test "$solaris" = "yes" ; then
504 ec530c81 bellard
  #
505 ec530c81 bellard
  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
506 ec530c81 bellard
  # override the check with --disable-gcc-check
507 5fafdf24 ths
  #
508 ec530c81 bellard
  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
509 ec530c81 bellard
    solgcc=`which $cc`
510 ec530c81 bellard
    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
511 ec530c81 bellard
      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
512 ec530c81 bellard
      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
513 ec530c81 bellard
      echo "or get the latest patch from SunSolve for gcc"
514 ec530c81 bellard
      exit 1
515 ec530c81 bellard
    fi
516 ec530c81 bellard
  fi
517 ec530c81 bellard
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
518 ec530c81 bellard
  if test -z "$solinst" ; then
519 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
520 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
521 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
522 ec530c81 bellard
    exit 1
523 ec530c81 bellard
  fi
524 ec530c81 bellard
  if test "$solinst" = "/usr/sbin/install" ; then
525 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
526 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
527 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
528 ec530c81 bellard
    exit 1
529 ec530c81 bellard
  fi
530 ec530c81 bellard
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
531 ec530c81 bellard
  if test -z "$sol_ar" ; then
532 ec530c81 bellard
    echo "Error: No path includes ar"
533 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
534 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
535 ec530c81 bellard
    fi
536 ec530c81 bellard
    exit 1
537 ec530c81 bellard
  fi
538 5fafdf24 ths
fi
539 ec530c81 bellard
540 ec530c81 bellard
541 5327cf48 bellard
if test -z "$target_list" ; then
542 5327cf48 bellard
# these targets are portable
543 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
544 2408a527 aurel32
        target_list="\
545 2408a527 aurel32
i386-softmmu \
546 2408a527 aurel32
x86_64-softmmu \
547 2408a527 aurel32
arm-softmmu \
548 2408a527 aurel32
cris-softmmu \
549 2408a527 aurel32
m68k-softmmu \
550 2408a527 aurel32
mips-softmmu \
551 2408a527 aurel32
mipsel-softmmu \
552 2408a527 aurel32
mips64-softmmu \
553 2408a527 aurel32
mips64el-softmmu \
554 2408a527 aurel32
ppc-softmmu \
555 2408a527 aurel32
ppcemb-softmmu \
556 2408a527 aurel32
ppc64-softmmu \
557 2408a527 aurel32
sh4-softmmu \
558 2408a527 aurel32
sh4eb-softmmu \
559 2408a527 aurel32
sparc-softmmu \
560 2408a527 aurel32
"
561 0a8e90f4 pbrook
    fi
562 5327cf48 bellard
# the following are Linux specific
563 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
564 2408a527 aurel32
        target_list="${target_list}\
565 2408a527 aurel32
i386-linux-user \
566 2408a527 aurel32
x86_64-linux-user \
567 2408a527 aurel32
alpha-linux-user \
568 2408a527 aurel32
arm-linux-user \
569 2408a527 aurel32
armeb-linux-user \
570 2408a527 aurel32
cris-linux-user \
571 2408a527 aurel32
m68k-linux-user \
572 2408a527 aurel32
mips-linux-user \
573 2408a527 aurel32
mipsel-linux-user \
574 2408a527 aurel32
ppc-linux-user \
575 2408a527 aurel32
ppc64-linux-user \
576 2408a527 aurel32
ppc64abi32-linux-user \
577 2408a527 aurel32
sh4-linux-user \
578 2408a527 aurel32
sh4eb-linux-user \
579 2408a527 aurel32
sparc-linux-user \
580 2408a527 aurel32
sparc64-linux-user \
581 2408a527 aurel32
sparc32plus-linux-user \
582 2408a527 aurel32
"
583 831b7825 ths
    fi
584 831b7825 ths
# the following are Darwin specific
585 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
586 2408a527 aurel32
        target_list="$target_list i386-darwin-user ppc-darwin-user"
587 5327cf48 bellard
    fi
588 6e20a45f bellard
else
589 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
590 5327cf48 bellard
fi
591 0a8e90f4 pbrook
if test -z "$target_list" ; then
592 0a8e90f4 pbrook
    echo "No targets enabled"
593 0a8e90f4 pbrook
    exit 1
594 0a8e90f4 pbrook
fi
595 5327cf48 bellard
596 7d13299d bellard
if test -z "$cross_prefix" ; then
597 7d13299d bellard
598 7d13299d bellard
# ---
599 7d13299d bellard
# big/little endian test
600 7d13299d bellard
cat > $TMPC << EOF
601 7d13299d bellard
#include <inttypes.h>
602 7d13299d bellard
int main(int argc, char ** argv){
603 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
604 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
605 7d13299d bellard
}
606 7d13299d bellard
EOF
607 7d13299d bellard
608 db7287ed pbrook
if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
609 7d13299d bellard
$TMPE && bigendian="yes"
610 7d13299d bellard
else
611 7d13299d bellard
echo big/little test failed
612 7d13299d bellard
fi
613 7d13299d bellard
614 7d13299d bellard
else
615 7d13299d bellard
616 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
617 0938cda5 aurel32
if test "$cpu" = "armv4b" \
618 f54b3f92 aurel32
     -o "$cpu" = "hppa" \
619 0938cda5 aurel32
     -o "$cpu" = "m68k" \
620 0938cda5 aurel32
     -o "$cpu" = "mips" \
621 0938cda5 aurel32
     -o "$cpu" = "mips64" \
622 0938cda5 aurel32
     -o "$cpu" = "powerpc" \
623 0938cda5 aurel32
     -o "$cpu" = "s390" \
624 0938cda5 aurel32
     -o "$cpu" = "sparc" \
625 0938cda5 aurel32
     -o "$cpu" = "sparc64"; then
626 7d13299d bellard
    bigendian="yes"
627 7d13299d bellard
fi
628 7d13299d bellard
629 7d13299d bellard
fi
630 7d13299d bellard
631 b6853697 bellard
# host long bits test
632 b6853697 bellard
hostlongbits="32"
633 0938cda5 aurel32
if test "$cpu" = "x86_64" \
634 0938cda5 aurel32
     -o "$cpu" = "alpha" \
635 0938cda5 aurel32
     -o "$cpu" = "ia64" \
636 0938cda5 aurel32
     -o "$cpu" = "sparc64"; then
637 b6853697 bellard
    hostlongbits="64"
638 b6853697 bellard
fi
639 b6853697 bellard
640 810260a8 malc
# ppc specific hostlongbits selection
641 810260a8 malc
if test "$cpu" = "powerpc" ; then
642 810260a8 malc
    cat > $TMPC <<EOF
643 810260a8 malc
int main(void){return sizeof(long);}
644 810260a8 malc
EOF
645 810260a8 malc
646 810260a8 malc
    if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null; then
647 810260a8 malc
        $TMPE
648 810260a8 malc
        case $? in
649 810260a8 malc
            4) hostlongbits="32";;
650 810260a8 malc
            8) hostlongbits="64";;
651 ba69a08a malc
            *) echo "Couldn't determine bits per long value"; exit 1;;
652 810260a8 malc
        esac
653 810260a8 malc
    else
654 810260a8 malc
        echo hostlongbits test failed
655 ba69a08a malc
        exit 1
656 810260a8 malc
    fi
657 810260a8 malc
fi
658 810260a8 malc
659 e8cd23de bellard
# check gcc options support
660 04369ff2 bellard
cat > $TMPC <<EOF
661 04369ff2 bellard
int main(void) {
662 04369ff2 bellard
}
663 04369ff2 bellard
EOF
664 04369ff2 bellard
665 bd0c5661 pbrook
# Check host NPTL support
666 bd0c5661 pbrook
cat > $TMPC <<EOF
667 bd0c5661 pbrook
#include <sched.h>
668 30813cea pbrook
#include <linux/futex.h>
669 bd0c5661 pbrook
void foo()
670 bd0c5661 pbrook
{
671 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
672 bd0c5661 pbrook
#error bork
673 bd0c5661 pbrook
#endif
674 bd0c5661 pbrook
}
675 bd0c5661 pbrook
EOF
676 bd0c5661 pbrook
677 bd0c5661 pbrook
if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC 2> /dev/null ; then
678 bd0c5661 pbrook
  :
679 bd0c5661 pbrook
else
680 bd0c5661 pbrook
   nptl="no"
681 bd0c5661 pbrook
fi
682 bd0c5661 pbrook
683 11d9f695 bellard
##########################################
684 11d9f695 bellard
# SDL probe
685 11d9f695 bellard
686 11d9f695 bellard
sdl_too_old=no
687 11d9f695 bellard
688 11d9f695 bellard
if test -z "$sdl" ; then
689 069b0bda ths
    sdl_config="sdl-config"
690 069b0bda ths
    sdl=no
691 069b0bda ths
    sdl_static=no
692 069b0bda ths
693 069b0bda ths
    if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
694 069b0bda ths
    # win32 cross compilation case
695 069b0bda ths
        sdl_config="i386-mingw32msvc-sdl-config"
696 069b0bda ths
        sdl=yes
697 069b0bda ths
    else
698 069b0bda ths
        # normal SDL probe
699 11d9f695 bellard
cat > $TMPC << EOF
700 11d9f695 bellard
#include <SDL.h>
701 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
702 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
703 11d9f695 bellard
EOF
704 db7287ed pbrook
        if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /tmp/qemu-$$-sdl-config.log ; then
705 069b0bda ths
            _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
706 069b0bda ths
            if test "$_sdlversion" -lt 121 ; then
707 069b0bda ths
                sdl_too_old=yes
708 069b0bda ths
            else
709 069b0bda ths
                if test "$cocoa" = "no" ; then
710 069b0bda ths
                    sdl=yes
711 069b0bda ths
                fi
712 069b0bda ths
            fi
713 11d9f695 bellard
714 069b0bda ths
            # static link with sdl ?
715 069b0bda ths
            if test "$sdl" = "yes" ; then
716 069b0bda ths
                aa="no"
717 069b0bda ths
                `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
718 069b0bda ths
                sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
719 069b0bda ths
                if [ "$aa" = "yes" ] ; then
720 069b0bda ths
                    sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
721 069b0bda ths
                fi
722 069b0bda ths
723 8281db4d ths
                if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
724 069b0bda ths
                    sdl_static=yes
725 069b0bda ths
                fi
726 069b0bda ths
            fi # static link
727 069b0bda ths
        fi # sdl compile test
728 069b0bda ths
    fi # cross compilation
729 fd677642 ths
else
730 069b0bda ths
    # Make sure to disable cocoa if sdl was set
731 069b0bda ths
    if test "$sdl" = "yes" ; then
732 069b0bda ths
       cocoa="no"
733 c2de5c91 malc
       audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
734 069b0bda ths
    fi
735 a6e022ad bellard
fi # -z $sdl
736 11d9f695 bellard
737 8f28f3fb ths
##########################################
738 8d5d2d4c ths
# VNC TLS detection
739 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
740 8d5d2d4c ths
  `pkg-config gnutls` || vnc_tls="no"
741 8d5d2d4c ths
fi
742 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
743 8d5d2d4c ths
  vnc_tls_cflags=`pkg-config --cflags gnutls`
744 8d5d2d4c ths
  vnc_tls_libs=`pkg-config --libs gnutls`
745 8d5d2d4c ths
fi
746 8d5d2d4c ths
747 8d5d2d4c ths
##########################################
748 8a16d273 ths
# vde libraries probe
749 8a16d273 ths
if test "$vde" = "yes" ; then
750 8a16d273 ths
  cat > $TMPC << EOF
751 8a16d273 ths
#include <libvdeplug.h>
752 8a16d273 ths
int main(void) { struct vde_open_args a = {0, 0, 0} ; return 0;}
753 8a16d273 ths
EOF
754 8a16d273 ths
    if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
755 8a16d273 ths
        :
756 8a16d273 ths
    else
757 e0e6c8c0 aliguori
        vde="no"
758 8a16d273 ths
    fi
759 8a16d273 ths
fi
760 8a16d273 ths
761 8a16d273 ths
##########################################
762 c2de5c91 malc
# Sound support libraries probe
763 8f28f3fb ths
764 c2de5c91 malc
audio_drv_probe()
765 c2de5c91 malc
{
766 c2de5c91 malc
    drv=$1
767 c2de5c91 malc
    hdr=$2
768 c2de5c91 malc
    lib=$3
769 c2de5c91 malc
    exp=$4
770 c2de5c91 malc
    cfl=$5
771 c2de5c91 malc
        cat > $TMPC << EOF
772 c2de5c91 malc
#include <$hdr>
773 c2de5c91 malc
int main(void) { $exp }
774 8f28f3fb ths
EOF
775 c2de5c91 malc
    if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib 2> /dev/null ; then
776 c2de5c91 malc
        :
777 c2de5c91 malc
    else
778 c2de5c91 malc
        echo
779 c2de5c91 malc
        echo "Error: $drv check failed"
780 c2de5c91 malc
        echo "Make sure to have the $drv libs and headers installed."
781 c2de5c91 malc
        echo
782 c2de5c91 malc
        exit 1
783 c2de5c91 malc
    fi
784 c2de5c91 malc
}
785 c2de5c91 malc
786 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
787 c2de5c91 malc
for drv in $audio_drv_list; do
788 c2de5c91 malc
    case $drv in
789 c2de5c91 malc
    alsa)
790 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
791 c2de5c91 malc
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
792 c2de5c91 malc
    ;;
793 c2de5c91 malc
794 c2de5c91 malc
    fmod)
795 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
796 c2de5c91 malc
        echo
797 c2de5c91 malc
        echo "Error: You must specify path to FMOD library and headers"
798 c2de5c91 malc
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
799 c2de5c91 malc
        echo
800 c2de5c91 malc
        exit 1
801 c2de5c91 malc
    fi
802 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
803 c2de5c91 malc
    ;;
804 c2de5c91 malc
805 c2de5c91 malc
    esd)
806 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
807 c2de5c91 malc
    ;;
808 b8e59f18 malc
809 b8e59f18 malc
    pa)
810 b8e59f18 malc
    audio_drv_probe $drv pulse/simple.h -lpulse-simple \
811 b8e59f18 malc
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
812 b8e59f18 malc
    ;;
813 b8e59f18 malc
814 e4c63a6a malc
    *)
815 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
816 e4c63a6a malc
        echo
817 e4c63a6a malc
        echo "Error: Unknown driver '$drv' selected"
818 e4c63a6a malc
        echo "Possible drivers are: $audio_possible_drivers"
819 e4c63a6a malc
        echo
820 e4c63a6a malc
        exit 1
821 e4c63a6a malc
    }
822 e4c63a6a malc
    ;;
823 e4c63a6a malc
824 c2de5c91 malc
    esac
825 c2de5c91 malc
done
826 8f28f3fb ths
827 4d3b6f6e balrog
##########################################
828 2e4d9fb1 aurel32
# BrlAPI probe
829 2e4d9fb1 aurel32
830 2e4d9fb1 aurel32
if test -z "$brlapi" ; then
831 2e4d9fb1 aurel32
    brlapi=no
832 2e4d9fb1 aurel32
cat > $TMPC << EOF
833 2e4d9fb1 aurel32
#include <brlapi.h>
834 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
835 2e4d9fb1 aurel32
EOF
836 a40e56d5 aurel32
    if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi 2> /dev/null ; then
837 2e4d9fb1 aurel32
	    brlapi=yes
838 2e4d9fb1 aurel32
    fi # brlapi compile test
839 2e4d9fb1 aurel32
fi # -z $brlapi
840 2e4d9fb1 aurel32
841 2e4d9fb1 aurel32
##########################################
842 4d3b6f6e balrog
# curses probe
843 4d3b6f6e balrog
844 4d3b6f6e balrog
if test "$curses" = "yes" ; then
845 4d3b6f6e balrog
  curses=no
846 4d3b6f6e balrog
  cat > $TMPC << EOF
847 4d3b6f6e balrog
#include <curses.h>
848 4d3b6f6e balrog
int main(void) { return curses_version(); }
849 4d3b6f6e balrog
EOF
850 af896aaa pbrook
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses 2> /dev/null ; then
851 4d3b6f6e balrog
    curses=yes
852 4d3b6f6e balrog
  fi
853 4d3b6f6e balrog
fi # test "$curses"
854 4d3b6f6e balrog
855 cc8ae6de pbrook
# Check if tools are available to build documentation.
856 6c591867 ths
if [ -x "`which texi2html 2>/dev/null`" ] && \
857 6c591867 ths
   [ -x "`which pod2man 2>/dev/null`" ]; then
858 cc8ae6de pbrook
  build_docs="yes"
859 cc8ae6de pbrook
fi
860 cc8ae6de pbrook
861 11d9f695 bellard
if test "$mingw32" = "yes" ; then
862 308c3593 pbrook
  if test -z "$prefix" ; then
863 308c3593 pbrook
      prefix="/c/Program Files/Qemu"
864 308c3593 pbrook
  fi
865 308c3593 pbrook
  mansuffix=""
866 308c3593 pbrook
  datasuffix=""
867 308c3593 pbrook
  docsuffix=""
868 308c3593 pbrook
  binsuffix=""
869 11d9f695 bellard
else
870 308c3593 pbrook
  if test -z "$prefix" ; then
871 308c3593 pbrook
      prefix="/usr/local"
872 308c3593 pbrook
  fi
873 308c3593 pbrook
  mansuffix="/share/man"
874 308c3593 pbrook
  datasuffix="/share/qemu"
875 308c3593 pbrook
  docsuffix="/share/doc/qemu"
876 308c3593 pbrook
  binsuffix="/bin"
877 11d9f695 bellard
fi
878 5a67135a bellard
879 43ce4dfe bellard
echo "Install prefix    $prefix"
880 308c3593 pbrook
echo "BIOS directory    $prefix$datasuffix"
881 308c3593 pbrook
echo "binary directory  $prefix$binsuffix"
882 11d9f695 bellard
if test "$mingw32" = "no" ; then
883 308c3593 pbrook
echo "Manual directory  $prefix$mansuffix"
884 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
885 11d9f695 bellard
fi
886 5a67135a bellard
echo "Source path       $source_path"
887 43ce4dfe bellard
echo "C compiler        $cc"
888 83469015 bellard
echo "Host C compiler   $host_cc"
889 db7287ed pbrook
echo "ARCH_CFLAGS       $ARCH_CFLAGS"
890 43ce4dfe bellard
echo "make              $make"
891 6a882643 pbrook
echo "install           $install"
892 43ce4dfe bellard
echo "host CPU          $cpu"
893 de83cd02 bellard
echo "host big endian   $bigendian"
894 97a847bc bellard
echo "target list       $target_list"
895 43ce4dfe bellard
echo "gprof enabled     $gprof"
896 05c2a3e7 bellard
echo "profiler          $profiler"
897 43ce4dfe bellard
echo "static build      $static"
898 85aa5189 bellard
echo "-Werror enabled   $werror"
899 5b0753e0 bellard
if test "$darwin" = "yes" ; then
900 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
901 5b0753e0 bellard
fi
902 97a847bc bellard
echo "SDL support       $sdl"
903 e4afee97 bellard
if test "$sdl" != "no" ; then
904 e4afee97 bellard
    echo "SDL static link   $sdl_static"
905 e4afee97 bellard
fi
906 4d3b6f6e balrog
echo "curses support    $curses"
907 67b915a5 bellard
echo "mingw32 support   $mingw32"
908 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
909 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
910 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
911 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
912 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
913 8d5d2d4c ths
    echo "    TLS CFLAGS    $vnc_tls_cflags"
914 8d5d2d4c ths
    echo "    TLS LIBS      $vnc_tls_libs"
915 8d5d2d4c ths
fi
916 3142255c blueswir1
if test -n "$sparc_cpu"; then
917 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
918 3142255c blueswir1
fi
919 07f4ddbf bellard
echo "kqemu support     $kqemu"
920 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
921 cc8ae6de pbrook
echo "Documentation     $build_docs"
922 c5937220 pbrook
[ ! -z "$uname_release" ] && \
923 c5937220 pbrook
echo "uname -r          $uname_release"
924 bd0c5661 pbrook
echo "NPTL support      $nptl"
925 8a16d273 ths
echo "vde support       $vde"
926 67b915a5 bellard
927 97a847bc bellard
if test $sdl_too_old = "yes"; then
928 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
929 7c1f25b4 bellard
fi
930 20b40c6a ths
if [ -s /tmp/qemu-$$-sdl-config.log ]; then
931 20b40c6a ths
  echo "The error log from compiling the libSDL test is: "
932 20b40c6a ths
  cat /tmp/qemu-$$-sdl-config.log
933 20b40c6a ths
fi
934 20b40c6a ths
rm -f /tmp/qemu-$$-sdl-config.log
935 24b55b96 bellard
#if test "$sdl_static" = "no"; then
936 24b55b96 bellard
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
937 24b55b96 bellard
#fi
938 97a847bc bellard
config_mak="config-host.mak"
939 97a847bc bellard
config_h="config-host.h"
940 7d13299d bellard
941 7c1f25b4 bellard
#echo "Creating $config_mak and $config_h"
942 7d13299d bellard
943 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
944 15d9ca0f ths
945 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
946 29517134 pbrook
echo "# Configured with: $0 $@" >> $config_mak
947 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
948 7d13299d bellard
949 97a847bc bellard
echo "prefix=$prefix" >> $config_mak
950 308c3593 pbrook
echo "bindir=\${prefix}$binsuffix" >> $config_mak
951 308c3593 pbrook
echo "mandir=\${prefix}$mansuffix" >> $config_mak
952 308c3593 pbrook
echo "datadir=\${prefix}$datasuffix" >> $config_mak
953 4ad5b06d ths
echo "docdir=\${prefix}$docsuffix" >> $config_mak
954 308c3593 pbrook
echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
955 97a847bc bellard
echo "MAKE=$make" >> $config_mak
956 6a882643 pbrook
echo "INSTALL=$install" >> $config_mak
957 97a847bc bellard
echo "CC=$cc" >> $config_mak
958 97a847bc bellard
echo "HOST_CC=$host_cc" >> $config_mak
959 97a847bc bellard
echo "AR=$ar" >> $config_mak
960 97a847bc bellard
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
961 40293e58 bellard
# XXX: only use CFLAGS and LDFLAGS ?  
962 40293e58 bellard
# XXX: should export HOST_CFLAGS and HOST_LDFLAGS for cross
963 40293e58 bellard
# compilation of dyngen tool (useful for win32 build on Linux host)
964 6f30fa85 ths
echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
965 3142255c blueswir1
echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
966 3142255c blueswir1
echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
967 3142255c blueswir1
echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
968 97a847bc bellard
echo "CFLAGS=$CFLAGS" >> $config_mak
969 97a847bc bellard
echo "LDFLAGS=$LDFLAGS" >> $config_mak
970 67b915a5 bellard
echo "EXESUF=$EXESUF" >> $config_mak
971 70956b77 ths
echo "AIOLIBS=$AIOLIBS" >> $config_mak
972 2408a527 aurel32
case "$cpu" in
973 2408a527 aurel32
  i386)
974 2408a527 aurel32
    echo "ARCH=i386" >> $config_mak
975 2408a527 aurel32
    echo "#define HOST_I386 1" >> $config_h
976 2408a527 aurel32
  ;;
977 2408a527 aurel32
  x86_64)
978 2408a527 aurel32
    echo "ARCH=x86_64" >> $config_mak
979 2408a527 aurel32
    echo "#define HOST_X86_64 1" >> $config_h
980 2408a527 aurel32
  ;;
981 2408a527 aurel32
  alpha)
982 2408a527 aurel32
    echo "ARCH=alpha" >> $config_mak
983 2408a527 aurel32
    echo "#define HOST_ALPHA 1" >> $config_h
984 2408a527 aurel32
  ;;
985 2408a527 aurel32
  armv4b)
986 2408a527 aurel32
    echo "ARCH=arm" >> $config_mak
987 2408a527 aurel32
    echo "#define HOST_ARM 1" >> $config_h
988 2408a527 aurel32
  ;;
989 2408a527 aurel32
  armv4l)
990 2408a527 aurel32
    echo "ARCH=arm" >> $config_mak
991 2408a527 aurel32
    echo "#define HOST_ARM 1" >> $config_h
992 2408a527 aurel32
  ;;
993 2408a527 aurel32
  cris)
994 2408a527 aurel32
    echo "ARCH=cris" >> $config_mak
995 2408a527 aurel32
    echo "#define HOST_CRIS 1" >> $config_h
996 2408a527 aurel32
  ;;
997 2408a527 aurel32
  hppa)
998 2408a527 aurel32
    echo "ARCH=hppa" >> $config_mak
999 2408a527 aurel32
    echo "#define HOST_HPPA 1" >> $config_h
1000 2408a527 aurel32
  ;;
1001 2408a527 aurel32
  ia64)
1002 2408a527 aurel32
    echo "ARCH=ia64" >> $config_mak
1003 2408a527 aurel32
    echo "#define HOST_IA64 1" >> $config_h
1004 2408a527 aurel32
  ;;
1005 2408a527 aurel32
  m68k)
1006 2408a527 aurel32
    echo "ARCH=m68k" >> $config_mak
1007 2408a527 aurel32
    echo "#define HOST_M68K 1" >> $config_h
1008 2408a527 aurel32
  ;;
1009 2408a527 aurel32
  mips)
1010 2408a527 aurel32
    echo "ARCH=mips" >> $config_mak
1011 2408a527 aurel32
    echo "#define HOST_MIPS 1" >> $config_h
1012 2408a527 aurel32
  ;;
1013 2408a527 aurel32
  mips64)
1014 2408a527 aurel32
    echo "ARCH=mips64" >> $config_mak
1015 2408a527 aurel32
    echo "#define HOST_MIPS64 1" >> $config_h
1016 2408a527 aurel32
  ;;
1017 2408a527 aurel32
  powerpc)
1018 810260a8 malc
  if test "$hostlongbits" = "32"; then
1019 810260a8 malc
      echo "ARCH=ppc" >> $config_mak
1020 810260a8 malc
      echo "#define HOST_PPC 1" >> $config_h
1021 810260a8 malc
  else
1022 810260a8 malc
      echo "ARCH=ppc64" >> $config_mak
1023 810260a8 malc
      echo "#define HOST_PPC64 1" >> $config_h
1024 810260a8 malc
  fi
1025 2408a527 aurel32
  ;;
1026 2408a527 aurel32
  s390)
1027 2408a527 aurel32
    echo "ARCH=s390" >> $config_mak
1028 2408a527 aurel32
    echo "#define HOST_S390 1" >> $config_h
1029 2408a527 aurel32
  ;;
1030 2408a527 aurel32
  sparc)
1031 2408a527 aurel32
    echo "ARCH=sparc" >> $config_mak
1032 2408a527 aurel32
    echo "#define HOST_SPARC 1" >> $config_h
1033 2408a527 aurel32
  ;;
1034 2408a527 aurel32
  sparc64)
1035 2408a527 aurel32
    echo "ARCH=sparc64" >> $config_mak
1036 2408a527 aurel32
    echo "#define HOST_SPARC64 1" >> $config_h
1037 2408a527 aurel32
  ;;
1038 2408a527 aurel32
  *)
1039 2408a527 aurel32
    echo "Unsupported CPU = $cpu"
1040 2408a527 aurel32
    exit 1
1041 2408a527 aurel32
  ;;
1042 2408a527 aurel32
esac
1043 7d13299d bellard
if test "$bigendian" = "yes" ; then
1044 97a847bc bellard
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
1045 97a847bc bellard
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
1046 97a847bc bellard
fi
1047 b6853697 bellard
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
1048 67b915a5 bellard
if test "$mingw32" = "yes" ; then
1049 67b915a5 bellard
  echo "CONFIG_WIN32=yes" >> $config_mak
1050 11d9f695 bellard
  echo "#define CONFIG_WIN32 1" >> $config_h
1051 210fa556 pbrook
else
1052 210fa556 pbrook
  cat > $TMPC << EOF
1053 210fa556 pbrook
#include <byteswap.h>
1054 210fa556 pbrook
int main(void) { return bswap_32(0); }
1055 210fa556 pbrook
EOF
1056 db7287ed pbrook
  if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
1057 210fa556 pbrook
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
1058 210fa556 pbrook
  fi
1059 67b915a5 bellard
fi
1060 83fb7adf bellard
if test "$darwin" = "yes" ; then
1061 83fb7adf bellard
  echo "CONFIG_DARWIN=yes" >> $config_mak
1062 83fb7adf bellard
  echo "#define CONFIG_DARWIN 1" >> $config_h
1063 83fb7adf bellard
fi
1064 ec530c81 bellard
if test "$solaris" = "yes" ; then
1065 ec530c81 bellard
  echo "CONFIG_SOLARIS=yes" >> $config_mak
1066 38cfa06c bellard
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
1067 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
1068 0475a5ca ths
    echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
1069 0475a5ca ths
    echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
1070 0475a5ca ths
  fi
1071 ec530c81 bellard
fi
1072 3142255c blueswir1
if test -n "$sparc_cpu"; then
1073 3142255c blueswir1
  echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
1074 3142255c blueswir1
  echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
1075 3142255c blueswir1
fi
1076 67b915a5 bellard
if test "$gdbstub" = "yes" ; then
1077 67b915a5 bellard
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
1078 67b915a5 bellard
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
1079 67b915a5 bellard
fi
1080 97a847bc bellard
if test "$gprof" = "yes" ; then
1081 97a847bc bellard
  echo "TARGET_GPROF=yes" >> $config_mak
1082 97a847bc bellard
  echo "#define HAVE_GPROF 1" >> $config_h
1083 97a847bc bellard
fi
1084 97a847bc bellard
if test "$static" = "yes" ; then
1085 97a847bc bellard
  echo "CONFIG_STATIC=yes" >> $config_mak
1086 50863472 bellard
  echo "#define CONFIG_STATIC 1" >> $config_h
1087 7d13299d bellard
fi
1088 05c2a3e7 bellard
if test $profiler = "yes" ; then
1089 05c2a3e7 bellard
  echo "#define CONFIG_PROFILER 1" >> $config_h
1090 05c2a3e7 bellard
fi
1091 c20709aa bellard
if test "$slirp" = "yes" ; then
1092 c20709aa bellard
  echo "CONFIG_SLIRP=yes" >> $config_mak
1093 c20709aa bellard
  echo "#define CONFIG_SLIRP 1" >> $config_h
1094 c20709aa bellard
fi
1095 8a16d273 ths
if test "$vde" = "yes" ; then
1096 8a16d273 ths
  echo "CONFIG_VDE=yes" >> $config_mak
1097 8a16d273 ths
  echo "#define CONFIG_VDE 1" >> $config_h
1098 8a16d273 ths
  echo "VDE_LIBS=-lvdeplug" >> $config_mak
1099 8a16d273 ths
fi
1100 0c58ac1c malc
for card in $audio_card_list; do
1101 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1102 0c58ac1c malc
    echo "$def=yes" >> $config_mak
1103 0c58ac1c malc
    echo "#define $def 1" >> $config_h
1104 0c58ac1c malc
done
1105 0c58ac1c malc
echo "#define AUDIO_DRIVERS \\" >> $config_h
1106 0c58ac1c malc
for drv in $audio_drv_list; do
1107 0c58ac1c malc
    echo "    &${drv}_audio_driver, \\" >>$config_h
1108 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1109 0c58ac1c malc
    echo "$def=yes" >> $config_mak
1110 923e4521 malc
    if test "$drv" = "fmod"; then
1111 0c58ac1c malc
        echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
1112 0c58ac1c malc
        echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
1113 0c58ac1c malc
    fi
1114 0c58ac1c malc
done
1115 0c58ac1c malc
echo "" >>$config_h
1116 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
1117 8ff9cbf7 malc
  echo "CONFIG_MIXEMU=yes" >> $config_mak
1118 8ff9cbf7 malc
  echo "#define CONFIG_MIXEMU 1" >> $config_h
1119 8ff9cbf7 malc
fi
1120 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1121 8d5d2d4c ths
  echo "CONFIG_VNC_TLS=yes" >> $config_mak
1122 8d5d2d4c ths
  echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
1123 8d5d2d4c ths
  echo "CONFIG_VNC_TLS_LIBS=$vnc_tls_libs" >> $config_mak
1124 8d5d2d4c ths
  echo "#define CONFIG_VNC_TLS 1" >> $config_h
1125 8d5d2d4c ths
fi
1126 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
1127 b1a550a0 pbrook
echo "VERSION=$qemu_version" >>$config_mak
1128 d4b8f039 pbrook
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
1129 97a847bc bellard
1130 97a847bc bellard
echo "SRC_PATH=$source_path" >> $config_mak
1131 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
1132 ad064840 pbrook
  echo "VPATH=$source_path" >> $config_mak
1133 ad064840 pbrook
fi
1134 97a847bc bellard
echo "TARGET_DIRS=$target_list" >> $config_mak
1135 cc8ae6de pbrook
if [ "$build_docs" = "yes" ] ; then
1136 cc8ae6de pbrook
  echo "BUILD_DOCS=yes" >> $config_mak
1137 cc8ae6de pbrook
fi
1138 49ecc3fa bellard
if test "$static" = "yes"; then
1139 49ecc3fa bellard
  sdl1=$sdl_static
1140 49ecc3fa bellard
else
1141 49ecc3fa bellard
  sdl1=$sdl
1142 49ecc3fa bellard
fi
1143 49ecc3fa bellard
if test "$sdl1" = "yes" ; then
1144 49ecc3fa bellard
  echo "#define CONFIG_SDL 1" >> $config_h
1145 49ecc3fa bellard
  echo "CONFIG_SDL=yes" >> $config_mak
1146 49ecc3fa bellard
  if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1147 49ecc3fa bellard
    echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1148 49ecc3fa bellard
  else
1149 49ecc3fa bellard
    echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1150 49ecc3fa bellard
  fi
1151 49ecc3fa bellard
  if [ "${aa}" = "yes" ] ; then
1152 49ecc3fa bellard
    echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1153 49ecc3fa bellard
  else
1154 49ecc3fa bellard
    echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1155 49ecc3fa bellard
  fi
1156 49ecc3fa bellard
fi
1157 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
1158 4d3b6f6e balrog
  echo "#define CONFIG_COCOA 1" >> $config_h
1159 4d3b6f6e balrog
  echo "CONFIG_COCOA=yes" >> $config_mak
1160 4d3b6f6e balrog
fi
1161 4d3b6f6e balrog
if test "$curses" = "yes" ; then
1162 4d3b6f6e balrog
  echo "#define CONFIG_CURSES 1" >> $config_h
1163 4d3b6f6e balrog
  echo "CONFIG_CURSES=yes" >> $config_mak
1164 4d3b6f6e balrog
  echo "CURSES_LIBS=-lcurses" >> $config_mak
1165 49ecc3fa bellard
fi
1166 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
1167 2e4d9fb1 aurel32
  echo "CONFIG_BRLAPI=yes" >> $config_mak
1168 2e4d9fb1 aurel32
  echo "#define CONFIG_BRLAPI 1" >> $config_h
1169 2e4d9fb1 aurel32
  echo "BRLAPI_LIBS=-lbrlapi" >> $config_mak
1170 2e4d9fb1 aurel32
fi
1171 97a847bc bellard
1172 83fb7adf bellard
# XXX: suppress that
1173 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
1174 43003046 bellard
  echo "#define O_LARGEFILE 0" >> $config_h
1175 43003046 bellard
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
1176 7d3505c5 bellard
  echo "#define _BSD 1" >> $config_h
1177 7d3505c5 bellard
fi
1178 7d3505c5 bellard
1179 c5937220 pbrook
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
1180 c5937220 pbrook
1181 c39e3338 pbrook
tools=
1182 c39e3338 pbrook
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1183 c39e3338 pbrook
  tools="qemu-img\$(EXESUF) $tools"
1184 7a5ca864 bellard
  if [ "$linux" = "yes" ] ; then
1185 7a5ca864 bellard
      tools="qemu-nbd\$(EXESUF) $tools"
1186 7a5ca864 bellard
  fi
1187 c39e3338 pbrook
fi
1188 c39e3338 pbrook
echo "TOOLS=$tools" >> $config_mak
1189 c39e3338 pbrook
1190 15d9ca0f ths
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1191 15d9ca0f ths
1192 1d14ffa9 bellard
for target in $target_list; do
1193 97a847bc bellard
target_dir="$target"
1194 97a847bc bellard
config_mak=$target_dir/config.mak
1195 97a847bc bellard
config_h=$target_dir/config.h
1196 97a847bc bellard
target_cpu=`echo $target | cut -d '-' -f 1`
1197 97a847bc bellard
target_bigendian="no"
1198 808c4954 bellard
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
1199 0938cda5 aurel32
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
1200 0938cda5 aurel32
[ "$target_cpu" = "mips" ] && target_bigendian=yes
1201 0938cda5 aurel32
[ "$target_cpu" = "mipsn32" ] && target_bigendian=yes
1202 0938cda5 aurel32
[ "$target_cpu" = "mips64" ] && target_bigendian=yes
1203 67867308 bellard
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
1204 d4082e95 j_mayer
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
1205 22f8a8b3 j_mayer
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
1206 e85e7c6e j_mayer
[ "$target_cpu" = "ppc64abi32" ] && target_bigendian=yes
1207 908f52b0 pbrook
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
1208 0938cda5 aurel32
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
1209 0938cda5 aurel32
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
1210 0938cda5 aurel32
[ "$target_cpu" = "sparc32plus" ] && target_bigendian=yes
1211 97a847bc bellard
target_softmmu="no"
1212 997344f3 bellard
target_user_only="no"
1213 831b7825 ths
target_linux_user="no"
1214 831b7825 ths
target_darwin_user="no"
1215 9e407a85 pbrook
case "$target" in
1216 9e407a85 pbrook
  ${target_cpu}-softmmu)
1217 9e407a85 pbrook
    target_softmmu="yes"
1218 9e407a85 pbrook
    ;;
1219 9e407a85 pbrook
  ${target_cpu}-linux-user)
1220 9e407a85 pbrook
    target_user_only="yes"
1221 9e407a85 pbrook
    target_linux_user="yes"
1222 9e407a85 pbrook
    ;;
1223 9e407a85 pbrook
  ${target_cpu}-darwin-user)
1224 9e407a85 pbrook
    target_user_only="yes"
1225 9e407a85 pbrook
    target_darwin_user="yes"
1226 9e407a85 pbrook
    ;;
1227 9e407a85 pbrook
  *)
1228 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
1229 9e407a85 pbrook
    exit 1
1230 9e407a85 pbrook
    ;;
1231 9e407a85 pbrook
esac
1232 831b7825 ths
1233 97ccc689 bellard
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
1234 1d14ffa9 bellard
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
1235 97ccc689 bellard
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
1236 9c038506 pbrook
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
1237 4d3b6f6e balrog
    echo "Note that this will disable all output from the virtual graphics card"
1238 4d3b6f6e balrog
    echo "except through VNC or curses."
1239 97ccc689 bellard
    exit 1;
1240 97ccc689 bellard
fi
1241 97ccc689 bellard
1242 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1243 97a847bc bellard
1244 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
1245 15d9ca0f ths
1246 97a847bc bellard
mkdir -p $target_dir
1247 158142c2 bellard
mkdir -p $target_dir/fpu
1248 57fec1fe bellard
mkdir -p $target_dir/tcg
1249 831b7825 ths
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
1250 69de927c bellard
  mkdir -p $target_dir/nwfpe
1251 69de927c bellard
fi
1252 69de927c bellard
1253 ec530c81 bellard
#
1254 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
1255 ec530c81 bellard
#
1256 ec530c81 bellard
rm -f $target_dir/Makefile
1257 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
1258 ec530c81 bellard
1259 97a847bc bellard
1260 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
1261 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
1262 97a847bc bellard
1263 de83cd02 bellard
1264 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
1265 97a847bc bellard
echo "#include \"../config-host.h\"" >> $config_h
1266 1e43adfc bellard
1267 e5fe0c52 pbrook
bflt="no"
1268 cb33da57 blueswir1
elfload32="no"
1269 bd0c5661 pbrook
target_nptl="no"
1270 1e43adfc bellard
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
1271 1e43adfc bellard
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
1272 97a847bc bellard
1273 2408a527 aurel32
case "$target_cpu" in
1274 2408a527 aurel32
  i386)
1275 2408a527 aurel32
    echo "TARGET_ARCH=i386" >> $config_mak
1276 2408a527 aurel32
    echo "#define TARGET_ARCH \"i386\"" >> $config_h
1277 2408a527 aurel32
    echo "#define TARGET_I386 1" >> $config_h
1278 da260249 bellard
    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1279 2408a527 aurel32
    then
1280 2408a527 aurel32
      echo "#define USE_KQEMU 1" >> $config_h
1281 2408a527 aurel32
    fi
1282 f2bf094e aurel32
    gcc3minver=`$cc --version 2> /dev/null| fgrep "(GCC) 3." | awk '{ print $3 }' | cut -f2 -d.`
1283 11d1fdb0 pbrook
    if test -n "$gcc3minver" && test $gcc3minver -gt 3
1284 f2bf094e aurel32
    then
1285 f2bf094e aurel32
      echo "HAVE_GT_GCC_3_3=true" >> $config_mak
1286 f2bf094e aurel32
    else
1287 f2bf094e aurel32
      echo "HAVE_GT_GCC_3_3=false" >> $config_mak
1288 f2bf094e aurel32
    fi
1289 2408a527 aurel32
  ;;
1290 2408a527 aurel32
  x86_64)
1291 2408a527 aurel32
    echo "TARGET_ARCH=x86_64" >> $config_mak
1292 2408a527 aurel32
    echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
1293 2408a527 aurel32
    echo "#define TARGET_I386 1" >> $config_h
1294 2408a527 aurel32
    echo "#define TARGET_X86_64 1" >> $config_h
1295 2408a527 aurel32
    if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"
1296 2408a527 aurel32
    then
1297 2408a527 aurel32
      echo "#define USE_KQEMU 1" >> $config_h
1298 2408a527 aurel32
    fi
1299 2408a527 aurel32
  ;;
1300 2408a527 aurel32
  alpha)
1301 2408a527 aurel32
    echo "TARGET_ARCH=alpha" >> $config_mak
1302 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1303 2408a527 aurel32
    echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1304 2408a527 aurel32
    echo "#define TARGET_ALPHA 1" >> $config_h
1305 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1306 2408a527 aurel32
  ;;
1307 2408a527 aurel32
  arm|armeb)
1308 2408a527 aurel32
    echo "TARGET_ARCH=arm" >> $config_mak
1309 2408a527 aurel32
    echo "#define TARGET_ARCH \"arm\"" >> $config_h
1310 2408a527 aurel32
    echo "#define TARGET_ARM 1" >> $config_h
1311 2408a527 aurel32
    bflt="yes"
1312 bd0c5661 pbrook
    target_nptl="yes"
1313 2408a527 aurel32
  ;;
1314 2408a527 aurel32
  cris)
1315 2408a527 aurel32
    echo "TARGET_ARCH=cris" >> $config_mak
1316 2408a527 aurel32
    echo "#define TARGET_ARCH \"cris\"" >> $config_h
1317 2408a527 aurel32
    echo "#define TARGET_CRIS 1" >> $config_h
1318 2408a527 aurel32
  ;;
1319 2408a527 aurel32
  m68k)
1320 2408a527 aurel32
    echo "TARGET_ARCH=m68k" >> $config_mak
1321 2408a527 aurel32
    echo "#define TARGET_ARCH \"m68k\"" >> $config_h
1322 2408a527 aurel32
    echo "#define TARGET_M68K 1" >> $config_h
1323 2408a527 aurel32
    bflt="yes"
1324 2408a527 aurel32
  ;;
1325 2408a527 aurel32
  mips|mipsel)
1326 2408a527 aurel32
    echo "TARGET_ARCH=mips" >> $config_mak
1327 2408a527 aurel32
    echo "#define TARGET_ARCH \"mips\"" >> $config_h
1328 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1329 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSO32 1" >> $config_h
1330 2408a527 aurel32
  ;;
1331 2408a527 aurel32
  mipsn32|mipsn32el)
1332 2408a527 aurel32
    echo "TARGET_ARCH=mipsn32" >> $config_mak
1333 2408a527 aurel32
    echo "#define TARGET_ARCH \"mipsn32\"" >> $config_h
1334 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1335 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSN32 1" >> $config_h
1336 2408a527 aurel32
  ;;
1337 2408a527 aurel32
  mips64|mips64el)
1338 2408a527 aurel32
    echo "TARGET_ARCH=mips64" >> $config_mak
1339 2408a527 aurel32
    echo "#define TARGET_ARCH \"mips64\"" >> $config_h
1340 2408a527 aurel32
    echo "#define TARGET_MIPS 1" >> $config_h
1341 2408a527 aurel32
    echo "#define TARGET_MIPS64 1" >> $config_h
1342 2408a527 aurel32
    echo "#define TARGET_ABI_MIPSN64 1" >> $config_h
1343 2408a527 aurel32
  ;;
1344 2408a527 aurel32
  ppc)
1345 2408a527 aurel32
    echo "TARGET_ARCH=ppc" >> $config_mak
1346 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1347 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc\"" >> $config_h
1348 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1349 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1350 2408a527 aurel32
  ;;
1351 2408a527 aurel32
  ppcemb)
1352 2408a527 aurel32
    echo "TARGET_ARCH=ppcemb" >> $config_mak
1353 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1354 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1355 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
1356 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1357 2408a527 aurel32
    echo "#define TARGET_PPCEMB 1" >> $config_h
1358 ec5b78cd blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1359 2408a527 aurel32
  ;;
1360 2408a527 aurel32
  ppc64)
1361 2408a527 aurel32
    echo "TARGET_ARCH=ppc64" >> $config_mak
1362 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1363 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1364 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1365 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1366 2408a527 aurel32
    echo "#define TARGET_PPC64 1" >> $config_h
1367 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1368 2408a527 aurel32
  ;;
1369 2408a527 aurel32
  ppc64abi32)
1370 2408a527 aurel32
    echo "TARGET_ARCH=ppc64" >> $config_mak
1371 2408a527 aurel32
    echo "TARGET_ABI_DIR=ppc" >> $config_mak
1372 2408a527 aurel32
    echo "TARGET_ARCH2=ppc64abi32" >> $config_mak
1373 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1374 2408a527 aurel32
    echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
1375 2408a527 aurel32
    echo "#define TARGET_PPC 1" >> $config_h
1376 2408a527 aurel32
    echo "#define TARGET_PPC64 1" >> $config_h
1377 2408a527 aurel32
    echo "#define TARGET_ABI32 1" >> $config_h
1378 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1379 2408a527 aurel32
  ;;
1380 2408a527 aurel32
  sh4|sh4eb)
1381 2408a527 aurel32
    echo "TARGET_ARCH=sh4" >> $config_mak
1382 bf6247fb blueswir1
    echo "CONFIG_DYNGEN_OP=yes" >> $config_mak
1383 2408a527 aurel32
    echo "#define TARGET_ARCH \"sh4\"" >> $config_h
1384 2408a527 aurel32
    echo "#define TARGET_SH4 1" >> $config_h
1385 bf6247fb blueswir1
    echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
1386 2408a527 aurel32
    bflt="yes"
1387 2408a527 aurel32
  ;;
1388 2408a527 aurel32
  sparc)
1389 2408a527 aurel32
    echo "TARGET_ARCH=sparc" >> $config_mak
1390 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc\"" >> $config_h
1391 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1392 2408a527 aurel32
  ;;
1393 2408a527 aurel32
  sparc64)
1394 2408a527 aurel32
    echo "TARGET_ARCH=sparc64" >> $config_mak
1395 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1396 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1397 2408a527 aurel32
    echo "#define TARGET_SPARC64 1" >> $config_h
1398 2408a527 aurel32
    elfload32="yes"
1399 2408a527 aurel32
  ;;
1400 2408a527 aurel32
  sparc32plus)
1401 2408a527 aurel32
    echo "TARGET_ARCH=sparc64" >> $config_mak
1402 2408a527 aurel32
    echo "TARGET_ABI_DIR=sparc" >> $config_mak
1403 2408a527 aurel32
    echo "TARGET_ARCH2=sparc32plus" >> $config_mak
1404 2408a527 aurel32
    echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
1405 2408a527 aurel32
    echo "#define TARGET_SPARC 1" >> $config_h
1406 2408a527 aurel32
    echo "#define TARGET_SPARC64 1" >> $config_h
1407 2408a527 aurel32
    echo "#define TARGET_ABI32 1" >> $config_h
1408 2408a527 aurel32
  ;;
1409 2408a527 aurel32
  *)
1410 2408a527 aurel32
    echo "Unsupported target CPU"
1411 2408a527 aurel32
    exit 1
1412 2408a527 aurel32
  ;;
1413 2408a527 aurel32
esac
1414 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
1415 97a847bc bellard
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1416 97a847bc bellard
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1417 de83cd02 bellard
fi
1418 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
1419 97a847bc bellard
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
1420 97a847bc bellard
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
1421 43ce4dfe bellard
fi
1422 997344f3 bellard
if test "$target_user_only" = "yes" ; then
1423 997344f3 bellard
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
1424 997344f3 bellard
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
1425 997344f3 bellard
fi
1426 831b7825 ths
if test "$target_linux_user" = "yes" ; then
1427 831b7825 ths
  echo "CONFIG_LINUX_USER=yes" >> $config_mak
1428 831b7825 ths
  echo "#define CONFIG_LINUX_USER 1" >> $config_h
1429 831b7825 ths
fi
1430 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
1431 831b7825 ths
  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1432 831b7825 ths
  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1433 831b7825 ths
fi
1434 97a847bc bellard
1435 0938cda5 aurel32
if test "$target_cpu" = "arm" \
1436 0938cda5 aurel32
     -o "$target_cpu" = "armeb" \
1437 0938cda5 aurel32
     -o "$target_cpu" = "m68k" \
1438 0938cda5 aurel32
     -o "$target_cpu" = "mips" \
1439 0938cda5 aurel32
     -o "$target_cpu" = "mipsel" \
1440 0938cda5 aurel32
     -o "$target_cpu" = "mipsn32" \
1441 0938cda5 aurel32
     -o "$target_cpu" = "mipsn32el" \
1442 0938cda5 aurel32
     -o "$target_cpu" = "mips64" \
1443 0938cda5 aurel32
     -o "$target_cpu" = "mips64el" \
1444 0938cda5 aurel32
     -o "$target_cpu" = "sparc" \
1445 0938cda5 aurel32
     -o "$target_cpu" = "sparc64" \
1446 0938cda5 aurel32
     -o "$target_cpu" = "sparc32plus"; then
1447 158142c2 bellard
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1448 158142c2 bellard
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1449 158142c2 bellard
fi
1450 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1451 e5fe0c52 pbrook
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
1452 e5fe0c52 pbrook
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
1453 e5fe0c52 pbrook
fi
1454 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
1455 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
1456 bd0c5661 pbrook
  echo "#define USE_NPTL 1" >> $config_h
1457 bd0c5661 pbrook
fi
1458 cb33da57 blueswir1
# 32 bit ELF loader in addition to native 64 bit loader?
1459 cb33da57 blueswir1
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
1460 cb33da57 blueswir1
  echo "TARGET_HAS_ELFLOAD32=yes" >> $config_mak
1461 cb33da57 blueswir1
  echo "#define TARGET_HAS_ELFLOAD32 1" >> $config_h
1462 cb33da57 blueswir1
fi
1463 5b0753e0 bellard
1464 15d9ca0f ths
test -f ${config_h}~ && cmp -s $config_h ${config_h}~ && mv ${config_h}~ $config_h
1465 15d9ca0f ths
1466 97a847bc bellard
done # for target in $targets
1467 7d13299d bellard
1468 7d13299d bellard
# build tree in object directory if source path is different from current one
1469 7d13299d bellard
if test "$source_path_used" = "yes" ; then
1470 49ecc3fa bellard
    DIRS="tests tests/cris slirp audio"
1471 7d13299d bellard
    FILES="Makefile tests/Makefile"
1472 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
1473 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
1474 7d13299d bellard
    for dir in $DIRS ; do
1475 7d13299d bellard
            mkdir -p $dir
1476 7d13299d bellard
    done
1477 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
1478 7d13299d bellard
    for f in $FILES ; do
1479 ec530c81 bellard
        rm -f $f
1480 ec530c81 bellard
        ln -s $source_path/$f $f
1481 7d13299d bellard
    done
1482 7d13299d bellard
fi
1483 7d13299d bellard
1484 97a847bc bellard
rm -f $TMPO $TMPC $TMPE $TMPS