Statistics
| Branch: | Revision:

root / configure @ 87ac5427

History | View | Annotate | Download (24.7 kB)

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