Statistics
| Branch: | Revision:

root / configure @ 86cc1ce0

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