Statistics
| Branch: | Revision:

root / configure @ f4918804

History | View | Annotate | Download (66.1 kB)

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