xref: /openbmc/qemu/configure (revision b1e5fff4afd0c47148b0d9f9341887ae2c3eb9af)
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
308dc38a78SPeter Maydelldo_cc() {
318dc38a78SPeter Maydell    # Run the compiler, capturing its output to the log.
328dc38a78SPeter Maydell    echo $cc "$@" >> config.log
338dc38a78SPeter Maydell    $cc "$@" >> config.log 2>&1 || return $?
348dc38a78SPeter Maydell    # Test passed. If this is an --enable-werror build, rerun
358dc38a78SPeter Maydell    # the test with -Werror and bail out if it fails. This
368dc38a78SPeter Maydell    # makes warning-generating-errors in configure test code
378dc38a78SPeter Maydell    # obvious to developers.
388dc38a78SPeter Maydell    if test "$werror" != "yes"; then
398dc38a78SPeter Maydell        return 0
408dc38a78SPeter Maydell    fi
418dc38a78SPeter Maydell    # Don't bother rerunning the compile if we were already using -Werror
428dc38a78SPeter Maydell    case "$*" in
438dc38a78SPeter Maydell        *-Werror*)
448dc38a78SPeter Maydell           return 0
458dc38a78SPeter Maydell        ;;
468dc38a78SPeter Maydell    esac
478dc38a78SPeter Maydell    echo $cc -Werror "$@" >> config.log
488dc38a78SPeter Maydell    $cc -Werror "$@" >> config.log 2>&1 && return $?
498dc38a78SPeter Maydell    echo "ERROR: configure test passed without -Werror but failed with -Werror."
508dc38a78SPeter Maydell    echo "This is probably a bug in the configure script. The failing command"
518dc38a78SPeter Maydell    echo "will be at the bottom of config.log."
528dc38a78SPeter Maydell    echo "You can run configure with --disable-werror to bypass this check."
538dc38a78SPeter Maydell    exit 1
548dc38a78SPeter Maydell}
558dc38a78SPeter Maydell
5652166aa0SJuan Quintelacompile_object() {
578dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
5852166aa0SJuan Quintela}
5952166aa0SJuan Quintela
6052166aa0SJuan Quintelacompile_prog() {
6152166aa0SJuan Quintela  local_cflags="$1"
6252166aa0SJuan Quintela  local_ldflags="$2"
638dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
6452166aa0SJuan Quintela}
6552166aa0SJuan Quintela
6611568d6dSPaolo Bonzini# symbolically link $1 to $2.  Portable version of "ln -sf".
6711568d6dSPaolo Bonzinisymlink() {
6872b8b5a1SStefan Weil  rm -rf "$2"
69ec5b06d7SAnthony Liguori  mkdir -p "$(dirname "$2")"
7072b8b5a1SStefan Weil  ln -s "$1" "$2"
7111568d6dSPaolo Bonzini}
7211568d6dSPaolo Bonzini
730dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
740dba6195SLoïc Minier# executable or a builtin)
750dba6195SLoïc Minierhas() {
760dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
770dba6195SLoïc Minier}
780dba6195SLoïc Minier
790dba6195SLoïc Minier# search for an executable in PATH
800dba6195SLoïc Minierpath_of() {
810dba6195SLoïc Minier    local_command="$1"
820dba6195SLoïc Minier    local_ifs="$IFS"
830dba6195SLoïc Minier    local_dir=""
840dba6195SLoïc Minier
850dba6195SLoïc Minier    # pathname has a dir component?
860dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
870dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
880dba6195SLoïc Minier            echo "$local_command"
890dba6195SLoïc Minier            return 0
900dba6195SLoïc Minier        fi
910dba6195SLoïc Minier    fi
920dba6195SLoïc Minier    if [ -z "$local_command" ]; then
930dba6195SLoïc Minier        return 1
940dba6195SLoïc Minier    fi
950dba6195SLoïc Minier
960dba6195SLoïc Minier    IFS=:
970dba6195SLoïc Minier    for local_dir in $PATH; do
980dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
990dba6195SLoïc Minier            echo "$local_dir/$local_command"
1000dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
1010dba6195SLoïc Minier            return 0
1020dba6195SLoïc Minier        fi
1030dba6195SLoïc Minier    done
1040dba6195SLoïc Minier    # not found
1050dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
1060dba6195SLoïc Minier    return 1
1070dba6195SLoïc Minier}
1080dba6195SLoïc Minier
1097d13299dSbellard# default parameters
110ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"`
1112ff6b91eSJuan Quintelacpu=""
1121e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
11343ce4dfeSbellardstatic="no"
1147d13299dSbellardcross_prefix=""
1150c58ac1cSmalcaudio_drv_list=""
11661dc008fSAnthony Liguoriaudio_card_list="ac97 es1370 sb16 hda"
11761dc008fSAnthony Liguoriaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
118eb852011SMarkus Armbrusterblock_drv_whitelist=""
119e49d021eSPeter Maydellhost_cc="cc"
12073da375eSJuan Quintelalibs_softmmu=""
1213e2e0e6bSJuan Quintelalibs_tools=""
12267f86e8eSJuan Quintelaaudio_pt_int=""
123d5631638Smalcaudio_win_int=""
1242b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc
125957f1f99SMichael Rothlibs_qga=""
1265bc62e01SGerd Hoffmanndebug_info="yes"
127ac0df51dSaliguori
128afb63ebdSStefan Weil# Don't accept a target_list environment variable.
129afb63ebdSStefan Weilunset target_list
130377529c0SPaolo Bonzini
131377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
132377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
133377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
134377529c0SPaolo Bonzini#              unless --disable-foo is given
135377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
136377529c0SPaolo Bonzini#              feature will searched for,
137377529c0SPaolo Bonzini#              if not found, configure exits with error
138377529c0SPaolo Bonzini#
139377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
140377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
141377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
142377529c0SPaolo Bonzini
143377529c0SPaolo Bonzinibluez=""
144377529c0SPaolo Bonzinibrlapi=""
145377529c0SPaolo Bonzinicurl=""
146377529c0SPaolo Bonzinicurses=""
147377529c0SPaolo Bonzinidocs=""
148377529c0SPaolo Bonzinifdt=""
149377529c0SPaolo Bonzininptl=""
150e2134eb9SGerd Hoffmannpixman=""
151377529c0SPaolo Bonzinisdl=""
152983eef5aSMeador Ingevirtfs=""
153821601eaSJes Sorensenvnc="yes"
154377529c0SPaolo Bonzinisparse="no"
155377529c0SPaolo Bonziniuuid=""
156377529c0SPaolo Bonzinivde=""
157377529c0SPaolo Bonzinivnc_tls=""
158377529c0SPaolo Bonzinivnc_sasl=""
159377529c0SPaolo Bonzinivnc_jpeg=""
160377529c0SPaolo Bonzinivnc_png=""
1617536ee4bSTim Hardeckvnc_ws=""
162377529c0SPaolo Bonzinixen=""
163d5b93ddfSAnthony PERARDxen_ctrl_version=""
164eb6fda0fSAnthony PERARDxen_pci_passthrough=""
165377529c0SPaolo Bonzinilinux_aio=""
16647e98658SCorey Bryantcap_ng=""
167377529c0SPaolo Bonziniattr=""
1684f26f2b6SAvi Kivitylibattr=""
169377529c0SPaolo Bonzinixfs=""
170377529c0SPaolo Bonzini
171d41a75a2SBradvhost_net="no"
172d41a75a2SBradkvm="no"
173377529c0SPaolo Bonzinigprof="no"
174377529c0SPaolo Bonzinidebug_tcg="no"
175377529c0SPaolo Bonzinidebug="no"
176377529c0SPaolo Bonzinistrip_opt="yes"
1779195b2c2SStefan Weiltcg_interpreter="no"
178377529c0SPaolo Bonzinibigendian="no"
179377529c0SPaolo Bonzinimingw32="no"
1801d728c39SBlue Swirlgcov="no"
1811d728c39SBlue Swirlgcov_tool="gcov"
182377529c0SPaolo BonziniEXESUF=""
183377529c0SPaolo Bonziniprefix="/usr/local"
184377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
185528ae5b8SEduardo Habkostdatadir="\${prefix}/share"
186850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu"
187377529c0SPaolo Bonzinibindir="\${prefix}/bin"
1883aa5d2beSAlon Levylibdir="\${prefix}/lib"
1898bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec"
1900f94d6daSAlon Levyincludedir="\${prefix}/include"
191377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
192785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var"
193377529c0SPaolo Bonziniconfsuffix="/qemu"
194377529c0SPaolo Bonzinislirp="yes"
195377529c0SPaolo Bonzinifmod_lib=""
196377529c0SPaolo Bonzinifmod_inc=""
197377529c0SPaolo Bonzinioss_lib=""
198377529c0SPaolo Bonzinibsd="no"
199377529c0SPaolo Bonzinilinux="no"
200377529c0SPaolo Bonzinisolaris="no"
201377529c0SPaolo Bonziniprofiler="no"
202377529c0SPaolo Bonzinicocoa="no"
203377529c0SPaolo Bonzinisoftmmu="yes"
204377529c0SPaolo Bonzinilinux_user="no"
205377529c0SPaolo Bonzinibsd_user="no"
20630163d89SPeter Maydellguest_base="yes"
207377529c0SPaolo Bonziniuname_release=""
208377529c0SPaolo Bonzinimixemu="no"
209377529c0SPaolo Bonziniaix="no"
210377529c0SPaolo Bonziniblobs="yes"
211377529c0SPaolo Bonzinipkgversion=""
21240d6444eSAvi Kivitypie=""
213377529c0SPaolo Bonzinizero_malloc=""
214377529c0SPaolo Bonzinitrace_backend="nop"
215377529c0SPaolo Bonzinitrace_file="trace"
216377529c0SPaolo Bonzinispice=""
217377529c0SPaolo Bonzinirbd=""
218111a38b0SRobert Relyeasmartcard_nss=""
21969354a83SHans de Goedeusb_redir=""
220*b1e5fff4SMichael Walleglx=""
2211ece9905SAlon Levyzlib="yes"
222d138cee9SMichael Rothguest_agent="yes"
2234b1c11fdSDaniel P. Berrangewant_tools="yes"
224c589b249SRonnie Sahlberglibiscsi=""
225519175a2SAlex Barcelocoroutine=""
226f794573eSEduardo Otuboseccomp=""
227eb100396SBharata B Raoglusterfs=""
228583f6e7bSStefan Hajnoczivirtio_blk_data_plane=""
229a4ccabcfSAnthony Liguorigtk=""
230528de90aSDaniel P. Berrangegtkabi="2.0"
231ab214c29SStefan Bergertpm="no"
232377529c0SPaolo Bonzini
233ac0df51dSaliguori# parse CC options first
234ac0df51dSaliguorifor opt do
235ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
236ac0df51dSaliguori  case "$opt" in
237ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
238ac0df51dSaliguori  ;;
2393d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
240ac0df51dSaliguori  ;;
241ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
242ca4deeb1SPaolo Bonzini  ;;
2432ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2442ff6b91eSJuan Quintela  ;;
245a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
246f9943cd5SGerd Hoffmann                    EXTRA_CFLAGS="$optarg"
247e2a2ed06SJuan Quintela  ;;
248e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
249f9943cd5SGerd Hoffmann                     EXTRA_LDFLAGS="$optarg"
250e2a2ed06SJuan Quintela  ;;
2515bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2525bc62e01SGerd Hoffmann  ;;
2535bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2545bc62e01SGerd Hoffmann  ;;
255ac0df51dSaliguori  esac
256ac0df51dSaliguoridone
257ac0df51dSaliguori# OS specific
258ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
25993148aa5SStefan Weil# we can eliminate its usage altogether.
260ac0df51dSaliguori
261e49d021eSPeter Maydell# Preferred compiler:
262e49d021eSPeter Maydell#  ${CC} (if set)
263e49d021eSPeter Maydell#  ${cross_prefix}gcc (if cross-prefix specified)
264e49d021eSPeter Maydell#  system compiler
265e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then
266e49d021eSPeter Maydell  cc="$host_cc"
267e49d021eSPeter Maydellelse
268b3198cc2SStuart Yoder  cc="${CC-${cross_prefix}gcc}"
269e49d021eSPeter Maydellfi
270e49d021eSPeter Maydell
271b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
2723dd46c78SBlue Swirlas="${AS-${cross_prefix}as}"
2733dd46c78SBlue Swirlcpp="${CPP-$cc -E}"
274b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
275b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
2763f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
277b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
278b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
27917884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
28017884d7bSSergei Trofimovichquery_pkg_config() {
28117884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
28217884d7bSSergei Trofimovich}
28317884d7bSSergei Trofimovichpkg_config=query_pkg_config
284b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
285ac0df51dSaliguori
286be17dc90SMichael S. Tsirkin# default flags for all hosts
287be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
288f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
289c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
290be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
2916b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
2925bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
2935bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
294be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
2955bc62e01SGerd Hoffmannfi
296be17dc90SMichael S. Tsirkin
297ca4deeb1SPaolo Bonzini# make source path absolute
298ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
299ca4deeb1SPaolo Bonzini
300ac0df51dSaliguoricheck_define() {
301ac0df51dSaliguoricat > $TMPC <<EOF
302ac0df51dSaliguori#if !defined($1)
303fd786e1aSPeter Maydell#error $1 not defined
304ac0df51dSaliguori#endif
305ac0df51dSaliguoriint main(void) { return 0; }
306ac0df51dSaliguoriEOF
30752166aa0SJuan Quintela  compile_object
308ac0df51dSaliguori}
309ac0df51dSaliguori
310bbea4050SPeter Maydellif check_define __linux__ ; then
311bbea4050SPeter Maydell  targetos="Linux"
312bbea4050SPeter Maydellelif check_define _WIN32 ; then
313bbea4050SPeter Maydell  targetos='MINGW32'
314bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then
315bbea4050SPeter Maydell  targetos='OpenBSD'
316bbea4050SPeter Maydellelif check_define __sun__ ; then
317bbea4050SPeter Maydell  targetos='SunOS'
318bbea4050SPeter Maydellelif check_define __HAIKU__ ; then
319bbea4050SPeter Maydell  targetos='Haiku'
320bbea4050SPeter Maydellelse
321bbea4050SPeter Maydell  targetos=`uname -s`
322bbea4050SPeter Maydellfi
323bbea4050SPeter Maydell
324bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use.
325bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're
326bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify
327bbea4050SPeter Maydell# the correct CPU with the --cpu option.
328bbea4050SPeter Maydellcase $targetos in
329bbea4050SPeter MaydellDarwin)
330bbea4050SPeter Maydell  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
331bbea4050SPeter Maydell  # run 64-bit userspace code.
332bbea4050SPeter Maydell  # If the user didn't specify a CPU explicitly and the kernel says this is
333bbea4050SPeter Maydell  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
334bbea4050SPeter Maydell  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
335bbea4050SPeter Maydell    cpu="x86_64"
336bbea4050SPeter Maydell  fi
337bbea4050SPeter Maydell  ;;
338bbea4050SPeter MaydellSunOS)
339bbea4050SPeter Maydell  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
340bbea4050SPeter Maydell  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
341bbea4050SPeter Maydell    cpu="x86_64"
342bbea4050SPeter Maydell  fi
343bbea4050SPeter Maydellesac
344bbea4050SPeter Maydell
3452ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
3462ff6b91eSJuan Quintela  # command line argument
3472ff6b91eSJuan Quintela  :
3482ff6b91eSJuan Quintelaelif check_define __i386__ ; then
349ac0df51dSaliguori  cpu="i386"
350ac0df51dSaliguorielif check_define __x86_64__ ; then
351ac0df51dSaliguori  cpu="x86_64"
3523aa9bd6cSblueswir1elif check_define __sparc__ ; then
3533aa9bd6cSblueswir1  if check_define __arch64__ ; then
3543aa9bd6cSblueswir1    cpu="sparc64"
3553aa9bd6cSblueswir1  else
3563aa9bd6cSblueswir1    cpu="sparc"
3573aa9bd6cSblueswir1  fi
358fdf7ed96Smalcelif check_define _ARCH_PPC ; then
359fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
360fdf7ed96Smalc    cpu="ppc64"
361ac0df51dSaliguori  else
362fdf7ed96Smalc    cpu="ppc"
363fdf7ed96Smalc  fi
364afa05235SAurelien Jarnoelif check_define __mips__ ; then
365afa05235SAurelien Jarno  cpu="mips"
366477ba620SAurelien Jarnoelif check_define __ia64__ ; then
367477ba620SAurelien Jarno  cpu="ia64"
368d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
369d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
370d66ed0eaSAurelien Jarno    cpu="s390x"
371d66ed0eaSAurelien Jarno  else
372d66ed0eaSAurelien Jarno    cpu="s390"
373d66ed0eaSAurelien Jarno  fi
37421d89f84SPeter Maydellelif check_define __arm__ ; then
37521d89f84SPeter Maydell  cpu="arm"
376f28ffed5SBradelif check_define __hppa__ ; then
377f28ffed5SBrad  cpu="hppa"
378fdf7ed96Smalcelse
379fdf7ed96Smalc  cpu=`uname -m`
380ac0df51dSaliguorifi
381ac0df51dSaliguori
382359bc95dSPeter MaydellARCH=
383359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
384359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
3857d13299dSbellardcase "$cpu" in
386359bc95dSPeter Maydell  ia64|ppc|ppc64|s390|s390x|sparc64)
387ea8f20f8SJuan Quintela    cpu="$cpu"
388ea8f20f8SJuan Quintela  ;;
3897d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
39097a847bcSbellard    cpu="i386"
3917d13299dSbellard  ;;
392aaa5fa14Saurel32  x86_64|amd64)
393aaa5fa14Saurel32    cpu="x86_64"
394aaa5fa14Saurel32  ;;
39521d89f84SPeter Maydell  armv*b|armv*l|arm)
39621d89f84SPeter Maydell    cpu="arm"
3977d13299dSbellard  ;;
398f28ffed5SBrad  hppa|parisc|parisc64)
399f54b3f92Saurel32    cpu="hppa"
400f54b3f92Saurel32  ;;
401afa05235SAurelien Jarno  mips*)
402afa05235SAurelien Jarno    cpu="mips"
403afa05235SAurelien Jarno  ;;
4043142255cSblueswir1  sparc|sun4[cdmuv])
405ae228531Sbellard    cpu="sparc"
406ae228531Sbellard  ;;
4077d13299dSbellard  *)
408359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
409359bc95dSPeter Maydell    ARCH=unknown
4107d13299dSbellard  ;;
4117d13299dSbellardesac
412359bc95dSPeter Maydellif test -z "$ARCH"; then
413359bc95dSPeter Maydell  ARCH="$cpu"
414359bc95dSPeter Maydellfi
415e2d52ad3SJuan Quintela
4167d13299dSbellard# OS specific
4170dbfc675SJuan Quintela
4187d13299dSbellardcase $targetos in
419c326e0afSbellardCYGWIN*)
420c326e0afSbellard  mingw32="yes"
421a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
422d5631638Smalc  audio_possible_drivers="winwave sdl"
423d5631638Smalc  audio_drv_list="winwave"
424c326e0afSbellard;;
42567b915a5SbellardMINGW32*)
42667b915a5Sbellard  mingw32="yes"
427d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
428d5631638Smalc  audio_drv_list="winwave"
42967b915a5Sbellard;;
4305c40d2bdSthsGNU/kFreeBSD)
431a167ba50SAurelien Jarno  bsd="yes"
4320c58ac1cSmalc  audio_drv_list="oss"
433f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
4345c40d2bdSths;;
4357d3505c5SbellardFreeBSD)
4367d3505c5Sbellard  bsd="yes"
4370db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4380c58ac1cSmalc  audio_drv_list="oss"
439f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
440f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
441f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
4427d3505c5Sbellard;;
443c5e97233Sblueswir1DragonFly)
444c5e97233Sblueswir1  bsd="yes"
4450db4a067SPaolo Bonzini  make="${MAKE-gmake}"
446c5e97233Sblueswir1  audio_drv_list="oss"
447c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
448c5e97233Sblueswir1;;
4497d3505c5SbellardNetBSD)
4507d3505c5Sbellard  bsd="yes"
4510db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4520c58ac1cSmalc  audio_drv_list="oss"
453c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4548ef92a88Sblueswir1  oss_lib="-lossaudio"
4557d3505c5Sbellard;;
4567d3505c5SbellardOpenBSD)
4577d3505c5Sbellard  bsd="yes"
4580db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4590c58ac1cSmalc  audio_drv_list="oss"
460c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4612f6a1ab0Sblueswir1  oss_lib="-lossaudio"
4627d3505c5Sbellard;;
46383fb7adfSbellardDarwin)
46483fb7adfSbellard  bsd="yes"
46583fb7adfSbellard  darwin="yes"
4661b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
467a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
4680c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
4691b0f9cc2Saliguori  else
470a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
4711b0f9cc2Saliguori  fi
472fd677642Sths  cocoa="yes"
4730c58ac1cSmalc  audio_drv_list="coreaudio"
474c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4750c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4767973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
477a0b7cf6bSPeter Maydell  # Disable attempts to use ObjectiveC features in os/object.h since they
478a0b7cf6bSPeter Maydell  # won't work when we're compiling with gcc as a C compiler.
479a0b7cf6bSPeter Maydell  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
48083fb7adfSbellard;;
481ec530c81SbellardSunOS)
482ec530c81Sbellard  solaris="yes"
4830db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4840db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
485fa58948dSBlue Swirl  ld="gld"
486e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
4870475a5caSths  needs_libsunmath="no"
488c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
489c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4900475a5caSths    if test "$solarisrev" -le 9 ; then
4910475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4920475a5caSths        needs_libsunmath="yes"
493f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
494f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
495f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4960475a5caSths      else
4970475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4980475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4990475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
5000475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
5010475a5caSths        exit 1
5020475a5caSths      fi
5030475a5caSths    fi
50486b2bd93Sths  fi
5056b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
5060c58ac1cSmalc    audio_drv_list="oss"
5076b4d2ba1Sths  fi
508c2de5c91Smalc  audio_possible_drivers="oss sdl"
509d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
510d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
511d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
512d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
513a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
514560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
515560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
516560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
517ec530c81Sbellard;;
518b29fe3edSmalcAIX)
519b29fe3edSmalc  aix="yes"
5200db4a067SPaolo Bonzini  make="${MAKE-gmake}"
521b29fe3edSmalc;;
522179cf400SAndreas FärberHaiku)
523179cf400SAndreas Färber  haiku="yes"
524179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
525179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
526179cf400SAndreas Färber;;
527fb065187Sbellard*)
5280c58ac1cSmalc  audio_drv_list="oss"
529b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
5305327cf48Sbellard  linux="yes"
531831b7825Sths  linux_user="yes"
53268063649Sblueswir1  usb="linux"
533af2be207SJan Kiszka  kvm="yes"
534af2be207SJan Kiszka  vhost_net="yes"
53507f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
536c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
537c9ec1fe4Sbellard  fi
538fb065187Sbellard;;
5397d13299dSbellardesac
5407d13299dSbellard
5417d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
542b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
54368063649Sblueswir1    usb="bsd"
54484778508Sblueswir1    bsd_user="yes"
5457d3505c5Sbellard  fi
54608de3949SAndreas Färberfi
5477d3505c5Sbellard
5480db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5490db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
550c886edfbSBlue Swirl: ${python=${PYTHON-python}}
551e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5520db4a067SPaolo Bonzini
5533c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC
5543c4a4d0dSPeter Maydellif has clang; then
5553c4a4d0dSPeter Maydell  objcc=clang
5563c4a4d0dSPeter Maydellelse
5573c4a4d0dSPeter Maydell  objcc="$cc"
5583c4a4d0dSPeter Maydellfi
5593c4a4d0dSPeter Maydell
5603457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
5613457a3f8SJuan Quintela  EXESUF=".exe"
562a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
563e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
564e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
565f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
566f7cf5d5bSStefan Weilcat > $TMPC << EOF
567f7cf5d5bSStefan Weilint main(void) { return 0; }
568f7cf5d5bSStefan WeilEOF
569f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
570f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
571f7cf5d5bSStefan Weil  fi
572c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
573683035deSPaolo Bonzini  mandir="\${prefix}"
574528ae5b8SEduardo Habkost  datadir="\${prefix}"
575850da188SEduardo Habkost  qemu_docdir="\${prefix}"
576683035deSPaolo Bonzini  bindir="\${prefix}"
577683035deSPaolo Bonzini  sysconfdir="\${prefix}"
578785c23aeSLuiz Capitulino  local_statedir="\${prefix}"
579683035deSPaolo Bonzini  confsuffix=""
580368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
5813457a3f8SJuan Quintelafi
5823457a3f8SJuan Quintela
583487fefdbSAnthony Liguoriwerror=""
58485aa5189Sbellard
5857d13299dSbellardfor opt do
586a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
5877d13299dSbellard  case "$opt" in
5882efc3265Sbellard  --help|-h) show_help=yes
5892efc3265Sbellard  ;;
59099123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
59199123e13SMike Frysinger  ;;
592b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5937d13299dSbellard  ;;
594b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
59532ce6337Sbellard  ;;
596ca4deeb1SPaolo Bonzini  --source-path=*)
5977d13299dSbellard  ;;
598ac0df51dSaliguori  --cross-prefix=*)
5997d13299dSbellard  ;;
600ac0df51dSaliguori  --cc=*)
6017d13299dSbellard  ;;
602b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
60383469015Sbellard  ;;
6043c4a4d0dSPeter Maydell  --objcc=*) objcc="$optarg"
6053c4a4d0dSPeter Maydell  ;;
606b1a550a0Spbrook  --make=*) make="$optarg"
6077d13299dSbellard  ;;
6086a882643Spbrook  --install=*) install="$optarg"
6096a882643Spbrook  ;;
610c886edfbSBlue Swirl  --python=*) python="$optarg"
611c886edfbSBlue Swirl  ;;
6121d728c39SBlue Swirl  --gcov=*) gcov_tool="$optarg"
6131d728c39SBlue Swirl  ;;
614e2d8830eSBrad  --smbd=*) smbd="$optarg"
615e2d8830eSBrad  ;;
616e2a2ed06SJuan Quintela  --extra-cflags=*)
6177d13299dSbellard  ;;
618e2a2ed06SJuan Quintela  --extra-ldflags=*)
6197d13299dSbellard  ;;
6205bc62e01SGerd Hoffmann  --enable-debug-info)
6215bc62e01SGerd Hoffmann  ;;
6225bc62e01SGerd Hoffmann  --disable-debug-info)
6235bc62e01SGerd Hoffmann  ;;
6242ff6b91eSJuan Quintela  --cpu=*)
6257d13299dSbellard  ;;
626b1a550a0Spbrook  --target-list=*) target_list="$optarg"
627de83cd02Sbellard  ;;
62874242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
62994a420b1SStefan Hajnoczi  ;;
63074242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
6319410b56cSPrerna Saxena  ;;
6327d13299dSbellard  --enable-gprof) gprof="yes"
6337d13299dSbellard  ;;
6341d728c39SBlue Swirl  --enable-gcov) gcov="yes"
6351d728c39SBlue Swirl  ;;
63679427693SLoïc Minier  --static)
63779427693SLoïc Minier    static="yes"
63879427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
63917884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
64043ce4dfeSbellard  ;;
6410b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
6420b24e75fSPaolo Bonzini  ;;
6430b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
6440b24e75fSPaolo Bonzini  ;;
6453aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
6463aa5d2beSAlon Levy  ;;
6478bf188aaSMichael Tokarev  --libexecdir=*) libexecdir="$optarg"
6488bf188aaSMichael Tokarev  ;;
6490f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
6500f94d6daSAlon Levy  ;;
651528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
6520b24e75fSPaolo Bonzini  ;;
653023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
654023d3d67SEduardo Habkost  ;;
655850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
6560b24e75fSPaolo Bonzini  ;;
657ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
65807381cc1SAnthony Liguori  ;;
659785c23aeSLuiz Capitulino  --localstatedir=*) local_statedir="$optarg"
660785c23aeSLuiz Capitulino  ;;
661785c23aeSLuiz Capitulino  --sbindir=*|--sharedstatedir=*|\
662023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
663023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
664023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
665023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
666023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
667023ddd74SMax Filippov    # lots of directory switches by default.
668023ddd74SMax Filippov  ;;
669e2134eb9SGerd Hoffmann  --with-system-pixman) pixman="system"
670e2134eb9SGerd Hoffmann  ;;
671e2134eb9SGerd Hoffmann  --without-system-pixman) pixman="internal"
672e2134eb9SGerd Hoffmann  ;;
67374880fe2SRobert Schiele  --without-pixman) pixman="none"
67474880fe2SRobert Schiele  ;;
67597a847bcSbellard  --disable-sdl) sdl="no"
67697a847bcSbellard  ;;
677c4198157SJuan Quintela  --enable-sdl) sdl="yes"
678c4198157SJuan Quintela  ;;
679983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
680983eef5aSMeador Inge  ;;
681983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
682983eef5aSMeador Inge  ;;
683821601eaSJes Sorensen  --disable-vnc) vnc="no"
684821601eaSJes Sorensen  ;;
685821601eaSJes Sorensen  --enable-vnc) vnc="yes"
686821601eaSJes Sorensen  ;;
687b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
688102a52e4Sbellard  ;;
689c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
690c2de5c91Smalc  ;;
6912f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
6922f6a1ab0Sblueswir1  ;;
6932fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
6940c58ac1cSmalc  ;;
6950c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
6960c58ac1cSmalc  ;;
697eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
698eb852011SMarkus Armbruster  ;;
699f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
700f8393946Saurel32  ;;
701f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
702f8393946Saurel32  ;;
703f3d08ee6SPaul Brook  --enable-debug)
704f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
705f3d08ee6SPaul Brook      debug_tcg="yes"
706f3d08ee6SPaul Brook      debug="yes"
707f3d08ee6SPaul Brook      strip_opt="no"
708f3d08ee6SPaul Brook  ;;
70903b4fe7dSaliguori  --enable-sparse) sparse="yes"
71003b4fe7dSaliguori  ;;
71103b4fe7dSaliguori  --disable-sparse) sparse="no"
71203b4fe7dSaliguori  ;;
7131625af87Saliguori  --disable-strip) strip_opt="no"
7141625af87Saliguori  ;;
7158d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
7168d5d2d4cSths  ;;
7171be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
7181be10ad2SJuan Quintela  ;;
7192f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
7202f9606b3Saliguori  ;;
721ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
722ea784e3bSJuan Quintela  ;;
7232f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
7242f6f5c7aSCorentin Chary  ;;
7252f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
7262f6f5c7aSCorentin Chary  ;;
727efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
728efe556adSCorentin Chary  ;;
729efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
730efe556adSCorentin Chary  ;;
7317536ee4bSTim Hardeck  --disable-vnc-ws) vnc_ws="no"
7327536ee4bSTim Hardeck  ;;
7337536ee4bSTim Hardeck  --enable-vnc-ws) vnc_ws="yes"
7347536ee4bSTim Hardeck  ;;
735443f1376Sbellard  --disable-slirp) slirp="no"
736c20709aaSbellard  ;;
737ee682d27SStefan Weil  --disable-uuid) uuid="no"
738ee682d27SStefan Weil  ;;
739ee682d27SStefan Weil  --enable-uuid) uuid="yes"
740ee682d27SStefan Weil  ;;
741e0e6c8c0Saliguori  --disable-vde) vde="no"
7428a16d273Sths  ;;
743dfb278bdSJuan Quintela  --enable-vde) vde="yes"
744dfb278bdSJuan Quintela  ;;
745e37630caSaliguori  --disable-xen) xen="no"
746e37630caSaliguori  ;;
747fc321b4bSJuan Quintela  --enable-xen) xen="yes"
748fc321b4bSJuan Quintela  ;;
749eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
750eb6fda0fSAnthony PERARD  ;;
751eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
752eb6fda0fSAnthony PERARD  ;;
7532e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
7542e4d9fb1Saurel32  ;;
7554ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
7564ffcedb6SJuan Quintela  ;;
757fb599c9aSbalrog  --disable-bluez) bluez="no"
758fb599c9aSbalrog  ;;
759a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
760a20a6f46SJuan Quintela  ;;
7617ba1e619Saliguori  --disable-kvm) kvm="no"
7627ba1e619Saliguori  ;;
763b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
764b31a0277SJuan Quintela  ;;
7659195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
7669195b2c2SStefan Weil  ;;
7679195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
7689195b2c2SStefan Weil  ;;
76947e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
77047e98658SCorey Bryant  ;;
77147e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
77247e98658SCorey Bryant  ;;
773cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
774cd4ec0b4SGerd Hoffmann  ;;
775cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
776cd4ec0b4SGerd Hoffmann  ;;
777c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
778c589b249SRonnie Sahlberg  ;;
779c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
780c589b249SRonnie Sahlberg  ;;
78105c2a3e7Sbellard  --enable-profiler) profiler="yes"
78205c2a3e7Sbellard  ;;
78314821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
78414821030SPavel Borzenkov  ;;
785c2de5c91Smalc  --enable-cocoa)
786c2de5c91Smalc      cocoa="yes" ;
787c2de5c91Smalc      sdl="no" ;
788c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
7895b0753e0Sbellard  ;;
790cad25d69Spbrook  --disable-system) softmmu="no"
7910a8e90f4Spbrook  ;;
792cad25d69Spbrook  --enable-system) softmmu="yes"
7930a8e90f4Spbrook  ;;
7940953a80fSZachary Amsden  --disable-user)
7950953a80fSZachary Amsden      linux_user="no" ;
7960953a80fSZachary Amsden      bsd_user="no" ;
7970953a80fSZachary Amsden  ;;
7980953a80fSZachary Amsden  --enable-user) ;;
799831b7825Sths  --disable-linux-user) linux_user="no"
8000a8e90f4Spbrook  ;;
801831b7825Sths  --enable-linux-user) linux_user="yes"
802831b7825Sths  ;;
80384778508Sblueswir1  --disable-bsd-user) bsd_user="no"
80484778508Sblueswir1  ;;
80584778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
80684778508Sblueswir1  ;;
807379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
808379f6698SPaul Brook  ;;
809379f6698SPaul Brook  --disable-guest-base) guest_base="no"
810379f6698SPaul Brook  ;;
81140d6444eSAvi Kivity  --enable-pie) pie="yes"
81234005a00SKirill A. Shutemov  ;;
81340d6444eSAvi Kivity  --disable-pie) pie="no"
81434005a00SKirill A. Shutemov  ;;
815c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
816c5937220Spbrook  ;;
81785aa5189Sbellard  --enable-werror) werror="yes"
81885aa5189Sbellard  ;;
81985aa5189Sbellard  --disable-werror) werror="no"
82085aa5189Sbellard  ;;
8214d3b6f6eSbalrog  --disable-curses) curses="no"
8224d3b6f6eSbalrog  ;;
823c584a6d0SJuan Quintela  --enable-curses) curses="yes"
824c584a6d0SJuan Quintela  ;;
825769ce76dSAlexander Graf  --disable-curl) curl="no"
826769ce76dSAlexander Graf  ;;
827788c8196SJuan Quintela  --enable-curl) curl="yes"
828788c8196SJuan Quintela  ;;
8292df87df7SJuan Quintela  --disable-fdt) fdt="no"
8302df87df7SJuan Quintela  ;;
8312df87df7SJuan Quintela  --enable-fdt) fdt="yes"
8322df87df7SJuan Quintela  ;;
833bd0c5661Spbrook  --disable-nptl) nptl="no"
834bd0c5661Spbrook  ;;
835b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
836b0a47e79SJuan Quintela  ;;
8378ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
8388ff9cbf7Smalc  ;;
8395c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
8405c6c3a6cSChristoph Hellwig  ;;
8415c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
8425c6c3a6cSChristoph Hellwig  ;;
843758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
844758e8e38SVenkateswararao Jujjuri (JV)  ;;
845758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
846758e8e38SVenkateswararao Jujjuri (JV)  ;;
84777755340Sths  --disable-blobs) blobs="no"
84877755340Sths  ;;
8494a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
8504a19f1ecSpbrook  ;;
851519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
852519175a2SAlex Barcelo  ;;
853a25dba17SJuan Quintela  --disable-docs) docs="no"
85470ec5dc0SAnthony Liguori  ;;
855a25dba17SJuan Quintela  --enable-docs) docs="yes"
85683a3ab8bSJuan Quintela  ;;
857d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
858d5970055SMichael S. Tsirkin  ;;
859d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
860d5970055SMichael S. Tsirkin  ;;
861*b1e5fff4SMichael Walle  --disable-glx) glx="no"
86220ff075bSMichael Walle  ;;
863*b1e5fff4SMichael Walle  --enable-glx) glx="yes"
86420ff075bSMichael Walle  ;;
865f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
866f27aaf4bSChristian Brunner  ;;
867f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
868f27aaf4bSChristian Brunner  ;;
8698c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
8708c84cf11SSergei Trofimovich  ;;
8718c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
8728c84cf11SSergei Trofimovich  ;;
873111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
874111a38b0SRobert Relyea  ;;
875111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
876111a38b0SRobert Relyea  ;;
87769354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
87869354a83SHans de Goede  ;;
87969354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
88069354a83SHans de Goede  ;;
8811ece9905SAlon Levy  --disable-zlib-test) zlib="no"
8821ece9905SAlon Levy  ;;
883d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
884d138cee9SMichael Roth  ;;
885d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
886d138cee9SMichael Roth  ;;
8874b1c11fdSDaniel P. Berrange  --enable-tools) want_tools="yes"
8884b1c11fdSDaniel P. Berrange  ;;
8894b1c11fdSDaniel P. Berrange  --disable-tools) want_tools="no"
8904b1c11fdSDaniel P. Berrange  ;;
891f794573eSEduardo Otubo  --enable-seccomp) seccomp="yes"
892f794573eSEduardo Otubo  ;;
893f794573eSEduardo Otubo  --disable-seccomp) seccomp="no"
894f794573eSEduardo Otubo  ;;
895eb100396SBharata B Rao  --disable-glusterfs) glusterfs="no"
896eb100396SBharata B Rao  ;;
897eb100396SBharata B Rao  --enable-glusterfs) glusterfs="yes"
898eb100396SBharata B Rao  ;;
899583f6e7bSStefan Hajnoczi  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
900583f6e7bSStefan Hajnoczi  ;;
901583f6e7bSStefan Hajnoczi  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
902583f6e7bSStefan Hajnoczi  ;;
903a4ccabcfSAnthony Liguori  --disable-gtk) gtk="no"
904a4ccabcfSAnthony Liguori  ;;
905a4ccabcfSAnthony Liguori  --enable-gtk) gtk="yes"
906a4ccabcfSAnthony Liguori  ;;
907528de90aSDaniel P. Berrange  --with-gtkabi=*) gtkabi="$optarg"
908528de90aSDaniel P. Berrange  ;;
909ab214c29SStefan Berger  --enable-tpm) tpm="yes"
910ab214c29SStefan Berger  ;;
9117f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
9127f1559c6Sbalrog  ;;
9137d13299dSbellard  esac
9147d13299dSbellarddone
9157d13299dSbellard
91640293e58Sbellardcase "$cpu" in
9179b9c37c3SRichard Henderson    sparc)
9180c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
9199b9c37c3SRichard Henderson           QEMU_CFLAGS="-m32 -mcpu=ultrasparc $QEMU_CFLAGS"
9203142255cSblueswir1           ;;
921ed968ff1SJuan Quintela    sparc64)
9220c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
9239b9c37c3SRichard Henderson           QEMU_CFLAGS="-m64 -mcpu=ultrasparc $QEMU_CFLAGS"
9243142255cSblueswir1           ;;
92576d83bdeSths    s390)
92628d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
92728d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
92828d7cc49SRichard Henderson           ;;
92928d7cc49SRichard Henderson    s390x)
93028d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
93128d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
93276d83bdeSths           ;;
93340293e58Sbellard    i386)
934a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
9350c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
9362b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
93740293e58Sbellard           ;;
93840293e58Sbellard    x86_64)
939a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
9400c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
9412b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
942379f6698SPaul Brook           ;;
94330163d89SPeter Maydell    # No special flags required for other host CPUs
9443142255cSblueswir1esac
9453142255cSblueswir1
94660e0df25SPeter Maydelldefault_target_list=""
94760e0df25SPeter Maydell
94860e0df25SPeter Maydell# these targets are portable
94960e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then
95060e0df25SPeter Maydell    default_target_list="\
95160e0df25SPeter Maydelli386-softmmu \
95260e0df25SPeter Maydellx86_64-softmmu \
95327cdad67SRichard Hendersonalpha-softmmu \
95460e0df25SPeter Maydellarm-softmmu \
95560e0df25SPeter Maydellcris-softmmu \
95660e0df25SPeter Maydelllm32-softmmu \
95760e0df25SPeter Maydellm68k-softmmu \
95860e0df25SPeter Maydellmicroblaze-softmmu \
95960e0df25SPeter Maydellmicroblazeel-softmmu \
96060e0df25SPeter Maydellmips-softmmu \
96160e0df25SPeter Maydellmipsel-softmmu \
96260e0df25SPeter Maydellmips64-softmmu \
96360e0df25SPeter Maydellmips64el-softmmu \
964e67db06eSJia Liuor32-softmmu \
96560e0df25SPeter Maydellppc-softmmu \
96660e0df25SPeter Maydellppcemb-softmmu \
96760e0df25SPeter Maydellppc64-softmmu \
96860e0df25SPeter Maydellsh4-softmmu \
96960e0df25SPeter Maydellsh4eb-softmmu \
97060e0df25SPeter Maydellsparc-softmmu \
97160e0df25SPeter Maydellsparc64-softmmu \
9720f3301d4SAlexander Grafs390x-softmmu \
973cfa550c6SMax Filippovxtensa-softmmu \
974cfa550c6SMax Filippovxtensaeb-softmmu \
9754f23a1e6SGuan Xuetaounicore32-softmmu \
97660e0df25SPeter Maydell"
97760e0df25SPeter Maydellfi
97860e0df25SPeter Maydell# the following are Linux specific
97960e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then
98060e0df25SPeter Maydell    default_target_list="${default_target_list}\
98160e0df25SPeter Maydelli386-linux-user \
98260e0df25SPeter Maydellx86_64-linux-user \
98360e0df25SPeter Maydellalpha-linux-user \
98460e0df25SPeter Maydellarm-linux-user \
98560e0df25SPeter Maydellarmeb-linux-user \
98660e0df25SPeter Maydellcris-linux-user \
98760e0df25SPeter Maydellm68k-linux-user \
98860e0df25SPeter Maydellmicroblaze-linux-user \
98960e0df25SPeter Maydellmicroblazeel-linux-user \
99060e0df25SPeter Maydellmips-linux-user \
99160e0df25SPeter Maydellmipsel-linux-user \
99251cd14d3SRichard Hendersonmips64-linux-user \
99351cd14d3SRichard Hendersonmips64el-linux-user \
99451cd14d3SRichard Hendersonmipsn32-linux-user \
99551cd14d3SRichard Hendersonmipsn32el-linux-user \
996d962783eSJia Liuor32-linux-user \
99760e0df25SPeter Maydellppc-linux-user \
99860e0df25SPeter Maydellppc64-linux-user \
99960e0df25SPeter Maydellppc64abi32-linux-user \
100060e0df25SPeter Maydellsh4-linux-user \
100160e0df25SPeter Maydellsh4eb-linux-user \
100260e0df25SPeter Maydellsparc-linux-user \
100360e0df25SPeter Maydellsparc64-linux-user \
100460e0df25SPeter Maydellsparc32plus-linux-user \
100560e0df25SPeter Maydellunicore32-linux-user \
10060f3301d4SAlexander Grafs390x-linux-user \
100760e0df25SPeter Maydell"
100860e0df25SPeter Maydellfi
100960e0df25SPeter Maydell# the following are BSD specific
101060e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then
101160e0df25SPeter Maydell    default_target_list="${default_target_list}\
101260e0df25SPeter Maydelli386-bsd-user \
101360e0df25SPeter Maydellx86_64-bsd-user \
101460e0df25SPeter Maydellsparc-bsd-user \
101560e0df25SPeter Maydellsparc64-bsd-user \
101660e0df25SPeter Maydell"
101760e0df25SPeter Maydellfi
101860e0df25SPeter Maydell
1019af5db58eSpbrookif test x"$show_help" = x"yes" ; then
1020af5db58eSpbrookcat << EOF
1021af5db58eSpbrook
1022af5db58eSpbrookUsage: configure [options]
1023af5db58eSpbrookOptions: [defaults in brackets after descriptions]
1024af5db58eSpbrook
1025af5db58eSpbrookEOF
1026af5db58eSpbrookecho "Standard options:"
1027af5db58eSpbrookecho "  --help                   print this message"
1028af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
1029af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
1030af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
103160e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
103260e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
103360e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
1034af5db58eSpbrookecho ""
1035af5db58eSpbrookecho "Advanced options (experts only):"
1036af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
1037af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
1038af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
10390bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
10400bfe8cc0SPaolo Bonziniecho "                           build time"
10413c4a4d0dSPeter Maydellecho "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
1042a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
1043e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
1044af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
10456a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
1046c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
1047e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
1048af5db58eSpbrookecho "  --static                 enable static build [$static]"
10490b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
1050023d3d67SEduardo Habkostecho "  --datadir=PATH           install firmware in PATH$confsuffix"
1051023d3d67SEduardo Habkostecho "  --docdir=PATH            install documentation in PATH$confsuffix"
10520b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
1053023d3d67SEduardo Habkostecho "  --sysconfdir=PATH        install config in PATH$confsuffix"
1054785c23aeSLuiz Capitulinoecho "  --localstatedir=PATH     install local state in PATH"
10552ae4748fSStefan Weilecho "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1056f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1057f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
105809695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1059890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1060890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
10611625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
106285aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1063fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1064c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1065ab400449SHu Taoecho "  --disable-gtk            disable gtk UI"
1066ab400449SHu Taoecho "  --enable-gtk             enable gtk UI"
1067983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1068983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1069821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1070821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
107114821030SPavel Borzenkovecho "  --disable-cocoa          disable Cocoa (Mac OS X only)"
107214821030SPavel Borzenkovecho "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
1073c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1074c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
10754c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
10764c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
1077eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
1078eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
10798ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
1080e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1081fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
1082eb6fda0fSAnthony PERARDecho "  --disable-xen-pci-passthrough"
1083eb6fda0fSAnthony PERARDecho "  --enable-xen-pci-passthrough"
10842e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
10854ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
10868d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
10871be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
10882f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1089ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
10902f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
10912f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
109296763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1093efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
10947536ee4bSTim Hardeckecho "  --disable-vnc-ws         disable Websockets support for VNC server"
10957536ee4bSTim Hardeckecho "  --enable-vnc-ws          enable Websockets support for VNC server"
1096af896aaaSpbrookecho "  --disable-curses         disable curses output"
1097c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1098769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1099788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
11002df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
11012df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1102fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1103a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
11046093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
11057ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1106b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
11079195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1108bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
1109e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
1110af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1111af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
11120953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
11130953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1114831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1115831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
111684778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
111784778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1118379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1119379f6698SPaul Brookecho "                           emulation targets"
1120379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
112140d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
112240d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1123af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1124af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
11252f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1126c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1127235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
1128ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1129ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1130e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1131dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
11325c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
11335c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
113447e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
113547e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1136758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1137758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
113877755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1139d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1140d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1141d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1142d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1143320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1144650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
114574242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
11469410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1147cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1148cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1149f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1150c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1151c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
1152111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1153111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
115469354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
115569354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1156d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1157d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1158f794573eSEduardo Otuboecho "  --disable-seccomp        disable seccomp support"
1159f794573eSEduardo Otuboecho "  --enable-seccomp         enables seccomp support"
1160519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1161fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
1162eb100396SBharata B Raoecho "  --enable-glusterfs       enable GlusterFS backend"
1163eb100396SBharata B Raoecho "  --disable-glusterfs      disable GlusterFS backend"
11641d728c39SBlue Swirlecho "  --enable-gcov            enable test coverage analysis with gcov"
11651d728c39SBlue Swirlecho "  --gcov=GCOV              use specified gcov [$gcov_tool]"
1166ab214c29SStefan Bergerecho "  --enable-tpm             enable TPM support"
1167af5db58eSpbrookecho ""
11685bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1169af5db58eSpbrookexit 1
1170af5db58eSpbrookfi
1171af5db58eSpbrook
1172359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1173359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1174359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1175359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1176359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1177359bc95dSPeter Maydell        ARCH=tci
1178359bc95dSPeter Maydell    else
1179359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1180359bc95dSPeter Maydell        exit 1
1181359bc95dSPeter Maydell    fi
1182359bc95dSPeter Maydellfi
1183359bc95dSPeter Maydell
11848d05095cSPaolo Bonzini# check that the C compiler works.
11858d05095cSPaolo Bonzinicat > $TMPC <<EOF
118675cafad7SStefan Weilint main(void) { return 0; }
11878d05095cSPaolo BonziniEOF
11888d05095cSPaolo Bonzini
11898d05095cSPaolo Bonziniif compile_object ; then
11908d05095cSPaolo Bonzini  : C compiler works ok
11918d05095cSPaolo Bonzinielse
11928d05095cSPaolo Bonzini    echo "ERROR: \"$cc\" either does not exist or does not work"
11938d05095cSPaolo Bonzini    exit 1
11948d05095cSPaolo Bonzinifi
11958d05095cSPaolo Bonzini
1196417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror
1197417c9d72SAlexander Graf# by default.  Only enable by default for git builds
1198417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION`
1199417c9d72SAlexander Graf
1200417c9d72SAlexander Grafif test -z "$werror" ; then
12016c8fec83SAndreas Färber    if test -d "$source_path/.git" -a \
1202417c9d72SAlexander Graf        "$linux" = "yes" ; then
1203417c9d72SAlexander Graf        werror="yes"
1204417c9d72SAlexander Graf    else
1205417c9d72SAlexander Graf        werror="no"
1206417c9d72SAlexander Graf    fi
1207417c9d72SAlexander Graffi
1208417c9d72SAlexander Graf
12098d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
12108d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
12118d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1212f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
1213c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags"
12146ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would
12156ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due
12166ca026cbSPeter Maydell# to -Werror this would just silently disable some features,
12176ca026cbSPeter Maydell# so it's too error prone.
12188d05095cSPaolo Bonzinicat > $TMPC << EOF
12198d05095cSPaolo Bonziniint main(void) { return 0; }
12208d05095cSPaolo BonziniEOF
12218d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1222a1d29d6cSPeter Maydell    # Use the positive sense of the flag when testing for -Wno-wombat
1223a1d29d6cSPeter Maydell    # support (gcc will happily accept the -Wno- form of unknown
1224a1d29d6cSPeter Maydell    # warning options).
1225a1d29d6cSPeter Maydell    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1226a1d29d6cSPeter Maydell    if compile_prog "-Werror $optflag" "" ; then
12278d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
12288d05095cSPaolo Bonzini    fi
12298d05095cSPaolo Bonzinidone
12308d05095cSPaolo Bonzini
1231cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1232cbdd1999SPaolo Bonzini# large functions that use global variables.  The bug is in all releases of
1233cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1234cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1235cbdd1999SPaolo Bonzinicat > $TMPC << EOF
1236cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1237cbdd1999SPaolo Bonziniint main(void) { return 0; }
1238cbdd1999SPaolo Bonzini#else
1239cbdd1999SPaolo Bonzini#error No bug in this compiler.
1240cbdd1999SPaolo Bonzini#endif
1241cbdd1999SPaolo BonziniEOF
1242cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then
1243cbdd1999SPaolo Bonzini  TRANSLATE_OPT_CFLAGS=-fno-gcse
1244cbdd1999SPaolo Bonzinifi
1245cbdd1999SPaolo Bonzini
124640d6444eSAvi Kivityif test "$static" = "yes" ; then
124740d6444eSAvi Kivity  if test "$pie" = "yes" ; then
124840d6444eSAvi Kivity    echo "static and pie are mutually incompatible"
124940d6444eSAvi Kivity    exit 1
125040d6444eSAvi Kivity  else
125140d6444eSAvi Kivity    pie="no"
125240d6444eSAvi Kivity  fi
125340d6444eSAvi Kivityfi
125440d6444eSAvi Kivity
125540d6444eSAvi Kivityif test "$pie" = ""; then
125640d6444eSAvi Kivity  case "$cpu-$targetos" in
1257f9db31a2SBrad    i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
125840d6444eSAvi Kivity      ;;
125940d6444eSAvi Kivity    *)
126040d6444eSAvi Kivity      pie="no"
126140d6444eSAvi Kivity      ;;
126240d6444eSAvi Kivity  esac
126340d6444eSAvi Kivityfi
126440d6444eSAvi Kivity
126540d6444eSAvi Kivityif test "$pie" != "no" ; then
126640d6444eSAvi Kivity  cat > $TMPC << EOF
126721d4a791SAvi Kivity
126821d4a791SAvi Kivity#ifdef __linux__
126921d4a791SAvi Kivity#  define THREAD __thread
127021d4a791SAvi Kivity#else
127121d4a791SAvi Kivity#  define THREAD
127221d4a791SAvi Kivity#endif
127321d4a791SAvi Kivity
127421d4a791SAvi Kivitystatic THREAD int tls_var;
127521d4a791SAvi Kivity
127621d4a791SAvi Kivityint main(void) { return tls_var; }
127721d4a791SAvi Kivity
127840d6444eSAvi KivityEOF
127940d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
128040d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
128140d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
128240d6444eSAvi Kivity    pie="yes"
128340d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
128440d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
128540d6444eSAvi Kivity    fi
128640d6444eSAvi Kivity  else
128740d6444eSAvi Kivity    if test "$pie" = "yes"; then
128840d6444eSAvi Kivity      echo "PIE not available due to missing toolchain support"
128940d6444eSAvi Kivity      exit 1
129040d6444eSAvi Kivity    else
129140d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
129240d6444eSAvi Kivity      pie="no"
129340d6444eSAvi Kivity    fi
129440d6444eSAvi Kivity  fi
129540d6444eSAvi Kivityfi
129640d6444eSAvi Kivity
1297ec530c81Sbellard#
1298ec530c81Sbellard# Solaris specific configure tool chain decisions
1299ec530c81Sbellard#
1300ec530c81Sbellardif test "$solaris" = "yes" ; then
13016792aa11SLoïc Minier  if has $install; then
13026792aa11SLoïc Minier    :
13036792aa11SLoïc Minier  else
1304ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1305ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1306ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1307ec530c81Sbellard    exit 1
1308ec530c81Sbellard  fi
13096792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
1310ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1311ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1312ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1313ec530c81Sbellard    exit 1
1314ec530c81Sbellard  fi
13156792aa11SLoïc Minier  if has ar; then
13166792aa11SLoïc Minier    :
13176792aa11SLoïc Minier  else
1318ec530c81Sbellard    echo "Error: No path includes ar"
1319ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
1320ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
1321ec530c81Sbellard    fi
1322ec530c81Sbellard    exit 1
1323ec530c81Sbellard  fi
1324ec530c81Sbellardfi
1325ec530c81Sbellard
13267a3fc891SSebastian Herbsztif ! has $python; then
1327c886edfbSBlue Swirl  echo "Python not found. Use --python=/path/to/python"
1328c886edfbSBlue Swirl  exit 1
1329c886edfbSBlue Swirlfi
1330c886edfbSBlue Swirl
13316ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
13326ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
1333e120d449SStefan Hajnocziif ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1334e120d449SStefan Hajnoczi  echo "Cannot use '$python', Python 2.4 or later is required."
1335e120d449SStefan Hajnoczi  echo "Note that Python 3 or later is not yet supported."
1336e120d449SStefan Hajnoczi  echo "Use --python=/path/to/python to specify a supported Python."
13376ccea1e4SPeter Maydell  exit 1
13386ccea1e4SPeter Maydellfi
13396ccea1e4SPeter Maydell
1340afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then
1341121afa9eSAnthony Liguori    target_list="$default_target_list"
1342121afa9eSAnthony Liguorielse
1343121afa9eSAnthony Liguori    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
13445327cf48Sbellardfi
1345f55fe278SPaolo Bonzini# see if system emulation was really requested
1346f55fe278SPaolo Bonzinicase " $target_list " in
1347f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1348f55fe278SPaolo Bonzini  ;;
1349f55fe278SPaolo Bonzini  *) softmmu=no
1350f55fe278SPaolo Bonzini  ;;
1351f55fe278SPaolo Bonziniesac
13525327cf48Sbellard
1353249247c9SJuan Quintelafeature_not_found() {
1354249247c9SJuan Quintela  feature=$1
1355249247c9SJuan Quintela
1356249247c9SJuan Quintela  echo "ERROR"
1357249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
13589332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1359249247c9SJuan Quintela  echo "ERROR"
1360249247c9SJuan Quintela  exit 1;
1361249247c9SJuan Quintela}
1362249247c9SJuan Quintela
13637d13299dSbellardif test -z "$cross_prefix" ; then
13647d13299dSbellard
13657d13299dSbellard# ---
13667d13299dSbellard# big/little endian test
13677d13299dSbellardcat > $TMPC << EOF
13687d13299dSbellard#include <inttypes.h>
1369abab1a0fSStefan Weilint main(void) {
13707d13299dSbellard        volatile uint32_t i=0x01234567;
13717d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
13727d13299dSbellard}
13737d13299dSbellardEOF
13747d13299dSbellard
137552166aa0SJuan Quintelaif compile_prog "" "" ; then
13767d13299dSbellard$TMPE && bigendian="yes"
13777d13299dSbellardelse
13787d13299dSbellardecho big/little test failed
13797d13299dSbellardfi
13807d13299dSbellard
13817d13299dSbellardelse
13827d13299dSbellard
13837d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1384ea8f20f8SJuan Quintelacase "$cpu" in
138521d89f84SPeter Maydell  arm)
138621d89f84SPeter Maydell    # ARM can be either way; ask the compiler which one we are
138721d89f84SPeter Maydell    if check_define __ARMEB__; then
138821d89f84SPeter Maydell      bigendian=yes
138921d89f84SPeter Maydell    fi
139021d89f84SPeter Maydell  ;;
139121d89f84SPeter Maydell  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1392ea8f20f8SJuan Quintela    bigendian=yes
1393ea8f20f8SJuan Quintela  ;;
1394ea8f20f8SJuan Quintelaesac
13957d13299dSbellard
13967d13299dSbellardfi
13977d13299dSbellard
1398b0a47e79SJuan Quintela##########################################
1399779ab5e3SStefan Weil# pkg-config probe
1400779ab5e3SStefan Weil
1401779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then
1402779ab5e3SStefan Weil  echo "Error: pkg-config binary '$pkg_config_exe' not found"
1403779ab5e3SStefan Weil  exit 1
1404779ab5e3SStefan Weilfi
1405779ab5e3SStefan Weil
1406779ab5e3SStefan Weil##########################################
1407b0a47e79SJuan Quintela# NPTL probe
1408b0a47e79SJuan Quintela
1409b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1410bd0c5661Spbrook  cat > $TMPC <<EOF
1411bd0c5661Spbrook#include <sched.h>
141230813ceaSpbrook#include <linux/futex.h>
1413182eacc0SStefan Weilint main(void) {
1414bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1415bd0c5661Spbrook#error bork
1416bd0c5661Spbrook#endif
1417182eacc0SStefan Weil  return 0;
1418bd0c5661Spbrook}
1419bd0c5661SpbrookEOF
1420bd0c5661Spbrook
142152166aa0SJuan Quintela  if compile_object ; then
1422b0a47e79SJuan Quintela    nptl=yes
1423bd0c5661Spbrook  else
1424b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1425b0a47e79SJuan Quintela      feature_not_found "nptl"
1426b0a47e79SJuan Quintela    fi
1427b0a47e79SJuan Quintela    nptl=no
1428b0a47e79SJuan Quintela  fi
1429bd0c5661Spbrookfi
1430bd0c5661Spbrook
143111d9f695Sbellard##########################################
1432ac62922eSbalrog# zlib check
1433ac62922eSbalrog
14341ece9905SAlon Levyif test "$zlib" != "no" ; then
1435ac62922eSbalrog    cat > $TMPC << EOF
1436ac62922eSbalrog#include <zlib.h>
1437ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1438ac62922eSbalrogEOF
143952166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1440ac62922eSbalrog        :
1441ac62922eSbalrog    else
1442ac62922eSbalrog        echo
1443ac62922eSbalrog        echo "Error: zlib check failed"
1444ac62922eSbalrog        echo "Make sure to have the zlib libs and headers installed."
1445ac62922eSbalrog        echo
1446ac62922eSbalrog        exit 1
1447ac62922eSbalrog    fi
14481ece9905SAlon Levyfi
1449ac62922eSbalrog
1450ac62922eSbalrog##########################################
1451f794573eSEduardo Otubo# libseccomp check
1452f794573eSEduardo Otubo
1453f794573eSEduardo Otuboif test "$seccomp" != "no" ; then
14542c5c4451SBlue Swirl    if $pkg_config --atleast-version=1.0.0 libseccomp --modversion >/dev/null 2>&1; then
1455b4451996SMichael Tokarev        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1456f794573eSEduardo Otubo	seccomp="yes"
1457f794573eSEduardo Otubo    else
1458f794573eSEduardo Otubo	if test "$seccomp" = "yes"; then
1459f794573eSEduardo Otubo            feature_not_found "libseccomp"
1460f794573eSEduardo Otubo	fi
1461e84d5956SYann E. MORIN	seccomp="no"
1462f794573eSEduardo Otubo    fi
1463f794573eSEduardo Otubofi
1464f794573eSEduardo Otubo##########################################
1465e37630caSaliguori# xen probe
1466e37630caSaliguori
1467fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1468b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1469d5b93ddfSAnthony PERARD
147050ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
147150ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
147250ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
147350ced5b3SStefan Weil
147450ced5b3SStefan Weil  # Xen (any)
147550ced5b3SStefan Weil  cat > $TMPC <<EOF
147650ced5b3SStefan Weil#include <xenctrl.h>
147750ced5b3SStefan Weilint main(void) {
147850ced5b3SStefan Weil  return 0;
147950ced5b3SStefan Weil}
148050ced5b3SStefan WeilEOF
148150ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
148250ced5b3SStefan Weil    # Xen not found
148350ced5b3SStefan Weil    if test "$xen" = "yes" ; then
148450ced5b3SStefan Weil      feature_not_found "xen"
148550ced5b3SStefan Weil    fi
148650ced5b3SStefan Weil    xen=no
148750ced5b3SStefan Weil
1488d5b93ddfSAnthony PERARD  # Xen unstable
148969deef08SPeter Maydell  elif
149069deef08SPeter Maydell      cat > $TMPC <<EOF &&
1491e37630caSaliguori#include <xenctrl.h>
1492e108a3c1SAnthony PERARD#include <xenstore.h>
1493d5b93ddfSAnthony PERARD#include <stdint.h>
1494d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1495d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1496d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1497d5b93ddfSAnthony PERARD#endif
1498d5b93ddfSAnthony PERARDint main(void) {
1499d5b93ddfSAnthony PERARD  xc_interface *xc;
1500d5b93ddfSAnthony PERARD  xs_daemon_open();
1501d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1502d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1503d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1504b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
15058688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
15068688e065SStefano Stabellini  return 0;
15078688e065SStefano Stabellini}
15088688e065SStefano StabelliniEOF
15098688e065SStefano Stabellini      compile_prog "" "$xen_libs"
151069deef08SPeter Maydell    then
15118688e065SStefano Stabellini    xen_ctrl_version=420
15128688e065SStefano Stabellini    xen=yes
15138688e065SStefano Stabellini
151469deef08SPeter Maydell  elif
151569deef08SPeter Maydell      cat > $TMPC <<EOF &&
15168688e065SStefano Stabellini#include <xenctrl.h>
15178688e065SStefano Stabellini#include <xs.h>
15188688e065SStefano Stabellini#include <stdint.h>
15198688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
15208688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
15218688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
15228688e065SStefano Stabellini#endif
15238688e065SStefano Stabelliniint main(void) {
15248688e065SStefano Stabellini  xs_daemon_open();
15259b4c0b56SPeter Maydell  xc_interface_open(0, 0, 0);
15268688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
15278688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
15288688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1529d5b93ddfSAnthony PERARD  return 0;
1530d5b93ddfSAnthony PERARD}
1531e37630caSaliguoriEOF
153250ced5b3SStefan Weil      compile_prog "" "$xen_libs"
153369deef08SPeter Maydell    then
1534d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1535fc321b4bSJuan Quintela    xen=yes
1536d5b93ddfSAnthony PERARD
1537d5b93ddfSAnthony PERARD  # Xen 4.0.0
153869deef08SPeter Maydell  elif
153969deef08SPeter Maydell      cat > $TMPC <<EOF &&
1540d5b93ddfSAnthony PERARD#include <xenctrl.h>
1541d5b93ddfSAnthony PERARD#include <xs.h>
1542d5b93ddfSAnthony PERARD#include <stdint.h>
1543d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1544d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1545d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1546d5b93ddfSAnthony PERARD#endif
1547d5b93ddfSAnthony PERARDint main(void) {
1548b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1549b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1550b87de24eSAnthony PERARD  };
1551d5b93ddfSAnthony PERARD  xs_daemon_open();
1552d5b93ddfSAnthony PERARD  xc_interface_open();
1553d5b93ddfSAnthony PERARD  xc_gnttab_open();
1554d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1555b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1556d5b93ddfSAnthony PERARD  return 0;
1557d5b93ddfSAnthony PERARD}
1558d5b93ddfSAnthony PERARDEOF
1559d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
156069deef08SPeter Maydell    then
1561d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1562d5b93ddfSAnthony PERARD    xen=yes
1563d5b93ddfSAnthony PERARD
1564b87de24eSAnthony PERARD  # Xen 3.4.0
156569deef08SPeter Maydell  elif
156669deef08SPeter Maydell      cat > $TMPC <<EOF &&
1567b87de24eSAnthony PERARD#include <xenctrl.h>
1568b87de24eSAnthony PERARD#include <xs.h>
1569b87de24eSAnthony PERARDint main(void) {
1570b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1571b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1572b87de24eSAnthony PERARD  };
1573b87de24eSAnthony PERARD  xs_daemon_open();
1574b87de24eSAnthony PERARD  xc_interface_open();
1575b87de24eSAnthony PERARD  xc_gnttab_open();
1576b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1577b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1578b87de24eSAnthony PERARD  return 0;
1579b87de24eSAnthony PERARD}
1580b87de24eSAnthony PERARDEOF
1581b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
158269deef08SPeter Maydell    then
1583b87de24eSAnthony PERARD    xen_ctrl_version=340
1584b87de24eSAnthony PERARD    xen=yes
1585b87de24eSAnthony PERARD
1586b87de24eSAnthony PERARD  # Xen 3.3.0
158769deef08SPeter Maydell  elif
158869deef08SPeter Maydell      cat > $TMPC <<EOF &&
1589d5b93ddfSAnthony PERARD#include <xenctrl.h>
1590d5b93ddfSAnthony PERARD#include <xs.h>
1591d5b93ddfSAnthony PERARDint main(void) {
1592d5b93ddfSAnthony PERARD  xs_daemon_open();
1593d5b93ddfSAnthony PERARD  xc_interface_open();
1594d5b93ddfSAnthony PERARD  xc_gnttab_open();
1595d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1596d5b93ddfSAnthony PERARD  return 0;
1597d5b93ddfSAnthony PERARD}
1598d5b93ddfSAnthony PERARDEOF
1599d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
160069deef08SPeter Maydell    then
1601d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1602d5b93ddfSAnthony PERARD    xen=yes
1603d5b93ddfSAnthony PERARD
160450ced5b3SStefan Weil  # Xen version unsupported
1605e37630caSaliguori  else
1606fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
160750ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1608fc321b4bSJuan Quintela    fi
1609fc321b4bSJuan Quintela    xen=no
1610e37630caSaliguori  fi
1611d5b93ddfSAnthony PERARD
1612d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1613d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1614d5b93ddfSAnthony PERARD  fi
1615e37630caSaliguorifi
1616e37630caSaliguori
1617eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1618eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1619eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1620eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1621eb6fda0fSAnthony PERARD  else
1622eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1623eb6fda0fSAnthony PERARD      echo "ERROR"
1624eb6fda0fSAnthony PERARD      echo "ERROR: User requested feature Xen PCI Passthrough"
1625eb6fda0fSAnthony PERARD      echo "ERROR: but this feature require /sys from Linux"
1626eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
1627eb6fda0fSAnthony PERARD        echo "ERROR: This feature does not work with Xen 3.3"
1628eb6fda0fSAnthony PERARD      fi
1629eb6fda0fSAnthony PERARD      echo "ERROR"
1630eb6fda0fSAnthony PERARD      exit 1;
1631eb6fda0fSAnthony PERARD    fi
1632eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1633eb6fda0fSAnthony PERARD  fi
1634eb6fda0fSAnthony PERARDfi
1635eb6fda0fSAnthony PERARD
1636e37630caSaliguori##########################################
163744dc0ca3SAlon Levy# libtool probe
163844dc0ca3SAlon Levy
16393f534581SBradif ! has $libtool; then
164044dc0ca3SAlon Levy    libtool=
164144dc0ca3SAlon Levyfi
164244dc0ca3SAlon Levy
164344dc0ca3SAlon Levy##########################################
1644dfffc653SJuan Quintela# Sparse probe
1645dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
16460dba6195SLoïc Minier  if has cgcc; then
1647dfffc653SJuan Quintela    sparse=yes
1648dfffc653SJuan Quintela  else
1649dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1650dfffc653SJuan Quintela      feature_not_found "sparse"
1651dfffc653SJuan Quintela    fi
1652dfffc653SJuan Quintela    sparse=no
1653dfffc653SJuan Quintela  fi
1654dfffc653SJuan Quintelafi
1655dfffc653SJuan Quintela
1656dfffc653SJuan Quintela##########################################
1657a4ccabcfSAnthony Liguori# GTK probe
1658a4ccabcfSAnthony Liguori
1659a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then
1660528de90aSDaniel P. Berrange    gtkpackage="gtk+-$gtkabi"
1661528de90aSDaniel P. Berrange    if test "$gtkabi" = "3.0" ; then
1662528de90aSDaniel P. Berrange      gtkversion="3.0.0"
1663528de90aSDaniel P. Berrange      vtepackage="vte-2.90"
1664528de90aSDaniel P. Berrange      vteversion="0.32.0"
1665528de90aSDaniel P. Berrange    else
1666528de90aSDaniel P. Berrange      gtkversion="2.18.0"
1667528de90aSDaniel P. Berrange      vtepackage="vte"
1668528de90aSDaniel P. Berrange      vteversion="0.24.0"
1669528de90aSDaniel P. Berrange    fi
1670528de90aSDaniel P. Berrange    if $pkg_config --exists "$gtkpackage >= $gtkversion" && \
1671528de90aSDaniel P. Berrange       $pkg_config --exists "$vtepackage >= $vteversion"; then
1672528de90aSDaniel P. Berrange	gtk_cflags=`$pkg_config --cflags $gtkpackage 2>/dev/null`
1673528de90aSDaniel P. Berrange	gtk_libs=`$pkg_config --libs $gtkpackage 2>/dev/null`
1674528de90aSDaniel P. Berrange	vte_cflags=`$pkg_config --cflags $vtepackage 2>/dev/null`
1675528de90aSDaniel P. Berrange	vte_libs=`$pkg_config --libs $vtepackage 2>/dev/null`
1676a4ccabcfSAnthony Liguori	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1677a4ccabcfSAnthony Liguori	gtk="yes"
1678a4ccabcfSAnthony Liguori    else
1679a4ccabcfSAnthony Liguori	if test "$gtk" = "yes" ; then
1680a4ccabcfSAnthony Liguori	    feature_not_found "gtk"
1681a4ccabcfSAnthony Liguori	fi
1682a4ccabcfSAnthony Liguori	gtk="no"
1683a4ccabcfSAnthony Liguori    fi
1684a4ccabcfSAnthony Liguorifi
1685a4ccabcfSAnthony Liguori
1686a4ccabcfSAnthony Liguori##########################################
168711d9f695Sbellard# SDL probe
168811d9f695Sbellard
16893ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
16903ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
16913ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
16923ec87ffeSPaolo Bonzini  sdl_config=sdl-config
16933ec87ffeSPaolo Bonzinifi
16943ec87ffeSPaolo Bonzini
16953ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1696a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1697fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
16983ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
16993ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
17009316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1701a0dfd8a4SLoïc Minierelse
1702a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1703a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1704a0dfd8a4SLoïc Minier  fi
1705a0dfd8a4SLoïc Minier  sdl=no
17069316f803SPaolo Bonzinifi
170729e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
17083ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
17093ec87ffeSPaolo Bonzinifi
171011d9f695Sbellard
17119316f803SPaolo Bonzinisdl_too_old=no
1712c4198157SJuan Quintelaif test "$sdl" != "no" ; then
171311d9f695Sbellard  cat > $TMPC << EOF
171411d9f695Sbellard#include <SDL.h>
171511d9f695Sbellard#undef main /* We don't want SDL to override our main() */
171611d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
171711d9f695SbellardEOF
17189316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
171974f42e18STeLeMan  if test "$static" = "yes" ; then
172074f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
172174f42e18STeLeMan  else
17229316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
172374f42e18STeLeMan  fi
172452166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
172511d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
172611d9f695Sbellard      sdl_too_old=yes
172711d9f695Sbellard    else
1728fd677642Sths      if test "$cocoa" = "no" ; then
172911d9f695Sbellard        sdl=yes
173011d9f695Sbellard      fi
1731fd677642Sths    fi
17327c1f25b4Sbellard
173367c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
17341ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
173567c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1736f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1737f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
173811d9f695Sbellard      fi
173952166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
17401ac88f28SJuan Quintela	:
17411ac88f28SJuan Quintela      else
17421ac88f28SJuan Quintela        sdl=no
17437c1f25b4Sbellard      fi
17447c1f25b4Sbellard    fi # static link
1745c4198157SJuan Quintela  else # sdl not found
1746c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1747c4198157SJuan Quintela      feature_not_found "sdl"
1748c4198157SJuan Quintela    fi
1749c4198157SJuan Quintela    sdl=no
17507c1f25b4Sbellard  fi # sdl compile test
1751fd677642Sthsfi
175211d9f695Sbellard
17535368a422Saliguoriif test "$sdl" = "yes" ; then
17545368a422Saliguori  cat > $TMPC <<EOF
17555368a422Saliguori#include <SDL.h>
17565368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
17575368a422Saliguori#include <X11/XKBlib.h>
17585368a422Saliguori#else
17595368a422Saliguori#error No x11 support
17605368a422Saliguori#endif
17615368a422Saliguoriint main(void) { return 0; }
17625368a422SaliguoriEOF
176352166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1764681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
17655368a422Saliguori  fi
17660705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
17675368a422Saliguorifi
17685368a422Saliguori
17698f28f3fbSths##########################################
17707536ee4bSTim Hardeck# VNC TLS/WS detection
17717536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
1772ae6b5e5aSaliguori  cat > $TMPC <<EOF
1773ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1774ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1775ae6b5e5aSaliguoriEOF
1776a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1777a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
177852166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
17797536ee4bSTim Hardeck    if test "$vnc_tls" != "no" ; then
17801be10ad2SJuan Quintela      vnc_tls=yes
17817536ee4bSTim Hardeck    fi
17827536ee4bSTim Hardeck    if test "$vnc_ws" != "no" ; then
17837536ee4bSTim Hardeck      vnc_ws=yes
17847536ee4bSTim Hardeck    fi
1785a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1786ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
1787ae6b5e5aSaliguori  else
17881be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
17891be10ad2SJuan Quintela      feature_not_found "vnc-tls"
17901be10ad2SJuan Quintela    fi
17917536ee4bSTim Hardeck    if test "$vnc_ws" = "yes" ; then
17927536ee4bSTim Hardeck      feature_not_found "vnc-ws"
17937536ee4bSTim Hardeck    fi
17941be10ad2SJuan Quintela    vnc_tls=no
17957536ee4bSTim Hardeck    vnc_ws=no
17968d5d2d4cSths  fi
17978d5d2d4cSthsfi
17988d5d2d4cSths
17998d5d2d4cSths##########################################
18002f9606b3Saliguori# VNC SASL detection
1801821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
18022f9606b3Saliguori  cat > $TMPC <<EOF
18032f9606b3Saliguori#include <sasl/sasl.h>
18042f9606b3Saliguori#include <stdio.h>
18052f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
18062f9606b3SaliguoriEOF
18072f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
18082f9606b3Saliguori  vnc_sasl_cflags=""
18092f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
181052166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1811ea784e3bSJuan Quintela    vnc_sasl=yes
1812fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1813ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
18142f9606b3Saliguori  else
1815ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1816ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1817ea784e3bSJuan Quintela    fi
1818ea784e3bSJuan Quintela    vnc_sasl=no
18192f9606b3Saliguori  fi
18202f9606b3Saliguorifi
18212f9606b3Saliguori
18222f9606b3Saliguori##########################################
18232f6f5c7aSCorentin Chary# VNC JPEG detection
1824821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
18252f6f5c7aSCorentin Charycat > $TMPC <<EOF
18262f6f5c7aSCorentin Chary#include <stdio.h>
18272f6f5c7aSCorentin Chary#include <jpeglib.h>
18282f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
18292f6f5c7aSCorentin CharyEOF
18302f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
18312f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
18322f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
18332f6f5c7aSCorentin Chary    vnc_jpeg=yes
18342f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1835ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
18362f6f5c7aSCorentin Chary  else
18372f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
18382f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
18392f6f5c7aSCorentin Chary    fi
18402f6f5c7aSCorentin Chary    vnc_jpeg=no
18412f6f5c7aSCorentin Chary  fi
18422f6f5c7aSCorentin Charyfi
18432f6f5c7aSCorentin Chary
18442f6f5c7aSCorentin Chary##########################################
1845efe556adSCorentin Chary# VNC PNG detection
1846821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1847efe556adSCorentin Charycat > $TMPC <<EOF
1848efe556adSCorentin Chary//#include <stdio.h>
1849efe556adSCorentin Chary#include <png.h>
1850832ce9c2SScott Wood#include <stddef.h>
1851efe556adSCorentin Charyint main(void) {
1852efe556adSCorentin Chary    png_structp png_ptr;
1853efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
18547edc3fedSPeter Maydell    return png_ptr != 0;
1855efe556adSCorentin Chary}
1856efe556adSCorentin CharyEOF
18579af8025eSBrad  if $pkg_config libpng --modversion >/dev/null 2>&1; then
18589af8025eSBrad    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
18599af8025eSBrad    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
18609af8025eSBrad  else
1861efe556adSCorentin Chary    vnc_png_cflags=""
1862efe556adSCorentin Chary    vnc_png_libs="-lpng"
18639af8025eSBrad  fi
1864efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1865efe556adSCorentin Chary    vnc_png=yes
1866efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
18679af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1868efe556adSCorentin Chary  else
1869efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1870efe556adSCorentin Chary      feature_not_found "vnc-png"
1871efe556adSCorentin Chary    fi
1872efe556adSCorentin Chary    vnc_png=no
1873efe556adSCorentin Chary  fi
1874efe556adSCorentin Charyfi
1875efe556adSCorentin Chary
1876efe556adSCorentin Chary##########################################
187776655d6dSaliguori# fnmatch() probe, used for ACL routines
187876655d6dSaliguorifnmatch="no"
187976655d6dSaliguoricat > $TMPC << EOF
188076655d6dSaliguori#include <fnmatch.h>
188176655d6dSaliguoriint main(void)
188276655d6dSaliguori{
188376655d6dSaliguori    fnmatch("foo", "foo", 0);
188476655d6dSaliguori    return 0;
188576655d6dSaliguori}
188676655d6dSaliguoriEOF
188752166aa0SJuan Quintelaif compile_prog "" "" ; then
188876655d6dSaliguori   fnmatch="yes"
188976655d6dSaliguorifi
189076655d6dSaliguori
189176655d6dSaliguori##########################################
1892ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1893ee682d27SStefan Weilif test "$uuid" != "no" ; then
1894ee682d27SStefan Weil  uuid_libs="-luuid"
1895ee682d27SStefan Weil  cat > $TMPC << EOF
1896ee682d27SStefan Weil#include <uuid/uuid.h>
1897ee682d27SStefan Weilint main(void)
1898ee682d27SStefan Weil{
1899ee682d27SStefan Weil    uuid_t my_uuid;
1900ee682d27SStefan Weil    uuid_generate(my_uuid);
1901ee682d27SStefan Weil    return 0;
1902ee682d27SStefan Weil}
1903ee682d27SStefan WeilEOF
1904ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1905ee682d27SStefan Weil    uuid="yes"
1906ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1907ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1908ee682d27SStefan Weil  else
1909ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1910ee682d27SStefan Weil      feature_not_found "uuid"
1911ee682d27SStefan Weil    fi
1912ee682d27SStefan Weil    uuid=no
1913ee682d27SStefan Weil  fi
1914ee682d27SStefan Weilfi
1915ee682d27SStefan Weil
1916ee682d27SStefan Weil##########################################
1917dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1918dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1919dce512deSChristoph Hellwig  cat > $TMPC << EOF
1920ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
1921dce512deSChristoph Hellwig#include <xfs/xfs.h>
1922dce512deSChristoph Hellwigint main(void)
1923dce512deSChristoph Hellwig{
1924dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1925dce512deSChristoph Hellwig    return 0;
1926dce512deSChristoph Hellwig}
1927dce512deSChristoph HellwigEOF
1928dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1929dce512deSChristoph Hellwig    xfs="yes"
1930dce512deSChristoph Hellwig  else
1931dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1932dce512deSChristoph Hellwig      feature_not_found "xfs"
1933dce512deSChristoph Hellwig    fi
1934dce512deSChristoph Hellwig    xfs=no
1935dce512deSChristoph Hellwig  fi
1936dce512deSChristoph Hellwigfi
1937dce512deSChristoph Hellwig
1938dce512deSChristoph Hellwig##########################################
19398a16d273Sths# vde libraries probe
1940dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
19414baae0acSJuan Quintela  vde_libs="-lvdeplug"
19428a16d273Sths  cat > $TMPC << EOF
19438a16d273Sths#include <libvdeplug.h>
19444a7f0e06Spbrookint main(void)
19454a7f0e06Spbrook{
19464a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
1947fea08e08SPeter Maydell    char s[] = "";
1948fea08e08SPeter Maydell    vde_open(s, s, &a);
19494a7f0e06Spbrook    return 0;
19504a7f0e06Spbrook}
19518a16d273SthsEOF
195252166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
19534baae0acSJuan Quintela    vde=yes
19548e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
19558e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1956dfb278bdSJuan Quintela  else
1957dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1958dfb278bdSJuan Quintela      feature_not_found "vde"
1959dfb278bdSJuan Quintela    fi
1960dfb278bdSJuan Quintela    vde=no
19618a16d273Sths  fi
19628a16d273Sthsfi
19638a16d273Sths
19648a16d273Sths##########################################
196547e98658SCorey Bryant# libcap-ng library probe
196647e98658SCorey Bryantif test "$cap_ng" != "no" ; then
196747e98658SCorey Bryant  cap_libs="-lcap-ng"
196847e98658SCorey Bryant  cat > $TMPC << EOF
196947e98658SCorey Bryant#include <cap-ng.h>
197047e98658SCorey Bryantint main(void)
197147e98658SCorey Bryant{
197247e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
197347e98658SCorey Bryant    return 0;
197447e98658SCorey Bryant}
197547e98658SCorey BryantEOF
197647e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
197747e98658SCorey Bryant    cap_ng=yes
197847e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
197947e98658SCorey Bryant  else
198047e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
198147e98658SCorey Bryant      feature_not_found "cap_ng"
198247e98658SCorey Bryant    fi
198347e98658SCorey Bryant    cap_ng=no
198447e98658SCorey Bryant  fi
198547e98658SCorey Bryantfi
198647e98658SCorey Bryant
198747e98658SCorey Bryant##########################################
1988c2de5c91Smalc# Sound support libraries probe
19898f28f3fbSths
1990c2de5c91Smalcaudio_drv_probe()
1991c2de5c91Smalc{
1992c2de5c91Smalc    drv=$1
1993c2de5c91Smalc    hdr=$2
1994c2de5c91Smalc    lib=$3
1995c2de5c91Smalc    exp=$4
1996c2de5c91Smalc    cfl=$5
19978f28f3fbSths        cat > $TMPC << EOF
1998c2de5c91Smalc#include <$hdr>
1999c2de5c91Smalcint main(void) { $exp }
20008f28f3fbSthsEOF
200152166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
20028f28f3fbSths        :
20038f28f3fbSths    else
20048f28f3fbSths        echo
2005c2de5c91Smalc        echo "Error: $drv check failed"
2006c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
20078f28f3fbSths        echo
20088f28f3fbSths        exit 1
20098f28f3fbSths    fi
2010c2de5c91Smalc}
2011c2de5c91Smalc
20122fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2013c2de5c91Smalcfor drv in $audio_drv_list; do
2014c2de5c91Smalc    case $drv in
2015c2de5c91Smalc    alsa)
2016c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
2017e35bcb0cSStefan Weil        "return snd_pcm_close((snd_pcm_t *)0);"
2018a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
2019c2de5c91Smalc    ;;
2020c2de5c91Smalc
2021c2de5c91Smalc    fmod)
2022c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
2023c2de5c91Smalc        echo
2024c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
2025c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
2026c2de5c91Smalc        echo
2027c2de5c91Smalc        exit 1
20288f28f3fbSths    fi
2029c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2030a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
2031c2de5c91Smalc    ;;
2032c2de5c91Smalc
2033c2de5c91Smalc    esd)
2034c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2035a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
203667f86e8eSJuan Quintela    audio_pt_int="yes"
2037c2de5c91Smalc    ;;
2038b8e59f18Smalc
2039b8e59f18Smalc    pa)
2040a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2041a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2042a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
204367f86e8eSJuan Quintela    audio_pt_int="yes"
2044b8e59f18Smalc    ;;
2045b8e59f18Smalc
2046997e690aSJuan Quintela    coreaudio)
2047997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
2048997e690aSJuan Quintela    ;;
2049997e690aSJuan Quintela
2050a4bf6780SJuan Quintela    dsound)
2051a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2052d5631638Smalc      audio_win_int="yes"
2053a4bf6780SJuan Quintela    ;;
2054a4bf6780SJuan Quintela
2055a4bf6780SJuan Quintela    oss)
2056a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
2057a4bf6780SJuan Quintela    ;;
2058a4bf6780SJuan Quintela
2059a4bf6780SJuan Quintela    sdl|wav)
20602f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
20612f6a1ab0Sblueswir1    ;;
20622f6a1ab0Sblueswir1
2063d5631638Smalc    winwave)
2064d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
2065d5631638Smalc      audio_win_int="yes"
2066d5631638Smalc    ;;
2067d5631638Smalc
2068e4c63a6aSmalc    *)
20691c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
2070e4c63a6aSmalc        echo
2071e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
2072e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
2073e4c63a6aSmalc        echo
2074e4c63a6aSmalc        exit 1
2075e4c63a6aSmalc    }
2076e4c63a6aSmalc    ;;
2077c2de5c91Smalc    esac
2078c2de5c91Smalcdone
20798f28f3fbSths
20804d3b6f6eSbalrog##########################################
20812e4d9fb1Saurel32# BrlAPI probe
20822e4d9fb1Saurel32
20834ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
2084eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
20852e4d9fb1Saurel32  cat > $TMPC << EOF
20862e4d9fb1Saurel32#include <brlapi.h>
2087832ce9c2SScott Wood#include <stddef.h>
20882e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
20892e4d9fb1Saurel32EOF
209052166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
20912e4d9fb1Saurel32    brlapi=yes
2092264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
20934ffcedb6SJuan Quintela  else
20944ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
20954ffcedb6SJuan Quintela      feature_not_found "brlapi"
20964ffcedb6SJuan Quintela    fi
20974ffcedb6SJuan Quintela    brlapi=no
2098eb82284fSJuan Quintela  fi
2099eb82284fSJuan Quintelafi
21002e4d9fb1Saurel32
21012e4d9fb1Saurel32##########################################
21024d3b6f6eSbalrog# curses probe
2103e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
2104e095e2f3SStefan Weil    curses_list="-lpdcurses"
2105e095e2f3SStefan Weilelse
2106acf15c89SVadim Evard    curses_list="-lncurses:-lcurses:$($pkg_config --libs ncurses 2>/dev/null)"
2107e095e2f3SStefan Weilfi
21084d3b6f6eSbalrog
2109c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
2110c584a6d0SJuan Quintela  curses_found=no
21114d3b6f6eSbalrog  cat > $TMPC << EOF
21124d3b6f6eSbalrog#include <curses.h>
2113ef9a2524SStefan Weilint main(void) {
2114ef9a2524SStefan Weil  const char *s = curses_version();
2115ef9a2524SStefan Weil  resize_term(0, 0);
2116ef9a2524SStefan Weil  return s != 0;
2117ef9a2524SStefan Weil}
21184d3b6f6eSbalrogEOF
2119ecbe251fSVadim Evard  IFS=:
21204f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
2121ecbe251fSVadim Evard    unset IFS
21224f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
2123c584a6d0SJuan Quintela      curses_found=yes
21244f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
21254f78ef9aSJuan Quintela      break
21264d3b6f6eSbalrog    fi
21274f78ef9aSJuan Quintela  done
2128ecbe251fSVadim Evard  unset IFS
2129c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
2130c584a6d0SJuan Quintela    curses=yes
2131c584a6d0SJuan Quintela  else
2132c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
2133c584a6d0SJuan Quintela      feature_not_found "curses"
2134c584a6d0SJuan Quintela    fi
2135c584a6d0SJuan Quintela    curses=no
2136c584a6d0SJuan Quintela  fi
21374f78ef9aSJuan Quintelafi
21384d3b6f6eSbalrog
2139414f0dabSblueswir1##########################################
2140769ce76dSAlexander Graf# curl probe
2141769ce76dSAlexander Graf
2142a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
2143a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
21444e2b0658SPaolo Bonzinielse
21454e2b0658SPaolo Bonzini  curlconfig=curl-config
21464e2b0658SPaolo Bonzinifi
21474e2b0658SPaolo Bonzini
2148788c8196SJuan Quintelaif test "$curl" != "no" ; then
2149769ce76dSAlexander Graf  cat > $TMPC << EOF
2150769ce76dSAlexander Graf#include <curl/curl.h>
21510b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2152769ce76dSAlexander GrafEOF
21534e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
21544e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2155b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2156769ce76dSAlexander Graf    curl=yes
2157f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2158f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2159788c8196SJuan Quintela  else
2160788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2161788c8196SJuan Quintela      feature_not_found "curl"
2162788c8196SJuan Quintela    fi
2163788c8196SJuan Quintela    curl=no
2164769ce76dSAlexander Graf  fi
2165769ce76dSAlexander Graffi # test "$curl"
2166769ce76dSAlexander Graf
2167769ce76dSAlexander Graf##########################################
2168fb599c9aSbalrog# bluez support probe
2169a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2170e820e3f4Sbalrog  cat > $TMPC << EOF
2171e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2172e820e3f4Sbalrogint main(void) { return bt_error(0); }
2173e820e3f4SbalrogEOF
2174a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2175a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
217652166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2177a20a6f46SJuan Quintela    bluez=yes
2178e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2179e820e3f4Sbalrog  else
2180a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2181a20a6f46SJuan Quintela      feature_not_found "bluez"
2182a20a6f46SJuan Quintela    fi
2183e820e3f4Sbalrog    bluez="no"
2184e820e3f4Sbalrog  fi
2185fb599c9aSbalrogfi
2186fb599c9aSbalrog
2187fb599c9aSbalrog##########################################
2188e18df141SAnthony Liguori# glib support probe
2189a52d28afSPaolo Bonzini
2190a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2191a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2192a52d28afSPaolo Bonzini    glib_req_ver=2.20
2193a52d28afSPaolo Bonzinielse
2194a52d28afSPaolo Bonzini    glib_req_ver=2.12
2195a52d28afSPaolo Bonzinifi
2196a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
2197a52d28afSPaolo Bonzinithen
21984b76a481SStefan Hajnoczi    glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
21994b76a481SStefan Hajnoczi    glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
220014015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2201957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2202e18df141SAnthony Liguorielse
2203a52d28afSPaolo Bonzini    echo "glib-$glib_req_ver required to compile QEMU"
2204e18df141SAnthony Liguori    exit 1
2205e18df141SAnthony Liguorifi
2206e18df141SAnthony Liguori
2207e18df141SAnthony Liguori##########################################
2208e2134eb9SGerd Hoffmann# pixman support probe
2209e2134eb9SGerd Hoffmann
2210e2134eb9SGerd Hoffmannif test "$pixman" = ""; then
221174880fe2SRobert Schiele  if test "$want_tools" = "no" -a "$softmmu" = "no"; then
221274880fe2SRobert Schiele    pixman="none"
221374880fe2SRobert Schiele  elif $pkg_config pixman-1 > /dev/null 2>&1; then
2214e2134eb9SGerd Hoffmann    pixman="system"
2215e2134eb9SGerd Hoffmann  else
2216e2134eb9SGerd Hoffmann    pixman="internal"
2217e2134eb9SGerd Hoffmann  fi
2218e2134eb9SGerd Hoffmannfi
221974880fe2SRobert Schieleif test "$pixman" = "none"; then
222074880fe2SRobert Schiele  if test "$want_tools" != "no" -o "$softmmu" != "no"; then
222174880fe2SRobert Schiele    echo "ERROR: pixman disabled but system emulation or tools build"
222274880fe2SRobert Schiele    echo "       enabled.  You can turn off pixman only if you also"
222374880fe2SRobert Schiele    echo "       disable all system emulation targets and the tools"
222474880fe2SRobert Schiele    echo "       build with '--disable-tools --disable-system'."
222574880fe2SRobert Schiele    exit 1
222674880fe2SRobert Schiele  fi
222774880fe2SRobert Schiele  pixman_cflags=
222874880fe2SRobert Schiele  pixman_libs=
222974880fe2SRobert Schieleelif test "$pixman" = "system"; then
2230e2134eb9SGerd Hoffmann  pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null`
2231e2134eb9SGerd Hoffmann  pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null`
2232e2134eb9SGerd Hoffmannelse
2233e2134eb9SGerd Hoffmann  if test ! -d ${source_path}/pixman/pixman; then
2234cb1d40d7SGerd Hoffmann    echo "ERROR: pixman not present. Your options:"
2235eac29d87SStefan Weil    echo "  (1) Preferred: Install the pixman devel package (any recent"
2236e2134eb9SGerd Hoffmann    echo "      distro should have packages as Xorg needs pixman too)."
2237e2134eb9SGerd Hoffmann    echo "  (2) Fetch the pixman submodule, using:"
2238e2134eb9SGerd Hoffmann    echo "      git submodule update --init pixman"
2239e2134eb9SGerd Hoffmann    exit 1
2240e2134eb9SGerd Hoffmann  fi
22415ca9388aSGerd Hoffmann  mkdir -p pixman/pixman
22425ca9388aSGerd Hoffmann  pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
22435ca9388aSGerd Hoffmann  pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2244e2134eb9SGerd Hoffmannfi
2245e2134eb9SGerd Hoffmann
2246e2134eb9SGerd Hoffmann##########################################
224717bff52bSM. Mohan Kumar# libcap probe
224817bff52bSM. Mohan Kumar
224917bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
225017bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
225117bff52bSM. Mohan Kumar#include <stdio.h>
225217bff52bSM. Mohan Kumar#include <sys/capability.h>
2253cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
225417bff52bSM. Mohan KumarEOF
225517bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
225617bff52bSM. Mohan Kumar    cap=yes
225717bff52bSM. Mohan Kumar  else
225817bff52bSM. Mohan Kumar    cap=no
225917bff52bSM. Mohan Kumar  fi
226017bff52bSM. Mohan Kumarfi
226117bff52bSM. Mohan Kumar
226217bff52bSM. Mohan Kumar##########################################
2263e5d355d1Saliguori# pthread probe
22644b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
22653c529d93Saliguori
2266e5d355d1Saliguoripthread=no
2267414f0dabSblueswir1cat > $TMPC << EOF
22683c529d93Saliguori#include <pthread.h>
22697a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
22707a42bbe4SStefan Weilint main(void) {
22717a42bbe4SStefan Weil  pthread_t thread;
22727a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
22737a42bbe4SStefan Weil  return 0;
22747a42bbe4SStefan Weil}
2275414f0dabSblueswir1EOF
2276bd00d539SAndreas Färberif compile_prog "" "" ; then
2277bd00d539SAndreas Färber  pthread=yes
2278bd00d539SAndreas Färberelse
2279de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
228052166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2281e5d355d1Saliguori      pthread=yes
2282e3c56761SPeter Portante      found=no
2283e3c56761SPeter Portante      for lib_entry in $LIBS; do
2284e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2285e3c56761SPeter Portante          found=yes
2286e3c56761SPeter Portante          break
2287e3c56761SPeter Portante        fi
2288e3c56761SPeter Portante      done
2289e3c56761SPeter Portante      if test "$found" = "no"; then
22905572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2291e3c56761SPeter Portante      fi
2292de65fe0fSSebastian Herbszt      break
2293414f0dabSblueswir1    fi
2294de65fe0fSSebastian Herbszt  done
2295bd00d539SAndreas Färberfi
2296414f0dabSblueswir1
22974617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
22984dd75c70SChristoph Hellwig  echo
22994dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
23004dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
23014dd75c70SChristoph Hellwig  echo
23024dd75c70SChristoph Hellwig  exit 1
2303e5d355d1Saliguorifi
2304e5d355d1Saliguori
2305bf9298b9Saliguori##########################################
2306f27aaf4bSChristian Brunner# rbd probe
2307f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2308f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2309f27aaf4bSChristian Brunner#include <stdio.h>
2310ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2311f27aaf4bSChristian Brunnerint main(void) {
2312ad32e9c0SJosh Durgin    rados_t cluster;
2313ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2314f27aaf4bSChristian Brunner    return 0;
2315f27aaf4bSChristian Brunner}
2316f27aaf4bSChristian BrunnerEOF
2317ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2318f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2319f27aaf4bSChristian Brunner    rbd=yes
2320f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2321f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2322f27aaf4bSChristian Brunner  else
2323f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2324f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2325f27aaf4bSChristian Brunner    fi
2326f27aaf4bSChristian Brunner    rbd=no
2327f27aaf4bSChristian Brunner  fi
2328f27aaf4bSChristian Brunnerfi
2329f27aaf4bSChristian Brunner
2330f27aaf4bSChristian Brunner##########################################
23315c6c3a6cSChristoph Hellwig# linux-aio probe
23325c6c3a6cSChristoph Hellwig
23335c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
23345c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
23355c6c3a6cSChristoph Hellwig#include <libaio.h>
23365c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2337832ce9c2SScott Wood#include <stddef.h>
23385c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
23395c6c3a6cSChristoph HellwigEOF
23405c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
23415c6c3a6cSChristoph Hellwig    linux_aio=yes
2342048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2343048d179fSPaul Brook    libs_tools="$libs_tools -laio"
23445c6c3a6cSChristoph Hellwig  else
23455c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
23465c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
23475c6c3a6cSChristoph Hellwig    fi
23483cfcae3cSLuiz Capitulino    linux_aio=no
23495c6c3a6cSChristoph Hellwig  fi
23505c6c3a6cSChristoph Hellwigfi
23515c6c3a6cSChristoph Hellwig
23525c6c3a6cSChristoph Hellwig##########################################
2353583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio
2354583f6e7bSStefan Hajnoczi
2355583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \
2356583f6e7bSStefan Hajnoczi	"$linux_aio" != "yes" ; then
2357583f6e7bSStefan Hajnoczi  echo "Error: virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2358583f6e7bSStefan Hajnoczi  exit 1
2359583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then
2360583f6e7bSStefan Hajnoczi  virtio_blk_data_plane=$linux_aio
2361583f6e7bSStefan Hajnoczifi
2362583f6e7bSStefan Hajnoczi
2363583f6e7bSStefan Hajnoczi##########################################
2364758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2365758e8e38SVenkateswararao Jujjuri (JV)
2366758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2367758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2368758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2369758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2370f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2371f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2372f2338fb4SPavel Borzenkov#else
23734f26f2b6SAvi Kivity#include <sys/xattr.h>
2374f2338fb4SPavel Borzenkov#endif
2375758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2376758e8e38SVenkateswararao Jujjuri (JV)EOF
23774f26f2b6SAvi Kivity  if compile_prog "" "" ; then
23784f26f2b6SAvi Kivity    attr=yes
23794f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2380f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2381758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2382758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
23834f26f2b6SAvi Kivity    libattr=yes
2384758e8e38SVenkateswararao Jujjuri (JV)  else
2385758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2386758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2387758e8e38SVenkateswararao Jujjuri (JV)    fi
2388758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2389758e8e38SVenkateswararao Jujjuri (JV)  fi
2390758e8e38SVenkateswararao Jujjuri (JV)fi
2391758e8e38SVenkateswararao Jujjuri (JV)
2392758e8e38SVenkateswararao Jujjuri (JV)##########################################
2393bf9298b9Saliguori# iovec probe
2394bf9298b9Saliguoricat > $TMPC <<EOF
2395db34f0b3Sblueswir1#include <sys/types.h>
2396bf9298b9Saliguori#include <sys/uio.h>
2397db34f0b3Sblueswir1#include <unistd.h>
2398f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2399bf9298b9SaliguoriEOF
2400bf9298b9Saliguoriiovec=no
240152166aa0SJuan Quintelaif compile_prog "" "" ; then
2402bf9298b9Saliguori  iovec=yes
2403bf9298b9Saliguorifi
2404bf9298b9Saliguori
2405f652e6afSaurel32##########################################
2406ceb42de8Saliguori# preadv probe
2407ceb42de8Saliguoricat > $TMPC <<EOF
2408ceb42de8Saliguori#include <sys/types.h>
2409ceb42de8Saliguori#include <sys/uio.h>
2410ceb42de8Saliguori#include <unistd.h>
2411c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); }
2412ceb42de8SaliguoriEOF
2413ceb42de8Saliguoripreadv=no
241452166aa0SJuan Quintelaif compile_prog "" "" ; then
2415ceb42de8Saliguori  preadv=yes
2416ceb42de8Saliguorifi
2417ceb42de8Saliguori
2418ceb42de8Saliguori##########################################
2419f652e6afSaurel32# fdt probe
24202df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2421b41af4baSJuan Quintela  fdt_libs="-lfdt"
2422f652e6afSaurel32  cat > $TMPC << EOF
2423f652e6afSaurel32int main(void) { return 0; }
2424f652e6afSaurel32EOF
242552166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2426f652e6afSaurel32    fdt=yes
2427320ba5feSPaolo Bonzini    libs_softmmu="$libs_softmmu $fdt_libs"
24282df87df7SJuan Quintela  else
24292df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
24302df87df7SJuan Quintela      feature_not_found "fdt"
24312df87df7SJuan Quintela    fi
2432de3a354aSMichael Walle    fdt_libs=
24332df87df7SJuan Quintela    fdt=no
2434f652e6afSaurel32  fi
2435f652e6afSaurel32fi
2436f652e6afSaurel32
243720ff075bSMichael Walle##########################################
2438*b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2
2439*b1e5fff4SMichael Walleif test "$glx" != "no" ; then
2440*b1e5fff4SMichael Walle  glx_libs="-lGL -lX11"
244120ff075bSMichael Walle  cat > $TMPC << EOF
244220ff075bSMichael Walle#include <X11/Xlib.h>
244320ff075bSMichael Walle#include <GL/gl.h>
244420ff075bSMichael Walle#include <GL/glx.h>
2445d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
244620ff075bSMichael WalleEOF
2447d3fcbb16SMichael Walle  if compile_prog "" "-lGL -lX11" ; then
2448*b1e5fff4SMichael Walle    glx=yes
244920ff075bSMichael Walle  else
2450*b1e5fff4SMichael Walle    if test "$glx" = "yes" ; then
2451*b1e5fff4SMichael Walle      feature_not_found "glx"
245220ff075bSMichael Walle    fi
2453*b1e5fff4SMichael Walle    glx_libs=
2454*b1e5fff4SMichael Walle    glx=no
245520ff075bSMichael Walle  fi
245620ff075bSMichael Wallefi
245720ff075bSMichael Walle
2458eb100396SBharata B Rao##########################################
2459eb100396SBharata B Rao# glusterfs probe
2460eb100396SBharata B Raoif test "$glusterfs" != "no" ; then
2461eb100396SBharata B Rao  cat > $TMPC <<EOF
2462eb100396SBharata B Rao#include <glusterfs/api/glfs.h>
2463eb100396SBharata B Raoint main(void) {
2464eb100396SBharata B Rao    (void) glfs_new("volume");
2465eb100396SBharata B Rao    return 0;
2466eb100396SBharata B Rao}
2467eb100396SBharata B RaoEOF
2468eb100396SBharata B Rao  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
2469eb100396SBharata B Rao  if compile_prog "" "$glusterfs_libs" ; then
2470eb100396SBharata B Rao    glusterfs=yes
2471eb100396SBharata B Rao    libs_tools="$glusterfs_libs $libs_tools"
2472eb100396SBharata B Rao    libs_softmmu="$glusterfs_libs $libs_softmmu"
2473eb100396SBharata B Rao  else
2474eb100396SBharata B Rao    if test "$glusterfs" = "yes" ; then
2475eb100396SBharata B Rao      feature_not_found "GlusterFS backend support"
2476eb100396SBharata B Rao    fi
2477eb100396SBharata B Rao    glusterfs=no
2478eb100396SBharata B Rao  fi
2479eb100396SBharata B Raofi
2480eb100396SBharata B Rao
24813b3f24adSaurel32#
24823b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
24833b3f24adSaurel32# emulator.  This is done because older glibc versions don't
24843b3f24adSaurel32# have syscall stubs for these implemented.
24853b3f24adSaurel32#
24863b3f24adSaurel32atfile=no
24873b3f24adSaurel32cat > $TMPC << EOF
24883b3f24adSaurel32#define _ATFILE_SOURCE
24893b3f24adSaurel32#include <sys/types.h>
24903b3f24adSaurel32#include <fcntl.h>
24913b3f24adSaurel32#include <unistd.h>
24923b3f24adSaurel32
24933b3f24adSaurel32int
24943b3f24adSaurel32main(void)
24953b3f24adSaurel32{
24963b3f24adSaurel32	/* try to unlink nonexisting file */
24973b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
24983b3f24adSaurel32}
24993b3f24adSaurel32EOF
250052166aa0SJuan Quintelaif compile_prog "" "" ; then
25013b3f24adSaurel32  atfile=yes
25023b3f24adSaurel32fi
25033b3f24adSaurel32
250439386ac7Saurel32# Check for inotify functions when we are building linux-user
25053b3f24adSaurel32# emulator.  This is done because older glibc versions don't
25063b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
25073b3f24adSaurel32# don't provide them even if kernel supports them.
25083b3f24adSaurel32#
25093b3f24adSaurel32inotify=no
25103b3f24adSaurel32cat > $TMPC << EOF
25113b3f24adSaurel32#include <sys/inotify.h>
25123b3f24adSaurel32
25133b3f24adSaurel32int
25143b3f24adSaurel32main(void)
25153b3f24adSaurel32{
25163b3f24adSaurel32	/* try to start inotify */
25178690e420Saurel32	return inotify_init();
25183b3f24adSaurel32}
25193b3f24adSaurel32EOF
252052166aa0SJuan Quintelaif compile_prog "" "" ; then
25213b3f24adSaurel32  inotify=yes
25223b3f24adSaurel32fi
25233b3f24adSaurel32
2524c05c7a73SRiku Voipioinotify1=no
2525c05c7a73SRiku Voipiocat > $TMPC << EOF
2526c05c7a73SRiku Voipio#include <sys/inotify.h>
2527c05c7a73SRiku Voipio
2528c05c7a73SRiku Voipioint
2529c05c7a73SRiku Voipiomain(void)
2530c05c7a73SRiku Voipio{
2531c05c7a73SRiku Voipio    /* try to start inotify */
2532c05c7a73SRiku Voipio    return inotify_init1(0);
2533c05c7a73SRiku Voipio}
2534c05c7a73SRiku VoipioEOF
2535c05c7a73SRiku Voipioif compile_prog "" "" ; then
2536c05c7a73SRiku Voipio  inotify1=yes
2537c05c7a73SRiku Voipiofi
2538c05c7a73SRiku Voipio
2539ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2540ebc996f3SRiku Voipioutimens=no
2541ebc996f3SRiku Voipiocat > $TMPC << EOF
2542ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2543ebc996f3SRiku Voipio#include <stddef.h>
2544ebc996f3SRiku Voipio#include <fcntl.h>
25453014ee00SPeter Maydell#include <sys/stat.h>
2546ebc996f3SRiku Voipio
2547ebc996f3SRiku Voipioint main(void)
2548ebc996f3SRiku Voipio{
2549ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2550ebc996f3SRiku Voipio    futimens(0, NULL);
2551ebc996f3SRiku Voipio    return 0;
2552ebc996f3SRiku Voipio}
2553ebc996f3SRiku VoipioEOF
255452166aa0SJuan Quintelaif compile_prog "" "" ; then
2555ebc996f3SRiku Voipio  utimens=yes
2556ebc996f3SRiku Voipiofi
2557ebc996f3SRiku Voipio
2558099d6b0fSRiku Voipio# check if pipe2 is there
2559099d6b0fSRiku Voipiopipe2=no
2560099d6b0fSRiku Voipiocat > $TMPC << EOF
2561099d6b0fSRiku Voipio#include <unistd.h>
2562099d6b0fSRiku Voipio#include <fcntl.h>
2563099d6b0fSRiku Voipio
2564099d6b0fSRiku Voipioint main(void)
2565099d6b0fSRiku Voipio{
2566099d6b0fSRiku Voipio    int pipefd[2];
25679bca8162SBruce Rogers    return pipe2(pipefd, O_CLOEXEC);
2568099d6b0fSRiku Voipio}
2569099d6b0fSRiku VoipioEOF
257052166aa0SJuan Quintelaif compile_prog "" "" ; then
2571099d6b0fSRiku Voipio  pipe2=yes
2572099d6b0fSRiku Voipiofi
2573099d6b0fSRiku Voipio
257440ff6d7eSKevin Wolf# check if accept4 is there
257540ff6d7eSKevin Wolfaccept4=no
257640ff6d7eSKevin Wolfcat > $TMPC << EOF
257740ff6d7eSKevin Wolf#include <sys/socket.h>
257840ff6d7eSKevin Wolf#include <stddef.h>
257940ff6d7eSKevin Wolf
258040ff6d7eSKevin Wolfint main(void)
258140ff6d7eSKevin Wolf{
258240ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
258340ff6d7eSKevin Wolf    return 0;
258440ff6d7eSKevin Wolf}
258540ff6d7eSKevin WolfEOF
258640ff6d7eSKevin Wolfif compile_prog "" "" ; then
258740ff6d7eSKevin Wolf  accept4=yes
258840ff6d7eSKevin Wolffi
258940ff6d7eSKevin Wolf
25903ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
25913ce34dfbSvibisreenivasansplice=no
25923ce34dfbSvibisreenivasancat > $TMPC << EOF
25933ce34dfbSvibisreenivasan#include <unistd.h>
25943ce34dfbSvibisreenivasan#include <fcntl.h>
25953ce34dfbSvibisreenivasan#include <limits.h>
25963ce34dfbSvibisreenivasan
25973ce34dfbSvibisreenivasanint main(void)
25983ce34dfbSvibisreenivasan{
259966ea0f22SStefan Weil    int len, fd = 0;
26003ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
26013ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
26023ce34dfbSvibisreenivasan    return 0;
26033ce34dfbSvibisreenivasan}
26043ce34dfbSvibisreenivasanEOF
260552166aa0SJuan Quintelaif compile_prog "" "" ; then
26063ce34dfbSvibisreenivasan  splice=yes
26073ce34dfbSvibisreenivasanfi
26083ce34dfbSvibisreenivasan
2609dcc38d1cSMarcelo Tosatti##########################################
2610dcc38d1cSMarcelo Tosatti# signalfd probe
2611dcc38d1cSMarcelo Tosattisignalfd="no"
2612dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2613dcc38d1cSMarcelo Tosatti#include <unistd.h>
2614dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2615dcc38d1cSMarcelo Tosatti#include <signal.h>
2616dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2617dcc38d1cSMarcelo TosattiEOF
2618dcc38d1cSMarcelo Tosatti
2619dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2620dcc38d1cSMarcelo Tosatti  signalfd=yes
2621dcc38d1cSMarcelo Tosattifi
2622dcc38d1cSMarcelo Tosatti
2623c2882b96SRiku Voipio# check if eventfd is supported
2624c2882b96SRiku Voipioeventfd=no
2625c2882b96SRiku Voipiocat > $TMPC << EOF
2626c2882b96SRiku Voipio#include <sys/eventfd.h>
2627c2882b96SRiku Voipio
2628c2882b96SRiku Voipioint main(void)
2629c2882b96SRiku Voipio{
263055cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2631c2882b96SRiku Voipio}
2632c2882b96SRiku VoipioEOF
2633c2882b96SRiku Voipioif compile_prog "" "" ; then
2634c2882b96SRiku Voipio  eventfd=yes
2635c2882b96SRiku Voipiofi
2636c2882b96SRiku Voipio
2637d0927938SUlrich Hecht# check for fallocate
2638d0927938SUlrich Hechtfallocate=no
2639d0927938SUlrich Hechtcat > $TMPC << EOF
2640d0927938SUlrich Hecht#include <fcntl.h>
2641d0927938SUlrich Hecht
2642d0927938SUlrich Hechtint main(void)
2643d0927938SUlrich Hecht{
2644d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2645d0927938SUlrich Hecht    return 0;
2646d0927938SUlrich Hecht}
2647d0927938SUlrich HechtEOF
26488fb03151SPeter Maydellif compile_prog "" "" ; then
2649d0927938SUlrich Hecht  fallocate=yes
2650d0927938SUlrich Hechtfi
2651d0927938SUlrich Hecht
26523d4fa43eSKusanagi Kouichi# check for fallocate hole punching
26533d4fa43eSKusanagi Kouichifallocate_punch_hole=no
26543d4fa43eSKusanagi Kouichicat > $TMPC << EOF
26553d4fa43eSKusanagi Kouichi#include <fcntl.h>
26563d4fa43eSKusanagi Kouichi#include <linux/falloc.h>
26573d4fa43eSKusanagi Kouichi
26583d4fa43eSKusanagi Kouichiint main(void)
26593d4fa43eSKusanagi Kouichi{
26603d4fa43eSKusanagi Kouichi    fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
26613d4fa43eSKusanagi Kouichi    return 0;
26623d4fa43eSKusanagi Kouichi}
26633d4fa43eSKusanagi KouichiEOF
26643d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then
26653d4fa43eSKusanagi Kouichi  fallocate_punch_hole=yes
26663d4fa43eSKusanagi Kouichifi
26673d4fa43eSKusanagi Kouichi
2668c727f47dSPeter Maydell# check for sync_file_range
2669c727f47dSPeter Maydellsync_file_range=no
2670c727f47dSPeter Maydellcat > $TMPC << EOF
2671c727f47dSPeter Maydell#include <fcntl.h>
2672c727f47dSPeter Maydell
2673c727f47dSPeter Maydellint main(void)
2674c727f47dSPeter Maydell{
2675c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2676c727f47dSPeter Maydell    return 0;
2677c727f47dSPeter Maydell}
2678c727f47dSPeter MaydellEOF
26798fb03151SPeter Maydellif compile_prog "" "" ; then
2680c727f47dSPeter Maydell  sync_file_range=yes
2681c727f47dSPeter Maydellfi
2682c727f47dSPeter Maydell
2683dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2684dace20dcSPeter Maydellfiemap=no
2685dace20dcSPeter Maydellcat > $TMPC << EOF
2686dace20dcSPeter Maydell#include <sys/ioctl.h>
2687dace20dcSPeter Maydell#include <linux/fs.h>
2688dace20dcSPeter Maydell#include <linux/fiemap.h>
2689dace20dcSPeter Maydell
2690dace20dcSPeter Maydellint main(void)
2691dace20dcSPeter Maydell{
2692dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2693dace20dcSPeter Maydell    return 0;
2694dace20dcSPeter Maydell}
2695dace20dcSPeter MaydellEOF
26968fb03151SPeter Maydellif compile_prog "" "" ; then
2697dace20dcSPeter Maydell  fiemap=yes
2698dace20dcSPeter Maydellfi
2699dace20dcSPeter Maydell
2700d0927938SUlrich Hecht# check for dup3
2701d0927938SUlrich Hechtdup3=no
2702d0927938SUlrich Hechtcat > $TMPC << EOF
2703d0927938SUlrich Hecht#include <unistd.h>
2704d0927938SUlrich Hecht
2705d0927938SUlrich Hechtint main(void)
2706d0927938SUlrich Hecht{
2707d0927938SUlrich Hecht    dup3(0, 0, 0);
2708d0927938SUlrich Hecht    return 0;
2709d0927938SUlrich Hecht}
2710d0927938SUlrich HechtEOF
271178f5d726SJan Kiszkaif compile_prog "" "" ; then
2712d0927938SUlrich Hecht  dup3=yes
2713d0927938SUlrich Hechtfi
2714d0927938SUlrich Hecht
27153b6edd16SPeter Maydell# check for epoll support
27163b6edd16SPeter Maydellepoll=no
27173b6edd16SPeter Maydellcat > $TMPC << EOF
27183b6edd16SPeter Maydell#include <sys/epoll.h>
27193b6edd16SPeter Maydell
27203b6edd16SPeter Maydellint main(void)
27213b6edd16SPeter Maydell{
27223b6edd16SPeter Maydell    epoll_create(0);
27233b6edd16SPeter Maydell    return 0;
27243b6edd16SPeter Maydell}
27253b6edd16SPeter MaydellEOF
27268fb03151SPeter Maydellif compile_prog "" "" ; then
27273b6edd16SPeter Maydell  epoll=yes
27283b6edd16SPeter Maydellfi
27293b6edd16SPeter Maydell
27303b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
27313b6edd16SPeter Maydell# so we must check separately for their presence
27323b6edd16SPeter Maydellepoll_create1=no
27333b6edd16SPeter Maydellcat > $TMPC << EOF
27343b6edd16SPeter Maydell#include <sys/epoll.h>
27353b6edd16SPeter Maydell
27363b6edd16SPeter Maydellint main(void)
27373b6edd16SPeter Maydell{
273819e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
273919e83f6bSPeter Maydell     * a function being called. This is necessary so that on
274019e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
274119e83f6bSPeter Maydell     * the library but not declared in the header file we will
274219e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
274319e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
274419e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
274519e83f6bSPeter Maydell     */
2746c075a723SBlue Swirl    return (int)(uintptr_t)&epoll_create1;
27473b6edd16SPeter Maydell}
27483b6edd16SPeter MaydellEOF
27498fb03151SPeter Maydellif compile_prog "" "" ; then
27503b6edd16SPeter Maydell  epoll_create1=yes
27513b6edd16SPeter Maydellfi
27523b6edd16SPeter Maydell
27533b6edd16SPeter Maydellepoll_pwait=no
27543b6edd16SPeter Maydellcat > $TMPC << EOF
27553b6edd16SPeter Maydell#include <sys/epoll.h>
27563b6edd16SPeter Maydell
27573b6edd16SPeter Maydellint main(void)
27583b6edd16SPeter Maydell{
27593b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
27603b6edd16SPeter Maydell    return 0;
27613b6edd16SPeter Maydell}
27623b6edd16SPeter MaydellEOF
27638fb03151SPeter Maydellif compile_prog "" "" ; then
27643b6edd16SPeter Maydell  epoll_pwait=yes
27653b6edd16SPeter Maydellfi
27663b6edd16SPeter Maydell
2767a8fd1abaSPeter Maydell# check for sendfile support
2768a8fd1abaSPeter Maydellsendfile=no
2769a8fd1abaSPeter Maydellcat > $TMPC << EOF
2770a8fd1abaSPeter Maydell#include <sys/sendfile.h>
2771a8fd1abaSPeter Maydell
2772a8fd1abaSPeter Maydellint main(void)
2773a8fd1abaSPeter Maydell{
2774a8fd1abaSPeter Maydell    return sendfile(0, 0, 0, 0);
2775a8fd1abaSPeter Maydell}
2776a8fd1abaSPeter MaydellEOF
2777a8fd1abaSPeter Maydellif compile_prog "" "" ; then
2778a8fd1abaSPeter Maydell  sendfile=yes
2779a8fd1abaSPeter Maydellfi
2780a8fd1abaSPeter Maydell
2781cc8ae6deSpbrook# Check if tools are available to build documentation.
2782a25dba17SJuan Quintelaif test "$docs" != "no" ; then
278301668d98SStefan Weil  if has makeinfo && has pod2man; then
2784a25dba17SJuan Quintela    docs=yes
278583a3ab8bSJuan Quintela  else
2786a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2787a25dba17SJuan Quintela      feature_not_found "docs"
278883a3ab8bSJuan Quintela    fi
2789a25dba17SJuan Quintela    docs=no
279083a3ab8bSJuan Quintela  fi
2791cc8ae6deSpbrookfi
2792cc8ae6deSpbrook
2793f514f41cSStefan Weil# Search for bswap_32 function
27946ae9a1f4SJuan Quintelabyteswap_h=no
27956ae9a1f4SJuan Quintelacat > $TMPC << EOF
27966ae9a1f4SJuan Quintela#include <byteswap.h>
27976ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
27986ae9a1f4SJuan QuintelaEOF
279952166aa0SJuan Quintelaif compile_prog "" "" ; then
28006ae9a1f4SJuan Quintela  byteswap_h=yes
28016ae9a1f4SJuan Quintelafi
28026ae9a1f4SJuan Quintela
280375f13596SStefan Weil# Search for bswap32 function
28046ae9a1f4SJuan Quintelabswap_h=no
28056ae9a1f4SJuan Quintelacat > $TMPC << EOF
28066ae9a1f4SJuan Quintela#include <sys/endian.h>
28076ae9a1f4SJuan Quintela#include <sys/types.h>
28086ae9a1f4SJuan Quintela#include <machine/bswap.h>
28096ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
28106ae9a1f4SJuan QuintelaEOF
281152166aa0SJuan Quintelaif compile_prog "" "" ; then
28126ae9a1f4SJuan Quintela  bswap_h=yes
28136ae9a1f4SJuan Quintelafi
28146ae9a1f4SJuan Quintela
2815da93a1fdSaliguori##########################################
2816c589b249SRonnie Sahlberg# Do we have libiscsi
2817fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a
2818fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi.
2819c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
2820c589b249SRonnie Sahlberg  cat > $TMPC << EOF
2821fa6acb0cSRonnie Sahlberg#include <stdio.h>
2822c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
2823fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
2824c589b249SRonnie SahlbergEOF
28253c33ea96SPaolo Bonzini  if $pkg_config --atleast-version=1.7.0 libiscsi --modversion >/dev/null 2>&1; then
28263c33ea96SPaolo Bonzini    libiscsi="yes"
28273c33ea96SPaolo Bonzini    libiscsi_cflags=$($pkg_config --cflags libiscsi 2>/dev/null)
28283c33ea96SPaolo Bonzini    libiscsi_libs=$($pkg_config --libs libiscsi 2>/dev/null)
28293c33ea96SPaolo Bonzini    CFLAGS="$CFLAGS $libiscsi_cflags"
28303c33ea96SPaolo Bonzini    LIBS="$LIBS $libiscsi_libs"
28313c33ea96SPaolo Bonzini  elif compile_prog "" "-liscsi" ; then
2832c589b249SRonnie Sahlberg    libiscsi="yes"
2833c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
2834c589b249SRonnie Sahlberg  else
2835c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
2836c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
2837c589b249SRonnie Sahlberg    fi
2838c589b249SRonnie Sahlberg    libiscsi="no"
2839c589b249SRonnie Sahlberg  fi
2840c589b249SRonnie Sahlbergfi
2841c589b249SRonnie Sahlberg
2842c589b249SRonnie Sahlberg
2843c589b249SRonnie Sahlberg##########################################
28448bacde8dSNatanael Copa# Do we need libm
28458bacde8dSNatanael Copacat > $TMPC << EOF
28468bacde8dSNatanael Copa#include <math.h>
28478bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); }
28488bacde8dSNatanael CopaEOF
28498bacde8dSNatanael Copaif compile_prog "" "" ; then
28508bacde8dSNatanael Copa  :
28518bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then
28528bacde8dSNatanael Copa  LIBS="-lm $LIBS"
28538bacde8dSNatanael Copa  libs_qga="-lm $libs_qga"
28548bacde8dSNatanael Copaelse
28558bacde8dSNatanael Copa  echo
28568bacde8dSNatanael Copa  echo "Error: libm check failed"
28578bacde8dSNatanael Copa  echo
28588bacde8dSNatanael Copa  exit 1
28598bacde8dSNatanael Copafi
28608bacde8dSNatanael Copa
28618bacde8dSNatanael Copa##########################################
2862da93a1fdSaliguori# Do we need librt
28638bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime
28648bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't
28658bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this
28668bacde8dSNatanael Copa# function in addition.
2867da93a1fdSaliguoricat > $TMPC <<EOF
2868da93a1fdSaliguori#include <signal.h>
2869da93a1fdSaliguori#include <time.h>
28708bacde8dSNatanael Copaint main(void) {
28718bacde8dSNatanael Copa  timer_create(CLOCK_REALTIME, NULL, NULL);
28728bacde8dSNatanael Copa  return clock_gettime(CLOCK_REALTIME, NULL);
28738bacde8dSNatanael Copa}
2874da93a1fdSaliguoriEOF
2875da93a1fdSaliguori
287652166aa0SJuan Quintelaif compile_prog "" "" ; then
287707ffa4bdSJuan Quintela  :
28788bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result
28798bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then
288007ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
28818bacde8dSNatanael Copa  libs_qga="-lrt $libs_qga"
2882da93a1fdSaliguorifi
2883da93a1fdSaliguori
288431ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2885179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
28866362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
28876362a53fSJuan Quintelafi
28886362a53fSJuan Quintela
2889de5071c5SBlue Swirl##########################################
2890cd4ec0b4SGerd Hoffmann# spice probe
2891cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2892cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2893cd4ec0b4SGerd Hoffmann#include <spice.h>
2894cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2895cd4ec0b4SGerd HoffmannEOF
2896710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2897710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
289867be6726SGerd Hoffmann  if $pkg_config --atleast-version=0.12.0 spice-server >/dev/null 2>&1 && \
2899358689feSMichal Privoznik     $pkg_config --atleast-version=0.12.3 spice-protocol > /dev/null 2>&1 && \
2900cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2901cd4ec0b4SGerd Hoffmann    spice="yes"
2902cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2903cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
29042e0e3c39SAlon Levy    spice_protocol_version=$($pkg_config --modversion spice-protocol)
29052e0e3c39SAlon Levy    spice_server_version=$($pkg_config --modversion spice-server)
2906cd4ec0b4SGerd Hoffmann  else
2907cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2908cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2909cd4ec0b4SGerd Hoffmann    fi
2910cd4ec0b4SGerd Hoffmann    spice="no"
2911cd4ec0b4SGerd Hoffmann  fi
2912cd4ec0b4SGerd Hoffmannfi
2913cd4ec0b4SGerd Hoffmann
2914111a38b0SRobert Relyea# check for libcacard for smartcard support
2915111a38b0SRobert Relyeasmartcard_cflags=""
2916111a38b0SRobert Relyea# TODO - what's the minimal nss version we support?
2917111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then
29185f01e06fSSergei Trofimovich  cat > $TMPC << EOF
29195f01e06fSSergei Trofimovich#include <pk11pub.h>
29205f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
29215f01e06fSSergei TrofimovichEOF
29220b22ef0fSPeter Maydell    smartcard_includes="-I\$(SRC_PATH)/libcacard"
29238c741c22SAlon Levy    libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
29248c741c22SAlon Levy    libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
29256ca026cbSPeter Maydell    test_cflags="$libcacard_cflags"
29266ca026cbSPeter Maydell    # The header files in nss < 3.13.3 have a bug which causes them to
29276ca026cbSPeter Maydell    # emit a warning. If we're going to compile QEMU with -Werror, then
29286ca026cbSPeter Maydell    # test that the headers don't have this bug. Otherwise we would pass
29296ca026cbSPeter Maydell    # the configure test but fail to compile QEMU later.
29306ca026cbSPeter Maydell    if test "$werror" = "yes"; then
29316ca026cbSPeter Maydell        test_cflags="-Werror $test_cflags"
29326ca026cbSPeter Maydell    fi
2933b6fc675bSPaolo Bonzini    if test -n "$libtool" &&
2934b6fc675bSPaolo Bonzini            $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
29356ca026cbSPeter Maydell      compile_prog "$test_cflags" "$libcacard_libs"; then
29365f01e06fSSergei Trofimovich        smartcard_nss="yes"
29370b22ef0fSPeter Maydell        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
29380b22ef0fSPeter Maydell        QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
2939ad4cf3f6SPaul Brook        libs_softmmu="$libcacard_libs $libs_softmmu"
2940111a38b0SRobert Relyea    else
2941111a38b0SRobert Relyea        if test "$smartcard_nss" = "yes"; then
2942111a38b0SRobert Relyea            feature_not_found "nss"
2943111a38b0SRobert Relyea        fi
2944111a38b0SRobert Relyea        smartcard_nss="no"
2945111a38b0SRobert Relyea    fi
2946111a38b0SRobert Relyeafi
2947111a38b0SRobert Relyea
294869354a83SHans de Goede# check for usbredirparser for usb network redirection support
294969354a83SHans de Goedeif test "$usb_redir" != "no" ; then
2950b2d1fe67SHans de Goede    if $pkg_config --atleast-version=0.6 libusbredirparser-0.5 >/dev/null 2>&1 ; then
295169354a83SHans de Goede        usb_redir="yes"
29528b626aa7SHans de Goede        usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5 2>/dev/null)
29538b626aa7SHans de Goede        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5 2>/dev/null)
295469354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
295556ab2ad1SAurelien Jarno        libs_softmmu="$libs_softmmu $usb_redir_libs"
295669354a83SHans de Goede    else
295769354a83SHans de Goede        if test "$usb_redir" = "yes"; then
295869354a83SHans de Goede            feature_not_found "usb-redir"
295969354a83SHans de Goede        fi
296069354a83SHans de Goede        usb_redir="no"
296169354a83SHans de Goede    fi
296269354a83SHans de Goedefi
296369354a83SHans de Goede
2964cd4ec0b4SGerd Hoffmann##########################################
2965cd4ec0b4SGerd Hoffmann
2966747bbdf7SBlue Swirl##########################################
29675f6b9e8fSBlue Swirl# check if we have fdatasync
29685f6b9e8fSBlue Swirl
29695f6b9e8fSBlue Swirlfdatasync=no
29705f6b9e8fSBlue Swirlcat > $TMPC << EOF
29715f6b9e8fSBlue Swirl#include <unistd.h>
2972d1722a27SAlexandre Raymondint main(void) {
2973d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2974d1722a27SAlexandre Raymondreturn fdatasync(0);
2975d1722a27SAlexandre Raymond#else
2976e172fe11SStefan Weil#error Not supported
2977d1722a27SAlexandre Raymond#endif
2978d1722a27SAlexandre Raymond}
29795f6b9e8fSBlue SwirlEOF
29805f6b9e8fSBlue Swirlif compile_prog "" "" ; then
29815f6b9e8fSBlue Swirl    fdatasync=yes
29825f6b9e8fSBlue Swirlfi
29835f6b9e8fSBlue Swirl
298494a420b1SStefan Hajnoczi##########################################
2985e78815a5SAndreas Färber# check if we have madvise
2986e78815a5SAndreas Färber
2987e78815a5SAndreas Färbermadvise=no
2988e78815a5SAndreas Färbercat > $TMPC << EOF
2989e78815a5SAndreas Färber#include <sys/types.h>
2990e78815a5SAndreas Färber#include <sys/mman.h>
2991832ce9c2SScott Wood#include <stddef.h>
2992e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2993e78815a5SAndreas FärberEOF
2994e78815a5SAndreas Färberif compile_prog "" "" ; then
2995e78815a5SAndreas Färber    madvise=yes
2996e78815a5SAndreas Färberfi
2997e78815a5SAndreas Färber
2998e78815a5SAndreas Färber##########################################
2999e78815a5SAndreas Färber# check if we have posix_madvise
3000e78815a5SAndreas Färber
3001e78815a5SAndreas Färberposix_madvise=no
3002e78815a5SAndreas Färbercat > $TMPC << EOF
3003e78815a5SAndreas Färber#include <sys/mman.h>
3004832ce9c2SScott Wood#include <stddef.h>
3005e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
3006e78815a5SAndreas FärberEOF
3007e78815a5SAndreas Färberif compile_prog "" "" ; then
3008e78815a5SAndreas Färber    posix_madvise=yes
3009e78815a5SAndreas Färberfi
3010e78815a5SAndreas Färber
3011e78815a5SAndreas Färber##########################################
30121e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID
30131e9737daSRichard Henderson
30141e9737daSRichard Hendersonsigev_thread_id=no
30151e9737daSRichard Hendersoncat > $TMPC << EOF
30161e9737daSRichard Henderson#include <signal.h>
30171e9737daSRichard Hendersonint main(void) {
30181e9737daSRichard Henderson  struct sigevent ev;
30191e9737daSRichard Henderson  ev.sigev_notify = SIGEV_THREAD_ID;
30201e9737daSRichard Henderson  ev._sigev_un._tid = 0;
30211e9737daSRichard Henderson  asm volatile("" : : "g"(&ev));
30221e9737daSRichard Henderson  return 0;
30231e9737daSRichard Henderson}
30241e9737daSRichard HendersonEOF
30251e9737daSRichard Hendersonif compile_prog "" "" ; then
30261e9737daSRichard Henderson    sigev_thread_id=yes
30271e9737daSRichard Hendersonfi
30281e9737daSRichard Henderson
30291e9737daSRichard Henderson##########################################
303094a420b1SStefan Hajnoczi# check if trace backend exists
303194a420b1SStefan Hajnoczi
3032650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
303394a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
303494a420b1SStefan Hajnoczi  echo
303594a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
303694a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
303794a420b1SStefan Hajnoczi  echo
303894a420b1SStefan Hajnoczi  exit 1
303994a420b1SStefan Hajnoczifi
304094a420b1SStefan Hajnoczi
30417e24e92aSStefan Hajnoczi##########################################
30427e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
30437e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
30447e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
30457e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
30467e24e92aSStefan Hajnoczi#include <ust/marker.h>
30477e24e92aSStefan Hajnocziint main(void) { return 0; }
30487e24e92aSStefan HajnocziEOF
30497e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
305094b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
3051c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
30527e24e92aSStefan Hajnoczi  else
30537e24e92aSStefan Hajnoczi    echo
30547e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
30557e24e92aSStefan Hajnoczi    echo
30567e24e92aSStefan Hajnoczi    exit 1
30577e24e92aSStefan Hajnoczi  fi
30587e24e92aSStefan Hajnoczifi
3059b3d08c02SDaniel P. Berrange
3060b3d08c02SDaniel P. Berrange##########################################
3061b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
3062b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
3063b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
3064b3d08c02SDaniel P. Berrange    echo
3065b3d08c02SDaniel P. Berrange    echo "Error: dtrace command is not found in PATH $PATH"
3066b3d08c02SDaniel P. Berrange    echo
3067b3d08c02SDaniel P. Berrange    exit 1
3068b3d08c02SDaniel P. Berrange  fi
3069c276b17dSDaniel P. Berrange  trace_backend_stap="no"
3070c276b17dSDaniel P. Berrange  if has 'stap' ; then
3071c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
3072c276b17dSDaniel P. Berrange  fi
3073b3d08c02SDaniel P. Berrangefi
3074b3d08c02SDaniel P. Berrange
30757e24e92aSStefan Hajnoczi##########################################
3076023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains
3077023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit
3078023367e6SWolfgang Mauerer# specification is necessary
30791ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
3080023367e6SWolfgang Mauerer  cat > $TMPC << EOF
30817ace252aSStefan Weilstatic int sfaa(int *ptr)
3082023367e6SWolfgang Mauerer{
3083023367e6SWolfgang Mauerer  return __sync_fetch_and_and(ptr, 0);
3084023367e6SWolfgang Mauerer}
3085023367e6SWolfgang Mauerer
3086abab1a0fSStefan Weilint main(void)
3087023367e6SWolfgang Mauerer{
3088023367e6SWolfgang Mauerer  int val = 42;
3089023367e6SWolfgang Mauerer  sfaa(&val);
3090023367e6SWolfgang Mauerer  return val;
3091023367e6SWolfgang Mauerer}
3092023367e6SWolfgang MauererEOF
3093023367e6SWolfgang Mauerer  if ! compile_prog "" "" ; then
3094caa50971SPeter Maydell    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
3095023367e6SWolfgang Mauerer  fi
3096023367e6SWolfgang Mauererfi
3097023367e6SWolfgang Mauerer
3098023367e6SWolfgang Mauerer##########################################
3099519175a2SAlex Barcelo# check and set a backend for coroutine
3100d0e2fce5SAneesh Kumar K.V
3101519175a2SAlex Barcelo# default is ucontext, but always fallback to gthread
3102519175a2SAlex Barcelo# windows autodetected by make
3103519175a2SAlex Barceloif test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
3104d0e2fce5SAneesh Kumar K.V  if test "$darwin" != "yes"; then
3105d0e2fce5SAneesh Kumar K.V    cat > $TMPC << EOF
3106d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
3107cdf84806SPeter Maydell#ifdef __stub_makecontext
3108cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
3109cdf84806SPeter Maydell#endif
311075cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
3111d0e2fce5SAneesh Kumar K.VEOF
3112d0e2fce5SAneesh Kumar K.V    if compile_prog "" "" ; then
3113519175a2SAlex Barcelo        coroutine_backend=ucontext
3114519175a2SAlex Barcelo    else
3115519175a2SAlex Barcelo	coroutine_backend=gthread
3116d0e2fce5SAneesh Kumar K.V    fi
3117519175a2SAlex Barcelo  fi
3118519175a2SAlex Barceloelif test "$coroutine" = "gthread" ; then
3119519175a2SAlex Barcelo  coroutine_backend=gthread
3120519175a2SAlex Barceloelif test "$coroutine" = "windows" ; then
3121519175a2SAlex Barcelo  coroutine_backend=windows
3122fe91bfa8SAlex Barceloelif test "$coroutine" = "sigaltstack" ; then
3123fe91bfa8SAlex Barcelo  coroutine_backend=sigaltstack
3124519175a2SAlex Barceloelse
3125519175a2SAlex Barcelo  echo
3126519175a2SAlex Barcelo  echo "Error: unknown coroutine backend $coroutine"
3127519175a2SAlex Barcelo  echo
3128519175a2SAlex Barcelo  exit 1
3129d0e2fce5SAneesh Kumar K.Vfi
3130d0e2fce5SAneesh Kumar K.V
3131d0e2fce5SAneesh Kumar K.V##########################################
3132d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
3133d2042378SAneesh Kumar K.V
31344e1797f9SStefan Weilopen_by_handle_at=no
3135d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
3136d2042378SAneesh Kumar K.V#include <fcntl.h>
3137acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
3138acc55ba8SStefan Weil# error missing definition
3139acc55ba8SStefan Weil#else
314075cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3141acc55ba8SStefan Weil#endif
3142d2042378SAneesh Kumar K.VEOF
3143d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
3144d2042378SAneesh Kumar K.V    open_by_handle_at=yes
3145d2042378SAneesh Kumar K.Vfi
3146d2042378SAneesh Kumar K.V
3147e06a765eSHarsh Prateek Bora########################################
3148e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
3149e06a765eSHarsh Prateek Bora
3150e06a765eSHarsh Prateek Boralinux_magic_h=no
3151e06a765eSHarsh Prateek Boracat > $TMPC << EOF
3152e06a765eSHarsh Prateek Bora#include <linux/magic.h>
3153e06a765eSHarsh Prateek Boraint main(void) {
315475cafad7SStefan Weil  return 0;
3155e06a765eSHarsh Prateek Bora}
3156e06a765eSHarsh Prateek BoraEOF
3157e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
3158e06a765eSHarsh Prateek Bora    linux_magic_h=yes
3159e06a765eSHarsh Prateek Borafi
3160e06a765eSHarsh Prateek Bora
31618ab1bf12SLuiz Capitulino########################################
3162c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed
3163c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries).
3164c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is
3165c95e3080SKevin Wolf# only a warning.
3166c95e3080SKevin Wolf#
3167c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that
3168c95e3080SKevin Wolf# the build doesn't fail anyway.
3169c95e3080SKevin Wolf
317006d71fa1SPeter Maydellpragma_disable_unused_but_set=no
317106d71fa1SPeter Maydellcat > $TMPC << EOF
317206d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3173c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes"
3174c95e3080SKevin Wolf
317506d71fa1SPeter Maydellint main(void) {
317606d71fa1SPeter Maydell    return 0;
317706d71fa1SPeter Maydell}
317806d71fa1SPeter MaydellEOF
317906d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then
3180cc6e3ca9SGerd Hoffmann    pragma_diagnostic_available=yes
3181c95e3080SKevin Wolfelse
3182c95e3080SKevin Wolf    werror=no
318306d71fa1SPeter Maydellfi
318406d71fa1SPeter Maydell
318506d71fa1SPeter Maydell########################################
318662fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h
31873f4349dcSKevin Wolf
31883f4349dcSKevin Wolfvalgrind_h=no
31893f4349dcSKevin Wolfcat > $TMPC << EOF
31903f4349dcSKevin Wolf#include <valgrind/valgrind.h>
319162fe8331SChristian Borntraeger#include <valgrind/memcheck.h>
31923f4349dcSKevin Wolfint main(void) {
31933f4349dcSKevin Wolf  return 0;
31943f4349dcSKevin Wolf}
31953f4349dcSKevin WolfEOF
31963f4349dcSKevin Wolfif compile_prog "" "" ; then
31973f4349dcSKevin Wolf    valgrind_h=yes
31983f4349dcSKevin Wolffi
31993f4349dcSKevin Wolf
32003f4349dcSKevin Wolf########################################
32018ab1bf12SLuiz Capitulino# check if environ is declared
32028ab1bf12SLuiz Capitulino
32038ab1bf12SLuiz Capitulinohas_environ=no
32048ab1bf12SLuiz Capitulinocat > $TMPC << EOF
32058ab1bf12SLuiz Capitulino#include <unistd.h>
32068ab1bf12SLuiz Capitulinoint main(void) {
3207c075a723SBlue Swirl    environ = 0;
32088ab1bf12SLuiz Capitulino    return 0;
32098ab1bf12SLuiz Capitulino}
32108ab1bf12SLuiz CapitulinoEOF
32118ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
32128ab1bf12SLuiz Capitulino    has_environ=yes
32138ab1bf12SLuiz Capitulinofi
32148ab1bf12SLuiz Capitulino
321576a347e1SRichard Henderson########################################
321676a347e1SRichard Henderson# check if cpuid.h is usable.
321776a347e1SRichard Henderson
321876a347e1SRichard Hendersoncpuid_h=no
321976a347e1SRichard Hendersoncat > $TMPC << EOF
322076a347e1SRichard Henderson#include <cpuid.h>
322176a347e1SRichard Hendersonint main(void) {
322276a347e1SRichard Henderson  return 0;
322376a347e1SRichard Henderson}
322476a347e1SRichard HendersonEOF
322576a347e1SRichard Hendersonif compile_prog "" "" ; then
322676a347e1SRichard Henderson    cpuid_h=yes
322776a347e1SRichard Hendersonfi
322876a347e1SRichard Henderson
3229f540166bSRichard Henderson########################################
3230f540166bSRichard Henderson# check if __[u]int128_t is usable.
3231f540166bSRichard Henderson
3232f540166bSRichard Hendersonint128=no
3233f540166bSRichard Hendersoncat > $TMPC << EOF
3234f540166bSRichard Henderson__int128_t a;
3235f540166bSRichard Henderson__uint128_t b;
3236f540166bSRichard Hendersonint main (void) {
3237f540166bSRichard Henderson  a = a + b;
3238f540166bSRichard Henderson  b = a * b;
3239f540166bSRichard Henderson  return 0;
3240f540166bSRichard Henderson}
3241f540166bSRichard HendersonEOF
3242f540166bSRichard Hendersonif compile_prog "" "" ; then
3243f540166bSRichard Henderson    int128=yes
3244f540166bSRichard Hendersonfi
324576a347e1SRichard Henderson
3246d2042378SAneesh Kumar K.V##########################################
3247e86ecd4bSJuan Quintela# End of CC checks
3248e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
3249e86ecd4bSJuan Quintela
32501d728c39SBlue Swirlif test "$gcov" = "yes" ; then
32511d728c39SBlue Swirl  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
32521d728c39SBlue Swirl  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
32531d728c39SBlue Swirlelif test "$debug" = "no" ; then
32548be74dc0SAvi Kivity  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
3255e86ecd4bSJuan Quintelafi
3256a316e378SJuan Quintela
32571d728c39SBlue Swirl
325820ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
325920ff6c80SAnthony Liguori# enable/disable
326020ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
326120ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
326220ff6c80SAnthony Liguori	zero_malloc="no"
326320ff6c80SAnthony Liguori    else
326420ff6c80SAnthony Liguori	zero_malloc="yes"
326520ff6c80SAnthony Liguori    fi
326620ff6c80SAnthony Liguorifi
326720ff6c80SAnthony Liguori
32686ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags
32696ca026cbSPeter Maydellif test "$werror" = "yes"; then
32706ca026cbSPeter Maydell    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
32716ca026cbSPeter Maydellfi
32726ca026cbSPeter Maydell
3273e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
3274e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
32751156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
3276e86ecd4bSJuan Quintela    fi
3277e86ecd4bSJuan Quintelafi
3278e86ecd4bSJuan Quintela
327994dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
328094dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
328194dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
328294dd53c5SGerd Hoffmannelse
328394dd53c5SGerd Hoffmann    POD2MAN="pod2man"
328494dd53c5SGerd Hoffmannfi
328594dd53c5SGerd Hoffmann
3286952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
3287952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
3288952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
3289952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3290952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
3291952afb71SBlue Swirl        fi
3292952afb71SBlue Swirl    done
3293952afb71SBlue Swirlfi
3294952afb71SBlue Swirl
329510ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
3296528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
3297834574eaSAnthony Liguoriqemu_localedir="$datadir/locale"
32985a67135aSbellard
32994b1c11fdSDaniel P. Berrangetools=""
33004b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then
3301ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
33024b1c11fdSDaniel P. Berrange  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
33034b1c11fdSDaniel P. Berrange    tools="qemu-nbd\$(EXESUF) $tools"
33044b1c11fdSDaniel P. Berrange  fi
33054b1c11fdSDaniel P. Berrangefi
33064b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then
3307983eef5aSMeador Inge  if test "$virtfs" != no ; then
3308be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3309983eef5aSMeador Inge      virtfs=yes
331017bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3311983eef5aSMeador Inge    else
3312983eef5aSMeador Inge      if test "$virtfs" = yes; then
3313263ddcc8SHarsh Prateek Bora        echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3314263ddcc8SHarsh Prateek Bora        exit 1
3315983eef5aSMeador Inge      fi
331617500370SAndreas Färber      virtfs=no
3317983eef5aSMeador Inge    fi
331817bff52bSM. Mohan Kumar  fi
3319ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3320d138cee9SMichael Roth    if [ "$guest_agent" = "yes" ]; then
332148ff7a62SMichael Roth      tools="qemu-ga\$(EXESUF) $tools"
3322d138cee9SMichael Roth    fi
3323ca35f780SPaolo Bonzini  fi
33244b1c11fdSDaniel P. Berrangefi
3325ca35f780SPaolo Bonzini
3326ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
3327ca35f780SPaolo Bonziniroms=
3328ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3329ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3330ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
3331ca35f780SPaolo Bonzini  roms="optionrom"
3332ca35f780SPaolo Bonzinifi
3333d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
333439ac8455SDavid Gibson  roms="$roms spapr-rtas"
333539ac8455SDavid Gibsonfi
3336ca35f780SPaolo Bonzini
33375ca9388aSGerd Hoffmann# add pixman flags after all config tests are done
33385ca9388aSGerd HoffmannQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags"
33395ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs"
33405ca9388aSGerd Hoffmann
33417d13299dSbellardecho "Install prefix    $prefix"
3342c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
3343f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
33443aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
33458bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`"
33460f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
33471c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
3348785c23aeSLuiz Capitulinoecho "local state directory   `eval echo $local_statedir`"
334911d9f695Sbellardif test "$mingw32" = "no" ; then
3350f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
335143ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
335211d9f695Sbellardfi
33535a67135aSbellardecho "Source path       $source_path"
33547d13299dSbellardecho "C compiler        $cc"
335583469015Sbellardecho "Host C compiler   $host_cc"
33563c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc"
33570c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
3358a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
33590c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
33607d13299dSbellardecho "make              $make"
33616a882643Spbrookecho "install           $install"
3362c886edfbSBlue Swirlecho "python            $python"
3363e2d8830eSBradif test "$slirp" = "yes" ; then
3364e2d8830eSBrad    echo "smbd              $smbd"
3365e2d8830eSBradfi
3366a98fd896Sbellardecho "host CPU          $cpu"
3367de83cd02Sbellardecho "host big endian   $bigendian"
336897a847bcSbellardecho "target list       $target_list"
3369ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
33707d13299dSbellardecho "gprof enabled     $gprof"
337103b4fe7dSaliguoriecho "sparse enabled    $sparse"
33721625af87Saliguoriecho "strip binaries    $strip_opt"
337305c2a3e7Sbellardecho "profiler          $profiler"
337443ce4dfeSbellardecho "static build      $static"
337585aa5189Sbellardecho "-Werror enabled   $werror"
33765b0753e0Sbellardif test "$darwin" = "yes" ; then
33775b0753e0Sbellard    echo "Cocoa support     $cocoa"
33785b0753e0Sbellardfi
3379e2134eb9SGerd Hoffmannecho "pixman            $pixman"
338097a847bcSbellardecho "SDL support       $sdl"
3381a4ccabcfSAnthony Liguoriecho "GTK support       $gtk"
33824d3b6f6eSbalrogecho "curses support    $curses"
3383769ce76dSAlexander Grafecho "curl support      $curl"
338467b915a5Sbellardecho "mingw32 support   $mingw32"
33850c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
33860c58ac1cSmalcecho "Extra audio cards $audio_card_list"
3387eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
33888ff9cbf7Smalcecho "Mixer emulation   $mixemu"
3389983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3390821601eaSJes Sorensenecho "VNC support       $vnc"
3391821601eaSJes Sorensenif test "$vnc" = "yes" ; then
33928d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
33932f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
33942f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3395efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
33967536ee4bSTim Hardeck    echo "VNC WS support    $vnc_ws"
3397821601eaSJes Sorensenfi
33983142255cSblueswir1if test -n "$sparc_cpu"; then
33993142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
34003142255cSblueswir1fi
3401e37630caSaliguoriecho "xen support       $xen"
34022e4d9fb1Saurel32echo "brlapi support    $brlapi"
3403a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3404a25dba17SJuan Quintelaecho "Documentation     $docs"
3405c5937220Spbrook[ ! -z "$uname_release" ] && \
3406c5937220Spbrookecho "uname -r          $uname_release"
3407bd0c5661Spbrookecho "NPTL support      $nptl"
3408379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
340940d6444eSAvi Kivityecho "PIE               $pie"
34108a16d273Sthsecho "vde support       $vde"
34115c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3412758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
341377755340Sthsecho "Install blobs     $blobs"
3414b31a0277SJuan Quintelaecho "KVM support       $kvm"
34159195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3416f652e6afSaurel32echo "fdt support       $fdt"
3417ceb42de8Saliguoriecho "preadv support    $preadv"
34185f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3419e78815a5SAndreas Färberecho "madvise           $madvise"
3420e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
34211e9737daSRichard Hendersonecho "sigev_thread_id   $sigev_thread_id"
3422ee682d27SStefan Weilecho "uuid support      $uuid"
342347e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3424d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
342594a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
34269410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
34272e0e3c39SAlon Levyecho "spice support     $spice ($spice_protocol_version/$spice_server_version)"
3428f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3429dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3430111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
343169354a83SHans de Goedeecho "usb net redir     $usb_redir"
3432*b1e5fff4SMichael Walleecho "GLX support       $glx"
3433c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3434d138cee9SMichael Rothecho "build guest agent $guest_agent"
3435f794573eSEduardo Otuboecho "seccomp support   $seccomp"
3436519175a2SAlex Barceloecho "coroutine backend $coroutine_backend"
3437eb100396SBharata B Raoecho "GlusterFS support $glusterfs"
3438583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane"
34391d728c39SBlue Swirlecho "gcov              $gcov_tool"
34401d728c39SBlue Swirlecho "gcov enabled      $gcov"
3441ab214c29SStefan Bergerecho "TPM support       $tpm"
344267b915a5Sbellard
34431ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
344424b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3445e8cd23deSbellardfi
344697a847bcSbellard
344798ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
34484bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
344997a847bcSbellard
3450dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak
3451dbd99ae3SStefan Weil
345298ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
345398ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
345498ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
345598ec69acSJuan Quintelaecho >> $config_host_mak
345698ec69acSJuan Quintela
3457e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
345899d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
345999d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
34603aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
34618bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak
34620f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
346399d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
346499d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
346522d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
34669afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
34679afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
3468785c23aeSLuiz Capitulinoecho "qemu_localstatedir=$local_statedir" >> $config_host_mak
3469f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak
3470f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
3471f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
3472834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak
3473804edf29SJuan Quintela
347498ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3475f8393946Saurel32if test "$debug_tcg" = "yes" ; then
34762358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3477f8393946Saurel32fi
3478f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
34792358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
3480f3d08ee6SPaul Brookfi
34811625af87Saliguoriif test "$strip_opt" = "yes" ; then
348252ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
34831625af87Saliguorifi
34847d13299dSbellardif test "$bigendian" = "yes" ; then
3485e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
348697a847bcSbellardfi
348767b915a5Sbellardif test "$mingw32" = "yes" ; then
348898ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
34899fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
34909fe6de94SBlue Swirl  version_major=${rc_version%%.*}
34919fe6de94SBlue Swirl  rc_version=${rc_version#*.}
34929fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
34939fe6de94SBlue Swirl  rc_version=${rc_version#*.}
34949fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
34959fe6de94SBlue Swirl  version_micro=0
34969fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
34979fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3498210fa556Spbrookelse
349935f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3500210fa556Spbrookfi
3501128ab2ffSblueswir1
3502dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3503dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3504dffcb71cSMark McLoughlinfi
3505dffcb71cSMark McLoughlin
350683fb7adfSbellardif test "$darwin" = "yes" ; then
350798ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
350883fb7adfSbellardfi
3509b29fe3edSmalc
3510b29fe3edSmalcif test "$aix" = "yes" ; then
351198ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3512b29fe3edSmalcfi
3513b29fe3edSmalc
3514ec530c81Sbellardif test "$solaris" = "yes" ; then
351598ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
35162358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
35170475a5caSths  if test "$needs_libsunmath" = "yes" ; then
351875b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
35190475a5caSths  fi
3520ec530c81Sbellardfi
3521179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3522179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3523179cf400SAndreas Färberfi
352497a847bcSbellardif test "$static" = "yes" ; then
352598ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
352697a847bcSbellardfi
35271ba16968SStefan Weilif test "$profiler" = "yes" ; then
35282358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
352905c2a3e7Sbellardfi
3530c20709aaSbellardif test "$slirp" = "yes" ; then
353198ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3532e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3533c20709aaSbellardfi
35348a16d273Sthsif test "$vde" = "yes" ; then
353598ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
35368a16d273Sthsfi
353747e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
353847e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
353947e98658SCorey Bryantfi
35400c58ac1cSmalcfor card in $audio_card_list; do
3541bb55b712SStefan Weil    def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
354298ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
35430c58ac1cSmalcdone
35442358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
35450c58ac1cSmalcfor drv in $audio_drv_list; do
3546bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
354798ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3548923e4521Smalc    if test "$drv" = "fmod"; then
35497aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3550fb065187Sbellard    fi
35510c58ac1cSmalcdone
355267f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
355367f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
355467f86e8eSJuan Quintelafi
3555d5631638Smalcif test "$audio_win_int" = "yes" ; then
3556d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3557d5631638Smalcfi
3558eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
35598ff9cbf7Smalcif test "$mixemu" = "yes" ; then
356098ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
35618ff9cbf7Smalcfi
3562821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3563821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3564821601eaSJes Sorensenfi
35658d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
356698ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
35678d5d2d4cSthsfi
35682f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
356998ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
35702f9606b3Saliguorifi
3571821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
35722f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
35732f6f5c7aSCorentin Charyfi
3574821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3575efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3576efe556adSCorentin Charyfi
35777536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then
35787536ee4bSTim Hardeck  echo "CONFIG_VNC_WS=y" >> $config_host_mak
35797536ee4bSTim Hardeck  echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
35807536ee4bSTim Hardeckfi
358176655d6dSaliguoriif test "$fnmatch" = "yes" ; then
35822358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
358376655d6dSaliguorifi
3584ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3585ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3586ee682d27SStefan Weilfi
3587dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3588dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3589dce512deSChristoph Hellwigfi
3590b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
359198ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
35922358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
359398ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
359498ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3595a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
359698ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3597cc8ae6deSpbrookfi
35981ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
359998ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
36008ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
360149ecc3faSbellardfi
360249ecc3faSbellardif test "$cocoa" = "yes" ; then
360398ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
360449ecc3faSbellardfi
36054d3b6f6eSbalrogif test "$curses" = "yes" ; then
360698ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3607ab4e5602SJan Kiszkafi
36083b3f24adSaurel32if test "$atfile" = "yes" ; then
36092358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
36103b3f24adSaurel32fi
3611ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
36122358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3613ebc996f3SRiku Voipiofi
3614099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
36152358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3616099d6b0fSRiku Voipiofi
361740ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
361840ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
361940ff6d7eSKevin Wolffi
36203ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
36212358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
36223ce34dfbSvibisreenivasanfi
3623c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3624c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3625c2882b96SRiku Voipiofi
3626d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3627d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3628d0927938SUlrich Hechtfi
36293d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then
36303d4fa43eSKusanagi Kouichi  echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
36313d4fa43eSKusanagi Kouichifi
3632c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3633c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3634c727f47dSPeter Maydellfi
3635dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3636dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3637dace20dcSPeter Maydellfi
3638d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3639d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3640d0927938SUlrich Hechtfi
36413b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
36423b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
36433b6edd16SPeter Maydellfi
36443b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
36453b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
36463b6edd16SPeter Maydellfi
36473b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
36483b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
36493b6edd16SPeter Maydellfi
3650a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then
3651a8fd1abaSPeter Maydell  echo "CONFIG_SENDFILE=y" >> $config_host_mak
3652a8fd1abaSPeter Maydellfi
36533b3f24adSaurel32if test "$inotify" = "yes" ; then
36542358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
36553b3f24adSaurel32fi
3656c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
3657c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3658c05c7a73SRiku Voipiofi
36596ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
36606ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
36616ae9a1f4SJuan Quintelafi
36626ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
36636ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
36646ae9a1f4SJuan Quintelafi
3665769ce76dSAlexander Grafif test "$curl" = "yes" ; then
366698ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
3667b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3668769ce76dSAlexander Graffi
36692e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
367098ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
36712e4d9fb1Saurel32fi
3672fb599c9aSbalrogif test "$bluez" = "yes" ; then
367398ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
3674ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3675fb599c9aSbalrogfi
3676e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3677a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then
3678a4ccabcfSAnthony Liguori  echo "CONFIG_GTK=y" >> $config_host_mak
3679a4ccabcfSAnthony Liguori  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
3680a4ccabcfSAnthony Liguori  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
3681a4ccabcfSAnthony Liguorifi
3682e37630caSaliguoriif test "$xen" = "yes" ; then
36836dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3684d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3685e37630caSaliguorifi
36865c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
36875c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
36885c6c3a6cSChristoph Hellwigfi
3689758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
3690758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
3691758e8e38SVenkateswararao Jujjuri (JV)fi
36924f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
36934f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
36944f26f2b6SAvi Kivityfi
3695983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
3696758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
3697758e8e38SVenkateswararao Jujjuri (JV)fi
369877755340Sthsif test "$blobs" = "yes" ; then
369998ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
370077755340Sthsfi
3701bf9298b9Saliguoriif test "$iovec" = "yes" ; then
37022358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
3703bf9298b9Saliguorifi
3704ceb42de8Saliguoriif test "$preadv" = "yes" ; then
37052358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
3706ceb42de8Saliguorifi
3707f652e6afSaurel32if test "$fdt" = "yes" ; then
37083f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
3709f652e6afSaurel32fi
3710dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
3711dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3712dcc38d1cSMarcelo Tosattifi
37139195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
37149195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
37159195b2c2SStefan Weilfi
37165f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
37175f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
37185f6b9e8fSBlue Swirlfi
3719e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
3720e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
3721e78815a5SAndreas Färberfi
3722e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
3723e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3724e78815a5SAndreas Färberfi
37251e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then
37261e9737daSRichard Henderson  echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
37271e9737daSRichard Hendersonfi
372897a847bcSbellard
3729cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
3730cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
3731cd4ec0b4SGerd Hoffmannfi
3732cd4ec0b4SGerd Hoffmann
3733111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3734111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3735ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3736ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3737111a38b0SRobert Relyeafi
3738111a38b0SRobert Relyea
373969354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
374069354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
374169354a83SHans de Goedefi
374269354a83SHans de Goede
3743*b1e5fff4SMichael Walleif test "$glx" = "yes" ; then
3744*b1e5fff4SMichael Walle  echo "CONFIG_GLX=y" >> $config_host_mak
374520ff075bSMichael Wallefi
374620ff075bSMichael Walle
3747c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
3748c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3749c589b249SRonnie Sahlbergfi
3750c589b249SRonnie Sahlberg
3751f794573eSEduardo Otuboif test "$seccomp" = "yes"; then
3752f794573eSEduardo Otubo  echo "CONFIG_SECCOMP=y" >> $config_host_mak
3753f794573eSEduardo Otubofi
3754f794573eSEduardo Otubo
375583fb7adfSbellard# XXX: suppress that
37567d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
37572358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
37587d3505c5Sbellardfi
37597d3505c5Sbellard
37602358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3761c5937220Spbrook
376220ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
376320ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
376420ff6c80SAnthony Liguorifi
3765f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
3766f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
3767f27aaf4bSChristian Brunnerfi
376820ff6c80SAnthony Liguori
3769519175a2SAlex Barceloif test "$coroutine_backend" = "ucontext" ; then
3770d0e2fce5SAneesh Kumar K.V  echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3771fe91bfa8SAlex Barceloelif test "$coroutine_backend" = "sigaltstack" ; then
3772fe91bfa8SAlex Barcelo  echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
3773d0e2fce5SAneesh Kumar K.Vfi
3774d0e2fce5SAneesh Kumar K.V
3775d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
3776d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3777d2042378SAneesh Kumar K.Vfi
3778d2042378SAneesh Kumar K.V
3779e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
3780e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3781e06a765eSHarsh Prateek Borafi
3782e06a765eSHarsh Prateek Bora
3783cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then
3784cc6e3ca9SGerd Hoffmann  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
378506d71fa1SPeter Maydellfi
378606d71fa1SPeter Maydell
37873f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then
37883f4349dcSKevin Wolf  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
37893f4349dcSKevin Wolffi
37903f4349dcSKevin Wolf
37918ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
37928ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
37938ab1bf12SLuiz Capitulinofi
37948ab1bf12SLuiz Capitulino
379576a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then
379676a347e1SRichard Henderson  echo "CONFIG_CPUID_H=y" >> $config_host_mak
379776a347e1SRichard Hendersonfi
379876a347e1SRichard Henderson
3799f540166bSRichard Hendersonif test "$int128" = "yes" ; then
3800f540166bSRichard Henderson  echo "CONFIG_INT128=y" >> $config_host_mak
3801f540166bSRichard Hendersonfi
3802f540166bSRichard Henderson
3803eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then
3804eb100396SBharata B Rao  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
3805eb100396SBharata B Raofi
3806eb100396SBharata B Rao
3807583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then
3808583f6e7bSStefan Hajnoczi  echo "CONFIG_VIRTIO_BLK_DATA_PLANE=y" >> $config_host_mak
3809583f6e7bSStefan Hajnoczifi
3810583f6e7bSStefan Hajnoczi
381168063649Sblueswir1# USB host support
381268063649Sblueswir1case "$usb" in
381368063649Sblueswir1linux)
38144075975dSGerd Hoffmann  echo "HOST_USB=linux legacy" >> $config_host_mak
381568063649Sblueswir1;;
381668063649Sblueswir1bsd)
381798ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
381868063649Sblueswir1;;
381968063649Sblueswir1*)
382098ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
382168063649Sblueswir1;;
382268063649Sblueswir1esac
382368063649Sblueswir1
3824e4858974SLluís# use default implementation for tracing backend-specific routines
3825e4858974SLluístrace_default=yes
382694a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
38276d8a764eSLluísif test "$trace_backend" = "nop"; then
38286d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
382922890ab5SPrerna Saxenafi
38309410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
38316d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3832e4858974SLluís  trace_default=no
38336d8a764eSLluís  # Set the appropriate trace file.
3834953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
38359410b56cSPrerna Saxenafi
38366d8a764eSLluísif test "$trace_backend" = "stderr"; then
38376d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
38389a82b6a5SLluís  trace_default=no
38396d8a764eSLluísfi
38406d8a764eSLluísif test "$trace_backend" = "ust"; then
38416d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
38426d8a764eSLluísfi
38436d8a764eSLluísif test "$trace_backend" = "dtrace"; then
38446d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
38456d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
38466d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
38476d8a764eSLluís  fi
3848c276b17dSDaniel P. Berrangefi
38499410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3850e4858974SLluísif test "$trace_default" = "yes"; then
3851e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3852e4858974SLluísfi
38539410b56cSPrerna Saxena
385498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
385598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
3856804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
3857804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
38581901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
38591901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
386021655882SPaolo Bonziniif test -n "$libtool"; then
386121655882SPaolo Bonzini  echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
386221655882SPaolo Bonzini  echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
386321655882SPaolo Bonzinielse
38641901cb14SBrad  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
386521655882SPaolo Bonzini  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
386621655882SPaolo Bonzinifi
3867c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
3868804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
38692b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
3870804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
38713c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak
3872804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
38733dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak
38743dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak
3875804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
3876804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
38779fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
387844dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
3879e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
3880a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3881f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3882e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
3883e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
3884e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
3885e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3886e39f0062SPaolo Bonzinifi
388742da6041SGerd Hoffmannif test "$cross_prefix" != ""; then
388842da6041SGerd Hoffmann  echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
388942da6041SGerd Hoffmannelse
389042da6041SGerd Hoffmann  echo "AUTOCONF_HOST := "                             >> $config_host_mak
389142da6041SGerd Hoffmannfi
3892e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
3893a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3894a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
389573da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
38963e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3897804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
3898957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
389994dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
3900cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
39011d728c39SBlue Swirlif test "$gcov" = "yes" ; then
39021d728c39SBlue Swirl  echo "CONFIG_GCOV=y" >> $config_host_mak
39031d728c39SBlue Swirl  echo "GCOV=$gcov_tool" >> $config_host_mak
39041d728c39SBlue Swirlfi
3905804edf29SJuan Quintela
39064bf6b55bSJuan Quintela# generate list of library paths for linker script
39074bf6b55bSJuan Quintela
39084bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
39094bf6b55bSJuan Quintela
39104bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
39114bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
39124bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
39134bf6b55bSJuan Quintela  else
39144bf6b55bSJuan Quintela    rm ${config_host_ld}~
39154bf6b55bSJuan Quintela  fi
39164bf6b55bSJuan Quintelafi
39174bf6b55bSJuan Quintela
39186efd7517SPeter Maydell# use included Linux headers
39196efd7517SPeter Maydellif test "$linux" = "yes" ; then
3920a307beb6SAndreas Färber  mkdir -p linux-headers
39216efd7517SPeter Maydell  case "$cpu" in
39226efd7517SPeter Maydell  i386|x86_64)
392308312a63SPeter Maydell    linux_arch=x86
39246efd7517SPeter Maydell    ;;
39256efd7517SPeter Maydell  ppcemb|ppc|ppc64)
392608312a63SPeter Maydell    linux_arch=powerpc
39276efd7517SPeter Maydell    ;;
39286efd7517SPeter Maydell  s390x)
392908312a63SPeter Maydell    linux_arch=s390
393008312a63SPeter Maydell    ;;
393108312a63SPeter Maydell  *)
393208312a63SPeter Maydell    # For most CPUs the kernel architecture name and QEMU CPU name match.
393308312a63SPeter Maydell    linux_arch="$cpu"
39346efd7517SPeter Maydell    ;;
39356efd7517SPeter Maydell  esac
393608312a63SPeter Maydell    # For non-KVM architectures we will not have asm headers
393708312a63SPeter Maydell    if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
393808312a63SPeter Maydell      symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
393908312a63SPeter Maydell    fi
39406efd7517SPeter Maydellfi
39416efd7517SPeter Maydell
394297a847bcSbellardfor target in $target_list; do
394397a847bcSbellardtarget_dir="$target"
394425be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
3945600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
394697a847bcSbellardtarget_bigendian="no"
39471f3d3c8fSJuan Quintela
3948ea2d6a39SJuan Quintelacase "$target_arch2" in
3949e67db06eSJia Liu  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3950ea2d6a39SJuan Quintela  target_bigendian=yes
3951ea2d6a39SJuan Quintela  ;;
3952ea2d6a39SJuan Quintelaesac
395397a847bcSbellardtarget_softmmu="no"
3954997344f3Sbellardtarget_user_only="no"
3955831b7825Sthstarget_linux_user="no"
395684778508Sblueswir1target_bsd_user="no"
39579e407a85Spbrookcase "$target" in
3958600309b6SBlue Swirl  ${target_arch2}-softmmu)
39599e407a85Spbrook    target_softmmu="yes"
39609e407a85Spbrook    ;;
3961600309b6SBlue Swirl  ${target_arch2}-linux-user)
39629c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
39639c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
39649c7a4202SBlue Swirl      exit 1
39659c7a4202SBlue Swirl    fi
39669e407a85Spbrook    target_user_only="yes"
39679e407a85Spbrook    target_linux_user="yes"
39689e407a85Spbrook    ;;
3969600309b6SBlue Swirl  ${target_arch2}-bsd-user)
39709cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
39719c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
39729c7a4202SBlue Swirl      exit 1
39739c7a4202SBlue Swirl    fi
397484778508Sblueswir1    target_user_only="yes"
397584778508Sblueswir1    target_bsd_user="yes"
397684778508Sblueswir1    ;;
39779e407a85Spbrook  *)
39789e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
39799e407a85Spbrook    exit 1
39809e407a85Spbrook    ;;
39819e407a85Spbrookesac
3982831b7825Sths
398397a847bcSbellardmkdir -p $target_dir
398425be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
398597a847bcSbellard
3986e5fe0c52Spbrookbflt="no"
3987bd0c5661Spbrooktarget_nptl="no"
3988600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
398956aebc89Spbrookgdb_xml_files=""
3990c2e3dee6SLaurent Viviertarget_short_alignment=2
3991c2e3dee6SLaurent Viviertarget_int_alignment=4
3992c2e3dee6SLaurent Viviertarget_long_alignment=4
3993c2e3dee6SLaurent Viviertarget_llong_alignment=8
3994de3a354aSMichael Walletarget_libs_softmmu=
39957ba1e619Saliguori
3996938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
39976acff7daSJuan QuintelaTARGET_BASE_ARCH=""
3998e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
3999e73aae67SJuan Quintela
4000600309b6SBlue Swirlcase "$target_arch2" in
40012408a527Saurel32  i386)
40022408a527Saurel32  ;;
40032408a527Saurel32  x86_64)
40046acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
4005c2e3dee6SLaurent Vivier    target_long_alignment=8
40062408a527Saurel32  ;;
40072408a527Saurel32  alpha)
4008c2e3dee6SLaurent Vivier    target_long_alignment=8
4009a4b388ffSRichard Henderson    target_nptl="yes"
40102408a527Saurel32  ;;
40112408a527Saurel32  arm|armeb)
4012b498c8a0SJuan Quintela    TARGET_ARCH=arm
4013e5fe0c52Spbrook    bflt="yes"
4014bd0c5661Spbrook    target_nptl="yes"
401556aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
4016c2e3dee6SLaurent Vivier    target_llong_alignment=4
40172408a527Saurel32  ;;
40182408a527Saurel32  cris)
4019253bd7f8Sedgar_igl    target_nptl="yes"
40202408a527Saurel32  ;;
4021613a22c9SMichael Walle  lm32)
4022*b1e5fff4SMichael Walle    target_libs_softmmu="$glx_libs"
4023613a22c9SMichael Walle  ;;
40242408a527Saurel32  m68k)
40250938cda5Saurel32    bflt="yes"
402656aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
4027c2e3dee6SLaurent Vivier    target_int_alignment=2
4028c2e3dee6SLaurent Vivier    target_long_alignment=2
4029c2e3dee6SLaurent Vivier    target_llong_alignment=2
40302408a527Saurel32  ;;
4031877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
4032877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
403372b675caSEdgar E. Iglesias    bflt="yes"
403472b675caSEdgar E. Iglesias    target_nptl="yes"
403572b675caSEdgar E. Iglesias  ;;
40362408a527Saurel32  mips|mipsel)
4037b498c8a0SJuan Quintela    TARGET_ARCH=mips
403825be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
4039f04dc72fSPaul Brook    target_nptl="yes"
40402408a527Saurel32  ;;
40412408a527Saurel32  mipsn32|mipsn32el)
4042597e2cecSRichard Henderson    TARGET_ARCH=mips64
40436acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
404425be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4045597e2cecSRichard Henderson    echo "TARGET_ABI32=y" >> $config_target_mak
40462408a527Saurel32  ;;
40472408a527Saurel32  mips64|mips64el)
4048b498c8a0SJuan Quintela    TARGET_ARCH=mips64
40496acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
405025be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
4051c2e3dee6SLaurent Vivier    target_long_alignment=8
40522408a527Saurel32  ;;
4053e67db06eSJia Liu  or32)
4054e67db06eSJia Liu    TARGET_ARCH=openrisc
4055e67db06eSJia Liu    TARGET_BASE_ARCH=openrisc
4056e67db06eSJia Liu  ;;
40572408a527Saurel32  ppc)
4058c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4059d6630708SNathan Froyd    target_nptl="yes"
40602408a527Saurel32  ;;
40612408a527Saurel32  ppcemb)
40626acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4063e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4064c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4065d6630708SNathan Froyd    target_nptl="yes"
40662408a527Saurel32  ;;
40672408a527Saurel32  ppc64)
40686acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4069e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4070c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4071c2e3dee6SLaurent Vivier    target_long_alignment=8
40722408a527Saurel32  ;;
40732408a527Saurel32  ppc64abi32)
4074b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
40756acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4076e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
407725be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
4078c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
40792408a527Saurel32  ;;
40802408a527Saurel32  sh4|sh4eb)
4081b498c8a0SJuan Quintela    TARGET_ARCH=sh4
40824dbed897Spbrook    bflt="yes"
40830b6d3ae0Saurel32    target_nptl="yes"
40842408a527Saurel32  ;;
40852408a527Saurel32  sparc)
40862408a527Saurel32  ;;
40872408a527Saurel32  sparc64)
40886acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4089c2e3dee6SLaurent Vivier    target_long_alignment=8
40902408a527Saurel32  ;;
40912408a527Saurel32  sparc32plus)
4092b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
40936acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4094e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
409525be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
40962408a527Saurel32  ;;
409724e804ecSAlexander Graf  s390x)
4098bc434676SUlrich Hecht    target_nptl="yes"
40997b3da903SAlexander Graf    target_long_alignment=8
410024e804ecSAlexander Graf  ;;
4101d2fbca94SGuan Xuetao  unicore32)
4102d2fbca94SGuan Xuetao  ;;
4103cfa550c6SMax Filippov  xtensa|xtensaeb)
4104cfa550c6SMax Filippov    TARGET_ARCH=xtensa
4105cfa550c6SMax Filippov  ;;
41062408a527Saurel32  *)
4107de83cd02Sbellard    echo "Unsupported target CPU"
4108de83cd02Sbellard    exit 1
41092408a527Saurel32  ;;
41102408a527Saurel32esac
41115e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
41125e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
41135e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
41145e8861a0SPaolo Bonzinifi
41155e8861a0SPaolo Bonzini
41165e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
41175e8861a0SPaolo Bonzini
411899afc91dSDaniel P. Berrangeupper() {
411999afc91dSDaniel P. Berrange    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
412099afc91dSDaniel P. Berrange}
412199afc91dSDaniel P. Berrange
412232761257SYeongkyoon Leecase "$cpu" in
4123ed224a56Smalc  i386|x86_64|ppc)
412413586813SStefan Weil    # The TCG interpreter currently does not support ld/st optimization.
412513586813SStefan Weil    if test "$tcg_interpreter" = "no" ; then
412632761257SYeongkyoon Lee        echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_target_mak
412713586813SStefan Weil    fi
412832761257SYeongkyoon Lee  ;;
412932761257SYeongkyoon Leeesac
413032761257SYeongkyoon Lee
4131c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
4132c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
4133c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
4134c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
413525be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
413699afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`"
413725be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
413825be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
413999afc91dSDaniel P. Berrangeecho "TARGET_TYPE=TARGET_TYPE_`upper $target_arch2`" >> $config_target_mak
414025be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4141e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
4142e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
4143e6e91b9cSJuan Quintelafi
414425be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
41451b0c87fcSJuan Quintelacase "$target_arch2" in
41461b0c87fcSJuan Quintela  i386|x86_64)
41471b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
414825be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
4149eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
4150eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4151eb6fda0fSAnthony PERARD      fi
415259d21e53SAlexander Graf    else
415359d21e53SAlexander Graf      echo "CONFIG_NO_XEN=y" >> $config_target_mak
4154432d268cSJun Nakajima    fi
415559d21e53SAlexander Graf    ;;
415659d21e53SAlexander Graf  *)
415759d21e53SAlexander Graf    echo "CONFIG_NO_XEN=y" >> $config_target_mak
41581b0c87fcSJuan Quintelaesac
4159c59249f9SJuan Quintelacase "$target_arch2" in
416068b05c42SPeter Maydell  arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4161c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
4162c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4163c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
4164c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
41655f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4166adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4167adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4168c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
4169c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
417025be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
41711ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
4172d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4173d5970055SMichael S. Tsirkin      fi
4174c59249f9SJuan Quintela    fi
4175c59249f9SJuan Quintelaesac
4176fae001f5SWen Congyangcase "$target_arch2" in
4177fae001f5SWen Congyang  i386|x86_64)
4178fae001f5SWen Congyang    echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak
4179fae001f5SWen Congyangesac
4180de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
418125be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
418297a847bcSbellardfi
418397a847bcSbellardif test "$target_softmmu" = "yes" ; then
418425be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4185de3a354aSMichael Walle  echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
41869fecbed0SWen Congyang  case "$target_arch2" in
41879fecbed0SWen Congyang    i386|x86_64)
41889fecbed0SWen Congyang      echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak
41899fecbed0SWen Congyang  esac
4190de83cd02Sbellardfi
4191997344f3Sbellardif test "$target_user_only" = "yes" ; then
419225be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4193a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4194997344f3Sbellardfi
4195831b7825Sthsif test "$target_linux_user" = "yes" ; then
419625be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4197831b7825Sthsfi
419856aebc89Spbrooklist=""
419956aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
420056aebc89Spbrook  for x in $gdb_xml_files; do
420156aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
420256aebc89Spbrook  done
420325be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
42043d0f1517SJuan Quintelafi
4205de83cd02Sbellard
4206e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
420725be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4208e5fe0c52Spbrookfi
4209bd0c5661Spbrookif test "$target_user_only" = "yes" \
4210bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
421125be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
4212bd0c5661Spbrookfi
4213379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
421425be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4215379f6698SPaul Brookfi
421684778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
421725be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
421884778508Sblueswir1fi
42195b0753e0Sbellard
42205a4d701aSJan Kiszka# the static way of configuring available audio cards requires this workaround
42215a4d701aSJan Kiszkaif test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then
42225a4d701aSJan Kiszka  echo "CONFIG_PCSPK=y" >> $config_target_mak
42235a4d701aSJan Kiszkafi
42245a4d701aSJan Kiszka
42254afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
4226fa282484SJuan Quintela
42274afddb55SJuan Quintelacflags=""
4228f9728943SPaolo Bonziniincludes=""
4229fa282484SJuan Quintelaldflags=""
42309b8e111fSJuan Quintela
42319195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then
42329195b2c2SStefan Weil  includes="-I\$(SRC_PATH)/tcg/tci $includes"
42339195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then
4234f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
423524e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
4236f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
42375d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
4238f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
423957ddfbf7SJuan Quintelaelse
4240f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
424157ddfbf7SJuan Quintelafi
4242f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
424357ddfbf7SJuan Quintela
42446efd7517SPeter Maydellif test "$linux" = "yes" ; then
42456efd7517SPeter Maydell  includes="-I\$(SRC_PATH)/linux-headers $includes"
42466efd7517SPeter Maydellfi
42476efd7517SPeter Maydell
424864656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
424964656024SJuan Quintela  case "$i" in
425064656024SJuan Quintela  alpha)
425125be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
425276cad711SPaolo Bonzini    echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
425364656024SJuan Quintela  ;;
425464656024SJuan Quintela  arm)
425525be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
425676cad711SPaolo Bonzini    echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
425764656024SJuan Quintela  ;;
425864656024SJuan Quintela  cris)
425925be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
426076cad711SPaolo Bonzini    echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
426164656024SJuan Quintela  ;;
426264656024SJuan Quintela  hppa)
426325be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
426476cad711SPaolo Bonzini    echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
426564656024SJuan Quintela  ;;
426664656024SJuan Quintela  i386|x86_64)
426725be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
426876cad711SPaolo Bonzini    echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
426964656024SJuan Quintela  ;;
4270903ec55cSAurelien Jarno  ia64*)
4271903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
427276cad711SPaolo Bonzini    echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4273903ec55cSAurelien Jarno  ;;
427479368f49SMichael Walle  lm32)
427579368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
427676cad711SPaolo Bonzini    echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
427779368f49SMichael Walle  ;;
427864656024SJuan Quintela  m68k)
427925be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
428076cad711SPaolo Bonzini    echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
428164656024SJuan Quintela  ;;
4282877fdc12SEdgar E. Iglesias  microblaze*)
428325be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
428476cad711SPaolo Bonzini    echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
428564656024SJuan Quintela  ;;
428664656024SJuan Quintela  mips*)
428725be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
428876cad711SPaolo Bonzini    echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
428964656024SJuan Quintela  ;;
4290e67db06eSJia Liu  or32)
4291e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
429276cad711SPaolo Bonzini    echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4293e67db06eSJia Liu  ;;
429464656024SJuan Quintela  ppc*)
429525be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
429676cad711SPaolo Bonzini    echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
429764656024SJuan Quintela  ;;
429824e804ecSAlexander Graf  s390*)
429925be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
430076cad711SPaolo Bonzini    echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
430164656024SJuan Quintela  ;;
430264656024SJuan Quintela  sh4)
430325be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
430476cad711SPaolo Bonzini    echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
430564656024SJuan Quintela  ;;
430664656024SJuan Quintela  sparc*)
430725be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
430876cad711SPaolo Bonzini    echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
430964656024SJuan Quintela  ;;
4310cfa550c6SMax Filippov  xtensa*)
4311cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
431276cad711SPaolo Bonzini    echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
4313cfa550c6SMax Filippov  ;;
431464656024SJuan Quintela  esac
431564656024SJuan Quinteladone
43169195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
43179195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
431876cad711SPaolo Bonzini  echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
43199195b2c2SStefan Weilfi
432064656024SJuan Quintela
43216ee7126fSJuan Quintelacase "$ARCH" in
43226ee7126fSJuan Quintelaalpha)
43236ee7126fSJuan Quintela  # Ensure there's only a single GP
43246ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
43256ee7126fSJuan Quintela;;
43266ee7126fSJuan Quintelaesac
43276ee7126fSJuan Quintela
432855d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
432955d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
433055d9c04bSJuan Quintela  arm)
433155d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
433255d9c04bSJuan Quintela  ;;
433325a8bb96SMichael Walle  lm32)
433425a8bb96SMichael Walle    cflags="-DHAS_AUDIO $cflags"
433525a8bb96SMichael Walle  ;;
433655d9c04bSJuan Quintela  i386|mips|ppc)
433755d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
433855d9c04bSJuan Quintela  ;;
433955d9c04bSJuan Quintela  esac
434055d9c04bSJuan Quintelafi
434155d9c04bSJuan Quintela
4342d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
434325be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
4344d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
4345d02c1db3SJuan Quintela    cflags="-p $cflags"
4346d02c1db3SJuan Quintela    ldflags="-p $ldflags"
4347d02c1db3SJuan Quintela  fi
4348d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
4349d02c1db3SJuan Quintela    ldflags="-p $ldflags"
435025be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
4351d02c1db3SJuan Quintela  fi
4352d02c1db3SJuan Quintelafi
4353d02c1db3SJuan Quintela
4354ab214c29SStefan Bergerif test "$tpm" = "yes"; then
4355ab214c29SStefan Berger  if test "$target_softmmu" = "yes" ; then
4356ab214c29SStefan Berger    echo "CONFIG_TPM=y" >> $config_host_mak
4357ab214c29SStefan Berger  fi
4358ab214c29SStefan Bergerfi
4359ab214c29SStefan Berger
43609195b2c2SStefan Weilif test "$ARCH" = "tci"; then
43619195b2c2SStefan Weil  linker_script=""
43629195b2c2SStefan Weilelse
4363c1c93672SPaolo Bonzini  linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/ldscripts/\$(ARCH).ld"
43649195b2c2SStefan Weilfi
43659195b2c2SStefan Weil
43669b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4367fa282484SJuan Quintela  case "$ARCH" in
43684d58be06SRichard Henderson  alpha | s390x)
43694d58be06SRichard Henderson    # The default placement of the application is fine.
43704d58be06SRichard Henderson    ;;
4371fd76e73aSRichard Henderson  *)
4372322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
4373fa282484SJuan Quintela    ;;
4374fa282484SJuan Quintela  esac
4375fa282484SJuan Quintelafi
4376fa282484SJuan Quintela
437725be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
437825be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4379f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
4380fa282484SJuan Quintela
438197a847bcSbellarddone # for target in $targets
43827d13299dSbellard
4383b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then
4384b776eca1SGerd Hoffmann  echo "config-host.h: subdir-pixman" >> $config_host_mak
4385b776eca1SGerd Hoffmannfi
4386b776eca1SGerd Hoffmann
4387d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
4388927b241dSMichael WalleDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
43892dee8d54SPaolo BonziniDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
43902d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
43912dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
4392c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4393c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
4394834574eaSAnthony LiguoriFILES="$FILES tests/tcg/lm32/Makefile po/Makefile"
4395ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4396446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
43972d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
43984652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp"
4399753d11f2SRichard Hendersonfor bios_file in \
4400753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
44015acc2ec0SGerd Hoffmann    $source_path/pc-bios/*.aml \
4402753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
4403753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
4404753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
4405753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
4406753d11f2SRichard Hendersondo
44077ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
44087ea78b74SJan Kiszkadone
4409d1807a4fSPaolo Bonzinimkdir -p $DIRS
44107d13299dSbellardfor f in $FILES ; do
441172b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4412f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
4413f9245e10SPeter Maydell    fi
44147d13299dSbellarddone
44151ad2134fSPaul Brook
4416c34ebfdcSAnthony Liguori# temporary config to build submodules
44172d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
4418c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
441937116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4420c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
44213dd46c78SBlue Swirl    echo "AS=$as" >> $config_mak
4422c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4423c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
44243dd46c78SBlue Swirl    echo "CPP=$cpp" >> $config_mak
4425c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4426c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
4427c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4428c34ebfdcSAnthony Liguoridone
4429c34ebfdcSAnthony Liguori
4430b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4431b40292e7SJan Kiszka  mkdir -p QMP
4432b40292e7SJan Kiszkafi
4433