Statistics
| Branch: | Revision:

root / configure @ ea785922

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