xref: /openbmc/qemu/configure (revision 7f762366)
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=""
17225b651beSGerd Hoffmanncheck_utests=""
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"
185c589b249SRonnie Sahlberglibiscsi=""
186377529c0SPaolo Bonzini
187ac0df51dSaliguori# parse CC options first
188ac0df51dSaliguorifor opt do
189ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
190ac0df51dSaliguori  case "$opt" in
191ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
192ac0df51dSaliguori  ;;
1933d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
194ac0df51dSaliguori  ;;
195ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
196ca4deeb1SPaolo Bonzini  ;;
1972ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
1982ff6b91eSJuan Quintela  ;;
199a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
200e2a2ed06SJuan Quintela  ;;
201e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
202e2a2ed06SJuan Quintela  ;;
20350e7b1a0SJuan Quintela  --sparc_cpu=*)
20450e7b1a0SJuan Quintela    sparc_cpu="$optarg"
20550e7b1a0SJuan Quintela    case $sparc_cpu in
206ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
20750e7b1a0SJuan Quintela      cpu="sparc"
20850e7b1a0SJuan Quintela    ;;
20950e7b1a0SJuan Quintela    v9)
21050e7b1a0SJuan Quintela      cpu="sparc64"
21150e7b1a0SJuan Quintela    ;;
21250e7b1a0SJuan Quintela    *)
21350e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
21450e7b1a0SJuan Quintela      exit 1
21550e7b1a0SJuan Quintela    ;;
21650e7b1a0SJuan Quintela    esac
21750e7b1a0SJuan Quintela  ;;
218ac0df51dSaliguori  esac
219ac0df51dSaliguoridone
220ac0df51dSaliguori# OS specific
221ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
222ac0df51dSaliguori# we can eliminate it's usage altogether
223ac0df51dSaliguori
224b3198cc2SStuart Yodercc="${CC-${cross_prefix}gcc}"
225b3198cc2SStuart Yoderar="${AR-${cross_prefix}ar}"
226b3198cc2SStuart Yoderobjcopy="${OBJCOPY-${cross_prefix}objcopy}"
227b3198cc2SStuart Yoderld="${LD-${cross_prefix}ld}"
2283f534581SBradlibtool="${LIBTOOL-${cross_prefix}libtool}"
229b3198cc2SStuart Yoderstrip="${STRIP-${cross_prefix}strip}"
230b3198cc2SStuart Yoderwindres="${WINDRES-${cross_prefix}windres}"
231b3198cc2SStuart Yoderpkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
232b3198cc2SStuart Yodersdl_config="${SDL_CONFIG-${cross_prefix}sdl-config}"
233ac0df51dSaliguori
234be17dc90SMichael S. Tsirkin# default flags for all hosts
235be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
236be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS"
237f9188227SMike FrysingerQEMU_CFLAGS="-Wall -Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
238be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
239be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
24084958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
241cbbab922SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH) -I\$(SRC_PATH)/fpu"
242be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS"
243be17dc90SMichael S. Tsirkin
244ca4deeb1SPaolo Bonzini# make source path absolute
245ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
246ca4deeb1SPaolo Bonzini
247ac0df51dSaliguoricheck_define() {
248ac0df51dSaliguoricat > $TMPC <<EOF
249ac0df51dSaliguori#if !defined($1)
250ac0df51dSaliguori#error Not defined
251ac0df51dSaliguori#endif
252ac0df51dSaliguoriint main(void) { return 0; }
253ac0df51dSaliguoriEOF
25452166aa0SJuan Quintela  compile_object
255ac0df51dSaliguori}
256ac0df51dSaliguori
2572ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
2582ff6b91eSJuan Quintela  # command line argument
2592ff6b91eSJuan Quintela  :
2602ff6b91eSJuan Quintelaelif check_define __i386__ ; then
261ac0df51dSaliguori  cpu="i386"
262ac0df51dSaliguorielif check_define __x86_64__ ; then
263ac0df51dSaliguori  cpu="x86_64"
2643aa9bd6cSblueswir1elif check_define __sparc__ ; then
2653aa9bd6cSblueswir1  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
2663aa9bd6cSblueswir1  # They must be specified using --sparc_cpu
2673aa9bd6cSblueswir1  if check_define __arch64__ ; then
2683aa9bd6cSblueswir1    cpu="sparc64"
2693aa9bd6cSblueswir1  else
2703aa9bd6cSblueswir1    cpu="sparc"
2713aa9bd6cSblueswir1  fi
272fdf7ed96Smalcelif check_define _ARCH_PPC ; then
273fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
274fdf7ed96Smalc    cpu="ppc64"
275ac0df51dSaliguori  else
276fdf7ed96Smalc    cpu="ppc"
277fdf7ed96Smalc  fi
278afa05235SAurelien Jarnoelif check_define __mips__ ; then
279afa05235SAurelien Jarno  cpu="mips"
280477ba620SAurelien Jarnoelif check_define __ia64__ ; then
281477ba620SAurelien Jarno  cpu="ia64"
282d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
283d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
284d66ed0eaSAurelien Jarno    cpu="s390x"
285d66ed0eaSAurelien Jarno  else
286d66ed0eaSAurelien Jarno    cpu="s390"
287d66ed0eaSAurelien Jarno  fi
288f28ffed5SBradelif check_define __ARMEB__ ; then
289f28ffed5SBrad  cpu="armv4b"
290f28ffed5SBradelif check_define __ARMEL__ ; then
291f28ffed5SBrad  cpu="armv4l"
292f28ffed5SBradelif check_define __hppa__ ; then
293f28ffed5SBrad  cpu="hppa"
294fdf7ed96Smalcelse
295fdf7ed96Smalc  cpu=`uname -m`
296ac0df51dSaliguorifi
297ac0df51dSaliguori
2987d13299dSbellardcase "$cpu" in
299d2fbca94SGuan Xuetao  alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64|unicore32)
300ea8f20f8SJuan Quintela    cpu="$cpu"
301ea8f20f8SJuan Quintela  ;;
3027d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
30397a847bcSbellard    cpu="i386"
3047d13299dSbellard  ;;
305aaa5fa14Saurel32  x86_64|amd64)
306aaa5fa14Saurel32    cpu="x86_64"
307aaa5fa14Saurel32  ;;
308ba68055eSbellard  armv*b)
309808c4954Sbellard    cpu="armv4b"
310808c4954Sbellard  ;;
311ba68055eSbellard  armv*l)
3127d13299dSbellard    cpu="armv4l"
3137d13299dSbellard  ;;
314f28ffed5SBrad  hppa|parisc|parisc64)
315f54b3f92Saurel32    cpu="hppa"
316f54b3f92Saurel32  ;;
317afa05235SAurelien Jarno  mips*)
318afa05235SAurelien Jarno    cpu="mips"
319afa05235SAurelien Jarno  ;;
32024e804ecSAlexander Graf  s390)
321fb3e5849Sbellard    cpu="s390"
322fb3e5849Sbellard  ;;
32324e804ecSAlexander Graf  s390x)
32424e804ecSAlexander Graf    cpu="s390x"
32524e804ecSAlexander Graf  ;;
3263142255cSblueswir1  sparc|sun4[cdmuv])
327ae228531Sbellard    cpu="sparc"
328ae228531Sbellard  ;;
3297d13299dSbellard  *)
330a447d4dcSPaolo Bonzini    echo "Unsupported CPU = $cpu"
331a447d4dcSPaolo Bonzini    exit 1
3327d13299dSbellard  ;;
3337d13299dSbellardesac
334e2d52ad3SJuan Quintela
3357d13299dSbellard# OS specific
336ac0df51dSaliguoriif check_define __linux__ ; then
337ac0df51dSaliguori  targetos="Linux"
338ac0df51dSaliguorielif check_define _WIN32 ; then
339ac0df51dSaliguori  targetos='MINGW32'
340169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
341169dc5d3Sblueswir1  targetos='OpenBSD'
342169dc5d3Sblueswir1elif check_define __sun__ ; then
343169dc5d3Sblueswir1  targetos='SunOS'
344179cf400SAndreas Färberelif check_define __HAIKU__ ; then
345179cf400SAndreas Färber  targetos='Haiku'
346ac0df51dSaliguorielse
3477d13299dSbellard  targetos=`uname -s`
348ac0df51dSaliguorifi
3490dbfc675SJuan Quintela
3507d13299dSbellardcase $targetos in
351c326e0afSbellardCYGWIN*)
352c326e0afSbellard  mingw32="yes"
353a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
354d5631638Smalc  audio_possible_drivers="winwave sdl"
355d5631638Smalc  audio_drv_list="winwave"
356c326e0afSbellard;;
35767b915a5SbellardMINGW32*)
35867b915a5Sbellard  mingw32="yes"
359d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
360d5631638Smalc  audio_drv_list="winwave"
36167b915a5Sbellard;;
3625c40d2bdSthsGNU/kFreeBSD)
363a167ba50SAurelien Jarno  bsd="yes"
3640c58ac1cSmalc  audio_drv_list="oss"
365f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3665c40d2bdSths;;
3677d3505c5SbellardFreeBSD)
3687d3505c5Sbellard  bsd="yes"
3690db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3700c58ac1cSmalc  audio_drv_list="oss"
371f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
372f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
373f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3747d3505c5Sbellard;;
375c5e97233Sblueswir1DragonFly)
376c5e97233Sblueswir1  bsd="yes"
3770db4a067SPaolo Bonzini  make="${MAKE-gmake}"
378c5e97233Sblueswir1  audio_drv_list="oss"
379c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
380c5e97233Sblueswir1;;
3817d3505c5SbellardNetBSD)
3827d3505c5Sbellard  bsd="yes"
3830db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3840c58ac1cSmalc  audio_drv_list="oss"
385c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3868ef92a88Sblueswir1  oss_lib="-lossaudio"
3877d3505c5Sbellard;;
3887d3505c5SbellardOpenBSD)
3897d3505c5Sbellard  bsd="yes"
3900db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3910c58ac1cSmalc  audio_drv_list="oss"
392c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3932f6a1ab0Sblueswir1  oss_lib="-lossaudio"
3947d3505c5Sbellard;;
39583fb7adfSbellardDarwin)
39683fb7adfSbellard  bsd="yes"
39783fb7adfSbellard  darwin="yes"
3980dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
3990dbfc675SJuan Quintela  # run 64-bit userspace code
400aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
4011b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
402aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
4031b0f9cc2Saliguori  fi
4041b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
405a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
4060c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
4071b0f9cc2Saliguori  else
408a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
4091b0f9cc2Saliguori  fi
410831b7825Sths  darwin_user="yes"
411fd677642Sths  cocoa="yes"
4120c58ac1cSmalc  audio_drv_list="coreaudio"
413c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4140c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4157973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
41683fb7adfSbellard;;
417ec530c81SbellardSunOS)
418ec530c81Sbellard  solaris="yes"
4190db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4200db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
421fa58948dSBlue Swirl  ld="gld"
422e2d8830eSBrad  smbd="${SMBD-/usr/sfw/sbin/smbd}"
4230475a5caSths  needs_libsunmath="no"
424c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
425ef18c883Sths  # have to select again, because `uname -m` returns i86pc
426ef18c883Sths  # even on an x86_64 box.
427ef18c883Sths  solariscpu=`isainfo -k`
428ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
429ef18c883Sths    cpu="x86_64"
430ef18c883Sths  fi
431c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4320475a5caSths    if test "$solarisrev" -le 9 ; then
4330475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4340475a5caSths        needs_libsunmath="yes"
435f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
436f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
437f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4380475a5caSths      else
4390475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4400475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4410475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4420475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4430475a5caSths        exit 1
4440475a5caSths      fi
4450475a5caSths    fi
44686b2bd93Sths  fi
4476b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4480c58ac1cSmalc    audio_drv_list="oss"
4496b4d2ba1Sths  fi
450c2de5c91Smalc  audio_possible_drivers="oss sdl"
451d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
452d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
453d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
454d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
455a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
456e174c0bbSJuan Quintela  LIBS="-lsocket -lnsl -lresolv $LIBS"
457ec530c81Sbellard;;
458b29fe3edSmalcAIX)
459b29fe3edSmalc  aix="yes"
4600db4a067SPaolo Bonzini  make="${MAKE-gmake}"
461b29fe3edSmalc;;
462179cf400SAndreas FärberHaiku)
463179cf400SAndreas Färber  haiku="yes"
464179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
465179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
466179cf400SAndreas Färber;;
467fb065187Sbellard*)
4680c58ac1cSmalc  audio_drv_list="oss"
469b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4705327cf48Sbellard  linux="yes"
471831b7825Sths  linux_user="yes"
47268063649Sblueswir1  usb="linux"
473af2be207SJan Kiszka  kvm="yes"
474af2be207SJan Kiszka  vhost_net="yes"
47507f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
476c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
477c9ec1fe4Sbellard  fi
478fb065187Sbellard;;
4797d13299dSbellardesac
4807d13299dSbellard
4817d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
482b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
48368063649Sblueswir1    usb="bsd"
48483fb7adfSbellard  fi
48584778508Sblueswir1  bsd_user="yes"
4867d3505c5Sbellardfi
4877d3505c5Sbellard
4880db4a067SPaolo Bonzini: ${make=${MAKE-make}}
4890db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
490c886edfbSBlue Swirl: ${python=${PYTHON-python}}
491e2d8830eSBrad: ${smbd=${SMBD-/usr/sbin/smbd}}
4920db4a067SPaolo Bonzini
4933457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
4943457a3f8SJuan Quintela  EXESUF=".exe"
495a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
496e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
497e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
49808f3896aSStefan Weil  LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
499683035deSPaolo Bonzini  prefix="c:/Program Files/Qemu"
500683035deSPaolo Bonzini  mandir="\${prefix}"
501683035deSPaolo Bonzini  datadir="\${prefix}"
502683035deSPaolo Bonzini  docdir="\${prefix}"
503683035deSPaolo Bonzini  bindir="\${prefix}"
504683035deSPaolo Bonzini  sysconfdir="\${prefix}"
505683035deSPaolo Bonzini  confsuffix=""
50683b2f0a0SStefan Weil  guest_agent="no"
5073457a3f8SJuan Quintelafi
5083457a3f8SJuan Quintela
509487fefdbSAnthony Liguoriwerror=""
51085aa5189Sbellard
5117d13299dSbellardfor opt do
512a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
5137d13299dSbellard  case "$opt" in
5142efc3265Sbellard  --help|-h) show_help=yes
5152efc3265Sbellard  ;;
51699123e13SMike Frysinger  --version|-V) exec cat $source_path/VERSION
51799123e13SMike Frysinger  ;;
518b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5197d13299dSbellard  ;;
520b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
52132ce6337Sbellard  ;;
522ca4deeb1SPaolo Bonzini  --source-path=*)
5237d13299dSbellard  ;;
524ac0df51dSaliguori  --cross-prefix=*)
5257d13299dSbellard  ;;
526ac0df51dSaliguori  --cc=*)
5277d13299dSbellard  ;;
528b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
52983469015Sbellard  ;;
530b1a550a0Spbrook  --make=*) make="$optarg"
5317d13299dSbellard  ;;
5326a882643Spbrook  --install=*) install="$optarg"
5336a882643Spbrook  ;;
534c886edfbSBlue Swirl  --python=*) python="$optarg"
535c886edfbSBlue Swirl  ;;
536e2d8830eSBrad  --smbd=*) smbd="$optarg"
537e2d8830eSBrad  ;;
538e2a2ed06SJuan Quintela  --extra-cflags=*)
5397d13299dSbellard  ;;
540e2a2ed06SJuan Quintela  --extra-ldflags=*)
5417d13299dSbellard  ;;
5422ff6b91eSJuan Quintela  --cpu=*)
5437d13299dSbellard  ;;
544b1a550a0Spbrook  --target-list=*) target_list="$optarg"
545de83cd02Sbellard  ;;
54674242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
54794a420b1SStefan Hajnoczi  ;;
54874242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
5499410b56cSPrerna Saxena  ;;
5507d13299dSbellard  --enable-gprof) gprof="yes"
5517d13299dSbellard  ;;
55279427693SLoïc Minier  --static)
55379427693SLoïc Minier    static="yes"
55479427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
55543ce4dfeSbellard  ;;
5560b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5570b24e75fSPaolo Bonzini  ;;
5580b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5590b24e75fSPaolo Bonzini  ;;
5603aa5d2beSAlon Levy  --libdir=*) libdir="$optarg"
5613aa5d2beSAlon Levy  ;;
5620f94d6daSAlon Levy  --includedir=*) includedir="$optarg"
5630f94d6daSAlon Levy  ;;
5640b24e75fSPaolo Bonzini  --datadir=*) datadir="$optarg"
5650b24e75fSPaolo Bonzini  ;;
5660b24e75fSPaolo Bonzini  --docdir=*) docdir="$optarg"
5670b24e75fSPaolo Bonzini  ;;
568ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
56907381cc1SAnthony Liguori  ;;
57097a847bcSbellard  --disable-sdl) sdl="no"
57197a847bcSbellard  ;;
572c4198157SJuan Quintela  --enable-sdl) sdl="yes"
573c4198157SJuan Quintela  ;;
574821601eaSJes Sorensen  --disable-vnc) vnc="no"
575821601eaSJes Sorensen  ;;
576821601eaSJes Sorensen  --enable-vnc) vnc="yes"
577821601eaSJes Sorensen  ;;
578b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
579102a52e4Sbellard  ;;
580c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
581c2de5c91Smalc  ;;
5822f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
5832f6a1ab0Sblueswir1  ;;
5842fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
5850c58ac1cSmalc  ;;
5860c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
5870c58ac1cSmalc  ;;
588eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
589eb852011SMarkus Armbruster  ;;
590f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
591f8393946Saurel32  ;;
592f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
593f8393946Saurel32  ;;
594b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
595b4475aa2SLuiz Capitulino  ;;
596b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
597b4475aa2SLuiz Capitulino  ;;
598f3d08ee6SPaul Brook  --enable-debug)
599f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
600f3d08ee6SPaul Brook      debug_tcg="yes"
601b4475aa2SLuiz Capitulino      debug_mon="yes"
602f3d08ee6SPaul Brook      debug="yes"
603f3d08ee6SPaul Brook      strip_opt="no"
604f3d08ee6SPaul Brook  ;;
60503b4fe7dSaliguori  --enable-sparse) sparse="yes"
60603b4fe7dSaliguori  ;;
60703b4fe7dSaliguori  --disable-sparse) sparse="no"
60803b4fe7dSaliguori  ;;
6091625af87Saliguori  --disable-strip) strip_opt="no"
6101625af87Saliguori  ;;
6118d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
6128d5d2d4cSths  ;;
6131be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
6141be10ad2SJuan Quintela  ;;
6152f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
6162f9606b3Saliguori  ;;
617ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
618ea784e3bSJuan Quintela  ;;
6192f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
6202f6f5c7aSCorentin Chary  ;;
6212f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
6222f6f5c7aSCorentin Chary  ;;
623efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
624efe556adSCorentin Chary  ;;
625efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
626efe556adSCorentin Chary  ;;
627bd023f95SCorentin Chary  --disable-vnc-thread) vnc_thread="no"
628bd023f95SCorentin Chary  ;;
629bd023f95SCorentin Chary  --enable-vnc-thread) vnc_thread="yes"
630bd023f95SCorentin Chary  ;;
631443f1376Sbellard  --disable-slirp) slirp="no"
632c20709aaSbellard  ;;
633ee682d27SStefan Weil  --disable-uuid) uuid="no"
634ee682d27SStefan Weil  ;;
635ee682d27SStefan Weil  --enable-uuid) uuid="yes"
636ee682d27SStefan Weil  ;;
637e0e6c8c0Saliguori  --disable-vde) vde="no"
6388a16d273Sths  ;;
639dfb278bdSJuan Quintela  --enable-vde) vde="yes"
640dfb278bdSJuan Quintela  ;;
641e37630caSaliguori  --disable-xen) xen="no"
642e37630caSaliguori  ;;
643fc321b4bSJuan Quintela  --enable-xen) xen="yes"
644fc321b4bSJuan Quintela  ;;
6452e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6462e4d9fb1Saurel32  ;;
6474ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6484ffcedb6SJuan Quintela  ;;
649fb599c9aSbalrog  --disable-bluez) bluez="no"
650fb599c9aSbalrog  ;;
651a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
652a20a6f46SJuan Quintela  ;;
6537ba1e619Saliguori  --disable-kvm) kvm="no"
6547ba1e619Saliguori  ;;
655b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
656b31a0277SJuan Quintela  ;;
657cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
658cd4ec0b4SGerd Hoffmann  ;;
659cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
660cd4ec0b4SGerd Hoffmann  ;;
661c589b249SRonnie Sahlberg  --disable-libiscsi) libiscsi="no"
662c589b249SRonnie Sahlberg  ;;
663c589b249SRonnie Sahlberg  --enable-libiscsi) libiscsi="yes"
664c589b249SRonnie Sahlberg  ;;
66505c2a3e7Sbellard  --enable-profiler) profiler="yes"
66605c2a3e7Sbellard  ;;
667c2de5c91Smalc  --enable-cocoa)
668c2de5c91Smalc      cocoa="yes" ;
669c2de5c91Smalc      sdl="no" ;
670c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
6715b0753e0Sbellard  ;;
672cad25d69Spbrook  --disable-system) softmmu="no"
6730a8e90f4Spbrook  ;;
674cad25d69Spbrook  --enable-system) softmmu="yes"
6750a8e90f4Spbrook  ;;
6760953a80fSZachary Amsden  --disable-user)
6770953a80fSZachary Amsden      linux_user="no" ;
6780953a80fSZachary Amsden      bsd_user="no" ;
6790953a80fSZachary Amsden      darwin_user="no"
6800953a80fSZachary Amsden  ;;
6810953a80fSZachary Amsden  --enable-user) ;;
682831b7825Sths  --disable-linux-user) linux_user="no"
6830a8e90f4Spbrook  ;;
684831b7825Sths  --enable-linux-user) linux_user="yes"
685831b7825Sths  ;;
686831b7825Sths  --disable-darwin-user) darwin_user="no"
687831b7825Sths  ;;
688831b7825Sths  --enable-darwin-user) darwin_user="yes"
6890a8e90f4Spbrook  ;;
69084778508Sblueswir1  --disable-bsd-user) bsd_user="no"
69184778508Sblueswir1  ;;
69284778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
69384778508Sblueswir1  ;;
694379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
695379f6698SPaul Brook  ;;
696379f6698SPaul Brook  --disable-guest-base) guest_base="no"
697379f6698SPaul Brook  ;;
69834005a00SKirill A. Shutemov  --enable-user-pie) user_pie="yes"
69934005a00SKirill A. Shutemov  ;;
70034005a00SKirill A. Shutemov  --disable-user-pie) user_pie="no"
70134005a00SKirill A. Shutemov  ;;
702c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
703c5937220Spbrook  ;;
7043142255cSblueswir1  --sparc_cpu=*)
7053142255cSblueswir1  ;;
70685aa5189Sbellard  --enable-werror) werror="yes"
70785aa5189Sbellard  ;;
70885aa5189Sbellard  --disable-werror) werror="no"
70985aa5189Sbellard  ;;
7104d3b6f6eSbalrog  --disable-curses) curses="no"
7114d3b6f6eSbalrog  ;;
712c584a6d0SJuan Quintela  --enable-curses) curses="yes"
713c584a6d0SJuan Quintela  ;;
714769ce76dSAlexander Graf  --disable-curl) curl="no"
715769ce76dSAlexander Graf  ;;
716788c8196SJuan Quintela  --enable-curl) curl="yes"
717788c8196SJuan Quintela  ;;
7182df87df7SJuan Quintela  --disable-fdt) fdt="no"
7192df87df7SJuan Quintela  ;;
7202df87df7SJuan Quintela  --enable-fdt) fdt="yes"
7212df87df7SJuan Quintela  ;;
7225495ed11SLuiz Capitulino  --disable-check-utests) check_utests="no"
7235495ed11SLuiz Capitulino  ;;
7245495ed11SLuiz Capitulino  --enable-check-utests) check_utests="yes"
7255495ed11SLuiz Capitulino  ;;
726bd0c5661Spbrook  --disable-nptl) nptl="no"
727bd0c5661Spbrook  ;;
728b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
729b0a47e79SJuan Quintela  ;;
7308ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
7318ff9cbf7Smalc  ;;
7325c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
7335c6c3a6cSChristoph Hellwig  ;;
7345c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
7355c6c3a6cSChristoph Hellwig  ;;
736758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
737758e8e38SVenkateswararao Jujjuri (JV)  ;;
738758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
739758e8e38SVenkateswararao Jujjuri (JV)  ;;
74077755340Sths  --disable-blobs) blobs="no"
74177755340Sths  ;;
7424a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
7434a19f1ecSpbrook  ;;
744a25dba17SJuan Quintela  --disable-docs) docs="no"
74570ec5dc0SAnthony Liguori  ;;
746a25dba17SJuan Quintela  --enable-docs) docs="yes"
74783a3ab8bSJuan Quintela  ;;
748d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
749d5970055SMichael S. Tsirkin  ;;
750d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
751d5970055SMichael S. Tsirkin  ;;
75220ff075bSMichael Walle  --disable-opengl) opengl="no"
75320ff075bSMichael Walle  ;;
75420ff075bSMichael Walle  --enable-opengl) opengl="yes"
75520ff075bSMichael Walle  ;;
7566bde81cbSPaolo Bonzini  --*dir)
7576bde81cbSPaolo Bonzini  ;;
758f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
759f27aaf4bSChristian Brunner  ;;
760f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
761f27aaf4bSChristian Brunner  ;;
76236707144SAlon Levy  --disable-smartcard) smartcard="no"
76336707144SAlon Levy  ;;
76436707144SAlon Levy  --enable-smartcard) smartcard="yes"
76536707144SAlon Levy  ;;
766111a38b0SRobert Relyea  --disable-smartcard-nss) smartcard_nss="no"
767111a38b0SRobert Relyea  ;;
768111a38b0SRobert Relyea  --enable-smartcard-nss) smartcard_nss="yes"
769111a38b0SRobert Relyea  ;;
77069354a83SHans de Goede  --disable-usb-redir) usb_redir="no"
77169354a83SHans de Goede  ;;
77269354a83SHans de Goede  --enable-usb-redir) usb_redir="yes"
77369354a83SHans de Goede  ;;
7741ece9905SAlon Levy  --disable-zlib-test) zlib="no"
7751ece9905SAlon Levy  ;;
776d138cee9SMichael Roth  --enable-guest-agent) guest_agent="yes"
777d138cee9SMichael Roth  ;;
778d138cee9SMichael Roth  --disable-guest-agent) guest_agent="no"
779d138cee9SMichael Roth  ;;
7807f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
7817f1559c6Sbalrog  ;;
7827d13299dSbellard  esac
7837d13299dSbellarddone
7847d13299dSbellard
7853142255cSblueswir1#
7863142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
787a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
7883142255cSblueswir1#
789379f6698SPaul Brookhost_guest_base="no"
79040293e58Sbellardcase "$cpu" in
791ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
792ed968ff1SJuan Quintela           v7|v8)
793a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
794ed968ff1SJuan Quintela           ;;
795ed968ff1SJuan Quintela           v8plus|v8plusa)
796a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
797ed968ff1SJuan Quintela           ;;
798ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
799a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
800ed968ff1SJuan Quintela           esac
8010c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
802a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
803762e8230Sblueswir1           if test "$solaris" = "no" ; then
804a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
805c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
806762e8230Sblueswir1           fi
8073142255cSblueswir1           ;;
808ed968ff1SJuan Quintela    sparc64)
809a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
8100c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
811a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
812ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
813a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
814762e8230Sblueswir1           fi
8153142255cSblueswir1           ;;
81676d83bdeSths    s390)
81728d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
81828d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
81948bb3750SRichard Henderson           host_guest_base="yes"
82028d7cc49SRichard Henderson           ;;
82128d7cc49SRichard Henderson    s390x)
82228d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
82328d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
82448bb3750SRichard Henderson           host_guest_base="yes"
82576d83bdeSths           ;;
82640293e58Sbellard    i386)
827a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
8280c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
8292b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
830c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
831379f6698SPaul Brook           host_guest_base="yes"
83240293e58Sbellard           ;;
83340293e58Sbellard    x86_64)
834a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
8350c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
8362b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
837379f6698SPaul Brook           host_guest_base="yes"
838379f6698SPaul Brook           ;;
839379f6698SPaul Brook    arm*)
840379f6698SPaul Brook           host_guest_base="yes"
84140293e58Sbellard           ;;
842f6548c0aSmalc    ppc*)
843f6548c0aSmalc           host_guest_base="yes"
844f6548c0aSmalc           ;;
845cc01cc8eSAurelien Jarno    mips*)
846cc01cc8eSAurelien Jarno           host_guest_base="yes"
847cc01cc8eSAurelien Jarno           ;;
848477ba620SAurelien Jarno    ia64*)
849477ba620SAurelien Jarno           host_guest_base="yes"
850477ba620SAurelien Jarno           ;;
851fd76e73aSRichard Henderson    hppa*)
852fd76e73aSRichard Henderson           host_guest_base="yes"
853fd76e73aSRichard Henderson           ;;
854d2fbca94SGuan Xuetao    unicore32*)
855d2fbca94SGuan Xuetao           host_guest_base="yes"
856d2fbca94SGuan Xuetao           ;;
8573142255cSblueswir1esac
8583142255cSblueswir1
859379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
860379f6698SPaul Brook
86160e0df25SPeter Maydell
86260e0df25SPeter Maydelldefault_target_list=""
86360e0df25SPeter Maydell
86460e0df25SPeter Maydell# these targets are portable
86560e0df25SPeter Maydellif [ "$softmmu" = "yes" ] ; then
86660e0df25SPeter Maydell    default_target_list="\
86760e0df25SPeter Maydelli386-softmmu \
86860e0df25SPeter Maydellx86_64-softmmu \
86927cdad67SRichard Hendersonalpha-softmmu \
87060e0df25SPeter Maydellarm-softmmu \
87160e0df25SPeter Maydellcris-softmmu \
87260e0df25SPeter Maydelllm32-softmmu \
87360e0df25SPeter Maydellm68k-softmmu \
87460e0df25SPeter Maydellmicroblaze-softmmu \
87560e0df25SPeter Maydellmicroblazeel-softmmu \
87660e0df25SPeter Maydellmips-softmmu \
87760e0df25SPeter Maydellmipsel-softmmu \
87860e0df25SPeter Maydellmips64-softmmu \
87960e0df25SPeter Maydellmips64el-softmmu \
88060e0df25SPeter Maydellppc-softmmu \
88160e0df25SPeter Maydellppcemb-softmmu \
88260e0df25SPeter Maydellppc64-softmmu \
88360e0df25SPeter Maydellsh4-softmmu \
88460e0df25SPeter Maydellsh4eb-softmmu \
88560e0df25SPeter Maydellsparc-softmmu \
88660e0df25SPeter Maydellsparc64-softmmu \
8870f3301d4SAlexander Grafs390x-softmmu \
888cfa550c6SMax Filippovxtensa-softmmu \
889cfa550c6SMax Filippovxtensaeb-softmmu \
89060e0df25SPeter Maydell"
89160e0df25SPeter Maydellfi
89260e0df25SPeter Maydell# the following are Linux specific
89360e0df25SPeter Maydellif [ "$linux_user" = "yes" ] ; then
89460e0df25SPeter Maydell    default_target_list="${default_target_list}\
89560e0df25SPeter Maydelli386-linux-user \
89660e0df25SPeter Maydellx86_64-linux-user \
89760e0df25SPeter Maydellalpha-linux-user \
89860e0df25SPeter Maydellarm-linux-user \
89960e0df25SPeter Maydellarmeb-linux-user \
90060e0df25SPeter Maydellcris-linux-user \
90160e0df25SPeter Maydellm68k-linux-user \
90260e0df25SPeter Maydellmicroblaze-linux-user \
90360e0df25SPeter Maydellmicroblazeel-linux-user \
90460e0df25SPeter Maydellmips-linux-user \
90560e0df25SPeter Maydellmipsel-linux-user \
90660e0df25SPeter Maydellppc-linux-user \
90760e0df25SPeter Maydellppc64-linux-user \
90860e0df25SPeter Maydellppc64abi32-linux-user \
90960e0df25SPeter Maydellsh4-linux-user \
91060e0df25SPeter Maydellsh4eb-linux-user \
91160e0df25SPeter Maydellsparc-linux-user \
91260e0df25SPeter Maydellsparc64-linux-user \
91360e0df25SPeter Maydellsparc32plus-linux-user \
91460e0df25SPeter Maydellunicore32-linux-user \
9150f3301d4SAlexander Grafs390x-linux-user \
91660e0df25SPeter Maydell"
91760e0df25SPeter Maydellfi
91860e0df25SPeter Maydell# the following are Darwin specific
91960e0df25SPeter Maydellif [ "$darwin_user" = "yes" ] ; then
92060e0df25SPeter Maydell    default_target_list="$default_target_list i386-darwin-user ppc-darwin-user "
92160e0df25SPeter Maydellfi
92260e0df25SPeter Maydell# the following are BSD specific
92360e0df25SPeter Maydellif [ "$bsd_user" = "yes" ] ; then
92460e0df25SPeter Maydell    default_target_list="${default_target_list}\
92560e0df25SPeter Maydelli386-bsd-user \
92660e0df25SPeter Maydellx86_64-bsd-user \
92760e0df25SPeter Maydellsparc-bsd-user \
92860e0df25SPeter Maydellsparc64-bsd-user \
92960e0df25SPeter Maydell"
93060e0df25SPeter Maydellfi
93160e0df25SPeter Maydell
932af5db58eSpbrookif test x"$show_help" = x"yes" ; then
933af5db58eSpbrookcat << EOF
934af5db58eSpbrook
935af5db58eSpbrookUsage: configure [options]
936af5db58eSpbrookOptions: [defaults in brackets after descriptions]
937af5db58eSpbrook
938af5db58eSpbrookEOF
939af5db58eSpbrookecho "Standard options:"
940af5db58eSpbrookecho "  --help                   print this message"
941af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
942af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
943af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
94460e0df25SPeter Maydellecho "  --target-list=LIST       set target list (default: build everything)"
94560e0df25SPeter Maydellecho "Available targets: $default_target_list" | \
94660e0df25SPeter Maydell    fold -s -w 53 | sed -e 's/^/                           /'
947af5db58eSpbrookecho ""
948af5db58eSpbrookecho "Advanced options (experts only):"
949af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
950af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
951af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
9520bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
9530bfe8cc0SPaolo Bonziniecho "                           build time"
954a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
955e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
956af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
9576a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
958c886edfbSBlue Swirlecho "  --python=PYTHON          use specified python [$python]"
959e2d8830eSBradecho "  --smbd=SMBD              use specified smbd [$smbd]"
960af5db58eSpbrookecho "  --static                 enable static build [$static]"
9610b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
9620b24e75fSPaolo Bonziniecho "  --datadir=PATH           install firmware in PATH"
9630b24e75fSPaolo Bonziniecho "  --docdir=PATH            install documentation in PATH"
9640b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
9650b24e75fSPaolo Bonziniecho "  --sysconfdir=PATH        install config in PATH/qemu"
966f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
967f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
96809695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
969890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
970890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
9711625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
97285aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
973fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
974c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
975821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
976821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
977af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
978c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
979c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
9804c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
9814c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
982eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
983eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
9848ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
985e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
986fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
9872e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
9884ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
9898d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
9901be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
9912f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
992ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
9932f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
9942f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
99596763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
996efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
997bd023f95SCorentin Charyecho "  --disable-vnc-thread     disable threaded VNC server"
998bd023f95SCorentin Charyecho "  --enable-vnc-thread      enable threaded VNC server"
999af896aaaSpbrookecho "  --disable-curses         disable curses output"
1000c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
1001769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
1002788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
10032df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
10042df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
10055495ed11SLuiz Capitulinoecho "  --disable-check-utests   disable check unit-tests"
10065495ed11SLuiz Capitulinoecho "  --enable-check-utests    enable check unit-tests"
1007fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
1008a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
10096093d3d4SPeter Maydellecho "  --disable-slirp          disable SLIRP userspace network connectivity"
10107ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
1011b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
1012bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
1013e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
1014af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
1015af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
10160953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
10170953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
1018831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
1019831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
1020831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
1021831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
102284778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
102384778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
1024379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
1025379f6698SPaul Brookecho "                           emulation targets"
1026379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
102734005a00SKirill A. Shutemovecho "  --enable-user-pie        build usermode emulation targets as PIE"
102834005a00SKirill A. Shutemovecho "  --disable-user-pie       do not build usermode emulation targets as PIE"
1029af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
1030af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
10312f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
1032c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
10333142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
1034ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
1035ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
1036e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
1037dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
10385c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
10395c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
1040758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
1041758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
104277755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
1043d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
1044d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
1045d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
1046d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
1047320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
1048320fba2aSFabien Chouteauecho "                           Available backends:" $("$source_path"/scripts/tracetool --list-backends)
104974242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
10509410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
1051cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
1052cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
1053f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
1054c589b249SRonnie Sahlbergecho "  --disable-libiscsi       disable iscsi support"
1055c589b249SRonnie Sahlbergecho "  --enable-libiscsi        enable iscsi support"
105636707144SAlon Levyecho "  --disable-smartcard      disable smartcard support"
105736707144SAlon Levyecho "  --enable-smartcard       enable smartcard support"
1058111a38b0SRobert Relyeaecho "  --disable-smartcard-nss  disable smartcard nss support"
1059111a38b0SRobert Relyeaecho "  --enable-smartcard-nss   enable smartcard nss support"
106069354a83SHans de Goedeecho "  --disable-usb-redir      disable usb network redirection support"
106169354a83SHans de Goedeecho "  --enable-usb-redir       enable usb network redirection support"
1062d138cee9SMichael Rothecho "  --disable-guest-agent    disable building of the QEMU Guest Agent"
1063d138cee9SMichael Rothecho "  --enable-guest-agent     enable building of the QEMU Guest Agent"
1064af5db58eSpbrookecho ""
10655bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
1066af5db58eSpbrookexit 1
1067af5db58eSpbrookfi
1068af5db58eSpbrook
10698d05095cSPaolo Bonzini# check that the C compiler works.
10708d05095cSPaolo Bonzinicat > $TMPC <<EOF
10718d05095cSPaolo Bonziniint main(void) {}
10728d05095cSPaolo BonziniEOF
10738d05095cSPaolo Bonzini
10748d05095cSPaolo Bonziniif compile_object ; then
10758d05095cSPaolo Bonzini  : C compiler works ok
10768d05095cSPaolo Bonzinielse
10778d05095cSPaolo Bonzini    echo "ERROR: \"$cc\" either does not exist or does not work"
10788d05095cSPaolo Bonzini    exit 1
10798d05095cSPaolo Bonzinifi
10808d05095cSPaolo Bonzini
10818d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
10828d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
10838d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
1084f9188227SMike Frysingergcc_flags="-fstack-protector-all -Wendif-labels $gcc_flags"
10858d05095cSPaolo Bonzinicat > $TMPC << EOF
10868d05095cSPaolo Bonziniint main(void) { return 0; }
10878d05095cSPaolo BonziniEOF
10888d05095cSPaolo Bonzinifor flag in $gcc_flags; do
1089af2d37deSStefan Weil    if compile_prog "$flag -Werror" "" ; then
10908d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
10918d05095cSPaolo Bonzini    fi
10928d05095cSPaolo Bonzinidone
10938d05095cSPaolo Bonzini
1094ec530c81Sbellard#
1095ec530c81Sbellard# Solaris specific configure tool chain decisions
1096ec530c81Sbellard#
1097ec530c81Sbellardif test "$solaris" = "yes" ; then
10986792aa11SLoïc Minier  if has $install; then
10996792aa11SLoïc Minier    :
11006792aa11SLoïc Minier  else
1101ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
1102ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
1103ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
1104ec530c81Sbellard    exit 1
1105ec530c81Sbellard  fi
11066792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
1107ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
1108ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
1109ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
1110ec530c81Sbellard    exit 1
1111ec530c81Sbellard  fi
11126792aa11SLoïc Minier  if has ar; then
11136792aa11SLoïc Minier    :
11146792aa11SLoïc Minier  else
1115ec530c81Sbellard    echo "Error: No path includes ar"
1116ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
1117ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
1118ec530c81Sbellard    fi
1119ec530c81Sbellard    exit 1
1120ec530c81Sbellard  fi
1121ec530c81Sbellardfi
1122ec530c81Sbellard
1123d138cee9SMichael Rothif test "$guest_agent" != "no" ; then
1124c886edfbSBlue Swirl  if has $python; then
1125c886edfbSBlue Swirl    :
1126c886edfbSBlue Swirl  else
1127c886edfbSBlue Swirl    echo "Python not found. Use --python=/path/to/python"
1128c886edfbSBlue Swirl    exit 1
1129c886edfbSBlue Swirl  fi
1130d138cee9SMichael Rothfi
1131c886edfbSBlue Swirl
11325327cf48Sbellardif test -z "$target_list" ; then
113360e0df25SPeter Maydell    target_list="$default_target_list"
11346e20a45fSbellardelse
1135b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
11365327cf48Sbellardfi
11370a8e90f4Spbrookif test -z "$target_list" ; then
11380a8e90f4Spbrook    echo "No targets enabled"
11390a8e90f4Spbrook    exit 1
11400a8e90f4Spbrookfi
1141f55fe278SPaolo Bonzini# see if system emulation was really requested
1142f55fe278SPaolo Bonzinicase " $target_list " in
1143f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1144f55fe278SPaolo Bonzini  ;;
1145f55fe278SPaolo Bonzini  *) softmmu=no
1146f55fe278SPaolo Bonzini  ;;
1147f55fe278SPaolo Bonziniesac
11485327cf48Sbellard
1149249247c9SJuan Quintelafeature_not_found() {
1150249247c9SJuan Quintela  feature=$1
1151249247c9SJuan Quintela
1152249247c9SJuan Quintela  echo "ERROR"
1153249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
11549332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1155249247c9SJuan Quintela  echo "ERROR"
1156249247c9SJuan Quintela  exit 1;
1157249247c9SJuan Quintela}
1158249247c9SJuan Quintela
11597d13299dSbellardif test -z "$cross_prefix" ; then
11607d13299dSbellard
11617d13299dSbellard# ---
11627d13299dSbellard# big/little endian test
11637d13299dSbellardcat > $TMPC << EOF
11647d13299dSbellard#include <inttypes.h>
11657d13299dSbellardint main(int argc, char ** argv){
11667d13299dSbellard        volatile uint32_t i=0x01234567;
11677d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
11687d13299dSbellard}
11697d13299dSbellardEOF
11707d13299dSbellard
117152166aa0SJuan Quintelaif compile_prog "" "" ; then
11727d13299dSbellard$TMPE && bigendian="yes"
11737d13299dSbellardelse
11747d13299dSbellardecho big/little test failed
11757d13299dSbellardfi
11767d13299dSbellard
11777d13299dSbellardelse
11787d13299dSbellard
11797d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1180ea8f20f8SJuan Quintelacase "$cpu" in
118124e804ecSAlexander Graf  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1182ea8f20f8SJuan Quintela    bigendian=yes
1183ea8f20f8SJuan Quintela  ;;
1184ea8f20f8SJuan Quintelaesac
11857d13299dSbellard
11867d13299dSbellardfi
11877d13299dSbellard
118870be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test
118970be1a2eSPaolo Bonzinicat > $TMPC << EOF
119070be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
119170be1a2eSPaolo BonziniEOF
119270be1a2eSPaolo Bonziniif compile_object; then
1193ea8f20f8SJuan Quintelahostlongbits=64
119470be1a2eSPaolo Bonzinielse
119570be1a2eSPaolo Bonzinihostlongbits=32
119670be1a2eSPaolo Bonzinifi
1197b6853697Sbellard
1198b0a47e79SJuan Quintela
1199b0a47e79SJuan Quintela##########################################
1200b0a47e79SJuan Quintela# NPTL probe
1201b0a47e79SJuan Quintela
1202b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1203bd0c5661Spbrook  cat > $TMPC <<EOF
1204bd0c5661Spbrook#include <sched.h>
120530813ceaSpbrook#include <linux/futex.h>
1206bd0c5661Spbrookvoid foo()
1207bd0c5661Spbrook{
1208bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1209bd0c5661Spbrook#error bork
1210bd0c5661Spbrook#endif
1211bd0c5661Spbrook}
1212bd0c5661SpbrookEOF
1213bd0c5661Spbrook
121452166aa0SJuan Quintela  if compile_object ; then
1215b0a47e79SJuan Quintela    nptl=yes
1216bd0c5661Spbrook  else
1217b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1218b0a47e79SJuan Quintela      feature_not_found "nptl"
1219b0a47e79SJuan Quintela    fi
1220b0a47e79SJuan Quintela    nptl=no
1221b0a47e79SJuan Quintela  fi
1222bd0c5661Spbrookfi
1223bd0c5661Spbrook
122411d9f695Sbellard##########################################
1225ac62922eSbalrog# zlib check
1226ac62922eSbalrog
12271ece9905SAlon Levyif test "$zlib" != "no" ; then
1228ac62922eSbalrog    cat > $TMPC << EOF
1229ac62922eSbalrog#include <zlib.h>
1230ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1231ac62922eSbalrogEOF
123252166aa0SJuan Quintela    if compile_prog "" "-lz" ; then
1233ac62922eSbalrog        :
1234ac62922eSbalrog    else
1235ac62922eSbalrog        echo
1236ac62922eSbalrog        echo "Error: zlib check failed"
1237ac62922eSbalrog        echo "Make sure to have the zlib libs and headers installed."
1238ac62922eSbalrog        echo
1239ac62922eSbalrog        exit 1
1240ac62922eSbalrog    fi
12411ece9905SAlon Levyfi
1242ac62922eSbalrog
1243ac62922eSbalrog##########################################
1244e37630caSaliguori# xen probe
1245e37630caSaliguori
1246fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1247b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1248d5b93ddfSAnthony PERARD
1249d5b93ddfSAnthony PERARD  # Xen unstable
1250e37630caSaliguori  cat > $TMPC <<EOF
1251e37630caSaliguori#include <xenctrl.h>
1252e37630caSaliguori#include <xs.h>
1253d5b93ddfSAnthony PERARD#include <stdint.h>
1254d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1255d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1256d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1257d5b93ddfSAnthony PERARD#endif
1258d5b93ddfSAnthony PERARDint main(void) {
1259d5b93ddfSAnthony PERARD  xc_interface *xc;
1260d5b93ddfSAnthony PERARD  xs_daemon_open();
1261d5b93ddfSAnthony PERARD  xc = xc_interface_open(0, 0, 0);
1262d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1263d5b93ddfSAnthony PERARD  xc_gnttab_open(NULL, 0);
1264b87de24eSAnthony PERARD  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
1265d5b93ddfSAnthony PERARD  return 0;
1266d5b93ddfSAnthony PERARD}
1267e37630caSaliguoriEOF
126852166aa0SJuan Quintela  if compile_prog "" "$xen_libs" ; then
1269d5b93ddfSAnthony PERARD    xen_ctrl_version=410
1270fc321b4bSJuan Quintela    xen=yes
1271d5b93ddfSAnthony PERARD
1272d5b93ddfSAnthony PERARD  # Xen 4.0.0
1273d5b93ddfSAnthony PERARD  elif (
1274d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1275d5b93ddfSAnthony PERARD#include <xenctrl.h>
1276d5b93ddfSAnthony PERARD#include <xs.h>
1277d5b93ddfSAnthony PERARD#include <stdint.h>
1278d5b93ddfSAnthony PERARD#include <xen/hvm/hvm_info_table.h>
1279d5b93ddfSAnthony PERARD#if !defined(HVM_MAX_VCPUS)
1280d5b93ddfSAnthony PERARD# error HVM_MAX_VCPUS not defined
1281d5b93ddfSAnthony PERARD#endif
1282d5b93ddfSAnthony PERARDint main(void) {
1283b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1284b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1285b87de24eSAnthony PERARD  };
1286d5b93ddfSAnthony PERARD  xs_daemon_open();
1287d5b93ddfSAnthony PERARD  xc_interface_open();
1288d5b93ddfSAnthony PERARD  xc_gnttab_open();
1289d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1290b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1291d5b93ddfSAnthony PERARD  return 0;
1292d5b93ddfSAnthony PERARD}
1293d5b93ddfSAnthony PERARDEOF
1294d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1295d5b93ddfSAnthony PERARD    ) ; then
1296d5b93ddfSAnthony PERARD    xen_ctrl_version=400
1297d5b93ddfSAnthony PERARD    xen=yes
1298d5b93ddfSAnthony PERARD
1299b87de24eSAnthony PERARD  # Xen 3.4.0
1300b87de24eSAnthony PERARD  elif (
1301b87de24eSAnthony PERARD      cat > $TMPC <<EOF
1302b87de24eSAnthony PERARD#include <xenctrl.h>
1303b87de24eSAnthony PERARD#include <xs.h>
1304b87de24eSAnthony PERARDint main(void) {
1305b87de24eSAnthony PERARD  struct xen_add_to_physmap xatp = {
1306b87de24eSAnthony PERARD    .domid = 0, .space = XENMAPSPACE_gmfn, .idx = 0, .gpfn = 0,
1307b87de24eSAnthony PERARD  };
1308b87de24eSAnthony PERARD  xs_daemon_open();
1309b87de24eSAnthony PERARD  xc_interface_open();
1310b87de24eSAnthony PERARD  xc_gnttab_open();
1311b87de24eSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1312b87de24eSAnthony PERARD  xc_memory_op(0, XENMEM_add_to_physmap, &xatp);
1313b87de24eSAnthony PERARD  return 0;
1314b87de24eSAnthony PERARD}
1315b87de24eSAnthony PERARDEOF
1316b87de24eSAnthony PERARD      compile_prog "" "$xen_libs"
1317b87de24eSAnthony PERARD    ) ; then
1318b87de24eSAnthony PERARD    xen_ctrl_version=340
1319b87de24eSAnthony PERARD    xen=yes
1320b87de24eSAnthony PERARD
1321b87de24eSAnthony PERARD  # Xen 3.3.0
1322d5b93ddfSAnthony PERARD  elif (
1323d5b93ddfSAnthony PERARD      cat > $TMPC <<EOF
1324d5b93ddfSAnthony PERARD#include <xenctrl.h>
1325d5b93ddfSAnthony PERARD#include <xs.h>
1326d5b93ddfSAnthony PERARDint main(void) {
1327d5b93ddfSAnthony PERARD  xs_daemon_open();
1328d5b93ddfSAnthony PERARD  xc_interface_open();
1329d5b93ddfSAnthony PERARD  xc_gnttab_open();
1330d5b93ddfSAnthony PERARD  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
1331d5b93ddfSAnthony PERARD  return 0;
1332d5b93ddfSAnthony PERARD}
1333d5b93ddfSAnthony PERARDEOF
1334d5b93ddfSAnthony PERARD      compile_prog "" "$xen_libs"
1335d5b93ddfSAnthony PERARD    ) ; then
1336d5b93ddfSAnthony PERARD    xen_ctrl_version=330
1337d5b93ddfSAnthony PERARD    xen=yes
1338d5b93ddfSAnthony PERARD
1339d5b93ddfSAnthony PERARD  # Xen not found or unsupported
1340e37630caSaliguori  else
1341fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
1342fc321b4bSJuan Quintela      feature_not_found "xen"
1343fc321b4bSJuan Quintela    fi
1344fc321b4bSJuan Quintela    xen=no
1345e37630caSaliguori  fi
1346d5b93ddfSAnthony PERARD
1347d5b93ddfSAnthony PERARD  if test "$xen" = yes; then
1348d5b93ddfSAnthony PERARD    libs_softmmu="$xen_libs $libs_softmmu"
1349d5b93ddfSAnthony PERARD  fi
1350e37630caSaliguorifi
1351e37630caSaliguori
1352e37630caSaliguori##########################################
1353a8bd70adSPaolo Bonzini# pkg-config probe
1354f91672e5SPaolo Bonzini
1355a8bd70adSPaolo Bonziniif ! has $pkg_config; then
1356a213fcb2SPeter Maydell  echo "Error: pkg-config binary '$pkg_config' not found"
1357a213fcb2SPeter Maydell  exit 1
1358f91672e5SPaolo Bonzinifi
1359f91672e5SPaolo Bonzini
1360f91672e5SPaolo Bonzini##########################################
136144dc0ca3SAlon Levy# libtool probe
136244dc0ca3SAlon Levy
13633f534581SBradif ! has $libtool; then
136444dc0ca3SAlon Levy    libtool=
136544dc0ca3SAlon Levyfi
136644dc0ca3SAlon Levy
136744dc0ca3SAlon Levy##########################################
1368dfffc653SJuan Quintela# Sparse probe
1369dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
13700dba6195SLoïc Minier  if has cgcc; then
1371dfffc653SJuan Quintela    sparse=yes
1372dfffc653SJuan Quintela  else
1373dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1374dfffc653SJuan Quintela      feature_not_found "sparse"
1375dfffc653SJuan Quintela    fi
1376dfffc653SJuan Quintela    sparse=no
1377dfffc653SJuan Quintela  fi
1378dfffc653SJuan Quintelafi
1379dfffc653SJuan Quintela
1380dfffc653SJuan Quintela##########################################
138111d9f695Sbellard# SDL probe
138211d9f695Sbellard
13833ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
13843ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
13853ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
13863ec87ffeSPaolo Bonzini  sdl_config=sdl-config
13873ec87ffeSPaolo Bonzinifi
13883ec87ffeSPaolo Bonzini
13893ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1390a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1391fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
13923ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
13933ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
13949316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1395a0dfd8a4SLoïc Minierelse
1396a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1397a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1398a0dfd8a4SLoïc Minier  fi
1399a0dfd8a4SLoïc Minier  sdl=no
14009316f803SPaolo Bonzinifi
140129e5badaSScott Woodif test -n "$cross_prefix" && test "$(basename "$sdlconfig")" = sdl-config; then
14023ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
14033ec87ffeSPaolo Bonzinifi
140411d9f695Sbellard
14059316f803SPaolo Bonzinisdl_too_old=no
1406c4198157SJuan Quintelaif test "$sdl" != "no" ; then
140711d9f695Sbellard  cat > $TMPC << EOF
140811d9f695Sbellard#include <SDL.h>
140911d9f695Sbellard#undef main /* We don't want SDL to override our main() */
141011d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
141111d9f695SbellardEOF
14129316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
141374f42e18STeLeMan  if test "$static" = "yes" ; then
141474f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
141574f42e18STeLeMan  else
14169316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
141774f42e18STeLeMan  fi
141852166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
141911d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
142011d9f695Sbellard      sdl_too_old=yes
142111d9f695Sbellard    else
1422fd677642Sths      if test "$cocoa" = "no" ; then
142311d9f695Sbellard        sdl=yes
142411d9f695Sbellard      fi
1425fd677642Sths    fi
14267c1f25b4Sbellard
142767c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
14281ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
142967c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1430f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1431f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
143211d9f695Sbellard      fi
143352166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
14341ac88f28SJuan Quintela	:
14351ac88f28SJuan Quintela      else
14361ac88f28SJuan Quintela        sdl=no
14377c1f25b4Sbellard      fi
14387c1f25b4Sbellard    fi # static link
1439c4198157SJuan Quintela  else # sdl not found
1440c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1441c4198157SJuan Quintela      feature_not_found "sdl"
1442c4198157SJuan Quintela    fi
1443c4198157SJuan Quintela    sdl=no
14447c1f25b4Sbellard  fi # sdl compile test
1445fd677642Sthsfi
144611d9f695Sbellard
14475368a422Saliguoriif test "$sdl" = "yes" ; then
14485368a422Saliguori  cat > $TMPC <<EOF
14495368a422Saliguori#include <SDL.h>
14505368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
14515368a422Saliguori#include <X11/XKBlib.h>
14525368a422Saliguori#else
14535368a422Saliguori#error No x11 support
14545368a422Saliguori#endif
14555368a422Saliguoriint main(void) { return 0; }
14565368a422SaliguoriEOF
145752166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1458681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
14595368a422Saliguori  fi
146007d9ac44SJuan Quintela  if test "$mingw32" = "yes" ; then
146107d9ac44SJuan Quintela    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
146207d9ac44SJuan Quintela  fi
14630705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
14645368a422Saliguorifi
14655368a422Saliguori
14668f28f3fbSths##########################################
14678d5d2d4cSths# VNC TLS detection
1468821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1469ae6b5e5aSaliguori  cat > $TMPC <<EOF
1470ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1471ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1472ae6b5e5aSaliguoriEOF
1473a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1474a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
147552166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
14761be10ad2SJuan Quintela    vnc_tls=yes
1477a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1478ae6b5e5aSaliguori  else
14791be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
14801be10ad2SJuan Quintela      feature_not_found "vnc-tls"
14811be10ad2SJuan Quintela    fi
14821be10ad2SJuan Quintela    vnc_tls=no
14838d5d2d4cSths  fi
14848d5d2d4cSthsfi
14858d5d2d4cSths
14868d5d2d4cSths##########################################
14872f9606b3Saliguori# VNC SASL detection
1488821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
14892f9606b3Saliguori  cat > $TMPC <<EOF
14902f9606b3Saliguori#include <sasl/sasl.h>
14912f9606b3Saliguori#include <stdio.h>
14922f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
14932f9606b3SaliguoriEOF
14942f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
14952f9606b3Saliguori  vnc_sasl_cflags=""
14962f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
149752166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1498ea784e3bSJuan Quintela    vnc_sasl=yes
1499fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
15002f9606b3Saliguori  else
1501ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1502ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1503ea784e3bSJuan Quintela    fi
1504ea784e3bSJuan Quintela    vnc_sasl=no
15052f9606b3Saliguori  fi
15062f9606b3Saliguorifi
15072f9606b3Saliguori
15082f9606b3Saliguori##########################################
15092f6f5c7aSCorentin Chary# VNC JPEG detection
1510821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
15112f6f5c7aSCorentin Charycat > $TMPC <<EOF
15122f6f5c7aSCorentin Chary#include <stdio.h>
15132f6f5c7aSCorentin Chary#include <jpeglib.h>
15142f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
15152f6f5c7aSCorentin CharyEOF
15162f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
15172f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
15182f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
15192f6f5c7aSCorentin Chary    vnc_jpeg=yes
15202f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
15212f6f5c7aSCorentin Chary  else
15222f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
15232f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
15242f6f5c7aSCorentin Chary    fi
15252f6f5c7aSCorentin Chary    vnc_jpeg=no
15262f6f5c7aSCorentin Chary  fi
15272f6f5c7aSCorentin Charyfi
15282f6f5c7aSCorentin Chary
15292f6f5c7aSCorentin Chary##########################################
1530efe556adSCorentin Chary# VNC PNG detection
1531821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1532efe556adSCorentin Charycat > $TMPC <<EOF
1533efe556adSCorentin Chary//#include <stdio.h>
1534efe556adSCorentin Chary#include <png.h>
1535832ce9c2SScott Wood#include <stddef.h>
1536efe556adSCorentin Charyint main(void) {
1537efe556adSCorentin Chary    png_structp png_ptr;
1538efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1539efe556adSCorentin Chary    return 0;
1540efe556adSCorentin Chary}
1541efe556adSCorentin CharyEOF
15429af8025eSBrad  if $pkg_config libpng --modversion >/dev/null 2>&1; then
15439af8025eSBrad    vnc_png_cflags=`$pkg_config libpng --cflags 2> /dev/null`
15449af8025eSBrad    vnc_png_libs=`$pkg_config libpng --libs 2> /dev/null`
15459af8025eSBrad  else
1546efe556adSCorentin Chary    vnc_png_cflags=""
1547efe556adSCorentin Chary    vnc_png_libs="-lpng"
15489af8025eSBrad  fi
1549efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1550efe556adSCorentin Chary    vnc_png=yes
1551efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
15529af8025eSBrad    QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
1553efe556adSCorentin Chary  else
1554efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1555efe556adSCorentin Chary      feature_not_found "vnc-png"
1556efe556adSCorentin Chary    fi
1557efe556adSCorentin Chary    vnc_png=no
1558efe556adSCorentin Chary  fi
1559efe556adSCorentin Charyfi
1560efe556adSCorentin Chary
1561efe556adSCorentin Chary##########################################
156276655d6dSaliguori# fnmatch() probe, used for ACL routines
156376655d6dSaliguorifnmatch="no"
156476655d6dSaliguoricat > $TMPC << EOF
156576655d6dSaliguori#include <fnmatch.h>
156676655d6dSaliguoriint main(void)
156776655d6dSaliguori{
156876655d6dSaliguori    fnmatch("foo", "foo", 0);
156976655d6dSaliguori    return 0;
157076655d6dSaliguori}
157176655d6dSaliguoriEOF
157252166aa0SJuan Quintelaif compile_prog "" "" ; then
157376655d6dSaliguori   fnmatch="yes"
157476655d6dSaliguorifi
157576655d6dSaliguori
157676655d6dSaliguori##########################################
1577ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1578ee682d27SStefan Weilif test "$uuid" != "no" ; then
1579ee682d27SStefan Weil  uuid_libs="-luuid"
1580ee682d27SStefan Weil  cat > $TMPC << EOF
1581ee682d27SStefan Weil#include <uuid/uuid.h>
1582ee682d27SStefan Weilint main(void)
1583ee682d27SStefan Weil{
1584ee682d27SStefan Weil    uuid_t my_uuid;
1585ee682d27SStefan Weil    uuid_generate(my_uuid);
1586ee682d27SStefan Weil    return 0;
1587ee682d27SStefan Weil}
1588ee682d27SStefan WeilEOF
1589ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1590ee682d27SStefan Weil    uuid="yes"
1591ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1592ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1593ee682d27SStefan Weil  else
1594ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1595ee682d27SStefan Weil      feature_not_found "uuid"
1596ee682d27SStefan Weil    fi
1597ee682d27SStefan Weil    uuid=no
1598ee682d27SStefan Weil  fi
1599ee682d27SStefan Weilfi
1600ee682d27SStefan Weil
1601ee682d27SStefan Weil##########################################
1602dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1603dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1604dce512deSChristoph Hellwig  cat > $TMPC << EOF
1605dce512deSChristoph Hellwig#include <xfs/xfs.h>
1606dce512deSChristoph Hellwigint main(void)
1607dce512deSChristoph Hellwig{
1608dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1609dce512deSChristoph Hellwig    return 0;
1610dce512deSChristoph Hellwig}
1611dce512deSChristoph HellwigEOF
1612dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1613dce512deSChristoph Hellwig    xfs="yes"
1614dce512deSChristoph Hellwig  else
1615dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1616dce512deSChristoph Hellwig      feature_not_found "xfs"
1617dce512deSChristoph Hellwig    fi
1618dce512deSChristoph Hellwig    xfs=no
1619dce512deSChristoph Hellwig  fi
1620dce512deSChristoph Hellwigfi
1621dce512deSChristoph Hellwig
1622dce512deSChristoph Hellwig##########################################
16238a16d273Sths# vde libraries probe
1624dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
16254baae0acSJuan Quintela  vde_libs="-lvdeplug"
16268a16d273Sths  cat > $TMPC << EOF
16278a16d273Sths#include <libvdeplug.h>
16284a7f0e06Spbrookint main(void)
16294a7f0e06Spbrook{
16304a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
16314a7f0e06Spbrook    vde_open("", "", &a);
16324a7f0e06Spbrook    return 0;
16334a7f0e06Spbrook}
16348a16d273SthsEOF
163552166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
16364baae0acSJuan Quintela    vde=yes
16378e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
16388e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1639dfb278bdSJuan Quintela  else
1640dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1641dfb278bdSJuan Quintela      feature_not_found "vde"
1642dfb278bdSJuan Quintela    fi
1643dfb278bdSJuan Quintela    vde=no
16448a16d273Sths  fi
16458a16d273Sthsfi
16468a16d273Sths
16478a16d273Sths##########################################
1648c2de5c91Smalc# Sound support libraries probe
16498f28f3fbSths
1650c2de5c91Smalcaudio_drv_probe()
1651c2de5c91Smalc{
1652c2de5c91Smalc    drv=$1
1653c2de5c91Smalc    hdr=$2
1654c2de5c91Smalc    lib=$3
1655c2de5c91Smalc    exp=$4
1656c2de5c91Smalc    cfl=$5
16578f28f3fbSths        cat > $TMPC << EOF
1658c2de5c91Smalc#include <$hdr>
1659c2de5c91Smalcint main(void) { $exp }
16608f28f3fbSthsEOF
166152166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
16628f28f3fbSths        :
16638f28f3fbSths    else
16648f28f3fbSths        echo
1665c2de5c91Smalc        echo "Error: $drv check failed"
1666c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
16678f28f3fbSths        echo
16688f28f3fbSths        exit 1
16698f28f3fbSths    fi
1670c2de5c91Smalc}
1671c2de5c91Smalc
16722fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1673c2de5c91Smalcfor drv in $audio_drv_list; do
1674c2de5c91Smalc    case $drv in
1675c2de5c91Smalc    alsa)
1676c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1677c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1678a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1679c2de5c91Smalc    ;;
1680c2de5c91Smalc
1681c2de5c91Smalc    fmod)
1682c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1683c2de5c91Smalc        echo
1684c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1685c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1686c2de5c91Smalc        echo
1687c2de5c91Smalc        exit 1
16888f28f3fbSths    fi
1689c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1690a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1691c2de5c91Smalc    ;;
1692c2de5c91Smalc
1693c2de5c91Smalc    esd)
1694c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1695a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
169667f86e8eSJuan Quintela    audio_pt_int="yes"
1697c2de5c91Smalc    ;;
1698b8e59f18Smalc
1699b8e59f18Smalc    pa)
1700493abda6SAurelien Jarno    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
170120fa53ecSMarc-Antoine Perennou        "pa_simple *s = 0; pa_simple_free(s); return 0;"
1702493abda6SAurelien Jarno    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
170367f86e8eSJuan Quintela    audio_pt_int="yes"
1704b8e59f18Smalc    ;;
1705b8e59f18Smalc
1706997e690aSJuan Quintela    coreaudio)
1707997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1708997e690aSJuan Quintela    ;;
1709997e690aSJuan Quintela
1710a4bf6780SJuan Quintela    dsound)
1711a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1712d5631638Smalc      audio_win_int="yes"
1713a4bf6780SJuan Quintela    ;;
1714a4bf6780SJuan Quintela
1715a4bf6780SJuan Quintela    oss)
1716a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1717a4bf6780SJuan Quintela    ;;
1718a4bf6780SJuan Quintela
1719a4bf6780SJuan Quintela    sdl|wav)
17202f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
17212f6a1ab0Sblueswir1    ;;
17222f6a1ab0Sblueswir1
1723d5631638Smalc    winwave)
1724d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1725d5631638Smalc      audio_win_int="yes"
1726d5631638Smalc    ;;
1727d5631638Smalc
1728e4c63a6aSmalc    *)
17291c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1730e4c63a6aSmalc        echo
1731e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1732e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1733e4c63a6aSmalc        echo
1734e4c63a6aSmalc        exit 1
1735e4c63a6aSmalc    }
1736e4c63a6aSmalc    ;;
1737c2de5c91Smalc    esac
1738c2de5c91Smalcdone
17398f28f3fbSths
17404d3b6f6eSbalrog##########################################
17412e4d9fb1Saurel32# BrlAPI probe
17422e4d9fb1Saurel32
17434ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1744eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
17452e4d9fb1Saurel32  cat > $TMPC << EOF
17462e4d9fb1Saurel32#include <brlapi.h>
1747832ce9c2SScott Wood#include <stddef.h>
17482e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
17492e4d9fb1Saurel32EOF
175052166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
17512e4d9fb1Saurel32    brlapi=yes
1752264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
17534ffcedb6SJuan Quintela  else
17544ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
17554ffcedb6SJuan Quintela      feature_not_found "brlapi"
17564ffcedb6SJuan Quintela    fi
17574ffcedb6SJuan Quintela    brlapi=no
1758eb82284fSJuan Quintela  fi
1759eb82284fSJuan Quintelafi
17602e4d9fb1Saurel32
17612e4d9fb1Saurel32##########################################
17624d3b6f6eSbalrog# curses probe
1763e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
1764e095e2f3SStefan Weil    curses_list="-lpdcurses"
1765e095e2f3SStefan Weilelse
17664f78ef9aSJuan Quintela    curses_list="-lncurses -lcurses"
1767e095e2f3SStefan Weilfi
17684d3b6f6eSbalrog
1769c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1770c584a6d0SJuan Quintela  curses_found=no
17714d3b6f6eSbalrog  cat > $TMPC << EOF
17724d3b6f6eSbalrog#include <curses.h>
17735a8ff3aaSblueswir1#ifdef __OpenBSD__
17745a8ff3aaSblueswir1#define resize_term resizeterm
17755a8ff3aaSblueswir1#endif
17765a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); }
17774d3b6f6eSbalrogEOF
17784f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
17794f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1780c584a6d0SJuan Quintela      curses_found=yes
17814f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
17824f78ef9aSJuan Quintela      break
17834d3b6f6eSbalrog    fi
17844f78ef9aSJuan Quintela  done
1785c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1786c584a6d0SJuan Quintela    curses=yes
1787c584a6d0SJuan Quintela  else
1788c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1789c584a6d0SJuan Quintela      feature_not_found "curses"
1790c584a6d0SJuan Quintela    fi
1791c584a6d0SJuan Quintela    curses=no
1792c584a6d0SJuan Quintela  fi
17934f78ef9aSJuan Quintelafi
17944d3b6f6eSbalrog
1795414f0dabSblueswir1##########################################
1796769ce76dSAlexander Graf# curl probe
1797769ce76dSAlexander Graf
1798a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
1799a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
18004e2b0658SPaolo Bonzinielse
18014e2b0658SPaolo Bonzini  curlconfig=curl-config
18024e2b0658SPaolo Bonzinifi
18034e2b0658SPaolo Bonzini
1804788c8196SJuan Quintelaif test "$curl" != "no" ; then
1805769ce76dSAlexander Graf  cat > $TMPC << EOF
1806769ce76dSAlexander Graf#include <curl/curl.h>
18070b862cedSPeter Maydellint main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
1808769ce76dSAlexander GrafEOF
18094e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
18104e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
1811b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
1812769ce76dSAlexander Graf    curl=yes
1813f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
1814f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
1815788c8196SJuan Quintela  else
1816788c8196SJuan Quintela    if test "$curl" = "yes" ; then
1817788c8196SJuan Quintela      feature_not_found "curl"
1818788c8196SJuan Quintela    fi
1819788c8196SJuan Quintela    curl=no
1820769ce76dSAlexander Graf  fi
1821769ce76dSAlexander Graffi # test "$curl"
1822769ce76dSAlexander Graf
1823769ce76dSAlexander Graf##########################################
18245495ed11SLuiz Capitulino# check framework probe
18255495ed11SLuiz Capitulino
18265495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then
18275495ed11SLuiz Capitulino  cat > $TMPC << EOF
18285495ed11SLuiz Capitulino#include <check.h>
18295495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; }
18305495ed11SLuiz CapitulinoEOF
1831a8bd70adSPaolo Bonzini  check_libs=`$pkg_config --libs check`
18325495ed11SLuiz Capitulino  if compile_prog "" $check_libs ; then
18335495ed11SLuiz Capitulino    check_utests=yes
18345495ed11SLuiz Capitulino    libs_tools="$check_libs $libs_tools"
18355495ed11SLuiz Capitulino  else
18365495ed11SLuiz Capitulino    if test "$check_utests" = "yes" ; then
18375495ed11SLuiz Capitulino      feature_not_found "check"
18385495ed11SLuiz Capitulino    fi
18395495ed11SLuiz Capitulino    check_utests=no
18405495ed11SLuiz Capitulino  fi
18415495ed11SLuiz Capitulinofi # test "$check_utests"
18425495ed11SLuiz Capitulino
18435495ed11SLuiz Capitulino##########################################
1844fb599c9aSbalrog# bluez support probe
1845a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
1846e820e3f4Sbalrog  cat > $TMPC << EOF
1847e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
1848e820e3f4Sbalrogint main(void) { return bt_error(0); }
1849e820e3f4SbalrogEOF
1850a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1851a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
185252166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1853a20a6f46SJuan Quintela    bluez=yes
1854e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
1855e820e3f4Sbalrog  else
1856a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
1857a20a6f46SJuan Quintela      feature_not_found "bluez"
1858a20a6f46SJuan Quintela    fi
1859e820e3f4Sbalrog    bluez="no"
1860e820e3f4Sbalrog  fi
1861fb599c9aSbalrogfi
1862fb599c9aSbalrog
1863fb599c9aSbalrog##########################################
1864e18df141SAnthony Liguori# glib support probe
18654b76a481SStefan Hajnocziif $pkg_config --modversion gthread-2.0 > /dev/null 2>&1 ; then
18664b76a481SStefan Hajnoczi    glib_cflags=`$pkg_config --cflags gthread-2.0 2>/dev/null`
18674b76a481SStefan Hajnoczi    glib_libs=`$pkg_config --libs gthread-2.0 2>/dev/null`
186814015304SAnthony Liguori    LIBS="$glib_libs $LIBS"
1869957f1f99SMichael Roth    libs_qga="$glib_libs $libs_qga"
1870e18df141SAnthony Liguorielse
1871e18df141SAnthony Liguori    echo "glib-2.0 required to compile QEMU"
1872e18df141SAnthony Liguori    exit 1
1873e18df141SAnthony Liguorifi
1874e18df141SAnthony Liguori
1875e18df141SAnthony Liguori##########################################
1876e5d355d1Saliguori# pthread probe
18774b29ec41SBradPTHREADLIBS_LIST="-pthread -lpthread -lpthreadGC2"
18783c529d93Saliguori
1879e5d355d1Saliguoripthread=no
1880414f0dabSblueswir1cat > $TMPC << EOF
18813c529d93Saliguori#include <pthread.h>
1882de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; }
1883414f0dabSblueswir1EOF
1884bd00d539SAndreas Färberif compile_prog "" "" ; then
1885bd00d539SAndreas Färber  pthread=yes
1886bd00d539SAndreas Färberelse
1887de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
188852166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
1889e5d355d1Saliguori      pthread=yes
18905572b539SJuan Quintela      LIBS="$pthread_lib $LIBS"
1891de65fe0fSSebastian Herbszt      break
1892414f0dabSblueswir1    fi
1893de65fe0fSSebastian Herbszt  done
1894bd00d539SAndreas Färberfi
1895414f0dabSblueswir1
18964617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
18974dd75c70SChristoph Hellwig  echo
18984dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
18994dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
19004dd75c70SChristoph Hellwig  echo
19014dd75c70SChristoph Hellwig  exit 1
1902e5d355d1Saliguorifi
1903e5d355d1Saliguori
1904bf9298b9Saliguori##########################################
1905f27aaf4bSChristian Brunner# rbd probe
1906f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
1907f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
1908f27aaf4bSChristian Brunner#include <stdio.h>
1909ad32e9c0SJosh Durgin#include <rbd/librbd.h>
1910f27aaf4bSChristian Brunnerint main(void) {
1911ad32e9c0SJosh Durgin    rados_t cluster;
1912ad32e9c0SJosh Durgin    rados_create(&cluster, NULL);
1913f27aaf4bSChristian Brunner    return 0;
1914f27aaf4bSChristian Brunner}
1915f27aaf4bSChristian BrunnerEOF
1916ad32e9c0SJosh Durgin  rbd_libs="-lrbd -lrados"
1917f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
1918f27aaf4bSChristian Brunner    rbd=yes
1919f27aaf4bSChristian Brunner    libs_tools="$rbd_libs $libs_tools"
1920f27aaf4bSChristian Brunner    libs_softmmu="$rbd_libs $libs_softmmu"
1921f27aaf4bSChristian Brunner  else
1922f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
1923f27aaf4bSChristian Brunner      feature_not_found "rados block device"
1924f27aaf4bSChristian Brunner    fi
1925f27aaf4bSChristian Brunner    rbd=no
1926f27aaf4bSChristian Brunner  fi
1927f27aaf4bSChristian Brunnerfi
1928f27aaf4bSChristian Brunner
1929f27aaf4bSChristian Brunner##########################################
19305c6c3a6cSChristoph Hellwig# linux-aio probe
19315c6c3a6cSChristoph Hellwig
19325c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
19335c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
19345c6c3a6cSChristoph Hellwig#include <libaio.h>
19355c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
1936832ce9c2SScott Wood#include <stddef.h>
19375c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
19385c6c3a6cSChristoph HellwigEOF
19395c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
19405c6c3a6cSChristoph Hellwig    linux_aio=yes
1941048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
1942048d179fSPaul Brook    libs_tools="$libs_tools -laio"
19435c6c3a6cSChristoph Hellwig  else
19445c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
19455c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
19465c6c3a6cSChristoph Hellwig    fi
19473cfcae3cSLuiz Capitulino    linux_aio=no
19485c6c3a6cSChristoph Hellwig  fi
19495c6c3a6cSChristoph Hellwigfi
19505c6c3a6cSChristoph Hellwig
19515c6c3a6cSChristoph Hellwig##########################################
1952758e8e38SVenkateswararao Jujjuri (JV)# attr probe
1953758e8e38SVenkateswararao Jujjuri (JV)
1954758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
1955758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
1956758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
1957758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
1958758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h>
1959758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1960758e8e38SVenkateswararao Jujjuri (JV)EOF
1961758e8e38SVenkateswararao Jujjuri (JV)  if compile_prog "" "-lattr" ; then
1962758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
1963758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
1964758e8e38SVenkateswararao Jujjuri (JV)  else
1965758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
1966758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
1967758e8e38SVenkateswararao Jujjuri (JV)    fi
1968758e8e38SVenkateswararao Jujjuri (JV)    attr=no
1969758e8e38SVenkateswararao Jujjuri (JV)  fi
1970758e8e38SVenkateswararao Jujjuri (JV)fi
1971758e8e38SVenkateswararao Jujjuri (JV)
1972758e8e38SVenkateswararao Jujjuri (JV)##########################################
1973bf9298b9Saliguori# iovec probe
1974bf9298b9Saliguoricat > $TMPC <<EOF
1975db34f0b3Sblueswir1#include <sys/types.h>
1976bf9298b9Saliguori#include <sys/uio.h>
1977db34f0b3Sblueswir1#include <unistd.h>
1978bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; }
1979bf9298b9SaliguoriEOF
1980bf9298b9Saliguoriiovec=no
198152166aa0SJuan Quintelaif compile_prog "" "" ; then
1982bf9298b9Saliguori  iovec=yes
1983bf9298b9Saliguorifi
1984bf9298b9Saliguori
1985f652e6afSaurel32##########################################
1986ceb42de8Saliguori# preadv probe
1987ceb42de8Saliguoricat > $TMPC <<EOF
1988ceb42de8Saliguori#include <sys/types.h>
1989ceb42de8Saliguori#include <sys/uio.h>
1990ceb42de8Saliguori#include <unistd.h>
1991ceb42de8Saliguoriint main(void) { preadv; }
1992ceb42de8SaliguoriEOF
1993ceb42de8Saliguoripreadv=no
199452166aa0SJuan Quintelaif compile_prog "" "" ; then
1995ceb42de8Saliguori  preadv=yes
1996ceb42de8Saliguorifi
1997ceb42de8Saliguori
1998ceb42de8Saliguori##########################################
1999f652e6afSaurel32# fdt probe
20002df87df7SJuan Quintelaif test "$fdt" != "no" ; then
2001b41af4baSJuan Quintela  fdt_libs="-lfdt"
2002f652e6afSaurel32  cat > $TMPC << EOF
2003f652e6afSaurel32int main(void) { return 0; }
2004f652e6afSaurel32EOF
200552166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
2006f652e6afSaurel32    fdt=yes
20072df87df7SJuan Quintela  else
20082df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
20092df87df7SJuan Quintela      feature_not_found "fdt"
20102df87df7SJuan Quintela    fi
2011de3a354aSMichael Walle    fdt_libs=
20122df87df7SJuan Quintela    fdt=no
2013f652e6afSaurel32  fi
2014f652e6afSaurel32fi
2015f652e6afSaurel32
201620ff075bSMichael Walle##########################################
201720ff075bSMichael Walle# opengl probe, used by milkymist-tmu2
201820ff075bSMichael Walleif test "$opengl" != "no" ; then
201920ff075bSMichael Walle  opengl_libs="-lGL"
202020ff075bSMichael Walle  cat > $TMPC << EOF
202120ff075bSMichael Walle#include <X11/Xlib.h>
202220ff075bSMichael Walle#include <GL/gl.h>
202320ff075bSMichael Walle#include <GL/glx.h>
202420ff075bSMichael Walleint main(void) { GL_VERSION; return 0; }
202520ff075bSMichael WalleEOF
202620ff075bSMichael Walle  if compile_prog "" "-lGL" ; then
202720ff075bSMichael Walle    opengl=yes
202820ff075bSMichael Walle  else
202920ff075bSMichael Walle    if test "$opengl" = "yes" ; then
203020ff075bSMichael Walle      feature_not_found "opengl"
203120ff075bSMichael Walle    fi
2032de3a354aSMichael Walle    opengl_libs=
203320ff075bSMichael Walle    opengl=no
203420ff075bSMichael Walle  fi
203520ff075bSMichael Wallefi
203620ff075bSMichael Walle
20373b3f24adSaurel32#
20383b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
20393b3f24adSaurel32# emulator.  This is done because older glibc versions don't
20403b3f24adSaurel32# have syscall stubs for these implemented.
20413b3f24adSaurel32#
20423b3f24adSaurel32atfile=no
20433b3f24adSaurel32cat > $TMPC << EOF
20443b3f24adSaurel32#define _ATFILE_SOURCE
20453b3f24adSaurel32#include <sys/types.h>
20463b3f24adSaurel32#include <fcntl.h>
20473b3f24adSaurel32#include <unistd.h>
20483b3f24adSaurel32
20493b3f24adSaurel32int
20503b3f24adSaurel32main(void)
20513b3f24adSaurel32{
20523b3f24adSaurel32	/* try to unlink nonexisting file */
20533b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
20543b3f24adSaurel32}
20553b3f24adSaurel32EOF
205652166aa0SJuan Quintelaif compile_prog "" "" ; then
20573b3f24adSaurel32  atfile=yes
20583b3f24adSaurel32fi
20593b3f24adSaurel32
206039386ac7Saurel32# Check for inotify functions when we are building linux-user
20613b3f24adSaurel32# emulator.  This is done because older glibc versions don't
20623b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
20633b3f24adSaurel32# don't provide them even if kernel supports them.
20643b3f24adSaurel32#
20653b3f24adSaurel32inotify=no
20663b3f24adSaurel32cat > $TMPC << EOF
20673b3f24adSaurel32#include <sys/inotify.h>
20683b3f24adSaurel32
20693b3f24adSaurel32int
20703b3f24adSaurel32main(void)
20713b3f24adSaurel32{
20723b3f24adSaurel32	/* try to start inotify */
20738690e420Saurel32	return inotify_init();
20743b3f24adSaurel32}
20753b3f24adSaurel32EOF
207652166aa0SJuan Quintelaif compile_prog "" "" ; then
20773b3f24adSaurel32  inotify=yes
20783b3f24adSaurel32fi
20793b3f24adSaurel32
2080c05c7a73SRiku Voipioinotify1=no
2081c05c7a73SRiku Voipiocat > $TMPC << EOF
2082c05c7a73SRiku Voipio#include <sys/inotify.h>
2083c05c7a73SRiku Voipio
2084c05c7a73SRiku Voipioint
2085c05c7a73SRiku Voipiomain(void)
2086c05c7a73SRiku Voipio{
2087c05c7a73SRiku Voipio    /* try to start inotify */
2088c05c7a73SRiku Voipio    return inotify_init1(0);
2089c05c7a73SRiku Voipio}
2090c05c7a73SRiku VoipioEOF
2091c05c7a73SRiku Voipioif compile_prog "" "" ; then
2092c05c7a73SRiku Voipio  inotify1=yes
2093c05c7a73SRiku Voipiofi
2094c05c7a73SRiku Voipio
2095ebc996f3SRiku Voipio# check if utimensat and futimens are supported
2096ebc996f3SRiku Voipioutimens=no
2097ebc996f3SRiku Voipiocat > $TMPC << EOF
2098ebc996f3SRiku Voipio#define _ATFILE_SOURCE
2099ebc996f3SRiku Voipio#include <stddef.h>
2100ebc996f3SRiku Voipio#include <fcntl.h>
2101ebc996f3SRiku Voipio
2102ebc996f3SRiku Voipioint main(void)
2103ebc996f3SRiku Voipio{
2104ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2105ebc996f3SRiku Voipio    futimens(0, NULL);
2106ebc996f3SRiku Voipio    return 0;
2107ebc996f3SRiku Voipio}
2108ebc996f3SRiku VoipioEOF
210952166aa0SJuan Quintelaif compile_prog "" "" ; then
2110ebc996f3SRiku Voipio  utimens=yes
2111ebc996f3SRiku Voipiofi
2112ebc996f3SRiku Voipio
2113099d6b0fSRiku Voipio# check if pipe2 is there
2114099d6b0fSRiku Voipiopipe2=no
2115099d6b0fSRiku Voipiocat > $TMPC << EOF
2116099d6b0fSRiku Voipio#include <unistd.h>
2117099d6b0fSRiku Voipio#include <fcntl.h>
2118099d6b0fSRiku Voipio
2119099d6b0fSRiku Voipioint main(void)
2120099d6b0fSRiku Voipio{
2121099d6b0fSRiku Voipio    int pipefd[2];
2122099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
2123099d6b0fSRiku Voipio    return 0;
2124099d6b0fSRiku Voipio}
2125099d6b0fSRiku VoipioEOF
212652166aa0SJuan Quintelaif compile_prog "" "" ; then
2127099d6b0fSRiku Voipio  pipe2=yes
2128099d6b0fSRiku Voipiofi
2129099d6b0fSRiku Voipio
213040ff6d7eSKevin Wolf# check if accept4 is there
213140ff6d7eSKevin Wolfaccept4=no
213240ff6d7eSKevin Wolfcat > $TMPC << EOF
213340ff6d7eSKevin Wolf#include <sys/socket.h>
213440ff6d7eSKevin Wolf#include <stddef.h>
213540ff6d7eSKevin Wolf
213640ff6d7eSKevin Wolfint main(void)
213740ff6d7eSKevin Wolf{
213840ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
213940ff6d7eSKevin Wolf    return 0;
214040ff6d7eSKevin Wolf}
214140ff6d7eSKevin WolfEOF
214240ff6d7eSKevin Wolfif compile_prog "" "" ; then
214340ff6d7eSKevin Wolf  accept4=yes
214440ff6d7eSKevin Wolffi
214540ff6d7eSKevin Wolf
21463ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
21473ce34dfbSvibisreenivasansplice=no
21483ce34dfbSvibisreenivasancat > $TMPC << EOF
21493ce34dfbSvibisreenivasan#include <unistd.h>
21503ce34dfbSvibisreenivasan#include <fcntl.h>
21513ce34dfbSvibisreenivasan#include <limits.h>
21523ce34dfbSvibisreenivasan
21533ce34dfbSvibisreenivasanint main(void)
21543ce34dfbSvibisreenivasan{
21553ce34dfbSvibisreenivasan    int len, fd;
21563ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
21573ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
21583ce34dfbSvibisreenivasan    return 0;
21593ce34dfbSvibisreenivasan}
21603ce34dfbSvibisreenivasanEOF
216152166aa0SJuan Quintelaif compile_prog "" "" ; then
21623ce34dfbSvibisreenivasan  splice=yes
21633ce34dfbSvibisreenivasanfi
21643ce34dfbSvibisreenivasan
2165dcc38d1cSMarcelo Tosatti##########################################
2166dcc38d1cSMarcelo Tosatti# signalfd probe
2167dcc38d1cSMarcelo Tosattisignalfd="no"
2168dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2169dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE
2170dcc38d1cSMarcelo Tosatti#include <unistd.h>
2171dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2172dcc38d1cSMarcelo Tosatti#include <signal.h>
2173dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2174dcc38d1cSMarcelo TosattiEOF
2175dcc38d1cSMarcelo Tosatti
2176dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2177dcc38d1cSMarcelo Tosatti  signalfd=yes
2178dcc38d1cSMarcelo Tosattifi
2179dcc38d1cSMarcelo Tosatti
2180c2882b96SRiku Voipio# check if eventfd is supported
2181c2882b96SRiku Voipioeventfd=no
2182c2882b96SRiku Voipiocat > $TMPC << EOF
2183c2882b96SRiku Voipio#include <sys/eventfd.h>
2184c2882b96SRiku Voipio
2185c2882b96SRiku Voipioint main(void)
2186c2882b96SRiku Voipio{
2187c2882b96SRiku Voipio    int efd = eventfd(0, 0);
2188c2882b96SRiku Voipio    return 0;
2189c2882b96SRiku Voipio}
2190c2882b96SRiku VoipioEOF
2191c2882b96SRiku Voipioif compile_prog "" "" ; then
2192c2882b96SRiku Voipio  eventfd=yes
2193c2882b96SRiku Voipiofi
2194c2882b96SRiku Voipio
2195d0927938SUlrich Hecht# check for fallocate
2196d0927938SUlrich Hechtfallocate=no
2197d0927938SUlrich Hechtcat > $TMPC << EOF
2198d0927938SUlrich Hecht#include <fcntl.h>
2199d0927938SUlrich Hecht
2200d0927938SUlrich Hechtint main(void)
2201d0927938SUlrich Hecht{
2202d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2203d0927938SUlrich Hecht    return 0;
2204d0927938SUlrich Hecht}
2205d0927938SUlrich HechtEOF
2206be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then
2207d0927938SUlrich Hecht  fallocate=yes
2208d0927938SUlrich Hechtfi
2209d0927938SUlrich Hecht
2210c727f47dSPeter Maydell# check for sync_file_range
2211c727f47dSPeter Maydellsync_file_range=no
2212c727f47dSPeter Maydellcat > $TMPC << EOF
2213c727f47dSPeter Maydell#include <fcntl.h>
2214c727f47dSPeter Maydell
2215c727f47dSPeter Maydellint main(void)
2216c727f47dSPeter Maydell{
2217c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2218c727f47dSPeter Maydell    return 0;
2219c727f47dSPeter Maydell}
2220c727f47dSPeter MaydellEOF
2221c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
2222c727f47dSPeter Maydell  sync_file_range=yes
2223c727f47dSPeter Maydellfi
2224c727f47dSPeter Maydell
2225dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2226dace20dcSPeter Maydellfiemap=no
2227dace20dcSPeter Maydellcat > $TMPC << EOF
2228dace20dcSPeter Maydell#include <sys/ioctl.h>
2229dace20dcSPeter Maydell#include <linux/fs.h>
2230dace20dcSPeter Maydell#include <linux/fiemap.h>
2231dace20dcSPeter Maydell
2232dace20dcSPeter Maydellint main(void)
2233dace20dcSPeter Maydell{
2234dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2235dace20dcSPeter Maydell    return 0;
2236dace20dcSPeter Maydell}
2237dace20dcSPeter MaydellEOF
2238dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
2239dace20dcSPeter Maydell  fiemap=yes
2240dace20dcSPeter Maydellfi
2241dace20dcSPeter Maydell
2242d0927938SUlrich Hecht# check for dup3
2243d0927938SUlrich Hechtdup3=no
2244d0927938SUlrich Hechtcat > $TMPC << EOF
2245d0927938SUlrich Hecht#include <unistd.h>
2246d0927938SUlrich Hecht
2247d0927938SUlrich Hechtint main(void)
2248d0927938SUlrich Hecht{
2249d0927938SUlrich Hecht    dup3(0, 0, 0);
2250d0927938SUlrich Hecht    return 0;
2251d0927938SUlrich Hecht}
2252d0927938SUlrich HechtEOF
225378f5d726SJan Kiszkaif compile_prog "" "" ; then
2254d0927938SUlrich Hecht  dup3=yes
2255d0927938SUlrich Hechtfi
2256d0927938SUlrich Hecht
22573b6edd16SPeter Maydell# check for epoll support
22583b6edd16SPeter Maydellepoll=no
22593b6edd16SPeter Maydellcat > $TMPC << EOF
22603b6edd16SPeter Maydell#include <sys/epoll.h>
22613b6edd16SPeter Maydell
22623b6edd16SPeter Maydellint main(void)
22633b6edd16SPeter Maydell{
22643b6edd16SPeter Maydell    epoll_create(0);
22653b6edd16SPeter Maydell    return 0;
22663b6edd16SPeter Maydell}
22673b6edd16SPeter MaydellEOF
22683b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
22693b6edd16SPeter Maydell  epoll=yes
22703b6edd16SPeter Maydellfi
22713b6edd16SPeter Maydell
22723b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
22733b6edd16SPeter Maydell# so we must check separately for their presence
22743b6edd16SPeter Maydellepoll_create1=no
22753b6edd16SPeter Maydellcat > $TMPC << EOF
22763b6edd16SPeter Maydell#include <sys/epoll.h>
22773b6edd16SPeter Maydell
22783b6edd16SPeter Maydellint main(void)
22793b6edd16SPeter Maydell{
228019e83f6bSPeter Maydell    /* Note that we use epoll_create1 as a value, not as
228119e83f6bSPeter Maydell     * a function being called. This is necessary so that on
228219e83f6bSPeter Maydell     * old SPARC glibc versions where the function was present in
228319e83f6bSPeter Maydell     * the library but not declared in the header file we will
228419e83f6bSPeter Maydell     * fail the configure check. (Otherwise we will get a compiler
228519e83f6bSPeter Maydell     * warning but not an error, and will proceed to fail the
228619e83f6bSPeter Maydell     * qemu compile where we compile with -Werror.)
228719e83f6bSPeter Maydell     */
228819e83f6bSPeter Maydell    epoll_create1;
22893b6edd16SPeter Maydell    return 0;
22903b6edd16SPeter Maydell}
22913b6edd16SPeter MaydellEOF
22923b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
22933b6edd16SPeter Maydell  epoll_create1=yes
22943b6edd16SPeter Maydellfi
22953b6edd16SPeter Maydell
22963b6edd16SPeter Maydellepoll_pwait=no
22973b6edd16SPeter Maydellcat > $TMPC << EOF
22983b6edd16SPeter Maydell#include <sys/epoll.h>
22993b6edd16SPeter Maydell
23003b6edd16SPeter Maydellint main(void)
23013b6edd16SPeter Maydell{
23023b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
23033b6edd16SPeter Maydell    return 0;
23043b6edd16SPeter Maydell}
23053b6edd16SPeter MaydellEOF
23063b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
23073b6edd16SPeter Maydell  epoll_pwait=yes
23083b6edd16SPeter Maydellfi
23093b6edd16SPeter Maydell
2310cc8ae6deSpbrook# Check if tools are available to build documentation.
2311a25dba17SJuan Quintelaif test "$docs" != "no" ; then
231201668d98SStefan Weil  if has makeinfo && has pod2man; then
2313a25dba17SJuan Quintela    docs=yes
231483a3ab8bSJuan Quintela  else
2315a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2316a25dba17SJuan Quintela      feature_not_found "docs"
231783a3ab8bSJuan Quintela    fi
2318a25dba17SJuan Quintela    docs=no
231983a3ab8bSJuan Quintela  fi
2320cc8ae6deSpbrookfi
2321cc8ae6deSpbrook
2322f514f41cSStefan Weil# Search for bswap_32 function
23236ae9a1f4SJuan Quintelabyteswap_h=no
23246ae9a1f4SJuan Quintelacat > $TMPC << EOF
23256ae9a1f4SJuan Quintela#include <byteswap.h>
23266ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
23276ae9a1f4SJuan QuintelaEOF
232852166aa0SJuan Quintelaif compile_prog "" "" ; then
23296ae9a1f4SJuan Quintela  byteswap_h=yes
23306ae9a1f4SJuan Quintelafi
23316ae9a1f4SJuan Quintela
2332f514f41cSStefan Weil# Search for bswap_32 function
23336ae9a1f4SJuan Quintelabswap_h=no
23346ae9a1f4SJuan Quintelacat > $TMPC << EOF
23356ae9a1f4SJuan Quintela#include <sys/endian.h>
23366ae9a1f4SJuan Quintela#include <sys/types.h>
23376ae9a1f4SJuan Quintela#include <machine/bswap.h>
23386ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
23396ae9a1f4SJuan QuintelaEOF
234052166aa0SJuan Quintelaif compile_prog "" "" ; then
23416ae9a1f4SJuan Quintela  bswap_h=yes
23426ae9a1f4SJuan Quintelafi
23436ae9a1f4SJuan Quintela
2344da93a1fdSaliguori##########################################
2345c589b249SRonnie Sahlberg# Do we have libiscsi
2346c589b249SRonnie Sahlbergif test "$libiscsi" != "no" ; then
2347c589b249SRonnie Sahlberg  cat > $TMPC << EOF
2348c589b249SRonnie Sahlberg#include <iscsi/iscsi.h>
2349c589b249SRonnie Sahlbergint main(void) { iscsi_create_context(""); return 0; }
2350c589b249SRonnie SahlbergEOF
2351c589b249SRonnie Sahlberg  if compile_prog "-Werror" "-liscsi" ; then
2352c589b249SRonnie Sahlberg    libiscsi="yes"
2353c589b249SRonnie Sahlberg    LIBS="$LIBS -liscsi"
2354c589b249SRonnie Sahlberg  else
2355c589b249SRonnie Sahlberg    if test "$libiscsi" = "yes" ; then
2356c589b249SRonnie Sahlberg      feature_not_found "libiscsi"
2357c589b249SRonnie Sahlberg    fi
2358c589b249SRonnie Sahlberg    libiscsi="no"
2359c589b249SRonnie Sahlberg  fi
2360c589b249SRonnie Sahlbergfi
2361c589b249SRonnie Sahlberg
2362c589b249SRonnie Sahlberg
2363c589b249SRonnie Sahlberg##########################################
2364da93a1fdSaliguori# Do we need librt
2365da93a1fdSaliguoricat > $TMPC <<EOF
2366da93a1fdSaliguori#include <signal.h>
2367da93a1fdSaliguori#include <time.h>
2368da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); }
2369da93a1fdSaliguoriEOF
2370da93a1fdSaliguori
237152166aa0SJuan Quintelaif compile_prog "" "" ; then
237207ffa4bdSJuan Quintela  :
237352166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
237407ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2375da93a1fdSaliguorifi
2376da93a1fdSaliguori
237731ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2378179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
23796362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
23806362a53fSJuan Quintelafi
23816362a53fSJuan Quintela
2382de5071c5SBlue Swirl##########################################
2383de5071c5SBlue Swirl# check if the compiler defines offsetof
2384de5071c5SBlue Swirl
2385de5071c5SBlue Swirlneed_offsetof=yes
2386de5071c5SBlue Swirlcat > $TMPC << EOF
2387de5071c5SBlue Swirl#include <stddef.h>
2388de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); }
2389de5071c5SBlue SwirlEOF
2390de5071c5SBlue Swirlif compile_prog "" "" ; then
2391de5071c5SBlue Swirl    need_offsetof=no
2392de5071c5SBlue Swirlfi
2393de5071c5SBlue Swirl
2394cd4ec0b4SGerd Hoffmann# spice probe
2395cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2396cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2397cd4ec0b4SGerd Hoffmann#include <spice.h>
2398cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2399cd4ec0b4SGerd HoffmannEOF
2400710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2401710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2402012b80d3SGerd Hoffmann  if $pkg_config --atleast-version=0.6.0 spice-server >/dev/null 2>&1 && \
2403cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2404cd4ec0b4SGerd Hoffmann    spice="yes"
2405cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2406cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2407cd4ec0b4SGerd Hoffmann  else
2408cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2409cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2410cd4ec0b4SGerd Hoffmann    fi
2411cd4ec0b4SGerd Hoffmann    spice="no"
2412cd4ec0b4SGerd Hoffmann  fi
2413cd4ec0b4SGerd Hoffmannfi
2414cd4ec0b4SGerd Hoffmann
2415111a38b0SRobert Relyea# check for libcacard for smartcard support
2416111a38b0SRobert Relyeaif test "$smartcard" != "no" ; then
2417111a38b0SRobert Relyea    smartcard="yes"
2418111a38b0SRobert Relyea    smartcard_cflags=""
2419111a38b0SRobert Relyea    # TODO - what's the minimal nss version we support?
2420111a38b0SRobert Relyea    if test "$smartcard_nss" != "no"; then
2421111a38b0SRobert Relyea        if $pkg_config --atleast-version=3.12.8 nss >/dev/null 2>&1 ; then
2422111a38b0SRobert Relyea            smartcard_nss="yes"
2423111a38b0SRobert Relyea            smartcard_cflags="-I\$(SRC_PATH)/libcacard"
2424111a38b0SRobert Relyea            libcacard_libs=$($pkg_config --libs nss 2>/dev/null)
2425111a38b0SRobert Relyea            libcacard_cflags=$($pkg_config --cflags nss 2>/dev/null)
2426111a38b0SRobert Relyea            QEMU_CFLAGS="$QEMU_CFLAGS $smartcard_cflags $libcacard_cflags"
2427111a38b0SRobert Relyea            LIBS="$libcacard_libs $LIBS"
2428111a38b0SRobert Relyea        else
2429111a38b0SRobert Relyea            if test "$smartcard_nss" = "yes"; then
2430111a38b0SRobert Relyea                feature_not_found "nss"
2431111a38b0SRobert Relyea            fi
2432111a38b0SRobert Relyea            smartcard_nss="no"
2433111a38b0SRobert Relyea        fi
2434111a38b0SRobert Relyea    fi
2435111a38b0SRobert Relyeafi
2436111a38b0SRobert Relyeaif test "$smartcard" = "no" ; then
2437111a38b0SRobert Relyea    smartcard_nss="no"
2438111a38b0SRobert Relyeafi
2439111a38b0SRobert Relyea
244069354a83SHans de Goede# check for usbredirparser for usb network redirection support
244169354a83SHans de Goedeif test "$usb_redir" != "no" ; then
244269354a83SHans de Goede    if $pkg_config libusbredirparser >/dev/null 2>&1 ; then
244369354a83SHans de Goede        usb_redir="yes"
244469354a83SHans de Goede        usb_redir_cflags=$($pkg_config --cflags libusbredirparser 2>/dev/null)
244569354a83SHans de Goede        usb_redir_libs=$($pkg_config --libs libusbredirparser 2>/dev/null)
244669354a83SHans de Goede        QEMU_CFLAGS="$QEMU_CFLAGS $usb_redir_cflags"
244769354a83SHans de Goede        LIBS="$LIBS $usb_redir_libs"
244869354a83SHans de Goede    else
244969354a83SHans de Goede        if test "$usb_redir" = "yes"; then
245069354a83SHans de Goede            feature_not_found "usb-redir"
245169354a83SHans de Goede        fi
245269354a83SHans de Goede        usb_redir="no"
245369354a83SHans de Goede    fi
245469354a83SHans de Goedefi
245569354a83SHans de Goede
2456cd4ec0b4SGerd Hoffmann##########################################
2457cd4ec0b4SGerd Hoffmann
2458747bbdf7SBlue Swirl##########################################
24595f6b9e8fSBlue Swirl# check if we have fdatasync
24605f6b9e8fSBlue Swirl
24615f6b9e8fSBlue Swirlfdatasync=no
24625f6b9e8fSBlue Swirlcat > $TMPC << EOF
24635f6b9e8fSBlue Swirl#include <unistd.h>
2464d1722a27SAlexandre Raymondint main(void) {
2465d1722a27SAlexandre Raymond#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
2466d1722a27SAlexandre Raymondreturn fdatasync(0);
2467d1722a27SAlexandre Raymond#else
2468d1722a27SAlexandre Raymond#abort Not supported
2469d1722a27SAlexandre Raymond#endif
2470d1722a27SAlexandre Raymond}
24715f6b9e8fSBlue SwirlEOF
24725f6b9e8fSBlue Swirlif compile_prog "" "" ; then
24735f6b9e8fSBlue Swirl    fdatasync=yes
24745f6b9e8fSBlue Swirlfi
24755f6b9e8fSBlue Swirl
247694a420b1SStefan Hajnoczi##########################################
2477e78815a5SAndreas Färber# check if we have madvise
2478e78815a5SAndreas Färber
2479e78815a5SAndreas Färbermadvise=no
2480e78815a5SAndreas Färbercat > $TMPC << EOF
2481e78815a5SAndreas Färber#include <sys/types.h>
2482e78815a5SAndreas Färber#include <sys/mman.h>
2483832ce9c2SScott Wood#include <stddef.h>
2484e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2485e78815a5SAndreas FärberEOF
2486e78815a5SAndreas Färberif compile_prog "" "" ; then
2487e78815a5SAndreas Färber    madvise=yes
2488e78815a5SAndreas Färberfi
2489e78815a5SAndreas Färber
2490e78815a5SAndreas Färber##########################################
2491e78815a5SAndreas Färber# check if we have posix_madvise
2492e78815a5SAndreas Färber
2493e78815a5SAndreas Färberposix_madvise=no
2494e78815a5SAndreas Färbercat > $TMPC << EOF
2495e78815a5SAndreas Färber#include <sys/mman.h>
2496832ce9c2SScott Wood#include <stddef.h>
2497e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2498e78815a5SAndreas FärberEOF
2499e78815a5SAndreas Färberif compile_prog "" "" ; then
2500e78815a5SAndreas Färber    posix_madvise=yes
2501e78815a5SAndreas Färberfi
2502e78815a5SAndreas Färber
2503e78815a5SAndreas Färber##########################################
250494a420b1SStefan Hajnoczi# check if trace backend exists
250594a420b1SStefan Hajnoczi
25064c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
250794a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
250894a420b1SStefan Hajnoczi  echo
250994a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
251094a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
251194a420b1SStefan Hajnoczi  echo
251294a420b1SStefan Hajnoczi  exit 1
251394a420b1SStefan Hajnoczifi
251494a420b1SStefan Hajnoczi
25157e24e92aSStefan Hajnoczi##########################################
25167e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
25177e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
25187e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
25197e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
25207e24e92aSStefan Hajnoczi#include <ust/marker.h>
25217e24e92aSStefan Hajnocziint main(void) { return 0; }
25227e24e92aSStefan HajnocziEOF
25237e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
25247e24e92aSStefan Hajnoczi    LIBS="-lust $LIBS"
25257e24e92aSStefan Hajnoczi  else
25267e24e92aSStefan Hajnoczi    echo
25277e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
25287e24e92aSStefan Hajnoczi    echo
25297e24e92aSStefan Hajnoczi    exit 1
25307e24e92aSStefan Hajnoczi  fi
25317e24e92aSStefan Hajnoczifi
2532b3d08c02SDaniel P. Berrange
2533b3d08c02SDaniel P. Berrange##########################################
2534b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
2535b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
2536b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
2537b3d08c02SDaniel P. Berrange    echo
2538b3d08c02SDaniel P. Berrange    echo "Error: dtrace command is not found in PATH $PATH"
2539b3d08c02SDaniel P. Berrange    echo
2540b3d08c02SDaniel P. Berrange    exit 1
2541b3d08c02SDaniel P. Berrange  fi
2542c276b17dSDaniel P. Berrange  trace_backend_stap="no"
2543c276b17dSDaniel P. Berrange  if has 'stap' ; then
2544c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
2545c276b17dSDaniel P. Berrange  fi
2546b3d08c02SDaniel P. Berrangefi
2547b3d08c02SDaniel P. Berrange
25487e24e92aSStefan Hajnoczi##########################################
2549023367e6SWolfgang Mauerer# __sync_fetch_and_and requires at least -march=i486. Many toolchains
2550023367e6SWolfgang Mauerer# use i686 as default anyway, but for those that don't, an explicit
2551023367e6SWolfgang Mauerer# specification is necessary
25521ba16968SStefan Weilif test "$vhost_net" = "yes" && test "$cpu" = "i386"; then
2553023367e6SWolfgang Mauerer  cat > $TMPC << EOF
2554023367e6SWolfgang Mauererint sfaa(unsigned *ptr)
2555023367e6SWolfgang Mauerer{
2556023367e6SWolfgang Mauerer  return __sync_fetch_and_and(ptr, 0);
2557023367e6SWolfgang Mauerer}
2558023367e6SWolfgang Mauerer
2559023367e6SWolfgang Mauererint main(int argc, char **argv)
2560023367e6SWolfgang Mauerer{
2561023367e6SWolfgang Mauerer  int val = 42;
2562023367e6SWolfgang Mauerer  sfaa(&val);
2563023367e6SWolfgang Mauerer  return val;
2564023367e6SWolfgang Mauerer}
2565023367e6SWolfgang MauererEOF
2566023367e6SWolfgang Mauerer  if ! compile_prog "" "" ; then
2567023367e6SWolfgang Mauerer    CFLAGS+="-march=i486"
2568023367e6SWolfgang Mauerer  fi
2569023367e6SWolfgang Mauererfi
2570023367e6SWolfgang Mauerer
2571023367e6SWolfgang Mauerer##########################################
2572d0e2fce5SAneesh Kumar K.V# check if we have makecontext
2573d0e2fce5SAneesh Kumar K.V
2574d0e2fce5SAneesh Kumar K.Vucontext_coroutine=no
2575d0e2fce5SAneesh Kumar K.Vif test "$darwin" != "yes"; then
2576d0e2fce5SAneesh Kumar K.V  cat > $TMPC << EOF
2577d0e2fce5SAneesh Kumar K.V#include <ucontext.h>
2578d0e2fce5SAneesh Kumar K.Vint main(void) { makecontext(0, 0, 0); }
2579d0e2fce5SAneesh Kumar K.VEOF
2580d0e2fce5SAneesh Kumar K.V  if compile_prog "" "" ; then
2581d0e2fce5SAneesh Kumar K.V      ucontext_coroutine=yes
2582d0e2fce5SAneesh Kumar K.V  fi
2583d0e2fce5SAneesh Kumar K.Vfi
2584d0e2fce5SAneesh Kumar K.V
2585d0e2fce5SAneesh Kumar K.V##########################################
2586d2042378SAneesh Kumar K.V# check if we have open_by_handle_at
2587d2042378SAneesh Kumar K.V
2588d2042378SAneesh Kumar K.Vopen_by_hande_at=no
2589d2042378SAneesh Kumar K.Vcat > $TMPC << EOF
2590d2042378SAneesh Kumar K.V#include <fcntl.h>
259115329e83SAneesh Kumar K.Vint main(void) { struct file_handle fh; open_by_handle_at(0, &fh, 0); }
2592d2042378SAneesh Kumar K.VEOF
2593d2042378SAneesh Kumar K.Vif compile_prog "" "" ; then
2594d2042378SAneesh Kumar K.V    open_by_handle_at=yes
2595d2042378SAneesh Kumar K.Vfi
2596d2042378SAneesh Kumar K.V
2597e06a765eSHarsh Prateek Bora########################################
2598e06a765eSHarsh Prateek Bora# check if we have linux/magic.h
2599e06a765eSHarsh Prateek Bora
2600e06a765eSHarsh Prateek Boralinux_magic_h=no
2601e06a765eSHarsh Prateek Boracat > $TMPC << EOF
2602e06a765eSHarsh Prateek Bora#include <linux/magic.h>
2603e06a765eSHarsh Prateek Boraint main(void) {
2604e06a765eSHarsh Prateek Bora}
2605e06a765eSHarsh Prateek BoraEOF
2606e06a765eSHarsh Prateek Boraif compile_prog "" "" ; then
2607e06a765eSHarsh Prateek Bora    linux_magic_h=yes
2608e06a765eSHarsh Prateek Borafi
2609e06a765eSHarsh Prateek Bora
2610d2042378SAneesh Kumar K.V##########################################
2611e86ecd4bSJuan Quintela# End of CC checks
2612e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2613e86ecd4bSJuan Quintela
2614e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
26151156c669SJuan Quintela  CFLAGS="-O2 $CFLAGS"
2616e86ecd4bSJuan Quintelafi
2617a316e378SJuan Quintela
2618e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
2619e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
2620e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
262120ff6c80SAnthony Liguori
262220ff6c80SAnthony Liguoriif test -z "$werror" ; then
2623e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
2624e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
2625e86ecd4bSJuan Quintela        werror="yes"
2626e86ecd4bSJuan Quintela    else
2627e86ecd4bSJuan Quintela        werror="no"
2628e86ecd4bSJuan Quintela    fi
2629e86ecd4bSJuan Quintelafi
2630e86ecd4bSJuan Quintela
263120ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
263220ff6c80SAnthony Liguori# enable/disable
263320ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
263420ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
263520ff6c80SAnthony Liguori	zero_malloc="no"
263620ff6c80SAnthony Liguori    else
263720ff6c80SAnthony Liguori	zero_malloc="yes"
263820ff6c80SAnthony Liguori    fi
263920ff6c80SAnthony Liguorifi
264020ff6c80SAnthony Liguori
2641e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
2642a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2643e86ecd4bSJuan Quintelafi
2644e86ecd4bSJuan Quintela
2645e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2646e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
26471156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2648e86ecd4bSJuan Quintela    fi
2649e86ecd4bSJuan Quintelafi
2650e86ecd4bSJuan Quintela
2651952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
2652952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
2653952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
2654952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2655952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
2656952afb71SBlue Swirl        fi
2657952afb71SBlue Swirl    done
2658952afb71SBlue Swirlfi
2659952afb71SBlue Swirl
2660190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix
26615a67135aSbellard
2662ca35f780SPaolo Bonzinitools=
2663ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2664ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2665ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2666ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2667d138cee9SMichael Roth    if [ "$guest_agent" = "yes" ]; then
266848ff7a62SMichael Roth      tools="qemu-ga\$(EXESUF) $tools"
2669d138cee9SMichael Roth    fi
2670ca35f780SPaolo Bonzini    if [ "$check_utests" = "yes" ]; then
2671fffbeb75SGerd Hoffmann      checks="check-qint check-qstring check-qdict check-qlist"
2672695833bcSGerd Hoffmann      checks="check-qfloat check-qjson test-coroutine $checks"
2673ca35f780SPaolo Bonzini    fi
2674ca35f780SPaolo Bonzini  fi
2675ca35f780SPaolo Bonzinifi
2676ca35f780SPaolo Bonzini
2677ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
2678ca35f780SPaolo Bonziniroms=
2679ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2680ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2681ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
2682ca35f780SPaolo Bonzini  roms="optionrom"
2683ca35f780SPaolo Bonzinifi
2684d0384d1dSAndreas Färberif test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then
268539ac8455SDavid Gibson  roms="$roms spapr-rtas"
268639ac8455SDavid Gibsonfi
2687ca35f780SPaolo Bonzini
26887d13299dSbellardecho "Install prefix    $prefix"
2689f2b9e1e3SPaolo Bonziniecho "BIOS directory    `eval echo $datadir`"
2690f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
26913aa5d2beSAlon Levyecho "library directory `eval echo $libdir`"
26920f94d6daSAlon Levyecho "include directory `eval echo $includedir`"
26931c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
269411d9f695Sbellardif test "$mingw32" = "no" ; then
2695f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
269643ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
269711d9f695Sbellardfi
26985a67135aSbellardecho "Source path       $source_path"
26997d13299dSbellardecho "C compiler        $cc"
270083469015Sbellardecho "Host C compiler   $host_cc"
27010c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
2702a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
27030c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
27047d13299dSbellardecho "make              $make"
27056a882643Spbrookecho "install           $install"
2706c886edfbSBlue Swirlecho "python            $python"
2707e2d8830eSBradif test "$slirp" = "yes" ; then
2708e2d8830eSBrad    echo "smbd              $smbd"
2709e2d8830eSBradfi
2710a98fd896Sbellardecho "host CPU          $cpu"
2711de83cd02Sbellardecho "host big endian   $bigendian"
271297a847bcSbellardecho "target list       $target_list"
2713ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
2714b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
27157d13299dSbellardecho "gprof enabled     $gprof"
271603b4fe7dSaliguoriecho "sparse enabled    $sparse"
27171625af87Saliguoriecho "strip binaries    $strip_opt"
271805c2a3e7Sbellardecho "profiler          $profiler"
271943ce4dfeSbellardecho "static build      $static"
272085aa5189Sbellardecho "-Werror enabled   $werror"
27215b0753e0Sbellardif test "$darwin" = "yes" ; then
27225b0753e0Sbellard    echo "Cocoa support     $cocoa"
27235b0753e0Sbellardfi
272497a847bcSbellardecho "SDL support       $sdl"
27254d3b6f6eSbalrogecho "curses support    $curses"
2726769ce76dSAlexander Grafecho "curl support      $curl"
27275495ed11SLuiz Capitulinoecho "check support     $check_utests"
272867b915a5Sbellardecho "mingw32 support   $mingw32"
27290c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
27300c58ac1cSmalcecho "Extra audio cards $audio_card_list"
2731eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
27328ff9cbf7Smalcecho "Mixer emulation   $mixemu"
2733821601eaSJes Sorensenecho "VNC support       $vnc"
2734821601eaSJes Sorensenif test "$vnc" = "yes" ; then
27358d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
27362f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
27372f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
2738efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
2739bd023f95SCorentin Chary    echo "VNC thread        $vnc_thread"
2740821601eaSJes Sorensenfi
27413142255cSblueswir1if test -n "$sparc_cpu"; then
27423142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
27433142255cSblueswir1fi
2744e37630caSaliguoriecho "xen support       $xen"
27452e4d9fb1Saurel32echo "brlapi support    $brlapi"
2746a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
2747a25dba17SJuan Quintelaecho "Documentation     $docs"
2748c5937220Spbrook[ ! -z "$uname_release" ] && \
2749c5937220Spbrookecho "uname -r          $uname_release"
2750bd0c5661Spbrookecho "NPTL support      $nptl"
2751379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
275234005a00SKirill A. Shutemovecho "PIE user targets  $user_pie"
27538a16d273Sthsecho "vde support       $vde"
27545c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
2755758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
275677755340Sthsecho "Install blobs     $blobs"
2757b31a0277SJuan Quintelaecho "KVM support       $kvm"
2758f652e6afSaurel32echo "fdt support       $fdt"
2759ceb42de8Saliguoriecho "preadv support    $preadv"
27605f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
2761e78815a5SAndreas Färberecho "madvise           $madvise"
2762e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
2763ee682d27SStefan Weilecho "uuid support      $uuid"
2764d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
276594a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
27669410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
2767cd4ec0b4SGerd Hoffmannecho "spice support     $spice"
2768f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
2769dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
2770111a38b0SRobert Relyeaecho "nss used          $smartcard_nss"
277169354a83SHans de Goedeecho "usb net redir     $usb_redir"
277220ff075bSMichael Walleecho "OpenGL support    $opengl"
2773c589b249SRonnie Sahlbergecho "libiscsi support  $libiscsi"
2774d138cee9SMichael Rothecho "build guest agent $guest_agent"
277567b915a5Sbellard
27761ba16968SStefan Weilif test "$sdl_too_old" = "yes"; then
277724b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
2778e8cd23deSbellardfi
277997a847bcSbellard
278098ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
27814bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
278297a847bcSbellard
278398ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
278498ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
278598ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
278698ec69acSJuan Quintelaecho >> $config_host_mak
278798ec69acSJuan Quintela
2788e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
278999d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
279099d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
27913aa5d2beSAlon Levyecho "libdir=$libdir" >> $config_host_mak
27920f94d6daSAlon Levyecho "includedir=$includedir" >> $config_host_mak
279399d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
279499d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak
279599d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
279699d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak
27971dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak
2798804edf29SJuan Quintela
27992408a527Saurel32case "$cpu" in
2800d2fbca94SGuan Xuetao  i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64|unicore32)
2801e0da9dd3SJuan Quintela    ARCH=$cpu
28022408a527Saurel32  ;;
2803a302c32dSLaurent Desnogues  armv4b|armv4l)
280416dbd14fSJuan Quintela    ARCH=arm
28052408a527Saurel32  ;;
28062408a527Saurel32esac
280798ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
2808f8393946Saurel32if test "$debug_tcg" = "yes" ; then
28092358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2810f8393946Saurel32fi
2811b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
2812b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2813b4475aa2SLuiz Capitulinofi
2814f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
28152358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2816f3d08ee6SPaul Brookfi
28171625af87Saliguoriif test "$strip_opt" = "yes" ; then
281852ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
28191625af87Saliguorifi
28207d13299dSbellardif test "$bigendian" = "yes" ; then
2821e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
282297a847bcSbellardfi
28232358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
282467b915a5Sbellardif test "$mingw32" = "yes" ; then
282598ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
28269fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
28279fe6de94SBlue Swirl  version_major=${rc_version%%.*}
28289fe6de94SBlue Swirl  rc_version=${rc_version#*.}
28299fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
28309fe6de94SBlue Swirl  rc_version=${rc_version#*.}
28319fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
28329fe6de94SBlue Swirl  version_micro=0
28339fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
28349fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2835210fa556Spbrookelse
283635f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
2837210fa556Spbrookfi
2838128ab2ffSblueswir1
2839dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
2840dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
2841dffcb71cSMark McLoughlinfi
2842dffcb71cSMark McLoughlin
284383fb7adfSbellardif test "$darwin" = "yes" ; then
284498ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
284583fb7adfSbellardfi
2846b29fe3edSmalc
2847b29fe3edSmalcif test "$aix" = "yes" ; then
284898ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
2849b29fe3edSmalcfi
2850b29fe3edSmalc
2851ec530c81Sbellardif test "$solaris" = "yes" ; then
285298ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
28532358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
28540475a5caSths  if test "$needs_libsunmath" = "yes" ; then
285575b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
28560475a5caSths  fi
2857ec530c81Sbellardfi
2858179cf400SAndreas Färberif test "$haiku" = "yes" ; then
2859179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
2860179cf400SAndreas Färberfi
286197a847bcSbellardif test "$static" = "yes" ; then
286298ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
286397a847bcSbellardfi
28641ba16968SStefan Weilif test "$profiler" = "yes" ; then
28652358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
286605c2a3e7Sbellardfi
2867c20709aaSbellardif test "$slirp" = "yes" ; then
286898ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
2869e2d8830eSBrad  echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
2870f9728943SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
2871c20709aaSbellardfi
28728a16d273Sthsif test "$vde" = "yes" ; then
287398ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
28748a16d273Sthsfi
28750c58ac1cSmalcfor card in $audio_card_list; do
2876f6e5889eSpbrook    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
287798ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
28780c58ac1cSmalcdone
28792358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
28800c58ac1cSmalcfor drv in $audio_drv_list; do
2881f6e5889eSpbrook    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
288298ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
2883923e4521Smalc    if test "$drv" = "fmod"; then
28847aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2885fb065187Sbellard    fi
28860c58ac1cSmalcdone
288767f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
288867f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
288967f86e8eSJuan Quintelafi
2890d5631638Smalcif test "$audio_win_int" = "yes" ; then
2891d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2892d5631638Smalcfi
2893eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
28948ff9cbf7Smalcif test "$mixemu" = "yes" ; then
289598ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
28968ff9cbf7Smalcfi
2897821601eaSJes Sorensenif test "$vnc" = "yes" ; then
2898821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
2899821601eaSJes Sorensenfi
29008d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
290198ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2902525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
29038d5d2d4cSthsfi
29042f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
290598ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
290660ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
29072f9606b3Saliguorifi
2908821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
29092f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
29102f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
29112f6f5c7aSCorentin Charyfi
2912821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
2913efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2914efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2915efe556adSCorentin Charyfi
2916821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then
2917bd023f95SCorentin Chary  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2918bd023f95SCorentin Charyfi
291976655d6dSaliguoriif test "$fnmatch" = "yes" ; then
29202358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
292176655d6dSaliguorifi
2922ee682d27SStefan Weilif test "$uuid" = "yes" ; then
2923ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
2924ee682d27SStefan Weilfi
2925dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
2926dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
2927dce512deSChristoph Hellwigfi
2928b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
292998ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
29302358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
293198ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
293298ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
2933a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
293498ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
2935cc8ae6deSpbrookfi
29361ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
293798ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
29388ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
293949ecc3faSbellardfi
294049ecc3faSbellardif test "$cocoa" = "yes" ; then
294198ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
294249ecc3faSbellardfi
29434d3b6f6eSbalrogif test "$curses" = "yes" ; then
294498ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
2945ab4e5602SJan Kiszkafi
29463b3f24adSaurel32if test "$atfile" = "yes" ; then
29472358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
29483b3f24adSaurel32fi
2949ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
29502358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2951ebc996f3SRiku Voipiofi
2952099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
29532358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
2954099d6b0fSRiku Voipiofi
295540ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
295640ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
295740ff6d7eSKevin Wolffi
29583ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
29592358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
29603ce34dfbSvibisreenivasanfi
2961c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
2962c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2963c2882b96SRiku Voipiofi
2964d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
2965d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2966d0927938SUlrich Hechtfi
2967c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
2968c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
2969c727f47dSPeter Maydellfi
2970dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
2971dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
2972dace20dcSPeter Maydellfi
2973d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
2974d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
2975d0927938SUlrich Hechtfi
29763b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
29773b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
29783b6edd16SPeter Maydellfi
29793b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
29803b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
29813b6edd16SPeter Maydellfi
29823b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
29833b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
29843b6edd16SPeter Maydellfi
29853b3f24adSaurel32if test "$inotify" = "yes" ; then
29862358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
29873b3f24adSaurel32fi
2988c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
2989c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2990c05c7a73SRiku Voipiofi
29916ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
29926ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
29936ae9a1f4SJuan Quintelafi
29946ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
29956ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
29966ae9a1f4SJuan Quintelafi
2997769ce76dSAlexander Grafif test "$curl" = "yes" ; then
299898ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
2999b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
3000769ce76dSAlexander Graffi
30012e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
300298ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
30032e4d9fb1Saurel32fi
3004fb599c9aSbalrogif test "$bluez" = "yes" ; then
300598ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
3006ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
3007fb599c9aSbalrogfi
3008e18df141SAnthony Liguoriecho "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
3009e37630caSaliguoriif test "$xen" = "yes" ; then
30106dbd588aSJan Kiszka  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
3011d5b93ddfSAnthony PERARD  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
3012e37630caSaliguorifi
30135c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
30145c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
30155c6c3a6cSChristoph Hellwigfi
3016758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
3017758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
3018758e8e38SVenkateswararao Jujjuri (JV)fi
3019758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then
3020758e8e38SVenkateswararao Jujjuri (JV)  if test "$attr" = "yes" ; then
3021758e8e38SVenkateswararao Jujjuri (JV)    echo "CONFIG_VIRTFS=y" >> $config_host_mak
3022758e8e38SVenkateswararao Jujjuri (JV)  fi
3023758e8e38SVenkateswararao Jujjuri (JV)fi
302477755340Sthsif test "$blobs" = "yes" ; then
302598ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
302677755340Sthsfi
3027bf9298b9Saliguoriif test "$iovec" = "yes" ; then
30282358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
3029bf9298b9Saliguorifi
3030ceb42de8Saliguoriif test "$preadv" = "yes" ; then
30312358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
3032ceb42de8Saliguorifi
3033f652e6afSaurel32if test "$fdt" = "yes" ; then
30343f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
3035f652e6afSaurel32fi
3036dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
3037dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
3038dcc38d1cSMarcelo Tosattifi
3039de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then
3040de5071c5SBlue Swirl  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
3041de5071c5SBlue Swirlfi
30425f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
30435f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
30445f6b9e8fSBlue Swirlfi
3045e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
3046e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
3047e78815a5SAndreas Färberfi
3048e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
3049e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
3050e78815a5SAndreas Färberfi
305197a847bcSbellard
3052cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
3053cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
3054cd4ec0b4SGerd Hoffmannfi
3055cd4ec0b4SGerd Hoffmann
305636707144SAlon Levyif test "$smartcard" = "yes" ; then
305736707144SAlon Levy  echo "CONFIG_SMARTCARD=y" >> $config_host_mak
305836707144SAlon Levyfi
305936707144SAlon Levy
3060111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3061111a38b0SRobert Relyea  echo "CONFIG_SMARTCARD_NSS=y" >> $config_host_mak
3062111a38b0SRobert Relyeafi
3063111a38b0SRobert Relyea
306469354a83SHans de Goedeif test "$usb_redir" = "yes" ; then
306569354a83SHans de Goede  echo "CONFIG_USB_REDIR=y" >> $config_host_mak
306669354a83SHans de Goedefi
306769354a83SHans de Goede
306820ff075bSMichael Walleif test "$opengl" = "yes" ; then
306920ff075bSMichael Walle  echo "CONFIG_OPENGL=y" >> $config_host_mak
307020ff075bSMichael Wallefi
307120ff075bSMichael Walle
3072c589b249SRonnie Sahlbergif test "$libiscsi" = "yes" ; then
3073c589b249SRonnie Sahlberg  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
3074c589b249SRonnie Sahlbergfi
3075c589b249SRonnie Sahlberg
307683fb7adfSbellard# XXX: suppress that
30777d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
30782358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
30797d3505c5Sbellardfi
30807d3505c5Sbellard
30812358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
3082c5937220Spbrook
308320ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
308420ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
308520ff6c80SAnthony Liguorifi
3086f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
3087f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
3088f27aaf4bSChristian Brunnerfi
308920ff6c80SAnthony Liguori
3090d0e2fce5SAneesh Kumar K.Vif test "$ucontext_coroutine" = "yes" ; then
3091d0e2fce5SAneesh Kumar K.V  echo "CONFIG_UCONTEXT_COROUTINE=y" >> $config_host_mak
3092d0e2fce5SAneesh Kumar K.Vfi
3093d0e2fce5SAneesh Kumar K.V
3094d2042378SAneesh Kumar K.Vif test "$open_by_handle_at" = "yes" ; then
3095d2042378SAneesh Kumar K.V  echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak
3096d2042378SAneesh Kumar K.Vfi
3097d2042378SAneesh Kumar K.V
3098e06a765eSHarsh Prateek Boraif test "$linux_magic_h" = "yes" ; then
3099e06a765eSHarsh Prateek Bora  echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
3100e06a765eSHarsh Prateek Borafi
3101e06a765eSHarsh Prateek Bora
310268063649Sblueswir1# USB host support
310368063649Sblueswir1case "$usb" in
310468063649Sblueswir1linux)
310598ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
310668063649Sblueswir1;;
310768063649Sblueswir1bsd)
310898ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
310968063649Sblueswir1;;
311068063649Sblueswir1*)
311198ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
311268063649Sblueswir1;;
311368063649Sblueswir1esac
311468063649Sblueswir1
3115e4858974SLluís# use default implementation for tracing backend-specific routines
3116e4858974SLluístrace_default=yes
311794a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
31186d8a764eSLluísif test "$trace_backend" = "nop"; then
31196d8a764eSLluís  echo "CONFIG_TRACE_NOP=y" >> $config_host_mak
312022890ab5SPrerna Saxenafi
31219410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
31226d8a764eSLluís  echo "CONFIG_TRACE_SIMPLE=y" >> $config_host_mak
3123e4858974SLluís  trace_default=no
31246d8a764eSLluís  # Set the appropriate trace file.
3125953ffe0fSAndreas Färber  trace_file="\"$trace_file-\" FMT_pid"
31269410b56cSPrerna Saxenafi
31276d8a764eSLluísif test "$trace_backend" = "stderr"; then
31286d8a764eSLluís  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
31299a82b6a5SLluís  trace_default=no
31306d8a764eSLluísfi
31316d8a764eSLluísif test "$trace_backend" = "ust"; then
31326d8a764eSLluís  echo "CONFIG_TRACE_UST=y" >> $config_host_mak
31336d8a764eSLluísfi
31346d8a764eSLluísif test "$trace_backend" = "dtrace"; then
31356d8a764eSLluís  echo "CONFIG_TRACE_DTRACE=y" >> $config_host_mak
31366d8a764eSLluís  if test "$trace_backend_stap" = "yes" ; then
31376d8a764eSLluís    echo "CONFIG_TRACE_SYSTEMTAP=y" >> $config_host_mak
31386d8a764eSLluís  fi
3139c276b17dSDaniel P. Berrangefi
31409410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
3141e4858974SLluísif test "$trace_default" = "yes"; then
3142e4858974SLluís  echo "CONFIG_TRACE_DEFAULT=y" >> $config_host_mak
3143e4858974SLluísfi
31449410b56cSPrerna Saxena
314598ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
3146fffbeb75SGerd Hoffmannecho "CHECKS=$checks" >> $config_host_mak
314798ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
3148804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
3149804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
31501901cb14SBradecho "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
31511901cb14SBradecho "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
31521901cb14SBradecho "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
3153c886edfbSBlue Swirlecho "PYTHON=$python" >> $config_host_mak
3154804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
31552b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
3156804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
3157804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
3158804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
3159804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
31609fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
316144dc0ca3SAlon Levyecho "LIBTOOL=$libtool" >> $config_host_mak
3162e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
3163a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
3164f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
3165e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
3166e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
3167e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
3168e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
3169e39f0062SPaolo Bonzinifi
3170c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
3171e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
3172a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
3173a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
317473da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
31753e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
3176804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
3177957f1f99SMichael Rothecho "LIBS_QGA+=$libs_qga" >> $config_host_mak
3178804edf29SJuan Quintela
31794bf6b55bSJuan Quintela# generate list of library paths for linker script
31804bf6b55bSJuan Quintela
31814bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
31824bf6b55bSJuan Quintela
31834bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
31844bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
31854bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
31864bf6b55bSJuan Quintela  else
31874bf6b55bSJuan Quintela    rm ${config_host_ld}~
31884bf6b55bSJuan Quintela  fi
31894bf6b55bSJuan Quintelafi
31904bf6b55bSJuan Quintela
31914d904533SBlue Swirlfor d in libdis libdis-user; do
31924d904533SBlue Swirl    mkdir -p $d
319311568d6dSPaolo Bonzini    symlink $source_path/Makefile.dis $d/Makefile
31944d904533SBlue Swirl    echo > $d/config.mak
31954d904533SBlue Swirldone
3196d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then
3197d44cff22SRichard Henderson  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
3198d44cff22SRichard Hendersonfi
31994d904533SBlue Swirl
320097a847bcSbellardfor target in $target_list; do
320197a847bcSbellardtarget_dir="$target"
320225be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
3203600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
320497a847bcSbellardtarget_bigendian="no"
32051f3d3c8fSJuan Quintela
3206ea2d6a39SJuan Quintelacase "$target_arch2" in
3207cfa550c6SMax Filippov  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb)
3208ea2d6a39SJuan Quintela  target_bigendian=yes
3209ea2d6a39SJuan Quintela  ;;
3210ea2d6a39SJuan Quintelaesac
321197a847bcSbellardtarget_softmmu="no"
3212997344f3Sbellardtarget_user_only="no"
3213831b7825Sthstarget_linux_user="no"
3214831b7825Sthstarget_darwin_user="no"
321584778508Sblueswir1target_bsd_user="no"
32169e407a85Spbrookcase "$target" in
3217600309b6SBlue Swirl  ${target_arch2}-softmmu)
32189e407a85Spbrook    target_softmmu="yes"
32199e407a85Spbrook    ;;
3220600309b6SBlue Swirl  ${target_arch2}-linux-user)
32219c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
32229c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
32239c7a4202SBlue Swirl      exit 1
32249c7a4202SBlue Swirl    fi
32259e407a85Spbrook    target_user_only="yes"
32269e407a85Spbrook    target_linux_user="yes"
32279e407a85Spbrook    ;;
3228600309b6SBlue Swirl  ${target_arch2}-darwin-user)
32299c7a4202SBlue Swirl    if test "$darwin" != "yes" ; then
32309c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Darwin host"
32319c7a4202SBlue Swirl      exit 1
32329c7a4202SBlue Swirl    fi
32339e407a85Spbrook    target_user_only="yes"
3234831b7825Sths    target_darwin_user="yes"
32359e407a85Spbrook    ;;
3236600309b6SBlue Swirl  ${target_arch2}-bsd-user)
32379cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
32389c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
32399c7a4202SBlue Swirl      exit 1
32409c7a4202SBlue Swirl    fi
324184778508Sblueswir1    target_user_only="yes"
324284778508Sblueswir1    target_bsd_user="yes"
324384778508Sblueswir1    ;;
32449e407a85Spbrook  *)
32459e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
32469e407a85Spbrook    exit 1
32479e407a85Spbrook    ;;
32489e407a85Spbrookesac
3249831b7825Sths
325097a847bcSbellardmkdir -p $target_dir
3251158142c2Sbellardmkdir -p $target_dir/fpu
325257fec1feSbellardmkdir -p $target_dir/tcg
325359f2a787SGerd Hoffmannmkdir -p $target_dir/ide
3254353ac78dSAneesh Kumar K.Vmkdir -p $target_dir/9pfs
325584778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
325669de927cSbellard  mkdir -p $target_dir/nwfpe
325769de927cSbellardfi
325811568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile
3259ec530c81Sbellard
326097a847bcSbellard
326125be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
326297a847bcSbellard
3263e5fe0c52Spbrookbflt="no"
3264bd0c5661Spbrooktarget_nptl="no"
3265600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
32667ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
326756aebc89Spbrookgdb_xml_files=""
3268c2e3dee6SLaurent Viviertarget_short_alignment=2
3269c2e3dee6SLaurent Viviertarget_int_alignment=4
3270c2e3dee6SLaurent Viviertarget_long_alignment=4
3271c2e3dee6SLaurent Viviertarget_llong_alignment=8
3272de3a354aSMichael Walletarget_libs_softmmu=
32737ba1e619Saliguori
3274938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
32756acff7daSJuan QuintelaTARGET_BASE_ARCH=""
3276e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
3277e73aae67SJuan Quintela
3278600309b6SBlue Swirlcase "$target_arch2" in
32792408a527Saurel32  i386)
328071deff27SAurelien Jarno    target_phys_bits=64
32812408a527Saurel32  ;;
32822408a527Saurel32  x86_64)
32836acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
32841ad2134fSPaul Brook    target_phys_bits=64
3285c2e3dee6SLaurent Vivier    target_long_alignment=8
32862408a527Saurel32  ;;
32872408a527Saurel32  alpha)
32881ad2134fSPaul Brook    target_phys_bits=64
3289c2e3dee6SLaurent Vivier    target_long_alignment=8
3290a4b388ffSRichard Henderson    target_nptl="yes"
32912408a527Saurel32  ;;
32922408a527Saurel32  arm|armeb)
3293b498c8a0SJuan Quintela    TARGET_ARCH=arm
3294e5fe0c52Spbrook    bflt="yes"
3295bd0c5661Spbrook    target_nptl="yes"
329656aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
32971ad2134fSPaul Brook    target_phys_bits=32
3298c2e3dee6SLaurent Vivier    target_llong_alignment=4
32992408a527Saurel32  ;;
33002408a527Saurel32  cris)
3301253bd7f8Sedgar_igl    target_nptl="yes"
33021ad2134fSPaul Brook    target_phys_bits=32
33032408a527Saurel32  ;;
3304613a22c9SMichael Walle  lm32)
3305613a22c9SMichael Walle    target_phys_bits=32
3306de3a354aSMichael Walle    target_libs_softmmu="$opengl_libs"
3307613a22c9SMichael Walle  ;;
33082408a527Saurel32  m68k)
33090938cda5Saurel32    bflt="yes"
331056aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
33111ad2134fSPaul Brook    target_phys_bits=32
3312c2e3dee6SLaurent Vivier    target_int_alignment=2
3313c2e3dee6SLaurent Vivier    target_long_alignment=2
3314c2e3dee6SLaurent Vivier    target_llong_alignment=2
33152408a527Saurel32  ;;
3316877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
3317877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
331872b675caSEdgar E. Iglesias    bflt="yes"
331972b675caSEdgar E. Iglesias    target_nptl="yes"
332072b675caSEdgar E. Iglesias    target_phys_bits=32
3321de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
332272b675caSEdgar E. Iglesias  ;;
33232408a527Saurel32  mips|mipsel)
3324b498c8a0SJuan Quintela    TARGET_ARCH=mips
332525be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3326f04dc72fSPaul Brook    target_nptl="yes"
33271ad2134fSPaul Brook    target_phys_bits=64
33282408a527Saurel32  ;;
33292408a527Saurel32  mipsn32|mipsn32el)
3330b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
33316acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
333225be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
33331ad2134fSPaul Brook    target_phys_bits=64
33342408a527Saurel32  ;;
33352408a527Saurel32  mips64|mips64el)
3336b498c8a0SJuan Quintela    TARGET_ARCH=mips64
33376acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
333825be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
33391ad2134fSPaul Brook    target_phys_bits=64
3340c2e3dee6SLaurent Vivier    target_long_alignment=8
33412408a527Saurel32  ;;
33422408a527Saurel32  ppc)
3343c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
33448b242ebaSAlexander Graf    target_phys_bits=64
3345d6630708SNathan Froyd    target_nptl="yes"
3346de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
33472408a527Saurel32  ;;
33482408a527Saurel32  ppcemb)
33496acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3350e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3351c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
33521ad2134fSPaul Brook    target_phys_bits=64
3353d6630708SNathan Froyd    target_nptl="yes"
3354de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
33552408a527Saurel32  ;;
33562408a527Saurel32  ppc64)
33576acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3358e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3359c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
33601ad2134fSPaul Brook    target_phys_bits=64
3361c2e3dee6SLaurent Vivier    target_long_alignment=8
3362de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
33632408a527Saurel32  ;;
33642408a527Saurel32  ppc64abi32)
3365b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
33666acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3367e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
336825be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
3369c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
33701ad2134fSPaul Brook    target_phys_bits=64
3371de3a354aSMichael Walle    target_libs_softmmu="$fdt_libs"
33722408a527Saurel32  ;;
33732408a527Saurel32  sh4|sh4eb)
3374b498c8a0SJuan Quintela    TARGET_ARCH=sh4
33754dbed897Spbrook    bflt="yes"
33760b6d3ae0Saurel32    target_nptl="yes"
33771ad2134fSPaul Brook    target_phys_bits=32
33782408a527Saurel32  ;;
33792408a527Saurel32  sparc)
33801ad2134fSPaul Brook    target_phys_bits=64
33812408a527Saurel32  ;;
33822408a527Saurel32  sparc64)
33836acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
33841ad2134fSPaul Brook    target_phys_bits=64
3385c2e3dee6SLaurent Vivier    target_long_alignment=8
33862408a527Saurel32  ;;
33872408a527Saurel32  sparc32plus)
3388b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
33896acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
3390e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
339125be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
33921ad2134fSPaul Brook    target_phys_bits=64
33932408a527Saurel32  ;;
339424e804ecSAlexander Graf  s390x)
3395bc434676SUlrich Hecht    target_nptl="yes"
339624e804ecSAlexander Graf    target_phys_bits=64
33977b3da903SAlexander Graf    target_long_alignment=8
339824e804ecSAlexander Graf  ;;
3399d2fbca94SGuan Xuetao  unicore32)
3400d2fbca94SGuan Xuetao    target_phys_bits=32
3401d2fbca94SGuan Xuetao  ;;
3402cfa550c6SMax Filippov  xtensa|xtensaeb)
3403cfa550c6SMax Filippov    TARGET_ARCH=xtensa
3404cfa550c6SMax Filippov    target_phys_bits=32
3405cfa550c6SMax Filippov  ;;
34062408a527Saurel32  *)
3407de83cd02Sbellard    echo "Unsupported target CPU"
3408de83cd02Sbellard    exit 1
34092408a527Saurel32  ;;
34102408a527Saurel32esac
3411c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3412c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3413c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3414c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
341525be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3416053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
341725be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
341825be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
341942bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
34206acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then
34216acff7daSJuan Quintela  TARGET_BASE_ARCH=$TARGET_ARCH
34226acff7daSJuan Quintelafi
342325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3424e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
3425e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
3426e6e91b9cSJuan Quintelafi
342725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
34281b0c87fcSJuan Quintelacase "$target_arch2" in
34291b0c87fcSJuan Quintela  i386|x86_64)
34301b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
343164b3cfdbSAnthony PERARD      target_phys_bits=64
343225be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
343359d21e53SAlexander Graf    else
343459d21e53SAlexander Graf      echo "CONFIG_NO_XEN=y" >> $config_target_mak
3435432d268cSJun Nakajima    fi
343659d21e53SAlexander Graf    ;;
343759d21e53SAlexander Graf  *)
343859d21e53SAlexander Graf    echo "CONFIG_NO_XEN=y" >> $config_target_mak
34391b0c87fcSJuan Quintelaesac
3440c59249f9SJuan Quintelacase "$target_arch2" in
34410e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
3442c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
3443c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3444c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
3445c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
34465f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
3447adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
3448adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3449c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
3450c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
345125be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
34521ba16968SStefan Weil      if test "$vhost_net" = "yes" ; then
3453d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3454d5970055SMichael S. Tsirkin      fi
3455c59249f9SJuan Quintela    fi
3456c59249f9SJuan Quintelaesac
3457*7f762366SBlue Swirlif test "$target_arch2" = "ppc64" -a "$fdt" = "yes"; then
34580a6b8ddeSAlexander Graf  echo "CONFIG_PSERIES=y" >> $config_target_mak
34590a6b8ddeSAlexander Graffi
3460de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
346125be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
346297a847bcSbellardfi
346397a847bcSbellardif test "$target_softmmu" = "yes" ; then
3464b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
346525be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
3466de3a354aSMichael Walle  echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
34670e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
34685791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3469de83cd02Sbellardfi
3470997344f3Sbellardif test "$target_user_only" = "yes" ; then
347125be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3472997344f3Sbellardfi
3473831b7825Sthsif test "$target_linux_user" = "yes" ; then
347425be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3475831b7825Sthsfi
3476831b7825Sthsif test "$target_darwin_user" = "yes" ; then
347725be210fSJuan Quintela  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3478831b7825Sthsfi
3479111a38b0SRobert Relyeaif test "$smartcard_nss" = "yes" ; then
3480111a38b0SRobert Relyea  echo "subdir-$target: subdir-libcacard" >> $config_host_mak
3481111a38b0SRobert Relyea  echo "libcacard_libs=$libcacard_libs" >> $config_host_mak
3482111a38b0SRobert Relyea  echo "libcacard_cflags=$libcacard_cflags" >> $config_host_mak
3483111a38b0SRobert Relyeafi
348456aebc89Spbrooklist=""
348556aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
348656aebc89Spbrook  for x in $gdb_xml_files; do
348756aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
348856aebc89Spbrook  done
348925be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
34903d0f1517SJuan Quintelafi
3491de83cd02Sbellard
3492e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
349325be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3494e5fe0c52Spbrookfi
3495bd0c5661Spbrookif test "$target_user_only" = "yes" \
3496bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
349725be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3498bd0c5661Spbrookfi
3499379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
350025be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3501379f6698SPaul Brookfi
350284778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
350325be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
350484778508Sblueswir1fi
35055b0753e0Sbellard
35064afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
3507fa282484SJuan Quintela
35084afddb55SJuan Quintelacflags=""
3509f9728943SPaolo Bonziniincludes=""
3510fa282484SJuan Quintelaldflags=""
35119b8e111fSJuan Quintela
351257ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then
3513f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
351424e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
3515f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
35165d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
3517f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
351857ddfbf7SJuan Quintelaelse
3519f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
352057ddfbf7SJuan Quintelafi
3521f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
352257ddfbf7SJuan Quintela
35234d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
35244d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
35254d904533SBlue Swirlelse
35264d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
35274d904533SBlue Swirlfi
35284d904533SBlue Swirl
352964656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
353064656024SJuan Quintela  case "$i" in
353164656024SJuan Quintela  alpha)
353225be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
35334d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
353464656024SJuan Quintela  ;;
353564656024SJuan Quintela  arm)
353625be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
35374d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
353864656024SJuan Quintela  ;;
353964656024SJuan Quintela  cris)
354025be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
35414d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
354264656024SJuan Quintela  ;;
354364656024SJuan Quintela  hppa)
354425be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
35454d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
354664656024SJuan Quintela  ;;
354764656024SJuan Quintela  i386|x86_64)
354825be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
35494d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
355064656024SJuan Quintela  ;;
3551903ec55cSAurelien Jarno  ia64*)
3552903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
3553903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
3554903ec55cSAurelien Jarno  ;;
355564656024SJuan Quintela  m68k)
355625be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
35574d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
355864656024SJuan Quintela  ;;
3559877fdc12SEdgar E. Iglesias  microblaze*)
356025be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
35614d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
356264656024SJuan Quintela  ;;
356364656024SJuan Quintela  mips*)
356425be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
35654d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
356664656024SJuan Quintela  ;;
356764656024SJuan Quintela  ppc*)
356825be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
35694d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
357064656024SJuan Quintela  ;;
357124e804ecSAlexander Graf  s390*)
357225be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
35734d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
357464656024SJuan Quintela  ;;
357564656024SJuan Quintela  sh4)
357625be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
35774d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
357864656024SJuan Quintela  ;;
357964656024SJuan Quintela  sparc*)
358025be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
35814d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
358264656024SJuan Quintela  ;;
3583cfa550c6SMax Filippov  xtensa*)
3584cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $config_target_mak
3585cfa550c6SMax Filippov    echo "CONFIG_XTENSA_DIS=y"  >> $libdis_config_mak
3586cfa550c6SMax Filippov  ;;
358764656024SJuan Quintela  esac
358864656024SJuan Quinteladone
358964656024SJuan Quintela
35906ee7126fSJuan Quintelacase "$ARCH" in
35916ee7126fSJuan Quintelaalpha)
35926ee7126fSJuan Quintela  # Ensure there's only a single GP
35936ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
35946ee7126fSJuan Quintela;;
35956ee7126fSJuan Quintelaesac
35966ee7126fSJuan Quintela
359755d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
359855d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
359955d9c04bSJuan Quintela  arm)
360055d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
360155d9c04bSJuan Quintela  ;;
360225a8bb96SMichael Walle  lm32)
360325a8bb96SMichael Walle    cflags="-DHAS_AUDIO $cflags"
360425a8bb96SMichael Walle  ;;
360555d9c04bSJuan Quintela  i386|mips|ppc)
360655d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
360755d9c04bSJuan Quintela  ;;
360855d9c04bSJuan Quintela  esac
360955d9c04bSJuan Quintelafi
361055d9c04bSJuan Quintela
361134005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \
361234005a00SKirill A. Shutemov	"$user_pie" = "yes" ; then
361334005a00SKirill A. Shutemov  cflags="-fpie $cflags"
361434005a00SKirill A. Shutemov  ldflags="-pie $ldflags"
361534005a00SKirill A. Shutemovfi
361634005a00SKirill A. Shutemov
3617471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \
3618471857ddSJuan Quintela        "$TARGET_ARCH" = "microblaze" -o \
3619471857ddSJuan Quintela        "$TARGET_ARCH" = "cris" \) ; then
362025be210fSJuan Quintela  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3621471857ddSJuan Quintelafi
3622471857ddSJuan Quintela
3623d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
362425be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
3625d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
3626d02c1db3SJuan Quintela    cflags="-p $cflags"
3627d02c1db3SJuan Quintela    ldflags="-p $ldflags"
3628d02c1db3SJuan Quintela  fi
3629d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
3630d02c1db3SJuan Quintela    ldflags="-p $ldflags"
363125be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
3632d02c1db3SJuan Quintela  fi
3633d02c1db3SJuan Quintelafi
3634d02c1db3SJuan Quintela
36356ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
36369b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3637fa282484SJuan Quintela  case "$ARCH" in
3638fa282484SJuan Quintela  sparc)
3639fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
3640322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
3641fa282484SJuan Quintela    ;;
36424d58be06SRichard Henderson  alpha | s390x)
36434d58be06SRichard Henderson    # The default placement of the application is fine.
36444d58be06SRichard Henderson    ;;
3645fd76e73aSRichard Henderson  *)
3646322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
3647fa282484SJuan Quintela    ;;
3648fa282484SJuan Quintela  esac
3649fa282484SJuan Quintelafi
3650fa282484SJuan Quintela
3651e205c790SJan Kiszka# use included Linux headers
3652af2be207SJan Kiszkaif test "$linux" = "yes" ; then
3653e205c790SJan Kiszka  includes="-I\$(SRC_PATH)/linux-headers $includes"
3654e205c790SJan Kiszka  mkdir -p linux-headers
3655e205c790SJan Kiszka  case "$cpu" in
3656e205c790SJan Kiszka  i386|x86_64)
3657e205c790SJan Kiszka    symlink $source_path/linux-headers/asm-x86 linux-headers/asm
3658e205c790SJan Kiszka    ;;
3659e205c790SJan Kiszka  ppcemb|ppc|ppc64)
3660af2be207SJan Kiszka    symlink $source_path/linux-headers/asm-powerpc linux-headers/asm
3661e205c790SJan Kiszka    ;;
3662e205c790SJan Kiszka  s390x)
3663e205c790SJan Kiszka    symlink $source_path/linux-headers/asm-s390 linux-headers/asm
3664e205c790SJan Kiszka    ;;
3665e205c790SJan Kiszka  esac
3666af2be207SJan Kiszkafi
3667e205c790SJan Kiszka
366825be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
366925be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3670f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
3671fa282484SJuan Quintela
367297a847bcSbellarddone # for target in $targets
36737d13299dSbellard
3674d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
3675e1144d00SMark McLoughlinDIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
3676446b9165SAndreas FärberDIRS="$DIRS pc-bios/spapr-rtas"
36772d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
36783e230dd2SCorentin CharyDIRS="$DIRS fsdev ui"
3679e098fc3fSMichael RothDIRS="$DIRS qapi qapi-generated"
3680d9cd446bSAnthony LiguoriDIRS="$DIRS qga trace"
368170371cfbSLuiz CapitulinoFILES="Makefile tests/Makefile qdict-test-data.txt"
3682e7daa605SthsFILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3683ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
3684446b9165SAndreas FärberFILES="$FILES pc-bios/spapr-rtas/Makefile"
36852d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
3686753d11f2SRichard Hendersonfor bios_file in \
3687753d11f2SRichard Henderson    $source_path/pc-bios/*.bin \
3688753d11f2SRichard Henderson    $source_path/pc-bios/*.rom \
3689753d11f2SRichard Henderson    $source_path/pc-bios/*.dtb \
3690753d11f2SRichard Henderson    $source_path/pc-bios/openbios-* \
3691753d11f2SRichard Henderson    $source_path/pc-bios/palcode-*
3692753d11f2SRichard Hendersondo
36937ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
36947ea78b74SJan Kiszkadone
3695d1807a4fSPaolo Bonzinimkdir -p $DIRS
36967d13299dSbellardfor f in $FILES ; do
3697f9245e10SPeter Maydell    if [ -e "$source_path/$f" ] && ! [ -e "$f" ]; then
3698f9245e10SPeter Maydell        symlink "$source_path/$f" "$f"
3699f9245e10SPeter Maydell    fi
37007d13299dSbellarddone
37011ad2134fSPaul Brook
3702c34ebfdcSAnthony Liguori# temporary config to build submodules
37032d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
3704c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
370537116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
3706c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3707c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
3708c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
3709c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
3710c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
3711c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
3712c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
3713c34ebfdcSAnthony Liguoridone
3714c34ebfdcSAnthony Liguori
37151ad2134fSPaul Brookfor hwlib in 32 64; do
37161ad2134fSPaul Brook  d=libhw$hwlib
37171ad2134fSPaul Brook  mkdir -p $d
37189953b2fcSBlue Swirl  mkdir -p $d/ide
371911568d6dSPaolo Bonzini  symlink $source_path/Makefile.hw $d/Makefile
3720353ac78dSAneesh Kumar K.V  mkdir -p $d/9pfs
372137116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
37221ad2134fSPaul Brookdone
3723add16157SBlue Swirl
3724111a38b0SRobert Relyeaif [ "$source_path" != `pwd` ]; then
3725111a38b0SRobert Relyea    # out of tree build
3726111a38b0SRobert Relyea    mkdir -p libcacard
3727111a38b0SRobert Relyea    rm -f libcacard/Makefile
372844dc0ca3SAlon Levy    symlink "$source_path/libcacard/Makefile" libcacard/Makefile
3729111a38b0SRobert Relyeafi
3730111a38b0SRobert Relyea
3731add16157SBlue Swirld=libuser
3732add16157SBlue Swirlmkdir -p $d
3733937b1258SLluís Vilanovamkdir -p $d/trace
373411568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile
3735299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then
3736299060a0SKirill A. Shutemov  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3737299060a0SKirill A. Shutemovfi
3738b40292e7SJan Kiszka
3739b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
3740b40292e7SJan Kiszka  mkdir -p QMP
3741b40292e7SJan Kiszkafi
3742