xref: /openbmc/qemu/configure (revision 0b22ef0f57a8910d849602bef0940edcd0553d2c)
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=""
9361dc008fSAnthony Liguoriaudio_card_list="ac97 es1370 sb16 hda"
9461dc008fSAnthony Liguoriaudio_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 Bonzinixen=""
138d5b93ddfSAnthony PERARDxen_ctrl_version=""
139eb6fda0fSAnthony PERARDxen_pci_passthrough=""
140377529c0SPaolo Bonzinilinux_aio=""
14147e98658SCorey Bryantcap_ng=""
142377529c0SPaolo Bonziniattr=""
1434f26f2b6SAvi Kivitylibattr=""
144377529c0SPaolo Bonzinixfs=""
145377529c0SPaolo Bonzini
146d41a75a2SBradvhost_net="no"
147d41a75a2SBradkvm="no"
148377529c0SPaolo Bonzinigprof="no"
149377529c0SPaolo Bonzinidebug_tcg="no"
150377529c0SPaolo Bonzinidebug_mon="no"
151377529c0SPaolo Bonzinidebug="no"
152377529c0SPaolo Bonzinistrip_opt="yes"
1539195b2c2SStefan Weiltcg_interpreter="no"
154377529c0SPaolo Bonzinibigendian="no"
155377529c0SPaolo Bonzinimingw32="no"
156377529c0SPaolo BonziniEXESUF=""
157377529c0SPaolo Bonziniprefix="/usr/local"
158377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
159528ae5b8SEduardo Habkostdatadir="\${prefix}/share"
160850da188SEduardo Habkostqemu_docdir="\${prefix}/share/doc/qemu"
161377529c0SPaolo Bonzinibindir="\${prefix}/bin"
1623aa5d2beSAlon Levylibdir="\${prefix}/lib"
1630f94d6daSAlon Levyincludedir="\${prefix}/include"
164377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
165377529c0SPaolo Bonziniconfsuffix="/qemu"
166377529c0SPaolo Bonzinislirp="yes"
167377529c0SPaolo Bonzinifmod_lib=""
168377529c0SPaolo Bonzinifmod_inc=""
169377529c0SPaolo Bonzinioss_lib=""
170377529c0SPaolo Bonzinibsd="no"
171377529c0SPaolo Bonzinilinux="no"
172377529c0SPaolo Bonzinisolaris="no"
173377529c0SPaolo Bonziniprofiler="no"
174377529c0SPaolo Bonzinicocoa="no"
175377529c0SPaolo Bonzinisoftmmu="yes"
176377529c0SPaolo Bonzinilinux_user="no"
177377529c0SPaolo Bonzinibsd_user="no"
178377529c0SPaolo Bonziniguest_base=""
179377529c0SPaolo Bonziniuname_release=""
180377529c0SPaolo Bonzinimixemu="no"
181377529c0SPaolo Bonziniaix="no"
182377529c0SPaolo Bonziniblobs="yes"
183377529c0SPaolo Bonzinipkgversion=""
18440d6444eSAvi Kivitypie=""
185377529c0SPaolo Bonzinizero_malloc=""
186377529c0SPaolo Bonzinitrace_backend="nop"
187377529c0SPaolo Bonzinitrace_file="trace"
188377529c0SPaolo Bonzinispice=""
189377529c0SPaolo Bonzinirbd=""
19036707144SAlon Levysmartcard=""
191111a38b0SRobert Relyeasmartcard_nss=""
19269354a83SHans de Goedeusb_redir=""
193430a3c18SMichael Walleopengl=""
1941ece9905SAlon Levyzlib="yes"
195d138cee9SMichael Rothguest_agent="yes"
196c589b249SRonnie Sahlberglibiscsi=""
197519175a2SAlex Barcelocoroutine=""
198377529c0SPaolo Bonzini
199ac0df51dSaliguori# parse CC options first
200ac0df51dSaliguorifor opt do
201ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
202ac0df51dSaliguori  case "$opt" in
203ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
204ac0df51dSaliguori  ;;
2053d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
206ac0df51dSaliguori  ;;
207ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
208ca4deeb1SPaolo Bonzini  ;;
2092ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
2102ff6b91eSJuan Quintela  ;;
211a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
212e2a2ed06SJuan Quintela  ;;
213e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
214e2a2ed06SJuan Quintela  ;;
2155bc62e01SGerd Hoffmann  --enable-debug-info) debug_info="yes"
2165bc62e01SGerd Hoffmann  ;;
2175bc62e01SGerd Hoffmann  --disable-debug-info) debug_info="no"
2185bc62e01SGerd Hoffmann  ;;
21950e7b1a0SJuan Quintela  --sparc_cpu=*)
22050e7b1a0SJuan Quintela    sparc_cpu="$optarg"
22150e7b1a0SJuan Quintela    case $sparc_cpu in
222ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
22350e7b1a0SJuan Quintela      cpu="sparc"
22450e7b1a0SJuan Quintela    ;;
22550e7b1a0SJuan Quintela    v9)
22650e7b1a0SJuan Quintela      cpu="sparc64"
22750e7b1a0SJuan Quintela    ;;
22850e7b1a0SJuan Quintela    *)
22950e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
23050e7b1a0SJuan Quintela      exit 1
23150e7b1a0SJuan Quintela    ;;
23250e7b1a0SJuan Quintela    esac
23350e7b1a0SJuan Quintela  ;;
234ac0df51dSaliguori  esac
235ac0df51dSaliguoridone
236ac0df51dSaliguori# OS specific
237ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
23893148aa5SStefan Weil# we can eliminate its usage altogether.
239ac0df51dSaliguori
240b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}"
241b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
242b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
243b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
2443f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
245b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
246b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
24717884d7bSSergei Trofimovichpkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
24817884d7bSSergei Trofimovichquery_pkg_config() {
24917884d7bSSergei Trofimovich    "${pkg_config_exe}" ${QEMU_PKG_CONFIG_FLAGS} "$@"
25017884d7bSSergei Trofimovich}
25117884d7bSSergei Trofimovichpkg_config=query_pkg_config
252b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
253ac0df51dSaliguori
254be17dc90SMichael S. Tsirkin# default flags for all hosts
255be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
256f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
257be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
258be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
259cbbab922SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
2605bc62e01SGerd Hoffmannif test "$debug_info" = "yes"; then
2615bc62e01SGerd Hoffmann    CFLAGS="-g $CFLAGS"
262be17dc90SMichael S. Tsirkin    LDFLAGS="-g $LDFLAGS"
2635bc62e01SGerd Hoffmannfi
264be17dc90SMichael S. Tsirkin
265ca4deeb1SPaolo Bonzini# make source path absolute
266ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
267ca4deeb1SPaolo Bonzini
268ac0df51dSaliguoricheck_define() {
269ac0df51dSaliguoricat > $TMPC <<EOF
270ac0df51dSaliguori#if !defined($1)
271fd786e1aSPeter Maydell#error $1 not defined
272ac0df51dSaliguori#endif
273ac0df51dSaliguoriint main(void) { return 0; }
274ac0df51dSaliguoriEOF
27552166aa0SJuan Quintela  compile_object
276ac0df51dSaliguori}
277ac0df51dSaliguori
2782ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
2792ff6b91eSJuan Quintela  # command line argument
2802ff6b91eSJuan Quintela  :
2812ff6b91eSJuan Quintelaelif check_define __i386__ ; then
282ac0df51dSaliguori  cpu="i386"
283ac0df51dSaliguorielif check_define __x86_64__ ; then
284ac0df51dSaliguori  cpu="x86_64"
2853aa9bd6cSblueswir1elif check_define __sparc__ ; then
2863aa9bd6cSblueswir1  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
2873aa9bd6cSblueswir1  # They must be specified using --sparc_cpu
2883aa9bd6cSblueswir1  if check_define __arch64__ ; then
2893aa9bd6cSblueswir1    cpu="sparc64"
2903aa9bd6cSblueswir1  else
2913aa9bd6cSblueswir1    cpu="sparc"
2923aa9bd6cSblueswir1  fi
293fdf7ed96Smalcelif check_define _ARCH_PPC ; then
294fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
295fdf7ed96Smalc    cpu="ppc64"
296ac0df51dSaliguori  else
297fdf7ed96Smalc    cpu="ppc"
298fdf7ed96Smalc  fi
299afa05235SAurelien Jarnoelif check_define __mips__ ; then
300afa05235SAurelien Jarno  cpu="mips"
301477ba620SAurelien Jarnoelif check_define __ia64__ ; then
302477ba620SAurelien Jarno  cpu="ia64"
303d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
304d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
305d66ed0eaSAurelien Jarno    cpu="s390x"
306d66ed0eaSAurelien Jarno  else
307d66ed0eaSAurelien Jarno    cpu="s390"
308d66ed0eaSAurelien Jarno  fi
30921d89f84SPeter Maydellelif check_define __arm__ ; then
31021d89f84SPeter Maydell  cpu="arm"
311f28ffed5SBradelif check_define __hppa__ ; then
312f28ffed5SBrad  cpu="hppa"
313fdf7ed96Smalcelse
314fdf7ed96Smalc  cpu=`uname -m`
315ac0df51dSaliguorifi
316ac0df51dSaliguori
317359bc95dSPeter MaydellARCH=
318359bc95dSPeter Maydell# Normalise host CPU name and set ARCH.
319359bc95dSPeter Maydell# Note that this case should only have supported host CPUs, not guests.
3207d13299dSbellardcase "$cpu" in
321359bc95dSPeter Maydell  ia64|ppc|ppc64|s390|s390x|sparc64)
322ea8f20f8SJuan Quintela    cpu="$cpu"
323ea8f20f8SJuan Quintela  ;;
3247d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
32597a847bcSbellard    cpu="i386"
3267d13299dSbellard  ;;
327aaa5fa14Saurel32  x86_64|amd64)
328aaa5fa14Saurel32    cpu="x86_64"
329aaa5fa14Saurel32  ;;
33021d89f84SPeter Maydell  armv*b|armv*l|arm)
33121d89f84SPeter Maydell    cpu="arm"
3327d13299dSbellard  ;;
333f28ffed5SBrad  hppa|parisc|parisc64)
334f54b3f92Saurel32    cpu="hppa"
335f54b3f92Saurel32  ;;
336afa05235SAurelien Jarno  mips*)
337afa05235SAurelien Jarno    cpu="mips"
338afa05235SAurelien Jarno  ;;
3393142255cSblueswir1  sparc|sun4[cdmuv])
340ae228531Sbellard    cpu="sparc"
341ae228531Sbellard  ;;
3427d13299dSbellard  *)
343359bc95dSPeter Maydell    # This will result in either an error or falling back to TCI later
344359bc95dSPeter Maydell    ARCH=unknown
3457d13299dSbellard  ;;
3467d13299dSbellardesac
347359bc95dSPeter Maydellif test -z "$ARCH"; then
348359bc95dSPeter Maydell  ARCH="$cpu"
349359bc95dSPeter Maydellfi
350e2d52ad3SJuan Quintela
3517d13299dSbellard# OS specific
352ac0df51dSaliguoriif check_define __linux__ ; then
353ac0df51dSaliguori  targetos="Linux"
354ac0df51dSaliguorielif check_define _WIN32 ; then
355ac0df51dSaliguori  targetos='MINGW32'
356169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
357169dc5d3Sblueswir1  targetos='OpenBSD'
358169dc5d3Sblueswir1elif check_define __sun__ ; then
359169dc5d3Sblueswir1  targetos='SunOS'
360179cf400SAndreas Färberelif check_define __HAIKU__ ; then
361179cf400SAndreas Färber  targetos='Haiku'
362ac0df51dSaliguorielse
3637d13299dSbellard  targetos=`uname -s`
364ac0df51dSaliguorifi
3650dbfc675SJuan Quintela
3667d13299dSbellardcase $targetos in
367c326e0afSbellardCYGWIN*)
368c326e0afSbellard  mingw32="yes"
369a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
370d5631638Smalc  audio_possible_drivers="winwave sdl"
371d5631638Smalc  audio_drv_list="winwave"
372c326e0afSbellard;;
37367b915a5SbellardMINGW32*)
37467b915a5Sbellard  mingw32="yes"
375d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
376d5631638Smalc  audio_drv_list="winwave"
37767b915a5Sbellard;;
3785c40d2bdSthsGNU/kFreeBSD)
379a167ba50SAurelien Jarno  bsd="yes"
3800c58ac1cSmalc  audio_drv_list="oss"
381f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3825c40d2bdSths;;
3837d3505c5SbellardFreeBSD)
3847d3505c5Sbellard  bsd="yes"
3850db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3860c58ac1cSmalc  audio_drv_list="oss"
387f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
388f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
389f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3907d3505c5Sbellard;;
391c5e97233Sblueswir1DragonFly)
392c5e97233Sblueswir1  bsd="yes"
3930db4a067SPaolo Bonzini  make="${MAKE-gmake}"
394c5e97233Sblueswir1  audio_drv_list="oss"
395c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
396c5e97233Sblueswir1;;
3977d3505c5SbellardNetBSD)
3987d3505c5Sbellard  bsd="yes"
3990db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4000c58ac1cSmalc  audio_drv_list="oss"
401c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4028ef92a88Sblueswir1  oss_lib="-lossaudio"
4037d3505c5Sbellard;;
4047d3505c5SbellardOpenBSD)
4057d3505c5Sbellard  bsd="yes"
4060db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4070c58ac1cSmalc  audio_drv_list="oss"
408c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
4092f6a1ab0Sblueswir1  oss_lib="-lossaudio"
4107d3505c5Sbellard;;
41183fb7adfSbellardDarwin)
41283fb7adfSbellard  bsd="yes"
41383fb7adfSbellard  darwin="yes"
4140dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
4150dbfc675SJuan Quintela  # run 64-bit userspace code
416aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
4171b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
418aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
4191b0f9cc2Saliguori  fi
4201b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
421a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
4220c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
4231b0f9cc2Saliguori  else
424a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
4251b0f9cc2Saliguori  fi
426fd677642Sths  cocoa="yes"
4270c58ac1cSmalc  audio_drv_list="coreaudio"
428c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4290c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4307973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
43183fb7adfSbellard;;
432ec530c81SbellardSunOS)
433ec530c81Sbellard  solaris="yes"
4340db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4350db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
436fa58948dSBlue Swirl  ld="gld"
437e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
4380475a5caSths  needs_libsunmath="no"
439c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
440ef18c883Sths  # have to select again, because `uname -m` returns i86pc
441ef18c883Sths  # even on an x86_64 box.
442ef18c883Sths  solariscpu=`isainfo -k`
443ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
444ef18c883Sths    cpu="x86_64"
445ef18c883Sths  fi
446c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4470475a5caSths    if test "$solarisrev" -le 9 ; then
4480475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4490475a5caSths        needs_libsunmath="yes"
450f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
451f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
452f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4530475a5caSths      else
4540475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4550475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4560475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4570475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4580475a5caSths        exit 1
4590475a5caSths      fi
4600475a5caSths    fi
46186b2bd93Sths  fi
4626b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4630c58ac1cSmalc    audio_drv_list="oss"
4646b4d2ba1Sths  fi
465c2de5c91Smalc  audio_possible_drivers="oss sdl"
466d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
467d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
468d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
469d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
470a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
471560d375fSAndreas Färber  solarisnetlibs="-lsocket -lnsl -lresolv"
472560d375fSAndreas Färber  LIBS="$solarisnetlibs $LIBS"
473560d375fSAndreas Färber  libs_qga="$solarisnetlibs $libs_qga"
474ec530c81Sbellard;;
475b29fe3edSmalcAIX)
476b29fe3edSmalc  aix="yes"
4770db4a067SPaolo Bonzini  make="${MAKE-gmake}"
478b29fe3edSmalc;;
479179cf400SAndreas FärberHaiku)
480179cf400SAndreas Färber  haiku="yes"
481179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
482179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
483179cf400SAndreas Färber;;
484fb065187Sbellard*)
4850c58ac1cSmalc  audio_drv_list="oss"
486b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4875327cf48Sbellard  linux="yes"
488831b7825Sths  linux_user="yes"
48968063649Sblueswir1  usb="linux"
490af2be207SJan Kiszka  kvm="yes"
491af2be207SJan Kiszka  vhost_net="yes"
49207f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
493c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
494c9ec1fe4Sbellard  fi
495fb065187Sbellard;;
4967d13299dSbellardesac
4977d13299dSbellard
4987d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
499b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
50068063649Sblueswir1    usb="bsd"
50184778508Sblueswir1    bsd_user="yes"
5027d3505c5Sbellard  fi
50308de3949SAndreas Färberfi
5047d3505c5Sbellard
5050db4a067SPaolo Bonzini: ${make=${MAKE-make}}
5060db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
507c886edfbSBlue Swirl: ${python=${PYTHON-python}}
508e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
5090db4a067SPaolo Bonzini
5103457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
5113457a3f8SJuan Quintela  EXESUF=".exe"
512a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
513e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
514e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
515f7cf5d5bSStefan Weil  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
516f7cf5d5bSStefan Weilcat > $TMPC << EOF
517f7cf5d5bSStefan Weilint main(void) { return 0; }
518f7cf5d5bSStefan WeilEOF
519f7cf5d5bSStefan Weil  if compile_prog "" "-liberty" ; then
520f7cf5d5bSStefan Weil    LIBS="-liberty $LIBS"
521f7cf5d5bSStefan Weil  fi
522c5ec15eaSStefan Weil  prefix="c:/Program Files/QEMU"
523683035deSPaolo Bonzini  mandir="\${prefix}"
524528ae5b8SEduardo Habkost  datadir="\${prefix}"
525850da188SEduardo Habkost  qemu_docdir="\${prefix}"
526683035deSPaolo Bonzini  bindir="\${prefix}"
527683035deSPaolo Bonzini  sysconfdir="\${prefix}"
528683035deSPaolo Bonzini  confsuffix=""
529368542b8SStefan Hajnoczi  libs_qga="-lws2_32 -lwinmm -lpowrprof $libs_qga"
5303457a3f8SJuan Quintelafi
5313457a3f8SJuan Quintela
532487fefdbSAnthony Liguoriwerror=""
53385aa5189Sbellard
5347d13299dSbellardfor opt do
535a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
5367d13299dSbellard  case "$opt" in
5372efc3265Sbellard  --help|-h) show_help=yes
5382efc3265Sbellard  ;;
53999123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
54099123e13SMike Frysinger  ;;
541b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5427d13299dSbellard  ;;
543b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
54432ce6337Sbellard  ;;
545ca4deeb1SPaolo Bonzini  --source-path=*)
5467d13299dSbellard  ;;
547ac0df51dSaliguori  --cross-prefix=*)
5487d13299dSbellard  ;;
549ac0df51dSaliguori  --cc=*)
5507d13299dSbellard  ;;
551b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
55283469015Sbellard  ;;
553b1a550a0Spbrook  --make=*) make="$optarg"
5547d13299dSbellard  ;;
5556a882643Spbrook  --install=*) install="$optarg"
5566a882643Spbrook  ;;
557c886edfbSBlue Swirl  --python=*) python="$optarg"
558c886edfbSBlue Swirl  ;;
559e2d8830eSBrad  --smbd=*) smbd="$optarg"
560e2d8830eSBrad  ;;
561e2a2ed06SJuan Quintela  --extra-cflags=*)
5627d13299dSbellard  ;;
563e2a2ed06SJuan Quintela  --extra-ldflags=*)
5647d13299dSbellard  ;;
5655bc62e01SGerd Hoffmann  --enable-debug-info)
5665bc62e01SGerd Hoffmann  ;;
5675bc62e01SGerd Hoffmann  --disable-debug-info)
5685bc62e01SGerd Hoffmann  ;;
5692ff6b91eSJuan Quintela  --cpu=*)
5707d13299dSbellard  ;;
571b1a550a0Spbrook  --target-list=*) target_list="$optarg"
572de83cd02Sbellard  ;;
57374242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
57494a420b1SStefan Hajnoczi  ;;
57574242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
5769410b56cSPrerna Saxena  ;;
5777d13299dSbellard  --enable-gprof) gprof="yes"
5787d13299dSbellard  ;;
57979427693SLoïc Minier  --static)
58079427693SLoïc Minier    static="yes"
58179427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
58217884d7bSSergei Trofimovich    QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
58343ce4dfeSbellard  ;;
5840b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5850b24e75fSPaolo Bonzini  ;;
5860b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5870b24e75fSPaolo Bonzini  ;;
5883aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
5893aa5d2beSAlon Levy  ;;
5900f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
5910f94d6daSAlon Levy  ;;
592528ae5b8SEduardo Habkost  --datadir=*) datadir="$optarg"
5930b24e75fSPaolo Bonzini  ;;
594023d3d67SEduardo Habkost  --with-confsuffix=*) confsuffix="$optarg"
595023d3d67SEduardo Habkost  ;;
596850da188SEduardo Habkost  --docdir=*) qemu_docdir="$optarg"
5970b24e75fSPaolo Bonzini  ;;
598ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
59907381cc1SAnthony Liguori  ;;
600023ddd74SMax Filippov  --sbindir=*|--libexecdir=*|--sharedstatedir=*|--localstatedir=*|\
601023ddd74SMax Filippov  --oldincludedir=*|--datarootdir=*|--infodir=*|--localedir=*|\
602023ddd74SMax Filippov  --htmldir=*|--dvidir=*|--pdfdir=*|--psdir=*)
603023ddd74SMax Filippov    # These switches are silently ignored, for compatibility with
604023ddd74SMax Filippov    # autoconf-generated configure scripts. This allows QEMU's
605023ddd74SMax Filippov    # configure to be used by RPM and similar macros that set
606023ddd74SMax Filippov    # lots of directory switches by default.
607023ddd74SMax Filippov  ;;
60897a847bcSbellard  --disable-sdl) sdl="no"
60997a847bcSbellard  ;;
610c4198157SJuan Quintela  --enable-sdl) sdl="yes"
611c4198157SJuan Quintela  ;;
612983eef5aSMeador Inge  --disable-virtfs) virtfs="no"
613983eef5aSMeador Inge  ;;
614983eef5aSMeador Inge  --enable-virtfs) virtfs="yes"
615983eef5aSMeador Inge  ;;
616821601eaSJes Sorensen  --disable-vnc) vnc="no"
617821601eaSJes Sorensen  ;;
618821601eaSJes Sorensen  --enable-vnc) vnc="yes"
619821601eaSJes Sorensen  ;;
620b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
621102a52e4Sbellard  ;;
622c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
623c2de5c91Smalc  ;;
6242f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
6252f6a1ab0Sblueswir1  ;;
6262fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
6270c58ac1cSmalc  ;;
6280c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
6290c58ac1cSmalc  ;;
630eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
631eb852011SMarkus Armbruster  ;;
632f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
633f8393946Saurel32  ;;
634f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
635f8393946Saurel32  ;;
636b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
637b4475aa2SLuiz Capitulino  ;;
638b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
639b4475aa2SLuiz Capitulino  ;;
640f3d08ee6SPaul Brook  --enable-debug)
641f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
642f3d08ee6SPaul Brook      debug_tcg="yes"
643b4475aa2SLuiz Capitulino      debug_mon="yes"
644f3d08ee6SPaul Brook      debug="yes"
645f3d08ee6SPaul Brook      strip_opt="no"
646f3d08ee6SPaul Brook  ;;
64703b4fe7dSaliguori  --enable-sparse) sparse="yes"
64803b4fe7dSaliguori  ;;
64903b4fe7dSaliguori  --disable-sparse) sparse="no"
65003b4fe7dSaliguori  ;;
6511625af87Saliguori  --disable-strip) strip_opt="no"
6521625af87Saliguori  ;;
6538d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
6548d5d2d4cSths  ;;
6551be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
6561be10ad2SJuan Quintela  ;;
6572f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
6582f9606b3Saliguori  ;;
659ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
660ea784e3bSJuan Quintela  ;;
6612f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
6622f6f5c7aSCorentin Chary  ;;
6632f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
6642f6f5c7aSCorentin Chary  ;;
665efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
666efe556adSCorentin Chary  ;;
667efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
668efe556adSCorentin Chary  ;;
669443f1376Sbellard  --disable-slirp) slirp="no"
670c20709aaSbellard  ;;
671ee682d27SStefan Weil  --disable-uuid) uuid="no"
672ee682d27SStefan Weil  ;;
673ee682d27SStefan Weil  --enable-uuid) uuid="yes"
674ee682d27SStefan Weil  ;;
675e0e6c8c0Saliguori  --disable-vde) vde="no"
6768a16d273Sths  ;;
677dfb278bdSJuan Quintela  --enable-vde) vde="yes"
678dfb278bdSJuan Quintela  ;;
679e37630caSaliguori  --disable-xen) xen="no"
680e37630caSaliguori  ;;
681fc321b4bSJuan Quintela  --enable-xen) xen="yes"
682fc321b4bSJuan Quintela  ;;
683eb6fda0fSAnthony PERARD  --disable-xen-pci-passthrough) xen_pci_passthrough="no"
684eb6fda0fSAnthony PERARD  ;;
685eb6fda0fSAnthony PERARD  --enable-xen-pci-passthrough) xen_pci_passthrough="yes"
686eb6fda0fSAnthony PERARD  ;;
6872e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6882e4d9fb1Saurel32  ;;
6894ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6904ffcedb6SJuan Quintela  ;;
691fb599c9aSbalrog  --disable-bluez) bluez="no"
692fb599c9aSbalrog  ;;
693a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
694a20a6f46SJuan Quintela  ;;
6957ba1e619Saliguori  --disable-kvm) kvm="no"
6967ba1e619Saliguori  ;;
697b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
698b31a0277SJuan Quintela  ;;
6999195b2c2SStefan Weil  --disable-tcg-interpreter) tcg_interpreter="no"
7009195b2c2SStefan Weil  ;;
7019195b2c2SStefan Weil  --enable-tcg-interpreter) tcg_interpreter="yes"
7029195b2c2SStefan Weil  ;;
70347e98658SCorey Bryant  --disable-cap-ng)  cap_ng="no"
70447e98658SCorey Bryant  ;;
70547e98658SCorey Bryant  --enable-cap-ng) cap_ng="yes"
70647e98658SCorey Bryant  ;;
707cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
708cd4ec0b4SGerd Hoffmann  ;;
709cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
710cd4ec0b4SGerd Hoffmann  ;;
711c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
712c589b249SRonnie Sahlberg  ;;
713c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
714c589b249SRonnie Sahlberg  ;;
71505c2a3e7Sbellard  --enable-profiler) profiler="yes"
71605c2a3e7Sbellard  ;;
71714821030SPavel Borzenkov  --disable-cocoa) cocoa="no"
71814821030SPavel Borzenkov  ;;
719c2de5c91Smalc  --enable-cocoa)
720c2de5c91Smalc      cocoa="yes" ;
721c2de5c91Smalc      sdl="no" ;
722c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
7235b0753e0Sbellard  ;;
724cad25d69Spbrook  --disable-system) softmmu="no"
7250a8e90f4Spbrook  ;;
726cad25d69Spbrook  --enable-system) softmmu="yes"
7270a8e90f4Spbrook  ;;
7280953a80fSZachary Amsden  --disable-user)
7290953a80fSZachary Amsden      linux_user="no" ;
7300953a80fSZachary Amsden      bsd_user="no" ;
7310953a80fSZachary Amsden  ;;
7320953a80fSZachary Amsden  --enable-user) ;;
733831b7825Sths  --disable-linux-user) linux_user="no"
7340a8e90f4Spbrook  ;;
735831b7825Sths  --enable-linux-user) linux_user="yes"
736831b7825Sths  ;;
73784778508Sblueswir1  --disable-bsd-user) bsd_user="no"
73884778508Sblueswir1  ;;
73984778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
74084778508Sblueswir1  ;;
741379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
742379f6698SPaul Brook  ;;
743379f6698SPaul Brook  --disable-guest-base) guest_base="no"
744379f6698SPaul Brook  ;;
74540d6444eSAvi Kivity  --enable-pie) pie="yes"
74634005a00SKirill A. Shutemov  ;;
74740d6444eSAvi Kivity  --disable-pie) pie="no"
74834005a00SKirill A. Shutemov  ;;
749c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
750c5937220Spbrook  ;;
7513142255cSblueswir1  --sparc_cpu=*)
7523142255cSblueswir1  ;;
75385aa5189Sbellard  --enable-werror) werror="yes"
75485aa5189Sbellard  ;;
75585aa5189Sbellard  --disable-werror) werror="no"
75685aa5189Sbellard  ;;
7574d3b6f6eSbalrog  --disable-curses) curses="no"
7584d3b6f6eSbalrog  ;;
759c584a6d0SJuan Quintela  --enable-curses) curses="yes"
760c584a6d0SJuan Quintela  ;;
761769ce76dSAlexander Graf  --disable-curl) curl="no"
762769ce76dSAlexander Graf  ;;
763788c8196SJuan Quintela  --enable-curl) curl="yes"
764788c8196SJuan Quintela  ;;
7652df87df7SJuan Quintela  --disable-fdt) fdt="no"
7662df87df7SJuan Quintela  ;;
7672df87df7SJuan Quintela  --enable-fdt) fdt="yes"
7682df87df7SJuan Quintela  ;;
769bd0c5661Spbrook  --disable-nptl) nptl="no"
770bd0c5661Spbrook  ;;
771b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
772b0a47e79SJuan Quintela  ;;
7738ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
7748ff9cbf7Smalc  ;;
7755c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
7765c6c3a6cSChristoph Hellwig  ;;
7775c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
7785c6c3a6cSChristoph Hellwig  ;;
779758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
780758e8e38SVenkateswararao Jujjuri (JV)  ;;
781758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
782758e8e38SVenkateswararao Jujjuri (JV)  ;;
78377755340Sths  --disable-blobs) blobs="no"
78477755340Sths  ;;
7854a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
7864a19f1ecSpbrook  ;;
787519175a2SAlex Barcelo  --with-coroutine=*) coroutine="$optarg"
788519175a2SAlex Barcelo  ;;
789a25dba17SJuan Quintela  --disable-docs) docs="no"
79070ec5dc0SAnthony Liguori  ;;
791a25dba17SJuan Quintela  --enable-docs) docs="yes"
79283a3ab8bSJuan Quintela  ;;
793d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
794d5970055SMichael S. Tsirkin  ;;
795d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
796d5970055SMichael S. Tsirkin  ;;
79720ff075bSMichael Walle  --disable-opengl) opengl="no"
79820ff075bSMichael Walle  ;;
79920ff075bSMichael Walle  --enable-opengl) opengl="yes"
80020ff075bSMichael Walle  ;;
801f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
802f27aaf4bSChristian Brunner  ;;
803f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
804f27aaf4bSChristian Brunner  ;;
8058c84cf11SSergei Trofimovich  --disable-xfsctl) xfs="no"
8068c84cf11SSergei Trofimovich  ;;
8078c84cf11SSergei Trofimovich  --enable-xfsctl) xfs="yes"
8088c84cf11SSergei Trofimovich  ;;
80936707144SAlon Levy  --disable-smartcard) smartcard="no"
81036707144SAlon Levy  ;;
81136707144SAlon Levy  --enable-smartcard) smartcard="yes"
81236707144SAlon Levy  ;;
813111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
814111a38b0SRobert Relyea  ;;
815111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
816111a38b0SRobert Relyea  ;;
81769354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
81869354a83SHans de Goede  ;;
81969354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
82069354a83SHans de Goede  ;;
8211ece9905SAlon Levy  --disable-zlib-test) zlib="no"
8221ece9905SAlon Levy  ;;
823d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
824d138cee9SMichael Roth  ;;
825d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
826d138cee9SMichael Roth  ;;
8277f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
8287f1559c6Sbalrog  ;;
8297d13299dSbellard  esac
8307d13299dSbellarddone
8317d13299dSbellard
8323142255cSblueswir1#
8333142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
834a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
8353142255cSblueswir1#
836379f6698SPaul Brookhost_guest_base="no"
83740293e58Sbellardcase "$cpu" in
838ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
839ed968ff1SJuan Quintela           v7|v8)
840a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
841ed968ff1SJuan Quintela           ;;
842ed968ff1SJuan Quintela           v8plus|v8plusa)
843a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
844ed968ff1SJuan Quintela           ;;
845ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
846a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
847ed968ff1SJuan Quintela           esac
8480c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
849a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
850762e8230Sblueswir1           if test "$solaris" = "no" ; then
851a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
852c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
853762e8230Sblueswir1           fi
8543142255cSblueswir1           ;;
855ed968ff1SJuan Quintela    sparc64)
856a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
8570c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
858a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
859ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
860a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
861762e8230Sblueswir1           fi
8623142255cSblueswir1           ;;
86376d83bdeSths    s390)
86428d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
86528d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
86648bb3750SRichard Henderson           host_guest_base="yes"
86728d7cc49SRichard Henderson           ;;
86828d7cc49SRichard Henderson    s390x)
86928d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
87028d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
87148bb3750SRichard Henderson           host_guest_base="yes"
87276d83bdeSths           ;;
87340293e58Sbellard    i386)
874a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
8750c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
8762b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
877c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
878379f6698SPaul Brook           host_guest_base="yes"
87940293e58Sbellard           ;;
88040293e58Sbellard    x86_64)
881a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
8820c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
8832b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
884379f6698SPaul Brook           host_guest_base="yes"
885379f6698SPaul Brook           ;;
886379f6698SPaul Brook    arm*)
887379f6698SPaul Brook           host_guest_base="yes"
88840293e58Sbellard           ;;
889f6548c0aSmalc    ppc*)
890f6548c0aSmalc           host_guest_base="yes"
891f6548c0aSmalc           ;;
892cc01cc8eSAurelien Jarno    mips*)
893cc01cc8eSAurelien Jarno           host_guest_base="yes"
894cc01cc8eSAurelien Jarno           ;;
895477ba620SAurelien Jarno    ia64*)
896477ba620SAurelien Jarno           host_guest_base="yes"
897477ba620SAurelien Jarno           ;;
898fd76e73aSRichard Henderson    hppa*)
899fd76e73aSRichard Henderson           host_guest_base="yes"
900fd76e73aSRichard Henderson           ;;
901d2fbca94SGuan Xuetao    unicore32*)
902d2fbca94SGuan Xuetao           host_guest_base="yes"
903d2fbca94SGuan Xuetao           ;;
9043142255cSblueswir1esac
9053142255cSblueswir1
906379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
907379f6698SPaul Brook
90860e0df25SPeter Maydell
90960e0df25SPeter Maydelldefault_target_list=""
91060e0df25SPeter Maydell
91160e0df25SPeter Maydell# these targets are portable
91260e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then
91360e0df25SPeter Maydell    default_target_list="\
91460e0df25SPeter Maydelli386-softmmu \
91560e0df25SPeter Maydellx86_64-softmmu \
91627cdad67SRichard Hendersonalpha-softmmu \
91760e0df25SPeter Maydellarm-softmmu \
91860e0df25SPeter Maydellcris-softmmu \
91960e0df25SPeter Maydelllm32-softmmu \
92060e0df25SPeter Maydellm68k-softmmu \
92160e0df25SPeter Maydellmicroblaze-softmmu \
92260e0df25SPeter Maydellmicroblazeel-softmmu \
92360e0df25SPeter Maydellmips-softmmu \
92460e0df25SPeter Maydellmipsel-softmmu \
92560e0df25SPeter Maydellmips64-softmmu \
92660e0df25SPeter Maydellmips64el-softmmu \
927e67db06eSJia Liuor32-softmmu \
92860e0df25SPeter Maydellppc-softmmu \
92960e0df25SPeter Maydellppcemb-softmmu \
93060e0df25SPeter Maydellppc64-softmmu \
93160e0df25SPeter Maydellsh4-softmmu \
93260e0df25SPeter Maydellsh4eb-softmmu \
93360e0df25SPeter Maydellsparc-softmmu \
93460e0df25SPeter Maydellsparc64-softmmu \
9350f3301d4SAlexander Grafs390x-softmmu \
936cfa550c6SMax Filippovxtensa-softmmu \
937cfa550c6SMax Filippovxtensaeb-softmmu \
93860e0df25SPeter Maydell"
93960e0df25SPeter Maydellfi
94060e0df25SPeter Maydell# the following are Linux specific
94160e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then
94260e0df25SPeter Maydell    default_target_list="${default_target_list}\
94360e0df25SPeter Maydelli386-linux-user \
94460e0df25SPeter Maydellx86_64-linux-user \
94560e0df25SPeter Maydellalpha-linux-user \
94660e0df25SPeter Maydellarm-linux-user \
94760e0df25SPeter Maydellarmeb-linux-user \
94860e0df25SPeter Maydellcris-linux-user \
94960e0df25SPeter Maydellm68k-linux-user \
95060e0df25SPeter Maydellmicroblaze-linux-user \
95160e0df25SPeter Maydellmicroblazeel-linux-user \
95260e0df25SPeter Maydellmips-linux-user \
95360e0df25SPeter Maydellmipsel-linux-user \
954d962783eSJia Liuor32-linux-user \
95560e0df25SPeter Maydellppc-linux-user \
95660e0df25SPeter Maydellppc64-linux-user \
95760e0df25SPeter Maydellppc64abi32-linux-user \
95860e0df25SPeter Maydellsh4-linux-user \
95960e0df25SPeter Maydellsh4eb-linux-user \
96060e0df25SPeter Maydellsparc-linux-user \
96160e0df25SPeter Maydellsparc64-linux-user \
96260e0df25SPeter Maydellsparc32plus-linux-user \
96360e0df25SPeter Maydellunicore32-linux-user \
9640f3301d4SAlexander Grafs390x-linux-user \
96560e0df25SPeter Maydell"
96660e0df25SPeter Maydellfi
96760e0df25SPeter Maydell# the following are BSD specific
96860e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then
96960e0df25SPeter Maydell    default_target_list="${default_target_list}\
97060e0df25SPeter Maydelli386-bsd-user \
97160e0df25SPeter Maydellx86_64-bsd-user \
97260e0df25SPeter Maydellsparc-bsd-user \
97360e0df25SPeter Maydellsparc64-bsd-user \
97460e0df25SPeter Maydell"
97560e0df25SPeter Maydellfi
97660e0df25SPeter Maydell
977af5db58eSpbrookif test x"$show_help" = x"yes" ; then
978af5db58eSpbrookcat << EOF
979af5db58eSpbrook
980af5db58eSpbrookUsage: configure [options]
981af5db58eSpbrookOptions: [defaults in brackets after descriptions]
982af5db58eSpbrook
983af5db58eSpbrookEOF
984af5db58eSpbrookecho "Standard options:"
985af5db58eSpbrookecho "  --help                   print this message"
986af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
987af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
988af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
98960e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
99060e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
99160e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
992af5db58eSpbrookecho ""
993af5db58eSpbrookecho "Advanced options (experts only):"
994af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
995af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
996af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
9970bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
9980bfe8cc0SPaolo Bonziniecho "                           build time"
999a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
1000e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
1001af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
10026a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
1003c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
1004e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
1005af5db58eSpbrookecho "  --static                 enable static build [$static]"
10060b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
1007023d3d67SEduardo Habkostecho "  --datadir=PATH           install firmware in PATH$confsuffix"
1008023d3d67SEduardo Habkostecho "  --docdir=PATH            install documentation in PATH$confsuffix"
10090b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
1010023d3d67SEduardo Habkostecho "  --sysconfdir=PATH        install config in PATH$confsuffix"
10112ae4748fSStefan Weilecho "  --with-confsuffix=SUFFIX suffix for QEMU data inside datadir and sysconfdir [$confsuffix]"
1012f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
1013f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
101409695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
1015890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
1016890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
10171625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
101885aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
1019fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
1020c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
1021983eef5aSMeador Ingeecho "  --disable-virtfs         disable VirtFS"
1022983eef5aSMeador Ingeecho "  --enable-virtfs          enable VirtFS"
1023821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
1024821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
102514821030SPavel Borzenkovecho "  --disable-cocoa          disable Cocoa (Mac OS X only)"
102614821030SPavel Borzenkovecho "  --enable-cocoa           enable Cocoa (default on Mac OS X)"
1027c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
1028c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
10294c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
10304c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
1031eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
1032eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
10338ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
1034e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
1035fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
1036eb6fda0fSAnthony PERARDecho "  --disable-xen-pci-passthrough"
1037eb6fda0fSAnthony PERARDecho "  --enable-xen-pci-passthrough"
10382e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
10394ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
10408d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
10411be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
10422f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
1043ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
10442f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
10452f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
104696763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
1047efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
1048af896aaaSpbrookecho "  --disable-curses         disable curses output"
1049c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1050769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1051788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
10522df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
10532df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
1054fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1055a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
10566093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
10577ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1058b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
10599195b2c2SStefan Weilecho "  --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI)"
1060bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
1061e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
1062af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1063af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
10640953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
10650953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1066831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1067831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
106884778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
106984778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1070379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1071379f6698SPaul Brookecho "                           emulation targets"
1072379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
107340d6444eSAvi Kivityecho "  --enable-pie             build Position Independent Executables"
107440d6444eSAvi Kivityecho "  --disable-pie            do not build Position Independent Executables"
1075af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1076af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
10772f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1078c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
1079235e510cS陳韋任echo "  --cpu=CPU                Build for host CPU [$cpu]"
10803142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1081ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1082ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1083e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1084dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
10855c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
10865c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
108747e98658SCorey Bryantecho "  --disable-cap-ng         disable libcap-ng support"
108847e98658SCorey Bryantecho "  --enable-cap-ng          enable libcap-ng support"
1089758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1090758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
109177755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1092d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1093d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1094d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1095d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1096320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1097650ab98dSLluís Vilanovaecho "                           Available backends:" $($python "$source_path"/scripts/tracetool.py --list-backends)
109874242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
10999410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1100cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1101cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1102f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1103c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1104c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
110536707144SAlon Levyecho "  --disable-smartcard      disable smartcard support"
110636707144SAlon Levyecho "  --enable-smartcard       enable smartcard support"
1107111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1108111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
110969354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
111069354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1111d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1112d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1113519175a2SAlex Barceloecho "  --with-coroutine=BACKEND coroutine backend. Supported options:"
1114fe91bfa8SAlex Barceloecho "                           gthread, ucontext, sigaltstack, windows"
1115af5db58eSpbrookecho ""
11165bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1117af5db58eSpbrookexit 1
1118af5db58eSpbrookfi
1119af5db58eSpbrook
1120359bc95dSPeter Maydell# Now we have handled --enable-tcg-interpreter and know we're not just
1121359bc95dSPeter Maydell# printing the help message, bail out if the host CPU isn't supported.
1122359bc95dSPeter Maydellif test "$ARCH" = "unknown"; then
1123359bc95dSPeter Maydell    if test "$tcg_interpreter" = "yes" ; then
1124359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, will use TCG with TCI (experimental)"
1125359bc95dSPeter Maydell        ARCH=tci
1126359bc95dSPeter Maydell    else
1127359bc95dSPeter Maydell        echo "Unsupported CPU = $cpu, try --enable-tcg-interpreter"
1128359bc95dSPeter Maydell        exit 1
1129359bc95dSPeter Maydell    fi
1130359bc95dSPeter Maydellfi
1131359bc95dSPeter Maydell
11328d05095cSPaolo Bonzini# check that the C compiler works.
11338d05095cSPaolo Bonzinicat > $TMPC <<EOF
113475cafad7SStefan Weilint main(void) { return 0; }
11358d05095cSPaolo BonziniEOF
11368d05095cSPaolo Bonzini
11378d05095cSPaolo Bonziniif compile_object ; then
11388d05095cSPaolo Bonzini  : C compiler works ok
11398d05095cSPaolo Bonzinielse
11408d05095cSPaolo Bonzini    echo "ERROR: \"$cc\" either does not exist or does not work"
11418d05095cSPaolo Bonzini    exit 1
11428d05095cSPaolo Bonzinifi
11438d05095cSPaolo Bonzini
1144417c9d72SAlexander Graf# Consult white-list to determine whether to enable werror
1145417c9d72SAlexander Graf# by default.  Only enable by default for git builds
1146417c9d72SAlexander Grafz_version=`cut -f3 -d. $source_path/VERSION`
1147417c9d72SAlexander Graf
1148417c9d72SAlexander Grafif test -z "$werror" ; then
1149417c9d72SAlexander Graf    if test "$z_version" = "50" -a \
1150417c9d72SAlexander Graf        "$linux" = "yes" ; then
1151417c9d72SAlexander Graf        werror="yes"
1152417c9d72SAlexander Graf    else
1153417c9d72SAlexander Graf        werror="no"
1154417c9d72SAlexander Graf    fi
1155417c9d72SAlexander Graffi
1156417c9d72SAlexander Graf
11578d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
11588d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
11598d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1160f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
11616ca026cbSPeter Maydell# Note that we do not add -Werror to gcc_flags here, because that would
11626ca026cbSPeter Maydell# enable it for all configure tests. If a configure test failed due
11636ca026cbSPeter Maydell# to -Werror this would just silently disable some features,
11646ca026cbSPeter Maydell# so it's too error prone.
11658d05095cSPaolo Bonzinicat > $TMPC << EOF
11668d05095cSPaolo Bonziniint main(void) { return 0; }
11678d05095cSPaolo BonziniEOF
11688d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1169bd947d30SStefan Weil    if compile_prog "-Werror $flag" "" ; then
11708d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
11718d05095cSPaolo Bonzini    fi
11728d05095cSPaolo Bonzinidone
11738d05095cSPaolo Bonzini
117440d6444eSAvi Kivityif test "$static" = "yes" ; then
117540d6444eSAvi Kivity  if test "$pie" = "yes" ; then
117640d6444eSAvi Kivity    echo "static and pie are mutually incompatible"
117740d6444eSAvi Kivity    exit 1
117840d6444eSAvi Kivity  else
117940d6444eSAvi Kivity    pie="no"
118040d6444eSAvi Kivity  fi
118140d6444eSAvi Kivityfi
118240d6444eSAvi Kivity
118340d6444eSAvi Kivityif test "$pie" = ""; then
118440d6444eSAvi Kivity  case "$cpu-$targetos" in
1185f9db31a2SBrad    i386-Linux|x86_64-Linux|i386-OpenBSD|x86_64-OpenBSD)
118640d6444eSAvi Kivity      ;;
118740d6444eSAvi Kivity    *)
118840d6444eSAvi Kivity      pie="no"
118940d6444eSAvi Kivity      ;;
119040d6444eSAvi Kivity  esac
119140d6444eSAvi Kivityfi
119240d6444eSAvi Kivity
119340d6444eSAvi Kivityif test "$pie" != "no" ; then
119440d6444eSAvi Kivity  cat > $TMPC << EOF
119521d4a791SAvi Kivity
119621d4a791SAvi Kivity#ifdef __linux__
119721d4a791SAvi Kivity#  define THREAD __thread
119821d4a791SAvi Kivity#else
119921d4a791SAvi Kivity#  define THREAD
120021d4a791SAvi Kivity#endif
120121d4a791SAvi Kivity
120221d4a791SAvi Kivitystatic THREAD int tls_var;
120321d4a791SAvi Kivity
120421d4a791SAvi Kivityint main(void) { return tls_var; }
120521d4a791SAvi Kivity
120640d6444eSAvi KivityEOF
120740d6444eSAvi Kivity  if compile_prog "-fPIE -DPIE" "-pie"; then
120840d6444eSAvi Kivity    QEMU_CFLAGS="-fPIE -DPIE $QEMU_CFLAGS"
120940d6444eSAvi Kivity    LDFLAGS="-pie $LDFLAGS"
121040d6444eSAvi Kivity    pie="yes"
121140d6444eSAvi Kivity    if compile_prog "" "-Wl,-z,relro -Wl,-z,now" ; then
121240d6444eSAvi Kivity      LDFLAGS="-Wl,-z,relro -Wl,-z,now $LDFLAGS"
121340d6444eSAvi Kivity    fi
121440d6444eSAvi Kivity  else
121540d6444eSAvi Kivity    if test "$pie" = "yes"; then
121640d6444eSAvi Kivity      echo "PIE not available due to missing toolchain support"
121740d6444eSAvi Kivity      exit 1
121840d6444eSAvi Kivity    else
121940d6444eSAvi Kivity      echo "Disabling PIE due to missing toolchain support"
122040d6444eSAvi Kivity      pie="no"
122140d6444eSAvi Kivity    fi
122240d6444eSAvi Kivity  fi
122340d6444eSAvi Kivityfi
122440d6444eSAvi Kivity
1225ec530c81Sbellard#
1226ec530c81Sbellard# Solaris specific configure tool chain decisions
1227ec530c81Sbellard#
1228ec530c81Sbellardif test "$solaris" = "yes" ; then
12296792aa11SLoïc Minier  if has $install; then
12306792aa11SLoïc Minier    :
12316792aa11SLoïc Minier  else
1232ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1233ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1234ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1235ec530c81Sbellard    exit 1
1236ec530c81Sbellard  fi
12376792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
1238ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1239ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1240ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1241ec530c81Sbellard    exit 1
1242ec530c81Sbellard  fi
12436792aa11SLoïc Minier  if has ar; then
12446792aa11SLoïc Minier    :
12456792aa11SLoïc Minier  else
1246ec530c81Sbellard    echo "Error: No path includes ar"
1247ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
1248ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
1249ec530c81Sbellard    fi
1250ec530c81Sbellard    exit 1
1251ec530c81Sbellard  fi
1252ec530c81Sbellardfi
1253ec530c81Sbellard
12547a3fc891SSebastian Herbsztif ! has $python; then
1255c886edfbSBlue Swirl  echo "Python not found. Use --python=/path/to/python"
1256c886edfbSBlue Swirl  exit 1
1257c886edfbSBlue Swirlfi
1258c886edfbSBlue Swirl
12596ccea1e4SPeter Maydell# Note that if the Python conditional here evaluates True we will exit
12606ccea1e4SPeter Maydell# with status 1 which is a shell 'false' value.
1261e120d449SStefan Hajnocziif ! "$python" -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))'; then
1262e120d449SStefan Hajnoczi  echo "Cannot use '$python', Python 2.4 or later is required."
1263e120d449SStefan Hajnoczi  echo "Note that Python 3 or later is not yet supported."
1264e120d449SStefan Hajnoczi  echo "Use --python=/path/to/python to specify a supported Python."
12656ccea1e4SPeter Maydell  exit 1
12666ccea1e4SPeter Maydellfi
12676ccea1e4SPeter Maydell
12685327cf48Sbellardif test -z "$target_list" ; then
126960e0df25SPeter Maydell    target_list="$default_target_list"
12706e20a45fSbellardelse
1271b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
12725327cf48Sbellardfi
12730a8e90f4Spbrookif test -z "$target_list" ; then
12740a8e90f4Spbrook    echo "No targets enabled"
12750a8e90f4Spbrook    exit 1
12760a8e90f4Spbrookfi
1277f55fe278SPaolo Bonzini# see if system emulation was really requested
1278f55fe278SPaolo Bonzinicase " $target_list " in
1279f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1280f55fe278SPaolo Bonzini  ;;
1281f55fe278SPaolo Bonzini  *) softmmu=no
1282f55fe278SPaolo Bonzini  ;;
1283f55fe278SPaolo Bonziniesac
12845327cf48Sbellard
1285249247c9SJuan Quintelafeature_not_found() {
1286249247c9SJuan Quintela  feature=$1
1287249247c9SJuan Quintela
1288249247c9SJuan Quintela  echo "ERROR"
1289249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
12909332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1291249247c9SJuan Quintela  echo "ERROR"
1292249247c9SJuan Quintela  exit 1;
1293249247c9SJuan Quintela}
1294249247c9SJuan Quintela
12957d13299dSbellardif test -z "$cross_prefix" ; then
12967d13299dSbellard
12977d13299dSbellard# ---
12987d13299dSbellard# big/little endian test
12997d13299dSbellardcat > $TMPC << EOF
13007d13299dSbellard#include <inttypes.h>
13017d13299dSbellardint main(int argc, char ** argv){
13027d13299dSbellard        volatile uint32_t i=0x01234567;
13037d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
13047d13299dSbellard}
13057d13299dSbellardEOF
13067d13299dSbellard
130752166aa0SJuan Quintelaif compile_prog "" "" ; then
13087d13299dSbellard$TMPE && bigendian="yes"
13097d13299dSbellardelse
13107d13299dSbellardecho big/little test failed
13117d13299dSbellardfi
13127d13299dSbellard
13137d13299dSbellardelse
13147d13299dSbellard
13157d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1316ea8f20f8SJuan Quintelacase "$cpu" in
131721d89f84SPeter Maydell  arm)
131821d89f84SPeter Maydell    # ARM can be either way; ask the compiler which one we are
131921d89f84SPeter Maydell    if check_define __ARMEB__; then
132021d89f84SPeter Maydell      bigendian=yes
132121d89f84SPeter Maydell    fi
132221d89f84SPeter Maydell  ;;
132321d89f84SPeter Maydell  hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1324ea8f20f8SJuan Quintela    bigendian=yes
1325ea8f20f8SJuan Quintela  ;;
1326ea8f20f8SJuan Quintelaesac
13277d13299dSbellard
13287d13299dSbellardfi
13297d13299dSbellard
1330b0a47e79SJuan Quintela##########################################
1331b0a47e79SJuan Quintela# NPTL probe
1332b0a47e79SJuan Quintela
1333b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1334bd0c5661Spbrook  cat > $TMPC <<EOF
1335bd0c5661Spbrook#include <sched.h>
133630813ceaSpbrook#include <linux/futex.h>
1337182eacc0SStefan Weilint main(void) {
1338bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1339bd0c5661Spbrook#error bork
1340bd0c5661Spbrook#endif
1341182eacc0SStefan Weil  return 0;
1342bd0c5661Spbrook}
1343bd0c5661SpbrookEOF
1344bd0c5661Spbrook
134552166aa0SJuan Quintela  if compile_object ; then
1346b0a47e79SJuan Quintela    nptl=yes
1347bd0c5661Spbrook  else
1348b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1349b0a47e79SJuan Quintela      feature_not_found "nptl"
1350b0a47e79SJuan Quintela    fi
1351b0a47e79SJuan Quintela    nptl=no
1352b0a47e79SJuan Quintela  fi
1353bd0c5661Spbrookfi
1354bd0c5661Spbrook
135511d9f695Sbellard##########################################
1356ac62922eSbalrog# zlib check
1357ac62922eSbalrog
13581ece9905SAlon Levyif test "$zlib" != "no" ; then
1359ac62922eSbalrog    cat > $TMPC << EOF
1360ac62922eSbalrog#include <zlib.h>
1361ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1362ac62922eSbalrogEOF
136352166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1364ac62922eSbalrog        :
1365ac62922eSbalrog    else
1366ac62922eSbalrog        echo
1367ac62922eSbalrog        echo "Error: zlib check failed"
1368ac62922eSbalrog        echo "Make sure to have the zlib libs and headers installed."
1369ac62922eSbalrog        echo
1370ac62922eSbalrog        exit 1
1371ac62922eSbalrog    fi
13721ece9905SAlon Levyfi
1373ac62922eSbalrog
1374ac62922eSbalrog##########################################
1375e37630caSaliguori# xen probe
1376e37630caSaliguori
1377fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1378b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1379d5b93ddfSAnthony PERARD
138050ced5b3SStefan Weil  # First we test whether Xen headers and libraries are available.
138150ced5b3SStefan Weil  # If no, we are done and there is no Xen support.
138250ced5b3SStefan Weil  # If yes, more tests are run to detect the Xen version.
138350ced5b3SStefan Weil
138450ced5b3SStefan Weil  # Xen (any)
138550ced5b3SStefan Weil  cat > $TMPC <<EOF
138650ced5b3SStefan Weil#include <xenctrl.h>
138750ced5b3SStefan Weil#include <xs.h>
138850ced5b3SStefan Weilint main(void) {
138950ced5b3SStefan Weil  return 0;
139050ced5b3SStefan Weil}
139150ced5b3SStefan WeilEOF
139250ced5b3SStefan Weil  if ! compile_prog "" "$xen_libs" ; then
139350ced5b3SStefan Weil    # Xen not found
139450ced5b3SStefan Weil    if test "$xen" = "yes" ; then
139550ced5b3SStefan Weil      feature_not_found "xen"
139650ced5b3SStefan Weil    fi
139750ced5b3SStefan Weil    xen=no
139850ced5b3SStefan Weil
1399d5b93ddfSAnthony PERARD  # Xen unstable
140050ced5b3SStefan Weil  elif (
1401e37630caSaliguori      cat > $TMPC <<EOF
1402e37630caSaliguori#include <xenctrl.h>
1403e108a3c1SAnthony PERARD#include <xenstore.h>
1404d5b93ddfSAnthony PERARD#include <stdint.h>
1405d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1406d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1407d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1408d5b93ddfSAnthony PERARD#endif
1409d5b93ddfSAnthony PERARDint main(void) {
1410d5b93ddfSAnthony PERARD  xc_interface *xc;
1411d5b93ddfSAnthony PERARD  xs_daemon_open();
1412d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1413d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1414d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1415b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
14168688e065SStefano Stabellini  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
14178688e065SStefano Stabellini  return 0;
14188688e065SStefano Stabellini}
14198688e065SStefano StabelliniEOF
14208688e065SStefano Stabellini      compile_prog "" "$xen_libs"
14218688e065SStefano Stabellini    ) ; then
14228688e065SStefano Stabellini    xen_ctrl_version=420
14238688e065SStefano Stabellini    xen=yes
14248688e065SStefano Stabellini
14258688e065SStefano Stabellini  elif (
14268688e065SStefano Stabellini      cat > $TMPC <<EOF
14278688e065SStefano Stabellini#include <xenctrl.h>
14288688e065SStefano Stabellini#include <xs.h>
14298688e065SStefano Stabellini#include <stdint.h>
14308688e065SStefano Stabellini#include <xen/hvm/hvm_info_table.h>
14318688e065SStefano Stabellini#if !defined(HVM_MAX_VCPUS)
14328688e065SStefano Stabellini# error HVM_MAX_VCPUS not defined
14338688e065SStefano Stabellini#endif
14348688e065SStefano Stabelliniint main(void) {
14358688e065SStefano Stabellini  xc_interface *xc;
14368688e065SStefano Stabellini  xs_daemon_open();
14378688e065SStefano Stabellini  xc = xc_interface_open(0, 0, 0);
14388688e065SStefano Stabellini  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
14398688e065SStefano Stabellini  xc_gnttab_open(NULL, 0);
14408688e065SStefano Stabellini  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1441d5b93ddfSAnthony PERARD  return 0;
1442d5b93ddfSAnthony PERARD}
1443e37630caSaliguoriEOF
144450ced5b3SStefan Weil      compile_prog "" "$xen_libs"
144550ced5b3SStefan Weil    ) ; then
1446d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1447fc321b4bSJuan Quintela    xen=yes
1448d5b93ddfSAnthony PERARD
1449d5b93ddfSAnthony PERARD  # Xen 4.0.0
1450d5b93ddfSAnthony PERARD  elif (
1451d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1452d5b93ddfSAnthony PERARD#include <xenctrl.h>
1453d5b93ddfSAnthony PERARD#include <xs.h>
1454d5b93ddfSAnthony PERARD#include <stdint.h>
1455d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1456d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1457d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1458d5b93ddfSAnthony PERARD#endif
1459d5b93ddfSAnthony PERARDint main(void) {
1460b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1461b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1462b87de24eSAnthony PERARD  };
1463d5b93ddfSAnthony PERARD  xs_daemon_open();
1464d5b93ddfSAnthony PERARD  xc_interface_open();
1465d5b93ddfSAnthony PERARD  xc_gnttab_open();
1466d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1467b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1468d5b93ddfSAnthony PERARD  return 0;
1469d5b93ddfSAnthony PERARD}
1470d5b93ddfSAnthony PERARDEOF
1471d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1472d5b93ddfSAnthony PERARD    ) ; then
1473d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1474d5b93ddfSAnthony PERARD    xen=yes
1475d5b93ddfSAnthony PERARD
1476b87de24eSAnthony PERARD  # Xen 3.4.0
1477b87de24eSAnthony PERARD  elif (
1478b87de24eSAnthony PERARD      cat > $TMPC <<EOF
1479b87de24eSAnthony PERARD#include <xenctrl.h>
1480b87de24eSAnthony PERARD#include <xs.h>
1481b87de24eSAnthony PERARDint main(void) {
1482b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1483b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1484b87de24eSAnthony PERARD  };
1485b87de24eSAnthony PERARD  xs_daemon_open();
1486b87de24eSAnthony PERARD  xc_interface_open();
1487b87de24eSAnthony PERARD  xc_gnttab_open();
1488b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1489b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1490b87de24eSAnthony PERARD  return 0;
1491b87de24eSAnthony PERARD}
1492b87de24eSAnthony PERARDEOF
1493b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
1494b87de24eSAnthony PERARD    ) ; then
1495b87de24eSAnthony PERARD    xen_ctrl_version=340
1496b87de24eSAnthony PERARD    xen=yes
1497b87de24eSAnthony PERARD
1498b87de24eSAnthony PERARD  # Xen 3.3.0
1499d5b93ddfSAnthony PERARD  elif (
1500d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1501d5b93ddfSAnthony PERARD#include <xenctrl.h>
1502d5b93ddfSAnthony PERARD#include <xs.h>
1503d5b93ddfSAnthony PERARDint main(void) {
1504d5b93ddfSAnthony PERARD  xs_daemon_open();
1505d5b93ddfSAnthony PERARD  xc_interface_open();
1506d5b93ddfSAnthony PERARD  xc_gnttab_open();
1507d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1508d5b93ddfSAnthony PERARD  return 0;
1509d5b93ddfSAnthony PERARD}
1510d5b93ddfSAnthony PERARDEOF
1511d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1512d5b93ddfSAnthony PERARD    ) ; then
1513d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1514d5b93ddfSAnthony PERARD    xen=yes
1515d5b93ddfSAnthony PERARD
151650ced5b3SStefan Weil  # Xen version unsupported
1517e37630caSaliguori  else
1518fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
151950ced5b3SStefan Weil      feature_not_found "xen (unsupported version)"
1520fc321b4bSJuan Quintela    fi
1521fc321b4bSJuan Quintela    xen=no
1522e37630caSaliguori  fi
1523d5b93ddfSAnthony PERARD
1524d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1525d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1526d5b93ddfSAnthony PERARD  fi
1527e37630caSaliguorifi
1528e37630caSaliguori
1529eb6fda0fSAnthony PERARDif test "$xen_pci_passthrough" != "no"; then
1530eb6fda0fSAnthony PERARD  if test "$xen" = "yes" && test "$linux" = "yes" &&
1531eb6fda0fSAnthony PERARD    test "$xen_ctrl_version" -ge 340; then
1532eb6fda0fSAnthony PERARD    xen_pci_passthrough=yes
1533eb6fda0fSAnthony PERARD  else
1534eb6fda0fSAnthony PERARD    if test "$xen_pci_passthrough" = "yes"; then
1535eb6fda0fSAnthony PERARD      echo "ERROR"
1536eb6fda0fSAnthony PERARD      echo "ERROR: User requested feature Xen PCI Passthrough"
1537eb6fda0fSAnthony PERARD      echo "ERROR: but this feature require /sys from Linux"
1538eb6fda0fSAnthony PERARD      if test "$xen_ctrl_version" -lt 340; then
1539eb6fda0fSAnthony PERARD        echo "ERROR: This feature does not work with Xen 3.3"
1540eb6fda0fSAnthony PERARD      fi
1541eb6fda0fSAnthony PERARD      echo "ERROR"
1542eb6fda0fSAnthony PERARD      exit 1;
1543eb6fda0fSAnthony PERARD    fi
1544eb6fda0fSAnthony PERARD    xen_pci_passthrough=no
1545eb6fda0fSAnthony PERARD  fi
1546eb6fda0fSAnthony PERARDfi
1547eb6fda0fSAnthony PERARD
1548e37630caSaliguori##########################################
1549a8bd70adSPaolo Bonzini# pkg-config probe
1550f91672e5SPaolo Bonzini
155117884d7bSSergei Trofimovichif ! has "$pkg_config_exe"; then
155217884d7bSSergei Trofimovich  echo "Error: pkg-config binary '$pkg_config_exe' not found"
1553a213fcb2SPeter Maydell  exit 1
1554f91672e5SPaolo Bonzinifi
1555f91672e5SPaolo Bonzini
1556f91672e5SPaolo Bonzini##########################################
155744dc0ca3SAlon Levy# libtool probe
155844dc0ca3SAlon Levy
15593f534581SBradif ! has $libtool; then
156044dc0ca3SAlon Levy    libtool=
156144dc0ca3SAlon Levyfi
156244dc0ca3SAlon Levy
156344dc0ca3SAlon Levy##########################################
1564dfffc653SJuan Quintela# Sparse probe
1565dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
15660dba6195SLoïc Minier  if has cgcc; then
1567dfffc653SJuan Quintela    sparse=yes
1568dfffc653SJuan Quintela  else
1569dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1570dfffc653SJuan Quintela      feature_not_found "sparse"
1571dfffc653SJuan Quintela    fi
1572dfffc653SJuan Quintela    sparse=no
1573dfffc653SJuan Quintela  fi
1574dfffc653SJuan Quintelafi
1575dfffc653SJuan Quintela
1576dfffc653SJuan Quintela##########################################
157711d9f695Sbellard# SDL probe
157811d9f695Sbellard
15793ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
15803ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
15813ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
15823ec87ffeSPaolo Bonzini  sdl_config=sdl-config
15833ec87ffeSPaolo Bonzinifi
15843ec87ffeSPaolo Bonzini
15853ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1586a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1587fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
15883ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
15893ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
15909316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1591a0dfd8a4SLoïc Minierelse
1592a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1593a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1594a0dfd8a4SLoïc Minier  fi
1595a0dfd8a4SLoïc Minier  sdl=no
15969316f803SPaolo Bonzinifi
159729e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
15983ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
15993ec87ffeSPaolo Bonzinifi
160011d9f695Sbellard
16019316f803SPaolo Bonzinisdl_too_old=no
1602c4198157SJuan Quintelaif test "$sdl" != "no" ; then
160311d9f695Sbellard  cat > $TMPC << EOF
160411d9f695Sbellard#include <SDL.h>
160511d9f695Sbellard#undef main /* We don't want SDL to override our main() */
160611d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
160711d9f695SbellardEOF
16089316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
160974f42e18STeLeMan  if test "$static" = "yes" ; then
161074f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
161174f42e18STeLeMan  else
16129316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
161374f42e18STeLeMan  fi
161452166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
161511d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
161611d9f695Sbellard      sdl_too_old=yes
161711d9f695Sbellard    else
1618fd677642Sths      if test "$cocoa" = "no" ; then
161911d9f695Sbellard        sdl=yes
162011d9f695Sbellard      fi
1621fd677642Sths    fi
16227c1f25b4Sbellard
162367c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
16241ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
162567c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1626f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1627f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
162811d9f695Sbellard      fi
162952166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
16301ac88f28SJuan Quintela	:
16311ac88f28SJuan Quintela      else
16321ac88f28SJuan Quintela        sdl=no
16337c1f25b4Sbellard      fi
16347c1f25b4Sbellard    fi # static link
1635c4198157SJuan Quintela  else # sdl not found
1636c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1637c4198157SJuan Quintela      feature_not_found "sdl"
1638c4198157SJuan Quintela    fi
1639c4198157SJuan Quintela    sdl=no
16407c1f25b4Sbellard  fi # sdl compile test
1641fd677642Sthsfi
164211d9f695Sbellard
16435368a422Saliguoriif test "$sdl" = "yes" ; then
16445368a422Saliguori  cat > $TMPC <<EOF
16455368a422Saliguori#include <SDL.h>
16465368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
16475368a422Saliguori#include <X11/XKBlib.h>
16485368a422Saliguori#else
16495368a422Saliguori#error No x11 support
16505368a422Saliguori#endif
16515368a422Saliguoriint main(void) { return 0; }
16525368a422SaliguoriEOF
165352166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1654681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
16555368a422Saliguori  fi
16560705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
16575368a422Saliguorifi
16585368a422Saliguori
16598f28f3fbSths##########################################
16608d5d2d4cSths# VNC TLS detection
1661821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1662ae6b5e5aSaliguori  cat > $TMPC <<EOF
1663ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1664ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1665ae6b5e5aSaliguoriEOF
1666a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1667a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
166852166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
16691be10ad2SJuan Quintela    vnc_tls=yes
1670a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1671ae6b5e5aSaliguori  else
16721be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
16731be10ad2SJuan Quintela      feature_not_found "vnc-tls"
16741be10ad2SJuan Quintela    fi
16751be10ad2SJuan Quintela    vnc_tls=no
16768d5d2d4cSths  fi
16778d5d2d4cSthsfi
16788d5d2d4cSths
16798d5d2d4cSths##########################################
16802f9606b3Saliguori# VNC SASL detection
1681821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
16822f9606b3Saliguori  cat > $TMPC <<EOF
16832f9606b3Saliguori#include <sasl/sasl.h>
16842f9606b3Saliguori#include <stdio.h>
16852f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
16862f9606b3SaliguoriEOF
16872f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
16882f9606b3Saliguori  vnc_sasl_cflags=""
16892f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
169052166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1691ea784e3bSJuan Quintela    vnc_sasl=yes
1692fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
16932f9606b3Saliguori  else
1694ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1695ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1696ea784e3bSJuan Quintela    fi
1697ea784e3bSJuan Quintela    vnc_sasl=no
16982f9606b3Saliguori  fi
16992f9606b3Saliguorifi
17002f9606b3Saliguori
17012f9606b3Saliguori##########################################
17022f6f5c7aSCorentin Chary# VNC JPEG detection
1703821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
17042f6f5c7aSCorentin Charycat > $TMPC <<EOF
17052f6f5c7aSCorentin Chary#include <stdio.h>
17062f6f5c7aSCorentin Chary#include <jpeglib.h>
17072f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
17082f6f5c7aSCorentin CharyEOF
17092f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
17102f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
17112f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
17122f6f5c7aSCorentin Chary    vnc_jpeg=yes
17132f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
17142f6f5c7aSCorentin Chary  else
17152f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
17162f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
17172f6f5c7aSCorentin Chary    fi
17182f6f5c7aSCorentin Chary    vnc_jpeg=no
17192f6f5c7aSCorentin Chary  fi
17202f6f5c7aSCorentin Charyfi
17212f6f5c7aSCorentin Chary
17222f6f5c7aSCorentin Chary##########################################
1723efe556adSCorentin Chary# VNC PNG detection
1724821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1725efe556adSCorentin Charycat > $TMPC <<EOF
1726efe556adSCorentin Chary//#include <stdio.h>
1727efe556adSCorentin Chary#include <png.h>
1728832ce9c2SScott Wood#include <stddef.h>
1729efe556adSCorentin Charyint main(void) {
1730efe556adSCorentin Chary    png_structp png_ptr;
1731efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
17327edc3fedSPeter Maydell    return png_ptr != 0;
1733efe556adSCorentin Chary}
1734efe556adSCorentin CharyEOF
17359af8025eSBrad  if $pkg_config libpng --modversion >/dev/null 2>&1; then
17369af8025eSBrad    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
17379af8025eSBrad    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
17389af8025eSBrad  else
1739efe556adSCorentin Chary    vnc_png_cflags=""
1740efe556adSCorentin Chary    vnc_png_libs="-lpng"
17419af8025eSBrad  fi
1742efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1743efe556adSCorentin Chary    vnc_png=yes
1744efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
17459af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1746efe556adSCorentin Chary  else
1747efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1748efe556adSCorentin Chary      feature_not_found "vnc-png"
1749efe556adSCorentin Chary    fi
1750efe556adSCorentin Chary    vnc_png=no
1751efe556adSCorentin Chary  fi
1752efe556adSCorentin Charyfi
1753efe556adSCorentin Chary
1754efe556adSCorentin Chary##########################################
175576655d6dSaliguori# fnmatch() probe, used for ACL routines
175676655d6dSaliguorifnmatch="no"
175776655d6dSaliguoricat > $TMPC << EOF
175876655d6dSaliguori#include <fnmatch.h>
175976655d6dSaliguoriint main(void)
176076655d6dSaliguori{
176176655d6dSaliguori    fnmatch("foo", "foo", 0);
176276655d6dSaliguori    return 0;
176376655d6dSaliguori}
176476655d6dSaliguoriEOF
176552166aa0SJuan Quintelaif compile_prog "" "" ; then
176676655d6dSaliguori   fnmatch="yes"
176776655d6dSaliguorifi
176876655d6dSaliguori
176976655d6dSaliguori##########################################
1770ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1771ee682d27SStefan Weilif test "$uuid" != "no" ; then
1772ee682d27SStefan Weil  uuid_libs="-luuid"
1773ee682d27SStefan Weil  cat > $TMPC << EOF
1774ee682d27SStefan Weil#include <uuid/uuid.h>
1775ee682d27SStefan Weilint main(void)
1776ee682d27SStefan Weil{
1777ee682d27SStefan Weil    uuid_t my_uuid;
1778ee682d27SStefan Weil    uuid_generate(my_uuid);
1779ee682d27SStefan Weil    return 0;
1780ee682d27SStefan Weil}
1781ee682d27SStefan WeilEOF
1782ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1783ee682d27SStefan Weil    uuid="yes"
1784ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1785ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1786ee682d27SStefan Weil  else
1787ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1788ee682d27SStefan Weil      feature_not_found "uuid"
1789ee682d27SStefan Weil    fi
1790ee682d27SStefan Weil    uuid=no
1791ee682d27SStefan Weil  fi
1792ee682d27SStefan Weilfi
1793ee682d27SStefan Weil
1794ee682d27SStefan Weil##########################################
1795dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1796dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1797dce512deSChristoph Hellwig  cat > $TMPC << EOF
1798ffc41d10SStefan Weil#include <stddef.h>  /* NULL */
1799dce512deSChristoph Hellwig#include <xfs/xfs.h>
1800dce512deSChristoph Hellwigint main(void)
1801dce512deSChristoph Hellwig{
1802dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1803dce512deSChristoph Hellwig    return 0;
1804dce512deSChristoph Hellwig}
1805dce512deSChristoph HellwigEOF
1806dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1807dce512deSChristoph Hellwig    xfs="yes"
1808dce512deSChristoph Hellwig  else
1809dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1810dce512deSChristoph Hellwig      feature_not_found "xfs"
1811dce512deSChristoph Hellwig    fi
1812dce512deSChristoph Hellwig    xfs=no
1813dce512deSChristoph Hellwig  fi
1814dce512deSChristoph Hellwigfi
1815dce512deSChristoph Hellwig
1816dce512deSChristoph Hellwig##########################################
18178a16d273Sths# vde libraries probe
1818dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
18194baae0acSJuan Quintela  vde_libs="-lvdeplug"
18208a16d273Sths  cat > $TMPC << EOF
18218a16d273Sths#include <libvdeplug.h>
18224a7f0e06Spbrookint main(void)
18234a7f0e06Spbrook{
18244a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
1825fea08e08SPeter Maydell    char s[] = "";
1826fea08e08SPeter Maydell    vde_open(s, s, &a);
18274a7f0e06Spbrook    return 0;
18284a7f0e06Spbrook}
18298a16d273SthsEOF
183052166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
18314baae0acSJuan Quintela    vde=yes
18328e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
18338e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1834dfb278bdSJuan Quintela  else
1835dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1836dfb278bdSJuan Quintela      feature_not_found "vde"
1837dfb278bdSJuan Quintela    fi
1838dfb278bdSJuan Quintela    vde=no
18398a16d273Sths  fi
18408a16d273Sthsfi
18418a16d273Sths
18428a16d273Sths##########################################
184347e98658SCorey Bryant# libcap-ng library probe
184447e98658SCorey Bryantif test "$cap_ng" != "no" ; then
184547e98658SCorey Bryant  cap_libs="-lcap-ng"
184647e98658SCorey Bryant  cat > $TMPC << EOF
184747e98658SCorey Bryant#include <cap-ng.h>
184847e98658SCorey Bryantint main(void)
184947e98658SCorey Bryant{
185047e98658SCorey Bryant    capng_capability_to_name(CAPNG_EFFECTIVE);
185147e98658SCorey Bryant    return 0;
185247e98658SCorey Bryant}
185347e98658SCorey BryantEOF
185447e98658SCorey Bryant  if compile_prog "" "$cap_libs" ; then
185547e98658SCorey Bryant    cap_ng=yes
185647e98658SCorey Bryant    libs_tools="$cap_libs $libs_tools"
185747e98658SCorey Bryant  else
185847e98658SCorey Bryant    if test "$cap_ng" = "yes" ; then
185947e98658SCorey Bryant      feature_not_found "cap_ng"
186047e98658SCorey Bryant    fi
186147e98658SCorey Bryant    cap_ng=no
186247e98658SCorey Bryant  fi
186347e98658SCorey Bryantfi
186447e98658SCorey Bryant
186547e98658SCorey Bryant##########################################
1866c2de5c91Smalc# Sound support libraries probe
18678f28f3fbSths
1868c2de5c91Smalcaudio_drv_probe()
1869c2de5c91Smalc{
1870c2de5c91Smalc    drv=$1
1871c2de5c91Smalc    hdr=$2
1872c2de5c91Smalc    lib=$3
1873c2de5c91Smalc    exp=$4
1874c2de5c91Smalc    cfl=$5
18758f28f3fbSths        cat > $TMPC << EOF
1876c2de5c91Smalc#include <$hdr>
1877c2de5c91Smalcint main(void) { $exp }
18788f28f3fbSthsEOF
187952166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
18808f28f3fbSths        :
18818f28f3fbSths    else
18828f28f3fbSths        echo
1883c2de5c91Smalc        echo "Error: $drv check failed"
1884c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
18858f28f3fbSths        echo
18868f28f3fbSths        exit 1
18878f28f3fbSths    fi
1888c2de5c91Smalc}
1889c2de5c91Smalc
18902fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1891c2de5c91Smalcfor drv in $audio_drv_list; do
1892c2de5c91Smalc    case $drv in
1893c2de5c91Smalc    alsa)
1894c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1895e35bcb0cSStefan Weil        "return snd_pcm_close((snd_pcm_t *)0);"
1896a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1897c2de5c91Smalc    ;;
1898c2de5c91Smalc
1899c2de5c91Smalc    fmod)
1900c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1901c2de5c91Smalc        echo
1902c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1903c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1904c2de5c91Smalc        echo
1905c2de5c91Smalc        exit 1
19068f28f3fbSths    fi
1907c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1908a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1909c2de5c91Smalc    ;;
1910c2de5c91Smalc
1911c2de5c91Smalc    esd)
1912c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1913a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
191467f86e8eSJuan Quintela    audio_pt_int="yes"
1915c2de5c91Smalc    ;;
1916b8e59f18Smalc
1917b8e59f18Smalc    pa)
1918a394aed2SMarc-André Lureau    audio_drv_probe $drv pulse/mainloop.h "-lpulse" \
1919a394aed2SMarc-André Lureau        "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;"
1920a394aed2SMarc-André Lureau    libs_softmmu="-lpulse $libs_softmmu"
192167f86e8eSJuan Quintela    audio_pt_int="yes"
1922b8e59f18Smalc    ;;
1923b8e59f18Smalc
1924997e690aSJuan Quintela    coreaudio)
1925997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1926997e690aSJuan Quintela    ;;
1927997e690aSJuan Quintela
1928a4bf6780SJuan Quintela    dsound)
1929a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1930d5631638Smalc      audio_win_int="yes"
1931a4bf6780SJuan Quintela    ;;
1932a4bf6780SJuan Quintela
1933a4bf6780SJuan Quintela    oss)
1934a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1935a4bf6780SJuan Quintela    ;;
1936a4bf6780SJuan Quintela
1937a4bf6780SJuan Quintela    sdl|wav)
19382f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
19392f6a1ab0Sblueswir1    ;;
19402f6a1ab0Sblueswir1
1941d5631638Smalc    winwave)
1942d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1943d5631638Smalc      audio_win_int="yes"
1944d5631638Smalc    ;;
1945d5631638Smalc
1946e4c63a6aSmalc    *)
19471c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1948e4c63a6aSmalc        echo
1949e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1950e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1951e4c63a6aSmalc        echo
1952e4c63a6aSmalc        exit 1
1953e4c63a6aSmalc    }
1954e4c63a6aSmalc    ;;
1955c2de5c91Smalc    esac
1956c2de5c91Smalcdone
19578f28f3fbSths
19584d3b6f6eSbalrog##########################################
19592e4d9fb1Saurel32# BrlAPI probe
19602e4d9fb1Saurel32
19614ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1962eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
19632e4d9fb1Saurel32  cat > $TMPC << EOF
19642e4d9fb1Saurel32#include <brlapi.h>
1965832ce9c2SScott Wood#include <stddef.h>
19662e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
19672e4d9fb1Saurel32EOF
196852166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
19692e4d9fb1Saurel32    brlapi=yes
1970264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
19714ffcedb6SJuan Quintela  else
19724ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
19734ffcedb6SJuan Quintela      feature_not_found "brlapi"
19744ffcedb6SJuan Quintela    fi
19754ffcedb6SJuan Quintela    brlapi=no
1976eb82284fSJuan Quintela  fi
1977eb82284fSJuan Quintelafi
19782e4d9fb1Saurel32
19792e4d9fb1Saurel32##########################################
19804d3b6f6eSbalrog# curses probe
1981e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
1982e095e2f3SStefan Weil    curses_list="-lpdcurses"
1983e095e2f3SStefan Weilelse
19844f78ef9aSJuan Quintela    curses_list="-lncurses -lcurses"
1985e095e2f3SStefan Weilfi
19864d3b6f6eSbalrog
1987c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1988c584a6d0SJuan Quintela  curses_found=no
19894d3b6f6eSbalrog  cat > $TMPC << EOF
19904d3b6f6eSbalrog#include <curses.h>
1991ef9a2524SStefan Weilint main(void) {
1992ef9a2524SStefan Weil  const char *s = curses_version();
1993ef9a2524SStefan Weil  resize_term(0, 0);
1994ef9a2524SStefan Weil  return s != 0;
1995ef9a2524SStefan Weil}
19964d3b6f6eSbalrogEOF
19974f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
19984f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1999c584a6d0SJuan Quintela      curses_found=yes
20004f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
20014f78ef9aSJuan Quintela      break
20024d3b6f6eSbalrog    fi
20034f78ef9aSJuan Quintela  done
2004c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
2005c584a6d0SJuan Quintela    curses=yes
2006c584a6d0SJuan Quintela  else
2007c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
2008c584a6d0SJuan Quintela      feature_not_found "curses"
2009c584a6d0SJuan Quintela    fi
2010c584a6d0SJuan Quintela    curses=no
2011c584a6d0SJuan Quintela  fi
20124f78ef9aSJuan Quintelafi
20134d3b6f6eSbalrog
2014414f0dabSblueswir1##########################################
2015769ce76dSAlexander Graf# curl probe
2016769ce76dSAlexander Graf
2017a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
2018a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
20194e2b0658SPaolo Bonzinielse
20204e2b0658SPaolo Bonzini  curlconfig=curl-config
20214e2b0658SPaolo Bonzinifi
20224e2b0658SPaolo Bonzini
2023788c8196SJuan Quintelaif test "$curl" != "no" ; then
2024769ce76dSAlexander Graf  cat > $TMPC << EOF
2025769ce76dSAlexander Graf#include <curl/curl.h>
20260b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
2027769ce76dSAlexander GrafEOF
20284e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
20294e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
2030b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
2031769ce76dSAlexander Graf    curl=yes
2032f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
2033f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
2034788c8196SJuan Quintela  else
2035788c8196SJuan Quintela    if test "$curl" = "yes" ; then
2036788c8196SJuan Quintela      feature_not_found "curl"
2037788c8196SJuan Quintela    fi
2038788c8196SJuan Quintela    curl=no
2039769ce76dSAlexander Graf  fi
2040769ce76dSAlexander Graffi # test "$curl"
2041769ce76dSAlexander Graf
2042769ce76dSAlexander Graf##########################################
2043fb599c9aSbalrog# bluez support probe
2044a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
2045e820e3f4Sbalrog  cat > $TMPC << EOF
2046e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
2047e820e3f4Sbalrogint main(void) { return bt_error(0); }
2048e820e3f4SbalrogEOF
2049a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
2050a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
205152166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
2052a20a6f46SJuan Quintela    bluez=yes
2053e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
2054e820e3f4Sbalrog  else
2055a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
2056a20a6f46SJuan Quintela      feature_not_found "bluez"
2057a20a6f46SJuan Quintela    fi
2058e820e3f4Sbalrog    bluez="no"
2059e820e3f4Sbalrog  fi
2060fb599c9aSbalrogfi
2061fb599c9aSbalrog
2062fb599c9aSbalrog##########################################
2063e18df141SAnthony Liguori# glib support probe
2064a52d28afSPaolo Bonzini
2065a52d28afSPaolo Bonziniif test "$mingw32" = yes; then
2066a52d28afSPaolo Bonzini    # g_poll is required in order to integrate with the glib main loop.
2067a52d28afSPaolo Bonzini    glib_req_ver=2.20
2068a52d28afSPaolo Bonzinielse
2069a52d28afSPaolo Bonzini    glib_req_ver=2.12
2070a52d28afSPaolo Bonzinifi
2071a52d28afSPaolo Bonziniif $pkg_config --atleast-version=$glib_req_ver gthread-2.0 > /dev/null 2>&1
2072a52d28afSPaolo Bonzinithen
20734b76a481SStefan Hajnoczi    glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
20744b76a481SStefan Hajnoczi    glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
207514015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
2076957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
2077e18df141SAnthony Liguorielse
2078a52d28afSPaolo Bonzini    echo "glib-$glib_req_ver required to compile QEMU"
2079e18df141SAnthony Liguori    exit 1
2080e18df141SAnthony Liguorifi
2081e18df141SAnthony Liguori
2082e18df141SAnthony Liguori##########################################
208317bff52bSM. Mohan Kumar# libcap probe
208417bff52bSM. Mohan Kumar
208517bff52bSM. Mohan Kumarif test "$cap" != "no" ; then
208617bff52bSM. Mohan Kumar  cat > $TMPC <<EOF
208717bff52bSM. Mohan Kumar#include <stdio.h>
208817bff52bSM. Mohan Kumar#include <sys/capability.h>
2089cc939743SStefan Weilint main(void) { cap_t caps; caps = cap_init(); return caps != NULL; }
209017bff52bSM. Mohan KumarEOF
209117bff52bSM. Mohan Kumar  if compile_prog "" "-lcap" ; then
209217bff52bSM. Mohan Kumar    cap=yes
209317bff52bSM. Mohan Kumar  else
209417bff52bSM. Mohan Kumar    cap=no
209517bff52bSM. Mohan Kumar  fi
209617bff52bSM. Mohan Kumarfi
209717bff52bSM. Mohan Kumar
209817bff52bSM. Mohan Kumar##########################################
2099e5d355d1Saliguori# pthread probe
21004b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
21013c529d93Saliguori
2102e5d355d1Saliguoripthread=no
2103414f0dabSblueswir1cat > $TMPC << EOF
21043c529d93Saliguori#include <pthread.h>
21057a42bbe4SStefan Weilstatic void *f(void *p) { return NULL; }
21067a42bbe4SStefan Weilint main(void) {
21077a42bbe4SStefan Weil  pthread_t thread;
21087a42bbe4SStefan Weil  pthread_create(&thread, 0, f, 0);
21097a42bbe4SStefan Weil  return 0;
21107a42bbe4SStefan Weil}
2111414f0dabSblueswir1EOF
2112bd00d539SAndreas Färberif compile_prog "" "" ; then
2113bd00d539SAndreas Färber  pthread=yes
2114bd00d539SAndreas Färberelse
2115de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
211652166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
2117e5d355d1Saliguori      pthread=yes
2118e3c56761SPeter Portante      found=no
2119e3c56761SPeter Portante      for lib_entry in $LIBS; do
2120e3c56761SPeter Portante        if test "$lib_entry" = "$pthread_lib"; then
2121e3c56761SPeter Portante          found=yes
2122e3c56761SPeter Portante          break
2123e3c56761SPeter Portante        fi
2124e3c56761SPeter Portante      done
2125e3c56761SPeter Portante      if test "$found" = "no"; then
21265572b539SJuan Quintela        LIBS="$pthread_lib $LIBS"
2127e3c56761SPeter Portante      fi
2128de65fe0fSSebastian Herbszt      break
2129414f0dabSblueswir1    fi
2130de65fe0fSSebastian Herbszt  done
2131bd00d539SAndreas Färberfi
2132414f0dabSblueswir1
21334617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
21344dd75c70SChristoph Hellwig  echo
21354dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
21364dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
21374dd75c70SChristoph Hellwig  echo
21384dd75c70SChristoph Hellwig  exit 1
2139e5d355d1Saliguorifi
2140e5d355d1Saliguori
2141bf9298b9Saliguori##########################################
2142f27aaf4bSChristian Brunner# rbd probe
2143f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
2144f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
2145f27aaf4bSChristian Brunner#include <stdio.h>
2146ad32e9c0SJosh Durgin#include <rbd/librbd.h>
2147f27aaf4bSChristian Brunnerint main(void) {
2148ad32e9c0SJosh Durgin    rados_t cluster;
2149ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
2150f27aaf4bSChristian Brunner    return 0;
2151f27aaf4bSChristian Brunner}
2152f27aaf4bSChristian BrunnerEOF
2153ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
2154f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
2155f27aaf4bSChristian Brunner    rbd=yes
2156f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
2157f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
2158f27aaf4bSChristian Brunner  else
2159f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
2160f27aaf4bSChristian Brunner      feature_not_found "rados block device"
2161f27aaf4bSChristian Brunner    fi
2162f27aaf4bSChristian Brunner    rbd=no
2163f27aaf4bSChristian Brunner  fi
2164f27aaf4bSChristian Brunnerfi
2165f27aaf4bSChristian Brunner
2166f27aaf4bSChristian Brunner##########################################
21675c6c3a6cSChristoph Hellwig# linux-aio probe
21685c6c3a6cSChristoph Hellwig
21695c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
21705c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
21715c6c3a6cSChristoph Hellwig#include <libaio.h>
21725c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
2173832ce9c2SScott Wood#include <stddef.h>
21745c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
21755c6c3a6cSChristoph HellwigEOF
21765c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
21775c6c3a6cSChristoph Hellwig    linux_aio=yes
2178048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
2179048d179fSPaul Brook    libs_tools="$libs_tools -laio"
21805c6c3a6cSChristoph Hellwig  else
21815c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
21825c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
21835c6c3a6cSChristoph Hellwig    fi
21843cfcae3cSLuiz Capitulino    linux_aio=no
21855c6c3a6cSChristoph Hellwig  fi
21865c6c3a6cSChristoph Hellwigfi
21875c6c3a6cSChristoph Hellwig
21885c6c3a6cSChristoph Hellwig##########################################
2189758e8e38SVenkateswararao Jujjuri (JV)# attr probe
2190758e8e38SVenkateswararao Jujjuri (JV)
2191758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
2192758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
2193758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
2194758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
2195f2338fb4SPavel Borzenkov#ifdef CONFIG_LIBATTR
2196f2338fb4SPavel Borzenkov#include <attr/xattr.h>
2197f2338fb4SPavel Borzenkov#else
21984f26f2b6SAvi Kivity#include <sys/xattr.h>
2199f2338fb4SPavel Borzenkov#endif
2200758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
2201758e8e38SVenkateswararao Jujjuri (JV)EOF
22024f26f2b6SAvi Kivity  if compile_prog "" "" ; then
22034f26f2b6SAvi Kivity    attr=yes
22044f26f2b6SAvi Kivity  # Older distros have <attr/xattr.h>, and need -lattr:
2205f2338fb4SPavel Borzenkov  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
2206758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
2207758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
22084f26f2b6SAvi Kivity    libattr=yes
2209758e8e38SVenkateswararao Jujjuri (JV)  else
2210758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
2211758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
2212758e8e38SVenkateswararao Jujjuri (JV)    fi
2213758e8e38SVenkateswararao Jujjuri (JV)    attr=no
2214758e8e38SVenkateswararao Jujjuri (JV)  fi
2215758e8e38SVenkateswararao Jujjuri (JV)fi
2216758e8e38SVenkateswararao Jujjuri (JV)
2217758e8e38SVenkateswararao Jujjuri (JV)##########################################
2218bf9298b9Saliguori# iovec probe
2219bf9298b9Saliguoricat > $TMPC <<EOF
2220db34f0b3Sblueswir1#include <sys/types.h>
2221bf9298b9Saliguori#include <sys/uio.h>
2222db34f0b3Sblueswir1#include <unistd.h>
2223f91f9beeSStefan Weilint main(void) { return sizeof(struct iovec); }
2224bf9298b9SaliguoriEOF
2225bf9298b9Saliguoriiovec=no
222652166aa0SJuan Quintelaif compile_prog "" "" ; then
2227bf9298b9Saliguori  iovec=yes
2228bf9298b9Saliguorifi
2229bf9298b9Saliguori
2230f652e6afSaurel32##########################################
2231ceb42de8Saliguori# preadv probe
2232ceb42de8Saliguoricat > $TMPC <<EOF
2233ceb42de8Saliguori#include <sys/types.h>
2234ceb42de8Saliguori#include <sys/uio.h>
2235ceb42de8Saliguori#include <unistd.h>
223684972cbbSStefan Weilint main(void) { return preadv == preadv; }
2237ceb42de8SaliguoriEOF
2238ceb42de8Saliguoripreadv=no
223952166aa0SJuan Quintelaif compile_prog "" "" ; then
2240ceb42de8Saliguori  preadv=yes
2241ceb42de8Saliguorifi
2242ceb42de8Saliguori
2243ceb42de8Saliguori##########################################
2244f652e6afSaurel32# fdt probe
22452df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2246b41af4baSJuan Quintela  fdt_libs="-lfdt"
2247f652e6afSaurel32  cat > $TMPC << EOF
2248f652e6afSaurel32int main(void) { return 0; }
2249f652e6afSaurel32EOF
225052166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2251f652e6afSaurel32    fdt=yes
22522df87df7SJuan Quintela  else
22532df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
22542df87df7SJuan Quintela      feature_not_found "fdt"
22552df87df7SJuan Quintela    fi
2256de3a354aSMichael Walle    fdt_libs=
22572df87df7SJuan Quintela    fdt=no
2258f652e6afSaurel32  fi
2259f652e6afSaurel32fi
2260f652e6afSaurel32
226120ff075bSMichael Walle##########################################
226220ff075bSMichael Walle# opengl probe, used by milkymist-tmu2
226320ff075bSMichael Walleif test "$opengl" != "no" ; then
226420ff075bSMichael Walle  opengl_libs="-lGL"
226520ff075bSMichael Walle  cat > $TMPC << EOF
226620ff075bSMichael Walle#include <X11/Xlib.h>
226720ff075bSMichael Walle#include <GL/gl.h>
226820ff075bSMichael Walle#include <GL/glx.h>
226984972cbbSStefan Weilint main(void) { return GL_VERSION != 0; }
227020ff075bSMichael WalleEOF
227120ff075bSMichael Walle  if compile_prog "" "-lGL" ; then
227220ff075bSMichael Walle    opengl=yes
227320ff075bSMichael Walle  else
227420ff075bSMichael Walle    if test "$opengl" = "yes" ; then
227520ff075bSMichael Walle      feature_not_found "opengl"
227620ff075bSMichael Walle    fi
2277de3a354aSMichael Walle    opengl_libs=
227820ff075bSMichael Walle    opengl=no
227920ff075bSMichael Walle  fi
228020ff075bSMichael Wallefi
228120ff075bSMichael Walle
22823b3f24adSaurel32#
22833b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
22843b3f24adSaurel32# emulator.  This is done because older glibc versions don't
22853b3f24adSaurel32# have syscall stubs for these implemented.
22863b3f24adSaurel32#
22873b3f24adSaurel32atfile=no
22883b3f24adSaurel32cat > $TMPC << EOF
22893b3f24adSaurel32#define _ATFILE_SOURCE
22903b3f24adSaurel32#include <sys/types.h>
22913b3f24adSaurel32#include <fcntl.h>
22923b3f24adSaurel32#include <unistd.h>
22933b3f24adSaurel32
22943b3f24adSaurel32int
22953b3f24adSaurel32main(void)
22963b3f24adSaurel32{
22973b3f24adSaurel32	/* try to unlink nonexisting file */
22983b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
22993b3f24adSaurel32}
23003b3f24adSaurel32EOF
230152166aa0SJuan Quintelaif compile_prog "" "" ; then
23023b3f24adSaurel32  atfile=yes
23033b3f24adSaurel32fi
23043b3f24adSaurel32
230539386ac7Saurel32# Check for inotify functions when we are building linux-user
23063b3f24adSaurel32# emulator.  This is done because older glibc versions don't
23073b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
23083b3f24adSaurel32# don't provide them even if kernel supports them.
23093b3f24adSaurel32#
23103b3f24adSaurel32inotify=no
23113b3f24adSaurel32cat > $TMPC << EOF
23123b3f24adSaurel32#include <sys/inotify.h>
23133b3f24adSaurel32
23143b3f24adSaurel32int
23153b3f24adSaurel32main(void)
23163b3f24adSaurel32{
23173b3f24adSaurel32	/* try to start inotify */
23188690e420Saurel32	return inotify_init();
23193b3f24adSaurel32}
23203b3f24adSaurel32EOF
232152166aa0SJuan Quintelaif compile_prog "" "" ; then
23223b3f24adSaurel32  inotify=yes
23233b3f24adSaurel32fi
23243b3f24adSaurel32
2325c05c7a73SRiku Voipioinotify1=no
2326c05c7a73SRiku Voipiocat > $TMPC << EOF
2327c05c7a73SRiku Voipio#include <sys/inotify.h>
2328c05c7a73SRiku Voipio
2329c05c7a73SRiku Voipioint
2330c05c7a73SRiku Voipiomain(void)
2331c05c7a73SRiku Voipio{
2332c05c7a73SRiku Voipio    /* try to start inotify */
2333c05c7a73SRiku Voipio    return inotify_init1(0);
2334c05c7a73SRiku Voipio}
2335c05c7a73SRiku VoipioEOF
2336c05c7a73SRiku Voipioif compile_prog "" "" ; then
2337c05c7a73SRiku Voipio  inotify1=yes
2338c05c7a73SRiku Voipiofi
2339c05c7a73SRiku Voipio
2340ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2341ebc996f3SRiku Voipioutimens=no
2342ebc996f3SRiku Voipiocat > $TMPC << EOF
2343ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2344ebc996f3SRiku Voipio#include <stddef.h>
2345ebc996f3SRiku Voipio#include <fcntl.h>
23463014ee00SPeter Maydell#include <sys/stat.h>
2347ebc996f3SRiku Voipio
2348ebc996f3SRiku Voipioint main(void)
2349ebc996f3SRiku Voipio{
2350ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2351ebc996f3SRiku Voipio    futimens(0, NULL);
2352ebc996f3SRiku Voipio    return 0;
2353ebc996f3SRiku Voipio}
2354ebc996f3SRiku VoipioEOF
235552166aa0SJuan Quintelaif compile_prog "" "" ; then
2356ebc996f3SRiku Voipio  utimens=yes
2357ebc996f3SRiku Voipiofi
2358ebc996f3SRiku Voipio
2359099d6b0fSRiku Voipio# check if pipe2 is there
2360099d6b0fSRiku Voipiopipe2=no
2361099d6b0fSRiku Voipiocat > $TMPC << EOF
2362099d6b0fSRiku Voipio#include <unistd.h>
2363099d6b0fSRiku Voipio#include <fcntl.h>
2364099d6b0fSRiku Voipio
2365099d6b0fSRiku Voipioint main(void)
2366099d6b0fSRiku Voipio{
2367099d6b0fSRiku Voipio    int pipefd[2];
2368099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
2369099d6b0fSRiku Voipio    return 0;
2370099d6b0fSRiku Voipio}
2371099d6b0fSRiku VoipioEOF
237252166aa0SJuan Quintelaif compile_prog "" "" ; then
2373099d6b0fSRiku Voipio  pipe2=yes
2374099d6b0fSRiku Voipiofi
2375099d6b0fSRiku Voipio
237640ff6d7eSKevin Wolf# check if accept4 is there
237740ff6d7eSKevin Wolfaccept4=no
237840ff6d7eSKevin Wolfcat > $TMPC << EOF
237940ff6d7eSKevin Wolf#include <sys/socket.h>
238040ff6d7eSKevin Wolf#include <stddef.h>
238140ff6d7eSKevin Wolf
238240ff6d7eSKevin Wolfint main(void)
238340ff6d7eSKevin Wolf{
238440ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
238540ff6d7eSKevin Wolf    return 0;
238640ff6d7eSKevin Wolf}
238740ff6d7eSKevin WolfEOF
238840ff6d7eSKevin Wolfif compile_prog "" "" ; then
238940ff6d7eSKevin Wolf  accept4=yes
239040ff6d7eSKevin Wolffi
239140ff6d7eSKevin Wolf
23923ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
23933ce34dfbSvibisreenivasansplice=no
23943ce34dfbSvibisreenivasancat > $TMPC << EOF
23953ce34dfbSvibisreenivasan#include <unistd.h>
23963ce34dfbSvibisreenivasan#include <fcntl.h>
23973ce34dfbSvibisreenivasan#include <limits.h>
23983ce34dfbSvibisreenivasan
23993ce34dfbSvibisreenivasanint main(void)
24003ce34dfbSvibisreenivasan{
240166ea0f22SStefan Weil    int len, fd = 0;
24023ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
24033ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
24043ce34dfbSvibisreenivasan    return 0;
24053ce34dfbSvibisreenivasan}
24063ce34dfbSvibisreenivasanEOF
240752166aa0SJuan Quintelaif compile_prog "" "" ; then
24083ce34dfbSvibisreenivasan  splice=yes
24093ce34dfbSvibisreenivasanfi
24103ce34dfbSvibisreenivasan
2411dcc38d1cSMarcelo Tosatti##########################################
2412dcc38d1cSMarcelo Tosatti# signalfd probe
2413dcc38d1cSMarcelo Tosattisignalfd="no"
2414dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2415dcc38d1cSMarcelo Tosatti#include <unistd.h>
2416dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2417dcc38d1cSMarcelo Tosatti#include <signal.h>
2418dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2419dcc38d1cSMarcelo TosattiEOF
2420dcc38d1cSMarcelo Tosatti
2421dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2422dcc38d1cSMarcelo Tosatti  signalfd=yes
2423dcc38d1cSMarcelo Tosattifi
2424dcc38d1cSMarcelo Tosatti
2425c2882b96SRiku Voipio# check if eventfd is supported
2426c2882b96SRiku Voipioeventfd=no
2427c2882b96SRiku Voipiocat > $TMPC << EOF
2428c2882b96SRiku Voipio#include <sys/eventfd.h>
2429c2882b96SRiku Voipio
2430c2882b96SRiku Voipioint main(void)
2431c2882b96SRiku Voipio{
243255cc7f3eSStefan Weil    return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
2433c2882b96SRiku Voipio}
2434c2882b96SRiku VoipioEOF
2435c2882b96SRiku Voipioif compile_prog "" "" ; then
2436c2882b96SRiku Voipio  eventfd=yes
2437c2882b96SRiku Voipiofi
2438c2882b96SRiku Voipio
2439d0927938SUlrich Hecht# check for fallocate
2440d0927938SUlrich Hechtfallocate=no
2441d0927938SUlrich Hechtcat > $TMPC << EOF
2442d0927938SUlrich Hecht#include <fcntl.h>
2443d0927938SUlrich Hecht
2444d0927938SUlrich Hechtint main(void)
2445d0927938SUlrich Hecht{
2446d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2447d0927938SUlrich Hecht    return 0;
2448d0927938SUlrich Hecht}
2449d0927938SUlrich HechtEOF
24508fb03151SPeter Maydellif compile_prog "" "" ; then
2451d0927938SUlrich Hecht  fallocate=yes
2452d0927938SUlrich Hechtfi
2453d0927938SUlrich Hecht
2454c727f47dSPeter Maydell# check for sync_file_range
2455c727f47dSPeter Maydellsync_file_range=no
2456c727f47dSPeter Maydellcat > $TMPC << EOF
2457c727f47dSPeter Maydell#include <fcntl.h>
2458c727f47dSPeter Maydell
2459c727f47dSPeter Maydellint main(void)
2460c727f47dSPeter Maydell{
2461c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2462c727f47dSPeter Maydell    return 0;
2463c727f47dSPeter Maydell}
2464c727f47dSPeter MaydellEOF
24658fb03151SPeter Maydellif compile_prog "" "" ; then
2466c727f47dSPeter Maydell  sync_file_range=yes
2467c727f47dSPeter Maydellfi
2468c727f47dSPeter Maydell
2469dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2470dace20dcSPeter Maydellfiemap=no
2471dace20dcSPeter Maydellcat > $TMPC << EOF
2472dace20dcSPeter Maydell#include <sys/ioctl.h>
2473dace20dcSPeter Maydell#include <linux/fs.h>
2474dace20dcSPeter Maydell#include <linux/fiemap.h>
2475dace20dcSPeter Maydell
2476dace20dcSPeter Maydellint main(void)
2477dace20dcSPeter Maydell{
2478dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2479dace20dcSPeter Maydell    return 0;
2480dace20dcSPeter Maydell}
2481dace20dcSPeter MaydellEOF
24828fb03151SPeter Maydellif compile_prog "" "" ; then
2483dace20dcSPeter Maydell  fiemap=yes
2484dace20dcSPeter Maydellfi
2485dace20dcSPeter Maydell
2486d0927938SUlrich Hecht# check for dup3
2487d0927938SUlrich Hechtdup3=no
2488d0927938SUlrich Hechtcat > $TMPC << EOF
2489d0927938SUlrich Hecht#include <unistd.h>
2490d0927938SUlrich Hecht
2491d0927938SUlrich Hechtint main(void)
2492d0927938SUlrich Hecht{
2493d0927938SUlrich Hecht    dup3(0, 0, 0);
2494d0927938SUlrich Hecht    return 0;
2495d0927938SUlrich Hecht}
2496d0927938SUlrich HechtEOF
249778f5d726SJan Kiszkaif compile_prog "" "" ; then
2498d0927938SUlrich Hecht  dup3=yes
2499d0927938SUlrich Hechtfi
2500d0927938SUlrich Hecht
25013b6edd16SPeter Maydell# check for epoll support
25023b6edd16SPeter Maydellepoll=no
25033b6edd16SPeter Maydellcat > $TMPC << EOF
25043b6edd16SPeter Maydell#include <sys/epoll.h>
25053b6edd16SPeter Maydell
25063b6edd16SPeter Maydellint main(void)
25073b6edd16SPeter Maydell{
25083b6edd16SPeter Maydell    epoll_create(0);
25093b6edd16SPeter Maydell    return 0;
25103b6edd16SPeter Maydell}
25113b6edd16SPeter MaydellEOF
25128fb03151SPeter Maydellif compile_prog "" "" ; then
25133b6edd16SPeter Maydell  epoll=yes
25143b6edd16SPeter Maydellfi
25153b6edd16SPeter Maydell
25163b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
25173b6edd16SPeter Maydell# so we must check separately for their presence
25183b6edd16SPeter Maydellepoll_create1=no
25193b6edd16SPeter Maydellcat > $TMPC << EOF
25203b6edd16SPeter Maydell#include <sys/epoll.h>
25213b6edd16SPeter Maydell
25223b6edd16SPeter Maydellint main(void)
25233b6edd16SPeter Maydell{
252419e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
252519e83f6bSPeter Maydell     * a function being called. This is necessary so that on
252619e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
252719e83f6bSPeter Maydell     * the library but not declared in the header file we will
252819e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
252919e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
253019e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
253119e83f6bSPeter Maydell     */
253284972cbbSStefan Weil    return epoll_create1 == epoll_create1;
25333b6edd16SPeter Maydell}
25343b6edd16SPeter MaydellEOF
25358fb03151SPeter Maydellif compile_prog "" "" ; then
25363b6edd16SPeter Maydell  epoll_create1=yes
25373b6edd16SPeter Maydellfi
25383b6edd16SPeter Maydell
25393b6edd16SPeter Maydellepoll_pwait=no
25403b6edd16SPeter Maydellcat > $TMPC << EOF
25413b6edd16SPeter Maydell#include <sys/epoll.h>
25423b6edd16SPeter Maydell
25433b6edd16SPeter Maydellint main(void)
25443b6edd16SPeter Maydell{
25453b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
25463b6edd16SPeter Maydell    return 0;
25473b6edd16SPeter Maydell}
25483b6edd16SPeter MaydellEOF
25498fb03151SPeter Maydellif compile_prog "" "" ; then
25503b6edd16SPeter Maydell  epoll_pwait=yes
25513b6edd16SPeter Maydellfi
25523b6edd16SPeter Maydell
2553cc8ae6deSpbrook# Check if tools are available to build documentation.
2554a25dba17SJuan Quintelaif test "$docs" != "no" ; then
255501668d98SStefan Weil  if has makeinfo && has pod2man; then
2556a25dba17SJuan Quintela    docs=yes
255783a3ab8bSJuan Quintela  else
2558a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2559a25dba17SJuan Quintela      feature_not_found "docs"
256083a3ab8bSJuan Quintela    fi
2561a25dba17SJuan Quintela    docs=no
256283a3ab8bSJuan Quintela  fi
2563cc8ae6deSpbrookfi
2564cc8ae6deSpbrook
2565f514f41cSStefan Weil# Search for bswap_32 function
25666ae9a1f4SJuan Quintelabyteswap_h=no
25676ae9a1f4SJuan Quintelacat > $TMPC << EOF
25686ae9a1f4SJuan Quintela#include <byteswap.h>
25696ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
25706ae9a1f4SJuan QuintelaEOF
257152166aa0SJuan Quintelaif compile_prog "" "" ; then
25726ae9a1f4SJuan Quintela  byteswap_h=yes
25736ae9a1f4SJuan Quintelafi
25746ae9a1f4SJuan Quintela
2575f514f41cSStefan Weil# Search for bswap_32 function
25766ae9a1f4SJuan Quintelabswap_h=no
25776ae9a1f4SJuan Quintelacat > $TMPC << EOF
25786ae9a1f4SJuan Quintela#include <sys/endian.h>
25796ae9a1f4SJuan Quintela#include <sys/types.h>
25806ae9a1f4SJuan Quintela#include <machine/bswap.h>
25816ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
25826ae9a1f4SJuan QuintelaEOF
258352166aa0SJuan Quintelaif compile_prog "" "" ; then
25846ae9a1f4SJuan Quintela  bswap_h=yes
25856ae9a1f4SJuan Quintelafi
25866ae9a1f4SJuan Quintela
2587da93a1fdSaliguori##########################################
2588c589b249SRonnie Sahlberg# Do we have libiscsi
2589fa6acb0cSRonnie Sahlberg# We check for iscsi_unmap_sync() to make sure we have a
2590fa6acb0cSRonnie Sahlberg# recent enough version of libiscsi.
2591c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
2592c589b249SRonnie Sahlberg  cat > $TMPC << EOF
2593fa6acb0cSRonnie Sahlberg#include <stdio.h>
2594c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
2595fa6acb0cSRonnie Sahlbergint main(void) { iscsi_unmap_sync(NULL,0,0,0,NULL,0); return 0; }
2596c589b249SRonnie SahlbergEOF
2597417c9d72SAlexander Graf  if compile_prog "" "-liscsi" ; then
2598c589b249SRonnie Sahlberg    libiscsi="yes"
2599c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
2600c589b249SRonnie Sahlberg  else
2601c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
2602c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
2603c589b249SRonnie Sahlberg    fi
2604c589b249SRonnie Sahlberg    libiscsi="no"
2605c589b249SRonnie Sahlberg  fi
2606c589b249SRonnie Sahlbergfi
2607c589b249SRonnie Sahlberg
2608c589b249SRonnie Sahlberg
2609c589b249SRonnie Sahlberg##########################################
2610da93a1fdSaliguori# Do we need librt
2611da93a1fdSaliguoricat > $TMPC <<EOF
2612da93a1fdSaliguori#include <signal.h>
2613da93a1fdSaliguori#include <time.h>
261466ea0f22SStefan Weilint main(void) { return clock_gettime(CLOCK_REALTIME, NULL); }
2615da93a1fdSaliguoriEOF
2616da93a1fdSaliguori
261752166aa0SJuan Quintelaif compile_prog "" "" ; then
261807ffa4bdSJuan Quintela  :
261952166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
262007ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2621da93a1fdSaliguorifi
2622da93a1fdSaliguori
262331ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2624179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
26256362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
26266362a53fSJuan Quintelafi
26276362a53fSJuan Quintela
2628de5071c5SBlue Swirl##########################################
2629cd4ec0b4SGerd Hoffmann# spice probe
2630cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2631cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2632cd4ec0b4SGerd Hoffmann#include <spice.h>
2633cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2634cd4ec0b4SGerd HoffmannEOF
2635710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2636710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
26374295e15aSAlon Levy  if $pkg_config --atleast-version=0.8.2 spice-server >/dev/null 2>&1 && \
26387e3efdacSAlon Levy     $pkg_config --atleast-version=0.8.1 spice-protocol > /dev/null 2>&1 && \
2639cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2640cd4ec0b4SGerd Hoffmann    spice="yes"
2641cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2642cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2643cd4ec0b4SGerd Hoffmann  else
2644cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2645cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2646cd4ec0b4SGerd Hoffmann    fi
2647cd4ec0b4SGerd Hoffmann    spice="no"
2648cd4ec0b4SGerd Hoffmann  fi
2649cd4ec0b4SGerd Hoffmannfi
2650cd4ec0b4SGerd Hoffmann
2651111a38b0SRobert Relyea# check for libcacard for smartcard support
2652111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then
2653111a38b0SRobert Relyea    smartcard="yes"
2654111a38b0SRobert Relyea    smartcard_cflags=""
2655111a38b0SRobert Relyea    # TODO - what's the minimal nss version we support?
2656111a38b0SRobert Relyea    if test "$smartcard_nss" != "no"; then
26575f01e06fSSergei Trofimovich      cat > $TMPC << EOF
26585f01e06fSSergei Trofimovich#include <pk11pub.h>
26595f01e06fSSergei Trofimovichint main(void) { PK11_FreeSlot(0); return 0; }
26605f01e06fSSergei TrofimovichEOF
2661*0b22ef0fSPeter Maydell        smartcard_includes="-I\$(SRC_PATH)/libcacard"
26628c741c22SAlon Levy        libcacard_libs="$($pkg_config --libs nss 2>/dev/null) $glib_libs"
26638c741c22SAlon Levy        libcacard_cflags="$($pkg_config --cflags nss 2>/dev/null) $glib_cflags"
26646ca026cbSPeter Maydell        test_cflags="$libcacard_cflags"
26656ca026cbSPeter Maydell        # The header files in nss < 3.13.3 have a bug which causes them to
26666ca026cbSPeter Maydell        # emit a warning. If we're going to compile QEMU with -Werror, then
26676ca026cbSPeter Maydell        # test that the headers don't have this bug. Otherwise we would pass
26686ca026cbSPeter Maydell        # the configure test but fail to compile QEMU later.
26696ca026cbSPeter Maydell        if test "$werror" = "yes"; then
26706ca026cbSPeter Maydell            test_cflags="-Werror $test_cflags"
26716ca026cbSPeter Maydell        fi
26725f01e06fSSergei Trofimovich        if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 && \
26736ca026cbSPeter Maydell          compile_prog "$test_cflags" "$libcacard_libs"; then
26745f01e06fSSergei Trofimovich            smartcard_nss="yes"
2675*0b22ef0fSPeter Maydell            QEMU_CFLAGS="$QEMU_CFLAGS $libcacard_cflags"
2676*0b22ef0fSPeter Maydell            QEMU_INCLUDES="$QEMU_INCLUDES $smartcard_includes"
2677ad4cf3f6SPaul Brook            libs_softmmu="$libcacard_libs $libs_softmmu"
2678111a38b0SRobert Relyea        else
2679111a38b0SRobert Relyea            if test "$smartcard_nss" = "yes"; then
2680111a38b0SRobert Relyea                feature_not_found "nss"
2681111a38b0SRobert Relyea            fi
2682111a38b0SRobert Relyea            smartcard_nss="no"
2683111a38b0SRobert Relyea        fi
2684111a38b0SRobert Relyea    fi
2685111a38b0SRobert Relyeafi
2686111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then
2687111a38b0SRobert Relyea    smartcard_nss="no"
2688111a38b0SRobert Relyeafi
2689111a38b0SRobert Relyea
269069354a83SHans de Goede# check for usbredirparser for usb network redirection support
269169354a83SHans de Goedeif test "$usb_redir" != "no" ; then
2692097a66efSHans de Goede    if $pkg_config --atleast-version=0.3.4 libusbredirparser >/dev/null 2>&1 ; then
269369354a83SHans de Goede        usb_redir="yes"
269469354a83SHans de Goede        usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
269569354a83SHans de Goede        usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
269669354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
269769354a83SHans de Goede        LIBS="$LIBS $usb_redir_libs"
269869354a83SHans de Goede    else
269969354a83SHans de Goede        if test "$usb_redir" = "yes"; then
270069354a83SHans de Goede            feature_not_found "usb-redir"
270169354a83SHans de Goede        fi
270269354a83SHans de Goede        usb_redir="no"
270369354a83SHans de Goede    fi
270469354a83SHans de Goedefi
270569354a83SHans de Goede
2706cd4ec0b4SGerd Hoffmann##########################################
2707cd4ec0b4SGerd Hoffmann
2708747bbdf7SBlue Swirl##########################################
27095f6b9e8fSBlue Swirl# check if we have fdatasync
27105f6b9e8fSBlue Swirl
27115f6b9e8fSBlue Swirlfdatasync=no
27125f6b9e8fSBlue Swirlcat > $TMPC << EOF
27135f6b9e8fSBlue Swirl#include <unistd.h>
2714d1722a27SAlexandre Raymondint main(void) {
2715d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2716d1722a27SAlexandre Raymondreturn fdatasync(0);
2717d1722a27SAlexandre Raymond#else
2718e172fe11SStefan Weil#error Not supported
2719d1722a27SAlexandre Raymond#endif
2720d1722a27SAlexandre Raymond}
27215f6b9e8fSBlue SwirlEOF
27225f6b9e8fSBlue Swirlif compile_prog "" "" ; then
27235f6b9e8fSBlue Swirl    fdatasync=yes
27245f6b9e8fSBlue Swirlfi
27255f6b9e8fSBlue Swirl
272694a420b1SStefan Hajnoczi##########################################
2727e78815a5SAndreas Färber# check if we have madvise
2728e78815a5SAndreas Färber
2729e78815a5SAndreas Färbermadvise=no
2730e78815a5SAndreas Färbercat > $TMPC << EOF
2731e78815a5SAndreas Färber#include <sys/types.h>
2732e78815a5SAndreas Färber#include <sys/mman.h>
2733832ce9c2SScott Wood#include <stddef.h>
2734e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2735e78815a5SAndreas FärberEOF
2736e78815a5SAndreas Färberif compile_prog "" "" ; then
2737e78815a5SAndreas Färber    madvise=yes
2738e78815a5SAndreas Färberfi
2739e78815a5SAndreas Färber
2740e78815a5SAndreas Färber##########################################
2741e78815a5SAndreas Färber# check if we have posix_madvise
2742e78815a5SAndreas Färber
2743e78815a5SAndreas Färberposix_madvise=no
2744e78815a5SAndreas Färbercat > $TMPC << EOF
2745e78815a5SAndreas Färber#include <sys/mman.h>
2746832ce9c2SScott Wood#include <stddef.h>
2747e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2748e78815a5SAndreas FärberEOF
2749e78815a5SAndreas Färberif compile_prog "" "" ; then
2750e78815a5SAndreas Färber    posix_madvise=yes
2751e78815a5SAndreas Färberfi
2752e78815a5SAndreas Färber
2753e78815a5SAndreas Färber##########################################
275494a420b1SStefan Hajnoczi# check if trace backend exists
275594a420b1SStefan Hajnoczi
2756650ab98dSLluís Vilanova$python "$source_path/scripts/tracetool.py" "--backend=$trace_backend" --check-backend  > /dev/null 2> /dev/null
275794a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
275894a420b1SStefan Hajnoczi  echo
275994a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
276094a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
276194a420b1SStefan Hajnoczi  echo
276294a420b1SStefan Hajnoczi  exit 1
276394a420b1SStefan Hajnoczifi
276494a420b1SStefan Hajnoczi
27657e24e92aSStefan Hajnoczi##########################################
27667e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
27677e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
27687e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
27697e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
27707e24e92aSStefan Hajnoczi#include <ust/marker.h>
27717e24e92aSStefan Hajnocziint main(void) { return 0; }
27727e24e92aSStefan HajnocziEOF
27737e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
277494b4fefaSLluís Vilanova    LIBS="-lust -lurcu-bp $LIBS"
2775c9a2e37cSLluís Vilanova    libs_qga="-lust -lurcu-bp $libs_qga"
27767e24e92aSStefan Hajnoczi  else
27777e24e92aSStefan Hajnoczi    echo
27787e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
27797e24e92aSStefan Hajnoczi    echo
27807e24e92aSStefan Hajnoczi    exit 1
27817e24e92aSStefan Hajnoczi  fi
27827e24e92aSStefan Hajnoczifi
2783b3d08c02SDaniel P. Berrange
2784b3d08c02SDaniel P. Berrange##########################################
2785b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
2786b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
2787b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
2788b3d08c02SDaniel P. Berrange    echo
2789b3d08c02SDaniel P. Berrange    echo "Error: dtrace command is not found in PATH $PATH"
2790b3d08c02SDaniel P. Berrange    echo
2791b3d08c02SDaniel P. Berrange    exit 1
2792b3d08c02SDaniel P. Berrange  fi
2793c276b17dSDaniel P. Berrange  trace_backend_stap="no"
2794c276b17dSDaniel P. Berrange  if has 'stap' ; then
2795c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
2796c276b17dSDaniel P. Berrange  fi
2797b3d08c02SDaniel P. Berrangefi
2798b3d08c02SDaniel P. Berrange
27997e24e92aSStefan Hajnoczi##########################################
2800023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2801023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit
2802023367e6SWolfgang Mauerer# specification is necessary
28031ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2804023367e6SWolfgang Mauerer  cat > $TMPC << EOF
28057ace252aSStefan Weilstatic int sfaa(int *ptr)
2806023367e6SWolfgang Mauerer{
2807023367e6SWolfgang Mauerer  return __sync_fetch_and_and(ptr, 0);
2808023367e6SWolfgang Mauerer}
2809023367e6SWolfgang Mauerer
2810023367e6SWolfgang Mauererint main(int argc, char **argv)
2811023367e6SWolfgang Mauerer{
2812023367e6SWolfgang Mauerer  int val = 42;
2813023367e6SWolfgang Mauerer  sfaa(&val);
2814023367e6SWolfgang Mauerer  return val;
2815023367e6SWolfgang Mauerer}
2816023367e6SWolfgang MauererEOF
2817023367e6SWolfgang Mauerer  if ! compile_prog "" "" ; then
2818caa50971SPeter Maydell    QEMU_CFLAGS="-march=i486 $QEMU_CFLAGS"
2819023367e6SWolfgang Mauerer  fi
2820023367e6SWolfgang Mauererfi
2821023367e6SWolfgang Mauerer
2822023367e6SWolfgang Mauerer##########################################
2823519175a2SAlex Barcelo# check and set a backend for coroutine
2824d0e2fce5SAneesh Kumar K.V
2825519175a2SAlex Barcelo# default is ucontext, but always fallback to gthread
2826519175a2SAlex Barcelo# windows autodetected by make
2827519175a2SAlex Barceloif test "$coroutine" = "" -o "$coroutine" = "ucontext"; then
2828d0e2fce5SAneesh Kumar K.V  if test "$darwin" != "yes"; then
2829d0e2fce5SAneesh Kumar K.V    cat > $TMPC << EOF
2830d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
2831cdf84806SPeter Maydell#ifdef __stub_makecontext
2832cdf84806SPeter Maydell#error Ignoring glibc stub makecontext which will always fail
2833cdf84806SPeter Maydell#endif
283475cafad7SStefan Weilint main(void) { makecontext(0, 0, 0); return 0; }
2835d0e2fce5SAneesh Kumar K.VEOF
2836d0e2fce5SAneesh Kumar K.V    if compile_prog "" "" ; then
2837519175a2SAlex Barcelo        coroutine_backend=ucontext
2838519175a2SAlex Barcelo    else
2839519175a2SAlex Barcelo	coroutine_backend=gthread
2840d0e2fce5SAneesh Kumar K.V    fi
2841519175a2SAlex Barcelo  else
2842519175a2SAlex Barcelo    echo "Silently falling back into gthread backend under darwin"
2843519175a2SAlex Barcelo  fi
2844519175a2SAlex Barceloelif test "$coroutine" = "gthread" ; then
2845519175a2SAlex Barcelo  coroutine_backend=gthread
2846519175a2SAlex Barceloelif test "$coroutine" = "windows" ; then
2847519175a2SAlex Barcelo  coroutine_backend=windows
2848fe91bfa8SAlex Barceloelif test "$coroutine" = "sigaltstack" ; then
2849fe91bfa8SAlex Barcelo  coroutine_backend=sigaltstack
2850519175a2SAlex Barceloelse
2851519175a2SAlex Barcelo  echo
2852519175a2SAlex Barcelo  echo "Error: unknown coroutine backend $coroutine"
2853519175a2SAlex Barcelo  echo
2854519175a2SAlex Barcelo  exit 1
2855d0e2fce5SAneesh Kumar K.Vfi
2856d0e2fce5SAneesh Kumar K.V
2857d0e2fce5SAneesh Kumar K.V##########################################
2858d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
2859d2042378SAneesh Kumar K.V
28604e1797f9SStefan Weilopen_by_handle_at=no
2861d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
2862d2042378SAneesh Kumar K.V#include <fcntl.h>
2863acc55ba8SStefan Weil#if !defined(AT_EMPTY_PATH)
2864acc55ba8SStefan Weil# error missing definition
2865acc55ba8SStefan Weil#else
286675cafad7SStefan Weilint main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); }
2867acc55ba8SStefan Weil#endif
2868d2042378SAneesh Kumar K.VEOF
2869d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
2870d2042378SAneesh Kumar K.V    open_by_handle_at=yes
2871d2042378SAneesh Kumar K.Vfi
2872d2042378SAneesh Kumar K.V
2873e06a765eSHarsh Prateek Bora########################################
2874e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
2875e06a765eSHarsh Prateek Bora
2876e06a765eSHarsh Prateek Boralinux_magic_h=no
2877e06a765eSHarsh Prateek Boracat > $TMPC << EOF
2878e06a765eSHarsh Prateek Bora#include <linux/magic.h>
2879e06a765eSHarsh Prateek Boraint main(void) {
288075cafad7SStefan Weil  return 0;
2881e06a765eSHarsh Prateek Bora}
2882e06a765eSHarsh Prateek BoraEOF
2883e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
2884e06a765eSHarsh Prateek Bora    linux_magic_h=yes
2885e06a765eSHarsh Prateek Borafi
2886e06a765eSHarsh Prateek Bora
28878ab1bf12SLuiz Capitulino########################################
288806d71fa1SPeter Maydell# check whether we can disable the -Wunused-but-set-variable
288906d71fa1SPeter Maydell# option with a pragma (this is needed to silence a warning in
289006d71fa1SPeter Maydell# some versions of the valgrind VALGRIND_STACK_DEREGISTER macro.)
289106d71fa1SPeter Maydell# This test has to be compiled with -Werror as otherwise an
289206d71fa1SPeter Maydell# unknown pragma is only a warning.
289306d71fa1SPeter Maydellpragma_disable_unused_but_set=no
289406d71fa1SPeter Maydellcat > $TMPC << EOF
289506d71fa1SPeter Maydell#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
289606d71fa1SPeter Maydellint main(void) {
289706d71fa1SPeter Maydell    return 0;
289806d71fa1SPeter Maydell}
289906d71fa1SPeter MaydellEOF
290006d71fa1SPeter Maydellif compile_prog "-Werror" "" ; then
290106d71fa1SPeter Maydell    pragma_disable_unused_but_set=yes
290206d71fa1SPeter Maydellfi
290306d71fa1SPeter Maydell
290406d71fa1SPeter Maydell########################################
29053f4349dcSKevin Wolf# check if we have valgrind/valgrind.h
29063f4349dcSKevin Wolf
29073f4349dcSKevin Wolfvalgrind_h=no
29083f4349dcSKevin Wolfcat > $TMPC << EOF
29093f4349dcSKevin Wolf#include <valgrind/valgrind.h>
29103f4349dcSKevin Wolfint main(void) {
29113f4349dcSKevin Wolf  return 0;
29123f4349dcSKevin Wolf}
29133f4349dcSKevin WolfEOF
29143f4349dcSKevin Wolfif compile_prog "" "" ; then
29153f4349dcSKevin Wolf    valgrind_h=yes
29163f4349dcSKevin Wolffi
29173f4349dcSKevin Wolf
29183f4349dcSKevin Wolf########################################
29198ab1bf12SLuiz Capitulino# check if environ is declared
29208ab1bf12SLuiz Capitulino
29218ab1bf12SLuiz Capitulinohas_environ=no
29228ab1bf12SLuiz Capitulinocat > $TMPC << EOF
29238ab1bf12SLuiz Capitulino#include <unistd.h>
29248ab1bf12SLuiz Capitulinoint main(void) {
29258ab1bf12SLuiz Capitulino    environ = environ;
29268ab1bf12SLuiz Capitulino    return 0;
29278ab1bf12SLuiz Capitulino}
29288ab1bf12SLuiz CapitulinoEOF
29298ab1bf12SLuiz Capitulinoif compile_prog "" "" ; then
29308ab1bf12SLuiz Capitulino    has_environ=yes
29318ab1bf12SLuiz Capitulinofi
29328ab1bf12SLuiz Capitulino
2933d2042378SAneesh Kumar K.V##########################################
2934e86ecd4bSJuan Quintela# End of CC checks
2935e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2936e86ecd4bSJuan Quintela
2937e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
29388be74dc0SAvi Kivity  CFLAGS="-O2 -D_FORTIFY_SOURCE=2 $CFLAGS"
2939e86ecd4bSJuan Quintelafi
2940a316e378SJuan Quintela
294120ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
294220ff6c80SAnthony Liguori# enable/disable
294320ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
294420ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
294520ff6c80SAnthony Liguori	zero_malloc="no"
294620ff6c80SAnthony Liguori    else
294720ff6c80SAnthony Liguori	zero_malloc="yes"
294820ff6c80SAnthony Liguori    fi
294920ff6c80SAnthony Liguorifi
295020ff6c80SAnthony Liguori
29516ca026cbSPeter Maydell# Now we've finished running tests it's OK to add -Werror to the compiler flags
29526ca026cbSPeter Maydellif test "$werror" = "yes"; then
29536ca026cbSPeter Maydell    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
29546ca026cbSPeter Maydellfi
29556ca026cbSPeter Maydell
2956e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2957e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
29581156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2959e86ecd4bSJuan Quintela    fi
2960e86ecd4bSJuan Quintelafi
2961e86ecd4bSJuan Quintela
296294dd53c5SGerd Hoffmann# test if pod2man has --utf8 option
296394dd53c5SGerd Hoffmannif pod2man --help | grep -q utf8; then
296494dd53c5SGerd Hoffmann    POD2MAN="pod2man --utf8"
296594dd53c5SGerd Hoffmannelse
296694dd53c5SGerd Hoffmann    POD2MAN="pod2man"
296794dd53c5SGerd Hoffmannfi
296894dd53c5SGerd Hoffmann
2969952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
2970952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
2971952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
2972952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2973952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
2974952afb71SBlue Swirl        fi
2975952afb71SBlue Swirl    done
2976952afb71SBlue Swirlfi
2977952afb71SBlue Swirl
297810ea68b3SEduardo Habkostqemu_confdir=$sysconfdir$confsuffix
2979528ae5b8SEduardo Habkostqemu_datadir=$datadir$confsuffix
29805a67135aSbellard
2981ca35f780SPaolo Bonzinitools=
2982ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2983ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2984983eef5aSMeador Inge  if test "$virtfs" != no ; then
2985be5ea8edSAnthony Liguori    if test "$cap" = yes && test "$linux" = yes && test "$attr" = yes ; then
2986983eef5aSMeador Inge      virtfs=yes
298717bff52bSM. Mohan Kumar      tools="$tools fsdev/virtfs-proxy-helper\$(EXESUF)"
2988983eef5aSMeador Inge    else
2989983eef5aSMeador Inge      if test "$virtfs" = yes; then
2990263ddcc8SHarsh Prateek Bora        echo "VirtFS is supported only on Linux and requires libcap-devel and libattr-devel"
2991263ddcc8SHarsh Prateek Bora        exit 1
2992983eef5aSMeador Inge      fi
299317500370SAndreas Färber      virtfs=no
2994983eef5aSMeador Inge    fi
299517bff52bSM. Mohan Kumar  fi
2996ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2997ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2998d138cee9SMichael Roth    if [ "$guest_agent" = "yes" ]; then
299948ff7a62SMichael Roth      tools="qemu-ga\$(EXESUF) $tools"
3000d138cee9SMichael Roth    fi
3001ca35f780SPaolo Bonzini  fi
3002ca35f780SPaolo Bonzinifi
300300c705fbSPaolo Bonziniif test "$smartcard_nss" = "yes" ; then
300400c705fbSPaolo Bonzini  tools="vscclient\$(EXESUF) $tools"
300500c705fbSPaolo Bonzinifi
3006ca35f780SPaolo Bonzini
3007ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
3008ca35f780SPaolo Bonziniroms=
3009ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
3010ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
3011ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
3012ca35f780SPaolo Bonzini  roms="optionrom"
3013ca35f780SPaolo Bonzinifi
3014d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
301539ac8455SDavid Gibson  roms="$roms spapr-rtas"
301639ac8455SDavid Gibsonfi
3017ca35f780SPaolo Bonzini
30187d13299dSbellardecho "Install prefix    $prefix"
3019c00b2808SEduardo Habkostecho "BIOS directory    `eval echo $qemu_datadir`"
3020f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
30213aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
30220f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
30231c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
302411d9f695Sbellardif test "$mingw32" = "no" ; then
3025f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
302643ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
302711d9f695Sbellardfi
30285a67135aSbellardecho "Source path       $source_path"
30297d13299dSbellardecho "C compiler        $cc"
303083469015Sbellardecho "Host C compiler   $host_cc"
30310c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
3032a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
30330c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
30347d13299dSbellardecho "make              $make"
30356a882643Spbrookecho "install           $install"
3036c886edfbSBlue Swirlecho "python            $python"
3037e2d8830eSBradif test "$slirp" = "yes" ; then
3038e2d8830eSBrad    echo "smbd              $smbd"
3039e2d8830eSBradfi
3040a98fd896Sbellardecho "host CPU          $cpu"
3041de83cd02Sbellardecho "host big endian   $bigendian"
304297a847bcSbellardecho "target list       $target_list"
3043ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
3044b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
30457d13299dSbellardecho "gprof enabled     $gprof"
304603b4fe7dSaliguoriecho "sparse enabled    $sparse"
30471625af87Saliguoriecho "strip binaries    $strip_opt"
304805c2a3e7Sbellardecho "profiler          $profiler"
304943ce4dfeSbellardecho "static build      $static"
305085aa5189Sbellardecho "-Werror enabled   $werror"
30515b0753e0Sbellardif test "$darwin" = "yes" ; then
30525b0753e0Sbellard    echo "Cocoa support     $cocoa"
30535b0753e0Sbellardfi
305497a847bcSbellardecho "SDL support       $sdl"
30554d3b6f6eSbalrogecho "curses support    $curses"
3056769ce76dSAlexander Grafecho "curl support      $curl"
305767b915a5Sbellardecho "mingw32 support   $mingw32"
30580c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
30590c58ac1cSmalcecho "Extra audio cards $audio_card_list"
3060eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
30618ff9cbf7Smalcecho "Mixer emulation   $mixemu"
3062983eef5aSMeador Ingeecho "VirtFS support    $virtfs"
3063821601eaSJes Sorensenecho "VNC support       $vnc"
3064821601eaSJes Sorensenif test "$vnc" = "yes" ; then
30658d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
30662f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
30672f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
3068efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
3069821601eaSJes Sorensenfi
30703142255cSblueswir1if test -n "$sparc_cpu"; then
30713142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
30723142255cSblueswir1fi
3073e37630caSaliguoriecho "xen support       $xen"
30742e4d9fb1Saurel32echo "brlapi support    $brlapi"
3075a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
3076a25dba17SJuan Quintelaecho "Documentation     $docs"
3077c5937220Spbrook[ ! -z "$uname_release" ] && \
3078c5937220Spbrookecho "uname -r          $uname_release"
3079bd0c5661Spbrookecho "NPTL support      $nptl"
3080379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
308140d6444eSAvi Kivityecho "PIE               $pie"
30828a16d273Sthsecho "vde support       $vde"
30835c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
3084758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
308577755340Sthsecho "Install blobs     $blobs"
3086b31a0277SJuan Quintelaecho "KVM support       $kvm"
30879195b2c2SStefan Weilecho "TCG interpreter   $tcg_interpreter"
3088f652e6afSaurel32echo "fdt support       $fdt"
3089ceb42de8Saliguoriecho "preadv support    $preadv"
30905f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
3091e78815a5SAndreas Färberecho "madvise           $madvise"
3092e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
3093ee682d27SStefan Weilecho "uuid support      $uuid"
309447e98658SCorey Bryantecho "libcap-ng support $cap_ng"
3095d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
309694a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
30979410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
3098cd4ec0b4SGerd Hoffmannecho "spice support     $spice"
3099f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
3100dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
3101111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
310269354a83SHans de Goedeecho "usb net redir     $usb_redir"
310320ff075bSMichael Walleecho "OpenGL support    $opengl"
3104c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
3105d138cee9SMichael Rothecho "build guest agent $guest_agent"
3106519175a2SAlex Barceloecho "coroutine backend $coroutine_backend"
310767b915a5Sbellard
31081ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
310924b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
3110e8cd23deSbellardfi
311197a847bcSbellard
311298ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
31134bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
311497a847bcSbellard
311598ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
311698ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
311798ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
311898ec69acSJuan Quintelaecho >> $config_host_mak
311998ec69acSJuan Quintela
3120e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
312199d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
312299d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
31233aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
31240f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
312599d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
312699d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
312722d07038SEduardo Habkostecho "qemu_confdir=$qemu_confdir" >> $config_host_mak
31289afa52ceSEduardo Habkostecho "qemu_datadir=$qemu_datadir" >> $config_host_mak
31299afa52ceSEduardo Habkostecho "qemu_docdir=$qemu_docdir" >> $config_host_mak
31307b93fadfSCorey Bryantecho "libexecdir=\${prefix}/libexec" >> $config_host_mak
3131a7c36ee4SCorey Bryantecho "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
3132804edf29SJuan Quintela
313398ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
3134f8393946Saurel32if test "$debug_tcg" = "yes" ; then
31352358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
3136f8393946Saurel32fi
3137b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
3138b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
3139b4475aa2SLuiz Capitulinofi
3140f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
31412358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
3142f3d08ee6SPaul Brookfi
31431625af87Saliguoriif test "$strip_opt" = "yes" ; then
314452ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
31451625af87Saliguorifi
31467d13299dSbellardif test "$bigendian" = "yes" ; then
3147e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
314897a847bcSbellardfi
314967b915a5Sbellardif test "$mingw32" = "yes" ; then
315098ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
31519fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
31529fe6de94SBlue Swirl  version_major=${rc_version%%.*}
31539fe6de94SBlue Swirl  rc_version=${rc_version#*.}
31549fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
31559fe6de94SBlue Swirl  rc_version=${rc_version#*.}
31569fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
31579fe6de94SBlue Swirl  version_micro=0
31589fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
31599fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
3160210fa556Spbrookelse
316135f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
3162210fa556Spbrookfi
3163128ab2ffSblueswir1
3164dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
3165dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
3166dffcb71cSMark McLoughlinfi
3167dffcb71cSMark McLoughlin
316883fb7adfSbellardif test "$darwin" = "yes" ; then
316998ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
317083fb7adfSbellardfi
3171b29fe3edSmalc
3172b29fe3edSmalcif test "$aix" = "yes" ; then
317398ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
3174b29fe3edSmalcfi
3175b29fe3edSmalc
3176ec530c81Sbellardif test "$solaris" = "yes" ; then
317798ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
31782358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
31790475a5caSths  if test "$needs_libsunmath" = "yes" ; then
318075b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
31810475a5caSths  fi
3182ec530c81Sbellardfi
3183179cf400SAndreas Färberif test "$haiku" = "yes" ; then
3184179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
3185179cf400SAndreas Färberfi
318697a847bcSbellardif test "$static" = "yes" ; then
318798ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
318897a847bcSbellardfi
31891ba16968SStefan Weilif test "$profiler" = "yes" ; then
31902358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
319105c2a3e7Sbellardfi
3192c20709aaSbellardif test "$slirp" = "yes" ; then
319398ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
3194e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
3195f9728943SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
3196c20709aaSbellardfi
31978a16d273Sthsif test "$vde" = "yes" ; then
319898ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
31998a16d273Sthsfi
320047e98658SCorey Bryantif test "$cap_ng" = "yes" ; then
320147e98658SCorey Bryant  echo "CONFIG_LIBCAP=y" >> $config_host_mak
320247e98658SCorey Bryantfi
32030c58ac1cSmalcfor card in $audio_card_list; do
3204bb55b712SStefan Weil    def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
320598ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
32060c58ac1cSmalcdone
32072358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
32080c58ac1cSmalcfor drv in $audio_drv_list; do
3209bb55b712SStefan Weil    def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
321098ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
3211923e4521Smalc    if test "$drv" = "fmod"; then
32127aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
3213fb065187Sbellard    fi
32140c58ac1cSmalcdone
321567f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
321667f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
321767f86e8eSJuan Quintelafi
3218d5631638Smalcif test "$audio_win_int" = "yes" ; then
3219d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
3220d5631638Smalcfi
3221eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
32228ff9cbf7Smalcif test "$mixemu" = "yes" ; then
322398ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
32248ff9cbf7Smalcfi
3225821601eaSJes Sorensenif test "$vnc" = "yes" ; then
3226821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
3227821601eaSJes Sorensenfi
32288d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
322998ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
3230525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
32318d5d2d4cSthsfi
32322f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
323398ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
323460ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
32352f9606b3Saliguorifi
3236821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
32372f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
32382f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
32392f6f5c7aSCorentin Charyfi
3240821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
3241efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
3242efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
3243efe556adSCorentin Charyfi
324476655d6dSaliguoriif test "$fnmatch" = "yes" ; then
32452358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
324676655d6dSaliguorifi
3247ee682d27SStefan Weilif test "$uuid" = "yes" ; then
3248ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
3249ee682d27SStefan Weilfi
3250dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
3251dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
3252dce512deSChristoph Hellwigfi
3253b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
325498ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
32552358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
325698ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
325798ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
3258a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
325998ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
3260cc8ae6deSpbrookfi
32611ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
326298ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
32638ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
326449ecc3faSbellardfi
326549ecc3faSbellardif test "$cocoa" = "yes" ; then
326698ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
326749ecc3faSbellardfi
32684d3b6f6eSbalrogif test "$curses" = "yes" ; then
326998ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
3270ab4e5602SJan Kiszkafi
32713b3f24adSaurel32if test "$atfile" = "yes" ; then
32722358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
32733b3f24adSaurel32fi
3274ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
32752358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
3276ebc996f3SRiku Voipiofi
3277099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
32782358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
3279099d6b0fSRiku Voipiofi
328040ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
328140ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
328240ff6d7eSKevin Wolffi
32833ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
32842358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
32853ce34dfbSvibisreenivasanfi
3286c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
3287c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
3288c2882b96SRiku Voipiofi
3289d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
3290d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
3291d0927938SUlrich Hechtfi
3292c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
3293c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
3294c727f47dSPeter Maydellfi
3295dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
3296dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
3297dace20dcSPeter Maydellfi
3298d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
3299d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
3300d0927938SUlrich Hechtfi
33013b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
33023b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
33033b6edd16SPeter Maydellfi
33043b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
33053b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
33063b6edd16SPeter Maydellfi
33073b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
33083b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
33093b6edd16SPeter Maydellfi
33103b3f24adSaurel32if test "$inotify" = "yes" ; then
33112358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
33123b3f24adSaurel32fi
3313c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
3314c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
3315c05c7a73SRiku Voipiofi
33166ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
33176ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
33186ae9a1f4SJuan Quintelafi
33196ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
33206ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
33216ae9a1f4SJuan Quintelafi
3322769ce76dSAlexander Grafif test "$curl" = "yes" ; then
332398ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
3324b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3325769ce76dSAlexander Graffi
33262e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
332798ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
33282e4d9fb1Saurel32fi
3329fb599c9aSbalrogif test "$bluez" = "yes" ; then
333098ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
3331ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3332fb599c9aSbalrogfi
3333e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3334e37630caSaliguoriif test "$xen" = "yes" ; then
33356dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3336d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3337e37630caSaliguorifi
33385c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
33395c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
33405c6c3a6cSChristoph Hellwigfi
3341758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
3342758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
3343758e8e38SVenkateswararao Jujjuri (JV)fi
33444f26f2b6SAvi Kivityif test "$libattr" = "yes" ; then
33454f26f2b6SAvi Kivity  echo "CONFIG_LIBATTR=y" >> $config_host_mak
33464f26f2b6SAvi Kivityfi
3347983eef5aSMeador Ingeif test "$virtfs" = "yes" ; then
3348758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_VIRTFS=y" >> $config_host_mak
3349758e8e38SVenkateswararao Jujjuri (JV)fi
335077755340Sthsif test "$blobs" = "yes" ; then
335198ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
335277755340Sthsfi
3353bf9298b9Saliguoriif test "$iovec" = "yes" ; then
33542358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
3355bf9298b9Saliguorifi
3356ceb42de8Saliguoriif test "$preadv" = "yes" ; then
33572358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
3358ceb42de8Saliguorifi
3359f652e6afSaurel32if test "$fdt" = "yes" ; then
33603f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
3361f652e6afSaurel32fi
3362dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
3363dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3364dcc38d1cSMarcelo Tosattifi
33659195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
33669195b2c2SStefan Weil  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
33679195b2c2SStefan Weilfi
33685f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
33695f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
33705f6b9e8fSBlue Swirlfi
3371e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
3372e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
3373e78815a5SAndreas Färberfi
3374e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
3375e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3376e78815a5SAndreas Färberfi
337797a847bcSbellard
3378cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
3379cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
3380cd4ec0b4SGerd Hoffmannfi
3381cd4ec0b4SGerd Hoffmann
338236707144SAlon Levyif test "$smartcard" = "yes" ; then
338336707144SAlon Levy  echo "CONFIG_SMARTCARD=y" >> $config_host_mak
338436707144SAlon Levyfi
338536707144SAlon Levy
3386111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3387111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3388ad4cf3f6SPaul Brook  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3389ad4cf3f6SPaul Brook  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3390111a38b0SRobert Relyeafi
3391111a38b0SRobert Relyea
339269354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
339369354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
339469354a83SHans de Goedefi
339569354a83SHans de Goede
339620ff075bSMichael Walleif test "$opengl" = "yes" ; then
339720ff075bSMichael Walle  echo "CONFIG_OPENGL=y" >> $config_host_mak
339820ff075bSMichael Wallefi
339920ff075bSMichael Walle
3400c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
3401c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3402c589b249SRonnie Sahlbergfi
3403c589b249SRonnie Sahlberg
340483fb7adfSbellard# XXX: suppress that
34057d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
34062358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
34077d3505c5Sbellardfi
34087d3505c5Sbellard
34092358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3410c5937220Spbrook
341120ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
341220ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
341320ff6c80SAnthony Liguorifi
3414f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
3415f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
3416f27aaf4bSChristian Brunnerfi
341720ff6c80SAnthony Liguori
3418519175a2SAlex Barceloif test "$coroutine_backend" = "ucontext" ; then
3419d0e2fce5SAneesh Kumar K.V  echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3420fe91bfa8SAlex Barceloelif test "$coroutine_backend" = "sigaltstack" ; then
3421fe91bfa8SAlex Barcelo  echo "CONFIG_SIGALTSTACK_COROUTINE=y" >> $config_host_mak
3422d0e2fce5SAneesh Kumar K.Vfi
3423d0e2fce5SAneesh Kumar K.V
3424d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
3425d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3426d2042378SAneesh Kumar K.Vfi
3427d2042378SAneesh Kumar K.V
3428e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
3429e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3430e06a765eSHarsh Prateek Borafi
3431e06a765eSHarsh Prateek Bora
343206d71fa1SPeter Maydellif test "$pragma_disable_unused_but_set" = "yes" ; then
343306d71fa1SPeter Maydell  echo "CONFIG_PRAGMA_DISABLE_UNUSED_BUT_SET=y" >> $config_host_mak
343406d71fa1SPeter Maydellfi
343506d71fa1SPeter Maydell
34363f4349dcSKevin Wolfif test "$valgrind_h" = "yes" ; then
34373f4349dcSKevin Wolf  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
34383f4349dcSKevin Wolffi
34393f4349dcSKevin Wolf
34408ab1bf12SLuiz Capitulinoif test "$has_environ" = "yes" ; then
34418ab1bf12SLuiz Capitulino  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
34428ab1bf12SLuiz Capitulinofi
34438ab1bf12SLuiz Capitulino
344468063649Sblueswir1# USB host support
344568063649Sblueswir1case "$usb" in
344668063649Sblueswir1linux)
344798ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
344868063649Sblueswir1;;
344968063649Sblueswir1bsd)
345098ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
345168063649Sblueswir1;;
345268063649Sblueswir1*)
345398ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
345468063649Sblueswir1;;
345568063649Sblueswir1esac
345668063649Sblueswir1
3457e4858974SLluís# use default implementation for tracing backend-specific routines
3458e4858974SLluístrace_default=yes
345994a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
34606d8a764eSLluísif test "$trace_backend" = "nop"; then
34616d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
346222890ab5SPrerna Saxenafi
34639410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
34646d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3465e4858974SLluís  trace_default=no
34666d8a764eSLluís  # Set the appropriate trace file.
3467953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
34689410b56cSPrerna Saxenafi
34696d8a764eSLluísif test "$trace_backend" = "stderr"; then
34706d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
34719a82b6a5SLluís  trace_default=no
34726d8a764eSLluísfi
34736d8a764eSLluísif test "$trace_backend" = "ust"; then
34746d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
34756d8a764eSLluísfi
34766d8a764eSLluísif test "$trace_backend" = "dtrace"; then
34776d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
34786d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
34796d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
34806d8a764eSLluís  fi
3481c276b17dSDaniel P. Berrangefi
34829410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3483e4858974SLluísif test "$trace_default" = "yes"; then
3484e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3485e4858974SLluísfi
34869410b56cSPrerna Saxena
348798ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
348898ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
3489804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
3490804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
34911901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
34921901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
34931901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3494c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
3495804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
34962b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
3497804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
3498804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
3499804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
3500804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
35019fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
350244dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
3503e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
3504a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3505f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3506e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
3507e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
3508e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
3509e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3510e39f0062SPaolo Bonzinifi
3511c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3512e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
3513a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3514a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
351573da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
35163e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3517804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
3518957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
351994dd53c5SGerd Hoffmannecho "POD2MAN=$POD2MAN" >> $config_host_mak
3520804edf29SJuan Quintela
35214bf6b55bSJuan Quintela# generate list of library paths for linker script
35224bf6b55bSJuan Quintela
35234bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
35244bf6b55bSJuan Quintela
35254bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
35264bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
35274bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
35284bf6b55bSJuan Quintela  else
35294bf6b55bSJuan Quintela    rm ${config_host_ld}~
35304bf6b55bSJuan Quintela  fi
35314bf6b55bSJuan Quintelafi
35324bf6b55bSJuan Quintela
35334d904533SBlue Swirlfor d in libdis libdis-user; do
353472b8b5a1SStefan Weil    symlink "$source_path/Makefile.dis" "$d/Makefile"
35354d904533SBlue Swirl    echo > $d/config.mak
35364d904533SBlue Swirldone
35374d904533SBlue Swirl
35386efd7517SPeter Maydell# use included Linux headers
35396efd7517SPeter Maydellif test "$linux" = "yes" ; then
3540a307beb6SAndreas Färber  mkdir -p linux-headers
35416efd7517SPeter Maydell  case "$cpu" in
35426efd7517SPeter Maydell  i386|x86_64)
354372b8b5a1SStefan Weil    symlink "$source_path/linux-headers/asm-x86" linux-headers/asm
35446efd7517SPeter Maydell    ;;
35456efd7517SPeter Maydell  ppcemb|ppc|ppc64)
354672b8b5a1SStefan Weil    symlink "$source_path/linux-headers/asm-powerpc" linux-headers/asm
35476efd7517SPeter Maydell    ;;
35486efd7517SPeter Maydell  s390x)
354972b8b5a1SStefan Weil    symlink "$source_path/linux-headers/asm-s390" linux-headers/asm
35506efd7517SPeter Maydell    ;;
35516efd7517SPeter Maydell  esac
35526efd7517SPeter Maydellfi
35536efd7517SPeter Maydell
355497a847bcSbellardfor target in $target_list; do
355597a847bcSbellardtarget_dir="$target"
355625be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
3557600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
355897a847bcSbellardtarget_bigendian="no"
35591f3d3c8fSJuan Quintela
3560ea2d6a39SJuan Quintelacase "$target_arch2" in
3561e67db06eSJia Liu  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|or32|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3562ea2d6a39SJuan Quintela  target_bigendian=yes
3563ea2d6a39SJuan Quintela  ;;
3564ea2d6a39SJuan Quintelaesac
356597a847bcSbellardtarget_softmmu="no"
3566997344f3Sbellardtarget_user_only="no"
3567831b7825Sthstarget_linux_user="no"
356884778508Sblueswir1target_bsd_user="no"
35699e407a85Spbrookcase "$target" in
3570600309b6SBlue Swirl  ${target_arch2}-softmmu)
35719e407a85Spbrook    target_softmmu="yes"
35729e407a85Spbrook    ;;
3573600309b6SBlue Swirl  ${target_arch2}-linux-user)
35749c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
35759c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
35769c7a4202SBlue Swirl      exit 1
35779c7a4202SBlue Swirl    fi
35789e407a85Spbrook    target_user_only="yes"
35799e407a85Spbrook    target_linux_user="yes"
35809e407a85Spbrook    ;;
3581600309b6SBlue Swirl  ${target_arch2}-bsd-user)
35829cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
35839c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
35849c7a4202SBlue Swirl      exit 1
35859c7a4202SBlue Swirl    fi
358684778508Sblueswir1    target_user_only="yes"
358784778508Sblueswir1    target_bsd_user="yes"
358884778508Sblueswir1    ;;
35899e407a85Spbrook  *)
35909e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
35919e407a85Spbrook    exit 1
35929e407a85Spbrook    ;;
35939e407a85Spbrookesac
3594831b7825Sths
359597a847bcSbellardmkdir -p $target_dir
359625be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
359797a847bcSbellard
3598e5fe0c52Spbrookbflt="no"
3599bd0c5661Spbrooktarget_nptl="no"
3600600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
360156aebc89Spbrookgdb_xml_files=""
3602c2e3dee6SLaurent Viviertarget_short_alignment=2
3603c2e3dee6SLaurent Viviertarget_int_alignment=4
3604c2e3dee6SLaurent Viviertarget_long_alignment=4
3605c2e3dee6SLaurent Viviertarget_llong_alignment=8
3606de3a354aSMichael Walletarget_libs_softmmu=
36077ba1e619Saliguori
3608938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
36096acff7daSJuan QuintelaTARGET_BASE_ARCH=""
3610e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
3611e73aae67SJuan Quintela
3612600309b6SBlue Swirlcase "$target_arch2" in
36132408a527Saurel32  i386)
361471deff27SAurelien Jarno    target_phys_bits=64
36152408a527Saurel32  ;;
36162408a527Saurel32  x86_64)
36176acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
36181ad2134fSPaul Brook    target_phys_bits=64
3619c2e3dee6SLaurent Vivier    target_long_alignment=8
36202408a527Saurel32  ;;
36212408a527Saurel32  alpha)
36221ad2134fSPaul Brook    target_phys_bits=64
3623c2e3dee6SLaurent Vivier    target_long_alignment=8
3624a4b388ffSRichard Henderson    target_nptl="yes"
36252408a527Saurel32  ;;
36262408a527Saurel32  arm|armeb)
3627b498c8a0SJuan Quintela    TARGET_ARCH=arm
3628e5fe0c52Spbrook    bflt="yes"
3629bd0c5661Spbrook    target_nptl="yes"
363056aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
36313cc0cd61SPeter Maydell    target_phys_bits=64
3632c2e3dee6SLaurent Vivier    target_llong_alignment=4
3633412beee6SGrant Likely    target_libs_softmmu="$fdt_libs"
36342408a527Saurel32  ;;
36352408a527Saurel32  cris)
3636253bd7f8Sedgar_igl    target_nptl="yes"
36371ad2134fSPaul Brook    target_phys_bits=32
36382408a527Saurel32  ;;
3639613a22c9SMichael Walle  lm32)
3640613a22c9SMichael Walle    target_phys_bits=32
3641de3a354aSMichael Walle    target_libs_softmmu="$opengl_libs"
3642613a22c9SMichael Walle  ;;
36432408a527Saurel32  m68k)
36440938cda5Saurel32    bflt="yes"
364556aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
36461ad2134fSPaul Brook    target_phys_bits=32
3647c2e3dee6SLaurent Vivier    target_int_alignment=2
3648c2e3dee6SLaurent Vivier    target_long_alignment=2
3649c2e3dee6SLaurent Vivier    target_llong_alignment=2
36502408a527Saurel32  ;;
3651877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
3652877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
365372b675caSEdgar E. Iglesias    bflt="yes"
365472b675caSEdgar E. Iglesias    target_nptl="yes"
365572b675caSEdgar E. Iglesias    target_phys_bits=32
3656de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
365772b675caSEdgar E. Iglesias  ;;
36582408a527Saurel32  mips|mipsel)
3659b498c8a0SJuan Quintela    TARGET_ARCH=mips
366025be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3661f04dc72fSPaul Brook    target_nptl="yes"
36621ad2134fSPaul Brook    target_phys_bits=64
36632408a527Saurel32  ;;
36642408a527Saurel32  mipsn32|mipsn32el)
3665b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
36666acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
366725be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
36681ad2134fSPaul Brook    target_phys_bits=64
36692408a527Saurel32  ;;
36702408a527Saurel32  mips64|mips64el)
3671b498c8a0SJuan Quintela    TARGET_ARCH=mips64
36726acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
367325be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
36741ad2134fSPaul Brook    target_phys_bits=64
3675c2e3dee6SLaurent Vivier    target_long_alignment=8
36762408a527Saurel32  ;;
3677e67db06eSJia Liu  or32)
3678e67db06eSJia Liu    TARGET_ARCH=openrisc
3679e67db06eSJia Liu    TARGET_BASE_ARCH=openrisc
3680e67db06eSJia Liu    target_phys_bits=32
3681e67db06eSJia Liu  ;;
36822408a527Saurel32  ppc)
3683c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
36848b242ebaSAlexander Graf    target_phys_bits=64
3685d6630708SNathan Froyd    target_nptl="yes"
3686de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
36872408a527Saurel32  ;;
36882408a527Saurel32  ppcemb)
36896acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3690e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3691c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
36921ad2134fSPaul Brook    target_phys_bits=64
3693d6630708SNathan Froyd    target_nptl="yes"
3694de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
36952408a527Saurel32  ;;
36962408a527Saurel32  ppc64)
36976acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3698e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3699c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
37001ad2134fSPaul Brook    target_phys_bits=64
3701c2e3dee6SLaurent Vivier    target_long_alignment=8
3702de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
37032408a527Saurel32  ;;
37042408a527Saurel32  ppc64abi32)
3705b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
37066acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3707e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
370825be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
3709c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
37101ad2134fSPaul Brook    target_phys_bits=64
3711de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
37122408a527Saurel32  ;;
37132408a527Saurel32  sh4|sh4eb)
3714b498c8a0SJuan Quintela    TARGET_ARCH=sh4
37154dbed897Spbrook    bflt="yes"
37160b6d3ae0Saurel32    target_nptl="yes"
37171ad2134fSPaul Brook    target_phys_bits=32
37182408a527Saurel32  ;;
37192408a527Saurel32  sparc)
37201ad2134fSPaul Brook    target_phys_bits=64
37212408a527Saurel32  ;;
37222408a527Saurel32  sparc64)
37236acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
37241ad2134fSPaul Brook    target_phys_bits=64
3725c2e3dee6SLaurent Vivier    target_long_alignment=8
37262408a527Saurel32  ;;
37272408a527Saurel32  sparc32plus)
3728b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
37296acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
3730e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
373125be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
37321ad2134fSPaul Brook    target_phys_bits=64
37332408a527Saurel32  ;;
373424e804ecSAlexander Graf  s390x)
3735bc434676SUlrich Hecht    target_nptl="yes"
373624e804ecSAlexander Graf    target_phys_bits=64
37377b3da903SAlexander Graf    target_long_alignment=8
373824e804ecSAlexander Graf  ;;
3739d2fbca94SGuan Xuetao  unicore32)
3740d2fbca94SGuan Xuetao    target_phys_bits=32
3741d2fbca94SGuan Xuetao  ;;
3742cfa550c6SMax Filippov  xtensa|xtensaeb)
3743cfa550c6SMax Filippov    TARGET_ARCH=xtensa
3744cfa550c6SMax Filippov    target_phys_bits=32
3745cfa550c6SMax Filippov  ;;
37462408a527Saurel32  *)
3747de83cd02Sbellard    echo "Unsupported target CPU"
3748de83cd02Sbellard    exit 1
37492408a527Saurel32  ;;
37502408a527Saurel32esac
37515e8861a0SPaolo Bonzini# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
37525e8861a0SPaolo Bonziniif [ "$TARGET_BASE_ARCH" = "" ]; then
37535e8861a0SPaolo Bonzini  TARGET_BASE_ARCH=$TARGET_ARCH
37545e8861a0SPaolo Bonzinifi
37555e8861a0SPaolo Bonzini
37565e8861a0SPaolo Bonzinisymlink "$source_path/Makefile.target" "$target_dir/Makefile"
37575e8861a0SPaolo Bonzini
37580184e266SBlue Swirl
37590184e266SBlue Swirlcase "$target_arch2" in
3760e67db06eSJia Liu  alpha | or32 | sparc* | xtensa* | ppc*)
37610184e266SBlue Swirl    echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
37620184e266SBlue Swirl  ;;
37630184e266SBlue Swirlesac
37640184e266SBlue Swirl
3765c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3766c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3767c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3768c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
376925be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3770bb55b712SStefan Weiltarget_arch_name="`echo $TARGET_ARCH | LC_ALL=C tr '[a-z]' '[A-Z]'`"
377125be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
377225be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
377325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3774e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
3775e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
3776e6e91b9cSJuan Quintelafi
377725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
37781b0c87fcSJuan Quintelacase "$target_arch2" in
37791b0c87fcSJuan Quintela  i386|x86_64)
37801b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
378164b3cfdbSAnthony PERARD      target_phys_bits=64
378225be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
3783eb6fda0fSAnthony PERARD      if test "$xen_pci_passthrough" = yes; then
3784eb6fda0fSAnthony PERARD        echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
3785eb6fda0fSAnthony PERARD      fi
378659d21e53SAlexander Graf    else
378759d21e53SAlexander Graf      echo "CONFIG_NO_XEN=y" >> $config_target_mak
3788432d268cSJun Nakajima    fi
378959d21e53SAlexander Graf    ;;
379059d21e53SAlexander Graf  *)
379159d21e53SAlexander Graf    echo "CONFIG_NO_XEN=y" >> $config_target_mak
37921b0c87fcSJuan Quintelaesac
3793c59249f9SJuan Quintelacase "$target_arch2" in
37940e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
3795c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
3796c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3797c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
3798c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
37995f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
3800adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
3801adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3802c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
3803c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
380425be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
38051ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
3806d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3807d5970055SMichael S. Tsirkin      fi
3808c59249f9SJuan Quintela    fi
3809c59249f9SJuan Quintelaesac
3810fae001f5SWen Congyangcase "$target_arch2" in
3811fae001f5SWen Congyang  i386|x86_64)
3812fae001f5SWen Congyang    echo "CONFIG_HAVE_GET_MEMORY_MAPPING=y" >> $config_target_mak
3813fae001f5SWen Congyangesac
38147f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
38150a6b8ddeSAlexander Graf  echo "CONFIG_PSERIES=y" >> $config_target_mak
38160a6b8ddeSAlexander Graffi
3817de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
381825be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
381997a847bcSbellardfi
382097a847bcSbellardif test "$target_softmmu" = "yes" ; then
3821b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
382225be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3823de3a354aSMichael Walle  echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
38240e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
38255791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3826ad4cf3f6SPaul Brook  if test "$smartcard_nss" = "yes" ; then
3827ad4cf3f6SPaul Brook    echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3828ad4cf3f6SPaul Brook  fi
38299fecbed0SWen Congyang  case "$target_arch2" in
38309fecbed0SWen Congyang    i386|x86_64)
38319fecbed0SWen Congyang      echo "CONFIG_HAVE_CORE_DUMP=y" >> $config_target_mak
38329fecbed0SWen Congyang  esac
3833de83cd02Sbellardfi
3834997344f3Sbellardif test "$target_user_only" = "yes" ; then
383525be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3836a2c80be9SStefan Weil  echo "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
3837997344f3Sbellardfi
3838831b7825Sthsif test "$target_linux_user" = "yes" ; then
383925be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3840831b7825Sthsfi
384156aebc89Spbrooklist=""
384256aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
384356aebc89Spbrook  for x in $gdb_xml_files; do
384456aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
384556aebc89Spbrook  done
384625be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
38473d0f1517SJuan Quintelafi
3848de83cd02Sbellard
3849e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
385025be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3851e5fe0c52Spbrookfi
3852bd0c5661Spbrookif test "$target_user_only" = "yes" \
3853bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
385425be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3855bd0c5661Spbrookfi
3856379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
385725be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3858379f6698SPaul Brookfi
385984778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
386025be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
386184778508Sblueswir1fi
38625b0753e0Sbellard
38634afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
3864fa282484SJuan Quintela
38654afddb55SJuan Quintelacflags=""
3866f9728943SPaolo Bonziniincludes=""
3867fa282484SJuan Quintelaldflags=""
38689b8e111fSJuan Quintela
38699195b2c2SStefan Weilif test "$tcg_interpreter" = "yes"; then
38709195b2c2SStefan Weil  includes="-I\$(SRC_PATH)/tcg/tci $includes"
38719195b2c2SStefan Weilelif test "$ARCH" = "sparc64" ; then
3872f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
387324e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
3874f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
38755d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
3876f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
387757ddfbf7SJuan Quintelaelse
3878f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
387957ddfbf7SJuan Quintelafi
3880f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
388157ddfbf7SJuan Quintela
38826efd7517SPeter Maydellif test "$linux" = "yes" ; then
38836efd7517SPeter Maydell  includes="-I\$(SRC_PATH)/linux-headers $includes"
38846efd7517SPeter Maydellfi
38856efd7517SPeter Maydell
38864d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
38874d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
38884d904533SBlue Swirlelse
38894d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
38904d904533SBlue Swirlfi
38914d904533SBlue Swirl
389264656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
389364656024SJuan Quintela  case "$i" in
389464656024SJuan Quintela  alpha)
389525be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
38964d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
389764656024SJuan Quintela  ;;
389864656024SJuan Quintela  arm)
389925be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
39004d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
390164656024SJuan Quintela  ;;
390264656024SJuan Quintela  cris)
390325be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
39044d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
390564656024SJuan Quintela  ;;
390664656024SJuan Quintela  hppa)
390725be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
39084d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
390964656024SJuan Quintela  ;;
391064656024SJuan Quintela  i386|x86_64)
391125be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
39124d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
391364656024SJuan Quintela  ;;
3914903ec55cSAurelien Jarno  ia64*)
3915903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
3916903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
3917903ec55cSAurelien Jarno  ;;
391879368f49SMichael Walle  lm32)
391979368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $config_target_mak
392079368f49SMichael Walle    echo "CONFIG_LM32_DIS=y"  >> $libdis_config_mak
392179368f49SMichael Walle  ;;
392264656024SJuan Quintela  m68k)
392325be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
39244d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
392564656024SJuan Quintela  ;;
3926877fdc12SEdgar E. Iglesias  microblaze*)
392725be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
39284d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
392964656024SJuan Quintela  ;;
393064656024SJuan Quintela  mips*)
393125be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
39324d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
393364656024SJuan Quintela  ;;
3934e67db06eSJia Liu  or32)
3935e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $config_target_mak
3936e67db06eSJia Liu    echo "CONFIG_OPENRISC_DIS=y"  >> $libdis_config_mak
3937e67db06eSJia Liu  ;;
393864656024SJuan Quintela  ppc*)
393925be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
39404d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
394164656024SJuan Quintela  ;;
394224e804ecSAlexander Graf  s390*)
394325be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
39444d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
394564656024SJuan Quintela  ;;
394664656024SJuan Quintela  sh4)
394725be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
39484d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
394964656024SJuan Quintela  ;;
395064656024SJuan Quintela  sparc*)
395125be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
39524d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
395364656024SJuan Quintela  ;;
3954cfa550c6SMax Filippov  xtensa*)
3955cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
3956cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $libdis_config_mak
3957cfa550c6SMax Filippov  ;;
395864656024SJuan Quintela  esac
395964656024SJuan Quinteladone
39609195b2c2SStefan Weilif test "$tcg_interpreter" = "yes" ; then
39619195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $config_target_mak
39629195b2c2SStefan Weil  echo "CONFIG_TCI_DIS=y"  >> $libdis_config_mak
39639195b2c2SStefan Weilfi
396464656024SJuan Quintela
39656ee7126fSJuan Quintelacase "$ARCH" in
39666ee7126fSJuan Quintelaalpha)
39676ee7126fSJuan Quintela  # Ensure there's only a single GP
39686ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
39696ee7126fSJuan Quintela;;
39706ee7126fSJuan Quintelaesac
39716ee7126fSJuan Quintela
397255d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
397355d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
397455d9c04bSJuan Quintela  arm)
397555d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
397655d9c04bSJuan Quintela  ;;
397725a8bb96SMichael Walle  lm32)
397825a8bb96SMichael Walle    cflags="-DHAS_AUDIO $cflags"
397925a8bb96SMichael Walle  ;;
398055d9c04bSJuan Quintela  i386|mips|ppc)
398155d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
398255d9c04bSJuan Quintela  ;;
398355d9c04bSJuan Quintela  esac
398455d9c04bSJuan Quintelafi
398555d9c04bSJuan Quintela
3986d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
398725be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
3988d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
3989d02c1db3SJuan Quintela    cflags="-p $cflags"
3990d02c1db3SJuan Quintela    ldflags="-p $ldflags"
3991d02c1db3SJuan Quintela  fi
3992d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
3993d02c1db3SJuan Quintela    ldflags="-p $ldflags"
399425be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
3995d02c1db3SJuan Quintela  fi
3996d02c1db3SJuan Quintelafi
3997d02c1db3SJuan Quintela
39989195b2c2SStefan Weilif test "$ARCH" = "tci"; then
39999195b2c2SStefan Weil  linker_script=""
40009195b2c2SStefan Weilelse
40016ee7126fSJuan Quintela  linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
40029195b2c2SStefan Weilfi
40039195b2c2SStefan Weil
40049b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
4005fa282484SJuan Quintela  case "$ARCH" in
4006fa282484SJuan Quintela  sparc)
4007fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
4008322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
4009fa282484SJuan Quintela    ;;
40104d58be06SRichard Henderson  alpha | s390x)
40114d58be06SRichard Henderson    # The default placement of the application is fine.
40124d58be06SRichard Henderson    ;;
4013fd76e73aSRichard Henderson  *)
4014322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
4015fa282484SJuan Quintela    ;;
4016fa282484SJuan Quintela  esac
4017fa282484SJuan Quintelafi
4018fa282484SJuan Quintela
401925be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
402025be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
4021f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
4022fa282484SJuan Quintela
402397a847bcSbellarddone # for target in $targets
40247d13299dSbellard
4025d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
4026927b241dSMichael WalleDIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32"
40272dee8d54SPaolo BonziniDIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas"
40282d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
40292dee8d54SPaolo BonziniDIRS="$DIRS qapi-generated"
403000c705fbSPaolo BonziniDIRS="$DIRS libcacard libcacard/libcacard libcacard/trace"
4031c09015ddSAnthony LiguoriFILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
4032c09015ddSAnthony LiguoriFILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
403300c705fbSPaolo BonziniFILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile"
4034ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
4035446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
40362d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
4037753d11f2SRichard Hendersonfor bios_file in \
4038753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
4039753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
4040753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
4041753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
4042753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
4043753d11f2SRichard Hendersondo
40447ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
40457ea78b74SJan Kiszkadone
4046d1807a4fSPaolo Bonzinimkdir -p $DIRS
40477d13299dSbellardfor f in $FILES ; do
404872b8b5a1SStefan Weil    if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
4049f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
4050f9245e10SPeter Maydell    fi
40517d13299dSbellarddone
40521ad2134fSPaul Brook
4053c34ebfdcSAnthony Liguori# temporary config to build submodules
40542d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
4055c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
405637116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
4057c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
4058c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
4059c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
4060c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
4061c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
4062c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
4063c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
4064c34ebfdcSAnthony Liguoridone
4065c34ebfdcSAnthony Liguori
40661ad2134fSPaul Brookfor hwlib in 32 64; do
40671ad2134fSPaul Brook  d=libhw$hwlib
406872b8b5a1SStefan Weil  symlink "$source_path/Makefile.hw" "$d/Makefile"
406937116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
40701ad2134fSPaul Brookdone
4071add16157SBlue Swirl
4072add16157SBlue Swirld=libuser
407372b8b5a1SStefan Weilsymlink "$source_path/Makefile.user" "$d/Makefile"
4074b40292e7SJan Kiszka
4075b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
4076b40292e7SJan Kiszka  mkdir -p QMP
4077b40292e7SJan Kiszkafi
4078