Statistics
| Branch: | Revision:

root / configure @ 36bb244b

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