Statistics
| Branch: | Revision:

root / configure @ a0f291fc

History | View | Annotate | Download (66.6 kB)

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