Statistics
| Branch: | Revision:

root / configure @ a558ee17

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