xref: /openbmc/qemu/configure (revision 650ab98d)
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
3052166aa0SJuan Quintelacompile_object() {
31da1d85e3SGerd Hoffmann  echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
32da1d85e3SGerd Hoffmann  $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
3352166aa0SJuan Quintela}
3452166aa0SJuan Quintela
3552166aa0SJuan Quintelacompile_prog() {
3652166aa0SJuan Quintela  local_cflags="$1"
3752166aa0SJuan Quintela  local_ldflags="$2"
38da1d85e3SGerd Hoffmann  echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
39da1d85e3SGerd Hoffmann  $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
4052166aa0SJuan Quintela}
4152166aa0SJuan Quintela
4211568d6dSPaolo Bonzini# symbolically link $1 to $2.  Portable version of "ln -sf".
4311568d6dSPaolo Bonzinisymlink() {
4411568d6dSPaolo Bonzini  rm -f $2
4511568d6dSPaolo Bonzini  ln -s $1 $2
4611568d6dSPaolo Bonzini}
4711568d6dSPaolo Bonzini
480dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
490dba6195SLoïc Minier# executable or a builtin)
500dba6195SLoïc Minierhas() {
510dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
520dba6195SLoïc Minier}
530dba6195SLoïc Minier
540dba6195SLoïc Minier# search for an executable in PATH
550dba6195SLoïc Minierpath_of() {
560dba6195SLoïc Minier    local_command="$1"
570dba6195SLoïc Minier    local_ifs="$IFS"
580dba6195SLoïc Minier    local_dir=""
590dba6195SLoïc Minier
600dba6195SLoïc Minier    # pathname has a dir component?
610dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
620dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
630dba6195SLoïc Minier            echo "$local_command"
640dba6195SLoïc Minier            return 0
650dba6195SLoïc Minier        fi
660dba6195SLoïc Minier    fi
670dba6195SLoïc Minier    if [ -z "$local_command" ]; then
680dba6195SLoïc Minier        return 1
690dba6195SLoïc Minier    fi
700dba6195SLoïc Minier
710dba6195SLoïc Minier    IFS=:
720dba6195SLoïc Minier    for local_dir in $PATH; do
730dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
740dba6195SLoïc Minier            echo "$local_dir/$local_command"
750dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
760dba6195SLoïc Minier            return 0
770dba6195SLoïc Minier        fi
780dba6195SLoïc Minier    done
790dba6195SLoïc Minier    # not found
800dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
810dba6195SLoïc Minier    return 1
820dba6195SLoïc Minier}
830dba6195SLoïc Minier
847d13299dSbellard# default parameters
85ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"`
862ff6b91eSJuan Quintelacpu=""
871e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
8843ce4dfeSbellardstatic="no"
89ed968ff1SJuan Quintelasparc_cpu=""
907d13299dSbellardcross_prefix=""
910c58ac1cSmalcaudio_drv_list=""
92d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda"
93d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
94eb852011SMarkus Armbrusterblock_drv_whitelist=""
957d13299dSbellardhost_cc="gcc"
96c81da56eSJuan Quintelahelper_cflags=""
9773da375eSJuan Quintelalibs_softmmu=""
983e2e0e6bSJuan Quintelalibs_tools=""
9967f86e8eSJuan Quintelaaudio_pt_int=""
100d5631638Smalcaudio_win_int=""
1012b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc
102957f1f99SMichael Rothlibs_qga=""
1035bc62e01SGerd Hoffmanndebug_info="yes"
104ac0df51dSaliguori
105377529c0SPaolo Bonzinitarget_list=""
106377529c0SPaolo Bonzini
107377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
108377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
109377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
110377529c0SPaolo Bonzini#              unless --disable-foo is given
111377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
112377529c0SPaolo Bonzini#              feature will searched for,
113377529c0SPaolo Bonzini#              if not found, configure exits with error
114377529c0SPaolo Bonzini#
115377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
116377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
117377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
118377529c0SPaolo Bonzini
119377529c0SPaolo Bonzinibluez=""
120377529c0SPaolo Bonzinibrlapi=""
121377529c0SPaolo Bonzinicurl=""
122377529c0SPaolo Bonzinicurses=""
123377529c0SPaolo Bonzinidocs=""
124377529c0SPaolo Bonzinifdt=""
125377529c0SPaolo Bonzininptl=""
126377529c0SPaolo Bonzinisdl=""
127983eef5aSMeador Ingevirtfs=""
128821601eaSJes Sorensenvnc="yes"
129377529c0SPaolo Bonzinisparse="no"
130377529c0SPaolo Bonziniuuid=""
131377529c0SPaolo Bonzinivde=""
132377529c0SPaolo Bonzinivnc_tls=""
133377529c0SPaolo Bonzinivnc_sasl=""
134377529c0SPaolo Bonzinivnc_jpeg=""
135377529c0SPaolo Bonzinivnc_png=""
136377529c0SPaolo Bonzinivnc_thread="no"
137377529c0SPaolo Bonzinixen=""
138d5b93ddfSAnthony PERARDxen_ctrl_version=""
139377529c0SPaolo Bonzinilinux_aio=""
14047e98658SCorey Bryantcap_ng=""
141377529c0SPaolo Bonziniattr=""
1424f26f2b6SAvi Kivitylibattr=""
143377529c0SPaolo Bonzinixfs=""
144377529c0SPaolo Bonzini
145d41a75a2SBradvhost_net="no"
146d41a75a2SBradkvm="no"
147377529c0SPaolo Bonzinigprof="no"
148377529c0SPaolo Bonzinidebug_tcg="no"
149377529c0SPaolo Bonzinidebug_mon="no"
150377529c0SPaolo Bonzinidebug="no"
151377529c0SPaolo Bonzinistrip_opt="yes"
1529195b2c2SStefan Weiltcg_interpreter="no"
153377529c0SPaolo Bonzinibigendian="no"
154377529c0SPaolo Bonzinimingw32="no"
155377529c0SPaolo BonziniEXESUF=""
156377529c0SPaolo Bonziniprefix="/usr/local"
157377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
158377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu"
159377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu"
160377529c0SPaolo Bonzinibindir="\${prefix}/bin"
1613aa5d2beSAlon Levylibdir="\${prefix}/lib"
1620f94d6daSAlon Levyincludedir="\${prefix}/include"
163377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
164377529c0SPaolo Bonziniconfsuffix="/qemu"
165377529c0SPaolo Bonzinislirp="yes"
166377529c0SPaolo Bonzinifmod_lib=""
167377529c0SPaolo Bonzinifmod_inc=""
168377529c0SPaolo Bonzinioss_lib=""
169377529c0SPaolo Bonzinibsd="no"
170377529c0SPaolo Bonzinilinux="no"
171377529c0SPaolo Bonzinisolaris="no"
172377529c0SPaolo Bonziniprofiler="no"
173377529c0SPaolo Bonzinicocoa="no"
174377529c0SPaolo Bonzinisoftmmu="yes"
175377529c0SPaolo Bonzinilinux_user="no"
176377529c0SPaolo Bonzinidarwin_user="no"
177377529c0SPaolo Bonzinibsd_user="no"
178377529c0SPaolo Bonziniguest_base=""
179377529c0SPaolo Bonziniuname_release=""
180377529c0SPaolo Bonzinimixemu="no"
181377529c0SPaolo Bonziniaix="no"
182377529c0SPaolo Bonziniblobs="yes"
183377529c0SPaolo Bonzinipkgversion=""
18440d6444eSAvi Kivitypie=""
185377529c0SPaolo Bonzinizero_malloc=""
186377529c0SPaolo Bonzinitrace_backend="nop"
187377529c0SPaolo Bonzinitrace_file="trace"
188377529c0SPaolo Bonzinispice=""
189377529c0SPaolo Bonzinirbd=""
19036707144SAlon Levysmartcard=""
191111a38b0SRobert Relyeasmartcard_nss=""
19269354a83SHans de Goedeusb_redir=""
193430a3c18SMichael Walleopengl=""
1941ece9905SAlon Levyzlib="yes"
195d138cee9SMichael Rothguest_agent="yes"
196c589b249SRonnie Sahlberglibiscsi=""
197519175a2SAlex Barcelocoroutine=""
198377529c0SPaolo Bonzini
199ac0df51dSaliguori# parse CC options first
200ac0df51dSaliguorifor opt do
201ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
202ac0df51dSaliguori  case "$opt" in
203ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
204ac0df51dSaliguori  ;;
2053d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
206ac0df51dSaliguori  ;;
207ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
208ca4deeb1SPaolo Bonzini  ;;
2092ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2102ff6b91eSJuan Quintela  ;;
211a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
212e2a2ed06SJuan Quintela  ;;
213e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
214e2a2ed06SJuan Quintela  ;;
2155bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2165bc62e01SGerd Hoffmann  ;;
2175bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2185bc62e01SGerd Hoffmann  ;;
21950e7b1a0SJuan Quintela  --sparc_cpu=*)
22050e7b1a0SJuan Quintela    sparc_cpu="$optarg"
22150e7b1a0SJuan Quintela    case $sparc_cpu in
222ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
22350e7b1a0SJuan Quintela      cpu="sparc"
22450e7b1a0SJuan Quintela    ;;
22550e7b1a0SJuan Quintela    v9)
22650e7b1a0SJuan Quintela      cpu="sparc64"
22750e7b1a0SJuan Quintela    ;;
22850e7b1a0SJuan Quintela    *)
22950e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
23050e7b1a0SJuan Quintela      exit 1
23150e7b1a0SJuan Quintela    ;;
23250e7b1a0SJuan Quintela    esac
23350e7b1a0SJuan Quintela  ;;
234ac0df51dSaliguori  esac
235ac0df51dSaliguoridone
236ac0df51dSaliguori# OS specific
237ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
23893148aa5SStefan Weil# we can eliminate its usage altogether.
239ac0df51dSaliguori
240b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}"
241b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
242b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
243b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
2443f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
245b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
246b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
24717884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
24817884d7bSSergei Trofimovichquery_pkg_config() {
24917884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
25017884d7bSSergei Trofimovich}
25117884d7bSSergei Trofimovichpkg_config=query_pkg_config
252b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
253ac0df51dSaliguori
254be17dc90SMichael S. Tsirkin# default flags for all hosts
255be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
256f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
257be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
258be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
25984958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
260cbbab922SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
2615bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
2625bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
263be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
2645bc62e01SGerd Hoffmannfi
265be17dc90SMichael S. Tsirkin
266ca4deeb1SPaolo Bonzini# make source path absolute
267ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
268ca4deeb1SPaolo Bonzini
269ac0df51dSaliguoricheck_define() {
270ac0df51dSaliguoricat > $TMPC <<EOF
271ac0df51dSaliguori#if !defined($1)
272fd786e1aSPeter Maydell#error $1 not defined
273ac0df51dSaliguori#endif
274ac0df51dSaliguoriint main(void) { return 0; }
275ac0df51dSaliguoriEOF
27652166aa0SJuan Quintela  compile_object
277ac0df51dSaliguori}
278ac0df51dSaliguori
2792ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
2802ff6b91eSJuan Quintela  # command line argument
2812ff6b91eSJuan Quintela  :
2822ff6b91eSJuan Quintelaelif check_define __i386__ ; then
283ac0df51dSaliguori  cpu="i386"
284ac0df51dSaliguorielif check_define __x86_64__ ; then
285ac0df51dSaliguori  cpu="x86_64"
2863aa9bd6cSblueswir1elif check_define __sparc__ ; then
2873aa9bd6cSblueswir1  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
2883aa9bd6cSblueswir1  # They must be specified using --sparc_cpu
2893aa9bd6cSblueswir1  if check_define __arch64__ ; then
2903aa9bd6cSblueswir1    cpu="sparc64"
2913aa9bd6cSblueswir1  else
2923aa9bd6cSblueswir1    cpu="sparc"
2933aa9bd6cSblueswir1  fi
294fdf7ed96Smalcelif check_define _ARCH_PPC ; then
295fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
296fdf7ed96Smalc    cpu="ppc64"
297ac0df51dSaliguori  else
298fdf7ed96Smalc    cpu="ppc"
299fdf7ed96Smalc  fi
300afa05235SAurelien Jarnoelif check_define __mips__ ; then
301afa05235SAurelien Jarno  cpu="mips"
302477ba620SAurelien Jarnoelif check_define __ia64__ ; then
303477ba620SAurelien Jarno  cpu="ia64"
304d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
305d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
306d66ed0eaSAurelien Jarno    cpu="s390x"
307d66ed0eaSAurelien Jarno  else
308d66ed0eaSAurelien Jarno    cpu="s390"
309d66ed0eaSAurelien Jarno  fi
31021d89f84SPeter Maydellelif check_define __arm__ ; then
31121d89f84SPeter Maydell  cpu="arm"
312f28ffed5SBradelif check_define __hppa__ ; then
313f28ffed5SBrad  cpu="hppa"
314fdf7ed96Smalcelse
315fdf7ed96Smalc  cpu=`uname -m`
316ac0df51dSaliguorifi
317ac0df51dSaliguori
318359bc95dSPeter MaydellARCH=
319359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
320359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
3217d13299dSbellardcase "$cpu" in
322359bc95dSPeter Maydell  ia64|ppc|ppc64|s390|s390x|sparc64)
323ea8f20f8SJuan Quintela    cpu="$cpu"
324ea8f20f8SJuan Quintela  ;;
3257d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
32697a847bcSbellard    cpu="i386"
3277d13299dSbellard  ;;
328aaa5fa14Saurel32  x86_64|amd64)
329aaa5fa14Saurel32    cpu="x86_64"
330aaa5fa14Saurel32  ;;
33121d89f84SPeter Maydell  armv*b|armv*l|arm)
33221d89f84SPeter Maydell    cpu="arm"
3337d13299dSbellard  ;;
334f28ffed5SBrad  hppa|parisc|parisc64)
335f54b3f92Saurel32    cpu="hppa"
336f54b3f92Saurel32  ;;
337afa05235SAurelien Jarno  mips*)
338afa05235SAurelien Jarno    cpu="mips"
339afa05235SAurelien Jarno  ;;
3403142255cSblueswir1  sparc|sun4[cdmuv])
341ae228531Sbellard    cpu="sparc"
342ae228531Sbellard  ;;
3437d13299dSbellard  *)
344359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
345359bc95dSPeter Maydell    ARCH=unknown
3467d13299dSbellard  ;;
3477d13299dSbellardesac
348359bc95dSPeter Maydellif test -z "$ARCH"; then
349359bc95dSPeter Maydell  ARCH="$cpu"
350359bc95dSPeter Maydellfi
351e2d52ad3SJuan Quintela
3527d13299dSbellard# OS specific
353ac0df51dSaliguoriif check_define __linux__ ; then
354ac0df51dSaliguori  targetos="Linux"
355ac0df51dSaliguorielif check_define _WIN32 ; then
356ac0df51dSaliguori  targetos='MINGW32'
357169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
358169dc5d3Sblueswir1  targetos='OpenBSD'
359169dc5d3Sblueswir1elif check_define __sun__ ; then
360169dc5d3Sblueswir1  targetos='SunOS'
361179cf400SAndreas Färberelif check_define __HAIKU__ ; then
362179cf400SAndreas Färber  targetos='Haiku'
363ac0df51dSaliguorielse
3647d13299dSbellard  targetos=`uname -s`
365ac0df51dSaliguorifi
3660dbfc675SJuan Quintela
3677d13299dSbellardcase $targetos in
368c326e0afSbellardCYGWIN*)
369c326e0afSbellard  mingw32="yes"
370a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
371d5631638Smalc  audio_possible_drivers="winwave sdl"
372d5631638Smalc  audio_drv_list="winwave"
373c326e0afSbellard;;
37467b915a5SbellardMINGW32*)
37567b915a5Sbellard  mingw32="yes"
376d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
377d5631638Smalc  audio_drv_list="winwave"
37867b915a5Sbellard;;
3795c40d2bdSthsGNU/kFreeBSD)
380a167ba50SAurelien Jarno  bsd="yes"
3810c58ac1cSmalc  audio_drv_list="oss"
382f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3835c40d2bdSths;;
3847d3505c5SbellardFreeBSD)
3857d3505c5Sbellard  bsd="yes"
3860db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3870c58ac1cSmalc  audio_drv_list="oss"
388f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
389f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
390f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3917d3505c5Sbellard;;
392c5e97233Sblueswir1DragonFly)
393c5e97233Sblueswir1  bsd="yes"
3940db4a067SPaolo Bonzini  make="${MAKE-gmake}"
395c5e97233Sblueswir1  audio_drv_list="oss"
396c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
397c5e97233Sblueswir1;;
3987d3505c5SbellardNetBSD)
3997d3505c5Sbellard  bsd="yes"
4000db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4010c58ac1cSmalc  audio_drv_list="oss"
402c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4038ef92a88Sblueswir1  oss_lib="-lossaudio"
4047d3505c5Sbellard;;
4057d3505c5SbellardOpenBSD)
4067d3505c5Sbellard  bsd="yes"
4070db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4080c58ac1cSmalc  audio_drv_list="oss"
409c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4102f6a1ab0Sblueswir1  oss_lib="-lossaudio"
4117d3505c5Sbellard;;
41283fb7adfSbellardDarwin)
41383fb7adfSbellard  bsd="yes"
41483fb7adfSbellard  darwin="yes"
4150dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
4160dbfc675SJuan Quintela  # run 64-bit userspace code
417aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
4181b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
419aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
4201b0f9cc2Saliguori  fi
4211b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
422a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
4230c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
4241b0f9cc2Saliguori  else
425a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
4261b0f9cc2Saliguori  fi
427831b7825Sths  darwin_user="yes"
428fd677642Sths  cocoa="yes"
4290c58ac1cSmalc  audio_drv_list="coreaudio"
430c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4310c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4327973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
43383fb7adfSbellard;;
434ec530c81SbellardSunOS)
435ec530c81Sbellard  solaris="yes"
4360db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4370db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
438fa58948dSBlue Swirl  ld="gld"
439e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
4400475a5caSths  needs_libsunmath="no"
441c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
442ef18c883Sths  # have to select again, because `uname -m` returns i86pc
443ef18c883Sths  # even on an x86_64 box.
444ef18c883Sths  solariscpu=`isainfo -k`
445ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
446ef18c883Sths    cpu="x86_64"
447ef18c883Sths  fi
448c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4490475a5caSths    if test "$solarisrev" -le 9 ; then
4500475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4510475a5caSths        needs_libsunmath="yes"
452f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
453f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
454f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4550475a5caSths      else
4560475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4570475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4580475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4590475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4600475a5caSths        exit 1
4610475a5caSths      fi
4620475a5caSths    fi
46386b2bd93Sths  fi
4646b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4650c58ac1cSmalc    audio_drv_list="oss"
4666b4d2ba1Sths  fi
467c2de5c91Smalc  audio_possible_drivers="oss sdl"
468d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
469d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
470d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
471d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
472a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
473e174c0bbSJuan Quintela  LIBS="-lsocket -lnsl -lresolv $LIBS"
474ec530c81Sbellard;;
475b29fe3edSmalcAIX)
476b29fe3edSmalc  aix="yes"
4770db4a067SPaolo Bonzini  make="${MAKE-gmake}"
478b29fe3edSmalc;;
479179cf400SAndreas FärberHaiku)
480179cf400SAndreas Färber  haiku="yes"
481179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
482179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
483179cf400SAndreas Färber;;
484fb065187Sbellard*)
4850c58ac1cSmalc  audio_drv_list="oss"
486b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4875327cf48Sbellard  linux="yes"
488831b7825Sths  linux_user="yes"
48968063649Sblueswir1  usb="linux"
490af2be207SJan Kiszka  kvm="yes"
491af2be207SJan Kiszka  vhost_net="yes"
49207f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
493c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
494c9ec1fe4Sbellard  fi
495fb065187Sbellard;;
4967d13299dSbellardesac
4977d13299dSbellard
4987d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
499b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
50068063649Sblueswir1    usb="bsd"
50183fb7adfSbellard  fi
50284778508Sblueswir1  bsd_user="yes"
5037d3505c5Sbellardfi
5047d3505c5Sbellard
5050db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5060db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
507c886edfbSBlue Swirl: ${python=${PYTHON-python}}
508e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5090db4a067SPaolo Bonzini
5103457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
5113457a3f8SJuan Quintela  EXESUF=".exe"
512a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
513e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
514e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
515f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
516f7cf5d5bSStefan Weilcat > $TMPC << EOF
517f7cf5d5bSStefan Weilint main(void) { return 0; }
518f7cf5d5bSStefan WeilEOF
519f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
520f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
521f7cf5d5bSStefan Weil  fi
522c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
523683035deSPaolo Bonzini  mandir="\${prefix}"
524683035deSPaolo Bonzini  datadir="\${prefix}"
525683035deSPaolo Bonzini  docdir="\${prefix}"
526683035deSPaolo Bonzini  bindir="\${prefix}"
527683035deSPaolo Bonzini  sysconfdir="\${prefix}"
528683035deSPaolo Bonzini  confsuffix=""
529368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
5303457a3f8SJuan Quintelafi
5313457a3f8SJuan Quintela
532487fefdbSAnthony Liguoriwerror=""
53385aa5189Sbellard
5347d13299dSbellardfor opt do
535a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
5367d13299dSbellard  case "$opt" in
5372efc3265Sbellard  --help|-h) show_help=yes
5382efc3265Sbellard  ;;
53999123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
54099123e13SMike Frysinger  ;;
541b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5427d13299dSbellard  ;;
543b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
54432ce6337Sbellard  ;;
545ca4deeb1SPaolo Bonzini  --source-path=*)
5467d13299dSbellard  ;;
547ac0df51dSaliguori  --cross-prefix=*)
5487d13299dSbellard  ;;
549ac0df51dSaliguori  --cc=*)
5507d13299dSbellard  ;;
551b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
55283469015Sbellard  ;;
553b1a550a0Spbrook  --make=*) make="$optarg"
5547d13299dSbellard  ;;
5556a882643Spbrook  --install=*) install="$optarg"
5566a882643Spbrook  ;;
557c886edfbSBlue Swirl  --python=*) python="$optarg"
558c886edfbSBlue Swirl  ;;
559e2d8830eSBrad  --smbd=*) smbd="$optarg"
560e2d8830eSBrad  ;;
561e2a2ed06SJuan Quintela  --extra-cflags=*)
5627d13299dSbellard  ;;
563e2a2ed06SJuan Quintela  --extra-ldflags=*)
5647d13299dSbellard  ;;
5655bc62e01SGerd Hoffmann  --enable-debug-info)
5665bc62e01SGerd Hoffmann  ;;
5675bc62e01SGerd Hoffmann  --disable-debug-info)
5685bc62e01SGerd Hoffmann  ;;
5692ff6b91eSJuan Quintela  --cpu=*)
5707d13299dSbellard  ;;
571b1a550a0Spbrook  --target-list=*) target_list="$optarg"
572de83cd02Sbellard  ;;
57374242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
57494a420b1SStefan Hajnoczi  ;;
57574242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
5769410b56cSPrerna Saxena  ;;
5777d13299dSbellard  --enable-gprof) gprof="yes"
5787d13299dSbellard  ;;
57979427693SLoïc Minier  --static)
58079427693SLoïc Minier    static="yes"
58179427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
58217884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
58343ce4dfeSbellard  ;;
5840b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5850b24e75fSPaolo Bonzini  ;;
5860b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5870b24e75fSPaolo Bonzini  ;;
5883aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
5893aa5d2beSAlon Levy  ;;
5900f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
5910f94d6daSAlon Levy  ;;
5920b24e75fSPaolo Bonzini  --datadir=*) datadir="$optarg"
5930b24e75fSPaolo Bonzini  ;;
5940b24e75fSPaolo Bonzini  --docdir=*) docdir="$optarg"
5950b24e75fSPaolo Bonzini  ;;
596ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
59707381cc1SAnthony Liguori  ;;
598023ddd74SMax Filippov  --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
599023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
600023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
601023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
602023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
603023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
604023ddd74SMax Filippov    # lots of directory switches by default.
605023ddd74SMax Filippov  ;;
60697a847bcSbellard  --disable-sdl) sdl="no"
60797a847bcSbellard  ;;
608c4198157SJuan Quintela  --enable-sdl) sdl="yes"
609c4198157SJuan Quintela  ;;
610983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
611983eef5aSMeador Inge  ;;
612983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
613983eef5aSMeador Inge  ;;
614821601eaSJes Sorensen  --disable-vnc) vnc="no"
615821601eaSJes Sorensen  ;;
616821601eaSJes Sorensen  --enable-vnc) vnc="yes"
617821601eaSJes Sorensen  ;;
618b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
619102a52e4Sbellard  ;;
620c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
621c2de5c91Smalc  ;;
6222f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
6232f6a1ab0Sblueswir1  ;;
6242fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
6250c58ac1cSmalc  ;;
6260c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
6270c58ac1cSmalc  ;;
628eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
629eb852011SMarkus Armbruster  ;;
630f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
631f8393946Saurel32  ;;
632f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
633f8393946Saurel32  ;;
634b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
635b4475aa2SLuiz Capitulino  ;;
636b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
637b4475aa2SLuiz Capitulino  ;;
638f3d08ee6SPaul Brook  --enable-debug)
639f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
640f3d08ee6SPaul Brook      debug_tcg="yes"
641b4475aa2SLuiz Capitulino      debug_mon="yes"
642f3d08ee6SPaul Brook      debug="yes"
643f3d08ee6SPaul Brook      strip_opt="no"
644f3d08ee6SPaul Brook  ;;
64503b4fe7dSaliguori  --enable-sparse) sparse="yes"
64603b4fe7dSaliguori  ;;
64703b4fe7dSaliguori  --disable-sparse) sparse="no"
64803b4fe7dSaliguori  ;;
6491625af87Saliguori  --disable-strip) strip_opt="no"
6501625af87Saliguori  ;;
6518d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
6528d5d2d4cSths  ;;
6531be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
6541be10ad2SJuan Quintela  ;;
6552f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
6562f9606b3Saliguori  ;;
657ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
658ea784e3bSJuan Quintela  ;;
6592f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
6602f6f5c7aSCorentin Chary  ;;
6612f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
6622f6f5c7aSCorentin Chary  ;;
663efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
664efe556adSCorentin Chary  ;;
665efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
666efe556adSCorentin Chary  ;;
667bd023f95SCorentin Chary  --disable-vnc-thread) vnc_thread="no"
668bd023f95SCorentin Chary  ;;
669bd023f95SCorentin Chary  --enable-vnc-thread) vnc_thread="yes"
670bd023f95SCorentin Chary  ;;
671443f1376Sbellard  --disable-slirp) slirp="no"
672c20709aaSbellard  ;;
673ee682d27SStefan Weil  --disable-uuid) uuid="no"
674ee682d27SStefan Weil  ;;
675ee682d27SStefan Weil  --enable-uuid) uuid="yes"
676ee682d27SStefan Weil  ;;
677e0e6c8c0Saliguori  --disable-vde) vde="no"
6788a16d273Sths  ;;
679dfb278bdSJuan Quintela  --enable-vde) vde="yes"
680dfb278bdSJuan Quintela  ;;
681e37630caSaliguori  --disable-xen) xen="no"
682e37630caSaliguori  ;;
683fc321b4bSJuan Quintela  --enable-xen) xen="yes"
684fc321b4bSJuan Quintela  ;;
6852e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6862e4d9fb1Saurel32  ;;
6874ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6884ffcedb6SJuan Quintela  ;;
689fb599c9aSbalrog  --disable-bluez) bluez="no"
690fb599c9aSbalrog  ;;
691a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
692a20a6f46SJuan Quintela  ;;
6937ba1e619Saliguori  --disable-kvm) kvm="no"
6947ba1e619Saliguori  ;;
695b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
696b31a0277SJuan Quintela  ;;
6979195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
6989195b2c2SStefan Weil  ;;
6999195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
7009195b2c2SStefan Weil  ;;
70147e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
70247e98658SCorey Bryant  ;;
70347e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
70447e98658SCorey Bryant  ;;
705cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
706cd4ec0b4SGerd Hoffmann  ;;
707cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
708cd4ec0b4SGerd Hoffmann  ;;
709c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
710c589b249SRonnie Sahlberg  ;;
711c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
712c589b249SRonnie Sahlberg  ;;
71305c2a3e7Sbellard  --enable-profiler) profiler="yes"
71405c2a3e7Sbellard  ;;
715c2de5c91Smalc  --enable-cocoa)
716c2de5c91Smalc      cocoa="yes" ;
717c2de5c91Smalc      sdl="no" ;
718c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
7195b0753e0Sbellard  ;;
720cad25d69Spbrook  --disable-system) softmmu="no"
7210a8e90f4Spbrook  ;;
722cad25d69Spbrook  --enable-system) softmmu="yes"
7230a8e90f4Spbrook  ;;
7240953a80fSZachary Amsden  --disable-user)
7250953a80fSZachary Amsden      linux_user="no" ;
7260953a80fSZachary Amsden      bsd_user="no" ;
7270953a80fSZachary Amsden      darwin_user="no"
7280953a80fSZachary Amsden  ;;
7290953a80fSZachary Amsden  --enable-user) ;;
730831b7825Sths  --disable-linux-user) linux_user="no"
7310a8e90f4Spbrook  ;;
732831b7825Sths  --enable-linux-user) linux_user="yes"
733831b7825Sths  ;;
734831b7825Sths  --disable-darwin-user) darwin_user="no"
735831b7825Sths  ;;
736831b7825Sths  --enable-darwin-user) darwin_user="yes"
7370a8e90f4Spbrook  ;;
73884778508Sblueswir1  --disable-bsd-user) bsd_user="no"
73984778508Sblueswir1  ;;
74084778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
74184778508Sblueswir1  ;;
742379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
743379f6698SPaul Brook  ;;
744379f6698SPaul Brook  --disable-guest-base) guest_base="no"
745379f6698SPaul Brook  ;;
74640d6444eSAvi Kivity  --enable-pie) pie="yes"
74734005a00SKirill A. Shutemov  ;;
74840d6444eSAvi Kivity  --disable-pie) pie="no"
74934005a00SKirill A. Shutemov  ;;
750c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
751c5937220Spbrook  ;;
7523142255cSblueswir1  --sparc_cpu=*)
7533142255cSblueswir1  ;;
75485aa5189Sbellard  --enable-werror) werror="yes"
75585aa5189Sbellard  ;;
75685aa5189Sbellard  --disable-werror) werror="no"
75785aa5189Sbellard  ;;
7584d3b6f6eSbalrog  --disable-curses) curses="no"
7594d3b6f6eSbalrog  ;;
760c584a6d0SJuan Quintela  --enable-curses) curses="yes"
761c584a6d0SJuan Quintela  ;;
762769ce76dSAlexander Graf  --disable-curl) curl="no"
763769ce76dSAlexander Graf  ;;
764788c8196SJuan Quintela  --enable-curl) curl="yes"
765788c8196SJuan Quintela  ;;
7662df87df7SJuan Quintela  --disable-fdt) fdt="no"
7672df87df7SJuan Quintela  ;;
7682df87df7SJuan Quintela  --enable-fdt) fdt="yes"
7692df87df7SJuan Quintela  ;;
770bd0c5661Spbrook  --disable-nptl) nptl="no"
771bd0c5661Spbrook  ;;
772b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
773b0a47e79SJuan Quintela  ;;
7748ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
7758ff9cbf7Smalc  ;;
7765c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
7775c6c3a6cSChristoph Hellwig  ;;
7785c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
7795c6c3a6cSChristoph Hellwig  ;;
780758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
781758e8e38SVenkateswararao Jujjuri (JV)  ;;
782758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
783758e8e38SVenkateswararao Jujjuri (JV)  ;;
78477755340Sths  --disable-blobs) blobs="no"
78577755340Sths  ;;
7864a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
7874a19f1ecSpbrook  ;;
788519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
789519175a2SAlex Barcelo  ;;
790a25dba17SJuan Quintela  --disable-docs) docs="no"
79170ec5dc0SAnthony Liguori  ;;
792a25dba17SJuan Quintela  --enable-docs) docs="yes"
79383a3ab8bSJuan Quintela  ;;
794d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
795d5970055SMichael S. Tsirkin  ;;
796d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
797d5970055SMichael S. Tsirkin  ;;
79820ff075bSMichael Walle  --disable-opengl) opengl="no"
79920ff075bSMichael Walle  ;;
80020ff075bSMichael Walle  --enable-opengl) opengl="yes"
80120ff075bSMichael Walle  ;;
802f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
803f27aaf4bSChristian Brunner  ;;
804f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
805f27aaf4bSChristian Brunner  ;;
8068c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
8078c84cf11SSergei Trofimovich  ;;
8088c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
8098c84cf11SSergei Trofimovich  ;;
81036707144SAlon Levy  --disable-smartcard) smartcard="no"
81136707144SAlon Levy  ;;
81236707144SAlon Levy  --enable-smartcard) smartcard="yes"
81336707144SAlon Levy  ;;
814111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
815111a38b0SRobert Relyea  ;;
816111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
817111a38b0SRobert Relyea  ;;
81869354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
81969354a83SHans de Goede  ;;
82069354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
82169354a83SHans de Goede  ;;
8221ece9905SAlon Levy  --disable-zlib-test) zlib="no"
8231ece9905SAlon Levy  ;;
824d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
825d138cee9SMichael Roth  ;;
826d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
827d138cee9SMichael Roth  ;;
8287f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
8297f1559c6Sbalrog  ;;
8307d13299dSbellard  esac
8317d13299dSbellarddone
8327d13299dSbellard
8333142255cSblueswir1#
8343142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
835a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
8363142255cSblueswir1#
837379f6698SPaul Brookhost_guest_base="no"
83840293e58Sbellardcase "$cpu" in
839ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
840ed968ff1SJuan Quintela           v7|v8)
841a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
842ed968ff1SJuan Quintela           ;;
843ed968ff1SJuan Quintela           v8plus|v8plusa)
844a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
845ed968ff1SJuan Quintela           ;;
846ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
847a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
848ed968ff1SJuan Quintela           esac
8490c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
850a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
851762e8230Sblueswir1           if test "$solaris" = "no" ; then
852a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
853c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
854762e8230Sblueswir1           fi
8553142255cSblueswir1           ;;
856ed968ff1SJuan Quintela    sparc64)
857a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
8580c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
859a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
860ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
861a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
862762e8230Sblueswir1           fi
8633142255cSblueswir1           ;;
86476d83bdeSths    s390)
86528d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
86628d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
86748bb3750SRichard Henderson           host_guest_base="yes"
86828d7cc49SRichard Henderson           ;;
86928d7cc49SRichard Henderson    s390x)
87028d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
87128d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
87248bb3750SRichard Henderson           host_guest_base="yes"
87376d83bdeSths           ;;
87440293e58Sbellard    i386)
875a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
8760c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
8772b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
878c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
879379f6698SPaul Brook           host_guest_base="yes"
88040293e58Sbellard           ;;
88140293e58Sbellard    x86_64)
882a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
8830c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
8842b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
885379f6698SPaul Brook           host_guest_base="yes"
886379f6698SPaul Brook           ;;
887379f6698SPaul Brook    arm*)
888379f6698SPaul Brook           host_guest_base="yes"
88940293e58Sbellard           ;;
890f6548c0aSmalc    ppc*)
891f6548c0aSmalc           host_guest_base="yes"
892f6548c0aSmalc           ;;
893cc01cc8eSAurelien Jarno    mips*)
894cc01cc8eSAurelien Jarno           host_guest_base="yes"
895cc01cc8eSAurelien Jarno           ;;
896477ba620SAurelien Jarno    ia64*)
897477ba620SAurelien Jarno           host_guest_base="yes"
898477ba620SAurelien Jarno           ;;
899fd76e73aSRichard Henderson    hppa*)
900fd76e73aSRichard Henderson           host_guest_base="yes"
901fd76e73aSRichard Henderson           ;;
902d2fbca94SGuan Xuetao    unicore32*)
903d2fbca94SGuan Xuetao           host_guest_base="yes"
904d2fbca94SGuan Xuetao           ;;
9053142255cSblueswir1esac
9063142255cSblueswir1
907379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
908379f6698SPaul Brook
90960e0df25SPeter Maydell
91060e0df25SPeter Maydelldefault_target_list=""
91160e0df25SPeter Maydell
91260e0df25SPeter Maydell# these targets are portable
91360e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then
91460e0df25SPeter Maydell    default_target_list="\
91560e0df25SPeter Maydelli386-softmmu \
91660e0df25SPeter Maydellx86_64-softmmu \
91727cdad67SRichard Hendersonalpha-softmmu \
91860e0df25SPeter Maydellarm-softmmu \
91960e0df25SPeter Maydellcris-softmmu \
92060e0df25SPeter Maydelllm32-softmmu \
92160e0df25SPeter Maydellm68k-softmmu \
92260e0df25SPeter Maydellmicroblaze-softmmu \
92360e0df25SPeter Maydellmicroblazeel-softmmu \
92460e0df25SPeter Maydellmips-softmmu \
92560e0df25SPeter Maydellmipsel-softmmu \
92660e0df25SPeter Maydellmips64-softmmu \
92760e0df25SPeter Maydellmips64el-softmmu \
92860e0df25SPeter Maydellppc-softmmu \
92960e0df25SPeter Maydellppcemb-softmmu \
93060e0df25SPeter Maydellppc64-softmmu \
93160e0df25SPeter Maydellsh4-softmmu \
93260e0df25SPeter Maydellsh4eb-softmmu \
93360e0df25SPeter Maydellsparc-softmmu \
93460e0df25SPeter Maydellsparc64-softmmu \
9350f3301d4SAlexander Grafs390x-softmmu \
936cfa550c6SMax Filippovxtensa-softmmu \
937cfa550c6SMax Filippovxtensaeb-softmmu \
93860e0df25SPeter Maydell"
93960e0df25SPeter Maydellfi
94060e0df25SPeter Maydell# the following are Linux specific
94160e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then
94260e0df25SPeter Maydell    default_target_list="${default_target_list}\
94360e0df25SPeter Maydelli386-linux-user \
94460e0df25SPeter Maydellx86_64-linux-user \
94560e0df25SPeter Maydellalpha-linux-user \
94660e0df25SPeter Maydellarm-linux-user \
94760e0df25SPeter Maydellarmeb-linux-user \
94860e0df25SPeter Maydellcris-linux-user \
94960e0df25SPeter Maydellm68k-linux-user \
95060e0df25SPeter Maydellmicroblaze-linux-user \
95160e0df25SPeter Maydellmicroblazeel-linux-user \
95260e0df25SPeter Maydellmips-linux-user \
95360e0df25SPeter Maydellmipsel-linux-user \
95460e0df25SPeter Maydellppc-linux-user \
95560e0df25SPeter Maydellppc64-linux-user \
95660e0df25SPeter Maydellppc64abi32-linux-user \
95760e0df25SPeter Maydellsh4-linux-user \
95860e0df25SPeter Maydellsh4eb-linux-user \
95960e0df25SPeter Maydellsparc-linux-user \
96060e0df25SPeter Maydellsparc64-linux-user \
96160e0df25SPeter Maydellsparc32plus-linux-user \
96260e0df25SPeter Maydellunicore32-linux-user \
9630f3301d4SAlexander Grafs390x-linux-user \
96460e0df25SPeter Maydell"
96560e0df25SPeter Maydellfi
96660e0df25SPeter Maydell# the following are Darwin specific
96760e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then
96860e0df25SPeter Maydell    default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
96960e0df25SPeter Maydellfi
97060e0df25SPeter Maydell# the following are BSD specific
97160e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then
97260e0df25SPeter Maydell    default_target_list="${default_target_list}\
97360e0df25SPeter Maydelli386-bsd-user \
97460e0df25SPeter Maydellx86_64-bsd-user \
97560e0df25SPeter Maydellsparc-bsd-user \
97660e0df25SPeter Maydellsparc64-bsd-user \
97760e0df25SPeter Maydell"
97860e0df25SPeter Maydellfi
97960e0df25SPeter Maydell
980af5db58eSpbrookif test x"$show_help" = x"yes" ; then
981af5db58eSpbrookcat << EOF
982af5db58eSpbrook
983af5db58eSpbrookUsage: configure [options]
984af5db58eSpbrookOptions: [defaults in brackets after descriptions]
985af5db58eSpbrook
986af5db58eSpbrookEOF
987af5db58eSpbrookecho "Standard options:"
988af5db58eSpbrookecho "  --help                   print this message"
989af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
990af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
991af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
99260e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
99360e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
99460e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
995af5db58eSpbrookecho ""
996af5db58eSpbrookecho "Advanced options (experts only):"
997af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
998af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
999af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
10000bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
10010bfe8cc0SPaolo Bonziniecho "                           build time"
1002a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
1003e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
1004af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
10056a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
1006c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
1007e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
1008af5db58eSpbrookecho "  --static                 enable static build [$static]"
10090b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
10100b24e75fSPaolo Bonziniecho "  --datadir=PATH           install firmware in PATH"
10110b24e75fSPaolo Bonziniecho "  --docdir=PATH            install documentation in PATH"
10120b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
10130b24e75fSPaolo Bonziniecho "  --sysconfdir=PATH        install config in PATH/qemu"
1014f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1015f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
101609695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1017890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1018890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
10191625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
102085aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1021fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1022c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1023983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1024983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1025821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1026821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
1027af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
1028c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1029c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
10304c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
10314c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
1032eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
1033eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
10348ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
1035e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1036fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
10372e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
10384ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
10398d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
10401be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
10412f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1042ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
10432f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
10442f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
104596763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1046efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
1047bd023f95SCorentin Charyecho "  --disable-vnc-thread     disable threaded VNC server"
1048bd023f95SCorentin Charyecho "  --enable-vnc-thread      enable threaded VNC server"
1049af896aaaSpbrookecho "  --disable-curses         disable curses output"
1050c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1051769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1052788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
10532df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
10542df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1055fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1056a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
10576093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
10587ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1059b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
10609195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1061bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
1062e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
1063af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1064af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
10650953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
10660953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1067831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1068831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
1069831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
1070831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
107184778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
107284778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1073379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1074379f6698SPaul Brookecho "                           emulation targets"
1075379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
107640d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
107740d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1078af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1079af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
10802f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1081c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1082235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
10833142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1084ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1085ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1086e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1087dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
10885c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
10895c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
109047e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
109147e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1092758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1093758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
109477755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1095d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1096d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1097d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1098d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1099320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1100*650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
110174242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
11029410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1103cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1104cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1105f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1106c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1107c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
110836707144SAlon Levyecho "  --disable-smartcard      disable smartcard support"
110936707144SAlon Levyecho "  --enable-smartcard       enable smartcard support"
1110111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1111111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
111269354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
111369354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1114d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1115d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1116519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1117fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
1118af5db58eSpbrookecho ""
11195bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1120af5db58eSpbrookexit 1
1121af5db58eSpbrookfi
1122af5db58eSpbrook
1123359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1124359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1125359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1126359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1127359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1128359bc95dSPeter Maydell        ARCH=tci
1129359bc95dSPeter Maydell    else
1130359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1131359bc95dSPeter Maydell        exit 1
1132359bc95dSPeter Maydell    fi
1133359bc95dSPeter Maydellfi
1134359bc95dSPeter Maydell
11358d05095cSPaolo Bonzini# check that the C compiler works.
11368d05095cSPaolo Bonzinicat > $TMPC <<EOF
113775cafad7SStefan Weilint main(void) { return 0; }
11388d05095cSPaolo BonziniEOF
11398d05095cSPaolo Bonzini
11408d05095cSPaolo Bonziniif compile_object ; then
11418d05095cSPaolo Bonzini  : C compiler works ok
11428d05095cSPaolo Bonzinielse
11438d05095cSPaolo Bonzini    echo "ERROR: \"$cc\" either does not exist or does not work"
11448d05095cSPaolo Bonzini    exit 1
11458d05095cSPaolo Bonzinifi
11468d05095cSPaolo Bonzini
11478d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
11488d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
11498d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1150f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
11518d05095cSPaolo Bonzinicat > $TMPC << EOF
11528d05095cSPaolo Bonziniint main(void) { return 0; }
11538d05095cSPaolo BonziniEOF
11548d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1155bd947d30SStefan Weil    if compile_prog "-Werror $flag" "" ; then
11568d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
11578d05095cSPaolo Bonzini    fi
11588d05095cSPaolo Bonzinidone
11598d05095cSPaolo Bonzini
116040d6444eSAvi Kivityif test "$static" = "yes" ; then
116140d6444eSAvi Kivity  if test "$pie" = "yes" ; then
116240d6444eSAvi Kivity    echo "static and pie are mutually incompatible"
116340d6444eSAvi Kivity    exit 1
116440d6444eSAvi Kivity  else
116540d6444eSAvi Kivity    pie="no"
116640d6444eSAvi Kivity  fi
116740d6444eSAvi Kivityfi
116840d6444eSAvi Kivity
116940d6444eSAvi Kivityif test "$pie" = ""; then
117040d6444eSAvi Kivity  case "$cpu-$targetos" in
1171f9db31a2SBrad    i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
117240d6444eSAvi Kivity      ;;
117340d6444eSAvi Kivity    *)
117440d6444eSAvi Kivity      pie="no"
117540d6444eSAvi Kivity      ;;
117640d6444eSAvi Kivity  esac
117740d6444eSAvi Kivityfi
117840d6444eSAvi Kivity
117940d6444eSAvi Kivityif test "$pie" != "no" ; then
118040d6444eSAvi Kivity  cat > $TMPC << EOF
118121d4a791SAvi Kivity
118221d4a791SAvi Kivity#ifdef __linux__
118321d4a791SAvi Kivity#  define THREAD __thread
118421d4a791SAvi Kivity#else
118521d4a791SAvi Kivity#  define THREAD
118621d4a791SAvi Kivity#endif
118721d4a791SAvi Kivity
118821d4a791SAvi Kivitystatic THREAD int tls_var;
118921d4a791SAvi Kivity
119021d4a791SAvi Kivityint main(void) { return tls_var; }
119121d4a791SAvi Kivity
119240d6444eSAvi KivityEOF
119340d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
119440d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
119540d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
119640d6444eSAvi Kivity    pie="yes"
119740d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
119840d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
119940d6444eSAvi Kivity    fi
120040d6444eSAvi Kivity  else
120140d6444eSAvi Kivity    if test "$pie" = "yes"; then
120240d6444eSAvi Kivity      echo "PIE not available due to missing toolchain support"
120340d6444eSAvi Kivity      exit 1
120440d6444eSAvi Kivity    else
120540d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
120640d6444eSAvi Kivity      pie="no"
120740d6444eSAvi Kivity    fi
120840d6444eSAvi Kivity  fi
120940d6444eSAvi Kivityfi
121040d6444eSAvi Kivity
1211ec530c81Sbellard#
1212ec530c81Sbellard# Solaris specific configure tool chain decisions
1213ec530c81Sbellard#
1214ec530c81Sbellardif test "$solaris" = "yes" ; then
12156792aa11SLoïc Minier  if has $install; then
12166792aa11SLoïc Minier    :
12176792aa11SLoïc Minier  else
1218ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1219ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1220ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1221ec530c81Sbellard    exit 1
1222ec530c81Sbellard  fi
12236792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
1224ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1225ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1226ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1227ec530c81Sbellard    exit 1
1228ec530c81Sbellard  fi
12296792aa11SLoïc Minier  if has ar; then
12306792aa11SLoïc Minier    :
12316792aa11SLoïc Minier  else
1232ec530c81Sbellard    echo "Error: No path includes ar"
1233ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
1234ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
1235ec530c81Sbellard    fi
1236ec530c81Sbellard    exit 1
1237ec530c81Sbellard  fi
1238ec530c81Sbellardfi
1239ec530c81Sbellard
12407a3fc891SSebastian Herbsztif ! has $python; then
1241c886edfbSBlue Swirl  echo "Python not found. Use --python=/path/to/python"
1242c886edfbSBlue Swirl  exit 1
1243c886edfbSBlue Swirlfi
1244c886edfbSBlue Swirl
12456ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
12466ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
12476ccea1e4SPeter Maydellif ! "$python" -c 'import sys; sys.exit(sys.version_info[0] >= 3)'; then
12486ccea1e4SPeter Maydell  echo "Python 2 required but '$python' is version 3 or better."
12496ccea1e4SPeter Maydell  echo "Use --python=/path/to/python to specify a Python 2."
12506ccea1e4SPeter Maydell  exit 1
12516ccea1e4SPeter Maydellfi
12526ccea1e4SPeter Maydell
12535327cf48Sbellardif test -z "$target_list" ; then
125460e0df25SPeter Maydell    target_list="$default_target_list"
12556e20a45fSbellardelse
1256b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
12575327cf48Sbellardfi
12580a8e90f4Spbrookif test -z "$target_list" ; then
12590a8e90f4Spbrook    echo "No targets enabled"
12600a8e90f4Spbrook    exit 1
12610a8e90f4Spbrookfi
1262f55fe278SPaolo Bonzini# see if system emulation was really requested
1263f55fe278SPaolo Bonzinicase " $target_list " in
1264f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1265f55fe278SPaolo Bonzini  ;;
1266f55fe278SPaolo Bonzini  *) softmmu=no
1267f55fe278SPaolo Bonzini  ;;
1268f55fe278SPaolo Bonziniesac
12695327cf48Sbellard
1270249247c9SJuan Quintelafeature_not_found() {
1271249247c9SJuan Quintela  feature=$1
1272249247c9SJuan Quintela
1273249247c9SJuan Quintela  echo "ERROR"
1274249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
12759332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1276249247c9SJuan Quintela  echo "ERROR"
1277249247c9SJuan Quintela  exit 1;
1278249247c9SJuan Quintela}
1279249247c9SJuan Quintela
12807d13299dSbellardif test -z "$cross_prefix" ; then
12817d13299dSbellard
12827d13299dSbellard# ---
12837d13299dSbellard# big/little endian test
12847d13299dSbellardcat > $TMPC << EOF
12857d13299dSbellard#include <inttypes.h>
12867d13299dSbellardint main(int argc, char ** argv){
12877d13299dSbellard        volatile uint32_t i=0x01234567;
12887d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
12897d13299dSbellard}
12907d13299dSbellardEOF
12917d13299dSbellard
129252166aa0SJuan Quintelaif compile_prog "" "" ; then
12937d13299dSbellard$TMPE && bigendian="yes"
12947d13299dSbellardelse
12957d13299dSbellardecho big/little test failed
12967d13299dSbellardfi
12977d13299dSbellard
12987d13299dSbellardelse
12997d13299dSbellard
13007d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1301ea8f20f8SJuan Quintelacase "$cpu" in
130221d89f84SPeter Maydell  arm)
130321d89f84SPeter Maydell    # ARM can be either way; ask the compiler which one we are
130421d89f84SPeter Maydell    if check_define __ARMEB__; then
130521d89f84SPeter Maydell      bigendian=yes
130621d89f84SPeter Maydell    fi
130721d89f84SPeter Maydell  ;;
130821d89f84SPeter Maydell  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1309ea8f20f8SJuan Quintela    bigendian=yes
1310ea8f20f8SJuan Quintela  ;;
1311ea8f20f8SJuan Quintelaesac
13127d13299dSbellard
13137d13299dSbellardfi
13147d13299dSbellard
1315b0a47e79SJuan Quintela##########################################
1316b0a47e79SJuan Quintela# NPTL probe
1317b0a47e79SJuan Quintela
1318b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1319bd0c5661Spbrook  cat > $TMPC <<EOF
1320bd0c5661Spbrook#include <sched.h>
132130813ceaSpbrook#include <linux/futex.h>
1322182eacc0SStefan Weilint main(void) {
1323bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1324bd0c5661Spbrook#error bork
1325bd0c5661Spbrook#endif
1326182eacc0SStefan Weil  return 0;
1327bd0c5661Spbrook}
1328bd0c5661SpbrookEOF
1329bd0c5661Spbrook
133052166aa0SJuan Quintela  if compile_object ; then
1331b0a47e79SJuan Quintela    nptl=yes
1332bd0c5661Spbrook  else
1333b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1334b0a47e79SJuan Quintela      feature_not_found "nptl"
1335b0a47e79SJuan Quintela    fi
1336b0a47e79SJuan Quintela    nptl=no
1337b0a47e79SJuan Quintela  fi
1338bd0c5661Spbrookfi
1339bd0c5661Spbrook
134011d9f695Sbellard##########################################
1341ac62922eSbalrog# zlib check
1342ac62922eSbalrog
13431ece9905SAlon Levyif test "$zlib" != "no" ; then
1344ac62922eSbalrog    cat > $TMPC << EOF
1345ac62922eSbalrog#include <zlib.h>
1346ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1347ac62922eSbalrogEOF
134852166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1349ac62922eSbalrog        :
1350ac62922eSbalrog    else
1351ac62922eSbalrog        echo
1352ac62922eSbalrog        echo "Error: zlib check failed"
1353ac62922eSbalrog        echo "Make sure to have the zlib libs and headers installed."
1354ac62922eSbalrog        echo
1355ac62922eSbalrog        exit 1
1356ac62922eSbalrog    fi
13571ece9905SAlon Levyfi
1358ac62922eSbalrog
1359ac62922eSbalrog##########################################
1360e37630caSaliguori# xen probe
1361e37630caSaliguori
1362fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1363b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1364d5b93ddfSAnthony PERARD
136550ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
136650ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
136750ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
136850ced5b3SStefan Weil
136950ced5b3SStefan Weil  # Xen (any)
137050ced5b3SStefan Weil  cat > $TMPC <<EOF
137150ced5b3SStefan Weil#include <xenctrl.h>
137250ced5b3SStefan Weil#include <xs.h>
137350ced5b3SStefan Weilint main(void) {
137450ced5b3SStefan Weil  return 0;
137550ced5b3SStefan Weil}
137650ced5b3SStefan WeilEOF
137750ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
137850ced5b3SStefan Weil    # Xen not found
137950ced5b3SStefan Weil    if test "$xen" = "yes" ; then
138050ced5b3SStefan Weil      feature_not_found "xen"
138150ced5b3SStefan Weil    fi
138250ced5b3SStefan Weil    xen=no
138350ced5b3SStefan Weil
1384d5b93ddfSAnthony PERARD  # Xen unstable
138550ced5b3SStefan Weil  elif (
1386e37630caSaliguori      cat > $TMPC <<EOF
1387e37630caSaliguori#include <xenctrl.h>
1388e37630caSaliguori#include <xs.h>
1389d5b93ddfSAnthony PERARD#include <stdint.h>
1390d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1391d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1392d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1393d5b93ddfSAnthony PERARD#endif
1394d5b93ddfSAnthony PERARDint main(void) {
1395d5b93ddfSAnthony PERARD  xc_interface *xc;
1396d5b93ddfSAnthony PERARD  xs_daemon_open();
1397d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1398d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1399d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1400b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1401d5b93ddfSAnthony PERARD  return 0;
1402d5b93ddfSAnthony PERARD}
1403e37630caSaliguoriEOF
140450ced5b3SStefan Weil      compile_prog "" "$xen_libs"
140550ced5b3SStefan Weil    ) ; then
1406d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1407fc321b4bSJuan Quintela    xen=yes
1408d5b93ddfSAnthony PERARD
1409d5b93ddfSAnthony PERARD  # Xen 4.0.0
1410d5b93ddfSAnthony PERARD  elif (
1411d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1412d5b93ddfSAnthony PERARD#include <xenctrl.h>
1413d5b93ddfSAnthony PERARD#include <xs.h>
1414d5b93ddfSAnthony PERARD#include <stdint.h>
1415d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1416d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1417d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1418d5b93ddfSAnthony PERARD#endif
1419d5b93ddfSAnthony PERARDint main(void) {
1420b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1421b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1422b87de24eSAnthony PERARD  };
1423d5b93ddfSAnthony PERARD  xs_daemon_open();
1424d5b93ddfSAnthony PERARD  xc_interface_open();
1425d5b93ddfSAnthony PERARD  xc_gnttab_open();
1426d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1427b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1428d5b93ddfSAnthony PERARD  return 0;
1429d5b93ddfSAnthony PERARD}
1430d5b93ddfSAnthony PERARDEOF
1431d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1432d5b93ddfSAnthony PERARD    ) ; then
1433d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1434d5b93ddfSAnthony PERARD    xen=yes
1435d5b93ddfSAnthony PERARD
1436b87de24eSAnthony PERARD  # Xen 3.4.0
1437b87de24eSAnthony PERARD  elif (
1438b87de24eSAnthony PERARD      cat > $TMPC <<EOF
1439b87de24eSAnthony PERARD#include <xenctrl.h>
1440b87de24eSAnthony PERARD#include <xs.h>
1441b87de24eSAnthony PERARDint main(void) {
1442b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1443b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1444b87de24eSAnthony PERARD  };
1445b87de24eSAnthony PERARD  xs_daemon_open();
1446b87de24eSAnthony PERARD  xc_interface_open();
1447b87de24eSAnthony PERARD  xc_gnttab_open();
1448b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1449b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1450b87de24eSAnthony PERARD  return 0;
1451b87de24eSAnthony PERARD}
1452b87de24eSAnthony PERARDEOF
1453b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
1454b87de24eSAnthony PERARD    ) ; then
1455b87de24eSAnthony PERARD    xen_ctrl_version=340
1456b87de24eSAnthony PERARD    xen=yes
1457b87de24eSAnthony PERARD
1458b87de24eSAnthony PERARD  # Xen 3.3.0
1459d5b93ddfSAnthony PERARD  elif (
1460d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1461d5b93ddfSAnthony PERARD#include <xenctrl.h>
1462d5b93ddfSAnthony PERARD#include <xs.h>
1463d5b93ddfSAnthony PERARDint main(void) {
1464d5b93ddfSAnthony PERARD  xs_daemon_open();
1465d5b93ddfSAnthony PERARD  xc_interface_open();
1466d5b93ddfSAnthony PERARD  xc_gnttab_open();
1467d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1468d5b93ddfSAnthony PERARD  return 0;
1469d5b93ddfSAnthony PERARD}
1470d5b93ddfSAnthony PERARDEOF
1471d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1472d5b93ddfSAnthony PERARD    ) ; then
1473d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1474d5b93ddfSAnthony PERARD    xen=yes
1475d5b93ddfSAnthony PERARD
147650ced5b3SStefan Weil  # Xen version unsupported
1477e37630caSaliguori  else
1478fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
147950ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1480fc321b4bSJuan Quintela    fi
1481fc321b4bSJuan Quintela    xen=no
1482e37630caSaliguori  fi
1483d5b93ddfSAnthony PERARD
1484d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1485d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1486d5b93ddfSAnthony PERARD  fi
1487e37630caSaliguorifi
1488e37630caSaliguori
1489e37630caSaliguori##########################################
1490a8bd70adSPaolo Bonzini# pkg-config probe
1491f91672e5SPaolo Bonzini
149217884d7bSSergei Trofimovichif ! has "$pkg_config_exe"; then
149317884d7bSSergei Trofimovich  echo "Error: pkg-config binary '$pkg_config_exe' not found"
1494a213fcb2SPeter Maydell  exit 1
1495f91672e5SPaolo Bonzinifi
1496f91672e5SPaolo Bonzini
1497f91672e5SPaolo Bonzini##########################################
149844dc0ca3SAlon Levy# libtool probe
149944dc0ca3SAlon Levy
15003f534581SBradif ! has $libtool; then
150144dc0ca3SAlon Levy    libtool=
150244dc0ca3SAlon Levyfi
150344dc0ca3SAlon Levy
150444dc0ca3SAlon Levy##########################################
1505dfffc653SJuan Quintela# Sparse probe
1506dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
15070dba6195SLoïc Minier  if has cgcc; then
1508dfffc653SJuan Quintela    sparse=yes
1509dfffc653SJuan Quintela  else
1510dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1511dfffc653SJuan Quintela      feature_not_found "sparse"
1512dfffc653SJuan Quintela    fi
1513dfffc653SJuan Quintela    sparse=no
1514dfffc653SJuan Quintela  fi
1515dfffc653SJuan Quintelafi
1516dfffc653SJuan Quintela
1517dfffc653SJuan Quintela##########################################
151811d9f695Sbellard# SDL probe
151911d9f695Sbellard
15203ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
15213ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
15223ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
15233ec87ffeSPaolo Bonzini  sdl_config=sdl-config
15243ec87ffeSPaolo Bonzinifi
15253ec87ffeSPaolo Bonzini
15263ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1527a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1528fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
15293ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
15303ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
15319316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1532a0dfd8a4SLoïc Minierelse
1533a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1534a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1535a0dfd8a4SLoïc Minier  fi
1536a0dfd8a4SLoïc Minier  sdl=no
15379316f803SPaolo Bonzinifi
153829e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
15393ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
15403ec87ffeSPaolo Bonzinifi
154111d9f695Sbellard
15429316f803SPaolo Bonzinisdl_too_old=no
1543c4198157SJuan Quintelaif test "$sdl" != "no" ; then
154411d9f695Sbellard  cat > $TMPC << EOF
154511d9f695Sbellard#include <SDL.h>
154611d9f695Sbellard#undef main /* We don't want SDL to override our main() */
154711d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
154811d9f695SbellardEOF
15499316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
155074f42e18STeLeMan  if test "$static" = "yes" ; then
155174f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
155274f42e18STeLeMan  else
15539316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
155474f42e18STeLeMan  fi
155552166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
155611d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
155711d9f695Sbellard      sdl_too_old=yes
155811d9f695Sbellard    else
1559fd677642Sths      if test "$cocoa" = "no" ; then
156011d9f695Sbellard        sdl=yes
156111d9f695Sbellard      fi
1562fd677642Sths    fi
15637c1f25b4Sbellard
156467c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
15651ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
156667c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1567f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1568f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
156911d9f695Sbellard      fi
157052166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
15711ac88f28SJuan Quintela	:
15721ac88f28SJuan Quintela      else
15731ac88f28SJuan Quintela        sdl=no
15747c1f25b4Sbellard      fi
15757c1f25b4Sbellard    fi # static link
1576c4198157SJuan Quintela  else # sdl not found
1577c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1578c4198157SJuan Quintela      feature_not_found "sdl"
1579c4198157SJuan Quintela    fi
1580c4198157SJuan Quintela    sdl=no
15817c1f25b4Sbellard  fi # sdl compile test
1582fd677642Sthsfi
158311d9f695Sbellard
15845368a422Saliguoriif test "$sdl" = "yes" ; then
15855368a422Saliguori  cat > $TMPC <<EOF
15865368a422Saliguori#include <SDL.h>
15875368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
15885368a422Saliguori#include <X11/XKBlib.h>
15895368a422Saliguori#else
15905368a422Saliguori#error No x11 support
15915368a422Saliguori#endif
15925368a422Saliguoriint main(void) { return 0; }
15935368a422SaliguoriEOF
159452166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1595681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
15965368a422Saliguori  fi
15970705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
15985368a422Saliguorifi
15995368a422Saliguori
16008f28f3fbSths##########################################
16018d5d2d4cSths# VNC TLS detection
1602821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1603ae6b5e5aSaliguori  cat > $TMPC <<EOF
1604ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1605ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1606ae6b5e5aSaliguoriEOF
1607a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1608a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
160952166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
16101be10ad2SJuan Quintela    vnc_tls=yes
1611a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1612ae6b5e5aSaliguori  else
16131be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
16141be10ad2SJuan Quintela      feature_not_found "vnc-tls"
16151be10ad2SJuan Quintela    fi
16161be10ad2SJuan Quintela    vnc_tls=no
16178d5d2d4cSths  fi
16188d5d2d4cSthsfi
16198d5d2d4cSths
16208d5d2d4cSths##########################################
16212f9606b3Saliguori# VNC SASL detection
1622821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
16232f9606b3Saliguori  cat > $TMPC <<EOF
16242f9606b3Saliguori#include <sasl/sasl.h>
16252f9606b3Saliguori#include <stdio.h>
16262f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
16272f9606b3SaliguoriEOF
16282f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
16292f9606b3Saliguori  vnc_sasl_cflags=""
16302f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
163152166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1632ea784e3bSJuan Quintela    vnc_sasl=yes
1633fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
16342f9606b3Saliguori  else
1635ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1636ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1637ea784e3bSJuan Quintela    fi
1638ea784e3bSJuan Quintela    vnc_sasl=no
16392f9606b3Saliguori  fi
16402f9606b3Saliguorifi
16412f9606b3Saliguori
16422f9606b3Saliguori##########################################
16432f6f5c7aSCorentin Chary# VNC JPEG detection
1644821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
16452f6f5c7aSCorentin Charycat > $TMPC <<EOF
16462f6f5c7aSCorentin Chary#include <stdio.h>
16472f6f5c7aSCorentin Chary#include <jpeglib.h>
16482f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
16492f6f5c7aSCorentin CharyEOF
16502f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
16512f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
16522f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
16532f6f5c7aSCorentin Chary    vnc_jpeg=yes
16542f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
16552f6f5c7aSCorentin Chary  else
16562f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
16572f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
16582f6f5c7aSCorentin Chary    fi
16592f6f5c7aSCorentin Chary    vnc_jpeg=no
16602f6f5c7aSCorentin Chary  fi
16612f6f5c7aSCorentin Charyfi
16622f6f5c7aSCorentin Chary
16632f6f5c7aSCorentin Chary##########################################
1664efe556adSCorentin Chary# VNC PNG detection
1665821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1666efe556adSCorentin Charycat > $TMPC <<EOF
1667efe556adSCorentin Chary//#include <stdio.h>
1668efe556adSCorentin Chary#include <png.h>
1669832ce9c2SScott Wood#include <stddef.h>
1670efe556adSCorentin Charyint main(void) {
1671efe556adSCorentin Chary    png_structp png_ptr;
1672efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1673efe556adSCorentin Chary    return 0;
1674efe556adSCorentin Chary}
1675efe556adSCorentin CharyEOF
16769af8025eSBrad  if $pkg_config libpng --modversion >/dev/null 2>&1; then
16779af8025eSBrad    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
16789af8025eSBrad    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
16799af8025eSBrad  else
1680efe556adSCorentin Chary    vnc_png_cflags=""
1681efe556adSCorentin Chary    vnc_png_libs="-lpng"
16829af8025eSBrad  fi
1683efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1684efe556adSCorentin Chary    vnc_png=yes
1685efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
16869af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1687efe556adSCorentin Chary  else
1688efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1689efe556adSCorentin Chary      feature_not_found "vnc-png"
1690efe556adSCorentin Chary    fi
1691efe556adSCorentin Chary    vnc_png=no
1692efe556adSCorentin Chary  fi
1693efe556adSCorentin Charyfi
1694efe556adSCorentin Chary
1695efe556adSCorentin Chary##########################################
169676655d6dSaliguori# fnmatch() probe, used for ACL routines
169776655d6dSaliguorifnmatch="no"
169876655d6dSaliguoricat > $TMPC << EOF
169976655d6dSaliguori#include <fnmatch.h>
170076655d6dSaliguoriint main(void)
170176655d6dSaliguori{
170276655d6dSaliguori    fnmatch("foo", "foo", 0);
170376655d6dSaliguori    return 0;
170476655d6dSaliguori}
170576655d6dSaliguoriEOF
170652166aa0SJuan Quintelaif compile_prog "" "" ; then
170776655d6dSaliguori   fnmatch="yes"
170876655d6dSaliguorifi
170976655d6dSaliguori
171076655d6dSaliguori##########################################
1711ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1712ee682d27SStefan Weilif test "$uuid" != "no" ; then
1713ee682d27SStefan Weil  uuid_libs="-luuid"
1714ee682d27SStefan Weil  cat > $TMPC << EOF
1715ee682d27SStefan Weil#include <uuid/uuid.h>
1716ee682d27SStefan Weilint main(void)
1717ee682d27SStefan Weil{
1718ee682d27SStefan Weil    uuid_t my_uuid;
1719ee682d27SStefan Weil    uuid_generate(my_uuid);
1720ee682d27SStefan Weil    return 0;
1721ee682d27SStefan Weil}
1722ee682d27SStefan WeilEOF
1723ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1724ee682d27SStefan Weil    uuid="yes"
1725ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1726ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1727ee682d27SStefan Weil  else
1728ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1729ee682d27SStefan Weil      feature_not_found "uuid"
1730ee682d27SStefan Weil    fi
1731ee682d27SStefan Weil    uuid=no
1732ee682d27SStefan Weil  fi
1733ee682d27SStefan Weilfi
1734ee682d27SStefan Weil
1735ee682d27SStefan Weil##########################################
1736dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1737dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1738dce512deSChristoph Hellwig  cat > $TMPC << EOF
1739ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
1740dce512deSChristoph Hellwig#include <xfs/xfs.h>
1741dce512deSChristoph Hellwigint main(void)
1742dce512deSChristoph Hellwig{
1743dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1744dce512deSChristoph Hellwig    return 0;
1745dce512deSChristoph Hellwig}
1746dce512deSChristoph HellwigEOF
1747dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1748dce512deSChristoph Hellwig    xfs="yes"
1749dce512deSChristoph Hellwig  else
1750dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1751dce512deSChristoph Hellwig      feature_not_found "xfs"
1752dce512deSChristoph Hellwig    fi
1753dce512deSChristoph Hellwig    xfs=no
1754dce512deSChristoph Hellwig  fi
1755dce512deSChristoph Hellwigfi
1756dce512deSChristoph Hellwig
1757dce512deSChristoph Hellwig##########################################
17588a16d273Sths# vde libraries probe
1759dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
17604baae0acSJuan Quintela  vde_libs="-lvdeplug"
17618a16d273Sths  cat > $TMPC << EOF
17628a16d273Sths#include <libvdeplug.h>
17634a7f0e06Spbrookint main(void)
17644a7f0e06Spbrook{
17654a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
17664a7f0e06Spbrook    vde_open("", "", &a);
17674a7f0e06Spbrook    return 0;
17684a7f0e06Spbrook}
17698a16d273SthsEOF
177052166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
17714baae0acSJuan Quintela    vde=yes
17728e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
17738e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1774dfb278bdSJuan Quintela  else
1775dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1776dfb278bdSJuan Quintela      feature_not_found "vde"
1777dfb278bdSJuan Quintela    fi
1778dfb278bdSJuan Quintela    vde=no
17798a16d273Sths  fi
17808a16d273Sthsfi
17818a16d273Sths
17828a16d273Sths##########################################
178347e98658SCorey Bryant# libcap-ng library probe
178447e98658SCorey Bryantif test "$cap_ng" != "no" ; then
178547e98658SCorey Bryant  cap_libs="-lcap-ng"
178647e98658SCorey Bryant  cat > $TMPC << EOF
178747e98658SCorey Bryant#include <cap-ng.h>
178847e98658SCorey Bryantint main(void)
178947e98658SCorey Bryant{
179047e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
179147e98658SCorey Bryant    return 0;
179247e98658SCorey Bryant}
179347e98658SCorey BryantEOF
179447e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
179547e98658SCorey Bryant    cap_ng=yes
179647e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
179747e98658SCorey Bryant  else
179847e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
179947e98658SCorey Bryant      feature_not_found "cap_ng"
180047e98658SCorey Bryant    fi
180147e98658SCorey Bryant    cap_ng=no
180247e98658SCorey Bryant  fi
180347e98658SCorey Bryantfi
180447e98658SCorey Bryant
180547e98658SCorey Bryant##########################################
1806c2de5c91Smalc# Sound support libraries probe
18078f28f3fbSths
1808c2de5c91Smalcaudio_drv_probe()
1809c2de5c91Smalc{
1810c2de5c91Smalc    drv=$1
1811c2de5c91Smalc    hdr=$2
1812c2de5c91Smalc    lib=$3
1813c2de5c91Smalc    exp=$4
1814c2de5c91Smalc    cfl=$5
18158f28f3fbSths        cat > $TMPC << EOF
1816c2de5c91Smalc#include <$hdr>
1817c2de5c91Smalcint main(void) { $exp }
18188f28f3fbSthsEOF
181952166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
18208f28f3fbSths        :
18218f28f3fbSths    else
18228f28f3fbSths        echo
1823c2de5c91Smalc        echo "Error: $drv check failed"
1824c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
18258f28f3fbSths        echo
18268f28f3fbSths        exit 1
18278f28f3fbSths    fi
1828c2de5c91Smalc}
1829c2de5c91Smalc
18302fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1831c2de5c91Smalcfor drv in $audio_drv_list; do
1832c2de5c91Smalc    case $drv in
1833c2de5c91Smalc    alsa)
1834c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1835c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1836a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1837c2de5c91Smalc    ;;
1838c2de5c91Smalc
1839c2de5c91Smalc    fmod)
1840c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1841c2de5c91Smalc        echo
1842c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1843c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1844c2de5c91Smalc        echo
1845c2de5c91Smalc        exit 1
18468f28f3fbSths    fi
1847c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1848a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1849c2de5c91Smalc    ;;
1850c2de5c91Smalc
1851c2de5c91Smalc    esd)
1852c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1853a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
185467f86e8eSJuan Quintela    audio_pt_int="yes"
1855c2de5c91Smalc    ;;
1856b8e59f18Smalc
1857b8e59f18Smalc    pa)
1858a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
1859a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
1860a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
186167f86e8eSJuan Quintela    audio_pt_int="yes"
1862b8e59f18Smalc    ;;
1863b8e59f18Smalc
1864997e690aSJuan Quintela    coreaudio)
1865997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1866997e690aSJuan Quintela    ;;
1867997e690aSJuan Quintela
1868a4bf6780SJuan Quintela    dsound)
1869a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1870d5631638Smalc      audio_win_int="yes"
1871a4bf6780SJuan Quintela    ;;
1872a4bf6780SJuan Quintela
1873a4bf6780SJuan Quintela    oss)
1874a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1875a4bf6780SJuan Quintela    ;;
1876a4bf6780SJuan Quintela
1877a4bf6780SJuan Quintela    sdl|wav)
18782f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
18792f6a1ab0Sblueswir1    ;;
18802f6a1ab0Sblueswir1
1881d5631638Smalc    winwave)
1882d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1883d5631638Smalc      audio_win_int="yes"
1884d5631638Smalc    ;;
1885d5631638Smalc
1886e4c63a6aSmalc    *)
18871c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1888e4c63a6aSmalc        echo
1889e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1890e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1891e4c63a6aSmalc        echo
1892e4c63a6aSmalc        exit 1
1893e4c63a6aSmalc    }
1894e4c63a6aSmalc    ;;
1895c2de5c91Smalc    esac
1896c2de5c91Smalcdone
18978f28f3fbSths
18984d3b6f6eSbalrog##########################################
18992e4d9fb1Saurel32# BrlAPI probe
19002e4d9fb1Saurel32
19014ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1902eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
19032e4d9fb1Saurel32  cat > $TMPC << EOF
19042e4d9fb1Saurel32#include <brlapi.h>
1905832ce9c2SScott Wood#include <stddef.h>
19062e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
19072e4d9fb1Saurel32EOF
190852166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
19092e4d9fb1Saurel32    brlapi=yes
1910264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
19114ffcedb6SJuan Quintela  else
19124ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
19134ffcedb6SJuan Quintela      feature_not_found "brlapi"
19144ffcedb6SJuan Quintela    fi
19154ffcedb6SJuan Quintela    brlapi=no
1916eb82284fSJuan Quintela  fi
1917eb82284fSJuan Quintelafi
19182e4d9fb1Saurel32
19192e4d9fb1Saurel32##########################################
19204d3b6f6eSbalrog# curses probe
1921e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
1922e095e2f3SStefan Weil    curses_list="-lpdcurses"
1923e095e2f3SStefan Weilelse
19244f78ef9aSJuan Quintela    curses_list="-lncurses -lcurses"
1925e095e2f3SStefan Weilfi
19264d3b6f6eSbalrog
1927c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1928c584a6d0SJuan Quintela  curses_found=no
19294d3b6f6eSbalrog  cat > $TMPC << EOF
19304d3b6f6eSbalrog#include <curses.h>
1931ef9a2524SStefan Weilint main(void) {
1932ef9a2524SStefan Weil  const char *s = curses_version();
1933ef9a2524SStefan Weil  resize_term(0, 0);
1934ef9a2524SStefan Weil  return s != 0;
1935ef9a2524SStefan Weil}
19364d3b6f6eSbalrogEOF
19374f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
19384f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1939c584a6d0SJuan Quintela      curses_found=yes
19404f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
19414f78ef9aSJuan Quintela      break
19424d3b6f6eSbalrog    fi
19434f78ef9aSJuan Quintela  done
1944c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1945c584a6d0SJuan Quintela    curses=yes
1946c584a6d0SJuan Quintela  else
1947c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1948c584a6d0SJuan Quintela      feature_not_found "curses"
1949c584a6d0SJuan Quintela    fi
1950c584a6d0SJuan Quintela    curses=no
1951c584a6d0SJuan Quintela  fi
19524f78ef9aSJuan Quintelafi
19534d3b6f6eSbalrog
1954414f0dabSblueswir1##########################################
1955769ce76dSAlexander Graf# curl probe
1956769ce76dSAlexander Graf
1957a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
1958a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
19594e2b0658SPaolo Bonzinielse
19604e2b0658SPaolo Bonzini  curlconfig=curl-config
19614e2b0658SPaolo Bonzinifi
19624e2b0658SPaolo Bonzini
1963788c8196SJuan Quintelaif test "$curl" != "no" ; then
1964769ce76dSAlexander Graf  cat > $TMPC << EOF
1965769ce76dSAlexander Graf#include <curl/curl.h>
19660b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
1967769ce76dSAlexander GrafEOF
19684e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
19694e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
1970b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
1971769ce76dSAlexander Graf    curl=yes
1972f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
1973f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
1974788c8196SJuan Quintela  else
1975788c8196SJuan Quintela    if test "$curl" = "yes" ; then
1976788c8196SJuan Quintela      feature_not_found "curl"
1977788c8196SJuan Quintela    fi
1978788c8196SJuan Quintela    curl=no
1979769ce76dSAlexander Graf  fi
1980769ce76dSAlexander Graffi # test "$curl"
1981769ce76dSAlexander Graf
1982769ce76dSAlexander Graf##########################################
1983fb599c9aSbalrog# bluez support probe
1984a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
1985e820e3f4Sbalrog  cat > $TMPC << EOF
1986e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
1987e820e3f4Sbalrogint main(void) { return bt_error(0); }
1988e820e3f4SbalrogEOF
1989a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1990a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
199152166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1992a20a6f46SJuan Quintela    bluez=yes
1993e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
1994e820e3f4Sbalrog  else
1995a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
1996a20a6f46SJuan Quintela      feature_not_found "bluez"
1997a20a6f46SJuan Quintela    fi
1998e820e3f4Sbalrog    bluez="no"
1999e820e3f4Sbalrog  fi
2000fb599c9aSbalrogfi
2001fb599c9aSbalrog
2002fb599c9aSbalrog##########################################
2003e18df141SAnthony Liguori# glib support probe
2004a52d28afSPaolo Bonzini
2005a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2006a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2007a52d28afSPaolo Bonzini    glib_req_ver=2.20
2008a52d28afSPaolo Bonzinielse
2009a52d28afSPaolo Bonzini    glib_req_ver=2.12
2010a52d28afSPaolo Bonzinifi
2011a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
2012a52d28afSPaolo Bonzinithen
20134b76a481SStefan Hajnoczi    glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
20144b76a481SStefan Hajnoczi    glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
201514015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2016957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2017e18df141SAnthony Liguorielse
2018a52d28afSPaolo Bonzini    echo "glib-$glib_req_ver required to compile QEMU"
2019e18df141SAnthony Liguori    exit 1
2020e18df141SAnthony Liguorifi
2021e18df141SAnthony Liguori
2022e18df141SAnthony Liguori##########################################
202317bff52bSM. Mohan Kumar# libcap probe
202417bff52bSM. Mohan Kumar
202517bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
202617bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
202717bff52bSM. Mohan Kumar#include <stdio.h>
202817bff52bSM. Mohan Kumar#include <sys/capability.h>
202917bff52bSM. Mohan Kumarint main(void) { cap_t caps; caps = cap_init(); }
203017bff52bSM. Mohan KumarEOF
203117bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
203217bff52bSM. Mohan Kumar    cap=yes
203317bff52bSM. Mohan Kumar  else
203417bff52bSM. Mohan Kumar    cap=no
203517bff52bSM. Mohan Kumar  fi
203617bff52bSM. Mohan Kumarfi
203717bff52bSM. Mohan Kumar
203817bff52bSM. Mohan Kumar##########################################
2039e5d355d1Saliguori# pthread probe
20404b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
20413c529d93Saliguori
2042e5d355d1Saliguoripthread=no
2043414f0dabSblueswir1cat > $TMPC << EOF
20443c529d93Saliguori#include <pthread.h>
20457a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
20467a42bbe4SStefan Weilint main(void) {
20477a42bbe4SStefan Weil  pthread_t thread;
20487a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
20497a42bbe4SStefan Weil  return 0;
20507a42bbe4SStefan Weil}
2051414f0dabSblueswir1EOF
2052bd00d539SAndreas Färberif compile_prog "" "" ; then
2053bd00d539SAndreas Färber  pthread=yes
2054bd00d539SAndreas Färberelse
2055de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
205652166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2057e5d355d1Saliguori      pthread=yes
20585572b539SJuan Quintela      LIBS="$pthread_lib $LIBS"
2059de65fe0fSSebastian Herbszt      break
2060414f0dabSblueswir1    fi
2061de65fe0fSSebastian Herbszt  done
2062bd00d539SAndreas Färberfi
2063414f0dabSblueswir1
20644617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
20654dd75c70SChristoph Hellwig  echo
20664dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
20674dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
20684dd75c70SChristoph Hellwig  echo
20694dd75c70SChristoph Hellwig  exit 1
2070e5d355d1Saliguorifi
2071e5d355d1Saliguori
2072bf9298b9Saliguori##########################################
2073f27aaf4bSChristian Brunner# rbd probe
2074f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2075f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2076f27aaf4bSChristian Brunner#include <stdio.h>
2077ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2078f27aaf4bSChristian Brunnerint main(void) {
2079ad32e9c0SJosh Durgin    rados_t cluster;
2080ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2081f27aaf4bSChristian Brunner    return 0;
2082f27aaf4bSChristian Brunner}
2083f27aaf4bSChristian BrunnerEOF
2084ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2085f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2086f27aaf4bSChristian Brunner    rbd=yes
2087f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2088f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2089f27aaf4bSChristian Brunner  else
2090f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2091f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2092f27aaf4bSChristian Brunner    fi
2093f27aaf4bSChristian Brunner    rbd=no
2094f27aaf4bSChristian Brunner  fi
2095f27aaf4bSChristian Brunnerfi
2096f27aaf4bSChristian Brunner
2097f27aaf4bSChristian Brunner##########################################
20985c6c3a6cSChristoph Hellwig# linux-aio probe
20995c6c3a6cSChristoph Hellwig
21005c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
21015c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
21025c6c3a6cSChristoph Hellwig#include <libaio.h>
21035c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2104832ce9c2SScott Wood#include <stddef.h>
21055c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
21065c6c3a6cSChristoph HellwigEOF
21075c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
21085c6c3a6cSChristoph Hellwig    linux_aio=yes
2109048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2110048d179fSPaul Brook    libs_tools="$libs_tools -laio"
21115c6c3a6cSChristoph Hellwig  else
21125c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
21135c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
21145c6c3a6cSChristoph Hellwig    fi
21153cfcae3cSLuiz Capitulino    linux_aio=no
21165c6c3a6cSChristoph Hellwig  fi
21175c6c3a6cSChristoph Hellwigfi
21185c6c3a6cSChristoph Hellwig
21195c6c3a6cSChristoph Hellwig##########################################
2120758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2121758e8e38SVenkateswararao Jujjuri (JV)
2122758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2123758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2124758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2125758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2126f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2127f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2128f2338fb4SPavel Borzenkov#else
21294f26f2b6SAvi Kivity#include <sys/xattr.h>
2130f2338fb4SPavel Borzenkov#endif
2131758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2132758e8e38SVenkateswararao Jujjuri (JV)EOF
21334f26f2b6SAvi Kivity  if compile_prog "" "" ; then
21344f26f2b6SAvi Kivity    attr=yes
21354f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2136f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2137758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2138758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
21394f26f2b6SAvi Kivity    libattr=yes
2140758e8e38SVenkateswararao Jujjuri (JV)  else
2141758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2142758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2143758e8e38SVenkateswararao Jujjuri (JV)    fi
2144758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2145758e8e38SVenkateswararao Jujjuri (JV)  fi
2146758e8e38SVenkateswararao Jujjuri (JV)fi
2147758e8e38SVenkateswararao Jujjuri (JV)
2148758e8e38SVenkateswararao Jujjuri (JV)##########################################
2149bf9298b9Saliguori# iovec probe
2150bf9298b9Saliguoricat > $TMPC <<EOF
2151db34f0b3Sblueswir1#include <sys/types.h>
2152bf9298b9Saliguori#include <sys/uio.h>
2153db34f0b3Sblueswir1#include <unistd.h>
2154f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2155bf9298b9SaliguoriEOF
2156bf9298b9Saliguoriiovec=no
215752166aa0SJuan Quintelaif compile_prog "" "" ; then
2158bf9298b9Saliguori  iovec=yes
2159bf9298b9Saliguorifi
2160bf9298b9Saliguori
2161f652e6afSaurel32##########################################
2162ceb42de8Saliguori# preadv probe
2163ceb42de8Saliguoricat > $TMPC <<EOF
2164ceb42de8Saliguori#include <sys/types.h>
2165ceb42de8Saliguori#include <sys/uio.h>
2166ceb42de8Saliguori#include <unistd.h>
216784972cbbSStefan Weilint main(void) { return preadv == preadv; }
2168ceb42de8SaliguoriEOF
2169ceb42de8Saliguoripreadv=no
217052166aa0SJuan Quintelaif compile_prog "" "" ; then
2171ceb42de8Saliguori  preadv=yes
2172ceb42de8Saliguorifi
2173ceb42de8Saliguori
2174ceb42de8Saliguori##########################################
2175f652e6afSaurel32# fdt probe
21762df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2177b41af4baSJuan Quintela  fdt_libs="-lfdt"
2178f652e6afSaurel32  cat > $TMPC << EOF
2179f652e6afSaurel32int main(void) { return 0; }
2180f652e6afSaurel32EOF
218152166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2182f652e6afSaurel32    fdt=yes
21832df87df7SJuan Quintela  else
21842df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
21852df87df7SJuan Quintela      feature_not_found "fdt"
21862df87df7SJuan Quintela    fi
2187de3a354aSMichael Walle    fdt_libs=
21882df87df7SJuan Quintela    fdt=no
2189f652e6afSaurel32  fi
2190f652e6afSaurel32fi
2191f652e6afSaurel32
219220ff075bSMichael Walle##########################################
219320ff075bSMichael Walle# opengl probe, used by milkymist-tmu2
219420ff075bSMichael Walleif test "$opengl" != "no" ; then
219520ff075bSMichael Walle  opengl_libs="-lGL"
219620ff075bSMichael Walle  cat > $TMPC << EOF
219720ff075bSMichael Walle#include <X11/Xlib.h>
219820ff075bSMichael Walle#include <GL/gl.h>
219920ff075bSMichael Walle#include <GL/glx.h>
220084972cbbSStefan Weilint main(void) { return GL_VERSION != 0; }
220120ff075bSMichael WalleEOF
220220ff075bSMichael Walle  if compile_prog "" "-lGL" ; then
220320ff075bSMichael Walle    opengl=yes
220420ff075bSMichael Walle  else
220520ff075bSMichael Walle    if test "$opengl" = "yes" ; then
220620ff075bSMichael Walle      feature_not_found "opengl"
220720ff075bSMichael Walle    fi
2208de3a354aSMichael Walle    opengl_libs=
220920ff075bSMichael Walle    opengl=no
221020ff075bSMichael Walle  fi
221120ff075bSMichael Wallefi
221220ff075bSMichael Walle
22133b3f24adSaurel32#
22143b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
22153b3f24adSaurel32# emulator.  This is done because older glibc versions don't
22163b3f24adSaurel32# have syscall stubs for these implemented.
22173b3f24adSaurel32#
22183b3f24adSaurel32atfile=no
22193b3f24adSaurel32cat > $TMPC << EOF
22203b3f24adSaurel32#define _ATFILE_SOURCE
22213b3f24adSaurel32#include <sys/types.h>
22223b3f24adSaurel32#include <fcntl.h>
22233b3f24adSaurel32#include <unistd.h>
22243b3f24adSaurel32
22253b3f24adSaurel32int
22263b3f24adSaurel32main(void)
22273b3f24adSaurel32{
22283b3f24adSaurel32	/* try to unlink nonexisting file */
22293b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
22303b3f24adSaurel32}
22313b3f24adSaurel32EOF
223252166aa0SJuan Quintelaif compile_prog "" "" ; then
22333b3f24adSaurel32  atfile=yes
22343b3f24adSaurel32fi
22353b3f24adSaurel32
223639386ac7Saurel32# Check for inotify functions when we are building linux-user
22373b3f24adSaurel32# emulator.  This is done because older glibc versions don't
22383b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
22393b3f24adSaurel32# don't provide them even if kernel supports them.
22403b3f24adSaurel32#
22413b3f24adSaurel32inotify=no
22423b3f24adSaurel32cat > $TMPC << EOF
22433b3f24adSaurel32#include <sys/inotify.h>
22443b3f24adSaurel32
22453b3f24adSaurel32int
22463b3f24adSaurel32main(void)
22473b3f24adSaurel32{
22483b3f24adSaurel32	/* try to start inotify */
22498690e420Saurel32	return inotify_init();
22503b3f24adSaurel32}
22513b3f24adSaurel32EOF
225252166aa0SJuan Quintelaif compile_prog "" "" ; then
22533b3f24adSaurel32  inotify=yes
22543b3f24adSaurel32fi
22553b3f24adSaurel32
2256c05c7a73SRiku Voipioinotify1=no
2257c05c7a73SRiku Voipiocat > $TMPC << EOF
2258c05c7a73SRiku Voipio#include <sys/inotify.h>
2259c05c7a73SRiku Voipio
2260c05c7a73SRiku Voipioint
2261c05c7a73SRiku Voipiomain(void)
2262c05c7a73SRiku Voipio{
2263c05c7a73SRiku Voipio    /* try to start inotify */
2264c05c7a73SRiku Voipio    return inotify_init1(0);
2265c05c7a73SRiku Voipio}
2266c05c7a73SRiku VoipioEOF
2267c05c7a73SRiku Voipioif compile_prog "" "" ; then
2268c05c7a73SRiku Voipio  inotify1=yes
2269c05c7a73SRiku Voipiofi
2270c05c7a73SRiku Voipio
2271ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2272ebc996f3SRiku Voipioutimens=no
2273ebc996f3SRiku Voipiocat > $TMPC << EOF
2274ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2275ebc996f3SRiku Voipio#include <stddef.h>
2276ebc996f3SRiku Voipio#include <fcntl.h>
2277ebc996f3SRiku Voipio
2278ebc996f3SRiku Voipioint main(void)
2279ebc996f3SRiku Voipio{
2280ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2281ebc996f3SRiku Voipio    futimens(0, NULL);
2282ebc996f3SRiku Voipio    return 0;
2283ebc996f3SRiku Voipio}
2284ebc996f3SRiku VoipioEOF
228552166aa0SJuan Quintelaif compile_prog "" "" ; then
2286ebc996f3SRiku Voipio  utimens=yes
2287ebc996f3SRiku Voipiofi
2288ebc996f3SRiku Voipio
2289099d6b0fSRiku Voipio# check if pipe2 is there
2290099d6b0fSRiku Voipiopipe2=no
2291099d6b0fSRiku Voipiocat > $TMPC << EOF
2292099d6b0fSRiku Voipio#include <unistd.h>
2293099d6b0fSRiku Voipio#include <fcntl.h>
2294099d6b0fSRiku Voipio
2295099d6b0fSRiku Voipioint main(void)
2296099d6b0fSRiku Voipio{
2297099d6b0fSRiku Voipio    int pipefd[2];
2298099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
2299099d6b0fSRiku Voipio    return 0;
2300099d6b0fSRiku Voipio}
2301099d6b0fSRiku VoipioEOF
230252166aa0SJuan Quintelaif compile_prog "" "" ; then
2303099d6b0fSRiku Voipio  pipe2=yes
2304099d6b0fSRiku Voipiofi
2305099d6b0fSRiku Voipio
230640ff6d7eSKevin Wolf# check if accept4 is there
230740ff6d7eSKevin Wolfaccept4=no
230840ff6d7eSKevin Wolfcat > $TMPC << EOF
230940ff6d7eSKevin Wolf#include <sys/socket.h>
231040ff6d7eSKevin Wolf#include <stddef.h>
231140ff6d7eSKevin Wolf
231240ff6d7eSKevin Wolfint main(void)
231340ff6d7eSKevin Wolf{
231440ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
231540ff6d7eSKevin Wolf    return 0;
231640ff6d7eSKevin Wolf}
231740ff6d7eSKevin WolfEOF
231840ff6d7eSKevin Wolfif compile_prog "" "" ; then
231940ff6d7eSKevin Wolf  accept4=yes
232040ff6d7eSKevin Wolffi
232140ff6d7eSKevin Wolf
23223ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
23233ce34dfbSvibisreenivasansplice=no
23243ce34dfbSvibisreenivasancat > $TMPC << EOF
23253ce34dfbSvibisreenivasan#include <unistd.h>
23263ce34dfbSvibisreenivasan#include <fcntl.h>
23273ce34dfbSvibisreenivasan#include <limits.h>
23283ce34dfbSvibisreenivasan
23293ce34dfbSvibisreenivasanint main(void)
23303ce34dfbSvibisreenivasan{
233166ea0f22SStefan Weil    int len, fd = 0;
23323ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
23333ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
23343ce34dfbSvibisreenivasan    return 0;
23353ce34dfbSvibisreenivasan}
23363ce34dfbSvibisreenivasanEOF
233752166aa0SJuan Quintelaif compile_prog "" "" ; then
23383ce34dfbSvibisreenivasan  splice=yes
23393ce34dfbSvibisreenivasanfi
23403ce34dfbSvibisreenivasan
2341dcc38d1cSMarcelo Tosatti##########################################
2342dcc38d1cSMarcelo Tosatti# signalfd probe
2343dcc38d1cSMarcelo Tosattisignalfd="no"
2344dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2345dcc38d1cSMarcelo Tosatti#include <unistd.h>
2346dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2347dcc38d1cSMarcelo Tosatti#include <signal.h>
2348dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2349dcc38d1cSMarcelo TosattiEOF
2350dcc38d1cSMarcelo Tosatti
2351dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2352dcc38d1cSMarcelo Tosatti  signalfd=yes
2353dcc38d1cSMarcelo Tosattifi
2354dcc38d1cSMarcelo Tosatti
2355c2882b96SRiku Voipio# check if eventfd is supported
2356c2882b96SRiku Voipioeventfd=no
2357c2882b96SRiku Voipiocat > $TMPC << EOF
2358c2882b96SRiku Voipio#include <sys/eventfd.h>
2359c2882b96SRiku Voipio
2360c2882b96SRiku Voipioint main(void)
2361c2882b96SRiku Voipio{
236255cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2363c2882b96SRiku Voipio}
2364c2882b96SRiku VoipioEOF
2365c2882b96SRiku Voipioif compile_prog "" "" ; then
2366c2882b96SRiku Voipio  eventfd=yes
2367c2882b96SRiku Voipiofi
2368c2882b96SRiku Voipio
2369d0927938SUlrich Hecht# check for fallocate
2370d0927938SUlrich Hechtfallocate=no
2371d0927938SUlrich Hechtcat > $TMPC << EOF
2372d0927938SUlrich Hecht#include <fcntl.h>
2373d0927938SUlrich Hecht
2374d0927938SUlrich Hechtint main(void)
2375d0927938SUlrich Hecht{
2376d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2377d0927938SUlrich Hecht    return 0;
2378d0927938SUlrich Hecht}
2379d0927938SUlrich HechtEOF
23808fb03151SPeter Maydellif compile_prog "" "" ; then
2381d0927938SUlrich Hecht  fallocate=yes
2382d0927938SUlrich Hechtfi
2383d0927938SUlrich Hecht
2384c727f47dSPeter Maydell# check for sync_file_range
2385c727f47dSPeter Maydellsync_file_range=no
2386c727f47dSPeter Maydellcat > $TMPC << EOF
2387c727f47dSPeter Maydell#include <fcntl.h>
2388c727f47dSPeter Maydell
2389c727f47dSPeter Maydellint main(void)
2390c727f47dSPeter Maydell{
2391c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2392c727f47dSPeter Maydell    return 0;
2393c727f47dSPeter Maydell}
2394c727f47dSPeter MaydellEOF
23958fb03151SPeter Maydellif compile_prog "" "" ; then
2396c727f47dSPeter Maydell  sync_file_range=yes
2397c727f47dSPeter Maydellfi
2398c727f47dSPeter Maydell
2399dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2400dace20dcSPeter Maydellfiemap=no
2401dace20dcSPeter Maydellcat > $TMPC << EOF
2402dace20dcSPeter Maydell#include <sys/ioctl.h>
2403dace20dcSPeter Maydell#include <linux/fs.h>
2404dace20dcSPeter Maydell#include <linux/fiemap.h>
2405dace20dcSPeter Maydell
2406dace20dcSPeter Maydellint main(void)
2407dace20dcSPeter Maydell{
2408dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2409dace20dcSPeter Maydell    return 0;
2410dace20dcSPeter Maydell}
2411dace20dcSPeter MaydellEOF
24128fb03151SPeter Maydellif compile_prog "" "" ; then
2413dace20dcSPeter Maydell  fiemap=yes
2414dace20dcSPeter Maydellfi
2415dace20dcSPeter Maydell
2416d0927938SUlrich Hecht# check for dup3
2417d0927938SUlrich Hechtdup3=no
2418d0927938SUlrich Hechtcat > $TMPC << EOF
2419d0927938SUlrich Hecht#include <unistd.h>
2420d0927938SUlrich Hecht
2421d0927938SUlrich Hechtint main(void)
2422d0927938SUlrich Hecht{
2423d0927938SUlrich Hecht    dup3(0, 0, 0);
2424d0927938SUlrich Hecht    return 0;
2425d0927938SUlrich Hecht}
2426d0927938SUlrich HechtEOF
242778f5d726SJan Kiszkaif compile_prog "" "" ; then
2428d0927938SUlrich Hecht  dup3=yes
2429d0927938SUlrich Hechtfi
2430d0927938SUlrich Hecht
24313b6edd16SPeter Maydell# check for epoll support
24323b6edd16SPeter Maydellepoll=no
24333b6edd16SPeter Maydellcat > $TMPC << EOF
24343b6edd16SPeter Maydell#include <sys/epoll.h>
24353b6edd16SPeter Maydell
24363b6edd16SPeter Maydellint main(void)
24373b6edd16SPeter Maydell{
24383b6edd16SPeter Maydell    epoll_create(0);
24393b6edd16SPeter Maydell    return 0;
24403b6edd16SPeter Maydell}
24413b6edd16SPeter MaydellEOF
24428fb03151SPeter Maydellif compile_prog "" "" ; then
24433b6edd16SPeter Maydell  epoll=yes
24443b6edd16SPeter Maydellfi
24453b6edd16SPeter Maydell
24463b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
24473b6edd16SPeter Maydell# so we must check separately for their presence
24483b6edd16SPeter Maydellepoll_create1=no
24493b6edd16SPeter Maydellcat > $TMPC << EOF
24503b6edd16SPeter Maydell#include <sys/epoll.h>
24513b6edd16SPeter Maydell
24523b6edd16SPeter Maydellint main(void)
24533b6edd16SPeter Maydell{
245419e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
245519e83f6bSPeter Maydell     * a function being called. This is necessary so that on
245619e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
245719e83f6bSPeter Maydell     * the library but not declared in the header file we will
245819e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
245919e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
246019e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
246119e83f6bSPeter Maydell     */
246284972cbbSStefan Weil    return epoll_create1 == epoll_create1;
24633b6edd16SPeter Maydell}
24643b6edd16SPeter MaydellEOF
24658fb03151SPeter Maydellif compile_prog "" "" ; then
24663b6edd16SPeter Maydell  epoll_create1=yes
24673b6edd16SPeter Maydellfi
24683b6edd16SPeter Maydell
24693b6edd16SPeter Maydellepoll_pwait=no
24703b6edd16SPeter Maydellcat > $TMPC << EOF
24713b6edd16SPeter Maydell#include <sys/epoll.h>
24723b6edd16SPeter Maydell
24733b6edd16SPeter Maydellint main(void)
24743b6edd16SPeter Maydell{
24753b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
24763b6edd16SPeter Maydell    return 0;
24773b6edd16SPeter Maydell}
24783b6edd16SPeter MaydellEOF
24798fb03151SPeter Maydellif compile_prog "" "" ; then
24803b6edd16SPeter Maydell  epoll_pwait=yes
24813b6edd16SPeter Maydellfi
24823b6edd16SPeter Maydell
2483cc8ae6deSpbrook# Check if tools are available to build documentation.
2484a25dba17SJuan Quintelaif test "$docs" != "no" ; then
248501668d98SStefan Weil  if has makeinfo && has pod2man; then
2486a25dba17SJuan Quintela    docs=yes
248783a3ab8bSJuan Quintela  else
2488a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2489a25dba17SJuan Quintela      feature_not_found "docs"
249083a3ab8bSJuan Quintela    fi
2491a25dba17SJuan Quintela    docs=no
249283a3ab8bSJuan Quintela  fi
2493cc8ae6deSpbrookfi
2494cc8ae6deSpbrook
2495f514f41cSStefan Weil# Search for bswap_32 function
24966ae9a1f4SJuan Quintelabyteswap_h=no
24976ae9a1f4SJuan Quintelacat > $TMPC << EOF
24986ae9a1f4SJuan Quintela#include <byteswap.h>
24996ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
25006ae9a1f4SJuan QuintelaEOF
250152166aa0SJuan Quintelaif compile_prog "" "" ; then
25026ae9a1f4SJuan Quintela  byteswap_h=yes
25036ae9a1f4SJuan Quintelafi
25046ae9a1f4SJuan Quintela
2505f514f41cSStefan Weil# Search for bswap_32 function
25066ae9a1f4SJuan Quintelabswap_h=no
25076ae9a1f4SJuan Quintelacat > $TMPC << EOF
25086ae9a1f4SJuan Quintela#include <sys/endian.h>
25096ae9a1f4SJuan Quintela#include <sys/types.h>
25106ae9a1f4SJuan Quintela#include <machine/bswap.h>
25116ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
25126ae9a1f4SJuan QuintelaEOF
251352166aa0SJuan Quintelaif compile_prog "" "" ; then
25146ae9a1f4SJuan Quintela  bswap_h=yes
25156ae9a1f4SJuan Quintelafi
25166ae9a1f4SJuan Quintela
2517da93a1fdSaliguori##########################################
2518c589b249SRonnie Sahlberg# Do we have libiscsi
2519c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
2520c589b249SRonnie Sahlberg  cat > $TMPC << EOF
2521c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
2522c589b249SRonnie Sahlbergint main(void) { iscsi_create_context(""); return 0; }
2523c589b249SRonnie SahlbergEOF
2524c589b249SRonnie Sahlberg  if compile_prog "-Werror" "-liscsi" ; then
2525c589b249SRonnie Sahlberg    libiscsi="yes"
2526c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
2527c589b249SRonnie Sahlberg  else
2528c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
2529c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
2530c589b249SRonnie Sahlberg    fi
2531c589b249SRonnie Sahlberg    libiscsi="no"
2532c589b249SRonnie Sahlberg  fi
2533c589b249SRonnie Sahlbergfi
2534c589b249SRonnie Sahlberg
2535c589b249SRonnie Sahlberg
2536c589b249SRonnie Sahlberg##########################################
2537da93a1fdSaliguori# Do we need librt
2538da93a1fdSaliguoricat > $TMPC <<EOF
2539da93a1fdSaliguori#include <signal.h>
2540da93a1fdSaliguori#include <time.h>
254166ea0f22SStefan Weilint main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
2542da93a1fdSaliguoriEOF
2543da93a1fdSaliguori
254452166aa0SJuan Quintelaif compile_prog "" "" ; then
254507ffa4bdSJuan Quintela  :
254652166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
254707ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2548da93a1fdSaliguorifi
2549da93a1fdSaliguori
255031ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2551179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
25526362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
25536362a53fSJuan Quintelafi
25546362a53fSJuan Quintela
2555de5071c5SBlue Swirl##########################################
2556cd4ec0b4SGerd Hoffmann# spice probe
2557cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2558cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2559cd4ec0b4SGerd Hoffmann#include <spice.h>
2560cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2561cd4ec0b4SGerd HoffmannEOF
2562710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2563710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
25644295e15aSAlon Levy  if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \
2565cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2566cd4ec0b4SGerd Hoffmann    spice="yes"
2567cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2568cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2569cd4ec0b4SGerd Hoffmann  else
2570cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2571cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2572cd4ec0b4SGerd Hoffmann    fi
2573cd4ec0b4SGerd Hoffmann    spice="no"
2574cd4ec0b4SGerd Hoffmann  fi
2575cd4ec0b4SGerd Hoffmannfi
2576cd4ec0b4SGerd Hoffmann
2577111a38b0SRobert Relyea# check for libcacard for smartcard support
2578111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then
2579111a38b0SRobert Relyea    smartcard="yes"
2580111a38b0SRobert Relyea    smartcard_cflags=""
2581111a38b0SRobert Relyea    # TODO - what's the minimal nss version we support?
2582111a38b0SRobert Relyea    if test "$smartcard_nss" != "no"; then
25835f01e06fSSergei Trofimovich      cat > $TMPC << EOF
25845f01e06fSSergei Trofimovich#include <pk11pub.h>
25855f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
25865f01e06fSSergei TrofimovichEOF
2587111a38b0SRobert Relyea        smartcard_cflags="-I\$(SRC_PATH)/libcacard"
25888c741c22SAlon Levy        libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
25898c741c22SAlon Levy        libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
25905f01e06fSSergei Trofimovich        if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
25915f01e06fSSergei Trofimovich          compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then
25925f01e06fSSergei Trofimovich            smartcard_nss="yes"
2593111a38b0SRobert Relyea            QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2594ad4cf3f6SPaul Brook            libs_softmmu="$libcacard_libs $libs_softmmu"
2595111a38b0SRobert Relyea        else
2596111a38b0SRobert Relyea            if test "$smartcard_nss" = "yes"; then
2597111a38b0SRobert Relyea                feature_not_found "nss"
2598111a38b0SRobert Relyea            fi
2599111a38b0SRobert Relyea            smartcard_nss="no"
2600111a38b0SRobert Relyea        fi
2601111a38b0SRobert Relyea    fi
2602111a38b0SRobert Relyeafi
2603111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then
2604111a38b0SRobert Relyea    smartcard_nss="no"
2605111a38b0SRobert Relyeafi
2606111a38b0SRobert Relyea
260769354a83SHans de Goede# check for usbredirparser for usb network redirection support
260869354a83SHans de Goedeif test "$usb_redir" != "no" ; then
2609097a66efSHans de Goede    if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then
261069354a83SHans de Goede        usb_redir="yes"
261169354a83SHans de Goede        usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
261269354a83SHans de Goede        usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
261369354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
261469354a83SHans de Goede        LIBS="$LIBS $usb_redir_libs"
261569354a83SHans de Goede    else
261669354a83SHans de Goede        if test "$usb_redir" = "yes"; then
261769354a83SHans de Goede            feature_not_found "usb-redir"
261869354a83SHans de Goede        fi
261969354a83SHans de Goede        usb_redir="no"
262069354a83SHans de Goede    fi
262169354a83SHans de Goedefi
262269354a83SHans de Goede
2623cd4ec0b4SGerd Hoffmann##########################################
2624cd4ec0b4SGerd Hoffmann
2625747bbdf7SBlue Swirl##########################################
26265f6b9e8fSBlue Swirl# check if we have fdatasync
26275f6b9e8fSBlue Swirl
26285f6b9e8fSBlue Swirlfdatasync=no
26295f6b9e8fSBlue Swirlcat > $TMPC << EOF
26305f6b9e8fSBlue Swirl#include <unistd.h>
2631d1722a27SAlexandre Raymondint main(void) {
2632d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2633d1722a27SAlexandre Raymondreturn fdatasync(0);
2634d1722a27SAlexandre Raymond#else
2635e172fe11SStefan Weil#error Not supported
2636d1722a27SAlexandre Raymond#endif
2637d1722a27SAlexandre Raymond}
26385f6b9e8fSBlue SwirlEOF
26395f6b9e8fSBlue Swirlif compile_prog "" "" ; then
26405f6b9e8fSBlue Swirl    fdatasync=yes
26415f6b9e8fSBlue Swirlfi
26425f6b9e8fSBlue Swirl
264394a420b1SStefan Hajnoczi##########################################
2644e78815a5SAndreas Färber# check if we have madvise
2645e78815a5SAndreas Färber
2646e78815a5SAndreas Färbermadvise=no
2647e78815a5SAndreas Färbercat > $TMPC << EOF
2648e78815a5SAndreas Färber#include <sys/types.h>
2649e78815a5SAndreas Färber#include <sys/mman.h>
2650832ce9c2SScott Wood#include <stddef.h>
2651e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2652e78815a5SAndreas FärberEOF
2653e78815a5SAndreas Färberif compile_prog "" "" ; then
2654e78815a5SAndreas Färber    madvise=yes
2655e78815a5SAndreas Färberfi
2656e78815a5SAndreas Färber
2657e78815a5SAndreas Färber##########################################
2658e78815a5SAndreas Färber# check if we have posix_madvise
2659e78815a5SAndreas Färber
2660e78815a5SAndreas Färberposix_madvise=no
2661e78815a5SAndreas Färbercat > $TMPC << EOF
2662e78815a5SAndreas Färber#include <sys/mman.h>
2663832ce9c2SScott Wood#include <stddef.h>
2664e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2665e78815a5SAndreas FärberEOF
2666e78815a5SAndreas Färberif compile_prog "" "" ; then
2667e78815a5SAndreas Färber    posix_madvise=yes
2668e78815a5SAndreas Färberfi
2669e78815a5SAndreas Färber
2670e78815a5SAndreas Färber##########################################
267194a420b1SStefan Hajnoczi# check if trace backend exists
267294a420b1SStefan Hajnoczi
2673*650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
267494a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
267594a420b1SStefan Hajnoczi  echo
267694a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
267794a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
267894a420b1SStefan Hajnoczi  echo
267994a420b1SStefan Hajnoczi  exit 1
268094a420b1SStefan Hajnoczifi
268194a420b1SStefan Hajnoczi
26827e24e92aSStefan Hajnoczi##########################################
26837e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
26847e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
26857e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
26867e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
26877e24e92aSStefan Hajnoczi#include <ust/marker.h>
26887e24e92aSStefan Hajnocziint main(void) { return 0; }
26897e24e92aSStefan HajnocziEOF
26907e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
269194b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
2692c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
26937e24e92aSStefan Hajnoczi  else
26947e24e92aSStefan Hajnoczi    echo
26957e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
26967e24e92aSStefan Hajnoczi    echo
26977e24e92aSStefan Hajnoczi    exit 1
26987e24e92aSStefan Hajnoczi  fi
26997e24e92aSStefan Hajnoczifi
2700b3d08c02SDaniel P. Berrange
2701b3d08c02SDaniel P. Berrange##########################################
2702b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
2703b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
2704b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
2705b3d08c02SDaniel P. Berrange    echo
2706b3d08c02SDaniel P. Berrange    echo "Error: dtrace command is not found in PATH $PATH"
2707b3d08c02SDaniel P. Berrange    echo
2708b3d08c02SDaniel P. Berrange    exit 1
2709b3d08c02SDaniel P. Berrange  fi
2710c276b17dSDaniel P. Berrange  trace_backend_stap="no"
2711c276b17dSDaniel P. Berrange  if has 'stap' ; then
2712c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
2713c276b17dSDaniel P. Berrange  fi
2714b3d08c02SDaniel P. Berrangefi
2715b3d08c02SDaniel P. Berrange
27167e24e92aSStefan Hajnoczi##########################################
2717023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2718023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit
2719023367e6SWolfgang Mauerer# specification is necessary
27201ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2721023367e6SWolfgang Mauerer  cat > $TMPC << EOF
2722023367e6SWolfgang Mauererint sfaa(unsigned *ptr)
2723023367e6SWolfgang Mauerer{
2724023367e6SWolfgang Mauerer  return __sync_fetch_and_and(ptr, 0);
2725023367e6SWolfgang Mauerer}
2726023367e6SWolfgang Mauerer
2727023367e6SWolfgang Mauererint main(int argc, char **argv)
2728023367e6SWolfgang Mauerer{
2729023367e6SWolfgang Mauerer  int val = 42;
2730023367e6SWolfgang Mauerer  sfaa(&val);
2731023367e6SWolfgang Mauerer  return val;
2732023367e6SWolfgang Mauerer}
2733023367e6SWolfgang MauererEOF
2734023367e6SWolfgang Mauerer  if ! compile_prog "" "" ; then
2735023367e6SWolfgang Mauerer    CFLAGS+="-march=i486"
2736023367e6SWolfgang Mauerer  fi
2737023367e6SWolfgang Mauererfi
2738023367e6SWolfgang Mauerer
2739023367e6SWolfgang Mauerer##########################################
2740519175a2SAlex Barcelo# check and set a backend for coroutine
2741d0e2fce5SAneesh Kumar K.V
2742519175a2SAlex Barcelo# default is ucontext, but always fallback to gthread
2743519175a2SAlex Barcelo# windows autodetected by make
2744519175a2SAlex Barceloif test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
2745d0e2fce5SAneesh Kumar K.V  if test "$darwin" != "yes"; then
2746d0e2fce5SAneesh Kumar K.V    cat > $TMPC << EOF
2747d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
2748cdf84806SPeter Maydell#ifdef __stub_makecontext
2749cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
2750cdf84806SPeter Maydell#endif
275175cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
2752d0e2fce5SAneesh Kumar K.VEOF
2753d0e2fce5SAneesh Kumar K.V    if compile_prog "" "" ; then
2754519175a2SAlex Barcelo        coroutine_backend=ucontext
2755519175a2SAlex Barcelo    else
2756519175a2SAlex Barcelo	coroutine_backend=gthread
2757d0e2fce5SAneesh Kumar K.V    fi
2758519175a2SAlex Barcelo  else
2759519175a2SAlex Barcelo    echo "Silently falling back into gthread backend under darwin"
2760519175a2SAlex Barcelo  fi
2761519175a2SAlex Barceloelif test "$coroutine" = "gthread" ; then
2762519175a2SAlex Barcelo  coroutine_backend=gthread
2763519175a2SAlex Barceloelif test "$coroutine" = "windows" ; then
2764519175a2SAlex Barcelo  coroutine_backend=windows
2765fe91bfa8SAlex Barceloelif test "$coroutine" = "sigaltstack" ; then
2766fe91bfa8SAlex Barcelo  coroutine_backend=sigaltstack
2767519175a2SAlex Barceloelse
2768519175a2SAlex Barcelo  echo
2769519175a2SAlex Barcelo  echo "Error: unknown coroutine backend $coroutine"
2770519175a2SAlex Barcelo  echo
2771519175a2SAlex Barcelo  exit 1
2772d0e2fce5SAneesh Kumar K.Vfi
2773d0e2fce5SAneesh Kumar K.V
2774d0e2fce5SAneesh Kumar K.V##########################################
2775d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
2776d2042378SAneesh Kumar K.V
2777d2042378SAneesh Kumar K.Vopen_by_hande_at=no
2778d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
2779d2042378SAneesh Kumar K.V#include <fcntl.h>
278075cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
2781d2042378SAneesh Kumar K.VEOF
2782d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
2783d2042378SAneesh Kumar K.V    open_by_handle_at=yes
2784d2042378SAneesh Kumar K.Vfi
2785d2042378SAneesh Kumar K.V
2786e06a765eSHarsh Prateek Bora########################################
2787e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
2788e06a765eSHarsh Prateek Bora
2789e06a765eSHarsh Prateek Boralinux_magic_h=no
2790e06a765eSHarsh Prateek Boracat > $TMPC << EOF
2791e06a765eSHarsh Prateek Bora#include <linux/magic.h>
2792e06a765eSHarsh Prateek Boraint main(void) {
279375cafad7SStefan Weil  return 0;
2794e06a765eSHarsh Prateek Bora}
2795e06a765eSHarsh Prateek BoraEOF
2796e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
2797e06a765eSHarsh Prateek Bora    linux_magic_h=yes
2798e06a765eSHarsh Prateek Borafi
2799e06a765eSHarsh Prateek Bora
2800d2042378SAneesh Kumar K.V##########################################
2801e86ecd4bSJuan Quintela# End of CC checks
2802e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2803e86ecd4bSJuan Quintela
2804e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
28051156c669SJuan Quintela  CFLAGS="-O2 $CFLAGS"
2806e86ecd4bSJuan Quintelafi
2807a316e378SJuan Quintela
2808e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
2809e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
2810e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
281120ff6c80SAnthony Liguori
281220ff6c80SAnthony Liguoriif test -z "$werror" ; then
2813e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
2814e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
2815e86ecd4bSJuan Quintela        werror="yes"
2816e86ecd4bSJuan Quintela    else
2817e86ecd4bSJuan Quintela        werror="no"
2818e86ecd4bSJuan Quintela    fi
2819e86ecd4bSJuan Quintelafi
2820e86ecd4bSJuan Quintela
282120ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
282220ff6c80SAnthony Liguori# enable/disable
282320ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
282420ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
282520ff6c80SAnthony Liguori	zero_malloc="no"
282620ff6c80SAnthony Liguori    else
282720ff6c80SAnthony Liguori	zero_malloc="yes"
282820ff6c80SAnthony Liguori    fi
282920ff6c80SAnthony Liguorifi
283020ff6c80SAnthony Liguori
2831e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
2832a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2833e86ecd4bSJuan Quintelafi
2834e86ecd4bSJuan Quintela
2835e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2836e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
28371156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2838e86ecd4bSJuan Quintela    fi
2839e86ecd4bSJuan Quintelafi
2840e86ecd4bSJuan Quintela
284194dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
284294dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
284394dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
284494dd53c5SGerd Hoffmannelse
284594dd53c5SGerd Hoffmann    POD2MAN="pod2man"
284694dd53c5SGerd Hoffmannfi
284794dd53c5SGerd Hoffmann
2848952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
2849952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
2850952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
2851952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2852952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
2853952afb71SBlue Swirl        fi
2854952afb71SBlue Swirl    done
2855952afb71SBlue Swirlfi
2856952afb71SBlue Swirl
2857190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix
28585a67135aSbellard
2859ca35f780SPaolo Bonzinitools=
2860ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2861ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2862983eef5aSMeador Inge  if test "$virtfs" != no ; then
2863983eef5aSMeador Inge      if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
2864983eef5aSMeador Inge	  virtfs=yes
286517bff52bSM. Mohan Kumar	  tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
2866983eef5aSMeador Inge      else
2867983eef5aSMeador Inge	  if test "$virtfs" = yes; then
2868983eef5aSMeador Inge	      feature_not_found "virtfs"
2869983eef5aSMeador Inge	  fi
2870983eef5aSMeador Inge      fi
287117bff52bSM. Mohan Kumar  fi
2872ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2873ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2874d138cee9SMichael Roth    if [ "$guest_agent" = "yes" ]; then
287548ff7a62SMichael Roth      tools="qemu-ga\$(EXESUF) $tools"
2876d138cee9SMichael Roth    fi
2877ca35f780SPaolo Bonzini  fi
2878ca35f780SPaolo Bonzinifi
2879ca35f780SPaolo Bonzini
2880ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
2881ca35f780SPaolo Bonziniroms=
2882ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2883ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2884ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
2885ca35f780SPaolo Bonzini  roms="optionrom"
2886ca35f780SPaolo Bonzinifi
2887d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
288839ac8455SDavid Gibson  roms="$roms spapr-rtas"
288939ac8455SDavid Gibsonfi
2890ca35f780SPaolo Bonzini
28917d13299dSbellardecho "Install prefix    $prefix"
2892f2b9e1e3SPaolo Bonziniecho "BIOS directory    `eval echo $datadir`"
2893f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
28943aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
28950f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
28961c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
289711d9f695Sbellardif test "$mingw32" = "no" ; then
2898f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
289943ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
290011d9f695Sbellardfi
29015a67135aSbellardecho "Source path       $source_path"
29027d13299dSbellardecho "C compiler        $cc"
290383469015Sbellardecho "Host C compiler   $host_cc"
29040c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
2905a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
29060c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
29077d13299dSbellardecho "make              $make"
29086a882643Spbrookecho "install           $install"
2909c886edfbSBlue Swirlecho "python            $python"
2910e2d8830eSBradif test "$slirp" = "yes" ; then
2911e2d8830eSBrad    echo "smbd              $smbd"
2912e2d8830eSBradfi
2913a98fd896Sbellardecho "host CPU          $cpu"
2914de83cd02Sbellardecho "host big endian   $bigendian"
291597a847bcSbellardecho "target list       $target_list"
2916ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
2917b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
29187d13299dSbellardecho "gprof enabled     $gprof"
291903b4fe7dSaliguoriecho "sparse enabled    $sparse"
29201625af87Saliguoriecho "strip binaries    $strip_opt"
292105c2a3e7Sbellardecho "profiler          $profiler"
292243ce4dfeSbellardecho "static build      $static"
292385aa5189Sbellardecho "-Werror enabled   $werror"
29245b0753e0Sbellardif test "$darwin" = "yes" ; then
29255b0753e0Sbellard    echo "Cocoa support     $cocoa"
29265b0753e0Sbellardfi
292797a847bcSbellardecho "SDL support       $sdl"
29284d3b6f6eSbalrogecho "curses support    $curses"
2929769ce76dSAlexander Grafecho "curl support      $curl"
293067b915a5Sbellardecho "mingw32 support   $mingw32"
29310c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
29320c58ac1cSmalcecho "Extra audio cards $audio_card_list"
2933eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
29348ff9cbf7Smalcecho "Mixer emulation   $mixemu"
2935983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
2936821601eaSJes Sorensenecho "VNC support       $vnc"
2937821601eaSJes Sorensenif test "$vnc" = "yes" ; then
29388d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
29392f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
29402f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
2941efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
2942bd023f95SCorentin Chary    echo "VNC thread        $vnc_thread"
2943821601eaSJes Sorensenfi
29443142255cSblueswir1if test -n "$sparc_cpu"; then
29453142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
29463142255cSblueswir1fi
2947e37630caSaliguoriecho "xen support       $xen"
29482e4d9fb1Saurel32echo "brlapi support    $brlapi"
2949a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
2950a25dba17SJuan Quintelaecho "Documentation     $docs"
2951c5937220Spbrook[ ! -z "$uname_release" ] && \
2952c5937220Spbrookecho "uname -r          $uname_release"
2953bd0c5661Spbrookecho "NPTL support      $nptl"
2954379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
295540d6444eSAvi Kivityecho "PIE               $pie"
29568a16d273Sthsecho "vde support       $vde"
29575c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
2958758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
295977755340Sthsecho "Install blobs     $blobs"
2960b31a0277SJuan Quintelaecho "KVM support       $kvm"
29619195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
2962f652e6afSaurel32echo "fdt support       $fdt"
2963ceb42de8Saliguoriecho "preadv support    $preadv"
29645f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
2965e78815a5SAndreas Färberecho "madvise           $madvise"
2966e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
2967ee682d27SStefan Weilecho "uuid support      $uuid"
296847e98658SCorey Bryantecho "libcap-ng support $cap_ng"
2969d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
297094a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
29719410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
2972cd4ec0b4SGerd Hoffmannecho "spice support     $spice"
2973f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
2974dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
2975111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
297669354a83SHans de Goedeecho "usb net redir     $usb_redir"
297720ff075bSMichael Walleecho "OpenGL support    $opengl"
2978c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
2979d138cee9SMichael Rothecho "build guest agent $guest_agent"
2980519175a2SAlex Barceloecho "coroutine backend $coroutine_backend"
298167b915a5Sbellard
29821ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
298324b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
2984e8cd23deSbellardfi
298597a847bcSbellard
298698ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
29874bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
298897a847bcSbellard
298998ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
299098ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
299198ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
299298ec69acSJuan Quintelaecho >> $config_host_mak
299398ec69acSJuan Quintela
2994e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
299599d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
299699d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
29973aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
29980f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
299999d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
300099d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak
300199d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
300299d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak
30031dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak
30047b93fadfSCorey Bryantecho "libexecdir=\${prefix}/libexec" >> $config_host_mak
3005a7c36ee4SCorey Bryantecho "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
3006a7c36ee4SCorey Bryantecho "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
3007804edf29SJuan Quintela
300898ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3009f8393946Saurel32if test "$debug_tcg" = "yes" ; then
30102358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3011f8393946Saurel32fi
3012b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
3013b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
3014b4475aa2SLuiz Capitulinofi
3015f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
30162358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
3017f3d08ee6SPaul Brookfi
30181625af87Saliguoriif test "$strip_opt" = "yes" ; then
301952ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
30201625af87Saliguorifi
30217d13299dSbellardif test "$bigendian" = "yes" ; then
3022e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
302397a847bcSbellardfi
302467b915a5Sbellardif test "$mingw32" = "yes" ; then
302598ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
30269fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
30279fe6de94SBlue Swirl  version_major=${rc_version%%.*}
30289fe6de94SBlue Swirl  rc_version=${rc_version#*.}
30299fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
30309fe6de94SBlue Swirl  rc_version=${rc_version#*.}
30319fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
30329fe6de94SBlue Swirl  version_micro=0
30339fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
30349fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3035210fa556Spbrookelse
303635f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3037210fa556Spbrookfi
3038128ab2ffSblueswir1
3039dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3040dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3041dffcb71cSMark McLoughlinfi
3042dffcb71cSMark McLoughlin
304383fb7adfSbellardif test "$darwin" = "yes" ; then
304498ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
304583fb7adfSbellardfi
3046b29fe3edSmalc
3047b29fe3edSmalcif test "$aix" = "yes" ; then
304898ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3049b29fe3edSmalcfi
3050b29fe3edSmalc
3051ec530c81Sbellardif test "$solaris" = "yes" ; then
305298ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
30532358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
30540475a5caSths  if test "$needs_libsunmath" = "yes" ; then
305575b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
30560475a5caSths  fi
3057ec530c81Sbellardfi
3058179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3059179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3060179cf400SAndreas Färberfi
306197a847bcSbellardif test "$static" = "yes" ; then
306298ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
306397a847bcSbellardfi
30641ba16968SStefan Weilif test "$profiler" = "yes" ; then
30652358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
306605c2a3e7Sbellardfi
3067c20709aaSbellardif test "$slirp" = "yes" ; then
306898ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3069e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3070f9728943SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
3071c20709aaSbellardfi
30728a16d273Sthsif test "$vde" = "yes" ; then
307398ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
30748a16d273Sthsfi
307547e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
307647e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
307747e98658SCorey Bryantfi
30780c58ac1cSmalcfor card in $audio_card_list; do
3079bb55b712SStefan Weil    def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
308098ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
30810c58ac1cSmalcdone
30822358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
30830c58ac1cSmalcfor drv in $audio_drv_list; do
3084bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
308598ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3086923e4521Smalc    if test "$drv" = "fmod"; then
30877aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3088fb065187Sbellard    fi
30890c58ac1cSmalcdone
309067f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
309167f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
309267f86e8eSJuan Quintelafi
3093d5631638Smalcif test "$audio_win_int" = "yes" ; then
3094d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3095d5631638Smalcfi
3096eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
30978ff9cbf7Smalcif test "$mixemu" = "yes" ; then
309898ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
30998ff9cbf7Smalcfi
3100821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3101821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3102821601eaSJes Sorensenfi
31038d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
310498ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
3105525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
31068d5d2d4cSthsfi
31072f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
310898ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
310960ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
31102f9606b3Saliguorifi
3111821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
31122f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
31132f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
31142f6f5c7aSCorentin Charyfi
3115821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3116efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3117efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3118efe556adSCorentin Charyfi
3119821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then
3120bd023f95SCorentin Chary  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
3121bd023f95SCorentin Charyfi
312276655d6dSaliguoriif test "$fnmatch" = "yes" ; then
31232358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
312476655d6dSaliguorifi
3125ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3126ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3127ee682d27SStefan Weilfi
3128dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3129dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3130dce512deSChristoph Hellwigfi
3131b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
313298ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
31332358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
313498ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
313598ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3136a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
313798ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3138cc8ae6deSpbrookfi
31391ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
314098ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
31418ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
314249ecc3faSbellardfi
314349ecc3faSbellardif test "$cocoa" = "yes" ; then
314498ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
314549ecc3faSbellardfi
31464d3b6f6eSbalrogif test "$curses" = "yes" ; then
314798ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3148ab4e5602SJan Kiszkafi
31493b3f24adSaurel32if test "$atfile" = "yes" ; then
31502358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
31513b3f24adSaurel32fi
3152ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
31532358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3154ebc996f3SRiku Voipiofi
3155099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
31562358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3157099d6b0fSRiku Voipiofi
315840ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
315940ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
316040ff6d7eSKevin Wolffi
31613ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
31622358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
31633ce34dfbSvibisreenivasanfi
3164c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3165c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3166c2882b96SRiku Voipiofi
3167d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3168d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3169d0927938SUlrich Hechtfi
3170c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3171c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3172c727f47dSPeter Maydellfi
3173dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3174dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3175dace20dcSPeter Maydellfi
3176d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3177d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3178d0927938SUlrich Hechtfi
31793b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
31803b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
31813b6edd16SPeter Maydellfi
31823b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
31833b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
31843b6edd16SPeter Maydellfi
31853b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
31863b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
31873b6edd16SPeter Maydellfi
31883b3f24adSaurel32if test "$inotify" = "yes" ; then
31892358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
31903b3f24adSaurel32fi
3191c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
3192c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3193c05c7a73SRiku Voipiofi
31946ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
31956ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
31966ae9a1f4SJuan Quintelafi
31976ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
31986ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
31996ae9a1f4SJuan Quintelafi
3200769ce76dSAlexander Grafif test "$curl" = "yes" ; then
320198ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
3202b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3203769ce76dSAlexander Graffi
32042e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
320598ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
32062e4d9fb1Saurel32fi
3207fb599c9aSbalrogif test "$bluez" = "yes" ; then
320898ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
3209ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3210fb599c9aSbalrogfi
3211e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3212e37630caSaliguoriif test "$xen" = "yes" ; then
32136dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3214d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3215e37630caSaliguorifi
32165c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
32175c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
32185c6c3a6cSChristoph Hellwigfi
3219758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
3220758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
3221758e8e38SVenkateswararao Jujjuri (JV)fi
32224f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
32234f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
32244f26f2b6SAvi Kivityfi
3225983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
3226758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
3227758e8e38SVenkateswararao Jujjuri (JV)fi
322877755340Sthsif test "$blobs" = "yes" ; then
322998ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
323077755340Sthsfi
3231bf9298b9Saliguoriif test "$iovec" = "yes" ; then
32322358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
3233bf9298b9Saliguorifi
3234ceb42de8Saliguoriif test "$preadv" = "yes" ; then
32352358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
3236ceb42de8Saliguorifi
3237f652e6afSaurel32if test "$fdt" = "yes" ; then
32383f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
3239f652e6afSaurel32fi
3240dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
3241dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3242dcc38d1cSMarcelo Tosattifi
32439195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
32449195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
32459195b2c2SStefan Weilfi
32465f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
32475f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
32485f6b9e8fSBlue Swirlfi
3249e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
3250e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
3251e78815a5SAndreas Färberfi
3252e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
3253e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3254e78815a5SAndreas Färberfi
325597a847bcSbellard
3256cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
3257cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
3258cd4ec0b4SGerd Hoffmannfi
3259cd4ec0b4SGerd Hoffmann
326036707144SAlon Levyif test "$smartcard" = "yes" ; then
326136707144SAlon Levy  echo "CONFIG_SMARTCARD=y" >> $config_host_mak
326236707144SAlon Levyfi
326336707144SAlon Levy
3264111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3265111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3266ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3267ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3268111a38b0SRobert Relyeafi
3269111a38b0SRobert Relyea
327069354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
327169354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
327269354a83SHans de Goedefi
327369354a83SHans de Goede
327420ff075bSMichael Walleif test "$opengl" = "yes" ; then
327520ff075bSMichael Walle  echo "CONFIG_OPENGL=y" >> $config_host_mak
327620ff075bSMichael Wallefi
327720ff075bSMichael Walle
3278c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
3279c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3280c589b249SRonnie Sahlbergfi
3281c589b249SRonnie Sahlberg
328283fb7adfSbellard# XXX: suppress that
32837d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
32842358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
32857d3505c5Sbellardfi
32867d3505c5Sbellard
32872358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3288c5937220Spbrook
328920ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
329020ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
329120ff6c80SAnthony Liguorifi
3292f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
3293f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
3294f27aaf4bSChristian Brunnerfi
329520ff6c80SAnthony Liguori
3296519175a2SAlex Barceloif test "$coroutine_backend" = "ucontext" ; then
3297d0e2fce5SAneesh Kumar K.V  echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3298fe91bfa8SAlex Barceloelif test "$coroutine_backend" = "sigaltstack" ; then
3299fe91bfa8SAlex Barcelo  echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
3300d0e2fce5SAneesh Kumar K.Vfi
3301d0e2fce5SAneesh Kumar K.V
3302d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
3303d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3304d2042378SAneesh Kumar K.Vfi
3305d2042378SAneesh Kumar K.V
3306e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
3307e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3308e06a765eSHarsh Prateek Borafi
3309e06a765eSHarsh Prateek Bora
331068063649Sblueswir1# USB host support
331168063649Sblueswir1case "$usb" in
331268063649Sblueswir1linux)
331398ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
331468063649Sblueswir1;;
331568063649Sblueswir1bsd)
331698ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
331768063649Sblueswir1;;
331868063649Sblueswir1*)
331998ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
332068063649Sblueswir1;;
332168063649Sblueswir1esac
332268063649Sblueswir1
3323e4858974SLluís# use default implementation for tracing backend-specific routines
3324e4858974SLluístrace_default=yes
332594a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
33266d8a764eSLluísif test "$trace_backend" = "nop"; then
33276d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
332822890ab5SPrerna Saxenafi
33299410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
33306d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3331e4858974SLluís  trace_default=no
33326d8a764eSLluís  # Set the appropriate trace file.
3333953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
33349410b56cSPrerna Saxenafi
33356d8a764eSLluísif test "$trace_backend" = "stderr"; then
33366d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
33379a82b6a5SLluís  trace_default=no
33386d8a764eSLluísfi
33396d8a764eSLluísif test "$trace_backend" = "ust"; then
33406d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
33416d8a764eSLluísfi
33426d8a764eSLluísif test "$trace_backend" = "dtrace"; then
33436d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
33446d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
33456d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
33466d8a764eSLluís  fi
3347c276b17dSDaniel P. Berrangefi
33489410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3349e4858974SLluísif test "$trace_default" = "yes"; then
3350e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3351e4858974SLluísfi
33529410b56cSPrerna Saxena
335398ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
335498ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
3355804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
3356804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
33571901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
33581901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
33591901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3360c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
3361804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
33622b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
3363804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
3364804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
3365804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
3366804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
33679fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
336844dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
3369e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
3370a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3371f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3372e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
3373e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
3374e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
3375e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3376e39f0062SPaolo Bonzinifi
3377c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3378e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
3379a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3380a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
338173da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
33823e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3383804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
3384957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
338594dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
3386804edf29SJuan Quintela
33874bf6b55bSJuan Quintela# generate list of library paths for linker script
33884bf6b55bSJuan Quintela
33894bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
33904bf6b55bSJuan Quintela
33914bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
33924bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
33934bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
33944bf6b55bSJuan Quintela  else
33954bf6b55bSJuan Quintela    rm ${config_host_ld}~
33964bf6b55bSJuan Quintela  fi
33974bf6b55bSJuan Quintelafi
33984bf6b55bSJuan Quintela
33994d904533SBlue Swirlfor d in libdis libdis-user; do
34004d904533SBlue Swirl    mkdir -p $d
340111568d6dSPaolo Bonzini    symlink $source_path/Makefile.dis $d/Makefile
34024d904533SBlue Swirl    echo > $d/config.mak
34034d904533SBlue Swirldone
34044d904533SBlue Swirl
34056efd7517SPeter Maydell# use included Linux headers
34066efd7517SPeter Maydellif test "$linux" = "yes" ; then
34076efd7517SPeter Maydell  mkdir -p linux-headers
34086efd7517SPeter Maydell  case "$cpu" in
34096efd7517SPeter Maydell  i386|x86_64)
34106efd7517SPeter Maydell    symlink $source_path/linux-headers/asm-x86 linux-headers/asm
34116efd7517SPeter Maydell    ;;
34126efd7517SPeter Maydell  ppcemb|ppc|ppc64)
34136efd7517SPeter Maydell    symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
34146efd7517SPeter Maydell    ;;
34156efd7517SPeter Maydell  s390x)
34166efd7517SPeter Maydell    symlink $source_path/linux-headers/asm-s390 linux-headers/asm
34176efd7517SPeter Maydell    ;;
34186efd7517SPeter Maydell  esac
34196efd7517SPeter Maydellfi
34206efd7517SPeter Maydell
342197a847bcSbellardfor target in $target_list; do
342297a847bcSbellardtarget_dir="$target"
342325be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
3424600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
342597a847bcSbellardtarget_bigendian="no"
34261f3d3c8fSJuan Quintela
3427ea2d6a39SJuan Quintelacase "$target_arch2" in
3428cfa550c6SMax Filippov  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3429ea2d6a39SJuan Quintela  target_bigendian=yes
3430ea2d6a39SJuan Quintela  ;;
3431ea2d6a39SJuan Quintelaesac
343297a847bcSbellardtarget_softmmu="no"
3433997344f3Sbellardtarget_user_only="no"
3434831b7825Sthstarget_linux_user="no"
3435831b7825Sthstarget_darwin_user="no"
343684778508Sblueswir1target_bsd_user="no"
34379e407a85Spbrookcase "$target" in
3438600309b6SBlue Swirl  ${target_arch2}-softmmu)
34399e407a85Spbrook    target_softmmu="yes"
34409e407a85Spbrook    ;;
3441600309b6SBlue Swirl  ${target_arch2}-linux-user)
34429c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
34439c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
34449c7a4202SBlue Swirl      exit 1
34459c7a4202SBlue Swirl    fi
34469e407a85Spbrook    target_user_only="yes"
34479e407a85Spbrook    target_linux_user="yes"
34489e407a85Spbrook    ;;
3449600309b6SBlue Swirl  ${target_arch2}-darwin-user)
34509c7a4202SBlue Swirl    if test "$darwin" != "yes" ; then
34519c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Darwin host"
34529c7a4202SBlue Swirl      exit 1
34539c7a4202SBlue Swirl    fi
34549e407a85Spbrook    target_user_only="yes"
3455831b7825Sths    target_darwin_user="yes"
34569e407a85Spbrook    ;;
3457600309b6SBlue Swirl  ${target_arch2}-bsd-user)
34589cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
34599c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
34609c7a4202SBlue Swirl      exit 1
34619c7a4202SBlue Swirl    fi
346284778508Sblueswir1    target_user_only="yes"
346384778508Sblueswir1    target_bsd_user="yes"
346484778508Sblueswir1    ;;
34659e407a85Spbrook  *)
34669e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
34679e407a85Spbrook    exit 1
34689e407a85Spbrook    ;;
34699e407a85Spbrookesac
3470831b7825Sths
347197a847bcSbellardmkdir -p $target_dir
3472158142c2Sbellardmkdir -p $target_dir/fpu
347357fec1feSbellardmkdir -p $target_dir/tcg
347459f2a787SGerd Hoffmannmkdir -p $target_dir/ide
3475f1ae32a1SGerd Hoffmannmkdir -p $target_dir/usb
3476353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs
34773b9a6ee5SJan Kiszkamkdir -p $target_dir/kvm
347884778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
347969de927cSbellard  mkdir -p $target_dir/nwfpe
348069de927cSbellardfi
348111568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile
3482ec530c81Sbellard
348397a847bcSbellard
348425be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
348597a847bcSbellard
3486e5fe0c52Spbrookbflt="no"
3487bd0c5661Spbrooktarget_nptl="no"
3488600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
348956aebc89Spbrookgdb_xml_files=""
3490c2e3dee6SLaurent Viviertarget_short_alignment=2
3491c2e3dee6SLaurent Viviertarget_int_alignment=4
3492c2e3dee6SLaurent Viviertarget_long_alignment=4
3493c2e3dee6SLaurent Viviertarget_llong_alignment=8
3494de3a354aSMichael Walletarget_libs_softmmu=
34957ba1e619Saliguori
3496938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
34976acff7daSJuan QuintelaTARGET_BASE_ARCH=""
3498e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
3499e73aae67SJuan Quintela
3500600309b6SBlue Swirlcase "$target_arch2" in
35012408a527Saurel32  i386)
350271deff27SAurelien Jarno    target_phys_bits=64
35032408a527Saurel32  ;;
35042408a527Saurel32  x86_64)
35056acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
35061ad2134fSPaul Brook    target_phys_bits=64
3507c2e3dee6SLaurent Vivier    target_long_alignment=8
35082408a527Saurel32  ;;
35092408a527Saurel32  alpha)
35101ad2134fSPaul Brook    target_phys_bits=64
3511c2e3dee6SLaurent Vivier    target_long_alignment=8
3512a4b388ffSRichard Henderson    target_nptl="yes"
35132408a527Saurel32  ;;
35142408a527Saurel32  arm|armeb)
3515b498c8a0SJuan Quintela    TARGET_ARCH=arm
3516e5fe0c52Spbrook    bflt="yes"
3517bd0c5661Spbrook    target_nptl="yes"
351856aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
35191ad2134fSPaul Brook    target_phys_bits=32
3520c2e3dee6SLaurent Vivier    target_llong_alignment=4
3521412beee6SGrant Likely    target_libs_softmmu="$fdt_libs"
35222408a527Saurel32  ;;
35232408a527Saurel32  cris)
3524253bd7f8Sedgar_igl    target_nptl="yes"
35251ad2134fSPaul Brook    target_phys_bits=32
35262408a527Saurel32  ;;
3527613a22c9SMichael Walle  lm32)
3528613a22c9SMichael Walle    target_phys_bits=32
3529de3a354aSMichael Walle    target_libs_softmmu="$opengl_libs"
3530613a22c9SMichael Walle  ;;
35312408a527Saurel32  m68k)
35320938cda5Saurel32    bflt="yes"
353356aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
35341ad2134fSPaul Brook    target_phys_bits=32
3535c2e3dee6SLaurent Vivier    target_int_alignment=2
3536c2e3dee6SLaurent Vivier    target_long_alignment=2
3537c2e3dee6SLaurent Vivier    target_llong_alignment=2
35382408a527Saurel32  ;;
3539877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
3540877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
354172b675caSEdgar E. Iglesias    bflt="yes"
354272b675caSEdgar E. Iglesias    target_nptl="yes"
354372b675caSEdgar E. Iglesias    target_phys_bits=32
3544de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
354572b675caSEdgar E. Iglesias  ;;
35462408a527Saurel32  mips|mipsel)
3547b498c8a0SJuan Quintela    TARGET_ARCH=mips
354825be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3549f04dc72fSPaul Brook    target_nptl="yes"
35501ad2134fSPaul Brook    target_phys_bits=64
35512408a527Saurel32  ;;
35522408a527Saurel32  mipsn32|mipsn32el)
3553b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
35546acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
355525be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
35561ad2134fSPaul Brook    target_phys_bits=64
35572408a527Saurel32  ;;
35582408a527Saurel32  mips64|mips64el)
3559b498c8a0SJuan Quintela    TARGET_ARCH=mips64
35606acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
356125be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
35621ad2134fSPaul Brook    target_phys_bits=64
3563c2e3dee6SLaurent Vivier    target_long_alignment=8
35642408a527Saurel32  ;;
35652408a527Saurel32  ppc)
3566c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
35678b242ebaSAlexander Graf    target_phys_bits=64
3568d6630708SNathan Froyd    target_nptl="yes"
3569de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
35702408a527Saurel32  ;;
35712408a527Saurel32  ppcemb)
35726acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3573e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3574c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
35751ad2134fSPaul Brook    target_phys_bits=64
3576d6630708SNathan Froyd    target_nptl="yes"
3577de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
35782408a527Saurel32  ;;
35792408a527Saurel32  ppc64)
35806acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3581e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3582c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
35831ad2134fSPaul Brook    target_phys_bits=64
3584c2e3dee6SLaurent Vivier    target_long_alignment=8
3585de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
35862408a527Saurel32  ;;
35872408a527Saurel32  ppc64abi32)
3588b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
35896acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3590e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
359125be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
3592c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
35931ad2134fSPaul Brook    target_phys_bits=64
3594de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
35952408a527Saurel32  ;;
35962408a527Saurel32  sh4|sh4eb)
3597b498c8a0SJuan Quintela    TARGET_ARCH=sh4
35984dbed897Spbrook    bflt="yes"
35990b6d3ae0Saurel32    target_nptl="yes"
36001ad2134fSPaul Brook    target_phys_bits=32
36012408a527Saurel32  ;;
36022408a527Saurel32  sparc)
36031ad2134fSPaul Brook    target_phys_bits=64
36042408a527Saurel32  ;;
36052408a527Saurel32  sparc64)
36066acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
36071ad2134fSPaul Brook    target_phys_bits=64
3608c2e3dee6SLaurent Vivier    target_long_alignment=8
36092408a527Saurel32  ;;
36102408a527Saurel32  sparc32plus)
3611b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
36126acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
3613e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
361425be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
36151ad2134fSPaul Brook    target_phys_bits=64
36162408a527Saurel32  ;;
361724e804ecSAlexander Graf  s390x)
3618bc434676SUlrich Hecht    target_nptl="yes"
361924e804ecSAlexander Graf    target_phys_bits=64
36207b3da903SAlexander Graf    target_long_alignment=8
362124e804ecSAlexander Graf  ;;
3622d2fbca94SGuan Xuetao  unicore32)
3623d2fbca94SGuan Xuetao    target_phys_bits=32
3624d2fbca94SGuan Xuetao  ;;
3625cfa550c6SMax Filippov  xtensa|xtensaeb)
3626cfa550c6SMax Filippov    TARGET_ARCH=xtensa
3627cfa550c6SMax Filippov    target_phys_bits=32
3628cfa550c6SMax Filippov  ;;
36292408a527Saurel32  *)
3630de83cd02Sbellard    echo "Unsupported target CPU"
3631de83cd02Sbellard    exit 1
36322408a527Saurel32  ;;
36332408a527Saurel32esac
36340184e266SBlue Swirl
36350184e266SBlue Swirlcase "$target_arch2" in
3636c3082755SRichard Henderson  alpha | sparc*)
36370184e266SBlue Swirl    echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
36380184e266SBlue Swirl  ;;
36390184e266SBlue Swirlesac
36400184e266SBlue Swirl
3641c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3642c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3643c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3644c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
364525be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3646bb55b712SStefan Weiltarget_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
364725be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
364825be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
364942bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
36506acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then
36516acff7daSJuan Quintela  TARGET_BASE_ARCH=$TARGET_ARCH
36526acff7daSJuan Quintelafi
365325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3654e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
3655e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
3656e6e91b9cSJuan Quintelafi
365725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
36581b0c87fcSJuan Quintelacase "$target_arch2" in
36591b0c87fcSJuan Quintela  i386|x86_64)
36601b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
366164b3cfdbSAnthony PERARD      target_phys_bits=64
366225be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
366359d21e53SAlexander Graf    else
366459d21e53SAlexander Graf      echo "CONFIG_NO_XEN=y" >> $config_target_mak
3665432d268cSJun Nakajima    fi
366659d21e53SAlexander Graf    ;;
366759d21e53SAlexander Graf  *)
366859d21e53SAlexander Graf    echo "CONFIG_NO_XEN=y" >> $config_target_mak
36691b0c87fcSJuan Quintelaesac
3670c59249f9SJuan Quintelacase "$target_arch2" in
36710e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
3672c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
3673c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3674c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
3675c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
36765f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
3677adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
3678adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3679c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
3680c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
368125be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
36821ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
3683d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3684d5970055SMichael S. Tsirkin      fi
3685c59249f9SJuan Quintela    fi
3686c59249f9SJuan Quintelaesac
36877f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
36880a6b8ddeSAlexander Graf  echo "CONFIG_PSERIES=y" >> $config_target_mak
36890a6b8ddeSAlexander Graffi
3690de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
369125be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
369297a847bcSbellardfi
369397a847bcSbellardif test "$target_softmmu" = "yes" ; then
3694b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
369525be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3696de3a354aSMichael Walle  echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
36970e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
36985791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3699ad4cf3f6SPaul Brook  if test "$smartcard_nss" = "yes" ; then
3700ad4cf3f6SPaul Brook    echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3701ad4cf3f6SPaul Brook  fi
3702de83cd02Sbellardfi
3703997344f3Sbellardif test "$target_user_only" = "yes" ; then
370425be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3705a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3706997344f3Sbellardfi
3707831b7825Sthsif test "$target_linux_user" = "yes" ; then
370825be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3709831b7825Sthsfi
3710831b7825Sthsif test "$target_darwin_user" = "yes" ; then
371125be210fSJuan Quintela  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3712831b7825Sthsfi
371356aebc89Spbrooklist=""
371456aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
371556aebc89Spbrook  for x in $gdb_xml_files; do
371656aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
371756aebc89Spbrook  done
371825be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
37193d0f1517SJuan Quintelafi
3720de83cd02Sbellard
3721e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
372225be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3723e5fe0c52Spbrookfi
3724bd0c5661Spbrookif test "$target_user_only" = "yes" \
3725bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
372625be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3727bd0c5661Spbrookfi
3728379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
372925be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3730379f6698SPaul Brookfi
373184778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
373225be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
373384778508Sblueswir1fi
37345b0753e0Sbellard
37354afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
3736fa282484SJuan Quintela
37374afddb55SJuan Quintelacflags=""
3738f9728943SPaolo Bonziniincludes=""
3739fa282484SJuan Quintelaldflags=""
37409b8e111fSJuan Quintela
37419195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then
37429195b2c2SStefan Weil  includes="-I\$(SRC_PATH)/tcg/tci $includes"
37439195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then
3744f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
374524e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
3746f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
37475d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
3748f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
374957ddfbf7SJuan Quintelaelse
3750f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
375157ddfbf7SJuan Quintelafi
3752f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
375357ddfbf7SJuan Quintela
37546efd7517SPeter Maydellif test "$linux" = "yes" ; then
37556efd7517SPeter Maydell  includes="-I\$(SRC_PATH)/linux-headers $includes"
37566efd7517SPeter Maydellfi
37576efd7517SPeter Maydell
37584d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
37594d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
37604d904533SBlue Swirlelse
37614d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
37624d904533SBlue Swirlfi
37634d904533SBlue Swirl
376464656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
376564656024SJuan Quintela  case "$i" in
376664656024SJuan Quintela  alpha)
376725be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
37684d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
376964656024SJuan Quintela  ;;
377064656024SJuan Quintela  arm)
377125be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
37724d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
377364656024SJuan Quintela  ;;
377464656024SJuan Quintela  cris)
377525be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
37764d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
377764656024SJuan Quintela  ;;
377864656024SJuan Quintela  hppa)
377925be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
37804d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
378164656024SJuan Quintela  ;;
378264656024SJuan Quintela  i386|x86_64)
378325be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
37844d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
378564656024SJuan Quintela  ;;
3786903ec55cSAurelien Jarno  ia64*)
3787903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
3788903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
3789903ec55cSAurelien Jarno  ;;
379079368f49SMichael Walle  lm32)
379179368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
379279368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $libdis_config_mak
379379368f49SMichael Walle  ;;
379464656024SJuan Quintela  m68k)
379525be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
37964d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
379764656024SJuan Quintela  ;;
3798877fdc12SEdgar E. Iglesias  microblaze*)
379925be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
38004d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
380164656024SJuan Quintela  ;;
380264656024SJuan Quintela  mips*)
380325be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
38044d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
380564656024SJuan Quintela  ;;
380664656024SJuan Quintela  ppc*)
380725be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
38084d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
380964656024SJuan Quintela  ;;
381024e804ecSAlexander Graf  s390*)
381125be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
38124d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
381364656024SJuan Quintela  ;;
381464656024SJuan Quintela  sh4)
381525be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
38164d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
381764656024SJuan Quintela  ;;
381864656024SJuan Quintela  sparc*)
381925be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
38204d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
382164656024SJuan Quintela  ;;
3822cfa550c6SMax Filippov  xtensa*)
3823cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
3824cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $libdis_config_mak
3825cfa550c6SMax Filippov  ;;
382664656024SJuan Quintela  esac
382764656024SJuan Quinteladone
38289195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
38299195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
38309195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $libdis_config_mak
38319195b2c2SStefan Weilfi
383264656024SJuan Quintela
38336ee7126fSJuan Quintelacase "$ARCH" in
38346ee7126fSJuan Quintelaalpha)
38356ee7126fSJuan Quintela  # Ensure there's only a single GP
38366ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
38376ee7126fSJuan Quintela;;
38386ee7126fSJuan Quintelaesac
38396ee7126fSJuan Quintela
384055d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
384155d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
384255d9c04bSJuan Quintela  arm)
384355d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
384455d9c04bSJuan Quintela  ;;
384525a8bb96SMichael Walle  lm32)
384625a8bb96SMichael Walle    cflags="-DHAS_AUDIO $cflags"
384725a8bb96SMichael Walle  ;;
384855d9c04bSJuan Quintela  i386|mips|ppc)
384955d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
385055d9c04bSJuan Quintela  ;;
385155d9c04bSJuan Quintela  esac
385255d9c04bSJuan Quintelafi
385355d9c04bSJuan Quintela
3854471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \
3855471857ddSJuan Quintela        "$TARGET_ARCH" = "microblaze" -o \
3856471857ddSJuan Quintela        "$TARGET_ARCH" = "cris" \) ; then
385725be210fSJuan Quintela  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3858471857ddSJuan Quintelafi
3859471857ddSJuan Quintela
3860d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
386125be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
3862d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
3863d02c1db3SJuan Quintela    cflags="-p $cflags"
3864d02c1db3SJuan Quintela    ldflags="-p $ldflags"
3865d02c1db3SJuan Quintela  fi
3866d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
3867d02c1db3SJuan Quintela    ldflags="-p $ldflags"
386825be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
3869d02c1db3SJuan Quintela  fi
3870d02c1db3SJuan Quintelafi
3871d02c1db3SJuan Quintela
38729195b2c2SStefan Weilif test "$ARCH" = "tci"; then
38739195b2c2SStefan Weil  linker_script=""
38749195b2c2SStefan Weilelse
38756ee7126fSJuan Quintela  linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
38769195b2c2SStefan Weilfi
38779195b2c2SStefan Weil
38789b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3879fa282484SJuan Quintela  case "$ARCH" in
3880fa282484SJuan Quintela  sparc)
3881fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
3882322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
3883fa282484SJuan Quintela    ;;
38844d58be06SRichard Henderson  alpha | s390x)
38854d58be06SRichard Henderson    # The default placement of the application is fine.
38864d58be06SRichard Henderson    ;;
3887fd76e73aSRichard Henderson  *)
3888322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
3889fa282484SJuan Quintela    ;;
3890fa282484SJuan Quintela  esac
3891fa282484SJuan Quintelafi
3892fa282484SJuan Quintela
389325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
389425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3895f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
3896fa282484SJuan Quintela
389797a847bcSbellarddone # for target in $targets
38987d13299dSbellard
3899d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
3900927b241dSMichael WalleDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
3901927b241dSMichael WalleDIRS="$DIRS slirp audio block net pc-bios/optionrom"
3902446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas"
39032d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
3904f1ae32a1SGerd HoffmannDIRS="$DIRS fsdev ui usb"
3905e098fc3fSMichael RothDIRS="$DIRS qapi qapi-generated"
39062f28d2ffSAnthony LiguoriDIRS="$DIRS qga trace qom"
3907c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
3908c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
3909927b241dSMichael WalleFILES="$FILES tests/tcg/lm32/Makefile"
3910ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3911446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
39122d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3913753d11f2SRichard Hendersonfor bios_file in \
3914753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
3915753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
3916753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
3917753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
3918753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
3919753d11f2SRichard Hendersondo
39207ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
39217ea78b74SJan Kiszkadone
3922d1807a4fSPaolo Bonzinimkdir -p $DIRS
39237d13299dSbellardfor f in $FILES ; do
3924f9245e10SPeter Maydell    if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3925f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
3926f9245e10SPeter Maydell    fi
39277d13299dSbellarddone
39281ad2134fSPaul Brook
3929c34ebfdcSAnthony Liguori# temporary config to build submodules
39302d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
3931c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
393237116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
3933c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3934c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
3935c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
3936c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
3937c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
3938c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
3939c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
3940c34ebfdcSAnthony Liguoridone
3941c34ebfdcSAnthony Liguori
39421ad2134fSPaul Brookfor hwlib in 32 64; do
39431ad2134fSPaul Brook  d=libhw$hwlib
39441ad2134fSPaul Brook  mkdir -p $d
39459953b2fcSBlue Swirl  mkdir -p $d/ide
3946f1ae32a1SGerd Hoffmann  mkdir -p $d/usb
394711568d6dSPaolo Bonzini  symlink $source_path/Makefile.hw $d/Makefile
3948353ac78dSAneesh Kumar K.V  mkdir -p $d/9pfs
394937116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
39501ad2134fSPaul Brookdone
3951add16157SBlue Swirl
3952111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then
3953111a38b0SRobert Relyea    # out of tree build
3954111a38b0SRobert Relyea    mkdir -p libcacard
3955111a38b0SRobert Relyea    rm -f libcacard/Makefile
395644dc0ca3SAlon Levy    symlink "$source_path/libcacard/Makefile" libcacard/Makefile
3957111a38b0SRobert Relyeafi
3958111a38b0SRobert Relyea
3959add16157SBlue Swirld=libuser
3960add16157SBlue Swirlmkdir -p $d
3961937b1258SLluís Vilanovamkdir -p $d/trace
3962dd83b06aSAndreas Färbermkdir -p $d/qom
396311568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile
3964b40292e7SJan Kiszka
3965b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
3966b40292e7SJan Kiszka  mkdir -p QMP
3967b40292e7SJan Kiszkafi
3968