xref: /openbmc/qemu/configure (revision 2b170eff)
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
3076ad07a4SPeter Maydellerror_exit() {
3176ad07a4SPeter Maydell    echo
3276ad07a4SPeter Maydell    echo "ERROR: $1"
3376ad07a4SPeter Maydell    while test -n "$2"; do
3476ad07a4SPeter Maydell        echo "       $2"
3576ad07a4SPeter Maydell        shift
3676ad07a4SPeter Maydell    done
3776ad07a4SPeter Maydell    echo
3876ad07a4SPeter Maydell    exit 1
3976ad07a4SPeter Maydell}
4076ad07a4SPeter Maydell
418dc38a78SPeter Maydelldo_cc() {
428dc38a78SPeter Maydell    # Run the compiler, capturing its output to the log.
438dc38a78SPeter Maydell    echo $cc "$@" >> config.log
448dc38a78SPeter Maydell    $cc "$@" >> config.log 2>&1 || return $?
458dc38a78SPeter Maydell    # Test passed. If this is an --enable-werror build, rerun
468dc38a78SPeter Maydell    # the test with -Werror and bail out if it fails. This
478dc38a78SPeter Maydell    # makes warning-generating-errors in configure test code
488dc38a78SPeter Maydell    # obvious to developers.
498dc38a78SPeter Maydell    if test "$werror" != "yes"; then
508dc38a78SPeter Maydell        return 0
518dc38a78SPeter Maydell    fi
528dc38a78SPeter Maydell    # Don't bother rerunning the compile if we were already using -Werror
538dc38a78SPeter Maydell    case "$*" in
548dc38a78SPeter Maydell        *-Werror*)
558dc38a78SPeter Maydell           return 0
568dc38a78SPeter Maydell        ;;
578dc38a78SPeter Maydell    esac
588dc38a78SPeter Maydell    echo $cc -Werror "$@" >> config.log
598dc38a78SPeter Maydell    $cc -Werror "$@" >> config.log 2>&1 && return $?
6076ad07a4SPeter Maydell    error_exit "configure test passed without -Werror but failed with -Werror." \
6176ad07a4SPeter Maydell        "This is probably a bug in the configure script. The failing command" \
6276ad07a4SPeter Maydell        "will be at the bottom of config.log." \
6376ad07a4SPeter Maydell        "You can run configure with --disable-werror to bypass this check."
648dc38a78SPeter Maydell}
658dc38a78SPeter Maydell
6652166aa0SJuan Quintelacompile_object() {
678dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
6852166aa0SJuan Quintela}
6952166aa0SJuan Quintela
7052166aa0SJuan Quintelacompile_prog() {
7152166aa0SJuan Quintela  local_cflags="$1"
7252166aa0SJuan Quintela  local_ldflags="$2"
738dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
7452166aa0SJuan Quintela}
7552166aa0SJuan Quintela
7611568d6dSPaolo Bonzini# symbolically link $1 to $2.  Portable version of "ln -sf".
7711568d6dSPaolo Bonzinisymlink() {
7872b8b5a1SStefan Weil  rm -rf "$2"
79ec5b06d7SAnthony Liguori  mkdir -p "$(dirname "$2")"
8072b8b5a1SStefan Weil  ln -s "$1" "$2"
8111568d6dSPaolo Bonzini}
8211568d6dSPaolo Bonzini
830dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
840dba6195SLoïc Minier# executable or a builtin)
850dba6195SLoïc Minierhas() {
860dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
870dba6195SLoïc Minier}
880dba6195SLoïc Minier
890dba6195SLoïc Minier# search for an executable in PATH
900dba6195SLoïc Minierpath_of() {
910dba6195SLoïc Minier    local_command="$1"
920dba6195SLoïc Minier    local_ifs="$IFS"
930dba6195SLoïc Minier    local_dir=""
940dba6195SLoïc Minier
950dba6195SLoïc Minier    # pathname has a dir component?
960dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
970dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
980dba6195SLoïc Minier            echo "$local_command"
990dba6195SLoïc Minier            return 0
1000dba6195SLoïc Minier        fi
1010dba6195SLoïc Minier    fi
1020dba6195SLoïc Minier    if [ -z "$local_command" ]; then
1030dba6195SLoïc Minier        return 1
1040dba6195SLoïc Minier    fi
1050dba6195SLoïc Minier
1060dba6195SLoïc Minier    IFS=:
1070dba6195SLoïc Minier    for local_dir in $PATH; do
1080dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
1090dba6195SLoïc Minier            echo "$local_dir/$local_command"
1100dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
1110dba6195SLoïc Minier            return 0
1120dba6195SLoïc Minier        fi
1130dba6195SLoïc Minier    done
1140dba6195SLoïc Minier    # not found
1150dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
1160dba6195SLoïc Minier    return 1
1170dba6195SLoïc Minier}
1180dba6195SLoïc Minier
1197d13299dSbellard# default parameters
120ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"`
1212ff6b91eSJuan Quintelacpu=""
1221e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
12343ce4dfeSbellardstatic="no"
1247d13299dSbellardcross_prefix=""
1250c58ac1cSmalcaudio_drv_list=""
126b64ec4e4SFam Zhengblock_drv_rw_whitelist=""
127b64ec4e4SFam Zhengblock_drv_ro_whitelist=""
128e49d021eSPeter Maydellhost_cc="cc"
12973da375eSJuan Quintelalibs_softmmu=""
1303e2e0e6bSJuan Quintelalibs_tools=""
13167f86e8eSJuan Quintelaaudio_pt_int=""
132d5631638Smalcaudio_win_int=""
1332b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc
134957f1f99SMichael Rothlibs_qga=""
1355bc62e01SGerd Hoffmanndebug_info="yes"
136ac0df51dSaliguori
137afb63ebdSStefan Weil# Don't accept a target_list environment variable.
138afb63ebdSStefan Weilunset target_list
139377529c0SPaolo Bonzini
140377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
141377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
142377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
143377529c0SPaolo Bonzini#              unless --disable-foo is given
144377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
145377529c0SPaolo Bonzini#              feature will searched for,
146377529c0SPaolo Bonzini#              if not found, configure exits with error
147377529c0SPaolo Bonzini#
148377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
149377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
150377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
151377529c0SPaolo Bonzini
152377529c0SPaolo Bonzinibluez=""
153377529c0SPaolo Bonzinibrlapi=""
154377529c0SPaolo Bonzinicurl=""
155377529c0SPaolo Bonzinicurses=""
156377529c0SPaolo Bonzinidocs=""
157377529c0SPaolo Bonzinifdt=""
158e2134eb9SGerd Hoffmannpixman=""
159377529c0SPaolo Bonzinisdl=""
160983eef5aSMeador Ingevirtfs=""
161821601eaSJes Sorensenvnc="yes"
162377529c0SPaolo Bonzinisparse="no"
163377529c0SPaolo Bonziniuuid=""
164377529c0SPaolo Bonzinivde=""
165377529c0SPaolo Bonzinivnc_tls=""
166377529c0SPaolo Bonzinivnc_sasl=""
167377529c0SPaolo Bonzinivnc_jpeg=""
168377529c0SPaolo Bonzinivnc_png=""
1697536ee4bSTim Hardeckvnc_ws=""
170377529c0SPaolo Bonzinixen=""
171d5b93ddfSAnthony PERARDxen_ctrl_version=""
172eb6fda0fSAnthony PERARDxen_pci_passthrough=""
173377529c0SPaolo Bonzinilinux_aio=""
17447e98658SCorey Bryantcap_ng=""
175377529c0SPaolo Bonziniattr=""
1764f26f2b6SAvi Kivitylibattr=""
177377529c0SPaolo Bonzinixfs=""
178377529c0SPaolo Bonzini
179d41a75a2SBradvhost_net="no"
1805e9be92dSNicholas Bellingervhost_scsi="no"
181d41a75a2SBradkvm="no"
1822da776dbSMichael R. Hinesrdma=""
183377529c0SPaolo Bonzinigprof="no"
184377529c0SPaolo Bonzinidebug_tcg="no"
185377529c0SPaolo Bonzinidebug="no"
186377529c0SPaolo Bonzinistrip_opt="yes"
1879195b2c2SStefan Weiltcg_interpreter="no"
188377529c0SPaolo Bonzinibigendian="no"
189377529c0SPaolo Bonzinimingw32="no"
1901d728c39SBlue Swirlgcov="no"
1911d728c39SBlue Swirlgcov_tool="gcov"
192377529c0SPaolo BonziniEXESUF=""
193377529c0SPaolo Bonziniprefix="/usr/local"
194377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
195528ae5b8SEduardo Habkostdatadir="\${prefix}/share"
196850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu"
197377529c0SPaolo Bonzinibindir="\${prefix}/bin"
1983aa5d2beSAlon Levylibdir="\${prefix}/lib"
1998bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec"
2000f94d6daSAlon Levyincludedir="\${prefix}/include"
201377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
202785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var"
203377529c0SPaolo Bonziniconfsuffix="/qemu"
204377529c0SPaolo Bonzinislirp="yes"
205377529c0SPaolo Bonzinifmod_lib=""
206377529c0SPaolo Bonzinifmod_inc=""
207377529c0SPaolo Bonzinioss_lib=""
208377529c0SPaolo Bonzinibsd="no"
209377529c0SPaolo Bonzinilinux="no"
210377529c0SPaolo Bonzinisolaris="no"
211377529c0SPaolo Bonziniprofiler="no"
212377529c0SPaolo Bonzinicocoa="no"
213377529c0SPaolo Bonzinisoftmmu="yes"
214377529c0SPaolo Bonzinilinux_user="no"
215377529c0SPaolo Bonzinibsd_user="no"
21630163d89SPeter Maydellguest_base="yes"
217377529c0SPaolo Bonziniuname_release=""
218377529c0SPaolo Bonziniaix="no"
219377529c0SPaolo Bonziniblobs="yes"
220377529c0SPaolo Bonzinipkgversion=""
22140d6444eSAvi Kivitypie=""
222377529c0SPaolo Bonzinizero_malloc=""
2233556c233SPaolo Bonziniqom_cast_debug="yes"
224377529c0SPaolo Bonzinitrace_backend="nop"
225377529c0SPaolo Bonzinitrace_file="trace"
226377529c0SPaolo Bonzinispice=""
227377529c0SPaolo Bonzinirbd=""
228111a38b0SRobert Relyeasmartcard_nss=""
2292b2325ffSGerd Hoffmannlibusb=""
23069354a83SHans de Goedeusb_redir=""
231b1e5fff4SMichael Walleglx=""
2321ece9905SAlon Levyzlib="yes"
233e8ef31a3SMichael Tokarevguest_agent=""
234d9840e25STomoki Sekiyamaguest_agent_with_vss="no"
235d9840e25STomoki Sekiyamavss_win32_sdk=""
236d9840e25STomoki Sekiyamawin_sdk="no"
2374b1c11fdSDaniel P. Berrangewant_tools="yes"
238c589b249SRonnie Sahlberglibiscsi=""
239519175a2SAlex Barcelocoroutine=""
24070c60c08SStefan Hajnoczicoroutine_pool=""
241f794573eSEduardo Otuboseccomp=""
242eb100396SBharata B Raoglusterfs=""
2430c14fb47SBharata B Raoglusterfs_discard="no"
244583f6e7bSStefan Hajnoczivirtio_blk_data_plane=""
245a4ccabcfSAnthony Liguorigtk=""
246528de90aSDaniel P. Berrangegtkabi="2.0"
247ab214c29SStefan Bergertpm="no"
2480a12ec87SRichard W.M. Joneslibssh2=""
249377529c0SPaolo Bonzini
250ac0df51dSaliguori# parse CC options first
251ac0df51dSaliguorifor opt do
252ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
253ac0df51dSaliguori  case "$opt" in
254ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
255ac0df51dSaliguori  ;;
2563d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
257ac0df51dSaliguori  ;;
25883f73fceSTomoki Sekiyama  --cxx=*) CXX="$optarg"
25983f73fceSTomoki Sekiyama  ;;
260ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
261ca4deeb1SPaolo Bonzini  ;;
2622ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2632ff6b91eSJuan Quintela  ;;
264a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
265f9943cd5SGerd Hoffmann                    EXTRA_CFLAGS="$optarg"
266e2a2ed06SJuan Quintela  ;;
267e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
268f9943cd5SGerd Hoffmann                     EXTRA_LDFLAGS="$optarg"
269e2a2ed06SJuan Quintela  ;;
2705bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2715bc62e01SGerd Hoffmann  ;;
2725bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2735bc62e01SGerd Hoffmann  ;;
274ac0df51dSaliguori  esac
275ac0df51dSaliguoridone
276ac0df51dSaliguori# OS specific
277ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
27893148aa5SStefan Weil# we can eliminate its usage altogether.
279ac0df51dSaliguori
280e49d021eSPeter Maydell# Preferred compiler:
281e49d021eSPeter Maydell#  ${CC} (if set)
282e49d021eSPeter Maydell#  ${cross_prefix}gcc (if cross-prefix specified)
283e49d021eSPeter Maydell#  system compiler
284e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then
285e49d021eSPeter Maydell  cc="$host_cc"
286e49d021eSPeter Maydellelse
287b3198cc2SStuart Yoder  cc="${CC-${cross_prefix}gcc}"
288e49d021eSPeter Maydellfi
289e49d021eSPeter Maydell
29083f73fceSTomoki Sekiyamaif test -z "${CXX}${cross_prefix}"; then
29183f73fceSTomoki Sekiyama  cxx="c++"
29283f73fceSTomoki Sekiyamaelse
29383f73fceSTomoki Sekiyama  cxx="${CXX-${cross_prefix}g++}"
29483f73fceSTomoki Sekiyamafi
29583f73fceSTomoki Sekiyama
296b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
2973dd46c78SBlue Swirlas="${AS-${cross_prefix}as}"
2983dd46c78SBlue Swirlcpp="${CPP-$cc -E}"
299b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
300b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
3013f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
302b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
303b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
30417884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
30517884d7bSSergei Trofimovichquery_pkg_config() {
30617884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
30717884d7bSSergei Trofimovich}
30817884d7bSSergei Trofimovichpkg_config=query_pkg_config
309b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
310ac0df51dSaliguori
311be17dc90SMichael S. Tsirkin# default flags for all hosts
312be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
313f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
314c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
315be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
3166b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
3175bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
3185bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
319be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
3205bc62e01SGerd Hoffmannfi
321be17dc90SMichael S. Tsirkin
322ca4deeb1SPaolo Bonzini# make source path absolute
323ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
324ca4deeb1SPaolo Bonzini
325ac0df51dSaliguoricheck_define() {
326ac0df51dSaliguoricat > $TMPC <<EOF
327ac0df51dSaliguori#if !defined($1)
328fd786e1aSPeter Maydell#error $1 not defined
329ac0df51dSaliguori#endif
330ac0df51dSaliguoriint main(void) { return 0; }
331ac0df51dSaliguoriEOF
33252166aa0SJuan Quintela  compile_object
333ac0df51dSaliguori}
334ac0df51dSaliguori
335bbea4050SPeter Maydellif check_define __linux__ ; then
336bbea4050SPeter Maydell  targetos="Linux"
337bbea4050SPeter Maydellelif check_define _WIN32 ; then
338bbea4050SPeter Maydell  targetos='MINGW32'
339bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then
340bbea4050SPeter Maydell  targetos='OpenBSD'
341bbea4050SPeter Maydellelif check_define __sun__ ; then
342bbea4050SPeter Maydell  targetos='SunOS'
343bbea4050SPeter Maydellelif check_define __HAIKU__ ; then
344bbea4050SPeter Maydell  targetos='Haiku'
345bbea4050SPeter Maydellelse
346bbea4050SPeter Maydell  targetos=`uname -s`
347bbea4050SPeter Maydellfi
348bbea4050SPeter Maydell
349bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use.
350bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're
351bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify
352bbea4050SPeter Maydell# the correct CPU with the --cpu option.
353bbea4050SPeter Maydellcase $targetos in
354bbea4050SPeter MaydellDarwin)
355bbea4050SPeter Maydell  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
356bbea4050SPeter Maydell  # run 64-bit userspace code.
357bbea4050SPeter Maydell  # If the user didn't specify a CPU explicitly and the kernel says this is
358bbea4050SPeter Maydell  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
359bbea4050SPeter Maydell  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
360bbea4050SPeter Maydell    cpu="x86_64"
361bbea4050SPeter Maydell  fi
362bbea4050SPeter Maydell  ;;
363bbea4050SPeter MaydellSunOS)
364bbea4050SPeter Maydell  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
365bbea4050SPeter Maydell  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
366bbea4050SPeter Maydell    cpu="x86_64"
367bbea4050SPeter Maydell  fi
368bbea4050SPeter Maydellesac
369bbea4050SPeter Maydell
3702ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
3712ff6b91eSJuan Quintela  # command line argument
3722ff6b91eSJuan Quintela  :
3732ff6b91eSJuan Quintelaelif check_define __i386__ ; then
374ac0df51dSaliguori  cpu="i386"
375ac0df51dSaliguorielif check_define __x86_64__ ; then
376c72b26ecSRichard Henderson  if check_define __ILP32__ ; then
377c72b26ecSRichard Henderson    cpu="x32"
378c72b26ecSRichard Henderson  else
379ac0df51dSaliguori    cpu="x86_64"
380c72b26ecSRichard Henderson  fi
3813aa9bd6cSblueswir1elif check_define __sparc__ ; then
3823aa9bd6cSblueswir1  if check_define __arch64__ ; then
3833aa9bd6cSblueswir1    cpu="sparc64"
3843aa9bd6cSblueswir1  else
3853aa9bd6cSblueswir1    cpu="sparc"
3863aa9bd6cSblueswir1  fi
387fdf7ed96Smalcelif check_define _ARCH_PPC ; then
388fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
389fdf7ed96Smalc    cpu="ppc64"
390ac0df51dSaliguori  else
391fdf7ed96Smalc    cpu="ppc"
392fdf7ed96Smalc  fi
393afa05235SAurelien Jarnoelif check_define __mips__ ; then
394afa05235SAurelien Jarno  cpu="mips"
395477ba620SAurelien Jarnoelif check_define __ia64__ ; then
396477ba620SAurelien Jarno  cpu="ia64"
397d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
398d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
399d66ed0eaSAurelien Jarno    cpu="s390x"
400d66ed0eaSAurelien Jarno  else
401d66ed0eaSAurelien Jarno    cpu="s390"
402d66ed0eaSAurelien Jarno  fi
40321d89f84SPeter Maydellelif check_define __arm__ ; then
40421d89f84SPeter Maydell  cpu="arm"
4051f080313SClaudio Fontanaelif check_define __aarch64__ ; then
4061f080313SClaudio Fontana  cpu="aarch64"
407f28ffed5SBradelif check_define __hppa__ ; then
408f28ffed5SBrad  cpu="hppa"
409fdf7ed96Smalcelse
410fdf7ed96Smalc  cpu=`uname -m`
411ac0df51dSaliguorifi
412ac0df51dSaliguori
413359bc95dSPeter MaydellARCH=
414359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
415359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
4167d13299dSbellardcase "$cpu" in
417c72b26ecSRichard Henderson  ia64|ppc|ppc64|s390|s390x|sparc64|x32)
418ea8f20f8SJuan Quintela    cpu="$cpu"
419ea8f20f8SJuan Quintela  ;;
4207d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
42197a847bcSbellard    cpu="i386"
4227d13299dSbellard  ;;
423aaa5fa14Saurel32  x86_64|amd64)
424aaa5fa14Saurel32    cpu="x86_64"
425aaa5fa14Saurel32  ;;
42621d89f84SPeter Maydell  armv*b|armv*l|arm)
42721d89f84SPeter Maydell    cpu="arm"
4287d13299dSbellard  ;;
4291f080313SClaudio Fontana  aarch64)
4301f080313SClaudio Fontana    cpu="aarch64"
4311f080313SClaudio Fontana  ;;
432afa05235SAurelien Jarno  mips*)
433afa05235SAurelien Jarno    cpu="mips"
434afa05235SAurelien Jarno  ;;
4353142255cSblueswir1  sparc|sun4[cdmuv])
436ae228531Sbellard    cpu="sparc"
437ae228531Sbellard  ;;
4387d13299dSbellard  *)
439359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
440359bc95dSPeter Maydell    ARCH=unknown
4417d13299dSbellard  ;;
4427d13299dSbellardesac
443359bc95dSPeter Maydellif test -z "$ARCH"; then
444359bc95dSPeter Maydell  ARCH="$cpu"
445359bc95dSPeter Maydellfi
446e2d52ad3SJuan Quintela
4477d13299dSbellard# OS specific
4480dbfc675SJuan Quintela
4497d13299dSbellardcase $targetos in
450c326e0afSbellardCYGWIN*)
451c326e0afSbellard  mingw32="yes"
452a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
453d5631638Smalc  audio_possible_drivers="winwave sdl"
454d5631638Smalc  audio_drv_list="winwave"
455c326e0afSbellard;;
45667b915a5SbellardMINGW32*)
45767b915a5Sbellard  mingw32="yes"
458d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
459d5631638Smalc  audio_drv_list="winwave"
46067b915a5Sbellard;;
4615c40d2bdSthsGNU/kFreeBSD)
462a167ba50SAurelien Jarno  bsd="yes"
4630c58ac1cSmalc  audio_drv_list="oss"
464f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
4655c40d2bdSths;;
4667d3505c5SbellardFreeBSD)
4677d3505c5Sbellard  bsd="yes"
4680db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4690c58ac1cSmalc  audio_drv_list="oss"
470f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
471f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
472f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
4737d3505c5Sbellard;;
474c5e97233Sblueswir1DragonFly)
475c5e97233Sblueswir1  bsd="yes"
4760db4a067SPaolo Bonzini  make="${MAKE-gmake}"
477c5e97233Sblueswir1  audio_drv_list="oss"
478c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
479c5e97233Sblueswir1;;
4807d3505c5SbellardNetBSD)
4817d3505c5Sbellard  bsd="yes"
4820db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4830c58ac1cSmalc  audio_drv_list="oss"
484c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4858ef92a88Sblueswir1  oss_lib="-lossaudio"
4867d3505c5Sbellard;;
4877d3505c5SbellardOpenBSD)
4887d3505c5Sbellard  bsd="yes"
4890db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4904f6ab397SBrad Smith  audio_drv_list="sdl"
4914f6ab397SBrad Smith  audio_possible_drivers="sdl esd"
4927d3505c5Sbellard;;
49383fb7adfSbellardDarwin)
49483fb7adfSbellard  bsd="yes"
49583fb7adfSbellard  darwin="yes"
4961b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
497a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
4980c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
4991b0f9cc2Saliguori  else
500a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
5011b0f9cc2Saliguori  fi
502fd677642Sths  cocoa="yes"
5030c58ac1cSmalc  audio_drv_list="coreaudio"
504c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
5050c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
5067973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
507a0b7cf6bSPeter Maydell  # Disable attempts to use ObjectiveC features in os/object.h since they
508a0b7cf6bSPeter Maydell  # won't work when we're compiling with gcc as a C compiler.
509a0b7cf6bSPeter Maydell  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
51083fb7adfSbellard;;
511ec530c81SbellardSunOS)
512ec530c81Sbellard  solaris="yes"
5130db4a067SPaolo Bonzini  make="${MAKE-gmake}"
5140db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
515fa58948dSBlue Swirl  ld="gld"
516e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
5170475a5caSths  needs_libsunmath="no"
518c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
519c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
5200475a5caSths    if test "$solarisrev" -le 9 ; then
5210475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
5220475a5caSths        needs_libsunmath="yes"
523f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
524f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
525f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
5260475a5caSths      else
52776ad07a4SPeter Maydell        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
52876ad07a4SPeter Maydell            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
52976ad07a4SPeter Maydell            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
53076ad07a4SPeter Maydell            "Studio 11 can be downloaded from www.sun.com."
5310475a5caSths      fi
5320475a5caSths    fi
53386b2bd93Sths  fi
5346b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
5350c58ac1cSmalc    audio_drv_list="oss"
5366b4d2ba1Sths  fi
537c2de5c91Smalc  audio_possible_drivers="oss sdl"
538d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
539d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
540d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
541d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
542a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
543560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
544560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
545560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
546ec530c81Sbellard;;
547b29fe3edSmalcAIX)
548b29fe3edSmalc  aix="yes"
5490db4a067SPaolo Bonzini  make="${MAKE-gmake}"
550b29fe3edSmalc;;
551179cf400SAndreas FärberHaiku)
552179cf400SAndreas Färber  haiku="yes"
553179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
554179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
555179cf400SAndreas Färber;;
556fb065187Sbellard*)
5570c58ac1cSmalc  audio_drv_list="oss"
558b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
5595327cf48Sbellard  linux="yes"
560831b7825Sths  linux_user="yes"
561af2be207SJan Kiszka  kvm="yes"
562af2be207SJan Kiszka  vhost_net="yes"
5635e9be92dSNicholas Bellinger  vhost_scsi="yes"
564c72b26ecSRichard Henderson  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "x32" ] ; then
565c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
566c9ec1fe4Sbellard  fi
567a585140dSAlexey Kardashevskiy  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
568fb065187Sbellard;;
5697d13299dSbellardesac
5707d13299dSbellard
5717d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
572b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
57384778508Sblueswir1    bsd_user="yes"
5747d3505c5Sbellard  fi
57508de3949SAndreas Färberfi
5767d3505c5Sbellard
5770db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5780db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
5791d984a67SStefan Weil: ${python=${PYTHON-python -B}}
580e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5810db4a067SPaolo Bonzini
5823c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC
5833c4a4d0dSPeter Maydellif has clang; then
5843c4a4d0dSPeter Maydell  objcc=clang
5853c4a4d0dSPeter Maydellelse
5863c4a4d0dSPeter Maydell  objcc="$cc"
5873c4a4d0dSPeter Maydellfi
5883c4a4d0dSPeter Maydell
5893457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
5903457a3f8SJuan Quintela  EXESUF=".exe"
591a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
592e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
593e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
594f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
595f7cf5d5bSStefan Weilcat > $TMPC << EOF
596f7cf5d5bSStefan Weilint main(void) { return 0; }
597f7cf5d5bSStefan WeilEOF
598f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
599f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
600f7cf5d5bSStefan Weil  fi
601c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
602683035deSPaolo Bonzini  mandir="\${prefix}"
603528ae5b8SEduardo Habkost  datadir="\${prefix}"
604850da188SEduardo Habkost  qemu_docdir="\${prefix}"
605683035deSPaolo Bonzini  bindir="\${prefix}"
606683035deSPaolo Bonzini  sysconfdir="\${prefix}"
6075a699bbbSLaszlo Ersek  local_statedir=
608683035deSPaolo Bonzini  confsuffix=""
609368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
6103457a3f8SJuan Quintelafi
6113457a3f8SJuan Quintela
612487fefdbSAnthony Liguoriwerror=""
61385aa5189Sbellard
6147d13299dSbellardfor opt do
615a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
6167d13299dSbellard  case "$opt" in
6172efc3265Sbellard  --help|-h) show_help=yes
6182efc3265Sbellard  ;;
61999123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
62099123e13SMike Frysinger  ;;
621b1a550a0Spbrook  --prefix=*) prefix="$optarg"
6227d13299dSbellard  ;;
623b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
62432ce6337Sbellard  ;;
625ca4deeb1SPaolo Bonzini  --source-path=*)
6267d13299dSbellard  ;;
627ac0df51dSaliguori  --cross-prefix=*)
6287d13299dSbellard  ;;
629ac0df51dSaliguori  --cc=*)
6307d13299dSbellard  ;;
631b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
63283469015Sbellard  ;;
63383f73fceSTomoki Sekiyama  --cxx=*)
63483f73fceSTomoki Sekiyama  ;;
6353c4a4d0dSPeter Maydell  --objcc=*) objcc="$optarg"
6363c4a4d0dSPeter Maydell  ;;
637b1a550a0Spbrook  --make=*) make="$optarg"
6387d13299dSbellard  ;;
6396a882643Spbrook  --install=*) install="$optarg"
6406a882643Spbrook  ;;
641c886edfbSBlue Swirl  --python=*) python="$optarg"
642c886edfbSBlue Swirl  ;;
6431d728c39SBlue Swirl  --gcov=*) gcov_tool="$optarg"
6441d728c39SBlue Swirl  ;;
645e2d8830eSBrad  --smbd=*) smbd="$optarg"
646e2d8830eSBrad  ;;
647e2a2ed06SJuan Quintela  --extra-cflags=*)
6487d13299dSbellard  ;;
649e2a2ed06SJuan Quintela  --extra-ldflags=*)
6507d13299dSbellard  ;;
6515bc62e01SGerd Hoffmann  --enable-debug-info)
6525bc62e01SGerd Hoffmann  ;;
6535bc62e01SGerd Hoffmann  --disable-debug-info)
6545bc62e01SGerd Hoffmann  ;;
6552ff6b91eSJuan Quintela  --cpu=*)
6567d13299dSbellard  ;;
657b1a550a0Spbrook  --target-list=*) target_list="$optarg"
658de83cd02Sbellard  ;;
65974242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
66094a420b1SStefan Hajnoczi  ;;
66174242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
6629410b56cSPrerna Saxena  ;;
6637d13299dSbellard  --enable-gprof) gprof="yes"
6647d13299dSbellard  ;;
6651d728c39SBlue Swirl  --enable-gcov) gcov="yes"
6661d728c39SBlue Swirl  ;;
66779427693SLoïc Minier  --static)
66879427693SLoïc Minier    static="yes"
66979427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
67017884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
67143ce4dfeSbellard  ;;
6720b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
6730b24e75fSPaolo Bonzini  ;;
6740b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
6750b24e75fSPaolo Bonzini  ;;
6763aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
6773aa5d2beSAlon Levy  ;;
6788bf188aaSMichael Tokarev  --libexecdir=*) libexecdir="$optarg"
6798bf188aaSMichael Tokarev  ;;
6800f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
6810f94d6daSAlon Levy  ;;
682528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
6830b24e75fSPaolo Bonzini  ;;
684023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
685023d3d67SEduardo Habkost  ;;
686850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
6870b24e75fSPaolo Bonzini  ;;
688ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
68907381cc1SAnthony Liguori  ;;
690785c23aeSLuiz Capitulino  --localstatedir=*) local_statedir="$optarg"
691785c23aeSLuiz Capitulino  ;;
692785c23aeSLuiz Capitulino  --sbindir=*|--sharedstatedir=*|\
693023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
694023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
695023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
696023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
697023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
698023ddd74SMax Filippov    # lots of directory switches by default.
699023ddd74SMax Filippov  ;;
700e2134eb9SGerd Hoffmann  --with-system-pixman) pixman="system"
701e2134eb9SGerd Hoffmann  ;;
702e2134eb9SGerd Hoffmann  --without-system-pixman) pixman="internal"
703e2134eb9SGerd Hoffmann  ;;
70474880fe2SRobert Schiele  --without-pixman) pixman="none"
70574880fe2SRobert Schiele  ;;
70697a847bcSbellard  --disable-sdl) sdl="no"
70797a847bcSbellard  ;;
708c4198157SJuan Quintela  --enable-sdl) sdl="yes"
709c4198157SJuan Quintela  ;;
7103556c233SPaolo Bonzini  --disable-qom-cast-debug) qom_cast_debug="no"
7113556c233SPaolo Bonzini  ;;
7123556c233SPaolo Bonzini  --enable-qom-cast-debug) qom_cast_debug="yes"
7133556c233SPaolo Bonzini  ;;
714983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
715983eef5aSMeador Inge  ;;
716983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
717983eef5aSMeador Inge  ;;
718821601eaSJes Sorensen  --disable-vnc) vnc="no"
719821601eaSJes Sorensen  ;;
720821601eaSJes Sorensen  --enable-vnc) vnc="yes"
721821601eaSJes Sorensen  ;;
722b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
723102a52e4Sbellard  ;;
724c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
725c2de5c91Smalc  ;;
7262f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
7272f6a1ab0Sblueswir1  ;;
7280c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
7290c58ac1cSmalc  ;;
730b64ec4e4SFam Zheng  --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
731b64ec4e4SFam Zheng  ;;
732b64ec4e4SFam Zheng  --block-drv-ro-whitelist=*) block_drv_ro_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
733eb852011SMarkus Armbruster  ;;
734f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
735f8393946Saurel32  ;;
736f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
737f8393946Saurel32  ;;
738f3d08ee6SPaul Brook  --enable-debug)
739f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
740f3d08ee6SPaul Brook      debug_tcg="yes"
741f3d08ee6SPaul Brook      debug="yes"
742f3d08ee6SPaul Brook      strip_opt="no"
743f3d08ee6SPaul Brook  ;;
74403b4fe7dSaliguori  --enable-sparse) sparse="yes"
74503b4fe7dSaliguori  ;;
74603b4fe7dSaliguori  --disable-sparse) sparse="no"
74703b4fe7dSaliguori  ;;
7481625af87Saliguori  --disable-strip) strip_opt="no"
7491625af87Saliguori  ;;
7508d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
7518d5d2d4cSths  ;;
7521be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
7531be10ad2SJuan Quintela  ;;
7542f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
7552f9606b3Saliguori  ;;
756ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
757ea784e3bSJuan Quintela  ;;
7582f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
7592f6f5c7aSCorentin Chary  ;;
7602f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
7612f6f5c7aSCorentin Chary  ;;
762efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
763efe556adSCorentin Chary  ;;
764efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
765efe556adSCorentin Chary  ;;
7667536ee4bSTim Hardeck  --disable-vnc-ws) vnc_ws="no"
7677536ee4bSTim Hardeck  ;;
7687536ee4bSTim Hardeck  --enable-vnc-ws) vnc_ws="yes"
7697536ee4bSTim Hardeck  ;;
770443f1376Sbellard  --disable-slirp) slirp="no"
771c20709aaSbellard  ;;
772ee682d27SStefan Weil  --disable-uuid) uuid="no"
773ee682d27SStefan Weil  ;;
774ee682d27SStefan Weil  --enable-uuid) uuid="yes"
775ee682d27SStefan Weil  ;;
776e0e6c8c0Saliguori  --disable-vde) vde="no"
7778a16d273Sths  ;;
778dfb278bdSJuan Quintela  --enable-vde) vde="yes"
779dfb278bdSJuan Quintela  ;;
780e37630caSaliguori  --disable-xen) xen="no"
781e37630caSaliguori  ;;
782fc321b4bSJuan Quintela  --enable-xen) xen="yes"
783fc321b4bSJuan Quintela  ;;
784eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
785eb6fda0fSAnthony PERARD  ;;
786eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
787eb6fda0fSAnthony PERARD  ;;
7882e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
7892e4d9fb1Saurel32  ;;
7904ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
7914ffcedb6SJuan Quintela  ;;
792fb599c9aSbalrog  --disable-bluez) bluez="no"
793fb599c9aSbalrog  ;;
794a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
795a20a6f46SJuan Quintela  ;;
7967ba1e619Saliguori  --disable-kvm) kvm="no"
7977ba1e619Saliguori  ;;
798b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
799b31a0277SJuan Quintela  ;;
8009195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
8019195b2c2SStefan Weil  ;;
8029195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
8039195b2c2SStefan Weil  ;;
80447e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
80547e98658SCorey Bryant  ;;
80647e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
80747e98658SCorey Bryant  ;;
808cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
809cd4ec0b4SGerd Hoffmann  ;;
810cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
811cd4ec0b4SGerd Hoffmann  ;;
812c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
813c589b249SRonnie Sahlberg  ;;
814c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
815c589b249SRonnie Sahlberg  ;;
81605c2a3e7Sbellard  --enable-profiler) profiler="yes"
81705c2a3e7Sbellard  ;;
81814821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
81914821030SPavel Borzenkov  ;;
820c2de5c91Smalc  --enable-cocoa)
821c2de5c91Smalc      cocoa="yes" ;
822c2de5c91Smalc      sdl="no" ;
823c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
8245b0753e0Sbellard  ;;
825cad25d69Spbrook  --disable-system) softmmu="no"
8260a8e90f4Spbrook  ;;
827cad25d69Spbrook  --enable-system) softmmu="yes"
8280a8e90f4Spbrook  ;;
8290953a80fSZachary Amsden  --disable-user)
8300953a80fSZachary Amsden      linux_user="no" ;
8310953a80fSZachary Amsden      bsd_user="no" ;
8320953a80fSZachary Amsden  ;;
8330953a80fSZachary Amsden  --enable-user) ;;
834831b7825Sths  --disable-linux-user) linux_user="no"
8350a8e90f4Spbrook  ;;
836831b7825Sths  --enable-linux-user) linux_user="yes"
837831b7825Sths  ;;
83884778508Sblueswir1  --disable-bsd-user) bsd_user="no"
83984778508Sblueswir1  ;;
84084778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
84184778508Sblueswir1  ;;
842379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
843379f6698SPaul Brook  ;;
844379f6698SPaul Brook  --disable-guest-base) guest_base="no"
845379f6698SPaul Brook  ;;
84640d6444eSAvi Kivity  --enable-pie) pie="yes"
84734005a00SKirill A. Shutemov  ;;
84840d6444eSAvi Kivity  --disable-pie) pie="no"
84934005a00SKirill A. Shutemov  ;;
850c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
851c5937220Spbrook  ;;
85285aa5189Sbellard  --enable-werror) werror="yes"
85385aa5189Sbellard  ;;
85485aa5189Sbellard  --disable-werror) werror="no"
85585aa5189Sbellard  ;;
8564d3b6f6eSbalrog  --disable-curses) curses="no"
8574d3b6f6eSbalrog  ;;
858c584a6d0SJuan Quintela  --enable-curses) curses="yes"
859c584a6d0SJuan Quintela  ;;
860769ce76dSAlexander Graf  --disable-curl) curl="no"
861769ce76dSAlexander Graf  ;;
862788c8196SJuan Quintela  --enable-curl) curl="yes"
863788c8196SJuan Quintela  ;;
8642df87df7SJuan Quintela  --disable-fdt) fdt="no"
8652df87df7SJuan Quintela  ;;
8662df87df7SJuan Quintela  --enable-fdt) fdt="yes"
8672df87df7SJuan Quintela  ;;
8685c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
8695c6c3a6cSChristoph Hellwig  ;;
8705c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
8715c6c3a6cSChristoph Hellwig  ;;
872758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
873758e8e38SVenkateswararao Jujjuri (JV)  ;;
874758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
875758e8e38SVenkateswararao Jujjuri (JV)  ;;
87677755340Sths  --disable-blobs) blobs="no"
87777755340Sths  ;;
8784a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
8794a19f1ecSpbrook  ;;
880519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
881519175a2SAlex Barcelo  ;;
88270c60c08SStefan Hajnoczi  --disable-coroutine-pool) coroutine_pool="no"
88370c60c08SStefan Hajnoczi  ;;
88470c60c08SStefan Hajnoczi  --enable-coroutine-pool) coroutine_pool="yes"
88570c60c08SStefan Hajnoczi  ;;
886a25dba17SJuan Quintela  --disable-docs) docs="no"
88770ec5dc0SAnthony Liguori  ;;
888a25dba17SJuan Quintela  --enable-docs) docs="yes"
88983a3ab8bSJuan Quintela  ;;
890d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
891d5970055SMichael S. Tsirkin  ;;
892d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
893d5970055SMichael S. Tsirkin  ;;
8945e9be92dSNicholas Bellinger  --disable-vhost-scsi) vhost_scsi="no"
8955e9be92dSNicholas Bellinger  ;;
8965e9be92dSNicholas Bellinger  --enable-vhost-scsi) vhost_scsi="yes"
8975e9be92dSNicholas Bellinger  ;;
898b1e5fff4SMichael Walle  --disable-glx) glx="no"
89920ff075bSMichael Walle  ;;
900b1e5fff4SMichael Walle  --enable-glx) glx="yes"
90120ff075bSMichael Walle  ;;
902f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
903f27aaf4bSChristian Brunner  ;;
904f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
905f27aaf4bSChristian Brunner  ;;
9068c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
9078c84cf11SSergei Trofimovich  ;;
9088c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
9098c84cf11SSergei Trofimovich  ;;
910111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
911111a38b0SRobert Relyea  ;;
912111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
913111a38b0SRobert Relyea  ;;
9142b2325ffSGerd Hoffmann  --disable-libusb) libusb="no"
9152b2325ffSGerd Hoffmann  ;;
9162b2325ffSGerd Hoffmann  --enable-libusb) libusb="yes"
9172b2325ffSGerd Hoffmann  ;;
91869354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
91969354a83SHans de Goede  ;;
92069354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
92169354a83SHans de Goede  ;;
9221ece9905SAlon Levy  --disable-zlib-test) zlib="no"
9231ece9905SAlon Levy  ;;
924d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
925d138cee9SMichael Roth  ;;
926d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
927d138cee9SMichael Roth  ;;
928d9840e25STomoki Sekiyama  --with-vss-sdk) vss_win32_sdk=""
929d9840e25STomoki Sekiyama  ;;
930d9840e25STomoki Sekiyama  --with-vss-sdk=*) vss_win32_sdk="$optarg"
931d9840e25STomoki Sekiyama  ;;
932d9840e25STomoki Sekiyama  --without-vss-sdk) vss_win32_sdk="no"
933d9840e25STomoki Sekiyama  ;;
934d9840e25STomoki Sekiyama  --with-win-sdk) win_sdk=""
935d9840e25STomoki Sekiyama  ;;
936d9840e25STomoki Sekiyama  --with-win-sdk=*) win_sdk="$optarg"
937d9840e25STomoki Sekiyama  ;;
938d9840e25STomoki Sekiyama  --without-win-sdk) win_sdk="no"
939d9840e25STomoki Sekiyama  ;;
9404b1c11fdSDaniel P. Berrange  --enable-tools) want_tools="yes"
9414b1c11fdSDaniel P. Berrange  ;;
9424b1c11fdSDaniel P. Berrange  --disable-tools) want_tools="no"
9434b1c11fdSDaniel P. Berrange  ;;
944f794573eSEduardo Otubo  --enable-seccomp) seccomp="yes"
945f794573eSEduardo Otubo  ;;
946f794573eSEduardo Otubo  --disable-seccomp) seccomp="no"
947f794573eSEduardo Otubo  ;;
948eb100396SBharata B Rao  --disable-glusterfs) glusterfs="no"
949eb100396SBharata B Rao  ;;
950eb100396SBharata B Rao  --enable-glusterfs) glusterfs="yes"
951eb100396SBharata B Rao  ;;
952583f6e7bSStefan Hajnoczi  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
953583f6e7bSStefan Hajnoczi  ;;
954583f6e7bSStefan Hajnoczi  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
955583f6e7bSStefan Hajnoczi  ;;
956a4ccabcfSAnthony Liguori  --disable-gtk) gtk="no"
957a4ccabcfSAnthony Liguori  ;;
958a4ccabcfSAnthony Liguori  --enable-gtk) gtk="yes"
959a4ccabcfSAnthony Liguori  ;;
9602da776dbSMichael R. Hines  --enable-rdma) rdma="yes"
9612da776dbSMichael R. Hines  ;;
9622da776dbSMichael R. Hines  --disable-rdma) rdma="no"
9632da776dbSMichael R. Hines  ;;
964528de90aSDaniel P. Berrange  --with-gtkabi=*) gtkabi="$optarg"
965528de90aSDaniel P. Berrange  ;;
966ab214c29SStefan Berger  --enable-tpm) tpm="yes"
967ab214c29SStefan Berger  ;;
9680a12ec87SRichard W.M. Jones  --disable-libssh2) libssh2="no"
9690a12ec87SRichard W.M. Jones  ;;
9700a12ec87SRichard W.M. Jones  --enable-libssh2) libssh2="yes"
9710a12ec87SRichard W.M. Jones  ;;
9727f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
9737f1559c6Sbalrog  ;;
9747d13299dSbellard  esac
9757d13299dSbellarddone
9767d13299dSbellard
97740293e58Sbellardcase "$cpu" in
978e3608d66SRichard Henderson    ppc)
979e3608d66SRichard Henderson           CPU_CFLAGS="-m32"
980e3608d66SRichard Henderson           LDFLAGS="-m32 $LDFLAGS"
981e3608d66SRichard Henderson           ;;
982e3608d66SRichard Henderson    ppc64)
983e3608d66SRichard Henderson           CPU_CFLAGS="-m64"
984e3608d66SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
985e3608d66SRichard Henderson           ;;
9869b9c37c3SRichard Henderson    sparc)
9870c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
98879f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32 -mcpu=ultrasparc"
9893142255cSblueswir1           ;;
990ed968ff1SJuan Quintela    sparc64)
9910c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
99279f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -mcpu=ultrasparc"
9933142255cSblueswir1           ;;
99476d83bdeSths    s390)
99579f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m31 -march=z990"
99628d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
99728d7cc49SRichard Henderson           ;;
99828d7cc49SRichard Henderson    s390x)
99979f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64 -march=z990"
100028d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
100176d83bdeSths           ;;
100240293e58Sbellard    i386)
100379f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m32"
10040c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
10052b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
100640293e58Sbellard           ;;
100740293e58Sbellard    x86_64)
100879f3b12fSPeter Crosthwaite           CPU_CFLAGS="-m64"
10090c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
10102b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
1011379f6698SPaul Brook           ;;
1012c72b26ecSRichard Henderson    x32)
1013c72b26ecSRichard Henderson           CPU_CFLAGS="-mx32"
1014c72b26ecSRichard Henderson           LDFLAGS="-mx32 $LDFLAGS"
1015c72b26ecSRichard Henderson           cc_i386='$(CC) -m32'
1016c72b26ecSRichard Henderson           ;;
101730163d89SPeter Maydell    # No special flags required for other host CPUs
10183142255cSblueswir1esac
10193142255cSblueswir1
102079f3b12fSPeter CrosthwaiteQEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
102179f3b12fSPeter CrosthwaiteEXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"
102279f3b12fSPeter Crosthwaite
102360e0df25SPeter Maydelldefault_target_list=""
102460e0df25SPeter Maydell
10256e92f823SPeter Maydellmak_wilds=""
10266e92f823SPeter Maydell
102760e0df25SPeter Maydellif [ "$softmmu" = "yes" ]; then
10286e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-softmmu.mak"
102960e0df25SPeter Maydellfi
103060e0df25SPeter Maydellif [ "$linux_user" = "yes" ]; then
10316e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-linux-user.mak"
103260e0df25SPeter Maydellfi
103360e0df25SPeter Maydellif [ "$bsd_user" = "yes" ]; then
10346e92f823SPeter Maydell    mak_wilds="${mak_wilds} $source_path/default-configs/*-bsd-user.mak"
103560e0df25SPeter Maydellfi
103660e0df25SPeter Maydell
10376e92f823SPeter Maydellfor config in $mak_wilds; do
10386e92f823SPeter Maydell    default_target_list="${default_target_list} $(basename "$config" .mak)"
10396e92f823SPeter Maydelldone
10406e92f823SPeter Maydell
1041af5db58eSpbrookif test x"$show_help" = x"yes" ; then
1042af5db58eSpbrookcat << EOF
1043af5db58eSpbrook
1044af5db58eSpbrookUsage: configure [options]
1045af5db58eSpbrookOptions: [defaults in brackets after descriptions]
1046af5db58eSpbrook
1047af5db58eSpbrookEOF
1048af5db58eSpbrookecho "Standard options:"
1049af5db58eSpbrookecho "  --help                   print this message"
1050af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
1051af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
1052af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
105360e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
105460e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
105560e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
1056af5db58eSpbrookecho ""
1057af5db58eSpbrookecho "Advanced options (experts only):"
1058af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
1059af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
1060af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
10610bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
10620bfe8cc0SPaolo Bonziniecho "                           build time"
106383f73fceSTomoki Sekiyamaecho "  --cxx=CXX                use C++ compiler CXX [$cxx]"
10643c4a4d0dSPeter Maydellecho "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
1065a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
1066e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
1067af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
10686a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
1069c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
1070e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
1071af5db58eSpbrookecho "  --static                 enable static build [$static]"
10720b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
1073023d3d67SEduardo Habkostecho "  --datadir=PATH           install firmware in PATH$confsuffix"
1074023d3d67SEduardo Habkostecho "  --docdir=PATH            install documentation in PATH$confsuffix"
10750b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
1076a7b66fa7SDoug Goldsteinecho "  --libdir=PATH            install libraries in PATH"
1077023d3d67SEduardo Habkostecho "  --sysconfdir=PATH        install config in PATH$confsuffix"
10785a699bbbSLaszlo Ersekecho "  --localstatedir=PATH     install local state in PATH (set at runtime on win32)"
10792ae4748fSStefan Weilecho "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1080f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1081f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
10829941afdeSDunrong Huangecho "  --enable-debug-info       enable debugging information (default)"
10839941afdeSDunrong Huangecho "  --disable-debug-info      disable debugging information"
108409695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1085890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1086890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
10871625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
108885aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1089fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1090c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1091ab400449SHu Taoecho "  --disable-gtk            disable gtk UI"
1092ab400449SHu Taoecho "  --enable-gtk             enable gtk UI"
1093983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1094983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1095821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1096821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
109714821030SPavel Borzenkovecho "  --disable-cocoa          disable Cocoa (Mac OS X only)"
109814821030SPavel Borzenkovecho "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
1099c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1100c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
1101b64ec4e4SFam Zhengecho "  --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L"
1102b64ec4e4SFam Zhengecho "  --block-drv-rw-whitelist=L"
1103b64ec4e4SFam Zhengecho "                           set block driver read-write whitelist"
1104b64ec4e4SFam Zhengecho "                           (affects only QEMU, not qemu-img)"
1105b64ec4e4SFam Zhengecho "  --block-drv-ro-whitelist=L"
1106b64ec4e4SFam Zhengecho "                           set block driver read-only whitelist"
1107eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
1108e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1109fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
1110eb6fda0fSAnthony PERARDecho "  --disable-xen-pci-passthrough"
1111eb6fda0fSAnthony PERARDecho "  --enable-xen-pci-passthrough"
11122e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
11134ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
11148d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
11151be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
11162f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1117ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
11182f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
11192f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
112096763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1121efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
11227536ee4bSTim Hardeckecho "  --disable-vnc-ws         disable Websockets support for VNC server"
11237536ee4bSTim Hardeckecho "  --enable-vnc-ws          enable Websockets support for VNC server"
1124af896aaaSpbrookecho "  --disable-curses         disable curses output"
1125c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1126769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1127788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
11282df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
11292df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1130fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1131a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
11326093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
11337ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1134b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
11352da776dbSMichael R. Hinesecho "  --disable-rdma           disable RDMA-based migration support"
11362da776dbSMichael R. Hinesecho "  --enable-rdma            enable RDMA-based migration support"
11379195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1138af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1139af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
11400953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
11410953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1142831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1143831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
114484778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
114584778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1146379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1147379f6698SPaul Brookecho "                           emulation targets"
1148379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
114940d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
115040d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1151af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1152af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
11532f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1154c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1155235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
1156ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1157ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1158e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1159dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
11605c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
11615c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
116247e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
116347e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1164758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1165758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
116677755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1167d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1168d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1169d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1170d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1171320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1172650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
117374242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
11749410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1175cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1176cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1177f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1178c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1179c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
1180111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1181111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
11822b2325ffSGerd Hoffmannecho "  --disable-libusb         disable libusb (for usb passthrough)"
11832b2325ffSGerd Hoffmannecho "  --enable-libusb          enable libusb (for usb passthrough)"
118469354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
118569354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1186d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1187d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1188d9840e25STomoki Sekiyamaecho "  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent"
1189d9840e25STomoki Sekiyamaecho "  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)"
1190f794573eSEduardo Otuboecho "  --disable-seccomp        disable seccomp support"
1191f794573eSEduardo Otuboecho "  --enable-seccomp         enables seccomp support"
1192519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1193fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
119470c60c08SStefan Hajnocziecho "  --disable-coroutine-pool disable coroutine freelist (worse performance)"
119570c60c08SStefan Hajnocziecho "  --enable-coroutine-pool  enable coroutine freelist (better performance)"
1196eb100396SBharata B Raoecho "  --enable-glusterfs       enable GlusterFS backend"
1197eb100396SBharata B Raoecho "  --disable-glusterfs      disable GlusterFS backend"
11981d728c39SBlue Swirlecho "  --enable-gcov            enable test coverage analysis with gcov"
11991d728c39SBlue Swirlecho "  --gcov=GCOV              use specified gcov [$gcov_tool]"
1200ab214c29SStefan Bergerecho "  --enable-tpm             enable TPM support"
12010a12ec87SRichard W.M. Jonesecho "  --disable-libssh2        disable ssh block device support"
12020a12ec87SRichard W.M. Jonesecho "  --enable-libssh2         enable ssh block device support"
1203af5db58eSpbrookecho ""
12045bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1205af5db58eSpbrookexit 1
1206af5db58eSpbrookfi
1207af5db58eSpbrook
1208359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1209359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1210359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1211359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1212359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1213359bc95dSPeter Maydell        ARCH=tci
1214359bc95dSPeter Maydell    else
121576ad07a4SPeter Maydell        error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1216359bc95dSPeter Maydell    fi
1217359bc95dSPeter Maydellfi
1218359bc95dSPeter Maydell
12198d05095cSPaolo Bonzini# check that the C compiler works.
12208d05095cSPaolo Bonzinicat > $TMPC <<EOF
122175cafad7SStefan Weilint main(void) { return 0; }
12228d05095cSPaolo BonziniEOF
12238d05095cSPaolo Bonzini
12248d05095cSPaolo Bonziniif compile_object ; then
12258d05095cSPaolo Bonzini  : C compiler works ok
12268d05095cSPaolo Bonzinielse
122776ad07a4SPeter Maydell    error_exit "\"$cc\" either does not exist or does not work"
12288d05095cSPaolo Bonzinifi
12298d05095cSPaolo Bonzini
1230417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror
1231417c9d72SAlexander Graf# by default.  Only enable by default for git builds
1232417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION`
1233417c9d72SAlexander Graf
1234417c9d72SAlexander Grafif test -z "$werror" ; then
12356c8fec83SAndreas Färber    if test -d "$source_path/.git" -a \
1236417c9d72SAlexander Graf        "$linux" = "yes" ; then
1237417c9d72SAlexander Graf        werror="yes"
1238417c9d72SAlexander Graf    else
1239417c9d72SAlexander Graf        werror="no"
1240417c9d72SAlexander Graf    fi
1241417c9d72SAlexander Graffi
1242417c9d72SAlexander Graf
12438d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
12448d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
12458d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
124637746c5eSMarc-André Lureaugcc_flags="-Wendif-labels $gcc_flags"
1247c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags"
124871429097SPeter Maydellgcc_flags="-Wno-string-plus-int $gcc_flags"
12496ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would
12506ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due
12516ca026cbSPeter Maydell# to -Werror this would just silently disable some features,
12526ca026cbSPeter Maydell# so it's too error prone.
12538d05095cSPaolo Bonzinicat > $TMPC << EOF
12548d05095cSPaolo Bonziniint main(void) { return 0; }
12558d05095cSPaolo BonziniEOF
12568d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1257a1d29d6cSPeter Maydell    # Use the positive sense of the flag when testing for -Wno-wombat
1258a1d29d6cSPeter Maydell    # support (gcc will happily accept the -Wno- form of unknown
1259a1d29d6cSPeter Maydell    # warning options).
1260a1d29d6cSPeter Maydell    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1261a1d29d6cSPeter Maydell    if compile_prog "-Werror $optflag" "" ; then
12628d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
12638d05095cSPaolo Bonzini    fi
12648d05095cSPaolo Bonzinidone
12658d05095cSPaolo Bonzini
126637746c5eSMarc-André Lureauif compile_prog "-Werror -fstack-protector-all" "" ; then
126737746c5eSMarc-André Lureau    QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
126837746c5eSMarc-André Lureau    LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
126937746c5eSMarc-André Lureaufi
127037746c5eSMarc-André Lureau
1271cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1272cbdd1999SPaolo Bonzini# large functions that use global variables.  The bug is in all releases of
1273cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1274cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1275cbdd1999SPaolo Bonzinicat > $TMPC << EOF
1276cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1277cbdd1999SPaolo Bonziniint main(void) { return 0; }
1278cbdd1999SPaolo Bonzini#else
1279cbdd1999SPaolo Bonzini#error No bug in this compiler.
1280cbdd1999SPaolo Bonzini#endif
1281cbdd1999SPaolo BonziniEOF
1282cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then
1283cbdd1999SPaolo Bonzini  TRANSLATE_OPT_CFLAGS=-fno-gcse
1284cbdd1999SPaolo Bonzinifi
1285cbdd1999SPaolo Bonzini
128640d6444eSAvi Kivityif test "$static" = "yes" ; then
128740d6444eSAvi Kivity  if test "$pie" = "yes" ; then
128876ad07a4SPeter Maydell    error_exit "static and pie are mutually incompatible"
128940d6444eSAvi Kivity  else
129040d6444eSAvi Kivity    pie="no"
129140d6444eSAvi Kivity  fi
129240d6444eSAvi Kivityfi
129340d6444eSAvi Kivity
129440d6444eSAvi Kivityif test "$pie" = ""; then
129540d6444eSAvi Kivity  case "$cpu-$targetos" in
1296c72b26ecSRichard Henderson    i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD)
129740d6444eSAvi Kivity      ;;
129840d6444eSAvi Kivity    *)
129940d6444eSAvi Kivity      pie="no"
130040d6444eSAvi Kivity      ;;
130140d6444eSAvi Kivity  esac
130240d6444eSAvi Kivityfi
130340d6444eSAvi Kivity
130440d6444eSAvi Kivityif test "$pie" != "no" ; then
130540d6444eSAvi Kivity  cat > $TMPC << EOF
130621d4a791SAvi Kivity
130721d4a791SAvi Kivity#ifdef __linux__
130821d4a791SAvi Kivity#  define THREAD __thread
130921d4a791SAvi Kivity#else
131021d4a791SAvi Kivity#  define THREAD
131121d4a791SAvi Kivity#endif
131221d4a791SAvi Kivity
131321d4a791SAvi Kivitystatic THREAD int tls_var;
131421d4a791SAvi Kivity
131521d4a791SAvi Kivityint main(void) { return tls_var; }
131621d4a791SAvi Kivity
131740d6444eSAvi KivityEOF
131840d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
131940d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
132040d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
132140d6444eSAvi Kivity    pie="yes"
132240d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
132340d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
132440d6444eSAvi Kivity    fi
132540d6444eSAvi Kivity  else
132640d6444eSAvi Kivity    if test "$pie" = "yes"; then
132776ad07a4SPeter Maydell      error_exit "PIE not available due to missing toolchain support"
132840d6444eSAvi Kivity    else
132940d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
133040d6444eSAvi Kivity      pie="no"
133140d6444eSAvi Kivity    fi
133240d6444eSAvi Kivity  fi
133340d6444eSAvi Kivityfi
133440d6444eSAvi Kivity
133509dada40SPaolo Bonzini##########################################
133609dada40SPaolo Bonzini# __sync_fetch_and_and requires at least -march=i486. Many toolchains
133709dada40SPaolo Bonzini# use i686 as default anyway, but for those that don't, an explicit
133809dada40SPaolo Bonzini# specification is necessary
133909dada40SPaolo Bonzini
134009dada40SPaolo Bonziniif test "$cpu" = "i386"; then
134109dada40SPaolo Bonzini  cat > $TMPC << EOF
134209dada40SPaolo Bonzinistatic int sfaa(int *ptr)
134309dada40SPaolo Bonzini{
134409dada40SPaolo Bonzini  return __sync_fetch_and_and(ptr, 0);
134509dada40SPaolo Bonzini}
134609dada40SPaolo Bonzini
134709dada40SPaolo Bonziniint main(void)
134809dada40SPaolo Bonzini{
134909dada40SPaolo Bonzini  int val = 42;
13501405b629SStefan Weil  val = __sync_val_compare_and_swap(&val, 0, 1);
135109dada40SPaolo Bonzini  sfaa(&val);
135209dada40SPaolo Bonzini  return val;
135309dada40SPaolo Bonzini}
135409dada40SPaolo BonziniEOF
135509dada40SPaolo Bonzini  if ! compile_prog "" "" ; then
135609dada40SPaolo Bonzini    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
135709dada40SPaolo Bonzini  fi
135809dada40SPaolo Bonzinifi
135909dada40SPaolo Bonzini
136009dada40SPaolo Bonzini#########################################
1361ec530c81Sbellard# Solaris specific configure tool chain decisions
136209dada40SPaolo Bonzini
1363ec530c81Sbellardif test "$solaris" = "yes" ; then
13646792aa11SLoïc Minier  if has $install; then
13656792aa11SLoïc Minier    :
13666792aa11SLoïc Minier  else
136776ad07a4SPeter Maydell    error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
136876ad07a4SPeter Maydell        "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
136976ad07a4SPeter Maydell        "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1370ec530c81Sbellard  fi
13716792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
137276ad07a4SPeter Maydell    error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
137376ad07a4SPeter Maydell        "try ginstall from the GNU fileutils available from www.blastwave.org" \
137476ad07a4SPeter Maydell        "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1375ec530c81Sbellard  fi
13766792aa11SLoïc Minier  if has ar; then
13776792aa11SLoïc Minier    :
13786792aa11SLoïc Minier  else
1379ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
138076ad07a4SPeter Maydell      error_exit "No path includes ar" \
138176ad07a4SPeter Maydell          "Add /usr/ccs/bin to your path and rerun configure"
1382ec530c81Sbellard    fi
138376ad07a4SPeter Maydell    error_exit "No path includes ar"
1384ec530c81Sbellard  fi
1385ec530c81Sbellardfi
1386ec530c81Sbellard
13877a3fc891SSebastian Herbsztif ! has $python; then
138876ad07a4SPeter Maydell  error_exit "Python not found. Use --python=/path/to/python"
1389c886edfbSBlue Swirlfi
1390c886edfbSBlue Swirl
13916ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
13926ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
13931d984a67SStefan Weilif ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
139476ad07a4SPeter Maydell  error_exit "Cannot use '$python', Python 2.4 or later is required." \
139576ad07a4SPeter Maydell      "Note that Python 3 or later is not yet supported." \
139676ad07a4SPeter Maydell      "Use --python=/path/to/python to specify a supported Python."
13976ccea1e4SPeter Maydellfi
13986ccea1e4SPeter Maydell
1399afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then
1400121afa9eSAnthony Liguori    target_list="$default_target_list"
1401121afa9eSAnthony Liguorielse
1402121afa9eSAnthony Liguori    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
14035327cf48Sbellardfi
140425b48338SPeter Maydell
140525b48338SPeter Maydell# Check that we recognised the target name; this allows a more
140625b48338SPeter Maydell# friendly error message than if we let it fall through.
140725b48338SPeter Maydellfor target in $target_list; do
140825b48338SPeter Maydell    case " $default_target_list " in
140925b48338SPeter Maydell        *" $target "*)
141025b48338SPeter Maydell            ;;
141125b48338SPeter Maydell        *)
141225b48338SPeter Maydell            error_exit "Unknown target name '$target'"
141325b48338SPeter Maydell            ;;
141425b48338SPeter Maydell    esac
141525b48338SPeter Maydelldone
141625b48338SPeter Maydell
1417f55fe278SPaolo Bonzini# see if system emulation was really requested
1418f55fe278SPaolo Bonzinicase " $target_list " in
1419f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1420f55fe278SPaolo Bonzini  ;;
1421f55fe278SPaolo Bonzini  *) softmmu=no
1422f55fe278SPaolo Bonzini  ;;
1423f55fe278SPaolo Bonziniesac
14245327cf48Sbellard
1425249247c9SJuan Quintelafeature_not_found() {
1426249247c9SJuan Quintela  feature=$1
1427249247c9SJuan Quintela
142876ad07a4SPeter Maydell  error_exit "User requested feature $feature" \
142976ad07a4SPeter Maydell      "configure was not able to find it"
1430249247c9SJuan Quintela}
1431249247c9SJuan Quintela
14327d13299dSbellardif test -z "$cross_prefix" ; then
14337d13299dSbellard
14347d13299dSbellard# ---
14357d13299dSbellard# big/little endian test
14367d13299dSbellardcat > $TMPC << EOF
14377d13299dSbellard#include <inttypes.h>
1438abab1a0fSStefan Weilint main(void) {
14397d13299dSbellard        volatile uint32_t i=0x01234567;
14407d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
14417d13299dSbellard}
14427d13299dSbellardEOF
14437d13299dSbellard
144452166aa0SJuan Quintelaif compile_prog "" "" ; then
14457d13299dSbellard$TMPE && bigendian="yes"
14467d13299dSbellardelse
14477d13299dSbellardecho big/little test failed
14487d13299dSbellardfi
14497d13299dSbellard
14507d13299dSbellardelse
14517d13299dSbellard
14527d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1453ea8f20f8SJuan Quintelacase "$cpu" in
145421d89f84SPeter Maydell  arm)
145521d89f84SPeter Maydell    # ARM can be either way; ask the compiler which one we are
145621d89f84SPeter Maydell    if check_define __ARMEB__; then
145721d89f84SPeter Maydell      bigendian=yes
145821d89f84SPeter Maydell    fi
145921d89f84SPeter Maydell  ;;
146021d89f84SPeter Maydell  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1461ea8f20f8SJuan Quintela    bigendian=yes
1462ea8f20f8SJuan Quintela  ;;
1463ea8f20f8SJuan Quintelaesac
14647d13299dSbellard
14657d13299dSbellardfi
14667d13299dSbellard
1467b0a47e79SJuan Quintela##########################################
1468779ab5e3SStefan Weil# pkg-config probe
1469779ab5e3SStefan Weil
1470779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then
147176ad07a4SPeter Maydell  error_exit "pkg-config binary '$pkg_config_exe' not found"
1472779ab5e3SStefan Weilfi
1473779ab5e3SStefan Weil
1474779ab5e3SStefan Weil##########################################
1475b0a47e79SJuan Quintela# NPTL probe
1476b0a47e79SJuan Quintela
147724cb36a6SPeter Maydellif test "$linux_user" = "yes"; then
1478bd0c5661Spbrook  cat > $TMPC <<EOF
1479bd0c5661Spbrook#include <sched.h>
148030813ceaSpbrook#include <linux/futex.h>
1481182eacc0SStefan Weilint main(void) {
1482bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1483bd0c5661Spbrook#error bork
1484bd0c5661Spbrook#endif
1485182eacc0SStefan Weil  return 0;
1486bd0c5661Spbrook}
1487bd0c5661SpbrookEOF
148824cb36a6SPeter Maydell  if ! compile_object ; then
1489b0a47e79SJuan Quintela    feature_not_found "nptl"
1490b0a47e79SJuan Quintela  fi
1491bd0c5661Spbrookfi
1492bd0c5661Spbrook
149311d9f695Sbellard##########################################
1494ac62922eSbalrog# zlib check
1495ac62922eSbalrog
14961ece9905SAlon Levyif test "$zlib" != "no" ; then
1497ac62922eSbalrog    cat > $TMPC << EOF
1498ac62922eSbalrog#include <zlib.h>
1499ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1500ac62922eSbalrogEOF
150152166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1502ac62922eSbalrog        :
1503ac62922eSbalrog    else
150476ad07a4SPeter Maydell        error_exit "zlib check failed" \
150576ad07a4SPeter Maydell            "Make sure to have the zlib libs and headers installed."
1506ac62922eSbalrog    fi
15071ece9905SAlon Levyfi
1508f544a488SPaolo Bonzinilibs_softmmu="$libs_softmmu -lz"
1509ac62922eSbalrog
1510ac62922eSbalrog##########################################
1511f794573eSEduardo Otubo# libseccomp check
1512f794573eSEduardo Otubo
1513f794573eSEduardo Otuboif test "$seccomp" != "no" ; then
151465d5d3f9SStefan Weil    if $pkg_config --atleast-version=2.1.0 libseccomp; then
1515b4451996SMichael Tokarev        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1516372e47e9SAndreas Färber        QEMU_CFLAGS="$QEMU_CFLAGS `$pkg_config --cflags libseccomp`"
1517f794573eSEduardo Otubo	seccomp="yes"
1518f794573eSEduardo Otubo    else
1519f794573eSEduardo Otubo	if test "$seccomp" = "yes"; then
1520f794573eSEduardo Otubo            feature_not_found "libseccomp"
1521f794573eSEduardo Otubo	fi
1522e84d5956SYann E. MORIN	seccomp="no"
1523f794573eSEduardo Otubo    fi
1524f794573eSEduardo Otubofi
1525f794573eSEduardo Otubo##########################################
1526e37630caSaliguori# xen probe
1527e37630caSaliguori
1528fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1529b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1530d5b93ddfSAnthony PERARD
153150ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
153250ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
153350ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
153450ced5b3SStefan Weil
153550ced5b3SStefan Weil  # Xen (any)
153650ced5b3SStefan Weil  cat > $TMPC <<EOF
153750ced5b3SStefan Weil#include <xenctrl.h>
153850ced5b3SStefan Weilint main(void) {
153950ced5b3SStefan Weil  return 0;
154050ced5b3SStefan Weil}
154150ced5b3SStefan WeilEOF
154250ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
154350ced5b3SStefan Weil    # Xen not found
154450ced5b3SStefan Weil    if test "$xen" = "yes" ; then
154550ced5b3SStefan Weil      feature_not_found "xen"
154650ced5b3SStefan Weil    fi
154750ced5b3SStefan Weil    xen=no
154850ced5b3SStefan Weil
1549d5b93ddfSAnthony PERARD  # Xen unstable
155069deef08SPeter Maydell  elif
155169deef08SPeter Maydell      cat > $TMPC <<EOF &&
1552e37630caSaliguori#include <xenctrl.h>
1553e108a3c1SAnthony PERARD#include <xenstore.h>
1554d5b93ddfSAnthony PERARD#include <stdint.h>
1555d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1556d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1557d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1558d5b93ddfSAnthony PERARD#endif
1559d5b93ddfSAnthony PERARDint main(void) {
1560d5b93ddfSAnthony PERARD  xc_interface *xc;
1561d5b93ddfSAnthony PERARD  xs_daemon_open();
1562d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1563d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1564d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1565b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
15668688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
15678688e065SStefano Stabellini  return 0;
15688688e065SStefano Stabellini}
15698688e065SStefano StabelliniEOF
15708688e065SStefano Stabellini      compile_prog "" "$xen_libs"
157169deef08SPeter Maydell    then
15728688e065SStefano Stabellini    xen_ctrl_version=420
15738688e065SStefano Stabellini    xen=yes
15748688e065SStefano Stabellini
157569deef08SPeter Maydell  elif
157669deef08SPeter Maydell      cat > $TMPC <<EOF &&
15778688e065SStefano Stabellini#include <xenctrl.h>
15788688e065SStefano Stabellini#include <xs.h>
15798688e065SStefano Stabellini#include <stdint.h>
15808688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
15818688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
15828688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
15838688e065SStefano Stabellini#endif
15848688e065SStefano Stabelliniint main(void) {
15858688e065SStefano Stabellini  xs_daemon_open();
15869b4c0b56SPeter Maydell  xc_interface_open(0, 0, 0);
15878688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
15888688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
15898688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1590d5b93ddfSAnthony PERARD  return 0;
1591d5b93ddfSAnthony PERARD}
1592e37630caSaliguoriEOF
159350ced5b3SStefan Weil      compile_prog "" "$xen_libs"
159469deef08SPeter Maydell    then
1595d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1596fc321b4bSJuan Quintela    xen=yes
1597d5b93ddfSAnthony PERARD
1598d5b93ddfSAnthony PERARD  # Xen 4.0.0
159969deef08SPeter Maydell  elif
160069deef08SPeter Maydell      cat > $TMPC <<EOF &&
1601d5b93ddfSAnthony PERARD#include <xenctrl.h>
1602d5b93ddfSAnthony PERARD#include <xs.h>
1603d5b93ddfSAnthony PERARD#include <stdint.h>
1604d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1605d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1606d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1607d5b93ddfSAnthony PERARD#endif
1608d5b93ddfSAnthony PERARDint main(void) {
1609b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1610b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1611b87de24eSAnthony PERARD  };
1612d5b93ddfSAnthony PERARD  xs_daemon_open();
1613d5b93ddfSAnthony PERARD  xc_interface_open();
1614d5b93ddfSAnthony PERARD  xc_gnttab_open();
1615d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1616b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1617d5b93ddfSAnthony PERARD  return 0;
1618d5b93ddfSAnthony PERARD}
1619d5b93ddfSAnthony PERARDEOF
1620d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
162169deef08SPeter Maydell    then
1622d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1623d5b93ddfSAnthony PERARD    xen=yes
1624d5b93ddfSAnthony PERARD
1625b87de24eSAnthony PERARD  # Xen 3.4.0
162669deef08SPeter Maydell  elif
162769deef08SPeter Maydell      cat > $TMPC <<EOF &&
1628b87de24eSAnthony PERARD#include <xenctrl.h>
1629b87de24eSAnthony PERARD#include <xs.h>
1630b87de24eSAnthony PERARDint main(void) {
1631b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1632b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1633b87de24eSAnthony PERARD  };
1634b87de24eSAnthony PERARD  xs_daemon_open();
1635b87de24eSAnthony PERARD  xc_interface_open();
1636b87de24eSAnthony PERARD  xc_gnttab_open();
1637b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1638b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1639b87de24eSAnthony PERARD  return 0;
1640b87de24eSAnthony PERARD}
1641b87de24eSAnthony PERARDEOF
1642b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
164369deef08SPeter Maydell    then
1644b87de24eSAnthony PERARD    xen_ctrl_version=340
1645b87de24eSAnthony PERARD    xen=yes
1646b87de24eSAnthony PERARD
1647b87de24eSAnthony PERARD  # Xen 3.3.0
164869deef08SPeter Maydell  elif
164969deef08SPeter Maydell      cat > $TMPC <<EOF &&
1650d5b93ddfSAnthony PERARD#include <xenctrl.h>
1651d5b93ddfSAnthony PERARD#include <xs.h>
1652d5b93ddfSAnthony PERARDint main(void) {
1653d5b93ddfSAnthony PERARD  xs_daemon_open();
1654d5b93ddfSAnthony PERARD  xc_interface_open();
1655d5b93ddfSAnthony PERARD  xc_gnttab_open();
1656d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1657d5b93ddfSAnthony PERARD  return 0;
1658d5b93ddfSAnthony PERARD}
1659d5b93ddfSAnthony PERARDEOF
1660d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
166169deef08SPeter Maydell    then
1662d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1663d5b93ddfSAnthony PERARD    xen=yes
1664d5b93ddfSAnthony PERARD
166550ced5b3SStefan Weil  # Xen version unsupported
1666e37630caSaliguori  else
1667fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
166850ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1669fc321b4bSJuan Quintela    fi
1670fc321b4bSJuan Quintela    xen=no
1671e37630caSaliguori  fi
1672d5b93ddfSAnthony PERARD
1673d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1674d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1675d5b93ddfSAnthony PERARD  fi
1676e37630caSaliguorifi
1677e37630caSaliguori
1678eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1679eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1680eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1681eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1682eb6fda0fSAnthony PERARD  else
1683eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1684eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
168576ad07a4SPeter Maydell        error_exit "User requested feature Xen PCI Passthrough" \
168676ad07a4SPeter Maydell            "This feature does not work with Xen 3.3"
1687eb6fda0fSAnthony PERARD      fi
168876ad07a4SPeter Maydell      error_exit "User requested feature Xen PCI Passthrough" \
168976ad07a4SPeter Maydell          " but this feature requires /sys from Linux"
1690eb6fda0fSAnthony PERARD    fi
1691eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1692eb6fda0fSAnthony PERARD  fi
1693eb6fda0fSAnthony PERARDfi
1694eb6fda0fSAnthony PERARD
1695e37630caSaliguori##########################################
169644dc0ca3SAlon Levy# libtool probe
169744dc0ca3SAlon Levy
16983f534581SBradif ! has $libtool; then
169944dc0ca3SAlon Levy    libtool=
170044dc0ca3SAlon Levyfi
170144dc0ca3SAlon Levy
17028e515b12SPeter Maydell# MacOSX ships with a libtool which isn't the GNU one; weed this
17038e515b12SPeter Maydell# out by checking whether libtool supports the --version switch
17048e515b12SPeter Maydellif test -n "$libtool"; then
17058e515b12SPeter Maydell  if ! "$libtool" --version >/dev/null 2>&1; then
17068e515b12SPeter Maydell    libtool=
17078e515b12SPeter Maydell  fi
17088e515b12SPeter Maydellfi
17098e515b12SPeter Maydell
171044dc0ca3SAlon Levy##########################################
1711dfffc653SJuan Quintela# Sparse probe
1712dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
17130dba6195SLoïc Minier  if has cgcc; then
1714dfffc653SJuan Quintela    sparse=yes
1715dfffc653SJuan Quintela  else
1716dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1717dfffc653SJuan Quintela      feature_not_found "sparse"
1718dfffc653SJuan Quintela    fi
1719dfffc653SJuan Quintela    sparse=no
1720dfffc653SJuan Quintela  fi
1721dfffc653SJuan Quintelafi
1722dfffc653SJuan Quintela
1723dfffc653SJuan Quintela##########################################
1724a4ccabcfSAnthony Liguori# GTK probe
1725a4ccabcfSAnthony Liguori
1726a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then
1727528de90aSDaniel P. Berrange    gtkpackage="gtk+-$gtkabi"
1728528de90aSDaniel P. Berrange    if test "$gtkabi" = "3.0" ; then
1729528de90aSDaniel P. Berrange      gtkversion="3.0.0"
1730528de90aSDaniel P. Berrange      vtepackage="vte-2.90"
1731528de90aSDaniel P. Berrange      vteversion="0.32.0"
1732528de90aSDaniel P. Berrange    else
1733528de90aSDaniel P. Berrange      gtkversion="2.18.0"
1734528de90aSDaniel P. Berrange      vtepackage="vte"
1735528de90aSDaniel P. Berrange      vteversion="0.24.0"
1736528de90aSDaniel P. Berrange    fi
17370d185e63SPeter Maydell    if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
17380d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17390d185e63SPeter Maydell            feature_not_found "gtk"
17400d185e63SPeter Maydell        fi
17410d185e63SPeter Maydell        gtk="no"
17420d185e63SPeter Maydell    elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
17430d185e63SPeter Maydell        if test "$gtk" = "yes" ; then
17440d185e63SPeter Maydell            error_exit "libvte not found (required for gtk support)"
17450d185e63SPeter Maydell        fi
17460d185e63SPeter Maydell        gtk="no"
17470d185e63SPeter Maydell    else
1748ca871ec8SStefan Weil	gtk_cflags=`$pkg_config --cflags $gtkpackage`
1749ca871ec8SStefan Weil	gtk_libs=`$pkg_config --libs $gtkpackage`
1750ca871ec8SStefan Weil	vte_cflags=`$pkg_config --cflags $vtepackage`
1751ca871ec8SStefan Weil	vte_libs=`$pkg_config --libs $vtepackage`
1752a4ccabcfSAnthony Liguori	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1753a4ccabcfSAnthony Liguori	gtk="yes"
1754a4ccabcfSAnthony Liguori    fi
1755a4ccabcfSAnthony Liguorifi
1756a4ccabcfSAnthony Liguori
1757a4ccabcfSAnthony Liguori##########################################
175811d9f695Sbellard# SDL probe
175911d9f695Sbellard
17603ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
17613ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
17623ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
17633ec87ffeSPaolo Bonzini  sdl_config=sdl-config
17643ec87ffeSPaolo Bonzinifi
17653ec87ffeSPaolo Bonzini
176665d5d3f9SStefan Weilif $pkg_config sdl --exists; then
1767a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1768fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
17693ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
17703ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
17719316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1772a0dfd8a4SLoïc Minierelse
1773a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1774a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1775a0dfd8a4SLoïc Minier  fi
1776a0dfd8a4SLoïc Minier  sdl=no
17779316f803SPaolo Bonzinifi
177829e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
17793ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
17803ec87ffeSPaolo Bonzinifi
178111d9f695Sbellard
17829316f803SPaolo Bonzinisdl_too_old=no
1783c4198157SJuan Quintelaif test "$sdl" != "no" ; then
178411d9f695Sbellard  cat > $TMPC << EOF
178511d9f695Sbellard#include <SDL.h>
178611d9f695Sbellard#undef main /* We don't want SDL to override our main() */
178711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
178811d9f695SbellardEOF
17899316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
179074f42e18STeLeMan  if test "$static" = "yes" ; then
179174f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
179274f42e18STeLeMan  else
17939316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
179474f42e18STeLeMan  fi
179552166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
179611d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
179711d9f695Sbellard      sdl_too_old=yes
179811d9f695Sbellard    else
1799fd677642Sths      if test "$cocoa" = "no" ; then
180011d9f695Sbellard        sdl=yes
180111d9f695Sbellard      fi
1802fd677642Sths    fi
18037c1f25b4Sbellard
180467c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
18051ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
180667c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1807f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1808f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
180911d9f695Sbellard      fi
181052166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
18111ac88f28SJuan Quintela	:
18121ac88f28SJuan Quintela      else
18131ac88f28SJuan Quintela        sdl=no
18147c1f25b4Sbellard      fi
18157c1f25b4Sbellard    fi # static link
1816c4198157SJuan Quintela  else # sdl not found
1817c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1818c4198157SJuan Quintela      feature_not_found "sdl"
1819c4198157SJuan Quintela    fi
1820c4198157SJuan Quintela    sdl=no
18217c1f25b4Sbellard  fi # sdl compile test
1822fd677642Sthsfi
182311d9f695Sbellard
18245368a422Saliguoriif test "$sdl" = "yes" ; then
18255368a422Saliguori  cat > $TMPC <<EOF
18265368a422Saliguori#include <SDL.h>
18275368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
18285368a422Saliguori#include <X11/XKBlib.h>
18295368a422Saliguori#else
18305368a422Saliguori#error No x11 support
18315368a422Saliguori#endif
18325368a422Saliguoriint main(void) { return 0; }
18335368a422SaliguoriEOF
183452166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1835681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
18365368a422Saliguori  fi
18370705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
18385368a422Saliguorifi
18395368a422Saliguori
18408f28f3fbSths##########################################
18412da776dbSMichael R. Hines# RDMA needs OpenFabrics libraries
18422da776dbSMichael R. Hinesif test "$rdma" != "no" ; then
18432da776dbSMichael R. Hines  cat > $TMPC <<EOF
18442da776dbSMichael R. Hines#include <rdma/rdma_cma.h>
18452da776dbSMichael R. Hinesint main(void) { return 0; }
18462da776dbSMichael R. HinesEOF
18472da776dbSMichael R. Hines  rdma_libs="-lrdmacm -libverbs"
18482da776dbSMichael R. Hines  if compile_prog "" "$rdma_libs" ; then
18492da776dbSMichael R. Hines    rdma="yes"
18502da776dbSMichael R. Hines    libs_softmmu="$libs_softmmu $rdma_libs"
18512da776dbSMichael R. Hines  else
18522da776dbSMichael R. Hines    if test "$rdma" = "yes" ; then
18532da776dbSMichael R. Hines        error_exit \
18542da776dbSMichael R. Hines            " OpenFabrics librdmacm/libibverbs not present." \
18552da776dbSMichael R. Hines            " Your options:" \
18562da776dbSMichael R. Hines            "  (1) Fast: Install infiniband packages from your distro." \
18572da776dbSMichael R. Hines            "  (2) Cleanest: Install libraries from www.openfabrics.org" \
18582da776dbSMichael R. Hines            "  (3) Also: Install softiwarp if you don't have RDMA hardware"
18592da776dbSMichael R. Hines    fi
18602da776dbSMichael R. Hines    rdma="no"
18612da776dbSMichael R. Hines  fi
18622da776dbSMichael R. Hinesfi
18632da776dbSMichael R. Hines
18642da776dbSMichael R. Hines##########################################
18657536ee4bSTim Hardeck# VNC TLS/WS detection
18667536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
1867ae6b5e5aSaliguori  cat > $TMPC <<EOF
1868ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1869ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1870ae6b5e5aSaliguoriEOF
1871a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1872a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
187352166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
18747536ee4bSTim Hardeck    if test "$vnc_tls" != "no" ; then
18751be10ad2SJuan Quintela      vnc_tls=yes
18767536ee4bSTim Hardeck    fi
18777536ee4bSTim Hardeck    if test "$vnc_ws" != "no" ; then
18787536ee4bSTim Hardeck      vnc_ws=yes
18797536ee4bSTim Hardeck    fi
1880a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1881ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
1882ae6b5e5aSaliguori  else
18831be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
18841be10ad2SJuan Quintela      feature_not_found "vnc-tls"
18851be10ad2SJuan Quintela    fi
18867536ee4bSTim Hardeck    if test "$vnc_ws" = "yes" ; then
18877536ee4bSTim Hardeck      feature_not_found "vnc-ws"
18887536ee4bSTim Hardeck    fi
18891be10ad2SJuan Quintela    vnc_tls=no
18907536ee4bSTim Hardeck    vnc_ws=no
18918d5d2d4cSths  fi
18928d5d2d4cSthsfi
18938d5d2d4cSths
18948d5d2d4cSths##########################################
18952f9606b3Saliguori# VNC SASL detection
1896821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
18972f9606b3Saliguori  cat > $TMPC <<EOF
18982f9606b3Saliguori#include <sasl/sasl.h>
18992f9606b3Saliguori#include <stdio.h>
19002f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
19012f9606b3SaliguoriEOF
19022f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
19032f9606b3Saliguori  vnc_sasl_cflags=""
19042f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
190552166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1906ea784e3bSJuan Quintela    vnc_sasl=yes
1907fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1908ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
19092f9606b3Saliguori  else
1910ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1911ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1912ea784e3bSJuan Quintela    fi
1913ea784e3bSJuan Quintela    vnc_sasl=no
19142f9606b3Saliguori  fi
19152f9606b3Saliguorifi
19162f9606b3Saliguori
19172f9606b3Saliguori##########################################
19182f6f5c7aSCorentin Chary# VNC JPEG detection
1919821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
19202f6f5c7aSCorentin Charycat > $TMPC <<EOF
19212f6f5c7aSCorentin Chary#include <stdio.h>
19222f6f5c7aSCorentin Chary#include <jpeglib.h>
19232f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
19242f6f5c7aSCorentin CharyEOF
19252f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
19262f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
19272f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
19282f6f5c7aSCorentin Chary    vnc_jpeg=yes
19292f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1930ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
19312f6f5c7aSCorentin Chary  else
19322f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
19332f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
19342f6f5c7aSCorentin Chary    fi
19352f6f5c7aSCorentin Chary    vnc_jpeg=no
19362f6f5c7aSCorentin Chary  fi
19372f6f5c7aSCorentin Charyfi
19382f6f5c7aSCorentin Chary
19392f6f5c7aSCorentin Chary##########################################
1940efe556adSCorentin Chary# VNC PNG detection
1941821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1942efe556adSCorentin Charycat > $TMPC <<EOF
1943efe556adSCorentin Chary//#include <stdio.h>
1944efe556adSCorentin Chary#include <png.h>
1945832ce9c2SScott Wood#include <stddef.h>
1946efe556adSCorentin Charyint main(void) {
1947efe556adSCorentin Chary    png_structp png_ptr;
1948efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
19497edc3fedSPeter Maydell    return png_ptr != 0;
1950efe556adSCorentin Chary}
1951efe556adSCorentin CharyEOF
195265d5d3f9SStefan Weil  if $pkg_config libpng --exists; then
1953ca871ec8SStefan Weil    vnc_png_cflags=`$pkg_config libpng --cflags`
1954ca871ec8SStefan Weil    vnc_png_libs=`$pkg_config libpng --libs`
19559af8025eSBrad  else
1956efe556adSCorentin Chary    vnc_png_cflags=""
1957efe556adSCorentin Chary    vnc_png_libs="-lpng"
19589af8025eSBrad  fi
1959efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1960efe556adSCorentin Chary    vnc_png=yes
1961efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
19629af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1963efe556adSCorentin Chary  else
1964efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1965efe556adSCorentin Chary      feature_not_found "vnc-png"
1966efe556adSCorentin Chary    fi
1967efe556adSCorentin Chary    vnc_png=no
1968efe556adSCorentin Chary  fi
1969efe556adSCorentin Charyfi
1970efe556adSCorentin Chary
1971efe556adSCorentin Chary##########################################
197276655d6dSaliguori# fnmatch() probe, used for ACL routines
197376655d6dSaliguorifnmatch="no"
197476655d6dSaliguoricat > $TMPC << EOF
197576655d6dSaliguori#include <fnmatch.h>
197676655d6dSaliguoriint main(void)
197776655d6dSaliguori{
197876655d6dSaliguori    fnmatch("foo", "foo", 0);
197976655d6dSaliguori    return 0;
198076655d6dSaliguori}
198176655d6dSaliguoriEOF
198252166aa0SJuan Quintelaif compile_prog "" "" ; then
198376655d6dSaliguori   fnmatch="yes"
198476655d6dSaliguorifi
198576655d6dSaliguori
198676655d6dSaliguori##########################################
1987ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
19882d16c8e9SPeter Maydell# Note that on some systems (notably MacOSX) no extra library
19892d16c8e9SPeter Maydell# need be linked to get the uuid functions.
1990ee682d27SStefan Weilif test "$uuid" != "no" ; then
1991ee682d27SStefan Weil  uuid_libs="-luuid"
1992ee682d27SStefan Weil  cat > $TMPC << EOF
1993ee682d27SStefan Weil#include <uuid/uuid.h>
1994ee682d27SStefan Weilint main(void)
1995ee682d27SStefan Weil{
1996ee682d27SStefan Weil    uuid_t my_uuid;
1997ee682d27SStefan Weil    uuid_generate(my_uuid);
1998ee682d27SStefan Weil    return 0;
1999ee682d27SStefan Weil}
2000ee682d27SStefan WeilEOF
20012d16c8e9SPeter Maydell  if compile_prog "" "" ; then
20022d16c8e9SPeter Maydell    uuid="yes"
20032d16c8e9SPeter Maydell  elif compile_prog "" "$uuid_libs" ; then
2004ee682d27SStefan Weil    uuid="yes"
2005ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
2006ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
2007ee682d27SStefan Weil  else
2008ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
2009ee682d27SStefan Weil      feature_not_found "uuid"
2010ee682d27SStefan Weil    fi
2011ee682d27SStefan Weil    uuid=no
2012ee682d27SStefan Weil  fi
2013ee682d27SStefan Weilfi
2014ee682d27SStefan Weil
2015ee682d27SStefan Weil##########################################
2016dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
2017dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
2018dce512deSChristoph Hellwig  cat > $TMPC << EOF
2019ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
2020dce512deSChristoph Hellwig#include <xfs/xfs.h>
2021dce512deSChristoph Hellwigint main(void)
2022dce512deSChristoph Hellwig{
2023dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
2024dce512deSChristoph Hellwig    return 0;
2025dce512deSChristoph Hellwig}
2026dce512deSChristoph HellwigEOF
2027dce512deSChristoph Hellwig  if compile_prog "" "" ; then
2028dce512deSChristoph Hellwig    xfs="yes"
2029dce512deSChristoph Hellwig  else
2030dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
2031dce512deSChristoph Hellwig      feature_not_found "xfs"
2032dce512deSChristoph Hellwig    fi
2033dce512deSChristoph Hellwig    xfs=no
2034dce512deSChristoph Hellwig  fi
2035dce512deSChristoph Hellwigfi
2036dce512deSChristoph Hellwig
2037dce512deSChristoph Hellwig##########################################
20388a16d273Sths# vde libraries probe
2039dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
20404baae0acSJuan Quintela  vde_libs="-lvdeplug"
20418a16d273Sths  cat > $TMPC << EOF
20428a16d273Sths#include <libvdeplug.h>
20434a7f0e06Spbrookint main(void)
20444a7f0e06Spbrook{
20454a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
2046fea08e08SPeter Maydell    char s[] = "";
2047fea08e08SPeter Maydell    vde_open(s, s, &a);
20484a7f0e06Spbrook    return 0;
20494a7f0e06Spbrook}
20508a16d273SthsEOF
205152166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
20524baae0acSJuan Quintela    vde=yes
20538e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
20548e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
2055dfb278bdSJuan Quintela  else
2056dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
2057dfb278bdSJuan Quintela      feature_not_found "vde"
2058dfb278bdSJuan Quintela    fi
2059dfb278bdSJuan Quintela    vde=no
20608a16d273Sths  fi
20618a16d273Sthsfi
20628a16d273Sths
20638a16d273Sths##########################################
206447e98658SCorey Bryant# libcap-ng library probe
206547e98658SCorey Bryantif test "$cap_ng" != "no" ; then
206647e98658SCorey Bryant  cap_libs="-lcap-ng"
206747e98658SCorey Bryant  cat > $TMPC << EOF
206847e98658SCorey Bryant#include <cap-ng.h>
206947e98658SCorey Bryantint main(void)
207047e98658SCorey Bryant{
207147e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
207247e98658SCorey Bryant    return 0;
207347e98658SCorey Bryant}
207447e98658SCorey BryantEOF
207547e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
207647e98658SCorey Bryant    cap_ng=yes
207747e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
207847e98658SCorey Bryant  else
207947e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
208047e98658SCorey Bryant      feature_not_found "cap_ng"
208147e98658SCorey Bryant    fi
208247e98658SCorey Bryant    cap_ng=no
208347e98658SCorey Bryant  fi
208447e98658SCorey Bryantfi
208547e98658SCorey Bryant
208647e98658SCorey Bryant##########################################
2087c2de5c91Smalc# Sound support libraries probe
20888f28f3fbSths
2089c2de5c91Smalcaudio_drv_probe()
2090c2de5c91Smalc{
2091c2de5c91Smalc    drv=$1
2092c2de5c91Smalc    hdr=$2
2093c2de5c91Smalc    lib=$3
2094c2de5c91Smalc    exp=$4
2095c2de5c91Smalc    cfl=$5
20968f28f3fbSths        cat > $TMPC << EOF
2097c2de5c91Smalc#include <$hdr>
2098c2de5c91Smalcint main(void) { $exp }
20998f28f3fbSthsEOF
210052166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
21018f28f3fbSths        :
21028f28f3fbSths    else
210376ad07a4SPeter Maydell        error_exit "$drv check failed" \
210476ad07a4SPeter Maydell            "Make sure to have the $drv libs and headers installed."
21058f28f3fbSths    fi
2106c2de5c91Smalc}
2107c2de5c91Smalc
21082fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2109c2de5c91Smalcfor drv in $audio_drv_list; do
2110c2de5c91Smalc    case $drv in
2111c2de5c91Smalc    alsa)
2112c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
2113e35bcb0cSStefan Weil        "return snd_pcm_close((snd_pcm_t *)0);"
2114a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
2115c2de5c91Smalc    ;;
2116c2de5c91Smalc
2117c2de5c91Smalc    fmod)
2118c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
211976ad07a4SPeter Maydell        error_exit "You must specify path to FMOD library and headers" \
212076ad07a4SPeter Maydell            "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
21218f28f3fbSths    fi
2122c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2123a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
2124c2de5c91Smalc    ;;
2125c2de5c91Smalc
2126c2de5c91Smalc    esd)
2127c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2128a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
212967f86e8eSJuan Quintela    audio_pt_int="yes"
2130c2de5c91Smalc    ;;
2131b8e59f18Smalc
2132b8e59f18Smalc    pa)
2133a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2134a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2135a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
213667f86e8eSJuan Quintela    audio_pt_int="yes"
2137b8e59f18Smalc    ;;
2138b8e59f18Smalc
2139997e690aSJuan Quintela    coreaudio)
2140997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
2141997e690aSJuan Quintela    ;;
2142997e690aSJuan Quintela
2143a4bf6780SJuan Quintela    dsound)
2144a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2145d5631638Smalc      audio_win_int="yes"
2146a4bf6780SJuan Quintela    ;;
2147a4bf6780SJuan Quintela
2148a4bf6780SJuan Quintela    oss)
2149a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
2150a4bf6780SJuan Quintela    ;;
2151a4bf6780SJuan Quintela
2152a4bf6780SJuan Quintela    sdl|wav)
21532f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
21542f6a1ab0Sblueswir1    ;;
21552f6a1ab0Sblueswir1
2156d5631638Smalc    winwave)
2157d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
2158d5631638Smalc      audio_win_int="yes"
2159d5631638Smalc    ;;
2160d5631638Smalc
2161e4c63a6aSmalc    *)
21621c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
216376ad07a4SPeter Maydell        error_exit "Unknown driver '$drv' selected" \
216476ad07a4SPeter Maydell            "Possible drivers are: $audio_possible_drivers"
2165e4c63a6aSmalc    }
2166e4c63a6aSmalc    ;;
2167c2de5c91Smalc    esac
2168c2de5c91Smalcdone
21698f28f3fbSths
21704d3b6f6eSbalrog##########################################
21712e4d9fb1Saurel32# BrlAPI probe
21722e4d9fb1Saurel32
21734ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
2174eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
21752e4d9fb1Saurel32  cat > $TMPC << EOF
21762e4d9fb1Saurel32#include <brlapi.h>
2177832ce9c2SScott Wood#include <stddef.h>
21782e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
21792e4d9fb1Saurel32EOF
218052166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
21812e4d9fb1Saurel32    brlapi=yes
2182264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
21834ffcedb6SJuan Quintela  else
21844ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
21854ffcedb6SJuan Quintela      feature_not_found "brlapi"
21864ffcedb6SJuan Quintela    fi
21874ffcedb6SJuan Quintela    brlapi=no
2188eb82284fSJuan Quintela  fi
2189eb82284fSJuan Quintelafi
21902e4d9fb1Saurel32
21912e4d9fb1Saurel32##########################################
21924d3b6f6eSbalrog# curses probe
2193a3605bf6SMichael Tokarevif test "$curses" != "no" ; then
2194e095e2f3SStefan Weil  if test "$mingw32" = "yes" ; then
2195e095e2f3SStefan Weil    curses_list="-lpdcurses"
2196e095e2f3SStefan Weil  else
2197cfeda5f4SEd Maste    curses_list="$($pkg_config --libs ncurses 2>/dev/null):-lncurses:-lcurses"
2198e095e2f3SStefan Weil  fi
2199c584a6d0SJuan Quintela  curses_found=no
22004d3b6f6eSbalrog  cat > $TMPC << EOF
22014d3b6f6eSbalrog#include <curses.h>
2202ef9a2524SStefan Weilint main(void) {
2203ef9a2524SStefan Weil  const char *s = curses_version();
2204ef9a2524SStefan Weil  resize_term(0, 0);
2205ef9a2524SStefan Weil  return s != 0;
2206ef9a2524SStefan Weil}
22074d3b6f6eSbalrogEOF
2208ecbe251fSVadim Evard  IFS=:
22094f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
2210ecbe251fSVadim Evard    unset IFS
22114f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
2212c584a6d0SJuan Quintela      curses_found=yes
22134f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
22144f78ef9aSJuan Quintela      break
22154d3b6f6eSbalrog    fi
22164f78ef9aSJuan Quintela  done
2217ecbe251fSVadim Evard  unset IFS
2218c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
2219c584a6d0SJuan Quintela    curses=yes
2220c584a6d0SJuan Quintela  else
2221c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
2222c584a6d0SJuan Quintela      feature_not_found "curses"
2223c584a6d0SJuan Quintela    fi
2224c584a6d0SJuan Quintela    curses=no
2225c584a6d0SJuan Quintela  fi
22264f78ef9aSJuan Quintelafi
22274d3b6f6eSbalrog
2228414f0dabSblueswir1##########################################
2229769ce76dSAlexander Graf# curl probe
2230a3605bf6SMichael Tokarevif test "$curl" != "no" ; then
223165d5d3f9SStefan Weil  if $pkg_config libcurl --exists; then
2232a8bd70adSPaolo Bonzini    curlconfig="$pkg_config libcurl"
22334e2b0658SPaolo Bonzini  else
22344e2b0658SPaolo Bonzini    curlconfig=curl-config
22354e2b0658SPaolo Bonzini  fi
2236769ce76dSAlexander Graf  cat > $TMPC << EOF
2237769ce76dSAlexander Graf#include <curl/curl.h>
22380b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2239769ce76dSAlexander GrafEOF
22404e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
22414e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2242b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2243769ce76dSAlexander Graf    curl=yes
2244f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2245f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2246788c8196SJuan Quintela  else
2247788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2248788c8196SJuan Quintela      feature_not_found "curl"
2249788c8196SJuan Quintela    fi
2250788c8196SJuan Quintela    curl=no
2251769ce76dSAlexander Graf  fi
2252769ce76dSAlexander Graffi # test "$curl"
2253769ce76dSAlexander Graf
2254769ce76dSAlexander Graf##########################################
2255fb599c9aSbalrog# bluez support probe
2256a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2257e820e3f4Sbalrog  cat > $TMPC << EOF
2258e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2259e820e3f4Sbalrogint main(void) { return bt_error(0); }
2260e820e3f4SbalrogEOF
2261a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2262a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
226352166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2264a20a6f46SJuan Quintela    bluez=yes
2265e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2266e820e3f4Sbalrog  else
2267a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2268a20a6f46SJuan Quintela      feature_not_found "bluez"
2269a20a6f46SJuan Quintela    fi
2270e820e3f4Sbalrog    bluez="no"
2271e820e3f4Sbalrog  fi
2272fb599c9aSbalrogfi
2273fb599c9aSbalrog
2274fb599c9aSbalrog##########################################
2275e18df141SAnthony Liguori# glib support probe
2276a52d28afSPaolo Bonzini
2277a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2278a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2279a52d28afSPaolo Bonzini    glib_req_ver=2.20
2280a52d28afSPaolo Bonzinielse
2281a52d28afSPaolo Bonzini    glib_req_ver=2.12
2282a52d28afSPaolo Bonzinifi
228365d5d3f9SStefan Weilif $pkg_config --atleast-version=$glib_req_ver gthread-2.0; then
2284ca871ec8SStefan Weil    glib_cflags=`$pkg_config --cflags gthread-2.0`
2285ca871ec8SStefan Weil    glib_libs=`$pkg_config --libs gthread-2.0`
228614015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2287957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2288e18df141SAnthony Liguorielse
228976ad07a4SPeter Maydell    error_exit "glib-$glib_req_ver required to compile QEMU"
2290e18df141SAnthony Liguorifi
2291e18df141SAnthony Liguori
2292e18df141SAnthony Liguori##########################################
2293e2134eb9SGerd Hoffmann# pixman support probe
2294e2134eb9SGerd Hoffmann
2295e2134eb9SGerd Hoffmannif test "$pixman" = ""; then
229674880fe2SRobert Schiele  if test "$want_tools" = "no" -a "$softmmu" = "no"; then
229774880fe2SRobert Schiele    pixman="none"
229874880fe2SRobert Schiele  elif $pkg_config pixman-1 > /dev/null 2>&1; then
2299e2134eb9SGerd Hoffmann    pixman="system"
2300e2134eb9SGerd Hoffmann  else
2301e2134eb9SGerd Hoffmann    pixman="internal"
2302e2134eb9SGerd Hoffmann  fi
2303e2134eb9SGerd Hoffmannfi
230474880fe2SRobert Schieleif test "$pixman" = "none"; then
230574880fe2SRobert Schiele  if test "$want_tools" != "no" -o "$softmmu" != "no"; then
230676ad07a4SPeter Maydell    error_exit "pixman disabled but system emulation or tools build" \
230776ad07a4SPeter Maydell        "enabled.  You can turn off pixman only if you also" \
230876ad07a4SPeter Maydell        "disable all system emulation targets and the tools" \
230976ad07a4SPeter Maydell        "build with '--disable-tools --disable-system'."
231074880fe2SRobert Schiele  fi
231174880fe2SRobert Schiele  pixman_cflags=
231274880fe2SRobert Schiele  pixman_libs=
231374880fe2SRobert Schieleelif test "$pixman" = "system"; then
2314ca871ec8SStefan Weil  pixman_cflags=`$pkg_config --cflags pixman-1`
2315ca871ec8SStefan Weil  pixman_libs=`$pkg_config --libs pixman-1`
2316e2134eb9SGerd Hoffmannelse
2317e2134eb9SGerd Hoffmann  if test ! -d ${source_path}/pixman/pixman; then
231876ad07a4SPeter Maydell    error_exit "pixman not present. Your options:" \
231976ad07a4SPeter Maydell        "  (1) Preferred: Install the pixman devel package (any recent" \
232076ad07a4SPeter Maydell        "      distro should have packages as Xorg needs pixman too)." \
232176ad07a4SPeter Maydell        "  (2) Fetch the pixman submodule, using:" \
232276ad07a4SPeter Maydell        "      git submodule update --init pixman"
2323e2134eb9SGerd Hoffmann  fi
23245ca9388aSGerd Hoffmann  mkdir -p pixman/pixman
23255ca9388aSGerd Hoffmann  pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
23265ca9388aSGerd Hoffmann  pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2327e2134eb9SGerd Hoffmannfi
2328e2134eb9SGerd Hoffmann
2329e2134eb9SGerd Hoffmann##########################################
233017bff52bSM. Mohan Kumar# libcap probe
233117bff52bSM. Mohan Kumar
233217bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
233317bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
233417bff52bSM. Mohan Kumar#include <stdio.h>
233517bff52bSM. Mohan Kumar#include <sys/capability.h>
2336cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
233717bff52bSM. Mohan KumarEOF
233817bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
233917bff52bSM. Mohan Kumar    cap=yes
234017bff52bSM. Mohan Kumar  else
234117bff52bSM. Mohan Kumar    cap=no
234217bff52bSM. Mohan Kumar  fi
234317bff52bSM. Mohan Kumarfi
234417bff52bSM. Mohan Kumar
234517bff52bSM. Mohan Kumar##########################################
2346e5d355d1Saliguori# pthread probe
23474b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
23483c529d93Saliguori
2349e5d355d1Saliguoripthread=no
2350414f0dabSblueswir1cat > $TMPC << EOF
23513c529d93Saliguori#include <pthread.h>
23527a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
23537a42bbe4SStefan Weilint main(void) {
23547a42bbe4SStefan Weil  pthread_t thread;
23557a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
23567a42bbe4SStefan Weil  return 0;
23577a42bbe4SStefan Weil}
2358414f0dabSblueswir1EOF
2359bd00d539SAndreas Färberif compile_prog "" "" ; then
2360bd00d539SAndreas Färber  pthread=yes
2361bd00d539SAndreas Färberelse
2362de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
236352166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2364e5d355d1Saliguori      pthread=yes
2365e3c56761SPeter Portante      found=no
2366e3c56761SPeter Portante      for lib_entry in $LIBS; do
2367e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2368e3c56761SPeter Portante          found=yes
2369e3c56761SPeter Portante          break
2370e3c56761SPeter Portante        fi
2371e3c56761SPeter Portante      done
2372e3c56761SPeter Portante      if test "$found" = "no"; then
23735572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2374e3c56761SPeter Portante      fi
2375de65fe0fSSebastian Herbszt      break
2376414f0dabSblueswir1    fi
2377de65fe0fSSebastian Herbszt  done
2378bd00d539SAndreas Färberfi
2379414f0dabSblueswir1
23804617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
238176ad07a4SPeter Maydell  error_exit "pthread check failed" \
238276ad07a4SPeter Maydell      "Make sure to have the pthread libs and headers installed."
2383e5d355d1Saliguorifi
2384e5d355d1Saliguori
2385bf9298b9Saliguori##########################################
2386f27aaf4bSChristian Brunner# rbd probe
2387f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2388f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2389f27aaf4bSChristian Brunner#include <stdio.h>
2390ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2391f27aaf4bSChristian Brunnerint main(void) {
2392ad32e9c0SJosh Durgin    rados_t cluster;
2393ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2394f27aaf4bSChristian Brunner    return 0;
2395f27aaf4bSChristian Brunner}
2396f27aaf4bSChristian BrunnerEOF
2397ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2398f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2399f27aaf4bSChristian Brunner    rbd=yes
2400f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2401f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2402f27aaf4bSChristian Brunner  else
2403f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2404f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2405f27aaf4bSChristian Brunner    fi
2406f27aaf4bSChristian Brunner    rbd=no
2407f27aaf4bSChristian Brunner  fi
2408f27aaf4bSChristian Brunnerfi
2409f27aaf4bSChristian Brunner
2410f27aaf4bSChristian Brunner##########################################
24110a12ec87SRichard W.M. Jones# libssh2 probe
24124fc16838SRichard W.M. Jonesmin_libssh2_version=1.2.8
24130a12ec87SRichard W.M. Jonesif test "$libssh2" != "no" ; then
241465d5d3f9SStefan Weil  if $pkg_config --atleast-version=$min_libssh2_version libssh2; then
24150a12ec87SRichard W.M. Jones    libssh2_cflags=`$pkg_config libssh2 --cflags`
24160a12ec87SRichard W.M. Jones    libssh2_libs=`$pkg_config libssh2 --libs`
24170a12ec87SRichard W.M. Jones    libssh2=yes
24180a12ec87SRichard W.M. Jones    libs_tools="$libssh2_libs $libs_tools"
24190a12ec87SRichard W.M. Jones    libs_softmmu="$libssh2_libs $libs_softmmu"
24200a12ec87SRichard W.M. Jones    QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags"
24210a12ec87SRichard W.M. Jones  else
24220a12ec87SRichard W.M. Jones    if test "$libssh2" = "yes" ; then
24234fc16838SRichard W.M. Jones      error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
24240a12ec87SRichard W.M. Jones    fi
24250a12ec87SRichard W.M. Jones    libssh2=no
24260a12ec87SRichard W.M. Jones  fi
24270a12ec87SRichard W.M. Jonesfi
24280a12ec87SRichard W.M. Jones
24290a12ec87SRichard W.M. Jones##########################################
24309a2d462eSRichard W.M. Jones# libssh2_sftp_fsync probe
24319a2d462eSRichard W.M. Jones
24329a2d462eSRichard W.M. Jonesif test "$libssh2" = "yes"; then
24339a2d462eSRichard W.M. Jones  cat > $TMPC <<EOF
24349a2d462eSRichard W.M. Jones#include <stdio.h>
24359a2d462eSRichard W.M. Jones#include <libssh2.h>
24369a2d462eSRichard W.M. Jones#include <libssh2_sftp.h>
24379a2d462eSRichard W.M. Jonesint main(void) {
24389a2d462eSRichard W.M. Jones    LIBSSH2_SESSION *session;
24399a2d462eSRichard W.M. Jones    LIBSSH2_SFTP *sftp;
24409a2d462eSRichard W.M. Jones    LIBSSH2_SFTP_HANDLE *sftp_handle;
24419a2d462eSRichard W.M. Jones    session = libssh2_session_init ();
24429a2d462eSRichard W.M. Jones    sftp = libssh2_sftp_init (session);
24439a2d462eSRichard W.M. Jones    sftp_handle = libssh2_sftp_open (sftp, "/", 0, 0);
24449a2d462eSRichard W.M. Jones    libssh2_sftp_fsync (sftp_handle);
24459a2d462eSRichard W.M. Jones    return 0;
24469a2d462eSRichard W.M. Jones}
24479a2d462eSRichard W.M. JonesEOF
24489a2d462eSRichard W.M. Jones  # libssh2_cflags/libssh2_libs defined in previous test.
24499a2d462eSRichard W.M. Jones  if compile_prog "$libssh2_cflags" "$libssh2_libs" ; then
24509a2d462eSRichard W.M. Jones    QEMU_CFLAGS="-DHAS_LIBSSH2_SFTP_FSYNC $QEMU_CFLAGS"
24519a2d462eSRichard W.M. Jones  fi
24529a2d462eSRichard W.M. Jonesfi
24539a2d462eSRichard W.M. Jones
24549a2d462eSRichard W.M. Jones##########################################
24555c6c3a6cSChristoph Hellwig# linux-aio probe
24565c6c3a6cSChristoph Hellwig
24575c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
24585c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
24595c6c3a6cSChristoph Hellwig#include <libaio.h>
24605c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2461832ce9c2SScott Wood#include <stddef.h>
24625c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
24635c6c3a6cSChristoph HellwigEOF
24645c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
24655c6c3a6cSChristoph Hellwig    linux_aio=yes
2466048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2467048d179fSPaul Brook    libs_tools="$libs_tools -laio"
24685c6c3a6cSChristoph Hellwig  else
24695c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
24705c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
24715c6c3a6cSChristoph Hellwig    fi
24723cfcae3cSLuiz Capitulino    linux_aio=no
24735c6c3a6cSChristoph Hellwig  fi
24745c6c3a6cSChristoph Hellwigfi
24755c6c3a6cSChristoph Hellwig
24765c6c3a6cSChristoph Hellwig##########################################
24773b8acc11SPaolo Bonzini# TPM passthrough is only on x86 Linux
24783b8acc11SPaolo Bonzini
24793b8acc11SPaolo Bonziniif test "$targetos" = Linux && test "$cpu" = i386 -o "$cpu" = x86_64; then
24803b8acc11SPaolo Bonzini  tpm_passthrough=$tpm
24813b8acc11SPaolo Bonzinielse
24823b8acc11SPaolo Bonzini  tpm_passthrough=no
24833b8acc11SPaolo Bonzinifi
24843b8acc11SPaolo Bonzini
24853b8acc11SPaolo Bonzini##########################################
2486583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio
2487583f6e7bSStefan Hajnoczi
2488583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \
2489583f6e7bSStefan Hajnoczi	"$linux_aio" != "yes" ; then
249076ad07a4SPeter Maydell  error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2491583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then
2492583f6e7bSStefan Hajnoczi  virtio_blk_data_plane=$linux_aio
2493583f6e7bSStefan Hajnoczifi
2494583f6e7bSStefan Hajnoczi
2495583f6e7bSStefan Hajnoczi##########################################
2496758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2497758e8e38SVenkateswararao Jujjuri (JV)
2498758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2499758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2500758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2501758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2502f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2503f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2504f2338fb4SPavel Borzenkov#else
25054f26f2b6SAvi Kivity#include <sys/xattr.h>
2506f2338fb4SPavel Borzenkov#endif
2507758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2508758e8e38SVenkateswararao Jujjuri (JV)EOF
25094f26f2b6SAvi Kivity  if compile_prog "" "" ; then
25104f26f2b6SAvi Kivity    attr=yes
25114f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2512f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2513758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2514758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
25154f26f2b6SAvi Kivity    libattr=yes
2516758e8e38SVenkateswararao Jujjuri (JV)  else
2517758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2518758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2519758e8e38SVenkateswararao Jujjuri (JV)    fi
2520758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2521758e8e38SVenkateswararao Jujjuri (JV)  fi
2522758e8e38SVenkateswararao Jujjuri (JV)fi
2523758e8e38SVenkateswararao Jujjuri (JV)
2524758e8e38SVenkateswararao Jujjuri (JV)##########################################
2525bf9298b9Saliguori# iovec probe
2526bf9298b9Saliguoricat > $TMPC <<EOF
2527db34f0b3Sblueswir1#include <sys/types.h>
2528bf9298b9Saliguori#include <sys/uio.h>
2529db34f0b3Sblueswir1#include <unistd.h>
2530f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2531bf9298b9SaliguoriEOF
2532bf9298b9Saliguoriiovec=no
253352166aa0SJuan Quintelaif compile_prog "" "" ; then
2534bf9298b9Saliguori  iovec=yes
2535bf9298b9Saliguorifi
2536bf9298b9Saliguori
2537f652e6afSaurel32##########################################
2538ceb42de8Saliguori# preadv probe
2539ceb42de8Saliguoricat > $TMPC <<EOF
2540ceb42de8Saliguori#include <sys/types.h>
2541ceb42de8Saliguori#include <sys/uio.h>
2542ceb42de8Saliguori#include <unistd.h>
2543c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); }
2544ceb42de8SaliguoriEOF
2545ceb42de8Saliguoripreadv=no
254652166aa0SJuan Quintelaif compile_prog "" "" ; then
2547ceb42de8Saliguori  preadv=yes
2548ceb42de8Saliguorifi
2549ceb42de8Saliguori
2550ceb42de8Saliguori##########################################
2551f652e6afSaurel32# fdt probe
2552e169e1e1SPeter Maydell# fdt support is mandatory for at least some target architectures,
2553e169e1e1SPeter Maydell# so insist on it if we're building those system emulators.
2554e169e1e1SPeter Maydellfdt_required=no
2555e169e1e1SPeter Maydellfor target in $target_list; do
2556e169e1e1SPeter Maydell  case $target in
25576a49fa95SAlexander Graf    aarch64*-softmmu|arm*-softmmu|ppc*-softmmu|microblaze*-softmmu)
2558e169e1e1SPeter Maydell      fdt_required=yes
2559e169e1e1SPeter Maydell    ;;
2560e169e1e1SPeter Maydell  esac
2561e169e1e1SPeter Maydelldone
2562e169e1e1SPeter Maydell
2563e169e1e1SPeter Maydellif test "$fdt_required" = "yes"; then
2564e169e1e1SPeter Maydell  if test "$fdt" = "no"; then
2565e169e1e1SPeter Maydell    error_exit "fdt disabled but some requested targets require it." \
2566e169e1e1SPeter Maydell      "You can turn off fdt only if you also disable all the system emulation" \
2567e169e1e1SPeter Maydell      "targets which need it (by specifying a cut down --target-list)."
2568e169e1e1SPeter Maydell  fi
2569e169e1e1SPeter Maydell  fdt=yes
2570e169e1e1SPeter Maydellfi
2571e169e1e1SPeter Maydell
25722df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2573b41af4baSJuan Quintela  fdt_libs="-lfdt"
257496ce6545SPeter Crosthwaite  # explicitly check for libfdt_env.h as it is missing in some stable installs
2575f652e6afSaurel32  cat > $TMPC << EOF
257696ce6545SPeter Crosthwaite#include <libfdt_env.h>
2577f652e6afSaurel32int main(void) { return 0; }
2578f652e6afSaurel32EOF
257952166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2580a540f158SPeter Crosthwaite    # system DTC is good - use it
2581f652e6afSaurel32    fdt=yes
2582a540f158SPeter Crosthwaite  elif test -d ${source_path}/dtc/libfdt ; then
2583a540f158SPeter Crosthwaite    # have submodule DTC - use it
2584a540f158SPeter Crosthwaite    fdt=yes
2585a540f158SPeter Crosthwaite    dtc_internal="yes"
2586a540f158SPeter Crosthwaite    mkdir -p dtc
2587a540f158SPeter Crosthwaite    if [ "$source_path" != `pwd` ] ; then
2588a540f158SPeter Crosthwaite       symlink "$source_path/dtc/Makefile" "dtc/Makefile"
2589a540f158SPeter Crosthwaite       symlink "$source_path/dtc/scripts" "dtc/scripts"
25902df87df7SJuan Quintela    fi
2591a540f158SPeter Crosthwaite    fdt_cflags="-I\$(SRC_PATH)/dtc/libfdt"
2592a540f158SPeter Crosthwaite    fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
2593a540f158SPeter Crosthwaite  elif test "$fdt" = "yes" ; then
2594a540f158SPeter Crosthwaite    # have neither and want - prompt for system/submodule install
2595f2c4ddd9SAndreas Färber    error_exit "DTC not present. Your options:" \
2596a540f158SPeter Crosthwaite        "  (1) Preferred: Install the DTC devel package" \
2597a540f158SPeter Crosthwaite        "  (2) Fetch the DTC submodule, using:" \
2598a540f158SPeter Crosthwaite        "      git submodule update --init dtc"
2599a540f158SPeter Crosthwaite  else
2600a540f158SPeter Crosthwaite    # don't have and don't want
2601de3a354aSMichael Walle    fdt_libs=
26022df87df7SJuan Quintela    fdt=no
2603f652e6afSaurel32  fi
2604f652e6afSaurel32fi
2605f652e6afSaurel32
2606a540f158SPeter Crosthwaitelibs_softmmu="$libs_softmmu $fdt_libs"
2607a540f158SPeter Crosthwaite
260820ff075bSMichael Walle##########################################
2609b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2
2610b1e5fff4SMichael Walleif test "$glx" != "no" ; then
2611b1e5fff4SMichael Walle  glx_libs="-lGL -lX11"
261220ff075bSMichael Walle  cat > $TMPC << EOF
261320ff075bSMichael Walle#include <X11/Xlib.h>
261420ff075bSMichael Walle#include <GL/gl.h>
261520ff075bSMichael Walle#include <GL/glx.h>
2616d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
261720ff075bSMichael WalleEOF
2618d3fcbb16SMichael Walle  if compile_prog "" "-lGL -lX11" ; then
2619b1e5fff4SMichael Walle    glx=yes
262020ff075bSMichael Walle  else
2621b1e5fff4SMichael Walle    if test "$glx" = "yes" ; then
2622b1e5fff4SMichael Walle      feature_not_found "glx"
262320ff075bSMichael Walle    fi
2624b1e5fff4SMichael Walle    glx_libs=
2625b1e5fff4SMichael Walle    glx=no
262620ff075bSMichael Walle  fi
262720ff075bSMichael Wallefi
262820ff075bSMichael Walle
2629eb100396SBharata B Rao##########################################
2630eb100396SBharata B Rao# glusterfs probe
2631eb100396SBharata B Raoif test "$glusterfs" != "no" ; then
263265d5d3f9SStefan Weil  if $pkg_config --atleast-version=3 glusterfs-api; then
2633e01bee08SBharata B Rao    glusterfs="yes"
2634ca871ec8SStefan Weil    glusterfs_cflags=`$pkg_config --cflags glusterfs-api`
2635ca871ec8SStefan Weil    glusterfs_libs=`$pkg_config --libs glusterfs-api`
2636e01bee08SBharata B Rao    CFLAGS="$CFLAGS $glusterfs_cflags"
2637eb100396SBharata B Rao    libs_tools="$glusterfs_libs $libs_tools"
2638eb100396SBharata B Rao    libs_softmmu="$glusterfs_libs $libs_softmmu"
263965d5d3f9SStefan Weil    if $pkg_config --atleast-version=5 glusterfs-api; then
26400c14fb47SBharata B Rao      glusterfs_discard="yes"
26410c14fb47SBharata B Rao    fi
2642eb100396SBharata B Rao  else
2643eb100396SBharata B Rao    if test "$glusterfs" = "yes" ; then
2644eb100396SBharata B Rao      feature_not_found "GlusterFS backend support"
2645eb100396SBharata B Rao    fi
2646e01bee08SBharata B Rao    glusterfs="no"
2647eb100396SBharata B Rao  fi
2648eb100396SBharata B Raofi
2649eb100396SBharata B Rao
265039386ac7Saurel32# Check for inotify functions when we are building linux-user
26513b3f24adSaurel32# emulator.  This is done because older glibc versions don't
26523b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
26533b3f24adSaurel32# don't provide them even if kernel supports them.
26543b3f24adSaurel32#
26553b3f24adSaurel32inotify=no
26563b3f24adSaurel32cat > $TMPC << EOF
26573b3f24adSaurel32#include <sys/inotify.h>
26583b3f24adSaurel32
26593b3f24adSaurel32int
26603b3f24adSaurel32main(void)
26613b3f24adSaurel32{
26623b3f24adSaurel32	/* try to start inotify */
26638690e420Saurel32	return inotify_init();
26643b3f24adSaurel32}
26653b3f24adSaurel32EOF
266652166aa0SJuan Quintelaif compile_prog "" "" ; then
26673b3f24adSaurel32  inotify=yes
26683b3f24adSaurel32fi
26693b3f24adSaurel32
2670c05c7a73SRiku Voipioinotify1=no
2671c05c7a73SRiku Voipiocat > $TMPC << EOF
2672c05c7a73SRiku Voipio#include <sys/inotify.h>
2673c05c7a73SRiku Voipio
2674c05c7a73SRiku Voipioint
2675c05c7a73SRiku Voipiomain(void)
2676c05c7a73SRiku Voipio{
2677c05c7a73SRiku Voipio    /* try to start inotify */
2678c05c7a73SRiku Voipio    return inotify_init1(0);
2679c05c7a73SRiku Voipio}
2680c05c7a73SRiku VoipioEOF
2681c05c7a73SRiku Voipioif compile_prog "" "" ; then
2682c05c7a73SRiku Voipio  inotify1=yes
2683c05c7a73SRiku Voipiofi
2684c05c7a73SRiku Voipio
2685ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2686ebc996f3SRiku Voipioutimens=no
2687ebc996f3SRiku Voipiocat > $TMPC << EOF
2688ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2689ebc996f3SRiku Voipio#include <stddef.h>
2690ebc996f3SRiku Voipio#include <fcntl.h>
26913014ee00SPeter Maydell#include <sys/stat.h>
2692ebc996f3SRiku Voipio
2693ebc996f3SRiku Voipioint main(void)
2694ebc996f3SRiku Voipio{
2695ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2696ebc996f3SRiku Voipio    futimens(0, NULL);
2697ebc996f3SRiku Voipio    return 0;
2698ebc996f3SRiku Voipio}
2699ebc996f3SRiku VoipioEOF
270052166aa0SJuan Quintelaif compile_prog "" "" ; then
2701ebc996f3SRiku Voipio  utimens=yes
2702ebc996f3SRiku Voipiofi
2703ebc996f3SRiku Voipio
2704099d6b0fSRiku Voipio# check if pipe2 is there
2705099d6b0fSRiku Voipiopipe2=no
2706099d6b0fSRiku Voipiocat > $TMPC << EOF
2707099d6b0fSRiku Voipio#include <unistd.h>
2708099d6b0fSRiku Voipio#include <fcntl.h>
2709099d6b0fSRiku Voipio
2710099d6b0fSRiku Voipioint main(void)
2711099d6b0fSRiku Voipio{
2712099d6b0fSRiku Voipio    int pipefd[2];
27139bca8162SBruce Rogers    return pipe2(pipefd, O_CLOEXEC);
2714099d6b0fSRiku Voipio}
2715099d6b0fSRiku VoipioEOF
271652166aa0SJuan Quintelaif compile_prog "" "" ; then
2717099d6b0fSRiku Voipio  pipe2=yes
2718099d6b0fSRiku Voipiofi
2719099d6b0fSRiku Voipio
272040ff6d7eSKevin Wolf# check if accept4 is there
272140ff6d7eSKevin Wolfaccept4=no
272240ff6d7eSKevin Wolfcat > $TMPC << EOF
272340ff6d7eSKevin Wolf#include <sys/socket.h>
272440ff6d7eSKevin Wolf#include <stddef.h>
272540ff6d7eSKevin Wolf
272640ff6d7eSKevin Wolfint main(void)
272740ff6d7eSKevin Wolf{
272840ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
272940ff6d7eSKevin Wolf    return 0;
273040ff6d7eSKevin Wolf}
273140ff6d7eSKevin WolfEOF
273240ff6d7eSKevin Wolfif compile_prog "" "" ; then
273340ff6d7eSKevin Wolf  accept4=yes
273440ff6d7eSKevin Wolffi
273540ff6d7eSKevin Wolf
27363ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
27373ce34dfbSvibisreenivasansplice=no
27383ce34dfbSvibisreenivasancat > $TMPC << EOF
27393ce34dfbSvibisreenivasan#include <unistd.h>
27403ce34dfbSvibisreenivasan#include <fcntl.h>
27413ce34dfbSvibisreenivasan#include <limits.h>
27423ce34dfbSvibisreenivasan
27433ce34dfbSvibisreenivasanint main(void)
27443ce34dfbSvibisreenivasan{
274566ea0f22SStefan Weil    int len, fd = 0;
27463ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
27473ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
27483ce34dfbSvibisreenivasan    return 0;
27493ce34dfbSvibisreenivasan}
27503ce34dfbSvibisreenivasanEOF
275152166aa0SJuan Quintelaif compile_prog "" "" ; then
27523ce34dfbSvibisreenivasan  splice=yes
27533ce34dfbSvibisreenivasanfi
27543ce34dfbSvibisreenivasan
2755dcc38d1cSMarcelo Tosatti##########################################
2756dcc38d1cSMarcelo Tosatti# signalfd probe
2757dcc38d1cSMarcelo Tosattisignalfd="no"
2758dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2759dcc38d1cSMarcelo Tosatti#include <unistd.h>
2760dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2761dcc38d1cSMarcelo Tosatti#include <signal.h>
2762dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2763dcc38d1cSMarcelo TosattiEOF
2764dcc38d1cSMarcelo Tosatti
2765dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2766dcc38d1cSMarcelo Tosatti  signalfd=yes
2767dcc38d1cSMarcelo Tosattifi
2768dcc38d1cSMarcelo Tosatti
2769c2882b96SRiku Voipio# check if eventfd is supported
2770c2882b96SRiku Voipioeventfd=no
2771c2882b96SRiku Voipiocat > $TMPC << EOF
2772c2882b96SRiku Voipio#include <sys/eventfd.h>
2773c2882b96SRiku Voipio
2774c2882b96SRiku Voipioint main(void)
2775c2882b96SRiku Voipio{
277655cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2777c2882b96SRiku Voipio}
2778c2882b96SRiku VoipioEOF
2779c2882b96SRiku Voipioif compile_prog "" "" ; then
2780c2882b96SRiku Voipio  eventfd=yes
2781c2882b96SRiku Voipiofi
2782c2882b96SRiku Voipio
2783d0927938SUlrich Hecht# check for fallocate
2784d0927938SUlrich Hechtfallocate=no
2785d0927938SUlrich Hechtcat > $TMPC << EOF
2786d0927938SUlrich Hecht#include <fcntl.h>
2787d0927938SUlrich Hecht
2788d0927938SUlrich Hechtint main(void)
2789d0927938SUlrich Hecht{
2790d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2791d0927938SUlrich Hecht    return 0;
2792d0927938SUlrich Hecht}
2793d0927938SUlrich HechtEOF
27948fb03151SPeter Maydellif compile_prog "" "" ; then
2795d0927938SUlrich Hecht  fallocate=yes
2796d0927938SUlrich Hechtfi
2797d0927938SUlrich Hecht
27983d4fa43eSKusanagi Kouichi# check for fallocate hole punching
27993d4fa43eSKusanagi Kouichifallocate_punch_hole=no
28003d4fa43eSKusanagi Kouichicat > $TMPC << EOF
28013d4fa43eSKusanagi Kouichi#include <fcntl.h>
28023d4fa43eSKusanagi Kouichi#include <linux/falloc.h>
28033d4fa43eSKusanagi Kouichi
28043d4fa43eSKusanagi Kouichiint main(void)
28053d4fa43eSKusanagi Kouichi{
28063d4fa43eSKusanagi Kouichi    fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
28073d4fa43eSKusanagi Kouichi    return 0;
28083d4fa43eSKusanagi Kouichi}
28093d4fa43eSKusanagi KouichiEOF
28103d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then
28113d4fa43eSKusanagi Kouichi  fallocate_punch_hole=yes
28123d4fa43eSKusanagi Kouichifi
28133d4fa43eSKusanagi Kouichi
2814c727f47dSPeter Maydell# check for sync_file_range
2815c727f47dSPeter Maydellsync_file_range=no
2816c727f47dSPeter Maydellcat > $TMPC << EOF
2817c727f47dSPeter Maydell#include <fcntl.h>
2818c727f47dSPeter Maydell
2819c727f47dSPeter Maydellint main(void)
2820c727f47dSPeter Maydell{
2821c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2822c727f47dSPeter Maydell    return 0;
2823c727f47dSPeter Maydell}
2824c727f47dSPeter MaydellEOF
28258fb03151SPeter Maydellif compile_prog "" "" ; then
2826c727f47dSPeter Maydell  sync_file_range=yes
2827c727f47dSPeter Maydellfi
2828c727f47dSPeter Maydell
2829dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2830dace20dcSPeter Maydellfiemap=no
2831dace20dcSPeter Maydellcat > $TMPC << EOF
2832dace20dcSPeter Maydell#include <sys/ioctl.h>
2833dace20dcSPeter Maydell#include <linux/fs.h>
2834dace20dcSPeter Maydell#include <linux/fiemap.h>
2835dace20dcSPeter Maydell
2836dace20dcSPeter Maydellint main(void)
2837dace20dcSPeter Maydell{
2838dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2839dace20dcSPeter Maydell    return 0;
2840dace20dcSPeter Maydell}
2841dace20dcSPeter MaydellEOF
28428fb03151SPeter Maydellif compile_prog "" "" ; then
2843dace20dcSPeter Maydell  fiemap=yes
2844dace20dcSPeter Maydellfi
2845dace20dcSPeter Maydell
2846d0927938SUlrich Hecht# check for dup3
2847d0927938SUlrich Hechtdup3=no
2848d0927938SUlrich Hechtcat > $TMPC << EOF
2849d0927938SUlrich Hecht#include <unistd.h>
2850d0927938SUlrich Hecht
2851d0927938SUlrich Hechtint main(void)
2852d0927938SUlrich Hecht{
2853d0927938SUlrich Hecht    dup3(0, 0, 0);
2854d0927938SUlrich Hecht    return 0;
2855d0927938SUlrich Hecht}
2856d0927938SUlrich HechtEOF
285778f5d726SJan Kiszkaif compile_prog "" "" ; then
2858d0927938SUlrich Hecht  dup3=yes
2859d0927938SUlrich Hechtfi
2860d0927938SUlrich Hecht
28614e0c6529SAlex Bligh# check for ppoll support
28624e0c6529SAlex Blighppoll=no
28634e0c6529SAlex Blighcat > $TMPC << EOF
28644e0c6529SAlex Bligh#include <poll.h>
28654e0c6529SAlex Bligh
28664e0c6529SAlex Blighint main(void)
28674e0c6529SAlex Bligh{
28684e0c6529SAlex Bligh    struct pollfd pfd = { .fd = 0, .events = 0, .revents = 0 };
28694e0c6529SAlex Bligh    ppoll(&pfd, 1, 0, 0);
28704e0c6529SAlex Bligh    return 0;
28714e0c6529SAlex Bligh}
28724e0c6529SAlex BlighEOF
28734e0c6529SAlex Blighif compile_prog "" "" ; then
28744e0c6529SAlex Bligh  ppoll=yes
28754e0c6529SAlex Blighfi
28764e0c6529SAlex Bligh
2877cd758dd0SAlex Bligh# check for prctl(PR_SET_TIMERSLACK , ... ) support
2878cd758dd0SAlex Blighprctl_pr_set_timerslack=no
2879cd758dd0SAlex Blighcat > $TMPC << EOF
2880cd758dd0SAlex Bligh#include <sys/prctl.h>
2881cd758dd0SAlex Bligh
2882cd758dd0SAlex Blighint main(void)
2883cd758dd0SAlex Bligh{
2884cd758dd0SAlex Bligh    prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0);
2885cd758dd0SAlex Bligh    return 0;
2886cd758dd0SAlex Bligh}
2887cd758dd0SAlex BlighEOF
2888cd758dd0SAlex Blighif compile_prog "" "" ; then
2889cd758dd0SAlex Bligh  prctl_pr_set_timerslack=yes
2890cd758dd0SAlex Blighfi
2891cd758dd0SAlex Bligh
28923b6edd16SPeter Maydell# check for epoll support
28933b6edd16SPeter Maydellepoll=no
28943b6edd16SPeter Maydellcat > $TMPC << EOF
28953b6edd16SPeter Maydell#include <sys/epoll.h>
28963b6edd16SPeter Maydell
28973b6edd16SPeter Maydellint main(void)
28983b6edd16SPeter Maydell{
28993b6edd16SPeter Maydell    epoll_create(0);
29003b6edd16SPeter Maydell    return 0;
29013b6edd16SPeter Maydell}
29023b6edd16SPeter MaydellEOF
29038fb03151SPeter Maydellif compile_prog "" "" ; then
29043b6edd16SPeter Maydell  epoll=yes
29053b6edd16SPeter Maydellfi
29063b6edd16SPeter Maydell
29073b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
29083b6edd16SPeter Maydell# so we must check separately for their presence
29093b6edd16SPeter Maydellepoll_create1=no
29103b6edd16SPeter Maydellcat > $TMPC << EOF
29113b6edd16SPeter Maydell#include <sys/epoll.h>
29123b6edd16SPeter Maydell
29133b6edd16SPeter Maydellint main(void)
29143b6edd16SPeter Maydell{
291519e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
291619e83f6bSPeter Maydell     * a function being called. This is necessary so that on
291719e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
291819e83f6bSPeter Maydell     * the library but not declared in the header file we will
291919e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
292019e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
292119e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
292219e83f6bSPeter Maydell     */
2923c075a723SBlue Swirl    return (int)(uintptr_t)&epoll_create1;
29243b6edd16SPeter Maydell}
29253b6edd16SPeter MaydellEOF
29268fb03151SPeter Maydellif compile_prog "" "" ; then
29273b6edd16SPeter Maydell  epoll_create1=yes
29283b6edd16SPeter Maydellfi
29293b6edd16SPeter Maydell
29303b6edd16SPeter Maydellepoll_pwait=no
29313b6edd16SPeter Maydellcat > $TMPC << EOF
29323b6edd16SPeter Maydell#include <sys/epoll.h>
29333b6edd16SPeter Maydell
29343b6edd16SPeter Maydellint main(void)
29353b6edd16SPeter Maydell{
29363b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
29373b6edd16SPeter Maydell    return 0;
29383b6edd16SPeter Maydell}
29393b6edd16SPeter MaydellEOF
29408fb03151SPeter Maydellif compile_prog "" "" ; then
29413b6edd16SPeter Maydell  epoll_pwait=yes
29423b6edd16SPeter Maydellfi
29433b6edd16SPeter Maydell
2944a8fd1abaSPeter Maydell# check for sendfile support
2945a8fd1abaSPeter Maydellsendfile=no
2946a8fd1abaSPeter Maydellcat > $TMPC << EOF
2947a8fd1abaSPeter Maydell#include <sys/sendfile.h>
2948a8fd1abaSPeter Maydell
2949a8fd1abaSPeter Maydellint main(void)
2950a8fd1abaSPeter Maydell{
2951a8fd1abaSPeter Maydell    return sendfile(0, 0, 0, 0);
2952a8fd1abaSPeter Maydell}
2953a8fd1abaSPeter MaydellEOF
2954a8fd1abaSPeter Maydellif compile_prog "" "" ; then
2955a8fd1abaSPeter Maydell  sendfile=yes
2956a8fd1abaSPeter Maydellfi
2957a8fd1abaSPeter Maydell
2958cc8ae6deSpbrook# Check if tools are available to build documentation.
2959a25dba17SJuan Quintelaif test "$docs" != "no" ; then
296001668d98SStefan Weil  if has makeinfo && has pod2man; then
2961a25dba17SJuan Quintela    docs=yes
296283a3ab8bSJuan Quintela  else
2963a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2964a25dba17SJuan Quintela      feature_not_found "docs"
296583a3ab8bSJuan Quintela    fi
2966a25dba17SJuan Quintela    docs=no
296783a3ab8bSJuan Quintela  fi
2968cc8ae6deSpbrookfi
2969cc8ae6deSpbrook
2970f514f41cSStefan Weil# Search for bswap_32 function
29716ae9a1f4SJuan Quintelabyteswap_h=no
29726ae9a1f4SJuan Quintelacat > $TMPC << EOF
29736ae9a1f4SJuan Quintela#include <byteswap.h>
29746ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
29756ae9a1f4SJuan QuintelaEOF
297652166aa0SJuan Quintelaif compile_prog "" "" ; then
29776ae9a1f4SJuan Quintela  byteswap_h=yes
29786ae9a1f4SJuan Quintelafi
29796ae9a1f4SJuan Quintela
298075f13596SStefan Weil# Search for bswap32 function
29816ae9a1f4SJuan Quintelabswap_h=no
29826ae9a1f4SJuan Quintelacat > $TMPC << EOF
29836ae9a1f4SJuan Quintela#include <sys/endian.h>
29846ae9a1f4SJuan Quintela#include <sys/types.h>
29856ae9a1f4SJuan Quintela#include <machine/bswap.h>
29866ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
29876ae9a1f4SJuan QuintelaEOF
298852166aa0SJuan Quintelaif compile_prog "" "" ; then
29896ae9a1f4SJuan Quintela  bswap_h=yes
29906ae9a1f4SJuan Quintelafi
29916ae9a1f4SJuan Quintela
2992da93a1fdSaliguori##########################################
2993c589b249SRonnie Sahlberg# Do we have libiscsi
2994fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a
2995fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi.
2996c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
2997c589b249SRonnie Sahlberg  cat > $TMPC << EOF
2998fa6acb0cSRonnie Sahlberg#include <stdio.h>
2999c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
3000fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
3001c589b249SRonnie SahlbergEOF
300265d5d3f9SStefan Weil  if $pkg_config --atleast-version=1.7.0 libiscsi; then
30033c33ea96SPaolo Bonzini    libiscsi="yes"
3004ca871ec8SStefan Weil    libiscsi_cflags=$($pkg_config --cflags libiscsi)
3005ca871ec8SStefan Weil    libiscsi_libs=$($pkg_config --libs libiscsi)
30063c33ea96SPaolo Bonzini    CFLAGS="$CFLAGS $libiscsi_cflags"
30073c33ea96SPaolo Bonzini    LIBS="$LIBS $libiscsi_libs"
30083c33ea96SPaolo Bonzini  elif compile_prog "" "-liscsi" ; then
3009c589b249SRonnie Sahlberg    libiscsi="yes"
3010c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
3011c589b249SRonnie Sahlberg  else
3012c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
3013c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
3014c589b249SRonnie Sahlberg    fi
3015c589b249SRonnie Sahlberg    libiscsi="no"
3016c589b249SRonnie Sahlberg  fi
3017c589b249SRonnie Sahlbergfi
3018c589b249SRonnie Sahlberg
3019c589b249SRonnie Sahlberg
3020c589b249SRonnie Sahlberg##########################################
30218bacde8dSNatanael Copa# Do we need libm
30228bacde8dSNatanael Copacat > $TMPC << EOF
30238bacde8dSNatanael Copa#include <math.h>
30248bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); }
30258bacde8dSNatanael CopaEOF
30268bacde8dSNatanael Copaif compile_prog "" "" ; then
30278bacde8dSNatanael Copa  :
30288bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then
30298bacde8dSNatanael Copa  LIBS="-lm $LIBS"
30308bacde8dSNatanael Copa  libs_qga="-lm $libs_qga"
30318bacde8dSNatanael Copaelse
303276ad07a4SPeter Maydell  error_exit "libm check failed"
30338bacde8dSNatanael Copafi
30348bacde8dSNatanael Copa
30358bacde8dSNatanael Copa##########################################
3036da93a1fdSaliguori# Do we need librt
30378bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime
30388bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't
30398bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this
30408bacde8dSNatanael Copa# function in addition.
3041da93a1fdSaliguoricat > $TMPC <<EOF
3042da93a1fdSaliguori#include <signal.h>
3043da93a1fdSaliguori#include <time.h>
30448bacde8dSNatanael Copaint main(void) {
30458bacde8dSNatanael Copa  timer_create(CLOCK_REALTIME, NULL, NULL);
30468bacde8dSNatanael Copa  return clock_gettime(CLOCK_REALTIME, NULL);
30478bacde8dSNatanael Copa}
3048da93a1fdSaliguoriEOF
3049da93a1fdSaliguori
305052166aa0SJuan Quintelaif compile_prog "" "" ; then
305107ffa4bdSJuan Quintela  :
30528bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result
30538bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then
305407ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
30558bacde8dSNatanael Copa  libs_qga="-lrt $libs_qga"
3056da93a1fdSaliguorifi
3057da93a1fdSaliguori
305831ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
3059179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
30606362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
30616362a53fSJuan Quintelafi
30626362a53fSJuan Quintela
3063de5071c5SBlue Swirl##########################################
3064cd4ec0b4SGerd Hoffmann# spice probe
3065cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
3066cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
3067cd4ec0b4SGerd Hoffmann#include <spice.h>
3068cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
3069cd4ec0b4SGerd HoffmannEOF
3070710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
3071710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
307265d5d3f9SStefan Weil  if $pkg_config --atleast-version=0.12.0 spice-server && \
307365d5d3f9SStefan Weil     $pkg_config --atleast-version=0.12.3 spice-protocol && \
3074cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
3075cd4ec0b4SGerd Hoffmann    spice="yes"
3076cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
3077cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
30782e0e3c39SAlon Levy    spice_protocol_version=$($pkg_config --modversion spice-protocol)
30792e0e3c39SAlon Levy    spice_server_version=$($pkg_config --modversion spice-server)
3080cd4ec0b4SGerd Hoffmann  else
3081cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
3082cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
3083cd4ec0b4SGerd Hoffmann    fi
3084cd4ec0b4SGerd Hoffmann    spice="no"
3085cd4ec0b4SGerd Hoffmann  fi
3086cd4ec0b4SGerd Hoffmannfi
3087cd4ec0b4SGerd Hoffmann
3088111a38b0SRobert Relyea# check for libcacard for smartcard support
3089111a38b0SRobert Relyeasmartcard_cflags=""
3090111a38b0SRobert Relyea# TODO - what's the minimal nss version we support?
3091111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then
30925f01e06fSSergei Trofimovich  cat > $TMPC << EOF
30935f01e06fSSergei Trofimovich#include <pk11pub.h>
30945f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
30955f01e06fSSergei TrofimovichEOF
30960b22ef0fSPeter Maydell    smartcard_includes="-I\$(SRC_PATH)/libcacard"
30978c741c22SAlon Levy    libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
30988c741c22SAlon Levy    libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
30996ca026cbSPeter Maydell    test_cflags="$libcacard_cflags"
31006ca026cbSPeter Maydell    # The header files in nss < 3.13.3 have a bug which causes them to
31016ca026cbSPeter Maydell    # emit a warning. If we're going to compile QEMU with -Werror, then
31026ca026cbSPeter Maydell    # test that the headers don't have this bug. Otherwise we would pass
31036ca026cbSPeter Maydell    # the configure test but fail to compile QEMU later.
31046ca026cbSPeter Maydell    if test "$werror" = "yes"; then
31056ca026cbSPeter Maydell        test_cflags="-Werror $test_cflags"
31066ca026cbSPeter Maydell    fi
3107b6fc675bSPaolo Bonzini    if test -n "$libtool" &&
310865d5d3f9SStefan Weil       $pkg_config --atleast-version=3.12.8 nss && \
31096ca026cbSPeter Maydell      compile_prog "$test_cflags" "$libcacard_libs"; then
31105f01e06fSSergei Trofimovich        smartcard_nss="yes"
31110b22ef0fSPeter Maydell        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
31120b22ef0fSPeter Maydell        QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
3113ad4cf3f6SPaul Brook        libs_softmmu="$libcacard_libs $libs_softmmu"
3114111a38b0SRobert Relyea    else
3115111a38b0SRobert Relyea        if test "$smartcard_nss" = "yes"; then
3116111a38b0SRobert Relyea            feature_not_found "nss"
3117111a38b0SRobert Relyea        fi
3118111a38b0SRobert Relyea        smartcard_nss="no"
3119111a38b0SRobert Relyea    fi
3120111a38b0SRobert Relyeafi
3121111a38b0SRobert Relyea
31222b2325ffSGerd Hoffmann# check for libusb
31232b2325ffSGerd Hoffmannif test "$libusb" != "no" ; then
312465d5d3f9SStefan Weil    if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
31252b2325ffSGerd Hoffmann        libusb="yes"
3126ca871ec8SStefan Weil        libusb_cflags=$($pkg_config --cflags libusb-1.0)
3127ca871ec8SStefan Weil        libusb_libs=$($pkg_config --libs libusb-1.0)
31282b2325ffSGerd Hoffmann        QEMU_CFLAGS="$QEMU_CFLAGS $libusb_cflags"
31292b2325ffSGerd Hoffmann        libs_softmmu="$libs_softmmu $libusb_libs"
31302b2325ffSGerd Hoffmann    else
31312b2325ffSGerd Hoffmann        if test "$libusb" = "yes"; then
31322b2325ffSGerd Hoffmann            feature_not_found "libusb"
31332b2325ffSGerd Hoffmann        fi
31342b2325ffSGerd Hoffmann        libusb="no"
31352b2325ffSGerd Hoffmann    fi
31362b2325ffSGerd Hoffmannfi
31372b2325ffSGerd Hoffmann
313869354a83SHans de Goede# check for usbredirparser for usb network redirection support
313969354a83SHans de Goedeif test "$usb_redir" != "no" ; then
314065d5d3f9SStefan Weil    if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
314169354a83SHans de Goede        usb_redir="yes"
3142ca871ec8SStefan Weil        usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
3143ca871ec8SStefan Weil        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
314469354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
314556ab2ad1SAurelien Jarno        libs_softmmu="$libs_softmmu $usb_redir_libs"
314669354a83SHans de Goede    else
314769354a83SHans de Goede        if test "$usb_redir" = "yes"; then
314869354a83SHans de Goede            feature_not_found "usb-redir"
314969354a83SHans de Goede        fi
315069354a83SHans de Goede        usb_redir="no"
315169354a83SHans de Goede    fi
315269354a83SHans de Goedefi
315369354a83SHans de Goede
3154cd4ec0b4SGerd Hoffmann##########################################
3155d9840e25STomoki Sekiyama# check if we have VSS SDK headers for win
3156d9840e25STomoki Sekiyama
3157d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$vss_win32_sdk" != "no" ; then
3158d9840e25STomoki Sekiyama  case "$vss_win32_sdk" in
3159d9840e25STomoki Sekiyama    "")   vss_win32_include="-I$source_path" ;;
3160d9840e25STomoki Sekiyama    *\ *) # The SDK is installed in "Program Files" by default, but we cannot
3161d9840e25STomoki Sekiyama          # handle path with spaces. So we symlink the headers into ".sdk/vss".
3162d9840e25STomoki Sekiyama          vss_win32_include="-I$source_path/.sdk/vss"
3163d9840e25STomoki Sekiyama	  symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
3164d9840e25STomoki Sekiyama	  ;;
3165d9840e25STomoki Sekiyama    *)    vss_win32_include="-I$vss_win32_sdk"
3166d9840e25STomoki Sekiyama  esac
3167d9840e25STomoki Sekiyama  cat > $TMPC << EOF
3168d9840e25STomoki Sekiyama#define __MIDL_user_allocate_free_DEFINED__
3169d9840e25STomoki Sekiyama#include <inc/win2003/vss.h>
3170d9840e25STomoki Sekiyamaint main(void) { return VSS_CTX_BACKUP; }
3171d9840e25STomoki SekiyamaEOF
3172d9840e25STomoki Sekiyama  if compile_prog "$vss_win32_include" "" ; then
3173d9840e25STomoki Sekiyama    guest_agent_with_vss="yes"
3174d9840e25STomoki Sekiyama    QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
3175d9840e25STomoki Sekiyama    libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
3176d9840e25STomoki Sekiyama  else
3177d9840e25STomoki Sekiyama    if test "$vss_win32_sdk" != "" ; then
3178d9840e25STomoki Sekiyama      echo "ERROR: Please download and install Microsoft VSS SDK:"
3179d9840e25STomoki Sekiyama      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
3180d9840e25STomoki Sekiyama      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
3181d9840e25STomoki Sekiyama      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
3182d9840e25STomoki Sekiyama      echo "ERROR: The headers are extracted in the directory \`inc'."
3183d9840e25STomoki Sekiyama      feature_not_found "VSS support"
3184d9840e25STomoki Sekiyama    fi
3185d9840e25STomoki Sekiyama    guest_agent_with_vss="no"
3186d9840e25STomoki Sekiyama  fi
3187d9840e25STomoki Sekiyamafi
3188d9840e25STomoki Sekiyama
3189d9840e25STomoki Sekiyama##########################################
3190d9840e25STomoki Sekiyama# lookup Windows platform SDK (if not specified)
3191d9840e25STomoki Sekiyama# The SDK is needed only to build .tlb (type library) file of guest agent
3192d9840e25STomoki Sekiyama# VSS provider from the source. It is usually unnecessary because the
3193d9840e25STomoki Sekiyama# pre-compiled .tlb file is included.
3194d9840e25STomoki Sekiyama
3195d9840e25STomoki Sekiyamaif test "$mingw32" = "yes" -a "$guest_agent" != "no" -a "$guest_agent_with_vss" = "yes" ; then
3196d9840e25STomoki Sekiyama  if test -z "$win_sdk"; then
3197d9840e25STomoki Sekiyama    programfiles="$PROGRAMFILES"
3198d9840e25STomoki Sekiyama    test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
3199d9840e25STomoki Sekiyama    if test -n "$programfiles"; then
3200d9840e25STomoki Sekiyama      win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
3201d9840e25STomoki Sekiyama    else
3202d9840e25STomoki Sekiyama      feature_not_found "Windows SDK"
3203d9840e25STomoki Sekiyama    fi
3204d9840e25STomoki Sekiyama  elif test "$win_sdk" = "no"; then
3205d9840e25STomoki Sekiyama    win_sdk=""
3206d9840e25STomoki Sekiyama  fi
3207d9840e25STomoki Sekiyamafi
3208d9840e25STomoki Sekiyama
3209d9840e25STomoki Sekiyama##########################################
3210cd4ec0b4SGerd Hoffmann
3211747bbdf7SBlue Swirl##########################################
32125f6b9e8fSBlue Swirl# check if we have fdatasync
32135f6b9e8fSBlue Swirl
32145f6b9e8fSBlue Swirlfdatasync=no
32155f6b9e8fSBlue Swirlcat > $TMPC << EOF
32165f6b9e8fSBlue Swirl#include <unistd.h>
3217d1722a27SAlexandre Raymondint main(void) {
3218d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
3219d1722a27SAlexandre Raymondreturn fdatasync(0);
3220d1722a27SAlexandre Raymond#else
3221e172fe11SStefan Weil#error Not supported
3222d1722a27SAlexandre Raymond#endif
3223d1722a27SAlexandre Raymond}
32245f6b9e8fSBlue SwirlEOF
32255f6b9e8fSBlue Swirlif compile_prog "" "" ; then
32265f6b9e8fSBlue Swirl    fdatasync=yes
32275f6b9e8fSBlue Swirlfi
32285f6b9e8fSBlue Swirl
322994a420b1SStefan Hajnoczi##########################################
3230e78815a5SAndreas Färber# check if we have madvise
3231e78815a5SAndreas Färber
3232e78815a5SAndreas Färbermadvise=no
3233e78815a5SAndreas Färbercat > $TMPC << EOF
3234e78815a5SAndreas Färber#include <sys/types.h>
3235e78815a5SAndreas Färber#include <sys/mman.h>
3236832ce9c2SScott Wood#include <stddef.h>
3237e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
3238e78815a5SAndreas FärberEOF
3239e78815a5SAndreas Färberif compile_prog "" "" ; then
3240e78815a5SAndreas Färber    madvise=yes
3241e78815a5SAndreas Färberfi
3242e78815a5SAndreas Färber
3243e78815a5SAndreas Färber##########################################
3244e78815a5SAndreas Färber# check if we have posix_madvise
3245e78815a5SAndreas Färber
3246e78815a5SAndreas Färberposix_madvise=no
3247e78815a5SAndreas Färbercat > $TMPC << EOF
3248e78815a5SAndreas Färber#include <sys/mman.h>
3249832ce9c2SScott Wood#include <stddef.h>
3250e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3251e78815a5SAndreas FärberEOF
3252e78815a5SAndreas Färberif compile_prog "" "" ; then
3253e78815a5SAndreas Färber    posix_madvise=yes
3254e78815a5SAndreas Färberfi
3255e78815a5SAndreas Färber
3256e78815a5SAndreas Färber##########################################
32571e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID
32581e9737daSRichard Henderson
32591e9737daSRichard Hendersonsigev_thread_id=no
32601e9737daSRichard Hendersoncat > $TMPC << EOF
32611e9737daSRichard Henderson#include <signal.h>
32621e9737daSRichard Hendersonint main(void) {
32631e9737daSRichard Henderson  struct sigevent ev;
32641e9737daSRichard Henderson  ev.sigev_notify = SIGEV_THREAD_ID;
32651e9737daSRichard Henderson  ev._sigev_un._tid = 0;
32661e9737daSRichard Henderson  asm volatile("" : : "g"(&ev));
32671e9737daSRichard Henderson  return 0;
32681e9737daSRichard Henderson}
32691e9737daSRichard HendersonEOF
32701e9737daSRichard Hendersonif compile_prog "" "" ; then
32711e9737daSRichard Henderson    sigev_thread_id=yes
32721e9737daSRichard Hendersonfi
32731e9737daSRichard Henderson
32741e9737daSRichard Henderson##########################################
327594a420b1SStefan Hajnoczi# check if trace backend exists
327694a420b1SStefan Hajnoczi
3277650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
327894a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
327976ad07a4SPeter Maydell  error_exit "invalid trace backend" \
328076ad07a4SPeter Maydell      "Please choose a supported trace backend."
328194a420b1SStefan Hajnoczifi
328294a420b1SStefan Hajnoczi
32837e24e92aSStefan Hajnoczi##########################################
32847e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
32857e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
32867e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
32877e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
32887e24e92aSStefan Hajnoczi#include <ust/marker.h>
32897e24e92aSStefan Hajnocziint main(void) { return 0; }
32907e24e92aSStefan HajnocziEOF
32917e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
329294b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
3293c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
32947e24e92aSStefan Hajnoczi  else
329576ad07a4SPeter Maydell    error_exit "Trace backend 'ust' missing libust header files"
32967e24e92aSStefan Hajnoczi  fi
32977e24e92aSStefan Hajnoczifi
3298b3d08c02SDaniel P. Berrange
3299b3d08c02SDaniel P. Berrange##########################################
3300b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
3301b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
3302b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
330376ad07a4SPeter Maydell    error_exit "dtrace command is not found in PATH $PATH"
3304b3d08c02SDaniel P. Berrange  fi
3305c276b17dSDaniel P. Berrange  trace_backend_stap="no"
3306c276b17dSDaniel P. Berrange  if has 'stap' ; then
3307c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
3308c276b17dSDaniel P. Berrange  fi
3309b3d08c02SDaniel P. Berrangefi
3310b3d08c02SDaniel P. Berrange
33117e24e92aSStefan Hajnoczi##########################################
3312519175a2SAlex Barcelo# check and set a backend for coroutine
3313d0e2fce5SAneesh Kumar K.V
33147c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback
33157c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because
33167c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally
33177c2acc70SPeter Maydell# useful for debugging purposes.)  On Windows the only valid backend
33187c2acc70SPeter Maydell# is the Windows-specific one.
33197c2acc70SPeter Maydell
33207c2acc70SPeter Maydellucontext_works=no
3321d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then
3322d0e2fce5SAneesh Kumar K.V  cat > $TMPC << EOF
3323d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
3324cdf84806SPeter Maydell#ifdef __stub_makecontext
3325cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
3326cdf84806SPeter Maydell#endif
332775cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
3328d0e2fce5SAneesh Kumar K.VEOF
3329d0e2fce5SAneesh Kumar K.V  if compile_prog "" "" ; then
33307c2acc70SPeter Maydell    ucontext_works=yes
3331d0e2fce5SAneesh Kumar K.V  fi
3332519175a2SAlex Barcelofi
33337c2acc70SPeter Maydell
33347c2acc70SPeter Maydellif test "$coroutine" = ""; then
33357c2acc70SPeter Maydell  if test "$mingw32" = "yes"; then
33367c2acc70SPeter Maydell    coroutine=win32
33377c2acc70SPeter Maydell  elif test "$ucontext_works" = "yes"; then
33387c2acc70SPeter Maydell    coroutine=ucontext
3339519175a2SAlex Barcelo  else
33407c2acc70SPeter Maydell    coroutine=sigaltstack
33417c2acc70SPeter Maydell  fi
33427c2acc70SPeter Maydellelse
33437c2acc70SPeter Maydell  case $coroutine in
33447c2acc70SPeter Maydell  windows)
33457c2acc70SPeter Maydell    if test "$mingw32" != "yes"; then
33467c2acc70SPeter Maydell      error_exit "'windows' coroutine backend only valid for Windows"
33477c2acc70SPeter Maydell    fi
33487c2acc70SPeter Maydell    # Unfortunately the user visible backend name doesn't match the
33497c2acc70SPeter Maydell    # coroutine-*.c filename for this case, so we have to adjust it here.
33507c2acc70SPeter Maydell    coroutine=win32
33517c2acc70SPeter Maydell    ;;
33527c2acc70SPeter Maydell  ucontext)
33537c2acc70SPeter Maydell    if test "$ucontext_works" != "yes"; then
33547c2acc70SPeter Maydell      feature_not_found "ucontext"
33557c2acc70SPeter Maydell    fi
33567c2acc70SPeter Maydell    ;;
33577c2acc70SPeter Maydell  gthread|sigaltstack)
33587c2acc70SPeter Maydell    if test "$mingw32" = "yes"; then
33597c2acc70SPeter Maydell      error_exit "only the 'windows' coroutine backend is valid for Windows"
33607c2acc70SPeter Maydell    fi
33617c2acc70SPeter Maydell    ;;
33627c2acc70SPeter Maydell  *)
336376ad07a4SPeter Maydell    error_exit "unknown coroutine backend $coroutine"
33647c2acc70SPeter Maydell    ;;
33657c2acc70SPeter Maydell  esac
3366d0e2fce5SAneesh Kumar K.Vfi
3367d0e2fce5SAneesh Kumar K.V
336870c60c08SStefan Hajnocziif test "$coroutine_pool" = ""; then
336970c60c08SStefan Hajnoczi  if test "$coroutine" = "gthread"; then
337070c60c08SStefan Hajnoczi    coroutine_pool=no
337170c60c08SStefan Hajnoczi  else
337270c60c08SStefan Hajnoczi    coroutine_pool=yes
337370c60c08SStefan Hajnoczi  fi
337470c60c08SStefan Hajnoczifi
337570c60c08SStefan Hajnocziif test "$coroutine" = "gthread" -a "$coroutine_pool" = "yes"; then
337670c60c08SStefan Hajnoczi  error_exit "'gthread' coroutine backend does not support pool (use --disable-coroutine-pool)"
337770c60c08SStefan Hajnoczifi
337870c60c08SStefan Hajnoczi
3379d0e2fce5SAneesh Kumar K.V##########################################
3380d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
3381d2042378SAneesh Kumar K.V
33824e1797f9SStefan Weilopen_by_handle_at=no
3383d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
3384d2042378SAneesh Kumar K.V#include <fcntl.h>
3385acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
3386acc55ba8SStefan Weil# error missing definition
3387acc55ba8SStefan Weil#else
338875cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3389acc55ba8SStefan Weil#endif
3390d2042378SAneesh Kumar K.VEOF
3391d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
3392d2042378SAneesh Kumar K.V    open_by_handle_at=yes
3393d2042378SAneesh Kumar K.Vfi
3394d2042378SAneesh Kumar K.V
3395e06a765eSHarsh Prateek Bora########################################
3396e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
3397e06a765eSHarsh Prateek Bora
3398e06a765eSHarsh Prateek Boralinux_magic_h=no
3399e06a765eSHarsh Prateek Boracat > $TMPC << EOF
3400e06a765eSHarsh Prateek Bora#include <linux/magic.h>
3401e06a765eSHarsh Prateek Boraint main(void) {
340275cafad7SStefan Weil  return 0;
3403e06a765eSHarsh Prateek Bora}
3404e06a765eSHarsh Prateek BoraEOF
3405e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
3406e06a765eSHarsh Prateek Bora    linux_magic_h=yes
3407e06a765eSHarsh Prateek Borafi
3408e06a765eSHarsh Prateek Bora
34098ab1bf12SLuiz Capitulino########################################
3410c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed
3411c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries).
3412c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is
3413c95e3080SKevin Wolf# only a warning.
3414c95e3080SKevin Wolf#
3415c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that
3416c95e3080SKevin Wolf# the build doesn't fail anyway.
3417c95e3080SKevin Wolf
341806d71fa1SPeter Maydellpragma_disable_unused_but_set=no
341906d71fa1SPeter Maydellcat > $TMPC << EOF
3420e6f53fd5SMarkus Armbruster#pragma GCC diagnostic push
342106d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3422c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes"
3423e6f53fd5SMarkus Armbruster#pragma GCC diagnostic pop
3424c95e3080SKevin Wolf
342506d71fa1SPeter Maydellint main(void) {
342606d71fa1SPeter Maydell    return 0;
342706d71fa1SPeter Maydell}
342806d71fa1SPeter MaydellEOF
342906d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then
3430cc6e3ca9SGerd Hoffmann    pragma_diagnostic_available=yes
3431c95e3080SKevin Wolfelse
3432c95e3080SKevin Wolf    werror=no
343306d71fa1SPeter Maydellfi
343406d71fa1SPeter Maydell
343506d71fa1SPeter Maydell########################################
343662fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h
34373f4349dcSKevin Wolf
34383f4349dcSKevin Wolfvalgrind_h=no
34393f4349dcSKevin Wolfcat > $TMPC << EOF
34403f4349dcSKevin Wolf#include <valgrind/valgrind.h>
344162fe8331SChristian Borntraeger#include <valgrind/memcheck.h>
34423f4349dcSKevin Wolfint main(void) {
34433f4349dcSKevin Wolf  return 0;
34443f4349dcSKevin Wolf}
34453f4349dcSKevin WolfEOF
34463f4349dcSKevin Wolfif compile_prog "" "" ; then
34473f4349dcSKevin Wolf    valgrind_h=yes
34483f4349dcSKevin Wolffi
34493f4349dcSKevin Wolf
34503f4349dcSKevin Wolf########################################
34518ab1bf12SLuiz Capitulino# check if environ is declared
34528ab1bf12SLuiz Capitulino
34538ab1bf12SLuiz Capitulinohas_environ=no
34548ab1bf12SLuiz Capitulinocat > $TMPC << EOF
34558ab1bf12SLuiz Capitulino#include <unistd.h>
34568ab1bf12SLuiz Capitulinoint main(void) {
3457c075a723SBlue Swirl    environ = 0;
34588ab1bf12SLuiz Capitulino    return 0;
34598ab1bf12SLuiz Capitulino}
34608ab1bf12SLuiz CapitulinoEOF
34618ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
34628ab1bf12SLuiz Capitulino    has_environ=yes
34638ab1bf12SLuiz Capitulinofi
34648ab1bf12SLuiz Capitulino
346576a347e1SRichard Henderson########################################
346676a347e1SRichard Henderson# check if cpuid.h is usable.
346776a347e1SRichard Henderson
346876a347e1SRichard Hendersoncpuid_h=no
346976a347e1SRichard Hendersoncat > $TMPC << EOF
347076a347e1SRichard Henderson#include <cpuid.h>
347176a347e1SRichard Hendersonint main(void) {
347276a347e1SRichard Henderson  return 0;
347376a347e1SRichard Henderson}
347476a347e1SRichard HendersonEOF
347576a347e1SRichard Hendersonif compile_prog "" "" ; then
347676a347e1SRichard Henderson    cpuid_h=yes
347776a347e1SRichard Hendersonfi
347876a347e1SRichard Henderson
3479f540166bSRichard Henderson########################################
3480f540166bSRichard Henderson# check if __[u]int128_t is usable.
3481f540166bSRichard Henderson
3482f540166bSRichard Hendersonint128=no
3483f540166bSRichard Hendersoncat > $TMPC << EOF
3484f540166bSRichard Henderson__int128_t a;
3485f540166bSRichard Henderson__uint128_t b;
3486f540166bSRichard Hendersonint main (void) {
3487f540166bSRichard Henderson  a = a + b;
3488f540166bSRichard Henderson  b = a * b;
3489464e3671SPeter Maydell  a = a * a;
3490f540166bSRichard Henderson  return 0;
3491f540166bSRichard Henderson}
3492f540166bSRichard HendersonEOF
3493f540166bSRichard Hendersonif compile_prog "" "" ; then
3494f540166bSRichard Henderson    int128=yes
3495f540166bSRichard Hendersonfi
349676a347e1SRichard Henderson
34971e6e9acaSRichard Henderson########################################
34981e6e9acaSRichard Henderson# check if getauxval is available.
34991e6e9acaSRichard Henderson
35001e6e9acaSRichard Hendersongetauxval=no
35011e6e9acaSRichard Hendersoncat > $TMPC << EOF
35021e6e9acaSRichard Henderson#include <sys/auxv.h>
35031e6e9acaSRichard Hendersonint main(void) {
35041e6e9acaSRichard Henderson  return getauxval(AT_HWCAP) == 0;
35051e6e9acaSRichard Henderson}
35061e6e9acaSRichard HendersonEOF
35071e6e9acaSRichard Hendersonif compile_prog "" "" ; then
35081e6e9acaSRichard Henderson    getauxval=yes
35091e6e9acaSRichard Hendersonfi
35101e6e9acaSRichard Henderson
3511d2042378SAneesh Kumar K.V##########################################
3512e86ecd4bSJuan Quintela# End of CC checks
3513e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
3514e86ecd4bSJuan Quintela
35151d728c39SBlue Swirlif test "$gcov" = "yes" ; then
35161d728c39SBlue Swirl  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
35171d728c39SBlue Swirl  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
35181d728c39SBlue Swirlelif test "$debug" = "no" ; then
3519e600cdf3SMichal Privoznik  CFLAGS="-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS"
3520e86ecd4bSJuan Quintelafi
3521a316e378SJuan Quintela
35221d728c39SBlue Swirl
352320ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
352420ff6c80SAnthony Liguori# enable/disable
352520ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
352620ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
352720ff6c80SAnthony Liguori	zero_malloc="no"
352820ff6c80SAnthony Liguori    else
352920ff6c80SAnthony Liguori	zero_malloc="yes"
353020ff6c80SAnthony Liguori    fi
353120ff6c80SAnthony Liguorifi
353220ff6c80SAnthony Liguori
35336ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags
35346ca026cbSPeter Maydellif test "$werror" = "yes"; then
35356ca026cbSPeter Maydell    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
35366ca026cbSPeter Maydellfi
35376ca026cbSPeter Maydell
3538e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
3539e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
35401156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
3541e86ecd4bSJuan Quintela    fi
3542e86ecd4bSJuan Quintelafi
3543e86ecd4bSJuan Quintela
354494dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
354594dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
354694dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
354794dd53c5SGerd Hoffmannelse
354894dd53c5SGerd Hoffmann    POD2MAN="pod2man"
354994dd53c5SGerd Hoffmannfi
355094dd53c5SGerd Hoffmann
3551952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
3552952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
3553952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
3554952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3555952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
3556952afb71SBlue Swirl        fi
3557952afb71SBlue Swirl    done
3558952afb71SBlue Swirlfi
3559952afb71SBlue Swirl
356010ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
3561528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
3562834574eaSAnthony Liguoriqemu_localedir="$datadir/locale"
35635a67135aSbellard
35644b1c11fdSDaniel P. Berrangetools=""
35654b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then
3566ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
35674b1c11fdSDaniel P. Berrange  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
35684b1c11fdSDaniel P. Berrange    tools="qemu-nbd\$(EXESUF) $tools"
35694b1c11fdSDaniel P. Berrange  fi
35704b1c11fdSDaniel P. Berrangefi
35714b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then
3572983eef5aSMeador Inge  if test "$virtfs" != no ; then
3573be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3574983eef5aSMeador Inge      virtfs=yes
357517bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3576983eef5aSMeador Inge    else
3577983eef5aSMeador Inge      if test "$virtfs" = yes; then
357876ad07a4SPeter Maydell        error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3579983eef5aSMeador Inge      fi
358017500370SAndreas Färber      virtfs=no
3581983eef5aSMeador Inge    fi
358217bff52bSM. Mohan Kumar  fi
3583d138cee9SMichael Rothfi
3584e8ef31a3SMichael Tokarevif [ "$guest_agent" != "no" ]; then
3585b39297aeSTomoki Sekiyama  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
3586e8ef31a3SMichael Tokarev      tools="qemu-ga\$(EXESUF) $tools"
3587b39297aeSTomoki Sekiyama      if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then
3588b39297aeSTomoki Sekiyama        tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools"
3589b39297aeSTomoki Sekiyama      fi
3590e8ef31a3SMichael Tokarev      guest_agent=yes
3591e8ef31a3SMichael Tokarev  elif [ "$guest_agent" != yes ]; then
3592e8ef31a3SMichael Tokarev      guest_agent=no
3593e8ef31a3SMichael Tokarev  else
3594e8ef31a3SMichael Tokarev      error_exit "Guest agent is not supported on this platform"
3595ca35f780SPaolo Bonzini  fi
35964b1c11fdSDaniel P. Berrangefi
3597ca35f780SPaolo Bonzini
3598ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
3599ca35f780SPaolo Bonziniroms=
3600ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3601ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3602ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
3603ca35f780SPaolo Bonzini  roms="optionrom"
3604ca35f780SPaolo Bonzinifi
3605d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
360639ac8455SDavid Gibson  roms="$roms spapr-rtas"
360739ac8455SDavid Gibsonfi
3608ca35f780SPaolo Bonzini
36099933c305SChristian Borntraegerif test "$cpu" = "s390x" ; then
36109933c305SChristian Borntraeger  roms="$roms s390-ccw"
36119933c305SChristian Borntraegerfi
36129933c305SChristian Borntraeger
3613964c6fa1SRichard Henderson# Probe for the need for relocating the user-only binary.
3614964c6fa1SRichard Hendersonif test "$pie" = "no" ; then
3615964c6fa1SRichard Henderson  textseg_addr=
3616964c6fa1SRichard Henderson  case "$cpu" in
3617c72b26ecSRichard Henderson    arm | hppa | i386 | m68k | ppc | ppc64 | s390* | sparc | sparc64 | x86_64 | x32)
3618964c6fa1SRichard Henderson      textseg_addr=0x60000000
3619964c6fa1SRichard Henderson      ;;
3620964c6fa1SRichard Henderson    mips)
3621964c6fa1SRichard Henderson      textseg_addr=0x400000
3622964c6fa1SRichard Henderson      ;;
3623964c6fa1SRichard Henderson  esac
3624964c6fa1SRichard Henderson  if [ -n "$textseg_addr" ]; then
3625964c6fa1SRichard Henderson    cat > $TMPC <<EOF
3626964c6fa1SRichard Henderson    int main(void) { return 0; }
3627964c6fa1SRichard HendersonEOF
3628964c6fa1SRichard Henderson    textseg_ldflags="-Wl,-Ttext-segment=$textseg_addr"
3629964c6fa1SRichard Henderson    if ! compile_prog "" "$textseg_ldflags"; then
3630964c6fa1SRichard Henderson      # In case ld does not support -Ttext-segment, edit the default linker
3631964c6fa1SRichard Henderson      # script via sed to set the .text start addr.  This is needed on FreeBSD
3632964c6fa1SRichard Henderson      # at least.
3633964c6fa1SRichard Henderson      $ld --verbose | sed \
3634964c6fa1SRichard Henderson        -e '1,/==================================================/d' \
3635964c6fa1SRichard Henderson        -e '/==================================================/,$d' \
3636964c6fa1SRichard Henderson        -e "s/[.] = [0-9a-fx]* [+] SIZEOF_HEADERS/. = $textseg_addr + SIZEOF_HEADERS/" \
3637964c6fa1SRichard Henderson        -e "s/__executable_start = [0-9a-fx]*/__executable_start = $textseg_addr/" > config-host.ld
3638964c6fa1SRichard Henderson      textseg_ldflags="-Wl,-T../config-host.ld"
3639964c6fa1SRichard Henderson    fi
3640964c6fa1SRichard Henderson  fi
3641964c6fa1SRichard Hendersonfi
3642964c6fa1SRichard Henderson
36435ca9388aSGerd Hoffmann# add pixman flags after all config tests are done
3644a540f158SPeter CrosthwaiteQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags $fdt_cflags"
36455ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs"
36465ca9388aSGerd Hoffmann
36477d13299dSbellardecho "Install prefix    $prefix"
3648c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
3649f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
36503aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
36518bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`"
36520f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
36531c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
365411d9f695Sbellardif test "$mingw32" = "no" ; then
36555a699bbbSLaszlo Ersekecho "local state directory   `eval echo $local_statedir`"
3656f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
365743ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
36585a699bbbSLaszlo Ersekelse
36595a699bbbSLaszlo Ersekecho "local state directory   queried at runtime"
3660d9840e25STomoki Sekiyamaecho "Windows SDK       $win_sdk"
366111d9f695Sbellardfi
36625a67135aSbellardecho "Source path       $source_path"
36637d13299dSbellardecho "C compiler        $cc"
366483469015Sbellardecho "Host C compiler   $host_cc"
366583f73fceSTomoki Sekiyamaecho "C++ compiler      $cxx"
36663c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc"
36670c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
3668a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
36690c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
36707d13299dSbellardecho "make              $make"
36716a882643Spbrookecho "install           $install"
3672c886edfbSBlue Swirlecho "python            $python"
3673e2d8830eSBradif test "$slirp" = "yes" ; then
3674e2d8830eSBrad    echo "smbd              $smbd"
3675e2d8830eSBradfi
3676a98fd896Sbellardecho "host CPU          $cpu"
3677de83cd02Sbellardecho "host big endian   $bigendian"
367897a847bcSbellardecho "target list       $target_list"
3679ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
36807d13299dSbellardecho "gprof enabled     $gprof"
368103b4fe7dSaliguoriecho "sparse enabled    $sparse"
36821625af87Saliguoriecho "strip binaries    $strip_opt"
368305c2a3e7Sbellardecho "profiler          $profiler"
368443ce4dfeSbellardecho "static build      $static"
368585aa5189Sbellardecho "-Werror enabled   $werror"
36865b0753e0Sbellardif test "$darwin" = "yes" ; then
36875b0753e0Sbellard    echo "Cocoa support     $cocoa"
36885b0753e0Sbellardfi
3689e2134eb9SGerd Hoffmannecho "pixman            $pixman"
369097a847bcSbellardecho "SDL support       $sdl"
3691a4ccabcfSAnthony Liguoriecho "GTK support       $gtk"
36924d3b6f6eSbalrogecho "curses support    $curses"
3693769ce76dSAlexander Grafecho "curl support      $curl"
369467b915a5Sbellardecho "mingw32 support   $mingw32"
36950c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
3696b64ec4e4SFam Zhengecho "Block whitelist (rw) $block_drv_rw_whitelist"
3697b64ec4e4SFam Zhengecho "Block whitelist (ro) $block_drv_ro_whitelist"
3698983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3699821601eaSJes Sorensenecho "VNC support       $vnc"
3700821601eaSJes Sorensenif test "$vnc" = "yes" ; then
37018d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
37022f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
37032f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3704efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
37057536ee4bSTim Hardeck    echo "VNC WS support    $vnc_ws"
3706821601eaSJes Sorensenfi
37073142255cSblueswir1if test -n "$sparc_cpu"; then
37083142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
37093142255cSblueswir1fi
3710e37630caSaliguoriecho "xen support       $xen"
37112e4d9fb1Saurel32echo "brlapi support    $brlapi"
3712a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3713a25dba17SJuan Quintelaecho "Documentation     $docs"
3714c5937220Spbrook[ ! -z "$uname_release" ] && \
3715c5937220Spbrookecho "uname -r          $uname_release"
3716379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
371740d6444eSAvi Kivityecho "PIE               $pie"
37188a16d273Sthsecho "vde support       $vde"
37195c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3720758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
372177755340Sthsecho "Install blobs     $blobs"
3722b31a0277SJuan Quintelaecho "KVM support       $kvm"
37232da776dbSMichael R. Hinesecho "RDMA support      $rdma"
37249195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3725f652e6afSaurel32echo "fdt support       $fdt"
3726ceb42de8Saliguoriecho "preadv support    $preadv"
37275f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3728e78815a5SAndreas Färberecho "madvise           $madvise"
3729e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
37301e9737daSRichard Hendersonecho "sigev_thread_id   $sigev_thread_id"
3731ee682d27SStefan Weilecho "uuid support      $uuid"
373247e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3733d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
37345e9be92dSNicholas Bellingerecho "vhost-scsi support $vhost_scsi"
373594a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
37369410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
37372e0e3c39SAlon Levyecho "spice support     $spice ($spice_protocol_version/$spice_server_version)"
3738f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3739dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3740111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
37412b2325ffSGerd Hoffmannecho "libusb            $libusb"
374269354a83SHans de Goedeecho "usb net redir     $usb_redir"
3743b1e5fff4SMichael Walleecho "GLX support       $glx"
3744c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3745d138cee9SMichael Rothecho "build guest agent $guest_agent"
3746d9840e25STomoki Sekiyamaecho "QGA VSS support   $guest_agent_with_vss"
3747f794573eSEduardo Otuboecho "seccomp support   $seccomp"
37487c2acc70SPeter Maydellecho "coroutine backend $coroutine"
374970c60c08SStefan Hajnocziecho "coroutine pool    $coroutine_pool"
3750eb100396SBharata B Raoecho "GlusterFS support $glusterfs"
3751583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane"
37521d728c39SBlue Swirlecho "gcov              $gcov_tool"
37531d728c39SBlue Swirlecho "gcov enabled      $gcov"
3754ab214c29SStefan Bergerecho "TPM support       $tpm"
37550a12ec87SRichard W.M. Jonesecho "libssh2 support   $libssh2"
37563b8acc11SPaolo Bonziniecho "TPM passthrough   $tpm_passthrough"
37573556c233SPaolo Bonziniecho "QOM debugging     $qom_cast_debug"
375867b915a5Sbellard
37591ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
376024b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3761e8cd23deSbellardfi
376297a847bcSbellard
376398ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
376497a847bcSbellard
3765dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak
3766dbd99ae3SStefan Weil
376798ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
376898ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
376998ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
377098ec69acSJuan Quintelaecho >> $config_host_mak
377198ec69acSJuan Quintela
3772e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
377399d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
377499d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
37753aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
37768bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak
37770f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
377899d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
377999d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
378022d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
37819afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
37829afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
37835a699bbbSLaszlo Ersekif test "$mingw32" = "no" ; then
3784785c23aeSLuiz Capitulino  echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
37855a699bbbSLaszlo Ersekfi
3786f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak
3787f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
3788f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
3789834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak
3790f544a488SPaolo Bonziniecho "libs_softmmu=$libs_softmmu" >> $config_host_mak
3791804edf29SJuan Quintela
379298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3793727e5283SPaolo Bonzini
3794f8393946Saurel32if test "$debug_tcg" = "yes" ; then
37952358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3796f8393946Saurel32fi
37971625af87Saliguoriif test "$strip_opt" = "yes" ; then
379852ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
37991625af87Saliguorifi
38007d13299dSbellardif test "$bigendian" = "yes" ; then
3801e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
380297a847bcSbellardfi
380367b915a5Sbellardif test "$mingw32" = "yes" ; then
380498ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
38059fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
38069fe6de94SBlue Swirl  version_major=${rc_version%%.*}
38079fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38089fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
38099fe6de94SBlue Swirl  rc_version=${rc_version#*.}
38109fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
38119fe6de94SBlue Swirl  version_micro=0
38129fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
38139fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3814d9840e25STomoki Sekiyama  if test "$guest_agent_with_vss" = "yes" ; then
3815d9840e25STomoki Sekiyama    echo "CONFIG_QGA_VSS=y" >> $config_host_mak
3816d9840e25STomoki Sekiyama    echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
3817d9840e25STomoki Sekiyama  fi
3818210fa556Spbrookelse
381935f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3820210fa556Spbrookfi
3821128ab2ffSblueswir1
3822dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3823dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3824dffcb71cSMark McLoughlinfi
3825dffcb71cSMark McLoughlin
382683fb7adfSbellardif test "$darwin" = "yes" ; then
382798ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
382883fb7adfSbellardfi
3829b29fe3edSmalc
3830b29fe3edSmalcif test "$aix" = "yes" ; then
383198ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3832b29fe3edSmalcfi
3833b29fe3edSmalc
3834ec530c81Sbellardif test "$solaris" = "yes" ; then
383598ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
38362358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
38370475a5caSths  if test "$needs_libsunmath" = "yes" ; then
383875b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
38390475a5caSths  fi
3840ec530c81Sbellardfi
3841179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3842179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3843179cf400SAndreas Färberfi
384497a847bcSbellardif test "$static" = "yes" ; then
384598ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
384697a847bcSbellardfi
38471ba16968SStefan Weilif test "$profiler" = "yes" ; then
38482358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
384905c2a3e7Sbellardfi
3850c20709aaSbellardif test "$slirp" = "yes" ; then
385198ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3852e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3853c20709aaSbellardfi
38548a16d273Sthsif test "$vde" = "yes" ; then
385598ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
38568a16d273Sthsfi
385747e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
385847e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
385947e98658SCorey Bryantfi
38602358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
38610c58ac1cSmalcfor drv in $audio_drv_list; do
3862bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
386398ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3864923e4521Smalc    if test "$drv" = "fmod"; then
38657aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3866fb065187Sbellard    fi
38670c58ac1cSmalcdone
386867f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
386967f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
387067f86e8eSJuan Quintelafi
3871d5631638Smalcif test "$audio_win_int" = "yes" ; then
3872d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3873d5631638Smalcfi
3874b64ec4e4SFam Zhengecho "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
3875b64ec4e4SFam Zhengecho "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
3876821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3877821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3878821601eaSJes Sorensenfi
38798d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
388098ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
38818d5d2d4cSthsfi
38822f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
388398ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
38842f9606b3Saliguorifi
3885821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
38862f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
38872f6f5c7aSCorentin Charyfi
3888821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3889efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3890efe556adSCorentin Charyfi
38917536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then
38927536ee4bSTim Hardeck  echo "CONFIG_VNC_WS=y" >> $config_host_mak
38937536ee4bSTim Hardeck  echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
38947536ee4bSTim Hardeckfi
389576655d6dSaliguoriif test "$fnmatch" = "yes" ; then
38962358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
389776655d6dSaliguorifi
3898ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3899ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3900ee682d27SStefan Weilfi
3901dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3902dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3903dce512deSChristoph Hellwigfi
3904b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
390598ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
39062358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
390798ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
390898ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3909a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
391098ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3911cc8ae6deSpbrookfi
39121ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
391398ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
39148ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
391549ecc3faSbellardfi
391649ecc3faSbellardif test "$cocoa" = "yes" ; then
391798ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
391849ecc3faSbellardfi
39194d3b6f6eSbalrogif test "$curses" = "yes" ; then
392098ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3921ab4e5602SJan Kiszkafi
3922ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
39232358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3924ebc996f3SRiku Voipiofi
3925099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
39262358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3927099d6b0fSRiku Voipiofi
392840ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
392940ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
393040ff6d7eSKevin Wolffi
39313ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
39322358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
39333ce34dfbSvibisreenivasanfi
3934c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3935c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3936c2882b96SRiku Voipiofi
3937d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3938d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3939d0927938SUlrich Hechtfi
39403d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then
39413d4fa43eSKusanagi Kouichi  echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
39423d4fa43eSKusanagi Kouichifi
3943c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3944c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3945c727f47dSPeter Maydellfi
3946dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3947dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3948dace20dcSPeter Maydellfi
3949d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3950d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3951d0927938SUlrich Hechtfi
39524e0c6529SAlex Blighif test "$ppoll" = "yes" ; then
39534e0c6529SAlex Bligh  echo "CONFIG_PPOLL=y" >> $config_host_mak
39544e0c6529SAlex Blighfi
3955cd758dd0SAlex Blighif test "$prctl_pr_set_timerslack" = "yes" ; then
3956cd758dd0SAlex Bligh  echo "CONFIG_PRCTL_PR_SET_TIMERSLACK=y" >> $config_host_mak
3957cd758dd0SAlex Blighfi
39583b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
39593b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
39603b6edd16SPeter Maydellfi
39613b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
39623b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
39633b6edd16SPeter Maydellfi
39643b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
39653b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
39663b6edd16SPeter Maydellfi
3967a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then
3968a8fd1abaSPeter Maydell  echo "CONFIG_SENDFILE=y" >> $config_host_mak
3969a8fd1abaSPeter Maydellfi
39703b3f24adSaurel32if test "$inotify" = "yes" ; then
39712358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
39723b3f24adSaurel32fi
3973c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
3974c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3975c05c7a73SRiku Voipiofi
39766ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
39776ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
39786ae9a1f4SJuan Quintelafi
39796ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
39806ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
39816ae9a1f4SJuan Quintelafi
3982769ce76dSAlexander Grafif test "$curl" = "yes" ; then
398398ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
3984b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3985769ce76dSAlexander Graffi
39862e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
398798ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
39882e4d9fb1Saurel32fi
3989fb599c9aSbalrogif test "$bluez" = "yes" ; then
399098ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
3991ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3992fb599c9aSbalrogfi
3993e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3994a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then
3995a4ccabcfSAnthony Liguori  echo "CONFIG_GTK=y" >> $config_host_mak
3996a4ccabcfSAnthony Liguori  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
3997a4ccabcfSAnthony Liguori  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
3998a4ccabcfSAnthony Liguorifi
3999e37630caSaliguoriif test "$xen" = "yes" ; then
40006dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
4001d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
4002e37630caSaliguorifi
40035c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
40045c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
40055c6c3a6cSChristoph Hellwigfi
4006758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
4007758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
4008758e8e38SVenkateswararao Jujjuri (JV)fi
40094f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
40104f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
40114f26f2b6SAvi Kivityfi
4012983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
4013758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
4014758e8e38SVenkateswararao Jujjuri (JV)fi
40155e9be92dSNicholas Bellingerif test "$vhost_scsi" = "yes" ; then
40165e9be92dSNicholas Bellinger  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
40175e9be92dSNicholas Bellingerfi
401877755340Sthsif test "$blobs" = "yes" ; then
401998ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
402077755340Sthsfi
4021bf9298b9Saliguoriif test "$iovec" = "yes" ; then
40222358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
4023bf9298b9Saliguorifi
4024ceb42de8Saliguoriif test "$preadv" = "yes" ; then
40252358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
4026ceb42de8Saliguorifi
4027f652e6afSaurel32if test "$fdt" = "yes" ; then
40283f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
4029f652e6afSaurel32fi
4030dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
4031dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
4032dcc38d1cSMarcelo Tosattifi
40339195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
40349195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
40359195b2c2SStefan Weilfi
40365f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
40375f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
40385f6b9e8fSBlue Swirlfi
4039e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
4040e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
4041e78815a5SAndreas Färberfi
4042e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
4043e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
4044e78815a5SAndreas Färberfi
40451e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then
40461e9737daSRichard Henderson  echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
40471e9737daSRichard Hendersonfi
404897a847bcSbellard
4049cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
4050cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
4051cd4ec0b4SGerd Hoffmannfi
4052cd4ec0b4SGerd Hoffmann
4053111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
4054111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
4055ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
4056ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
4057111a38b0SRobert Relyeafi
4058111a38b0SRobert Relyea
40592b2325ffSGerd Hoffmannif test "$libusb" = "yes" ; then
40602b2325ffSGerd Hoffmann  echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
40612b2325ffSGerd Hoffmannfi
40622b2325ffSGerd Hoffmann
406369354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
406469354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
406569354a83SHans de Goedefi
406669354a83SHans de Goede
4067b1e5fff4SMichael Walleif test "$glx" = "yes" ; then
4068b1e5fff4SMichael Walle  echo "CONFIG_GLX=y" >> $config_host_mak
40692b6b7099SPaolo Bonzini  echo "GLX_LIBS=$glx_libs" >> $config_host_mak
407020ff075bSMichael Wallefi
407120ff075bSMichael Walle
4072c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
4073c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
4074c589b249SRonnie Sahlbergfi
4075c589b249SRonnie Sahlberg
4076f794573eSEduardo Otuboif test "$seccomp" = "yes"; then
4077f794573eSEduardo Otubo  echo "CONFIG_SECCOMP=y" >> $config_host_mak
4078f794573eSEduardo Otubofi
4079f794573eSEduardo Otubo
408083fb7adfSbellard# XXX: suppress that
40817d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
40822358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
40837d3505c5Sbellardfi
40847d3505c5Sbellard
40852358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
4086c5937220Spbrook
408720ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
408820ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
408920ff6c80SAnthony Liguorifi
40903556c233SPaolo Bonziniif test "$qom_cast_debug" = "yes" ; then
40913556c233SPaolo Bonzini  echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
40923556c233SPaolo Bonzinifi
4093f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
4094f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
4095f27aaf4bSChristian Brunnerfi
409620ff6c80SAnthony Liguori
40977c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
409870c60c08SStefan Hajnocziif test "$coroutine_pool" = "yes" ; then
409970c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
410070c60c08SStefan Hajnoczielse
410170c60c08SStefan Hajnoczi  echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
410270c60c08SStefan Hajnoczifi
4103d0e2fce5SAneesh Kumar K.V
4104d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
4105d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
4106d2042378SAneesh Kumar K.Vfi
4107d2042378SAneesh Kumar K.V
4108e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
4109e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
4110e06a765eSHarsh Prateek Borafi
4111e06a765eSHarsh Prateek Bora
4112cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then
4113cc6e3ca9SGerd Hoffmann  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
411406d71fa1SPeter Maydellfi
411506d71fa1SPeter Maydell
41163f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then
41173f4349dcSKevin Wolf  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
41183f4349dcSKevin Wolffi
41193f4349dcSKevin Wolf
41208ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
41218ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
41228ab1bf12SLuiz Capitulinofi
41238ab1bf12SLuiz Capitulino
412476a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then
412576a347e1SRichard Henderson  echo "CONFIG_CPUID_H=y" >> $config_host_mak
412676a347e1SRichard Hendersonfi
412776a347e1SRichard Henderson
4128f540166bSRichard Hendersonif test "$int128" = "yes" ; then
4129f540166bSRichard Henderson  echo "CONFIG_INT128=y" >> $config_host_mak
4130f540166bSRichard Hendersonfi
4131f540166bSRichard Henderson
41321e6e9acaSRichard Hendersonif test "$getauxval" = "yes" ; then
41331e6e9acaSRichard Henderson  echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
41341e6e9acaSRichard Hendersonfi
41351e6e9acaSRichard Henderson
4136eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then
4137eb100396SBharata B Rao  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
4138eb100396SBharata B Raofi
4139eb100396SBharata B Rao
41400c14fb47SBharata B Raoif test "$glusterfs_discard" = "yes" ; then
41410c14fb47SBharata B Rao  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
41420c14fb47SBharata B Raofi
41430c14fb47SBharata B Rao
41440a12ec87SRichard W.M. Jonesif test "$libssh2" = "yes" ; then
41450a12ec87SRichard W.M. Jones  echo "CONFIG_LIBSSH2=y" >> $config_host_mak
41460a12ec87SRichard W.M. Jonesfi
41470a12ec87SRichard W.M. Jones
4148583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then
41496e790746SPaolo Bonzini  echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
4150583f6e7bSStefan Hajnoczifi
4151583f6e7bSStefan Hajnoczi
415268063649Sblueswir1# USB host support
4153b5613fdcSGerd Hoffmannif test "$libusb" = "yes"; then
41542b2325ffSGerd Hoffmann  echo "HOST_USB=libusb legacy" >> $config_host_mak
4155b5613fdcSGerd Hoffmannelse
415698ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
4157b5613fdcSGerd Hoffmannfi
415868063649Sblueswir1
41593b8acc11SPaolo Bonzini# TPM passthrough support?
41603b8acc11SPaolo Bonziniif test "$tpm" = "yes"; then
41613b8acc11SPaolo Bonzini  echo 'CONFIG_TPM=$(CONFIG_SOFTMMU)' >> $config_host_mak
41623b8acc11SPaolo Bonzini  if test "$tpm_passthrough" = "yes"; then
41633b8acc11SPaolo Bonzini    echo "CONFIG_TPM_PASSTHROUGH=y" >> $config_host_mak
41643b8acc11SPaolo Bonzini  fi
41653b8acc11SPaolo Bonzinifi
41663b8acc11SPaolo Bonzini
4167e4858974SLluís# use default implementation for tracing backend-specific routines
4168e4858974SLluístrace_default=yes
416994a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
41706d8a764eSLluísif test "$trace_backend" = "nop"; then
41716d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
417222890ab5SPrerna Saxenafi
41739410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
41746d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
4175e4858974SLluís  trace_default=no
41766d8a764eSLluís  # Set the appropriate trace file.
4177953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
41789410b56cSPrerna Saxenafi
41796d8a764eSLluísif test "$trace_backend" = "stderr"; then
41806d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
41819a82b6a5SLluís  trace_default=no
41826d8a764eSLluísfi
41836d8a764eSLluísif test "$trace_backend" = "ust"; then
41846d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
41856d8a764eSLluísfi
41866d8a764eSLluísif test "$trace_backend" = "dtrace"; then
41876d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
41886d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
41896d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
41906d8a764eSLluís  fi
4191c276b17dSDaniel P. Berrangefi
4192781e9545SEiichi Tsukataif test "$trace_backend" = "ftrace"; then
4193781e9545SEiichi Tsukata  if test "$linux" = "yes" ; then
4194781e9545SEiichi Tsukata    echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
4195781e9545SEiichi Tsukata    trace_default=no
4196781e9545SEiichi Tsukata  else
4197781e9545SEiichi Tsukata    feature_not_found "ftrace(trace backend)"
4198781e9545SEiichi Tsukata  fi
4199781e9545SEiichi Tsukatafi
42009410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
4201e4858974SLluísif test "$trace_default" = "yes"; then
4202e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
4203e4858974SLluísfi
42049410b56cSPrerna Saxena
42052da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
42062da776dbSMichael R. Hines  echo "CONFIG_RDMA=y" >> $config_host_mak
42072da776dbSMichael R. Hinesfi
42082da776dbSMichael R. Hines
42095b5e3037SPaolo Bonziniif test "$tcg_interpreter" = "yes"; then
42105b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/tci $QEMU_INCLUDES"
42115b5e3037SPaolo Bonzinielif test "$ARCH" = "sparc64" ; then
42125b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/sparc $QEMU_INCLUDES"
42135b5e3037SPaolo Bonzinielif test "$ARCH" = "s390x" ; then
42145b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/s390 $QEMU_INCLUDES"
4215c72b26ecSRichard Hendersonelif test "$ARCH" = "x86_64" -o "$ARCH" = "x32" ; then
42165b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/i386 $QEMU_INCLUDES"
42175b5e3037SPaolo Bonzinielse
42185b5e3037SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/tcg/\$(ARCH) $QEMU_INCLUDES"
42195b5e3037SPaolo Bonzinifi
42205b5e3037SPaolo BonziniQEMU_INCLUDES="-I\$(SRC_PATH)/tcg $QEMU_INCLUDES"
42215b5e3037SPaolo Bonzini
422298ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
422398ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
4224804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
4225804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
42261901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
42271901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
422821655882SPaolo Bonziniif test -n "$libtool"; then
422921655882SPaolo Bonzini  echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
423021655882SPaolo Bonzini  echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
423121655882SPaolo Bonzinielse
42321901cb14SBrad  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
423321655882SPaolo Bonzini  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
423421655882SPaolo Bonzinifi
4235c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
4236804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
42372b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
4238804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
423983f73fceSTomoki Sekiyamaecho "CXX=$cxx" >> $config_host_mak
42403c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak
4241804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
42423dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak
42433dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak
4244804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
4245804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
42469fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
424744dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
4248e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
4249a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
4250f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
4251e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
4252e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
4253e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
4254e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
4255e39f0062SPaolo Bonzinifi
425642da6041SGerd Hoffmannif test "$cross_prefix" != ""; then
425742da6041SGerd Hoffmann  echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
425842da6041SGerd Hoffmannelse
425942da6041SGerd Hoffmann  echo "AUTOCONF_HOST := "                             >> $config_host_mak
426042da6041SGerd Hoffmannfi
4261e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
426237746c5eSMarc-André Lureauecho "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
426373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
42643e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
4265804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
4266957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
426794dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
4268cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
42691d728c39SBlue Swirlif test "$gcov" = "yes" ; then
42701d728c39SBlue Swirl  echo "CONFIG_GCOV=y" >> $config_host_mak
42711d728c39SBlue Swirl  echo "GCOV=$gcov_tool" >> $config_host_mak
42721d728c39SBlue Swirlfi
4273804edf29SJuan Quintela
42746efd7517SPeter Maydell# use included Linux headers
42756efd7517SPeter Maydellif test "$linux" = "yes" ; then
4276a307beb6SAndreas Färber  mkdir -p linux-headers
42776efd7517SPeter Maydell  case "$cpu" in
4278c72b26ecSRichard Henderson  i386|x86_64|x32)
427908312a63SPeter Maydell    linux_arch=x86
42806efd7517SPeter Maydell    ;;
42816efd7517SPeter Maydell  ppcemb|ppc|ppc64)
428208312a63SPeter Maydell    linux_arch=powerpc
42836efd7517SPeter Maydell    ;;
42846efd7517SPeter Maydell  s390x)
428508312a63SPeter Maydell    linux_arch=s390
428608312a63SPeter Maydell    ;;
42871f080313SClaudio Fontana  aarch64)
42881f080313SClaudio Fontana    linux_arch=arm64
42891f080313SClaudio Fontana    ;;
429008312a63SPeter Maydell  *)
429108312a63SPeter Maydell    # For most CPUs the kernel architecture name and QEMU CPU name match.
429208312a63SPeter Maydell    linux_arch="$cpu"
42936efd7517SPeter Maydell    ;;
42946efd7517SPeter Maydell  esac
429508312a63SPeter Maydell    # For non-KVM architectures we will not have asm headers
429608312a63SPeter Maydell    if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
429708312a63SPeter Maydell      symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
429808312a63SPeter Maydell    fi
42996efd7517SPeter Maydellfi
43006efd7517SPeter Maydell
430197a847bcSbellardfor target in $target_list; do
430297a847bcSbellardtarget_dir="$target"
430325be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
4304c1799a84SPaolo Bonzinitarget_name=`echo $target | cut -d '-' -f 1`
430597a847bcSbellardtarget_bigendian="no"
43061f3d3c8fSJuan Quintela
4307c1799a84SPaolo Bonzinicase "$target_name" in
4308d15a9c23SAnthony Green  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
4309ea2d6a39SJuan Quintela  target_bigendian=yes
4310ea2d6a39SJuan Quintela  ;;
4311ea2d6a39SJuan Quintelaesac
431297a847bcSbellardtarget_softmmu="no"
4313997344f3Sbellardtarget_user_only="no"
4314831b7825Sthstarget_linux_user="no"
431584778508Sblueswir1target_bsd_user="no"
43169e407a85Spbrookcase "$target" in
4317c1799a84SPaolo Bonzini  ${target_name}-softmmu)
43189e407a85Spbrook    target_softmmu="yes"
43199e407a85Spbrook    ;;
4320c1799a84SPaolo Bonzini  ${target_name}-linux-user)
43219c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
432276ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a Linux host"
43239c7a4202SBlue Swirl    fi
43249e407a85Spbrook    target_user_only="yes"
43259e407a85Spbrook    target_linux_user="yes"
43269e407a85Spbrook    ;;
4327c1799a84SPaolo Bonzini  ${target_name}-bsd-user)
43289cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
432976ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a BSD host"
43309c7a4202SBlue Swirl    fi
433184778508Sblueswir1    target_user_only="yes"
433284778508Sblueswir1    target_bsd_user="yes"
433384778508Sblueswir1    ;;
43349e407a85Spbrook  *)
433576ad07a4SPeter Maydell    error_exit "Target '$target' not recognised"
43369e407a85Spbrook    exit 1
43379e407a85Spbrook    ;;
43389e407a85Spbrookesac
4339831b7825Sths
434097a847bcSbellardmkdir -p $target_dir
434125be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
434297a847bcSbellard
4343e5fe0c52Spbrookbflt="no"
4344c1799a84SPaolo Bonziniinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_name/g"`
434556aebc89Spbrookgdb_xml_files=""
43467ba1e619Saliguori
4347c1799a84SPaolo BonziniTARGET_ARCH="$target_name"
43486acff7daSJuan QuintelaTARGET_BASE_ARCH=""
4349e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
4350e73aae67SJuan Quintela
4351c1799a84SPaolo Bonzinicase "$target_name" in
43522408a527Saurel32  i386)
43532408a527Saurel32  ;;
43542408a527Saurel32  x86_64)
43556acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
43562408a527Saurel32  ;;
43572408a527Saurel32  alpha)
43582408a527Saurel32  ;;
43592408a527Saurel32  arm|armeb)
4360b498c8a0SJuan Quintela    TARGET_ARCH=arm
4361e5fe0c52Spbrook    bflt="yes"
436256aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
43632408a527Saurel32  ;;
43646a49fa95SAlexander Graf  aarch64)
43656a49fa95SAlexander Graf    TARGET_BASE_ARCH=arm
43666a49fa95SAlexander Graf    bflt="yes"
43676a49fa95SAlexander Graf    gdb_xml_files="aarch64-core.xml"
43686a49fa95SAlexander Graf  ;;
43692408a527Saurel32  cris)
43702408a527Saurel32  ;;
4371613a22c9SMichael Walle  lm32)
4372613a22c9SMichael Walle  ;;
43732408a527Saurel32  m68k)
43740938cda5Saurel32    bflt="yes"
437556aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
43762408a527Saurel32  ;;
4377877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
4378877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
437972b675caSEdgar E. Iglesias    bflt="yes"
438072b675caSEdgar E. Iglesias  ;;
43812408a527Saurel32  mips|mipsel)
4382b498c8a0SJuan Quintela    TARGET_ARCH=mips
438325be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
43842408a527Saurel32  ;;
43852408a527Saurel32  mipsn32|mipsn32el)
4386597e2cecSRichard Henderson    TARGET_ARCH=mips64
43876acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
438825be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4389597e2cecSRichard Henderson    echo "TARGET_ABI32=y" >> $config_target_mak
43902408a527Saurel32  ;;
43912408a527Saurel32  mips64|mips64el)
4392b498c8a0SJuan Quintela    TARGET_ARCH=mips64
43936acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
439425be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
43952408a527Saurel32  ;;
4396d15a9c23SAnthony Green  moxie)
4397d15a9c23SAnthony Green  ;;
4398e67db06eSJia Liu  or32)
4399e67db06eSJia Liu    TARGET_ARCH=openrisc
4400e67db06eSJia Liu    TARGET_BASE_ARCH=openrisc
4401e67db06eSJia Liu  ;;
44022408a527Saurel32  ppc)
4403c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44042408a527Saurel32  ;;
44052408a527Saurel32  ppcemb)
44066acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4407e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4408c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44092408a527Saurel32  ;;
44102408a527Saurel32  ppc64)
44116acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4412e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4413c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44142408a527Saurel32  ;;
44152408a527Saurel32  ppc64abi32)
4416b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
44176acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4418e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
441925be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
4420c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
44212408a527Saurel32  ;;
44222408a527Saurel32  sh4|sh4eb)
4423b498c8a0SJuan Quintela    TARGET_ARCH=sh4
44244dbed897Spbrook    bflt="yes"
44252408a527Saurel32  ;;
44262408a527Saurel32  sparc)
44272408a527Saurel32  ;;
44282408a527Saurel32  sparc64)
44296acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
44302408a527Saurel32  ;;
44312408a527Saurel32  sparc32plus)
4432b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
44336acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4434e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
443525be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
44362408a527Saurel32  ;;
443724e804ecSAlexander Graf  s390x)
443824e804ecSAlexander Graf  ;;
4439d2fbca94SGuan Xuetao  unicore32)
4440d2fbca94SGuan Xuetao  ;;
4441cfa550c6SMax Filippov  xtensa|xtensaeb)
4442cfa550c6SMax Filippov    TARGET_ARCH=xtensa
4443cfa550c6SMax Filippov  ;;
44442408a527Saurel32  *)
444576ad07a4SPeter Maydell    error_exit "Unsupported target CPU"
44462408a527Saurel32  ;;
44472408a527Saurel32esac
44485e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
44495e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
44505e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
44515e8861a0SPaolo Bonzinifi
44525e8861a0SPaolo Bonzini
44535e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
44545e8861a0SPaolo Bonzini
445599afc91dSDaniel P. Berrangeupper() {
445699afc91dSDaniel P. Berrange    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
445799afc91dSDaniel P. Berrange}
445899afc91dSDaniel P. Berrange
445999afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`"
446025be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
4461c1799a84SPaolo Bonziniecho "TARGET_NAME=$target_name" >> $config_target_mak
446225be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4463e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
4464e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
4465e6e91b9cSJuan Quintelafi
446625be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
4467c1799a84SPaolo Bonzinicase "$target_name" in
44681b0c87fcSJuan Quintela  i386|x86_64)
44691b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
447025be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
4471eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
4472eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4473eb6fda0fSAnthony PERARD      fi
4474432d268cSJun Nakajima    fi
447559d21e53SAlexander Graf    ;;
447659d21e53SAlexander Graf  *)
44771b0c87fcSJuan Quintelaesac
4478c1799a84SPaolo Bonzinicase "$target_name" in
447968b05c42SPeter Maydell  arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4480c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
4481c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4482c1799a84SPaolo Bonzini      \( "$target_name" = "$cpu" -o \
4483c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
4484c1799a84SPaolo Bonzini      \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4485c1799a84SPaolo Bonzini      \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4486c1799a84SPaolo Bonzini      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4487c1799a84SPaolo Bonzini      \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
4488c1799a84SPaolo Bonzini      \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
448925be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
44901ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
4491d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4492d5970055SMichael S. Tsirkin      fi
4493c59249f9SJuan Quintela    fi
4494c59249f9SJuan Quintelaesac
4495de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
449625be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
449797a847bcSbellardfi
449897a847bcSbellardif test "$target_softmmu" = "yes" ; then
449925be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4500de83cd02Sbellardfi
4501997344f3Sbellardif test "$target_user_only" = "yes" ; then
450225be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4503a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4504997344f3Sbellardfi
4505831b7825Sthsif test "$target_linux_user" = "yes" ; then
450625be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4507831b7825Sthsfi
450856aebc89Spbrooklist=""
450956aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
451056aebc89Spbrook  for x in $gdb_xml_files; do
451156aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
451256aebc89Spbrook  done
451325be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
45143d0f1517SJuan Quintelafi
4515de83cd02Sbellard
4516e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
451725be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4518e5fe0c52Spbrookfi
4519379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
452025be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4521379f6698SPaul Brookfi
452284778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
452325be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
452484778508Sblueswir1fi
45255b0753e0Sbellard
45264afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
4527fa282484SJuan Quintela
45284afddb55SJuan Quintelacflags=""
4529fa282484SJuan Quintelaldflags=""
45309b8e111fSJuan Quintela
453164656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
453264656024SJuan Quintela  case "$i" in
453364656024SJuan Quintela  alpha)
453425be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
453576cad711SPaolo Bonzini    echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
453664656024SJuan Quintela  ;;
453764656024SJuan Quintela  arm)
453825be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
453976cad711SPaolo Bonzini    echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
454064656024SJuan Quintela  ;;
454164656024SJuan Quintela  cris)
454225be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
454376cad711SPaolo Bonzini    echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
454464656024SJuan Quintela  ;;
454564656024SJuan Quintela  hppa)
454625be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
454776cad711SPaolo Bonzini    echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
454864656024SJuan Quintela  ;;
4549c72b26ecSRichard Henderson  i386|x86_64|x32)
455025be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
455176cad711SPaolo Bonzini    echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
455264656024SJuan Quintela  ;;
4553903ec55cSAurelien Jarno  ia64*)
4554903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
455576cad711SPaolo Bonzini    echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4556903ec55cSAurelien Jarno  ;;
455779368f49SMichael Walle  lm32)
455879368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
455976cad711SPaolo Bonzini    echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
456079368f49SMichael Walle  ;;
456164656024SJuan Quintela  m68k)
456225be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
456376cad711SPaolo Bonzini    echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
456464656024SJuan Quintela  ;;
4565877fdc12SEdgar E. Iglesias  microblaze*)
456625be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
456776cad711SPaolo Bonzini    echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
456864656024SJuan Quintela  ;;
456964656024SJuan Quintela  mips*)
457025be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
457176cad711SPaolo Bonzini    echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
457264656024SJuan Quintela  ;;
4573d15a9c23SAnthony Green  moxie*)
4574d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> $config_target_mak
4575d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> config-all-disas.mak
4576d15a9c23SAnthony Green  ;;
4577e67db06eSJia Liu  or32)
4578e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
457976cad711SPaolo Bonzini    echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4580e67db06eSJia Liu  ;;
458164656024SJuan Quintela  ppc*)
458225be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
458376cad711SPaolo Bonzini    echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
458464656024SJuan Quintela  ;;
458524e804ecSAlexander Graf  s390*)
458625be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
458776cad711SPaolo Bonzini    echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
458864656024SJuan Quintela  ;;
458964656024SJuan Quintela  sh4)
459025be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
459176cad711SPaolo Bonzini    echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
459264656024SJuan Quintela  ;;
459364656024SJuan Quintela  sparc*)
459425be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
459576cad711SPaolo Bonzini    echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
459664656024SJuan Quintela  ;;
4597cfa550c6SMax Filippov  xtensa*)
4598cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
459976cad711SPaolo Bonzini    echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
4600cfa550c6SMax Filippov  ;;
460164656024SJuan Quintela  esac
460264656024SJuan Quinteladone
46039195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
46049195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
460576cad711SPaolo Bonzini  echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
46069195b2c2SStefan Weilfi
460764656024SJuan Quintela
46086ee7126fSJuan Quintelacase "$ARCH" in
46096ee7126fSJuan Quintelaalpha)
46106ee7126fSJuan Quintela  # Ensure there's only a single GP
46116ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
46126ee7126fSJuan Quintela;;
46136ee7126fSJuan Quintelaesac
46146ee7126fSJuan Quintela
4615d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
461625be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
4617d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
4618d02c1db3SJuan Quintela    cflags="-p $cflags"
4619d02c1db3SJuan Quintela    ldflags="-p $ldflags"
4620d02c1db3SJuan Quintela  fi
4621d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
4622d02c1db3SJuan Quintela    ldflags="-p $ldflags"
462325be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
4624d02c1db3SJuan Quintela  fi
4625d02c1db3SJuan Quintelafi
4626d02c1db3SJuan Quintela
46279b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4628964c6fa1SRichard Henderson  ldflags="$ldflags $textseg_ldflags"
4629fa282484SJuan Quintelafi
4630fa282484SJuan Quintela
463125be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
463225be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4633fa282484SJuan Quintela
463497a847bcSbellarddone # for target in $targets
46357d13299dSbellard
4636b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then
4637b776eca1SGerd Hoffmann  echo "config-host.h: subdir-pixman" >> $config_host_mak
4638b776eca1SGerd Hoffmannfi
4639b776eca1SGerd Hoffmann
46402da776dbSMichael R. Hinesif test "$rdma" = "yes" ; then
46412da776dbSMichael R. Hinesecho "CONFIG_RDMA=y" >> $config_host_mak
46422da776dbSMichael R. Hinesfi
46432da776dbSMichael R. Hines
4644a540f158SPeter Crosthwaiteif [ "$dtc_internal" = "yes" ]; then
4645a540f158SPeter Crosthwaite  echo "config-host.h: subdir-dtc" >> $config_host_mak
4646a540f158SPeter Crosthwaitefi
4647a540f158SPeter Crosthwaite
4648d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
4649f93296eaSWenchao XiaDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests"
4650*2b170effSMichael TokarevDIRS="$DIRS fsdev"
46519933c305SChristian BorntraegerDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
46522d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
46532dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
4654c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4655c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
4656aaa2ebc5SAndreas FärberFILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
4657ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4658446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
46599933c305SChristian BorntraegerFILES="$FILES pc-bios/s390-ccw/Makefile"
46602d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
46614652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp"
4662753d11f2SRichard Hendersonfor bios_file in \
4663753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
46645acc2ec0SGerd Hoffmann    $source_path/pc-bios/*.aml \
4665753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
4666753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
4667e89e33e1SDominik Dingel    $source_path/pc-bios/*.img \
4668753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
4669753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
4670753d11f2SRichard Hendersondo
46717ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
46727ea78b74SJan Kiszkadone
4673d1807a4fSPaolo Bonzinimkdir -p $DIRS
46747d13299dSbellardfor f in $FILES ; do
467572b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4676f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
4677f9245e10SPeter Maydell    fi
46787d13299dSbellarddone
46791ad2134fSPaul Brook
4680c34ebfdcSAnthony Liguori# temporary config to build submodules
46812d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
4682c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
468337116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4684c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
46853dd46c78SBlue Swirl    echo "AS=$as" >> $config_mak
4686c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4687c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
46883dd46c78SBlue Swirl    echo "CPP=$cpp" >> $config_mak
4689c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4690c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
4691c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4692c34ebfdcSAnthony Liguoridone
4693c34ebfdcSAnthony Liguori
4694b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4695b40292e7SJan Kiszka  mkdir -p QMP
4696b40292e7SJan Kiszkafi
4697