Statistics
| Branch: | Revision:

root / configure @ 94ac5158

History | View | Annotate | Download (23.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 7d13299d bellard
host_cc="gcc"
26 7d13299d bellard
ar="ar"
27 7d13299d bellard
make="make"
28 6a882643 pbrook
install="install"
29 7d13299d bellard
strip="strip"
30 7d13299d bellard
cpu=`uname -m`
31 5327cf48 bellard
target_list=""
32 7d13299d bellard
case "$cpu" in
33 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
34 97a847bc bellard
    cpu="i386"
35 7d13299d bellard
  ;;
36 ba68055e bellard
  armv*b)
37 808c4954 bellard
    cpu="armv4b"
38 808c4954 bellard
  ;;
39 ba68055e bellard
  armv*l)
40 7d13299d bellard
    cpu="armv4l"
41 7d13299d bellard
  ;;
42 7d13299d bellard
  alpha)
43 7d13299d bellard
    cpu="alpha"
44 7d13299d bellard
  ;;
45 295defa5 bellard
  "Power Macintosh"|ppc|ppc64)
46 7d13299d bellard
    cpu="powerpc"
47 7d13299d bellard
  ;;
48 7d13299d bellard
  mips)
49 7d13299d bellard
    cpu="mips"
50 7d13299d bellard
  ;;
51 fb3e5849 bellard
  s390)
52 fb3e5849 bellard
    cpu="s390"
53 fb3e5849 bellard
  ;;
54 94ac5158 pbrook
  sparc|sun4[muv])
55 ae228531 bellard
    cpu="sparc"
56 ae228531 bellard
  ;;
57 ae228531 bellard
  sparc64)
58 ae228531 bellard
    cpu="sparc64"
59 ae228531 bellard
  ;;
60 a8baa8c5 bellard
  ia64)
61 a8baa8c5 bellard
    cpu="ia64"
62 a8baa8c5 bellard
  ;;
63 38e584a0 bellard
  m68k)
64 38e584a0 bellard
    cpu="m68k"
65 38e584a0 bellard
  ;;
66 bc51c5c9 bellard
  x86_64|amd64)
67 0b0babc6 bellard
    cpu="x86_64"
68 bc51c5c9 bellard
  ;;
69 7d13299d bellard
  *)
70 7d13299d bellard
    cpu="unknown"
71 7d13299d bellard
  ;;
72 7d13299d bellard
esac
73 7d13299d bellard
gprof="no"
74 7d13299d bellard
bigendian="no"
75 67b915a5 bellard
mingw32="no"
76 67b915a5 bellard
EXESUF=""
77 67b915a5 bellard
gdbstub="yes"
78 443f1376 bellard
slirp="yes"
79 fb065187 bellard
adlib="no"
80 fb065187 bellard
oss="no"
81 1d14ffa9 bellard
dsound="no"
82 1d14ffa9 bellard
coreaudio="no"
83 1d14ffa9 bellard
alsa="no"
84 102a52e4 bellard
fmod="no"
85 102a52e4 bellard
fmod_lib=""
86 102a52e4 bellard
fmod_inc=""
87 b1a550a0 pbrook
bsd="no"
88 5327cf48 bellard
linux="no"
89 c9ec1fe4 bellard
kqemu="no"
90 05c2a3e7 bellard
profiler="no"
91 c9ec1fe4 bellard
kernel_path=""
92 5b0753e0 bellard
cocoa="no"
93 97ccc689 bellard
check_gfx="yes"
94 1aff381f bellard
check_gcc="yes"
95 0a8e90f4 pbrook
softmmu="yes"
96 0a8e90f4 pbrook
user="no"
97 cc8ae6de pbrook
build_docs="no"
98 7d13299d bellard
99 7d13299d bellard
# OS specific
100 7d13299d bellard
targetos=`uname -s`
101 7d13299d bellard
case $targetos in
102 c326e0af bellard
CYGWIN*)
103 c326e0af bellard
mingw32="yes"
104 c326e0af bellard
CFLAGS="-O2 -mno-cygwin"
105 c326e0af bellard
;;
106 67b915a5 bellard
MINGW32*)
107 67b915a5 bellard
mingw32="yes"
108 67b915a5 bellard
;;
109 7d3505c5 bellard
FreeBSD)
110 7d3505c5 bellard
bsd="yes"
111 fb065187 bellard
oss="yes"
112 e99f9060 bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
113 07f4ddbf bellard
    kqemu="yes"
114 07f4ddbf bellard
fi
115 7d3505c5 bellard
;;
116 7d3505c5 bellard
NetBSD)
117 7d3505c5 bellard
bsd="yes"
118 fb065187 bellard
oss="yes"
119 7d3505c5 bellard
;;
120 7d3505c5 bellard
OpenBSD)
121 7d3505c5 bellard
bsd="yes"
122 fb065187 bellard
oss="yes"
123 7d3505c5 bellard
;;
124 83fb7adf bellard
Darwin)
125 83fb7adf bellard
bsd="yes"
126 83fb7adf bellard
darwin="yes"
127 83fb7adf bellard
;;
128 ec530c81 bellard
SunOS)
129 ec530c81 bellard
solaris="yes"
130 ec530c81 bellard
;;
131 1d14ffa9 bellard
*)
132 fb065187 bellard
oss="yes"
133 5327cf48 bellard
linux="yes"
134 0a8e90f4 pbrook
user="yes"
135 07f4ddbf bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
136 c9ec1fe4 bellard
    kqemu="yes"
137 c9ec1fe4 bellard
fi
138 fb065187 bellard
;;
139 7d13299d bellard
esac
140 7d13299d bellard
141 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
142 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
143 83fb7adf bellard
    make="gmake"
144 83fb7adf bellard
  fi
145 7d3505c5 bellard
fi
146 7d3505c5 bellard
147 ec530c81 bellard
if [ "$solaris" = "yes" ] ; then
148 ec530c81 bellard
    make="gmake"
149 ec530c81 bellard
    install="ginstall"
150 ec530c81 bellard
    solarisrev=`uname -r | cut -f2 -d.`
151 ec530c81 bellard
    if test $solarisrev -lt 10 ; then
152 ec530c81 bellard
      presolaris10="yes"
153 ec530c81 bellard
    fi
154 ec530c81 bellard
fi
155 ec530c81 bellard
156 7d13299d bellard
# find source path
157 ad064840 pbrook
source_path=`dirname "$0"`
158 ad064840 pbrook
if [ -z "$source_path" ]; then
159 7d13299d bellard
    source_path=`pwd`
160 ad064840 pbrook
else
161 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
162 ad064840 pbrook
fi
163 ad064840 pbrook
if test "$source_path" = `pwd` ; then
164 7d13299d bellard
    source_path_used="no"
165 ad064840 pbrook
else
166 ad064840 pbrook
    source_path_used="yes"
167 7d13299d bellard
fi
168 7d13299d bellard
169 7d13299d bellard
for opt do
170 b1a550a0 pbrook
  optarg=`expr "$opt" : '[^=]*=\(.*\)'`
171 7d13299d bellard
  case "$opt" in
172 2efc3265 bellard
  --help|-h) show_help=yes
173 2efc3265 bellard
  ;;
174 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
175 7d13299d bellard
  ;;
176 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
177 32ce6337 bellard
  ;;
178 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
179 ad064840 pbrook
  source_path_used="yes"
180 7d13299d bellard
  ;;
181 b1a550a0 pbrook
  --cross-prefix=*) cross_prefix="$optarg"
182 7d13299d bellard
  ;;
183 b1a550a0 pbrook
  --cc=*) cc="$optarg"
184 7d13299d bellard
  ;;
185 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
186 83469015 bellard
  ;;
187 b1a550a0 pbrook
  --make=*) make="$optarg"
188 7d13299d bellard
  ;;
189 6a882643 pbrook
  --install=*) install="$optarg"
190 6a882643 pbrook
  ;;
191 b1a550a0 pbrook
  --extra-cflags=*) CFLAGS="$optarg"
192 7d13299d bellard
  ;;
193 b1a550a0 pbrook
  --extra-ldflags=*) LDFLAGS="$optarg"
194 7d13299d bellard
  ;;
195 b1a550a0 pbrook
  --cpu=*) cpu="$optarg"
196 7d13299d bellard
  ;;
197 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
198 de83cd02 bellard
  ;;
199 7d13299d bellard
  --enable-gprof) gprof="yes"
200 7d13299d bellard
  ;;
201 43ce4dfe bellard
  --static) static="yes"
202 43ce4dfe bellard
  ;;
203 97a847bc bellard
  --disable-sdl) sdl="no"
204 97a847bc bellard
  ;;
205 1d14ffa9 bellard
  --enable-coreaudio) coreaudio="yes"
206 1d14ffa9 bellard
  ;;
207 1d14ffa9 bellard
  --enable-alsa) alsa="yes"
208 1d14ffa9 bellard
  ;;
209 1d14ffa9 bellard
  --enable-dsound) dsound="yes"
210 1d14ffa9 bellard
  ;;
211 102a52e4 bellard
  --enable-fmod) fmod="yes"
212 102a52e4 bellard
  ;;
213 b1a550a0 pbrook
  --fmod-lib=*) fmod_lib="$optarg"
214 102a52e4 bellard
  ;;
215 b1a550a0 pbrook
  --fmod-inc=*) fmod_inc="$optarg"
216 102a52e4 bellard
  ;;
217 67b915a5 bellard
  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
218 1d14ffa9 bellard
  ;;
219 443f1376 bellard
  --disable-slirp) slirp="no"
220 1d14ffa9 bellard
  ;;
221 fb065187 bellard
  --enable-adlib) adlib="yes"
222 1d14ffa9 bellard
  ;;
223 c9ec1fe4 bellard
  --disable-kqemu) kqemu="no"
224 1d14ffa9 bellard
  ;;
225 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
226 05c2a3e7 bellard
  ;;
227 b1a550a0 pbrook
  --kernel-path=*) kernel_path="$optarg"
228 1d14ffa9 bellard
  ;;
229 1d14ffa9 bellard
  --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no"
230 1d14ffa9 bellard
  ;;
231 97ccc689 bellard
  --disable-gfx-check) check_gfx="no"
232 97ccc689 bellard
  ;;
233 1aff381f bellard
  --disable-gcc-check) check_gcc="no"
234 1aff381f bellard
  ;;
235 cad25d69 pbrook
  --disable-system) softmmu="no"
236 0a8e90f4 pbrook
  ;;
237 cad25d69 pbrook
  --enable-system) softmmu="yes"
238 0a8e90f4 pbrook
  ;;
239 0a8e90f4 pbrook
  --disable-user) user="no"
240 0a8e90f4 pbrook
  ;;
241 0a8e90f4 pbrook
  --enable-user) user="yes"
242 0a8e90f4 pbrook
  ;;
243 7d13299d bellard
  esac
244 7d13299d bellard
done
245 7d13299d bellard
246 7d13299d bellard
# Checking for CFLAGS
247 7d13299d bellard
if test -z "$CFLAGS"; then
248 7d13299d bellard
    CFLAGS="-O2"
249 7d13299d bellard
fi
250 7d13299d bellard
251 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
252 af5db58e pbrook
cat << EOF
253 af5db58e pbrook
254 af5db58e pbrook
Usage: configure [options]
255 af5db58e pbrook
Options: [defaults in brackets after descriptions]
256 af5db58e pbrook
257 af5db58e pbrook
EOF
258 af5db58e pbrook
echo "Standard options:"
259 af5db58e pbrook
echo "  --help                   print this message"
260 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
261 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
262 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
263 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
264 af5db58e pbrook
echo ""
265 af5db58e pbrook
echo "kqemu kernel acceleration support:"
266 af5db58e pbrook
echo "  --disable-kqemu          disable kqemu support"
267 af5db58e pbrook
echo "  --kernel-path=PATH       set the kernel path (configure probes it)"
268 af5db58e pbrook
echo ""
269 af5db58e pbrook
echo "Advanced options (experts only):"
270 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
271 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
272 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
273 af5db58e pbrook
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
274 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
275 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
276 af5db58e pbrook
echo "  --static                 enable static build [$static]"
277 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
278 af5db58e pbrook
echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
279 af5db58e pbrook
echo "  --enable-adlib           enable Adlib emulation"
280 af5db58e pbrook
echo "  --enable-coreaudio       enable Coreaudio audio driver"
281 af5db58e pbrook
echo "  --enable-alsa            enable ALSA audio driver"
282 af5db58e pbrook
echo "  --enable-fmod            enable FMOD audio driver"
283 af5db58e pbrook
echo "  --enabled-dsound         enable DirectSound audio driver"
284 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
285 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
286 af5db58e pbrook
echo "  --enable-user            enable all linux usermode emulation targets"
287 af5db58e pbrook
echo "  --disable-user           disable all linux usermode emulation targets"
288 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
289 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
290 af5db58e pbrook
echo ""
291 af5db58e pbrook
echo "NOTE: The object files are build at the place where configure is launched"
292 af5db58e pbrook
exit 1
293 af5db58e pbrook
fi
294 af5db58e pbrook
295 7d13299d bellard
cc="${cross_prefix}${cc}"
296 7d13299d bellard
ar="${cross_prefix}${ar}"
297 7d13299d bellard
strip="${cross_prefix}${strip}"
298 7d13299d bellard
299 94ac5158 pbrook
if [ ! -x "`which $cc`" ] ; then
300 a7350fa1 bellard
    echo "Compiler $cc could not be found"
301 a7350fa1 bellard
    exit
302 a7350fa1 bellard
fi
303 a7350fa1 bellard
304 67b915a5 bellard
if test "$mingw32" = "yes" ; then
305 5327cf48 bellard
    linux="no"
306 67b915a5 bellard
    EXESUF=".exe"
307 67b915a5 bellard
    gdbstub="no"
308 9f059eca bellard
    oss="no"
309 07f4ddbf bellard
    if [ "$cpu" = "i386" ] ; then
310 07f4ddbf bellard
        kqemu="yes"
311 07f4ddbf bellard
    fi
312 67b915a5 bellard
fi
313 67b915a5 bellard
314 ec530c81 bellard
#
315 ec530c81 bellard
# Solaris specific configure tool chain decisions
316 ec530c81 bellard
#
317 ec530c81 bellard
if test "$solaris" = "yes" ; then
318 ec530c81 bellard
  #
319 ec530c81 bellard
  # gcc for solaris 10/fcs in /usr/sfw/bin doesn't compile qemu correctly
320 ec530c81 bellard
  # override the check with --disable-gcc-check
321 ec530c81 bellard
  # 
322 ec530c81 bellard
  if test "$solarisrev" -eq 10 -a "$check_gcc" = "yes" ; then
323 ec530c81 bellard
    solgcc=`which $cc`
324 ec530c81 bellard
    if test "$solgcc" = "/usr/sfw/bin/gcc" ; then
325 ec530c81 bellard
      echo "Solaris 10/FCS gcc in /usr/sfw/bin will not compiled qemu correctly."
326 ec530c81 bellard
      echo "please get gcc-3.4.3 or later, from www.blastwave.org using pkg-get -i gcc3"
327 ec530c81 bellard
      echo "or get the latest patch from SunSolve for gcc"
328 ec530c81 bellard
      exit 1
329 ec530c81 bellard
    fi
330 ec530c81 bellard
  fi
331 ec530c81 bellard
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
332 ec530c81 bellard
  if test -z "$solinst" ; then
333 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
334 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
335 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
336 ec530c81 bellard
    exit 1
337 ec530c81 bellard
  fi
338 ec530c81 bellard
  if test "$solinst" = "/usr/sbin/install" ; then
339 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
340 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
341 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
342 ec530c81 bellard
    exit 1
343 ec530c81 bellard
  fi
344 ec530c81 bellard
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
345 ec530c81 bellard
  if test -z "$sol_ar" ; then
346 ec530c81 bellard
    echo "Error: No path includes ar"
347 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
348 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
349 ec530c81 bellard
    fi
350 ec530c81 bellard
    exit 1
351 ec530c81 bellard
  fi
352 ec530c81 bellard
fi 
353 ec530c81 bellard
354 ec530c81 bellard
355 5327cf48 bellard
if test -z "$target_list" ; then
356 5327cf48 bellard
# these targets are portable
357 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
358 0a8e90f4 pbrook
        target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu mips-softmmu mipsel-softmmu arm-softmmu"
359 0a8e90f4 pbrook
    fi
360 5327cf48 bellard
# the following are Linux specific
361 0a8e90f4 pbrook
    if [ "$user" = "yes" ] ; then
362 c20eb473 bellard
        target_list="i386-user arm-user armeb-user sparc-user ppc-user mips-user mipsel-user $target_list"
363 5327cf48 bellard
    fi
364 6e20a45f bellard
else
365 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
366 5327cf48 bellard
fi
367 0a8e90f4 pbrook
if test -z "$target_list" ; then
368 0a8e90f4 pbrook
    echo "No targets enabled"
369 0a8e90f4 pbrook
    exit 1
370 0a8e90f4 pbrook
fi
371 5327cf48 bellard
372 7d13299d bellard
if test -z "$cross_prefix" ; then
373 7d13299d bellard
374 7d13299d bellard
# ---
375 7d13299d bellard
# big/little endian test
376 7d13299d bellard
cat > $TMPC << EOF
377 7d13299d bellard
#include <inttypes.h>
378 7d13299d bellard
int main(int argc, char ** argv){
379 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
380 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
381 7d13299d bellard
}
382 7d13299d bellard
EOF
383 7d13299d bellard
384 7d13299d bellard
if $cc -o $TMPE $TMPC 2>/dev/null ; then
385 7d13299d bellard
$TMPE && bigendian="yes"
386 7d13299d bellard
else
387 7d13299d bellard
echo big/little test failed
388 7d13299d bellard
fi
389 7d13299d bellard
390 7d13299d bellard
else
391 7d13299d bellard
392 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
393 808c4954 bellard
if test "$cpu" = "powerpc" -o "$cpu" = "mips" -o "$cpu" = "s390" -o "$cpu" = "sparc" -o "$cpu" = "sparc64" -o "$cpu" = "m68k" -o "$cpu" = "armv4b"; then
394 7d13299d bellard
    bigendian="yes"
395 7d13299d bellard
fi
396 7d13299d bellard
397 7d13299d bellard
fi
398 7d13299d bellard
399 b6853697 bellard
# host long bits test
400 b6853697 bellard
hostlongbits="32"
401 b6853697 bellard
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
402 b6853697 bellard
    hostlongbits="64"
403 b6853697 bellard
fi
404 b6853697 bellard
405 e8cd23de bellard
# check gcc options support
406 04369ff2 bellard
cat > $TMPC <<EOF
407 04369ff2 bellard
int main(void) {
408 04369ff2 bellard
}
409 04369ff2 bellard
EOF
410 04369ff2 bellard
411 e8cd23de bellard
have_gcc3_options="no"
412 e8cd23de bellard
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
413 e8cd23de bellard
   have_gcc3_options="yes"
414 04369ff2 bellard
fi
415 ca735206 bellard
416 b1a550a0 pbrook
# Check for gcc4, error if pre-gcc4 
417 1aff381f bellard
if test "$check_gcc" = "yes" ; then
418 1aff381f bellard
    cat > $TMPC <<EOF
419 b1a550a0 pbrook
#if __GNUC__ < 4
420 b1a550a0 pbrook
#error gcc3
421 1aff381f bellard
#endif
422 1aff381f bellard
int main(){return 0;}
423 1aff381f bellard
EOF
424 b1a550a0 pbrook
    if $cc -o $TMPO $TMPC 2>/dev/null ; then
425 1aff381f bellard
        echo "ERROR: \"$cc\" looks like gcc 4.x"
426 1aff381f bellard
        echo "QEMU is known to have problems when compiled with gcc 4.x"
427 1aff381f bellard
        echo "It is recommended that you use gcc 3.x to build QEMU"
428 1aff381f bellard
        echo "To use this compiler anyway, configure with --disable-gcc-check"
429 1aff381f bellard
        exit 1;
430 1aff381f bellard
    fi
431 1aff381f bellard
fi
432 1aff381f bellard
433 11d9f695 bellard
##########################################
434 11d9f695 bellard
# SDL probe
435 11d9f695 bellard
436 11d9f695 bellard
sdl_too_old=no
437 11d9f695 bellard
438 11d9f695 bellard
if test -z "$sdl" ; then
439 11d9f695 bellard
440 a6e022ad bellard
sdl_config="sdl-config"
441 a6e022ad bellard
sdl=no
442 7c1f25b4 bellard
sdl_static=no
443 a6e022ad bellard
444 a6e022ad bellard
if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
445 a6e022ad bellard
# win32 cross compilation case
446 a6e022ad bellard
    sdl_config="i386-mingw32msvc-sdl-config"
447 a6e022ad bellard
    sdl=yes
448 a6e022ad bellard
else
449 a6e022ad bellard
# normal SDL probe
450 11d9f695 bellard
cat > $TMPC << EOF
451 11d9f695 bellard
#include <SDL.h>
452 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
453 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
454 11d9f695 bellard
EOF
455 11d9f695 bellard
456 a6e022ad bellard
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
457 a6e022ad bellard
_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
458 11d9f695 bellard
if test "$_sdlversion" -lt 121 ; then
459 11d9f695 bellard
sdl_too_old=yes
460 11d9f695 bellard
else
461 11d9f695 bellard
sdl=yes
462 11d9f695 bellard
fi
463 7c1f25b4 bellard
464 7c1f25b4 bellard
# static link with sdl ?
465 7c1f25b4 bellard
if test "$sdl" = "yes" ; then
466 7c1f25b4 bellard
aa="no"
467 7c1f25b4 bellard
`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
468 7c1f25b4 bellard
sdl_static_libs=`$sdl_config --static-libs`
469 7c1f25b4 bellard
if [ "$aa" = "yes" ] ; then
470 d8d8aa4e bellard
  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
471 7c1f25b4 bellard
fi
472 7c1f25b4 bellard
473 7c1f25b4 bellard
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
474 7c1f25b4 bellard
  sdl_static=yes
475 11d9f695 bellard
fi
476 11d9f695 bellard
477 7c1f25b4 bellard
fi # static link
478 7c1f25b4 bellard
479 7c1f25b4 bellard
fi # sdl compile test
480 7c1f25b4 bellard
481 a6e022ad bellard
fi # cross compilation
482 a6e022ad bellard
fi # -z $sdl
483 11d9f695 bellard
484 cc8ae6de pbrook
# Check if tools are available to build documentation.
485 94ac5158 pbrook
if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
486 cc8ae6de pbrook
  build_docs="yes"
487 cc8ae6de pbrook
fi
488 cc8ae6de pbrook
489 11d9f695 bellard
if test "$mingw32" = "yes" ; then
490 11d9f695 bellard
if test -z "$prefix" ; then
491 11d9f695 bellard
    prefix="/c/Program Files/Qemu"
492 11d9f695 bellard
fi
493 11d9f695 bellard
mandir="$prefix"
494 7efa4387 bellard
datadir="$prefix"
495 1f50f8d1 bellard
docdir="$prefix"
496 11d9f695 bellard
bindir="$prefix"
497 11d9f695 bellard
else
498 11d9f695 bellard
if test -z "$prefix" ; then
499 11d9f695 bellard
    prefix="/usr/local"
500 11d9f695 bellard
fi
501 5a67135a bellard
mandir="$prefix/share/man"
502 7efa4387 bellard
datadir="$prefix/share/qemu"
503 1f50f8d1 bellard
docdir="$prefix/share/doc/qemu"
504 11d9f695 bellard
bindir="$prefix/bin"
505 11d9f695 bellard
fi
506 5a67135a bellard
507 43ce4dfe bellard
echo "Install prefix    $prefix"
508 7efa4387 bellard
echo "BIOS directory    $datadir"
509 11d9f695 bellard
echo "binary directory  $bindir"
510 11d9f695 bellard
if test "$mingw32" = "no" ; then
511 11d9f695 bellard
echo "Manual directory  $mandir"
512 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
513 11d9f695 bellard
fi
514 5a67135a bellard
echo "Source path       $source_path"
515 43ce4dfe bellard
echo "C compiler        $cc"
516 83469015 bellard
echo "Host C compiler   $host_cc"
517 43ce4dfe bellard
echo "make              $make"
518 6a882643 pbrook
echo "install           $install"
519 43ce4dfe bellard
echo "host CPU          $cpu"
520 de83cd02 bellard
echo "host big endian   $bigendian"
521 97a847bc bellard
echo "target list       $target_list"
522 43ce4dfe bellard
echo "gprof enabled     $gprof"
523 05c2a3e7 bellard
echo "profiler          $profiler"
524 43ce4dfe bellard
echo "static build      $static"
525 5b0753e0 bellard
if test "$darwin" = "yes" ; then
526 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
527 5b0753e0 bellard
fi
528 97a847bc bellard
echo "SDL support       $sdl"
529 e4afee97 bellard
if test "$sdl" != "no" ; then
530 e4afee97 bellard
    echo "SDL static link   $sdl_static"
531 e4afee97 bellard
fi
532 67b915a5 bellard
echo "mingw32 support   $mingw32"
533 fb065187 bellard
echo "Adlib support     $adlib"
534 1d14ffa9 bellard
echo "CoreAudio support $coreaudio"
535 1d14ffa9 bellard
echo "ALSA support      $alsa"
536 1d14ffa9 bellard
echo "DSound support    $dsound"
537 1d14ffa9 bellard
if test "$fmod" = "yes"; then
538 1d14ffa9 bellard
    if test -z $fmod_lib || test -z $fmod_inc; then
539 1d14ffa9 bellard
        echo
540 1d14ffa9 bellard
        echo "Error: You must specify path to FMOD library and headers"
541 1d14ffa9 bellard
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
542 1d14ffa9 bellard
        echo
543 1d14ffa9 bellard
        exit 1
544 1d14ffa9 bellard
    fi
545 b1a550a0 pbrook
    fmod_support=" (lib='$fmod_lib' include='$fmod_inc')"
546 b1a550a0 pbrook
else
547 b1a550a0 pbrook
    fmod_support=""
548 102a52e4 bellard
fi
549 b1a550a0 pbrook
echo "FMOD support      $fmod $fmod_support"
550 07f4ddbf bellard
echo "kqemu support     $kqemu"
551 cc8ae6de pbrook
echo "Documentation     $build_docs"
552 67b915a5 bellard
553 97a847bc bellard
if test $sdl_too_old = "yes"; then
554 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
555 7c1f25b4 bellard
fi
556 24b55b96 bellard
#if test "$sdl_static" = "no"; then
557 24b55b96 bellard
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
558 24b55b96 bellard
#fi
559 97a847bc bellard
config_mak="config-host.mak"
560 97a847bc bellard
config_h="config-host.h"
561 7d13299d bellard
562 7c1f25b4 bellard
#echo "Creating $config_mak and $config_h"
563 7d13299d bellard
564 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
565 29517134 pbrook
echo "# Configured with: $0 $@" >> $config_mak
566 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
567 7d13299d bellard
568 97a847bc bellard
echo "prefix=$prefix" >> $config_mak
569 11d9f695 bellard
echo "bindir=$bindir" >> $config_mak
570 5a67135a bellard
echo "mandir=$mandir" >> $config_mak
571 7efa4387 bellard
echo "datadir=$datadir" >> $config_mak
572 1f50f8d1 bellard
echo "docdir=$docdir" >> $config_mak
573 7efa4387 bellard
echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
574 97a847bc bellard
echo "MAKE=$make" >> $config_mak
575 6a882643 pbrook
echo "INSTALL=$install" >> $config_mak
576 97a847bc bellard
echo "CC=$cc" >> $config_mak
577 e8cd23de bellard
if test "$have_gcc3_options" = "yes" ; then
578 97a847bc bellard
  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
579 e8cd23de bellard
fi
580 97a847bc bellard
echo "HOST_CC=$host_cc" >> $config_mak
581 97a847bc bellard
echo "AR=$ar" >> $config_mak
582 97a847bc bellard
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
583 97a847bc bellard
echo "CFLAGS=$CFLAGS" >> $config_mak
584 97a847bc bellard
echo "LDFLAGS=$LDFLAGS" >> $config_mak
585 67b915a5 bellard
echo "EXESUF=$EXESUF" >> $config_mak
586 97a847bc bellard
if test "$cpu" = "i386" ; then
587 97a847bc bellard
  echo "ARCH=i386" >> $config_mak
588 97a847bc bellard
  echo "#define HOST_I386 1" >> $config_h
589 0b0babc6 bellard
elif test "$cpu" = "x86_64" ; then
590 0b0babc6 bellard
  echo "ARCH=x86_64" >> $config_mak
591 0b0babc6 bellard
  echo "#define HOST_X86_64 1" >> $config_h
592 808c4954 bellard
elif test "$cpu" = "armv4b" ; then
593 808c4954 bellard
  echo "ARCH=arm" >> $config_mak
594 808c4954 bellard
  echo "#define HOST_ARM 1" >> $config_h
595 7d13299d bellard
elif test "$cpu" = "armv4l" ; then
596 97a847bc bellard
  echo "ARCH=arm" >> $config_mak
597 97a847bc bellard
  echo "#define HOST_ARM 1" >> $config_h
598 7d13299d bellard
elif test "$cpu" = "powerpc" ; then
599 97a847bc bellard
  echo "ARCH=ppc" >> $config_mak
600 97a847bc bellard
  echo "#define HOST_PPC 1" >> $config_h
601 7d13299d bellard
elif test "$cpu" = "mips" ; then
602 97a847bc bellard
  echo "ARCH=mips" >> $config_mak
603 97a847bc bellard
  echo "#define HOST_MIPS 1" >> $config_h
604 fb3e5849 bellard
elif test "$cpu" = "s390" ; then
605 97a847bc bellard
  echo "ARCH=s390" >> $config_mak
606 97a847bc bellard
  echo "#define HOST_S390 1" >> $config_h
607 295defa5 bellard
elif test "$cpu" = "alpha" ; then
608 97a847bc bellard
  echo "ARCH=alpha" >> $config_mak
609 97a847bc bellard
  echo "#define HOST_ALPHA 1" >> $config_h
610 ae228531 bellard
elif test "$cpu" = "sparc" ; then
611 97a847bc bellard
  echo "ARCH=sparc" >> $config_mak
612 97a847bc bellard
  echo "#define HOST_SPARC 1" >> $config_h
613 ae228531 bellard
elif test "$cpu" = "sparc64" ; then
614 97a847bc bellard
  echo "ARCH=sparc64" >> $config_mak
615 97a847bc bellard
  echo "#define HOST_SPARC64 1" >> $config_h
616 a8baa8c5 bellard
elif test "$cpu" = "ia64" ; then
617 97a847bc bellard
  echo "ARCH=ia64" >> $config_mak
618 97a847bc bellard
  echo "#define HOST_IA64 1" >> $config_h
619 38e584a0 bellard
elif test "$cpu" = "m68k" ; then
620 38ca2abc bellard
  echo "ARCH=m68k" >> $config_mak
621 38ca2abc bellard
  echo "#define HOST_M68K 1" >> $config_h
622 7d13299d bellard
else
623 7d13299d bellard
  echo "Unsupported CPU"
624 7d13299d bellard
  exit 1
625 7d13299d bellard
fi
626 7d13299d bellard
if test "$bigendian" = "yes" ; then
627 97a847bc bellard
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
628 97a847bc bellard
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
629 97a847bc bellard
fi
630 b6853697 bellard
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
631 67b915a5 bellard
if test "$mingw32" = "yes" ; then
632 67b915a5 bellard
  echo "CONFIG_WIN32=yes" >> $config_mak
633 11d9f695 bellard
  echo "#define CONFIG_WIN32 1" >> $config_h
634 7d3505c5 bellard
elif test -f "/usr/include/byteswap.h" ; then
635 67b915a5 bellard
  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
636 67b915a5 bellard
fi
637 83fb7adf bellard
if test "$darwin" = "yes" ; then
638 83fb7adf bellard
  echo "CONFIG_DARWIN=yes" >> $config_mak
639 83fb7adf bellard
  echo "#define CONFIG_DARWIN 1" >> $config_h
640 83fb7adf bellard
fi
641 ec530c81 bellard
if test "$solaris" = "yes" ; then
642 ec530c81 bellard
  echo "CONFIG_SOLARIS=yes" >> $config_mak
643 ec530c81 bellard
  if test "$presolaris10" = "yes" ; then
644 ec530c81 bellard
    echo "#define _PRESOLARIS10 1" >> $config_h
645 ec530c81 bellard
  fi
646 ec530c81 bellard
fi
647 67b915a5 bellard
if test "$gdbstub" = "yes" ; then
648 67b915a5 bellard
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
649 67b915a5 bellard
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
650 67b915a5 bellard
fi
651 97a847bc bellard
if test "$gprof" = "yes" ; then
652 97a847bc bellard
  echo "TARGET_GPROF=yes" >> $config_mak
653 97a847bc bellard
  echo "#define HAVE_GPROF 1" >> $config_h
654 97a847bc bellard
fi
655 97a847bc bellard
if test "$static" = "yes" ; then
656 97a847bc bellard
  echo "CONFIG_STATIC=yes" >> $config_mak
657 50863472 bellard
  echo "#define CONFIG_STATIC 1" >> $config_h
658 7d13299d bellard
fi
659 05c2a3e7 bellard
if test $profiler = "yes" ; then
660 05c2a3e7 bellard
  echo "#define CONFIG_PROFILER 1" >> $config_h
661 05c2a3e7 bellard
fi
662 c20709aa bellard
if test "$slirp" = "yes" ; then
663 c20709aa bellard
  echo "CONFIG_SLIRP=yes" >> $config_mak
664 c20709aa bellard
  echo "#define CONFIG_SLIRP 1" >> $config_h
665 c20709aa bellard
fi
666 fb065187 bellard
if test "$adlib" = "yes" ; then
667 fb065187 bellard
  echo "CONFIG_ADLIB=yes" >> $config_mak
668 fb065187 bellard
  echo "#define CONFIG_ADLIB 1" >> $config_h
669 fb065187 bellard
fi
670 fb065187 bellard
if test "$oss" = "yes" ; then
671 fb065187 bellard
  echo "CONFIG_OSS=yes" >> $config_mak
672 fb065187 bellard
  echo "#define CONFIG_OSS 1" >> $config_h
673 fb065187 bellard
fi
674 1d14ffa9 bellard
if test "$coreaudio" = "yes" ; then
675 1d14ffa9 bellard
  echo "CONFIG_COREAUDIO=yes" >> $config_mak
676 1d14ffa9 bellard
  echo "#define CONFIG_COREAUDIO 1" >> $config_h
677 1d14ffa9 bellard
fi
678 1d14ffa9 bellard
if test "$alsa" = "yes" ; then
679 1d14ffa9 bellard
  echo "CONFIG_ALSA=yes" >> $config_mak
680 1d14ffa9 bellard
  echo "#define CONFIG_ALSA 1" >> $config_h
681 1d14ffa9 bellard
fi
682 1d14ffa9 bellard
if test "$dsound" = "yes" ; then
683 1d14ffa9 bellard
  echo "CONFIG_DSOUND=yes" >> $config_mak
684 1d14ffa9 bellard
  echo "#define CONFIG_DSOUND 1" >> $config_h
685 1d14ffa9 bellard
fi
686 102a52e4 bellard
if test "$fmod" = "yes" ; then
687 102a52e4 bellard
  echo "CONFIG_FMOD=yes" >> $config_mak
688 102a52e4 bellard
  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
689 102a52e4 bellard
  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
690 102a52e4 bellard
  echo "#define CONFIG_FMOD 1" >> $config_h
691 102a52e4 bellard
fi
692 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
693 b1a550a0 pbrook
echo "VERSION=$qemu_version" >>$config_mak
694 d4b8f039 pbrook
echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_h
695 97a847bc bellard
696 97a847bc bellard
echo "SRC_PATH=$source_path" >> $config_mak
697 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
698 ad064840 pbrook
  echo "VPATH=$source_path" >> $config_mak
699 ad064840 pbrook
fi
700 97a847bc bellard
echo "TARGET_DIRS=$target_list" >> $config_mak
701 cc8ae6de pbrook
if [ "$build_docs" = "yes" ] ; then
702 cc8ae6de pbrook
  echo "BUILD_DOCS=yes" >> $config_mak
703 cc8ae6de pbrook
fi
704 97a847bc bellard
705 83fb7adf bellard
# XXX: suppress that
706 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
707 43003046 bellard
  echo "#define O_LARGEFILE 0" >> $config_h
708 43003046 bellard
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
709 7d3505c5 bellard
  echo "#define _BSD 1" >> $config_h
710 7d3505c5 bellard
fi
711 7d3505c5 bellard
712 1d14ffa9 bellard
for target in $target_list; do
713 97a847bc bellard
target_dir="$target"
714 97a847bc bellard
config_mak=$target_dir/config.mak
715 97a847bc bellard
config_h=$target_dir/config.h
716 97a847bc bellard
target_cpu=`echo $target | cut -d '-' -f 1`
717 97a847bc bellard
target_bigendian="no"
718 808c4954 bellard
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
719 1e43adfc bellard
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
720 64b3ab24 bellard
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
721 67867308 bellard
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
722 a2458627 bellard
[ "$target_cpu" = "ppc64" ] && target_bigendian=yes
723 d3258560 bellard
[ "$target_cpu" = "mips" ] && target_bigendian=yes
724 97a847bc bellard
target_softmmu="no"
725 97a847bc bellard
if expr $target : '.*-softmmu' > /dev/null ; then
726 97a847bc bellard
  target_softmmu="yes"
727 97a847bc bellard
fi
728 997344f3 bellard
target_user_only="no"
729 997344f3 bellard
if expr $target : '.*-user' > /dev/null ; then
730 997344f3 bellard
  target_user_only="yes"
731 997344f3 bellard
fi
732 97a847bc bellard
733 97ccc689 bellard
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
734 1d14ffa9 bellard
        -a "$sdl" = "no" -a "$cocoa" = "no" ; then
735 97ccc689 bellard
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
736 9c038506 pbrook
    echo "To build QEMU without graphical output configure with --disable-gfx-check"
737 97ccc689 bellard
    echo "Note that this will disable all output from the virtual graphics card."
738 97ccc689 bellard
    exit 1;
739 97ccc689 bellard
fi
740 97ccc689 bellard
741 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
742 97a847bc bellard
743 97a847bc bellard
mkdir -p $target_dir
744 158142c2 bellard
mkdir -p $target_dir/fpu
745 808c4954 bellard
if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
746 69de927c bellard
  mkdir -p $target_dir/nwfpe
747 69de927c bellard
fi
748 a7e61ed4 bellard
if test "$target_user_only" = "no" ; then
749 a7e61ed4 bellard
  mkdir -p $target_dir/slirp
750 a7e61ed4 bellard
fi
751 69de927c bellard
752 ec530c81 bellard
#
753 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
754 ec530c81 bellard
#
755 ec530c81 bellard
rm -f $target_dir/Makefile
756 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
757 ec530c81 bellard
758 97a847bc bellard
759 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
760 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
761 97a847bc bellard
762 de83cd02 bellard
763 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
764 97a847bc bellard
echo "#include \"../config-host.h\"" >> $config_h
765 1e43adfc bellard
766 1e43adfc bellard
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
767 1e43adfc bellard
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
768 97a847bc bellard
769 97a847bc bellard
if test "$target_cpu" = "i386" ; then
770 97a847bc bellard
  echo "TARGET_ARCH=i386" >> $config_mak
771 97a847bc bellard
  echo "#define TARGET_ARCH \"i386\"" >> $config_h
772 97a847bc bellard
  echo "#define TARGET_I386 1" >> $config_h
773 07f4ddbf bellard
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
774 824d560f bellard
    echo "#define USE_KQEMU 1" >> $config_h
775 824d560f bellard
  fi
776 808c4954 bellard
elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
777 97a847bc bellard
  echo "TARGET_ARCH=arm" >> $config_mak
778 97a847bc bellard
  echo "#define TARGET_ARCH \"arm\"" >> $config_h
779 97a847bc bellard
  echo "#define TARGET_ARM 1" >> $config_h
780 1e43adfc bellard
elif test "$target_cpu" = "sparc" ; then
781 1e43adfc bellard
  echo "TARGET_ARCH=sparc" >> $config_mak
782 1e43adfc bellard
  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
783 1e43adfc bellard
  echo "#define TARGET_SPARC 1" >> $config_h
784 64b3ab24 bellard
elif test "$target_cpu" = "sparc64" ; then
785 64b3ab24 bellard
  echo "TARGET_ARCH=sparc64" >> $config_mak
786 64b3ab24 bellard
  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
787 64b3ab24 bellard
  echo "#define TARGET_SPARC 1" >> $config_h
788 64b3ab24 bellard
  echo "#define TARGET_SPARC64 1" >> $config_h
789 67867308 bellard
elif test "$target_cpu" = "ppc" ; then
790 67867308 bellard
  echo "TARGET_ARCH=ppc" >> $config_mak
791 67867308 bellard
  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
792 67867308 bellard
  echo "#define TARGET_PPC 1" >> $config_h
793 a2458627 bellard
elif test "$target_cpu" = "ppc64" ; then
794 a2458627 bellard
  echo "TARGET_ARCH=ppc64" >> $config_mak
795 a2458627 bellard
  echo "#define TARGET_ARCH \"ppc64\"" >> $config_h
796 a2458627 bellard
  echo "#define TARGET_PPC 1" >> $config_h
797 a2458627 bellard
  echo "#define TARGET_PPC64 1" >> $config_h
798 0b0babc6 bellard
elif test "$target_cpu" = "x86_64" ; then
799 0b0babc6 bellard
  echo "TARGET_ARCH=x86_64" >> $config_mak
800 0b0babc6 bellard
  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
801 0b0babc6 bellard
  echo "#define TARGET_I386 1" >> $config_h
802 0b0babc6 bellard
  echo "#define TARGET_X86_64 1" >> $config_h
803 07f4ddbf bellard
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
804 07f4ddbf bellard
    echo "#define USE_KQEMU 1" >> $config_h
805 07f4ddbf bellard
  fi
806 c20eb473 bellard
elif test "$target_cpu" = "mips" -o "$target_cpu" = "mipsel" ; then
807 d3258560 bellard
  echo "TARGET_ARCH=mips" >> $config_mak
808 d3258560 bellard
  echo "#define TARGET_ARCH \"mips\"" >> $config_h
809 d3258560 bellard
  echo "#define TARGET_MIPS 1" >> $config_h
810 de83cd02 bellard
else
811 de83cd02 bellard
  echo "Unsupported target CPU"
812 de83cd02 bellard
  exit 1
813 de83cd02 bellard
fi
814 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
815 97a847bc bellard
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
816 97a847bc bellard
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
817 de83cd02 bellard
fi
818 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
819 97a847bc bellard
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
820 97a847bc bellard
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
821 43ce4dfe bellard
fi
822 997344f3 bellard
if test "$target_user_only" = "yes" ; then
823 997344f3 bellard
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
824 997344f3 bellard
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
825 997344f3 bellard
fi
826 97a847bc bellard
827 158142c2 bellard
if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
828 158142c2 bellard
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
829 158142c2 bellard
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
830 158142c2 bellard
fi
831 7c1f25b4 bellard
# sdl defines
832 7c1f25b4 bellard
833 7c1f25b4 bellard
if test "$target_user_only" = "no"; then
834 7c1f25b4 bellard
    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
835 dbb2c921 bellard
        sdl1=$sdl_static
836 7c1f25b4 bellard
    else
837 dbb2c921 bellard
        sdl1=$sdl
838 dbb2c921 bellard
    fi
839 dbb2c921 bellard
    if test "$sdl1" = "yes" ; then
840 dbb2c921 bellard
        echo "#define CONFIG_SDL 1" >> $config_h
841 dbb2c921 bellard
        echo "CONFIG_SDL=yes" >> $config_mak
842 dbb2c921 bellard
        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
843 dbb2c921 bellard
            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
844 dbb2c921 bellard
        else
845 7c1f25b4 bellard
            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
846 7c1f25b4 bellard
        fi
847 dbb2c921 bellard
        if [ "${aa}" = "yes" ] ; then
848 b1a550a0 pbrook
            echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_mak
849 b1a550a0 pbrook
        else
850 b1a550a0 pbrook
            echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
851 dbb2c921 bellard
        fi
852 7c1f25b4 bellard
    fi
853 7c1f25b4 bellard
fi
854 7c1f25b4 bellard
855 5b0753e0 bellard
if test "$cocoa" = "yes" ; then
856 5b0753e0 bellard
    echo "#define CONFIG_COCOA 1" >> $config_h
857 5b0753e0 bellard
    echo "CONFIG_COCOA=yes" >> $config_mak
858 5b0753e0 bellard
fi
859 5b0753e0 bellard
860 97a847bc bellard
done # for target in $targets
861 7d13299d bellard
862 7d13299d bellard
# build tree in object directory if source path is different from current one
863 7d13299d bellard
if test "$source_path_used" = "yes" ; then
864 7d13299d bellard
    DIRS="tests"
865 7d13299d bellard
    FILES="Makefile tests/Makefile"
866 7d13299d bellard
    for dir in $DIRS ; do
867 7d13299d bellard
            mkdir -p $dir
868 7d13299d bellard
    done
869 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
870 7d13299d bellard
    for f in $FILES ; do
871 ec530c81 bellard
        rm -f $f
872 ec530c81 bellard
        ln -s $source_path/$f $f
873 7d13299d bellard
    done
874 7d13299d bellard
fi
875 7d13299d bellard
876 97a847bc bellard
rm -f $TMPO $TMPC $TMPE $TMPS