xref: /openbmc/qemu/configure (revision e007dbece5fc4e55e10116c6cb42753e35a945bf)
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=""
172e2134eb9SGerd Hoffmannpixman=""
173377529c0SPaolo Bonzinisdl=""
174983eef5aSMeador Ingevirtfs=""
175821601eaSJes Sorensenvnc="yes"
176377529c0SPaolo Bonzinisparse="no"
177377529c0SPaolo Bonziniuuid=""
178377529c0SPaolo Bonzinivde=""
179377529c0SPaolo Bonzinivnc_tls=""
180377529c0SPaolo Bonzinivnc_sasl=""
181377529c0SPaolo Bonzinivnc_jpeg=""
182377529c0SPaolo Bonzinivnc_png=""
1837536ee4bSTim Hardeckvnc_ws=""
184377529c0SPaolo Bonzinixen=""
185d5b93ddfSAnthony PERARDxen_ctrl_version=""
186eb6fda0fSAnthony PERARDxen_pci_passthrough=""
187377529c0SPaolo Bonzinilinux_aio=""
18847e98658SCorey Bryantcap_ng=""
189377529c0SPaolo Bonziniattr=""
1904f26f2b6SAvi Kivitylibattr=""
191377529c0SPaolo Bonzinixfs=""
192377529c0SPaolo Bonzini
193d41a75a2SBradvhost_net="no"
1945e9be92dSNicholas Bellingervhost_scsi="no"
195d41a75a2SBradkvm="no"
1962da776dbSMichael R. Hinesrdma=""
197377529c0SPaolo Bonzinigprof="no"
198377529c0SPaolo Bonzinidebug_tcg="no"
199377529c0SPaolo Bonzinidebug="no"
200377529c0SPaolo Bonzinistrip_opt="yes"
2019195b2c2SStefan Weiltcg_interpreter="no"
202377529c0SPaolo Bonzinibigendian="no"
203377529c0SPaolo Bonzinimingw32="no"
2041d728c39SBlue Swirlgcov="no"
2051d728c39SBlue Swirlgcov_tool="gcov"
206377529c0SPaolo BonziniEXESUF=""
207377529c0SPaolo Bonziniprefix="/usr/local"
208377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
209528ae5b8SEduardo Habkostdatadir="\${prefix}/share"
210850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu"
211377529c0SPaolo Bonzinibindir="\${prefix}/bin"
2123aa5d2beSAlon Levylibdir="\${prefix}/lib"
2138bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec"
2140f94d6daSAlon Levyincludedir="\${prefix}/include"
215377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
216785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var"
217377529c0SPaolo Bonziniconfsuffix="/qemu"
218377529c0SPaolo Bonzinislirp="yes"
219377529c0SPaolo Bonzinifmod_lib=""
220377529c0SPaolo Bonzinifmod_inc=""
221377529c0SPaolo Bonzinioss_lib=""
222377529c0SPaolo Bonzinibsd="no"
223377529c0SPaolo Bonzinilinux="no"
224377529c0SPaolo Bonzinisolaris="no"
225377529c0SPaolo Bonziniprofiler="no"
226377529c0SPaolo Bonzinicocoa="no"
227377529c0SPaolo Bonzinisoftmmu="yes"
228377529c0SPaolo Bonzinilinux_user="no"
229377529c0SPaolo Bonzinibsd_user="no"
23030163d89SPeter Maydellguest_base="yes"
231377529c0SPaolo Bonziniuname_release=""
232377529c0SPaolo Bonziniaix="no"
233377529c0SPaolo Bonziniblobs="yes"
234377529c0SPaolo Bonzinipkgversion=""
23540d6444eSAvi Kivitypie=""
236377529c0SPaolo Bonzinizero_malloc=""
2373556c233SPaolo Bonziniqom_cast_debug="yes"
238377529c0SPaolo Bonzinitrace_backend="nop"
239377529c0SPaolo Bonzinitrace_file="trace"
240377529c0SPaolo Bonzinispice=""
241377529c0SPaolo Bonzinirbd=""
242111a38b0SRobert Relyeasmartcard_nss=""
2432b2325ffSGerd Hoffmannlibusb=""
24469354a83SHans de Goedeusb_redir=""
245b1e5fff4SMichael Walleglx=""
2461ece9905SAlon Levyzlib="yes"
247e8ef31a3SMichael Tokarevguest_agent=""
248d9840e25STomoki Sekiyamaguest_agent_with_vss="no"
249d9840e25STomoki Sekiyamavss_win32_sdk=""
250d9840e25STomoki Sekiyamawin_sdk="no"
2514b1c11fdSDaniel P. Berrangewant_tools="yes"
252c589b249SRonnie Sahlberglibiscsi=""
253519175a2SAlex Barcelocoroutine=""
25470c60c08SStefan Hajnoczicoroutine_pool=""
255f794573eSEduardo Otuboseccomp=""
256eb100396SBharata B Raoglusterfs=""
2570c14fb47SBharata B Raoglusterfs_discard="no"
258583f6e7bSStefan Hajnoczivirtio_blk_data_plane=""
259a4ccabcfSAnthony Liguorigtk=""
260528de90aSDaniel P. Berrangegtkabi="2.0"
261ab214c29SStefan Bergertpm="no"
2620a12ec87SRichard W.M. Joneslibssh2=""
2634f18b782SJeff Codyvhdx=""
264377529c0SPaolo Bonzini
265ac0df51dSaliguori# parse CC options first
266ac0df51dSaliguorifor opt do
267ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
268ac0df51dSaliguori  case "$opt" in
269ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
270ac0df51dSaliguori  ;;
2713d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
272ac0df51dSaliguori  ;;
27383f73fceSTomoki Sekiyama  --cxx=*) CXX="$optarg"
27483f73fceSTomoki Sekiyama  ;;
275ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
276ca4deeb1SPaolo Bonzini  ;;
2772ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2782ff6b91eSJuan Quintela  ;;
279a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
280f9943cd5SGerd Hoffmann                    EXTRA_CFLAGS="$optarg"
281e2a2ed06SJuan Quintela  ;;
282e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
283f9943cd5SGerd Hoffmann                     EXTRA_LDFLAGS="$optarg"
284e2a2ed06SJuan Quintela  ;;
2855bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2865bc62e01SGerd Hoffmann  ;;
2875bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2885bc62e01SGerd Hoffmann  ;;
289ac0df51dSaliguori  esac
290ac0df51dSaliguoridone
291ac0df51dSaliguori# OS specific
292ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
29393148aa5SStefan Weil# we can eliminate its usage altogether.
294ac0df51dSaliguori
295e49d021eSPeter Maydell# Preferred compiler:
296e49d021eSPeter Maydell#  ${CC} (if set)
297e49d021eSPeter Maydell#  ${cross_prefix}gcc (if cross-prefix specified)
298e49d021eSPeter Maydell#  system compiler
299e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then
300e49d021eSPeter Maydell  cc="$host_cc"
301e49d021eSPeter Maydellelse
302b3198cc2SStuart Yoder  cc="${CC-${cross_prefix}gcc}"
303e49d021eSPeter Maydellfi
304e49d021eSPeter Maydell
30583f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then
30683f73fceSTomoki Sekiyama  cxx="c++"
30783f73fceSTomoki Sekiyamaelse
30883f73fceSTomoki Sekiyama  cxx="${CXX-${cross_prefix}g++}"
30983f73fceSTomoki Sekiyamafi
31083f73fceSTomoki Sekiyama
311b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
3123dd46c78SBlue Swirlas="${AS-${cross_prefix}as}"
3133dd46c78SBlue Swirlcpp="${CPP-$cc -E}"
314b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
315b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
3163f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
317b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
318b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
31917884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
32017884d7bSSergei Trofimovichquery_pkg_config() {
32117884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
32217884d7bSSergei Trofimovich}
32317884d7bSSergei Trofimovichpkg_config=query_pkg_config
324b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
325ac0df51dSaliguori
326be17dc90SMichael S. Tsirkin# default flags for all hosts
327be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
328f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
329c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
330be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
3316b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
3325bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
3335bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
334be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
3355bc62e01SGerd Hoffmannfi
336be17dc90SMichael S. Tsirkin
337ca4deeb1SPaolo Bonzini# make source path absolute
338ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
339ca4deeb1SPaolo Bonzini
340ac0df51dSaliguoricheck_define() {
341ac0df51dSaliguoricat > $TMPC <<EOF
342ac0df51dSaliguori#if !defined($1)
343fd786e1aSPeter Maydell#error $1 not defined
344ac0df51dSaliguori#endif
345ac0df51dSaliguoriint main(void) { return 0; }
346ac0df51dSaliguoriEOF
34752166aa0SJuan Quintela  compile_object
348ac0df51dSaliguori}
349ac0df51dSaliguori
350bbea4050SPeter Maydellif check_define __linux__ ; then
351bbea4050SPeter Maydell  targetos="Linux"
352bbea4050SPeter Maydellelif check_define _WIN32 ; then
353bbea4050SPeter Maydell  targetos='MINGW32'
354bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then
355bbea4050SPeter Maydell  targetos='OpenBSD'
356bbea4050SPeter Maydellelif check_define __sun__ ; then
357bbea4050SPeter Maydell  targetos='SunOS'
358bbea4050SPeter Maydellelif check_define __HAIKU__ ; then
359bbea4050SPeter Maydell  targetos='Haiku'
360bbea4050SPeter Maydellelse
361bbea4050SPeter Maydell  targetos=`uname -s`
362bbea4050SPeter Maydellfi
363bbea4050SPeter Maydell
364bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use.
365bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're
366bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify
367bbea4050SPeter Maydell# the correct CPU with the --cpu option.
368bbea4050SPeter Maydellcase $targetos in
369bbea4050SPeter MaydellDarwin)
370bbea4050SPeter Maydell  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
371bbea4050SPeter Maydell  # run 64-bit userspace code.
372bbea4050SPeter Maydell  # If the user didn't specify a CPU explicitly and the kernel says this is
373bbea4050SPeter Maydell  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
374bbea4050SPeter Maydell  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
375bbea4050SPeter Maydell    cpu="x86_64"
376bbea4050SPeter Maydell  fi
377bbea4050SPeter Maydell  ;;
378bbea4050SPeter MaydellSunOS)
379bbea4050SPeter Maydell  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
380bbea4050SPeter Maydell  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
381bbea4050SPeter Maydell    cpu="x86_64"
382bbea4050SPeter Maydell  fi
383bbea4050SPeter Maydellesac
384bbea4050SPeter Maydell
3852ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
3862ff6b91eSJuan Quintela  # command line argument
3872ff6b91eSJuan Quintela  :
3882ff6b91eSJuan Quintelaelif check_define __i386__ ; then
389ac0df51dSaliguori  cpu="i386"
390ac0df51dSaliguorielif check_define __x86_64__ ; then
391c72b26ecSRichard Henderson  if check_define __ILP32__ ; then
392c72b26ecSRichard Henderson    cpu="x32"
393c72b26ecSRichard Henderson  else
394ac0df51dSaliguori    cpu="x86_64"
395c72b26ecSRichard Henderson  fi
3963aa9bd6cSblueswir1elif check_define __sparc__ ; then
3973aa9bd6cSblueswir1  if check_define __arch64__ ; then
3983aa9bd6cSblueswir1    cpu="sparc64"
3993aa9bd6cSblueswir1  else
4003aa9bd6cSblueswir1    cpu="sparc"
4013aa9bd6cSblueswir1  fi
402fdf7ed96Smalcelif check_define _ARCH_PPC ; then
403fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
404fdf7ed96Smalc    cpu="ppc64"
405ac0df51dSaliguori  else
406fdf7ed96Smalc    cpu="ppc"
407fdf7ed96Smalc  fi
408afa05235SAurelien Jarnoelif check_define __mips__ ; then
409afa05235SAurelien Jarno  cpu="mips"
410477ba620SAurelien Jarnoelif check_define __ia64__ ; then
411477ba620SAurelien Jarno  cpu="ia64"
412d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
413d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
414d66ed0eaSAurelien Jarno    cpu="s390x"
415d66ed0eaSAurelien Jarno  else
416d66ed0eaSAurelien Jarno    cpu="s390"
417d66ed0eaSAurelien Jarno  fi
41821d89f84SPeter Maydellelif check_define __arm__ ; then
41921d89f84SPeter Maydell  cpu="arm"
4201f080313SClaudio Fontanaelif check_define __aarch64__ ; then
4211f080313SClaudio Fontana  cpu="aarch64"
422f28ffed5SBradelif check_define __hppa__ ; then
423f28ffed5SBrad  cpu="hppa"
424fdf7ed96Smalcelse
425fdf7ed96Smalc  cpu=`uname -m`
426ac0df51dSaliguorifi
427ac0df51dSaliguori
428359bc95dSPeter MaydellARCH=
429359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
430359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
4317d13299dSbellardcase "$cpu" in
432c72b26ecSRichard Henderson  ia64|ppc|ppc64|s390|s390x|sparc64|x32)
433ea8f20f8SJuan Quintela    cpu="$cpu"
434ea8f20f8SJuan Quintela  ;;
4357d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
43697a847bcSbellard    cpu="i386"
4377d13299dSbellard  ;;
438aaa5fa14Saurel32  x86_64|amd64)
439aaa5fa14Saurel32    cpu="x86_64"
440aaa5fa14Saurel32  ;;
44121d89f84SPeter Maydell  armv*b|armv*l|arm)
44221d89f84SPeter Maydell    cpu="arm"
4437d13299dSbellard  ;;
4441f080313SClaudio Fontana  aarch64)
4451f080313SClaudio Fontana    cpu="aarch64"
4461f080313SClaudio Fontana  ;;
447afa05235SAurelien Jarno  mips*)
448afa05235SAurelien Jarno    cpu="mips"
449afa05235SAurelien Jarno  ;;
4503142255cSblueswir1  sparc|sun4[cdmuv])
451ae228531Sbellard    cpu="sparc"
452ae228531Sbellard  ;;
4537d13299dSbellard  *)
454359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
455359bc95dSPeter Maydell    ARCH=unknown
4567d13299dSbellard  ;;
4577d13299dSbellardesac
458359bc95dSPeter Maydellif test -z "$ARCH"; then
459359bc95dSPeter Maydell  ARCH="$cpu"
460359bc95dSPeter Maydellfi
461e2d52ad3SJuan Quintela
4627d13299dSbellard# OS specific
4630dbfc675SJuan Quintela
4647d13299dSbellardcase $targetos in
465c326e0afSbellardCYGWIN*)
466c326e0afSbellard  mingw32="yes"
467a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
468d5631638Smalc  audio_possible_drivers="winwave sdl"
469d5631638Smalc  audio_drv_list="winwave"
470c326e0afSbellard;;
47167b915a5SbellardMINGW32*)
47267b915a5Sbellard  mingw32="yes"
473d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
474d5631638Smalc  audio_drv_list="winwave"
47567b915a5Sbellard;;
4765c40d2bdSthsGNU/kFreeBSD)
477a167ba50SAurelien Jarno  bsd="yes"
4780c58ac1cSmalc  audio_drv_list="oss"
479f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
4805c40d2bdSths;;
4817d3505c5SbellardFreeBSD)
4827d3505c5Sbellard  bsd="yes"
4830db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4840c58ac1cSmalc  audio_drv_list="oss"
485f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
486f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
487f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
4887d3505c5Sbellard;;
489c5e97233Sblueswir1DragonFly)
490c5e97233Sblueswir1  bsd="yes"
4910db4a067SPaolo Bonzini  make="${MAKE-gmake}"
492c5e97233Sblueswir1  audio_drv_list="oss"
493c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
494c5e97233Sblueswir1;;
4957d3505c5SbellardNetBSD)
4967d3505c5Sbellard  bsd="yes"
4970db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4980c58ac1cSmalc  audio_drv_list="oss"
499c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
5008ef92a88Sblueswir1  oss_lib="-lossaudio"
5017d3505c5Sbellard;;
5027d3505c5SbellardOpenBSD)
5037d3505c5Sbellard  bsd="yes"
5040db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5054f6ab397SBrad Smith  audio_drv_list="sdl"
5064f6ab397SBrad Smith  audio_possible_drivers="sdl esd"
5077d3505c5Sbellard;;
50883fb7adfSbellardDarwin)
50983fb7adfSbellard  bsd="yes"
51083fb7adfSbellard  darwin="yes"
5111b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
512a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
5130c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
5141b0f9cc2Saliguori  else
515a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
5161b0f9cc2Saliguori  fi
517fd677642Sths  cocoa="yes"
5180c58ac1cSmalc  audio_drv_list="coreaudio"
519c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
5200c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
5217973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
522a0b7cf6bSPeter Maydell  # Disable attempts to use ObjectiveC features in os/object.h since they
523a0b7cf6bSPeter Maydell  # won't work when we're compiling with gcc as a C compiler.
524a0b7cf6bSPeter Maydell  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
52583fb7adfSbellard;;
526ec530c81SbellardSunOS)
527ec530c81Sbellard  solaris="yes"
5280db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5290db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
530fa58948dSBlue Swirl  ld="gld"
531e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
5320475a5caSths  needs_libsunmath="no"
533c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
534c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
5350475a5caSths    if test "$solarisrev" -le 9 ; then
5360475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
5370475a5caSths        needs_libsunmath="yes"
538f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
539f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
540f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
5410475a5caSths      else
54276ad07a4SPeter Maydell        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
54376ad07a4SPeter Maydell            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
54476ad07a4SPeter Maydell            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
54576ad07a4SPeter Maydell            "Studio 11 can be downloaded from www.sun.com."
5460475a5caSths      fi
5470475a5caSths    fi
54886b2bd93Sths  fi
5496b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
5500c58ac1cSmalc    audio_drv_list="oss"
5516b4d2ba1Sths  fi
552c2de5c91Smalc  audio_possible_drivers="oss sdl"
553d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
554d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
555d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
556d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
557a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
558560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
559560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
560560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
561ec530c81Sbellard;;
562b29fe3edSmalcAIX)
563b29fe3edSmalc  aix="yes"
5640db4a067SPaolo Bonzini  make="${MAKE-gmake}"
565b29fe3edSmalc;;
566179cf400SAndreas FärberHaiku)
567179cf400SAndreas Färber  haiku="yes"
568179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
569179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
570179cf400SAndreas Färber;;
571fb065187Sbellard*)
5720c58ac1cSmalc  audio_drv_list="oss"
573b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
5745327cf48Sbellard  linux="yes"
575831b7825Sths  linux_user="yes"
576af2be207SJan Kiszka  kvm="yes"
577af2be207SJan Kiszka  vhost_net="yes"
5785e9be92dSNicholas Bellinger  vhost_scsi="yes"
579c72b26ecSRichard Henderson  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
580c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
581c9ec1fe4Sbellard  fi
582a585140dSAlexey Kardashevskiy  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
583fb065187Sbellard;;
5847d13299dSbellardesac
5857d13299dSbellard
5867d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
587b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
58884778508Sblueswir1    bsd_user="yes"
5897d3505c5Sbellard  fi
59008de3949SAndreas Färberfi
5917d3505c5Sbellard
5920db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5930db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
59452510f8bSStefan Weil: ${python=${PYTHON-python}}
595e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5960db4a067SPaolo Bonzini
5973c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC
5983c4a4d0dSPeter Maydellif has clang; then
5993c4a4d0dSPeter Maydell  objcc=clang
6003c4a4d0dSPeter Maydellelse
6013c4a4d0dSPeter Maydell  objcc="$cc"
6023c4a4d0dSPeter Maydellfi
6033c4a4d0dSPeter Maydell
6043457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
6053457a3f8SJuan Quintela  EXESUF=".exe"
606a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
607e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
608e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
609f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
610f7cf5d5bSStefan Weilcat > $TMPC << EOF
611f7cf5d5bSStefan Weilint main(void) { return 0; }
612f7cf5d5bSStefan WeilEOF
613f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
614f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
615f7cf5d5bSStefan Weil  fi
616c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
617683035deSPaolo Bonzini  mandir="\${prefix}"
618528ae5b8SEduardo Habkost  datadir="\${prefix}"
619850da188SEduardo Habkost  qemu_docdir="\${prefix}"
620683035deSPaolo Bonzini  bindir="\${prefix}"
621683035deSPaolo Bonzini  sysconfdir="\${prefix}"
6225a699bbbSLaszlo Ersek  local_statedir=
623683035deSPaolo Bonzini  confsuffix=""
624368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
6253457a3f8SJuan Quintelafi
6263457a3f8SJuan Quintela
627487fefdbSAnthony Liguoriwerror=""
62885aa5189Sbellard
6297d13299dSbellardfor opt do
630a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
6317d13299dSbellard  case "$opt" in
6322efc3265Sbellard  --help|-h) show_help=yes
6332efc3265Sbellard  ;;
63499123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
63599123e13SMike Frysinger  ;;
636b1a550a0Spbrook  --prefix=*) prefix="$optarg"
6377d13299dSbellard  ;;
638b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
63932ce6337Sbellard  ;;
640ca4deeb1SPaolo Bonzini  --source-path=*)
6417d13299dSbellard  ;;
642ac0df51dSaliguori  --cross-prefix=*)
6437d13299dSbellard  ;;
644ac0df51dSaliguori  --cc=*)
6457d13299dSbellard  ;;
646b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
64783469015Sbellard  ;;
64883f73fceSTomoki Sekiyama  --cxx=*)
64983f73fceSTomoki Sekiyama  ;;
650*e007dbecSMichael S. Tsirkin  --iasl=*) iasl="$optarg"
651*e007dbecSMichael S. Tsirkin  ;;
6523c4a4d0dSPeter Maydell  --objcc=*) objcc="$optarg"
6533c4a4d0dSPeter Maydell  ;;
654b1a550a0Spbrook  --make=*) make="$optarg"
6557d13299dSbellard  ;;
6566a882643Spbrook  --install=*) install="$optarg"
6576a882643Spbrook  ;;
658c886edfbSBlue Swirl  --python=*) python="$optarg"
659c886edfbSBlue Swirl  ;;
6601d728c39SBlue Swirl  --gcov=*) gcov_tool="$optarg"
6611d728c39SBlue Swirl  ;;
662e2d8830eSBrad  --smbd=*) smbd="$optarg"
663e2d8830eSBrad  ;;
664e2a2ed06SJuan Quintela  --extra-cflags=*)
6657d13299dSbellard  ;;
666e2a2ed06SJuan Quintela  --extra-ldflags=*)
6677d13299dSbellard  ;;
6685bc62e01SGerd Hoffmann  --enable-debug-info)
6695bc62e01SGerd Hoffmann  ;;
6705bc62e01SGerd Hoffmann  --disable-debug-info)
6715bc62e01SGerd Hoffmann  ;;
6722ff6b91eSJuan Quintela  --cpu=*)
6737d13299dSbellard  ;;
674b1a550a0Spbrook  --target-list=*) target_list="$optarg"
675de83cd02Sbellard  ;;
67674242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
67794a420b1SStefan Hajnoczi  ;;
67874242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
6799410b56cSPrerna Saxena  ;;
6807d13299dSbellard  --enable-gprof) gprof="yes"
6817d13299dSbellard  ;;
6821d728c39SBlue Swirl  --enable-gcov) gcov="yes"
6831d728c39SBlue Swirl  ;;
68479427693SLoïc Minier  --static)
68579427693SLoïc Minier    static="yes"
68679427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
68717884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
68843ce4dfeSbellard  ;;
6890b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
6900b24e75fSPaolo Bonzini  ;;
6910b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
6920b24e75fSPaolo Bonzini  ;;
6933aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
6943aa5d2beSAlon Levy  ;;
6958bf188aaSMichael Tokarev  --libexecdir=*) libexecdir="$optarg"
6968bf188aaSMichael Tokarev  ;;
6970f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
6980f94d6daSAlon Levy  ;;
699528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
7000b24e75fSPaolo Bonzini  ;;
701023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
702023d3d67SEduardo Habkost  ;;
703850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
7040b24e75fSPaolo Bonzini  ;;
705ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
70607381cc1SAnthony Liguori  ;;
707785c23aeSLuiz Capitulino  --localstatedir=*) local_statedir="$optarg"
708785c23aeSLuiz Capitulino  ;;
709785c23aeSLuiz Capitulino  --sbindir=*|--sharedstatedir=*|\
710023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
711023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
712023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
713023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
714023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
715023ddd74SMax Filippov    # lots of directory switches by default.
716023ddd74SMax Filippov  ;;
717e2134eb9SGerd Hoffmann  --with-system-pixman) pixman="system"
718e2134eb9SGerd Hoffmann  ;;
719e2134eb9SGerd Hoffmann  --without-system-pixman) pixman="internal"
720e2134eb9SGerd Hoffmann  ;;
72174880fe2SRobert Schiele  --without-pixman) pixman="none"
72274880fe2SRobert Schiele  ;;
72397a847bcSbellard  --disable-sdl) sdl="no"
72497a847bcSbellard  ;;
725c4198157SJuan Quintela  --enable-sdl) sdl="yes"
726c4198157SJuan Quintela  ;;
7273556c233SPaolo Bonzini  --disable-qom-cast-debug) qom_cast_debug="no"
7283556c233SPaolo Bonzini  ;;
7293556c233SPaolo Bonzini  --enable-qom-cast-debug) qom_cast_debug="yes"
7303556c233SPaolo Bonzini  ;;
731983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
732983eef5aSMeador Inge  ;;
733983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
734983eef5aSMeador Inge  ;;
735821601eaSJes Sorensen  --disable-vnc) vnc="no"
736821601eaSJes Sorensen  ;;
737821601eaSJes Sorensen  --enable-vnc) vnc="yes"
738821601eaSJes Sorensen  ;;
739b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
740102a52e4Sbellard  ;;
741c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
742c2de5c91Smalc  ;;
7432f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
7442f6a1ab0Sblueswir1  ;;
7450c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
7460c58ac1cSmalc  ;;
747b64ec4e4SFam Zheng  --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
748b64ec4e4SFam Zheng  ;;
749b64ec4e4SFam Zheng  --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
750eb852011SMarkus Armbruster  ;;
751f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
752f8393946Saurel32  ;;
753f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
754f8393946Saurel32  ;;
755f3d08ee6SPaul Brook  --enable-debug)
756f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
757f3d08ee6SPaul Brook      debug_tcg="yes"
758f3d08ee6SPaul Brook      debug="yes"
759f3d08ee6SPaul Brook      strip_opt="no"
760f3d08ee6SPaul Brook  ;;
76103b4fe7dSaliguori  --enable-sparse) sparse="yes"
76203b4fe7dSaliguori  ;;
76303b4fe7dSaliguori  --disable-sparse) sparse="no"
76403b4fe7dSaliguori  ;;
7651625af87Saliguori  --disable-strip) strip_opt="no"
7661625af87Saliguori  ;;
7678d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
7688d5d2d4cSths  ;;
7691be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
7701be10ad2SJuan Quintela  ;;
7712f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
7722f9606b3Saliguori  ;;
773ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
774ea784e3bSJuan Quintela  ;;
7752f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
7762f6f5c7aSCorentin Chary  ;;
7772f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
7782f6f5c7aSCorentin Chary  ;;
779efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
780efe556adSCorentin Chary  ;;
781efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
782efe556adSCorentin Chary  ;;
7837536ee4bSTim Hardeck  --disable-vnc-ws) vnc_ws="no"
7847536ee4bSTim Hardeck  ;;
7857536ee4bSTim Hardeck  --enable-vnc-ws) vnc_ws="yes"
7867536ee4bSTim Hardeck  ;;
787443f1376Sbellard  --disable-slirp) slirp="no"
788c20709aaSbellard  ;;
789ee682d27SStefan Weil  --disable-uuid) uuid="no"
790ee682d27SStefan Weil  ;;
791ee682d27SStefan Weil  --enable-uuid) uuid="yes"
792ee682d27SStefan Weil  ;;
793e0e6c8c0Saliguori  --disable-vde) vde="no"
7948a16d273Sths  ;;
795dfb278bdSJuan Quintela  --enable-vde) vde="yes"
796dfb278bdSJuan Quintela  ;;
797e37630caSaliguori  --disable-xen) xen="no"
798e37630caSaliguori  ;;
799fc321b4bSJuan Quintela  --enable-xen) xen="yes"
800fc321b4bSJuan Quintela  ;;
801eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
802eb6fda0fSAnthony PERARD  ;;
803eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
804eb6fda0fSAnthony PERARD  ;;
8052e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
8062e4d9fb1Saurel32  ;;
8074ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
8084ffcedb6SJuan Quintela  ;;
809fb599c9aSbalrog  --disable-bluez) bluez="no"
810fb599c9aSbalrog  ;;
811a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
812a20a6f46SJuan Quintela  ;;
8137ba1e619Saliguori  --disable-kvm) kvm="no"
8147ba1e619Saliguori  ;;
815b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
816b31a0277SJuan Quintela  ;;
8179195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
8189195b2c2SStefan Weil  ;;
8199195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
8209195b2c2SStefan Weil  ;;
82147e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
82247e98658SCorey Bryant  ;;
82347e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
82447e98658SCorey Bryant  ;;
825cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
826cd4ec0b4SGerd Hoffmann  ;;
827cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
828cd4ec0b4SGerd Hoffmann  ;;
829c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
830c589b249SRonnie Sahlberg  ;;
831c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
832c589b249SRonnie Sahlberg  ;;
83305c2a3e7Sbellard  --enable-profiler) profiler="yes"
83405c2a3e7Sbellard  ;;
83514821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
83614821030SPavel Borzenkov  ;;
837c2de5c91Smalc  --enable-cocoa)
838c2de5c91Smalc      cocoa="yes" ;
839c2de5c91Smalc      sdl="no" ;
840c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
8415b0753e0Sbellard  ;;
842cad25d69Spbrook  --disable-system) softmmu="no"
8430a8e90f4Spbrook  ;;
844cad25d69Spbrook  --enable-system) softmmu="yes"
8450a8e90f4Spbrook  ;;
8460953a80fSZachary Amsden  --disable-user)
8470953a80fSZachary Amsden      linux_user="no" ;
8480953a80fSZachary Amsden      bsd_user="no" ;
8490953a80fSZachary Amsden  ;;
8500953a80fSZachary Amsden  --enable-user) ;;
851831b7825Sths  --disable-linux-user) linux_user="no"
8520a8e90f4Spbrook  ;;
853831b7825Sths  --enable-linux-user) linux_user="yes"
854831b7825Sths  ;;
85584778508Sblueswir1  --disable-bsd-user) bsd_user="no"
85684778508Sblueswir1  ;;
85784778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
85884778508Sblueswir1  ;;
859379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
860379f6698SPaul Brook  ;;
861379f6698SPaul Brook  --disable-guest-base) guest_base="no"
862379f6698SPaul Brook  ;;
86340d6444eSAvi Kivity  --enable-pie) pie="yes"
86434005a00SKirill A. Shutemov  ;;
86540d6444eSAvi Kivity  --disable-pie) pie="no"
86634005a00SKirill A. Shutemov  ;;
867c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
868c5937220Spbrook  ;;
86985aa5189Sbellard  --enable-werror) werror="yes"
87085aa5189Sbellard  ;;
87185aa5189Sbellard  --disable-werror) werror="no"
87285aa5189Sbellard  ;;
8734d3b6f6eSbalrog  --disable-curses) curses="no"
8744d3b6f6eSbalrog  ;;
875c584a6d0SJuan Quintela  --enable-curses) curses="yes"
876c584a6d0SJuan Quintela  ;;
877769ce76dSAlexander Graf  --disable-curl) curl="no"
878769ce76dSAlexander Graf  ;;
879788c8196SJuan Quintela  --enable-curl) curl="yes"
880788c8196SJuan Quintela  ;;
8812df87df7SJuan Quintela  --disable-fdt) fdt="no"
8822df87df7SJuan Quintela  ;;
8832df87df7SJuan Quintela  --enable-fdt) fdt="yes"
8842df87df7SJuan Quintela  ;;
8855c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
8865c6c3a6cSChristoph Hellwig  ;;
8875c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
8885c6c3a6cSChristoph Hellwig  ;;
889758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
890758e8e38SVenkateswararao Jujjuri (JV)  ;;
891758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
892758e8e38SVenkateswararao Jujjuri (JV)  ;;
89377755340Sths  --disable-blobs) blobs="no"
89477755340Sths  ;;
8954a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
8964a19f1ecSpbrook  ;;
897519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
898519175a2SAlex Barcelo  ;;
89970c60c08SStefan Hajnoczi  --disable-coroutine-pool) coroutine_pool="no"
90070c60c08SStefan Hajnoczi  ;;
90170c60c08SStefan Hajnoczi  --enable-coroutine-pool) coroutine_pool="yes"
90270c60c08SStefan Hajnoczi  ;;
903a25dba17SJuan Quintela  --disable-docs) docs="no"
90470ec5dc0SAnthony Liguori  ;;
905a25dba17SJuan Quintela  --enable-docs) docs="yes"
90683a3ab8bSJuan Quintela  ;;
907d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
908d5970055SMichael S. Tsirkin  ;;
909d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
910d5970055SMichael S. Tsirkin  ;;
9115e9be92dSNicholas Bellinger  --disable-vhost-scsi) vhost_scsi="no"
9125e9be92dSNicholas Bellinger  ;;
9135e9be92dSNicholas Bellinger  --enable-vhost-scsi) vhost_scsi="yes"
9145e9be92dSNicholas Bellinger  ;;
915b1e5fff4SMichael Walle  --disable-glx) glx="no"
91620ff075bSMichael Walle  ;;
917b1e5fff4SMichael Walle  --enable-glx) glx="yes"
91820ff075bSMichael Walle  ;;
919f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
920f27aaf4bSChristian Brunner  ;;
921f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
922f27aaf4bSChristian Brunner  ;;
9238c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
9248c84cf11SSergei Trofimovich  ;;
9258c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
9268c84cf11SSergei Trofimovich  ;;
927111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
928111a38b0SRobert Relyea  ;;
929111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
930111a38b0SRobert Relyea  ;;
9312b2325ffSGerd Hoffmann  --disable-libusb) libusb="no"
9322b2325ffSGerd Hoffmann  ;;
9332b2325ffSGerd Hoffmann  --enable-libusb) libusb="yes"
9342b2325ffSGerd Hoffmann  ;;
93569354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
93669354a83SHans de Goede  ;;
93769354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
93869354a83SHans de Goede  ;;
9391ece9905SAlon Levy  --disable-zlib-test) zlib="no"
9401ece9905SAlon Levy  ;;
941d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
942d138cee9SMichael Roth  ;;
943d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
944d138cee9SMichael Roth  ;;
945d9840e25STomoki Sekiyama  --with-vss-sdk) vss_win32_sdk=""
946d9840e25STomoki Sekiyama  ;;
947d9840e25STomoki Sekiyama  --with-vss-sdk=*) vss_win32_sdk="$optarg"
948d9840e25STomoki Sekiyama  ;;
949d9840e25STomoki Sekiyama  --without-vss-sdk) vss_win32_sdk="no"
950d9840e25STomoki Sekiyama  ;;
951d9840e25STomoki Sekiyama  --with-win-sdk) win_sdk=""
952d9840e25STomoki Sekiyama  ;;
953d9840e25STomoki Sekiyama  --with-win-sdk=*) win_sdk="$optarg"
954d9840e25STomoki Sekiyama  ;;
955d9840e25STomoki Sekiyama  --without-win-sdk) win_sdk="no"
956d9840e25STomoki Sekiyama  ;;
9574b1c11fdSDaniel P. Berrange  --enable-tools) want_tools="yes"
9584b1c11fdSDaniel P. Berrange  ;;
9594b1c11fdSDaniel P. Berrange  --disable-tools) want_tools="no"
9604b1c11fdSDaniel P. Berrange  ;;
961f794573eSEduardo Otubo  --enable-seccomp) seccomp="yes"
962f794573eSEduardo Otubo  ;;
963f794573eSEduardo Otubo  --disable-seccomp) seccomp="no"
964f794573eSEduardo Otubo  ;;
965eb100396SBharata B Rao  --disable-glusterfs) glusterfs="no"
966eb100396SBharata B Rao  ;;
967eb100396SBharata B Rao  --enable-glusterfs) glusterfs="yes"
968eb100396SBharata B Rao  ;;
969583f6e7bSStefan Hajnoczi  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
970583f6e7bSStefan Hajnoczi  ;;
971583f6e7bSStefan Hajnoczi  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
972583f6e7bSStefan Hajnoczi  ;;
973a4ccabcfSAnthony Liguori  --disable-gtk) gtk="no"
974a4ccabcfSAnthony Liguori  ;;
975a4ccabcfSAnthony Liguori  --enable-gtk) gtk="yes"
976a4ccabcfSAnthony Liguori  ;;
9772da776dbSMichael R. Hines  --enable-rdma) rdma="yes"
9782da776dbSMichael R. Hines  ;;
9792da776dbSMichael R. Hines  --disable-rdma) rdma="no"
9802da776dbSMichael R. Hines  ;;
981528de90aSDaniel P. Berrange  --with-gtkabi=*) gtkabi="$optarg"
982528de90aSDaniel P. Berrange  ;;
983ab214c29SStefan Berger  --enable-tpm) tpm="yes"
984ab214c29SStefan Berger  ;;
9850a12ec87SRichard W.M. Jones  --disable-libssh2) libssh2="no"
9860a12ec87SRichard W.M. Jones  ;;
9870a12ec87SRichard W.M. Jones  --enable-libssh2) libssh2="yes"
9880a12ec87SRichard W.M. Jones  ;;
9894f18b782SJeff Cody  --enable-vhdx) vhdx="yes"
9904f18b782SJeff Cody  ;;
9914f18b782SJeff Cody  --disable-vhdx) vhdx="no"
9924f18b782SJeff Cody  ;;
9937f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
9947f1559c6Sbalrog  ;;
9957d13299dSbellard  esac
9967d13299dSbellarddone
9977d13299dSbellard
99840293e58Sbellardcase "$cpu" in
999e3608d66SRichard Henderson    ppc)
1000e3608d66SRichard Henderson           CPU_CFLAGS="-m32"
1001e3608d66SRichard Henderson           LDFLAGS="-m32 $LDFLAGS"
1002e3608d66SRichard Henderson           ;;
1003e3608d66SRichard Henderson    ppc64)
1004e3608d66SRichard Henderson           CPU_CFLAGS="-m64"
1005e3608d66SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
1006e3608d66SRichard Henderson           ;;
10079b9c37c3SRichard Henderson    sparc)
10080c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
100979f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32 -mcpu=ultrasparc"
10103142255cSblueswir1           ;;
1011ed968ff1SJuan Quintela    sparc64)
10120c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
101379f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -mcpu=ultrasparc"
10143142255cSblueswir1           ;;
101576d83bdeSths    s390)
101679f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m31 -march=z990"
101728d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
101828d7cc49SRichard Henderson           ;;
101928d7cc49SRichard Henderson    s390x)
102079f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -march=z990"
102128d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
102276d83bdeSths           ;;
102340293e58Sbellard    i386)
102479f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32"
10250c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
10262b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
102740293e58Sbellard           ;;
102840293e58Sbellard    x86_64)
102979f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64"
10300c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
10312b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
1032379f6698SPaul Brook           ;;
1033c72b26ecSRichard Henderson    x32)
1034c72b26ecSRichard Henderson           CPU_CFLAGS="-mx32"
1035c72b26ecSRichard Henderson           LDFLAGS="-mx32 $LDFLAGS"
1036c72b26ecSRichard Henderson           cc_i386='$(CC) -m32'
1037c72b26ecSRichard Henderson           ;;
103830163d89SPeter Maydell    # No special flags required for other host CPUs
10393142255cSblueswir1esac
10403142255cSblueswir1
104179f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
104279f3b12fSPeter CrosthwaiteEXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
104379f3b12fSPeter Crosthwaite
104460e0df25SPeter Maydelldefault_target_list=""
104560e0df25SPeter Maydell
10466e92f823SPeter Maydellmak_wilds=""
10476e92f823SPeter Maydell
104860e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then
10496e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
105060e0df25SPeter Maydellfi
105160e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then
10526e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
105360e0df25SPeter Maydellfi
105460e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then
10556e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
105660e0df25SPeter Maydellfi
105760e0df25SPeter Maydell
10586e92f823SPeter Maydellfor config in $mak_wilds; do
10596e92f823SPeter Maydell    default_target_list="${default_target_list} $(basename "$config" .mak)"
10606e92f823SPeter Maydelldone
10616e92f823SPeter Maydell
1062af5db58eSpbrookif test x"$show_help" = x"yes" ; then
1063af5db58eSpbrookcat << EOF
1064af5db58eSpbrook
1065af5db58eSpbrookUsage: configure [options]
1066af5db58eSpbrookOptions: [defaults in brackets after descriptions]
1067af5db58eSpbrook
1068af5db58eSpbrookEOF
1069af5db58eSpbrookecho "Standard options:"
1070af5db58eSpbrookecho "  --help                   print this message"
1071af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
1072af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
1073af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
107460e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
107560e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
107660e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
1077af5db58eSpbrookecho ""
1078af5db58eSpbrookecho "Advanced options (experts only):"
1079af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
1080af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
1081af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
1082a31a8642SMichael S. Tsirkinecho "  --iasl=IASL              use ACPI compiler IASL [$iasl]"
10830bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
10840bfe8cc0SPaolo Bonziniecho "                           build time"
108583f73fceSTomoki Sekiyamaecho "  --cxx=CXX                use C++ compiler CXX [$cxx]"
10863c4a4d0dSPeter Maydellecho "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
1087a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
1088e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
1089af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
10906a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
1091c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
1092e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
1093af5db58eSpbrookecho "  --static                 enable static build [$static]"
10940b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
1095023d3d67SEduardo Habkostecho "  --datadir=PATH           install firmware in PATH$confsuffix"
1096023d3d67SEduardo Habkostecho "  --docdir=PATH            install documentation in PATH$confsuffix"
10970b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
1098a7b66fa7SDoug Goldsteinecho "  --libdir=PATH            install libraries in PATH"
1099023d3d67SEduardo Habkostecho "  --sysconfdir=PATH        install config in PATH$confsuffix"
11005a699bbbSLaszlo Ersekecho "  --localstatedir=PATH     install local state in PATH (set at runtime on win32)"
11012ae4748fSStefan Weilecho "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1102f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1103f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
11049941afdeSDunrong Huangecho "  --enable-debug-info       enable debugging information (default)"
11059941afdeSDunrong Huangecho "  --disable-debug-info      disable debugging information"
110609695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1107890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1108890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
11091625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
111085aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1111fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1112c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1113ab400449SHu Taoecho "  --disable-gtk            disable gtk UI"
1114ab400449SHu Taoecho "  --enable-gtk             enable gtk UI"
1115983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1116983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1117821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1118821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
111914821030SPavel Borzenkovecho "  --disable-cocoa          disable Cocoa (Mac OS X only)"
112014821030SPavel Borzenkovecho "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
1121c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1122c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
1123b64ec4e4SFam Zhengecho "  --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L"
1124b64ec4e4SFam Zhengecho "  --block-drv-rw-whitelist=L"
1125b64ec4e4SFam Zhengecho "                           set block driver read-write whitelist"
1126b64ec4e4SFam Zhengecho "                           (affects only QEMU, not qemu-img)"
1127b64ec4e4SFam Zhengecho "  --block-drv-ro-whitelist=L"
1128b64ec4e4SFam Zhengecho "                           set block driver read-only whitelist"
1129eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
1130e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1131fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
1132eb6fda0fSAnthony PERARDecho "  --disable-xen-pci-passthrough"
1133eb6fda0fSAnthony PERARDecho "  --enable-xen-pci-passthrough"
11342e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
11354ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
11368d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
11371be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
11382f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1139ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
11402f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
11412f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
114296763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1143efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
11447536ee4bSTim Hardeckecho "  --disable-vnc-ws         disable Websockets support for VNC server"
11457536ee4bSTim Hardeckecho "  --enable-vnc-ws          enable Websockets support for VNC server"
1146af896aaaSpbrookecho "  --disable-curses         disable curses output"
1147c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1148769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1149788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
11502df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
11512df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1152fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1153a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
11546093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
11557ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1156b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
11572da776dbSMichael R. Hinesecho "  --disable-rdma           disable RDMA-based migration support"
11582da776dbSMichael R. Hinesecho "  --enable-rdma            enable RDMA-based migration support"
11599195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1160af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1161af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
11620953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
11630953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1164831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1165831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
116684778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
116784778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1168379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1169379f6698SPaul Brookecho "                           emulation targets"
1170379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
117140d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
117240d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1173af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1174af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
11752f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1176c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1177235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
1178ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1179ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1180e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1181dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
11825c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
11835c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
118447e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
118547e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1186758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1187758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
118877755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1189d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1190d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1191d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1192d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1193320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1194650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
119574242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
11969410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1197cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1198cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1199f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1200c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1201c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
1202111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1203111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
12042b2325ffSGerd Hoffmannecho "  --disable-libusb         disable libusb (for usb passthrough)"
12052b2325ffSGerd Hoffmannecho "  --enable-libusb          enable libusb (for usb passthrough)"
120669354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
120769354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1208d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1209d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1210d9840e25STomoki Sekiyamaecho "  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent"
1211d9840e25STomoki Sekiyamaecho "  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)"
1212f794573eSEduardo Otuboecho "  --disable-seccomp        disable seccomp support"
1213f794573eSEduardo Otuboecho "  --enable-seccomp         enables seccomp support"
1214519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1215fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
121670c60c08SStefan Hajnocziecho "  --disable-coroutine-pool disable coroutine freelist (worse performance)"
121770c60c08SStefan Hajnocziecho "  --enable-coroutine-pool  enable coroutine freelist (better performance)"
1218eb100396SBharata B Raoecho "  --enable-glusterfs       enable GlusterFS backend"
1219eb100396SBharata B Raoecho "  --disable-glusterfs      disable GlusterFS backend"
12201d728c39SBlue Swirlecho "  --enable-gcov            enable test coverage analysis with gcov"
12211d728c39SBlue Swirlecho "  --gcov=GCOV              use specified gcov [$gcov_tool]"
1222ab214c29SStefan Bergerecho "  --enable-tpm             enable TPM support"
12230a12ec87SRichard W.M. Jonesecho "  --disable-libssh2        disable ssh block device support"
12240a12ec87SRichard W.M. Jonesecho "  --enable-libssh2         enable ssh block device support"
12254f18b782SJeff Codyecho "  --disable-vhdx           disables support for the Microsoft VHDX image format"
12264f18b782SJeff Codyecho "  --enable-vhdx            enable support for the Microsoft VHDX image format"
1227af5db58eSpbrookecho ""
12285bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1229af5db58eSpbrookexit 1
1230af5db58eSpbrookfi
1231af5db58eSpbrook
1232359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1233359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1234359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1235359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1236359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1237359bc95dSPeter Maydell        ARCH=tci
1238359bc95dSPeter Maydell    else
123976ad07a4SPeter Maydell        error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1240359bc95dSPeter Maydell    fi
1241359bc95dSPeter Maydellfi
1242359bc95dSPeter Maydell
12438d05095cSPaolo Bonzini# check that the C compiler works.
12448d05095cSPaolo Bonzinicat > $TMPC <<EOF
124575cafad7SStefan Weilint main(void) { return 0; }
12468d05095cSPaolo BonziniEOF
12478d05095cSPaolo Bonzini
12488d05095cSPaolo Bonziniif compile_object ; then
12498d05095cSPaolo Bonzini  : C compiler works ok
12508d05095cSPaolo Bonzinielse
125176ad07a4SPeter Maydell    error_exit "\"$cc\" either does not exist or does not work"
12528d05095cSPaolo Bonzinifi
12538d05095cSPaolo Bonzini
1254417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror
1255417c9d72SAlexander Graf# by default.  Only enable by default for git builds
1256417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION`
1257417c9d72SAlexander Graf
1258417c9d72SAlexander Grafif test -z "$werror" ; then
12596c8fec83SAndreas Färber    if test -d "$source_path/.git" -a \
1260417c9d72SAlexander Graf        "$linux" = "yes" ; then
1261417c9d72SAlexander Graf        werror="yes"
1262417c9d72SAlexander Graf    else
1263417c9d72SAlexander Graf        werror="no"
1264417c9d72SAlexander Graf    fi
1265417c9d72SAlexander Graffi
1266417c9d72SAlexander Graf
12678d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
12688d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
12698d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
127037746c5eSMarc-André Lureaugcc_flags="-Wendif-labels $gcc_flags"
1271c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags"
127271429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags"
12736ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would
12746ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due
12756ca026cbSPeter Maydell# to -Werror this would just silently disable some features,
12766ca026cbSPeter Maydell# so it's too error prone.
12778d05095cSPaolo Bonzinicat > $TMPC << EOF
12788d05095cSPaolo Bonziniint main(void) { return 0; }
12798d05095cSPaolo BonziniEOF
12808d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1281a1d29d6cSPeter Maydell    # Use the positive sense of the flag when testing for -Wno-wombat
1282a1d29d6cSPeter Maydell    # support (gcc will happily accept the -Wno- form of unknown
1283a1d29d6cSPeter Maydell    # warning options).
1284a1d29d6cSPeter Maydell    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1285a1d29d6cSPeter Maydell    if compile_prog "-Werror $optflag" "" ; then
12868d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
12878d05095cSPaolo Bonzini    fi
12888d05095cSPaolo Bonzinidone
12898d05095cSPaolo Bonzini
129037746c5eSMarc-André Lureauif compile_prog "-Werror -fstack-protector-all" "" ; then
129137746c5eSMarc-André Lureau    QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
129237746c5eSMarc-André Lureau    LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
129337746c5eSMarc-André Lureaufi
129437746c5eSMarc-André Lureau
1295cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1296cbdd1999SPaolo Bonzini# large functions that use global variables.  The bug is in all releases of
1297cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1298cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1299cbdd1999SPaolo Bonzinicat > $TMPC << EOF
1300cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1301cbdd1999SPaolo Bonziniint main(void) { return 0; }
1302cbdd1999SPaolo Bonzini#else
1303cbdd1999SPaolo Bonzini#error No bug in this compiler.
1304cbdd1999SPaolo Bonzini#endif
1305cbdd1999SPaolo BonziniEOF
1306cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then
1307cbdd1999SPaolo Bonzini  TRANSLATE_OPT_CFLAGS=-fno-gcse
1308cbdd1999SPaolo Bonzinifi
1309cbdd1999SPaolo Bonzini
131040d6444eSAvi Kivityif test "$static" = "yes" ; then
131140d6444eSAvi Kivity  if test "$pie" = "yes" ; then
131276ad07a4SPeter Maydell    error_exit "static and pie are mutually incompatible"
131340d6444eSAvi Kivity  else
131440d6444eSAvi Kivity    pie="no"
131540d6444eSAvi Kivity  fi
131640d6444eSAvi Kivityfi
131740d6444eSAvi Kivity
131840d6444eSAvi Kivityif test "$pie" = ""; then
131940d6444eSAvi Kivity  case "$cpu-$targetos" in
1320c72b26ecSRichard Henderson    i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
132140d6444eSAvi Kivity      ;;
132240d6444eSAvi Kivity    *)
132340d6444eSAvi Kivity      pie="no"
132440d6444eSAvi Kivity      ;;
132540d6444eSAvi Kivity  esac
132640d6444eSAvi Kivityfi
132740d6444eSAvi Kivity
132840d6444eSAvi Kivityif test "$pie" != "no" ; then
132940d6444eSAvi Kivity  cat > $TMPC << EOF
133021d4a791SAvi Kivity
133121d4a791SAvi Kivity#ifdef __linux__
133221d4a791SAvi Kivity#  define THREAD __thread
133321d4a791SAvi Kivity#else
133421d4a791SAvi Kivity#  define THREAD
133521d4a791SAvi Kivity#endif
133621d4a791SAvi Kivity
133721d4a791SAvi Kivitystatic THREAD int tls_var;
133821d4a791SAvi Kivity
133921d4a791SAvi Kivityint main(void) { return tls_var; }
134021d4a791SAvi Kivity
134140d6444eSAvi KivityEOF
134240d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
134340d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
134440d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
134540d6444eSAvi Kivity    pie="yes"
134640d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
134740d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
134840d6444eSAvi Kivity    fi
134940d6444eSAvi Kivity  else
135040d6444eSAvi Kivity    if test "$pie" = "yes"; then
135176ad07a4SPeter Maydell      error_exit "PIE not available due to missing toolchain support"
135240d6444eSAvi Kivity    else
135340d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
135440d6444eSAvi Kivity      pie="no"
135540d6444eSAvi Kivity    fi
135640d6444eSAvi Kivity  fi
135740d6444eSAvi Kivityfi
135840d6444eSAvi Kivity
135909dada40SPaolo Bonzini##########################################
136009dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains
136109dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit
136209dada40SPaolo Bonzini# specification is necessary
136309dada40SPaolo Bonzini
136409dada40SPaolo Bonziniif test "$cpu" = "i386"; then
136509dada40SPaolo Bonzini  cat > $TMPC << EOF
136609dada40SPaolo Bonzinistatic int sfaa(int *ptr)
136709dada40SPaolo Bonzini{
136809dada40SPaolo Bonzini  return __sync_fetch_and_and(ptr, 0);
136909dada40SPaolo Bonzini}
137009dada40SPaolo Bonzini
137109dada40SPaolo Bonziniint main(void)
137209dada40SPaolo Bonzini{
137309dada40SPaolo Bonzini  int val = 42;
13741405b629SStefan Weil  val = __sync_val_compare_and_swap(&val, 0, 1);
137509dada40SPaolo Bonzini  sfaa(&val);
137609dada40SPaolo Bonzini  return val;
137709dada40SPaolo Bonzini}
137809dada40SPaolo BonziniEOF
137909dada40SPaolo Bonzini  if ! compile_prog "" "" ; then
138009dada40SPaolo Bonzini    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
138109dada40SPaolo Bonzini  fi
138209dada40SPaolo Bonzinifi
138309dada40SPaolo Bonzini
138409dada40SPaolo Bonzini#########################################
1385ec530c81Sbellard# Solaris specific configure tool chain decisions
138609dada40SPaolo Bonzini
1387ec530c81Sbellardif test "$solaris" = "yes" ; then
13886792aa11SLoïc Minier  if has $install; then
13896792aa11SLoïc Minier    :
13906792aa11SLoïc Minier  else
139176ad07a4SPeter Maydell    error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
139276ad07a4SPeter Maydell        "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
139376ad07a4SPeter Maydell        "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1394ec530c81Sbellard  fi
13956792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
139676ad07a4SPeter Maydell    error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
139776ad07a4SPeter Maydell        "try ginstall from the GNU fileutils available from www.blastwave.org" \
139876ad07a4SPeter Maydell        "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1399ec530c81Sbellard  fi
14006792aa11SLoïc Minier  if has ar; then
14016792aa11SLoïc Minier    :
14026792aa11SLoïc Minier  else
1403ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
140476ad07a4SPeter Maydell      error_exit "No path includes ar" \
140576ad07a4SPeter Maydell          "Add /usr/ccs/bin to your path and rerun configure"
1406ec530c81Sbellard    fi
140776ad07a4SPeter Maydell    error_exit "No path includes ar"
1408ec530c81Sbellard  fi
1409ec530c81Sbellardfi
1410ec530c81Sbellard
14117a3fc891SSebastian Herbsztif ! has $python; then
141276ad07a4SPeter Maydell  error_exit "Python not found. Use --python=/path/to/python"
1413c886edfbSBlue Swirlfi
1414c886edfbSBlue Swirl
14156ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
14166ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
14171d984a67SStefan Weilif ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
141876ad07a4SPeter Maydell  error_exit "Cannot use '$python', Python 2.4 or later is required." \
141976ad07a4SPeter Maydell      "Note that Python 3 or later is not yet supported." \
142076ad07a4SPeter Maydell      "Use --python=/path/to/python to specify a supported Python."
14216ccea1e4SPeter Maydellfi
14226ccea1e4SPeter Maydell
142352510f8bSStefan Weil# The -B switch was added in Python 2.6.
142452510f8bSStefan Weil# If it is supplied, compiled files are not written.
142552510f8bSStefan Weil# Use it for Python versions which support it.
142652510f8bSStefan Weilif $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
142752510f8bSStefan Weil  python="$python -B"
142852510f8bSStefan Weilfi
142952510f8bSStefan Weil
1430afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then
1431121afa9eSAnthony Liguori    target_list="$default_target_list"
1432121afa9eSAnthony Liguorielse
1433121afa9eSAnthony Liguori    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
14345327cf48Sbellardfi
143525b48338SPeter Maydell
143625b48338SPeter Maydell# Check that we recognised the target name; this allows a more
143725b48338SPeter Maydell# friendly error message than if we let it fall through.
143825b48338SPeter Maydellfor target in $target_list; do
143925b48338SPeter Maydell    case " $default_target_list " in
144025b48338SPeter Maydell        *" $target "*)
144125b48338SPeter Maydell            ;;
144225b48338SPeter Maydell        *)
144325b48338SPeter Maydell            error_exit "Unknown target name '$target'"
144425b48338SPeter Maydell            ;;
144525b48338SPeter Maydell    esac
144625b48338SPeter Maydelldone
144725b48338SPeter Maydell
1448f55fe278SPaolo Bonzini# see if system emulation was really requested
1449f55fe278SPaolo Bonzinicase " $target_list " in
1450f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1451f55fe278SPaolo Bonzini  ;;
1452f55fe278SPaolo Bonzini  *) softmmu=no
1453f55fe278SPaolo Bonzini  ;;
1454f55fe278SPaolo Bonziniesac
14555327cf48Sbellard
1456249247c9SJuan Quintelafeature_not_found() {
1457249247c9SJuan Quintela  feature=$1
1458249247c9SJuan Quintela
145976ad07a4SPeter Maydell  error_exit "User requested feature $feature" \
146076ad07a4SPeter Maydell      "configure was not able to find it"
1461249247c9SJuan Quintela}
1462249247c9SJuan Quintela
14637d13299dSbellard# ---
14647d13299dSbellard# big/little endian test
14657d13299dSbellardcat > $TMPC << EOF
146661cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
146761cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
146861cc919fSMike Frysingerextern int foo(short *, short *);
146961cc919fSMike Frysingerint main(int argc, char *argv[]) {
147061cc919fSMike Frysinger    return foo(big_endian, little_endian);
14717d13299dSbellard}
14727d13299dSbellardEOF
14737d13299dSbellard
147461cc919fSMike Frysingerif compile_object ; then
147561cc919fSMike Frysinger    if grep -q BiGeNdIaN $TMPO ; then
147661cc919fSMike Frysinger        bigendian="yes"
147761cc919fSMike Frysinger    elif grep -q LiTtLeEnDiAn $TMPO ; then
147861cc919fSMike Frysinger        bigendian="no"
14797d13299dSbellard    else
14807d13299dSbellard        echo big/little test failed
14817d13299dSbellard    fi
14827d13299dSbellardelse
148361cc919fSMike Frysinger    echo big/little test failed
14847d13299dSbellardfi
14857d13299dSbellard
1486b0a47e79SJuan Quintela##########################################
1487779ab5e3SStefan Weil# pkg-config probe
1488779ab5e3SStefan Weil
1489779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then
149076ad07a4SPeter Maydell  error_exit "pkg-config binary '$pkg_config_exe' not found"
1491779ab5e3SStefan Weilfi
1492779ab5e3SStefan Weil
1493779ab5e3SStefan Weil##########################################
1494b0a47e79SJuan Quintela# NPTL probe
1495b0a47e79SJuan Quintela
149624cb36a6SPeter Maydellif test "$linux_user" = "yes"; then
1497bd0c5661Spbrook  cat > $TMPC <<EOF
1498bd0c5661Spbrook#include <sched.h>
149930813ceaSpbrook#include <linux/futex.h>
1500182eacc0SStefan Weilint main(void) {
1501bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1502bd0c5661Spbrook#error bork
1503bd0c5661Spbrook#endif
1504182eacc0SStefan Weil  return 0;
1505bd0c5661Spbrook}
1506bd0c5661SpbrookEOF
150724cb36a6SPeter Maydell  if ! compile_object ; then
1508b0a47e79SJuan Quintela    feature_not_found "nptl"
1509b0a47e79SJuan Quintela  fi
1510bd0c5661Spbrookfi
1511bd0c5661Spbrook
151211d9f695Sbellard##########################################
1513ac62922eSbalrog# zlib check
1514ac62922eSbalrog
15151ece9905SAlon Levyif test "$zlib" != "no" ; then
1516ac62922eSbalrog    cat > $TMPC << EOF
1517ac62922eSbalrog#include <zlib.h>
1518ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1519ac62922eSbalrogEOF
152052166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1521ac62922eSbalrog        :
1522ac62922eSbalrog    else
152376ad07a4SPeter Maydell        error_exit "zlib check failed" \
152476ad07a4SPeter Maydell            "Make sure to have the zlib libs and headers installed."
1525ac62922eSbalrog    fi
15261ece9905SAlon Levyfi
1527f544a488SPaolo Bonzinilibs_softmmu="$libs_softmmu -lz"
1528ac62922eSbalrog
1529ac62922eSbalrog##########################################
1530f794573eSEduardo Otubo# libseccomp check
1531f794573eSEduardo Otubo
1532f794573eSEduardo Otuboif test "$seccomp" != "no" ; then
153365d5d3f9SStefan Weil    if $pkg_config --atleast-version=2.1.0 libseccomp; then
1534b4451996SMichael Tokarev        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1535372e47e9SAndreas Färber        QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1536f794573eSEduardo Otubo	seccomp="yes"
1537f794573eSEduardo Otubo    else
1538f794573eSEduardo Otubo	if test "$seccomp" = "yes"; then
1539f794573eSEduardo Otubo            feature_not_found "libseccomp"
1540f794573eSEduardo Otubo	fi
1541e84d5956SYann E. MORIN	seccomp="no"
1542f794573eSEduardo Otubo    fi
1543f794573eSEduardo Otubofi
1544f794573eSEduardo Otubo##########################################
1545e37630caSaliguori# xen probe
1546e37630caSaliguori
1547fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1548b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1549d5b93ddfSAnthony PERARD
155050ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
155150ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
155250ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
155350ced5b3SStefan Weil
155450ced5b3SStefan Weil  # Xen (any)
155550ced5b3SStefan Weil  cat > $TMPC <<EOF
155650ced5b3SStefan Weil#include <xenctrl.h>
155750ced5b3SStefan Weilint main(void) {
155850ced5b3SStefan Weil  return 0;
155950ced5b3SStefan Weil}
156050ced5b3SStefan WeilEOF
156150ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
156250ced5b3SStefan Weil    # Xen not found
156350ced5b3SStefan Weil    if test "$xen" = "yes" ; then
156450ced5b3SStefan Weil      feature_not_found "xen"
156550ced5b3SStefan Weil    fi
156650ced5b3SStefan Weil    xen=no
156750ced5b3SStefan Weil
1568d5b93ddfSAnthony PERARD  # Xen unstable
156969deef08SPeter Maydell  elif
157069deef08SPeter Maydell      cat > $TMPC <<EOF &&
1571e37630caSaliguori#include <xenctrl.h>
1572e108a3c1SAnthony PERARD#include <xenstore.h>
1573d5b93ddfSAnthony PERARD#include <stdint.h>
1574d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1575d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1576d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1577d5b93ddfSAnthony PERARD#endif
1578d5b93ddfSAnthony PERARDint main(void) {
1579d5b93ddfSAnthony PERARD  xc_interface *xc;
1580d5b93ddfSAnthony PERARD  xs_daemon_open();
1581d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1582d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1583d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1584b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
15858688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
15868688e065SStefano Stabellini  return 0;
15878688e065SStefano Stabellini}
15888688e065SStefano StabelliniEOF
15898688e065SStefano Stabellini      compile_prog "" "$xen_libs"
159069deef08SPeter Maydell    then
15918688e065SStefano Stabellini    xen_ctrl_version=420
15928688e065SStefano Stabellini    xen=yes
15938688e065SStefano Stabellini
159469deef08SPeter Maydell  elif
159569deef08SPeter Maydell      cat > $TMPC <<EOF &&
15968688e065SStefano Stabellini#include <xenctrl.h>
15978688e065SStefano Stabellini#include <xs.h>
15988688e065SStefano Stabellini#include <stdint.h>
15998688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
16008688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
16018688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
16028688e065SStefano Stabellini#endif
16038688e065SStefano Stabelliniint main(void) {
16048688e065SStefano Stabellini  xs_daemon_open();
16059b4c0b56SPeter Maydell  xc_interface_open(0, 0, 0);
16068688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
16078688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
16088688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1609d5b93ddfSAnthony PERARD  return 0;
1610d5b93ddfSAnthony PERARD}
1611e37630caSaliguoriEOF
161250ced5b3SStefan Weil      compile_prog "" "$xen_libs"
161369deef08SPeter Maydell    then
1614d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1615fc321b4bSJuan Quintela    xen=yes
1616d5b93ddfSAnthony PERARD
1617d5b93ddfSAnthony PERARD  # Xen 4.0.0
161869deef08SPeter Maydell  elif
161969deef08SPeter Maydell      cat > $TMPC <<EOF &&
1620d5b93ddfSAnthony PERARD#include <xenctrl.h>
1621d5b93ddfSAnthony PERARD#include <xs.h>
1622d5b93ddfSAnthony PERARD#include <stdint.h>
1623d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1624d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1625d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1626d5b93ddfSAnthony PERARD#endif
1627d5b93ddfSAnthony PERARDint main(void) {
1628b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1629b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1630b87de24eSAnthony PERARD  };
1631d5b93ddfSAnthony PERARD  xs_daemon_open();
1632d5b93ddfSAnthony PERARD  xc_interface_open();
1633d5b93ddfSAnthony PERARD  xc_gnttab_open();
1634d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1635b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1636d5b93ddfSAnthony PERARD  return 0;
1637d5b93ddfSAnthony PERARD}
1638d5b93ddfSAnthony PERARDEOF
1639d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
164069deef08SPeter Maydell    then
1641d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1642d5b93ddfSAnthony PERARD    xen=yes
1643d5b93ddfSAnthony PERARD
1644b87de24eSAnthony PERARD  # Xen 3.4.0
164569deef08SPeter Maydell  elif
164669deef08SPeter Maydell      cat > $TMPC <<EOF &&
1647b87de24eSAnthony PERARD#include <xenctrl.h>
1648b87de24eSAnthony PERARD#include <xs.h>
1649b87de24eSAnthony PERARDint main(void) {
1650b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1651b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1652b87de24eSAnthony PERARD  };
1653b87de24eSAnthony PERARD  xs_daemon_open();
1654b87de24eSAnthony PERARD  xc_interface_open();
1655b87de24eSAnthony PERARD  xc_gnttab_open();
1656b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1657b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1658b87de24eSAnthony PERARD  return 0;
1659b87de24eSAnthony PERARD}
1660b87de24eSAnthony PERARDEOF
1661b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
166269deef08SPeter Maydell    then
1663b87de24eSAnthony PERARD    xen_ctrl_version=340
1664b87de24eSAnthony PERARD    xen=yes
1665b87de24eSAnthony PERARD
1666b87de24eSAnthony PERARD  # Xen 3.3.0
166769deef08SPeter Maydell  elif
166869deef08SPeter Maydell      cat > $TMPC <<EOF &&
1669d5b93ddfSAnthony PERARD#include <xenctrl.h>
1670d5b93ddfSAnthony PERARD#include <xs.h>
1671d5b93ddfSAnthony PERARDint main(void) {
1672d5b93ddfSAnthony PERARD  xs_daemon_open();
1673d5b93ddfSAnthony PERARD  xc_interface_open();
1674d5b93ddfSAnthony PERARD  xc_gnttab_open();
1675d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1676d5b93ddfSAnthony PERARD  return 0;
1677d5b93ddfSAnthony PERARD}
1678d5b93ddfSAnthony PERARDEOF
1679d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
168069deef08SPeter Maydell    then
1681d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1682d5b93ddfSAnthony PERARD    xen=yes
1683d5b93ddfSAnthony PERARD
168450ced5b3SStefan Weil  # Xen version unsupported
1685e37630caSaliguori  else
1686fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
168750ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1688fc321b4bSJuan Quintela    fi
1689fc321b4bSJuan Quintela    xen=no
1690e37630caSaliguori  fi
1691d5b93ddfSAnthony PERARD
1692d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1693d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1694d5b93ddfSAnthony PERARD  fi
1695e37630caSaliguorifi
1696e37630caSaliguori
1697eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1698eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1699eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1700eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1701eb6fda0fSAnthony PERARD  else
1702eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1703eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
170476ad07a4SPeter Maydell        error_exit "User requested feature Xen PCI Passthrough" \
170576ad07a4SPeter Maydell            "This feature does not work with Xen 3.3"
1706eb6fda0fSAnthony PERARD      fi
170776ad07a4SPeter Maydell      error_exit "User requested feature Xen PCI Passthrough" \
170876ad07a4SPeter Maydell          " but this feature requires /sys from Linux"
1709eb6fda0fSAnthony PERARD    fi
1710eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1711eb6fda0fSAnthony PERARD  fi
1712eb6fda0fSAnthony PERARDfi
1713eb6fda0fSAnthony PERARD
1714e37630caSaliguori##########################################
171544dc0ca3SAlon Levy# libtool probe
171644dc0ca3SAlon Levy
17173f534581SBradif ! has $libtool; then
171844dc0ca3SAlon Levy    libtool=
171944dc0ca3SAlon Levyfi
172044dc0ca3SAlon Levy
17218e515b12SPeter Maydell# MacOSX ships with a libtool which isn't the GNU one; weed this
17228e515b12SPeter Maydell# out by checking whether libtool supports the --version switch
17238e515b12SPeter Maydellif test -n "$libtool"; then
17248e515b12SPeter Maydell  if ! "$libtool" --version >/dev/null 2>&1; then
17258e515b12SPeter Maydell    libtool=
17268e515b12SPeter Maydell  fi
17278e515b12SPeter Maydellfi
17288e515b12SPeter Maydell
172944dc0ca3SAlon Levy##########################################
1730dfffc653SJuan Quintela# Sparse probe
1731dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
17320dba6195SLoïc Minier  if has cgcc; then
1733dfffc653SJuan Quintela    sparse=yes
1734dfffc653SJuan Quintela  else
1735dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1736dfffc653SJuan Quintela      feature_not_found "sparse"
1737dfffc653SJuan Quintela    fi
1738dfffc653SJuan Quintela    sparse=no
1739dfffc653SJuan Quintela  fi
1740dfffc653SJuan Quintelafi
1741dfffc653SJuan Quintela
1742dfffc653SJuan Quintela##########################################
1743a4ccabcfSAnthony Liguori# GTK probe
1744a4ccabcfSAnthony Liguori
1745a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then
1746528de90aSDaniel P. Berrange    gtkpackage="gtk+-$gtkabi"
1747528de90aSDaniel P. Berrange    if test "$gtkabi" = "3.0" ; then
1748528de90aSDaniel P. Berrange      gtkversion="3.0.0"
1749528de90aSDaniel P. Berrange      vtepackage="vte-2.90"
1750528de90aSDaniel P. Berrange      vteversion="0.32.0"
1751528de90aSDaniel P. Berrange    else
1752528de90aSDaniel P. Berrange      gtkversion="2.18.0"
1753528de90aSDaniel P. Berrange      vtepackage="vte"
1754528de90aSDaniel P. Berrange      vteversion="0.24.0"
1755528de90aSDaniel P. Berrange    fi
17560d185e63SPeter Maydell    if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
17570d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17580d185e63SPeter Maydell            feature_not_found "gtk"
17590d185e63SPeter Maydell        fi
17600d185e63SPeter Maydell        gtk="no"
17610d185e63SPeter Maydell    elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
17620d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17630d185e63SPeter Maydell            error_exit "libvte not found (required for gtk support)"
17640d185e63SPeter Maydell        fi
17650d185e63SPeter Maydell        gtk="no"
17660d185e63SPeter Maydell    else
1767ca871ec8SStefan Weil	gtk_cflags=`$pkg_config --cflags $gtkpackage`
1768ca871ec8SStefan Weil	gtk_libs=`$pkg_config --libs $gtkpackage`
1769ca871ec8SStefan Weil	vte_cflags=`$pkg_config --cflags $vtepackage`
1770ca871ec8SStefan Weil	vte_libs=`$pkg_config --libs $vtepackage`
1771a4ccabcfSAnthony Liguori	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1772a4ccabcfSAnthony Liguori	gtk="yes"
1773a4ccabcfSAnthony Liguori    fi
1774a4ccabcfSAnthony Liguorifi
1775a4ccabcfSAnthony Liguori
1776a4ccabcfSAnthony Liguori##########################################
177711d9f695Sbellard# SDL probe
177811d9f695Sbellard
17793ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
17803ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
17813ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
17823ec87ffeSPaolo Bonzini  sdl_config=sdl-config
17833ec87ffeSPaolo Bonzinifi
17843ec87ffeSPaolo Bonzini
178565d5d3f9SStefan Weilif $pkg_config sdl --exists; then
1786a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1787fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
17883ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
17893ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
17909316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1791a0dfd8a4SLoïc Minierelse
1792a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1793a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1794a0dfd8a4SLoïc Minier  fi
1795a0dfd8a4SLoïc Minier  sdl=no
17969316f803SPaolo Bonzinifi
179729e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
17983ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
17993ec87ffeSPaolo Bonzinifi
180011d9f695Sbellard
18019316f803SPaolo Bonzinisdl_too_old=no
1802c4198157SJuan Quintelaif test "$sdl" != "no" ; then
180311d9f695Sbellard  cat > $TMPC << EOF
180411d9f695Sbellard#include <SDL.h>
180511d9f695Sbellard#undef main /* We don't want SDL to override our main() */
180611d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
180711d9f695SbellardEOF
18089316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
180974f42e18STeLeMan  if test "$static" = "yes" ; then
181074f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
181174f42e18STeLeMan  else
18129316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
181374f42e18STeLeMan  fi
181452166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
181511d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
181611d9f695Sbellard      sdl_too_old=yes
181711d9f695Sbellard    else
1818fd677642Sths      if test "$cocoa" = "no" ; then
181911d9f695Sbellard        sdl=yes
182011d9f695Sbellard      fi
1821fd677642Sths    fi
18227c1f25b4Sbellard
182367c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
18241ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
182567c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1826f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1827f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
182811d9f695Sbellard      fi
182952166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
18301ac88f28SJuan Quintela	:
18311ac88f28SJuan Quintela      else
18321ac88f28SJuan Quintela        sdl=no
18337c1f25b4Sbellard      fi
18347c1f25b4Sbellard    fi # static link
1835c4198157SJuan Quintela  else # sdl not found
1836c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1837c4198157SJuan Quintela      feature_not_found "sdl"
1838c4198157SJuan Quintela    fi
1839c4198157SJuan Quintela    sdl=no
18407c1f25b4Sbellard  fi # sdl compile test
1841fd677642Sthsfi
184211d9f695Sbellard
18435368a422Saliguoriif test "$sdl" = "yes" ; then
18445368a422Saliguori  cat > $TMPC <<EOF
18455368a422Saliguori#include <SDL.h>
18465368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
18475368a422Saliguori#include <X11/XKBlib.h>
18485368a422Saliguori#else
18495368a422Saliguori#error No x11 support
18505368a422Saliguori#endif
18515368a422Saliguoriint main(void) { return 0; }
18525368a422SaliguoriEOF
185352166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1854681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
18555368a422Saliguori  fi
18560705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
18575368a422Saliguorifi
18585368a422Saliguori
18598f28f3fbSths##########################################
18602da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries
18612da776dbSMichael R. Hinesif test "$rdma" != "no" ; then
18622da776dbSMichael R. Hines  cat > $TMPC <<EOF
18632da776dbSMichael R. Hines#include <rdma/rdma_cma.h>
18642da776dbSMichael R. Hinesint main(void) { return 0; }
18652da776dbSMichael R. HinesEOF
18662da776dbSMichael R. Hines  rdma_libs="-lrdmacm -libverbs"
18672da776dbSMichael R. Hines  if compile_prog "" "$rdma_libs" ; then
18682da776dbSMichael R. Hines    rdma="yes"
18692da776dbSMichael R. Hines    libs_softmmu="$libs_softmmu $rdma_libs"
18702da776dbSMichael R. Hines  else
18712da776dbSMichael R. Hines    if test "$rdma" = "yes" ; then
18722da776dbSMichael R. Hines        error_exit \
18732da776dbSMichael R. Hines            " OpenFabrics librdmacm/libibverbs not present." \
18742da776dbSMichael R. Hines            " Your options:" \
18752da776dbSMichael R. Hines            "  (1) Fast: Install infiniband packages from your distro." \
18762da776dbSMichael R. Hines            "  (2) Cleanest: Install libraries from www.openfabrics.org" \
18772da776dbSMichael R. Hines            "  (3) Also: Install softiwarp if you don't have RDMA hardware"
18782da776dbSMichael R. Hines    fi
18792da776dbSMichael R. Hines    rdma="no"
18802da776dbSMichael R. Hines  fi
18812da776dbSMichael R. Hinesfi
18822da776dbSMichael R. Hines
18832da776dbSMichael R. Hines##########################################
18847536ee4bSTim Hardeck# VNC TLS/WS detection
18857536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
1886ae6b5e5aSaliguori  cat > $TMPC <<EOF
1887ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1888ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1889ae6b5e5aSaliguoriEOF
1890a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1891a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
189252166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
18937536ee4bSTim Hardeck    if test "$vnc_tls" != "no" ; then
18941be10ad2SJuan Quintela      vnc_tls=yes
18957536ee4bSTim Hardeck    fi
18967536ee4bSTim Hardeck    if test "$vnc_ws" != "no" ; then
18977536ee4bSTim Hardeck      vnc_ws=yes
18987536ee4bSTim Hardeck    fi
1899a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1900ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
1901ae6b5e5aSaliguori  else
19021be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
19031be10ad2SJuan Quintela      feature_not_found "vnc-tls"
19041be10ad2SJuan Quintela    fi
19057536ee4bSTim Hardeck    if test "$vnc_ws" = "yes" ; then
19067536ee4bSTim Hardeck      feature_not_found "vnc-ws"
19077536ee4bSTim Hardeck    fi
19081be10ad2SJuan Quintela    vnc_tls=no
19097536ee4bSTim Hardeck    vnc_ws=no
19108d5d2d4cSths  fi
19118d5d2d4cSthsfi
19128d5d2d4cSths
19138d5d2d4cSths##########################################
19142f9606b3Saliguori# VNC SASL detection
1915821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
19162f9606b3Saliguori  cat > $TMPC <<EOF
19172f9606b3Saliguori#include <sasl/sasl.h>
19182f9606b3Saliguori#include <stdio.h>
19192f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
19202f9606b3SaliguoriEOF
19212f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
19222f9606b3Saliguori  vnc_sasl_cflags=""
19232f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
192452166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1925ea784e3bSJuan Quintela    vnc_sasl=yes
1926fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1927ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
19282f9606b3Saliguori  else
1929ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1930ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1931ea784e3bSJuan Quintela    fi
1932ea784e3bSJuan Quintela    vnc_sasl=no
19332f9606b3Saliguori  fi
19342f9606b3Saliguorifi
19352f9606b3Saliguori
19362f9606b3Saliguori##########################################
19372f6f5c7aSCorentin Chary# VNC JPEG detection
1938821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
19392f6f5c7aSCorentin Charycat > $TMPC <<EOF
19402f6f5c7aSCorentin Chary#include <stdio.h>
19412f6f5c7aSCorentin Chary#include <jpeglib.h>
19422f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
19432f6f5c7aSCorentin CharyEOF
19442f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
19452f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
19462f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
19472f6f5c7aSCorentin Chary    vnc_jpeg=yes
19482f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1949ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
19502f6f5c7aSCorentin Chary  else
19512f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
19522f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
19532f6f5c7aSCorentin Chary    fi
19542f6f5c7aSCorentin Chary    vnc_jpeg=no
19552f6f5c7aSCorentin Chary  fi
19562f6f5c7aSCorentin Charyfi
19572f6f5c7aSCorentin Chary
19582f6f5c7aSCorentin Chary##########################################
1959efe556adSCorentin Chary# VNC PNG detection
1960821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1961efe556adSCorentin Charycat > $TMPC <<EOF
1962efe556adSCorentin Chary//#include <stdio.h>
1963efe556adSCorentin Chary#include <png.h>
1964832ce9c2SScott Wood#include <stddef.h>
1965efe556adSCorentin Charyint main(void) {
1966efe556adSCorentin Chary    png_structp png_ptr;
1967efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
19687edc3fedSPeter Maydell    return png_ptr != 0;
1969efe556adSCorentin Chary}
1970efe556adSCorentin CharyEOF
197165d5d3f9SStefan Weil  if $pkg_config libpng --exists; then
1972ca871ec8SStefan Weil    vnc_png_cflags=`$pkg_config libpng --cflags`
1973ca871ec8SStefan Weil    vnc_png_libs=`$pkg_config libpng --libs`
19749af8025eSBrad  else
1975efe556adSCorentin Chary    vnc_png_cflags=""
1976efe556adSCorentin Chary    vnc_png_libs="-lpng"
19779af8025eSBrad  fi
1978efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1979efe556adSCorentin Chary    vnc_png=yes
1980efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
19819af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1982efe556adSCorentin Chary  else
1983efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1984efe556adSCorentin Chary      feature_not_found "vnc-png"
1985efe556adSCorentin Chary    fi
1986efe556adSCorentin Chary    vnc_png=no
1987efe556adSCorentin Chary  fi
1988efe556adSCorentin Charyfi
1989efe556adSCorentin Chary
1990efe556adSCorentin Chary##########################################
199176655d6dSaliguori# fnmatch() probe, used for ACL routines
199276655d6dSaliguorifnmatch="no"
199376655d6dSaliguoricat > $TMPC << EOF
199476655d6dSaliguori#include <fnmatch.h>
199576655d6dSaliguoriint main(void)
199676655d6dSaliguori{
199776655d6dSaliguori    fnmatch("foo", "foo", 0);
199876655d6dSaliguori    return 0;
199976655d6dSaliguori}
200076655d6dSaliguoriEOF
200152166aa0SJuan Quintelaif compile_prog "" "" ; then
200276655d6dSaliguori   fnmatch="yes"
200376655d6dSaliguorifi
200476655d6dSaliguori
200576655d6dSaliguori##########################################
2006ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
20072d16c8e9SPeter Maydell# Note that on some systems (notably MacOSX) no extra library
20082d16c8e9SPeter Maydell# need be linked to get the uuid functions.
2009ee682d27SStefan Weilif test "$uuid" != "no" ; then
2010ee682d27SStefan Weil  uuid_libs="-luuid"
2011ee682d27SStefan Weil  cat > $TMPC << EOF
2012ee682d27SStefan Weil#include <uuid/uuid.h>
2013ee682d27SStefan Weilint main(void)
2014ee682d27SStefan Weil{
2015ee682d27SStefan Weil    uuid_t my_uuid;
2016ee682d27SStefan Weil    uuid_generate(my_uuid);
2017ee682d27SStefan Weil    return 0;
2018ee682d27SStefan Weil}
2019ee682d27SStefan WeilEOF
20202d16c8e9SPeter Maydell  if compile_prog "" "" ; then
20212d16c8e9SPeter Maydell    uuid="yes"
20222d16c8e9SPeter Maydell  elif compile_prog "" "$uuid_libs" ; then
2023ee682d27SStefan Weil    uuid="yes"
2024ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
2025ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
2026ee682d27SStefan Weil  else
2027ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
2028ee682d27SStefan Weil      feature_not_found "uuid"
2029ee682d27SStefan Weil    fi
2030ee682d27SStefan Weil    uuid=no
2031ee682d27SStefan Weil  fi
2032ee682d27SStefan Weilfi
2033ee682d27SStefan Weil
20344f18b782SJeff Codyif test "$vhdx" = "yes" ; then
20354f18b782SJeff Cody    if test "$uuid" = "no" ; then
20364f18b782SJeff Cody        error_exit "uuid required for VHDX support"
20374f18b782SJeff Cody    fi
20384f18b782SJeff Codyelif test "$vhdx" != "no" ; then
20394f18b782SJeff Cody    if test "$uuid" = "yes" ; then
20404f18b782SJeff Cody        vhdx=yes
20414f18b782SJeff Cody    else
20424f18b782SJeff Cody        vhdx=no
20434f18b782SJeff Cody    fi
20444f18b782SJeff Codyfi
20454f18b782SJeff Cody
2046ee682d27SStefan Weil##########################################
2047dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
2048dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
2049dce512deSChristoph Hellwig  cat > $TMPC << EOF
2050ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
2051dce512deSChristoph Hellwig#include <xfs/xfs.h>
2052dce512deSChristoph Hellwigint main(void)
2053dce512deSChristoph Hellwig{
2054dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
2055dce512deSChristoph Hellwig    return 0;
2056dce512deSChristoph Hellwig}
2057dce512deSChristoph HellwigEOF
2058dce512deSChristoph Hellwig  if compile_prog "" "" ; then
2059dce512deSChristoph Hellwig    xfs="yes"
2060dce512deSChristoph Hellwig  else
2061dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
2062dce512deSChristoph Hellwig      feature_not_found "xfs"
2063dce512deSChristoph Hellwig    fi
2064dce512deSChristoph Hellwig    xfs=no
2065dce512deSChristoph Hellwig  fi
2066dce512deSChristoph Hellwigfi
2067dce512deSChristoph Hellwig
2068dce512deSChristoph Hellwig##########################################
20698a16d273Sths# vde libraries probe
2070dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
20714baae0acSJuan Quintela  vde_libs="-lvdeplug"
20728a16d273Sths  cat > $TMPC << EOF
20738a16d273Sths#include <libvdeplug.h>
20744a7f0e06Spbrookint main(void)
20754a7f0e06Spbrook{
20764a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
2077fea08e08SPeter Maydell    char s[] = "";
2078fea08e08SPeter Maydell    vde_open(s, s, &a);
20794a7f0e06Spbrook    return 0;
20804a7f0e06Spbrook}
20818a16d273SthsEOF
208252166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
20834baae0acSJuan Quintela    vde=yes
20848e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
20858e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
2086dfb278bdSJuan Quintela  else
2087dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
2088dfb278bdSJuan Quintela      feature_not_found "vde"
2089dfb278bdSJuan Quintela    fi
2090dfb278bdSJuan Quintela    vde=no
20918a16d273Sths  fi
20928a16d273Sthsfi
20938a16d273Sths
20948a16d273Sths##########################################
209547e98658SCorey Bryant# libcap-ng library probe
209647e98658SCorey Bryantif test "$cap_ng" != "no" ; then
209747e98658SCorey Bryant  cap_libs="-lcap-ng"
209847e98658SCorey Bryant  cat > $TMPC << EOF
209947e98658SCorey Bryant#include <cap-ng.h>
210047e98658SCorey Bryantint main(void)
210147e98658SCorey Bryant{
210247e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
210347e98658SCorey Bryant    return 0;
210447e98658SCorey Bryant}
210547e98658SCorey BryantEOF
210647e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
210747e98658SCorey Bryant    cap_ng=yes
210847e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
210947e98658SCorey Bryant  else
211047e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
211147e98658SCorey Bryant      feature_not_found "cap_ng"
211247e98658SCorey Bryant    fi
211347e98658SCorey Bryant    cap_ng=no
211447e98658SCorey Bryant  fi
211547e98658SCorey Bryantfi
211647e98658SCorey Bryant
211747e98658SCorey Bryant##########################################
2118c2de5c91Smalc# Sound support libraries probe
21198f28f3fbSths
2120c2de5c91Smalcaudio_drv_probe()
2121c2de5c91Smalc{
2122c2de5c91Smalc    drv=$1
2123c2de5c91Smalc    hdr=$2
2124c2de5c91Smalc    lib=$3
2125c2de5c91Smalc    exp=$4
2126c2de5c91Smalc    cfl=$5
21278f28f3fbSths        cat > $TMPC << EOF
2128c2de5c91Smalc#include <$hdr>
2129c2de5c91Smalcint main(void) { $exp }
21308f28f3fbSthsEOF
213152166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
21328f28f3fbSths        :
21338f28f3fbSths    else
213476ad07a4SPeter Maydell        error_exit "$drv check failed" \
213576ad07a4SPeter Maydell            "Make sure to have the $drv libs and headers installed."
21368f28f3fbSths    fi
2137c2de5c91Smalc}
2138c2de5c91Smalc
21392fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2140c2de5c91Smalcfor drv in $audio_drv_list; do
2141c2de5c91Smalc    case $drv in
2142c2de5c91Smalc    alsa)
2143c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
2144e35bcb0cSStefan Weil        "return snd_pcm_close((snd_pcm_t *)0);"
2145a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
2146c2de5c91Smalc    ;;
2147c2de5c91Smalc
2148c2de5c91Smalc    fmod)
2149c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
215076ad07a4SPeter Maydell        error_exit "You must specify path to FMOD library and headers" \
215176ad07a4SPeter Maydell            "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
21528f28f3fbSths    fi
2153c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2154a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
2155c2de5c91Smalc    ;;
2156c2de5c91Smalc
2157c2de5c91Smalc    esd)
2158c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2159a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
216067f86e8eSJuan Quintela    audio_pt_int="yes"
2161c2de5c91Smalc    ;;
2162b8e59f18Smalc
2163b8e59f18Smalc    pa)
2164a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2165a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2166a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
216767f86e8eSJuan Quintela    audio_pt_int="yes"
2168b8e59f18Smalc    ;;
2169b8e59f18Smalc
2170997e690aSJuan Quintela    coreaudio)
2171997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
2172997e690aSJuan Quintela    ;;
2173997e690aSJuan Quintela
2174a4bf6780SJuan Quintela    dsound)
2175a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2176d5631638Smalc      audio_win_int="yes"
2177a4bf6780SJuan Quintela    ;;
2178a4bf6780SJuan Quintela
2179a4bf6780SJuan Quintela    oss)
2180a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
2181a4bf6780SJuan Quintela    ;;
2182a4bf6780SJuan Quintela
2183a4bf6780SJuan Quintela    sdl|wav)
21842f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
21852f6a1ab0Sblueswir1    ;;
21862f6a1ab0Sblueswir1
2187d5631638Smalc    winwave)
2188d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
2189d5631638Smalc      audio_win_int="yes"
2190d5631638Smalc    ;;
2191d5631638Smalc
2192e4c63a6aSmalc    *)
21931c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
219476ad07a4SPeter Maydell        error_exit "Unknown driver '$drv' selected" \
219576ad07a4SPeter Maydell            "Possible drivers are: $audio_possible_drivers"
2196e4c63a6aSmalc    }
2197e4c63a6aSmalc    ;;
2198c2de5c91Smalc    esac
2199c2de5c91Smalcdone
22008f28f3fbSths
22014d3b6f6eSbalrog##########################################
22022e4d9fb1Saurel32# BrlAPI probe
22032e4d9fb1Saurel32
22044ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
2205eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
22062e4d9fb1Saurel32  cat > $TMPC << EOF
22072e4d9fb1Saurel32#include <brlapi.h>
2208832ce9c2SScott Wood#include <stddef.h>
22092e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
22102e4d9fb1Saurel32EOF
221152166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
22122e4d9fb1Saurel32    brlapi=yes
2213264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
22144ffcedb6SJuan Quintela  else
22154ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
22164ffcedb6SJuan Quintela      feature_not_found "brlapi"
22174ffcedb6SJuan Quintela    fi
22184ffcedb6SJuan Quintela    brlapi=no
2219eb82284fSJuan Quintela  fi
2220eb82284fSJuan Quintelafi
22212e4d9fb1Saurel32
22222e4d9fb1Saurel32##########################################
22234d3b6f6eSbalrog# curses probe
2224a3605bf6SMichael Tokarevif test "$curses" != "no" ; then
2225e095e2f3SStefan Weil  if test "$mingw32" = "yes" ; then
2226e095e2f3SStefan Weil    curses_list="-lpdcurses"
2227e095e2f3SStefan Weil  else
2228cfeda5f4SEd Maste    curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2229e095e2f3SStefan Weil  fi
2230c584a6d0SJuan Quintela  curses_found=no
22314d3b6f6eSbalrog  cat > $TMPC << EOF
22324d3b6f6eSbalrog#include <curses.h>
2233ef9a2524SStefan Weilint main(void) {
2234ef9a2524SStefan Weil  const char *s = curses_version();
2235ef9a2524SStefan Weil  resize_term(0, 0);
2236ef9a2524SStefan Weil  return s != 0;
2237ef9a2524SStefan Weil}
22384d3b6f6eSbalrogEOF
2239ecbe251fSVadim Evard  IFS=:
22404f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
2241ecbe251fSVadim Evard    unset IFS
22424f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
2243c584a6d0SJuan Quintela      curses_found=yes
22444f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
22454f78ef9aSJuan Quintela      break
22464d3b6f6eSbalrog    fi
22474f78ef9aSJuan Quintela  done
2248ecbe251fSVadim Evard  unset IFS
2249c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
2250c584a6d0SJuan Quintela    curses=yes
2251c584a6d0SJuan Quintela  else
2252c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
2253c584a6d0SJuan Quintela      feature_not_found "curses"
2254c584a6d0SJuan Quintela    fi
2255c584a6d0SJuan Quintela    curses=no
2256c584a6d0SJuan Quintela  fi
22574f78ef9aSJuan Quintelafi
22584d3b6f6eSbalrog
2259414f0dabSblueswir1##########################################
2260769ce76dSAlexander Graf# curl probe
2261a3605bf6SMichael Tokarevif test "$curl" != "no" ; then
226265d5d3f9SStefan Weil  if $pkg_config libcurl --exists; then
2263a8bd70adSPaolo Bonzini    curlconfig="$pkg_config libcurl"
22644e2b0658SPaolo Bonzini  else
22654e2b0658SPaolo Bonzini    curlconfig=curl-config
22664e2b0658SPaolo Bonzini  fi
2267769ce76dSAlexander Graf  cat > $TMPC << EOF
2268769ce76dSAlexander Graf#include <curl/curl.h>
22690b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2270769ce76dSAlexander GrafEOF
22714e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
22724e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2273b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2274769ce76dSAlexander Graf    curl=yes
2275f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2276f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2277788c8196SJuan Quintela  else
2278788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2279788c8196SJuan Quintela      feature_not_found "curl"
2280788c8196SJuan Quintela    fi
2281788c8196SJuan Quintela    curl=no
2282769ce76dSAlexander Graf  fi
2283769ce76dSAlexander Graffi # test "$curl"
2284769ce76dSAlexander Graf
2285769ce76dSAlexander Graf##########################################
2286fb599c9aSbalrog# bluez support probe
2287a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2288e820e3f4Sbalrog  cat > $TMPC << EOF
2289e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2290e820e3f4Sbalrogint main(void) { return bt_error(0); }
2291e820e3f4SbalrogEOF
2292a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2293a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
229452166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2295a20a6f46SJuan Quintela    bluez=yes
2296e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2297e820e3f4Sbalrog  else
2298a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2299a20a6f46SJuan Quintela      feature_not_found "bluez"
2300a20a6f46SJuan Quintela    fi
2301e820e3f4Sbalrog    bluez="no"
2302e820e3f4Sbalrog  fi
2303fb599c9aSbalrogfi
2304fb599c9aSbalrog
2305fb599c9aSbalrog##########################################
2306e18df141SAnthony Liguori# glib support probe
2307a52d28afSPaolo Bonzini
2308a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2309a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2310a52d28afSPaolo Bonzini    glib_req_ver=2.20
2311a52d28afSPaolo Bonzinielse
2312a52d28afSPaolo Bonzini    glib_req_ver=2.12
2313a52d28afSPaolo Bonzinifi
231465d5d3f9SStefan Weilif $pkg_config --atleast-version=$glib_req_ver gthread-2.0; then
2315ca871ec8SStefan Weil    glib_cflags=`$pkg_config --cflags gthread-2.0`
2316ca871ec8SStefan Weil    glib_libs=`$pkg_config --libs gthread-2.0`
231714015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2318957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2319e18df141SAnthony Liguorielse
232076ad07a4SPeter Maydell    error_exit "glib-$glib_req_ver required to compile QEMU"
2321e18df141SAnthony Liguorifi
2322e18df141SAnthony Liguori
2323e18df141SAnthony Liguori##########################################
2324e2134eb9SGerd Hoffmann# pixman support probe
2325e2134eb9SGerd Hoffmann
2326e2134eb9SGerd Hoffmannif test "$pixman" = ""; then
232774880fe2SRobert Schiele  if test "$want_tools" = "no" -a "$softmmu" = "no"; then
232874880fe2SRobert Schiele    pixman="none"
232974880fe2SRobert Schiele  elif $pkg_config pixman-1 > /dev/null 2>&1; then
2330e2134eb9SGerd Hoffmann    pixman="system"
2331e2134eb9SGerd Hoffmann  else
2332e2134eb9SGerd Hoffmann    pixman="internal"
2333e2134eb9SGerd Hoffmann  fi
2334e2134eb9SGerd Hoffmannfi
233574880fe2SRobert Schieleif test "$pixman" = "none"; then
233674880fe2SRobert Schiele  if test "$want_tools" != "no" -o "$softmmu" != "no"; then
233776ad07a4SPeter Maydell    error_exit "pixman disabled but system emulation or tools build" \
233876ad07a4SPeter Maydell        "enabled.  You can turn off pixman only if you also" \
233976ad07a4SPeter Maydell        "disable all system emulation targets and the tools" \
234076ad07a4SPeter Maydell        "build with '--disable-tools --disable-system'."
234174880fe2SRobert Schiele  fi
234274880fe2SRobert Schiele  pixman_cflags=
234374880fe2SRobert Schiele  pixman_libs=
234474880fe2SRobert Schieleelif test "$pixman" = "system"; then
2345ca871ec8SStefan Weil  pixman_cflags=`$pkg_config --cflags pixman-1`
2346ca871ec8SStefan Weil  pixman_libs=`$pkg_config --libs pixman-1`
2347e2134eb9SGerd Hoffmannelse
2348e2134eb9SGerd Hoffmann  if test ! -d ${source_path}/pixman/pixman; then
234976ad07a4SPeter Maydell    error_exit "pixman not present. Your options:" \
235076ad07a4SPeter Maydell        "  (1) Preferred: Install the pixman devel package (any recent" \
235176ad07a4SPeter Maydell        "      distro should have packages as Xorg needs pixman too)." \
235276ad07a4SPeter Maydell        "  (2) Fetch the pixman submodule, using:" \
235376ad07a4SPeter Maydell        "      git submodule update --init pixman"
2354e2134eb9SGerd Hoffmann  fi
23555ca9388aSGerd Hoffmann  mkdir -p pixman/pixman
23565ca9388aSGerd Hoffmann  pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
23575ca9388aSGerd Hoffmann  pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2358e2134eb9SGerd Hoffmannfi
2359e2134eb9SGerd Hoffmann
2360e2134eb9SGerd Hoffmann##########################################
236117bff52bSM. Mohan Kumar# libcap probe
236217bff52bSM. Mohan Kumar
236317bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
236417bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
236517bff52bSM. Mohan Kumar#include <stdio.h>
236617bff52bSM. Mohan Kumar#include <sys/capability.h>
2367cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
236817bff52bSM. Mohan KumarEOF
236917bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
237017bff52bSM. Mohan Kumar    cap=yes
237117bff52bSM. Mohan Kumar  else
237217bff52bSM. Mohan Kumar    cap=no
237317bff52bSM. Mohan Kumar  fi
237417bff52bSM. Mohan Kumarfi
237517bff52bSM. Mohan Kumar
237617bff52bSM. Mohan Kumar##########################################
2377e5d355d1Saliguori# pthread probe
23784b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
23793c529d93Saliguori
2380e5d355d1Saliguoripthread=no
2381414f0dabSblueswir1cat > $TMPC << EOF
23823c529d93Saliguori#include <pthread.h>
23837a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
23847a42bbe4SStefan Weilint main(void) {
23857a42bbe4SStefan Weil  pthread_t thread;
23867a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
23877a42bbe4SStefan Weil  return 0;
23887a42bbe4SStefan Weil}
2389414f0dabSblueswir1EOF
2390bd00d539SAndreas Färberif compile_prog "" "" ; then
2391bd00d539SAndreas Färber  pthread=yes
2392bd00d539SAndreas Färberelse
2393de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
239452166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2395e5d355d1Saliguori      pthread=yes
2396e3c56761SPeter Portante      found=no
2397e3c56761SPeter Portante      for lib_entry in $LIBS; do
2398e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2399e3c56761SPeter Portante          found=yes
2400e3c56761SPeter Portante          break
2401e3c56761SPeter Portante        fi
2402e3c56761SPeter Portante      done
2403e3c56761SPeter Portante      if test "$found" = "no"; then
24045572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2405e3c56761SPeter Portante      fi
2406de65fe0fSSebastian Herbszt      break
2407414f0dabSblueswir1    fi
2408de65fe0fSSebastian Herbszt  done
2409bd00d539SAndreas Färberfi
2410414f0dabSblueswir1
24114617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
241276ad07a4SPeter Maydell  error_exit "pthread check failed" \
241376ad07a4SPeter Maydell      "Make sure to have the pthread libs and headers installed."
2414e5d355d1Saliguorifi
2415e5d355d1Saliguori
2416bf9298b9Saliguori##########################################
2417f27aaf4bSChristian Brunner# rbd probe
2418f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2419f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2420f27aaf4bSChristian Brunner#include <stdio.h>
2421ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2422f27aaf4bSChristian Brunnerint main(void) {
2423ad32e9c0SJosh Durgin    rados_t cluster;
2424ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2425f27aaf4bSChristian Brunner    return 0;
2426f27aaf4bSChristian Brunner}
2427f27aaf4bSChristian BrunnerEOF
2428ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2429f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2430f27aaf4bSChristian Brunner    rbd=yes
2431f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2432f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2433f27aaf4bSChristian Brunner  else
2434f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2435f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2436f27aaf4bSChristian Brunner    fi
2437f27aaf4bSChristian Brunner    rbd=no
2438f27aaf4bSChristian Brunner  fi
2439f27aaf4bSChristian Brunnerfi
2440f27aaf4bSChristian Brunner
2441f27aaf4bSChristian Brunner##########################################
24420a12ec87SRichard W.M. Jones# libssh2 probe
24434fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8
24440a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then
244565d5d3f9SStefan Weil  if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
24460a12ec87SRichard W.M. Jones    libssh2_cflags=`$pkg_config libssh2 --cflags`
24470a12ec87SRichard W.M. Jones    libssh2_libs=`$pkg_config libssh2 --libs`
24480a12ec87SRichard W.M. Jones    libssh2=yes
24490a12ec87SRichard W.M. Jones    libs_tools="$libssh2_libs $libs_tools"
24500a12ec87SRichard W.M. Jones    libs_softmmu="$libssh2_libs $libs_softmmu"
24510a12ec87SRichard W.M. Jones    QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags"
24520a12ec87SRichard W.M. Jones  else
24530a12ec87SRichard W.M. Jones    if test "$libssh2" = "yes" ; then
24544fc16838SRichard W.M. Jones      error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
24550a12ec87SRichard W.M. Jones    fi
24560a12ec87SRichard W.M. Jones    libssh2=no
24570a12ec87SRichard W.M. Jones  fi
24580a12ec87SRichard W.M. Jonesfi
24590a12ec87SRichard W.M. Jones
24600a12ec87SRichard W.M. Jones##########################################
24619a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe
24629a2d462eSRichard W.M. Jones
24639a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then
24649a2d462eSRichard W.M. Jones  cat > $TMPC <<EOF
24659a2d462eSRichard W.M. Jones#include <stdio.h>
24669a2d462eSRichard W.M. Jones#include <libssh2.h>
24679a2d462eSRichard W.M. Jones#include <libssh2_sftp.h>
24689a2d462eSRichard W.M. Jonesint main(void) {
24699a2d462eSRichard W.M. Jones    LIBSSH2_SESSION *session;
24709a2d462eSRichard W.M. Jones    LIBSSH2_SFTP *sftp;
24719a2d462eSRichard W.M. Jones    LIBSSH2_SFTP_HANDLE *sftp_handle;
24729a2d462eSRichard W.M. Jones    session = libssh2_session_init ();
24739a2d462eSRichard W.M. Jones    sftp = libssh2_sftp_init (session);
24749a2d462eSRichard W.M. Jones    sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
24759a2d462eSRichard W.M. Jones    libssh2_sftp_fsync (sftp_handle);
24769a2d462eSRichard W.M. Jones    return 0;
24779a2d462eSRichard W.M. Jones}
24789a2d462eSRichard W.M. JonesEOF
24799a2d462eSRichard W.M. Jones  # libssh2_cflags/libssh2_libs defined in previous test.
24809a2d462eSRichard W.M. Jones  if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
24819a2d462eSRichard W.M. Jones    QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
24829a2d462eSRichard W.M. Jones  fi
24839a2d462eSRichard W.M. Jonesfi
24849a2d462eSRichard W.M. Jones
24859a2d462eSRichard W.M. Jones##########################################
24865c6c3a6cSChristoph Hellwig# linux-aio probe
24875c6c3a6cSChristoph Hellwig
24885c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
24895c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
24905c6c3a6cSChristoph Hellwig#include <libaio.h>
24915c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2492832ce9c2SScott Wood#include <stddef.h>
24935c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
24945c6c3a6cSChristoph HellwigEOF
24955c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
24965c6c3a6cSChristoph Hellwig    linux_aio=yes
2497048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2498048d179fSPaul Brook    libs_tools="$libs_tools -laio"
24995c6c3a6cSChristoph Hellwig  else
25005c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
25015c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
25025c6c3a6cSChristoph Hellwig    fi
25033cfcae3cSLuiz Capitulino    linux_aio=no
25045c6c3a6cSChristoph Hellwig  fi
25055c6c3a6cSChristoph Hellwigfi
25065c6c3a6cSChristoph Hellwig
25075c6c3a6cSChristoph Hellwig##########################################
25083b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux
25093b8acc11SPaolo Bonzini
25103b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
25113b8acc11SPaolo Bonzini  tpm_passthrough=$tpm
25123b8acc11SPaolo Bonzinielse
25133b8acc11SPaolo Bonzini  tpm_passthrough=no
25143b8acc11SPaolo Bonzinifi
25153b8acc11SPaolo Bonzini
25163b8acc11SPaolo Bonzini##########################################
2517583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio
2518583f6e7bSStefan Hajnoczi
2519583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \
2520583f6e7bSStefan Hajnoczi	"$linux_aio" != "yes" ; then
252176ad07a4SPeter Maydell  error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2522583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then
2523583f6e7bSStefan Hajnoczi  virtio_blk_data_plane=$linux_aio
2524583f6e7bSStefan Hajnoczifi
2525583f6e7bSStefan Hajnoczi
2526583f6e7bSStefan Hajnoczi##########################################
2527758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2528758e8e38SVenkateswararao Jujjuri (JV)
2529758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2530758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2531758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2532758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2533f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2534f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2535f2338fb4SPavel Borzenkov#else
25364f26f2b6SAvi Kivity#include <sys/xattr.h>
2537f2338fb4SPavel Borzenkov#endif
2538758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2539758e8e38SVenkateswararao Jujjuri (JV)EOF
25404f26f2b6SAvi Kivity  if compile_prog "" "" ; then
25414f26f2b6SAvi Kivity    attr=yes
25424f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2543f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2544758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2545758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
25464f26f2b6SAvi Kivity    libattr=yes
2547758e8e38SVenkateswararao Jujjuri (JV)  else
2548758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2549758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2550758e8e38SVenkateswararao Jujjuri (JV)    fi
2551758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2552758e8e38SVenkateswararao Jujjuri (JV)  fi
2553758e8e38SVenkateswararao Jujjuri (JV)fi
2554758e8e38SVenkateswararao Jujjuri (JV)
2555758e8e38SVenkateswararao Jujjuri (JV)##########################################
2556bf9298b9Saliguori# iovec probe
2557bf9298b9Saliguoricat > $TMPC <<EOF
2558db34f0b3Sblueswir1#include <sys/types.h>
2559bf9298b9Saliguori#include <sys/uio.h>
2560db34f0b3Sblueswir1#include <unistd.h>
2561f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2562bf9298b9SaliguoriEOF
2563bf9298b9Saliguoriiovec=no
256452166aa0SJuan Quintelaif compile_prog "" "" ; then
2565bf9298b9Saliguori  iovec=yes
2566bf9298b9Saliguorifi
2567bf9298b9Saliguori
2568f652e6afSaurel32##########################################
2569ceb42de8Saliguori# preadv probe
2570ceb42de8Saliguoricat > $TMPC <<EOF
2571ceb42de8Saliguori#include <sys/types.h>
2572ceb42de8Saliguori#include <sys/uio.h>
2573ceb42de8Saliguori#include <unistd.h>
2574c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); }
2575ceb42de8SaliguoriEOF
2576ceb42de8Saliguoripreadv=no
257752166aa0SJuan Quintelaif compile_prog "" "" ; then
2578ceb42de8Saliguori  preadv=yes
2579ceb42de8Saliguorifi
2580ceb42de8Saliguori
2581ceb42de8Saliguori##########################################
2582f652e6afSaurel32# fdt probe
2583e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures,
2584e169e1e1SPeter Maydell# so insist on it if we're building those system emulators.
2585e169e1e1SPeter Maydellfdt_required=no
2586e169e1e1SPeter Maydellfor target in $target_list; do
2587e169e1e1SPeter Maydell  case $target in
25886a49fa95SAlexander Graf    aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
2589e169e1e1SPeter Maydell      fdt_required=yes
2590e169e1e1SPeter Maydell    ;;
2591e169e1e1SPeter Maydell  esac
2592e169e1e1SPeter Maydelldone
2593e169e1e1SPeter Maydell
2594e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then
2595e169e1e1SPeter Maydell  if test "$fdt" = "no"; then
2596e169e1e1SPeter Maydell    error_exit "fdt disabled but some requested targets require it." \
2597e169e1e1SPeter Maydell      "You can turn off fdt only if you also disable all the system emulation" \
2598e169e1e1SPeter Maydell      "targets which need it (by specifying a cut down --target-list)."
2599e169e1e1SPeter Maydell  fi
2600e169e1e1SPeter Maydell  fdt=yes
2601e169e1e1SPeter Maydellfi
2602e169e1e1SPeter Maydell
26032df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2604b41af4baSJuan Quintela  fdt_libs="-lfdt"
260596ce6545SPeter Crosthwaite  # explicitly check for libfdt_env.h as it is missing in some stable installs
2606f652e6afSaurel32  cat > $TMPC << EOF
260796ce6545SPeter Crosthwaite#include <libfdt_env.h>
2608f652e6afSaurel32int main(void) { return 0; }
2609f652e6afSaurel32EOF
261052166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2611a540f158SPeter Crosthwaite    # system DTC is good - use it
2612f652e6afSaurel32    fdt=yes
2613a540f158SPeter Crosthwaite  elif test -d ${source_path}/dtc/libfdt ; then
2614a540f158SPeter Crosthwaite    # have submodule DTC - use it
2615a540f158SPeter Crosthwaite    fdt=yes
2616a540f158SPeter Crosthwaite    dtc_internal="yes"
2617a540f158SPeter Crosthwaite    mkdir -p dtc
2618a540f158SPeter Crosthwaite    if [ "$source_path" != `pwd` ] ; then
2619a540f158SPeter Crosthwaite       symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2620a540f158SPeter Crosthwaite       symlink "$source_path/dtc/scripts" "dtc/scripts"
26212df87df7SJuan Quintela    fi
2622a540f158SPeter Crosthwaite    fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2623a540f158SPeter Crosthwaite    fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2624a540f158SPeter Crosthwaite  elif test "$fdt" = "yes" ; then
2625a540f158SPeter Crosthwaite    # have neither and want - prompt for system/submodule install
2626f2c4ddd9SAndreas Färber    error_exit "DTC not present. Your options:" \
2627a540f158SPeter Crosthwaite        "  (1) Preferred: Install the DTC devel package" \
2628a540f158SPeter Crosthwaite        "  (2) Fetch the DTC submodule, using:" \
2629a540f158SPeter Crosthwaite        "      git submodule update --init dtc"
2630a540f158SPeter Crosthwaite  else
2631a540f158SPeter Crosthwaite    # don't have and don't want
2632de3a354aSMichael Walle    fdt_libs=
26332df87df7SJuan Quintela    fdt=no
2634f652e6afSaurel32  fi
2635f652e6afSaurel32fi
2636f652e6afSaurel32
2637a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs"
2638a540f158SPeter Crosthwaite
263920ff075bSMichael Walle##########################################
2640b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2
2641b1e5fff4SMichael Walleif test "$glx" != "no" ; then
2642b1e5fff4SMichael Walle  glx_libs="-lGL -lX11"
264320ff075bSMichael Walle  cat > $TMPC << EOF
264420ff075bSMichael Walle#include <X11/Xlib.h>
264520ff075bSMichael Walle#include <GL/gl.h>
264620ff075bSMichael Walle#include <GL/glx.h>
2647d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
264820ff075bSMichael WalleEOF
2649d3fcbb16SMichael Walle  if compile_prog "" "-lGL -lX11" ; then
2650b1e5fff4SMichael Walle    glx=yes
265120ff075bSMichael Walle  else
2652b1e5fff4SMichael Walle    if test "$glx" = "yes" ; then
2653b1e5fff4SMichael Walle      feature_not_found "glx"
265420ff075bSMichael Walle    fi
2655b1e5fff4SMichael Walle    glx_libs=
2656b1e5fff4SMichael Walle    glx=no
265720ff075bSMichael Walle  fi
265820ff075bSMichael Wallefi
265920ff075bSMichael Walle
2660eb100396SBharata B Rao##########################################
2661eb100396SBharata B Rao# glusterfs probe
2662eb100396SBharata B Raoif test "$glusterfs" != "no" ; then
266365d5d3f9SStefan Weil  if $pkg_config --atleast-version=3 glusterfs-api; then
2664e01bee08SBharata B Rao    glusterfs="yes"
2665ca871ec8SStefan Weil    glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2666ca871ec8SStefan Weil    glusterfs_libs=`$pkg_config --libs glusterfs-api`
2667e01bee08SBharata B Rao    CFLAGS="$CFLAGS $glusterfs_cflags"
2668eb100396SBharata B Rao    libs_tools="$glusterfs_libs $libs_tools"
2669eb100396SBharata B Rao    libs_softmmu="$glusterfs_libs $libs_softmmu"
267065d5d3f9SStefan Weil    if $pkg_config --atleast-version=5 glusterfs-api; then
26710c14fb47SBharata B Rao      glusterfs_discard="yes"
26720c14fb47SBharata B Rao    fi
2673eb100396SBharata B Rao  else
2674eb100396SBharata B Rao    if test "$glusterfs" = "yes" ; then
2675eb100396SBharata B Rao      feature_not_found "GlusterFS backend support"
2676eb100396SBharata B Rao    fi
2677e01bee08SBharata B Rao    glusterfs="no"
2678eb100396SBharata B Rao  fi
2679eb100396SBharata B Raofi
2680eb100396SBharata B Rao
268139386ac7Saurel32# Check for inotify functions when we are building linux-user
26823b3f24adSaurel32# emulator.  This is done because older glibc versions don't
26833b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
26843b3f24adSaurel32# don't provide them even if kernel supports them.
26853b3f24adSaurel32#
26863b3f24adSaurel32inotify=no
26873b3f24adSaurel32cat > $TMPC << EOF
26883b3f24adSaurel32#include <sys/inotify.h>
26893b3f24adSaurel32
26903b3f24adSaurel32int
26913b3f24adSaurel32main(void)
26923b3f24adSaurel32{
26933b3f24adSaurel32	/* try to start inotify */
26948690e420Saurel32	return inotify_init();
26953b3f24adSaurel32}
26963b3f24adSaurel32EOF
269752166aa0SJuan Quintelaif compile_prog "" "" ; then
26983b3f24adSaurel32  inotify=yes
26993b3f24adSaurel32fi
27003b3f24adSaurel32
2701c05c7a73SRiku Voipioinotify1=no
2702c05c7a73SRiku Voipiocat > $TMPC << EOF
2703c05c7a73SRiku Voipio#include <sys/inotify.h>
2704c05c7a73SRiku Voipio
2705c05c7a73SRiku Voipioint
2706c05c7a73SRiku Voipiomain(void)
2707c05c7a73SRiku Voipio{
2708c05c7a73SRiku Voipio    /* try to start inotify */
2709c05c7a73SRiku Voipio    return inotify_init1(0);
2710c05c7a73SRiku Voipio}
2711c05c7a73SRiku VoipioEOF
2712c05c7a73SRiku Voipioif compile_prog "" "" ; then
2713c05c7a73SRiku Voipio  inotify1=yes
2714c05c7a73SRiku Voipiofi
2715c05c7a73SRiku Voipio
2716ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2717ebc996f3SRiku Voipioutimens=no
2718ebc996f3SRiku Voipiocat > $TMPC << EOF
2719ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2720ebc996f3SRiku Voipio#include <stddef.h>
2721ebc996f3SRiku Voipio#include <fcntl.h>
27223014ee00SPeter Maydell#include <sys/stat.h>
2723ebc996f3SRiku Voipio
2724ebc996f3SRiku Voipioint main(void)
2725ebc996f3SRiku Voipio{
2726ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2727ebc996f3SRiku Voipio    futimens(0, NULL);
2728ebc996f3SRiku Voipio    return 0;
2729ebc996f3SRiku Voipio}
2730ebc996f3SRiku VoipioEOF
273152166aa0SJuan Quintelaif compile_prog "" "" ; then
2732ebc996f3SRiku Voipio  utimens=yes
2733ebc996f3SRiku Voipiofi
2734ebc996f3SRiku Voipio
2735099d6b0fSRiku Voipio# check if pipe2 is there
2736099d6b0fSRiku Voipiopipe2=no
2737099d6b0fSRiku Voipiocat > $TMPC << EOF
2738099d6b0fSRiku Voipio#include <unistd.h>
2739099d6b0fSRiku Voipio#include <fcntl.h>
2740099d6b0fSRiku Voipio
2741099d6b0fSRiku Voipioint main(void)
2742099d6b0fSRiku Voipio{
2743099d6b0fSRiku Voipio    int pipefd[2];
27449bca8162SBruce Rogers    return pipe2(pipefd, O_CLOEXEC);
2745099d6b0fSRiku Voipio}
2746099d6b0fSRiku VoipioEOF
274752166aa0SJuan Quintelaif compile_prog "" "" ; then
2748099d6b0fSRiku Voipio  pipe2=yes
2749099d6b0fSRiku Voipiofi
2750099d6b0fSRiku Voipio
275140ff6d7eSKevin Wolf# check if accept4 is there
275240ff6d7eSKevin Wolfaccept4=no
275340ff6d7eSKevin Wolfcat > $TMPC << EOF
275440ff6d7eSKevin Wolf#include <sys/socket.h>
275540ff6d7eSKevin Wolf#include <stddef.h>
275640ff6d7eSKevin Wolf
275740ff6d7eSKevin Wolfint main(void)
275840ff6d7eSKevin Wolf{
275940ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
276040ff6d7eSKevin Wolf    return 0;
276140ff6d7eSKevin Wolf}
276240ff6d7eSKevin WolfEOF
276340ff6d7eSKevin Wolfif compile_prog "" "" ; then
276440ff6d7eSKevin Wolf  accept4=yes
276540ff6d7eSKevin Wolffi
276640ff6d7eSKevin Wolf
27673ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
27683ce34dfbSvibisreenivasansplice=no
27693ce34dfbSvibisreenivasancat > $TMPC << EOF
27703ce34dfbSvibisreenivasan#include <unistd.h>
27713ce34dfbSvibisreenivasan#include <fcntl.h>
27723ce34dfbSvibisreenivasan#include <limits.h>
27733ce34dfbSvibisreenivasan
27743ce34dfbSvibisreenivasanint main(void)
27753ce34dfbSvibisreenivasan{
277666ea0f22SStefan Weil    int len, fd = 0;
27773ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
27783ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
27793ce34dfbSvibisreenivasan    return 0;
27803ce34dfbSvibisreenivasan}
27813ce34dfbSvibisreenivasanEOF
278252166aa0SJuan Quintelaif compile_prog "" "" ; then
27833ce34dfbSvibisreenivasan  splice=yes
27843ce34dfbSvibisreenivasanfi
27853ce34dfbSvibisreenivasan
2786dcc38d1cSMarcelo Tosatti##########################################
2787dcc38d1cSMarcelo Tosatti# signalfd probe
2788dcc38d1cSMarcelo Tosattisignalfd="no"
2789dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2790dcc38d1cSMarcelo Tosatti#include <unistd.h>
2791dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2792dcc38d1cSMarcelo Tosatti#include <signal.h>
2793dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2794dcc38d1cSMarcelo TosattiEOF
2795dcc38d1cSMarcelo Tosatti
2796dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2797dcc38d1cSMarcelo Tosatti  signalfd=yes
2798dcc38d1cSMarcelo Tosattifi
2799dcc38d1cSMarcelo Tosatti
2800c2882b96SRiku Voipio# check if eventfd is supported
2801c2882b96SRiku Voipioeventfd=no
2802c2882b96SRiku Voipiocat > $TMPC << EOF
2803c2882b96SRiku Voipio#include <sys/eventfd.h>
2804c2882b96SRiku Voipio
2805c2882b96SRiku Voipioint main(void)
2806c2882b96SRiku Voipio{
280755cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2808c2882b96SRiku Voipio}
2809c2882b96SRiku VoipioEOF
2810c2882b96SRiku Voipioif compile_prog "" "" ; then
2811c2882b96SRiku Voipio  eventfd=yes
2812c2882b96SRiku Voipiofi
2813c2882b96SRiku Voipio
2814d0927938SUlrich Hecht# check for fallocate
2815d0927938SUlrich Hechtfallocate=no
2816d0927938SUlrich Hechtcat > $TMPC << EOF
2817d0927938SUlrich Hecht#include <fcntl.h>
2818d0927938SUlrich Hecht
2819d0927938SUlrich Hechtint main(void)
2820d0927938SUlrich Hecht{
2821d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2822d0927938SUlrich Hecht    return 0;
2823d0927938SUlrich Hecht}
2824d0927938SUlrich HechtEOF
28258fb03151SPeter Maydellif compile_prog "" "" ; then
2826d0927938SUlrich Hecht  fallocate=yes
2827d0927938SUlrich Hechtfi
2828d0927938SUlrich Hecht
28293d4fa43eSKusanagi Kouichi# check for fallocate hole punching
28303d4fa43eSKusanagi Kouichifallocate_punch_hole=no
28313d4fa43eSKusanagi Kouichicat > $TMPC << EOF
28323d4fa43eSKusanagi Kouichi#include <fcntl.h>
28333d4fa43eSKusanagi Kouichi#include <linux/falloc.h>
28343d4fa43eSKusanagi Kouichi
28353d4fa43eSKusanagi Kouichiint main(void)
28363d4fa43eSKusanagi Kouichi{
28373d4fa43eSKusanagi Kouichi    fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
28383d4fa43eSKusanagi Kouichi    return 0;
28393d4fa43eSKusanagi Kouichi}
28403d4fa43eSKusanagi KouichiEOF
28413d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then
28423d4fa43eSKusanagi Kouichi  fallocate_punch_hole=yes
28433d4fa43eSKusanagi Kouichifi
28443d4fa43eSKusanagi Kouichi
2845c727f47dSPeter Maydell# check for sync_file_range
2846c727f47dSPeter Maydellsync_file_range=no
2847c727f47dSPeter Maydellcat > $TMPC << EOF
2848c727f47dSPeter Maydell#include <fcntl.h>
2849c727f47dSPeter Maydell
2850c727f47dSPeter Maydellint main(void)
2851c727f47dSPeter Maydell{
2852c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2853c727f47dSPeter Maydell    return 0;
2854c727f47dSPeter Maydell}
2855c727f47dSPeter MaydellEOF
28568fb03151SPeter Maydellif compile_prog "" "" ; then
2857c727f47dSPeter Maydell  sync_file_range=yes
2858c727f47dSPeter Maydellfi
2859c727f47dSPeter Maydell
2860dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2861dace20dcSPeter Maydellfiemap=no
2862dace20dcSPeter Maydellcat > $TMPC << EOF
2863dace20dcSPeter Maydell#include <sys/ioctl.h>
2864dace20dcSPeter Maydell#include <linux/fs.h>
2865dace20dcSPeter Maydell#include <linux/fiemap.h>
2866dace20dcSPeter Maydell
2867dace20dcSPeter Maydellint main(void)
2868dace20dcSPeter Maydell{
2869dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2870dace20dcSPeter Maydell    return 0;
2871dace20dcSPeter Maydell}
2872dace20dcSPeter MaydellEOF
28738fb03151SPeter Maydellif compile_prog "" "" ; then
2874dace20dcSPeter Maydell  fiemap=yes
2875dace20dcSPeter Maydellfi
2876dace20dcSPeter Maydell
2877d0927938SUlrich Hecht# check for dup3
2878d0927938SUlrich Hechtdup3=no
2879d0927938SUlrich Hechtcat > $TMPC << EOF
2880d0927938SUlrich Hecht#include <unistd.h>
2881d0927938SUlrich Hecht
2882d0927938SUlrich Hechtint main(void)
2883d0927938SUlrich Hecht{
2884d0927938SUlrich Hecht    dup3(0, 0, 0);
2885d0927938SUlrich Hecht    return 0;
2886d0927938SUlrich Hecht}
2887d0927938SUlrich HechtEOF
288878f5d726SJan Kiszkaif compile_prog "" "" ; then
2889d0927938SUlrich Hecht  dup3=yes
2890d0927938SUlrich Hechtfi
2891d0927938SUlrich Hecht
28924e0c6529SAlex Bligh# check for ppoll support
28934e0c6529SAlex Blighppoll=no
28944e0c6529SAlex Blighcat > $TMPC << EOF
28954e0c6529SAlex Bligh#include <poll.h>
28964e0c6529SAlex Bligh
28974e0c6529SAlex Blighint main(void)
28984e0c6529SAlex Bligh{
28994e0c6529SAlex Bligh    struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
29004e0c6529SAlex Bligh    ppoll(&pfd, 1, 0, 0);
29014e0c6529SAlex Bligh    return 0;
29024e0c6529SAlex Bligh}
29034e0c6529SAlex BlighEOF
29044e0c6529SAlex Blighif compile_prog "" "" ; then
29054e0c6529SAlex Bligh  ppoll=yes
29064e0c6529SAlex Blighfi
29074e0c6529SAlex Bligh
2908cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support
2909cd758dd0SAlex Blighprctl_pr_set_timerslack=no
2910cd758dd0SAlex Blighcat > $TMPC << EOF
2911cd758dd0SAlex Bligh#include <sys/prctl.h>
2912cd758dd0SAlex Bligh
2913cd758dd0SAlex Blighint main(void)
2914cd758dd0SAlex Bligh{
2915cd758dd0SAlex Bligh    prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
2916cd758dd0SAlex Bligh    return 0;
2917cd758dd0SAlex Bligh}
2918cd758dd0SAlex BlighEOF
2919cd758dd0SAlex Blighif compile_prog "" "" ; then
2920cd758dd0SAlex Bligh  prctl_pr_set_timerslack=yes
2921cd758dd0SAlex Blighfi
2922cd758dd0SAlex Bligh
29233b6edd16SPeter Maydell# check for epoll support
29243b6edd16SPeter Maydellepoll=no
29253b6edd16SPeter Maydellcat > $TMPC << EOF
29263b6edd16SPeter Maydell#include <sys/epoll.h>
29273b6edd16SPeter Maydell
29283b6edd16SPeter Maydellint main(void)
29293b6edd16SPeter Maydell{
29303b6edd16SPeter Maydell    epoll_create(0);
29313b6edd16SPeter Maydell    return 0;
29323b6edd16SPeter Maydell}
29333b6edd16SPeter MaydellEOF
29348fb03151SPeter Maydellif compile_prog "" "" ; then
29353b6edd16SPeter Maydell  epoll=yes
29363b6edd16SPeter Maydellfi
29373b6edd16SPeter Maydell
29383b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
29393b6edd16SPeter Maydell# so we must check separately for their presence
29403b6edd16SPeter Maydellepoll_create1=no
29413b6edd16SPeter Maydellcat > $TMPC << EOF
29423b6edd16SPeter Maydell#include <sys/epoll.h>
29433b6edd16SPeter Maydell
29443b6edd16SPeter Maydellint main(void)
29453b6edd16SPeter Maydell{
294619e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
294719e83f6bSPeter Maydell     * a function being called. This is necessary so that on
294819e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
294919e83f6bSPeter Maydell     * the library but not declared in the header file we will
295019e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
295119e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
295219e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
295319e83f6bSPeter Maydell     */
2954c075a723SBlue Swirl    return (int)(uintptr_t)&epoll_create1;
29553b6edd16SPeter Maydell}
29563b6edd16SPeter MaydellEOF
29578fb03151SPeter Maydellif compile_prog "" "" ; then
29583b6edd16SPeter Maydell  epoll_create1=yes
29593b6edd16SPeter Maydellfi
29603b6edd16SPeter Maydell
29613b6edd16SPeter Maydellepoll_pwait=no
29623b6edd16SPeter Maydellcat > $TMPC << EOF
29633b6edd16SPeter Maydell#include <sys/epoll.h>
29643b6edd16SPeter Maydell
29653b6edd16SPeter Maydellint main(void)
29663b6edd16SPeter Maydell{
29673b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
29683b6edd16SPeter Maydell    return 0;
29693b6edd16SPeter Maydell}
29703b6edd16SPeter MaydellEOF
29718fb03151SPeter Maydellif compile_prog "" "" ; then
29723b6edd16SPeter Maydell  epoll_pwait=yes
29733b6edd16SPeter Maydellfi
29743b6edd16SPeter Maydell
2975a8fd1abaSPeter Maydell# check for sendfile support
2976a8fd1abaSPeter Maydellsendfile=no
2977a8fd1abaSPeter Maydellcat > $TMPC << EOF
2978a8fd1abaSPeter Maydell#include <sys/sendfile.h>
2979a8fd1abaSPeter Maydell
2980a8fd1abaSPeter Maydellint main(void)
2981a8fd1abaSPeter Maydell{
2982a8fd1abaSPeter Maydell    return sendfile(0, 0, 0, 0);
2983a8fd1abaSPeter Maydell}
2984a8fd1abaSPeter MaydellEOF
2985a8fd1abaSPeter Maydellif compile_prog "" "" ; then
2986a8fd1abaSPeter Maydell  sendfile=yes
2987a8fd1abaSPeter Maydellfi
2988a8fd1abaSPeter Maydell
2989cc8ae6deSpbrook# Check if tools are available to build documentation.
2990a25dba17SJuan Quintelaif test "$docs" != "no" ; then
299101668d98SStefan Weil  if has makeinfo && has pod2man; then
2992a25dba17SJuan Quintela    docs=yes
299383a3ab8bSJuan Quintela  else
2994a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2995a25dba17SJuan Quintela      feature_not_found "docs"
299683a3ab8bSJuan Quintela    fi
2997a25dba17SJuan Quintela    docs=no
299883a3ab8bSJuan Quintela  fi
2999cc8ae6deSpbrookfi
3000cc8ae6deSpbrook
3001f514f41cSStefan Weil# Search for bswap_32 function
30026ae9a1f4SJuan Quintelabyteswap_h=no
30036ae9a1f4SJuan Quintelacat > $TMPC << EOF
30046ae9a1f4SJuan Quintela#include <byteswap.h>
30056ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
30066ae9a1f4SJuan QuintelaEOF
300752166aa0SJuan Quintelaif compile_prog "" "" ; then
30086ae9a1f4SJuan Quintela  byteswap_h=yes
30096ae9a1f4SJuan Quintelafi
30106ae9a1f4SJuan Quintela
301175f13596SStefan Weil# Search for bswap32 function
30126ae9a1f4SJuan Quintelabswap_h=no
30136ae9a1f4SJuan Quintelacat > $TMPC << EOF
30146ae9a1f4SJuan Quintela#include <sys/endian.h>
30156ae9a1f4SJuan Quintela#include <sys/types.h>
30166ae9a1f4SJuan Quintela#include <machine/bswap.h>
30176ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
30186ae9a1f4SJuan QuintelaEOF
301952166aa0SJuan Quintelaif compile_prog "" "" ; then
30206ae9a1f4SJuan Quintela  bswap_h=yes
30216ae9a1f4SJuan Quintelafi
30226ae9a1f4SJuan Quintela
3023da93a1fdSaliguori##########################################
3024c589b249SRonnie Sahlberg# Do we have libiscsi
3025fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a
3026fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi.
3027c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
3028c589b249SRonnie Sahlberg  cat > $TMPC << EOF
3029fa6acb0cSRonnie Sahlberg#include <stdio.h>
3030c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
3031fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
3032c589b249SRonnie SahlbergEOF
303365d5d3f9SStefan Weil  if $pkg_config --atleast-version=1.7.0 libiscsi; then
30343c33ea96SPaolo Bonzini    libiscsi="yes"
3035ca871ec8SStefan Weil    libiscsi_cflags=$($pkg_config --cflags libiscsi)
3036ca871ec8SStefan Weil    libiscsi_libs=$($pkg_config --libs libiscsi)
30373c33ea96SPaolo Bonzini    CFLAGS="$CFLAGS $libiscsi_cflags"
30383c33ea96SPaolo Bonzini    LIBS="$LIBS $libiscsi_libs"
30393c33ea96SPaolo Bonzini  elif compile_prog "" "-liscsi" ; then
3040c589b249SRonnie Sahlberg    libiscsi="yes"
3041c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
3042c589b249SRonnie Sahlberg  else
3043c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
3044c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
3045c589b249SRonnie Sahlberg    fi
3046c589b249SRonnie Sahlberg    libiscsi="no"
3047c589b249SRonnie Sahlberg  fi
3048c589b249SRonnie Sahlbergfi
3049c589b249SRonnie Sahlberg
3050c589b249SRonnie Sahlberg
3051c589b249SRonnie Sahlberg##########################################
30528bacde8dSNatanael Copa# Do we need libm
30538bacde8dSNatanael Copacat > $TMPC << EOF
30548bacde8dSNatanael Copa#include <math.h>
30558bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); }
30568bacde8dSNatanael CopaEOF
30578bacde8dSNatanael Copaif compile_prog "" "" ; then
30588bacde8dSNatanael Copa  :
30598bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then
30608bacde8dSNatanael Copa  LIBS="-lm $LIBS"
30618bacde8dSNatanael Copa  libs_qga="-lm $libs_qga"
30628bacde8dSNatanael Copaelse
306376ad07a4SPeter Maydell  error_exit "libm check failed"
30648bacde8dSNatanael Copafi
30658bacde8dSNatanael Copa
30668bacde8dSNatanael Copa##########################################
3067da93a1fdSaliguori# Do we need librt
30688bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime
30698bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't
30708bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this
30718bacde8dSNatanael Copa# function in addition.
3072da93a1fdSaliguoricat > $TMPC <<EOF
3073da93a1fdSaliguori#include <signal.h>
3074da93a1fdSaliguori#include <time.h>
30758bacde8dSNatanael Copaint main(void) {
30768bacde8dSNatanael Copa  timer_create(CLOCK_REALTIME, NULL, NULL);
30778bacde8dSNatanael Copa  return clock_gettime(CLOCK_REALTIME, NULL);
30788bacde8dSNatanael Copa}
3079da93a1fdSaliguoriEOF
3080da93a1fdSaliguori
308152166aa0SJuan Quintelaif compile_prog "" "" ; then
308207ffa4bdSJuan Quintela  :
30838bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result
30848bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then
308507ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
30868bacde8dSNatanael Copa  libs_qga="-lrt $libs_qga"
3087da93a1fdSaliguorifi
3088da93a1fdSaliguori
308931ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3090179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
30916362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
30926362a53fSJuan Quintelafi
30936362a53fSJuan Quintela
3094de5071c5SBlue Swirl##########################################
3095cd4ec0b4SGerd Hoffmann# spice probe
3096cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
3097cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
3098cd4ec0b4SGerd Hoffmann#include <spice.h>
3099cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
3100cd4ec0b4SGerd HoffmannEOF
3101710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3102710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
310365d5d3f9SStefan Weil  if $pkg_config --atleast-version=0.12.0 spice-server && \
310465d5d3f9SStefan Weil     $pkg_config --atleast-version=0.12.3 spice-protocol && \
3105cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
3106cd4ec0b4SGerd Hoffmann    spice="yes"
3107cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
3108cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
31092e0e3c39SAlon Levy    spice_protocol_version=$($pkg_config --modversion spice-protocol)
31102e0e3c39SAlon Levy    spice_server_version=$($pkg_config --modversion spice-server)
3111cd4ec0b4SGerd Hoffmann  else
3112cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
3113cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
3114cd4ec0b4SGerd Hoffmann    fi
3115cd4ec0b4SGerd Hoffmann    spice="no"
3116cd4ec0b4SGerd Hoffmann  fi
3117cd4ec0b4SGerd Hoffmannfi
3118cd4ec0b4SGerd Hoffmann
3119111a38b0SRobert Relyea# check for libcacard for smartcard support
3120111a38b0SRobert Relyeasmartcard_cflags=""
3121111a38b0SRobert Relyea# TODO - what's the minimal nss version we support?
3122111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then
31235f01e06fSSergei Trofimovich  cat > $TMPC << EOF
31245f01e06fSSergei Trofimovich#include <pk11pub.h>
31255f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
31265f01e06fSSergei TrofimovichEOF
31270b22ef0fSPeter Maydell    smartcard_includes="-I\$(SRC_PATH)/libcacard"
31288c741c22SAlon Levy    libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
31298c741c22SAlon Levy    libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
31306ca026cbSPeter Maydell    test_cflags="$libcacard_cflags"
31316ca026cbSPeter Maydell    # The header files in nss < 3.13.3 have a bug which causes them to
31326ca026cbSPeter Maydell    # emit a warning. If we're going to compile QEMU with -Werror, then
31336ca026cbSPeter Maydell    # test that the headers don't have this bug. Otherwise we would pass
31346ca026cbSPeter Maydell    # the configure test but fail to compile QEMU later.
31356ca026cbSPeter Maydell    if test "$werror" = "yes"; then
31366ca026cbSPeter Maydell        test_cflags="-Werror $test_cflags"
31376ca026cbSPeter Maydell    fi
3138b6fc675bSPaolo Bonzini    if test -n "$libtool" &&
313965d5d3f9SStefan Weil       $pkg_config --atleast-version=3.12.8 nss && \
31406ca026cbSPeter Maydell      compile_prog "$test_cflags" "$libcacard_libs"; then
31415f01e06fSSergei Trofimovich        smartcard_nss="yes"
31420b22ef0fSPeter Maydell        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
31430b22ef0fSPeter Maydell        QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3144ad4cf3f6SPaul Brook        libs_softmmu="$libcacard_libs $libs_softmmu"
3145111a38b0SRobert Relyea    else
3146111a38b0SRobert Relyea        if test "$smartcard_nss" = "yes"; then
3147111a38b0SRobert Relyea            feature_not_found "nss"
3148111a38b0SRobert Relyea        fi
3149111a38b0SRobert Relyea        smartcard_nss="no"
3150111a38b0SRobert Relyea    fi
3151111a38b0SRobert Relyeafi
3152111a38b0SRobert Relyea
31532b2325ffSGerd Hoffmann# check for libusb
31542b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then
315565d5d3f9SStefan Weil    if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
31562b2325ffSGerd Hoffmann        libusb="yes"
3157ca871ec8SStefan Weil        libusb_cflags=$($pkg_config --cflags libusb-1.0)
3158ca871ec8SStefan Weil        libusb_libs=$($pkg_config --libs libusb-1.0)
31592b2325ffSGerd Hoffmann        QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
31602b2325ffSGerd Hoffmann        libs_softmmu="$libs_softmmu $libusb_libs"
31612b2325ffSGerd Hoffmann    else
31622b2325ffSGerd Hoffmann        if test "$libusb" = "yes"; then
31632b2325ffSGerd Hoffmann            feature_not_found "libusb"
31642b2325ffSGerd Hoffmann        fi
31652b2325ffSGerd Hoffmann        libusb="no"
31662b2325ffSGerd Hoffmann    fi
31672b2325ffSGerd Hoffmannfi
31682b2325ffSGerd Hoffmann
316969354a83SHans de Goede# check for usbredirparser for usb network redirection support
317069354a83SHans de Goedeif test "$usb_redir" != "no" ; then
317165d5d3f9SStefan Weil    if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
317269354a83SHans de Goede        usb_redir="yes"
3173ca871ec8SStefan Weil        usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3174ca871ec8SStefan Weil        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
317569354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
317656ab2ad1SAurelien Jarno        libs_softmmu="$libs_softmmu $usb_redir_libs"
317769354a83SHans de Goede    else
317869354a83SHans de Goede        if test "$usb_redir" = "yes"; then
317969354a83SHans de Goede            feature_not_found "usb-redir"
318069354a83SHans de Goede        fi
318169354a83SHans de Goede        usb_redir="no"
318269354a83SHans de Goede    fi
318369354a83SHans de Goedefi
318469354a83SHans de Goede
3185cd4ec0b4SGerd Hoffmann##########################################
3186d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win
3187d9840e25STomoki Sekiyama
3188d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3189d9840e25STomoki Sekiyama  case "$vss_win32_sdk" in
3190d9840e25STomoki Sekiyama    "")   vss_win32_include="-I$source_path" ;;
3191d9840e25STomoki Sekiyama    *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3192d9840e25STomoki Sekiyama          # handle path with spaces. So we symlink the headers into ".sdk/vss".
3193d9840e25STomoki Sekiyama          vss_win32_include="-I$source_path/.sdk/vss"
3194d9840e25STomoki Sekiyama	  symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3195d9840e25STomoki Sekiyama	  ;;
3196d9840e25STomoki Sekiyama    *)    vss_win32_include="-I$vss_win32_sdk"
3197d9840e25STomoki Sekiyama  esac
3198d9840e25STomoki Sekiyama  cat > $TMPC << EOF
3199d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__
3200d9840e25STomoki Sekiyama#include <inc/win2003/vss.h>
3201d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; }
3202d9840e25STomoki SekiyamaEOF
3203d9840e25STomoki Sekiyama  if compile_prog "$vss_win32_include" "" ; then
3204d9840e25STomoki Sekiyama    guest_agent_with_vss="yes"
3205d9840e25STomoki Sekiyama    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3206d9840e25STomoki Sekiyama    libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3207d9840e25STomoki Sekiyama  else
3208d9840e25STomoki Sekiyama    if test "$vss_win32_sdk" != "" ; then
3209d9840e25STomoki Sekiyama      echo "ERROR: Please download and install Microsoft VSS SDK:"
3210d9840e25STomoki Sekiyama      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3211d9840e25STomoki Sekiyama      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3212d9840e25STomoki Sekiyama      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
3213d9840e25STomoki Sekiyama      echo "ERROR: The headers are extracted in the directory \`inc'."
3214d9840e25STomoki Sekiyama      feature_not_found "VSS support"
3215d9840e25STomoki Sekiyama    fi
3216d9840e25STomoki Sekiyama    guest_agent_with_vss="no"
3217d9840e25STomoki Sekiyama  fi
3218d9840e25STomoki Sekiyamafi
3219d9840e25STomoki Sekiyama
3220d9840e25STomoki Sekiyama##########################################
3221d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified)
3222d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent
3223d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the
3224d9840e25STomoki Sekiyama# pre-compiled .tlb file is included.
3225d9840e25STomoki Sekiyama
3226d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3227d9840e25STomoki Sekiyama  if test -z "$win_sdk"; then
3228d9840e25STomoki Sekiyama    programfiles="$PROGRAMFILES"
3229d9840e25STomoki Sekiyama    test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3230d9840e25STomoki Sekiyama    if test -n "$programfiles"; then
3231d9840e25STomoki Sekiyama      win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3232d9840e25STomoki Sekiyama    else
3233d9840e25STomoki Sekiyama      feature_not_found "Windows SDK"
3234d9840e25STomoki Sekiyama    fi
3235d9840e25STomoki Sekiyama  elif test "$win_sdk" = "no"; then
3236d9840e25STomoki Sekiyama    win_sdk=""
3237d9840e25STomoki Sekiyama  fi
3238d9840e25STomoki Sekiyamafi
3239d9840e25STomoki Sekiyama
3240d9840e25STomoki Sekiyama##########################################
3241cd4ec0b4SGerd Hoffmann
3242747bbdf7SBlue Swirl##########################################
32435f6b9e8fSBlue Swirl# check if we have fdatasync
32445f6b9e8fSBlue Swirl
32455f6b9e8fSBlue Swirlfdatasync=no
32465f6b9e8fSBlue Swirlcat > $TMPC << EOF
32475f6b9e8fSBlue Swirl#include <unistd.h>
3248d1722a27SAlexandre Raymondint main(void) {
3249d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3250d1722a27SAlexandre Raymondreturn fdatasync(0);
3251d1722a27SAlexandre Raymond#else
3252e172fe11SStefan Weil#error Not supported
3253d1722a27SAlexandre Raymond#endif
3254d1722a27SAlexandre Raymond}
32555f6b9e8fSBlue SwirlEOF
32565f6b9e8fSBlue Swirlif compile_prog "" "" ; then
32575f6b9e8fSBlue Swirl    fdatasync=yes
32585f6b9e8fSBlue Swirlfi
32595f6b9e8fSBlue Swirl
326094a420b1SStefan Hajnoczi##########################################
3261e78815a5SAndreas Färber# check if we have madvise
3262e78815a5SAndreas Färber
3263e78815a5SAndreas Färbermadvise=no
3264e78815a5SAndreas Färbercat > $TMPC << EOF
3265e78815a5SAndreas Färber#include <sys/types.h>
3266e78815a5SAndreas Färber#include <sys/mman.h>
3267832ce9c2SScott Wood#include <stddef.h>
3268e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3269e78815a5SAndreas FärberEOF
3270e78815a5SAndreas Färberif compile_prog "" "" ; then
3271e78815a5SAndreas Färber    madvise=yes
3272e78815a5SAndreas Färberfi
3273e78815a5SAndreas Färber
3274e78815a5SAndreas Färber##########################################
3275e78815a5SAndreas Färber# check if we have posix_madvise
3276e78815a5SAndreas Färber
3277e78815a5SAndreas Färberposix_madvise=no
3278e78815a5SAndreas Färbercat > $TMPC << EOF
3279e78815a5SAndreas Färber#include <sys/mman.h>
3280832ce9c2SScott Wood#include <stddef.h>
3281e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3282e78815a5SAndreas FärberEOF
3283e78815a5SAndreas Färberif compile_prog "" "" ; then
3284e78815a5SAndreas Färber    posix_madvise=yes
3285e78815a5SAndreas Färberfi
3286e78815a5SAndreas Färber
3287e78815a5SAndreas Färber##########################################
32881e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID
32891e9737daSRichard Henderson
32901e9737daSRichard Hendersonsigev_thread_id=no
32911e9737daSRichard Hendersoncat > $TMPC << EOF
32921e9737daSRichard Henderson#include <signal.h>
32931e9737daSRichard Hendersonint main(void) {
32941e9737daSRichard Henderson  struct sigevent ev;
32951e9737daSRichard Henderson  ev.sigev_notify = SIGEV_THREAD_ID;
32961e9737daSRichard Henderson  ev._sigev_un._tid = 0;
32971e9737daSRichard Henderson  asm volatile("" : : "g"(&ev));
32981e9737daSRichard Henderson  return 0;
32991e9737daSRichard Henderson}
33001e9737daSRichard HendersonEOF
33011e9737daSRichard Hendersonif compile_prog "" "" ; then
33021e9737daSRichard Henderson    sigev_thread_id=yes
33031e9737daSRichard Hendersonfi
33041e9737daSRichard Henderson
33051e9737daSRichard Henderson##########################################
330694a420b1SStefan Hajnoczi# check if trace backend exists
330794a420b1SStefan Hajnoczi
3308650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
330994a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
331076ad07a4SPeter Maydell  error_exit "invalid trace backend" \
331176ad07a4SPeter Maydell      "Please choose a supported trace backend."
331294a420b1SStefan Hajnoczifi
331394a420b1SStefan Hajnoczi
33147e24e92aSStefan Hajnoczi##########################################
33157e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
33167e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
33177e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
33187e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
33197e24e92aSStefan Hajnoczi#include <ust/marker.h>
33207e24e92aSStefan Hajnocziint main(void) { return 0; }
33217e24e92aSStefan HajnocziEOF
33227e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
332394b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
3324c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
33257e24e92aSStefan Hajnoczi  else
332676ad07a4SPeter Maydell    error_exit "Trace backend 'ust' missing libust header files"
33277e24e92aSStefan Hajnoczi  fi
33287e24e92aSStefan Hajnoczifi
3329b3d08c02SDaniel P. Berrange
3330b3d08c02SDaniel P. Berrange##########################################
3331b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
3332b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
3333b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
333476ad07a4SPeter Maydell    error_exit "dtrace command is not found in PATH $PATH"
3335b3d08c02SDaniel P. Berrange  fi
3336c276b17dSDaniel P. Berrange  trace_backend_stap="no"
3337c276b17dSDaniel P. Berrange  if has 'stap' ; then
3338c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
3339c276b17dSDaniel P. Berrange  fi
3340b3d08c02SDaniel P. Berrangefi
3341b3d08c02SDaniel P. Berrange
33427e24e92aSStefan Hajnoczi##########################################
3343519175a2SAlex Barcelo# check and set a backend for coroutine
3344d0e2fce5SAneesh Kumar K.V
33457c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback
33467c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because
33477c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally
33487c2acc70SPeter Maydell# useful for debugging purposes.)  On Windows the only valid backend
33497c2acc70SPeter Maydell# is the Windows-specific one.
33507c2acc70SPeter Maydell
33517c2acc70SPeter Maydellucontext_works=no
3352d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then
3353d0e2fce5SAneesh Kumar K.V  cat > $TMPC << EOF
3354d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
3355cdf84806SPeter Maydell#ifdef __stub_makecontext
3356cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
3357cdf84806SPeter Maydell#endif
335875cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
3359d0e2fce5SAneesh Kumar K.VEOF
3360d0e2fce5SAneesh Kumar K.V  if compile_prog "" "" ; then
33617c2acc70SPeter Maydell    ucontext_works=yes
3362d0e2fce5SAneesh Kumar K.V  fi
3363519175a2SAlex Barcelofi
33647c2acc70SPeter Maydell
33657c2acc70SPeter Maydellif test "$coroutine" = ""; then
33667c2acc70SPeter Maydell  if test "$mingw32" = "yes"; then
33677c2acc70SPeter Maydell    coroutine=win32
33687c2acc70SPeter Maydell  elif test "$ucontext_works" = "yes"; then
33697c2acc70SPeter Maydell    coroutine=ucontext
3370519175a2SAlex Barcelo  else
33717c2acc70SPeter Maydell    coroutine=sigaltstack
33727c2acc70SPeter Maydell  fi
33737c2acc70SPeter Maydellelse
33747c2acc70SPeter Maydell  case $coroutine in
33757c2acc70SPeter Maydell  windows)
33767c2acc70SPeter Maydell    if test "$mingw32" != "yes"; then
33777c2acc70SPeter Maydell      error_exit "'windows' coroutine backend only valid for Windows"
33787c2acc70SPeter Maydell    fi
33797c2acc70SPeter Maydell    # Unfortunately the user visible backend name doesn't match the
33807c2acc70SPeter Maydell    # coroutine-*.c filename for this case, so we have to adjust it here.
33817c2acc70SPeter Maydell    coroutine=win32
33827c2acc70SPeter Maydell    ;;
33837c2acc70SPeter Maydell  ucontext)
33847c2acc70SPeter Maydell    if test "$ucontext_works" != "yes"; then
33857c2acc70SPeter Maydell      feature_not_found "ucontext"
33867c2acc70SPeter Maydell    fi
33877c2acc70SPeter Maydell    ;;
33887c2acc70SPeter Maydell  gthread|sigaltstack)
33897c2acc70SPeter Maydell    if test "$mingw32" = "yes"; then
33907c2acc70SPeter Maydell      error_exit "only the 'windows' coroutine backend is valid for Windows"
33917c2acc70SPeter Maydell    fi
33927c2acc70SPeter Maydell    ;;
33937c2acc70SPeter Maydell  *)
339476ad07a4SPeter Maydell    error_exit "unknown coroutine backend $coroutine"
33957c2acc70SPeter Maydell    ;;
33967c2acc70SPeter Maydell  esac
3397d0e2fce5SAneesh Kumar K.Vfi
3398d0e2fce5SAneesh Kumar K.V
339970c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then
340070c60c08SStefan Hajnoczi  if test "$coroutine" = "gthread"; then
340170c60c08SStefan Hajnoczi    coroutine_pool=no
340270c60c08SStefan Hajnoczi  else
340370c60c08SStefan Hajnoczi    coroutine_pool=yes
340470c60c08SStefan Hajnoczi  fi
340570c60c08SStefan Hajnoczifi
340670c60c08SStefan Hajnocziif test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
340770c60c08SStefan Hajnoczi  error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
340870c60c08SStefan Hajnoczifi
340970c60c08SStefan Hajnoczi
3410d0e2fce5SAneesh Kumar K.V##########################################
3411d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
3412d2042378SAneesh Kumar K.V
34134e1797f9SStefan Weilopen_by_handle_at=no
3414d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
3415d2042378SAneesh Kumar K.V#include <fcntl.h>
3416acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
3417acc55ba8SStefan Weil# error missing definition
3418acc55ba8SStefan Weil#else
341975cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3420acc55ba8SStefan Weil#endif
3421d2042378SAneesh Kumar K.VEOF
3422d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
3423d2042378SAneesh Kumar K.V    open_by_handle_at=yes
3424d2042378SAneesh Kumar K.Vfi
3425d2042378SAneesh Kumar K.V
3426e06a765eSHarsh Prateek Bora########################################
3427e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
3428e06a765eSHarsh Prateek Bora
3429e06a765eSHarsh Prateek Boralinux_magic_h=no
3430e06a765eSHarsh Prateek Boracat > $TMPC << EOF
3431e06a765eSHarsh Prateek Bora#include <linux/magic.h>
3432e06a765eSHarsh Prateek Boraint main(void) {
343375cafad7SStefan Weil  return 0;
3434e06a765eSHarsh Prateek Bora}
3435e06a765eSHarsh Prateek BoraEOF
3436e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
3437e06a765eSHarsh Prateek Bora    linux_magic_h=yes
3438e06a765eSHarsh Prateek Borafi
3439e06a765eSHarsh Prateek Bora
34408ab1bf12SLuiz Capitulino########################################
3441c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed
3442c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries).
3443c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is
3444c95e3080SKevin Wolf# only a warning.
3445c95e3080SKevin Wolf#
3446c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that
3447c95e3080SKevin Wolf# the build doesn't fail anyway.
3448c95e3080SKevin Wolf
344906d71fa1SPeter Maydellpragma_disable_unused_but_set=no
345006d71fa1SPeter Maydellcat > $TMPC << EOF
3451e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push
345206d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3453c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes"
3454e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop
3455c95e3080SKevin Wolf
345606d71fa1SPeter Maydellint main(void) {
345706d71fa1SPeter Maydell    return 0;
345806d71fa1SPeter Maydell}
345906d71fa1SPeter MaydellEOF
346006d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then
3461cc6e3ca9SGerd Hoffmann    pragma_diagnostic_available=yes
3462c95e3080SKevin Wolfelse
3463c95e3080SKevin Wolf    werror=no
346406d71fa1SPeter Maydellfi
346506d71fa1SPeter Maydell
346606d71fa1SPeter Maydell########################################
346762fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h
34683f4349dcSKevin Wolf
34693f4349dcSKevin Wolfvalgrind_h=no
34703f4349dcSKevin Wolfcat > $TMPC << EOF
34713f4349dcSKevin Wolf#include <valgrind/valgrind.h>
347262fe8331SChristian Borntraeger#include <valgrind/memcheck.h>
34733f4349dcSKevin Wolfint main(void) {
34743f4349dcSKevin Wolf  return 0;
34753f4349dcSKevin Wolf}
34763f4349dcSKevin WolfEOF
34773f4349dcSKevin Wolfif compile_prog "" "" ; then
34783f4349dcSKevin Wolf    valgrind_h=yes
34793f4349dcSKevin Wolffi
34803f4349dcSKevin Wolf
34813f4349dcSKevin Wolf########################################
34828ab1bf12SLuiz Capitulino# check if environ is declared
34838ab1bf12SLuiz Capitulino
34848ab1bf12SLuiz Capitulinohas_environ=no
34858ab1bf12SLuiz Capitulinocat > $TMPC << EOF
34868ab1bf12SLuiz Capitulino#include <unistd.h>
34878ab1bf12SLuiz Capitulinoint main(void) {
3488c075a723SBlue Swirl    environ = 0;
34898ab1bf12SLuiz Capitulino    return 0;
34908ab1bf12SLuiz Capitulino}
34918ab1bf12SLuiz CapitulinoEOF
34928ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
34938ab1bf12SLuiz Capitulino    has_environ=yes
34948ab1bf12SLuiz Capitulinofi
34958ab1bf12SLuiz Capitulino
349676a347e1SRichard Henderson########################################
349776a347e1SRichard Henderson# check if cpuid.h is usable.
349876a347e1SRichard Henderson
349976a347e1SRichard Hendersoncpuid_h=no
350076a347e1SRichard Hendersoncat > $TMPC << EOF
350176a347e1SRichard Henderson#include <cpuid.h>
350276a347e1SRichard Hendersonint main(void) {
350376a347e1SRichard Henderson  return 0;
350476a347e1SRichard Henderson}
350576a347e1SRichard HendersonEOF
350676a347e1SRichard Hendersonif compile_prog "" "" ; then
350776a347e1SRichard Henderson    cpuid_h=yes
350876a347e1SRichard Hendersonfi
350976a347e1SRichard Henderson
3510f540166bSRichard Henderson########################################
3511f540166bSRichard Henderson# check if __[u]int128_t is usable.
3512f540166bSRichard Henderson
3513f540166bSRichard Hendersonint128=no
3514f540166bSRichard Hendersoncat > $TMPC << EOF
3515f540166bSRichard Henderson__int128_t a;
3516f540166bSRichard Henderson__uint128_t b;
3517f540166bSRichard Hendersonint main (void) {
3518f540166bSRichard Henderson  a = a + b;
3519f540166bSRichard Henderson  b = a * b;
3520464e3671SPeter Maydell  a = a * a;
3521f540166bSRichard Henderson  return 0;
3522f540166bSRichard Henderson}
3523f540166bSRichard HendersonEOF
3524f540166bSRichard Hendersonif compile_prog "" "" ; then
3525f540166bSRichard Henderson    int128=yes
3526f540166bSRichard Hendersonfi
352776a347e1SRichard Henderson
35281e6e9acaSRichard Henderson########################################
35291e6e9acaSRichard Henderson# check if getauxval is available.
35301e6e9acaSRichard Henderson
35311e6e9acaSRichard Hendersongetauxval=no
35321e6e9acaSRichard Hendersoncat > $TMPC << EOF
35331e6e9acaSRichard Henderson#include <sys/auxv.h>
35341e6e9acaSRichard Hendersonint main(void) {
35351e6e9acaSRichard Henderson  return getauxval(AT_HWCAP) == 0;
35361e6e9acaSRichard Henderson}
35371e6e9acaSRichard HendersonEOF
35381e6e9acaSRichard Hendersonif compile_prog "" "" ; then
35391e6e9acaSRichard Henderson    getauxval=yes
35401e6e9acaSRichard Hendersonfi
35411e6e9acaSRichard Henderson
3542d2042378SAneesh Kumar K.V##########################################
3543e86ecd4bSJuan Quintela# End of CC checks
3544e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
3545e86ecd4bSJuan Quintela
35461d728c39SBlue Swirlif test "$gcov" = "yes" ; then
35471d728c39SBlue Swirl  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
35481d728c39SBlue Swirl  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
35491d728c39SBlue Swirlelif test "$debug" = "no" ; then
3550e600cdf3SMichal Privoznik  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
3551e86ecd4bSJuan Quintelafi
3552a316e378SJuan Quintela
35531d728c39SBlue Swirl
355420ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
355520ff6c80SAnthony Liguori# enable/disable
355620ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
355720ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
355820ff6c80SAnthony Liguori	zero_malloc="no"
355920ff6c80SAnthony Liguori    else
356020ff6c80SAnthony Liguori	zero_malloc="yes"
356120ff6c80SAnthony Liguori    fi
356220ff6c80SAnthony Liguorifi
356320ff6c80SAnthony Liguori
35646ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags
35656ca026cbSPeter Maydellif test "$werror" = "yes"; then
35666ca026cbSPeter Maydell    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
35676ca026cbSPeter Maydellfi
35686ca026cbSPeter Maydell
3569e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
3570e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
35711156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
3572e86ecd4bSJuan Quintela    fi
3573e86ecd4bSJuan Quintelafi
3574e86ecd4bSJuan Quintela
357594dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
357694dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
357794dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
357894dd53c5SGerd Hoffmannelse
357994dd53c5SGerd Hoffmann    POD2MAN="pod2man"
358094dd53c5SGerd Hoffmannfi
358194dd53c5SGerd Hoffmann
3582952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
3583952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
3584952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
3585952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3586952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
3587952afb71SBlue Swirl        fi
3588952afb71SBlue Swirl    done
3589952afb71SBlue Swirlfi
3590952afb71SBlue Swirl
359110ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
3592528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
3593834574eaSAnthony Liguoriqemu_localedir="$datadir/locale"
35945a67135aSbellard
35954b1c11fdSDaniel P. Berrangetools=""
35964b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then
3597ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
35984b1c11fdSDaniel P. Berrange  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
35994b1c11fdSDaniel P. Berrange    tools="qemu-nbd\$(EXESUF) $tools"
36004b1c11fdSDaniel P. Berrange  fi
36014b1c11fdSDaniel P. Berrangefi
36024b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then
3603983eef5aSMeador Inge  if test "$virtfs" != no ; then
3604be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3605983eef5aSMeador Inge      virtfs=yes
360617bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3607983eef5aSMeador Inge    else
3608983eef5aSMeador Inge      if test "$virtfs" = yes; then
360976ad07a4SPeter Maydell        error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3610983eef5aSMeador Inge      fi
361117500370SAndreas Färber      virtfs=no
3612983eef5aSMeador Inge    fi
361317bff52bSM. Mohan Kumar  fi
3614d138cee9SMichael Rothfi
3615e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then
3616b39297aeSTomoki Sekiyama  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
3617e8ef31a3SMichael Tokarev      tools="qemu-ga\$(EXESUF) $tools"
3618b39297aeSTomoki Sekiyama      if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3619b39297aeSTomoki Sekiyama        tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3620b39297aeSTomoki Sekiyama      fi
3621e8ef31a3SMichael Tokarev      guest_agent=yes
3622e8ef31a3SMichael Tokarev  elif [ "$guest_agent" != yes ]; then
3623e8ef31a3SMichael Tokarev      guest_agent=no
3624e8ef31a3SMichael Tokarev  else
3625e8ef31a3SMichael Tokarev      error_exit "Guest agent is not supported on this platform"
3626ca35f780SPaolo Bonzini  fi
36274b1c11fdSDaniel P. Berrangefi
3628ca35f780SPaolo Bonzini
3629ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
3630ca35f780SPaolo Bonziniroms=
3631ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3632ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3633ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
3634ca35f780SPaolo Bonzini  roms="optionrom"
3635ca35f780SPaolo Bonzinifi
3636d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
363739ac8455SDavid Gibson  roms="$roms spapr-rtas"
363839ac8455SDavid Gibsonfi
3639ca35f780SPaolo Bonzini
36409933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then
36419933c305SChristian Borntraeger  roms="$roms s390-ccw"
36429933c305SChristian Borntraegerfi
36439933c305SChristian Borntraeger
3644964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary.
3645964c6fa1SRichard Hendersonif test "$pie" = "no" ; then
3646964c6fa1SRichard Henderson  textseg_addr=
3647964c6fa1SRichard Henderson  case "$cpu" in
3648c72b26ecSRichard Henderson    arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
3649964c6fa1SRichard Henderson      textseg_addr=0x60000000
3650964c6fa1SRichard Henderson      ;;
3651964c6fa1SRichard Henderson    mips)
3652964c6fa1SRichard Henderson      textseg_addr=0x400000
3653964c6fa1SRichard Henderson      ;;
3654964c6fa1SRichard Henderson  esac
3655964c6fa1SRichard Henderson  if [ -n "$textseg_addr" ]; then
3656964c6fa1SRichard Henderson    cat > $TMPC <<EOF
3657964c6fa1SRichard Henderson    int main(void) { return 0; }
3658964c6fa1SRichard HendersonEOF
3659964c6fa1SRichard Henderson    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3660964c6fa1SRichard Henderson    if ! compile_prog "" "$textseg_ldflags"; then
3661964c6fa1SRichard Henderson      # In case ld does not support -Ttext-segment, edit the default linker
3662964c6fa1SRichard Henderson      # script via sed to set the .text start addr.  This is needed on FreeBSD
3663964c6fa1SRichard Henderson      # at least.
3664964c6fa1SRichard Henderson      $ld --verbose | sed \
3665964c6fa1SRichard Henderson        -e '1,/==================================================/d' \
3666964c6fa1SRichard Henderson        -e '/==================================================/,$d' \
3667964c6fa1SRichard Henderson        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3668964c6fa1SRichard Henderson        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3669964c6fa1SRichard Henderson      textseg_ldflags="-Wl,-T../config-host.ld"
3670964c6fa1SRichard Henderson    fi
3671964c6fa1SRichard Henderson  fi
3672964c6fa1SRichard Hendersonfi
3673964c6fa1SRichard Henderson
36745ca9388aSGerd Hoffmann# add pixman flags after all config tests are done
3675a540f158SPeter CrosthwaiteQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
36765ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs"
36775ca9388aSGerd Hoffmann
36787d13299dSbellardecho "Install prefix    $prefix"
3679c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
3680f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
36813aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
36828bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`"
36830f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
36841c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
368511d9f695Sbellardif test "$mingw32" = "no" ; then
36865a699bbbSLaszlo Ersekecho "local state directory   `eval echo $local_statedir`"
3687f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
368843ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
36895a699bbbSLaszlo Ersekelse
36905a699bbbSLaszlo Ersekecho "local state directory   queried at runtime"
3691d9840e25STomoki Sekiyamaecho "Windows SDK       $win_sdk"
369211d9f695Sbellardfi
36935a67135aSbellardecho "Source path       $source_path"
36947d13299dSbellardecho "C compiler        $cc"
369583469015Sbellardecho "Host C compiler   $host_cc"
369683f73fceSTomoki Sekiyamaecho "C++ compiler      $cxx"
36973c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc"
36980c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
3699a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
37000c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
37017d13299dSbellardecho "make              $make"
37026a882643Spbrookecho "install           $install"
3703c886edfbSBlue Swirlecho "python            $python"
3704e2d8830eSBradif test "$slirp" = "yes" ; then
3705e2d8830eSBrad    echo "smbd              $smbd"
3706e2d8830eSBradfi
3707a98fd896Sbellardecho "host CPU          $cpu"
3708de83cd02Sbellardecho "host big endian   $bigendian"
370997a847bcSbellardecho "target list       $target_list"
3710ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
37117d13299dSbellardecho "gprof enabled     $gprof"
371203b4fe7dSaliguoriecho "sparse enabled    $sparse"
37131625af87Saliguoriecho "strip binaries    $strip_opt"
371405c2a3e7Sbellardecho "profiler          $profiler"
371543ce4dfeSbellardecho "static build      $static"
371685aa5189Sbellardecho "-Werror enabled   $werror"
37175b0753e0Sbellardif test "$darwin" = "yes" ; then
37185b0753e0Sbellard    echo "Cocoa support     $cocoa"
37195b0753e0Sbellardfi
3720e2134eb9SGerd Hoffmannecho "pixman            $pixman"
372197a847bcSbellardecho "SDL support       $sdl"
3722a4ccabcfSAnthony Liguoriecho "GTK support       $gtk"
37234d3b6f6eSbalrogecho "curses support    $curses"
3724769ce76dSAlexander Grafecho "curl support      $curl"
372567b915a5Sbellardecho "mingw32 support   $mingw32"
37260c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
3727b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist"
3728b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist"
3729983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3730821601eaSJes Sorensenecho "VNC support       $vnc"
3731821601eaSJes Sorensenif test "$vnc" = "yes" ; then
37328d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
37332f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
37342f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3735efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
37367536ee4bSTim Hardeck    echo "VNC WS support    $vnc_ws"
3737821601eaSJes Sorensenfi
37383142255cSblueswir1if test -n "$sparc_cpu"; then
37393142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
37403142255cSblueswir1fi
3741e37630caSaliguoriecho "xen support       $xen"
37422e4d9fb1Saurel32echo "brlapi support    $brlapi"
3743a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3744a25dba17SJuan Quintelaecho "Documentation     $docs"
3745c5937220Spbrook[ ! -z "$uname_release" ] && \
3746c5937220Spbrookecho "uname -r          $uname_release"
3747379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
374840d6444eSAvi Kivityecho "PIE               $pie"
37498a16d273Sthsecho "vde support       $vde"
37505c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3751758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
375277755340Sthsecho "Install blobs     $blobs"
3753b31a0277SJuan Quintelaecho "KVM support       $kvm"
37542da776dbSMichael R. Hinesecho "RDMA support      $rdma"
37559195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3756f652e6afSaurel32echo "fdt support       $fdt"
3757ceb42de8Saliguoriecho "preadv support    $preadv"
37585f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3759e78815a5SAndreas Färberecho "madvise           $madvise"
3760e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
37611e9737daSRichard Hendersonecho "sigev_thread_id   $sigev_thread_id"
3762ee682d27SStefan Weilecho "uuid support      $uuid"
376347e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3764d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
37655e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi"
376694a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
37679410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
37682e0e3c39SAlon Levyecho "spice support     $spice ($spice_protocol_version/$spice_server_version)"
3769f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3770dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3771111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
37722b2325ffSGerd Hoffmannecho "libusb            $libusb"
377369354a83SHans de Goedeecho "usb net redir     $usb_redir"
3774b1e5fff4SMichael Walleecho "GLX support       $glx"
3775c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3776d138cee9SMichael Rothecho "build guest agent $guest_agent"
3777d9840e25STomoki Sekiyamaecho "QGA VSS support   $guest_agent_with_vss"
3778f794573eSEduardo Otuboecho "seccomp support   $seccomp"
37797c2acc70SPeter Maydellecho "coroutine backend $coroutine"
378070c60c08SStefan Hajnocziecho "coroutine pool    $coroutine_pool"
3781eb100396SBharata B Raoecho "GlusterFS support $glusterfs"
3782583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane"
37831d728c39SBlue Swirlecho "gcov              $gcov_tool"
37841d728c39SBlue Swirlecho "gcov enabled      $gcov"
3785ab214c29SStefan Bergerecho "TPM support       $tpm"
37860a12ec87SRichard W.M. Jonesecho "libssh2 support   $libssh2"
37873b8acc11SPaolo Bonziniecho "TPM passthrough   $tpm_passthrough"
37883556c233SPaolo Bonziniecho "QOM debugging     $qom_cast_debug"
37894f18b782SJeff Codyecho "vhdx              $vhdx"
379067b915a5Sbellard
37911ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
379224b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3793e8cd23deSbellardfi
379497a847bcSbellard
379598ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
379697a847bcSbellard
3797dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak
3798dbd99ae3SStefan Weil
379998ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
380098ec69acSJuan Quintelaecho >> $config_host_mak
380198ec69acSJuan Quintela
3802e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
380399d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
380499d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
38053aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
38068bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak
38070f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
380899d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
380999d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
381022d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
38119afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
38129afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
38135a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then
3814785c23aeSLuiz Capitulino  echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
38155a699bbbSLaszlo Ersekfi
3816f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak
3817f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
3818f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
3819834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak
3820f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak
3821804edf29SJuan Quintela
382298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3823727e5283SPaolo Bonzini
3824f8393946Saurel32if test "$debug_tcg" = "yes" ; then
38252358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3826f8393946Saurel32fi
38271625af87Saliguoriif test "$strip_opt" = "yes" ; then
382852ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
38291625af87Saliguorifi
38307d13299dSbellardif test "$bigendian" = "yes" ; then
3831e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
383297a847bcSbellardfi
383367b915a5Sbellardif test "$mingw32" = "yes" ; then
383498ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
38359fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
38369fe6de94SBlue Swirl  version_major=${rc_version%%.*}
38379fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38389fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
38399fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38409fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
38419fe6de94SBlue Swirl  version_micro=0
38429fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
38439fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3844d9840e25STomoki Sekiyama  if test "$guest_agent_with_vss" = "yes" ; then
3845d9840e25STomoki Sekiyama    echo "CONFIG_QGA_VSS=y" >> $config_host_mak
3846d9840e25STomoki Sekiyama    echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
3847d9840e25STomoki Sekiyama  fi
3848210fa556Spbrookelse
384935f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3850210fa556Spbrookfi
3851128ab2ffSblueswir1
3852dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3853dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3854dffcb71cSMark McLoughlinfi
3855dffcb71cSMark McLoughlin
385683fb7adfSbellardif test "$darwin" = "yes" ; then
385798ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
385883fb7adfSbellardfi
3859b29fe3edSmalc
3860b29fe3edSmalcif test "$aix" = "yes" ; then
386198ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3862b29fe3edSmalcfi
3863b29fe3edSmalc
3864ec530c81Sbellardif test "$solaris" = "yes" ; then
386598ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
38662358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
38670475a5caSths  if test "$needs_libsunmath" = "yes" ; then
386875b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
38690475a5caSths  fi
3870ec530c81Sbellardfi
3871179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3872179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3873179cf400SAndreas Färberfi
387497a847bcSbellardif test "$static" = "yes" ; then
387598ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
387697a847bcSbellardfi
38771ba16968SStefan Weilif test "$profiler" = "yes" ; then
38782358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
387905c2a3e7Sbellardfi
3880c20709aaSbellardif test "$slirp" = "yes" ; then
388198ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3882e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3883c20709aaSbellardfi
38848a16d273Sthsif test "$vde" = "yes" ; then
388598ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
38868a16d273Sthsfi
388747e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
388847e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
388947e98658SCorey Bryantfi
38902358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
38910c58ac1cSmalcfor drv in $audio_drv_list; do
3892bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
389398ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3894923e4521Smalc    if test "$drv" = "fmod"; then
38957aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3896fb065187Sbellard    fi
38970c58ac1cSmalcdone
389867f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
389967f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
390067f86e8eSJuan Quintelafi
3901d5631638Smalcif test "$audio_win_int" = "yes" ; then
3902d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3903d5631638Smalcfi
3904b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
3905b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
3906821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3907821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3908821601eaSJes Sorensenfi
39098d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
391098ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
39118d5d2d4cSthsfi
39122f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
391398ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
39142f9606b3Saliguorifi
3915821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
39162f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
39172f6f5c7aSCorentin Charyfi
3918821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3919efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3920efe556adSCorentin Charyfi
39217536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then
39227536ee4bSTim Hardeck  echo "CONFIG_VNC_WS=y" >> $config_host_mak
39237536ee4bSTim Hardeck  echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
39247536ee4bSTim Hardeckfi
392576655d6dSaliguoriif test "$fnmatch" = "yes" ; then
39262358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
392776655d6dSaliguorifi
3928ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3929ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3930ee682d27SStefan Weilfi
3931dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3932dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3933dce512deSChristoph Hellwigfi
3934b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
393598ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
39362358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
393798ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
393898ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3939a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
394098ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3941cc8ae6deSpbrookfi
39421ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
394398ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
39448ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
394549ecc3faSbellardfi
394649ecc3faSbellardif test "$cocoa" = "yes" ; then
394798ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
394849ecc3faSbellardfi
39494d3b6f6eSbalrogif test "$curses" = "yes" ; then
395098ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3951ab4e5602SJan Kiszkafi
3952ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
39532358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3954ebc996f3SRiku Voipiofi
3955099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
39562358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3957099d6b0fSRiku Voipiofi
395840ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
395940ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
396040ff6d7eSKevin Wolffi
39613ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
39622358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
39633ce34dfbSvibisreenivasanfi
3964c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3965c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3966c2882b96SRiku Voipiofi
3967d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3968d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3969d0927938SUlrich Hechtfi
39703d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then
39713d4fa43eSKusanagi Kouichi  echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
39723d4fa43eSKusanagi Kouichifi
3973c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3974c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3975c727f47dSPeter Maydellfi
3976dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3977dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3978dace20dcSPeter Maydellfi
3979d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3980d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3981d0927938SUlrich Hechtfi
39824e0c6529SAlex Blighif test "$ppoll" = "yes" ; then
39834e0c6529SAlex Bligh  echo "CONFIG_PPOLL=y" >> $config_host_mak
39844e0c6529SAlex Blighfi
3985cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then
3986cd758dd0SAlex Bligh  echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
3987cd758dd0SAlex Blighfi
39883b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
39893b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
39903b6edd16SPeter Maydellfi
39913b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
39923b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
39933b6edd16SPeter Maydellfi
39943b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
39953b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
39963b6edd16SPeter Maydellfi
3997a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then
3998a8fd1abaSPeter Maydell  echo "CONFIG_SENDFILE=y" >> $config_host_mak
3999a8fd1abaSPeter Maydellfi
40003b3f24adSaurel32if test "$inotify" = "yes" ; then
40012358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
40023b3f24adSaurel32fi
4003c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
4004c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4005c05c7a73SRiku Voipiofi
40066ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
40076ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
40086ae9a1f4SJuan Quintelafi
40096ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
40106ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
40116ae9a1f4SJuan Quintelafi
4012769ce76dSAlexander Grafif test "$curl" = "yes" ; then
401398ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
4014b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
4015769ce76dSAlexander Graffi
40162e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
401798ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
40182e4d9fb1Saurel32fi
4019fb599c9aSbalrogif test "$bluez" = "yes" ; then
402098ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
4021ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
4022fb599c9aSbalrogfi
4023e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
4024a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then
4025a4ccabcfSAnthony Liguori  echo "CONFIG_GTK=y" >> $config_host_mak
4026a4ccabcfSAnthony Liguori  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4027a4ccabcfSAnthony Liguori  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4028a4ccabcfSAnthony Liguorifi
4029e37630caSaliguoriif test "$xen" = "yes" ; then
40306dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4031d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4032e37630caSaliguorifi
40335c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
40345c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
40355c6c3a6cSChristoph Hellwigfi
4036758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
4037758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
4038758e8e38SVenkateswararao Jujjuri (JV)fi
40394f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
40404f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
40414f26f2b6SAvi Kivityfi
4042983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
4043758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
4044758e8e38SVenkateswararao Jujjuri (JV)fi
40455e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then
40465e9be92dSNicholas Bellinger  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
40475e9be92dSNicholas Bellingerfi
404877755340Sthsif test "$blobs" = "yes" ; then
404998ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
405077755340Sthsfi
4051bf9298b9Saliguoriif test "$iovec" = "yes" ; then
40522358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
4053bf9298b9Saliguorifi
4054ceb42de8Saliguoriif test "$preadv" = "yes" ; then
40552358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
4056ceb42de8Saliguorifi
4057f652e6afSaurel32if test "$fdt" = "yes" ; then
40583f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
4059f652e6afSaurel32fi
4060dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
4061dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4062dcc38d1cSMarcelo Tosattifi
40639195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
40649195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
40659195b2c2SStefan Weilfi
40665f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
40675f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
40685f6b9e8fSBlue Swirlfi
4069e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
4070e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
4071e78815a5SAndreas Färberfi
4072e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
4073e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4074e78815a5SAndreas Färberfi
40751e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then
40761e9737daSRichard Henderson  echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
40771e9737daSRichard Hendersonfi
407897a847bcSbellard
4079cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
4080cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
4081cd4ec0b4SGerd Hoffmannfi
4082cd4ec0b4SGerd Hoffmann
4083111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
4084111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
4085ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4086ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
4087111a38b0SRobert Relyeafi
4088111a38b0SRobert Relyea
40892b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then
40902b2325ffSGerd Hoffmann  echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
40912b2325ffSGerd Hoffmannfi
40922b2325ffSGerd Hoffmann
409369354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
409469354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
409569354a83SHans de Goedefi
409669354a83SHans de Goede
4097b1e5fff4SMichael Walleif test "$glx" = "yes" ; then
4098b1e5fff4SMichael Walle  echo "CONFIG_GLX=y" >> $config_host_mak
40992b6b7099SPaolo Bonzini  echo "GLX_LIBS=$glx_libs" >> $config_host_mak
410020ff075bSMichael Wallefi
410120ff075bSMichael Walle
4102c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
4103c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
4104c589b249SRonnie Sahlbergfi
4105c589b249SRonnie Sahlberg
4106f794573eSEduardo Otuboif test "$seccomp" = "yes"; then
4107f794573eSEduardo Otubo  echo "CONFIG_SECCOMP=y" >> $config_host_mak
4108f794573eSEduardo Otubofi
4109f794573eSEduardo Otubo
411083fb7adfSbellard# XXX: suppress that
41117d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
41122358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
41137d3505c5Sbellardfi
41147d3505c5Sbellard
41152358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
4116c5937220Spbrook
411720ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
411820ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
411920ff6c80SAnthony Liguorifi
41203556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then
41213556c233SPaolo Bonzini  echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
41223556c233SPaolo Bonzinifi
4123f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
4124f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
4125f27aaf4bSChristian Brunnerfi
412620ff6c80SAnthony Liguori
41277c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
412870c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then
412970c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
413070c60c08SStefan Hajnoczielse
413170c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
413270c60c08SStefan Hajnoczifi
4133d0e2fce5SAneesh Kumar K.V
4134d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
4135d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4136d2042378SAneesh Kumar K.Vfi
4137d2042378SAneesh Kumar K.V
4138e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
4139e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4140e06a765eSHarsh Prateek Borafi
4141e06a765eSHarsh Prateek Bora
4142cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then
4143cc6e3ca9SGerd Hoffmann  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
414406d71fa1SPeter Maydellfi
414506d71fa1SPeter Maydell
41463f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then
41473f4349dcSKevin Wolf  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
41483f4349dcSKevin Wolffi
41493f4349dcSKevin Wolf
41508ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
41518ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
41528ab1bf12SLuiz Capitulinofi
41538ab1bf12SLuiz Capitulino
415476a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then
415576a347e1SRichard Henderson  echo "CONFIG_CPUID_H=y" >> $config_host_mak
415676a347e1SRichard Hendersonfi
415776a347e1SRichard Henderson
4158f540166bSRichard Hendersonif test "$int128" = "yes" ; then
4159f540166bSRichard Henderson  echo "CONFIG_INT128=y" >> $config_host_mak
4160f540166bSRichard Hendersonfi
4161f540166bSRichard Henderson
41621e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then
41631e6e9acaSRichard Henderson  echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
41641e6e9acaSRichard Hendersonfi
41651e6e9acaSRichard Henderson
4166eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then
4167eb100396SBharata B Rao  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
4168eb100396SBharata B Raofi
4169eb100396SBharata B Rao
41700c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then
41710c14fb47SBharata B Rao  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
41720c14fb47SBharata B Raofi
41730c14fb47SBharata B Rao
41740a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then
41750a12ec87SRichard W.M. Jones  echo "CONFIG_LIBSSH2=y" >> $config_host_mak
41760a12ec87SRichard W.M. Jonesfi
41770a12ec87SRichard W.M. Jones
4178583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then
41796e790746SPaolo Bonzini  echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
4180583f6e7bSStefan Hajnoczifi
4181583f6e7bSStefan Hajnoczi
41824f18b782SJeff Codyif test "$vhdx" = "yes" ; then
41834f18b782SJeff Cody  echo "CONFIG_VHDX=y" >> $config_host_mak
41844f18b782SJeff Codyfi
41854f18b782SJeff Cody
418668063649Sblueswir1# USB host support
4187b5613fdcSGerd Hoffmannif test "$libusb" = "yes"; then
41882b2325ffSGerd Hoffmann  echo "HOST_USB=libusb legacy" >> $config_host_mak
4189b5613fdcSGerd Hoffmannelse
419098ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
4191b5613fdcSGerd Hoffmannfi
419268063649Sblueswir1
41933b8acc11SPaolo Bonzini# TPM passthrough support?
41943b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then
41953b8acc11SPaolo Bonzini  echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
41963b8acc11SPaolo Bonzini  if test "$tpm_passthrough" = "yes"; then
41973b8acc11SPaolo Bonzini    echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
41983b8acc11SPaolo Bonzini  fi
41993b8acc11SPaolo Bonzinifi
42003b8acc11SPaolo Bonzini
4201e4858974SLluís# use default implementation for tracing backend-specific routines
4202e4858974SLluístrace_default=yes
420394a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
42046d8a764eSLluísif test "$trace_backend" = "nop"; then
42056d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
420622890ab5SPrerna Saxenafi
42079410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
42086d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
4209e4858974SLluís  trace_default=no
42106d8a764eSLluís  # Set the appropriate trace file.
4211953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
42129410b56cSPrerna Saxenafi
42136d8a764eSLluísif test "$trace_backend" = "stderr"; then
42146d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
42159a82b6a5SLluís  trace_default=no
42166d8a764eSLluísfi
42176d8a764eSLluísif test "$trace_backend" = "ust"; then
42186d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
42196d8a764eSLluísfi
42206d8a764eSLluísif test "$trace_backend" = "dtrace"; then
42216d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
42226d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
42236d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
42246d8a764eSLluís  fi
4225c276b17dSDaniel P. Berrangefi
4226781e9545SEiichi Tsukataif test "$trace_backend" = "ftrace"; then
4227781e9545SEiichi Tsukata  if test "$linux" = "yes" ; then
4228781e9545SEiichi Tsukata    echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4229781e9545SEiichi Tsukata    trace_default=no
4230781e9545SEiichi Tsukata  else
4231781e9545SEiichi Tsukata    feature_not_found "ftrace(trace backend)"
4232781e9545SEiichi Tsukata  fi
4233781e9545SEiichi Tsukatafi
42349410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
4235e4858974SLluísif test "$trace_default" = "yes"; then
4236e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4237e4858974SLluísfi
42389410b56cSPrerna Saxena
42392da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
42402da776dbSMichael R. Hines  echo "CONFIG_RDMA=y" >> $config_host_mak
42412da776dbSMichael R. Hinesfi
42422da776dbSMichael R. Hines
42435b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then
42445b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
42455b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then
42465b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
42475b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then
42485b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
4249c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
42505b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
42515b5e3037SPaolo Bonzinielse
42525b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
42535b5e3037SPaolo Bonzinifi
42545b5e3037SPaolo BonziniQEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
42555b5e3037SPaolo Bonzini
425698ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
425798ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
4258804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
4259804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
42601901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
42611901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
426221655882SPaolo Bonziniif test -n "$libtool"; then
426321655882SPaolo Bonzini  echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
426421655882SPaolo Bonzini  echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
426521655882SPaolo Bonzinielse
42661901cb14SBrad  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
426721655882SPaolo Bonzini  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
426821655882SPaolo Bonzinifi
4269c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
4270804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
4271a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then
4272a31a8642SMichael S. Tsirkin  echo "IASL=$iasl" >> $config_host_mak
4273a31a8642SMichael S. Tsirkinfi
42742b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
4275804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
427683f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak
42773c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak
4278804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
42793dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak
42803dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak
4281804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
4282804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
42839fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
428444dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
4285e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
4286a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
4287f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
4288e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
4289e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
4290e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
4291e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4292e39f0062SPaolo Bonzinifi
429342da6041SGerd Hoffmannif test "$cross_prefix" != ""; then
429442da6041SGerd Hoffmann  echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
429542da6041SGerd Hoffmannelse
429642da6041SGerd Hoffmann  echo "AUTOCONF_HOST := "                             >> $config_host_mak
429742da6041SGerd Hoffmannfi
4298e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
429937746c5eSMarc-André Lureauecho "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
430073da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
43013e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
4302804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
4303957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
430494dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
4305cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
43061d728c39SBlue Swirlif test "$gcov" = "yes" ; then
43071d728c39SBlue Swirl  echo "CONFIG_GCOV=y" >> $config_host_mak
43081d728c39SBlue Swirl  echo "GCOV=$gcov_tool" >> $config_host_mak
43091d728c39SBlue Swirlfi
4310804edf29SJuan Quintela
43116efd7517SPeter Maydell# use included Linux headers
43126efd7517SPeter Maydellif test "$linux" = "yes" ; then
4313a307beb6SAndreas Färber  mkdir -p linux-headers
43146efd7517SPeter Maydell  case "$cpu" in
4315c72b26ecSRichard Henderson  i386|x86_64|x32)
431608312a63SPeter Maydell    linux_arch=x86
43176efd7517SPeter Maydell    ;;
43186efd7517SPeter Maydell  ppcemb|ppc|ppc64)
431908312a63SPeter Maydell    linux_arch=powerpc
43206efd7517SPeter Maydell    ;;
43216efd7517SPeter Maydell  s390x)
432208312a63SPeter Maydell    linux_arch=s390
432308312a63SPeter Maydell    ;;
43241f080313SClaudio Fontana  aarch64)
43251f080313SClaudio Fontana    linux_arch=arm64
43261f080313SClaudio Fontana    ;;
432708312a63SPeter Maydell  *)
432808312a63SPeter Maydell    # For most CPUs the kernel architecture name and QEMU CPU name match.
432908312a63SPeter Maydell    linux_arch="$cpu"
43306efd7517SPeter Maydell    ;;
43316efd7517SPeter Maydell  esac
433208312a63SPeter Maydell    # For non-KVM architectures we will not have asm headers
433308312a63SPeter Maydell    if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
433408312a63SPeter Maydell      symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
433508312a63SPeter Maydell    fi
43366efd7517SPeter Maydellfi
43376efd7517SPeter Maydell
433897a847bcSbellardfor target in $target_list; do
433997a847bcSbellardtarget_dir="$target"
434025be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
4341c1799a84SPaolo Bonzinitarget_name=`echo $target | cut -d '-' -f 1`
434297a847bcSbellardtarget_bigendian="no"
43431f3d3c8fSJuan Quintela
4344c1799a84SPaolo Bonzinicase "$target_name" in
4345d15a9c23SAnthony Green  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
4346ea2d6a39SJuan Quintela  target_bigendian=yes
4347ea2d6a39SJuan Quintela  ;;
4348ea2d6a39SJuan Quintelaesac
434997a847bcSbellardtarget_softmmu="no"
4350997344f3Sbellardtarget_user_only="no"
4351831b7825Sthstarget_linux_user="no"
435284778508Sblueswir1target_bsd_user="no"
43539e407a85Spbrookcase "$target" in
4354c1799a84SPaolo Bonzini  ${target_name}-softmmu)
43559e407a85Spbrook    target_softmmu="yes"
43569e407a85Spbrook    ;;
4357c1799a84SPaolo Bonzini  ${target_name}-linux-user)
43589c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
435976ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a Linux host"
43609c7a4202SBlue Swirl    fi
43619e407a85Spbrook    target_user_only="yes"
43629e407a85Spbrook    target_linux_user="yes"
43639e407a85Spbrook    ;;
4364c1799a84SPaolo Bonzini  ${target_name}-bsd-user)
43659cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
436676ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a BSD host"
43679c7a4202SBlue Swirl    fi
436884778508Sblueswir1    target_user_only="yes"
436984778508Sblueswir1    target_bsd_user="yes"
437084778508Sblueswir1    ;;
43719e407a85Spbrook  *)
437276ad07a4SPeter Maydell    error_exit "Target '$target' not recognised"
43739e407a85Spbrook    exit 1
43749e407a85Spbrook    ;;
43759e407a85Spbrookesac
4376831b7825Sths
437797a847bcSbellardmkdir -p $target_dir
437825be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
437997a847bcSbellard
4380e5fe0c52Spbrookbflt="no"
4381c1799a84SPaolo Bonziniinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
438256aebc89Spbrookgdb_xml_files=""
43837ba1e619Saliguori
4384c1799a84SPaolo BonziniTARGET_ARCH="$target_name"
43856acff7daSJuan QuintelaTARGET_BASE_ARCH=""
4386e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
4387e73aae67SJuan Quintela
4388c1799a84SPaolo Bonzinicase "$target_name" in
43892408a527Saurel32  i386)
43902408a527Saurel32  ;;
43912408a527Saurel32  x86_64)
43926acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
43932408a527Saurel32  ;;
43942408a527Saurel32  alpha)
43952408a527Saurel32  ;;
43962408a527Saurel32  arm|armeb)
4397b498c8a0SJuan Quintela    TARGET_ARCH=arm
4398e5fe0c52Spbrook    bflt="yes"
439956aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
44002408a527Saurel32  ;;
44016a49fa95SAlexander Graf  aarch64)
44026a49fa95SAlexander Graf    TARGET_BASE_ARCH=arm
44036a49fa95SAlexander Graf    bflt="yes"
44046a49fa95SAlexander Graf    gdb_xml_files="aarch64-core.xml"
44056a49fa95SAlexander Graf  ;;
44062408a527Saurel32  cris)
44072408a527Saurel32  ;;
4408613a22c9SMichael Walle  lm32)
4409613a22c9SMichael Walle  ;;
44102408a527Saurel32  m68k)
44110938cda5Saurel32    bflt="yes"
441256aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
44132408a527Saurel32  ;;
4414877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
4415877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
441672b675caSEdgar E. Iglesias    bflt="yes"
441772b675caSEdgar E. Iglesias  ;;
44182408a527Saurel32  mips|mipsel)
4419b498c8a0SJuan Quintela    TARGET_ARCH=mips
442025be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
44212408a527Saurel32  ;;
44222408a527Saurel32  mipsn32|mipsn32el)
4423597e2cecSRichard Henderson    TARGET_ARCH=mips64
44246acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
442525be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4426597e2cecSRichard Henderson    echo "TARGET_ABI32=y" >> $config_target_mak
44272408a527Saurel32  ;;
44282408a527Saurel32  mips64|mips64el)
4429b498c8a0SJuan Quintela    TARGET_ARCH=mips64
44306acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
443125be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
44322408a527Saurel32  ;;
4433d15a9c23SAnthony Green  moxie)
4434d15a9c23SAnthony Green  ;;
4435e67db06eSJia Liu  or32)
4436e67db06eSJia Liu    TARGET_ARCH=openrisc
4437e67db06eSJia Liu    TARGET_BASE_ARCH=openrisc
4438e67db06eSJia Liu  ;;
44392408a527Saurel32  ppc)
4440c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44412408a527Saurel32  ;;
44422408a527Saurel32  ppcemb)
44436acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4444e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4445c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44462408a527Saurel32  ;;
44472408a527Saurel32  ppc64)
44486acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4449e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4450c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44512408a527Saurel32  ;;
44522408a527Saurel32  ppc64abi32)
4453b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
44546acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4455e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
445625be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
4457c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44582408a527Saurel32  ;;
44592408a527Saurel32  sh4|sh4eb)
4460b498c8a0SJuan Quintela    TARGET_ARCH=sh4
44614dbed897Spbrook    bflt="yes"
44622408a527Saurel32  ;;
44632408a527Saurel32  sparc)
44642408a527Saurel32  ;;
44652408a527Saurel32  sparc64)
44666acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
44672408a527Saurel32  ;;
44682408a527Saurel32  sparc32plus)
4469b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
44706acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4471e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
447225be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
44732408a527Saurel32  ;;
447424e804ecSAlexander Graf  s390x)
447524e804ecSAlexander Graf  ;;
4476d2fbca94SGuan Xuetao  unicore32)
4477d2fbca94SGuan Xuetao  ;;
4478cfa550c6SMax Filippov  xtensa|xtensaeb)
4479cfa550c6SMax Filippov    TARGET_ARCH=xtensa
4480cfa550c6SMax Filippov  ;;
44812408a527Saurel32  *)
448276ad07a4SPeter Maydell    error_exit "Unsupported target CPU"
44832408a527Saurel32  ;;
44842408a527Saurel32esac
44855e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
44865e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
44875e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
44885e8861a0SPaolo Bonzinifi
44895e8861a0SPaolo Bonzini
44905e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
44915e8861a0SPaolo Bonzini
449299afc91dSDaniel P. Berrangeupper() {
449399afc91dSDaniel P. Berrange    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
449499afc91dSDaniel P. Berrange}
449599afc91dSDaniel P. Berrange
449699afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`"
449725be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
4498c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak
449925be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4500e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
4501e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
4502e6e91b9cSJuan Quintelafi
450325be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
4504c1799a84SPaolo Bonzinicase "$target_name" in
45051b0c87fcSJuan Quintela  i386|x86_64)
45061b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
450725be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
4508eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
4509eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4510eb6fda0fSAnthony PERARD      fi
4511432d268cSJun Nakajima    fi
451259d21e53SAlexander Graf    ;;
451359d21e53SAlexander Graf  *)
45141b0c87fcSJuan Quintelaesac
4515c1799a84SPaolo Bonzinicase "$target_name" in
451668b05c42SPeter Maydell  arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4517c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
4518c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4519c1799a84SPaolo Bonzini      \( "$target_name" = "$cpu" -o \
4520c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4521c1799a84SPaolo Bonzini      \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4522c1799a84SPaolo Bonzini      \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4523c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4524c1799a84SPaolo Bonzini      \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
4525c1799a84SPaolo Bonzini      \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
452625be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
45271ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
4528d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4529d5970055SMichael S. Tsirkin      fi
4530c59249f9SJuan Quintela    fi
4531c59249f9SJuan Quintelaesac
4532de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
453325be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
453497a847bcSbellardfi
453597a847bcSbellardif test "$target_softmmu" = "yes" ; then
453625be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4537de83cd02Sbellardfi
4538997344f3Sbellardif test "$target_user_only" = "yes" ; then
453925be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4540a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4541997344f3Sbellardfi
4542831b7825Sthsif test "$target_linux_user" = "yes" ; then
454325be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4544831b7825Sthsfi
454556aebc89Spbrooklist=""
454656aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
454756aebc89Spbrook  for x in $gdb_xml_files; do
454856aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
454956aebc89Spbrook  done
455025be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
45513d0f1517SJuan Quintelafi
4552de83cd02Sbellard
4553e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
455425be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4555e5fe0c52Spbrookfi
4556379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
455725be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4558379f6698SPaul Brookfi
455984778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
456025be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
456184778508Sblueswir1fi
45625b0753e0Sbellard
45634afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
4564fa282484SJuan Quintela
45654afddb55SJuan Quintelacflags=""
4566fa282484SJuan Quintelaldflags=""
45679b8e111fSJuan Quintela
456864656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
456964656024SJuan Quintela  case "$i" in
457064656024SJuan Quintela  alpha)
457125be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
457276cad711SPaolo Bonzini    echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
457364656024SJuan Quintela  ;;
457464656024SJuan Quintela  arm)
457525be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
457676cad711SPaolo Bonzini    echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
457764656024SJuan Quintela  ;;
457864656024SJuan Quintela  cris)
457925be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
458076cad711SPaolo Bonzini    echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
458164656024SJuan Quintela  ;;
458264656024SJuan Quintela  hppa)
458325be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
458476cad711SPaolo Bonzini    echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
458564656024SJuan Quintela  ;;
4586c72b26ecSRichard Henderson  i386|x86_64|x32)
458725be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
458876cad711SPaolo Bonzini    echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
458964656024SJuan Quintela  ;;
4590903ec55cSAurelien Jarno  ia64*)
4591903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
459276cad711SPaolo Bonzini    echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4593903ec55cSAurelien Jarno  ;;
459479368f49SMichael Walle  lm32)
459579368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
459676cad711SPaolo Bonzini    echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
459779368f49SMichael Walle  ;;
459864656024SJuan Quintela  m68k)
459925be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
460076cad711SPaolo Bonzini    echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
460164656024SJuan Quintela  ;;
4602877fdc12SEdgar E. Iglesias  microblaze*)
460325be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
460476cad711SPaolo Bonzini    echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
460564656024SJuan Quintela  ;;
460664656024SJuan Quintela  mips*)
460725be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
460876cad711SPaolo Bonzini    echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
460964656024SJuan Quintela  ;;
4610d15a9c23SAnthony Green  moxie*)
4611d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> $config_target_mak
4612d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> config-all-disas.mak
4613d15a9c23SAnthony Green  ;;
4614e67db06eSJia Liu  or32)
4615e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
461676cad711SPaolo Bonzini    echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4617e67db06eSJia Liu  ;;
461864656024SJuan Quintela  ppc*)
461925be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
462076cad711SPaolo Bonzini    echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
462164656024SJuan Quintela  ;;
462224e804ecSAlexander Graf  s390*)
462325be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
462476cad711SPaolo Bonzini    echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
462564656024SJuan Quintela  ;;
462664656024SJuan Quintela  sh4)
462725be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
462876cad711SPaolo Bonzini    echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
462964656024SJuan Quintela  ;;
463064656024SJuan Quintela  sparc*)
463125be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
463276cad711SPaolo Bonzini    echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
463364656024SJuan Quintela  ;;
4634cfa550c6SMax Filippov  xtensa*)
4635cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
463676cad711SPaolo Bonzini    echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
4637cfa550c6SMax Filippov  ;;
463864656024SJuan Quintela  esac
463964656024SJuan Quinteladone
46409195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
46419195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
464276cad711SPaolo Bonzini  echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
46439195b2c2SStefan Weilfi
464464656024SJuan Quintela
46456ee7126fSJuan Quintelacase "$ARCH" in
46466ee7126fSJuan Quintelaalpha)
46476ee7126fSJuan Quintela  # Ensure there's only a single GP
46486ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
46496ee7126fSJuan Quintela;;
46506ee7126fSJuan Quintelaesac
46516ee7126fSJuan Quintela
4652d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
465325be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
4654d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
4655d02c1db3SJuan Quintela    cflags="-p $cflags"
4656d02c1db3SJuan Quintela    ldflags="-p $ldflags"
4657d02c1db3SJuan Quintela  fi
4658d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
4659d02c1db3SJuan Quintela    ldflags="-p $ldflags"
466025be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
4661d02c1db3SJuan Quintela  fi
4662d02c1db3SJuan Quintelafi
4663d02c1db3SJuan Quintela
46649b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4665964c6fa1SRichard Henderson  ldflags="$ldflags $textseg_ldflags"
4666fa282484SJuan Quintelafi
4667fa282484SJuan Quintela
466825be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
466925be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4670fa282484SJuan Quintela
467197a847bcSbellarddone # for target in $targets
46727d13299dSbellard
4673b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then
4674b776eca1SGerd Hoffmann  echo "config-host.h: subdir-pixman" >> $config_host_mak
4675b776eca1SGerd Hoffmannfi
4676b776eca1SGerd Hoffmann
46772da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
46782da776dbSMichael R. Hinesecho "CONFIG_RDMA=y" >> $config_host_mak
46792da776dbSMichael R. Hinesfi
46802da776dbSMichael R. Hines
4681a540f158SPeter Crosthwaiteif [ "$dtc_internal" = "yes" ]; then
4682a540f158SPeter Crosthwaite  echo "config-host.h: subdir-dtc" >> $config_host_mak
4683a540f158SPeter Crosthwaitefi
4684a540f158SPeter Crosthwaite
4685d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
4686f93296eaSWenchao XiaDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
46872b170effSMichael TokarevDIRS="$DIRS fsdev"
46889933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
46892d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
46902dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
4691c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4692c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
4693aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
4694ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4695446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
46969933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile"
46972d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
46984652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp"
4699753d11f2SRichard Hendersonfor bios_file in \
4700753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
47015acc2ec0SGerd Hoffmann    $source_path/pc-bios/*.aml \
4702753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
4703753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
4704e89e33e1SDominik Dingel    $source_path/pc-bios/*.img \
4705753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
4706753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
4707753d11f2SRichard Hendersondo
47087ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
47097ea78b74SJan Kiszkadone
4710d1807a4fSPaolo Bonzinimkdir -p $DIRS
47117d13299dSbellardfor f in $FILES ; do
471272b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4713f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
4714f9245e10SPeter Maydell    fi
47157d13299dSbellarddone
47161ad2134fSPaul Brook
4717c34ebfdcSAnthony Liguori# temporary config to build submodules
47182d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
4719c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
472037116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4721c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
47223dd46c78SBlue Swirl    echo "AS=$as" >> $config_mak
4723c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4724c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
47253dd46c78SBlue Swirl    echo "CPP=$cpp" >> $config_mak
4726c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4727a31a8642SMichael S. Tsirkin    echo "IASL=$iasl" >> $config_mak
4728c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4729c34ebfdcSAnthony Liguoridone
4730c34ebfdcSAnthony Liguori
4731b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4732b40292e7SJan Kiszka  mkdir -p QMP
4733b40292e7SJan Kiszkafi
4734