Statistics
| Branch: | Revision:

root / configure @ 1cdb9c3d

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