Statistics
| Branch: | Revision:

root / configure @ dc5d0b3d

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