Statistics
| Branch: | Revision:

root / configure @ ea8f20f8

History | View | Annotate | Download (52.6 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 7d13299d bellard
18 9784cde5 Juan Quintela
trap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15
19 9ac81bbb malc
20 52166aa0 Juan Quintela
compile_object() {
21 52166aa0 Juan Quintela
  $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
22 52166aa0 Juan Quintela
}
23 52166aa0 Juan Quintela
24 52166aa0 Juan Quintela
compile_prog() {
25 52166aa0 Juan Quintela
  local_cflags="$1"
26 52166aa0 Juan Quintela
  local_ldflags="$2"
27 52166aa0 Juan Quintela
  $cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
28 52166aa0 Juan Quintela
}
29 52166aa0 Juan Quintela
30 7d13299d bellard
# default parameters
31 2ff6b91e Juan Quintela
cpu=""
32 11d9f695 bellard
prefix=""
33 1e43adfc bellard
interp_prefix="/usr/gnemul/qemu-%M"
34 43ce4dfe bellard
static="no"
35 ed968ff1 Juan Quintela
sparc_cpu=""
36 7d13299d bellard
cross_prefix=""
37 7d13299d bellard
cc="gcc"
38 0c58ac1c malc
audio_drv_list=""
39 4c9b53e3 malc
audio_card_list="ac97 es1370 sb16"
40 4c9b53e3 malc
audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
41 7d13299d bellard
host_cc="gcc"
42 7d13299d bellard
ar="ar"
43 7d13299d bellard
make="make"
44 6a882643 pbrook
install="install"
45 7aa486fe Anthony Liguori
objcopy="objcopy"
46 7aa486fe Anthony Liguori
ld="ld"
47 ac0df51d aliguori
48 ac0df51d aliguori
# parse CC options first
49 ac0df51d aliguori
for opt do
50 ac0df51d aliguori
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
51 ac0df51d aliguori
  case "$opt" in
52 ac0df51d aliguori
  --cross-prefix=*) cross_prefix="$optarg"
53 ac0df51d aliguori
  ;;
54 ac0df51d aliguori
  --cc=*) cc="$optarg"
55 ac0df51d aliguori
  ;;
56 2ff6b91e Juan Quintela
  --cpu=*) cpu="$optarg"
57 2ff6b91e Juan Quintela
  ;;
58 e2a2ed06 Juan Quintela
  --extra-cflags=*) CFLAGS="$optarg $CFLAGS"
59 e2a2ed06 Juan Quintela
  ;;
60 e2a2ed06 Juan Quintela
  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
61 e2a2ed06 Juan Quintela
  ;;
62 50e7b1a0 Juan Quintela
  --sparc_cpu=*)
63 50e7b1a0 Juan Quintela
    sparc_cpu="$optarg"
64 50e7b1a0 Juan Quintela
    case $sparc_cpu in
65 ed968ff1 Juan Quintela
    v7|v8|v8plus|v8plusa)
66 50e7b1a0 Juan Quintela
      cpu="sparc"
67 50e7b1a0 Juan Quintela
    ;;
68 50e7b1a0 Juan Quintela
    v9)
69 50e7b1a0 Juan Quintela
      cpu="sparc64"
70 50e7b1a0 Juan Quintela
    ;;
71 50e7b1a0 Juan Quintela
    *)
72 50e7b1a0 Juan Quintela
      echo "undefined SPARC architecture. Exiting";
73 50e7b1a0 Juan Quintela
      exit 1
74 50e7b1a0 Juan Quintela
    ;;
75 50e7b1a0 Juan Quintela
    esac
76 50e7b1a0 Juan Quintela
  ;;
77 ac0df51d aliguori
  esac
78 ac0df51d aliguori
done
79 ac0df51d aliguori
# OS specific
80 ac0df51d aliguori
# Using uname is really, really broken.  Once we have the right set of checks
81 ac0df51d aliguori
# we can eliminate it's usage altogether
82 ac0df51d aliguori
83 ac0df51d aliguori
cc="${cross_prefix}${cc}"
84 ac0df51d aliguori
ar="${cross_prefix}${ar}"
85 7aa486fe Anthony Liguori
objcopy="${cross_prefix}${objcopy}"
86 7aa486fe Anthony Liguori
ld="${cross_prefix}${ld}"
87 ac0df51d aliguori
88 ac0df51d aliguori
# check that the C compiler works.
89 ac0df51d aliguori
cat > $TMPC <<EOF
90 ac0df51d aliguori
int main(void) {}
91 ac0df51d aliguori
EOF
92 ac0df51d aliguori
93 52166aa0 Juan Quintela
if compile_object ; then
94 ac0df51d aliguori
  : C compiler works ok
95 ac0df51d aliguori
else
96 ac0df51d aliguori
    echo "ERROR: \"$cc\" either does not exist or does not work"
97 ac0df51d aliguori
    exit 1
98 ac0df51d aliguori
fi
99 ac0df51d aliguori
100 ac0df51d aliguori
check_define() {
101 ac0df51d aliguori
cat > $TMPC <<EOF
102 ac0df51d aliguori
#if !defined($1)
103 ac0df51d aliguori
#error Not defined
104 ac0df51d aliguori
#endif
105 ac0df51d aliguori
int main(void) { return 0; }
106 ac0df51d aliguori
EOF
107 52166aa0 Juan Quintela
  compile_object
108 ac0df51d aliguori
}
109 ac0df51d aliguori
110 2ff6b91e Juan Quintela
if test ! -z "$cpu" ; then
111 2ff6b91e Juan Quintela
  # command line argument
112 2ff6b91e Juan Quintela
  :
113 2ff6b91e Juan Quintela
elif check_define __i386__ ; then
114 ac0df51d aliguori
  cpu="i386"
115 ac0df51d aliguori
elif check_define __x86_64__ ; then
116 ac0df51d aliguori
  cpu="x86_64"
117 3aa9bd6c blueswir1
elif check_define __sparc__ ; then
118 3aa9bd6c blueswir1
  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
119 3aa9bd6c blueswir1
  # They must be specified using --sparc_cpu
120 3aa9bd6c blueswir1
  if check_define __arch64__ ; then
121 3aa9bd6c blueswir1
    cpu="sparc64"
122 3aa9bd6c blueswir1
  else
123 3aa9bd6c blueswir1
    cpu="sparc"
124 3aa9bd6c blueswir1
  fi
125 fdf7ed96 malc
elif check_define _ARCH_PPC ; then
126 fdf7ed96 malc
  if check_define _ARCH_PPC64 ; then
127 fdf7ed96 malc
    cpu="ppc64"
128 fdf7ed96 malc
  else
129 fdf7ed96 malc
    cpu="ppc"
130 fdf7ed96 malc
  fi
131 ac0df51d aliguori
else
132 fdf7ed96 malc
  cpu=`uname -m`
133 ac0df51d aliguori
fi
134 ac0df51d aliguori
135 5327cf48 bellard
target_list=""
136 7d13299d bellard
case "$cpu" in
137 ea8f20f8 Juan Quintela
  alpha|cris|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|sparc64)
138 ea8f20f8 Juan Quintela
    cpu="$cpu"
139 ea8f20f8 Juan Quintela
  ;;
140 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
141 97a847bc bellard
    cpu="i386"
142 7d13299d bellard
  ;;
143 aaa5fa14 aurel32
  x86_64|amd64)
144 aaa5fa14 aurel32
    cpu="x86_64"
145 aaa5fa14 aurel32
  ;;
146 ba68055e bellard
  armv*b)
147 808c4954 bellard
    cpu="armv4b"
148 808c4954 bellard
  ;;
149 ba68055e bellard
  armv*l)
150 7d13299d bellard
    cpu="armv4l"
151 7d13299d bellard
  ;;
152 f54b3f92 aurel32
  parisc|parisc64)
153 f54b3f92 aurel32
    cpu="hppa"
154 f54b3f92 aurel32
  ;;
155 0e7b8a9f ths
  s390*)
156 fb3e5849 bellard
    cpu="s390"
157 fb3e5849 bellard
  ;;
158 3142255c blueswir1
  sparc|sun4[cdmuv])
159 ae228531 bellard
    cpu="sparc"
160 ae228531 bellard
  ;;
161 7d13299d bellard
  *)
162 7d13299d bellard
    cpu="unknown"
163 7d13299d bellard
  ;;
164 7d13299d bellard
esac
165 eb82284f Juan Quintela
brlapi="yes"
166 7d13299d bellard
gprof="no"
167 f8393946 aurel32
debug_tcg="no"
168 f3d08ee6 Paul Brook
debug="no"
169 03b4fe7d aliguori
sparse="no"
170 1625af87 aliguori
strip_opt="yes"
171 7d13299d bellard
bigendian="no"
172 67b915a5 bellard
mingw32="no"
173 67b915a5 bellard
EXESUF=""
174 443f1376 bellard
slirp="yes"
175 e0e6c8c0 aliguori
vde="yes"
176 102a52e4 bellard
fmod_lib=""
177 102a52e4 bellard
fmod_inc=""
178 2f6a1ab0 blueswir1
oss_lib=""
179 8d5d2d4c ths
vnc_tls="yes"
180 2f9606b3 aliguori
vnc_sasl="yes"
181 b1a550a0 pbrook
bsd="no"
182 5327cf48 bellard
linux="no"
183 d2c7c9b8 blueswir1
solaris="no"
184 c9ec1fe4 bellard
kqemu="no"
185 05c2a3e7 bellard
profiler="no"
186 5b0753e0 bellard
cocoa="no"
187 0a8e90f4 pbrook
softmmu="yes"
188 831b7825 ths
linux_user="no"
189 831b7825 ths
darwin_user="no"
190 84778508 blueswir1
bsd_user="no"
191 379f6698 Paul Brook
guest_base=""
192 70ec5dc0 Anthony Liguori
build_docs="yes"
193 c5937220 pbrook
uname_release=""
194 4d3b6f6e balrog
curses="yes"
195 769ce76d Alexander Graf
curl="yes"
196 e5d355d1 aliguori
pthread="yes"
197 414f0dab blueswir1
aio="yes"
198 e5d355d1 aliguori
io_thread="no"
199 bd0c5661 pbrook
nptl="yes"
200 8ff9cbf7 malc
mixemu="no"
201 fb599c9a balrog
bluez="yes"
202 dff84034 Jan Kiszka
kvm="no"
203 eac30262 aliguori
kerneldir=""
204 b29fe3ed malc
aix="no"
205 77755340 ths
blobs="yes"
206 f652e6af aurel32
fdt="yes"
207 f92f8afe Anthony Liguori
sdl="yes"
208 e37630ca aliguori
xen="yes"
209 4a19f1ec pbrook
pkgversion=""
210 7d13299d bellard
211 7d13299d bellard
# OS specific
212 ac0df51d aliguori
if check_define __linux__ ; then
213 ac0df51d aliguori
  targetos="Linux"
214 ac0df51d aliguori
elif check_define _WIN32 ; then
215 ac0df51d aliguori
  targetos='MINGW32'
216 169dc5d3 blueswir1
elif check_define __OpenBSD__ ; then
217 169dc5d3 blueswir1
  targetos='OpenBSD'
218 169dc5d3 blueswir1
elif check_define __sun__ ; then
219 169dc5d3 blueswir1
  targetos='SunOS'
220 ac0df51d aliguori
else
221 ac0df51d aliguori
  targetos=`uname -s`
222 ac0df51d aliguori
fi
223 7d13299d bellard
case $targetos in
224 c326e0af bellard
CYGWIN*)
225 c326e0af bellard
mingw32="yes"
226 0c439cbf Juan Quintela
CFLAGS="-mno-cygwin $CFLAGS"
227 c2de5c91 malc
audio_possible_drivers="sdl"
228 c326e0af bellard
;;
229 67b915a5 bellard
MINGW32*)
230 67b915a5 bellard
mingw32="yes"
231 c2de5c91 malc
audio_possible_drivers="dsound sdl fmod"
232 67b915a5 bellard
;;
233 5c40d2bd ths
GNU/kFreeBSD)
234 0c58ac1c malc
audio_drv_list="oss"
235 f34af52c aurel32
audio_possible_drivers="oss sdl esd pa"
236 5c40d2bd ths
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
237 5c40d2bd ths
    kqemu="yes"
238 5c40d2bd ths
fi
239 5c40d2bd ths
;;
240 7d3505c5 bellard
FreeBSD)
241 7d3505c5 bellard
bsd="yes"
242 0c58ac1c malc
audio_drv_list="oss"
243 f34af52c aurel32
audio_possible_drivers="oss sdl esd pa"
244 e99f9060 bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
245 07f4ddbf bellard
    kqemu="yes"
246 07f4ddbf bellard
fi
247 7d3505c5 bellard
;;
248 c5e97233 blueswir1
DragonFly)
249 c5e97233 blueswir1
bsd="yes"
250 c5e97233 blueswir1
audio_drv_list="oss"
251 c5e97233 blueswir1
audio_possible_drivers="oss sdl esd pa"
252 c5e97233 blueswir1
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
253 c5e97233 blueswir1
    kqemu="yes"
254 c5e97233 blueswir1
fi
255 c5e97233 blueswir1
aio="no"
256 c5e97233 blueswir1
;;
257 7d3505c5 bellard
NetBSD)
258 7d3505c5 bellard
bsd="yes"
259 0c58ac1c malc
audio_drv_list="oss"
260 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
261 8ef92a88 blueswir1
oss_lib="-lossaudio"
262 7d3505c5 bellard
;;
263 7d3505c5 bellard
OpenBSD)
264 7d3505c5 bellard
bsd="yes"
265 0c58ac1c malc
audio_drv_list="oss"
266 c2de5c91 malc
audio_possible_drivers="oss sdl esd"
267 2f6a1ab0 blueswir1
oss_lib="-lossaudio"
268 7d3505c5 bellard
;;
269 83fb7adf bellard
Darwin)
270 83fb7adf bellard
bsd="yes"
271 83fb7adf bellard
darwin="yes"
272 1b0f9cc2 aliguori
# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
273 aab8588a malc
if [ "$cpu" = "i386" ] ; then
274 aab8588a malc
    is_x86_64=`sysctl -n hw.optional.x86_64`
275 aab8588a malc
    [ "$is_x86_64" = "1" ] && cpu=x86_64
276 1b0f9cc2 aliguori
fi
277 1b0f9cc2 aliguori
if [ "$cpu" = "x86_64" ] ; then
278 0c439cbf Juan Quintela
    CFLAGS="-arch x86_64 $CFLAGS"
279 0c439cbf Juan Quintela
    LDFLAGS="-arch x86_64 $LDFLAGS"
280 1b0f9cc2 aliguori
else
281 0c439cbf Juan Quintela
    CFLAGS="-mdynamic-no-pic $CFLAGS"
282 1b0f9cc2 aliguori
fi
283 831b7825 ths
darwin_user="yes"
284 fd677642 ths
cocoa="yes"
285 0c58ac1c malc
audio_drv_list="coreaudio"
286 c2de5c91 malc
audio_possible_drivers="coreaudio sdl fmod"
287 0c439cbf Juan Quintela
LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
288 83fb7adf bellard
;;
289 ec530c81 bellard
SunOS)
290 c2b84fab ths
    solaris="yes"
291 c2b84fab ths
    make="gmake"
292 c2b84fab ths
    install="ginstall"
293 0475a5ca ths
    needs_libsunmath="no"
294 c2b84fab ths
    solarisrev=`uname -r | cut -f2 -d.`
295 ef18c883 ths
    # have to select again, because `uname -m` returns i86pc
296 ef18c883 ths
    # even on an x86_64 box.
297 ef18c883 ths
    solariscpu=`isainfo -k`
298 ef18c883 ths
    if test "${solariscpu}" = "amd64" ; then
299 ef18c883 ths
        cpu="x86_64"
300 ef18c883 ths
    fi
301 c2b84fab ths
    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
302 0475a5ca ths
        if test "$solarisrev" -le 9 ; then
303 0475a5ca ths
            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
304 0475a5ca ths
                needs_libsunmath="yes"
305 0475a5ca ths
            else
306 0475a5ca ths
                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
307 0475a5ca ths
                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
308 0475a5ca ths
                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
309 0475a5ca ths
                echo "Studio 11 can be downloaded from www.sun.com."
310 0475a5ca ths
                exit 1
311 0475a5ca ths
            fi
312 0475a5ca ths
        fi
313 0475a5ca ths
        if test "$solarisrev" -ge 9 ; then
314 c2b84fab ths
            kqemu="yes"
315 c2b84fab ths
        fi
316 86b2bd93 ths
    fi
317 6b4d2ba1 ths
    if test -f /usr/include/sys/soundcard.h ; then
318 0c58ac1c malc
        audio_drv_list="oss"
319 6b4d2ba1 ths
    fi
320 c2de5c91 malc
    audio_possible_drivers="oss sdl"
321 0c439cbf Juan Quintela
    CFLAGS="-std=gnu99 $CFLAGS"
322 86b2bd93 ths
;;
323 b29fe3ed malc
AIX)
324 b29fe3ed malc
aix="yes"
325 b29fe3ed malc
make="gmake"
326 b29fe3ed malc
;;
327 1d14ffa9 bellard
*)
328 0c58ac1c malc
audio_drv_list="oss"
329 b8e59f18 malc
audio_possible_drivers="oss alsa sdl esd pa"
330 5327cf48 bellard
linux="yes"
331 831b7825 ths
linux_user="yes"
332 68063649 blueswir1
usb="linux"
333 dff84034 Jan Kiszka
kvm="yes"
334 07f4ddbf bellard
if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
335 c9ec1fe4 bellard
    kqemu="yes"
336 c2de5c91 malc
    audio_possible_drivers="$audio_possible_drivers fmod"
337 c9ec1fe4 bellard
fi
338 fb065187 bellard
;;
339 7d13299d bellard
esac
340 7d13299d bellard
341 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
342 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
343 83fb7adf bellard
    make="gmake"
344 68063649 blueswir1
    usb="bsd"
345 83fb7adf bellard
  fi
346 84778508 blueswir1
  bsd_user="yes"
347 7d3505c5 bellard
fi
348 7d3505c5 bellard
349 3457a3f8 Juan Quintela
if test "$mingw32" = "yes" ; then
350 fecde40a Juan Quintela
  if [ "$cpu" = "i386" ] ; then
351 fecde40a Juan Quintela
    kqemu="yes"
352 fecde40a Juan Quintela
  fi
353 3457a3f8 Juan Quintela
  EXESUF=".exe"
354 3457a3f8 Juan Quintela
  CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
355 3457a3f8 Juan Quintela
fi
356 3457a3f8 Juan Quintela
357 7d13299d bellard
# find source path
358 ad064840 pbrook
source_path=`dirname "$0"`
359 59faef3a balrog
source_path_used="no"
360 59faef3a balrog
workdir=`pwd`
361 ad064840 pbrook
if [ -z "$source_path" ]; then
362 59faef3a balrog
    source_path=$workdir
363 ad064840 pbrook
else
364 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
365 7d13299d bellard
fi
366 724db118 pbrook
[ -f "$workdir/vl.c" ] || source_path_used="yes"
367 7d13299d bellard
368 487fefdb Anthony Liguori
werror=""
369 85aa5189 bellard
370 7d13299d bellard
for opt do
371 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
372 7d13299d bellard
  case "$opt" in
373 2efc3265 bellard
  --help|-h) show_help=yes
374 2efc3265 bellard
  ;;
375 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
376 7d13299d bellard
  ;;
377 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
378 32ce6337 bellard
  ;;
379 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
380 ad064840 pbrook
  source_path_used="yes"
381 7d13299d bellard
  ;;
382 ac0df51d aliguori
  --cross-prefix=*)
383 7d13299d bellard
  ;;
384 ac0df51d aliguori
  --cc=*)
385 7d13299d bellard
  ;;
386 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
387 83469015 bellard
  ;;
388 b1a550a0 pbrook
  --make=*) make="$optarg"
389 7d13299d bellard
  ;;
390 6a882643 pbrook
  --install=*) install="$optarg"
391 6a882643 pbrook
  ;;
392 e2a2ed06 Juan Quintela
  --extra-cflags=*)
393 7d13299d bellard
  ;;
394 e2a2ed06 Juan Quintela
  --extra-ldflags=*)
395 7d13299d bellard
  ;;
396 2ff6b91e Juan Quintela
  --cpu=*)
397 7d13299d bellard
  ;;
398 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
399 de83cd02 bellard
  ;;
400 7d13299d bellard
  --enable-gprof) gprof="yes"
401 7d13299d bellard
  ;;
402 43ce4dfe bellard
  --static) static="yes"
403 43ce4dfe bellard
  ;;
404 97a847bc bellard
  --disable-sdl) sdl="no"
405 97a847bc bellard
  ;;
406 0c58ac1c malc
  --fmod-lib=*) fmod_lib="$optarg"
407 1d14ffa9 bellard
  ;;
408 c2de5c91 malc
  --fmod-inc=*) fmod_inc="$optarg"
409 c2de5c91 malc
  ;;
410 2f6a1ab0 blueswir1
  --oss-lib=*) oss_lib="$optarg"
411 2f6a1ab0 blueswir1
  ;;
412 2fa7d3bf malc
  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
413 102a52e4 bellard
  ;;
414 0c58ac1c malc
  --audio-drv-list=*) audio_drv_list="$optarg"
415 102a52e4 bellard
  ;;
416 f8393946 aurel32
  --enable-debug-tcg) debug_tcg="yes"
417 f8393946 aurel32
  ;;
418 f8393946 aurel32
  --disable-debug-tcg) debug_tcg="no"
419 f8393946 aurel32
  ;;
420 f3d08ee6 Paul Brook
  --enable-debug)
421 f3d08ee6 Paul Brook
      # Enable debugging options that aren't excessively noisy
422 f3d08ee6 Paul Brook
      debug_tcg="yes"
423 f3d08ee6 Paul Brook
      debug="yes"
424 f3d08ee6 Paul Brook
      strip_opt="no"
425 f3d08ee6 Paul Brook
  ;;
426 03b4fe7d aliguori
  --enable-sparse) sparse="yes"
427 03b4fe7d aliguori
  ;;
428 03b4fe7d aliguori
  --disable-sparse) sparse="no"
429 03b4fe7d aliguori
  ;;
430 1625af87 aliguori
  --disable-strip) strip_opt="no"
431 1625af87 aliguori
  ;;
432 8d5d2d4c ths
  --disable-vnc-tls) vnc_tls="no"
433 8d5d2d4c ths
  ;;
434 2f9606b3 aliguori
  --disable-vnc-sasl) vnc_sasl="no"
435 2f9606b3 aliguori
  ;;
436 443f1376 bellard
  --disable-slirp) slirp="no"
437 1d14ffa9 bellard
  ;;
438 e0e6c8c0 aliguori
  --disable-vde) vde="no"
439 8a16d273 ths
  ;;
440 c9ec1fe4 bellard
  --disable-kqemu) kqemu="no"
441 1d14ffa9 bellard
  ;;
442 e37630ca aliguori
  --disable-xen) xen="no"
443 e37630ca aliguori
  ;;
444 2e4d9fb1 aurel32
  --disable-brlapi) brlapi="no"
445 2e4d9fb1 aurel32
  ;;
446 fb599c9a balrog
  --disable-bluez) bluez="no"
447 fb599c9a balrog
  ;;
448 7ba1e619 aliguori
  --disable-kvm) kvm="no"
449 7ba1e619 aliguori
  ;;
450 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
451 05c2a3e7 bellard
  ;;
452 c2de5c91 malc
  --enable-cocoa)
453 c2de5c91 malc
      cocoa="yes" ;
454 c2de5c91 malc
      sdl="no" ;
455 c2de5c91 malc
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
456 1d14ffa9 bellard
  ;;
457 cad25d69 pbrook
  --disable-system) softmmu="no"
458 0a8e90f4 pbrook
  ;;
459 cad25d69 pbrook
  --enable-system) softmmu="yes"
460 0a8e90f4 pbrook
  ;;
461 831b7825 ths
  --disable-linux-user) linux_user="no"
462 0a8e90f4 pbrook
  ;;
463 831b7825 ths
  --enable-linux-user) linux_user="yes"
464 831b7825 ths
  ;;
465 831b7825 ths
  --disable-darwin-user) darwin_user="no"
466 831b7825 ths
  ;;
467 831b7825 ths
  --enable-darwin-user) darwin_user="yes"
468 0a8e90f4 pbrook
  ;;
469 84778508 blueswir1
  --disable-bsd-user) bsd_user="no"
470 84778508 blueswir1
  ;;
471 84778508 blueswir1
  --enable-bsd-user) bsd_user="yes"
472 84778508 blueswir1
  ;;
473 379f6698 Paul Brook
  --enable-guest-base) guest_base="yes"
474 379f6698 Paul Brook
  ;;
475 379f6698 Paul Brook
  --disable-guest-base) guest_base="no"
476 379f6698 Paul Brook
  ;;
477 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
478 c5937220 pbrook
  ;;
479 3142255c blueswir1
  --sparc_cpu=*)
480 3142255c blueswir1
  ;;
481 85aa5189 bellard
  --enable-werror) werror="yes"
482 85aa5189 bellard
  ;;
483 85aa5189 bellard
  --disable-werror) werror="no"
484 85aa5189 bellard
  ;;
485 4d3b6f6e balrog
  --disable-curses) curses="no"
486 4d3b6f6e balrog
  ;;
487 769ce76d Alexander Graf
  --disable-curl) curl="no"
488 769ce76d Alexander Graf
  ;;
489 bd0c5661 pbrook
  --disable-nptl) nptl="no"
490 bd0c5661 pbrook
  ;;
491 8ff9cbf7 malc
  --enable-mixemu) mixemu="yes"
492 8ff9cbf7 malc
  ;;
493 e5d355d1 aliguori
  --disable-pthread) pthread="no"
494 e5d355d1 aliguori
  ;;
495 414f0dab blueswir1
  --disable-aio) aio="no"
496 414f0dab blueswir1
  ;;
497 e5d355d1 aliguori
  --enable-io-thread) io_thread="yes"
498 e5d355d1 aliguori
  ;;
499 77755340 ths
  --disable-blobs) blobs="no"
500 77755340 ths
  ;;
501 eac30262 aliguori
  --kerneldir=*) kerneldir="$optarg"
502 eac30262 aliguori
  ;;
503 4a19f1ec pbrook
  --with-pkgversion=*) pkgversion=" ($optarg)"
504 4a19f1ec pbrook
  ;;
505 70ec5dc0 Anthony Liguori
  --disable-docs) build_docs="no"
506 70ec5dc0 Anthony Liguori
  ;;
507 7f1559c6 balrog
  *) echo "ERROR: unknown option $opt"; show_help="yes"
508 7f1559c6 balrog
  ;;
509 7d13299d bellard
  esac
510 7d13299d bellard
done
511 7d13299d bellard
512 3142255c blueswir1
#
513 3142255c blueswir1
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
514 0c439cbf Juan Quintela
# CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
515 3142255c blueswir1
#
516 379f6698 Paul Brook
host_guest_base="no"
517 40293e58 bellard
case "$cpu" in
518 ed968ff1 Juan Quintela
    sparc) case $sparc_cpu in
519 ed968ff1 Juan Quintela
           v7|v8)
520 ed968ff1 Juan Quintela
             CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS"
521 ed968ff1 Juan Quintela
           ;;
522 ed968ff1 Juan Quintela
           v8plus|v8plusa)
523 ed968ff1 Juan Quintela
             CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
524 ed968ff1 Juan Quintela
           ;;
525 ed968ff1 Juan Quintela
           *) # sparc_cpu not defined in the command line
526 ed968ff1 Juan Quintela
             CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $CFLAGS"
527 ed968ff1 Juan Quintela
           esac
528 ed968ff1 Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
529 ed968ff1 Juan Quintela
           CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $CFLAGS"
530 762e8230 blueswir1
           if test "$solaris" = "no" ; then
531 ed968ff1 Juan Quintela
             CFLAGS="-ffixed-g1 -ffixed-g6 $CFLAGS"
532 762e8230 blueswir1
           fi
533 3142255c blueswir1
           ;;
534 ed968ff1 Juan Quintela
    sparc64)
535 ed968ff1 Juan Quintela
           CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $CFLAGS"
536 ed968ff1 Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
537 ed968ff1 Juan Quintela
           CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
538 ed968ff1 Juan Quintela
           if test "$solaris" != "no" ; then
539 ed968ff1 Juan Quintela
             CFLAGS="-ffixed-g1 $CFLAGS"
540 762e8230 blueswir1
           fi
541 3142255c blueswir1
           ;;
542 76d83bde ths
    s390)
543 0c439cbf Juan Quintela
           CFLAGS="-march=z900 $CFLAGS"
544 76d83bde ths
           ;;
545 40293e58 bellard
    i386)
546 0c439cbf Juan Quintela
           CFLAGS="-m32 $CFLAGS"
547 0c439cbf Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
548 379f6698 Paul Brook
           host_guest_base="yes"
549 40293e58 bellard
           ;;
550 40293e58 bellard
    x86_64)
551 0c439cbf Juan Quintela
           CFLAGS="-m64 $CFLAGS"
552 0c439cbf Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
553 379f6698 Paul Brook
           host_guest_base="yes"
554 379f6698 Paul Brook
           ;;
555 379f6698 Paul Brook
    arm*)
556 379f6698 Paul Brook
           host_guest_base="yes"
557 40293e58 bellard
           ;;
558 f6548c0a malc
    ppc*)
559 f6548c0a malc
           host_guest_base="yes"
560 f6548c0a malc
           ;;
561 3142255c blueswir1
esac
562 3142255c blueswir1
563 379f6698 Paul Brook
[ -z "$guest_base" ] && guest_base="$host_guest_base"
564 379f6698 Paul Brook
565 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
566 af5db58e pbrook
cat << EOF
567 af5db58e pbrook
568 af5db58e pbrook
Usage: configure [options]
569 af5db58e pbrook
Options: [defaults in brackets after descriptions]
570 af5db58e pbrook
571 af5db58e pbrook
EOF
572 af5db58e pbrook
echo "Standard options:"
573 af5db58e pbrook
echo "  --help                   print this message"
574 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
575 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
576 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
577 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
578 af5db58e pbrook
echo ""
579 af5db58e pbrook
echo "kqemu kernel acceleration support:"
580 af5db58e pbrook
echo "  --disable-kqemu          disable kqemu support"
581 af5db58e pbrook
echo ""
582 af5db58e pbrook
echo "Advanced options (experts only):"
583 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
584 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
585 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
586 af5db58e pbrook
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
587 e3fc14c3 Jan Kiszka
echo "  --extra-cflags=CFLAGS    append extra C compiler flags CFLAGS"
588 e3fc14c3 Jan Kiszka
echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
589 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
590 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
591 af5db58e pbrook
echo "  --static                 enable static build [$static]"
592 f8393946 aurel32
echo "  --enable-debug-tcg       enable TCG debugging"
593 f8393946 aurel32
echo "  --disable-debug-tcg      disable TCG debugging (default)"
594 09695a4a Stefan Weil
echo "  --enable-debug           enable common debug build options"
595 890b1658 aliguori
echo "  --enable-sparse          enable sparse checker"
596 890b1658 aliguori
echo "  --disable-sparse         disable sparse checker (default)"
597 1625af87 aliguori
echo "  --disable-strip          disable stripping binaries"
598 85aa5189 bellard
echo "  --disable-werror         disable compilation abort on warning"
599 fe8f78e4 balrog
echo "  --disable-sdl            disable SDL"
600 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
601 c2de5c91 malc
echo "  --audio-drv-list=LIST    set audio drivers list:"
602 c2de5c91 malc
echo "                           Available drivers: $audio_possible_drivers"
603 4c9b53e3 malc
echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
604 4c9b53e3 malc
echo "                           Available cards: $audio_possible_cards"
605 8ff9cbf7 malc
echo "  --enable-mixemu          enable mixer emulation"
606 e37630ca aliguori
echo "  --disable-xen            disable xen backend driver support"
607 2e4d9fb1 aurel32
echo "  --disable-brlapi         disable BrlAPI"
608 8d5d2d4c ths
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
609 2f9606b3 aliguori
echo "  --disable-vnc-sasl       disable SASL encryption for VNC server"
610 af896aaa pbrook
echo "  --disable-curses         disable curses output"
611 769ce76d Alexander Graf
echo "  --disable-curl           disable curl connectivity"
612 fb599c9a balrog
echo "  --disable-bluez          disable bluez stack connectivity"
613 7ba1e619 aliguori
echo "  --disable-kvm            disable KVM acceleration support"
614 bd0c5661 pbrook
echo "  --disable-nptl           disable usermode NPTL support"
615 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
616 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
617 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
618 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
619 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
620 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
621 84778508 blueswir1
echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
622 84778508 blueswir1
echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
623 379f6698 Paul Brook
echo "  --enable-guest-base      enable GUEST_BASE support for usermode"
624 379f6698 Paul Brook
echo "                           emulation targets"
625 379f6698 Paul Brook
echo "  --disable-guest-base     disable GUEST_BASE support"
626 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
627 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
628 2f6a1ab0 blueswir1
echo "  --oss-lib                path to OSS library"
629 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
630 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
631 e0e6c8c0 aliguori
echo "  --disable-vde            disable support for vde network"
632 e5d355d1 aliguori
echo "  --disable-pthread        disable pthread support"
633 414f0dab blueswir1
echo "  --disable-aio            disable AIO support"
634 e5d355d1 aliguori
echo "  --enable-io-thread       enable IO thread"
635 77755340 ths
echo "  --disable-blobs          disable installing provided firmware blobs"
636 eac30262 aliguori
echo "  --kerneldir=PATH         look for kernel includes in PATH"
637 af5db58e pbrook
echo ""
638 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
639 af5db58e pbrook
exit 1
640 af5db58e pbrook
fi
641 af5db58e pbrook
642 03b4fe7d aliguori
if test ! -x "$(which cgcc 2>/dev/null)"; then
643 03b4fe7d aliguori
    sparse="no"
644 03b4fe7d aliguori
fi
645 03b4fe7d aliguori
646 ec530c81 bellard
#
647 ec530c81 bellard
# Solaris specific configure tool chain decisions
648 ec530c81 bellard
#
649 ec530c81 bellard
if test "$solaris" = "yes" ; then
650 ec530c81 bellard
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
651 ec530c81 bellard
  if test -z "$solinst" ; then
652 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
653 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
654 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
655 ec530c81 bellard
    exit 1
656 ec530c81 bellard
  fi
657 ec530c81 bellard
  if test "$solinst" = "/usr/sbin/install" ; then
658 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
659 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
660 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
661 ec530c81 bellard
    exit 1
662 ec530c81 bellard
  fi
663 ec530c81 bellard
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
664 ec530c81 bellard
  if test -z "$sol_ar" ; then
665 ec530c81 bellard
    echo "Error: No path includes ar"
666 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
667 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
668 ec530c81 bellard
    fi
669 ec530c81 bellard
    exit 1
670 ec530c81 bellard
  fi
671 5fafdf24 ths
fi
672 ec530c81 bellard
673 ec530c81 bellard
674 5327cf48 bellard
if test -z "$target_list" ; then
675 5327cf48 bellard
# these targets are portable
676 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
677 2408a527 aurel32
        target_list="\
678 2408a527 aurel32
i386-softmmu \
679 2408a527 aurel32
x86_64-softmmu \
680 2408a527 aurel32
arm-softmmu \
681 2408a527 aurel32
cris-softmmu \
682 2408a527 aurel32
m68k-softmmu \
683 72b675ca Edgar E. Iglesias
microblaze-softmmu \
684 2408a527 aurel32
mips-softmmu \
685 2408a527 aurel32
mipsel-softmmu \
686 2408a527 aurel32
mips64-softmmu \
687 2408a527 aurel32
mips64el-softmmu \
688 2408a527 aurel32
ppc-softmmu \
689 2408a527 aurel32
ppcemb-softmmu \
690 2408a527 aurel32
ppc64-softmmu \
691 2408a527 aurel32
sh4-softmmu \
692 2408a527 aurel32
sh4eb-softmmu \
693 2408a527 aurel32
sparc-softmmu \
694 1b64fcae Igor V. Kovalenko
sparc64-softmmu \
695 2408a527 aurel32
"
696 0a8e90f4 pbrook
    fi
697 5327cf48 bellard
# the following are Linux specific
698 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
699 2408a527 aurel32
        target_list="${target_list}\
700 2408a527 aurel32
i386-linux-user \
701 2408a527 aurel32
x86_64-linux-user \
702 2408a527 aurel32
alpha-linux-user \
703 2408a527 aurel32
arm-linux-user \
704 2408a527 aurel32
armeb-linux-user \
705 2408a527 aurel32
cris-linux-user \
706 2408a527 aurel32
m68k-linux-user \
707 72b675ca Edgar E. Iglesias
microblaze-linux-user \
708 2408a527 aurel32
mips-linux-user \
709 2408a527 aurel32
mipsel-linux-user \
710 2408a527 aurel32
ppc-linux-user \
711 2408a527 aurel32
ppc64-linux-user \
712 2408a527 aurel32
ppc64abi32-linux-user \
713 2408a527 aurel32
sh4-linux-user \
714 2408a527 aurel32
sh4eb-linux-user \
715 2408a527 aurel32
sparc-linux-user \
716 2408a527 aurel32
sparc64-linux-user \
717 2408a527 aurel32
sparc32plus-linux-user \
718 2408a527 aurel32
"
719 831b7825 ths
    fi
720 831b7825 ths
# the following are Darwin specific
721 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
722 6cdc7375 malc
        target_list="$target_list i386-darwin-user ppc-darwin-user "
723 5327cf48 bellard
    fi
724 84778508 blueswir1
# the following are BSD specific
725 84778508 blueswir1
    if [ "$bsd_user" = "yes" ] ; then
726 84778508 blueswir1
        target_list="${target_list}\
727 31fc12df blueswir1
i386-bsd-user \
728 31fc12df blueswir1
x86_64-bsd-user \
729 31fc12df blueswir1
sparc-bsd-user \
730 84778508 blueswir1
sparc64-bsd-user \
731 84778508 blueswir1
"
732 84778508 blueswir1
    fi
733 6e20a45f bellard
else
734 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
735 5327cf48 bellard
fi
736 0a8e90f4 pbrook
if test -z "$target_list" ; then
737 0a8e90f4 pbrook
    echo "No targets enabled"
738 0a8e90f4 pbrook
    exit 1
739 0a8e90f4 pbrook
fi
740 5327cf48 bellard
741 7d13299d bellard
if test -z "$cross_prefix" ; then
742 7d13299d bellard
743 7d13299d bellard
# ---
744 7d13299d bellard
# big/little endian test
745 7d13299d bellard
cat > $TMPC << EOF
746 7d13299d bellard
#include <inttypes.h>
747 7d13299d bellard
int main(int argc, char ** argv){
748 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
749 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
750 7d13299d bellard
}
751 7d13299d bellard
EOF
752 7d13299d bellard
753 52166aa0 Juan Quintela
if compile_prog "" "" ; then
754 7d13299d bellard
$TMPE && bigendian="yes"
755 7d13299d bellard
else
756 7d13299d bellard
echo big/little test failed
757 7d13299d bellard
fi
758 7d13299d bellard
759 7d13299d bellard
else
760 7d13299d bellard
761 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
762 ea8f20f8 Juan Quintela
case "$cpu" in
763 ea8f20f8 Juan Quintela
  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
764 ea8f20f8 Juan Quintela
    bigendian=yes
765 ea8f20f8 Juan Quintela
  ;;
766 ea8f20f8 Juan Quintela
esac
767 7d13299d bellard
768 7d13299d bellard
fi
769 7d13299d bellard
770 b6853697 bellard
# host long bits test
771 b6853697 bellard
hostlongbits="32"
772 ea8f20f8 Juan Quintela
case "$cpu" in
773 ea8f20f8 Juan Quintela
  x86_64|alpha|ia64|sparc64|ppc64)
774 ea8f20f8 Juan Quintela
    hostlongbits=64
775 ea8f20f8 Juan Quintela
  ;;
776 ea8f20f8 Juan Quintela
esac
777 b6853697 bellard
778 bd0c5661 pbrook
# Check host NPTL support
779 bd0c5661 pbrook
cat > $TMPC <<EOF
780 bd0c5661 pbrook
#include <sched.h>
781 30813cea pbrook
#include <linux/futex.h>
782 bd0c5661 pbrook
void foo()
783 bd0c5661 pbrook
{
784 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
785 bd0c5661 pbrook
#error bork
786 bd0c5661 pbrook
#endif
787 bd0c5661 pbrook
}
788 bd0c5661 pbrook
EOF
789 bd0c5661 pbrook
790 52166aa0 Juan Quintela
if compile_object ; then
791 bd0c5661 pbrook
  :
792 bd0c5661 pbrook
else
793 bd0c5661 pbrook
   nptl="no"
794 bd0c5661 pbrook
fi
795 bd0c5661 pbrook
796 11d9f695 bellard
##########################################
797 ac62922e balrog
# zlib check
798 ac62922e balrog
799 ac62922e balrog
cat > $TMPC << EOF
800 ac62922e balrog
#include <zlib.h>
801 ac62922e balrog
int main(void) { zlibVersion(); return 0; }
802 ac62922e balrog
EOF
803 52166aa0 Juan Quintela
if compile_prog "" "-lz" ; then
804 ac62922e balrog
    :
805 ac62922e balrog
else
806 ac62922e balrog
    echo
807 ac62922e balrog
    echo "Error: zlib check failed"
808 ac62922e balrog
    echo "Make sure to have the zlib libs and headers installed."
809 ac62922e balrog
    echo
810 ac62922e balrog
    exit 1
811 ac62922e balrog
fi
812 ac62922e balrog
813 ac62922e balrog
##########################################
814 e37630ca aliguori
# xen probe
815 e37630ca aliguori
816 e37630ca aliguori
if test "$xen" = "yes" ; then
817 b2266bee Juan Quintela
  xen_libs="-lxenstore -lxenctrl -lxenguest"
818 b2266bee Juan Quintela
  cat > $TMPC <<EOF
819 e37630ca aliguori
#include <xenctrl.h>
820 e37630ca aliguori
#include <xs.h>
821 df7a607b Christoph Egger
int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
822 e37630ca aliguori
EOF
823 52166aa0 Juan Quintela
  if compile_prog "" "$xen_libs" ; then
824 b2266bee Juan Quintela
    :
825 b2266bee Juan Quintela
  else
826 b2266bee Juan Quintela
    xen="no"
827 b2266bee Juan Quintela
  fi
828 e37630ca aliguori
fi
829 e37630ca aliguori
830 e37630ca aliguori
##########################################
831 11d9f695 bellard
# SDL probe
832 11d9f695 bellard
833 11d9f695 bellard
sdl_too_old=no
834 11d9f695 bellard
835 f92f8afe Anthony Liguori
if test "$sdl" = "yes" ; then
836 ac119f9d Juan Quintela
  sdl=no
837 ac119f9d Juan Quintela
  cat > $TMPC << EOF
838 11d9f695 bellard
#include <SDL.h>
839 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
840 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
841 11d9f695 bellard
EOF
842 ac119f9d Juan Quintela
  sdl_cflags=`sdl-config --cflags 2> /dev/null`
843 ac119f9d Juan Quintela
  sdl_libs=`sdl-config --libs 2> /dev/null`
844 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
845 ac119f9d Juan Quintela
    _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
846 ac119f9d Juan Quintela
    if test "$_sdlversion" -lt 121 ; then
847 ac119f9d Juan Quintela
      sdl_too_old=yes
848 ac119f9d Juan Quintela
    else
849 ac119f9d Juan Quintela
      if test "$cocoa" = "no" ; then
850 ac119f9d Juan Quintela
        sdl=yes
851 ac119f9d Juan Quintela
      fi
852 ac119f9d Juan Quintela
    fi
853 cd01b4a3 aliguori
854 ac119f9d Juan Quintela
    # static link with sdl ?
855 ac119f9d Juan Quintela
    if test "$sdl" = "yes" -a "$static" = "yes" ; then
856 ac119f9d Juan Quintela
      sdl_libs=`sdl-config --static-libs 2>/dev/null`
857 ac119f9d Juan Quintela
      if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then
858 ac119f9d Juan Quintela
         sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
859 ac119f9d Juan Quintela
         sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
860 ac119f9d Juan Quintela
      fi
861 52166aa0 Juan Quintela
      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
862 ac119f9d Juan Quintela
	:
863 ac119f9d Juan Quintela
      else
864 ac119f9d Juan Quintela
        sdl=no
865 ac119f9d Juan Quintela
      fi
866 ac119f9d Juan Quintela
    fi # static link
867 ac119f9d Juan Quintela
  fi # sdl compile test
868 a68551bc Juan Quintela
fi
869 11d9f695 bellard
870 5368a422 aliguori
if test "$sdl" = "yes" ; then
871 ac119f9d Juan Quintela
  cat > $TMPC <<EOF
872 5368a422 aliguori
#include <SDL.h>
873 5368a422 aliguori
#if defined(SDL_VIDEO_DRIVER_X11)
874 5368a422 aliguori
#include <X11/XKBlib.h>
875 5368a422 aliguori
#else
876 5368a422 aliguori
#error No x11 support
877 5368a422 aliguori
#endif
878 5368a422 aliguori
int main(void) { return 0; }
879 5368a422 aliguori
EOF
880 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
881 ac119f9d Juan Quintela
    sdl_libs="$sdl_libs -lX11"
882 ac119f9d Juan Quintela
  fi
883 5368a422 aliguori
fi
884 5368a422 aliguori
885 8f28f3fb ths
##########################################
886 8d5d2d4c ths
# VNC TLS detection
887 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
888 ae6b5e5a aliguori
cat > $TMPC <<EOF
889 ae6b5e5a aliguori
#include <gnutls/gnutls.h>
890 ae6b5e5a aliguori
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
891 ae6b5e5a aliguori
EOF
892 ae6b5e5a aliguori
    vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
893 ae6b5e5a aliguori
    vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
894 52166aa0 Juan Quintela
    if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
895 ae6b5e5a aliguori
	:
896 ae6b5e5a aliguori
    else
897 ae6b5e5a aliguori
	vnc_tls="no"
898 ae6b5e5a aliguori
    fi
899 8d5d2d4c ths
fi
900 8d5d2d4c ths
901 8d5d2d4c ths
##########################################
902 2f9606b3 aliguori
# VNC SASL detection
903 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
904 2f9606b3 aliguori
cat > $TMPC <<EOF
905 2f9606b3 aliguori
#include <sasl/sasl.h>
906 2f9606b3 aliguori
#include <stdio.h>
907 2f9606b3 aliguori
int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
908 2f9606b3 aliguori
EOF
909 2f9606b3 aliguori
    # Assuming Cyrus-SASL installed in /usr prefix
910 2f9606b3 aliguori
    vnc_sasl_cflags=""
911 2f9606b3 aliguori
    vnc_sasl_libs="-lsasl2"
912 52166aa0 Juan Quintela
    if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
913 2f9606b3 aliguori
	:
914 2f9606b3 aliguori
    else
915 2f9606b3 aliguori
	vnc_sasl="no"
916 2f9606b3 aliguori
    fi
917 2f9606b3 aliguori
fi
918 2f9606b3 aliguori
919 2f9606b3 aliguori
##########################################
920 76655d6d aliguori
# fnmatch() probe, used for ACL routines
921 76655d6d aliguori
fnmatch="no"
922 76655d6d aliguori
cat > $TMPC << EOF
923 76655d6d aliguori
#include <fnmatch.h>
924 76655d6d aliguori
int main(void)
925 76655d6d aliguori
{
926 76655d6d aliguori
    fnmatch("foo", "foo", 0);
927 76655d6d aliguori
    return 0;
928 76655d6d aliguori
}
929 76655d6d aliguori
EOF
930 52166aa0 Juan Quintela
if compile_prog "" "" ; then
931 76655d6d aliguori
   fnmatch="yes"
932 76655d6d aliguori
fi
933 76655d6d aliguori
934 76655d6d aliguori
##########################################
935 8a16d273 ths
# vde libraries probe
936 8a16d273 ths
if test "$vde" = "yes" ; then
937 4baae0ac Juan Quintela
  vde=no
938 4baae0ac Juan Quintela
  vde_libs="-lvdeplug"
939 8a16d273 ths
  cat > $TMPC << EOF
940 8a16d273 ths
#include <libvdeplug.h>
941 4a7f0e06 pbrook
int main(void)
942 4a7f0e06 pbrook
{
943 4a7f0e06 pbrook
    struct vde_open_args a = {0, 0, 0};
944 4a7f0e06 pbrook
    vde_open("", "", &a);
945 4a7f0e06 pbrook
    return 0;
946 4a7f0e06 pbrook
}
947 8a16d273 ths
EOF
948 52166aa0 Juan Quintela
  if compile_prog "" "$vde_libs" ; then
949 4baae0ac Juan Quintela
    vde=yes
950 4baae0ac Juan Quintela
  fi
951 8a16d273 ths
fi
952 8a16d273 ths
953 8a16d273 ths
##########################################
954 c2de5c91 malc
# Sound support libraries probe
955 8f28f3fb ths
956 c2de5c91 malc
audio_drv_probe()
957 c2de5c91 malc
{
958 c2de5c91 malc
    drv=$1
959 c2de5c91 malc
    hdr=$2
960 c2de5c91 malc
    lib=$3
961 c2de5c91 malc
    exp=$4
962 c2de5c91 malc
    cfl=$5
963 c2de5c91 malc
        cat > $TMPC << EOF
964 c2de5c91 malc
#include <$hdr>
965 c2de5c91 malc
int main(void) { $exp }
966 8f28f3fb ths
EOF
967 52166aa0 Juan Quintela
    if compile_prog "$cfl" "$lib" ; then
968 c2de5c91 malc
        :
969 c2de5c91 malc
    else
970 c2de5c91 malc
        echo
971 c2de5c91 malc
        echo "Error: $drv check failed"
972 c2de5c91 malc
        echo "Make sure to have the $drv libs and headers installed."
973 c2de5c91 malc
        echo
974 c2de5c91 malc
        exit 1
975 c2de5c91 malc
    fi
976 c2de5c91 malc
}
977 c2de5c91 malc
978 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
979 c2de5c91 malc
for drv in $audio_drv_list; do
980 c2de5c91 malc
    case $drv in
981 c2de5c91 malc
    alsa)
982 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
983 c2de5c91 malc
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
984 c2de5c91 malc
    ;;
985 c2de5c91 malc
986 c2de5c91 malc
    fmod)
987 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
988 c2de5c91 malc
        echo
989 c2de5c91 malc
        echo "Error: You must specify path to FMOD library and headers"
990 c2de5c91 malc
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
991 c2de5c91 malc
        echo
992 c2de5c91 malc
        exit 1
993 c2de5c91 malc
    fi
994 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
995 c2de5c91 malc
    ;;
996 c2de5c91 malc
997 c2de5c91 malc
    esd)
998 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
999 c2de5c91 malc
    ;;
1000 b8e59f18 malc
1001 b8e59f18 malc
    pa)
1002 b8e59f18 malc
    audio_drv_probe $drv pulse/simple.h -lpulse-simple \
1003 b8e59f18 malc
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1004 b8e59f18 malc
    ;;
1005 b8e59f18 malc
1006 2f6a1ab0 blueswir1
    oss|sdl|core|wav|dsound)
1007 2f6a1ab0 blueswir1
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1008 2f6a1ab0 blueswir1
    ;;
1009 2f6a1ab0 blueswir1
1010 e4c63a6a malc
    *)
1011 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1012 e4c63a6a malc
        echo
1013 e4c63a6a malc
        echo "Error: Unknown driver '$drv' selected"
1014 e4c63a6a malc
        echo "Possible drivers are: $audio_possible_drivers"
1015 e4c63a6a malc
        echo
1016 e4c63a6a malc
        exit 1
1017 e4c63a6a malc
    }
1018 e4c63a6a malc
    ;;
1019 c2de5c91 malc
    esac
1020 c2de5c91 malc
done
1021 8f28f3fb ths
1022 4d3b6f6e balrog
##########################################
1023 2e4d9fb1 aurel32
# BrlAPI probe
1024 2e4d9fb1 aurel32
1025 eb82284f Juan Quintela
if test "$brlapi" = "yes" ; then
1026 eb82284f Juan Quintela
  brlapi=no
1027 eb82284f Juan Quintela
  brlapi_libs="-lbrlapi"
1028 eb82284f Juan Quintela
  cat > $TMPC << EOF
1029 2e4d9fb1 aurel32
#include <brlapi.h>
1030 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1031 2e4d9fb1 aurel32
EOF
1032 52166aa0 Juan Quintela
  if compile_prog "" "$brlapi_libs" ; then
1033 eb82284f Juan Quintela
    brlapi=yes
1034 eb82284f Juan Quintela
  fi
1035 eb82284f Juan Quintela
fi
1036 2e4d9fb1 aurel32
1037 2e4d9fb1 aurel32
##########################################
1038 4d3b6f6e balrog
# curses probe
1039 4d3b6f6e balrog
1040 4d3b6f6e balrog
if test "$curses" = "yes" ; then
1041 4d3b6f6e balrog
  cat > $TMPC << EOF
1042 4d3b6f6e balrog
#include <curses.h>
1043 5a8ff3aa blueswir1
#ifdef __OpenBSD__
1044 5a8ff3aa blueswir1
#define resize_term resizeterm
1045 5a8ff3aa blueswir1
#endif
1046 5a8ff3aa blueswir1
int main(void) { resize_term(0, 0); return curses_version(); }
1047 4d3b6f6e balrog
EOF
1048 52166aa0 Juan Quintela
  if compile_prog "" "-lncurses" ; then
1049 e0b7a42b Juan Quintela
    curses_libs="-lncurses"
1050 52166aa0 Juan Quintela
  elif compile_prog "" "-lcurses" ; then
1051 e0b7a42b Juan Quintela
    curses_libs="-lcurses"
1052 e0b7a42b Juan Quintela
  else
1053 e0b7a42b Juan Quintela
    curses=no
1054 4d3b6f6e balrog
  fi
1055 4d3b6f6e balrog
fi # test "$curses"
1056 4d3b6f6e balrog
1057 414f0dab blueswir1
##########################################
1058 769ce76d Alexander Graf
# curl probe
1059 769ce76d Alexander Graf
1060 769ce76d Alexander Graf
if test "$curl" = "yes" ; then
1061 769ce76d Alexander Graf
  curl=no
1062 769ce76d Alexander Graf
  cat > $TMPC << EOF
1063 769ce76d Alexander Graf
#include <curl/curl.h>
1064 769ce76d Alexander Graf
int main(void) { return curl_easy_init(); }
1065 769ce76d Alexander Graf
EOF
1066 b1d5a277 Juan Quintela
  curl_cflags=`curl-config --cflags 2>/dev/null`
1067 52368552 Paul Brook
  curl_libs=`curl-config --libs 2>/dev/null`
1068 b1d5a277 Juan Quintela
  if compile_prog "$curl_cflags" "$curl_libs" ; then
1069 769ce76d Alexander Graf
    curl=yes
1070 769ce76d Alexander Graf
  fi
1071 769ce76d Alexander Graf
fi # test "$curl"
1072 769ce76d Alexander Graf
1073 769ce76d Alexander Graf
##########################################
1074 fb599c9a balrog
# bluez support probe
1075 fb599c9a balrog
if test "$bluez" = "yes" ; then
1076 efcfd0c5 Blue Swirl
  `pkg-config bluez 2> /dev/null` || bluez="no"
1077 fb599c9a balrog
fi
1078 fb599c9a balrog
if test "$bluez" = "yes" ; then
1079 e820e3f4 balrog
  cat > $TMPC << EOF
1080 e820e3f4 balrog
#include <bluetooth/bluetooth.h>
1081 e820e3f4 balrog
int main(void) { return bt_error(0); }
1082 e820e3f4 balrog
EOF
1083 efcfd0c5 Blue Swirl
  bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1084 efcfd0c5 Blue Swirl
  bluez_libs=`pkg-config --libs bluez 2> /dev/null`
1085 52166aa0 Juan Quintela
  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1086 e820e3f4 balrog
    :
1087 e820e3f4 balrog
  else
1088 e820e3f4 balrog
    bluez="no"
1089 e820e3f4 balrog
  fi
1090 fb599c9a balrog
fi
1091 fb599c9a balrog
1092 fb599c9a balrog
##########################################
1093 7ba1e619 aliguori
# kvm probe
1094 7ba1e619 aliguori
if test "$kvm" = "yes" ; then
1095 7ba1e619 aliguori
    cat > $TMPC <<EOF
1096 7ba1e619 aliguori
#include <linux/kvm.h>
1097 9fd8d8d7 aliguori
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1098 7ba1e619 aliguori
#error Invalid KVM version
1099 7ba1e619 aliguori
#endif
1100 9fd8d8d7 aliguori
#if !defined(KVM_CAP_USER_MEMORY)
1101 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_USER_MEMORY
1102 9fd8d8d7 aliguori
#endif
1103 9fd8d8d7 aliguori
#if !defined(KVM_CAP_SET_TSS_ADDR)
1104 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1105 9fd8d8d7 aliguori
#endif
1106 9fd8d8d7 aliguori
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1107 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1108 9fd8d8d7 aliguori
#endif
1109 7ba1e619 aliguori
int main(void) { return 0; }
1110 7ba1e619 aliguori
EOF
1111 eac30262 aliguori
  if test "$kerneldir" != "" ; then
1112 eac30262 aliguori
      kvm_cflags=-I"$kerneldir"/include
1113 8444eb6e aliguori
      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1114 8444eb6e aliguori
         -a -d "$kerneldir/arch/x86/include" ; then
1115 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1116 406b430d aliguori
	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1117 406b430d aliguori
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1118 8444eb6e aliguori
        elif test -d "$kerneldir/arch/$cpu/include" ; then
1119 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1120 8444eb6e aliguori
      fi
1121 eac30262 aliguori
  else
1122 eac30262 aliguori
      kvm_cflags=""
1123 eac30262 aliguori
  fi
1124 52166aa0 Juan Quintela
  if compile_prog "$kvm_cflags" "" ; then
1125 7ba1e619 aliguori
    :
1126 7ba1e619 aliguori
  else
1127 9fd8d8d7 aliguori
    kvm="no";
1128 9fd8d8d7 aliguori
    if [ -x "`which awk 2>/dev/null`" ] && \
1129 9fd8d8d7 aliguori
       [ -x "`which grep 2>/dev/null`" ]; then
1130 0c439cbf Juan Quintela
      kvmerr=`LANG=C $cc $CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1131 9fd8d8d7 aliguori
	| grep "error: " \
1132 9fd8d8d7 aliguori
	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1133 9fd8d8d7 aliguori
      if test "$kvmerr" != "" ; then
1134 168ccc11 Jan Kiszka
        kvm="no - (${kvmerr})\n\
1135 168ccc11 Jan Kiszka
    NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1136 168ccc11 Jan Kiszka
recent kvm-kmod from http://sourceforge.net/projects/kvm."
1137 9fd8d8d7 aliguori
      fi
1138 9fd8d8d7 aliguori
    fi
1139 7ba1e619 aliguori
  fi
1140 7ba1e619 aliguori
fi
1141 7ba1e619 aliguori
1142 7ba1e619 aliguori
##########################################
1143 e5d355d1 aliguori
# pthread probe
1144 de65fe0f Sebastian Herbszt
PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1145 e5d355d1 aliguori
PTHREADLIBS=""
1146 3c529d93 aliguori
1147 e5d355d1 aliguori
if test "$pthread" = yes; then
1148 e5d355d1 aliguori
  pthread=no
1149 e5d355d1 aliguori
cat > $TMPC << EOF
1150 3c529d93 aliguori
#include <pthread.h>
1151 de65fe0f Sebastian Herbszt
int main(void) { pthread_create(0,0,0,0); return 0; }
1152 414f0dab blueswir1
EOF
1153 de65fe0f Sebastian Herbszt
  for pthread_lib in $PTHREADLIBS_LIST; do
1154 52166aa0 Juan Quintela
    if compile_prog "" "$pthread_lib" ; then
1155 de65fe0f Sebastian Herbszt
      pthread=yes
1156 de65fe0f Sebastian Herbszt
      PTHREADLIBS="$pthread_lib"
1157 de65fe0f Sebastian Herbszt
      break
1158 de65fe0f Sebastian Herbszt
    fi
1159 de65fe0f Sebastian Herbszt
  done
1160 414f0dab blueswir1
fi
1161 414f0dab blueswir1
1162 e5d355d1 aliguori
if test "$pthread" = no; then
1163 e5d355d1 aliguori
   aio=no
1164 e5d355d1 aliguori
   io_thread=no
1165 e5d355d1 aliguori
fi
1166 e5d355d1 aliguori
1167 bf9298b9 aliguori
##########################################
1168 bf9298b9 aliguori
# iovec probe
1169 bf9298b9 aliguori
cat > $TMPC <<EOF
1170 db34f0b3 blueswir1
#include <sys/types.h>
1171 bf9298b9 aliguori
#include <sys/uio.h>
1172 db34f0b3 blueswir1
#include <unistd.h>
1173 bf9298b9 aliguori
int main(void) { struct iovec iov; return 0; }
1174 bf9298b9 aliguori
EOF
1175 bf9298b9 aliguori
iovec=no
1176 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1177 bf9298b9 aliguori
  iovec=yes
1178 bf9298b9 aliguori
fi
1179 bf9298b9 aliguori
1180 f652e6af aurel32
##########################################
1181 ceb42de8 aliguori
# preadv probe
1182 ceb42de8 aliguori
cat > $TMPC <<EOF
1183 ceb42de8 aliguori
#include <sys/types.h>
1184 ceb42de8 aliguori
#include <sys/uio.h>
1185 ceb42de8 aliguori
#include <unistd.h>
1186 ceb42de8 aliguori
int main(void) { preadv; }
1187 ceb42de8 aliguori
EOF
1188 ceb42de8 aliguori
preadv=no
1189 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1190 ceb42de8 aliguori
  preadv=yes
1191 ceb42de8 aliguori
fi
1192 ceb42de8 aliguori
1193 ceb42de8 aliguori
##########################################
1194 f652e6af aurel32
# fdt probe
1195 f652e6af aurel32
if test "$fdt" = "yes" ; then
1196 b41af4ba Juan Quintela
  fdt=no
1197 b41af4ba Juan Quintela
  fdt_libs="-lfdt"
1198 b41af4ba Juan Quintela
  cat > $TMPC << EOF
1199 f652e6af aurel32
int main(void) { return 0; }
1200 f652e6af aurel32
EOF
1201 52166aa0 Juan Quintela
  if compile_prog "" "$fdt_libs" ; then
1202 f652e6af aurel32
    fdt=yes
1203 f652e6af aurel32
  fi
1204 f652e6af aurel32
fi
1205 f652e6af aurel32
1206 3b3f24ad aurel32
#
1207 3b3f24ad aurel32
# Check for xxxat() functions when we are building linux-user
1208 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1209 3b3f24ad aurel32
# have syscall stubs for these implemented.
1210 3b3f24ad aurel32
#
1211 3b3f24ad aurel32
atfile=no
1212 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1213 3b3f24ad aurel32
#define _ATFILE_SOURCE
1214 3b3f24ad aurel32
#include <sys/types.h>
1215 3b3f24ad aurel32
#include <fcntl.h>
1216 3b3f24ad aurel32
#include <unistd.h>
1217 3b3f24ad aurel32
1218 3b3f24ad aurel32
int
1219 3b3f24ad aurel32
main(void)
1220 3b3f24ad aurel32
{
1221 3b3f24ad aurel32
	/* try to unlink nonexisting file */
1222 3b3f24ad aurel32
	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1223 3b3f24ad aurel32
}
1224 3b3f24ad aurel32
EOF
1225 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1226 67ba57f6 Riku Voipio
  atfile=yes
1227 3b3f24ad aurel32
fi
1228 3b3f24ad aurel32
1229 39386ac7 aurel32
# Check for inotify functions when we are building linux-user
1230 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1231 3b3f24ad aurel32
# have syscall stubs for these implemented.  In that case we
1232 3b3f24ad aurel32
# don't provide them even if kernel supports them.
1233 3b3f24ad aurel32
#
1234 3b3f24ad aurel32
inotify=no
1235 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1236 3b3f24ad aurel32
#include <sys/inotify.h>
1237 3b3f24ad aurel32
1238 3b3f24ad aurel32
int
1239 3b3f24ad aurel32
main(void)
1240 3b3f24ad aurel32
{
1241 3b3f24ad aurel32
	/* try to start inotify */
1242 8690e420 aurel32
	return inotify_init();
1243 3b3f24ad aurel32
}
1244 3b3f24ad aurel32
EOF
1245 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1246 67ba57f6 Riku Voipio
  inotify=yes
1247 3b3f24ad aurel32
fi
1248 3b3f24ad aurel32
1249 ebc996f3 Riku Voipio
# check if utimensat and futimens are supported
1250 ebc996f3 Riku Voipio
utimens=no
1251 ebc996f3 Riku Voipio
cat > $TMPC << EOF
1252 ebc996f3 Riku Voipio
#define _ATFILE_SOURCE
1253 ebc996f3 Riku Voipio
#define _GNU_SOURCE
1254 ebc996f3 Riku Voipio
#include <stddef.h>
1255 ebc996f3 Riku Voipio
#include <fcntl.h>
1256 ebc996f3 Riku Voipio
1257 ebc996f3 Riku Voipio
int main(void)
1258 ebc996f3 Riku Voipio
{
1259 ebc996f3 Riku Voipio
    utimensat(AT_FDCWD, "foo", NULL, 0);
1260 ebc996f3 Riku Voipio
    futimens(0, NULL);
1261 ebc996f3 Riku Voipio
    return 0;
1262 ebc996f3 Riku Voipio
}
1263 ebc996f3 Riku Voipio
EOF
1264 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1265 ebc996f3 Riku Voipio
  utimens=yes
1266 ebc996f3 Riku Voipio
fi
1267 ebc996f3 Riku Voipio
1268 099d6b0f Riku Voipio
# check if pipe2 is there
1269 099d6b0f Riku Voipio
pipe2=no
1270 099d6b0f Riku Voipio
cat > $TMPC << EOF
1271 099d6b0f Riku Voipio
#define _GNU_SOURCE
1272 099d6b0f Riku Voipio
#include <unistd.h>
1273 099d6b0f Riku Voipio
#include <fcntl.h>
1274 099d6b0f Riku Voipio
1275 099d6b0f Riku Voipio
int main(void)
1276 099d6b0f Riku Voipio
{
1277 099d6b0f Riku Voipio
    int pipefd[2];
1278 099d6b0f Riku Voipio
    pipe2(pipefd, O_CLOEXEC);
1279 099d6b0f Riku Voipio
    return 0;
1280 099d6b0f Riku Voipio
}
1281 099d6b0f Riku Voipio
EOF
1282 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1283 099d6b0f Riku Voipio
  pipe2=yes
1284 099d6b0f Riku Voipio
fi
1285 099d6b0f Riku Voipio
1286 3ce34dfb vibisreenivasan
# check if tee/splice is there. vmsplice was added same time.
1287 3ce34dfb vibisreenivasan
splice=no
1288 3ce34dfb vibisreenivasan
cat > $TMPC << EOF
1289 3ce34dfb vibisreenivasan
#define _GNU_SOURCE
1290 3ce34dfb vibisreenivasan
#include <unistd.h>
1291 3ce34dfb vibisreenivasan
#include <fcntl.h>
1292 3ce34dfb vibisreenivasan
#include <limits.h>
1293 3ce34dfb vibisreenivasan
1294 3ce34dfb vibisreenivasan
int main(void)
1295 3ce34dfb vibisreenivasan
{
1296 3ce34dfb vibisreenivasan
    int len, fd;
1297 3ce34dfb vibisreenivasan
    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1298 3ce34dfb vibisreenivasan
    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1299 3ce34dfb vibisreenivasan
    return 0;
1300 3ce34dfb vibisreenivasan
}
1301 3ce34dfb vibisreenivasan
EOF
1302 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1303 3ce34dfb vibisreenivasan
  splice=yes
1304 3ce34dfb vibisreenivasan
fi
1305 3ce34dfb vibisreenivasan
1306 cc8ae6de pbrook
# Check if tools are available to build documentation.
1307 70ec5dc0 Anthony Liguori
if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
1308 70ec5dc0 Anthony Liguori
  build_docs="no"
1309 cc8ae6de pbrook
fi
1310 cc8ae6de pbrook
1311 6ae9a1f4 Juan Quintela
# Search for bsawp_32 function
1312 6ae9a1f4 Juan Quintela
byteswap_h=no
1313 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1314 6ae9a1f4 Juan Quintela
#include <byteswap.h>
1315 6ae9a1f4 Juan Quintela
int main(void) { return bswap_32(0); }
1316 6ae9a1f4 Juan Quintela
EOF
1317 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1318 6ae9a1f4 Juan Quintela
  byteswap_h=yes
1319 6ae9a1f4 Juan Quintela
fi
1320 6ae9a1f4 Juan Quintela
1321 6ae9a1f4 Juan Quintela
# Search for bsawp_32 function
1322 6ae9a1f4 Juan Quintela
bswap_h=no
1323 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1324 6ae9a1f4 Juan Quintela
#include <sys/endian.h>
1325 6ae9a1f4 Juan Quintela
#include <sys/types.h>
1326 6ae9a1f4 Juan Quintela
#include <machine/bswap.h>
1327 6ae9a1f4 Juan Quintela
int main(void) { return bswap32(0); }
1328 6ae9a1f4 Juan Quintela
EOF
1329 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1330 6ae9a1f4 Juan Quintela
  bswap_h=yes
1331 6ae9a1f4 Juan Quintela
fi
1332 6ae9a1f4 Juan Quintela
1333 da93a1fd aliguori
##########################################
1334 da93a1fd aliguori
# Do we need librt
1335 da93a1fd aliguori
cat > $TMPC <<EOF
1336 da93a1fd aliguori
#include <signal.h>
1337 da93a1fd aliguori
#include <time.h>
1338 da93a1fd aliguori
int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1339 da93a1fd aliguori
EOF
1340 da93a1fd aliguori
1341 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1342 5169202b Juan Quintela
  CLOCKLIBS=""
1343 52166aa0 Juan Quintela
elif compile_prog "" "-lrt" ; then
1344 e5d355d1 aliguori
  CLOCKLIBS="-lrt"
1345 da93a1fd aliguori
fi
1346 da93a1fd aliguori
1347 a36abbbb Juan Quintela
# Determine what linker flags to use to force archive inclusion
1348 a36abbbb Juan Quintela
check_linker_flags()
1349 a36abbbb Juan Quintela
{
1350 a36abbbb Juan Quintela
    w2=
1351 a36abbbb Juan Quintela
    if test "$2" ; then
1352 a36abbbb Juan Quintela
	w2=-Wl,$2
1353 a36abbbb Juan Quintela
    fi
1354 52166aa0 Juan Quintela
    compile_prog "" "-Wl,$1 ${w2}"
1355 a36abbbb Juan Quintela
}
1356 a36abbbb Juan Quintela
1357 a36abbbb Juan Quintela
cat > $TMPC << EOF
1358 a36abbbb Juan Quintela
int main(void) { }
1359 a36abbbb Juan Quintela
EOF
1360 a36abbbb Juan Quintela
if check_linker_flags --whole-archive --no-whole-archive ; then
1361 a36abbbb Juan Quintela
    # GNU ld
1362 a36abbbb Juan Quintela
    arlibs_begin="-Wl,--whole-archive"
1363 a36abbbb Juan Quintela
    arlibs_end="-Wl,--no-whole-archive"
1364 a36abbbb Juan Quintela
elif check_linker_flags -z,allextract -z,defaultextract ; then
1365 a36abbbb Juan Quintela
    # Solaris ld
1366 a36abbbb Juan Quintela
    arlibs_begin"=-Wl,-z,allextract"
1367 a36abbbb Juan Quintela
    arlibs_end="-Wl,-z,defaultextract"
1368 a36abbbb Juan Quintela
elif check_linker_flags -all_load ; then
1369 a36abbbb Juan Quintela
    # Mac OS X
1370 a36abbbb Juan Quintela
    arlibs_begin="-all_load"
1371 a36abbbb Juan Quintela
    arlibs_end=""
1372 a36abbbb Juan Quintela
else
1373 a36abbbb Juan Quintela
    echo "Error: your linker does not support --whole-archive or -z."
1374 a36abbbb Juan Quintela
    echo "Please report to qemu-devel@nongnu.org"
1375 a36abbbb Juan Quintela
    exit 1
1376 a36abbbb Juan Quintela
fi
1377 a36abbbb Juan Quintela
1378 e86ecd4b Juan Quintela
# End of CC checks
1379 e86ecd4b Juan Quintela
# After here, no more $cc or $ld runs
1380 e86ecd4b Juan Quintela
1381 e86ecd4b Juan Quintela
# default flags for all hosts
1382 1156c669 Juan Quintela
CFLAGS="-g -fno-strict-aliasing $CFLAGS"
1383 e86ecd4b Juan Quintela
if test "$debug" = "no" ; then
1384 1156c669 Juan Quintela
  CFLAGS="-O2 $CFLAGS"
1385 e86ecd4b Juan Quintela
fi
1386 1156c669 Juan Quintela
CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls $CFLAGS"
1387 1156c669 Juan Quintela
LDFLAGS="-g $LDFLAGS"
1388 e86ecd4b Juan Quintela
1389 e86ecd4b Juan Quintela
# Consult white-list to determine whether to enable werror
1390 e86ecd4b Juan Quintela
# by default.  Only enable by default for git builds
1391 e86ecd4b Juan Quintela
if test -z "$werror" ; then
1392 e86ecd4b Juan Quintela
    z_version=`cut -f3 -d. $source_path/VERSION`
1393 e86ecd4b Juan Quintela
    if test "$z_version" = "50" -a \
1394 e86ecd4b Juan Quintela
        "$linux" = "yes" ; then
1395 e86ecd4b Juan Quintela
        werror="yes"
1396 e86ecd4b Juan Quintela
    else
1397 e86ecd4b Juan Quintela
        werror="no"
1398 e86ecd4b Juan Quintela
    fi
1399 e86ecd4b Juan Quintela
fi
1400 e86ecd4b Juan Quintela
1401 e86ecd4b Juan Quintela
if test "$werror" = "yes" ; then
1402 1156c669 Juan Quintela
    CFLAGS="-Werror $CFLAGS"
1403 e86ecd4b Juan Quintela
fi
1404 e86ecd4b Juan Quintela
1405 e86ecd4b Juan Quintela
if test "$solaris" = "no" ; then
1406 e86ecd4b Juan Quintela
    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1407 1156c669 Juan Quintela
        LDFLAGS="-Wl,--warn-common $LDFLAGS"
1408 e86ecd4b Juan Quintela
    fi
1409 e86ecd4b Juan Quintela
fi
1410 e86ecd4b Juan Quintela
1411 11d9f695 bellard
if test "$mingw32" = "yes" ; then
1412 308c3593 pbrook
  if test -z "$prefix" ; then
1413 55418b96 Stefan Weil
      prefix="c:/Program Files/Qemu"
1414 308c3593 pbrook
  fi
1415 308c3593 pbrook
  mansuffix=""
1416 308c3593 pbrook
  datasuffix=""
1417 308c3593 pbrook
  docsuffix=""
1418 308c3593 pbrook
  binsuffix=""
1419 11d9f695 bellard
else
1420 308c3593 pbrook
  if test -z "$prefix" ; then
1421 308c3593 pbrook
      prefix="/usr/local"
1422 308c3593 pbrook
  fi
1423 308c3593 pbrook
  mansuffix="/share/man"
1424 308c3593 pbrook
  datasuffix="/share/qemu"
1425 308c3593 pbrook
  docsuffix="/share/doc/qemu"
1426 308c3593 pbrook
  binsuffix="/bin"
1427 11d9f695 bellard
fi
1428 5a67135a bellard
1429 43ce4dfe bellard
echo "Install prefix    $prefix"
1430 308c3593 pbrook
echo "BIOS directory    $prefix$datasuffix"
1431 308c3593 pbrook
echo "binary directory  $prefix$binsuffix"
1432 11d9f695 bellard
if test "$mingw32" = "no" ; then
1433 308c3593 pbrook
echo "Manual directory  $prefix$mansuffix"
1434 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
1435 11d9f695 bellard
fi
1436 5a67135a bellard
echo "Source path       $source_path"
1437 43ce4dfe bellard
echo "C compiler        $cc"
1438 83469015 bellard
echo "Host C compiler   $host_cc"
1439 0c439cbf Juan Quintela
echo "CFLAGS            $CFLAGS"
1440 0c439cbf Juan Quintela
echo "LDFLAGS           $LDFLAGS"
1441 43ce4dfe bellard
echo "make              $make"
1442 6a882643 pbrook
echo "install           $install"
1443 43ce4dfe bellard
echo "host CPU          $cpu"
1444 de83cd02 bellard
echo "host big endian   $bigendian"
1445 97a847bc bellard
echo "target list       $target_list"
1446 ade25b0d aurel32
echo "tcg debug enabled $debug_tcg"
1447 43ce4dfe bellard
echo "gprof enabled     $gprof"
1448 03b4fe7d aliguori
echo "sparse enabled    $sparse"
1449 1625af87 aliguori
echo "strip binaries    $strip_opt"
1450 05c2a3e7 bellard
echo "profiler          $profiler"
1451 43ce4dfe bellard
echo "static build      $static"
1452 85aa5189 bellard
echo "-Werror enabled   $werror"
1453 5b0753e0 bellard
if test "$darwin" = "yes" ; then
1454 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
1455 5b0753e0 bellard
fi
1456 97a847bc bellard
echo "SDL support       $sdl"
1457 4d3b6f6e balrog
echo "curses support    $curses"
1458 769ce76d Alexander Graf
echo "curl support      $curl"
1459 67b915a5 bellard
echo "mingw32 support   $mingw32"
1460 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
1461 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
1462 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
1463 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
1464 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1465 8d5d2d4c ths
    echo "    TLS CFLAGS    $vnc_tls_cflags"
1466 8d5d2d4c ths
    echo "    TLS LIBS      $vnc_tls_libs"
1467 8d5d2d4c ths
fi
1468 2f9606b3 aliguori
echo "VNC SASL support  $vnc_sasl"
1469 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
1470 2f9606b3 aliguori
    echo "    SASL CFLAGS    $vnc_sasl_cflags"
1471 2f9606b3 aliguori
    echo "    SASL LIBS      $vnc_sasl_libs"
1472 2f9606b3 aliguori
fi
1473 3142255c blueswir1
if test -n "$sparc_cpu"; then
1474 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
1475 3142255c blueswir1
fi
1476 07f4ddbf bellard
echo "kqemu support     $kqemu"
1477 e37630ca aliguori
echo "xen support       $xen"
1478 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
1479 cc8ae6de pbrook
echo "Documentation     $build_docs"
1480 c5937220 pbrook
[ ! -z "$uname_release" ] && \
1481 c5937220 pbrook
echo "uname -r          $uname_release"
1482 bd0c5661 pbrook
echo "NPTL support      $nptl"
1483 379f6698 Paul Brook
echo "GUEST_BASE        $guest_base"
1484 8a16d273 ths
echo "vde support       $vde"
1485 414f0dab blueswir1
echo "AIO support       $aio"
1486 e5d355d1 aliguori
echo "IO thread         $io_thread"
1487 77755340 ths
echo "Install blobs     $blobs"
1488 168ccc11 Jan Kiszka
echo -e "KVM support       $kvm"
1489 f652e6af aurel32
echo "fdt support       $fdt"
1490 ceb42de8 aliguori
echo "preadv support    $preadv"
1491 67b915a5 bellard
1492 97a847bc bellard
if test $sdl_too_old = "yes"; then
1493 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
1494 7c1f25b4 bellard
fi
1495 7d13299d bellard
1496 98ec69ac Juan Quintela
config_host_mak="config-host.mak"
1497 98ec69ac Juan Quintela
config_host_h="config-host.h"
1498 4bf6b55b Juan Quintela
config_host_ld="config-host.ld"
1499 98ec69ac Juan Quintela
1500 98ec69ac Juan Quintela
#echo "Creating $config_host_mak and $config_host_h"
1501 98ec69ac Juan Quintela
1502 98ec69ac Juan Quintela
test -f $config_host_h && mv $config_host_h ${config_host_h}~
1503 98ec69ac Juan Quintela
1504 98ec69ac Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_host_mak
1505 98ec69ac Juan Quintela
printf "# Configured with:" >> $config_host_mak
1506 98ec69ac Juan Quintela
printf " '%s'" "$0" "$@" >> $config_host_mak
1507 98ec69ac Juan Quintela
echo >> $config_host_mak
1508 98ec69ac Juan Quintela
1509 2358a494 Juan Quintela
echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
1510 804edf29 Juan Quintela
1511 2408a527 aurel32
case "$cpu" in
1512 c62bbcd3 Andrzej Zaborowski
  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
1513 e0da9dd3 Juan Quintela
    ARCH=$cpu
1514 2408a527 aurel32
  ;;
1515 a302c32d Laurent Desnogues
  armv4b|armv4l)
1516 16dbd14f Juan Quintela
    ARCH=arm
1517 2408a527 aurel32
  ;;
1518 2408a527 aurel32
  *)
1519 2408a527 aurel32
    echo "Unsupported CPU = $cpu"
1520 2408a527 aurel32
    exit 1
1521 2408a527 aurel32
  ;;
1522 2408a527 aurel32
esac
1523 98ec69ac Juan Quintela
echo "ARCH=$ARCH" >> $config_host_mak
1524 f8393946 aurel32
if test "$debug_tcg" = "yes" ; then
1525 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
1526 f8393946 aurel32
fi
1527 f3d08ee6 Paul Brook
if test "$debug" = "yes" ; then
1528 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
1529 f3d08ee6 Paul Brook
fi
1530 1625af87 aliguori
if test "$strip_opt" = "yes" ; then
1531 98ec69ac Juan Quintela
  echo "STRIP_OPT=-s" >> $config_host_mak
1532 1625af87 aliguori
fi
1533 7d13299d bellard
if test "$bigendian" = "yes" ; then
1534 e2542fe2 Juan Quintela
  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
1535 97a847bc bellard
fi
1536 2358a494 Juan Quintela
echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
1537 67b915a5 bellard
if test "$mingw32" = "yes" ; then
1538 98ec69ac Juan Quintela
  echo "CONFIG_WIN32=y" >> $config_host_mak
1539 210fa556 pbrook
else
1540 35f4df27 Juan Quintela
  echo "CONFIG_POSIX=y" >> $config_host_mak
1541 67b915a5 bellard
fi
1542 128ab2ff blueswir1
1543 83fb7adf bellard
if test "$darwin" = "yes" ; then
1544 98ec69ac Juan Quintela
  echo "CONFIG_DARWIN=y" >> $config_host_mak
1545 83fb7adf bellard
fi
1546 b29fe3ed malc
1547 b29fe3ed malc
if test "$aix" = "yes" ; then
1548 98ec69ac Juan Quintela
  echo "CONFIG_AIX=y" >> $config_host_mak
1549 b29fe3ed malc
fi
1550 b29fe3ed malc
1551 ec530c81 bellard
if test "$solaris" = "yes" ; then
1552 98ec69ac Juan Quintela
  echo "CONFIG_SOLARIS=y" >> $config_host_mak
1553 2358a494 Juan Quintela
  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
1554 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
1555 75b5a697 Juan Quintela
    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
1556 0475a5ca ths
  fi
1557 ec530c81 bellard
fi
1558 97a847bc bellard
if test "$gprof" = "yes" ; then
1559 98ec69ac Juan Quintela
  echo "TARGET_GPROF=yes" >> $config_host_mak
1560 97a847bc bellard
fi
1561 97a847bc bellard
if test "$static" = "yes" ; then
1562 98ec69ac Juan Quintela
  echo "CONFIG_STATIC=y" >> $config_host_mak
1563 1156c669 Juan Quintela
  LDFLAGS="-static $LDFLAGS"
1564 7d13299d bellard
fi
1565 05c2a3e7 bellard
if test $profiler = "yes" ; then
1566 2358a494 Juan Quintela
  echo "CONFIG_PROFILER=y" >> $config_host_mak
1567 05c2a3e7 bellard
fi
1568 c20709aa bellard
if test "$slirp" = "yes" ; then
1569 98ec69ac Juan Quintela
  echo "CONFIG_SLIRP=y" >> $config_host_mak
1570 c20709aa bellard
fi
1571 8a16d273 ths
if test "$vde" = "yes" ; then
1572 98ec69ac Juan Quintela
  echo "CONFIG_VDE=y" >> $config_host_mak
1573 4baae0ac Juan Quintela
  echo "VDE_LIBS=$vde_libs" >> $config_host_mak
1574 8a16d273 ths
fi
1575 0c58ac1c malc
for card in $audio_card_list; do
1576 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1577 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
1578 0c58ac1c malc
done
1579 2358a494 Juan Quintela
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
1580 0c58ac1c malc
for drv in $audio_drv_list; do
1581 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1582 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
1583 923e4521 malc
    if test "$drv" = "fmod"; then
1584 7aac6cb1 Juan Quintela
        echo "FMOD_LIBS=$fmod_lib" >> $config_host_mak
1585 7aac6cb1 Juan Quintela
        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
1586 2f6a1ab0 blueswir1
    elif test "$drv" = "oss"; then
1587 6881964c Juan Quintela
        echo "OSS_LIBS=$oss_lib" >> $config_host_mak
1588 0c58ac1c malc
    fi
1589 0c58ac1c malc
done
1590 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
1591 98ec69ac Juan Quintela
  echo "CONFIG_MIXEMU=y" >> $config_host_mak
1592 8ff9cbf7 malc
fi
1593 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1594 98ec69ac Juan Quintela
  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
1595 525061bf Juan Quintela
  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1596 525061bf Juan Quintela
  echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak
1597 8d5d2d4c ths
fi
1598 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
1599 98ec69ac Juan Quintela
  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
1600 60ddf533 Juan Quintela
  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1601 60ddf533 Juan Quintela
  echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak
1602 2f9606b3 aliguori
fi
1603 76655d6d aliguori
if test "$fnmatch" = "yes" ; then
1604 2358a494 Juan Quintela
  echo "CONFIG_FNMATCH=y" >> $config_host_mak
1605 76655d6d aliguori
fi
1606 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
1607 98ec69ac Juan Quintela
echo "VERSION=$qemu_version" >>$config_host_mak
1608 2358a494 Juan Quintela
echo "PKGVERSION=$pkgversion" >>$config_host_mak
1609 98ec69ac Juan Quintela
echo "SRC_PATH=$source_path" >> $config_host_mak
1610 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
1611 98ec69ac Juan Quintela
  echo "VPATH=$source_path" >> $config_host_mak
1612 ad064840 pbrook
fi
1613 98ec69ac Juan Quintela
echo "TARGET_DIRS=$target_list" >> $config_host_mak
1614 cc8ae6de pbrook
if [ "$build_docs" = "yes" ] ; then
1615 98ec69ac Juan Quintela
  echo "BUILD_DOCS=yes" >> $config_host_mak
1616 cc8ae6de pbrook
fi
1617 1ac88f28 Juan Quintela
if test "$sdl" = "yes" ; then
1618 98ec69ac Juan Quintela
  echo "CONFIG_SDL=y" >> $config_host_mak
1619 1ac88f28 Juan Quintela
  echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
1620 1ac88f28 Juan Quintela
  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
1621 49ecc3fa bellard
fi
1622 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
1623 98ec69ac Juan Quintela
  echo "CONFIG_COCOA=y" >> $config_host_mak
1624 4d3b6f6e balrog
fi
1625 4d3b6f6e balrog
if test "$curses" = "yes" ; then
1626 98ec69ac Juan Quintela
  echo "CONFIG_CURSES=y" >> $config_host_mak
1627 e0b7a42b Juan Quintela
  echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
1628 49ecc3fa bellard
fi
1629 3b3f24ad aurel32
if test "$atfile" = "yes" ; then
1630 2358a494 Juan Quintela
  echo "CONFIG_ATFILE=y" >> $config_host_mak
1631 3b3f24ad aurel32
fi
1632 ebc996f3 Riku Voipio
if test "$utimens" = "yes" ; then
1633 2358a494 Juan Quintela
  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
1634 ebc996f3 Riku Voipio
fi
1635 099d6b0f Riku Voipio
if test "$pipe2" = "yes" ; then
1636 2358a494 Juan Quintela
  echo "CONFIG_PIPE2=y" >> $config_host_mak
1637 099d6b0f Riku Voipio
fi
1638 3ce34dfb vibisreenivasan
if test "$splice" = "yes" ; then
1639 2358a494 Juan Quintela
  echo "CONFIG_SPLICE=y" >> $config_host_mak
1640 3ce34dfb vibisreenivasan
fi
1641 3b3f24ad aurel32
if test "$inotify" = "yes" ; then
1642 2358a494 Juan Quintela
  echo "CONFIG_INOTIFY=y" >> $config_host_mak
1643 3b3f24ad aurel32
fi
1644 6ae9a1f4 Juan Quintela
if test "$byteswap_h" = "yes" ; then
1645 6ae9a1f4 Juan Quintela
  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
1646 6ae9a1f4 Juan Quintela
fi
1647 6ae9a1f4 Juan Quintela
if test "$bswap_h" = "yes" ; then
1648 6ae9a1f4 Juan Quintela
  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
1649 6ae9a1f4 Juan Quintela
fi
1650 769ce76d Alexander Graf
if test "$curl" = "yes" ; then
1651 98ec69ac Juan Quintela
  echo "CONFIG_CURL=y" >> $config_host_mak
1652 b1d5a277 Juan Quintela
  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
1653 98ec69ac Juan Quintela
  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
1654 769ce76d Alexander Graf
fi
1655 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
1656 98ec69ac Juan Quintela
  echo "CONFIG_BRLAPI=y" >> $config_host_mak
1657 eb82284f Juan Quintela
  echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
1658 2e4d9fb1 aurel32
fi
1659 fb599c9a balrog
if test "$bluez" = "yes" ; then
1660 98ec69ac Juan Quintela
  echo "CONFIG_BLUEZ=y" >> $config_host_mak
1661 ef7635ec Juan Quintela
  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
1662 ef7635ec Juan Quintela
  echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak
1663 fb599c9a balrog
fi
1664 e37630ca aliguori
if test "$xen" = "yes" ; then
1665 5647eb74 Juan Quintela
  echo "CONFIG_XEN=y" >> $config_host_mak
1666 b2266bee Juan Quintela
  echo "XEN_LIBS=$xen_libs" >> $config_host_mak
1667 e37630ca aliguori
fi
1668 414f0dab blueswir1
if test "$aio" = "yes" ; then
1669 98ec69ac Juan Quintela
  echo "CONFIG_AIO=y" >> $config_host_mak
1670 414f0dab blueswir1
fi
1671 e5d355d1 aliguori
if test "$io_thread" = "yes" ; then
1672 98ec69ac Juan Quintela
  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
1673 e5d355d1 aliguori
fi
1674 77755340 ths
if test "$blobs" = "yes" ; then
1675 98ec69ac Juan Quintela
  echo "INSTALL_BLOBS=yes" >> $config_host_mak
1676 77755340 ths
fi
1677 bf9298b9 aliguori
if test "$iovec" = "yes" ; then
1678 2358a494 Juan Quintela
  echo "CONFIG_IOVEC=y" >> $config_host_mak
1679 bf9298b9 aliguori
fi
1680 ceb42de8 aliguori
if test "$preadv" = "yes" ; then
1681 2358a494 Juan Quintela
  echo "CONFIG_PREADV=y" >> $config_host_mak
1682 ceb42de8 aliguori
fi
1683 f652e6af aurel32
if test "$fdt" = "yes" ; then
1684 3f0855b1 Juan Quintela
  echo "CONFIG_FDT=y" >> $config_host_mak
1685 b41af4ba Juan Quintela
  echo "FDT_LIBS=$fdt_libs" >> $config_host_mak
1686 f652e6af aurel32
fi
1687 97a847bc bellard
1688 83fb7adf bellard
# XXX: suppress that
1689 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
1690 2358a494 Juan Quintela
  echo "CONFIG_BSD=y" >> $config_host_mak
1691 7d3505c5 bellard
fi
1692 7d3505c5 bellard
1693 2358a494 Juan Quintela
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
1694 c5937220 pbrook
1695 68063649 blueswir1
# USB host support
1696 68063649 blueswir1
case "$usb" in
1697 68063649 blueswir1
linux)
1698 98ec69ac Juan Quintela
  echo "HOST_USB=linux" >> $config_host_mak
1699 68063649 blueswir1
;;
1700 68063649 blueswir1
bsd)
1701 98ec69ac Juan Quintela
  echo "HOST_USB=bsd" >> $config_host_mak
1702 68063649 blueswir1
;;
1703 68063649 blueswir1
*)
1704 98ec69ac Juan Quintela
  echo "HOST_USB=stub" >> $config_host_mak
1705 68063649 blueswir1
;;
1706 68063649 blueswir1
esac
1707 68063649 blueswir1
1708 c39e3338 pbrook
tools=
1709 c39e3338 pbrook
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
1710 3dd1f8ef aliguori
  tools="qemu-img\$(EXESUF) $tools"
1711 7a5ca864 bellard
  if [ "$linux" = "yes" ] ; then
1712 3dd1f8ef aliguori
      tools="qemu-nbd\$(EXESUF) qemu-io\$(EXESUF) $tools"
1713 7a5ca864 bellard
  fi
1714 c39e3338 pbrook
fi
1715 98ec69ac Juan Quintela
echo "TOOLS=$tools" >> $config_host_mak
1716 c39e3338 pbrook
1717 161294d8 Juan Quintela
# Mac OS X ships with a broken assembler
1718 253d0942 Alexander Graf
roms=
1719 161294d8 Juan Quintela
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
1720 161294d8 Juan Quintela
        "$targetos" != "Darwin" ; then
1721 c05ac895 Paul Brook
  roms="optionrom"
1722 253d0942 Alexander Graf
fi
1723 98ec69ac Juan Quintela
echo "ROMS=$roms" >> $config_host_mak
1724 253d0942 Alexander Graf
1725 804edf29 Juan Quintela
echo "prefix=$prefix" >> $config_host_mak
1726 804edf29 Juan Quintela
echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
1727 804edf29 Juan Quintela
echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
1728 804edf29 Juan Quintela
echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
1729 804edf29 Juan Quintela
echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
1730 804edf29 Juan Quintela
echo "MAKE=$make" >> $config_host_mak
1731 804edf29 Juan Quintela
echo "INSTALL=$install" >> $config_host_mak
1732 804edf29 Juan Quintela
echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
1733 804edf29 Juan Quintela
echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
1734 804edf29 Juan Quintela
echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
1735 804edf29 Juan Quintela
echo "CC=$cc" >> $config_host_mak
1736 804edf29 Juan Quintela
echo "HOST_CC=$host_cc" >> $config_host_mak
1737 804edf29 Juan Quintela
if test "$sparse" = "yes" ; then
1738 804edf29 Juan Quintela
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
1739 804edf29 Juan Quintela
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
1740 804edf29 Juan Quintela
  echo "CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
1741 804edf29 Juan Quintela
fi
1742 804edf29 Juan Quintela
echo "AR=$ar" >> $config_host_mak
1743 804edf29 Juan Quintela
echo "OBJCOPY=$objcopy" >> $config_host_mak
1744 804edf29 Juan Quintela
echo "LD=$ld" >> $config_host_mak
1745 e2a2ed06 Juan Quintela
echo "CFLAGS=$CFLAGS" >> $config_host_mak
1746 e2a2ed06 Juan Quintela
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
1747 a36abbbb Juan Quintela
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
1748 a36abbbb Juan Quintela
echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
1749 804edf29 Juan Quintela
echo "EXESUF=$EXESUF" >> $config_host_mak
1750 804edf29 Juan Quintela
echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
1751 804edf29 Juan Quintela
echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
1752 804edf29 Juan Quintela
1753 2358a494 Juan Quintela
echo "/* Automatically generated by configure - do not modify */" > $config_host_h
1754 2358a494 Juan Quintela
1755 0ff6697d malc
$SHELL $source_path/create_config < $config_host_mak >> $config_host_h
1756 2358a494 Juan Quintela
1757 98ec69ac Juan Quintela
if test -f ${config_host_h}~ ; then
1758 98ec69ac Juan Quintela
  if cmp -s $config_host_h ${config_host_h}~ ; then
1759 98ec69ac Juan Quintela
    mv ${config_host_h}~ $config_host_h
1760 370ab986 Paul Brook
  else
1761 98ec69ac Juan Quintela
    rm ${config_host_h}~
1762 370ab986 Paul Brook
  fi
1763 370ab986 Paul Brook
fi
1764 370ab986 Paul Brook
1765 4bf6b55b Juan Quintela
# generate list of library paths for linker script
1766 4bf6b55b Juan Quintela
1767 4bf6b55b Juan Quintela
$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
1768 4bf6b55b Juan Quintela
1769 4bf6b55b Juan Quintela
if test -f ${config_host_ld}~ ; then
1770 4bf6b55b Juan Quintela
  if cmp -s $config_host_ld ${config_host_ld}~ ; then
1771 4bf6b55b Juan Quintela
    mv ${config_host_ld}~ $config_host_ld
1772 4bf6b55b Juan Quintela
  else
1773 4bf6b55b Juan Quintela
    rm ${config_host_ld}~
1774 4bf6b55b Juan Quintela
  fi
1775 4bf6b55b Juan Quintela
fi
1776 4bf6b55b Juan Quintela
1777 1d14ffa9 bellard
for target in $target_list; do
1778 97a847bc bellard
target_dir="$target"
1779 97a847bc bellard
config_mak=$target_dir/config.mak
1780 97a847bc bellard
config_h=$target_dir/config.h
1781 600309b6 Blue Swirl
target_arch2=`echo $target | cut -d '-' -f 1`
1782 97a847bc bellard
target_bigendian="no"
1783 ea2d6a39 Juan Quintela
case "$target_arch2" in
1784 ea2d6a39 Juan Quintela
  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
1785 ea2d6a39 Juan Quintela
  target_bigendian=yes
1786 ea2d6a39 Juan Quintela
  ;;
1787 ea2d6a39 Juan Quintela
esac
1788 97a847bc bellard
target_softmmu="no"
1789 997344f3 bellard
target_user_only="no"
1790 831b7825 ths
target_linux_user="no"
1791 831b7825 ths
target_darwin_user="no"
1792 84778508 blueswir1
target_bsd_user="no"
1793 9e407a85 pbrook
case "$target" in
1794 600309b6 Blue Swirl
  ${target_arch2}-softmmu)
1795 9e407a85 pbrook
    target_softmmu="yes"
1796 9e407a85 pbrook
    ;;
1797 600309b6 Blue Swirl
  ${target_arch2}-linux-user)
1798 9e407a85 pbrook
    target_user_only="yes"
1799 9e407a85 pbrook
    target_linux_user="yes"
1800 9e407a85 pbrook
    ;;
1801 600309b6 Blue Swirl
  ${target_arch2}-darwin-user)
1802 9e407a85 pbrook
    target_user_only="yes"
1803 9e407a85 pbrook
    target_darwin_user="yes"
1804 9e407a85 pbrook
    ;;
1805 600309b6 Blue Swirl
  ${target_arch2}-bsd-user)
1806 84778508 blueswir1
    target_user_only="yes"
1807 84778508 blueswir1
    target_bsd_user="yes"
1808 84778508 blueswir1
    ;;
1809 9e407a85 pbrook
  *)
1810 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
1811 9e407a85 pbrook
    exit 1
1812 9e407a85 pbrook
    ;;
1813 9e407a85 pbrook
esac
1814 831b7825 ths
1815 7c1f25b4 bellard
#echo "Creating $config_mak, $config_h and $target_dir/Makefile"
1816 97a847bc bellard
1817 15d9ca0f ths
test -f $config_h && mv $config_h ${config_h}~
1818 15d9ca0f ths
1819 97a847bc bellard
mkdir -p $target_dir
1820 158142c2 bellard
mkdir -p $target_dir/fpu
1821 57fec1fe bellard
mkdir -p $target_dir/tcg
1822 84778508 blueswir1
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
1823 69de927c bellard
  mkdir -p $target_dir/nwfpe
1824 69de927c bellard
fi
1825 69de927c bellard
1826 ec530c81 bellard
#
1827 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
1828 ec530c81 bellard
#
1829 ec530c81 bellard
rm -f $target_dir/Makefile
1830 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
1831 ec530c81 bellard
1832 97a847bc bellard
1833 97a847bc bellard
echo "# Automatically generated by configure - do not modify" > $config_mak
1834 de83cd02 bellard
1835 97a847bc bellard
echo "include ../config-host.mak" >> $config_mak
1836 1e43adfc bellard
1837 e5fe0c52 pbrook
bflt="no"
1838 cb33da57 blueswir1
elfload32="no"
1839 bd0c5661 pbrook
target_nptl="no"
1840 600309b6 Blue Swirl
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
1841 42bc608b Juan Quintela
echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_mak
1842 56aebc89 pbrook
gdb_xml_files=""
1843 7ba1e619 aliguori
1844 938b1edd Juan Quintela
TARGET_ARCH="$target_arch2"
1845 6acff7da Juan Quintela
TARGET_BASE_ARCH=""
1846 e6e91b9c Juan Quintela
TARGET_ABI_DIR=""
1847 e73aae67 Juan Quintela
1848 600309b6 Blue Swirl
case "$target_arch2" in
1849 2408a527 aurel32
  i386)
1850 1ad2134f Paul Brook
    target_phys_bits=32
1851 2408a527 aurel32
  ;;
1852 2408a527 aurel32
  x86_64)
1853 6acff7da Juan Quintela
    TARGET_BASE_ARCH=i386
1854 1ad2134f Paul Brook
    target_phys_bits=64
1855 2408a527 aurel32
  ;;
1856 2408a527 aurel32
  alpha)
1857 1ad2134f Paul Brook
    target_phys_bits=64
1858 2408a527 aurel32
  ;;
1859 2408a527 aurel32
  arm|armeb)
1860 b498c8a0 Juan Quintela
    TARGET_ARCH=arm
1861 2408a527 aurel32
    bflt="yes"
1862 bd0c5661 pbrook
    target_nptl="yes"
1863 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
1864 1ad2134f Paul Brook
    target_phys_bits=32
1865 2408a527 aurel32
  ;;
1866 2408a527 aurel32
  cris)
1867 253bd7f8 edgar_igl
    target_nptl="yes"
1868 1ad2134f Paul Brook
    target_phys_bits=32
1869 2408a527 aurel32
  ;;
1870 2408a527 aurel32
  m68k)
1871 2408a527 aurel32
    bflt="yes"
1872 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
1873 1ad2134f Paul Brook
    target_phys_bits=32
1874 2408a527 aurel32
  ;;
1875 72b675ca Edgar E. Iglesias
  microblaze)
1876 72b675ca Edgar E. Iglesias
    bflt="yes"
1877 72b675ca Edgar E. Iglesias
    target_nptl="yes"
1878 72b675ca Edgar E. Iglesias
    target_phys_bits=32
1879 72b675ca Edgar E. Iglesias
  ;;
1880 0adcffb1 Juan Quintela
  mips|mipsel)
1881 b498c8a0 Juan Quintela
    TARGET_ARCH=mips
1882 42bc608b Juan Quintela
    echo "TARGET_ABI_MIPSO32=y" >> $config_mak
1883 f04dc72f Paul Brook
    target_nptl="yes"
1884 1ad2134f Paul Brook
    target_phys_bits=64
1885 2408a527 aurel32
  ;;
1886 2408a527 aurel32
  mipsn32|mipsn32el)
1887 b498c8a0 Juan Quintela
    TARGET_ARCH=mipsn32
1888 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
1889 42bc608b Juan Quintela
    echo "TARGET_ABI_MIPSN32=y" >> $config_mak
1890 1ad2134f Paul Brook
    target_phys_bits=64
1891 2408a527 aurel32
  ;;
1892 2408a527 aurel32
  mips64|mips64el)
1893 b498c8a0 Juan Quintela
    TARGET_ARCH=mips64
1894 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
1895 42bc608b Juan Quintela
    echo "TARGET_ABI_MIPSN64=y" >> $config_mak
1896 1ad2134f Paul Brook
    target_phys_bits=64
1897 2408a527 aurel32
  ;;
1898 2408a527 aurel32
  ppc)
1899 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1900 1ad2134f Paul Brook
    target_phys_bits=32
1901 d6630708 Nathan Froyd
    target_nptl="yes"
1902 2408a527 aurel32
  ;;
1903 2408a527 aurel32
  ppcemb)
1904 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
1905 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
1906 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1907 1ad2134f Paul Brook
    target_phys_bits=64
1908 d6630708 Nathan Froyd
    target_nptl="yes"
1909 2408a527 aurel32
  ;;
1910 2408a527 aurel32
  ppc64)
1911 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
1912 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
1913 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1914 1ad2134f Paul Brook
    target_phys_bits=64
1915 2408a527 aurel32
  ;;
1916 2408a527 aurel32
  ppc64abi32)
1917 b498c8a0 Juan Quintela
    TARGET_ARCH=ppc64
1918 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
1919 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
1920 42bc608b Juan Quintela
    echo "TARGET_ABI32=y" >> $config_mak
1921 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
1922 1ad2134f Paul Brook
    target_phys_bits=64
1923 2408a527 aurel32
  ;;
1924 2408a527 aurel32
  sh4|sh4eb)
1925 b498c8a0 Juan Quintela
    TARGET_ARCH=sh4
1926 2408a527 aurel32
    bflt="yes"
1927 0b6d3ae0 aurel32
    target_nptl="yes"
1928 1ad2134f Paul Brook
    target_phys_bits=32
1929 2408a527 aurel32
  ;;
1930 2408a527 aurel32
  sparc)
1931 1ad2134f Paul Brook
    target_phys_bits=64
1932 2408a527 aurel32
  ;;
1933 2408a527 aurel32
  sparc64)
1934 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
1935 2408a527 aurel32
    elfload32="yes"
1936 1ad2134f Paul Brook
    target_phys_bits=64
1937 2408a527 aurel32
  ;;
1938 2408a527 aurel32
  sparc32plus)
1939 b498c8a0 Juan Quintela
    TARGET_ARCH=sparc64
1940 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
1941 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=sparc
1942 42bc608b Juan Quintela
    echo "TARGET_ABI32=y" >> $config_mak
1943 1ad2134f Paul Brook
    target_phys_bits=64
1944 2408a527 aurel32
  ;;
1945 2408a527 aurel32
  *)
1946 2408a527 aurel32
    echo "Unsupported target CPU"
1947 2408a527 aurel32
    exit 1
1948 2408a527 aurel32
  ;;
1949 2408a527 aurel32
esac
1950 b498c8a0 Juan Quintela
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak
1951 0adcffb1 Juan Quintela
echo "TARGET_ARCH2=$target_arch2" >> $config_mak
1952 42bc608b Juan Quintela
# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
1953 6acff7da Juan Quintela
if [ "$TARGET_BASE_ARCH" = "" ]; then
1954 6acff7da Juan Quintela
  TARGET_BASE_ARCH=$TARGET_ARCH
1955 6acff7da Juan Quintela
fi
1956 6acff7da Juan Quintela
echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_mak
1957 e6e91b9c Juan Quintela
if [ "$TARGET_ABI_DIR" = "" ]; then
1958 e6e91b9c Juan Quintela
  TARGET_ABI_DIR=$TARGET_ARCH
1959 e6e91b9c Juan Quintela
fi
1960 e6e91b9c Juan Quintela
echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_mak
1961 1ad2134f Paul Brook
if [ $target_phys_bits -lt $hostlongbits ] ; then
1962 1ad2134f Paul Brook
  target_phys_bits=$hostlongbits
1963 1ad2134f Paul Brook
fi
1964 1b0c87fc Juan Quintela
case "$target_arch2" in
1965 1b0c87fc Juan Quintela
  i386|x86_64)
1966 1b0c87fc Juan Quintela
    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
1967 1b0c87fc Juan Quintela
      echo "CONFIG_XEN=y" >> $config_mak
1968 1b0c87fc Juan Quintela
    fi
1969 0d46b7ed Juan Quintela
    if test $kqemu = "yes" -a "$target_softmmu" = "yes"
1970 0d46b7ed Juan Quintela
    then
1971 0d46b7ed Juan Quintela
      echo "CONFIG_KQEMU=y" >> $config_mak
1972 0d46b7ed Juan Quintela
    fi
1973 1b0c87fc Juan Quintela
esac
1974 c59249f9 Juan Quintela
case "$target_arch2" in
1975 5f114bc6 Alexander Graf
  i386|x86_64|ppcemb|ppc|ppc64)
1976 c59249f9 Juan Quintela
    # Make sure the target and host cpus are compatible
1977 c59249f9 Juan Quintela
    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
1978 c59249f9 Juan Quintela
      \( "$target_arch2" = "$cpu" -o \
1979 c59249f9 Juan Quintela
      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
1980 5f114bc6 Alexander Graf
      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
1981 c59249f9 Juan Quintela
      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
1982 c59249f9 Juan Quintela
      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
1983 c59249f9 Juan Quintela
      echo "CONFIG_KVM=y" >> $config_mak
1984 c59249f9 Juan Quintela
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
1985 c59249f9 Juan Quintela
    fi
1986 c59249f9 Juan Quintela
esac
1987 1ad2134f Paul Brook
echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_mak
1988 42bc608b Juan Quintela
echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_mak
1989 1ad2134f Paul Brook
echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
1990 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
1991 42bc608b Juan Quintela
  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_mak
1992 de83cd02 bellard
fi
1993 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
1994 e34af2ce Juan Quintela
  echo "CONFIG_SOFTMMU=y" >> $config_mak
1995 43ce4dfe bellard
fi
1996 997344f3 bellard
if test "$target_user_only" = "yes" ; then
1997 e34af2ce Juan Quintela
  echo "CONFIG_USER_ONLY=y" >> $config_mak
1998 997344f3 bellard
fi
1999 831b7825 ths
if test "$target_linux_user" = "yes" ; then
2000 e34af2ce Juan Quintela
  echo "CONFIG_LINUX_USER=y" >> $config_mak
2001 831b7825 ths
fi
2002 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
2003 e34af2ce Juan Quintela
  echo "CONFIG_DARWIN_USER=y" >> $config_mak
2004 831b7825 ths
fi
2005 56aebc89 pbrook
list=""
2006 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
2007 56aebc89 pbrook
  for x in $gdb_xml_files; do
2008 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
2009 56aebc89 pbrook
  done
2010 56aebc89 pbrook
fi
2011 56aebc89 pbrook
echo "TARGET_XML_FILES=$list" >> $config_mak
2012 97a847bc bellard
2013 f57975fb Juan Quintela
case "$target_arch2" in
2014 f57975fb Juan Quintela
  arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
2015 f57975fb Juan Quintela
    echo "CONFIG_SOFTFLOAT=y" >> $config_mak
2016 f57975fb Juan Quintela
    ;;
2017 f57975fb Juan Quintela
esac
2018 f57975fb Juan Quintela
2019 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2020 e34af2ce Juan Quintela
  echo "TARGET_HAS_BFLT=y" >> $config_mak
2021 e5fe0c52 pbrook
fi
2022 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
2023 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2024 2f7bb878 Juan Quintela
  echo "CONFIG_USE_NPTL=y" >> $config_mak
2025 bd0c5661 pbrook
fi
2026 cb33da57 blueswir1
# 32 bit ELF loader in addition to native 64 bit loader?
2027 cb33da57 blueswir1
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2028 e34af2ce Juan Quintela
  echo "TARGET_HAS_ELFLOAD32=y" >> $config_mak
2029 cb33da57 blueswir1
fi
2030 379f6698 Paul Brook
if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2031 379f6698 Paul Brook
  echo "CONFIG_USE_GUEST_BASE=y" >> $config_mak
2032 379f6698 Paul Brook
fi
2033 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
2034 e34af2ce Juan Quintela
  echo "CONFIG_BSD_USER=y" >> $config_mak
2035 84778508 blueswir1
fi
2036 5b0753e0 bellard
2037 fa282484 Juan Quintela
# generate LDFLAGS for targets
2038 fa282484 Juan Quintela
2039 fa282484 Juan Quintela
ldflags=""
2040 fa282484 Juan Quintela
if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
2041 fa282484 Juan Quintela
  case "$ARCH" in
2042 fa282484 Juan Quintela
  i386)
2043 fa282484 Juan Quintela
    if test "$gprof" = "yes" -o "$static" = "yes" ; then
2044 4bf6b55b Juan Quintela
      ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
2045 fa282484 Juan Quintela
    else
2046 fa282484 Juan Quintela
      # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
2047 fa282484 Juan Quintela
      # that the kernel ELF loader considers as an executable. I think this
2048 fa282484 Juan Quintela
      # is the simplest way to make it self virtualizable!
2049 fa282484 Juan Quintela
      ldflags='-Wl,-shared'
2050 fa282484 Juan Quintela
    fi
2051 fa282484 Juan Quintela
    ;;
2052 fa282484 Juan Quintela
  sparc)
2053 fa282484 Juan Quintela
    # -static is used to avoid g1/g3 usage by the dynamic linker
2054 4bf6b55b Juan Quintela
    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2055 fa282484 Juan Quintela
    ;;
2056 fa282484 Juan Quintela
  ia64)
2057 4bf6b55b Juan Quintela
    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2058 fa282484 Juan Quintela
    ;;
2059 fa282484 Juan Quintela
  x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
2060 4bf6b55b Juan Quintela
    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
2061 fa282484 Juan Quintela
    ;;
2062 fa282484 Juan Quintela
  esac
2063 fa282484 Juan Quintela
fi
2064 fa282484 Juan Quintela
if test "$target_softmmu" = "yes" ; then
2065 fa282484 Juan Quintela
  case "$ARCH" in
2066 fa282484 Juan Quintela
  ia64)
2067 4bf6b55b Juan Quintela
    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
2068 fa282484 Juan Quintela
    ;;
2069 fa282484 Juan Quintela
  esac
2070 fa282484 Juan Quintela
fi
2071 fa282484 Juan Quintela
2072 fa282484 Juan Quintela
if test "$ldflags" != "" ; then
2073 fa282484 Juan Quintela
  echo "LDFLAGS+=$ldflags" >> $config_mak
2074 fa282484 Juan Quintela
fi
2075 fa282484 Juan Quintela
2076 2358a494 Juan Quintela
echo "/* Automatically generated by configure - do not modify */" > $config_h
2077 2358a494 Juan Quintela
echo "#include \"../config-host.h\"" >> $config_h
2078 2358a494 Juan Quintela
2079 0ff6697d malc
$SHELL $source_path/create_config < $config_mak >> $config_h
2080 42bc608b Juan Quintela
2081 a900c002 Juan Quintela
if test -f ${config_h}~ ; then
2082 a900c002 Juan Quintela
  if cmp -s $config_h ${config_h}~ ; then
2083 a900c002 Juan Quintela
    mv ${config_h}~ $config_h
2084 a900c002 Juan Quintela
  else
2085 a900c002 Juan Quintela
    rm ${config_h}~
2086 a900c002 Juan Quintela
  fi
2087 a900c002 Juan Quintela
fi
2088 15d9ca0f ths
2089 97a847bc bellard
done # for target in $targets
2090 7d13299d bellard
2091 7d13299d bellard
# build tree in object directory if source path is different from current one
2092 7d13299d bellard
if test "$source_path_used" = "yes" ; then
2093 253d0942 Alexander Graf
    DIRS="tests tests/cris slirp audio block pc-bios/optionrom"
2094 7d13299d bellard
    FILES="Makefile tests/Makefile"
2095 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2096 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
2097 7ea78b74 Jan Kiszka
    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2098 7ea78b74 Jan Kiszka
    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2099 7ea78b74 Jan Kiszka
        FILES="$FILES pc-bios/`basename $bios_file`"
2100 7ea78b74 Jan Kiszka
    done
2101 7d13299d bellard
    for dir in $DIRS ; do
2102 7d13299d bellard
            mkdir -p $dir
2103 7d13299d bellard
    done
2104 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
2105 7d13299d bellard
    for f in $FILES ; do
2106 ec530c81 bellard
        rm -f $f
2107 ec530c81 bellard
        ln -s $source_path/$f $f
2108 7d13299d bellard
    done
2109 7d13299d bellard
fi
2110 1ad2134f Paul Brook
2111 1ad2134f Paul Brook
for hwlib in 32 64; do
2112 1ad2134f Paul Brook
  d=libhw$hwlib
2113 1ad2134f Paul Brook
  mkdir -p $d
2114 1ad2134f Paul Brook
  rm -f $d/Makefile
2115 1ad2134f Paul Brook
  ln -s $source_path/Makefile.hw $d/Makefile
2116 1ad2134f Paul Brook
  echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2117 1ad2134f Paul Brook
  echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2118 1ad2134f Paul Brook
done