Statistics
| Branch: | Revision:

root / configure @ d3c61721

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