xref: /openbmc/qemu/configure (revision fd123245b98fd6e13d829878f25b30a9417f4bfc)
17d13299dSbellard#!/bin/sh
27d13299dSbellard#
33ef693a0Sbellard# qemu configure script (c) 2003 Fabrice Bellard
47d13299dSbellard#
57d13299dSbellard# set temporary file name
67d13299dSbellardif test ! -z "$TMPDIR" ; then
77d13299dSbellard    TMPDIR1="${TMPDIR}"
87d13299dSbellardelif test ! -z "$TEMPDIR" ; then
97d13299dSbellard    TMPDIR1="${TEMPDIR}"
107d13299dSbellardelse
117d13299dSbellard    TMPDIR1="/tmp"
127d13299dSbellardfi
137d13299dSbellard
143ef693a0SbellardTMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
153ef693a0SbellardTMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
16a91b857cSmalcTMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe"
177d13299dSbellard
180ba8681eSLoïc Minier# NB: do not call "exit" in the trap handler; this is buggy with some shells;
190ba8681eSLoïc Minier# see <1285349658-3122-1-git-send-email-loic.minier@linaro.org>
200ba8681eSLoïc Miniertrap "rm -f $TMPC $TMPO $TMPE" EXIT INT QUIT TERM
21da1d85e3SGerd Hoffmannrm -f config.log
229ac81bbbSmalc
23b48e3611SPeter Maydell# Print a helpful header at the top of config.log
24b48e3611SPeter Maydellecho "# QEMU configure log $(date)" >> config.log
25979ae168SPeter Maydellprintf "# Configured with:" >> config.log
26979ae168SPeter Maydellprintf " '%s'" "$0" "$@" >> config.log
27979ae168SPeter Maydellecho >> config.log
28b48e3611SPeter Maydellecho "#" >> config.log
29b48e3611SPeter Maydell
3076ad07a4SPeter Maydellerror_exit() {
3176ad07a4SPeter Maydell    echo
3276ad07a4SPeter Maydell    echo "ERROR: $1"
3376ad07a4SPeter Maydell    while test -n "$2"; do
3476ad07a4SPeter Maydell        echo "       $2"
3576ad07a4SPeter Maydell        shift
3676ad07a4SPeter Maydell    done
3776ad07a4SPeter Maydell    echo
3876ad07a4SPeter Maydell    exit 1
3976ad07a4SPeter Maydell}
4076ad07a4SPeter Maydell
418dc38a78SPeter Maydelldo_cc() {
428dc38a78SPeter Maydell    # Run the compiler, capturing its output to the log.
438dc38a78SPeter Maydell    echo $cc "$@" >> config.log
448dc38a78SPeter Maydell    $cc "$@" >> config.log 2>&1 || return $?
458dc38a78SPeter Maydell    # Test passed. If this is an --enable-werror build, rerun
468dc38a78SPeter Maydell    # the test with -Werror and bail out if it fails. This
478dc38a78SPeter Maydell    # makes warning-generating-errors in configure test code
488dc38a78SPeter Maydell    # obvious to developers.
498dc38a78SPeter Maydell    if test "$werror" != "yes"; then
508dc38a78SPeter Maydell        return 0
518dc38a78SPeter Maydell    fi
528dc38a78SPeter Maydell    # Don't bother rerunning the compile if we were already using -Werror
538dc38a78SPeter Maydell    case "$*" in
548dc38a78SPeter Maydell        *-Werror*)
558dc38a78SPeter Maydell           return 0
568dc38a78SPeter Maydell        ;;
578dc38a78SPeter Maydell    esac
588dc38a78SPeter Maydell    echo $cc -Werror "$@" >> config.log
598dc38a78SPeter Maydell    $cc -Werror "$@" >> config.log 2>&1 && return $?
6076ad07a4SPeter Maydell    error_exit "configure test passed without -Werror but failed with -Werror." \
6176ad07a4SPeter Maydell        "This is probably a bug in the configure script. The failing command" \
6276ad07a4SPeter Maydell        "will be at the bottom of config.log." \
6376ad07a4SPeter Maydell        "You can run configure with --disable-werror to bypass this check."
648dc38a78SPeter Maydell}
658dc38a78SPeter Maydell
6652166aa0SJuan Quintelacompile_object() {
678dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC
6852166aa0SJuan Quintela}
6952166aa0SJuan Quintela
7052166aa0SJuan Quintelacompile_prog() {
7152166aa0SJuan Quintela  local_cflags="$1"
7252166aa0SJuan Quintela  local_ldflags="$2"
738dc38a78SPeter Maydell  do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags
7452166aa0SJuan Quintela}
7552166aa0SJuan Quintela
7611568d6dSPaolo Bonzini# symbolically link $1 to $2.  Portable version of "ln -sf".
7711568d6dSPaolo Bonzinisymlink() {
7872b8b5a1SStefan Weil  rm -rf "$2"
79ec5b06d7SAnthony Liguori  mkdir -p "$(dirname "$2")"
8072b8b5a1SStefan Weil  ln -s "$1" "$2"
8111568d6dSPaolo Bonzini}
8211568d6dSPaolo Bonzini
830dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
840dba6195SLoïc Minier# executable or a builtin)
850dba6195SLoïc Minierhas() {
860dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
870dba6195SLoïc Minier}
880dba6195SLoïc Minier
890dba6195SLoïc Minier# search for an executable in PATH
900dba6195SLoïc Minierpath_of() {
910dba6195SLoïc Minier    local_command="$1"
920dba6195SLoïc Minier    local_ifs="$IFS"
930dba6195SLoïc Minier    local_dir=""
940dba6195SLoïc Minier
950dba6195SLoïc Minier    # pathname has a dir component?
960dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
970dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
980dba6195SLoïc Minier            echo "$local_command"
990dba6195SLoïc Minier            return 0
1000dba6195SLoïc Minier        fi
1010dba6195SLoïc Minier    fi
1020dba6195SLoïc Minier    if [ -z "$local_command" ]; then
1030dba6195SLoïc Minier        return 1
1040dba6195SLoïc Minier    fi
1050dba6195SLoïc Minier
1060dba6195SLoïc Minier    IFS=:
1070dba6195SLoïc Minier    for local_dir in $PATH; do
1080dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
1090dba6195SLoïc Minier            echo "$local_dir/$local_command"
1100dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
1110dba6195SLoïc Minier            return 0
1120dba6195SLoïc Minier        fi
1130dba6195SLoïc Minier    done
1140dba6195SLoïc Minier    # not found
1150dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
1160dba6195SLoïc Minier    return 1
1170dba6195SLoïc Minier}
1180dba6195SLoïc Minier
1197d13299dSbellard# default parameters
120ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"`
1212ff6b91eSJuan Quintelacpu=""
1221e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
12343ce4dfeSbellardstatic="no"
1247d13299dSbellardcross_prefix=""
1250c58ac1cSmalcaudio_drv_list=""
12661dc008fSAnthony Liguoriaudio_card_list="ac97 es1370 sb16 hda"
12761dc008fSAnthony Liguoriaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
128eb852011SMarkus Armbrusterblock_drv_whitelist=""
129e49d021eSPeter Maydellhost_cc="cc"
13073da375eSJuan Quintelalibs_softmmu=""
1313e2e0e6bSJuan Quintelalibs_tools=""
13267f86e8eSJuan Quintelaaudio_pt_int=""
133d5631638Smalcaudio_win_int=""
1342b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc
135957f1f99SMichael Rothlibs_qga=""
1365bc62e01SGerd Hoffmanndebug_info="yes"
137ac0df51dSaliguori
138afb63ebdSStefan Weil# Don't accept a target_list environment variable.
139afb63ebdSStefan Weilunset target_list
140377529c0SPaolo Bonzini
141377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
142377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
143377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
144377529c0SPaolo Bonzini#              unless --disable-foo is given
145377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
146377529c0SPaolo Bonzini#              feature will searched for,
147377529c0SPaolo Bonzini#              if not found, configure exits with error
148377529c0SPaolo Bonzini#
149377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
150377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
151377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
152377529c0SPaolo Bonzini
153377529c0SPaolo Bonzinibluez=""
154377529c0SPaolo Bonzinibrlapi=""
155377529c0SPaolo Bonzinicurl=""
156377529c0SPaolo Bonzinicurses=""
157377529c0SPaolo Bonzinidocs=""
158377529c0SPaolo Bonzinifdt=""
159377529c0SPaolo Bonzininptl=""
160e2134eb9SGerd Hoffmannpixman=""
161377529c0SPaolo Bonzinisdl=""
162983eef5aSMeador Ingevirtfs=""
163821601eaSJes Sorensenvnc="yes"
164377529c0SPaolo Bonzinisparse="no"
165377529c0SPaolo Bonziniuuid=""
166377529c0SPaolo Bonzinivde=""
167377529c0SPaolo Bonzinivnc_tls=""
168377529c0SPaolo Bonzinivnc_sasl=""
169377529c0SPaolo Bonzinivnc_jpeg=""
170377529c0SPaolo Bonzinivnc_png=""
1717536ee4bSTim Hardeckvnc_ws=""
172377529c0SPaolo Bonzinixen=""
173d5b93ddfSAnthony PERARDxen_ctrl_version=""
174eb6fda0fSAnthony PERARDxen_pci_passthrough=""
175377529c0SPaolo Bonzinilinux_aio=""
17647e98658SCorey Bryantcap_ng=""
177377529c0SPaolo Bonziniattr=""
1784f26f2b6SAvi Kivitylibattr=""
179377529c0SPaolo Bonzinixfs=""
180377529c0SPaolo Bonzini
181d41a75a2SBradvhost_net="no"
182d41a75a2SBradkvm="no"
183377529c0SPaolo Bonzinigprof="no"
184377529c0SPaolo Bonzinidebug_tcg="no"
185377529c0SPaolo Bonzinidebug="no"
186377529c0SPaolo Bonzinistrip_opt="yes"
1879195b2c2SStefan Weiltcg_interpreter="no"
188377529c0SPaolo Bonzinibigendian="no"
189377529c0SPaolo Bonzinimingw32="no"
1901d728c39SBlue Swirlgcov="no"
1911d728c39SBlue Swirlgcov_tool="gcov"
192377529c0SPaolo BonziniEXESUF=""
193377529c0SPaolo Bonziniprefix="/usr/local"
194377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
195528ae5b8SEduardo Habkostdatadir="\${prefix}/share"
196850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu"
197377529c0SPaolo Bonzinibindir="\${prefix}/bin"
1983aa5d2beSAlon Levylibdir="\${prefix}/lib"
1998bf188aaSMichael Tokarevlibexecdir="\${prefix}/libexec"
2000f94d6daSAlon Levyincludedir="\${prefix}/include"
201377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
202785c23aeSLuiz Capitulinolocal_statedir="\${prefix}/var"
203377529c0SPaolo Bonziniconfsuffix="/qemu"
204377529c0SPaolo Bonzinislirp="yes"
205377529c0SPaolo Bonzinifmod_lib=""
206377529c0SPaolo Bonzinifmod_inc=""
207377529c0SPaolo Bonzinioss_lib=""
208377529c0SPaolo Bonzinibsd="no"
209377529c0SPaolo Bonzinilinux="no"
210377529c0SPaolo Bonzinisolaris="no"
211377529c0SPaolo Bonziniprofiler="no"
212377529c0SPaolo Bonzinicocoa="no"
213377529c0SPaolo Bonzinisoftmmu="yes"
214377529c0SPaolo Bonzinilinux_user="no"
215377529c0SPaolo Bonzinibsd_user="no"
21630163d89SPeter Maydellguest_base="yes"
217377529c0SPaolo Bonziniuname_release=""
218377529c0SPaolo Bonzinimixemu="no"
219377529c0SPaolo Bonziniaix="no"
220377529c0SPaolo Bonziniblobs="yes"
221377529c0SPaolo Bonzinipkgversion=""
22240d6444eSAvi Kivitypie=""
223377529c0SPaolo Bonzinizero_malloc=""
224377529c0SPaolo Bonzinitrace_backend="nop"
225377529c0SPaolo Bonzinitrace_file="trace"
226377529c0SPaolo Bonzinispice=""
227377529c0SPaolo Bonzinirbd=""
228111a38b0SRobert Relyeasmartcard_nss=""
22969354a83SHans de Goedeusb_redir=""
230b1e5fff4SMichael Walleglx=""
2311ece9905SAlon Levyzlib="yes"
232d138cee9SMichael Rothguest_agent="yes"
2334b1c11fdSDaniel P. Berrangewant_tools="yes"
234c589b249SRonnie Sahlberglibiscsi=""
235519175a2SAlex Barcelocoroutine=""
236f794573eSEduardo Otuboseccomp=""
237eb100396SBharata B Raoglusterfs=""
238583f6e7bSStefan Hajnoczivirtio_blk_data_plane=""
239a4ccabcfSAnthony Liguorigtk=""
240528de90aSDaniel P. Berrangegtkabi="2.0"
241ab214c29SStefan Bergertpm="no"
242377529c0SPaolo Bonzini
243ac0df51dSaliguori# parse CC options first
244ac0df51dSaliguorifor opt do
245ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
246ac0df51dSaliguori  case "$opt" in
247ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
248ac0df51dSaliguori  ;;
2493d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
250ac0df51dSaliguori  ;;
251ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
252ca4deeb1SPaolo Bonzini  ;;
2532ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2542ff6b91eSJuan Quintela  ;;
255a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
256f9943cd5SGerd Hoffmann                    EXTRA_CFLAGS="$optarg"
257e2a2ed06SJuan Quintela  ;;
258e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
259f9943cd5SGerd Hoffmann                     EXTRA_LDFLAGS="$optarg"
260e2a2ed06SJuan Quintela  ;;
2615bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2625bc62e01SGerd Hoffmann  ;;
2635bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2645bc62e01SGerd Hoffmann  ;;
265ac0df51dSaliguori  esac
266ac0df51dSaliguoridone
267ac0df51dSaliguori# OS specific
268ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
26993148aa5SStefan Weil# we can eliminate its usage altogether.
270ac0df51dSaliguori
271e49d021eSPeter Maydell# Preferred compiler:
272e49d021eSPeter Maydell#  ${CC} (if set)
273e49d021eSPeter Maydell#  ${cross_prefix}gcc (if cross-prefix specified)
274e49d021eSPeter Maydell#  system compiler
275e49d021eSPeter Maydellif test -z "${CC}${cross_prefix}"; then
276e49d021eSPeter Maydell  cc="$host_cc"
277e49d021eSPeter Maydellelse
278b3198cc2SStuart Yoder  cc="${CC-${cross_prefix}gcc}"
279e49d021eSPeter Maydellfi
280e49d021eSPeter Maydell
281b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
2823dd46c78SBlue Swirlas="${AS-${cross_prefix}as}"
2833dd46c78SBlue Swirlcpp="${CPP-$cc -E}"
284b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
285b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
2863f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
287b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
288b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
28917884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
29017884d7bSSergei Trofimovichquery_pkg_config() {
29117884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
29217884d7bSSergei Trofimovich}
29317884d7bSSergei Trofimovichpkg_config=query_pkg_config
294b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
295ac0df51dSaliguori
296be17dc90SMichael S. Tsirkin# default flags for all hosts
297be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
298f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
299c95e3080SKevin WolfQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
300be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
3016b4c305cSPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/include"
3025bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
3035bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
304be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
3055bc62e01SGerd Hoffmannfi
306be17dc90SMichael S. Tsirkin
307ca4deeb1SPaolo Bonzini# make source path absolute
308ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
309ca4deeb1SPaolo Bonzini
310ac0df51dSaliguoricheck_define() {
311ac0df51dSaliguoricat > $TMPC <<EOF
312ac0df51dSaliguori#if !defined($1)
313fd786e1aSPeter Maydell#error $1 not defined
314ac0df51dSaliguori#endif
315ac0df51dSaliguoriint main(void) { return 0; }
316ac0df51dSaliguoriEOF
31752166aa0SJuan Quintela  compile_object
318ac0df51dSaliguori}
319ac0df51dSaliguori
320bbea4050SPeter Maydellif check_define __linux__ ; then
321bbea4050SPeter Maydell  targetos="Linux"
322bbea4050SPeter Maydellelif check_define _WIN32 ; then
323bbea4050SPeter Maydell  targetos='MINGW32'
324bbea4050SPeter Maydellelif check_define __OpenBSD__ ; then
325bbea4050SPeter Maydell  targetos='OpenBSD'
326bbea4050SPeter Maydellelif check_define __sun__ ; then
327bbea4050SPeter Maydell  targetos='SunOS'
328bbea4050SPeter Maydellelif check_define __HAIKU__ ; then
329bbea4050SPeter Maydell  targetos='Haiku'
330bbea4050SPeter Maydellelse
331bbea4050SPeter Maydell  targetos=`uname -s`
332bbea4050SPeter Maydellfi
333bbea4050SPeter Maydell
334bbea4050SPeter Maydell# Some host OSes need non-standard checks for which CPU to use.
335bbea4050SPeter Maydell# Note that these checks are broken for cross-compilation: if you're
336bbea4050SPeter Maydell# cross-compiling to one of these OSes then you'll need to specify
337bbea4050SPeter Maydell# the correct CPU with the --cpu option.
338bbea4050SPeter Maydellcase $targetos in
339bbea4050SPeter MaydellDarwin)
340bbea4050SPeter Maydell  # on Leopard most of the system is 32-bit, so we have to ask the kernel if we can
341bbea4050SPeter Maydell  # run 64-bit userspace code.
342bbea4050SPeter Maydell  # If the user didn't specify a CPU explicitly and the kernel says this is
343bbea4050SPeter Maydell  # 64 bit hw, then assume x86_64. Otherwise fall through to the usual detection code.
344bbea4050SPeter Maydell  if test -z "$cpu" && test "$(sysctl -n hw.optional.x86_64)" = "1"; then
345bbea4050SPeter Maydell    cpu="x86_64"
346bbea4050SPeter Maydell  fi
347bbea4050SPeter Maydell  ;;
348bbea4050SPeter MaydellSunOS)
349bbea4050SPeter Maydell  # `uname -m` returns i86pc even on an x86_64 box, so default based on isainfo
350bbea4050SPeter Maydell  if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
351bbea4050SPeter Maydell    cpu="x86_64"
352bbea4050SPeter Maydell  fi
353bbea4050SPeter Maydellesac
354bbea4050SPeter Maydell
3552ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
3562ff6b91eSJuan Quintela  # command line argument
3572ff6b91eSJuan Quintela  :
3582ff6b91eSJuan Quintelaelif check_define __i386__ ; then
359ac0df51dSaliguori  cpu="i386"
360ac0df51dSaliguorielif check_define __x86_64__ ; then
361ac0df51dSaliguori  cpu="x86_64"
3623aa9bd6cSblueswir1elif check_define __sparc__ ; then
3633aa9bd6cSblueswir1  if check_define __arch64__ ; then
3643aa9bd6cSblueswir1    cpu="sparc64"
3653aa9bd6cSblueswir1  else
3663aa9bd6cSblueswir1    cpu="sparc"
3673aa9bd6cSblueswir1  fi
368fdf7ed96Smalcelif check_define _ARCH_PPC ; then
369fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
370fdf7ed96Smalc    cpu="ppc64"
371ac0df51dSaliguori  else
372fdf7ed96Smalc    cpu="ppc"
373fdf7ed96Smalc  fi
374afa05235SAurelien Jarnoelif check_define __mips__ ; then
375afa05235SAurelien Jarno  cpu="mips"
376477ba620SAurelien Jarnoelif check_define __ia64__ ; then
377477ba620SAurelien Jarno  cpu="ia64"
378d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
379d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
380d66ed0eaSAurelien Jarno    cpu="s390x"
381d66ed0eaSAurelien Jarno  else
382d66ed0eaSAurelien Jarno    cpu="s390"
383d66ed0eaSAurelien Jarno  fi
38421d89f84SPeter Maydellelif check_define __arm__ ; then
38521d89f84SPeter Maydell  cpu="arm"
386f28ffed5SBradelif check_define __hppa__ ; then
387f28ffed5SBrad  cpu="hppa"
388fdf7ed96Smalcelse
389fdf7ed96Smalc  cpu=`uname -m`
390ac0df51dSaliguorifi
391ac0df51dSaliguori
392359bc95dSPeter MaydellARCH=
393359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
394359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
3957d13299dSbellardcase "$cpu" in
396359bc95dSPeter Maydell  ia64|ppc|ppc64|s390|s390x|sparc64)
397ea8f20f8SJuan Quintela    cpu="$cpu"
398ea8f20f8SJuan Quintela  ;;
3997d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
40097a847bcSbellard    cpu="i386"
4017d13299dSbellard  ;;
402aaa5fa14Saurel32  x86_64|amd64)
403aaa5fa14Saurel32    cpu="x86_64"
404aaa5fa14Saurel32  ;;
40521d89f84SPeter Maydell  armv*b|armv*l|arm)
40621d89f84SPeter Maydell    cpu="arm"
4077d13299dSbellard  ;;
408f28ffed5SBrad  hppa|parisc|parisc64)
409f54b3f92Saurel32    cpu="hppa"
410f54b3f92Saurel32  ;;
411afa05235SAurelien Jarno  mips*)
412afa05235SAurelien Jarno    cpu="mips"
413afa05235SAurelien Jarno  ;;
4143142255cSblueswir1  sparc|sun4[cdmuv])
415ae228531Sbellard    cpu="sparc"
416ae228531Sbellard  ;;
4177d13299dSbellard  *)
418359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
419359bc95dSPeter Maydell    ARCH=unknown
4207d13299dSbellard  ;;
4217d13299dSbellardesac
422359bc95dSPeter Maydellif test -z "$ARCH"; then
423359bc95dSPeter Maydell  ARCH="$cpu"
424359bc95dSPeter Maydellfi
425e2d52ad3SJuan Quintela
4267d13299dSbellard# OS specific
4270dbfc675SJuan Quintela
4287d13299dSbellardcase $targetos in
429c326e0afSbellardCYGWIN*)
430c326e0afSbellard  mingw32="yes"
431a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
432d5631638Smalc  audio_possible_drivers="winwave sdl"
433d5631638Smalc  audio_drv_list="winwave"
434c326e0afSbellard;;
43567b915a5SbellardMINGW32*)
43667b915a5Sbellard  mingw32="yes"
437d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
438d5631638Smalc  audio_drv_list="winwave"
43967b915a5Sbellard;;
4405c40d2bdSthsGNU/kFreeBSD)
441a167ba50SAurelien Jarno  bsd="yes"
4420c58ac1cSmalc  audio_drv_list="oss"
443f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
4445c40d2bdSths;;
4457d3505c5SbellardFreeBSD)
4467d3505c5Sbellard  bsd="yes"
4470db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4480c58ac1cSmalc  audio_drv_list="oss"
449f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
450f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
451f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
4527d3505c5Sbellard;;
453c5e97233Sblueswir1DragonFly)
454c5e97233Sblueswir1  bsd="yes"
4550db4a067SPaolo Bonzini  make="${MAKE-gmake}"
456c5e97233Sblueswir1  audio_drv_list="oss"
457c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
458c5e97233Sblueswir1;;
4597d3505c5SbellardNetBSD)
4607d3505c5Sbellard  bsd="yes"
4610db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4620c58ac1cSmalc  audio_drv_list="oss"
463c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4648ef92a88Sblueswir1  oss_lib="-lossaudio"
4657d3505c5Sbellard;;
4667d3505c5SbellardOpenBSD)
4677d3505c5Sbellard  bsd="yes"
4680db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4690c58ac1cSmalc  audio_drv_list="oss"
470c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4712f6a1ab0Sblueswir1  oss_lib="-lossaudio"
4727d3505c5Sbellard;;
47383fb7adfSbellardDarwin)
47483fb7adfSbellard  bsd="yes"
47583fb7adfSbellard  darwin="yes"
4761b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
477a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
4780c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
4791b0f9cc2Saliguori  else
480a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
4811b0f9cc2Saliguori  fi
482fd677642Sths  cocoa="yes"
4830c58ac1cSmalc  audio_drv_list="coreaudio"
484c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4850c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4867973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
487a0b7cf6bSPeter Maydell  # Disable attempts to use ObjectiveC features in os/object.h since they
488a0b7cf6bSPeter Maydell  # won't work when we're compiling with gcc as a C compiler.
489a0b7cf6bSPeter Maydell  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
49083fb7adfSbellard;;
491ec530c81SbellardSunOS)
492ec530c81Sbellard  solaris="yes"
4930db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4940db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
495fa58948dSBlue Swirl  ld="gld"
496e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
4970475a5caSths  needs_libsunmath="no"
498c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
499c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
5000475a5caSths    if test "$solarisrev" -le 9 ; then
5010475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
5020475a5caSths        needs_libsunmath="yes"
503f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
504f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
505f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
5060475a5caSths      else
50776ad07a4SPeter Maydell        error_exit "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without" \
50876ad07a4SPeter Maydell            "libsunmath from the Sun Studio compilers tools, due to a lack of" \
50976ad07a4SPeter Maydell            "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86" \
51076ad07a4SPeter Maydell            "Studio 11 can be downloaded from www.sun.com."
5110475a5caSths      fi
5120475a5caSths    fi
51386b2bd93Sths  fi
5146b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
5150c58ac1cSmalc    audio_drv_list="oss"
5166b4d2ba1Sths  fi
517c2de5c91Smalc  audio_possible_drivers="oss sdl"
518d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
519d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
520d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
521d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
522a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
523560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
524560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
525560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
526ec530c81Sbellard;;
527b29fe3edSmalcAIX)
528b29fe3edSmalc  aix="yes"
5290db4a067SPaolo Bonzini  make="${MAKE-gmake}"
530b29fe3edSmalc;;
531179cf400SAndreas FärberHaiku)
532179cf400SAndreas Färber  haiku="yes"
533179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
534179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
535179cf400SAndreas Färber;;
536fb065187Sbellard*)
5370c58ac1cSmalc  audio_drv_list="oss"
538b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
5395327cf48Sbellard  linux="yes"
540831b7825Sths  linux_user="yes"
54168063649Sblueswir1  usb="linux"
542af2be207SJan Kiszka  kvm="yes"
543af2be207SJan Kiszka  vhost_net="yes"
54407f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
545c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
546c9ec1fe4Sbellard  fi
547*fd123245SJan Kiszka  QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers $QEMU_INCLUDES"
548fb065187Sbellard;;
5497d13299dSbellardesac
5507d13299dSbellard
5517d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
552b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
55368063649Sblueswir1    usb="bsd"
55484778508Sblueswir1    bsd_user="yes"
5557d3505c5Sbellard  fi
55608de3949SAndreas Färberfi
5577d3505c5Sbellard
5580db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5590db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
560c886edfbSBlue Swirl: ${python=${PYTHON-python}}
561e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5620db4a067SPaolo Bonzini
5633c4a4d0dSPeter Maydell# Default objcc to clang if available, otherwise use CC
5643c4a4d0dSPeter Maydellif has clang; then
5653c4a4d0dSPeter Maydell  objcc=clang
5663c4a4d0dSPeter Maydellelse
5673c4a4d0dSPeter Maydell  objcc="$cc"
5683c4a4d0dSPeter Maydellfi
5693c4a4d0dSPeter Maydell
5703457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
5713457a3f8SJuan Quintela  EXESUF=".exe"
572a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
573e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
574e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
5755e3a0f41SStefan Weil  if test "$cpu" = "i386"; then
5765e3a0f41SStefan Weil    # We need something better than i386 for __sync_val_compare_and_swap
5775e3a0f41SStefan Weil    # and can expect that QEMU will only run on i686 or later.
5785e3a0f41SStefan Weil    QEMU_CFLAGS="-march=i686 $QEMU_CFLAGS"
5795e3a0f41SStefan Weil  fi
580f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
581f7cf5d5bSStefan Weilcat > $TMPC << EOF
582f7cf5d5bSStefan Weilint main(void) { return 0; }
583f7cf5d5bSStefan WeilEOF
584f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
585f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
586f7cf5d5bSStefan Weil  fi
587c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
588683035deSPaolo Bonzini  mandir="\${prefix}"
589528ae5b8SEduardo Habkost  datadir="\${prefix}"
590850da188SEduardo Habkost  qemu_docdir="\${prefix}"
591683035deSPaolo Bonzini  bindir="\${prefix}"
592683035deSPaolo Bonzini  sysconfdir="\${prefix}"
593785c23aeSLuiz Capitulino  local_statedir="\${prefix}"
594683035deSPaolo Bonzini  confsuffix=""
595368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
5963457a3f8SJuan Quintelafi
5973457a3f8SJuan Quintela
598487fefdbSAnthony Liguoriwerror=""
59985aa5189Sbellard
6007d13299dSbellardfor opt do
601a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
6027d13299dSbellard  case "$opt" in
6032efc3265Sbellard  --help|-h) show_help=yes
6042efc3265Sbellard  ;;
60599123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
60699123e13SMike Frysinger  ;;
607b1a550a0Spbrook  --prefix=*) prefix="$optarg"
6087d13299dSbellard  ;;
609b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
61032ce6337Sbellard  ;;
611ca4deeb1SPaolo Bonzini  --source-path=*)
6127d13299dSbellard  ;;
613ac0df51dSaliguori  --cross-prefix=*)
6147d13299dSbellard  ;;
615ac0df51dSaliguori  --cc=*)
6167d13299dSbellard  ;;
617b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
61883469015Sbellard  ;;
6193c4a4d0dSPeter Maydell  --objcc=*) objcc="$optarg"
6203c4a4d0dSPeter Maydell  ;;
621b1a550a0Spbrook  --make=*) make="$optarg"
6227d13299dSbellard  ;;
6236a882643Spbrook  --install=*) install="$optarg"
6246a882643Spbrook  ;;
625c886edfbSBlue Swirl  --python=*) python="$optarg"
626c886edfbSBlue Swirl  ;;
6271d728c39SBlue Swirl  --gcov=*) gcov_tool="$optarg"
6281d728c39SBlue Swirl  ;;
629e2d8830eSBrad  --smbd=*) smbd="$optarg"
630e2d8830eSBrad  ;;
631e2a2ed06SJuan Quintela  --extra-cflags=*)
6327d13299dSbellard  ;;
633e2a2ed06SJuan Quintela  --extra-ldflags=*)
6347d13299dSbellard  ;;
6355bc62e01SGerd Hoffmann  --enable-debug-info)
6365bc62e01SGerd Hoffmann  ;;
6375bc62e01SGerd Hoffmann  --disable-debug-info)
6385bc62e01SGerd Hoffmann  ;;
6392ff6b91eSJuan Quintela  --cpu=*)
6407d13299dSbellard  ;;
641b1a550a0Spbrook  --target-list=*) target_list="$optarg"
642de83cd02Sbellard  ;;
64374242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
64494a420b1SStefan Hajnoczi  ;;
64574242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
6469410b56cSPrerna Saxena  ;;
6477d13299dSbellard  --enable-gprof) gprof="yes"
6487d13299dSbellard  ;;
6491d728c39SBlue Swirl  --enable-gcov) gcov="yes"
6501d728c39SBlue Swirl  ;;
65179427693SLoïc Minier  --static)
65279427693SLoïc Minier    static="yes"
65379427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
65417884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
65543ce4dfeSbellard  ;;
6560b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
6570b24e75fSPaolo Bonzini  ;;
6580b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
6590b24e75fSPaolo Bonzini  ;;
6603aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
6613aa5d2beSAlon Levy  ;;
6628bf188aaSMichael Tokarev  --libexecdir=*) libexecdir="$optarg"
6638bf188aaSMichael Tokarev  ;;
6640f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
6650f94d6daSAlon Levy  ;;
666528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
6670b24e75fSPaolo Bonzini  ;;
668023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
669023d3d67SEduardo Habkost  ;;
670850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
6710b24e75fSPaolo Bonzini  ;;
672ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
67307381cc1SAnthony Liguori  ;;
674785c23aeSLuiz Capitulino  --localstatedir=*) local_statedir="$optarg"
675785c23aeSLuiz Capitulino  ;;
676785c23aeSLuiz Capitulino  --sbindir=*|--sharedstatedir=*|\
677023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
678023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
679023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
680023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
681023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
682023ddd74SMax Filippov    # lots of directory switches by default.
683023ddd74SMax Filippov  ;;
684e2134eb9SGerd Hoffmann  --with-system-pixman) pixman="system"
685e2134eb9SGerd Hoffmann  ;;
686e2134eb9SGerd Hoffmann  --without-system-pixman) pixman="internal"
687e2134eb9SGerd Hoffmann  ;;
68874880fe2SRobert Schiele  --without-pixman) pixman="none"
68974880fe2SRobert Schiele  ;;
69097a847bcSbellard  --disable-sdl) sdl="no"
69197a847bcSbellard  ;;
692c4198157SJuan Quintela  --enable-sdl) sdl="yes"
693c4198157SJuan Quintela  ;;
694983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
695983eef5aSMeador Inge  ;;
696983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
697983eef5aSMeador Inge  ;;
698821601eaSJes Sorensen  --disable-vnc) vnc="no"
699821601eaSJes Sorensen  ;;
700821601eaSJes Sorensen  --enable-vnc) vnc="yes"
701821601eaSJes Sorensen  ;;
702b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
703102a52e4Sbellard  ;;
704c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
705c2de5c91Smalc  ;;
7062f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
7072f6a1ab0Sblueswir1  ;;
7082fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
7090c58ac1cSmalc  ;;
7100c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
7110c58ac1cSmalc  ;;
712eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
713eb852011SMarkus Armbruster  ;;
714f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
715f8393946Saurel32  ;;
716f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
717f8393946Saurel32  ;;
718f3d08ee6SPaul Brook  --enable-debug)
719f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
720f3d08ee6SPaul Brook      debug_tcg="yes"
721f3d08ee6SPaul Brook      debug="yes"
722f3d08ee6SPaul Brook      strip_opt="no"
723f3d08ee6SPaul Brook  ;;
72403b4fe7dSaliguori  --enable-sparse) sparse="yes"
72503b4fe7dSaliguori  ;;
72603b4fe7dSaliguori  --disable-sparse) sparse="no"
72703b4fe7dSaliguori  ;;
7281625af87Saliguori  --disable-strip) strip_opt="no"
7291625af87Saliguori  ;;
7308d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
7318d5d2d4cSths  ;;
7321be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
7331be10ad2SJuan Quintela  ;;
7342f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
7352f9606b3Saliguori  ;;
736ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
737ea784e3bSJuan Quintela  ;;
7382f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
7392f6f5c7aSCorentin Chary  ;;
7402f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
7412f6f5c7aSCorentin Chary  ;;
742efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
743efe556adSCorentin Chary  ;;
744efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
745efe556adSCorentin Chary  ;;
7467536ee4bSTim Hardeck  --disable-vnc-ws) vnc_ws="no"
7477536ee4bSTim Hardeck  ;;
7487536ee4bSTim Hardeck  --enable-vnc-ws) vnc_ws="yes"
7497536ee4bSTim Hardeck  ;;
750443f1376Sbellard  --disable-slirp) slirp="no"
751c20709aaSbellard  ;;
752ee682d27SStefan Weil  --disable-uuid) uuid="no"
753ee682d27SStefan Weil  ;;
754ee682d27SStefan Weil  --enable-uuid) uuid="yes"
755ee682d27SStefan Weil  ;;
756e0e6c8c0Saliguori  --disable-vde) vde="no"
7578a16d273Sths  ;;
758dfb278bdSJuan Quintela  --enable-vde) vde="yes"
759dfb278bdSJuan Quintela  ;;
760e37630caSaliguori  --disable-xen) xen="no"
761e37630caSaliguori  ;;
762fc321b4bSJuan Quintela  --enable-xen) xen="yes"
763fc321b4bSJuan Quintela  ;;
764eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
765eb6fda0fSAnthony PERARD  ;;
766eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
767eb6fda0fSAnthony PERARD  ;;
7682e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
7692e4d9fb1Saurel32  ;;
7704ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
7714ffcedb6SJuan Quintela  ;;
772fb599c9aSbalrog  --disable-bluez) bluez="no"
773fb599c9aSbalrog  ;;
774a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
775a20a6f46SJuan Quintela  ;;
7767ba1e619Saliguori  --disable-kvm) kvm="no"
7777ba1e619Saliguori  ;;
778b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
779b31a0277SJuan Quintela  ;;
7809195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
7819195b2c2SStefan Weil  ;;
7829195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
7839195b2c2SStefan Weil  ;;
78447e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
78547e98658SCorey Bryant  ;;
78647e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
78747e98658SCorey Bryant  ;;
788cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
789cd4ec0b4SGerd Hoffmann  ;;
790cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
791cd4ec0b4SGerd Hoffmann  ;;
792c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
793c589b249SRonnie Sahlberg  ;;
794c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
795c589b249SRonnie Sahlberg  ;;
79605c2a3e7Sbellard  --enable-profiler) profiler="yes"
79705c2a3e7Sbellard  ;;
79814821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
79914821030SPavel Borzenkov  ;;
800c2de5c91Smalc  --enable-cocoa)
801c2de5c91Smalc      cocoa="yes" ;
802c2de5c91Smalc      sdl="no" ;
803c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
8045b0753e0Sbellard  ;;
805cad25d69Spbrook  --disable-system) softmmu="no"
8060a8e90f4Spbrook  ;;
807cad25d69Spbrook  --enable-system) softmmu="yes"
8080a8e90f4Spbrook  ;;
8090953a80fSZachary Amsden  --disable-user)
8100953a80fSZachary Amsden      linux_user="no" ;
8110953a80fSZachary Amsden      bsd_user="no" ;
8120953a80fSZachary Amsden  ;;
8130953a80fSZachary Amsden  --enable-user) ;;
814831b7825Sths  --disable-linux-user) linux_user="no"
8150a8e90f4Spbrook  ;;
816831b7825Sths  --enable-linux-user) linux_user="yes"
817831b7825Sths  ;;
81884778508Sblueswir1  --disable-bsd-user) bsd_user="no"
81984778508Sblueswir1  ;;
82084778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
82184778508Sblueswir1  ;;
822379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
823379f6698SPaul Brook  ;;
824379f6698SPaul Brook  --disable-guest-base) guest_base="no"
825379f6698SPaul Brook  ;;
82640d6444eSAvi Kivity  --enable-pie) pie="yes"
82734005a00SKirill A. Shutemov  ;;
82840d6444eSAvi Kivity  --disable-pie) pie="no"
82934005a00SKirill A. Shutemov  ;;
830c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
831c5937220Spbrook  ;;
83285aa5189Sbellard  --enable-werror) werror="yes"
83385aa5189Sbellard  ;;
83485aa5189Sbellard  --disable-werror) werror="no"
83585aa5189Sbellard  ;;
8364d3b6f6eSbalrog  --disable-curses) curses="no"
8374d3b6f6eSbalrog  ;;
838c584a6d0SJuan Quintela  --enable-curses) curses="yes"
839c584a6d0SJuan Quintela  ;;
840769ce76dSAlexander Graf  --disable-curl) curl="no"
841769ce76dSAlexander Graf  ;;
842788c8196SJuan Quintela  --enable-curl) curl="yes"
843788c8196SJuan Quintela  ;;
8442df87df7SJuan Quintela  --disable-fdt) fdt="no"
8452df87df7SJuan Quintela  ;;
8462df87df7SJuan Quintela  --enable-fdt) fdt="yes"
8472df87df7SJuan Quintela  ;;
848bd0c5661Spbrook  --disable-nptl) nptl="no"
849bd0c5661Spbrook  ;;
850b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
851b0a47e79SJuan Quintela  ;;
8528ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
8538ff9cbf7Smalc  ;;
8545c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
8555c6c3a6cSChristoph Hellwig  ;;
8565c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
8575c6c3a6cSChristoph Hellwig  ;;
858758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
859758e8e38SVenkateswararao Jujjuri (JV)  ;;
860758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
861758e8e38SVenkateswararao Jujjuri (JV)  ;;
86277755340Sths  --disable-blobs) blobs="no"
86377755340Sths  ;;
8644a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
8654a19f1ecSpbrook  ;;
866519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
867519175a2SAlex Barcelo  ;;
868a25dba17SJuan Quintela  --disable-docs) docs="no"
86970ec5dc0SAnthony Liguori  ;;
870a25dba17SJuan Quintela  --enable-docs) docs="yes"
87183a3ab8bSJuan Quintela  ;;
872d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
873d5970055SMichael S. Tsirkin  ;;
874d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
875d5970055SMichael S. Tsirkin  ;;
876b1e5fff4SMichael Walle  --disable-glx) glx="no"
87720ff075bSMichael Walle  ;;
878b1e5fff4SMichael Walle  --enable-glx) glx="yes"
87920ff075bSMichael Walle  ;;
880f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
881f27aaf4bSChristian Brunner  ;;
882f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
883f27aaf4bSChristian Brunner  ;;
8848c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
8858c84cf11SSergei Trofimovich  ;;
8868c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
8878c84cf11SSergei Trofimovich  ;;
888111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
889111a38b0SRobert Relyea  ;;
890111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
891111a38b0SRobert Relyea  ;;
89269354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
89369354a83SHans de Goede  ;;
89469354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
89569354a83SHans de Goede  ;;
8961ece9905SAlon Levy  --disable-zlib-test) zlib="no"
8971ece9905SAlon Levy  ;;
898d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
899d138cee9SMichael Roth  ;;
900d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
901d138cee9SMichael Roth  ;;
9024b1c11fdSDaniel P. Berrange  --enable-tools) want_tools="yes"
9034b1c11fdSDaniel P. Berrange  ;;
9044b1c11fdSDaniel P. Berrange  --disable-tools) want_tools="no"
9054b1c11fdSDaniel P. Berrange  ;;
906f794573eSEduardo Otubo  --enable-seccomp) seccomp="yes"
907f794573eSEduardo Otubo  ;;
908f794573eSEduardo Otubo  --disable-seccomp) seccomp="no"
909f794573eSEduardo Otubo  ;;
910eb100396SBharata B Rao  --disable-glusterfs) glusterfs="no"
911eb100396SBharata B Rao  ;;
912eb100396SBharata B Rao  --enable-glusterfs) glusterfs="yes"
913eb100396SBharata B Rao  ;;
914583f6e7bSStefan Hajnoczi  --disable-virtio-blk-data-plane) virtio_blk_data_plane="no"
915583f6e7bSStefan Hajnoczi  ;;
916583f6e7bSStefan Hajnoczi  --enable-virtio-blk-data-plane) virtio_blk_data_plane="yes"
917583f6e7bSStefan Hajnoczi  ;;
918a4ccabcfSAnthony Liguori  --disable-gtk) gtk="no"
919a4ccabcfSAnthony Liguori  ;;
920a4ccabcfSAnthony Liguori  --enable-gtk) gtk="yes"
921a4ccabcfSAnthony Liguori  ;;
922528de90aSDaniel P. Berrange  --with-gtkabi=*) gtkabi="$optarg"
923528de90aSDaniel P. Berrange  ;;
924ab214c29SStefan Berger  --enable-tpm) tpm="yes"
925ab214c29SStefan Berger  ;;
9267f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
9277f1559c6Sbalrog  ;;
9287d13299dSbellard  esac
9297d13299dSbellarddone
9307d13299dSbellard
93140293e58Sbellardcase "$cpu" in
9329b9c37c3SRichard Henderson    sparc)
9330c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
9349b9c37c3SRichard Henderson           QEMU_CFLAGS="-m32 -mcpu=ultrasparc $QEMU_CFLAGS"
9353142255cSblueswir1           ;;
936ed968ff1SJuan Quintela    sparc64)
9370c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
9389b9c37c3SRichard Henderson           QEMU_CFLAGS="-m64 -mcpu=ultrasparc $QEMU_CFLAGS"
9393142255cSblueswir1           ;;
94076d83bdeSths    s390)
94128d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
94228d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
94328d7cc49SRichard Henderson           ;;
94428d7cc49SRichard Henderson    s390x)
94528d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
94628d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
94776d83bdeSths           ;;
94840293e58Sbellard    i386)
949a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
9500c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
9512b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
95240293e58Sbellard           ;;
95340293e58Sbellard    x86_64)
954a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
9550c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
9562b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
957379f6698SPaul Brook           ;;
95830163d89SPeter Maydell    # No special flags required for other host CPUs
9593142255cSblueswir1esac
9603142255cSblueswir1
96160e0df25SPeter Maydelldefault_target_list=""
96260e0df25SPeter Maydell
96360e0df25SPeter Maydell# these targets are portable
96460e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then
96560e0df25SPeter Maydell    default_target_list="\
96660e0df25SPeter Maydelli386-softmmu \
96760e0df25SPeter Maydellx86_64-softmmu \
96827cdad67SRichard Hendersonalpha-softmmu \
96960e0df25SPeter Maydellarm-softmmu \
97060e0df25SPeter Maydellcris-softmmu \
97160e0df25SPeter Maydelllm32-softmmu \
97260e0df25SPeter Maydellm68k-softmmu \
97360e0df25SPeter Maydellmicroblaze-softmmu \
97460e0df25SPeter Maydellmicroblazeel-softmmu \
97560e0df25SPeter Maydellmips-softmmu \
97660e0df25SPeter Maydellmipsel-softmmu \
97760e0df25SPeter Maydellmips64-softmmu \
97860e0df25SPeter Maydellmips64el-softmmu \
979d15a9c23SAnthony Greenmoxie-softmmu \
980e67db06eSJia Liuor32-softmmu \
98160e0df25SPeter Maydellppc-softmmu \
98260e0df25SPeter Maydellppcemb-softmmu \
98360e0df25SPeter Maydellppc64-softmmu \
98460e0df25SPeter Maydellsh4-softmmu \
98560e0df25SPeter Maydellsh4eb-softmmu \
98660e0df25SPeter Maydellsparc-softmmu \
98760e0df25SPeter Maydellsparc64-softmmu \
9880f3301d4SAlexander Grafs390x-softmmu \
989cfa550c6SMax Filippovxtensa-softmmu \
990cfa550c6SMax Filippovxtensaeb-softmmu \
9914f23a1e6SGuan Xuetaounicore32-softmmu \
99260e0df25SPeter Maydell"
99360e0df25SPeter Maydellfi
99460e0df25SPeter Maydell# the following are Linux specific
99560e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then
99660e0df25SPeter Maydell    default_target_list="${default_target_list}\
99760e0df25SPeter Maydelli386-linux-user \
99860e0df25SPeter Maydellx86_64-linux-user \
99960e0df25SPeter Maydellalpha-linux-user \
100060e0df25SPeter Maydellarm-linux-user \
100160e0df25SPeter Maydellarmeb-linux-user \
100260e0df25SPeter Maydellcris-linux-user \
100360e0df25SPeter Maydellm68k-linux-user \
100460e0df25SPeter Maydellmicroblaze-linux-user \
100560e0df25SPeter Maydellmicroblazeel-linux-user \
100660e0df25SPeter Maydellmips-linux-user \
100760e0df25SPeter Maydellmipsel-linux-user \
100851cd14d3SRichard Hendersonmips64-linux-user \
100951cd14d3SRichard Hendersonmips64el-linux-user \
101051cd14d3SRichard Hendersonmipsn32-linux-user \
101151cd14d3SRichard Hendersonmipsn32el-linux-user \
1012d962783eSJia Liuor32-linux-user \
101360e0df25SPeter Maydellppc-linux-user \
101460e0df25SPeter Maydellppc64-linux-user \
101560e0df25SPeter Maydellppc64abi32-linux-user \
101660e0df25SPeter Maydellsh4-linux-user \
101760e0df25SPeter Maydellsh4eb-linux-user \
101860e0df25SPeter Maydellsparc-linux-user \
101960e0df25SPeter Maydellsparc64-linux-user \
102060e0df25SPeter Maydellsparc32plus-linux-user \
102160e0df25SPeter Maydellunicore32-linux-user \
10220f3301d4SAlexander Grafs390x-linux-user \
102360e0df25SPeter Maydell"
102460e0df25SPeter Maydellfi
102560e0df25SPeter Maydell# the following are BSD specific
102660e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then
102760e0df25SPeter Maydell    default_target_list="${default_target_list}\
102860e0df25SPeter Maydelli386-bsd-user \
102960e0df25SPeter Maydellx86_64-bsd-user \
103060e0df25SPeter Maydellsparc-bsd-user \
103160e0df25SPeter Maydellsparc64-bsd-user \
103260e0df25SPeter Maydell"
103360e0df25SPeter Maydellfi
103460e0df25SPeter Maydell
1035af5db58eSpbrookif test x"$show_help" = x"yes" ; then
1036af5db58eSpbrookcat << EOF
1037af5db58eSpbrook
1038af5db58eSpbrookUsage: configure [options]
1039af5db58eSpbrookOptions: [defaults in brackets after descriptions]
1040af5db58eSpbrook
1041af5db58eSpbrookEOF
1042af5db58eSpbrookecho "Standard options:"
1043af5db58eSpbrookecho "  --help                   print this message"
1044af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
1045af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
1046af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
104760e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
104860e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
104960e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
1050af5db58eSpbrookecho ""
1051af5db58eSpbrookecho "Advanced options (experts only):"
1052af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
1053af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
1054af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
10550bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
10560bfe8cc0SPaolo Bonziniecho "                           build time"
10573c4a4d0dSPeter Maydellecho "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
1058a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
1059e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
1060af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
10616a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
1062c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
1063e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
1064af5db58eSpbrookecho "  --static                 enable static build [$static]"
10650b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
1066023d3d67SEduardo Habkostecho "  --datadir=PATH           install firmware in PATH$confsuffix"
1067023d3d67SEduardo Habkostecho "  --docdir=PATH            install documentation in PATH$confsuffix"
10680b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
1069a7b66fa7SDoug Goldsteinecho "  --libdir=PATH            install libraries in PATH"
1070023d3d67SEduardo Habkostecho "  --sysconfdir=PATH        install config in PATH$confsuffix"
1071785c23aeSLuiz Capitulinoecho "  --localstatedir=PATH     install local state in PATH"
10722ae4748fSStefan Weilecho "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1073f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1074f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
10759941afdeSDunrong Huangecho "  --enable-debug-info       enable debugging information (default)"
10769941afdeSDunrong Huangecho "  --disable-debug-info      disable debugging information"
107709695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1078890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1079890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
10801625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
108185aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1082fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1083c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1084ab400449SHu Taoecho "  --disable-gtk            disable gtk UI"
1085ab400449SHu Taoecho "  --enable-gtk             enable gtk UI"
1086983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1087983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1088821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1089821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
109014821030SPavel Borzenkovecho "  --disable-cocoa          disable Cocoa (Mac OS X only)"
109114821030SPavel Borzenkovecho "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
1092c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1093c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
10944c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
10954c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
1096eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
1097eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
10988ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
1099e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1100fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
1101eb6fda0fSAnthony PERARDecho "  --disable-xen-pci-passthrough"
1102eb6fda0fSAnthony PERARDecho "  --enable-xen-pci-passthrough"
11032e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
11044ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
11058d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
11061be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
11072f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1108ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
11092f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
11102f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
111196763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1112efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
11137536ee4bSTim Hardeckecho "  --disable-vnc-ws         disable Websockets support for VNC server"
11147536ee4bSTim Hardeckecho "  --enable-vnc-ws          enable Websockets support for VNC server"
1115af896aaaSpbrookecho "  --disable-curses         disable curses output"
1116c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1117769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1118788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
11192df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
11202df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1121fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1122a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
11236093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
11247ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1125b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
11269195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1127bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
1128e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
1129af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1130af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
11310953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
11320953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1133831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1134831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
113584778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
113684778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1137379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1138379f6698SPaul Brookecho "                           emulation targets"
1139379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
114040d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
114140d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1142af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1143af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
11442f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1145c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1146235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
1147ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1148ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1149e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1150dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
11515c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
11525c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
115347e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
115447e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1155758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1156758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
115777755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1158d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1159d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1160d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1161d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1162320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1163650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
116474242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
11659410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1166cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1167cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1168f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1169c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1170c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
1171111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1172111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
117369354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
117469354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1175d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1176d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1177f794573eSEduardo Otuboecho "  --disable-seccomp        disable seccomp support"
1178f794573eSEduardo Otuboecho "  --enable-seccomp         enables seccomp support"
1179519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1180fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
1181eb100396SBharata B Raoecho "  --enable-glusterfs       enable GlusterFS backend"
1182eb100396SBharata B Raoecho "  --disable-glusterfs      disable GlusterFS backend"
11831d728c39SBlue Swirlecho "  --enable-gcov            enable test coverage analysis with gcov"
11841d728c39SBlue Swirlecho "  --gcov=GCOV              use specified gcov [$gcov_tool]"
1185ab214c29SStefan Bergerecho "  --enable-tpm             enable TPM support"
1186af5db58eSpbrookecho ""
11875bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1188af5db58eSpbrookexit 1
1189af5db58eSpbrookfi
1190af5db58eSpbrook
1191359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1192359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1193359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1194359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1195359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1196359bc95dSPeter Maydell        ARCH=tci
1197359bc95dSPeter Maydell    else
119876ad07a4SPeter Maydell        error_exit "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1199359bc95dSPeter Maydell    fi
1200359bc95dSPeter Maydellfi
1201359bc95dSPeter Maydell
12028d05095cSPaolo Bonzini# check that the C compiler works.
12038d05095cSPaolo Bonzinicat > $TMPC <<EOF
120475cafad7SStefan Weilint main(void) { return 0; }
12058d05095cSPaolo BonziniEOF
12068d05095cSPaolo Bonzini
12078d05095cSPaolo Bonziniif compile_object ; then
12088d05095cSPaolo Bonzini  : C compiler works ok
12098d05095cSPaolo Bonzinielse
121076ad07a4SPeter Maydell    error_exit "\"$cc\" either does not exist or does not work"
12118d05095cSPaolo Bonzinifi
12128d05095cSPaolo Bonzini
1213417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror
1214417c9d72SAlexander Graf# by default.  Only enable by default for git builds
1215417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION`
1216417c9d72SAlexander Graf
1217417c9d72SAlexander Grafif test -z "$werror" ; then
12186c8fec83SAndreas Färber    if test -d "$source_path/.git" -a \
1219417c9d72SAlexander Graf        "$linux" = "yes" ; then
1220417c9d72SAlexander Graf        werror="yes"
1221417c9d72SAlexander Graf    else
1222417c9d72SAlexander Graf        werror="no"
1223417c9d72SAlexander Graf    fi
1224417c9d72SAlexander Graffi
1225417c9d72SAlexander Graf
12268d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
12278d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
12288d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1229f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
1230c1556a81SPeter Maydellgcc_flags="-Wno-initializer-overrides $gcc_flags"
12316ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would
12326ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due
12336ca026cbSPeter Maydell# to -Werror this would just silently disable some features,
12346ca026cbSPeter Maydell# so it's too error prone.
12358d05095cSPaolo Bonzinicat > $TMPC << EOF
12368d05095cSPaolo Bonziniint main(void) { return 0; }
12378d05095cSPaolo BonziniEOF
12388d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1239a1d29d6cSPeter Maydell    # Use the positive sense of the flag when testing for -Wno-wombat
1240a1d29d6cSPeter Maydell    # support (gcc will happily accept the -Wno- form of unknown
1241a1d29d6cSPeter Maydell    # warning options).
1242a1d29d6cSPeter Maydell    optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')"
1243a1d29d6cSPeter Maydell    if compile_prog "-Werror $optflag" "" ; then
12448d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
12458d05095cSPaolo Bonzini    fi
12468d05095cSPaolo Bonzinidone
12478d05095cSPaolo Bonzini
1248cbdd1999SPaolo Bonzini# Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
1249cbdd1999SPaolo Bonzini# large functions that use global variables.  The bug is in all releases of
1250cbdd1999SPaolo Bonzini# GCC, but it became particularly acute in 4.6.x and 4.7.x.  It is fixed in
1251cbdd1999SPaolo Bonzini# 4.7.3 and 4.8.0.  We should be able to delete this at the end of 2013.
1252cbdd1999SPaolo Bonzinicat > $TMPC << EOF
1253cbdd1999SPaolo Bonzini#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2))
1254cbdd1999SPaolo Bonziniint main(void) { return 0; }
1255cbdd1999SPaolo Bonzini#else
1256cbdd1999SPaolo Bonzini#error No bug in this compiler.
1257cbdd1999SPaolo Bonzini#endif
1258cbdd1999SPaolo BonziniEOF
1259cbdd1999SPaolo Bonziniif compile_prog "-Werror -fno-gcse" "" ; then
1260cbdd1999SPaolo Bonzini  TRANSLATE_OPT_CFLAGS=-fno-gcse
1261cbdd1999SPaolo Bonzinifi
1262cbdd1999SPaolo Bonzini
126340d6444eSAvi Kivityif test "$static" = "yes" ; then
126440d6444eSAvi Kivity  if test "$pie" = "yes" ; then
126576ad07a4SPeter Maydell    error_exit "static and pie are mutually incompatible"
126640d6444eSAvi Kivity  else
126740d6444eSAvi Kivity    pie="no"
126840d6444eSAvi Kivity  fi
126940d6444eSAvi Kivityfi
127040d6444eSAvi Kivity
127140d6444eSAvi Kivityif test "$pie" = ""; then
127240d6444eSAvi Kivity  case "$cpu-$targetos" in
1273f9db31a2SBrad    i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
127440d6444eSAvi Kivity      ;;
127540d6444eSAvi Kivity    *)
127640d6444eSAvi Kivity      pie="no"
127740d6444eSAvi Kivity      ;;
127840d6444eSAvi Kivity  esac
127940d6444eSAvi Kivityfi
128040d6444eSAvi Kivity
128140d6444eSAvi Kivityif test "$pie" != "no" ; then
128240d6444eSAvi Kivity  cat > $TMPC << EOF
128321d4a791SAvi Kivity
128421d4a791SAvi Kivity#ifdef __linux__
128521d4a791SAvi Kivity#  define THREAD __thread
128621d4a791SAvi Kivity#else
128721d4a791SAvi Kivity#  define THREAD
128821d4a791SAvi Kivity#endif
128921d4a791SAvi Kivity
129021d4a791SAvi Kivitystatic THREAD int tls_var;
129121d4a791SAvi Kivity
129221d4a791SAvi Kivityint main(void) { return tls_var; }
129321d4a791SAvi Kivity
129440d6444eSAvi KivityEOF
129540d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
129640d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
129740d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
129840d6444eSAvi Kivity    pie="yes"
129940d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
130040d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
130140d6444eSAvi Kivity    fi
130240d6444eSAvi Kivity  else
130340d6444eSAvi Kivity    if test "$pie" = "yes"; then
130476ad07a4SPeter Maydell      error_exit "PIE not available due to missing toolchain support"
130540d6444eSAvi Kivity    else
130640d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
130740d6444eSAvi Kivity      pie="no"
130840d6444eSAvi Kivity    fi
130940d6444eSAvi Kivity  fi
131040d6444eSAvi Kivityfi
131140d6444eSAvi Kivity
1312ec530c81Sbellard#
1313ec530c81Sbellard# Solaris specific configure tool chain decisions
1314ec530c81Sbellard#
1315ec530c81Sbellardif test "$solaris" = "yes" ; then
13166792aa11SLoïc Minier  if has $install; then
13176792aa11SLoïc Minier    :
13186792aa11SLoïc Minier  else
131976ad07a4SPeter Maydell    error_exit "Solaris install program not found. Use --install=/usr/ucb/install or" \
132076ad07a4SPeter Maydell        "install fileutils from www.blastwave.org using pkg-get -i fileutils" \
132176ad07a4SPeter Maydell        "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1322ec530c81Sbellard  fi
13236792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
132476ad07a4SPeter Maydell    error_exit "Solaris /usr/sbin/install is not an appropriate install program." \
132576ad07a4SPeter Maydell        "try ginstall from the GNU fileutils available from www.blastwave.org" \
132676ad07a4SPeter Maydell        "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1327ec530c81Sbellard  fi
13286792aa11SLoïc Minier  if has ar; then
13296792aa11SLoïc Minier    :
13306792aa11SLoïc Minier  else
1331ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
133276ad07a4SPeter Maydell      error_exit "No path includes ar" \
133376ad07a4SPeter Maydell          "Add /usr/ccs/bin to your path and rerun configure"
1334ec530c81Sbellard    fi
133576ad07a4SPeter Maydell    error_exit "No path includes ar"
1336ec530c81Sbellard  fi
1337ec530c81Sbellardfi
1338ec530c81Sbellard
13397a3fc891SSebastian Herbsztif ! has $python; then
134076ad07a4SPeter Maydell  error_exit "Python not found. Use --python=/path/to/python"
1341c886edfbSBlue Swirlfi
1342c886edfbSBlue Swirl
13436ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
13446ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
1345e120d449SStefan Hajnocziif ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
134676ad07a4SPeter Maydell  error_exit "Cannot use '$python', Python 2.4 or later is required." \
134776ad07a4SPeter Maydell      "Note that Python 3 or later is not yet supported." \
134876ad07a4SPeter Maydell      "Use --python=/path/to/python to specify a supported Python."
13496ccea1e4SPeter Maydellfi
13506ccea1e4SPeter Maydell
1351afb63ebdSStefan Weilif test -z "${target_list+xxx}" ; then
1352121afa9eSAnthony Liguori    target_list="$default_target_list"
1353121afa9eSAnthony Liguorielse
1354121afa9eSAnthony Liguori    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
13555327cf48Sbellardfi
1356f55fe278SPaolo Bonzini# see if system emulation was really requested
1357f55fe278SPaolo Bonzinicase " $target_list " in
1358f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1359f55fe278SPaolo Bonzini  ;;
1360f55fe278SPaolo Bonzini  *) softmmu=no
1361f55fe278SPaolo Bonzini  ;;
1362f55fe278SPaolo Bonziniesac
13635327cf48Sbellard
1364249247c9SJuan Quintelafeature_not_found() {
1365249247c9SJuan Quintela  feature=$1
1366249247c9SJuan Quintela
136776ad07a4SPeter Maydell  error_exit "User requested feature $feature" \
136876ad07a4SPeter Maydell      "configure was not able to find it"
1369249247c9SJuan Quintela}
1370249247c9SJuan Quintela
13717d13299dSbellardif test -z "$cross_prefix" ; then
13727d13299dSbellard
13737d13299dSbellard# ---
13747d13299dSbellard# big/little endian test
13757d13299dSbellardcat > $TMPC << EOF
13767d13299dSbellard#include <inttypes.h>
1377abab1a0fSStefan Weilint main(void) {
13787d13299dSbellard        volatile uint32_t i=0x01234567;
13797d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
13807d13299dSbellard}
13817d13299dSbellardEOF
13827d13299dSbellard
138352166aa0SJuan Quintelaif compile_prog "" "" ; then
13847d13299dSbellard$TMPE && bigendian="yes"
13857d13299dSbellardelse
13867d13299dSbellardecho big/little test failed
13877d13299dSbellardfi
13887d13299dSbellard
13897d13299dSbellardelse
13907d13299dSbellard
13917d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1392ea8f20f8SJuan Quintelacase "$cpu" in
139321d89f84SPeter Maydell  arm)
139421d89f84SPeter Maydell    # ARM can be either way; ask the compiler which one we are
139521d89f84SPeter Maydell    if check_define __ARMEB__; then
139621d89f84SPeter Maydell      bigendian=yes
139721d89f84SPeter Maydell    fi
139821d89f84SPeter Maydell  ;;
139921d89f84SPeter Maydell  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1400ea8f20f8SJuan Quintela    bigendian=yes
1401ea8f20f8SJuan Quintela  ;;
1402ea8f20f8SJuan Quintelaesac
14037d13299dSbellard
14047d13299dSbellardfi
14057d13299dSbellard
1406b0a47e79SJuan Quintela##########################################
1407779ab5e3SStefan Weil# pkg-config probe
1408779ab5e3SStefan Weil
1409779ab5e3SStefan Weilif ! has "$pkg_config_exe"; then
141076ad07a4SPeter Maydell  error_exit "pkg-config binary '$pkg_config_exe' not found"
1411779ab5e3SStefan Weilfi
1412779ab5e3SStefan Weil
1413779ab5e3SStefan Weil##########################################
1414b0a47e79SJuan Quintela# NPTL probe
1415b0a47e79SJuan Quintela
1416b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1417bd0c5661Spbrook  cat > $TMPC <<EOF
1418bd0c5661Spbrook#include <sched.h>
141930813ceaSpbrook#include <linux/futex.h>
1420182eacc0SStefan Weilint main(void) {
1421bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1422bd0c5661Spbrook#error bork
1423bd0c5661Spbrook#endif
1424182eacc0SStefan Weil  return 0;
1425bd0c5661Spbrook}
1426bd0c5661SpbrookEOF
1427bd0c5661Spbrook
142852166aa0SJuan Quintela  if compile_object ; then
1429b0a47e79SJuan Quintela    nptl=yes
1430bd0c5661Spbrook  else
1431b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1432b0a47e79SJuan Quintela      feature_not_found "nptl"
1433b0a47e79SJuan Quintela    fi
1434b0a47e79SJuan Quintela    nptl=no
1435b0a47e79SJuan Quintela  fi
1436bd0c5661Spbrookfi
1437bd0c5661Spbrook
143811d9f695Sbellard##########################################
1439ac62922eSbalrog# zlib check
1440ac62922eSbalrog
14411ece9905SAlon Levyif test "$zlib" != "no" ; then
1442ac62922eSbalrog    cat > $TMPC << EOF
1443ac62922eSbalrog#include <zlib.h>
1444ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1445ac62922eSbalrogEOF
144652166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1447ac62922eSbalrog        :
1448ac62922eSbalrog    else
144976ad07a4SPeter Maydell        error_exit "zlib check failed" \
145076ad07a4SPeter Maydell            "Make sure to have the zlib libs and headers installed."
1451ac62922eSbalrog    fi
14521ece9905SAlon Levyfi
1453ac62922eSbalrog
1454ac62922eSbalrog##########################################
1455f794573eSEduardo Otubo# libseccomp check
1456f794573eSEduardo Otubo
1457f794573eSEduardo Otuboif test "$seccomp" != "no" ; then
14582c5c4451SBlue Swirl    if $pkg_config --atleast-version=1.0.0 libseccomp --modversion >/dev/null 2>&1; then
1459b4451996SMichael Tokarev        libs_softmmu="$libs_softmmu `$pkg_config --libs libseccomp`"
1460f794573eSEduardo Otubo	seccomp="yes"
1461f794573eSEduardo Otubo    else
1462f794573eSEduardo Otubo	if test "$seccomp" = "yes"; then
1463f794573eSEduardo Otubo            feature_not_found "libseccomp"
1464f794573eSEduardo Otubo	fi
1465e84d5956SYann E. MORIN	seccomp="no"
1466f794573eSEduardo Otubo    fi
1467f794573eSEduardo Otubofi
1468f794573eSEduardo Otubo##########################################
1469e37630caSaliguori# xen probe
1470e37630caSaliguori
1471fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1472b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1473d5b93ddfSAnthony PERARD
147450ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
147550ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
147650ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
147750ced5b3SStefan Weil
147850ced5b3SStefan Weil  # Xen (any)
147950ced5b3SStefan Weil  cat > $TMPC <<EOF
148050ced5b3SStefan Weil#include <xenctrl.h>
148150ced5b3SStefan Weilint main(void) {
148250ced5b3SStefan Weil  return 0;
148350ced5b3SStefan Weil}
148450ced5b3SStefan WeilEOF
148550ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
148650ced5b3SStefan Weil    # Xen not found
148750ced5b3SStefan Weil    if test "$xen" = "yes" ; then
148850ced5b3SStefan Weil      feature_not_found "xen"
148950ced5b3SStefan Weil    fi
149050ced5b3SStefan Weil    xen=no
149150ced5b3SStefan Weil
1492d5b93ddfSAnthony PERARD  # Xen unstable
149369deef08SPeter Maydell  elif
149469deef08SPeter Maydell      cat > $TMPC <<EOF &&
1495e37630caSaliguori#include <xenctrl.h>
1496e108a3c1SAnthony PERARD#include <xenstore.h>
1497d5b93ddfSAnthony PERARD#include <stdint.h>
1498d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1499d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1500d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1501d5b93ddfSAnthony PERARD#endif
1502d5b93ddfSAnthony PERARDint main(void) {
1503d5b93ddfSAnthony PERARD  xc_interface *xc;
1504d5b93ddfSAnthony PERARD  xs_daemon_open();
1505d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1506d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1507d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1508b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
15098688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
15108688e065SStefano Stabellini  return 0;
15118688e065SStefano Stabellini}
15128688e065SStefano StabelliniEOF
15138688e065SStefano Stabellini      compile_prog "" "$xen_libs"
151469deef08SPeter Maydell    then
15158688e065SStefano Stabellini    xen_ctrl_version=420
15168688e065SStefano Stabellini    xen=yes
15178688e065SStefano Stabellini
151869deef08SPeter Maydell  elif
151969deef08SPeter Maydell      cat > $TMPC <<EOF &&
15208688e065SStefano Stabellini#include <xenctrl.h>
15218688e065SStefano Stabellini#include <xs.h>
15228688e065SStefano Stabellini#include <stdint.h>
15238688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
15248688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
15258688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
15268688e065SStefano Stabellini#endif
15278688e065SStefano Stabelliniint main(void) {
15288688e065SStefano Stabellini  xs_daemon_open();
15299b4c0b56SPeter Maydell  xc_interface_open(0, 0, 0);
15308688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
15318688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
15328688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1533d5b93ddfSAnthony PERARD  return 0;
1534d5b93ddfSAnthony PERARD}
1535e37630caSaliguoriEOF
153650ced5b3SStefan Weil      compile_prog "" "$xen_libs"
153769deef08SPeter Maydell    then
1538d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1539fc321b4bSJuan Quintela    xen=yes
1540d5b93ddfSAnthony PERARD
1541d5b93ddfSAnthony PERARD  # Xen 4.0.0
154269deef08SPeter Maydell  elif
154369deef08SPeter Maydell      cat > $TMPC <<EOF &&
1544d5b93ddfSAnthony PERARD#include <xenctrl.h>
1545d5b93ddfSAnthony PERARD#include <xs.h>
1546d5b93ddfSAnthony PERARD#include <stdint.h>
1547d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1548d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1549d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1550d5b93ddfSAnthony PERARD#endif
1551d5b93ddfSAnthony PERARDint main(void) {
1552b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1553b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1554b87de24eSAnthony PERARD  };
1555d5b93ddfSAnthony PERARD  xs_daemon_open();
1556d5b93ddfSAnthony PERARD  xc_interface_open();
1557d5b93ddfSAnthony PERARD  xc_gnttab_open();
1558d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1559b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1560d5b93ddfSAnthony PERARD  return 0;
1561d5b93ddfSAnthony PERARD}
1562d5b93ddfSAnthony PERARDEOF
1563d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
156469deef08SPeter Maydell    then
1565d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1566d5b93ddfSAnthony PERARD    xen=yes
1567d5b93ddfSAnthony PERARD
1568b87de24eSAnthony PERARD  # Xen 3.4.0
156969deef08SPeter Maydell  elif
157069deef08SPeter Maydell      cat > $TMPC <<EOF &&
1571b87de24eSAnthony PERARD#include <xenctrl.h>
1572b87de24eSAnthony PERARD#include <xs.h>
1573b87de24eSAnthony PERARDint main(void) {
1574b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1575b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1576b87de24eSAnthony PERARD  };
1577b87de24eSAnthony PERARD  xs_daemon_open();
1578b87de24eSAnthony PERARD  xc_interface_open();
1579b87de24eSAnthony PERARD  xc_gnttab_open();
1580b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1581b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1582b87de24eSAnthony PERARD  return 0;
1583b87de24eSAnthony PERARD}
1584b87de24eSAnthony PERARDEOF
1585b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
158669deef08SPeter Maydell    then
1587b87de24eSAnthony PERARD    xen_ctrl_version=340
1588b87de24eSAnthony PERARD    xen=yes
1589b87de24eSAnthony PERARD
1590b87de24eSAnthony PERARD  # Xen 3.3.0
159169deef08SPeter Maydell  elif
159269deef08SPeter Maydell      cat > $TMPC <<EOF &&
1593d5b93ddfSAnthony PERARD#include <xenctrl.h>
1594d5b93ddfSAnthony PERARD#include <xs.h>
1595d5b93ddfSAnthony PERARDint main(void) {
1596d5b93ddfSAnthony PERARD  xs_daemon_open();
1597d5b93ddfSAnthony PERARD  xc_interface_open();
1598d5b93ddfSAnthony PERARD  xc_gnttab_open();
1599d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1600d5b93ddfSAnthony PERARD  return 0;
1601d5b93ddfSAnthony PERARD}
1602d5b93ddfSAnthony PERARDEOF
1603d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
160469deef08SPeter Maydell    then
1605d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1606d5b93ddfSAnthony PERARD    xen=yes
1607d5b93ddfSAnthony PERARD
160850ced5b3SStefan Weil  # Xen version unsupported
1609e37630caSaliguori  else
1610fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
161150ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1612fc321b4bSJuan Quintela    fi
1613fc321b4bSJuan Quintela    xen=no
1614e37630caSaliguori  fi
1615d5b93ddfSAnthony PERARD
1616d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1617d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1618d5b93ddfSAnthony PERARD  fi
1619e37630caSaliguorifi
1620e37630caSaliguori
1621eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1622eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1623eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1624eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1625eb6fda0fSAnthony PERARD  else
1626eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1627eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
162876ad07a4SPeter Maydell        error_exit "User requested feature Xen PCI Passthrough" \
162976ad07a4SPeter Maydell            "This feature does not work with Xen 3.3"
1630eb6fda0fSAnthony PERARD      fi
163176ad07a4SPeter Maydell      error_exit "User requested feature Xen PCI Passthrough" \
163276ad07a4SPeter Maydell          " but this feature requires /sys from Linux"
1633eb6fda0fSAnthony PERARD    fi
1634eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1635eb6fda0fSAnthony PERARD  fi
1636eb6fda0fSAnthony PERARDfi
1637eb6fda0fSAnthony PERARD
1638e37630caSaliguori##########################################
163944dc0ca3SAlon Levy# libtool probe
164044dc0ca3SAlon Levy
16413f534581SBradif ! has $libtool; then
164244dc0ca3SAlon Levy    libtool=
164344dc0ca3SAlon Levyfi
164444dc0ca3SAlon Levy
164544dc0ca3SAlon Levy##########################################
1646dfffc653SJuan Quintela# Sparse probe
1647dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
16480dba6195SLoïc Minier  if has cgcc; then
1649dfffc653SJuan Quintela    sparse=yes
1650dfffc653SJuan Quintela  else
1651dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1652dfffc653SJuan Quintela      feature_not_found "sparse"
1653dfffc653SJuan Quintela    fi
1654dfffc653SJuan Quintela    sparse=no
1655dfffc653SJuan Quintela  fi
1656dfffc653SJuan Quintelafi
1657dfffc653SJuan Quintela
1658dfffc653SJuan Quintela##########################################
1659a4ccabcfSAnthony Liguori# GTK probe
1660a4ccabcfSAnthony Liguori
1661a4ccabcfSAnthony Liguoriif test "$gtk" != "no"; then
1662528de90aSDaniel P. Berrange    gtkpackage="gtk+-$gtkabi"
1663528de90aSDaniel P. Berrange    if test "$gtkabi" = "3.0" ; then
1664528de90aSDaniel P. Berrange      gtkversion="3.0.0"
1665528de90aSDaniel P. Berrange      vtepackage="vte-2.90"
1666528de90aSDaniel P. Berrange      vteversion="0.32.0"
1667528de90aSDaniel P. Berrange    else
1668528de90aSDaniel P. Berrange      gtkversion="2.18.0"
1669528de90aSDaniel P. Berrange      vtepackage="vte"
1670528de90aSDaniel P. Berrange      vteversion="0.24.0"
1671528de90aSDaniel P. Berrange    fi
1672528de90aSDaniel P. Berrange    if $pkg_config --exists "$gtkpackage >= $gtkversion" && \
1673528de90aSDaniel P. Berrange       $pkg_config --exists "$vtepackage >= $vteversion"; then
1674528de90aSDaniel P. Berrange	gtk_cflags=`$pkg_config --cflags $gtkpackage 2>/dev/null`
1675528de90aSDaniel P. Berrange	gtk_libs=`$pkg_config --libs $gtkpackage 2>/dev/null`
1676528de90aSDaniel P. Berrange	vte_cflags=`$pkg_config --cflags $vtepackage 2>/dev/null`
1677528de90aSDaniel P. Berrange	vte_libs=`$pkg_config --libs $vtepackage 2>/dev/null`
1678a4ccabcfSAnthony Liguori	libs_softmmu="$gtk_libs $vte_libs $libs_softmmu"
1679a4ccabcfSAnthony Liguori	gtk="yes"
1680a4ccabcfSAnthony Liguori    else
1681a4ccabcfSAnthony Liguori	if test "$gtk" = "yes" ; then
1682a4ccabcfSAnthony Liguori	    feature_not_found "gtk"
1683a4ccabcfSAnthony Liguori	fi
1684a4ccabcfSAnthony Liguori	gtk="no"
1685a4ccabcfSAnthony Liguori    fi
1686a4ccabcfSAnthony Liguorifi
1687a4ccabcfSAnthony Liguori
1688a4ccabcfSAnthony Liguori##########################################
168911d9f695Sbellard# SDL probe
169011d9f695Sbellard
16913ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
16923ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
16933ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
16943ec87ffeSPaolo Bonzini  sdl_config=sdl-config
16953ec87ffeSPaolo Bonzinifi
16963ec87ffeSPaolo Bonzini
16973ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1698a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1699fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
17003ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
17013ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
17029316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1703a0dfd8a4SLoïc Minierelse
1704a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1705a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1706a0dfd8a4SLoïc Minier  fi
1707a0dfd8a4SLoïc Minier  sdl=no
17089316f803SPaolo Bonzinifi
170929e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
17103ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
17113ec87ffeSPaolo Bonzinifi
171211d9f695Sbellard
17139316f803SPaolo Bonzinisdl_too_old=no
1714c4198157SJuan Quintelaif test "$sdl" != "no" ; then
171511d9f695Sbellard  cat > $TMPC << EOF
171611d9f695Sbellard#include <SDL.h>
171711d9f695Sbellard#undef main /* We don't want SDL to override our main() */
171811d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
171911d9f695SbellardEOF
17209316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
172174f42e18STeLeMan  if test "$static" = "yes" ; then
172274f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
172374f42e18STeLeMan  else
17249316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
172574f42e18STeLeMan  fi
172652166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
172711d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
172811d9f695Sbellard      sdl_too_old=yes
172911d9f695Sbellard    else
1730fd677642Sths      if test "$cocoa" = "no" ; then
173111d9f695Sbellard        sdl=yes
173211d9f695Sbellard      fi
1733fd677642Sths    fi
17347c1f25b4Sbellard
173567c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
17361ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
173767c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1738f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1739f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
174011d9f695Sbellard      fi
174152166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
17421ac88f28SJuan Quintela	:
17431ac88f28SJuan Quintela      else
17441ac88f28SJuan Quintela        sdl=no
17457c1f25b4Sbellard      fi
17467c1f25b4Sbellard    fi # static link
1747c4198157SJuan Quintela  else # sdl not found
1748c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1749c4198157SJuan Quintela      feature_not_found "sdl"
1750c4198157SJuan Quintela    fi
1751c4198157SJuan Quintela    sdl=no
17527c1f25b4Sbellard  fi # sdl compile test
1753fd677642Sthsfi
175411d9f695Sbellard
17555368a422Saliguoriif test "$sdl" = "yes" ; then
17565368a422Saliguori  cat > $TMPC <<EOF
17575368a422Saliguori#include <SDL.h>
17585368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
17595368a422Saliguori#include <X11/XKBlib.h>
17605368a422Saliguori#else
17615368a422Saliguori#error No x11 support
17625368a422Saliguori#endif
17635368a422Saliguoriint main(void) { return 0; }
17645368a422SaliguoriEOF
176552166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1766681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
17675368a422Saliguori  fi
17680705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
17695368a422Saliguorifi
17705368a422Saliguori
17718f28f3fbSths##########################################
17727536ee4bSTim Hardeck# VNC TLS/WS detection
17737536ee4bSTim Hardeckif test "$vnc" = "yes" -a \( "$vnc_tls" != "no" -o "$vnc_ws" != "no" \) ; then
1774ae6b5e5aSaliguori  cat > $TMPC <<EOF
1775ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1776ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1777ae6b5e5aSaliguoriEOF
1778a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1779a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
178052166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
17817536ee4bSTim Hardeck    if test "$vnc_tls" != "no" ; then
17821be10ad2SJuan Quintela      vnc_tls=yes
17837536ee4bSTim Hardeck    fi
17847536ee4bSTim Hardeck    if test "$vnc_ws" != "no" ; then
17857536ee4bSTim Hardeck      vnc_ws=yes
17867536ee4bSTim Hardeck    fi
1787a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1788ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
1789ae6b5e5aSaliguori  else
17901be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
17911be10ad2SJuan Quintela      feature_not_found "vnc-tls"
17921be10ad2SJuan Quintela    fi
17937536ee4bSTim Hardeck    if test "$vnc_ws" = "yes" ; then
17947536ee4bSTim Hardeck      feature_not_found "vnc-ws"
17957536ee4bSTim Hardeck    fi
17961be10ad2SJuan Quintela    vnc_tls=no
17977536ee4bSTim Hardeck    vnc_ws=no
17988d5d2d4cSths  fi
17998d5d2d4cSthsfi
18008d5d2d4cSths
18018d5d2d4cSths##########################################
18022f9606b3Saliguori# VNC SASL detection
1803821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
18042f9606b3Saliguori  cat > $TMPC <<EOF
18052f9606b3Saliguori#include <sasl/sasl.h>
18062f9606b3Saliguori#include <stdio.h>
18072f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
18082f9606b3SaliguoriEOF
18092f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
18102f9606b3Saliguori  vnc_sasl_cflags=""
18112f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
181252166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1813ea784e3bSJuan Quintela    vnc_sasl=yes
1814fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
1815ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
18162f9606b3Saliguori  else
1817ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1818ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1819ea784e3bSJuan Quintela    fi
1820ea784e3bSJuan Quintela    vnc_sasl=no
18212f9606b3Saliguori  fi
18222f9606b3Saliguorifi
18232f9606b3Saliguori
18242f9606b3Saliguori##########################################
18252f6f5c7aSCorentin Chary# VNC JPEG detection
1826821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
18272f6f5c7aSCorentin Charycat > $TMPC <<EOF
18282f6f5c7aSCorentin Chary#include <stdio.h>
18292f6f5c7aSCorentin Chary#include <jpeglib.h>
18302f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
18312f6f5c7aSCorentin CharyEOF
18322f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
18332f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
18342f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
18352f6f5c7aSCorentin Chary    vnc_jpeg=yes
18362f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
1837ca273d58SPaolo Bonzini    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
18382f6f5c7aSCorentin Chary  else
18392f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
18402f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
18412f6f5c7aSCorentin Chary    fi
18422f6f5c7aSCorentin Chary    vnc_jpeg=no
18432f6f5c7aSCorentin Chary  fi
18442f6f5c7aSCorentin Charyfi
18452f6f5c7aSCorentin Chary
18462f6f5c7aSCorentin Chary##########################################
1847efe556adSCorentin Chary# VNC PNG detection
1848821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1849efe556adSCorentin Charycat > $TMPC <<EOF
1850efe556adSCorentin Chary//#include <stdio.h>
1851efe556adSCorentin Chary#include <png.h>
1852832ce9c2SScott Wood#include <stddef.h>
1853efe556adSCorentin Charyint main(void) {
1854efe556adSCorentin Chary    png_structp png_ptr;
1855efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
18567edc3fedSPeter Maydell    return png_ptr != 0;
1857efe556adSCorentin Chary}
1858efe556adSCorentin CharyEOF
18599af8025eSBrad  if $pkg_config libpng --modversion >/dev/null 2>&1; then
18609af8025eSBrad    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
18619af8025eSBrad    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
18629af8025eSBrad  else
1863efe556adSCorentin Chary    vnc_png_cflags=""
1864efe556adSCorentin Chary    vnc_png_libs="-lpng"
18659af8025eSBrad  fi
1866efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1867efe556adSCorentin Chary    vnc_png=yes
1868efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
18699af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1870efe556adSCorentin Chary  else
1871efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1872efe556adSCorentin Chary      feature_not_found "vnc-png"
1873efe556adSCorentin Chary    fi
1874efe556adSCorentin Chary    vnc_png=no
1875efe556adSCorentin Chary  fi
1876efe556adSCorentin Charyfi
1877efe556adSCorentin Chary
1878efe556adSCorentin Chary##########################################
187976655d6dSaliguori# fnmatch() probe, used for ACL routines
188076655d6dSaliguorifnmatch="no"
188176655d6dSaliguoricat > $TMPC << EOF
188276655d6dSaliguori#include <fnmatch.h>
188376655d6dSaliguoriint main(void)
188476655d6dSaliguori{
188576655d6dSaliguori    fnmatch("foo", "foo", 0);
188676655d6dSaliguori    return 0;
188776655d6dSaliguori}
188876655d6dSaliguoriEOF
188952166aa0SJuan Quintelaif compile_prog "" "" ; then
189076655d6dSaliguori   fnmatch="yes"
189176655d6dSaliguorifi
189276655d6dSaliguori
189376655d6dSaliguori##########################################
1894ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1895ee682d27SStefan Weilif test "$uuid" != "no" ; then
1896ee682d27SStefan Weil  uuid_libs="-luuid"
1897ee682d27SStefan Weil  cat > $TMPC << EOF
1898ee682d27SStefan Weil#include <uuid/uuid.h>
1899ee682d27SStefan Weilint main(void)
1900ee682d27SStefan Weil{
1901ee682d27SStefan Weil    uuid_t my_uuid;
1902ee682d27SStefan Weil    uuid_generate(my_uuid);
1903ee682d27SStefan Weil    return 0;
1904ee682d27SStefan Weil}
1905ee682d27SStefan WeilEOF
1906ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1907ee682d27SStefan Weil    uuid="yes"
1908ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1909ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1910ee682d27SStefan Weil  else
1911ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1912ee682d27SStefan Weil      feature_not_found "uuid"
1913ee682d27SStefan Weil    fi
1914ee682d27SStefan Weil    uuid=no
1915ee682d27SStefan Weil  fi
1916ee682d27SStefan Weilfi
1917ee682d27SStefan Weil
1918ee682d27SStefan Weil##########################################
1919dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1920dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1921dce512deSChristoph Hellwig  cat > $TMPC << EOF
1922ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
1923dce512deSChristoph Hellwig#include <xfs/xfs.h>
1924dce512deSChristoph Hellwigint main(void)
1925dce512deSChristoph Hellwig{
1926dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1927dce512deSChristoph Hellwig    return 0;
1928dce512deSChristoph Hellwig}
1929dce512deSChristoph HellwigEOF
1930dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1931dce512deSChristoph Hellwig    xfs="yes"
1932dce512deSChristoph Hellwig  else
1933dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1934dce512deSChristoph Hellwig      feature_not_found "xfs"
1935dce512deSChristoph Hellwig    fi
1936dce512deSChristoph Hellwig    xfs=no
1937dce512deSChristoph Hellwig  fi
1938dce512deSChristoph Hellwigfi
1939dce512deSChristoph Hellwig
1940dce512deSChristoph Hellwig##########################################
19418a16d273Sths# vde libraries probe
1942dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
19434baae0acSJuan Quintela  vde_libs="-lvdeplug"
19448a16d273Sths  cat > $TMPC << EOF
19458a16d273Sths#include <libvdeplug.h>
19464a7f0e06Spbrookint main(void)
19474a7f0e06Spbrook{
19484a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
1949fea08e08SPeter Maydell    char s[] = "";
1950fea08e08SPeter Maydell    vde_open(s, s, &a);
19514a7f0e06Spbrook    return 0;
19524a7f0e06Spbrook}
19538a16d273SthsEOF
195452166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
19554baae0acSJuan Quintela    vde=yes
19568e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
19578e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1958dfb278bdSJuan Quintela  else
1959dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1960dfb278bdSJuan Quintela      feature_not_found "vde"
1961dfb278bdSJuan Quintela    fi
1962dfb278bdSJuan Quintela    vde=no
19638a16d273Sths  fi
19648a16d273Sthsfi
19658a16d273Sths
19668a16d273Sths##########################################
196747e98658SCorey Bryant# libcap-ng library probe
196847e98658SCorey Bryantif test "$cap_ng" != "no" ; then
196947e98658SCorey Bryant  cap_libs="-lcap-ng"
197047e98658SCorey Bryant  cat > $TMPC << EOF
197147e98658SCorey Bryant#include <cap-ng.h>
197247e98658SCorey Bryantint main(void)
197347e98658SCorey Bryant{
197447e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
197547e98658SCorey Bryant    return 0;
197647e98658SCorey Bryant}
197747e98658SCorey BryantEOF
197847e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
197947e98658SCorey Bryant    cap_ng=yes
198047e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
198147e98658SCorey Bryant  else
198247e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
198347e98658SCorey Bryant      feature_not_found "cap_ng"
198447e98658SCorey Bryant    fi
198547e98658SCorey Bryant    cap_ng=no
198647e98658SCorey Bryant  fi
198747e98658SCorey Bryantfi
198847e98658SCorey Bryant
198947e98658SCorey Bryant##########################################
1990c2de5c91Smalc# Sound support libraries probe
19918f28f3fbSths
1992c2de5c91Smalcaudio_drv_probe()
1993c2de5c91Smalc{
1994c2de5c91Smalc    drv=$1
1995c2de5c91Smalc    hdr=$2
1996c2de5c91Smalc    lib=$3
1997c2de5c91Smalc    exp=$4
1998c2de5c91Smalc    cfl=$5
19998f28f3fbSths        cat > $TMPC << EOF
2000c2de5c91Smalc#include <$hdr>
2001c2de5c91Smalcint main(void) { $exp }
20028f28f3fbSthsEOF
200352166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
20048f28f3fbSths        :
20058f28f3fbSths    else
200676ad07a4SPeter Maydell        error_exit "$drv check failed" \
200776ad07a4SPeter Maydell            "Make sure to have the $drv libs and headers installed."
20088f28f3fbSths    fi
2009c2de5c91Smalc}
2010c2de5c91Smalc
20112fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
2012c2de5c91Smalcfor drv in $audio_drv_list; do
2013c2de5c91Smalc    case $drv in
2014c2de5c91Smalc    alsa)
2015c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
2016e35bcb0cSStefan Weil        "return snd_pcm_close((snd_pcm_t *)0);"
2017a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
2018c2de5c91Smalc    ;;
2019c2de5c91Smalc
2020c2de5c91Smalc    fmod)
2021c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
202276ad07a4SPeter Maydell        error_exit "You must specify path to FMOD library and headers" \
202376ad07a4SPeter Maydell            "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
20248f28f3fbSths    fi
2025c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
2026a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
2027c2de5c91Smalc    ;;
2028c2de5c91Smalc
2029c2de5c91Smalc    esd)
2030c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
2031a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
203267f86e8eSJuan Quintela    audio_pt_int="yes"
2033c2de5c91Smalc    ;;
2034b8e59f18Smalc
2035b8e59f18Smalc    pa)
2036a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
2037a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
2038a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
203967f86e8eSJuan Quintela    audio_pt_int="yes"
2040b8e59f18Smalc    ;;
2041b8e59f18Smalc
2042997e690aSJuan Quintela    coreaudio)
2043997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
2044997e690aSJuan Quintela    ;;
2045997e690aSJuan Quintela
2046a4bf6780SJuan Quintela    dsound)
2047a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
2048d5631638Smalc      audio_win_int="yes"
2049a4bf6780SJuan Quintela    ;;
2050a4bf6780SJuan Quintela
2051a4bf6780SJuan Quintela    oss)
2052a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
2053a4bf6780SJuan Quintela    ;;
2054a4bf6780SJuan Quintela
2055a4bf6780SJuan Quintela    sdl|wav)
20562f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
20572f6a1ab0Sblueswir1    ;;
20582f6a1ab0Sblueswir1
2059d5631638Smalc    winwave)
2060d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
2061d5631638Smalc      audio_win_int="yes"
2062d5631638Smalc    ;;
2063d5631638Smalc
2064e4c63a6aSmalc    *)
20651c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
206676ad07a4SPeter Maydell        error_exit "Unknown driver '$drv' selected" \
206776ad07a4SPeter Maydell            "Possible drivers are: $audio_possible_drivers"
2068e4c63a6aSmalc    }
2069e4c63a6aSmalc    ;;
2070c2de5c91Smalc    esac
2071c2de5c91Smalcdone
20728f28f3fbSths
20734d3b6f6eSbalrog##########################################
20742e4d9fb1Saurel32# BrlAPI probe
20752e4d9fb1Saurel32
20764ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
2077eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
20782e4d9fb1Saurel32  cat > $TMPC << EOF
20792e4d9fb1Saurel32#include <brlapi.h>
2080832ce9c2SScott Wood#include <stddef.h>
20812e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
20822e4d9fb1Saurel32EOF
208352166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
20842e4d9fb1Saurel32    brlapi=yes
2085264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
20864ffcedb6SJuan Quintela  else
20874ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
20884ffcedb6SJuan Quintela      feature_not_found "brlapi"
20894ffcedb6SJuan Quintela    fi
20904ffcedb6SJuan Quintela    brlapi=no
2091eb82284fSJuan Quintela  fi
2092eb82284fSJuan Quintelafi
20932e4d9fb1Saurel32
20942e4d9fb1Saurel32##########################################
20954d3b6f6eSbalrog# curses probe
2096e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
2097e095e2f3SStefan Weil    curses_list="-lpdcurses"
2098e095e2f3SStefan Weilelse
2099acf15c89SVadim Evard    curses_list="-lncurses:-lcurses:$($pkg_config --libs ncurses 2>/dev/null)"
2100e095e2f3SStefan Weilfi
21014d3b6f6eSbalrog
2102c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
2103c584a6d0SJuan Quintela  curses_found=no
21044d3b6f6eSbalrog  cat > $TMPC << EOF
21054d3b6f6eSbalrog#include <curses.h>
2106ef9a2524SStefan Weilint main(void) {
2107ef9a2524SStefan Weil  const char *s = curses_version();
2108ef9a2524SStefan Weil  resize_term(0, 0);
2109ef9a2524SStefan Weil  return s != 0;
2110ef9a2524SStefan Weil}
21114d3b6f6eSbalrogEOF
2112ecbe251fSVadim Evard  IFS=:
21134f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
2114ecbe251fSVadim Evard    unset IFS
21154f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
2116c584a6d0SJuan Quintela      curses_found=yes
21174f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
21184f78ef9aSJuan Quintela      break
21194d3b6f6eSbalrog    fi
21204f78ef9aSJuan Quintela  done
2121ecbe251fSVadim Evard  unset IFS
2122c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
2123c584a6d0SJuan Quintela    curses=yes
2124c584a6d0SJuan Quintela  else
2125c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
2126c584a6d0SJuan Quintela      feature_not_found "curses"
2127c584a6d0SJuan Quintela    fi
2128c584a6d0SJuan Quintela    curses=no
2129c584a6d0SJuan Quintela  fi
21304f78ef9aSJuan Quintelafi
21314d3b6f6eSbalrog
2132414f0dabSblueswir1##########################################
2133769ce76dSAlexander Graf# curl probe
2134769ce76dSAlexander Graf
2135a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
2136a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
21374e2b0658SPaolo Bonzinielse
21384e2b0658SPaolo Bonzini  curlconfig=curl-config
21394e2b0658SPaolo Bonzinifi
21404e2b0658SPaolo Bonzini
2141788c8196SJuan Quintelaif test "$curl" != "no" ; then
2142769ce76dSAlexander Graf  cat > $TMPC << EOF
2143769ce76dSAlexander Graf#include <curl/curl.h>
21440b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2145769ce76dSAlexander GrafEOF
21464e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
21474e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2148b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2149769ce76dSAlexander Graf    curl=yes
2150f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2151f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2152788c8196SJuan Quintela  else
2153788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2154788c8196SJuan Quintela      feature_not_found "curl"
2155788c8196SJuan Quintela    fi
2156788c8196SJuan Quintela    curl=no
2157769ce76dSAlexander Graf  fi
2158769ce76dSAlexander Graffi # test "$curl"
2159769ce76dSAlexander Graf
2160769ce76dSAlexander Graf##########################################
2161fb599c9aSbalrog# bluez support probe
2162a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2163e820e3f4Sbalrog  cat > $TMPC << EOF
2164e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2165e820e3f4Sbalrogint main(void) { return bt_error(0); }
2166e820e3f4SbalrogEOF
2167a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2168a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
216952166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2170a20a6f46SJuan Quintela    bluez=yes
2171e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2172e820e3f4Sbalrog  else
2173a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2174a20a6f46SJuan Quintela      feature_not_found "bluez"
2175a20a6f46SJuan Quintela    fi
2176e820e3f4Sbalrog    bluez="no"
2177e820e3f4Sbalrog  fi
2178fb599c9aSbalrogfi
2179fb599c9aSbalrog
2180fb599c9aSbalrog##########################################
2181e18df141SAnthony Liguori# glib support probe
2182a52d28afSPaolo Bonzini
2183a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2184a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2185a52d28afSPaolo Bonzini    glib_req_ver=2.20
2186a52d28afSPaolo Bonzinielse
2187a52d28afSPaolo Bonzini    glib_req_ver=2.12
2188a52d28afSPaolo Bonzinifi
2189a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
2190a52d28afSPaolo Bonzinithen
21914b76a481SStefan Hajnoczi    glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
21924b76a481SStefan Hajnoczi    glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
219314015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2194957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2195e18df141SAnthony Liguorielse
219676ad07a4SPeter Maydell    error_exit "glib-$glib_req_ver required to compile QEMU"
2197e18df141SAnthony Liguorifi
2198e18df141SAnthony Liguori
2199e18df141SAnthony Liguori##########################################
2200e2134eb9SGerd Hoffmann# pixman support probe
2201e2134eb9SGerd Hoffmann
2202e2134eb9SGerd Hoffmannif test "$pixman" = ""; then
220374880fe2SRobert Schiele  if test "$want_tools" = "no" -a "$softmmu" = "no"; then
220474880fe2SRobert Schiele    pixman="none"
220574880fe2SRobert Schiele  elif $pkg_config pixman-1 > /dev/null 2>&1; then
2206e2134eb9SGerd Hoffmann    pixman="system"
2207e2134eb9SGerd Hoffmann  else
2208e2134eb9SGerd Hoffmann    pixman="internal"
2209e2134eb9SGerd Hoffmann  fi
2210e2134eb9SGerd Hoffmannfi
221174880fe2SRobert Schieleif test "$pixman" = "none"; then
221274880fe2SRobert Schiele  if test "$want_tools" != "no" -o "$softmmu" != "no"; then
221376ad07a4SPeter Maydell    error_exit "pixman disabled but system emulation or tools build" \
221476ad07a4SPeter Maydell        "enabled.  You can turn off pixman only if you also" \
221576ad07a4SPeter Maydell        "disable all system emulation targets and the tools" \
221676ad07a4SPeter Maydell        "build with '--disable-tools --disable-system'."
221774880fe2SRobert Schiele  fi
221874880fe2SRobert Schiele  pixman_cflags=
221974880fe2SRobert Schiele  pixman_libs=
222074880fe2SRobert Schieleelif test "$pixman" = "system"; then
2221e2134eb9SGerd Hoffmann  pixman_cflags=`$pkg_config --cflags pixman-1 2>/dev/null`
2222e2134eb9SGerd Hoffmann  pixman_libs=`$pkg_config --libs pixman-1 2>/dev/null`
2223e2134eb9SGerd Hoffmannelse
2224e2134eb9SGerd Hoffmann  if test ! -d ${source_path}/pixman/pixman; then
222576ad07a4SPeter Maydell    error_exit "pixman not present. Your options:" \
222676ad07a4SPeter Maydell        "  (1) Preferred: Install the pixman devel package (any recent" \
222776ad07a4SPeter Maydell        "      distro should have packages as Xorg needs pixman too)." \
222876ad07a4SPeter Maydell        "  (2) Fetch the pixman submodule, using:" \
222976ad07a4SPeter Maydell        "      git submodule update --init pixman"
2230e2134eb9SGerd Hoffmann  fi
22315ca9388aSGerd Hoffmann  mkdir -p pixman/pixman
22325ca9388aSGerd Hoffmann  pixman_cflags="-I\$(SRC_PATH)/pixman/pixman -I\$(BUILD_DIR)/pixman/pixman"
22335ca9388aSGerd Hoffmann  pixman_libs="-L\$(BUILD_DIR)/pixman/pixman/.libs -lpixman-1"
2234e2134eb9SGerd Hoffmannfi
2235e2134eb9SGerd Hoffmann
2236e2134eb9SGerd Hoffmann##########################################
223717bff52bSM. Mohan Kumar# libcap probe
223817bff52bSM. Mohan Kumar
223917bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
224017bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
224117bff52bSM. Mohan Kumar#include <stdio.h>
224217bff52bSM. Mohan Kumar#include <sys/capability.h>
2243cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
224417bff52bSM. Mohan KumarEOF
224517bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
224617bff52bSM. Mohan Kumar    cap=yes
224717bff52bSM. Mohan Kumar  else
224817bff52bSM. Mohan Kumar    cap=no
224917bff52bSM. Mohan Kumar  fi
225017bff52bSM. Mohan Kumarfi
225117bff52bSM. Mohan Kumar
225217bff52bSM. Mohan Kumar##########################################
2253e5d355d1Saliguori# pthread probe
22544b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
22553c529d93Saliguori
2256e5d355d1Saliguoripthread=no
2257414f0dabSblueswir1cat > $TMPC << EOF
22583c529d93Saliguori#include <pthread.h>
22597a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
22607a42bbe4SStefan Weilint main(void) {
22617a42bbe4SStefan Weil  pthread_t thread;
22627a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
22637a42bbe4SStefan Weil  return 0;
22647a42bbe4SStefan Weil}
2265414f0dabSblueswir1EOF
2266bd00d539SAndreas Färberif compile_prog "" "" ; then
2267bd00d539SAndreas Färber  pthread=yes
2268bd00d539SAndreas Färberelse
2269de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
227052166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2271e5d355d1Saliguori      pthread=yes
2272e3c56761SPeter Portante      found=no
2273e3c56761SPeter Portante      for lib_entry in $LIBS; do
2274e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2275e3c56761SPeter Portante          found=yes
2276e3c56761SPeter Portante          break
2277e3c56761SPeter Portante        fi
2278e3c56761SPeter Portante      done
2279e3c56761SPeter Portante      if test "$found" = "no"; then
22805572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2281e3c56761SPeter Portante      fi
2282de65fe0fSSebastian Herbszt      break
2283414f0dabSblueswir1    fi
2284de65fe0fSSebastian Herbszt  done
2285bd00d539SAndreas Färberfi
2286414f0dabSblueswir1
22874617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
228876ad07a4SPeter Maydell  error_exit "pthread check failed" \
228976ad07a4SPeter Maydell      "Make sure to have the pthread libs and headers installed."
2290e5d355d1Saliguorifi
2291e5d355d1Saliguori
2292bf9298b9Saliguori##########################################
2293f27aaf4bSChristian Brunner# rbd probe
2294f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2295f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2296f27aaf4bSChristian Brunner#include <stdio.h>
2297ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2298f27aaf4bSChristian Brunnerint main(void) {
2299ad32e9c0SJosh Durgin    rados_t cluster;
2300ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2301f27aaf4bSChristian Brunner    return 0;
2302f27aaf4bSChristian Brunner}
2303f27aaf4bSChristian BrunnerEOF
2304ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2305f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2306f27aaf4bSChristian Brunner    rbd=yes
2307f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2308f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2309f27aaf4bSChristian Brunner  else
2310f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2311f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2312f27aaf4bSChristian Brunner    fi
2313f27aaf4bSChristian Brunner    rbd=no
2314f27aaf4bSChristian Brunner  fi
2315f27aaf4bSChristian Brunnerfi
2316f27aaf4bSChristian Brunner
2317f27aaf4bSChristian Brunner##########################################
23185c6c3a6cSChristoph Hellwig# linux-aio probe
23195c6c3a6cSChristoph Hellwig
23205c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
23215c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
23225c6c3a6cSChristoph Hellwig#include <libaio.h>
23235c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2324832ce9c2SScott Wood#include <stddef.h>
23255c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
23265c6c3a6cSChristoph HellwigEOF
23275c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
23285c6c3a6cSChristoph Hellwig    linux_aio=yes
2329048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2330048d179fSPaul Brook    libs_tools="$libs_tools -laio"
23315c6c3a6cSChristoph Hellwig  else
23325c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
23335c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
23345c6c3a6cSChristoph Hellwig    fi
23353cfcae3cSLuiz Capitulino    linux_aio=no
23365c6c3a6cSChristoph Hellwig  fi
23375c6c3a6cSChristoph Hellwigfi
23385c6c3a6cSChristoph Hellwig
23395c6c3a6cSChristoph Hellwig##########################################
2340583f6e7bSStefan Hajnoczi# adjust virtio-blk-data-plane based on linux-aio
2341583f6e7bSStefan Hajnoczi
2342583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" -a \
2343583f6e7bSStefan Hajnoczi	"$linux_aio" != "yes" ; then
234476ad07a4SPeter Maydell  error_exit "virtio-blk-data-plane requires Linux AIO, please try --enable-linux-aio"
2345583f6e7bSStefan Hajnoczielif test -z "$virtio_blk_data_plane" ; then
2346583f6e7bSStefan Hajnoczi  virtio_blk_data_plane=$linux_aio
2347583f6e7bSStefan Hajnoczifi
2348583f6e7bSStefan Hajnoczi
2349583f6e7bSStefan Hajnoczi##########################################
2350758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2351758e8e38SVenkateswararao Jujjuri (JV)
2352758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2353758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2354758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2355758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2356f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2357f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2358f2338fb4SPavel Borzenkov#else
23594f26f2b6SAvi Kivity#include <sys/xattr.h>
2360f2338fb4SPavel Borzenkov#endif
2361758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2362758e8e38SVenkateswararao Jujjuri (JV)EOF
23634f26f2b6SAvi Kivity  if compile_prog "" "" ; then
23644f26f2b6SAvi Kivity    attr=yes
23654f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2366f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2367758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2368758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
23694f26f2b6SAvi Kivity    libattr=yes
2370758e8e38SVenkateswararao Jujjuri (JV)  else
2371758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2372758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2373758e8e38SVenkateswararao Jujjuri (JV)    fi
2374758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2375758e8e38SVenkateswararao Jujjuri (JV)  fi
2376758e8e38SVenkateswararao Jujjuri (JV)fi
2377758e8e38SVenkateswararao Jujjuri (JV)
2378758e8e38SVenkateswararao Jujjuri (JV)##########################################
2379bf9298b9Saliguori# iovec probe
2380bf9298b9Saliguoricat > $TMPC <<EOF
2381db34f0b3Sblueswir1#include <sys/types.h>
2382bf9298b9Saliguori#include <sys/uio.h>
2383db34f0b3Sblueswir1#include <unistd.h>
2384f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2385bf9298b9SaliguoriEOF
2386bf9298b9Saliguoriiovec=no
238752166aa0SJuan Quintelaif compile_prog "" "" ; then
2388bf9298b9Saliguori  iovec=yes
2389bf9298b9Saliguorifi
2390bf9298b9Saliguori
2391f652e6afSaurel32##########################################
2392ceb42de8Saliguori# preadv probe
2393ceb42de8Saliguoricat > $TMPC <<EOF
2394ceb42de8Saliguori#include <sys/types.h>
2395ceb42de8Saliguori#include <sys/uio.h>
2396ceb42de8Saliguori#include <unistd.h>
2397c075a723SBlue Swirlint main(void) { return preadv(0, 0, 0, 0); }
2398ceb42de8SaliguoriEOF
2399ceb42de8Saliguoripreadv=no
240052166aa0SJuan Quintelaif compile_prog "" "" ; then
2401ceb42de8Saliguori  preadv=yes
2402ceb42de8Saliguorifi
2403ceb42de8Saliguori
2404ceb42de8Saliguori##########################################
2405f652e6afSaurel32# fdt probe
24062df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2407b41af4baSJuan Quintela  fdt_libs="-lfdt"
2408f652e6afSaurel32  cat > $TMPC << EOF
2409f652e6afSaurel32int main(void) { return 0; }
2410f652e6afSaurel32EOF
241152166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2412f652e6afSaurel32    fdt=yes
2413320ba5feSPaolo Bonzini    libs_softmmu="$libs_softmmu $fdt_libs"
24142df87df7SJuan Quintela  else
24152df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
24162df87df7SJuan Quintela      feature_not_found "fdt"
24172df87df7SJuan Quintela    fi
2418de3a354aSMichael Walle    fdt_libs=
24192df87df7SJuan Quintela    fdt=no
2420f652e6afSaurel32  fi
2421f652e6afSaurel32fi
2422f652e6afSaurel32
242320ff075bSMichael Walle##########################################
2424b1e5fff4SMichael Walle# GLX probe, used by milkymist-tmu2
2425b1e5fff4SMichael Walleif test "$glx" != "no" ; then
2426b1e5fff4SMichael Walle  glx_libs="-lGL -lX11"
242720ff075bSMichael Walle  cat > $TMPC << EOF
242820ff075bSMichael Walle#include <X11/Xlib.h>
242920ff075bSMichael Walle#include <GL/gl.h>
243020ff075bSMichael Walle#include <GL/glx.h>
2431d3fcbb16SMichael Walleint main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; }
243220ff075bSMichael WalleEOF
2433d3fcbb16SMichael Walle  if compile_prog "" "-lGL -lX11" ; then
2434b1e5fff4SMichael Walle    glx=yes
243520ff075bSMichael Walle  else
2436b1e5fff4SMichael Walle    if test "$glx" = "yes" ; then
2437b1e5fff4SMichael Walle      feature_not_found "glx"
243820ff075bSMichael Walle    fi
2439b1e5fff4SMichael Walle    glx_libs=
2440b1e5fff4SMichael Walle    glx=no
244120ff075bSMichael Walle  fi
244220ff075bSMichael Wallefi
244320ff075bSMichael Walle
2444eb100396SBharata B Rao##########################################
2445eb100396SBharata B Rao# glusterfs probe
2446eb100396SBharata B Raoif test "$glusterfs" != "no" ; then
2447eb100396SBharata B Rao  cat > $TMPC <<EOF
2448eb100396SBharata B Rao#include <glusterfs/api/glfs.h>
2449eb100396SBharata B Raoint main(void) {
2450eb100396SBharata B Rao    (void) glfs_new("volume");
2451eb100396SBharata B Rao    return 0;
2452eb100396SBharata B Rao}
2453eb100396SBharata B RaoEOF
2454eb100396SBharata B Rao  glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
2455eb100396SBharata B Rao  if compile_prog "" "$glusterfs_libs" ; then
2456eb100396SBharata B Rao    glusterfs=yes
2457eb100396SBharata B Rao    libs_tools="$glusterfs_libs $libs_tools"
2458eb100396SBharata B Rao    libs_softmmu="$glusterfs_libs $libs_softmmu"
2459eb100396SBharata B Rao  else
2460eb100396SBharata B Rao    if test "$glusterfs" = "yes" ; then
2461eb100396SBharata B Rao      feature_not_found "GlusterFS backend support"
2462eb100396SBharata B Rao    fi
2463eb100396SBharata B Rao    glusterfs=no
2464eb100396SBharata B Rao  fi
2465eb100396SBharata B Raofi
2466eb100396SBharata B Rao
24673b3f24adSaurel32#
24683b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
24693b3f24adSaurel32# emulator.  This is done because older glibc versions don't
24703b3f24adSaurel32# have syscall stubs for these implemented.
24713b3f24adSaurel32#
24723b3f24adSaurel32atfile=no
24733b3f24adSaurel32cat > $TMPC << EOF
24743b3f24adSaurel32#define _ATFILE_SOURCE
24753b3f24adSaurel32#include <sys/types.h>
24763b3f24adSaurel32#include <fcntl.h>
24773b3f24adSaurel32#include <unistd.h>
24783b3f24adSaurel32
24793b3f24adSaurel32int
24803b3f24adSaurel32main(void)
24813b3f24adSaurel32{
24823b3f24adSaurel32	/* try to unlink nonexisting file */
24833b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
24843b3f24adSaurel32}
24853b3f24adSaurel32EOF
248652166aa0SJuan Quintelaif compile_prog "" "" ; then
24873b3f24adSaurel32  atfile=yes
24883b3f24adSaurel32fi
24893b3f24adSaurel32
249039386ac7Saurel32# Check for inotify functions when we are building linux-user
24913b3f24adSaurel32# emulator.  This is done because older glibc versions don't
24923b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
24933b3f24adSaurel32# don't provide them even if kernel supports them.
24943b3f24adSaurel32#
24953b3f24adSaurel32inotify=no
24963b3f24adSaurel32cat > $TMPC << EOF
24973b3f24adSaurel32#include <sys/inotify.h>
24983b3f24adSaurel32
24993b3f24adSaurel32int
25003b3f24adSaurel32main(void)
25013b3f24adSaurel32{
25023b3f24adSaurel32	/* try to start inotify */
25038690e420Saurel32	return inotify_init();
25043b3f24adSaurel32}
25053b3f24adSaurel32EOF
250652166aa0SJuan Quintelaif compile_prog "" "" ; then
25073b3f24adSaurel32  inotify=yes
25083b3f24adSaurel32fi
25093b3f24adSaurel32
2510c05c7a73SRiku Voipioinotify1=no
2511c05c7a73SRiku Voipiocat > $TMPC << EOF
2512c05c7a73SRiku Voipio#include <sys/inotify.h>
2513c05c7a73SRiku Voipio
2514c05c7a73SRiku Voipioint
2515c05c7a73SRiku Voipiomain(void)
2516c05c7a73SRiku Voipio{
2517c05c7a73SRiku Voipio    /* try to start inotify */
2518c05c7a73SRiku Voipio    return inotify_init1(0);
2519c05c7a73SRiku Voipio}
2520c05c7a73SRiku VoipioEOF
2521c05c7a73SRiku Voipioif compile_prog "" "" ; then
2522c05c7a73SRiku Voipio  inotify1=yes
2523c05c7a73SRiku Voipiofi
2524c05c7a73SRiku Voipio
2525ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2526ebc996f3SRiku Voipioutimens=no
2527ebc996f3SRiku Voipiocat > $TMPC << EOF
2528ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2529ebc996f3SRiku Voipio#include <stddef.h>
2530ebc996f3SRiku Voipio#include <fcntl.h>
25313014ee00SPeter Maydell#include <sys/stat.h>
2532ebc996f3SRiku Voipio
2533ebc996f3SRiku Voipioint main(void)
2534ebc996f3SRiku Voipio{
2535ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2536ebc996f3SRiku Voipio    futimens(0, NULL);
2537ebc996f3SRiku Voipio    return 0;
2538ebc996f3SRiku Voipio}
2539ebc996f3SRiku VoipioEOF
254052166aa0SJuan Quintelaif compile_prog "" "" ; then
2541ebc996f3SRiku Voipio  utimens=yes
2542ebc996f3SRiku Voipiofi
2543ebc996f3SRiku Voipio
2544099d6b0fSRiku Voipio# check if pipe2 is there
2545099d6b0fSRiku Voipiopipe2=no
2546099d6b0fSRiku Voipiocat > $TMPC << EOF
2547099d6b0fSRiku Voipio#include <unistd.h>
2548099d6b0fSRiku Voipio#include <fcntl.h>
2549099d6b0fSRiku Voipio
2550099d6b0fSRiku Voipioint main(void)
2551099d6b0fSRiku Voipio{
2552099d6b0fSRiku Voipio    int pipefd[2];
25539bca8162SBruce Rogers    return pipe2(pipefd, O_CLOEXEC);
2554099d6b0fSRiku Voipio}
2555099d6b0fSRiku VoipioEOF
255652166aa0SJuan Quintelaif compile_prog "" "" ; then
2557099d6b0fSRiku Voipio  pipe2=yes
2558099d6b0fSRiku Voipiofi
2559099d6b0fSRiku Voipio
256040ff6d7eSKevin Wolf# check if accept4 is there
256140ff6d7eSKevin Wolfaccept4=no
256240ff6d7eSKevin Wolfcat > $TMPC << EOF
256340ff6d7eSKevin Wolf#include <sys/socket.h>
256440ff6d7eSKevin Wolf#include <stddef.h>
256540ff6d7eSKevin Wolf
256640ff6d7eSKevin Wolfint main(void)
256740ff6d7eSKevin Wolf{
256840ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
256940ff6d7eSKevin Wolf    return 0;
257040ff6d7eSKevin Wolf}
257140ff6d7eSKevin WolfEOF
257240ff6d7eSKevin Wolfif compile_prog "" "" ; then
257340ff6d7eSKevin Wolf  accept4=yes
257440ff6d7eSKevin Wolffi
257540ff6d7eSKevin Wolf
25763ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
25773ce34dfbSvibisreenivasansplice=no
25783ce34dfbSvibisreenivasancat > $TMPC << EOF
25793ce34dfbSvibisreenivasan#include <unistd.h>
25803ce34dfbSvibisreenivasan#include <fcntl.h>
25813ce34dfbSvibisreenivasan#include <limits.h>
25823ce34dfbSvibisreenivasan
25833ce34dfbSvibisreenivasanint main(void)
25843ce34dfbSvibisreenivasan{
258566ea0f22SStefan Weil    int len, fd = 0;
25863ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
25873ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
25883ce34dfbSvibisreenivasan    return 0;
25893ce34dfbSvibisreenivasan}
25903ce34dfbSvibisreenivasanEOF
259152166aa0SJuan Quintelaif compile_prog "" "" ; then
25923ce34dfbSvibisreenivasan  splice=yes
25933ce34dfbSvibisreenivasanfi
25943ce34dfbSvibisreenivasan
2595dcc38d1cSMarcelo Tosatti##########################################
2596dcc38d1cSMarcelo Tosatti# signalfd probe
2597dcc38d1cSMarcelo Tosattisignalfd="no"
2598dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2599dcc38d1cSMarcelo Tosatti#include <unistd.h>
2600dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2601dcc38d1cSMarcelo Tosatti#include <signal.h>
2602dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2603dcc38d1cSMarcelo TosattiEOF
2604dcc38d1cSMarcelo Tosatti
2605dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2606dcc38d1cSMarcelo Tosatti  signalfd=yes
2607dcc38d1cSMarcelo Tosattifi
2608dcc38d1cSMarcelo Tosatti
2609c2882b96SRiku Voipio# check if eventfd is supported
2610c2882b96SRiku Voipioeventfd=no
2611c2882b96SRiku Voipiocat > $TMPC << EOF
2612c2882b96SRiku Voipio#include <sys/eventfd.h>
2613c2882b96SRiku Voipio
2614c2882b96SRiku Voipioint main(void)
2615c2882b96SRiku Voipio{
261655cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2617c2882b96SRiku Voipio}
2618c2882b96SRiku VoipioEOF
2619c2882b96SRiku Voipioif compile_prog "" "" ; then
2620c2882b96SRiku Voipio  eventfd=yes
2621c2882b96SRiku Voipiofi
2622c2882b96SRiku Voipio
2623d0927938SUlrich Hecht# check for fallocate
2624d0927938SUlrich Hechtfallocate=no
2625d0927938SUlrich Hechtcat > $TMPC << EOF
2626d0927938SUlrich Hecht#include <fcntl.h>
2627d0927938SUlrich Hecht
2628d0927938SUlrich Hechtint main(void)
2629d0927938SUlrich Hecht{
2630d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2631d0927938SUlrich Hecht    return 0;
2632d0927938SUlrich Hecht}
2633d0927938SUlrich HechtEOF
26348fb03151SPeter Maydellif compile_prog "" "" ; then
2635d0927938SUlrich Hecht  fallocate=yes
2636d0927938SUlrich Hechtfi
2637d0927938SUlrich Hecht
26383d4fa43eSKusanagi Kouichi# check for fallocate hole punching
26393d4fa43eSKusanagi Kouichifallocate_punch_hole=no
26403d4fa43eSKusanagi Kouichicat > $TMPC << EOF
26413d4fa43eSKusanagi Kouichi#include <fcntl.h>
26423d4fa43eSKusanagi Kouichi#include <linux/falloc.h>
26433d4fa43eSKusanagi Kouichi
26443d4fa43eSKusanagi Kouichiint main(void)
26453d4fa43eSKusanagi Kouichi{
26463d4fa43eSKusanagi Kouichi    fallocate(0, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, 0, 0);
26473d4fa43eSKusanagi Kouichi    return 0;
26483d4fa43eSKusanagi Kouichi}
26493d4fa43eSKusanagi KouichiEOF
26503d4fa43eSKusanagi Kouichiif compile_prog "" "" ; then
26513d4fa43eSKusanagi Kouichi  fallocate_punch_hole=yes
26523d4fa43eSKusanagi Kouichifi
26533d4fa43eSKusanagi Kouichi
2654c727f47dSPeter Maydell# check for sync_file_range
2655c727f47dSPeter Maydellsync_file_range=no
2656c727f47dSPeter Maydellcat > $TMPC << EOF
2657c727f47dSPeter Maydell#include <fcntl.h>
2658c727f47dSPeter Maydell
2659c727f47dSPeter Maydellint main(void)
2660c727f47dSPeter Maydell{
2661c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2662c727f47dSPeter Maydell    return 0;
2663c727f47dSPeter Maydell}
2664c727f47dSPeter MaydellEOF
26658fb03151SPeter Maydellif compile_prog "" "" ; then
2666c727f47dSPeter Maydell  sync_file_range=yes
2667c727f47dSPeter Maydellfi
2668c727f47dSPeter Maydell
2669dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2670dace20dcSPeter Maydellfiemap=no
2671dace20dcSPeter Maydellcat > $TMPC << EOF
2672dace20dcSPeter Maydell#include <sys/ioctl.h>
2673dace20dcSPeter Maydell#include <linux/fs.h>
2674dace20dcSPeter Maydell#include <linux/fiemap.h>
2675dace20dcSPeter Maydell
2676dace20dcSPeter Maydellint main(void)
2677dace20dcSPeter Maydell{
2678dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2679dace20dcSPeter Maydell    return 0;
2680dace20dcSPeter Maydell}
2681dace20dcSPeter MaydellEOF
26828fb03151SPeter Maydellif compile_prog "" "" ; then
2683dace20dcSPeter Maydell  fiemap=yes
2684dace20dcSPeter Maydellfi
2685dace20dcSPeter Maydell
2686d0927938SUlrich Hecht# check for dup3
2687d0927938SUlrich Hechtdup3=no
2688d0927938SUlrich Hechtcat > $TMPC << EOF
2689d0927938SUlrich Hecht#include <unistd.h>
2690d0927938SUlrich Hecht
2691d0927938SUlrich Hechtint main(void)
2692d0927938SUlrich Hecht{
2693d0927938SUlrich Hecht    dup3(0, 0, 0);
2694d0927938SUlrich Hecht    return 0;
2695d0927938SUlrich Hecht}
2696d0927938SUlrich HechtEOF
269778f5d726SJan Kiszkaif compile_prog "" "" ; then
2698d0927938SUlrich Hecht  dup3=yes
2699d0927938SUlrich Hechtfi
2700d0927938SUlrich Hecht
27013b6edd16SPeter Maydell# check for epoll support
27023b6edd16SPeter Maydellepoll=no
27033b6edd16SPeter Maydellcat > $TMPC << EOF
27043b6edd16SPeter Maydell#include <sys/epoll.h>
27053b6edd16SPeter Maydell
27063b6edd16SPeter Maydellint main(void)
27073b6edd16SPeter Maydell{
27083b6edd16SPeter Maydell    epoll_create(0);
27093b6edd16SPeter Maydell    return 0;
27103b6edd16SPeter Maydell}
27113b6edd16SPeter MaydellEOF
27128fb03151SPeter Maydellif compile_prog "" "" ; then
27133b6edd16SPeter Maydell  epoll=yes
27143b6edd16SPeter Maydellfi
27153b6edd16SPeter Maydell
27163b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
27173b6edd16SPeter Maydell# so we must check separately for their presence
27183b6edd16SPeter Maydellepoll_create1=no
27193b6edd16SPeter Maydellcat > $TMPC << EOF
27203b6edd16SPeter Maydell#include <sys/epoll.h>
27213b6edd16SPeter Maydell
27223b6edd16SPeter Maydellint main(void)
27233b6edd16SPeter Maydell{
272419e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
272519e83f6bSPeter Maydell     * a function being called. This is necessary so that on
272619e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
272719e83f6bSPeter Maydell     * the library but not declared in the header file we will
272819e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
272919e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
273019e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
273119e83f6bSPeter Maydell     */
2732c075a723SBlue Swirl    return (int)(uintptr_t)&epoll_create1;
27333b6edd16SPeter Maydell}
27343b6edd16SPeter MaydellEOF
27358fb03151SPeter Maydellif compile_prog "" "" ; then
27363b6edd16SPeter Maydell  epoll_create1=yes
27373b6edd16SPeter Maydellfi
27383b6edd16SPeter Maydell
27393b6edd16SPeter Maydellepoll_pwait=no
27403b6edd16SPeter Maydellcat > $TMPC << EOF
27413b6edd16SPeter Maydell#include <sys/epoll.h>
27423b6edd16SPeter Maydell
27433b6edd16SPeter Maydellint main(void)
27443b6edd16SPeter Maydell{
27453b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
27463b6edd16SPeter Maydell    return 0;
27473b6edd16SPeter Maydell}
27483b6edd16SPeter MaydellEOF
27498fb03151SPeter Maydellif compile_prog "" "" ; then
27503b6edd16SPeter Maydell  epoll_pwait=yes
27513b6edd16SPeter Maydellfi
27523b6edd16SPeter Maydell
2753a8fd1abaSPeter Maydell# check for sendfile support
2754a8fd1abaSPeter Maydellsendfile=no
2755a8fd1abaSPeter Maydellcat > $TMPC << EOF
2756a8fd1abaSPeter Maydell#include <sys/sendfile.h>
2757a8fd1abaSPeter Maydell
2758a8fd1abaSPeter Maydellint main(void)
2759a8fd1abaSPeter Maydell{
2760a8fd1abaSPeter Maydell    return sendfile(0, 0, 0, 0);
2761a8fd1abaSPeter Maydell}
2762a8fd1abaSPeter MaydellEOF
2763a8fd1abaSPeter Maydellif compile_prog "" "" ; then
2764a8fd1abaSPeter Maydell  sendfile=yes
2765a8fd1abaSPeter Maydellfi
2766a8fd1abaSPeter Maydell
2767cc8ae6deSpbrook# Check if tools are available to build documentation.
2768a25dba17SJuan Quintelaif test "$docs" != "no" ; then
276901668d98SStefan Weil  if has makeinfo && has pod2man; then
2770a25dba17SJuan Quintela    docs=yes
277183a3ab8bSJuan Quintela  else
2772a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2773a25dba17SJuan Quintela      feature_not_found "docs"
277483a3ab8bSJuan Quintela    fi
2775a25dba17SJuan Quintela    docs=no
277683a3ab8bSJuan Quintela  fi
2777cc8ae6deSpbrookfi
2778cc8ae6deSpbrook
2779f514f41cSStefan Weil# Search for bswap_32 function
27806ae9a1f4SJuan Quintelabyteswap_h=no
27816ae9a1f4SJuan Quintelacat > $TMPC << EOF
27826ae9a1f4SJuan Quintela#include <byteswap.h>
27836ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
27846ae9a1f4SJuan QuintelaEOF
278552166aa0SJuan Quintelaif compile_prog "" "" ; then
27866ae9a1f4SJuan Quintela  byteswap_h=yes
27876ae9a1f4SJuan Quintelafi
27886ae9a1f4SJuan Quintela
278975f13596SStefan Weil# Search for bswap32 function
27906ae9a1f4SJuan Quintelabswap_h=no
27916ae9a1f4SJuan Quintelacat > $TMPC << EOF
27926ae9a1f4SJuan Quintela#include <sys/endian.h>
27936ae9a1f4SJuan Quintela#include <sys/types.h>
27946ae9a1f4SJuan Quintela#include <machine/bswap.h>
27956ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
27966ae9a1f4SJuan QuintelaEOF
279752166aa0SJuan Quintelaif compile_prog "" "" ; then
27986ae9a1f4SJuan Quintela  bswap_h=yes
27996ae9a1f4SJuan Quintelafi
28006ae9a1f4SJuan Quintela
2801da93a1fdSaliguori##########################################
2802c589b249SRonnie Sahlberg# Do we have libiscsi
2803fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a
2804fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi.
2805c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
2806c589b249SRonnie Sahlberg  cat > $TMPC << EOF
2807fa6acb0cSRonnie Sahlberg#include <stdio.h>
2808c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
2809fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
2810c589b249SRonnie SahlbergEOF
28113c33ea96SPaolo Bonzini  if $pkg_config --atleast-version=1.7.0 libiscsi --modversion >/dev/null 2>&1; then
28123c33ea96SPaolo Bonzini    libiscsi="yes"
28133c33ea96SPaolo Bonzini    libiscsi_cflags=$($pkg_config --cflags libiscsi 2>/dev/null)
28143c33ea96SPaolo Bonzini    libiscsi_libs=$($pkg_config --libs libiscsi 2>/dev/null)
28153c33ea96SPaolo Bonzini    CFLAGS="$CFLAGS $libiscsi_cflags"
28163c33ea96SPaolo Bonzini    LIBS="$LIBS $libiscsi_libs"
28173c33ea96SPaolo Bonzini  elif compile_prog "" "-liscsi" ; then
2818c589b249SRonnie Sahlberg    libiscsi="yes"
2819c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
2820c589b249SRonnie Sahlberg  else
2821c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
2822c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
2823c589b249SRonnie Sahlberg    fi
2824c589b249SRonnie Sahlberg    libiscsi="no"
2825c589b249SRonnie Sahlberg  fi
2826c589b249SRonnie Sahlbergfi
2827c589b249SRonnie Sahlberg
2828c589b249SRonnie Sahlberg
2829c589b249SRonnie Sahlberg##########################################
28308bacde8dSNatanael Copa# Do we need libm
28318bacde8dSNatanael Copacat > $TMPC << EOF
28328bacde8dSNatanael Copa#include <math.h>
28338bacde8dSNatanael Copaint main(void) { return isnan(sin(0.0)); }
28348bacde8dSNatanael CopaEOF
28358bacde8dSNatanael Copaif compile_prog "" "" ; then
28368bacde8dSNatanael Copa  :
28378bacde8dSNatanael Copaelif compile_prog "" "-lm" ; then
28388bacde8dSNatanael Copa  LIBS="-lm $LIBS"
28398bacde8dSNatanael Copa  libs_qga="-lm $libs_qga"
28408bacde8dSNatanael Copaelse
284176ad07a4SPeter Maydell  error_exit "libm check failed"
28428bacde8dSNatanael Copafi
28438bacde8dSNatanael Copa
28448bacde8dSNatanael Copa##########################################
2845da93a1fdSaliguori# Do we need librt
28468bacde8dSNatanael Copa# uClibc provides 2 versions of clock_gettime(), one with realtime
28478bacde8dSNatanael Copa# support and one without. This means that the clock_gettime() don't
28488bacde8dSNatanael Copa# need -lrt. We still need it for timer_create() so we check for this
28498bacde8dSNatanael Copa# function in addition.
2850da93a1fdSaliguoricat > $TMPC <<EOF
2851da93a1fdSaliguori#include <signal.h>
2852da93a1fdSaliguori#include <time.h>
28538bacde8dSNatanael Copaint main(void) {
28548bacde8dSNatanael Copa  timer_create(CLOCK_REALTIME, NULL, NULL);
28558bacde8dSNatanael Copa  return clock_gettime(CLOCK_REALTIME, NULL);
28568bacde8dSNatanael Copa}
2857da93a1fdSaliguoriEOF
2858da93a1fdSaliguori
285952166aa0SJuan Quintelaif compile_prog "" "" ; then
286007ffa4bdSJuan Quintela  :
28618bacde8dSNatanael Copa# we need pthread for static linking. use previous pthread test result
28628bacde8dSNatanael Copaelif compile_prog "" "-lrt $pthread_lib" ; then
286307ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
28648bacde8dSNatanael Copa  libs_qga="-lrt $libs_qga"
2865da93a1fdSaliguorifi
2866da93a1fdSaliguori
286731ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2868179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
28696362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
28706362a53fSJuan Quintelafi
28716362a53fSJuan Quintela
2872de5071c5SBlue Swirl##########################################
2873cd4ec0b4SGerd Hoffmann# spice probe
2874cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2875cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2876cd4ec0b4SGerd Hoffmann#include <spice.h>
2877cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2878cd4ec0b4SGerd HoffmannEOF
2879710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2880710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
288167be6726SGerd Hoffmann  if $pkg_config --atleast-version=0.12.0 spice-server >/dev/null 2>&1 && \
2882358689feSMichal Privoznik     $pkg_config --atleast-version=0.12.3 spice-protocol > /dev/null 2>&1 && \
2883cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2884cd4ec0b4SGerd Hoffmann    spice="yes"
2885cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2886cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
28872e0e3c39SAlon Levy    spice_protocol_version=$($pkg_config --modversion spice-protocol)
28882e0e3c39SAlon Levy    spice_server_version=$($pkg_config --modversion spice-server)
2889cd4ec0b4SGerd Hoffmann  else
2890cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2891cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2892cd4ec0b4SGerd Hoffmann    fi
2893cd4ec0b4SGerd Hoffmann    spice="no"
2894cd4ec0b4SGerd Hoffmann  fi
2895cd4ec0b4SGerd Hoffmannfi
2896cd4ec0b4SGerd Hoffmann
2897111a38b0SRobert Relyea# check for libcacard for smartcard support
2898111a38b0SRobert Relyeasmartcard_cflags=""
2899111a38b0SRobert Relyea# TODO - what's the minimal nss version we support?
2900111a38b0SRobert Relyeaif test "$smartcard_nss" != "no"; then
29015f01e06fSSergei Trofimovich  cat > $TMPC << EOF
29025f01e06fSSergei Trofimovich#include <pk11pub.h>
29035f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
29045f01e06fSSergei TrofimovichEOF
29050b22ef0fSPeter Maydell    smartcard_includes="-I\$(SRC_PATH)/libcacard"
29068c741c22SAlon Levy    libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
29078c741c22SAlon Levy    libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
29086ca026cbSPeter Maydell    test_cflags="$libcacard_cflags"
29096ca026cbSPeter Maydell    # The header files in nss < 3.13.3 have a bug which causes them to
29106ca026cbSPeter Maydell    # emit a warning. If we're going to compile QEMU with -Werror, then
29116ca026cbSPeter Maydell    # test that the headers don't have this bug. Otherwise we would pass
29126ca026cbSPeter Maydell    # the configure test but fail to compile QEMU later.
29136ca026cbSPeter Maydell    if test "$werror" = "yes"; then
29146ca026cbSPeter Maydell        test_cflags="-Werror $test_cflags"
29156ca026cbSPeter Maydell    fi
2916b6fc675bSPaolo Bonzini    if test -n "$libtool" &&
2917b6fc675bSPaolo Bonzini            $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
29186ca026cbSPeter Maydell      compile_prog "$test_cflags" "$libcacard_libs"; then
29195f01e06fSSergei Trofimovich        smartcard_nss="yes"
29200b22ef0fSPeter Maydell        QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
29210b22ef0fSPeter Maydell        QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
2922ad4cf3f6SPaul Brook        libs_softmmu="$libcacard_libs $libs_softmmu"
2923111a38b0SRobert Relyea    else
2924111a38b0SRobert Relyea        if test "$smartcard_nss" = "yes"; then
2925111a38b0SRobert Relyea            feature_not_found "nss"
2926111a38b0SRobert Relyea        fi
2927111a38b0SRobert Relyea        smartcard_nss="no"
2928111a38b0SRobert Relyea    fi
2929111a38b0SRobert Relyeafi
2930111a38b0SRobert Relyea
293169354a83SHans de Goede# check for usbredirparser for usb network redirection support
293269354a83SHans de Goedeif test "$usb_redir" != "no" ; then
2933b2d1fe67SHans de Goede    if $pkg_config --atleast-version=0.6 libusbredirparser-0.5 >/dev/null 2>&1 ; then
293469354a83SHans de Goede        usb_redir="yes"
29358b626aa7SHans de Goede        usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5 2>/dev/null)
29368b626aa7SHans de Goede        usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5 2>/dev/null)
293769354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
293856ab2ad1SAurelien Jarno        libs_softmmu="$libs_softmmu $usb_redir_libs"
293969354a83SHans de Goede    else
294069354a83SHans de Goede        if test "$usb_redir" = "yes"; then
294169354a83SHans de Goede            feature_not_found "usb-redir"
294269354a83SHans de Goede        fi
294369354a83SHans de Goede        usb_redir="no"
294469354a83SHans de Goede    fi
294569354a83SHans de Goedefi
294669354a83SHans de Goede
2947cd4ec0b4SGerd Hoffmann##########################################
2948cd4ec0b4SGerd Hoffmann
2949747bbdf7SBlue Swirl##########################################
29505f6b9e8fSBlue Swirl# check if we have fdatasync
29515f6b9e8fSBlue Swirl
29525f6b9e8fSBlue Swirlfdatasync=no
29535f6b9e8fSBlue Swirlcat > $TMPC << EOF
29545f6b9e8fSBlue Swirl#include <unistd.h>
2955d1722a27SAlexandre Raymondint main(void) {
2956d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2957d1722a27SAlexandre Raymondreturn fdatasync(0);
2958d1722a27SAlexandre Raymond#else
2959e172fe11SStefan Weil#error Not supported
2960d1722a27SAlexandre Raymond#endif
2961d1722a27SAlexandre Raymond}
29625f6b9e8fSBlue SwirlEOF
29635f6b9e8fSBlue Swirlif compile_prog "" "" ; then
29645f6b9e8fSBlue Swirl    fdatasync=yes
29655f6b9e8fSBlue Swirlfi
29665f6b9e8fSBlue Swirl
296794a420b1SStefan Hajnoczi##########################################
2968e78815a5SAndreas Färber# check if we have madvise
2969e78815a5SAndreas Färber
2970e78815a5SAndreas Färbermadvise=no
2971e78815a5SAndreas Färbercat > $TMPC << EOF
2972e78815a5SAndreas Färber#include <sys/types.h>
2973e78815a5SAndreas Färber#include <sys/mman.h>
2974832ce9c2SScott Wood#include <stddef.h>
2975e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2976e78815a5SAndreas FärberEOF
2977e78815a5SAndreas Färberif compile_prog "" "" ; then
2978e78815a5SAndreas Färber    madvise=yes
2979e78815a5SAndreas Färberfi
2980e78815a5SAndreas Färber
2981e78815a5SAndreas Färber##########################################
2982e78815a5SAndreas Färber# check if we have posix_madvise
2983e78815a5SAndreas Färber
2984e78815a5SAndreas Färberposix_madvise=no
2985e78815a5SAndreas Färbercat > $TMPC << EOF
2986e78815a5SAndreas Färber#include <sys/mman.h>
2987832ce9c2SScott Wood#include <stddef.h>
2988e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2989e78815a5SAndreas FärberEOF
2990e78815a5SAndreas Färberif compile_prog "" "" ; then
2991e78815a5SAndreas Färber    posix_madvise=yes
2992e78815a5SAndreas Färberfi
2993e78815a5SAndreas Färber
2994e78815a5SAndreas Färber##########################################
29951e9737daSRichard Henderson# check if we have usable SIGEV_THREAD_ID
29961e9737daSRichard Henderson
29971e9737daSRichard Hendersonsigev_thread_id=no
29981e9737daSRichard Hendersoncat > $TMPC << EOF
29991e9737daSRichard Henderson#include <signal.h>
30001e9737daSRichard Hendersonint main(void) {
30011e9737daSRichard Henderson  struct sigevent ev;
30021e9737daSRichard Henderson  ev.sigev_notify = SIGEV_THREAD_ID;
30031e9737daSRichard Henderson  ev._sigev_un._tid = 0;
30041e9737daSRichard Henderson  asm volatile("" : : "g"(&ev));
30051e9737daSRichard Henderson  return 0;
30061e9737daSRichard Henderson}
30071e9737daSRichard HendersonEOF
30081e9737daSRichard Hendersonif compile_prog "" "" ; then
30091e9737daSRichard Henderson    sigev_thread_id=yes
30101e9737daSRichard Hendersonfi
30111e9737daSRichard Henderson
30121e9737daSRichard Henderson##########################################
301394a420b1SStefan Hajnoczi# check if trace backend exists
301494a420b1SStefan Hajnoczi
3015650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
301694a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
301776ad07a4SPeter Maydell  error_exit "invalid trace backend" \
301876ad07a4SPeter Maydell      "Please choose a supported trace backend."
301994a420b1SStefan Hajnoczifi
302094a420b1SStefan Hajnoczi
30217e24e92aSStefan Hajnoczi##########################################
30227e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
30237e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
30247e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
30257e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
30267e24e92aSStefan Hajnoczi#include <ust/marker.h>
30277e24e92aSStefan Hajnocziint main(void) { return 0; }
30287e24e92aSStefan HajnocziEOF
30297e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
303094b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
3031c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
30327e24e92aSStefan Hajnoczi  else
303376ad07a4SPeter Maydell    error_exit "Trace backend 'ust' missing libust header files"
30347e24e92aSStefan Hajnoczi  fi
30357e24e92aSStefan Hajnoczifi
3036b3d08c02SDaniel P. Berrange
3037b3d08c02SDaniel P. Berrange##########################################
3038b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
3039b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
3040b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
304176ad07a4SPeter Maydell    error_exit "dtrace command is not found in PATH $PATH"
3042b3d08c02SDaniel P. Berrange  fi
3043c276b17dSDaniel P. Berrange  trace_backend_stap="no"
3044c276b17dSDaniel P. Berrange  if has 'stap' ; then
3045c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
3046c276b17dSDaniel P. Berrange  fi
3047b3d08c02SDaniel P. Berrangefi
3048b3d08c02SDaniel P. Berrange
30497e24e92aSStefan Hajnoczi##########################################
3050023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains
3051023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit
3052023367e6SWolfgang Mauerer# specification is necessary
30531ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
3054023367e6SWolfgang Mauerer  cat > $TMPC << EOF
30557ace252aSStefan Weilstatic int sfaa(int *ptr)
3056023367e6SWolfgang Mauerer{
3057023367e6SWolfgang Mauerer  return __sync_fetch_and_and(ptr, 0);
3058023367e6SWolfgang Mauerer}
3059023367e6SWolfgang Mauerer
3060abab1a0fSStefan Weilint main(void)
3061023367e6SWolfgang Mauerer{
3062023367e6SWolfgang Mauerer  int val = 42;
3063023367e6SWolfgang Mauerer  sfaa(&val);
3064023367e6SWolfgang Mauerer  return val;
3065023367e6SWolfgang Mauerer}
3066023367e6SWolfgang MauererEOF
3067023367e6SWolfgang Mauerer  if ! compile_prog "" "" ; then
3068caa50971SPeter Maydell    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
3069023367e6SWolfgang Mauerer  fi
3070023367e6SWolfgang Mauererfi
3071023367e6SWolfgang Mauerer
3072023367e6SWolfgang Mauerer##########################################
3073519175a2SAlex Barcelo# check and set a backend for coroutine
3074d0e2fce5SAneesh Kumar K.V
30757c2acc70SPeter Maydell# We prefer ucontext, but it's not always possible. The fallback
30767c2acc70SPeter Maydell# is sigcontext. gthread is not selectable except explicitly, because
30777c2acc70SPeter Maydell# it is not functional enough to run QEMU proper. (It is occasionally
30787c2acc70SPeter Maydell# useful for debugging purposes.)  On Windows the only valid backend
30797c2acc70SPeter Maydell# is the Windows-specific one.
30807c2acc70SPeter Maydell
30817c2acc70SPeter Maydellucontext_works=no
3082d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then
3083d0e2fce5SAneesh Kumar K.V  cat > $TMPC << EOF
3084d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
3085cdf84806SPeter Maydell#ifdef __stub_makecontext
3086cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
3087cdf84806SPeter Maydell#endif
308875cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
3089d0e2fce5SAneesh Kumar K.VEOF
3090d0e2fce5SAneesh Kumar K.V  if compile_prog "" "" ; then
30917c2acc70SPeter Maydell    ucontext_works=yes
3092d0e2fce5SAneesh Kumar K.V  fi
3093519175a2SAlex Barcelofi
30947c2acc70SPeter Maydell
30957c2acc70SPeter Maydellif test "$coroutine" = ""; then
30967c2acc70SPeter Maydell  if test "$mingw32" = "yes"; then
30977c2acc70SPeter Maydell    coroutine=win32
30987c2acc70SPeter Maydell  elif test "$ucontext_works" = "yes"; then
30997c2acc70SPeter Maydell    coroutine=ucontext
3100519175a2SAlex Barcelo  else
31017c2acc70SPeter Maydell    coroutine=sigaltstack
31027c2acc70SPeter Maydell  fi
31037c2acc70SPeter Maydellelse
31047c2acc70SPeter Maydell  case $coroutine in
31057c2acc70SPeter Maydell  windows)
31067c2acc70SPeter Maydell    if test "$mingw32" != "yes"; then
31077c2acc70SPeter Maydell      error_exit "'windows' coroutine backend only valid for Windows"
31087c2acc70SPeter Maydell    fi
31097c2acc70SPeter Maydell    # Unfortunately the user visible backend name doesn't match the
31107c2acc70SPeter Maydell    # coroutine-*.c filename for this case, so we have to adjust it here.
31117c2acc70SPeter Maydell    coroutine=win32
31127c2acc70SPeter Maydell    ;;
31137c2acc70SPeter Maydell  ucontext)
31147c2acc70SPeter Maydell    if test "$ucontext_works" != "yes"; then
31157c2acc70SPeter Maydell      feature_not_found "ucontext"
31167c2acc70SPeter Maydell    fi
31177c2acc70SPeter Maydell    ;;
31187c2acc70SPeter Maydell  gthread|sigaltstack)
31197c2acc70SPeter Maydell    if test "$mingw32" = "yes"; then
31207c2acc70SPeter Maydell      error_exit "only the 'windows' coroutine backend is valid for Windows"
31217c2acc70SPeter Maydell    fi
31227c2acc70SPeter Maydell    ;;
31237c2acc70SPeter Maydell  *)
312476ad07a4SPeter Maydell    error_exit "unknown coroutine backend $coroutine"
31257c2acc70SPeter Maydell    ;;
31267c2acc70SPeter Maydell  esac
3127d0e2fce5SAneesh Kumar K.Vfi
3128d0e2fce5SAneesh Kumar K.V
3129d0e2fce5SAneesh Kumar K.V##########################################
3130d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
3131d2042378SAneesh Kumar K.V
31324e1797f9SStefan Weilopen_by_handle_at=no
3133d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
3134d2042378SAneesh Kumar K.V#include <fcntl.h>
3135acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
3136acc55ba8SStefan Weil# error missing definition
3137acc55ba8SStefan Weil#else
313875cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
3139acc55ba8SStefan Weil#endif
3140d2042378SAneesh Kumar K.VEOF
3141d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
3142d2042378SAneesh Kumar K.V    open_by_handle_at=yes
3143d2042378SAneesh Kumar K.Vfi
3144d2042378SAneesh Kumar K.V
3145e06a765eSHarsh Prateek Bora########################################
3146e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
3147e06a765eSHarsh Prateek Bora
3148e06a765eSHarsh Prateek Boralinux_magic_h=no
3149e06a765eSHarsh Prateek Boracat > $TMPC << EOF
3150e06a765eSHarsh Prateek Bora#include <linux/magic.h>
3151e06a765eSHarsh Prateek Boraint main(void) {
315275cafad7SStefan Weil  return 0;
3153e06a765eSHarsh Prateek Bora}
3154e06a765eSHarsh Prateek BoraEOF
3155e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
3156e06a765eSHarsh Prateek Bora    linux_magic_h=yes
3157e06a765eSHarsh Prateek Borafi
3158e06a765eSHarsh Prateek Bora
31598ab1bf12SLuiz Capitulino########################################
3160c95e3080SKevin Wolf# check whether we can disable warning option with a pragma (this is needed
3161c95e3080SKevin Wolf# to silence warnings in the headers of some versions of external libraries).
3162c95e3080SKevin Wolf# This test has to be compiled with -Werror as otherwise an unknown pragma is
3163c95e3080SKevin Wolf# only a warning.
3164c95e3080SKevin Wolf#
3165c95e3080SKevin Wolf# If we can't selectively disable warning in the code, disable -Werror so that
3166c95e3080SKevin Wolf# the build doesn't fail anyway.
3167c95e3080SKevin Wolf
316806d71fa1SPeter Maydellpragma_disable_unused_but_set=no
316906d71fa1SPeter Maydellcat > $TMPC << EOF
317006d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
3171c95e3080SKevin Wolf#pragma GCC diagnostic ignored "-Wstrict-prototypes"
3172c95e3080SKevin Wolf
317306d71fa1SPeter Maydellint main(void) {
317406d71fa1SPeter Maydell    return 0;
317506d71fa1SPeter Maydell}
317606d71fa1SPeter MaydellEOF
317706d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then
3178cc6e3ca9SGerd Hoffmann    pragma_diagnostic_available=yes
3179c95e3080SKevin Wolfelse
3180c95e3080SKevin Wolf    werror=no
318106d71fa1SPeter Maydellfi
318206d71fa1SPeter Maydell
318306d71fa1SPeter Maydell########################################
318462fe8331SChristian Borntraeger# check if we have valgrind/valgrind.h and valgrind/memcheck.h
31853f4349dcSKevin Wolf
31863f4349dcSKevin Wolfvalgrind_h=no
31873f4349dcSKevin Wolfcat > $TMPC << EOF
31883f4349dcSKevin Wolf#include <valgrind/valgrind.h>
318962fe8331SChristian Borntraeger#include <valgrind/memcheck.h>
31903f4349dcSKevin Wolfint main(void) {
31913f4349dcSKevin Wolf  return 0;
31923f4349dcSKevin Wolf}
31933f4349dcSKevin WolfEOF
31943f4349dcSKevin Wolfif compile_prog "" "" ; then
31953f4349dcSKevin Wolf    valgrind_h=yes
31963f4349dcSKevin Wolffi
31973f4349dcSKevin Wolf
31983f4349dcSKevin Wolf########################################
31998ab1bf12SLuiz Capitulino# check if environ is declared
32008ab1bf12SLuiz Capitulino
32018ab1bf12SLuiz Capitulinohas_environ=no
32028ab1bf12SLuiz Capitulinocat > $TMPC << EOF
32038ab1bf12SLuiz Capitulino#include <unistd.h>
32048ab1bf12SLuiz Capitulinoint main(void) {
3205c075a723SBlue Swirl    environ = 0;
32068ab1bf12SLuiz Capitulino    return 0;
32078ab1bf12SLuiz Capitulino}
32088ab1bf12SLuiz CapitulinoEOF
32098ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
32108ab1bf12SLuiz Capitulino    has_environ=yes
32118ab1bf12SLuiz Capitulinofi
32128ab1bf12SLuiz Capitulino
321376a347e1SRichard Henderson########################################
321476a347e1SRichard Henderson# check if cpuid.h is usable.
321576a347e1SRichard Henderson
321676a347e1SRichard Hendersoncpuid_h=no
321776a347e1SRichard Hendersoncat > $TMPC << EOF
321876a347e1SRichard Henderson#include <cpuid.h>
321976a347e1SRichard Hendersonint main(void) {
322076a347e1SRichard Henderson  return 0;
322176a347e1SRichard Henderson}
322276a347e1SRichard HendersonEOF
322376a347e1SRichard Hendersonif compile_prog "" "" ; then
322476a347e1SRichard Henderson    cpuid_h=yes
322576a347e1SRichard Hendersonfi
322676a347e1SRichard Henderson
3227f540166bSRichard Henderson########################################
3228f540166bSRichard Henderson# check if __[u]int128_t is usable.
3229f540166bSRichard Henderson
3230f540166bSRichard Hendersonint128=no
3231f540166bSRichard Hendersoncat > $TMPC << EOF
3232f540166bSRichard Henderson__int128_t a;
3233f540166bSRichard Henderson__uint128_t b;
3234f540166bSRichard Hendersonint main (void) {
3235f540166bSRichard Henderson  a = a + b;
3236f540166bSRichard Henderson  b = a * b;
3237f540166bSRichard Henderson  return 0;
3238f540166bSRichard Henderson}
3239f540166bSRichard HendersonEOF
3240f540166bSRichard Hendersonif compile_prog "" "" ; then
3241f540166bSRichard Henderson    int128=yes
3242f540166bSRichard Hendersonfi
324376a347e1SRichard Henderson
3244d2042378SAneesh Kumar K.V##########################################
3245e86ecd4bSJuan Quintela# End of CC checks
3246e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
3247e86ecd4bSJuan Quintela
32481d728c39SBlue Swirlif test "$gcov" = "yes" ; then
32491d728c39SBlue Swirl  CFLAGS="-fprofile-arcs -ftest-coverage -g $CFLAGS"
32501d728c39SBlue Swirl  LDFLAGS="-fprofile-arcs -ftest-coverage $LDFLAGS"
32511d728c39SBlue Swirlelif test "$debug" = "no" ; then
32528be74dc0SAvi Kivity  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
3253e86ecd4bSJuan Quintelafi
3254a316e378SJuan Quintela
32551d728c39SBlue Swirl
325620ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
325720ff6c80SAnthony Liguori# enable/disable
325820ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
325920ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
326020ff6c80SAnthony Liguori	zero_malloc="no"
326120ff6c80SAnthony Liguori    else
326220ff6c80SAnthony Liguori	zero_malloc="yes"
326320ff6c80SAnthony Liguori    fi
326420ff6c80SAnthony Liguorifi
326520ff6c80SAnthony Liguori
32666ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags
32676ca026cbSPeter Maydellif test "$werror" = "yes"; then
32686ca026cbSPeter Maydell    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
32696ca026cbSPeter Maydellfi
32706ca026cbSPeter Maydell
3271e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
3272e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
32731156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
3274e86ecd4bSJuan Quintela    fi
3275e86ecd4bSJuan Quintelafi
3276e86ecd4bSJuan Quintela
327794dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
327894dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
327994dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
328094dd53c5SGerd Hoffmannelse
328194dd53c5SGerd Hoffmann    POD2MAN="pod2man"
328294dd53c5SGerd Hoffmannfi
328394dd53c5SGerd Hoffmann
3284952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
3285952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
3286952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
3287952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
3288952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
3289952afb71SBlue Swirl        fi
3290952afb71SBlue Swirl    done
3291952afb71SBlue Swirlfi
3292952afb71SBlue Swirl
329310ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
3294528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
3295834574eaSAnthony Liguoriqemu_localedir="$datadir/locale"
32965a67135aSbellard
32974b1c11fdSDaniel P. Berrangetools=""
32984b1c11fdSDaniel P. Berrangeif test "$want_tools" = "yes" ; then
3299ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
33004b1c11fdSDaniel P. Berrange  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
33014b1c11fdSDaniel P. Berrange    tools="qemu-nbd\$(EXESUF) $tools"
33024b1c11fdSDaniel P. Berrange  fi
33034b1c11fdSDaniel P. Berrangefi
33044b1c11fdSDaniel P. Berrangeif test "$softmmu" = yes ; then
3305983eef5aSMeador Inge  if test "$virtfs" != no ; then
3306be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
3307983eef5aSMeador Inge      virtfs=yes
330817bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
3309983eef5aSMeador Inge    else
3310983eef5aSMeador Inge      if test "$virtfs" = yes; then
331176ad07a4SPeter Maydell        error_exit "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
3312983eef5aSMeador Inge      fi
331317500370SAndreas Färber      virtfs=no
3314983eef5aSMeador Inge    fi
331517bff52bSM. Mohan Kumar  fi
3316ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
3317d138cee9SMichael Roth    if [ "$guest_agent" = "yes" ]; then
331848ff7a62SMichael Roth      tools="qemu-ga\$(EXESUF) $tools"
3319d138cee9SMichael Roth    fi
3320ca35f780SPaolo Bonzini  fi
33214b1c11fdSDaniel P. Berrangefi
3322ca35f780SPaolo Bonzini
3323ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
3324ca35f780SPaolo Bonziniroms=
3325ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3326ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3327ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
3328ca35f780SPaolo Bonzini  roms="optionrom"
3329ca35f780SPaolo Bonzinifi
3330d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
333139ac8455SDavid Gibson  roms="$roms spapr-rtas"
333239ac8455SDavid Gibsonfi
3333ca35f780SPaolo Bonzini
33345ca9388aSGerd Hoffmann# add pixman flags after all config tests are done
33355ca9388aSGerd HoffmannQEMU_CFLAGS="$QEMU_CFLAGS $pixman_cflags"
33365ca9388aSGerd Hoffmannlibs_softmmu="$libs_softmmu $pixman_libs"
33375ca9388aSGerd Hoffmann
33387d13299dSbellardecho "Install prefix    $prefix"
3339c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
3340f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
33413aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
33428bf188aaSMichael Tokarevecho "libexec directory `eval echo $libexecdir`"
33430f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
33441c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
3345785c23aeSLuiz Capitulinoecho "local state directory   `eval echo $local_statedir`"
334611d9f695Sbellardif test "$mingw32" = "no" ; then
3347f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
334843ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
334911d9f695Sbellardfi
33505a67135aSbellardecho "Source path       $source_path"
33517d13299dSbellardecho "C compiler        $cc"
335283469015Sbellardecho "Host C compiler   $host_cc"
33533c4a4d0dSPeter Maydellecho "Objective-C compiler $objcc"
33540c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
3355a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
33560c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
33577d13299dSbellardecho "make              $make"
33586a882643Spbrookecho "install           $install"
3359c886edfbSBlue Swirlecho "python            $python"
3360e2d8830eSBradif test "$slirp" = "yes" ; then
3361e2d8830eSBrad    echo "smbd              $smbd"
3362e2d8830eSBradfi
3363a98fd896Sbellardecho "host CPU          $cpu"
3364de83cd02Sbellardecho "host big endian   $bigendian"
336597a847bcSbellardecho "target list       $target_list"
3366ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
33677d13299dSbellardecho "gprof enabled     $gprof"
336803b4fe7dSaliguoriecho "sparse enabled    $sparse"
33691625af87Saliguoriecho "strip binaries    $strip_opt"
337005c2a3e7Sbellardecho "profiler          $profiler"
337143ce4dfeSbellardecho "static build      $static"
337285aa5189Sbellardecho "-Werror enabled   $werror"
33735b0753e0Sbellardif test "$darwin" = "yes" ; then
33745b0753e0Sbellard    echo "Cocoa support     $cocoa"
33755b0753e0Sbellardfi
3376e2134eb9SGerd Hoffmannecho "pixman            $pixman"
337797a847bcSbellardecho "SDL support       $sdl"
3378a4ccabcfSAnthony Liguoriecho "GTK support       $gtk"
33794d3b6f6eSbalrogecho "curses support    $curses"
3380769ce76dSAlexander Grafecho "curl support      $curl"
338167b915a5Sbellardecho "mingw32 support   $mingw32"
33820c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
33830c58ac1cSmalcecho "Extra audio cards $audio_card_list"
3384eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
33858ff9cbf7Smalcecho "Mixer emulation   $mixemu"
3386983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3387821601eaSJes Sorensenecho "VNC support       $vnc"
3388821601eaSJes Sorensenif test "$vnc" = "yes" ; then
33898d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
33902f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
33912f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3392efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
33937536ee4bSTim Hardeck    echo "VNC WS support    $vnc_ws"
3394821601eaSJes Sorensenfi
33953142255cSblueswir1if test -n "$sparc_cpu"; then
33963142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
33973142255cSblueswir1fi
3398e37630caSaliguoriecho "xen support       $xen"
33992e4d9fb1Saurel32echo "brlapi support    $brlapi"
3400a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3401a25dba17SJuan Quintelaecho "Documentation     $docs"
3402c5937220Spbrook[ ! -z "$uname_release" ] && \
3403c5937220Spbrookecho "uname -r          $uname_release"
3404bd0c5661Spbrookecho "NPTL support      $nptl"
3405379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
340640d6444eSAvi Kivityecho "PIE               $pie"
34078a16d273Sthsecho "vde support       $vde"
34085c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3409758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
341077755340Sthsecho "Install blobs     $blobs"
3411b31a0277SJuan Quintelaecho "KVM support       $kvm"
34129195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3413f652e6afSaurel32echo "fdt support       $fdt"
3414ceb42de8Saliguoriecho "preadv support    $preadv"
34155f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3416e78815a5SAndreas Färberecho "madvise           $madvise"
3417e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
34181e9737daSRichard Hendersonecho "sigev_thread_id   $sigev_thread_id"
3419ee682d27SStefan Weilecho "uuid support      $uuid"
342047e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3421d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
342294a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
34239410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
34242e0e3c39SAlon Levyecho "spice support     $spice ($spice_protocol_version/$spice_server_version)"
3425f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3426dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3427111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
342869354a83SHans de Goedeecho "usb net redir     $usb_redir"
3429b1e5fff4SMichael Walleecho "GLX support       $glx"
3430c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3431d138cee9SMichael Rothecho "build guest agent $guest_agent"
3432f794573eSEduardo Otuboecho "seccomp support   $seccomp"
34337c2acc70SPeter Maydellecho "coroutine backend $coroutine"
3434eb100396SBharata B Raoecho "GlusterFS support $glusterfs"
3435583f6e7bSStefan Hajnocziecho "virtio-blk-data-plane $virtio_blk_data_plane"
34361d728c39SBlue Swirlecho "gcov              $gcov_tool"
34371d728c39SBlue Swirlecho "gcov enabled      $gcov"
3438ab214c29SStefan Bergerecho "TPM support       $tpm"
343967b915a5Sbellard
34401ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
344124b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3442e8cd23deSbellardfi
344397a847bcSbellard
344498ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
34454bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
344697a847bcSbellard
3447dbd99ae3SStefan Weilecho "# Automatically generated by configure - do not modify" >config-all-disas.mak
3448dbd99ae3SStefan Weil
344998ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
345098ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
345198ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
345298ec69acSJuan Quintelaecho >> $config_host_mak
345398ec69acSJuan Quintela
3454e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
345599d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
345699d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
34573aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
34588bf188aaSMichael Tokarevecho "libexecdir=$libexecdir" >> $config_host_mak
34590f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
346099d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
346199d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
346222d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
34639afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
34649afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
3465785c23aeSLuiz Capitulinoecho "qemu_localstatedir=$local_statedir" >> $config_host_mak
3466f354b1a1SMichael Tokarevecho "qemu_helperdir=$libexecdir" >> $config_host_mak
3467f9943cd5SGerd Hoffmannecho "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
3468f9943cd5SGerd Hoffmannecho "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
3469834574eaSAnthony Liguoriecho "qemu_localedir=$qemu_localedir" >> $config_host_mak
3470804edf29SJuan Quintela
347198ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3472f8393946Saurel32if test "$debug_tcg" = "yes" ; then
34732358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3474f8393946Saurel32fi
34751625af87Saliguoriif test "$strip_opt" = "yes" ; then
347652ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
34771625af87Saliguorifi
34787d13299dSbellardif test "$bigendian" = "yes" ; then
3479e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
348097a847bcSbellardfi
348167b915a5Sbellardif test "$mingw32" = "yes" ; then
348298ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
34839fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
34849fe6de94SBlue Swirl  version_major=${rc_version%%.*}
34859fe6de94SBlue Swirl  rc_version=${rc_version#*.}
34869fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
34879fe6de94SBlue Swirl  rc_version=${rc_version#*.}
34889fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
34899fe6de94SBlue Swirl  version_micro=0
34909fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
34919fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3492210fa556Spbrookelse
349335f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3494210fa556Spbrookfi
3495128ab2ffSblueswir1
3496dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3497dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3498dffcb71cSMark McLoughlinfi
3499dffcb71cSMark McLoughlin
350083fb7adfSbellardif test "$darwin" = "yes" ; then
350198ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
350283fb7adfSbellardfi
3503b29fe3edSmalc
3504b29fe3edSmalcif test "$aix" = "yes" ; then
350598ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3506b29fe3edSmalcfi
3507b29fe3edSmalc
3508ec530c81Sbellardif test "$solaris" = "yes" ; then
350998ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
35102358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
35110475a5caSths  if test "$needs_libsunmath" = "yes" ; then
351275b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
35130475a5caSths  fi
3514ec530c81Sbellardfi
3515179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3516179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3517179cf400SAndreas Färberfi
351897a847bcSbellardif test "$static" = "yes" ; then
351998ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
352097a847bcSbellardfi
35211ba16968SStefan Weilif test "$profiler" = "yes" ; then
35222358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
352305c2a3e7Sbellardfi
3524c20709aaSbellardif test "$slirp" = "yes" ; then
352598ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3526e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3527c20709aaSbellardfi
35288a16d273Sthsif test "$vde" = "yes" ; then
352998ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
35308a16d273Sthsfi
353147e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
353247e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
353347e98658SCorey Bryantfi
35340c58ac1cSmalcfor card in $audio_card_list; do
3535bb55b712SStefan Weil    def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
353698ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
35370c58ac1cSmalcdone
35382358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
35390c58ac1cSmalcfor drv in $audio_drv_list; do
3540bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
354198ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3542923e4521Smalc    if test "$drv" = "fmod"; then
35437aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3544fb065187Sbellard    fi
35450c58ac1cSmalcdone
354667f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
354767f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
354867f86e8eSJuan Quintelafi
3549d5631638Smalcif test "$audio_win_int" = "yes" ; then
3550d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3551d5631638Smalcfi
3552eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
35538ff9cbf7Smalcif test "$mixemu" = "yes" ; then
355498ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
35558ff9cbf7Smalcfi
3556821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3557821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3558821601eaSJes Sorensenfi
35598d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
356098ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
35618d5d2d4cSthsfi
35622f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
356398ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
35642f9606b3Saliguorifi
3565821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
35662f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
35672f6f5c7aSCorentin Charyfi
3568821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3569efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3570efe556adSCorentin Charyfi
35717536ee4bSTim Hardeckif test "$vnc_ws" = "yes" ; then
35727536ee4bSTim Hardeck  echo "CONFIG_VNC_WS=y" >> $config_host_mak
35737536ee4bSTim Hardeck  echo "VNC_WS_CFLAGS=$vnc_ws_cflags" >> $config_host_mak
35747536ee4bSTim Hardeckfi
357576655d6dSaliguoriif test "$fnmatch" = "yes" ; then
35762358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
357776655d6dSaliguorifi
3578ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3579ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3580ee682d27SStefan Weilfi
3581dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3582dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3583dce512deSChristoph Hellwigfi
3584b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
358598ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
35862358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
358798ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
358898ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3589a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
359098ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3591cc8ae6deSpbrookfi
35921ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
359398ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
35948ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
359549ecc3faSbellardfi
359649ecc3faSbellardif test "$cocoa" = "yes" ; then
359798ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
359849ecc3faSbellardfi
35994d3b6f6eSbalrogif test "$curses" = "yes" ; then
360098ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3601ab4e5602SJan Kiszkafi
36023b3f24adSaurel32if test "$atfile" = "yes" ; then
36032358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
36043b3f24adSaurel32fi
3605ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
36062358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3607ebc996f3SRiku Voipiofi
3608099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
36092358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3610099d6b0fSRiku Voipiofi
361140ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
361240ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
361340ff6d7eSKevin Wolffi
36143ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
36152358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
36163ce34dfbSvibisreenivasanfi
3617c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3618c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3619c2882b96SRiku Voipiofi
3620d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3621d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3622d0927938SUlrich Hechtfi
36233d4fa43eSKusanagi Kouichiif test "$fallocate_punch_hole" = "yes" ; then
36243d4fa43eSKusanagi Kouichi  echo "CONFIG_FALLOCATE_PUNCH_HOLE=y" >> $config_host_mak
36253d4fa43eSKusanagi Kouichifi
3626c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3627c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3628c727f47dSPeter Maydellfi
3629dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3630dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3631dace20dcSPeter Maydellfi
3632d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3633d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3634d0927938SUlrich Hechtfi
36353b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
36363b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
36373b6edd16SPeter Maydellfi
36383b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
36393b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
36403b6edd16SPeter Maydellfi
36413b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
36423b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
36433b6edd16SPeter Maydellfi
3644a8fd1abaSPeter Maydellif test "$sendfile" = "yes" ; then
3645a8fd1abaSPeter Maydell  echo "CONFIG_SENDFILE=y" >> $config_host_mak
3646a8fd1abaSPeter Maydellfi
36473b3f24adSaurel32if test "$inotify" = "yes" ; then
36482358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
36493b3f24adSaurel32fi
3650c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
3651c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3652c05c7a73SRiku Voipiofi
36536ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
36546ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
36556ae9a1f4SJuan Quintelafi
36566ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
36576ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
36586ae9a1f4SJuan Quintelafi
3659769ce76dSAlexander Grafif test "$curl" = "yes" ; then
366098ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
3661b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3662769ce76dSAlexander Graffi
36632e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
366498ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
36652e4d9fb1Saurel32fi
3666fb599c9aSbalrogif test "$bluez" = "yes" ; then
366798ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
3668ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3669fb599c9aSbalrogfi
3670e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3671a4ccabcfSAnthony Liguoriif test "$gtk" = "yes" ; then
3672a4ccabcfSAnthony Liguori  echo "CONFIG_GTK=y" >> $config_host_mak
3673a4ccabcfSAnthony Liguori  echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
3674a4ccabcfSAnthony Liguori  echo "VTE_CFLAGS=$vte_cflags" >> $config_host_mak
3675a4ccabcfSAnthony Liguorifi
3676e37630caSaliguoriif test "$xen" = "yes" ; then
36776dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3678d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3679e37630caSaliguorifi
36805c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
36815c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
36825c6c3a6cSChristoph Hellwigfi
3683758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
3684758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
3685758e8e38SVenkateswararao Jujjuri (JV)fi
36864f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
36874f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
36884f26f2b6SAvi Kivityfi
3689983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
3690758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
3691758e8e38SVenkateswararao Jujjuri (JV)fi
369277755340Sthsif test "$blobs" = "yes" ; then
369398ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
369477755340Sthsfi
3695bf9298b9Saliguoriif test "$iovec" = "yes" ; then
36962358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
3697bf9298b9Saliguorifi
3698ceb42de8Saliguoriif test "$preadv" = "yes" ; then
36992358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
3700ceb42de8Saliguorifi
3701f652e6afSaurel32if test "$fdt" = "yes" ; then
37023f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
3703f652e6afSaurel32fi
3704dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
3705dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3706dcc38d1cSMarcelo Tosattifi
37079195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
37089195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
37099195b2c2SStefan Weilfi
37105f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
37115f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
37125f6b9e8fSBlue Swirlfi
3713e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
3714e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
3715e78815a5SAndreas Färberfi
3716e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
3717e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3718e78815a5SAndreas Färberfi
37191e9737daSRichard Hendersonif test "$sigev_thread_id" = "yes" ; then
37201e9737daSRichard Henderson  echo "CONFIG_SIGEV_THREAD_ID=y" >> $config_host_mak
37211e9737daSRichard Hendersonfi
372297a847bcSbellard
3723cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
3724cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
3725cd4ec0b4SGerd Hoffmannfi
3726cd4ec0b4SGerd Hoffmann
3727111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3728111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3729ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3730ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3731111a38b0SRobert Relyeafi
3732111a38b0SRobert Relyea
373369354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
373469354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
373569354a83SHans de Goedefi
373669354a83SHans de Goede
3737b1e5fff4SMichael Walleif test "$glx" = "yes" ; then
3738b1e5fff4SMichael Walle  echo "CONFIG_GLX=y" >> $config_host_mak
373920ff075bSMichael Wallefi
374020ff075bSMichael Walle
3741c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
3742c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3743c589b249SRonnie Sahlbergfi
3744c589b249SRonnie Sahlberg
3745f794573eSEduardo Otuboif test "$seccomp" = "yes"; then
3746f794573eSEduardo Otubo  echo "CONFIG_SECCOMP=y" >> $config_host_mak
3747f794573eSEduardo Otubofi
3748f794573eSEduardo Otubo
374983fb7adfSbellard# XXX: suppress that
37507d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
37512358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
37527d3505c5Sbellardfi
37537d3505c5Sbellard
37542358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3755c5937220Spbrook
375620ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
375720ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
375820ff6c80SAnthony Liguorifi
3759f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
3760f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
3761f27aaf4bSChristian Brunnerfi
376220ff6c80SAnthony Liguori
37637c2acc70SPeter Maydellecho "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
3764d0e2fce5SAneesh Kumar K.V
3765d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
3766d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3767d2042378SAneesh Kumar K.Vfi
3768d2042378SAneesh Kumar K.V
3769e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
3770e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3771e06a765eSHarsh Prateek Borafi
3772e06a765eSHarsh Prateek Bora
3773cc6e3ca9SGerd Hoffmannif test "$pragma_diagnostic_available" = "yes" ; then
3774cc6e3ca9SGerd Hoffmann  echo "CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE=y" >> $config_host_mak
377506d71fa1SPeter Maydellfi
377606d71fa1SPeter Maydell
37773f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then
37783f4349dcSKevin Wolf  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
37793f4349dcSKevin Wolffi
37803f4349dcSKevin Wolf
37818ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
37828ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
37838ab1bf12SLuiz Capitulinofi
37848ab1bf12SLuiz Capitulino
378576a347e1SRichard Hendersonif test "$cpuid_h" = "yes" ; then
378676a347e1SRichard Henderson  echo "CONFIG_CPUID_H=y" >> $config_host_mak
378776a347e1SRichard Hendersonfi
378876a347e1SRichard Henderson
3789f540166bSRichard Hendersonif test "$int128" = "yes" ; then
3790f540166bSRichard Henderson  echo "CONFIG_INT128=y" >> $config_host_mak
3791f540166bSRichard Hendersonfi
3792f540166bSRichard Henderson
3793eb100396SBharata B Raoif test "$glusterfs" = "yes" ; then
3794eb100396SBharata B Rao  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
3795eb100396SBharata B Raofi
3796eb100396SBharata B Rao
3797583f6e7bSStefan Hajnocziif test "$virtio_blk_data_plane" = "yes" ; then
37986e790746SPaolo Bonzini  echo 'CONFIG_VIRTIO_BLK_DATA_PLANE=$(CONFIG_VIRTIO)' >> $config_host_mak
3799583f6e7bSStefan Hajnoczifi
3800583f6e7bSStefan Hajnoczi
380168063649Sblueswir1# USB host support
380268063649Sblueswir1case "$usb" in
380368063649Sblueswir1linux)
38044075975dSGerd Hoffmann  echo "HOST_USB=linux legacy" >> $config_host_mak
380568063649Sblueswir1;;
380668063649Sblueswir1bsd)
380798ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
380868063649Sblueswir1;;
380968063649Sblueswir1*)
381098ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
381168063649Sblueswir1;;
381268063649Sblueswir1esac
381368063649Sblueswir1
3814e4858974SLluís# use default implementation for tracing backend-specific routines
3815e4858974SLluístrace_default=yes
381694a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
38176d8a764eSLluísif test "$trace_backend" = "nop"; then
38186d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
381922890ab5SPrerna Saxenafi
38209410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
38216d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3822e4858974SLluís  trace_default=no
38236d8a764eSLluís  # Set the appropriate trace file.
3824953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
38259410b56cSPrerna Saxenafi
38266d8a764eSLluísif test "$trace_backend" = "stderr"; then
38276d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
38289a82b6a5SLluís  trace_default=no
38296d8a764eSLluísfi
38306d8a764eSLluísif test "$trace_backend" = "ust"; then
38316d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
38326d8a764eSLluísfi
38336d8a764eSLluísif test "$trace_backend" = "dtrace"; then
38346d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
38356d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
38366d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
38376d8a764eSLluís  fi
3838c276b17dSDaniel P. Berrangefi
38399410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3840e4858974SLluísif test "$trace_default" = "yes"; then
3841e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3842e4858974SLluísfi
38439410b56cSPrerna Saxena
384498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
384598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
3846804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
3847804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
38481901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
38491901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
385021655882SPaolo Bonziniif test -n "$libtool"; then
385121655882SPaolo Bonzini  echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
385221655882SPaolo Bonzini  echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
385321655882SPaolo Bonzinielse
38541901cb14SBrad  echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
385521655882SPaolo Bonzini  echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
385621655882SPaolo Bonzinifi
3857c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
3858804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
38592b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
3860804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
38613c4a4d0dSPeter Maydellecho "OBJCC=$objcc" >> $config_host_mak
3862804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
38633dd46c78SBlue Swirlecho "AS=$as" >> $config_host_mak
38643dd46c78SBlue Swirlecho "CPP=$cpp" >> $config_host_mak
3865804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
3866804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
38679fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
386844dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
3869e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
3870a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3871f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3872e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
3873e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
3874e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
3875e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3876e39f0062SPaolo Bonzinifi
387742da6041SGerd Hoffmannif test "$cross_prefix" != ""; then
387842da6041SGerd Hoffmann  echo "AUTOCONF_HOST := --host=${cross_prefix%-}"     >> $config_host_mak
387942da6041SGerd Hoffmannelse
388042da6041SGerd Hoffmann  echo "AUTOCONF_HOST := "                             >> $config_host_mak
388142da6041SGerd Hoffmannfi
3882e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
388373da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
38843e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3885804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
3886957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
388794dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
3888cbdd1999SPaolo Bonziniecho "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak
38891d728c39SBlue Swirlif test "$gcov" = "yes" ; then
38901d728c39SBlue Swirl  echo "CONFIG_GCOV=y" >> $config_host_mak
38911d728c39SBlue Swirl  echo "GCOV=$gcov_tool" >> $config_host_mak
38921d728c39SBlue Swirlfi
3893804edf29SJuan Quintela
38944bf6b55bSJuan Quintela# generate list of library paths for linker script
38954bf6b55bSJuan Quintela
38964bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
38974bf6b55bSJuan Quintela
38984bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
38994bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
39004bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
39014bf6b55bSJuan Quintela  else
39024bf6b55bSJuan Quintela    rm ${config_host_ld}~
39034bf6b55bSJuan Quintela  fi
39044bf6b55bSJuan Quintelafi
39054bf6b55bSJuan Quintela
39066efd7517SPeter Maydell# use included Linux headers
39076efd7517SPeter Maydellif test "$linux" = "yes" ; then
3908a307beb6SAndreas Färber  mkdir -p linux-headers
39096efd7517SPeter Maydell  case "$cpu" in
39106efd7517SPeter Maydell  i386|x86_64)
391108312a63SPeter Maydell    linux_arch=x86
39126efd7517SPeter Maydell    ;;
39136efd7517SPeter Maydell  ppcemb|ppc|ppc64)
391408312a63SPeter Maydell    linux_arch=powerpc
39156efd7517SPeter Maydell    ;;
39166efd7517SPeter Maydell  s390x)
391708312a63SPeter Maydell    linux_arch=s390
391808312a63SPeter Maydell    ;;
391908312a63SPeter Maydell  *)
392008312a63SPeter Maydell    # For most CPUs the kernel architecture name and QEMU CPU name match.
392108312a63SPeter Maydell    linux_arch="$cpu"
39226efd7517SPeter Maydell    ;;
39236efd7517SPeter Maydell  esac
392408312a63SPeter Maydell    # For non-KVM architectures we will not have asm headers
392508312a63SPeter Maydell    if [ -e "$source_path/linux-headers/asm-$linux_arch" ]; then
392608312a63SPeter Maydell      symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
392708312a63SPeter Maydell    fi
39286efd7517SPeter Maydellfi
39296efd7517SPeter Maydell
393097a847bcSbellardfor target in $target_list; do
393197a847bcSbellardtarget_dir="$target"
393225be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
3933600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
393497a847bcSbellardtarget_bigendian="no"
39351f3d3c8fSJuan Quintela
3936ea2d6a39SJuan Quintelacase "$target_arch2" in
3937d15a9c23SAnthony Green  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3938ea2d6a39SJuan Quintela  target_bigendian=yes
3939ea2d6a39SJuan Quintela  ;;
3940ea2d6a39SJuan Quintelaesac
394197a847bcSbellardtarget_softmmu="no"
3942997344f3Sbellardtarget_user_only="no"
3943831b7825Sthstarget_linux_user="no"
394484778508Sblueswir1target_bsd_user="no"
39459e407a85Spbrookcase "$target" in
3946600309b6SBlue Swirl  ${target_arch2}-softmmu)
39479e407a85Spbrook    target_softmmu="yes"
39489e407a85Spbrook    ;;
3949600309b6SBlue Swirl  ${target_arch2}-linux-user)
39509c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
395176ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a Linux host"
39529c7a4202SBlue Swirl    fi
39539e407a85Spbrook    target_user_only="yes"
39549e407a85Spbrook    target_linux_user="yes"
39559e407a85Spbrook    ;;
3956600309b6SBlue Swirl  ${target_arch2}-bsd-user)
39579cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
395876ad07a4SPeter Maydell      error_exit "Target '$target' is only available on a BSD host"
39599c7a4202SBlue Swirl    fi
396084778508Sblueswir1    target_user_only="yes"
396184778508Sblueswir1    target_bsd_user="yes"
396284778508Sblueswir1    ;;
39639e407a85Spbrook  *)
396476ad07a4SPeter Maydell    error_exit "Target '$target' not recognised"
39659e407a85Spbrook    exit 1
39669e407a85Spbrook    ;;
39679e407a85Spbrookesac
3968831b7825Sths
396997a847bcSbellardmkdir -p $target_dir
397025be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
397197a847bcSbellard
3972e5fe0c52Spbrookbflt="no"
3973bd0c5661Spbrooktarget_nptl="no"
3974600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
397556aebc89Spbrookgdb_xml_files=""
3976c2e3dee6SLaurent Viviertarget_short_alignment=2
3977c2e3dee6SLaurent Viviertarget_int_alignment=4
3978c2e3dee6SLaurent Viviertarget_long_alignment=4
3979c2e3dee6SLaurent Viviertarget_llong_alignment=8
3980de3a354aSMichael Walletarget_libs_softmmu=
39817ba1e619Saliguori
3982938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
39836acff7daSJuan QuintelaTARGET_BASE_ARCH=""
3984e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
3985e73aae67SJuan Quintela
3986600309b6SBlue Swirlcase "$target_arch2" in
39872408a527Saurel32  i386)
39882408a527Saurel32  ;;
39892408a527Saurel32  x86_64)
39906acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
3991c2e3dee6SLaurent Vivier    target_long_alignment=8
39922408a527Saurel32  ;;
39932408a527Saurel32  alpha)
3994c2e3dee6SLaurent Vivier    target_long_alignment=8
3995a4b388ffSRichard Henderson    target_nptl="yes"
39962408a527Saurel32  ;;
39972408a527Saurel32  arm|armeb)
3998b498c8a0SJuan Quintela    TARGET_ARCH=arm
3999e5fe0c52Spbrook    bflt="yes"
4000bd0c5661Spbrook    target_nptl="yes"
400156aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
4002c2e3dee6SLaurent Vivier    target_llong_alignment=4
40032408a527Saurel32  ;;
40042408a527Saurel32  cris)
4005253bd7f8Sedgar_igl    target_nptl="yes"
40062408a527Saurel32  ;;
4007613a22c9SMichael Walle  lm32)
4008b1e5fff4SMichael Walle    target_libs_softmmu="$glx_libs"
4009613a22c9SMichael Walle  ;;
40102408a527Saurel32  m68k)
40110938cda5Saurel32    bflt="yes"
401256aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
4013c2e3dee6SLaurent Vivier    target_int_alignment=2
4014c2e3dee6SLaurent Vivier    target_long_alignment=2
4015c2e3dee6SLaurent Vivier    target_llong_alignment=2
40162408a527Saurel32  ;;
4017877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
4018877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
401972b675caSEdgar E. Iglesias    bflt="yes"
402072b675caSEdgar E. Iglesias    target_nptl="yes"
402172b675caSEdgar E. Iglesias  ;;
40222408a527Saurel32  mips|mipsel)
4023b498c8a0SJuan Quintela    TARGET_ARCH=mips
402425be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
4025f04dc72fSPaul Brook    target_nptl="yes"
40262408a527Saurel32  ;;
40272408a527Saurel32  mipsn32|mipsn32el)
4028597e2cecSRichard Henderson    TARGET_ARCH=mips64
40296acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
403025be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
4031597e2cecSRichard Henderson    echo "TARGET_ABI32=y" >> $config_target_mak
40322408a527Saurel32  ;;
40332408a527Saurel32  mips64|mips64el)
4034b498c8a0SJuan Quintela    TARGET_ARCH=mips64
40356acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
403625be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
4037c2e3dee6SLaurent Vivier    target_long_alignment=8
40382408a527Saurel32  ;;
4039d15a9c23SAnthony Green  moxie)
4040d15a9c23SAnthony Green  ;;
4041e67db06eSJia Liu  or32)
4042e67db06eSJia Liu    TARGET_ARCH=openrisc
4043e67db06eSJia Liu    TARGET_BASE_ARCH=openrisc
4044e67db06eSJia Liu  ;;
40452408a527Saurel32  ppc)
4046c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4047d6630708SNathan Froyd    target_nptl="yes"
40482408a527Saurel32  ;;
40492408a527Saurel32  ppcemb)
40506acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4051e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4052c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4053d6630708SNathan Froyd    target_nptl="yes"
40542408a527Saurel32  ;;
40552408a527Saurel32  ppc64)
40566acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4057e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
4058c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
4059c2e3dee6SLaurent Vivier    target_long_alignment=8
40602408a527Saurel32  ;;
40612408a527Saurel32  ppc64abi32)
4062b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
40636acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
4064e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
406525be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
4066c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
40672408a527Saurel32  ;;
40682408a527Saurel32  sh4|sh4eb)
4069b498c8a0SJuan Quintela    TARGET_ARCH=sh4
40704dbed897Spbrook    bflt="yes"
40710b6d3ae0Saurel32    target_nptl="yes"
40722408a527Saurel32  ;;
40732408a527Saurel32  sparc)
40742408a527Saurel32  ;;
40752408a527Saurel32  sparc64)
40766acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4077c2e3dee6SLaurent Vivier    target_long_alignment=8
40782408a527Saurel32  ;;
40792408a527Saurel32  sparc32plus)
4080b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
40816acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
4082e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
408325be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
40842408a527Saurel32  ;;
408524e804ecSAlexander Graf  s390x)
4086bc434676SUlrich Hecht    target_nptl="yes"
40877b3da903SAlexander Graf    target_long_alignment=8
408824e804ecSAlexander Graf  ;;
4089d2fbca94SGuan Xuetao  unicore32)
4090d2fbca94SGuan Xuetao  ;;
4091cfa550c6SMax Filippov  xtensa|xtensaeb)
4092cfa550c6SMax Filippov    TARGET_ARCH=xtensa
4093cfa550c6SMax Filippov  ;;
40942408a527Saurel32  *)
409576ad07a4SPeter Maydell    error_exit "Unsupported target CPU"
40962408a527Saurel32  ;;
40972408a527Saurel32esac
40985e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
40995e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
41005e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
41015e8861a0SPaolo Bonzinifi
41025e8861a0SPaolo Bonzini
41035e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
41045e8861a0SPaolo Bonzini
410599afc91dSDaniel P. Berrangeupper() {
410699afc91dSDaniel P. Berrange    echo "$@"| LC_ALL=C tr '[a-z]' '[A-Z]'
410799afc91dSDaniel P. Berrange}
410899afc91dSDaniel P. Berrange
410932761257SYeongkyoon Leecase "$cpu" in
4110ed224a56Smalc  i386|x86_64|ppc)
411113586813SStefan Weil    # The TCG interpreter currently does not support ld/st optimization.
411213586813SStefan Weil    if test "$tcg_interpreter" = "no" ; then
411332761257SYeongkyoon Lee        echo "CONFIG_QEMU_LDST_OPTIMIZATION=y" >> $config_target_mak
411413586813SStefan Weil    fi
411532761257SYeongkyoon Lee  ;;
411632761257SYeongkyoon Leeesac
411732761257SYeongkyoon Lee
4118c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
4119c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
4120c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
4121c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
412225be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
412399afc91dSDaniel P. Berrangetarget_arch_name="`upper $TARGET_ARCH`"
412425be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
412525be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
412699afc91dSDaniel P. Berrangeecho "TARGET_TYPE=TARGET_TYPE_`upper $target_arch2`" >> $config_target_mak
412725be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
4128e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
4129e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
4130e6e91b9cSJuan Quintelafi
413125be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
41321b0c87fcSJuan Quintelacase "$target_arch2" in
41331b0c87fcSJuan Quintela  i386|x86_64)
41341b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
413525be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
4136eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
4137eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
4138eb6fda0fSAnthony PERARD      fi
413959d21e53SAlexander Graf    else
414059d21e53SAlexander Graf      echo "CONFIG_NO_XEN=y" >> $config_target_mak
4141432d268cSJun Nakajima    fi
414259d21e53SAlexander Graf    ;;
414359d21e53SAlexander Graf  *)
414459d21e53SAlexander Graf    echo "CONFIG_NO_XEN=y" >> $config_target_mak
41451b0c87fcSJuan Quintelaesac
4146c59249f9SJuan Quintelacase "$target_arch2" in
414768b05c42SPeter Maydell  arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
4148c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
4149c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
4150c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
4151c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
41525f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
4153adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
4154adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
4155c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
4156c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
415725be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
41581ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
4159d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
4160d5970055SMichael S. Tsirkin      fi
4161c59249f9SJuan Quintela    fi
4162c59249f9SJuan Quintelaesac
4163fae001f5SWen Congyangcase "$target_arch2" in
4164fae001f5SWen Congyang  i386|x86_64)
4165fae001f5SWen Congyang    echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak
4166fae001f5SWen Congyangesac
4167de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
416825be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
416997a847bcSbellardfi
417097a847bcSbellardif test "$target_softmmu" = "yes" ; then
417125be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
4172de3a354aSMichael Walle  echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
41739fecbed0SWen Congyang  case "$target_arch2" in
41749fecbed0SWen Congyang    i386|x86_64)
41759fecbed0SWen Congyang      echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak
41769fecbed0SWen Congyang  esac
4177de83cd02Sbellardfi
4178997344f3Sbellardif test "$target_user_only" = "yes" ; then
417925be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
4180a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
4181997344f3Sbellardfi
4182831b7825Sthsif test "$target_linux_user" = "yes" ; then
418325be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
4184831b7825Sthsfi
418556aebc89Spbrooklist=""
418656aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
418756aebc89Spbrook  for x in $gdb_xml_files; do
418856aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
418956aebc89Spbrook  done
419025be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
41913d0f1517SJuan Quintelafi
4192de83cd02Sbellard
4193e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
419425be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
4195e5fe0c52Spbrookfi
4196bd0c5661Spbrookif test "$target_user_only" = "yes" \
4197bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
419825be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
4199bd0c5661Spbrookfi
4200379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
420125be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
4202379f6698SPaul Brookfi
420384778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
420425be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
420584778508Sblueswir1fi
42065b0753e0Sbellard
42075a4d701aSJan Kiszka# the static way of configuring available audio cards requires this workaround
42085a4d701aSJan Kiszkaif test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then
42095a4d701aSJan Kiszka  echo "CONFIG_PCSPK=y" >> $config_target_mak
42105a4d701aSJan Kiszkafi
42115a4d701aSJan Kiszka
42124afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
4213fa282484SJuan Quintela
42144afddb55SJuan Quintelacflags=""
4215f9728943SPaolo Bonziniincludes=""
4216fa282484SJuan Quintelaldflags=""
42179b8e111fSJuan Quintela
42189195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then
42199195b2c2SStefan Weil  includes="-I\$(SRC_PATH)/tcg/tci $includes"
42209195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then
4221f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
422224e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
4223f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
42245d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
4225f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
422657ddfbf7SJuan Quintelaelse
4227f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
422857ddfbf7SJuan Quintelafi
4229f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
423057ddfbf7SJuan Quintela
423164656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
423264656024SJuan Quintela  case "$i" in
423364656024SJuan Quintela  alpha)
423425be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
423576cad711SPaolo Bonzini    echo "CONFIG_ALPHA_DIS=y"  >> config-all-disas.mak
423664656024SJuan Quintela  ;;
423764656024SJuan Quintela  arm)
423825be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
423976cad711SPaolo Bonzini    echo "CONFIG_ARM_DIS=y"  >> config-all-disas.mak
424064656024SJuan Quintela  ;;
424164656024SJuan Quintela  cris)
424225be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
424376cad711SPaolo Bonzini    echo "CONFIG_CRIS_DIS=y"  >> config-all-disas.mak
424464656024SJuan Quintela  ;;
424564656024SJuan Quintela  hppa)
424625be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
424776cad711SPaolo Bonzini    echo "CONFIG_HPPA_DIS=y"  >> config-all-disas.mak
424864656024SJuan Quintela  ;;
424964656024SJuan Quintela  i386|x86_64)
425025be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
425176cad711SPaolo Bonzini    echo "CONFIG_I386_DIS=y"  >> config-all-disas.mak
425264656024SJuan Quintela  ;;
4253903ec55cSAurelien Jarno  ia64*)
4254903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
425576cad711SPaolo Bonzini    echo "CONFIG_IA64_DIS=y"  >> config-all-disas.mak
4256903ec55cSAurelien Jarno  ;;
425779368f49SMichael Walle  lm32)
425879368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
425976cad711SPaolo Bonzini    echo "CONFIG_LM32_DIS=y"  >> config-all-disas.mak
426079368f49SMichael Walle  ;;
426164656024SJuan Quintela  m68k)
426225be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
426376cad711SPaolo Bonzini    echo "CONFIG_M68K_DIS=y"  >> config-all-disas.mak
426464656024SJuan Quintela  ;;
4265877fdc12SEdgar E. Iglesias  microblaze*)
426625be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
426776cad711SPaolo Bonzini    echo "CONFIG_MICROBLAZE_DIS=y"  >> config-all-disas.mak
426864656024SJuan Quintela  ;;
426964656024SJuan Quintela  mips*)
427025be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
427176cad711SPaolo Bonzini    echo "CONFIG_MIPS_DIS=y"  >> config-all-disas.mak
427264656024SJuan Quintela  ;;
4273d15a9c23SAnthony Green  moxie*)
4274d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> $config_target_mak
4275d15a9c23SAnthony Green    echo "CONFIG_MOXIE_DIS=y"  >> config-all-disas.mak
4276d15a9c23SAnthony Green  ;;
4277e67db06eSJia Liu  or32)
4278e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
427976cad711SPaolo Bonzini    echo "CONFIG_OPENRISC_DIS=y"  >> config-all-disas.mak
4280e67db06eSJia Liu  ;;
428164656024SJuan Quintela  ppc*)
428225be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
428376cad711SPaolo Bonzini    echo "CONFIG_PPC_DIS=y"  >> config-all-disas.mak
428464656024SJuan Quintela  ;;
428524e804ecSAlexander Graf  s390*)
428625be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
428776cad711SPaolo Bonzini    echo "CONFIG_S390_DIS=y"  >> config-all-disas.mak
428864656024SJuan Quintela  ;;
428964656024SJuan Quintela  sh4)
429025be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
429176cad711SPaolo Bonzini    echo "CONFIG_SH4_DIS=y"  >> config-all-disas.mak
429264656024SJuan Quintela  ;;
429364656024SJuan Quintela  sparc*)
429425be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
429576cad711SPaolo Bonzini    echo "CONFIG_SPARC_DIS=y"  >> config-all-disas.mak
429664656024SJuan Quintela  ;;
4297cfa550c6SMax Filippov  xtensa*)
4298cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
429976cad711SPaolo Bonzini    echo "CONFIG_XTENSA_DIS=y"  >> config-all-disas.mak
4300cfa550c6SMax Filippov  ;;
430164656024SJuan Quintela  esac
430264656024SJuan Quinteladone
43039195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
43049195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
430576cad711SPaolo Bonzini  echo "CONFIG_TCI_DIS=y"  >> config-all-disas.mak
43069195b2c2SStefan Weilfi
430764656024SJuan Quintela
43086ee7126fSJuan Quintelacase "$ARCH" in
43096ee7126fSJuan Quintelaalpha)
43106ee7126fSJuan Quintela  # Ensure there's only a single GP
43116ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
43126ee7126fSJuan Quintela;;
43136ee7126fSJuan Quintelaesac
43146ee7126fSJuan Quintela
431555d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
431655d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
431755d9c04bSJuan Quintela  arm)
431855d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
431955d9c04bSJuan Quintela  ;;
432025a8bb96SMichael Walle  lm32)
432125a8bb96SMichael Walle    cflags="-DHAS_AUDIO $cflags"
432225a8bb96SMichael Walle  ;;
432355d9c04bSJuan Quintela  i386|mips|ppc)
432455d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
432555d9c04bSJuan Quintela  ;;
432655d9c04bSJuan Quintela  esac
432755d9c04bSJuan Quintelafi
432855d9c04bSJuan Quintela
4329d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
433025be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
4331d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
4332d02c1db3SJuan Quintela    cflags="-p $cflags"
4333d02c1db3SJuan Quintela    ldflags="-p $ldflags"
4334d02c1db3SJuan Quintela  fi
4335d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
4336d02c1db3SJuan Quintela    ldflags="-p $ldflags"
433725be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
4338d02c1db3SJuan Quintela  fi
4339d02c1db3SJuan Quintelafi
4340d02c1db3SJuan Quintela
4341ab214c29SStefan Bergerif test "$tpm" = "yes"; then
4342ab214c29SStefan Berger  if test "$target_softmmu" = "yes" ; then
4343ab214c29SStefan Berger    echo "CONFIG_TPM=y" >> $config_host_mak
4344ab214c29SStefan Berger  fi
4345ab214c29SStefan Bergerfi
4346ab214c29SStefan Berger
43479195b2c2SStefan Weilif test "$ARCH" = "tci"; then
43489195b2c2SStefan Weil  linker_script=""
43499195b2c2SStefan Weilelse
4350c1c93672SPaolo Bonzini  linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/ldscripts/\$(ARCH).ld"
43519195b2c2SStefan Weilfi
43529195b2c2SStefan Weil
43539b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4354fa282484SJuan Quintela  case "$ARCH" in
43554d58be06SRichard Henderson  alpha | s390x)
43564d58be06SRichard Henderson    # The default placement of the application is fine.
43574d58be06SRichard Henderson    ;;
4358fd76e73aSRichard Henderson  *)
4359322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
4360fa282484SJuan Quintela    ;;
4361fa282484SJuan Quintela  esac
4362fa282484SJuan Quintelafi
4363fa282484SJuan Quintela
436425be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
436525be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4366f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
4367fa282484SJuan Quintela
436897a847bcSbellarddone # for target in $targets
43697d13299dSbellard
4370b776eca1SGerd Hoffmannif [ "$pixman" = "internal" ]; then
4371b776eca1SGerd Hoffmann  echo "config-host.h: subdir-pixman" >> $config_host_mak
4372b776eca1SGerd Hoffmannfi
4373b776eca1SGerd Hoffmann
4374d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
4375927b241dSMichael WalleDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
43762dee8d54SPaolo BonziniDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
43772d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
43782dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
4379c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4380c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
4381834574eaSAnthony LiguoriFILES="$FILES tests/tcg/lm32/Makefile po/Makefile"
4382ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4383446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
43842d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
43854652b792SJan KiszkaFILES="$FILES pc-bios/qemu-icon.bmp"
4386753d11f2SRichard Hendersonfor bios_file in \
4387753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
43885acc2ec0SGerd Hoffmann    $source_path/pc-bios/*.aml \
4389753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
4390753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
4391753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
4392753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
4393753d11f2SRichard Hendersondo
43947ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
43957ea78b74SJan Kiszkadone
4396d1807a4fSPaolo Bonzinimkdir -p $DIRS
43977d13299dSbellardfor f in $FILES ; do
439872b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4399f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
4400f9245e10SPeter Maydell    fi
44017d13299dSbellarddone
44021ad2134fSPaul Brook
4403c34ebfdcSAnthony Liguori# temporary config to build submodules
44042d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
4405c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
440637116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4407c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
44083dd46c78SBlue Swirl    echo "AS=$as" >> $config_mak
4409c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4410c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
44113dd46c78SBlue Swirl    echo "CPP=$cpp" >> $config_mak
4412c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4413c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
4414c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4415c34ebfdcSAnthony Liguoridone
4416c34ebfdcSAnthony Liguori
4417b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4418b40292e7SJan Kiszka  mkdir -p QMP
4419b40292e7SJan Kiszkafi
4420