Statistics
| Branch: | Revision:

root / configure @ 4ad5b06d

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