blob: b5dcfbde850b87419f11f1c347d761466a5eaf9e [file] [log] [blame]
bellard7d132992003-03-06 23:23:54 +00001#!/bin/sh
2#
bellard3ef693a2003-03-23 20:17:16 +00003# qemu configure script (c) 2003 Fabrice Bellard
bellard7d132992003-03-06 23:23:54 +00004#
5# set temporary file name
6if test ! -z "$TMPDIR" ; then
7 TMPDIR1="${TMPDIR}"
8elif test ! -z "$TEMPDIR" ; then
9 TMPDIR1="${TEMPDIR}"
10else
11 TMPDIR1="/tmp"
12fi
13
bellard3ef693a2003-03-23 20:17:16 +000014TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
Don Slutz66518bf2014-01-02 21:12:46 -050015TMPB="qemu-conf-${RANDOM}-$$-${RANDOM}"
16TMPO="${TMPDIR1}/${TMPB}.o"
Peter Maydell9c83ffd2014-02-25 18:27:49 +000017TMPCXX="${TMPDIR1}/${TMPB}.cxx"
Don Slutz66518bf2014-01-02 21:12:46 -050018TMPL="${TMPDIR1}/${TMPB}.lo"
19TMPA="${TMPDIR1}/lib${TMPB}.la"
malca91b8572009-10-15 01:57:14 +040020TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
bellard7d132992003-03-06 23:23:54 +000021
Loïc Minier0ba86812010-09-25 21:52:30 +020022# NB: do not call "exit" in the trap handler; this is buggy with some shells;
23# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
Peter Maydell9c83ffd2014-02-25 18:27:49 +000024trap "rm -f $TMPC $TMPO $TMPCXX $TMPE" EXIT INT QUIT TERM
Gerd Hoffmannda1d85e2010-04-23 13:44:10 +020025rm -f config.log
malc9ac81bb2008-11-29 20:09:56 +000026
Peter Maydellb48e3612011-11-23 17:26:44 +000027# Print a helpful header at the top of config.log
28echo "# QEMU configure log $(date)" >> config.log
Peter Maydell979ae162012-03-07 12:16:29 +000029printf "# Configured with:" >> config.log
30printf " '%s'" "$0" "$@" >> config.log
31echo >> config.log
Peter Maydellb48e3612011-11-23 17:26:44 +000032echo "#" >> config.log
33
Stefan Weilbdf523e2013-10-20 18:39:21 +020034# Save the configure command line for later reuse.
35cat <<EOD >config.status
36#!/bin/sh
37# Generated by configure.
38# Run this file to recreate the current configuration.
39# Compiler output produced by configure, useful for debugging
40# configure, is in config.log if it exists.
41EOD
42printf "exec" >>config.status
43printf " '%s'" "$0" "$@" >>config.status
44echo >>config.status
45chmod +x config.status
46
Peter Maydell76ad07a2013-04-08 12:11:26 +010047error_exit() {
48 echo
49 echo "ERROR: $1"
50 while test -n "$2"; do
51 echo " $2"
52 shift
53 done
54 echo
55 exit 1
56}
57
Peter Maydell9c83ffd2014-02-25 18:27:49 +000058do_compiler() {
59 # Run the compiler, capturing its output to the log. First argument
60 # is compiler binary to execute.
61 local compiler="$1"
62 shift
63 echo $compiler "$@" >> config.log
64 $compiler "$@" >> config.log 2>&1 || return $?
Peter Maydell8dc38a72012-07-18 15:10:28 +010065 # Test passed. If this is an --enable-werror build, rerun
66 # the test with -Werror and bail out if it fails. This
67 # makes warning-generating-errors in configure test code
68 # obvious to developers.
69 if test "$werror" != "yes"; then
70 return 0
71 fi
72 # Don't bother rerunning the compile if we were already using -Werror
73 case "$*" in
74 *-Werror*)
75 return 0
76 ;;
77 esac
Peter Maydell9c83ffd2014-02-25 18:27:49 +000078 echo $compiler -Werror "$@" >> config.log
79 $compiler -Werror "$@" >> config.log 2>&1 && return $?
Peter Maydell76ad07a2013-04-08 12:11:26 +010080 error_exit "configure test passed without -Werror but failed with -Werror." \
81 "This is probably a bug in the configure script. The failing command" \
82 "will be at the bottom of config.log." \
83 "You can run configure with --disable-werror to bypass this check."
Peter Maydell8dc38a72012-07-18 15:10:28 +010084}
85
Peter Maydell9c83ffd2014-02-25 18:27:49 +000086do_cc() {
87 do_compiler "$cc" "$@"
88}
89
90do_cxx() {
91 do_compiler "$cxx" "$@"
92}
93
94update_cxxflags() {
95 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
96 # options which some versions of GCC's C++ compiler complain about
97 # because they only make sense for C programs.
98 QEMU_CXXFLAGS=
99 for arg in $QEMU_CFLAGS; do
100 case $arg in
101 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
102 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
103 ;;
104 *)
105 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
106 ;;
107 esac
108 done
109}
110
Juan Quintela52166aa2009-08-03 14:46:03 +0200111compile_object() {
Peter Maydell8dc38a72012-07-18 15:10:28 +0100112 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
Juan Quintela52166aa2009-08-03 14:46:03 +0200113}
114
115compile_prog() {
116 local_cflags="$1"
117 local_ldflags="$2"
Peter Maydell8dc38a72012-07-18 15:10:28 +0100118 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
Juan Quintela52166aa2009-08-03 14:46:03 +0200119}
120
Don Slutz66518bf2014-01-02 21:12:46 -0500121do_libtool() {
122 local mode=$1
123 shift
124 # Run the compiler, capturing its output to the log.
125 echo $libtool $mode --tag=CC $cc "$@" >> config.log
126 $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
127 # Test passed. If this is an --enable-werror build, rerun
128 # the test with -Werror and bail out if it fails. This
129 # makes warning-generating-errors in configure test code
130 # obvious to developers.
131 if test "$werror" != "yes"; then
132 return 0
133 fi
134 # Don't bother rerunning the compile if we were already using -Werror
135 case "$*" in
136 *-Werror*)
137 return 0
138 ;;
139 esac
140 echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
141 $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
142 error_exit "configure test passed without -Werror but failed with -Werror." \
143 "This is probably a bug in the configure script. The failing command" \
144 "will be at the bottom of config.log." \
145 "You can run configure with --disable-werror to bypass this check."
146}
147
148libtool_prog() {
149 do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
150 do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
151}
152
Paolo Bonzini11568d62010-12-23 11:43:58 +0100153# symbolically link $1 to $2. Portable version of "ln -sf".
154symlink() {
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100155 rm -rf "$2"
Anthony Liguoriec5b06d2012-06-06 16:57:00 +0800156 mkdir -p "$(dirname "$2")"
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100157 ln -s "$1" "$2"
Paolo Bonzini11568d62010-12-23 11:43:58 +0100158}
159
Loïc Minier0dba6192010-01-28 21:26:51 +0000160# check whether a command is available to this shell (may be either an
161# executable or a builtin)
162has() {
163 type "$1" >/dev/null 2>&1
164}
165
166# search for an executable in PATH
167path_of() {
168 local_command="$1"
169 local_ifs="$IFS"
170 local_dir=""
171
172 # pathname has a dir component?
173 if [ "${local_command#*/}" != "$local_command" ]; then
174 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
175 echo "$local_command"
176 return 0
177 fi
178 fi
179 if [ -z "$local_command" ]; then
180 return 1
181 fi
182
183 IFS=:
184 for local_dir in $PATH; do
185 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
186 echo "$local_dir/$local_command"
187 IFS="${local_ifs:-$(printf ' \t\n')}"
188 return 0
189 fi
190 done
191 # not found
192 IFS="${local_ifs:-$(printf ' \t\n')}"
193 return 1
194}
195
bellard7d132992003-03-06 23:23:54 +0000196# default parameters
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100197source_path=`dirname "$0"`
Juan Quintela2ff6b912009-08-03 14:45:55 +0200198cpu=""
Michael S. Tsirkina31a8642013-07-24 18:56:03 +0300199iasl="iasl"
bellard1e43adf2003-09-30 20:54:24 +0000200interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +0000201static="no"
bellard7d132992003-03-06 23:23:54 +0000202cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +0000203audio_drv_list=""
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800204block_drv_rw_whitelist=""
205block_drv_ro_whitelist=""
Peter Maydelle49d0212012-12-07 15:39:13 +0000206host_cc="cc"
Juan Quintela73da3752009-08-03 14:46:26 +0200207libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200208libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +0200209audio_pt_int=""
malcd5631632009-10-10 01:13:41 +0400210audio_win_int=""
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200211cc_i386=i386-pc-linux-gnu-gcc
Michael Roth957f1f92011-08-11 15:38:12 -0500212libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100213debug_info="yes"
aliguoriac0df512008-12-29 17:14:15 +0000214
Stefan Weilafb63eb2012-09-26 22:04:38 +0200215# Don't accept a target_list environment variable.
216unset target_list
Paolo Bonzini377529c2010-12-23 11:43:50 +0100217
218# Default value for a variable defining feature "foo".
219# * foo="no" feature will only be used if --enable-foo arg is given
220# * foo="" feature will be searched for, and if found, will be used
221# unless --disable-foo is given
222# * foo="yes" this value will only be set by --enable-foo flag.
223# feature will searched for,
224# if not found, configure exits with error
225#
226# Always add --enable-foo and --disable-foo command line args.
227# Distributions want to ensure that several features are compiled in, and it
228# is impossible without a --enable-foo that exits if a feature is not found.
229
230bluez=""
231brlapi=""
232curl=""
233curses=""
234docs=""
235fdt=""
Vincenzo Maffione58952132013-11-06 11:44:06 +0100236netmap="no"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200237pixman=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100238sdl=""
Meador Inge983eef52012-02-24 14:00:42 +0530239virtfs=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100240vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100241sparse="no"
242uuid=""
243vde=""
244vnc_tls=""
245vnc_sasl=""
246vnc_jpeg=""
247vnc_png=""
Tim Hardeck7536ee42013-01-21 11:04:44 +0100248vnc_ws=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100249xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000250xen_ctrl_version=""
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000251xen_pci_passthrough=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100252linux_aio=""
Corey Bryant47e98652012-01-26 09:42:26 -0500253cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100254attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200255libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100256xfs=""
257
Bradd41a75a2011-07-26 23:11:26 -0400258vhost_net="no"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000259vhost_scsi="no"
Bradd41a75a2011-07-26 23:11:26 -0400260kvm="no"
Michael R. Hines2da776d2013-07-22 10:01:54 -0400261rdma=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100262gprof="no"
263debug_tcg="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100264debug="no"
265strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200266tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100267bigendian="no"
268mingw32="no"
Blue Swirl1d728c32012-05-01 18:45:39 +0000269gcov="no"
270gcov_tool="gcov"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100271EXESUF=""
Fam Zheng17969262014-02-10 14:48:56 +0800272DSOSUF=".so"
273LDFLAGS_SHARED="-shared"
274modules="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100275prefix="/usr/local"
276mandir="\${prefix}/share/man"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300277datadir="\${prefix}/share"
Eduardo Habkost850da182012-04-18 16:55:38 -0300278qemu_docdir="\${prefix}/share/doc/qemu"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100279bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300280libdir="\${prefix}/lib"
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400281libexecdir="\${prefix}/libexec"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200282includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100283sysconfdir="\${prefix}/etc"
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300284local_statedir="\${prefix}/var"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100285confsuffix="/qemu"
286slirp="yes"
287fmod_lib=""
288fmod_inc=""
289oss_lib=""
290bsd="no"
291linux="no"
292solaris="no"
293profiler="no"
294cocoa="no"
295softmmu="yes"
296linux_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100297bsd_user="no"
Peter Maydell30163d82012-10-09 03:16:49 +0000298guest_base="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100299uname_release=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100300aix="no"
301blobs="yes"
302pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200303pie=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100304zero_malloc=""
Paolo Bonzini3556c232013-05-10 14:16:40 +0200305qom_cast_debug="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100306trace_backend="nop"
307trace_file="trace"
308spice=""
309rbd=""
Robert Relyea111a38b2010-11-28 16:36:38 +0200310smartcard_nss=""
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100311libusb=""
Hans de Goede69354a82011-07-19 11:04:10 +0200312usb_redir=""
Michael Walleb1e5fff2013-03-06 20:23:32 +0100313glx=""
Alon Levy1ece9902011-07-26 12:30:40 +0300314zlib="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +0800315lzo="no"
316snappy="no"
Michael Tokareve8ef31a2013-07-31 14:22:07 +0400317guest_agent=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400318guest_agent_with_vss="no"
319vss_win32_sdk=""
320win_sdk="no"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +0100321want_tools="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100322libiscsi=""
Peter Lieven6542aa92014-02-03 10:26:13 +0100323libnfs=""
Alex Barcelo519175a2012-02-28 12:25:50 +0100324coroutine=""
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200325coroutine_pool=""
Eduardo Otubof7945732012-08-14 18:44:05 -0300326seccomp=""
Bharata B Raoeb100392012-09-24 14:42:45 +0530327glusterfs=""
Bharata B Rao0c14fb42013-07-16 21:47:42 +0530328glusterfs_discard="no"
Bharata B Rao7c815372013-12-21 14:51:25 +0530329glusterfs_zerofill="no"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +0100330virtio_blk_data_plane=""
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600331gtk=""
Daniel P. Berrange528de902013-02-25 15:20:44 +0000332gtkabi="2.0"
Stefan Bergerab214c22013-02-27 12:47:52 -0500333tpm="no"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +0100334libssh2=""
Jeff Cody4f18b782013-10-30 10:44:39 -0400335vhdx=""
Benoît Canet95c6bff2014-02-21 22:21:15 +0100336quorum="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100337
aliguoriac0df512008-12-29 17:14:15 +0000338# parse CC options first
339for opt do
340 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
341 case "$opt" in
342 --cross-prefix=*) cross_prefix="$optarg"
343 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100344 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000345 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400346 --cxx=*) CXX="$optarg"
347 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100348 --source-path=*) source_path="$optarg"
349 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200350 --cpu=*) cpu="$optarg"
351 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200352 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100353 EXTRA_CFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200354 ;;
355 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100356 EXTRA_LDFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200357 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100358 --enable-debug-info) debug_info="yes"
359 ;;
360 --disable-debug-info) debug_info="no"
361 ;;
aliguoriac0df512008-12-29 17:14:15 +0000362 esac
363done
aliguoriac0df512008-12-29 17:14:15 +0000364# OS specific
365# Using uname is really, really broken. Once we have the right set of checks
Stefan Weil93148aa2012-02-26 18:46:12 +0100366# we can eliminate its usage altogether.
aliguoriac0df512008-12-29 17:14:15 +0000367
Peter Maydelle49d0212012-12-07 15:39:13 +0000368# Preferred compiler:
369# ${CC} (if set)
370# ${cross_prefix}gcc (if cross-prefix specified)
371# system compiler
372if test -z "${CC}${cross_prefix}"; then
373 cc="$host_cc"
374else
375 cc="${CC-${cross_prefix}gcc}"
376fi
377
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400378if test -z "${CXX}${cross_prefix}"; then
379 cxx="c++"
380else
381 cxx="${CXX-${cross_prefix}g++}"
382fi
383
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500384ar="${AR-${cross_prefix}ar}"
Blue Swirl3dd46c72013-01-05 10:10:27 +0000385as="${AS-${cross_prefix}as}"
386cpp="${CPP-$cc -E}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500387objcopy="${OBJCOPY-${cross_prefix}objcopy}"
388ld="${LD-${cross_prefix}ld}"
Brad3f534582011-08-13 20:30:14 -0400389libtool="${LIBTOOL-${cross_prefix}libtool}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500390strip="${STRIP-${cross_prefix}strip}"
391windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300392pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
393query_pkg_config() {
394 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
395}
396pkg_config=query_pkg_config
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500397sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
aliguoriac0df512008-12-29 17:14:15 +0000398
Peter Maydell45d285a2013-10-21 21:03:06 +0100399# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
400ARFLAGS="${ARFLAGS-rv}"
401
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200402# default flags for all hosts
403QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400404QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Kevin Wolfc95e3082013-02-22 21:08:51 +0100405QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200406QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Paolo Bonzini6b4c3052012-10-24 13:12:00 +0200407QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100408if test "$debug_info" = "yes"; then
409 CFLAGS="-g $CFLAGS"
410 LDFLAGS="-g $LDFLAGS"
411fi
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200412
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100413# make source path absolute
414source_path=`cd "$source_path"; pwd`
415
aliguoriac0df512008-12-29 17:14:15 +0000416check_define() {
417cat > $TMPC <<EOF
418#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000419#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000420#endif
421int main(void) { return 0; }
422EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200423 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000424}
425
Peter Maydellbbea4052012-08-14 15:35:34 +0100426if check_define __linux__ ; then
427 targetos="Linux"
428elif check_define _WIN32 ; then
429 targetos='MINGW32'
430elif check_define __OpenBSD__ ; then
431 targetos='OpenBSD'
432elif check_define __sun__ ; then
433 targetos='SunOS'
434elif check_define __HAIKU__ ; then
435 targetos='Haiku'
436else
437 targetos=`uname -s`
438fi
439
440# Some host OSes need non-standard checks for which CPU to use.
441# Note that these checks are broken for cross-compilation: if you're
442# cross-compiling to one of these OSes then you'll need to specify
443# the correct CPU with the --cpu option.
444case $targetos in
445Darwin)
446 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
447 # run 64-bit userspace code.
448 # If the user didn't specify a CPU explicitly and the kernel says this is
449 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
450 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
451 cpu="x86_64"
452 fi
453 ;;
454SunOS)
455 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
456 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
457 cpu="x86_64"
458 fi
459esac
460
Juan Quintela2ff6b912009-08-03 14:45:55 +0200461if test ! -z "$cpu" ; then
462 # command line argument
463 :
464elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000465 cpu="i386"
466elif check_define __x86_64__ ; then
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700467 if check_define __ILP32__ ; then
468 cpu="x32"
469 else
470 cpu="x86_64"
471 fi
blueswir13aa9bd62008-12-31 16:55:26 +0000472elif check_define __sparc__ ; then
blueswir13aa9bd62008-12-31 16:55:26 +0000473 if check_define __arch64__ ; then
474 cpu="sparc64"
475 else
476 cpu="sparc"
477 fi
malcfdf7ed92009-01-14 18:39:52 +0000478elif check_define _ARCH_PPC ; then
479 if check_define _ARCH_PPC64 ; then
480 cpu="ppc64"
481 else
482 cpu="ppc"
483 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200484elif check_define __mips__ ; then
485 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200486elif check_define __ia64__ ; then
487 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200488elif check_define __s390__ ; then
489 if check_define __s390x__ ; then
490 cpu="s390x"
491 else
492 cpu="s390"
493 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100494elif check_define __arm__ ; then
495 cpu="arm"
Claudio Fontana1f080312013-06-12 16:20:23 +0100496elif check_define __aarch64__ ; then
497 cpu="aarch64"
Bradf28ffed2011-09-07 21:24:56 -0400498elif check_define __hppa__ ; then
499 cpu="hppa"
aliguoriac0df512008-12-29 17:14:15 +0000500else
malcfdf7ed92009-01-14 18:39:52 +0000501 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000502fi
503
Peter Maydell359bc952011-12-24 13:07:25 +0000504ARCH=
505# Normalise host CPU name and set ARCH.
506# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000507case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700508 ia64|ppc|ppc64|s390|s390x|sparc64|x32)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200509 cpu="$cpu"
510 ;;
bellard7d132992003-03-06 23:23:54 +0000511 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000512 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000513 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000514 x86_64|amd64)
515 cpu="x86_64"
516 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100517 armv*b|armv*l|arm)
518 cpu="arm"
bellard7d132992003-03-06 23:23:54 +0000519 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +0100520 aarch64)
521 cpu="aarch64"
522 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200523 mips*)
524 cpu="mips"
525 ;;
blueswir131422552007-04-16 18:27:06 +0000526 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000527 cpu="sparc"
528 ;;
bellard7d132992003-03-06 23:23:54 +0000529 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000530 # This will result in either an error or falling back to TCI later
531 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000532 ;;
533esac
Peter Maydell359bc952011-12-24 13:07:25 +0000534if test -z "$ARCH"; then
535 ARCH="$cpu"
536fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200537
bellard7d132992003-03-06 23:23:54 +0000538# OS specific
Juan Quintela0dbfc672009-08-03 14:46:13 +0200539
bellard7d132992003-03-06 23:23:54 +0000540case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000541CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200542 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200543 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400544 audio_possible_drivers="winwave sdl"
545 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000546;;
bellard67b915a2004-03-31 23:37:16 +0000547MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200548 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400549 audio_possible_drivers="winwave dsound sdl fmod"
550 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000551;;
ths5c40d2b2007-06-23 16:03:36 +0000552GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100553 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200554 audio_drv_list="oss"
555 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000556;;
bellard7d3505c2004-05-12 19:32:15 +0000557FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200558 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100559 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200560 audio_drv_list="oss"
561 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100562 # needed for kinfo_getvmmap(3) in libutil.h
563 LIBS="-lutil $LIBS"
Vincenzo Maffione58952132013-11-06 11:44:06 +0100564 netmap="" # enable netmap autodetect
bellard7d3505c2004-05-12 19:32:15 +0000565;;
blueswir1c5e97232009-03-07 20:06:23 +0000566DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200567 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100568 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200569 audio_drv_list="oss"
570 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000571;;
bellard7d3505c2004-05-12 19:32:15 +0000572NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200573 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100574 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200575 audio_drv_list="oss"
576 audio_possible_drivers="oss sdl esd"
577 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000578;;
579OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200580 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100581 make="${MAKE-gmake}"
Brad Smith4f6ab392013-05-24 19:01:07 -0400582 audio_drv_list="sdl"
583 audio_possible_drivers="sdl esd"
bellard7d3505c2004-05-12 19:32:15 +0000584;;
bellard83fb7ad2004-07-05 21:25:26 +0000585Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200586 bsd="yes"
587 darwin="yes"
Fam Zheng17969262014-02-10 14:48:56 +0800588 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200589 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200590 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200591 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200592 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200593 cocoa="yes"
594 audio_drv_list="coreaudio"
595 audio_possible_drivers="coreaudio sdl fmod"
596 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200597 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
Peter Maydella0b7cf62012-08-11 22:34:39 +0100598 # Disable attempts to use ObjectiveC features in os/object.h since they
599 # won't work when we're compiling with gcc as a C compiler.
600 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
bellard83fb7ad2004-07-05 21:25:26 +0000601;;
bellardec530c82006-04-25 22:36:06 +0000602SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200603 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100604 make="${MAKE-gmake}"
605 install="${INSTALL-ginstall}"
Blue Swirlfa589482009-10-02 19:38:25 +0000606 ld="gld"
Brade2d88302011-09-02 16:53:28 -0400607 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200608 needs_libsunmath="no"
609 solarisrev=`uname -r | cut -f2 -d.`
Juan Quintela0dbfc672009-08-03 14:46:13 +0200610 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
611 if test "$solarisrev" -le 9 ; then
612 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
613 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200614 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
615 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
616 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200617 else
Peter Maydell76ad07a2013-04-08 12:11:26 +0100618 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
619 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
620 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
621 "Studio 11 can be downloaded from www.sun.com."
Juan Quintela0dbfc672009-08-03 14:46:13 +0200622 fi
thsef18c882007-09-16 22:12:39 +0000623 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200624 fi
625 if test -f /usr/include/sys/soundcard.h ; then
626 audio_drv_list="oss"
627 fi
628 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000629# needed for CMSG_ macros in sys/socket.h
630 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
631# needed for TIOCWIN* defines in termios.h
632 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200633 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Andreas Färber560d3752012-04-30 18:00:55 +0200634 solarisnetlibs="-lsocket -lnsl -lresolv"
635 LIBS="$solarisnetlibs $LIBS"
636 libs_qga="$solarisnetlibs $libs_qga"
ths86b2bd92007-02-11 00:31:33 +0000637;;
malcb29fe3e2008-11-18 01:42:22 +0000638AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200639 aix="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100640 make="${MAKE-gmake}"
malcb29fe3e2008-11-18 01:42:22 +0000641;;
Andreas Färber179cf402010-09-20 00:50:43 +0200642Haiku)
643 haiku="yes"
644 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
645 LIBS="-lposix_error_mapper -lnetwork $LIBS"
646;;
bellard1d14ffa2005-10-30 18:58:22 +0000647*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200648 audio_drv_list="oss"
649 audio_possible_drivers="oss alsa sdl esd pa"
650 linux="yes"
651 linux_user="yes"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200652 kvm="yes"
653 vhost_net="yes"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000654 vhost_scsi="yes"
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700655 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000656 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200657 fi
Alexey Kardashevskiya5851402013-05-29 23:30:43 +1000658 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
bellardfb065182004-11-09 23:09:44 +0000659;;
bellard7d132992003-03-06 23:23:54 +0000660esac
661
bellard7d3505c2004-05-12 19:32:15 +0000662if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000663 if [ "$darwin" != "yes" ] ; then
Andreas Färber08de3942012-04-26 11:57:39 +0200664 bsd_user="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000665 fi
bellard7d3505c2004-05-12 19:32:15 +0000666fi
667
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100668: ${make=${MAKE-make}}
669: ${install=${INSTALL-install}}
Stefan Weil52510f82013-11-14 19:07:03 +0100670: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400671: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100672
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100673# Default objcc to clang if available, otherwise use CC
674if has clang; then
675 objcc=clang
676else
677 objcc="$cc"
678fi
679
Juan Quintela3457a3f2009-08-03 14:46:07 +0200680if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200681 EXESUF=".exe"
Fam Zheng17969262014-02-10 14:48:56 +0800682 DSOSUF=".dll"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200683 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100684 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
685 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100686 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
687cat > $TMPC << EOF
688int main(void) { return 0; }
689EOF
690 if compile_prog "" "-liberty" ; then
691 LIBS="-liberty $LIBS"
692 fi
Stefan Weilc5ec15e2012-04-07 09:23:38 +0200693 prefix="c:/Program Files/QEMU"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200694 mandir="\${prefix}"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300695 datadir="\${prefix}"
Eduardo Habkost850da182012-04-18 16:55:38 -0300696 qemu_docdir="\${prefix}"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200697 bindir="\${prefix}"
698 sysconfdir="\${prefix}"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +0200699 local_statedir=
Paolo Bonzini683035d2010-05-26 16:08:28 +0200700 confsuffix=""
Stefan Hajnoczi368542b2012-03-27 08:26:18 +0100701 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200702fi
703
Anthony Liguori487fefd2009-06-11 13:28:25 -0500704werror=""
bellard85aa5182007-11-11 20:17:03 +0000705
bellard7d132992003-03-06 23:23:54 +0000706for opt do
pbrooka46e4032006-04-29 23:05:22 +0000707 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000708 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000709 --help|-h) show_help=yes
710 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400711 --version|-V) exec cat $source_path/VERSION
712 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000713 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000714 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000715 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000716 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100717 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000718 ;;
aliguoriac0df512008-12-29 17:14:15 +0000719 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000720 ;;
aliguoriac0df512008-12-29 17:14:15 +0000721 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000722 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000723 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000724 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400725 --cxx=*)
726 ;;
Michael S. Tsirkine007dbe2013-11-24 11:38:05 +0200727 --iasl=*) iasl="$optarg"
728 ;;
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100729 --objcc=*) objcc="$optarg"
730 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000731 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000732 ;;
pbrook6a882642006-04-17 13:57:12 +0000733 --install=*) install="$optarg"
734 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000735 --python=*) python="$optarg"
736 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000737 --gcov=*) gcov_tool="$optarg"
738 ;;
Brade2d88302011-09-02 16:53:28 -0400739 --smbd=*) smbd="$optarg"
740 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200741 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000742 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200743 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000744 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100745 --enable-debug-info)
746 ;;
747 --disable-debug-info)
748 ;;
Fam Zheng17969262014-02-10 14:48:56 +0800749 --enable-modules)
750 modules="yes"
751 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200752 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000753 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000754 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000755 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100756 --enable-trace-backend=*) trace_backend="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100757 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100758 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100759 ;;
bellard7d132992003-03-06 23:23:54 +0000760 --enable-gprof) gprof="yes"
761 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000762 --enable-gcov) gcov="yes"
763 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100764 --static)
765 static="yes"
766 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300767 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000768 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200769 --mandir=*) mandir="$optarg"
770 ;;
771 --bindir=*) bindir="$optarg"
772 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300773 --libdir=*) libdir="$optarg"
774 ;;
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400775 --libexecdir=*) libexecdir="$optarg"
776 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200777 --includedir=*) includedir="$optarg"
778 ;;
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300779 --datadir=*) datadir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200780 ;;
Eduardo Habkost023d3d62012-04-18 16:55:50 -0300781 --with-confsuffix=*) confsuffix="$optarg"
782 ;;
Eduardo Habkost850da182012-04-18 16:55:38 -0300783 --docdir=*) qemu_docdir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200784 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100785 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600786 ;;
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300787 --localstatedir=*) local_statedir="$optarg"
788 ;;
789 --sbindir=*|--sharedstatedir=*|\
Max Filippov023ddd72011-11-24 16:11:31 +0400790 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
791 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
792 # These switches are silently ignored, for compatibility with
793 # autoconf-generated configure scripts. This allows QEMU's
794 # configure to be used by RPM and similar macros that set
795 # lots of directory switches by default.
796 ;;
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200797 --with-system-pixman) pixman="system"
798 ;;
799 --without-system-pixman) pixman="internal"
800 ;;
Robert Schiele74880fe2012-12-04 16:58:08 +0100801 --without-pixman) pixman="none"
802 ;;
bellard97a847b2003-08-10 21:36:04 +0000803 --disable-sdl) sdl="no"
804 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200805 --enable-sdl) sdl="yes"
806 ;;
Paolo Bonzini3556c232013-05-10 14:16:40 +0200807 --disable-qom-cast-debug) qom_cast_debug="no"
808 ;;
809 --enable-qom-cast-debug) qom_cast_debug="yes"
810 ;;
Meador Inge983eef52012-02-24 14:00:42 +0530811 --disable-virtfs) virtfs="no"
812 ;;
813 --enable-virtfs) virtfs="yes"
814 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +0100815 --disable-vnc) vnc="no"
816 ;;
817 --enable-vnc) vnc="yes"
818 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000819 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000820 ;;
malcc2de5c92008-06-28 19:13:06 +0000821 --fmod-inc=*) fmod_inc="$optarg"
822 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000823 --oss-lib=*) oss_lib="$optarg"
824 ;;
malc0c58ac12008-06-25 21:04:05 +0000825 --audio-drv-list=*) audio_drv_list="$optarg"
826 ;;
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800827 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
828 ;;
829 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
Markus Armbrustereb852012009-10-27 18:41:44 +0100830 ;;
aurel32f8393942009-04-13 18:45:38 +0000831 --enable-debug-tcg) debug_tcg="yes"
832 ;;
833 --disable-debug-tcg) debug_tcg="no"
834 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100835 --enable-debug)
836 # Enable debugging options that aren't excessively noisy
837 debug_tcg="yes"
838 debug="yes"
839 strip_opt="no"
840 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000841 --enable-sparse) sparse="yes"
842 ;;
843 --disable-sparse) sparse="no"
844 ;;
aliguori1625af82009-04-05 17:41:02 +0000845 --disable-strip) strip_opt="no"
846 ;;
ths8d5d2d42007-08-25 01:37:51 +0000847 --disable-vnc-tls) vnc_tls="no"
848 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200849 --enable-vnc-tls) vnc_tls="yes"
850 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000851 --disable-vnc-sasl) vnc_sasl="no"
852 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200853 --enable-vnc-sasl) vnc_sasl="yes"
854 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200855 --disable-vnc-jpeg) vnc_jpeg="no"
856 ;;
857 --enable-vnc-jpeg) vnc_jpeg="yes"
858 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200859 --disable-vnc-png) vnc_png="no"
860 ;;
861 --enable-vnc-png) vnc_png="yes"
862 ;;
Tim Hardeck7536ee42013-01-21 11:04:44 +0100863 --disable-vnc-ws) vnc_ws="no"
864 ;;
865 --enable-vnc-ws) vnc_ws="yes"
866 ;;
bellard443f1372004-06-04 11:13:20 +0000867 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000868 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200869 --disable-uuid) uuid="no"
870 ;;
871 --enable-uuid) uuid="yes"
872 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000873 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000874 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200875 --enable-vde) vde="yes"
876 ;;
Vincenzo Maffione58952132013-11-06 11:44:06 +0100877 --disable-netmap) netmap="no"
878 ;;
879 --enable-netmap) netmap="yes"
880 ;;
aliguorie37630c2009-04-22 15:19:10 +0000881 --disable-xen) xen="no"
882 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200883 --enable-xen) xen="yes"
884 ;;
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000885 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
886 ;;
887 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
888 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000889 --disable-brlapi) brlapi="no"
890 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200891 --enable-brlapi) brlapi="yes"
892 ;;
balrogfb599c92008-09-28 23:49:55 +0000893 --disable-bluez) bluez="no"
894 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200895 --enable-bluez) bluez="yes"
896 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000897 --disable-kvm) kvm="no"
898 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200899 --enable-kvm) kvm="yes"
900 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +0200901 --disable-tcg-interpreter) tcg_interpreter="no"
902 ;;
903 --enable-tcg-interpreter) tcg_interpreter="yes"
904 ;;
Corey Bryant47e98652012-01-26 09:42:26 -0500905 --disable-cap-ng) cap_ng="no"
906 ;;
907 --enable-cap-ng) cap_ng="yes"
908 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100909 --disable-spice) spice="no"
910 ;;
911 --enable-spice) spice="yes"
912 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100913 --disable-libiscsi) libiscsi="no"
914 ;;
915 --enable-libiscsi) libiscsi="yes"
916 ;;
Peter Lieven6542aa92014-02-03 10:26:13 +0100917 --disable-libnfs) libnfs="no"
918 ;;
919 --enable-libnfs) libnfs="yes"
920 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000921 --enable-profiler) profiler="yes"
922 ;;
Pavel Borzenkov14821032011-11-10 22:40:07 +0400923 --disable-cocoa) cocoa="no"
924 ;;
malcc2de5c92008-06-28 19:13:06 +0000925 --enable-cocoa)
926 cocoa="yes" ;
927 sdl="no" ;
928 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000929 ;;
pbrookcad25d62006-03-19 16:31:11 +0000930 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000931 ;;
pbrookcad25d62006-03-19 16:31:11 +0000932 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000933 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000934 --disable-user)
935 linux_user="no" ;
936 bsd_user="no" ;
Zachary Amsden0953a802009-07-30 00:14:59 -1000937 ;;
938 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000939 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000940 ;;
ths831b7822007-01-18 20:06:33 +0000941 --enable-linux-user) linux_user="yes"
942 ;;
blueswir184778502008-10-26 20:33:16 +0000943 --disable-bsd-user) bsd_user="no"
944 ;;
945 --enable-bsd-user) bsd_user="yes"
946 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100947 --enable-guest-base) guest_base="yes"
948 ;;
949 --disable-guest-base) guest_base="no"
950 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200951 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300952 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200953 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300954 ;;
pbrookc5937222006-05-14 11:30:38 +0000955 --enable-uname-release=*) uname_release="$optarg"
956 ;;
bellard85aa5182007-11-11 20:17:03 +0000957 --enable-werror) werror="yes"
958 ;;
959 --disable-werror) werror="no"
960 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000961 --disable-curses) curses="no"
962 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200963 --enable-curses) curses="yes"
964 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200965 --disable-curl) curl="no"
966 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200967 --enable-curl) curl="yes"
968 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200969 --disable-fdt) fdt="no"
970 ;;
971 --enable-fdt) fdt="yes"
972 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200973 --disable-linux-aio) linux_aio="no"
974 ;;
975 --enable-linux-aio) linux_aio="yes"
976 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700977 --disable-attr) attr="no"
978 ;;
979 --enable-attr) attr="yes"
980 ;;
ths77755342008-11-27 15:45:16 +0000981 --disable-blobs) blobs="no"
982 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000983 --with-pkgversion=*) pkgversion=" ($optarg)"
984 ;;
Alex Barcelo519175a2012-02-28 12:25:50 +0100985 --with-coroutine=*) coroutine="$optarg"
986 ;;
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200987 --disable-coroutine-pool) coroutine_pool="no"
988 ;;
989 --enable-coroutine-pool) coroutine_pool="yes"
990 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200991 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500992 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200993 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200994 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200995 --disable-vhost-net) vhost_net="no"
996 ;;
997 --enable-vhost-net) vhost_net="yes"
998 ;;
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000999 --disable-vhost-scsi) vhost_scsi="no"
1000 ;;
1001 --enable-vhost-scsi) vhost_scsi="yes"
1002 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +01001003 --disable-glx) glx="no"
Michael Walle20ff0752011-03-07 23:32:39 +01001004 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +01001005 --enable-glx) glx="yes"
Michael Walle20ff0752011-03-07 23:32:39 +01001006 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +01001007 --disable-rbd) rbd="no"
1008 ;;
1009 --enable-rbd) rbd="yes"
1010 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +03001011 --disable-xfsctl) xfs="no"
1012 ;;
1013 --enable-xfsctl) xfs="yes"
1014 ;;
Robert Relyea111a38b2010-11-28 16:36:38 +02001015 --disable-smartcard-nss) smartcard_nss="no"
1016 ;;
1017 --enable-smartcard-nss) smartcard_nss="yes"
1018 ;;
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01001019 --disable-libusb) libusb="no"
1020 ;;
1021 --enable-libusb) libusb="yes"
1022 ;;
Hans de Goede69354a82011-07-19 11:04:10 +02001023 --disable-usb-redir) usb_redir="no"
1024 ;;
1025 --enable-usb-redir) usb_redir="yes"
1026 ;;
Alon Levy1ece9902011-07-26 12:30:40 +03001027 --disable-zlib-test) zlib="no"
1028 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001029 --enable-lzo) lzo="yes"
1030 ;;
1031 --enable-snappy) snappy="yes"
1032 ;;
Michael Rothd138cee2011-08-01 14:52:57 -05001033 --enable-guest-agent) guest_agent="yes"
1034 ;;
1035 --disable-guest-agent) guest_agent="no"
1036 ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04001037 --with-vss-sdk) vss_win32_sdk=""
1038 ;;
1039 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1040 ;;
1041 --without-vss-sdk) vss_win32_sdk="no"
1042 ;;
1043 --with-win-sdk) win_sdk=""
1044 ;;
1045 --with-win-sdk=*) win_sdk="$optarg"
1046 ;;
1047 --without-win-sdk) win_sdk="no"
1048 ;;
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01001049 --enable-tools) want_tools="yes"
1050 ;;
1051 --disable-tools) want_tools="no"
1052 ;;
Eduardo Otubof7945732012-08-14 18:44:05 -03001053 --enable-seccomp) seccomp="yes"
1054 ;;
1055 --disable-seccomp) seccomp="no"
1056 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +05301057 --disable-glusterfs) glusterfs="no"
1058 ;;
1059 --enable-glusterfs) glusterfs="yes"
1060 ;;
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01001061 --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
1062 ;;
1063 --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
1064 ;;
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001065 --disable-gtk) gtk="no"
1066 ;;
1067 --enable-gtk) gtk="yes"
1068 ;;
Michael R. Hines2da776d2013-07-22 10:01:54 -04001069 --enable-rdma) rdma="yes"
1070 ;;
1071 --disable-rdma) rdma="no"
1072 ;;
Daniel P. Berrange528de902013-02-25 15:20:44 +00001073 --with-gtkabi=*) gtkabi="$optarg"
1074 ;;
Stefan Bergerab214c22013-02-27 12:47:52 -05001075 --enable-tpm) tpm="yes"
1076 ;;
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001077 --disable-libssh2) libssh2="no"
1078 ;;
1079 --enable-libssh2) libssh2="yes"
1080 ;;
Jeff Cody4f18b782013-10-30 10:44:39 -04001081 --enable-vhdx) vhdx="yes"
1082 ;;
1083 --disable-vhdx) vhdx="no"
1084 ;;
Benoît Canet95c6bff2014-02-21 22:21:15 +01001085 --disable-quorum) quorum="no"
1086 ;;
1087 --enable-quorum) quorum="yes"
1088 ;;
balrog7f1559c2007-11-17 10:24:32 +00001089 *) echo "ERROR: unknown option $opt"; show_help="yes"
1090 ;;
bellard7d132992003-03-06 23:23:54 +00001091 esac
1092done
1093
Stefan Weilf6f0b7d2013-12-18 22:30:26 +01001094if ! has $python; then
1095 error_exit "Python not found. Use --python=/path/to/python"
1096fi
1097
1098# Note that if the Python conditional here evaluates True we will exit
1099# with status 1 which is a shell 'false' value.
1100if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1101 error_exit "Cannot use '$python', Python 2.4 or later is required." \
1102 "Note that Python 3 or later is not yet supported." \
1103 "Use --python=/path/to/python to specify a supported Python."
1104fi
1105
1106# The -B switch was added in Python 2.6.
1107# If it is supplied, compiled files are not written.
1108# Use it for Python versions which support it.
1109if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1110 python="$python -B"
1111fi
1112
bellard40293e52008-01-31 11:32:10 +00001113case "$cpu" in
Richard Hendersone3608d62013-08-28 15:48:21 -07001114 ppc)
1115 CPU_CFLAGS="-m32"
1116 LDFLAGS="-m32 $LDFLAGS"
1117 ;;
1118 ppc64)
1119 CPU_CFLAGS="-m64"
1120 LDFLAGS="-m64 $LDFLAGS"
1121 ;;
Richard Henderson9b9c37c2012-09-21 10:34:21 -07001122 sparc)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001123 LDFLAGS="-m32 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001124 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001125 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +02001126 sparc64)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001127 LDFLAGS="-m64 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001128 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001129 ;;
ths76d83bd2007-11-18 21:22:10 +00001130 s390)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001131 CPU_CFLAGS="-m31 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001132 LDFLAGS="-m31 $LDFLAGS"
1133 ;;
1134 s390x)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001135 CPU_CFLAGS="-m64 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001136 LDFLAGS="-m64 $LDFLAGS"
ths76d83bd2007-11-18 21:22:10 +00001137 ;;
bellard40293e52008-01-31 11:32:10 +00001138 i386)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001139 CPU_CFLAGS="-m32"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001140 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001141 cc_i386='$(CC) -m32'
bellard40293e52008-01-31 11:32:10 +00001142 ;;
1143 x86_64)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001144 CPU_CFLAGS="-m64"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001145 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001146 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +01001147 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001148 x32)
1149 CPU_CFLAGS="-mx32"
1150 LDFLAGS="-mx32 $LDFLAGS"
1151 cc_i386='$(CC) -m32'
1152 ;;
Peter Maydell30163d82012-10-09 03:16:49 +00001153 # No special flags required for other host CPUs
blueswir131422552007-04-16 18:27:06 +00001154esac
1155
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001156QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1157EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1158
Peter Maydell60e0df22011-05-03 14:50:13 +01001159default_target_list=""
1160
Peter Maydell6e92f822013-05-20 16:16:15 +01001161mak_wilds=""
1162
1163if [ "$softmmu" = "yes" ]; then
1164 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001165fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001166if [ "$linux_user" = "yes" ]; then
1167 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001168fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001169if [ "$bsd_user" = "yes" ]; then
1170 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001171fi
1172
Peter Maydell6e92f822013-05-20 16:16:15 +01001173for config in $mak_wilds; do
1174 default_target_list="${default_target_list} $(basename "$config" .mak)"
1175done
1176
pbrookaf5db582006-04-08 14:26:41 +00001177if test x"$show_help" = x"yes" ; then
1178cat << EOF
1179
1180Usage: configure [options]
1181Options: [defaults in brackets after descriptions]
1182
Stefan Weil08fb77e2013-12-18 22:09:39 +01001183Standard options:
1184 --help print this message
1185 --prefix=PREFIX install in PREFIX [$prefix]
1186 --interp-prefix=PREFIX where to find shared libraries, etc.
1187 use %M for cpu name [$interp_prefix]
1188 --target-list=LIST set target list (default: build everything)
1189$(echo Available targets: $default_target_list | \
1190 fold -s -w 53 | sed -e 's/^/ /')
1191
1192Advanced options (experts only):
1193 --source-path=PATH path of source code [$source_path]
1194 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1195 --cc=CC use C compiler CC [$cc]
1196 --iasl=IASL use ACPI compiler IASL [$iasl]
1197 --host-cc=CC use C compiler CC [$host_cc] for code run at
1198 build time
1199 --cxx=CXX use C++ compiler CXX [$cxx]
1200 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1201 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1202 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1203 --make=MAKE use specified make [$make]
1204 --install=INSTALL use specified install [$install]
1205 --python=PYTHON use specified python [$python]
1206 --smbd=SMBD use specified smbd [$smbd]
1207 --static enable static build [$static]
1208 --mandir=PATH install man pages in PATH
1209 --datadir=PATH install firmware in PATH$confsuffix
1210 --docdir=PATH install documentation in PATH$confsuffix
1211 --bindir=PATH install binaries in PATH
1212 --libdir=PATH install libraries in PATH
1213 --sysconfdir=PATH install config in PATH$confsuffix
1214 --localstatedir=PATH install local state in PATH (set at runtime on win32)
Fam Zhenge26110c2014-02-10 14:48:57 +08001215 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
Fam Zheng17969262014-02-10 14:48:56 +08001216 --enable-modules enable modules support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001217 --enable-debug-tcg enable TCG debugging
1218 --disable-debug-tcg disable TCG debugging (default)
1219 --enable-debug-info enable debugging information (default)
1220 --disable-debug-info disable debugging information
1221 --enable-debug enable common debug build options
1222 --enable-sparse enable sparse checker
1223 --disable-sparse disable sparse checker (default)
1224 --disable-strip disable stripping binaries
1225 --disable-werror disable compilation abort on warning
1226 --disable-sdl disable SDL
1227 --enable-sdl enable SDL
1228 --disable-gtk disable gtk UI
1229 --enable-gtk enable gtk UI
1230 --disable-virtfs disable VirtFS
1231 --enable-virtfs enable VirtFS
1232 --disable-vnc disable VNC
1233 --enable-vnc enable VNC
1234 --disable-cocoa disable Cocoa (Mac OS X only)
1235 --enable-cocoa enable Cocoa (default on Mac OS X)
1236 --audio-drv-list=LIST set audio drivers list:
1237 Available drivers: $audio_possible_drivers
1238 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1239 --block-drv-rw-whitelist=L
1240 set block driver read-write whitelist
1241 (affects only QEMU, not qemu-img)
1242 --block-drv-ro-whitelist=L
1243 set block driver read-only whitelist
1244 (affects only QEMU, not qemu-img)
1245 --disable-xen disable xen backend driver support
1246 --enable-xen enable xen backend driver support
1247 --disable-xen-pci-passthrough
1248 --enable-xen-pci-passthrough
1249 --disable-brlapi disable BrlAPI
1250 --enable-brlapi enable BrlAPI
1251 --disable-vnc-tls disable TLS encryption for VNC server
1252 --enable-vnc-tls enable TLS encryption for VNC server
1253 --disable-vnc-sasl disable SASL encryption for VNC server
1254 --enable-vnc-sasl enable SASL encryption for VNC server
1255 --disable-vnc-jpeg disable JPEG lossy compression for VNC server
1256 --enable-vnc-jpeg enable JPEG lossy compression for VNC server
1257 --disable-vnc-png disable PNG compression for VNC server (default)
1258 --enable-vnc-png enable PNG compression for VNC server
1259 --disable-vnc-ws disable Websockets support for VNC server
1260 --enable-vnc-ws enable Websockets support for VNC server
1261 --disable-curses disable curses output
1262 --enable-curses enable curses output
1263 --disable-curl disable curl connectivity
1264 --enable-curl enable curl connectivity
1265 --disable-fdt disable fdt device tree
1266 --enable-fdt enable fdt device tree
1267 --disable-bluez disable bluez stack connectivity
1268 --enable-bluez enable bluez stack connectivity
1269 --disable-slirp disable SLIRP userspace network connectivity
1270 --disable-kvm disable KVM acceleration support
1271 --enable-kvm enable KVM acceleration support
1272 --disable-rdma disable RDMA-based migration support
1273 --enable-rdma enable RDMA-based migration support
1274 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1275 --enable-system enable all system emulation targets
1276 --disable-system disable all system emulation targets
1277 --enable-user enable supported user emulation targets
1278 --disable-user disable all user emulation targets
1279 --enable-linux-user enable all linux usermode emulation targets
1280 --disable-linux-user disable all linux usermode emulation targets
1281 --enable-bsd-user enable all BSD usermode emulation targets
1282 --disable-bsd-user disable all BSD usermode emulation targets
1283 --enable-guest-base enable GUEST_BASE support for usermode
1284 emulation targets
1285 --disable-guest-base disable GUEST_BASE support
1286 --enable-pie build Position Independent Executables
1287 --disable-pie do not build Position Independent Executables
1288 --fmod-lib path to FMOD library
1289 --fmod-inc path to FMOD includes
1290 --oss-lib path to OSS library
1291 --enable-uname-release=R Return R for uname -r in usermode emulation
1292 --cpu=CPU Build for host CPU [$cpu]
1293 --disable-uuid disable uuid support
1294 --enable-uuid enable uuid support
1295 --disable-vde disable support for vde network
1296 --enable-vde enable support for vde network
1297 --disable-netmap disable support for netmap network
1298 --enable-netmap enable support for netmap network
1299 --disable-linux-aio disable Linux AIO support
1300 --enable-linux-aio enable Linux AIO support
1301 --disable-cap-ng disable libcap-ng support
1302 --enable-cap-ng enable libcap-ng support
1303 --disable-attr disables attr and xattr support
1304 --enable-attr enable attr and xattr support
1305 --disable-blobs disable installing provided firmware blobs
1306 --enable-docs enable documentation build
1307 --disable-docs disable documentation build
1308 --disable-vhost-net disable vhost-net acceleration support
1309 --enable-vhost-net enable vhost-net acceleration support
1310 --enable-trace-backend=B Set trace backend
1311 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1312 --with-trace-file=NAME Full PATH,NAME of file to store traces
1313 Default:trace-<pid>
1314 --disable-spice disable spice
1315 --enable-spice enable spice
1316 --enable-rbd enable building the rados block device (rbd)
1317 --disable-libiscsi disable iscsi support
1318 --enable-libiscsi enable iscsi support
Peter Lieven6542aa92014-02-03 10:26:13 +01001319 --disable-libnfs disable nfs support
1320 --enable-libnfs enable nfs support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001321 --disable-smartcard-nss disable smartcard nss support
1322 --enable-smartcard-nss enable smartcard nss support
1323 --disable-libusb disable libusb (for usb passthrough)
1324 --enable-libusb enable libusb (for usb passthrough)
1325 --disable-usb-redir disable usb network redirection support
1326 --enable-usb-redir enable usb network redirection support
qiaonuohan607dacd2014-02-18 14:11:30 +08001327 --enable-lzo enable the support of lzo compression library
1328 --enable-snappy enable the support of snappy compression library
Stefan Weil08fb77e2013-12-18 22:09:39 +01001329 --disable-guest-agent disable building of the QEMU Guest Agent
1330 --enable-guest-agent enable building of the QEMU Guest Agent
1331 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1332 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1333 --disable-seccomp disable seccomp support
1334 --enable-seccomp enables seccomp support
1335 --with-coroutine=BACKEND coroutine backend. Supported options:
1336 gthread, ucontext, sigaltstack, windows
1337 --disable-coroutine-pool disable coroutine freelist (worse performance)
1338 --enable-coroutine-pool enable coroutine freelist (better performance)
1339 --enable-glusterfs enable GlusterFS backend
1340 --disable-glusterfs disable GlusterFS backend
1341 --enable-gcov enable test coverage analysis with gcov
1342 --gcov=GCOV use specified gcov [$gcov_tool]
1343 --enable-tpm enable TPM support
1344 --disable-libssh2 disable ssh block device support
1345 --enable-libssh2 enable ssh block device support
1346 --disable-vhdx disables support for the Microsoft VHDX image format
1347 --enable-vhdx enable support for the Microsoft VHDX image format
Benoît Canet95c6bff2014-02-21 22:21:15 +01001348 --disable-quorum disable quorum block filter support
1349 --enable-quorum enable quorum block filter support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001350
1351NOTE: The object files are built at the place where configure is launched
pbrookaf5db582006-04-08 14:26:41 +00001352EOF
pbrookaf5db582006-04-08 14:26:41 +00001353exit 1
1354fi
1355
Peter Maydell359bc952011-12-24 13:07:25 +00001356# Now we have handled --enable-tcg-interpreter and know we're not just
1357# printing the help message, bail out if the host CPU isn't supported.
1358if test "$ARCH" = "unknown"; then
1359 if test "$tcg_interpreter" = "yes" ; then
1360 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1361 ARCH=tci
1362 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001363 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
Peter Maydell359bc952011-12-24 13:07:25 +00001364 fi
1365fi
1366
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001367# Consult white-list to determine whether to enable werror
1368# by default. Only enable by default for git builds
1369z_version=`cut -f3 -d. $source_path/VERSION`
1370
1371if test -z "$werror" ; then
1372 if test -d "$source_path/.git" -a \
1373 "$linux" = "yes" ; then
1374 werror="yes"
1375 else
1376 werror="no"
1377 fi
1378fi
1379
Paolo Bonzini8d050952010-12-23 11:43:52 +01001380# check that the C compiler works.
1381cat > $TMPC <<EOF
Stefan Weil75cafad2011-12-17 09:27:29 +01001382int main(void) { return 0; }
Paolo Bonzini8d050952010-12-23 11:43:52 +01001383EOF
1384
1385if compile_object ; then
1386 : C compiler works ok
1387else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001388 error_exit "\"$cc\" either does not exist or does not work"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001389fi
1390
Peter Maydell98b21dc2014-02-20 15:10:16 +00001391# Check that the C++ compiler exists and works with the C compiler
1392if has $cxx; then
1393 cat > $TMPC <<EOF
1394int c_function(void);
1395int main(void) { return c_function(); }
1396EOF
1397
1398 compile_object
1399
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001400 cat > $TMPCXX <<EOF
Peter Maydell98b21dc2014-02-20 15:10:16 +00001401extern "C" {
1402 int c_function(void);
1403}
1404int c_function(void) { return 42; }
1405EOF
1406
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001407 update_cxxflags
1408
1409 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
Peter Maydell98b21dc2014-02-20 15:10:16 +00001410 # C++ compiler $cxx works ok with C compiler $cc
1411 :
1412 else
1413 echo "C++ compiler $cxx does not work with C compiler $cc"
1414 echo "Disabling C++ specific optional code"
1415 cxx=
1416 fi
1417else
1418 echo "No C++ compiler available; disabling C++ specific optional code"
1419 cxx=
1420fi
1421
Paolo Bonzini8d050952010-12-23 11:43:52 +01001422gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1423gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1424gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Marc-André Lureau37746c52013-02-25 23:31:12 +01001425gcc_flags="-Wendif-labels $gcc_flags"
Peter Maydellc1556a82012-10-14 21:00:39 +01001426gcc_flags="-Wno-initializer-overrides $gcc_flags"
Peter Maydell71429092013-08-05 20:16:40 +01001427gcc_flags="-Wno-string-plus-int $gcc_flags"
Peter Maydell6ca026c2012-07-18 15:10:18 +01001428# Note that we do not add -Werror to gcc_flags here, because that would
1429# enable it for all configure tests. If a configure test failed due
1430# to -Werror this would just silently disable some features,
1431# so it's too error prone.
Paolo Bonzini8d050952010-12-23 11:43:52 +01001432cat > $TMPC << EOF
1433int main(void) { return 0; }
1434EOF
1435for flag in $gcc_flags; do
Peter Maydella1d29d62012-10-27 22:19:07 +01001436 # Use the positive sense of the flag when testing for -Wno-wombat
1437 # support (gcc will happily accept the -Wno- form of unknown
1438 # warning options).
1439 optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1440 if compile_prog "-Werror $optflag" "" ; then
Paolo Bonzini8d050952010-12-23 11:43:52 +01001441 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1442 fi
1443done
1444
Marc-André Lureau37746c52013-02-25 23:31:12 +01001445if compile_prog "-Werror -fstack-protector-all" "" ; then
1446 QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
1447 LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
1448fi
1449
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01001450# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1451# large functions that use global variables. The bug is in all releases of
1452# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1453# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1454cat > $TMPC << EOF
1455#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1456int main(void) { return 0; }
1457#else
1458#error No bug in this compiler.
1459#endif
1460EOF
1461if compile_prog "-Werror -fno-gcse" "" ; then
1462 TRANSLATE_OPT_CFLAGS=-fno-gcse
1463fi
1464
Avi Kivity40d64442011-11-15 20:12:17 +02001465if test "$static" = "yes" ; then
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01001466 if test "$modules" = "yes" ; then
1467 error_exit "static and modules are mutually incompatible"
1468 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001469 if test "$pie" = "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001470 error_exit "static and pie are mutually incompatible"
Avi Kivity40d64442011-11-15 20:12:17 +02001471 else
1472 pie="no"
1473 fi
1474fi
1475
1476if test "$pie" = ""; then
1477 case "$cpu-$targetos" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001478 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02001479 ;;
1480 *)
1481 pie="no"
1482 ;;
1483 esac
1484fi
1485
1486if test "$pie" != "no" ; then
1487 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02001488
1489#ifdef __linux__
1490# define THREAD __thread
1491#else
1492# define THREAD
1493#endif
1494
1495static THREAD int tls_var;
1496
1497int main(void) { return tls_var; }
1498
Avi Kivity40d64442011-11-15 20:12:17 +02001499EOF
1500 if compile_prog "-fPIE -DPIE" "-pie"; then
1501 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1502 LDFLAGS="-pie $LDFLAGS"
1503 pie="yes"
1504 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1505 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1506 fi
1507 else
1508 if test "$pie" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001509 error_exit "PIE not available due to missing toolchain support"
Avi Kivity40d64442011-11-15 20:12:17 +02001510 else
1511 echo "Disabling PIE due to missing toolchain support"
1512 pie="no"
1513 fi
1514 fi
Brad46eef332013-12-10 19:49:08 -05001515
1516 if compile_prog "-fno-pie" "-nopie"; then
1517 CFLAGS_NOPIE="-fno-pie"
1518 LDFLAGS_NOPIE="-nopie"
1519 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001520fi
1521
Don Slutz66518bf2014-01-02 21:12:46 -05001522# check for broken gcc and libtool in RHEL5
1523if test -n "$libtool" -a "$pie" != "no" ; then
1524 cat > $TMPC <<EOF
1525
1526void *f(unsigned char *buf, int len);
1527void *g(unsigned char *buf, int len);
1528
1529void *
1530f(unsigned char *buf, int len)
1531{
1532 return (void*)0L;
1533}
1534
1535void *
1536g(unsigned char *buf, int len)
1537{
1538 return f(buf, len);
1539}
1540
1541EOF
1542 if ! libtool_prog; then
1543 echo "Disabling libtool due to broken toolchain support"
1544 libtool=
1545 fi
1546fi
1547
Paolo Bonzini09dada42013-04-17 16:26:47 +02001548##########################################
1549# __sync_fetch_and_and requires at least -march=i486. Many toolchains
1550# use i686 as default anyway, but for those that don't, an explicit
1551# specification is necessary
1552
1553if test "$cpu" = "i386"; then
1554 cat > $TMPC << EOF
1555static int sfaa(int *ptr)
1556{
1557 return __sync_fetch_and_and(ptr, 0);
1558}
1559
1560int main(void)
1561{
1562 int val = 42;
Stefan Weil1405b622013-05-11 21:46:58 +02001563 val = __sync_val_compare_and_swap(&val, 0, 1);
Paolo Bonzini09dada42013-04-17 16:26:47 +02001564 sfaa(&val);
1565 return val;
1566}
1567EOF
1568 if ! compile_prog "" "" ; then
1569 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1570 fi
1571fi
1572
1573#########################################
bellardec530c82006-04-25 22:36:06 +00001574# Solaris specific configure tool chain decisions
Paolo Bonzini09dada42013-04-17 16:26:47 +02001575
bellardec530c82006-04-25 22:36:06 +00001576if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001577 if has $install; then
1578 :
1579 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001580 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1581 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1582 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
bellardec530c82006-04-25 22:36:06 +00001583 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001584 if test "`path_of $install`" = "/usr/sbin/install" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001585 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1586 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1587 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
bellardec530c82006-04-25 22:36:06 +00001588 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001589 if has ar; then
1590 :
1591 else
bellardec530c82006-04-25 22:36:06 +00001592 if test -f /usr/ccs/bin/ar ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001593 error_exit "No path includes ar" \
1594 "Add /usr/ccs/bin to your path and rerun configure"
bellardec530c82006-04-25 22:36:06 +00001595 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001596 error_exit "No path includes ar"
bellardec530c82006-04-25 22:36:06 +00001597 fi
ths5fafdf22007-09-16 21:08:06 +00001598fi
bellardec530c82006-04-25 22:36:06 +00001599
Stefan Weilafb63eb2012-09-26 22:04:38 +02001600if test -z "${target_list+xxx}" ; then
Anthony Liguori121afa92012-09-14 08:17:03 -05001601 target_list="$default_target_list"
1602else
1603 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001604fi
Peter Maydell25b48332013-05-20 16:16:16 +01001605
1606# Check that we recognised the target name; this allows a more
1607# friendly error message than if we let it fall through.
1608for target in $target_list; do
1609 case " $default_target_list " in
1610 *" $target "*)
1611 ;;
1612 *)
1613 error_exit "Unknown target name '$target'"
1614 ;;
1615 esac
1616done
1617
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001618# see if system emulation was really requested
1619case " $target_list " in
1620 *"-softmmu "*) softmmu=yes
1621 ;;
1622 *) softmmu=no
1623 ;;
1624esac
bellard5327cf42005-01-10 23:18:50 +00001625
Juan Quintela249247c2009-08-12 18:20:25 +02001626feature_not_found() {
1627 feature=$1
Stewart Smith21684af2014-01-24 12:39:10 +11001628 remedy=$2
Juan Quintela249247c2009-08-12 18:20:25 +02001629
Peter Maydell76ad07a2013-04-08 12:11:26 +01001630 error_exit "User requested feature $feature" \
Stewart Smith21684af2014-01-24 12:39:10 +11001631 "configure was not able to find it." \
1632 "$remedy"
Juan Quintela249247c2009-08-12 18:20:25 +02001633}
1634
bellard7d132992003-03-06 23:23:54 +00001635# ---
1636# big/little endian test
1637cat > $TMPC << EOF
Mike Frysinger61cc9192013-06-30 23:30:18 -04001638short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1639short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1640extern int foo(short *, short *);
1641int main(int argc, char *argv[]) {
1642 return foo(big_endian, little_endian);
bellard7d132992003-03-06 23:23:54 +00001643}
1644EOF
1645
Mike Frysinger61cc9192013-06-30 23:30:18 -04001646if compile_object ; then
1647 if grep -q BiGeNdIaN $TMPO ; then
1648 bigendian="yes"
1649 elif grep -q LiTtLeEnDiAn $TMPO ; then
1650 bigendian="no"
1651 else
1652 echo big/little test failed
Peter Maydell21d89f82011-11-30 10:57:48 +01001653 fi
Mike Frysinger61cc9192013-06-30 23:30:18 -04001654else
1655 echo big/little test failed
bellard7d132992003-03-06 23:23:54 +00001656fi
1657
Juan Quintelab0a47e72009-08-12 18:29:49 +02001658##########################################
Stefan Weil779ab5e2012-12-16 11:29:45 +01001659# pkg-config probe
1660
1661if ! has "$pkg_config_exe"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001662 error_exit "pkg-config binary '$pkg_config_exe' not found"
Stefan Weil779ab5e2012-12-16 11:29:45 +01001663fi
1664
1665##########################################
Juan Quintelab0a47e72009-08-12 18:29:49 +02001666# NPTL probe
1667
Peter Maydell24cb36a2013-07-16 18:45:00 +01001668if test "$linux_user" = "yes"; then
Juan Quintelab0a47e72009-08-12 18:29:49 +02001669 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001670#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001671#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01001672int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00001673#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1674#error bork
1675#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01001676 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00001677}
1678EOF
Peter Maydell24cb36a2013-07-16 18:45:00 +01001679 if ! compile_object ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001680 feature_not_found "nptl" "Install glibc and linux kernel headers."
Juan Quintelab0a47e72009-08-12 18:29:49 +02001681 fi
pbrookbd0c5662008-05-29 14:34:11 +00001682fi
1683
bellard11d9f692004-04-02 20:55:59 +00001684##########################################
balrogac629222008-10-11 09:56:04 +00001685# zlib check
1686
Alon Levy1ece9902011-07-26 12:30:40 +03001687if test "$zlib" != "no" ; then
1688 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00001689#include <zlib.h>
1690int main(void) { zlibVersion(); return 0; }
1691EOF
Alon Levy1ece9902011-07-26 12:30:40 +03001692 if compile_prog "" "-lz" ; then
1693 :
1694 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001695 error_exit "zlib check failed" \
1696 "Make sure to have the zlib libs and headers installed."
Alon Levy1ece9902011-07-26 12:30:40 +03001697 fi
balrogac629222008-10-11 09:56:04 +00001698fi
Will Newtoneb0ecd52014-02-26 17:20:07 +00001699LIBS="$LIBS -lz"
balrogac629222008-10-11 09:56:04 +00001700
1701##########################################
qiaonuohan607dacd2014-02-18 14:11:30 +08001702# lzo check
1703
1704if test "$lzo" != "no" ; then
1705 cat > $TMPC << EOF
1706#include <lzo/lzo1x.h>
1707int main(void) { lzo_version(); return 0; }
1708EOF
1709 if compile_prog "" "-llzo2" ; then
1710 :
1711 else
1712 error_exit "lzo check failed" \
1713 "Make sure to have the lzo libs and headers installed."
1714 fi
1715
1716 libs_softmmu="$libs_softmmu -llzo2"
1717fi
1718
1719##########################################
1720# snappy check
1721
1722if test "$snappy" != "no" ; then
1723 cat > $TMPC << EOF
1724#include <snappy-c.h>
1725int main(void) { snappy_max_compressed_length(4096); return 0; }
1726EOF
1727 if compile_prog "" "-lsnappy" ; then
1728 :
1729 else
1730 error_exit "snappy check failed" \
1731 "Make sure to have the snappy libs and headers installed."
1732 fi
1733
1734 libs_softmmu="$libs_softmmu -lsnappy"
1735fi
1736
1737##########################################
Eduardo Otubof7945732012-08-14 18:44:05 -03001738# libseccomp check
1739
1740if test "$seccomp" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02001741 if $pkg_config --atleast-version=2.1.0 libseccomp; then
Michael Tokarevb4451992013-01-19 18:58:09 +04001742 libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
Andreas Färber372e47e2013-04-28 16:27:26 +02001743 QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
Eduardo Otubof7945732012-08-14 18:44:05 -03001744 seccomp="yes"
1745 else
Eduardo Otubof7945732012-08-14 18:44:05 -03001746 if test "$seccomp" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11001747 feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
Eduardo Otubof7945732012-08-14 18:44:05 -03001748 fi
Yann E. MORINe84d5952012-09-06 22:40:30 +02001749 seccomp="no"
Eduardo Otubof7945732012-08-14 18:44:05 -03001750 fi
1751fi
1752##########################################
aliguorie37630c2009-04-22 15:19:10 +00001753# xen probe
1754
Juan Quintelafc321b42009-08-12 18:29:55 +02001755if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001756 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001757
Stefan Weil50ced5b2011-12-17 09:27:39 +01001758 # First we test whether Xen headers and libraries are available.
1759 # If no, we are done and there is no Xen support.
1760 # If yes, more tests are run to detect the Xen version.
1761
1762 # Xen (any)
Juan Quintelab2266be2009-07-27 16:13:16 +02001763 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001764#include <xenctrl.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01001765int main(void) {
1766 return 0;
1767}
1768EOF
1769 if ! compile_prog "" "$xen_libs" ; then
1770 # Xen not found
1771 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001772 feature_not_found "xen" "Install xen devel"
Stefan Weil50ced5b2011-12-17 09:27:39 +01001773 fi
1774 xen=no
1775
1776 # Xen unstable
Peter Maydell69deef02012-08-02 18:30:26 +01001777 elif
1778 cat > $TMPC <<EOF &&
Stefan Weil50ced5b2011-12-17 09:27:39 +01001779#include <xenctrl.h>
Anthony PERARDe108a3c2012-06-21 11:44:35 +00001780#include <xenstore.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001781#include <stdint.h>
1782#include <xen/hvm/hvm_info_table.h>
1783#if !defined(HVM_MAX_VCPUS)
1784# error HVM_MAX_VCPUS not defined
1785#endif
1786int main(void) {
1787 xc_interface *xc;
1788 xs_daemon_open();
1789 xc = xc_interface_open(0, 0, 0);
1790 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1791 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001792 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001793 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1794 return 0;
1795}
1796EOF
1797 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001798 then
Stefano Stabellini8688e062012-04-17 17:04:18 +00001799 xen_ctrl_version=420
1800 xen=yes
1801
Peter Maydell69deef02012-08-02 18:30:26 +01001802 elif
1803 cat > $TMPC <<EOF &&
Stefano Stabellini8688e062012-04-17 17:04:18 +00001804#include <xenctrl.h>
1805#include <xs.h>
1806#include <stdint.h>
1807#include <xen/hvm/hvm_info_table.h>
1808#if !defined(HVM_MAX_VCPUS)
1809# error HVM_MAX_VCPUS not defined
1810#endif
1811int main(void) {
Stefano Stabellini8688e062012-04-17 17:04:18 +00001812 xs_daemon_open();
Peter Maydell9b4c0b52012-08-02 18:30:27 +01001813 xc_interface_open(0, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001814 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1815 xc_gnttab_open(NULL, 0);
1816 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001817 return 0;
1818}
aliguorie37630c2009-04-22 15:19:10 +00001819EOF
Stefan Weil50ced5b2011-12-17 09:27:39 +01001820 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001821 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001822 xen_ctrl_version=410
Juan Quintelafc321b42009-08-12 18:29:55 +02001823 xen=yes
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001824
1825 # Xen 4.0.0
Peter Maydell69deef02012-08-02 18:30:26 +01001826 elif
1827 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001828#include <xenctrl.h>
1829#include <xs.h>
1830#include <stdint.h>
1831#include <xen/hvm/hvm_info_table.h>
1832#if !defined(HVM_MAX_VCPUS)
1833# error HVM_MAX_VCPUS not defined
1834#endif
1835int main(void) {
Anthony PERARDb87de242011-05-24 14:34:20 +01001836 struct xen_add_to_physmap xatp = {
1837 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1838 };
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001839 xs_daemon_open();
1840 xc_interface_open();
1841 xc_gnttab_open();
1842 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001843 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001844 return 0;
1845}
1846EOF
1847 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001848 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001849 xen_ctrl_version=400
1850 xen=yes
1851
Anthony PERARDb87de242011-05-24 14:34:20 +01001852 # Xen 3.4.0
Peter Maydell69deef02012-08-02 18:30:26 +01001853 elif
1854 cat > $TMPC <<EOF &&
Anthony PERARDb87de242011-05-24 14:34:20 +01001855#include <xenctrl.h>
1856#include <xs.h>
1857int main(void) {
1858 struct xen_add_to_physmap xatp = {
1859 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1860 };
1861 xs_daemon_open();
1862 xc_interface_open();
1863 xc_gnttab_open();
1864 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1865 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1866 return 0;
1867}
1868EOF
1869 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001870 then
Anthony PERARDb87de242011-05-24 14:34:20 +01001871 xen_ctrl_version=340
1872 xen=yes
1873
1874 # Xen 3.3.0
Peter Maydell69deef02012-08-02 18:30:26 +01001875 elif
1876 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001877#include <xenctrl.h>
1878#include <xs.h>
1879int main(void) {
1880 xs_daemon_open();
1881 xc_interface_open();
1882 xc_gnttab_open();
1883 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1884 return 0;
1885}
1886EOF
1887 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001888 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001889 xen_ctrl_version=330
1890 xen=yes
1891
Stefan Weil50ced5b2011-12-17 09:27:39 +01001892 # Xen version unsupported
Juan Quintelab2266be2009-07-27 16:13:16 +02001893 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001894 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001895 feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
Juan Quintelafc321b42009-08-12 18:29:55 +02001896 fi
1897 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001898 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001899
1900 if test "$xen" = yes; then
1901 libs_softmmu="$xen_libs $libs_softmmu"
1902 fi
aliguorie37630c2009-04-22 15:19:10 +00001903fi
1904
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001905if test "$xen_pci_passthrough" != "no"; then
1906 if test "$xen" = "yes" && test "$linux" = "yes" &&
1907 test "$xen_ctrl_version" -ge 340; then
1908 xen_pci_passthrough=yes
1909 else
1910 if test "$xen_pci_passthrough" = "yes"; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001911 if test "$xen_ctrl_version" -lt 340; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001912 error_exit "User requested feature Xen PCI Passthrough" \
1913 "This feature does not work with Xen 3.3"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001914 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001915 error_exit "User requested feature Xen PCI Passthrough" \
1916 " but this feature requires /sys from Linux"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001917 fi
1918 xen_pci_passthrough=no
1919 fi
1920fi
1921
aliguorie37630c2009-04-22 15:19:10 +00001922##########################################
Alon Levy44dc0ca2011-05-15 11:51:28 +03001923# libtool probe
1924
Brad3f534582011-08-13 20:30:14 -04001925if ! has $libtool; then
Alon Levy44dc0ca2011-05-15 11:51:28 +03001926 libtool=
Alon Levy44dc0ca2011-05-15 11:51:28 +03001927fi
1928
Peter Maydell8e515b12013-05-04 21:57:51 +01001929# MacOSX ships with a libtool which isn't the GNU one; weed this
1930# out by checking whether libtool supports the --version switch
1931if test -n "$libtool"; then
1932 if ! "$libtool" --version >/dev/null 2>&1; then
1933 libtool=
1934 fi
1935fi
1936
Alon Levy44dc0ca2011-05-15 11:51:28 +03001937##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001938# Sparse probe
1939if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001940 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001941 sparse=yes
1942 else
1943 if test "$sparse" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001944 feature_not_found "sparse" "Install sparse binary"
Juan Quinteladfffc652009-08-12 18:29:57 +02001945 fi
1946 sparse=no
1947 fi
1948fi
1949
1950##########################################
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001951# GTK probe
1952
1953if test "$gtk" != "no"; then
Daniel P. Berrange528de902013-02-25 15:20:44 +00001954 gtkpackage="gtk+-$gtkabi"
1955 if test "$gtkabi" = "3.0" ; then
1956 gtkversion="3.0.0"
1957 vtepackage="vte-2.90"
1958 vteversion="0.32.0"
1959 else
1960 gtkversion="2.18.0"
1961 vtepackage="vte"
1962 vteversion="0.24.0"
1963 fi
Peter Maydell0d185e62013-07-18 16:42:01 +01001964 if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1965 if test "$gtk" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001966 feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
Peter Maydell0d185e62013-07-18 16:42:01 +01001967 fi
1968 gtk="no"
1969 elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
1970 if test "$gtk" = "yes" ; then
1971 error_exit "libvte not found (required for gtk support)"
1972 fi
1973 gtk="no"
1974 else
Stefan Weilca871ec2013-08-27 21:09:12 +02001975 gtk_cflags=`$pkg_config --cflags $gtkpackage`
1976 gtk_libs=`$pkg_config --libs $gtkpackage`
1977 vte_cflags=`$pkg_config --cflags $vtepackage`
1978 vte_libs=`$pkg_config --libs $vtepackage`
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001979 libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1980 gtk="yes"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001981 fi
1982fi
1983
1984##########################################
bellard11d9f692004-04-02 20:55:59 +00001985# SDL probe
1986
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001987# Look for sdl configuration program (pkg-config or sdl-config). Try
1988# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
1989if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
1990 sdl_config=sdl-config
1991fi
1992
Stefan Weil65d5d3f2013-08-27 21:09:13 +02001993if $pkg_config sdl --exists; then
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01001994 sdlconfig="$pkg_config sdl"
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001995 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001996elif has ${sdl_config}; then
1997 sdlconfig="$sdl_config"
Paolo Bonzini9316f802010-01-13 09:52:55 +01001998 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00001999else
2000 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002001 feature_not_found "sdl" "Install SDL devel"
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00002002 fi
2003 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01002004fi
Scott Wood29e5bad2011-04-08 14:15:50 -05002005if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01002006 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2007fi
bellard11d9f692004-04-02 20:55:59 +00002008
Paolo Bonzini9316f802010-01-13 09:52:55 +01002009sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02002010if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002011 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00002012#include <SDL.h>
2013#undef main /* We don't want SDL to override our main() */
2014int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2015EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01002016 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08002017 if test "$static" = "yes" ; then
2018 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
2019 else
2020 sdl_libs=`$sdlconfig --libs 2> /dev/null`
2021 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002022 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002023 if test "$_sdlversion" -lt 121 ; then
2024 sdl_too_old=yes
2025 else
2026 if test "$cocoa" = "no" ; then
2027 sdl=yes
2028 fi
2029 fi
aliguoricd01b4a2008-08-21 19:25:45 +00002030
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002031 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02002032 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002033 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01002034 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2035 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02002036 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002037 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002038 :
2039 else
2040 sdl=no
2041 fi
2042 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02002043 else # sdl not found
2044 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002045 feature_not_found "sdl" "Install SDL devel"
Juan Quintelac4198152009-08-12 18:29:53 +02002046 fi
2047 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02002048 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02002049fi
bellard11d9f692004-04-02 20:55:59 +00002050
aliguori5368a422009-03-03 17:37:21 +00002051if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002052 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00002053#include <SDL.h>
2054#if defined(SDL_VIDEO_DRIVER_X11)
2055#include <X11/XKBlib.h>
2056#else
2057#error No x11 support
2058#endif
2059int main(void) { return 0; }
2060EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002061 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002062 sdl_libs="$sdl_libs -lX11"
2063 fi
Juan Quintela07056672009-08-03 14:46:27 +02002064 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00002065fi
2066
ths8f28f3f2007-01-05 21:25:54 +00002067##########################################
Michael R. Hines2da776d2013-07-22 10:01:54 -04002068# RDMA needs OpenFabrics libraries
2069if test "$rdma" != "no" ; then
2070 cat > $TMPC <<EOF
2071#include <rdma/rdma_cma.h>
2072int main(void) { return 0; }
2073EOF
2074 rdma_libs="-lrdmacm -libverbs"
2075 if compile_prog "" "$rdma_libs" ; then
2076 rdma="yes"
2077 libs_softmmu="$libs_softmmu $rdma_libs"
2078 else
2079 if test "$rdma" = "yes" ; then
2080 error_exit \
2081 " OpenFabrics librdmacm/libibverbs not present." \
2082 " Your options:" \
2083 " (1) Fast: Install infiniband packages from your distro." \
2084 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2085 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2086 fi
2087 rdma="no"
2088 fi
2089fi
2090
2091##########################################
Tim Hardeck7536ee42013-01-21 11:04:44 +01002092# VNC TLS/WS detection
2093if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
Juan Quintela1be10ad2009-08-12 18:20:28 +02002094 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00002095#include <gnutls/gnutls.h>
2096int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2097EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01002098 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2099 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02002100 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
Tim Hardeck7536ee42013-01-21 11:04:44 +01002101 if test "$vnc_tls" != "no" ; then
2102 vnc_tls=yes
2103 fi
2104 if test "$vnc_ws" != "no" ; then
2105 vnc_ws=yes
2106 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02002107 libs_softmmu="$vnc_tls_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002108 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
Juan Quintela1be10ad2009-08-12 18:20:28 +02002109 else
2110 if test "$vnc_tls" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002111 feature_not_found "vnc-tls" "Install gnutls devel"
aliguoriae6b5e52008-08-06 16:55:50 +00002112 fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01002113 if test "$vnc_ws" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002114 feature_not_found "vnc-ws" "Install gnutls devel"
Tim Hardeck7536ee42013-01-21 11:04:44 +01002115 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02002116 vnc_tls=no
Tim Hardeck7536ee42013-01-21 11:04:44 +01002117 vnc_ws=no
Juan Quintela1be10ad2009-08-12 18:20:28 +02002118 fi
ths8d5d2d42007-08-25 01:37:51 +00002119fi
2120
2121##########################################
Benoît Canet95c6bff2014-02-21 22:21:15 +01002122# Quorum probe (check for gnutls)
2123if test "$quorum" != "no" ; then
2124cat > $TMPC <<EOF
2125#include <gnutls/gnutls.h>
2126#include <gnutls/crypto.h>
2127int main(void) {char data[4096], digest[32];
2128gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2129return 0;
2130}
2131EOF
2132quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2133quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2134if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2135 qcow_tls=yes
2136 libs_softmmu="$quorum_tls_libs $libs_softmmu"
2137 libs_tools="$quorum_tls_libs $libs_softmmu"
2138 QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2139else
2140 echo "gnutls > 2.10.0 required to compile Quorum"
2141 exit 1
2142fi
2143fi
2144
2145##########################################
aliguori2f9606b2009-03-06 20:27:28 +00002146# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002147if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02002148 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00002149#include <sasl/sasl.h>
2150#include <stdio.h>
2151int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2152EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02002153 # Assuming Cyrus-SASL installed in /usr prefix
2154 vnc_sasl_cflags=""
2155 vnc_sasl_libs="-lsasl2"
2156 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2157 vnc_sasl=yes
2158 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002159 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
Juan Quintelaea784e32009-08-12 18:20:29 +02002160 else
2161 if test "$vnc_sasl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002162 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
aliguori2f9606b2009-03-06 20:27:28 +00002163 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02002164 vnc_sasl=no
2165 fi
aliguori2f9606b2009-03-06 20:27:28 +00002166fi
2167
2168##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002169# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002170if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002171cat > $TMPC <<EOF
2172#include <stdio.h>
2173#include <jpeglib.h>
2174int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2175EOF
2176 vnc_jpeg_cflags=""
2177 vnc_jpeg_libs="-ljpeg"
2178 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2179 vnc_jpeg=yes
2180 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002181 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002182 else
2183 if test "$vnc_jpeg" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002184 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002185 fi
2186 vnc_jpeg=no
2187 fi
2188fi
2189
2190##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02002191# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002192if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02002193cat > $TMPC <<EOF
2194//#include <stdio.h>
2195#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002196#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02002197int main(void) {
2198 png_structp png_ptr;
2199 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
Peter Maydell7edc3fe2012-07-18 15:10:24 +01002200 return png_ptr != 0;
Corentin Charyefe556a2010-07-07 20:57:56 +02002201}
2202EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002203 if $pkg_config libpng --exists; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002204 vnc_png_cflags=`$pkg_config libpng --cflags`
2205 vnc_png_libs=`$pkg_config libpng --libs`
Brad9af80252011-07-30 01:45:55 -04002206 else
Corentin Charyefe556a2010-07-07 20:57:56 +02002207 vnc_png_cflags=""
2208 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04002209 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02002210 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2211 vnc_png=yes
2212 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04002213 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02002214 else
2215 if test "$vnc_png" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002216 feature_not_found "vnc-png" "Install libpng devel"
Corentin Charyefe556a2010-07-07 20:57:56 +02002217 fi
2218 vnc_png=no
2219 fi
2220fi
2221
2222##########################################
aliguori76655d62009-03-06 20:27:37 +00002223# fnmatch() probe, used for ACL routines
2224fnmatch="no"
2225cat > $TMPC << EOF
2226#include <fnmatch.h>
2227int main(void)
2228{
2229 fnmatch("foo", "foo", 0);
2230 return 0;
2231}
2232EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002233if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00002234 fnmatch="yes"
2235fi
2236
2237##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02002238# uuid_generate() probe, used for vdi block driver
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002239# Note that on some systems (notably MacOSX) no extra library
2240# need be linked to get the uuid functions.
Stefan Weilee682d22009-10-01 20:10:37 +02002241if test "$uuid" != "no" ; then
2242 uuid_libs="-luuid"
2243 cat > $TMPC << EOF
2244#include <uuid/uuid.h>
2245int main(void)
2246{
2247 uuid_t my_uuid;
2248 uuid_generate(my_uuid);
2249 return 0;
2250}
2251EOF
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002252 if compile_prog "" "" ; then
2253 uuid="yes"
2254 elif compile_prog "" "$uuid_libs" ; then
Stefan Weilee682d22009-10-01 20:10:37 +02002255 uuid="yes"
2256 libs_softmmu="$uuid_libs $libs_softmmu"
2257 libs_tools="$uuid_libs $libs_tools"
2258 else
2259 if test "$uuid" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002260 feature_not_found "uuid" "Install libuuid devel"
Stefan Weilee682d22009-10-01 20:10:37 +02002261 fi
2262 uuid=no
2263 fi
2264fi
2265
Jeff Cody4f18b782013-10-30 10:44:39 -04002266if test "$vhdx" = "yes" ; then
2267 if test "$uuid" = "no" ; then
2268 error_exit "uuid required for VHDX support"
2269 fi
2270elif test "$vhdx" != "no" ; then
2271 if test "$uuid" = "yes" ; then
2272 vhdx=yes
2273 else
2274 vhdx=no
2275 fi
2276fi
2277
Stefan Weilee682d22009-10-01 20:10:37 +02002278##########################################
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002279# xfsctl() probe, used for raw-posix
2280if test "$xfs" != "no" ; then
2281 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01002282#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002283#include <xfs/xfs.h>
2284int main(void)
2285{
2286 xfsctl(NULL, 0, 0, NULL);
2287 return 0;
2288}
2289EOF
2290 if compile_prog "" "" ; then
2291 xfs="yes"
2292 else
2293 if test "$xfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002294 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002295 fi
2296 xfs=no
2297 fi
2298fi
2299
2300##########################################
ths8a16d272008-07-19 09:56:24 +00002301# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02002302if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002303 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00002304 cat > $TMPC << EOF
2305#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00002306int main(void)
2307{
2308 struct vde_open_args a = {0, 0, 0};
Peter Maydellfea08e02012-07-18 15:10:25 +01002309 char s[] = "";
2310 vde_open(s, s, &a);
pbrook4a7f0e02008-09-07 16:42:53 +00002311 return 0;
2312}
ths8a16d272008-07-19 09:56:24 +00002313EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002314 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002315 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02002316 libs_softmmu="$vde_libs $libs_softmmu"
2317 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002318 else
2319 if test "$vde" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002320 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002321 fi
2322 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02002323 fi
ths8a16d272008-07-19 09:56:24 +00002324fi
2325
2326##########################################
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01002327# netmap support probe
2328# Apart from looking for netmap headers, we make sure that the host API version
2329# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2330# a minor/major version number. Minor new features will be marked with values up
2331# to 15, and if something happens that requires a change to the backend we will
2332# move above 15, submit the backend fixes and modify this two bounds.
Vincenzo Maffione58952132013-11-06 11:44:06 +01002333if test "$netmap" != "no" ; then
2334 cat > $TMPC << EOF
2335#include <inttypes.h>
2336#include <net/if.h>
2337#include <net/netmap.h>
2338#include <net/netmap_user.h>
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01002339#if (NETMAP_API < 11) || (NETMAP_API > 15)
2340#error
2341#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01002342int main(void) { return 0; }
2343EOF
2344 if compile_prog "" "" ; then
2345 netmap=yes
2346 else
2347 if test "$netmap" = "yes" ; then
2348 feature_not_found "netmap"
2349 fi
2350 netmap=no
2351 fi
2352fi
2353
2354##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05002355# libcap-ng library probe
2356if test "$cap_ng" != "no" ; then
2357 cap_libs="-lcap-ng"
2358 cat > $TMPC << EOF
2359#include <cap-ng.h>
2360int main(void)
2361{
2362 capng_capability_to_name(CAPNG_EFFECTIVE);
2363 return 0;
2364}
2365EOF
2366 if compile_prog "" "$cap_libs" ; then
2367 cap_ng=yes
2368 libs_tools="$cap_libs $libs_tools"
2369 else
2370 if test "$cap_ng" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002371 feature_not_found "cap_ng" "Install libcap-ng devel"
Corey Bryant47e98652012-01-26 09:42:26 -05002372 fi
2373 cap_ng=no
2374 fi
2375fi
2376
2377##########################################
malcc2de5c92008-06-28 19:13:06 +00002378# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00002379
malcc2de5c92008-06-28 19:13:06 +00002380audio_drv_probe()
2381{
2382 drv=$1
2383 hdr=$2
2384 lib=$3
2385 exp=$4
2386 cfl=$5
2387 cat > $TMPC << EOF
2388#include <$hdr>
2389int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00002390EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002391 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00002392 :
2393 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002394 error_exit "$drv check failed" \
2395 "Make sure to have the $drv libs and headers installed."
malcc2de5c92008-06-28 19:13:06 +00002396 fi
2397}
2398
malc2fa7d3b2008-07-29 12:58:44 +00002399audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00002400for drv in $audio_drv_list; do
2401 case $drv in
2402 alsa)
2403 audio_drv_probe $drv alsa/asoundlib.h -lasound \
Stefan Weile35bcb02012-07-18 15:10:19 +01002404 "return snd_pcm_close((snd_pcm_t *)0);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002405 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002406 ;;
2407
2408 fmod)
2409 if test -z $fmod_lib || test -z $fmod_inc; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002410 error_exit "You must specify path to FMOD library and headers" \
2411 "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
malcc2de5c92008-06-28 19:13:06 +00002412 fi
2413 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002414 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002415 ;;
2416
2417 esd)
2418 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002419 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002420 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00002421 ;;
malcb8e59f12008-07-02 21:03:08 +00002422
2423 pa)
Marc-André Lureaua394aed2012-04-17 14:32:42 +02002424 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2425 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2426 libs_softmmu="-lpulse $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002427 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00002428 ;;
2429
Juan Quintela997e6902009-08-03 14:46:29 +02002430 coreaudio)
2431 libs_softmmu="-framework CoreAudio $libs_softmmu"
2432 ;;
2433
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002434 dsound)
2435 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04002436 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002437 ;;
2438
2439 oss)
2440 libs_softmmu="$oss_lib $libs_softmmu"
2441 ;;
2442
2443 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00002444 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2445 ;;
2446
malcd5631632009-10-10 01:13:41 +04002447 winwave)
2448 libs_softmmu="-lwinmm $libs_softmmu"
2449 audio_win_int="yes"
2450 ;;
2451
malce4c63a62008-07-19 16:15:16 +00002452 *)
malc1c9b2a52008-07-19 16:57:30 +00002453 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
Peter Maydell76ad07a2013-04-08 12:11:26 +01002454 error_exit "Unknown driver '$drv' selected" \
2455 "Possible drivers are: $audio_possible_drivers"
malce4c63a62008-07-19 16:15:16 +00002456 }
2457 ;;
malcc2de5c92008-06-28 19:13:06 +00002458 esac
2459done
ths8f28f3f2007-01-05 21:25:54 +00002460
balrog4d3b6f62008-02-10 16:33:14 +00002461##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00002462# BrlAPI probe
2463
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002464if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002465 brlapi_libs="-lbrlapi"
2466 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00002467#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002468#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00002469int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2470EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002471 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002472 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02002473 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002474 else
2475 if test "$brlapi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002476 feature_not_found "brlapi" "Install brlapi devel"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002477 fi
2478 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02002479 fi
2480fi
aurel322e4d9fb2008-04-08 06:01:02 +00002481
2482##########################################
balrog4d3b6f62008-02-10 16:33:14 +00002483# curses probe
Juan Quintelac584a6d2009-08-12 18:20:30 +02002484if test "$curses" != "no" ; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002485 if test "$mingw32" = "yes" ; then
2486 curses_list="-lpdcurses"
2487 else
Ed Mastecfeda5f2013-05-24 16:07:00 -04002488 curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
Michael Tokareva3605bf2013-05-25 13:17:21 +04002489 fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02002490 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00002491 cat > $TMPC << EOF
2492#include <curses.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01002493int main(void) {
2494 const char *s = curses_version();
2495 resize_term(0, 0);
2496 return s != 0;
2497}
balrog4d3b6f62008-02-10 16:33:14 +00002498EOF
Vadim Evardecbe2512013-01-15 16:17:24 +04002499 IFS=:
Juan Quintela4f78ef92009-08-12 18:20:23 +02002500 for curses_lib in $curses_list; do
Vadim Evardecbe2512013-01-15 16:17:24 +04002501 unset IFS
Juan Quintela4f78ef92009-08-12 18:20:23 +02002502 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02002503 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02002504 libs_softmmu="$curses_lib $libs_softmmu"
2505 break
2506 fi
2507 done
Vadim Evardecbe2512013-01-15 16:17:24 +04002508 unset IFS
Juan Quintelac584a6d2009-08-12 18:20:30 +02002509 if test "$curses_found" = "yes" ; then
2510 curses=yes
2511 else
2512 if test "$curses" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002513 feature_not_found "curses" "Install ncurses devel"
Juan Quintelac584a6d2009-08-12 18:20:30 +02002514 fi
2515 curses=no
2516 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02002517fi
balrog4d3b6f62008-02-10 16:33:14 +00002518
blueswir1414f0da2008-08-15 18:20:52 +00002519##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02002520# curl probe
Juan Quintela788c8192009-08-12 18:29:47 +02002521if test "$curl" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002522 if $pkg_config libcurl --exists; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002523 curlconfig="$pkg_config libcurl"
2524 else
2525 curlconfig=curl-config
2526 fi
Alexander Graf769ce762009-05-11 17:41:42 +02002527 cat > $TMPC << EOF
2528#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01002529int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02002530EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01002531 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2532 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02002533 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02002534 curl=yes
Juan Quintela788c8192009-08-12 18:29:47 +02002535 else
2536 if test "$curl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002537 feature_not_found "curl" "Install libcurl devel"
Juan Quintela788c8192009-08-12 18:29:47 +02002538 fi
2539 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02002540 fi
2541fi # test "$curl"
2542
2543##########################################
balrogfb599c92008-09-28 23:49:55 +00002544# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002545if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00002546 cat > $TMPC << EOF
2547#include <bluetooth/bluetooth.h>
2548int main(void) { return bt_error(0); }
2549EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01002550 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2551 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02002552 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002553 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02002554 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00002555 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002556 if test "$bluez" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002557 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002558 fi
balroge820e3f2008-09-30 02:27:44 +00002559 bluez="no"
2560 fi
balrogfb599c92008-09-28 23:49:55 +00002561fi
2562
2563##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05002564# glib support probe
Paolo Bonzinia52d28a2012-04-05 13:01:54 +02002565
2566if test "$mingw32" = yes; then
2567 # g_poll is required in order to integrate with the glib main loop.
2568 glib_req_ver=2.20
2569else
2570 glib_req_ver=2.12
2571fi
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01002572glib_modules=gthread-2.0
2573if test "$modules" = yes; then
2574 glib_modules="$glib_modules gmodule-2.0"
2575fi
Fam Zhenge26110c2014-02-10 14:48:57 +08002576
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01002577for i in $glib_modules; do
Fam Zhenge26110c2014-02-10 14:48:57 +08002578 if $pkg_config --atleast-version=$glib_req_ver $i; then
2579 glib_cflags=`$pkg_config --cflags $i`
2580 glib_libs=`$pkg_config --libs $i`
2581 CFLAGS="$glib_cflags $CFLAGS"
2582 LIBS="$glib_libs $LIBS"
2583 libs_qga="$glib_libs $libs_qga"
2584 else
2585 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2586 fi
2587done
2588
2589##########################################
2590# SHA command probe for modules
2591if test "$modules" = yes; then
2592 shacmd_probe="sha1sum sha1 shasum"
2593 for c in $shacmd_probe; do
2594 if which $c &>/dev/null; then
2595 shacmd="$c"
2596 break
2597 fi
2598 done
2599 if test "$shacmd" = ""; then
2600 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2601 fi
Anthony Liguorie18df142011-07-19 14:50:29 -05002602fi
2603
2604##########################################
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002605# pixman support probe
2606
2607if test "$pixman" = ""; then
Robert Schiele74880fe2012-12-04 16:58:08 +01002608 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2609 pixman="none"
2610 elif $pkg_config pixman-1 > /dev/null 2>&1; then
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002611 pixman="system"
2612 else
2613 pixman="internal"
2614 fi
2615fi
Robert Schiele74880fe2012-12-04 16:58:08 +01002616if test "$pixman" = "none"; then
2617 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002618 error_exit "pixman disabled but system emulation or tools build" \
2619 "enabled. You can turn off pixman only if you also" \
2620 "disable all system emulation targets and the tools" \
2621 "build with '--disable-tools --disable-system'."
Robert Schiele74880fe2012-12-04 16:58:08 +01002622 fi
2623 pixman_cflags=
2624 pixman_libs=
2625elif test "$pixman" = "system"; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002626 pixman_cflags=`$pkg_config --cflags pixman-1`
2627 pixman_libs=`$pkg_config --libs pixman-1`
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002628else
2629 if test ! -d ${source_path}/pixman/pixman; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002630 error_exit "pixman not present. Your options:" \
2631 " (1) Preferred: Install the pixman devel package (any recent" \
2632 " distro should have packages as Xorg needs pixman too)." \
2633 " (2) Fetch the pixman submodule, using:" \
2634 " git submodule update --init pixman"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002635 fi
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01002636 mkdir -p pixman/pixman
2637 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2638 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002639fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002640
2641##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302642# libcap probe
2643
2644if test "$cap" != "no" ; then
2645 cat > $TMPC <<EOF
2646#include <stdio.h>
2647#include <sys/capability.h>
Stefan Weilcc939742012-07-18 15:10:20 +01002648int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302649EOF
2650 if compile_prog "" "-lcap" ; then
2651 cap=yes
2652 else
2653 cap=no
2654 fi
2655fi
2656
2657##########################################
aliguorie5d355d2009-04-24 18:03:15 +00002658# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04002659PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00002660
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02002661pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00002662cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00002663#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01002664static void *f(void *p) { return NULL; }
2665int main(void) {
2666 pthread_t thread;
2667 pthread_create(&thread, 0, f, 0);
2668 return 0;
2669}
blueswir1414f0da2008-08-15 18:20:52 +00002670EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02002671if compile_prog "" "" ; then
2672 pthread=yes
2673else
2674 for pthread_lib in $PTHREADLIBS_LIST; do
2675 if compile_prog "" "$pthread_lib" ; then
2676 pthread=yes
Peter Portantee3c56762012-04-20 10:36:12 -04002677 found=no
2678 for lib_entry in $LIBS; do
2679 if test "$lib_entry" = "$pthread_lib"; then
2680 found=yes
2681 break
2682 fi
2683 done
2684 if test "$found" = "no"; then
2685 LIBS="$pthread_lib $LIBS"
2686 fi
Andreas Färberbd00d532010-09-20 00:50:44 +02002687 break
2688 fi
2689 done
2690fi
blueswir1414f0da2008-08-15 18:20:52 +00002691
Anthony Liguori4617e592009-08-25 17:21:56 -05002692if test "$mingw32" != yes -a "$pthread" = no; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002693 error_exit "pthread check failed" \
2694 "Make sure to have the pthread libs and headers installed."
aliguorie5d355d2009-04-24 18:03:15 +00002695fi
2696
aliguoribf9298b2008-12-05 20:05:26 +00002697##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002698# rbd probe
2699if test "$rbd" != "no" ; then
2700 cat > $TMPC <<EOF
2701#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07002702#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002703int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07002704 rados_t cluster;
2705 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002706 return 0;
2707}
2708EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07002709 rbd_libs="-lrbd -lrados"
2710 if compile_prog "" "$rbd_libs" ; then
2711 rbd=yes
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002712 else
2713 if test "$rbd" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002714 feature_not_found "rados block device" "Install librbd/ceph devel"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002715 fi
2716 rbd=no
2717 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002718fi
2719
2720##########################################
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002721# libssh2 probe
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002722min_libssh2_version=1.2.8
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002723if test "$libssh2" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002724 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002725 libssh2_cflags=`$pkg_config libssh2 --cflags`
2726 libssh2_libs=`$pkg_config libssh2 --libs`
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002727 libssh2=yes
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002728 else
2729 if test "$libssh2" = "yes" ; then
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002730 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002731 fi
2732 libssh2=no
2733 fi
2734fi
2735
2736##########################################
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01002737# libssh2_sftp_fsync probe
2738
2739if test "$libssh2" = "yes"; then
2740 cat > $TMPC <<EOF
2741#include <stdio.h>
2742#include <libssh2.h>
2743#include <libssh2_sftp.h>
2744int main(void) {
2745 LIBSSH2_SESSION *session;
2746 LIBSSH2_SFTP *sftp;
2747 LIBSSH2_SFTP_HANDLE *sftp_handle;
2748 session = libssh2_session_init ();
2749 sftp = libssh2_sftp_init (session);
2750 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2751 libssh2_sftp_fsync (sftp_handle);
2752 return 0;
2753}
2754EOF
2755 # libssh2_cflags/libssh2_libs defined in previous test.
2756 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2757 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2758 fi
2759fi
2760
2761##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002762# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002763
2764if test "$linux_aio" != "no" ; then
2765 cat > $TMPC <<EOF
2766#include <libaio.h>
2767#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002768#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002769int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2770EOF
2771 if compile_prog "" "-laio" ; then
2772 linux_aio=yes
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002773 else
2774 if test "$linux_aio" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002775 feature_not_found "linux AIO" "Install libaio devel"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002776 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03002777 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002778 fi
2779fi
2780
2781##########################################
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01002782# TPM passthrough is only on x86 Linux
2783
2784if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2785 tpm_passthrough=$tpm
2786else
2787 tpm_passthrough=no
2788fi
2789
2790##########################################
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002791# adjust virtio-blk-data-plane based on linux-aio
2792
2793if test "$virtio_blk_data_plane" = "yes" -a \
2794 "$linux_aio" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002795 error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002796elif test -z "$virtio_blk_data_plane" ; then
2797 virtio_blk_data_plane=$linux_aio
2798fi
2799
2800##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002801# attr probe
2802
2803if test "$attr" != "no" ; then
2804 cat > $TMPC <<EOF
2805#include <stdio.h>
2806#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002807#ifdef CONFIG_LIBATTR
2808#include <attr/xattr.h>
2809#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002810#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002811#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002812int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2813EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002814 if compile_prog "" "" ; then
2815 attr=yes
2816 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002817 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002818 attr=yes
2819 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002820 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002821 else
2822 if test "$attr" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002823 feature_not_found "ATTR" "Install libc6 or libattr devel"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002824 fi
2825 attr=no
2826 fi
2827fi
2828
2829##########################################
aliguoribf9298b2008-12-05 20:05:26 +00002830# iovec probe
2831cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00002832#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00002833#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00002834#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01002835int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00002836EOF
2837iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002838if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00002839 iovec=yes
2840fi
2841
aurel32f652e6a2008-12-16 10:43:48 +00002842##########################################
aliguoriceb42de2009-04-07 18:43:28 +00002843# preadv probe
2844cat > $TMPC <<EOF
2845#include <sys/types.h>
2846#include <sys/uio.h>
2847#include <unistd.h>
Blue Swirlc075a722012-08-09 20:21:25 +00002848int main(void) { return preadv(0, 0, 0, 0); }
aliguoriceb42de2009-04-07 18:43:28 +00002849EOF
2850preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002851if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00002852 preadv=yes
2853fi
2854
2855##########################################
aurel32f652e6a2008-12-16 10:43:48 +00002856# fdt probe
Peter Maydelle169e1e2013-05-24 16:26:54 +01002857# fdt support is mandatory for at least some target architectures,
2858# so insist on it if we're building those system emulators.
2859fdt_required=no
2860for target in $target_list; do
2861 case $target in
Alexander Graf6a49fa92013-09-03 20:12:22 +01002862 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
Peter Maydelle169e1e2013-05-24 16:26:54 +01002863 fdt_required=yes
2864 ;;
2865 esac
2866done
2867
2868if test "$fdt_required" = "yes"; then
2869 if test "$fdt" = "no"; then
2870 error_exit "fdt disabled but some requested targets require it." \
2871 "You can turn off fdt only if you also disable all the system emulation" \
2872 "targets which need it (by specifying a cut down --target-list)."
2873 fi
2874 fdt=yes
2875fi
2876
Juan Quintela2df87df2009-08-12 18:29:54 +02002877if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02002878 fdt_libs="-lfdt"
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002879 # explicitly check for libfdt_env.h as it is missing in some stable installs
Juan Quintelab41af4b2009-07-27 16:13:20 +02002880 cat > $TMPC << EOF
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002881#include <libfdt_env.h>
aurel32f652e6a2008-12-16 10:43:48 +00002882int main(void) { return 0; }
2883EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002884 if compile_prog "" "$fdt_libs" ; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002885 # system DTC is good - use it
aurel32f652e6a2008-12-16 10:43:48 +00002886 fdt=yes
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002887 elif test -d ${source_path}/dtc/libfdt ; then
2888 # have submodule DTC - use it
2889 fdt=yes
2890 dtc_internal="yes"
2891 mkdir -p dtc
2892 if [ "$source_path" != `pwd` ] ; then
2893 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2894 symlink "$source_path/dtc/scripts" "dtc/scripts"
Juan Quintela2df87df2009-08-12 18:29:54 +02002895 fi
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002896 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2897 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2898 elif test "$fdt" = "yes" ; then
2899 # have neither and want - prompt for system/submodule install
Stewart Smith3f281822014-01-24 12:39:06 +11002900 error_exit "DTC (libfdt) not present. Your options:" \
2901 " (1) Preferred: Install the DTC (libfdt) devel package" \
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002902 " (2) Fetch the DTC submodule, using:" \
2903 " git submodule update --init dtc"
2904 else
2905 # don't have and don't want
Michael Wallede3a3542011-04-26 00:24:07 +02002906 fdt_libs=
Juan Quintela2df87df2009-08-12 18:29:54 +02002907 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00002908 fi
2909fi
2910
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002911libs_softmmu="$libs_softmmu $fdt_libs"
2912
Michael Walle20ff0752011-03-07 23:32:39 +01002913##########################################
Michael Walleb1e5fff2013-03-06 20:23:32 +01002914# GLX probe, used by milkymist-tmu2
2915if test "$glx" != "no" ; then
2916 glx_libs="-lGL -lX11"
Michael Walle20ff0752011-03-07 23:32:39 +01002917 cat > $TMPC << EOF
2918#include <X11/Xlib.h>
2919#include <GL/gl.h>
2920#include <GL/glx.h>
Michael Walled3fcbb12013-03-06 20:16:58 +01002921int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
Michael Walle20ff0752011-03-07 23:32:39 +01002922EOF
Michael Walled3fcbb12013-03-06 20:16:58 +01002923 if compile_prog "" "-lGL -lX11" ; then
Michael Walleb1e5fff2013-03-06 20:23:32 +01002924 glx=yes
Michael Walle20ff0752011-03-07 23:32:39 +01002925 else
Michael Walleb1e5fff2013-03-06 20:23:32 +01002926 if test "$glx" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002927 feature_not_found "glx" "Install GL devel (e.g. MESA)"
Michael Walle20ff0752011-03-07 23:32:39 +01002928 fi
Michael Walleb1e5fff2013-03-06 20:23:32 +01002929 glx_libs=
2930 glx=no
Michael Walle20ff0752011-03-07 23:32:39 +01002931 fi
2932fi
2933
Bharata B Raoeb100392012-09-24 14:42:45 +05302934##########################################
2935# glusterfs probe
2936if test "$glusterfs" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002937 if $pkg_config --atleast-version=3 glusterfs-api; then
Bharata B Raoe01bee02013-07-16 21:47:41 +05302938 glusterfs="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02002939 glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2940 glusterfs_libs=`$pkg_config --libs glusterfs-api`
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002941 if $pkg_config --atleast-version=5 glusterfs-api; then
Bharata B Rao0c14fb42013-07-16 21:47:42 +05302942 glusterfs_discard="yes"
2943 fi
Bharata B Rao7c815372013-12-21 14:51:25 +05302944 if $pkg_config --atleast-version=6 glusterfs-api; then
2945 glusterfs_zerofill="yes"
2946 fi
Bharata B Raoeb100392012-09-24 14:42:45 +05302947 else
2948 if test "$glusterfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002949 feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
Bharata B Raoeb100392012-09-24 14:42:45 +05302950 fi
Bharata B Raoe01bee02013-07-16 21:47:41 +05302951 glusterfs="no"
Bharata B Raoeb100392012-09-24 14:42:45 +05302952 fi
2953fi
2954
aurel3239386ac2009-04-15 19:48:17 +00002955# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00002956# emulator. This is done because older glibc versions don't
2957# have syscall stubs for these implemented. In that case we
2958# don't provide them even if kernel supports them.
2959#
2960inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002961cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002962#include <sys/inotify.h>
2963
2964int
2965main(void)
2966{
2967 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00002968 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00002969}
2970EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002971if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002972 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00002973fi
2974
Riku Voipioc05c7a72010-03-26 15:25:11 +00002975inotify1=no
2976cat > $TMPC << EOF
2977#include <sys/inotify.h>
2978
2979int
2980main(void)
2981{
2982 /* try to start inotify */
2983 return inotify_init1(0);
2984}
2985EOF
2986if compile_prog "" "" ; then
2987 inotify1=yes
2988fi
2989
Riku Voipioebc996f2009-04-21 15:01:51 +03002990# check if utimensat and futimens are supported
2991utimens=no
2992cat > $TMPC << EOF
2993#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03002994#include <stddef.h>
2995#include <fcntl.h>
Peter Maydell3014ee02012-07-18 15:10:26 +01002996#include <sys/stat.h>
Riku Voipioebc996f2009-04-21 15:01:51 +03002997
2998int main(void)
2999{
3000 utimensat(AT_FDCWD, "foo", NULL, 0);
3001 futimens(0, NULL);
3002 return 0;
3003}
3004EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003005if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03003006 utimens=yes
3007fi
3008
Riku Voipio099d6b02009-05-05 12:10:04 +03003009# check if pipe2 is there
3010pipe2=no
3011cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03003012#include <unistd.h>
3013#include <fcntl.h>
3014
3015int main(void)
3016{
3017 int pipefd[2];
Bruce Rogers9bca8162012-08-20 12:45:08 -06003018 return pipe2(pipefd, O_CLOEXEC);
Riku Voipio099d6b02009-05-05 12:10:04 +03003019}
3020EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003021if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03003022 pipe2=yes
3023fi
3024
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003025# check if accept4 is there
3026accept4=no
3027cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003028#include <sys/socket.h>
3029#include <stddef.h>
3030
3031int main(void)
3032{
3033 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3034 return 0;
3035}
3036EOF
3037if compile_prog "" "" ; then
3038 accept4=yes
3039fi
3040
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303041# check if tee/splice is there. vmsplice was added same time.
3042splice=no
3043cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303044#include <unistd.h>
3045#include <fcntl.h>
3046#include <limits.h>
3047
3048int main(void)
3049{
Stefan Weil66ea0f22011-12-17 09:27:35 +01003050 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303051 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3052 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3053 return 0;
3054}
3055EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003056if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303057 splice=yes
3058fi
3059
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003060##########################################
3061# signalfd probe
3062signalfd="no"
3063cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003064#include <unistd.h>
3065#include <sys/syscall.h>
3066#include <signal.h>
3067int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3068EOF
3069
3070if compile_prog "" "" ; then
3071 signalfd=yes
3072fi
3073
Riku Voipioc2882b92009-08-12 15:08:24 +03003074# check if eventfd is supported
3075eventfd=no
3076cat > $TMPC << EOF
3077#include <sys/eventfd.h>
3078
3079int main(void)
3080{
Stefan Weil55cc7f32011-12-17 09:27:37 +01003081 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03003082}
3083EOF
3084if compile_prog "" "" ; then
3085 eventfd=yes
3086fi
3087
Ulrich Hechtd0927932009-09-17 20:22:14 +03003088# check for fallocate
3089fallocate=no
3090cat > $TMPC << EOF
3091#include <fcntl.h>
3092
3093int main(void)
3094{
3095 fallocate(0, 0, 0, 0);
3096 return 0;
3097}
3098EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003099if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03003100 fallocate=yes
3101fi
3102
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01003103# check for fallocate hole punching
3104fallocate_punch_hole=no
3105cat > $TMPC << EOF
3106#include <fcntl.h>
3107#include <linux/falloc.h>
3108
3109int main(void)
3110{
3111 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3112 return 0;
3113}
3114EOF
3115if compile_prog "" "" ; then
3116 fallocate_punch_hole=yes
3117fi
3118
Peter Maydellc727f472011-01-06 11:05:10 +00003119# check for sync_file_range
3120sync_file_range=no
3121cat > $TMPC << EOF
3122#include <fcntl.h>
3123
3124int main(void)
3125{
3126 sync_file_range(0, 0, 0, 0);
3127 return 0;
3128}
3129EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003130if compile_prog "" "" ; then
Peter Maydellc727f472011-01-06 11:05:10 +00003131 sync_file_range=yes
3132fi
3133
Peter Maydelldace20d2011-01-10 13:11:24 +00003134# check for linux/fiemap.h and FS_IOC_FIEMAP
3135fiemap=no
3136cat > $TMPC << EOF
3137#include <sys/ioctl.h>
3138#include <linux/fs.h>
3139#include <linux/fiemap.h>
3140
3141int main(void)
3142{
3143 ioctl(0, FS_IOC_FIEMAP, 0);
3144 return 0;
3145}
3146EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003147if compile_prog "" "" ; then
Peter Maydelldace20d2011-01-10 13:11:24 +00003148 fiemap=yes
3149fi
3150
Ulrich Hechtd0927932009-09-17 20:22:14 +03003151# check for dup3
3152dup3=no
3153cat > $TMPC << EOF
3154#include <unistd.h>
3155
3156int main(void)
3157{
3158 dup3(0, 0, 0);
3159 return 0;
3160}
3161EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01003162if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03003163 dup3=yes
3164fi
3165
Alex Bligh4e0c6522013-08-21 16:02:43 +01003166# check for ppoll support
3167ppoll=no
3168cat > $TMPC << EOF
3169#include <poll.h>
3170
3171int main(void)
3172{
3173 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3174 ppoll(&pfd, 1, 0, 0);
3175 return 0;
3176}
3177EOF
3178if compile_prog "" "" ; then
3179 ppoll=yes
3180fi
3181
Alex Blighcd758dd2013-08-21 16:02:44 +01003182# check for prctl(PR_SET_TIMERSLACK , ... ) support
3183prctl_pr_set_timerslack=no
3184cat > $TMPC << EOF
3185#include <sys/prctl.h>
3186
3187int main(void)
3188{
3189 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3190 return 0;
3191}
3192EOF
3193if compile_prog "" "" ; then
3194 prctl_pr_set_timerslack=yes
3195fi
3196
Peter Maydell3b6edd12011-02-15 18:35:05 +00003197# check for epoll support
3198epoll=no
3199cat > $TMPC << EOF
3200#include <sys/epoll.h>
3201
3202int main(void)
3203{
3204 epoll_create(0);
3205 return 0;
3206}
3207EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003208if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003209 epoll=yes
3210fi
3211
3212# epoll_create1 and epoll_pwait are later additions
3213# so we must check separately for their presence
3214epoll_create1=no
3215cat > $TMPC << EOF
3216#include <sys/epoll.h>
3217
3218int main(void)
3219{
Peter Maydell19e83f62011-04-26 16:56:40 +01003220 /* Note that we use epoll_create1 as a value, not as
3221 * a function being called. This is necessary so that on
3222 * old SPARC glibc versions where the function was present in
3223 * the library but not declared in the header file we will
3224 * fail the configure check. (Otherwise we will get a compiler
3225 * warning but not an error, and will proceed to fail the
3226 * qemu compile where we compile with -Werror.)
3227 */
Blue Swirlc075a722012-08-09 20:21:25 +00003228 return (int)(uintptr_t)&epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00003229}
3230EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003231if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003232 epoll_create1=yes
3233fi
3234
3235epoll_pwait=no
3236cat > $TMPC << EOF
3237#include <sys/epoll.h>
3238
3239int main(void)
3240{
3241 epoll_pwait(0, 0, 0, 0, 0);
3242 return 0;
3243}
3244EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003245if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003246 epoll_pwait=yes
3247fi
3248
Peter Maydella8fd1ab2013-02-08 07:31:55 +00003249# check for sendfile support
3250sendfile=no
3251cat > $TMPC << EOF
3252#include <sys/sendfile.h>
3253
3254int main(void)
3255{
3256 return sendfile(0, 0, 0, 0);
3257}
3258EOF
3259if compile_prog "" "" ; then
3260 sendfile=yes
3261fi
3262
pbrookcc8ae6d2006-04-23 17:57:59 +00003263# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02003264if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01003265 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02003266 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02003267 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02003268 if test "$docs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003269 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
Juan Quintela83a3ab82009-08-12 18:29:51 +02003270 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02003271 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02003272 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00003273fi
3274
Stefan Weilf514f412009-10-11 12:44:07 +02003275# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003276byteswap_h=no
3277cat > $TMPC << EOF
3278#include <byteswap.h>
3279int main(void) { return bswap_32(0); }
3280EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003281if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003282 byteswap_h=yes
3283fi
3284
Stefan Weil75f13592013-01-05 12:17:38 +01003285# Search for bswap32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003286bswap_h=no
3287cat > $TMPC << EOF
3288#include <sys/endian.h>
3289#include <sys/types.h>
3290#include <machine/bswap.h>
3291int main(void) { return bswap32(0); }
3292EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003293if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003294 bswap_h=yes
3295fi
3296
aliguorida93a1f2008-12-12 20:02:52 +00003297##########################################
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003298# Do we have libiscsi
Peter Lieven063c3372013-12-05 16:47:17 +01003299# We check for iscsi_write16_sync() to make sure we have a
3300# at least version 1.4.0 of libiscsi.
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003301if test "$libiscsi" != "no" ; then
3302 cat > $TMPC << EOF
Ronnie Sahlbergfa6acb02012-04-24 16:29:04 +10003303#include <stdio.h>
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003304#include <iscsi/iscsi.h>
Peter Lieven063c3372013-12-05 16:47:17 +01003305int main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003306EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003307 if $pkg_config --atleast-version=1.7.0 libiscsi; then
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003308 libiscsi="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003309 libiscsi_cflags=$($pkg_config --cflags libiscsi)
3310 libiscsi_libs=$($pkg_config --libs libiscsi)
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003311 elif compile_prog "" "-liscsi" ; then
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003312 libiscsi="yes"
Fam Zheng6ebc91e2014-02-10 14:48:54 +08003313 libiscsi_libs="-liscsi"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003314 else
3315 if test "$libiscsi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003316 feature_not_found "libiscsi" "Install libiscsi devel"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003317 fi
3318 libiscsi="no"
3319 fi
3320fi
3321
Stefan Weil219c2522013-12-17 08:57:10 +01003322# We also need to know the API version because there was an
3323# API change from 1.4.0 to 1.5.0.
3324if test "$libiscsi" = "yes"; then
3325 cat >$TMPC <<EOF
3326#include <iscsi/iscsi.h>
3327int main(void)
3328{
3329 iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3330 return 0;
3331}
3332EOF
3333 if compile_prog "" "-liscsi"; then
3334 libiscsi_version="1.4.0"
3335 fi
3336fi
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003337
3338##########################################
Natanael Copa8bacde82012-09-12 09:06:51 +00003339# Do we need libm
3340cat > $TMPC << EOF
3341#include <math.h>
3342int main(void) { return isnan(sin(0.0)); }
3343EOF
3344if compile_prog "" "" ; then
3345 :
3346elif compile_prog "" "-lm" ; then
3347 LIBS="-lm $LIBS"
3348 libs_qga="-lm $libs_qga"
3349else
Peter Maydell76ad07a2013-04-08 12:11:26 +01003350 error_exit "libm check failed"
Natanael Copa8bacde82012-09-12 09:06:51 +00003351fi
3352
3353##########################################
aliguorida93a1f2008-12-12 20:02:52 +00003354# Do we need librt
Natanael Copa8bacde82012-09-12 09:06:51 +00003355# uClibc provides 2 versions of clock_gettime(), one with realtime
3356# support and one without. This means that the clock_gettime() don't
3357# need -lrt. We still need it for timer_create() so we check for this
3358# function in addition.
aliguorida93a1f2008-12-12 20:02:52 +00003359cat > $TMPC <<EOF
3360#include <signal.h>
3361#include <time.h>
Natanael Copa8bacde82012-09-12 09:06:51 +00003362int main(void) {
3363 timer_create(CLOCK_REALTIME, NULL, NULL);
3364 return clock_gettime(CLOCK_REALTIME, NULL);
3365}
aliguorida93a1f2008-12-12 20:02:52 +00003366EOF
3367
Juan Quintela52166aa2009-08-03 14:46:03 +02003368if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003369 :
Natanael Copa8bacde82012-09-12 09:06:51 +00003370# we need pthread for static linking. use previous pthread test result
3371elif compile_prog "" "-lrt $pthread_lib" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003372 LIBS="-lrt $LIBS"
Natanael Copa8bacde82012-09-12 09:06:51 +00003373 libs_qga="-lrt $libs_qga"
aliguorida93a1f2008-12-12 20:02:52 +00003374fi
3375
Blue Swirl31ff5042009-09-12 12:33:07 +00003376if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02003377 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02003378 libs_softmmu="-lutil $libs_softmmu"
3379fi
3380
Blue Swirlde5071c2009-09-12 09:58:46 +00003381##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003382# spice probe
3383if test "$spice" != "no" ; then
3384 cat > $TMPC << EOF
3385#include <spice.h>
3386int main(void) { spice_server_new(); return 0; }
3387EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01003388 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3389 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003390 if $pkg_config --atleast-version=0.12.0 spice-server && \
3391 $pkg_config --atleast-version=0.12.3 spice-protocol && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003392 compile_prog "$spice_cflags" "$spice_libs" ; then
3393 spice="yes"
3394 libs_softmmu="$libs_softmmu $spice_libs"
3395 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
Alon Levy2e0e3c32012-08-22 11:16:26 +03003396 spice_protocol_version=$($pkg_config --modversion spice-protocol)
3397 spice_server_version=$($pkg_config --modversion spice-server)
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003398 else
3399 if test "$spice" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003400 feature_not_found "spice" "Install spice-server and spice-protocol devel"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003401 fi
3402 spice="no"
3403 fi
3404fi
3405
Robert Relyea111a38b2010-11-28 16:36:38 +02003406# check for libcacard for smartcard support
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003407smartcard_cflags=""
3408# TODO - what's the minimal nss version we support?
3409if test "$smartcard_nss" != "no"; then
3410 cat > $TMPC << EOF
Sergei Trofimovich5f01e062012-01-31 22:03:58 +03003411#include <pk11pub.h>
3412int main(void) { PK11_FreeSlot(0); return 0; }
3413EOF
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003414 smartcard_includes="-I\$(SRC_PATH)/libcacard"
3415 libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3416 libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3417 test_cflags="$libcacard_cflags"
3418 # The header files in nss < 3.13.3 have a bug which causes them to
3419 # emit a warning. If we're going to compile QEMU with -Werror, then
3420 # test that the headers don't have this bug. Otherwise we would pass
3421 # the configure test but fail to compile QEMU later.
3422 if test "$werror" = "yes"; then
3423 test_cflags="-Werror $test_cflags"
Robert Relyea111a38b2010-11-28 16:36:38 +02003424 fi
Paolo Bonzinib6fc6752012-12-20 20:40:35 +01003425 if test -n "$libtool" &&
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003426 $pkg_config --atleast-version=3.12.8 nss && \
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003427 compile_prog "$test_cflags" "$libcacard_libs"; then
3428 smartcard_nss="yes"
3429 QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
3430 QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3431 libs_softmmu="$libcacard_libs $libs_softmmu"
3432 else
3433 if test "$smartcard_nss" = "yes"; then
3434 feature_not_found "nss"
3435 fi
3436 smartcard_nss="no"
3437 fi
Robert Relyea111a38b2010-11-28 16:36:38 +02003438fi
3439
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003440# check for libusb
3441if test "$libusb" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003442 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003443 libusb="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003444 libusb_cflags=$($pkg_config --cflags libusb-1.0)
3445 libusb_libs=$($pkg_config --libs libusb-1.0)
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003446 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3447 libs_softmmu="$libs_softmmu $libusb_libs"
3448 else
3449 if test "$libusb" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003450 feature_not_found "libusb" "Install libusb devel"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003451 fi
3452 libusb="no"
3453 fi
3454fi
3455
Hans de Goede69354a82011-07-19 11:04:10 +02003456# check for usbredirparser for usb network redirection support
3457if test "$usb_redir" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003458 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
Hans de Goede69354a82011-07-19 11:04:10 +02003459 usb_redir="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003460 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3461 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
Hans de Goede69354a82011-07-19 11:04:10 +02003462 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
Aurelien Jarno56ab2ad2012-09-11 20:57:58 +02003463 libs_softmmu="$libs_softmmu $usb_redir_libs"
Hans de Goede69354a82011-07-19 11:04:10 +02003464 else
3465 if test "$usb_redir" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003466 feature_not_found "usb-redir" "Install usbredir devel"
Hans de Goede69354a82011-07-19 11:04:10 +02003467 fi
3468 usb_redir="no"
3469 fi
3470fi
3471
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003472##########################################
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003473# check if we have VSS SDK headers for win
3474
3475if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3476 case "$vss_win32_sdk" in
3477 "") vss_win32_include="-I$source_path" ;;
3478 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3479 # handle path with spaces. So we symlink the headers into ".sdk/vss".
3480 vss_win32_include="-I$source_path/.sdk/vss"
3481 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3482 ;;
3483 *) vss_win32_include="-I$vss_win32_sdk"
3484 esac
3485 cat > $TMPC << EOF
3486#define __MIDL_user_allocate_free_DEFINED__
3487#include <inc/win2003/vss.h>
3488int main(void) { return VSS_CTX_BACKUP; }
3489EOF
3490 if compile_prog "$vss_win32_include" "" ; then
3491 guest_agent_with_vss="yes"
3492 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3493 libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3494 else
3495 if test "$vss_win32_sdk" != "" ; then
3496 echo "ERROR: Please download and install Microsoft VSS SDK:"
3497 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3498 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3499 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
3500 echo "ERROR: The headers are extracted in the directory \`inc'."
3501 feature_not_found "VSS support"
3502 fi
3503 guest_agent_with_vss="no"
3504 fi
3505fi
3506
3507##########################################
3508# lookup Windows platform SDK (if not specified)
3509# The SDK is needed only to build .tlb (type library) file of guest agent
3510# VSS provider from the source. It is usually unnecessary because the
3511# pre-compiled .tlb file is included.
3512
3513if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3514 if test -z "$win_sdk"; then
3515 programfiles="$PROGRAMFILES"
3516 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3517 if test -n "$programfiles"; then
3518 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3519 else
3520 feature_not_found "Windows SDK"
3521 fi
3522 elif test "$win_sdk" = "no"; then
3523 win_sdk=""
3524 fi
3525fi
3526
3527##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003528
Blue Swirl747bbdf2009-10-18 16:26:06 +00003529##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003530# check if we have fdatasync
3531
3532fdatasync=no
3533cat > $TMPC << EOF
3534#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003535int main(void) {
3536#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3537return fdatasync(0);
3538#else
Stefan Weile172fe12012-04-06 21:33:20 +02003539#error Not supported
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003540#endif
3541}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003542EOF
3543if compile_prog "" "" ; then
3544 fdatasync=yes
3545fi
3546
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003547##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00003548# check if we have madvise
3549
3550madvise=no
3551cat > $TMPC << EOF
3552#include <sys/types.h>
3553#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003554#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003555int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3556EOF
3557if compile_prog "" "" ; then
3558 madvise=yes
3559fi
3560
3561##########################################
3562# check if we have posix_madvise
3563
3564posix_madvise=no
3565cat > $TMPC << EOF
3566#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003567#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003568int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3569EOF
3570if compile_prog "" "" ; then
3571 posix_madvise=yes
3572fi
3573
3574##########################################
Richard Henderson1e9737d2012-10-23 07:33:00 +10003575# check if we have usable SIGEV_THREAD_ID
3576
3577sigev_thread_id=no
3578cat > $TMPC << EOF
3579#include <signal.h>
3580int main(void) {
3581 struct sigevent ev;
3582 ev.sigev_notify = SIGEV_THREAD_ID;
3583 ev._sigev_un._tid = 0;
3584 asm volatile("" : : "g"(&ev));
3585 return 0;
3586}
3587EOF
3588if compile_prog "" "" ; then
3589 sigev_thread_id=yes
3590fi
3591
3592##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003593# check if trace backend exists
3594
Lluís Vilanova650ab982012-04-03 20:47:39 +02003595$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003596if test "$?" -ne 0 ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003597 error_exit "invalid trace backend" \
3598 "Please choose a supported trace backend."
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003599fi
3600
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003601##########################################
3602# For 'ust' backend, test if ust headers are present
3603if test "$trace_backend" = "ust"; then
3604 cat > $TMPC << EOF
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003605#include <lttng/tracepoint.h>
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003606int main(void) { return 0; }
3607EOF
3608 if compile_prog "" "" ; then
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003609 if $pkg_config lttng-ust --exists; then
3610 lttng_ust_libs=`$pkg_config --libs lttng-ust`
3611 else
3612 lttng_ust_libs="-llttng-ust"
3613 fi
3614 if $pkg_config liburcu-bp --exists; then
3615 urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3616 else
3617 urcu_bp_libs="-lurcu-bp"
3618 fi
3619
3620 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3621 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003622 else
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003623 error_exit "Trace backend 'ust' missing lttng-ust header files"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003624 fi
3625fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003626
3627##########################################
3628# For 'dtrace' backend, test if 'dtrace' command is present
3629if test "$trace_backend" = "dtrace"; then
3630 if ! has 'dtrace' ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003631 error_exit "dtrace command is not found in PATH $PATH"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003632 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00003633 trace_backend_stap="no"
3634 if has 'stap' ; then
3635 trace_backend_stap="yes"
3636 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003637fi
3638
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003639##########################################
Alex Barcelo519175a2012-02-28 12:25:50 +01003640# check and set a backend for coroutine
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303641
Peter Maydell7c2acc72013-04-08 12:11:27 +01003642# We prefer ucontext, but it's not always possible. The fallback
3643# is sigcontext. gthread is not selectable except explicitly, because
3644# it is not functional enough to run QEMU proper. (It is occasionally
3645# useful for debugging purposes.) On Windows the only valid backend
3646# is the Windows-specific one.
3647
3648ucontext_works=no
3649if test "$darwin" != "yes"; then
3650 cat > $TMPC << EOF
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303651#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00003652#ifdef __stub_makecontext
3653#error Ignoring glibc stub makecontext which will always fail
3654#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01003655int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303656EOF
Peter Maydell7c2acc72013-04-08 12:11:27 +01003657 if compile_prog "" "" ; then
3658 ucontext_works=yes
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303659 fi
Peter Maydell7c2acc72013-04-08 12:11:27 +01003660fi
3661
3662if test "$coroutine" = ""; then
3663 if test "$mingw32" = "yes"; then
3664 coroutine=win32
3665 elif test "$ucontext_works" = "yes"; then
3666 coroutine=ucontext
3667 else
3668 coroutine=sigaltstack
3669 fi
Alex Barcelo519175a2012-02-28 12:25:50 +01003670else
Peter Maydell7c2acc72013-04-08 12:11:27 +01003671 case $coroutine in
3672 windows)
3673 if test "$mingw32" != "yes"; then
3674 error_exit "'windows' coroutine backend only valid for Windows"
3675 fi
3676 # Unfortunately the user visible backend name doesn't match the
3677 # coroutine-*.c filename for this case, so we have to adjust it here.
3678 coroutine=win32
3679 ;;
3680 ucontext)
3681 if test "$ucontext_works" != "yes"; then
3682 feature_not_found "ucontext"
3683 fi
3684 ;;
3685 gthread|sigaltstack)
3686 if test "$mingw32" = "yes"; then
3687 error_exit "only the 'windows' coroutine backend is valid for Windows"
3688 fi
3689 ;;
3690 *)
3691 error_exit "unknown coroutine backend $coroutine"
3692 ;;
3693 esac
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303694fi
3695
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02003696if test "$coroutine_pool" = ""; then
3697 if test "$coroutine" = "gthread"; then
3698 coroutine_pool=no
3699 else
3700 coroutine_pool=yes
3701 fi
3702fi
3703if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3704 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3705fi
3706
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303707##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303708# check if we have open_by_handle_at
3709
Stefan Weil4e1797f2012-06-18 22:11:06 +02003710open_by_handle_at=no
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303711cat > $TMPC << EOF
3712#include <fcntl.h>
Stefan Weilacc55ba2012-06-06 19:35:57 +00003713#if !defined(AT_EMPTY_PATH)
3714# error missing definition
3715#else
Stefan Weil75cafad2011-12-17 09:27:29 +01003716int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Stefan Weilacc55ba2012-06-06 19:35:57 +00003717#endif
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303718EOF
3719if compile_prog "" "" ; then
3720 open_by_handle_at=yes
3721fi
3722
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303723########################################
3724# check if we have linux/magic.h
3725
3726linux_magic_h=no
3727cat > $TMPC << EOF
3728#include <linux/magic.h>
3729int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01003730 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303731}
3732EOF
3733if compile_prog "" "" ; then
3734 linux_magic_h=yes
3735fi
3736
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003737########################################
Kevin Wolfc95e3082013-02-22 21:08:51 +01003738# check whether we can disable warning option with a pragma (this is needed
3739# to silence warnings in the headers of some versions of external libraries).
3740# This test has to be compiled with -Werror as otherwise an unknown pragma is
3741# only a warning.
3742#
3743# If we can't selectively disable warning in the code, disable -Werror so that
3744# the build doesn't fail anyway.
3745
Peter Maydell06d71fa2012-07-30 16:13:07 +01003746pragma_disable_unused_but_set=no
3747cat > $TMPC << EOF
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003748#pragma GCC diagnostic push
Peter Maydell06d71fa2012-07-30 16:13:07 +01003749#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
Kevin Wolfc95e3082013-02-22 21:08:51 +01003750#pragma GCC diagnostic ignored "-Wstrict-prototypes"
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003751#pragma GCC diagnostic pop
Kevin Wolfc95e3082013-02-22 21:08:51 +01003752
Peter Maydell06d71fa2012-07-30 16:13:07 +01003753int main(void) {
3754 return 0;
3755}
3756EOF
3757if compile_prog "-Werror" "" ; then
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01003758 pragma_diagnostic_available=yes
Kevin Wolfc95e3082013-02-22 21:08:51 +01003759else
3760 werror=no
Peter Maydell06d71fa2012-07-30 16:13:07 +01003761fi
3762
3763########################################
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003764# check if we have valgrind/valgrind.h and valgrind/memcheck.h
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003765
3766valgrind_h=no
3767cat > $TMPC << EOF
3768#include <valgrind/valgrind.h>
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003769#include <valgrind/memcheck.h>
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003770int main(void) {
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003771 return 0;
3772}
3773EOF
3774if compile_prog "" "" ; then
3775 valgrind_h=yes
3776fi
3777
3778########################################
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003779# check if environ is declared
3780
3781has_environ=no
3782cat > $TMPC << EOF
3783#include <unistd.h>
3784int main(void) {
Blue Swirlc075a722012-08-09 20:21:25 +00003785 environ = 0;
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003786 return 0;
3787}
3788EOF
3789if compile_prog "" "" ; then
3790 has_environ=yes
3791fi
3792
Richard Henderson76a347e2012-12-28 14:17:02 -08003793########################################
3794# check if cpuid.h is usable.
3795
3796cpuid_h=no
3797cat > $TMPC << EOF
3798#include <cpuid.h>
3799int main(void) {
Peter Maydell774d5662014-02-20 19:42:53 +00003800 unsigned a, b, c, d;
3801 int max = __get_cpuid_max(0, 0);
3802
3803 if (max >= 1) {
3804 __cpuid(1, a, b, c, d);
3805 }
3806
3807 if (max >= 7) {
3808 __cpuid_count(7, 0, a, b, c, d);
3809 }
3810
3811 return 0;
Richard Henderson76a347e2012-12-28 14:17:02 -08003812}
3813EOF
3814if compile_prog "" "" ; then
3815 cpuid_h=yes
3816fi
3817
Richard Hendersonf5401662013-02-16 12:46:59 -08003818########################################
3819# check if __[u]int128_t is usable.
3820
3821int128=no
3822cat > $TMPC << EOF
3823__int128_t a;
3824__uint128_t b;
3825int main (void) {
3826 a = a + b;
3827 b = a * b;
Peter Maydell464e3672013-06-21 14:01:31 +01003828 a = a * a;
Richard Hendersonf5401662013-02-16 12:46:59 -08003829 return 0;
3830}
3831EOF
3832if compile_prog "" "" ; then
3833 int128=yes
3834fi
Richard Henderson76a347e2012-12-28 14:17:02 -08003835
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08003836########################################
3837# check if getauxval is available.
3838
3839getauxval=no
3840cat > $TMPC << EOF
3841#include <sys/auxv.h>
3842int main(void) {
3843 return getauxval(AT_HWCAP) == 0;
3844}
3845EOF
3846if compile_prog "" "" ; then
3847 getauxval=yes
3848fi
3849
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303850##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02003851# End of CC checks
3852# After here, no more $cc or $ld runs
3853
Blue Swirl1d728c32012-05-01 18:45:39 +00003854if test "$gcov" = "yes" ; then
3855 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3856 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3857elif test "$debug" = "no" ; then
Michal Privoznike600cdf2013-09-05 12:54:49 +02003858 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003859fi
Juan Quintelaa316e372009-09-30 01:10:55 +02003860
Peter Lieven6542aa92014-02-03 10:26:13 +01003861##########################################
3862# Do we have libnfs
3863if test "$libnfs" != "no" ; then
3864 if $pkg_config --atleast-version=1.9.2 libnfs; then
3865 libnfs="yes"
3866 libnfs_libs=$($pkg_config --libs libnfs)
3867 LIBS="$LIBS $libnfs_libs"
3868 else
3869 if test "$libnfs" = "yes" ; then
3870 feature_not_found "libnfs"
3871 fi
3872 libnfs="no"
3873 fi
3874fi
Blue Swirl1d728c32012-05-01 18:45:39 +00003875
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003876# Disable zero malloc errors for official releases unless explicitly told to
3877# enable/disable
3878if test -z "$zero_malloc" ; then
3879 if test "$z_version" = "50" ; then
3880 zero_malloc="no"
3881 else
3882 zero_malloc="yes"
3883 fi
3884fi
3885
Peter Maydell6ca026c2012-07-18 15:10:18 +01003886# Now we've finished running tests it's OK to add -Werror to the compiler flags
3887if test "$werror" = "yes"; then
3888 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3889fi
3890
Juan Quintelae86ecd42009-08-03 14:45:59 +02003891if test "$solaris" = "no" ; then
3892 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02003893 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003894 fi
3895fi
3896
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02003897# test if pod2man has --utf8 option
3898if pod2man --help | grep -q utf8; then
3899 POD2MAN="pod2man --utf8"
3900else
3901 POD2MAN="pod2man"
3902fi
3903
Blue Swirl952afb72010-09-19 08:36:34 +00003904# Use ASLR, no-SEH and DEP if available
3905if test "$mingw32" = "yes" ; then
3906 for flag in --dynamicbase --no-seh --nxcompat; do
3907 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3908 LDFLAGS="-Wl,$flag $LDFLAGS"
3909 fi
3910 done
3911fi
3912
Eduardo Habkost10ea68b2012-04-18 16:55:39 -03003913qemu_confdir=$sysconfdir$confsuffix
Fam Zhenge26110c2014-02-10 14:48:57 +08003914qemu_moddir=$libdir$confsuffix
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03003915qemu_datadir=$datadir$confsuffix
Anthony Liguori834574e2013-02-20 07:43:24 -06003916qemu_localedir="$datadir/locale"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02003917
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003918tools=""
3919if test "$want_tools" = "yes" ; then
Paolo Bonzinica35f782010-05-26 16:08:29 +02003920 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003921 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3922 tools="qemu-nbd\$(EXESUF) $tools"
3923 fi
3924fi
3925if test "$softmmu" = yes ; then
Meador Inge983eef52012-02-24 14:00:42 +05303926 if test "$virtfs" != no ; then
Andreas Färberaabfd882012-05-01 01:12:02 +02003927 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3928 virtfs=yes
3929 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3930 else
3931 if test "$virtfs" = yes; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003932 error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
Meador Inge983eef52012-02-24 14:00:42 +05303933 fi
Andreas Färber17500372012-05-01 01:12:03 +02003934 virtfs=no
Andreas Färberaabfd882012-05-01 01:12:02 +02003935 fi
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303936 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003937fi
3938if [ "$guest_agent" != "no" ]; then
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003939 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
Michael Roth48ff7a62011-07-20 15:19:37 -05003940 tools="qemu-ga\$(EXESUF) $tools"
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003941 if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3942 tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3943 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003944 guest_agent=yes
3945 elif [ "$guest_agent" != yes ]; then
3946 guest_agent=no
3947 else
3948 error_exit "Guest agent is not supported on this platform"
Paolo Bonzinica35f782010-05-26 16:08:29 +02003949 fi
Paolo Bonzini00c705f2012-05-29 11:40:24 +02003950fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003951
3952# Mac OS X ships with a broken assembler
3953roms=
3954if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3955 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3956 "$softmmu" = yes ; then
3957 roms="optionrom"
3958fi
Andreas Färberd0384d12011-05-01 18:23:56 +02003959if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11003960 roms="$roms spapr-rtas"
3961fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003962
Christian Borntraeger9933c302013-04-23 01:23:03 +00003963if test "$cpu" = "s390x" ; then
3964 roms="$roms s390-ccw"
3965fi
3966
Richard Henderson964c6fa2013-06-21 19:10:16 -07003967# Probe for the need for relocating the user-only binary.
3968if test "$pie" = "no" ; then
3969 textseg_addr=
3970 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07003971 arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
Richard Henderson964c6fa2013-06-21 19:10:16 -07003972 textseg_addr=0x60000000
3973 ;;
3974 mips)
3975 textseg_addr=0x400000
3976 ;;
3977 esac
3978 if [ -n "$textseg_addr" ]; then
3979 cat > $TMPC <<EOF
3980 int main(void) { return 0; }
3981EOF
3982 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3983 if ! compile_prog "" "$textseg_ldflags"; then
3984 # In case ld does not support -Ttext-segment, edit the default linker
3985 # script via sed to set the .text start addr. This is needed on FreeBSD
3986 # at least.
3987 $ld --verbose | sed \
3988 -e '1,/==================================================/d' \
3989 -e '/==================================================/,$d' \
3990 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3991 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3992 textseg_ldflags="-Wl,-T../config-host.ld"
3993 fi
3994 fi
3995fi
3996
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01003997# add pixman flags after all config tests are done
Peter Crosthwaitea540f152013-04-18 14:47:31 +10003998QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01003999libs_softmmu="$libs_softmmu $pixman_libs"
4000
bellard43ce4df2003-06-09 19:53:12 +00004001echo "Install prefix $prefix"
Eduardo Habkostc00b2802012-04-18 16:55:37 -03004002echo "BIOS directory `eval echo $qemu_datadir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02004003echo "binary directory `eval echo $bindir`"
Alon Levy3aa5d2b2011-05-15 12:08:59 +03004004echo "library directory `eval echo $libdir`"
Fam Zhenge26110c2014-02-10 14:48:57 +08004005echo "module directory `eval echo $qemu_moddir`"
Michael Tokarev8bf188a2012-06-07 01:11:00 +04004006echo "libexec directory `eval echo $libexecdir`"
Alon Levy0f94d6d2011-06-27 11:58:20 +02004007echo "include directory `eval echo $includedir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02004008echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00004009if test "$mingw32" = "no" ; then
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02004010echo "local state directory `eval echo $local_statedir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02004011echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00004012echo "ELF interp prefix $interp_prefix"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02004013else
4014echo "local state directory queried at runtime"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004015echo "Windows SDK $win_sdk"
bellard11d9f692004-04-02 20:55:59 +00004016fi
bellard5a671352003-10-01 00:13:48 +00004017echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00004018echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00004019echo "Host C compiler $host_cc"
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04004020echo "C++ compiler $cxx"
Peter Maydell3c4a4d02012-08-11 22:34:40 +01004021echo "Objective-C compiler $objcc"
Peter Maydell45d285a2013-10-21 21:03:06 +01004022echo "ARFLAGS $ARFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02004023echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02004024echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02004025echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00004026echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00004027echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00004028echo "python $python"
Brade2d88302011-09-02 16:53:28 -04004029if test "$slirp" = "yes" ; then
4030 echo "smbd $smbd"
4031fi
Fam Zheng17969262014-02-10 14:48:56 +08004032echo "module support $modules"
bellard43ce4df2003-06-09 19:53:12 +00004033echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00004034echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00004035echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00004036echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00004037echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00004038echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00004039echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00004040echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00004041echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00004042echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00004043if test "$darwin" = "yes" ; then
4044 echo "Cocoa support $cocoa"
4045fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02004046echo "pixman $pixman"
bellard97a847b2003-08-10 21:36:04 +00004047echo "SDL support $sdl"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06004048echo "GTK support $gtk"
balrog4d3b6f62008-02-10 16:33:14 +00004049echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02004050echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00004051echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00004052echo "Audio drivers $audio_drv_list"
Fam Zhengb64ec4e2013-05-29 19:35:40 +08004053echo "Block whitelist (rw) $block_drv_rw_whitelist"
4054echo "Block whitelist (ro) $block_drv_ro_whitelist"
Meador Inge983eef52012-02-24 14:00:42 +05304055echo "VirtFS support $virtfs"
Jes Sorensen821601e2011-03-16 13:33:36 +01004056echo "VNC support $vnc"
4057if test "$vnc" = "yes" ; then
4058 echo "VNC TLS support $vnc_tls"
4059 echo "VNC SASL support $vnc_sasl"
4060 echo "VNC JPEG support $vnc_jpeg"
4061 echo "VNC PNG support $vnc_png"
Tim Hardeck7536ee42013-01-21 11:04:44 +01004062 echo "VNC WS support $vnc_ws"
Jes Sorensen821601e2011-03-16 13:33:36 +01004063fi
blueswir131422552007-04-16 18:27:06 +00004064if test -n "$sparc_cpu"; then
4065 echo "Target Sparc Arch $sparc_cpu"
4066fi
aliguorie37630c2009-04-22 15:19:10 +00004067echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00004068echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02004069echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02004070echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00004071[ ! -z "$uname_release" ] && \
4072echo "uname -r $uname_release"
Paul Brook379f6692009-07-17 12:48:08 +01004073echo "GUEST_BASE $guest_base"
Avi Kivity40d64442011-11-15 20:12:17 +02004074echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00004075echo "vde support $vde"
Vincenzo Maffione58952132013-11-06 11:44:06 +01004076echo "netmap support $netmap"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004077echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004078echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00004079echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02004080echo "KVM support $kvm"
Michael R. Hines2da776d2013-07-22 10:01:54 -04004081echo "RDMA support $rdma"
Stefan Weil9195b2c2011-10-19 07:07:18 +02004082echo "TCG interpreter $tcg_interpreter"
aurel32f652e6a2008-12-16 10:43:48 +00004083echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00004084echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004085echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00004086echo "madvise $madvise"
4087echo "posix_madvise $posix_madvise"
Richard Henderson1e9737d2012-10-23 07:33:00 +10004088echo "sigev_thread_id $sigev_thread_id"
Stefan Weilee682d22009-10-01 20:10:37 +02004089echo "uuid support $uuid"
Corey Bryant47e98652012-01-26 09:42:26 -05004090echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02004091echo "vhost-net support $vhost_net"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00004092echo "vhost-scsi support $vhost_scsi"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004093echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01004094echo "Trace output file $trace_file-<pid>"
Alon Levy2e0e3c32012-08-22 11:16:26 +03004095echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004096echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01004097echo "xfsctl support $xfs"
Robert Relyea111a38b2010-11-28 16:36:38 +02004098echo "nss used $smartcard_nss"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004099echo "libusb $libusb"
Hans de Goede69354a82011-07-19 11:04:10 +02004100echo "usb net redir $usb_redir"
Michael Walleb1e5fff2013-03-06 20:23:32 +01004101echo "GLX support $glx"
Stefan Weil219c2522013-12-17 08:57:10 +01004102if test "$libiscsi_version" = "1.4.0"; then
4103echo "libiscsi support $libiscsi (1.4.0)"
4104else
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004105echo "libiscsi support $libiscsi"
Stefan Weil219c2522013-12-17 08:57:10 +01004106fi
Peter Lieven6542aa92014-02-03 10:26:13 +01004107echo "libnfs support $libnfs"
Michael Rothd138cee2011-08-01 14:52:57 -05004108echo "build guest agent $guest_agent"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004109echo "QGA VSS support $guest_agent_with_vss"
Eduardo Otubof7945732012-08-14 18:44:05 -03004110echo "seccomp support $seccomp"
Peter Maydell7c2acc72013-04-08 12:11:27 +01004111echo "coroutine backend $coroutine"
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004112echo "coroutine pool $coroutine_pool"
Bharata B Raoeb100392012-09-24 14:42:45 +05304113echo "GlusterFS support $glusterfs"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004114echo "virtio-blk-data-plane $virtio_blk_data_plane"
Blue Swirl1d728c32012-05-01 18:45:39 +00004115echo "gcov $gcov_tool"
4116echo "gcov enabled $gcov"
Stefan Bergerab214c22013-02-27 12:47:52 -05004117echo "TPM support $tpm"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004118echo "libssh2 support $libssh2"
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004119echo "TPM passthrough $tpm_passthrough"
Paolo Bonzini3556c232013-05-10 14:16:40 +02004120echo "QOM debugging $qom_cast_debug"
Jeff Cody4f18b782013-10-30 10:44:39 -04004121echo "vhdx $vhdx"
Benoît Canet95c6bff2014-02-21 22:21:15 +01004122echo "Quorum $quorum"
qiaonuohan607dacd2014-02-18 14:11:30 +08004123echo "lzo support $lzo"
4124echo "snappy support $snappy"
bellard67b915a2004-03-31 23:37:16 +00004125
Stefan Weil1ba16962011-07-29 22:40:45 +02004126if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00004127echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00004128fi
bellard97a847b2003-08-10 21:36:04 +00004129
Juan Quintela98ec69a2009-07-16 18:34:18 +02004130config_host_mak="config-host.mak"
bellard97a847b2003-08-10 21:36:04 +00004131
Stefan Weildbd99ae2013-01-01 18:33:44 +01004132echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4133
Juan Quintela98ec69a2009-07-16 18:34:18 +02004134echo "# Automatically generated by configure - do not modify" > $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004135echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004136
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02004137echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004138echo "prefix=$prefix" >> $config_host_mak
4139echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03004140echo "libdir=$libdir" >> $config_host_mak
Michael Tokarev8bf188a2012-06-07 01:11:00 +04004141echo "libexecdir=$libexecdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02004142echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004143echo "mandir=$mandir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004144echo "sysconfdir=$sysconfdir" >> $config_host_mak
Eduardo Habkost22d07032012-04-18 16:55:42 -03004145echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03004146echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4147echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
Fam Zhenge26110c2014-02-10 14:48:57 +08004148echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02004149if test "$mingw32" = "no" ; then
4150 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4151fi
Michael Tokarevf354b1a2012-10-21 22:52:54 +04004152echo "qemu_helperdir=$libexecdir" >> $config_host_mak
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +01004153echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4154echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
Anthony Liguori834574e2013-02-20 07:43:24 -06004155echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
Paolo Bonzinif544a482013-04-17 16:26:44 +02004156echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004157
Juan Quintela98ec69a2009-07-16 18:34:18 +02004158echo "ARCH=$ARCH" >> $config_host_mak
Paolo Bonzini727e5282013-04-17 16:26:43 +02004159
aurel32f8393942009-04-13 18:45:38 +00004160if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004161 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00004162fi
aliguori1625af82009-04-05 17:41:02 +00004163if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07004164 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00004165fi
bellard7d132992003-03-06 23:23:54 +00004166if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02004167 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00004168fi
bellard67b915a2004-03-31 23:37:16 +00004169if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004170 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00004171 rc_version=`cat $source_path/VERSION`
4172 version_major=${rc_version%%.*}
4173 rc_version=${rc_version#*.}
4174 version_minor=${rc_version%%.*}
4175 rc_version=${rc_version#*.}
4176 version_subminor=${rc_version%%.*}
4177 version_micro=0
4178 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4179 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004180 if test "$guest_agent_with_vss" = "yes" ; then
4181 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4182 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4183 fi
pbrook210fa552007-02-27 21:04:49 +00004184else
Juan Quintela35f4df22009-07-27 16:13:07 +02004185 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00004186fi
blueswir1128ab2f2008-08-15 18:33:42 +00004187
Mark McLoughlindffcb712009-10-22 17:49:11 +01004188if test "$linux" = "yes" ; then
4189 echo "CONFIG_LINUX=y" >> $config_host_mak
4190fi
4191
bellard83fb7ad2004-07-05 21:25:26 +00004192if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004193 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00004194fi
malcb29fe3e2008-11-18 01:42:22 +00004195
4196if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004197 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00004198fi
4199
bellardec530c82006-04-25 22:36:06 +00004200if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004201 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004202 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004203 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02004204 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004205 fi
bellardec530c82006-04-25 22:36:06 +00004206fi
Andreas Färber179cf402010-09-20 00:50:43 +02004207if test "$haiku" = "yes" ; then
4208 echo "CONFIG_HAIKU=y" >> $config_host_mak
4209fi
bellard97a847b2003-08-10 21:36:04 +00004210if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004211 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00004212fi
Stefan Weil1ba16962011-07-29 22:40:45 +02004213if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004214 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00004215fi
bellardc20709a2004-04-21 23:27:19 +00004216if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004217 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04004218 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00004219fi
ths8a16d272008-07-19 09:56:24 +00004220if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004221 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00004222fi
Vincenzo Maffione58952132013-11-06 11:44:06 +01004223if test "$netmap" = "yes" ; then
4224 echo "CONFIG_NETMAP=y" >> $config_host_mak
4225fi
Corey Bryant47e98652012-01-26 09:42:26 -05004226if test "$cap_ng" = "yes" ; then
4227 echo "CONFIG_LIBCAP=y" >> $config_host_mak
4228fi
Juan Quintela2358a492009-07-27 16:13:25 +02004229echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004230for drv in $audio_drv_list; do
Stefan Weilbb55b712012-03-27 19:23:53 +02004231 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004232 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00004233 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02004234 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004235 fi
4236done
Juan Quintela67f86e82009-08-03 14:46:59 +02004237if test "$audio_pt_int" = "yes" ; then
4238 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4239fi
malcd5631632009-10-10 01:13:41 +04004240if test "$audio_win_int" = "yes" ; then
4241 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4242fi
Fam Zhengb64ec4e2013-05-29 19:35:40 +08004243echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4244echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
Jes Sorensen821601e2011-03-16 13:33:36 +01004245if test "$vnc" = "yes" ; then
4246 echo "CONFIG_VNC=y" >> $config_host_mak
4247fi
ths8d5d2d42007-08-25 01:37:51 +00004248if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004249 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00004250fi
aliguori2f9606b2009-03-06 20:27:28 +00004251if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004252 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00004253fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004254if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004255 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004256fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004257if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02004258 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
Corentin Charyefe556a2010-07-07 20:57:56 +02004259fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01004260if test "$vnc_ws" = "yes" ; then
4261 echo "CONFIG_VNC_WS=y" >> $config_host_mak
4262 echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4263fi
aliguori76655d62009-03-06 20:27:37 +00004264if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004265 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00004266fi
Stefan Weilee682d22009-10-01 20:10:37 +02004267if test "$uuid" = "yes" ; then
4268 echo "CONFIG_UUID=y" >> $config_host_mak
4269fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01004270if test "$xfs" = "yes" ; then
4271 echo "CONFIG_XFS=y" >> $config_host_mak
4272fi
pbrookb1a550a2006-04-16 13:28:56 +00004273qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004274echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004275echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004276echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004277echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02004278if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004279 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00004280fi
Fam Zheng17969262014-02-10 14:48:56 +08004281if test "$modules" = "yes"; then
Fam Zhenge26110c2014-02-10 14:48:57 +08004282 # $shacmd can generate a hash started with digit, which the compiler doesn't
4283 # like as an symbol. So prefix it with an underscore
4284 echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08004285 echo "CONFIG_MODULES=y" >> $config_host_mak
4286fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02004287if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004288 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02004289 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004290fi
4291if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004292 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00004293fi
4294if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004295 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004296fi
Riku Voipioebc996f2009-04-21 15:01:51 +03004297if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004298 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03004299fi
Riku Voipio099d6b02009-05-05 12:10:04 +03004300if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004301 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03004302fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004303if test "$accept4" = "yes" ; then
4304 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4305fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304306if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004307 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304308fi
Riku Voipioc2882b92009-08-12 15:08:24 +03004309if test "$eventfd" = "yes" ; then
4310 echo "CONFIG_EVENTFD=y" >> $config_host_mak
4311fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004312if test "$fallocate" = "yes" ; then
4313 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4314fi
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01004315if test "$fallocate_punch_hole" = "yes" ; then
4316 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4317fi
Peter Maydellc727f472011-01-06 11:05:10 +00004318if test "$sync_file_range" = "yes" ; then
4319 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4320fi
Peter Maydelldace20d2011-01-10 13:11:24 +00004321if test "$fiemap" = "yes" ; then
4322 echo "CONFIG_FIEMAP=y" >> $config_host_mak
4323fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004324if test "$dup3" = "yes" ; then
4325 echo "CONFIG_DUP3=y" >> $config_host_mak
4326fi
Alex Bligh4e0c6522013-08-21 16:02:43 +01004327if test "$ppoll" = "yes" ; then
4328 echo "CONFIG_PPOLL=y" >> $config_host_mak
4329fi
Alex Blighcd758dd2013-08-21 16:02:44 +01004330if test "$prctl_pr_set_timerslack" = "yes" ; then
4331 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4332fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00004333if test "$epoll" = "yes" ; then
4334 echo "CONFIG_EPOLL=y" >> $config_host_mak
4335fi
4336if test "$epoll_create1" = "yes" ; then
4337 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4338fi
4339if test "$epoll_pwait" = "yes" ; then
4340 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4341fi
Peter Maydella8fd1ab2013-02-08 07:31:55 +00004342if test "$sendfile" = "yes" ; then
4343 echo "CONFIG_SENDFILE=y" >> $config_host_mak
4344fi
aurel323b3f24a2009-04-15 16:12:13 +00004345if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004346 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00004347fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00004348if test "$inotify1" = "yes" ; then
4349 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4350fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004351if test "$byteswap_h" = "yes" ; then
4352 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4353fi
4354if test "$bswap_h" = "yes" ; then
4355 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4356fi
Alexander Graf769ce762009-05-11 17:41:42 +02004357if test "$curl" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004358 echo "CONFIG_CURL=m" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02004359 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004360 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02004361fi
aurel322e4d9fb2008-04-08 06:01:02 +00004362if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004363 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00004364fi
balrogfb599c92008-09-28 23:49:55 +00004365if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004366 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02004367 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00004368fi
Anthony Liguorie18df142011-07-19 14:50:29 -05004369echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06004370if test "$gtk" = "yes" ; then
4371 echo "CONFIG_GTK=y" >> $config_host_mak
4372 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4373 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4374fi
aliguorie37630c2009-04-22 15:19:10 +00004375if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02004376 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00004377 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00004378fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004379if test "$linux_aio" = "yes" ; then
4380 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4381fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004382if test "$attr" = "yes" ; then
4383 echo "CONFIG_ATTR=y" >> $config_host_mak
4384fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02004385if test "$libattr" = "yes" ; then
4386 echo "CONFIG_LIBATTR=y" >> $config_host_mak
4387fi
Meador Inge983eef52012-02-24 14:00:42 +05304388if test "$virtfs" = "yes" ; then
4389 echo "CONFIG_VIRTFS=y" >> $config_host_mak
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004390fi
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00004391if test "$vhost_scsi" = "yes" ; then
4392 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4393fi
ths77755342008-11-27 15:45:16 +00004394if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004395 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00004396fi
aliguoribf9298b2008-12-05 20:05:26 +00004397if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004398 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00004399fi
aliguoriceb42de2009-04-07 18:43:28 +00004400if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004401 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00004402fi
aurel32f652e6a2008-12-16 10:43:48 +00004403if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02004404 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00004405fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004406if test "$signalfd" = "yes" ; then
4407 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4408fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02004409if test "$tcg_interpreter" = "yes" ; then
4410 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4411fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004412if test "$fdatasync" = "yes" ; then
4413 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4414fi
Andreas Färbere78815a2010-09-25 11:26:05 +00004415if test "$madvise" = "yes" ; then
4416 echo "CONFIG_MADVISE=y" >> $config_host_mak
4417fi
4418if test "$posix_madvise" = "yes" ; then
4419 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4420fi
Richard Henderson1e9737d2012-10-23 07:33:00 +10004421if test "$sigev_thread_id" = "yes" ; then
4422 echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4423fi
bellard97a847b2003-08-10 21:36:04 +00004424
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004425if test "$spice" = "yes" ; then
4426 echo "CONFIG_SPICE=y" >> $config_host_mak
4427fi
4428
Robert Relyea111a38b2010-11-28 16:36:38 +02004429if test "$smartcard_nss" = "yes" ; then
4430 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
Paul Brookad4cf3f2012-02-09 19:05:29 +00004431 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4432 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02004433fi
4434
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004435if test "$libusb" = "yes" ; then
4436 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4437fi
4438
Hans de Goede69354a82011-07-19 11:04:10 +02004439if test "$usb_redir" = "yes" ; then
4440 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4441fi
4442
Michael Walleb1e5fff2013-03-06 20:23:32 +01004443if test "$glx" = "yes" ; then
4444 echo "CONFIG_GLX=y" >> $config_host_mak
Paolo Bonzini2b6b7092013-04-17 16:26:45 +02004445 echo "GLX_LIBS=$glx_libs" >> $config_host_mak
Michael Walle20ff0752011-03-07 23:32:39 +01004446fi
4447
qiaonuohan607dacd2014-02-18 14:11:30 +08004448if test "$lzo" = "yes" ; then
4449 echo "CONFIG_LZO=y" >> $config_host_mak
4450fi
4451
4452if test "$snappy" = "yes" ; then
4453 echo "CONFIG_SNAPPY=y" >> $config_host_mak
4454fi
4455
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004456if test "$libiscsi" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004457 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
Stefan Weil219c2522013-12-17 08:57:10 +01004458 if test "$libiscsi_version" = "1.4.0"; then
4459 echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4460 fi
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004461 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
4462 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004463fi
4464
Peter Lieven6542aa92014-02-03 10:26:13 +01004465if test "$libnfs" = "yes" ; then
4466 echo "CONFIG_LIBNFS=y" >> $config_host_mak
4467fi
4468
Eduardo Otubof7945732012-08-14 18:44:05 -03004469if test "$seccomp" = "yes"; then
4470 echo "CONFIG_SECCOMP=y" >> $config_host_mak
4471fi
4472
bellard83fb7ad2004-07-05 21:25:26 +00004473# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00004474if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004475 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00004476fi
4477
Juan Quintela2358a492009-07-27 16:13:25 +02004478echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00004479
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004480if test "$zero_malloc" = "yes" ; then
4481 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4482fi
Paolo Bonzini3556c232013-05-10 14:16:40 +02004483if test "$qom_cast_debug" = "yes" ; then
4484 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4485fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004486if test "$rbd" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004487 echo "CONFIG_RBD=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004488 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
4489 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004490fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004491
Peter Maydell7c2acc72013-04-08 12:11:27 +01004492echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004493if test "$coroutine_pool" = "yes" ; then
4494 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4495else
4496 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4497fi
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304498
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05304499if test "$open_by_handle_at" = "yes" ; then
4500 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4501fi
4502
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05304503if test "$linux_magic_h" = "yes" ; then
4504 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4505fi
4506
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01004507if test "$pragma_diagnostic_available" = "yes" ; then
4508 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
Peter Maydell06d71fa2012-07-30 16:13:07 +01004509fi
4510
Kevin Wolf3f4349d2012-06-29 13:40:27 +02004511if test "$valgrind_h" = "yes" ; then
4512 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4513fi
4514
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03004515if test "$has_environ" = "yes" ; then
4516 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
4517fi
4518
Richard Henderson76a347e2012-12-28 14:17:02 -08004519if test "$cpuid_h" = "yes" ; then
4520 echo "CONFIG_CPUID_H=y" >> $config_host_mak
4521fi
4522
Richard Hendersonf5401662013-02-16 12:46:59 -08004523if test "$int128" = "yes" ; then
4524 echo "CONFIG_INT128=y" >> $config_host_mak
4525fi
4526
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08004527if test "$getauxval" = "yes" ; then
4528 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4529fi
4530
Bharata B Raoeb100392012-09-24 14:42:45 +05304531if test "$glusterfs" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004532 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004533 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
4534 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
Bharata B Raoeb100392012-09-24 14:42:45 +05304535fi
4536
Bharata B Rao0c14fb42013-07-16 21:47:42 +05304537if test "$glusterfs_discard" = "yes" ; then
4538 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
4539fi
4540
Bharata B Rao7c815372013-12-21 14:51:25 +05304541if test "$glusterfs_zerofill" = "yes" ; then
4542 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4543fi
4544
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004545if test "$libssh2" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004546 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004547 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4548 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004549fi
4550
Benoît Canet95c6bff2014-02-21 22:21:15 +01004551if test "$quorum" = "yes" ; then
4552 echo "CONFIG_QUORUM=y" >> $config_host_mak
4553fi
4554
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004555if test "$virtio_blk_data_plane" = "yes" ; then
Paolo Bonzini6e790742013-02-05 12:42:31 +01004556 echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004557fi
4558
Jeff Cody4f18b782013-10-30 10:44:39 -04004559if test "$vhdx" = "yes" ; then
4560 echo "CONFIG_VHDX=y" >> $config_host_mak
4561fi
4562
blueswir168063642008-11-22 21:03:55 +00004563# USB host support
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004564if test "$libusb" = "yes"; then
4565 echo "HOST_USB=libusb legacy" >> $config_host_mak
4566else
Juan Quintela98ec69a2009-07-16 18:34:18 +02004567 echo "HOST_USB=stub" >> $config_host_mak
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004568fi
blueswir168063642008-11-22 21:03:55 +00004569
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004570# TPM passthrough support?
4571if test "$tpm" = "yes"; then
4572 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4573 if test "$tpm_passthrough" = "yes"; then
4574 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4575 fi
4576fi
4577
Lluíse4858972011-08-31 20:31:03 +02004578# use default implementation for tracing backend-specific routines
4579trace_default=yes
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004580echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02004581if test "$trace_backend" = "nop"; then
4582 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05304583fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004584if test "$trace_backend" = "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02004585 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004586 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004587 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02004588 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01004589fi
Lluís6d8a7642011-08-31 20:30:43 +02004590if test "$trace_backend" = "stderr"; then
4591 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
Lluís9a82b6a2011-08-31 20:31:51 +02004592 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004593fi
4594if test "$trace_backend" = "ust"; then
4595 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4596fi
4597if test "$trace_backend" = "dtrace"; then
4598 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4599 if test "$trace_backend_stap" = "yes" ; then
4600 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4601 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00004602fi
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004603if test "$trace_backend" = "ftrace"; then
4604 if test "$linux" = "yes" ; then
4605 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4606 trace_default=no
4607 else
Stewart Smith21684af2014-01-24 12:39:10 +11004608 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004609 fi
4610fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004611echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004612if test "$trace_default" = "yes"; then
4613 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4614fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004615
Michael R. Hines2da776d2013-07-22 10:01:54 -04004616if test "$rdma" = "yes" ; then
4617 echo "CONFIG_RDMA=y" >> $config_host_mak
4618fi
4619
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004620if test "$tcg_interpreter" = "yes"; then
4621 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4622elif test "$ARCH" = "sparc64" ; then
4623 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4624elif test "$ARCH" = "s390x" ; then
4625 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004626elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004627 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4628else
4629 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4630fi
4631QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4632
Juan Quintela98ec69a2009-07-16 18:34:18 +02004633echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004634echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004635echo "MAKE=$make" >> $config_host_mak
4636echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04004637echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4638echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
Paolo Bonzini21655882012-12-20 18:57:45 +01004639if test -n "$libtool"; then
4640 echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4641 echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4642else
4643 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4644 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4645fi
Blue Swirlc886edf2011-07-22 21:08:09 +00004646echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004647echo "CC=$cc" >> $config_host_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03004648if $iasl -h > /dev/null 2>&1; then
4649 echo "IASL=$iasl" >> $config_host_mak
4650fi
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02004651echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004652echo "HOST_CC=$host_cc" >> $config_host_mak
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04004653echo "CXX=$cxx" >> $config_host_mak
Peter Maydell3c4a4d02012-08-11 22:34:40 +01004654echo "OBJCC=$objcc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004655echo "AR=$ar" >> $config_host_mak
Peter Maydell45d285a2013-10-21 21:03:06 +01004656echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00004657echo "AS=$as" >> $config_host_mak
4658echo "CPP=$cpp" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004659echo "OBJCOPY=$objcopy" >> $config_host_mak
4660echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00004661echo "WINDRES=$windres" >> $config_host_mak
Alon Levy44dc0ca2011-05-15 11:51:28 +03004662echo "LIBTOOL=$libtool" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004663echo "CFLAGS=$CFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004664echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02004665echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01004666echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01004667if test "$sparse" = "yes" ; then
4668 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
4669 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
4670 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4671fi
Gerd Hoffmann42da6042012-11-07 11:09:52 +01004672if test "$cross_prefix" != ""; then
4673 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
4674else
4675 echo "AUTOCONF_HOST := " >> $config_host_mak
4676fi
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004677echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004678echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
Marc-André Lureau37746c52013-02-25 23:31:12 +01004679echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02004680echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02004681echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004682echo "EXESUF=$EXESUF" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08004683echo "DSOSUF=$DSOSUF" >> $config_host_mak
4684echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05004685echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02004686echo "POD2MAN=$POD2MAN" >> $config_host_mak
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01004687echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
Blue Swirl1d728c32012-05-01 18:45:39 +00004688if test "$gcov" = "yes" ; then
4689 echo "CONFIG_GCOV=y" >> $config_host_mak
4690 echo "GCOV=$gcov_tool" >> $config_host_mak
4691fi
Juan Quintela804edf22009-07-27 16:12:49 +02004692
Peter Maydell6efd7512011-11-30 11:59:04 +00004693# use included Linux headers
4694if test "$linux" = "yes" ; then
Andreas Färbera307beb2012-06-14 15:14:33 +00004695 mkdir -p linux-headers
Peter Maydell6efd7512011-11-30 11:59:04 +00004696 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004697 i386|x86_64|x32)
Peter Maydell08312a62012-08-03 13:51:25 +01004698 linux_arch=x86
Peter Maydell6efd7512011-11-30 11:59:04 +00004699 ;;
4700 ppcemb|ppc|ppc64)
Peter Maydell08312a62012-08-03 13:51:25 +01004701 linux_arch=powerpc
Peter Maydell6efd7512011-11-30 11:59:04 +00004702 ;;
4703 s390x)
Peter Maydell08312a62012-08-03 13:51:25 +01004704 linux_arch=s390
4705 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +01004706 aarch64)
4707 linux_arch=arm64
4708 ;;
Peter Maydell08312a62012-08-03 13:51:25 +01004709 *)
4710 # For most CPUs the kernel architecture name and QEMU CPU name match.
4711 linux_arch="$cpu"
Peter Maydell6efd7512011-11-30 11:59:04 +00004712 ;;
4713 esac
Peter Maydell08312a62012-08-03 13:51:25 +01004714 # For non-KVM architectures we will not have asm headers
4715 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4716 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4717 fi
Peter Maydell6efd7512011-11-30 11:59:04 +00004718fi
4719
bellard1d14ffa2005-10-30 18:58:22 +00004720for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00004721target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02004722config_target_mak=$target_dir/config-target.mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004723target_name=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00004724target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02004725
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004726case "$target_name" in
Anthony Greend15a9c22013-03-18 15:49:25 -04004727 armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
Juan Quintelaea2d6a32009-07-16 18:34:10 +02004728 target_bigendian=yes
4729 ;;
4730esac
bellard97a847b2003-08-10 21:36:04 +00004731target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00004732target_user_only="no"
ths831b7822007-01-18 20:06:33 +00004733target_linux_user="no"
blueswir184778502008-10-26 20:33:16 +00004734target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00004735case "$target" in
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004736 ${target_name}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00004737 target_softmmu="yes"
4738 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004739 ${target_name}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00004740 if test "$linux" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004741 error_exit "Target '$target' is only available on a Linux host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004742 fi
pbrook9e407a82007-05-26 16:38:53 +00004743 target_user_only="yes"
4744 target_linux_user="yes"
4745 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004746 ${target_name}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00004747 if test "$bsd" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004748 error_exit "Target '$target' is only available on a BSD host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004749 fi
blueswir184778502008-10-26 20:33:16 +00004750 target_user_only="yes"
4751 target_bsd_user="yes"
4752 ;;
pbrook9e407a82007-05-26 16:38:53 +00004753 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004754 error_exit "Target '$target' not recognised"
pbrook9e407a82007-05-26 16:38:53 +00004755 exit 1
4756 ;;
4757esac
ths831b7822007-01-18 20:06:33 +00004758
bellard97a847b2003-08-10 21:36:04 +00004759mkdir -p $target_dir
Juan Quintela25be2102009-10-07 02:41:00 +02004760echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004761
pbrooke5fe0c52006-06-11 13:32:59 +00004762bflt="no"
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004763interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
pbrook56aebc82008-10-11 17:55:29 +00004764gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00004765
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004766TARGET_ARCH="$target_name"
Juan Quintela6acff7d2009-07-16 18:34:15 +02004767TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02004768TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02004769
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004770case "$target_name" in
aurel322408a522008-04-20 20:19:44 +00004771 i386)
aurel322408a522008-04-20 20:19:44 +00004772 ;;
4773 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004774 TARGET_BASE_ARCH=i386
aurel322408a522008-04-20 20:19:44 +00004775 ;;
4776 alpha)
aurel322408a522008-04-20 20:19:44 +00004777 ;;
4778 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004779 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00004780 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004781 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00004782 ;;
Alexander Graf6a49fa92013-09-03 20:12:22 +01004783 aarch64)
4784 TARGET_BASE_ARCH=arm
4785 bflt="yes"
Peter Maydell6a669422013-12-17 19:42:32 +00004786 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
Alexander Graf6a49fa92013-09-03 20:12:22 +01004787 ;;
aurel322408a522008-04-20 20:19:44 +00004788 cris)
aurel322408a522008-04-20 20:19:44 +00004789 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01004790 lm32)
Michael Walle613a22c2011-02-17 23:45:17 +01004791 ;;
aurel322408a522008-04-20 20:19:44 +00004792 m68k)
aurel322408a522008-04-20 20:19:44 +00004793 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004794 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00004795 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004796 microblaze|microblazeel)
4797 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004798 bflt="yes"
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004799 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02004800 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004801 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004802 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004803 ;;
4804 mipsn32|mipsn32el)
Richard Henderson597e2ce2013-02-10 10:30:50 -08004805 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004806 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004807 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Richard Henderson597e2ce2013-02-10 10:30:50 -08004808 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004809 ;;
4810 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004811 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004812 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004813 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004814 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004815 moxie)
4816 ;;
Jia Liue67db062012-07-20 15:50:39 +08004817 or32)
4818 TARGET_ARCH=openrisc
4819 TARGET_BASE_ARCH=openrisc
Jia Liue67db062012-07-20 15:50:39 +08004820 ;;
aurel322408a522008-04-20 20:19:44 +00004821 ppc)
aurel32c8b35322009-01-24 15:07:34 +00004822 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004823 ;;
4824 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004825 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004826 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004827 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004828 ;;
4829 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004830 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004831 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004832 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004833 ;;
4834 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004835 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004836 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004837 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02004838 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00004839 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004840 ;;
4841 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004842 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00004843 bflt="yes"
4844 ;;
4845 sparc)
aurel322408a522008-04-20 20:19:44 +00004846 ;;
4847 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004848 TARGET_BASE_ARCH=sparc
aurel322408a522008-04-20 20:19:44 +00004849 ;;
4850 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004851 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004852 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004853 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02004854 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004855 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01004856 s390x)
Alexander Graf24e804ec2009-12-05 12:44:22 +01004857 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004858 unicore32)
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004859 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04004860 xtensa|xtensaeb)
4861 TARGET_ARCH=xtensa
Max Filippovcfa550c2011-09-06 03:55:26 +04004862 ;;
aurel322408a522008-04-20 20:19:44 +00004863 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004864 error_exit "Unsupported target CPU"
aurel322408a522008-04-20 20:19:44 +00004865 ;;
4866esac
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004867# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4868if [ "$TARGET_BASE_ARCH" = "" ]; then
4869 TARGET_BASE_ARCH=$TARGET_ARCH
4870fi
4871
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004872symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4873
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004874upper() {
4875 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4876}
4877
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004878target_arch_name="`upper $TARGET_ARCH`"
Juan Quintela25be2102009-10-07 02:41:00 +02004879echo "TARGET_$target_arch_name=y" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004880echo "TARGET_NAME=$target_name" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02004881echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02004882if [ "$TARGET_ABI_DIR" = "" ]; then
4883 TARGET_ABI_DIR=$TARGET_ARCH
4884fi
Juan Quintela25be2102009-10-07 02:41:00 +02004885echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004886case "$target_name" in
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004887 i386|x86_64)
4888 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004889 echo "CONFIG_XEN=y" >> $config_target_mak
Anthony PERARDeb6fda02012-06-21 15:32:59 +00004890 if test "$xen_pci_passthrough" = yes; then
4891 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4892 fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004893 fi
Alexander Graf59d21e52011-07-17 07:30:29 +02004894 ;;
4895 *)
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004896esac
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004897case "$target_name" in
Peter Maydell70a5f682013-12-17 19:42:30 +00004898 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02004899 # Make sure the target and host cpus are compatible
4900 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004901 \( "$target_name" = "$cpu" -o \
4902 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4903 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
4904 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
4905 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4906 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
4907 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004908 echo "CONFIG_KVM=y" >> $config_target_mak
Stefan Weil1ba16962011-07-29 22:40:45 +02004909 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02004910 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4911 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02004912 fi
4913esac
bellardde83cd02003-06-15 20:25:43 +00004914if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004915 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004916fi
4917if test "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004918 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
bellardde83cd02003-06-15 20:25:43 +00004919fi
bellard997344f2003-10-27 21:10:39 +00004920if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004921 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01004922 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00004923fi
ths831b7822007-01-18 20:06:33 +00004924if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004925 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00004926fi
pbrook56aebc82008-10-11 17:55:29 +00004927list=""
4928if test ! -z "$gdb_xml_files" ; then
4929 for x in $gdb_xml_files; do
4930 list="$list $source_path/gdb-xml/$x"
4931 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02004932 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00004933fi
bellardde83cd02003-06-15 20:25:43 +00004934
pbrooke5fe0c52006-06-11 13:32:59 +00004935if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004936 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00004937fi
Paul Brook379f6692009-07-17 12:48:08 +01004938if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004939 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01004940fi
blueswir184778502008-10-26 20:33:16 +00004941if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004942 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00004943fi
bellard5b0753e2005-03-01 21:37:28 +00004944
Juan Quintela4afddb52009-08-03 14:46:45 +02004945# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02004946
Juan Quintela4afddb52009-08-03 14:46:45 +02004947cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02004948ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02004949
Juan Quintela64656022009-08-03 14:46:53 +02004950for i in $ARCH $TARGET_BASE_ARCH ; do
4951 case "$i" in
4952 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02004953 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004954 echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004955 ;;
4956 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02004957 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004958 echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
Claudio Fontana999b53e2014-02-05 17:27:28 +00004959 if test -n "${cxx}"; then
4960 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
4961 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
4962 fi
Juan Quintela64656022009-08-03 14:46:53 +02004963 ;;
4964 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02004965 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004966 echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004967 ;;
4968 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02004969 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004970 echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004971 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004972 i386|x86_64|x32)
Juan Quintela25be2102009-10-07 02:41:00 +02004973 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004974 echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004975 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02004976 ia64*)
4977 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004978 echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
Aurelien Jarno903ec552010-03-29 02:12:51 +02004979 ;;
Michael Walle79368f42012-03-31 19:54:20 +02004980 lm32)
4981 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004982 echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
Michael Walle79368f42012-03-31 19:54:20 +02004983 ;;
Juan Quintela64656022009-08-03 14:46:53 +02004984 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02004985 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004986 echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004987 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004988 microblaze*)
Juan Quintela25be2102009-10-07 02:41:00 +02004989 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004990 echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004991 ;;
4992 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02004993 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004994 echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004995 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004996 moxie*)
4997 echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
4998 echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
4999 ;;
Jia Liue67db062012-07-20 15:50:39 +08005000 or32)
5001 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005002 echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
Jia Liue67db062012-07-20 15:50:39 +08005003 ;;
Juan Quintela64656022009-08-03 14:46:53 +02005004 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02005005 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005006 echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005007 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01005008 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02005009 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005010 echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005011 ;;
5012 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02005013 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005014 echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005015 ;;
5016 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02005017 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005018 echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005019 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04005020 xtensa*)
5021 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005022 echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
Max Filippovcfa550c2011-09-06 03:55:26 +04005023 ;;
Juan Quintela64656022009-08-03 14:46:53 +02005024 esac
5025done
Stefan Weil9195b2c2011-10-19 07:07:18 +02005026if test "$tcg_interpreter" = "yes" ; then
5027 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005028 echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
Stefan Weil9195b2c2011-10-19 07:07:18 +02005029fi
Juan Quintela64656022009-08-03 14:46:53 +02005030
Juan Quintela6ee71262009-08-03 14:46:47 +02005031case "$ARCH" in
5032alpha)
5033 # Ensure there's only a single GP
5034 cflags="-msmall-data $cflags"
5035;;
5036esac
5037
Juan Quintelad02c1db2009-08-03 14:46:50 +02005038if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02005039 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02005040 if test "$target_linux_user" = "yes" ; then
5041 cflags="-p $cflags"
5042 ldflags="-p $ldflags"
5043 fi
5044 if test "$target_softmmu" = "yes" ; then
5045 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02005046 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02005047 fi
5048fi
5049
Juan Quintela9b8e1112009-08-03 14:46:46 +02005050if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07005051 ldflags="$ldflags $textseg_ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02005052fi
Juan Quintelafa282482009-07-22 22:37:39 +02005053
Juan Quintela25be2102009-10-07 02:41:00 +02005054echo "LDFLAGS+=$ldflags" >> $config_target_mak
5055echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02005056
bellard97a847b2003-08-10 21:36:04 +00005057done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00005058
Gerd Hoffmannb776eca2012-11-12 12:18:38 +01005059if [ "$pixman" = "internal" ]; then
5060 echo "config-host.h: subdir-pixman" >> $config_host_mak
5061fi
5062
Michael R. Hines2da776d2013-07-22 10:01:54 -04005063if test "$rdma" = "yes" ; then
5064echo "CONFIG_RDMA=y" >> $config_host_mak
5065fi
5066
Peter Crosthwaitea540f152013-04-18 14:47:31 +10005067if [ "$dtc_internal" = "yes" ]; then
5068 echo "config-host.h: subdir-dtc" >> $config_host_mak
5069fi
5070
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005071# build tree in object directory in case the source is not in the current directory
Wenchao Xiaf93296e2013-09-06 11:24:32 +08005072DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
Michael Tokarev2b170ef2013-10-21 12:33:58 +04005073DIRS="$DIRS fsdev"
Christian Borntraeger9933c302013-04-23 01:23:03 +00005074DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005075DIRS="$DIRS roms/seabios roms/vgabios"
Paolo Bonzini2dee8d52012-06-04 09:15:43 +02005076DIRS="$DIRS qapi-generated"
Anthony Liguoric09015d2012-01-10 13:10:42 -06005077FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5078FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
Andreas Färberaaa2ebc2013-07-06 20:41:37 +02005079FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005080FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02005081FILES="$FILES pc-bios/spapr-rtas/Makefile"
Christian Borntraeger9933c302013-04-23 01:23:03 +00005082FILES="$FILES pc-bios/s390-ccw/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005083FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka4652b792013-02-22 21:05:01 +01005084FILES="$FILES pc-bios/qemu-icon.bmp"
Richard Henderson753d11f2011-06-24 11:58:37 -07005085for bios_file in \
5086 $source_path/pc-bios/*.bin \
Gerd Hoffmann5acc2ec2012-12-03 10:45:49 +01005087 $source_path/pc-bios/*.aml \
Richard Henderson753d11f2011-06-24 11:58:37 -07005088 $source_path/pc-bios/*.rom \
5089 $source_path/pc-bios/*.dtb \
Dominik Dingele89e33e2013-04-29 04:52:06 +00005090 $source_path/pc-bios/*.img \
Richard Henderson753d11f2011-06-24 11:58:37 -07005091 $source_path/pc-bios/openbios-* \
5092 $source_path/pc-bios/palcode-*
5093do
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005094 FILES="$FILES pc-bios/`basename $bios_file`"
5095done
Marcel Apfelbaumc2304b52013-12-26 16:54:20 +02005096for test_file in `find $source_path/tests/acpi-test-data -type f`
5097do
5098 FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5099done
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005100mkdir -p $DIRS
5101for f in $FILES ; do
Stefan Weil72b8b5a2012-03-19 13:20:47 +01005102 if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
Peter Maydellf9245e12011-06-03 17:10:40 +01005103 symlink "$source_path/$f" "$f"
5104 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005105done
Paul Brook1ad21342009-05-19 16:17:58 +01005106
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005107# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06005108for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005109 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01005110 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005111 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00005112 echo "AS=$as" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005113 echo "CC=$cc" >> $config_mak
5114 echo "BCC=bcc" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00005115 echo "CPP=$cpp" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005116 echo "OBJCOPY=objcopy" >> $config_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03005117 echo "IASL=$iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005118 echo "LD=$ld" >> $config_mak
5119done
5120
Jan Kiszkab40292e2010-05-31 14:43:31 -03005121if test "$docs" = "yes" ; then
5122 mkdir -p QMP
5123fi