Statistics
| Branch: | Revision:

root / configure @ 192c7bd9

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