xref: /openbmc/qemu/configure (revision cfa550c6)
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
2352166aa0SJuan Quintelacompile_object() {
24da1d85e3SGerd Hoffmann  echo $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log
25da1d85e3SGerd Hoffmann  $cc $QEMU_CFLAGS -c -o $TMPO $TMPC >> config.log 2>&1
2652166aa0SJuan Quintela}
2752166aa0SJuan Quintela
2852166aa0SJuan Quintelacompile_prog() {
2952166aa0SJuan Quintela  local_cflags="$1"
3052166aa0SJuan Quintela  local_ldflags="$2"
31da1d85e3SGerd Hoffmann  echo $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log
32da1d85e3SGerd Hoffmann  $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1
3352166aa0SJuan Quintela}
3452166aa0SJuan Quintela
3511568d6dSPaolo Bonzini# symbolically link $1 to $2.  Portable version of "ln -sf".
3611568d6dSPaolo Bonzinisymlink() {
3711568d6dSPaolo Bonzini  rm -f $2
3811568d6dSPaolo Bonzini  ln -s $1 $2
3911568d6dSPaolo Bonzini}
4011568d6dSPaolo Bonzini
410dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
420dba6195SLoïc Minier# executable or a builtin)
430dba6195SLoïc Minierhas() {
440dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
450dba6195SLoïc Minier}
460dba6195SLoïc Minier
470dba6195SLoïc Minier# search for an executable in PATH
480dba6195SLoïc Minierpath_of() {
490dba6195SLoïc Minier    local_command="$1"
500dba6195SLoïc Minier    local_ifs="$IFS"
510dba6195SLoïc Minier    local_dir=""
520dba6195SLoïc Minier
530dba6195SLoïc Minier    # pathname has a dir component?
540dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
550dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
560dba6195SLoïc Minier            echo "$local_command"
570dba6195SLoïc Minier            return 0
580dba6195SLoïc Minier        fi
590dba6195SLoïc Minier    fi
600dba6195SLoïc Minier    if [ -z "$local_command" ]; then
610dba6195SLoïc Minier        return 1
620dba6195SLoïc Minier    fi
630dba6195SLoïc Minier
640dba6195SLoïc Minier    IFS=:
650dba6195SLoïc Minier    for local_dir in $PATH; do
660dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
670dba6195SLoïc Minier            echo "$local_dir/$local_command"
680dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
690dba6195SLoïc Minier            return 0
700dba6195SLoïc Minier        fi
710dba6195SLoïc Minier    done
720dba6195SLoïc Minier    # not found
730dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
740dba6195SLoïc Minier    return 1
750dba6195SLoïc Minier}
760dba6195SLoïc Minier
777d13299dSbellard# default parameters
78ca4deeb1SPaolo Bonzinisource_path=`dirname "$0"`
792ff6b91eSJuan Quintelacpu=""
801e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
8143ce4dfeSbellardstatic="no"
82ed968ff1SJuan Quintelasparc_cpu=""
837d13299dSbellardcross_prefix=""
840c58ac1cSmalcaudio_drv_list=""
85d61a4ce8SGerd Hoffmannaudio_card_list="ac97 es1370 sb16 hda"
86d61a4ce8SGerd Hoffmannaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
87eb852011SMarkus Armbrusterblock_drv_whitelist=""
887d13299dSbellardhost_cc="gcc"
89c81da56eSJuan Quintelahelper_cflags=""
9073da375eSJuan Quintelalibs_softmmu=""
913e2e0e6bSJuan Quintelalibs_tools=""
9267f86e8eSJuan Quintelaaudio_pt_int=""
93d5631638Smalcaudio_win_int=""
942b2e59e6SPaolo Bonzinicc_i386=i386-pc-linux-gnu-gcc
95957f1f99SMichael Rothlibs_qga=""
96ac0df51dSaliguori
97377529c0SPaolo Bonzinitarget_list=""
98377529c0SPaolo Bonzini
99377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
100377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
101377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
102377529c0SPaolo Bonzini#              unless --disable-foo is given
103377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
104377529c0SPaolo Bonzini#              feature will searched for,
105377529c0SPaolo Bonzini#              if not found, configure exits with error
106377529c0SPaolo Bonzini#
107377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
108377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
109377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
110377529c0SPaolo Bonzini
111377529c0SPaolo Bonzinibluez=""
112377529c0SPaolo Bonzinibrlapi=""
113377529c0SPaolo Bonzinicurl=""
114377529c0SPaolo Bonzinicurses=""
115377529c0SPaolo Bonzinidocs=""
116377529c0SPaolo Bonzinifdt=""
117377529c0SPaolo Bonzininptl=""
118377529c0SPaolo Bonzinisdl=""
119821601eaSJes Sorensenvnc="yes"
120377529c0SPaolo Bonzinisparse="no"
121377529c0SPaolo Bonziniuuid=""
122377529c0SPaolo Bonzinivde=""
123377529c0SPaolo Bonzinivnc_tls=""
124377529c0SPaolo Bonzinivnc_sasl=""
125377529c0SPaolo Bonzinivnc_jpeg=""
126377529c0SPaolo Bonzinivnc_png=""
127377529c0SPaolo Bonzinivnc_thread="no"
128377529c0SPaolo Bonzinixen=""
129d5b93ddfSAnthony PERARDxen_ctrl_version=""
130377529c0SPaolo Bonzinilinux_aio=""
131377529c0SPaolo Bonziniattr=""
132377529c0SPaolo Bonzinixfs=""
133377529c0SPaolo Bonzini
134d41a75a2SBradvhost_net="no"
135d41a75a2SBradkvm="no"
136377529c0SPaolo Bonzinigprof="no"
137377529c0SPaolo Bonzinidebug_tcg="no"
138377529c0SPaolo Bonzinidebug_mon="no"
139377529c0SPaolo Bonzinidebug="no"
140377529c0SPaolo Bonzinistrip_opt="yes"
141377529c0SPaolo Bonzinibigendian="no"
142377529c0SPaolo Bonzinimingw32="no"
143377529c0SPaolo BonziniEXESUF=""
144377529c0SPaolo Bonziniprefix="/usr/local"
145377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
146377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu"
147377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu"
148377529c0SPaolo Bonzinibindir="\${prefix}/bin"
1493aa5d2beSAlon Levylibdir="\${prefix}/lib"
1500f94d6daSAlon Levyincludedir="\${prefix}/include"
151377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
152377529c0SPaolo Bonziniconfsuffix="/qemu"
153377529c0SPaolo Bonzinislirp="yes"
154377529c0SPaolo Bonzinifmod_lib=""
155377529c0SPaolo Bonzinifmod_inc=""
156377529c0SPaolo Bonzinioss_lib=""
157377529c0SPaolo Bonzinibsd="no"
158377529c0SPaolo Bonzinilinux="no"
159377529c0SPaolo Bonzinisolaris="no"
160377529c0SPaolo Bonziniprofiler="no"
161377529c0SPaolo Bonzinicocoa="no"
162377529c0SPaolo Bonzinisoftmmu="yes"
163377529c0SPaolo Bonzinilinux_user="no"
164377529c0SPaolo Bonzinidarwin_user="no"
165377529c0SPaolo Bonzinibsd_user="no"
166377529c0SPaolo Bonziniguest_base=""
167377529c0SPaolo Bonziniuname_release=""
168377529c0SPaolo Bonzinimixemu="no"
169377529c0SPaolo Bonziniaix="no"
170377529c0SPaolo Bonziniblobs="yes"
171377529c0SPaolo Bonzinipkgversion=""
172377529c0SPaolo Bonzinicheck_utests="no"
173377529c0SPaolo Bonziniuser_pie="no"
174377529c0SPaolo Bonzinizero_malloc=""
175377529c0SPaolo Bonzinitrace_backend="nop"
176377529c0SPaolo Bonzinitrace_file="trace"
177377529c0SPaolo Bonzinispice=""
178377529c0SPaolo Bonzinirbd=""
17936707144SAlon Levysmartcard=""
180111a38b0SRobert Relyeasmartcard_nss=""
18169354a83SHans de Goedeusb_redir=""
182430a3c18SMichael Walleopengl=""
1831ece9905SAlon Levyzlib="yes"
184d138cee9SMichael Rothguest_agent="yes"
185377529c0SPaolo Bonzini
186ac0df51dSaliguori# parse CC options first
187ac0df51dSaliguorifor opt do
188ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
189ac0df51dSaliguori  case "$opt" in
190ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
191ac0df51dSaliguori  ;;
1923d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
193ac0df51dSaliguori  ;;
194ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
195ca4deeb1SPaolo Bonzini  ;;
1962ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
1972ff6b91eSJuan Quintela  ;;
198a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
199e2a2ed06SJuan Quintela  ;;
200e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
201e2a2ed06SJuan Quintela  ;;
20250e7b1a0SJuan Quintela  --sparc_cpu=*)
20350e7b1a0SJuan Quintela    sparc_cpu="$optarg"
20450e7b1a0SJuan Quintela    case $sparc_cpu in
205ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
20650e7b1a0SJuan Quintela      cpu="sparc"
20750e7b1a0SJuan Quintela    ;;
20850e7b1a0SJuan Quintela    v9)
20950e7b1a0SJuan Quintela      cpu="sparc64"
21050e7b1a0SJuan Quintela    ;;
21150e7b1a0SJuan Quintela    *)
21250e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
21350e7b1a0SJuan Quintela      exit 1
21450e7b1a0SJuan Quintela    ;;
21550e7b1a0SJuan Quintela    esac
21650e7b1a0SJuan Quintela  ;;
217ac0df51dSaliguori  esac
218ac0df51dSaliguoridone
219ac0df51dSaliguori# OS specific
220ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
221ac0df51dSaliguori# we can eliminate it's usage altogether
222ac0df51dSaliguori
223b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}"
224b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
225b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
226b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
2273f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
228b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
229b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
230b3198cc2SStuart Yoderpkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
231b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
232ac0df51dSaliguori
233be17dc90SMichael S. Tsirkin# default flags for all hosts
234be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
235be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS"
236f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
237be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
238be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
23984958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
240cbbab922SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
241be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS"
242be17dc90SMichael S. Tsirkin
243ca4deeb1SPaolo Bonzini# make source path absolute
244ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
245ca4deeb1SPaolo Bonzini
246ac0df51dSaliguoricheck_define() {
247ac0df51dSaliguoricat > $TMPC <<EOF
248ac0df51dSaliguori#if !defined($1)
249ac0df51dSaliguori#error Not defined
250ac0df51dSaliguori#endif
251ac0df51dSaliguoriint main(void) { return 0; }
252ac0df51dSaliguoriEOF
25352166aa0SJuan Quintela  compile_object
254ac0df51dSaliguori}
255ac0df51dSaliguori
2562ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
2572ff6b91eSJuan Quintela  # command line argument
2582ff6b91eSJuan Quintela  :
2592ff6b91eSJuan Quintelaelif check_define __i386__ ; then
260ac0df51dSaliguori  cpu="i386"
261ac0df51dSaliguorielif check_define __x86_64__ ; then
262ac0df51dSaliguori  cpu="x86_64"
2633aa9bd6cSblueswir1elif check_define __sparc__ ; then
2643aa9bd6cSblueswir1  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
2653aa9bd6cSblueswir1  # They must be specified using --sparc_cpu
2663aa9bd6cSblueswir1  if check_define __arch64__ ; then
2673aa9bd6cSblueswir1    cpu="sparc64"
2683aa9bd6cSblueswir1  else
2693aa9bd6cSblueswir1    cpu="sparc"
2703aa9bd6cSblueswir1  fi
271fdf7ed96Smalcelif check_define _ARCH_PPC ; then
272fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
273fdf7ed96Smalc    cpu="ppc64"
274ac0df51dSaliguori  else
275fdf7ed96Smalc    cpu="ppc"
276fdf7ed96Smalc  fi
277afa05235SAurelien Jarnoelif check_define __mips__ ; then
278afa05235SAurelien Jarno  cpu="mips"
279477ba620SAurelien Jarnoelif check_define __ia64__ ; then
280477ba620SAurelien Jarno  cpu="ia64"
281d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
282d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
283d66ed0eaSAurelien Jarno    cpu="s390x"
284d66ed0eaSAurelien Jarno  else
285d66ed0eaSAurelien Jarno    cpu="s390"
286d66ed0eaSAurelien Jarno  fi
287fdf7ed96Smalcelse
288fdf7ed96Smalc  cpu=`uname -m`
289ac0df51dSaliguorifi
290ac0df51dSaliguori
2917d13299dSbellardcase "$cpu" in
292d2fbca94SGuan Xuetao  alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
293ea8f20f8SJuan Quintela    cpu="$cpu"
294ea8f20f8SJuan Quintela  ;;
2957d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
29697a847bcSbellard    cpu="i386"
2977d13299dSbellard  ;;
298aaa5fa14Saurel32  x86_64|amd64)
299aaa5fa14Saurel32    cpu="x86_64"
300aaa5fa14Saurel32  ;;
301ba68055eSbellard  armv*b)
302808c4954Sbellard    cpu="armv4b"
303808c4954Sbellard  ;;
304ba68055eSbellard  armv*l)
3057d13299dSbellard    cpu="armv4l"
3067d13299dSbellard  ;;
307f54b3f92Saurel32  parisc|parisc64)
308f54b3f92Saurel32    cpu="hppa"
309f54b3f92Saurel32  ;;
310afa05235SAurelien Jarno  mips*)
311afa05235SAurelien Jarno    cpu="mips"
312afa05235SAurelien Jarno  ;;
31324e804ecSAlexander Graf  s390)
314fb3e5849Sbellard    cpu="s390"
315fb3e5849Sbellard  ;;
31624e804ecSAlexander Graf  s390x)
31724e804ecSAlexander Graf    cpu="s390x"
31824e804ecSAlexander Graf  ;;
3193142255cSblueswir1  sparc|sun4[cdmuv])
320ae228531Sbellard    cpu="sparc"
321ae228531Sbellard  ;;
3227d13299dSbellard  *)
323a447d4dcSPaolo Bonzini    echo "Unsupported CPU = $cpu"
324a447d4dcSPaolo Bonzini    exit 1
3257d13299dSbellard  ;;
3267d13299dSbellardesac
327e2d52ad3SJuan Quintela
3287d13299dSbellard# OS specific
329ac0df51dSaliguoriif check_define __linux__ ; then
330ac0df51dSaliguori  targetos="Linux"
331ac0df51dSaliguorielif check_define _WIN32 ; then
332ac0df51dSaliguori  targetos='MINGW32'
333169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
334169dc5d3Sblueswir1  targetos='OpenBSD'
335169dc5d3Sblueswir1elif check_define __sun__ ; then
336169dc5d3Sblueswir1  targetos='SunOS'
337179cf400SAndreas Färberelif check_define __HAIKU__ ; then
338179cf400SAndreas Färber  targetos='Haiku'
339ac0df51dSaliguorielse
3407d13299dSbellard  targetos=`uname -s`
341ac0df51dSaliguorifi
3420dbfc675SJuan Quintela
3437d13299dSbellardcase $targetos in
344c326e0afSbellardCYGWIN*)
345c326e0afSbellard  mingw32="yes"
346a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
347d5631638Smalc  audio_possible_drivers="winwave sdl"
348d5631638Smalc  audio_drv_list="winwave"
349c326e0afSbellard;;
35067b915a5SbellardMINGW32*)
35167b915a5Sbellard  mingw32="yes"
352d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
353d5631638Smalc  audio_drv_list="winwave"
35467b915a5Sbellard;;
3555c40d2bdSthsGNU/kFreeBSD)
356a167ba50SAurelien Jarno  bsd="yes"
3570c58ac1cSmalc  audio_drv_list="oss"
358f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3595c40d2bdSths;;
3607d3505c5SbellardFreeBSD)
3617d3505c5Sbellard  bsd="yes"
3620db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3630c58ac1cSmalc  audio_drv_list="oss"
364f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
365f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
366f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3677d3505c5Sbellard;;
368c5e97233Sblueswir1DragonFly)
369c5e97233Sblueswir1  bsd="yes"
3700db4a067SPaolo Bonzini  make="${MAKE-gmake}"
371c5e97233Sblueswir1  audio_drv_list="oss"
372c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
373c5e97233Sblueswir1;;
3747d3505c5SbellardNetBSD)
3757d3505c5Sbellard  bsd="yes"
3760db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3770c58ac1cSmalc  audio_drv_list="oss"
378c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3798ef92a88Sblueswir1  oss_lib="-lossaudio"
3807d3505c5Sbellard;;
3817d3505c5SbellardOpenBSD)
3827d3505c5Sbellard  bsd="yes"
3830db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3840c58ac1cSmalc  audio_drv_list="oss"
385c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3862f6a1ab0Sblueswir1  oss_lib="-lossaudio"
3877d3505c5Sbellard;;
38883fb7adfSbellardDarwin)
38983fb7adfSbellard  bsd="yes"
39083fb7adfSbellard  darwin="yes"
3910dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
3920dbfc675SJuan Quintela  # run 64-bit userspace code
393aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
3941b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
395aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
3961b0f9cc2Saliguori  fi
3971b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
398a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
3990c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
4001b0f9cc2Saliguori  else
401a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
4021b0f9cc2Saliguori  fi
403831b7825Sths  darwin_user="yes"
404fd677642Sths  cocoa="yes"
4050c58ac1cSmalc  audio_drv_list="coreaudio"
406c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4070c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4087973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
40983fb7adfSbellard;;
410ec530c81SbellardSunOS)
411ec530c81Sbellard  solaris="yes"
4120db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4130db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
414fa58948dSBlue Swirl  ld="gld"
415e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
4160475a5caSths  needs_libsunmath="no"
417c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
418ef18c883Sths  # have to select again, because `uname -m` returns i86pc
419ef18c883Sths  # even on an x86_64 box.
420ef18c883Sths  solariscpu=`isainfo -k`
421ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
422ef18c883Sths    cpu="x86_64"
423ef18c883Sths  fi
424c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4250475a5caSths    if test "$solarisrev" -le 9 ; then
4260475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4270475a5caSths        needs_libsunmath="yes"
428f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
429f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
430f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4310475a5caSths      else
4320475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4330475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4340475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4350475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4360475a5caSths        exit 1
4370475a5caSths      fi
4380475a5caSths    fi
43986b2bd93Sths  fi
4406b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4410c58ac1cSmalc    audio_drv_list="oss"
4426b4d2ba1Sths  fi
443c2de5c91Smalc  audio_possible_drivers="oss sdl"
444d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
445d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
446d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
447d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
448a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
449e174c0bbSJuan Quintela  LIBS="-lsocket -lnsl -lresolv $LIBS"
450ec530c81Sbellard;;
451b29fe3edSmalcAIX)
452b29fe3edSmalc  aix="yes"
4530db4a067SPaolo Bonzini  make="${MAKE-gmake}"
454b29fe3edSmalc;;
455179cf400SAndreas FärberHaiku)
456179cf400SAndreas Färber  haiku="yes"
457179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
458179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
459179cf400SAndreas Färber;;
460fb065187Sbellard*)
4610c58ac1cSmalc  audio_drv_list="oss"
462b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4635327cf48Sbellard  linux="yes"
464831b7825Sths  linux_user="yes"
46568063649Sblueswir1  usb="linux"
466af2be207SJan Kiszka  kvm="yes"
467af2be207SJan Kiszka  vhost_net="yes"
46807f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
469c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
470c9ec1fe4Sbellard  fi
471fb065187Sbellard;;
4727d13299dSbellardesac
4737d13299dSbellard
4747d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
475b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
47668063649Sblueswir1    usb="bsd"
47783fb7adfSbellard  fi
47884778508Sblueswir1  bsd_user="yes"
4797d3505c5Sbellardfi
4807d3505c5Sbellard
4810db4a067SPaolo Bonzini: ${make=${MAKE-make}}
4820db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
483c886edfbSBlue Swirl: ${python=${PYTHON-python}}
484e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
4850db4a067SPaolo Bonzini
4863457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
4873457a3f8SJuan Quintela  EXESUF=".exe"
488a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
489e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
490e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
49108f3896aSStefan Weil  LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
492683035deSPaolo Bonzini  prefix="c:/Program Files/Qemu"
493683035deSPaolo Bonzini  mandir="\${prefix}"
494683035deSPaolo Bonzini  datadir="\${prefix}"
495683035deSPaolo Bonzini  docdir="\${prefix}"
496683035deSPaolo Bonzini  bindir="\${prefix}"
497683035deSPaolo Bonzini  sysconfdir="\${prefix}"
498683035deSPaolo Bonzini  confsuffix=""
49983b2f0a0SStefan Weil  guest_agent="no"
5003457a3f8SJuan Quintelafi
5013457a3f8SJuan Quintela
502487fefdbSAnthony Liguoriwerror=""
50385aa5189Sbellard
5047d13299dSbellardfor opt do
505a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
5067d13299dSbellard  case "$opt" in
5072efc3265Sbellard  --help|-h) show_help=yes
5082efc3265Sbellard  ;;
50999123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
51099123e13SMike Frysinger  ;;
511b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5127d13299dSbellard  ;;
513b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
51432ce6337Sbellard  ;;
515ca4deeb1SPaolo Bonzini  --source-path=*)
5167d13299dSbellard  ;;
517ac0df51dSaliguori  --cross-prefix=*)
5187d13299dSbellard  ;;
519ac0df51dSaliguori  --cc=*)
5207d13299dSbellard  ;;
521b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
52283469015Sbellard  ;;
523b1a550a0Spbrook  --make=*) make="$optarg"
5247d13299dSbellard  ;;
5256a882643Spbrook  --install=*) install="$optarg"
5266a882643Spbrook  ;;
527c886edfbSBlue Swirl  --python=*) python="$optarg"
528c886edfbSBlue Swirl  ;;
529e2d8830eSBrad  --smbd=*) smbd="$optarg"
530e2d8830eSBrad  ;;
531e2a2ed06SJuan Quintela  --extra-cflags=*)
5327d13299dSbellard  ;;
533e2a2ed06SJuan Quintela  --extra-ldflags=*)
5347d13299dSbellard  ;;
5352ff6b91eSJuan Quintela  --cpu=*)
5367d13299dSbellard  ;;
537b1a550a0Spbrook  --target-list=*) target_list="$optarg"
538de83cd02Sbellard  ;;
53974242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
54094a420b1SStefan Hajnoczi  ;;
54174242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
5429410b56cSPrerna Saxena  ;;
5437d13299dSbellard  --enable-gprof) gprof="yes"
5447d13299dSbellard  ;;
54579427693SLoïc Minier  --static)
54679427693SLoïc Minier    static="yes"
54779427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
54843ce4dfeSbellard  ;;
5490b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5500b24e75fSPaolo Bonzini  ;;
5510b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5520b24e75fSPaolo Bonzini  ;;
5533aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
5543aa5d2beSAlon Levy  ;;
5550f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
5560f94d6daSAlon Levy  ;;
5570b24e75fSPaolo Bonzini  --datadir=*) datadir="$optarg"
5580b24e75fSPaolo Bonzini  ;;
5590b24e75fSPaolo Bonzini  --docdir=*) docdir="$optarg"
5600b24e75fSPaolo Bonzini  ;;
561ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
56207381cc1SAnthony Liguori  ;;
56397a847bcSbellard  --disable-sdl) sdl="no"
56497a847bcSbellard  ;;
565c4198157SJuan Quintela  --enable-sdl) sdl="yes"
566c4198157SJuan Quintela  ;;
567821601eaSJes Sorensen  --disable-vnc) vnc="no"
568821601eaSJes Sorensen  ;;
569821601eaSJes Sorensen  --enable-vnc) vnc="yes"
570821601eaSJes Sorensen  ;;
571b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
572102a52e4Sbellard  ;;
573c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
574c2de5c91Smalc  ;;
5752f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
5762f6a1ab0Sblueswir1  ;;
5772fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
5780c58ac1cSmalc  ;;
5790c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
5800c58ac1cSmalc  ;;
581eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
582eb852011SMarkus Armbruster  ;;
583f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
584f8393946Saurel32  ;;
585f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
586f8393946Saurel32  ;;
587b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
588b4475aa2SLuiz Capitulino  ;;
589b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
590b4475aa2SLuiz Capitulino  ;;
591f3d08ee6SPaul Brook  --enable-debug)
592f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
593f3d08ee6SPaul Brook      debug_tcg="yes"
594b4475aa2SLuiz Capitulino      debug_mon="yes"
595f3d08ee6SPaul Brook      debug="yes"
596f3d08ee6SPaul Brook      strip_opt="no"
597f3d08ee6SPaul Brook  ;;
59803b4fe7dSaliguori  --enable-sparse) sparse="yes"
59903b4fe7dSaliguori  ;;
60003b4fe7dSaliguori  --disable-sparse) sparse="no"
60103b4fe7dSaliguori  ;;
6021625af87Saliguori  --disable-strip) strip_opt="no"
6031625af87Saliguori  ;;
6048d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
6058d5d2d4cSths  ;;
6061be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
6071be10ad2SJuan Quintela  ;;
6082f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
6092f9606b3Saliguori  ;;
610ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
611ea784e3bSJuan Quintela  ;;
6122f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
6132f6f5c7aSCorentin Chary  ;;
6142f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
6152f6f5c7aSCorentin Chary  ;;
616efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
617efe556adSCorentin Chary  ;;
618efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
619efe556adSCorentin Chary  ;;
620bd023f95SCorentin Chary  --disable-vnc-thread) vnc_thread="no"
621bd023f95SCorentin Chary  ;;
622bd023f95SCorentin Chary  --enable-vnc-thread) vnc_thread="yes"
623bd023f95SCorentin Chary  ;;
624443f1376Sbellard  --disable-slirp) slirp="no"
625c20709aaSbellard  ;;
626ee682d27SStefan Weil  --disable-uuid) uuid="no"
627ee682d27SStefan Weil  ;;
628ee682d27SStefan Weil  --enable-uuid) uuid="yes"
629ee682d27SStefan Weil  ;;
630e0e6c8c0Saliguori  --disable-vde) vde="no"
6318a16d273Sths  ;;
632dfb278bdSJuan Quintela  --enable-vde) vde="yes"
633dfb278bdSJuan Quintela  ;;
634e37630caSaliguori  --disable-xen) xen="no"
635e37630caSaliguori  ;;
636fc321b4bSJuan Quintela  --enable-xen) xen="yes"
637fc321b4bSJuan Quintela  ;;
6382e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6392e4d9fb1Saurel32  ;;
6404ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6414ffcedb6SJuan Quintela  ;;
642fb599c9aSbalrog  --disable-bluez) bluez="no"
643fb599c9aSbalrog  ;;
644a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
645a20a6f46SJuan Quintela  ;;
6467ba1e619Saliguori  --disable-kvm) kvm="no"
6477ba1e619Saliguori  ;;
648b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
649b31a0277SJuan Quintela  ;;
650cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
651cd4ec0b4SGerd Hoffmann  ;;
652cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
653cd4ec0b4SGerd Hoffmann  ;;
65405c2a3e7Sbellard  --enable-profiler) profiler="yes"
65505c2a3e7Sbellard  ;;
656c2de5c91Smalc  --enable-cocoa)
657c2de5c91Smalc      cocoa="yes" ;
658c2de5c91Smalc      sdl="no" ;
659c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
6605b0753e0Sbellard  ;;
661cad25d69Spbrook  --disable-system) softmmu="no"
6620a8e90f4Spbrook  ;;
663cad25d69Spbrook  --enable-system) softmmu="yes"
6640a8e90f4Spbrook  ;;
6650953a80fSZachary Amsden  --disable-user)
6660953a80fSZachary Amsden      linux_user="no" ;
6670953a80fSZachary Amsden      bsd_user="no" ;
6680953a80fSZachary Amsden      darwin_user="no"
6690953a80fSZachary Amsden  ;;
6700953a80fSZachary Amsden  --enable-user) ;;
671831b7825Sths  --disable-linux-user) linux_user="no"
6720a8e90f4Spbrook  ;;
673831b7825Sths  --enable-linux-user) linux_user="yes"
674831b7825Sths  ;;
675831b7825Sths  --disable-darwin-user) darwin_user="no"
676831b7825Sths  ;;
677831b7825Sths  --enable-darwin-user) darwin_user="yes"
6780a8e90f4Spbrook  ;;
67984778508Sblueswir1  --disable-bsd-user) bsd_user="no"
68084778508Sblueswir1  ;;
68184778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
68284778508Sblueswir1  ;;
683379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
684379f6698SPaul Brook  ;;
685379f6698SPaul Brook  --disable-guest-base) guest_base="no"
686379f6698SPaul Brook  ;;
68734005a00SKirill A. Shutemov  --enable-user-pie) user_pie="yes"
68834005a00SKirill A. Shutemov  ;;
68934005a00SKirill A. Shutemov  --disable-user-pie) user_pie="no"
69034005a00SKirill A. Shutemov  ;;
691c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
692c5937220Spbrook  ;;
6933142255cSblueswir1  --sparc_cpu=*)
6943142255cSblueswir1  ;;
69585aa5189Sbellard  --enable-werror) werror="yes"
69685aa5189Sbellard  ;;
69785aa5189Sbellard  --disable-werror) werror="no"
69885aa5189Sbellard  ;;
6994d3b6f6eSbalrog  --disable-curses) curses="no"
7004d3b6f6eSbalrog  ;;
701c584a6d0SJuan Quintela  --enable-curses) curses="yes"
702c584a6d0SJuan Quintela  ;;
703769ce76dSAlexander Graf  --disable-curl) curl="no"
704769ce76dSAlexander Graf  ;;
705788c8196SJuan Quintela  --enable-curl) curl="yes"
706788c8196SJuan Quintela  ;;
7072df87df7SJuan Quintela  --disable-fdt) fdt="no"
7082df87df7SJuan Quintela  ;;
7092df87df7SJuan Quintela  --enable-fdt) fdt="yes"
7102df87df7SJuan Quintela  ;;
7115495ed11SLuiz Capitulino  --disable-check-utests) check_utests="no"
7125495ed11SLuiz Capitulino  ;;
7135495ed11SLuiz Capitulino  --enable-check-utests) check_utests="yes"
7145495ed11SLuiz Capitulino  ;;
715bd0c5661Spbrook  --disable-nptl) nptl="no"
716bd0c5661Spbrook  ;;
717b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
718b0a47e79SJuan Quintela  ;;
7198ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
7208ff9cbf7Smalc  ;;
7215c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
7225c6c3a6cSChristoph Hellwig  ;;
7235c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
7245c6c3a6cSChristoph Hellwig  ;;
725758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
726758e8e38SVenkateswararao Jujjuri (JV)  ;;
727758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
728758e8e38SVenkateswararao Jujjuri (JV)  ;;
72977755340Sths  --disable-blobs) blobs="no"
73077755340Sths  ;;
7314a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
7324a19f1ecSpbrook  ;;
733a25dba17SJuan Quintela  --disable-docs) docs="no"
73470ec5dc0SAnthony Liguori  ;;
735a25dba17SJuan Quintela  --enable-docs) docs="yes"
73683a3ab8bSJuan Quintela  ;;
737d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
738d5970055SMichael S. Tsirkin  ;;
739d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
740d5970055SMichael S. Tsirkin  ;;
74120ff075bSMichael Walle  --disable-opengl) opengl="no"
74220ff075bSMichael Walle  ;;
74320ff075bSMichael Walle  --enable-opengl) opengl="yes"
74420ff075bSMichael Walle  ;;
7456bde81cbSPaolo Bonzini  --*dir)
7466bde81cbSPaolo Bonzini  ;;
747f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
748f27aaf4bSChristian Brunner  ;;
749f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
750f27aaf4bSChristian Brunner  ;;
75136707144SAlon Levy  --disable-smartcard) smartcard="no"
75236707144SAlon Levy  ;;
75336707144SAlon Levy  --enable-smartcard) smartcard="yes"
75436707144SAlon Levy  ;;
755111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
756111a38b0SRobert Relyea  ;;
757111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
758111a38b0SRobert Relyea  ;;
75969354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
76069354a83SHans de Goede  ;;
76169354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
76269354a83SHans de Goede  ;;
7631ece9905SAlon Levy  --disable-zlib-test) zlib="no"
7641ece9905SAlon Levy  ;;
765d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
766d138cee9SMichael Roth  ;;
767d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
768d138cee9SMichael Roth  ;;
7697f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
7707f1559c6Sbalrog  ;;
7717d13299dSbellard  esac
7727d13299dSbellarddone
7737d13299dSbellard
7743142255cSblueswir1#
7753142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
776a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
7773142255cSblueswir1#
778379f6698SPaul Brookhost_guest_base="no"
77940293e58Sbellardcase "$cpu" in
780ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
781ed968ff1SJuan Quintela           v7|v8)
782a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
783ed968ff1SJuan Quintela           ;;
784ed968ff1SJuan Quintela           v8plus|v8plusa)
785a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
786ed968ff1SJuan Quintela           ;;
787ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
788a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
789ed968ff1SJuan Quintela           esac
7900c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
791a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
792762e8230Sblueswir1           if test "$solaris" = "no" ; then
793a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
794c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
795762e8230Sblueswir1           fi
7963142255cSblueswir1           ;;
797ed968ff1SJuan Quintela    sparc64)
798a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
7990c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
800a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
801ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
802a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
803762e8230Sblueswir1           fi
8043142255cSblueswir1           ;;
80576d83bdeSths    s390)
80628d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
80728d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
80848bb3750SRichard Henderson           host_guest_base="yes"
80928d7cc49SRichard Henderson           ;;
81028d7cc49SRichard Henderson    s390x)
81128d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
81228d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
81348bb3750SRichard Henderson           host_guest_base="yes"
81476d83bdeSths           ;;
81540293e58Sbellard    i386)
816a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
8170c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
8182b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
819c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
820379f6698SPaul Brook           host_guest_base="yes"
82140293e58Sbellard           ;;
82240293e58Sbellard    x86_64)
823a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
8240c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
8252b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
826379f6698SPaul Brook           host_guest_base="yes"
827379f6698SPaul Brook           ;;
828379f6698SPaul Brook    arm*)
829379f6698SPaul Brook           host_guest_base="yes"
83040293e58Sbellard           ;;
831f6548c0aSmalc    ppc*)
832f6548c0aSmalc           host_guest_base="yes"
833f6548c0aSmalc           ;;
834cc01cc8eSAurelien Jarno    mips*)
835cc01cc8eSAurelien Jarno           host_guest_base="yes"
836cc01cc8eSAurelien Jarno           ;;
837477ba620SAurelien Jarno    ia64*)
838477ba620SAurelien Jarno           host_guest_base="yes"
839477ba620SAurelien Jarno           ;;
840fd76e73aSRichard Henderson    hppa*)
841fd76e73aSRichard Henderson           host_guest_base="yes"
842fd76e73aSRichard Henderson           ;;
843d2fbca94SGuan Xuetao    unicore32*)
844d2fbca94SGuan Xuetao           host_guest_base="yes"
845d2fbca94SGuan Xuetao           ;;
8463142255cSblueswir1esac
8473142255cSblueswir1
848379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
849379f6698SPaul Brook
85060e0df25SPeter Maydell
85160e0df25SPeter Maydelldefault_target_list=""
85260e0df25SPeter Maydell
85360e0df25SPeter Maydell# these targets are portable
85460e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then
85560e0df25SPeter Maydell    default_target_list="\
85660e0df25SPeter Maydelli386-softmmu \
85760e0df25SPeter Maydellx86_64-softmmu \
85860e0df25SPeter Maydellarm-softmmu \
85960e0df25SPeter Maydellcris-softmmu \
86060e0df25SPeter Maydelllm32-softmmu \
86160e0df25SPeter Maydellm68k-softmmu \
86260e0df25SPeter Maydellmicroblaze-softmmu \
86360e0df25SPeter Maydellmicroblazeel-softmmu \
86460e0df25SPeter Maydellmips-softmmu \
86560e0df25SPeter Maydellmipsel-softmmu \
86660e0df25SPeter Maydellmips64-softmmu \
86760e0df25SPeter Maydellmips64el-softmmu \
86860e0df25SPeter Maydellppc-softmmu \
86960e0df25SPeter Maydellppcemb-softmmu \
87060e0df25SPeter Maydellppc64-softmmu \
87160e0df25SPeter Maydellsh4-softmmu \
87260e0df25SPeter Maydellsh4eb-softmmu \
87360e0df25SPeter Maydellsparc-softmmu \
87460e0df25SPeter Maydellsparc64-softmmu \
8750f3301d4SAlexander Grafs390x-softmmu \
876*cfa550c6SMax Filippovxtensa-softmmu \
877*cfa550c6SMax Filippovxtensaeb-softmmu \
87860e0df25SPeter Maydell"
87960e0df25SPeter Maydellfi
88060e0df25SPeter Maydell# the following are Linux specific
88160e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then
88260e0df25SPeter Maydell    default_target_list="${default_target_list}\
88360e0df25SPeter Maydelli386-linux-user \
88460e0df25SPeter Maydellx86_64-linux-user \
88560e0df25SPeter Maydellalpha-linux-user \
88660e0df25SPeter Maydellarm-linux-user \
88760e0df25SPeter Maydellarmeb-linux-user \
88860e0df25SPeter Maydellcris-linux-user \
88960e0df25SPeter Maydellm68k-linux-user \
89060e0df25SPeter Maydellmicroblaze-linux-user \
89160e0df25SPeter Maydellmicroblazeel-linux-user \
89260e0df25SPeter Maydellmips-linux-user \
89360e0df25SPeter Maydellmipsel-linux-user \
89460e0df25SPeter Maydellppc-linux-user \
89560e0df25SPeter Maydellppc64-linux-user \
89660e0df25SPeter Maydellppc64abi32-linux-user \
89760e0df25SPeter Maydellsh4-linux-user \
89860e0df25SPeter Maydellsh4eb-linux-user \
89960e0df25SPeter Maydellsparc-linux-user \
90060e0df25SPeter Maydellsparc64-linux-user \
90160e0df25SPeter Maydellsparc32plus-linux-user \
90260e0df25SPeter Maydellunicore32-linux-user \
9030f3301d4SAlexander Grafs390x-linux-user \
90460e0df25SPeter Maydell"
90560e0df25SPeter Maydellfi
90660e0df25SPeter Maydell# the following are Darwin specific
90760e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then
90860e0df25SPeter Maydell    default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
90960e0df25SPeter Maydellfi
91060e0df25SPeter Maydell# the following are BSD specific
91160e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then
91260e0df25SPeter Maydell    default_target_list="${default_target_list}\
91360e0df25SPeter Maydelli386-bsd-user \
91460e0df25SPeter Maydellx86_64-bsd-user \
91560e0df25SPeter Maydellsparc-bsd-user \
91660e0df25SPeter Maydellsparc64-bsd-user \
91760e0df25SPeter Maydell"
91860e0df25SPeter Maydellfi
91960e0df25SPeter Maydell
920af5db58eSpbrookif test x"$show_help" = x"yes" ; then
921af5db58eSpbrookcat << EOF
922af5db58eSpbrook
923af5db58eSpbrookUsage: configure [options]
924af5db58eSpbrookOptions: [defaults in brackets after descriptions]
925af5db58eSpbrook
926af5db58eSpbrookEOF
927af5db58eSpbrookecho "Standard options:"
928af5db58eSpbrookecho "  --help                   print this message"
929af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
930af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
931af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
93260e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
93360e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
93460e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
935af5db58eSpbrookecho ""
936af5db58eSpbrookecho "Advanced options (experts only):"
937af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
938af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
939af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
9400bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
9410bfe8cc0SPaolo Bonziniecho "                           build time"
942a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
943e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
944af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
9456a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
946c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
947e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
948af5db58eSpbrookecho "  --static                 enable static build [$static]"
9490b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
9500b24e75fSPaolo Bonziniecho "  --datadir=PATH           install firmware in PATH"
9510b24e75fSPaolo Bonziniecho "  --docdir=PATH            install documentation in PATH"
9520b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
9530b24e75fSPaolo Bonziniecho "  --sysconfdir=PATH        install config in PATH/qemu"
954f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
955f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
95609695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
957890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
958890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
9591625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
96085aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
961fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
962c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
963821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
964821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
965af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
966c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
967c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
9684c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
9694c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
970eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
971eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
9728ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
973e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
974fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
9752e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
9764ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
9778d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
9781be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
9792f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
980ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
9812f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
9822f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
98396763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
984efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
985bd023f95SCorentin Charyecho "  --disable-vnc-thread     disable threaded VNC server"
986bd023f95SCorentin Charyecho "  --enable-vnc-thread      enable threaded VNC server"
987af896aaaSpbrookecho "  --disable-curses         disable curses output"
988c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
989769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
990788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
9912df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
9922df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
9935495ed11SLuiz Capitulinoecho "  --disable-check-utests   disable check unit-tests"
9945495ed11SLuiz Capitulinoecho "  --enable-check-utests    enable check unit-tests"
995fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
996a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
9976093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
9987ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
999b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
1000bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
1001e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
1002af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1003af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
10040953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
10050953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1006831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1007831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
1008831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
1009831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
101084778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
101184778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1012379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1013379f6698SPaul Brookecho "                           emulation targets"
1014379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
101534005a00SKirill A. Shutemovecho "  --enable-user-pie        build usermode emulation targets as PIE"
101634005a00SKirill A. Shutemovecho "  --disable-user-pie       do not build usermode emulation targets as PIE"
1017af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1018af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
10192f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1020c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
10213142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1022ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1023ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1024e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1025dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
10265c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
10275c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
1028758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1029758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
103077755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1031d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1032d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1033d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1034d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1035320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1036320fba2aSFabien Chouteauecho "                           Available backends:" $("$source_path"/scripts/tracetool --list-backends)
103774242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
10389410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1039cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1040cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1041f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
104236707144SAlon Levyecho "  --disable-smartcard      disable smartcard support"
104336707144SAlon Levyecho "  --enable-smartcard       enable smartcard support"
1044111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1045111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
104669354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
104769354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1048d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1049d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1050af5db58eSpbrookecho ""
10515bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1052af5db58eSpbrookexit 1
1053af5db58eSpbrookfi
1054af5db58eSpbrook
10558d05095cSPaolo Bonzini# check that the C compiler works.
10568d05095cSPaolo Bonzinicat > $TMPC <<EOF
10578d05095cSPaolo Bonziniint main(void) {}
10588d05095cSPaolo BonziniEOF
10598d05095cSPaolo Bonzini
10608d05095cSPaolo Bonziniif compile_object ; then
10618d05095cSPaolo Bonzini  : C compiler works ok
10628d05095cSPaolo Bonzinielse
10638d05095cSPaolo Bonzini    echo "ERROR: \"$cc\" either does not exist or does not work"
10648d05095cSPaolo Bonzini    exit 1
10658d05095cSPaolo Bonzinifi
10668d05095cSPaolo Bonzini
10678d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
10688d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
10698d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1070f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
10718d05095cSPaolo Bonzinicat > $TMPC << EOF
10728d05095cSPaolo Bonziniint main(void) { return 0; }
10738d05095cSPaolo BonziniEOF
10748d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1075af2d37deSStefan Weil    if compile_prog "$flag -Werror" "" ; then
10768d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
10778d05095cSPaolo Bonzini    fi
10788d05095cSPaolo Bonzinidone
10798d05095cSPaolo Bonzini
1080ec530c81Sbellard#
1081ec530c81Sbellard# Solaris specific configure tool chain decisions
1082ec530c81Sbellard#
1083ec530c81Sbellardif test "$solaris" = "yes" ; then
10846792aa11SLoïc Minier  if has $install; then
10856792aa11SLoïc Minier    :
10866792aa11SLoïc Minier  else
1087ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1088ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1089ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1090ec530c81Sbellard    exit 1
1091ec530c81Sbellard  fi
10926792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
1093ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1094ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1095ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1096ec530c81Sbellard    exit 1
1097ec530c81Sbellard  fi
10986792aa11SLoïc Minier  if has ar; then
10996792aa11SLoïc Minier    :
11006792aa11SLoïc Minier  else
1101ec530c81Sbellard    echo "Error: No path includes ar"
1102ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
1103ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
1104ec530c81Sbellard    fi
1105ec530c81Sbellard    exit 1
1106ec530c81Sbellard  fi
1107ec530c81Sbellardfi
1108ec530c81Sbellard
1109d138cee9SMichael Rothif test "$guest_agent" != "no" ; then
1110c886edfbSBlue Swirl  if has $python; then
1111c886edfbSBlue Swirl    :
1112c886edfbSBlue Swirl  else
1113c886edfbSBlue Swirl    echo "Python not found. Use --python=/path/to/python"
1114c886edfbSBlue Swirl    exit 1
1115c886edfbSBlue Swirl  fi
1116d138cee9SMichael Rothfi
1117c886edfbSBlue Swirl
11185327cf48Sbellardif test -z "$target_list" ; then
111960e0df25SPeter Maydell    target_list="$default_target_list"
11206e20a45fSbellardelse
1121b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
11225327cf48Sbellardfi
11230a8e90f4Spbrookif test -z "$target_list" ; then
11240a8e90f4Spbrook    echo "No targets enabled"
11250a8e90f4Spbrook    exit 1
11260a8e90f4Spbrookfi
1127f55fe278SPaolo Bonzini# see if system emulation was really requested
1128f55fe278SPaolo Bonzinicase " $target_list " in
1129f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1130f55fe278SPaolo Bonzini  ;;
1131f55fe278SPaolo Bonzini  *) softmmu=no
1132f55fe278SPaolo Bonzini  ;;
1133f55fe278SPaolo Bonziniesac
11345327cf48Sbellard
1135249247c9SJuan Quintelafeature_not_found() {
1136249247c9SJuan Quintela  feature=$1
1137249247c9SJuan Quintela
1138249247c9SJuan Quintela  echo "ERROR"
1139249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
11409332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1141249247c9SJuan Quintela  echo "ERROR"
1142249247c9SJuan Quintela  exit 1;
1143249247c9SJuan Quintela}
1144249247c9SJuan Quintela
11457d13299dSbellardif test -z "$cross_prefix" ; then
11467d13299dSbellard
11477d13299dSbellard# ---
11487d13299dSbellard# big/little endian test
11497d13299dSbellardcat > $TMPC << EOF
11507d13299dSbellard#include <inttypes.h>
11517d13299dSbellardint main(int argc, char ** argv){
11527d13299dSbellard        volatile uint32_t i=0x01234567;
11537d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
11547d13299dSbellard}
11557d13299dSbellardEOF
11567d13299dSbellard
115752166aa0SJuan Quintelaif compile_prog "" "" ; then
11587d13299dSbellard$TMPE && bigendian="yes"
11597d13299dSbellardelse
11607d13299dSbellardecho big/little test failed
11617d13299dSbellardfi
11627d13299dSbellard
11637d13299dSbellardelse
11647d13299dSbellard
11657d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1166ea8f20f8SJuan Quintelacase "$cpu" in
116724e804ecSAlexander Graf  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1168ea8f20f8SJuan Quintela    bigendian=yes
1169ea8f20f8SJuan Quintela  ;;
1170ea8f20f8SJuan Quintelaesac
11717d13299dSbellard
11727d13299dSbellardfi
11737d13299dSbellard
117470be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test
117570be1a2eSPaolo Bonzinicat > $TMPC << EOF
117670be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
117770be1a2eSPaolo BonziniEOF
117870be1a2eSPaolo Bonziniif compile_object; then
1179ea8f20f8SJuan Quintelahostlongbits=64
118070be1a2eSPaolo Bonzinielse
118170be1a2eSPaolo Bonzinihostlongbits=32
118270be1a2eSPaolo Bonzinifi
1183b6853697Sbellard
1184b0a47e79SJuan Quintela
1185b0a47e79SJuan Quintela##########################################
1186b0a47e79SJuan Quintela# NPTL probe
1187b0a47e79SJuan Quintela
1188b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1189bd0c5661Spbrook  cat > $TMPC <<EOF
1190bd0c5661Spbrook#include <sched.h>
119130813ceaSpbrook#include <linux/futex.h>
1192bd0c5661Spbrookvoid foo()
1193bd0c5661Spbrook{
1194bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1195bd0c5661Spbrook#error bork
1196bd0c5661Spbrook#endif
1197bd0c5661Spbrook}
1198bd0c5661SpbrookEOF
1199bd0c5661Spbrook
120052166aa0SJuan Quintela  if compile_object ; then
1201b0a47e79SJuan Quintela    nptl=yes
1202bd0c5661Spbrook  else
1203b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1204b0a47e79SJuan Quintela      feature_not_found "nptl"
1205b0a47e79SJuan Quintela    fi
1206b0a47e79SJuan Quintela    nptl=no
1207b0a47e79SJuan Quintela  fi
1208bd0c5661Spbrookfi
1209bd0c5661Spbrook
121011d9f695Sbellard##########################################
1211ac62922eSbalrog# zlib check
1212ac62922eSbalrog
12131ece9905SAlon Levyif test "$zlib" != "no" ; then
1214ac62922eSbalrog    cat > $TMPC << EOF
1215ac62922eSbalrog#include <zlib.h>
1216ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1217ac62922eSbalrogEOF
121852166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1219ac62922eSbalrog        :
1220ac62922eSbalrog    else
1221ac62922eSbalrog        echo
1222ac62922eSbalrog        echo "Error: zlib check failed"
1223ac62922eSbalrog        echo "Make sure to have the zlib libs and headers installed."
1224ac62922eSbalrog        echo
1225ac62922eSbalrog        exit 1
1226ac62922eSbalrog    fi
12271ece9905SAlon Levyfi
1228ac62922eSbalrog
1229ac62922eSbalrog##########################################
1230e37630caSaliguori# xen probe
1231e37630caSaliguori
1232fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1233b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1234d5b93ddfSAnthony PERARD
1235d5b93ddfSAnthony PERARD  # Xen unstable
1236e37630caSaliguori  cat > $TMPC <<EOF
1237e37630caSaliguori#include <xenctrl.h>
1238e37630caSaliguori#include <xs.h>
1239d5b93ddfSAnthony PERARD#include <stdint.h>
1240d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1241d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1242d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1243d5b93ddfSAnthony PERARD#endif
1244d5b93ddfSAnthony PERARDint main(void) {
1245d5b93ddfSAnthony PERARD  xc_interface *xc;
1246d5b93ddfSAnthony PERARD  xs_daemon_open();
1247d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1248d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1249d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1250b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1251d5b93ddfSAnthony PERARD  return 0;
1252d5b93ddfSAnthony PERARD}
1253e37630caSaliguoriEOF
125452166aa0SJuan Quintela  if compile_prog "" "$xen_libs" ; then
1255d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1256fc321b4bSJuan Quintela    xen=yes
1257d5b93ddfSAnthony PERARD
1258d5b93ddfSAnthony PERARD  # Xen 4.0.0
1259d5b93ddfSAnthony PERARD  elif (
1260d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1261d5b93ddfSAnthony PERARD#include <xenctrl.h>
1262d5b93ddfSAnthony PERARD#include <xs.h>
1263d5b93ddfSAnthony PERARD#include <stdint.h>
1264d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1265d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1266d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1267d5b93ddfSAnthony PERARD#endif
1268d5b93ddfSAnthony PERARDint main(void) {
1269b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1270b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1271b87de24eSAnthony PERARD  };
1272d5b93ddfSAnthony PERARD  xs_daemon_open();
1273d5b93ddfSAnthony PERARD  xc_interface_open();
1274d5b93ddfSAnthony PERARD  xc_gnttab_open();
1275d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1276b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1277d5b93ddfSAnthony PERARD  return 0;
1278d5b93ddfSAnthony PERARD}
1279d5b93ddfSAnthony PERARDEOF
1280d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1281d5b93ddfSAnthony PERARD    ) ; then
1282d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1283d5b93ddfSAnthony PERARD    xen=yes
1284d5b93ddfSAnthony PERARD
1285b87de24eSAnthony PERARD  # Xen 3.4.0
1286b87de24eSAnthony PERARD  elif (
1287b87de24eSAnthony PERARD      cat > $TMPC <<EOF
1288b87de24eSAnthony PERARD#include <xenctrl.h>
1289b87de24eSAnthony PERARD#include <xs.h>
1290b87de24eSAnthony PERARDint main(void) {
1291b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1292b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1293b87de24eSAnthony PERARD  };
1294b87de24eSAnthony PERARD  xs_daemon_open();
1295b87de24eSAnthony PERARD  xc_interface_open();
1296b87de24eSAnthony PERARD  xc_gnttab_open();
1297b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1298b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1299b87de24eSAnthony PERARD  return 0;
1300b87de24eSAnthony PERARD}
1301b87de24eSAnthony PERARDEOF
1302b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
1303b87de24eSAnthony PERARD    ) ; then
1304b87de24eSAnthony PERARD    xen_ctrl_version=340
1305b87de24eSAnthony PERARD    xen=yes
1306b87de24eSAnthony PERARD
1307b87de24eSAnthony PERARD  # Xen 3.3.0
1308d5b93ddfSAnthony PERARD  elif (
1309d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1310d5b93ddfSAnthony PERARD#include <xenctrl.h>
1311d5b93ddfSAnthony PERARD#include <xs.h>
1312d5b93ddfSAnthony PERARDint main(void) {
1313d5b93ddfSAnthony PERARD  xs_daemon_open();
1314d5b93ddfSAnthony PERARD  xc_interface_open();
1315d5b93ddfSAnthony PERARD  xc_gnttab_open();
1316d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1317d5b93ddfSAnthony PERARD  return 0;
1318d5b93ddfSAnthony PERARD}
1319d5b93ddfSAnthony PERARDEOF
1320d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1321d5b93ddfSAnthony PERARD    ) ; then
1322d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1323d5b93ddfSAnthony PERARD    xen=yes
1324d5b93ddfSAnthony PERARD
1325d5b93ddfSAnthony PERARD  # Xen not found or unsupported
1326e37630caSaliguori  else
1327fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
1328fc321b4bSJuan Quintela      feature_not_found "xen"
1329fc321b4bSJuan Quintela    fi
1330fc321b4bSJuan Quintela    xen=no
1331e37630caSaliguori  fi
1332d5b93ddfSAnthony PERARD
1333d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1334d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1335d5b93ddfSAnthony PERARD  fi
1336e37630caSaliguorifi
1337e37630caSaliguori
1338e37630caSaliguori##########################################
1339a8bd70adSPaolo Bonzini# pkg-config probe
1340f91672e5SPaolo Bonzini
1341a8bd70adSPaolo Bonziniif ! has $pkg_config; then
134208421541SPaolo Bonzini  echo warning: proceeding without "$pkg_config" >&2
134308421541SPaolo Bonzini  pkg_config=/bin/false
1344f91672e5SPaolo Bonzinifi
1345f91672e5SPaolo Bonzini
1346f91672e5SPaolo Bonzini##########################################
134744dc0ca3SAlon Levy# libtool probe
134844dc0ca3SAlon Levy
13493f534581SBradif ! has $libtool; then
135044dc0ca3SAlon Levy    libtool=
135144dc0ca3SAlon Levyfi
135244dc0ca3SAlon Levy
135344dc0ca3SAlon Levy##########################################
1354dfffc653SJuan Quintela# Sparse probe
1355dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
13560dba6195SLoïc Minier  if has cgcc; then
1357dfffc653SJuan Quintela    sparse=yes
1358dfffc653SJuan Quintela  else
1359dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1360dfffc653SJuan Quintela      feature_not_found "sparse"
1361dfffc653SJuan Quintela    fi
1362dfffc653SJuan Quintela    sparse=no
1363dfffc653SJuan Quintela  fi
1364dfffc653SJuan Quintelafi
1365dfffc653SJuan Quintela
1366dfffc653SJuan Quintela##########################################
136711d9f695Sbellard# SDL probe
136811d9f695Sbellard
13693ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
13703ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
13713ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
13723ec87ffeSPaolo Bonzini  sdl_config=sdl-config
13733ec87ffeSPaolo Bonzinifi
13743ec87ffeSPaolo Bonzini
13753ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1376a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1377fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
13783ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
13793ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
13809316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1381a0dfd8a4SLoïc Minierelse
1382a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1383a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1384a0dfd8a4SLoïc Minier  fi
1385a0dfd8a4SLoïc Minier  sdl=no
13869316f803SPaolo Bonzinifi
138729e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
13883ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
13893ec87ffeSPaolo Bonzinifi
139011d9f695Sbellard
13919316f803SPaolo Bonzinisdl_too_old=no
1392c4198157SJuan Quintelaif test "$sdl" != "no" ; then
139311d9f695Sbellard  cat > $TMPC << EOF
139411d9f695Sbellard#include <SDL.h>
139511d9f695Sbellard#undef main /* We don't want SDL to override our main() */
139611d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
139711d9f695SbellardEOF
13989316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
139974f42e18STeLeMan  if test "$static" = "yes" ; then
140074f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
140174f42e18STeLeMan  else
14029316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
140374f42e18STeLeMan  fi
140452166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
140511d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
140611d9f695Sbellard      sdl_too_old=yes
140711d9f695Sbellard    else
1408fd677642Sths      if test "$cocoa" = "no" ; then
140911d9f695Sbellard        sdl=yes
141011d9f695Sbellard      fi
1411fd677642Sths    fi
14127c1f25b4Sbellard
141367c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
14141ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
141567c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1416f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1417f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
141811d9f695Sbellard      fi
141952166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
14201ac88f28SJuan Quintela	:
14211ac88f28SJuan Quintela      else
14221ac88f28SJuan Quintela        sdl=no
14237c1f25b4Sbellard      fi
14247c1f25b4Sbellard    fi # static link
1425c4198157SJuan Quintela  else # sdl not found
1426c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1427c4198157SJuan Quintela      feature_not_found "sdl"
1428c4198157SJuan Quintela    fi
1429c4198157SJuan Quintela    sdl=no
14307c1f25b4Sbellard  fi # sdl compile test
1431fd677642Sthsfi
143211d9f695Sbellard
14335368a422Saliguoriif test "$sdl" = "yes" ; then
14345368a422Saliguori  cat > $TMPC <<EOF
14355368a422Saliguori#include <SDL.h>
14365368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
14375368a422Saliguori#include <X11/XKBlib.h>
14385368a422Saliguori#else
14395368a422Saliguori#error No x11 support
14405368a422Saliguori#endif
14415368a422Saliguoriint main(void) { return 0; }
14425368a422SaliguoriEOF
144352166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1444681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
14455368a422Saliguori  fi
144607d9ac44SJuan Quintela  if test "$mingw32" = "yes" ; then
144707d9ac44SJuan Quintela    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
144807d9ac44SJuan Quintela  fi
14490705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
14505368a422Saliguorifi
14515368a422Saliguori
14528f28f3fbSths##########################################
14538d5d2d4cSths# VNC TLS detection
1454821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1455ae6b5e5aSaliguori  cat > $TMPC <<EOF
1456ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1457ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1458ae6b5e5aSaliguoriEOF
1459a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1460a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
146152166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
14621be10ad2SJuan Quintela    vnc_tls=yes
1463a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1464ae6b5e5aSaliguori  else
14651be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
14661be10ad2SJuan Quintela      feature_not_found "vnc-tls"
14671be10ad2SJuan Quintela    fi
14681be10ad2SJuan Quintela    vnc_tls=no
14698d5d2d4cSths  fi
14708d5d2d4cSthsfi
14718d5d2d4cSths
14728d5d2d4cSths##########################################
14732f9606b3Saliguori# VNC SASL detection
1474821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
14752f9606b3Saliguori  cat > $TMPC <<EOF
14762f9606b3Saliguori#include <sasl/sasl.h>
14772f9606b3Saliguori#include <stdio.h>
14782f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
14792f9606b3SaliguoriEOF
14802f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
14812f9606b3Saliguori  vnc_sasl_cflags=""
14822f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
148352166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1484ea784e3bSJuan Quintela    vnc_sasl=yes
1485fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
14862f9606b3Saliguori  else
1487ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1488ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1489ea784e3bSJuan Quintela    fi
1490ea784e3bSJuan Quintela    vnc_sasl=no
14912f9606b3Saliguori  fi
14922f9606b3Saliguorifi
14932f9606b3Saliguori
14942f9606b3Saliguori##########################################
14952f6f5c7aSCorentin Chary# VNC JPEG detection
1496821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
14972f6f5c7aSCorentin Charycat > $TMPC <<EOF
14982f6f5c7aSCorentin Chary#include <stdio.h>
14992f6f5c7aSCorentin Chary#include <jpeglib.h>
15002f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
15012f6f5c7aSCorentin CharyEOF
15022f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
15032f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
15042f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
15052f6f5c7aSCorentin Chary    vnc_jpeg=yes
15062f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
15072f6f5c7aSCorentin Chary  else
15082f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
15092f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
15102f6f5c7aSCorentin Chary    fi
15112f6f5c7aSCorentin Chary    vnc_jpeg=no
15122f6f5c7aSCorentin Chary  fi
15132f6f5c7aSCorentin Charyfi
15142f6f5c7aSCorentin Chary
15152f6f5c7aSCorentin Chary##########################################
1516efe556adSCorentin Chary# VNC PNG detection
1517821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1518efe556adSCorentin Charycat > $TMPC <<EOF
1519efe556adSCorentin Chary//#include <stdio.h>
1520efe556adSCorentin Chary#include <png.h>
1521832ce9c2SScott Wood#include <stddef.h>
1522efe556adSCorentin Charyint main(void) {
1523efe556adSCorentin Chary    png_structp png_ptr;
1524efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1525efe556adSCorentin Chary    return 0;
1526efe556adSCorentin Chary}
1527efe556adSCorentin CharyEOF
15289af8025eSBrad  if $pkg_config libpng --modversion >/dev/null 2>&1; then
15299af8025eSBrad    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
15309af8025eSBrad    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
15319af8025eSBrad  else
1532efe556adSCorentin Chary    vnc_png_cflags=""
1533efe556adSCorentin Chary    vnc_png_libs="-lpng"
15349af8025eSBrad  fi
1535efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1536efe556adSCorentin Chary    vnc_png=yes
1537efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
15389af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1539efe556adSCorentin Chary  else
1540efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1541efe556adSCorentin Chary      feature_not_found "vnc-png"
1542efe556adSCorentin Chary    fi
1543efe556adSCorentin Chary    vnc_png=no
1544efe556adSCorentin Chary  fi
1545efe556adSCorentin Charyfi
1546efe556adSCorentin Chary
1547efe556adSCorentin Chary##########################################
154876655d6dSaliguori# fnmatch() probe, used for ACL routines
154976655d6dSaliguorifnmatch="no"
155076655d6dSaliguoricat > $TMPC << EOF
155176655d6dSaliguori#include <fnmatch.h>
155276655d6dSaliguoriint main(void)
155376655d6dSaliguori{
155476655d6dSaliguori    fnmatch("foo", "foo", 0);
155576655d6dSaliguori    return 0;
155676655d6dSaliguori}
155776655d6dSaliguoriEOF
155852166aa0SJuan Quintelaif compile_prog "" "" ; then
155976655d6dSaliguori   fnmatch="yes"
156076655d6dSaliguorifi
156176655d6dSaliguori
156276655d6dSaliguori##########################################
1563ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1564ee682d27SStefan Weilif test "$uuid" != "no" ; then
1565ee682d27SStefan Weil  uuid_libs="-luuid"
1566ee682d27SStefan Weil  cat > $TMPC << EOF
1567ee682d27SStefan Weil#include <uuid/uuid.h>
1568ee682d27SStefan Weilint main(void)
1569ee682d27SStefan Weil{
1570ee682d27SStefan Weil    uuid_t my_uuid;
1571ee682d27SStefan Weil    uuid_generate(my_uuid);
1572ee682d27SStefan Weil    return 0;
1573ee682d27SStefan Weil}
1574ee682d27SStefan WeilEOF
1575ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1576ee682d27SStefan Weil    uuid="yes"
1577ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1578ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1579ee682d27SStefan Weil  else
1580ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1581ee682d27SStefan Weil      feature_not_found "uuid"
1582ee682d27SStefan Weil    fi
1583ee682d27SStefan Weil    uuid=no
1584ee682d27SStefan Weil  fi
1585ee682d27SStefan Weilfi
1586ee682d27SStefan Weil
1587ee682d27SStefan Weil##########################################
1588dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1589dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1590dce512deSChristoph Hellwig  cat > $TMPC << EOF
1591dce512deSChristoph Hellwig#include <xfs/xfs.h>
1592dce512deSChristoph Hellwigint main(void)
1593dce512deSChristoph Hellwig{
1594dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1595dce512deSChristoph Hellwig    return 0;
1596dce512deSChristoph Hellwig}
1597dce512deSChristoph HellwigEOF
1598dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1599dce512deSChristoph Hellwig    xfs="yes"
1600dce512deSChristoph Hellwig  else
1601dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1602dce512deSChristoph Hellwig      feature_not_found "xfs"
1603dce512deSChristoph Hellwig    fi
1604dce512deSChristoph Hellwig    xfs=no
1605dce512deSChristoph Hellwig  fi
1606dce512deSChristoph Hellwigfi
1607dce512deSChristoph Hellwig
1608dce512deSChristoph Hellwig##########################################
16098a16d273Sths# vde libraries probe
1610dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
16114baae0acSJuan Quintela  vde_libs="-lvdeplug"
16128a16d273Sths  cat > $TMPC << EOF
16138a16d273Sths#include <libvdeplug.h>
16144a7f0e06Spbrookint main(void)
16154a7f0e06Spbrook{
16164a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
16174a7f0e06Spbrook    vde_open("", "", &a);
16184a7f0e06Spbrook    return 0;
16194a7f0e06Spbrook}
16208a16d273SthsEOF
162152166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
16224baae0acSJuan Quintela    vde=yes
16238e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
16248e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1625dfb278bdSJuan Quintela  else
1626dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1627dfb278bdSJuan Quintela      feature_not_found "vde"
1628dfb278bdSJuan Quintela    fi
1629dfb278bdSJuan Quintela    vde=no
16308a16d273Sths  fi
16318a16d273Sthsfi
16328a16d273Sths
16338a16d273Sths##########################################
1634c2de5c91Smalc# Sound support libraries probe
16358f28f3fbSths
1636c2de5c91Smalcaudio_drv_probe()
1637c2de5c91Smalc{
1638c2de5c91Smalc    drv=$1
1639c2de5c91Smalc    hdr=$2
1640c2de5c91Smalc    lib=$3
1641c2de5c91Smalc    exp=$4
1642c2de5c91Smalc    cfl=$5
16438f28f3fbSths        cat > $TMPC << EOF
1644c2de5c91Smalc#include <$hdr>
1645c2de5c91Smalcint main(void) { $exp }
16468f28f3fbSthsEOF
164752166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
16488f28f3fbSths        :
16498f28f3fbSths    else
16508f28f3fbSths        echo
1651c2de5c91Smalc        echo "Error: $drv check failed"
1652c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
16538f28f3fbSths        echo
16548f28f3fbSths        exit 1
16558f28f3fbSths    fi
1656c2de5c91Smalc}
1657c2de5c91Smalc
16582fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1659c2de5c91Smalcfor drv in $audio_drv_list; do
1660c2de5c91Smalc    case $drv in
1661c2de5c91Smalc    alsa)
1662c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1663c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1664a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1665c2de5c91Smalc    ;;
1666c2de5c91Smalc
1667c2de5c91Smalc    fmod)
1668c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1669c2de5c91Smalc        echo
1670c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1671c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1672c2de5c91Smalc        echo
1673c2de5c91Smalc        exit 1
16748f28f3fbSths    fi
1675c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1676a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1677c2de5c91Smalc    ;;
1678c2de5c91Smalc
1679c2de5c91Smalc    esd)
1680c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1681a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
168267f86e8eSJuan Quintela    audio_pt_int="yes"
1683c2de5c91Smalc    ;;
1684b8e59f18Smalc
1685b8e59f18Smalc    pa)
1686493abda6SAurelien Jarno    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
168720fa53ecSMarc-Antoine Perennou        "pa_simple *s = 0; pa_simple_free(s); return 0;"
1688493abda6SAurelien Jarno    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
168967f86e8eSJuan Quintela    audio_pt_int="yes"
1690b8e59f18Smalc    ;;
1691b8e59f18Smalc
1692997e690aSJuan Quintela    coreaudio)
1693997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1694997e690aSJuan Quintela    ;;
1695997e690aSJuan Quintela
1696a4bf6780SJuan Quintela    dsound)
1697a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1698d5631638Smalc      audio_win_int="yes"
1699a4bf6780SJuan Quintela    ;;
1700a4bf6780SJuan Quintela
1701a4bf6780SJuan Quintela    oss)
1702a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1703a4bf6780SJuan Quintela    ;;
1704a4bf6780SJuan Quintela
1705a4bf6780SJuan Quintela    sdl|wav)
17062f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
17072f6a1ab0Sblueswir1    ;;
17082f6a1ab0Sblueswir1
1709d5631638Smalc    winwave)
1710d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1711d5631638Smalc      audio_win_int="yes"
1712d5631638Smalc    ;;
1713d5631638Smalc
1714e4c63a6aSmalc    *)
17151c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1716e4c63a6aSmalc        echo
1717e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1718e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1719e4c63a6aSmalc        echo
1720e4c63a6aSmalc        exit 1
1721e4c63a6aSmalc    }
1722e4c63a6aSmalc    ;;
1723c2de5c91Smalc    esac
1724c2de5c91Smalcdone
17258f28f3fbSths
17264d3b6f6eSbalrog##########################################
17272e4d9fb1Saurel32# BrlAPI probe
17282e4d9fb1Saurel32
17294ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1730eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
17312e4d9fb1Saurel32  cat > $TMPC << EOF
17322e4d9fb1Saurel32#include <brlapi.h>
1733832ce9c2SScott Wood#include <stddef.h>
17342e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
17352e4d9fb1Saurel32EOF
173652166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
17372e4d9fb1Saurel32    brlapi=yes
1738264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
17394ffcedb6SJuan Quintela  else
17404ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
17414ffcedb6SJuan Quintela      feature_not_found "brlapi"
17424ffcedb6SJuan Quintela    fi
17434ffcedb6SJuan Quintela    brlapi=no
1744eb82284fSJuan Quintela  fi
1745eb82284fSJuan Quintelafi
17462e4d9fb1Saurel32
17472e4d9fb1Saurel32##########################################
17484d3b6f6eSbalrog# curses probe
1749e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
1750e095e2f3SStefan Weil    curses_list="-lpdcurses"
1751e095e2f3SStefan Weilelse
17524f78ef9aSJuan Quintela    curses_list="-lncurses -lcurses"
1753e095e2f3SStefan Weilfi
17544d3b6f6eSbalrog
1755c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1756c584a6d0SJuan Quintela  curses_found=no
17574d3b6f6eSbalrog  cat > $TMPC << EOF
17584d3b6f6eSbalrog#include <curses.h>
17595a8ff3aaSblueswir1#ifdef __OpenBSD__
17605a8ff3aaSblueswir1#define resize_term resizeterm
17615a8ff3aaSblueswir1#endif
17625a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); }
17634d3b6f6eSbalrogEOF
17644f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
17654f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1766c584a6d0SJuan Quintela      curses_found=yes
17674f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
17684f78ef9aSJuan Quintela      break
17694d3b6f6eSbalrog    fi
17704f78ef9aSJuan Quintela  done
1771c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1772c584a6d0SJuan Quintela    curses=yes
1773c584a6d0SJuan Quintela  else
1774c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1775c584a6d0SJuan Quintela      feature_not_found "curses"
1776c584a6d0SJuan Quintela    fi
1777c584a6d0SJuan Quintela    curses=no
1778c584a6d0SJuan Quintela  fi
17794f78ef9aSJuan Quintelafi
17804d3b6f6eSbalrog
1781414f0dabSblueswir1##########################################
1782769ce76dSAlexander Graf# curl probe
1783769ce76dSAlexander Graf
1784a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
1785a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
17864e2b0658SPaolo Bonzinielse
17874e2b0658SPaolo Bonzini  curlconfig=curl-config
17884e2b0658SPaolo Bonzinifi
17894e2b0658SPaolo Bonzini
1790788c8196SJuan Quintelaif test "$curl" != "no" ; then
1791769ce76dSAlexander Graf  cat > $TMPC << EOF
1792769ce76dSAlexander Graf#include <curl/curl.h>
17930b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
1794769ce76dSAlexander GrafEOF
17954e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
17964e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
1797b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
1798769ce76dSAlexander Graf    curl=yes
1799f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
1800f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
1801788c8196SJuan Quintela  else
1802788c8196SJuan Quintela    if test "$curl" = "yes" ; then
1803788c8196SJuan Quintela      feature_not_found "curl"
1804788c8196SJuan Quintela    fi
1805788c8196SJuan Quintela    curl=no
1806769ce76dSAlexander Graf  fi
1807769ce76dSAlexander Graffi # test "$curl"
1808769ce76dSAlexander Graf
1809769ce76dSAlexander Graf##########################################
18105495ed11SLuiz Capitulino# check framework probe
18115495ed11SLuiz Capitulino
18125495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then
18135495ed11SLuiz Capitulino  cat > $TMPC << EOF
18145495ed11SLuiz Capitulino#include <check.h>
18155495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; }
18165495ed11SLuiz CapitulinoEOF
1817a8bd70adSPaolo Bonzini  check_libs=`$pkg_config --libs check`
18185495ed11SLuiz Capitulino  if compile_prog "" $check_libs ; then
18195495ed11SLuiz Capitulino    check_utests=yes
18205495ed11SLuiz Capitulino    libs_tools="$check_libs $libs_tools"
18215495ed11SLuiz Capitulino  else
18225495ed11SLuiz Capitulino    if test "$check_utests" = "yes" ; then
18235495ed11SLuiz Capitulino      feature_not_found "check"
18245495ed11SLuiz Capitulino    fi
18255495ed11SLuiz Capitulino    check_utests=no
18265495ed11SLuiz Capitulino  fi
18275495ed11SLuiz Capitulinofi # test "$check_utests"
18285495ed11SLuiz Capitulino
18295495ed11SLuiz Capitulino##########################################
1830fb599c9aSbalrog# bluez support probe
1831a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
1832e820e3f4Sbalrog  cat > $TMPC << EOF
1833e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
1834e820e3f4Sbalrogint main(void) { return bt_error(0); }
1835e820e3f4SbalrogEOF
1836a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1837a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
183852166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1839a20a6f46SJuan Quintela    bluez=yes
1840e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
1841e820e3f4Sbalrog  else
1842a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
1843a20a6f46SJuan Quintela      feature_not_found "bluez"
1844a20a6f46SJuan Quintela    fi
1845e820e3f4Sbalrog    bluez="no"
1846e820e3f4Sbalrog  fi
1847fb599c9aSbalrogfi
1848fb599c9aSbalrog
1849fb599c9aSbalrog##########################################
1850e18df141SAnthony Liguori# glib support probe
18514b76a481SStefan Hajnocziif $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
18524b76a481SStefan Hajnoczi    glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
18534b76a481SStefan Hajnoczi    glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
185414015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
1855957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
1856e18df141SAnthony Liguorielse
1857e18df141SAnthony Liguori    echo "glib-2.0 required to compile QEMU"
1858e18df141SAnthony Liguori    exit 1
1859e18df141SAnthony Liguorifi
1860e18df141SAnthony Liguori
1861e18df141SAnthony Liguori##########################################
1862e5d355d1Saliguori# pthread probe
18634b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
18643c529d93Saliguori
1865e5d355d1Saliguoripthread=no
1866414f0dabSblueswir1cat > $TMPC << EOF
18673c529d93Saliguori#include <pthread.h>
1868de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; }
1869414f0dabSblueswir1EOF
1870bd00d539SAndreas Färberif compile_prog "" "" ; then
1871bd00d539SAndreas Färber  pthread=yes
1872bd00d539SAndreas Färberelse
1873de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
187452166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
1875e5d355d1Saliguori      pthread=yes
18765572b539SJuan Quintela      LIBS="$pthread_lib $LIBS"
1877de65fe0fSSebastian Herbszt      break
1878414f0dabSblueswir1    fi
1879de65fe0fSSebastian Herbszt  done
1880bd00d539SAndreas Färberfi
1881414f0dabSblueswir1
18824617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
18834dd75c70SChristoph Hellwig  echo
18844dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
18854dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
18864dd75c70SChristoph Hellwig  echo
18874dd75c70SChristoph Hellwig  exit 1
1888e5d355d1Saliguorifi
1889e5d355d1Saliguori
1890bf9298b9Saliguori##########################################
1891f27aaf4bSChristian Brunner# rbd probe
1892f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
1893f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
1894f27aaf4bSChristian Brunner#include <stdio.h>
1895ad32e9c0SJosh Durgin#include <rbd/librbd.h>
1896f27aaf4bSChristian Brunnerint main(void) {
1897ad32e9c0SJosh Durgin    rados_t cluster;
1898ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
1899f27aaf4bSChristian Brunner    return 0;
1900f27aaf4bSChristian Brunner}
1901f27aaf4bSChristian BrunnerEOF
1902ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
1903f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
1904f27aaf4bSChristian Brunner    rbd=yes
1905f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
1906f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
1907f27aaf4bSChristian Brunner  else
1908f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
1909f27aaf4bSChristian Brunner      feature_not_found "rados block device"
1910f27aaf4bSChristian Brunner    fi
1911f27aaf4bSChristian Brunner    rbd=no
1912f27aaf4bSChristian Brunner  fi
1913f27aaf4bSChristian Brunnerfi
1914f27aaf4bSChristian Brunner
1915f27aaf4bSChristian Brunner##########################################
19165c6c3a6cSChristoph Hellwig# linux-aio probe
19175c6c3a6cSChristoph Hellwig
19185c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
19195c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
19205c6c3a6cSChristoph Hellwig#include <libaio.h>
19215c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
1922832ce9c2SScott Wood#include <stddef.h>
19235c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
19245c6c3a6cSChristoph HellwigEOF
19255c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
19265c6c3a6cSChristoph Hellwig    linux_aio=yes
1927048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
1928048d179fSPaul Brook    libs_tools="$libs_tools -laio"
19295c6c3a6cSChristoph Hellwig  else
19305c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
19315c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
19325c6c3a6cSChristoph Hellwig    fi
19333cfcae3cSLuiz Capitulino    linux_aio=no
19345c6c3a6cSChristoph Hellwig  fi
19355c6c3a6cSChristoph Hellwigfi
19365c6c3a6cSChristoph Hellwig
19375c6c3a6cSChristoph Hellwig##########################################
1938758e8e38SVenkateswararao Jujjuri (JV)# attr probe
1939758e8e38SVenkateswararao Jujjuri (JV)
1940758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
1941758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
1942758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
1943758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
1944758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h>
1945758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1946758e8e38SVenkateswararao Jujjuri (JV)EOF
1947758e8e38SVenkateswararao Jujjuri (JV)  if compile_prog "" "-lattr" ; then
1948758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
1949758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
1950758e8e38SVenkateswararao Jujjuri (JV)  else
1951758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
1952758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
1953758e8e38SVenkateswararao Jujjuri (JV)    fi
1954758e8e38SVenkateswararao Jujjuri (JV)    attr=no
1955758e8e38SVenkateswararao Jujjuri (JV)  fi
1956758e8e38SVenkateswararao Jujjuri (JV)fi
1957758e8e38SVenkateswararao Jujjuri (JV)
1958758e8e38SVenkateswararao Jujjuri (JV)##########################################
1959bf9298b9Saliguori# iovec probe
1960bf9298b9Saliguoricat > $TMPC <<EOF
1961db34f0b3Sblueswir1#include <sys/types.h>
1962bf9298b9Saliguori#include <sys/uio.h>
1963db34f0b3Sblueswir1#include <unistd.h>
1964bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; }
1965bf9298b9SaliguoriEOF
1966bf9298b9Saliguoriiovec=no
196752166aa0SJuan Quintelaif compile_prog "" "" ; then
1968bf9298b9Saliguori  iovec=yes
1969bf9298b9Saliguorifi
1970bf9298b9Saliguori
1971f652e6afSaurel32##########################################
1972ceb42de8Saliguori# preadv probe
1973ceb42de8Saliguoricat > $TMPC <<EOF
1974ceb42de8Saliguori#include <sys/types.h>
1975ceb42de8Saliguori#include <sys/uio.h>
1976ceb42de8Saliguori#include <unistd.h>
1977ceb42de8Saliguoriint main(void) { preadv; }
1978ceb42de8SaliguoriEOF
1979ceb42de8Saliguoripreadv=no
198052166aa0SJuan Quintelaif compile_prog "" "" ; then
1981ceb42de8Saliguori  preadv=yes
1982ceb42de8Saliguorifi
1983ceb42de8Saliguori
1984ceb42de8Saliguori##########################################
1985f652e6afSaurel32# fdt probe
19862df87df7SJuan Quintelaif test "$fdt" != "no" ; then
1987b41af4baSJuan Quintela  fdt_libs="-lfdt"
1988f652e6afSaurel32  cat > $TMPC << EOF
1989f652e6afSaurel32int main(void) { return 0; }
1990f652e6afSaurel32EOF
199152166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
1992f652e6afSaurel32    fdt=yes
19932df87df7SJuan Quintela  else
19942df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
19952df87df7SJuan Quintela      feature_not_found "fdt"
19962df87df7SJuan Quintela    fi
1997de3a354aSMichael Walle    fdt_libs=
19982df87df7SJuan Quintela    fdt=no
1999f652e6afSaurel32  fi
2000f652e6afSaurel32fi
2001f652e6afSaurel32
200220ff075bSMichael Walle##########################################
200320ff075bSMichael Walle# opengl probe, used by milkymist-tmu2
200420ff075bSMichael Walleif test "$opengl" != "no" ; then
200520ff075bSMichael Walle  opengl_libs="-lGL"
200620ff075bSMichael Walle  cat > $TMPC << EOF
200720ff075bSMichael Walle#include <X11/Xlib.h>
200820ff075bSMichael Walle#include <GL/gl.h>
200920ff075bSMichael Walle#include <GL/glx.h>
201020ff075bSMichael Walleint main(void) { GL_VERSION; return 0; }
201120ff075bSMichael WalleEOF
201220ff075bSMichael Walle  if compile_prog "" "-lGL" ; then
201320ff075bSMichael Walle    opengl=yes
201420ff075bSMichael Walle  else
201520ff075bSMichael Walle    if test "$opengl" = "yes" ; then
201620ff075bSMichael Walle      feature_not_found "opengl"
201720ff075bSMichael Walle    fi
2018de3a354aSMichael Walle    opengl_libs=
201920ff075bSMichael Walle    opengl=no
202020ff075bSMichael Walle  fi
202120ff075bSMichael Wallefi
202220ff075bSMichael Walle
20233b3f24adSaurel32#
20243b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
20253b3f24adSaurel32# emulator.  This is done because older glibc versions don't
20263b3f24adSaurel32# have syscall stubs for these implemented.
20273b3f24adSaurel32#
20283b3f24adSaurel32atfile=no
20293b3f24adSaurel32cat > $TMPC << EOF
20303b3f24adSaurel32#define _ATFILE_SOURCE
20313b3f24adSaurel32#include <sys/types.h>
20323b3f24adSaurel32#include <fcntl.h>
20333b3f24adSaurel32#include <unistd.h>
20343b3f24adSaurel32
20353b3f24adSaurel32int
20363b3f24adSaurel32main(void)
20373b3f24adSaurel32{
20383b3f24adSaurel32	/* try to unlink nonexisting file */
20393b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
20403b3f24adSaurel32}
20413b3f24adSaurel32EOF
204252166aa0SJuan Quintelaif compile_prog "" "" ; then
20433b3f24adSaurel32  atfile=yes
20443b3f24adSaurel32fi
20453b3f24adSaurel32
204639386ac7Saurel32# Check for inotify functions when we are building linux-user
20473b3f24adSaurel32# emulator.  This is done because older glibc versions don't
20483b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
20493b3f24adSaurel32# don't provide them even if kernel supports them.
20503b3f24adSaurel32#
20513b3f24adSaurel32inotify=no
20523b3f24adSaurel32cat > $TMPC << EOF
20533b3f24adSaurel32#include <sys/inotify.h>
20543b3f24adSaurel32
20553b3f24adSaurel32int
20563b3f24adSaurel32main(void)
20573b3f24adSaurel32{
20583b3f24adSaurel32	/* try to start inotify */
20598690e420Saurel32	return inotify_init();
20603b3f24adSaurel32}
20613b3f24adSaurel32EOF
206252166aa0SJuan Quintelaif compile_prog "" "" ; then
20633b3f24adSaurel32  inotify=yes
20643b3f24adSaurel32fi
20653b3f24adSaurel32
2066c05c7a73SRiku Voipioinotify1=no
2067c05c7a73SRiku Voipiocat > $TMPC << EOF
2068c05c7a73SRiku Voipio#include <sys/inotify.h>
2069c05c7a73SRiku Voipio
2070c05c7a73SRiku Voipioint
2071c05c7a73SRiku Voipiomain(void)
2072c05c7a73SRiku Voipio{
2073c05c7a73SRiku Voipio    /* try to start inotify */
2074c05c7a73SRiku Voipio    return inotify_init1(0);
2075c05c7a73SRiku Voipio}
2076c05c7a73SRiku VoipioEOF
2077c05c7a73SRiku Voipioif compile_prog "" "" ; then
2078c05c7a73SRiku Voipio  inotify1=yes
2079c05c7a73SRiku Voipiofi
2080c05c7a73SRiku Voipio
2081ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2082ebc996f3SRiku Voipioutimens=no
2083ebc996f3SRiku Voipiocat > $TMPC << EOF
2084ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2085ebc996f3SRiku Voipio#include <stddef.h>
2086ebc996f3SRiku Voipio#include <fcntl.h>
2087ebc996f3SRiku Voipio
2088ebc996f3SRiku Voipioint main(void)
2089ebc996f3SRiku Voipio{
2090ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2091ebc996f3SRiku Voipio    futimens(0, NULL);
2092ebc996f3SRiku Voipio    return 0;
2093ebc996f3SRiku Voipio}
2094ebc996f3SRiku VoipioEOF
209552166aa0SJuan Quintelaif compile_prog "" "" ; then
2096ebc996f3SRiku Voipio  utimens=yes
2097ebc996f3SRiku Voipiofi
2098ebc996f3SRiku Voipio
2099099d6b0fSRiku Voipio# check if pipe2 is there
2100099d6b0fSRiku Voipiopipe2=no
2101099d6b0fSRiku Voipiocat > $TMPC << EOF
2102099d6b0fSRiku Voipio#include <unistd.h>
2103099d6b0fSRiku Voipio#include <fcntl.h>
2104099d6b0fSRiku Voipio
2105099d6b0fSRiku Voipioint main(void)
2106099d6b0fSRiku Voipio{
2107099d6b0fSRiku Voipio    int pipefd[2];
2108099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
2109099d6b0fSRiku Voipio    return 0;
2110099d6b0fSRiku Voipio}
2111099d6b0fSRiku VoipioEOF
211252166aa0SJuan Quintelaif compile_prog "" "" ; then
2113099d6b0fSRiku Voipio  pipe2=yes
2114099d6b0fSRiku Voipiofi
2115099d6b0fSRiku Voipio
211640ff6d7eSKevin Wolf# check if accept4 is there
211740ff6d7eSKevin Wolfaccept4=no
211840ff6d7eSKevin Wolfcat > $TMPC << EOF
211940ff6d7eSKevin Wolf#include <sys/socket.h>
212040ff6d7eSKevin Wolf#include <stddef.h>
212140ff6d7eSKevin Wolf
212240ff6d7eSKevin Wolfint main(void)
212340ff6d7eSKevin Wolf{
212440ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
212540ff6d7eSKevin Wolf    return 0;
212640ff6d7eSKevin Wolf}
212740ff6d7eSKevin WolfEOF
212840ff6d7eSKevin Wolfif compile_prog "" "" ; then
212940ff6d7eSKevin Wolf  accept4=yes
213040ff6d7eSKevin Wolffi
213140ff6d7eSKevin Wolf
21323ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
21333ce34dfbSvibisreenivasansplice=no
21343ce34dfbSvibisreenivasancat > $TMPC << EOF
21353ce34dfbSvibisreenivasan#include <unistd.h>
21363ce34dfbSvibisreenivasan#include <fcntl.h>
21373ce34dfbSvibisreenivasan#include <limits.h>
21383ce34dfbSvibisreenivasan
21393ce34dfbSvibisreenivasanint main(void)
21403ce34dfbSvibisreenivasan{
21413ce34dfbSvibisreenivasan    int len, fd;
21423ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
21433ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
21443ce34dfbSvibisreenivasan    return 0;
21453ce34dfbSvibisreenivasan}
21463ce34dfbSvibisreenivasanEOF
214752166aa0SJuan Quintelaif compile_prog "" "" ; then
21483ce34dfbSvibisreenivasan  splice=yes
21493ce34dfbSvibisreenivasanfi
21503ce34dfbSvibisreenivasan
2151dcc38d1cSMarcelo Tosatti##########################################
2152dcc38d1cSMarcelo Tosatti# signalfd probe
2153dcc38d1cSMarcelo Tosattisignalfd="no"
2154dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2155dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE
2156dcc38d1cSMarcelo Tosatti#include <unistd.h>
2157dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2158dcc38d1cSMarcelo Tosatti#include <signal.h>
2159dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2160dcc38d1cSMarcelo TosattiEOF
2161dcc38d1cSMarcelo Tosatti
2162dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2163dcc38d1cSMarcelo Tosatti  signalfd=yes
2164dcc38d1cSMarcelo Tosattifi
2165dcc38d1cSMarcelo Tosatti
2166c2882b96SRiku Voipio# check if eventfd is supported
2167c2882b96SRiku Voipioeventfd=no
2168c2882b96SRiku Voipiocat > $TMPC << EOF
2169c2882b96SRiku Voipio#include <sys/eventfd.h>
2170c2882b96SRiku Voipio
2171c2882b96SRiku Voipioint main(void)
2172c2882b96SRiku Voipio{
2173c2882b96SRiku Voipio    int efd = eventfd(0, 0);
2174c2882b96SRiku Voipio    return 0;
2175c2882b96SRiku Voipio}
2176c2882b96SRiku VoipioEOF
2177c2882b96SRiku Voipioif compile_prog "" "" ; then
2178c2882b96SRiku Voipio  eventfd=yes
2179c2882b96SRiku Voipiofi
2180c2882b96SRiku Voipio
2181d0927938SUlrich Hecht# check for fallocate
2182d0927938SUlrich Hechtfallocate=no
2183d0927938SUlrich Hechtcat > $TMPC << EOF
2184d0927938SUlrich Hecht#include <fcntl.h>
2185d0927938SUlrich Hecht
2186d0927938SUlrich Hechtint main(void)
2187d0927938SUlrich Hecht{
2188d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2189d0927938SUlrich Hecht    return 0;
2190d0927938SUlrich Hecht}
2191d0927938SUlrich HechtEOF
2192be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then
2193d0927938SUlrich Hecht  fallocate=yes
2194d0927938SUlrich Hechtfi
2195d0927938SUlrich Hecht
2196c727f47dSPeter Maydell# check for sync_file_range
2197c727f47dSPeter Maydellsync_file_range=no
2198c727f47dSPeter Maydellcat > $TMPC << EOF
2199c727f47dSPeter Maydell#include <fcntl.h>
2200c727f47dSPeter Maydell
2201c727f47dSPeter Maydellint main(void)
2202c727f47dSPeter Maydell{
2203c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2204c727f47dSPeter Maydell    return 0;
2205c727f47dSPeter Maydell}
2206c727f47dSPeter MaydellEOF
2207c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
2208c727f47dSPeter Maydell  sync_file_range=yes
2209c727f47dSPeter Maydellfi
2210c727f47dSPeter Maydell
2211dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2212dace20dcSPeter Maydellfiemap=no
2213dace20dcSPeter Maydellcat > $TMPC << EOF
2214dace20dcSPeter Maydell#include <sys/ioctl.h>
2215dace20dcSPeter Maydell#include <linux/fs.h>
2216dace20dcSPeter Maydell#include <linux/fiemap.h>
2217dace20dcSPeter Maydell
2218dace20dcSPeter Maydellint main(void)
2219dace20dcSPeter Maydell{
2220dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2221dace20dcSPeter Maydell    return 0;
2222dace20dcSPeter Maydell}
2223dace20dcSPeter MaydellEOF
2224dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
2225dace20dcSPeter Maydell  fiemap=yes
2226dace20dcSPeter Maydellfi
2227dace20dcSPeter Maydell
2228d0927938SUlrich Hecht# check for dup3
2229d0927938SUlrich Hechtdup3=no
2230d0927938SUlrich Hechtcat > $TMPC << EOF
2231d0927938SUlrich Hecht#include <unistd.h>
2232d0927938SUlrich Hecht
2233d0927938SUlrich Hechtint main(void)
2234d0927938SUlrich Hecht{
2235d0927938SUlrich Hecht    dup3(0, 0, 0);
2236d0927938SUlrich Hecht    return 0;
2237d0927938SUlrich Hecht}
2238d0927938SUlrich HechtEOF
223978f5d726SJan Kiszkaif compile_prog "" "" ; then
2240d0927938SUlrich Hecht  dup3=yes
2241d0927938SUlrich Hechtfi
2242d0927938SUlrich Hecht
22433b6edd16SPeter Maydell# check for epoll support
22443b6edd16SPeter Maydellepoll=no
22453b6edd16SPeter Maydellcat > $TMPC << EOF
22463b6edd16SPeter Maydell#include <sys/epoll.h>
22473b6edd16SPeter Maydell
22483b6edd16SPeter Maydellint main(void)
22493b6edd16SPeter Maydell{
22503b6edd16SPeter Maydell    epoll_create(0);
22513b6edd16SPeter Maydell    return 0;
22523b6edd16SPeter Maydell}
22533b6edd16SPeter MaydellEOF
22543b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
22553b6edd16SPeter Maydell  epoll=yes
22563b6edd16SPeter Maydellfi
22573b6edd16SPeter Maydell
22583b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
22593b6edd16SPeter Maydell# so we must check separately for their presence
22603b6edd16SPeter Maydellepoll_create1=no
22613b6edd16SPeter Maydellcat > $TMPC << EOF
22623b6edd16SPeter Maydell#include <sys/epoll.h>
22633b6edd16SPeter Maydell
22643b6edd16SPeter Maydellint main(void)
22653b6edd16SPeter Maydell{
226619e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
226719e83f6bSPeter Maydell     * a function being called. This is necessary so that on
226819e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
226919e83f6bSPeter Maydell     * the library but not declared in the header file we will
227019e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
227119e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
227219e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
227319e83f6bSPeter Maydell     */
227419e83f6bSPeter Maydell    epoll_create1;
22753b6edd16SPeter Maydell    return 0;
22763b6edd16SPeter Maydell}
22773b6edd16SPeter MaydellEOF
22783b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
22793b6edd16SPeter Maydell  epoll_create1=yes
22803b6edd16SPeter Maydellfi
22813b6edd16SPeter Maydell
22823b6edd16SPeter Maydellepoll_pwait=no
22833b6edd16SPeter Maydellcat > $TMPC << EOF
22843b6edd16SPeter Maydell#include <sys/epoll.h>
22853b6edd16SPeter Maydell
22863b6edd16SPeter Maydellint main(void)
22873b6edd16SPeter Maydell{
22883b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
22893b6edd16SPeter Maydell    return 0;
22903b6edd16SPeter Maydell}
22913b6edd16SPeter MaydellEOF
22923b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
22933b6edd16SPeter Maydell  epoll_pwait=yes
22943b6edd16SPeter Maydellfi
22953b6edd16SPeter Maydell
2296cc8ae6deSpbrook# Check if tools are available to build documentation.
2297a25dba17SJuan Quintelaif test "$docs" != "no" ; then
229801668d98SStefan Weil  if has makeinfo && has pod2man; then
2299a25dba17SJuan Quintela    docs=yes
230083a3ab8bSJuan Quintela  else
2301a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2302a25dba17SJuan Quintela      feature_not_found "docs"
230383a3ab8bSJuan Quintela    fi
2304a25dba17SJuan Quintela    docs=no
230583a3ab8bSJuan Quintela  fi
2306cc8ae6deSpbrookfi
2307cc8ae6deSpbrook
2308f514f41cSStefan Weil# Search for bswap_32 function
23096ae9a1f4SJuan Quintelabyteswap_h=no
23106ae9a1f4SJuan Quintelacat > $TMPC << EOF
23116ae9a1f4SJuan Quintela#include <byteswap.h>
23126ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
23136ae9a1f4SJuan QuintelaEOF
231452166aa0SJuan Quintelaif compile_prog "" "" ; then
23156ae9a1f4SJuan Quintela  byteswap_h=yes
23166ae9a1f4SJuan Quintelafi
23176ae9a1f4SJuan Quintela
2318f514f41cSStefan Weil# Search for bswap_32 function
23196ae9a1f4SJuan Quintelabswap_h=no
23206ae9a1f4SJuan Quintelacat > $TMPC << EOF
23216ae9a1f4SJuan Quintela#include <sys/endian.h>
23226ae9a1f4SJuan Quintela#include <sys/types.h>
23236ae9a1f4SJuan Quintela#include <machine/bswap.h>
23246ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
23256ae9a1f4SJuan QuintelaEOF
232652166aa0SJuan Quintelaif compile_prog "" "" ; then
23276ae9a1f4SJuan Quintela  bswap_h=yes
23286ae9a1f4SJuan Quintelafi
23296ae9a1f4SJuan Quintela
2330da93a1fdSaliguori##########################################
2331da93a1fdSaliguori# Do we need librt
2332da93a1fdSaliguoricat > $TMPC <<EOF
2333da93a1fdSaliguori#include <signal.h>
2334da93a1fdSaliguori#include <time.h>
2335da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); }
2336da93a1fdSaliguoriEOF
2337da93a1fdSaliguori
233852166aa0SJuan Quintelaif compile_prog "" "" ; then
233907ffa4bdSJuan Quintela  :
234052166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
234107ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2342da93a1fdSaliguorifi
2343da93a1fdSaliguori
234431ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2345179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
23466362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
23476362a53fSJuan Quintelafi
23486362a53fSJuan Quintela
2349de5071c5SBlue Swirl##########################################
2350de5071c5SBlue Swirl# check if the compiler defines offsetof
2351de5071c5SBlue Swirl
2352de5071c5SBlue Swirlneed_offsetof=yes
2353de5071c5SBlue Swirlcat > $TMPC << EOF
2354de5071c5SBlue Swirl#include <stddef.h>
2355de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); }
2356de5071c5SBlue SwirlEOF
2357de5071c5SBlue Swirlif compile_prog "" "" ; then
2358de5071c5SBlue Swirl    need_offsetof=no
2359de5071c5SBlue Swirlfi
2360de5071c5SBlue Swirl
23615f6b9e8fSBlue Swirl##########################################
2362747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result
2363747bbdf7SBlue Swirl#
2364747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning
2365747bbdf7SBlue Swirl# about attribute warn_unused_result
2366747bbdf7SBlue Swirl
2367747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no
2368747bbdf7SBlue Swirlcat > $TMPC << EOF
2369747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2370747bbdf7SBlue Swirl#error gcc 3.3 or older
2371747bbdf7SBlue Swirl#endif
2372747bbdf7SBlue Swirlint main(void) { return 0;}
2373747bbdf7SBlue SwirlEOF
2374747bbdf7SBlue Swirlif compile_prog "" ""; then
2375747bbdf7SBlue Swirl    gcc_attribute_warn_unused_result=yes
2376747bbdf7SBlue Swirlfi
2377747bbdf7SBlue Swirl
2378cd4ec0b4SGerd Hoffmann# spice probe
2379cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2380cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2381cd4ec0b4SGerd Hoffmann#include <spice.h>
2382cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2383cd4ec0b4SGerd HoffmannEOF
2384710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2385710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2386012b80d3SGerd Hoffmann  if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \
2387cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2388cd4ec0b4SGerd Hoffmann    spice="yes"
2389cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2390cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2391cd4ec0b4SGerd Hoffmann  else
2392cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2393cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2394cd4ec0b4SGerd Hoffmann    fi
2395cd4ec0b4SGerd Hoffmann    spice="no"
2396cd4ec0b4SGerd Hoffmann  fi
2397cd4ec0b4SGerd Hoffmannfi
2398cd4ec0b4SGerd Hoffmann
2399111a38b0SRobert Relyea# check for libcacard for smartcard support
2400111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then
2401111a38b0SRobert Relyea    smartcard="yes"
2402111a38b0SRobert Relyea    smartcard_cflags=""
2403111a38b0SRobert Relyea    # TODO - what's the minimal nss version we support?
2404111a38b0SRobert Relyea    if test "$smartcard_nss" != "no"; then
2405111a38b0SRobert Relyea        if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2406111a38b0SRobert Relyea            smartcard_nss="yes"
2407111a38b0SRobert Relyea            smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2408111a38b0SRobert Relyea            libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2409111a38b0SRobert Relyea            libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2410111a38b0SRobert Relyea            QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2411111a38b0SRobert Relyea            LIBS="$libcacard_libs $LIBS"
2412111a38b0SRobert Relyea        else
2413111a38b0SRobert Relyea            if test "$smartcard_nss" = "yes"; then
2414111a38b0SRobert Relyea                feature_not_found "nss"
2415111a38b0SRobert Relyea            fi
2416111a38b0SRobert Relyea            smartcard_nss="no"
2417111a38b0SRobert Relyea        fi
2418111a38b0SRobert Relyea    fi
2419111a38b0SRobert Relyeafi
2420111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then
2421111a38b0SRobert Relyea    smartcard_nss="no"
2422111a38b0SRobert Relyeafi
2423111a38b0SRobert Relyea
242469354a83SHans de Goede# check for usbredirparser for usb network redirection support
242569354a83SHans de Goedeif test "$usb_redir" != "no" ; then
242669354a83SHans de Goede    if $pkg_config libusbredirparser >/dev/null 2>&1 ; then
242769354a83SHans de Goede        usb_redir="yes"
242869354a83SHans de Goede        usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
242969354a83SHans de Goede        usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
243069354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
243169354a83SHans de Goede        LIBS="$LIBS $usb_redir_libs"
243269354a83SHans de Goede    else
243369354a83SHans de Goede        if test "$usb_redir" = "yes"; then
243469354a83SHans de Goede            feature_not_found "usb-redir"
243569354a83SHans de Goede        fi
243669354a83SHans de Goede        usb_redir="no"
243769354a83SHans de Goede    fi
243869354a83SHans de Goedefi
243969354a83SHans de Goede
2440cd4ec0b4SGerd Hoffmann##########################################
2441cd4ec0b4SGerd Hoffmann
2442747bbdf7SBlue Swirl##########################################
24435f6b9e8fSBlue Swirl# check if we have fdatasync
24445f6b9e8fSBlue Swirl
24455f6b9e8fSBlue Swirlfdatasync=no
24465f6b9e8fSBlue Swirlcat > $TMPC << EOF
24475f6b9e8fSBlue Swirl#include <unistd.h>
2448d1722a27SAlexandre Raymondint main(void) {
2449d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2450d1722a27SAlexandre Raymondreturn fdatasync(0);
2451d1722a27SAlexandre Raymond#else
2452d1722a27SAlexandre Raymond#abort Not supported
2453d1722a27SAlexandre Raymond#endif
2454d1722a27SAlexandre Raymond}
24555f6b9e8fSBlue SwirlEOF
24565f6b9e8fSBlue Swirlif compile_prog "" "" ; then
24575f6b9e8fSBlue Swirl    fdatasync=yes
24585f6b9e8fSBlue Swirlfi
24595f6b9e8fSBlue Swirl
246094a420b1SStefan Hajnoczi##########################################
2461e78815a5SAndreas Färber# check if we have madvise
2462e78815a5SAndreas Färber
2463e78815a5SAndreas Färbermadvise=no
2464e78815a5SAndreas Färbercat > $TMPC << EOF
2465e78815a5SAndreas Färber#include <sys/types.h>
2466e78815a5SAndreas Färber#include <sys/mman.h>
2467832ce9c2SScott Wood#include <stddef.h>
2468e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2469e78815a5SAndreas FärberEOF
2470e78815a5SAndreas Färberif compile_prog "" "" ; then
2471e78815a5SAndreas Färber    madvise=yes
2472e78815a5SAndreas Färberfi
2473e78815a5SAndreas Färber
2474e78815a5SAndreas Färber##########################################
2475e78815a5SAndreas Färber# check if we have posix_madvise
2476e78815a5SAndreas Färber
2477e78815a5SAndreas Färberposix_madvise=no
2478e78815a5SAndreas Färbercat > $TMPC << EOF
2479e78815a5SAndreas Färber#include <sys/mman.h>
2480832ce9c2SScott Wood#include <stddef.h>
2481e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2482e78815a5SAndreas FärberEOF
2483e78815a5SAndreas Färberif compile_prog "" "" ; then
2484e78815a5SAndreas Färber    posix_madvise=yes
2485e78815a5SAndreas Färberfi
2486e78815a5SAndreas Färber
2487e78815a5SAndreas Färber##########################################
248894a420b1SStefan Hajnoczi# check if trace backend exists
248994a420b1SStefan Hajnoczi
24904c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
249194a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
249294a420b1SStefan Hajnoczi  echo
249394a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
249494a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
249594a420b1SStefan Hajnoczi  echo
249694a420b1SStefan Hajnoczi  exit 1
249794a420b1SStefan Hajnoczifi
249894a420b1SStefan Hajnoczi
24997e24e92aSStefan Hajnoczi##########################################
25007e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
25017e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
25027e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
25037e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
25047e24e92aSStefan Hajnoczi#include <ust/marker.h>
25057e24e92aSStefan Hajnocziint main(void) { return 0; }
25067e24e92aSStefan HajnocziEOF
25077e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
25087e24e92aSStefan Hajnoczi    LIBS="-lust $LIBS"
25097e24e92aSStefan Hajnoczi  else
25107e24e92aSStefan Hajnoczi    echo
25117e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
25127e24e92aSStefan Hajnoczi    echo
25137e24e92aSStefan Hajnoczi    exit 1
25147e24e92aSStefan Hajnoczi  fi
25157e24e92aSStefan Hajnoczifi
2516b3d08c02SDaniel P. Berrange
2517b3d08c02SDaniel P. Berrange##########################################
2518b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
2519b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
2520b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
2521b3d08c02SDaniel P. Berrange    echo
2522b3d08c02SDaniel P. Berrange    echo "Error: dtrace command is not found in PATH $PATH"
2523b3d08c02SDaniel P. Berrange    echo
2524b3d08c02SDaniel P. Berrange    exit 1
2525b3d08c02SDaniel P. Berrange  fi
2526c276b17dSDaniel P. Berrange  trace_backend_stap="no"
2527c276b17dSDaniel P. Berrange  if has 'stap' ; then
2528c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
2529c276b17dSDaniel P. Berrange  fi
2530b3d08c02SDaniel P. Berrangefi
2531b3d08c02SDaniel P. Berrange
25327e24e92aSStefan Hajnoczi##########################################
2533023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2534023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit
2535023367e6SWolfgang Mauerer# specification is necessary
25361ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2537023367e6SWolfgang Mauerer  cat > $TMPC << EOF
2538023367e6SWolfgang Mauererint sfaa(unsigned *ptr)
2539023367e6SWolfgang Mauerer{
2540023367e6SWolfgang Mauerer  return __sync_fetch_and_and(ptr, 0);
2541023367e6SWolfgang Mauerer}
2542023367e6SWolfgang Mauerer
2543023367e6SWolfgang Mauererint main(int argc, char **argv)
2544023367e6SWolfgang Mauerer{
2545023367e6SWolfgang Mauerer  int val = 42;
2546023367e6SWolfgang Mauerer  sfaa(&val);
2547023367e6SWolfgang Mauerer  return val;
2548023367e6SWolfgang Mauerer}
2549023367e6SWolfgang MauererEOF
2550023367e6SWolfgang Mauerer  if ! compile_prog "" "" ; then
2551023367e6SWolfgang Mauerer    CFLAGS+="-march=i486"
2552023367e6SWolfgang Mauerer  fi
2553023367e6SWolfgang Mauererfi
2554023367e6SWolfgang Mauerer
2555023367e6SWolfgang Mauerer##########################################
2556d0e2fce5SAneesh Kumar K.V# check if we have makecontext
2557d0e2fce5SAneesh Kumar K.V
2558d0e2fce5SAneesh Kumar K.Vucontext_coroutine=no
2559d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then
2560d0e2fce5SAneesh Kumar K.V  cat > $TMPC << EOF
2561d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
2562d0e2fce5SAneesh Kumar K.Vint main(void) { makecontext(0, 0, 0); }
2563d0e2fce5SAneesh Kumar K.VEOF
2564d0e2fce5SAneesh Kumar K.V  if compile_prog "" "" ; then
2565d0e2fce5SAneesh Kumar K.V      ucontext_coroutine=yes
2566d0e2fce5SAneesh Kumar K.V  fi
2567d0e2fce5SAneesh Kumar K.Vfi
2568d0e2fce5SAneesh Kumar K.V
2569d0e2fce5SAneesh Kumar K.V##########################################
2570e86ecd4bSJuan Quintela# End of CC checks
2571e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2572e86ecd4bSJuan Quintela
2573e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
25741156c669SJuan Quintela  CFLAGS="-O2 $CFLAGS"
2575e86ecd4bSJuan Quintelafi
2576a316e378SJuan Quintela
2577e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
2578e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
2579e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
258020ff6c80SAnthony Liguori
258120ff6c80SAnthony Liguoriif test -z "$werror" ; then
2582e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
2583e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
2584e86ecd4bSJuan Quintela        werror="yes"
2585e86ecd4bSJuan Quintela    else
2586e86ecd4bSJuan Quintela        werror="no"
2587e86ecd4bSJuan Quintela    fi
2588e86ecd4bSJuan Quintelafi
2589e86ecd4bSJuan Quintela
259020ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
259120ff6c80SAnthony Liguori# enable/disable
259220ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
259320ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
259420ff6c80SAnthony Liguori	zero_malloc="no"
259520ff6c80SAnthony Liguori    else
259620ff6c80SAnthony Liguori	zero_malloc="yes"
259720ff6c80SAnthony Liguori    fi
259820ff6c80SAnthony Liguorifi
259920ff6c80SAnthony Liguori
2600e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
2601a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2602e86ecd4bSJuan Quintelafi
2603e86ecd4bSJuan Quintela
2604e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2605e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
26061156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2607e86ecd4bSJuan Quintela    fi
2608e86ecd4bSJuan Quintelafi
2609e86ecd4bSJuan Quintela
2610952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
2611952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
2612952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
2613952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2614952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
2615952afb71SBlue Swirl        fi
2616952afb71SBlue Swirl    done
2617952afb71SBlue Swirlfi
2618952afb71SBlue Swirl
2619190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix
26205a67135aSbellard
2621ca35f780SPaolo Bonzinitools=
2622ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2623ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2624ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2625ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2626d138cee9SMichael Roth    if [ "$guest_agent" = "yes" ]; then
262748ff7a62SMichael Roth      tools="qemu-ga\$(EXESUF) $tools"
2628d138cee9SMichael Roth    fi
2629ca35f780SPaolo Bonzini    if [ "$check_utests" = "yes" ]; then
2630ca35f780SPaolo Bonzini      tools="check-qint check-qstring check-qdict check-qlist $tools"
2631ca35f780SPaolo Bonzini      tools="check-qfloat check-qjson $tools"
2632ca35f780SPaolo Bonzini    fi
2633ca35f780SPaolo Bonzini  fi
2634ca35f780SPaolo Bonzinifi
2635ca35f780SPaolo Bonzini
2636ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
2637ca35f780SPaolo Bonziniroms=
2638ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2639ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2640ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
2641ca35f780SPaolo Bonzini  roms="optionrom"
2642ca35f780SPaolo Bonzinifi
2643d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
264439ac8455SDavid Gibson  roms="$roms spapr-rtas"
264539ac8455SDavid Gibsonfi
2646ca35f780SPaolo Bonzini
26477d13299dSbellardecho "Install prefix    $prefix"
2648f2b9e1e3SPaolo Bonziniecho "BIOS directory    `eval echo $datadir`"
2649f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
26503aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
26510f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
26521c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
265311d9f695Sbellardif test "$mingw32" = "no" ; then
2654f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
265543ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
265611d9f695Sbellardfi
26575a67135aSbellardecho "Source path       $source_path"
26587d13299dSbellardecho "C compiler        $cc"
265983469015Sbellardecho "Host C compiler   $host_cc"
26600c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
2661a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
26620c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
26637d13299dSbellardecho "make              $make"
26646a882643Spbrookecho "install           $install"
2665c886edfbSBlue Swirlecho "python            $python"
2666e2d8830eSBradif test "$slirp" = "yes" ; then
2667e2d8830eSBrad    echo "smbd              $smbd"
2668e2d8830eSBradfi
2669a98fd896Sbellardecho "host CPU          $cpu"
2670de83cd02Sbellardecho "host big endian   $bigendian"
267197a847bcSbellardecho "target list       $target_list"
2672ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
2673b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
26747d13299dSbellardecho "gprof enabled     $gprof"
267503b4fe7dSaliguoriecho "sparse enabled    $sparse"
26761625af87Saliguoriecho "strip binaries    $strip_opt"
267705c2a3e7Sbellardecho "profiler          $profiler"
267843ce4dfeSbellardecho "static build      $static"
267985aa5189Sbellardecho "-Werror enabled   $werror"
26805b0753e0Sbellardif test "$darwin" = "yes" ; then
26815b0753e0Sbellard    echo "Cocoa support     $cocoa"
26825b0753e0Sbellardfi
268397a847bcSbellardecho "SDL support       $sdl"
26844d3b6f6eSbalrogecho "curses support    $curses"
2685769ce76dSAlexander Grafecho "curl support      $curl"
26865495ed11SLuiz Capitulinoecho "check support     $check_utests"
268767b915a5Sbellardecho "mingw32 support   $mingw32"
26880c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
26890c58ac1cSmalcecho "Extra audio cards $audio_card_list"
2690eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
26918ff9cbf7Smalcecho "Mixer emulation   $mixemu"
2692821601eaSJes Sorensenecho "VNC support       $vnc"
2693821601eaSJes Sorensenif test "$vnc" = "yes" ; then
26948d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
26952f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
26962f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
2697efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
2698bd023f95SCorentin Chary    echo "VNC thread        $vnc_thread"
2699821601eaSJes Sorensenfi
27003142255cSblueswir1if test -n "$sparc_cpu"; then
27013142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
27023142255cSblueswir1fi
2703e37630caSaliguoriecho "xen support       $xen"
27042e4d9fb1Saurel32echo "brlapi support    $brlapi"
2705a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
2706a25dba17SJuan Quintelaecho "Documentation     $docs"
2707c5937220Spbrook[ ! -z "$uname_release" ] && \
2708c5937220Spbrookecho "uname -r          $uname_release"
2709bd0c5661Spbrookecho "NPTL support      $nptl"
2710379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
271134005a00SKirill A. Shutemovecho "PIE user targets  $user_pie"
27128a16d273Sthsecho "vde support       $vde"
27135c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
2714758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
271577755340Sthsecho "Install blobs     $blobs"
2716b31a0277SJuan Quintelaecho "KVM support       $kvm"
2717f652e6afSaurel32echo "fdt support       $fdt"
2718ceb42de8Saliguoriecho "preadv support    $preadv"
27195f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
2720e78815a5SAndreas Färberecho "madvise           $madvise"
2721e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
2722ee682d27SStefan Weilecho "uuid support      $uuid"
2723d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
272494a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
27259410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
2726cd4ec0b4SGerd Hoffmannecho "spice support     $spice"
2727f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
2728dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
2729111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
273069354a83SHans de Goedeecho "usb net redir     $usb_redir"
273120ff075bSMichael Walleecho "OpenGL support    $opengl"
2732d138cee9SMichael Rothecho "build guest agent $guest_agent"
273367b915a5Sbellard
27341ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
273524b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
2736e8cd23deSbellardfi
273797a847bcSbellard
273898ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
27394bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
274097a847bcSbellard
274198ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
274298ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
274398ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
274498ec69acSJuan Quintelaecho >> $config_host_mak
274598ec69acSJuan Quintela
2746e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
274799d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
274899d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
27493aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
27500f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
275199d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
275299d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak
275399d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
275499d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak
27551dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak
2756804edf29SJuan Quintela
27572408a527Saurel32case "$cpu" in
2758d2fbca94SGuan Xuetao  i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
2759e0da9dd3SJuan Quintela    ARCH=$cpu
27602408a527Saurel32  ;;
2761a302c32dSLaurent Desnogues  armv4b|armv4l)
276216dbd14fSJuan Quintela    ARCH=arm
27632408a527Saurel32  ;;
27642408a527Saurel32esac
276598ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
2766f8393946Saurel32if test "$debug_tcg" = "yes" ; then
27672358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2768f8393946Saurel32fi
2769b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
2770b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2771b4475aa2SLuiz Capitulinofi
2772f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
27732358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2774f3d08ee6SPaul Brookfi
27751625af87Saliguoriif test "$strip_opt" = "yes" ; then
277652ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
27771625af87Saliguorifi
27787d13299dSbellardif test "$bigendian" = "yes" ; then
2779e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
278097a847bcSbellardfi
27812358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
278267b915a5Sbellardif test "$mingw32" = "yes" ; then
278398ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
27849fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
27859fe6de94SBlue Swirl  version_major=${rc_version%%.*}
27869fe6de94SBlue Swirl  rc_version=${rc_version#*.}
27879fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
27889fe6de94SBlue Swirl  rc_version=${rc_version#*.}
27899fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
27909fe6de94SBlue Swirl  version_micro=0
27919fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
27929fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2793210fa556Spbrookelse
279435f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
2795210fa556Spbrookfi
2796128ab2ffSblueswir1
2797dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
2798dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
2799dffcb71cSMark McLoughlinfi
2800dffcb71cSMark McLoughlin
280183fb7adfSbellardif test "$darwin" = "yes" ; then
280298ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
280383fb7adfSbellardfi
2804b29fe3edSmalc
2805b29fe3edSmalcif test "$aix" = "yes" ; then
280698ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
2807b29fe3edSmalcfi
2808b29fe3edSmalc
2809ec530c81Sbellardif test "$solaris" = "yes" ; then
281098ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
28112358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
28120475a5caSths  if test "$needs_libsunmath" = "yes" ; then
281375b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
28140475a5caSths  fi
2815ec530c81Sbellardfi
2816179cf400SAndreas Färberif test "$haiku" = "yes" ; then
2817179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
2818179cf400SAndreas Färberfi
281997a847bcSbellardif test "$static" = "yes" ; then
282098ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
282197a847bcSbellardfi
28221ba16968SStefan Weilif test "$profiler" = "yes" ; then
28232358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
282405c2a3e7Sbellardfi
2825c20709aaSbellardif test "$slirp" = "yes" ; then
282698ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
2827e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
2828f9728943SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
2829c20709aaSbellardfi
28308a16d273Sthsif test "$vde" = "yes" ; then
283198ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
28328a16d273Sthsfi
28330c58ac1cSmalcfor card in $audio_card_list; do
2834f6e5889eSpbrook    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
283598ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
28360c58ac1cSmalcdone
28372358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
28380c58ac1cSmalcfor drv in $audio_drv_list; do
2839f6e5889eSpbrook    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
284098ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
2841923e4521Smalc    if test "$drv" = "fmod"; then
28427aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2843fb065187Sbellard    fi
28440c58ac1cSmalcdone
284567f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
284667f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
284767f86e8eSJuan Quintelafi
2848d5631638Smalcif test "$audio_win_int" = "yes" ; then
2849d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2850d5631638Smalcfi
2851eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
28528ff9cbf7Smalcif test "$mixemu" = "yes" ; then
285398ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
28548ff9cbf7Smalcfi
2855821601eaSJes Sorensenif test "$vnc" = "yes" ; then
2856821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
2857821601eaSJes Sorensenfi
28588d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
285998ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2860525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
28618d5d2d4cSthsfi
28622f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
286398ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
286460ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
28652f9606b3Saliguorifi
2866821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
28672f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
28682f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
28692f6f5c7aSCorentin Charyfi
2870821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
2871efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2872efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2873efe556adSCorentin Charyfi
2874821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then
2875bd023f95SCorentin Chary  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2876bd023f95SCorentin Charyfi
287776655d6dSaliguoriif test "$fnmatch" = "yes" ; then
28782358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
287976655d6dSaliguorifi
2880ee682d27SStefan Weilif test "$uuid" = "yes" ; then
2881ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
2882ee682d27SStefan Weilfi
2883dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
2884dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
2885dce512deSChristoph Hellwigfi
2886b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
288798ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
28882358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
288998ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
289098ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
2891a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
289298ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
2893cc8ae6deSpbrookfi
28941ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
289598ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
28968ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
289749ecc3faSbellardfi
289849ecc3faSbellardif test "$cocoa" = "yes" ; then
289998ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
290049ecc3faSbellardfi
29014d3b6f6eSbalrogif test "$curses" = "yes" ; then
290298ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
2903ab4e5602SJan Kiszkafi
29043b3f24adSaurel32if test "$atfile" = "yes" ; then
29052358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
29063b3f24adSaurel32fi
2907ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
29082358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2909ebc996f3SRiku Voipiofi
2910099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
29112358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
2912099d6b0fSRiku Voipiofi
291340ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
291440ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
291540ff6d7eSKevin Wolffi
29163ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
29172358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
29183ce34dfbSvibisreenivasanfi
2919c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
2920c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2921c2882b96SRiku Voipiofi
2922d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
2923d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2924d0927938SUlrich Hechtfi
2925c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
2926c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
2927c727f47dSPeter Maydellfi
2928dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
2929dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
2930dace20dcSPeter Maydellfi
2931d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
2932d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
2933d0927938SUlrich Hechtfi
29343b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
29353b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
29363b6edd16SPeter Maydellfi
29373b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
29383b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
29393b6edd16SPeter Maydellfi
29403b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
29413b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
29423b6edd16SPeter Maydellfi
29433b3f24adSaurel32if test "$inotify" = "yes" ; then
29442358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
29453b3f24adSaurel32fi
2946c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
2947c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2948c05c7a73SRiku Voipiofi
29496ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
29506ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
29516ae9a1f4SJuan Quintelafi
29526ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
29536ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
29546ae9a1f4SJuan Quintelafi
2955769ce76dSAlexander Grafif test "$curl" = "yes" ; then
295698ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
2957b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2958769ce76dSAlexander Graffi
29592e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
296098ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
29612e4d9fb1Saurel32fi
2962fb599c9aSbalrogif test "$bluez" = "yes" ; then
296398ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2964ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2965fb599c9aSbalrogfi
2966e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
2967e37630caSaliguoriif test "$xen" = "yes" ; then
29686dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
2969d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
2970e37630caSaliguorifi
29715c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
29725c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
29735c6c3a6cSChristoph Hellwigfi
2974758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
2975758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
2976758e8e38SVenkateswararao Jujjuri (JV)fi
2977758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then
2978758e8e38SVenkateswararao Jujjuri (JV)  if test "$attr" = "yes" ; then
2979758e8e38SVenkateswararao Jujjuri (JV)    echo "CONFIG_VIRTFS=y" >> $config_host_mak
2980758e8e38SVenkateswararao Jujjuri (JV)  fi
2981758e8e38SVenkateswararao Jujjuri (JV)fi
298277755340Sthsif test "$blobs" = "yes" ; then
298398ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
298477755340Sthsfi
2985bf9298b9Saliguoriif test "$iovec" = "yes" ; then
29862358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
2987bf9298b9Saliguorifi
2988ceb42de8Saliguoriif test "$preadv" = "yes" ; then
29892358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
2990ceb42de8Saliguorifi
2991f652e6afSaurel32if test "$fdt" = "yes" ; then
29923f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
2993f652e6afSaurel32fi
2994dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
2995dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2996dcc38d1cSMarcelo Tosattifi
2997de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then
2998de5071c5SBlue Swirl  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2999de5071c5SBlue Swirlfi
3000747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then
3001747bbdf7SBlue Swirl  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
3002747bbdf7SBlue Swirlfi
30035f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
30045f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
30055f6b9e8fSBlue Swirlfi
3006e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
3007e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
3008e78815a5SAndreas Färberfi
3009e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
3010e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3011e78815a5SAndreas Färberfi
301297a847bcSbellard
3013cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
3014cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
3015cd4ec0b4SGerd Hoffmannfi
3016cd4ec0b4SGerd Hoffmann
301736707144SAlon Levyif test "$smartcard" = "yes" ; then
301836707144SAlon Levy  echo "CONFIG_SMARTCARD=y" >> $config_host_mak
301936707144SAlon Levyfi
302036707144SAlon Levy
3021111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3022111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3023111a38b0SRobert Relyeafi
3024111a38b0SRobert Relyea
302569354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
302669354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
302769354a83SHans de Goedefi
302869354a83SHans de Goede
302920ff075bSMichael Walleif test "$opengl" = "yes" ; then
303020ff075bSMichael Walle  echo "CONFIG_OPENGL=y" >> $config_host_mak
303120ff075bSMichael Wallefi
303220ff075bSMichael Walle
303383fb7adfSbellard# XXX: suppress that
30347d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
30352358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
30367d3505c5Sbellardfi
30377d3505c5Sbellard
30382358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3039c5937220Spbrook
304020ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
304120ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
304220ff6c80SAnthony Liguorifi
3043f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
3044f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
3045f27aaf4bSChristian Brunnerfi
304620ff6c80SAnthony Liguori
3047d0e2fce5SAneesh Kumar K.Vif test "$ucontext_coroutine" = "yes" ; then
3048d0e2fce5SAneesh Kumar K.V  echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3049d0e2fce5SAneesh Kumar K.Vfi
3050d0e2fce5SAneesh Kumar K.V
305168063649Sblueswir1# USB host support
305268063649Sblueswir1case "$usb" in
305368063649Sblueswir1linux)
305498ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
305568063649Sblueswir1;;
305668063649Sblueswir1bsd)
305798ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
305868063649Sblueswir1;;
305968063649Sblueswir1*)
306098ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
306168063649Sblueswir1;;
306268063649Sblueswir1esac
306368063649Sblueswir1
3064e4858974SLluís# use default implementation for tracing backend-specific routines
3065e4858974SLluístrace_default=yes
306694a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
30676d8a764eSLluísif test "$trace_backend" = "nop"; then
30686d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
306922890ab5SPrerna Saxenafi
30709410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
30716d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3072e4858974SLluís  trace_default=no
30736d8a764eSLluís  # Set the appropriate trace file.
3074953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
30759410b56cSPrerna Saxenafi
30766d8a764eSLluísif test "$trace_backend" = "stderr"; then
30776d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
30789a82b6a5SLluís  trace_default=no
30796d8a764eSLluísfi
30806d8a764eSLluísif test "$trace_backend" = "ust"; then
30816d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
30826d8a764eSLluísfi
30836d8a764eSLluísif test "$trace_backend" = "dtrace"; then
30846d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
30856d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
30866d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
30876d8a764eSLluís  fi
3088c276b17dSDaniel P. Berrangefi
30899410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3090e4858974SLluísif test "$trace_default" = "yes"; then
3091e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3092e4858974SLluísfi
30939410b56cSPrerna Saxena
309498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
309598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
3096804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
3097804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
30981901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
30991901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
31001901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3101c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
3102804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
31032b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
3104804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
3105804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
3106804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
3107804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
31089fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
310944dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
3110e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
3111a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3112f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3113e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
3114e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
3115e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
3116e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3117e39f0062SPaolo Bonzinifi
3118c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3119e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
3120a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3121a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
312273da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
31233e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3124804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
3125957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
3126804edf29SJuan Quintela
31274bf6b55bSJuan Quintela# generate list of library paths for linker script
31284bf6b55bSJuan Quintela
31294bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
31304bf6b55bSJuan Quintela
31314bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
31324bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
31334bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
31344bf6b55bSJuan Quintela  else
31354bf6b55bSJuan Quintela    rm ${config_host_ld}~
31364bf6b55bSJuan Quintela  fi
31374bf6b55bSJuan Quintelafi
31384bf6b55bSJuan Quintela
31394d904533SBlue Swirlfor d in libdis libdis-user; do
31404d904533SBlue Swirl    mkdir -p $d
314111568d6dSPaolo Bonzini    symlink $source_path/Makefile.dis $d/Makefile
31424d904533SBlue Swirl    echo > $d/config.mak
31434d904533SBlue Swirldone
3144d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then
3145d44cff22SRichard Henderson  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
3146d44cff22SRichard Hendersonfi
31474d904533SBlue Swirl
314897a847bcSbellardfor target in $target_list; do
314997a847bcSbellardtarget_dir="$target"
315025be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
3151600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
315297a847bcSbellardtarget_bigendian="no"
31531f3d3c8fSJuan Quintela
3154ea2d6a39SJuan Quintelacase "$target_arch2" in
3155*cfa550c6SMax Filippov  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3156ea2d6a39SJuan Quintela  target_bigendian=yes
3157ea2d6a39SJuan Quintela  ;;
3158ea2d6a39SJuan Quintelaesac
315997a847bcSbellardtarget_softmmu="no"
3160997344f3Sbellardtarget_user_only="no"
3161831b7825Sthstarget_linux_user="no"
3162831b7825Sthstarget_darwin_user="no"
316384778508Sblueswir1target_bsd_user="no"
31649e407a85Spbrookcase "$target" in
3165600309b6SBlue Swirl  ${target_arch2}-softmmu)
31669e407a85Spbrook    target_softmmu="yes"
31679e407a85Spbrook    ;;
3168600309b6SBlue Swirl  ${target_arch2}-linux-user)
31699c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
31709c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
31719c7a4202SBlue Swirl      exit 1
31729c7a4202SBlue Swirl    fi
31739e407a85Spbrook    target_user_only="yes"
31749e407a85Spbrook    target_linux_user="yes"
31759e407a85Spbrook    ;;
3176600309b6SBlue Swirl  ${target_arch2}-darwin-user)
31779c7a4202SBlue Swirl    if test "$darwin" != "yes" ; then
31789c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Darwin host"
31799c7a4202SBlue Swirl      exit 1
31809c7a4202SBlue Swirl    fi
31819e407a85Spbrook    target_user_only="yes"
3182831b7825Sths    target_darwin_user="yes"
31839e407a85Spbrook    ;;
3184600309b6SBlue Swirl  ${target_arch2}-bsd-user)
31859cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
31869c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
31879c7a4202SBlue Swirl      exit 1
31889c7a4202SBlue Swirl    fi
318984778508Sblueswir1    target_user_only="yes"
319084778508Sblueswir1    target_bsd_user="yes"
319184778508Sblueswir1    ;;
31929e407a85Spbrook  *)
31939e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
31949e407a85Spbrook    exit 1
31959e407a85Spbrook    ;;
31969e407a85Spbrookesac
3197831b7825Sths
319897a847bcSbellardmkdir -p $target_dir
3199158142c2Sbellardmkdir -p $target_dir/fpu
320057fec1feSbellardmkdir -p $target_dir/tcg
320159f2a787SGerd Hoffmannmkdir -p $target_dir/ide
3202353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs
320384778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
320469de927cSbellard  mkdir -p $target_dir/nwfpe
320569de927cSbellardfi
320611568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile
3207ec530c81Sbellard
320897a847bcSbellard
320925be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
321097a847bcSbellard
3211e5fe0c52Spbrookbflt="no"
3212bd0c5661Spbrooktarget_nptl="no"
3213600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
32147ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
321556aebc89Spbrookgdb_xml_files=""
3216c2e3dee6SLaurent Viviertarget_short_alignment=2
3217c2e3dee6SLaurent Viviertarget_int_alignment=4
3218c2e3dee6SLaurent Viviertarget_long_alignment=4
3219c2e3dee6SLaurent Viviertarget_llong_alignment=8
3220de3a354aSMichael Walletarget_libs_softmmu=
32217ba1e619Saliguori
3222938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
32236acff7daSJuan QuintelaTARGET_BASE_ARCH=""
3224e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
3225e73aae67SJuan Quintela
3226600309b6SBlue Swirlcase "$target_arch2" in
32272408a527Saurel32  i386)
322871deff27SAurelien Jarno    target_phys_bits=64
32292408a527Saurel32  ;;
32302408a527Saurel32  x86_64)
32316acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
32321ad2134fSPaul Brook    target_phys_bits=64
3233c2e3dee6SLaurent Vivier    target_long_alignment=8
32342408a527Saurel32  ;;
32352408a527Saurel32  alpha)
32361ad2134fSPaul Brook    target_phys_bits=64
3237c2e3dee6SLaurent Vivier    target_long_alignment=8
3238a4b388ffSRichard Henderson    target_nptl="yes"
32392408a527Saurel32  ;;
32402408a527Saurel32  arm|armeb)
3241b498c8a0SJuan Quintela    TARGET_ARCH=arm
3242e5fe0c52Spbrook    bflt="yes"
3243bd0c5661Spbrook    target_nptl="yes"
324456aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
32451ad2134fSPaul Brook    target_phys_bits=32
3246c2e3dee6SLaurent Vivier    target_llong_alignment=4
32472408a527Saurel32  ;;
32482408a527Saurel32  cris)
3249253bd7f8Sedgar_igl    target_nptl="yes"
32501ad2134fSPaul Brook    target_phys_bits=32
32512408a527Saurel32  ;;
3252613a22c9SMichael Walle  lm32)
3253613a22c9SMichael Walle    target_phys_bits=32
3254de3a354aSMichael Walle    target_libs_softmmu="$opengl_libs"
3255613a22c9SMichael Walle  ;;
32562408a527Saurel32  m68k)
32570938cda5Saurel32    bflt="yes"
325856aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
32591ad2134fSPaul Brook    target_phys_bits=32
3260c2e3dee6SLaurent Vivier    target_int_alignment=2
3261c2e3dee6SLaurent Vivier    target_long_alignment=2
3262c2e3dee6SLaurent Vivier    target_llong_alignment=2
32632408a527Saurel32  ;;
3264877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
3265877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
326672b675caSEdgar E. Iglesias    bflt="yes"
326772b675caSEdgar E. Iglesias    target_nptl="yes"
326872b675caSEdgar E. Iglesias    target_phys_bits=32
3269de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
327072b675caSEdgar E. Iglesias  ;;
32712408a527Saurel32  mips|mipsel)
3272b498c8a0SJuan Quintela    TARGET_ARCH=mips
327325be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3274f04dc72fSPaul Brook    target_nptl="yes"
32751ad2134fSPaul Brook    target_phys_bits=64
32762408a527Saurel32  ;;
32772408a527Saurel32  mipsn32|mipsn32el)
3278b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
32796acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
328025be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
32811ad2134fSPaul Brook    target_phys_bits=64
32822408a527Saurel32  ;;
32832408a527Saurel32  mips64|mips64el)
3284b498c8a0SJuan Quintela    TARGET_ARCH=mips64
32856acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
328625be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
32871ad2134fSPaul Brook    target_phys_bits=64
3288c2e3dee6SLaurent Vivier    target_long_alignment=8
32892408a527Saurel32  ;;
32902408a527Saurel32  ppc)
3291c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
32921ad2134fSPaul Brook    target_phys_bits=32
3293d6630708SNathan Froyd    target_nptl="yes"
3294de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
32952408a527Saurel32  ;;
32962408a527Saurel32  ppcemb)
32976acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3298e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3299c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
33001ad2134fSPaul Brook    target_phys_bits=64
3301d6630708SNathan Froyd    target_nptl="yes"
3302de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
33032408a527Saurel32  ;;
33042408a527Saurel32  ppc64)
33056acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3306e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3307c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
33081ad2134fSPaul Brook    target_phys_bits=64
3309c2e3dee6SLaurent Vivier    target_long_alignment=8
3310de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
33112408a527Saurel32  ;;
33122408a527Saurel32  ppc64abi32)
3313b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
33146acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3315e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
331625be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
3317c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
33181ad2134fSPaul Brook    target_phys_bits=64
3319de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
33202408a527Saurel32  ;;
33212408a527Saurel32  sh4|sh4eb)
3322b498c8a0SJuan Quintela    TARGET_ARCH=sh4
33234dbed897Spbrook    bflt="yes"
33240b6d3ae0Saurel32    target_nptl="yes"
33251ad2134fSPaul Brook    target_phys_bits=32
33262408a527Saurel32  ;;
33272408a527Saurel32  sparc)
33281ad2134fSPaul Brook    target_phys_bits=64
33292408a527Saurel32  ;;
33302408a527Saurel32  sparc64)
33316acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
33321ad2134fSPaul Brook    target_phys_bits=64
3333c2e3dee6SLaurent Vivier    target_long_alignment=8
33342408a527Saurel32  ;;
33352408a527Saurel32  sparc32plus)
3336b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
33376acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
3338e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
333925be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
33401ad2134fSPaul Brook    target_phys_bits=64
33412408a527Saurel32  ;;
334224e804ecSAlexander Graf  s390x)
3343bc434676SUlrich Hecht    target_nptl="yes"
334424e804ecSAlexander Graf    target_phys_bits=64
33457b3da903SAlexander Graf    target_long_alignment=8
334624e804ecSAlexander Graf  ;;
3347d2fbca94SGuan Xuetao  unicore32)
3348d2fbca94SGuan Xuetao    target_phys_bits=32
3349d2fbca94SGuan Xuetao  ;;
3350*cfa550c6SMax Filippov  xtensa|xtensaeb)
3351*cfa550c6SMax Filippov    TARGET_ARCH=xtensa
3352*cfa550c6SMax Filippov    target_phys_bits=32
3353*cfa550c6SMax Filippov  ;;
33542408a527Saurel32  *)
3355de83cd02Sbellard    echo "Unsupported target CPU"
3356de83cd02Sbellard    exit 1
33572408a527Saurel32  ;;
33582408a527Saurel32esac
3359c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3360c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3361c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3362c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
336325be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3364053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
336525be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
336625be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
336742bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
33686acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then
33696acff7daSJuan Quintela  TARGET_BASE_ARCH=$TARGET_ARCH
33706acff7daSJuan Quintelafi
337125be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3372e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
3373e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
3374e6e91b9cSJuan Quintelafi
337525be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
33761b0c87fcSJuan Quintelacase "$target_arch2" in
33771b0c87fcSJuan Quintela  i386|x86_64)
33781b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
337964b3cfdbSAnthony PERARD      target_phys_bits=64
338025be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
338159d21e53SAlexander Graf    else
338259d21e53SAlexander Graf      echo "CONFIG_NO_XEN=y" >> $config_target_mak
3383432d268cSJun Nakajima    fi
338459d21e53SAlexander Graf    ;;
338559d21e53SAlexander Graf  *)
338659d21e53SAlexander Graf    echo "CONFIG_NO_XEN=y" >> $config_target_mak
33871b0c87fcSJuan Quintelaesac
3388c59249f9SJuan Quintelacase "$target_arch2" in
33890e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
3390c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
3391c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3392c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
3393c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
33945f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
3395adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
3396adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3397c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
3398c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
339925be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
34001ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
3401d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3402d5970055SMichael S. Tsirkin      fi
3403c59249f9SJuan Quintela    fi
3404c59249f9SJuan Quintelaesac
3405de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
340625be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
340797a847bcSbellardfi
340897a847bcSbellardif test "$target_softmmu" = "yes" ; then
3409b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
341025be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3411de3a354aSMichael Walle  echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
34120e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
34135791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3414de83cd02Sbellardfi
3415997344f3Sbellardif test "$target_user_only" = "yes" ; then
341625be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3417997344f3Sbellardfi
3418831b7825Sthsif test "$target_linux_user" = "yes" ; then
341925be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3420831b7825Sthsfi
3421831b7825Sthsif test "$target_darwin_user" = "yes" ; then
342225be210fSJuan Quintela  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3423831b7825Sthsfi
3424111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3425111a38b0SRobert Relyea  echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3426111a38b0SRobert Relyea  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3427111a38b0SRobert Relyea  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3428111a38b0SRobert Relyeafi
342956aebc89Spbrooklist=""
343056aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
343156aebc89Spbrook  for x in $gdb_xml_files; do
343256aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
343356aebc89Spbrook  done
343425be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
34353d0f1517SJuan Quintelafi
3436de83cd02Sbellard
3437e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
343825be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3439e5fe0c52Spbrookfi
3440bd0c5661Spbrookif test "$target_user_only" = "yes" \
3441bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
344225be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3443bd0c5661Spbrookfi
3444379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
344525be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3446379f6698SPaul Brookfi
344784778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
344825be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
344984778508Sblueswir1fi
34505b0753e0Sbellard
34514afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
3452fa282484SJuan Quintela
34534afddb55SJuan Quintelacflags=""
3454f9728943SPaolo Bonziniincludes=""
3455fa282484SJuan Quintelaldflags=""
34569b8e111fSJuan Quintela
345757ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then
3458f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
345924e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
3460f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
34615d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
3462f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
346357ddfbf7SJuan Quintelaelse
3464f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
346557ddfbf7SJuan Quintelafi
3466f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
346757ddfbf7SJuan Quintela
34684d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
34694d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
34704d904533SBlue Swirlelse
34714d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
34724d904533SBlue Swirlfi
34734d904533SBlue Swirl
347464656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
347564656024SJuan Quintela  case "$i" in
347664656024SJuan Quintela  alpha)
347725be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
34784d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
347964656024SJuan Quintela  ;;
348064656024SJuan Quintela  arm)
348125be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
34824d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
348364656024SJuan Quintela  ;;
348464656024SJuan Quintela  cris)
348525be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
34864d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
348764656024SJuan Quintela  ;;
348864656024SJuan Quintela  hppa)
348925be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
34904d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
349164656024SJuan Quintela  ;;
349264656024SJuan Quintela  i386|x86_64)
349325be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
34944d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
349564656024SJuan Quintela  ;;
3496903ec55cSAurelien Jarno  ia64*)
3497903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
3498903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
3499903ec55cSAurelien Jarno  ;;
350064656024SJuan Quintela  m68k)
350125be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
35024d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
350364656024SJuan Quintela  ;;
3504877fdc12SEdgar E. Iglesias  microblaze*)
350525be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
35064d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
350764656024SJuan Quintela  ;;
350864656024SJuan Quintela  mips*)
350925be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
35104d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
351164656024SJuan Quintela  ;;
351264656024SJuan Quintela  ppc*)
351325be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
35144d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
351564656024SJuan Quintela  ;;
351624e804ecSAlexander Graf  s390*)
351725be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
35184d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
351964656024SJuan Quintela  ;;
352064656024SJuan Quintela  sh4)
352125be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
35224d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
352364656024SJuan Quintela  ;;
352464656024SJuan Quintela  sparc*)
352525be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
35264d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
352764656024SJuan Quintela  ;;
3528*cfa550c6SMax Filippov  xtensa*)
3529*cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
3530*cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $libdis_config_mak
3531*cfa550c6SMax Filippov  ;;
353264656024SJuan Quintela  esac
353364656024SJuan Quinteladone
353464656024SJuan Quintela
35356ee7126fSJuan Quintelacase "$ARCH" in
35366ee7126fSJuan Quintelaalpha)
35376ee7126fSJuan Quintela  # Ensure there's only a single GP
35386ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
35396ee7126fSJuan Quintela;;
35406ee7126fSJuan Quintelaesac
35416ee7126fSJuan Quintela
354255d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
354355d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
354455d9c04bSJuan Quintela  arm)
354555d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
354655d9c04bSJuan Quintela  ;;
354725a8bb96SMichael Walle  lm32)
354825a8bb96SMichael Walle    cflags="-DHAS_AUDIO $cflags"
354925a8bb96SMichael Walle  ;;
355055d9c04bSJuan Quintela  i386|mips|ppc)
355155d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
355255d9c04bSJuan Quintela  ;;
355355d9c04bSJuan Quintela  esac
355455d9c04bSJuan Quintelafi
355555d9c04bSJuan Quintela
355634005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \
355734005a00SKirill A. Shutemov	"$user_pie" = "yes" ; then
355834005a00SKirill A. Shutemov  cflags="-fpie $cflags"
355934005a00SKirill A. Shutemov  ldflags="-pie $ldflags"
356034005a00SKirill A. Shutemovfi
356134005a00SKirill A. Shutemov
3562471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \
3563471857ddSJuan Quintela        "$TARGET_ARCH" = "microblaze" -o \
3564471857ddSJuan Quintela        "$TARGET_ARCH" = "cris" \) ; then
356525be210fSJuan Quintela  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3566471857ddSJuan Quintelafi
3567471857ddSJuan Quintela
3568d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
356925be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
3570d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
3571d02c1db3SJuan Quintela    cflags="-p $cflags"
3572d02c1db3SJuan Quintela    ldflags="-p $ldflags"
3573d02c1db3SJuan Quintela  fi
3574d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
3575d02c1db3SJuan Quintela    ldflags="-p $ldflags"
357625be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
3577d02c1db3SJuan Quintela  fi
3578d02c1db3SJuan Quintelafi
3579d02c1db3SJuan Quintela
35806ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
35819b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3582fa282484SJuan Quintela  case "$ARCH" in
3583fa282484SJuan Quintela  sparc)
3584fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
3585322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
3586fa282484SJuan Quintela    ;;
35874d58be06SRichard Henderson  alpha | s390x)
35884d58be06SRichard Henderson    # The default placement of the application is fine.
35894d58be06SRichard Henderson    ;;
3590fd76e73aSRichard Henderson  *)
3591322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
3592fa282484SJuan Quintela    ;;
3593fa282484SJuan Quintela  esac
3594fa282484SJuan Quintelafi
3595fa282484SJuan Quintela
3596e205c790SJan Kiszka# use included Linux headers
3597af2be207SJan Kiszkaif test "$linux" = "yes" ; then
3598e205c790SJan Kiszka  includes="-I\$(SRC_PATH)/linux-headers $includes"
3599e205c790SJan Kiszka  mkdir -p linux-headers
3600e205c790SJan Kiszka  case "$cpu" in
3601e205c790SJan Kiszka  i386|x86_64)
3602e205c790SJan Kiszka    symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3603e205c790SJan Kiszka    ;;
3604e205c790SJan Kiszka  ppcemb|ppc|ppc64)
3605af2be207SJan Kiszka    symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3606e205c790SJan Kiszka    ;;
3607e205c790SJan Kiszka  s390x)
3608e205c790SJan Kiszka    symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3609e205c790SJan Kiszka    ;;
3610e205c790SJan Kiszka  esac
3611af2be207SJan Kiszkafi
3612e205c790SJan Kiszka
361325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
361425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3615f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
3616fa282484SJuan Quintela
361797a847bcSbellarddone # for target in $targets
36187d13299dSbellard
3619d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
3620e1144d00SMark McLoughlinDIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3621446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas"
36222d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
36233e230dd2SCorentin CharyDIRS="$DIRS fsdev ui"
36242345c77cSMichael RothDIRS="$DIRS qapi"
3625d9cd446bSAnthony LiguoriDIRS="$DIRS qga trace"
362670371cfbSLuiz CapitulinoFILES="Makefile tests/Makefile qdict-test-data.txt"
3627e7daa605SthsFILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3628ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3629446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
36302d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
36315ee8ad71SAlex Williamsonfor bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.rom $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
36327ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
36337ea78b74SJan Kiszkadone
3634d1807a4fSPaolo Bonzinimkdir -p $DIRS
36357d13299dSbellardfor f in $FILES ; do
3636f9245e10SPeter Maydell    if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3637f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
3638f9245e10SPeter Maydell    fi
36397d13299dSbellarddone
36401ad2134fSPaul Brook
3641c34ebfdcSAnthony Liguori# temporary config to build submodules
36422d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
3643c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
364437116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
3645c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3646c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
3647c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
3648c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
3649c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
3650c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
3651c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
3652c34ebfdcSAnthony Liguoridone
3653c34ebfdcSAnthony Liguori
36541ad2134fSPaul Brookfor hwlib in 32 64; do
36551ad2134fSPaul Brook  d=libhw$hwlib
36561ad2134fSPaul Brook  mkdir -p $d
36579953b2fcSBlue Swirl  mkdir -p $d/ide
365811568d6dSPaolo Bonzini  symlink $source_path/Makefile.hw $d/Makefile
3659353ac78dSAneesh Kumar K.V  mkdir -p $d/9pfs
366037116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
36611ad2134fSPaul Brookdone
3662add16157SBlue Swirl
3663111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then
3664111a38b0SRobert Relyea    # out of tree build
3665111a38b0SRobert Relyea    mkdir -p libcacard
3666111a38b0SRobert Relyea    rm -f libcacard/Makefile
366744dc0ca3SAlon Levy    symlink "$source_path/libcacard/Makefile" libcacard/Makefile
3668111a38b0SRobert Relyeafi
3669111a38b0SRobert Relyea
3670add16157SBlue Swirld=libuser
3671add16157SBlue Swirlmkdir -p $d
367211568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile
3673299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then
3674299060a0SKirill A. Shutemov  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3675299060a0SKirill A. Shutemovfi
3676b40292e7SJan Kiszka
3677b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
3678b40292e7SJan Kiszka  mkdir -p QMP
3679b40292e7SJan Kiszkafi
3680