Statistics
| Branch: | Revision:

root / configure @ dfae6487

History | View | Annotate | Download (19.3 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 7d13299d bellard
strip="strip"
29 7d13299d bellard
cpu=`uname -m`
30 5327cf48 bellard
target_list=""
31 7d13299d bellard
case "$cpu" in
32 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
33 97a847bc bellard
    cpu="i386"
34 7d13299d bellard
  ;;
35 ba68055e bellard
  armv*b)
36 808c4954 bellard
    cpu="armv4b"
37 808c4954 bellard
  ;;
38 ba68055e bellard
  armv*l)
39 7d13299d bellard
    cpu="armv4l"
40 7d13299d bellard
  ;;
41 7d13299d bellard
  alpha)
42 7d13299d bellard
    cpu="alpha"
43 7d13299d bellard
  ;;
44 295defa5 bellard
  "Power Macintosh"|ppc|ppc64)
45 7d13299d bellard
    cpu="powerpc"
46 7d13299d bellard
  ;;
47 7d13299d bellard
  mips)
48 7d13299d bellard
    cpu="mips"
49 7d13299d bellard
  ;;
50 fb3e5849 bellard
  s390)
51 fb3e5849 bellard
    cpu="s390"
52 fb3e5849 bellard
  ;;
53 ae228531 bellard
  sparc)
54 ae228531 bellard
    cpu="sparc"
55 ae228531 bellard
  ;;
56 ae228531 bellard
  sparc64)
57 ae228531 bellard
    cpu="sparc64"
58 ae228531 bellard
  ;;
59 a8baa8c5 bellard
  ia64)
60 a8baa8c5 bellard
    cpu="ia64"
61 a8baa8c5 bellard
  ;;
62 38e584a0 bellard
  m68k)
63 38e584a0 bellard
    cpu="m68k"
64 38e584a0 bellard
  ;;
65 bc51c5c9 bellard
  x86_64|amd64)
66 0b0babc6 bellard
    cpu="x86_64"
67 bc51c5c9 bellard
  ;;
68 7d13299d bellard
  *)
69 7d13299d bellard
    cpu="unknown"
70 7d13299d bellard
  ;;
71 7d13299d bellard
esac
72 7d13299d bellard
gprof="no"
73 7d13299d bellard
bigendian="no"
74 67b915a5 bellard
mingw32="no"
75 67b915a5 bellard
EXESUF=""
76 67b915a5 bellard
gdbstub="yes"
77 443f1376 bellard
slirp="yes"
78 fb065187 bellard
adlib="no"
79 fb065187 bellard
oss="no"
80 102a52e4 bellard
fmod="no"
81 102a52e4 bellard
fmod_lib=""
82 102a52e4 bellard
fmod_inc=""
83 5327cf48 bellard
linux="no"
84 c9ec1fe4 bellard
kqemu="no"
85 c9ec1fe4 bellard
kernel_path=""
86 5b0753e0 bellard
cocoa="no"
87 97ccc689 bellard
check_gfx="yes"
88 7d13299d bellard
89 7d13299d bellard
# OS specific
90 7d13299d bellard
targetos=`uname -s`
91 7d13299d bellard
case $targetos in
92 c326e0af bellard
CYGWIN*)
93 c326e0af bellard
mingw32="yes"
94 c326e0af bellard
CFLAGS="-O2 -mno-cygwin"
95 c326e0af bellard
;;
96 67b915a5 bellard
MINGW32*)
97 67b915a5 bellard
mingw32="yes"
98 67b915a5 bellard
;;
99 7d3505c5 bellard
FreeBSD)
100 7d3505c5 bellard
bsd="yes"
101 fb065187 bellard
oss="yes"
102 07f4ddbf bellard
if [ "$cpu" = "i386" ] ; then
103 07f4ddbf bellard
    kqemu="yes"
104 07f4ddbf bellard
fi
105 7d3505c5 bellard
;;
106 7d3505c5 bellard
NetBSD)
107 7d3505c5 bellard
bsd="yes"
108 fb065187 bellard
oss="yes"
109 7d3505c5 bellard
;;
110 7d3505c5 bellard
OpenBSD)
111 7d3505c5 bellard
bsd="yes"
112 fb065187 bellard
oss="yes"
113 7d3505c5 bellard
;;
114 83fb7adf bellard
Darwin)
115 83fb7adf bellard
bsd="yes"
116 83fb7adf bellard
darwin="yes"
117 83fb7adf bellard
;;
118 fb065187 bellard
*) 
119 fb065187 bellard
oss="yes"
120 5327cf48 bellard
linux="yes"
121 07f4ddbf bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
122 c9ec1fe4 bellard
    kqemu="yes"
123 c9ec1fe4 bellard
fi
124 fb065187 bellard
;;
125 7d13299d bellard
esac
126 7d13299d bellard
127 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
128 83fb7adf bellard
  if [ ! "$darwin" = "yes" ] ; then
129 83fb7adf bellard
    make="gmake"
130 83fb7adf bellard
  fi
131 7d3505c5 bellard
fi
132 7d3505c5 bellard
133 7d13299d bellard
# find source path
134 7d13299d bellard
# XXX: we assume an absolute path is given when launching configure, 
135 7d13299d bellard
# except in './configure' case.
136 7d13299d bellard
source_path=${0%configure}
137 7d13299d bellard
source_path=${source_path%/}
138 7d13299d bellard
source_path_used="yes"
139 7d13299d bellard
if test -z "$source_path" -o "$source_path" = "." ; then
140 7d13299d bellard
    source_path=`pwd`
141 7d13299d bellard
    source_path_used="no"
142 7d13299d bellard
fi
143 7d13299d bellard
144 7d13299d bellard
for opt do
145 7d13299d bellard
  case "$opt" in
146 7d13299d bellard
  --prefix=*) prefix=`echo $opt | cut -d '=' -f 2`
147 7d13299d bellard
  ;;
148 32ce6337 bellard
  --interp-prefix=*) interp_prefix=`echo $opt | cut -d '=' -f 2`
149 32ce6337 bellard
  ;;
150 7d13299d bellard
  --source-path=*) source_path=`echo $opt | cut -d '=' -f 2`
151 7d13299d bellard
  ;;
152 7d13299d bellard
  --cross-prefix=*) cross_prefix=`echo $opt | cut -d '=' -f 2`
153 7d13299d bellard
  ;;
154 7d13299d bellard
  --cc=*) cc=`echo $opt | cut -d '=' -f 2`
155 7d13299d bellard
  ;;
156 7d13299d bellard
  --make=*) make=`echo $opt | cut -d '=' -f 2`
157 7d13299d bellard
  ;;
158 7d13299d bellard
  --extra-cflags=*) CFLAGS="${opt#--extra-cflags=}"
159 7d13299d bellard
  ;;
160 7d13299d bellard
  --extra-ldflags=*) LDFLAGS="${opt#--extra-ldflags=}"
161 7d13299d bellard
  ;;
162 7d13299d bellard
  --cpu=*) cpu=`echo $opt | cut -d '=' -f 2`
163 7d13299d bellard
  ;;
164 97a847bc bellard
  --target-list=*) target_list=${opt#--target-list=}
165 de83cd02 bellard
  ;;
166 7d13299d bellard
  --enable-gprof) gprof="yes"
167 7d13299d bellard
  ;;
168 43ce4dfe bellard
  --static) static="yes"
169 43ce4dfe bellard
  ;;
170 97a847bc bellard
  --disable-sdl) sdl="no"
171 97a847bc bellard
  ;;
172 102a52e4 bellard
  --enable-fmod) fmod="yes"
173 102a52e4 bellard
  ;;
174 102a52e4 bellard
  --fmod-lib=*) fmod_lib=${opt#--fmod-lib=}
175 102a52e4 bellard
  ;;
176 102a52e4 bellard
  --fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
177 102a52e4 bellard
  ;;
178 67b915a5 bellard
  --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
179 67b915a5 bellard
  ;; 
180 443f1376 bellard
  --disable-slirp) slirp="no"
181 c20709aa bellard
  ;; 
182 fb065187 bellard
  --enable-adlib) adlib="yes"
183 fb065187 bellard
  ;; 
184 c9ec1fe4 bellard
  --disable-kqemu) kqemu="no"
185 c9ec1fe4 bellard
  ;; 
186 c9ec1fe4 bellard
  --kernel-path=*) kernel_path=${opt#--kernel-path=}
187 c9ec1fe4 bellard
  ;; 
188 5b0753e0 bellard
  --enable-cocoa) cocoa="yes" ; sdl="no"
189 5b0753e0 bellard
  ;; 
190 97ccc689 bellard
  --disable-gfx-check) check_gfx="no"
191 97ccc689 bellard
  ;;
192 7d13299d bellard
  esac
193 7d13299d bellard
done
194 7d13299d bellard
195 7d13299d bellard
# Checking for CFLAGS
196 7d13299d bellard
if test -z "$CFLAGS"; then
197 7d13299d bellard
    CFLAGS="-O2"
198 7d13299d bellard
fi
199 7d13299d bellard
200 7d13299d bellard
cc="${cross_prefix}${cc}"
201 7d13299d bellard
ar="${cross_prefix}${ar}"
202 7d13299d bellard
strip="${cross_prefix}${strip}"
203 7d13299d bellard
204 67b915a5 bellard
if test "$mingw32" = "yes" ; then
205 5327cf48 bellard
    linux="no"
206 67b915a5 bellard
    EXESUF=".exe"
207 67b915a5 bellard
    gdbstub="no"
208 9f059eca bellard
    oss="no"
209 07f4ddbf bellard
    if [ "$cpu" = "i386" ] ; then
210 07f4ddbf bellard
        kqemu="yes"
211 07f4ddbf bellard
    fi
212 67b915a5 bellard
fi
213 67b915a5 bellard
214 5327cf48 bellard
if test -z "$target_list" ; then
215 5327cf48 bellard
# these targets are portable
216 a20b5524 bellard
    target_list="i386-softmmu ppc-softmmu sparc-softmmu x86_64-softmmu"
217 5327cf48 bellard
# the following are Linux specific
218 5327cf48 bellard
    if [ "$linux" = "yes" ] ; then
219 a20b5524 bellard
        target_list="i386-user arm-user armeb-user sparc-user ppc-user $target_list"
220 5327cf48 bellard
    fi
221 6e20a45f bellard
else
222 6e20a45f bellard
    target_list=$(echo "$target_list" | sed -e 's/,/ /g')
223 5327cf48 bellard
fi
224 5327cf48 bellard
225 7d13299d bellard
if test -z "$cross_prefix" ; then
226 7d13299d bellard
227 7d13299d bellard
# ---
228 7d13299d bellard
# big/little endian test
229 7d13299d bellard
cat > $TMPC << EOF
230 7d13299d bellard
#include <inttypes.h>
231 7d13299d bellard
int main(int argc, char ** argv){
232 7d13299d bellard
	volatile uint32_t i=0x01234567;
233 7d13299d bellard
	return (*((uint8_t*)(&i))) == 0x67;
234 7d13299d bellard
}
235 7d13299d bellard
EOF
236 7d13299d bellard
237 7d13299d bellard
if $cc -o $TMPE $TMPC 2>/dev/null ; then
238 7d13299d bellard
$TMPE && bigendian="yes"
239 7d13299d bellard
else
240 7d13299d bellard
echo big/little test failed
241 7d13299d bellard
fi
242 7d13299d bellard
243 7d13299d bellard
else
244 7d13299d bellard
245 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
246 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
247 7d13299d bellard
    bigendian="yes"
248 7d13299d bellard
fi
249 7d13299d bellard
250 7d13299d bellard
fi
251 7d13299d bellard
252 b6853697 bellard
# host long bits test
253 b6853697 bellard
hostlongbits="32"
254 b6853697 bellard
if test "$cpu" = "sparc64" -o "$cpu" = "ia64" -o "$cpu" = "x86_64" -o "$cpu" = "alpha"; then
255 b6853697 bellard
    hostlongbits="64"
256 b6853697 bellard
fi
257 b6853697 bellard
258 e8cd23de bellard
# check gcc options support
259 04369ff2 bellard
cat > $TMPC <<EOF
260 04369ff2 bellard
int main(void) {
261 04369ff2 bellard
}
262 04369ff2 bellard
EOF
263 04369ff2 bellard
264 e8cd23de bellard
have_gcc3_options="no"
265 e8cd23de bellard
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
266 e8cd23de bellard
   have_gcc3_options="yes"
267 04369ff2 bellard
fi
268 ca735206 bellard
269 11d9f695 bellard
##########################################
270 11d9f695 bellard
# SDL probe
271 11d9f695 bellard
272 11d9f695 bellard
sdl_too_old=no
273 11d9f695 bellard
274 11d9f695 bellard
if test -z "$sdl" ; then
275 11d9f695 bellard
276 a6e022ad bellard
sdl_config="sdl-config"
277 a6e022ad bellard
sdl=no
278 7c1f25b4 bellard
sdl_static=no
279 a6e022ad bellard
280 a6e022ad bellard
if test "$mingw32" = "yes" -a ! -z "$cross_prefix" ; then
281 a6e022ad bellard
# win32 cross compilation case
282 a6e022ad bellard
    sdl_config="i386-mingw32msvc-sdl-config"
283 a6e022ad bellard
    sdl=yes
284 a6e022ad bellard
else
285 a6e022ad bellard
# normal SDL probe
286 11d9f695 bellard
cat > $TMPC << EOF
287 11d9f695 bellard
#include <SDL.h>
288 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
289 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
290 11d9f695 bellard
EOF
291 11d9f695 bellard
292 a6e022ad bellard
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` 2> /dev/null ; then
293 a6e022ad bellard
_sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
294 11d9f695 bellard
if test "$_sdlversion" -lt 121 ; then
295 11d9f695 bellard
sdl_too_old=yes
296 11d9f695 bellard
else
297 11d9f695 bellard
sdl=yes
298 11d9f695 bellard
fi
299 7c1f25b4 bellard
300 7c1f25b4 bellard
# static link with sdl ?
301 7c1f25b4 bellard
if test "$sdl" = "yes" ; then
302 7c1f25b4 bellard
aa="no"
303 7c1f25b4 bellard
`$sdl_config --static-libs | grep \\\-laa > /dev/null` && aa="yes"
304 7c1f25b4 bellard
sdl_static_libs=`$sdl_config --static-libs`
305 7c1f25b4 bellard
if [ "$aa" = "yes" ] ; then
306 d8d8aa4e bellard
  sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
307 7c1f25b4 bellard
fi
308 7c1f25b4 bellard
309 7c1f25b4 bellard
if $cc -o $TMPE `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs 2> /dev/null; then
310 7c1f25b4 bellard
  sdl_static=yes
311 11d9f695 bellard
fi
312 11d9f695 bellard
313 7c1f25b4 bellard
fi # static link
314 7c1f25b4 bellard
315 7c1f25b4 bellard
fi # sdl compile test
316 7c1f25b4 bellard
317 a6e022ad bellard
fi # cross compilation
318 a6e022ad bellard
fi # -z $sdl
319 11d9f695 bellard
320 7d13299d bellard
if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
321 7d13299d bellard
cat << EOF
322 7d13299d bellard
323 7d13299d bellard
Usage: configure [options]
324 7d13299d bellard
Options: [defaults in brackets after descriptions]
325 7d13299d bellard
326 7d13299d bellard
EOF
327 7d13299d bellard
echo "Standard options:"
328 7d13299d bellard
echo "  --help                   print this message"
329 7d13299d bellard
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
330 1e43adfc bellard
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
331 1e43adfc bellard
echo "                           use %M for cpu name [$interp_prefix]"
332 97a847bc bellard
echo "  --target-list=LIST       set target list [$target_list]"
333 7d13299d bellard
echo ""
334 c9ec1fe4 bellard
echo "kqemu kernel acceleration support:"
335 c9ec1fe4 bellard
echo "  --disable-kqemu          disable kqemu build"
336 c9ec1fe4 bellard
echo "  --kernel-path=PATH       set the kernel path (configure probes it)"
337 c9ec1fe4 bellard
echo ""
338 7d13299d bellard
echo "Advanced options (experts only):"
339 7d13299d bellard
echo "  --source-path=PATH       path of source code [$source_path]"
340 7d13299d bellard
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
341 7d13299d bellard
echo "  --cc=CC                  use C compiler CC [$cc]"
342 7d13299d bellard
echo "  --make=MAKE              use specified make [$make]"
343 43ce4dfe bellard
echo "  --static                 enable static build [$static]"
344 67b915a5 bellard
echo "  --enable-mingw32         enable Win32 cross compilation with mingw32"
345 d37282ad bellard
echo "  --enable-adlib           enable Adlib emulation"
346 102a52e4 bellard
echo "  --enable-fmod            enable FMOD audio output driver"
347 102a52e4 bellard
echo "  --fmod-lib               path to FMOD library"
348 102a52e4 bellard
echo "  --fmod-inc               path to FMOD includes"
349 7d13299d bellard
echo ""
350 7d13299d bellard
echo "NOTE: The object files are build at the place where configure is launched"
351 7d13299d bellard
exit 1
352 7d13299d bellard
fi
353 7d13299d bellard
354 11d9f695 bellard
if test "$mingw32" = "yes" ; then
355 11d9f695 bellard
if test -z "$prefix" ; then
356 11d9f695 bellard
    prefix="/c/Program Files/Qemu"
357 11d9f695 bellard
fi
358 11d9f695 bellard
mandir="$prefix"
359 7efa4387 bellard
datadir="$prefix"
360 1f50f8d1 bellard
docdir="$prefix"
361 11d9f695 bellard
bindir="$prefix"
362 11d9f695 bellard
else
363 11d9f695 bellard
if test -z "$prefix" ; then
364 11d9f695 bellard
    prefix="/usr/local"
365 11d9f695 bellard
fi
366 5a67135a bellard
mandir="$prefix/share/man"
367 7efa4387 bellard
datadir="$prefix/share/qemu"
368 1f50f8d1 bellard
docdir="$prefix/share/doc/qemu"
369 11d9f695 bellard
bindir="$prefix/bin"
370 11d9f695 bellard
fi
371 5a67135a bellard
372 07f4ddbf bellard
# kqemu support
373 c9ec1fe4 bellard
if test $kqemu = "yes" ; then
374 441c72ba bellard
    # test if the source code is installed
375 441c72ba bellard
    if test '!' -f "kqemu/Makefile" ; then 
376 441c72ba bellard
        kqemu="no"
377 441c72ba bellard
    fi
378 441c72ba bellard
fi
379 441c72ba bellard
  
380 07f4ddbf bellard
# Linux specific kqemu configuration
381 07f4ddbf bellard
if test $kqemu = "yes" -a $linux = "yes" ; then
382 c9ec1fe4 bellard
# find the kernel path
383 c9ec1fe4 bellard
if test -z "$kernel_path" ; then
384 c9ec1fe4 bellard
kernel_version=`uname -r`
385 c9ec1fe4 bellard
kernel_path="/lib/modules/$kernel_version/build"
386 c9ec1fe4 bellard
if test '!' -d "$kernel_path/include" ; then 
387 c9ec1fe4 bellard
    kernel_path="/usr/src/linux"
388 c9ec1fe4 bellard
    if test '!' -d "$kernel_path/include" ; then 
389 c9ec1fe4 bellard
        echo "Could not find kernel includes in /lib/modules or /usr/src/linux - cannot build the kqemu module"
390 c9ec1fe4 bellard
        kqemu="no"
391 c9ec1fe4 bellard
    fi
392 c9ec1fe4 bellard
fi
393 c9ec1fe4 bellard
fi
394 c9ec1fe4 bellard
395 c9ec1fe4 bellard
if test $kqemu = "yes" ; then
396 c9ec1fe4 bellard
397 c9ec1fe4 bellard
# test that the kernel config is present
398 c9ec1fe4 bellard
if test '!' -f "$kernel_path/Makefile" ; then
399 f94daedd bellard
    echo "No Makefile file present in $kernel_path - kqemu cannot be built"
400 c9ec1fe4 bellard
    kqemu="no"
401 c9ec1fe4 bellard
fi    
402 c9ec1fe4 bellard
403 c9ec1fe4 bellard
# find build system (2.6 or legacy)
404 c9ec1fe4 bellard
kbuild26="yes"
405 c9ec1fe4 bellard
if grep -q "PATCHLEVEL = 4" $kernel_path/Makefile ; then
406 c9ec1fe4 bellard
kbuild26="no"
407 c9ec1fe4 bellard
fi
408 c9ec1fe4 bellard
409 c9ec1fe4 bellard
fi # kqemu
410 c9ec1fe4 bellard
411 07f4ddbf bellard
fi # kqemu and linux
412 c9ec1fe4 bellard
413 c9ec1fe4 bellard
414 43ce4dfe bellard
echo "Install prefix    $prefix"
415 7efa4387 bellard
echo "BIOS directory    $datadir"
416 11d9f695 bellard
echo "binary directory  $bindir"
417 11d9f695 bellard
if test "$mingw32" = "no" ; then
418 11d9f695 bellard
echo "Manual directory  $mandir"
419 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
420 11d9f695 bellard
fi
421 5a67135a bellard
echo "Source path       $source_path"
422 43ce4dfe bellard
echo "C compiler        $cc"
423 43ce4dfe bellard
echo "make              $make"
424 43ce4dfe bellard
echo "host CPU          $cpu"
425 de83cd02 bellard
echo "host big endian   $bigendian"
426 97a847bc bellard
echo "target list       $target_list"
427 43ce4dfe bellard
echo "gprof enabled     $gprof"
428 43ce4dfe bellard
echo "static build      $static"
429 5b0753e0 bellard
if test "$darwin" = "yes" ; then
430 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
431 5b0753e0 bellard
fi
432 97a847bc bellard
echo "SDL support       $sdl"
433 e4afee97 bellard
if test "$sdl" != "no" ; then
434 e4afee97 bellard
    echo "SDL static link   $sdl_static"
435 e4afee97 bellard
fi
436 67b915a5 bellard
echo "mingw32 support   $mingw32"
437 fb065187 bellard
echo "Adlib support     $adlib"
438 102a52e4 bellard
echo -n "FMOD support      $fmod"
439 102a52e4 bellard
if test $fmod = "yes"; then
440 102a52e4 bellard
    echo -n " (lib='$fmod_lib' include='$fmod_inc')"
441 102a52e4 bellard
fi
442 102a52e4 bellard
echo ""
443 07f4ddbf bellard
echo "kqemu support     $kqemu"
444 07f4ddbf bellard
if test $kqemu = "yes" -a $linux = "yes" ; then
445 c9ec1fe4 bellard
echo ""
446 07f4ddbf bellard
echo "KQEMU Linux module configuration:"
447 c9ec1fe4 bellard
echo "kernel sources    $kernel_path"
448 c9ec1fe4 bellard
echo -n "kbuild type       "
449 c9ec1fe4 bellard
if test $kbuild26 = "yes"; then
450 c9ec1fe4 bellard
echo "2.6"
451 c9ec1fe4 bellard
else
452 c9ec1fe4 bellard
echo "2.4"
453 c9ec1fe4 bellard
fi
454 c9ec1fe4 bellard
fi
455 67b915a5 bellard
456 97a847bc bellard
if test $sdl_too_old = "yes"; then
457 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
458 7c1f25b4 bellard
fi
459 24b55b96 bellard
#if test "$sdl_static" = "no"; then
460 24b55b96 bellard
#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
461 24b55b96 bellard
#fi
462 97a847bc bellard
463 97a847bc bellard
config_mak="config-host.mak"
464 97a847bc bellard
config_h="config-host.h"
465 7d13299d bellard
466 7c1f25b4 bellard
#echo "Creating $config_mak and $config_h"
467 7d13299d bellard
468 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
469 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
470 7d13299d bellard
471 97a847bc bellard
echo "prefix=$prefix" >> $config_mak
472 11d9f695 bellard
echo "bindir=$bindir" >> $config_mak
473 5a67135a bellard
echo "mandir=$mandir" >> $config_mak
474 7efa4387 bellard
echo "datadir=$datadir" >> $config_mak
475 1f50f8d1 bellard
echo "docdir=$docdir" >> $config_mak
476 7efa4387 bellard
echo "#define CONFIG_QEMU_SHAREDIR \"$datadir\"" >> $config_h
477 97a847bc bellard
echo "MAKE=$make" >> $config_mak
478 97a847bc bellard
echo "CC=$cc" >> $config_mak
479 e8cd23de bellard
if test "$have_gcc3_options" = "yes" ; then
480 97a847bc bellard
  echo "HAVE_GCC3_OPTIONS=yes" >> $config_mak
481 e8cd23de bellard
fi
482 97a847bc bellard
echo "HOST_CC=$host_cc" >> $config_mak
483 97a847bc bellard
echo "AR=$ar" >> $config_mak
484 97a847bc bellard
echo "STRIP=$strip -s -R .comment -R .note" >> $config_mak
485 97a847bc bellard
echo "CFLAGS=$CFLAGS" >> $config_mak
486 97a847bc bellard
echo "LDFLAGS=$LDFLAGS" >> $config_mak
487 67b915a5 bellard
echo "EXESUF=$EXESUF" >> $config_mak
488 97a847bc bellard
if test "$cpu" = "i386" ; then
489 97a847bc bellard
  echo "ARCH=i386" >> $config_mak
490 97a847bc bellard
  echo "#define HOST_I386 1" >> $config_h
491 0b0babc6 bellard
elif test "$cpu" = "x86_64" ; then
492 0b0babc6 bellard
  echo "ARCH=x86_64" >> $config_mak
493 0b0babc6 bellard
  echo "#define HOST_X86_64 1" >> $config_h
494 808c4954 bellard
elif test "$cpu" = "armv4b" ; then
495 808c4954 bellard
  echo "ARCH=arm" >> $config_mak
496 808c4954 bellard
  echo "#define HOST_ARM 1" >> $config_h
497 7d13299d bellard
elif test "$cpu" = "armv4l" ; then
498 97a847bc bellard
  echo "ARCH=arm" >> $config_mak
499 97a847bc bellard
  echo "#define HOST_ARM 1" >> $config_h
500 7d13299d bellard
elif test "$cpu" = "powerpc" ; then
501 97a847bc bellard
  echo "ARCH=ppc" >> $config_mak
502 97a847bc bellard
  echo "#define HOST_PPC 1" >> $config_h
503 7d13299d bellard
elif test "$cpu" = "mips" ; then
504 97a847bc bellard
  echo "ARCH=mips" >> $config_mak
505 97a847bc bellard
  echo "#define HOST_MIPS 1" >> $config_h
506 fb3e5849 bellard
elif test "$cpu" = "s390" ; then
507 97a847bc bellard
  echo "ARCH=s390" >> $config_mak
508 97a847bc bellard
  echo "#define HOST_S390 1" >> $config_h
509 295defa5 bellard
elif test "$cpu" = "alpha" ; then
510 97a847bc bellard
  echo "ARCH=alpha" >> $config_mak
511 97a847bc bellard
  echo "#define HOST_ALPHA 1" >> $config_h
512 ae228531 bellard
elif test "$cpu" = "sparc" ; then
513 97a847bc bellard
  echo "ARCH=sparc" >> $config_mak
514 97a847bc bellard
  echo "#define HOST_SPARC 1" >> $config_h
515 ae228531 bellard
elif test "$cpu" = "sparc64" ; then
516 97a847bc bellard
  echo "ARCH=sparc64" >> $config_mak
517 97a847bc bellard
  echo "#define HOST_SPARC64 1" >> $config_h
518 a8baa8c5 bellard
elif test "$cpu" = "ia64" ; then
519 97a847bc bellard
  echo "ARCH=ia64" >> $config_mak
520 97a847bc bellard
  echo "#define HOST_IA64 1" >> $config_h
521 38e584a0 bellard
elif test "$cpu" = "m68k" ; then
522 38ca2abc bellard
  echo "ARCH=m68k" >> $config_mak
523 38ca2abc bellard
  echo "#define HOST_M68K 1" >> $config_h
524 7d13299d bellard
else
525 7d13299d bellard
  echo "Unsupported CPU"
526 7d13299d bellard
  exit 1
527 7d13299d bellard
fi
528 7d13299d bellard
if test "$bigendian" = "yes" ; then
529 97a847bc bellard
  echo "WORDS_BIGENDIAN=yes" >> $config_mak
530 97a847bc bellard
  echo "#define WORDS_BIGENDIAN 1" >> $config_h
531 97a847bc bellard
fi
532 b6853697 bellard
echo "#define HOST_LONG_BITS $hostlongbits" >> $config_h
533 67b915a5 bellard
if test "$mingw32" = "yes" ; then
534 67b915a5 bellard
  echo "CONFIG_WIN32=yes" >> $config_mak
535 11d9f695 bellard
  echo "#define CONFIG_WIN32 1" >> $config_h
536 7d3505c5 bellard
elif test -f "/usr/include/byteswap.h" ; then
537 67b915a5 bellard
  echo "#define HAVE_BYTESWAP_H 1" >> $config_h
538 67b915a5 bellard
fi
539 83fb7adf bellard
if test "$darwin" = "yes" ; then
540 83fb7adf bellard
  echo "CONFIG_DARWIN=yes" >> $config_mak
541 83fb7adf bellard
  echo "#define CONFIG_DARWIN 1" >> $config_h
542 83fb7adf bellard
fi
543 67b915a5 bellard
if test "$gdbstub" = "yes" ; then
544 67b915a5 bellard
  echo "CONFIG_GDBSTUB=yes" >> $config_mak
545 67b915a5 bellard
  echo "#define CONFIG_GDBSTUB 1" >> $config_h
546 67b915a5 bellard
fi
547 97a847bc bellard
if test "$gprof" = "yes" ; then
548 97a847bc bellard
  echo "TARGET_GPROF=yes" >> $config_mak
549 97a847bc bellard
  echo "#define HAVE_GPROF 1" >> $config_h
550 97a847bc bellard
fi
551 97a847bc bellard
if test "$static" = "yes" ; then
552 97a847bc bellard
  echo "CONFIG_STATIC=yes" >> $config_mak
553 50863472 bellard
  echo "#define CONFIG_STATIC 1" >> $config_h
554 7d13299d bellard
fi
555 c20709aa bellard
if test "$slirp" = "yes" ; then
556 c20709aa bellard
  echo "CONFIG_SLIRP=yes" >> $config_mak
557 c20709aa bellard
  echo "#define CONFIG_SLIRP 1" >> $config_h
558 c20709aa bellard
fi
559 fb065187 bellard
if test "$adlib" = "yes" ; then
560 fb065187 bellard
  echo "CONFIG_ADLIB=yes" >> $config_mak
561 fb065187 bellard
  echo "#define CONFIG_ADLIB 1" >> $config_h
562 fb065187 bellard
fi
563 fb065187 bellard
if test "$oss" = "yes" ; then
564 fb065187 bellard
  echo "CONFIG_OSS=yes" >> $config_mak
565 fb065187 bellard
  echo "#define CONFIG_OSS 1" >> $config_h
566 fb065187 bellard
fi
567 102a52e4 bellard
if test "$fmod" = "yes" ; then
568 102a52e4 bellard
  echo "CONFIG_FMOD=yes" >> $config_mak
569 102a52e4 bellard
  echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
570 102a52e4 bellard
  echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
571 102a52e4 bellard
  echo "#define CONFIG_FMOD 1" >> $config_h
572 102a52e4 bellard
fi
573 97a847bc bellard
echo -n "VERSION=" >>$config_mak
574 97a847bc bellard
head $source_path/VERSION >>$config_mak
575 97a847bc bellard
echo "" >>$config_mak
576 97a847bc bellard
echo -n "#define QEMU_VERSION \"" >> $config_h
577 97a847bc bellard
head $source_path/VERSION >> $config_h
578 97a847bc bellard
echo "\"" >> $config_h
579 97a847bc bellard
580 c9ec1fe4 bellard
if test $kqemu = "yes" ; then
581 c9ec1fe4 bellard
  echo "CONFIG_KQEMU=yes" >> $config_mak
582 1026f133 bellard
  if test $linux = "yes" ; then
583 1026f133 bellard
    echo "KERNEL_PATH=$kernel_path" >> $config_mak
584 1026f133 bellard
    if test $kbuild26 = "yes" ; then
585 1026f133 bellard
      echo "CONFIG_KBUILD26=yes" >> $config_mak
586 1026f133 bellard
    fi
587 c9ec1fe4 bellard
  fi
588 c9ec1fe4 bellard
fi
589 97a847bc bellard
echo "SRC_PATH=$source_path" >> $config_mak
590 97a847bc bellard
echo "TARGET_DIRS=$target_list" >> $config_mak
591 97a847bc bellard
592 83fb7adf bellard
# XXX: suppress that
593 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
594 43003046 bellard
  echo "#define O_LARGEFILE 0" >> $config_h
595 43003046 bellard
  echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
596 7d3505c5 bellard
  echo "#define _BSD 1" >> $config_h
597 7d3505c5 bellard
fi
598 7d3505c5 bellard
599 97a847bc bellard
for target in $target_list; do 
600 97a847bc bellard
601 97a847bc bellard
target_dir="$target"
602 97a847bc bellard
config_mak=$target_dir/config.mak
603 97a847bc bellard
config_h=$target_dir/config.h
604 97a847bc bellard
target_cpu=`echo $target | cut -d '-' -f 1`
605 97a847bc bellard
target_bigendian="no"
606 808c4954 bellard
[ "$target_cpu" = "armeb" ] && target_bigendian=yes
607 1e43adfc bellard
[ "$target_cpu" = "sparc" ] && target_bigendian=yes
608 64b3ab24 bellard
[ "$target_cpu" = "sparc64" ] && target_bigendian=yes
609 67867308 bellard
[ "$target_cpu" = "ppc" ] && target_bigendian=yes
610 97a847bc bellard
target_softmmu="no"
611 97a847bc bellard
if expr $target : '.*-softmmu' > /dev/null ; then
612 97a847bc bellard
  target_softmmu="yes"
613 97a847bc bellard
fi
614 997344f3 bellard
target_user_only="no"
615 997344f3 bellard
if expr $target : '.*-user' > /dev/null ; then
616 997344f3 bellard
  target_user_only="yes"
617 997344f3 bellard
fi
618 97a847bc bellard
619 97ccc689 bellard
if test "$target_user_only" = "no" -a "$check_gfx" = "yes" \
620 97ccc689 bellard
	-a "$sdl" = "no" -a "$cocoa" = "no" ; then
621 97ccc689 bellard
    echo "ERROR: QEMU requires SDL or Cocoa for graphical output"
622 97ccc689 bellard
    echo "To build QEMU with graphical output configure with --disable-gfx-check"
623 97ccc689 bellard
    echo "Note that this will disable all output from the virtual graphics card."
624 97ccc689 bellard
    exit 1;
625 97ccc689 bellard
fi
626 97ccc689 bellard
627 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
628 97a847bc bellard
629 97a847bc bellard
mkdir -p $target_dir
630 158142c2 bellard
mkdir -p $target_dir/fpu
631 808c4954 bellard
if test "$target" = "arm-user" -o "$target" = "armeb-user" ; then
632 69de927c bellard
  mkdir -p $target_dir/nwfpe
633 69de927c bellard
fi
634 a7e61ed4 bellard
if test "$target_user_only" = "no" ; then
635 a7e61ed4 bellard
  mkdir -p $target_dir/slirp
636 a7e61ed4 bellard
fi
637 69de927c bellard
638 97a847bc bellard
ln -sf $source_path/Makefile.target $target_dir/Makefile
639 97a847bc bellard
640 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
641 97a847bc bellard
echo "/* Automatically generated by configure - do not modify */" > $config_h
642 97a847bc bellard
643 de83cd02 bellard
644 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
645 97a847bc bellard
echo "#include \"../config-host.h\"" >> $config_h
646 1e43adfc bellard
647 1e43adfc bellard
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
648 1e43adfc bellard
echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
649 97a847bc bellard
650 97a847bc bellard
if test "$target_cpu" = "i386" ; then
651 97a847bc bellard
  echo "TARGET_ARCH=i386" >> $config_mak
652 97a847bc bellard
  echo "#define TARGET_ARCH \"i386\"" >> $config_h
653 97a847bc bellard
  echo "#define TARGET_I386 1" >> $config_h
654 07f4ddbf bellard
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "i386" ; then
655 824d560f bellard
    echo "#define USE_KQEMU 1" >> $config_h
656 824d560f bellard
  fi
657 808c4954 bellard
elif test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
658 97a847bc bellard
  echo "TARGET_ARCH=arm" >> $config_mak
659 97a847bc bellard
  echo "#define TARGET_ARCH \"arm\"" >> $config_h
660 97a847bc bellard
  echo "#define TARGET_ARM 1" >> $config_h
661 1e43adfc bellard
elif test "$target_cpu" = "sparc" ; then
662 1e43adfc bellard
  echo "TARGET_ARCH=sparc" >> $config_mak
663 1e43adfc bellard
  echo "#define TARGET_ARCH \"sparc\"" >> $config_h
664 1e43adfc bellard
  echo "#define TARGET_SPARC 1" >> $config_h
665 64b3ab24 bellard
elif test "$target_cpu" = "sparc64" ; then
666 64b3ab24 bellard
  echo "TARGET_ARCH=sparc64" >> $config_mak
667 64b3ab24 bellard
  echo "#define TARGET_ARCH \"sparc64\"" >> $config_h
668 64b3ab24 bellard
  echo "#define TARGET_SPARC 1" >> $config_h
669 64b3ab24 bellard
  echo "#define TARGET_SPARC64 1" >> $config_h
670 67867308 bellard
elif test "$target_cpu" = "ppc" ; then
671 67867308 bellard
  echo "TARGET_ARCH=ppc" >> $config_mak
672 67867308 bellard
  echo "#define TARGET_ARCH \"ppc\"" >> $config_h
673 67867308 bellard
  echo "#define TARGET_PPC 1" >> $config_h
674 0b0babc6 bellard
elif test "$target_cpu" = "x86_64" ; then
675 0b0babc6 bellard
  echo "TARGET_ARCH=x86_64" >> $config_mak
676 0b0babc6 bellard
  echo "#define TARGET_ARCH \"x86_64\"" >> $config_h
677 0b0babc6 bellard
  echo "#define TARGET_I386 1" >> $config_h
678 0b0babc6 bellard
  echo "#define TARGET_X86_64 1" >> $config_h
679 07f4ddbf bellard
  if test $kqemu = "yes" -a "$target_softmmu" = "yes" -a $cpu = "x86_64"  ; then
680 07f4ddbf bellard
    echo "#define USE_KQEMU 1" >> $config_h
681 07f4ddbf bellard
  fi
682 de83cd02 bellard
else
683 de83cd02 bellard
  echo "Unsupported target CPU"
684 de83cd02 bellard
  exit 1
685 de83cd02 bellard
fi
686 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
687 97a847bc bellard
  echo "TARGET_WORDS_BIGENDIAN=yes" >> $config_mak
688 97a847bc bellard
  echo "#define TARGET_WORDS_BIGENDIAN 1" >> $config_h
689 de83cd02 bellard
fi
690 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
691 97a847bc bellard
  echo "CONFIG_SOFTMMU=yes" >> $config_mak
692 97a847bc bellard
  echo "#define CONFIG_SOFTMMU 1" >> $config_h
693 43ce4dfe bellard
fi
694 997344f3 bellard
if test "$target_user_only" = "yes" ; then
695 997344f3 bellard
  echo "CONFIG_USER_ONLY=yes" >> $config_mak
696 997344f3 bellard
  echo "#define CONFIG_USER_ONLY 1" >> $config_h
697 997344f3 bellard
fi
698 97a847bc bellard
699 158142c2 bellard
if test "$target_cpu" = "arm" -o "$target_cpu" = "armeb" ; then
700 158142c2 bellard
  echo "CONFIG_SOFTFLOAT=yes" >> $config_mak
701 158142c2 bellard
  echo "#define CONFIG_SOFTFLOAT 1" >> $config_h
702 158142c2 bellard
fi
703 7c1f25b4 bellard
# sdl defines
704 7c1f25b4 bellard
705 7c1f25b4 bellard
if test "$target_user_only" = "no"; then
706 7c1f25b4 bellard
    if test "$target_softmmu" = "no" -o "$static" = "yes"; then
707 dbb2c921 bellard
        sdl1=$sdl_static
708 7c1f25b4 bellard
    else
709 dbb2c921 bellard
        sdl1=$sdl
710 dbb2c921 bellard
    fi
711 dbb2c921 bellard
    if test "$sdl1" = "yes" ; then
712 dbb2c921 bellard
        echo "#define CONFIG_SDL 1" >> $config_h
713 dbb2c921 bellard
        echo "CONFIG_SDL=yes" >> $config_mak
714 dbb2c921 bellard
        if test "$target_softmmu" = "no" -o "$static" = "yes"; then
715 dbb2c921 bellard
            echo "SDL_LIBS=$sdl_static_libs" >> $config_mak
716 dbb2c921 bellard
        else
717 7c1f25b4 bellard
            echo "SDL_LIBS=`$sdl_config --libs`" >> $config_mak
718 7c1f25b4 bellard
        fi
719 dbb2c921 bellard
        echo -n "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_mak
720 dbb2c921 bellard
        if [ "${aa}" = "yes" ] ; then
721 dbb2c921 bellard
            echo -n " `aalib-config --cflags`" >> $config_mak ;
722 dbb2c921 bellard
        fi
723 dbb2c921 bellard
        echo "" >> $config_mak
724 7c1f25b4 bellard
    fi
725 7c1f25b4 bellard
fi
726 7c1f25b4 bellard
727 5b0753e0 bellard
if test "$cocoa" = "yes" ; then
728 5b0753e0 bellard
    echo "#define CONFIG_COCOA 1" >> $config_h
729 5b0753e0 bellard
    echo "CONFIG_COCOA=yes" >> $config_mak
730 5b0753e0 bellard
fi
731 5b0753e0 bellard
732 97a847bc bellard
done # for target in $targets
733 7d13299d bellard
734 7d13299d bellard
# build tree in object directory if source path is different from current one
735 7d13299d bellard
if test "$source_path_used" = "yes" ; then
736 7d13299d bellard
    DIRS="tests"
737 7d13299d bellard
    FILES="Makefile tests/Makefile"
738 7d13299d bellard
    for dir in $DIRS ; do
739 7d13299d bellard
            mkdir -p $dir
740 7d13299d bellard
    done
741 7d13299d bellard
    for f in $FILES ; do
742 7d13299d bellard
        ln -sf $source_path/$f $f
743 7d13299d bellard
    done
744 7d13299d bellard
fi
745 7d13299d bellard
746 97a847bc bellard
rm -f $TMPO $TMPC $TMPE $TMPS