xref: /openbmc/qemu/configure (revision 063c3378)
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
32645d285abSPeter Maydell# If the user hasn't specified ARFLAGS, default to 'rv', just as make does.
32745d285abSPeter MaydellARFLAGS="${ARFLAGS-rv}"
32845d285abSPeter Maydell
329be17dc90SMichael S. Tsirkin# default flags for all hosts
330be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
331f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
332c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
333be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
3346b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
3355bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
3365bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
337be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
3385bc62e01SGerd Hoffmannfi
339be17dc90SMichael S. Tsirkin
340ca4deeb1SPaolo Bonzini# make source path absolute
341ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
342ca4deeb1SPaolo Bonzini
343ac0df51dSaliguoricheck_define() {
344ac0df51dSaliguoricat > $TMPC <<EOF
345ac0df51dSaliguori#if !defined($1)
346fd786e1aSPeter Maydell#error $1 not defined
347ac0df51dSaliguori#endif
348ac0df51dSaliguoriint main(void) { return 0; }
349ac0df51dSaliguoriEOF
35052166aa0SJuan Quintela  compile_object
351ac0df51dSaliguori}
352ac0df51dSaliguori
353bbea4050SPeter Maydellif check_define __linux__ ; then
354bbea4050SPeter Maydell  targetos="Linux"
355bbea4050SPeter Maydellelif check_define _WIN32 ; then
356bbea4050SPeter Maydell  targetos='MINGW32'
357bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then
358bbea4050SPeter Maydell  targetos='OpenBSD'
359bbea4050SPeter Maydellelif check_define __sun__ ; then
360bbea4050SPeter Maydell  targetos='SunOS'
361bbea4050SPeter Maydellelif check_define __HAIKU__ ; then
362bbea4050SPeter Maydell  targetos='Haiku'
363bbea4050SPeter Maydellelse
364bbea4050SPeter Maydell  targetos=`uname -s`
365bbea4050SPeter Maydellfi
366bbea4050SPeter Maydell
367bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use.
368bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're
369bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify
370bbea4050SPeter Maydell# the correct CPU with the --cpu option.
371bbea4050SPeter Maydellcase $targetos in
372bbea4050SPeter MaydellDarwin)
373bbea4050SPeter Maydell  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
374bbea4050SPeter Maydell  # run 64-bit userspace code.
375bbea4050SPeter Maydell  # If the user didn't specify a CPU explicitly and the kernel says this is
376bbea4050SPeter Maydell  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
377bbea4050SPeter Maydell  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
378bbea4050SPeter Maydell    cpu="x86_64"
379bbea4050SPeter Maydell  fi
380bbea4050SPeter Maydell  ;;
381bbea4050SPeter MaydellSunOS)
382bbea4050SPeter Maydell  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
383bbea4050SPeter Maydell  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
384bbea4050SPeter Maydell    cpu="x86_64"
385bbea4050SPeter Maydell  fi
386bbea4050SPeter Maydellesac
387bbea4050SPeter Maydell
3882ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
3892ff6b91eSJuan Quintela  # command line argument
3902ff6b91eSJuan Quintela  :
3912ff6b91eSJuan Quintelaelif check_define __i386__ ; then
392ac0df51dSaliguori  cpu="i386"
393ac0df51dSaliguorielif check_define __x86_64__ ; then
394c72b26ecSRichard Henderson  if check_define __ILP32__ ; then
395c72b26ecSRichard Henderson    cpu="x32"
396c72b26ecSRichard Henderson  else
397ac0df51dSaliguori    cpu="x86_64"
398c72b26ecSRichard Henderson  fi
3993aa9bd6cSblueswir1elif check_define __sparc__ ; then
4003aa9bd6cSblueswir1  if check_define __arch64__ ; then
4013aa9bd6cSblueswir1    cpu="sparc64"
4023aa9bd6cSblueswir1  else
4033aa9bd6cSblueswir1    cpu="sparc"
4043aa9bd6cSblueswir1  fi
405fdf7ed96Smalcelif check_define _ARCH_PPC ; then
406fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
407fdf7ed96Smalc    cpu="ppc64"
408ac0df51dSaliguori  else
409fdf7ed96Smalc    cpu="ppc"
410fdf7ed96Smalc  fi
411afa05235SAurelien Jarnoelif check_define __mips__ ; then
412afa05235SAurelien Jarno  cpu="mips"
413477ba620SAurelien Jarnoelif check_define __ia64__ ; then
414477ba620SAurelien Jarno  cpu="ia64"
415d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
416d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
417d66ed0eaSAurelien Jarno    cpu="s390x"
418d66ed0eaSAurelien Jarno  else
419d66ed0eaSAurelien Jarno    cpu="s390"
420d66ed0eaSAurelien Jarno  fi
42121d89f84SPeter Maydellelif check_define __arm__ ; then
42221d89f84SPeter Maydell  cpu="arm"
4231f080313SClaudio Fontanaelif check_define __aarch64__ ; then
4241f080313SClaudio Fontana  cpu="aarch64"
425f28ffed5SBradelif check_define __hppa__ ; then
426f28ffed5SBrad  cpu="hppa"
427fdf7ed96Smalcelse
428fdf7ed96Smalc  cpu=`uname -m`
429ac0df51dSaliguorifi
430ac0df51dSaliguori
431359bc95dSPeter MaydellARCH=
432359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
433359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
4347d13299dSbellardcase "$cpu" in
435c72b26ecSRichard Henderson  ia64|ppc|ppc64|s390|s390x|sparc64|x32)
436ea8f20f8SJuan Quintela    cpu="$cpu"
437ea8f20f8SJuan Quintela  ;;
4387d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
43997a847bcSbellard    cpu="i386"
4407d13299dSbellard  ;;
441aaa5fa14Saurel32  x86_64|amd64)
442aaa5fa14Saurel32    cpu="x86_64"
443aaa5fa14Saurel32  ;;
44421d89f84SPeter Maydell  armv*b|armv*l|arm)
44521d89f84SPeter Maydell    cpu="arm"
4467d13299dSbellard  ;;
4471f080313SClaudio Fontana  aarch64)
4481f080313SClaudio Fontana    cpu="aarch64"
4491f080313SClaudio Fontana  ;;
450afa05235SAurelien Jarno  mips*)
451afa05235SAurelien Jarno    cpu="mips"
452afa05235SAurelien Jarno  ;;
4533142255cSblueswir1  sparc|sun4[cdmuv])
454ae228531Sbellard    cpu="sparc"
455ae228531Sbellard  ;;
4567d13299dSbellard  *)
457359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
458359bc95dSPeter Maydell    ARCH=unknown
4597d13299dSbellard  ;;
4607d13299dSbellardesac
461359bc95dSPeter Maydellif test -z "$ARCH"; then
462359bc95dSPeter Maydell  ARCH="$cpu"
463359bc95dSPeter Maydellfi
464e2d52ad3SJuan Quintela
4657d13299dSbellard# OS specific
4660dbfc675SJuan Quintela
4677d13299dSbellardcase $targetos in
468c326e0afSbellardCYGWIN*)
469c326e0afSbellard  mingw32="yes"
470a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
471d5631638Smalc  audio_possible_drivers="winwave sdl"
472d5631638Smalc  audio_drv_list="winwave"
473c326e0afSbellard;;
47467b915a5SbellardMINGW32*)
47567b915a5Sbellard  mingw32="yes"
476d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
477d5631638Smalc  audio_drv_list="winwave"
47867b915a5Sbellard;;
4795c40d2bdSthsGNU/kFreeBSD)
480a167ba50SAurelien Jarno  bsd="yes"
4810c58ac1cSmalc  audio_drv_list="oss"
482f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
4835c40d2bdSths;;
4847d3505c5SbellardFreeBSD)
4857d3505c5Sbellard  bsd="yes"
4860db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4870c58ac1cSmalc  audio_drv_list="oss"
488f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
489f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
490f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
4917d3505c5Sbellard;;
492c5e97233Sblueswir1DragonFly)
493c5e97233Sblueswir1  bsd="yes"
4940db4a067SPaolo Bonzini  make="${MAKE-gmake}"
495c5e97233Sblueswir1  audio_drv_list="oss"
496c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
497c5e97233Sblueswir1;;
4987d3505c5SbellardNetBSD)
4997d3505c5Sbellard  bsd="yes"
5000db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5010c58ac1cSmalc  audio_drv_list="oss"
502c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
5038ef92a88Sblueswir1  oss_lib="-lossaudio"
5047d3505c5Sbellard;;
5057d3505c5SbellardOpenBSD)
5067d3505c5Sbellard  bsd="yes"
5070db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5084f6ab397SBrad Smith  audio_drv_list="sdl"
5094f6ab397SBrad Smith  audio_possible_drivers="sdl esd"
5107d3505c5Sbellard;;
51183fb7adfSbellardDarwin)
51283fb7adfSbellard  bsd="yes"
51383fb7adfSbellard  darwin="yes"
5141b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
515a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
5160c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
5171b0f9cc2Saliguori  else
518a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
5191b0f9cc2Saliguori  fi
520fd677642Sths  cocoa="yes"
5210c58ac1cSmalc  audio_drv_list="coreaudio"
522c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
5230c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
5247973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
525a0b7cf6bSPeter Maydell  # Disable attempts to use ObjectiveC features in os/object.h since they
526a0b7cf6bSPeter Maydell  # won't work when we're compiling with gcc as a C compiler.
527a0b7cf6bSPeter Maydell  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
52883fb7adfSbellard;;
529ec530c81SbellardSunOS)
530ec530c81Sbellard  solaris="yes"
5310db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5320db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
533fa58948dSBlue Swirl  ld="gld"
534e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
5350475a5caSths  needs_libsunmath="no"
536c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
537c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
5380475a5caSths    if test "$solarisrev" -le 9 ; then
5390475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
5400475a5caSths        needs_libsunmath="yes"
541f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
542f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
543f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
5440475a5caSths      else
54576ad07a4SPeter Maydell        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
54676ad07a4SPeter Maydell            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
54776ad07a4SPeter Maydell            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
54876ad07a4SPeter Maydell            "Studio 11 can be downloaded from www.sun.com."
5490475a5caSths      fi
5500475a5caSths    fi
55186b2bd93Sths  fi
5526b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
5530c58ac1cSmalc    audio_drv_list="oss"
5546b4d2ba1Sths  fi
555c2de5c91Smalc  audio_possible_drivers="oss sdl"
556d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
557d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
558d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
559d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
560a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
561560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
562560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
563560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
564ec530c81Sbellard;;
565b29fe3edSmalcAIX)
566b29fe3edSmalc  aix="yes"
5670db4a067SPaolo Bonzini  make="${MAKE-gmake}"
568b29fe3edSmalc;;
569179cf400SAndreas FärberHaiku)
570179cf400SAndreas Färber  haiku="yes"
571179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
572179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
573179cf400SAndreas Färber;;
574fb065187Sbellard*)
5750c58ac1cSmalc  audio_drv_list="oss"
576b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
5775327cf48Sbellard  linux="yes"
578831b7825Sths  linux_user="yes"
579af2be207SJan Kiszka  kvm="yes"
580af2be207SJan Kiszka  vhost_net="yes"
5815e9be92dSNicholas Bellinger  vhost_scsi="yes"
582c72b26ecSRichard Henderson  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
583c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
584c9ec1fe4Sbellard  fi
585a585140dSAlexey Kardashevskiy  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
586fb065187Sbellard;;
5877d13299dSbellardesac
5887d13299dSbellard
5897d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
590b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
59184778508Sblueswir1    bsd_user="yes"
5927d3505c5Sbellard  fi
59308de3949SAndreas Färberfi
5947d3505c5Sbellard
5950db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5960db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
59752510f8bSStefan Weil: ${python=${PYTHON-python}}
598e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5990db4a067SPaolo Bonzini
6003c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC
6013c4a4d0dSPeter Maydellif has clang; then
6023c4a4d0dSPeter Maydell  objcc=clang
6033c4a4d0dSPeter Maydellelse
6043c4a4d0dSPeter Maydell  objcc="$cc"
6053c4a4d0dSPeter Maydellfi
6063c4a4d0dSPeter Maydell
6073457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
6083457a3f8SJuan Quintela  EXESUF=".exe"
609a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
610e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
611e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
612f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
613f7cf5d5bSStefan Weilcat > $TMPC << EOF
614f7cf5d5bSStefan Weilint main(void) { return 0; }
615f7cf5d5bSStefan WeilEOF
616f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
617f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
618f7cf5d5bSStefan Weil  fi
619c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
620683035deSPaolo Bonzini  mandir="\${prefix}"
621528ae5b8SEduardo Habkost  datadir="\${prefix}"
622850da188SEduardo Habkost  qemu_docdir="\${prefix}"
623683035deSPaolo Bonzini  bindir="\${prefix}"
624683035deSPaolo Bonzini  sysconfdir="\${prefix}"
6255a699bbbSLaszlo Ersek  local_statedir=
626683035deSPaolo Bonzini  confsuffix=""
627368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
6283457a3f8SJuan Quintelafi
6293457a3f8SJuan Quintela
630487fefdbSAnthony Liguoriwerror=""
63185aa5189Sbellard
6327d13299dSbellardfor opt do
633a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
6347d13299dSbellard  case "$opt" in
6352efc3265Sbellard  --help|-h) show_help=yes
6362efc3265Sbellard  ;;
63799123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
63899123e13SMike Frysinger  ;;
639b1a550a0Spbrook  --prefix=*) prefix="$optarg"
6407d13299dSbellard  ;;
641b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
64232ce6337Sbellard  ;;
643ca4deeb1SPaolo Bonzini  --source-path=*)
6447d13299dSbellard  ;;
645ac0df51dSaliguori  --cross-prefix=*)
6467d13299dSbellard  ;;
647ac0df51dSaliguori  --cc=*)
6487d13299dSbellard  ;;
649b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
65083469015Sbellard  ;;
65183f73fceSTomoki Sekiyama  --cxx=*)
65283f73fceSTomoki Sekiyama  ;;
653e007dbecSMichael S. Tsirkin  --iasl=*) iasl="$optarg"
654e007dbecSMichael S. Tsirkin  ;;
6553c4a4d0dSPeter Maydell  --objcc=*) objcc="$optarg"
6563c4a4d0dSPeter Maydell  ;;
657b1a550a0Spbrook  --make=*) make="$optarg"
6587d13299dSbellard  ;;
6596a882643Spbrook  --install=*) install="$optarg"
6606a882643Spbrook  ;;
661c886edfbSBlue Swirl  --python=*) python="$optarg"
662c886edfbSBlue Swirl  ;;
6631d728c39SBlue Swirl  --gcov=*) gcov_tool="$optarg"
6641d728c39SBlue Swirl  ;;
665e2d8830eSBrad  --smbd=*) smbd="$optarg"
666e2d8830eSBrad  ;;
667e2a2ed06SJuan Quintela  --extra-cflags=*)
6687d13299dSbellard  ;;
669e2a2ed06SJuan Quintela  --extra-ldflags=*)
6707d13299dSbellard  ;;
6715bc62e01SGerd Hoffmann  --enable-debug-info)
6725bc62e01SGerd Hoffmann  ;;
6735bc62e01SGerd Hoffmann  --disable-debug-info)
6745bc62e01SGerd Hoffmann  ;;
6752ff6b91eSJuan Quintela  --cpu=*)
6767d13299dSbellard  ;;
677b1a550a0Spbrook  --target-list=*) target_list="$optarg"
678de83cd02Sbellard  ;;
67974242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
68094a420b1SStefan Hajnoczi  ;;
68174242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
6829410b56cSPrerna Saxena  ;;
6837d13299dSbellard  --enable-gprof) gprof="yes"
6847d13299dSbellard  ;;
6851d728c39SBlue Swirl  --enable-gcov) gcov="yes"
6861d728c39SBlue Swirl  ;;
68779427693SLoïc Minier  --static)
68879427693SLoïc Minier    static="yes"
68979427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
69017884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
69143ce4dfeSbellard  ;;
6920b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
6930b24e75fSPaolo Bonzini  ;;
6940b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
6950b24e75fSPaolo Bonzini  ;;
6963aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
6973aa5d2beSAlon Levy  ;;
6988bf188aaSMichael Tokarev  --libexecdir=*) libexecdir="$optarg"
6998bf188aaSMichael Tokarev  ;;
7000f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
7010f94d6daSAlon Levy  ;;
702528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
7030b24e75fSPaolo Bonzini  ;;
704023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
705023d3d67SEduardo Habkost  ;;
706850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
7070b24e75fSPaolo Bonzini  ;;
708ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
70907381cc1SAnthony Liguori  ;;
710785c23aeSLuiz Capitulino  --localstatedir=*) local_statedir="$optarg"
711785c23aeSLuiz Capitulino  ;;
712785c23aeSLuiz Capitulino  --sbindir=*|--sharedstatedir=*|\
713023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
714023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
715023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
716023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
717023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
718023ddd74SMax Filippov    # lots of directory switches by default.
719023ddd74SMax Filippov  ;;
720e2134eb9SGerd Hoffmann  --with-system-pixman) pixman="system"
721e2134eb9SGerd Hoffmann  ;;
722e2134eb9SGerd Hoffmann  --without-system-pixman) pixman="internal"
723e2134eb9SGerd Hoffmann  ;;
72474880fe2SRobert Schiele  --without-pixman) pixman="none"
72574880fe2SRobert Schiele  ;;
72697a847bcSbellard  --disable-sdl) sdl="no"
72797a847bcSbellard  ;;
728c4198157SJuan Quintela  --enable-sdl) sdl="yes"
729c4198157SJuan Quintela  ;;
7303556c233SPaolo Bonzini  --disable-qom-cast-debug) qom_cast_debug="no"
7313556c233SPaolo Bonzini  ;;
7323556c233SPaolo Bonzini  --enable-qom-cast-debug) qom_cast_debug="yes"
7333556c233SPaolo Bonzini  ;;
734983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
735983eef5aSMeador Inge  ;;
736983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
737983eef5aSMeador Inge  ;;
738821601eaSJes Sorensen  --disable-vnc) vnc="no"
739821601eaSJes Sorensen  ;;
740821601eaSJes Sorensen  --enable-vnc) vnc="yes"
741821601eaSJes Sorensen  ;;
742b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
743102a52e4Sbellard  ;;
744c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
745c2de5c91Smalc  ;;
7462f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
7472f6a1ab0Sblueswir1  ;;
7480c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
7490c58ac1cSmalc  ;;
750b64ec4e4SFam Zheng  --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
751b64ec4e4SFam Zheng  ;;
752b64ec4e4SFam Zheng  --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
753eb852011SMarkus Armbruster  ;;
754f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
755f8393946Saurel32  ;;
756f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
757f8393946Saurel32  ;;
758f3d08ee6SPaul Brook  --enable-debug)
759f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
760f3d08ee6SPaul Brook      debug_tcg="yes"
761f3d08ee6SPaul Brook      debug="yes"
762f3d08ee6SPaul Brook      strip_opt="no"
763f3d08ee6SPaul Brook  ;;
76403b4fe7dSaliguori  --enable-sparse) sparse="yes"
76503b4fe7dSaliguori  ;;
76603b4fe7dSaliguori  --disable-sparse) sparse="no"
76703b4fe7dSaliguori  ;;
7681625af87Saliguori  --disable-strip) strip_opt="no"
7691625af87Saliguori  ;;
7708d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
7718d5d2d4cSths  ;;
7721be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
7731be10ad2SJuan Quintela  ;;
7742f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
7752f9606b3Saliguori  ;;
776ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
777ea784e3bSJuan Quintela  ;;
7782f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
7792f6f5c7aSCorentin Chary  ;;
7802f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
7812f6f5c7aSCorentin Chary  ;;
782efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
783efe556adSCorentin Chary  ;;
784efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
785efe556adSCorentin Chary  ;;
7867536ee4bSTim Hardeck  --disable-vnc-ws) vnc_ws="no"
7877536ee4bSTim Hardeck  ;;
7887536ee4bSTim Hardeck  --enable-vnc-ws) vnc_ws="yes"
7897536ee4bSTim Hardeck  ;;
790443f1376Sbellard  --disable-slirp) slirp="no"
791c20709aaSbellard  ;;
792ee682d27SStefan Weil  --disable-uuid) uuid="no"
793ee682d27SStefan Weil  ;;
794ee682d27SStefan Weil  --enable-uuid) uuid="yes"
795ee682d27SStefan Weil  ;;
796e0e6c8c0Saliguori  --disable-vde) vde="no"
7978a16d273Sths  ;;
798dfb278bdSJuan Quintela  --enable-vde) vde="yes"
799dfb278bdSJuan Quintela  ;;
800e37630caSaliguori  --disable-xen) xen="no"
801e37630caSaliguori  ;;
802fc321b4bSJuan Quintela  --enable-xen) xen="yes"
803fc321b4bSJuan Quintela  ;;
804eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
805eb6fda0fSAnthony PERARD  ;;
806eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
807eb6fda0fSAnthony PERARD  ;;
8082e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
8092e4d9fb1Saurel32  ;;
8104ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
8114ffcedb6SJuan Quintela  ;;
812fb599c9aSbalrog  --disable-bluez) bluez="no"
813fb599c9aSbalrog  ;;
814a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
815a20a6f46SJuan Quintela  ;;
8167ba1e619Saliguori  --disable-kvm) kvm="no"
8177ba1e619Saliguori  ;;
818b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
819b31a0277SJuan Quintela  ;;
8209195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
8219195b2c2SStefan Weil  ;;
8229195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
8239195b2c2SStefan Weil  ;;
82447e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
82547e98658SCorey Bryant  ;;
82647e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
82747e98658SCorey Bryant  ;;
828cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
829cd4ec0b4SGerd Hoffmann  ;;
830cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
831cd4ec0b4SGerd Hoffmann  ;;
832c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
833c589b249SRonnie Sahlberg  ;;
834c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
835c589b249SRonnie Sahlberg  ;;
83605c2a3e7Sbellard  --enable-profiler) profiler="yes"
83705c2a3e7Sbellard  ;;
83814821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
83914821030SPavel Borzenkov  ;;
840c2de5c91Smalc  --enable-cocoa)
841c2de5c91Smalc      cocoa="yes" ;
842c2de5c91Smalc      sdl="no" ;
843c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
8445b0753e0Sbellard  ;;
845cad25d69Spbrook  --disable-system) softmmu="no"
8460a8e90f4Spbrook  ;;
847cad25d69Spbrook  --enable-system) softmmu="yes"
8480a8e90f4Spbrook  ;;
8490953a80fSZachary Amsden  --disable-user)
8500953a80fSZachary Amsden      linux_user="no" ;
8510953a80fSZachary Amsden      bsd_user="no" ;
8520953a80fSZachary Amsden  ;;
8530953a80fSZachary Amsden  --enable-user) ;;
854831b7825Sths  --disable-linux-user) linux_user="no"
8550a8e90f4Spbrook  ;;
856831b7825Sths  --enable-linux-user) linux_user="yes"
857831b7825Sths  ;;
85884778508Sblueswir1  --disable-bsd-user) bsd_user="no"
85984778508Sblueswir1  ;;
86084778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
86184778508Sblueswir1  ;;
862379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
863379f6698SPaul Brook  ;;
864379f6698SPaul Brook  --disable-guest-base) guest_base="no"
865379f6698SPaul Brook  ;;
86640d6444eSAvi Kivity  --enable-pie) pie="yes"
86734005a00SKirill A. Shutemov  ;;
86840d6444eSAvi Kivity  --disable-pie) pie="no"
86934005a00SKirill A. Shutemov  ;;
870c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
871c5937220Spbrook  ;;
87285aa5189Sbellard  --enable-werror) werror="yes"
87385aa5189Sbellard  ;;
87485aa5189Sbellard  --disable-werror) werror="no"
87585aa5189Sbellard  ;;
8764d3b6f6eSbalrog  --disable-curses) curses="no"
8774d3b6f6eSbalrog  ;;
878c584a6d0SJuan Quintela  --enable-curses) curses="yes"
879c584a6d0SJuan Quintela  ;;
880769ce76dSAlexander Graf  --disable-curl) curl="no"
881769ce76dSAlexander Graf  ;;
882788c8196SJuan Quintela  --enable-curl) curl="yes"
883788c8196SJuan Quintela  ;;
8842df87df7SJuan Quintela  --disable-fdt) fdt="no"
8852df87df7SJuan Quintela  ;;
8862df87df7SJuan Quintela  --enable-fdt) fdt="yes"
8872df87df7SJuan Quintela  ;;
8885c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
8895c6c3a6cSChristoph Hellwig  ;;
8905c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
8915c6c3a6cSChristoph Hellwig  ;;
892758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
893758e8e38SVenkateswararao Jujjuri (JV)  ;;
894758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
895758e8e38SVenkateswararao Jujjuri (JV)  ;;
89677755340Sths  --disable-blobs) blobs="no"
89777755340Sths  ;;
8984a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
8994a19f1ecSpbrook  ;;
900519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
901519175a2SAlex Barcelo  ;;
90270c60c08SStefan Hajnoczi  --disable-coroutine-pool) coroutine_pool="no"
90370c60c08SStefan Hajnoczi  ;;
90470c60c08SStefan Hajnoczi  --enable-coroutine-pool) coroutine_pool="yes"
90570c60c08SStefan Hajnoczi  ;;
906a25dba17SJuan Quintela  --disable-docs) docs="no"
90770ec5dc0SAnthony Liguori  ;;
908a25dba17SJuan Quintela  --enable-docs) docs="yes"
90983a3ab8bSJuan Quintela  ;;
910d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
911d5970055SMichael S. Tsirkin  ;;
912d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
913d5970055SMichael S. Tsirkin  ;;
9145e9be92dSNicholas Bellinger  --disable-vhost-scsi) vhost_scsi="no"
9155e9be92dSNicholas Bellinger  ;;
9165e9be92dSNicholas Bellinger  --enable-vhost-scsi) vhost_scsi="yes"
9175e9be92dSNicholas Bellinger  ;;
918b1e5fff4SMichael Walle  --disable-glx) glx="no"
91920ff075bSMichael Walle  ;;
920b1e5fff4SMichael Walle  --enable-glx) glx="yes"
92120ff075bSMichael Walle  ;;
922f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
923f27aaf4bSChristian Brunner  ;;
924f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
925f27aaf4bSChristian Brunner  ;;
9268c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
9278c84cf11SSergei Trofimovich  ;;
9288c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
9298c84cf11SSergei Trofimovich  ;;
930111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
931111a38b0SRobert Relyea  ;;
932111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
933111a38b0SRobert Relyea  ;;
9342b2325ffSGerd Hoffmann  --disable-libusb) libusb="no"
9352b2325ffSGerd Hoffmann  ;;
9362b2325ffSGerd Hoffmann  --enable-libusb) libusb="yes"
9372b2325ffSGerd Hoffmann  ;;
93869354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
93969354a83SHans de Goede  ;;
94069354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
94169354a83SHans de Goede  ;;
9421ece9905SAlon Levy  --disable-zlib-test) zlib="no"
9431ece9905SAlon Levy  ;;
944d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
945d138cee9SMichael Roth  ;;
946d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
947d138cee9SMichael Roth  ;;
948d9840e25STomoki Sekiyama  --with-vss-sdk) vss_win32_sdk=""
949d9840e25STomoki Sekiyama  ;;
950d9840e25STomoki Sekiyama  --with-vss-sdk=*) vss_win32_sdk="$optarg"
951d9840e25STomoki Sekiyama  ;;
952d9840e25STomoki Sekiyama  --without-vss-sdk) vss_win32_sdk="no"
953d9840e25STomoki Sekiyama  ;;
954d9840e25STomoki Sekiyama  --with-win-sdk) win_sdk=""
955d9840e25STomoki Sekiyama  ;;
956d9840e25STomoki Sekiyama  --with-win-sdk=*) win_sdk="$optarg"
957d9840e25STomoki Sekiyama  ;;
958d9840e25STomoki Sekiyama  --without-win-sdk) win_sdk="no"
959d9840e25STomoki Sekiyama  ;;
9604b1c11fdSDaniel P. Berrange  --enable-tools) want_tools="yes"
9614b1c11fdSDaniel P. Berrange  ;;
9624b1c11fdSDaniel P. Berrange  --disable-tools) want_tools="no"
9634b1c11fdSDaniel P. Berrange  ;;
964f794573eSEduardo Otubo  --enable-seccomp) seccomp="yes"
965f794573eSEduardo Otubo  ;;
966f794573eSEduardo Otubo  --disable-seccomp) seccomp="no"
967f794573eSEduardo Otubo  ;;
968eb100396SBharata B Rao  --disable-glusterfs) glusterfs="no"
969eb100396SBharata B Rao  ;;
970eb100396SBharata B Rao  --enable-glusterfs) glusterfs="yes"
971eb100396SBharata B Rao  ;;
972583f6e7bSStefan Hajnoczi  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
973583f6e7bSStefan Hajnoczi  ;;
974583f6e7bSStefan Hajnoczi  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
975583f6e7bSStefan Hajnoczi  ;;
976a4ccabcfSAnthony Liguori  --disable-gtk) gtk="no"
977a4ccabcfSAnthony Liguori  ;;
978a4ccabcfSAnthony Liguori  --enable-gtk) gtk="yes"
979a4ccabcfSAnthony Liguori  ;;
9802da776dbSMichael R. Hines  --enable-rdma) rdma="yes"
9812da776dbSMichael R. Hines  ;;
9822da776dbSMichael R. Hines  --disable-rdma) rdma="no"
9832da776dbSMichael R. Hines  ;;
984528de90aSDaniel P. Berrange  --with-gtkabi=*) gtkabi="$optarg"
985528de90aSDaniel P. Berrange  ;;
986ab214c29SStefan Berger  --enable-tpm) tpm="yes"
987ab214c29SStefan Berger  ;;
9880a12ec87SRichard W.M. Jones  --disable-libssh2) libssh2="no"
9890a12ec87SRichard W.M. Jones  ;;
9900a12ec87SRichard W.M. Jones  --enable-libssh2) libssh2="yes"
9910a12ec87SRichard W.M. Jones  ;;
9924f18b782SJeff Cody  --enable-vhdx) vhdx="yes"
9934f18b782SJeff Cody  ;;
9944f18b782SJeff Cody  --disable-vhdx) vhdx="no"
9954f18b782SJeff Cody  ;;
9967f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
9977f1559c6Sbalrog  ;;
9987d13299dSbellard  esac
9997d13299dSbellarddone
10007d13299dSbellard
100140293e58Sbellardcase "$cpu" in
1002e3608d66SRichard Henderson    ppc)
1003e3608d66SRichard Henderson           CPU_CFLAGS="-m32"
1004e3608d66SRichard Henderson           LDFLAGS="-m32 $LDFLAGS"
1005e3608d66SRichard Henderson           ;;
1006e3608d66SRichard Henderson    ppc64)
1007e3608d66SRichard Henderson           CPU_CFLAGS="-m64"
1008e3608d66SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
1009e3608d66SRichard Henderson           ;;
10109b9c37c3SRichard Henderson    sparc)
10110c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
101279f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32 -mcpu=ultrasparc"
10133142255cSblueswir1           ;;
1014ed968ff1SJuan Quintela    sparc64)
10150c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
101679f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -mcpu=ultrasparc"
10173142255cSblueswir1           ;;
101876d83bdeSths    s390)
101979f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m31 -march=z990"
102028d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
102128d7cc49SRichard Henderson           ;;
102228d7cc49SRichard Henderson    s390x)
102379f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -march=z990"
102428d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
102576d83bdeSths           ;;
102640293e58Sbellard    i386)
102779f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32"
10280c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
10292b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
103040293e58Sbellard           ;;
103140293e58Sbellard    x86_64)
103279f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64"
10330c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
10342b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
1035379f6698SPaul Brook           ;;
1036c72b26ecSRichard Henderson    x32)
1037c72b26ecSRichard Henderson           CPU_CFLAGS="-mx32"
1038c72b26ecSRichard Henderson           LDFLAGS="-mx32 $LDFLAGS"
1039c72b26ecSRichard Henderson           cc_i386='$(CC) -m32'
1040c72b26ecSRichard Henderson           ;;
104130163d89SPeter Maydell    # No special flags required for other host CPUs
10423142255cSblueswir1esac
10433142255cSblueswir1
104479f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
104579f3b12fSPeter CrosthwaiteEXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
104679f3b12fSPeter Crosthwaite
104760e0df25SPeter Maydelldefault_target_list=""
104860e0df25SPeter Maydell
10496e92f823SPeter Maydellmak_wilds=""
10506e92f823SPeter Maydell
105160e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then
10526e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
105360e0df25SPeter Maydellfi
105460e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then
10556e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
105660e0df25SPeter Maydellfi
105760e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then
10586e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
105960e0df25SPeter Maydellfi
106060e0df25SPeter Maydell
10616e92f823SPeter Maydellfor config in $mak_wilds; do
10626e92f823SPeter Maydell    default_target_list="${default_target_list} $(basename "$config" .mak)"
10636e92f823SPeter Maydelldone
10646e92f823SPeter Maydell
1065af5db58eSpbrookif test x"$show_help" = x"yes" ; then
1066af5db58eSpbrookcat << EOF
1067af5db58eSpbrook
1068af5db58eSpbrookUsage: configure [options]
1069af5db58eSpbrookOptions: [defaults in brackets after descriptions]
1070af5db58eSpbrook
1071af5db58eSpbrookEOF
1072af5db58eSpbrookecho "Standard options:"
1073af5db58eSpbrookecho "  --help                   print this message"
1074af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
1075af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
1076af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
107760e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
107860e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
107960e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
1080af5db58eSpbrookecho ""
1081af5db58eSpbrookecho "Advanced options (experts only):"
1082af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
1083af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
1084af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
1085a31a8642SMichael S. Tsirkinecho "  --iasl=IASL              use ACPI compiler IASL [$iasl]"
10860bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
10870bfe8cc0SPaolo Bonziniecho "                           build time"
108883f73fceSTomoki Sekiyamaecho "  --cxx=CXX                use C++ compiler CXX [$cxx]"
10893c4a4d0dSPeter Maydellecho "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
1090a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
1091e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
1092af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
10936a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
1094c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
1095e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
1096af5db58eSpbrookecho "  --static                 enable static build [$static]"
10970b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
1098023d3d67SEduardo Habkostecho "  --datadir=PATH           install firmware in PATH$confsuffix"
1099023d3d67SEduardo Habkostecho "  --docdir=PATH            install documentation in PATH$confsuffix"
11000b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
1101a7b66fa7SDoug Goldsteinecho "  --libdir=PATH            install libraries in PATH"
1102023d3d67SEduardo Habkostecho "  --sysconfdir=PATH        install config in PATH$confsuffix"
11035a699bbbSLaszlo Ersekecho "  --localstatedir=PATH     install local state in PATH (set at runtime on win32)"
11042ae4748fSStefan Weilecho "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1105f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1106f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
11079941afdeSDunrong Huangecho "  --enable-debug-info       enable debugging information (default)"
11089941afdeSDunrong Huangecho "  --disable-debug-info      disable debugging information"
110909695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1110890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1111890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
11121625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
111385aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1114fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1115c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1116ab400449SHu Taoecho "  --disable-gtk            disable gtk UI"
1117ab400449SHu Taoecho "  --enable-gtk             enable gtk UI"
1118983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1119983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1120821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1121821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
112214821030SPavel Borzenkovecho "  --disable-cocoa          disable Cocoa (Mac OS X only)"
112314821030SPavel Borzenkovecho "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
1124c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1125c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
1126b64ec4e4SFam Zhengecho "  --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L"
1127b64ec4e4SFam Zhengecho "  --block-drv-rw-whitelist=L"
1128b64ec4e4SFam Zhengecho "                           set block driver read-write whitelist"
1129b64ec4e4SFam Zhengecho "                           (affects only QEMU, not qemu-img)"
1130b64ec4e4SFam Zhengecho "  --block-drv-ro-whitelist=L"
1131b64ec4e4SFam Zhengecho "                           set block driver read-only whitelist"
1132eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
1133e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1134fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
1135eb6fda0fSAnthony PERARDecho "  --disable-xen-pci-passthrough"
1136eb6fda0fSAnthony PERARDecho "  --enable-xen-pci-passthrough"
11372e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
11384ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
11398d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
11401be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
11412f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1142ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
11432f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
11442f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
114596763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1146efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
11477536ee4bSTim Hardeckecho "  --disable-vnc-ws         disable Websockets support for VNC server"
11487536ee4bSTim Hardeckecho "  --enable-vnc-ws          enable Websockets support for VNC server"
1149af896aaaSpbrookecho "  --disable-curses         disable curses output"
1150c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1151769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1152788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
11532df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
11542df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1155fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1156a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
11576093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
11587ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1159b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
11602da776dbSMichael R. Hinesecho "  --disable-rdma           disable RDMA-based migration support"
11612da776dbSMichael R. Hinesecho "  --enable-rdma            enable RDMA-based migration support"
11629195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1163af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1164af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
11650953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
11660953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1167831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1168831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
116984778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
117084778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1171379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1172379f6698SPaul Brookecho "                           emulation targets"
1173379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
117440d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
117540d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1176af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1177af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
11782f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1179c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1180235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
1181ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1182ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1183e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1184dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
11855c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
11865c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
118747e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
118847e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1189758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1190758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
119177755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1192d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1193d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1194d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1195d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1196320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1197650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
119874242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
11999410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1200cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1201cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1202f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1203c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1204c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
1205111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1206111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
12072b2325ffSGerd Hoffmannecho "  --disable-libusb         disable libusb (for usb passthrough)"
12082b2325ffSGerd Hoffmannecho "  --enable-libusb          enable libusb (for usb passthrough)"
120969354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
121069354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1211d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1212d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1213d9840e25STomoki Sekiyamaecho "  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent"
1214d9840e25STomoki Sekiyamaecho "  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)"
1215f794573eSEduardo Otuboecho "  --disable-seccomp        disable seccomp support"
1216f794573eSEduardo Otuboecho "  --enable-seccomp         enables seccomp support"
1217519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1218fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
121970c60c08SStefan Hajnocziecho "  --disable-coroutine-pool disable coroutine freelist (worse performance)"
122070c60c08SStefan Hajnocziecho "  --enable-coroutine-pool  enable coroutine freelist (better performance)"
1221eb100396SBharata B Raoecho "  --enable-glusterfs       enable GlusterFS backend"
1222eb100396SBharata B Raoecho "  --disable-glusterfs      disable GlusterFS backend"
12231d728c39SBlue Swirlecho "  --enable-gcov            enable test coverage analysis with gcov"
12241d728c39SBlue Swirlecho "  --gcov=GCOV              use specified gcov [$gcov_tool]"
1225ab214c29SStefan Bergerecho "  --enable-tpm             enable TPM support"
12260a12ec87SRichard W.M. Jonesecho "  --disable-libssh2        disable ssh block device support"
12270a12ec87SRichard W.M. Jonesecho "  --enable-libssh2         enable ssh block device support"
12284f18b782SJeff Codyecho "  --disable-vhdx           disables support for the Microsoft VHDX image format"
12294f18b782SJeff Codyecho "  --enable-vhdx            enable support for the Microsoft VHDX image format"
1230af5db58eSpbrookecho ""
12315bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1232af5db58eSpbrookexit 1
1233af5db58eSpbrookfi
1234af5db58eSpbrook
1235359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1236359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1237359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1238359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1239359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1240359bc95dSPeter Maydell        ARCH=tci
1241359bc95dSPeter Maydell    else
124276ad07a4SPeter Maydell        error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1243359bc95dSPeter Maydell    fi
1244359bc95dSPeter Maydellfi
1245359bc95dSPeter Maydell
12468d05095cSPaolo Bonzini# check that the C compiler works.
12478d05095cSPaolo Bonzinicat > $TMPC <<EOF
124875cafad7SStefan Weilint main(void) { return 0; }
12498d05095cSPaolo BonziniEOF
12508d05095cSPaolo Bonzini
12518d05095cSPaolo Bonziniif compile_object ; then
12528d05095cSPaolo Bonzini  : C compiler works ok
12538d05095cSPaolo Bonzinielse
125476ad07a4SPeter Maydell    error_exit "\"$cc\" either does not exist or does not work"
12558d05095cSPaolo Bonzinifi
12568d05095cSPaolo Bonzini
1257417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror
1258417c9d72SAlexander Graf# by default.  Only enable by default for git builds
1259417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION`
1260417c9d72SAlexander Graf
1261417c9d72SAlexander Grafif test -z "$werror" ; then
12626c8fec83SAndreas Färber    if test -d "$source_path/.git" -a \
1263417c9d72SAlexander Graf        "$linux" = "yes" ; then
1264417c9d72SAlexander Graf        werror="yes"
1265417c9d72SAlexander Graf    else
1266417c9d72SAlexander Graf        werror="no"
1267417c9d72SAlexander Graf    fi
1268417c9d72SAlexander Graffi
1269417c9d72SAlexander Graf
12708d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
12718d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
12728d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
127337746c5eSMarc-André Lureaugcc_flags="-Wendif-labels $gcc_flags"
1274c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags"
127571429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags"
12766ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would
12776ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due
12786ca026cbSPeter Maydell# to -Werror this would just silently disable some features,
12796ca026cbSPeter Maydell# so it's too error prone.
12808d05095cSPaolo Bonzinicat > $TMPC << EOF
12818d05095cSPaolo Bonziniint main(void) { return 0; }
12828d05095cSPaolo BonziniEOF
12838d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1284a1d29d6cSPeter Maydell    # Use the positive sense of the flag when testing for -Wno-wombat
1285a1d29d6cSPeter Maydell    # support (gcc will happily accept the -Wno- form of unknown
1286a1d29d6cSPeter Maydell    # warning options).
1287a1d29d6cSPeter Maydell    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1288a1d29d6cSPeter Maydell    if compile_prog "-Werror $optflag" "" ; then
12898d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
12908d05095cSPaolo Bonzini    fi
12918d05095cSPaolo Bonzinidone
12928d05095cSPaolo Bonzini
129337746c5eSMarc-André Lureauif compile_prog "-Werror -fstack-protector-all" "" ; then
129437746c5eSMarc-André Lureau    QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
129537746c5eSMarc-André Lureau    LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
129637746c5eSMarc-André Lureaufi
129737746c5eSMarc-André Lureau
1298cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1299cbdd1999SPaolo Bonzini# large functions that use global variables.  The bug is in all releases of
1300cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1301cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1302cbdd1999SPaolo Bonzinicat > $TMPC << EOF
1303cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1304cbdd1999SPaolo Bonziniint main(void) { return 0; }
1305cbdd1999SPaolo Bonzini#else
1306cbdd1999SPaolo Bonzini#error No bug in this compiler.
1307cbdd1999SPaolo Bonzini#endif
1308cbdd1999SPaolo BonziniEOF
1309cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then
1310cbdd1999SPaolo Bonzini  TRANSLATE_OPT_CFLAGS=-fno-gcse
1311cbdd1999SPaolo Bonzinifi
1312cbdd1999SPaolo Bonzini
131340d6444eSAvi Kivityif test "$static" = "yes" ; then
131440d6444eSAvi Kivity  if test "$pie" = "yes" ; then
131576ad07a4SPeter Maydell    error_exit "static and pie are mutually incompatible"
131640d6444eSAvi Kivity  else
131740d6444eSAvi Kivity    pie="no"
131840d6444eSAvi Kivity  fi
131940d6444eSAvi Kivityfi
132040d6444eSAvi Kivity
132140d6444eSAvi Kivityif test "$pie" = ""; then
132240d6444eSAvi Kivity  case "$cpu-$targetos" in
1323c72b26ecSRichard Henderson    i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
132440d6444eSAvi Kivity      ;;
132540d6444eSAvi Kivity    *)
132640d6444eSAvi Kivity      pie="no"
132740d6444eSAvi Kivity      ;;
132840d6444eSAvi Kivity  esac
132940d6444eSAvi Kivityfi
133040d6444eSAvi Kivity
133140d6444eSAvi Kivityif test "$pie" != "no" ; then
133240d6444eSAvi Kivity  cat > $TMPC << EOF
133321d4a791SAvi Kivity
133421d4a791SAvi Kivity#ifdef __linux__
133521d4a791SAvi Kivity#  define THREAD __thread
133621d4a791SAvi Kivity#else
133721d4a791SAvi Kivity#  define THREAD
133821d4a791SAvi Kivity#endif
133921d4a791SAvi Kivity
134021d4a791SAvi Kivitystatic THREAD int tls_var;
134121d4a791SAvi Kivity
134221d4a791SAvi Kivityint main(void) { return tls_var; }
134321d4a791SAvi Kivity
134440d6444eSAvi KivityEOF
134540d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
134640d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
134740d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
134840d6444eSAvi Kivity    pie="yes"
134940d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
135040d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
135140d6444eSAvi Kivity    fi
135240d6444eSAvi Kivity  else
135340d6444eSAvi Kivity    if test "$pie" = "yes"; then
135476ad07a4SPeter Maydell      error_exit "PIE not available due to missing toolchain support"
135540d6444eSAvi Kivity    else
135640d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
135740d6444eSAvi Kivity      pie="no"
135840d6444eSAvi Kivity    fi
135940d6444eSAvi Kivity  fi
136040d6444eSAvi Kivityfi
136140d6444eSAvi Kivity
136209dada40SPaolo Bonzini##########################################
136309dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains
136409dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit
136509dada40SPaolo Bonzini# specification is necessary
136609dada40SPaolo Bonzini
136709dada40SPaolo Bonziniif test "$cpu" = "i386"; then
136809dada40SPaolo Bonzini  cat > $TMPC << EOF
136909dada40SPaolo Bonzinistatic int sfaa(int *ptr)
137009dada40SPaolo Bonzini{
137109dada40SPaolo Bonzini  return __sync_fetch_and_and(ptr, 0);
137209dada40SPaolo Bonzini}
137309dada40SPaolo Bonzini
137409dada40SPaolo Bonziniint main(void)
137509dada40SPaolo Bonzini{
137609dada40SPaolo Bonzini  int val = 42;
13771405b629SStefan Weil  val = __sync_val_compare_and_swap(&val, 0, 1);
137809dada40SPaolo Bonzini  sfaa(&val);
137909dada40SPaolo Bonzini  return val;
138009dada40SPaolo Bonzini}
138109dada40SPaolo BonziniEOF
138209dada40SPaolo Bonzini  if ! compile_prog "" "" ; then
138309dada40SPaolo Bonzini    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
138409dada40SPaolo Bonzini  fi
138509dada40SPaolo Bonzinifi
138609dada40SPaolo Bonzini
138709dada40SPaolo Bonzini#########################################
1388ec530c81Sbellard# Solaris specific configure tool chain decisions
138909dada40SPaolo Bonzini
1390ec530c81Sbellardif test "$solaris" = "yes" ; then
13916792aa11SLoïc Minier  if has $install; then
13926792aa11SLoïc Minier    :
13936792aa11SLoïc Minier  else
139476ad07a4SPeter Maydell    error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
139576ad07a4SPeter Maydell        "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
139676ad07a4SPeter Maydell        "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1397ec530c81Sbellard  fi
13986792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
139976ad07a4SPeter Maydell    error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
140076ad07a4SPeter Maydell        "try ginstall from the GNU fileutils available from www.blastwave.org" \
140176ad07a4SPeter Maydell        "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1402ec530c81Sbellard  fi
14036792aa11SLoïc Minier  if has ar; then
14046792aa11SLoïc Minier    :
14056792aa11SLoïc Minier  else
1406ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
140776ad07a4SPeter Maydell      error_exit "No path includes ar" \
140876ad07a4SPeter Maydell          "Add /usr/ccs/bin to your path and rerun configure"
1409ec530c81Sbellard    fi
141076ad07a4SPeter Maydell    error_exit "No path includes ar"
1411ec530c81Sbellard  fi
1412ec530c81Sbellardfi
1413ec530c81Sbellard
14147a3fc891SSebastian Herbsztif ! has $python; then
141576ad07a4SPeter Maydell  error_exit "Python not found. Use --python=/path/to/python"
1416c886edfbSBlue Swirlfi
1417c886edfbSBlue Swirl
14186ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
14196ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
14201d984a67SStefan Weilif ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
142176ad07a4SPeter Maydell  error_exit "Cannot use '$python', Python 2.4 or later is required." \
142276ad07a4SPeter Maydell      "Note that Python 3 or later is not yet supported." \
142376ad07a4SPeter Maydell      "Use --python=/path/to/python to specify a supported Python."
14246ccea1e4SPeter Maydellfi
14256ccea1e4SPeter Maydell
142652510f8bSStefan Weil# The -B switch was added in Python 2.6.
142752510f8bSStefan Weil# If it is supplied, compiled files are not written.
142852510f8bSStefan Weil# Use it for Python versions which support it.
142952510f8bSStefan Weilif $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
143052510f8bSStefan Weil  python="$python -B"
143152510f8bSStefan Weilfi
143252510f8bSStefan Weil
1433afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then
1434121afa9eSAnthony Liguori    target_list="$default_target_list"
1435121afa9eSAnthony Liguorielse
1436121afa9eSAnthony Liguori    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
14375327cf48Sbellardfi
143825b48338SPeter Maydell
143925b48338SPeter Maydell# Check that we recognised the target name; this allows a more
144025b48338SPeter Maydell# friendly error message than if we let it fall through.
144125b48338SPeter Maydellfor target in $target_list; do
144225b48338SPeter Maydell    case " $default_target_list " in
144325b48338SPeter Maydell        *" $target "*)
144425b48338SPeter Maydell            ;;
144525b48338SPeter Maydell        *)
144625b48338SPeter Maydell            error_exit "Unknown target name '$target'"
144725b48338SPeter Maydell            ;;
144825b48338SPeter Maydell    esac
144925b48338SPeter Maydelldone
145025b48338SPeter Maydell
1451f55fe278SPaolo Bonzini# see if system emulation was really requested
1452f55fe278SPaolo Bonzinicase " $target_list " in
1453f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1454f55fe278SPaolo Bonzini  ;;
1455f55fe278SPaolo Bonzini  *) softmmu=no
1456f55fe278SPaolo Bonzini  ;;
1457f55fe278SPaolo Bonziniesac
14585327cf48Sbellard
1459249247c9SJuan Quintelafeature_not_found() {
1460249247c9SJuan Quintela  feature=$1
1461249247c9SJuan Quintela
146276ad07a4SPeter Maydell  error_exit "User requested feature $feature" \
146376ad07a4SPeter Maydell      "configure was not able to find it"
1464249247c9SJuan Quintela}
1465249247c9SJuan Quintela
14667d13299dSbellard# ---
14677d13299dSbellard# big/little endian test
14687d13299dSbellardcat > $TMPC << EOF
146961cc919fSMike Frysingershort big_endian[] = { 0x4269, 0x4765, 0x4e64, 0x4961, 0x4e00, 0, };
147061cc919fSMike Frysingershort little_endian[] = { 0x694c, 0x7454, 0x654c, 0x6e45, 0x6944, 0x6e41, 0, };
147161cc919fSMike Frysingerextern int foo(short *, short *);
147261cc919fSMike Frysingerint main(int argc, char *argv[]) {
147361cc919fSMike Frysinger    return foo(big_endian, little_endian);
14747d13299dSbellard}
14757d13299dSbellardEOF
14767d13299dSbellard
147761cc919fSMike Frysingerif compile_object ; then
147861cc919fSMike Frysinger    if grep -q BiGeNdIaN $TMPO ; then
147961cc919fSMike Frysinger        bigendian="yes"
148061cc919fSMike Frysinger    elif grep -q LiTtLeEnDiAn $TMPO ; then
148161cc919fSMike Frysinger        bigendian="no"
14827d13299dSbellard    else
14837d13299dSbellard        echo big/little test failed
14847d13299dSbellard    fi
14857d13299dSbellardelse
148661cc919fSMike Frysinger    echo big/little test failed
14877d13299dSbellardfi
14887d13299dSbellard
1489b0a47e79SJuan Quintela##########################################
1490779ab5e3SStefan Weil# pkg-config probe
1491779ab5e3SStefan Weil
1492779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then
149376ad07a4SPeter Maydell  error_exit "pkg-config binary '$pkg_config_exe' not found"
1494779ab5e3SStefan Weilfi
1495779ab5e3SStefan Weil
1496779ab5e3SStefan Weil##########################################
1497b0a47e79SJuan Quintela# NPTL probe
1498b0a47e79SJuan Quintela
149924cb36a6SPeter Maydellif test "$linux_user" = "yes"; then
1500bd0c5661Spbrook  cat > $TMPC <<EOF
1501bd0c5661Spbrook#include <sched.h>
150230813ceaSpbrook#include <linux/futex.h>
1503182eacc0SStefan Weilint main(void) {
1504bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1505bd0c5661Spbrook#error bork
1506bd0c5661Spbrook#endif
1507182eacc0SStefan Weil  return 0;
1508bd0c5661Spbrook}
1509bd0c5661SpbrookEOF
151024cb36a6SPeter Maydell  if ! compile_object ; then
1511b0a47e79SJuan Quintela    feature_not_found "nptl"
1512b0a47e79SJuan Quintela  fi
1513bd0c5661Spbrookfi
1514bd0c5661Spbrook
151511d9f695Sbellard##########################################
1516ac62922eSbalrog# zlib check
1517ac62922eSbalrog
15181ece9905SAlon Levyif test "$zlib" != "no" ; then
1519ac62922eSbalrog    cat > $TMPC << EOF
1520ac62922eSbalrog#include <zlib.h>
1521ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1522ac62922eSbalrogEOF
152352166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1524ac62922eSbalrog        :
1525ac62922eSbalrog    else
152676ad07a4SPeter Maydell        error_exit "zlib check failed" \
152776ad07a4SPeter Maydell            "Make sure to have the zlib libs and headers installed."
1528ac62922eSbalrog    fi
15291ece9905SAlon Levyfi
1530f544a488SPaolo Bonzinilibs_softmmu="$libs_softmmu -lz"
1531ac62922eSbalrog
1532ac62922eSbalrog##########################################
1533f794573eSEduardo Otubo# libseccomp check
1534f794573eSEduardo Otubo
1535f794573eSEduardo Otuboif test "$seccomp" != "no" ; then
153665d5d3f9SStefan Weil    if $pkg_config --atleast-version=2.1.0 libseccomp; then
1537b4451996SMichael Tokarev        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1538372e47e9SAndreas Färber        QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1539f794573eSEduardo Otubo	seccomp="yes"
1540f794573eSEduardo Otubo    else
1541f794573eSEduardo Otubo	if test "$seccomp" = "yes"; then
1542f794573eSEduardo Otubo            feature_not_found "libseccomp"
1543f794573eSEduardo Otubo	fi
1544e84d5956SYann E. MORIN	seccomp="no"
1545f794573eSEduardo Otubo    fi
1546f794573eSEduardo Otubofi
1547f794573eSEduardo Otubo##########################################
1548e37630caSaliguori# xen probe
1549e37630caSaliguori
1550fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1551b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1552d5b93ddfSAnthony PERARD
155350ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
155450ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
155550ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
155650ced5b3SStefan Weil
155750ced5b3SStefan Weil  # Xen (any)
155850ced5b3SStefan Weil  cat > $TMPC <<EOF
155950ced5b3SStefan Weil#include <xenctrl.h>
156050ced5b3SStefan Weilint main(void) {
156150ced5b3SStefan Weil  return 0;
156250ced5b3SStefan Weil}
156350ced5b3SStefan WeilEOF
156450ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
156550ced5b3SStefan Weil    # Xen not found
156650ced5b3SStefan Weil    if test "$xen" = "yes" ; then
156750ced5b3SStefan Weil      feature_not_found "xen"
156850ced5b3SStefan Weil    fi
156950ced5b3SStefan Weil    xen=no
157050ced5b3SStefan Weil
1571d5b93ddfSAnthony PERARD  # Xen unstable
157269deef08SPeter Maydell  elif
157369deef08SPeter Maydell      cat > $TMPC <<EOF &&
1574e37630caSaliguori#include <xenctrl.h>
1575e108a3c1SAnthony PERARD#include <xenstore.h>
1576d5b93ddfSAnthony PERARD#include <stdint.h>
1577d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1578d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1579d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1580d5b93ddfSAnthony PERARD#endif
1581d5b93ddfSAnthony PERARDint main(void) {
1582d5b93ddfSAnthony PERARD  xc_interface *xc;
1583d5b93ddfSAnthony PERARD  xs_daemon_open();
1584d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1585d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1586d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1587b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
15888688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
15898688e065SStefano Stabellini  return 0;
15908688e065SStefano Stabellini}
15918688e065SStefano StabelliniEOF
15928688e065SStefano Stabellini      compile_prog "" "$xen_libs"
159369deef08SPeter Maydell    then
15948688e065SStefano Stabellini    xen_ctrl_version=420
15958688e065SStefano Stabellini    xen=yes
15968688e065SStefano Stabellini
159769deef08SPeter Maydell  elif
159869deef08SPeter Maydell      cat > $TMPC <<EOF &&
15998688e065SStefano Stabellini#include <xenctrl.h>
16008688e065SStefano Stabellini#include <xs.h>
16018688e065SStefano Stabellini#include <stdint.h>
16028688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
16038688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
16048688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
16058688e065SStefano Stabellini#endif
16068688e065SStefano Stabelliniint main(void) {
16078688e065SStefano Stabellini  xs_daemon_open();
16089b4c0b56SPeter Maydell  xc_interface_open(0, 0, 0);
16098688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
16108688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
16118688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1612d5b93ddfSAnthony PERARD  return 0;
1613d5b93ddfSAnthony PERARD}
1614e37630caSaliguoriEOF
161550ced5b3SStefan Weil      compile_prog "" "$xen_libs"
161669deef08SPeter Maydell    then
1617d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1618fc321b4bSJuan Quintela    xen=yes
1619d5b93ddfSAnthony PERARD
1620d5b93ddfSAnthony PERARD  # Xen 4.0.0
162169deef08SPeter Maydell  elif
162269deef08SPeter Maydell      cat > $TMPC <<EOF &&
1623d5b93ddfSAnthony PERARD#include <xenctrl.h>
1624d5b93ddfSAnthony PERARD#include <xs.h>
1625d5b93ddfSAnthony PERARD#include <stdint.h>
1626d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1627d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1628d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1629d5b93ddfSAnthony PERARD#endif
1630d5b93ddfSAnthony PERARDint main(void) {
1631b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1632b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1633b87de24eSAnthony PERARD  };
1634d5b93ddfSAnthony PERARD  xs_daemon_open();
1635d5b93ddfSAnthony PERARD  xc_interface_open();
1636d5b93ddfSAnthony PERARD  xc_gnttab_open();
1637d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1638b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1639d5b93ddfSAnthony PERARD  return 0;
1640d5b93ddfSAnthony PERARD}
1641d5b93ddfSAnthony PERARDEOF
1642d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
164369deef08SPeter Maydell    then
1644d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1645d5b93ddfSAnthony PERARD    xen=yes
1646d5b93ddfSAnthony PERARD
1647b87de24eSAnthony PERARD  # Xen 3.4.0
164869deef08SPeter Maydell  elif
164969deef08SPeter Maydell      cat > $TMPC <<EOF &&
1650b87de24eSAnthony PERARD#include <xenctrl.h>
1651b87de24eSAnthony PERARD#include <xs.h>
1652b87de24eSAnthony PERARDint main(void) {
1653b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1654b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1655b87de24eSAnthony PERARD  };
1656b87de24eSAnthony PERARD  xs_daemon_open();
1657b87de24eSAnthony PERARD  xc_interface_open();
1658b87de24eSAnthony PERARD  xc_gnttab_open();
1659b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1660b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1661b87de24eSAnthony PERARD  return 0;
1662b87de24eSAnthony PERARD}
1663b87de24eSAnthony PERARDEOF
1664b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
166569deef08SPeter Maydell    then
1666b87de24eSAnthony PERARD    xen_ctrl_version=340
1667b87de24eSAnthony PERARD    xen=yes
1668b87de24eSAnthony PERARD
1669b87de24eSAnthony PERARD  # Xen 3.3.0
167069deef08SPeter Maydell  elif
167169deef08SPeter Maydell      cat > $TMPC <<EOF &&
1672d5b93ddfSAnthony PERARD#include <xenctrl.h>
1673d5b93ddfSAnthony PERARD#include <xs.h>
1674d5b93ddfSAnthony PERARDint main(void) {
1675d5b93ddfSAnthony PERARD  xs_daemon_open();
1676d5b93ddfSAnthony PERARD  xc_interface_open();
1677d5b93ddfSAnthony PERARD  xc_gnttab_open();
1678d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1679d5b93ddfSAnthony PERARD  return 0;
1680d5b93ddfSAnthony PERARD}
1681d5b93ddfSAnthony PERARDEOF
1682d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
168369deef08SPeter Maydell    then
1684d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1685d5b93ddfSAnthony PERARD    xen=yes
1686d5b93ddfSAnthony PERARD
168750ced5b3SStefan Weil  # Xen version unsupported
1688e37630caSaliguori  else
1689fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
169050ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1691fc321b4bSJuan Quintela    fi
1692fc321b4bSJuan Quintela    xen=no
1693e37630caSaliguori  fi
1694d5b93ddfSAnthony PERARD
1695d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1696d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1697d5b93ddfSAnthony PERARD  fi
1698e37630caSaliguorifi
1699e37630caSaliguori
1700eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1701eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1702eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1703eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1704eb6fda0fSAnthony PERARD  else
1705eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1706eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
170776ad07a4SPeter Maydell        error_exit "User requested feature Xen PCI Passthrough" \
170876ad07a4SPeter Maydell            "This feature does not work with Xen 3.3"
1709eb6fda0fSAnthony PERARD      fi
171076ad07a4SPeter Maydell      error_exit "User requested feature Xen PCI Passthrough" \
171176ad07a4SPeter Maydell          " but this feature requires /sys from Linux"
1712eb6fda0fSAnthony PERARD    fi
1713eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1714eb6fda0fSAnthony PERARD  fi
1715eb6fda0fSAnthony PERARDfi
1716eb6fda0fSAnthony PERARD
1717e37630caSaliguori##########################################
171844dc0ca3SAlon Levy# libtool probe
171944dc0ca3SAlon Levy
17203f534581SBradif ! has $libtool; then
172144dc0ca3SAlon Levy    libtool=
172244dc0ca3SAlon Levyfi
172344dc0ca3SAlon Levy
17248e515b12SPeter Maydell# MacOSX ships with a libtool which isn't the GNU one; weed this
17258e515b12SPeter Maydell# out by checking whether libtool supports the --version switch
17268e515b12SPeter Maydellif test -n "$libtool"; then
17278e515b12SPeter Maydell  if ! "$libtool" --version >/dev/null 2>&1; then
17288e515b12SPeter Maydell    libtool=
17298e515b12SPeter Maydell  fi
17308e515b12SPeter Maydellfi
17318e515b12SPeter Maydell
173244dc0ca3SAlon Levy##########################################
1733dfffc653SJuan Quintela# Sparse probe
1734dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
17350dba6195SLoïc Minier  if has cgcc; then
1736dfffc653SJuan Quintela    sparse=yes
1737dfffc653SJuan Quintela  else
1738dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1739dfffc653SJuan Quintela      feature_not_found "sparse"
1740dfffc653SJuan Quintela    fi
1741dfffc653SJuan Quintela    sparse=no
1742dfffc653SJuan Quintela  fi
1743dfffc653SJuan Quintelafi
1744dfffc653SJuan Quintela
1745dfffc653SJuan Quintela##########################################
1746a4ccabcfSAnthony Liguori# GTK probe
1747a4ccabcfSAnthony Liguori
1748a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then
1749528de90aSDaniel P. Berrange    gtkpackage="gtk+-$gtkabi"
1750528de90aSDaniel P. Berrange    if test "$gtkabi" = "3.0" ; then
1751528de90aSDaniel P. Berrange      gtkversion="3.0.0"
1752528de90aSDaniel P. Berrange      vtepackage="vte-2.90"
1753528de90aSDaniel P. Berrange      vteversion="0.32.0"
1754528de90aSDaniel P. Berrange    else
1755528de90aSDaniel P. Berrange      gtkversion="2.18.0"
1756528de90aSDaniel P. Berrange      vtepackage="vte"
1757528de90aSDaniel P. Berrange      vteversion="0.24.0"
1758528de90aSDaniel P. Berrange    fi
17590d185e63SPeter Maydell    if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
17600d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17610d185e63SPeter Maydell            feature_not_found "gtk"
17620d185e63SPeter Maydell        fi
17630d185e63SPeter Maydell        gtk="no"
17640d185e63SPeter Maydell    elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
17650d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17660d185e63SPeter Maydell            error_exit "libvte not found (required for gtk support)"
17670d185e63SPeter Maydell        fi
17680d185e63SPeter Maydell        gtk="no"
17690d185e63SPeter Maydell    else
1770ca871ec8SStefan Weil	gtk_cflags=`$pkg_config --cflags $gtkpackage`
1771ca871ec8SStefan Weil	gtk_libs=`$pkg_config --libs $gtkpackage`
1772ca871ec8SStefan Weil	vte_cflags=`$pkg_config --cflags $vtepackage`
1773ca871ec8SStefan Weil	vte_libs=`$pkg_config --libs $vtepackage`
1774a4ccabcfSAnthony Liguori	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1775a4ccabcfSAnthony Liguori	gtk="yes"
1776a4ccabcfSAnthony Liguori    fi
1777a4ccabcfSAnthony Liguorifi
1778a4ccabcfSAnthony Liguori
1779a4ccabcfSAnthony Liguori##########################################
178011d9f695Sbellard# SDL probe
178111d9f695Sbellard
17823ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
17833ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
17843ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
17853ec87ffeSPaolo Bonzini  sdl_config=sdl-config
17863ec87ffeSPaolo Bonzinifi
17873ec87ffeSPaolo Bonzini
178865d5d3f9SStefan Weilif $pkg_config sdl --exists; then
1789a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1790fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
17913ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
17923ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
17939316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1794a0dfd8a4SLoïc Minierelse
1795a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1796a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1797a0dfd8a4SLoïc Minier  fi
1798a0dfd8a4SLoïc Minier  sdl=no
17999316f803SPaolo Bonzinifi
180029e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
18013ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
18023ec87ffeSPaolo Bonzinifi
180311d9f695Sbellard
18049316f803SPaolo Bonzinisdl_too_old=no
1805c4198157SJuan Quintelaif test "$sdl" != "no" ; then
180611d9f695Sbellard  cat > $TMPC << EOF
180711d9f695Sbellard#include <SDL.h>
180811d9f695Sbellard#undef main /* We don't want SDL to override our main() */
180911d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
181011d9f695SbellardEOF
18119316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
181274f42e18STeLeMan  if test "$static" = "yes" ; then
181374f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
181474f42e18STeLeMan  else
18159316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
181674f42e18STeLeMan  fi
181752166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
181811d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
181911d9f695Sbellard      sdl_too_old=yes
182011d9f695Sbellard    else
1821fd677642Sths      if test "$cocoa" = "no" ; then
182211d9f695Sbellard        sdl=yes
182311d9f695Sbellard      fi
1824fd677642Sths    fi
18257c1f25b4Sbellard
182667c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
18271ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
182867c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1829f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1830f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
183111d9f695Sbellard      fi
183252166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
18331ac88f28SJuan Quintela	:
18341ac88f28SJuan Quintela      else
18351ac88f28SJuan Quintela        sdl=no
18367c1f25b4Sbellard      fi
18377c1f25b4Sbellard    fi # static link
1838c4198157SJuan Quintela  else # sdl not found
1839c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1840c4198157SJuan Quintela      feature_not_found "sdl"
1841c4198157SJuan Quintela    fi
1842c4198157SJuan Quintela    sdl=no
18437c1f25b4Sbellard  fi # sdl compile test
1844fd677642Sthsfi
184511d9f695Sbellard
18465368a422Saliguoriif test "$sdl" = "yes" ; then
18475368a422Saliguori  cat > $TMPC <<EOF
18485368a422Saliguori#include <SDL.h>
18495368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
18505368a422Saliguori#include <X11/XKBlib.h>
18515368a422Saliguori#else
18525368a422Saliguori#error No x11 support
18535368a422Saliguori#endif
18545368a422Saliguoriint main(void) { return 0; }
18555368a422SaliguoriEOF
185652166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1857681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
18585368a422Saliguori  fi
18590705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
18605368a422Saliguorifi
18615368a422Saliguori
18628f28f3fbSths##########################################
18632da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries
18642da776dbSMichael R. Hinesif test "$rdma" != "no" ; then
18652da776dbSMichael R. Hines  cat > $TMPC <<EOF
18662da776dbSMichael R. Hines#include <rdma/rdma_cma.h>
18672da776dbSMichael R. Hinesint main(void) { return 0; }
18682da776dbSMichael R. HinesEOF
18692da776dbSMichael R. Hines  rdma_libs="-lrdmacm -libverbs"
18702da776dbSMichael R. Hines  if compile_prog "" "$rdma_libs" ; then
18712da776dbSMichael R. Hines    rdma="yes"
18722da776dbSMichael R. Hines    libs_softmmu="$libs_softmmu $rdma_libs"
18732da776dbSMichael R. Hines  else
18742da776dbSMichael R. Hines    if test "$rdma" = "yes" ; then
18752da776dbSMichael R. Hines        error_exit \
18762da776dbSMichael R. Hines            " OpenFabrics librdmacm/libibverbs not present." \
18772da776dbSMichael R. Hines            " Your options:" \
18782da776dbSMichael R. Hines            "  (1) Fast: Install infiniband packages from your distro." \
18792da776dbSMichael R. Hines            "  (2) Cleanest: Install libraries from www.openfabrics.org" \
18802da776dbSMichael R. Hines            "  (3) Also: Install softiwarp if you don't have RDMA hardware"
18812da776dbSMichael R. Hines    fi
18822da776dbSMichael R. Hines    rdma="no"
18832da776dbSMichael R. Hines  fi
18842da776dbSMichael R. Hinesfi
18852da776dbSMichael R. Hines
18862da776dbSMichael R. Hines##########################################
18877536ee4bSTim Hardeck# VNC TLS/WS detection
18887536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
1889ae6b5e5aSaliguori  cat > $TMPC <<EOF
1890ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1891ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1892ae6b5e5aSaliguoriEOF
1893a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1894a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
189552166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
18967536ee4bSTim Hardeck    if test "$vnc_tls" != "no" ; then
18971be10ad2SJuan Quintela      vnc_tls=yes
18987536ee4bSTim Hardeck    fi
18997536ee4bSTim Hardeck    if test "$vnc_ws" != "no" ; then
19007536ee4bSTim Hardeck      vnc_ws=yes
19017536ee4bSTim Hardeck    fi
1902a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1903ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
1904ae6b5e5aSaliguori  else
19051be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
19061be10ad2SJuan Quintela      feature_not_found "vnc-tls"
19071be10ad2SJuan Quintela    fi
19087536ee4bSTim Hardeck    if test "$vnc_ws" = "yes" ; then
19097536ee4bSTim Hardeck      feature_not_found "vnc-ws"
19107536ee4bSTim Hardeck    fi
19111be10ad2SJuan Quintela    vnc_tls=no
19127536ee4bSTim Hardeck    vnc_ws=no
19138d5d2d4cSths  fi
19148d5d2d4cSthsfi
19158d5d2d4cSths
19168d5d2d4cSths##########################################
19172f9606b3Saliguori# VNC SASL detection
1918821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
19192f9606b3Saliguori  cat > $TMPC <<EOF
19202f9606b3Saliguori#include <sasl/sasl.h>
19212f9606b3Saliguori#include <stdio.h>
19222f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
19232f9606b3SaliguoriEOF
19242f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
19252f9606b3Saliguori  vnc_sasl_cflags=""
19262f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
192752166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1928ea784e3bSJuan Quintela    vnc_sasl=yes
1929fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1930ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
19312f9606b3Saliguori  else
1932ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1933ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1934ea784e3bSJuan Quintela    fi
1935ea784e3bSJuan Quintela    vnc_sasl=no
19362f9606b3Saliguori  fi
19372f9606b3Saliguorifi
19382f9606b3Saliguori
19392f9606b3Saliguori##########################################
19402f6f5c7aSCorentin Chary# VNC JPEG detection
1941821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
19422f6f5c7aSCorentin Charycat > $TMPC <<EOF
19432f6f5c7aSCorentin Chary#include <stdio.h>
19442f6f5c7aSCorentin Chary#include <jpeglib.h>
19452f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
19462f6f5c7aSCorentin CharyEOF
19472f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
19482f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
19492f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
19502f6f5c7aSCorentin Chary    vnc_jpeg=yes
19512f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1952ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
19532f6f5c7aSCorentin Chary  else
19542f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
19552f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
19562f6f5c7aSCorentin Chary    fi
19572f6f5c7aSCorentin Chary    vnc_jpeg=no
19582f6f5c7aSCorentin Chary  fi
19592f6f5c7aSCorentin Charyfi
19602f6f5c7aSCorentin Chary
19612f6f5c7aSCorentin Chary##########################################
1962efe556adSCorentin Chary# VNC PNG detection
1963821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1964efe556adSCorentin Charycat > $TMPC <<EOF
1965efe556adSCorentin Chary//#include <stdio.h>
1966efe556adSCorentin Chary#include <png.h>
1967832ce9c2SScott Wood#include <stddef.h>
1968efe556adSCorentin Charyint main(void) {
1969efe556adSCorentin Chary    png_structp png_ptr;
1970efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
19717edc3fedSPeter Maydell    return png_ptr != 0;
1972efe556adSCorentin Chary}
1973efe556adSCorentin CharyEOF
197465d5d3f9SStefan Weil  if $pkg_config libpng --exists; then
1975ca871ec8SStefan Weil    vnc_png_cflags=`$pkg_config libpng --cflags`
1976ca871ec8SStefan Weil    vnc_png_libs=`$pkg_config libpng --libs`
19779af8025eSBrad  else
1978efe556adSCorentin Chary    vnc_png_cflags=""
1979efe556adSCorentin Chary    vnc_png_libs="-lpng"
19809af8025eSBrad  fi
1981efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1982efe556adSCorentin Chary    vnc_png=yes
1983efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
19849af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1985efe556adSCorentin Chary  else
1986efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1987efe556adSCorentin Chary      feature_not_found "vnc-png"
1988efe556adSCorentin Chary    fi
1989efe556adSCorentin Chary    vnc_png=no
1990efe556adSCorentin Chary  fi
1991efe556adSCorentin Charyfi
1992efe556adSCorentin Chary
1993efe556adSCorentin Chary##########################################
199476655d6dSaliguori# fnmatch() probe, used for ACL routines
199576655d6dSaliguorifnmatch="no"
199676655d6dSaliguoricat > $TMPC << EOF
199776655d6dSaliguori#include <fnmatch.h>
199876655d6dSaliguoriint main(void)
199976655d6dSaliguori{
200076655d6dSaliguori    fnmatch("foo", "foo", 0);
200176655d6dSaliguori    return 0;
200276655d6dSaliguori}
200376655d6dSaliguoriEOF
200452166aa0SJuan Quintelaif compile_prog "" "" ; then
200576655d6dSaliguori   fnmatch="yes"
200676655d6dSaliguorifi
200776655d6dSaliguori
200876655d6dSaliguori##########################################
2009ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
20102d16c8e9SPeter Maydell# Note that on some systems (notably MacOSX) no extra library
20112d16c8e9SPeter Maydell# need be linked to get the uuid functions.
2012ee682d27SStefan Weilif test "$uuid" != "no" ; then
2013ee682d27SStefan Weil  uuid_libs="-luuid"
2014ee682d27SStefan Weil  cat > $TMPC << EOF
2015ee682d27SStefan Weil#include <uuid/uuid.h>
2016ee682d27SStefan Weilint main(void)
2017ee682d27SStefan Weil{
2018ee682d27SStefan Weil    uuid_t my_uuid;
2019ee682d27SStefan Weil    uuid_generate(my_uuid);
2020ee682d27SStefan Weil    return 0;
2021ee682d27SStefan Weil}
2022ee682d27SStefan WeilEOF
20232d16c8e9SPeter Maydell  if compile_prog "" "" ; then
20242d16c8e9SPeter Maydell    uuid="yes"
20252d16c8e9SPeter Maydell  elif compile_prog "" "$uuid_libs" ; then
2026ee682d27SStefan Weil    uuid="yes"
2027ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
2028ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
2029ee682d27SStefan Weil  else
2030ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
2031ee682d27SStefan Weil      feature_not_found "uuid"
2032ee682d27SStefan Weil    fi
2033ee682d27SStefan Weil    uuid=no
2034ee682d27SStefan Weil  fi
2035ee682d27SStefan Weilfi
2036ee682d27SStefan Weil
20374f18b782SJeff Codyif test "$vhdx" = "yes" ; then
20384f18b782SJeff Cody    if test "$uuid" = "no" ; then
20394f18b782SJeff Cody        error_exit "uuid required for VHDX support"
20404f18b782SJeff Cody    fi
20414f18b782SJeff Codyelif test "$vhdx" != "no" ; then
20424f18b782SJeff Cody    if test "$uuid" = "yes" ; then
20434f18b782SJeff Cody        vhdx=yes
20444f18b782SJeff Cody    else
20454f18b782SJeff Cody        vhdx=no
20464f18b782SJeff Cody    fi
20474f18b782SJeff Codyfi
20484f18b782SJeff Cody
2049ee682d27SStefan Weil##########################################
2050dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
2051dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
2052dce512deSChristoph Hellwig  cat > $TMPC << EOF
2053ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
2054dce512deSChristoph Hellwig#include <xfs/xfs.h>
2055dce512deSChristoph Hellwigint main(void)
2056dce512deSChristoph Hellwig{
2057dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
2058dce512deSChristoph Hellwig    return 0;
2059dce512deSChristoph Hellwig}
2060dce512deSChristoph HellwigEOF
2061dce512deSChristoph Hellwig  if compile_prog "" "" ; then
2062dce512deSChristoph Hellwig    xfs="yes"
2063dce512deSChristoph Hellwig  else
2064dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
2065dce512deSChristoph Hellwig      feature_not_found "xfs"
2066dce512deSChristoph Hellwig    fi
2067dce512deSChristoph Hellwig    xfs=no
2068dce512deSChristoph Hellwig  fi
2069dce512deSChristoph Hellwigfi
2070dce512deSChristoph Hellwig
2071dce512deSChristoph Hellwig##########################################
20728a16d273Sths# vde libraries probe
2073dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
20744baae0acSJuan Quintela  vde_libs="-lvdeplug"
20758a16d273Sths  cat > $TMPC << EOF
20768a16d273Sths#include <libvdeplug.h>
20774a7f0e06Spbrookint main(void)
20784a7f0e06Spbrook{
20794a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
2080fea08e08SPeter Maydell    char s[] = "";
2081fea08e08SPeter Maydell    vde_open(s, s, &a);
20824a7f0e06Spbrook    return 0;
20834a7f0e06Spbrook}
20848a16d273SthsEOF
208552166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
20864baae0acSJuan Quintela    vde=yes
20878e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
20888e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
2089dfb278bdSJuan Quintela  else
2090dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
2091dfb278bdSJuan Quintela      feature_not_found "vde"
2092dfb278bdSJuan Quintela    fi
2093dfb278bdSJuan Quintela    vde=no
20948a16d273Sths  fi
20958a16d273Sthsfi
20968a16d273Sths
20978a16d273Sths##########################################
209847e98658SCorey Bryant# libcap-ng library probe
209947e98658SCorey Bryantif test "$cap_ng" != "no" ; then
210047e98658SCorey Bryant  cap_libs="-lcap-ng"
210147e98658SCorey Bryant  cat > $TMPC << EOF
210247e98658SCorey Bryant#include <cap-ng.h>
210347e98658SCorey Bryantint main(void)
210447e98658SCorey Bryant{
210547e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
210647e98658SCorey Bryant    return 0;
210747e98658SCorey Bryant}
210847e98658SCorey BryantEOF
210947e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
211047e98658SCorey Bryant    cap_ng=yes
211147e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
211247e98658SCorey Bryant  else
211347e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
211447e98658SCorey Bryant      feature_not_found "cap_ng"
211547e98658SCorey Bryant    fi
211647e98658SCorey Bryant    cap_ng=no
211747e98658SCorey Bryant  fi
211847e98658SCorey Bryantfi
211947e98658SCorey Bryant
212047e98658SCorey Bryant##########################################
2121c2de5c91Smalc# Sound support libraries probe
21228f28f3fbSths
2123c2de5c91Smalcaudio_drv_probe()
2124c2de5c91Smalc{
2125c2de5c91Smalc    drv=$1
2126c2de5c91Smalc    hdr=$2
2127c2de5c91Smalc    lib=$3
2128c2de5c91Smalc    exp=$4
2129c2de5c91Smalc    cfl=$5
21308f28f3fbSths        cat > $TMPC << EOF
2131c2de5c91Smalc#include <$hdr>
2132c2de5c91Smalcint main(void) { $exp }
21338f28f3fbSthsEOF
213452166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
21358f28f3fbSths        :
21368f28f3fbSths    else
213776ad07a4SPeter Maydell        error_exit "$drv check failed" \
213876ad07a4SPeter Maydell            "Make sure to have the $drv libs and headers installed."
21398f28f3fbSths    fi
2140c2de5c91Smalc}
2141c2de5c91Smalc
21422fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2143c2de5c91Smalcfor drv in $audio_drv_list; do
2144c2de5c91Smalc    case $drv in
2145c2de5c91Smalc    alsa)
2146c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
2147e35bcb0cSStefan Weil        "return snd_pcm_close((snd_pcm_t *)0);"
2148a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
2149c2de5c91Smalc    ;;
2150c2de5c91Smalc
2151c2de5c91Smalc    fmod)
2152c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
215376ad07a4SPeter Maydell        error_exit "You must specify path to FMOD library and headers" \
215476ad07a4SPeter Maydell            "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
21558f28f3fbSths    fi
2156c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2157a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
2158c2de5c91Smalc    ;;
2159c2de5c91Smalc
2160c2de5c91Smalc    esd)
2161c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2162a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
216367f86e8eSJuan Quintela    audio_pt_int="yes"
2164c2de5c91Smalc    ;;
2165b8e59f18Smalc
2166b8e59f18Smalc    pa)
2167a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2168a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2169a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
217067f86e8eSJuan Quintela    audio_pt_int="yes"
2171b8e59f18Smalc    ;;
2172b8e59f18Smalc
2173997e690aSJuan Quintela    coreaudio)
2174997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
2175997e690aSJuan Quintela    ;;
2176997e690aSJuan Quintela
2177a4bf6780SJuan Quintela    dsound)
2178a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2179d5631638Smalc      audio_win_int="yes"
2180a4bf6780SJuan Quintela    ;;
2181a4bf6780SJuan Quintela
2182a4bf6780SJuan Quintela    oss)
2183a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
2184a4bf6780SJuan Quintela    ;;
2185a4bf6780SJuan Quintela
2186a4bf6780SJuan Quintela    sdl|wav)
21872f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
21882f6a1ab0Sblueswir1    ;;
21892f6a1ab0Sblueswir1
2190d5631638Smalc    winwave)
2191d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
2192d5631638Smalc      audio_win_int="yes"
2193d5631638Smalc    ;;
2194d5631638Smalc
2195e4c63a6aSmalc    *)
21961c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
219776ad07a4SPeter Maydell        error_exit "Unknown driver '$drv' selected" \
219876ad07a4SPeter Maydell            "Possible drivers are: $audio_possible_drivers"
2199e4c63a6aSmalc    }
2200e4c63a6aSmalc    ;;
2201c2de5c91Smalc    esac
2202c2de5c91Smalcdone
22038f28f3fbSths
22044d3b6f6eSbalrog##########################################
22052e4d9fb1Saurel32# BrlAPI probe
22062e4d9fb1Saurel32
22074ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
2208eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
22092e4d9fb1Saurel32  cat > $TMPC << EOF
22102e4d9fb1Saurel32#include <brlapi.h>
2211832ce9c2SScott Wood#include <stddef.h>
22122e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
22132e4d9fb1Saurel32EOF
221452166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
22152e4d9fb1Saurel32    brlapi=yes
2216264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
22174ffcedb6SJuan Quintela  else
22184ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
22194ffcedb6SJuan Quintela      feature_not_found "brlapi"
22204ffcedb6SJuan Quintela    fi
22214ffcedb6SJuan Quintela    brlapi=no
2222eb82284fSJuan Quintela  fi
2223eb82284fSJuan Quintelafi
22242e4d9fb1Saurel32
22252e4d9fb1Saurel32##########################################
22264d3b6f6eSbalrog# curses probe
2227a3605bf6SMichael Tokarevif test "$curses" != "no" ; then
2228e095e2f3SStefan Weil  if test "$mingw32" = "yes" ; then
2229e095e2f3SStefan Weil    curses_list="-lpdcurses"
2230e095e2f3SStefan Weil  else
2231cfeda5f4SEd Maste    curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2232e095e2f3SStefan Weil  fi
2233c584a6d0SJuan Quintela  curses_found=no
22344d3b6f6eSbalrog  cat > $TMPC << EOF
22354d3b6f6eSbalrog#include <curses.h>
2236ef9a2524SStefan Weilint main(void) {
2237ef9a2524SStefan Weil  const char *s = curses_version();
2238ef9a2524SStefan Weil  resize_term(0, 0);
2239ef9a2524SStefan Weil  return s != 0;
2240ef9a2524SStefan Weil}
22414d3b6f6eSbalrogEOF
2242ecbe251fSVadim Evard  IFS=:
22434f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
2244ecbe251fSVadim Evard    unset IFS
22454f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
2246c584a6d0SJuan Quintela      curses_found=yes
22474f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
22484f78ef9aSJuan Quintela      break
22494d3b6f6eSbalrog    fi
22504f78ef9aSJuan Quintela  done
2251ecbe251fSVadim Evard  unset IFS
2252c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
2253c584a6d0SJuan Quintela    curses=yes
2254c584a6d0SJuan Quintela  else
2255c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
2256c584a6d0SJuan Quintela      feature_not_found "curses"
2257c584a6d0SJuan Quintela    fi
2258c584a6d0SJuan Quintela    curses=no
2259c584a6d0SJuan Quintela  fi
22604f78ef9aSJuan Quintelafi
22614d3b6f6eSbalrog
2262414f0dabSblueswir1##########################################
2263769ce76dSAlexander Graf# curl probe
2264a3605bf6SMichael Tokarevif test "$curl" != "no" ; then
226565d5d3f9SStefan Weil  if $pkg_config libcurl --exists; then
2266a8bd70adSPaolo Bonzini    curlconfig="$pkg_config libcurl"
22674e2b0658SPaolo Bonzini  else
22684e2b0658SPaolo Bonzini    curlconfig=curl-config
22694e2b0658SPaolo Bonzini  fi
2270769ce76dSAlexander Graf  cat > $TMPC << EOF
2271769ce76dSAlexander Graf#include <curl/curl.h>
22720b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2273769ce76dSAlexander GrafEOF
22744e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
22754e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2276b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2277769ce76dSAlexander Graf    curl=yes
2278f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2279f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2280788c8196SJuan Quintela  else
2281788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2282788c8196SJuan Quintela      feature_not_found "curl"
2283788c8196SJuan Quintela    fi
2284788c8196SJuan Quintela    curl=no
2285769ce76dSAlexander Graf  fi
2286769ce76dSAlexander Graffi # test "$curl"
2287769ce76dSAlexander Graf
2288769ce76dSAlexander Graf##########################################
2289fb599c9aSbalrog# bluez support probe
2290a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2291e820e3f4Sbalrog  cat > $TMPC << EOF
2292e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2293e820e3f4Sbalrogint main(void) { return bt_error(0); }
2294e820e3f4SbalrogEOF
2295a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2296a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
229752166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2298a20a6f46SJuan Quintela    bluez=yes
2299e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2300e820e3f4Sbalrog  else
2301a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2302a20a6f46SJuan Quintela      feature_not_found "bluez"
2303a20a6f46SJuan Quintela    fi
2304e820e3f4Sbalrog    bluez="no"
2305e820e3f4Sbalrog  fi
2306fb599c9aSbalrogfi
2307fb599c9aSbalrog
2308fb599c9aSbalrog##########################################
2309e18df141SAnthony Liguori# glib support probe
2310a52d28afSPaolo Bonzini
2311a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2312a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2313a52d28afSPaolo Bonzini    glib_req_ver=2.20
2314a52d28afSPaolo Bonzinielse
2315a52d28afSPaolo Bonzini    glib_req_ver=2.12
2316a52d28afSPaolo Bonzinifi
231765d5d3f9SStefan Weilif $pkg_config --atleast-version=$glib_req_ver gthread-2.0; then
2318ca871ec8SStefan Weil    glib_cflags=`$pkg_config --cflags gthread-2.0`
2319ca871ec8SStefan Weil    glib_libs=`$pkg_config --libs gthread-2.0`
232014015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2321957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2322e18df141SAnthony Liguorielse
232376ad07a4SPeter Maydell    error_exit "glib-$glib_req_ver required to compile QEMU"
2324e18df141SAnthony Liguorifi
2325e18df141SAnthony Liguori
2326e18df141SAnthony Liguori##########################################
2327e2134eb9SGerd Hoffmann# pixman support probe
2328e2134eb9SGerd Hoffmann
2329e2134eb9SGerd Hoffmannif test "$pixman" = ""; then
233074880fe2SRobert Schiele  if test "$want_tools" = "no" -a "$softmmu" = "no"; then
233174880fe2SRobert Schiele    pixman="none"
233274880fe2SRobert Schiele  elif $pkg_config pixman-1 > /dev/null 2>&1; then
2333e2134eb9SGerd Hoffmann    pixman="system"
2334e2134eb9SGerd Hoffmann  else
2335e2134eb9SGerd Hoffmann    pixman="internal"
2336e2134eb9SGerd Hoffmann  fi
2337e2134eb9SGerd Hoffmannfi
233874880fe2SRobert Schieleif test "$pixman" = "none"; then
233974880fe2SRobert Schiele  if test "$want_tools" != "no" -o "$softmmu" != "no"; then
234076ad07a4SPeter Maydell    error_exit "pixman disabled but system emulation or tools build" \
234176ad07a4SPeter Maydell        "enabled.  You can turn off pixman only if you also" \
234276ad07a4SPeter Maydell        "disable all system emulation targets and the tools" \
234376ad07a4SPeter Maydell        "build with '--disable-tools --disable-system'."
234474880fe2SRobert Schiele  fi
234574880fe2SRobert Schiele  pixman_cflags=
234674880fe2SRobert Schiele  pixman_libs=
234774880fe2SRobert Schieleelif test "$pixman" = "system"; then
2348ca871ec8SStefan Weil  pixman_cflags=`$pkg_config --cflags pixman-1`
2349ca871ec8SStefan Weil  pixman_libs=`$pkg_config --libs pixman-1`
2350e2134eb9SGerd Hoffmannelse
2351e2134eb9SGerd Hoffmann  if test ! -d ${source_path}/pixman/pixman; then
235276ad07a4SPeter Maydell    error_exit "pixman not present. Your options:" \
235376ad07a4SPeter Maydell        "  (1) Preferred: Install the pixman devel package (any recent" \
235476ad07a4SPeter Maydell        "      distro should have packages as Xorg needs pixman too)." \
235576ad07a4SPeter Maydell        "  (2) Fetch the pixman submodule, using:" \
235676ad07a4SPeter Maydell        "      git submodule update --init pixman"
2357e2134eb9SGerd Hoffmann  fi
23585ca9388aSGerd Hoffmann  mkdir -p pixman/pixman
23595ca9388aSGerd Hoffmann  pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
23605ca9388aSGerd Hoffmann  pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2361e2134eb9SGerd Hoffmannfi
2362e2134eb9SGerd Hoffmann
2363e2134eb9SGerd Hoffmann##########################################
236417bff52bSM. Mohan Kumar# libcap probe
236517bff52bSM. Mohan Kumar
236617bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
236717bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
236817bff52bSM. Mohan Kumar#include <stdio.h>
236917bff52bSM. Mohan Kumar#include <sys/capability.h>
2370cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
237117bff52bSM. Mohan KumarEOF
237217bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
237317bff52bSM. Mohan Kumar    cap=yes
237417bff52bSM. Mohan Kumar  else
237517bff52bSM. Mohan Kumar    cap=no
237617bff52bSM. Mohan Kumar  fi
237717bff52bSM. Mohan Kumarfi
237817bff52bSM. Mohan Kumar
237917bff52bSM. Mohan Kumar##########################################
2380e5d355d1Saliguori# pthread probe
23814b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
23823c529d93Saliguori
2383e5d355d1Saliguoripthread=no
2384414f0dabSblueswir1cat > $TMPC << EOF
23853c529d93Saliguori#include <pthread.h>
23867a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
23877a42bbe4SStefan Weilint main(void) {
23887a42bbe4SStefan Weil  pthread_t thread;
23897a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
23907a42bbe4SStefan Weil  return 0;
23917a42bbe4SStefan Weil}
2392414f0dabSblueswir1EOF
2393bd00d539SAndreas Färberif compile_prog "" "" ; then
2394bd00d539SAndreas Färber  pthread=yes
2395bd00d539SAndreas Färberelse
2396de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
239752166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2398e5d355d1Saliguori      pthread=yes
2399e3c56761SPeter Portante      found=no
2400e3c56761SPeter Portante      for lib_entry in $LIBS; do
2401e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2402e3c56761SPeter Portante          found=yes
2403e3c56761SPeter Portante          break
2404e3c56761SPeter Portante        fi
2405e3c56761SPeter Portante      done
2406e3c56761SPeter Portante      if test "$found" = "no"; then
24075572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2408e3c56761SPeter Portante      fi
2409de65fe0fSSebastian Herbszt      break
2410414f0dabSblueswir1    fi
2411de65fe0fSSebastian Herbszt  done
2412bd00d539SAndreas Färberfi
2413414f0dabSblueswir1
24144617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
241576ad07a4SPeter Maydell  error_exit "pthread check failed" \
241676ad07a4SPeter Maydell      "Make sure to have the pthread libs and headers installed."
2417e5d355d1Saliguorifi
2418e5d355d1Saliguori
2419bf9298b9Saliguori##########################################
2420f27aaf4bSChristian Brunner# rbd probe
2421f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2422f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2423f27aaf4bSChristian Brunner#include <stdio.h>
2424ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2425f27aaf4bSChristian Brunnerint main(void) {
2426ad32e9c0SJosh Durgin    rados_t cluster;
2427ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2428f27aaf4bSChristian Brunner    return 0;
2429f27aaf4bSChristian Brunner}
2430f27aaf4bSChristian BrunnerEOF
2431ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2432f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2433f27aaf4bSChristian Brunner    rbd=yes
2434f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2435f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2436f27aaf4bSChristian Brunner  else
2437f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2438f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2439f27aaf4bSChristian Brunner    fi
2440f27aaf4bSChristian Brunner    rbd=no
2441f27aaf4bSChristian Brunner  fi
2442f27aaf4bSChristian Brunnerfi
2443f27aaf4bSChristian Brunner
2444f27aaf4bSChristian Brunner##########################################
24450a12ec87SRichard W.M. Jones# libssh2 probe
24464fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8
24470a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then
244865d5d3f9SStefan Weil  if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
24490a12ec87SRichard W.M. Jones    libssh2_cflags=`$pkg_config libssh2 --cflags`
24500a12ec87SRichard W.M. Jones    libssh2_libs=`$pkg_config libssh2 --libs`
24510a12ec87SRichard W.M. Jones    libssh2=yes
24520a12ec87SRichard W.M. Jones    libs_tools="$libssh2_libs $libs_tools"
24530a12ec87SRichard W.M. Jones    libs_softmmu="$libssh2_libs $libs_softmmu"
24540a12ec87SRichard W.M. Jones    QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags"
24550a12ec87SRichard W.M. Jones  else
24560a12ec87SRichard W.M. Jones    if test "$libssh2" = "yes" ; then
24574fc16838SRichard W.M. Jones      error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
24580a12ec87SRichard W.M. Jones    fi
24590a12ec87SRichard W.M. Jones    libssh2=no
24600a12ec87SRichard W.M. Jones  fi
24610a12ec87SRichard W.M. Jonesfi
24620a12ec87SRichard W.M. Jones
24630a12ec87SRichard W.M. Jones##########################################
24649a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe
24659a2d462eSRichard W.M. Jones
24669a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then
24679a2d462eSRichard W.M. Jones  cat > $TMPC <<EOF
24689a2d462eSRichard W.M. Jones#include <stdio.h>
24699a2d462eSRichard W.M. Jones#include <libssh2.h>
24709a2d462eSRichard W.M. Jones#include <libssh2_sftp.h>
24719a2d462eSRichard W.M. Jonesint main(void) {
24729a2d462eSRichard W.M. Jones    LIBSSH2_SESSION *session;
24739a2d462eSRichard W.M. Jones    LIBSSH2_SFTP *sftp;
24749a2d462eSRichard W.M. Jones    LIBSSH2_SFTP_HANDLE *sftp_handle;
24759a2d462eSRichard W.M. Jones    session = libssh2_session_init ();
24769a2d462eSRichard W.M. Jones    sftp = libssh2_sftp_init (session);
24779a2d462eSRichard W.M. Jones    sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
24789a2d462eSRichard W.M. Jones    libssh2_sftp_fsync (sftp_handle);
24799a2d462eSRichard W.M. Jones    return 0;
24809a2d462eSRichard W.M. Jones}
24819a2d462eSRichard W.M. JonesEOF
24829a2d462eSRichard W.M. Jones  # libssh2_cflags/libssh2_libs defined in previous test.
24839a2d462eSRichard W.M. Jones  if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
24849a2d462eSRichard W.M. Jones    QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
24859a2d462eSRichard W.M. Jones  fi
24869a2d462eSRichard W.M. Jonesfi
24879a2d462eSRichard W.M. Jones
24889a2d462eSRichard W.M. Jones##########################################
24895c6c3a6cSChristoph Hellwig# linux-aio probe
24905c6c3a6cSChristoph Hellwig
24915c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
24925c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
24935c6c3a6cSChristoph Hellwig#include <libaio.h>
24945c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2495832ce9c2SScott Wood#include <stddef.h>
24965c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
24975c6c3a6cSChristoph HellwigEOF
24985c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
24995c6c3a6cSChristoph Hellwig    linux_aio=yes
2500048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2501048d179fSPaul Brook    libs_tools="$libs_tools -laio"
25025c6c3a6cSChristoph Hellwig  else
25035c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
25045c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
25055c6c3a6cSChristoph Hellwig    fi
25063cfcae3cSLuiz Capitulino    linux_aio=no
25075c6c3a6cSChristoph Hellwig  fi
25085c6c3a6cSChristoph Hellwigfi
25095c6c3a6cSChristoph Hellwig
25105c6c3a6cSChristoph Hellwig##########################################
25113b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux
25123b8acc11SPaolo Bonzini
25133b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
25143b8acc11SPaolo Bonzini  tpm_passthrough=$tpm
25153b8acc11SPaolo Bonzinielse
25163b8acc11SPaolo Bonzini  tpm_passthrough=no
25173b8acc11SPaolo Bonzinifi
25183b8acc11SPaolo Bonzini
25193b8acc11SPaolo Bonzini##########################################
2520583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio
2521583f6e7bSStefan Hajnoczi
2522583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \
2523583f6e7bSStefan Hajnoczi	"$linux_aio" != "yes" ; then
252476ad07a4SPeter Maydell  error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2525583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then
2526583f6e7bSStefan Hajnoczi  virtio_blk_data_plane=$linux_aio
2527583f6e7bSStefan Hajnoczifi
2528583f6e7bSStefan Hajnoczi
2529583f6e7bSStefan Hajnoczi##########################################
2530758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2531758e8e38SVenkateswararao Jujjuri (JV)
2532758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2533758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2534758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2535758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2536f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2537f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2538f2338fb4SPavel Borzenkov#else
25394f26f2b6SAvi Kivity#include <sys/xattr.h>
2540f2338fb4SPavel Borzenkov#endif
2541758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2542758e8e38SVenkateswararao Jujjuri (JV)EOF
25434f26f2b6SAvi Kivity  if compile_prog "" "" ; then
25444f26f2b6SAvi Kivity    attr=yes
25454f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2546f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2547758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2548758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
25494f26f2b6SAvi Kivity    libattr=yes
2550758e8e38SVenkateswararao Jujjuri (JV)  else
2551758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2552758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2553758e8e38SVenkateswararao Jujjuri (JV)    fi
2554758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2555758e8e38SVenkateswararao Jujjuri (JV)  fi
2556758e8e38SVenkateswararao Jujjuri (JV)fi
2557758e8e38SVenkateswararao Jujjuri (JV)
2558758e8e38SVenkateswararao Jujjuri (JV)##########################################
2559bf9298b9Saliguori# iovec probe
2560bf9298b9Saliguoricat > $TMPC <<EOF
2561db34f0b3Sblueswir1#include <sys/types.h>
2562bf9298b9Saliguori#include <sys/uio.h>
2563db34f0b3Sblueswir1#include <unistd.h>
2564f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2565bf9298b9SaliguoriEOF
2566bf9298b9Saliguoriiovec=no
256752166aa0SJuan Quintelaif compile_prog "" "" ; then
2568bf9298b9Saliguori  iovec=yes
2569bf9298b9Saliguorifi
2570bf9298b9Saliguori
2571f652e6afSaurel32##########################################
2572ceb42de8Saliguori# preadv probe
2573ceb42de8Saliguoricat > $TMPC <<EOF
2574ceb42de8Saliguori#include <sys/types.h>
2575ceb42de8Saliguori#include <sys/uio.h>
2576ceb42de8Saliguori#include <unistd.h>
2577c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); }
2578ceb42de8SaliguoriEOF
2579ceb42de8Saliguoripreadv=no
258052166aa0SJuan Quintelaif compile_prog "" "" ; then
2581ceb42de8Saliguori  preadv=yes
2582ceb42de8Saliguorifi
2583ceb42de8Saliguori
2584ceb42de8Saliguori##########################################
2585f652e6afSaurel32# fdt probe
2586e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures,
2587e169e1e1SPeter Maydell# so insist on it if we're building those system emulators.
2588e169e1e1SPeter Maydellfdt_required=no
2589e169e1e1SPeter Maydellfor target in $target_list; do
2590e169e1e1SPeter Maydell  case $target in
25916a49fa95SAlexander Graf    aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
2592e169e1e1SPeter Maydell      fdt_required=yes
2593e169e1e1SPeter Maydell    ;;
2594e169e1e1SPeter Maydell  esac
2595e169e1e1SPeter Maydelldone
2596e169e1e1SPeter Maydell
2597e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then
2598e169e1e1SPeter Maydell  if test "$fdt" = "no"; then
2599e169e1e1SPeter Maydell    error_exit "fdt disabled but some requested targets require it." \
2600e169e1e1SPeter Maydell      "You can turn off fdt only if you also disable all the system emulation" \
2601e169e1e1SPeter Maydell      "targets which need it (by specifying a cut down --target-list)."
2602e169e1e1SPeter Maydell  fi
2603e169e1e1SPeter Maydell  fdt=yes
2604e169e1e1SPeter Maydellfi
2605e169e1e1SPeter Maydell
26062df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2607b41af4baSJuan Quintela  fdt_libs="-lfdt"
260896ce6545SPeter Crosthwaite  # explicitly check for libfdt_env.h as it is missing in some stable installs
2609f652e6afSaurel32  cat > $TMPC << EOF
261096ce6545SPeter Crosthwaite#include <libfdt_env.h>
2611f652e6afSaurel32int main(void) { return 0; }
2612f652e6afSaurel32EOF
261352166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2614a540f158SPeter Crosthwaite    # system DTC is good - use it
2615f652e6afSaurel32    fdt=yes
2616a540f158SPeter Crosthwaite  elif test -d ${source_path}/dtc/libfdt ; then
2617a540f158SPeter Crosthwaite    # have submodule DTC - use it
2618a540f158SPeter Crosthwaite    fdt=yes
2619a540f158SPeter Crosthwaite    dtc_internal="yes"
2620a540f158SPeter Crosthwaite    mkdir -p dtc
2621a540f158SPeter Crosthwaite    if [ "$source_path" != `pwd` ] ; then
2622a540f158SPeter Crosthwaite       symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2623a540f158SPeter Crosthwaite       symlink "$source_path/dtc/scripts" "dtc/scripts"
26242df87df7SJuan Quintela    fi
2625a540f158SPeter Crosthwaite    fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2626a540f158SPeter Crosthwaite    fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2627a540f158SPeter Crosthwaite  elif test "$fdt" = "yes" ; then
2628a540f158SPeter Crosthwaite    # have neither and want - prompt for system/submodule install
2629f2c4ddd9SAndreas Färber    error_exit "DTC not present. Your options:" \
2630a540f158SPeter Crosthwaite        "  (1) Preferred: Install the DTC devel package" \
2631a540f158SPeter Crosthwaite        "  (2) Fetch the DTC submodule, using:" \
2632a540f158SPeter Crosthwaite        "      git submodule update --init dtc"
2633a540f158SPeter Crosthwaite  else
2634a540f158SPeter Crosthwaite    # don't have and don't want
2635de3a354aSMichael Walle    fdt_libs=
26362df87df7SJuan Quintela    fdt=no
2637f652e6afSaurel32  fi
2638f652e6afSaurel32fi
2639f652e6afSaurel32
2640a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs"
2641a540f158SPeter Crosthwaite
264220ff075bSMichael Walle##########################################
2643b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2
2644b1e5fff4SMichael Walleif test "$glx" != "no" ; then
2645b1e5fff4SMichael Walle  glx_libs="-lGL -lX11"
264620ff075bSMichael Walle  cat > $TMPC << EOF
264720ff075bSMichael Walle#include <X11/Xlib.h>
264820ff075bSMichael Walle#include <GL/gl.h>
264920ff075bSMichael Walle#include <GL/glx.h>
2650d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
265120ff075bSMichael WalleEOF
2652d3fcbb16SMichael Walle  if compile_prog "" "-lGL -lX11" ; then
2653b1e5fff4SMichael Walle    glx=yes
265420ff075bSMichael Walle  else
2655b1e5fff4SMichael Walle    if test "$glx" = "yes" ; then
2656b1e5fff4SMichael Walle      feature_not_found "glx"
265720ff075bSMichael Walle    fi
2658b1e5fff4SMichael Walle    glx_libs=
2659b1e5fff4SMichael Walle    glx=no
266020ff075bSMichael Walle  fi
266120ff075bSMichael Wallefi
266220ff075bSMichael Walle
2663eb100396SBharata B Rao##########################################
2664eb100396SBharata B Rao# glusterfs probe
2665eb100396SBharata B Raoif test "$glusterfs" != "no" ; then
266665d5d3f9SStefan Weil  if $pkg_config --atleast-version=3 glusterfs-api; then
2667e01bee08SBharata B Rao    glusterfs="yes"
2668ca871ec8SStefan Weil    glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2669ca871ec8SStefan Weil    glusterfs_libs=`$pkg_config --libs glusterfs-api`
2670e01bee08SBharata B Rao    CFLAGS="$CFLAGS $glusterfs_cflags"
2671eb100396SBharata B Rao    libs_tools="$glusterfs_libs $libs_tools"
2672eb100396SBharata B Rao    libs_softmmu="$glusterfs_libs $libs_softmmu"
267365d5d3f9SStefan Weil    if $pkg_config --atleast-version=5 glusterfs-api; then
26740c14fb47SBharata B Rao      glusterfs_discard="yes"
26750c14fb47SBharata B Rao    fi
2676eb100396SBharata B Rao  else
2677eb100396SBharata B Rao    if test "$glusterfs" = "yes" ; then
2678eb100396SBharata B Rao      feature_not_found "GlusterFS backend support"
2679eb100396SBharata B Rao    fi
2680e01bee08SBharata B Rao    glusterfs="no"
2681eb100396SBharata B Rao  fi
2682eb100396SBharata B Raofi
2683eb100396SBharata B Rao
268439386ac7Saurel32# Check for inotify functions when we are building linux-user
26853b3f24adSaurel32# emulator.  This is done because older glibc versions don't
26863b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
26873b3f24adSaurel32# don't provide them even if kernel supports them.
26883b3f24adSaurel32#
26893b3f24adSaurel32inotify=no
26903b3f24adSaurel32cat > $TMPC << EOF
26913b3f24adSaurel32#include <sys/inotify.h>
26923b3f24adSaurel32
26933b3f24adSaurel32int
26943b3f24adSaurel32main(void)
26953b3f24adSaurel32{
26963b3f24adSaurel32	/* try to start inotify */
26978690e420Saurel32	return inotify_init();
26983b3f24adSaurel32}
26993b3f24adSaurel32EOF
270052166aa0SJuan Quintelaif compile_prog "" "" ; then
27013b3f24adSaurel32  inotify=yes
27023b3f24adSaurel32fi
27033b3f24adSaurel32
2704c05c7a73SRiku Voipioinotify1=no
2705c05c7a73SRiku Voipiocat > $TMPC << EOF
2706c05c7a73SRiku Voipio#include <sys/inotify.h>
2707c05c7a73SRiku Voipio
2708c05c7a73SRiku Voipioint
2709c05c7a73SRiku Voipiomain(void)
2710c05c7a73SRiku Voipio{
2711c05c7a73SRiku Voipio    /* try to start inotify */
2712c05c7a73SRiku Voipio    return inotify_init1(0);
2713c05c7a73SRiku Voipio}
2714c05c7a73SRiku VoipioEOF
2715c05c7a73SRiku Voipioif compile_prog "" "" ; then
2716c05c7a73SRiku Voipio  inotify1=yes
2717c05c7a73SRiku Voipiofi
2718c05c7a73SRiku Voipio
2719ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2720ebc996f3SRiku Voipioutimens=no
2721ebc996f3SRiku Voipiocat > $TMPC << EOF
2722ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2723ebc996f3SRiku Voipio#include <stddef.h>
2724ebc996f3SRiku Voipio#include <fcntl.h>
27253014ee00SPeter Maydell#include <sys/stat.h>
2726ebc996f3SRiku Voipio
2727ebc996f3SRiku Voipioint main(void)
2728ebc996f3SRiku Voipio{
2729ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2730ebc996f3SRiku Voipio    futimens(0, NULL);
2731ebc996f3SRiku Voipio    return 0;
2732ebc996f3SRiku Voipio}
2733ebc996f3SRiku VoipioEOF
273452166aa0SJuan Quintelaif compile_prog "" "" ; then
2735ebc996f3SRiku Voipio  utimens=yes
2736ebc996f3SRiku Voipiofi
2737ebc996f3SRiku Voipio
2738099d6b0fSRiku Voipio# check if pipe2 is there
2739099d6b0fSRiku Voipiopipe2=no
2740099d6b0fSRiku Voipiocat > $TMPC << EOF
2741099d6b0fSRiku Voipio#include <unistd.h>
2742099d6b0fSRiku Voipio#include <fcntl.h>
2743099d6b0fSRiku Voipio
2744099d6b0fSRiku Voipioint main(void)
2745099d6b0fSRiku Voipio{
2746099d6b0fSRiku Voipio    int pipefd[2];
27479bca8162SBruce Rogers    return pipe2(pipefd, O_CLOEXEC);
2748099d6b0fSRiku Voipio}
2749099d6b0fSRiku VoipioEOF
275052166aa0SJuan Quintelaif compile_prog "" "" ; then
2751099d6b0fSRiku Voipio  pipe2=yes
2752099d6b0fSRiku Voipiofi
2753099d6b0fSRiku Voipio
275440ff6d7eSKevin Wolf# check if accept4 is there
275540ff6d7eSKevin Wolfaccept4=no
275640ff6d7eSKevin Wolfcat > $TMPC << EOF
275740ff6d7eSKevin Wolf#include <sys/socket.h>
275840ff6d7eSKevin Wolf#include <stddef.h>
275940ff6d7eSKevin Wolf
276040ff6d7eSKevin Wolfint main(void)
276140ff6d7eSKevin Wolf{
276240ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
276340ff6d7eSKevin Wolf    return 0;
276440ff6d7eSKevin Wolf}
276540ff6d7eSKevin WolfEOF
276640ff6d7eSKevin Wolfif compile_prog "" "" ; then
276740ff6d7eSKevin Wolf  accept4=yes
276840ff6d7eSKevin Wolffi
276940ff6d7eSKevin Wolf
27703ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
27713ce34dfbSvibisreenivasansplice=no
27723ce34dfbSvibisreenivasancat > $TMPC << EOF
27733ce34dfbSvibisreenivasan#include <unistd.h>
27743ce34dfbSvibisreenivasan#include <fcntl.h>
27753ce34dfbSvibisreenivasan#include <limits.h>
27763ce34dfbSvibisreenivasan
27773ce34dfbSvibisreenivasanint main(void)
27783ce34dfbSvibisreenivasan{
277966ea0f22SStefan Weil    int len, fd = 0;
27803ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
27813ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
27823ce34dfbSvibisreenivasan    return 0;
27833ce34dfbSvibisreenivasan}
27843ce34dfbSvibisreenivasanEOF
278552166aa0SJuan Quintelaif compile_prog "" "" ; then
27863ce34dfbSvibisreenivasan  splice=yes
27873ce34dfbSvibisreenivasanfi
27883ce34dfbSvibisreenivasan
2789dcc38d1cSMarcelo Tosatti##########################################
2790dcc38d1cSMarcelo Tosatti# signalfd probe
2791dcc38d1cSMarcelo Tosattisignalfd="no"
2792dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2793dcc38d1cSMarcelo Tosatti#include <unistd.h>
2794dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2795dcc38d1cSMarcelo Tosatti#include <signal.h>
2796dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2797dcc38d1cSMarcelo TosattiEOF
2798dcc38d1cSMarcelo Tosatti
2799dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2800dcc38d1cSMarcelo Tosatti  signalfd=yes
2801dcc38d1cSMarcelo Tosattifi
2802dcc38d1cSMarcelo Tosatti
2803c2882b96SRiku Voipio# check if eventfd is supported
2804c2882b96SRiku Voipioeventfd=no
2805c2882b96SRiku Voipiocat > $TMPC << EOF
2806c2882b96SRiku Voipio#include <sys/eventfd.h>
2807c2882b96SRiku Voipio
2808c2882b96SRiku Voipioint main(void)
2809c2882b96SRiku Voipio{
281055cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2811c2882b96SRiku Voipio}
2812c2882b96SRiku VoipioEOF
2813c2882b96SRiku Voipioif compile_prog "" "" ; then
2814c2882b96SRiku Voipio  eventfd=yes
2815c2882b96SRiku Voipiofi
2816c2882b96SRiku Voipio
2817d0927938SUlrich Hecht# check for fallocate
2818d0927938SUlrich Hechtfallocate=no
2819d0927938SUlrich Hechtcat > $TMPC << EOF
2820d0927938SUlrich Hecht#include <fcntl.h>
2821d0927938SUlrich Hecht
2822d0927938SUlrich Hechtint main(void)
2823d0927938SUlrich Hecht{
2824d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2825d0927938SUlrich Hecht    return 0;
2826d0927938SUlrich Hecht}
2827d0927938SUlrich HechtEOF
28288fb03151SPeter Maydellif compile_prog "" "" ; then
2829d0927938SUlrich Hecht  fallocate=yes
2830d0927938SUlrich Hechtfi
2831d0927938SUlrich Hecht
28323d4fa43eSKusanagi Kouichi# check for fallocate hole punching
28333d4fa43eSKusanagi Kouichifallocate_punch_hole=no
28343d4fa43eSKusanagi Kouichicat > $TMPC << EOF
28353d4fa43eSKusanagi Kouichi#include <fcntl.h>
28363d4fa43eSKusanagi Kouichi#include <linux/falloc.h>
28373d4fa43eSKusanagi Kouichi
28383d4fa43eSKusanagi Kouichiint main(void)
28393d4fa43eSKusanagi Kouichi{
28403d4fa43eSKusanagi Kouichi    fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
28413d4fa43eSKusanagi Kouichi    return 0;
28423d4fa43eSKusanagi Kouichi}
28433d4fa43eSKusanagi KouichiEOF
28443d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then
28453d4fa43eSKusanagi Kouichi  fallocate_punch_hole=yes
28463d4fa43eSKusanagi Kouichifi
28473d4fa43eSKusanagi Kouichi
2848c727f47dSPeter Maydell# check for sync_file_range
2849c727f47dSPeter Maydellsync_file_range=no
2850c727f47dSPeter Maydellcat > $TMPC << EOF
2851c727f47dSPeter Maydell#include <fcntl.h>
2852c727f47dSPeter Maydell
2853c727f47dSPeter Maydellint main(void)
2854c727f47dSPeter Maydell{
2855c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2856c727f47dSPeter Maydell    return 0;
2857c727f47dSPeter Maydell}
2858c727f47dSPeter MaydellEOF
28598fb03151SPeter Maydellif compile_prog "" "" ; then
2860c727f47dSPeter Maydell  sync_file_range=yes
2861c727f47dSPeter Maydellfi
2862c727f47dSPeter Maydell
2863dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2864dace20dcSPeter Maydellfiemap=no
2865dace20dcSPeter Maydellcat > $TMPC << EOF
2866dace20dcSPeter Maydell#include <sys/ioctl.h>
2867dace20dcSPeter Maydell#include <linux/fs.h>
2868dace20dcSPeter Maydell#include <linux/fiemap.h>
2869dace20dcSPeter Maydell
2870dace20dcSPeter Maydellint main(void)
2871dace20dcSPeter Maydell{
2872dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2873dace20dcSPeter Maydell    return 0;
2874dace20dcSPeter Maydell}
2875dace20dcSPeter MaydellEOF
28768fb03151SPeter Maydellif compile_prog "" "" ; then
2877dace20dcSPeter Maydell  fiemap=yes
2878dace20dcSPeter Maydellfi
2879dace20dcSPeter Maydell
2880d0927938SUlrich Hecht# check for dup3
2881d0927938SUlrich Hechtdup3=no
2882d0927938SUlrich Hechtcat > $TMPC << EOF
2883d0927938SUlrich Hecht#include <unistd.h>
2884d0927938SUlrich Hecht
2885d0927938SUlrich Hechtint main(void)
2886d0927938SUlrich Hecht{
2887d0927938SUlrich Hecht    dup3(0, 0, 0);
2888d0927938SUlrich Hecht    return 0;
2889d0927938SUlrich Hecht}
2890d0927938SUlrich HechtEOF
289178f5d726SJan Kiszkaif compile_prog "" "" ; then
2892d0927938SUlrich Hecht  dup3=yes
2893d0927938SUlrich Hechtfi
2894d0927938SUlrich Hecht
28954e0c6529SAlex Bligh# check for ppoll support
28964e0c6529SAlex Blighppoll=no
28974e0c6529SAlex Blighcat > $TMPC << EOF
28984e0c6529SAlex Bligh#include <poll.h>
28994e0c6529SAlex Bligh
29004e0c6529SAlex Blighint main(void)
29014e0c6529SAlex Bligh{
29024e0c6529SAlex Bligh    struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
29034e0c6529SAlex Bligh    ppoll(&pfd, 1, 0, 0);
29044e0c6529SAlex Bligh    return 0;
29054e0c6529SAlex Bligh}
29064e0c6529SAlex BlighEOF
29074e0c6529SAlex Blighif compile_prog "" "" ; then
29084e0c6529SAlex Bligh  ppoll=yes
29094e0c6529SAlex Blighfi
29104e0c6529SAlex Bligh
2911cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support
2912cd758dd0SAlex Blighprctl_pr_set_timerslack=no
2913cd758dd0SAlex Blighcat > $TMPC << EOF
2914cd758dd0SAlex Bligh#include <sys/prctl.h>
2915cd758dd0SAlex Bligh
2916cd758dd0SAlex Blighint main(void)
2917cd758dd0SAlex Bligh{
2918cd758dd0SAlex Bligh    prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
2919cd758dd0SAlex Bligh    return 0;
2920cd758dd0SAlex Bligh}
2921cd758dd0SAlex BlighEOF
2922cd758dd0SAlex Blighif compile_prog "" "" ; then
2923cd758dd0SAlex Bligh  prctl_pr_set_timerslack=yes
2924cd758dd0SAlex Blighfi
2925cd758dd0SAlex Bligh
29263b6edd16SPeter Maydell# check for epoll support
29273b6edd16SPeter Maydellepoll=no
29283b6edd16SPeter Maydellcat > $TMPC << EOF
29293b6edd16SPeter Maydell#include <sys/epoll.h>
29303b6edd16SPeter Maydell
29313b6edd16SPeter Maydellint main(void)
29323b6edd16SPeter Maydell{
29333b6edd16SPeter Maydell    epoll_create(0);
29343b6edd16SPeter Maydell    return 0;
29353b6edd16SPeter Maydell}
29363b6edd16SPeter MaydellEOF
29378fb03151SPeter Maydellif compile_prog "" "" ; then
29383b6edd16SPeter Maydell  epoll=yes
29393b6edd16SPeter Maydellfi
29403b6edd16SPeter Maydell
29413b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
29423b6edd16SPeter Maydell# so we must check separately for their presence
29433b6edd16SPeter Maydellepoll_create1=no
29443b6edd16SPeter Maydellcat > $TMPC << EOF
29453b6edd16SPeter Maydell#include <sys/epoll.h>
29463b6edd16SPeter Maydell
29473b6edd16SPeter Maydellint main(void)
29483b6edd16SPeter Maydell{
294919e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
295019e83f6bSPeter Maydell     * a function being called. This is necessary so that on
295119e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
295219e83f6bSPeter Maydell     * the library but not declared in the header file we will
295319e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
295419e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
295519e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
295619e83f6bSPeter Maydell     */
2957c075a723SBlue Swirl    return (int)(uintptr_t)&epoll_create1;
29583b6edd16SPeter Maydell}
29593b6edd16SPeter MaydellEOF
29608fb03151SPeter Maydellif compile_prog "" "" ; then
29613b6edd16SPeter Maydell  epoll_create1=yes
29623b6edd16SPeter Maydellfi
29633b6edd16SPeter Maydell
29643b6edd16SPeter Maydellepoll_pwait=no
29653b6edd16SPeter Maydellcat > $TMPC << EOF
29663b6edd16SPeter Maydell#include <sys/epoll.h>
29673b6edd16SPeter Maydell
29683b6edd16SPeter Maydellint main(void)
29693b6edd16SPeter Maydell{
29703b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
29713b6edd16SPeter Maydell    return 0;
29723b6edd16SPeter Maydell}
29733b6edd16SPeter MaydellEOF
29748fb03151SPeter Maydellif compile_prog "" "" ; then
29753b6edd16SPeter Maydell  epoll_pwait=yes
29763b6edd16SPeter Maydellfi
29773b6edd16SPeter Maydell
2978a8fd1abaSPeter Maydell# check for sendfile support
2979a8fd1abaSPeter Maydellsendfile=no
2980a8fd1abaSPeter Maydellcat > $TMPC << EOF
2981a8fd1abaSPeter Maydell#include <sys/sendfile.h>
2982a8fd1abaSPeter Maydell
2983a8fd1abaSPeter Maydellint main(void)
2984a8fd1abaSPeter Maydell{
2985a8fd1abaSPeter Maydell    return sendfile(0, 0, 0, 0);
2986a8fd1abaSPeter Maydell}
2987a8fd1abaSPeter MaydellEOF
2988a8fd1abaSPeter Maydellif compile_prog "" "" ; then
2989a8fd1abaSPeter Maydell  sendfile=yes
2990a8fd1abaSPeter Maydellfi
2991a8fd1abaSPeter Maydell
2992cc8ae6deSpbrook# Check if tools are available to build documentation.
2993a25dba17SJuan Quintelaif test "$docs" != "no" ; then
299401668d98SStefan Weil  if has makeinfo && has pod2man; then
2995a25dba17SJuan Quintela    docs=yes
299683a3ab8bSJuan Quintela  else
2997a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2998a25dba17SJuan Quintela      feature_not_found "docs"
299983a3ab8bSJuan Quintela    fi
3000a25dba17SJuan Quintela    docs=no
300183a3ab8bSJuan Quintela  fi
3002cc8ae6deSpbrookfi
3003cc8ae6deSpbrook
3004f514f41cSStefan Weil# Search for bswap_32 function
30056ae9a1f4SJuan Quintelabyteswap_h=no
30066ae9a1f4SJuan Quintelacat > $TMPC << EOF
30076ae9a1f4SJuan Quintela#include <byteswap.h>
30086ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
30096ae9a1f4SJuan QuintelaEOF
301052166aa0SJuan Quintelaif compile_prog "" "" ; then
30116ae9a1f4SJuan Quintela  byteswap_h=yes
30126ae9a1f4SJuan Quintelafi
30136ae9a1f4SJuan Quintela
301475f13596SStefan Weil# Search for bswap32 function
30156ae9a1f4SJuan Quintelabswap_h=no
30166ae9a1f4SJuan Quintelacat > $TMPC << EOF
30176ae9a1f4SJuan Quintela#include <sys/endian.h>
30186ae9a1f4SJuan Quintela#include <sys/types.h>
30196ae9a1f4SJuan Quintela#include <machine/bswap.h>
30206ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
30216ae9a1f4SJuan QuintelaEOF
302252166aa0SJuan Quintelaif compile_prog "" "" ; then
30236ae9a1f4SJuan Quintela  bswap_h=yes
30246ae9a1f4SJuan Quintelafi
30256ae9a1f4SJuan Quintela
3026da93a1fdSaliguori##########################################
3027c589b249SRonnie Sahlberg# Do we have libiscsi
3028*063c3378SPeter Lieven# We check for iscsi_write16_sync() to make sure we have a
3029*063c3378SPeter Lieven# at least version 1.4.0 of libiscsi.
3030c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
3031c589b249SRonnie Sahlberg  cat > $TMPC << EOF
3032fa6acb0cSRonnie Sahlberg#include <stdio.h>
3033c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
3034*063c3378SPeter Lievenint main(void) { iscsi_write16_sync(NULL,0,0,NULL,0,0,0,0,0,0,0); return 0; }
3035c589b249SRonnie SahlbergEOF
303665d5d3f9SStefan Weil  if $pkg_config --atleast-version=1.7.0 libiscsi; then
30373c33ea96SPaolo Bonzini    libiscsi="yes"
3038ca871ec8SStefan Weil    libiscsi_cflags=$($pkg_config --cflags libiscsi)
3039ca871ec8SStefan Weil    libiscsi_libs=$($pkg_config --libs libiscsi)
30403c33ea96SPaolo Bonzini    CFLAGS="$CFLAGS $libiscsi_cflags"
30413c33ea96SPaolo Bonzini    LIBS="$LIBS $libiscsi_libs"
30423c33ea96SPaolo Bonzini  elif compile_prog "" "-liscsi" ; then
3043c589b249SRonnie Sahlberg    libiscsi="yes"
3044c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
3045c589b249SRonnie Sahlberg  else
3046c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
3047c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
3048c589b249SRonnie Sahlberg    fi
3049c589b249SRonnie Sahlberg    libiscsi="no"
3050c589b249SRonnie Sahlberg  fi
3051c589b249SRonnie Sahlbergfi
3052c589b249SRonnie Sahlberg
3053c589b249SRonnie Sahlberg
3054c589b249SRonnie Sahlberg##########################################
30558bacde8dSNatanael Copa# Do we need libm
30568bacde8dSNatanael Copacat > $TMPC << EOF
30578bacde8dSNatanael Copa#include <math.h>
30588bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); }
30598bacde8dSNatanael CopaEOF
30608bacde8dSNatanael Copaif compile_prog "" "" ; then
30618bacde8dSNatanael Copa  :
30628bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then
30638bacde8dSNatanael Copa  LIBS="-lm $LIBS"
30648bacde8dSNatanael Copa  libs_qga="-lm $libs_qga"
30658bacde8dSNatanael Copaelse
306676ad07a4SPeter Maydell  error_exit "libm check failed"
30678bacde8dSNatanael Copafi
30688bacde8dSNatanael Copa
30698bacde8dSNatanael Copa##########################################
3070da93a1fdSaliguori# Do we need librt
30718bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime
30728bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't
30738bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this
30748bacde8dSNatanael Copa# function in addition.
3075da93a1fdSaliguoricat > $TMPC <<EOF
3076da93a1fdSaliguori#include <signal.h>
3077da93a1fdSaliguori#include <time.h>
30788bacde8dSNatanael Copaint main(void) {
30798bacde8dSNatanael Copa  timer_create(CLOCK_REALTIME, NULL, NULL);
30808bacde8dSNatanael Copa  return clock_gettime(CLOCK_REALTIME, NULL);
30818bacde8dSNatanael Copa}
3082da93a1fdSaliguoriEOF
3083da93a1fdSaliguori
308452166aa0SJuan Quintelaif compile_prog "" "" ; then
308507ffa4bdSJuan Quintela  :
30868bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result
30878bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then
308807ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
30898bacde8dSNatanael Copa  libs_qga="-lrt $libs_qga"
3090da93a1fdSaliguorifi
3091da93a1fdSaliguori
309231ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3093179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
30946362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
30956362a53fSJuan Quintelafi
30966362a53fSJuan Quintela
3097de5071c5SBlue Swirl##########################################
3098cd4ec0b4SGerd Hoffmann# spice probe
3099cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
3100cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
3101cd4ec0b4SGerd Hoffmann#include <spice.h>
3102cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
3103cd4ec0b4SGerd HoffmannEOF
3104710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3105710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
310665d5d3f9SStefan Weil  if $pkg_config --atleast-version=0.12.0 spice-server && \
310765d5d3f9SStefan Weil     $pkg_config --atleast-version=0.12.3 spice-protocol && \
3108cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
3109cd4ec0b4SGerd Hoffmann    spice="yes"
3110cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
3111cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
31122e0e3c39SAlon Levy    spice_protocol_version=$($pkg_config --modversion spice-protocol)
31132e0e3c39SAlon Levy    spice_server_version=$($pkg_config --modversion spice-server)
3114cd4ec0b4SGerd Hoffmann  else
3115cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
3116cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
3117cd4ec0b4SGerd Hoffmann    fi
3118cd4ec0b4SGerd Hoffmann    spice="no"
3119cd4ec0b4SGerd Hoffmann  fi
3120cd4ec0b4SGerd Hoffmannfi
3121cd4ec0b4SGerd Hoffmann
3122111a38b0SRobert Relyea# check for libcacard for smartcard support
3123111a38b0SRobert Relyeasmartcard_cflags=""
3124111a38b0SRobert Relyea# TODO - what's the minimal nss version we support?
3125111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then
31265f01e06fSSergei Trofimovich  cat > $TMPC << EOF
31275f01e06fSSergei Trofimovich#include <pk11pub.h>
31285f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
31295f01e06fSSergei TrofimovichEOF
31300b22ef0fSPeter Maydell    smartcard_includes="-I\$(SRC_PATH)/libcacard"
31318c741c22SAlon Levy    libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
31328c741c22SAlon Levy    libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
31336ca026cbSPeter Maydell    test_cflags="$libcacard_cflags"
31346ca026cbSPeter Maydell    # The header files in nss < 3.13.3 have a bug which causes them to
31356ca026cbSPeter Maydell    # emit a warning. If we're going to compile QEMU with -Werror, then
31366ca026cbSPeter Maydell    # test that the headers don't have this bug. Otherwise we would pass
31376ca026cbSPeter Maydell    # the configure test but fail to compile QEMU later.
31386ca026cbSPeter Maydell    if test "$werror" = "yes"; then
31396ca026cbSPeter Maydell        test_cflags="-Werror $test_cflags"
31406ca026cbSPeter Maydell    fi
3141b6fc675bSPaolo Bonzini    if test -n "$libtool" &&
314265d5d3f9SStefan Weil       $pkg_config --atleast-version=3.12.8 nss && \
31436ca026cbSPeter Maydell      compile_prog "$test_cflags" "$libcacard_libs"; then
31445f01e06fSSergei Trofimovich        smartcard_nss="yes"
31450b22ef0fSPeter Maydell        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
31460b22ef0fSPeter Maydell        QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3147ad4cf3f6SPaul Brook        libs_softmmu="$libcacard_libs $libs_softmmu"
3148111a38b0SRobert Relyea    else
3149111a38b0SRobert Relyea        if test "$smartcard_nss" = "yes"; then
3150111a38b0SRobert Relyea            feature_not_found "nss"
3151111a38b0SRobert Relyea        fi
3152111a38b0SRobert Relyea        smartcard_nss="no"
3153111a38b0SRobert Relyea    fi
3154111a38b0SRobert Relyeafi
3155111a38b0SRobert Relyea
31562b2325ffSGerd Hoffmann# check for libusb
31572b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then
315865d5d3f9SStefan Weil    if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
31592b2325ffSGerd Hoffmann        libusb="yes"
3160ca871ec8SStefan Weil        libusb_cflags=$($pkg_config --cflags libusb-1.0)
3161ca871ec8SStefan Weil        libusb_libs=$($pkg_config --libs libusb-1.0)
31622b2325ffSGerd Hoffmann        QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
31632b2325ffSGerd Hoffmann        libs_softmmu="$libs_softmmu $libusb_libs"
31642b2325ffSGerd Hoffmann    else
31652b2325ffSGerd Hoffmann        if test "$libusb" = "yes"; then
31662b2325ffSGerd Hoffmann            feature_not_found "libusb"
31672b2325ffSGerd Hoffmann        fi
31682b2325ffSGerd Hoffmann        libusb="no"
31692b2325ffSGerd Hoffmann    fi
31702b2325ffSGerd Hoffmannfi
31712b2325ffSGerd Hoffmann
317269354a83SHans de Goede# check for usbredirparser for usb network redirection support
317369354a83SHans de Goedeif test "$usb_redir" != "no" ; then
317465d5d3f9SStefan Weil    if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
317569354a83SHans de Goede        usb_redir="yes"
3176ca871ec8SStefan Weil        usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3177ca871ec8SStefan Weil        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
317869354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
317956ab2ad1SAurelien Jarno        libs_softmmu="$libs_softmmu $usb_redir_libs"
318069354a83SHans de Goede    else
318169354a83SHans de Goede        if test "$usb_redir" = "yes"; then
318269354a83SHans de Goede            feature_not_found "usb-redir"
318369354a83SHans de Goede        fi
318469354a83SHans de Goede        usb_redir="no"
318569354a83SHans de Goede    fi
318669354a83SHans de Goedefi
318769354a83SHans de Goede
3188cd4ec0b4SGerd Hoffmann##########################################
3189d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win
3190d9840e25STomoki Sekiyama
3191d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3192d9840e25STomoki Sekiyama  case "$vss_win32_sdk" in
3193d9840e25STomoki Sekiyama    "")   vss_win32_include="-I$source_path" ;;
3194d9840e25STomoki Sekiyama    *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3195d9840e25STomoki Sekiyama          # handle path with spaces. So we symlink the headers into ".sdk/vss".
3196d9840e25STomoki Sekiyama          vss_win32_include="-I$source_path/.sdk/vss"
3197d9840e25STomoki Sekiyama	  symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3198d9840e25STomoki Sekiyama	  ;;
3199d9840e25STomoki Sekiyama    *)    vss_win32_include="-I$vss_win32_sdk"
3200d9840e25STomoki Sekiyama  esac
3201d9840e25STomoki Sekiyama  cat > $TMPC << EOF
3202d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__
3203d9840e25STomoki Sekiyama#include <inc/win2003/vss.h>
3204d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; }
3205d9840e25STomoki SekiyamaEOF
3206d9840e25STomoki Sekiyama  if compile_prog "$vss_win32_include" "" ; then
3207d9840e25STomoki Sekiyama    guest_agent_with_vss="yes"
3208d9840e25STomoki Sekiyama    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3209d9840e25STomoki Sekiyama    libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3210d9840e25STomoki Sekiyama  else
3211d9840e25STomoki Sekiyama    if test "$vss_win32_sdk" != "" ; then
3212d9840e25STomoki Sekiyama      echo "ERROR: Please download and install Microsoft VSS SDK:"
3213d9840e25STomoki Sekiyama      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3214d9840e25STomoki Sekiyama      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3215d9840e25STomoki Sekiyama      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
3216d9840e25STomoki Sekiyama      echo "ERROR: The headers are extracted in the directory \`inc'."
3217d9840e25STomoki Sekiyama      feature_not_found "VSS support"
3218d9840e25STomoki Sekiyama    fi
3219d9840e25STomoki Sekiyama    guest_agent_with_vss="no"
3220d9840e25STomoki Sekiyama  fi
3221d9840e25STomoki Sekiyamafi
3222d9840e25STomoki Sekiyama
3223d9840e25STomoki Sekiyama##########################################
3224d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified)
3225d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent
3226d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the
3227d9840e25STomoki Sekiyama# pre-compiled .tlb file is included.
3228d9840e25STomoki Sekiyama
3229d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3230d9840e25STomoki Sekiyama  if test -z "$win_sdk"; then
3231d9840e25STomoki Sekiyama    programfiles="$PROGRAMFILES"
3232d9840e25STomoki Sekiyama    test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3233d9840e25STomoki Sekiyama    if test -n "$programfiles"; then
3234d9840e25STomoki Sekiyama      win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3235d9840e25STomoki Sekiyama    else
3236d9840e25STomoki Sekiyama      feature_not_found "Windows SDK"
3237d9840e25STomoki Sekiyama    fi
3238d9840e25STomoki Sekiyama  elif test "$win_sdk" = "no"; then
3239d9840e25STomoki Sekiyama    win_sdk=""
3240d9840e25STomoki Sekiyama  fi
3241d9840e25STomoki Sekiyamafi
3242d9840e25STomoki Sekiyama
3243d9840e25STomoki Sekiyama##########################################
3244cd4ec0b4SGerd Hoffmann
3245747bbdf7SBlue Swirl##########################################
32465f6b9e8fSBlue Swirl# check if we have fdatasync
32475f6b9e8fSBlue Swirl
32485f6b9e8fSBlue Swirlfdatasync=no
32495f6b9e8fSBlue Swirlcat > $TMPC << EOF
32505f6b9e8fSBlue Swirl#include <unistd.h>
3251d1722a27SAlexandre Raymondint main(void) {
3252d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3253d1722a27SAlexandre Raymondreturn fdatasync(0);
3254d1722a27SAlexandre Raymond#else
3255e172fe11SStefan Weil#error Not supported
3256d1722a27SAlexandre Raymond#endif
3257d1722a27SAlexandre Raymond}
32585f6b9e8fSBlue SwirlEOF
32595f6b9e8fSBlue Swirlif compile_prog "" "" ; then
32605f6b9e8fSBlue Swirl    fdatasync=yes
32615f6b9e8fSBlue Swirlfi
32625f6b9e8fSBlue Swirl
326394a420b1SStefan Hajnoczi##########################################
3264e78815a5SAndreas Färber# check if we have madvise
3265e78815a5SAndreas Färber
3266e78815a5SAndreas Färbermadvise=no
3267e78815a5SAndreas Färbercat > $TMPC << EOF
3268e78815a5SAndreas Färber#include <sys/types.h>
3269e78815a5SAndreas Färber#include <sys/mman.h>
3270832ce9c2SScott Wood#include <stddef.h>
3271e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3272e78815a5SAndreas FärberEOF
3273e78815a5SAndreas Färberif compile_prog "" "" ; then
3274e78815a5SAndreas Färber    madvise=yes
3275e78815a5SAndreas Färberfi
3276e78815a5SAndreas Färber
3277e78815a5SAndreas Färber##########################################
3278e78815a5SAndreas Färber# check if we have posix_madvise
3279e78815a5SAndreas Färber
3280e78815a5SAndreas Färberposix_madvise=no
3281e78815a5SAndreas Färbercat > $TMPC << EOF
3282e78815a5SAndreas Färber#include <sys/mman.h>
3283832ce9c2SScott Wood#include <stddef.h>
3284e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3285e78815a5SAndreas FärberEOF
3286e78815a5SAndreas Färberif compile_prog "" "" ; then
3287e78815a5SAndreas Färber    posix_madvise=yes
3288e78815a5SAndreas Färberfi
3289e78815a5SAndreas Färber
3290e78815a5SAndreas Färber##########################################
32911e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID
32921e9737daSRichard Henderson
32931e9737daSRichard Hendersonsigev_thread_id=no
32941e9737daSRichard Hendersoncat > $TMPC << EOF
32951e9737daSRichard Henderson#include <signal.h>
32961e9737daSRichard Hendersonint main(void) {
32971e9737daSRichard Henderson  struct sigevent ev;
32981e9737daSRichard Henderson  ev.sigev_notify = SIGEV_THREAD_ID;
32991e9737daSRichard Henderson  ev._sigev_un._tid = 0;
33001e9737daSRichard Henderson  asm volatile("" : : "g"(&ev));
33011e9737daSRichard Henderson  return 0;
33021e9737daSRichard Henderson}
33031e9737daSRichard HendersonEOF
33041e9737daSRichard Hendersonif compile_prog "" "" ; then
33051e9737daSRichard Henderson    sigev_thread_id=yes
33061e9737daSRichard Hendersonfi
33071e9737daSRichard Henderson
33081e9737daSRichard Henderson##########################################
330994a420b1SStefan Hajnoczi# check if trace backend exists
331094a420b1SStefan Hajnoczi
3311650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
331294a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
331376ad07a4SPeter Maydell  error_exit "invalid trace backend" \
331476ad07a4SPeter Maydell      "Please choose a supported trace backend."
331594a420b1SStefan Hajnoczifi
331694a420b1SStefan Hajnoczi
33177e24e92aSStefan Hajnoczi##########################################
33187e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
33197e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
33207e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
33217e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
33227e24e92aSStefan Hajnoczi#include <ust/marker.h>
33237e24e92aSStefan Hajnocziint main(void) { return 0; }
33247e24e92aSStefan HajnocziEOF
33257e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
332694b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
3327c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
33287e24e92aSStefan Hajnoczi  else
332976ad07a4SPeter Maydell    error_exit "Trace backend 'ust' missing libust header files"
33307e24e92aSStefan Hajnoczi  fi
33317e24e92aSStefan Hajnoczifi
3332b3d08c02SDaniel P. Berrange
3333b3d08c02SDaniel P. Berrange##########################################
3334b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
3335b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
3336b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
333776ad07a4SPeter Maydell    error_exit "dtrace command is not found in PATH $PATH"
3338b3d08c02SDaniel P. Berrange  fi
3339c276b17dSDaniel P. Berrange  trace_backend_stap="no"
3340c276b17dSDaniel P. Berrange  if has 'stap' ; then
3341c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
3342c276b17dSDaniel P. Berrange  fi
3343b3d08c02SDaniel P. Berrangefi
3344b3d08c02SDaniel P. Berrange
33457e24e92aSStefan Hajnoczi##########################################
3346519175a2SAlex Barcelo# check and set a backend for coroutine
3347d0e2fce5SAneesh Kumar K.V
33487c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback
33497c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because
33507c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally
33517c2acc70SPeter Maydell# useful for debugging purposes.)  On Windows the only valid backend
33527c2acc70SPeter Maydell# is the Windows-specific one.
33537c2acc70SPeter Maydell
33547c2acc70SPeter Maydellucontext_works=no
3355d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then
3356d0e2fce5SAneesh Kumar K.V  cat > $TMPC << EOF
3357d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
3358cdf84806SPeter Maydell#ifdef __stub_makecontext
3359cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
3360cdf84806SPeter Maydell#endif
336175cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
3362d0e2fce5SAneesh Kumar K.VEOF
3363d0e2fce5SAneesh Kumar K.V  if compile_prog "" "" ; then
33647c2acc70SPeter Maydell    ucontext_works=yes
3365d0e2fce5SAneesh Kumar K.V  fi
3366519175a2SAlex Barcelofi
33677c2acc70SPeter Maydell
33687c2acc70SPeter Maydellif test "$coroutine" = ""; then
33697c2acc70SPeter Maydell  if test "$mingw32" = "yes"; then
33707c2acc70SPeter Maydell    coroutine=win32
33717c2acc70SPeter Maydell  elif test "$ucontext_works" = "yes"; then
33727c2acc70SPeter Maydell    coroutine=ucontext
3373519175a2SAlex Barcelo  else
33747c2acc70SPeter Maydell    coroutine=sigaltstack
33757c2acc70SPeter Maydell  fi
33767c2acc70SPeter Maydellelse
33777c2acc70SPeter Maydell  case $coroutine in
33787c2acc70SPeter Maydell  windows)
33797c2acc70SPeter Maydell    if test "$mingw32" != "yes"; then
33807c2acc70SPeter Maydell      error_exit "'windows' coroutine backend only valid for Windows"
33817c2acc70SPeter Maydell    fi
33827c2acc70SPeter Maydell    # Unfortunately the user visible backend name doesn't match the
33837c2acc70SPeter Maydell    # coroutine-*.c filename for this case, so we have to adjust it here.
33847c2acc70SPeter Maydell    coroutine=win32
33857c2acc70SPeter Maydell    ;;
33867c2acc70SPeter Maydell  ucontext)
33877c2acc70SPeter Maydell    if test "$ucontext_works" != "yes"; then
33887c2acc70SPeter Maydell      feature_not_found "ucontext"
33897c2acc70SPeter Maydell    fi
33907c2acc70SPeter Maydell    ;;
33917c2acc70SPeter Maydell  gthread|sigaltstack)
33927c2acc70SPeter Maydell    if test "$mingw32" = "yes"; then
33937c2acc70SPeter Maydell      error_exit "only the 'windows' coroutine backend is valid for Windows"
33947c2acc70SPeter Maydell    fi
33957c2acc70SPeter Maydell    ;;
33967c2acc70SPeter Maydell  *)
339776ad07a4SPeter Maydell    error_exit "unknown coroutine backend $coroutine"
33987c2acc70SPeter Maydell    ;;
33997c2acc70SPeter Maydell  esac
3400d0e2fce5SAneesh Kumar K.Vfi
3401d0e2fce5SAneesh Kumar K.V
340270c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then
340370c60c08SStefan Hajnoczi  if test "$coroutine" = "gthread"; then
340470c60c08SStefan Hajnoczi    coroutine_pool=no
340570c60c08SStefan Hajnoczi  else
340670c60c08SStefan Hajnoczi    coroutine_pool=yes
340770c60c08SStefan Hajnoczi  fi
340870c60c08SStefan Hajnoczifi
340970c60c08SStefan Hajnocziif test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
341070c60c08SStefan Hajnoczi  error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
341170c60c08SStefan Hajnoczifi
341270c60c08SStefan Hajnoczi
3413d0e2fce5SAneesh Kumar K.V##########################################
3414d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
3415d2042378SAneesh Kumar K.V
34164e1797f9SStefan Weilopen_by_handle_at=no
3417d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
3418d2042378SAneesh Kumar K.V#include <fcntl.h>
3419acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
3420acc55ba8SStefan Weil# error missing definition
3421acc55ba8SStefan Weil#else
342275cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3423acc55ba8SStefan Weil#endif
3424d2042378SAneesh Kumar K.VEOF
3425d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
3426d2042378SAneesh Kumar K.V    open_by_handle_at=yes
3427d2042378SAneesh Kumar K.Vfi
3428d2042378SAneesh Kumar K.V
3429e06a765eSHarsh Prateek Bora########################################
3430e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
3431e06a765eSHarsh Prateek Bora
3432e06a765eSHarsh Prateek Boralinux_magic_h=no
3433e06a765eSHarsh Prateek Boracat > $TMPC << EOF
3434e06a765eSHarsh Prateek Bora#include <linux/magic.h>
3435e06a765eSHarsh Prateek Boraint main(void) {
343675cafad7SStefan Weil  return 0;
3437e06a765eSHarsh Prateek Bora}
3438e06a765eSHarsh Prateek BoraEOF
3439e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
3440e06a765eSHarsh Prateek Bora    linux_magic_h=yes
3441e06a765eSHarsh Prateek Borafi
3442e06a765eSHarsh Prateek Bora
34438ab1bf12SLuiz Capitulino########################################
3444c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed
3445c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries).
3446c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is
3447c95e3080SKevin Wolf# only a warning.
3448c95e3080SKevin Wolf#
3449c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that
3450c95e3080SKevin Wolf# the build doesn't fail anyway.
3451c95e3080SKevin Wolf
345206d71fa1SPeter Maydellpragma_disable_unused_but_set=no
345306d71fa1SPeter Maydellcat > $TMPC << EOF
3454e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push
345506d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3456c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes"
3457e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop
3458c95e3080SKevin Wolf
345906d71fa1SPeter Maydellint main(void) {
346006d71fa1SPeter Maydell    return 0;
346106d71fa1SPeter Maydell}
346206d71fa1SPeter MaydellEOF
346306d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then
3464cc6e3ca9SGerd Hoffmann    pragma_diagnostic_available=yes
3465c95e3080SKevin Wolfelse
3466c95e3080SKevin Wolf    werror=no
346706d71fa1SPeter Maydellfi
346806d71fa1SPeter Maydell
346906d71fa1SPeter Maydell########################################
347062fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h
34713f4349dcSKevin Wolf
34723f4349dcSKevin Wolfvalgrind_h=no
34733f4349dcSKevin Wolfcat > $TMPC << EOF
34743f4349dcSKevin Wolf#include <valgrind/valgrind.h>
347562fe8331SChristian Borntraeger#include <valgrind/memcheck.h>
34763f4349dcSKevin Wolfint main(void) {
34773f4349dcSKevin Wolf  return 0;
34783f4349dcSKevin Wolf}
34793f4349dcSKevin WolfEOF
34803f4349dcSKevin Wolfif compile_prog "" "" ; then
34813f4349dcSKevin Wolf    valgrind_h=yes
34823f4349dcSKevin Wolffi
34833f4349dcSKevin Wolf
34843f4349dcSKevin Wolf########################################
34858ab1bf12SLuiz Capitulino# check if environ is declared
34868ab1bf12SLuiz Capitulino
34878ab1bf12SLuiz Capitulinohas_environ=no
34888ab1bf12SLuiz Capitulinocat > $TMPC << EOF
34898ab1bf12SLuiz Capitulino#include <unistd.h>
34908ab1bf12SLuiz Capitulinoint main(void) {
3491c075a723SBlue Swirl    environ = 0;
34928ab1bf12SLuiz Capitulino    return 0;
34938ab1bf12SLuiz Capitulino}
34948ab1bf12SLuiz CapitulinoEOF
34958ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
34968ab1bf12SLuiz Capitulino    has_environ=yes
34978ab1bf12SLuiz Capitulinofi
34988ab1bf12SLuiz Capitulino
349976a347e1SRichard Henderson########################################
350076a347e1SRichard Henderson# check if cpuid.h is usable.
350176a347e1SRichard Henderson
350276a347e1SRichard Hendersoncpuid_h=no
350376a347e1SRichard Hendersoncat > $TMPC << EOF
350476a347e1SRichard Henderson#include <cpuid.h>
350576a347e1SRichard Hendersonint main(void) {
350676a347e1SRichard Henderson  return 0;
350776a347e1SRichard Henderson}
350876a347e1SRichard HendersonEOF
350976a347e1SRichard Hendersonif compile_prog "" "" ; then
351076a347e1SRichard Henderson    cpuid_h=yes
351176a347e1SRichard Hendersonfi
351276a347e1SRichard Henderson
3513f540166bSRichard Henderson########################################
3514f540166bSRichard Henderson# check if __[u]int128_t is usable.
3515f540166bSRichard Henderson
3516f540166bSRichard Hendersonint128=no
3517f540166bSRichard Hendersoncat > $TMPC << EOF
3518f540166bSRichard Henderson__int128_t a;
3519f540166bSRichard Henderson__uint128_t b;
3520f540166bSRichard Hendersonint main (void) {
3521f540166bSRichard Henderson  a = a + b;
3522f540166bSRichard Henderson  b = a * b;
3523464e3671SPeter Maydell  a = a * a;
3524f540166bSRichard Henderson  return 0;
3525f540166bSRichard Henderson}
3526f540166bSRichard HendersonEOF
3527f540166bSRichard Hendersonif compile_prog "" "" ; then
3528f540166bSRichard Henderson    int128=yes
3529f540166bSRichard Hendersonfi
353076a347e1SRichard Henderson
35311e6e9acaSRichard Henderson########################################
35321e6e9acaSRichard Henderson# check if getauxval is available.
35331e6e9acaSRichard Henderson
35341e6e9acaSRichard Hendersongetauxval=no
35351e6e9acaSRichard Hendersoncat > $TMPC << EOF
35361e6e9acaSRichard Henderson#include <sys/auxv.h>
35371e6e9acaSRichard Hendersonint main(void) {
35381e6e9acaSRichard Henderson  return getauxval(AT_HWCAP) == 0;
35391e6e9acaSRichard Henderson}
35401e6e9acaSRichard HendersonEOF
35411e6e9acaSRichard Hendersonif compile_prog "" "" ; then
35421e6e9acaSRichard Henderson    getauxval=yes
35431e6e9acaSRichard Hendersonfi
35441e6e9acaSRichard Henderson
3545d2042378SAneesh Kumar K.V##########################################
3546e86ecd4bSJuan Quintela# End of CC checks
3547e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
3548e86ecd4bSJuan Quintela
35491d728c39SBlue Swirlif test "$gcov" = "yes" ; then
35501d728c39SBlue Swirl  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
35511d728c39SBlue Swirl  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
35521d728c39SBlue Swirlelif test "$debug" = "no" ; then
3553e600cdf3SMichal Privoznik  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
3554e86ecd4bSJuan Quintelafi
3555a316e378SJuan Quintela
35561d728c39SBlue Swirl
355720ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
355820ff6c80SAnthony Liguori# enable/disable
355920ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
356020ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
356120ff6c80SAnthony Liguori	zero_malloc="no"
356220ff6c80SAnthony Liguori    else
356320ff6c80SAnthony Liguori	zero_malloc="yes"
356420ff6c80SAnthony Liguori    fi
356520ff6c80SAnthony Liguorifi
356620ff6c80SAnthony Liguori
35676ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags
35686ca026cbSPeter Maydellif test "$werror" = "yes"; then
35696ca026cbSPeter Maydell    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
35706ca026cbSPeter Maydellfi
35716ca026cbSPeter Maydell
3572e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
3573e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
35741156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
3575e86ecd4bSJuan Quintela    fi
3576e86ecd4bSJuan Quintelafi
3577e86ecd4bSJuan Quintela
357894dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
357994dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
358094dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
358194dd53c5SGerd Hoffmannelse
358294dd53c5SGerd Hoffmann    POD2MAN="pod2man"
358394dd53c5SGerd Hoffmannfi
358494dd53c5SGerd Hoffmann
3585952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
3586952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
3587952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
3588952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3589952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
3590952afb71SBlue Swirl        fi
3591952afb71SBlue Swirl    done
3592952afb71SBlue Swirlfi
3593952afb71SBlue Swirl
359410ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
3595528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
3596834574eaSAnthony Liguoriqemu_localedir="$datadir/locale"
35975a67135aSbellard
35984b1c11fdSDaniel P. Berrangetools=""
35994b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then
3600ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
36014b1c11fdSDaniel P. Berrange  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
36024b1c11fdSDaniel P. Berrange    tools="qemu-nbd\$(EXESUF) $tools"
36034b1c11fdSDaniel P. Berrange  fi
36044b1c11fdSDaniel P. Berrangefi
36054b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then
3606983eef5aSMeador Inge  if test "$virtfs" != no ; then
3607be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3608983eef5aSMeador Inge      virtfs=yes
360917bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3610983eef5aSMeador Inge    else
3611983eef5aSMeador Inge      if test "$virtfs" = yes; then
361276ad07a4SPeter Maydell        error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3613983eef5aSMeador Inge      fi
361417500370SAndreas Färber      virtfs=no
3615983eef5aSMeador Inge    fi
361617bff52bSM. Mohan Kumar  fi
3617d138cee9SMichael Rothfi
3618e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then
3619b39297aeSTomoki Sekiyama  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
3620e8ef31a3SMichael Tokarev      tools="qemu-ga\$(EXESUF) $tools"
3621b39297aeSTomoki Sekiyama      if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3622b39297aeSTomoki Sekiyama        tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3623b39297aeSTomoki Sekiyama      fi
3624e8ef31a3SMichael Tokarev      guest_agent=yes
3625e8ef31a3SMichael Tokarev  elif [ "$guest_agent" != yes ]; then
3626e8ef31a3SMichael Tokarev      guest_agent=no
3627e8ef31a3SMichael Tokarev  else
3628e8ef31a3SMichael Tokarev      error_exit "Guest agent is not supported on this platform"
3629ca35f780SPaolo Bonzini  fi
36304b1c11fdSDaniel P. Berrangefi
3631ca35f780SPaolo Bonzini
3632ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
3633ca35f780SPaolo Bonziniroms=
3634ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3635ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3636ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
3637ca35f780SPaolo Bonzini  roms="optionrom"
3638ca35f780SPaolo Bonzinifi
3639d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
364039ac8455SDavid Gibson  roms="$roms spapr-rtas"
364139ac8455SDavid Gibsonfi
3642ca35f780SPaolo Bonzini
36439933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then
36449933c305SChristian Borntraeger  roms="$roms s390-ccw"
36459933c305SChristian Borntraegerfi
36469933c305SChristian Borntraeger
3647964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary.
3648964c6fa1SRichard Hendersonif test "$pie" = "no" ; then
3649964c6fa1SRichard Henderson  textseg_addr=
3650964c6fa1SRichard Henderson  case "$cpu" in
3651c72b26ecSRichard Henderson    arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
3652964c6fa1SRichard Henderson      textseg_addr=0x60000000
3653964c6fa1SRichard Henderson      ;;
3654964c6fa1SRichard Henderson    mips)
3655964c6fa1SRichard Henderson      textseg_addr=0x400000
3656964c6fa1SRichard Henderson      ;;
3657964c6fa1SRichard Henderson  esac
3658964c6fa1SRichard Henderson  if [ -n "$textseg_addr" ]; then
3659964c6fa1SRichard Henderson    cat > $TMPC <<EOF
3660964c6fa1SRichard Henderson    int main(void) { return 0; }
3661964c6fa1SRichard HendersonEOF
3662964c6fa1SRichard Henderson    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3663964c6fa1SRichard Henderson    if ! compile_prog "" "$textseg_ldflags"; then
3664964c6fa1SRichard Henderson      # In case ld does not support -Ttext-segment, edit the default linker
3665964c6fa1SRichard Henderson      # script via sed to set the .text start addr.  This is needed on FreeBSD
3666964c6fa1SRichard Henderson      # at least.
3667964c6fa1SRichard Henderson      $ld --verbose | sed \
3668964c6fa1SRichard Henderson        -e '1,/==================================================/d' \
3669964c6fa1SRichard Henderson        -e '/==================================================/,$d' \
3670964c6fa1SRichard Henderson        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3671964c6fa1SRichard Henderson        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3672964c6fa1SRichard Henderson      textseg_ldflags="-Wl,-T../config-host.ld"
3673964c6fa1SRichard Henderson    fi
3674964c6fa1SRichard Henderson  fi
3675964c6fa1SRichard Hendersonfi
3676964c6fa1SRichard Henderson
36775ca9388aSGerd Hoffmann# add pixman flags after all config tests are done
3678a540f158SPeter CrosthwaiteQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
36795ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs"
36805ca9388aSGerd Hoffmann
36817d13299dSbellardecho "Install prefix    $prefix"
3682c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
3683f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
36843aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
36858bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`"
36860f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
36871c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
368811d9f695Sbellardif test "$mingw32" = "no" ; then
36895a699bbbSLaszlo Ersekecho "local state directory   `eval echo $local_statedir`"
3690f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
369143ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
36925a699bbbSLaszlo Ersekelse
36935a699bbbSLaszlo Ersekecho "local state directory   queried at runtime"
3694d9840e25STomoki Sekiyamaecho "Windows SDK       $win_sdk"
369511d9f695Sbellardfi
36965a67135aSbellardecho "Source path       $source_path"
36977d13299dSbellardecho "C compiler        $cc"
369883469015Sbellardecho "Host C compiler   $host_cc"
369983f73fceSTomoki Sekiyamaecho "C++ compiler      $cxx"
37003c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc"
370145d285abSPeter Maydellecho "ARFLAGS           $ARFLAGS"
37020c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
3703a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
37040c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
37057d13299dSbellardecho "make              $make"
37066a882643Spbrookecho "install           $install"
3707c886edfbSBlue Swirlecho "python            $python"
3708e2d8830eSBradif test "$slirp" = "yes" ; then
3709e2d8830eSBrad    echo "smbd              $smbd"
3710e2d8830eSBradfi
3711a98fd896Sbellardecho "host CPU          $cpu"
3712de83cd02Sbellardecho "host big endian   $bigendian"
371397a847bcSbellardecho "target list       $target_list"
3714ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
37157d13299dSbellardecho "gprof enabled     $gprof"
371603b4fe7dSaliguoriecho "sparse enabled    $sparse"
37171625af87Saliguoriecho "strip binaries    $strip_opt"
371805c2a3e7Sbellardecho "profiler          $profiler"
371943ce4dfeSbellardecho "static build      $static"
372085aa5189Sbellardecho "-Werror enabled   $werror"
37215b0753e0Sbellardif test "$darwin" = "yes" ; then
37225b0753e0Sbellard    echo "Cocoa support     $cocoa"
37235b0753e0Sbellardfi
3724e2134eb9SGerd Hoffmannecho "pixman            $pixman"
372597a847bcSbellardecho "SDL support       $sdl"
3726a4ccabcfSAnthony Liguoriecho "GTK support       $gtk"
37274d3b6f6eSbalrogecho "curses support    $curses"
3728769ce76dSAlexander Grafecho "curl support      $curl"
372967b915a5Sbellardecho "mingw32 support   $mingw32"
37300c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
3731b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist"
3732b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist"
3733983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3734821601eaSJes Sorensenecho "VNC support       $vnc"
3735821601eaSJes Sorensenif test "$vnc" = "yes" ; then
37368d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
37372f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
37382f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3739efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
37407536ee4bSTim Hardeck    echo "VNC WS support    $vnc_ws"
3741821601eaSJes Sorensenfi
37423142255cSblueswir1if test -n "$sparc_cpu"; then
37433142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
37443142255cSblueswir1fi
3745e37630caSaliguoriecho "xen support       $xen"
37462e4d9fb1Saurel32echo "brlapi support    $brlapi"
3747a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3748a25dba17SJuan Quintelaecho "Documentation     $docs"
3749c5937220Spbrook[ ! -z "$uname_release" ] && \
3750c5937220Spbrookecho "uname -r          $uname_release"
3751379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
375240d6444eSAvi Kivityecho "PIE               $pie"
37538a16d273Sthsecho "vde support       $vde"
37545c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3755758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
375677755340Sthsecho "Install blobs     $blobs"
3757b31a0277SJuan Quintelaecho "KVM support       $kvm"
37582da776dbSMichael R. Hinesecho "RDMA support      $rdma"
37599195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3760f652e6afSaurel32echo "fdt support       $fdt"
3761ceb42de8Saliguoriecho "preadv support    $preadv"
37625f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3763e78815a5SAndreas Färberecho "madvise           $madvise"
3764e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
37651e9737daSRichard Hendersonecho "sigev_thread_id   $sigev_thread_id"
3766ee682d27SStefan Weilecho "uuid support      $uuid"
376747e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3768d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
37695e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi"
377094a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
37719410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
37722e0e3c39SAlon Levyecho "spice support     $spice ($spice_protocol_version/$spice_server_version)"
3773f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3774dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3775111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
37762b2325ffSGerd Hoffmannecho "libusb            $libusb"
377769354a83SHans de Goedeecho "usb net redir     $usb_redir"
3778b1e5fff4SMichael Walleecho "GLX support       $glx"
3779c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3780d138cee9SMichael Rothecho "build guest agent $guest_agent"
3781d9840e25STomoki Sekiyamaecho "QGA VSS support   $guest_agent_with_vss"
3782f794573eSEduardo Otuboecho "seccomp support   $seccomp"
37837c2acc70SPeter Maydellecho "coroutine backend $coroutine"
378470c60c08SStefan Hajnocziecho "coroutine pool    $coroutine_pool"
3785eb100396SBharata B Raoecho "GlusterFS support $glusterfs"
3786583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane"
37871d728c39SBlue Swirlecho "gcov              $gcov_tool"
37881d728c39SBlue Swirlecho "gcov enabled      $gcov"
3789ab214c29SStefan Bergerecho "TPM support       $tpm"
37900a12ec87SRichard W.M. Jonesecho "libssh2 support   $libssh2"
37913b8acc11SPaolo Bonziniecho "TPM passthrough   $tpm_passthrough"
37923556c233SPaolo Bonziniecho "QOM debugging     $qom_cast_debug"
37934f18b782SJeff Codyecho "vhdx              $vhdx"
379467b915a5Sbellard
37951ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
379624b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3797e8cd23deSbellardfi
379897a847bcSbellard
379998ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
380097a847bcSbellard
3801dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak
3802dbd99ae3SStefan Weil
380398ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
380498ec69acSJuan Quintelaecho >> $config_host_mak
380598ec69acSJuan Quintela
3806e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
380799d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
380899d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
38093aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
38108bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak
38110f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
381299d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
381399d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
381422d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
38159afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
38169afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
38175a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then
3818785c23aeSLuiz Capitulino  echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
38195a699bbbSLaszlo Ersekfi
3820f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak
3821f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
3822f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
3823834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak
3824f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak
3825804edf29SJuan Quintela
382698ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3827727e5283SPaolo Bonzini
3828f8393946Saurel32if test "$debug_tcg" = "yes" ; then
38292358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3830f8393946Saurel32fi
38311625af87Saliguoriif test "$strip_opt" = "yes" ; then
383252ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
38331625af87Saliguorifi
38347d13299dSbellardif test "$bigendian" = "yes" ; then
3835e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
383697a847bcSbellardfi
383767b915a5Sbellardif test "$mingw32" = "yes" ; then
383898ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
38399fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
38409fe6de94SBlue Swirl  version_major=${rc_version%%.*}
38419fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38429fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
38439fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38449fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
38459fe6de94SBlue Swirl  version_micro=0
38469fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
38479fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3848d9840e25STomoki Sekiyama  if test "$guest_agent_with_vss" = "yes" ; then
3849d9840e25STomoki Sekiyama    echo "CONFIG_QGA_VSS=y" >> $config_host_mak
3850d9840e25STomoki Sekiyama    echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
3851d9840e25STomoki Sekiyama  fi
3852210fa556Spbrookelse
385335f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3854210fa556Spbrookfi
3855128ab2ffSblueswir1
3856dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3857dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3858dffcb71cSMark McLoughlinfi
3859dffcb71cSMark McLoughlin
386083fb7adfSbellardif test "$darwin" = "yes" ; then
386198ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
386283fb7adfSbellardfi
3863b29fe3edSmalc
3864b29fe3edSmalcif test "$aix" = "yes" ; then
386598ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3866b29fe3edSmalcfi
3867b29fe3edSmalc
3868ec530c81Sbellardif test "$solaris" = "yes" ; then
386998ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
38702358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
38710475a5caSths  if test "$needs_libsunmath" = "yes" ; then
387275b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
38730475a5caSths  fi
3874ec530c81Sbellardfi
3875179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3876179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3877179cf400SAndreas Färberfi
387897a847bcSbellardif test "$static" = "yes" ; then
387998ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
388097a847bcSbellardfi
38811ba16968SStefan Weilif test "$profiler" = "yes" ; then
38822358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
388305c2a3e7Sbellardfi
3884c20709aaSbellardif test "$slirp" = "yes" ; then
388598ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3886e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3887c20709aaSbellardfi
38888a16d273Sthsif test "$vde" = "yes" ; then
388998ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
38908a16d273Sthsfi
389147e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
389247e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
389347e98658SCorey Bryantfi
38942358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
38950c58ac1cSmalcfor drv in $audio_drv_list; do
3896bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
389798ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3898923e4521Smalc    if test "$drv" = "fmod"; then
38997aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3900fb065187Sbellard    fi
39010c58ac1cSmalcdone
390267f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
390367f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
390467f86e8eSJuan Quintelafi
3905d5631638Smalcif test "$audio_win_int" = "yes" ; then
3906d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3907d5631638Smalcfi
3908b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
3909b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
3910821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3911821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3912821601eaSJes Sorensenfi
39138d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
391498ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
39158d5d2d4cSthsfi
39162f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
391798ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
39182f9606b3Saliguorifi
3919821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
39202f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
39212f6f5c7aSCorentin Charyfi
3922821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3923efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3924efe556adSCorentin Charyfi
39257536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then
39267536ee4bSTim Hardeck  echo "CONFIG_VNC_WS=y" >> $config_host_mak
39277536ee4bSTim Hardeck  echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
39287536ee4bSTim Hardeckfi
392976655d6dSaliguoriif test "$fnmatch" = "yes" ; then
39302358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
393176655d6dSaliguorifi
3932ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3933ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3934ee682d27SStefan Weilfi
3935dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3936dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3937dce512deSChristoph Hellwigfi
3938b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
393998ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
39402358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
394198ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
394298ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3943a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
394498ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3945cc8ae6deSpbrookfi
39461ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
394798ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
39488ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
394949ecc3faSbellardfi
395049ecc3faSbellardif test "$cocoa" = "yes" ; then
395198ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
395249ecc3faSbellardfi
39534d3b6f6eSbalrogif test "$curses" = "yes" ; then
395498ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3955ab4e5602SJan Kiszkafi
3956ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
39572358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3958ebc996f3SRiku Voipiofi
3959099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
39602358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3961099d6b0fSRiku Voipiofi
396240ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
396340ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
396440ff6d7eSKevin Wolffi
39653ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
39662358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
39673ce34dfbSvibisreenivasanfi
3968c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3969c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3970c2882b96SRiku Voipiofi
3971d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3972d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3973d0927938SUlrich Hechtfi
39743d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then
39753d4fa43eSKusanagi Kouichi  echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
39763d4fa43eSKusanagi Kouichifi
3977c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3978c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3979c727f47dSPeter Maydellfi
3980dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3981dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3982dace20dcSPeter Maydellfi
3983d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3984d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3985d0927938SUlrich Hechtfi
39864e0c6529SAlex Blighif test "$ppoll" = "yes" ; then
39874e0c6529SAlex Bligh  echo "CONFIG_PPOLL=y" >> $config_host_mak
39884e0c6529SAlex Blighfi
3989cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then
3990cd758dd0SAlex Bligh  echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
3991cd758dd0SAlex Blighfi
39923b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
39933b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
39943b6edd16SPeter Maydellfi
39953b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
39963b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
39973b6edd16SPeter Maydellfi
39983b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
39993b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
40003b6edd16SPeter Maydellfi
4001a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then
4002a8fd1abaSPeter Maydell  echo "CONFIG_SENDFILE=y" >> $config_host_mak
4003a8fd1abaSPeter Maydellfi
40043b3f24adSaurel32if test "$inotify" = "yes" ; then
40052358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
40063b3f24adSaurel32fi
4007c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
4008c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
4009c05c7a73SRiku Voipiofi
40106ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
40116ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
40126ae9a1f4SJuan Quintelafi
40136ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
40146ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
40156ae9a1f4SJuan Quintelafi
4016769ce76dSAlexander Grafif test "$curl" = "yes" ; then
401798ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
4018b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
4019769ce76dSAlexander Graffi
40202e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
402198ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
40222e4d9fb1Saurel32fi
4023fb599c9aSbalrogif test "$bluez" = "yes" ; then
402498ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
4025ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
4026fb599c9aSbalrogfi
4027e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
4028a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then
4029a4ccabcfSAnthony Liguori  echo "CONFIG_GTK=y" >> $config_host_mak
4030a4ccabcfSAnthony Liguori  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
4031a4ccabcfSAnthony Liguori  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
4032a4ccabcfSAnthony Liguorifi
4033e37630caSaliguoriif test "$xen" = "yes" ; then
40346dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4035d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4036e37630caSaliguorifi
40375c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
40385c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
40395c6c3a6cSChristoph Hellwigfi
4040758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
4041758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
4042758e8e38SVenkateswararao Jujjuri (JV)fi
40434f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
40444f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
40454f26f2b6SAvi Kivityfi
4046983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
4047758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
4048758e8e38SVenkateswararao Jujjuri (JV)fi
40495e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then
40505e9be92dSNicholas Bellinger  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
40515e9be92dSNicholas Bellingerfi
405277755340Sthsif test "$blobs" = "yes" ; then
405398ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
405477755340Sthsfi
4055bf9298b9Saliguoriif test "$iovec" = "yes" ; then
40562358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
4057bf9298b9Saliguorifi
4058ceb42de8Saliguoriif test "$preadv" = "yes" ; then
40592358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
4060ceb42de8Saliguorifi
4061f652e6afSaurel32if test "$fdt" = "yes" ; then
40623f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
4063f652e6afSaurel32fi
4064dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
4065dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4066dcc38d1cSMarcelo Tosattifi
40679195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
40689195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
40699195b2c2SStefan Weilfi
40705f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
40715f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
40725f6b9e8fSBlue Swirlfi
4073e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
4074e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
4075e78815a5SAndreas Färberfi
4076e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
4077e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4078e78815a5SAndreas Färberfi
40791e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then
40801e9737daSRichard Henderson  echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
40811e9737daSRichard Hendersonfi
408297a847bcSbellard
4083cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
4084cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
4085cd4ec0b4SGerd Hoffmannfi
4086cd4ec0b4SGerd Hoffmann
4087111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
4088111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
4089ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4090ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
4091111a38b0SRobert Relyeafi
4092111a38b0SRobert Relyea
40932b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then
40942b2325ffSGerd Hoffmann  echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
40952b2325ffSGerd Hoffmannfi
40962b2325ffSGerd Hoffmann
409769354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
409869354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
409969354a83SHans de Goedefi
410069354a83SHans de Goede
4101b1e5fff4SMichael Walleif test "$glx" = "yes" ; then
4102b1e5fff4SMichael Walle  echo "CONFIG_GLX=y" >> $config_host_mak
41032b6b7099SPaolo Bonzini  echo "GLX_LIBS=$glx_libs" >> $config_host_mak
410420ff075bSMichael Wallefi
410520ff075bSMichael Walle
4106c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
4107c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
4108c589b249SRonnie Sahlbergfi
4109c589b249SRonnie Sahlberg
4110f794573eSEduardo Otuboif test "$seccomp" = "yes"; then
4111f794573eSEduardo Otubo  echo "CONFIG_SECCOMP=y" >> $config_host_mak
4112f794573eSEduardo Otubofi
4113f794573eSEduardo Otubo
411483fb7adfSbellard# XXX: suppress that
41157d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
41162358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
41177d3505c5Sbellardfi
41187d3505c5Sbellard
41192358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
4120c5937220Spbrook
412120ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
412220ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
412320ff6c80SAnthony Liguorifi
41243556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then
41253556c233SPaolo Bonzini  echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
41263556c233SPaolo Bonzinifi
4127f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
4128f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
4129f27aaf4bSChristian Brunnerfi
413020ff6c80SAnthony Liguori
41317c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
413270c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then
413370c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
413470c60c08SStefan Hajnoczielse
413570c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
413670c60c08SStefan Hajnoczifi
4137d0e2fce5SAneesh Kumar K.V
4138d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
4139d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4140d2042378SAneesh Kumar K.Vfi
4141d2042378SAneesh Kumar K.V
4142e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
4143e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4144e06a765eSHarsh Prateek Borafi
4145e06a765eSHarsh Prateek Bora
4146cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then
4147cc6e3ca9SGerd Hoffmann  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
414806d71fa1SPeter Maydellfi
414906d71fa1SPeter Maydell
41503f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then
41513f4349dcSKevin Wolf  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
41523f4349dcSKevin Wolffi
41533f4349dcSKevin Wolf
41548ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
41558ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
41568ab1bf12SLuiz Capitulinofi
41578ab1bf12SLuiz Capitulino
415876a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then
415976a347e1SRichard Henderson  echo "CONFIG_CPUID_H=y" >> $config_host_mak
416076a347e1SRichard Hendersonfi
416176a347e1SRichard Henderson
4162f540166bSRichard Hendersonif test "$int128" = "yes" ; then
4163f540166bSRichard Henderson  echo "CONFIG_INT128=y" >> $config_host_mak
4164f540166bSRichard Hendersonfi
4165f540166bSRichard Henderson
41661e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then
41671e6e9acaSRichard Henderson  echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
41681e6e9acaSRichard Hendersonfi
41691e6e9acaSRichard Henderson
4170eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then
4171eb100396SBharata B Rao  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
4172eb100396SBharata B Raofi
4173eb100396SBharata B Rao
41740c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then
41750c14fb47SBharata B Rao  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
41760c14fb47SBharata B Raofi
41770c14fb47SBharata B Rao
41780a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then
41790a12ec87SRichard W.M. Jones  echo "CONFIG_LIBSSH2=y" >> $config_host_mak
41800a12ec87SRichard W.M. Jonesfi
41810a12ec87SRichard W.M. Jones
4182583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then
41836e790746SPaolo Bonzini  echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
4184583f6e7bSStefan Hajnoczifi
4185583f6e7bSStefan Hajnoczi
41864f18b782SJeff Codyif test "$vhdx" = "yes" ; then
41874f18b782SJeff Cody  echo "CONFIG_VHDX=y" >> $config_host_mak
41884f18b782SJeff Codyfi
41894f18b782SJeff Cody
419068063649Sblueswir1# USB host support
4191b5613fdcSGerd Hoffmannif test "$libusb" = "yes"; then
41922b2325ffSGerd Hoffmann  echo "HOST_USB=libusb legacy" >> $config_host_mak
4193b5613fdcSGerd Hoffmannelse
419498ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
4195b5613fdcSGerd Hoffmannfi
419668063649Sblueswir1
41973b8acc11SPaolo Bonzini# TPM passthrough support?
41983b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then
41993b8acc11SPaolo Bonzini  echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
42003b8acc11SPaolo Bonzini  if test "$tpm_passthrough" = "yes"; then
42013b8acc11SPaolo Bonzini    echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
42023b8acc11SPaolo Bonzini  fi
42033b8acc11SPaolo Bonzinifi
42043b8acc11SPaolo Bonzini
4205e4858974SLluís# use default implementation for tracing backend-specific routines
4206e4858974SLluístrace_default=yes
420794a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
42086d8a764eSLluísif test "$trace_backend" = "nop"; then
42096d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
421022890ab5SPrerna Saxenafi
42119410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
42126d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
4213e4858974SLluís  trace_default=no
42146d8a764eSLluís  # Set the appropriate trace file.
4215953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
42169410b56cSPrerna Saxenafi
42176d8a764eSLluísif test "$trace_backend" = "stderr"; then
42186d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
42199a82b6a5SLluís  trace_default=no
42206d8a764eSLluísfi
42216d8a764eSLluísif test "$trace_backend" = "ust"; then
42226d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
42236d8a764eSLluísfi
42246d8a764eSLluísif test "$trace_backend" = "dtrace"; then
42256d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
42266d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
42276d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
42286d8a764eSLluís  fi
4229c276b17dSDaniel P. Berrangefi
4230781e9545SEiichi Tsukataif test "$trace_backend" = "ftrace"; then
4231781e9545SEiichi Tsukata  if test "$linux" = "yes" ; then
4232781e9545SEiichi Tsukata    echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4233781e9545SEiichi Tsukata    trace_default=no
4234781e9545SEiichi Tsukata  else
4235781e9545SEiichi Tsukata    feature_not_found "ftrace(trace backend)"
4236781e9545SEiichi Tsukata  fi
4237781e9545SEiichi Tsukatafi
42389410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
4239e4858974SLluísif test "$trace_default" = "yes"; then
4240e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4241e4858974SLluísfi
42429410b56cSPrerna Saxena
42432da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
42442da776dbSMichael R. Hines  echo "CONFIG_RDMA=y" >> $config_host_mak
42452da776dbSMichael R. Hinesfi
42462da776dbSMichael R. Hines
42475b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then
42485b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
42495b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then
42505b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
42515b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then
42525b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
4253c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
42545b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
42555b5e3037SPaolo Bonzinielse
42565b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
42575b5e3037SPaolo Bonzinifi
42585b5e3037SPaolo BonziniQEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
42595b5e3037SPaolo Bonzini
426098ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
426198ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
4262804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
4263804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
42641901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
42651901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
426621655882SPaolo Bonziniif test -n "$libtool"; then
426721655882SPaolo Bonzini  echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
426821655882SPaolo Bonzini  echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
426921655882SPaolo Bonzinielse
42701901cb14SBrad  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
427121655882SPaolo Bonzini  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
427221655882SPaolo Bonzinifi
4273c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
4274804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
4275a31a8642SMichael S. Tsirkinif $iasl -h > /dev/null 2>&1; then
4276a31a8642SMichael S. Tsirkin  echo "IASL=$iasl" >> $config_host_mak
4277a31a8642SMichael S. Tsirkinfi
42782b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
4279804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
428083f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak
42813c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak
4282804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
428345d285abSPeter Maydellecho "ARFLAGS=$ARFLAGS" >> $config_host_mak
42843dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak
42853dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak
4286804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
4287804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
42889fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
428944dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
4290e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
4291a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
4292f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
4293e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
4294e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
4295e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
4296e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4297e39f0062SPaolo Bonzinifi
429842da6041SGerd Hoffmannif test "$cross_prefix" != ""; then
429942da6041SGerd Hoffmann  echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
430042da6041SGerd Hoffmannelse
430142da6041SGerd Hoffmann  echo "AUTOCONF_HOST := "                             >> $config_host_mak
430242da6041SGerd Hoffmannfi
4303e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
430437746c5eSMarc-André Lureauecho "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
430573da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
43063e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
4307804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
4308957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
430994dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
4310cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
43111d728c39SBlue Swirlif test "$gcov" = "yes" ; then
43121d728c39SBlue Swirl  echo "CONFIG_GCOV=y" >> $config_host_mak
43131d728c39SBlue Swirl  echo "GCOV=$gcov_tool" >> $config_host_mak
43141d728c39SBlue Swirlfi
4315804edf29SJuan Quintela
43166efd7517SPeter Maydell# use included Linux headers
43176efd7517SPeter Maydellif test "$linux" = "yes" ; then
4318a307beb6SAndreas Färber  mkdir -p linux-headers
43196efd7517SPeter Maydell  case "$cpu" in
4320c72b26ecSRichard Henderson  i386|x86_64|x32)
432108312a63SPeter Maydell    linux_arch=x86
43226efd7517SPeter Maydell    ;;
43236efd7517SPeter Maydell  ppcemb|ppc|ppc64)
432408312a63SPeter Maydell    linux_arch=powerpc
43256efd7517SPeter Maydell    ;;
43266efd7517SPeter Maydell  s390x)
432708312a63SPeter Maydell    linux_arch=s390
432808312a63SPeter Maydell    ;;
43291f080313SClaudio Fontana  aarch64)
43301f080313SClaudio Fontana    linux_arch=arm64
43311f080313SClaudio Fontana    ;;
433208312a63SPeter Maydell  *)
433308312a63SPeter Maydell    # For most CPUs the kernel architecture name and QEMU CPU name match.
433408312a63SPeter Maydell    linux_arch="$cpu"
43356efd7517SPeter Maydell    ;;
43366efd7517SPeter Maydell  esac
433708312a63SPeter Maydell    # For non-KVM architectures we will not have asm headers
433808312a63SPeter Maydell    if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
433908312a63SPeter Maydell      symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
434008312a63SPeter Maydell    fi
43416efd7517SPeter Maydellfi
43426efd7517SPeter Maydell
434397a847bcSbellardfor target in $target_list; do
434497a847bcSbellardtarget_dir="$target"
434525be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
4346c1799a84SPaolo Bonzinitarget_name=`echo $target | cut -d '-' -f 1`
434797a847bcSbellardtarget_bigendian="no"
43481f3d3c8fSJuan Quintela
4349c1799a84SPaolo Bonzinicase "$target_name" in
4350d15a9c23SAnthony Green  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
4351ea2d6a39SJuan Quintela  target_bigendian=yes
4352ea2d6a39SJuan Quintela  ;;
4353ea2d6a39SJuan Quintelaesac
435497a847bcSbellardtarget_softmmu="no"
4355997344f3Sbellardtarget_user_only="no"
4356831b7825Sthstarget_linux_user="no"
435784778508Sblueswir1target_bsd_user="no"
43589e407a85Spbrookcase "$target" in
4359c1799a84SPaolo Bonzini  ${target_name}-softmmu)
43609e407a85Spbrook    target_softmmu="yes"
43619e407a85Spbrook    ;;
4362c1799a84SPaolo Bonzini  ${target_name}-linux-user)
43639c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
436476ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a Linux host"
43659c7a4202SBlue Swirl    fi
43669e407a85Spbrook    target_user_only="yes"
43679e407a85Spbrook    target_linux_user="yes"
43689e407a85Spbrook    ;;
4369c1799a84SPaolo Bonzini  ${target_name}-bsd-user)
43709cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
437176ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a BSD host"
43729c7a4202SBlue Swirl    fi
437384778508Sblueswir1    target_user_only="yes"
437484778508Sblueswir1    target_bsd_user="yes"
437584778508Sblueswir1    ;;
43769e407a85Spbrook  *)
437776ad07a4SPeter Maydell    error_exit "Target '$target' not recognised"
43789e407a85Spbrook    exit 1
43799e407a85Spbrook    ;;
43809e407a85Spbrookesac
4381831b7825Sths
438297a847bcSbellardmkdir -p $target_dir
438325be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
438497a847bcSbellard
4385e5fe0c52Spbrookbflt="no"
4386c1799a84SPaolo Bonziniinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
438756aebc89Spbrookgdb_xml_files=""
43887ba1e619Saliguori
4389c1799a84SPaolo BonziniTARGET_ARCH="$target_name"
43906acff7daSJuan QuintelaTARGET_BASE_ARCH=""
4391e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
4392e73aae67SJuan Quintela
4393c1799a84SPaolo Bonzinicase "$target_name" in
43942408a527Saurel32  i386)
43952408a527Saurel32  ;;
43962408a527Saurel32  x86_64)
43976acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
43982408a527Saurel32  ;;
43992408a527Saurel32  alpha)
44002408a527Saurel32  ;;
44012408a527Saurel32  arm|armeb)
4402b498c8a0SJuan Quintela    TARGET_ARCH=arm
4403e5fe0c52Spbrook    bflt="yes"
440456aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
44052408a527Saurel32  ;;
44066a49fa95SAlexander Graf  aarch64)
44076a49fa95SAlexander Graf    TARGET_BASE_ARCH=arm
44086a49fa95SAlexander Graf    bflt="yes"
44096a49fa95SAlexander Graf    gdb_xml_files="aarch64-core.xml"
44106a49fa95SAlexander Graf  ;;
44112408a527Saurel32  cris)
44122408a527Saurel32  ;;
4413613a22c9SMichael Walle  lm32)
4414613a22c9SMichael Walle  ;;
44152408a527Saurel32  m68k)
44160938cda5Saurel32    bflt="yes"
441756aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
44182408a527Saurel32  ;;
4419877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
4420877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
442172b675caSEdgar E. Iglesias    bflt="yes"
442272b675caSEdgar E. Iglesias  ;;
44232408a527Saurel32  mips|mipsel)
4424b498c8a0SJuan Quintela    TARGET_ARCH=mips
442525be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
44262408a527Saurel32  ;;
44272408a527Saurel32  mipsn32|mipsn32el)
4428597e2cecSRichard Henderson    TARGET_ARCH=mips64
44296acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
443025be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4431597e2cecSRichard Henderson    echo "TARGET_ABI32=y" >> $config_target_mak
44322408a527Saurel32  ;;
44332408a527Saurel32  mips64|mips64el)
4434b498c8a0SJuan Quintela    TARGET_ARCH=mips64
44356acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
443625be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
44372408a527Saurel32  ;;
4438d15a9c23SAnthony Green  moxie)
4439d15a9c23SAnthony Green  ;;
4440e67db06eSJia Liu  or32)
4441e67db06eSJia Liu    TARGET_ARCH=openrisc
4442e67db06eSJia Liu    TARGET_BASE_ARCH=openrisc
4443e67db06eSJia Liu  ;;
44442408a527Saurel32  ppc)
4445c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44462408a527Saurel32  ;;
44472408a527Saurel32  ppcemb)
44486acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4449e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4450c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44512408a527Saurel32  ;;
44522408a527Saurel32  ppc64)
44536acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4454e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4455c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44562408a527Saurel32  ;;
44572408a527Saurel32  ppc64abi32)
4458b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
44596acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4460e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
446125be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
4462c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44632408a527Saurel32  ;;
44642408a527Saurel32  sh4|sh4eb)
4465b498c8a0SJuan Quintela    TARGET_ARCH=sh4
44664dbed897Spbrook    bflt="yes"
44672408a527Saurel32  ;;
44682408a527Saurel32  sparc)
44692408a527Saurel32  ;;
44702408a527Saurel32  sparc64)
44716acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
44722408a527Saurel32  ;;
44732408a527Saurel32  sparc32plus)
4474b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
44756acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4476e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
447725be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
44782408a527Saurel32  ;;
447924e804ecSAlexander Graf  s390x)
448024e804ecSAlexander Graf  ;;
4481d2fbca94SGuan Xuetao  unicore32)
4482d2fbca94SGuan Xuetao  ;;
4483cfa550c6SMax Filippov  xtensa|xtensaeb)
4484cfa550c6SMax Filippov    TARGET_ARCH=xtensa
4485cfa550c6SMax Filippov  ;;
44862408a527Saurel32  *)
448776ad07a4SPeter Maydell    error_exit "Unsupported target CPU"
44882408a527Saurel32  ;;
44892408a527Saurel32esac
44905e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
44915e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
44925e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
44935e8861a0SPaolo Bonzinifi
44945e8861a0SPaolo Bonzini
44955e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
44965e8861a0SPaolo Bonzini
449799afc91dSDaniel P. Berrangeupper() {
449899afc91dSDaniel P. Berrange    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
449999afc91dSDaniel P. Berrange}
450099afc91dSDaniel P. Berrange
450199afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`"
450225be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
4503c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak
450425be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4505e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
4506e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
4507e6e91b9cSJuan Quintelafi
450825be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
4509c1799a84SPaolo Bonzinicase "$target_name" in
45101b0c87fcSJuan Quintela  i386|x86_64)
45111b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
451225be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
4513eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
4514eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4515eb6fda0fSAnthony PERARD      fi
4516432d268cSJun Nakajima    fi
451759d21e53SAlexander Graf    ;;
451859d21e53SAlexander Graf  *)
45191b0c87fcSJuan Quintelaesac
4520c1799a84SPaolo Bonzinicase "$target_name" in
452168b05c42SPeter Maydell  arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4522c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
4523c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4524c1799a84SPaolo Bonzini      \( "$target_name" = "$cpu" -o \
4525c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4526c1799a84SPaolo Bonzini      \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4527c1799a84SPaolo Bonzini      \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4528c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4529c1799a84SPaolo Bonzini      \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
4530c1799a84SPaolo Bonzini      \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
453125be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
45321ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
4533d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4534d5970055SMichael S. Tsirkin      fi
4535c59249f9SJuan Quintela    fi
4536c59249f9SJuan Quintelaesac
4537de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
453825be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
453997a847bcSbellardfi
454097a847bcSbellardif test "$target_softmmu" = "yes" ; then
454125be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4542de83cd02Sbellardfi
4543997344f3Sbellardif test "$target_user_only" = "yes" ; then
454425be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4545a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4546997344f3Sbellardfi
4547831b7825Sthsif test "$target_linux_user" = "yes" ; then
454825be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4549831b7825Sthsfi
455056aebc89Spbrooklist=""
455156aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
455256aebc89Spbrook  for x in $gdb_xml_files; do
455356aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
455456aebc89Spbrook  done
455525be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
45563d0f1517SJuan Quintelafi
4557de83cd02Sbellard
4558e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
455925be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4560e5fe0c52Spbrookfi
4561379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
456225be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4563379f6698SPaul Brookfi
456484778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
456525be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
456684778508Sblueswir1fi
45675b0753e0Sbellard
45684afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
4569fa282484SJuan Quintela
45704afddb55SJuan Quintelacflags=""
4571fa282484SJuan Quintelaldflags=""
45729b8e111fSJuan Quintela
457364656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
457464656024SJuan Quintela  case "$i" in
457564656024SJuan Quintela  alpha)
457625be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
457776cad711SPaolo Bonzini    echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
457864656024SJuan Quintela  ;;
457964656024SJuan Quintela  arm)
458025be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
458176cad711SPaolo Bonzini    echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
458264656024SJuan Quintela  ;;
458364656024SJuan Quintela  cris)
458425be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
458576cad711SPaolo Bonzini    echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
458664656024SJuan Quintela  ;;
458764656024SJuan Quintela  hppa)
458825be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
458976cad711SPaolo Bonzini    echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
459064656024SJuan Quintela  ;;
4591c72b26ecSRichard Henderson  i386|x86_64|x32)
459225be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
459376cad711SPaolo Bonzini    echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
459464656024SJuan Quintela  ;;
4595903ec55cSAurelien Jarno  ia64*)
4596903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
459776cad711SPaolo Bonzini    echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4598903ec55cSAurelien Jarno  ;;
459979368f49SMichael Walle  lm32)
460079368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
460176cad711SPaolo Bonzini    echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
460279368f49SMichael Walle  ;;
460364656024SJuan Quintela  m68k)
460425be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
460576cad711SPaolo Bonzini    echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
460664656024SJuan Quintela  ;;
4607877fdc12SEdgar E. Iglesias  microblaze*)
460825be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
460976cad711SPaolo Bonzini    echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
461064656024SJuan Quintela  ;;
461164656024SJuan Quintela  mips*)
461225be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
461376cad711SPaolo Bonzini    echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
461464656024SJuan Quintela  ;;
4615d15a9c23SAnthony Green  moxie*)
4616d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> $config_target_mak
4617d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> config-all-disas.mak
4618d15a9c23SAnthony Green  ;;
4619e67db06eSJia Liu  or32)
4620e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
462176cad711SPaolo Bonzini    echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4622e67db06eSJia Liu  ;;
462364656024SJuan Quintela  ppc*)
462425be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
462576cad711SPaolo Bonzini    echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
462664656024SJuan Quintela  ;;
462724e804ecSAlexander Graf  s390*)
462825be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
462976cad711SPaolo Bonzini    echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
463064656024SJuan Quintela  ;;
463164656024SJuan Quintela  sh4)
463225be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
463376cad711SPaolo Bonzini    echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
463464656024SJuan Quintela  ;;
463564656024SJuan Quintela  sparc*)
463625be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
463776cad711SPaolo Bonzini    echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
463864656024SJuan Quintela  ;;
4639cfa550c6SMax Filippov  xtensa*)
4640cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
464176cad711SPaolo Bonzini    echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
4642cfa550c6SMax Filippov  ;;
464364656024SJuan Quintela  esac
464464656024SJuan Quinteladone
46459195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
46469195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
464776cad711SPaolo Bonzini  echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
46489195b2c2SStefan Weilfi
464964656024SJuan Quintela
46506ee7126fSJuan Quintelacase "$ARCH" in
46516ee7126fSJuan Quintelaalpha)
46526ee7126fSJuan Quintela  # Ensure there's only a single GP
46536ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
46546ee7126fSJuan Quintela;;
46556ee7126fSJuan Quintelaesac
46566ee7126fSJuan Quintela
4657d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
465825be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
4659d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
4660d02c1db3SJuan Quintela    cflags="-p $cflags"
4661d02c1db3SJuan Quintela    ldflags="-p $ldflags"
4662d02c1db3SJuan Quintela  fi
4663d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
4664d02c1db3SJuan Quintela    ldflags="-p $ldflags"
466525be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
4666d02c1db3SJuan Quintela  fi
4667d02c1db3SJuan Quintelafi
4668d02c1db3SJuan Quintela
46699b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4670964c6fa1SRichard Henderson  ldflags="$ldflags $textseg_ldflags"
4671fa282484SJuan Quintelafi
4672fa282484SJuan Quintela
467325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
467425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4675fa282484SJuan Quintela
467697a847bcSbellarddone # for target in $targets
46777d13299dSbellard
4678b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then
4679b776eca1SGerd Hoffmann  echo "config-host.h: subdir-pixman" >> $config_host_mak
4680b776eca1SGerd Hoffmannfi
4681b776eca1SGerd Hoffmann
46822da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
46832da776dbSMichael R. Hinesecho "CONFIG_RDMA=y" >> $config_host_mak
46842da776dbSMichael R. Hinesfi
46852da776dbSMichael R. Hines
4686a540f158SPeter Crosthwaiteif [ "$dtc_internal" = "yes" ]; then
4687a540f158SPeter Crosthwaite  echo "config-host.h: subdir-dtc" >> $config_host_mak
4688a540f158SPeter Crosthwaitefi
4689a540f158SPeter Crosthwaite
4690d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
4691f93296eaSWenchao XiaDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
46922b170effSMichael TokarevDIRS="$DIRS fsdev"
46939933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
46942d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
46952dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
4696c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4697c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
4698aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
4699ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4700446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
47019933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile"
47022d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
47034652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp"
4704753d11f2SRichard Hendersonfor bios_file in \
4705753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
47065acc2ec0SGerd Hoffmann    $source_path/pc-bios/*.aml \
4707753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
4708753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
4709e89e33e1SDominik Dingel    $source_path/pc-bios/*.img \
4710753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
4711753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
4712753d11f2SRichard Hendersondo
47137ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
47147ea78b74SJan Kiszkadone
4715d1807a4fSPaolo Bonzinimkdir -p $DIRS
47167d13299dSbellardfor f in $FILES ; do
471772b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4718f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
4719f9245e10SPeter Maydell    fi
47207d13299dSbellarddone
47211ad2134fSPaul Brook
4722c34ebfdcSAnthony Liguori# temporary config to build submodules
47232d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
4724c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
472537116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4726c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
47273dd46c78SBlue Swirl    echo "AS=$as" >> $config_mak
4728c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4729c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
47303dd46c78SBlue Swirl    echo "CPP=$cpp" >> $config_mak
4731c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4732a31a8642SMichael S. Tsirkin    echo "IASL=$iasl" >> $config_mak
4733c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4734c34ebfdcSAnthony Liguoridone
4735c34ebfdcSAnthony Liguori
4736b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4737b40292e7SJan Kiszka  mkdir -p QMP
4738b40292e7SJan Kiszkafi
4739