Statistics
| Branch: | Revision:

root / configure @ afa05235

History | View | Annotate | Download (65 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 a91b857c malc
TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
17 7d13299d bellard
18 02d5467e malc
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 eb852011 Markus Armbruster
block_drv_whitelist=""
42 7d13299d bellard
host_cc="gcc"
43 7d13299d bellard
ar="ar"
44 7d13299d bellard
make="make"
45 6a882643 pbrook
install="install"
46 7aa486fe Anthony Liguori
objcopy="objcopy"
47 7aa486fe Anthony Liguori
ld="ld"
48 c81da56e Juan Quintela
helper_cflags=""
49 73da375e Juan Quintela
libs_softmmu=""
50 3e2e0e6b Juan Quintela
libs_tools=""
51 67f86e8e Juan Quintela
audio_pt_int=""
52 d5631638 malc
audio_win_int=""
53 ac0df51d aliguori
54 ac0df51d aliguori
# parse CC options first
55 ac0df51d aliguori
for opt do
56 ac0df51d aliguori
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
57 ac0df51d aliguori
  case "$opt" in
58 ac0df51d aliguori
  --cross-prefix=*) cross_prefix="$optarg"
59 ac0df51d aliguori
  ;;
60 ac0df51d aliguori
  --cc=*) cc="$optarg"
61 ac0df51d aliguori
  ;;
62 2ff6b91e Juan Quintela
  --cpu=*) cpu="$optarg"
63 2ff6b91e Juan Quintela
  ;;
64 a558ee17 Juan Quintela
  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
65 e2a2ed06 Juan Quintela
  ;;
66 e2a2ed06 Juan Quintela
  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
67 e2a2ed06 Juan Quintela
  ;;
68 50e7b1a0 Juan Quintela
  --sparc_cpu=*)
69 50e7b1a0 Juan Quintela
    sparc_cpu="$optarg"
70 50e7b1a0 Juan Quintela
    case $sparc_cpu in
71 ed968ff1 Juan Quintela
    v7|v8|v8plus|v8plusa)
72 50e7b1a0 Juan Quintela
      cpu="sparc"
73 50e7b1a0 Juan Quintela
    ;;
74 50e7b1a0 Juan Quintela
    v9)
75 50e7b1a0 Juan Quintela
      cpu="sparc64"
76 50e7b1a0 Juan Quintela
    ;;
77 50e7b1a0 Juan Quintela
    *)
78 50e7b1a0 Juan Quintela
      echo "undefined SPARC architecture. Exiting";
79 50e7b1a0 Juan Quintela
      exit 1
80 50e7b1a0 Juan Quintela
    ;;
81 50e7b1a0 Juan Quintela
    esac
82 50e7b1a0 Juan Quintela
  ;;
83 ac0df51d aliguori
  esac
84 ac0df51d aliguori
done
85 ac0df51d aliguori
# OS specific
86 ac0df51d aliguori
# Using uname is really, really broken.  Once we have the right set of checks
87 ac0df51d aliguori
# we can eliminate it's usage altogether
88 ac0df51d aliguori
89 ac0df51d aliguori
cc="${cross_prefix}${cc}"
90 ac0df51d aliguori
ar="${cross_prefix}${ar}"
91 7aa486fe Anthony Liguori
objcopy="${cross_prefix}${objcopy}"
92 7aa486fe Anthony Liguori
ld="${cross_prefix}${ld}"
93 ac0df51d aliguori
94 ac0df51d aliguori
# check that the C compiler works.
95 ac0df51d aliguori
cat > $TMPC <<EOF
96 ac0df51d aliguori
int main(void) {}
97 ac0df51d aliguori
EOF
98 ac0df51d aliguori
99 52166aa0 Juan Quintela
if compile_object ; then
100 ac0df51d aliguori
  : C compiler works ok
101 ac0df51d aliguori
else
102 ac0df51d aliguori
    echo "ERROR: \"$cc\" either does not exist or does not work"
103 ac0df51d aliguori
    exit 1
104 ac0df51d aliguori
fi
105 ac0df51d aliguori
106 ac0df51d aliguori
check_define() {
107 ac0df51d aliguori
cat > $TMPC <<EOF
108 ac0df51d aliguori
#if !defined($1)
109 ac0df51d aliguori
#error Not defined
110 ac0df51d aliguori
#endif
111 ac0df51d aliguori
int main(void) { return 0; }
112 ac0df51d aliguori
EOF
113 52166aa0 Juan Quintela
  compile_object
114 ac0df51d aliguori
}
115 ac0df51d aliguori
116 2ff6b91e Juan Quintela
if test ! -z "$cpu" ; then
117 2ff6b91e Juan Quintela
  # command line argument
118 2ff6b91e Juan Quintela
  :
119 2ff6b91e Juan Quintela
elif check_define __i386__ ; then
120 ac0df51d aliguori
  cpu="i386"
121 ac0df51d aliguori
elif check_define __x86_64__ ; then
122 ac0df51d aliguori
  cpu="x86_64"
123 3aa9bd6c blueswir1
elif check_define __sparc__ ; then
124 3aa9bd6c blueswir1
  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
125 3aa9bd6c blueswir1
  # They must be specified using --sparc_cpu
126 3aa9bd6c blueswir1
  if check_define __arch64__ ; then
127 3aa9bd6c blueswir1
    cpu="sparc64"
128 3aa9bd6c blueswir1
  else
129 3aa9bd6c blueswir1
    cpu="sparc"
130 3aa9bd6c blueswir1
  fi
131 fdf7ed96 malc
elif check_define _ARCH_PPC ; then
132 fdf7ed96 malc
  if check_define _ARCH_PPC64 ; then
133 fdf7ed96 malc
    cpu="ppc64"
134 fdf7ed96 malc
  else
135 fdf7ed96 malc
    cpu="ppc"
136 fdf7ed96 malc
  fi
137 afa05235 Aurelien Jarno
elif check_define __mips__ ; then
138 afa05235 Aurelien Jarno
  cpu="mips"
139 ac0df51d aliguori
else
140 fdf7ed96 malc
  cpu=`uname -m`
141 ac0df51d aliguori
fi
142 ac0df51d aliguori
143 5327cf48 bellard
target_list=""
144 7d13299d bellard
case "$cpu" in
145 afa05235 Aurelien Jarno
  alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
146 ea8f20f8 Juan Quintela
    cpu="$cpu"
147 ea8f20f8 Juan Quintela
  ;;
148 7d13299d bellard
  i386|i486|i586|i686|i86pc|BePC)
149 97a847bc bellard
    cpu="i386"
150 7d13299d bellard
  ;;
151 aaa5fa14 aurel32
  x86_64|amd64)
152 aaa5fa14 aurel32
    cpu="x86_64"
153 aaa5fa14 aurel32
  ;;
154 ba68055e bellard
  armv*b)
155 808c4954 bellard
    cpu="armv4b"
156 808c4954 bellard
  ;;
157 ba68055e bellard
  armv*l)
158 7d13299d bellard
    cpu="armv4l"
159 7d13299d bellard
  ;;
160 f54b3f92 aurel32
  parisc|parisc64)
161 f54b3f92 aurel32
    cpu="hppa"
162 f54b3f92 aurel32
  ;;
163 afa05235 Aurelien Jarno
  mips*)
164 afa05235 Aurelien Jarno
    cpu="mips"
165 afa05235 Aurelien Jarno
  ;;
166 0e7b8a9f ths
  s390*)
167 fb3e5849 bellard
    cpu="s390"
168 fb3e5849 bellard
  ;;
169 3142255c blueswir1
  sparc|sun4[cdmuv])
170 ae228531 bellard
    cpu="sparc"
171 ae228531 bellard
  ;;
172 7d13299d bellard
  *)
173 7d13299d bellard
    cpu="unknown"
174 7d13299d bellard
  ;;
175 7d13299d bellard
esac
176 e2d52ad3 Juan Quintela
177 3a3fb96d Stefan Weil
# Default value for a variable defining feature "foo".
178 3a3fb96d Stefan Weil
#  * foo="no"  feature will only be used if --enable-foo arg is given
179 3a3fb96d Stefan Weil
#  * foo=""    feature will be searched for, and if found, will be used
180 3a3fb96d Stefan Weil
#              unless --disable-foo is given
181 3a3fb96d Stefan Weil
#  * foo="yes" this value will only be set by --enable-foo flag.
182 3a3fb96d Stefan Weil
#              feature will searched for,
183 3a3fb96d Stefan Weil
#              if not found, configure exits with error
184 e2d52ad3 Juan Quintela
#
185 3a3fb96d Stefan Weil
# Always add --enable-foo and --disable-foo command line args.
186 3a3fb96d Stefan Weil
# Distributions want to ensure that several features are compiled in, and it
187 3a3fb96d Stefan Weil
# is impossible without a --enable-foo that exits if a feature is not found.
188 e2d52ad3 Juan Quintela
189 a20a6f46 Juan Quintela
bluez=""
190 4ffcedb6 Juan Quintela
brlapi=""
191 788c8196 Juan Quintela
curl=""
192 c584a6d0 Juan Quintela
curses=""
193 a25dba17 Juan Quintela
docs=""
194 2df87df7 Juan Quintela
fdt=""
195 b31a0277 Juan Quintela
kvm=""
196 b0a47e79 Juan Quintela
nptl=""
197 c4198157 Juan Quintela
sdl=""
198 dfffc653 Juan Quintela
sparse="no"
199 ee682d27 Stefan Weil
uuid=""
200 dfb278bd Juan Quintela
vde=""
201 1be10ad2 Juan Quintela
vnc_tls=""
202 ea784e3b Juan Quintela
vnc_sasl=""
203 fc321b4b Juan Quintela
xen=""
204 5c6c3a6c Christoph Hellwig
linux_aio=""
205 dfb278bd Juan Quintela
206 7d13299d bellard
gprof="no"
207 f8393946 aurel32
debug_tcg="no"
208 f3d08ee6 Paul Brook
debug="no"
209 1625af87 aliguori
strip_opt="yes"
210 7d13299d bellard
bigendian="no"
211 67b915a5 bellard
mingw32="no"
212 67b915a5 bellard
EXESUF=""
213 443f1376 bellard
slirp="yes"
214 102a52e4 bellard
fmod_lib=""
215 102a52e4 bellard
fmod_inc=""
216 2f6a1ab0 blueswir1
oss_lib=""
217 b1a550a0 pbrook
bsd="no"
218 5327cf48 bellard
linux="no"
219 d2c7c9b8 blueswir1
solaris="no"
220 05c2a3e7 bellard
profiler="no"
221 5b0753e0 bellard
cocoa="no"
222 0a8e90f4 pbrook
softmmu="yes"
223 831b7825 ths
linux_user="no"
224 831b7825 ths
darwin_user="no"
225 84778508 blueswir1
bsd_user="no"
226 379f6698 Paul Brook
guest_base=""
227 c5937220 pbrook
uname_release=""
228 e5d355d1 aliguori
io_thread="no"
229 8ff9cbf7 malc
mixemu="no"
230 eac30262 aliguori
kerneldir=""
231 b29fe3ed malc
aix="no"
232 77755340 ths
blobs="yes"
233 4a19f1ec pbrook
pkgversion=""
234 5495ed11 Luiz Capitulino
check_utests="no"
235 34005a00 Kirill A. Shutemov
user_pie="no"
236 7d13299d bellard
237 7d13299d bellard
# OS specific
238 ac0df51d aliguori
if check_define __linux__ ; then
239 ac0df51d aliguori
  targetos="Linux"
240 ac0df51d aliguori
elif check_define _WIN32 ; then
241 ac0df51d aliguori
  targetos='MINGW32'
242 169dc5d3 blueswir1
elif check_define __OpenBSD__ ; then
243 169dc5d3 blueswir1
  targetos='OpenBSD'
244 169dc5d3 blueswir1
elif check_define __sun__ ; then
245 169dc5d3 blueswir1
  targetos='SunOS'
246 ac0df51d aliguori
else
247 ac0df51d aliguori
  targetos=`uname -s`
248 ac0df51d aliguori
fi
249 0dbfc675 Juan Quintela
250 7d13299d bellard
case $targetos in
251 c326e0af bellard
CYGWIN*)
252 0dbfc675 Juan Quintela
  mingw32="yes"
253 a558ee17 Juan Quintela
  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
254 d5631638 malc
  audio_possible_drivers="winwave sdl"
255 d5631638 malc
  audio_drv_list="winwave"
256 c326e0af bellard
;;
257 67b915a5 bellard
MINGW32*)
258 0dbfc675 Juan Quintela
  mingw32="yes"
259 d5631638 malc
  audio_possible_drivers="winwave dsound sdl fmod"
260 d5631638 malc
  audio_drv_list="winwave"
261 67b915a5 bellard
;;
262 5c40d2bd ths
GNU/kFreeBSD)
263 a167ba50 Aurelien Jarno
  bsd="yes"
264 0dbfc675 Juan Quintela
  audio_drv_list="oss"
265 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
266 5c40d2bd ths
;;
267 7d3505c5 bellard
FreeBSD)
268 0dbfc675 Juan Quintela
  bsd="yes"
269 a167ba50 Aurelien Jarno
  make="gmake"
270 0dbfc675 Juan Quintela
  audio_drv_list="oss"
271 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
272 7d3505c5 bellard
;;
273 c5e97233 blueswir1
DragonFly)
274 0dbfc675 Juan Quintela
  bsd="yes"
275 a167ba50 Aurelien Jarno
  make="gmake"
276 0dbfc675 Juan Quintela
  audio_drv_list="oss"
277 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd pa"
278 c5e97233 blueswir1
;;
279 7d3505c5 bellard
NetBSD)
280 0dbfc675 Juan Quintela
  bsd="yes"
281 a167ba50 Aurelien Jarno
  make="gmake"
282 0dbfc675 Juan Quintela
  audio_drv_list="oss"
283 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd"
284 0dbfc675 Juan Quintela
  oss_lib="-lossaudio"
285 7d3505c5 bellard
;;
286 7d3505c5 bellard
OpenBSD)
287 0dbfc675 Juan Quintela
  bsd="yes"
288 a167ba50 Aurelien Jarno
  make="gmake"
289 0dbfc675 Juan Quintela
  audio_drv_list="oss"
290 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl esd"
291 0dbfc675 Juan Quintela
  oss_lib="-lossaudio"
292 7d3505c5 bellard
;;
293 83fb7adf bellard
Darwin)
294 0dbfc675 Juan Quintela
  bsd="yes"
295 0dbfc675 Juan Quintela
  darwin="yes"
296 0dbfc675 Juan Quintela
  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
297 0dbfc675 Juan Quintela
  # run 64-bit userspace code
298 0dbfc675 Juan Quintela
  if [ "$cpu" = "i386" ] ; then
299 aab8588a malc
    is_x86_64=`sysctl -n hw.optional.x86_64`
300 aab8588a malc
    [ "$is_x86_64" = "1" ] && cpu=x86_64
301 0dbfc675 Juan Quintela
  fi
302 0dbfc675 Juan Quintela
  if [ "$cpu" = "x86_64" ] ; then
303 a558ee17 Juan Quintela
    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
304 0c439cbf Juan Quintela
    LDFLAGS="-arch x86_64 $LDFLAGS"
305 0dbfc675 Juan Quintela
  else
306 a558ee17 Juan Quintela
    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
307 0dbfc675 Juan Quintela
  fi
308 0dbfc675 Juan Quintela
  darwin_user="yes"
309 0dbfc675 Juan Quintela
  cocoa="yes"
310 0dbfc675 Juan Quintela
  audio_drv_list="coreaudio"
311 0dbfc675 Juan Quintela
  audio_possible_drivers="coreaudio sdl fmod"
312 0dbfc675 Juan Quintela
  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
313 7973f21c Juan Quintela
  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
314 83fb7adf bellard
;;
315 ec530c81 bellard
SunOS)
316 0dbfc675 Juan Quintela
  solaris="yes"
317 0dbfc675 Juan Quintela
  make="gmake"
318 0dbfc675 Juan Quintela
  install="ginstall"
319 fa58948d Blue Swirl
  ld="gld"
320 0dbfc675 Juan Quintela
  needs_libsunmath="no"
321 0dbfc675 Juan Quintela
  solarisrev=`uname -r | cut -f2 -d.`
322 0dbfc675 Juan Quintela
  # have to select again, because `uname -m` returns i86pc
323 0dbfc675 Juan Quintela
  # even on an x86_64 box.
324 0dbfc675 Juan Quintela
  solariscpu=`isainfo -k`
325 0dbfc675 Juan Quintela
  if test "${solariscpu}" = "amd64" ; then
326 0dbfc675 Juan Quintela
    cpu="x86_64"
327 0dbfc675 Juan Quintela
  fi
328 0dbfc675 Juan Quintela
  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
329 0dbfc675 Juan Quintela
    if test "$solarisrev" -le 9 ; then
330 0dbfc675 Juan Quintela
      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
331 0dbfc675 Juan Quintela
        needs_libsunmath="yes"
332 f14bfdf9 Juan Quintela
        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
333 f14bfdf9 Juan Quintela
        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
334 f14bfdf9 Juan Quintela
        LIBS="-lsunmath $LIBS"
335 0dbfc675 Juan Quintela
      else
336 0dbfc675 Juan Quintela
        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
337 0dbfc675 Juan Quintela
        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
338 0dbfc675 Juan Quintela
        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
339 0dbfc675 Juan Quintela
        echo "Studio 11 can be downloaded from www.sun.com."
340 0dbfc675 Juan Quintela
        exit 1
341 0dbfc675 Juan Quintela
      fi
342 86b2bd93 ths
    fi
343 0dbfc675 Juan Quintela
  fi
344 0dbfc675 Juan Quintela
  if test -f /usr/include/sys/soundcard.h ; then
345 0dbfc675 Juan Quintela
    audio_drv_list="oss"
346 0dbfc675 Juan Quintela
  fi
347 0dbfc675 Juan Quintela
  audio_possible_drivers="oss sdl"
348 d741429a Blue Swirl
# needed for CMSG_ macros in sys/socket.h
349 d741429a Blue Swirl
  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
350 d741429a Blue Swirl
# needed for TIOCWIN* defines in termios.h
351 d741429a Blue Swirl
  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
352 a558ee17 Juan Quintela
  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
353 e174c0bb Juan Quintela
  LIBS="-lsocket -lnsl -lresolv $LIBS"
354 86b2bd93 ths
;;
355 b29fe3ed malc
AIX)
356 0dbfc675 Juan Quintela
  aix="yes"
357 0dbfc675 Juan Quintela
  make="gmake"
358 b29fe3ed malc
;;
359 1d14ffa9 bellard
*)
360 0dbfc675 Juan Quintela
  audio_drv_list="oss"
361 0dbfc675 Juan Quintela
  audio_possible_drivers="oss alsa sdl esd pa"
362 0dbfc675 Juan Quintela
  linux="yes"
363 0dbfc675 Juan Quintela
  linux_user="yes"
364 0dbfc675 Juan Quintela
  usb="linux"
365 0dbfc675 Juan Quintela
  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
366 c2de5c91 malc
    audio_possible_drivers="$audio_possible_drivers fmod"
367 0dbfc675 Juan Quintela
  fi
368 fb065187 bellard
;;
369 7d13299d bellard
esac
370 7d13299d bellard
371 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
372 b1a550a0 pbrook
  if [ "$darwin" != "yes" ] ; then
373 68063649 blueswir1
    usb="bsd"
374 83fb7adf bellard
  fi
375 84778508 blueswir1
  bsd_user="yes"
376 7d3505c5 bellard
fi
377 7d3505c5 bellard
378 3457a3f8 Juan Quintela
if test "$mingw32" = "yes" ; then
379 3457a3f8 Juan Quintela
  EXESUF=".exe"
380 a558ee17 Juan Quintela
  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
381 884044aa Juan Quintela
  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
382 3457a3f8 Juan Quintela
fi
383 3457a3f8 Juan Quintela
384 7d13299d bellard
# find source path
385 ad064840 pbrook
source_path=`dirname "$0"`
386 59faef3a balrog
source_path_used="no"
387 59faef3a balrog
workdir=`pwd`
388 ad064840 pbrook
if [ -z "$source_path" ]; then
389 59faef3a balrog
    source_path=$workdir
390 ad064840 pbrook
else
391 ad064840 pbrook
    source_path=`cd "$source_path"; pwd`
392 7d13299d bellard
fi
393 724db118 pbrook
[ -f "$workdir/vl.c" ] || source_path_used="yes"
394 7d13299d bellard
395 487fefdb Anthony Liguori
werror=""
396 85aa5189 bellard
397 7d13299d bellard
for opt do
398 a46e4035 pbrook
  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
399 7d13299d bellard
  case "$opt" in
400 2efc3265 bellard
  --help|-h) show_help=yes
401 2efc3265 bellard
  ;;
402 b1a550a0 pbrook
  --prefix=*) prefix="$optarg"
403 7d13299d bellard
  ;;
404 b1a550a0 pbrook
  --interp-prefix=*) interp_prefix="$optarg"
405 32ce6337 bellard
  ;;
406 b1a550a0 pbrook
  --source-path=*) source_path="$optarg"
407 ad064840 pbrook
  source_path_used="yes"
408 7d13299d bellard
  ;;
409 ac0df51d aliguori
  --cross-prefix=*)
410 7d13299d bellard
  ;;
411 ac0df51d aliguori
  --cc=*)
412 7d13299d bellard
  ;;
413 b1a550a0 pbrook
  --host-cc=*) host_cc="$optarg"
414 83469015 bellard
  ;;
415 b1a550a0 pbrook
  --make=*) make="$optarg"
416 7d13299d bellard
  ;;
417 6a882643 pbrook
  --install=*) install="$optarg"
418 6a882643 pbrook
  ;;
419 e2a2ed06 Juan Quintela
  --extra-cflags=*)
420 7d13299d bellard
  ;;
421 e2a2ed06 Juan Quintela
  --extra-ldflags=*)
422 7d13299d bellard
  ;;
423 2ff6b91e Juan Quintela
  --cpu=*)
424 7d13299d bellard
  ;;
425 b1a550a0 pbrook
  --target-list=*) target_list="$optarg"
426 de83cd02 bellard
  ;;
427 7d13299d bellard
  --enable-gprof) gprof="yes"
428 7d13299d bellard
  ;;
429 43ce4dfe bellard
  --static) static="yes"
430 43ce4dfe bellard
  ;;
431 97a847bc bellard
  --disable-sdl) sdl="no"
432 97a847bc bellard
  ;;
433 c4198157 Juan Quintela
  --enable-sdl) sdl="yes"
434 c4198157 Juan Quintela
  ;;
435 0c58ac1c malc
  --fmod-lib=*) fmod_lib="$optarg"
436 1d14ffa9 bellard
  ;;
437 c2de5c91 malc
  --fmod-inc=*) fmod_inc="$optarg"
438 c2de5c91 malc
  ;;
439 2f6a1ab0 blueswir1
  --oss-lib=*) oss_lib="$optarg"
440 2f6a1ab0 blueswir1
  ;;
441 2fa7d3bf malc
  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
442 102a52e4 bellard
  ;;
443 0c58ac1c malc
  --audio-drv-list=*) audio_drv_list="$optarg"
444 102a52e4 bellard
  ;;
445 eb852011 Markus Armbruster
  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
446 eb852011 Markus Armbruster
  ;;
447 f8393946 aurel32
  --enable-debug-tcg) debug_tcg="yes"
448 f8393946 aurel32
  ;;
449 f8393946 aurel32
  --disable-debug-tcg) debug_tcg="no"
450 f8393946 aurel32
  ;;
451 f3d08ee6 Paul Brook
  --enable-debug)
452 f3d08ee6 Paul Brook
      # Enable debugging options that aren't excessively noisy
453 f3d08ee6 Paul Brook
      debug_tcg="yes"
454 f3d08ee6 Paul Brook
      debug="yes"
455 f3d08ee6 Paul Brook
      strip_opt="no"
456 f3d08ee6 Paul Brook
  ;;
457 03b4fe7d aliguori
  --enable-sparse) sparse="yes"
458 03b4fe7d aliguori
  ;;
459 03b4fe7d aliguori
  --disable-sparse) sparse="no"
460 03b4fe7d aliguori
  ;;
461 1625af87 aliguori
  --disable-strip) strip_opt="no"
462 1625af87 aliguori
  ;;
463 8d5d2d4c ths
  --disable-vnc-tls) vnc_tls="no"
464 8d5d2d4c ths
  ;;
465 1be10ad2 Juan Quintela
  --enable-vnc-tls) vnc_tls="yes"
466 1be10ad2 Juan Quintela
  ;;
467 2f9606b3 aliguori
  --disable-vnc-sasl) vnc_sasl="no"
468 2f9606b3 aliguori
  ;;
469 ea784e3b Juan Quintela
  --enable-vnc-sasl) vnc_sasl="yes"
470 ea784e3b Juan Quintela
  ;;
471 443f1376 bellard
  --disable-slirp) slirp="no"
472 1d14ffa9 bellard
  ;;
473 ee682d27 Stefan Weil
  --disable-uuid) uuid="no"
474 ee682d27 Stefan Weil
  ;;
475 ee682d27 Stefan Weil
  --enable-uuid) uuid="yes"
476 ee682d27 Stefan Weil
  ;;
477 e0e6c8c0 aliguori
  --disable-vde) vde="no"
478 8a16d273 ths
  ;;
479 dfb278bd Juan Quintela
  --enable-vde) vde="yes"
480 dfb278bd Juan Quintela
  ;;
481 e37630ca aliguori
  --disable-xen) xen="no"
482 e37630ca aliguori
  ;;
483 fc321b4b Juan Quintela
  --enable-xen) xen="yes"
484 fc321b4b Juan Quintela
  ;;
485 2e4d9fb1 aurel32
  --disable-brlapi) brlapi="no"
486 2e4d9fb1 aurel32
  ;;
487 4ffcedb6 Juan Quintela
  --enable-brlapi) brlapi="yes"
488 4ffcedb6 Juan Quintela
  ;;
489 fb599c9a balrog
  --disable-bluez) bluez="no"
490 fb599c9a balrog
  ;;
491 a20a6f46 Juan Quintela
  --enable-bluez) bluez="yes"
492 a20a6f46 Juan Quintela
  ;;
493 7ba1e619 aliguori
  --disable-kvm) kvm="no"
494 7ba1e619 aliguori
  ;;
495 b31a0277 Juan Quintela
  --enable-kvm) kvm="yes"
496 b31a0277 Juan Quintela
  ;;
497 05c2a3e7 bellard
  --enable-profiler) profiler="yes"
498 05c2a3e7 bellard
  ;;
499 c2de5c91 malc
  --enable-cocoa)
500 c2de5c91 malc
      cocoa="yes" ;
501 c2de5c91 malc
      sdl="no" ;
502 c2de5c91 malc
      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
503 1d14ffa9 bellard
  ;;
504 cad25d69 pbrook
  --disable-system) softmmu="no"
505 0a8e90f4 pbrook
  ;;
506 cad25d69 pbrook
  --enable-system) softmmu="yes"
507 0a8e90f4 pbrook
  ;;
508 0953a80f Zachary Amsden
  --disable-user)
509 0953a80f Zachary Amsden
      linux_user="no" ;
510 0953a80f Zachary Amsden
      bsd_user="no" ;
511 0953a80f Zachary Amsden
      darwin_user="no"
512 0953a80f Zachary Amsden
  ;;
513 0953a80f Zachary Amsden
  --enable-user) ;;
514 831b7825 ths
  --disable-linux-user) linux_user="no"
515 0a8e90f4 pbrook
  ;;
516 831b7825 ths
  --enable-linux-user) linux_user="yes"
517 831b7825 ths
  ;;
518 831b7825 ths
  --disable-darwin-user) darwin_user="no"
519 831b7825 ths
  ;;
520 831b7825 ths
  --enable-darwin-user) darwin_user="yes"
521 0a8e90f4 pbrook
  ;;
522 84778508 blueswir1
  --disable-bsd-user) bsd_user="no"
523 84778508 blueswir1
  ;;
524 84778508 blueswir1
  --enable-bsd-user) bsd_user="yes"
525 84778508 blueswir1
  ;;
526 379f6698 Paul Brook
  --enable-guest-base) guest_base="yes"
527 379f6698 Paul Brook
  ;;
528 379f6698 Paul Brook
  --disable-guest-base) guest_base="no"
529 379f6698 Paul Brook
  ;;
530 34005a00 Kirill A. Shutemov
  --enable-user-pie) user_pie="yes"
531 34005a00 Kirill A. Shutemov
  ;;
532 34005a00 Kirill A. Shutemov
  --disable-user-pie) user_pie="no"
533 34005a00 Kirill A. Shutemov
  ;;
534 c5937220 pbrook
  --enable-uname-release=*) uname_release="$optarg"
535 c5937220 pbrook
  ;;
536 3142255c blueswir1
  --sparc_cpu=*)
537 3142255c blueswir1
  ;;
538 85aa5189 bellard
  --enable-werror) werror="yes"
539 85aa5189 bellard
  ;;
540 85aa5189 bellard
  --disable-werror) werror="no"
541 85aa5189 bellard
  ;;
542 4d3b6f6e balrog
  --disable-curses) curses="no"
543 4d3b6f6e balrog
  ;;
544 c584a6d0 Juan Quintela
  --enable-curses) curses="yes"
545 c584a6d0 Juan Quintela
  ;;
546 769ce76d Alexander Graf
  --disable-curl) curl="no"
547 769ce76d Alexander Graf
  ;;
548 788c8196 Juan Quintela
  --enable-curl) curl="yes"
549 788c8196 Juan Quintela
  ;;
550 2df87df7 Juan Quintela
  --disable-fdt) fdt="no"
551 2df87df7 Juan Quintela
  ;;
552 2df87df7 Juan Quintela
  --enable-fdt) fdt="yes"
553 2df87df7 Juan Quintela
  ;;
554 5495ed11 Luiz Capitulino
  --disable-check-utests) check_utests="no"
555 5495ed11 Luiz Capitulino
  ;;
556 5495ed11 Luiz Capitulino
  --enable-check-utests) check_utests="yes"
557 5495ed11 Luiz Capitulino
  ;;
558 bd0c5661 pbrook
  --disable-nptl) nptl="no"
559 bd0c5661 pbrook
  ;;
560 b0a47e79 Juan Quintela
  --enable-nptl) nptl="yes"
561 b0a47e79 Juan Quintela
  ;;
562 8ff9cbf7 malc
  --enable-mixemu) mixemu="yes"
563 8ff9cbf7 malc
  ;;
564 5c6c3a6c Christoph Hellwig
  --disable-linux-aio) linux_aio="no"
565 5c6c3a6c Christoph Hellwig
  ;;
566 5c6c3a6c Christoph Hellwig
  --enable-linux-aio) linux_aio="yes"
567 5c6c3a6c Christoph Hellwig
  ;;
568 e5d355d1 aliguori
  --enable-io-thread) io_thread="yes"
569 e5d355d1 aliguori
  ;;
570 77755340 ths
  --disable-blobs) blobs="no"
571 77755340 ths
  ;;
572 eac30262 aliguori
  --kerneldir=*) kerneldir="$optarg"
573 eac30262 aliguori
  ;;
574 4a19f1ec pbrook
  --with-pkgversion=*) pkgversion=" ($optarg)"
575 4a19f1ec pbrook
  ;;
576 a25dba17 Juan Quintela
  --disable-docs) docs="no"
577 70ec5dc0 Anthony Liguori
  ;;
578 a25dba17 Juan Quintela
  --enable-docs) docs="yes"
579 83a3ab8b Juan Quintela
  ;;
580 7f1559c6 balrog
  *) echo "ERROR: unknown option $opt"; show_help="yes"
581 7f1559c6 balrog
  ;;
582 7d13299d bellard
  esac
583 7d13299d bellard
done
584 7d13299d bellard
585 3142255c blueswir1
#
586 3142255c blueswir1
# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
587 a558ee17 Juan Quintela
# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
588 3142255c blueswir1
#
589 379f6698 Paul Brook
host_guest_base="no"
590 40293e58 bellard
case "$cpu" in
591 ed968ff1 Juan Quintela
    sparc) case $sparc_cpu in
592 ed968ff1 Juan Quintela
           v7|v8)
593 a558ee17 Juan Quintela
             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
594 ed968ff1 Juan Quintela
           ;;
595 ed968ff1 Juan Quintela
           v8plus|v8plusa)
596 a558ee17 Juan Quintela
             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
597 ed968ff1 Juan Quintela
           ;;
598 ed968ff1 Juan Quintela
           *) # sparc_cpu not defined in the command line
599 a558ee17 Juan Quintela
             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
600 ed968ff1 Juan Quintela
           esac
601 ed968ff1 Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
602 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
603 762e8230 blueswir1
           if test "$solaris" = "no" ; then
604 a558ee17 Juan Quintela
             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
605 c81da56e Juan Quintela
             helper_cflags="-ffixed-i0"
606 762e8230 blueswir1
           fi
607 3142255c blueswir1
           ;;
608 ed968ff1 Juan Quintela
    sparc64)
609 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
610 ed968ff1 Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
611 a558ee17 Juan Quintela
           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
612 ed968ff1 Juan Quintela
           if test "$solaris" != "no" ; then
613 a558ee17 Juan Quintela
             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
614 762e8230 blueswir1
           fi
615 3142255c blueswir1
           ;;
616 76d83bde ths
    s390)
617 a558ee17 Juan Quintela
           QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS"
618 76d83bde ths
           ;;
619 40293e58 bellard
    i386)
620 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
621 0c439cbf Juan Quintela
           LDFLAGS="-m32 $LDFLAGS"
622 c81da56e Juan Quintela
           helper_cflags="-fomit-frame-pointer"
623 379f6698 Paul Brook
           host_guest_base="yes"
624 40293e58 bellard
           ;;
625 40293e58 bellard
    x86_64)
626 a558ee17 Juan Quintela
           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
627 0c439cbf Juan Quintela
           LDFLAGS="-m64 $LDFLAGS"
628 379f6698 Paul Brook
           host_guest_base="yes"
629 379f6698 Paul Brook
           ;;
630 379f6698 Paul Brook
    arm*)
631 379f6698 Paul Brook
           host_guest_base="yes"
632 40293e58 bellard
           ;;
633 f6548c0a malc
    ppc*)
634 f6548c0a malc
           host_guest_base="yes"
635 f6548c0a malc
           ;;
636 3142255c blueswir1
esac
637 3142255c blueswir1
638 379f6698 Paul Brook
[ -z "$guest_base" ] && guest_base="$host_guest_base"
639 379f6698 Paul Brook
640 af5db58e pbrook
if test x"$show_help" = x"yes" ; then
641 af5db58e pbrook
cat << EOF
642 af5db58e pbrook
643 af5db58e pbrook
Usage: configure [options]
644 af5db58e pbrook
Options: [defaults in brackets after descriptions]
645 af5db58e pbrook
646 af5db58e pbrook
EOF
647 af5db58e pbrook
echo "Standard options:"
648 af5db58e pbrook
echo "  --help                   print this message"
649 af5db58e pbrook
echo "  --prefix=PREFIX          install in PREFIX [$prefix]"
650 af5db58e pbrook
echo "  --interp-prefix=PREFIX   where to find shared libraries, etc."
651 af5db58e pbrook
echo "                           use %M for cpu name [$interp_prefix]"
652 af5db58e pbrook
echo "  --target-list=LIST       set target list [$target_list]"
653 af5db58e pbrook
echo ""
654 af5db58e pbrook
echo "Advanced options (experts only):"
655 af5db58e pbrook
echo "  --source-path=PATH       path of source code [$source_path]"
656 af5db58e pbrook
echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
657 af5db58e pbrook
echo "  --cc=CC                  use C compiler CC [$cc]"
658 af5db58e pbrook
echo "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
659 a558ee17 Juan Quintela
echo "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
660 e3fc14c3 Jan Kiszka
echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
661 af5db58e pbrook
echo "  --make=MAKE              use specified make [$make]"
662 6a882643 pbrook
echo "  --install=INSTALL        use specified install [$install]"
663 af5db58e pbrook
echo "  --static                 enable static build [$static]"
664 f8393946 aurel32
echo "  --enable-debug-tcg       enable TCG debugging"
665 f8393946 aurel32
echo "  --disable-debug-tcg      disable TCG debugging (default)"
666 09695a4a Stefan Weil
echo "  --enable-debug           enable common debug build options"
667 890b1658 aliguori
echo "  --enable-sparse          enable sparse checker"
668 890b1658 aliguori
echo "  --disable-sparse         disable sparse checker (default)"
669 1625af87 aliguori
echo "  --disable-strip          disable stripping binaries"
670 85aa5189 bellard
echo "  --disable-werror         disable compilation abort on warning"
671 fe8f78e4 balrog
echo "  --disable-sdl            disable SDL"
672 c4198157 Juan Quintela
echo "  --enable-sdl             enable SDL"
673 af5db58e pbrook
echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
674 c2de5c91 malc
echo "  --audio-drv-list=LIST    set audio drivers list:"
675 c2de5c91 malc
echo "                           Available drivers: $audio_possible_drivers"
676 4c9b53e3 malc
echo "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
677 4c9b53e3 malc
echo "                           Available cards: $audio_possible_cards"
678 eb852011 Markus Armbruster
echo "  --block-drv-whitelist=L  set block driver whitelist"
679 eb852011 Markus Armbruster
echo "                           (affects only QEMU, not qemu-img)"
680 8ff9cbf7 malc
echo "  --enable-mixemu          enable mixer emulation"
681 e37630ca aliguori
echo "  --disable-xen            disable xen backend driver support"
682 fc321b4b Juan Quintela
echo "  --enable-xen             enable xen backend driver support"
683 2e4d9fb1 aurel32
echo "  --disable-brlapi         disable BrlAPI"
684 4ffcedb6 Juan Quintela
echo "  --enable-brlapi          enable BrlAPI"
685 8d5d2d4c ths
echo "  --disable-vnc-tls        disable TLS encryption for VNC server"
686 1be10ad2 Juan Quintela
echo "  --enable-vnc-tls         enable TLS encryption for VNC server"
687 2f9606b3 aliguori
echo "  --disable-vnc-sasl       disable SASL encryption for VNC server"
688 ea784e3b Juan Quintela
echo "  --enable-vnc-sasl        enable SASL encryption for VNC server"
689 af896aaa pbrook
echo "  --disable-curses         disable curses output"
690 c584a6d0 Juan Quintela
echo "  --enable-curses          enable curses output"
691 769ce76d Alexander Graf
echo "  --disable-curl           disable curl connectivity"
692 788c8196 Juan Quintela
echo "  --enable-curl            enable curl connectivity"
693 2df87df7 Juan Quintela
echo "  --disable-fdt            disable fdt device tree"
694 2df87df7 Juan Quintela
echo "  --enable-fdt             enable fdt device tree"
695 5495ed11 Luiz Capitulino
echo "  --disable-check-utests   disable check unit-tests"
696 5495ed11 Luiz Capitulino
echo "  --enable-check-utests    enable check unit-tests"
697 fb599c9a balrog
echo "  --disable-bluez          disable bluez stack connectivity"
698 a20a6f46 Juan Quintela
echo "  --enable-bluez           enable bluez stack connectivity"
699 7ba1e619 aliguori
echo "  --disable-kvm            disable KVM acceleration support"
700 b31a0277 Juan Quintela
echo "  --enable-kvm             enable KVM acceleration support"
701 bd0c5661 pbrook
echo "  --disable-nptl           disable usermode NPTL support"
702 e5934d33 Andre Przywara
echo "  --enable-nptl            enable usermode NPTL support"
703 af5db58e pbrook
echo "  --enable-system          enable all system emulation targets"
704 af5db58e pbrook
echo "  --disable-system         disable all system emulation targets"
705 0953a80f Zachary Amsden
echo "  --enable-user            enable supported user emulation targets"
706 0953a80f Zachary Amsden
echo "  --disable-user           disable all user emulation targets"
707 831b7825 ths
echo "  --enable-linux-user      enable all linux usermode emulation targets"
708 831b7825 ths
echo "  --disable-linux-user     disable all linux usermode emulation targets"
709 831b7825 ths
echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
710 831b7825 ths
echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
711 84778508 blueswir1
echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
712 84778508 blueswir1
echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
713 379f6698 Paul Brook
echo "  --enable-guest-base      enable GUEST_BASE support for usermode"
714 379f6698 Paul Brook
echo "                           emulation targets"
715 379f6698 Paul Brook
echo "  --disable-guest-base     disable GUEST_BASE support"
716 34005a00 Kirill A. Shutemov
echo "  --enable-user-pie        build usermode emulation targets as PIE"
717 34005a00 Kirill A. Shutemov
echo "  --disable-user-pie       do not build usermode emulation targets as PIE"
718 af5db58e pbrook
echo "  --fmod-lib               path to FMOD library"
719 af5db58e pbrook
echo "  --fmod-inc               path to FMOD includes"
720 2f6a1ab0 blueswir1
echo "  --oss-lib                path to OSS library"
721 c5937220 pbrook
echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
722 3142255c blueswir1
echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
723 ee682d27 Stefan Weil
echo "  --disable-uuid           disable uuid support"
724 ee682d27 Stefan Weil
echo "  --enable-uuid            enable uuid support"
725 e0e6c8c0 aliguori
echo "  --disable-vde            disable support for vde network"
726 dfb278bd Juan Quintela
echo "  --enable-vde             enable support for vde network"
727 5c6c3a6c Christoph Hellwig
echo "  --disable-linux-aio      disable Linux AIO support"
728 5c6c3a6c Christoph Hellwig
echo "  --enable-linux-aio       enable Linux AIO support"
729 e5d355d1 aliguori
echo "  --enable-io-thread       enable IO thread"
730 77755340 ths
echo "  --disable-blobs          disable installing provided firmware blobs"
731 eac30262 aliguori
echo "  --kerneldir=PATH         look for kernel includes in PATH"
732 af5db58e pbrook
echo ""
733 5bf08934 ths
echo "NOTE: The object files are built at the place where configure is launched"
734 af5db58e pbrook
exit 1
735 af5db58e pbrook
fi
736 af5db58e pbrook
737 ec530c81 bellard
#
738 ec530c81 bellard
# Solaris specific configure tool chain decisions
739 ec530c81 bellard
#
740 ec530c81 bellard
if test "$solaris" = "yes" ; then
741 ec530c81 bellard
  solinst=`which $install 2> /dev/null | /usr/bin/grep -v "no $install in"`
742 ec530c81 bellard
  if test -z "$solinst" ; then
743 ec530c81 bellard
    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
744 ec530c81 bellard
    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
745 ec530c81 bellard
    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
746 ec530c81 bellard
    exit 1
747 ec530c81 bellard
  fi
748 ec530c81 bellard
  if test "$solinst" = "/usr/sbin/install" ; then
749 ec530c81 bellard
    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
750 ec530c81 bellard
    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
751 ec530c81 bellard
    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
752 ec530c81 bellard
    exit 1
753 ec530c81 bellard
  fi
754 ec530c81 bellard
  sol_ar=`which ar 2> /dev/null | /usr/bin/grep -v "no ar in"`
755 ec530c81 bellard
  if test -z "$sol_ar" ; then
756 ec530c81 bellard
    echo "Error: No path includes ar"
757 ec530c81 bellard
    if test -f /usr/ccs/bin/ar ; then
758 ec530c81 bellard
      echo "Add /usr/ccs/bin to your path and rerun configure"
759 ec530c81 bellard
    fi
760 ec530c81 bellard
    exit 1
761 ec530c81 bellard
  fi
762 5fafdf24 ths
fi
763 ec530c81 bellard
764 ec530c81 bellard
765 5327cf48 bellard
if test -z "$target_list" ; then
766 5327cf48 bellard
# these targets are portable
767 0a8e90f4 pbrook
    if [ "$softmmu" = "yes" ] ; then
768 2408a527 aurel32
        target_list="\
769 2408a527 aurel32
i386-softmmu \
770 2408a527 aurel32
x86_64-softmmu \
771 2408a527 aurel32
arm-softmmu \
772 2408a527 aurel32
cris-softmmu \
773 2408a527 aurel32
m68k-softmmu \
774 72b675ca Edgar E. Iglesias
microblaze-softmmu \
775 2408a527 aurel32
mips-softmmu \
776 2408a527 aurel32
mipsel-softmmu \
777 2408a527 aurel32
mips64-softmmu \
778 2408a527 aurel32
mips64el-softmmu \
779 2408a527 aurel32
ppc-softmmu \
780 2408a527 aurel32
ppcemb-softmmu \
781 2408a527 aurel32
ppc64-softmmu \
782 2408a527 aurel32
sh4-softmmu \
783 2408a527 aurel32
sh4eb-softmmu \
784 2408a527 aurel32
sparc-softmmu \
785 1b64fcae Igor V. Kovalenko
sparc64-softmmu \
786 2408a527 aurel32
"
787 0a8e90f4 pbrook
    fi
788 5327cf48 bellard
# the following are Linux specific
789 831b7825 ths
    if [ "$linux_user" = "yes" ] ; then
790 2408a527 aurel32
        target_list="${target_list}\
791 2408a527 aurel32
i386-linux-user \
792 2408a527 aurel32
x86_64-linux-user \
793 2408a527 aurel32
alpha-linux-user \
794 2408a527 aurel32
arm-linux-user \
795 2408a527 aurel32
armeb-linux-user \
796 2408a527 aurel32
cris-linux-user \
797 2408a527 aurel32
m68k-linux-user \
798 72b675ca Edgar E. Iglesias
microblaze-linux-user \
799 2408a527 aurel32
mips-linux-user \
800 2408a527 aurel32
mipsel-linux-user \
801 2408a527 aurel32
ppc-linux-user \
802 2408a527 aurel32
ppc64-linux-user \
803 2408a527 aurel32
ppc64abi32-linux-user \
804 2408a527 aurel32
sh4-linux-user \
805 2408a527 aurel32
sh4eb-linux-user \
806 2408a527 aurel32
sparc-linux-user \
807 2408a527 aurel32
sparc64-linux-user \
808 2408a527 aurel32
sparc32plus-linux-user \
809 2408a527 aurel32
"
810 831b7825 ths
    fi
811 831b7825 ths
# the following are Darwin specific
812 831b7825 ths
    if [ "$darwin_user" = "yes" ] ; then
813 6cdc7375 malc
        target_list="$target_list i386-darwin-user ppc-darwin-user "
814 5327cf48 bellard
    fi
815 84778508 blueswir1
# the following are BSD specific
816 84778508 blueswir1
    if [ "$bsd_user" = "yes" ] ; then
817 84778508 blueswir1
        target_list="${target_list}\
818 31fc12df blueswir1
i386-bsd-user \
819 31fc12df blueswir1
x86_64-bsd-user \
820 31fc12df blueswir1
sparc-bsd-user \
821 84778508 blueswir1
sparc64-bsd-user \
822 84778508 blueswir1
"
823 84778508 blueswir1
    fi
824 6e20a45f bellard
else
825 b1a550a0 pbrook
    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
826 5327cf48 bellard
fi
827 0a8e90f4 pbrook
if test -z "$target_list" ; then
828 0a8e90f4 pbrook
    echo "No targets enabled"
829 0a8e90f4 pbrook
    exit 1
830 0a8e90f4 pbrook
fi
831 5327cf48 bellard
832 249247c9 Juan Quintela
feature_not_found() {
833 249247c9 Juan Quintela
  feature=$1
834 249247c9 Juan Quintela
835 249247c9 Juan Quintela
  echo "ERROR"
836 249247c9 Juan Quintela
  echo "ERROR: User requested feature $feature"
837 9332f6a2 Sebastian Herbszt
  echo "ERROR: configure was not able to find it"
838 249247c9 Juan Quintela
  echo "ERROR"
839 249247c9 Juan Quintela
  exit 1;
840 249247c9 Juan Quintela
}
841 249247c9 Juan Quintela
842 7d13299d bellard
if test -z "$cross_prefix" ; then
843 7d13299d bellard
844 7d13299d bellard
# ---
845 7d13299d bellard
# big/little endian test
846 7d13299d bellard
cat > $TMPC << EOF
847 7d13299d bellard
#include <inttypes.h>
848 7d13299d bellard
int main(int argc, char ** argv){
849 1d14ffa9 bellard
        volatile uint32_t i=0x01234567;
850 1d14ffa9 bellard
        return (*((uint8_t*)(&i))) == 0x67;
851 7d13299d bellard
}
852 7d13299d bellard
EOF
853 7d13299d bellard
854 52166aa0 Juan Quintela
if compile_prog "" "" ; then
855 7d13299d bellard
$TMPE && bigendian="yes"
856 7d13299d bellard
else
857 7d13299d bellard
echo big/little test failed
858 7d13299d bellard
fi
859 7d13299d bellard
860 7d13299d bellard
else
861 7d13299d bellard
862 7d13299d bellard
# if cross compiling, cannot launch a program, so make a static guess
863 ea8f20f8 Juan Quintela
case "$cpu" in
864 ea8f20f8 Juan Quintela
  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
865 ea8f20f8 Juan Quintela
    bigendian=yes
866 ea8f20f8 Juan Quintela
  ;;
867 ea8f20f8 Juan Quintela
esac
868 7d13299d bellard
869 7d13299d bellard
fi
870 7d13299d bellard
871 b6853697 bellard
# host long bits test
872 b6853697 bellard
hostlongbits="32"
873 ea8f20f8 Juan Quintela
case "$cpu" in
874 ea8f20f8 Juan Quintela
  x86_64|alpha|ia64|sparc64|ppc64)
875 ea8f20f8 Juan Quintela
    hostlongbits=64
876 ea8f20f8 Juan Quintela
  ;;
877 ea8f20f8 Juan Quintela
esac
878 b6853697 bellard
879 b0a47e79 Juan Quintela
880 b0a47e79 Juan Quintela
##########################################
881 b0a47e79 Juan Quintela
# NPTL probe
882 b0a47e79 Juan Quintela
883 b0a47e79 Juan Quintela
if test "$nptl" != "no" ; then
884 b0a47e79 Juan Quintela
  cat > $TMPC <<EOF
885 bd0c5661 pbrook
#include <sched.h>
886 30813cea pbrook
#include <linux/futex.h>
887 bd0c5661 pbrook
void foo()
888 bd0c5661 pbrook
{
889 bd0c5661 pbrook
#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
890 bd0c5661 pbrook
#error bork
891 bd0c5661 pbrook
#endif
892 bd0c5661 pbrook
}
893 bd0c5661 pbrook
EOF
894 bd0c5661 pbrook
895 b0a47e79 Juan Quintela
  if compile_object ; then
896 b0a47e79 Juan Quintela
    nptl=yes
897 b0a47e79 Juan Quintela
  else
898 b0a47e79 Juan Quintela
    if test "$nptl" = "yes" ; then
899 b0a47e79 Juan Quintela
      feature_not_found "nptl"
900 b0a47e79 Juan Quintela
    fi
901 b0a47e79 Juan Quintela
    nptl=no
902 b0a47e79 Juan Quintela
  fi
903 bd0c5661 pbrook
fi
904 bd0c5661 pbrook
905 11d9f695 bellard
##########################################
906 ac62922e balrog
# zlib check
907 ac62922e balrog
908 ac62922e balrog
cat > $TMPC << EOF
909 ac62922e balrog
#include <zlib.h>
910 ac62922e balrog
int main(void) { zlibVersion(); return 0; }
911 ac62922e balrog
EOF
912 52166aa0 Juan Quintela
if compile_prog "" "-lz" ; then
913 ac62922e balrog
    :
914 ac62922e balrog
else
915 ac62922e balrog
    echo
916 ac62922e balrog
    echo "Error: zlib check failed"
917 ac62922e balrog
    echo "Make sure to have the zlib libs and headers installed."
918 ac62922e balrog
    echo
919 ac62922e balrog
    exit 1
920 ac62922e balrog
fi
921 ac62922e balrog
922 ac62922e balrog
##########################################
923 e37630ca aliguori
# xen probe
924 e37630ca aliguori
925 fc321b4b Juan Quintela
if test "$xen" != "no" ; then
926 b2266bee Juan Quintela
  xen_libs="-lxenstore -lxenctrl -lxenguest"
927 b2266bee Juan Quintela
  cat > $TMPC <<EOF
928 e37630ca aliguori
#include <xenctrl.h>
929 e37630ca aliguori
#include <xs.h>
930 df7a607b Christoph Egger
int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
931 e37630ca aliguori
EOF
932 52166aa0 Juan Quintela
  if compile_prog "" "$xen_libs" ; then
933 fc321b4b Juan Quintela
    xen=yes
934 3efd632b Juan Quintela
    libs_softmmu="$xen_libs $libs_softmmu"
935 b2266bee Juan Quintela
  else
936 fc321b4b Juan Quintela
    if test "$xen" = "yes" ; then
937 fc321b4b Juan Quintela
      feature_not_found "xen"
938 fc321b4b Juan Quintela
    fi
939 fc321b4b Juan Quintela
    xen=no
940 b2266bee Juan Quintela
  fi
941 e37630ca aliguori
fi
942 e37630ca aliguori
943 e37630ca aliguori
##########################################
944 dfffc653 Juan Quintela
# Sparse probe
945 dfffc653 Juan Quintela
if test "$sparse" != "no" ; then
946 dfffc653 Juan Quintela
  if test -x "$(which cgcc 2>/dev/null)"; then
947 dfffc653 Juan Quintela
    sparse=yes
948 dfffc653 Juan Quintela
  else
949 dfffc653 Juan Quintela
    if test "$sparse" = "yes" ; then
950 dfffc653 Juan Quintela
      feature_not_found "sparse"
951 dfffc653 Juan Quintela
    fi
952 dfffc653 Juan Quintela
    sparse=no
953 dfffc653 Juan Quintela
  fi
954 dfffc653 Juan Quintela
fi
955 dfffc653 Juan Quintela
956 dfffc653 Juan Quintela
##########################################
957 11d9f695 bellard
# SDL probe
958 11d9f695 bellard
959 11d9f695 bellard
sdl_too_old=no
960 11d9f695 bellard
961 c4198157 Juan Quintela
if test "$sdl" != "no" ; then
962 ac119f9d Juan Quintela
  cat > $TMPC << EOF
963 11d9f695 bellard
#include <SDL.h>
964 11d9f695 bellard
#undef main /* We don't want SDL to override our main() */
965 11d9f695 bellard
int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
966 11d9f695 bellard
EOF
967 ac119f9d Juan Quintela
  sdl_cflags=`sdl-config --cflags 2> /dev/null`
968 ac119f9d Juan Quintela
  sdl_libs=`sdl-config --libs 2> /dev/null`
969 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
970 ac119f9d Juan Quintela
    _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
971 ac119f9d Juan Quintela
    if test "$_sdlversion" -lt 121 ; then
972 ac119f9d Juan Quintela
      sdl_too_old=yes
973 ac119f9d Juan Quintela
    else
974 ac119f9d Juan Quintela
      if test "$cocoa" = "no" ; then
975 ac119f9d Juan Quintela
        sdl=yes
976 ac119f9d Juan Quintela
      fi
977 ac119f9d Juan Quintela
    fi
978 cd01b4a3 aliguori
979 ac119f9d Juan Quintela
    # static link with sdl ?
980 ac119f9d Juan Quintela
    if test "$sdl" = "yes" -a "$static" = "yes" ; then
981 ac119f9d Juan Quintela
      sdl_libs=`sdl-config --static-libs 2>/dev/null`
982 ac119f9d Juan Quintela
      if test `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` ; then
983 ac119f9d Juan Quintela
         sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
984 ac119f9d Juan Quintela
         sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
985 ac119f9d Juan Quintela
      fi
986 52166aa0 Juan Quintela
      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
987 ac119f9d Juan Quintela
	:
988 ac119f9d Juan Quintela
      else
989 ac119f9d Juan Quintela
        sdl=no
990 ac119f9d Juan Quintela
      fi
991 ac119f9d Juan Quintela
    fi # static link
992 c4198157 Juan Quintela
  else # sdl not found
993 c4198157 Juan Quintela
    if test "$sdl" = "yes" ; then
994 c4198157 Juan Quintela
      feature_not_found "sdl"
995 c4198157 Juan Quintela
    fi
996 c4198157 Juan Quintela
    sdl=no
997 ac119f9d Juan Quintela
  fi # sdl compile test
998 a68551bc Juan Quintela
fi
999 11d9f695 bellard
1000 5368a422 aliguori
if test "$sdl" = "yes" ; then
1001 ac119f9d Juan Quintela
  cat > $TMPC <<EOF
1002 5368a422 aliguori
#include <SDL.h>
1003 5368a422 aliguori
#if defined(SDL_VIDEO_DRIVER_X11)
1004 5368a422 aliguori
#include <X11/XKBlib.h>
1005 5368a422 aliguori
#else
1006 5368a422 aliguori
#error No x11 support
1007 5368a422 aliguori
#endif
1008 5368a422 aliguori
int main(void) { return 0; }
1009 5368a422 aliguori
EOF
1010 52166aa0 Juan Quintela
  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1011 ac119f9d Juan Quintela
    sdl_libs="$sdl_libs -lX11"
1012 ac119f9d Juan Quintela
  fi
1013 07d9ac44 Juan Quintela
  if test "$mingw32" = "yes" ; then
1014 07d9ac44 Juan Quintela
    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
1015 07d9ac44 Juan Quintela
  fi
1016 0705667e Juan Quintela
  libs_softmmu="$sdl_libs $libs_softmmu"
1017 5368a422 aliguori
fi
1018 5368a422 aliguori
1019 8f28f3fb ths
##########################################
1020 8d5d2d4c ths
# VNC TLS detection
1021 1be10ad2 Juan Quintela
if test "$vnc_tls" != "no" ; then
1022 1be10ad2 Juan Quintela
  cat > $TMPC <<EOF
1023 ae6b5e5a aliguori
#include <gnutls/gnutls.h>
1024 ae6b5e5a aliguori
int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1025 ae6b5e5a aliguori
EOF
1026 1be10ad2 Juan Quintela
  vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
1027 1be10ad2 Juan Quintela
  vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
1028 1be10ad2 Juan Quintela
  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
1029 1be10ad2 Juan Quintela
    vnc_tls=yes
1030 1be10ad2 Juan Quintela
    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1031 1be10ad2 Juan Quintela
  else
1032 1be10ad2 Juan Quintela
    if test "$vnc_tls" = "yes" ; then
1033 1be10ad2 Juan Quintela
      feature_not_found "vnc-tls"
1034 ae6b5e5a aliguori
    fi
1035 1be10ad2 Juan Quintela
    vnc_tls=no
1036 1be10ad2 Juan Quintela
  fi
1037 8d5d2d4c ths
fi
1038 8d5d2d4c ths
1039 8d5d2d4c ths
##########################################
1040 2f9606b3 aliguori
# VNC SASL detection
1041 3aefa744 Juan Quintela
if test "$vnc_sasl" != "no" ; then
1042 ea784e3b Juan Quintela
  cat > $TMPC <<EOF
1043 2f9606b3 aliguori
#include <sasl/sasl.h>
1044 2f9606b3 aliguori
#include <stdio.h>
1045 2f9606b3 aliguori
int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
1046 2f9606b3 aliguori
EOF
1047 ea784e3b Juan Quintela
  # Assuming Cyrus-SASL installed in /usr prefix
1048 ea784e3b Juan Quintela
  vnc_sasl_cflags=""
1049 ea784e3b Juan Quintela
  vnc_sasl_libs="-lsasl2"
1050 ea784e3b Juan Quintela
  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1051 ea784e3b Juan Quintela
    vnc_sasl=yes
1052 ea784e3b Juan Quintela
    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1053 ea784e3b Juan Quintela
  else
1054 ea784e3b Juan Quintela
    if test "$vnc_sasl" = "yes" ; then
1055 ea784e3b Juan Quintela
      feature_not_found "vnc-sasl"
1056 2f9606b3 aliguori
    fi
1057 ea784e3b Juan Quintela
    vnc_sasl=no
1058 ea784e3b Juan Quintela
  fi
1059 2f9606b3 aliguori
fi
1060 2f9606b3 aliguori
1061 2f9606b3 aliguori
##########################################
1062 76655d6d aliguori
# fnmatch() probe, used for ACL routines
1063 76655d6d aliguori
fnmatch="no"
1064 76655d6d aliguori
cat > $TMPC << EOF
1065 76655d6d aliguori
#include <fnmatch.h>
1066 76655d6d aliguori
int main(void)
1067 76655d6d aliguori
{
1068 76655d6d aliguori
    fnmatch("foo", "foo", 0);
1069 76655d6d aliguori
    return 0;
1070 76655d6d aliguori
}
1071 76655d6d aliguori
EOF
1072 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1073 76655d6d aliguori
   fnmatch="yes"
1074 76655d6d aliguori
fi
1075 76655d6d aliguori
1076 76655d6d aliguori
##########################################
1077 ee682d27 Stefan Weil
# uuid_generate() probe, used for vdi block driver
1078 ee682d27 Stefan Weil
if test "$uuid" != "no" ; then
1079 ee682d27 Stefan Weil
  uuid_libs="-luuid"
1080 ee682d27 Stefan Weil
  cat > $TMPC << EOF
1081 ee682d27 Stefan Weil
#include <uuid/uuid.h>
1082 ee682d27 Stefan Weil
int main(void)
1083 ee682d27 Stefan Weil
{
1084 ee682d27 Stefan Weil
    uuid_t my_uuid;
1085 ee682d27 Stefan Weil
    uuid_generate(my_uuid);
1086 ee682d27 Stefan Weil
    return 0;
1087 ee682d27 Stefan Weil
}
1088 ee682d27 Stefan Weil
EOF
1089 ee682d27 Stefan Weil
  if compile_prog "" "$uuid_libs" ; then
1090 ee682d27 Stefan Weil
    uuid="yes"
1091 ee682d27 Stefan Weil
    libs_softmmu="$uuid_libs $libs_softmmu"
1092 ee682d27 Stefan Weil
    libs_tools="$uuid_libs $libs_tools"
1093 ee682d27 Stefan Weil
  else
1094 ee682d27 Stefan Weil
    if test "$uuid" = "yes" ; then
1095 ee682d27 Stefan Weil
      feature_not_found "uuid"
1096 ee682d27 Stefan Weil
    fi
1097 ee682d27 Stefan Weil
    uuid=no
1098 ee682d27 Stefan Weil
  fi
1099 ee682d27 Stefan Weil
fi
1100 ee682d27 Stefan Weil
1101 ee682d27 Stefan Weil
##########################################
1102 8a16d273 ths
# vde libraries probe
1103 dfb278bd Juan Quintela
if test "$vde" != "no" ; then
1104 4baae0ac Juan Quintela
  vde_libs="-lvdeplug"
1105 8a16d273 ths
  cat > $TMPC << EOF
1106 8a16d273 ths
#include <libvdeplug.h>
1107 4a7f0e06 pbrook
int main(void)
1108 4a7f0e06 pbrook
{
1109 4a7f0e06 pbrook
    struct vde_open_args a = {0, 0, 0};
1110 4a7f0e06 pbrook
    vde_open("", "", &a);
1111 4a7f0e06 pbrook
    return 0;
1112 4a7f0e06 pbrook
}
1113 8a16d273 ths
EOF
1114 52166aa0 Juan Quintela
  if compile_prog "" "$vde_libs" ; then
1115 4baae0ac Juan Quintela
    vde=yes
1116 8e02e54c Juan Quintela
    libs_softmmu="$vde_libs $libs_softmmu"
1117 8e02e54c Juan Quintela
    libs_tools="$vde_libs $libs_tools"
1118 dfb278bd Juan Quintela
  else
1119 dfb278bd Juan Quintela
    if test "$vde" = "yes" ; then
1120 dfb278bd Juan Quintela
      feature_not_found "vde"
1121 dfb278bd Juan Quintela
    fi
1122 dfb278bd Juan Quintela
    vde=no
1123 4baae0ac Juan Quintela
  fi
1124 8a16d273 ths
fi
1125 8a16d273 ths
1126 8a16d273 ths
##########################################
1127 c2de5c91 malc
# Sound support libraries probe
1128 8f28f3fb ths
1129 c2de5c91 malc
audio_drv_probe()
1130 c2de5c91 malc
{
1131 c2de5c91 malc
    drv=$1
1132 c2de5c91 malc
    hdr=$2
1133 c2de5c91 malc
    lib=$3
1134 c2de5c91 malc
    exp=$4
1135 c2de5c91 malc
    cfl=$5
1136 c2de5c91 malc
        cat > $TMPC << EOF
1137 c2de5c91 malc
#include <$hdr>
1138 c2de5c91 malc
int main(void) { $exp }
1139 8f28f3fb ths
EOF
1140 52166aa0 Juan Quintela
    if compile_prog "$cfl" "$lib" ; then
1141 c2de5c91 malc
        :
1142 c2de5c91 malc
    else
1143 c2de5c91 malc
        echo
1144 c2de5c91 malc
        echo "Error: $drv check failed"
1145 c2de5c91 malc
        echo "Make sure to have the $drv libs and headers installed."
1146 c2de5c91 malc
        echo
1147 c2de5c91 malc
        exit 1
1148 c2de5c91 malc
    fi
1149 c2de5c91 malc
}
1150 c2de5c91 malc
1151 2fa7d3bf malc
audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1152 c2de5c91 malc
for drv in $audio_drv_list; do
1153 c2de5c91 malc
    case $drv in
1154 c2de5c91 malc
    alsa)
1155 c2de5c91 malc
    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1156 c2de5c91 malc
        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1157 a4bf6780 Juan Quintela
    libs_softmmu="-lasound $libs_softmmu"
1158 c2de5c91 malc
    ;;
1159 c2de5c91 malc
1160 c2de5c91 malc
    fmod)
1161 c2de5c91 malc
    if test -z $fmod_lib || test -z $fmod_inc; then
1162 c2de5c91 malc
        echo
1163 c2de5c91 malc
        echo "Error: You must specify path to FMOD library and headers"
1164 c2de5c91 malc
        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1165 c2de5c91 malc
        echo
1166 c2de5c91 malc
        exit 1
1167 c2de5c91 malc
    fi
1168 c2de5c91 malc
    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1169 a4bf6780 Juan Quintela
    libs_softmmu="$fmod_lib $libs_softmmu"
1170 c2de5c91 malc
    ;;
1171 c2de5c91 malc
1172 c2de5c91 malc
    esd)
1173 c2de5c91 malc
    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1174 a4bf6780 Juan Quintela
    libs_softmmu="-lesd $libs_softmmu"
1175 67f86e8e Juan Quintela
    audio_pt_int="yes"
1176 c2de5c91 malc
    ;;
1177 b8e59f18 malc
1178 b8e59f18 malc
    pa)
1179 493abda6 Aurelien Jarno
    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1180 b8e59f18 malc
        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1181 493abda6 Aurelien Jarno
    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
1182 67f86e8e Juan Quintela
    audio_pt_int="yes"
1183 b8e59f18 malc
    ;;
1184 b8e59f18 malc
1185 997e690a Juan Quintela
    coreaudio)
1186 997e690a Juan Quintela
      libs_softmmu="-framework CoreAudio $libs_softmmu"
1187 997e690a Juan Quintela
    ;;
1188 997e690a Juan Quintela
1189 a4bf6780 Juan Quintela
    dsound)
1190 a4bf6780 Juan Quintela
      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1191 d5631638 malc
      audio_win_int="yes"
1192 a4bf6780 Juan Quintela
    ;;
1193 a4bf6780 Juan Quintela
1194 a4bf6780 Juan Quintela
    oss)
1195 a4bf6780 Juan Quintela
      libs_softmmu="$oss_lib $libs_softmmu"
1196 a4bf6780 Juan Quintela
    ;;
1197 a4bf6780 Juan Quintela
1198 a4bf6780 Juan Quintela
    sdl|wav)
1199 2f6a1ab0 blueswir1
    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
1200 2f6a1ab0 blueswir1
    ;;
1201 2f6a1ab0 blueswir1
1202 d5631638 malc
    winwave)
1203 d5631638 malc
      libs_softmmu="-lwinmm $libs_softmmu"
1204 d5631638 malc
      audio_win_int="yes"
1205 d5631638 malc
    ;;
1206 d5631638 malc
1207 e4c63a6a malc
    *)
1208 1c9b2a52 malc
    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1209 e4c63a6a malc
        echo
1210 e4c63a6a malc
        echo "Error: Unknown driver '$drv' selected"
1211 e4c63a6a malc
        echo "Possible drivers are: $audio_possible_drivers"
1212 e4c63a6a malc
        echo
1213 e4c63a6a malc
        exit 1
1214 e4c63a6a malc
    }
1215 e4c63a6a malc
    ;;
1216 c2de5c91 malc
    esac
1217 c2de5c91 malc
done
1218 8f28f3fb ths
1219 4d3b6f6e balrog
##########################################
1220 2e4d9fb1 aurel32
# BrlAPI probe
1221 2e4d9fb1 aurel32
1222 4ffcedb6 Juan Quintela
if test "$brlapi" != "no" ; then
1223 eb82284f Juan Quintela
  brlapi_libs="-lbrlapi"
1224 eb82284f Juan Quintela
  cat > $TMPC << EOF
1225 2e4d9fb1 aurel32
#include <brlapi.h>
1226 2e4d9fb1 aurel32
int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
1227 2e4d9fb1 aurel32
EOF
1228 52166aa0 Juan Quintela
  if compile_prog "" "$brlapi_libs" ; then
1229 eb82284f Juan Quintela
    brlapi=yes
1230 264606b3 Juan Quintela
    libs_softmmu="$brlapi_libs $libs_softmmu"
1231 4ffcedb6 Juan Quintela
  else
1232 4ffcedb6 Juan Quintela
    if test "$brlapi" = "yes" ; then
1233 4ffcedb6 Juan Quintela
      feature_not_found "brlapi"
1234 4ffcedb6 Juan Quintela
    fi
1235 4ffcedb6 Juan Quintela
    brlapi=no
1236 eb82284f Juan Quintela
  fi
1237 eb82284f Juan Quintela
fi
1238 2e4d9fb1 aurel32
1239 2e4d9fb1 aurel32
##########################################
1240 4d3b6f6e balrog
# curses probe
1241 4f78ef9a Juan Quintela
curses_list="-lncurses -lcurses"
1242 4d3b6f6e balrog
1243 c584a6d0 Juan Quintela
if test "$curses" != "no" ; then
1244 c584a6d0 Juan Quintela
  curses_found=no
1245 4d3b6f6e balrog
  cat > $TMPC << EOF
1246 4d3b6f6e balrog
#include <curses.h>
1247 5a8ff3aa blueswir1
#ifdef __OpenBSD__
1248 5a8ff3aa blueswir1
#define resize_term resizeterm
1249 5a8ff3aa blueswir1
#endif
1250 5a8ff3aa blueswir1
int main(void) { resize_term(0, 0); return curses_version(); }
1251 4d3b6f6e balrog
EOF
1252 4f78ef9a Juan Quintela
  for curses_lib in $curses_list; do
1253 4f78ef9a Juan Quintela
    if compile_prog "" "$curses_lib" ; then
1254 c584a6d0 Juan Quintela
      curses_found=yes
1255 4f78ef9a Juan Quintela
      libs_softmmu="$curses_lib $libs_softmmu"
1256 4f78ef9a Juan Quintela
      break
1257 4f78ef9a Juan Quintela
    fi
1258 4f78ef9a Juan Quintela
  done
1259 c584a6d0 Juan Quintela
  if test "$curses_found" = "yes" ; then
1260 c584a6d0 Juan Quintela
    curses=yes
1261 c584a6d0 Juan Quintela
  else
1262 c584a6d0 Juan Quintela
    if test "$curses" = "yes" ; then
1263 c584a6d0 Juan Quintela
      feature_not_found "curses"
1264 c584a6d0 Juan Quintela
    fi
1265 c584a6d0 Juan Quintela
    curses=no
1266 c584a6d0 Juan Quintela
  fi
1267 4f78ef9a Juan Quintela
fi
1268 4d3b6f6e balrog
1269 414f0dab blueswir1
##########################################
1270 769ce76d Alexander Graf
# curl probe
1271 769ce76d Alexander Graf
1272 788c8196 Juan Quintela
if test "$curl" != "no" ; then
1273 769ce76d Alexander Graf
  cat > $TMPC << EOF
1274 769ce76d Alexander Graf
#include <curl/curl.h>
1275 769ce76d Alexander Graf
int main(void) { return curl_easy_init(); }
1276 769ce76d Alexander Graf
EOF
1277 b1d5a277 Juan Quintela
  curl_cflags=`curl-config --cflags 2>/dev/null`
1278 52368552 Paul Brook
  curl_libs=`curl-config --libs 2>/dev/null`
1279 b1d5a277 Juan Quintela
  if compile_prog "$curl_cflags" "$curl_libs" ; then
1280 769ce76d Alexander Graf
    curl=yes
1281 f0302935 Juan Quintela
    libs_tools="$curl_libs $libs_tools"
1282 f0302935 Juan Quintela
    libs_softmmu="$curl_libs $libs_softmmu"
1283 788c8196 Juan Quintela
  else
1284 788c8196 Juan Quintela
    if test "$curl" = "yes" ; then
1285 788c8196 Juan Quintela
      feature_not_found "curl"
1286 788c8196 Juan Quintela
    fi
1287 788c8196 Juan Quintela
    curl=no
1288 769ce76d Alexander Graf
  fi
1289 769ce76d Alexander Graf
fi # test "$curl"
1290 769ce76d Alexander Graf
1291 769ce76d Alexander Graf
##########################################
1292 5495ed11 Luiz Capitulino
# check framework probe
1293 5495ed11 Luiz Capitulino
1294 5495ed11 Luiz Capitulino
if test "$check_utests" != "no" ; then
1295 5495ed11 Luiz Capitulino
  cat > $TMPC << EOF
1296 5495ed11 Luiz Capitulino
#include <check.h>
1297 5495ed11 Luiz Capitulino
int main(void) { suite_create("qemu test"); return 0; }
1298 5495ed11 Luiz Capitulino
EOF
1299 5495ed11 Luiz Capitulino
  check_libs=`pkg-config --libs check`
1300 5495ed11 Luiz Capitulino
  if compile_prog "" $check_libs ; then
1301 5495ed11 Luiz Capitulino
    check_utests=yes
1302 5495ed11 Luiz Capitulino
    libs_tools="$check_libs $libs_tools"
1303 5495ed11 Luiz Capitulino
  else
1304 5495ed11 Luiz Capitulino
    if test "$check_utests" = "yes" ; then
1305 5495ed11 Luiz Capitulino
      feature_not_found "check"
1306 5495ed11 Luiz Capitulino
    fi
1307 5495ed11 Luiz Capitulino
    check_utests=no
1308 5495ed11 Luiz Capitulino
  fi
1309 5495ed11 Luiz Capitulino
fi # test "$check_utests"
1310 5495ed11 Luiz Capitulino
1311 5495ed11 Luiz Capitulino
##########################################
1312 fb599c9a balrog
# bluez support probe
1313 a20a6f46 Juan Quintela
if test "$bluez" != "no" ; then
1314 e820e3f4 balrog
  cat > $TMPC << EOF
1315 e820e3f4 balrog
#include <bluetooth/bluetooth.h>
1316 e820e3f4 balrog
int main(void) { return bt_error(0); }
1317 e820e3f4 balrog
EOF
1318 efcfd0c5 Blue Swirl
  bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
1319 efcfd0c5 Blue Swirl
  bluez_libs=`pkg-config --libs bluez 2> /dev/null`
1320 52166aa0 Juan Quintela
  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1321 a20a6f46 Juan Quintela
    bluez=yes
1322 e482d56a Juan Quintela
    libs_softmmu="$bluez_libs $libs_softmmu"
1323 e820e3f4 balrog
  else
1324 a20a6f46 Juan Quintela
    if test "$bluez" = "yes" ; then
1325 a20a6f46 Juan Quintela
      feature_not_found "bluez"
1326 a20a6f46 Juan Quintela
    fi
1327 e820e3f4 balrog
    bluez="no"
1328 e820e3f4 balrog
  fi
1329 fb599c9a balrog
fi
1330 fb599c9a balrog
1331 fb599c9a balrog
##########################################
1332 7ba1e619 aliguori
# kvm probe
1333 b31a0277 Juan Quintela
if test "$kvm" != "no" ; then
1334 7ba1e619 aliguori
    cat > $TMPC <<EOF
1335 7ba1e619 aliguori
#include <linux/kvm.h>
1336 9fd8d8d7 aliguori
#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
1337 7ba1e619 aliguori
#error Invalid KVM version
1338 7ba1e619 aliguori
#endif
1339 9fd8d8d7 aliguori
#if !defined(KVM_CAP_USER_MEMORY)
1340 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_USER_MEMORY
1341 9fd8d8d7 aliguori
#endif
1342 9fd8d8d7 aliguori
#if !defined(KVM_CAP_SET_TSS_ADDR)
1343 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
1344 9fd8d8d7 aliguori
#endif
1345 9fd8d8d7 aliguori
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
1346 9fd8d8d7 aliguori
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
1347 9fd8d8d7 aliguori
#endif
1348 7ba1e619 aliguori
int main(void) { return 0; }
1349 7ba1e619 aliguori
EOF
1350 eac30262 aliguori
  if test "$kerneldir" != "" ; then
1351 eac30262 aliguori
      kvm_cflags=-I"$kerneldir"/include
1352 8444eb6e aliguori
      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
1353 8444eb6e aliguori
         -a -d "$kerneldir/arch/x86/include" ; then
1354 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1355 406b430d aliguori
	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1356 406b430d aliguori
	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
1357 8444eb6e aliguori
        elif test -d "$kerneldir/arch/$cpu/include" ; then
1358 8444eb6e aliguori
            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
1359 8444eb6e aliguori
      fi
1360 eac30262 aliguori
  else
1361 eac30262 aliguori
      kvm_cflags=""
1362 eac30262 aliguori
  fi
1363 52166aa0 Juan Quintela
  if compile_prog "$kvm_cflags" "" ; then
1364 b31a0277 Juan Quintela
    kvm=yes
1365 7ba1e619 aliguori
  else
1366 b31a0277 Juan Quintela
    if test "$kvm" = "yes" ; then
1367 b31a0277 Juan Quintela
      if [ -x "`which awk 2>/dev/null`" ] && \
1368 b31a0277 Juan Quintela
         [ -x "`which grep 2>/dev/null`" ]; then
1369 b31a0277 Juan Quintela
        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
1370 9fd8d8d7 aliguori
	| grep "error: " \
1371 9fd8d8d7 aliguori
	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
1372 b31a0277 Juan Quintela
        if test "$kvmerr" != "" ; then
1373 b31a0277 Juan Quintela
          echo -e "${kvmerr}\n\
1374 b31a0277 Juan Quintela
      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1375 b31a0277 Juan Quintela
  recent kvm-kmod from http://sourceforge.net/projects/kvm."
1376 b31a0277 Juan Quintela
        fi
1377 9fd8d8d7 aliguori
      fi
1378 b31a0277 Juan Quintela
      feature_not_found "kvm"
1379 9fd8d8d7 aliguori
    fi
1380 b31a0277 Juan Quintela
    kvm=no
1381 7ba1e619 aliguori
  fi
1382 7ba1e619 aliguori
fi
1383 7ba1e619 aliguori
1384 7ba1e619 aliguori
##########################################
1385 e5d355d1 aliguori
# pthread probe
1386 de65fe0f Sebastian Herbszt
PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
1387 3c529d93 aliguori
1388 4dd75c70 Christoph Hellwig
pthread=no
1389 e5d355d1 aliguori
cat > $TMPC << EOF
1390 3c529d93 aliguori
#include <pthread.h>
1391 de65fe0f Sebastian Herbszt
int main(void) { pthread_create(0,0,0,0); return 0; }
1392 414f0dab blueswir1
EOF
1393 4dd75c70 Christoph Hellwig
for pthread_lib in $PTHREADLIBS_LIST; do
1394 4dd75c70 Christoph Hellwig
  if compile_prog "" "$pthread_lib" ; then
1395 4dd75c70 Christoph Hellwig
    pthread=yes
1396 4dd75c70 Christoph Hellwig
    LIBS="$pthread_lib $LIBS"
1397 4dd75c70 Christoph Hellwig
    break
1398 4dd75c70 Christoph Hellwig
  fi
1399 4dd75c70 Christoph Hellwig
done
1400 414f0dab blueswir1
1401 4617e593 Anthony Liguori
if test "$mingw32" != yes -a "$pthread" = no; then
1402 4dd75c70 Christoph Hellwig
  echo
1403 4dd75c70 Christoph Hellwig
  echo "Error: pthread check failed"
1404 4dd75c70 Christoph Hellwig
  echo "Make sure to have the pthread libs and headers installed."
1405 4dd75c70 Christoph Hellwig
  echo
1406 4dd75c70 Christoph Hellwig
  exit 1
1407 e5d355d1 aliguori
fi
1408 e5d355d1 aliguori
1409 bf9298b9 aliguori
##########################################
1410 5c6c3a6c Christoph Hellwig
# linux-aio probe
1411 5c6c3a6c Christoph Hellwig
1412 5c6c3a6c Christoph Hellwig
if test "$linux_aio" != "no" ; then
1413 5c6c3a6c Christoph Hellwig
  cat > $TMPC <<EOF
1414 5c6c3a6c Christoph Hellwig
#include <libaio.h>
1415 5c6c3a6c Christoph Hellwig
#include <sys/eventfd.h>
1416 5c6c3a6c Christoph Hellwig
int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
1417 5c6c3a6c Christoph Hellwig
EOF
1418 5c6c3a6c Christoph Hellwig
  if compile_prog "" "-laio" ; then
1419 5c6c3a6c Christoph Hellwig
    linux_aio=yes
1420 5c6c3a6c Christoph Hellwig
    LIBS="$LIBS -laio"
1421 5c6c3a6c Christoph Hellwig
  else
1422 5c6c3a6c Christoph Hellwig
    if test "$linux_aio" = "yes" ; then
1423 5c6c3a6c Christoph Hellwig
      feature_not_found "linux AIO"
1424 5c6c3a6c Christoph Hellwig
    fi
1425 3cfcae3c Luiz Capitulino
    linux_aio=no
1426 5c6c3a6c Christoph Hellwig
  fi
1427 5c6c3a6c Christoph Hellwig
fi
1428 5c6c3a6c Christoph Hellwig
1429 5c6c3a6c Christoph Hellwig
##########################################
1430 bf9298b9 aliguori
# iovec probe
1431 bf9298b9 aliguori
cat > $TMPC <<EOF
1432 db34f0b3 blueswir1
#include <sys/types.h>
1433 bf9298b9 aliguori
#include <sys/uio.h>
1434 db34f0b3 blueswir1
#include <unistd.h>
1435 bf9298b9 aliguori
int main(void) { struct iovec iov; return 0; }
1436 bf9298b9 aliguori
EOF
1437 bf9298b9 aliguori
iovec=no
1438 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1439 bf9298b9 aliguori
  iovec=yes
1440 bf9298b9 aliguori
fi
1441 bf9298b9 aliguori
1442 f652e6af aurel32
##########################################
1443 ceb42de8 aliguori
# preadv probe
1444 ceb42de8 aliguori
cat > $TMPC <<EOF
1445 ceb42de8 aliguori
#include <sys/types.h>
1446 ceb42de8 aliguori
#include <sys/uio.h>
1447 ceb42de8 aliguori
#include <unistd.h>
1448 ceb42de8 aliguori
int main(void) { preadv; }
1449 ceb42de8 aliguori
EOF
1450 ceb42de8 aliguori
preadv=no
1451 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1452 ceb42de8 aliguori
  preadv=yes
1453 ceb42de8 aliguori
fi
1454 ceb42de8 aliguori
1455 ceb42de8 aliguori
##########################################
1456 f652e6af aurel32
# fdt probe
1457 2df87df7 Juan Quintela
if test "$fdt" != "no" ; then
1458 b41af4ba Juan Quintela
  fdt_libs="-lfdt"
1459 b41af4ba Juan Quintela
  cat > $TMPC << EOF
1460 f652e6af aurel32
int main(void) { return 0; }
1461 f652e6af aurel32
EOF
1462 52166aa0 Juan Quintela
  if compile_prog "" "$fdt_libs" ; then
1463 f652e6af aurel32
    fdt=yes
1464 e4782985 Juan Quintela
    libs_softmmu="$fdt_libs $libs_softmmu"
1465 2df87df7 Juan Quintela
  else
1466 2df87df7 Juan Quintela
    if test "$fdt" = "yes" ; then
1467 2df87df7 Juan Quintela
      feature_not_found "fdt"
1468 2df87df7 Juan Quintela
    fi
1469 2df87df7 Juan Quintela
    fdt=no
1470 f652e6af aurel32
  fi
1471 f652e6af aurel32
fi
1472 f652e6af aurel32
1473 3b3f24ad aurel32
#
1474 3b3f24ad aurel32
# Check for xxxat() functions when we are building linux-user
1475 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1476 3b3f24ad aurel32
# have syscall stubs for these implemented.
1477 3b3f24ad aurel32
#
1478 3b3f24ad aurel32
atfile=no
1479 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1480 3b3f24ad aurel32
#define _ATFILE_SOURCE
1481 3b3f24ad aurel32
#include <sys/types.h>
1482 3b3f24ad aurel32
#include <fcntl.h>
1483 3b3f24ad aurel32
#include <unistd.h>
1484 3b3f24ad aurel32
1485 3b3f24ad aurel32
int
1486 3b3f24ad aurel32
main(void)
1487 3b3f24ad aurel32
{
1488 3b3f24ad aurel32
	/* try to unlink nonexisting file */
1489 3b3f24ad aurel32
	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
1490 3b3f24ad aurel32
}
1491 3b3f24ad aurel32
EOF
1492 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1493 67ba57f6 Riku Voipio
  atfile=yes
1494 3b3f24ad aurel32
fi
1495 3b3f24ad aurel32
1496 39386ac7 aurel32
# Check for inotify functions when we are building linux-user
1497 3b3f24ad aurel32
# emulator.  This is done because older glibc versions don't
1498 3b3f24ad aurel32
# have syscall stubs for these implemented.  In that case we
1499 3b3f24ad aurel32
# don't provide them even if kernel supports them.
1500 3b3f24ad aurel32
#
1501 3b3f24ad aurel32
inotify=no
1502 67ba57f6 Riku Voipio
cat > $TMPC << EOF
1503 3b3f24ad aurel32
#include <sys/inotify.h>
1504 3b3f24ad aurel32
1505 3b3f24ad aurel32
int
1506 3b3f24ad aurel32
main(void)
1507 3b3f24ad aurel32
{
1508 3b3f24ad aurel32
	/* try to start inotify */
1509 8690e420 aurel32
	return inotify_init();
1510 3b3f24ad aurel32
}
1511 3b3f24ad aurel32
EOF
1512 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1513 67ba57f6 Riku Voipio
  inotify=yes
1514 3b3f24ad aurel32
fi
1515 3b3f24ad aurel32
1516 ebc996f3 Riku Voipio
# check if utimensat and futimens are supported
1517 ebc996f3 Riku Voipio
utimens=no
1518 ebc996f3 Riku Voipio
cat > $TMPC << EOF
1519 ebc996f3 Riku Voipio
#define _ATFILE_SOURCE
1520 ebc996f3 Riku Voipio
#define _GNU_SOURCE
1521 ebc996f3 Riku Voipio
#include <stddef.h>
1522 ebc996f3 Riku Voipio
#include <fcntl.h>
1523 ebc996f3 Riku Voipio
1524 ebc996f3 Riku Voipio
int main(void)
1525 ebc996f3 Riku Voipio
{
1526 ebc996f3 Riku Voipio
    utimensat(AT_FDCWD, "foo", NULL, 0);
1527 ebc996f3 Riku Voipio
    futimens(0, NULL);
1528 ebc996f3 Riku Voipio
    return 0;
1529 ebc996f3 Riku Voipio
}
1530 ebc996f3 Riku Voipio
EOF
1531 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1532 ebc996f3 Riku Voipio
  utimens=yes
1533 ebc996f3 Riku Voipio
fi
1534 ebc996f3 Riku Voipio
1535 099d6b0f Riku Voipio
# check if pipe2 is there
1536 099d6b0f Riku Voipio
pipe2=no
1537 099d6b0f Riku Voipio
cat > $TMPC << EOF
1538 099d6b0f Riku Voipio
#define _GNU_SOURCE
1539 099d6b0f Riku Voipio
#include <unistd.h>
1540 099d6b0f Riku Voipio
#include <fcntl.h>
1541 099d6b0f Riku Voipio
1542 099d6b0f Riku Voipio
int main(void)
1543 099d6b0f Riku Voipio
{
1544 099d6b0f Riku Voipio
    int pipefd[2];
1545 099d6b0f Riku Voipio
    pipe2(pipefd, O_CLOEXEC);
1546 099d6b0f Riku Voipio
    return 0;
1547 099d6b0f Riku Voipio
}
1548 099d6b0f Riku Voipio
EOF
1549 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1550 099d6b0f Riku Voipio
  pipe2=yes
1551 099d6b0f Riku Voipio
fi
1552 099d6b0f Riku Voipio
1553 3ce34dfb vibisreenivasan
# check if tee/splice is there. vmsplice was added same time.
1554 3ce34dfb vibisreenivasan
splice=no
1555 3ce34dfb vibisreenivasan
cat > $TMPC << EOF
1556 3ce34dfb vibisreenivasan
#define _GNU_SOURCE
1557 3ce34dfb vibisreenivasan
#include <unistd.h>
1558 3ce34dfb vibisreenivasan
#include <fcntl.h>
1559 3ce34dfb vibisreenivasan
#include <limits.h>
1560 3ce34dfb vibisreenivasan
1561 3ce34dfb vibisreenivasan
int main(void)
1562 3ce34dfb vibisreenivasan
{
1563 3ce34dfb vibisreenivasan
    int len, fd;
1564 3ce34dfb vibisreenivasan
    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
1565 3ce34dfb vibisreenivasan
    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
1566 3ce34dfb vibisreenivasan
    return 0;
1567 3ce34dfb vibisreenivasan
}
1568 3ce34dfb vibisreenivasan
EOF
1569 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1570 3ce34dfb vibisreenivasan
  splice=yes
1571 3ce34dfb vibisreenivasan
fi
1572 3ce34dfb vibisreenivasan
1573 c2882b96 Riku Voipio
# check if eventfd is supported
1574 c2882b96 Riku Voipio
eventfd=no
1575 c2882b96 Riku Voipio
cat > $TMPC << EOF
1576 c2882b96 Riku Voipio
#include <sys/eventfd.h>
1577 c2882b96 Riku Voipio
1578 c2882b96 Riku Voipio
int main(void)
1579 c2882b96 Riku Voipio
{
1580 c2882b96 Riku Voipio
    int efd = eventfd(0, 0);
1581 c2882b96 Riku Voipio
    return 0;
1582 c2882b96 Riku Voipio
}
1583 c2882b96 Riku Voipio
EOF
1584 c2882b96 Riku Voipio
if compile_prog "" "" ; then
1585 c2882b96 Riku Voipio
  eventfd=yes
1586 c2882b96 Riku Voipio
fi
1587 c2882b96 Riku Voipio
1588 d0927938 Ulrich Hecht
# check for fallocate
1589 d0927938 Ulrich Hecht
fallocate=no
1590 d0927938 Ulrich Hecht
cat > $TMPC << EOF
1591 d0927938 Ulrich Hecht
#include <fcntl.h>
1592 d0927938 Ulrich Hecht
1593 d0927938 Ulrich Hecht
int main(void)
1594 d0927938 Ulrich Hecht
{
1595 d0927938 Ulrich Hecht
    fallocate(0, 0, 0, 0);
1596 d0927938 Ulrich Hecht
    return 0;
1597 d0927938 Ulrich Hecht
}
1598 d0927938 Ulrich Hecht
EOF
1599 78f5d726 Jan Kiszka
if compile_prog "" "" ; then
1600 d0927938 Ulrich Hecht
  fallocate=yes
1601 d0927938 Ulrich Hecht
fi
1602 d0927938 Ulrich Hecht
1603 d0927938 Ulrich Hecht
# check for dup3
1604 d0927938 Ulrich Hecht
dup3=no
1605 d0927938 Ulrich Hecht
cat > $TMPC << EOF
1606 d0927938 Ulrich Hecht
#include <unistd.h>
1607 d0927938 Ulrich Hecht
1608 d0927938 Ulrich Hecht
int main(void)
1609 d0927938 Ulrich Hecht
{
1610 d0927938 Ulrich Hecht
    dup3(0, 0, 0);
1611 d0927938 Ulrich Hecht
    return 0;
1612 d0927938 Ulrich Hecht
}
1613 d0927938 Ulrich Hecht
EOF
1614 78f5d726 Jan Kiszka
if compile_prog "" "" ; then
1615 d0927938 Ulrich Hecht
  dup3=yes
1616 d0927938 Ulrich Hecht
fi
1617 d0927938 Ulrich Hecht
1618 cc8ae6de pbrook
# Check if tools are available to build documentation.
1619 a25dba17 Juan Quintela
if test "$docs" != "no" ; then
1620 83a3ab8b Juan Quintela
  if test -x "`which texi2html 2>/dev/null`" -a \
1621 83a3ab8b Juan Quintela
          -x "`which pod2man 2>/dev/null`" ; then
1622 a25dba17 Juan Quintela
    docs=yes
1623 83a3ab8b Juan Quintela
  else
1624 a25dba17 Juan Quintela
    if test "$docs" = "yes" ; then
1625 a25dba17 Juan Quintela
      feature_not_found "docs"
1626 83a3ab8b Juan Quintela
    fi
1627 a25dba17 Juan Quintela
    docs=no
1628 83a3ab8b Juan Quintela
  fi
1629 cc8ae6de pbrook
fi
1630 cc8ae6de pbrook
1631 f514f41c Stefan Weil
# Search for bswap_32 function
1632 6ae9a1f4 Juan Quintela
byteswap_h=no
1633 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1634 6ae9a1f4 Juan Quintela
#include <byteswap.h>
1635 6ae9a1f4 Juan Quintela
int main(void) { return bswap_32(0); }
1636 6ae9a1f4 Juan Quintela
EOF
1637 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1638 6ae9a1f4 Juan Quintela
  byteswap_h=yes
1639 6ae9a1f4 Juan Quintela
fi
1640 6ae9a1f4 Juan Quintela
1641 f514f41c Stefan Weil
# Search for bswap_32 function
1642 6ae9a1f4 Juan Quintela
bswap_h=no
1643 6ae9a1f4 Juan Quintela
cat > $TMPC << EOF
1644 6ae9a1f4 Juan Quintela
#include <sys/endian.h>
1645 6ae9a1f4 Juan Quintela
#include <sys/types.h>
1646 6ae9a1f4 Juan Quintela
#include <machine/bswap.h>
1647 6ae9a1f4 Juan Quintela
int main(void) { return bswap32(0); }
1648 6ae9a1f4 Juan Quintela
EOF
1649 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1650 6ae9a1f4 Juan Quintela
  bswap_h=yes
1651 6ae9a1f4 Juan Quintela
fi
1652 6ae9a1f4 Juan Quintela
1653 da93a1fd aliguori
##########################################
1654 da93a1fd aliguori
# Do we need librt
1655 da93a1fd aliguori
cat > $TMPC <<EOF
1656 da93a1fd aliguori
#include <signal.h>
1657 da93a1fd aliguori
#include <time.h>
1658 da93a1fd aliguori
int main(void) { clockid_t id; return clock_gettime(id, NULL); }
1659 da93a1fd aliguori
EOF
1660 da93a1fd aliguori
1661 52166aa0 Juan Quintela
if compile_prog "" "" ; then
1662 07ffa4bd Juan Quintela
  :
1663 52166aa0 Juan Quintela
elif compile_prog "" "-lrt" ; then
1664 07ffa4bd Juan Quintela
  LIBS="-lrt $LIBS"
1665 da93a1fd aliguori
fi
1666 da93a1fd aliguori
1667 a36abbbb Juan Quintela
# Determine what linker flags to use to force archive inclusion
1668 a36abbbb Juan Quintela
check_linker_flags()
1669 a36abbbb Juan Quintela
{
1670 a36abbbb Juan Quintela
    w2=
1671 a36abbbb Juan Quintela
    if test "$2" ; then
1672 a36abbbb Juan Quintela
	w2=-Wl,$2
1673 a36abbbb Juan Quintela
    fi
1674 52166aa0 Juan Quintela
    compile_prog "" "-Wl,$1 ${w2}"
1675 a36abbbb Juan Quintela
}
1676 a36abbbb Juan Quintela
1677 a36abbbb Juan Quintela
cat > $TMPC << EOF
1678 a36abbbb Juan Quintela
int main(void) { }
1679 a36abbbb Juan Quintela
EOF
1680 a36abbbb Juan Quintela
if check_linker_flags --whole-archive --no-whole-archive ; then
1681 a36abbbb Juan Quintela
    # GNU ld
1682 a36abbbb Juan Quintela
    arlibs_begin="-Wl,--whole-archive"
1683 a36abbbb Juan Quintela
    arlibs_end="-Wl,--no-whole-archive"
1684 a36abbbb Juan Quintela
elif check_linker_flags -z,allextract -z,defaultextract ; then
1685 a36abbbb Juan Quintela
    # Solaris ld
1686 31ff504d Blue Swirl
    arlibs_begin="-Wl,-z,allextract"
1687 a36abbbb Juan Quintela
    arlibs_end="-Wl,-z,defaultextract"
1688 a36abbbb Juan Quintela
elif check_linker_flags -all_load ; then
1689 a36abbbb Juan Quintela
    # Mac OS X
1690 a36abbbb Juan Quintela
    arlibs_begin="-all_load"
1691 a36abbbb Juan Quintela
    arlibs_end=""
1692 a36abbbb Juan Quintela
else
1693 a36abbbb Juan Quintela
    echo "Error: your linker does not support --whole-archive or -z."
1694 a36abbbb Juan Quintela
    echo "Please report to qemu-devel@nongnu.org"
1695 a36abbbb Juan Quintela
    exit 1
1696 a36abbbb Juan Quintela
fi
1697 a36abbbb Juan Quintela
1698 31ff504d Blue Swirl
if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
1699 6362a53f Juan Quintela
        "$aix" != "yes" ; then
1700 6362a53f Juan Quintela
    libs_softmmu="-lutil $libs_softmmu"
1701 6362a53f Juan Quintela
fi
1702 6362a53f Juan Quintela
1703 de5071c5 Blue Swirl
##########################################
1704 de5071c5 Blue Swirl
# check if the compiler defines offsetof
1705 de5071c5 Blue Swirl
1706 de5071c5 Blue Swirl
need_offsetof=yes
1707 de5071c5 Blue Swirl
cat > $TMPC << EOF
1708 de5071c5 Blue Swirl
#include <stddef.h>
1709 de5071c5 Blue Swirl
int main(void) { struct s { int f; }; return offsetof(struct s, f); }
1710 de5071c5 Blue Swirl
EOF
1711 de5071c5 Blue Swirl
if compile_prog "" "" ; then
1712 de5071c5 Blue Swirl
    need_offsetof=no
1713 de5071c5 Blue Swirl
fi
1714 de5071c5 Blue Swirl
1715 5f6b9e8f Blue Swirl
##########################################
1716 747bbdf7 Blue Swirl
# check if the compiler understands attribute warn_unused_result
1717 747bbdf7 Blue Swirl
#
1718 747bbdf7 Blue Swirl
# This could be smarter, but gcc -Werror does not error out even when warning
1719 747bbdf7 Blue Swirl
# about attribute warn_unused_result
1720 747bbdf7 Blue Swirl
1721 747bbdf7 Blue Swirl
gcc_attribute_warn_unused_result=no
1722 747bbdf7 Blue Swirl
cat > $TMPC << EOF
1723 747bbdf7 Blue Swirl
#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
1724 747bbdf7 Blue Swirl
#error gcc 3.3 or older
1725 747bbdf7 Blue Swirl
#endif
1726 747bbdf7 Blue Swirl
int main(void) { return 0;}
1727 747bbdf7 Blue Swirl
EOF
1728 747bbdf7 Blue Swirl
if compile_prog "" ""; then
1729 747bbdf7 Blue Swirl
    gcc_attribute_warn_unused_result=yes
1730 747bbdf7 Blue Swirl
fi
1731 747bbdf7 Blue Swirl
1732 747bbdf7 Blue Swirl
##########################################
1733 5f6b9e8f Blue Swirl
# check if we have fdatasync
1734 5f6b9e8f Blue Swirl
1735 5f6b9e8f Blue Swirl
fdatasync=no
1736 5f6b9e8f Blue Swirl
cat > $TMPC << EOF
1737 5f6b9e8f Blue Swirl
#include <unistd.h>
1738 5f6b9e8f Blue Swirl
int main(void) { return fdatasync(0); }
1739 5f6b9e8f Blue Swirl
EOF
1740 5f6b9e8f Blue Swirl
if compile_prog "" "" ; then
1741 5f6b9e8f Blue Swirl
    fdatasync=yes
1742 5f6b9e8f Blue Swirl
fi
1743 5f6b9e8f Blue Swirl
1744 e86ecd4b Juan Quintela
# End of CC checks
1745 e86ecd4b Juan Quintela
# After here, no more $cc or $ld runs
1746 e86ecd4b Juan Quintela
1747 e86ecd4b Juan Quintela
# default flags for all hosts
1748 a558ee17 Juan Quintela
QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
1749 a558ee17 Juan Quintela
CFLAGS="-g $CFLAGS"
1750 e86ecd4b Juan Quintela
if test "$debug" = "no" ; then
1751 1156c669 Juan Quintela
  CFLAGS="-O2 $CFLAGS"
1752 e86ecd4b Juan Quintela
fi
1753 867c16fd Juan Quintela
QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
1754 867c16fd Juan Quintela
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
1755 6c90361a Juan Quintela
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
1756 6c90361a Juan Quintela
QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
1757 02d5467e malc
QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
1758 1156c669 Juan Quintela
LDFLAGS="-g $LDFLAGS"
1759 e86ecd4b Juan Quintela
1760 a316e378 Juan Quintela
gcc_flags="-Wold-style-declaration -Wold-style-definition"
1761 a316e378 Juan Quintela
cat > $TMPC << EOF
1762 a316e378 Juan Quintela
int main(void) { }
1763 a316e378 Juan Quintela
EOF
1764 a316e378 Juan Quintela
for flag in $gcc_flags; do
1765 a316e378 Juan Quintela
    if compile_prog "$QEMU_CFLAGS" "$flag" ; then
1766 a316e378 Juan Quintela
	QEMU_CFLAGS="$flag $QEMU_CFLAGS"
1767 a316e378 Juan Quintela
    fi
1768 a316e378 Juan Quintela
done
1769 a316e378 Juan Quintela
1770 e86ecd4b Juan Quintela
# Consult white-list to determine whether to enable werror
1771 e86ecd4b Juan Quintela
# by default.  Only enable by default for git builds
1772 e86ecd4b Juan Quintela
if test -z "$werror" ; then
1773 e86ecd4b Juan Quintela
    z_version=`cut -f3 -d. $source_path/VERSION`
1774 e86ecd4b Juan Quintela
    if test "$z_version" = "50" -a \
1775 e86ecd4b Juan Quintela
        "$linux" = "yes" ; then
1776 e86ecd4b Juan Quintela
        werror="yes"
1777 e86ecd4b Juan Quintela
    else
1778 e86ecd4b Juan Quintela
        werror="no"
1779 e86ecd4b Juan Quintela
    fi
1780 e86ecd4b Juan Quintela
fi
1781 e86ecd4b Juan Quintela
1782 e86ecd4b Juan Quintela
if test "$werror" = "yes" ; then
1783 a558ee17 Juan Quintela
    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
1784 e86ecd4b Juan Quintela
fi
1785 e86ecd4b Juan Quintela
1786 e86ecd4b Juan Quintela
if test "$solaris" = "no" ; then
1787 e86ecd4b Juan Quintela
    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
1788 1156c669 Juan Quintela
        LDFLAGS="-Wl,--warn-common $LDFLAGS"
1789 e86ecd4b Juan Quintela
    fi
1790 e86ecd4b Juan Quintela
fi
1791 e86ecd4b Juan Quintela
1792 11d9f695 bellard
if test "$mingw32" = "yes" ; then
1793 308c3593 pbrook
  if test -z "$prefix" ; then
1794 55418b96 Stefan Weil
      prefix="c:/Program Files/Qemu"
1795 308c3593 pbrook
  fi
1796 308c3593 pbrook
  mansuffix=""
1797 308c3593 pbrook
  datasuffix=""
1798 308c3593 pbrook
  docsuffix=""
1799 308c3593 pbrook
  binsuffix=""
1800 11d9f695 bellard
else
1801 308c3593 pbrook
  if test -z "$prefix" ; then
1802 308c3593 pbrook
      prefix="/usr/local"
1803 308c3593 pbrook
  fi
1804 308c3593 pbrook
  mansuffix="/share/man"
1805 308c3593 pbrook
  datasuffix="/share/qemu"
1806 308c3593 pbrook
  docsuffix="/share/doc/qemu"
1807 308c3593 pbrook
  binsuffix="/bin"
1808 11d9f695 bellard
fi
1809 5a67135a bellard
1810 43ce4dfe bellard
echo "Install prefix    $prefix"
1811 308c3593 pbrook
echo "BIOS directory    $prefix$datasuffix"
1812 308c3593 pbrook
echo "binary directory  $prefix$binsuffix"
1813 11d9f695 bellard
if test "$mingw32" = "no" ; then
1814 308c3593 pbrook
echo "Manual directory  $prefix$mansuffix"
1815 43ce4dfe bellard
echo "ELF interp prefix $interp_prefix"
1816 11d9f695 bellard
fi
1817 5a67135a bellard
echo "Source path       $source_path"
1818 43ce4dfe bellard
echo "C compiler        $cc"
1819 83469015 bellard
echo "Host C compiler   $host_cc"
1820 0c439cbf Juan Quintela
echo "CFLAGS            $CFLAGS"
1821 a558ee17 Juan Quintela
echo "QEMU_CFLAGS       $QEMU_CFLAGS"
1822 0c439cbf Juan Quintela
echo "LDFLAGS           $LDFLAGS"
1823 43ce4dfe bellard
echo "make              $make"
1824 6a882643 pbrook
echo "install           $install"
1825 43ce4dfe bellard
echo "host CPU          $cpu"
1826 de83cd02 bellard
echo "host big endian   $bigendian"
1827 97a847bc bellard
echo "target list       $target_list"
1828 ade25b0d aurel32
echo "tcg debug enabled $debug_tcg"
1829 43ce4dfe bellard
echo "gprof enabled     $gprof"
1830 03b4fe7d aliguori
echo "sparse enabled    $sparse"
1831 1625af87 aliguori
echo "strip binaries    $strip_opt"
1832 05c2a3e7 bellard
echo "profiler          $profiler"
1833 43ce4dfe bellard
echo "static build      $static"
1834 85aa5189 bellard
echo "-Werror enabled   $werror"
1835 5b0753e0 bellard
if test "$darwin" = "yes" ; then
1836 5b0753e0 bellard
    echo "Cocoa support     $cocoa"
1837 5b0753e0 bellard
fi
1838 97a847bc bellard
echo "SDL support       $sdl"
1839 4d3b6f6e balrog
echo "curses support    $curses"
1840 769ce76d Alexander Graf
echo "curl support      $curl"
1841 5495ed11 Luiz Capitulino
echo "check support     $check_utests"
1842 67b915a5 bellard
echo "mingw32 support   $mingw32"
1843 0c58ac1c malc
echo "Audio drivers     $audio_drv_list"
1844 0c58ac1c malc
echo "Extra audio cards $audio_card_list"
1845 eb852011 Markus Armbruster
echo "Block whitelist   $block_drv_whitelist"
1846 8ff9cbf7 malc
echo "Mixer emulation   $mixemu"
1847 8d5d2d4c ths
echo "VNC TLS support   $vnc_tls"
1848 2f9606b3 aliguori
echo "VNC SASL support  $vnc_sasl"
1849 3142255c blueswir1
if test -n "$sparc_cpu"; then
1850 3142255c blueswir1
    echo "Target Sparc Arch $sparc_cpu"
1851 3142255c blueswir1
fi
1852 e37630ca aliguori
echo "xen support       $xen"
1853 2e4d9fb1 aurel32
echo "brlapi support    $brlapi"
1854 a20a6f46 Juan Quintela
echo "bluez  support    $bluez"
1855 a25dba17 Juan Quintela
echo "Documentation     $docs"
1856 c5937220 pbrook
[ ! -z "$uname_release" ] && \
1857 c5937220 pbrook
echo "uname -r          $uname_release"
1858 bd0c5661 pbrook
echo "NPTL support      $nptl"
1859 379f6698 Paul Brook
echo "GUEST_BASE        $guest_base"
1860 34005a00 Kirill A. Shutemov
echo "PIE user targets  $user_pie"
1861 8a16d273 ths
echo "vde support       $vde"
1862 e5d355d1 aliguori
echo "IO thread         $io_thread"
1863 5c6c3a6c Christoph Hellwig
echo "Linux AIO support $linux_aio"
1864 77755340 ths
echo "Install blobs     $blobs"
1865 b31a0277 Juan Quintela
echo "KVM support       $kvm"
1866 f652e6af aurel32
echo "fdt support       $fdt"
1867 ceb42de8 aliguori
echo "preadv support    $preadv"
1868 5f6b9e8f Blue Swirl
echo "fdatasync         $fdatasync"
1869 ee682d27 Stefan Weil
echo "uuid support      $uuid"
1870 67b915a5 bellard
1871 97a847bc bellard
if test $sdl_too_old = "yes"; then
1872 24b55b96 bellard
echo "-> Your SDL version is too old - please upgrade to have SDL support"
1873 7c1f25b4 bellard
fi
1874 7d13299d bellard
1875 98ec69ac Juan Quintela
config_host_mak="config-host.mak"
1876 4bf6b55b Juan Quintela
config_host_ld="config-host.ld"
1877 98ec69ac Juan Quintela
1878 98ec69ac Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_host_mak
1879 98ec69ac Juan Quintela
printf "# Configured with:" >> $config_host_mak
1880 98ec69ac Juan Quintela
printf " '%s'" "$0" "$@" >> $config_host_mak
1881 98ec69ac Juan Quintela
echo >> $config_host_mak
1882 98ec69ac Juan Quintela
1883 2358a494 Juan Quintela
echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
1884 804edf29 Juan Quintela
1885 2408a527 aurel32
case "$cpu" in
1886 c62bbcd3 Andrzej Zaborowski
  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
1887 e0da9dd3 Juan Quintela
    ARCH=$cpu
1888 2408a527 aurel32
  ;;
1889 a302c32d Laurent Desnogues
  armv4b|armv4l)
1890 16dbd14f Juan Quintela
    ARCH=arm
1891 2408a527 aurel32
  ;;
1892 2408a527 aurel32
  *)
1893 2408a527 aurel32
    echo "Unsupported CPU = $cpu"
1894 2408a527 aurel32
    exit 1
1895 2408a527 aurel32
  ;;
1896 2408a527 aurel32
esac
1897 98ec69ac Juan Quintela
echo "ARCH=$ARCH" >> $config_host_mak
1898 f8393946 aurel32
if test "$debug_tcg" = "yes" ; then
1899 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
1900 f8393946 aurel32
fi
1901 f3d08ee6 Paul Brook
if test "$debug" = "yes" ; then
1902 2358a494 Juan Quintela
  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
1903 f3d08ee6 Paul Brook
fi
1904 1625af87 aliguori
if test "$strip_opt" = "yes" ; then
1905 98ec69ac Juan Quintela
  echo "STRIP_OPT=-s" >> $config_host_mak
1906 1625af87 aliguori
fi
1907 7d13299d bellard
if test "$bigendian" = "yes" ; then
1908 e2542fe2 Juan Quintela
  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
1909 97a847bc bellard
fi
1910 2358a494 Juan Quintela
echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
1911 67b915a5 bellard
if test "$mingw32" = "yes" ; then
1912 98ec69ac Juan Quintela
  echo "CONFIG_WIN32=y" >> $config_host_mak
1913 210fa556 pbrook
else
1914 35f4df27 Juan Quintela
  echo "CONFIG_POSIX=y" >> $config_host_mak
1915 dffcb71c Mark McLoughlin
fi
1916 dffcb71c Mark McLoughlin
1917 dffcb71c Mark McLoughlin
if test "$linux" = "yes" ; then
1918 dffcb71c Mark McLoughlin
  echo "CONFIG_LINUX=y" >> $config_host_mak
1919 67b915a5 bellard
fi
1920 128ab2ff blueswir1
1921 83fb7adf bellard
if test "$darwin" = "yes" ; then
1922 98ec69ac Juan Quintela
  echo "CONFIG_DARWIN=y" >> $config_host_mak
1923 83fb7adf bellard
fi
1924 b29fe3ed malc
1925 b29fe3ed malc
if test "$aix" = "yes" ; then
1926 98ec69ac Juan Quintela
  echo "CONFIG_AIX=y" >> $config_host_mak
1927 b29fe3ed malc
fi
1928 b29fe3ed malc
1929 ec530c81 bellard
if test "$solaris" = "yes" ; then
1930 98ec69ac Juan Quintela
  echo "CONFIG_SOLARIS=y" >> $config_host_mak
1931 2358a494 Juan Quintela
  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
1932 0475a5ca ths
  if test "$needs_libsunmath" = "yes" ; then
1933 75b5a697 Juan Quintela
    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
1934 0475a5ca ths
  fi
1935 ec530c81 bellard
fi
1936 97a847bc bellard
if test "$static" = "yes" ; then
1937 98ec69ac Juan Quintela
  echo "CONFIG_STATIC=y" >> $config_host_mak
1938 1156c669 Juan Quintela
  LDFLAGS="-static $LDFLAGS"
1939 7d13299d bellard
fi
1940 05c2a3e7 bellard
if test $profiler = "yes" ; then
1941 2358a494 Juan Quintela
  echo "CONFIG_PROFILER=y" >> $config_host_mak
1942 05c2a3e7 bellard
fi
1943 c20709aa bellard
if test "$slirp" = "yes" ; then
1944 98ec69ac Juan Quintela
  echo "CONFIG_SLIRP=y" >> $config_host_mak
1945 b6e31c12 Juan Quintela
  QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
1946 c20709aa bellard
fi
1947 8a16d273 ths
if test "$vde" = "yes" ; then
1948 98ec69ac Juan Quintela
  echo "CONFIG_VDE=y" >> $config_host_mak
1949 8a16d273 ths
fi
1950 0c58ac1c malc
for card in $audio_card_list; do
1951 f6e5889e pbrook
    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1952 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
1953 0c58ac1c malc
done
1954 2358a494 Juan Quintela
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
1955 0c58ac1c malc
for drv in $audio_drv_list; do
1956 f6e5889e pbrook
    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1957 98ec69ac Juan Quintela
    echo "$def=y" >> $config_host_mak
1958 923e4521 malc
    if test "$drv" = "fmod"; then
1959 7aac6cb1 Juan Quintela
        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
1960 0c58ac1c malc
    fi
1961 0c58ac1c malc
done
1962 67f86e8e Juan Quintela
if test "$audio_pt_int" = "yes" ; then
1963 67f86e8e Juan Quintela
  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
1964 67f86e8e Juan Quintela
fi
1965 d5631638 malc
if test "$audio_win_int" = "yes" ; then
1966 d5631638 malc
  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
1967 d5631638 malc
fi
1968 eb852011 Markus Armbruster
echo "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
1969 8ff9cbf7 malc
if test "$mixemu" = "yes" ; then
1970 98ec69ac Juan Quintela
  echo "CONFIG_MIXEMU=y" >> $config_host_mak
1971 8ff9cbf7 malc
fi
1972 8d5d2d4c ths
if test "$vnc_tls" = "yes" ; then
1973 98ec69ac Juan Quintela
  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
1974 525061bf Juan Quintela
  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1975 8d5d2d4c ths
fi
1976 2f9606b3 aliguori
if test "$vnc_sasl" = "yes" ; then
1977 98ec69ac Juan Quintela
  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
1978 60ddf533 Juan Quintela
  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1979 2f9606b3 aliguori
fi
1980 76655d6d aliguori
if test "$fnmatch" = "yes" ; then
1981 2358a494 Juan Quintela
  echo "CONFIG_FNMATCH=y" >> $config_host_mak
1982 76655d6d aliguori
fi
1983 ee682d27 Stefan Weil
if test "$uuid" = "yes" ; then
1984 ee682d27 Stefan Weil
  echo "CONFIG_UUID=y" >> $config_host_mak
1985 ee682d27 Stefan Weil
fi
1986 b1a550a0 pbrook
qemu_version=`head $source_path/VERSION`
1987 98ec69ac Juan Quintela
echo "VERSION=$qemu_version" >>$config_host_mak
1988 2358a494 Juan Quintela
echo "PKGVERSION=$pkgversion" >>$config_host_mak
1989 98ec69ac Juan Quintela
echo "SRC_PATH=$source_path" >> $config_host_mak
1990 ad064840 pbrook
if [ "$source_path_used" = "yes" ]; then
1991 98ec69ac Juan Quintela
  echo "VPATH=$source_path" >> $config_host_mak
1992 ad064840 pbrook
fi
1993 98ec69ac Juan Quintela
echo "TARGET_DIRS=$target_list" >> $config_host_mak
1994 a25dba17 Juan Quintela
if [ "$docs" = "yes" ] ; then
1995 98ec69ac Juan Quintela
  echo "BUILD_DOCS=yes" >> $config_host_mak
1996 cc8ae6de pbrook
fi
1997 1ac88f28 Juan Quintela
if test "$sdl" = "yes" ; then
1998 98ec69ac Juan Quintela
  echo "CONFIG_SDL=y" >> $config_host_mak
1999 1ac88f28 Juan Quintela
  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
2000 49ecc3fa bellard
fi
2001 49ecc3fa bellard
if test "$cocoa" = "yes" ; then
2002 98ec69ac Juan Quintela
  echo "CONFIG_COCOA=y" >> $config_host_mak
2003 4d3b6f6e balrog
fi
2004 4d3b6f6e balrog
if test "$curses" = "yes" ; then
2005 98ec69ac Juan Quintela
  echo "CONFIG_CURSES=y" >> $config_host_mak
2006 49ecc3fa bellard
fi
2007 3b3f24ad aurel32
if test "$atfile" = "yes" ; then
2008 2358a494 Juan Quintela
  echo "CONFIG_ATFILE=y" >> $config_host_mak
2009 3b3f24ad aurel32
fi
2010 ebc996f3 Riku Voipio
if test "$utimens" = "yes" ; then
2011 2358a494 Juan Quintela
  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2012 ebc996f3 Riku Voipio
fi
2013 099d6b0f Riku Voipio
if test "$pipe2" = "yes" ; then
2014 2358a494 Juan Quintela
  echo "CONFIG_PIPE2=y" >> $config_host_mak
2015 099d6b0f Riku Voipio
fi
2016 3ce34dfb vibisreenivasan
if test "$splice" = "yes" ; then
2017 2358a494 Juan Quintela
  echo "CONFIG_SPLICE=y" >> $config_host_mak
2018 3ce34dfb vibisreenivasan
fi
2019 c2882b96 Riku Voipio
if test "$eventfd" = "yes" ; then
2020 c2882b96 Riku Voipio
  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2021 c2882b96 Riku Voipio
fi
2022 d0927938 Ulrich Hecht
if test "$fallocate" = "yes" ; then
2023 d0927938 Ulrich Hecht
  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2024 d0927938 Ulrich Hecht
fi
2025 d0927938 Ulrich Hecht
if test "$dup3" = "yes" ; then
2026 d0927938 Ulrich Hecht
  echo "CONFIG_DUP3=y" >> $config_host_mak
2027 d0927938 Ulrich Hecht
fi
2028 3b3f24ad aurel32
if test "$inotify" = "yes" ; then
2029 2358a494 Juan Quintela
  echo "CONFIG_INOTIFY=y" >> $config_host_mak
2030 3b3f24ad aurel32
fi
2031 6ae9a1f4 Juan Quintela
if test "$byteswap_h" = "yes" ; then
2032 6ae9a1f4 Juan Quintela
  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
2033 6ae9a1f4 Juan Quintela
fi
2034 6ae9a1f4 Juan Quintela
if test "$bswap_h" = "yes" ; then
2035 6ae9a1f4 Juan Quintela
  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
2036 6ae9a1f4 Juan Quintela
fi
2037 769ce76d Alexander Graf
if test "$curl" = "yes" ; then
2038 98ec69ac Juan Quintela
  echo "CONFIG_CURL=y" >> $config_host_mak
2039 b1d5a277 Juan Quintela
  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2040 769ce76d Alexander Graf
fi
2041 2e4d9fb1 aurel32
if test "$brlapi" = "yes" ; then
2042 98ec69ac Juan Quintela
  echo "CONFIG_BRLAPI=y" >> $config_host_mak
2043 2e4d9fb1 aurel32
fi
2044 fb599c9a balrog
if test "$bluez" = "yes" ; then
2045 98ec69ac Juan Quintela
  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2046 ef7635ec Juan Quintela
  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2047 fb599c9a balrog
fi
2048 e37630ca aliguori
if test "$xen" = "yes" ; then
2049 5647eb74 Juan Quintela
  echo "CONFIG_XEN=y" >> $config_host_mak
2050 e37630ca aliguori
fi
2051 e5d355d1 aliguori
if test "$io_thread" = "yes" ; then
2052 98ec69ac Juan Quintela
  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2053 e5d355d1 aliguori
fi
2054 5c6c3a6c Christoph Hellwig
if test "$linux_aio" = "yes" ; then
2055 5c6c3a6c Christoph Hellwig
  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
2056 5c6c3a6c Christoph Hellwig
fi
2057 77755340 ths
if test "$blobs" = "yes" ; then
2058 98ec69ac Juan Quintela
  echo "INSTALL_BLOBS=yes" >> $config_host_mak
2059 77755340 ths
fi
2060 bf9298b9 aliguori
if test "$iovec" = "yes" ; then
2061 2358a494 Juan Quintela
  echo "CONFIG_IOVEC=y" >> $config_host_mak
2062 bf9298b9 aliguori
fi
2063 ceb42de8 aliguori
if test "$preadv" = "yes" ; then
2064 2358a494 Juan Quintela
  echo "CONFIG_PREADV=y" >> $config_host_mak
2065 ceb42de8 aliguori
fi
2066 f652e6af aurel32
if test "$fdt" = "yes" ; then
2067 3f0855b1 Juan Quintela
  echo "CONFIG_FDT=y" >> $config_host_mak
2068 f652e6af aurel32
fi
2069 de5071c5 Blue Swirl
if test "$need_offsetof" = "yes" ; then
2070 de5071c5 Blue Swirl
  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2071 de5071c5 Blue Swirl
fi
2072 747bbdf7 Blue Swirl
if test "$gcc_attribute_warn_unused_result" = "yes" ; then
2073 747bbdf7 Blue Swirl
  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2074 747bbdf7 Blue Swirl
fi
2075 5f6b9e8f Blue Swirl
if test "$fdatasync" = "yes" ; then
2076 5f6b9e8f Blue Swirl
  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
2077 5f6b9e8f Blue Swirl
fi
2078 97a847bc bellard
2079 83fb7adf bellard
# XXX: suppress that
2080 7d3505c5 bellard
if [ "$bsd" = "yes" ] ; then
2081 2358a494 Juan Quintela
  echo "CONFIG_BSD=y" >> $config_host_mak
2082 7d3505c5 bellard
fi
2083 7d3505c5 bellard
2084 2358a494 Juan Quintela
echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2085 c5937220 pbrook
2086 68063649 blueswir1
# USB host support
2087 68063649 blueswir1
case "$usb" in
2088 68063649 blueswir1
linux)
2089 98ec69ac Juan Quintela
  echo "HOST_USB=linux" >> $config_host_mak
2090 68063649 blueswir1
;;
2091 68063649 blueswir1
bsd)
2092 98ec69ac Juan Quintela
  echo "HOST_USB=bsd" >> $config_host_mak
2093 68063649 blueswir1
;;
2094 68063649 blueswir1
*)
2095 98ec69ac Juan Quintela
  echo "HOST_USB=stub" >> $config_host_mak
2096 68063649 blueswir1
;;
2097 68063649 blueswir1
esac
2098 68063649 blueswir1
2099 c39e3338 pbrook
tools=
2100 c39e3338 pbrook
if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
2101 86355e07 Aurelien Jarno
  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2102 7a5ca864 bellard
  if [ "$linux" = "yes" ] ; then
2103 86355e07 Aurelien Jarno
      tools="qemu-nbd\$(EXESUF) $tools"
2104 5495ed11 Luiz Capitulino
    if [ "$check_utests" = "yes" ]; then
2105 3aa3dcff Luiz Capitulino
      tools="check-qint check-qstring check-qdict check-qlist $tools"
2106 422c46a8 Anthony Liguori
      tools="check-qfloat check-qjson $tools"
2107 5495ed11 Luiz Capitulino
    fi
2108 7a5ca864 bellard
  fi
2109 c39e3338 pbrook
fi
2110 98ec69ac Juan Quintela
echo "TOOLS=$tools" >> $config_host_mak
2111 c39e3338 pbrook
2112 161294d8 Juan Quintela
# Mac OS X ships with a broken assembler
2113 253d0942 Alexander Graf
roms=
2114 161294d8 Juan Quintela
if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2115 b461cdc9 Blue Swirl
        "$targetos" != "Darwin" -a \
2116 b461cdc9 Blue Swirl
        `expr "$target_list" : ".*softmmu.*"` != 0 ; then
2117 c05ac895 Paul Brook
  roms="optionrom"
2118 253d0942 Alexander Graf
fi
2119 98ec69ac Juan Quintela
echo "ROMS=$roms" >> $config_host_mak
2120 253d0942 Alexander Graf
2121 804edf29 Juan Quintela
echo "prefix=$prefix" >> $config_host_mak
2122 804edf29 Juan Quintela
echo "bindir=\${prefix}$binsuffix" >> $config_host_mak
2123 804edf29 Juan Quintela
echo "mandir=\${prefix}$mansuffix" >> $config_host_mak
2124 804edf29 Juan Quintela
echo "datadir=\${prefix}$datasuffix" >> $config_host_mak
2125 804edf29 Juan Quintela
echo "docdir=\${prefix}$docsuffix" >> $config_host_mak
2126 804edf29 Juan Quintela
echo "MAKE=$make" >> $config_host_mak
2127 804edf29 Juan Quintela
echo "INSTALL=$install" >> $config_host_mak
2128 804edf29 Juan Quintela
echo "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2129 804edf29 Juan Quintela
echo "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2130 804edf29 Juan Quintela
echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2131 804edf29 Juan Quintela
echo "CC=$cc" >> $config_host_mak
2132 804edf29 Juan Quintela
echo "HOST_CC=$host_cc" >> $config_host_mak
2133 804edf29 Juan Quintela
if test "$sparse" = "yes" ; then
2134 804edf29 Juan Quintela
  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
2135 804edf29 Juan Quintela
  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
2136 a558ee17 Juan Quintela
  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2137 804edf29 Juan Quintela
fi
2138 804edf29 Juan Quintela
echo "AR=$ar" >> $config_host_mak
2139 804edf29 Juan Quintela
echo "OBJCOPY=$objcopy" >> $config_host_mak
2140 804edf29 Juan Quintela
echo "LD=$ld" >> $config_host_mak
2141 e2a2ed06 Juan Quintela
echo "CFLAGS=$CFLAGS" >> $config_host_mak
2142 a558ee17 Juan Quintela
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2143 c81da56e Juan Quintela
echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2144 e2a2ed06 Juan Quintela
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
2145 a36abbbb Juan Quintela
echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2146 a36abbbb Juan Quintela
echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
2147 73da375e Juan Quintela
echo "LIBS+=$LIBS" >> $config_host_mak
2148 3e2e0e6b Juan Quintela
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2149 804edf29 Juan Quintela
echo "EXESUF=$EXESUF" >> $config_host_mak
2150 804edf29 Juan Quintela
2151 4bf6b55b Juan Quintela
# generate list of library paths for linker script
2152 4bf6b55b Juan Quintela
2153 4bf6b55b Juan Quintela
$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
2154 4bf6b55b Juan Quintela
2155 4bf6b55b Juan Quintela
if test -f ${config_host_ld}~ ; then
2156 4bf6b55b Juan Quintela
  if cmp -s $config_host_ld ${config_host_ld}~ ; then
2157 4bf6b55b Juan Quintela
    mv ${config_host_ld}~ $config_host_ld
2158 4bf6b55b Juan Quintela
  else
2159 4bf6b55b Juan Quintela
    rm ${config_host_ld}~
2160 4bf6b55b Juan Quintela
  fi
2161 4bf6b55b Juan Quintela
fi
2162 4bf6b55b Juan Quintela
2163 1d14ffa9 bellard
for target in $target_list; do
2164 97a847bc bellard
target_dir="$target"
2165 25be210f Juan Quintela
config_target_mak=$target_dir/config-target.mak
2166 600309b6 Blue Swirl
target_arch2=`echo $target | cut -d '-' -f 1`
2167 97a847bc bellard
target_bigendian="no"
2168 1f3d3c8f Juan Quintela
2169 ea2d6a39 Juan Quintela
case "$target_arch2" in
2170 ea2d6a39 Juan Quintela
  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
2171 ea2d6a39 Juan Quintela
  target_bigendian=yes
2172 ea2d6a39 Juan Quintela
  ;;
2173 ea2d6a39 Juan Quintela
esac
2174 97a847bc bellard
target_softmmu="no"
2175 997344f3 bellard
target_user_only="no"
2176 831b7825 ths
target_linux_user="no"
2177 831b7825 ths
target_darwin_user="no"
2178 84778508 blueswir1
target_bsd_user="no"
2179 9e407a85 pbrook
case "$target" in
2180 600309b6 Blue Swirl
  ${target_arch2}-softmmu)
2181 9e407a85 pbrook
    target_softmmu="yes"
2182 9e407a85 pbrook
    ;;
2183 600309b6 Blue Swirl
  ${target_arch2}-linux-user)
2184 9c7a4202 Blue Swirl
    if test "$linux" != "yes" ; then
2185 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a Linux host"
2186 9c7a4202 Blue Swirl
      exit 1
2187 9c7a4202 Blue Swirl
    fi
2188 9e407a85 pbrook
    target_user_only="yes"
2189 9e407a85 pbrook
    target_linux_user="yes"
2190 9e407a85 pbrook
    ;;
2191 600309b6 Blue Swirl
  ${target_arch2}-darwin-user)
2192 9c7a4202 Blue Swirl
    if test "$darwin" != "yes" ; then
2193 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a Darwin host"
2194 9c7a4202 Blue Swirl
      exit 1
2195 9c7a4202 Blue Swirl
    fi
2196 9e407a85 pbrook
    target_user_only="yes"
2197 9e407a85 pbrook
    target_darwin_user="yes"
2198 9e407a85 pbrook
    ;;
2199 600309b6 Blue Swirl
  ${target_arch2}-bsd-user)
2200 9cf55765 Blue Swirl
    if test "$bsd" != "yes" ; then
2201 9c7a4202 Blue Swirl
      echo "ERROR: Target '$target' is only available on a BSD host"
2202 9c7a4202 Blue Swirl
      exit 1
2203 9c7a4202 Blue Swirl
    fi
2204 84778508 blueswir1
    target_user_only="yes"
2205 84778508 blueswir1
    target_bsd_user="yes"
2206 84778508 blueswir1
    ;;
2207 9e407a85 pbrook
  *)
2208 9e407a85 pbrook
    echo "ERROR: Target '$target' not recognised"
2209 9e407a85 pbrook
    exit 1
2210 9e407a85 pbrook
    ;;
2211 9e407a85 pbrook
esac
2212 831b7825 ths
2213 97a847bc bellard
mkdir -p $target_dir
2214 158142c2 bellard
mkdir -p $target_dir/fpu
2215 57fec1fe bellard
mkdir -p $target_dir/tcg
2216 59f2a787 Gerd Hoffmann
mkdir -p $target_dir/ide
2217 84778508 blueswir1
if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
2218 69de927c bellard
  mkdir -p $target_dir/nwfpe
2219 69de927c bellard
fi
2220 69de927c bellard
2221 ec530c81 bellard
#
2222 ec530c81 bellard
# don't use ln -sf as not all "ln -sf" over write the file/link
2223 ec530c81 bellard
#
2224 ec530c81 bellard
rm -f $target_dir/Makefile
2225 ec530c81 bellard
ln -s $source_path/Makefile.target $target_dir/Makefile
2226 ec530c81 bellard
2227 97a847bc bellard
2228 25be210f Juan Quintela
echo "# Automatically generated by configure - do not modify" > $config_target_mak
2229 de83cd02 bellard
2230 e5fe0c52 pbrook
bflt="no"
2231 cb33da57 blueswir1
elfload32="no"
2232 bd0c5661 pbrook
target_nptl="no"
2233 600309b6 Blue Swirl
interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
2234 25be210f Juan Quintela
echo "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
2235 56aebc89 pbrook
gdb_xml_files=""
2236 7ba1e619 aliguori
2237 938b1edd Juan Quintela
TARGET_ARCH="$target_arch2"
2238 6acff7da Juan Quintela
TARGET_BASE_ARCH=""
2239 e6e91b9c Juan Quintela
TARGET_ABI_DIR=""
2240 e73aae67 Juan Quintela
2241 600309b6 Blue Swirl
case "$target_arch2" in
2242 2408a527 aurel32
  i386)
2243 1ad2134f Paul Brook
    target_phys_bits=32
2244 2408a527 aurel32
  ;;
2245 2408a527 aurel32
  x86_64)
2246 6acff7da Juan Quintela
    TARGET_BASE_ARCH=i386
2247 1ad2134f Paul Brook
    target_phys_bits=64
2248 2408a527 aurel32
  ;;
2249 2408a527 aurel32
  alpha)
2250 1ad2134f Paul Brook
    target_phys_bits=64
2251 2408a527 aurel32
  ;;
2252 2408a527 aurel32
  arm|armeb)
2253 b498c8a0 Juan Quintela
    TARGET_ARCH=arm
2254 2408a527 aurel32
    bflt="yes"
2255 bd0c5661 pbrook
    target_nptl="yes"
2256 56aebc89 pbrook
    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
2257 1ad2134f Paul Brook
    target_phys_bits=32
2258 2408a527 aurel32
  ;;
2259 2408a527 aurel32
  cris)
2260 253bd7f8 edgar_igl
    target_nptl="yes"
2261 1ad2134f Paul Brook
    target_phys_bits=32
2262 2408a527 aurel32
  ;;
2263 2408a527 aurel32
  m68k)
2264 2408a527 aurel32
    bflt="yes"
2265 56aebc89 pbrook
    gdb_xml_files="cf-core.xml cf-fp.xml"
2266 1ad2134f Paul Brook
    target_phys_bits=32
2267 2408a527 aurel32
  ;;
2268 72b675ca Edgar E. Iglesias
  microblaze)
2269 72b675ca Edgar E. Iglesias
    bflt="yes"
2270 72b675ca Edgar E. Iglesias
    target_nptl="yes"
2271 72b675ca Edgar E. Iglesias
    target_phys_bits=32
2272 72b675ca Edgar E. Iglesias
  ;;
2273 0adcffb1 Juan Quintela
  mips|mipsel)
2274 b498c8a0 Juan Quintela
    TARGET_ARCH=mips
2275 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2276 f04dc72f Paul Brook
    target_nptl="yes"
2277 1ad2134f Paul Brook
    target_phys_bits=64
2278 2408a527 aurel32
  ;;
2279 2408a527 aurel32
  mipsn32|mipsn32el)
2280 b498c8a0 Juan Quintela
    TARGET_ARCH=mipsn32
2281 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2282 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
2283 1ad2134f Paul Brook
    target_phys_bits=64
2284 2408a527 aurel32
  ;;
2285 2408a527 aurel32
  mips64|mips64el)
2286 b498c8a0 Juan Quintela
    TARGET_ARCH=mips64
2287 6acff7da Juan Quintela
    TARGET_BASE_ARCH=mips
2288 25be210f Juan Quintela
    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
2289 1ad2134f Paul Brook
    target_phys_bits=64
2290 2408a527 aurel32
  ;;
2291 2408a527 aurel32
  ppc)
2292 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2293 1ad2134f Paul Brook
    target_phys_bits=32
2294 d6630708 Nathan Froyd
    target_nptl="yes"
2295 2408a527 aurel32
  ;;
2296 2408a527 aurel32
  ppcemb)
2297 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2298 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2299 c8b3532d aurel32
    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2300 1ad2134f Paul Brook
    target_phys_bits=64
2301 d6630708 Nathan Froyd
    target_nptl="yes"
2302 2408a527 aurel32
  ;;
2303 2408a527 aurel32
  ppc64)
2304 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2305 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2306 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2307 1ad2134f Paul Brook
    target_phys_bits=64
2308 2408a527 aurel32
  ;;
2309 2408a527 aurel32
  ppc64abi32)
2310 b498c8a0 Juan Quintela
    TARGET_ARCH=ppc64
2311 6acff7da Juan Quintela
    TARGET_BASE_ARCH=ppc
2312 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=ppc
2313 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
2314 c8b3532d aurel32
    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
2315 1ad2134f Paul Brook
    target_phys_bits=64
2316 2408a527 aurel32
  ;;
2317 2408a527 aurel32
  sh4|sh4eb)
2318 b498c8a0 Juan Quintela
    TARGET_ARCH=sh4
2319 2408a527 aurel32
    bflt="yes"
2320 0b6d3ae0 aurel32
    target_nptl="yes"
2321 1ad2134f Paul Brook
    target_phys_bits=32
2322 2408a527 aurel32
  ;;
2323 2408a527 aurel32
  sparc)
2324 1ad2134f Paul Brook
    target_phys_bits=64
2325 2408a527 aurel32
  ;;
2326 2408a527 aurel32
  sparc64)
2327 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2328 2408a527 aurel32
    elfload32="yes"
2329 1ad2134f Paul Brook
    target_phys_bits=64
2330 2408a527 aurel32
  ;;
2331 2408a527 aurel32
  sparc32plus)
2332 b498c8a0 Juan Quintela
    TARGET_ARCH=sparc64
2333 6acff7da Juan Quintela
    TARGET_BASE_ARCH=sparc
2334 e6e91b9c Juan Quintela
    TARGET_ABI_DIR=sparc
2335 25be210f Juan Quintela
    echo "TARGET_ABI32=y" >> $config_target_mak
2336 1ad2134f Paul Brook
    target_phys_bits=64
2337 2408a527 aurel32
  ;;
2338 2408a527 aurel32
  *)
2339 2408a527 aurel32
    echo "Unsupported target CPU"
2340 2408a527 aurel32
    exit 1
2341 2408a527 aurel32
  ;;
2342 2408a527 aurel32
esac
2343 25be210f Juan Quintela
echo "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2344 053dd92e Juan Quintela
target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
2345 25be210f Juan Quintela
echo "TARGET_$target_arch_name=y" >> $config_target_mak
2346 25be210f Juan Quintela
echo "TARGET_ARCH2=$target_arch2" >> $config_target_mak
2347 42bc608b Juan Quintela
# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
2348 6acff7da Juan Quintela
if [ "$TARGET_BASE_ARCH" = "" ]; then
2349 6acff7da Juan Quintela
  TARGET_BASE_ARCH=$TARGET_ARCH
2350 6acff7da Juan Quintela
fi
2351 25be210f Juan Quintela
echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2352 e6e91b9c Juan Quintela
if [ "$TARGET_ABI_DIR" = "" ]; then
2353 e6e91b9c Juan Quintela
  TARGET_ABI_DIR=$TARGET_ARCH
2354 e6e91b9c Juan Quintela
fi
2355 25be210f Juan Quintela
echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
2356 1ad2134f Paul Brook
if [ $target_phys_bits -lt $hostlongbits ] ; then
2357 1ad2134f Paul Brook
  target_phys_bits=$hostlongbits
2358 1ad2134f Paul Brook
fi
2359 1b0c87fc Juan Quintela
case "$target_arch2" in
2360 1b0c87fc Juan Quintela
  i386|x86_64)
2361 1b0c87fc Juan Quintela
    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
2362 25be210f Juan Quintela
      echo "CONFIG_XEN=y" >> $config_target_mak
2363 1b0c87fc Juan Quintela
    fi
2364 1b0c87fc Juan Quintela
esac
2365 c59249f9 Juan Quintela
case "$target_arch2" in
2366 5f114bc6 Alexander Graf
  i386|x86_64|ppcemb|ppc|ppc64)
2367 c59249f9 Juan Quintela
    # Make sure the target and host cpus are compatible
2368 c59249f9 Juan Quintela
    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2369 c59249f9 Juan Quintela
      \( "$target_arch2" = "$cpu" -o \
2370 c59249f9 Juan Quintela
      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
2371 5f114bc6 Alexander Graf
      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
2372 c59249f9 Juan Quintela
      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
2373 c59249f9 Juan Quintela
      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
2374 25be210f Juan Quintela
      echo "CONFIG_KVM=y" >> $config_target_mak
2375 25be210f Juan Quintela
      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2376 c59249f9 Juan Quintela
    fi
2377 c59249f9 Juan Quintela
esac
2378 25be210f Juan Quintela
echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
2379 de83cd02 bellard
if test "$target_bigendian" = "yes" ; then
2380 25be210f Juan Quintela
  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
2381 de83cd02 bellard
fi
2382 97a847bc bellard
if test "$target_softmmu" = "yes" ; then
2383 25be210f Juan Quintela
  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
2384 25be210f Juan Quintela
  echo "LIBS+=$libs_softmmu" >> $config_target_mak
2385 25be210f Juan Quintela
  echo "HWLIB=../libhw$target_phys_bits/libqemuhw$target_phys_bits.a" >> $config_target_mak
2386 5791f45b Kirill A. Shutemov
  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2387 43ce4dfe bellard
fi
2388 997344f3 bellard
if test "$target_user_only" = "yes" ; then
2389 25be210f Juan Quintela
  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2390 997344f3 bellard
fi
2391 831b7825 ths
if test "$target_linux_user" = "yes" ; then
2392 25be210f Juan Quintela
  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2393 831b7825 ths
fi
2394 831b7825 ths
if test "$target_darwin_user" = "yes" ; then
2395 25be210f Juan Quintela
  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2396 831b7825 ths
fi
2397 56aebc89 pbrook
list=""
2398 56aebc89 pbrook
if test ! -z "$gdb_xml_files" ; then
2399 56aebc89 pbrook
  for x in $gdb_xml_files; do
2400 56aebc89 pbrook
    list="$list $source_path/gdb-xml/$x"
2401 56aebc89 pbrook
  done
2402 3d0f1517 Juan Quintela
  echo "TARGET_XML_FILES=$list" >> $config_target_mak
2403 56aebc89 pbrook
fi
2404 97a847bc bellard
2405 f57975fb Juan Quintela
case "$target_arch2" in
2406 f57975fb Juan Quintela
  arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
2407 25be210f Juan Quintela
    echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2408 f57975fb Juan Quintela
    ;;
2409 d6b38939 Juan Quintela
  *)
2410 25be210f Juan Quintela
    echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2411 d6b38939 Juan Quintela
    ;;
2412 f57975fb Juan Quintela
esac
2413 f57975fb Juan Quintela
2414 e5fe0c52 pbrook
if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
2415 25be210f Juan Quintela
  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2416 e5fe0c52 pbrook
fi
2417 bd0c5661 pbrook
if test "$target_user_only" = "yes" \
2418 bd0c5661 pbrook
        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
2419 25be210f Juan Quintela
  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2420 bd0c5661 pbrook
fi
2421 cb33da57 blueswir1
# 32 bit ELF loader in addition to native 64 bit loader?
2422 cb33da57 blueswir1
if test "$target_user_only" = "yes" -a "$elfload32" = "yes"; then
2423 25be210f Juan Quintela
  echo "TARGET_HAS_ELFLOAD32=y" >> $config_target_mak
2424 cb33da57 blueswir1
fi
2425 379f6698 Paul Brook
if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
2426 25be210f Juan Quintela
  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2427 379f6698 Paul Brook
fi
2428 84778508 blueswir1
if test "$target_bsd_user" = "yes" ; then
2429 25be210f Juan Quintela
  echo "CONFIG_BSD_USER=y" >> $config_target_mak
2430 84778508 blueswir1
fi
2431 5b0753e0 bellard
2432 4afddb55 Juan Quintela
# generate QEMU_CFLAGS/LDFLAGS for targets
2433 fa282484 Juan Quintela
2434 4afddb55 Juan Quintela
cflags=""
2435 fa282484 Juan Quintela
ldflags=""
2436 9b8e111f Juan Quintela
2437 57ddfbf7 Juan Quintela
if test "$ARCH" = "sparc64" ; then
2438 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
2439 57ddfbf7 Juan Quintela
else
2440 57ddfbf7 Juan Quintela
  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
2441 57ddfbf7 Juan Quintela
fi
2442 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/tcg $cflags"
2443 57ddfbf7 Juan Quintela
cflags="-I\$(SRC_PATH)/fpu $cflags"
2444 57ddfbf7 Juan Quintela
2445 64656024 Juan Quintela
for i in $ARCH $TARGET_BASE_ARCH ; do
2446 64656024 Juan Quintela
  case "$i" in
2447 64656024 Juan Quintela
  alpha)
2448 25be210f Juan Quintela
    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
2449 64656024 Juan Quintela
  ;;
2450 64656024 Juan Quintela
  arm)
2451 25be210f Juan Quintela
    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
2452 64656024 Juan Quintela
  ;;
2453 64656024 Juan Quintela
  cris)
2454 25be210f Juan Quintela
    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
2455 64656024 Juan Quintela
  ;;
2456 64656024 Juan Quintela
  hppa)
2457 25be210f Juan Quintela
    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
2458 64656024 Juan Quintela
  ;;
2459 64656024 Juan Quintela
  i386|x86_64)
2460 25be210f Juan Quintela
    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
2461 64656024 Juan Quintela
  ;;
2462 64656024 Juan Quintela
  m68k)
2463 25be210f Juan Quintela
    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
2464 64656024 Juan Quintela
  ;;
2465 64656024 Juan Quintela
  microblaze)
2466 25be210f Juan Quintela
    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
2467 64656024 Juan Quintela
  ;;
2468 64656024 Juan Quintela
  mips*)
2469 25be210f Juan Quintela
    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
2470 64656024 Juan Quintela
  ;;
2471 64656024 Juan Quintela
  ppc*)
2472 25be210f Juan Quintela
    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
2473 64656024 Juan Quintela
  ;;
2474 64656024 Juan Quintela
  s390)
2475 25be210f Juan Quintela
    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
2476 64656024 Juan Quintela
  ;;
2477 64656024 Juan Quintela
  sh4)
2478 25be210f Juan Quintela
    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
2479 64656024 Juan Quintela
  ;;
2480 64656024 Juan Quintela
  sparc*)
2481 25be210f Juan Quintela
    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
2482 64656024 Juan Quintela
  ;;
2483 64656024 Juan Quintela
  esac
2484 64656024 Juan Quintela
done
2485 64656024 Juan Quintela
2486 6ee7126f Juan Quintela
case "$ARCH" in
2487 6ee7126f Juan Quintela
alpha)
2488 6ee7126f Juan Quintela
  # Ensure there's only a single GP
2489 6ee7126f Juan Quintela
  cflags="-msmall-data $cflags"
2490 6ee7126f Juan Quintela
;;
2491 c60d0afa Juan Quintela
ia64)
2492 c60d0afa Juan Quintela
  cflags="-mno-sdata $cflags"
2493 c60d0afa Juan Quintela
;;
2494 6ee7126f Juan Quintela
esac
2495 6ee7126f Juan Quintela
2496 55d9c04b Juan Quintela
if test "$target_softmmu" = "yes" ; then
2497 55d9c04b Juan Quintela
  case "$TARGET_BASE_ARCH" in
2498 55d9c04b Juan Quintela
  arm)
2499 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO $cflags"
2500 55d9c04b Juan Quintela
  ;;
2501 55d9c04b Juan Quintela
  i386|mips|ppc)
2502 55d9c04b Juan Quintela
    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
2503 55d9c04b Juan Quintela
  ;;
2504 55d9c04b Juan Quintela
  esac
2505 55d9c04b Juan Quintela
fi
2506 55d9c04b Juan Quintela
2507 34005a00 Kirill A. Shutemov
if test "$target_user_only" = "yes" -a "$static" = "no" -a \
2508 50108930 Blue Swirl
	"$user_pie" = "yes" ; then
2509 34005a00 Kirill A. Shutemov
  cflags="-fpie $cflags"
2510 34005a00 Kirill A. Shutemov
  ldflags="-pie $ldflags"
2511 34005a00 Kirill A. Shutemov
fi
2512 34005a00 Kirill A. Shutemov
2513 471857dd Juan Quintela
if test "$target_softmmu" = "yes" -a \( \
2514 471857dd Juan Quintela
        "$TARGET_ARCH" = "microblaze" -o \
2515 471857dd Juan Quintela
        "$TARGET_ARCH" = "cris" \) ; then
2516 25be210f Juan Quintela
  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2517 471857dd Juan Quintela
fi
2518 471857dd Juan Quintela
2519 d02c1db3 Juan Quintela
if test "$gprof" = "yes" ; then
2520 25be210f Juan Quintela
  echo "TARGET_GPROF=yes" >> $config_target_mak
2521 d02c1db3 Juan Quintela
  if test "$target_linux_user" = "yes" ; then
2522 d02c1db3 Juan Quintela
    cflags="-p $cflags"
2523 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
2524 d02c1db3 Juan Quintela
  fi
2525 d02c1db3 Juan Quintela
  if test "$target_softmmu" = "yes" ; then
2526 d02c1db3 Juan Quintela
    ldflags="-p $ldflags"
2527 25be210f Juan Quintela
    echo "GPROF_CFLAGS=-p" >> $config_target_mak
2528 d02c1db3 Juan Quintela
  fi
2529 d02c1db3 Juan Quintela
fi
2530 d02c1db3 Juan Quintela
2531 6ee7126f Juan Quintela
linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
2532 9b8e111f Juan Quintela
if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2533 fa282484 Juan Quintela
  case "$ARCH" in
2534 fa282484 Juan Quintela
  sparc)
2535 fa282484 Juan Quintela
    # -static is used to avoid g1/g3 usage by the dynamic linker
2536 322e5878 Juan Quintela
    ldflags="$linker_script -static $ldflags"
2537 fa282484 Juan Quintela
    ;;
2538 fa282484 Juan Quintela
  ia64)
2539 322e5878 Juan Quintela
    ldflags="-Wl,-G0 $linker_script -static $ldflags"
2540 fa282484 Juan Quintela
    ;;
2541 df70204d Kirill A. Shutemov
  i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
2542 322e5878 Juan Quintela
    ldflags="$linker_script $ldflags"
2543 fa282484 Juan Quintela
    ;;
2544 fa282484 Juan Quintela
  esac
2545 fa282484 Juan Quintela
fi
2546 fa282484 Juan Quintela
if test "$target_softmmu" = "yes" ; then
2547 fa282484 Juan Quintela
  case "$ARCH" in
2548 fa282484 Juan Quintela
  ia64)
2549 322e5878 Juan Quintela
    ldflags="-Wl,-G0 $linker_script -static $ldflags"
2550 fa282484 Juan Quintela
    ;;
2551 fa282484 Juan Quintela
  esac
2552 fa282484 Juan Quintela
fi
2553 fa282484 Juan Quintela
2554 25be210f Juan Quintela
echo "LDFLAGS+=$ldflags" >> $config_target_mak
2555 25be210f Juan Quintela
echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2556 fa282484 Juan Quintela
2557 97a847bc bellard
done # for target in $targets
2558 7d13299d bellard
2559 7d13299d bellard
# build tree in object directory if source path is different from current one
2560 7d13299d bellard
if test "$source_path_used" = "yes" ; then
2561 e1144d00 Mark McLoughlin
    DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
2562 2d9f27d2 Anthony Liguori
    DIRS="$DIRS roms/seabios roms/vgabios"
2563 7d13299d bellard
    FILES="Makefile tests/Makefile"
2564 e7daa605 ths
    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2565 e1ffb0f1 edgar_igl
    FILES="$FILES tests/test-mmap.c"
2566 7ea78b74 Jan Kiszka
    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
2567 2d9f27d2 Anthony Liguori
    FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
2568 7ea78b74 Jan Kiszka
    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
2569 7ea78b74 Jan Kiszka
        FILES="$FILES pc-bios/`basename $bios_file`"
2570 7ea78b74 Jan Kiszka
    done
2571 7d13299d bellard
    for dir in $DIRS ; do
2572 7d13299d bellard
            mkdir -p $dir
2573 7d13299d bellard
    done
2574 ec530c81 bellard
    # remove the link and recreate it, as not all "ln -sf" overwrite the link
2575 7d13299d bellard
    for f in $FILES ; do
2576 ec530c81 bellard
        rm -f $f
2577 ec530c81 bellard
        ln -s $source_path/$f $f
2578 7d13299d bellard
    done
2579 7d13299d bellard
fi
2580 1ad2134f Paul Brook
2581 c34ebfdc Anthony Liguori
# temporary config to build submodules
2582 2d9f27d2 Anthony Liguori
for rom in seabios vgabios ; do
2583 c34ebfdc Anthony Liguori
    config_mak=roms/$rom/config.mak
2584 c34ebfdc Anthony Liguori
    echo "# Automatically generated by configure - do not modify" >> $config_mak
2585 c34ebfdc Anthony Liguori
    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2586 c34ebfdc Anthony Liguori
    echo "CC=$cc" >> $config_mak
2587 c34ebfdc Anthony Liguori
    echo "BCC=bcc" >> $config_mak
2588 c34ebfdc Anthony Liguori
    echo "CPP=${cross_prefix}cpp" >> $config_mak
2589 c34ebfdc Anthony Liguori
    echo "OBJCOPY=objcopy" >> $config_mak
2590 c34ebfdc Anthony Liguori
    echo "IASL=iasl" >> $config_mak
2591 c34ebfdc Anthony Liguori
    echo "HOST_CC=$host_cc" >> $config_mak
2592 c34ebfdc Anthony Liguori
    echo "LD=$ld" >> $config_mak
2593 c34ebfdc Anthony Liguori
done
2594 c34ebfdc Anthony Liguori
2595 1ad2134f Paul Brook
for hwlib in 32 64; do
2596 1ad2134f Paul Brook
  d=libhw$hwlib
2597 1ad2134f Paul Brook
  mkdir -p $d
2598 1ad2134f Paul Brook
  rm -f $d/Makefile
2599 1ad2134f Paul Brook
  ln -s $source_path/Makefile.hw $d/Makefile
2600 1ad2134f Paul Brook
  echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
2601 a558ee17 Juan Quintela
  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
2602 1ad2134f Paul Brook
done
2603 add16157 Blue Swirl
2604 add16157 Blue Swirl
d=libuser
2605 add16157 Blue Swirl
mkdir -p $d
2606 add16157 Blue Swirl
rm -f $d/Makefile
2607 add16157 Blue Swirl
ln -s $source_path/Makefile.user $d/Makefile