blob: 3ae57d7480e53266365a9ec783c4a155679458d4 [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
Peter Maydell76ad07a2013-04-08 12:11:26 +010034error_exit() {
35 echo
36 echo "ERROR: $1"
37 while test -n "$2"; do
38 echo " $2"
39 shift
40 done
41 echo
42 exit 1
43}
44
Peter Maydell9c83ffd2014-02-25 18:27:49 +000045do_compiler() {
46 # Run the compiler, capturing its output to the log. First argument
47 # is compiler binary to execute.
48 local compiler="$1"
49 shift
50 echo $compiler "$@" >> config.log
51 $compiler "$@" >> config.log 2>&1 || return $?
Peter Maydell8dc38a72012-07-18 15:10:28 +010052 # Test passed. If this is an --enable-werror build, rerun
53 # the test with -Werror and bail out if it fails. This
54 # makes warning-generating-errors in configure test code
55 # obvious to developers.
56 if test "$werror" != "yes"; then
57 return 0
58 fi
59 # Don't bother rerunning the compile if we were already using -Werror
60 case "$*" in
61 *-Werror*)
62 return 0
63 ;;
64 esac
Peter Maydell9c83ffd2014-02-25 18:27:49 +000065 echo $compiler -Werror "$@" >> config.log
66 $compiler -Werror "$@" >> config.log 2>&1 && return $?
Peter Maydell76ad07a2013-04-08 12:11:26 +010067 error_exit "configure test passed without -Werror but failed with -Werror." \
68 "This is probably a bug in the configure script. The failing command" \
69 "will be at the bottom of config.log." \
70 "You can run configure with --disable-werror to bypass this check."
Peter Maydell8dc38a72012-07-18 15:10:28 +010071}
72
Peter Maydell9c83ffd2014-02-25 18:27:49 +000073do_cc() {
74 do_compiler "$cc" "$@"
75}
76
77do_cxx() {
78 do_compiler "$cxx" "$@"
79}
80
81update_cxxflags() {
82 # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those
83 # options which some versions of GCC's C++ compiler complain about
84 # because they only make sense for C programs.
85 QEMU_CXXFLAGS=
86 for arg in $QEMU_CFLAGS; do
87 case $arg in
88 -Wstrict-prototypes|-Wmissing-prototypes|-Wnested-externs|\
89 -Wold-style-declaration|-Wold-style-definition|-Wredundant-decls)
90 ;;
91 *)
92 QEMU_CXXFLAGS=${QEMU_CXXFLAGS:+$QEMU_CXXFLAGS }$arg
93 ;;
94 esac
95 done
96}
97
Juan Quintela52166aa2009-08-03 14:46:03 +020098compile_object() {
Peter Maydell8dc38a72012-07-18 15:10:28 +010099 do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
Juan Quintela52166aa2009-08-03 14:46:03 +0200100}
101
102compile_prog() {
103 local_cflags="$1"
104 local_ldflags="$2"
Peter Maydell8dc38a72012-07-18 15:10:28 +0100105 do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
Juan Quintela52166aa2009-08-03 14:46:03 +0200106}
107
Don Slutz66518bf2014-01-02 21:12:46 -0500108do_libtool() {
109 local mode=$1
110 shift
111 # Run the compiler, capturing its output to the log.
112 echo $libtool $mode --tag=CC $cc "$@" >> config.log
113 $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $?
114 # Test passed. If this is an --enable-werror build, rerun
115 # the test with -Werror and bail out if it fails. This
116 # makes warning-generating-errors in configure test code
117 # obvious to developers.
118 if test "$werror" != "yes"; then
119 return 0
120 fi
121 # Don't bother rerunning the compile if we were already using -Werror
122 case "$*" in
123 *-Werror*)
124 return 0
125 ;;
126 esac
127 echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log
128 $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $?
129 error_exit "configure test passed without -Werror but failed with -Werror." \
130 "This is probably a bug in the configure script. The failing command" \
131 "will be at the bottom of config.log." \
132 "You can run configure with --disable-werror to bypass this check."
133}
134
135libtool_prog() {
136 do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $?
137 do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib
138}
139
Paolo Bonzini11568d62010-12-23 11:43:58 +0100140# symbolically link $1 to $2. Portable version of "ln -sf".
141symlink() {
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100142 rm -rf "$2"
Anthony Liguoriec5b06d2012-06-06 16:57:00 +0800143 mkdir -p "$(dirname "$2")"
Stefan Weil72b8b5a2012-03-19 13:20:47 +0100144 ln -s "$1" "$2"
Paolo Bonzini11568d62010-12-23 11:43:58 +0100145}
146
Loïc Minier0dba6192010-01-28 21:26:51 +0000147# check whether a command is available to this shell (may be either an
148# executable or a builtin)
149has() {
150 type "$1" >/dev/null 2>&1
151}
152
153# search for an executable in PATH
154path_of() {
155 local_command="$1"
156 local_ifs="$IFS"
157 local_dir=""
158
159 # pathname has a dir component?
160 if [ "${local_command#*/}" != "$local_command" ]; then
161 if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
162 echo "$local_command"
163 return 0
164 fi
165 fi
166 if [ -z "$local_command" ]; then
167 return 1
168 fi
169
170 IFS=:
171 for local_dir in $PATH; do
172 if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
173 echo "$local_dir/$local_command"
174 IFS="${local_ifs:-$(printf ' \t\n')}"
175 return 0
176 fi
177 done
178 # not found
179 IFS="${local_ifs:-$(printf ' \t\n')}"
180 return 1
181}
182
bellard7d132992003-03-06 23:23:54 +0000183# default parameters
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100184source_path=`dirname "$0"`
Juan Quintela2ff6b912009-08-03 14:45:55 +0200185cpu=""
Michael S. Tsirkina31a8642013-07-24 18:56:03 +0300186iasl="iasl"
bellard1e43adf2003-09-30 20:54:24 +0000187interp_prefix="/usr/gnemul/qemu-%M"
bellard43ce4df2003-06-09 19:53:12 +0000188static="no"
bellard7d132992003-03-06 23:23:54 +0000189cross_prefix=""
malc0c58ac12008-06-25 21:04:05 +0000190audio_drv_list=""
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800191block_drv_rw_whitelist=""
192block_drv_ro_whitelist=""
Peter Maydelle49d0212012-12-07 15:39:13 +0000193host_cc="cc"
Juan Quintela73da3752009-08-03 14:46:26 +0200194libs_softmmu=""
Juan Quintela3e2e0e62009-08-03 14:47:06 +0200195libs_tools=""
Juan Quintela67f86e82009-08-03 14:46:59 +0200196audio_pt_int=""
malcd5631632009-10-10 01:13:41 +0400197audio_win_int=""
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +0200198cc_i386=i386-pc-linux-gnu-gcc
Michael Roth957f1f92011-08-11 15:38:12 -0500199libs_qga=""
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100200debug_info="yes"
aliguoriac0df512008-12-29 17:14:15 +0000201
Stefan Weilafb63eb2012-09-26 22:04:38 +0200202# Don't accept a target_list environment variable.
203unset target_list
Paolo Bonzini377529c2010-12-23 11:43:50 +0100204
205# Default value for a variable defining feature "foo".
206# * foo="no" feature will only be used if --enable-foo arg is given
207# * foo="" feature will be searched for, and if found, will be used
208# unless --disable-foo is given
209# * foo="yes" this value will only be set by --enable-foo flag.
210# feature will searched for,
211# if not found, configure exits with error
212#
213# Always add --enable-foo and --disable-foo command line args.
214# Distributions want to ensure that several features are compiled in, and it
215# is impossible without a --enable-foo that exits if a feature is not found.
216
217bluez=""
218brlapi=""
219curl=""
220curses=""
221docs=""
222fdt=""
Vincenzo Maffione58952132013-11-06 11:44:06 +0100223netmap="no"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200224pixman=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100225sdl=""
Dave Airlie47c03742013-12-10 14:05:51 +1000226sdlabi="1.2"
Meador Inge983eef52012-02-24 14:00:42 +0530227virtfs=""
Jes Sorensen821601e2011-03-16 13:33:36 +0100228vnc="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100229sparse="no"
230uuid=""
231vde=""
232vnc_tls=""
233vnc_sasl=""
234vnc_jpeg=""
235vnc_png=""
Tim Hardeck7536ee42013-01-21 11:04:44 +0100236vnc_ws=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100237xen=""
Anthony PERARDd5b93dd2011-02-25 16:20:34 +0000238xen_ctrl_version=""
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000239xen_pci_passthrough=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100240linux_aio=""
Corey Bryant47e98652012-01-26 09:42:26 -0500241cap_ng=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100242attr=""
Avi Kivity4f26f2b2011-11-09 14:44:52 +0200243libattr=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100244xfs=""
245
Bradd41a75a2011-07-26 23:11:26 -0400246vhost_net="no"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000247vhost_scsi="no"
Bradd41a75a2011-07-26 23:11:26 -0400248kvm="no"
Michael R. Hines2da776d2013-07-22 10:01:54 -0400249rdma=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100250gprof="no"
251debug_tcg="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100252debug="no"
253strip_opt="yes"
Stefan Weil9195b2c2011-10-19 07:07:18 +0200254tcg_interpreter="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100255bigendian="no"
256mingw32="no"
Blue Swirl1d728c32012-05-01 18:45:39 +0000257gcov="no"
258gcov_tool="gcov"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100259EXESUF=""
Fam Zheng17969262014-02-10 14:48:56 +0800260DSOSUF=".so"
261LDFLAGS_SHARED="-shared"
262modules="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100263prefix="/usr/local"
264mandir="\${prefix}/share/man"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300265datadir="\${prefix}/share"
Eduardo Habkost850da182012-04-18 16:55:38 -0300266qemu_docdir="\${prefix}/share/doc/qemu"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100267bindir="\${prefix}/bin"
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300268libdir="\${prefix}/lib"
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400269libexecdir="\${prefix}/libexec"
Alon Levy0f94d6d2011-06-27 11:58:20 +0200270includedir="\${prefix}/include"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100271sysconfdir="\${prefix}/etc"
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300272local_statedir="\${prefix}/var"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100273confsuffix="/qemu"
274slirp="yes"
275fmod_lib=""
276fmod_inc=""
277oss_lib=""
278bsd="no"
279linux="no"
280solaris="no"
281profiler="no"
282cocoa="no"
283softmmu="yes"
284linux_user="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100285bsd_user="no"
Peter Maydell30163d82012-10-09 03:16:49 +0000286guest_base="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100287uname_release=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100288aix="no"
289blobs="yes"
290pkgversion=""
Avi Kivity40d64442011-11-15 20:12:17 +0200291pie=""
Paolo Bonzini377529c2010-12-23 11:43:50 +0100292zero_malloc=""
Paolo Bonzini3556c232013-05-10 14:16:40 +0200293qom_cast_debug="yes"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100294trace_backend="nop"
295trace_file="trace"
296spice=""
297rbd=""
Robert Relyea111a38b2010-11-28 16:36:38 +0200298smartcard_nss=""
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +0100299libusb=""
Hans de Goede69354a82011-07-19 11:04:10 +0200300usb_redir=""
Michael Walleb1e5fff2013-03-06 20:23:32 +0100301glx=""
Alon Levy1ece9902011-07-26 12:30:40 +0300302zlib="yes"
qiaonuohan607dacd2014-02-18 14:11:30 +0800303lzo="no"
304snappy="no"
Michael Tokareve8ef31a2013-07-31 14:22:07 +0400305guest_agent=""
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -0400306guest_agent_with_vss="no"
307vss_win32_sdk=""
308win_sdk="no"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +0100309want_tools="yes"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100310libiscsi=""
Peter Lieven6542aa92014-02-03 10:26:13 +0100311libnfs=""
Alex Barcelo519175a2012-02-28 12:25:50 +0100312coroutine=""
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200313coroutine_pool=""
Eduardo Otubof7945732012-08-14 18:44:05 -0300314seccomp=""
Bharata B Raoeb100392012-09-24 14:42:45 +0530315glusterfs=""
Bharata B Rao0c14fb42013-07-16 21:47:42 +0530316glusterfs_discard="no"
Bharata B Rao7c815372013-12-21 14:51:25 +0530317glusterfs_zerofill="no"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +0100318virtio_blk_data_plane=""
Anthony Liguoria4ccabc2013-02-20 07:43:20 -0600319gtk=""
Daniel P. Berrange528de902013-02-25 15:20:44 +0000320gtkabi="2.0"
Stefan Bergerab214c22013-02-27 12:47:52 -0500321tpm="no"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +0100322libssh2=""
Jeff Cody4f18b782013-10-30 10:44:39 -0400323vhdx=""
Benoît Canet95c6bff2014-02-21 22:21:15 +0100324quorum="no"
Paolo Bonzini377529c2010-12-23 11:43:50 +0100325
aliguoriac0df512008-12-29 17:14:15 +0000326# parse CC options first
327for opt do
328 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
329 case "$opt" in
330 --cross-prefix=*) cross_prefix="$optarg"
331 ;;
Paolo Bonzini3d8df642010-12-23 11:43:48 +0100332 --cc=*) CC="$optarg"
aliguoriac0df512008-12-29 17:14:15 +0000333 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400334 --cxx=*) CXX="$optarg"
335 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100336 --source-path=*) source_path="$optarg"
337 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200338 --cpu=*) cpu="$optarg"
339 ;;
Juan Quintelaa558ee12009-08-03 14:46:21 +0200340 --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100341 EXTRA_CFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200342 ;;
343 --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +0100344 EXTRA_LDFLAGS="$optarg"
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200345 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100346 --enable-debug-info) debug_info="yes"
347 ;;
348 --disable-debug-info) debug_info="no"
349 ;;
aliguoriac0df512008-12-29 17:14:15 +0000350 esac
351done
aliguoriac0df512008-12-29 17:14:15 +0000352# OS specific
353# Using uname is really, really broken. Once we have the right set of checks
Stefan Weil93148aa2012-02-26 18:46:12 +0100354# we can eliminate its usage altogether.
aliguoriac0df512008-12-29 17:14:15 +0000355
Peter Maydelle49d0212012-12-07 15:39:13 +0000356# Preferred compiler:
357# ${CC} (if set)
358# ${cross_prefix}gcc (if cross-prefix specified)
359# system compiler
360if test -z "${CC}${cross_prefix}"; then
361 cc="$host_cc"
362else
363 cc="${CC-${cross_prefix}gcc}"
364fi
365
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400366if test -z "${CXX}${cross_prefix}"; then
367 cxx="c++"
368else
369 cxx="${CXX-${cross_prefix}g++}"
370fi
371
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500372ar="${AR-${cross_prefix}ar}"
Blue Swirl3dd46c72013-01-05 10:10:27 +0000373as="${AS-${cross_prefix}as}"
374cpp="${CPP-$cc -E}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500375objcopy="${OBJCOPY-${cross_prefix}objcopy}"
376ld="${LD-${cross_prefix}ld}"
Brad3f534582011-08-13 20:30:14 -0400377libtool="${LIBTOOL-${cross_prefix}libtool}"
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500378strip="${STRIP-${cross_prefix}strip}"
379windres="${WINDRES-${cross_prefix}windres}"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300380pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
381query_pkg_config() {
382 "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
383}
384pkg_config=query_pkg_config
Stuart Yoderb3198cc2011-08-04 17:10:08 -0500385sdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
Dave Airlie47c03742013-12-10 14:05:51 +1000386sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
aliguoriac0df512008-12-29 17:14:15 +0000387
Peter Maydell45d285a2013-10-21 21:03:06 +0100388# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
389ARFLAGS="${ARFLAGS-rv}"
390
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200391# default flags for all hosts
Peter Maydell4c288ac2014-02-26 21:53:30 +0000392QEMU_CFLAGS="-fno-strict-aliasing -fno-common $QEMU_CFLAGS"
Mike Frysingerf9188222011-05-17 17:08:43 -0400393QEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
Kevin Wolfc95e3082013-02-22 21:08:51 +0100394QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200395QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
Paolo Bonzini6b4c3052012-10-24 13:12:00 +0200396QEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100397if test "$debug_info" = "yes"; then
398 CFLAGS="-g $CFLAGS"
399 LDFLAGS="-g $LDFLAGS"
400fi
Michael S. Tsirkinbe17dc92009-11-11 13:50:09 +0200401
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100402# make source path absolute
403source_path=`cd "$source_path"; pwd`
404
aliguoriac0df512008-12-29 17:14:15 +0000405check_define() {
406cat > $TMPC <<EOF
407#if !defined($1)
Peter Maydellfd786e12011-11-23 17:26:43 +0000408#error $1 not defined
aliguoriac0df512008-12-29 17:14:15 +0000409#endif
410int main(void) { return 0; }
411EOF
Juan Quintela52166aa2009-08-03 14:46:03 +0200412 compile_object
aliguoriac0df512008-12-29 17:14:15 +0000413}
414
Peter Maydellbbea4052012-08-14 15:35:34 +0100415if check_define __linux__ ; then
416 targetos="Linux"
417elif check_define _WIN32 ; then
418 targetos='MINGW32'
419elif check_define __OpenBSD__ ; then
420 targetos='OpenBSD'
421elif check_define __sun__ ; then
422 targetos='SunOS'
423elif check_define __HAIKU__ ; then
424 targetos='Haiku'
425else
426 targetos=`uname -s`
427fi
428
429# Some host OSes need non-standard checks for which CPU to use.
430# Note that these checks are broken for cross-compilation: if you're
431# cross-compiling to one of these OSes then you'll need to specify
432# the correct CPU with the --cpu option.
433case $targetos in
434Darwin)
435 # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
436 # run 64-bit userspace code.
437 # If the user didn't specify a CPU explicitly and the kernel says this is
438 # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
439 if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
440 cpu="x86_64"
441 fi
442 ;;
443SunOS)
444 # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
445 if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
446 cpu="x86_64"
447 fi
448esac
449
Juan Quintela2ff6b912009-08-03 14:45:55 +0200450if test ! -z "$cpu" ; then
451 # command line argument
452 :
453elif check_define __i386__ ; then
aliguoriac0df512008-12-29 17:14:15 +0000454 cpu="i386"
455elif check_define __x86_64__ ; then
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700456 if check_define __ILP32__ ; then
457 cpu="x32"
458 else
459 cpu="x86_64"
460 fi
blueswir13aa9bd62008-12-31 16:55:26 +0000461elif check_define __sparc__ ; then
blueswir13aa9bd62008-12-31 16:55:26 +0000462 if check_define __arch64__ ; then
463 cpu="sparc64"
464 else
465 cpu="sparc"
466 fi
malcfdf7ed92009-01-14 18:39:52 +0000467elif check_define _ARCH_PPC ; then
468 if check_define _ARCH_PPC64 ; then
469 cpu="ppc64"
470 else
471 cpu="ppc"
472 fi
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200473elif check_define __mips__ ; then
474 cpu="mips"
Aurelien Jarno477ba622010-03-29 02:12:51 +0200475elif check_define __ia64__ ; then
476 cpu="ia64"
Aurelien Jarnod66ed0e2010-06-13 12:28:21 +0200477elif check_define __s390__ ; then
478 if check_define __s390x__ ; then
479 cpu="s390x"
480 else
481 cpu="s390"
482 fi
Peter Maydell21d89f82011-11-30 10:57:48 +0100483elif check_define __arm__ ; then
484 cpu="arm"
Claudio Fontana1f080312013-06-12 16:20:23 +0100485elif check_define __aarch64__ ; then
486 cpu="aarch64"
Bradf28ffed2011-09-07 21:24:56 -0400487elif check_define __hppa__ ; then
488 cpu="hppa"
aliguoriac0df512008-12-29 17:14:15 +0000489else
malcfdf7ed92009-01-14 18:39:52 +0000490 cpu=`uname -m`
aliguoriac0df512008-12-29 17:14:15 +0000491fi
492
Peter Maydell359bc952011-12-24 13:07:25 +0000493ARCH=
494# Normalise host CPU name and set ARCH.
495# Note that this case should only have supported host CPUs, not guests.
bellard7d132992003-03-06 23:23:54 +0000496case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700497 ia64|ppc|ppc64|s390|s390x|sparc64|x32)
Juan Quintelaea8f20f2009-08-03 14:46:12 +0200498 cpu="$cpu"
499 ;;
bellard7d132992003-03-06 23:23:54 +0000500 i386|i486|i586|i686|i86pc|BePC)
bellard97a847b2003-08-10 21:36:04 +0000501 cpu="i386"
bellard7d132992003-03-06 23:23:54 +0000502 ;;
aurel32aaa5fa12008-04-11 22:04:22 +0000503 x86_64|amd64)
504 cpu="x86_64"
505 ;;
Peter Maydell21d89f82011-11-30 10:57:48 +0100506 armv*b|armv*l|arm)
507 cpu="arm"
bellard7d132992003-03-06 23:23:54 +0000508 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +0100509 aarch64)
510 cpu="aarch64"
511 ;;
Aurelien Jarnoafa05232009-10-17 14:17:47 +0200512 mips*)
513 cpu="mips"
514 ;;
blueswir131422552007-04-16 18:27:06 +0000515 sparc|sun4[cdmuv])
bellardae228532003-05-13 18:59:59 +0000516 cpu="sparc"
517 ;;
bellard7d132992003-03-06 23:23:54 +0000518 *)
Peter Maydell359bc952011-12-24 13:07:25 +0000519 # This will result in either an error or falling back to TCI later
520 ARCH=unknown
bellard7d132992003-03-06 23:23:54 +0000521 ;;
522esac
Peter Maydell359bc952011-12-24 13:07:25 +0000523if test -z "$ARCH"; then
524 ARCH="$cpu"
525fi
Juan Quintelae2d52ad2009-08-12 18:20:24 +0200526
bellard7d132992003-03-06 23:23:54 +0000527# OS specific
Juan Quintela0dbfc672009-08-03 14:46:13 +0200528
bellard7d132992003-03-06 23:23:54 +0000529case $targetos in
bellardc326e0a2005-04-23 18:30:28 +0000530CYGWIN*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200531 mingw32="yes"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200532 QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
malcd5631632009-10-10 01:13:41 +0400533 audio_possible_drivers="winwave sdl"
534 audio_drv_list="winwave"
bellardc326e0a2005-04-23 18:30:28 +0000535;;
bellard67b915a2004-03-31 23:37:16 +0000536MINGW32*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200537 mingw32="yes"
malcd5631632009-10-10 01:13:41 +0400538 audio_possible_drivers="winwave dsound sdl fmod"
539 audio_drv_list="winwave"
bellard67b915a2004-03-31 23:37:16 +0000540;;
ths5c40d2b2007-06-23 16:03:36 +0000541GNU/kFreeBSD)
Aurelien Jarnoa167ba52009-11-29 18:00:41 +0100542 bsd="yes"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200543 audio_drv_list="oss"
544 audio_possible_drivers="oss sdl esd pa"
ths5c40d2b2007-06-23 16:03:36 +0000545;;
bellard7d3505c2004-05-12 19:32:15 +0000546FreeBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200547 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100548 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200549 audio_drv_list="oss"
550 audio_possible_drivers="oss sdl esd pa"
Juergen Lockf01576f2010-03-25 22:32:16 +0100551 # needed for kinfo_getvmmap(3) in libutil.h
552 LIBS="-lutil $LIBS"
Vincenzo Maffione58952132013-11-06 11:44:06 +0100553 netmap="" # enable netmap autodetect
bellard7d3505c2004-05-12 19:32:15 +0000554;;
blueswir1c5e97232009-03-07 20:06:23 +0000555DragonFly)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200556 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100557 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200558 audio_drv_list="oss"
559 audio_possible_drivers="oss sdl esd pa"
blueswir1c5e97232009-03-07 20:06:23 +0000560;;
bellard7d3505c2004-05-12 19:32:15 +0000561NetBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200562 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100563 make="${MAKE-gmake}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200564 audio_drv_list="oss"
565 audio_possible_drivers="oss sdl esd"
566 oss_lib="-lossaudio"
bellard7d3505c2004-05-12 19:32:15 +0000567;;
568OpenBSD)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200569 bsd="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100570 make="${MAKE-gmake}"
Brad Smith4f6ab392013-05-24 19:01:07 -0400571 audio_drv_list="sdl"
572 audio_possible_drivers="sdl esd"
bellard7d3505c2004-05-12 19:32:15 +0000573;;
bellard83fb7ad2004-07-05 21:25:26 +0000574Darwin)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200575 bsd="yes"
576 darwin="yes"
Fam Zheng17969262014-02-10 14:48:56 +0800577 LDFLAGS_SHARED="-bundle -undefined dynamic_lookup"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200578 if [ "$cpu" = "x86_64" ] ; then
Juan Quintelaa558ee12009-08-03 14:46:21 +0200579 QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +0200580 LDFLAGS="-arch x86_64 $LDFLAGS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200581 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200582 cocoa="yes"
583 audio_drv_list="coreaudio"
584 audio_possible_drivers="coreaudio sdl fmod"
585 LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
Juan Quintela7973f212009-08-03 14:47:09 +0200586 libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
Peter Maydella0b7cf62012-08-11 22:34:39 +0100587 # Disable attempts to use ObjectiveC features in os/object.h since they
588 # won't work when we're compiling with gcc as a C compiler.
589 QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
bellard83fb7ad2004-07-05 21:25:26 +0000590;;
bellardec530c82006-04-25 22:36:06 +0000591SunOS)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200592 solaris="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100593 make="${MAKE-gmake}"
594 install="${INSTALL-ginstall}"
Blue Swirlfa589482009-10-02 19:38:25 +0000595 ld="gld"
Brade2d88302011-09-02 16:53:28 -0400596 smbd="${SMBD-/usr/sfw/sbin/smbd}"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200597 needs_libsunmath="no"
598 solarisrev=`uname -r | cut -f2 -d.`
Juan Quintela0dbfc672009-08-03 14:46:13 +0200599 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
600 if test "$solarisrev" -le 9 ; then
601 if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
602 needs_libsunmath="yes"
Juan Quintelaf14bfdf2009-08-03 14:47:11 +0200603 QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
604 LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
605 LIBS="-lsunmath $LIBS"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200606 else
Peter Maydell76ad07a2013-04-08 12:11:26 +0100607 error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
608 "libsunmath from the Sun Studio compilers tools, due to a lack of" \
609 "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
610 "Studio 11 can be downloaded from www.sun.com."
Juan Quintela0dbfc672009-08-03 14:46:13 +0200611 fi
thsef18c882007-09-16 22:12:39 +0000612 fi
Juan Quintela0dbfc672009-08-03 14:46:13 +0200613 fi
614 if test -f /usr/include/sys/soundcard.h ; then
615 audio_drv_list="oss"
616 fi
617 audio_possible_drivers="oss sdl"
Blue Swirld7414292009-09-12 12:36:04 +0000618# needed for CMSG_ macros in sys/socket.h
619 QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
620# needed for TIOCWIN* defines in termios.h
621 QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200622 QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
Andreas Färber560d3752012-04-30 18:00:55 +0200623 solarisnetlibs="-lsocket -lnsl -lresolv"
624 LIBS="$solarisnetlibs $LIBS"
625 libs_qga="$solarisnetlibs $libs_qga"
ths86b2bd92007-02-11 00:31:33 +0000626;;
malcb29fe3e2008-11-18 01:42:22 +0000627AIX)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200628 aix="yes"
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100629 make="${MAKE-gmake}"
malcb29fe3e2008-11-18 01:42:22 +0000630;;
Andreas Färber179cf402010-09-20 00:50:43 +0200631Haiku)
632 haiku="yes"
633 QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
634 LIBS="-lposix_error_mapper -lnetwork $LIBS"
635;;
bellard1d14ffa2005-10-30 18:58:22 +0000636*)
Juan Quintela0dbfc672009-08-03 14:46:13 +0200637 audio_drv_list="oss"
638 audio_possible_drivers="oss alsa sdl esd pa"
639 linux="yes"
640 linux_user="yes"
Jan Kiszkaaf2be202011-06-23 10:05:12 +0200641 kvm="yes"
642 vhost_net="yes"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000643 vhost_scsi="yes"
Richard Hendersonc72b26e2013-08-20 12:20:05 -0700644 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
malcc2de5c92008-06-28 19:13:06 +0000645 audio_possible_drivers="$audio_possible_drivers fmod"
Juan Quintela0dbfc672009-08-03 14:46:13 +0200646 fi
Alexey Kardashevskiya5851402013-05-29 23:30:43 +1000647 QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
bellardfb065182004-11-09 23:09:44 +0000648;;
bellard7d132992003-03-06 23:23:54 +0000649esac
650
bellard7d3505c2004-05-12 19:32:15 +0000651if [ "$bsd" = "yes" ] ; then
pbrookb1a550a2006-04-16 13:28:56 +0000652 if [ "$darwin" != "yes" ] ; then
Andreas Färber08de3942012-04-26 11:57:39 +0200653 bsd_user="yes"
bellard83fb7ad2004-07-05 21:25:26 +0000654 fi
bellard7d3505c2004-05-12 19:32:15 +0000655fi
656
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100657: ${make=${MAKE-make}}
658: ${install=${INSTALL-install}}
Stefan Weil52510f82013-11-14 19:07:03 +0100659: ${python=${PYTHON-python}}
Brade2d88302011-09-02 16:53:28 -0400660: ${smbd=${SMBD-/usr/sbin/smbd}}
Paolo Bonzini0db4a062010-12-23 11:43:49 +0100661
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100662# Default objcc to clang if available, otherwise use CC
663if has clang; then
664 objcc=clang
665else
666 objcc="$cc"
667fi
668
Juan Quintela3457a3f2009-08-03 14:46:07 +0200669if test "$mingw32" = "yes" ; then
Juan Quintela3457a3f2009-08-03 14:46:07 +0200670 EXESUF=".exe"
Fam Zheng17969262014-02-10 14:48:56 +0800671 DSOSUF=".dll"
Juan Quintelaa558ee12009-08-03 14:46:21 +0200672 QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Stefan Weile94a7932010-02-12 11:02:08 +0100673 # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
674 QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
Stefan Weilf7cf5d52012-03-10 11:14:32 +0100675 LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
676cat > $TMPC << EOF
677int main(void) { return 0; }
678EOF
679 if compile_prog "" "-liberty" ; then
680 LIBS="-liberty $LIBS"
681 fi
Stefan Weilc5ec15e2012-04-07 09:23:38 +0200682 prefix="c:/Program Files/QEMU"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200683 mandir="\${prefix}"
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300684 datadir="\${prefix}"
Eduardo Habkost850da182012-04-18 16:55:38 -0300685 qemu_docdir="\${prefix}"
Paolo Bonzini683035d2010-05-26 16:08:28 +0200686 bindir="\${prefix}"
687 sysconfdir="\${prefix}"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +0200688 local_statedir=
Paolo Bonzini683035d2010-05-26 16:08:28 +0200689 confsuffix=""
Stefan Hajnoczi368542b2012-03-27 08:26:18 +0100690 libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
Juan Quintela3457a3f2009-08-03 14:46:07 +0200691fi
692
Anthony Liguori487fefd2009-06-11 13:28:25 -0500693werror=""
bellard85aa5182007-11-11 20:17:03 +0000694
bellard7d132992003-03-06 23:23:54 +0000695for opt do
pbrooka46e4032006-04-29 23:05:22 +0000696 optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
bellard7d132992003-03-06 23:23:54 +0000697 case "$opt" in
bellard2efc3262005-12-18 19:14:49 +0000698 --help|-h) show_help=yes
699 ;;
Mike Frysinger99123e12011-04-07 01:12:28 -0400700 --version|-V) exec cat $source_path/VERSION
701 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000702 --prefix=*) prefix="$optarg"
bellard7d132992003-03-06 23:23:54 +0000703 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000704 --interp-prefix=*) interp_prefix="$optarg"
bellard32ce6332003-04-11 00:16:16 +0000705 ;;
Paolo Bonzinica4deeb2010-12-23 11:44:00 +0100706 --source-path=*)
bellard7d132992003-03-06 23:23:54 +0000707 ;;
aliguoriac0df512008-12-29 17:14:15 +0000708 --cross-prefix=*)
bellard7d132992003-03-06 23:23:54 +0000709 ;;
aliguoriac0df512008-12-29 17:14:15 +0000710 --cc=*)
bellard7d132992003-03-06 23:23:54 +0000711 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000712 --host-cc=*) host_cc="$optarg"
bellard83469012005-07-23 14:27:54 +0000713 ;;
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -0400714 --cxx=*)
715 ;;
Michael S. Tsirkine007dbe2013-11-24 11:38:05 +0200716 --iasl=*) iasl="$optarg"
717 ;;
Peter Maydell3c4a4d02012-08-11 22:34:40 +0100718 --objcc=*) objcc="$optarg"
719 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000720 --make=*) make="$optarg"
bellard7d132992003-03-06 23:23:54 +0000721 ;;
pbrook6a882642006-04-17 13:57:12 +0000722 --install=*) install="$optarg"
723 ;;
Blue Swirlc886edf2011-07-22 21:08:09 +0000724 --python=*) python="$optarg"
725 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000726 --gcov=*) gcov_tool="$optarg"
727 ;;
Brade2d88302011-09-02 16:53:28 -0400728 --smbd=*) smbd="$optarg"
729 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200730 --extra-cflags=*)
bellard7d132992003-03-06 23:23:54 +0000731 ;;
Juan Quintelae2a2ed02009-08-03 14:46:02 +0200732 --extra-ldflags=*)
bellard7d132992003-03-06 23:23:54 +0000733 ;;
Gerd Hoffmann5bc62e02012-02-08 13:54:13 +0100734 --enable-debug-info)
735 ;;
736 --disable-debug-info)
737 ;;
Fam Zheng17969262014-02-10 14:48:56 +0800738 --enable-modules)
739 modules="yes"
740 ;;
Juan Quintela2ff6b912009-08-03 14:45:55 +0200741 --cpu=*)
bellard7d132992003-03-06 23:23:54 +0000742 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000743 --target-list=*) target_list="$optarg"
bellardde83cd02003-06-15 20:25:43 +0000744 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100745 --enable-trace-backend=*) trace_backend="$optarg"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +0100746 ;;
Paolo Bonzini74242e02010-12-23 11:44:02 +0100747 --with-trace-file=*) trace_file="$optarg"
Prerna Saxena9410b562010-07-13 09:26:32 +0100748 ;;
bellard7d132992003-03-06 23:23:54 +0000749 --enable-gprof) gprof="yes"
750 ;;
Blue Swirl1d728c32012-05-01 18:45:39 +0000751 --enable-gcov) gcov="yes"
752 ;;
Loïc Minier79427692010-01-31 12:23:45 +0100753 --static)
754 static="yes"
755 LDFLAGS="-static $LDFLAGS"
Sergei Trofimovich17884d72012-01-31 22:03:45 +0300756 QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
bellard43ce4df2003-06-09 19:53:12 +0000757 ;;
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200758 --mandir=*) mandir="$optarg"
759 ;;
760 --bindir=*) bindir="$optarg"
761 ;;
Alon Levy3aa5d2b2011-05-15 12:08:59 +0300762 --libdir=*) libdir="$optarg"
763 ;;
Michael Tokarev8bf188a2012-06-07 01:11:00 +0400764 --libexecdir=*) libexecdir="$optarg"
765 ;;
Alon Levy0f94d6d2011-06-27 11:58:20 +0200766 --includedir=*) includedir="$optarg"
767 ;;
Eduardo Habkost528ae5b2012-04-18 16:55:49 -0300768 --datadir=*) datadir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200769 ;;
Eduardo Habkost023d3d62012-04-18 16:55:50 -0300770 --with-confsuffix=*) confsuffix="$optarg"
771 ;;
Eduardo Habkost850da182012-04-18 16:55:38 -0300772 --docdir=*) qemu_docdir="$optarg"
Paolo Bonzini0b24e752010-05-26 16:08:26 +0200773 ;;
Andre Przywaraca2fb932010-03-08 14:09:48 +0100774 --sysconfdir=*) sysconfdir="$optarg"
Anthony Liguori07381cc2010-01-21 10:30:29 -0600775 ;;
Luiz Capitulino785c23a2012-10-03 18:35:57 -0300776 --localstatedir=*) local_statedir="$optarg"
777 ;;
778 --sbindir=*|--sharedstatedir=*|\
Max Filippov023ddd72011-11-24 16:11:31 +0400779 --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
780 --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
781 # These switches are silently ignored, for compatibility with
782 # autoconf-generated configure scripts. This allows QEMU's
783 # configure to be used by RPM and similar macros that set
784 # lots of directory switches by default.
785 ;;
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +0200786 --with-system-pixman) pixman="system"
787 ;;
788 --without-system-pixman) pixman="internal"
789 ;;
Robert Schiele74880fe2012-12-04 16:58:08 +0100790 --without-pixman) pixman="none"
791 ;;
bellard97a847b2003-08-10 21:36:04 +0000792 --disable-sdl) sdl="no"
793 ;;
Juan Quintelac4198152009-08-12 18:29:53 +0200794 --enable-sdl) sdl="yes"
795 ;;
Dave Airlie47c03742013-12-10 14:05:51 +1000796 --with-sdlabi=*) sdlabi="$optarg"
797 ;;
Paolo Bonzini3556c232013-05-10 14:16:40 +0200798 --disable-qom-cast-debug) qom_cast_debug="no"
799 ;;
800 --enable-qom-cast-debug) qom_cast_debug="yes"
801 ;;
Meador Inge983eef52012-02-24 14:00:42 +0530802 --disable-virtfs) virtfs="no"
803 ;;
804 --enable-virtfs) virtfs="yes"
805 ;;
Jes Sorensen821601e2011-03-16 13:33:36 +0100806 --disable-vnc) vnc="no"
807 ;;
808 --enable-vnc) vnc="yes"
809 ;;
pbrookb1a550a2006-04-16 13:28:56 +0000810 --fmod-lib=*) fmod_lib="$optarg"
bellard102a52e2004-11-14 19:57:29 +0000811 ;;
malcc2de5c92008-06-28 19:13:06 +0000812 --fmod-inc=*) fmod_inc="$optarg"
813 ;;
blueswir12f6a1ab2008-08-21 18:00:53 +0000814 --oss-lib=*) oss_lib="$optarg"
815 ;;
malc0c58ac12008-06-25 21:04:05 +0000816 --audio-drv-list=*) audio_drv_list="$optarg"
817 ;;
Fam Zhengb64ec4e2013-05-29 19:35:40 +0800818 --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
819 ;;
820 --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
Markus Armbrustereb852012009-10-27 18:41:44 +0100821 ;;
aurel32f8393942009-04-13 18:45:38 +0000822 --enable-debug-tcg) debug_tcg="yes"
823 ;;
824 --disable-debug-tcg) debug_tcg="no"
825 ;;
Paul Brookf3d08ee2009-06-04 11:39:04 +0100826 --enable-debug)
827 # Enable debugging options that aren't excessively noisy
828 debug_tcg="yes"
829 debug="yes"
830 strip_opt="no"
831 ;;
aliguori03b4fe72008-10-07 19:16:17 +0000832 --enable-sparse) sparse="yes"
833 ;;
834 --disable-sparse) sparse="no"
835 ;;
aliguori1625af82009-04-05 17:41:02 +0000836 --disable-strip) strip_opt="no"
837 ;;
ths8d5d2d42007-08-25 01:37:51 +0000838 --disable-vnc-tls) vnc_tls="no"
839 ;;
Juan Quintela1be10ad2009-08-12 18:20:28 +0200840 --enable-vnc-tls) vnc_tls="yes"
841 ;;
aliguori2f9606b2009-03-06 20:27:28 +0000842 --disable-vnc-sasl) vnc_sasl="no"
843 ;;
Juan Quintelaea784e32009-08-12 18:20:29 +0200844 --enable-vnc-sasl) vnc_sasl="yes"
845 ;;
Corentin Chary2f6f5c72010-07-07 20:57:49 +0200846 --disable-vnc-jpeg) vnc_jpeg="no"
847 ;;
848 --enable-vnc-jpeg) vnc_jpeg="yes"
849 ;;
Corentin Charyefe556a2010-07-07 20:57:56 +0200850 --disable-vnc-png) vnc_png="no"
851 ;;
852 --enable-vnc-png) vnc_png="yes"
853 ;;
Tim Hardeck7536ee42013-01-21 11:04:44 +0100854 --disable-vnc-ws) vnc_ws="no"
855 ;;
856 --enable-vnc-ws) vnc_ws="yes"
857 ;;
bellard443f1372004-06-04 11:13:20 +0000858 --disable-slirp) slirp="no"
bellard1d14ffa2005-10-30 18:58:22 +0000859 ;;
Stefan Weilee682d22009-10-01 20:10:37 +0200860 --disable-uuid) uuid="no"
861 ;;
862 --enable-uuid) uuid="yes"
863 ;;
aliguorie0e6c8c02008-07-23 18:14:33 +0000864 --disable-vde) vde="no"
ths8a16d272008-07-19 09:56:24 +0000865 ;;
Juan Quinteladfb278b2009-08-12 18:20:27 +0200866 --enable-vde) vde="yes"
867 ;;
Vincenzo Maffione58952132013-11-06 11:44:06 +0100868 --disable-netmap) netmap="no"
869 ;;
870 --enable-netmap) netmap="yes"
871 ;;
aliguorie37630c2009-04-22 15:19:10 +0000872 --disable-xen) xen="no"
873 ;;
Juan Quintelafc321b42009-08-12 18:29:55 +0200874 --enable-xen) xen="yes"
875 ;;
Anthony PERARDeb6fda02012-06-21 15:32:59 +0000876 --disable-xen-pci-passthrough) xen_pci_passthrough="no"
877 ;;
878 --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
879 ;;
aurel322e4d9fb2008-04-08 06:01:02 +0000880 --disable-brlapi) brlapi="no"
881 ;;
Juan Quintela4ffcedb2009-08-12 18:20:26 +0200882 --enable-brlapi) brlapi="yes"
883 ;;
balrogfb599c92008-09-28 23:49:55 +0000884 --disable-bluez) bluez="no"
885 ;;
Juan Quintelaa20a6f42009-08-12 18:29:50 +0200886 --enable-bluez) bluez="yes"
887 ;;
aliguori7ba1e612008-11-05 16:04:33 +0000888 --disable-kvm) kvm="no"
889 ;;
Juan Quintelab31a0272009-08-12 18:29:56 +0200890 --enable-kvm) kvm="yes"
891 ;;
Stefan Weil9195b2c2011-10-19 07:07:18 +0200892 --disable-tcg-interpreter) tcg_interpreter="no"
893 ;;
894 --enable-tcg-interpreter) tcg_interpreter="yes"
895 ;;
Corey Bryant47e98652012-01-26 09:42:26 -0500896 --disable-cap-ng) cap_ng="no"
897 ;;
898 --enable-cap-ng) cap_ng="yes"
899 ;;
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +0100900 --disable-spice) spice="no"
901 ;;
902 --enable-spice) spice="yes"
903 ;;
Ronnie Sahlbergc589b242011-10-25 19:24:24 +1100904 --disable-libiscsi) libiscsi="no"
905 ;;
906 --enable-libiscsi) libiscsi="yes"
907 ;;
Peter Lieven6542aa92014-02-03 10:26:13 +0100908 --disable-libnfs) libnfs="no"
909 ;;
910 --enable-libnfs) libnfs="yes"
911 ;;
bellard05c2a3e2006-02-08 22:39:17 +0000912 --enable-profiler) profiler="yes"
913 ;;
Pavel Borzenkov14821032011-11-10 22:40:07 +0400914 --disable-cocoa) cocoa="no"
915 ;;
malcc2de5c92008-06-28 19:13:06 +0000916 --enable-cocoa)
917 cocoa="yes" ;
918 sdl="no" ;
919 audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
bellard1d14ffa2005-10-30 18:58:22 +0000920 ;;
pbrookcad25d62006-03-19 16:31:11 +0000921 --disable-system) softmmu="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000922 ;;
pbrookcad25d62006-03-19 16:31:11 +0000923 --enable-system) softmmu="yes"
pbrook0a8e90f2006-03-19 14:54:16 +0000924 ;;
Zachary Amsden0953a802009-07-30 00:14:59 -1000925 --disable-user)
926 linux_user="no" ;
927 bsd_user="no" ;
Zachary Amsden0953a802009-07-30 00:14:59 -1000928 ;;
929 --enable-user) ;;
ths831b7822007-01-18 20:06:33 +0000930 --disable-linux-user) linux_user="no"
pbrook0a8e90f2006-03-19 14:54:16 +0000931 ;;
ths831b7822007-01-18 20:06:33 +0000932 --enable-linux-user) linux_user="yes"
933 ;;
blueswir184778502008-10-26 20:33:16 +0000934 --disable-bsd-user) bsd_user="no"
935 ;;
936 --enable-bsd-user) bsd_user="yes"
937 ;;
Paul Brook379f6692009-07-17 12:48:08 +0100938 --enable-guest-base) guest_base="yes"
939 ;;
940 --disable-guest-base) guest_base="no"
941 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200942 --enable-pie) pie="yes"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300943 ;;
Avi Kivity40d64442011-11-15 20:12:17 +0200944 --disable-pie) pie="no"
Kirill A. Shutemov34005a02009-09-12 02:17:55 +0300945 ;;
pbrookc5937222006-05-14 11:30:38 +0000946 --enable-uname-release=*) uname_release="$optarg"
947 ;;
bellard85aa5182007-11-11 20:17:03 +0000948 --enable-werror) werror="yes"
949 ;;
950 --disable-werror) werror="no"
951 ;;
balrog4d3b6f62008-02-10 16:33:14 +0000952 --disable-curses) curses="no"
953 ;;
Juan Quintelac584a6d2009-08-12 18:20:30 +0200954 --enable-curses) curses="yes"
955 ;;
Alexander Graf769ce762009-05-11 17:41:42 +0200956 --disable-curl) curl="no"
957 ;;
Juan Quintela788c8192009-08-12 18:29:47 +0200958 --enable-curl) curl="yes"
959 ;;
Juan Quintela2df87df2009-08-12 18:29:54 +0200960 --disable-fdt) fdt="no"
961 ;;
962 --enable-fdt) fdt="yes"
963 ;;
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +0200964 --disable-linux-aio) linux_aio="no"
965 ;;
966 --enable-linux-aio) linux_aio="yes"
967 ;;
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -0700968 --disable-attr) attr="no"
969 ;;
970 --enable-attr) attr="yes"
971 ;;
ths77755342008-11-27 15:45:16 +0000972 --disable-blobs) blobs="no"
973 ;;
pbrook4a19f1e2009-04-07 23:17:49 +0000974 --with-pkgversion=*) pkgversion=" ($optarg)"
975 ;;
Alex Barcelo519175a2012-02-28 12:25:50 +0100976 --with-coroutine=*) coroutine="$optarg"
977 ;;
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +0200978 --disable-coroutine-pool) coroutine_pool="no"
979 ;;
980 --enable-coroutine-pool) coroutine_pool="yes"
981 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200982 --disable-docs) docs="no"
Anthony Liguori70ec5dc2009-05-14 08:25:04 -0500983 ;;
Juan Quintelaa25dba12009-08-12 18:29:52 +0200984 --enable-docs) docs="yes"
Juan Quintela83a3ab82009-08-12 18:29:51 +0200985 ;;
Michael S. Tsirkind5970052010-03-17 13:08:17 +0200986 --disable-vhost-net) vhost_net="no"
987 ;;
988 --enable-vhost-net) vhost_net="yes"
989 ;;
Nicholas Bellinger5e9be922013-03-29 01:08:16 +0000990 --disable-vhost-scsi) vhost_scsi="no"
991 ;;
992 --enable-vhost-scsi) vhost_scsi="yes"
993 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +0100994 --disable-glx) glx="no"
Michael Walle20ff0752011-03-07 23:32:39 +0100995 ;;
Michael Walleb1e5fff2013-03-06 20:23:32 +0100996 --enable-glx) glx="yes"
Michael Walle20ff0752011-03-07 23:32:39 +0100997 ;;
Christian Brunnerf27aaf42010-12-06 20:53:01 +0100998 --disable-rbd) rbd="no"
999 ;;
1000 --enable-rbd) rbd="yes"
1001 ;;
Sergei Trofimovich8c84cf12012-01-24 20:42:40 +03001002 --disable-xfsctl) xfs="no"
1003 ;;
1004 --enable-xfsctl) xfs="yes"
1005 ;;
Robert Relyea111a38b2010-11-28 16:36:38 +02001006 --disable-smartcard-nss) smartcard_nss="no"
1007 ;;
1008 --enable-smartcard-nss) smartcard_nss="yes"
1009 ;;
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01001010 --disable-libusb) libusb="no"
1011 ;;
1012 --enable-libusb) libusb="yes"
1013 ;;
Hans de Goede69354a82011-07-19 11:04:10 +02001014 --disable-usb-redir) usb_redir="no"
1015 ;;
1016 --enable-usb-redir) usb_redir="yes"
1017 ;;
Alon Levy1ece9902011-07-26 12:30:40 +03001018 --disable-zlib-test) zlib="no"
1019 ;;
qiaonuohan607dacd2014-02-18 14:11:30 +08001020 --enable-lzo) lzo="yes"
1021 ;;
1022 --enable-snappy) snappy="yes"
1023 ;;
Michael Rothd138cee2011-08-01 14:52:57 -05001024 --enable-guest-agent) guest_agent="yes"
1025 ;;
1026 --disable-guest-agent) guest_agent="no"
1027 ;;
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04001028 --with-vss-sdk) vss_win32_sdk=""
1029 ;;
1030 --with-vss-sdk=*) vss_win32_sdk="$optarg"
1031 ;;
1032 --without-vss-sdk) vss_win32_sdk="no"
1033 ;;
1034 --with-win-sdk) win_sdk=""
1035 ;;
1036 --with-win-sdk=*) win_sdk="$optarg"
1037 ;;
1038 --without-win-sdk) win_sdk="no"
1039 ;;
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01001040 --enable-tools) want_tools="yes"
1041 ;;
1042 --disable-tools) want_tools="no"
1043 ;;
Eduardo Otubof7945732012-08-14 18:44:05 -03001044 --enable-seccomp) seccomp="yes"
1045 ;;
1046 --disable-seccomp) seccomp="no"
1047 ;;
Bharata B Raoeb100392012-09-24 14:42:45 +05301048 --disable-glusterfs) glusterfs="no"
1049 ;;
1050 --enable-glusterfs) glusterfs="yes"
1051 ;;
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01001052 --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
1053 ;;
1054 --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
1055 ;;
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001056 --disable-gtk) gtk="no"
1057 ;;
1058 --enable-gtk) gtk="yes"
1059 ;;
Michael R. Hines2da776d2013-07-22 10:01:54 -04001060 --enable-rdma) rdma="yes"
1061 ;;
1062 --disable-rdma) rdma="no"
1063 ;;
Daniel P. Berrange528de902013-02-25 15:20:44 +00001064 --with-gtkabi=*) gtkabi="$optarg"
1065 ;;
Stefan Bergerab214c22013-02-27 12:47:52 -05001066 --enable-tpm) tpm="yes"
1067 ;;
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01001068 --disable-libssh2) libssh2="no"
1069 ;;
1070 --enable-libssh2) libssh2="yes"
1071 ;;
Jeff Cody4f18b782013-10-30 10:44:39 -04001072 --enable-vhdx) vhdx="yes"
1073 ;;
1074 --disable-vhdx) vhdx="no"
1075 ;;
Benoît Canet95c6bff2014-02-21 22:21:15 +01001076 --disable-quorum) quorum="no"
1077 ;;
1078 --enable-quorum) quorum="yes"
1079 ;;
balrog7f1559c2007-11-17 10:24:32 +00001080 *) echo "ERROR: unknown option $opt"; show_help="yes"
1081 ;;
bellard7d132992003-03-06 23:23:54 +00001082 esac
1083done
1084
Stefan Weilf6f0b7d2013-12-18 22:30:26 +01001085if ! has $python; then
1086 error_exit "Python not found. Use --python=/path/to/python"
1087fi
1088
1089# Note that if the Python conditional here evaluates True we will exit
1090# with status 1 which is a shell 'false' value.
1091if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1092 error_exit "Cannot use '$python', Python 2.4 or later is required." \
1093 "Note that Python 3 or later is not yet supported." \
1094 "Use --python=/path/to/python to specify a supported Python."
1095fi
1096
1097# The -B switch was added in Python 2.6.
1098# If it is supplied, compiled files are not written.
1099# Use it for Python versions which support it.
1100if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
1101 python="$python -B"
1102fi
1103
bellard40293e52008-01-31 11:32:10 +00001104case "$cpu" in
Richard Hendersone3608d62013-08-28 15:48:21 -07001105 ppc)
1106 CPU_CFLAGS="-m32"
1107 LDFLAGS="-m32 $LDFLAGS"
1108 ;;
1109 ppc64)
1110 CPU_CFLAGS="-m64"
1111 LDFLAGS="-m64 $LDFLAGS"
1112 ;;
Richard Henderson9b9c37c2012-09-21 10:34:21 -07001113 sparc)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001114 LDFLAGS="-m32 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001115 CPU_CFLAGS="-m32 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001116 ;;
Juan Quintelaed968ff2009-08-03 14:46:11 +02001117 sparc64)
Juan Quintelaed968ff2009-08-03 14:46:11 +02001118 LDFLAGS="-m64 $LDFLAGS"
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001119 CPU_CFLAGS="-m64 -mcpu=ultrasparc"
blueswir131422552007-04-16 18:27:06 +00001120 ;;
ths76d83bd2007-11-18 21:22:10 +00001121 s390)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001122 CPU_CFLAGS="-m31 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001123 LDFLAGS="-m31 $LDFLAGS"
1124 ;;
1125 s390x)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001126 CPU_CFLAGS="-m64 -march=z990"
Richard Henderson28d7cc42010-06-04 12:14:09 -07001127 LDFLAGS="-m64 $LDFLAGS"
ths76d83bd2007-11-18 21:22:10 +00001128 ;;
bellard40293e52008-01-31 11:32:10 +00001129 i386)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001130 CPU_CFLAGS="-m32"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001131 LDFLAGS="-m32 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001132 cc_i386='$(CC) -m32'
bellard40293e52008-01-31 11:32:10 +00001133 ;;
1134 x86_64)
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001135 CPU_CFLAGS="-m64"
Juan Quintela0c439cb2009-08-03 14:46:01 +02001136 LDFLAGS="-m64 $LDFLAGS"
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02001137 cc_i386='$(CC) -m32'
Paul Brook379f6692009-07-17 12:48:08 +01001138 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001139 x32)
1140 CPU_CFLAGS="-mx32"
1141 LDFLAGS="-mx32 $LDFLAGS"
1142 cc_i386='$(CC) -m32'
1143 ;;
Peter Maydell30163d82012-10-09 03:16:49 +00001144 # No special flags required for other host CPUs
blueswir131422552007-04-16 18:27:06 +00001145esac
1146
Peter Crosthwaite79f3b122013-04-18 14:46:14 +10001147QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
1148EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
1149
Peter Maydell60e0df22011-05-03 14:50:13 +01001150default_target_list=""
1151
Peter Maydell6e92f822013-05-20 16:16:15 +01001152mak_wilds=""
1153
1154if [ "$softmmu" = "yes" ]; then
1155 mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001156fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001157if [ "$linux_user" = "yes" ]; then
1158 mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001159fi
Peter Maydell6e92f822013-05-20 16:16:15 +01001160if [ "$bsd_user" = "yes" ]; then
1161 mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
Peter Maydell60e0df22011-05-03 14:50:13 +01001162fi
1163
Peter Maydell6e92f822013-05-20 16:16:15 +01001164for config in $mak_wilds; do
1165 default_target_list="${default_target_list} $(basename "$config" .mak)"
1166done
1167
pbrookaf5db582006-04-08 14:26:41 +00001168if test x"$show_help" = x"yes" ; then
1169cat << EOF
1170
1171Usage: configure [options]
1172Options: [defaults in brackets after descriptions]
1173
Stefan Weil08fb77e2013-12-18 22:09:39 +01001174Standard options:
1175 --help print this message
1176 --prefix=PREFIX install in PREFIX [$prefix]
1177 --interp-prefix=PREFIX where to find shared libraries, etc.
1178 use %M for cpu name [$interp_prefix]
1179 --target-list=LIST set target list (default: build everything)
1180$(echo Available targets: $default_target_list | \
1181 fold -s -w 53 | sed -e 's/^/ /')
1182
1183Advanced options (experts only):
1184 --source-path=PATH path of source code [$source_path]
1185 --cross-prefix=PREFIX use PREFIX for compile tools [$cross_prefix]
1186 --cc=CC use C compiler CC [$cc]
1187 --iasl=IASL use ACPI compiler IASL [$iasl]
1188 --host-cc=CC use C compiler CC [$host_cc] for code run at
1189 build time
1190 --cxx=CXX use C++ compiler CXX [$cxx]
1191 --objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
1192 --extra-cflags=CFLAGS append extra C compiler flags QEMU_CFLAGS
1193 --extra-ldflags=LDFLAGS append extra linker flags LDFLAGS
1194 --make=MAKE use specified make [$make]
1195 --install=INSTALL use specified install [$install]
1196 --python=PYTHON use specified python [$python]
1197 --smbd=SMBD use specified smbd [$smbd]
1198 --static enable static build [$static]
1199 --mandir=PATH install man pages in PATH
1200 --datadir=PATH install firmware in PATH$confsuffix
1201 --docdir=PATH install documentation in PATH$confsuffix
1202 --bindir=PATH install binaries in PATH
1203 --libdir=PATH install libraries in PATH
1204 --sysconfdir=PATH install config in PATH$confsuffix
1205 --localstatedir=PATH install local state in PATH (set at runtime on win32)
Fam Zhenge26110c2014-02-10 14:48:57 +08001206 --with-confsuffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir [$confsuffix]
Fam Zheng17969262014-02-10 14:48:56 +08001207 --enable-modules enable modules support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001208 --enable-debug-tcg enable TCG debugging
1209 --disable-debug-tcg disable TCG debugging (default)
1210 --enable-debug-info enable debugging information (default)
1211 --disable-debug-info disable debugging information
1212 --enable-debug enable common debug build options
1213 --enable-sparse enable sparse checker
1214 --disable-sparse disable sparse checker (default)
1215 --disable-strip disable stripping binaries
1216 --disable-werror disable compilation abort on warning
1217 --disable-sdl disable SDL
1218 --enable-sdl enable SDL
Dave Airlie47c03742013-12-10 14:05:51 +10001219 --with-sdlabi select preferred SDL ABI 1.2 or 2.0
Stefan Weil08fb77e2013-12-18 22:09:39 +01001220 --disable-gtk disable gtk UI
1221 --enable-gtk enable gtk UI
1222 --disable-virtfs disable VirtFS
1223 --enable-virtfs enable VirtFS
1224 --disable-vnc disable VNC
1225 --enable-vnc enable VNC
1226 --disable-cocoa disable Cocoa (Mac OS X only)
1227 --enable-cocoa enable Cocoa (default on Mac OS X)
1228 --audio-drv-list=LIST set audio drivers list:
1229 Available drivers: $audio_possible_drivers
1230 --block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
1231 --block-drv-rw-whitelist=L
1232 set block driver read-write whitelist
1233 (affects only QEMU, not qemu-img)
1234 --block-drv-ro-whitelist=L
1235 set block driver read-only whitelist
1236 (affects only QEMU, not qemu-img)
1237 --disable-xen disable xen backend driver support
1238 --enable-xen enable xen backend driver support
1239 --disable-xen-pci-passthrough
1240 --enable-xen-pci-passthrough
1241 --disable-brlapi disable BrlAPI
1242 --enable-brlapi enable BrlAPI
1243 --disable-vnc-tls disable TLS encryption for VNC server
1244 --enable-vnc-tls enable TLS encryption for VNC server
1245 --disable-vnc-sasl disable SASL encryption for VNC server
1246 --enable-vnc-sasl enable SASL encryption for VNC server
1247 --disable-vnc-jpeg disable JPEG lossy compression for VNC server
1248 --enable-vnc-jpeg enable JPEG lossy compression for VNC server
1249 --disable-vnc-png disable PNG compression for VNC server (default)
1250 --enable-vnc-png enable PNG compression for VNC server
1251 --disable-vnc-ws disable Websockets support for VNC server
1252 --enable-vnc-ws enable Websockets support for VNC server
1253 --disable-curses disable curses output
1254 --enable-curses enable curses output
1255 --disable-curl disable curl connectivity
1256 --enable-curl enable curl connectivity
1257 --disable-fdt disable fdt device tree
1258 --enable-fdt enable fdt device tree
1259 --disable-bluez disable bluez stack connectivity
1260 --enable-bluez enable bluez stack connectivity
1261 --disable-slirp disable SLIRP userspace network connectivity
1262 --disable-kvm disable KVM acceleration support
1263 --enable-kvm enable KVM acceleration support
1264 --disable-rdma disable RDMA-based migration support
1265 --enable-rdma enable RDMA-based migration support
1266 --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1267 --enable-system enable all system emulation targets
1268 --disable-system disable all system emulation targets
1269 --enable-user enable supported user emulation targets
1270 --disable-user disable all user emulation targets
1271 --enable-linux-user enable all linux usermode emulation targets
1272 --disable-linux-user disable all linux usermode emulation targets
1273 --enable-bsd-user enable all BSD usermode emulation targets
1274 --disable-bsd-user disable all BSD usermode emulation targets
1275 --enable-guest-base enable GUEST_BASE support for usermode
1276 emulation targets
1277 --disable-guest-base disable GUEST_BASE support
1278 --enable-pie build Position Independent Executables
1279 --disable-pie do not build Position Independent Executables
1280 --fmod-lib path to FMOD library
1281 --fmod-inc path to FMOD includes
1282 --oss-lib path to OSS library
1283 --enable-uname-release=R Return R for uname -r in usermode emulation
1284 --cpu=CPU Build for host CPU [$cpu]
1285 --disable-uuid disable uuid support
1286 --enable-uuid enable uuid support
1287 --disable-vde disable support for vde network
1288 --enable-vde enable support for vde network
1289 --disable-netmap disable support for netmap network
1290 --enable-netmap enable support for netmap network
1291 --disable-linux-aio disable Linux AIO support
1292 --enable-linux-aio enable Linux AIO support
1293 --disable-cap-ng disable libcap-ng support
1294 --enable-cap-ng enable libcap-ng support
1295 --disable-attr disables attr and xattr support
1296 --enable-attr enable attr and xattr support
1297 --disable-blobs disable installing provided firmware blobs
1298 --enable-docs enable documentation build
1299 --disable-docs disable documentation build
1300 --disable-vhost-net disable vhost-net acceleration support
1301 --enable-vhost-net enable vhost-net acceleration support
1302 --enable-trace-backend=B Set trace backend
1303 Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1304 --with-trace-file=NAME Full PATH,NAME of file to store traces
1305 Default:trace-<pid>
1306 --disable-spice disable spice
1307 --enable-spice enable spice
1308 --enable-rbd enable building the rados block device (rbd)
1309 --disable-libiscsi disable iscsi support
1310 --enable-libiscsi enable iscsi support
Peter Lieven6542aa92014-02-03 10:26:13 +01001311 --disable-libnfs disable nfs support
1312 --enable-libnfs enable nfs support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001313 --disable-smartcard-nss disable smartcard nss support
1314 --enable-smartcard-nss enable smartcard nss support
1315 --disable-libusb disable libusb (for usb passthrough)
1316 --enable-libusb enable libusb (for usb passthrough)
1317 --disable-usb-redir disable usb network redirection support
1318 --enable-usb-redir enable usb network redirection support
qiaonuohan607dacd2014-02-18 14:11:30 +08001319 --enable-lzo enable the support of lzo compression library
1320 --enable-snappy enable the support of snappy compression library
Stefan Weil08fb77e2013-12-18 22:09:39 +01001321 --disable-guest-agent disable building of the QEMU Guest Agent
1322 --enable-guest-agent enable building of the QEMU Guest Agent
1323 --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
1324 --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
1325 --disable-seccomp disable seccomp support
1326 --enable-seccomp enables seccomp support
1327 --with-coroutine=BACKEND coroutine backend. Supported options:
1328 gthread, ucontext, sigaltstack, windows
1329 --disable-coroutine-pool disable coroutine freelist (worse performance)
1330 --enable-coroutine-pool enable coroutine freelist (better performance)
1331 --enable-glusterfs enable GlusterFS backend
1332 --disable-glusterfs disable GlusterFS backend
1333 --enable-gcov enable test coverage analysis with gcov
1334 --gcov=GCOV use specified gcov [$gcov_tool]
1335 --enable-tpm enable TPM support
1336 --disable-libssh2 disable ssh block device support
1337 --enable-libssh2 enable ssh block device support
1338 --disable-vhdx disables support for the Microsoft VHDX image format
1339 --enable-vhdx enable support for the Microsoft VHDX image format
Benoît Canet95c6bff2014-02-21 22:21:15 +01001340 --disable-quorum disable quorum block filter support
1341 --enable-quorum enable quorum block filter support
Stefan Weil08fb77e2013-12-18 22:09:39 +01001342
1343NOTE: The object files are built at the place where configure is launched
pbrookaf5db582006-04-08 14:26:41 +00001344EOF
pbrookaf5db582006-04-08 14:26:41 +00001345exit 1
1346fi
1347
Peter Maydell359bc952011-12-24 13:07:25 +00001348# Now we have handled --enable-tcg-interpreter and know we're not just
1349# printing the help message, bail out if the host CPU isn't supported.
1350if test "$ARCH" = "unknown"; then
1351 if test "$tcg_interpreter" = "yes" ; then
1352 echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1353 ARCH=tci
1354 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001355 error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
Peter Maydell359bc952011-12-24 13:07:25 +00001356 fi
1357fi
1358
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001359# Consult white-list to determine whether to enable werror
1360# by default. Only enable by default for git builds
1361z_version=`cut -f3 -d. $source_path/VERSION`
1362
1363if test -z "$werror" ; then
1364 if test -d "$source_path/.git" -a \
1365 "$linux" = "yes" ; then
1366 werror="yes"
1367 else
1368 werror="no"
1369 fi
1370fi
1371
Paolo Bonzini8d050952010-12-23 11:43:52 +01001372# check that the C compiler works.
1373cat > $TMPC <<EOF
Stefan Weil75cafad2011-12-17 09:27:29 +01001374int main(void) { return 0; }
Paolo Bonzini8d050952010-12-23 11:43:52 +01001375EOF
1376
1377if compile_object ; then
1378 : C compiler works ok
1379else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001380 error_exit "\"$cc\" either does not exist or does not work"
Paolo Bonzini8d050952010-12-23 11:43:52 +01001381fi
1382
Peter Maydell98b21dc2014-02-20 15:10:16 +00001383# Check that the C++ compiler exists and works with the C compiler
1384if has $cxx; then
1385 cat > $TMPC <<EOF
1386int c_function(void);
1387int main(void) { return c_function(); }
1388EOF
1389
1390 compile_object
1391
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001392 cat > $TMPCXX <<EOF
Peter Maydell98b21dc2014-02-20 15:10:16 +00001393extern "C" {
1394 int c_function(void);
1395}
1396int c_function(void) { return 42; }
1397EOF
1398
Peter Maydell9c83ffd2014-02-25 18:27:49 +00001399 update_cxxflags
1400
1401 if do_cxx $QEMU_CXXFLAGS -o $TMPE $TMPCXX $TMPO $LDFLAGS; then
Peter Maydell98b21dc2014-02-20 15:10:16 +00001402 # C++ compiler $cxx works ok with C compiler $cc
1403 :
1404 else
1405 echo "C++ compiler $cxx does not work with C compiler $cc"
1406 echo "Disabling C++ specific optional code"
1407 cxx=
1408 fi
1409else
1410 echo "No C++ compiler available; disabling C++ specific optional code"
1411 cxx=
1412fi
1413
Paolo Bonzini8d050952010-12-23 11:43:52 +01001414gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
1415gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1416gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
Marc-André Lureau37746c52013-02-25 23:31:12 +01001417gcc_flags="-Wendif-labels $gcc_flags"
Peter Maydellc1556a82012-10-14 21:00:39 +01001418gcc_flags="-Wno-initializer-overrides $gcc_flags"
Peter Maydell71429092013-08-05 20:16:40 +01001419gcc_flags="-Wno-string-plus-int $gcc_flags"
Peter Maydell6ca026c2012-07-18 15:10:18 +01001420# Note that we do not add -Werror to gcc_flags here, because that would
1421# enable it for all configure tests. If a configure test failed due
1422# to -Werror this would just silently disable some features,
1423# so it's too error prone.
Paolo Bonzini8d050952010-12-23 11:43:52 +01001424cat > $TMPC << EOF
1425int main(void) { return 0; }
1426EOF
1427for flag in $gcc_flags; do
Peter Maydella1d29d62012-10-27 22:19:07 +01001428 # Use the positive sense of the flag when testing for -Wno-wombat
1429 # support (gcc will happily accept the -Wno- form of unknown
1430 # warning options).
1431 optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1432 if compile_prog "-Werror $optflag" "" ; then
Paolo Bonzini8d050952010-12-23 11:43:52 +01001433 QEMU_CFLAGS="$QEMU_CFLAGS $flag"
1434 fi
1435done
1436
Marc-André Lureau37746c52013-02-25 23:31:12 +01001437if compile_prog "-Werror -fstack-protector-all" "" ; then
1438 QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
1439 LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
1440fi
1441
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01001442# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
1443# large functions that use global variables. The bug is in all releases of
1444# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in
1445# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013.
1446cat > $TMPC << EOF
1447#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1448int main(void) { return 0; }
1449#else
1450#error No bug in this compiler.
1451#endif
1452EOF
1453if compile_prog "-Werror -fno-gcse" "" ; then
1454 TRANSLATE_OPT_CFLAGS=-fno-gcse
1455fi
1456
Avi Kivity40d64442011-11-15 20:12:17 +02001457if test "$static" = "yes" ; then
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01001458 if test "$modules" = "yes" ; then
1459 error_exit "static and modules are mutually incompatible"
1460 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001461 if test "$pie" = "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001462 error_exit "static and pie are mutually incompatible"
Avi Kivity40d64442011-11-15 20:12:17 +02001463 else
1464 pie="no"
1465 fi
1466fi
1467
1468if test "$pie" = ""; then
1469 case "$cpu-$targetos" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07001470 i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
Avi Kivity40d64442011-11-15 20:12:17 +02001471 ;;
1472 *)
1473 pie="no"
1474 ;;
1475 esac
1476fi
1477
1478if test "$pie" != "no" ; then
1479 cat > $TMPC << EOF
Avi Kivity21d4a792011-11-23 11:24:25 +02001480
1481#ifdef __linux__
1482# define THREAD __thread
1483#else
1484# define THREAD
1485#endif
1486
1487static THREAD int tls_var;
1488
1489int main(void) { return tls_var; }
1490
Avi Kivity40d64442011-11-15 20:12:17 +02001491EOF
1492 if compile_prog "-fPIE -DPIE" "-pie"; then
1493 QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
1494 LDFLAGS="-pie $LDFLAGS"
1495 pie="yes"
1496 if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
1497 LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
1498 fi
1499 else
1500 if test "$pie" = "yes"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001501 error_exit "PIE not available due to missing toolchain support"
Avi Kivity40d64442011-11-15 20:12:17 +02001502 else
1503 echo "Disabling PIE due to missing toolchain support"
1504 pie="no"
1505 fi
1506 fi
Brad46eef332013-12-10 19:49:08 -05001507
1508 if compile_prog "-fno-pie" "-nopie"; then
1509 CFLAGS_NOPIE="-fno-pie"
1510 LDFLAGS_NOPIE="-nopie"
1511 fi
Avi Kivity40d64442011-11-15 20:12:17 +02001512fi
1513
Don Slutz66518bf2014-01-02 21:12:46 -05001514# check for broken gcc and libtool in RHEL5
1515if test -n "$libtool" -a "$pie" != "no" ; then
1516 cat > $TMPC <<EOF
1517
1518void *f(unsigned char *buf, int len);
1519void *g(unsigned char *buf, int len);
1520
1521void *
1522f(unsigned char *buf, int len)
1523{
1524 return (void*)0L;
1525}
1526
1527void *
1528g(unsigned char *buf, int len)
1529{
1530 return f(buf, len);
1531}
1532
1533EOF
1534 if ! libtool_prog; then
1535 echo "Disabling libtool due to broken toolchain support"
1536 libtool=
1537 fi
1538fi
1539
Paolo Bonzini09dada42013-04-17 16:26:47 +02001540##########################################
1541# __sync_fetch_and_and requires at least -march=i486. Many toolchains
1542# use i686 as default anyway, but for those that don't, an explicit
1543# specification is necessary
1544
1545if test "$cpu" = "i386"; then
1546 cat > $TMPC << EOF
1547static int sfaa(int *ptr)
1548{
1549 return __sync_fetch_and_and(ptr, 0);
1550}
1551
1552int main(void)
1553{
1554 int val = 42;
Stefan Weil1405b622013-05-11 21:46:58 +02001555 val = __sync_val_compare_and_swap(&val, 0, 1);
Paolo Bonzini09dada42013-04-17 16:26:47 +02001556 sfaa(&val);
1557 return val;
1558}
1559EOF
1560 if ! compile_prog "" "" ; then
1561 QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
1562 fi
1563fi
1564
1565#########################################
bellardec530c82006-04-25 22:36:06 +00001566# Solaris specific configure tool chain decisions
Paolo Bonzini09dada42013-04-17 16:26:47 +02001567
bellardec530c82006-04-25 22:36:06 +00001568if test "$solaris" = "yes" ; then
Loïc Minier6792aa12010-01-20 11:35:54 +01001569 if has $install; then
1570 :
1571 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001572 error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
1573 "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
1574 "to get ginstall which is used by default (which lives in /opt/csw/bin)"
bellardec530c82006-04-25 22:36:06 +00001575 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001576 if test "`path_of $install`" = "/usr/sbin/install" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001577 error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
1578 "try ginstall from the GNU fileutils available from www.blastwave.org" \
1579 "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
bellardec530c82006-04-25 22:36:06 +00001580 fi
Loïc Minier6792aa12010-01-20 11:35:54 +01001581 if has ar; then
1582 :
1583 else
bellardec530c82006-04-25 22:36:06 +00001584 if test -f /usr/ccs/bin/ar ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001585 error_exit "No path includes ar" \
1586 "Add /usr/ccs/bin to your path and rerun configure"
bellardec530c82006-04-25 22:36:06 +00001587 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001588 error_exit "No path includes ar"
bellardec530c82006-04-25 22:36:06 +00001589 fi
ths5fafdf22007-09-16 21:08:06 +00001590fi
bellardec530c82006-04-25 22:36:06 +00001591
Stefan Weilafb63eb2012-09-26 22:04:38 +02001592if test -z "${target_list+xxx}" ; then
Anthony Liguori121afa92012-09-14 08:17:03 -05001593 target_list="$default_target_list"
1594else
1595 target_list=`echo "$target_list" | sed -e 's/,/ /g'`
bellard5327cf42005-01-10 23:18:50 +00001596fi
Peter Maydell25b48332013-05-20 16:16:16 +01001597
1598# Check that we recognised the target name; this allows a more
1599# friendly error message than if we let it fall through.
1600for target in $target_list; do
1601 case " $default_target_list " in
1602 *" $target "*)
1603 ;;
1604 *)
1605 error_exit "Unknown target name '$target'"
1606 ;;
1607 esac
1608done
1609
Paolo Bonzinif55fe272010-05-26 16:08:17 +02001610# see if system emulation was really requested
1611case " $target_list " in
1612 *"-softmmu "*) softmmu=yes
1613 ;;
1614 *) softmmu=no
1615 ;;
1616esac
bellard5327cf42005-01-10 23:18:50 +00001617
Juan Quintela249247c2009-08-12 18:20:25 +02001618feature_not_found() {
1619 feature=$1
Stewart Smith21684af2014-01-24 12:39:10 +11001620 remedy=$2
Juan Quintela249247c2009-08-12 18:20:25 +02001621
Peter Maydell76ad07a2013-04-08 12:11:26 +01001622 error_exit "User requested feature $feature" \
Stewart Smith21684af2014-01-24 12:39:10 +11001623 "configure was not able to find it." \
1624 "$remedy"
Juan Quintela249247c2009-08-12 18:20:25 +02001625}
1626
bellard7d132992003-03-06 23:23:54 +00001627# ---
1628# big/little endian test
1629cat > $TMPC << EOF
Mike Frysinger61cc9192013-06-30 23:30:18 -04001630short big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
1631short little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
1632extern int foo(short *, short *);
1633int main(int argc, char *argv[]) {
1634 return foo(big_endian, little_endian);
bellard7d132992003-03-06 23:23:54 +00001635}
1636EOF
1637
Mike Frysinger61cc9192013-06-30 23:30:18 -04001638if compile_object ; then
1639 if grep -q BiGeNdIaN $TMPO ; then
1640 bigendian="yes"
1641 elif grep -q LiTtLeEnDiAn $TMPO ; then
1642 bigendian="no"
1643 else
1644 echo big/little test failed
Peter Maydell21d89f82011-11-30 10:57:48 +01001645 fi
Mike Frysinger61cc9192013-06-30 23:30:18 -04001646else
1647 echo big/little test failed
bellard7d132992003-03-06 23:23:54 +00001648fi
1649
Juan Quintelab0a47e72009-08-12 18:29:49 +02001650##########################################
Stefan Weil779ab5e2012-12-16 11:29:45 +01001651# pkg-config probe
1652
1653if ! has "$pkg_config_exe"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001654 error_exit "pkg-config binary '$pkg_config_exe' not found"
Stefan Weil779ab5e2012-12-16 11:29:45 +01001655fi
1656
1657##########################################
Juan Quintelab0a47e72009-08-12 18:29:49 +02001658# NPTL probe
1659
Peter Maydell24cb36a2013-07-16 18:45:00 +01001660if test "$linux_user" = "yes"; then
Juan Quintelab0a47e72009-08-12 18:29:49 +02001661 cat > $TMPC <<EOF
pbrookbd0c5662008-05-29 14:34:11 +00001662#include <sched.h>
pbrook30813ce2008-06-02 15:45:44 +00001663#include <linux/futex.h>
Stefan Weil182eacc2011-12-17 09:27:30 +01001664int main(void) {
pbrookbd0c5662008-05-29 14:34:11 +00001665#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1666#error bork
1667#endif
Stefan Weil182eacc2011-12-17 09:27:30 +01001668 return 0;
pbrookbd0c5662008-05-29 14:34:11 +00001669}
1670EOF
Peter Maydell24cb36a2013-07-16 18:45:00 +01001671 if ! compile_object ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001672 feature_not_found "nptl" "Install glibc and linux kernel headers."
Juan Quintelab0a47e72009-08-12 18:29:49 +02001673 fi
pbrookbd0c5662008-05-29 14:34:11 +00001674fi
1675
bellard11d9f692004-04-02 20:55:59 +00001676##########################################
balrogac629222008-10-11 09:56:04 +00001677# zlib check
1678
Alon Levy1ece9902011-07-26 12:30:40 +03001679if test "$zlib" != "no" ; then
1680 cat > $TMPC << EOF
balrogac629222008-10-11 09:56:04 +00001681#include <zlib.h>
1682int main(void) { zlibVersion(); return 0; }
1683EOF
Alon Levy1ece9902011-07-26 12:30:40 +03001684 if compile_prog "" "-lz" ; then
1685 :
1686 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01001687 error_exit "zlib check failed" \
1688 "Make sure to have the zlib libs and headers installed."
Alon Levy1ece9902011-07-26 12:30:40 +03001689 fi
balrogac629222008-10-11 09:56:04 +00001690fi
Will Newtoneb0ecd52014-02-26 17:20:07 +00001691LIBS="$LIBS -lz"
balrogac629222008-10-11 09:56:04 +00001692
1693##########################################
qiaonuohan607dacd2014-02-18 14:11:30 +08001694# lzo check
1695
1696if test "$lzo" != "no" ; then
1697 cat > $TMPC << EOF
1698#include <lzo/lzo1x.h>
1699int main(void) { lzo_version(); return 0; }
1700EOF
1701 if compile_prog "" "-llzo2" ; then
1702 :
1703 else
1704 error_exit "lzo check failed" \
1705 "Make sure to have the lzo libs and headers installed."
1706 fi
1707
1708 libs_softmmu="$libs_softmmu -llzo2"
1709fi
1710
1711##########################################
1712# snappy check
1713
1714if test "$snappy" != "no" ; then
1715 cat > $TMPC << EOF
1716#include <snappy-c.h>
1717int main(void) { snappy_max_compressed_length(4096); return 0; }
1718EOF
1719 if compile_prog "" "-lsnappy" ; then
1720 :
1721 else
1722 error_exit "snappy check failed" \
1723 "Make sure to have the snappy libs and headers installed."
1724 fi
1725
1726 libs_softmmu="$libs_softmmu -lsnappy"
1727fi
1728
1729##########################################
Eduardo Otubof7945732012-08-14 18:44:05 -03001730# libseccomp check
1731
1732if test "$seccomp" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02001733 if $pkg_config --atleast-version=2.1.0 libseccomp; then
Michael Tokarevb4451992013-01-19 18:58:09 +04001734 libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
Andreas Färber372e47e2013-04-28 16:27:26 +02001735 QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
Eduardo Otubof7945732012-08-14 18:44:05 -03001736 seccomp="yes"
1737 else
Eduardo Otubof7945732012-08-14 18:44:05 -03001738 if test "$seccomp" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11001739 feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
Eduardo Otubof7945732012-08-14 18:44:05 -03001740 fi
Yann E. MORINe84d5952012-09-06 22:40:30 +02001741 seccomp="no"
Eduardo Otubof7945732012-08-14 18:44:05 -03001742 fi
1743fi
1744##########################################
aliguorie37630c2009-04-22 15:19:10 +00001745# xen probe
1746
Juan Quintelafc321b42009-08-12 18:29:55 +02001747if test "$xen" != "no" ; then
Juan Quintelab2266be2009-07-27 16:13:16 +02001748 xen_libs="-lxenstore -lxenctrl -lxenguest"
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001749
Stefan Weil50ced5b2011-12-17 09:27:39 +01001750 # First we test whether Xen headers and libraries are available.
1751 # If no, we are done and there is no Xen support.
1752 # If yes, more tests are run to detect the Xen version.
1753
1754 # Xen (any)
Juan Quintelab2266be2009-07-27 16:13:16 +02001755 cat > $TMPC <<EOF
aliguorie37630c2009-04-22 15:19:10 +00001756#include <xenctrl.h>
Stefan Weil50ced5b2011-12-17 09:27:39 +01001757int main(void) {
1758 return 0;
1759}
1760EOF
1761 if ! compile_prog "" "$xen_libs" ; then
1762 # Xen not found
1763 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001764 feature_not_found "xen" "Install xen devel"
Stefan Weil50ced5b2011-12-17 09:27:39 +01001765 fi
1766 xen=no
1767
1768 # Xen unstable
Peter Maydell69deef02012-08-02 18:30:26 +01001769 elif
1770 cat > $TMPC <<EOF &&
Stefan Weil50ced5b2011-12-17 09:27:39 +01001771#include <xenctrl.h>
Anthony PERARDe108a3c2012-06-21 11:44:35 +00001772#include <xenstore.h>
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001773#include <stdint.h>
1774#include <xen/hvm/hvm_info_table.h>
1775#if !defined(HVM_MAX_VCPUS)
1776# error HVM_MAX_VCPUS not defined
1777#endif
1778int main(void) {
1779 xc_interface *xc;
1780 xs_daemon_open();
1781 xc = xc_interface_open(0, 0, 0);
1782 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1783 xc_gnttab_open(NULL, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001784 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001785 xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
1786 return 0;
1787}
1788EOF
1789 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001790 then
Stefano Stabellini8688e062012-04-17 17:04:18 +00001791 xen_ctrl_version=420
1792 xen=yes
1793
Peter Maydell69deef02012-08-02 18:30:26 +01001794 elif
1795 cat > $TMPC <<EOF &&
Stefano Stabellini8688e062012-04-17 17:04:18 +00001796#include <xenctrl.h>
1797#include <xs.h>
1798#include <stdint.h>
1799#include <xen/hvm/hvm_info_table.h>
1800#if !defined(HVM_MAX_VCPUS)
1801# error HVM_MAX_VCPUS not defined
1802#endif
1803int main(void) {
Stefano Stabellini8688e062012-04-17 17:04:18 +00001804 xs_daemon_open();
Peter Maydell9b4c0b52012-08-02 18:30:27 +01001805 xc_interface_open(0, 0, 0);
Stefano Stabellini8688e062012-04-17 17:04:18 +00001806 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1807 xc_gnttab_open(NULL, 0);
1808 xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001809 return 0;
1810}
aliguorie37630c2009-04-22 15:19:10 +00001811EOF
Stefan Weil50ced5b2011-12-17 09:27:39 +01001812 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001813 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001814 xen_ctrl_version=410
Juan Quintelafc321b42009-08-12 18:29:55 +02001815 xen=yes
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001816
1817 # Xen 4.0.0
Peter Maydell69deef02012-08-02 18:30:26 +01001818 elif
1819 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001820#include <xenctrl.h>
1821#include <xs.h>
1822#include <stdint.h>
1823#include <xen/hvm/hvm_info_table.h>
1824#if !defined(HVM_MAX_VCPUS)
1825# error HVM_MAX_VCPUS not defined
1826#endif
1827int main(void) {
Anthony PERARDb87de242011-05-24 14:34:20 +01001828 struct xen_add_to_physmap xatp = {
1829 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1830 };
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001831 xs_daemon_open();
1832 xc_interface_open();
1833 xc_gnttab_open();
1834 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
Anthony PERARDb87de242011-05-24 14:34:20 +01001835 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001836 return 0;
1837}
1838EOF
1839 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001840 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001841 xen_ctrl_version=400
1842 xen=yes
1843
Anthony PERARDb87de242011-05-24 14:34:20 +01001844 # Xen 3.4.0
Peter Maydell69deef02012-08-02 18:30:26 +01001845 elif
1846 cat > $TMPC <<EOF &&
Anthony PERARDb87de242011-05-24 14:34:20 +01001847#include <xenctrl.h>
1848#include <xs.h>
1849int main(void) {
1850 struct xen_add_to_physmap xatp = {
1851 .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1852 };
1853 xs_daemon_open();
1854 xc_interface_open();
1855 xc_gnttab_open();
1856 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1857 xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1858 return 0;
1859}
1860EOF
1861 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001862 then
Anthony PERARDb87de242011-05-24 14:34:20 +01001863 xen_ctrl_version=340
1864 xen=yes
1865
1866 # Xen 3.3.0
Peter Maydell69deef02012-08-02 18:30:26 +01001867 elif
1868 cat > $TMPC <<EOF &&
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001869#include <xenctrl.h>
1870#include <xs.h>
1871int main(void) {
1872 xs_daemon_open();
1873 xc_interface_open();
1874 xc_gnttab_open();
1875 xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1876 return 0;
1877}
1878EOF
1879 compile_prog "" "$xen_libs"
Peter Maydell69deef02012-08-02 18:30:26 +01001880 then
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001881 xen_ctrl_version=330
1882 xen=yes
1883
Stefan Weil50ced5b2011-12-17 09:27:39 +01001884 # Xen version unsupported
Juan Quintelab2266be2009-07-27 16:13:16 +02001885 else
Juan Quintelafc321b42009-08-12 18:29:55 +02001886 if test "$xen" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001887 feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
Juan Quintelafc321b42009-08-12 18:29:55 +02001888 fi
1889 xen=no
Juan Quintelab2266be2009-07-27 16:13:16 +02001890 fi
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00001891
1892 if test "$xen" = yes; then
1893 libs_softmmu="$xen_libs $libs_softmmu"
1894 fi
aliguorie37630c2009-04-22 15:19:10 +00001895fi
1896
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001897if test "$xen_pci_passthrough" != "no"; then
1898 if test "$xen" = "yes" && test "$linux" = "yes" &&
1899 test "$xen_ctrl_version" -ge 340; then
1900 xen_pci_passthrough=yes
1901 else
1902 if test "$xen_pci_passthrough" = "yes"; then
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001903 if test "$xen_ctrl_version" -lt 340; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01001904 error_exit "User requested feature Xen PCI Passthrough" \
1905 "This feature does not work with Xen 3.3"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001906 fi
Peter Maydell76ad07a2013-04-08 12:11:26 +01001907 error_exit "User requested feature Xen PCI Passthrough" \
1908 " but this feature requires /sys from Linux"
Anthony PERARDeb6fda02012-06-21 15:32:59 +00001909 fi
1910 xen_pci_passthrough=no
1911 fi
1912fi
1913
aliguorie37630c2009-04-22 15:19:10 +00001914##########################################
Alon Levy44dc0ca2011-05-15 11:51:28 +03001915# libtool probe
1916
Brad3f534582011-08-13 20:30:14 -04001917if ! has $libtool; then
Alon Levy44dc0ca2011-05-15 11:51:28 +03001918 libtool=
Alon Levy44dc0ca2011-05-15 11:51:28 +03001919fi
1920
Peter Maydell8e515b12013-05-04 21:57:51 +01001921# MacOSX ships with a libtool which isn't the GNU one; weed this
1922# out by checking whether libtool supports the --version switch
1923if test -n "$libtool"; then
1924 if ! "$libtool" --version >/dev/null 2>&1; then
1925 libtool=
1926 fi
1927fi
1928
Alon Levy44dc0ca2011-05-15 11:51:28 +03001929##########################################
Juan Quinteladfffc652009-08-12 18:29:57 +02001930# Sparse probe
1931if test "$sparse" != "no" ; then
Loïc Minier0dba6192010-01-28 21:26:51 +00001932 if has cgcc; then
Juan Quinteladfffc652009-08-12 18:29:57 +02001933 sparse=yes
1934 else
1935 if test "$sparse" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001936 feature_not_found "sparse" "Install sparse binary"
Juan Quinteladfffc652009-08-12 18:29:57 +02001937 fi
1938 sparse=no
1939 fi
1940fi
1941
1942##########################################
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001943# GTK probe
1944
1945if test "$gtk" != "no"; then
Daniel P. Berrange528de902013-02-25 15:20:44 +00001946 gtkpackage="gtk+-$gtkabi"
1947 if test "$gtkabi" = "3.0" ; then
1948 gtkversion="3.0.0"
1949 vtepackage="vte-2.90"
1950 vteversion="0.32.0"
1951 else
1952 gtkversion="2.18.0"
1953 vtepackage="vte"
1954 vteversion="0.24.0"
1955 fi
Peter Maydell0d185e62013-07-18 16:42:01 +01001956 if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
1957 if test "$gtk" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11001958 feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
Peter Maydell0d185e62013-07-18 16:42:01 +01001959 fi
1960 gtk="no"
1961 elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
1962 if test "$gtk" = "yes" ; then
1963 error_exit "libvte not found (required for gtk support)"
1964 fi
1965 gtk="no"
1966 else
Stefan Weilca871ec2013-08-27 21:09:12 +02001967 gtk_cflags=`$pkg_config --cflags $gtkpackage`
1968 gtk_libs=`$pkg_config --libs $gtkpackage`
1969 vte_cflags=`$pkg_config --cflags $vtepackage`
1970 vte_libs=`$pkg_config --libs $vtepackage`
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001971 libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1972 gtk="yes"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06001973 fi
1974fi
1975
1976##########################################
bellard11d9f692004-04-02 20:55:59 +00001977# SDL probe
1978
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001979# Look for sdl configuration program (pkg-config or sdl-config). Try
1980# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
Dave Airlie47c03742013-12-10 14:05:51 +10001981
1982if test $sdlabi = "2.0"; then
1983 sdl_config=$sdl2_config
1984 sdlname=sdl2
1985 sdlconfigname=sdl2_config
1986else
1987 sdlname=sdl
1988 sdlconfigname=sdl_config
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001989fi
1990
Dave Airlie47c03742013-12-10 14:05:51 +10001991if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
1992 sdl_config=$sdlconfigname
1993fi
1994
1995if $pkg_config $sdlname --exists; then
1996 sdlconfig="$pkg_config $sdlname"
Stefan Weilfec0e3e2010-04-11 18:44:18 +02001997 _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01001998elif has ${sdl_config}; then
1999 sdlconfig="$sdl_config"
Paolo Bonzini9316f802010-01-13 09:52:55 +01002000 _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00002001else
2002 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002003 feature_not_found "sdl" "Install SDL devel"
Loïc Miniera0dfd8a2010-01-28 21:15:18 +00002004 fi
2005 sdl=no
Paolo Bonzini9316f802010-01-13 09:52:55 +01002006fi
Scott Wood29e5bad2011-04-08 14:15:50 -05002007if test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
Paolo Bonzini3ec87ff2010-12-23 11:43:57 +01002008 echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
2009fi
bellard11d9f692004-04-02 20:55:59 +00002010
Paolo Bonzini9316f802010-01-13 09:52:55 +01002011sdl_too_old=no
Juan Quintelac4198152009-08-12 18:29:53 +02002012if test "$sdl" != "no" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002013 cat > $TMPC << EOF
bellard11d9f692004-04-02 20:55:59 +00002014#include <SDL.h>
2015#undef main /* We don't want SDL to override our main() */
2016int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
2017EOF
Paolo Bonzini9316f802010-01-13 09:52:55 +01002018 sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
TeLeMan74f42e12010-02-08 13:56:44 +08002019 if test "$static" = "yes" ; then
2020 sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
2021 else
2022 sdl_libs=`$sdlconfig --libs 2> /dev/null`
2023 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002024 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002025 if test "$_sdlversion" -lt 121 ; then
2026 sdl_too_old=yes
2027 else
2028 if test "$cocoa" = "no" ; then
2029 sdl=yes
2030 fi
2031 fi
aliguoricd01b4a2008-08-21 19:25:45 +00002032
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002033 # static link with sdl ? (note: sdl.pc's --static --libs is broken)
Juan Quintelaac119f92009-07-27 16:13:15 +02002034 if test "$sdl" = "yes" -a "$static" = "yes" ; then
Paolo Bonzini67c274d2010-01-13 09:52:54 +01002035 if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
Stefan Weilf8aa6c72010-03-01 22:10:46 +01002036 sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
2037 sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
Juan Quintelaac119f92009-07-27 16:13:15 +02002038 fi
Juan Quintela52166aa2009-08-03 14:46:03 +02002039 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002040 :
2041 else
2042 sdl=no
2043 fi
2044 fi # static link
Juan Quintelac4198152009-08-12 18:29:53 +02002045 else # sdl not found
2046 if test "$sdl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002047 feature_not_found "sdl" "Install SDL devel"
Juan Quintelac4198152009-08-12 18:29:53 +02002048 fi
2049 sdl=no
Juan Quintelaac119f92009-07-27 16:13:15 +02002050 fi # sdl compile test
Juan Quintelaa68551b2009-07-27 16:13:09 +02002051fi
bellard11d9f692004-04-02 20:55:59 +00002052
aliguori5368a422009-03-03 17:37:21 +00002053if test "$sdl" = "yes" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002054 cat > $TMPC <<EOF
aliguori5368a422009-03-03 17:37:21 +00002055#include <SDL.h>
2056#if defined(SDL_VIDEO_DRIVER_X11)
2057#include <X11/XKBlib.h>
2058#else
2059#error No x11 support
2060#endif
2061int main(void) { return 0; }
2062EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002063 if compile_prog "$sdl_cflags" "$sdl_libs" ; then
Juan Quintelaac119f92009-07-27 16:13:15 +02002064 sdl_libs="$sdl_libs -lX11"
2065 fi
Juan Quintela07056672009-08-03 14:46:27 +02002066 libs_softmmu="$sdl_libs $libs_softmmu"
aliguori5368a422009-03-03 17:37:21 +00002067fi
2068
ths8f28f3f2007-01-05 21:25:54 +00002069##########################################
Michael R. Hines2da776d2013-07-22 10:01:54 -04002070# RDMA needs OpenFabrics libraries
2071if test "$rdma" != "no" ; then
2072 cat > $TMPC <<EOF
2073#include <rdma/rdma_cma.h>
2074int main(void) { return 0; }
2075EOF
2076 rdma_libs="-lrdmacm -libverbs"
2077 if compile_prog "" "$rdma_libs" ; then
2078 rdma="yes"
2079 libs_softmmu="$libs_softmmu $rdma_libs"
2080 else
2081 if test "$rdma" = "yes" ; then
2082 error_exit \
2083 " OpenFabrics librdmacm/libibverbs not present." \
2084 " Your options:" \
2085 " (1) Fast: Install infiniband packages from your distro." \
2086 " (2) Cleanest: Install libraries from www.openfabrics.org" \
2087 " (3) Also: Install softiwarp if you don't have RDMA hardware"
2088 fi
2089 rdma="no"
2090 fi
2091fi
2092
2093##########################################
Tim Hardeck7536ee42013-01-21 11:04:44 +01002094# VNC TLS/WS detection
2095if test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
Juan Quintela1be10ad2009-08-12 18:20:28 +02002096 cat > $TMPC <<EOF
aliguoriae6b5e52008-08-06 16:55:50 +00002097#include <gnutls/gnutls.h>
2098int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
2099EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01002100 vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2101 vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
Juan Quintela1be10ad2009-08-12 18:20:28 +02002102 if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
Tim Hardeck7536ee42013-01-21 11:04:44 +01002103 if test "$vnc_tls" != "no" ; then
2104 vnc_tls=yes
2105 fi
2106 if test "$vnc_ws" != "no" ; then
2107 vnc_ws=yes
2108 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02002109 libs_softmmu="$vnc_tls_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002110 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
Juan Quintela1be10ad2009-08-12 18:20:28 +02002111 else
2112 if test "$vnc_tls" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002113 feature_not_found "vnc-tls" "Install gnutls devel"
aliguoriae6b5e52008-08-06 16:55:50 +00002114 fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01002115 if test "$vnc_ws" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002116 feature_not_found "vnc-ws" "Install gnutls devel"
Tim Hardeck7536ee42013-01-21 11:04:44 +01002117 fi
Juan Quintela1be10ad2009-08-12 18:20:28 +02002118 vnc_tls=no
Tim Hardeck7536ee42013-01-21 11:04:44 +01002119 vnc_ws=no
Juan Quintela1be10ad2009-08-12 18:20:28 +02002120 fi
ths8d5d2d42007-08-25 01:37:51 +00002121fi
2122
2123##########################################
Benoît Canet95c6bff2014-02-21 22:21:15 +01002124# Quorum probe (check for gnutls)
2125if test "$quorum" != "no" ; then
2126cat > $TMPC <<EOF
2127#include <gnutls/gnutls.h>
2128#include <gnutls/crypto.h>
2129int main(void) {char data[4096], digest[32];
2130gnutls_hash_fast(GNUTLS_DIG_SHA256, data, 4096, digest);
2131return 0;
2132}
2133EOF
2134quorum_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
2135quorum_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
2136if compile_prog "$quorum_tls_cflags" "$quorum_tls_libs" ; then
2137 qcow_tls=yes
2138 libs_softmmu="$quorum_tls_libs $libs_softmmu"
2139 libs_tools="$quorum_tls_libs $libs_softmmu"
2140 QEMU_CFLAGS="$QEMU_CFLAGS $quorum_tls_cflags"
2141else
2142 echo "gnutls > 2.10.0 required to compile Quorum"
2143 exit 1
2144fi
2145fi
2146
2147##########################################
aliguori2f9606b2009-03-06 20:27:28 +00002148# VNC SASL detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002149if test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
Juan Quintelaea784e32009-08-12 18:20:29 +02002150 cat > $TMPC <<EOF
aliguori2f9606b2009-03-06 20:27:28 +00002151#include <sasl/sasl.h>
2152#include <stdio.h>
2153int main(void) { sasl_server_init(NULL, "qemu"); return 0; }
2154EOF
Juan Quintelaea784e32009-08-12 18:20:29 +02002155 # Assuming Cyrus-SASL installed in /usr prefix
2156 vnc_sasl_cflags=""
2157 vnc_sasl_libs="-lsasl2"
2158 if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
2159 vnc_sasl=yes
2160 libs_softmmu="$vnc_sasl_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002161 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
Juan Quintelaea784e32009-08-12 18:20:29 +02002162 else
2163 if test "$vnc_sasl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002164 feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
aliguori2f9606b2009-03-06 20:27:28 +00002165 fi
Juan Quintelaea784e32009-08-12 18:20:29 +02002166 vnc_sasl=no
2167 fi
aliguori2f9606b2009-03-06 20:27:28 +00002168fi
2169
2170##########################################
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002171# VNC JPEG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002172if test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002173cat > $TMPC <<EOF
2174#include <stdio.h>
2175#include <jpeglib.h>
2176int main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
2177EOF
2178 vnc_jpeg_cflags=""
2179 vnc_jpeg_libs="-ljpeg"
2180 if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
2181 vnc_jpeg=yes
2182 libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
Paolo Bonzinica273d52012-12-20 12:29:19 +01002183 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002184 else
2185 if test "$vnc_jpeg" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002186 feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
Corentin Chary2f6f5c72010-07-07 20:57:49 +02002187 fi
2188 vnc_jpeg=no
2189 fi
2190fi
2191
2192##########################################
Corentin Charyefe556a2010-07-07 20:57:56 +02002193# VNC PNG detection
Jes Sorensen821601e2011-03-16 13:33:36 +01002194if test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02002195cat > $TMPC <<EOF
2196//#include <stdio.h>
2197#include <png.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002198#include <stddef.h>
Corentin Charyefe556a2010-07-07 20:57:56 +02002199int main(void) {
2200 png_structp png_ptr;
2201 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
Peter Maydell7edc3fe2012-07-18 15:10:24 +01002202 return png_ptr != 0;
Corentin Charyefe556a2010-07-07 20:57:56 +02002203}
2204EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002205 if $pkg_config libpng --exists; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002206 vnc_png_cflags=`$pkg_config libpng --cflags`
2207 vnc_png_libs=`$pkg_config libpng --libs`
Brad9af80252011-07-30 01:45:55 -04002208 else
Corentin Charyefe556a2010-07-07 20:57:56 +02002209 vnc_png_cflags=""
2210 vnc_png_libs="-lpng"
Brad9af80252011-07-30 01:45:55 -04002211 fi
Corentin Charyefe556a2010-07-07 20:57:56 +02002212 if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
2213 vnc_png=yes
2214 libs_softmmu="$vnc_png_libs $libs_softmmu"
Brad9af80252011-07-30 01:45:55 -04002215 QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
Corentin Charyefe556a2010-07-07 20:57:56 +02002216 else
2217 if test "$vnc_png" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002218 feature_not_found "vnc-png" "Install libpng devel"
Corentin Charyefe556a2010-07-07 20:57:56 +02002219 fi
2220 vnc_png=no
2221 fi
2222fi
2223
2224##########################################
aliguori76655d62009-03-06 20:27:37 +00002225# fnmatch() probe, used for ACL routines
2226fnmatch="no"
2227cat > $TMPC << EOF
2228#include <fnmatch.h>
2229int main(void)
2230{
2231 fnmatch("foo", "foo", 0);
2232 return 0;
2233}
2234EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002235if compile_prog "" "" ; then
aliguori76655d62009-03-06 20:27:37 +00002236 fnmatch="yes"
2237fi
2238
2239##########################################
Stefan Weilee682d22009-10-01 20:10:37 +02002240# uuid_generate() probe, used for vdi block driver
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002241# Note that on some systems (notably MacOSX) no extra library
2242# need be linked to get the uuid functions.
Stefan Weilee682d22009-10-01 20:10:37 +02002243if test "$uuid" != "no" ; then
2244 uuid_libs="-luuid"
2245 cat > $TMPC << EOF
2246#include <uuid/uuid.h>
2247int main(void)
2248{
2249 uuid_t my_uuid;
2250 uuid_generate(my_uuid);
2251 return 0;
2252}
2253EOF
Peter Maydell2d16c8e2013-05-14 21:36:39 +01002254 if compile_prog "" "" ; then
2255 uuid="yes"
2256 elif compile_prog "" "$uuid_libs" ; then
Stefan Weilee682d22009-10-01 20:10:37 +02002257 uuid="yes"
2258 libs_softmmu="$uuid_libs $libs_softmmu"
2259 libs_tools="$uuid_libs $libs_tools"
2260 else
2261 if test "$uuid" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002262 feature_not_found "uuid" "Install libuuid devel"
Stefan Weilee682d22009-10-01 20:10:37 +02002263 fi
2264 uuid=no
2265 fi
2266fi
2267
Jeff Cody4f18b782013-10-30 10:44:39 -04002268if test "$vhdx" = "yes" ; then
2269 if test "$uuid" = "no" ; then
2270 error_exit "uuid required for VHDX support"
2271 fi
2272elif test "$vhdx" != "no" ; then
2273 if test "$uuid" = "yes" ; then
2274 vhdx=yes
2275 else
2276 vhdx=no
2277 fi
2278fi
2279
Stefan Weilee682d22009-10-01 20:10:37 +02002280##########################################
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002281# xfsctl() probe, used for raw-posix
2282if test "$xfs" != "no" ; then
2283 cat > $TMPC << EOF
Stefan Weilffc41d12011-12-17 09:27:36 +01002284#include <stddef.h> /* NULL */
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002285#include <xfs/xfs.h>
2286int main(void)
2287{
2288 xfsctl(NULL, 0, 0, NULL);
2289 return 0;
2290}
2291EOF
2292 if compile_prog "" "" ; then
2293 xfs="yes"
2294 else
2295 if test "$xfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002296 feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01002297 fi
2298 xfs=no
2299 fi
2300fi
2301
2302##########################################
ths8a16d272008-07-19 09:56:24 +00002303# vde libraries probe
Juan Quinteladfb278b2009-08-12 18:20:27 +02002304if test "$vde" != "no" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002305 vde_libs="-lvdeplug"
ths8a16d272008-07-19 09:56:24 +00002306 cat > $TMPC << EOF
2307#include <libvdeplug.h>
pbrook4a7f0e02008-09-07 16:42:53 +00002308int main(void)
2309{
2310 struct vde_open_args a = {0, 0, 0};
Peter Maydellfea08e02012-07-18 15:10:25 +01002311 char s[] = "";
2312 vde_open(s, s, &a);
pbrook4a7f0e02008-09-07 16:42:53 +00002313 return 0;
2314}
ths8a16d272008-07-19 09:56:24 +00002315EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002316 if compile_prog "" "$vde_libs" ; then
Juan Quintela4baae0a2009-07-27 16:13:19 +02002317 vde=yes
Juan Quintela8e02e542009-08-03 14:47:07 +02002318 libs_softmmu="$vde_libs $libs_softmmu"
2319 libs_tools="$vde_libs $libs_tools"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002320 else
2321 if test "$vde" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002322 feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
Juan Quinteladfb278b2009-08-12 18:20:27 +02002323 fi
2324 vde=no
Juan Quintela4baae0a2009-07-27 16:13:19 +02002325 fi
ths8a16d272008-07-19 09:56:24 +00002326fi
2327
2328##########################################
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01002329# netmap support probe
2330# Apart from looking for netmap headers, we make sure that the host API version
2331# supports the netmap backend (>=11). The upper bound (15) is meant to simulate
2332# a minor/major version number. Minor new features will be marked with values up
2333# to 15, and if something happens that requires a change to the backend we will
2334# move above 15, submit the backend fixes and modify this two bounds.
Vincenzo Maffione58952132013-11-06 11:44:06 +01002335if test "$netmap" != "no" ; then
2336 cat > $TMPC << EOF
2337#include <inttypes.h>
2338#include <net/if.h>
2339#include <net/netmap.h>
2340#include <net/netmap_user.h>
Vincenzo Maffione0a985b32014-02-20 15:40:43 +01002341#if (NETMAP_API < 11) || (NETMAP_API > 15)
2342#error
2343#endif
Vincenzo Maffione58952132013-11-06 11:44:06 +01002344int main(void) { return 0; }
2345EOF
2346 if compile_prog "" "" ; then
2347 netmap=yes
2348 else
2349 if test "$netmap" = "yes" ; then
2350 feature_not_found "netmap"
2351 fi
2352 netmap=no
2353 fi
2354fi
2355
2356##########################################
Corey Bryant47e98652012-01-26 09:42:26 -05002357# libcap-ng library probe
2358if test "$cap_ng" != "no" ; then
2359 cap_libs="-lcap-ng"
2360 cat > $TMPC << EOF
2361#include <cap-ng.h>
2362int main(void)
2363{
2364 capng_capability_to_name(CAPNG_EFFECTIVE);
2365 return 0;
2366}
2367EOF
2368 if compile_prog "" "$cap_libs" ; then
2369 cap_ng=yes
2370 libs_tools="$cap_libs $libs_tools"
2371 else
2372 if test "$cap_ng" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002373 feature_not_found "cap_ng" "Install libcap-ng devel"
Corey Bryant47e98652012-01-26 09:42:26 -05002374 fi
2375 cap_ng=no
2376 fi
2377fi
2378
2379##########################################
malcc2de5c92008-06-28 19:13:06 +00002380# Sound support libraries probe
ths8f28f3f2007-01-05 21:25:54 +00002381
malcc2de5c92008-06-28 19:13:06 +00002382audio_drv_probe()
2383{
2384 drv=$1
2385 hdr=$2
2386 lib=$3
2387 exp=$4
2388 cfl=$5
2389 cat > $TMPC << EOF
2390#include <$hdr>
2391int main(void) { $exp }
ths8f28f3f2007-01-05 21:25:54 +00002392EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002393 if compile_prog "$cfl" "$lib" ; then
malcc2de5c92008-06-28 19:13:06 +00002394 :
2395 else
Peter Maydell76ad07a2013-04-08 12:11:26 +01002396 error_exit "$drv check failed" \
2397 "Make sure to have the $drv libs and headers installed."
malcc2de5c92008-06-28 19:13:06 +00002398 fi
2399}
2400
malc2fa7d3b2008-07-29 12:58:44 +00002401audio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
malcc2de5c92008-06-28 19:13:06 +00002402for drv in $audio_drv_list; do
2403 case $drv in
2404 alsa)
2405 audio_drv_probe $drv alsa/asoundlib.h -lasound \
Stefan Weile35bcb02012-07-18 15:10:19 +01002406 "return snd_pcm_close((snd_pcm_t *)0);"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002407 libs_softmmu="-lasound $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002408 ;;
2409
2410 fmod)
2411 if test -z $fmod_lib || test -z $fmod_inc; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002412 error_exit "You must specify path to FMOD library and headers" \
2413 "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
malcc2de5c92008-06-28 19:13:06 +00002414 fi
2415 audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002416 libs_softmmu="$fmod_lib $libs_softmmu"
malcc2de5c92008-06-28 19:13:06 +00002417 ;;
2418
2419 esd)
2420 audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002421 libs_softmmu="-lesd $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002422 audio_pt_int="yes"
malcc2de5c92008-06-28 19:13:06 +00002423 ;;
malcb8e59f12008-07-02 21:03:08 +00002424
2425 pa)
Marc-André Lureaua394aed2012-04-17 14:32:42 +02002426 audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2427 "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2428 libs_softmmu="-lpulse $libs_softmmu"
Juan Quintela67f86e82009-08-03 14:46:59 +02002429 audio_pt_int="yes"
malcb8e59f12008-07-02 21:03:08 +00002430 ;;
2431
Juan Quintela997e6902009-08-03 14:46:29 +02002432 coreaudio)
2433 libs_softmmu="-framework CoreAudio $libs_softmmu"
2434 ;;
2435
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002436 dsound)
2437 libs_softmmu="-lole32 -ldxguid $libs_softmmu"
malcd5631632009-10-10 01:13:41 +04002438 audio_win_int="yes"
Juan Quintelaa4bf6782009-08-03 14:46:30 +02002439 ;;
2440
2441 oss)
2442 libs_softmmu="$oss_lib $libs_softmmu"
2443 ;;
2444
2445 sdl|wav)
blueswir12f6a1ab2008-08-21 18:00:53 +00002446 # XXX: Probes for CoreAudio, DirectSound, SDL(?)
2447 ;;
2448
malcd5631632009-10-10 01:13:41 +04002449 winwave)
2450 libs_softmmu="-lwinmm $libs_softmmu"
2451 audio_win_int="yes"
2452 ;;
2453
malce4c63a62008-07-19 16:15:16 +00002454 *)
malc1c9b2a52008-07-19 16:57:30 +00002455 echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
Peter Maydell76ad07a2013-04-08 12:11:26 +01002456 error_exit "Unknown driver '$drv' selected" \
2457 "Possible drivers are: $audio_possible_drivers"
malce4c63a62008-07-19 16:15:16 +00002458 }
2459 ;;
malcc2de5c92008-06-28 19:13:06 +00002460 esac
2461done
ths8f28f3f2007-01-05 21:25:54 +00002462
balrog4d3b6f62008-02-10 16:33:14 +00002463##########################################
aurel322e4d9fb2008-04-08 06:01:02 +00002464# BrlAPI probe
2465
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002466if test "$brlapi" != "no" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002467 brlapi_libs="-lbrlapi"
2468 cat > $TMPC << EOF
aurel322e4d9fb2008-04-08 06:01:02 +00002469#include <brlapi.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002470#include <stddef.h>
aurel322e4d9fb2008-04-08 06:01:02 +00002471int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
2472EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002473 if compile_prog "" "$brlapi_libs" ; then
Juan Quintelaeb822842009-07-27 16:13:18 +02002474 brlapi=yes
Juan Quintela264606b2009-08-03 14:46:39 +02002475 libs_softmmu="$brlapi_libs $libs_softmmu"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002476 else
2477 if test "$brlapi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002478 feature_not_found "brlapi" "Install brlapi devel"
Juan Quintela4ffcedb2009-08-12 18:20:26 +02002479 fi
2480 brlapi=no
Juan Quintelaeb822842009-07-27 16:13:18 +02002481 fi
2482fi
aurel322e4d9fb2008-04-08 06:01:02 +00002483
2484##########################################
balrog4d3b6f62008-02-10 16:33:14 +00002485# curses probe
Juan Quintelac584a6d2009-08-12 18:20:30 +02002486if test "$curses" != "no" ; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002487 if test "$mingw32" = "yes" ; then
2488 curses_list="-lpdcurses"
2489 else
Ed Mastecfeda5f2013-05-24 16:07:00 -04002490 curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
Michael Tokareva3605bf2013-05-25 13:17:21 +04002491 fi
Juan Quintelac584a6d2009-08-12 18:20:30 +02002492 curses_found=no
balrog4d3b6f62008-02-10 16:33:14 +00002493 cat > $TMPC << EOF
2494#include <curses.h>
Stefan Weilef9a2522011-12-17 17:46:02 +01002495int main(void) {
2496 const char *s = curses_version();
2497 resize_term(0, 0);
2498 return s != 0;
2499}
balrog4d3b6f62008-02-10 16:33:14 +00002500EOF
Vadim Evardecbe2512013-01-15 16:17:24 +04002501 IFS=:
Juan Quintela4f78ef92009-08-12 18:20:23 +02002502 for curses_lib in $curses_list; do
Vadim Evardecbe2512013-01-15 16:17:24 +04002503 unset IFS
Juan Quintela4f78ef92009-08-12 18:20:23 +02002504 if compile_prog "" "$curses_lib" ; then
Juan Quintelac584a6d2009-08-12 18:20:30 +02002505 curses_found=yes
Juan Quintela4f78ef92009-08-12 18:20:23 +02002506 libs_softmmu="$curses_lib $libs_softmmu"
2507 break
2508 fi
2509 done
Vadim Evardecbe2512013-01-15 16:17:24 +04002510 unset IFS
Juan Quintelac584a6d2009-08-12 18:20:30 +02002511 if test "$curses_found" = "yes" ; then
2512 curses=yes
2513 else
2514 if test "$curses" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002515 feature_not_found "curses" "Install ncurses devel"
Juan Quintelac584a6d2009-08-12 18:20:30 +02002516 fi
2517 curses=no
2518 fi
Juan Quintela4f78ef92009-08-12 18:20:23 +02002519fi
balrog4d3b6f62008-02-10 16:33:14 +00002520
blueswir1414f0da2008-08-15 18:20:52 +00002521##########################################
Alexander Graf769ce762009-05-11 17:41:42 +02002522# curl probe
Juan Quintela788c8192009-08-12 18:29:47 +02002523if test "$curl" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002524 if $pkg_config libcurl --exists; then
Michael Tokareva3605bf2013-05-25 13:17:21 +04002525 curlconfig="$pkg_config libcurl"
2526 else
2527 curlconfig=curl-config
2528 fi
Alexander Graf769ce762009-05-11 17:41:42 +02002529 cat > $TMPC << EOF
2530#include <curl/curl.h>
Peter Maydell0b862ce2011-06-09 22:54:29 +01002531int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
Alexander Graf769ce762009-05-11 17:41:42 +02002532EOF
Paolo Bonzini4e2b0652010-01-13 09:52:56 +01002533 curl_cflags=`$curlconfig --cflags 2>/dev/null`
2534 curl_libs=`$curlconfig --libs 2>/dev/null`
Juan Quintelab1d5a272009-08-03 14:46:05 +02002535 if compile_prog "$curl_cflags" "$curl_libs" ; then
Alexander Graf769ce762009-05-11 17:41:42 +02002536 curl=yes
Juan Quintela788c8192009-08-12 18:29:47 +02002537 else
2538 if test "$curl" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002539 feature_not_found "curl" "Install libcurl devel"
Juan Quintela788c8192009-08-12 18:29:47 +02002540 fi
2541 curl=no
Alexander Graf769ce762009-05-11 17:41:42 +02002542 fi
2543fi # test "$curl"
2544
2545##########################################
balrogfb599c92008-09-28 23:49:55 +00002546# bluez support probe
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002547if test "$bluez" != "no" ; then
balroge820e3f2008-09-30 02:27:44 +00002548 cat > $TMPC << EOF
2549#include <bluetooth/bluetooth.h>
2550int main(void) { return bt_error(0); }
2551EOF
Paolo Bonzinia8bd70a2010-12-23 11:43:55 +01002552 bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2553 bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
Juan Quintela52166aa2009-08-03 14:46:03 +02002554 if compile_prog "$bluez_cflags" "$bluez_libs" ; then
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002555 bluez=yes
Juan Quintelae482d562009-08-03 14:46:37 +02002556 libs_softmmu="$bluez_libs $libs_softmmu"
balroge820e3f2008-09-30 02:27:44 +00002557 else
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002558 if test "$bluez" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002559 feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02002560 fi
balroge820e3f2008-09-30 02:27:44 +00002561 bluez="no"
2562 fi
balrogfb599c92008-09-28 23:49:55 +00002563fi
2564
2565##########################################
Anthony Liguorie18df142011-07-19 14:50:29 -05002566# glib support probe
Paolo Bonzinia52d28a2012-04-05 13:01:54 +02002567
2568if test "$mingw32" = yes; then
2569 # g_poll is required in order to integrate with the glib main loop.
2570 glib_req_ver=2.20
2571else
2572 glib_req_ver=2.12
2573fi
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01002574glib_modules=gthread-2.0
2575if test "$modules" = yes; then
2576 glib_modules="$glib_modules gmodule-2.0"
2577fi
Fam Zhenge26110c2014-02-10 14:48:57 +08002578
Paolo Bonziniaa0d1f42014-02-25 17:36:55 +01002579for i in $glib_modules; do
Fam Zhenge26110c2014-02-10 14:48:57 +08002580 if $pkg_config --atleast-version=$glib_req_ver $i; then
2581 glib_cflags=`$pkg_config --cflags $i`
2582 glib_libs=`$pkg_config --libs $i`
2583 CFLAGS="$glib_cflags $CFLAGS"
2584 LIBS="$glib_libs $LIBS"
2585 libs_qga="$glib_libs $libs_qga"
2586 else
2587 error_exit "glib-$glib_req_ver $i is required to compile QEMU"
2588 fi
2589done
2590
2591##########################################
2592# SHA command probe for modules
2593if test "$modules" = yes; then
2594 shacmd_probe="sha1sum sha1 shasum"
2595 for c in $shacmd_probe; do
2596 if which $c &>/dev/null; then
2597 shacmd="$c"
2598 break
2599 fi
2600 done
2601 if test "$shacmd" = ""; then
2602 error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
2603 fi
Anthony Liguorie18df142011-07-19 14:50:29 -05002604fi
2605
2606##########################################
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002607# pixman support probe
2608
2609if test "$pixman" = ""; then
Robert Schiele74880fe2012-12-04 16:58:08 +01002610 if test "$want_tools" = "no" -a "$softmmu" = "no"; then
2611 pixman="none"
2612 elif $pkg_config pixman-1 > /dev/null 2>&1; then
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002613 pixman="system"
2614 else
2615 pixman="internal"
2616 fi
2617fi
Robert Schiele74880fe2012-12-04 16:58:08 +01002618if test "$pixman" = "none"; then
2619 if test "$want_tools" != "no" -o "$softmmu" != "no"; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002620 error_exit "pixman disabled but system emulation or tools build" \
2621 "enabled. You can turn off pixman only if you also" \
2622 "disable all system emulation targets and the tools" \
2623 "build with '--disable-tools --disable-system'."
Robert Schiele74880fe2012-12-04 16:58:08 +01002624 fi
2625 pixman_cflags=
2626 pixman_libs=
2627elif test "$pixman" = "system"; then
Stefan Weilca871ec2013-08-27 21:09:12 +02002628 pixman_cflags=`$pkg_config --cflags pixman-1`
2629 pixman_libs=`$pkg_config --libs pixman-1`
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002630else
2631 if test ! -d ${source_path}/pixman/pixman; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002632 error_exit "pixman not present. Your options:" \
2633 " (1) Preferred: Install the pixman devel package (any recent" \
2634 " distro should have packages as Xorg needs pixman too)." \
2635 " (2) Fetch the pixman submodule, using:" \
2636 " git submodule update --init pixman"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002637 fi
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01002638 mkdir -p pixman/pixman
2639 pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
2640 pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002641fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02002642
2643##########################################
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302644# libcap probe
2645
2646if test "$cap" != "no" ; then
2647 cat > $TMPC <<EOF
2648#include <stdio.h>
2649#include <sys/capability.h>
Stefan Weilcc939742012-07-18 15:10:20 +01002650int main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
M. Mohan Kumar17bff522011-12-14 13:58:42 +05302651EOF
2652 if compile_prog "" "-lcap" ; then
2653 cap=yes
2654 else
2655 cap=no
2656 fi
2657fi
2658
2659##########################################
aliguorie5d355d2009-04-24 18:03:15 +00002660# pthread probe
Brad4b29ec42011-08-07 20:02:11 -04002661PTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
aliguori3c529d92008-12-12 16:41:40 +00002662
Christoph Hellwig4dd75c72009-08-10 23:39:39 +02002663pthread=no
aliguorie5d355d2009-04-24 18:03:15 +00002664cat > $TMPC << EOF
aliguori3c529d92008-12-12 16:41:40 +00002665#include <pthread.h>
Stefan Weil7a42bbe2011-12-17 09:27:32 +01002666static void *f(void *p) { return NULL; }
2667int main(void) {
2668 pthread_t thread;
2669 pthread_create(&thread, 0, f, 0);
2670 return 0;
2671}
blueswir1414f0da2008-08-15 18:20:52 +00002672EOF
Andreas Färberbd00d532010-09-20 00:50:44 +02002673if compile_prog "" "" ; then
2674 pthread=yes
2675else
2676 for pthread_lib in $PTHREADLIBS_LIST; do
2677 if compile_prog "" "$pthread_lib" ; then
2678 pthread=yes
Peter Portantee3c56762012-04-20 10:36:12 -04002679 found=no
2680 for lib_entry in $LIBS; do
2681 if test "$lib_entry" = "$pthread_lib"; then
2682 found=yes
2683 break
2684 fi
2685 done
2686 if test "$found" = "no"; then
2687 LIBS="$pthread_lib $LIBS"
2688 fi
Andreas Färberbd00d532010-09-20 00:50:44 +02002689 break
2690 fi
2691 done
2692fi
blueswir1414f0da2008-08-15 18:20:52 +00002693
Anthony Liguori4617e592009-08-25 17:21:56 -05002694if test "$mingw32" != yes -a "$pthread" = no; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002695 error_exit "pthread check failed" \
2696 "Make sure to have the pthread libs and headers installed."
aliguorie5d355d2009-04-24 18:03:15 +00002697fi
2698
aliguoribf9298b2008-12-05 20:05:26 +00002699##########################################
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002700# rbd probe
2701if test "$rbd" != "no" ; then
2702 cat > $TMPC <<EOF
2703#include <stdio.h>
Josh Durginad32e9c2011-05-26 16:07:31 -07002704#include <rbd/librbd.h>
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002705int main(void) {
Josh Durginad32e9c2011-05-26 16:07:31 -07002706 rados_t cluster;
2707 rados_create(&cluster, NULL);
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002708 return 0;
2709}
2710EOF
Josh Durginad32e9c2011-05-26 16:07:31 -07002711 rbd_libs="-lrbd -lrados"
2712 if compile_prog "" "$rbd_libs" ; then
2713 rbd=yes
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002714 else
2715 if test "$rbd" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002716 feature_not_found "rados block device" "Install librbd/ceph devel"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002717 fi
2718 rbd=no
2719 fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01002720fi
2721
2722##########################################
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002723# libssh2 probe
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002724min_libssh2_version=1.2.8
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002725if test "$libssh2" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002726 if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002727 libssh2_cflags=`$pkg_config libssh2 --cflags`
2728 libssh2_libs=`$pkg_config libssh2 --libs`
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002729 libssh2=yes
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002730 else
2731 if test "$libssh2" = "yes" ; then
Richard W.M. Jones4fc16832013-04-19 09:16:39 +01002732 error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01002733 fi
2734 libssh2=no
2735 fi
2736fi
2737
2738##########################################
Richard W.M. Jones9a2d4622013-04-09 15:30:54 +01002739# libssh2_sftp_fsync probe
2740
2741if test "$libssh2" = "yes"; then
2742 cat > $TMPC <<EOF
2743#include <stdio.h>
2744#include <libssh2.h>
2745#include <libssh2_sftp.h>
2746int main(void) {
2747 LIBSSH2_SESSION *session;
2748 LIBSSH2_SFTP *sftp;
2749 LIBSSH2_SFTP_HANDLE *sftp_handle;
2750 session = libssh2_session_init ();
2751 sftp = libssh2_sftp_init (session);
2752 sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
2753 libssh2_sftp_fsync (sftp_handle);
2754 return 0;
2755}
2756EOF
2757 # libssh2_cflags/libssh2_libs defined in previous test.
2758 if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
2759 QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
2760 fi
2761fi
2762
2763##########################################
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002764# linux-aio probe
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002765
2766if test "$linux_aio" != "no" ; then
2767 cat > $TMPC <<EOF
2768#include <libaio.h>
2769#include <sys/eventfd.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05002770#include <stddef.h>
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002771int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
2772EOF
2773 if compile_prog "" "-laio" ; then
2774 linux_aio=yes
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002775 else
2776 if test "$linux_aio" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002777 feature_not_found "linux AIO" "Install libaio devel"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002778 fi
Luiz Capitulino3cfcae32009-08-31 13:18:12 -03002779 linux_aio=no
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02002780 fi
2781fi
2782
2783##########################################
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01002784# TPM passthrough is only on x86 Linux
2785
2786if test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
2787 tpm_passthrough=$tpm
2788else
2789 tpm_passthrough=no
2790fi
2791
2792##########################################
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002793# adjust virtio-blk-data-plane based on linux-aio
2794
2795if test "$virtio_blk_data_plane" = "yes" -a \
2796 "$linux_aio" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01002797 error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01002798elif test -z "$virtio_blk_data_plane" ; then
2799 virtio_blk_data_plane=$linux_aio
2800fi
2801
2802##########################################
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002803# attr probe
2804
2805if test "$attr" != "no" ; then
2806 cat > $TMPC <<EOF
2807#include <stdio.h>
2808#include <sys/types.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002809#ifdef CONFIG_LIBATTR
2810#include <attr/xattr.h>
2811#else
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002812#include <sys/xattr.h>
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002813#endif
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002814int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2815EOF
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002816 if compile_prog "" "" ; then
2817 attr=yes
2818 # Older distros have <attr/xattr.h>, and need -lattr:
Pavel Borzenkovf2338fb2011-11-11 00:26:59 +04002819 elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002820 attr=yes
2821 LIBS="-lattr $LIBS"
Avi Kivity4f26f2b2011-11-09 14:44:52 +02002822 libattr=yes
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002823 else
2824 if test "$attr" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002825 feature_not_found "ATTR" "Install libc6 or libattr devel"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07002826 fi
2827 attr=no
2828 fi
2829fi
2830
2831##########################################
aliguoribf9298b2008-12-05 20:05:26 +00002832# iovec probe
2833cat > $TMPC <<EOF
blueswir1db34f0b2009-01-14 18:03:53 +00002834#include <sys/types.h>
aliguoribf9298b2008-12-05 20:05:26 +00002835#include <sys/uio.h>
blueswir1db34f0b2009-01-14 18:03:53 +00002836#include <unistd.h>
Stefan Weilf91f9be2011-12-17 09:27:33 +01002837int main(void) { return sizeof(struct iovec); }
aliguoribf9298b2008-12-05 20:05:26 +00002838EOF
2839iovec=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002840if compile_prog "" "" ; then
aliguoribf9298b2008-12-05 20:05:26 +00002841 iovec=yes
2842fi
2843
aurel32f652e6a2008-12-16 10:43:48 +00002844##########################################
aliguoriceb42de2009-04-07 18:43:28 +00002845# preadv probe
2846cat > $TMPC <<EOF
2847#include <sys/types.h>
2848#include <sys/uio.h>
2849#include <unistd.h>
Blue Swirlc075a722012-08-09 20:21:25 +00002850int main(void) { return preadv(0, 0, 0, 0); }
aliguoriceb42de2009-04-07 18:43:28 +00002851EOF
2852preadv=no
Juan Quintela52166aa2009-08-03 14:46:03 +02002853if compile_prog "" "" ; then
aliguoriceb42de2009-04-07 18:43:28 +00002854 preadv=yes
2855fi
2856
2857##########################################
aurel32f652e6a2008-12-16 10:43:48 +00002858# fdt probe
Peter Maydelle169e1e2013-05-24 16:26:54 +01002859# fdt support is mandatory for at least some target architectures,
2860# so insist on it if we're building those system emulators.
2861fdt_required=no
2862for target in $target_list; do
2863 case $target in
Alexander Graf6a49fa92013-09-03 20:12:22 +01002864 aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
Peter Maydelle169e1e2013-05-24 16:26:54 +01002865 fdt_required=yes
2866 ;;
2867 esac
2868done
2869
2870if test "$fdt_required" = "yes"; then
2871 if test "$fdt" = "no"; then
2872 error_exit "fdt disabled but some requested targets require it." \
2873 "You can turn off fdt only if you also disable all the system emulation" \
2874 "targets which need it (by specifying a cut down --target-list)."
2875 fi
2876 fdt=yes
2877fi
2878
Juan Quintela2df87df2009-08-12 18:29:54 +02002879if test "$fdt" != "no" ; then
Juan Quintelab41af4b2009-07-27 16:13:20 +02002880 fdt_libs="-lfdt"
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002881 # explicitly check for libfdt_env.h as it is missing in some stable installs
Juan Quintelab41af4b2009-07-27 16:13:20 +02002882 cat > $TMPC << EOF
Peter Crosthwaite96ce6542013-05-27 14:20:57 +10002883#include <libfdt_env.h>
aurel32f652e6a2008-12-16 10:43:48 +00002884int main(void) { return 0; }
2885EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002886 if compile_prog "" "$fdt_libs" ; then
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002887 # system DTC is good - use it
aurel32f652e6a2008-12-16 10:43:48 +00002888 fdt=yes
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002889 elif test -d ${source_path}/dtc/libfdt ; then
2890 # have submodule DTC - use it
2891 fdt=yes
2892 dtc_internal="yes"
2893 mkdir -p dtc
2894 if [ "$source_path" != `pwd` ] ; then
2895 symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2896 symlink "$source_path/dtc/scripts" "dtc/scripts"
Juan Quintela2df87df2009-08-12 18:29:54 +02002897 fi
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002898 fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2899 fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2900 elif test "$fdt" = "yes" ; then
2901 # have neither and want - prompt for system/submodule install
Stewart Smith3f281822014-01-24 12:39:06 +11002902 error_exit "DTC (libfdt) not present. Your options:" \
2903 " (1) Preferred: Install the DTC (libfdt) devel package" \
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002904 " (2) Fetch the DTC submodule, using:" \
2905 " git submodule update --init dtc"
2906 else
2907 # don't have and don't want
Michael Wallede3a3542011-04-26 00:24:07 +02002908 fdt_libs=
Juan Quintela2df87df2009-08-12 18:29:54 +02002909 fdt=no
aurel32f652e6a2008-12-16 10:43:48 +00002910 fi
2911fi
2912
Peter Crosthwaitea540f152013-04-18 14:47:31 +10002913libs_softmmu="$libs_softmmu $fdt_libs"
2914
Michael Walle20ff0752011-03-07 23:32:39 +01002915##########################################
Michael Walleb1e5fff2013-03-06 20:23:32 +01002916# GLX probe, used by milkymist-tmu2
2917if test "$glx" != "no" ; then
2918 glx_libs="-lGL -lX11"
Michael Walle20ff0752011-03-07 23:32:39 +01002919 cat > $TMPC << EOF
2920#include <X11/Xlib.h>
2921#include <GL/gl.h>
2922#include <GL/glx.h>
Michael Walled3fcbb12013-03-06 20:16:58 +01002923int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
Michael Walle20ff0752011-03-07 23:32:39 +01002924EOF
Michael Walled3fcbb12013-03-06 20:16:58 +01002925 if compile_prog "" "-lGL -lX11" ; then
Michael Walleb1e5fff2013-03-06 20:23:32 +01002926 glx=yes
Michael Walle20ff0752011-03-07 23:32:39 +01002927 else
Michael Walleb1e5fff2013-03-06 20:23:32 +01002928 if test "$glx" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002929 feature_not_found "glx" "Install GL devel (e.g. MESA)"
Michael Walle20ff0752011-03-07 23:32:39 +01002930 fi
Michael Walleb1e5fff2013-03-06 20:23:32 +01002931 glx_libs=
2932 glx=no
Michael Walle20ff0752011-03-07 23:32:39 +01002933 fi
2934fi
2935
Bharata B Raoeb100392012-09-24 14:42:45 +05302936##########################################
2937# glusterfs probe
2938if test "$glusterfs" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002939 if $pkg_config --atleast-version=3 glusterfs-api; then
Bharata B Raoe01bee02013-07-16 21:47:41 +05302940 glusterfs="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02002941 glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2942 glusterfs_libs=`$pkg_config --libs glusterfs-api`
Stefan Weil65d5d3f2013-08-27 21:09:13 +02002943 if $pkg_config --atleast-version=5 glusterfs-api; then
Bharata B Rao0c14fb42013-07-16 21:47:42 +05302944 glusterfs_discard="yes"
2945 fi
Bharata B Rao7c815372013-12-21 14:51:25 +05302946 if $pkg_config --atleast-version=6 glusterfs-api; then
2947 glusterfs_zerofill="yes"
2948 fi
Bharata B Raoeb100392012-09-24 14:42:45 +05302949 else
2950 if test "$glusterfs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11002951 feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
Bharata B Raoeb100392012-09-24 14:42:45 +05302952 fi
Bharata B Raoe01bee02013-07-16 21:47:41 +05302953 glusterfs="no"
Bharata B Raoeb100392012-09-24 14:42:45 +05302954 fi
2955fi
2956
aurel3239386ac2009-04-15 19:48:17 +00002957# Check for inotify functions when we are building linux-user
aurel323b3f24a2009-04-15 16:12:13 +00002958# emulator. This is done because older glibc versions don't
2959# have syscall stubs for these implemented. In that case we
2960# don't provide them even if kernel supports them.
2961#
2962inotify=no
Riku Voipio67ba57f2009-06-29 17:26:11 +03002963cat > $TMPC << EOF
aurel323b3f24a2009-04-15 16:12:13 +00002964#include <sys/inotify.h>
2965
2966int
2967main(void)
2968{
2969 /* try to start inotify */
aurel328690e422009-04-17 13:50:32 +00002970 return inotify_init();
aurel323b3f24a2009-04-15 16:12:13 +00002971}
2972EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02002973if compile_prog "" "" ; then
Riku Voipio67ba57f2009-06-29 17:26:11 +03002974 inotify=yes
aurel323b3f24a2009-04-15 16:12:13 +00002975fi
2976
Riku Voipioc05c7a72010-03-26 15:25:11 +00002977inotify1=no
2978cat > $TMPC << EOF
2979#include <sys/inotify.h>
2980
2981int
2982main(void)
2983{
2984 /* try to start inotify */
2985 return inotify_init1(0);
2986}
2987EOF
2988if compile_prog "" "" ; then
2989 inotify1=yes
2990fi
2991
Riku Voipioebc996f2009-04-21 15:01:51 +03002992# check if utimensat and futimens are supported
2993utimens=no
2994cat > $TMPC << EOF
2995#define _ATFILE_SOURCE
Riku Voipioebc996f2009-04-21 15:01:51 +03002996#include <stddef.h>
2997#include <fcntl.h>
Peter Maydell3014ee02012-07-18 15:10:26 +01002998#include <sys/stat.h>
Riku Voipioebc996f2009-04-21 15:01:51 +03002999
3000int main(void)
3001{
3002 utimensat(AT_FDCWD, "foo", NULL, 0);
3003 futimens(0, NULL);
3004 return 0;
3005}
3006EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003007if compile_prog "" "" ; then
Riku Voipioebc996f2009-04-21 15:01:51 +03003008 utimens=yes
3009fi
3010
Riku Voipio099d6b02009-05-05 12:10:04 +03003011# check if pipe2 is there
3012pipe2=no
3013cat > $TMPC << EOF
Riku Voipio099d6b02009-05-05 12:10:04 +03003014#include <unistd.h>
3015#include <fcntl.h>
3016
3017int main(void)
3018{
3019 int pipefd[2];
Bruce Rogers9bca8162012-08-20 12:45:08 -06003020 return pipe2(pipefd, O_CLOEXEC);
Riku Voipio099d6b02009-05-05 12:10:04 +03003021}
3022EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003023if compile_prog "" "" ; then
Riku Voipio099d6b02009-05-05 12:10:04 +03003024 pipe2=yes
3025fi
3026
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003027# check if accept4 is there
3028accept4=no
3029cat > $TMPC << EOF
Kevin Wolf40ff6d72009-12-02 12:24:42 +01003030#include <sys/socket.h>
3031#include <stddef.h>
3032
3033int main(void)
3034{
3035 accept4(0, NULL, NULL, SOCK_CLOEXEC);
3036 return 0;
3037}
3038EOF
3039if compile_prog "" "" ; then
3040 accept4=yes
3041fi
3042
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303043# check if tee/splice is there. vmsplice was added same time.
3044splice=no
3045cat > $TMPC << EOF
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303046#include <unistd.h>
3047#include <fcntl.h>
3048#include <limits.h>
3049
3050int main(void)
3051{
Stefan Weil66ea0f22011-12-17 09:27:35 +01003052 int len, fd = 0;
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303053 len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
3054 splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
3055 return 0;
3056}
3057EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003058if compile_prog "" "" ; then
vibisreenivasan3ce34df2009-05-16 18:32:41 +05303059 splice=yes
3060fi
3061
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003062##########################################
3063# signalfd probe
3064signalfd="no"
3065cat > $TMPC << EOF
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03003066#include <unistd.h>
3067#include <sys/syscall.h>
3068#include <signal.h>
3069int main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
3070EOF
3071
3072if compile_prog "" "" ; then
3073 signalfd=yes
3074fi
3075
Riku Voipioc2882b92009-08-12 15:08:24 +03003076# check if eventfd is supported
3077eventfd=no
3078cat > $TMPC << EOF
3079#include <sys/eventfd.h>
3080
3081int main(void)
3082{
Stefan Weil55cc7f32011-12-17 09:27:37 +01003083 return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
Riku Voipioc2882b92009-08-12 15:08:24 +03003084}
3085EOF
3086if compile_prog "" "" ; then
3087 eventfd=yes
3088fi
3089
Ulrich Hechtd0927932009-09-17 20:22:14 +03003090# check for fallocate
3091fallocate=no
3092cat > $TMPC << EOF
3093#include <fcntl.h>
3094
3095int main(void)
3096{
3097 fallocate(0, 0, 0, 0);
3098 return 0;
3099}
3100EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003101if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03003102 fallocate=yes
3103fi
3104
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01003105# check for fallocate hole punching
3106fallocate_punch_hole=no
3107cat > $TMPC << EOF
3108#include <fcntl.h>
3109#include <linux/falloc.h>
3110
3111int main(void)
3112{
3113 fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
3114 return 0;
3115}
3116EOF
3117if compile_prog "" "" ; then
3118 fallocate_punch_hole=yes
3119fi
3120
Peter Maydellc727f472011-01-06 11:05:10 +00003121# check for sync_file_range
3122sync_file_range=no
3123cat > $TMPC << EOF
3124#include <fcntl.h>
3125
3126int main(void)
3127{
3128 sync_file_range(0, 0, 0, 0);
3129 return 0;
3130}
3131EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003132if compile_prog "" "" ; then
Peter Maydellc727f472011-01-06 11:05:10 +00003133 sync_file_range=yes
3134fi
3135
Peter Maydelldace20d2011-01-10 13:11:24 +00003136# check for linux/fiemap.h and FS_IOC_FIEMAP
3137fiemap=no
3138cat > $TMPC << EOF
3139#include <sys/ioctl.h>
3140#include <linux/fs.h>
3141#include <linux/fiemap.h>
3142
3143int main(void)
3144{
3145 ioctl(0, FS_IOC_FIEMAP, 0);
3146 return 0;
3147}
3148EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003149if compile_prog "" "" ; then
Peter Maydelldace20d2011-01-10 13:11:24 +00003150 fiemap=yes
3151fi
3152
Ulrich Hechtd0927932009-09-17 20:22:14 +03003153# check for dup3
3154dup3=no
3155cat > $TMPC << EOF
3156#include <unistd.h>
3157
3158int main(void)
3159{
3160 dup3(0, 0, 0);
3161 return 0;
3162}
3163EOF
Jan Kiszka78f5d722009-11-03 10:54:44 +01003164if compile_prog "" "" ; then
Ulrich Hechtd0927932009-09-17 20:22:14 +03003165 dup3=yes
3166fi
3167
Alex Bligh4e0c6522013-08-21 16:02:43 +01003168# check for ppoll support
3169ppoll=no
3170cat > $TMPC << EOF
3171#include <poll.h>
3172
3173int main(void)
3174{
3175 struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
3176 ppoll(&pfd, 1, 0, 0);
3177 return 0;
3178}
3179EOF
3180if compile_prog "" "" ; then
3181 ppoll=yes
3182fi
3183
Alex Blighcd758dd2013-08-21 16:02:44 +01003184# check for prctl(PR_SET_TIMERSLACK , ... ) support
3185prctl_pr_set_timerslack=no
3186cat > $TMPC << EOF
3187#include <sys/prctl.h>
3188
3189int main(void)
3190{
3191 prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
3192 return 0;
3193}
3194EOF
3195if compile_prog "" "" ; then
3196 prctl_pr_set_timerslack=yes
3197fi
3198
Peter Maydell3b6edd12011-02-15 18:35:05 +00003199# check for epoll support
3200epoll=no
3201cat > $TMPC << EOF
3202#include <sys/epoll.h>
3203
3204int main(void)
3205{
3206 epoll_create(0);
3207 return 0;
3208}
3209EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003210if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003211 epoll=yes
3212fi
3213
3214# epoll_create1 and epoll_pwait are later additions
3215# so we must check separately for their presence
3216epoll_create1=no
3217cat > $TMPC << EOF
3218#include <sys/epoll.h>
3219
3220int main(void)
3221{
Peter Maydell19e83f62011-04-26 16:56:40 +01003222 /* Note that we use epoll_create1 as a value, not as
3223 * a function being called. This is necessary so that on
3224 * old SPARC glibc versions where the function was present in
3225 * the library but not declared in the header file we will
3226 * fail the configure check. (Otherwise we will get a compiler
3227 * warning but not an error, and will proceed to fail the
3228 * qemu compile where we compile with -Werror.)
3229 */
Blue Swirlc075a722012-08-09 20:21:25 +00003230 return (int)(uintptr_t)&epoll_create1;
Peter Maydell3b6edd12011-02-15 18:35:05 +00003231}
3232EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003233if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003234 epoll_create1=yes
3235fi
3236
3237epoll_pwait=no
3238cat > $TMPC << EOF
3239#include <sys/epoll.h>
3240
3241int main(void)
3242{
3243 epoll_pwait(0, 0, 0, 0, 0);
3244 return 0;
3245}
3246EOF
Peter Maydell8fb03152012-04-04 17:03:15 +01003247if compile_prog "" "" ; then
Peter Maydell3b6edd12011-02-15 18:35:05 +00003248 epoll_pwait=yes
3249fi
3250
Peter Maydella8fd1ab2013-02-08 07:31:55 +00003251# check for sendfile support
3252sendfile=no
3253cat > $TMPC << EOF
3254#include <sys/sendfile.h>
3255
3256int main(void)
3257{
3258 return sendfile(0, 0, 0, 0);
3259}
3260EOF
3261if compile_prog "" "" ; then
3262 sendfile=yes
3263fi
3264
pbrookcc8ae6d2006-04-23 17:57:59 +00003265# Check if tools are available to build documentation.
Juan Quintelaa25dba12009-08-12 18:29:52 +02003266if test "$docs" != "no" ; then
Stefan Weil01668d92010-03-04 22:21:02 +01003267 if has makeinfo && has pod2man; then
Juan Quintelaa25dba12009-08-12 18:29:52 +02003268 docs=yes
Juan Quintela83a3ab82009-08-12 18:29:51 +02003269 else
Juan Quintelaa25dba12009-08-12 18:29:52 +02003270 if test "$docs" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003271 feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
Juan Quintela83a3ab82009-08-12 18:29:51 +02003272 fi
Juan Quintelaa25dba12009-08-12 18:29:52 +02003273 docs=no
Juan Quintela83a3ab82009-08-12 18:29:51 +02003274 fi
pbrookcc8ae6d2006-04-23 17:57:59 +00003275fi
3276
Stefan Weilf514f412009-10-11 12:44:07 +02003277# Search for bswap_32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003278byteswap_h=no
3279cat > $TMPC << EOF
3280#include <byteswap.h>
3281int main(void) { return bswap_32(0); }
3282EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003283if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003284 byteswap_h=yes
3285fi
3286
Stefan Weil75f13592013-01-05 12:17:38 +01003287# Search for bswap32 function
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003288bswap_h=no
3289cat > $TMPC << EOF
3290#include <sys/endian.h>
3291#include <sys/types.h>
3292#include <machine/bswap.h>
3293int main(void) { return bswap32(0); }
3294EOF
Juan Quintela52166aa2009-08-03 14:46:03 +02003295if compile_prog "" "" ; then
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02003296 bswap_h=yes
3297fi
3298
aliguorida93a1f2008-12-12 20:02:52 +00003299##########################################
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003300# Do we have libiscsi
Peter Lieven063c3372013-12-05 16:47:17 +01003301# We check for iscsi_write16_sync() to make sure we have a
3302# at least version 1.4.0 of libiscsi.
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003303if test "$libiscsi" != "no" ; then
3304 cat > $TMPC << EOF
Ronnie Sahlbergfa6acb02012-04-24 16:29:04 +10003305#include <stdio.h>
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003306#include <iscsi/iscsi.h>
Peter Lieven063c3372013-12-05 16:47:17 +01003307int 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 +11003308EOF
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003309 if $pkg_config --atleast-version=1.7.0 libiscsi; then
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003310 libiscsi="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003311 libiscsi_cflags=$($pkg_config --cflags libiscsi)
3312 libiscsi_libs=$($pkg_config --libs libiscsi)
Paolo Bonzini3c33ea92013-02-22 18:14:28 +01003313 elif compile_prog "" "-liscsi" ; then
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003314 libiscsi="yes"
Fam Zheng6ebc91e2014-02-10 14:48:54 +08003315 libiscsi_libs="-liscsi"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003316 else
3317 if test "$libiscsi" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003318 feature_not_found "libiscsi" "Install libiscsi devel"
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003319 fi
3320 libiscsi="no"
3321 fi
3322fi
3323
Stefan Weil219c2522013-12-17 08:57:10 +01003324# We also need to know the API version because there was an
3325# API change from 1.4.0 to 1.5.0.
3326if test "$libiscsi" = "yes"; then
3327 cat >$TMPC <<EOF
3328#include <iscsi/iscsi.h>
3329int main(void)
3330{
3331 iscsi_read10_task(0, 0, 0, 0, 0, 0, 0);
3332 return 0;
3333}
3334EOF
3335 if compile_prog "" "-liscsi"; then
3336 libiscsi_version="1.4.0"
3337 fi
3338fi
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11003339
3340##########################################
Natanael Copa8bacde82012-09-12 09:06:51 +00003341# Do we need libm
3342cat > $TMPC << EOF
3343#include <math.h>
3344int main(void) { return isnan(sin(0.0)); }
3345EOF
3346if compile_prog "" "" ; then
3347 :
3348elif compile_prog "" "-lm" ; then
3349 LIBS="-lm $LIBS"
3350 libs_qga="-lm $libs_qga"
3351else
Peter Maydell76ad07a2013-04-08 12:11:26 +01003352 error_exit "libm check failed"
Natanael Copa8bacde82012-09-12 09:06:51 +00003353fi
3354
3355##########################################
aliguorida93a1f2008-12-12 20:02:52 +00003356# Do we need librt
Natanael Copa8bacde82012-09-12 09:06:51 +00003357# uClibc provides 2 versions of clock_gettime(), one with realtime
3358# support and one without. This means that the clock_gettime() don't
3359# need -lrt. We still need it for timer_create() so we check for this
3360# function in addition.
aliguorida93a1f2008-12-12 20:02:52 +00003361cat > $TMPC <<EOF
3362#include <signal.h>
3363#include <time.h>
Natanael Copa8bacde82012-09-12 09:06:51 +00003364int main(void) {
3365 timer_create(CLOCK_REALTIME, NULL, NULL);
3366 return clock_gettime(CLOCK_REALTIME, NULL);
3367}
aliguorida93a1f2008-12-12 20:02:52 +00003368EOF
3369
Juan Quintela52166aa2009-08-03 14:46:03 +02003370if compile_prog "" "" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003371 :
Natanael Copa8bacde82012-09-12 09:06:51 +00003372# we need pthread for static linking. use previous pthread test result
3373elif compile_prog "" "-lrt $pthread_lib" ; then
Juan Quintela07ffa4b2009-08-03 14:46:17 +02003374 LIBS="-lrt $LIBS"
Natanael Copa8bacde82012-09-12 09:06:51 +00003375 libs_qga="-lrt $libs_qga"
aliguorida93a1f2008-12-12 20:02:52 +00003376fi
3377
Blue Swirl31ff5042009-09-12 12:33:07 +00003378if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
Andreas Färber179cf402010-09-20 00:50:43 +02003379 "$aix" != "yes" -a "$haiku" != "yes" ; then
Juan Quintela6362a532009-08-03 14:46:32 +02003380 libs_softmmu="-lutil $libs_softmmu"
3381fi
3382
Blue Swirlde5071c2009-09-12 09:58:46 +00003383##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003384# spice probe
3385if test "$spice" != "no" ; then
3386 cat > $TMPC << EOF
3387#include <spice.h>
3388int main(void) { spice_server_new(); return 0; }
3389EOF
Jiri Denemark710fc4f2011-01-24 13:20:29 +01003390 spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3391 spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003392 if $pkg_config --atleast-version=0.12.0 spice-server && \
3393 $pkg_config --atleast-version=0.12.3 spice-protocol && \
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003394 compile_prog "$spice_cflags" "$spice_libs" ; then
3395 spice="yes"
3396 libs_softmmu="$libs_softmmu $spice_libs"
3397 QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
Alon Levy2e0e3c32012-08-22 11:16:26 +03003398 spice_protocol_version=$($pkg_config --modversion spice-protocol)
3399 spice_server_version=$($pkg_config --modversion spice-server)
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003400 else
3401 if test "$spice" = "yes" ; then
Stewart Smith21684af2014-01-24 12:39:10 +11003402 feature_not_found "spice" "Install spice-server and spice-protocol devel"
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003403 fi
3404 spice="no"
3405 fi
3406fi
3407
Robert Relyea111a38b2010-11-28 16:36:38 +02003408# check for libcacard for smartcard support
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003409smartcard_cflags=""
3410# TODO - what's the minimal nss version we support?
3411if test "$smartcard_nss" != "no"; then
3412 cat > $TMPC << EOF
Sergei Trofimovich5f01e062012-01-31 22:03:58 +03003413#include <pk11pub.h>
3414int main(void) { PK11_FreeSlot(0); return 0; }
3415EOF
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003416 smartcard_includes="-I\$(SRC_PATH)/libcacard"
3417 libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
3418 libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
3419 test_cflags="$libcacard_cflags"
3420 # The header files in nss < 3.13.3 have a bug which causes them to
3421 # emit a warning. If we're going to compile QEMU with -Werror, then
3422 # test that the headers don't have this bug. Otherwise we would pass
3423 # the configure test but fail to compile QEMU later.
3424 if test "$werror" = "yes"; then
3425 test_cflags="-Werror $test_cflags"
Robert Relyea111a38b2010-11-28 16:36:38 +02003426 fi
Paolo Bonzinib6fc6752012-12-20 20:40:35 +01003427 if test -n "$libtool" &&
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003428 $pkg_config --atleast-version=3.12.8 nss && \
Paolo Bonziniafd347a2012-12-20 20:39:36 +01003429 compile_prog "$test_cflags" "$libcacard_libs"; then
3430 smartcard_nss="yes"
3431 QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
3432 QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3433 libs_softmmu="$libcacard_libs $libs_softmmu"
3434 else
3435 if test "$smartcard_nss" = "yes"; then
3436 feature_not_found "nss"
3437 fi
3438 smartcard_nss="no"
3439 fi
Robert Relyea111a38b2010-11-28 16:36:38 +02003440fi
3441
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003442# check for libusb
3443if test "$libusb" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003444 if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003445 libusb="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003446 libusb_cflags=$($pkg_config --cflags libusb-1.0)
3447 libusb_libs=$($pkg_config --libs libusb-1.0)
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003448 QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
3449 libs_softmmu="$libs_softmmu $libusb_libs"
3450 else
3451 if test "$libusb" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003452 feature_not_found "libusb" "Install libusb devel"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01003453 fi
3454 libusb="no"
3455 fi
3456fi
3457
Hans de Goede69354a82011-07-19 11:04:10 +02003458# check for usbredirparser for usb network redirection support
3459if test "$usb_redir" != "no" ; then
Stefan Weil65d5d3f2013-08-27 21:09:13 +02003460 if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
Hans de Goede69354a82011-07-19 11:04:10 +02003461 usb_redir="yes"
Stefan Weilca871ec2013-08-27 21:09:12 +02003462 usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3463 usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
Hans de Goede69354a82011-07-19 11:04:10 +02003464 QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
Aurelien Jarno56ab2ad2012-09-11 20:57:58 +02003465 libs_softmmu="$libs_softmmu $usb_redir_libs"
Hans de Goede69354a82011-07-19 11:04:10 +02003466 else
3467 if test "$usb_redir" = "yes"; then
Stewart Smith21684af2014-01-24 12:39:10 +11003468 feature_not_found "usb-redir" "Install usbredir devel"
Hans de Goede69354a82011-07-19 11:04:10 +02003469 fi
3470 usb_redir="no"
3471 fi
3472fi
3473
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003474##########################################
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04003475# check if we have VSS SDK headers for win
3476
3477if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3478 case "$vss_win32_sdk" in
3479 "") vss_win32_include="-I$source_path" ;;
3480 *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3481 # handle path with spaces. So we symlink the headers into ".sdk/vss".
3482 vss_win32_include="-I$source_path/.sdk/vss"
3483 symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3484 ;;
3485 *) vss_win32_include="-I$vss_win32_sdk"
3486 esac
3487 cat > $TMPC << EOF
3488#define __MIDL_user_allocate_free_DEFINED__
3489#include <inc/win2003/vss.h>
3490int main(void) { return VSS_CTX_BACKUP; }
3491EOF
3492 if compile_prog "$vss_win32_include" "" ; then
3493 guest_agent_with_vss="yes"
3494 QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3495 libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3496 else
3497 if test "$vss_win32_sdk" != "" ; then
3498 echo "ERROR: Please download and install Microsoft VSS SDK:"
3499 echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3500 echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3501 echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
3502 echo "ERROR: The headers are extracted in the directory \`inc'."
3503 feature_not_found "VSS support"
3504 fi
3505 guest_agent_with_vss="no"
3506 fi
3507fi
3508
3509##########################################
3510# lookup Windows platform SDK (if not specified)
3511# The SDK is needed only to build .tlb (type library) file of guest agent
3512# VSS provider from the source. It is usually unnecessary because the
3513# pre-compiled .tlb file is included.
3514
3515if test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3516 if test -z "$win_sdk"; then
3517 programfiles="$PROGRAMFILES"
3518 test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3519 if test -n "$programfiles"; then
3520 win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3521 else
3522 feature_not_found "Windows SDK"
3523 fi
3524 elif test "$win_sdk" = "no"; then
3525 win_sdk=""
3526 fi
3527fi
3528
3529##########################################
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01003530
Blue Swirl747bbdf2009-10-18 16:26:06 +00003531##########################################
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003532# check if we have fdatasync
3533
3534fdatasync=no
3535cat > $TMPC << EOF
3536#include <unistd.h>
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003537int main(void) {
3538#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3539return fdatasync(0);
3540#else
Stefan Weile172fe12012-04-06 21:33:20 +02003541#error Not supported
Alexandre Raymondd1722a22011-05-29 18:22:48 -04003542#endif
3543}
Blue Swirl5f6b9e82009-09-20 06:56:26 +00003544EOF
3545if compile_prog "" "" ; then
3546 fdatasync=yes
3547fi
3548
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003549##########################################
Andreas Färbere78815a2010-09-25 11:26:05 +00003550# check if we have madvise
3551
3552madvise=no
3553cat > $TMPC << EOF
3554#include <sys/types.h>
3555#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003556#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003557int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3558EOF
3559if compile_prog "" "" ; then
3560 madvise=yes
3561fi
3562
3563##########################################
3564# check if we have posix_madvise
3565
3566posix_madvise=no
3567cat > $TMPC << EOF
3568#include <sys/mman.h>
Scott Wood832ce9c2010-10-05 14:28:17 -05003569#include <stddef.h>
Andreas Färbere78815a2010-09-25 11:26:05 +00003570int main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3571EOF
3572if compile_prog "" "" ; then
3573 posix_madvise=yes
3574fi
3575
3576##########################################
Richard Henderson1e9737d2012-10-23 07:33:00 +10003577# check if we have usable SIGEV_THREAD_ID
3578
3579sigev_thread_id=no
3580cat > $TMPC << EOF
3581#include <signal.h>
3582int main(void) {
3583 struct sigevent ev;
3584 ev.sigev_notify = SIGEV_THREAD_ID;
3585 ev._sigev_un._tid = 0;
3586 asm volatile("" : : "g"(&ev));
3587 return 0;
3588}
3589EOF
3590if compile_prog "" "" ; then
3591 sigev_thread_id=yes
3592fi
3593
3594##########################################
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003595# check if trace backend exists
3596
Lluís Vilanova650ab982012-04-03 20:47:39 +02003597$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend > /dev/null 2> /dev/null
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003598if test "$?" -ne 0 ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003599 error_exit "invalid trace backend" \
3600 "Please choose a supported trace backend."
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01003601fi
3602
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003603##########################################
3604# For 'ust' backend, test if ust headers are present
3605if test "$trace_backend" = "ust"; then
3606 cat > $TMPC << EOF
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003607#include <lttng/tracepoint.h>
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003608int main(void) { return 0; }
3609EOF
3610 if compile_prog "" "" ; then
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003611 if $pkg_config lttng-ust --exists; then
3612 lttng_ust_libs=`$pkg_config --libs lttng-ust`
3613 else
3614 lttng_ust_libs="-llttng-ust"
3615 fi
3616 if $pkg_config liburcu-bp --exists; then
3617 urcu_bp_libs=`$pkg_config --libs liburcu-bp`
3618 else
3619 urcu_bp_libs="-lurcu-bp"
3620 fi
3621
3622 LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
3623 libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003624 else
Mohamad Gebaibf15f632014-01-29 22:47:54 -05003625 error_exit "Trace backend 'ust' missing lttng-ust header files"
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003626 fi
3627fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003628
3629##########################################
3630# For 'dtrace' backend, test if 'dtrace' command is present
3631if test "$trace_backend" = "dtrace"; then
3632 if ! has 'dtrace' ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003633 error_exit "dtrace command is not found in PATH $PATH"
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003634 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00003635 trace_backend_stap="no"
3636 if has 'stap' ; then
3637 trace_backend_stap="yes"
3638 fi
Daniel P. Berrangeb3d08c02010-11-12 13:20:24 +00003639fi
3640
Stefan Hajnoczi7e24e922010-05-22 21:11:33 +01003641##########################################
Alex Barcelo519175a2012-02-28 12:25:50 +01003642# check and set a backend for coroutine
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303643
Peter Maydell7c2acc72013-04-08 12:11:27 +01003644# We prefer ucontext, but it's not always possible. The fallback
3645# is sigcontext. gthread is not selectable except explicitly, because
3646# it is not functional enough to run QEMU proper. (It is occasionally
3647# useful for debugging purposes.) On Windows the only valid backend
3648# is the Windows-specific one.
3649
3650ucontext_works=no
3651if test "$darwin" != "yes"; then
3652 cat > $TMPC << EOF
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303653#include <ucontext.h>
Peter Maydellcdf84802012-02-23 16:20:05 +00003654#ifdef __stub_makecontext
3655#error Ignoring glibc stub makecontext which will always fail
3656#endif
Stefan Weil75cafad2011-12-17 09:27:29 +01003657int main(void) { makecontext(0, 0, 0); return 0; }
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303658EOF
Peter Maydell7c2acc72013-04-08 12:11:27 +01003659 if compile_prog "" "" ; then
3660 ucontext_works=yes
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303661 fi
Peter Maydell7c2acc72013-04-08 12:11:27 +01003662fi
3663
3664if test "$coroutine" = ""; then
3665 if test "$mingw32" = "yes"; then
3666 coroutine=win32
3667 elif test "$ucontext_works" = "yes"; then
3668 coroutine=ucontext
3669 else
3670 coroutine=sigaltstack
3671 fi
Alex Barcelo519175a2012-02-28 12:25:50 +01003672else
Peter Maydell7c2acc72013-04-08 12:11:27 +01003673 case $coroutine in
3674 windows)
3675 if test "$mingw32" != "yes"; then
3676 error_exit "'windows' coroutine backend only valid for Windows"
3677 fi
3678 # Unfortunately the user visible backend name doesn't match the
3679 # coroutine-*.c filename for this case, so we have to adjust it here.
3680 coroutine=win32
3681 ;;
3682 ucontext)
3683 if test "$ucontext_works" != "yes"; then
3684 feature_not_found "ucontext"
3685 fi
3686 ;;
3687 gthread|sigaltstack)
3688 if test "$mingw32" = "yes"; then
3689 error_exit "only the 'windows' coroutine backend is valid for Windows"
3690 fi
3691 ;;
3692 *)
3693 error_exit "unknown coroutine backend $coroutine"
3694 ;;
3695 esac
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303696fi
3697
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02003698if test "$coroutine_pool" = ""; then
3699 if test "$coroutine" = "gthread"; then
3700 coroutine_pool=no
3701 else
3702 coroutine_pool=yes
3703 fi
3704fi
3705if test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
3706 error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
3707fi
3708
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05303709##########################################
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303710# check if we have open_by_handle_at
3711
Stefan Weil4e1797f2012-06-18 22:11:06 +02003712open_by_handle_at=no
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303713cat > $TMPC << EOF
3714#include <fcntl.h>
Stefan Weilacc55ba2012-06-06 19:35:57 +00003715#if !defined(AT_EMPTY_PATH)
3716# error missing definition
3717#else
Stefan Weil75cafad2011-12-17 09:27:29 +01003718int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
Stefan Weilacc55ba2012-06-06 19:35:57 +00003719#endif
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303720EOF
3721if compile_prog "" "" ; then
3722 open_by_handle_at=yes
3723fi
3724
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303725########################################
3726# check if we have linux/magic.h
3727
3728linux_magic_h=no
3729cat > $TMPC << EOF
3730#include <linux/magic.h>
3731int main(void) {
Stefan Weil75cafad2011-12-17 09:27:29 +01003732 return 0;
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05303733}
3734EOF
3735if compile_prog "" "" ; then
3736 linux_magic_h=yes
3737fi
3738
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003739########################################
Kevin Wolfc95e3082013-02-22 21:08:51 +01003740# check whether we can disable warning option with a pragma (this is needed
3741# to silence warnings in the headers of some versions of external libraries).
3742# This test has to be compiled with -Werror as otherwise an unknown pragma is
3743# only a warning.
3744#
3745# If we can't selectively disable warning in the code, disable -Werror so that
3746# the build doesn't fail anyway.
3747
Peter Maydell06d71fa2012-07-30 16:13:07 +01003748pragma_disable_unused_but_set=no
3749cat > $TMPC << EOF
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003750#pragma GCC diagnostic push
Peter Maydell06d71fa2012-07-30 16:13:07 +01003751#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
Kevin Wolfc95e3082013-02-22 21:08:51 +01003752#pragma GCC diagnostic ignored "-Wstrict-prototypes"
Markus Armbrustere6f53fd2013-04-16 13:51:06 +02003753#pragma GCC diagnostic pop
Kevin Wolfc95e3082013-02-22 21:08:51 +01003754
Peter Maydell06d71fa2012-07-30 16:13:07 +01003755int main(void) {
3756 return 0;
3757}
3758EOF
3759if compile_prog "-Werror" "" ; then
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01003760 pragma_diagnostic_available=yes
Kevin Wolfc95e3082013-02-22 21:08:51 +01003761else
3762 werror=no
Peter Maydell06d71fa2012-07-30 16:13:07 +01003763fi
3764
3765########################################
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003766# check if we have valgrind/valgrind.h and valgrind/memcheck.h
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003767
3768valgrind_h=no
3769cat > $TMPC << EOF
3770#include <valgrind/valgrind.h>
Christian Borntraeger62fe8332012-08-10 15:11:45 +02003771#include <valgrind/memcheck.h>
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003772int main(void) {
Kevin Wolf3f4349d2012-06-29 13:40:27 +02003773 return 0;
3774}
3775EOF
3776if compile_prog "" "" ; then
3777 valgrind_h=yes
3778fi
3779
3780########################################
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003781# check if environ is declared
3782
3783has_environ=no
3784cat > $TMPC << EOF
3785#include <unistd.h>
3786int main(void) {
Blue Swirlc075a722012-08-09 20:21:25 +00003787 environ = 0;
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03003788 return 0;
3789}
3790EOF
3791if compile_prog "" "" ; then
3792 has_environ=yes
3793fi
3794
Richard Henderson76a347e2012-12-28 14:17:02 -08003795########################################
3796# check if cpuid.h is usable.
3797
3798cpuid_h=no
3799cat > $TMPC << EOF
3800#include <cpuid.h>
3801int main(void) {
Peter Maydell774d5662014-02-20 19:42:53 +00003802 unsigned a, b, c, d;
3803 int max = __get_cpuid_max(0, 0);
3804
3805 if (max >= 1) {
3806 __cpuid(1, a, b, c, d);
3807 }
3808
3809 if (max >= 7) {
3810 __cpuid_count(7, 0, a, b, c, d);
3811 }
3812
3813 return 0;
Richard Henderson76a347e2012-12-28 14:17:02 -08003814}
3815EOF
3816if compile_prog "" "" ; then
3817 cpuid_h=yes
3818fi
3819
Richard Hendersonf5401662013-02-16 12:46:59 -08003820########################################
3821# check if __[u]int128_t is usable.
3822
3823int128=no
3824cat > $TMPC << EOF
3825__int128_t a;
3826__uint128_t b;
3827int main (void) {
3828 a = a + b;
3829 b = a * b;
Peter Maydell464e3672013-06-21 14:01:31 +01003830 a = a * a;
Richard Hendersonf5401662013-02-16 12:46:59 -08003831 return 0;
3832}
3833EOF
3834if compile_prog "" "" ; then
3835 int128=yes
3836fi
Richard Henderson76a347e2012-12-28 14:17:02 -08003837
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08003838########################################
3839# check if getauxval is available.
3840
3841getauxval=no
3842cat > $TMPC << EOF
3843#include <sys/auxv.h>
3844int main(void) {
3845 return getauxval(AT_HWCAP) == 0;
3846}
3847EOF
3848if compile_prog "" "" ; then
3849 getauxval=yes
3850fi
3851
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05303852##########################################
Juan Quintelae86ecd42009-08-03 14:45:59 +02003853# End of CC checks
3854# After here, no more $cc or $ld runs
3855
Blue Swirl1d728c32012-05-01 18:45:39 +00003856if test "$gcov" = "yes" ; then
3857 CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
3858 LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
3859elif test "$debug" = "no" ; then
Michal Privoznike600cdf2013-09-05 12:54:49 +02003860 CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003861fi
Juan Quintelaa316e372009-09-30 01:10:55 +02003862
Peter Lieven6542aa92014-02-03 10:26:13 +01003863##########################################
3864# Do we have libnfs
3865if test "$libnfs" != "no" ; then
3866 if $pkg_config --atleast-version=1.9.2 libnfs; then
3867 libnfs="yes"
3868 libnfs_libs=$($pkg_config --libs libnfs)
3869 LIBS="$LIBS $libnfs_libs"
3870 else
3871 if test "$libnfs" = "yes" ; then
3872 feature_not_found "libnfs"
3873 fi
3874 libnfs="no"
3875 fi
3876fi
Blue Swirl1d728c32012-05-01 18:45:39 +00003877
Anthony Liguori20ff6c82009-12-09 12:59:36 -06003878# Disable zero malloc errors for official releases unless explicitly told to
3879# enable/disable
3880if test -z "$zero_malloc" ; then
3881 if test "$z_version" = "50" ; then
3882 zero_malloc="no"
3883 else
3884 zero_malloc="yes"
3885 fi
3886fi
3887
Peter Maydell6ca026c2012-07-18 15:10:18 +01003888# Now we've finished running tests it's OK to add -Werror to the compiler flags
3889if test "$werror" = "yes"; then
3890 QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
3891fi
3892
Juan Quintelae86ecd42009-08-03 14:45:59 +02003893if test "$solaris" = "no" ; then
3894 if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
Juan Quintela1156c662009-08-03 14:46:00 +02003895 LDFLAGS="-Wl,--warn-common $LDFLAGS"
Juan Quintelae86ecd42009-08-03 14:45:59 +02003896 fi
3897fi
3898
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02003899# test if pod2man has --utf8 option
3900if pod2man --help | grep -q utf8; then
3901 POD2MAN="pod2man --utf8"
3902else
3903 POD2MAN="pod2man"
3904fi
3905
Blue Swirl952afb72010-09-19 08:36:34 +00003906# Use ASLR, no-SEH and DEP if available
3907if test "$mingw32" = "yes" ; then
3908 for flag in --dynamicbase --no-seh --nxcompat; do
3909 if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3910 LDFLAGS="-Wl,$flag $LDFLAGS"
3911 fi
3912 done
3913fi
3914
Eduardo Habkost10ea68b2012-04-18 16:55:39 -03003915qemu_confdir=$sysconfdir$confsuffix
Fam Zhenge26110c2014-02-10 14:48:57 +08003916qemu_moddir=$libdir$confsuffix
Eduardo Habkost528ae5b2012-04-18 16:55:49 -03003917qemu_datadir=$datadir$confsuffix
Anthony Liguori834574e2013-02-20 07:43:24 -06003918qemu_localedir="$datadir/locale"
Paolo Bonzinie7b45cc2010-05-26 16:08:20 +02003919
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003920tools=""
3921if test "$want_tools" = "yes" ; then
Paolo Bonzinica35f782010-05-26 16:08:29 +02003922 tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
Daniel P. Berrange4b1c11f2012-09-10 12:26:29 +01003923 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3924 tools="qemu-nbd\$(EXESUF) $tools"
3925 fi
3926fi
3927if test "$softmmu" = yes ; then
Meador Inge983eef52012-02-24 14:00:42 +05303928 if test "$virtfs" != no ; then
Andreas Färberaabfd882012-05-01 01:12:02 +02003929 if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3930 virtfs=yes
3931 tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3932 else
3933 if test "$virtfs" = yes; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01003934 error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
Meador Inge983eef52012-02-24 14:00:42 +05303935 fi
Andreas Färber17500372012-05-01 01:12:03 +02003936 virtfs=no
Andreas Färberaabfd882012-05-01 01:12:02 +02003937 fi
M. Mohan Kumar17bff522011-12-14 13:58:42 +05303938 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003939fi
3940if [ "$guest_agent" != "no" ]; then
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003941 if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
Michael Roth48ff7a62011-07-20 15:19:37 -05003942 tools="qemu-ga\$(EXESUF) $tools"
Tomoki Sekiyamab39297a2013-08-07 11:40:18 -04003943 if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3944 tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3945 fi
Michael Tokareve8ef31a2013-07-31 14:22:07 +04003946 guest_agent=yes
3947 elif [ "$guest_agent" != yes ]; then
3948 guest_agent=no
3949 else
3950 error_exit "Guest agent is not supported on this platform"
Paolo Bonzinica35f782010-05-26 16:08:29 +02003951 fi
Paolo Bonzini00c705f2012-05-29 11:40:24 +02003952fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003953
3954# Mac OS X ships with a broken assembler
3955roms=
3956if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3957 "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3958 "$softmmu" = yes ; then
3959 roms="optionrom"
3960fi
Andreas Färberd0384d12011-05-01 18:23:56 +02003961if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
David Gibson39ac8452011-04-01 15:15:23 +11003962 roms="$roms spapr-rtas"
3963fi
Paolo Bonzinica35f782010-05-26 16:08:29 +02003964
Christian Borntraeger9933c302013-04-23 01:23:03 +00003965if test "$cpu" = "s390x" ; then
3966 roms="$roms s390-ccw"
3967fi
3968
Richard Henderson964c6fa2013-06-21 19:10:16 -07003969# Probe for the need for relocating the user-only binary.
3970if test "$pie" = "no" ; then
3971 textseg_addr=
3972 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07003973 arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
Richard Henderson964c6fa2013-06-21 19:10:16 -07003974 textseg_addr=0x60000000
3975 ;;
3976 mips)
3977 textseg_addr=0x400000
3978 ;;
3979 esac
3980 if [ -n "$textseg_addr" ]; then
3981 cat > $TMPC <<EOF
3982 int main(void) { return 0; }
3983EOF
3984 textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3985 if ! compile_prog "" "$textseg_ldflags"; then
3986 # In case ld does not support -Ttext-segment, edit the default linker
3987 # script via sed to set the .text start addr. This is needed on FreeBSD
3988 # at least.
3989 $ld --verbose | sed \
3990 -e '1,/==================================================/d' \
3991 -e '/==================================================/,$d' \
3992 -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3993 -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3994 textseg_ldflags="-Wl,-T../config-host.ld"
3995 fi
3996 fi
3997fi
3998
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01003999# add pixman flags after all config tests are done
Peter Crosthwaitea540f152013-04-18 14:47:31 +10004000QEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
Gerd Hoffmann5ca93882012-11-07 11:06:23 +01004001libs_softmmu="$libs_softmmu $pixman_libs"
4002
bellard43ce4df2003-06-09 19:53:12 +00004003echo "Install prefix $prefix"
Eduardo Habkostc00b2802012-04-18 16:55:37 -03004004echo "BIOS directory `eval echo $qemu_datadir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02004005echo "binary directory `eval echo $bindir`"
Alon Levy3aa5d2b2011-05-15 12:08:59 +03004006echo "library directory `eval echo $libdir`"
Fam Zhenge26110c2014-02-10 14:48:57 +08004007echo "module directory `eval echo $qemu_moddir`"
Michael Tokarev8bf188a2012-06-07 01:11:00 +04004008echo "libexec directory `eval echo $libexecdir`"
Alon Levy0f94d6d2011-06-27 11:58:20 +02004009echo "include directory `eval echo $includedir`"
Aurelien Jarno1c0fd162010-06-10 00:14:02 +02004010echo "config directory `eval echo $sysconfdir`"
bellard11d9f692004-04-02 20:55:59 +00004011if test "$mingw32" = "no" ; then
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02004012echo "local state directory `eval echo $local_statedir`"
Paolo Bonzinif2b9e1e2010-05-26 16:08:23 +02004013echo "Manual directory `eval echo $mandir`"
bellard43ce4df2003-06-09 19:53:12 +00004014echo "ELF interp prefix $interp_prefix"
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02004015else
4016echo "local state directory queried at runtime"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004017echo "Windows SDK $win_sdk"
bellard11d9f692004-04-02 20:55:59 +00004018fi
bellard5a671352003-10-01 00:13:48 +00004019echo "Source path $source_path"
bellard43ce4df2003-06-09 19:53:12 +00004020echo "C compiler $cc"
bellard83469012005-07-23 14:27:54 +00004021echo "Host C compiler $host_cc"
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04004022echo "C++ compiler $cxx"
Peter Maydell3c4a4d02012-08-11 22:34:40 +01004023echo "Objective-C compiler $objcc"
Peter Maydell45d285a2013-10-21 21:03:06 +01004024echo "ARFLAGS $ARFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02004025echo "CFLAGS $CFLAGS"
Juan Quintelaa558ee12009-08-03 14:46:21 +02004026echo "QEMU_CFLAGS $QEMU_CFLAGS"
Juan Quintela0c439cb2009-08-03 14:46:01 +02004027echo "LDFLAGS $LDFLAGS"
bellard43ce4df2003-06-09 19:53:12 +00004028echo "make $make"
pbrook6a882642006-04-17 13:57:12 +00004029echo "install $install"
Blue Swirlc886edf2011-07-22 21:08:09 +00004030echo "python $python"
Brade2d88302011-09-02 16:53:28 -04004031if test "$slirp" = "yes" ; then
4032 echo "smbd $smbd"
4033fi
Fam Zheng17969262014-02-10 14:48:56 +08004034echo "module support $modules"
bellard43ce4df2003-06-09 19:53:12 +00004035echo "host CPU $cpu"
bellardde83cd02003-06-15 20:25:43 +00004036echo "host big endian $bigendian"
bellard97a847b2003-08-10 21:36:04 +00004037echo "target list $target_list"
aurel32ade25b02009-04-16 09:58:41 +00004038echo "tcg debug enabled $debug_tcg"
bellard43ce4df2003-06-09 19:53:12 +00004039echo "gprof enabled $gprof"
aliguori03b4fe72008-10-07 19:16:17 +00004040echo "sparse enabled $sparse"
aliguori1625af82009-04-05 17:41:02 +00004041echo "strip binaries $strip_opt"
bellard05c2a3e2006-02-08 22:39:17 +00004042echo "profiler $profiler"
bellard43ce4df2003-06-09 19:53:12 +00004043echo "static build $static"
bellard85aa5182007-11-11 20:17:03 +00004044echo "-Werror enabled $werror"
bellard5b0753e2005-03-01 21:37:28 +00004045if test "$darwin" = "yes" ; then
4046 echo "Cocoa support $cocoa"
4047fi
Gerd Hoffmanne2134eb2012-09-25 16:04:58 +02004048echo "pixman $pixman"
bellard97a847b2003-08-10 21:36:04 +00004049echo "SDL support $sdl"
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06004050echo "GTK support $gtk"
balrog4d3b6f62008-02-10 16:33:14 +00004051echo "curses support $curses"
Alexander Graf769ce762009-05-11 17:41:42 +02004052echo "curl support $curl"
bellard67b915a2004-03-31 23:37:16 +00004053echo "mingw32 support $mingw32"
malc0c58ac12008-06-25 21:04:05 +00004054echo "Audio drivers $audio_drv_list"
Fam Zhengb64ec4e2013-05-29 19:35:40 +08004055echo "Block whitelist (rw) $block_drv_rw_whitelist"
4056echo "Block whitelist (ro) $block_drv_ro_whitelist"
Meador Inge983eef52012-02-24 14:00:42 +05304057echo "VirtFS support $virtfs"
Jes Sorensen821601e2011-03-16 13:33:36 +01004058echo "VNC support $vnc"
4059if test "$vnc" = "yes" ; then
4060 echo "VNC TLS support $vnc_tls"
4061 echo "VNC SASL support $vnc_sasl"
4062 echo "VNC JPEG support $vnc_jpeg"
4063 echo "VNC PNG support $vnc_png"
Tim Hardeck7536ee42013-01-21 11:04:44 +01004064 echo "VNC WS support $vnc_ws"
Jes Sorensen821601e2011-03-16 13:33:36 +01004065fi
blueswir131422552007-04-16 18:27:06 +00004066if test -n "$sparc_cpu"; then
4067 echo "Target Sparc Arch $sparc_cpu"
4068fi
aliguorie37630c2009-04-22 15:19:10 +00004069echo "xen support $xen"
aurel322e4d9fb2008-04-08 06:01:02 +00004070echo "brlapi support $brlapi"
Juan Quintelaa20a6f42009-08-12 18:29:50 +02004071echo "bluez support $bluez"
Juan Quintelaa25dba12009-08-12 18:29:52 +02004072echo "Documentation $docs"
pbrookc5937222006-05-14 11:30:38 +00004073[ ! -z "$uname_release" ] && \
4074echo "uname -r $uname_release"
Paul Brook379f6692009-07-17 12:48:08 +01004075echo "GUEST_BASE $guest_base"
Avi Kivity40d64442011-11-15 20:12:17 +02004076echo "PIE $pie"
ths8a16d272008-07-19 09:56:24 +00004077echo "vde support $vde"
Vincenzo Maffione58952132013-11-06 11:44:06 +01004078echo "netmap support $netmap"
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004079echo "Linux AIO support $linux_aio"
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004080echo "ATTR/XATTR support $attr"
ths77755342008-11-27 15:45:16 +00004081echo "Install blobs $blobs"
Juan Quintelab31a0272009-08-12 18:29:56 +02004082echo "KVM support $kvm"
Michael R. Hines2da776d2013-07-22 10:01:54 -04004083echo "RDMA support $rdma"
Stefan Weil9195b2c2011-10-19 07:07:18 +02004084echo "TCG interpreter $tcg_interpreter"
aurel32f652e6a2008-12-16 10:43:48 +00004085echo "fdt support $fdt"
aliguoriceb42de2009-04-07 18:43:28 +00004086echo "preadv support $preadv"
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004087echo "fdatasync $fdatasync"
Andreas Färbere78815a2010-09-25 11:26:05 +00004088echo "madvise $madvise"
4089echo "posix_madvise $posix_madvise"
Richard Henderson1e9737d2012-10-23 07:33:00 +10004090echo "sigev_thread_id $sigev_thread_id"
Stefan Weilee682d22009-10-01 20:10:37 +02004091echo "uuid support $uuid"
Corey Bryant47e98652012-01-26 09:42:26 -05004092echo "libcap-ng support $cap_ng"
Michael S. Tsirkind5970052010-03-17 13:08:17 +02004093echo "vhost-net support $vhost_net"
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00004094echo "vhost-scsi support $vhost_scsi"
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004095echo "Trace backend $trace_backend"
Prerna Saxena9410b562010-07-13 09:26:32 +01004096echo "Trace output file $trace_file-<pid>"
Alon Levy2e0e3c32012-08-22 11:16:26 +03004097echo "spice support $spice ($spice_protocol_version/$spice_server_version)"
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004098echo "rbd support $rbd"
Christoph Hellwigdce512d2010-12-17 11:41:15 +01004099echo "xfsctl support $xfs"
Robert Relyea111a38b2010-11-28 16:36:38 +02004100echo "nss used $smartcard_nss"
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004101echo "libusb $libusb"
Hans de Goede69354a82011-07-19 11:04:10 +02004102echo "usb net redir $usb_redir"
Michael Walleb1e5fff2013-03-06 20:23:32 +01004103echo "GLX support $glx"
Stefan Weil219c2522013-12-17 08:57:10 +01004104if test "$libiscsi_version" = "1.4.0"; then
4105echo "libiscsi support $libiscsi (1.4.0)"
4106else
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004107echo "libiscsi support $libiscsi"
Stefan Weil219c2522013-12-17 08:57:10 +01004108fi
Peter Lieven6542aa92014-02-03 10:26:13 +01004109echo "libnfs support $libnfs"
Michael Rothd138cee2011-08-01 14:52:57 -05004110echo "build guest agent $guest_agent"
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004111echo "QGA VSS support $guest_agent_with_vss"
Eduardo Otubof7945732012-08-14 18:44:05 -03004112echo "seccomp support $seccomp"
Peter Maydell7c2acc72013-04-08 12:11:27 +01004113echo "coroutine backend $coroutine"
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004114echo "coroutine pool $coroutine_pool"
Bharata B Raoeb100392012-09-24 14:42:45 +05304115echo "GlusterFS support $glusterfs"
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004116echo "virtio-blk-data-plane $virtio_blk_data_plane"
Blue Swirl1d728c32012-05-01 18:45:39 +00004117echo "gcov $gcov_tool"
4118echo "gcov enabled $gcov"
Stefan Bergerab214c22013-02-27 12:47:52 -05004119echo "TPM support $tpm"
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004120echo "libssh2 support $libssh2"
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004121echo "TPM passthrough $tpm_passthrough"
Paolo Bonzini3556c232013-05-10 14:16:40 +02004122echo "QOM debugging $qom_cast_debug"
Jeff Cody4f18b782013-10-30 10:44:39 -04004123echo "vhdx $vhdx"
Benoît Canet95c6bff2014-02-21 22:21:15 +01004124echo "Quorum $quorum"
qiaonuohan607dacd2014-02-18 14:11:30 +08004125echo "lzo support $lzo"
4126echo "snappy support $snappy"
bellard67b915a2004-03-31 23:37:16 +00004127
Stefan Weil1ba16962011-07-29 22:40:45 +02004128if test "$sdl_too_old" = "yes"; then
bellard24b55b92005-03-01 22:30:41 +00004129echo "-> Your SDL version is too old - please upgrade to have SDL support"
bellarde8cd23d2003-06-25 16:08:13 +00004130fi
bellard97a847b2003-08-10 21:36:04 +00004131
Juan Quintela98ec69a2009-07-16 18:34:18 +02004132config_host_mak="config-host.mak"
bellard97a847b2003-08-10 21:36:04 +00004133
Stefan Weildbd99ae2013-01-01 18:33:44 +01004134echo "# Automatically generated by configure - do not modify" >config-all-disas.mak
4135
Juan Quintela98ec69a2009-07-16 18:34:18 +02004136echo "# Automatically generated by configure - do not modify" > $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004137echo >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004138
Paolo Bonzinie6c3b0f2010-10-21 10:18:35 +02004139echo all: >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004140echo "prefix=$prefix" >> $config_host_mak
4141echo "bindir=$bindir" >> $config_host_mak
Alon Levy3aa5d2b2011-05-15 12:08:59 +03004142echo "libdir=$libdir" >> $config_host_mak
Michael Tokarev8bf188a2012-06-07 01:11:00 +04004143echo "libexecdir=$libexecdir" >> $config_host_mak
Alon Levy0f94d6d2011-06-27 11:58:20 +02004144echo "includedir=$includedir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004145echo "mandir=$mandir" >> $config_host_mak
Paolo Bonzini99d7cc72010-05-26 16:08:24 +02004146echo "sysconfdir=$sysconfdir" >> $config_host_mak
Eduardo Habkost22d07032012-04-18 16:55:42 -03004147echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
Eduardo Habkost9afa52c2012-04-18 16:55:46 -03004148echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
4149echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
Fam Zhenge26110c2014-02-10 14:48:57 +08004150echo "qemu_moddir=$qemu_moddir" >> $config_host_mak
Laszlo Ersek5a699bb2013-05-18 06:31:50 +02004151if test "$mingw32" = "no" ; then
4152 echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
4153fi
Michael Tokarevf354b1a2012-10-21 22:52:54 +04004154echo "qemu_helperdir=$libexecdir" >> $config_host_mak
Gerd Hoffmannf9943cd2013-01-04 10:15:53 +01004155echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
4156echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
Anthony Liguori834574e2013-02-20 07:43:24 -06004157echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
Paolo Bonzinif544a482013-04-17 16:26:44 +02004158echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004159
Juan Quintela98ec69a2009-07-16 18:34:18 +02004160echo "ARCH=$ARCH" >> $config_host_mak
Paolo Bonzini727e5282013-04-17 16:26:43 +02004161
aurel32f8393942009-04-13 18:45:38 +00004162if test "$debug_tcg" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004163 echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
aurel32f8393942009-04-13 18:45:38 +00004164fi
aliguori1625af82009-04-05 17:41:02 +00004165if test "$strip_opt" = "yes" ; then
Hollis Blanchard52ba7842010-08-04 17:21:34 -07004166 echo "STRIP=${strip}" >> $config_host_mak
aliguori1625af82009-04-05 17:41:02 +00004167fi
bellard7d132992003-03-06 23:23:54 +00004168if test "$bigendian" = "yes" ; then
Juan Quintelae2542fe2009-07-27 16:13:06 +02004169 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00004170fi
bellard67b915a2004-03-31 23:37:16 +00004171if test "$mingw32" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004172 echo "CONFIG_WIN32=y" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00004173 rc_version=`cat $source_path/VERSION`
4174 version_major=${rc_version%%.*}
4175 rc_version=${rc_version#*.}
4176 version_minor=${rc_version%%.*}
4177 rc_version=${rc_version#*.}
4178 version_subminor=${rc_version%%.*}
4179 version_micro=0
4180 echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
4181 echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
Tomoki Sekiyamad9840e22013-08-07 11:40:03 -04004182 if test "$guest_agent_with_vss" = "yes" ; then
4183 echo "CONFIG_QGA_VSS=y" >> $config_host_mak
4184 echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
4185 fi
pbrook210fa552007-02-27 21:04:49 +00004186else
Juan Quintela35f4df22009-07-27 16:13:07 +02004187 echo "CONFIG_POSIX=y" >> $config_host_mak
bellard67b915a2004-03-31 23:37:16 +00004188fi
blueswir1128ab2f2008-08-15 18:33:42 +00004189
Mark McLoughlindffcb712009-10-22 17:49:11 +01004190if test "$linux" = "yes" ; then
4191 echo "CONFIG_LINUX=y" >> $config_host_mak
4192fi
4193
bellard83fb7ad2004-07-05 21:25:26 +00004194if test "$darwin" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004195 echo "CONFIG_DARWIN=y" >> $config_host_mak
bellard83fb7ad2004-07-05 21:25:26 +00004196fi
malcb29fe3e2008-11-18 01:42:22 +00004197
4198if test "$aix" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004199 echo "CONFIG_AIX=y" >> $config_host_mak
malcb29fe3e2008-11-18 01:42:22 +00004200fi
4201
bellardec530c82006-04-25 22:36:06 +00004202if test "$solaris" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004203 echo "CONFIG_SOLARIS=y" >> $config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004204 echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004205 if test "$needs_libsunmath" = "yes" ; then
Juan Quintela75b5a692009-07-27 16:13:23 +02004206 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
ths0475a5c2007-04-01 18:54:44 +00004207 fi
bellardec530c82006-04-25 22:36:06 +00004208fi
Andreas Färber179cf402010-09-20 00:50:43 +02004209if test "$haiku" = "yes" ; then
4210 echo "CONFIG_HAIKU=y" >> $config_host_mak
4211fi
bellard97a847b2003-08-10 21:36:04 +00004212if test "$static" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004213 echo "CONFIG_STATIC=y" >> $config_host_mak
bellard97a847b2003-08-10 21:36:04 +00004214fi
Stefan Weil1ba16962011-07-29 22:40:45 +02004215if test "$profiler" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004216 echo "CONFIG_PROFILER=y" >> $config_host_mak
bellard05c2a3e2006-02-08 22:39:17 +00004217fi
bellardc20709a2004-04-21 23:27:19 +00004218if test "$slirp" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004219 echo "CONFIG_SLIRP=y" >> $config_host_mak
Brade2d88302011-09-02 16:53:28 -04004220 echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
bellardc20709a2004-04-21 23:27:19 +00004221fi
ths8a16d272008-07-19 09:56:24 +00004222if test "$vde" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004223 echo "CONFIG_VDE=y" >> $config_host_mak
ths8a16d272008-07-19 09:56:24 +00004224fi
Vincenzo Maffione58952132013-11-06 11:44:06 +01004225if test "$netmap" = "yes" ; then
4226 echo "CONFIG_NETMAP=y" >> $config_host_mak
4227fi
Corey Bryant47e98652012-01-26 09:42:26 -05004228if test "$cap_ng" = "yes" ; then
4229 echo "CONFIG_LIBCAP=y" >> $config_host_mak
4230fi
Juan Quintela2358a492009-07-27 16:13:25 +02004231echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004232for drv in $audio_drv_list; do
Stefan Weilbb55b712012-03-27 19:23:53 +02004233 def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004234 echo "$def=y" >> $config_host_mak
malc923e4522008-07-02 18:13:46 +00004235 if test "$drv" = "fmod"; then
Juan Quintela7aac6cb2009-07-27 16:12:47 +02004236 echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
malc0c58ac12008-06-25 21:04:05 +00004237 fi
4238done
Juan Quintela67f86e82009-08-03 14:46:59 +02004239if test "$audio_pt_int" = "yes" ; then
4240 echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
4241fi
malcd5631632009-10-10 01:13:41 +04004242if test "$audio_win_int" = "yes" ; then
4243 echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
4244fi
Fam Zhengb64ec4e2013-05-29 19:35:40 +08004245echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
4246echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
Jes Sorensen821601e2011-03-16 13:33:36 +01004247if test "$vnc" = "yes" ; then
4248 echo "CONFIG_VNC=y" >> $config_host_mak
4249fi
ths8d5d2d42007-08-25 01:37:51 +00004250if test "$vnc_tls" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004251 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
ths8d5d2d42007-08-25 01:37:51 +00004252fi
aliguori2f9606b2009-03-06 20:27:28 +00004253if test "$vnc_sasl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004254 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
aliguori2f9606b2009-03-06 20:27:28 +00004255fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004256if test "$vnc_jpeg" = "yes" ; then
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004257 echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
Corentin Chary2f6f5c72010-07-07 20:57:49 +02004258fi
Jes Sorensen821601e2011-03-16 13:33:36 +01004259if test "$vnc_png" = "yes" ; then
Corentin Charyefe556a2010-07-07 20:57:56 +02004260 echo "CONFIG_VNC_PNG=y" >> $config_host_mak
Corentin Charyefe556a2010-07-07 20:57:56 +02004261fi
Tim Hardeck7536ee42013-01-21 11:04:44 +01004262if test "$vnc_ws" = "yes" ; then
4263 echo "CONFIG_VNC_WS=y" >> $config_host_mak
4264 echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
4265fi
aliguori76655d62009-03-06 20:27:37 +00004266if test "$fnmatch" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004267 echo "CONFIG_FNMATCH=y" >> $config_host_mak
aliguori76655d62009-03-06 20:27:37 +00004268fi
Stefan Weilee682d22009-10-01 20:10:37 +02004269if test "$uuid" = "yes" ; then
4270 echo "CONFIG_UUID=y" >> $config_host_mak
4271fi
Christoph Hellwigdce512d2010-12-17 11:41:15 +01004272if test "$xfs" = "yes" ; then
4273 echo "CONFIG_XFS=y" >> $config_host_mak
4274fi
pbrookb1a550a2006-04-16 13:28:56 +00004275qemu_version=`head $source_path/VERSION`
Juan Quintela98ec69a2009-07-16 18:34:18 +02004276echo "VERSION=$qemu_version" >>$config_host_mak
Juan Quintela2358a492009-07-27 16:13:25 +02004277echo "PKGVERSION=$pkgversion" >>$config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004278echo "SRC_PATH=$source_path" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004279echo "TARGET_DIRS=$target_list" >> $config_host_mak
Juan Quintelaa25dba12009-08-12 18:29:52 +02004280if [ "$docs" = "yes" ] ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004281 echo "BUILD_DOCS=yes" >> $config_host_mak
pbrookcc8ae6d2006-04-23 17:57:59 +00004282fi
Fam Zheng17969262014-02-10 14:48:56 +08004283if test "$modules" = "yes"; then
Fam Zhenge26110c2014-02-10 14:48:57 +08004284 # $shacmd can generate a hash started with digit, which the compiler doesn't
4285 # like as an symbol. So prefix it with an underscore
4286 echo "CONFIG_STAMP=_`(echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ `" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08004287 echo "CONFIG_MODULES=y" >> $config_host_mak
4288fi
Juan Quintela1ac88f22009-07-27 16:13:14 +02004289if test "$sdl" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004290 echo "CONFIG_SDL=y" >> $config_host_mak
Juan Quintela1ac88f22009-07-27 16:13:14 +02004291 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004292fi
4293if test "$cocoa" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004294 echo "CONFIG_COCOA=y" >> $config_host_mak
balrog4d3b6f62008-02-10 16:33:14 +00004295fi
4296if test "$curses" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004297 echo "CONFIG_CURSES=y" >> $config_host_mak
bellard49ecc3f2007-11-07 19:25:15 +00004298fi
Riku Voipioebc996f2009-04-21 15:01:51 +03004299if test "$utimens" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004300 echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
Riku Voipioebc996f2009-04-21 15:01:51 +03004301fi
Riku Voipio099d6b02009-05-05 12:10:04 +03004302if test "$pipe2" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004303 echo "CONFIG_PIPE2=y" >> $config_host_mak
Riku Voipio099d6b02009-05-05 12:10:04 +03004304fi
Kevin Wolf40ff6d72009-12-02 12:24:42 +01004305if test "$accept4" = "yes" ; then
4306 echo "CONFIG_ACCEPT4=y" >> $config_host_mak
4307fi
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304308if test "$splice" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004309 echo "CONFIG_SPLICE=y" >> $config_host_mak
vibisreenivasan3ce34df2009-05-16 18:32:41 +05304310fi
Riku Voipioc2882b92009-08-12 15:08:24 +03004311if test "$eventfd" = "yes" ; then
4312 echo "CONFIG_EVENTFD=y" >> $config_host_mak
4313fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004314if test "$fallocate" = "yes" ; then
4315 echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4316fi
Kusanagi Kouichi3d4fa432013-01-14 16:26:52 +01004317if test "$fallocate_punch_hole" = "yes" ; then
4318 echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
4319fi
Peter Maydellc727f472011-01-06 11:05:10 +00004320if test "$sync_file_range" = "yes" ; then
4321 echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4322fi
Peter Maydelldace20d2011-01-10 13:11:24 +00004323if test "$fiemap" = "yes" ; then
4324 echo "CONFIG_FIEMAP=y" >> $config_host_mak
4325fi
Ulrich Hechtd0927932009-09-17 20:22:14 +03004326if test "$dup3" = "yes" ; then
4327 echo "CONFIG_DUP3=y" >> $config_host_mak
4328fi
Alex Bligh4e0c6522013-08-21 16:02:43 +01004329if test "$ppoll" = "yes" ; then
4330 echo "CONFIG_PPOLL=y" >> $config_host_mak
4331fi
Alex Blighcd758dd2013-08-21 16:02:44 +01004332if test "$prctl_pr_set_timerslack" = "yes" ; then
4333 echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4334fi
Peter Maydell3b6edd12011-02-15 18:35:05 +00004335if test "$epoll" = "yes" ; then
4336 echo "CONFIG_EPOLL=y" >> $config_host_mak
4337fi
4338if test "$epoll_create1" = "yes" ; then
4339 echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
4340fi
4341if test "$epoll_pwait" = "yes" ; then
4342 echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
4343fi
Peter Maydella8fd1ab2013-02-08 07:31:55 +00004344if test "$sendfile" = "yes" ; then
4345 echo "CONFIG_SENDFILE=y" >> $config_host_mak
4346fi
aurel323b3f24a2009-04-15 16:12:13 +00004347if test "$inotify" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004348 echo "CONFIG_INOTIFY=y" >> $config_host_mak
aurel323b3f24a2009-04-15 16:12:13 +00004349fi
Riku Voipioc05c7a72010-03-26 15:25:11 +00004350if test "$inotify1" = "yes" ; then
4351 echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4352fi
Juan Quintela6ae9a1f2009-08-03 14:45:58 +02004353if test "$byteswap_h" = "yes" ; then
4354 echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
4355fi
4356if test "$bswap_h" = "yes" ; then
4357 echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
4358fi
Alexander Graf769ce762009-05-11 17:41:42 +02004359if test "$curl" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004360 echo "CONFIG_CURL=m" >> $config_host_mak
Juan Quintelab1d5a272009-08-03 14:46:05 +02004361 echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004362 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Alexander Graf769ce762009-05-11 17:41:42 +02004363fi
aurel322e4d9fb2008-04-08 06:01:02 +00004364if test "$brlapi" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004365 echo "CONFIG_BRLAPI=y" >> $config_host_mak
aurel322e4d9fb2008-04-08 06:01:02 +00004366fi
balrogfb599c92008-09-28 23:49:55 +00004367if test "$bluez" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004368 echo "CONFIG_BLUEZ=y" >> $config_host_mak
Juan Quintelaef7635e2009-07-27 16:12:46 +02004369 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
balrogfb599c92008-09-28 23:49:55 +00004370fi
Anthony Liguorie18df142011-07-19 14:50:29 -05004371echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
Anthony Liguoria4ccabc2013-02-20 07:43:20 -06004372if test "$gtk" = "yes" ; then
4373 echo "CONFIG_GTK=y" >> $config_host_mak
4374 echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4375 echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4376fi
aliguorie37630c2009-04-22 15:19:10 +00004377if test "$xen" = "yes" ; then
Jan Kiszka6dbd5882011-06-21 22:59:07 +02004378 echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
Anthony PERARDd5b93dd2011-02-25 16:20:34 +00004379 echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
aliguorie37630c2009-04-22 15:19:10 +00004380fi
Christoph Hellwig5c6c3a62009-08-20 16:58:35 +02004381if test "$linux_aio" = "yes" ; then
4382 echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
4383fi
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004384if test "$attr" = "yes" ; then
4385 echo "CONFIG_ATTR=y" >> $config_host_mak
4386fi
Avi Kivity4f26f2b2011-11-09 14:44:52 +02004387if test "$libattr" = "yes" ; then
4388 echo "CONFIG_LIBATTR=y" >> $config_host_mak
4389fi
Meador Inge983eef52012-02-24 14:00:42 +05304390if test "$virtfs" = "yes" ; then
4391 echo "CONFIG_VIRTFS=y" >> $config_host_mak
Venkateswararao Jujjuri (JV)758e8e32010-06-14 13:34:41 -07004392fi
Nicholas Bellinger5e9be922013-03-29 01:08:16 +00004393if test "$vhost_scsi" = "yes" ; then
4394 echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
4395fi
ths77755342008-11-27 15:45:16 +00004396if test "$blobs" = "yes" ; then
Juan Quintela98ec69a2009-07-16 18:34:18 +02004397 echo "INSTALL_BLOBS=yes" >> $config_host_mak
ths77755342008-11-27 15:45:16 +00004398fi
aliguoribf9298b2008-12-05 20:05:26 +00004399if test "$iovec" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004400 echo "CONFIG_IOVEC=y" >> $config_host_mak
aliguoribf9298b2008-12-05 20:05:26 +00004401fi
aliguoriceb42de2009-04-07 18:43:28 +00004402if test "$preadv" = "yes" ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004403 echo "CONFIG_PREADV=y" >> $config_host_mak
aliguoriceb42de2009-04-07 18:43:28 +00004404fi
aurel32f652e6a2008-12-16 10:43:48 +00004405if test "$fdt" = "yes" ; then
Juan Quintela3f0855b2009-07-27 16:12:52 +02004406 echo "CONFIG_FDT=y" >> $config_host_mak
aurel32f652e6a2008-12-16 10:43:48 +00004407fi
Marcelo Tosattidcc38d12010-10-11 15:31:15 -03004408if test "$signalfd" = "yes" ; then
4409 echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4410fi
Stefan Weil9195b2c2011-10-19 07:07:18 +02004411if test "$tcg_interpreter" = "yes" ; then
4412 echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
4413fi
Blue Swirl5f6b9e82009-09-20 06:56:26 +00004414if test "$fdatasync" = "yes" ; then
4415 echo "CONFIG_FDATASYNC=y" >> $config_host_mak
4416fi
Andreas Färbere78815a2010-09-25 11:26:05 +00004417if test "$madvise" = "yes" ; then
4418 echo "CONFIG_MADVISE=y" >> $config_host_mak
4419fi
4420if test "$posix_madvise" = "yes" ; then
4421 echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4422fi
Richard Henderson1e9737d2012-10-23 07:33:00 +10004423if test "$sigev_thread_id" = "yes" ; then
4424 echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
4425fi
bellard97a847b2003-08-10 21:36:04 +00004426
Gerd Hoffmanncd4ec0b2010-03-24 10:26:51 +01004427if test "$spice" = "yes" ; then
4428 echo "CONFIG_SPICE=y" >> $config_host_mak
4429fi
4430
Robert Relyea111a38b2010-11-28 16:36:38 +02004431if test "$smartcard_nss" = "yes" ; then
4432 echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
Paul Brookad4cf3f2012-02-09 19:05:29 +00004433 echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4434 echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
Robert Relyea111a38b2010-11-28 16:36:38 +02004435fi
4436
Gerd Hoffmann2b2325f2012-11-30 16:02:11 +01004437if test "$libusb" = "yes" ; then
4438 echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
4439fi
4440
Hans de Goede69354a82011-07-19 11:04:10 +02004441if test "$usb_redir" = "yes" ; then
4442 echo "CONFIG_USB_REDIR=y" >> $config_host_mak
4443fi
4444
Michael Walleb1e5fff2013-03-06 20:23:32 +01004445if test "$glx" = "yes" ; then
4446 echo "CONFIG_GLX=y" >> $config_host_mak
Paolo Bonzini2b6b7092013-04-17 16:26:45 +02004447 echo "GLX_LIBS=$glx_libs" >> $config_host_mak
Michael Walle20ff0752011-03-07 23:32:39 +01004448fi
4449
qiaonuohan607dacd2014-02-18 14:11:30 +08004450if test "$lzo" = "yes" ; then
4451 echo "CONFIG_LZO=y" >> $config_host_mak
4452fi
4453
4454if test "$snappy" = "yes" ; then
4455 echo "CONFIG_SNAPPY=y" >> $config_host_mak
4456fi
4457
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004458if test "$libiscsi" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004459 echo "CONFIG_LIBISCSI=m" >> $config_host_mak
Stefan Weil219c2522013-12-17 08:57:10 +01004460 if test "$libiscsi_version" = "1.4.0"; then
4461 echo "CONFIG_LIBISCSI_1_4=y" >> $config_host_mak
4462 fi
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004463 echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
4464 echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
Ronnie Sahlbergc589b242011-10-25 19:24:24 +11004465fi
4466
Peter Lieven6542aa92014-02-03 10:26:13 +01004467if test "$libnfs" = "yes" ; then
4468 echo "CONFIG_LIBNFS=y" >> $config_host_mak
4469fi
4470
Eduardo Otubof7945732012-08-14 18:44:05 -03004471if test "$seccomp" = "yes"; then
4472 echo "CONFIG_SECCOMP=y" >> $config_host_mak
4473fi
4474
bellard83fb7ad2004-07-05 21:25:26 +00004475# XXX: suppress that
bellard7d3505c2004-05-12 19:32:15 +00004476if [ "$bsd" = "yes" ] ; then
Juan Quintela2358a492009-07-27 16:13:25 +02004477 echo "CONFIG_BSD=y" >> $config_host_mak
bellard7d3505c2004-05-12 19:32:15 +00004478fi
4479
Juan Quintela2358a492009-07-27 16:13:25 +02004480echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
pbrookc5937222006-05-14 11:30:38 +00004481
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004482if test "$zero_malloc" = "yes" ; then
4483 echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
4484fi
Paolo Bonzini3556c232013-05-10 14:16:40 +02004485if test "$qom_cast_debug" = "yes" ; then
4486 echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
4487fi
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004488if test "$rbd" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004489 echo "CONFIG_RBD=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004490 echo "RBD_CFLAGS=$rbd_cflags" >> $config_host_mak
4491 echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
Christian Brunnerf27aaf42010-12-06 20:53:01 +01004492fi
Anthony Liguori20ff6c82009-12-09 12:59:36 -06004493
Peter Maydell7c2acc72013-04-08 12:11:27 +01004494echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
Stefan Hajnoczi70c60c02013-09-11 16:42:35 +02004495if test "$coroutine_pool" = "yes" ; then
4496 echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
4497else
4498 echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
4499fi
Aneesh Kumar K.Vd0e2fce2011-06-09 23:11:06 +05304500
Aneesh Kumar K.Vd2042372011-10-12 19:11:24 +05304501if test "$open_by_handle_at" = "yes" ; then
4502 echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4503fi
4504
Harsh Prateek Borae06a7652011-10-12 19:11:25 +05304505if test "$linux_magic_h" = "yes" ; then
4506 echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4507fi
4508
Gerd Hoffmanncc6e3ca2013-01-09 10:17:07 +01004509if test "$pragma_diagnostic_available" = "yes" ; then
4510 echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
Peter Maydell06d71fa2012-07-30 16:13:07 +01004511fi
4512
Kevin Wolf3f4349d2012-06-29 13:40:27 +02004513if test "$valgrind_h" = "yes" ; then
4514 echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
4515fi
4516
Luiz Capitulino8ab1bf12012-05-23 15:48:04 -03004517if test "$has_environ" = "yes" ; then
4518 echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
4519fi
4520
Richard Henderson76a347e2012-12-28 14:17:02 -08004521if test "$cpuid_h" = "yes" ; then
4522 echo "CONFIG_CPUID_H=y" >> $config_host_mak
4523fi
4524
Richard Hendersonf5401662013-02-16 12:46:59 -08004525if test "$int128" = "yes" ; then
4526 echo "CONFIG_INT128=y" >> $config_host_mak
4527fi
4528
Richard Henderson1e6e9ac2013-02-18 09:11:15 -08004529if test "$getauxval" = "yes" ; then
4530 echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
4531fi
4532
Bharata B Raoeb100392012-09-24 14:42:45 +05304533if test "$glusterfs" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004534 echo "CONFIG_GLUSTERFS=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004535 echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
4536 echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
Bharata B Raoeb100392012-09-24 14:42:45 +05304537fi
4538
Bharata B Rao0c14fb42013-07-16 21:47:42 +05304539if test "$glusterfs_discard" = "yes" ; then
4540 echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
4541fi
4542
Bharata B Rao7c815372013-12-21 14:51:25 +05304543if test "$glusterfs_zerofill" = "yes" ; then
4544 echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
4545fi
4546
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004547if test "$libssh2" = "yes" ; then
Fam Zhengd3399d72014-02-10 14:49:00 +08004548 echo "CONFIG_LIBSSH2=m" >> $config_host_mak
Fam Zheng6ebc91e2014-02-10 14:48:54 +08004549 echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
4550 echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
Richard W.M. Jones0a12ec82013-04-09 15:30:53 +01004551fi
4552
Benoît Canet95c6bff2014-02-21 22:21:15 +01004553if test "$quorum" = "yes" ; then
4554 echo "CONFIG_QUORUM=y" >> $config_host_mak
4555fi
4556
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004557if test "$virtio_blk_data_plane" = "yes" ; then
Paolo Bonzini6e790742013-02-05 12:42:31 +01004558 echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
Stefan Hajnoczi583f6e72012-11-14 15:04:15 +01004559fi
4560
Jeff Cody4f18b782013-10-30 10:44:39 -04004561if test "$vhdx" = "yes" ; then
4562 echo "CONFIG_VHDX=y" >> $config_host_mak
4563fi
4564
blueswir168063642008-11-22 21:03:55 +00004565# USB host support
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004566if test "$libusb" = "yes"; then
4567 echo "HOST_USB=libusb legacy" >> $config_host_mak
4568else
Juan Quintela98ec69a2009-07-16 18:34:18 +02004569 echo "HOST_USB=stub" >> $config_host_mak
Gerd Hoffmannb5613fd2013-09-10 11:02:59 +02004570fi
blueswir168063642008-11-22 21:03:55 +00004571
Paolo Bonzini3b8acc12013-03-18 16:37:50 +01004572# TPM passthrough support?
4573if test "$tpm" = "yes"; then
4574 echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
4575 if test "$tpm_passthrough" = "yes"; then
4576 echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
4577 fi
4578fi
4579
Lluíse4858972011-08-31 20:31:03 +02004580# use default implementation for tracing backend-specific routines
4581trace_default=yes
Stefan Hajnoczi94a420b2010-05-22 17:52:39 +01004582echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
Lluís6d8a7642011-08-31 20:30:43 +02004583if test "$trace_backend" = "nop"; then
4584 echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
Prerna Saxena22890ab2010-06-24 17:04:53 +05304585fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004586if test "$trace_backend" = "simple"; then
Lluís6d8a7642011-08-31 20:30:43 +02004587 echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004588 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004589 # Set the appropriate trace file.
Andreas Färber953ffe02011-06-02 19:58:06 +02004590 trace_file="\"$trace_file-\" FMT_pid"
Prerna Saxena9410b562010-07-13 09:26:32 +01004591fi
Lluís6d8a7642011-08-31 20:30:43 +02004592if test "$trace_backend" = "stderr"; then
4593 echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
Lluís9a82b6a2011-08-31 20:31:51 +02004594 trace_default=no
Lluís6d8a7642011-08-31 20:30:43 +02004595fi
4596if test "$trace_backend" = "ust"; then
4597 echo "CONFIG_TRACE_UST=y" >> $config_host_mak
4598fi
4599if test "$trace_backend" = "dtrace"; then
4600 echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
4601 if test "$trace_backend_stap" = "yes" ; then
4602 echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
4603 fi
Daniel P. Berrangec276b172010-11-12 13:20:25 +00004604fi
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004605if test "$trace_backend" = "ftrace"; then
4606 if test "$linux" = "yes" ; then
4607 echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4608 trace_default=no
4609 else
Stewart Smith21684af2014-01-24 12:39:10 +11004610 feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
Eiichi Tsukata781e9542013-04-11 20:25:15 +09004611 fi
4612fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004613echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
Lluíse4858972011-08-31 20:31:03 +02004614if test "$trace_default" = "yes"; then
4615 echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4616fi
Prerna Saxena9410b562010-07-13 09:26:32 +01004617
Michael R. Hines2da776d2013-07-22 10:01:54 -04004618if test "$rdma" = "yes" ; then
4619 echo "CONFIG_RDMA=y" >> $config_host_mak
4620fi
4621
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004622if test "$tcg_interpreter" = "yes"; then
4623 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
4624elif test "$ARCH" = "sparc64" ; then
4625 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
4626elif test "$ARCH" = "s390x" ; then
4627 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004628elif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
Paolo Bonzini5b5e3032013-04-17 16:26:35 +02004629 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
4630else
4631 QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
4632fi
4633QEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
4634
Juan Quintela98ec69a2009-07-16 18:34:18 +02004635echo "TOOLS=$tools" >> $config_host_mak
Juan Quintela98ec69a2009-07-16 18:34:18 +02004636echo "ROMS=$roms" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004637echo "MAKE=$make" >> $config_host_mak
4638echo "INSTALL=$install" >> $config_host_mak
Brad1901cb12011-08-28 04:01:33 -04004639echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
4640echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
Paolo Bonzini21655882012-12-20 18:57:45 +01004641if test -n "$libtool"; then
4642 echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
4643 echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
4644else
4645 echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
4646 echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
4647fi
Blue Swirlc886edf2011-07-22 21:08:09 +00004648echo "PYTHON=$python" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004649echo "CC=$cc" >> $config_host_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03004650if $iasl -h > /dev/null 2>&1; then
4651 echo "IASL=$iasl" >> $config_host_mak
4652fi
Paolo Bonzini2b2e59e2010-10-21 10:18:40 +02004653echo "CC_I386=$cc_i386" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004654echo "HOST_CC=$host_cc" >> $config_host_mak
Tomoki Sekiyama83f73fc2013-08-07 11:39:36 -04004655echo "CXX=$cxx" >> $config_host_mak
Peter Maydell3c4a4d02012-08-11 22:34:40 +01004656echo "OBJCC=$objcc" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004657echo "AR=$ar" >> $config_host_mak
Peter Maydell45d285a2013-10-21 21:03:06 +01004658echo "ARFLAGS=$ARFLAGS" >> $config_host_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00004659echo "AS=$as" >> $config_host_mak
4660echo "CPP=$cpp" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004661echo "OBJCOPY=$objcopy" >> $config_host_mak
4662echo "LD=$ld" >> $config_host_mak
Blue Swirl9fe6de92010-09-26 16:07:57 +00004663echo "WINDRES=$windres" >> $config_host_mak
Alon Levy44dc0ca2011-05-15 11:51:28 +03004664echo "LIBTOOL=$libtool" >> $config_host_mak
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004665echo "CFLAGS=$CFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004666echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
Juan Quintelaa558ee12009-08-03 14:46:21 +02004667echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
Paolo Bonzinif9728942010-12-23 11:43:53 +01004668echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
Paolo Bonzinie39f0062010-12-23 11:43:51 +01004669if test "$sparse" = "yes" ; then
4670 echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak
4671 echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
4672 echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4673fi
Gerd Hoffmann42da6042012-11-07 11:09:52 +01004674if test "$cross_prefix" != ""; then
4675 echo "AUTOCONF_HOST := --host=${cross_prefix%-}" >> $config_host_mak
4676else
4677 echo "AUTOCONF_HOST := " >> $config_host_mak
4678fi
Juan Quintelae2a2ed02009-08-03 14:46:02 +02004679echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
Brad46eef332013-12-10 19:49:08 -05004680echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
Marc-André Lureau37746c52013-02-25 23:31:12 +01004681echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
Juan Quintela73da3752009-08-03 14:46:26 +02004682echo "LIBS+=$LIBS" >> $config_host_mak
Juan Quintela3e2e0e62009-08-03 14:47:06 +02004683echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
Juan Quintela804edf22009-07-27 16:12:49 +02004684echo "EXESUF=$EXESUF" >> $config_host_mak
Fam Zheng17969262014-02-10 14:48:56 +08004685echo "DSOSUF=$DSOSUF" >> $config_host_mak
4686echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
Michael Roth957f1f92011-08-11 15:38:12 -05004687echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
Gerd Hoffmann94dd53c2012-03-29 10:55:18 +02004688echo "POD2MAN=$POD2MAN" >> $config_host_mak
Paolo Bonzinicbdd1992012-11-28 09:40:23 +01004689echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
Blue Swirl1d728c32012-05-01 18:45:39 +00004690if test "$gcov" = "yes" ; then
4691 echo "CONFIG_GCOV=y" >> $config_host_mak
4692 echo "GCOV=$gcov_tool" >> $config_host_mak
4693fi
Juan Quintela804edf22009-07-27 16:12:49 +02004694
Peter Maydell6efd7512011-11-30 11:59:04 +00004695# use included Linux headers
4696if test "$linux" = "yes" ; then
Andreas Färbera307beb2012-06-14 15:14:33 +00004697 mkdir -p linux-headers
Peter Maydell6efd7512011-11-30 11:59:04 +00004698 case "$cpu" in
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004699 i386|x86_64|x32)
Peter Maydell08312a62012-08-03 13:51:25 +01004700 linux_arch=x86
Peter Maydell6efd7512011-11-30 11:59:04 +00004701 ;;
4702 ppcemb|ppc|ppc64)
Peter Maydell08312a62012-08-03 13:51:25 +01004703 linux_arch=powerpc
Peter Maydell6efd7512011-11-30 11:59:04 +00004704 ;;
4705 s390x)
Peter Maydell08312a62012-08-03 13:51:25 +01004706 linux_arch=s390
4707 ;;
Claudio Fontana1f080312013-06-12 16:20:23 +01004708 aarch64)
4709 linux_arch=arm64
4710 ;;
Peter Maydell08312a62012-08-03 13:51:25 +01004711 *)
4712 # For most CPUs the kernel architecture name and QEMU CPU name match.
4713 linux_arch="$cpu"
Peter Maydell6efd7512011-11-30 11:59:04 +00004714 ;;
4715 esac
Peter Maydell08312a62012-08-03 13:51:25 +01004716 # For non-KVM architectures we will not have asm headers
4717 if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
4718 symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
4719 fi
Peter Maydell6efd7512011-11-30 11:59:04 +00004720fi
4721
bellard1d14ffa2005-10-30 18:58:22 +00004722for target in $target_list; do
bellard97a847b2003-08-10 21:36:04 +00004723target_dir="$target"
Juan Quintela25be2102009-10-07 02:41:00 +02004724config_target_mak=$target_dir/config-target.mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004725target_name=`echo $target | cut -d '-' -f 1`
bellard97a847b2003-08-10 21:36:04 +00004726target_bigendian="no"
Juan Quintela1f3d3c82009-10-07 02:41:02 +02004727
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004728case "$target_name" in
Anthony Greend15a9c22013-03-18 15:49:25 -04004729 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 +02004730 target_bigendian=yes
4731 ;;
4732esac
bellard97a847b2003-08-10 21:36:04 +00004733target_softmmu="no"
bellard997344f2003-10-27 21:10:39 +00004734target_user_only="no"
ths831b7822007-01-18 20:06:33 +00004735target_linux_user="no"
blueswir184778502008-10-26 20:33:16 +00004736target_bsd_user="no"
pbrook9e407a82007-05-26 16:38:53 +00004737case "$target" in
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004738 ${target_name}-softmmu)
pbrook9e407a82007-05-26 16:38:53 +00004739 target_softmmu="yes"
4740 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004741 ${target_name}-linux-user)
Blue Swirl9c7a4202009-11-17 20:52:56 +00004742 if test "$linux" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004743 error_exit "Target '$target' is only available on a Linux host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004744 fi
pbrook9e407a82007-05-26 16:38:53 +00004745 target_user_only="yes"
4746 target_linux_user="yes"
4747 ;;
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004748 ${target_name}-bsd-user)
Blue Swirl9cf55762009-11-17 21:27:18 +00004749 if test "$bsd" != "yes" ; then
Peter Maydell76ad07a2013-04-08 12:11:26 +01004750 error_exit "Target '$target' is only available on a BSD host"
Blue Swirl9c7a4202009-11-17 20:52:56 +00004751 fi
blueswir184778502008-10-26 20:33:16 +00004752 target_user_only="yes"
4753 target_bsd_user="yes"
4754 ;;
pbrook9e407a82007-05-26 16:38:53 +00004755 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004756 error_exit "Target '$target' not recognised"
pbrook9e407a82007-05-26 16:38:53 +00004757 exit 1
4758 ;;
4759esac
ths831b7822007-01-18 20:06:33 +00004760
bellard97a847b2003-08-10 21:36:04 +00004761mkdir -p $target_dir
Juan Quintela25be2102009-10-07 02:41:00 +02004762echo "# Automatically generated by configure - do not modify" > $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004763
pbrooke5fe0c52006-06-11 13:32:59 +00004764bflt="no"
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004765interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
pbrook56aebc82008-10-11 17:55:29 +00004766gdb_xml_files=""
aliguori7ba1e612008-11-05 16:04:33 +00004767
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004768TARGET_ARCH="$target_name"
Juan Quintela6acff7d2009-07-16 18:34:15 +02004769TARGET_BASE_ARCH=""
Juan Quintelae6e91b92009-07-16 18:34:17 +02004770TARGET_ABI_DIR=""
Juan Quintelae73aae62009-07-16 18:34:14 +02004771
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004772case "$target_name" in
aurel322408a522008-04-20 20:19:44 +00004773 i386)
aurel322408a522008-04-20 20:19:44 +00004774 ;;
4775 x86_64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004776 TARGET_BASE_ARCH=i386
aurel322408a522008-04-20 20:19:44 +00004777 ;;
4778 alpha)
aurel322408a522008-04-20 20:19:44 +00004779 ;;
4780 arm|armeb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004781 TARGET_ARCH=arm
aurel322408a522008-04-20 20:19:44 +00004782 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004783 gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
aurel322408a522008-04-20 20:19:44 +00004784 ;;
Alexander Graf6a49fa92013-09-03 20:12:22 +01004785 aarch64)
4786 TARGET_BASE_ARCH=arm
4787 bflt="yes"
Peter Maydell6a669422013-12-17 19:42:32 +00004788 gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
Alexander Graf6a49fa92013-09-03 20:12:22 +01004789 ;;
aurel322408a522008-04-20 20:19:44 +00004790 cris)
aurel322408a522008-04-20 20:19:44 +00004791 ;;
Michael Walle613a22c2011-02-17 23:45:17 +01004792 lm32)
Michael Walle613a22c2011-02-17 23:45:17 +01004793 ;;
aurel322408a522008-04-20 20:19:44 +00004794 m68k)
aurel322408a522008-04-20 20:19:44 +00004795 bflt="yes"
pbrook56aebc82008-10-11 17:55:29 +00004796 gdb_xml_files="cf-core.xml cf-fp.xml"
aurel322408a522008-04-20 20:19:44 +00004797 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004798 microblaze|microblazeel)
4799 TARGET_ARCH=microblaze
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004800 bflt="yes"
Edgar E. Iglesias72b675c2009-05-20 21:17:31 +02004801 ;;
Juan Quintela0adcffb2009-07-16 18:34:16 +02004802 mips|mipsel)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004803 TARGET_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004804 echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004805 ;;
4806 mipsn32|mipsn32el)
Richard Henderson597e2ce2013-02-10 10:30:50 -08004807 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004808 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004809 echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
Richard Henderson597e2ce2013-02-10 10:30:50 -08004810 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004811 ;;
4812 mips64|mips64el)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004813 TARGET_ARCH=mips64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004814 TARGET_BASE_ARCH=mips
Juan Quintela25be2102009-10-07 02:41:00 +02004815 echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004816 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004817 moxie)
4818 ;;
Jia Liue67db062012-07-20 15:50:39 +08004819 or32)
4820 TARGET_ARCH=openrisc
4821 TARGET_BASE_ARCH=openrisc
Jia Liue67db062012-07-20 15:50:39 +08004822 ;;
aurel322408a522008-04-20 20:19:44 +00004823 ppc)
aurel32c8b35322009-01-24 15:07:34 +00004824 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004825 ;;
4826 ppcemb)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004827 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004828 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004829 gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004830 ;;
4831 ppc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004832 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004833 TARGET_ABI_DIR=ppc
aurel32c8b35322009-01-24 15:07:34 +00004834 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004835 ;;
4836 ppc64abi32)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004837 TARGET_ARCH=ppc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004838 TARGET_BASE_ARCH=ppc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004839 TARGET_ABI_DIR=ppc
Juan Quintela25be2102009-10-07 02:41:00 +02004840 echo "TARGET_ABI32=y" >> $config_target_mak
aurel32c8b35322009-01-24 15:07:34 +00004841 gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
aurel322408a522008-04-20 20:19:44 +00004842 ;;
4843 sh4|sh4eb)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004844 TARGET_ARCH=sh4
aurel322408a522008-04-20 20:19:44 +00004845 bflt="yes"
4846 ;;
4847 sparc)
aurel322408a522008-04-20 20:19:44 +00004848 ;;
4849 sparc64)
Juan Quintela6acff7d2009-07-16 18:34:15 +02004850 TARGET_BASE_ARCH=sparc
aurel322408a522008-04-20 20:19:44 +00004851 ;;
4852 sparc32plus)
Juan Quintelab498c8a2009-07-16 18:34:11 +02004853 TARGET_ARCH=sparc64
Juan Quintela6acff7d2009-07-16 18:34:15 +02004854 TARGET_BASE_ARCH=sparc
Juan Quintelae6e91b92009-07-16 18:34:17 +02004855 TARGET_ABI_DIR=sparc
Juan Quintela25be2102009-10-07 02:41:00 +02004856 echo "TARGET_ABI32=y" >> $config_target_mak
aurel322408a522008-04-20 20:19:44 +00004857 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01004858 s390x)
Alexander Graf24e804ec2009-12-05 12:44:22 +01004859 ;;
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004860 unicore32)
Guan Xuetaod2fbca92011-04-12 16:27:03 +08004861 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04004862 xtensa|xtensaeb)
4863 TARGET_ARCH=xtensa
Max Filippovcfa550c2011-09-06 03:55:26 +04004864 ;;
aurel322408a522008-04-20 20:19:44 +00004865 *)
Peter Maydell76ad07a2013-04-08 12:11:26 +01004866 error_exit "Unsupported target CPU"
aurel322408a522008-04-20 20:19:44 +00004867 ;;
4868esac
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004869# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
4870if [ "$TARGET_BASE_ARCH" = "" ]; then
4871 TARGET_BASE_ARCH=$TARGET_ARCH
4872fi
4873
Paolo Bonzini5e8861a2012-05-29 10:23:15 +02004874symlink "$source_path/Makefile.target" "$target_dir/Makefile"
4875
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004876upper() {
4877 echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
4878}
4879
Daniel P. Berrange99afc912012-08-20 15:31:38 +01004880target_arch_name="`upper $TARGET_ARCH`"
Juan Quintela25be2102009-10-07 02:41:00 +02004881echo "TARGET_$target_arch_name=y" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004882echo "TARGET_NAME=$target_name" >> $config_target_mak
Juan Quintela25be2102009-10-07 02:41:00 +02004883echo "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
Juan Quintelae6e91b92009-07-16 18:34:17 +02004884if [ "$TARGET_ABI_DIR" = "" ]; then
4885 TARGET_ABI_DIR=$TARGET_ARCH
4886fi
Juan Quintela25be2102009-10-07 02:41:00 +02004887echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004888case "$target_name" in
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004889 i386|x86_64)
4890 if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004891 echo "CONFIG_XEN=y" >> $config_target_mak
Anthony PERARDeb6fda02012-06-21 15:32:59 +00004892 if test "$xen_pci_passthrough" = yes; then
4893 echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4894 fi
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004895 fi
Alexander Graf59d21e52011-07-17 07:30:29 +02004896 ;;
4897 *)
Juan Quintela1b0c87f2009-07-16 18:33:59 +02004898esac
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004899case "$target_name" in
Peter Maydell70a5f682013-12-17 19:42:30 +00004900 aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
Juan Quintelac59249f2009-07-16 18:34:00 +02004901 # Make sure the target and host cpus are compatible
4902 if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
Paolo Bonzinic1799a82013-06-14 15:19:07 +01004903 \( "$target_name" = "$cpu" -o \
4904 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4905 \( "$target_name" = "ppc64" -a "$cpu" = "ppc" \) -o \
4906 \( "$target_name" = "ppc" -a "$cpu" = "ppc64" \) -o \
4907 \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4908 \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \
4909 \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004910 echo "CONFIG_KVM=y" >> $config_target_mak
Stefan Weil1ba16962011-07-29 22:40:45 +02004911 if test "$vhost_net" = "yes" ; then
Michael S. Tsirkind5970052010-03-17 13:08:17 +02004912 echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4913 fi
Juan Quintelac59249f2009-07-16 18:34:00 +02004914 fi
4915esac
bellardde83cd02003-06-15 20:25:43 +00004916if test "$target_bigendian" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004917 echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
bellard97a847b2003-08-10 21:36:04 +00004918fi
4919if test "$target_softmmu" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004920 echo "CONFIG_SOFTMMU=y" >> $config_target_mak
bellardde83cd02003-06-15 20:25:43 +00004921fi
bellard997344f2003-10-27 21:10:39 +00004922if test "$target_user_only" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004923 echo "CONFIG_USER_ONLY=y" >> $config_target_mak
Stefan Weila2c80be2011-12-22 11:26:10 +01004924 echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
bellard997344f2003-10-27 21:10:39 +00004925fi
ths831b7822007-01-18 20:06:33 +00004926if test "$target_linux_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004927 echo "CONFIG_LINUX_USER=y" >> $config_target_mak
ths831b7822007-01-18 20:06:33 +00004928fi
pbrook56aebc82008-10-11 17:55:29 +00004929list=""
4930if test ! -z "$gdb_xml_files" ; then
4931 for x in $gdb_xml_files; do
4932 list="$list $source_path/gdb-xml/$x"
4933 done
Juan Quintela3d0f1512009-10-07 02:41:04 +02004934 echo "TARGET_XML_FILES=$list" >> $config_target_mak
pbrook56aebc82008-10-11 17:55:29 +00004935fi
bellardde83cd02003-06-15 20:25:43 +00004936
pbrooke5fe0c52006-06-11 13:32:59 +00004937if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004938 echo "TARGET_HAS_BFLT=y" >> $config_target_mak
pbrooke5fe0c52006-06-11 13:32:59 +00004939fi
Paul Brook379f6692009-07-17 12:48:08 +01004940if test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
Juan Quintela25be2102009-10-07 02:41:00 +02004941 echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
Paul Brook379f6692009-07-17 12:48:08 +01004942fi
blueswir184778502008-10-26 20:33:16 +00004943if test "$target_bsd_user" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02004944 echo "CONFIG_BSD_USER=y" >> $config_target_mak
blueswir184778502008-10-26 20:33:16 +00004945fi
bellard5b0753e2005-03-01 21:37:28 +00004946
Juan Quintela4afddb52009-08-03 14:46:45 +02004947# generate QEMU_CFLAGS/LDFLAGS for targets
Juan Quintelafa282482009-07-22 22:37:39 +02004948
Juan Quintela4afddb52009-08-03 14:46:45 +02004949cflags=""
Juan Quintelafa282482009-07-22 22:37:39 +02004950ldflags=""
Juan Quintela9b8e1112009-08-03 14:46:46 +02004951
Juan Quintela64656022009-08-03 14:46:53 +02004952for i in $ARCH $TARGET_BASE_ARCH ; do
4953 case "$i" in
4954 alpha)
Juan Quintela25be2102009-10-07 02:41:00 +02004955 echo "CONFIG_ALPHA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004956 echo "CONFIG_ALPHA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004957 ;;
4958 arm)
Juan Quintela25be2102009-10-07 02:41:00 +02004959 echo "CONFIG_ARM_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004960 echo "CONFIG_ARM_DIS=y" >> config-all-disas.mak
Claudio Fontana999b53e2014-02-05 17:27:28 +00004961 if test -n "${cxx}"; then
4962 echo "CONFIG_ARM_A64_DIS=y" >> $config_target_mak
4963 echo "CONFIG_ARM_A64_DIS=y" >> config-all-disas.mak
4964 fi
Juan Quintela64656022009-08-03 14:46:53 +02004965 ;;
4966 cris)
Juan Quintela25be2102009-10-07 02:41:00 +02004967 echo "CONFIG_CRIS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004968 echo "CONFIG_CRIS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004969 ;;
4970 hppa)
Juan Quintela25be2102009-10-07 02:41:00 +02004971 echo "CONFIG_HPPA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004972 echo "CONFIG_HPPA_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004973 ;;
Richard Hendersonc72b26e2013-08-20 12:20:05 -07004974 i386|x86_64|x32)
Juan Quintela25be2102009-10-07 02:41:00 +02004975 echo "CONFIG_I386_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004976 echo "CONFIG_I386_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004977 ;;
Aurelien Jarno903ec552010-03-29 02:12:51 +02004978 ia64*)
4979 echo "CONFIG_IA64_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004980 echo "CONFIG_IA64_DIS=y" >> config-all-disas.mak
Aurelien Jarno903ec552010-03-29 02:12:51 +02004981 ;;
Michael Walle79368f42012-03-31 19:54:20 +02004982 lm32)
4983 echo "CONFIG_LM32_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004984 echo "CONFIG_LM32_DIS=y" >> config-all-disas.mak
Michael Walle79368f42012-03-31 19:54:20 +02004985 ;;
Juan Quintela64656022009-08-03 14:46:53 +02004986 m68k)
Juan Quintela25be2102009-10-07 02:41:00 +02004987 echo "CONFIG_M68K_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004988 echo "CONFIG_M68K_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004989 ;;
Edgar E. Iglesias877fdc12011-02-21 12:42:20 +01004990 microblaze*)
Juan Quintela25be2102009-10-07 02:41:00 +02004991 echo "CONFIG_MICROBLAZE_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004992 echo "CONFIG_MICROBLAZE_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004993 ;;
4994 mips*)
Juan Quintela25be2102009-10-07 02:41:00 +02004995 echo "CONFIG_MIPS_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02004996 echo "CONFIG_MIPS_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02004997 ;;
Anthony Greend15a9c22013-03-18 15:49:25 -04004998 moxie*)
4999 echo "CONFIG_MOXIE_DIS=y" >> $config_target_mak
5000 echo "CONFIG_MOXIE_DIS=y" >> config-all-disas.mak
5001 ;;
Jia Liue67db062012-07-20 15:50:39 +08005002 or32)
5003 echo "CONFIG_OPENRISC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005004 echo "CONFIG_OPENRISC_DIS=y" >> config-all-disas.mak
Jia Liue67db062012-07-20 15:50:39 +08005005 ;;
Juan Quintela64656022009-08-03 14:46:53 +02005006 ppc*)
Juan Quintela25be2102009-10-07 02:41:00 +02005007 echo "CONFIG_PPC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005008 echo "CONFIG_PPC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005009 ;;
Alexander Graf24e804ec2009-12-05 12:44:22 +01005010 s390*)
Juan Quintela25be2102009-10-07 02:41:00 +02005011 echo "CONFIG_S390_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005012 echo "CONFIG_S390_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005013 ;;
5014 sh4)
Juan Quintela25be2102009-10-07 02:41:00 +02005015 echo "CONFIG_SH4_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005016 echo "CONFIG_SH4_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005017 ;;
5018 sparc*)
Juan Quintela25be2102009-10-07 02:41:00 +02005019 echo "CONFIG_SPARC_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005020 echo "CONFIG_SPARC_DIS=y" >> config-all-disas.mak
Juan Quintela64656022009-08-03 14:46:53 +02005021 ;;
Max Filippovcfa550c2011-09-06 03:55:26 +04005022 xtensa*)
5023 echo "CONFIG_XTENSA_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005024 echo "CONFIG_XTENSA_DIS=y" >> config-all-disas.mak
Max Filippovcfa550c2011-09-06 03:55:26 +04005025 ;;
Juan Quintela64656022009-08-03 14:46:53 +02005026 esac
5027done
Stefan Weil9195b2c2011-10-19 07:07:18 +02005028if test "$tcg_interpreter" = "yes" ; then
5029 echo "CONFIG_TCI_DIS=y" >> $config_target_mak
Paolo Bonzini76cad712012-10-24 11:12:21 +02005030 echo "CONFIG_TCI_DIS=y" >> config-all-disas.mak
Stefan Weil9195b2c2011-10-19 07:07:18 +02005031fi
Juan Quintela64656022009-08-03 14:46:53 +02005032
Juan Quintela6ee71262009-08-03 14:46:47 +02005033case "$ARCH" in
5034alpha)
5035 # Ensure there's only a single GP
5036 cflags="-msmall-data $cflags"
5037;;
5038esac
5039
Juan Quintelad02c1db2009-08-03 14:46:50 +02005040if test "$gprof" = "yes" ; then
Juan Quintela25be2102009-10-07 02:41:00 +02005041 echo "TARGET_GPROF=yes" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02005042 if test "$target_linux_user" = "yes" ; then
5043 cflags="-p $cflags"
5044 ldflags="-p $ldflags"
5045 fi
5046 if test "$target_softmmu" = "yes" ; then
5047 ldflags="-p $ldflags"
Juan Quintela25be2102009-10-07 02:41:00 +02005048 echo "GPROF_CFLAGS=-p" >> $config_target_mak
Juan Quintelad02c1db2009-08-03 14:46:50 +02005049 fi
5050fi
5051
Juan Quintela9b8e1112009-08-03 14:46:46 +02005052if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
Richard Henderson964c6fa2013-06-21 19:10:16 -07005053 ldflags="$ldflags $textseg_ldflags"
Juan Quintelafa282482009-07-22 22:37:39 +02005054fi
Juan Quintelafa282482009-07-22 22:37:39 +02005055
Juan Quintela25be2102009-10-07 02:41:00 +02005056echo "LDFLAGS+=$ldflags" >> $config_target_mak
5057echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak
Juan Quintelafa282482009-07-22 22:37:39 +02005058
bellard97a847b2003-08-10 21:36:04 +00005059done # for target in $targets
bellard7d132992003-03-06 23:23:54 +00005060
Gerd Hoffmannb776eca2012-11-12 12:18:38 +01005061if [ "$pixman" = "internal" ]; then
5062 echo "config-host.h: subdir-pixman" >> $config_host_mak
5063fi
5064
Michael R. Hines2da776d2013-07-22 10:01:54 -04005065if test "$rdma" = "yes" ; then
5066echo "CONFIG_RDMA=y" >> $config_host_mak
5067fi
5068
Peter Crosthwaitea540f152013-04-18 14:47:31 +10005069if [ "$dtc_internal" = "yes" ]; then
5070 echo "config-host.h: subdir-dtc" >> $config_host_mak
5071fi
5072
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005073# build tree in object directory in case the source is not in the current directory
Wenchao Xiaf93296e2013-09-06 11:24:32 +08005074DIRS="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 +04005075DIRS="$DIRS fsdev"
Christian Borntraeger9933c302013-04-23 01:23:03 +00005076DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005077DIRS="$DIRS roms/seabios roms/vgabios"
Paolo Bonzini2dee8d52012-06-04 09:15:43 +02005078DIRS="$DIRS qapi-generated"
Anthony Liguoric09015d2012-01-10 13:10:42 -06005079FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
5080FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
Andreas Färberaaa2ebc2013-07-06 20:41:37 +02005081FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005082FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
Andreas Färber446b9162011-05-08 13:25:56 +02005083FILES="$FILES pc-bios/spapr-rtas/Makefile"
Christian Borntraeger9933c302013-04-23 01:23:03 +00005084FILES="$FILES pc-bios/s390-ccw/Makefile"
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005085FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
Jan Kiszka4652b792013-02-22 21:05:01 +01005086FILES="$FILES pc-bios/qemu-icon.bmp"
Richard Henderson753d11f2011-06-24 11:58:37 -07005087for bios_file in \
5088 $source_path/pc-bios/*.bin \
Gerd Hoffmann5acc2ec2012-12-03 10:45:49 +01005089 $source_path/pc-bios/*.aml \
Richard Henderson753d11f2011-06-24 11:58:37 -07005090 $source_path/pc-bios/*.rom \
5091 $source_path/pc-bios/*.dtb \
Dominik Dingele89e33e2013-04-29 04:52:06 +00005092 $source_path/pc-bios/*.img \
Richard Henderson753d11f2011-06-24 11:58:37 -07005093 $source_path/pc-bios/openbios-* \
5094 $source_path/pc-bios/palcode-*
5095do
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005096 FILES="$FILES pc-bios/`basename $bios_file`"
5097done
Marcel Apfelbaumc2304b52013-12-26 16:54:20 +02005098for test_file in `find $source_path/tests/acpi-test-data -type f`
5099do
5100 FILES="$FILES tests/acpi-test-data`echo $test_file | sed -e 's/.*acpi-test-data//'`"
5101done
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005102mkdir -p $DIRS
5103for f in $FILES ; do
Stefan Weil72b8b5a2012-03-19 13:20:47 +01005104 if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
Peter Maydellf9245e12011-06-03 17:10:40 +01005105 symlink "$source_path/$f" "$f"
5106 fi
Paolo Bonzinid1807a42010-12-23 11:43:59 +01005107done
Paul Brook1ad21342009-05-19 16:17:58 +01005108
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005109# temporary config to build submodules
Anthony Liguori2d9f27d2009-11-02 15:50:27 -06005110for rom in seabios vgabios ; do
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005111 config_mak=roms/$rom/config.mak
Stefan Weil37116c82010-03-01 22:20:29 +01005112 echo "# Automatically generated by configure - do not modify" > $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005113 echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00005114 echo "AS=$as" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005115 echo "CC=$cc" >> $config_mak
5116 echo "BCC=bcc" >> $config_mak
Blue Swirl3dd46c72013-01-05 10:10:27 +00005117 echo "CPP=$cpp" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005118 echo "OBJCOPY=objcopy" >> $config_mak
Michael S. Tsirkina31a8642013-07-24 18:56:03 +03005119 echo "IASL=$iasl" >> $config_mak
Anthony Liguoric34ebfd2009-09-04 10:13:29 -05005120 echo "LD=$ld" >> $config_mak
5121done
5122
Jan Kiszkab40292e2010-05-31 14:43:31 -03005123if test "$docs" = "yes" ; then
5124 mkdir -p QMP
5125fi
Michael S. Tsirkindc655402014-03-09 17:37:49 +02005126
5127# Save the configure command line for later reuse.
5128cat <<EOD >config.status
5129#!/bin/sh
5130# Generated by configure.
5131# Run this file to recreate the current configuration.
5132# Compiler output produced by configure, useful for debugging
5133# configure, is in config.log if it exists.
5134EOD
5135printf "exec" >>config.status
5136printf " '%s'" "$0" "$@" >>config.status
5137echo >>config.status
5138chmod +x config.status
5139