xref: /openbmc/qemu/configure (revision eb6fda0f)
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() {
4472b8b5a1SStefan Weil  rm -rf "$2"
45ec5b06d7SAnthony Liguori  mkdir -p "$(dirname "$2")"
4672b8b5a1SStefan Weil  ln -s "$1" "$2"
4711568d6dSPaolo Bonzini}
4811568d6dSPaolo Bonzini
490dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
500dba6195SLoïc Minier# executable or a builtin)
510dba6195SLoïc Minierhas() {
520dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
530dba6195SLoïc Minier}
540dba6195SLoïc Minier
550dba6195SLoïc Minier# search for an executable in PATH
560dba6195SLoïc Minierpath_of() {
570dba6195SLoïc Minier    local_command="$1"
580dba6195SLoïc Minier    local_ifs="$IFS"
590dba6195SLoïc Minier    local_dir=""
600dba6195SLoïc Minier
610dba6195SLoïc Minier    # pathname has a dir component?
620dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
630dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
640dba6195SLoïc Minier            echo "$local_command"
650dba6195SLoïc Minier            return 0
660dba6195SLoïc Minier        fi
670dba6195SLoïc Minier    fi
680dba6195SLoïc Minier    if [ -z "$local_command" ]; then
690dba6195SLoïc Minier        return 1
700dba6195SLoïc Minier    fi
710dba6195SLoïc Minier
720dba6195SLoïc Minier    IFS=:
730dba6195SLoïc Minier    for local_dir in $PATH; do
740dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
750dba6195SLoïc Minier            echo "$local_dir/$local_command"
760dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
770dba6195SLoïc Minier            return 0
780dba6195SLoïc Minier        fi
790dba6195SLoïc Minier    done
800dba6195SLoïc Minier    # not found
810dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
820dba6195SLoïc Minier    return 1
830dba6195SLoïc Minier}
840dba6195SLoïc Minier
857d13299dSbellard# default parameters
86ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"`
872ff6b91eSJuan Quintelacpu=""
881e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
8943ce4dfeSbellardstatic="no"
90ed968ff1SJuan Quintelasparc_cpu=""
917d13299dSbellardcross_prefix=""
920c58ac1cSmalcaudio_drv_list=""
93d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda"
94d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
95eb852011SMarkus Armbrusterblock_drv_whitelist=""
967d13299dSbellardhost_cc="gcc"
97c81da56eSJuan Quintelahelper_cflags=""
9873da375eSJuan Quintelalibs_softmmu=""
993e2e0e6bSJuan Quintelalibs_tools=""
10067f86e8eSJuan Quintelaaudio_pt_int=""
101d5631638Smalcaudio_win_int=""
1022b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc
103957f1f99SMichael Rothlibs_qga=""
1045bc62e01SGerd Hoffmanndebug_info="yes"
105ac0df51dSaliguori
106377529c0SPaolo Bonzinitarget_list=""
107377529c0SPaolo Bonzini
108377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
109377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
110377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
111377529c0SPaolo Bonzini#              unless --disable-foo is given
112377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
113377529c0SPaolo Bonzini#              feature will searched for,
114377529c0SPaolo Bonzini#              if not found, configure exits with error
115377529c0SPaolo Bonzini#
116377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
117377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
118377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
119377529c0SPaolo Bonzini
120377529c0SPaolo Bonzinibluez=""
121377529c0SPaolo Bonzinibrlapi=""
122377529c0SPaolo Bonzinicurl=""
123377529c0SPaolo Bonzinicurses=""
124377529c0SPaolo Bonzinidocs=""
125377529c0SPaolo Bonzinifdt=""
126377529c0SPaolo Bonzininptl=""
127377529c0SPaolo Bonzinisdl=""
128983eef5aSMeador Ingevirtfs=""
129821601eaSJes Sorensenvnc="yes"
130377529c0SPaolo Bonzinisparse="no"
131377529c0SPaolo Bonziniuuid=""
132377529c0SPaolo Bonzinivde=""
133377529c0SPaolo Bonzinivnc_tls=""
134377529c0SPaolo Bonzinivnc_sasl=""
135377529c0SPaolo Bonzinivnc_jpeg=""
136377529c0SPaolo Bonzinivnc_png=""
137377529c0SPaolo Bonzinivnc_thread="no"
138377529c0SPaolo Bonzinixen=""
139d5b93ddfSAnthony PERARDxen_ctrl_version=""
140*eb6fda0fSAnthony PERARDxen_pci_passthrough=""
141377529c0SPaolo Bonzinilinux_aio=""
14247e98658SCorey Bryantcap_ng=""
143377529c0SPaolo Bonziniattr=""
1444f26f2b6SAvi Kivitylibattr=""
145377529c0SPaolo Bonzinixfs=""
146377529c0SPaolo Bonzini
147d41a75a2SBradvhost_net="no"
148d41a75a2SBradkvm="no"
149377529c0SPaolo Bonzinigprof="no"
150377529c0SPaolo Bonzinidebug_tcg="no"
151377529c0SPaolo Bonzinidebug_mon="no"
152377529c0SPaolo Bonzinidebug="no"
153377529c0SPaolo Bonzinistrip_opt="yes"
1549195b2c2SStefan Weiltcg_interpreter="no"
155377529c0SPaolo Bonzinibigendian="no"
156377529c0SPaolo Bonzinimingw32="no"
157377529c0SPaolo BonziniEXESUF=""
158377529c0SPaolo Bonziniprefix="/usr/local"
159377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
160528ae5b8SEduardo Habkostdatadir="\${prefix}/share"
161850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu"
162377529c0SPaolo Bonzinibindir="\${prefix}/bin"
1633aa5d2beSAlon Levylibdir="\${prefix}/lib"
1640f94d6daSAlon Levyincludedir="\${prefix}/include"
165377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
166377529c0SPaolo Bonziniconfsuffix="/qemu"
167377529c0SPaolo Bonzinislirp="yes"
168377529c0SPaolo Bonzinifmod_lib=""
169377529c0SPaolo Bonzinifmod_inc=""
170377529c0SPaolo Bonzinioss_lib=""
171377529c0SPaolo Bonzinibsd="no"
172377529c0SPaolo Bonzinilinux="no"
173377529c0SPaolo Bonzinisolaris="no"
174377529c0SPaolo Bonziniprofiler="no"
175377529c0SPaolo Bonzinicocoa="no"
176377529c0SPaolo Bonzinisoftmmu="yes"
177377529c0SPaolo Bonzinilinux_user="no"
178377529c0SPaolo Bonzinibsd_user="no"
179377529c0SPaolo Bonziniguest_base=""
180377529c0SPaolo Bonziniuname_release=""
181377529c0SPaolo Bonzinimixemu="no"
182377529c0SPaolo Bonziniaix="no"
183377529c0SPaolo Bonziniblobs="yes"
184377529c0SPaolo Bonzinipkgversion=""
18540d6444eSAvi Kivitypie=""
186377529c0SPaolo Bonzinizero_malloc=""
187377529c0SPaolo Bonzinitrace_backend="nop"
188377529c0SPaolo Bonzinitrace_file="trace"
189377529c0SPaolo Bonzinispice=""
190377529c0SPaolo Bonzinirbd=""
19136707144SAlon Levysmartcard=""
192111a38b0SRobert Relyeasmartcard_nss=""
19369354a83SHans de Goedeusb_redir=""
194430a3c18SMichael Walleopengl=""
1951ece9905SAlon Levyzlib="yes"
196d138cee9SMichael Rothguest_agent="yes"
197c589b249SRonnie Sahlberglibiscsi=""
198519175a2SAlex Barcelocoroutine=""
199377529c0SPaolo Bonzini
200ac0df51dSaliguori# parse CC options first
201ac0df51dSaliguorifor opt do
202ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
203ac0df51dSaliguori  case "$opt" in
204ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
205ac0df51dSaliguori  ;;
2063d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
207ac0df51dSaliguori  ;;
208ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
209ca4deeb1SPaolo Bonzini  ;;
2102ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2112ff6b91eSJuan Quintela  ;;
212a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
213e2a2ed06SJuan Quintela  ;;
214e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
215e2a2ed06SJuan Quintela  ;;
2165bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2175bc62e01SGerd Hoffmann  ;;
2185bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2195bc62e01SGerd Hoffmann  ;;
22050e7b1a0SJuan Quintela  --sparc_cpu=*)
22150e7b1a0SJuan Quintela    sparc_cpu="$optarg"
22250e7b1a0SJuan Quintela    case $sparc_cpu in
223ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
22450e7b1a0SJuan Quintela      cpu="sparc"
22550e7b1a0SJuan Quintela    ;;
22650e7b1a0SJuan Quintela    v9)
22750e7b1a0SJuan Quintela      cpu="sparc64"
22850e7b1a0SJuan Quintela    ;;
22950e7b1a0SJuan Quintela    *)
23050e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
23150e7b1a0SJuan Quintela      exit 1
23250e7b1a0SJuan Quintela    ;;
23350e7b1a0SJuan Quintela    esac
23450e7b1a0SJuan Quintela  ;;
235ac0df51dSaliguori  esac
236ac0df51dSaliguoridone
237ac0df51dSaliguori# OS specific
238ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
23993148aa5SStefan Weil# we can eliminate its usage altogether.
240ac0df51dSaliguori
241b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}"
242b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
243b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
244b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
2453f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
246b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
247b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
24817884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
24917884d7bSSergei Trofimovichquery_pkg_config() {
25017884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
25117884d7bSSergei Trofimovich}
25217884d7bSSergei Trofimovichpkg_config=query_pkg_config
253b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
254ac0df51dSaliguori
255be17dc90SMichael S. Tsirkin# default flags for all hosts
256be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
257f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
258be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
259be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $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
427fd677642Sths  cocoa="yes"
4280c58ac1cSmalc  audio_drv_list="coreaudio"
429c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4300c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4317973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
43283fb7adfSbellard;;
433ec530c81SbellardSunOS)
434ec530c81Sbellard  solaris="yes"
4350db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4360db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
437fa58948dSBlue Swirl  ld="gld"
438e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
4390475a5caSths  needs_libsunmath="no"
440c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
441ef18c883Sths  # have to select again, because `uname -m` returns i86pc
442ef18c883Sths  # even on an x86_64 box.
443ef18c883Sths  solariscpu=`isainfo -k`
444ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
445ef18c883Sths    cpu="x86_64"
446ef18c883Sths  fi
447c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4480475a5caSths    if test "$solarisrev" -le 9 ; then
4490475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4500475a5caSths        needs_libsunmath="yes"
451f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
452f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
453f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4540475a5caSths      else
4550475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4560475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4570475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4580475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4590475a5caSths        exit 1
4600475a5caSths      fi
4610475a5caSths    fi
46286b2bd93Sths  fi
4636b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4640c58ac1cSmalc    audio_drv_list="oss"
4656b4d2ba1Sths  fi
466c2de5c91Smalc  audio_possible_drivers="oss sdl"
467d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
468d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
469d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
470d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
471a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
472560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
473560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
474560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
475ec530c81Sbellard;;
476b29fe3edSmalcAIX)
477b29fe3edSmalc  aix="yes"
4780db4a067SPaolo Bonzini  make="${MAKE-gmake}"
479b29fe3edSmalc;;
480179cf400SAndreas FärberHaiku)
481179cf400SAndreas Färber  haiku="yes"
482179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
483179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
484179cf400SAndreas Färber;;
485fb065187Sbellard*)
4860c58ac1cSmalc  audio_drv_list="oss"
487b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4885327cf48Sbellard  linux="yes"
489831b7825Sths  linux_user="yes"
49068063649Sblueswir1  usb="linux"
491af2be207SJan Kiszka  kvm="yes"
492af2be207SJan Kiszka  vhost_net="yes"
49307f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
494c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
495c9ec1fe4Sbellard  fi
496fb065187Sbellard;;
4977d13299dSbellardesac
4987d13299dSbellard
4997d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
500b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
50168063649Sblueswir1    usb="bsd"
50284778508Sblueswir1    bsd_user="yes"
5037d3505c5Sbellard  fi
50408de3949SAndreas Färberfi
5057d3505c5Sbellard
5060db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5070db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
508c886edfbSBlue Swirl: ${python=${PYTHON-python}}
509e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5100db4a067SPaolo Bonzini
5113457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
5123457a3f8SJuan Quintela  EXESUF=".exe"
513a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
514e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
515e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
516f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
517f7cf5d5bSStefan Weilcat > $TMPC << EOF
518f7cf5d5bSStefan Weilint main(void) { return 0; }
519f7cf5d5bSStefan WeilEOF
520f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
521f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
522f7cf5d5bSStefan Weil  fi
523c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
524683035deSPaolo Bonzini  mandir="\${prefix}"
525528ae5b8SEduardo Habkost  datadir="\${prefix}"
526850da188SEduardo Habkost  qemu_docdir="\${prefix}"
527683035deSPaolo Bonzini  bindir="\${prefix}"
528683035deSPaolo Bonzini  sysconfdir="\${prefix}"
529683035deSPaolo Bonzini  confsuffix=""
530368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
5313457a3f8SJuan Quintelafi
5323457a3f8SJuan Quintela
533487fefdbSAnthony Liguoriwerror=""
53485aa5189Sbellard
5357d13299dSbellardfor opt do
536a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
5377d13299dSbellard  case "$opt" in
5382efc3265Sbellard  --help|-h) show_help=yes
5392efc3265Sbellard  ;;
54099123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
54199123e13SMike Frysinger  ;;
542b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5437d13299dSbellard  ;;
544b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
54532ce6337Sbellard  ;;
546ca4deeb1SPaolo Bonzini  --source-path=*)
5477d13299dSbellard  ;;
548ac0df51dSaliguori  --cross-prefix=*)
5497d13299dSbellard  ;;
550ac0df51dSaliguori  --cc=*)
5517d13299dSbellard  ;;
552b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
55383469015Sbellard  ;;
554b1a550a0Spbrook  --make=*) make="$optarg"
5557d13299dSbellard  ;;
5566a882643Spbrook  --install=*) install="$optarg"
5576a882643Spbrook  ;;
558c886edfbSBlue Swirl  --python=*) python="$optarg"
559c886edfbSBlue Swirl  ;;
560e2d8830eSBrad  --smbd=*) smbd="$optarg"
561e2d8830eSBrad  ;;
562e2a2ed06SJuan Quintela  --extra-cflags=*)
5637d13299dSbellard  ;;
564e2a2ed06SJuan Quintela  --extra-ldflags=*)
5657d13299dSbellard  ;;
5665bc62e01SGerd Hoffmann  --enable-debug-info)
5675bc62e01SGerd Hoffmann  ;;
5685bc62e01SGerd Hoffmann  --disable-debug-info)
5695bc62e01SGerd Hoffmann  ;;
5702ff6b91eSJuan Quintela  --cpu=*)
5717d13299dSbellard  ;;
572b1a550a0Spbrook  --target-list=*) target_list="$optarg"
573de83cd02Sbellard  ;;
57474242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
57594a420b1SStefan Hajnoczi  ;;
57674242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
5779410b56cSPrerna Saxena  ;;
5787d13299dSbellard  --enable-gprof) gprof="yes"
5797d13299dSbellard  ;;
58079427693SLoïc Minier  --static)
58179427693SLoïc Minier    static="yes"
58279427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
58317884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
58443ce4dfeSbellard  ;;
5850b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5860b24e75fSPaolo Bonzini  ;;
5870b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5880b24e75fSPaolo Bonzini  ;;
5893aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
5903aa5d2beSAlon Levy  ;;
5910f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
5920f94d6daSAlon Levy  ;;
593528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
5940b24e75fSPaolo Bonzini  ;;
595023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
596023d3d67SEduardo Habkost  ;;
597850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
5980b24e75fSPaolo Bonzini  ;;
599ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
60007381cc1SAnthony Liguori  ;;
601023ddd74SMax Filippov  --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
602023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
603023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
604023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
605023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
606023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
607023ddd74SMax Filippov    # lots of directory switches by default.
608023ddd74SMax Filippov  ;;
60997a847bcSbellard  --disable-sdl) sdl="no"
61097a847bcSbellard  ;;
611c4198157SJuan Quintela  --enable-sdl) sdl="yes"
612c4198157SJuan Quintela  ;;
613983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
614983eef5aSMeador Inge  ;;
615983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
616983eef5aSMeador Inge  ;;
617821601eaSJes Sorensen  --disable-vnc) vnc="no"
618821601eaSJes Sorensen  ;;
619821601eaSJes Sorensen  --enable-vnc) vnc="yes"
620821601eaSJes Sorensen  ;;
621b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
622102a52e4Sbellard  ;;
623c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
624c2de5c91Smalc  ;;
6252f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
6262f6a1ab0Sblueswir1  ;;
6272fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
6280c58ac1cSmalc  ;;
6290c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
6300c58ac1cSmalc  ;;
631eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
632eb852011SMarkus Armbruster  ;;
633f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
634f8393946Saurel32  ;;
635f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
636f8393946Saurel32  ;;
637b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
638b4475aa2SLuiz Capitulino  ;;
639b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
640b4475aa2SLuiz Capitulino  ;;
641f3d08ee6SPaul Brook  --enable-debug)
642f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
643f3d08ee6SPaul Brook      debug_tcg="yes"
644b4475aa2SLuiz Capitulino      debug_mon="yes"
645f3d08ee6SPaul Brook      debug="yes"
646f3d08ee6SPaul Brook      strip_opt="no"
647f3d08ee6SPaul Brook  ;;
64803b4fe7dSaliguori  --enable-sparse) sparse="yes"
64903b4fe7dSaliguori  ;;
65003b4fe7dSaliguori  --disable-sparse) sparse="no"
65103b4fe7dSaliguori  ;;
6521625af87Saliguori  --disable-strip) strip_opt="no"
6531625af87Saliguori  ;;
6548d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
6558d5d2d4cSths  ;;
6561be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
6571be10ad2SJuan Quintela  ;;
6582f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
6592f9606b3Saliguori  ;;
660ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
661ea784e3bSJuan Quintela  ;;
6622f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
6632f6f5c7aSCorentin Chary  ;;
6642f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
6652f6f5c7aSCorentin Chary  ;;
666efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
667efe556adSCorentin Chary  ;;
668efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
669efe556adSCorentin Chary  ;;
670bd023f95SCorentin Chary  --disable-vnc-thread) vnc_thread="no"
671bd023f95SCorentin Chary  ;;
672bd023f95SCorentin Chary  --enable-vnc-thread) vnc_thread="yes"
673bd023f95SCorentin Chary  ;;
674443f1376Sbellard  --disable-slirp) slirp="no"
675c20709aaSbellard  ;;
676ee682d27SStefan Weil  --disable-uuid) uuid="no"
677ee682d27SStefan Weil  ;;
678ee682d27SStefan Weil  --enable-uuid) uuid="yes"
679ee682d27SStefan Weil  ;;
680e0e6c8c0Saliguori  --disable-vde) vde="no"
6818a16d273Sths  ;;
682dfb278bdSJuan Quintela  --enable-vde) vde="yes"
683dfb278bdSJuan Quintela  ;;
684e37630caSaliguori  --disable-xen) xen="no"
685e37630caSaliguori  ;;
686fc321b4bSJuan Quintela  --enable-xen) xen="yes"
687fc321b4bSJuan Quintela  ;;
688*eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
689*eb6fda0fSAnthony PERARD  ;;
690*eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
691*eb6fda0fSAnthony PERARD  ;;
6922e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6932e4d9fb1Saurel32  ;;
6944ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6954ffcedb6SJuan Quintela  ;;
696fb599c9aSbalrog  --disable-bluez) bluez="no"
697fb599c9aSbalrog  ;;
698a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
699a20a6f46SJuan Quintela  ;;
7007ba1e619Saliguori  --disable-kvm) kvm="no"
7017ba1e619Saliguori  ;;
702b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
703b31a0277SJuan Quintela  ;;
7049195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
7059195b2c2SStefan Weil  ;;
7069195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
7079195b2c2SStefan Weil  ;;
70847e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
70947e98658SCorey Bryant  ;;
71047e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
71147e98658SCorey Bryant  ;;
712cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
713cd4ec0b4SGerd Hoffmann  ;;
714cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
715cd4ec0b4SGerd Hoffmann  ;;
716c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
717c589b249SRonnie Sahlberg  ;;
718c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
719c589b249SRonnie Sahlberg  ;;
72005c2a3e7Sbellard  --enable-profiler) profiler="yes"
72105c2a3e7Sbellard  ;;
72214821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
72314821030SPavel Borzenkov  ;;
724c2de5c91Smalc  --enable-cocoa)
725c2de5c91Smalc      cocoa="yes" ;
726c2de5c91Smalc      sdl="no" ;
727c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
7285b0753e0Sbellard  ;;
729cad25d69Spbrook  --disable-system) softmmu="no"
7300a8e90f4Spbrook  ;;
731cad25d69Spbrook  --enable-system) softmmu="yes"
7320a8e90f4Spbrook  ;;
7330953a80fSZachary Amsden  --disable-user)
7340953a80fSZachary Amsden      linux_user="no" ;
7350953a80fSZachary Amsden      bsd_user="no" ;
7360953a80fSZachary Amsden  ;;
7370953a80fSZachary Amsden  --enable-user) ;;
738831b7825Sths  --disable-linux-user) linux_user="no"
7390a8e90f4Spbrook  ;;
740831b7825Sths  --enable-linux-user) linux_user="yes"
741831b7825Sths  ;;
74284778508Sblueswir1  --disable-bsd-user) bsd_user="no"
74384778508Sblueswir1  ;;
74484778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
74584778508Sblueswir1  ;;
746379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
747379f6698SPaul Brook  ;;
748379f6698SPaul Brook  --disable-guest-base) guest_base="no"
749379f6698SPaul Brook  ;;
75040d6444eSAvi Kivity  --enable-pie) pie="yes"
75134005a00SKirill A. Shutemov  ;;
75240d6444eSAvi Kivity  --disable-pie) pie="no"
75334005a00SKirill A. Shutemov  ;;
754c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
755c5937220Spbrook  ;;
7563142255cSblueswir1  --sparc_cpu=*)
7573142255cSblueswir1  ;;
75885aa5189Sbellard  --enable-werror) werror="yes"
75985aa5189Sbellard  ;;
76085aa5189Sbellard  --disable-werror) werror="no"
76185aa5189Sbellard  ;;
7624d3b6f6eSbalrog  --disable-curses) curses="no"
7634d3b6f6eSbalrog  ;;
764c584a6d0SJuan Quintela  --enable-curses) curses="yes"
765c584a6d0SJuan Quintela  ;;
766769ce76dSAlexander Graf  --disable-curl) curl="no"
767769ce76dSAlexander Graf  ;;
768788c8196SJuan Quintela  --enable-curl) curl="yes"
769788c8196SJuan Quintela  ;;
7702df87df7SJuan Quintela  --disable-fdt) fdt="no"
7712df87df7SJuan Quintela  ;;
7722df87df7SJuan Quintela  --enable-fdt) fdt="yes"
7732df87df7SJuan Quintela  ;;
774bd0c5661Spbrook  --disable-nptl) nptl="no"
775bd0c5661Spbrook  ;;
776b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
777b0a47e79SJuan Quintela  ;;
7788ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
7798ff9cbf7Smalc  ;;
7805c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
7815c6c3a6cSChristoph Hellwig  ;;
7825c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
7835c6c3a6cSChristoph Hellwig  ;;
784758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
785758e8e38SVenkateswararao Jujjuri (JV)  ;;
786758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
787758e8e38SVenkateswararao Jujjuri (JV)  ;;
78877755340Sths  --disable-blobs) blobs="no"
78977755340Sths  ;;
7904a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
7914a19f1ecSpbrook  ;;
792519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
793519175a2SAlex Barcelo  ;;
794a25dba17SJuan Quintela  --disable-docs) docs="no"
79570ec5dc0SAnthony Liguori  ;;
796a25dba17SJuan Quintela  --enable-docs) docs="yes"
79783a3ab8bSJuan Quintela  ;;
798d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
799d5970055SMichael S. Tsirkin  ;;
800d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
801d5970055SMichael S. Tsirkin  ;;
80220ff075bSMichael Walle  --disable-opengl) opengl="no"
80320ff075bSMichael Walle  ;;
80420ff075bSMichael Walle  --enable-opengl) opengl="yes"
80520ff075bSMichael Walle  ;;
806f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
807f27aaf4bSChristian Brunner  ;;
808f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
809f27aaf4bSChristian Brunner  ;;
8108c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
8118c84cf11SSergei Trofimovich  ;;
8128c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
8138c84cf11SSergei Trofimovich  ;;
81436707144SAlon Levy  --disable-smartcard) smartcard="no"
81536707144SAlon Levy  ;;
81636707144SAlon Levy  --enable-smartcard) smartcard="yes"
81736707144SAlon Levy  ;;
818111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
819111a38b0SRobert Relyea  ;;
820111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
821111a38b0SRobert Relyea  ;;
82269354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
82369354a83SHans de Goede  ;;
82469354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
82569354a83SHans de Goede  ;;
8261ece9905SAlon Levy  --disable-zlib-test) zlib="no"
8271ece9905SAlon Levy  ;;
828d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
829d138cee9SMichael Roth  ;;
830d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
831d138cee9SMichael Roth  ;;
8327f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
8337f1559c6Sbalrog  ;;
8347d13299dSbellard  esac
8357d13299dSbellarddone
8367d13299dSbellard
8373142255cSblueswir1#
8383142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
839a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
8403142255cSblueswir1#
841379f6698SPaul Brookhost_guest_base="no"
84240293e58Sbellardcase "$cpu" in
843ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
844ed968ff1SJuan Quintela           v7|v8)
845a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
846ed968ff1SJuan Quintela           ;;
847ed968ff1SJuan Quintela           v8plus|v8plusa)
848a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
849ed968ff1SJuan Quintela           ;;
850ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
851a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
852ed968ff1SJuan Quintela           esac
8530c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
854a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
855762e8230Sblueswir1           if test "$solaris" = "no" ; then
856a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
857c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
858762e8230Sblueswir1           fi
8593142255cSblueswir1           ;;
860ed968ff1SJuan Quintela    sparc64)
861a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
8620c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
863a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
864ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
865a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
866762e8230Sblueswir1           fi
8673142255cSblueswir1           ;;
86876d83bdeSths    s390)
86928d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
87028d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
87148bb3750SRichard Henderson           host_guest_base="yes"
87228d7cc49SRichard Henderson           ;;
87328d7cc49SRichard Henderson    s390x)
87428d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
87528d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
87648bb3750SRichard Henderson           host_guest_base="yes"
87776d83bdeSths           ;;
87840293e58Sbellard    i386)
879a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
8800c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
8812b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
882c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
883379f6698SPaul Brook           host_guest_base="yes"
88440293e58Sbellard           ;;
88540293e58Sbellard    x86_64)
886a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
8870c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
8882b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
889379f6698SPaul Brook           host_guest_base="yes"
890379f6698SPaul Brook           ;;
891379f6698SPaul Brook    arm*)
892379f6698SPaul Brook           host_guest_base="yes"
89340293e58Sbellard           ;;
894f6548c0aSmalc    ppc*)
895f6548c0aSmalc           host_guest_base="yes"
896f6548c0aSmalc           ;;
897cc01cc8eSAurelien Jarno    mips*)
898cc01cc8eSAurelien Jarno           host_guest_base="yes"
899cc01cc8eSAurelien Jarno           ;;
900477ba620SAurelien Jarno    ia64*)
901477ba620SAurelien Jarno           host_guest_base="yes"
902477ba620SAurelien Jarno           ;;
903fd76e73aSRichard Henderson    hppa*)
904fd76e73aSRichard Henderson           host_guest_base="yes"
905fd76e73aSRichard Henderson           ;;
906d2fbca94SGuan Xuetao    unicore32*)
907d2fbca94SGuan Xuetao           host_guest_base="yes"
908d2fbca94SGuan Xuetao           ;;
9093142255cSblueswir1esac
9103142255cSblueswir1
911379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
912379f6698SPaul Brook
91360e0df25SPeter Maydell
91460e0df25SPeter Maydelldefault_target_list=""
91560e0df25SPeter Maydell
91660e0df25SPeter Maydell# these targets are portable
91760e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then
91860e0df25SPeter Maydell    default_target_list="\
91960e0df25SPeter Maydelli386-softmmu \
92060e0df25SPeter Maydellx86_64-softmmu \
92127cdad67SRichard Hendersonalpha-softmmu \
92260e0df25SPeter Maydellarm-softmmu \
92360e0df25SPeter Maydellcris-softmmu \
92460e0df25SPeter Maydelllm32-softmmu \
92560e0df25SPeter Maydellm68k-softmmu \
92660e0df25SPeter Maydellmicroblaze-softmmu \
92760e0df25SPeter Maydellmicroblazeel-softmmu \
92860e0df25SPeter Maydellmips-softmmu \
92960e0df25SPeter Maydellmipsel-softmmu \
93060e0df25SPeter Maydellmips64-softmmu \
93160e0df25SPeter Maydellmips64el-softmmu \
93260e0df25SPeter Maydellppc-softmmu \
93360e0df25SPeter Maydellppcemb-softmmu \
93460e0df25SPeter Maydellppc64-softmmu \
93560e0df25SPeter Maydellsh4-softmmu \
93660e0df25SPeter Maydellsh4eb-softmmu \
93760e0df25SPeter Maydellsparc-softmmu \
93860e0df25SPeter Maydellsparc64-softmmu \
9390f3301d4SAlexander Grafs390x-softmmu \
940cfa550c6SMax Filippovxtensa-softmmu \
941cfa550c6SMax Filippovxtensaeb-softmmu \
94260e0df25SPeter Maydell"
94360e0df25SPeter Maydellfi
94460e0df25SPeter Maydell# the following are Linux specific
94560e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then
94660e0df25SPeter Maydell    default_target_list="${default_target_list}\
94760e0df25SPeter Maydelli386-linux-user \
94860e0df25SPeter Maydellx86_64-linux-user \
94960e0df25SPeter Maydellalpha-linux-user \
95060e0df25SPeter Maydellarm-linux-user \
95160e0df25SPeter Maydellarmeb-linux-user \
95260e0df25SPeter Maydellcris-linux-user \
95360e0df25SPeter Maydellm68k-linux-user \
95460e0df25SPeter Maydellmicroblaze-linux-user \
95560e0df25SPeter Maydellmicroblazeel-linux-user \
95660e0df25SPeter Maydellmips-linux-user \
95760e0df25SPeter Maydellmipsel-linux-user \
95860e0df25SPeter Maydellppc-linux-user \
95960e0df25SPeter Maydellppc64-linux-user \
96060e0df25SPeter Maydellppc64abi32-linux-user \
96160e0df25SPeter Maydellsh4-linux-user \
96260e0df25SPeter Maydellsh4eb-linux-user \
96360e0df25SPeter Maydellsparc-linux-user \
96460e0df25SPeter Maydellsparc64-linux-user \
96560e0df25SPeter Maydellsparc32plus-linux-user \
96660e0df25SPeter Maydellunicore32-linux-user \
9670f3301d4SAlexander Grafs390x-linux-user \
96860e0df25SPeter Maydell"
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"
1010023d3d67SEduardo Habkostecho "  --datadir=PATH           install firmware in PATH$confsuffix"
1011023d3d67SEduardo Habkostecho "  --docdir=PATH            install documentation in PATH$confsuffix"
10120b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
1013023d3d67SEduardo Habkostecho "  --sysconfdir=PATH        install config in PATH$confsuffix"
10142ae4748fSStefan Weilecho "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1015f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1016f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
101709695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1018890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1019890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
10201625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
102185aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1022fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1023c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1024983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1025983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1026821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1027821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
102814821030SPavel Borzenkovecho "  --disable-cocoa          disable Cocoa (Mac OS X only)"
102914821030SPavel Borzenkovecho "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
1030c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1031c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
10324c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
10334c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
1034eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
1035eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
10368ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
1037e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1038fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
1039*eb6fda0fSAnthony PERARDecho "  --disable-xen-pci-passthrough"
1040*eb6fda0fSAnthony PERARDecho "  --enable-xen-pci-passthrough"
10412e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
10424ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
10438d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
10441be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
10452f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1046ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
10472f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
10482f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
104996763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1050efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
1051bd023f95SCorentin Charyecho "  --disable-vnc-thread     disable threaded VNC server"
1052bd023f95SCorentin Charyecho "  --enable-vnc-thread      enable threaded VNC server"
1053af896aaaSpbrookecho "  --disable-curses         disable curses output"
1054c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1055769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1056788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
10572df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
10582df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1059fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1060a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
10616093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
10627ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1063b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
10649195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1065bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
1066e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
1067af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1068af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
10690953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
10700953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1071831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1072831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
107384778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
107484778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1075379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1076379f6698SPaul Brookecho "                           emulation targets"
1077379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
107840d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
107940d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1080af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1081af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
10822f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1083c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1084235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
10853142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1086ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1087ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1088e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1089dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
10905c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
10915c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
109247e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
109347e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1094758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1095758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
109677755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1097d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1098d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1099d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1100d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1101320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1102650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
110374242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
11049410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1105cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1106cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1107f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1108c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1109c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
111036707144SAlon Levyecho "  --disable-smartcard      disable smartcard support"
111136707144SAlon Levyecho "  --enable-smartcard       enable smartcard support"
1112111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1113111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
111469354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
111569354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1116d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1117d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1118519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1119fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
1120af5db58eSpbrookecho ""
11215bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1122af5db58eSpbrookexit 1
1123af5db58eSpbrookfi
1124af5db58eSpbrook
1125359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1126359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1127359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1128359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1129359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1130359bc95dSPeter Maydell        ARCH=tci
1131359bc95dSPeter Maydell    else
1132359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1133359bc95dSPeter Maydell        exit 1
1134359bc95dSPeter Maydell    fi
1135359bc95dSPeter Maydellfi
1136359bc95dSPeter Maydell
11378d05095cSPaolo Bonzini# check that the C compiler works.
11388d05095cSPaolo Bonzinicat > $TMPC <<EOF
113975cafad7SStefan Weilint main(void) { return 0; }
11408d05095cSPaolo BonziniEOF
11418d05095cSPaolo Bonzini
11428d05095cSPaolo Bonziniif compile_object ; then
11438d05095cSPaolo Bonzini  : C compiler works ok
11448d05095cSPaolo Bonzinielse
11458d05095cSPaolo Bonzini    echo "ERROR: \"$cc\" either does not exist or does not work"
11468d05095cSPaolo Bonzini    exit 1
11478d05095cSPaolo Bonzinifi
11488d05095cSPaolo Bonzini
11498d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
11508d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
11518d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1152f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
11538d05095cSPaolo Bonzinicat > $TMPC << EOF
11548d05095cSPaolo Bonziniint main(void) { return 0; }
11558d05095cSPaolo BonziniEOF
11568d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1157bd947d30SStefan Weil    if compile_prog "-Werror $flag" "" ; then
11588d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
11598d05095cSPaolo Bonzini    fi
11608d05095cSPaolo Bonzinidone
11618d05095cSPaolo Bonzini
116240d6444eSAvi Kivityif test "$static" = "yes" ; then
116340d6444eSAvi Kivity  if test "$pie" = "yes" ; then
116440d6444eSAvi Kivity    echo "static and pie are mutually incompatible"
116540d6444eSAvi Kivity    exit 1
116640d6444eSAvi Kivity  else
116740d6444eSAvi Kivity    pie="no"
116840d6444eSAvi Kivity  fi
116940d6444eSAvi Kivityfi
117040d6444eSAvi Kivity
117140d6444eSAvi Kivityif test "$pie" = ""; then
117240d6444eSAvi Kivity  case "$cpu-$targetos" in
1173f9db31a2SBrad    i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
117440d6444eSAvi Kivity      ;;
117540d6444eSAvi Kivity    *)
117640d6444eSAvi Kivity      pie="no"
117740d6444eSAvi Kivity      ;;
117840d6444eSAvi Kivity  esac
117940d6444eSAvi Kivityfi
118040d6444eSAvi Kivity
118140d6444eSAvi Kivityif test "$pie" != "no" ; then
118240d6444eSAvi Kivity  cat > $TMPC << EOF
118321d4a791SAvi Kivity
118421d4a791SAvi Kivity#ifdef __linux__
118521d4a791SAvi Kivity#  define THREAD __thread
118621d4a791SAvi Kivity#else
118721d4a791SAvi Kivity#  define THREAD
118821d4a791SAvi Kivity#endif
118921d4a791SAvi Kivity
119021d4a791SAvi Kivitystatic THREAD int tls_var;
119121d4a791SAvi Kivity
119221d4a791SAvi Kivityint main(void) { return tls_var; }
119321d4a791SAvi Kivity
119440d6444eSAvi KivityEOF
119540d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
119640d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
119740d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
119840d6444eSAvi Kivity    pie="yes"
119940d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
120040d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
120140d6444eSAvi Kivity    fi
120240d6444eSAvi Kivity  else
120340d6444eSAvi Kivity    if test "$pie" = "yes"; then
120440d6444eSAvi Kivity      echo "PIE not available due to missing toolchain support"
120540d6444eSAvi Kivity      exit 1
120640d6444eSAvi Kivity    else
120740d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
120840d6444eSAvi Kivity      pie="no"
120940d6444eSAvi Kivity    fi
121040d6444eSAvi Kivity  fi
121140d6444eSAvi Kivityfi
121240d6444eSAvi Kivity
1213ec530c81Sbellard#
1214ec530c81Sbellard# Solaris specific configure tool chain decisions
1215ec530c81Sbellard#
1216ec530c81Sbellardif test "$solaris" = "yes" ; then
12176792aa11SLoïc Minier  if has $install; then
12186792aa11SLoïc Minier    :
12196792aa11SLoïc Minier  else
1220ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1221ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1222ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1223ec530c81Sbellard    exit 1
1224ec530c81Sbellard  fi
12256792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
1226ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1227ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1228ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1229ec530c81Sbellard    exit 1
1230ec530c81Sbellard  fi
12316792aa11SLoïc Minier  if has ar; then
12326792aa11SLoïc Minier    :
12336792aa11SLoïc Minier  else
1234ec530c81Sbellard    echo "Error: No path includes ar"
1235ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
1236ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
1237ec530c81Sbellard    fi
1238ec530c81Sbellard    exit 1
1239ec530c81Sbellard  fi
1240ec530c81Sbellardfi
1241ec530c81Sbellard
12427a3fc891SSebastian Herbsztif ! has $python; then
1243c886edfbSBlue Swirl  echo "Python not found. Use --python=/path/to/python"
1244c886edfbSBlue Swirl  exit 1
1245c886edfbSBlue Swirlfi
1246c886edfbSBlue Swirl
12476ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
12486ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
1249e120d449SStefan Hajnocziif ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1250e120d449SStefan Hajnoczi  echo "Cannot use '$python', Python 2.4 or later is required."
1251e120d449SStefan Hajnoczi  echo "Note that Python 3 or later is not yet supported."
1252e120d449SStefan Hajnoczi  echo "Use --python=/path/to/python to specify a supported Python."
12536ccea1e4SPeter Maydell  exit 1
12546ccea1e4SPeter Maydellfi
12556ccea1e4SPeter Maydell
12565327cf48Sbellardif test -z "$target_list" ; then
125760e0df25SPeter Maydell    target_list="$default_target_list"
12586e20a45fSbellardelse
1259b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
12605327cf48Sbellardfi
12610a8e90f4Spbrookif test -z "$target_list" ; then
12620a8e90f4Spbrook    echo "No targets enabled"
12630a8e90f4Spbrook    exit 1
12640a8e90f4Spbrookfi
1265f55fe278SPaolo Bonzini# see if system emulation was really requested
1266f55fe278SPaolo Bonzinicase " $target_list " in
1267f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1268f55fe278SPaolo Bonzini  ;;
1269f55fe278SPaolo Bonzini  *) softmmu=no
1270f55fe278SPaolo Bonzini  ;;
1271f55fe278SPaolo Bonziniesac
12725327cf48Sbellard
1273249247c9SJuan Quintelafeature_not_found() {
1274249247c9SJuan Quintela  feature=$1
1275249247c9SJuan Quintela
1276249247c9SJuan Quintela  echo "ERROR"
1277249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
12789332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1279249247c9SJuan Quintela  echo "ERROR"
1280249247c9SJuan Quintela  exit 1;
1281249247c9SJuan Quintela}
1282249247c9SJuan Quintela
12837d13299dSbellardif test -z "$cross_prefix" ; then
12847d13299dSbellard
12857d13299dSbellard# ---
12867d13299dSbellard# big/little endian test
12877d13299dSbellardcat > $TMPC << EOF
12887d13299dSbellard#include <inttypes.h>
12897d13299dSbellardint main(int argc, char ** argv){
12907d13299dSbellard        volatile uint32_t i=0x01234567;
12917d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
12927d13299dSbellard}
12937d13299dSbellardEOF
12947d13299dSbellard
129552166aa0SJuan Quintelaif compile_prog "" "" ; then
12967d13299dSbellard$TMPE && bigendian="yes"
12977d13299dSbellardelse
12987d13299dSbellardecho big/little test failed
12997d13299dSbellardfi
13007d13299dSbellard
13017d13299dSbellardelse
13027d13299dSbellard
13037d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1304ea8f20f8SJuan Quintelacase "$cpu" in
130521d89f84SPeter Maydell  arm)
130621d89f84SPeter Maydell    # ARM can be either way; ask the compiler which one we are
130721d89f84SPeter Maydell    if check_define __ARMEB__; then
130821d89f84SPeter Maydell      bigendian=yes
130921d89f84SPeter Maydell    fi
131021d89f84SPeter Maydell  ;;
131121d89f84SPeter Maydell  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1312ea8f20f8SJuan Quintela    bigendian=yes
1313ea8f20f8SJuan Quintela  ;;
1314ea8f20f8SJuan Quintelaesac
13157d13299dSbellard
13167d13299dSbellardfi
13177d13299dSbellard
1318b0a47e79SJuan Quintela##########################################
1319b0a47e79SJuan Quintela# NPTL probe
1320b0a47e79SJuan Quintela
1321b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1322bd0c5661Spbrook  cat > $TMPC <<EOF
1323bd0c5661Spbrook#include <sched.h>
132430813ceaSpbrook#include <linux/futex.h>
1325182eacc0SStefan Weilint main(void) {
1326bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1327bd0c5661Spbrook#error bork
1328bd0c5661Spbrook#endif
1329182eacc0SStefan Weil  return 0;
1330bd0c5661Spbrook}
1331bd0c5661SpbrookEOF
1332bd0c5661Spbrook
133352166aa0SJuan Quintela  if compile_object ; then
1334b0a47e79SJuan Quintela    nptl=yes
1335bd0c5661Spbrook  else
1336b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1337b0a47e79SJuan Quintela      feature_not_found "nptl"
1338b0a47e79SJuan Quintela    fi
1339b0a47e79SJuan Quintela    nptl=no
1340b0a47e79SJuan Quintela  fi
1341bd0c5661Spbrookfi
1342bd0c5661Spbrook
134311d9f695Sbellard##########################################
1344ac62922eSbalrog# zlib check
1345ac62922eSbalrog
13461ece9905SAlon Levyif test "$zlib" != "no" ; then
1347ac62922eSbalrog    cat > $TMPC << EOF
1348ac62922eSbalrog#include <zlib.h>
1349ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1350ac62922eSbalrogEOF
135152166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1352ac62922eSbalrog        :
1353ac62922eSbalrog    else
1354ac62922eSbalrog        echo
1355ac62922eSbalrog        echo "Error: zlib check failed"
1356ac62922eSbalrog        echo "Make sure to have the zlib libs and headers installed."
1357ac62922eSbalrog        echo
1358ac62922eSbalrog        exit 1
1359ac62922eSbalrog    fi
13601ece9905SAlon Levyfi
1361ac62922eSbalrog
1362ac62922eSbalrog##########################################
1363e37630caSaliguori# xen probe
1364e37630caSaliguori
1365fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1366b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1367d5b93ddfSAnthony PERARD
136850ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
136950ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
137050ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
137150ced5b3SStefan Weil
137250ced5b3SStefan Weil  # Xen (any)
137350ced5b3SStefan Weil  cat > $TMPC <<EOF
137450ced5b3SStefan Weil#include <xenctrl.h>
137550ced5b3SStefan Weil#include <xs.h>
137650ced5b3SStefan Weilint main(void) {
137750ced5b3SStefan Weil  return 0;
137850ced5b3SStefan Weil}
137950ced5b3SStefan WeilEOF
138050ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
138150ced5b3SStefan Weil    # Xen not found
138250ced5b3SStefan Weil    if test "$xen" = "yes" ; then
138350ced5b3SStefan Weil      feature_not_found "xen"
138450ced5b3SStefan Weil    fi
138550ced5b3SStefan Weil    xen=no
138650ced5b3SStefan Weil
1387d5b93ddfSAnthony PERARD  # Xen unstable
138850ced5b3SStefan Weil  elif (
1389e37630caSaliguori      cat > $TMPC <<EOF
1390e37630caSaliguori#include <xenctrl.h>
1391e37630caSaliguori#include <xs.h>
1392d5b93ddfSAnthony PERARD#include <stdint.h>
1393d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1394d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1395d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1396d5b93ddfSAnthony PERARD#endif
1397d5b93ddfSAnthony PERARDint main(void) {
1398d5b93ddfSAnthony PERARD  xc_interface *xc;
1399d5b93ddfSAnthony PERARD  xs_daemon_open();
1400d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1401d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1402d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1403b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
14048688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
14058688e065SStefano Stabellini  return 0;
14068688e065SStefano Stabellini}
14078688e065SStefano StabelliniEOF
14088688e065SStefano Stabellini      compile_prog "" "$xen_libs"
14098688e065SStefano Stabellini    ) ; then
14108688e065SStefano Stabellini    xen_ctrl_version=420
14118688e065SStefano Stabellini    xen=yes
14128688e065SStefano Stabellini
14138688e065SStefano Stabellini  elif (
14148688e065SStefano Stabellini      cat > $TMPC <<EOF
14158688e065SStefano Stabellini#include <xenctrl.h>
14168688e065SStefano Stabellini#include <xs.h>
14178688e065SStefano Stabellini#include <stdint.h>
14188688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
14198688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
14208688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
14218688e065SStefano Stabellini#endif
14228688e065SStefano Stabelliniint main(void) {
14238688e065SStefano Stabellini  xc_interface *xc;
14248688e065SStefano Stabellini  xs_daemon_open();
14258688e065SStefano Stabellini  xc = xc_interface_open(0, 0, 0);
14268688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
14278688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
14288688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1429d5b93ddfSAnthony PERARD  return 0;
1430d5b93ddfSAnthony PERARD}
1431e37630caSaliguoriEOF
143250ced5b3SStefan Weil      compile_prog "" "$xen_libs"
143350ced5b3SStefan Weil    ) ; then
1434d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1435fc321b4bSJuan Quintela    xen=yes
1436d5b93ddfSAnthony PERARD
1437d5b93ddfSAnthony PERARD  # Xen 4.0.0
1438d5b93ddfSAnthony PERARD  elif (
1439d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1440d5b93ddfSAnthony PERARD#include <xenctrl.h>
1441d5b93ddfSAnthony PERARD#include <xs.h>
1442d5b93ddfSAnthony PERARD#include <stdint.h>
1443d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1444d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1445d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1446d5b93ddfSAnthony PERARD#endif
1447d5b93ddfSAnthony PERARDint main(void) {
1448b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1449b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1450b87de24eSAnthony PERARD  };
1451d5b93ddfSAnthony PERARD  xs_daemon_open();
1452d5b93ddfSAnthony PERARD  xc_interface_open();
1453d5b93ddfSAnthony PERARD  xc_gnttab_open();
1454d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1455b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1456d5b93ddfSAnthony PERARD  return 0;
1457d5b93ddfSAnthony PERARD}
1458d5b93ddfSAnthony PERARDEOF
1459d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1460d5b93ddfSAnthony PERARD    ) ; then
1461d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1462d5b93ddfSAnthony PERARD    xen=yes
1463d5b93ddfSAnthony PERARD
1464b87de24eSAnthony PERARD  # Xen 3.4.0
1465b87de24eSAnthony PERARD  elif (
1466b87de24eSAnthony PERARD      cat > $TMPC <<EOF
1467b87de24eSAnthony PERARD#include <xenctrl.h>
1468b87de24eSAnthony PERARD#include <xs.h>
1469b87de24eSAnthony PERARDint main(void) {
1470b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1471b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1472b87de24eSAnthony PERARD  };
1473b87de24eSAnthony PERARD  xs_daemon_open();
1474b87de24eSAnthony PERARD  xc_interface_open();
1475b87de24eSAnthony PERARD  xc_gnttab_open();
1476b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1477b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1478b87de24eSAnthony PERARD  return 0;
1479b87de24eSAnthony PERARD}
1480b87de24eSAnthony PERARDEOF
1481b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
1482b87de24eSAnthony PERARD    ) ; then
1483b87de24eSAnthony PERARD    xen_ctrl_version=340
1484b87de24eSAnthony PERARD    xen=yes
1485b87de24eSAnthony PERARD
1486b87de24eSAnthony PERARD  # Xen 3.3.0
1487d5b93ddfSAnthony PERARD  elif (
1488d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1489d5b93ddfSAnthony PERARD#include <xenctrl.h>
1490d5b93ddfSAnthony PERARD#include <xs.h>
1491d5b93ddfSAnthony PERARDint main(void) {
1492d5b93ddfSAnthony PERARD  xs_daemon_open();
1493d5b93ddfSAnthony PERARD  xc_interface_open();
1494d5b93ddfSAnthony PERARD  xc_gnttab_open();
1495d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1496d5b93ddfSAnthony PERARD  return 0;
1497d5b93ddfSAnthony PERARD}
1498d5b93ddfSAnthony PERARDEOF
1499d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1500d5b93ddfSAnthony PERARD    ) ; then
1501d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1502d5b93ddfSAnthony PERARD    xen=yes
1503d5b93ddfSAnthony PERARD
150450ced5b3SStefan Weil  # Xen version unsupported
1505e37630caSaliguori  else
1506fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
150750ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1508fc321b4bSJuan Quintela    fi
1509fc321b4bSJuan Quintela    xen=no
1510e37630caSaliguori  fi
1511d5b93ddfSAnthony PERARD
1512d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1513d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1514d5b93ddfSAnthony PERARD  fi
1515e37630caSaliguorifi
1516e37630caSaliguori
1517*eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1518*eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1519*eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1520*eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1521*eb6fda0fSAnthony PERARD  else
1522*eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1523*eb6fda0fSAnthony PERARD      echo "ERROR"
1524*eb6fda0fSAnthony PERARD      echo "ERROR: User requested feature Xen PCI Passthrough"
1525*eb6fda0fSAnthony PERARD      echo "ERROR: but this feature require /sys from Linux"
1526*eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
1527*eb6fda0fSAnthony PERARD        echo "ERROR: This feature does not work with Xen 3.3"
1528*eb6fda0fSAnthony PERARD      fi
1529*eb6fda0fSAnthony PERARD      echo "ERROR"
1530*eb6fda0fSAnthony PERARD      exit 1;
1531*eb6fda0fSAnthony PERARD    fi
1532*eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1533*eb6fda0fSAnthony PERARD  fi
1534*eb6fda0fSAnthony PERARDfi
1535*eb6fda0fSAnthony PERARD
1536e37630caSaliguori##########################################
1537a8bd70adSPaolo Bonzini# pkg-config probe
1538f91672e5SPaolo Bonzini
153917884d7bSSergei Trofimovichif ! has "$pkg_config_exe"; then
154017884d7bSSergei Trofimovich  echo "Error: pkg-config binary '$pkg_config_exe' not found"
1541a213fcb2SPeter Maydell  exit 1
1542f91672e5SPaolo Bonzinifi
1543f91672e5SPaolo Bonzini
1544f91672e5SPaolo Bonzini##########################################
154544dc0ca3SAlon Levy# libtool probe
154644dc0ca3SAlon Levy
15473f534581SBradif ! has $libtool; then
154844dc0ca3SAlon Levy    libtool=
154944dc0ca3SAlon Levyfi
155044dc0ca3SAlon Levy
155144dc0ca3SAlon Levy##########################################
1552dfffc653SJuan Quintela# Sparse probe
1553dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
15540dba6195SLoïc Minier  if has cgcc; then
1555dfffc653SJuan Quintela    sparse=yes
1556dfffc653SJuan Quintela  else
1557dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1558dfffc653SJuan Quintela      feature_not_found "sparse"
1559dfffc653SJuan Quintela    fi
1560dfffc653SJuan Quintela    sparse=no
1561dfffc653SJuan Quintela  fi
1562dfffc653SJuan Quintelafi
1563dfffc653SJuan Quintela
1564dfffc653SJuan Quintela##########################################
156511d9f695Sbellard# SDL probe
156611d9f695Sbellard
15673ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
15683ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
15693ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
15703ec87ffeSPaolo Bonzini  sdl_config=sdl-config
15713ec87ffeSPaolo Bonzinifi
15723ec87ffeSPaolo Bonzini
15733ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1574a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1575fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
15763ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
15773ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
15789316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1579a0dfd8a4SLoïc Minierelse
1580a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1581a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1582a0dfd8a4SLoïc Minier  fi
1583a0dfd8a4SLoïc Minier  sdl=no
15849316f803SPaolo Bonzinifi
158529e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
15863ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
15873ec87ffeSPaolo Bonzinifi
158811d9f695Sbellard
15899316f803SPaolo Bonzinisdl_too_old=no
1590c4198157SJuan Quintelaif test "$sdl" != "no" ; then
159111d9f695Sbellard  cat > $TMPC << EOF
159211d9f695Sbellard#include <SDL.h>
159311d9f695Sbellard#undef main /* We don't want SDL to override our main() */
159411d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
159511d9f695SbellardEOF
15969316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
159774f42e18STeLeMan  if test "$static" = "yes" ; then
159874f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
159974f42e18STeLeMan  else
16009316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
160174f42e18STeLeMan  fi
160252166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
160311d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
160411d9f695Sbellard      sdl_too_old=yes
160511d9f695Sbellard    else
1606fd677642Sths      if test "$cocoa" = "no" ; then
160711d9f695Sbellard        sdl=yes
160811d9f695Sbellard      fi
1609fd677642Sths    fi
16107c1f25b4Sbellard
161167c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
16121ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
161367c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1614f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1615f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
161611d9f695Sbellard      fi
161752166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
16181ac88f28SJuan Quintela	:
16191ac88f28SJuan Quintela      else
16201ac88f28SJuan Quintela        sdl=no
16217c1f25b4Sbellard      fi
16227c1f25b4Sbellard    fi # static link
1623c4198157SJuan Quintela  else # sdl not found
1624c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1625c4198157SJuan Quintela      feature_not_found "sdl"
1626c4198157SJuan Quintela    fi
1627c4198157SJuan Quintela    sdl=no
16287c1f25b4Sbellard  fi # sdl compile test
1629fd677642Sthsfi
163011d9f695Sbellard
16315368a422Saliguoriif test "$sdl" = "yes" ; then
16325368a422Saliguori  cat > $TMPC <<EOF
16335368a422Saliguori#include <SDL.h>
16345368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
16355368a422Saliguori#include <X11/XKBlib.h>
16365368a422Saliguori#else
16375368a422Saliguori#error No x11 support
16385368a422Saliguori#endif
16395368a422Saliguoriint main(void) { return 0; }
16405368a422SaliguoriEOF
164152166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1642681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
16435368a422Saliguori  fi
16440705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
16455368a422Saliguorifi
16465368a422Saliguori
16478f28f3fbSths##########################################
16488d5d2d4cSths# VNC TLS detection
1649821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1650ae6b5e5aSaliguori  cat > $TMPC <<EOF
1651ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1652ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1653ae6b5e5aSaliguoriEOF
1654a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1655a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
165652166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
16571be10ad2SJuan Quintela    vnc_tls=yes
1658a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1659ae6b5e5aSaliguori  else
16601be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
16611be10ad2SJuan Quintela      feature_not_found "vnc-tls"
16621be10ad2SJuan Quintela    fi
16631be10ad2SJuan Quintela    vnc_tls=no
16648d5d2d4cSths  fi
16658d5d2d4cSthsfi
16668d5d2d4cSths
16678d5d2d4cSths##########################################
16682f9606b3Saliguori# VNC SASL detection
1669821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
16702f9606b3Saliguori  cat > $TMPC <<EOF
16712f9606b3Saliguori#include <sasl/sasl.h>
16722f9606b3Saliguori#include <stdio.h>
16732f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
16742f9606b3SaliguoriEOF
16752f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
16762f9606b3Saliguori  vnc_sasl_cflags=""
16772f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
167852166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1679ea784e3bSJuan Quintela    vnc_sasl=yes
1680fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
16812f9606b3Saliguori  else
1682ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1683ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1684ea784e3bSJuan Quintela    fi
1685ea784e3bSJuan Quintela    vnc_sasl=no
16862f9606b3Saliguori  fi
16872f9606b3Saliguorifi
16882f9606b3Saliguori
16892f9606b3Saliguori##########################################
16902f6f5c7aSCorentin Chary# VNC JPEG detection
1691821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
16922f6f5c7aSCorentin Charycat > $TMPC <<EOF
16932f6f5c7aSCorentin Chary#include <stdio.h>
16942f6f5c7aSCorentin Chary#include <jpeglib.h>
16952f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
16962f6f5c7aSCorentin CharyEOF
16972f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
16982f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
16992f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
17002f6f5c7aSCorentin Chary    vnc_jpeg=yes
17012f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
17022f6f5c7aSCorentin Chary  else
17032f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
17042f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
17052f6f5c7aSCorentin Chary    fi
17062f6f5c7aSCorentin Chary    vnc_jpeg=no
17072f6f5c7aSCorentin Chary  fi
17082f6f5c7aSCorentin Charyfi
17092f6f5c7aSCorentin Chary
17102f6f5c7aSCorentin Chary##########################################
1711efe556adSCorentin Chary# VNC PNG detection
1712821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1713efe556adSCorentin Charycat > $TMPC <<EOF
1714efe556adSCorentin Chary//#include <stdio.h>
1715efe556adSCorentin Chary#include <png.h>
1716832ce9c2SScott Wood#include <stddef.h>
1717efe556adSCorentin Charyint main(void) {
1718efe556adSCorentin Chary    png_structp png_ptr;
1719efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1720efe556adSCorentin Chary    return 0;
1721efe556adSCorentin Chary}
1722efe556adSCorentin CharyEOF
17239af8025eSBrad  if $pkg_config libpng --modversion >/dev/null 2>&1; then
17249af8025eSBrad    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
17259af8025eSBrad    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
17269af8025eSBrad  else
1727efe556adSCorentin Chary    vnc_png_cflags=""
1728efe556adSCorentin Chary    vnc_png_libs="-lpng"
17299af8025eSBrad  fi
1730efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1731efe556adSCorentin Chary    vnc_png=yes
1732efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
17339af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1734efe556adSCorentin Chary  else
1735efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1736efe556adSCorentin Chary      feature_not_found "vnc-png"
1737efe556adSCorentin Chary    fi
1738efe556adSCorentin Chary    vnc_png=no
1739efe556adSCorentin Chary  fi
1740efe556adSCorentin Charyfi
1741efe556adSCorentin Chary
1742efe556adSCorentin Chary##########################################
174376655d6dSaliguori# fnmatch() probe, used for ACL routines
174476655d6dSaliguorifnmatch="no"
174576655d6dSaliguoricat > $TMPC << EOF
174676655d6dSaliguori#include <fnmatch.h>
174776655d6dSaliguoriint main(void)
174876655d6dSaliguori{
174976655d6dSaliguori    fnmatch("foo", "foo", 0);
175076655d6dSaliguori    return 0;
175176655d6dSaliguori}
175276655d6dSaliguoriEOF
175352166aa0SJuan Quintelaif compile_prog "" "" ; then
175476655d6dSaliguori   fnmatch="yes"
175576655d6dSaliguorifi
175676655d6dSaliguori
175776655d6dSaliguori##########################################
1758ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1759ee682d27SStefan Weilif test "$uuid" != "no" ; then
1760ee682d27SStefan Weil  uuid_libs="-luuid"
1761ee682d27SStefan Weil  cat > $TMPC << EOF
1762ee682d27SStefan Weil#include <uuid/uuid.h>
1763ee682d27SStefan Weilint main(void)
1764ee682d27SStefan Weil{
1765ee682d27SStefan Weil    uuid_t my_uuid;
1766ee682d27SStefan Weil    uuid_generate(my_uuid);
1767ee682d27SStefan Weil    return 0;
1768ee682d27SStefan Weil}
1769ee682d27SStefan WeilEOF
1770ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1771ee682d27SStefan Weil    uuid="yes"
1772ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1773ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1774ee682d27SStefan Weil  else
1775ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1776ee682d27SStefan Weil      feature_not_found "uuid"
1777ee682d27SStefan Weil    fi
1778ee682d27SStefan Weil    uuid=no
1779ee682d27SStefan Weil  fi
1780ee682d27SStefan Weilfi
1781ee682d27SStefan Weil
1782ee682d27SStefan Weil##########################################
1783dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1784dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1785dce512deSChristoph Hellwig  cat > $TMPC << EOF
1786ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
1787dce512deSChristoph Hellwig#include <xfs/xfs.h>
1788dce512deSChristoph Hellwigint main(void)
1789dce512deSChristoph Hellwig{
1790dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1791dce512deSChristoph Hellwig    return 0;
1792dce512deSChristoph Hellwig}
1793dce512deSChristoph HellwigEOF
1794dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1795dce512deSChristoph Hellwig    xfs="yes"
1796dce512deSChristoph Hellwig  else
1797dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1798dce512deSChristoph Hellwig      feature_not_found "xfs"
1799dce512deSChristoph Hellwig    fi
1800dce512deSChristoph Hellwig    xfs=no
1801dce512deSChristoph Hellwig  fi
1802dce512deSChristoph Hellwigfi
1803dce512deSChristoph Hellwig
1804dce512deSChristoph Hellwig##########################################
18058a16d273Sths# vde libraries probe
1806dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
18074baae0acSJuan Quintela  vde_libs="-lvdeplug"
18088a16d273Sths  cat > $TMPC << EOF
18098a16d273Sths#include <libvdeplug.h>
18104a7f0e06Spbrookint main(void)
18114a7f0e06Spbrook{
18124a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
18134a7f0e06Spbrook    vde_open("", "", &a);
18144a7f0e06Spbrook    return 0;
18154a7f0e06Spbrook}
18168a16d273SthsEOF
181752166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
18184baae0acSJuan Quintela    vde=yes
18198e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
18208e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1821dfb278bdSJuan Quintela  else
1822dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1823dfb278bdSJuan Quintela      feature_not_found "vde"
1824dfb278bdSJuan Quintela    fi
1825dfb278bdSJuan Quintela    vde=no
18268a16d273Sths  fi
18278a16d273Sthsfi
18288a16d273Sths
18298a16d273Sths##########################################
183047e98658SCorey Bryant# libcap-ng library probe
183147e98658SCorey Bryantif test "$cap_ng" != "no" ; then
183247e98658SCorey Bryant  cap_libs="-lcap-ng"
183347e98658SCorey Bryant  cat > $TMPC << EOF
183447e98658SCorey Bryant#include <cap-ng.h>
183547e98658SCorey Bryantint main(void)
183647e98658SCorey Bryant{
183747e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
183847e98658SCorey Bryant    return 0;
183947e98658SCorey Bryant}
184047e98658SCorey BryantEOF
184147e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
184247e98658SCorey Bryant    cap_ng=yes
184347e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
184447e98658SCorey Bryant  else
184547e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
184647e98658SCorey Bryant      feature_not_found "cap_ng"
184747e98658SCorey Bryant    fi
184847e98658SCorey Bryant    cap_ng=no
184947e98658SCorey Bryant  fi
185047e98658SCorey Bryantfi
185147e98658SCorey Bryant
185247e98658SCorey Bryant##########################################
1853c2de5c91Smalc# Sound support libraries probe
18548f28f3fbSths
1855c2de5c91Smalcaudio_drv_probe()
1856c2de5c91Smalc{
1857c2de5c91Smalc    drv=$1
1858c2de5c91Smalc    hdr=$2
1859c2de5c91Smalc    lib=$3
1860c2de5c91Smalc    exp=$4
1861c2de5c91Smalc    cfl=$5
18628f28f3fbSths        cat > $TMPC << EOF
1863c2de5c91Smalc#include <$hdr>
1864c2de5c91Smalcint main(void) { $exp }
18658f28f3fbSthsEOF
186652166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
18678f28f3fbSths        :
18688f28f3fbSths    else
18698f28f3fbSths        echo
1870c2de5c91Smalc        echo "Error: $drv check failed"
1871c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
18728f28f3fbSths        echo
18738f28f3fbSths        exit 1
18748f28f3fbSths    fi
1875c2de5c91Smalc}
1876c2de5c91Smalc
18772fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1878c2de5c91Smalcfor drv in $audio_drv_list; do
1879c2de5c91Smalc    case $drv in
1880c2de5c91Smalc    alsa)
1881c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1882c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1883a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1884c2de5c91Smalc    ;;
1885c2de5c91Smalc
1886c2de5c91Smalc    fmod)
1887c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1888c2de5c91Smalc        echo
1889c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1890c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1891c2de5c91Smalc        echo
1892c2de5c91Smalc        exit 1
18938f28f3fbSths    fi
1894c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1895a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1896c2de5c91Smalc    ;;
1897c2de5c91Smalc
1898c2de5c91Smalc    esd)
1899c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1900a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
190167f86e8eSJuan Quintela    audio_pt_int="yes"
1902c2de5c91Smalc    ;;
1903b8e59f18Smalc
1904b8e59f18Smalc    pa)
1905a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
1906a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
1907a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
190867f86e8eSJuan Quintela    audio_pt_int="yes"
1909b8e59f18Smalc    ;;
1910b8e59f18Smalc
1911997e690aSJuan Quintela    coreaudio)
1912997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1913997e690aSJuan Quintela    ;;
1914997e690aSJuan Quintela
1915a4bf6780SJuan Quintela    dsound)
1916a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1917d5631638Smalc      audio_win_int="yes"
1918a4bf6780SJuan Quintela    ;;
1919a4bf6780SJuan Quintela
1920a4bf6780SJuan Quintela    oss)
1921a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1922a4bf6780SJuan Quintela    ;;
1923a4bf6780SJuan Quintela
1924a4bf6780SJuan Quintela    sdl|wav)
19252f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
19262f6a1ab0Sblueswir1    ;;
19272f6a1ab0Sblueswir1
1928d5631638Smalc    winwave)
1929d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1930d5631638Smalc      audio_win_int="yes"
1931d5631638Smalc    ;;
1932d5631638Smalc
1933e4c63a6aSmalc    *)
19341c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1935e4c63a6aSmalc        echo
1936e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1937e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1938e4c63a6aSmalc        echo
1939e4c63a6aSmalc        exit 1
1940e4c63a6aSmalc    }
1941e4c63a6aSmalc    ;;
1942c2de5c91Smalc    esac
1943c2de5c91Smalcdone
19448f28f3fbSths
19454d3b6f6eSbalrog##########################################
19462e4d9fb1Saurel32# BrlAPI probe
19472e4d9fb1Saurel32
19484ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1949eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
19502e4d9fb1Saurel32  cat > $TMPC << EOF
19512e4d9fb1Saurel32#include <brlapi.h>
1952832ce9c2SScott Wood#include <stddef.h>
19532e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
19542e4d9fb1Saurel32EOF
195552166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
19562e4d9fb1Saurel32    brlapi=yes
1957264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
19584ffcedb6SJuan Quintela  else
19594ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
19604ffcedb6SJuan Quintela      feature_not_found "brlapi"
19614ffcedb6SJuan Quintela    fi
19624ffcedb6SJuan Quintela    brlapi=no
1963eb82284fSJuan Quintela  fi
1964eb82284fSJuan Quintelafi
19652e4d9fb1Saurel32
19662e4d9fb1Saurel32##########################################
19674d3b6f6eSbalrog# curses probe
1968e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
1969e095e2f3SStefan Weil    curses_list="-lpdcurses"
1970e095e2f3SStefan Weilelse
19714f78ef9aSJuan Quintela    curses_list="-lncurses -lcurses"
1972e095e2f3SStefan Weilfi
19734d3b6f6eSbalrog
1974c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1975c584a6d0SJuan Quintela  curses_found=no
19764d3b6f6eSbalrog  cat > $TMPC << EOF
19774d3b6f6eSbalrog#include <curses.h>
1978ef9a2524SStefan Weilint main(void) {
1979ef9a2524SStefan Weil  const char *s = curses_version();
1980ef9a2524SStefan Weil  resize_term(0, 0);
1981ef9a2524SStefan Weil  return s != 0;
1982ef9a2524SStefan Weil}
19834d3b6f6eSbalrogEOF
19844f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
19854f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1986c584a6d0SJuan Quintela      curses_found=yes
19874f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
19884f78ef9aSJuan Quintela      break
19894d3b6f6eSbalrog    fi
19904f78ef9aSJuan Quintela  done
1991c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1992c584a6d0SJuan Quintela    curses=yes
1993c584a6d0SJuan Quintela  else
1994c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1995c584a6d0SJuan Quintela      feature_not_found "curses"
1996c584a6d0SJuan Quintela    fi
1997c584a6d0SJuan Quintela    curses=no
1998c584a6d0SJuan Quintela  fi
19994f78ef9aSJuan Quintelafi
20004d3b6f6eSbalrog
2001414f0dabSblueswir1##########################################
2002769ce76dSAlexander Graf# curl probe
2003769ce76dSAlexander Graf
2004a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
2005a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
20064e2b0658SPaolo Bonzinielse
20074e2b0658SPaolo Bonzini  curlconfig=curl-config
20084e2b0658SPaolo Bonzinifi
20094e2b0658SPaolo Bonzini
2010788c8196SJuan Quintelaif test "$curl" != "no" ; then
2011769ce76dSAlexander Graf  cat > $TMPC << EOF
2012769ce76dSAlexander Graf#include <curl/curl.h>
20130b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2014769ce76dSAlexander GrafEOF
20154e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
20164e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2017b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2018769ce76dSAlexander Graf    curl=yes
2019f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2020f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2021788c8196SJuan Quintela  else
2022788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2023788c8196SJuan Quintela      feature_not_found "curl"
2024788c8196SJuan Quintela    fi
2025788c8196SJuan Quintela    curl=no
2026769ce76dSAlexander Graf  fi
2027769ce76dSAlexander Graffi # test "$curl"
2028769ce76dSAlexander Graf
2029769ce76dSAlexander Graf##########################################
2030fb599c9aSbalrog# bluez support probe
2031a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2032e820e3f4Sbalrog  cat > $TMPC << EOF
2033e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2034e820e3f4Sbalrogint main(void) { return bt_error(0); }
2035e820e3f4SbalrogEOF
2036a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2037a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
203852166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2039a20a6f46SJuan Quintela    bluez=yes
2040e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2041e820e3f4Sbalrog  else
2042a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2043a20a6f46SJuan Quintela      feature_not_found "bluez"
2044a20a6f46SJuan Quintela    fi
2045e820e3f4Sbalrog    bluez="no"
2046e820e3f4Sbalrog  fi
2047fb599c9aSbalrogfi
2048fb599c9aSbalrog
2049fb599c9aSbalrog##########################################
2050e18df141SAnthony Liguori# glib support probe
2051a52d28afSPaolo Bonzini
2052a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2053a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2054a52d28afSPaolo Bonzini    glib_req_ver=2.20
2055a52d28afSPaolo Bonzinielse
2056a52d28afSPaolo Bonzini    glib_req_ver=2.12
2057a52d28afSPaolo Bonzinifi
2058a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
2059a52d28afSPaolo Bonzinithen
20604b76a481SStefan Hajnoczi    glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
20614b76a481SStefan Hajnoczi    glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
206214015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2063957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2064e18df141SAnthony Liguorielse
2065a52d28afSPaolo Bonzini    echo "glib-$glib_req_ver required to compile QEMU"
2066e18df141SAnthony Liguori    exit 1
2067e18df141SAnthony Liguorifi
2068e18df141SAnthony Liguori
2069e18df141SAnthony Liguori##########################################
207017bff52bSM. Mohan Kumar# libcap probe
207117bff52bSM. Mohan Kumar
207217bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
207317bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
207417bff52bSM. Mohan Kumar#include <stdio.h>
207517bff52bSM. Mohan Kumar#include <sys/capability.h>
207617bff52bSM. Mohan Kumarint main(void) { cap_t caps; caps = cap_init(); }
207717bff52bSM. Mohan KumarEOF
207817bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
207917bff52bSM. Mohan Kumar    cap=yes
208017bff52bSM. Mohan Kumar  else
208117bff52bSM. Mohan Kumar    cap=no
208217bff52bSM. Mohan Kumar  fi
208317bff52bSM. Mohan Kumarfi
208417bff52bSM. Mohan Kumar
208517bff52bSM. Mohan Kumar##########################################
2086e5d355d1Saliguori# pthread probe
20874b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
20883c529d93Saliguori
2089e5d355d1Saliguoripthread=no
2090414f0dabSblueswir1cat > $TMPC << EOF
20913c529d93Saliguori#include <pthread.h>
20927a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
20937a42bbe4SStefan Weilint main(void) {
20947a42bbe4SStefan Weil  pthread_t thread;
20957a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
20967a42bbe4SStefan Weil  return 0;
20977a42bbe4SStefan Weil}
2098414f0dabSblueswir1EOF
2099bd00d539SAndreas Färberif compile_prog "" "" ; then
2100bd00d539SAndreas Färber  pthread=yes
2101bd00d539SAndreas Färberelse
2102de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
210352166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2104e5d355d1Saliguori      pthread=yes
2105e3c56761SPeter Portante      found=no
2106e3c56761SPeter Portante      for lib_entry in $LIBS; do
2107e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2108e3c56761SPeter Portante          found=yes
2109e3c56761SPeter Portante          break
2110e3c56761SPeter Portante        fi
2111e3c56761SPeter Portante      done
2112e3c56761SPeter Portante      if test "$found" = "no"; then
21135572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2114e3c56761SPeter Portante      fi
2115de65fe0fSSebastian Herbszt      break
2116414f0dabSblueswir1    fi
2117de65fe0fSSebastian Herbszt  done
2118bd00d539SAndreas Färberfi
2119414f0dabSblueswir1
21204617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
21214dd75c70SChristoph Hellwig  echo
21224dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
21234dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
21244dd75c70SChristoph Hellwig  echo
21254dd75c70SChristoph Hellwig  exit 1
2126e5d355d1Saliguorifi
2127e5d355d1Saliguori
2128bf9298b9Saliguori##########################################
2129f27aaf4bSChristian Brunner# rbd probe
2130f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2131f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2132f27aaf4bSChristian Brunner#include <stdio.h>
2133ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2134f27aaf4bSChristian Brunnerint main(void) {
2135ad32e9c0SJosh Durgin    rados_t cluster;
2136ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2137f27aaf4bSChristian Brunner    return 0;
2138f27aaf4bSChristian Brunner}
2139f27aaf4bSChristian BrunnerEOF
2140ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2141f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2142f27aaf4bSChristian Brunner    rbd=yes
2143f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2144f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2145f27aaf4bSChristian Brunner  else
2146f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2147f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2148f27aaf4bSChristian Brunner    fi
2149f27aaf4bSChristian Brunner    rbd=no
2150f27aaf4bSChristian Brunner  fi
2151f27aaf4bSChristian Brunnerfi
2152f27aaf4bSChristian Brunner
2153f27aaf4bSChristian Brunner##########################################
21545c6c3a6cSChristoph Hellwig# linux-aio probe
21555c6c3a6cSChristoph Hellwig
21565c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
21575c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
21585c6c3a6cSChristoph Hellwig#include <libaio.h>
21595c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2160832ce9c2SScott Wood#include <stddef.h>
21615c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
21625c6c3a6cSChristoph HellwigEOF
21635c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
21645c6c3a6cSChristoph Hellwig    linux_aio=yes
2165048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2166048d179fSPaul Brook    libs_tools="$libs_tools -laio"
21675c6c3a6cSChristoph Hellwig  else
21685c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
21695c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
21705c6c3a6cSChristoph Hellwig    fi
21713cfcae3cSLuiz Capitulino    linux_aio=no
21725c6c3a6cSChristoph Hellwig  fi
21735c6c3a6cSChristoph Hellwigfi
21745c6c3a6cSChristoph Hellwig
21755c6c3a6cSChristoph Hellwig##########################################
2176758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2177758e8e38SVenkateswararao Jujjuri (JV)
2178758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2179758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2180758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2181758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2182f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2183f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2184f2338fb4SPavel Borzenkov#else
21854f26f2b6SAvi Kivity#include <sys/xattr.h>
2186f2338fb4SPavel Borzenkov#endif
2187758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2188758e8e38SVenkateswararao Jujjuri (JV)EOF
21894f26f2b6SAvi Kivity  if compile_prog "" "" ; then
21904f26f2b6SAvi Kivity    attr=yes
21914f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2192f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2193758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2194758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
21954f26f2b6SAvi Kivity    libattr=yes
2196758e8e38SVenkateswararao Jujjuri (JV)  else
2197758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2198758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2199758e8e38SVenkateswararao Jujjuri (JV)    fi
2200758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2201758e8e38SVenkateswararao Jujjuri (JV)  fi
2202758e8e38SVenkateswararao Jujjuri (JV)fi
2203758e8e38SVenkateswararao Jujjuri (JV)
2204758e8e38SVenkateswararao Jujjuri (JV)##########################################
2205bf9298b9Saliguori# iovec probe
2206bf9298b9Saliguoricat > $TMPC <<EOF
2207db34f0b3Sblueswir1#include <sys/types.h>
2208bf9298b9Saliguori#include <sys/uio.h>
2209db34f0b3Sblueswir1#include <unistd.h>
2210f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2211bf9298b9SaliguoriEOF
2212bf9298b9Saliguoriiovec=no
221352166aa0SJuan Quintelaif compile_prog "" "" ; then
2214bf9298b9Saliguori  iovec=yes
2215bf9298b9Saliguorifi
2216bf9298b9Saliguori
2217f652e6afSaurel32##########################################
2218ceb42de8Saliguori# preadv probe
2219ceb42de8Saliguoricat > $TMPC <<EOF
2220ceb42de8Saliguori#include <sys/types.h>
2221ceb42de8Saliguori#include <sys/uio.h>
2222ceb42de8Saliguori#include <unistd.h>
222384972cbbSStefan Weilint main(void) { return preadv == preadv; }
2224ceb42de8SaliguoriEOF
2225ceb42de8Saliguoripreadv=no
222652166aa0SJuan Quintelaif compile_prog "" "" ; then
2227ceb42de8Saliguori  preadv=yes
2228ceb42de8Saliguorifi
2229ceb42de8Saliguori
2230ceb42de8Saliguori##########################################
2231f652e6afSaurel32# fdt probe
22322df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2233b41af4baSJuan Quintela  fdt_libs="-lfdt"
2234f652e6afSaurel32  cat > $TMPC << EOF
2235f652e6afSaurel32int main(void) { return 0; }
2236f652e6afSaurel32EOF
223752166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2238f652e6afSaurel32    fdt=yes
22392df87df7SJuan Quintela  else
22402df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
22412df87df7SJuan Quintela      feature_not_found "fdt"
22422df87df7SJuan Quintela    fi
2243de3a354aSMichael Walle    fdt_libs=
22442df87df7SJuan Quintela    fdt=no
2245f652e6afSaurel32  fi
2246f652e6afSaurel32fi
2247f652e6afSaurel32
224820ff075bSMichael Walle##########################################
224920ff075bSMichael Walle# opengl probe, used by milkymist-tmu2
225020ff075bSMichael Walleif test "$opengl" != "no" ; then
225120ff075bSMichael Walle  opengl_libs="-lGL"
225220ff075bSMichael Walle  cat > $TMPC << EOF
225320ff075bSMichael Walle#include <X11/Xlib.h>
225420ff075bSMichael Walle#include <GL/gl.h>
225520ff075bSMichael Walle#include <GL/glx.h>
225684972cbbSStefan Weilint main(void) { return GL_VERSION != 0; }
225720ff075bSMichael WalleEOF
225820ff075bSMichael Walle  if compile_prog "" "-lGL" ; then
225920ff075bSMichael Walle    opengl=yes
226020ff075bSMichael Walle  else
226120ff075bSMichael Walle    if test "$opengl" = "yes" ; then
226220ff075bSMichael Walle      feature_not_found "opengl"
226320ff075bSMichael Walle    fi
2264de3a354aSMichael Walle    opengl_libs=
226520ff075bSMichael Walle    opengl=no
226620ff075bSMichael Walle  fi
226720ff075bSMichael Wallefi
226820ff075bSMichael Walle
22693b3f24adSaurel32#
22703b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
22713b3f24adSaurel32# emulator.  This is done because older glibc versions don't
22723b3f24adSaurel32# have syscall stubs for these implemented.
22733b3f24adSaurel32#
22743b3f24adSaurel32atfile=no
22753b3f24adSaurel32cat > $TMPC << EOF
22763b3f24adSaurel32#define _ATFILE_SOURCE
22773b3f24adSaurel32#include <sys/types.h>
22783b3f24adSaurel32#include <fcntl.h>
22793b3f24adSaurel32#include <unistd.h>
22803b3f24adSaurel32
22813b3f24adSaurel32int
22823b3f24adSaurel32main(void)
22833b3f24adSaurel32{
22843b3f24adSaurel32	/* try to unlink nonexisting file */
22853b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
22863b3f24adSaurel32}
22873b3f24adSaurel32EOF
228852166aa0SJuan Quintelaif compile_prog "" "" ; then
22893b3f24adSaurel32  atfile=yes
22903b3f24adSaurel32fi
22913b3f24adSaurel32
229239386ac7Saurel32# Check for inotify functions when we are building linux-user
22933b3f24adSaurel32# emulator.  This is done because older glibc versions don't
22943b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
22953b3f24adSaurel32# don't provide them even if kernel supports them.
22963b3f24adSaurel32#
22973b3f24adSaurel32inotify=no
22983b3f24adSaurel32cat > $TMPC << EOF
22993b3f24adSaurel32#include <sys/inotify.h>
23003b3f24adSaurel32
23013b3f24adSaurel32int
23023b3f24adSaurel32main(void)
23033b3f24adSaurel32{
23043b3f24adSaurel32	/* try to start inotify */
23058690e420Saurel32	return inotify_init();
23063b3f24adSaurel32}
23073b3f24adSaurel32EOF
230852166aa0SJuan Quintelaif compile_prog "" "" ; then
23093b3f24adSaurel32  inotify=yes
23103b3f24adSaurel32fi
23113b3f24adSaurel32
2312c05c7a73SRiku Voipioinotify1=no
2313c05c7a73SRiku Voipiocat > $TMPC << EOF
2314c05c7a73SRiku Voipio#include <sys/inotify.h>
2315c05c7a73SRiku Voipio
2316c05c7a73SRiku Voipioint
2317c05c7a73SRiku Voipiomain(void)
2318c05c7a73SRiku Voipio{
2319c05c7a73SRiku Voipio    /* try to start inotify */
2320c05c7a73SRiku Voipio    return inotify_init1(0);
2321c05c7a73SRiku Voipio}
2322c05c7a73SRiku VoipioEOF
2323c05c7a73SRiku Voipioif compile_prog "" "" ; then
2324c05c7a73SRiku Voipio  inotify1=yes
2325c05c7a73SRiku Voipiofi
2326c05c7a73SRiku Voipio
2327ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2328ebc996f3SRiku Voipioutimens=no
2329ebc996f3SRiku Voipiocat > $TMPC << EOF
2330ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2331ebc996f3SRiku Voipio#include <stddef.h>
2332ebc996f3SRiku Voipio#include <fcntl.h>
2333ebc996f3SRiku Voipio
2334ebc996f3SRiku Voipioint main(void)
2335ebc996f3SRiku Voipio{
2336ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2337ebc996f3SRiku Voipio    futimens(0, NULL);
2338ebc996f3SRiku Voipio    return 0;
2339ebc996f3SRiku Voipio}
2340ebc996f3SRiku VoipioEOF
234152166aa0SJuan Quintelaif compile_prog "" "" ; then
2342ebc996f3SRiku Voipio  utimens=yes
2343ebc996f3SRiku Voipiofi
2344ebc996f3SRiku Voipio
2345099d6b0fSRiku Voipio# check if pipe2 is there
2346099d6b0fSRiku Voipiopipe2=no
2347099d6b0fSRiku Voipiocat > $TMPC << EOF
2348099d6b0fSRiku Voipio#include <unistd.h>
2349099d6b0fSRiku Voipio#include <fcntl.h>
2350099d6b0fSRiku Voipio
2351099d6b0fSRiku Voipioint main(void)
2352099d6b0fSRiku Voipio{
2353099d6b0fSRiku Voipio    int pipefd[2];
2354099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
2355099d6b0fSRiku Voipio    return 0;
2356099d6b0fSRiku Voipio}
2357099d6b0fSRiku VoipioEOF
235852166aa0SJuan Quintelaif compile_prog "" "" ; then
2359099d6b0fSRiku Voipio  pipe2=yes
2360099d6b0fSRiku Voipiofi
2361099d6b0fSRiku Voipio
236240ff6d7eSKevin Wolf# check if accept4 is there
236340ff6d7eSKevin Wolfaccept4=no
236440ff6d7eSKevin Wolfcat > $TMPC << EOF
236540ff6d7eSKevin Wolf#include <sys/socket.h>
236640ff6d7eSKevin Wolf#include <stddef.h>
236740ff6d7eSKevin Wolf
236840ff6d7eSKevin Wolfint main(void)
236940ff6d7eSKevin Wolf{
237040ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
237140ff6d7eSKevin Wolf    return 0;
237240ff6d7eSKevin Wolf}
237340ff6d7eSKevin WolfEOF
237440ff6d7eSKevin Wolfif compile_prog "" "" ; then
237540ff6d7eSKevin Wolf  accept4=yes
237640ff6d7eSKevin Wolffi
237740ff6d7eSKevin Wolf
23783ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
23793ce34dfbSvibisreenivasansplice=no
23803ce34dfbSvibisreenivasancat > $TMPC << EOF
23813ce34dfbSvibisreenivasan#include <unistd.h>
23823ce34dfbSvibisreenivasan#include <fcntl.h>
23833ce34dfbSvibisreenivasan#include <limits.h>
23843ce34dfbSvibisreenivasan
23853ce34dfbSvibisreenivasanint main(void)
23863ce34dfbSvibisreenivasan{
238766ea0f22SStefan Weil    int len, fd = 0;
23883ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
23893ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
23903ce34dfbSvibisreenivasan    return 0;
23913ce34dfbSvibisreenivasan}
23923ce34dfbSvibisreenivasanEOF
239352166aa0SJuan Quintelaif compile_prog "" "" ; then
23943ce34dfbSvibisreenivasan  splice=yes
23953ce34dfbSvibisreenivasanfi
23963ce34dfbSvibisreenivasan
2397dcc38d1cSMarcelo Tosatti##########################################
2398dcc38d1cSMarcelo Tosatti# signalfd probe
2399dcc38d1cSMarcelo Tosattisignalfd="no"
2400dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2401dcc38d1cSMarcelo Tosatti#include <unistd.h>
2402dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2403dcc38d1cSMarcelo Tosatti#include <signal.h>
2404dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2405dcc38d1cSMarcelo TosattiEOF
2406dcc38d1cSMarcelo Tosatti
2407dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2408dcc38d1cSMarcelo Tosatti  signalfd=yes
2409dcc38d1cSMarcelo Tosattifi
2410dcc38d1cSMarcelo Tosatti
2411c2882b96SRiku Voipio# check if eventfd is supported
2412c2882b96SRiku Voipioeventfd=no
2413c2882b96SRiku Voipiocat > $TMPC << EOF
2414c2882b96SRiku Voipio#include <sys/eventfd.h>
2415c2882b96SRiku Voipio
2416c2882b96SRiku Voipioint main(void)
2417c2882b96SRiku Voipio{
241855cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2419c2882b96SRiku Voipio}
2420c2882b96SRiku VoipioEOF
2421c2882b96SRiku Voipioif compile_prog "" "" ; then
2422c2882b96SRiku Voipio  eventfd=yes
2423c2882b96SRiku Voipiofi
2424c2882b96SRiku Voipio
2425d0927938SUlrich Hecht# check for fallocate
2426d0927938SUlrich Hechtfallocate=no
2427d0927938SUlrich Hechtcat > $TMPC << EOF
2428d0927938SUlrich Hecht#include <fcntl.h>
2429d0927938SUlrich Hecht
2430d0927938SUlrich Hechtint main(void)
2431d0927938SUlrich Hecht{
2432d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2433d0927938SUlrich Hecht    return 0;
2434d0927938SUlrich Hecht}
2435d0927938SUlrich HechtEOF
24368fb03151SPeter Maydellif compile_prog "" "" ; then
2437d0927938SUlrich Hecht  fallocate=yes
2438d0927938SUlrich Hechtfi
2439d0927938SUlrich Hecht
2440c727f47dSPeter Maydell# check for sync_file_range
2441c727f47dSPeter Maydellsync_file_range=no
2442c727f47dSPeter Maydellcat > $TMPC << EOF
2443c727f47dSPeter Maydell#include <fcntl.h>
2444c727f47dSPeter Maydell
2445c727f47dSPeter Maydellint main(void)
2446c727f47dSPeter Maydell{
2447c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2448c727f47dSPeter Maydell    return 0;
2449c727f47dSPeter Maydell}
2450c727f47dSPeter MaydellEOF
24518fb03151SPeter Maydellif compile_prog "" "" ; then
2452c727f47dSPeter Maydell  sync_file_range=yes
2453c727f47dSPeter Maydellfi
2454c727f47dSPeter Maydell
2455dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2456dace20dcSPeter Maydellfiemap=no
2457dace20dcSPeter Maydellcat > $TMPC << EOF
2458dace20dcSPeter Maydell#include <sys/ioctl.h>
2459dace20dcSPeter Maydell#include <linux/fs.h>
2460dace20dcSPeter Maydell#include <linux/fiemap.h>
2461dace20dcSPeter Maydell
2462dace20dcSPeter Maydellint main(void)
2463dace20dcSPeter Maydell{
2464dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2465dace20dcSPeter Maydell    return 0;
2466dace20dcSPeter Maydell}
2467dace20dcSPeter MaydellEOF
24688fb03151SPeter Maydellif compile_prog "" "" ; then
2469dace20dcSPeter Maydell  fiemap=yes
2470dace20dcSPeter Maydellfi
2471dace20dcSPeter Maydell
2472d0927938SUlrich Hecht# check for dup3
2473d0927938SUlrich Hechtdup3=no
2474d0927938SUlrich Hechtcat > $TMPC << EOF
2475d0927938SUlrich Hecht#include <unistd.h>
2476d0927938SUlrich Hecht
2477d0927938SUlrich Hechtint main(void)
2478d0927938SUlrich Hecht{
2479d0927938SUlrich Hecht    dup3(0, 0, 0);
2480d0927938SUlrich Hecht    return 0;
2481d0927938SUlrich Hecht}
2482d0927938SUlrich HechtEOF
248378f5d726SJan Kiszkaif compile_prog "" "" ; then
2484d0927938SUlrich Hecht  dup3=yes
2485d0927938SUlrich Hechtfi
2486d0927938SUlrich Hecht
24873b6edd16SPeter Maydell# check for epoll support
24883b6edd16SPeter Maydellepoll=no
24893b6edd16SPeter Maydellcat > $TMPC << EOF
24903b6edd16SPeter Maydell#include <sys/epoll.h>
24913b6edd16SPeter Maydell
24923b6edd16SPeter Maydellint main(void)
24933b6edd16SPeter Maydell{
24943b6edd16SPeter Maydell    epoll_create(0);
24953b6edd16SPeter Maydell    return 0;
24963b6edd16SPeter Maydell}
24973b6edd16SPeter MaydellEOF
24988fb03151SPeter Maydellif compile_prog "" "" ; then
24993b6edd16SPeter Maydell  epoll=yes
25003b6edd16SPeter Maydellfi
25013b6edd16SPeter Maydell
25023b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
25033b6edd16SPeter Maydell# so we must check separately for their presence
25043b6edd16SPeter Maydellepoll_create1=no
25053b6edd16SPeter Maydellcat > $TMPC << EOF
25063b6edd16SPeter Maydell#include <sys/epoll.h>
25073b6edd16SPeter Maydell
25083b6edd16SPeter Maydellint main(void)
25093b6edd16SPeter Maydell{
251019e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
251119e83f6bSPeter Maydell     * a function being called. This is necessary so that on
251219e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
251319e83f6bSPeter Maydell     * the library but not declared in the header file we will
251419e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
251519e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
251619e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
251719e83f6bSPeter Maydell     */
251884972cbbSStefan Weil    return epoll_create1 == epoll_create1;
25193b6edd16SPeter Maydell}
25203b6edd16SPeter MaydellEOF
25218fb03151SPeter Maydellif compile_prog "" "" ; then
25223b6edd16SPeter Maydell  epoll_create1=yes
25233b6edd16SPeter Maydellfi
25243b6edd16SPeter Maydell
25253b6edd16SPeter Maydellepoll_pwait=no
25263b6edd16SPeter Maydellcat > $TMPC << EOF
25273b6edd16SPeter Maydell#include <sys/epoll.h>
25283b6edd16SPeter Maydell
25293b6edd16SPeter Maydellint main(void)
25303b6edd16SPeter Maydell{
25313b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
25323b6edd16SPeter Maydell    return 0;
25333b6edd16SPeter Maydell}
25343b6edd16SPeter MaydellEOF
25358fb03151SPeter Maydellif compile_prog "" "" ; then
25363b6edd16SPeter Maydell  epoll_pwait=yes
25373b6edd16SPeter Maydellfi
25383b6edd16SPeter Maydell
2539cc8ae6deSpbrook# Check if tools are available to build documentation.
2540a25dba17SJuan Quintelaif test "$docs" != "no" ; then
254101668d98SStefan Weil  if has makeinfo && has pod2man; then
2542a25dba17SJuan Quintela    docs=yes
254383a3ab8bSJuan Quintela  else
2544a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2545a25dba17SJuan Quintela      feature_not_found "docs"
254683a3ab8bSJuan Quintela    fi
2547a25dba17SJuan Quintela    docs=no
254883a3ab8bSJuan Quintela  fi
2549cc8ae6deSpbrookfi
2550cc8ae6deSpbrook
2551f514f41cSStefan Weil# Search for bswap_32 function
25526ae9a1f4SJuan Quintelabyteswap_h=no
25536ae9a1f4SJuan Quintelacat > $TMPC << EOF
25546ae9a1f4SJuan Quintela#include <byteswap.h>
25556ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
25566ae9a1f4SJuan QuintelaEOF
255752166aa0SJuan Quintelaif compile_prog "" "" ; then
25586ae9a1f4SJuan Quintela  byteswap_h=yes
25596ae9a1f4SJuan Quintelafi
25606ae9a1f4SJuan Quintela
2561f514f41cSStefan Weil# Search for bswap_32 function
25626ae9a1f4SJuan Quintelabswap_h=no
25636ae9a1f4SJuan Quintelacat > $TMPC << EOF
25646ae9a1f4SJuan Quintela#include <sys/endian.h>
25656ae9a1f4SJuan Quintela#include <sys/types.h>
25666ae9a1f4SJuan Quintela#include <machine/bswap.h>
25676ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
25686ae9a1f4SJuan QuintelaEOF
256952166aa0SJuan Quintelaif compile_prog "" "" ; then
25706ae9a1f4SJuan Quintela  bswap_h=yes
25716ae9a1f4SJuan Quintelafi
25726ae9a1f4SJuan Quintela
2573da93a1fdSaliguori##########################################
2574c589b249SRonnie Sahlberg# Do we have libiscsi
2575fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a
2576fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi.
2577c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
2578c589b249SRonnie Sahlberg  cat > $TMPC << EOF
2579fa6acb0cSRonnie Sahlberg#include <stdio.h>
2580c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
2581fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
2582c589b249SRonnie SahlbergEOF
2583c589b249SRonnie Sahlberg  if compile_prog "-Werror" "-liscsi" ; then
2584c589b249SRonnie Sahlberg    libiscsi="yes"
2585c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
2586c589b249SRonnie Sahlberg  else
2587c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
2588c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
2589c589b249SRonnie Sahlberg    fi
2590c589b249SRonnie Sahlberg    libiscsi="no"
2591c589b249SRonnie Sahlberg  fi
2592c589b249SRonnie Sahlbergfi
2593c589b249SRonnie Sahlberg
2594c589b249SRonnie Sahlberg
2595c589b249SRonnie Sahlberg##########################################
2596da93a1fdSaliguori# Do we need librt
2597da93a1fdSaliguoricat > $TMPC <<EOF
2598da93a1fdSaliguori#include <signal.h>
2599da93a1fdSaliguori#include <time.h>
260066ea0f22SStefan Weilint main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
2601da93a1fdSaliguoriEOF
2602da93a1fdSaliguori
260352166aa0SJuan Quintelaif compile_prog "" "" ; then
260407ffa4bdSJuan Quintela  :
260552166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
260607ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2607da93a1fdSaliguorifi
2608da93a1fdSaliguori
260931ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2610179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
26116362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
26126362a53fSJuan Quintelafi
26136362a53fSJuan Quintela
2614de5071c5SBlue Swirl##########################################
2615cd4ec0b4SGerd Hoffmann# spice probe
2616cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2617cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2618cd4ec0b4SGerd Hoffmann#include <spice.h>
2619cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2620cd4ec0b4SGerd HoffmannEOF
2621710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2622710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
26234295e15aSAlon Levy  if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \
26247e3efdacSAlon Levy     $pkg_config --atleast-version=0.8.1 spice-protocol > /dev/null 2>&1 && \
2625cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2626cd4ec0b4SGerd Hoffmann    spice="yes"
2627cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2628cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2629cd4ec0b4SGerd Hoffmann  else
2630cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2631cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2632cd4ec0b4SGerd Hoffmann    fi
2633cd4ec0b4SGerd Hoffmann    spice="no"
2634cd4ec0b4SGerd Hoffmann  fi
2635cd4ec0b4SGerd Hoffmannfi
2636cd4ec0b4SGerd Hoffmann
2637111a38b0SRobert Relyea# check for libcacard for smartcard support
2638111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then
2639111a38b0SRobert Relyea    smartcard="yes"
2640111a38b0SRobert Relyea    smartcard_cflags=""
2641111a38b0SRobert Relyea    # TODO - what's the minimal nss version we support?
2642111a38b0SRobert Relyea    if test "$smartcard_nss" != "no"; then
26435f01e06fSSergei Trofimovich      cat > $TMPC << EOF
26445f01e06fSSergei Trofimovich#include <pk11pub.h>
26455f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
26465f01e06fSSergei TrofimovichEOF
2647111a38b0SRobert Relyea        smartcard_cflags="-I\$(SRC_PATH)/libcacard"
26488c741c22SAlon Levy        libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
26498c741c22SAlon Levy        libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
26505f01e06fSSergei Trofimovich        if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
26515f01e06fSSergei Trofimovich          compile_prog "$smartcard_cflags $libcacard_cflags" "$libcacard_libs"; then
26525f01e06fSSergei Trofimovich            smartcard_nss="yes"
2653111a38b0SRobert Relyea            QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2654ad4cf3f6SPaul Brook            libs_softmmu="$libcacard_libs $libs_softmmu"
2655111a38b0SRobert Relyea        else
2656111a38b0SRobert Relyea            if test "$smartcard_nss" = "yes"; then
2657111a38b0SRobert Relyea                feature_not_found "nss"
2658111a38b0SRobert Relyea            fi
2659111a38b0SRobert Relyea            smartcard_nss="no"
2660111a38b0SRobert Relyea        fi
2661111a38b0SRobert Relyea    fi
2662111a38b0SRobert Relyeafi
2663111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then
2664111a38b0SRobert Relyea    smartcard_nss="no"
2665111a38b0SRobert Relyeafi
2666111a38b0SRobert Relyea
266769354a83SHans de Goede# check for usbredirparser for usb network redirection support
266869354a83SHans de Goedeif test "$usb_redir" != "no" ; then
2669097a66efSHans de Goede    if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then
267069354a83SHans de Goede        usb_redir="yes"
267169354a83SHans de Goede        usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
267269354a83SHans de Goede        usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
267369354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
267469354a83SHans de Goede        LIBS="$LIBS $usb_redir_libs"
267569354a83SHans de Goede    else
267669354a83SHans de Goede        if test "$usb_redir" = "yes"; then
267769354a83SHans de Goede            feature_not_found "usb-redir"
267869354a83SHans de Goede        fi
267969354a83SHans de Goede        usb_redir="no"
268069354a83SHans de Goede    fi
268169354a83SHans de Goedefi
268269354a83SHans de Goede
2683cd4ec0b4SGerd Hoffmann##########################################
2684cd4ec0b4SGerd Hoffmann
2685747bbdf7SBlue Swirl##########################################
26865f6b9e8fSBlue Swirl# check if we have fdatasync
26875f6b9e8fSBlue Swirl
26885f6b9e8fSBlue Swirlfdatasync=no
26895f6b9e8fSBlue Swirlcat > $TMPC << EOF
26905f6b9e8fSBlue Swirl#include <unistd.h>
2691d1722a27SAlexandre Raymondint main(void) {
2692d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2693d1722a27SAlexandre Raymondreturn fdatasync(0);
2694d1722a27SAlexandre Raymond#else
2695e172fe11SStefan Weil#error Not supported
2696d1722a27SAlexandre Raymond#endif
2697d1722a27SAlexandre Raymond}
26985f6b9e8fSBlue SwirlEOF
26995f6b9e8fSBlue Swirlif compile_prog "" "" ; then
27005f6b9e8fSBlue Swirl    fdatasync=yes
27015f6b9e8fSBlue Swirlfi
27025f6b9e8fSBlue Swirl
270394a420b1SStefan Hajnoczi##########################################
2704e78815a5SAndreas Färber# check if we have madvise
2705e78815a5SAndreas Färber
2706e78815a5SAndreas Färbermadvise=no
2707e78815a5SAndreas Färbercat > $TMPC << EOF
2708e78815a5SAndreas Färber#include <sys/types.h>
2709e78815a5SAndreas Färber#include <sys/mman.h>
2710832ce9c2SScott Wood#include <stddef.h>
2711e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2712e78815a5SAndreas FärberEOF
2713e78815a5SAndreas Färberif compile_prog "" "" ; then
2714e78815a5SAndreas Färber    madvise=yes
2715e78815a5SAndreas Färberfi
2716e78815a5SAndreas Färber
2717e78815a5SAndreas Färber##########################################
2718e78815a5SAndreas Färber# check if we have posix_madvise
2719e78815a5SAndreas Färber
2720e78815a5SAndreas Färberposix_madvise=no
2721e78815a5SAndreas Färbercat > $TMPC << EOF
2722e78815a5SAndreas Färber#include <sys/mman.h>
2723832ce9c2SScott Wood#include <stddef.h>
2724e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2725e78815a5SAndreas FärberEOF
2726e78815a5SAndreas Färberif compile_prog "" "" ; then
2727e78815a5SAndreas Färber    posix_madvise=yes
2728e78815a5SAndreas Färberfi
2729e78815a5SAndreas Färber
2730e78815a5SAndreas Färber##########################################
273194a420b1SStefan Hajnoczi# check if trace backend exists
273294a420b1SStefan Hajnoczi
2733650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
273494a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
273594a420b1SStefan Hajnoczi  echo
273694a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
273794a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
273894a420b1SStefan Hajnoczi  echo
273994a420b1SStefan Hajnoczi  exit 1
274094a420b1SStefan Hajnoczifi
274194a420b1SStefan Hajnoczi
27427e24e92aSStefan Hajnoczi##########################################
27437e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
27447e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
27457e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
27467e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
27477e24e92aSStefan Hajnoczi#include <ust/marker.h>
27487e24e92aSStefan Hajnocziint main(void) { return 0; }
27497e24e92aSStefan HajnocziEOF
27507e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
275194b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
2752c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
27537e24e92aSStefan Hajnoczi  else
27547e24e92aSStefan Hajnoczi    echo
27557e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
27567e24e92aSStefan Hajnoczi    echo
27577e24e92aSStefan Hajnoczi    exit 1
27587e24e92aSStefan Hajnoczi  fi
27597e24e92aSStefan Hajnoczifi
2760b3d08c02SDaniel P. Berrange
2761b3d08c02SDaniel P. Berrange##########################################
2762b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
2763b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
2764b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
2765b3d08c02SDaniel P. Berrange    echo
2766b3d08c02SDaniel P. Berrange    echo "Error: dtrace command is not found in PATH $PATH"
2767b3d08c02SDaniel P. Berrange    echo
2768b3d08c02SDaniel P. Berrange    exit 1
2769b3d08c02SDaniel P. Berrange  fi
2770c276b17dSDaniel P. Berrange  trace_backend_stap="no"
2771c276b17dSDaniel P. Berrange  if has 'stap' ; then
2772c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
2773c276b17dSDaniel P. Berrange  fi
2774b3d08c02SDaniel P. Berrangefi
2775b3d08c02SDaniel P. Berrange
27767e24e92aSStefan Hajnoczi##########################################
2777023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2778023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit
2779023367e6SWolfgang Mauerer# specification is necessary
27801ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2781023367e6SWolfgang Mauerer  cat > $TMPC << EOF
2782023367e6SWolfgang Mauererint sfaa(unsigned *ptr)
2783023367e6SWolfgang Mauerer{
2784023367e6SWolfgang Mauerer  return __sync_fetch_and_and(ptr, 0);
2785023367e6SWolfgang Mauerer}
2786023367e6SWolfgang Mauerer
2787023367e6SWolfgang Mauererint main(int argc, char **argv)
2788023367e6SWolfgang Mauerer{
2789023367e6SWolfgang Mauerer  int val = 42;
2790023367e6SWolfgang Mauerer  sfaa(&val);
2791023367e6SWolfgang Mauerer  return val;
2792023367e6SWolfgang Mauerer}
2793023367e6SWolfgang MauererEOF
2794023367e6SWolfgang Mauerer  if ! compile_prog "" "" ; then
2795023367e6SWolfgang Mauerer    CFLAGS+="-march=i486"
2796023367e6SWolfgang Mauerer  fi
2797023367e6SWolfgang Mauererfi
2798023367e6SWolfgang Mauerer
2799023367e6SWolfgang Mauerer##########################################
2800519175a2SAlex Barcelo# check and set a backend for coroutine
2801d0e2fce5SAneesh Kumar K.V
2802519175a2SAlex Barcelo# default is ucontext, but always fallback to gthread
2803519175a2SAlex Barcelo# windows autodetected by make
2804519175a2SAlex Barceloif test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
2805d0e2fce5SAneesh Kumar K.V  if test "$darwin" != "yes"; then
2806d0e2fce5SAneesh Kumar K.V    cat > $TMPC << EOF
2807d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
2808cdf84806SPeter Maydell#ifdef __stub_makecontext
2809cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
2810cdf84806SPeter Maydell#endif
281175cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
2812d0e2fce5SAneesh Kumar K.VEOF
2813d0e2fce5SAneesh Kumar K.V    if compile_prog "" "" ; then
2814519175a2SAlex Barcelo        coroutine_backend=ucontext
2815519175a2SAlex Barcelo    else
2816519175a2SAlex Barcelo	coroutine_backend=gthread
2817d0e2fce5SAneesh Kumar K.V    fi
2818519175a2SAlex Barcelo  else
2819519175a2SAlex Barcelo    echo "Silently falling back into gthread backend under darwin"
2820519175a2SAlex Barcelo  fi
2821519175a2SAlex Barceloelif test "$coroutine" = "gthread" ; then
2822519175a2SAlex Barcelo  coroutine_backend=gthread
2823519175a2SAlex Barceloelif test "$coroutine" = "windows" ; then
2824519175a2SAlex Barcelo  coroutine_backend=windows
2825fe91bfa8SAlex Barceloelif test "$coroutine" = "sigaltstack" ; then
2826fe91bfa8SAlex Barcelo  coroutine_backend=sigaltstack
2827519175a2SAlex Barceloelse
2828519175a2SAlex Barcelo  echo
2829519175a2SAlex Barcelo  echo "Error: unknown coroutine backend $coroutine"
2830519175a2SAlex Barcelo  echo
2831519175a2SAlex Barcelo  exit 1
2832d0e2fce5SAneesh Kumar K.Vfi
2833d0e2fce5SAneesh Kumar K.V
2834d0e2fce5SAneesh Kumar K.V##########################################
2835d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
2836d2042378SAneesh Kumar K.V
2837d2042378SAneesh Kumar K.Vopen_by_hande_at=no
2838d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
2839d2042378SAneesh Kumar K.V#include <fcntl.h>
2840acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
2841acc55ba8SStefan Weil# error missing definition
2842acc55ba8SStefan Weil#else
284375cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
2844acc55ba8SStefan Weil#endif
2845d2042378SAneesh Kumar K.VEOF
2846d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
2847d2042378SAneesh Kumar K.V    open_by_handle_at=yes
2848d2042378SAneesh Kumar K.Vfi
2849d2042378SAneesh Kumar K.V
2850e06a765eSHarsh Prateek Bora########################################
2851e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
2852e06a765eSHarsh Prateek Bora
2853e06a765eSHarsh Prateek Boralinux_magic_h=no
2854e06a765eSHarsh Prateek Boracat > $TMPC << EOF
2855e06a765eSHarsh Prateek Bora#include <linux/magic.h>
2856e06a765eSHarsh Prateek Boraint main(void) {
285775cafad7SStefan Weil  return 0;
2858e06a765eSHarsh Prateek Bora}
2859e06a765eSHarsh Prateek BoraEOF
2860e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
2861e06a765eSHarsh Prateek Bora    linux_magic_h=yes
2862e06a765eSHarsh Prateek Borafi
2863e06a765eSHarsh Prateek Bora
28648ab1bf12SLuiz Capitulino########################################
28658ab1bf12SLuiz Capitulino# check if environ is declared
28668ab1bf12SLuiz Capitulino
28678ab1bf12SLuiz Capitulinohas_environ=no
28688ab1bf12SLuiz Capitulinocat > $TMPC << EOF
28698ab1bf12SLuiz Capitulino#include <unistd.h>
28708ab1bf12SLuiz Capitulinoint main(void) {
28718ab1bf12SLuiz Capitulino    environ = environ;
28728ab1bf12SLuiz Capitulino    return 0;
28738ab1bf12SLuiz Capitulino}
28748ab1bf12SLuiz CapitulinoEOF
28758ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
28768ab1bf12SLuiz Capitulino    has_environ=yes
28778ab1bf12SLuiz Capitulinofi
28788ab1bf12SLuiz Capitulino
2879d2042378SAneesh Kumar K.V##########################################
2880e86ecd4bSJuan Quintela# End of CC checks
2881e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2882e86ecd4bSJuan Quintela
2883e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
28848be74dc0SAvi Kivity  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
2885e86ecd4bSJuan Quintelafi
2886a316e378SJuan Quintela
2887e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
2888e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
2889e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
289020ff6c80SAnthony Liguori
289120ff6c80SAnthony Liguoriif test -z "$werror" ; then
2892e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
2893e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
2894e86ecd4bSJuan Quintela        werror="yes"
2895e86ecd4bSJuan Quintela    else
2896e86ecd4bSJuan Quintela        werror="no"
2897e86ecd4bSJuan Quintela    fi
2898e86ecd4bSJuan Quintelafi
2899e86ecd4bSJuan Quintela
290020ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
290120ff6c80SAnthony Liguori# enable/disable
290220ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
290320ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
290420ff6c80SAnthony Liguori	zero_malloc="no"
290520ff6c80SAnthony Liguori    else
290620ff6c80SAnthony Liguori	zero_malloc="yes"
290720ff6c80SAnthony Liguori    fi
290820ff6c80SAnthony Liguorifi
290920ff6c80SAnthony Liguori
2910e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
2911a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2912e86ecd4bSJuan Quintelafi
2913e86ecd4bSJuan Quintela
2914e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2915e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
29161156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2917e86ecd4bSJuan Quintela    fi
2918e86ecd4bSJuan Quintelafi
2919e86ecd4bSJuan Quintela
292094dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
292194dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
292294dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
292394dd53c5SGerd Hoffmannelse
292494dd53c5SGerd Hoffmann    POD2MAN="pod2man"
292594dd53c5SGerd Hoffmannfi
292694dd53c5SGerd Hoffmann
2927952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
2928952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
2929952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
2930952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2931952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
2932952afb71SBlue Swirl        fi
2933952afb71SBlue Swirl    done
2934952afb71SBlue Swirlfi
2935952afb71SBlue Swirl
293610ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
2937528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
29385a67135aSbellard
2939ca35f780SPaolo Bonzinitools=
2940ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2941ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2942983eef5aSMeador Inge  if test "$virtfs" != no ; then
2943be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
2944983eef5aSMeador Inge      virtfs=yes
294517bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
2946983eef5aSMeador Inge    else
2947983eef5aSMeador Inge      if test "$virtfs" = yes; then
2948263ddcc8SHarsh Prateek Bora        echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
2949263ddcc8SHarsh Prateek Bora        exit 1
2950983eef5aSMeador Inge      fi
295117500370SAndreas Färber      virtfs=no
2952983eef5aSMeador Inge    fi
295317bff52bSM. Mohan Kumar  fi
2954ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2955ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2956d138cee9SMichael Roth    if [ "$guest_agent" = "yes" ]; then
295748ff7a62SMichael Roth      tools="qemu-ga\$(EXESUF) $tools"
2958d138cee9SMichael Roth    fi
2959ca35f780SPaolo Bonzini  fi
2960ca35f780SPaolo Bonzinifi
296100c705fbSPaolo Bonziniif test "$smartcard_nss" = "yes" ; then
296200c705fbSPaolo Bonzini  tools="vscclient\$(EXESUF) $tools"
296300c705fbSPaolo Bonzinifi
2964ca35f780SPaolo Bonzini
2965ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
2966ca35f780SPaolo Bonziniroms=
2967ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2968ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2969ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
2970ca35f780SPaolo Bonzini  roms="optionrom"
2971ca35f780SPaolo Bonzinifi
2972d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
297339ac8455SDavid Gibson  roms="$roms spapr-rtas"
297439ac8455SDavid Gibsonfi
2975ca35f780SPaolo Bonzini
29767d13299dSbellardecho "Install prefix    $prefix"
2977c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
2978f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
29793aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
29800f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
29811c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
298211d9f695Sbellardif test "$mingw32" = "no" ; then
2983f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
298443ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
298511d9f695Sbellardfi
29865a67135aSbellardecho "Source path       $source_path"
29877d13299dSbellardecho "C compiler        $cc"
298883469015Sbellardecho "Host C compiler   $host_cc"
29890c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
2990a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
29910c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
29927d13299dSbellardecho "make              $make"
29936a882643Spbrookecho "install           $install"
2994c886edfbSBlue Swirlecho "python            $python"
2995e2d8830eSBradif test "$slirp" = "yes" ; then
2996e2d8830eSBrad    echo "smbd              $smbd"
2997e2d8830eSBradfi
2998a98fd896Sbellardecho "host CPU          $cpu"
2999de83cd02Sbellardecho "host big endian   $bigendian"
300097a847bcSbellardecho "target list       $target_list"
3001ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
3002b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
30037d13299dSbellardecho "gprof enabled     $gprof"
300403b4fe7dSaliguoriecho "sparse enabled    $sparse"
30051625af87Saliguoriecho "strip binaries    $strip_opt"
300605c2a3e7Sbellardecho "profiler          $profiler"
300743ce4dfeSbellardecho "static build      $static"
300885aa5189Sbellardecho "-Werror enabled   $werror"
30095b0753e0Sbellardif test "$darwin" = "yes" ; then
30105b0753e0Sbellard    echo "Cocoa support     $cocoa"
30115b0753e0Sbellardfi
301297a847bcSbellardecho "SDL support       $sdl"
30134d3b6f6eSbalrogecho "curses support    $curses"
3014769ce76dSAlexander Grafecho "curl support      $curl"
301567b915a5Sbellardecho "mingw32 support   $mingw32"
30160c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
30170c58ac1cSmalcecho "Extra audio cards $audio_card_list"
3018eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
30198ff9cbf7Smalcecho "Mixer emulation   $mixemu"
3020983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3021821601eaSJes Sorensenecho "VNC support       $vnc"
3022821601eaSJes Sorensenif test "$vnc" = "yes" ; then
30238d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
30242f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
30252f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3026efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
3027bd023f95SCorentin Chary    echo "VNC thread        $vnc_thread"
3028821601eaSJes Sorensenfi
30293142255cSblueswir1if test -n "$sparc_cpu"; then
30303142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
30313142255cSblueswir1fi
3032e37630caSaliguoriecho "xen support       $xen"
30332e4d9fb1Saurel32echo "brlapi support    $brlapi"
3034a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3035a25dba17SJuan Quintelaecho "Documentation     $docs"
3036c5937220Spbrook[ ! -z "$uname_release" ] && \
3037c5937220Spbrookecho "uname -r          $uname_release"
3038bd0c5661Spbrookecho "NPTL support      $nptl"
3039379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
304040d6444eSAvi Kivityecho "PIE               $pie"
30418a16d273Sthsecho "vde support       $vde"
30425c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3043758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
304477755340Sthsecho "Install blobs     $blobs"
3045b31a0277SJuan Quintelaecho "KVM support       $kvm"
30469195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3047f652e6afSaurel32echo "fdt support       $fdt"
3048ceb42de8Saliguoriecho "preadv support    $preadv"
30495f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3050e78815a5SAndreas Färberecho "madvise           $madvise"
3051e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
3052ee682d27SStefan Weilecho "uuid support      $uuid"
305347e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3054d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
305594a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
30569410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
3057cd4ec0b4SGerd Hoffmannecho "spice support     $spice"
3058f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3059dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3060111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
306169354a83SHans de Goedeecho "usb net redir     $usb_redir"
306220ff075bSMichael Walleecho "OpenGL support    $opengl"
3063c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3064d138cee9SMichael Rothecho "build guest agent $guest_agent"
3065519175a2SAlex Barceloecho "coroutine backend $coroutine_backend"
306667b915a5Sbellard
30671ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
306824b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3069e8cd23deSbellardfi
307097a847bcSbellard
307198ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
30724bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
307397a847bcSbellard
307498ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
307598ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
307698ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
307798ec69acSJuan Quintelaecho >> $config_host_mak
307898ec69acSJuan Quintela
3079e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
308099d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
308199d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
30823aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
30830f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
308499d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
308599d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
308622d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
30879afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
30889afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
30897b93fadfSCorey Bryantecho "libexecdir=\${prefix}/libexec" >> $config_host_mak
3090a7c36ee4SCorey Bryantecho "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
3091804edf29SJuan Quintela
309298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3093f8393946Saurel32if test "$debug_tcg" = "yes" ; then
30942358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3095f8393946Saurel32fi
3096b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
3097b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
3098b4475aa2SLuiz Capitulinofi
3099f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
31002358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
3101f3d08ee6SPaul Brookfi
31021625af87Saliguoriif test "$strip_opt" = "yes" ; then
310352ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
31041625af87Saliguorifi
31057d13299dSbellardif test "$bigendian" = "yes" ; then
3106e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
310797a847bcSbellardfi
310867b915a5Sbellardif test "$mingw32" = "yes" ; then
310998ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
31109fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
31119fe6de94SBlue Swirl  version_major=${rc_version%%.*}
31129fe6de94SBlue Swirl  rc_version=${rc_version#*.}
31139fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
31149fe6de94SBlue Swirl  rc_version=${rc_version#*.}
31159fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
31169fe6de94SBlue Swirl  version_micro=0
31179fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
31189fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3119210fa556Spbrookelse
312035f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3121210fa556Spbrookfi
3122128ab2ffSblueswir1
3123dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3124dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3125dffcb71cSMark McLoughlinfi
3126dffcb71cSMark McLoughlin
312783fb7adfSbellardif test "$darwin" = "yes" ; then
312898ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
312983fb7adfSbellardfi
3130b29fe3edSmalc
3131b29fe3edSmalcif test "$aix" = "yes" ; then
313298ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3133b29fe3edSmalcfi
3134b29fe3edSmalc
3135ec530c81Sbellardif test "$solaris" = "yes" ; then
313698ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
31372358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
31380475a5caSths  if test "$needs_libsunmath" = "yes" ; then
313975b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
31400475a5caSths  fi
3141ec530c81Sbellardfi
3142179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3143179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3144179cf400SAndreas Färberfi
314597a847bcSbellardif test "$static" = "yes" ; then
314698ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
314797a847bcSbellardfi
31481ba16968SStefan Weilif test "$profiler" = "yes" ; then
31492358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
315005c2a3e7Sbellardfi
3151c20709aaSbellardif test "$slirp" = "yes" ; then
315298ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3153e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3154f9728943SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
3155c20709aaSbellardfi
31568a16d273Sthsif test "$vde" = "yes" ; then
315798ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
31588a16d273Sthsfi
315947e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
316047e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
316147e98658SCorey Bryantfi
31620c58ac1cSmalcfor card in $audio_card_list; do
3163bb55b712SStefan Weil    def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
316498ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
31650c58ac1cSmalcdone
31662358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
31670c58ac1cSmalcfor drv in $audio_drv_list; do
3168bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
316998ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3170923e4521Smalc    if test "$drv" = "fmod"; then
31717aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3172fb065187Sbellard    fi
31730c58ac1cSmalcdone
317467f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
317567f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
317667f86e8eSJuan Quintelafi
3177d5631638Smalcif test "$audio_win_int" = "yes" ; then
3178d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3179d5631638Smalcfi
3180eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
31818ff9cbf7Smalcif test "$mixemu" = "yes" ; then
318298ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
31838ff9cbf7Smalcfi
3184821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3185821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3186821601eaSJes Sorensenfi
31878d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
318898ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
3189525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
31908d5d2d4cSthsfi
31912f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
319298ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
319360ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
31942f9606b3Saliguorifi
3195821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
31962f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
31972f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
31982f6f5c7aSCorentin Charyfi
3199821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3200efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3201efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3202efe556adSCorentin Charyfi
3203821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then
3204bd023f95SCorentin Chary  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
3205bd023f95SCorentin Charyfi
320676655d6dSaliguoriif test "$fnmatch" = "yes" ; then
32072358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
320876655d6dSaliguorifi
3209ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3210ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3211ee682d27SStefan Weilfi
3212dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3213dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3214dce512deSChristoph Hellwigfi
3215b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
321698ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
32172358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
321898ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
321998ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3220a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
322198ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3222cc8ae6deSpbrookfi
32231ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
322498ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
32258ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
322649ecc3faSbellardfi
322749ecc3faSbellardif test "$cocoa" = "yes" ; then
322898ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
322949ecc3faSbellardfi
32304d3b6f6eSbalrogif test "$curses" = "yes" ; then
323198ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3232ab4e5602SJan Kiszkafi
32333b3f24adSaurel32if test "$atfile" = "yes" ; then
32342358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
32353b3f24adSaurel32fi
3236ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
32372358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3238ebc996f3SRiku Voipiofi
3239099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
32402358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3241099d6b0fSRiku Voipiofi
324240ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
324340ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
324440ff6d7eSKevin Wolffi
32453ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
32462358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
32473ce34dfbSvibisreenivasanfi
3248c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3249c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3250c2882b96SRiku Voipiofi
3251d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3252d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3253d0927938SUlrich Hechtfi
3254c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3255c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3256c727f47dSPeter Maydellfi
3257dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3258dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3259dace20dcSPeter Maydellfi
3260d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3261d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3262d0927938SUlrich Hechtfi
32633b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
32643b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
32653b6edd16SPeter Maydellfi
32663b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
32673b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
32683b6edd16SPeter Maydellfi
32693b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
32703b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
32713b6edd16SPeter Maydellfi
32723b3f24adSaurel32if test "$inotify" = "yes" ; then
32732358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
32743b3f24adSaurel32fi
3275c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
3276c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3277c05c7a73SRiku Voipiofi
32786ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
32796ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
32806ae9a1f4SJuan Quintelafi
32816ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
32826ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
32836ae9a1f4SJuan Quintelafi
3284769ce76dSAlexander Grafif test "$curl" = "yes" ; then
328598ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
3286b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3287769ce76dSAlexander Graffi
32882e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
328998ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
32902e4d9fb1Saurel32fi
3291fb599c9aSbalrogif test "$bluez" = "yes" ; then
329298ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
3293ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3294fb599c9aSbalrogfi
3295e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3296e37630caSaliguoriif test "$xen" = "yes" ; then
32976dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3298d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3299e37630caSaliguorifi
33005c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
33015c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
33025c6c3a6cSChristoph Hellwigfi
3303758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
3304758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
3305758e8e38SVenkateswararao Jujjuri (JV)fi
33064f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
33074f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
33084f26f2b6SAvi Kivityfi
3309983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
3310758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
3311758e8e38SVenkateswararao Jujjuri (JV)fi
331277755340Sthsif test "$blobs" = "yes" ; then
331398ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
331477755340Sthsfi
3315bf9298b9Saliguoriif test "$iovec" = "yes" ; then
33162358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
3317bf9298b9Saliguorifi
3318ceb42de8Saliguoriif test "$preadv" = "yes" ; then
33192358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
3320ceb42de8Saliguorifi
3321f652e6afSaurel32if test "$fdt" = "yes" ; then
33223f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
3323f652e6afSaurel32fi
3324dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
3325dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3326dcc38d1cSMarcelo Tosattifi
33279195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
33289195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
33299195b2c2SStefan Weilfi
33305f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
33315f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
33325f6b9e8fSBlue Swirlfi
3333e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
3334e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
3335e78815a5SAndreas Färberfi
3336e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
3337e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3338e78815a5SAndreas Färberfi
333997a847bcSbellard
3340cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
3341cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
3342cd4ec0b4SGerd Hoffmannfi
3343cd4ec0b4SGerd Hoffmann
334436707144SAlon Levyif test "$smartcard" = "yes" ; then
334536707144SAlon Levy  echo "CONFIG_SMARTCARD=y" >> $config_host_mak
334636707144SAlon Levyfi
334736707144SAlon Levy
3348111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3349111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3350ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3351ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3352111a38b0SRobert Relyeafi
3353111a38b0SRobert Relyea
335469354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
335569354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
335669354a83SHans de Goedefi
335769354a83SHans de Goede
335820ff075bSMichael Walleif test "$opengl" = "yes" ; then
335920ff075bSMichael Walle  echo "CONFIG_OPENGL=y" >> $config_host_mak
336020ff075bSMichael Wallefi
336120ff075bSMichael Walle
3362c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
3363c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3364c589b249SRonnie Sahlbergfi
3365c589b249SRonnie Sahlberg
336683fb7adfSbellard# XXX: suppress that
33677d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
33682358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
33697d3505c5Sbellardfi
33707d3505c5Sbellard
33712358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3372c5937220Spbrook
337320ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
337420ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
337520ff6c80SAnthony Liguorifi
3376f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
3377f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
3378f27aaf4bSChristian Brunnerfi
337920ff6c80SAnthony Liguori
3380519175a2SAlex Barceloif test "$coroutine_backend" = "ucontext" ; then
3381d0e2fce5SAneesh Kumar K.V  echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3382fe91bfa8SAlex Barceloelif test "$coroutine_backend" = "sigaltstack" ; then
3383fe91bfa8SAlex Barcelo  echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
3384d0e2fce5SAneesh Kumar K.Vfi
3385d0e2fce5SAneesh Kumar K.V
3386d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
3387d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3388d2042378SAneesh Kumar K.Vfi
3389d2042378SAneesh Kumar K.V
3390e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
3391e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3392e06a765eSHarsh Prateek Borafi
3393e06a765eSHarsh Prateek Bora
33948ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
33958ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
33968ab1bf12SLuiz Capitulinofi
33978ab1bf12SLuiz Capitulino
339868063649Sblueswir1# USB host support
339968063649Sblueswir1case "$usb" in
340068063649Sblueswir1linux)
340198ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
340268063649Sblueswir1;;
340368063649Sblueswir1bsd)
340498ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
340568063649Sblueswir1;;
340668063649Sblueswir1*)
340798ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
340868063649Sblueswir1;;
340968063649Sblueswir1esac
341068063649Sblueswir1
3411e4858974SLluís# use default implementation for tracing backend-specific routines
3412e4858974SLluístrace_default=yes
341394a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
34146d8a764eSLluísif test "$trace_backend" = "nop"; then
34156d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
341622890ab5SPrerna Saxenafi
34179410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
34186d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3419e4858974SLluís  trace_default=no
34206d8a764eSLluís  # Set the appropriate trace file.
3421953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
34229410b56cSPrerna Saxenafi
34236d8a764eSLluísif test "$trace_backend" = "stderr"; then
34246d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
34259a82b6a5SLluís  trace_default=no
34266d8a764eSLluísfi
34276d8a764eSLluísif test "$trace_backend" = "ust"; then
34286d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
34296d8a764eSLluísfi
34306d8a764eSLluísif test "$trace_backend" = "dtrace"; then
34316d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
34326d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
34336d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
34346d8a764eSLluís  fi
3435c276b17dSDaniel P. Berrangefi
34369410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3437e4858974SLluísif test "$trace_default" = "yes"; then
3438e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3439e4858974SLluísfi
34409410b56cSPrerna Saxena
344198ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
344298ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
3443804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
3444804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
34451901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
34461901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
34471901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3448c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
3449804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
34502b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
3451804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
3452804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
3453804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
3454804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
34559fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
345644dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
3457e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
3458a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3459f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3460e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
3461e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
3462e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
3463e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3464e39f0062SPaolo Bonzinifi
3465c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3466e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
3467a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3468a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
346973da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
34703e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3471804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
3472957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
347394dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
3474804edf29SJuan Quintela
34754bf6b55bSJuan Quintela# generate list of library paths for linker script
34764bf6b55bSJuan Quintela
34774bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
34784bf6b55bSJuan Quintela
34794bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
34804bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
34814bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
34824bf6b55bSJuan Quintela  else
34834bf6b55bSJuan Quintela    rm ${config_host_ld}~
34844bf6b55bSJuan Quintela  fi
34854bf6b55bSJuan Quintelafi
34864bf6b55bSJuan Quintela
34874d904533SBlue Swirlfor d in libdis libdis-user; do
348872b8b5a1SStefan Weil    symlink "$source_path/Makefile.dis" "$d/Makefile"
34894d904533SBlue Swirl    echo > $d/config.mak
34904d904533SBlue Swirldone
34914d904533SBlue Swirl
34926efd7517SPeter Maydell# use included Linux headers
34936efd7517SPeter Maydellif test "$linux" = "yes" ; then
34946efd7517SPeter Maydell  case "$cpu" in
34956efd7517SPeter Maydell  i386|x86_64)
349672b8b5a1SStefan Weil    symlink "$source_path/linux-headers/asm-x86" linux-headers/asm
34976efd7517SPeter Maydell    ;;
34986efd7517SPeter Maydell  ppcemb|ppc|ppc64)
349972b8b5a1SStefan Weil    symlink "$source_path/linux-headers/asm-powerpc" linux-headers/asm
35006efd7517SPeter Maydell    ;;
35016efd7517SPeter Maydell  s390x)
350272b8b5a1SStefan Weil    symlink "$source_path/linux-headers/asm-s390" linux-headers/asm
35036efd7517SPeter Maydell    ;;
35046efd7517SPeter Maydell  esac
35056efd7517SPeter Maydellfi
35066efd7517SPeter Maydell
350797a847bcSbellardfor target in $target_list; do
350897a847bcSbellardtarget_dir="$target"
350925be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
3510600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
351197a847bcSbellardtarget_bigendian="no"
35121f3d3c8fSJuan Quintela
3513ea2d6a39SJuan Quintelacase "$target_arch2" in
3514cfa550c6SMax Filippov  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3515ea2d6a39SJuan Quintela  target_bigendian=yes
3516ea2d6a39SJuan Quintela  ;;
3517ea2d6a39SJuan Quintelaesac
351897a847bcSbellardtarget_softmmu="no"
3519997344f3Sbellardtarget_user_only="no"
3520831b7825Sthstarget_linux_user="no"
352184778508Sblueswir1target_bsd_user="no"
35229e407a85Spbrookcase "$target" in
3523600309b6SBlue Swirl  ${target_arch2}-softmmu)
35249e407a85Spbrook    target_softmmu="yes"
35259e407a85Spbrook    ;;
3526600309b6SBlue Swirl  ${target_arch2}-linux-user)
35279c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
35289c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
35299c7a4202SBlue Swirl      exit 1
35309c7a4202SBlue Swirl    fi
35319e407a85Spbrook    target_user_only="yes"
35329e407a85Spbrook    target_linux_user="yes"
35339e407a85Spbrook    ;;
3534600309b6SBlue Swirl  ${target_arch2}-bsd-user)
35359cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
35369c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
35379c7a4202SBlue Swirl      exit 1
35389c7a4202SBlue Swirl    fi
353984778508Sblueswir1    target_user_only="yes"
354084778508Sblueswir1    target_bsd_user="yes"
354184778508Sblueswir1    ;;
35429e407a85Spbrook  *)
35439e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
35449e407a85Spbrook    exit 1
35459e407a85Spbrook    ;;
35469e407a85Spbrookesac
3547831b7825Sths
354897a847bcSbellardmkdir -p $target_dir
354925be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
355097a847bcSbellard
3551e5fe0c52Spbrookbflt="no"
3552bd0c5661Spbrooktarget_nptl="no"
3553600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
355456aebc89Spbrookgdb_xml_files=""
3555c2e3dee6SLaurent Viviertarget_short_alignment=2
3556c2e3dee6SLaurent Viviertarget_int_alignment=4
3557c2e3dee6SLaurent Viviertarget_long_alignment=4
3558c2e3dee6SLaurent Viviertarget_llong_alignment=8
3559de3a354aSMichael Walletarget_libs_softmmu=
35607ba1e619Saliguori
3561938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
35626acff7daSJuan QuintelaTARGET_BASE_ARCH=""
3563e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
3564e73aae67SJuan Quintela
3565600309b6SBlue Swirlcase "$target_arch2" in
35662408a527Saurel32  i386)
356771deff27SAurelien Jarno    target_phys_bits=64
35682408a527Saurel32  ;;
35692408a527Saurel32  x86_64)
35706acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
35711ad2134fSPaul Brook    target_phys_bits=64
3572c2e3dee6SLaurent Vivier    target_long_alignment=8
35732408a527Saurel32  ;;
35742408a527Saurel32  alpha)
35751ad2134fSPaul Brook    target_phys_bits=64
3576c2e3dee6SLaurent Vivier    target_long_alignment=8
3577a4b388ffSRichard Henderson    target_nptl="yes"
35782408a527Saurel32  ;;
35792408a527Saurel32  arm|armeb)
3580b498c8a0SJuan Quintela    TARGET_ARCH=arm
3581e5fe0c52Spbrook    bflt="yes"
3582bd0c5661Spbrook    target_nptl="yes"
358356aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
35841ad2134fSPaul Brook    target_phys_bits=32
3585c2e3dee6SLaurent Vivier    target_llong_alignment=4
3586412beee6SGrant Likely    target_libs_softmmu="$fdt_libs"
35872408a527Saurel32  ;;
35882408a527Saurel32  cris)
3589253bd7f8Sedgar_igl    target_nptl="yes"
35901ad2134fSPaul Brook    target_phys_bits=32
35912408a527Saurel32  ;;
3592613a22c9SMichael Walle  lm32)
3593613a22c9SMichael Walle    target_phys_bits=32
3594de3a354aSMichael Walle    target_libs_softmmu="$opengl_libs"
3595613a22c9SMichael Walle  ;;
35962408a527Saurel32  m68k)
35970938cda5Saurel32    bflt="yes"
359856aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
35991ad2134fSPaul Brook    target_phys_bits=32
3600c2e3dee6SLaurent Vivier    target_int_alignment=2
3601c2e3dee6SLaurent Vivier    target_long_alignment=2
3602c2e3dee6SLaurent Vivier    target_llong_alignment=2
36032408a527Saurel32  ;;
3604877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
3605877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
360672b675caSEdgar E. Iglesias    bflt="yes"
360772b675caSEdgar E. Iglesias    target_nptl="yes"
360872b675caSEdgar E. Iglesias    target_phys_bits=32
3609de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
361072b675caSEdgar E. Iglesias  ;;
36112408a527Saurel32  mips|mipsel)
3612b498c8a0SJuan Quintela    TARGET_ARCH=mips
361325be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3614f04dc72fSPaul Brook    target_nptl="yes"
36151ad2134fSPaul Brook    target_phys_bits=64
36162408a527Saurel32  ;;
36172408a527Saurel32  mipsn32|mipsn32el)
3618b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
36196acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
362025be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
36211ad2134fSPaul Brook    target_phys_bits=64
36222408a527Saurel32  ;;
36232408a527Saurel32  mips64|mips64el)
3624b498c8a0SJuan Quintela    TARGET_ARCH=mips64
36256acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
362625be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
36271ad2134fSPaul Brook    target_phys_bits=64
3628c2e3dee6SLaurent Vivier    target_long_alignment=8
36292408a527Saurel32  ;;
36302408a527Saurel32  ppc)
3631c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
36328b242ebaSAlexander Graf    target_phys_bits=64
3633d6630708SNathan Froyd    target_nptl="yes"
3634de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
36352408a527Saurel32  ;;
36362408a527Saurel32  ppcemb)
36376acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3638e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3639c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
36401ad2134fSPaul Brook    target_phys_bits=64
3641d6630708SNathan Froyd    target_nptl="yes"
3642de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
36432408a527Saurel32  ;;
36442408a527Saurel32  ppc64)
36456acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3646e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3647c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
36481ad2134fSPaul Brook    target_phys_bits=64
3649c2e3dee6SLaurent Vivier    target_long_alignment=8
3650de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
36512408a527Saurel32  ;;
36522408a527Saurel32  ppc64abi32)
3653b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
36546acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3655e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
365625be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
3657c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
36581ad2134fSPaul Brook    target_phys_bits=64
3659de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
36602408a527Saurel32  ;;
36612408a527Saurel32  sh4|sh4eb)
3662b498c8a0SJuan Quintela    TARGET_ARCH=sh4
36634dbed897Spbrook    bflt="yes"
36640b6d3ae0Saurel32    target_nptl="yes"
36651ad2134fSPaul Brook    target_phys_bits=32
36662408a527Saurel32  ;;
36672408a527Saurel32  sparc)
36681ad2134fSPaul Brook    target_phys_bits=64
36692408a527Saurel32  ;;
36702408a527Saurel32  sparc64)
36716acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
36721ad2134fSPaul Brook    target_phys_bits=64
3673c2e3dee6SLaurent Vivier    target_long_alignment=8
36742408a527Saurel32  ;;
36752408a527Saurel32  sparc32plus)
3676b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
36776acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
3678e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
367925be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
36801ad2134fSPaul Brook    target_phys_bits=64
36812408a527Saurel32  ;;
368224e804ecSAlexander Graf  s390x)
3683bc434676SUlrich Hecht    target_nptl="yes"
368424e804ecSAlexander Graf    target_phys_bits=64
36857b3da903SAlexander Graf    target_long_alignment=8
368624e804ecSAlexander Graf  ;;
3687d2fbca94SGuan Xuetao  unicore32)
3688d2fbca94SGuan Xuetao    target_phys_bits=32
3689d2fbca94SGuan Xuetao  ;;
3690cfa550c6SMax Filippov  xtensa|xtensaeb)
3691cfa550c6SMax Filippov    TARGET_ARCH=xtensa
3692cfa550c6SMax Filippov    target_phys_bits=32
3693cfa550c6SMax Filippov  ;;
36942408a527Saurel32  *)
3695de83cd02Sbellard    echo "Unsupported target CPU"
3696de83cd02Sbellard    exit 1
36972408a527Saurel32  ;;
36982408a527Saurel32esac
36995e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
37005e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
37015e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
37025e8861a0SPaolo Bonzinifi
37035e8861a0SPaolo Bonzini
37045e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
37055e8861a0SPaolo Bonzini
37060184e266SBlue Swirl
37070184e266SBlue Swirlcase "$target_arch2" in
3708f492b82dSMax Filippov  alpha | sparc* | xtensa*)
37090184e266SBlue Swirl    echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
37100184e266SBlue Swirl  ;;
37110184e266SBlue Swirlesac
37120184e266SBlue Swirl
3713c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3714c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3715c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3716c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
371725be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3718bb55b712SStefan Weiltarget_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
371925be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
372025be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
372125be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3722e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
3723e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
3724e6e91b9cSJuan Quintelafi
372525be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
37261b0c87fcSJuan Quintelacase "$target_arch2" in
37271b0c87fcSJuan Quintela  i386|x86_64)
37281b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
372964b3cfdbSAnthony PERARD      target_phys_bits=64
373025be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
3731*eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
3732*eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
3733*eb6fda0fSAnthony PERARD      fi
373459d21e53SAlexander Graf    else
373559d21e53SAlexander Graf      echo "CONFIG_NO_XEN=y" >> $config_target_mak
3736432d268cSJun Nakajima    fi
373759d21e53SAlexander Graf    ;;
373859d21e53SAlexander Graf  *)
373959d21e53SAlexander Graf    echo "CONFIG_NO_XEN=y" >> $config_target_mak
37401b0c87fcSJuan Quintelaesac
3741c59249f9SJuan Quintelacase "$target_arch2" in
37420e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
3743c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
3744c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3745c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
3746c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
37475f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
3748adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
3749adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3750c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
3751c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
375225be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
37531ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
3754d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3755d5970055SMichael S. Tsirkin      fi
3756c59249f9SJuan Quintela    fi
3757c59249f9SJuan Quintelaesac
3758fae001f5SWen Congyangcase "$target_arch2" in
3759fae001f5SWen Congyang  i386|x86_64)
3760fae001f5SWen Congyang    echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak
3761fae001f5SWen Congyangesac
37627f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
37630a6b8ddeSAlexander Graf  echo "CONFIG_PSERIES=y" >> $config_target_mak
37640a6b8ddeSAlexander Graffi
3765de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
376625be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
376797a847bcSbellardfi
376897a847bcSbellardif test "$target_softmmu" = "yes" ; then
3769b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
377025be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3771de3a354aSMichael Walle  echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
37720e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
37735791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3774ad4cf3f6SPaul Brook  if test "$smartcard_nss" = "yes" ; then
3775ad4cf3f6SPaul Brook    echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3776ad4cf3f6SPaul Brook  fi
37779fecbed0SWen Congyang  case "$target_arch2" in
37789fecbed0SWen Congyang    i386|x86_64)
37799fecbed0SWen Congyang      echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak
37809fecbed0SWen Congyang  esac
3781de83cd02Sbellardfi
3782997344f3Sbellardif test "$target_user_only" = "yes" ; then
378325be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3784a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3785997344f3Sbellardfi
3786831b7825Sthsif test "$target_linux_user" = "yes" ; then
378725be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3788831b7825Sthsfi
378956aebc89Spbrooklist=""
379056aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
379156aebc89Spbrook  for x in $gdb_xml_files; do
379256aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
379356aebc89Spbrook  done
379425be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
37953d0f1517SJuan Quintelafi
3796de83cd02Sbellard
3797e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
379825be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3799e5fe0c52Spbrookfi
3800bd0c5661Spbrookif test "$target_user_only" = "yes" \
3801bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
380225be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3803bd0c5661Spbrookfi
3804379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
380525be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3806379f6698SPaul Brookfi
380784778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
380825be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
380984778508Sblueswir1fi
38105b0753e0Sbellard
38114afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
3812fa282484SJuan Quintela
38134afddb55SJuan Quintelacflags=""
3814f9728943SPaolo Bonziniincludes=""
3815fa282484SJuan Quintelaldflags=""
38169b8e111fSJuan Quintela
38179195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then
38189195b2c2SStefan Weil  includes="-I\$(SRC_PATH)/tcg/tci $includes"
38199195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then
3820f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
382124e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
3822f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
38235d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
3824f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
382557ddfbf7SJuan Quintelaelse
3826f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
382757ddfbf7SJuan Quintelafi
3828f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
382957ddfbf7SJuan Quintela
38306efd7517SPeter Maydellif test "$linux" = "yes" ; then
38316efd7517SPeter Maydell  includes="-I\$(SRC_PATH)/linux-headers $includes"
38326efd7517SPeter Maydellfi
38336efd7517SPeter Maydell
38344d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
38354d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
38364d904533SBlue Swirlelse
38374d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
38384d904533SBlue Swirlfi
38394d904533SBlue Swirl
384064656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
384164656024SJuan Quintela  case "$i" in
384264656024SJuan Quintela  alpha)
384325be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
38444d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
384564656024SJuan Quintela  ;;
384664656024SJuan Quintela  arm)
384725be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
38484d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
384964656024SJuan Quintela  ;;
385064656024SJuan Quintela  cris)
385125be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
38524d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
385364656024SJuan Quintela  ;;
385464656024SJuan Quintela  hppa)
385525be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
38564d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
385764656024SJuan Quintela  ;;
385864656024SJuan Quintela  i386|x86_64)
385925be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
38604d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
386164656024SJuan Quintela  ;;
3862903ec55cSAurelien Jarno  ia64*)
3863903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
3864903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
3865903ec55cSAurelien Jarno  ;;
386679368f49SMichael Walle  lm32)
386779368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
386879368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $libdis_config_mak
386979368f49SMichael Walle  ;;
387064656024SJuan Quintela  m68k)
387125be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
38724d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
387364656024SJuan Quintela  ;;
3874877fdc12SEdgar E. Iglesias  microblaze*)
387525be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
38764d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
387764656024SJuan Quintela  ;;
387864656024SJuan Quintela  mips*)
387925be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
38804d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
388164656024SJuan Quintela  ;;
388264656024SJuan Quintela  ppc*)
388325be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
38844d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
388564656024SJuan Quintela  ;;
388624e804ecSAlexander Graf  s390*)
388725be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
38884d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
388964656024SJuan Quintela  ;;
389064656024SJuan Quintela  sh4)
389125be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
38924d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
389364656024SJuan Quintela  ;;
389464656024SJuan Quintela  sparc*)
389525be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
38964d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
389764656024SJuan Quintela  ;;
3898cfa550c6SMax Filippov  xtensa*)
3899cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
3900cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $libdis_config_mak
3901cfa550c6SMax Filippov  ;;
390264656024SJuan Quintela  esac
390364656024SJuan Quinteladone
39049195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
39059195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
39069195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $libdis_config_mak
39079195b2c2SStefan Weilfi
390864656024SJuan Quintela
39096ee7126fSJuan Quintelacase "$ARCH" in
39106ee7126fSJuan Quintelaalpha)
39116ee7126fSJuan Quintela  # Ensure there's only a single GP
39126ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
39136ee7126fSJuan Quintela;;
39146ee7126fSJuan Quintelaesac
39156ee7126fSJuan Quintela
391655d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
391755d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
391855d9c04bSJuan Quintela  arm)
391955d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
392055d9c04bSJuan Quintela  ;;
392125a8bb96SMichael Walle  lm32)
392225a8bb96SMichael Walle    cflags="-DHAS_AUDIO $cflags"
392325a8bb96SMichael Walle  ;;
392455d9c04bSJuan Quintela  i386|mips|ppc)
392555d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
392655d9c04bSJuan Quintela  ;;
392755d9c04bSJuan Quintela  esac
392855d9c04bSJuan Quintelafi
392955d9c04bSJuan Quintela
3930d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
393125be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
3932d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
3933d02c1db3SJuan Quintela    cflags="-p $cflags"
3934d02c1db3SJuan Quintela    ldflags="-p $ldflags"
3935d02c1db3SJuan Quintela  fi
3936d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
3937d02c1db3SJuan Quintela    ldflags="-p $ldflags"
393825be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
3939d02c1db3SJuan Quintela  fi
3940d02c1db3SJuan Quintelafi
3941d02c1db3SJuan Quintela
39429195b2c2SStefan Weilif test "$ARCH" = "tci"; then
39439195b2c2SStefan Weil  linker_script=""
39449195b2c2SStefan Weilelse
39456ee7126fSJuan Quintela  linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
39469195b2c2SStefan Weilfi
39479195b2c2SStefan Weil
39489b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3949fa282484SJuan Quintela  case "$ARCH" in
3950fa282484SJuan Quintela  sparc)
3951fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
3952322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
3953fa282484SJuan Quintela    ;;
39544d58be06SRichard Henderson  alpha | s390x)
39554d58be06SRichard Henderson    # The default placement of the application is fine.
39564d58be06SRichard Henderson    ;;
3957fd76e73aSRichard Henderson  *)
3958322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
3959fa282484SJuan Quintela    ;;
3960fa282484SJuan Quintela  esac
3961fa282484SJuan Quintelafi
3962fa282484SJuan Quintela
396325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
396425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3965f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
3966fa282484SJuan Quintela
396797a847bcSbellarddone # for target in $targets
39687d13299dSbellard
3969d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
3970927b241dSMichael WalleDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
39712dee8d54SPaolo BonziniDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
39722d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
39732dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
397400c705fbSPaolo BonziniDIRS="$DIRS libcacard libcacard/libcacard libcacard/trace"
3975c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
3976c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
397700c705fbSPaolo BonziniFILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile"
3978ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3979446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
39802d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3981753d11f2SRichard Hendersonfor bios_file in \
3982753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
3983753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
3984753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
3985753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
3986753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
3987753d11f2SRichard Hendersondo
39887ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
39897ea78b74SJan Kiszkadone
3990d1807a4fSPaolo Bonzinimkdir -p $DIRS
39917d13299dSbellardfor f in $FILES ; do
399272b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
3993f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
3994f9245e10SPeter Maydell    fi
39957d13299dSbellarddone
39961ad2134fSPaul Brook
3997c34ebfdcSAnthony Liguori# temporary config to build submodules
39982d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
3999c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
400037116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4001c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
4002c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4003c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
4004c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
4005c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4006c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
4007c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4008c34ebfdcSAnthony Liguoridone
4009c34ebfdcSAnthony Liguori
40101ad2134fSPaul Brookfor hwlib in 32 64; do
40111ad2134fSPaul Brook  d=libhw$hwlib
401272b8b5a1SStefan Weil  symlink "$source_path/Makefile.hw" "$d/Makefile"
401337116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
40141ad2134fSPaul Brookdone
4015add16157SBlue Swirl
4016add16157SBlue Swirld=libuser
401772b8b5a1SStefan Weilsymlink "$source_path/Makefile.user" "$d/Makefile"
4018b40292e7SJan Kiszka
4019b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4020b40292e7SJan Kiszka  mkdir -p QMP
4021b40292e7SJan Kiszkafi
4022