xref: /openbmc/qemu/configure (revision 08fb77ed)
17d13299dSbellard#!/bin/sh
27d13299dSbellard#
33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard
47d13299dSbellard#
57d13299dSbellard# set temporary file name
67d13299dSbellardif test ! -z "$TMPDIR" ; then
77d13299dSbellard    TMPDIR1="${TMPDIR}"
87d13299dSbellardelif test ! -z "$TEMPDIR" ; then
97d13299dSbellard    TMPDIR1="${TEMPDIR}"
107d13299dSbellardelse
117d13299dSbellard    TMPDIR1="/tmp"
127d13299dSbellardfi
137d13299dSbellard
143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16a91b857cSmalcTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
177d13299dSbellard
180ba8681eSLoïc Minier# NB: do not call "exit" in the trap handler; this is buggy with some shells;
190ba8681eSLoïc Minier# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
200ba8681eSLoïc Miniertrap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
21da1d85e3SGerd Hoffmannrm -f config.log
229ac81bbbSmalc
23b48e3611SPeter Maydell# Print a helpful header at the top of config.log
24b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log
25979ae168SPeter Maydellprintf "# Configured with:" >> config.log
26979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log
27979ae168SPeter Maydellecho >> config.log
28b48e3611SPeter Maydellecho "#" >> config.log
29b48e3611SPeter Maydell
30bdf523e6SStefan Weil# Save the configure command line for later reuse.
31bdf523e6SStefan Weilcat <<EOD >config.status
32bdf523e6SStefan Weil#!/bin/sh
33bdf523e6SStefan Weil# Generated by configure.
34bdf523e6SStefan Weil# Run this file to recreate the current configuration.
35bdf523e6SStefan Weil# Compiler output produced by configure, useful for debugging
36bdf523e6SStefan Weil# configure, is in config.log if it exists.
37bdf523e6SStefan WeilEOD
38bdf523e6SStefan Weilprintf "exec" >>config.status
39bdf523e6SStefan Weilprintf " '%s'" "$0" "$@" >>config.status
40bdf523e6SStefan Weilecho >>config.status
41bdf523e6SStefan Weilchmod +x config.status
42bdf523e6SStefan Weil
4376ad07a4SPeter Maydellerror_exit() {
4476ad07a4SPeter Maydell    echo
4576ad07a4SPeter Maydell    echo "ERROR: $1"
4676ad07a4SPeter Maydell    while test -n "$2"; do
4776ad07a4SPeter Maydell        echo "       $2"
4876ad07a4SPeter Maydell        shift
4976ad07a4SPeter Maydell    done
5076ad07a4SPeter Maydell    echo
5176ad07a4SPeter Maydell    exit 1
5276ad07a4SPeter Maydell}
5376ad07a4SPeter Maydell
548dc38a78SPeter Maydelldo_cc() {
558dc38a78SPeter Maydell    # Run the compiler, capturing its output to the log.
568dc38a78SPeter Maydell    echo $cc "$@" >> config.log
578dc38a78SPeter Maydell    $cc "$@" >> config.log 2>&1 || return $?
588dc38a78SPeter Maydell    # Test passed. If this is an --enable-werror build, rerun
598dc38a78SPeter Maydell    # the test with -Werror and bail out if it fails. This
608dc38a78SPeter Maydell    # makes warning-generating-errors in configure test code
618dc38a78SPeter Maydell    # obvious to developers.
628dc38a78SPeter Maydell    if test "$werror" != "yes"; then
638dc38a78SPeter Maydell        return 0
648dc38a78SPeter Maydell    fi
658dc38a78SPeter Maydell    # Don't bother rerunning the compile if we were already using -Werror
668dc38a78SPeter Maydell    case "$*" in
678dc38a78SPeter Maydell        *-Werror*)
688dc38a78SPeter Maydell           return 0
698dc38a78SPeter Maydell        ;;
708dc38a78SPeter Maydell    esac
718dc38a78SPeter Maydell    echo $cc -Werror "$@" >> config.log
728dc38a78SPeter Maydell    $cc -Werror "$@" >> config.log 2>&1 && return $?
7376ad07a4SPeter Maydell    error_exit "configure test passed without -Werror but failed with -Werror." \
7476ad07a4SPeter Maydell        "This is probably a bug in the configure script. The failing command" \
7576ad07a4SPeter Maydell        "will be at the bottom of config.log." \
7676ad07a4SPeter Maydell        "You can run configure with --disable-werror to bypass this check."
778dc38a78SPeter Maydell}
788dc38a78SPeter Maydell
7952166aa0SJuan Quintelacompile_object() {
808dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
8152166aa0SJuan Quintela}
8252166aa0SJuan Quintela
8352166aa0SJuan Quintelacompile_prog() {
8452166aa0SJuan Quintela  local_cflags="$1"
8552166aa0SJuan Quintela  local_ldflags="$2"
868dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
8752166aa0SJuan Quintela}
8852166aa0SJuan Quintela
8911568d6dSPaolo Bonzini# symbolically link $1 to $2.  Portable version of "ln -sf".
9011568d6dSPaolo Bonzinisymlink() {
9172b8b5a1SStefan Weil  rm -rf "$2"
92ec5b06d7SAnthony Liguori  mkdir -p "$(dirname "$2")"
9372b8b5a1SStefan Weil  ln -s "$1" "$2"
9411568d6dSPaolo Bonzini}
9511568d6dSPaolo Bonzini
960dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
970dba6195SLoïc Minier# executable or a builtin)
980dba6195SLoïc Minierhas() {
990dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
1000dba6195SLoïc Minier}
1010dba6195SLoïc Minier
1020dba6195SLoïc Minier# search for an executable in PATH
1030dba6195SLoïc Minierpath_of() {
1040dba6195SLoïc Minier    local_command="$1"
1050dba6195SLoïc Minier    local_ifs="$IFS"
1060dba6195SLoïc Minier    local_dir=""
1070dba6195SLoïc Minier
1080dba6195SLoïc Minier    # pathname has a dir component?
1090dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
1100dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
1110dba6195SLoïc Minier            echo "$local_command"
1120dba6195SLoïc Minier            return 0
1130dba6195SLoïc Minier        fi
1140dba6195SLoïc Minier    fi
1150dba6195SLoïc Minier    if [ -z "$local_command" ]; then
1160dba6195SLoïc Minier        return 1
1170dba6195SLoïc Minier    fi
1180dba6195SLoïc Minier
1190dba6195SLoïc Minier    IFS=:
1200dba6195SLoïc Minier    for local_dir in $PATH; do
1210dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
1220dba6195SLoïc Minier            echo "$local_dir/$local_command"
1230dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
1240dba6195SLoïc Minier            return 0
1250dba6195SLoïc Minier        fi
1260dba6195SLoïc Minier    done
1270dba6195SLoïc Minier    # not found
1280dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
1290dba6195SLoïc Minier    return 1
1300dba6195SLoïc Minier}
1310dba6195SLoïc Minier
1327d13299dSbellard# default parameters
133ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"`
1342ff6b91eSJuan Quintelacpu=""
135a31a8642SMichael S. Tsirkiniasl="iasl"
1361e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
13743ce4dfeSbellardstatic="no"
1387d13299dSbellardcross_prefix=""
1390c58ac1cSmalcaudio_drv_list=""
140b64ec4e4SFam Zhengblock_drv_rw_whitelist=""
141b64ec4e4SFam Zhengblock_drv_ro_whitelist=""
142e49d021eSPeter Maydellhost_cc="cc"
14373da375eSJuan Quintelalibs_softmmu=""
1443e2e0e6bSJuan Quintelalibs_tools=""
14567f86e8eSJuan Quintelaaudio_pt_int=""
146d5631638Smalcaudio_win_int=""
1472b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc
148957f1f99SMichael Rothlibs_qga=""
1495bc62e01SGerd Hoffmanndebug_info="yes"
150ac0df51dSaliguori
151afb63ebdSStefan Weil# Don't accept a target_list environment variable.
152afb63ebdSStefan Weilunset target_list
153377529c0SPaolo Bonzini
154377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
155377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
156377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
157377529c0SPaolo Bonzini#              unless --disable-foo is given
158377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
159377529c0SPaolo Bonzini#              feature will searched for,
160377529c0SPaolo Bonzini#              if not found, configure exits with error
161377529c0SPaolo Bonzini#
162377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
163377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
164377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
165377529c0SPaolo Bonzini
166377529c0SPaolo Bonzinibluez=""
167377529c0SPaolo Bonzinibrlapi=""
168377529c0SPaolo Bonzinicurl=""
169377529c0SPaolo Bonzinicurses=""
170377529c0SPaolo Bonzinidocs=""
171377529c0SPaolo Bonzinifdt=""
17258952137SVincenzo Maffionenetmap="no"
173e2134eb9SGerd Hoffmannpixman=""
174377529c0SPaolo Bonzinisdl=""
175983eef5aSMeador Ingevirtfs=""
176821601eaSJes Sorensenvnc="yes"
177377529c0SPaolo Bonzinisparse="no"
178377529c0SPaolo Bonziniuuid=""
179377529c0SPaolo Bonzinivde=""
180377529c0SPaolo Bonzinivnc_tls=""
181377529c0SPaolo Bonzinivnc_sasl=""
182377529c0SPaolo Bonzinivnc_jpeg=""
183377529c0SPaolo Bonzinivnc_png=""
1847536ee4bSTim Hardeckvnc_ws=""
185377529c0SPaolo Bonzinixen=""
186d5b93ddfSAnthony PERARDxen_ctrl_version=""
187eb6fda0fSAnthony PERARDxen_pci_passthrough=""
188377529c0SPaolo Bonzinilinux_aio=""
18947e98658SCorey Bryantcap_ng=""
190377529c0SPaolo Bonziniattr=""
1914f26f2b6SAvi Kivitylibattr=""
192377529c0SPaolo Bonzinixfs=""
193377529c0SPaolo Bonzini
194d41a75a2SBradvhost_net="no"
1955e9be92dSNicholas Bellingervhost_scsi="no"
196d41a75a2SBradkvm="no"
1972da776dbSMichael R. Hinesrdma=""
198377529c0SPaolo Bonzinigprof="no"
199377529c0SPaolo Bonzinidebug_tcg="no"
200377529c0SPaolo Bonzinidebug="no"
201377529c0SPaolo Bonzinistrip_opt="yes"
2029195b2c2SStefan Weiltcg_interpreter="no"
203377529c0SPaolo Bonzinibigendian="no"
204377529c0SPaolo Bonzinimingw32="no"
2051d728c39SBlue Swirlgcov="no"
2061d728c39SBlue Swirlgcov_tool="gcov"
207377529c0SPaolo BonziniEXESUF=""
208377529c0SPaolo Bonziniprefix="/usr/local"
209377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
210528ae5b8SEduardo Habkostdatadir="\${prefix}/share"
211850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu"
212377529c0SPaolo Bonzinibindir="\${prefix}/bin"
2133aa5d2beSAlon Levylibdir="\${prefix}/lib"
2148bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec"
2150f94d6daSAlon Levyincludedir="\${prefix}/include"
216377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
217785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var"
218377529c0SPaolo Bonziniconfsuffix="/qemu"
219377529c0SPaolo Bonzinislirp="yes"
220377529c0SPaolo Bonzinifmod_lib=""
221377529c0SPaolo Bonzinifmod_inc=""
222377529c0SPaolo Bonzinioss_lib=""
223377529c0SPaolo Bonzinibsd="no"
224377529c0SPaolo Bonzinilinux="no"
225377529c0SPaolo Bonzinisolaris="no"
226377529c0SPaolo Bonziniprofiler="no"
227377529c0SPaolo Bonzinicocoa="no"
228377529c0SPaolo Bonzinisoftmmu="yes"
229377529c0SPaolo Bonzinilinux_user="no"
230377529c0SPaolo Bonzinibsd_user="no"
23130163d89SPeter Maydellguest_base="yes"
232377529c0SPaolo Bonziniuname_release=""
233377529c0SPaolo Bonziniaix="no"
234377529c0SPaolo Bonziniblobs="yes"
235377529c0SPaolo Bonzinipkgversion=""
23640d6444eSAvi Kivitypie=""
237377529c0SPaolo Bonzinizero_malloc=""
2383556c233SPaolo Bonziniqom_cast_debug="yes"
239377529c0SPaolo Bonzinitrace_backend="nop"
240377529c0SPaolo Bonzinitrace_file="trace"
241377529c0SPaolo Bonzinispice=""
242377529c0SPaolo Bonzinirbd=""
243111a38b0SRobert Relyeasmartcard_nss=""
2442b2325ffSGerd Hoffmannlibusb=""
24569354a83SHans de Goedeusb_redir=""
246b1e5fff4SMichael Walleglx=""
2471ece9905SAlon Levyzlib="yes"
248e8ef31a3SMichael Tokarevguest_agent=""
249d9840e25STomoki Sekiyamaguest_agent_with_vss="no"
250d9840e25STomoki Sekiyamavss_win32_sdk=""
251d9840e25STomoki Sekiyamawin_sdk="no"
2524b1c11fdSDaniel P. Berrangewant_tools="yes"
253c589b249SRonnie Sahlberglibiscsi=""
254519175a2SAlex Barcelocoroutine=""
25570c60c08SStefan Hajnoczicoroutine_pool=""
256f794573eSEduardo Otuboseccomp=""
257eb100396SBharata B Raoglusterfs=""
2580c14fb47SBharata B Raoglusterfs_discard="no"
259583f6e7bSStefan Hajnoczivirtio_blk_data_plane=""
260a4ccabcfSAnthony Liguorigtk=""
261528de90aSDaniel P. Berrangegtkabi="2.0"
262ab214c29SStefan Bergertpm="no"
2630a12ec87SRichard W.M. Joneslibssh2=""
2644f18b782SJeff Codyvhdx=""
265377529c0SPaolo Bonzini
266ac0df51dSaliguori# parse CC options first
267ac0df51dSaliguorifor opt do
268ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
269ac0df51dSaliguori  case "$opt" in
270ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
271ac0df51dSaliguori  ;;
2723d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
273ac0df51dSaliguori  ;;
27483f73fceSTomoki Sekiyama  --cxx=*) CXX="$optarg"
27583f73fceSTomoki Sekiyama  ;;
276ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
277ca4deeb1SPaolo Bonzini  ;;
2782ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2792ff6b91eSJuan Quintela  ;;
280a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
281f9943cd5SGerd Hoffmann                    EXTRA_CFLAGS="$optarg"
282e2a2ed06SJuan Quintela  ;;
283e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
284f9943cd5SGerd Hoffmann                     EXTRA_LDFLAGS="$optarg"
285e2a2ed06SJuan Quintela  ;;
2865bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2875bc62e01SGerd Hoffmann  ;;
2885bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2895bc62e01SGerd Hoffmann  ;;
290ac0df51dSaliguori  esac
291ac0df51dSaliguoridone
292ac0df51dSaliguori# OS specific
293ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
29493148aa5SStefan Weil# we can eliminate its usage altogether.
295ac0df51dSaliguori
296e49d021eSPeter Maydell# Preferred compiler:
297e49d021eSPeter Maydell#  ${CC} (if set)
298e49d021eSPeter Maydell#  ${cross_prefix}gcc (if cross-prefix specified)
299e49d021eSPeter Maydell#  system compiler
300e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then
301e49d021eSPeter Maydell  cc="$host_cc"
302e49d021eSPeter Maydellelse
303b3198cc2SStuart Yoder  cc="${CC-${cross_prefix}gcc}"
304e49d021eSPeter Maydellfi
305e49d021eSPeter Maydell
30683f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then
30783f73fceSTomoki Sekiyama  cxx="c++"
30883f73fceSTomoki Sekiyamaelse
30983f73fceSTomoki Sekiyama  cxx="${CXX-${cross_prefix}g++}"
31083f73fceSTomoki Sekiyamafi
31183f73fceSTomoki Sekiyama
312b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
3133dd46c78SBlue Swirlas="${AS-${cross_prefix}as}"
3143dd46c78SBlue Swirlcpp="${CPP-$cc -E}"
315b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
316b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
3173f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
318b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
319b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
32017884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
32117884d7bSSergei Trofimovichquery_pkg_config() {
32217884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
32317884d7bSSergei Trofimovich}
32417884d7bSSergei Trofimovichpkg_config=query_pkg_config
325b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
326ac0df51dSaliguori
32745d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
32845d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}"
32945d285abSPeter Maydell
330be17dc90SMichael S. Tsirkin# default flags for all hosts
331be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
332f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
333c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
334be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
3356b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
3365bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
3375bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
338be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
3395bc62e01SGerd Hoffmannfi
340be17dc90SMichael S. Tsirkin
341ca4deeb1SPaolo Bonzini# make source path absolute
342ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
343ca4deeb1SPaolo Bonzini
344ac0df51dSaliguoricheck_define() {
345ac0df51dSaliguoricat > $TMPC <<EOF
346ac0df51dSaliguori#if !defined($1)
347fd786e1aSPeter Maydell#error $1 not defined
348ac0df51dSaliguori#endif
349ac0df51dSaliguoriint main(void) { return 0; }
350ac0df51dSaliguoriEOF
35152166aa0SJuan Quintela  compile_object
352ac0df51dSaliguori}
353ac0df51dSaliguori
354bbea4050SPeter Maydellif check_define __linux__ ; then
355bbea4050SPeter Maydell  targetos="Linux"
356bbea4050SPeter Maydellelif check_define _WIN32 ; then
357bbea4050SPeter Maydell  targetos='MINGW32'
358bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then
359bbea4050SPeter Maydell  targetos='OpenBSD'
360bbea4050SPeter Maydellelif check_define __sun__ ; then
361bbea4050SPeter Maydell  targetos='SunOS'
362bbea4050SPeter Maydellelif check_define __HAIKU__ ; then
363bbea4050SPeter Maydell  targetos='Haiku'
364bbea4050SPeter Maydellelse
365bbea4050SPeter Maydell  targetos=`uname -s`
366bbea4050SPeter Maydellfi
367bbea4050SPeter Maydell
368bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use.
369bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're
370bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify
371bbea4050SPeter Maydell# the correct CPU with the --cpu option.
372bbea4050SPeter Maydellcase $targetos in
373bbea4050SPeter MaydellDarwin)
374bbea4050SPeter Maydell  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
375bbea4050SPeter Maydell  # run 64-bit userspace code.
376bbea4050SPeter Maydell  # If the user didn't specify a CPU explicitly and the kernel says this is
377bbea4050SPeter Maydell  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
378bbea4050SPeter Maydell  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
379bbea4050SPeter Maydell    cpu="x86_64"
380bbea4050SPeter Maydell  fi
381bbea4050SPeter Maydell  ;;
382bbea4050SPeter MaydellSunOS)
383bbea4050SPeter Maydell  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
384bbea4050SPeter Maydell  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
385bbea4050SPeter Maydell    cpu="x86_64"
386bbea4050SPeter Maydell  fi
387bbea4050SPeter Maydellesac
388bbea4050SPeter Maydell
3892ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
3902ff6b91eSJuan Quintela  # command line argument
3912ff6b91eSJuan Quintela  :
3922ff6b91eSJuan Quintelaelif check_define __i386__ ; then
393ac0df51dSaliguori  cpu="i386"
394ac0df51dSaliguorielif check_define __x86_64__ ; then
395c72b26ecSRichard Henderson  if check_define __ILP32__ ; then
396c72b26ecSRichard Henderson    cpu="x32"
397c72b26ecSRichard Henderson  else
398ac0df51dSaliguori    cpu="x86_64"
399c72b26ecSRichard Henderson  fi
4003aa9bd6cSblueswir1elif check_define __sparc__ ; then
4013aa9bd6cSblueswir1  if check_define __arch64__ ; then
4023aa9bd6cSblueswir1    cpu="sparc64"
4033aa9bd6cSblueswir1  else
4043aa9bd6cSblueswir1    cpu="sparc"
4053aa9bd6cSblueswir1  fi
406fdf7ed96Smalcelif check_define _ARCH_PPC ; then
407fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
408fdf7ed96Smalc    cpu="ppc64"
409ac0df51dSaliguori  else
410fdf7ed96Smalc    cpu="ppc"
411fdf7ed96Smalc  fi
412afa05235SAurelien Jarnoelif check_define __mips__ ; then
413afa05235SAurelien Jarno  cpu="mips"
414477ba620SAurelien Jarnoelif check_define __ia64__ ; then
415477ba620SAurelien Jarno  cpu="ia64"
416d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
417d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
418d66ed0eaSAurelien Jarno    cpu="s390x"
419d66ed0eaSAurelien Jarno  else
420d66ed0eaSAurelien Jarno    cpu="s390"
421d66ed0eaSAurelien Jarno  fi
42221d89f84SPeter Maydellelif check_define __arm__ ; then
42321d89f84SPeter Maydell  cpu="arm"
4241f080313SClaudio Fontanaelif check_define __aarch64__ ; then
4251f080313SClaudio Fontana  cpu="aarch64"
426f28ffed5SBradelif check_define __hppa__ ; then
427f28ffed5SBrad  cpu="hppa"
428fdf7ed96Smalcelse
429fdf7ed96Smalc  cpu=`uname -m`
430ac0df51dSaliguorifi
431ac0df51dSaliguori
432359bc95dSPeter MaydellARCH=
433359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
434359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
4357d13299dSbellardcase "$cpu" in
436c72b26ecSRichard Henderson  ia64|ppc|ppc64|s390|s390x|sparc64|x32)
437ea8f20f8SJuan Quintela    cpu="$cpu"
438ea8f20f8SJuan Quintela  ;;
4397d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
44097a847bcSbellard    cpu="i386"
4417d13299dSbellard  ;;
442aaa5fa14Saurel32  x86_64|amd64)
443aaa5fa14Saurel32    cpu="x86_64"
444aaa5fa14Saurel32  ;;
44521d89f84SPeter Maydell  armv*b|armv*l|arm)
44621d89f84SPeter Maydell    cpu="arm"
4477d13299dSbellard  ;;
4481f080313SClaudio Fontana  aarch64)
4491f080313SClaudio Fontana    cpu="aarch64"
4501f080313SClaudio Fontana  ;;
451afa05235SAurelien Jarno  mips*)
452afa05235SAurelien Jarno    cpu="mips"
453afa05235SAurelien Jarno  ;;
4543142255cSblueswir1  sparc|sun4[cdmuv])
455ae228531Sbellard    cpu="sparc"
456ae228531Sbellard  ;;
4577d13299dSbellard  *)
458359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
459359bc95dSPeter Maydell    ARCH=unknown
4607d13299dSbellard  ;;
4617d13299dSbellardesac
462359bc95dSPeter Maydellif test -z "$ARCH"; then
463359bc95dSPeter Maydell  ARCH="$cpu"
464359bc95dSPeter Maydellfi
465e2d52ad3SJuan Quintela
4667d13299dSbellard# OS specific
4670dbfc675SJuan Quintela
4687d13299dSbellardcase $targetos in
469c326e0afSbellardCYGWIN*)
470c326e0afSbellard  mingw32="yes"
471a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
472d5631638Smalc  audio_possible_drivers="winwave sdl"
473d5631638Smalc  audio_drv_list="winwave"
474c326e0afSbellard;;
47567b915a5SbellardMINGW32*)
47667b915a5Sbellard  mingw32="yes"
477d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
478d5631638Smalc  audio_drv_list="winwave"
47967b915a5Sbellard;;
4805c40d2bdSthsGNU/kFreeBSD)
481a167ba50SAurelien Jarno  bsd="yes"
4820c58ac1cSmalc  audio_drv_list="oss"
483f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
4845c40d2bdSths;;
4857d3505c5SbellardFreeBSD)
4867d3505c5Sbellard  bsd="yes"
4870db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4880c58ac1cSmalc  audio_drv_list="oss"
489f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
490f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
491f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
49258952137SVincenzo Maffione  netmap=""  # enable netmap autodetect
4937d3505c5Sbellard;;
494c5e97233Sblueswir1DragonFly)
495c5e97233Sblueswir1  bsd="yes"
4960db4a067SPaolo Bonzini  make="${MAKE-gmake}"
497c5e97233Sblueswir1  audio_drv_list="oss"
498c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
499c5e97233Sblueswir1;;
5007d3505c5SbellardNetBSD)
5017d3505c5Sbellard  bsd="yes"
5020db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5030c58ac1cSmalc  audio_drv_list="oss"
504c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
5058ef92a88Sblueswir1  oss_lib="-lossaudio"
5067d3505c5Sbellard;;
5077d3505c5SbellardOpenBSD)
5087d3505c5Sbellard  bsd="yes"
5090db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5104f6ab397SBrad Smith  audio_drv_list="sdl"
5114f6ab397SBrad Smith  audio_possible_drivers="sdl esd"
5127d3505c5Sbellard;;
51383fb7adfSbellardDarwin)
51483fb7adfSbellard  bsd="yes"
51583fb7adfSbellard  darwin="yes"
5161b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
517a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
5180c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
5191b0f9cc2Saliguori  else
520a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
5211b0f9cc2Saliguori  fi
522fd677642Sths  cocoa="yes"
5230c58ac1cSmalc  audio_drv_list="coreaudio"
524c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
5250c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
5267973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
527a0b7cf6bSPeter Maydell  # Disable attempts to use ObjectiveC features in os/object.h since they
528a0b7cf6bSPeter Maydell  # won't work when we're compiling with gcc as a C compiler.
529a0b7cf6bSPeter Maydell  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
53083fb7adfSbellard;;
531ec530c81SbellardSunOS)
532ec530c81Sbellard  solaris="yes"
5330db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5340db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
535fa58948dSBlue Swirl  ld="gld"
536e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
5370475a5caSths  needs_libsunmath="no"
538c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
539c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
5400475a5caSths    if test "$solarisrev" -le 9 ; then
5410475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
5420475a5caSths        needs_libsunmath="yes"
543f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
544f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
545f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
5460475a5caSths      else
54776ad07a4SPeter Maydell        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
54876ad07a4SPeter Maydell            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
54976ad07a4SPeter Maydell            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
55076ad07a4SPeter Maydell            "Studio 11 can be downloaded from www.sun.com."
5510475a5caSths      fi
5520475a5caSths    fi
55386b2bd93Sths  fi
5546b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
5550c58ac1cSmalc    audio_drv_list="oss"
5566b4d2ba1Sths  fi
557c2de5c91Smalc  audio_possible_drivers="oss sdl"
558d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
559d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
560d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
561d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
562a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
563560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
564560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
565560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
566ec530c81Sbellard;;
567b29fe3edSmalcAIX)
568b29fe3edSmalc  aix="yes"
5690db4a067SPaolo Bonzini  make="${MAKE-gmake}"
570b29fe3edSmalc;;
571179cf400SAndreas FärberHaiku)
572179cf400SAndreas Färber  haiku="yes"
573179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
574179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
575179cf400SAndreas Färber;;
576fb065187Sbellard*)
5770c58ac1cSmalc  audio_drv_list="oss"
578b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
5795327cf48Sbellard  linux="yes"
580831b7825Sths  linux_user="yes"
581af2be207SJan Kiszka  kvm="yes"
582af2be207SJan Kiszka  vhost_net="yes"
5835e9be92dSNicholas Bellinger  vhost_scsi="yes"
584c72b26ecSRichard Henderson  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
585c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
586c9ec1fe4Sbellard  fi
587a585140dSAlexey Kardashevskiy  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
588fb065187Sbellard;;
5897d13299dSbellardesac
5907d13299dSbellard
5917d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
592b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
59384778508Sblueswir1    bsd_user="yes"
5947d3505c5Sbellard  fi
59508de3949SAndreas Färberfi
5967d3505c5Sbellard
5970db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5980db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
59952510f8bSStefan Weil: ${python=${PYTHON-python}}
600e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
6010db4a067SPaolo Bonzini
6023c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC
6033c4a4d0dSPeter Maydellif has clang; then
6043c4a4d0dSPeter Maydell  objcc=clang
6053c4a4d0dSPeter Maydellelse
6063c4a4d0dSPeter Maydell  objcc="$cc"
6073c4a4d0dSPeter Maydellfi
6083c4a4d0dSPeter Maydell
6093457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
6103457a3f8SJuan Quintela  EXESUF=".exe"
611a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
612e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
613e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
614f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
615f7cf5d5bSStefan Weilcat > $TMPC << EOF
616f7cf5d5bSStefan Weilint main(void) { return 0; }
617f7cf5d5bSStefan WeilEOF
618f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
619f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
620f7cf5d5bSStefan Weil  fi
621c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
622683035deSPaolo Bonzini  mandir="\${prefix}"
623528ae5b8SEduardo Habkost  datadir="\${prefix}"
624850da188SEduardo Habkost  qemu_docdir="\${prefix}"
625683035deSPaolo Bonzini  bindir="\${prefix}"
626683035deSPaolo Bonzini  sysconfdir="\${prefix}"
6275a699bbbSLaszlo Ersek  local_statedir=
628683035deSPaolo Bonzini  confsuffix=""
629368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
6303457a3f8SJuan Quintelafi
6313457a3f8SJuan Quintela
632487fefdbSAnthony Liguoriwerror=""
63385aa5189Sbellard
6347d13299dSbellardfor opt do
635a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
6367d13299dSbellard  case "$opt" in
6372efc3265Sbellard  --help|-h) show_help=yes
6382efc3265Sbellard  ;;
63999123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
64099123e13SMike Frysinger  ;;
641b1a550a0Spbrook  --prefix=*) prefix="$optarg"
6427d13299dSbellard  ;;
643b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
64432ce6337Sbellard  ;;
645ca4deeb1SPaolo Bonzini  --source-path=*)
6467d13299dSbellard  ;;
647ac0df51dSaliguori  --cross-prefix=*)
6487d13299dSbellard  ;;
649ac0df51dSaliguori  --cc=*)
6507d13299dSbellard  ;;
651b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
65283469015Sbellard  ;;
65383f73fceSTomoki Sekiyama  --cxx=*)
65483f73fceSTomoki Sekiyama  ;;
655e007dbecSMichael S. Tsirkin  --iasl=*) iasl="$optarg"
656e007dbecSMichael S. Tsirkin  ;;
6573c4a4d0dSPeter Maydell  --objcc=*) objcc="$optarg"
6583c4a4d0dSPeter Maydell  ;;
659b1a550a0Spbrook  --make=*) make="$optarg"
6607d13299dSbellard  ;;
6616a882643Spbrook  --install=*) install="$optarg"
6626a882643Spbrook  ;;
663c886edfbSBlue Swirl  --python=*) python="$optarg"
664c886edfbSBlue Swirl  ;;
6651d728c39SBlue Swirl  --gcov=*) gcov_tool="$optarg"
6661d728c39SBlue Swirl  ;;
667e2d8830eSBrad  --smbd=*) smbd="$optarg"
668e2d8830eSBrad  ;;
669e2a2ed06SJuan Quintela  --extra-cflags=*)
6707d13299dSbellard  ;;
671e2a2ed06SJuan Quintela  --extra-ldflags=*)
6727d13299dSbellard  ;;
6735bc62e01SGerd Hoffmann  --enable-debug-info)
6745bc62e01SGerd Hoffmann  ;;
6755bc62e01SGerd Hoffmann  --disable-debug-info)
6765bc62e01SGerd Hoffmann  ;;
6772ff6b91eSJuan Quintela  --cpu=*)
6787d13299dSbellard  ;;
679b1a550a0Spbrook  --target-list=*) target_list="$optarg"
680de83cd02Sbellard  ;;
68174242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
68294a420b1SStefan Hajnoczi  ;;
68374242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
6849410b56cSPrerna Saxena  ;;
6857d13299dSbellard  --enable-gprof) gprof="yes"
6867d13299dSbellard  ;;
6871d728c39SBlue Swirl  --enable-gcov) gcov="yes"
6881d728c39SBlue Swirl  ;;
68979427693SLoïc Minier  --static)
69079427693SLoïc Minier    static="yes"
69179427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
69217884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
69343ce4dfeSbellard  ;;
6940b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
6950b24e75fSPaolo Bonzini  ;;
6960b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
6970b24e75fSPaolo Bonzini  ;;
6983aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
6993aa5d2beSAlon Levy  ;;
7008bf188aaSMichael Tokarev  --libexecdir=*) libexecdir="$optarg"
7018bf188aaSMichael Tokarev  ;;
7020f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
7030f94d6daSAlon Levy  ;;
704528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
7050b24e75fSPaolo Bonzini  ;;
706023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
707023d3d67SEduardo Habkost  ;;
708850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
7090b24e75fSPaolo Bonzini  ;;
710ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
71107381cc1SAnthony Liguori  ;;
712785c23aeSLuiz Capitulino  --localstatedir=*) local_statedir="$optarg"
713785c23aeSLuiz Capitulino  ;;
714785c23aeSLuiz Capitulino  --sbindir=*|--sharedstatedir=*|\
715023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
716023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
717023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
718023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
719023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
720023ddd74SMax Filippov    # lots of directory switches by default.
721023ddd74SMax Filippov  ;;
722e2134eb9SGerd Hoffmann  --with-system-pixman) pixman="system"
723e2134eb9SGerd Hoffmann  ;;
724e2134eb9SGerd Hoffmann  --without-system-pixman) pixman="internal"
725e2134eb9SGerd Hoffmann  ;;
72674880fe2SRobert Schiele  --without-pixman) pixman="none"
72774880fe2SRobert Schiele  ;;
72897a847bcSbellard  --disable-sdl) sdl="no"
72997a847bcSbellard  ;;
730c4198157SJuan Quintela  --enable-sdl) sdl="yes"
731c4198157SJuan Quintela  ;;
7323556c233SPaolo Bonzini  --disable-qom-cast-debug) qom_cast_debug="no"
7333556c233SPaolo Bonzini  ;;
7343556c233SPaolo Bonzini  --enable-qom-cast-debug) qom_cast_debug="yes"
7353556c233SPaolo Bonzini  ;;
736983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
737983eef5aSMeador Inge  ;;
738983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
739983eef5aSMeador Inge  ;;
740821601eaSJes Sorensen  --disable-vnc) vnc="no"
741821601eaSJes Sorensen  ;;
742821601eaSJes Sorensen  --enable-vnc) vnc="yes"
743821601eaSJes Sorensen  ;;
744b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
745102a52e4Sbellard  ;;
746c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
747c2de5c91Smalc  ;;
7482f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
7492f6a1ab0Sblueswir1  ;;
7500c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
7510c58ac1cSmalc  ;;
752b64ec4e4SFam Zheng  --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
753b64ec4e4SFam Zheng  ;;
754b64ec4e4SFam Zheng  --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
755eb852011SMarkus Armbruster  ;;
756f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
757f8393946Saurel32  ;;
758f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
759f8393946Saurel32  ;;
760f3d08ee6SPaul Brook  --enable-debug)
761f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
762f3d08ee6SPaul Brook      debug_tcg="yes"
763f3d08ee6SPaul Brook      debug="yes"
764f3d08ee6SPaul Brook      strip_opt="no"
765f3d08ee6SPaul Brook  ;;
76603b4fe7dSaliguori  --enable-sparse) sparse="yes"
76703b4fe7dSaliguori  ;;
76803b4fe7dSaliguori  --disable-sparse) sparse="no"
76903b4fe7dSaliguori  ;;
7701625af87Saliguori  --disable-strip) strip_opt="no"
7711625af87Saliguori  ;;
7728d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
7738d5d2d4cSths  ;;
7741be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
7751be10ad2SJuan Quintela  ;;
7762f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
7772f9606b3Saliguori  ;;
778ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
779ea784e3bSJuan Quintela  ;;
7802f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
7812f6f5c7aSCorentin Chary  ;;
7822f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
7832f6f5c7aSCorentin Chary  ;;
784efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
785efe556adSCorentin Chary  ;;
786efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
787efe556adSCorentin Chary  ;;
7887536ee4bSTim Hardeck  --disable-vnc-ws) vnc_ws="no"
7897536ee4bSTim Hardeck  ;;
7907536ee4bSTim Hardeck  --enable-vnc-ws) vnc_ws="yes"
7917536ee4bSTim Hardeck  ;;
792443f1376Sbellard  --disable-slirp) slirp="no"
793c20709aaSbellard  ;;
794ee682d27SStefan Weil  --disable-uuid) uuid="no"
795ee682d27SStefan Weil  ;;
796ee682d27SStefan Weil  --enable-uuid) uuid="yes"
797ee682d27SStefan Weil  ;;
798e0e6c8c0Saliguori  --disable-vde) vde="no"
7998a16d273Sths  ;;
800dfb278bdSJuan Quintela  --enable-vde) vde="yes"
801dfb278bdSJuan Quintela  ;;
80258952137SVincenzo Maffione  --disable-netmap) netmap="no"
80358952137SVincenzo Maffione  ;;
80458952137SVincenzo Maffione  --enable-netmap) netmap="yes"
80558952137SVincenzo Maffione  ;;
806e37630caSaliguori  --disable-xen) xen="no"
807e37630caSaliguori  ;;
808fc321b4bSJuan Quintela  --enable-xen) xen="yes"
809fc321b4bSJuan Quintela  ;;
810eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
811eb6fda0fSAnthony PERARD  ;;
812eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
813eb6fda0fSAnthony PERARD  ;;
8142e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
8152e4d9fb1Saurel32  ;;
8164ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
8174ffcedb6SJuan Quintela  ;;
818fb599c9aSbalrog  --disable-bluez) bluez="no"
819fb599c9aSbalrog  ;;
820a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
821a20a6f46SJuan Quintela  ;;
8227ba1e619Saliguori  --disable-kvm) kvm="no"
8237ba1e619Saliguori  ;;
824b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
825b31a0277SJuan Quintela  ;;
8269195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
8279195b2c2SStefan Weil  ;;
8289195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
8299195b2c2SStefan Weil  ;;
83047e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
83147e98658SCorey Bryant  ;;
83247e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
83347e98658SCorey Bryant  ;;
834cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
835cd4ec0b4SGerd Hoffmann  ;;
836cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
837cd4ec0b4SGerd Hoffmann  ;;
838c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
839c589b249SRonnie Sahlberg  ;;
840c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
841c589b249SRonnie Sahlberg  ;;
84205c2a3e7Sbellard  --enable-profiler) profiler="yes"
84305c2a3e7Sbellard  ;;
84414821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
84514821030SPavel Borzenkov  ;;
846c2de5c91Smalc  --enable-cocoa)
847c2de5c91Smalc      cocoa="yes" ;
848c2de5c91Smalc      sdl="no" ;
849c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
8505b0753e0Sbellard  ;;
851cad25d69Spbrook  --disable-system) softmmu="no"
8520a8e90f4Spbrook  ;;
853cad25d69Spbrook  --enable-system) softmmu="yes"
8540a8e90f4Spbrook  ;;
8550953a80fSZachary Amsden  --disable-user)
8560953a80fSZachary Amsden      linux_user="no" ;
8570953a80fSZachary Amsden      bsd_user="no" ;
8580953a80fSZachary Amsden  ;;
8590953a80fSZachary Amsden  --enable-user) ;;
860831b7825Sths  --disable-linux-user) linux_user="no"
8610a8e90f4Spbrook  ;;
862831b7825Sths  --enable-linux-user) linux_user="yes"
863831b7825Sths  ;;
86484778508Sblueswir1  --disable-bsd-user) bsd_user="no"
86584778508Sblueswir1  ;;
86684778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
86784778508Sblueswir1  ;;
868379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
869379f6698SPaul Brook  ;;
870379f6698SPaul Brook  --disable-guest-base) guest_base="no"
871379f6698SPaul Brook  ;;
87240d6444eSAvi Kivity  --enable-pie) pie="yes"
87334005a00SKirill A. Shutemov  ;;
87440d6444eSAvi Kivity  --disable-pie) pie="no"
87534005a00SKirill A. Shutemov  ;;
876c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
877c5937220Spbrook  ;;
87885aa5189Sbellard  --enable-werror) werror="yes"
87985aa5189Sbellard  ;;
88085aa5189Sbellard  --disable-werror) werror="no"
88185aa5189Sbellard  ;;
8824d3b6f6eSbalrog  --disable-curses) curses="no"
8834d3b6f6eSbalrog  ;;
884c584a6d0SJuan Quintela  --enable-curses) curses="yes"
885c584a6d0SJuan Quintela  ;;
886769ce76dSAlexander Graf  --disable-curl) curl="no"
887769ce76dSAlexander Graf  ;;
888788c8196SJuan Quintela  --enable-curl) curl="yes"
889788c8196SJuan Quintela  ;;
8902df87df7SJuan Quintela  --disable-fdt) fdt="no"
8912df87df7SJuan Quintela  ;;
8922df87df7SJuan Quintela  --enable-fdt) fdt="yes"
8932df87df7SJuan Quintela  ;;
8945c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
8955c6c3a6cSChristoph Hellwig  ;;
8965c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
8975c6c3a6cSChristoph Hellwig  ;;
898758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
899758e8e38SVenkateswararao Jujjuri (JV)  ;;
900758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
901758e8e38SVenkateswararao Jujjuri (JV)  ;;
90277755340Sths  --disable-blobs) blobs="no"
90377755340Sths  ;;
9044a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
9054a19f1ecSpbrook  ;;
906519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
907519175a2SAlex Barcelo  ;;
90870c60c08SStefan Hajnoczi  --disable-coroutine-pool) coroutine_pool="no"
90970c60c08SStefan Hajnoczi  ;;
91070c60c08SStefan Hajnoczi  --enable-coroutine-pool) coroutine_pool="yes"
91170c60c08SStefan Hajnoczi  ;;
912a25dba17SJuan Quintela  --disable-docs) docs="no"
91370ec5dc0SAnthony Liguori  ;;
914a25dba17SJuan Quintela  --enable-docs) docs="yes"
91583a3ab8bSJuan Quintela  ;;
916d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
917d5970055SMichael S. Tsirkin  ;;
918d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
919d5970055SMichael S. Tsirkin  ;;
9205e9be92dSNicholas Bellinger  --disable-vhost-scsi) vhost_scsi="no"
9215e9be92dSNicholas Bellinger  ;;
9225e9be92dSNicholas Bellinger  --enable-vhost-scsi) vhost_scsi="yes"
9235e9be92dSNicholas Bellinger  ;;
924b1e5fff4SMichael Walle  --disable-glx) glx="no"
92520ff075bSMichael Walle  ;;
926b1e5fff4SMichael Walle  --enable-glx) glx="yes"
92720ff075bSMichael Walle  ;;
928f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
929f27aaf4bSChristian Brunner  ;;
930f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
931f27aaf4bSChristian Brunner  ;;
9328c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
9338c84cf11SSergei Trofimovich  ;;
9348c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
9358c84cf11SSergei Trofimovich  ;;
936111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
937111a38b0SRobert Relyea  ;;
938111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
939111a38b0SRobert Relyea  ;;
9402b2325ffSGerd Hoffmann  --disable-libusb) libusb="no"
9412b2325ffSGerd Hoffmann  ;;
9422b2325ffSGerd Hoffmann  --enable-libusb) libusb="yes"
9432b2325ffSGerd Hoffmann  ;;
94469354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
94569354a83SHans de Goede  ;;
94669354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
94769354a83SHans de Goede  ;;
9481ece9905SAlon Levy  --disable-zlib-test) zlib="no"
9491ece9905SAlon Levy  ;;
950d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
951d138cee9SMichael Roth  ;;
952d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
953d138cee9SMichael Roth  ;;
954d9840e25STomoki Sekiyama  --with-vss-sdk) vss_win32_sdk=""
955d9840e25STomoki Sekiyama  ;;
956d9840e25STomoki Sekiyama  --with-vss-sdk=*) vss_win32_sdk="$optarg"
957d9840e25STomoki Sekiyama  ;;
958d9840e25STomoki Sekiyama  --without-vss-sdk) vss_win32_sdk="no"
959d9840e25STomoki Sekiyama  ;;
960d9840e25STomoki Sekiyama  --with-win-sdk) win_sdk=""
961d9840e25STomoki Sekiyama  ;;
962d9840e25STomoki Sekiyama  --with-win-sdk=*) win_sdk="$optarg"
963d9840e25STomoki Sekiyama  ;;
964d9840e25STomoki Sekiyama  --without-win-sdk) win_sdk="no"
965d9840e25STomoki Sekiyama  ;;
9664b1c11fdSDaniel P. Berrange  --enable-tools) want_tools="yes"
9674b1c11fdSDaniel P. Berrange  ;;
9684b1c11fdSDaniel P. Berrange  --disable-tools) want_tools="no"
9694b1c11fdSDaniel P. Berrange  ;;
970f794573eSEduardo Otubo  --enable-seccomp) seccomp="yes"
971f794573eSEduardo Otubo  ;;
972f794573eSEduardo Otubo  --disable-seccomp) seccomp="no"
973f794573eSEduardo Otubo  ;;
974eb100396SBharata B Rao  --disable-glusterfs) glusterfs="no"
975eb100396SBharata B Rao  ;;
976eb100396SBharata B Rao  --enable-glusterfs) glusterfs="yes"
977eb100396SBharata B Rao  ;;
978583f6e7bSStefan Hajnoczi  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
979583f6e7bSStefan Hajnoczi  ;;
980583f6e7bSStefan Hajnoczi  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
981583f6e7bSStefan Hajnoczi  ;;
982a4ccabcfSAnthony Liguori  --disable-gtk) gtk="no"
983a4ccabcfSAnthony Liguori  ;;
984a4ccabcfSAnthony Liguori  --enable-gtk) gtk="yes"
985a4ccabcfSAnthony Liguori  ;;
9862da776dbSMichael R. Hines  --enable-rdma) rdma="yes"
9872da776dbSMichael R. Hines  ;;
9882da776dbSMichael R. Hines  --disable-rdma) rdma="no"
9892da776dbSMichael R. Hines  ;;
990528de90aSDaniel P. Berrange  --with-gtkabi=*) gtkabi="$optarg"
991528de90aSDaniel P. Berrange  ;;
992ab214c29SStefan Berger  --enable-tpm) tpm="yes"
993ab214c29SStefan Berger  ;;
9940a12ec87SRichard W.M. Jones  --disable-libssh2) libssh2="no"
9950a12ec87SRichard W.M. Jones  ;;
9960a12ec87SRichard W.M. Jones  --enable-libssh2) libssh2="yes"
9970a12ec87SRichard W.M. Jones  ;;
9984f18b782SJeff Cody  --enable-vhdx) vhdx="yes"
9994f18b782SJeff Cody  ;;
10004f18b782SJeff Cody  --disable-vhdx) vhdx="no"
10014f18b782SJeff Cody  ;;
10027f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
10037f1559c6Sbalrog  ;;
10047d13299dSbellard  esac
10057d13299dSbellarddone
10067d13299dSbellard
100740293e58Sbellardcase "$cpu" in
1008e3608d66SRichard Henderson    ppc)
1009e3608d66SRichard Henderson           CPU_CFLAGS="-m32"
1010e3608d66SRichard Henderson           LDFLAGS="-m32 $LDFLAGS"
1011e3608d66SRichard Henderson           ;;
1012e3608d66SRichard Henderson    ppc64)
1013e3608d66SRichard Henderson           CPU_CFLAGS="-m64"
1014e3608d66SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
1015e3608d66SRichard Henderson           ;;
10169b9c37c3SRichard Henderson    sparc)
10170c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
101879f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32 -mcpu=ultrasparc"
10193142255cSblueswir1           ;;
1020ed968ff1SJuan Quintela    sparc64)
10210c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
102279f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -mcpu=ultrasparc"
10233142255cSblueswir1           ;;
102476d83bdeSths    s390)
102579f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m31 -march=z990"
102628d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
102728d7cc49SRichard Henderson           ;;
102828d7cc49SRichard Henderson    s390x)
102979f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -march=z990"
103028d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
103176d83bdeSths           ;;
103240293e58Sbellard    i386)
103379f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32"
10340c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
10352b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
103640293e58Sbellard           ;;
103740293e58Sbellard    x86_64)
103879f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64"
10390c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
10402b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
1041379f6698SPaul Brook           ;;
1042c72b26ecSRichard Henderson    x32)
1043c72b26ecSRichard Henderson           CPU_CFLAGS="-mx32"
1044c72b26ecSRichard Henderson           LDFLAGS="-mx32 $LDFLAGS"
1045c72b26ecSRichard Henderson           cc_i386='$(CC) -m32'
1046c72b26ecSRichard Henderson           ;;
104730163d89SPeter Maydell    # No special flags required for other host CPUs
10483142255cSblueswir1esac
10493142255cSblueswir1
105079f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
105179f3b12fSPeter CrosthwaiteEXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
105279f3b12fSPeter Crosthwaite
105360e0df25SPeter Maydelldefault_target_list=""
105460e0df25SPeter Maydell
10556e92f823SPeter Maydellmak_wilds=""
10566e92f823SPeter Maydell
105760e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then
10586e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
105960e0df25SPeter Maydellfi
106060e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then
10616e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
106260e0df25SPeter Maydellfi
106360e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then
10646e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
106560e0df25SPeter Maydellfi
106660e0df25SPeter Maydell
10676e92f823SPeter Maydellfor config in $mak_wilds; do
10686e92f823SPeter Maydell    default_target_list="${default_target_list} $(basename "$config" .mak)"
10696e92f823SPeter Maydelldone
10706e92f823SPeter Maydell
1071af5db58eSpbrookif test x"$show_help" = x"yes" ; then
1072af5db58eSpbrookcat << EOF
1073af5db58eSpbrook
1074af5db58eSpbrookUsage: configure [options]
1075af5db58eSpbrookOptions: [defaults in brackets after descriptions]
1076af5db58eSpbrook
1077*08fb77edSStefan WeilStandard options:
1078*08fb77edSStefan Weil  --help                   print this message
1079*08fb77edSStefan Weil  --prefix=PREFIX          install in PREFIX [$prefix]
1080*08fb77edSStefan Weil  --interp-prefix=PREFIX   where to find shared libraries, etc.
1081*08fb77edSStefan Weil                           use %M for cpu name [$interp_prefix]
1082*08fb77edSStefan Weil  --target-list=LIST       set target list (default: build everything)
1083*08fb77edSStefan Weil$(echo Available targets: $default_target_list | \
1084*08fb77edSStefan Weil  fold -s -w 53 | sed -e 's/^/                           /')
1085*08fb77edSStefan Weil
1086*08fb77edSStefan WeilAdvanced options (experts only):
1087*08fb77edSStefan Weil  --source-path=PATH       path of source code [$source_path]
1088*08fb77edSStefan Weil  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]
1089*08fb77edSStefan Weil  --cc=CC                  use C compiler CC [$cc]
1090*08fb77edSStefan Weil  --iasl=IASL              use ACPI compiler IASL [$iasl]
1091*08fb77edSStefan Weil  --host-cc=CC             use C compiler CC [$host_cc] for code run at
1092*08fb77edSStefan Weil                           build time
1093*08fb77edSStefan Weil  --cxx=CXX                use C++ compiler CXX [$cxx]
1094*08fb77edSStefan Weil  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]
1095*08fb77edSStefan Weil  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS
1096*08fb77edSStefan Weil  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS
1097*08fb77edSStefan Weil  --make=MAKE              use specified make [$make]
1098*08fb77edSStefan Weil  --install=INSTALL        use specified install [$install]
1099*08fb77edSStefan Weil  --python=PYTHON          use specified python [$python]
1100*08fb77edSStefan Weil  --smbd=SMBD              use specified smbd [$smbd]
1101*08fb77edSStefan Weil  --static                 enable static build [$static]
1102*08fb77edSStefan Weil  --mandir=PATH            install man pages in PATH
1103*08fb77edSStefan Weil  --datadir=PATH           install firmware in PATH$confsuffix
1104*08fb77edSStefan Weil  --docdir=PATH            install documentation in PATH$confsuffix
1105*08fb77edSStefan Weil  --bindir=PATH            install binaries in PATH
1106*08fb77edSStefan Weil  --libdir=PATH            install libraries in PATH
1107*08fb77edSStefan Weil  --sysconfdir=PATH        install config in PATH$confsuffix
1108*08fb77edSStefan Weil  --localstatedir=PATH     install local state in PATH (set at runtime on win32)
1109*08fb77edSStefan Weil  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]
1110*08fb77edSStefan Weil  --enable-debug-tcg       enable TCG debugging
1111*08fb77edSStefan Weil  --disable-debug-tcg      disable TCG debugging (default)
1112*08fb77edSStefan Weil  --enable-debug-info       enable debugging information (default)
1113*08fb77edSStefan Weil  --disable-debug-info      disable debugging information
1114*08fb77edSStefan Weil  --enable-debug           enable common debug build options
1115*08fb77edSStefan Weil  --enable-sparse          enable sparse checker
1116*08fb77edSStefan Weil  --disable-sparse         disable sparse checker (default)
1117*08fb77edSStefan Weil  --disable-strip          disable stripping binaries
1118*08fb77edSStefan Weil  --disable-werror         disable compilation abort on warning
1119*08fb77edSStefan Weil  --disable-sdl            disable SDL
1120*08fb77edSStefan Weil  --enable-sdl             enable SDL
1121*08fb77edSStefan Weil  --disable-gtk            disable gtk UI
1122*08fb77edSStefan Weil  --enable-gtk             enable gtk UI
1123*08fb77edSStefan Weil  --disable-virtfs         disable VirtFS
1124*08fb77edSStefan Weil  --enable-virtfs          enable VirtFS
1125*08fb77edSStefan Weil  --disable-vnc            disable VNC
1126*08fb77edSStefan Weil  --enable-vnc             enable VNC
1127*08fb77edSStefan Weil  --disable-cocoa          disable Cocoa (Mac OS X only)
1128*08fb77edSStefan Weil  --enable-cocoa           enable Cocoa (default on Mac OS X)
1129*08fb77edSStefan Weil  --audio-drv-list=LIST    set audio drivers list:
1130*08fb77edSStefan Weil                           Available drivers: $audio_possible_drivers
1131*08fb77edSStefan Weil  --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L
1132*08fb77edSStefan Weil  --block-drv-rw-whitelist=L
1133*08fb77edSStefan Weil                           set block driver read-write whitelist
1134*08fb77edSStefan Weil                           (affects only QEMU, not qemu-img)
1135*08fb77edSStefan Weil  --block-drv-ro-whitelist=L
1136*08fb77edSStefan Weil                           set block driver read-only whitelist
1137*08fb77edSStefan Weil                           (affects only QEMU, not qemu-img)
1138*08fb77edSStefan Weil  --disable-xen            disable xen backend driver support
1139*08fb77edSStefan Weil  --enable-xen             enable xen backend driver support
1140*08fb77edSStefan Weil  --disable-xen-pci-passthrough
1141*08fb77edSStefan Weil  --enable-xen-pci-passthrough
1142*08fb77edSStefan Weil  --disable-brlapi         disable BrlAPI
1143*08fb77edSStefan Weil  --enable-brlapi          enable BrlAPI
1144*08fb77edSStefan Weil  --disable-vnc-tls        disable TLS encryption for VNC server
1145*08fb77edSStefan Weil  --enable-vnc-tls         enable TLS encryption for VNC server
1146*08fb77edSStefan Weil  --disable-vnc-sasl       disable SASL encryption for VNC server
1147*08fb77edSStefan Weil  --enable-vnc-sasl        enable SASL encryption for VNC server
1148*08fb77edSStefan Weil  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server
1149*08fb77edSStefan Weil  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server
1150*08fb77edSStefan Weil  --disable-vnc-png        disable PNG compression for VNC server (default)
1151*08fb77edSStefan Weil  --enable-vnc-png         enable PNG compression for VNC server
1152*08fb77edSStefan Weil  --disable-vnc-ws         disable Websockets support for VNC server
1153*08fb77edSStefan Weil  --enable-vnc-ws          enable Websockets support for VNC server
1154*08fb77edSStefan Weil  --disable-curses         disable curses output
1155*08fb77edSStefan Weil  --enable-curses          enable curses output
1156*08fb77edSStefan Weil  --disable-curl           disable curl connectivity
1157*08fb77edSStefan Weil  --enable-curl            enable curl connectivity
1158*08fb77edSStefan Weil  --disable-fdt            disable fdt device tree
1159*08fb77edSStefan Weil  --enable-fdt             enable fdt device tree
1160*08fb77edSStefan Weil  --disable-bluez          disable bluez stack connectivity
1161*08fb77edSStefan Weil  --enable-bluez           enable bluez stack connectivity
1162*08fb77edSStefan Weil  --disable-slirp          disable SLIRP userspace network connectivity
1163*08fb77edSStefan Weil  --disable-kvm            disable KVM acceleration support
1164*08fb77edSStefan Weil  --enable-kvm             enable KVM acceleration support
1165*08fb77edSStefan Weil  --disable-rdma           disable RDMA-based migration support
1166*08fb77edSStefan Weil  --enable-rdma            enable RDMA-based migration support
1167*08fb77edSStefan Weil  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)
1168*08fb77edSStefan Weil  --enable-system          enable all system emulation targets
1169*08fb77edSStefan Weil  --disable-system         disable all system emulation targets
1170*08fb77edSStefan Weil  --enable-user            enable supported user emulation targets
1171*08fb77edSStefan Weil  --disable-user           disable all user emulation targets
1172*08fb77edSStefan Weil  --enable-linux-user      enable all linux usermode emulation targets
1173*08fb77edSStefan Weil  --disable-linux-user     disable all linux usermode emulation targets
1174*08fb77edSStefan Weil  --enable-bsd-user        enable all BSD usermode emulation targets
1175*08fb77edSStefan Weil  --disable-bsd-user       disable all BSD usermode emulation targets
1176*08fb77edSStefan Weil  --enable-guest-base      enable GUEST_BASE support for usermode
1177*08fb77edSStefan Weil                           emulation targets
1178*08fb77edSStefan Weil  --disable-guest-base     disable GUEST_BASE support
1179*08fb77edSStefan Weil  --enable-pie             build Position Independent Executables
1180*08fb77edSStefan Weil  --disable-pie            do not build Position Independent Executables
1181*08fb77edSStefan Weil  --fmod-lib               path to FMOD library
1182*08fb77edSStefan Weil  --fmod-inc               path to FMOD includes
1183*08fb77edSStefan Weil  --oss-lib                path to OSS library
1184*08fb77edSStefan Weil  --enable-uname-release=R Return R for uname -r in usermode emulation
1185*08fb77edSStefan Weil  --cpu=CPU                Build for host CPU [$cpu]
1186*08fb77edSStefan Weil  --disable-uuid           disable uuid support
1187*08fb77edSStefan Weil  --enable-uuid            enable uuid support
1188*08fb77edSStefan Weil  --disable-vde            disable support for vde network
1189*08fb77edSStefan Weil  --enable-vde             enable support for vde network
1190*08fb77edSStefan Weil  --disable-netmap         disable support for netmap network
1191*08fb77edSStefan Weil  --enable-netmap          enable support for netmap network
1192*08fb77edSStefan Weil  --disable-linux-aio      disable Linux AIO support
1193*08fb77edSStefan Weil  --enable-linux-aio       enable Linux AIO support
1194*08fb77edSStefan Weil  --disable-cap-ng         disable libcap-ng support
1195*08fb77edSStefan Weil  --enable-cap-ng          enable libcap-ng support
1196*08fb77edSStefan Weil  --disable-attr           disables attr and xattr support
1197*08fb77edSStefan Weil  --enable-attr            enable attr and xattr support
1198*08fb77edSStefan Weil  --disable-blobs          disable installing provided firmware blobs
1199*08fb77edSStefan Weil  --enable-docs            enable documentation build
1200*08fb77edSStefan Weil  --disable-docs           disable documentation build
1201*08fb77edSStefan Weil  --disable-vhost-net      disable vhost-net acceleration support
1202*08fb77edSStefan Weil  --enable-vhost-net       enable vhost-net acceleration support
1203*08fb77edSStefan Weil  --enable-trace-backend=B Set trace backend
1204*08fb77edSStefan Weil                           Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
1205*08fb77edSStefan Weil  --with-trace-file=NAME   Full PATH,NAME of file to store traces
1206*08fb77edSStefan Weil                           Default:trace-<pid>
1207*08fb77edSStefan Weil  --disable-spice          disable spice
1208*08fb77edSStefan Weil  --enable-spice           enable spice
1209*08fb77edSStefan Weil  --enable-rbd             enable building the rados block device (rbd)
1210*08fb77edSStefan Weil  --disable-libiscsi       disable iscsi support
1211*08fb77edSStefan Weil  --enable-libiscsi        enable iscsi support
1212*08fb77edSStefan Weil  --disable-smartcard-nss  disable smartcard nss support
1213*08fb77edSStefan Weil  --enable-smartcard-nss   enable smartcard nss support
1214*08fb77edSStefan Weil  --disable-libusb         disable libusb (for usb passthrough)
1215*08fb77edSStefan Weil  --enable-libusb          enable libusb (for usb passthrough)
1216*08fb77edSStefan Weil  --disable-usb-redir      disable usb network redirection support
1217*08fb77edSStefan Weil  --enable-usb-redir       enable usb network redirection support
1218*08fb77edSStefan Weil  --disable-guest-agent    disable building of the QEMU Guest Agent
1219*08fb77edSStefan Weil  --enable-guest-agent     enable building of the QEMU Guest Agent
1220*08fb77edSStefan Weil  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent
1221*08fb77edSStefan Weil  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)
1222*08fb77edSStefan Weil  --disable-seccomp        disable seccomp support
1223*08fb77edSStefan Weil  --enable-seccomp         enables seccomp support
1224*08fb77edSStefan Weil  --with-coroutine=BACKEND coroutine backend. Supported options:
1225*08fb77edSStefan Weil                           gthread, ucontext, sigaltstack, windows
1226*08fb77edSStefan Weil  --disable-coroutine-pool disable coroutine freelist (worse performance)
1227*08fb77edSStefan Weil  --enable-coroutine-pool  enable coroutine freelist (better performance)
1228*08fb77edSStefan Weil  --enable-glusterfs       enable GlusterFS backend
1229*08fb77edSStefan Weil  --disable-glusterfs      disable GlusterFS backend
1230*08fb77edSStefan Weil  --enable-gcov            enable test coverage analysis with gcov
1231*08fb77edSStefan Weil  --gcov=GCOV              use specified gcov [$gcov_tool]
1232*08fb77edSStefan Weil  --enable-tpm             enable TPM support
1233*08fb77edSStefan Weil  --disable-libssh2        disable ssh block device support
1234*08fb77edSStefan Weil  --enable-libssh2         enable ssh block device support
1235*08fb77edSStefan Weil  --disable-vhdx           disables support for the Microsoft VHDX image format
1236*08fb77edSStefan Weil  --enable-vhdx            enable support for the Microsoft VHDX image format
1237*08fb77edSStefan Weil
1238*08fb77edSStefan WeilNOTE: The object files are built at the place where configure is launched
1239af5db58eSpbrookEOF
1240af5db58eSpbrookexit 1
1241af5db58eSpbrookfi
1242af5db58eSpbrook
1243359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1244359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1245359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1246359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1247359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1248359bc95dSPeter Maydell        ARCH=tci
1249359bc95dSPeter Maydell    else
125076ad07a4SPeter Maydell        error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1251359bc95dSPeter Maydell    fi
1252359bc95dSPeter Maydellfi
1253359bc95dSPeter Maydell
12548d05095cSPaolo Bonzini# check that the C compiler works.
12558d05095cSPaolo Bonzinicat > $TMPC <<EOF
125675cafad7SStefan Weilint main(void) { return 0; }
12578d05095cSPaolo BonziniEOF
12588d05095cSPaolo Bonzini
12598d05095cSPaolo Bonziniif compile_object ; then
12608d05095cSPaolo Bonzini  : C compiler works ok
12618d05095cSPaolo Bonzinielse
126276ad07a4SPeter Maydell    error_exit "\"$cc\" either does not exist or does not work"
12638d05095cSPaolo Bonzinifi
12648d05095cSPaolo Bonzini
1265417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror
1266417c9d72SAlexander Graf# by default.  Only enable by default for git builds
1267417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION`
1268417c9d72SAlexander Graf
1269417c9d72SAlexander Grafif test -z "$werror" ; then
12706c8fec83SAndreas Färber    if test -d "$source_path/.git" -a \
1271417c9d72SAlexander Graf        "$linux" = "yes" ; then
1272417c9d72SAlexander Graf        werror="yes"
1273417c9d72SAlexander Graf    else
1274417c9d72SAlexander Graf        werror="no"
1275417c9d72SAlexander Graf    fi
1276417c9d72SAlexander Graffi
1277417c9d72SAlexander Graf
12788d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
12798d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
12808d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
128137746c5eSMarc-André Lureaugcc_flags="-Wendif-labels $gcc_flags"
1282c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags"
128371429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags"
12846ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would
12856ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due
12866ca026cbSPeter Maydell# to -Werror this would just silently disable some features,
12876ca026cbSPeter Maydell# so it's too error prone.
12888d05095cSPaolo Bonzinicat > $TMPC << EOF
12898d05095cSPaolo Bonziniint main(void) { return 0; }
12908d05095cSPaolo BonziniEOF
12918d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1292a1d29d6cSPeter Maydell    # Use the positive sense of the flag when testing for -Wno-wombat
1293a1d29d6cSPeter Maydell    # support (gcc will happily accept the -Wno- form of unknown
1294a1d29d6cSPeter Maydell    # warning options).
1295a1d29d6cSPeter Maydell    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1296a1d29d6cSPeter Maydell    if compile_prog "-Werror $optflag" "" ; then
12978d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
12988d05095cSPaolo Bonzini    fi
12998d05095cSPaolo Bonzinidone
13008d05095cSPaolo Bonzini
130137746c5eSMarc-André Lureauif compile_prog "-Werror -fstack-protector-all" "" ; then
130237746c5eSMarc-André Lureau    QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
130337746c5eSMarc-André Lureau    LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
130437746c5eSMarc-André Lureaufi
130537746c5eSMarc-André Lureau
1306cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1307cbdd1999SPaolo Bonzini# large functions that use global variables.  The bug is in all releases of
1308cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1309cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1310cbdd1999SPaolo Bonzinicat > $TMPC << EOF
1311cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1312cbdd1999SPaolo Bonziniint main(void) { return 0; }
1313cbdd1999SPaolo Bonzini#else
1314cbdd1999SPaolo Bonzini#error No bug in this compiler.
1315cbdd1999SPaolo Bonzini#endif
1316cbdd1999SPaolo BonziniEOF
1317cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then
1318cbdd1999SPaolo Bonzini  TRANSLATE_OPT_CFLAGS=-fno-gcse
1319cbdd1999SPaolo Bonzinifi
1320cbdd1999SPaolo Bonzini
132140d6444eSAvi Kivityif test "$static" = "yes" ; then
132240d6444eSAvi Kivity  if test "$pie" = "yes" ; then
132376ad07a4SPeter Maydell    error_exit "static and pie are mutually incompatible"
132440d6444eSAvi Kivity  else
132540d6444eSAvi Kivity    pie="no"
132640d6444eSAvi Kivity  fi
132740d6444eSAvi Kivityfi
132840d6444eSAvi Kivity
132940d6444eSAvi Kivityif test "$pie" = ""; then
133040d6444eSAvi Kivity  case "$cpu-$targetos" in
1331c72b26ecSRichard Henderson    i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
133240d6444eSAvi Kivity      ;;
133340d6444eSAvi Kivity    *)
133440d6444eSAvi Kivity      pie="no"
133540d6444eSAvi Kivity      ;;
133640d6444eSAvi Kivity  esac
133740d6444eSAvi Kivityfi
133840d6444eSAvi Kivity
133940d6444eSAvi Kivityif test "$pie" != "no" ; then
134040d6444eSAvi Kivity  cat > $TMPC << EOF
134121d4a791SAvi Kivity
134221d4a791SAvi Kivity#ifdef __linux__
134321d4a791SAvi Kivity#  define THREAD __thread
134421d4a791SAvi Kivity#else
134521d4a791SAvi Kivity#  define THREAD
134621d4a791SAvi Kivity#endif
134721d4a791SAvi Kivity
134821d4a791SAvi Kivitystatic THREAD int tls_var;
134921d4a791SAvi Kivity
135021d4a791SAvi Kivityint main(void) { return tls_var; }
135121d4a791SAvi Kivity
135240d6444eSAvi KivityEOF
135340d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
135440d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
135540d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
135640d6444eSAvi Kivity    pie="yes"
135740d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
135840d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
135940d6444eSAvi Kivity    fi
136040d6444eSAvi Kivity  else
136140d6444eSAvi Kivity    if test "$pie" = "yes"; then
136276ad07a4SPeter Maydell      error_exit "PIE not available due to missing toolchain support"
136340d6444eSAvi Kivity    else
136440d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
136540d6444eSAvi Kivity      pie="no"
136640d6444eSAvi Kivity    fi
136740d6444eSAvi Kivity  fi
136840d6444eSAvi Kivityfi
136940d6444eSAvi Kivity
137009dada40SPaolo Bonzini##########################################
137109dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains
137209dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit
137309dada40SPaolo Bonzini# specification is necessary
137409dada40SPaolo Bonzini
137509dada40SPaolo Bonziniif test "$cpu" = "i386"; then
137609dada40SPaolo Bonzini  cat > $TMPC << EOF
137709dada40SPaolo Bonzinistatic int sfaa(int *ptr)
137809dada40SPaolo Bonzini{
137909dada40SPaolo Bonzini  return __sync_fetch_and_and(ptr, 0);
138009dada40SPaolo Bonzini}
138109dada40SPaolo Bonzini
138209dada40SPaolo Bonziniint main(void)
138309dada40SPaolo Bonzini{
138409dada40SPaolo Bonzini  int val = 42;
13851405b629SStefan Weil  val = __sync_val_compare_and_swap(&val, 0, 1);
138609dada40SPaolo Bonzini  sfaa(&val);
138709dada40SPaolo Bonzini  return val;
138809dada40SPaolo Bonzini}
138909dada40SPaolo BonziniEOF
139009dada40SPaolo Bonzini  if ! compile_prog "" "" ; then
139109dada40SPaolo Bonzini    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
139209dada40SPaolo Bonzini  fi
139309dada40SPaolo Bonzinifi
139409dada40SPaolo Bonzini
139509dada40SPaolo Bonzini#########################################
1396ec530c81Sbellard# Solaris specific configure tool chain decisions
139709dada40SPaolo Bonzini
1398ec530c81Sbellardif test "$solaris" = "yes" ; then
13996792aa11SLoïc Minier  if has $install; then
14006792aa11SLoïc Minier    :
14016792aa11SLoïc Minier  else
140276ad07a4SPeter Maydell    error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
140376ad07a4SPeter Maydell        "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
140476ad07a4SPeter Maydell        "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1405ec530c81Sbellard  fi
14066792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
140776ad07a4SPeter Maydell    error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
140876ad07a4SPeter Maydell        "try ginstall from the GNU fileutils available from www.blastwave.org" \
140976ad07a4SPeter Maydell        "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1410ec530c81Sbellard  fi
14116792aa11SLoïc Minier  if has ar; then
14126792aa11SLoïc Minier    :
14136792aa11SLoïc Minier  else
1414ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
141576ad07a4SPeter Maydell      error_exit "No path includes ar" \
141676ad07a4SPeter Maydell          "Add /usr/ccs/bin to your path and rerun configure"
1417ec530c81Sbellard    fi
141876ad07a4SPeter Maydell    error_exit "No path includes ar"
1419ec530c81Sbellard  fi
1420ec530c81Sbellardfi
1421ec530c81Sbellard
14227a3fc891SSebastian Herbsztif ! has $python; then
142376ad07a4SPeter Maydell  error_exit "Python not found. Use --python=/path/to/python"
1424c886edfbSBlue Swirlfi
1425c886edfbSBlue Swirl
14266ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
14276ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
14281d984a67SStefan Weilif ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
142976ad07a4SPeter Maydell  error_exit "Cannot use '$python', Python 2.4 or later is required." \
143076ad07a4SPeter Maydell      "Note that Python 3 or later is not yet supported." \
143176ad07a4SPeter Maydell      "Use --python=/path/to/python to specify a supported Python."
14326ccea1e4SPeter Maydellfi
14336ccea1e4SPeter Maydell
143452510f8bSStefan Weil# The -B switch was added in Python 2.6.
143552510f8bSStefan Weil# If it is supplied, compiled files are not written.
143652510f8bSStefan Weil# Use it for Python versions which support it.
143752510f8bSStefan Weilif $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
143852510f8bSStefan Weil  python="$python -B"
143952510f8bSStefan Weilfi
144052510f8bSStefan Weil
1441afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then
1442121afa9eSAnthony Liguori    target_list="$default_target_list"
1443121afa9eSAnthony Liguorielse
1444121afa9eSAnthony Liguori    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
14455327cf48Sbellardfi
144625b48338SPeter Maydell
144725b48338SPeter Maydell# Check that we recognised the target name; this allows a more
144825b48338SPeter Maydell# friendly error message than if we let it fall through.
144925b48338SPeter Maydellfor target in $target_list; do
145025b48338SPeter Maydell    case " $default_target_list " in
145125b48338SPeter Maydell        *" $target "*)
145225b48338SPeter Maydell            ;;
145325b48338SPeter Maydell        *)
145425b48338SPeter Maydell            error_exit "Unknown target name '$target'"
145525b48338SPeter Maydell            ;;
145625b48338SPeter Maydell    esac
145725b48338SPeter Maydelldone
145825b48338SPeter Maydell
1459f55fe278SPaolo Bonzini# see if system emulation was really requested
1460f55fe278SPaolo Bonzinicase " $target_list " in
1461f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1462f55fe278SPaolo Bonzini  ;;
1463f55fe278SPaolo Bonzini  *) softmmu=no
1464f55fe278SPaolo Bonzini  ;;
1465f55fe278SPaolo Bonziniesac
14665327cf48Sbellard
1467249247c9SJuan Quintelafeature_not_found() {
1468249247c9SJuan Quintela  feature=$1
1469249247c9SJuan Quintela
147076ad07a4SPeter Maydell  error_exit "User requested feature $feature" \
147176ad07a4SPeter Maydell      "configure was not able to find it"
1472249247c9SJuan Quintela}
1473249247c9SJuan Quintela
14747d13299dSbellard# ---
14757d13299dSbellard# big/little endian test
14767d13299dSbellardcat > $TMPC << EOF
147761cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
147861cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
147961cc919fSMike Frysingerextern int foo(short *, short *);
148061cc919fSMike Frysingerint main(int argc, char *argv[]) {
148161cc919fSMike Frysinger    return foo(big_endian, little_endian);
14827d13299dSbellard}
14837d13299dSbellardEOF
14847d13299dSbellard
148561cc919fSMike Frysingerif compile_object ; then
148661cc919fSMike Frysinger    if grep -q BiGeNdIaN $TMPO ; then
148761cc919fSMike Frysinger        bigendian="yes"
148861cc919fSMike Frysinger    elif grep -q LiTtLeEnDiAn $TMPO ; then
148961cc919fSMike Frysinger        bigendian="no"
14907d13299dSbellard    else
14917d13299dSbellard        echo big/little test failed
14927d13299dSbellard    fi
14937d13299dSbellardelse
149461cc919fSMike Frysinger    echo big/little test failed
14957d13299dSbellardfi
14967d13299dSbellard
1497b0a47e79SJuan Quintela##########################################
1498779ab5e3SStefan Weil# pkg-config probe
1499779ab5e3SStefan Weil
1500779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then
150176ad07a4SPeter Maydell  error_exit "pkg-config binary '$pkg_config_exe' not found"
1502779ab5e3SStefan Weilfi
1503779ab5e3SStefan Weil
1504779ab5e3SStefan Weil##########################################
1505b0a47e79SJuan Quintela# NPTL probe
1506b0a47e79SJuan Quintela
150724cb36a6SPeter Maydellif test "$linux_user" = "yes"; then
1508bd0c5661Spbrook  cat > $TMPC <<EOF
1509bd0c5661Spbrook#include <sched.h>
151030813ceaSpbrook#include <linux/futex.h>
1511182eacc0SStefan Weilint main(void) {
1512bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1513bd0c5661Spbrook#error bork
1514bd0c5661Spbrook#endif
1515182eacc0SStefan Weil  return 0;
1516bd0c5661Spbrook}
1517bd0c5661SpbrookEOF
151824cb36a6SPeter Maydell  if ! compile_object ; then
1519b0a47e79SJuan Quintela    feature_not_found "nptl"
1520b0a47e79SJuan Quintela  fi
1521bd0c5661Spbrookfi
1522bd0c5661Spbrook
152311d9f695Sbellard##########################################
1524ac62922eSbalrog# zlib check
1525ac62922eSbalrog
15261ece9905SAlon Levyif test "$zlib" != "no" ; then
1527ac62922eSbalrog    cat > $TMPC << EOF
1528ac62922eSbalrog#include <zlib.h>
1529ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1530ac62922eSbalrogEOF
153152166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1532ac62922eSbalrog        :
1533ac62922eSbalrog    else
153476ad07a4SPeter Maydell        error_exit "zlib check failed" \
153576ad07a4SPeter Maydell            "Make sure to have the zlib libs and headers installed."
1536ac62922eSbalrog    fi
15371ece9905SAlon Levyfi
1538f544a488SPaolo Bonzinilibs_softmmu="$libs_softmmu -lz"
1539ac62922eSbalrog
1540ac62922eSbalrog##########################################
1541f794573eSEduardo Otubo# libseccomp check
1542f794573eSEduardo Otubo
1543f794573eSEduardo Otuboif test "$seccomp" != "no" ; then
154465d5d3f9SStefan Weil    if $pkg_config --atleast-version=2.1.0 libseccomp; then
1545b4451996SMichael Tokarev        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1546372e47e9SAndreas Färber        QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1547f794573eSEduardo Otubo	seccomp="yes"
1548f794573eSEduardo Otubo    else
1549f794573eSEduardo Otubo	if test "$seccomp" = "yes"; then
1550f794573eSEduardo Otubo            feature_not_found "libseccomp"
1551f794573eSEduardo Otubo	fi
1552e84d5956SYann E. MORIN	seccomp="no"
1553f794573eSEduardo Otubo    fi
1554f794573eSEduardo Otubofi
1555f794573eSEduardo Otubo##########################################
1556e37630caSaliguori# xen probe
1557e37630caSaliguori
1558fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1559b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1560d5b93ddfSAnthony PERARD
156150ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
156250ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
156350ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
156450ced5b3SStefan Weil
156550ced5b3SStefan Weil  # Xen (any)
156650ced5b3SStefan Weil  cat > $TMPC <<EOF
156750ced5b3SStefan Weil#include <xenctrl.h>
156850ced5b3SStefan Weilint main(void) {
156950ced5b3SStefan Weil  return 0;
157050ced5b3SStefan Weil}
157150ced5b3SStefan WeilEOF
157250ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
157350ced5b3SStefan Weil    # Xen not found
157450ced5b3SStefan Weil    if test "$xen" = "yes" ; then
157550ced5b3SStefan Weil      feature_not_found "xen"
157650ced5b3SStefan Weil    fi
157750ced5b3SStefan Weil    xen=no
157850ced5b3SStefan Weil
1579d5b93ddfSAnthony PERARD  # Xen unstable
158069deef08SPeter Maydell  elif
158169deef08SPeter Maydell      cat > $TMPC <<EOF &&
1582e37630caSaliguori#include <xenctrl.h>
1583e108a3c1SAnthony PERARD#include <xenstore.h>
1584d5b93ddfSAnthony PERARD#include <stdint.h>
1585d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1586d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1587d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1588d5b93ddfSAnthony PERARD#endif
1589d5b93ddfSAnthony PERARDint main(void) {
1590d5b93ddfSAnthony PERARD  xc_interface *xc;
1591d5b93ddfSAnthony PERARD  xs_daemon_open();
1592d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1593d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1594d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1595b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
15968688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
15978688e065SStefano Stabellini  return 0;
15988688e065SStefano Stabellini}
15998688e065SStefano StabelliniEOF
16008688e065SStefano Stabellini      compile_prog "" "$xen_libs"
160169deef08SPeter Maydell    then
16028688e065SStefano Stabellini    xen_ctrl_version=420
16038688e065SStefano Stabellini    xen=yes
16048688e065SStefano Stabellini
160569deef08SPeter Maydell  elif
160669deef08SPeter Maydell      cat > $TMPC <<EOF &&
16078688e065SStefano Stabellini#include <xenctrl.h>
16088688e065SStefano Stabellini#include <xs.h>
16098688e065SStefano Stabellini#include <stdint.h>
16108688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
16118688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
16128688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
16138688e065SStefano Stabellini#endif
16148688e065SStefano Stabelliniint main(void) {
16158688e065SStefano Stabellini  xs_daemon_open();
16169b4c0b56SPeter Maydell  xc_interface_open(0, 0, 0);
16178688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
16188688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
16198688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1620d5b93ddfSAnthony PERARD  return 0;
1621d5b93ddfSAnthony PERARD}
1622e37630caSaliguoriEOF
162350ced5b3SStefan Weil      compile_prog "" "$xen_libs"
162469deef08SPeter Maydell    then
1625d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1626fc321b4bSJuan Quintela    xen=yes
1627d5b93ddfSAnthony PERARD
1628d5b93ddfSAnthony PERARD  # Xen 4.0.0
162969deef08SPeter Maydell  elif
163069deef08SPeter Maydell      cat > $TMPC <<EOF &&
1631d5b93ddfSAnthony PERARD#include <xenctrl.h>
1632d5b93ddfSAnthony PERARD#include <xs.h>
1633d5b93ddfSAnthony PERARD#include <stdint.h>
1634d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1635d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1636d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1637d5b93ddfSAnthony PERARD#endif
1638d5b93ddfSAnthony PERARDint main(void) {
1639b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1640b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1641b87de24eSAnthony PERARD  };
1642d5b93ddfSAnthony PERARD  xs_daemon_open();
1643d5b93ddfSAnthony PERARD  xc_interface_open();
1644d5b93ddfSAnthony PERARD  xc_gnttab_open();
1645d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1646b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1647d5b93ddfSAnthony PERARD  return 0;
1648d5b93ddfSAnthony PERARD}
1649d5b93ddfSAnthony PERARDEOF
1650d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
165169deef08SPeter Maydell    then
1652d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1653d5b93ddfSAnthony PERARD    xen=yes
1654d5b93ddfSAnthony PERARD
1655b87de24eSAnthony PERARD  # Xen 3.4.0
165669deef08SPeter Maydell  elif
165769deef08SPeter Maydell      cat > $TMPC <<EOF &&
1658b87de24eSAnthony PERARD#include <xenctrl.h>
1659b87de24eSAnthony PERARD#include <xs.h>
1660b87de24eSAnthony PERARDint main(void) {
1661b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1662b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1663b87de24eSAnthony PERARD  };
1664b87de24eSAnthony PERARD  xs_daemon_open();
1665b87de24eSAnthony PERARD  xc_interface_open();
1666b87de24eSAnthony PERARD  xc_gnttab_open();
1667b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1668b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1669b87de24eSAnthony PERARD  return 0;
1670b87de24eSAnthony PERARD}
1671b87de24eSAnthony PERARDEOF
1672b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
167369deef08SPeter Maydell    then
1674b87de24eSAnthony PERARD    xen_ctrl_version=340
1675b87de24eSAnthony PERARD    xen=yes
1676b87de24eSAnthony PERARD
1677b87de24eSAnthony PERARD  # Xen 3.3.0
167869deef08SPeter Maydell  elif
167969deef08SPeter Maydell      cat > $TMPC <<EOF &&
1680d5b93ddfSAnthony PERARD#include <xenctrl.h>
1681d5b93ddfSAnthony PERARD#include <xs.h>
1682d5b93ddfSAnthony PERARDint main(void) {
1683d5b93ddfSAnthony PERARD  xs_daemon_open();
1684d5b93ddfSAnthony PERARD  xc_interface_open();
1685d5b93ddfSAnthony PERARD  xc_gnttab_open();
1686d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1687d5b93ddfSAnthony PERARD  return 0;
1688d5b93ddfSAnthony PERARD}
1689d5b93ddfSAnthony PERARDEOF
1690d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
169169deef08SPeter Maydell    then
1692d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1693d5b93ddfSAnthony PERARD    xen=yes
1694d5b93ddfSAnthony PERARD
169550ced5b3SStefan Weil  # Xen version unsupported
1696e37630caSaliguori  else
1697fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
169850ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1699fc321b4bSJuan Quintela    fi
1700fc321b4bSJuan Quintela    xen=no
1701e37630caSaliguori  fi
1702d5b93ddfSAnthony PERARD
1703d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1704d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1705d5b93ddfSAnthony PERARD  fi
1706e37630caSaliguorifi
1707e37630caSaliguori
1708eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1709eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1710eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1711eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1712eb6fda0fSAnthony PERARD  else
1713eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1714eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
171576ad07a4SPeter Maydell        error_exit "User requested feature Xen PCI Passthrough" \
171676ad07a4SPeter Maydell            "This feature does not work with Xen 3.3"
1717eb6fda0fSAnthony PERARD      fi
171876ad07a4SPeter Maydell      error_exit "User requested feature Xen PCI Passthrough" \
171976ad07a4SPeter Maydell          " but this feature requires /sys from Linux"
1720eb6fda0fSAnthony PERARD    fi
1721eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1722eb6fda0fSAnthony PERARD  fi
1723eb6fda0fSAnthony PERARDfi
1724eb6fda0fSAnthony PERARD
1725e37630caSaliguori##########################################
172644dc0ca3SAlon Levy# libtool probe
172744dc0ca3SAlon Levy
17283f534581SBradif ! has $libtool; then
172944dc0ca3SAlon Levy    libtool=
173044dc0ca3SAlon Levyfi
173144dc0ca3SAlon Levy
17328e515b12SPeter Maydell# MacOSX ships with a libtool which isn't the GNU one; weed this
17338e515b12SPeter Maydell# out by checking whether libtool supports the --version switch
17348e515b12SPeter Maydellif test -n "$libtool"; then
17358e515b12SPeter Maydell  if ! "$libtool" --version >/dev/null 2>&1; then
17368e515b12SPeter Maydell    libtool=
17378e515b12SPeter Maydell  fi
17388e515b12SPeter Maydellfi
17398e515b12SPeter Maydell
174044dc0ca3SAlon Levy##########################################
1741dfffc653SJuan Quintela# Sparse probe
1742dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
17430dba6195SLoïc Minier  if has cgcc; then
1744dfffc653SJuan Quintela    sparse=yes
1745dfffc653SJuan Quintela  else
1746dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1747dfffc653SJuan Quintela      feature_not_found "sparse"
1748dfffc653SJuan Quintela    fi
1749dfffc653SJuan Quintela    sparse=no
1750dfffc653SJuan Quintela  fi
1751dfffc653SJuan Quintelafi
1752dfffc653SJuan Quintela
1753dfffc653SJuan Quintela##########################################
1754a4ccabcfSAnthony Liguori# GTK probe
1755a4ccabcfSAnthony Liguori
1756a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then
1757528de90aSDaniel P. Berrange    gtkpackage="gtk+-$gtkabi"
1758528de90aSDaniel P. Berrange    if test "$gtkabi" = "3.0" ; then
1759528de90aSDaniel P. Berrange      gtkversion="3.0.0"
1760528de90aSDaniel P. Berrange      vtepackage="vte-2.90"
1761528de90aSDaniel P. Berrange      vteversion="0.32.0"
1762528de90aSDaniel P. Berrange    else
1763528de90aSDaniel P. Berrange      gtkversion="2.18.0"
1764528de90aSDaniel P. Berrange      vtepackage="vte"
1765528de90aSDaniel P. Berrange      vteversion="0.24.0"
1766528de90aSDaniel P. Berrange    fi
17670d185e63SPeter Maydell    if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
17680d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17690d185e63SPeter Maydell            feature_not_found "gtk"
17700d185e63SPeter Maydell        fi
17710d185e63SPeter Maydell        gtk="no"
17720d185e63SPeter Maydell    elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
17730d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17740d185e63SPeter Maydell            error_exit "libvte not found (required for gtk support)"
17750d185e63SPeter Maydell        fi
17760d185e63SPeter Maydell        gtk="no"
17770d185e63SPeter Maydell    else
1778ca871ec8SStefan Weil	gtk_cflags=`$pkg_config --cflags $gtkpackage`
1779ca871ec8SStefan Weil	gtk_libs=`$pkg_config --libs $gtkpackage`
1780ca871ec8SStefan Weil	vte_cflags=`$pkg_config --cflags $vtepackage`
1781ca871ec8SStefan Weil	vte_libs=`$pkg_config --libs $vtepackage`
1782a4ccabcfSAnthony Liguori	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1783a4ccabcfSAnthony Liguori	gtk="yes"
1784a4ccabcfSAnthony Liguori    fi
1785a4ccabcfSAnthony Liguorifi
1786a4ccabcfSAnthony Liguori
1787a4ccabcfSAnthony Liguori##########################################
178811d9f695Sbellard# SDL probe
178911d9f695Sbellard
17903ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
17913ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
17923ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
17933ec87ffeSPaolo Bonzini  sdl_config=sdl-config
17943ec87ffeSPaolo Bonzinifi
17953ec87ffeSPaolo Bonzini
179665d5d3f9SStefan Weilif $pkg_config sdl --exists; then
1797a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1798fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
17993ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
18003ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
18019316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1802a0dfd8a4SLoïc Minierelse
1803a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1804a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1805a0dfd8a4SLoïc Minier  fi
1806a0dfd8a4SLoïc Minier  sdl=no
18079316f803SPaolo Bonzinifi
180829e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
18093ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
18103ec87ffeSPaolo Bonzinifi
181111d9f695Sbellard
18129316f803SPaolo Bonzinisdl_too_old=no
1813c4198157SJuan Quintelaif test "$sdl" != "no" ; then
181411d9f695Sbellard  cat > $TMPC << EOF
181511d9f695Sbellard#include <SDL.h>
181611d9f695Sbellard#undef main /* We don't want SDL to override our main() */
181711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
181811d9f695SbellardEOF
18199316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
182074f42e18STeLeMan  if test "$static" = "yes" ; then
182174f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
182274f42e18STeLeMan  else
18239316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
182474f42e18STeLeMan  fi
182552166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
182611d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
182711d9f695Sbellard      sdl_too_old=yes
182811d9f695Sbellard    else
1829fd677642Sths      if test "$cocoa" = "no" ; then
183011d9f695Sbellard        sdl=yes
183111d9f695Sbellard      fi
1832fd677642Sths    fi
18337c1f25b4Sbellard
183467c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
18351ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
183667c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1837f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1838f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
183911d9f695Sbellard      fi
184052166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
18411ac88f28SJuan Quintela	:
18421ac88f28SJuan Quintela      else
18431ac88f28SJuan Quintela        sdl=no
18447c1f25b4Sbellard      fi
18457c1f25b4Sbellard    fi # static link
1846c4198157SJuan Quintela  else # sdl not found
1847c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1848c4198157SJuan Quintela      feature_not_found "sdl"
1849c4198157SJuan Quintela    fi
1850c4198157SJuan Quintela    sdl=no
18517c1f25b4Sbellard  fi # sdl compile test
1852fd677642Sthsfi
185311d9f695Sbellard
18545368a422Saliguoriif test "$sdl" = "yes" ; then
18555368a422Saliguori  cat > $TMPC <<EOF
18565368a422Saliguori#include <SDL.h>
18575368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
18585368a422Saliguori#include <X11/XKBlib.h>
18595368a422Saliguori#else
18605368a422Saliguori#error No x11 support
18615368a422Saliguori#endif
18625368a422Saliguoriint main(void) { return 0; }
18635368a422SaliguoriEOF
186452166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1865681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
18665368a422Saliguori  fi
18670705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
18685368a422Saliguorifi
18695368a422Saliguori
18708f28f3fbSths##########################################
18712da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries
18722da776dbSMichael R. Hinesif test "$rdma" != "no" ; then
18732da776dbSMichael R. Hines  cat > $TMPC <<EOF
18742da776dbSMichael R. Hines#include <rdma/rdma_cma.h>
18752da776dbSMichael R. Hinesint main(void) { return 0; }
18762da776dbSMichael R. HinesEOF
18772da776dbSMichael R. Hines  rdma_libs="-lrdmacm -libverbs"
18782da776dbSMichael R. Hines  if compile_prog "" "$rdma_libs" ; then
18792da776dbSMichael R. Hines    rdma="yes"
18802da776dbSMichael R. Hines    libs_softmmu="$libs_softmmu $rdma_libs"
18812da776dbSMichael R. Hines  else
18822da776dbSMichael R. Hines    if test "$rdma" = "yes" ; then
18832da776dbSMichael R. Hines        error_exit \
18842da776dbSMichael R. Hines            " OpenFabrics librdmacm/libibverbs not present." \
18852da776dbSMichael R. Hines            " Your options:" \
18862da776dbSMichael R. Hines            "  (1) Fast: Install infiniband packages from your distro." \
18872da776dbSMichael R. Hines            "  (2) Cleanest: Install libraries from www.openfabrics.org" \
18882da776dbSMichael R. Hines            "  (3) Also: Install softiwarp if you don't have RDMA hardware"
18892da776dbSMichael R. Hines    fi
18902da776dbSMichael R. Hines    rdma="no"
18912da776dbSMichael R. Hines  fi
18922da776dbSMichael R. Hinesfi
18932da776dbSMichael R. Hines
18942da776dbSMichael R. Hines##########################################
18957536ee4bSTim Hardeck# VNC TLS/WS detection
18967536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
1897ae6b5e5aSaliguori  cat > $TMPC <<EOF
1898ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1899ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1900ae6b5e5aSaliguoriEOF
1901a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1902a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
190352166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
19047536ee4bSTim Hardeck    if test "$vnc_tls" != "no" ; then
19051be10ad2SJuan Quintela      vnc_tls=yes
19067536ee4bSTim Hardeck    fi
19077536ee4bSTim Hardeck    if test "$vnc_ws" != "no" ; then
19087536ee4bSTim Hardeck      vnc_ws=yes
19097536ee4bSTim Hardeck    fi
1910a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1911ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
1912ae6b5e5aSaliguori  else
19131be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
19141be10ad2SJuan Quintela      feature_not_found "vnc-tls"
19151be10ad2SJuan Quintela    fi
19167536ee4bSTim Hardeck    if test "$vnc_ws" = "yes" ; then
19177536ee4bSTim Hardeck      feature_not_found "vnc-ws"
19187536ee4bSTim Hardeck    fi
19191be10ad2SJuan Quintela    vnc_tls=no
19207536ee4bSTim Hardeck    vnc_ws=no
19218d5d2d4cSths  fi
19228d5d2d4cSthsfi
19238d5d2d4cSths
19248d5d2d4cSths##########################################
19252f9606b3Saliguori# VNC SASL detection
1926821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
19272f9606b3Saliguori  cat > $TMPC <<EOF
19282f9606b3Saliguori#include <sasl/sasl.h>
19292f9606b3Saliguori#include <stdio.h>
19302f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
19312f9606b3SaliguoriEOF
19322f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
19332f9606b3Saliguori  vnc_sasl_cflags=""
19342f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
193552166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1936ea784e3bSJuan Quintela    vnc_sasl=yes
1937fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1938ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
19392f9606b3Saliguori  else
1940ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1941ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1942ea784e3bSJuan Quintela    fi
1943ea784e3bSJuan Quintela    vnc_sasl=no
19442f9606b3Saliguori  fi
19452f9606b3Saliguorifi
19462f9606b3Saliguori
19472f9606b3Saliguori##########################################
19482f6f5c7aSCorentin Chary# VNC JPEG detection
1949821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
19502f6f5c7aSCorentin Charycat > $TMPC <<EOF
19512f6f5c7aSCorentin Chary#include <stdio.h>
19522f6f5c7aSCorentin Chary#include <jpeglib.h>
19532f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
19542f6f5c7aSCorentin CharyEOF
19552f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
19562f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
19572f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
19582f6f5c7aSCorentin Chary    vnc_jpeg=yes
19592f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1960ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
19612f6f5c7aSCorentin Chary  else
19622f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
19632f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
19642f6f5c7aSCorentin Chary    fi
19652f6f5c7aSCorentin Chary    vnc_jpeg=no
19662f6f5c7aSCorentin Chary  fi
19672f6f5c7aSCorentin Charyfi
19682f6f5c7aSCorentin Chary
19692f6f5c7aSCorentin Chary##########################################
1970efe556adSCorentin Chary# VNC PNG detection
1971821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1972efe556adSCorentin Charycat > $TMPC <<EOF
1973efe556adSCorentin Chary//#include <stdio.h>
1974efe556adSCorentin Chary#include <png.h>
1975832ce9c2SScott Wood#include <stddef.h>
1976efe556adSCorentin Charyint main(void) {
1977efe556adSCorentin Chary    png_structp png_ptr;
1978efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
19797edc3fedSPeter Maydell    return png_ptr != 0;
1980efe556adSCorentin Chary}
1981efe556adSCorentin CharyEOF
198265d5d3f9SStefan Weil  if $pkg_config libpng --exists; then
1983ca871ec8SStefan Weil    vnc_png_cflags=`$pkg_config libpng --cflags`
1984ca871ec8SStefan Weil    vnc_png_libs=`$pkg_config libpng --libs`
19859af8025eSBrad  else
1986efe556adSCorentin Chary    vnc_png_cflags=""
1987efe556adSCorentin Chary    vnc_png_libs="-lpng"
19889af8025eSBrad  fi
1989efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1990efe556adSCorentin Chary    vnc_png=yes
1991efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
19929af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1993efe556adSCorentin Chary  else
1994efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1995efe556adSCorentin Chary      feature_not_found "vnc-png"
1996efe556adSCorentin Chary    fi
1997efe556adSCorentin Chary    vnc_png=no
1998efe556adSCorentin Chary  fi
1999efe556adSCorentin Charyfi
2000efe556adSCorentin Chary
2001efe556adSCorentin Chary##########################################
200276655d6dSaliguori# fnmatch() probe, used for ACL routines
200376655d6dSaliguorifnmatch="no"
200476655d6dSaliguoricat > $TMPC << EOF
200576655d6dSaliguori#include <fnmatch.h>
200676655d6dSaliguoriint main(void)
200776655d6dSaliguori{
200876655d6dSaliguori    fnmatch("foo", "foo", 0);
200976655d6dSaliguori    return 0;
201076655d6dSaliguori}
201176655d6dSaliguoriEOF
201252166aa0SJuan Quintelaif compile_prog "" "" ; then
201376655d6dSaliguori   fnmatch="yes"
201476655d6dSaliguorifi
201576655d6dSaliguori
201676655d6dSaliguori##########################################
2017ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
20182d16c8e9SPeter Maydell# Note that on some systems (notably MacOSX) no extra library
20192d16c8e9SPeter Maydell# need be linked to get the uuid functions.
2020ee682d27SStefan Weilif test "$uuid" != "no" ; then
2021ee682d27SStefan Weil  uuid_libs="-luuid"
2022ee682d27SStefan Weil  cat > $TMPC << EOF
2023ee682d27SStefan Weil#include <uuid/uuid.h>
2024ee682d27SStefan Weilint main(void)
2025ee682d27SStefan Weil{
2026ee682d27SStefan Weil    uuid_t my_uuid;
2027ee682d27SStefan Weil    uuid_generate(my_uuid);
2028ee682d27SStefan Weil    return 0;
2029ee682d27SStefan Weil}
2030ee682d27SStefan WeilEOF
20312d16c8e9SPeter Maydell  if compile_prog "" "" ; then
20322d16c8e9SPeter Maydell    uuid="yes"
20332d16c8e9SPeter Maydell  elif compile_prog "" "$uuid_libs" ; then
2034ee682d27SStefan Weil    uuid="yes"
2035ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
2036ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
2037ee682d27SStefan Weil  else
2038ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
2039ee682d27SStefan Weil      feature_not_found "uuid"
2040ee682d27SStefan Weil    fi
2041ee682d27SStefan Weil    uuid=no
2042ee682d27SStefan Weil  fi
2043ee682d27SStefan Weilfi
2044ee682d27SStefan Weil
20454f18b782SJeff Codyif test "$vhdx" = "yes" ; then
20464f18b782SJeff Cody    if test "$uuid" = "no" ; then
20474f18b782SJeff Cody        error_exit "uuid required for VHDX support"
20484f18b782SJeff Cody    fi
20494f18b782SJeff Codyelif test "$vhdx" != "no" ; then
20504f18b782SJeff Cody    if test "$uuid" = "yes" ; then
20514f18b782SJeff Cody        vhdx=yes
20524f18b782SJeff Cody    else
20534f18b782SJeff Cody        vhdx=no
20544f18b782SJeff Cody    fi
20554f18b782SJeff Codyfi
20564f18b782SJeff Cody
2057ee682d27SStefan Weil##########################################
2058dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
2059dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
2060dce512deSChristoph Hellwig  cat > $TMPC << EOF
2061ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
2062dce512deSChristoph Hellwig#include <xfs/xfs.h>
2063dce512deSChristoph Hellwigint main(void)
2064dce512deSChristoph Hellwig{
2065dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
2066dce512deSChristoph Hellwig    return 0;
2067dce512deSChristoph Hellwig}
2068dce512deSChristoph HellwigEOF
2069dce512deSChristoph Hellwig  if compile_prog "" "" ; then
2070dce512deSChristoph Hellwig    xfs="yes"
2071dce512deSChristoph Hellwig  else
2072dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
2073dce512deSChristoph Hellwig      feature_not_found "xfs"
2074dce512deSChristoph Hellwig    fi
2075dce512deSChristoph Hellwig    xfs=no
2076dce512deSChristoph Hellwig  fi
2077dce512deSChristoph Hellwigfi
2078dce512deSChristoph Hellwig
2079dce512deSChristoph Hellwig##########################################
20808a16d273Sths# vde libraries probe
2081dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
20824baae0acSJuan Quintela  vde_libs="-lvdeplug"
20838a16d273Sths  cat > $TMPC << EOF
20848a16d273Sths#include <libvdeplug.h>
20854a7f0e06Spbrookint main(void)
20864a7f0e06Spbrook{
20874a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
2088fea08e08SPeter Maydell    char s[] = "";
2089fea08e08SPeter Maydell    vde_open(s, s, &a);
20904a7f0e06Spbrook    return 0;
20914a7f0e06Spbrook}
20928a16d273SthsEOF
209352166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
20944baae0acSJuan Quintela    vde=yes
20958e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
20968e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
2097dfb278bdSJuan Quintela  else
2098dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
2099dfb278bdSJuan Quintela      feature_not_found "vde"
2100dfb278bdSJuan Quintela    fi
2101dfb278bdSJuan Quintela    vde=no
21028a16d273Sths  fi
21038a16d273Sthsfi
21048a16d273Sths
21058a16d273Sths##########################################
210658952137SVincenzo Maffione# netmap headers probe
210758952137SVincenzo Maffioneif test "$netmap" != "no" ; then
210858952137SVincenzo Maffione  cat > $TMPC << EOF
210958952137SVincenzo Maffione#include <inttypes.h>
211058952137SVincenzo Maffione#include <net/if.h>
211158952137SVincenzo Maffione#include <net/netmap.h>
211258952137SVincenzo Maffione#include <net/netmap_user.h>
211358952137SVincenzo Maffioneint main(void) { return 0; }
211458952137SVincenzo MaffioneEOF
211558952137SVincenzo Maffione  if compile_prog "" "" ; then
211658952137SVincenzo Maffione    netmap=yes
211758952137SVincenzo Maffione  else
211858952137SVincenzo Maffione    if test "$netmap" = "yes" ; then
211958952137SVincenzo Maffione      feature_not_found "netmap"
212058952137SVincenzo Maffione    fi
212158952137SVincenzo Maffione    netmap=no
212258952137SVincenzo Maffione  fi
212358952137SVincenzo Maffionefi
212458952137SVincenzo Maffione
212558952137SVincenzo Maffione##########################################
212647e98658SCorey Bryant# libcap-ng library probe
212747e98658SCorey Bryantif test "$cap_ng" != "no" ; then
212847e98658SCorey Bryant  cap_libs="-lcap-ng"
212947e98658SCorey Bryant  cat > $TMPC << EOF
213047e98658SCorey Bryant#include <cap-ng.h>
213147e98658SCorey Bryantint main(void)
213247e98658SCorey Bryant{
213347e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
213447e98658SCorey Bryant    return 0;
213547e98658SCorey Bryant}
213647e98658SCorey BryantEOF
213747e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
213847e98658SCorey Bryant    cap_ng=yes
213947e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
214047e98658SCorey Bryant  else
214147e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
214247e98658SCorey Bryant      feature_not_found "cap_ng"
214347e98658SCorey Bryant    fi
214447e98658SCorey Bryant    cap_ng=no
214547e98658SCorey Bryant  fi
214647e98658SCorey Bryantfi
214747e98658SCorey Bryant
214847e98658SCorey Bryant##########################################
2149c2de5c91Smalc# Sound support libraries probe
21508f28f3fbSths
2151c2de5c91Smalcaudio_drv_probe()
2152c2de5c91Smalc{
2153c2de5c91Smalc    drv=$1
2154c2de5c91Smalc    hdr=$2
2155c2de5c91Smalc    lib=$3
2156c2de5c91Smalc    exp=$4
2157c2de5c91Smalc    cfl=$5
21588f28f3fbSths        cat > $TMPC << EOF
2159c2de5c91Smalc#include <$hdr>
2160c2de5c91Smalcint main(void) { $exp }
21618f28f3fbSthsEOF
216252166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
21638f28f3fbSths        :
21648f28f3fbSths    else
216576ad07a4SPeter Maydell        error_exit "$drv check failed" \
216676ad07a4SPeter Maydell            "Make sure to have the $drv libs and headers installed."
21678f28f3fbSths    fi
2168c2de5c91Smalc}
2169c2de5c91Smalc
21702fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2171c2de5c91Smalcfor drv in $audio_drv_list; do
2172c2de5c91Smalc    case $drv in
2173c2de5c91Smalc    alsa)
2174c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
2175e35bcb0cSStefan Weil        "return snd_pcm_close((snd_pcm_t *)0);"
2176a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
2177c2de5c91Smalc    ;;
2178c2de5c91Smalc
2179c2de5c91Smalc    fmod)
2180c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
218176ad07a4SPeter Maydell        error_exit "You must specify path to FMOD library and headers" \
218276ad07a4SPeter Maydell            "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
21838f28f3fbSths    fi
2184c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2185a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
2186c2de5c91Smalc    ;;
2187c2de5c91Smalc
2188c2de5c91Smalc    esd)
2189c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2190a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
219167f86e8eSJuan Quintela    audio_pt_int="yes"
2192c2de5c91Smalc    ;;
2193b8e59f18Smalc
2194b8e59f18Smalc    pa)
2195a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2196a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2197a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
219867f86e8eSJuan Quintela    audio_pt_int="yes"
2199b8e59f18Smalc    ;;
2200b8e59f18Smalc
2201997e690aSJuan Quintela    coreaudio)
2202997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
2203997e690aSJuan Quintela    ;;
2204997e690aSJuan Quintela
2205a4bf6780SJuan Quintela    dsound)
2206a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2207d5631638Smalc      audio_win_int="yes"
2208a4bf6780SJuan Quintela    ;;
2209a4bf6780SJuan Quintela
2210a4bf6780SJuan Quintela    oss)
2211a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
2212a4bf6780SJuan Quintela    ;;
2213a4bf6780SJuan Quintela
2214a4bf6780SJuan Quintela    sdl|wav)
22152f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
22162f6a1ab0Sblueswir1    ;;
22172f6a1ab0Sblueswir1
2218d5631638Smalc    winwave)
2219d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
2220d5631638Smalc      audio_win_int="yes"
2221d5631638Smalc    ;;
2222d5631638Smalc
2223e4c63a6aSmalc    *)
22241c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
222576ad07a4SPeter Maydell        error_exit "Unknown driver '$drv' selected" \
222676ad07a4SPeter Maydell            "Possible drivers are: $audio_possible_drivers"
2227e4c63a6aSmalc    }
2228e4c63a6aSmalc    ;;
2229c2de5c91Smalc    esac
2230c2de5c91Smalcdone
22318f28f3fbSths
22324d3b6f6eSbalrog##########################################
22332e4d9fb1Saurel32# BrlAPI probe
22342e4d9fb1Saurel32
22354ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
2236eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
22372e4d9fb1Saurel32  cat > $TMPC << EOF
22382e4d9fb1Saurel32#include <brlapi.h>
2239832ce9c2SScott Wood#include <stddef.h>
22402e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
22412e4d9fb1Saurel32EOF
224252166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
22432e4d9fb1Saurel32    brlapi=yes
2244264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
22454ffcedb6SJuan Quintela  else
22464ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
22474ffcedb6SJuan Quintela      feature_not_found "brlapi"
22484ffcedb6SJuan Quintela    fi
22494ffcedb6SJuan Quintela    brlapi=no
2250eb82284fSJuan Quintela  fi
2251eb82284fSJuan Quintelafi
22522e4d9fb1Saurel32
22532e4d9fb1Saurel32##########################################
22544d3b6f6eSbalrog# curses probe
2255a3605bf6SMichael Tokarevif test "$curses" != "no" ; then
2256e095e2f3SStefan Weil  if test "$mingw32" = "yes" ; then
2257e095e2f3SStefan Weil    curses_list="-lpdcurses"
2258e095e2f3SStefan Weil  else
2259cfeda5f4SEd Maste    curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2260e095e2f3SStefan Weil  fi
2261c584a6d0SJuan Quintela  curses_found=no
22624d3b6f6eSbalrog  cat > $TMPC << EOF
22634d3b6f6eSbalrog#include <curses.h>
2264ef9a2524SStefan Weilint main(void) {
2265ef9a2524SStefan Weil  const char *s = curses_version();
2266ef9a2524SStefan Weil  resize_term(0, 0);
2267ef9a2524SStefan Weil  return s != 0;
2268ef9a2524SStefan Weil}
22694d3b6f6eSbalrogEOF
2270ecbe251fSVadim Evard  IFS=:
22714f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
2272ecbe251fSVadim Evard    unset IFS
22734f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
2274c584a6d0SJuan Quintela      curses_found=yes
22754f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
22764f78ef9aSJuan Quintela      break
22774d3b6f6eSbalrog    fi
22784f78ef9aSJuan Quintela  done
2279ecbe251fSVadim Evard  unset IFS
2280c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
2281c584a6d0SJuan Quintela    curses=yes
2282c584a6d0SJuan Quintela  else
2283c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
2284c584a6d0SJuan Quintela      feature_not_found "curses"
2285c584a6d0SJuan Quintela    fi
2286c584a6d0SJuan Quintela    curses=no
2287c584a6d0SJuan Quintela  fi
22884f78ef9aSJuan Quintelafi
22894d3b6f6eSbalrog
2290414f0dabSblueswir1##########################################
2291769ce76dSAlexander Graf# curl probe
2292a3605bf6SMichael Tokarevif test "$curl" != "no" ; then
229365d5d3f9SStefan Weil  if $pkg_config libcurl --exists; then
2294a8bd70adSPaolo Bonzini    curlconfig="$pkg_config libcurl"
22954e2b0658SPaolo Bonzini  else
22964e2b0658SPaolo Bonzini    curlconfig=curl-config
22974e2b0658SPaolo Bonzini  fi
2298769ce76dSAlexander Graf  cat > $TMPC << EOF
2299769ce76dSAlexander Graf#include <curl/curl.h>
23000b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2301769ce76dSAlexander GrafEOF
23024e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
23034e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2304b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2305769ce76dSAlexander Graf    curl=yes
2306f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2307f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2308788c8196SJuan Quintela  else
2309788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2310788c8196SJuan Quintela      feature_not_found "curl"
2311788c8196SJuan Quintela    fi
2312788c8196SJuan Quintela    curl=no
2313769ce76dSAlexander Graf  fi
2314769ce76dSAlexander Graffi # test "$curl"
2315769ce76dSAlexander Graf
2316769ce76dSAlexander Graf##########################################
2317fb599c9aSbalrog# bluez support probe
2318a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2319e820e3f4Sbalrog  cat > $TMPC << EOF
2320e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2321e820e3f4Sbalrogint main(void) { return bt_error(0); }
2322e820e3f4SbalrogEOF
2323a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2324a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
232552166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2326a20a6f46SJuan Quintela    bluez=yes
2327e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2328e820e3f4Sbalrog  else
2329a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2330a20a6f46SJuan Quintela      feature_not_found "bluez"
2331a20a6f46SJuan Quintela    fi
2332e820e3f4Sbalrog    bluez="no"
2333e820e3f4Sbalrog  fi
2334fb599c9aSbalrogfi
2335fb599c9aSbalrog
2336fb599c9aSbalrog##########################################
2337e18df141SAnthony Liguori# glib support probe
2338a52d28afSPaolo Bonzini
2339a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2340a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2341a52d28afSPaolo Bonzini    glib_req_ver=2.20
2342a52d28afSPaolo Bonzinielse
2343a52d28afSPaolo Bonzini    glib_req_ver=2.12
2344a52d28afSPaolo Bonzinifi
234565d5d3f9SStefan Weilif $pkg_config --atleast-version=$glib_req_ver gthread-2.0; then
2346ca871ec8SStefan Weil    glib_cflags=`$pkg_config --cflags gthread-2.0`
2347ca871ec8SStefan Weil    glib_libs=`$pkg_config --libs gthread-2.0`
234814015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2349957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2350e18df141SAnthony Liguorielse
235176ad07a4SPeter Maydell    error_exit "glib-$glib_req_ver required to compile QEMU"
2352e18df141SAnthony Liguorifi
2353e18df141SAnthony Liguori
2354e18df141SAnthony Liguori##########################################
2355e2134eb9SGerd Hoffmann# pixman support probe
2356e2134eb9SGerd Hoffmann
2357e2134eb9SGerd Hoffmannif test "$pixman" = ""; then
235874880fe2SRobert Schiele  if test "$want_tools" = "no" -a "$softmmu" = "no"; then
235974880fe2SRobert Schiele    pixman="none"
236074880fe2SRobert Schiele  elif $pkg_config pixman-1 > /dev/null 2>&1; then
2361e2134eb9SGerd Hoffmann    pixman="system"
2362e2134eb9SGerd Hoffmann  else
2363e2134eb9SGerd Hoffmann    pixman="internal"
2364e2134eb9SGerd Hoffmann  fi
2365e2134eb9SGerd Hoffmannfi
236674880fe2SRobert Schieleif test "$pixman" = "none"; then
236774880fe2SRobert Schiele  if test "$want_tools" != "no" -o "$softmmu" != "no"; then
236876ad07a4SPeter Maydell    error_exit "pixman disabled but system emulation or tools build" \
236976ad07a4SPeter Maydell        "enabled.  You can turn off pixman only if you also" \
237076ad07a4SPeter Maydell        "disable all system emulation targets and the tools" \
237176ad07a4SPeter Maydell        "build with '--disable-tools --disable-system'."
237274880fe2SRobert Schiele  fi
237374880fe2SRobert Schiele  pixman_cflags=
237474880fe2SRobert Schiele  pixman_libs=
237574880fe2SRobert Schieleelif test "$pixman" = "system"; then
2376ca871ec8SStefan Weil  pixman_cflags=`$pkg_config --cflags pixman-1`
2377ca871ec8SStefan Weil  pixman_libs=`$pkg_config --libs pixman-1`
2378e2134eb9SGerd Hoffmannelse
2379e2134eb9SGerd Hoffmann  if test ! -d ${source_path}/pixman/pixman; then
238076ad07a4SPeter Maydell    error_exit "pixman not present. Your options:" \
238176ad07a4SPeter Maydell        "  (1) Preferred: Install the pixman devel package (any recent" \
238276ad07a4SPeter Maydell        "      distro should have packages as Xorg needs pixman too)." \
238376ad07a4SPeter Maydell        "  (2) Fetch the pixman submodule, using:" \
238476ad07a4SPeter Maydell        "      git submodule update --init pixman"
2385e2134eb9SGerd Hoffmann  fi
23865ca9388aSGerd Hoffmann  mkdir -p pixman/pixman
23875ca9388aSGerd Hoffmann  pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
23885ca9388aSGerd Hoffmann  pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2389e2134eb9SGerd Hoffmannfi
2390e2134eb9SGerd Hoffmann
2391e2134eb9SGerd Hoffmann##########################################
239217bff52bSM. Mohan Kumar# libcap probe
239317bff52bSM. Mohan Kumar
239417bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
239517bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
239617bff52bSM. Mohan Kumar#include <stdio.h>
239717bff52bSM. Mohan Kumar#include <sys/capability.h>
2398cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
239917bff52bSM. Mohan KumarEOF
240017bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
240117bff52bSM. Mohan Kumar    cap=yes
240217bff52bSM. Mohan Kumar  else
240317bff52bSM. Mohan Kumar    cap=no
240417bff52bSM. Mohan Kumar  fi
240517bff52bSM. Mohan Kumarfi
240617bff52bSM. Mohan Kumar
240717bff52bSM. Mohan Kumar##########################################
2408e5d355d1Saliguori# pthread probe
24094b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
24103c529d93Saliguori
2411e5d355d1Saliguoripthread=no
2412414f0dabSblueswir1cat > $TMPC << EOF
24133c529d93Saliguori#include <pthread.h>
24147a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
24157a42bbe4SStefan Weilint main(void) {
24167a42bbe4SStefan Weil  pthread_t thread;
24177a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
24187a42bbe4SStefan Weil  return 0;
24197a42bbe4SStefan Weil}
2420414f0dabSblueswir1EOF
2421bd00d539SAndreas Färberif compile_prog "" "" ; then
2422bd00d539SAndreas Färber  pthread=yes
2423bd00d539SAndreas Färberelse
2424de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
242552166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2426e5d355d1Saliguori      pthread=yes
2427e3c56761SPeter Portante      found=no
2428e3c56761SPeter Portante      for lib_entry in $LIBS; do
2429e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2430e3c56761SPeter Portante          found=yes
2431e3c56761SPeter Portante          break
2432e3c56761SPeter Portante        fi
2433e3c56761SPeter Portante      done
2434e3c56761SPeter Portante      if test "$found" = "no"; then
24355572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2436e3c56761SPeter Portante      fi
2437de65fe0fSSebastian Herbszt      break
2438414f0dabSblueswir1    fi
2439de65fe0fSSebastian Herbszt  done
2440bd00d539SAndreas Färberfi
2441414f0dabSblueswir1
24424617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
244376ad07a4SPeter Maydell  error_exit "pthread check failed" \
244476ad07a4SPeter Maydell      "Make sure to have the pthread libs and headers installed."
2445e5d355d1Saliguorifi
2446e5d355d1Saliguori
2447bf9298b9Saliguori##########################################
2448f27aaf4bSChristian Brunner# rbd probe
2449f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2450f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2451f27aaf4bSChristian Brunner#include <stdio.h>
2452ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2453f27aaf4bSChristian Brunnerint main(void) {
2454ad32e9c0SJosh Durgin    rados_t cluster;
2455ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2456f27aaf4bSChristian Brunner    return 0;
2457f27aaf4bSChristian Brunner}
2458f27aaf4bSChristian BrunnerEOF
2459ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2460f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2461f27aaf4bSChristian Brunner    rbd=yes
2462f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2463f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2464f27aaf4bSChristian Brunner  else
2465f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2466f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2467f27aaf4bSChristian Brunner    fi
2468f27aaf4bSChristian Brunner    rbd=no
2469f27aaf4bSChristian Brunner  fi
2470f27aaf4bSChristian Brunnerfi
2471f27aaf4bSChristian Brunner
2472f27aaf4bSChristian Brunner##########################################
24730a12ec87SRichard W.M. Jones# libssh2 probe
24744fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8
24750a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then
247665d5d3f9SStefan Weil  if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
24770a12ec87SRichard W.M. Jones    libssh2_cflags=`$pkg_config libssh2 --cflags`
24780a12ec87SRichard W.M. Jones    libssh2_libs=`$pkg_config libssh2 --libs`
24790a12ec87SRichard W.M. Jones    libssh2=yes
24800a12ec87SRichard W.M. Jones    libs_tools="$libssh2_libs $libs_tools"
24810a12ec87SRichard W.M. Jones    libs_softmmu="$libssh2_libs $libs_softmmu"
24820a12ec87SRichard W.M. Jones    QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags"
24830a12ec87SRichard W.M. Jones  else
24840a12ec87SRichard W.M. Jones    if test "$libssh2" = "yes" ; then
24854fc16838SRichard W.M. Jones      error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
24860a12ec87SRichard W.M. Jones    fi
24870a12ec87SRichard W.M. Jones    libssh2=no
24880a12ec87SRichard W.M. Jones  fi
24890a12ec87SRichard W.M. Jonesfi
24900a12ec87SRichard W.M. Jones
24910a12ec87SRichard W.M. Jones##########################################
24929a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe
24939a2d462eSRichard W.M. Jones
24949a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then
24959a2d462eSRichard W.M. Jones  cat > $TMPC <<EOF
24969a2d462eSRichard W.M. Jones#include <stdio.h>
24979a2d462eSRichard W.M. Jones#include <libssh2.h>
24989a2d462eSRichard W.M. Jones#include <libssh2_sftp.h>
24999a2d462eSRichard W.M. Jonesint main(void) {
25009a2d462eSRichard W.M. Jones    LIBSSH2_SESSION *session;
25019a2d462eSRichard W.M. Jones    LIBSSH2_SFTP *sftp;
25029a2d462eSRichard W.M. Jones    LIBSSH2_SFTP_HANDLE *sftp_handle;
25039a2d462eSRichard W.M. Jones    session = libssh2_session_init ();
25049a2d462eSRichard W.M. Jones    sftp = libssh2_sftp_init (session);
25059a2d462eSRichard W.M. Jones    sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
25069a2d462eSRichard W.M. Jones    libssh2_sftp_fsync (sftp_handle);
25079a2d462eSRichard W.M. Jones    return 0;
25089a2d462eSRichard W.M. Jones}
25099a2d462eSRichard W.M. JonesEOF
25109a2d462eSRichard W.M. Jones  # libssh2_cflags/libssh2_libs defined in previous test.
25119a2d462eSRichard W.M. Jones  if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
25129a2d462eSRichard W.M. Jones    QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
25139a2d462eSRichard W.M. Jones  fi
25149a2d462eSRichard W.M. Jonesfi
25159a2d462eSRichard W.M. Jones
25169a2d462eSRichard W.M. Jones##########################################
25175c6c3a6cSChristoph Hellwig# linux-aio probe
25185c6c3a6cSChristoph Hellwig
25195c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
25205c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
25215c6c3a6cSChristoph Hellwig#include <libaio.h>
25225c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2523832ce9c2SScott Wood#include <stddef.h>
25245c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
25255c6c3a6cSChristoph HellwigEOF
25265c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
25275c6c3a6cSChristoph Hellwig    linux_aio=yes
2528048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2529048d179fSPaul Brook    libs_tools="$libs_tools -laio"
25305c6c3a6cSChristoph Hellwig  else
25315c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
25325c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
25335c6c3a6cSChristoph Hellwig    fi
25343cfcae3cSLuiz Capitulino    linux_aio=no
25355c6c3a6cSChristoph Hellwig  fi
25365c6c3a6cSChristoph Hellwigfi
25375c6c3a6cSChristoph Hellwig
25385c6c3a6cSChristoph Hellwig##########################################
25393b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux
25403b8acc11SPaolo Bonzini
25413b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
25423b8acc11SPaolo Bonzini  tpm_passthrough=$tpm
25433b8acc11SPaolo Bonzinielse
25443b8acc11SPaolo Bonzini  tpm_passthrough=no
25453b8acc11SPaolo Bonzinifi
25463b8acc11SPaolo Bonzini
25473b8acc11SPaolo Bonzini##########################################
2548583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio
2549583f6e7bSStefan Hajnoczi
2550583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \
2551583f6e7bSStefan Hajnoczi	"$linux_aio" != "yes" ; then
255276ad07a4SPeter Maydell  error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2553583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then
2554583f6e7bSStefan Hajnoczi  virtio_blk_data_plane=$linux_aio
2555583f6e7bSStefan Hajnoczifi
2556583f6e7bSStefan Hajnoczi
2557583f6e7bSStefan Hajnoczi##########################################
2558758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2559758e8e38SVenkateswararao Jujjuri (JV)
2560758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2561758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2562758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2563758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2564f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2565f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2566f2338fb4SPavel Borzenkov#else
25674f26f2b6SAvi Kivity#include <sys/xattr.h>
2568f2338fb4SPavel Borzenkov#endif
2569758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2570758e8e38SVenkateswararao Jujjuri (JV)EOF
25714f26f2b6SAvi Kivity  if compile_prog "" "" ; then
25724f26f2b6SAvi Kivity    attr=yes
25734f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2574f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2575758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2576758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
25774f26f2b6SAvi Kivity    libattr=yes
2578758e8e38SVenkateswararao Jujjuri (JV)  else
2579758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2580758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2581758e8e38SVenkateswararao Jujjuri (JV)    fi
2582758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2583758e8e38SVenkateswararao Jujjuri (JV)  fi
2584758e8e38SVenkateswararao Jujjuri (JV)fi
2585758e8e38SVenkateswararao Jujjuri (JV)
2586758e8e38SVenkateswararao Jujjuri (JV)##########################################
2587bf9298b9Saliguori# iovec probe
2588bf9298b9Saliguoricat > $TMPC <<EOF
2589db34f0b3Sblueswir1#include <sys/types.h>
2590bf9298b9Saliguori#include <sys/uio.h>
2591db34f0b3Sblueswir1#include <unistd.h>
2592f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2593bf9298b9SaliguoriEOF
2594bf9298b9Saliguoriiovec=no
259552166aa0SJuan Quintelaif compile_prog "" "" ; then
2596bf9298b9Saliguori  iovec=yes
2597bf9298b9Saliguorifi
2598bf9298b9Saliguori
2599f652e6afSaurel32##########################################
2600ceb42de8Saliguori# preadv probe
2601ceb42de8Saliguoricat > $TMPC <<EOF
2602ceb42de8Saliguori#include <sys/types.h>
2603ceb42de8Saliguori#include <sys/uio.h>
2604ceb42de8Saliguori#include <unistd.h>
2605c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); }
2606ceb42de8SaliguoriEOF
2607ceb42de8Saliguoripreadv=no
260852166aa0SJuan Quintelaif compile_prog "" "" ; then
2609ceb42de8Saliguori  preadv=yes
2610ceb42de8Saliguorifi
2611ceb42de8Saliguori
2612ceb42de8Saliguori##########################################
2613f652e6afSaurel32# fdt probe
2614e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures,
2615e169e1e1SPeter Maydell# so insist on it if we're building those system emulators.
2616e169e1e1SPeter Maydellfdt_required=no
2617e169e1e1SPeter Maydellfor target in $target_list; do
2618e169e1e1SPeter Maydell  case $target in
26196a49fa95SAlexander Graf    aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
2620e169e1e1SPeter Maydell      fdt_required=yes
2621e169e1e1SPeter Maydell    ;;
2622e169e1e1SPeter Maydell  esac
2623e169e1e1SPeter Maydelldone
2624e169e1e1SPeter Maydell
2625e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then
2626e169e1e1SPeter Maydell  if test "$fdt" = "no"; then
2627e169e1e1SPeter Maydell    error_exit "fdt disabled but some requested targets require it." \
2628e169e1e1SPeter Maydell      "You can turn off fdt only if you also disable all the system emulation" \
2629e169e1e1SPeter Maydell      "targets which need it (by specifying a cut down --target-list)."
2630e169e1e1SPeter Maydell  fi
2631e169e1e1SPeter Maydell  fdt=yes
2632e169e1e1SPeter Maydellfi
2633e169e1e1SPeter Maydell
26342df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2635b41af4baSJuan Quintela  fdt_libs="-lfdt"
263696ce6545SPeter Crosthwaite  # explicitly check for libfdt_env.h as it is missing in some stable installs
2637f652e6afSaurel32  cat > $TMPC << EOF
263896ce6545SPeter Crosthwaite#include <libfdt_env.h>
2639f652e6afSaurel32int main(void) { return 0; }
2640f652e6afSaurel32EOF
264152166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2642a540f158SPeter Crosthwaite    # system DTC is good - use it
2643f652e6afSaurel32    fdt=yes
2644a540f158SPeter Crosthwaite  elif test -d ${source_path}/dtc/libfdt ; then
2645a540f158SPeter Crosthwaite    # have submodule DTC - use it
2646a540f158SPeter Crosthwaite    fdt=yes
2647a540f158SPeter Crosthwaite    dtc_internal="yes"
2648a540f158SPeter Crosthwaite    mkdir -p dtc
2649a540f158SPeter Crosthwaite    if [ "$source_path" != `pwd` ] ; then
2650a540f158SPeter Crosthwaite       symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2651a540f158SPeter Crosthwaite       symlink "$source_path/dtc/scripts" "dtc/scripts"
26522df87df7SJuan Quintela    fi
2653a540f158SPeter Crosthwaite    fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2654a540f158SPeter Crosthwaite    fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2655a540f158SPeter Crosthwaite  elif test "$fdt" = "yes" ; then
2656a540f158SPeter Crosthwaite    # have neither and want - prompt for system/submodule install
2657f2c4ddd9SAndreas Färber    error_exit "DTC not present. Your options:" \
2658a540f158SPeter Crosthwaite        "  (1) Preferred: Install the DTC devel package" \
2659a540f158SPeter Crosthwaite        "  (2) Fetch the DTC submodule, using:" \
2660a540f158SPeter Crosthwaite        "      git submodule update --init dtc"
2661a540f158SPeter Crosthwaite  else
2662a540f158SPeter Crosthwaite    # don't have and don't want
2663de3a354aSMichael Walle    fdt_libs=
26642df87df7SJuan Quintela    fdt=no
2665f652e6afSaurel32  fi
2666f652e6afSaurel32fi
2667f652e6afSaurel32
2668a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs"
2669a540f158SPeter Crosthwaite
267020ff075bSMichael Walle##########################################
2671b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2
2672b1e5fff4SMichael Walleif test "$glx" != "no" ; then
2673b1e5fff4SMichael Walle  glx_libs="-lGL -lX11"
267420ff075bSMichael Walle  cat > $TMPC << EOF
267520ff075bSMichael Walle#include <X11/Xlib.h>
267620ff075bSMichael Walle#include <GL/gl.h>
267720ff075bSMichael Walle#include <GL/glx.h>
2678d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
267920ff075bSMichael WalleEOF
2680d3fcbb16SMichael Walle  if compile_prog "" "-lGL -lX11" ; then
2681b1e5fff4SMichael Walle    glx=yes
268220ff075bSMichael Walle  else
2683b1e5fff4SMichael Walle    if test "$glx" = "yes" ; then
2684b1e5fff4SMichael Walle      feature_not_found "glx"
268520ff075bSMichael Walle    fi
2686b1e5fff4SMichael Walle    glx_libs=
2687b1e5fff4SMichael Walle    glx=no
268820ff075bSMichael Walle  fi
268920ff075bSMichael Wallefi
269020ff075bSMichael Walle
2691eb100396SBharata B Rao##########################################
2692eb100396SBharata B Rao# glusterfs probe
2693eb100396SBharata B Raoif test "$glusterfs" != "no" ; then
269465d5d3f9SStefan Weil  if $pkg_config --atleast-version=3 glusterfs-api; then
2695e01bee08SBharata B Rao    glusterfs="yes"
2696ca871ec8SStefan Weil    glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2697ca871ec8SStefan Weil    glusterfs_libs=`$pkg_config --libs glusterfs-api`
2698e01bee08SBharata B Rao    CFLAGS="$CFLAGS $glusterfs_cflags"
2699eb100396SBharata B Rao    libs_tools="$glusterfs_libs $libs_tools"
2700eb100396SBharata B Rao    libs_softmmu="$glusterfs_libs $libs_softmmu"
270165d5d3f9SStefan Weil    if $pkg_config --atleast-version=5 glusterfs-api; then
27020c14fb47SBharata B Rao      glusterfs_discard="yes"
27030c14fb47SBharata B Rao    fi
2704eb100396SBharata B Rao  else
2705eb100396SBharata B Rao    if test "$glusterfs" = "yes" ; then
2706eb100396SBharata B Rao      feature_not_found "GlusterFS backend support"
2707eb100396SBharata B Rao    fi
2708e01bee08SBharata B Rao    glusterfs="no"
2709eb100396SBharata B Rao  fi
2710eb100396SBharata B Raofi
2711eb100396SBharata B Rao
271239386ac7Saurel32# Check for inotify functions when we are building linux-user
27133b3f24adSaurel32# emulator.  This is done because older glibc versions don't
27143b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
27153b3f24adSaurel32# don't provide them even if kernel supports them.
27163b3f24adSaurel32#
27173b3f24adSaurel32inotify=no
27183b3f24adSaurel32cat > $TMPC << EOF
27193b3f24adSaurel32#include <sys/inotify.h>
27203b3f24adSaurel32
27213b3f24adSaurel32int
27223b3f24adSaurel32main(void)
27233b3f24adSaurel32{
27243b3f24adSaurel32	/* try to start inotify */
27258690e420Saurel32	return inotify_init();
27263b3f24adSaurel32}
27273b3f24adSaurel32EOF
272852166aa0SJuan Quintelaif compile_prog "" "" ; then
27293b3f24adSaurel32  inotify=yes
27303b3f24adSaurel32fi
27313b3f24adSaurel32
2732c05c7a73SRiku Voipioinotify1=no
2733c05c7a73SRiku Voipiocat > $TMPC << EOF
2734c05c7a73SRiku Voipio#include <sys/inotify.h>
2735c05c7a73SRiku Voipio
2736c05c7a73SRiku Voipioint
2737c05c7a73SRiku Voipiomain(void)
2738c05c7a73SRiku Voipio{
2739c05c7a73SRiku Voipio    /* try to start inotify */
2740c05c7a73SRiku Voipio    return inotify_init1(0);
2741c05c7a73SRiku Voipio}
2742c05c7a73SRiku VoipioEOF
2743c05c7a73SRiku Voipioif compile_prog "" "" ; then
2744c05c7a73SRiku Voipio  inotify1=yes
2745c05c7a73SRiku Voipiofi
2746c05c7a73SRiku Voipio
2747ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2748ebc996f3SRiku Voipioutimens=no
2749ebc996f3SRiku Voipiocat > $TMPC << EOF
2750ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2751ebc996f3SRiku Voipio#include <stddef.h>
2752ebc996f3SRiku Voipio#include <fcntl.h>
27533014ee00SPeter Maydell#include <sys/stat.h>
2754ebc996f3SRiku Voipio
2755ebc996f3SRiku Voipioint main(void)
2756ebc996f3SRiku Voipio{
2757ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2758ebc996f3SRiku Voipio    futimens(0, NULL);
2759ebc996f3SRiku Voipio    return 0;
2760ebc996f3SRiku Voipio}
2761ebc996f3SRiku VoipioEOF
276252166aa0SJuan Quintelaif compile_prog "" "" ; then
2763ebc996f3SRiku Voipio  utimens=yes
2764ebc996f3SRiku Voipiofi
2765ebc996f3SRiku Voipio
2766099d6b0fSRiku Voipio# check if pipe2 is there
2767099d6b0fSRiku Voipiopipe2=no
2768099d6b0fSRiku Voipiocat > $TMPC << EOF
2769099d6b0fSRiku Voipio#include <unistd.h>
2770099d6b0fSRiku Voipio#include <fcntl.h>
2771099d6b0fSRiku Voipio
2772099d6b0fSRiku Voipioint main(void)
2773099d6b0fSRiku Voipio{
2774099d6b0fSRiku Voipio    int pipefd[2];
27759bca8162SBruce Rogers    return pipe2(pipefd, O_CLOEXEC);
2776099d6b0fSRiku Voipio}
2777099d6b0fSRiku VoipioEOF
277852166aa0SJuan Quintelaif compile_prog "" "" ; then
2779099d6b0fSRiku Voipio  pipe2=yes
2780099d6b0fSRiku Voipiofi
2781099d6b0fSRiku Voipio
278240ff6d7eSKevin Wolf# check if accept4 is there
278340ff6d7eSKevin Wolfaccept4=no
278440ff6d7eSKevin Wolfcat > $TMPC << EOF
278540ff6d7eSKevin Wolf#include <sys/socket.h>
278640ff6d7eSKevin Wolf#include <stddef.h>
278740ff6d7eSKevin Wolf
278840ff6d7eSKevin Wolfint main(void)
278940ff6d7eSKevin Wolf{
279040ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
279140ff6d7eSKevin Wolf    return 0;
279240ff6d7eSKevin Wolf}
279340ff6d7eSKevin WolfEOF
279440ff6d7eSKevin Wolfif compile_prog "" "" ; then
279540ff6d7eSKevin Wolf  accept4=yes
279640ff6d7eSKevin Wolffi
279740ff6d7eSKevin Wolf
27983ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
27993ce34dfbSvibisreenivasansplice=no
28003ce34dfbSvibisreenivasancat > $TMPC << EOF
28013ce34dfbSvibisreenivasan#include <unistd.h>
28023ce34dfbSvibisreenivasan#include <fcntl.h>
28033ce34dfbSvibisreenivasan#include <limits.h>
28043ce34dfbSvibisreenivasan
28053ce34dfbSvibisreenivasanint main(void)
28063ce34dfbSvibisreenivasan{
280766ea0f22SStefan Weil    int len, fd = 0;
28083ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
28093ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
28103ce34dfbSvibisreenivasan    return 0;
28113ce34dfbSvibisreenivasan}
28123ce34dfbSvibisreenivasanEOF
281352166aa0SJuan Quintelaif compile_prog "" "" ; then
28143ce34dfbSvibisreenivasan  splice=yes
28153ce34dfbSvibisreenivasanfi
28163ce34dfbSvibisreenivasan
2817dcc38d1cSMarcelo Tosatti##########################################
2818dcc38d1cSMarcelo Tosatti# signalfd probe
2819dcc38d1cSMarcelo Tosattisignalfd="no"
2820dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2821dcc38d1cSMarcelo Tosatti#include <unistd.h>
2822dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2823dcc38d1cSMarcelo Tosatti#include <signal.h>
2824dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2825dcc38d1cSMarcelo TosattiEOF
2826dcc38d1cSMarcelo Tosatti
2827dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2828dcc38d1cSMarcelo Tosatti  signalfd=yes
2829dcc38d1cSMarcelo Tosattifi
2830dcc38d1cSMarcelo Tosatti
2831c2882b96SRiku Voipio# check if eventfd is supported
2832c2882b96SRiku Voipioeventfd=no
2833c2882b96SRiku Voipiocat > $TMPC << EOF
2834c2882b96SRiku Voipio#include <sys/eventfd.h>
2835c2882b96SRiku Voipio
2836c2882b96SRiku Voipioint main(void)
2837c2882b96SRiku Voipio{
283855cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2839c2882b96SRiku Voipio}
2840c2882b96SRiku VoipioEOF
2841c2882b96SRiku Voipioif compile_prog "" "" ; then
2842c2882b96SRiku Voipio  eventfd=yes
2843c2882b96SRiku Voipiofi
2844c2882b96SRiku Voipio
2845d0927938SUlrich Hecht# check for fallocate
2846d0927938SUlrich Hechtfallocate=no
2847d0927938SUlrich Hechtcat > $TMPC << EOF
2848d0927938SUlrich Hecht#include <fcntl.h>
2849d0927938SUlrich Hecht
2850d0927938SUlrich Hechtint main(void)
2851d0927938SUlrich Hecht{
2852d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2853d0927938SUlrich Hecht    return 0;
2854d0927938SUlrich Hecht}
2855d0927938SUlrich HechtEOF
28568fb03151SPeter Maydellif compile_prog "" "" ; then
2857d0927938SUlrich Hecht  fallocate=yes
2858d0927938SUlrich Hechtfi
2859d0927938SUlrich Hecht
28603d4fa43eSKusanagi Kouichi# check for fallocate hole punching
28613d4fa43eSKusanagi Kouichifallocate_punch_hole=no
28623d4fa43eSKusanagi Kouichicat > $TMPC << EOF
28633d4fa43eSKusanagi Kouichi#include <fcntl.h>
28643d4fa43eSKusanagi Kouichi#include <linux/falloc.h>
28653d4fa43eSKusanagi Kouichi
28663d4fa43eSKusanagi Kouichiint main(void)
28673d4fa43eSKusanagi Kouichi{
28683d4fa43eSKusanagi Kouichi    fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
28693d4fa43eSKusanagi Kouichi    return 0;
28703d4fa43eSKusanagi Kouichi}
28713d4fa43eSKusanagi KouichiEOF
28723d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then
28733d4fa43eSKusanagi Kouichi  fallocate_punch_hole=yes
28743d4fa43eSKusanagi Kouichifi
28753d4fa43eSKusanagi Kouichi
2876c727f47dSPeter Maydell# check for sync_file_range
2877c727f47dSPeter Maydellsync_file_range=no
2878c727f47dSPeter Maydellcat > $TMPC << EOF
2879c727f47dSPeter Maydell#include <fcntl.h>
2880c727f47dSPeter Maydell
2881c727f47dSPeter Maydellint main(void)
2882c727f47dSPeter Maydell{
2883c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2884c727f47dSPeter Maydell    return 0;
2885c727f47dSPeter Maydell}
2886c727f47dSPeter MaydellEOF
28878fb03151SPeter Maydellif compile_prog "" "" ; then
2888c727f47dSPeter Maydell  sync_file_range=yes
2889c727f47dSPeter Maydellfi
2890c727f47dSPeter Maydell
2891dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2892dace20dcSPeter Maydellfiemap=no
2893dace20dcSPeter Maydellcat > $TMPC << EOF
2894dace20dcSPeter Maydell#include <sys/ioctl.h>
2895dace20dcSPeter Maydell#include <linux/fs.h>
2896dace20dcSPeter Maydell#include <linux/fiemap.h>
2897dace20dcSPeter Maydell
2898dace20dcSPeter Maydellint main(void)
2899dace20dcSPeter Maydell{
2900dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2901dace20dcSPeter Maydell    return 0;
2902dace20dcSPeter Maydell}
2903dace20dcSPeter MaydellEOF
29048fb03151SPeter Maydellif compile_prog "" "" ; then
2905dace20dcSPeter Maydell  fiemap=yes
2906dace20dcSPeter Maydellfi
2907dace20dcSPeter Maydell
2908d0927938SUlrich Hecht# check for dup3
2909d0927938SUlrich Hechtdup3=no
2910d0927938SUlrich Hechtcat > $TMPC << EOF
2911d0927938SUlrich Hecht#include <unistd.h>
2912d0927938SUlrich Hecht
2913d0927938SUlrich Hechtint main(void)
2914d0927938SUlrich Hecht{
2915d0927938SUlrich Hecht    dup3(0, 0, 0);
2916d0927938SUlrich Hecht    return 0;
2917d0927938SUlrich Hecht}
2918d0927938SUlrich HechtEOF
291978f5d726SJan Kiszkaif compile_prog "" "" ; then
2920d0927938SUlrich Hecht  dup3=yes
2921d0927938SUlrich Hechtfi
2922d0927938SUlrich Hecht
29234e0c6529SAlex Bligh# check for ppoll support
29244e0c6529SAlex Blighppoll=no
29254e0c6529SAlex Blighcat > $TMPC << EOF
29264e0c6529SAlex Bligh#include <poll.h>
29274e0c6529SAlex Bligh
29284e0c6529SAlex Blighint main(void)
29294e0c6529SAlex Bligh{
29304e0c6529SAlex Bligh    struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
29314e0c6529SAlex Bligh    ppoll(&pfd, 1, 0, 0);
29324e0c6529SAlex Bligh    return 0;
29334e0c6529SAlex Bligh}
29344e0c6529SAlex BlighEOF
29354e0c6529SAlex Blighif compile_prog "" "" ; then
29364e0c6529SAlex Bligh  ppoll=yes
29374e0c6529SAlex Blighfi
29384e0c6529SAlex Bligh
2939cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support
2940cd758dd0SAlex Blighprctl_pr_set_timerslack=no
2941cd758dd0SAlex Blighcat > $TMPC << EOF
2942cd758dd0SAlex Bligh#include <sys/prctl.h>
2943cd758dd0SAlex Bligh
2944cd758dd0SAlex Blighint main(void)
2945cd758dd0SAlex Bligh{
2946cd758dd0SAlex Bligh    prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
2947cd758dd0SAlex Bligh    return 0;
2948cd758dd0SAlex Bligh}
2949cd758dd0SAlex BlighEOF
2950cd758dd0SAlex Blighif compile_prog "" "" ; then
2951cd758dd0SAlex Bligh  prctl_pr_set_timerslack=yes
2952cd758dd0SAlex Blighfi
2953cd758dd0SAlex Bligh
29543b6edd16SPeter Maydell# check for epoll support
29553b6edd16SPeter Maydellepoll=no
29563b6edd16SPeter Maydellcat > $TMPC << EOF
29573b6edd16SPeter Maydell#include <sys/epoll.h>
29583b6edd16SPeter Maydell
29593b6edd16SPeter Maydellint main(void)
29603b6edd16SPeter Maydell{
29613b6edd16SPeter Maydell    epoll_create(0);
29623b6edd16SPeter Maydell    return 0;
29633b6edd16SPeter Maydell}
29643b6edd16SPeter MaydellEOF
29658fb03151SPeter Maydellif compile_prog "" "" ; then
29663b6edd16SPeter Maydell  epoll=yes
29673b6edd16SPeter Maydellfi
29683b6edd16SPeter Maydell
29693b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
29703b6edd16SPeter Maydell# so we must check separately for their presence
29713b6edd16SPeter Maydellepoll_create1=no
29723b6edd16SPeter Maydellcat > $TMPC << EOF
29733b6edd16SPeter Maydell#include <sys/epoll.h>
29743b6edd16SPeter Maydell
29753b6edd16SPeter Maydellint main(void)
29763b6edd16SPeter Maydell{
297719e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
297819e83f6bSPeter Maydell     * a function being called. This is necessary so that on
297919e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
298019e83f6bSPeter Maydell     * the library but not declared in the header file we will
298119e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
298219e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
298319e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
298419e83f6bSPeter Maydell     */
2985c075a723SBlue Swirl    return (int)(uintptr_t)&epoll_create1;
29863b6edd16SPeter Maydell}
29873b6edd16SPeter MaydellEOF
29888fb03151SPeter Maydellif compile_prog "" "" ; then
29893b6edd16SPeter Maydell  epoll_create1=yes
29903b6edd16SPeter Maydellfi
29913b6edd16SPeter Maydell
29923b6edd16SPeter Maydellepoll_pwait=no
29933b6edd16SPeter Maydellcat > $TMPC << EOF
29943b6edd16SPeter Maydell#include <sys/epoll.h>
29953b6edd16SPeter Maydell
29963b6edd16SPeter Maydellint main(void)
29973b6edd16SPeter Maydell{
29983b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
29993b6edd16SPeter Maydell    return 0;
30003b6edd16SPeter Maydell}
30013b6edd16SPeter MaydellEOF
30028fb03151SPeter Maydellif compile_prog "" "" ; then
30033b6edd16SPeter Maydell  epoll_pwait=yes
30043b6edd16SPeter Maydellfi
30053b6edd16SPeter Maydell
3006a8fd1abaSPeter Maydell# check for sendfile support
3007a8fd1abaSPeter Maydellsendfile=no
3008a8fd1abaSPeter Maydellcat > $TMPC << EOF
3009a8fd1abaSPeter Maydell#include <sys/sendfile.h>
3010a8fd1abaSPeter Maydell
3011a8fd1abaSPeter Maydellint main(void)
3012a8fd1abaSPeter Maydell{
3013a8fd1abaSPeter Maydell    return sendfile(0, 0, 0, 0);
3014a8fd1abaSPeter Maydell}
3015a8fd1abaSPeter MaydellEOF
3016a8fd1abaSPeter Maydellif compile_prog "" "" ; then
3017a8fd1abaSPeter Maydell  sendfile=yes
3018a8fd1abaSPeter Maydellfi
3019a8fd1abaSPeter Maydell
3020cc8ae6deSpbrook# Check if tools are available to build documentation.
3021a25dba17SJuan Quintelaif test "$docs" != "no" ; then
302201668d98SStefan Weil  if has makeinfo && has pod2man; then
3023a25dba17SJuan Quintela    docs=yes
302483a3ab8bSJuan Quintela  else
3025a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
3026a25dba17SJuan Quintela      feature_not_found "docs"
302783a3ab8bSJuan Quintela    fi
3028a25dba17SJuan Quintela    docs=no
302983a3ab8bSJuan Quintela  fi
3030cc8ae6deSpbrookfi
3031cc8ae6deSpbrook
3032f514f41cSStefan Weil# Search for bswap_32 function
30336ae9a1f4SJuan Quintelabyteswap_h=no
30346ae9a1f4SJuan Quintelacat > $TMPC << EOF
30356ae9a1f4SJuan Quintela#include <byteswap.h>
30366ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
30376ae9a1f4SJuan QuintelaEOF
303852166aa0SJuan Quintelaif compile_prog "" "" ; then
30396ae9a1f4SJuan Quintela  byteswap_h=yes
30406ae9a1f4SJuan Quintelafi
30416ae9a1f4SJuan Quintela
304275f13596SStefan Weil# Search for bswap32 function
30436ae9a1f4SJuan Quintelabswap_h=no
30446ae9a1f4SJuan Quintelacat > $TMPC << EOF
30456ae9a1f4SJuan Quintela#include <sys/endian.h>
30466ae9a1f4SJuan Quintela#include <sys/types.h>
30476ae9a1f4SJuan Quintela#include <machine/bswap.h>
30486ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
30496ae9a1f4SJuan QuintelaEOF
305052166aa0SJuan Quintelaif compile_prog "" "" ; then
30516ae9a1f4SJuan Quintela  bswap_h=yes
30526ae9a1f4SJuan Quintelafi
30536ae9a1f4SJuan Quintela
3054da93a1fdSaliguori##########################################
3055c589b249SRonnie Sahlberg# Do we have libiscsi
3056063c3378SPeter Lieven# We check for iscsi_write16_sync() to make sure we have a
3057063c3378SPeter Lieven# at least version 1.4.0 of libiscsi.
3058c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
3059c589b249SRonnie Sahlberg  cat > $TMPC << EOF
3060fa6acb0cSRonnie Sahlberg#include <stdio.h>
3061c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
3062063c3378SPeter Lievenint main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
3063c589b249SRonnie SahlbergEOF
306465d5d3f9SStefan Weil  if $pkg_config --atleast-version=1.7.0 libiscsi; then
30653c33ea96SPaolo Bonzini    libiscsi="yes"
3066ca871ec8SStefan Weil    libiscsi_cflags=$($pkg_config --cflags libiscsi)
3067ca871ec8SStefan Weil    libiscsi_libs=$($pkg_config --libs libiscsi)
30683c33ea96SPaolo Bonzini    CFLAGS="$CFLAGS $libiscsi_cflags"
30693c33ea96SPaolo Bonzini    LIBS="$LIBS $libiscsi_libs"
30703c33ea96SPaolo Bonzini  elif compile_prog "" "-liscsi" ; then
3071c589b249SRonnie Sahlberg    libiscsi="yes"
3072c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
3073c589b249SRonnie Sahlberg  else
3074c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
3075c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
3076c589b249SRonnie Sahlberg    fi
3077c589b249SRonnie Sahlberg    libiscsi="no"
3078c589b249SRonnie Sahlberg  fi
3079c589b249SRonnie Sahlbergfi
3080c589b249SRonnie Sahlberg
3081c589b249SRonnie Sahlberg
3082c589b249SRonnie Sahlberg##########################################
30838bacde8dSNatanael Copa# Do we need libm
30848bacde8dSNatanael Copacat > $TMPC << EOF
30858bacde8dSNatanael Copa#include <math.h>
30868bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); }
30878bacde8dSNatanael CopaEOF
30888bacde8dSNatanael Copaif compile_prog "" "" ; then
30898bacde8dSNatanael Copa  :
30908bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then
30918bacde8dSNatanael Copa  LIBS="-lm $LIBS"
30928bacde8dSNatanael Copa  libs_qga="-lm $libs_qga"
30938bacde8dSNatanael Copaelse
309476ad07a4SPeter Maydell  error_exit "libm check failed"
30958bacde8dSNatanael Copafi
30968bacde8dSNatanael Copa
30978bacde8dSNatanael Copa##########################################
3098da93a1fdSaliguori# Do we need librt
30998bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime
31008bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't
31018bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this
31028bacde8dSNatanael Copa# function in addition.
3103da93a1fdSaliguoricat > $TMPC <<EOF
3104da93a1fdSaliguori#include <signal.h>
3105da93a1fdSaliguori#include <time.h>
31068bacde8dSNatanael Copaint main(void) {
31078bacde8dSNatanael Copa  timer_create(CLOCK_REALTIME, NULL, NULL);
31088bacde8dSNatanael Copa  return clock_gettime(CLOCK_REALTIME, NULL);
31098bacde8dSNatanael Copa}
3110da93a1fdSaliguoriEOF
3111da93a1fdSaliguori
311252166aa0SJuan Quintelaif compile_prog "" "" ; then
311307ffa4bdSJuan Quintela  :
31148bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result
31158bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then
311607ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
31178bacde8dSNatanael Copa  libs_qga="-lrt $libs_qga"
3118da93a1fdSaliguorifi
3119da93a1fdSaliguori
312031ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3121179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
31226362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
31236362a53fSJuan Quintelafi
31246362a53fSJuan Quintela
3125de5071c5SBlue Swirl##########################################
3126cd4ec0b4SGerd Hoffmann# spice probe
3127cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
3128cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
3129cd4ec0b4SGerd Hoffmann#include <spice.h>
3130cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
3131cd4ec0b4SGerd HoffmannEOF
3132710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3133710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
313465d5d3f9SStefan Weil  if $pkg_config --atleast-version=0.12.0 spice-server && \
313565d5d3f9SStefan Weil     $pkg_config --atleast-version=0.12.3 spice-protocol && \
3136cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
3137cd4ec0b4SGerd Hoffmann    spice="yes"
3138cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
3139cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
31402e0e3c39SAlon Levy    spice_protocol_version=$($pkg_config --modversion spice-protocol)
31412e0e3c39SAlon Levy    spice_server_version=$($pkg_config --modversion spice-server)
3142cd4ec0b4SGerd Hoffmann  else
3143cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
3144cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
3145cd4ec0b4SGerd Hoffmann    fi
3146cd4ec0b4SGerd Hoffmann    spice="no"
3147cd4ec0b4SGerd Hoffmann  fi
3148cd4ec0b4SGerd Hoffmannfi
3149cd4ec0b4SGerd Hoffmann
3150111a38b0SRobert Relyea# check for libcacard for smartcard support
3151111a38b0SRobert Relyeasmartcard_cflags=""
3152111a38b0SRobert Relyea# TODO - what's the minimal nss version we support?
3153111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then
31545f01e06fSSergei Trofimovich  cat > $TMPC << EOF
31555f01e06fSSergei Trofimovich#include <pk11pub.h>
31565f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
31575f01e06fSSergei TrofimovichEOF
31580b22ef0fSPeter Maydell    smartcard_includes="-I\$(SRC_PATH)/libcacard"
31598c741c22SAlon Levy    libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
31608c741c22SAlon Levy    libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
31616ca026cbSPeter Maydell    test_cflags="$libcacard_cflags"
31626ca026cbSPeter Maydell    # The header files in nss < 3.13.3 have a bug which causes them to
31636ca026cbSPeter Maydell    # emit a warning. If we're going to compile QEMU with -Werror, then
31646ca026cbSPeter Maydell    # test that the headers don't have this bug. Otherwise we would pass
31656ca026cbSPeter Maydell    # the configure test but fail to compile QEMU later.
31666ca026cbSPeter Maydell    if test "$werror" = "yes"; then
31676ca026cbSPeter Maydell        test_cflags="-Werror $test_cflags"
31686ca026cbSPeter Maydell    fi
3169b6fc675bSPaolo Bonzini    if test -n "$libtool" &&
317065d5d3f9SStefan Weil       $pkg_config --atleast-version=3.12.8 nss && \
31716ca026cbSPeter Maydell      compile_prog "$test_cflags" "$libcacard_libs"; then
31725f01e06fSSergei Trofimovich        smartcard_nss="yes"
31730b22ef0fSPeter Maydell        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
31740b22ef0fSPeter Maydell        QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3175ad4cf3f6SPaul Brook        libs_softmmu="$libcacard_libs $libs_softmmu"
3176111a38b0SRobert Relyea    else
3177111a38b0SRobert Relyea        if test "$smartcard_nss" = "yes"; then
3178111a38b0SRobert Relyea            feature_not_found "nss"
3179111a38b0SRobert Relyea        fi
3180111a38b0SRobert Relyea        smartcard_nss="no"
3181111a38b0SRobert Relyea    fi
3182111a38b0SRobert Relyeafi
3183111a38b0SRobert Relyea
31842b2325ffSGerd Hoffmann# check for libusb
31852b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then
318665d5d3f9SStefan Weil    if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
31872b2325ffSGerd Hoffmann        libusb="yes"
3188ca871ec8SStefan Weil        libusb_cflags=$($pkg_config --cflags libusb-1.0)
3189ca871ec8SStefan Weil        libusb_libs=$($pkg_config --libs libusb-1.0)
31902b2325ffSGerd Hoffmann        QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
31912b2325ffSGerd Hoffmann        libs_softmmu="$libs_softmmu $libusb_libs"
31922b2325ffSGerd Hoffmann    else
31932b2325ffSGerd Hoffmann        if test "$libusb" = "yes"; then
31942b2325ffSGerd Hoffmann            feature_not_found "libusb"
31952b2325ffSGerd Hoffmann        fi
31962b2325ffSGerd Hoffmann        libusb="no"
31972b2325ffSGerd Hoffmann    fi
31982b2325ffSGerd Hoffmannfi
31992b2325ffSGerd Hoffmann
320069354a83SHans de Goede# check for usbredirparser for usb network redirection support
320169354a83SHans de Goedeif test "$usb_redir" != "no" ; then
320265d5d3f9SStefan Weil    if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
320369354a83SHans de Goede        usb_redir="yes"
3204ca871ec8SStefan Weil        usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3205ca871ec8SStefan Weil        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
320669354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
320756ab2ad1SAurelien Jarno        libs_softmmu="$libs_softmmu $usb_redir_libs"
320869354a83SHans de Goede    else
320969354a83SHans de Goede        if test "$usb_redir" = "yes"; then
321069354a83SHans de Goede            feature_not_found "usb-redir"
321169354a83SHans de Goede        fi
321269354a83SHans de Goede        usb_redir="no"
321369354a83SHans de Goede    fi
321469354a83SHans de Goedefi
321569354a83SHans de Goede
3216cd4ec0b4SGerd Hoffmann##########################################
3217d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win
3218d9840e25STomoki Sekiyama
3219d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3220d9840e25STomoki Sekiyama  case "$vss_win32_sdk" in
3221d9840e25STomoki Sekiyama    "")   vss_win32_include="-I$source_path" ;;
3222d9840e25STomoki Sekiyama    *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3223d9840e25STomoki Sekiyama          # handle path with spaces. So we symlink the headers into ".sdk/vss".
3224d9840e25STomoki Sekiyama          vss_win32_include="-I$source_path/.sdk/vss"
3225d9840e25STomoki Sekiyama	  symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3226d9840e25STomoki Sekiyama	  ;;
3227d9840e25STomoki Sekiyama    *)    vss_win32_include="-I$vss_win32_sdk"
3228d9840e25STomoki Sekiyama  esac
3229d9840e25STomoki Sekiyama  cat > $TMPC << EOF
3230d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__
3231d9840e25STomoki Sekiyama#include <inc/win2003/vss.h>
3232d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; }
3233d9840e25STomoki SekiyamaEOF
3234d9840e25STomoki Sekiyama  if compile_prog "$vss_win32_include" "" ; then
3235d9840e25STomoki Sekiyama    guest_agent_with_vss="yes"
3236d9840e25STomoki Sekiyama    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3237d9840e25STomoki Sekiyama    libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3238d9840e25STomoki Sekiyama  else
3239d9840e25STomoki Sekiyama    if test "$vss_win32_sdk" != "" ; then
3240d9840e25STomoki Sekiyama      echo "ERROR: Please download and install Microsoft VSS SDK:"
3241d9840e25STomoki Sekiyama      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3242d9840e25STomoki Sekiyama      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3243d9840e25STomoki Sekiyama      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
3244d9840e25STomoki Sekiyama      echo "ERROR: The headers are extracted in the directory \`inc'."
3245d9840e25STomoki Sekiyama      feature_not_found "VSS support"
3246d9840e25STomoki Sekiyama    fi
3247d9840e25STomoki Sekiyama    guest_agent_with_vss="no"
3248d9840e25STomoki Sekiyama  fi
3249d9840e25STomoki Sekiyamafi
3250d9840e25STomoki Sekiyama
3251d9840e25STomoki Sekiyama##########################################
3252d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified)
3253d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent
3254d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the
3255d9840e25STomoki Sekiyama# pre-compiled .tlb file is included.
3256d9840e25STomoki Sekiyama
3257d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3258d9840e25STomoki Sekiyama  if test -z "$win_sdk"; then
3259d9840e25STomoki Sekiyama    programfiles="$PROGRAMFILES"
3260d9840e25STomoki Sekiyama    test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3261d9840e25STomoki Sekiyama    if test -n "$programfiles"; then
3262d9840e25STomoki Sekiyama      win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3263d9840e25STomoki Sekiyama    else
3264d9840e25STomoki Sekiyama      feature_not_found "Windows SDK"
3265d9840e25STomoki Sekiyama    fi
3266d9840e25STomoki Sekiyama  elif test "$win_sdk" = "no"; then
3267d9840e25STomoki Sekiyama    win_sdk=""
3268d9840e25STomoki Sekiyama  fi
3269d9840e25STomoki Sekiyamafi
3270d9840e25STomoki Sekiyama
3271d9840e25STomoki Sekiyama##########################################
3272cd4ec0b4SGerd Hoffmann
3273747bbdf7SBlue Swirl##########################################
32745f6b9e8fSBlue Swirl# check if we have fdatasync
32755f6b9e8fSBlue Swirl
32765f6b9e8fSBlue Swirlfdatasync=no
32775f6b9e8fSBlue Swirlcat > $TMPC << EOF
32785f6b9e8fSBlue Swirl#include <unistd.h>
3279d1722a27SAlexandre Raymondint main(void) {
3280d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3281d1722a27SAlexandre Raymondreturn fdatasync(0);
3282d1722a27SAlexandre Raymond#else
3283e172fe11SStefan Weil#error Not supported
3284d1722a27SAlexandre Raymond#endif
3285d1722a27SAlexandre Raymond}
32865f6b9e8fSBlue SwirlEOF
32875f6b9e8fSBlue Swirlif compile_prog "" "" ; then
32885f6b9e8fSBlue Swirl    fdatasync=yes
32895f6b9e8fSBlue Swirlfi
32905f6b9e8fSBlue Swirl
329194a420b1SStefan Hajnoczi##########################################
3292e78815a5SAndreas Färber# check if we have madvise
3293e78815a5SAndreas Färber
3294e78815a5SAndreas Färbermadvise=no
3295e78815a5SAndreas Färbercat > $TMPC << EOF
3296e78815a5SAndreas Färber#include <sys/types.h>
3297e78815a5SAndreas Färber#include <sys/mman.h>
3298832ce9c2SScott Wood#include <stddef.h>
3299e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3300e78815a5SAndreas FärberEOF
3301e78815a5SAndreas Färberif compile_prog "" "" ; then
3302e78815a5SAndreas Färber    madvise=yes
3303e78815a5SAndreas Färberfi
3304e78815a5SAndreas Färber
3305e78815a5SAndreas Färber##########################################
3306e78815a5SAndreas Färber# check if we have posix_madvise
3307e78815a5SAndreas Färber
3308e78815a5SAndreas Färberposix_madvise=no
3309e78815a5SAndreas Färbercat > $TMPC << EOF
3310e78815a5SAndreas Färber#include <sys/mman.h>
3311832ce9c2SScott Wood#include <stddef.h>
3312e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3313e78815a5SAndreas FärberEOF
3314e78815a5SAndreas Färberif compile_prog "" "" ; then
3315e78815a5SAndreas Färber    posix_madvise=yes
3316e78815a5SAndreas Färberfi
3317e78815a5SAndreas Färber
3318e78815a5SAndreas Färber##########################################
33191e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID
33201e9737daSRichard Henderson
33211e9737daSRichard Hendersonsigev_thread_id=no
33221e9737daSRichard Hendersoncat > $TMPC << EOF
33231e9737daSRichard Henderson#include <signal.h>
33241e9737daSRichard Hendersonint main(void) {
33251e9737daSRichard Henderson  struct sigevent ev;
33261e9737daSRichard Henderson  ev.sigev_notify = SIGEV_THREAD_ID;
33271e9737daSRichard Henderson  ev._sigev_un._tid = 0;
33281e9737daSRichard Henderson  asm volatile("" : : "g"(&ev));
33291e9737daSRichard Henderson  return 0;
33301e9737daSRichard Henderson}
33311e9737daSRichard HendersonEOF
33321e9737daSRichard Hendersonif compile_prog "" "" ; then
33331e9737daSRichard Henderson    sigev_thread_id=yes
33341e9737daSRichard Hendersonfi
33351e9737daSRichard Henderson
33361e9737daSRichard Henderson##########################################
333794a420b1SStefan Hajnoczi# check if trace backend exists
333894a420b1SStefan Hajnoczi
3339650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
334094a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
334176ad07a4SPeter Maydell  error_exit "invalid trace backend" \
334276ad07a4SPeter Maydell      "Please choose a supported trace backend."
334394a420b1SStefan Hajnoczifi
334494a420b1SStefan Hajnoczi
33457e24e92aSStefan Hajnoczi##########################################
33467e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
33477e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
33487e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
33497e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
33507e24e92aSStefan Hajnoczi#include <ust/marker.h>
33517e24e92aSStefan Hajnocziint main(void) { return 0; }
33527e24e92aSStefan HajnocziEOF
33537e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
335494b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
3355c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
33567e24e92aSStefan Hajnoczi  else
335776ad07a4SPeter Maydell    error_exit "Trace backend 'ust' missing libust header files"
33587e24e92aSStefan Hajnoczi  fi
33597e24e92aSStefan Hajnoczifi
3360b3d08c02SDaniel P. Berrange
3361b3d08c02SDaniel P. Berrange##########################################
3362b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
3363b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
3364b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
336576ad07a4SPeter Maydell    error_exit "dtrace command is not found in PATH $PATH"
3366b3d08c02SDaniel P. Berrange  fi
3367c276b17dSDaniel P. Berrange  trace_backend_stap="no"
3368c276b17dSDaniel P. Berrange  if has 'stap' ; then
3369c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
3370c276b17dSDaniel P. Berrange  fi
3371b3d08c02SDaniel P. Berrangefi
3372b3d08c02SDaniel P. Berrange
33737e24e92aSStefan Hajnoczi##########################################
3374519175a2SAlex Barcelo# check and set a backend for coroutine
3375d0e2fce5SAneesh Kumar K.V
33767c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback
33777c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because
33787c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally
33797c2acc70SPeter Maydell# useful for debugging purposes.)  On Windows the only valid backend
33807c2acc70SPeter Maydell# is the Windows-specific one.
33817c2acc70SPeter Maydell
33827c2acc70SPeter Maydellucontext_works=no
3383d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then
3384d0e2fce5SAneesh Kumar K.V  cat > $TMPC << EOF
3385d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
3386cdf84806SPeter Maydell#ifdef __stub_makecontext
3387cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
3388cdf84806SPeter Maydell#endif
338975cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
3390d0e2fce5SAneesh Kumar K.VEOF
3391d0e2fce5SAneesh Kumar K.V  if compile_prog "" "" ; then
33927c2acc70SPeter Maydell    ucontext_works=yes
3393d0e2fce5SAneesh Kumar K.V  fi
3394519175a2SAlex Barcelofi
33957c2acc70SPeter Maydell
33967c2acc70SPeter Maydellif test "$coroutine" = ""; then
33977c2acc70SPeter Maydell  if test "$mingw32" = "yes"; then
33987c2acc70SPeter Maydell    coroutine=win32
33997c2acc70SPeter Maydell  elif test "$ucontext_works" = "yes"; then
34007c2acc70SPeter Maydell    coroutine=ucontext
3401519175a2SAlex Barcelo  else
34027c2acc70SPeter Maydell    coroutine=sigaltstack
34037c2acc70SPeter Maydell  fi
34047c2acc70SPeter Maydellelse
34057c2acc70SPeter Maydell  case $coroutine in
34067c2acc70SPeter Maydell  windows)
34077c2acc70SPeter Maydell    if test "$mingw32" != "yes"; then
34087c2acc70SPeter Maydell      error_exit "'windows' coroutine backend only valid for Windows"
34097c2acc70SPeter Maydell    fi
34107c2acc70SPeter Maydell    # Unfortunately the user visible backend name doesn't match the
34117c2acc70SPeter Maydell    # coroutine-*.c filename for this case, so we have to adjust it here.
34127c2acc70SPeter Maydell    coroutine=win32
34137c2acc70SPeter Maydell    ;;
34147c2acc70SPeter Maydell  ucontext)
34157c2acc70SPeter Maydell    if test "$ucontext_works" != "yes"; then
34167c2acc70SPeter Maydell      feature_not_found "ucontext"
34177c2acc70SPeter Maydell    fi
34187c2acc70SPeter Maydell    ;;
34197c2acc70SPeter Maydell  gthread|sigaltstack)
34207c2acc70SPeter Maydell    if test "$mingw32" = "yes"; then
34217c2acc70SPeter Maydell      error_exit "only the 'windows' coroutine backend is valid for Windows"
34227c2acc70SPeter Maydell    fi
34237c2acc70SPeter Maydell    ;;
34247c2acc70SPeter Maydell  *)
342576ad07a4SPeter Maydell    error_exit "unknown coroutine backend $coroutine"
34267c2acc70SPeter Maydell    ;;
34277c2acc70SPeter Maydell  esac
3428d0e2fce5SAneesh Kumar K.Vfi
3429d0e2fce5SAneesh Kumar K.V
343070c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then
343170c60c08SStefan Hajnoczi  if test "$coroutine" = "gthread"; then
343270c60c08SStefan Hajnoczi    coroutine_pool=no
343370c60c08SStefan Hajnoczi  else
343470c60c08SStefan Hajnoczi    coroutine_pool=yes
343570c60c08SStefan Hajnoczi  fi
343670c60c08SStefan Hajnoczifi
343770c60c08SStefan Hajnocziif test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
343870c60c08SStefan Hajnoczi  error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
343970c60c08SStefan Hajnoczifi
344070c60c08SStefan Hajnoczi
3441d0e2fce5SAneesh Kumar K.V##########################################
3442d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
3443d2042378SAneesh Kumar K.V
34444e1797f9SStefan Weilopen_by_handle_at=no
3445d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
3446d2042378SAneesh Kumar K.V#include <fcntl.h>
3447acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
3448acc55ba8SStefan Weil# error missing definition
3449acc55ba8SStefan Weil#else
345075cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3451acc55ba8SStefan Weil#endif
3452d2042378SAneesh Kumar K.VEOF
3453d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
3454d2042378SAneesh Kumar K.V    open_by_handle_at=yes
3455d2042378SAneesh Kumar K.Vfi
3456d2042378SAneesh Kumar K.V
3457e06a765eSHarsh Prateek Bora########################################
3458e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
3459e06a765eSHarsh Prateek Bora
3460e06a765eSHarsh Prateek Boralinux_magic_h=no
3461e06a765eSHarsh Prateek Boracat > $TMPC << EOF
3462e06a765eSHarsh Prateek Bora#include <linux/magic.h>
3463e06a765eSHarsh Prateek Boraint main(void) {
346475cafad7SStefan Weil  return 0;
3465e06a765eSHarsh Prateek Bora}
3466e06a765eSHarsh Prateek BoraEOF
3467e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
3468e06a765eSHarsh Prateek Bora    linux_magic_h=yes
3469e06a765eSHarsh Prateek Borafi
3470e06a765eSHarsh Prateek Bora
34718ab1bf12SLuiz Capitulino########################################
3472c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed
3473c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries).
3474c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is
3475c95e3080SKevin Wolf# only a warning.
3476c95e3080SKevin Wolf#
3477c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that
3478c95e3080SKevin Wolf# the build doesn't fail anyway.
3479c95e3080SKevin Wolf
348006d71fa1SPeter Maydellpragma_disable_unused_but_set=no
348106d71fa1SPeter Maydellcat > $TMPC << EOF
3482e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push
348306d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3484c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes"
3485e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop
3486c95e3080SKevin Wolf
348706d71fa1SPeter Maydellint main(void) {
348806d71fa1SPeter Maydell    return 0;
348906d71fa1SPeter Maydell}
349006d71fa1SPeter MaydellEOF
349106d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then
3492cc6e3ca9SGerd Hoffmann    pragma_diagnostic_available=yes
3493c95e3080SKevin Wolfelse
3494c95e3080SKevin Wolf    werror=no
349506d71fa1SPeter Maydellfi
349606d71fa1SPeter Maydell
349706d71fa1SPeter Maydell########################################
349862fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h
34993f4349dcSKevin Wolf
35003f4349dcSKevin Wolfvalgrind_h=no
35013f4349dcSKevin Wolfcat > $TMPC << EOF
35023f4349dcSKevin Wolf#include <valgrind/valgrind.h>
350362fe8331SChristian Borntraeger#include <valgrind/memcheck.h>
35043f4349dcSKevin Wolfint main(void) {
35053f4349dcSKevin Wolf  return 0;
35063f4349dcSKevin Wolf}
35073f4349dcSKevin WolfEOF
35083f4349dcSKevin Wolfif compile_prog "" "" ; then
35093f4349dcSKevin Wolf    valgrind_h=yes
35103f4349dcSKevin Wolffi
35113f4349dcSKevin Wolf
35123f4349dcSKevin Wolf########################################
35138ab1bf12SLuiz Capitulino# check if environ is declared
35148ab1bf12SLuiz Capitulino
35158ab1bf12SLuiz Capitulinohas_environ=no
35168ab1bf12SLuiz Capitulinocat > $TMPC << EOF
35178ab1bf12SLuiz Capitulino#include <unistd.h>
35188ab1bf12SLuiz Capitulinoint main(void) {
3519c075a723SBlue Swirl    environ = 0;
35208ab1bf12SLuiz Capitulino    return 0;
35218ab1bf12SLuiz Capitulino}
35228ab1bf12SLuiz CapitulinoEOF
35238ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
35248ab1bf12SLuiz Capitulino    has_environ=yes
35258ab1bf12SLuiz Capitulinofi
35268ab1bf12SLuiz Capitulino
352776a347e1SRichard Henderson########################################
352876a347e1SRichard Henderson# check if cpuid.h is usable.
352976a347e1SRichard Henderson
353076a347e1SRichard Hendersoncpuid_h=no
353176a347e1SRichard Hendersoncat > $TMPC << EOF
353276a347e1SRichard Henderson#include <cpuid.h>
353376a347e1SRichard Hendersonint main(void) {
353476a347e1SRichard Henderson  return 0;
353576a347e1SRichard Henderson}
353676a347e1SRichard HendersonEOF
353776a347e1SRichard Hendersonif compile_prog "" "" ; then
353876a347e1SRichard Henderson    cpuid_h=yes
353976a347e1SRichard Hendersonfi
354076a347e1SRichard Henderson
3541f540166bSRichard Henderson########################################
3542f540166bSRichard Henderson# check if __[u]int128_t is usable.
3543f540166bSRichard Henderson
3544f540166bSRichard Hendersonint128=no
3545f540166bSRichard Hendersoncat > $TMPC << EOF
3546f540166bSRichard Henderson__int128_t a;
3547f540166bSRichard Henderson__uint128_t b;
3548f540166bSRichard Hendersonint main (void) {
3549f540166bSRichard Henderson  a = a + b;
3550f540166bSRichard Henderson  b = a * b;
3551464e3671SPeter Maydell  a = a * a;
3552f540166bSRichard Henderson  return 0;
3553f540166bSRichard Henderson}
3554f540166bSRichard HendersonEOF
3555f540166bSRichard Hendersonif compile_prog "" "" ; then
3556f540166bSRichard Henderson    int128=yes
3557f540166bSRichard Hendersonfi
355876a347e1SRichard Henderson
35591e6e9acaSRichard Henderson########################################
35601e6e9acaSRichard Henderson# check if getauxval is available.
35611e6e9acaSRichard Henderson
35621e6e9acaSRichard Hendersongetauxval=no
35631e6e9acaSRichard Hendersoncat > $TMPC << EOF
35641e6e9acaSRichard Henderson#include <sys/auxv.h>
35651e6e9acaSRichard Hendersonint main(void) {
35661e6e9acaSRichard Henderson  return getauxval(AT_HWCAP) == 0;
35671e6e9acaSRichard Henderson}
35681e6e9acaSRichard HendersonEOF
35691e6e9acaSRichard Hendersonif compile_prog "" "" ; then
35701e6e9acaSRichard Henderson    getauxval=yes
35711e6e9acaSRichard Hendersonfi
35721e6e9acaSRichard Henderson
3573d2042378SAneesh Kumar K.V##########################################
3574e86ecd4bSJuan Quintela# End of CC checks
3575e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
3576e86ecd4bSJuan Quintela
35771d728c39SBlue Swirlif test "$gcov" = "yes" ; then
35781d728c39SBlue Swirl  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
35791d728c39SBlue Swirl  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
35801d728c39SBlue Swirlelif test "$debug" = "no" ; then
3581e600cdf3SMichal Privoznik  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
3582e86ecd4bSJuan Quintelafi
3583a316e378SJuan Quintela
35841d728c39SBlue Swirl
358520ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
358620ff6c80SAnthony Liguori# enable/disable
358720ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
358820ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
358920ff6c80SAnthony Liguori	zero_malloc="no"
359020ff6c80SAnthony Liguori    else
359120ff6c80SAnthony Liguori	zero_malloc="yes"
359220ff6c80SAnthony Liguori    fi
359320ff6c80SAnthony Liguorifi
359420ff6c80SAnthony Liguori
35956ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags
35966ca026cbSPeter Maydellif test "$werror" = "yes"; then
35976ca026cbSPeter Maydell    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
35986ca026cbSPeter Maydellfi
35996ca026cbSPeter Maydell
3600e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
3601e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
36021156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
3603e86ecd4bSJuan Quintela    fi
3604e86ecd4bSJuan Quintelafi
3605e86ecd4bSJuan Quintela
360694dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
360794dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
360894dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
360994dd53c5SGerd Hoffmannelse
361094dd53c5SGerd Hoffmann    POD2MAN="pod2man"
361194dd53c5SGerd Hoffmannfi
361294dd53c5SGerd Hoffmann
3613952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
3614952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
3615952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
3616952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3617952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
3618952afb71SBlue Swirl        fi
3619952afb71SBlue Swirl    done
3620952afb71SBlue Swirlfi
3621952afb71SBlue Swirl
362210ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
3623528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
3624834574eaSAnthony Liguoriqemu_localedir="$datadir/locale"
36255a67135aSbellard
36264b1c11fdSDaniel P. Berrangetools=""
36274b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then
3628ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
36294b1c11fdSDaniel P. Berrange  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
36304b1c11fdSDaniel P. Berrange    tools="qemu-nbd\$(EXESUF) $tools"
36314b1c11fdSDaniel P. Berrange  fi
36324b1c11fdSDaniel P. Berrangefi
36334b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then
3634983eef5aSMeador Inge  if test "$virtfs" != no ; then
3635be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3636983eef5aSMeador Inge      virtfs=yes
363717bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3638983eef5aSMeador Inge    else
3639983eef5aSMeador Inge      if test "$virtfs" = yes; then
364076ad07a4SPeter Maydell        error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3641983eef5aSMeador Inge      fi
364217500370SAndreas Färber      virtfs=no
3643983eef5aSMeador Inge    fi
364417bff52bSM. Mohan Kumar  fi
3645d138cee9SMichael Rothfi
3646e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then
3647b39297aeSTomoki Sekiyama  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
3648e8ef31a3SMichael Tokarev      tools="qemu-ga\$(EXESUF) $tools"
3649b39297aeSTomoki Sekiyama      if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3650b39297aeSTomoki Sekiyama        tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3651b39297aeSTomoki Sekiyama      fi
3652e8ef31a3SMichael Tokarev      guest_agent=yes
3653e8ef31a3SMichael Tokarev  elif [ "$guest_agent" != yes ]; then
3654e8ef31a3SMichael Tokarev      guest_agent=no
3655e8ef31a3SMichael Tokarev  else
3656e8ef31a3SMichael Tokarev      error_exit "Guest agent is not supported on this platform"
3657ca35f780SPaolo Bonzini  fi
36584b1c11fdSDaniel P. Berrangefi
3659ca35f780SPaolo Bonzini
3660ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
3661ca35f780SPaolo Bonziniroms=
3662ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3663ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3664ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
3665ca35f780SPaolo Bonzini  roms="optionrom"
3666ca35f780SPaolo Bonzinifi
3667d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
366839ac8455SDavid Gibson  roms="$roms spapr-rtas"
366939ac8455SDavid Gibsonfi
3670ca35f780SPaolo Bonzini
36719933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then
36729933c305SChristian Borntraeger  roms="$roms s390-ccw"
36739933c305SChristian Borntraegerfi
36749933c305SChristian Borntraeger
3675964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary.
3676964c6fa1SRichard Hendersonif test "$pie" = "no" ; then
3677964c6fa1SRichard Henderson  textseg_addr=
3678964c6fa1SRichard Henderson  case "$cpu" in
3679c72b26ecSRichard Henderson    arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
3680964c6fa1SRichard Henderson      textseg_addr=0x60000000
3681964c6fa1SRichard Henderson      ;;
3682964c6fa1SRichard Henderson    mips)
3683964c6fa1SRichard Henderson      textseg_addr=0x400000
3684964c6fa1SRichard Henderson      ;;
3685964c6fa1SRichard Henderson  esac
3686964c6fa1SRichard Henderson  if [ -n "$textseg_addr" ]; then
3687964c6fa1SRichard Henderson    cat > $TMPC <<EOF
3688964c6fa1SRichard Henderson    int main(void) { return 0; }
3689964c6fa1SRichard HendersonEOF
3690964c6fa1SRichard Henderson    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3691964c6fa1SRichard Henderson    if ! compile_prog "" "$textseg_ldflags"; then
3692964c6fa1SRichard Henderson      # In case ld does not support -Ttext-segment, edit the default linker
3693964c6fa1SRichard Henderson      # script via sed to set the .text start addr.  This is needed on FreeBSD
3694964c6fa1SRichard Henderson      # at least.
3695964c6fa1SRichard Henderson      $ld --verbose | sed \
3696964c6fa1SRichard Henderson        -e '1,/==================================================/d' \
3697964c6fa1SRichard Henderson        -e '/==================================================/,$d' \
3698964c6fa1SRichard Henderson        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3699964c6fa1SRichard Henderson        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3700964c6fa1SRichard Henderson      textseg_ldflags="-Wl,-T../config-host.ld"
3701964c6fa1SRichard Henderson    fi
3702964c6fa1SRichard Henderson  fi
3703964c6fa1SRichard Hendersonfi
3704964c6fa1SRichard Henderson
37055ca9388aSGerd Hoffmann# add pixman flags after all config tests are done
3706a540f158SPeter CrosthwaiteQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
37075ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs"
37085ca9388aSGerd Hoffmann
37097d13299dSbellardecho "Install prefix    $prefix"
3710c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
3711f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
37123aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
37138bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`"
37140f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
37151c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
371611d9f695Sbellardif test "$mingw32" = "no" ; then
37175a699bbbSLaszlo Ersekecho "local state directory   `eval echo $local_statedir`"
3718f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
371943ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
37205a699bbbSLaszlo Ersekelse
37215a699bbbSLaszlo Ersekecho "local state directory   queried at runtime"
3722d9840e25STomoki Sekiyamaecho "Windows SDK       $win_sdk"
372311d9f695Sbellardfi
37245a67135aSbellardecho "Source path       $source_path"
37257d13299dSbellardecho "C compiler        $cc"
372683469015Sbellardecho "Host C compiler   $host_cc"
372783f73fceSTomoki Sekiyamaecho "C++ compiler      $cxx"
37283c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc"
372945d285abSPeter Maydellecho "ARFLAGS           $ARFLAGS"
37300c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
3731a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
37320c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
37337d13299dSbellardecho "make              $make"
37346a882643Spbrookecho "install           $install"
3735c886edfbSBlue Swirlecho "python            $python"
3736e2d8830eSBradif test "$slirp" = "yes" ; then
3737e2d8830eSBrad    echo "smbd              $smbd"
3738e2d8830eSBradfi
3739a98fd896Sbellardecho "host CPU          $cpu"
3740de83cd02Sbellardecho "host big endian   $bigendian"
374197a847bcSbellardecho "target list       $target_list"
3742ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
37437d13299dSbellardecho "gprof enabled     $gprof"
374403b4fe7dSaliguoriecho "sparse enabled    $sparse"
37451625af87Saliguoriecho "strip binaries    $strip_opt"
374605c2a3e7Sbellardecho "profiler          $profiler"
374743ce4dfeSbellardecho "static build      $static"
374885aa5189Sbellardecho "-Werror enabled   $werror"
37495b0753e0Sbellardif test "$darwin" = "yes" ; then
37505b0753e0Sbellard    echo "Cocoa support     $cocoa"
37515b0753e0Sbellardfi
3752e2134eb9SGerd Hoffmannecho "pixman            $pixman"
375397a847bcSbellardecho "SDL support       $sdl"
3754a4ccabcfSAnthony Liguoriecho "GTK support       $gtk"
37554d3b6f6eSbalrogecho "curses support    $curses"
3756769ce76dSAlexander Grafecho "curl support      $curl"
375767b915a5Sbellardecho "mingw32 support   $mingw32"
37580c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
3759b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist"
3760b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist"
3761983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3762821601eaSJes Sorensenecho "VNC support       $vnc"
3763821601eaSJes Sorensenif test "$vnc" = "yes" ; then
37648d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
37652f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
37662f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3767efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
37687536ee4bSTim Hardeck    echo "VNC WS support    $vnc_ws"
3769821601eaSJes Sorensenfi
37703142255cSblueswir1if test -n "$sparc_cpu"; then
37713142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
37723142255cSblueswir1fi
3773e37630caSaliguoriecho "xen support       $xen"
37742e4d9fb1Saurel32echo "brlapi support    $brlapi"
3775a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3776a25dba17SJuan Quintelaecho "Documentation     $docs"
3777c5937220Spbrook[ ! -z "$uname_release" ] && \
3778c5937220Spbrookecho "uname -r          $uname_release"
3779379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
378040d6444eSAvi Kivityecho "PIE               $pie"
37818a16d273Sthsecho "vde support       $vde"
378258952137SVincenzo Maffioneecho "netmap support    $netmap"
37835c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3784758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
378577755340Sthsecho "Install blobs     $blobs"
3786b31a0277SJuan Quintelaecho "KVM support       $kvm"
37872da776dbSMichael R. Hinesecho "RDMA support      $rdma"
37889195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3789f652e6afSaurel32echo "fdt support       $fdt"
3790ceb42de8Saliguoriecho "preadv support    $preadv"
37915f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3792e78815a5SAndreas Färberecho "madvise           $madvise"
3793e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
37941e9737daSRichard Hendersonecho "sigev_thread_id   $sigev_thread_id"
3795ee682d27SStefan Weilecho "uuid support      $uuid"
379647e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3797d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
37985e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi"
379994a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
38009410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
38012e0e3c39SAlon Levyecho "spice support     $spice ($spice_protocol_version/$spice_server_version)"
3802f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3803dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3804111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
38052b2325ffSGerd Hoffmannecho "libusb            $libusb"
380669354a83SHans de Goedeecho "usb net redir     $usb_redir"
3807b1e5fff4SMichael Walleecho "GLX support       $glx"
3808c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3809d138cee9SMichael Rothecho "build guest agent $guest_agent"
3810d9840e25STomoki Sekiyamaecho "QGA VSS support   $guest_agent_with_vss"
3811f794573eSEduardo Otuboecho "seccomp support   $seccomp"
38127c2acc70SPeter Maydellecho "coroutine backend $coroutine"
381370c60c08SStefan Hajnocziecho "coroutine pool    $coroutine_pool"
3814eb100396SBharata B Raoecho "GlusterFS support $glusterfs"
3815583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane"
38161d728c39SBlue Swirlecho "gcov              $gcov_tool"
38171d728c39SBlue Swirlecho "gcov enabled      $gcov"
3818ab214c29SStefan Bergerecho "TPM support       $tpm"
38190a12ec87SRichard W.M. Jonesecho "libssh2 support   $libssh2"
38203b8acc11SPaolo Bonziniecho "TPM passthrough   $tpm_passthrough"
38213556c233SPaolo Bonziniecho "QOM debugging     $qom_cast_debug"
38224f18b782SJeff Codyecho "vhdx              $vhdx"
382367b915a5Sbellard
38241ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
382524b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3826e8cd23deSbellardfi
382797a847bcSbellard
382898ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
382997a847bcSbellard
3830dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak
3831dbd99ae3SStefan Weil
383298ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
383398ec69acSJuan Quintelaecho >> $config_host_mak
383498ec69acSJuan Quintela
3835e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
383699d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
383799d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
38383aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
38398bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak
38400f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
384199d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
384299d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
384322d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
38449afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
38459afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
38465a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then
3847785c23aeSLuiz Capitulino  echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
38485a699bbbSLaszlo Ersekfi
3849f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak
3850f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
3851f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
3852834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak
3853f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak
3854804edf29SJuan Quintela
385598ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3856727e5283SPaolo Bonzini
3857f8393946Saurel32if test "$debug_tcg" = "yes" ; then
38582358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3859f8393946Saurel32fi
38601625af87Saliguoriif test "$strip_opt" = "yes" ; then
386152ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
38621625af87Saliguorifi
38637d13299dSbellardif test "$bigendian" = "yes" ; then
3864e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
386597a847bcSbellardfi
386667b915a5Sbellardif test "$mingw32" = "yes" ; then
386798ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
38689fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
38699fe6de94SBlue Swirl  version_major=${rc_version%%.*}
38709fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38719fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
38729fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38739fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
38749fe6de94SBlue Swirl  version_micro=0
38759fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
38769fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3877d9840e25STomoki Sekiyama  if test "$guest_agent_with_vss" = "yes" ; then
3878d9840e25STomoki Sekiyama    echo "CONFIG_QGA_VSS=y" >> $config_host_mak
3879d9840e25STomoki Sekiyama    echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
3880d9840e25STomoki Sekiyama  fi
3881210fa556Spbrookelse
388235f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3883210fa556Spbrookfi
3884128ab2ffSblueswir1
3885dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3886dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3887dffcb71cSMark McLoughlinfi
3888dffcb71cSMark McLoughlin
388983fb7adfSbellardif test "$darwin" = "yes" ; then
389098ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
389183fb7adfSbellardfi
3892b29fe3edSmalc
3893b29fe3edSmalcif test "$aix" = "yes" ; then
389498ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3895b29fe3edSmalcfi
3896b29fe3edSmalc
3897ec530c81Sbellardif test "$solaris" = "yes" ; then
389898ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
38992358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
39000475a5caSths  if test "$needs_libsunmath" = "yes" ; then
390175b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
39020475a5caSths  fi
3903ec530c81Sbellardfi
3904179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3905179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3906179cf400SAndreas Färberfi
390797a847bcSbellardif test "$static" = "yes" ; then
390898ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
390997a847bcSbellardfi
39101ba16968SStefan Weilif test "$profiler" = "yes" ; then
39112358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
391205c2a3e7Sbellardfi
3913c20709aaSbellardif test "$slirp" = "yes" ; then
391498ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3915e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3916c20709aaSbellardfi
39178a16d273Sthsif test "$vde" = "yes" ; then
391898ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
39198a16d273Sthsfi
392058952137SVincenzo Maffioneif test "$netmap" = "yes" ; then
392158952137SVincenzo Maffione  echo "CONFIG_NETMAP=y" >> $config_host_mak
392258952137SVincenzo Maffionefi
392347e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
392447e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
392547e98658SCorey Bryantfi
39262358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
39270c58ac1cSmalcfor drv in $audio_drv_list; do
3928bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
392998ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3930923e4521Smalc    if test "$drv" = "fmod"; then
39317aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3932fb065187Sbellard    fi
39330c58ac1cSmalcdone
393467f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
393567f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
393667f86e8eSJuan Quintelafi
3937d5631638Smalcif test "$audio_win_int" = "yes" ; then
3938d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3939d5631638Smalcfi
3940b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
3941b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
3942821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3943821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3944821601eaSJes Sorensenfi
39458d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
394698ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
39478d5d2d4cSthsfi
39482f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
394998ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
39502f9606b3Saliguorifi
3951821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
39522f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
39532f6f5c7aSCorentin Charyfi
3954821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3955efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3956efe556adSCorentin Charyfi
39577536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then
39587536ee4bSTim Hardeck  echo "CONFIG_VNC_WS=y" >> $config_host_mak
39597536ee4bSTim Hardeck  echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
39607536ee4bSTim Hardeckfi
396176655d6dSaliguoriif test "$fnmatch" = "yes" ; then
39622358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
396376655d6dSaliguorifi
3964ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3965ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3966ee682d27SStefan Weilfi
3967dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3968dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3969dce512deSChristoph Hellwigfi
3970b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
397198ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
39722358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
397398ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
397498ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3975a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
397698ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3977cc8ae6deSpbrookfi
39781ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
397998ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
39808ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
398149ecc3faSbellardfi
398249ecc3faSbellardif test "$cocoa" = "yes" ; then
398398ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
398449ecc3faSbellardfi
39854d3b6f6eSbalrogif test "$curses" = "yes" ; then
398698ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3987ab4e5602SJan Kiszkafi
3988ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
39892358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3990ebc996f3SRiku Voipiofi
3991099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
39922358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3993099d6b0fSRiku Voipiofi
399440ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
399540ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
399640ff6d7eSKevin Wolffi
39973ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
39982358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
39993ce34dfbSvibisreenivasanfi
4000c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
4001c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
4002c2882b96SRiku Voipiofi
4003d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
4004d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
4005d0927938SUlrich Hechtfi
40063d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then
40073d4fa43eSKusanagi Kouichi  echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
40083d4fa43eSKusanagi Kouichifi
4009c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
4010c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
4011c727f47dSPeter Maydellfi
4012dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
4013dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
4014dace20dcSPeter Maydellfi
4015d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
4016d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
4017d0927938SUlrich Hechtfi
40184e0c6529SAlex Blighif test "$ppoll" = "yes" ; then
40194e0c6529SAlex Bligh  echo "CONFIG_PPOLL=y" >> $config_host_mak
40204e0c6529SAlex Blighfi
4021cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then
4022cd758dd0SAlex Bligh  echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
4023cd758dd0SAlex Blighfi
40243b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
40253b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
40263b6edd16SPeter Maydellfi
40273b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
40283b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
40293b6edd16SPeter Maydellfi
40303b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
40313b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
40323b6edd16SPeter Maydellfi
4033a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then
4034a8fd1abaSPeter Maydell  echo "CONFIG_SENDFILE=y" >> $config_host_mak
4035a8fd1abaSPeter Maydellfi
40363b3f24adSaurel32if test "$inotify" = "yes" ; then
40372358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
40383b3f24adSaurel32fi
4039c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
4040c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4041c05c7a73SRiku Voipiofi
40426ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
40436ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
40446ae9a1f4SJuan Quintelafi
40456ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
40466ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
40476ae9a1f4SJuan Quintelafi
4048769ce76dSAlexander Grafif test "$curl" = "yes" ; then
404998ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
4050b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
4051769ce76dSAlexander Graffi
40522e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
405398ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
40542e4d9fb1Saurel32fi
4055fb599c9aSbalrogif test "$bluez" = "yes" ; then
405698ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
4057ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
4058fb599c9aSbalrogfi
4059e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
4060a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then
4061a4ccabcfSAnthony Liguori  echo "CONFIG_GTK=y" >> $config_host_mak
4062a4ccabcfSAnthony Liguori  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4063a4ccabcfSAnthony Liguori  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4064a4ccabcfSAnthony Liguorifi
4065e37630caSaliguoriif test "$xen" = "yes" ; then
40666dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4067d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4068e37630caSaliguorifi
40695c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
40705c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
40715c6c3a6cSChristoph Hellwigfi
4072758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
4073758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
4074758e8e38SVenkateswararao Jujjuri (JV)fi
40754f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
40764f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
40774f26f2b6SAvi Kivityfi
4078983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
4079758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
4080758e8e38SVenkateswararao Jujjuri (JV)fi
40815e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then
40825e9be92dSNicholas Bellinger  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
40835e9be92dSNicholas Bellingerfi
408477755340Sthsif test "$blobs" = "yes" ; then
408598ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
408677755340Sthsfi
4087bf9298b9Saliguoriif test "$iovec" = "yes" ; then
40882358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
4089bf9298b9Saliguorifi
4090ceb42de8Saliguoriif test "$preadv" = "yes" ; then
40912358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
4092ceb42de8Saliguorifi
4093f652e6afSaurel32if test "$fdt" = "yes" ; then
40943f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
4095f652e6afSaurel32fi
4096dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
4097dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4098dcc38d1cSMarcelo Tosattifi
40999195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
41009195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
41019195b2c2SStefan Weilfi
41025f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
41035f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
41045f6b9e8fSBlue Swirlfi
4105e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
4106e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
4107e78815a5SAndreas Färberfi
4108e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
4109e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4110e78815a5SAndreas Färberfi
41111e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then
41121e9737daSRichard Henderson  echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
41131e9737daSRichard Hendersonfi
411497a847bcSbellard
4115cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
4116cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
4117cd4ec0b4SGerd Hoffmannfi
4118cd4ec0b4SGerd Hoffmann
4119111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
4120111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
4121ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4122ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
4123111a38b0SRobert Relyeafi
4124111a38b0SRobert Relyea
41252b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then
41262b2325ffSGerd Hoffmann  echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
41272b2325ffSGerd Hoffmannfi
41282b2325ffSGerd Hoffmann
412969354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
413069354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
413169354a83SHans de Goedefi
413269354a83SHans de Goede
4133b1e5fff4SMichael Walleif test "$glx" = "yes" ; then
4134b1e5fff4SMichael Walle  echo "CONFIG_GLX=y" >> $config_host_mak
41352b6b7099SPaolo Bonzini  echo "GLX_LIBS=$glx_libs" >> $config_host_mak
413620ff075bSMichael Wallefi
413720ff075bSMichael Walle
4138c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
4139c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
4140c589b249SRonnie Sahlbergfi
4141c589b249SRonnie Sahlberg
4142f794573eSEduardo Otuboif test "$seccomp" = "yes"; then
4143f794573eSEduardo Otubo  echo "CONFIG_SECCOMP=y" >> $config_host_mak
4144f794573eSEduardo Otubofi
4145f794573eSEduardo Otubo
414683fb7adfSbellard# XXX: suppress that
41477d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
41482358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
41497d3505c5Sbellardfi
41507d3505c5Sbellard
41512358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
4152c5937220Spbrook
415320ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
415420ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
415520ff6c80SAnthony Liguorifi
41563556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then
41573556c233SPaolo Bonzini  echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
41583556c233SPaolo Bonzinifi
4159f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
4160f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
4161f27aaf4bSChristian Brunnerfi
416220ff6c80SAnthony Liguori
41637c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
416470c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then
416570c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
416670c60c08SStefan Hajnoczielse
416770c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
416870c60c08SStefan Hajnoczifi
4169d0e2fce5SAneesh Kumar K.V
4170d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
4171d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4172d2042378SAneesh Kumar K.Vfi
4173d2042378SAneesh Kumar K.V
4174e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
4175e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4176e06a765eSHarsh Prateek Borafi
4177e06a765eSHarsh Prateek Bora
4178cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then
4179cc6e3ca9SGerd Hoffmann  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
418006d71fa1SPeter Maydellfi
418106d71fa1SPeter Maydell
41823f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then
41833f4349dcSKevin Wolf  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
41843f4349dcSKevin Wolffi
41853f4349dcSKevin Wolf
41868ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
41878ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
41888ab1bf12SLuiz Capitulinofi
41898ab1bf12SLuiz Capitulino
419076a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then
419176a347e1SRichard Henderson  echo "CONFIG_CPUID_H=y" >> $config_host_mak
419276a347e1SRichard Hendersonfi
419376a347e1SRichard Henderson
4194f540166bSRichard Hendersonif test "$int128" = "yes" ; then
4195f540166bSRichard Henderson  echo "CONFIG_INT128=y" >> $config_host_mak
4196f540166bSRichard Hendersonfi
4197f540166bSRichard Henderson
41981e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then
41991e6e9acaSRichard Henderson  echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
42001e6e9acaSRichard Hendersonfi
42011e6e9acaSRichard Henderson
4202eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then
4203eb100396SBharata B Rao  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
4204eb100396SBharata B Raofi
4205eb100396SBharata B Rao
42060c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then
42070c14fb47SBharata B Rao  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
42080c14fb47SBharata B Raofi
42090c14fb47SBharata B Rao
42100a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then
42110a12ec87SRichard W.M. Jones  echo "CONFIG_LIBSSH2=y" >> $config_host_mak
42120a12ec87SRichard W.M. Jonesfi
42130a12ec87SRichard W.M. Jones
4214583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then
42156e790746SPaolo Bonzini  echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
4216583f6e7bSStefan Hajnoczifi
4217583f6e7bSStefan Hajnoczi
42184f18b782SJeff Codyif test "$vhdx" = "yes" ; then
42194f18b782SJeff Cody  echo "CONFIG_VHDX=y" >> $config_host_mak
42204f18b782SJeff Codyfi
42214f18b782SJeff Cody
422268063649Sblueswir1# USB host support
4223b5613fdcSGerd Hoffmannif test "$libusb" = "yes"; then
42242b2325ffSGerd Hoffmann  echo "HOST_USB=libusb legacy" >> $config_host_mak
4225b5613fdcSGerd Hoffmannelse
422698ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
4227b5613fdcSGerd Hoffmannfi
422868063649Sblueswir1
42293b8acc11SPaolo Bonzini# TPM passthrough support?
42303b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then
42313b8acc11SPaolo Bonzini  echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
42323b8acc11SPaolo Bonzini  if test "$tpm_passthrough" = "yes"; then
42333b8acc11SPaolo Bonzini    echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
42343b8acc11SPaolo Bonzini  fi
42353b8acc11SPaolo Bonzinifi
42363b8acc11SPaolo Bonzini
4237e4858974SLluís# use default implementation for tracing backend-specific routines
4238e4858974SLluístrace_default=yes
423994a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
42406d8a764eSLluísif test "$trace_backend" = "nop"; then
42416d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
424222890ab5SPrerna Saxenafi
42439410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
42446d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
4245e4858974SLluís  trace_default=no
42466d8a764eSLluís  # Set the appropriate trace file.
4247953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
42489410b56cSPrerna Saxenafi
42496d8a764eSLluísif test "$trace_backend" = "stderr"; then
42506d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
42519a82b6a5SLluís  trace_default=no
42526d8a764eSLluísfi
42536d8a764eSLluísif test "$trace_backend" = "ust"; then
42546d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
42556d8a764eSLluísfi
42566d8a764eSLluísif test "$trace_backend" = "dtrace"; then
42576d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
42586d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
42596d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
42606d8a764eSLluís  fi
4261c276b17dSDaniel P. Berrangefi
4262781e9545SEiichi Tsukataif test "$trace_backend" = "ftrace"; then
4263781e9545SEiichi Tsukata  if test "$linux" = "yes" ; then
4264781e9545SEiichi Tsukata    echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4265781e9545SEiichi Tsukata    trace_default=no
4266781e9545SEiichi Tsukata  else
4267781e9545SEiichi Tsukata    feature_not_found "ftrace(trace backend)"
4268781e9545SEiichi Tsukata  fi
4269781e9545SEiichi Tsukatafi
42709410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
4271e4858974SLluísif test "$trace_default" = "yes"; then
4272e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4273e4858974SLluísfi
42749410b56cSPrerna Saxena
42752da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
42762da776dbSMichael R. Hines  echo "CONFIG_RDMA=y" >> $config_host_mak
42772da776dbSMichael R. Hinesfi
42782da776dbSMichael R. Hines
42795b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then
42805b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
42815b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then
42825b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
42835b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then
42845b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
4285c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
42865b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
42875b5e3037SPaolo Bonzinielse
42885b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
42895b5e3037SPaolo Bonzinifi
42905b5e3037SPaolo BonziniQEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
42915b5e3037SPaolo Bonzini
429298ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
429398ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
4294804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
4295804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
42961901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
42971901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
429821655882SPaolo Bonziniif test -n "$libtool"; then
429921655882SPaolo Bonzini  echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
430021655882SPaolo Bonzini  echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
430121655882SPaolo Bonzinielse
43021901cb14SBrad  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
430321655882SPaolo Bonzini  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
430421655882SPaolo Bonzinifi
4305c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
4306804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
4307a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then
4308a31a8642SMichael S. Tsirkin  echo "IASL=$iasl" >> $config_host_mak
4309a31a8642SMichael S. Tsirkinfi
43102b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
4311804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
431283f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak
43133c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak
4314804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
431545d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak
43163dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak
43173dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak
4318804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
4319804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
43209fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
432144dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
4322e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
4323a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
4324f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
4325e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
4326e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
4327e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
4328e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4329e39f0062SPaolo Bonzinifi
433042da6041SGerd Hoffmannif test "$cross_prefix" != ""; then
433142da6041SGerd Hoffmann  echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
433242da6041SGerd Hoffmannelse
433342da6041SGerd Hoffmann  echo "AUTOCONF_HOST := "                             >> $config_host_mak
433442da6041SGerd Hoffmannfi
4335e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
433637746c5eSMarc-André Lureauecho "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
433773da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
43383e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
4339804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
4340957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
434194dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
4342cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
43431d728c39SBlue Swirlif test "$gcov" = "yes" ; then
43441d728c39SBlue Swirl  echo "CONFIG_GCOV=y" >> $config_host_mak
43451d728c39SBlue Swirl  echo "GCOV=$gcov_tool" >> $config_host_mak
43461d728c39SBlue Swirlfi
4347804edf29SJuan Quintela
43486efd7517SPeter Maydell# use included Linux headers
43496efd7517SPeter Maydellif test "$linux" = "yes" ; then
4350a307beb6SAndreas Färber  mkdir -p linux-headers
43516efd7517SPeter Maydell  case "$cpu" in
4352c72b26ecSRichard Henderson  i386|x86_64|x32)
435308312a63SPeter Maydell    linux_arch=x86
43546efd7517SPeter Maydell    ;;
43556efd7517SPeter Maydell  ppcemb|ppc|ppc64)
435608312a63SPeter Maydell    linux_arch=powerpc
43576efd7517SPeter Maydell    ;;
43586efd7517SPeter Maydell  s390x)
435908312a63SPeter Maydell    linux_arch=s390
436008312a63SPeter Maydell    ;;
43611f080313SClaudio Fontana  aarch64)
43621f080313SClaudio Fontana    linux_arch=arm64
43631f080313SClaudio Fontana    ;;
436408312a63SPeter Maydell  *)
436508312a63SPeter Maydell    # For most CPUs the kernel architecture name and QEMU CPU name match.
436608312a63SPeter Maydell    linux_arch="$cpu"
43676efd7517SPeter Maydell    ;;
43686efd7517SPeter Maydell  esac
436908312a63SPeter Maydell    # For non-KVM architectures we will not have asm headers
437008312a63SPeter Maydell    if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
437108312a63SPeter Maydell      symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
437208312a63SPeter Maydell    fi
43736efd7517SPeter Maydellfi
43746efd7517SPeter Maydell
437597a847bcSbellardfor target in $target_list; do
437697a847bcSbellardtarget_dir="$target"
437725be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
4378c1799a84SPaolo Bonzinitarget_name=`echo $target | cut -d '-' -f 1`
437997a847bcSbellardtarget_bigendian="no"
43801f3d3c8fSJuan Quintela
4381c1799a84SPaolo Bonzinicase "$target_name" in
4382d15a9c23SAnthony Green  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
4383ea2d6a39SJuan Quintela  target_bigendian=yes
4384ea2d6a39SJuan Quintela  ;;
4385ea2d6a39SJuan Quintelaesac
438697a847bcSbellardtarget_softmmu="no"
4387997344f3Sbellardtarget_user_only="no"
4388831b7825Sthstarget_linux_user="no"
438984778508Sblueswir1target_bsd_user="no"
43909e407a85Spbrookcase "$target" in
4391c1799a84SPaolo Bonzini  ${target_name}-softmmu)
43929e407a85Spbrook    target_softmmu="yes"
43939e407a85Spbrook    ;;
4394c1799a84SPaolo Bonzini  ${target_name}-linux-user)
43959c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
439676ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a Linux host"
43979c7a4202SBlue Swirl    fi
43989e407a85Spbrook    target_user_only="yes"
43999e407a85Spbrook    target_linux_user="yes"
44009e407a85Spbrook    ;;
4401c1799a84SPaolo Bonzini  ${target_name}-bsd-user)
44029cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
440376ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a BSD host"
44049c7a4202SBlue Swirl    fi
440584778508Sblueswir1    target_user_only="yes"
440684778508Sblueswir1    target_bsd_user="yes"
440784778508Sblueswir1    ;;
44089e407a85Spbrook  *)
440976ad07a4SPeter Maydell    error_exit "Target '$target' not recognised"
44109e407a85Spbrook    exit 1
44119e407a85Spbrook    ;;
44129e407a85Spbrookesac
4413831b7825Sths
441497a847bcSbellardmkdir -p $target_dir
441525be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
441697a847bcSbellard
4417e5fe0c52Spbrookbflt="no"
4418c1799a84SPaolo Bonziniinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
441956aebc89Spbrookgdb_xml_files=""
44207ba1e619Saliguori
4421c1799a84SPaolo BonziniTARGET_ARCH="$target_name"
44226acff7daSJuan QuintelaTARGET_BASE_ARCH=""
4423e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
4424e73aae67SJuan Quintela
4425c1799a84SPaolo Bonzinicase "$target_name" in
44262408a527Saurel32  i386)
44272408a527Saurel32  ;;
44282408a527Saurel32  x86_64)
44296acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
44302408a527Saurel32  ;;
44312408a527Saurel32  alpha)
44322408a527Saurel32  ;;
44332408a527Saurel32  arm|armeb)
4434b498c8a0SJuan Quintela    TARGET_ARCH=arm
4435e5fe0c52Spbrook    bflt="yes"
443656aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
44372408a527Saurel32  ;;
44386a49fa95SAlexander Graf  aarch64)
44396a49fa95SAlexander Graf    TARGET_BASE_ARCH=arm
44406a49fa95SAlexander Graf    bflt="yes"
44416a669427SPeter Maydell    gdb_xml_files="aarch64-core.xml aarch64-fpu.xml"
44426a49fa95SAlexander Graf  ;;
44432408a527Saurel32  cris)
44442408a527Saurel32  ;;
4445613a22c9SMichael Walle  lm32)
4446613a22c9SMichael Walle  ;;
44472408a527Saurel32  m68k)
44480938cda5Saurel32    bflt="yes"
444956aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
44502408a527Saurel32  ;;
4451877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
4452877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
445372b675caSEdgar E. Iglesias    bflt="yes"
445472b675caSEdgar E. Iglesias  ;;
44552408a527Saurel32  mips|mipsel)
4456b498c8a0SJuan Quintela    TARGET_ARCH=mips
445725be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
44582408a527Saurel32  ;;
44592408a527Saurel32  mipsn32|mipsn32el)
4460597e2cecSRichard Henderson    TARGET_ARCH=mips64
44616acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
446225be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4463597e2cecSRichard Henderson    echo "TARGET_ABI32=y" >> $config_target_mak
44642408a527Saurel32  ;;
44652408a527Saurel32  mips64|mips64el)
4466b498c8a0SJuan Quintela    TARGET_ARCH=mips64
44676acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
446825be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
44692408a527Saurel32  ;;
4470d15a9c23SAnthony Green  moxie)
4471d15a9c23SAnthony Green  ;;
4472e67db06eSJia Liu  or32)
4473e67db06eSJia Liu    TARGET_ARCH=openrisc
4474e67db06eSJia Liu    TARGET_BASE_ARCH=openrisc
4475e67db06eSJia Liu  ;;
44762408a527Saurel32  ppc)
4477c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44782408a527Saurel32  ;;
44792408a527Saurel32  ppcemb)
44806acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4481e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4482c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44832408a527Saurel32  ;;
44842408a527Saurel32  ppc64)
44856acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4486e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4487c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44882408a527Saurel32  ;;
44892408a527Saurel32  ppc64abi32)
4490b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
44916acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4492e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
449325be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
4494c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44952408a527Saurel32  ;;
44962408a527Saurel32  sh4|sh4eb)
4497b498c8a0SJuan Quintela    TARGET_ARCH=sh4
44984dbed897Spbrook    bflt="yes"
44992408a527Saurel32  ;;
45002408a527Saurel32  sparc)
45012408a527Saurel32  ;;
45022408a527Saurel32  sparc64)
45036acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
45042408a527Saurel32  ;;
45052408a527Saurel32  sparc32plus)
4506b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
45076acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4508e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
450925be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
45102408a527Saurel32  ;;
451124e804ecSAlexander Graf  s390x)
451224e804ecSAlexander Graf  ;;
4513d2fbca94SGuan Xuetao  unicore32)
4514d2fbca94SGuan Xuetao  ;;
4515cfa550c6SMax Filippov  xtensa|xtensaeb)
4516cfa550c6SMax Filippov    TARGET_ARCH=xtensa
4517cfa550c6SMax Filippov  ;;
45182408a527Saurel32  *)
451976ad07a4SPeter Maydell    error_exit "Unsupported target CPU"
45202408a527Saurel32  ;;
45212408a527Saurel32esac
45225e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
45235e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
45245e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
45255e8861a0SPaolo Bonzinifi
45265e8861a0SPaolo Bonzini
45275e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
45285e8861a0SPaolo Bonzini
452999afc91dSDaniel P. Berrangeupper() {
453099afc91dSDaniel P. Berrange    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
453199afc91dSDaniel P. Berrange}
453299afc91dSDaniel P. Berrange
453399afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`"
453425be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
4535c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak
453625be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4537e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
4538e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
4539e6e91b9cSJuan Quintelafi
454025be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
4541c1799a84SPaolo Bonzinicase "$target_name" in
45421b0c87fcSJuan Quintela  i386|x86_64)
45431b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
454425be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
4545eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
4546eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4547eb6fda0fSAnthony PERARD      fi
4548432d268cSJun Nakajima    fi
454959d21e53SAlexander Graf    ;;
455059d21e53SAlexander Graf  *)
45511b0c87fcSJuan Quintelaesac
4552c1799a84SPaolo Bonzinicase "$target_name" in
455370a5f682SPeter Maydell  aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4554c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
4555c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4556c1799a84SPaolo Bonzini      \( "$target_name" = "$cpu" -o \
4557c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4558c1799a84SPaolo Bonzini      \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4559c1799a84SPaolo Bonzini      \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4560c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4561c1799a84SPaolo Bonzini      \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
4562c1799a84SPaolo Bonzini      \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
456325be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
45641ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
4565d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4566d5970055SMichael S. Tsirkin      fi
4567c59249f9SJuan Quintela    fi
4568c59249f9SJuan Quintelaesac
4569de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
457025be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
457197a847bcSbellardfi
457297a847bcSbellardif test "$target_softmmu" = "yes" ; then
457325be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4574de83cd02Sbellardfi
4575997344f3Sbellardif test "$target_user_only" = "yes" ; then
457625be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4577a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4578997344f3Sbellardfi
4579831b7825Sthsif test "$target_linux_user" = "yes" ; then
458025be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4581831b7825Sthsfi
458256aebc89Spbrooklist=""
458356aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
458456aebc89Spbrook  for x in $gdb_xml_files; do
458556aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
458656aebc89Spbrook  done
458725be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
45883d0f1517SJuan Quintelafi
4589de83cd02Sbellard
4590e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
459125be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4592e5fe0c52Spbrookfi
4593379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
459425be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4595379f6698SPaul Brookfi
459684778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
459725be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
459884778508Sblueswir1fi
45995b0753e0Sbellard
46004afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
4601fa282484SJuan Quintela
46024afddb55SJuan Quintelacflags=""
4603fa282484SJuan Quintelaldflags=""
46049b8e111fSJuan Quintela
460564656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
460664656024SJuan Quintela  case "$i" in
460764656024SJuan Quintela  alpha)
460825be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
460976cad711SPaolo Bonzini    echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
461064656024SJuan Quintela  ;;
461164656024SJuan Quintela  arm)
461225be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
461376cad711SPaolo Bonzini    echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
461464656024SJuan Quintela  ;;
461564656024SJuan Quintela  cris)
461625be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
461776cad711SPaolo Bonzini    echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
461864656024SJuan Quintela  ;;
461964656024SJuan Quintela  hppa)
462025be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
462176cad711SPaolo Bonzini    echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
462264656024SJuan Quintela  ;;
4623c72b26ecSRichard Henderson  i386|x86_64|x32)
462425be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
462576cad711SPaolo Bonzini    echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
462664656024SJuan Quintela  ;;
4627903ec55cSAurelien Jarno  ia64*)
4628903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
462976cad711SPaolo Bonzini    echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4630903ec55cSAurelien Jarno  ;;
463179368f49SMichael Walle  lm32)
463279368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
463376cad711SPaolo Bonzini    echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
463479368f49SMichael Walle  ;;
463564656024SJuan Quintela  m68k)
463625be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
463776cad711SPaolo Bonzini    echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
463864656024SJuan Quintela  ;;
4639877fdc12SEdgar E. Iglesias  microblaze*)
464025be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
464176cad711SPaolo Bonzini    echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
464264656024SJuan Quintela  ;;
464364656024SJuan Quintela  mips*)
464425be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
464576cad711SPaolo Bonzini    echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
464664656024SJuan Quintela  ;;
4647d15a9c23SAnthony Green  moxie*)
4648d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> $config_target_mak
4649d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> config-all-disas.mak
4650d15a9c23SAnthony Green  ;;
4651e67db06eSJia Liu  or32)
4652e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
465376cad711SPaolo Bonzini    echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4654e67db06eSJia Liu  ;;
465564656024SJuan Quintela  ppc*)
465625be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
465776cad711SPaolo Bonzini    echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
465864656024SJuan Quintela  ;;
465924e804ecSAlexander Graf  s390*)
466025be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
466176cad711SPaolo Bonzini    echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
466264656024SJuan Quintela  ;;
466364656024SJuan Quintela  sh4)
466425be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
466576cad711SPaolo Bonzini    echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
466664656024SJuan Quintela  ;;
466764656024SJuan Quintela  sparc*)
466825be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
466976cad711SPaolo Bonzini    echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
467064656024SJuan Quintela  ;;
4671cfa550c6SMax Filippov  xtensa*)
4672cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
467376cad711SPaolo Bonzini    echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
4674cfa550c6SMax Filippov  ;;
467564656024SJuan Quintela  esac
467664656024SJuan Quinteladone
46779195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
46789195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
467976cad711SPaolo Bonzini  echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
46809195b2c2SStefan Weilfi
468164656024SJuan Quintela
46826ee7126fSJuan Quintelacase "$ARCH" in
46836ee7126fSJuan Quintelaalpha)
46846ee7126fSJuan Quintela  # Ensure there's only a single GP
46856ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
46866ee7126fSJuan Quintela;;
46876ee7126fSJuan Quintelaesac
46886ee7126fSJuan Quintela
4689d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
469025be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
4691d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
4692d02c1db3SJuan Quintela    cflags="-p $cflags"
4693d02c1db3SJuan Quintela    ldflags="-p $ldflags"
4694d02c1db3SJuan Quintela  fi
4695d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
4696d02c1db3SJuan Quintela    ldflags="-p $ldflags"
469725be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
4698d02c1db3SJuan Quintela  fi
4699d02c1db3SJuan Quintelafi
4700d02c1db3SJuan Quintela
47019b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4702964c6fa1SRichard Henderson  ldflags="$ldflags $textseg_ldflags"
4703fa282484SJuan Quintelafi
4704fa282484SJuan Quintela
470525be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
470625be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4707fa282484SJuan Quintela
470897a847bcSbellarddone # for target in $targets
47097d13299dSbellard
4710b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then
4711b776eca1SGerd Hoffmann  echo "config-host.h: subdir-pixman" >> $config_host_mak
4712b776eca1SGerd Hoffmannfi
4713b776eca1SGerd Hoffmann
47142da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
47152da776dbSMichael R. Hinesecho "CONFIG_RDMA=y" >> $config_host_mak
47162da776dbSMichael R. Hinesfi
47172da776dbSMichael R. Hines
4718a540f158SPeter Crosthwaiteif [ "$dtc_internal" = "yes" ]; then
4719a540f158SPeter Crosthwaite  echo "config-host.h: subdir-dtc" >> $config_host_mak
4720a540f158SPeter Crosthwaitefi
4721a540f158SPeter Crosthwaite
4722d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
4723f93296eaSWenchao XiaDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
47242b170effSMichael TokarevDIRS="$DIRS fsdev"
47259933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
47262d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
47272dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
4728c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4729c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
4730aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
4731ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4732446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
47339933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile"
47342d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
47354652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp"
4736753d11f2SRichard Hendersonfor bios_file in \
4737753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
47385acc2ec0SGerd Hoffmann    $source_path/pc-bios/*.aml \
4739753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
4740753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
4741e89e33e1SDominik Dingel    $source_path/pc-bios/*.img \
4742753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
4743753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
4744753d11f2SRichard Hendersondo
47457ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
47467ea78b74SJan Kiszkadone
4747d1807a4fSPaolo Bonzinimkdir -p $DIRS
47487d13299dSbellardfor f in $FILES ; do
474972b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4750f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
4751f9245e10SPeter Maydell    fi
47527d13299dSbellarddone
47531ad2134fSPaul Brook
4754c34ebfdcSAnthony Liguori# temporary config to build submodules
47552d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
4756c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
475737116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4758c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
47593dd46c78SBlue Swirl    echo "AS=$as" >> $config_mak
4760c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4761c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
47623dd46c78SBlue Swirl    echo "CPP=$cpp" >> $config_mak
4763c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4764a31a8642SMichael S. Tsirkin    echo "IASL=$iasl" >> $config_mak
4765c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4766c34ebfdcSAnthony Liguoridone
4767c34ebfdcSAnthony Liguori
4768b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4769b40292e7SJan Kiszka  mkdir -p QMP
4770b40292e7SJan Kiszkafi
4771