Statistics
| Branch: | Revision:

root / configure @ c631c88c

History | View | Annotate | Download (30.6 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 328a4240 pbrook
gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
27 7d13299d bellard
host_cc="gcc"
28 7d13299d bellard
ar="ar"
29 7d13299d bellard
make="make"
30 6a882643 pbrook
install="install"
31 7d13299d bellard
strip="strip"
32 7d13299d bellard
cpu=`uname -m`
33 5327cf48 bellard
target_list=""
34 7d13299d bellard
case "$cpu" in
35 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
36 97a847bc bellard
    cpu="i386"
37 7d13299d bellard
  ;;
38 ba68055e bellard
  armv*b)
39 808c4954 bellard
    cpu="armv4b"
40 808c4954 bellard
  ;;
41 ba68055e bellard
  armv*l)
42 7d13299d bellard
    cpu="armv4l"
43 7d13299d bellard
  ;;
44 7d13299d bellard
  alpha)
45 7d13299d bellard
    cpu="alpha"
46 7d13299d bellard
  ;;
47 295defa5 bellard
  "Power Macintosh"|ppc|ppc64)
48 7d13299d bellard
    cpu="powerpc"
49 7d13299d bellard
  ;;
50 7d13299d bellard
  mips)
51 7d13299d bellard
    cpu="mips"
52 7d13299d bellard
  ;;
53 fbe4f65b ths
  mips64)
54 fbe4f65b ths
    cpu="mips64"
55 fbe4f65b ths
  ;;
56 fb3e5849 bellard
  s390)
57 fb3e5849 bellard
    cpu="s390"
58 fb3e5849 bellard
  ;;
59 3142255c blueswir1
  sparc|sun4[cdmuv])
60 ae228531 bellard
    cpu="sparc"
61 ae228531 bellard
  ;;
62 ae228531 bellard
  sparc64)
63 ae228531 bellard
    cpu="sparc64"
64 ae228531 bellard
  ;;
65 a8baa8c5 bellard
  ia64)
66 a8baa8c5 bellard
    cpu="ia64"
67 a8baa8c5 bellard
  ;;
68 38e584a0 bellard
  m68k)
69 38e584a0 bellard
    cpu="m68k"
70 38e584a0 bellard
  ;;
71 bc51c5c9 bellard
  x86_64|amd64)
72 0b0babc6 bellard
    cpu="x86_64"
73 bc51c5c9 bellard
  ;;
74 7d13299d bellard
  *)
75 7d13299d bellard
    cpu="unknown"
76 7d13299d bellard
  ;;
77 7d13299d bellard
esac
78 7d13299d bellard
gprof="no"
79 7d13299d bellard
bigendian="no"
80 67b915a5 bellard
mingw32="no"
81 67b915a5 bellard
EXESUF=""
82 67b915a5 bellard
gdbstub="yes"
83 443f1376 bellard
slirp="yes"
84 fb065187 bellard
adlib="no"
85 fb065187 bellard
oss="no"
86 1d14ffa9 bellard
dsound="no"
87 1d14ffa9 bellard
coreaudio="no"
88 1d14ffa9 bellard
alsa="no"
89 102a52e4 bellard
fmod="no"
90 102a52e4 bellard
fmod_lib=""
91 102a52e4 bellard
fmod_inc=""
92 b1a550a0 pbrook
bsd="no"
93 5327cf48 bellard
linux="no"
94 c9ec1fe4 bellard
kqemu="no"
95 05c2a3e7 bellard
profiler="no"
96 5b0753e0 bellard
cocoa="no"
97 97ccc689 bellard
check_gfx="yes"
98 1aff381f bellard
check_gcc="yes"
99 0a8e90f4 pbrook
softmmu="yes"
100 831b7825 ths
linux_user="no"
101 831b7825 ths
darwin_user="no"
102 cc8ae6de pbrook
build_docs="no"
103 c5937220 pbrook
uname_release=""
104 7d13299d bellard
105 7d13299d bellard
# OS specific
106 7d13299d bellard
targetos=`uname -s`
107 7d13299d bellard
case $targetos in
108 c326e0af bellard
CYGWIN*)
109 c326e0af bellard
mingw32="yes"
110 6f30fa85 ths
OS_CFLAGS="-mno-cygwin"
111 c326e0af bellard
;;
112 67b915a5 bellard
MINGW32*)
113 67b915a5 bellard
mingw32="yes"
114 67b915a5 bellard
;;
115 7d3505c5 bellard
FreeBSD)
116 7d3505c5 bellard
bsd="yes"
117 fb065187 bellard
oss="yes"
118 e99f9060 bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
119 07f4ddbf bellard
    kqemu="yes"
120 07f4ddbf bellard
fi
121 7d3505c5 bellard
;;
122 7d3505c5 bellard
NetBSD)
123 7d3505c5 bellard
bsd="yes"
124 fb065187 bellard
oss="yes"
125 7d3505c5 bellard
;;
126 7d3505c5 bellard
OpenBSD)
127 7d3505c5 bellard
bsd="yes"
128 fb065187 bellard
oss="yes"
129 7d3505c5 bellard
;;
130 83fb7adf bellard
Darwin)
131 83fb7adf bellard
bsd="yes"
132 83fb7adf bellard
darwin="yes"
133 831b7825 ths
darwin_user="yes"
134 fd677642 ths
cocoa="yes"
135 fd677642 ths
coreaudio="yes"
136 6f30fa85 ths
OS_CFLAGS="-mdynamic-no-pic"
137 83fb7adf bellard
;;
138 ec530c81 bellard
SunOS)
139 c2b84fab ths
    solaris="yes"
140 c2b84fab ths
    make="gmake"
141 c2b84fab ths
    install="ginstall"
142 0475a5ca ths
    needs_libsunmath="no"
143 c2b84fab ths
    solarisrev=`uname -r | cut -f2 -d.`
144 c2b84fab ths
    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
145 0475a5ca ths
        if test "$solarisrev" -le 9 ; then
146 0475a5ca ths
            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
147 0475a5ca ths
                needs_libsunmath="yes"
148 0475a5ca ths
            else
149 0475a5ca ths
                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
150 0475a5ca ths
                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
151 0475a5ca ths
                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
152 0475a5ca ths
                echo "Studio 11 can be downloaded from www.sun.com."
153 0475a5ca ths
                exit 1
154 0475a5ca ths
            fi
155 0475a5ca ths
        fi
156 0475a5ca ths
        if test "$solarisrev" -ge 9 ; then
157 c2b84fab ths
            kqemu="yes"
158 c2b84fab ths
        fi
159 86b2bd93 ths
    fi
160 86b2bd93 ths
;;
161 1d14ffa9 bellard
*)
162 fb065187 bellard
oss="yes"
163 5327cf48 bellard
linux="yes"
164 831b7825 ths
linux_user="yes"
165 07f4ddbf bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
166 c9ec1fe4 bellard
    kqemu="yes"
167 c9ec1fe4 bellard
fi
168 fb065187 bellard
;;
169 7d13299d bellard
esac
170 7d13299d bellard
171 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
172 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
173 83fb7adf bellard
    make="gmake"
174 83fb7adf bellard
  fi
175 7d3505c5 bellard
fi
176 7d3505c5 bellard
177 7d13299d bellard
# find source path
178 ad064840 pbrook
source_path=`dirname "$0"`
179 ad064840 pbrook
if [ -z "$source_path" ]; then
180 7d13299d bellard
    source_path=`pwd`
181 ad064840 pbrook
else
182 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
183 ad064840 pbrook
fi
184 ad064840 pbrook
if test "$source_path" = `pwd` ; then
185 7d13299d bellard
    source_path_used="no"
186 ad064840 pbrook
else
187 ad064840 pbrook
    source_path_used="yes"
188 7d13299d bellard
fi
189 7d13299d bellard
190 7d13299d bellard
for opt do
191 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
192 7d13299d bellard
  case "$opt" in
193 2efc3265 bellard
  --help|-h) show_help=yes
194 2efc3265 bellard
  ;;
195 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
196 7d13299d bellard
  ;;
197 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
198 32ce6337 bellard
  ;;
199 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
200 ad064840 pbrook
  source_path_used="yes"
201 7d13299d bellard
  ;;
202 b1a550a0 pbrook
  --cross-prefix=*) cross_prefix="$optarg"
203 7d13299d bellard
  ;;
204 b1a550a0 pbrook
  --cc=*) cc="$optarg"
205 328a4240 pbrook
  gcc3_search="no"
206 7d13299d bellard
  ;;
207 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
208 83469015 bellard
  ;;
209 b1a550a0 pbrook
  --make=*) make="$optarg"
210 7d13299d bellard
  ;;
211 6a882643 pbrook
  --install=*) install="$optarg"
212 6a882643 pbrook
  ;;
213 b1a550a0 pbrook
  --extra-cflags=*) CFLAGS="$optarg"
214 7d13299d bellard
  ;;
215 b1a550a0 pbrook
  --extra-ldflags=*) LDFLAGS="$optarg"
216 7d13299d bellard
  ;;
217 b1a550a0 pbrook
  --cpu=*) cpu="$optarg"
218 7d13299d bellard
  ;;
219 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
220 de83cd02 bellard
  ;;
221 7d13299d bellard
  --enable-gprof) gprof="yes"
222 7d13299d bellard
  ;;
223 43ce4dfe bellard
  --static) static="yes"
224 43ce4dfe bellard
  ;;
225 97a847bc bellard
  --disable-sdl) sdl="no"
226 97a847bc bellard
  ;;
227 1d14ffa9 bellard
  --enable-coreaudio) coreaudio="yes"
228 1d14ffa9 bellard
  ;;
229 1d14ffa9 bellard
  --enable-alsa) alsa="yes"
230 1d14ffa9 bellard
  ;;
231 1d14ffa9 bellard
  --enable-dsound) dsound="yes"
232 1d14ffa9 bellard
  ;;
233 102a52e4 bellard
  --enable-fmod) fmod="yes"
234 102a52e4 bellard
  ;;
235 b1a550a0 pbrook
  --fmod-lib=*) fmod_lib="$optarg"
236 102a52e4 bellard
  ;;
237 b1a550a0 pbrook
  --fmod-inc=*) fmod_inc="$optarg"
238 102a52e4 bellard
  ;;
239 b93aebec bellard
  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-" ; linux_user="no"
240 1d14ffa9 bellard
  ;;
241 443f1376 bellard
  --disable-slirp) slirp="no"
242 1d14ffa9 bellard
  ;;
243 fb065187 bellard
  --enable-adlib) adlib="yes"
244 1d14ffa9 bellard
  ;;
245 c9ec1fe4 bellard
  --disable-kqemu) kqemu="no"
246 1d14ffa9 bellard
  ;;
247 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
248 05c2a3e7 bellard
  ;;
249 1d14ffa9 bellard
  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
250 1d14ffa9 bellard
  ;;
251 97ccc689 bellard
  --disable-gfx-check) check_gfx="no"
252 97ccc689 bellard
  ;;
253 1aff381f bellard
  --disable-gcc-check) check_gcc="no"
254 1aff381f bellard
  ;;
255 cad25d69 pbrook
  --disable-system) softmmu="no"
256 0a8e90f4 pbrook
  ;;
257 cad25d69 pbrook
  --enable-system) softmmu="yes"
258 0a8e90f4 pbrook
  ;;
259 831b7825 ths
  --disable-linux-user) linux_user="no"
260 0a8e90f4 pbrook
  ;;
261 831b7825 ths
  --enable-linux-user) linux_user="yes"
262 831b7825 ths
  ;;
263 831b7825 ths
  --disable-darwin-user) darwin_user="no"
264 831b7825 ths
  ;;
265 831b7825 ths
  --enable-darwin-user) darwin_user="yes"
266 0a8e90f4 pbrook
  ;;
267 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
268 c5937220 pbrook
  ;;
269 3142255c blueswir1
  --sparc_cpu=*)
270 3142255c blueswir1
      sparc_cpu="$optarg"
271 3142255c blueswir1
      case $sparc_cpu in
272 3142255c blueswir1
        v7|v8) SP_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
273 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
274 3142255c blueswir1
        v8plus|v8plusa) SP_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m32"
275 3142255c blueswir1
                 target_cpu="sparc"; cpu="sparc" ;;
276 3142255c blueswir1
        v9)    SP_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"; SP_LDFLAGS="-m64"
277 3142255c blueswir1
                 target_cpu="sparc64"; cpu="sparc64" ;;
278 3142255c blueswir1
        *)     echo "undefined SPARC architecture. Exiting";exit 1;;
279 3142255c blueswir1
      esac
280 3142255c blueswir1
  ;;
281 7d13299d bellard
  esac
282 7d13299d bellard
done
283 7d13299d bellard
284 209afb9e ths
if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
285 209afb9e ths
    AIOLIBS=
286 209afb9e ths
else
287 209afb9e ths
    AIOLIBS="-lrt"
288 209afb9e ths
fi
289 209afb9e ths
290 6f30fa85 ths
# default flags for all hosts
291 6f30fa85 ths
CFLAGS="$CFLAGS -Wall -O2 -g -fno-strict-aliasing"
292 6f30fa85 ths
LDFLAGS="$LDFLAGS -g"
293 6f30fa85 ths
294 3142255c blueswir1
#
295 3142255c blueswir1
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
296 3142255c blueswir1
# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
297 3142255c blueswir1
#
298 3142255c blueswir1
case $cpu in
299 3142255c blueswir1
    sparc) if test -z "$sparc_cpu" ; then
300 3142255c blueswir1
               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
301 3142255c blueswir1
               ARCH_LDFLAGS="-m32"
302 3142255c blueswir1
           else
303 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
304 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
305 3142255c blueswir1
           fi
306 3142255c blueswir1
           ;;
307 3142255c blueswir1
    sparc64) if test -z "$sparc_cpu" ; then
308 3142255c blueswir1
               ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
309 3142255c blueswir1
               ARCH_LDFLAGS="-m64"
310 3142255c blueswir1
           else
311 3142255c blueswir1
               ARCH_CFLAGS="${SP_CFLAGS}"
312 3142255c blueswir1
               ARCH_LDFLAGS="${SP_LDFLAGS}"
313 3142255c blueswir1
           fi
314 3142255c blueswir1
           ;;
315 3142255c blueswir1
esac
316 3142255c blueswir1
317 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
318 af5db58e pbrook
cat << EOF
319 af5db58e pbrook
320 af5db58e pbrook
Usage: configure [options]
321 af5db58e pbrook
Options: [defaults in brackets after descriptions]
322 af5db58e pbrook
323 af5db58e pbrook
EOF
324 af5db58e pbrook
echo "Standard options:"
325 af5db58e pbrook
echo "  --help                   print this message"
326 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
327 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
328 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
329 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
330 af5db58e pbrook
echo ""
331 af5db58e pbrook
echo "kqemu kernel acceleration support:"
332 af5db58e pbrook
echo "  --disable-kqemu          disable kqemu support"
333 af5db58e pbrook
echo ""
334 af5db58e pbrook
echo "Advanced options (experts only):"
335 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
336 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
337 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
338 af5db58e pbrook
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
339 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
340 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
341 af5db58e pbrook
echo "  --static                 enable static build [$static]"
342 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
343 af5db58e pbrook
echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
344 af5db58e pbrook
echo "  --enable-adlib           enable Adlib emulation"
345 af5db58e pbrook
echo "  --enable-coreaudio       enable Coreaudio audio driver"
346 af5db58e pbrook
echo "  --enable-alsa            enable ALSA audio driver"
347 af5db58e pbrook
echo "  --enable-fmod            enable FMOD audio driver"
348 ed5065e1 ths
echo "  --enable-dsound          enable DirectSound audio driver"
349 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
350 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
351 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
352 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
353 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
354 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
355 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
356 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
357 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
358 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
359 af5db58e pbrook
echo ""
360 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
361 af5db58e pbrook
exit 1
362 af5db58e pbrook
fi
363 af5db58e pbrook
364 7d13299d bellard
cc="${cross_prefix}${cc}"
365 7d13299d bellard
ar="${cross_prefix}${ar}"
366 7d13299d bellard
strip="${cross_prefix}${strip}"
367 7d13299d bellard
368 064aae13 pbrook
# check that the C compiler works.
369 064aae13 pbrook
cat > $TMPC <<EOF
370 064aae13 pbrook
int main(void) {}
371 064aae13 pbrook
EOF
372 064aae13 pbrook
373 cf257238 ths
if $cc -c -o $TMPO $TMPC 2> /dev/null ; then
374 064aae13 pbrook
  : C compiler works ok
375 064aae13 pbrook
else
376 064aae13 pbrook
    echo "ERROR: \"$cc\" either does not exist or does not work"
377 064aae13 pbrook
    exit 1
378 a7350fa1 bellard
fi
379 a7350fa1 bellard
380 67b915a5 bellard
if test "$mingw32" = "yes" ; then
381 5327cf48 bellard
    linux="no"
382 67b915a5 bellard
    EXESUF=".exe"
383 9f059eca bellard
    oss="no"
384 07f4ddbf bellard
    if [ "$cpu" = "i386" ] ; then
385 07f4ddbf bellard
        kqemu="yes"
386 07f4ddbf bellard
    fi
387 67b915a5 bellard
fi
388 67b915a5 bellard
389 328a4240 pbrook
# Check for gcc4, error if pre-gcc4 
390 328a4240 pbrook
if test "$check_gcc" = "yes" ; then
391 328a4240 pbrook
    cat > $TMPC <<EOF
392 328a4240 pbrook
#if __GNUC__ < 4
393 328a4240 pbrook
#error gcc3
394 328a4240 pbrook
#endif
395 328a4240 pbrook
int main(){return 0;}
396 328a4240 pbrook
EOF
397 328a4240 pbrook
    check_cc() {
398 cf257238 ths
	which "$1" 2> /dev/null
399 328a4240 pbrook
	return $?
400 328a4240 pbrook
    }
401 328a4240 pbrook
402 cf257238 ths
    if "$cc" -o $TMPE $TMPC 2> /dev/null ; then
403 328a4240 pbrook
	echo "WARNING: \"$cc\" looks like gcc 4.x"
404 328a4240 pbrook
	found_compat_cc="no"
405 328a4240 pbrook
	if test "$gcc3_search" = "yes" ; then
406 328a4240 pbrook
	    echo "Looking for gcc 3.x"
407 328a4240 pbrook
	    for compat_cc in $gcc3_list ; do
408 1124426a pbrook
		if check_cc "$cross_prefix$compat_cc" ; then
409 328a4240 pbrook
		    echo "Found \"$compat_cc\""
410 1124426a pbrook
		    cc="$cross_prefix$compat_cc"
411 328a4240 pbrook
		    found_compat_cc="yes"
412 328a4240 pbrook
		    break
413 328a4240 pbrook
		fi
414 328a4240 pbrook
	    done
415 328a4240 pbrook
	    if test "$found_compat_cc" = "no" ; then
416 328a4240 pbrook
		echo "gcc 3.x not found!"
417 328a4240 pbrook
	    fi
418 328a4240 pbrook
	fi
419 328a4240 pbrook
	if test "$found_compat_cc" = "no" ; then
420 328a4240 pbrook
	    echo "QEMU is known to have problems when compiled with gcc 4.x"
421 328a4240 pbrook
	    echo "It is recommended that you use gcc 3.x to build QEMU"
422 328a4240 pbrook
	    echo "To use this compiler anyway, configure with --disable-gcc-check"
423 328a4240 pbrook
	    exit 1;
424 328a4240 pbrook
	fi
425 328a4240 pbrook
    fi
426 328a4240 pbrook
fi
427 328a4240 pbrook
428 ec530c81 bellard
#
429 ec530c81 bellard
# Solaris specific configure tool chain decisions
430 ec530c81 bellard
#
431 ec530c81 bellard
if test "$solaris" = "yes" ; then
432 ec530c81 bellard
  #
433 ec530c81 bellard
  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
434 ec530c81 bellard
  # override the check with --disable-gcc-check
435 ec530c81 bellard
  # 
436 ec530c81 bellard
  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
437 ec530c81 bellard
    solgcc=`which $cc`
438 ec530c81 bellard
    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
439 ec530c81 bellard
      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
440 ec530c81 bellard
      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
441 ec530c81 bellard
      echo "or get the latest patch from SunSolve for gcc"
442 ec530c81 bellard
      exit 1
443 ec530c81 bellard
    fi
444 ec530c81 bellard
  fi
445 ec530c81 bellard
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
446 ec530c81 bellard
  if test -z "$solinst" ; then
447 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
448 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
449 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
450 ec530c81 bellard
    exit 1
451 ec530c81 bellard
  fi
452 ec530c81 bellard
  if test "$solinst" = "/usr/sbin/install" ; then
453 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
454 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
455 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
456 ec530c81 bellard
    exit 1
457 ec530c81 bellard
  fi
458 ec530c81 bellard
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
459 ec530c81 bellard
  if test -z "$sol_ar" ; then
460 ec530c81 bellard
    echo "Error: No path includes ar"
461 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
462 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
463 ec530c81 bellard
    fi
464 ec530c81 bellard
    exit 1
465 ec530c81 bellard
  fi
466 ec530c81 bellard
fi 
467 ec530c81 bellard
468 ec530c81 bellard
469 5327cf48 bellard
if test -z "$target_list" ; then
470 5327cf48 bellard
# these targets are portable
471 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
472 d4082e95 j_mayer
        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu arm-softmmu ppc64-softmmu ppcemb-softmmu "
473 0a8e90f4 pbrook
    fi
474 5327cf48 bellard
# the following are Linux specific
475 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
476 cf6c1b16 j_mayer
        target_list="i386-linux-user arm-linux-user armeb-linux-user sparc-linux-user ppc-linux-user mips-linux-user mipsel-linux-user m68k-linux-user alpha-linux-user $target_list"
477 831b7825 ths
    fi
478 831b7825 ths
# the following are Darwin specific
479 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
480 831b7825 ths
        target_list="i386-darwin-user ppc-darwin-user $target_list"
481 5327cf48 bellard
    fi
482 6e20a45f bellard
else
483 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
484 5327cf48 bellard
fi
485 0a8e90f4 pbrook
if test -z "$target_list" ; then
486 0a8e90f4 pbrook
    echo "No targets enabled"
487 0a8e90f4 pbrook
    exit 1
488 0a8e90f4 pbrook
fi
489 5327cf48 bellard
490 7d13299d bellard
if test -z "$cross_prefix" ; then
491 7d13299d bellard
492 7d13299d bellard
# ---
493 7d13299d bellard
# big/little endian test
494 7d13299d bellard
cat > $TMPC << EOF
495 7d13299d bellard
#include <inttypes.h>
496 7d13299d bellard
int main(int argc, char ** argv){
497 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
498 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
499 7d13299d bellard
}
500 7d13299d bellard
EOF
501 7d13299d bellard
502 cf257238 ths
if $cc -o $TMPE $TMPC 2> /dev/null ; then
503 7d13299d bellard
$TMPE && bigendian="yes"
504 7d13299d bellard
else
505 7d13299d bellard
echo big/little test failed
506 7d13299d bellard
fi
507 7d13299d bellard
508 7d13299d bellard
else
509 7d13299d bellard
510 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
511 fbe4f65b ths
if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "mips64" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
512 7d13299d bellard
    bigendian="yes"
513 7d13299d bellard
fi
514 7d13299d bellard
515 7d13299d bellard
fi
516 7d13299d bellard
517 b6853697 bellard
# host long bits test
518 b6853697 bellard
hostlongbits="32"
519 b6853697 bellard
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
520 b6853697 bellard
    hostlongbits="64"
521 b6853697 bellard
fi
522 b6853697 bellard
523 e8cd23de bellard
# check gcc options support
524 04369ff2 bellard
cat > $TMPC <<EOF
525 04369ff2 bellard
int main(void) {
526 04369ff2 bellard
}
527 04369ff2 bellard
EOF
528 04369ff2 bellard
529 11d9f695 bellard
##########################################
530 11d9f695 bellard
# SDL probe
531 11d9f695 bellard
532 11d9f695 bellard
sdl_too_old=no
533 11d9f695 bellard
534 11d9f695 bellard
if test -z "$sdl" ; then
535 11d9f695 bellard
536 a6e022ad bellard
sdl_config="sdl-config"
537 a6e022ad bellard
sdl=no
538 7c1f25b4 bellard
sdl_static=no
539 a6e022ad bellard
540 a6e022ad bellard
if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
541 a6e022ad bellard
# win32 cross compilation case
542 a6e022ad bellard
    sdl_config="i386-mingw32msvc-sdl-config"
543 a6e022ad bellard
    sdl=yes
544 a6e022ad bellard
else
545 a6e022ad bellard
# normal SDL probe
546 11d9f695 bellard
cat > $TMPC << EOF
547 11d9f695 bellard
#include <SDL.h>
548 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
549 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
550 11d9f695 bellard
EOF
551 11d9f695 bellard
552 a6e022ad bellard
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
553 a6e022ad bellard
_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
554 11d9f695 bellard
if test "$_sdlversion" -lt 121 ; then
555 11d9f695 bellard
sdl_too_old=yes
556 11d9f695 bellard
else
557 fd677642 ths
 if test "$cocoa" = "no" ; then
558 fd677642 ths
   sdl=yes
559 fd677642 ths
 fi
560 11d9f695 bellard
fi
561 7c1f25b4 bellard
562 7c1f25b4 bellard
# static link with sdl ?
563 7c1f25b4 bellard
if test "$sdl" = "yes" ; then
564 7c1f25b4 bellard
aa="no"
565 7c1f25b4 bellard
`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
566 7c1f25b4 bellard
sdl_static_libs=`$sdl_config --static-libs`
567 7c1f25b4 bellard
if [ "$aa" = "yes" ] ; then
568 d8d8aa4e bellard
  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
569 7c1f25b4 bellard
fi
570 7c1f25b4 bellard
571 7c1f25b4 bellard
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
572 7c1f25b4 bellard
  sdl_static=yes
573 11d9f695 bellard
fi
574 11d9f695 bellard
575 7c1f25b4 bellard
fi # static link
576 7c1f25b4 bellard
577 7c1f25b4 bellard
fi # sdl compile test
578 7c1f25b4 bellard
579 a6e022ad bellard
fi # cross compilation
580 fd677642 ths
581 fd677642 ths
else
582 fd677642 ths
 # Make sure to disable cocoa if sdl was set
583 fd677642 ths
 if test "$sdl" = "yes" ; then
584 fd677642 ths
   cocoa="no"
585 fd677642 ths
   coreaudio="no"
586 fd677642 ths
 fi
587 a6e022ad bellard
fi # -z $sdl
588 11d9f695 bellard
589 8f28f3fb ths
##########################################
590 8f28f3fb ths
# alsa sound support libraries
591 8f28f3fb ths
592 8f28f3fb ths
if test "$alsa" = "yes" ; then
593 8f28f3fb ths
  cat > $TMPC << EOF
594 8f28f3fb ths
#include <alsa/asoundlib.h>
595 8f28f3fb ths
int main(void) { snd_pcm_t **handle; return snd_pcm_close(*handle); }
596 8f28f3fb ths
EOF
597 8f28f3fb ths
  if $cc -o $TMPE $TMPC -lasound 2> /dev/null ; then
598 8f28f3fb ths
    :
599 8f28f3fb ths
  else
600 8f28f3fb ths
    echo
601 8f28f3fb ths
    echo "Error: Could not find alsa"
602 8f28f3fb ths
    echo "Make sure to have the alsa libs and headers installed."
603 8f28f3fb ths
    echo
604 8f28f3fb ths
    exit 1
605 8f28f3fb ths
  fi
606 8f28f3fb ths
fi
607 8f28f3fb ths
608 cc8ae6de pbrook
# Check if tools are available to build documentation.
609 94ac5158 pbrook
if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
610 cc8ae6de pbrook
  build_docs="yes"
611 cc8ae6de pbrook
fi
612 cc8ae6de pbrook
613 11d9f695 bellard
if test "$mingw32" = "yes" ; then
614 308c3593 pbrook
  if test -z "$prefix" ; then
615 308c3593 pbrook
      prefix="/c/Program Files/Qemu"
616 308c3593 pbrook
  fi
617 308c3593 pbrook
  mansuffix=""
618 308c3593 pbrook
  datasuffix=""
619 308c3593 pbrook
  docsuffix=""
620 308c3593 pbrook
  binsuffix=""
621 11d9f695 bellard
else
622 308c3593 pbrook
  if test -z "$prefix" ; then
623 308c3593 pbrook
      prefix="/usr/local"
624 308c3593 pbrook
  fi
625 308c3593 pbrook
  mansuffix="/share/man"
626 308c3593 pbrook
  datasuffix="/share/qemu"
627 308c3593 pbrook
  docsuffix="/share/doc/qemu"
628 308c3593 pbrook
  binsuffix="/bin"
629 11d9f695 bellard
fi
630 5a67135a bellard
631 43ce4dfe bellard
echo "Install prefix    $prefix"
632 308c3593 pbrook
echo "BIOS directory    $prefix$datasuffix"
633 308c3593 pbrook
echo "binary directory  $prefix$binsuffix"
634 11d9f695 bellard
if test "$mingw32" = "no" ; then
635 308c3593 pbrook
echo "Manual directory  $prefix$mansuffix"
636 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
637 11d9f695 bellard
fi
638 5a67135a bellard
echo "Source path       $source_path"
639 43ce4dfe bellard
echo "C compiler        $cc"
640 83469015 bellard
echo "Host C compiler   $host_cc"
641 43ce4dfe bellard
echo "make              $make"
642 6a882643 pbrook
echo "install           $install"
643 43ce4dfe bellard
echo "host CPU          $cpu"
644 de83cd02 bellard
echo "host big endian   $bigendian"
645 97a847bc bellard
echo "target list       $target_list"
646 43ce4dfe bellard
echo "gprof enabled     $gprof"
647 05c2a3e7 bellard
echo "profiler          $profiler"
648 43ce4dfe bellard
echo "static build      $static"
649 5b0753e0 bellard
if test "$darwin" = "yes" ; then
650 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
651 5b0753e0 bellard
fi
652 97a847bc bellard
echo "SDL support       $sdl"
653 e4afee97 bellard
if test "$sdl" != "no" ; then
654 e4afee97 bellard
    echo "SDL static link   $sdl_static"
655 e4afee97 bellard
fi
656 67b915a5 bellard
echo "mingw32 support   $mingw32"
657 fb065187 bellard
echo "Adlib support     $adlib"
658 1d14ffa9 bellard
echo "CoreAudio support $coreaudio"
659 1d14ffa9 bellard
echo "ALSA support      $alsa"
660 1d14ffa9 bellard
echo "DSound support    $dsound"
661 1d14ffa9 bellard
if test "$fmod" = "yes"; then
662 1d14ffa9 bellard
    if test -z $fmod_lib || test -z $fmod_inc; then
663 1d14ffa9 bellard
        echo
664 1d14ffa9 bellard
        echo "Error: You must specify path to FMOD library and headers"
665 1d14ffa9 bellard
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
666 1d14ffa9 bellard
        echo
667 1d14ffa9 bellard
        exit 1
668 1d14ffa9 bellard
    fi
669 b1a550a0 pbrook
    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
670 b1a550a0 pbrook
else
671 b1a550a0 pbrook
    fmod_support=""
672 102a52e4 bellard
fi
673 b1a550a0 pbrook
echo "FMOD support      $fmod $fmod_support"
674 3142255c blueswir1
if test -n "$sparc_cpu"; then
675 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
676 3142255c blueswir1
fi
677 07f4ddbf bellard
echo "kqemu support     $kqemu"
678 cc8ae6de pbrook
echo "Documentation     $build_docs"
679 c5937220 pbrook
[ ! -z "$uname_release" ] && \
680 c5937220 pbrook
echo "uname -r          $uname_release"
681 67b915a5 bellard
682 97a847bc bellard
if test $sdl_too_old = "yes"; then
683 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
684 7c1f25b4 bellard
fi
685 24b55b96 bellard
#if test "$sdl_static" = "no"; then
686 24b55b96 bellard
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
687 24b55b96 bellard
#fi
688 97a847bc bellard
config_mak="config-host.mak"
689 97a847bc bellard
config_h="config-host.h"
690 7d13299d bellard
691 7c1f25b4 bellard
#echo "Creating $config_mak and $config_h"
692 7d13299d bellard
693 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
694 29517134 pbrook
echo "# Configured with: $0 $@" >> $config_mak
695 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
696 7d13299d bellard
697 97a847bc bellard
echo "prefix=$prefix" >> $config_mak
698 308c3593 pbrook
echo "bindir=\${prefix}$binsuffix" >> $config_mak
699 308c3593 pbrook
echo "mandir=\${prefix}$mansuffix" >> $config_mak
700 308c3593 pbrook
echo "datadir=\${prefix}$datasuffix" >> $config_mak
701 4ad5b06d ths
echo "docdir=\${prefix}$docsuffix" >> $config_mak
702 308c3593 pbrook
echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_h
703 97a847bc bellard
echo "MAKE=$make" >> $config_mak
704 6a882643 pbrook
echo "INSTALL=$install" >> $config_mak
705 97a847bc bellard
echo "CC=$cc" >> $config_mak
706 97a847bc bellard
echo "HOST_CC=$host_cc" >> $config_mak
707 97a847bc bellard
echo "AR=$ar" >> $config_mak
708 97a847bc bellard
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
709 6f30fa85 ths
echo "OS_CFLAGS=$OS_CFLAGS" >> $config_mak
710 3142255c blueswir1
echo "OS_LDFLAGS=$OS_LDFLAGS" >> $config_mak
711 3142255c blueswir1
echo "ARCH_CFLAGS=$ARCH_CFLAGS" >> $config_mak
712 3142255c blueswir1
echo "ARCH_LDFLAGS=$ARCH_LDFLAGS" >> $config_mak
713 97a847bc bellard
echo "CFLAGS=$CFLAGS" >> $config_mak
714 97a847bc bellard
echo "LDFLAGS=$LDFLAGS" >> $config_mak
715 67b915a5 bellard
echo "EXESUF=$EXESUF" >> $config_mak
716 70956b77 ths
echo "AIOLIBS=$AIOLIBS" >> $config_mak
717 97a847bc bellard
if test "$cpu" = "i386" ; then
718 97a847bc bellard
  echo "ARCH=i386" >> $config_mak
719 97a847bc bellard
  echo "#define HOST_I386 1" >> $config_h
720 0b0babc6 bellard
elif test "$cpu" = "x86_64" ; then
721 0b0babc6 bellard
  echo "ARCH=x86_64" >> $config_mak
722 0b0babc6 bellard
  echo "#define HOST_X86_64 1" >> $config_h
723 808c4954 bellard
elif test "$cpu" = "armv4b" ; then
724 808c4954 bellard
  echo "ARCH=arm" >> $config_mak
725 808c4954 bellard
  echo "#define HOST_ARM 1" >> $config_h
726 7d13299d bellard
elif test "$cpu" = "armv4l" ; then
727 97a847bc bellard
  echo "ARCH=arm" >> $config_mak
728 97a847bc bellard
  echo "#define HOST_ARM 1" >> $config_h
729 7d13299d bellard
elif test "$cpu" = "powerpc" ; then
730 97a847bc bellard
  echo "ARCH=ppc" >> $config_mak
731 97a847bc bellard
  echo "#define HOST_PPC 1" >> $config_h
732 7d13299d bellard
elif test "$cpu" = "mips" ; then
733 97a847bc bellard
  echo "ARCH=mips" >> $config_mak
734 97a847bc bellard
  echo "#define HOST_MIPS 1" >> $config_h
735 fbe4f65b ths
elif test "$cpu" = "mips64" ; then
736 fbe4f65b ths
  echo "ARCH=mips64" >> $config_mak
737 fbe4f65b ths
  echo "#define HOST_MIPS64 1" >> $config_h
738 fb3e5849 bellard
elif test "$cpu" = "s390" ; then
739 97a847bc bellard
  echo "ARCH=s390" >> $config_mak
740 97a847bc bellard
  echo "#define HOST_S390 1" >> $config_h
741 295defa5 bellard
elif test "$cpu" = "alpha" ; then
742 97a847bc bellard
  echo "ARCH=alpha" >> $config_mak
743 97a847bc bellard
  echo "#define HOST_ALPHA 1" >> $config_h
744 ae228531 bellard
elif test "$cpu" = "sparc" ; then
745 97a847bc bellard
  echo "ARCH=sparc" >> $config_mak
746 97a847bc bellard
  echo "#define HOST_SPARC 1" >> $config_h
747 ae228531 bellard
elif test "$cpu" = "sparc64" ; then
748 97a847bc bellard
  echo "ARCH=sparc64" >> $config_mak
749 97a847bc bellard
  echo "#define HOST_SPARC64 1" >> $config_h
750 a8baa8c5 bellard
elif test "$cpu" = "ia64" ; then
751 97a847bc bellard
  echo "ARCH=ia64" >> $config_mak
752 97a847bc bellard
  echo "#define HOST_IA64 1" >> $config_h
753 38e584a0 bellard
elif test "$cpu" = "m68k" ; then
754 38ca2abc bellard
  echo "ARCH=m68k" >> $config_mak
755 38ca2abc bellard
  echo "#define HOST_M68K 1" >> $config_h
756 7d13299d bellard
else
757 3142255c blueswir1
  echo "Unsupported CPU = $cpu"
758 7d13299d bellard
  exit 1
759 7d13299d bellard
fi
760 7d13299d bellard
if test "$bigendian" = "yes" ; then
761 97a847bc bellard
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
762 97a847bc bellard
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
763 97a847bc bellard
fi
764 b6853697 bellard
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
765 67b915a5 bellard
if test "$mingw32" = "yes" ; then
766 67b915a5 bellard
  echo "CONFIG_WIN32=yes" >> $config_mak
767 11d9f695 bellard
  echo "#define CONFIG_WIN32 1" >> $config_h
768 210fa556 pbrook
else
769 210fa556 pbrook
  cat > $TMPC << EOF
770 210fa556 pbrook
#include <byteswap.h>
771 210fa556 pbrook
int main(void) { return bswap_32(0); }
772 210fa556 pbrook
EOF
773 210fa556 pbrook
  if $cc -o $TMPE $TMPC 2> /dev/null ; then
774 210fa556 pbrook
    echo "#define HAVE_BYTESWAP_H 1" >> $config_h
775 210fa556 pbrook
  fi
776 67b915a5 bellard
fi
777 83fb7adf bellard
if test "$darwin" = "yes" ; then
778 83fb7adf bellard
  echo "CONFIG_DARWIN=yes" >> $config_mak
779 83fb7adf bellard
  echo "#define CONFIG_DARWIN 1" >> $config_h
780 83fb7adf bellard
fi
781 ec530c81 bellard
if test "$solaris" = "yes" ; then
782 ec530c81 bellard
  echo "CONFIG_SOLARIS=yes" >> $config_mak
783 38cfa06c bellard
  echo "#define HOST_SOLARIS $solarisrev" >> $config_h
784 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
785 0475a5ca ths
    echo "NEEDS_LIBSUNMATH=yes" >> $config_mak
786 0475a5ca ths
    echo "#define NEEDS_LIBSUNMATH 1" >> $config_h
787 0475a5ca ths
  fi
788 ec530c81 bellard
fi
789 3142255c blueswir1
if test -n "$sparc_cpu"; then
790 3142255c blueswir1
  echo "CONFIG__sparc_${sparc_cpu}__=yes" >> $config_mak
791 3142255c blueswir1
  echo "#define __sparc_${sparc_cpu}__ 1" >> $config_h
792 3142255c blueswir1
fi
793 67b915a5 bellard
if test "$gdbstub" = "yes" ; then
794 67b915a5 bellard
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
795 67b915a5 bellard
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
796 67b915a5 bellard
fi
797 97a847bc bellard
if test "$gprof" = "yes" ; then
798 97a847bc bellard
  echo "TARGET_GPROF=yes" >> $config_mak
799 97a847bc bellard
  echo "#define HAVE_GPROF 1" >> $config_h
800 97a847bc bellard
fi
801 97a847bc bellard
if test "$static" = "yes" ; then
802 97a847bc bellard
  echo "CONFIG_STATIC=yes" >> $config_mak
803 50863472 bellard
  echo "#define CONFIG_STATIC 1" >> $config_h
804 7d13299d bellard
fi
805 05c2a3e7 bellard
if test $profiler = "yes" ; then
806 05c2a3e7 bellard
  echo "#define CONFIG_PROFILER 1" >> $config_h
807 05c2a3e7 bellard
fi
808 c20709aa bellard
if test "$slirp" = "yes" ; then
809 c20709aa bellard
  echo "CONFIG_SLIRP=yes" >> $config_mak
810 c20709aa bellard
  echo "#define CONFIG_SLIRP 1" >> $config_h
811 c20709aa bellard
fi
812 fb065187 bellard
if test "$adlib" = "yes" ; then
813 fb065187 bellard
  echo "CONFIG_ADLIB=yes" >> $config_mak
814 fb065187 bellard
  echo "#define CONFIG_ADLIB 1" >> $config_h
815 fb065187 bellard
fi
816 fb065187 bellard
if test "$oss" = "yes" ; then
817 fb065187 bellard
  echo "CONFIG_OSS=yes" >> $config_mak
818 fb065187 bellard
  echo "#define CONFIG_OSS 1" >> $config_h
819 fb065187 bellard
fi
820 1d14ffa9 bellard
if test "$coreaudio" = "yes" ; then
821 1d14ffa9 bellard
  echo "CONFIG_COREAUDIO=yes" >> $config_mak
822 1d14ffa9 bellard
  echo "#define CONFIG_COREAUDIO 1" >> $config_h
823 1d14ffa9 bellard
fi
824 1d14ffa9 bellard
if test "$alsa" = "yes" ; then
825 1d14ffa9 bellard
  echo "CONFIG_ALSA=yes" >> $config_mak
826 1d14ffa9 bellard
  echo "#define CONFIG_ALSA 1" >> $config_h
827 1d14ffa9 bellard
fi
828 1d14ffa9 bellard
if test "$dsound" = "yes" ; then
829 1d14ffa9 bellard
  echo "CONFIG_DSOUND=yes" >> $config_mak
830 1d14ffa9 bellard
  echo "#define CONFIG_DSOUND 1" >> $config_h
831 1d14ffa9 bellard
fi
832 102a52e4 bellard
if test "$fmod" = "yes" ; then
833 102a52e4 bellard
  echo "CONFIG_FMOD=yes" >> $config_mak
834 102a52e4 bellard
  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
835 102a52e4 bellard
  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
836 102a52e4 bellard
  echo "#define CONFIG_FMOD 1" >> $config_h
837 102a52e4 bellard
fi
838 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
839 b1a550a0 pbrook
echo "VERSION=$qemu_version" >>$config_mak
840 d4b8f039 pbrook
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
841 97a847bc bellard
842 97a847bc bellard
echo "SRC_PATH=$source_path" >> $config_mak
843 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
844 ad064840 pbrook
  echo "VPATH=$source_path" >> $config_mak
845 ad064840 pbrook
fi
846 97a847bc bellard
echo "TARGET_DIRS=$target_list" >> $config_mak
847 cc8ae6de pbrook
if [ "$build_docs" = "yes" ] ; then
848 cc8ae6de pbrook
  echo "BUILD_DOCS=yes" >> $config_mak
849 cc8ae6de pbrook
fi
850 97a847bc bellard
851 83fb7adf bellard
# XXX: suppress that
852 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
853 43003046 bellard
  echo "#define O_LARGEFILE 0" >> $config_h
854 43003046 bellard
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
855 7d3505c5 bellard
  echo "#define _BSD 1" >> $config_h
856 7d3505c5 bellard
fi
857 7d3505c5 bellard
858 c5937220 pbrook
echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
859 c5937220 pbrook
860 1d14ffa9 bellard
for target in $target_list; do
861 97a847bc bellard
target_dir="$target"
862 97a847bc bellard
config_mak=$target_dir/config.mak
863 97a847bc bellard
config_h=$target_dir/config.h
864 97a847bc bellard
target_cpu=`echo $target | cut -d '-' -f 1`
865 97a847bc bellard
target_bigendian="no"
866 808c4954 bellard
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
867 1e43adfc bellard
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
868 64b3ab24 bellard
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
869 67867308 bellard
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
870 a2458627 bellard
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
871 d4082e95 j_mayer
[ "$target_cpu" = "ppcemb" ] && target_bigendian=yes
872 d3258560 bellard
[ "$target_cpu" = "mips" ] && target_bigendian=yes
873 fbe4f65b ths
[ "$target_cpu" = "mips64" ] && target_bigendian=yes
874 908f52b0 pbrook
[ "$target_cpu" = "sh4eb" ] && target_bigendian=yes
875 e6e5906b pbrook
[ "$target_cpu" = "m68k" ] && target_bigendian=yes
876 97a847bc bellard
target_softmmu="no"
877 97a847bc bellard
if expr $target : '.*-softmmu' > /dev/null ; then
878 97a847bc bellard
  target_softmmu="yes"
879 97a847bc bellard
fi
880 997344f3 bellard
target_user_only="no"
881 997344f3 bellard
if expr $target : '.*-user' > /dev/null ; then
882 997344f3 bellard
  target_user_only="yes"
883 997344f3 bellard
fi
884 97a847bc bellard
885 831b7825 ths
target_linux_user="no"
886 831b7825 ths
if expr $target : '.*-linux-user' > /dev/null ; then
887 831b7825 ths
  target_linux_user="yes"
888 831b7825 ths
fi
889 831b7825 ths
890 831b7825 ths
target_darwin_user="no"
891 831b7825 ths
if expr $target : '.*-darwin-user' > /dev/null ; then
892 831b7825 ths
  target_darwin_user="yes"
893 831b7825 ths
fi
894 831b7825 ths
895 97ccc689 bellard
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
896 1d14ffa9 bellard
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
897 97ccc689 bellard
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
898 9c038506 pbrook
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
899 97ccc689 bellard
    echo "Note that this will disable all output from the virtual graphics card."
900 97ccc689 bellard
    exit 1;
901 97ccc689 bellard
fi
902 97ccc689 bellard
903 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
904 97a847bc bellard
905 97a847bc bellard
mkdir -p $target_dir
906 158142c2 bellard
mkdir -p $target_dir/fpu
907 831b7825 ths
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" ; then
908 69de927c bellard
  mkdir -p $target_dir/nwfpe
909 69de927c bellard
fi
910 a7e61ed4 bellard
if test "$target_user_only" = "no" ; then
911 a7e61ed4 bellard
  mkdir -p $target_dir/slirp
912 a7e61ed4 bellard
fi
913 69de927c bellard
914 ec530c81 bellard
#
915 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
916 ec530c81 bellard
#
917 ec530c81 bellard
rm -f $target_dir/Makefile
918 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
919 ec530c81 bellard
920 97a847bc bellard
921 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
922 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
923 97a847bc bellard
924 de83cd02 bellard
925 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
926 97a847bc bellard
echo "#include \"../config-host.h\"" >> $config_h
927 1e43adfc bellard
928 e5fe0c52 pbrook
bflt="no"
929 1e43adfc bellard
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
930 1e43adfc bellard
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
931 97a847bc bellard
932 97a847bc bellard
if test "$target_cpu" = "i386" ; then
933 97a847bc bellard
  echo "TARGET_ARCH=i386" >> $config_mak
934 97a847bc bellard
  echo "#define TARGET_ARCH \"i386\"" >> $config_h
935 97a847bc bellard
  echo "#define TARGET_I386 1" >> $config_h
936 07f4ddbf bellard
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
937 824d560f bellard
    echo "#define USE_KQEMU 1" >> $config_h
938 824d560f bellard
  fi
939 808c4954 bellard
elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
940 97a847bc bellard
  echo "TARGET_ARCH=arm" >> $config_mak
941 97a847bc bellard
  echo "#define TARGET_ARCH \"arm\"" >> $config_h
942 97a847bc bellard
  echo "#define TARGET_ARM 1" >> $config_h
943 e5fe0c52 pbrook
  bflt="yes"
944 1e43adfc bellard
elif test "$target_cpu" = "sparc" ; then
945 1e43adfc bellard
  echo "TARGET_ARCH=sparc" >> $config_mak
946 1e43adfc bellard
  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
947 1e43adfc bellard
  echo "#define TARGET_SPARC 1" >> $config_h
948 64b3ab24 bellard
elif test "$target_cpu" = "sparc64" ; then
949 64b3ab24 bellard
  echo "TARGET_ARCH=sparc64" >> $config_mak
950 64b3ab24 bellard
  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
951 64b3ab24 bellard
  echo "#define TARGET_SPARC 1" >> $config_h
952 64b3ab24 bellard
  echo "#define TARGET_SPARC64 1" >> $config_h
953 67867308 bellard
elif test "$target_cpu" = "ppc" ; then
954 67867308 bellard
  echo "TARGET_ARCH=ppc" >> $config_mak
955 67867308 bellard
  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
956 67867308 bellard
  echo "#define TARGET_PPC 1" >> $config_h
957 a2458627 bellard
elif test "$target_cpu" = "ppc64" ; then
958 a2458627 bellard
  echo "TARGET_ARCH=ppc64" >> $config_mak
959 a2458627 bellard
  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
960 a2458627 bellard
  echo "#define TARGET_PPC 1" >> $config_h
961 a2458627 bellard
  echo "#define TARGET_PPC64 1" >> $config_h
962 d4082e95 j_mayer
elif test "$target_cpu" = "ppcemb" ; then
963 d4082e95 j_mayer
  echo "TARGET_ARCH=ppcemb" >> $config_mak
964 d4082e95 j_mayer
  echo "#define TARGET_ARCH \"ppcemb\"" >> $config_h
965 d4082e95 j_mayer
  echo "#define TARGET_PPC 1" >> $config_h
966 d4082e95 j_mayer
  echo "#define TARGET_PPCEMB 1" >> $config_h
967 0b0babc6 bellard
elif test "$target_cpu" = "x86_64" ; then
968 0b0babc6 bellard
  echo "TARGET_ARCH=x86_64" >> $config_mak
969 0b0babc6 bellard
  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
970 0b0babc6 bellard
  echo "#define TARGET_I386 1" >> $config_h
971 0b0babc6 bellard
  echo "#define TARGET_X86_64 1" >> $config_h
972 07f4ddbf bellard
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
973 07f4ddbf bellard
    echo "#define USE_KQEMU 1" >> $config_h
974 07f4ddbf bellard
  fi
975 c20eb473 bellard
elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
976 d3258560 bellard
  echo "TARGET_ARCH=mips" >> $config_mak
977 d3258560 bellard
  echo "#define TARGET_ARCH \"mips\"" >> $config_h
978 d3258560 bellard
  echo "#define TARGET_MIPS 1" >> $config_h
979 6ea83fed bellard
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
980 6ea83fed bellard
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
981 fbe4f65b ths
elif test "$target_cpu" = "mips64" -o "$target_cpu" = "mips64el" ; then
982 fbe4f65b ths
  echo "TARGET_ARCH=mips64" >> $config_mak
983 fbe4f65b ths
  echo "#define TARGET_ARCH \"mips64\"" >> $config_h
984 fbe4f65b ths
  echo "#define TARGET_MIPS 1" >> $config_h
985 fbe4f65b ths
  echo "#define TARGET_MIPS64 1" >> $config_h
986 fbe4f65b ths
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
987 fbe4f65b ths
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
988 908f52b0 pbrook
elif test "$target_cpu" = "sh4" -o "$target_cpu" = "sh4eb" ; then
989 fdf9b3e8 bellard
  echo "TARGET_ARCH=sh4" >> $config_mak
990 fdf9b3e8 bellard
  echo "#define TARGET_ARCH \"sh4\"" >> $config_h
991 fdf9b3e8 bellard
  echo "#define TARGET_SH4 1" >> $config_h
992 4dbed897 pbrook
  bflt="yes"
993 e6e5906b pbrook
elif test "$target_cpu" = "m68k" ; then
994 e6e5906b pbrook
  echo "TARGET_ARCH=m68k" >> $config_mak
995 e6e5906b pbrook
  echo "#define TARGET_ARCH \"m68k\"" >> $config_h
996 e6e5906b pbrook
  echo "#define TARGET_M68K 1" >> $config_h
997 e6e5906b pbrook
  bflt="yes"
998 cf6c1b16 j_mayer
elif test "$target_cpu" = "alpha" ; then
999 cf6c1b16 j_mayer
  echo "TARGET_ARCH=alpha" >> $config_mak
1000 cf6c1b16 j_mayer
  echo "#define TARGET_ARCH \"alpha\"" >> $config_h
1001 cf6c1b16 j_mayer
  echo "#define TARGET_ALPHA 1" >> $config_h
1002 de83cd02 bellard
else
1003 de83cd02 bellard
  echo "Unsupported target CPU"
1004 de83cd02 bellard
  exit 1
1005 de83cd02 bellard
fi
1006 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
1007 97a847bc bellard
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
1008 97a847bc bellard
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
1009 de83cd02 bellard
fi
1010 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
1011 97a847bc bellard
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
1012 97a847bc bellard
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
1013 43ce4dfe bellard
fi
1014 997344f3 bellard
if test "$target_user_only" = "yes" ; then
1015 997344f3 bellard
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
1016 997344f3 bellard
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
1017 997344f3 bellard
fi
1018 831b7825 ths
if test "$target_linux_user" = "yes" ; then
1019 831b7825 ths
  echo "CONFIG_LINUX_USER=yes" >> $config_mak
1020 831b7825 ths
  echo "#define CONFIG_LINUX_USER 1" >> $config_h
1021 831b7825 ths
fi
1022 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
1023 831b7825 ths
  echo "CONFIG_DARWIN_USER=yes" >> $config_mak
1024 831b7825 ths
  echo "#define CONFIG_DARWIN_USER 1" >> $config_h
1025 831b7825 ths
fi
1026 97a847bc bellard
1027 e6e5906b pbrook
if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" -o "$target_cpu" = "sparc" -o "$target_cpu" = "sparc64" -o "$target_cpu" = "m68k"; then
1028 158142c2 bellard
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
1029 158142c2 bellard
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
1030 158142c2 bellard
fi
1031 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
1032 e5fe0c52 pbrook
  echo "TARGET_HAS_BFLT=yes" >> $config_mak
1033 e5fe0c52 pbrook
  echo "#define TARGET_HAS_BFLT 1" >> $config_h
1034 e5fe0c52 pbrook
fi
1035 7c1f25b4 bellard
# sdl defines
1036 7c1f25b4 bellard
1037 7c1f25b4 bellard
if test "$target_user_only" = "no"; then
1038 7c1f25b4 bellard
    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1039 dbb2c921 bellard
        sdl1=$sdl_static
1040 7c1f25b4 bellard
    else
1041 dbb2c921 bellard
        sdl1=$sdl
1042 dbb2c921 bellard
    fi
1043 dbb2c921 bellard
    if test "$sdl1" = "yes" ; then
1044 dbb2c921 bellard
        echo "#define CONFIG_SDL 1" >> $config_h
1045 dbb2c921 bellard
        echo "CONFIG_SDL=yes" >> $config_mak
1046 dbb2c921 bellard
        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
1047 dbb2c921 bellard
            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
1048 dbb2c921 bellard
        else
1049 7c1f25b4 bellard
            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
1050 7c1f25b4 bellard
        fi
1051 dbb2c921 bellard
        if [ "${aa}" = "yes" ] ; then
1052 b1a550a0 pbrook
            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
1053 b1a550a0 pbrook
        else
1054 b1a550a0 pbrook
            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
1055 dbb2c921 bellard
        fi
1056 7c1f25b4 bellard
    fi
1057 7c1f25b4 bellard
fi
1058 7c1f25b4 bellard
1059 5b0753e0 bellard
if test "$cocoa" = "yes" ; then
1060 5b0753e0 bellard
    echo "#define CONFIG_COCOA 1" >> $config_h
1061 5b0753e0 bellard
    echo "CONFIG_COCOA=yes" >> $config_mak
1062 5b0753e0 bellard
fi
1063 5b0753e0 bellard
1064 97a847bc bellard
done # for target in $targets
1065 7d13299d bellard
1066 7d13299d bellard
# build tree in object directory if source path is different from current one
1067 7d13299d bellard
if test "$source_path_used" = "yes" ; then
1068 7d13299d bellard
    DIRS="tests"
1069 7d13299d bellard
    FILES="Makefile tests/Makefile"
1070 7d13299d bellard
    for dir in $DIRS ; do
1071 7d13299d bellard
            mkdir -p $dir
1072 7d13299d bellard
    done
1073 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
1074 7d13299d bellard
    for f in $FILES ; do
1075 ec530c81 bellard
        rm -f $f
1076 ec530c81 bellard
        ln -s $source_path/$f $f
1077 7d13299d bellard
    done
1078 7d13299d bellard
fi
1079 7d13299d bellard
1080 97a847bc bellard
rm -f $TMPO $TMPC $TMPE $TMPS