Statistics
| Branch: | Revision:

root / configure @ e5fe0c52

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