Statistics
| Branch: | Revision:

root / configure @ 8c5e95d8

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