Statistics
| Branch: | Revision:

root / configure @ 8281db4d

History | View | Annotate | Download (35.7 kB)

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