Statistics
| Branch: | Revision:

root / configure @ 5bf08934

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