xref: /openbmc/qemu/configure (revision 821601ea)
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
95ac0df51dSaliguori
96377529c0SPaolo Bonzinitarget_list=""
97377529c0SPaolo Bonzini
98377529c0SPaolo Bonzini# Default value for a variable defining feature "foo".
99377529c0SPaolo Bonzini#  * foo="no"  feature will only be used if --enable-foo arg is given
100377529c0SPaolo Bonzini#  * foo=""    feature will be searched for, and if found, will be used
101377529c0SPaolo Bonzini#              unless --disable-foo is given
102377529c0SPaolo Bonzini#  * foo="yes" this value will only be set by --enable-foo flag.
103377529c0SPaolo Bonzini#              feature will searched for,
104377529c0SPaolo Bonzini#              if not found, configure exits with error
105377529c0SPaolo Bonzini#
106377529c0SPaolo Bonzini# Always add --enable-foo and --disable-foo command line args.
107377529c0SPaolo Bonzini# Distributions want to ensure that several features are compiled in, and it
108377529c0SPaolo Bonzini# is impossible without a --enable-foo that exits if a feature is not found.
109377529c0SPaolo Bonzini
110377529c0SPaolo Bonzinibluez=""
111377529c0SPaolo Bonzinibrlapi=""
112377529c0SPaolo Bonzinicurl=""
113377529c0SPaolo Bonzinicurses=""
114377529c0SPaolo Bonzinidocs=""
115377529c0SPaolo Bonzinifdt=""
116377529c0SPaolo Bonzinikvm=""
117377529c0SPaolo Bonzinikvm_para=""
118377529c0SPaolo Bonzininptl=""
119377529c0SPaolo Bonzinisdl=""
120*821601eaSJes Sorensenvnc="yes"
121377529c0SPaolo Bonzinisparse="no"
122377529c0SPaolo Bonziniuuid=""
123377529c0SPaolo Bonzinivde=""
124377529c0SPaolo Bonzinivnc_tls=""
125377529c0SPaolo Bonzinivnc_sasl=""
126377529c0SPaolo Bonzinivnc_jpeg=""
127377529c0SPaolo Bonzinivnc_png=""
128377529c0SPaolo Bonzinivnc_thread="no"
129377529c0SPaolo Bonzinixen=""
130377529c0SPaolo Bonzinilinux_aio=""
131377529c0SPaolo Bonziniattr=""
132377529c0SPaolo Bonzinivhost_net=""
133377529c0SPaolo Bonzinixfs=""
134377529c0SPaolo Bonzini
135377529c0SPaolo Bonzinigprof="no"
136377529c0SPaolo Bonzinidebug_tcg="no"
137377529c0SPaolo Bonzinidebug_mon="no"
138377529c0SPaolo Bonzinidebug="no"
139377529c0SPaolo Bonzinistrip_opt="yes"
140377529c0SPaolo Bonzinibigendian="no"
141377529c0SPaolo Bonzinimingw32="no"
142377529c0SPaolo BonziniEXESUF=""
143377529c0SPaolo Bonziniprefix="/usr/local"
144377529c0SPaolo Bonzinimandir="\${prefix}/share/man"
145377529c0SPaolo Bonzinidatadir="\${prefix}/share/qemu"
146377529c0SPaolo Bonzinidocdir="\${prefix}/share/doc/qemu"
147377529c0SPaolo Bonzinibindir="\${prefix}/bin"
148377529c0SPaolo Bonzinisysconfdir="\${prefix}/etc"
149377529c0SPaolo Bonziniconfsuffix="/qemu"
150377529c0SPaolo Bonzinislirp="yes"
151377529c0SPaolo Bonzinifmod_lib=""
152377529c0SPaolo Bonzinifmod_inc=""
153377529c0SPaolo Bonzinioss_lib=""
154377529c0SPaolo Bonzinibsd="no"
155377529c0SPaolo Bonzinilinux="no"
156377529c0SPaolo Bonzinisolaris="no"
157377529c0SPaolo Bonziniprofiler="no"
158377529c0SPaolo Bonzinicocoa="no"
159377529c0SPaolo Bonzinisoftmmu="yes"
160377529c0SPaolo Bonzinilinux_user="no"
161377529c0SPaolo Bonzinidarwin_user="no"
162377529c0SPaolo Bonzinibsd_user="no"
163377529c0SPaolo Bonziniguest_base=""
164377529c0SPaolo Bonziniuname_release=""
165377529c0SPaolo Bonziniio_thread="no"
166377529c0SPaolo Bonzinimixemu="no"
167377529c0SPaolo Bonzinikerneldir=""
168377529c0SPaolo Bonziniaix="no"
169377529c0SPaolo Bonziniblobs="yes"
170377529c0SPaolo Bonzinipkgversion=""
171377529c0SPaolo Bonzinicheck_utests="no"
172377529c0SPaolo Bonziniuser_pie="no"
173377529c0SPaolo Bonzinizero_malloc=""
174377529c0SPaolo Bonzinitrace_backend="nop"
175377529c0SPaolo Bonzinitrace_file="trace"
176377529c0SPaolo Bonzinispice=""
177377529c0SPaolo Bonzinirbd=""
178377529c0SPaolo Bonzini
179ac0df51dSaliguori# parse CC options first
180ac0df51dSaliguorifor opt do
181ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
182ac0df51dSaliguori  case "$opt" in
183ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
184ac0df51dSaliguori  ;;
1853d8df640SPaolo Bonzini  --cc=*) CC="$optarg"
186ac0df51dSaliguori  ;;
187ca4deeb1SPaolo Bonzini  --source-path=*) source_path="$optarg"
188ca4deeb1SPaolo Bonzini  ;;
1892ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
1902ff6b91eSJuan Quintela  ;;
191a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
192e2a2ed06SJuan Quintela  ;;
193e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
194e2a2ed06SJuan Quintela  ;;
19550e7b1a0SJuan Quintela  --sparc_cpu=*)
19650e7b1a0SJuan Quintela    sparc_cpu="$optarg"
19750e7b1a0SJuan Quintela    case $sparc_cpu in
198ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
19950e7b1a0SJuan Quintela      cpu="sparc"
20050e7b1a0SJuan Quintela    ;;
20150e7b1a0SJuan Quintela    v9)
20250e7b1a0SJuan Quintela      cpu="sparc64"
20350e7b1a0SJuan Quintela    ;;
20450e7b1a0SJuan Quintela    *)
20550e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
20650e7b1a0SJuan Quintela      exit 1
20750e7b1a0SJuan Quintela    ;;
20850e7b1a0SJuan Quintela    esac
20950e7b1a0SJuan Quintela  ;;
210ac0df51dSaliguori  esac
211ac0df51dSaliguoridone
212ac0df51dSaliguori# OS specific
213ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
214ac0df51dSaliguori# we can eliminate it's usage altogether
215ac0df51dSaliguori
2163d8df640SPaolo Bonzinicc="${cross_prefix}${CC-gcc}"
2173d8df640SPaolo Bonziniar="${cross_prefix}${AR-ar}"
2183d8df640SPaolo Bonziniobjcopy="${cross_prefix}${OBJCOPY-objcopy}"
2193d8df640SPaolo Bonzinild="${cross_prefix}${LD-ld}"
2203d8df640SPaolo Bonzinistrip="${cross_prefix}${STRIP-strip}"
2213d8df640SPaolo Bonziniwindres="${cross_prefix}${WINDRES-windres}"
222a8bd70adSPaolo Bonzinipkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}"
2233ec87ffeSPaolo Bonzinisdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}"
224ac0df51dSaliguori
225be17dc90SMichael S. Tsirkin# default flags for all hosts
226be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
227be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS"
228be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
229be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
230be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
23184958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
232f9728943SPaolo BonziniQEMU_INCLUDES="-I. -I\$(SRC_PATH)"
233be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS"
234be17dc90SMichael S. Tsirkin
235ca4deeb1SPaolo Bonzini# make source path absolute
236ca4deeb1SPaolo Bonzinisource_path=`cd "$source_path"; pwd`
237ca4deeb1SPaolo Bonzini
238ac0df51dSaliguoricheck_define() {
239ac0df51dSaliguoricat > $TMPC <<EOF
240ac0df51dSaliguori#if !defined($1)
241ac0df51dSaliguori#error Not defined
242ac0df51dSaliguori#endif
243ac0df51dSaliguoriint main(void) { return 0; }
244ac0df51dSaliguoriEOF
24552166aa0SJuan Quintela  compile_object
246ac0df51dSaliguori}
247ac0df51dSaliguori
2482ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
2492ff6b91eSJuan Quintela  # command line argument
2502ff6b91eSJuan Quintela  :
2512ff6b91eSJuan Quintelaelif check_define __i386__ ; then
252ac0df51dSaliguori  cpu="i386"
253ac0df51dSaliguorielif check_define __x86_64__ ; then
254ac0df51dSaliguori  cpu="x86_64"
2553aa9bd6cSblueswir1elif check_define __sparc__ ; then
2563aa9bd6cSblueswir1  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
2573aa9bd6cSblueswir1  # They must be specified using --sparc_cpu
2583aa9bd6cSblueswir1  if check_define __arch64__ ; then
2593aa9bd6cSblueswir1    cpu="sparc64"
2603aa9bd6cSblueswir1  else
2613aa9bd6cSblueswir1    cpu="sparc"
2623aa9bd6cSblueswir1  fi
263fdf7ed96Smalcelif check_define _ARCH_PPC ; then
264fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
265fdf7ed96Smalc    cpu="ppc64"
266ac0df51dSaliguori  else
267fdf7ed96Smalc    cpu="ppc"
268fdf7ed96Smalc  fi
269afa05235SAurelien Jarnoelif check_define __mips__ ; then
270afa05235SAurelien Jarno  cpu="mips"
271477ba620SAurelien Jarnoelif check_define __ia64__ ; then
272477ba620SAurelien Jarno  cpu="ia64"
273d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
274d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
275d66ed0eaSAurelien Jarno    cpu="s390x"
276d66ed0eaSAurelien Jarno  else
277d66ed0eaSAurelien Jarno    cpu="s390"
278d66ed0eaSAurelien Jarno  fi
279fdf7ed96Smalcelse
280fdf7ed96Smalc  cpu=`uname -m`
281ac0df51dSaliguorifi
282ac0df51dSaliguori
2837d13299dSbellardcase "$cpu" in
284613a22c9SMichael Walle  alpha|cris|ia64|lm32|m68k|microblaze|ppc|ppc64|sparc64)
285ea8f20f8SJuan Quintela    cpu="$cpu"
286ea8f20f8SJuan Quintela  ;;
2877d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
28897a847bcSbellard    cpu="i386"
2897d13299dSbellard  ;;
290aaa5fa14Saurel32  x86_64|amd64)
291aaa5fa14Saurel32    cpu="x86_64"
292aaa5fa14Saurel32  ;;
293ba68055eSbellard  armv*b)
294808c4954Sbellard    cpu="armv4b"
295808c4954Sbellard  ;;
296ba68055eSbellard  armv*l)
2977d13299dSbellard    cpu="armv4l"
2987d13299dSbellard  ;;
299f54b3f92Saurel32  parisc|parisc64)
300f54b3f92Saurel32    cpu="hppa"
301f54b3f92Saurel32  ;;
302afa05235SAurelien Jarno  mips*)
303afa05235SAurelien Jarno    cpu="mips"
304afa05235SAurelien Jarno  ;;
30524e804ecSAlexander Graf  s390)
306fb3e5849Sbellard    cpu="s390"
307fb3e5849Sbellard  ;;
30824e804ecSAlexander Graf  s390x)
30924e804ecSAlexander Graf    cpu="s390x"
31024e804ecSAlexander Graf  ;;
3113142255cSblueswir1  sparc|sun4[cdmuv])
312ae228531Sbellard    cpu="sparc"
313ae228531Sbellard  ;;
3147d13299dSbellard  *)
315a447d4dcSPaolo Bonzini    echo "Unsupported CPU = $cpu"
316a447d4dcSPaolo Bonzini    exit 1
3177d13299dSbellard  ;;
3187d13299dSbellardesac
319e2d52ad3SJuan Quintela
3207d13299dSbellard# OS specific
321ac0df51dSaliguoriif check_define __linux__ ; then
322ac0df51dSaliguori  targetos="Linux"
323ac0df51dSaliguorielif check_define _WIN32 ; then
324ac0df51dSaliguori  targetos='MINGW32'
325169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
326169dc5d3Sblueswir1  targetos='OpenBSD'
327169dc5d3Sblueswir1elif check_define __sun__ ; then
328169dc5d3Sblueswir1  targetos='SunOS'
329179cf400SAndreas Färberelif check_define __HAIKU__ ; then
330179cf400SAndreas Färber  targetos='Haiku'
331ac0df51dSaliguorielse
3327d13299dSbellard  targetos=`uname -s`
333ac0df51dSaliguorifi
3340dbfc675SJuan Quintela
3357d13299dSbellardcase $targetos in
336c326e0afSbellardCYGWIN*)
337c326e0afSbellard  mingw32="yes"
338a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
339d5631638Smalc  audio_possible_drivers="winwave sdl"
340d5631638Smalc  audio_drv_list="winwave"
341c326e0afSbellard;;
34267b915a5SbellardMINGW32*)
34367b915a5Sbellard  mingw32="yes"
344d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
345d5631638Smalc  audio_drv_list="winwave"
34667b915a5Sbellard;;
3475c40d2bdSthsGNU/kFreeBSD)
348a167ba50SAurelien Jarno  bsd="yes"
3490c58ac1cSmalc  audio_drv_list="oss"
350f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3515c40d2bdSths;;
3527d3505c5SbellardFreeBSD)
3537d3505c5Sbellard  bsd="yes"
3540db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3550c58ac1cSmalc  audio_drv_list="oss"
356f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
357f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
358f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3597d3505c5Sbellard;;
360c5e97233Sblueswir1DragonFly)
361c5e97233Sblueswir1  bsd="yes"
3620db4a067SPaolo Bonzini  make="${MAKE-gmake}"
363c5e97233Sblueswir1  audio_drv_list="oss"
364c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
365c5e97233Sblueswir1;;
3667d3505c5SbellardNetBSD)
3677d3505c5Sbellard  bsd="yes"
3680db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3690c58ac1cSmalc  audio_drv_list="oss"
370c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3718ef92a88Sblueswir1  oss_lib="-lossaudio"
3727d3505c5Sbellard;;
3737d3505c5SbellardOpenBSD)
3747d3505c5Sbellard  bsd="yes"
3750db4a067SPaolo Bonzini  make="${MAKE-gmake}"
3760c58ac1cSmalc  audio_drv_list="oss"
377c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3782f6a1ab0Sblueswir1  oss_lib="-lossaudio"
3797d3505c5Sbellard;;
38083fb7adfSbellardDarwin)
38183fb7adfSbellard  bsd="yes"
38283fb7adfSbellard  darwin="yes"
3830dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
3840dbfc675SJuan Quintela  # run 64-bit userspace code
385aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
3861b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
387aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
3881b0f9cc2Saliguori  fi
3891b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
390a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
3910c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
3921b0f9cc2Saliguori  else
393a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
3941b0f9cc2Saliguori  fi
395831b7825Sths  darwin_user="yes"
396fd677642Sths  cocoa="yes"
3970c58ac1cSmalc  audio_drv_list="coreaudio"
398c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
3990c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4007973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
40183fb7adfSbellard;;
402ec530c81SbellardSunOS)
403ec530c81Sbellard  solaris="yes"
4040db4a067SPaolo Bonzini  make="${MAKE-gmake}"
4050db4a067SPaolo Bonzini  install="${INSTALL-ginstall}"
406fa58948dSBlue Swirl  ld="gld"
4070475a5caSths  needs_libsunmath="no"
408c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
409ef18c883Sths  # have to select again, because `uname -m` returns i86pc
410ef18c883Sths  # even on an x86_64 box.
411ef18c883Sths  solariscpu=`isainfo -k`
412ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
413ef18c883Sths    cpu="x86_64"
414ef18c883Sths  fi
415c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4160475a5caSths    if test "$solarisrev" -le 9 ; then
4170475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4180475a5caSths        needs_libsunmath="yes"
419f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
420f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
421f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4220475a5caSths      else
4230475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4240475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4250475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4260475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4270475a5caSths        exit 1
4280475a5caSths      fi
4290475a5caSths    fi
43086b2bd93Sths  fi
4316b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4320c58ac1cSmalc    audio_drv_list="oss"
4336b4d2ba1Sths  fi
434c2de5c91Smalc  audio_possible_drivers="oss sdl"
435d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
436d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
437d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
438d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
439a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
440e174c0bbSJuan Quintela  LIBS="-lsocket -lnsl -lresolv $LIBS"
441ec530c81Sbellard;;
442b29fe3edSmalcAIX)
443b29fe3edSmalc  aix="yes"
4440db4a067SPaolo Bonzini  make="${MAKE-gmake}"
445b29fe3edSmalc;;
446179cf400SAndreas FärberHaiku)
447179cf400SAndreas Färber  haiku="yes"
448179cf400SAndreas Färber  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS"
449179cf400SAndreas Färber  LIBS="-lposix_error_mapper -lnetwork $LIBS"
450179cf400SAndreas Färber;;
451fb065187Sbellard*)
4520c58ac1cSmalc  audio_drv_list="oss"
453b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4545327cf48Sbellard  linux="yes"
455831b7825Sths  linux_user="yes"
45668063649Sblueswir1  usb="linux"
45707f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
458c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
459c9ec1fe4Sbellard  fi
460fb065187Sbellard;;
4617d13299dSbellardesac
4627d13299dSbellard
4637d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
464b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
46568063649Sblueswir1    usb="bsd"
46683fb7adfSbellard  fi
46784778508Sblueswir1  bsd_user="yes"
4687d3505c5Sbellardfi
4697d3505c5Sbellard
4700db4a067SPaolo Bonzini: ${make=${MAKE-make}}
4710db4a067SPaolo Bonzini: ${install=${INSTALL-install}}
4720db4a067SPaolo Bonzini
4733457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
4743457a3f8SJuan Quintela  EXESUF=".exe"
475a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
476e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
477e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
47808f3896aSStefan Weil  LIBS="-lwinmm -lws2_32 -liberty -liphlpapi $LIBS"
479683035deSPaolo Bonzini  prefix="c:/Program Files/Qemu"
480683035deSPaolo Bonzini  mandir="\${prefix}"
481683035deSPaolo Bonzini  datadir="\${prefix}"
482683035deSPaolo Bonzini  docdir="\${prefix}"
483683035deSPaolo Bonzini  bindir="\${prefix}"
484683035deSPaolo Bonzini  sysconfdir="\${prefix}"
485683035deSPaolo Bonzini  confsuffix=""
4863457a3f8SJuan Quintelafi
4873457a3f8SJuan Quintela
488487fefdbSAnthony Liguoriwerror=""
48985aa5189Sbellard
4907d13299dSbellardfor opt do
491a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
4927d13299dSbellard  case "$opt" in
4932efc3265Sbellard  --help|-h) show_help=yes
4942efc3265Sbellard  ;;
495b1a550a0Spbrook  --prefix=*) prefix="$optarg"
4967d13299dSbellard  ;;
497b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
49832ce6337Sbellard  ;;
499ca4deeb1SPaolo Bonzini  --source-path=*)
5007d13299dSbellard  ;;
501ac0df51dSaliguori  --cross-prefix=*)
5027d13299dSbellard  ;;
503ac0df51dSaliguori  --cc=*)
5047d13299dSbellard  ;;
505b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
50683469015Sbellard  ;;
507b1a550a0Spbrook  --make=*) make="$optarg"
5087d13299dSbellard  ;;
5096a882643Spbrook  --install=*) install="$optarg"
5106a882643Spbrook  ;;
511e2a2ed06SJuan Quintela  --extra-cflags=*)
5127d13299dSbellard  ;;
513e2a2ed06SJuan Quintela  --extra-ldflags=*)
5147d13299dSbellard  ;;
5152ff6b91eSJuan Quintela  --cpu=*)
5167d13299dSbellard  ;;
517b1a550a0Spbrook  --target-list=*) target_list="$optarg"
518de83cd02Sbellard  ;;
51974242e0fSPaolo Bonzini  --enable-trace-backend=*) trace_backend="$optarg"
52094a420b1SStefan Hajnoczi  ;;
52174242e0fSPaolo Bonzini  --with-trace-file=*) trace_file="$optarg"
5229410b56cSPrerna Saxena  ;;
5237d13299dSbellard  --enable-gprof) gprof="yes"
5247d13299dSbellard  ;;
52579427693SLoïc Minier  --static)
52679427693SLoïc Minier    static="yes"
52779427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
52843ce4dfeSbellard  ;;
5290b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5300b24e75fSPaolo Bonzini  ;;
5310b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5320b24e75fSPaolo Bonzini  ;;
5330b24e75fSPaolo Bonzini  --datadir=*) datadir="$optarg"
5340b24e75fSPaolo Bonzini  ;;
5350b24e75fSPaolo Bonzini  --docdir=*) docdir="$optarg"
5360b24e75fSPaolo Bonzini  ;;
537ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
53807381cc1SAnthony Liguori  ;;
53997a847bcSbellard  --disable-sdl) sdl="no"
54097a847bcSbellard  ;;
541c4198157SJuan Quintela  --enable-sdl) sdl="yes"
542c4198157SJuan Quintela  ;;
543*821601eaSJes Sorensen  --disable-vnc) vnc="no"
544*821601eaSJes Sorensen  ;;
545*821601eaSJes Sorensen  --enable-vnc) vnc="yes"
546*821601eaSJes Sorensen  ;;
547b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
548102a52e4Sbellard  ;;
549c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
550c2de5c91Smalc  ;;
5512f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
5522f6a1ab0Sblueswir1  ;;
5532fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
5540c58ac1cSmalc  ;;
5550c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
5560c58ac1cSmalc  ;;
557eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
558eb852011SMarkus Armbruster  ;;
559f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
560f8393946Saurel32  ;;
561f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
562f8393946Saurel32  ;;
563b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
564b4475aa2SLuiz Capitulino  ;;
565b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
566b4475aa2SLuiz Capitulino  ;;
567f3d08ee6SPaul Brook  --enable-debug)
568f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
569f3d08ee6SPaul Brook      debug_tcg="yes"
570b4475aa2SLuiz Capitulino      debug_mon="yes"
571f3d08ee6SPaul Brook      debug="yes"
572f3d08ee6SPaul Brook      strip_opt="no"
573f3d08ee6SPaul Brook  ;;
57403b4fe7dSaliguori  --enable-sparse) sparse="yes"
57503b4fe7dSaliguori  ;;
57603b4fe7dSaliguori  --disable-sparse) sparse="no"
57703b4fe7dSaliguori  ;;
5781625af87Saliguori  --disable-strip) strip_opt="no"
5791625af87Saliguori  ;;
5808d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
5818d5d2d4cSths  ;;
5821be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
5831be10ad2SJuan Quintela  ;;
5842f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
5852f9606b3Saliguori  ;;
586ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
587ea784e3bSJuan Quintela  ;;
5882f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
5892f6f5c7aSCorentin Chary  ;;
5902f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
5912f6f5c7aSCorentin Chary  ;;
592efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
593efe556adSCorentin Chary  ;;
594efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
595efe556adSCorentin Chary  ;;
596bd023f95SCorentin Chary  --disable-vnc-thread) vnc_thread="no"
597bd023f95SCorentin Chary  ;;
598bd023f95SCorentin Chary  --enable-vnc-thread) vnc_thread="yes"
599bd023f95SCorentin Chary  ;;
600443f1376Sbellard  --disable-slirp) slirp="no"
601c20709aaSbellard  ;;
602ee682d27SStefan Weil  --disable-uuid) uuid="no"
603ee682d27SStefan Weil  ;;
604ee682d27SStefan Weil  --enable-uuid) uuid="yes"
605ee682d27SStefan Weil  ;;
606e0e6c8c0Saliguori  --disable-vde) vde="no"
6078a16d273Sths  ;;
608dfb278bdSJuan Quintela  --enable-vde) vde="yes"
609dfb278bdSJuan Quintela  ;;
610e37630caSaliguori  --disable-xen) xen="no"
611e37630caSaliguori  ;;
612fc321b4bSJuan Quintela  --enable-xen) xen="yes"
613fc321b4bSJuan Quintela  ;;
6142e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6152e4d9fb1Saurel32  ;;
6164ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6174ffcedb6SJuan Quintela  ;;
618fb599c9aSbalrog  --disable-bluez) bluez="no"
619fb599c9aSbalrog  ;;
620a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
621a20a6f46SJuan Quintela  ;;
6227ba1e619Saliguori  --disable-kvm) kvm="no"
6237ba1e619Saliguori  ;;
624b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
625b31a0277SJuan Quintela  ;;
626cd4ec0b4SGerd Hoffmann  --disable-spice) spice="no"
627cd4ec0b4SGerd Hoffmann  ;;
628cd4ec0b4SGerd Hoffmann  --enable-spice) spice="yes"
629cd4ec0b4SGerd Hoffmann  ;;
63005c2a3e7Sbellard  --enable-profiler) profiler="yes"
63105c2a3e7Sbellard  ;;
632c2de5c91Smalc  --enable-cocoa)
633c2de5c91Smalc      cocoa="yes" ;
634c2de5c91Smalc      sdl="no" ;
635c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
6365b0753e0Sbellard  ;;
637cad25d69Spbrook  --disable-system) softmmu="no"
6380a8e90f4Spbrook  ;;
639cad25d69Spbrook  --enable-system) softmmu="yes"
6400a8e90f4Spbrook  ;;
6410953a80fSZachary Amsden  --disable-user)
6420953a80fSZachary Amsden      linux_user="no" ;
6430953a80fSZachary Amsden      bsd_user="no" ;
6440953a80fSZachary Amsden      darwin_user="no"
6450953a80fSZachary Amsden  ;;
6460953a80fSZachary Amsden  --enable-user) ;;
647831b7825Sths  --disable-linux-user) linux_user="no"
6480a8e90f4Spbrook  ;;
649831b7825Sths  --enable-linux-user) linux_user="yes"
650831b7825Sths  ;;
651831b7825Sths  --disable-darwin-user) darwin_user="no"
652831b7825Sths  ;;
653831b7825Sths  --enable-darwin-user) darwin_user="yes"
6540a8e90f4Spbrook  ;;
65584778508Sblueswir1  --disable-bsd-user) bsd_user="no"
65684778508Sblueswir1  ;;
65784778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
65884778508Sblueswir1  ;;
659379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
660379f6698SPaul Brook  ;;
661379f6698SPaul Brook  --disable-guest-base) guest_base="no"
662379f6698SPaul Brook  ;;
66334005a00SKirill A. Shutemov  --enable-user-pie) user_pie="yes"
66434005a00SKirill A. Shutemov  ;;
66534005a00SKirill A. Shutemov  --disable-user-pie) user_pie="no"
66634005a00SKirill A. Shutemov  ;;
667c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
668c5937220Spbrook  ;;
6693142255cSblueswir1  --sparc_cpu=*)
6703142255cSblueswir1  ;;
67185aa5189Sbellard  --enable-werror) werror="yes"
67285aa5189Sbellard  ;;
67385aa5189Sbellard  --disable-werror) werror="no"
67485aa5189Sbellard  ;;
6754d3b6f6eSbalrog  --disable-curses) curses="no"
6764d3b6f6eSbalrog  ;;
677c584a6d0SJuan Quintela  --enable-curses) curses="yes"
678c584a6d0SJuan Quintela  ;;
679769ce76dSAlexander Graf  --disable-curl) curl="no"
680769ce76dSAlexander Graf  ;;
681788c8196SJuan Quintela  --enable-curl) curl="yes"
682788c8196SJuan Quintela  ;;
6832df87df7SJuan Quintela  --disable-fdt) fdt="no"
6842df87df7SJuan Quintela  ;;
6852df87df7SJuan Quintela  --enable-fdt) fdt="yes"
6862df87df7SJuan Quintela  ;;
6875495ed11SLuiz Capitulino  --disable-check-utests) check_utests="no"
6885495ed11SLuiz Capitulino  ;;
6895495ed11SLuiz Capitulino  --enable-check-utests) check_utests="yes"
6905495ed11SLuiz Capitulino  ;;
691bd0c5661Spbrook  --disable-nptl) nptl="no"
692bd0c5661Spbrook  ;;
693b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
694b0a47e79SJuan Quintela  ;;
6958ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
6968ff9cbf7Smalc  ;;
6975c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
6985c6c3a6cSChristoph Hellwig  ;;
6995c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
7005c6c3a6cSChristoph Hellwig  ;;
701758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
702758e8e38SVenkateswararao Jujjuri (JV)  ;;
703758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
704758e8e38SVenkateswararao Jujjuri (JV)  ;;
705e5d355d1Saliguori  --enable-io-thread) io_thread="yes"
706e5d355d1Saliguori  ;;
70777755340Sths  --disable-blobs) blobs="no"
70877755340Sths  ;;
709eac30262Saliguori  --kerneldir=*) kerneldir="$optarg"
710eac30262Saliguori  ;;
7114a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
7124a19f1ecSpbrook  ;;
713a25dba17SJuan Quintela  --disable-docs) docs="no"
71470ec5dc0SAnthony Liguori  ;;
715a25dba17SJuan Quintela  --enable-docs) docs="yes"
71683a3ab8bSJuan Quintela  ;;
717d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
718d5970055SMichael S. Tsirkin  ;;
719d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
720d5970055SMichael S. Tsirkin  ;;
7216bde81cbSPaolo Bonzini  --*dir)
7226bde81cbSPaolo Bonzini  ;;
723f27aaf4bSChristian Brunner  --disable-rbd) rbd="no"
724f27aaf4bSChristian Brunner  ;;
725f27aaf4bSChristian Brunner  --enable-rbd) rbd="yes"
726f27aaf4bSChristian Brunner  ;;
7277f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
7287f1559c6Sbalrog  ;;
7297d13299dSbellard  esac
7307d13299dSbellarddone
7317d13299dSbellard
7323142255cSblueswir1#
7333142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
734a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
7353142255cSblueswir1#
736379f6698SPaul Brookhost_guest_base="no"
73740293e58Sbellardcase "$cpu" in
738ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
739ed968ff1SJuan Quintela           v7|v8)
740a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
741ed968ff1SJuan Quintela           ;;
742ed968ff1SJuan Quintela           v8plus|v8plusa)
743a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
744ed968ff1SJuan Quintela           ;;
745ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
746a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
747ed968ff1SJuan Quintela           esac
7480c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
749a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
750762e8230Sblueswir1           if test "$solaris" = "no" ; then
751a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
752c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
753762e8230Sblueswir1           fi
7543142255cSblueswir1           ;;
755ed968ff1SJuan Quintela    sparc64)
756a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
7570c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
758a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
759ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
760a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
761762e8230Sblueswir1           fi
7623142255cSblueswir1           ;;
76376d83bdeSths    s390)
76428d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
76528d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
76648bb3750SRichard Henderson           host_guest_base="yes"
76728d7cc49SRichard Henderson           ;;
76828d7cc49SRichard Henderson    s390x)
76928d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
77028d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
77148bb3750SRichard Henderson           host_guest_base="yes"
77276d83bdeSths           ;;
77340293e58Sbellard    i386)
774a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
7750c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
7762b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
777c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
778379f6698SPaul Brook           host_guest_base="yes"
77940293e58Sbellard           ;;
78040293e58Sbellard    x86_64)
781a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
7820c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
7832b2e59e6SPaolo Bonzini           cc_i386='$(CC) -m32'
784379f6698SPaul Brook           host_guest_base="yes"
785379f6698SPaul Brook           ;;
786379f6698SPaul Brook    arm*)
787379f6698SPaul Brook           host_guest_base="yes"
78840293e58Sbellard           ;;
789f6548c0aSmalc    ppc*)
790f6548c0aSmalc           host_guest_base="yes"
791f6548c0aSmalc           ;;
792cc01cc8eSAurelien Jarno    mips*)
793cc01cc8eSAurelien Jarno           host_guest_base="yes"
794cc01cc8eSAurelien Jarno           ;;
795477ba620SAurelien Jarno    ia64*)
796477ba620SAurelien Jarno           host_guest_base="yes"
797477ba620SAurelien Jarno           ;;
798fd76e73aSRichard Henderson    hppa*)
799fd76e73aSRichard Henderson           host_guest_base="yes"
800fd76e73aSRichard Henderson           ;;
8013142255cSblueswir1esac
8023142255cSblueswir1
803379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
804379f6698SPaul Brook
805af5db58eSpbrookif test x"$show_help" = x"yes" ; then
806af5db58eSpbrookcat << EOF
807af5db58eSpbrook
808af5db58eSpbrookUsage: configure [options]
809af5db58eSpbrookOptions: [defaults in brackets after descriptions]
810af5db58eSpbrook
811af5db58eSpbrookEOF
812af5db58eSpbrookecho "Standard options:"
813af5db58eSpbrookecho "  --help                   print this message"
814af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
815af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
816af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
817af5db58eSpbrookecho "  --target-list=LIST       set target list [$target_list]"
818af5db58eSpbrookecho ""
819af5db58eSpbrookecho "Advanced options (experts only):"
820af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
821af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
822af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
8230bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
8240bfe8cc0SPaolo Bonziniecho "                           build time"
825a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
826e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
827af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
8286a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
829af5db58eSpbrookecho "  --static                 enable static build [$static]"
8300b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
8310b24e75fSPaolo Bonziniecho "  --datadir=PATH           install firmware in PATH"
8320b24e75fSPaolo Bonziniecho "  --docdir=PATH            install documentation in PATH"
8330b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
8340b24e75fSPaolo Bonziniecho "  --sysconfdir=PATH        install config in PATH/qemu"
835f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
836f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
83709695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
838890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
839890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
8401625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
84185aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
842fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
843c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
844*821601eaSJes Sorensenecho "  --disable-vnc            disable VNC"
845*821601eaSJes Sorensenecho "  --enable-vnc             enable VNC"
846af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
847c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
848c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
8494c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
8504c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
851eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
852eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
8538ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
854e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
855fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
8562e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
8574ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
8588d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
8591be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
8602f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
861ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
8622f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
8632f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
86496763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
865efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
866bd023f95SCorentin Charyecho "  --disable-vnc-thread     disable threaded VNC server"
867bd023f95SCorentin Charyecho "  --enable-vnc-thread      enable threaded VNC server"
868af896aaaSpbrookecho "  --disable-curses         disable curses output"
869c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
870769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
871788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
8722df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
8732df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
8745495ed11SLuiz Capitulinoecho "  --disable-check-utests   disable check unit-tests"
8755495ed11SLuiz Capitulinoecho "  --enable-check-utests    enable check unit-tests"
876fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
877a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
8787ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
879b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
880bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
881e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
882af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
883af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
8840953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
8850953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
886831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
887831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
888831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
889831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
89084778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
89184778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
892379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
893379f6698SPaul Brookecho "                           emulation targets"
894379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
89534005a00SKirill A. Shutemovecho "  --enable-user-pie        build usermode emulation targets as PIE"
89634005a00SKirill A. Shutemovecho "  --disable-user-pie       do not build usermode emulation targets as PIE"
897af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
898af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
8992f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
900c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
9013142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
902ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
903ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
904e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
905dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
9065c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
9075c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
908758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
909758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
910e5d355d1Saliguoriecho "  --enable-io-thread       enable IO thread"
91177755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
912eac30262Saliguoriecho "  --kerneldir=PATH         look for kernel includes in PATH"
913d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
914d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
915d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
916d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
917320fba2aSFabien Chouteauecho "  --enable-trace-backend=B Set trace backend"
918320fba2aSFabien Chouteauecho "                           Available backends:" $("$source_path"/scripts/tracetool --list-backends)
91974242e0fSPaolo Bonziniecho "  --with-trace-file=NAME   Full PATH,NAME of file to store traces"
9209410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
921cd4ec0b4SGerd Hoffmannecho "  --disable-spice          disable spice"
922cd4ec0b4SGerd Hoffmannecho "  --enable-spice           enable spice"
923f27aaf4bSChristian Brunnerecho "  --enable-rbd             enable building the rados block device (rbd)"
924af5db58eSpbrookecho ""
9255bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
926af5db58eSpbrookexit 1
927af5db58eSpbrookfi
928af5db58eSpbrook
9298d05095cSPaolo Bonzini# check that the C compiler works.
9308d05095cSPaolo Bonzinicat > $TMPC <<EOF
9318d05095cSPaolo Bonziniint main(void) {}
9328d05095cSPaolo BonziniEOF
9338d05095cSPaolo Bonzini
9348d05095cSPaolo Bonziniif compile_object ; then
9358d05095cSPaolo Bonzini  : C compiler works ok
9368d05095cSPaolo Bonzinielse
9378d05095cSPaolo Bonzini    echo "ERROR: \"$cc\" either does not exist or does not work"
9388d05095cSPaolo Bonzini    exit 1
9398d05095cSPaolo Bonzinifi
9408d05095cSPaolo Bonzini
9418d05095cSPaolo Bonzinigcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
9428d05095cSPaolo Bonzinigcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
9438d05095cSPaolo Bonzinigcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
9448d05095cSPaolo Bonzinigcc_flags="-fstack-protector-all $gcc_flags"
9458d05095cSPaolo Bonzinicat > $TMPC << EOF
9468d05095cSPaolo Bonziniint main(void) { return 0; }
9478d05095cSPaolo BonziniEOF
9488d05095cSPaolo Bonzinifor flag in $gcc_flags; do
9498d05095cSPaolo Bonzini    if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
9508d05095cSPaolo Bonzini	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
9518d05095cSPaolo Bonzini    fi
9528d05095cSPaolo Bonzinidone
9538d05095cSPaolo Bonzini
954ec530c81Sbellard#
955ec530c81Sbellard# Solaris specific configure tool chain decisions
956ec530c81Sbellard#
957ec530c81Sbellardif test "$solaris" = "yes" ; then
9586792aa11SLoïc Minier  if has $install; then
9596792aa11SLoïc Minier    :
9606792aa11SLoïc Minier  else
961ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
962ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
963ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
964ec530c81Sbellard    exit 1
965ec530c81Sbellard  fi
9666792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
967ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
968ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
969ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
970ec530c81Sbellard    exit 1
971ec530c81Sbellard  fi
9726792aa11SLoïc Minier  if has ar; then
9736792aa11SLoïc Minier    :
9746792aa11SLoïc Minier  else
975ec530c81Sbellard    echo "Error: No path includes ar"
976ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
977ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
978ec530c81Sbellard    fi
979ec530c81Sbellard    exit 1
980ec530c81Sbellard  fi
981ec530c81Sbellardfi
982ec530c81Sbellard
983ec530c81Sbellard
9845327cf48Sbellardif test -z "$target_list" ; then
9855327cf48Sbellard# these targets are portable
9860a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
9872408a527Saurel32        target_list="\
9882408a527Saurel32i386-softmmu \
9892408a527Saurel32x86_64-softmmu \
9902408a527Saurel32arm-softmmu \
9912408a527Saurel32cris-softmmu \
992613a22c9SMichael Wallelm32-softmmu \
9932408a527Saurel32m68k-softmmu \
99472b675caSEdgar E. Iglesiasmicroblaze-softmmu \
995877fdc12SEdgar E. Iglesiasmicroblazeel-softmmu \
9962408a527Saurel32mips-softmmu \
9972408a527Saurel32mipsel-softmmu \
9982408a527Saurel32mips64-softmmu \
9992408a527Saurel32mips64el-softmmu \
10002408a527Saurel32ppc-softmmu \
10012408a527Saurel32ppcemb-softmmu \
10022408a527Saurel32ppc64-softmmu \
10032408a527Saurel32sh4-softmmu \
10042408a527Saurel32sh4eb-softmmu \
10052408a527Saurel32sparc-softmmu \
10061b64fcaeSIgor V. Kovalenkosparc64-softmmu \
10072408a527Saurel32"
10080a8e90f4Spbrook    fi
10095327cf48Sbellard# the following are Linux specific
1010831b7825Sths    if [ "$linux_user" = "yes" ] ; then
10112408a527Saurel32        target_list="${target_list}\
10122408a527Saurel32i386-linux-user \
10132408a527Saurel32x86_64-linux-user \
10142408a527Saurel32alpha-linux-user \
10152408a527Saurel32arm-linux-user \
10162408a527Saurel32armeb-linux-user \
10172408a527Saurel32cris-linux-user \
10182408a527Saurel32m68k-linux-user \
101972b675caSEdgar E. Iglesiasmicroblaze-linux-user \
1020877fdc12SEdgar E. Iglesiasmicroblazeel-linux-user \
10212408a527Saurel32mips-linux-user \
10222408a527Saurel32mipsel-linux-user \
10232408a527Saurel32ppc-linux-user \
10242408a527Saurel32ppc64-linux-user \
10252408a527Saurel32ppc64abi32-linux-user \
10262408a527Saurel32sh4-linux-user \
10272408a527Saurel32sh4eb-linux-user \
10282408a527Saurel32sparc-linux-user \
10292408a527Saurel32sparc64-linux-user \
10302408a527Saurel32sparc32plus-linux-user \
10312408a527Saurel32"
1032831b7825Sths    fi
1033831b7825Sths# the following are Darwin specific
1034831b7825Sths    if [ "$darwin_user" = "yes" ] ; then
10352408a527Saurel32        target_list="$target_list i386-darwin-user ppc-darwin-user "
10365327cf48Sbellard    fi
103784778508Sblueswir1# the following are BSD specific
103884778508Sblueswir1    if [ "$bsd_user" = "yes" ] ; then
103984778508Sblueswir1        target_list="${target_list}\
104031fc12dfSblueswir1i386-bsd-user \
104131fc12dfSblueswir1x86_64-bsd-user \
104231fc12dfSblueswir1sparc-bsd-user \
104384778508Sblueswir1sparc64-bsd-user \
104484778508Sblueswir1"
104584778508Sblueswir1    fi
10466e20a45fSbellardelse
1047b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
10485327cf48Sbellardfi
10490a8e90f4Spbrookif test -z "$target_list" ; then
10500a8e90f4Spbrook    echo "No targets enabled"
10510a8e90f4Spbrook    exit 1
10520a8e90f4Spbrookfi
1053f55fe278SPaolo Bonzini# see if system emulation was really requested
1054f55fe278SPaolo Bonzinicase " $target_list " in
1055f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1056f55fe278SPaolo Bonzini  ;;
1057f55fe278SPaolo Bonzini  *) softmmu=no
1058f55fe278SPaolo Bonzini  ;;
1059f55fe278SPaolo Bonziniesac
10605327cf48Sbellard
1061249247c9SJuan Quintelafeature_not_found() {
1062249247c9SJuan Quintela  feature=$1
1063249247c9SJuan Quintela
1064249247c9SJuan Quintela  echo "ERROR"
1065249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
10669332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1067249247c9SJuan Quintela  echo "ERROR"
1068249247c9SJuan Quintela  exit 1;
1069249247c9SJuan Quintela}
1070249247c9SJuan Quintela
10717d13299dSbellardif test -z "$cross_prefix" ; then
10727d13299dSbellard
10737d13299dSbellard# ---
10747d13299dSbellard# big/little endian test
10757d13299dSbellardcat > $TMPC << EOF
10767d13299dSbellard#include <inttypes.h>
10777d13299dSbellardint main(int argc, char ** argv){
10787d13299dSbellard        volatile uint32_t i=0x01234567;
10797d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
10807d13299dSbellard}
10817d13299dSbellardEOF
10827d13299dSbellard
108352166aa0SJuan Quintelaif compile_prog "" "" ; then
10847d13299dSbellard$TMPE && bigendian="yes"
10857d13299dSbellardelse
10867d13299dSbellardecho big/little test failed
10877d13299dSbellardfi
10887d13299dSbellard
10897d13299dSbellardelse
10907d13299dSbellard
10917d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1092ea8f20f8SJuan Quintelacase "$cpu" in
109324e804ecSAlexander Graf  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1094ea8f20f8SJuan Quintela    bigendian=yes
1095ea8f20f8SJuan Quintela  ;;
1096ea8f20f8SJuan Quintelaesac
10977d13299dSbellard
10987d13299dSbellardfi
10997d13299dSbellard
110070be1a2eSPaolo Bonzini# host long bits test, actually a pointer size test
110170be1a2eSPaolo Bonzinicat > $TMPC << EOF
110270be1a2eSPaolo Bonziniint sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1];
110370be1a2eSPaolo BonziniEOF
110470be1a2eSPaolo Bonziniif compile_object; then
1105ea8f20f8SJuan Quintelahostlongbits=64
110670be1a2eSPaolo Bonzinielse
110770be1a2eSPaolo Bonzinihostlongbits=32
110870be1a2eSPaolo Bonzinifi
1109b6853697Sbellard
1110b0a47e79SJuan Quintela
1111b0a47e79SJuan Quintela##########################################
1112b0a47e79SJuan Quintela# NPTL probe
1113b0a47e79SJuan Quintela
1114b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1115bd0c5661Spbrook  cat > $TMPC <<EOF
1116bd0c5661Spbrook#include <sched.h>
111730813ceaSpbrook#include <linux/futex.h>
1118bd0c5661Spbrookvoid foo()
1119bd0c5661Spbrook{
1120bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1121bd0c5661Spbrook#error bork
1122bd0c5661Spbrook#endif
1123bd0c5661Spbrook}
1124bd0c5661SpbrookEOF
1125bd0c5661Spbrook
112652166aa0SJuan Quintela  if compile_object ; then
1127b0a47e79SJuan Quintela    nptl=yes
1128bd0c5661Spbrook  else
1129b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1130b0a47e79SJuan Quintela      feature_not_found "nptl"
1131b0a47e79SJuan Quintela    fi
1132b0a47e79SJuan Quintela    nptl=no
1133b0a47e79SJuan Quintela  fi
1134bd0c5661Spbrookfi
1135bd0c5661Spbrook
113611d9f695Sbellard##########################################
1137ac62922eSbalrog# zlib check
1138ac62922eSbalrog
1139ac62922eSbalrogcat > $TMPC << EOF
1140ac62922eSbalrog#include <zlib.h>
1141ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1142ac62922eSbalrogEOF
114352166aa0SJuan Quintelaif compile_prog "" "-lz" ; then
1144ac62922eSbalrog    :
1145ac62922eSbalrogelse
1146ac62922eSbalrog    echo
1147ac62922eSbalrog    echo "Error: zlib check failed"
1148ac62922eSbalrog    echo "Make sure to have the zlib libs and headers installed."
1149ac62922eSbalrog    echo
1150ac62922eSbalrog    exit 1
1151ac62922eSbalrogfi
1152ac62922eSbalrog
1153ac62922eSbalrog##########################################
1154e37630caSaliguori# xen probe
1155e37630caSaliguori
1156fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1157b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1158e37630caSaliguori  cat > $TMPC <<EOF
1159e37630caSaliguori#include <xenctrl.h>
1160e37630caSaliguori#include <xs.h>
1161df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1162e37630caSaliguoriEOF
116352166aa0SJuan Quintela  if compile_prog "" "$xen_libs" ; then
1164fc321b4bSJuan Quintela    xen=yes
11653efd632bSJuan Quintela    libs_softmmu="$xen_libs $libs_softmmu"
1166e37630caSaliguori  else
1167fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
1168fc321b4bSJuan Quintela      feature_not_found "xen"
1169fc321b4bSJuan Quintela    fi
1170fc321b4bSJuan Quintela    xen=no
1171e37630caSaliguori  fi
1172e37630caSaliguorifi
1173e37630caSaliguori
1174e37630caSaliguori##########################################
1175a8bd70adSPaolo Bonzini# pkg-config probe
1176f91672e5SPaolo Bonzini
1177a8bd70adSPaolo Bonziniif ! has $pkg_config; then
117808421541SPaolo Bonzini  echo warning: proceeding without "$pkg_config" >&2
117908421541SPaolo Bonzini  pkg_config=/bin/false
1180f91672e5SPaolo Bonzinifi
1181f91672e5SPaolo Bonzini
1182f91672e5SPaolo Bonzini##########################################
1183dfffc653SJuan Quintela# Sparse probe
1184dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
11850dba6195SLoïc Minier  if has cgcc; then
1186dfffc653SJuan Quintela    sparse=yes
1187dfffc653SJuan Quintela  else
1188dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1189dfffc653SJuan Quintela      feature_not_found "sparse"
1190dfffc653SJuan Quintela    fi
1191dfffc653SJuan Quintela    sparse=no
1192dfffc653SJuan Quintela  fi
1193dfffc653SJuan Quintelafi
1194dfffc653SJuan Quintela
1195dfffc653SJuan Quintela##########################################
119611d9f695Sbellard# SDL probe
119711d9f695Sbellard
11983ec87ffeSPaolo Bonzini# Look for sdl configuration program (pkg-config or sdl-config).  Try
11993ec87ffeSPaolo Bonzini# sdl-config even without cross prefix, and favour pkg-config over sdl-config.
12003ec87ffeSPaolo Bonziniif test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then
12013ec87ffeSPaolo Bonzini  sdl_config=sdl-config
12023ec87ffeSPaolo Bonzinifi
12033ec87ffeSPaolo Bonzini
12043ec87ffeSPaolo Bonziniif $pkg_config sdl --modversion >/dev/null 2>&1; then
1205a8bd70adSPaolo Bonzini  sdlconfig="$pkg_config sdl"
1206fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
12073ec87ffeSPaolo Bonzinielif has ${sdl_config}; then
12083ec87ffeSPaolo Bonzini  sdlconfig="$sdl_config"
12099316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1210a0dfd8a4SLoïc Minierelse
1211a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1212a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1213a0dfd8a4SLoïc Minier  fi
1214a0dfd8a4SLoïc Minier  sdl=no
12159316f803SPaolo Bonzinifi
12163ec87ffeSPaolo Bonziniif test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then
12173ec87ffeSPaolo Bonzini  echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2
12183ec87ffeSPaolo Bonzinifi
121911d9f695Sbellard
12209316f803SPaolo Bonzinisdl_too_old=no
1221c4198157SJuan Quintelaif test "$sdl" != "no" ; then
122211d9f695Sbellard  cat > $TMPC << EOF
122311d9f695Sbellard#include <SDL.h>
122411d9f695Sbellard#undef main /* We don't want SDL to override our main() */
122511d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
122611d9f695SbellardEOF
12279316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
122874f42e18STeLeMan  if test "$static" = "yes" ; then
122974f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
123074f42e18STeLeMan  else
12319316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
123274f42e18STeLeMan  fi
123352166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
123411d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
123511d9f695Sbellard      sdl_too_old=yes
123611d9f695Sbellard    else
1237fd677642Sths      if test "$cocoa" = "no" ; then
123811d9f695Sbellard        sdl=yes
123911d9f695Sbellard      fi
1240fd677642Sths    fi
12417c1f25b4Sbellard
124267c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
12431ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
124467c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1245f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1246f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
124711d9f695Sbellard      fi
124852166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
12491ac88f28SJuan Quintela	:
12501ac88f28SJuan Quintela      else
12511ac88f28SJuan Quintela        sdl=no
12527c1f25b4Sbellard      fi
12537c1f25b4Sbellard    fi # static link
1254c4198157SJuan Quintela  else # sdl not found
1255c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1256c4198157SJuan Quintela      feature_not_found "sdl"
1257c4198157SJuan Quintela    fi
1258c4198157SJuan Quintela    sdl=no
12597c1f25b4Sbellard  fi # sdl compile test
1260fd677642Sthsfi
126111d9f695Sbellard
12625368a422Saliguoriif test "$sdl" = "yes" ; then
12635368a422Saliguori  cat > $TMPC <<EOF
12645368a422Saliguori#include <SDL.h>
12655368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
12665368a422Saliguori#include <X11/XKBlib.h>
12675368a422Saliguori#else
12685368a422Saliguori#error No x11 support
12695368a422Saliguori#endif
12705368a422Saliguoriint main(void) { return 0; }
12715368a422SaliguoriEOF
127252166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1273681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
12745368a422Saliguori  fi
127507d9ac44SJuan Quintela  if test "$mingw32" = "yes" ; then
127607d9ac44SJuan Quintela    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
127707d9ac44SJuan Quintela  fi
12780705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
12795368a422Saliguorifi
12805368a422Saliguori
12818f28f3fbSths##########################################
12828d5d2d4cSths# VNC TLS detection
1283*821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_tls" != "no" ; then
1284ae6b5e5aSaliguori  cat > $TMPC <<EOF
1285ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1286ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1287ae6b5e5aSaliguoriEOF
1288a8bd70adSPaolo Bonzini  vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null`
1289a8bd70adSPaolo Bonzini  vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null`
129052166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
12911be10ad2SJuan Quintela    vnc_tls=yes
1292a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1293ae6b5e5aSaliguori  else
12941be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
12951be10ad2SJuan Quintela      feature_not_found "vnc-tls"
12961be10ad2SJuan Quintela    fi
12971be10ad2SJuan Quintela    vnc_tls=no
12988d5d2d4cSths  fi
12998d5d2d4cSthsfi
13008d5d2d4cSths
13018d5d2d4cSths##########################################
13022f9606b3Saliguori# VNC SASL detection
1303*821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_sasl" != "no" ; then
13042f9606b3Saliguori  cat > $TMPC <<EOF
13052f9606b3Saliguori#include <sasl/sasl.h>
13062f9606b3Saliguori#include <stdio.h>
13072f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
13082f9606b3SaliguoriEOF
13092f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
13102f9606b3Saliguori  vnc_sasl_cflags=""
13112f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
131252166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1313ea784e3bSJuan Quintela    vnc_sasl=yes
1314fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
13152f9606b3Saliguori  else
1316ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1317ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1318ea784e3bSJuan Quintela    fi
1319ea784e3bSJuan Quintela    vnc_sasl=no
13202f9606b3Saliguori  fi
13212f9606b3Saliguorifi
13222f9606b3Saliguori
13232f9606b3Saliguori##########################################
13242f6f5c7aSCorentin Chary# VNC JPEG detection
1325*821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_jpeg" != "no" ; then
13262f6f5c7aSCorentin Charycat > $TMPC <<EOF
13272f6f5c7aSCorentin Chary#include <stdio.h>
13282f6f5c7aSCorentin Chary#include <jpeglib.h>
13292f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
13302f6f5c7aSCorentin CharyEOF
13312f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
13322f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
13332f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
13342f6f5c7aSCorentin Chary    vnc_jpeg=yes
13352f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
13362f6f5c7aSCorentin Chary  else
13372f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
13382f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
13392f6f5c7aSCorentin Chary    fi
13402f6f5c7aSCorentin Chary    vnc_jpeg=no
13412f6f5c7aSCorentin Chary  fi
13422f6f5c7aSCorentin Charyfi
13432f6f5c7aSCorentin Chary
13442f6f5c7aSCorentin Chary##########################################
1345efe556adSCorentin Chary# VNC PNG detection
1346*821601eaSJes Sorensenif test "$vnc" = "yes" -a "$vnc_png" != "no" ; then
1347efe556adSCorentin Charycat > $TMPC <<EOF
1348efe556adSCorentin Chary//#include <stdio.h>
1349efe556adSCorentin Chary#include <png.h>
1350832ce9c2SScott Wood#include <stddef.h>
1351efe556adSCorentin Charyint main(void) {
1352efe556adSCorentin Chary    png_structp png_ptr;
1353efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1354efe556adSCorentin Chary    return 0;
1355efe556adSCorentin Chary}
1356efe556adSCorentin CharyEOF
1357efe556adSCorentin Chary    vnc_png_cflags=""
1358efe556adSCorentin Chary    vnc_png_libs="-lpng"
1359efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1360efe556adSCorentin Chary    vnc_png=yes
1361efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
1362efe556adSCorentin Chary  else
1363efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1364efe556adSCorentin Chary      feature_not_found "vnc-png"
1365efe556adSCorentin Chary    fi
1366efe556adSCorentin Chary    vnc_png=no
1367efe556adSCorentin Chary  fi
1368efe556adSCorentin Charyfi
1369efe556adSCorentin Chary
1370efe556adSCorentin Chary##########################################
137176655d6dSaliguori# fnmatch() probe, used for ACL routines
137276655d6dSaliguorifnmatch="no"
137376655d6dSaliguoricat > $TMPC << EOF
137476655d6dSaliguori#include <fnmatch.h>
137576655d6dSaliguoriint main(void)
137676655d6dSaliguori{
137776655d6dSaliguori    fnmatch("foo", "foo", 0);
137876655d6dSaliguori    return 0;
137976655d6dSaliguori}
138076655d6dSaliguoriEOF
138152166aa0SJuan Quintelaif compile_prog "" "" ; then
138276655d6dSaliguori   fnmatch="yes"
138376655d6dSaliguorifi
138476655d6dSaliguori
138576655d6dSaliguori##########################################
1386ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1387ee682d27SStefan Weilif test "$uuid" != "no" ; then
1388ee682d27SStefan Weil  uuid_libs="-luuid"
1389ee682d27SStefan Weil  cat > $TMPC << EOF
1390ee682d27SStefan Weil#include <uuid/uuid.h>
1391ee682d27SStefan Weilint main(void)
1392ee682d27SStefan Weil{
1393ee682d27SStefan Weil    uuid_t my_uuid;
1394ee682d27SStefan Weil    uuid_generate(my_uuid);
1395ee682d27SStefan Weil    return 0;
1396ee682d27SStefan Weil}
1397ee682d27SStefan WeilEOF
1398ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1399ee682d27SStefan Weil    uuid="yes"
1400ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1401ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1402ee682d27SStefan Weil  else
1403ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1404ee682d27SStefan Weil      feature_not_found "uuid"
1405ee682d27SStefan Weil    fi
1406ee682d27SStefan Weil    uuid=no
1407ee682d27SStefan Weil  fi
1408ee682d27SStefan Weilfi
1409ee682d27SStefan Weil
1410ee682d27SStefan Weil##########################################
1411dce512deSChristoph Hellwig# xfsctl() probe, used for raw-posix
1412dce512deSChristoph Hellwigif test "$xfs" != "no" ; then
1413dce512deSChristoph Hellwig  cat > $TMPC << EOF
1414dce512deSChristoph Hellwig#include <xfs/xfs.h>
1415dce512deSChristoph Hellwigint main(void)
1416dce512deSChristoph Hellwig{
1417dce512deSChristoph Hellwig    xfsctl(NULL, 0, 0, NULL);
1418dce512deSChristoph Hellwig    return 0;
1419dce512deSChristoph Hellwig}
1420dce512deSChristoph HellwigEOF
1421dce512deSChristoph Hellwig  if compile_prog "" "" ; then
1422dce512deSChristoph Hellwig    xfs="yes"
1423dce512deSChristoph Hellwig  else
1424dce512deSChristoph Hellwig    if test "$xfs" = "yes" ; then
1425dce512deSChristoph Hellwig      feature_not_found "xfs"
1426dce512deSChristoph Hellwig    fi
1427dce512deSChristoph Hellwig    xfs=no
1428dce512deSChristoph Hellwig  fi
1429dce512deSChristoph Hellwigfi
1430dce512deSChristoph Hellwig
1431dce512deSChristoph Hellwig##########################################
14328a16d273Sths# vde libraries probe
1433dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
14344baae0acSJuan Quintela  vde_libs="-lvdeplug"
14358a16d273Sths  cat > $TMPC << EOF
14368a16d273Sths#include <libvdeplug.h>
14374a7f0e06Spbrookint main(void)
14384a7f0e06Spbrook{
14394a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
14404a7f0e06Spbrook    vde_open("", "", &a);
14414a7f0e06Spbrook    return 0;
14424a7f0e06Spbrook}
14438a16d273SthsEOF
144452166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
14454baae0acSJuan Quintela    vde=yes
14468e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
14478e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1448dfb278bdSJuan Quintela  else
1449dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1450dfb278bdSJuan Quintela      feature_not_found "vde"
1451dfb278bdSJuan Quintela    fi
1452dfb278bdSJuan Quintela    vde=no
14538a16d273Sths  fi
14548a16d273Sthsfi
14558a16d273Sths
14568a16d273Sths##########################################
1457c2de5c91Smalc# Sound support libraries probe
14588f28f3fbSths
1459c2de5c91Smalcaudio_drv_probe()
1460c2de5c91Smalc{
1461c2de5c91Smalc    drv=$1
1462c2de5c91Smalc    hdr=$2
1463c2de5c91Smalc    lib=$3
1464c2de5c91Smalc    exp=$4
1465c2de5c91Smalc    cfl=$5
14668f28f3fbSths        cat > $TMPC << EOF
1467c2de5c91Smalc#include <$hdr>
1468c2de5c91Smalcint main(void) { $exp }
14698f28f3fbSthsEOF
147052166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
14718f28f3fbSths        :
14728f28f3fbSths    else
14738f28f3fbSths        echo
1474c2de5c91Smalc        echo "Error: $drv check failed"
1475c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
14768f28f3fbSths        echo
14778f28f3fbSths        exit 1
14788f28f3fbSths    fi
1479c2de5c91Smalc}
1480c2de5c91Smalc
14812fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1482c2de5c91Smalcfor drv in $audio_drv_list; do
1483c2de5c91Smalc    case $drv in
1484c2de5c91Smalc    alsa)
1485c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1486c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1487a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1488c2de5c91Smalc    ;;
1489c2de5c91Smalc
1490c2de5c91Smalc    fmod)
1491c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1492c2de5c91Smalc        echo
1493c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1494c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1495c2de5c91Smalc        echo
1496c2de5c91Smalc        exit 1
14978f28f3fbSths    fi
1498c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1499a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1500c2de5c91Smalc    ;;
1501c2de5c91Smalc
1502c2de5c91Smalc    esd)
1503c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1504a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
150567f86e8eSJuan Quintela    audio_pt_int="yes"
1506c2de5c91Smalc    ;;
1507b8e59f18Smalc
1508b8e59f18Smalc    pa)
1509493abda6SAurelien Jarno    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1510b8e59f18Smalc        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1511493abda6SAurelien Jarno    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
151267f86e8eSJuan Quintela    audio_pt_int="yes"
1513b8e59f18Smalc    ;;
1514b8e59f18Smalc
1515997e690aSJuan Quintela    coreaudio)
1516997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1517997e690aSJuan Quintela    ;;
1518997e690aSJuan Quintela
1519a4bf6780SJuan Quintela    dsound)
1520a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1521d5631638Smalc      audio_win_int="yes"
1522a4bf6780SJuan Quintela    ;;
1523a4bf6780SJuan Quintela
1524a4bf6780SJuan Quintela    oss)
1525a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1526a4bf6780SJuan Quintela    ;;
1527a4bf6780SJuan Quintela
1528a4bf6780SJuan Quintela    sdl|wav)
15292f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
15302f6a1ab0Sblueswir1    ;;
15312f6a1ab0Sblueswir1
1532d5631638Smalc    winwave)
1533d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1534d5631638Smalc      audio_win_int="yes"
1535d5631638Smalc    ;;
1536d5631638Smalc
1537e4c63a6aSmalc    *)
15381c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1539e4c63a6aSmalc        echo
1540e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1541e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1542e4c63a6aSmalc        echo
1543e4c63a6aSmalc        exit 1
1544e4c63a6aSmalc    }
1545e4c63a6aSmalc    ;;
1546c2de5c91Smalc    esac
1547c2de5c91Smalcdone
15488f28f3fbSths
15494d3b6f6eSbalrog##########################################
15502e4d9fb1Saurel32# BrlAPI probe
15512e4d9fb1Saurel32
15524ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1553eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
15542e4d9fb1Saurel32  cat > $TMPC << EOF
15552e4d9fb1Saurel32#include <brlapi.h>
1556832ce9c2SScott Wood#include <stddef.h>
15572e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
15582e4d9fb1Saurel32EOF
155952166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
15602e4d9fb1Saurel32    brlapi=yes
1561264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
15624ffcedb6SJuan Quintela  else
15634ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
15644ffcedb6SJuan Quintela      feature_not_found "brlapi"
15654ffcedb6SJuan Quintela    fi
15664ffcedb6SJuan Quintela    brlapi=no
1567eb82284fSJuan Quintela  fi
1568eb82284fSJuan Quintelafi
15692e4d9fb1Saurel32
15702e4d9fb1Saurel32##########################################
15714d3b6f6eSbalrog# curses probe
1572e095e2f3SStefan Weilif test "$mingw32" = "yes" ; then
1573e095e2f3SStefan Weil    curses_list="-lpdcurses"
1574e095e2f3SStefan Weilelse
15754f78ef9aSJuan Quintela    curses_list="-lncurses -lcurses"
1576e095e2f3SStefan Weilfi
15774d3b6f6eSbalrog
1578c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1579c584a6d0SJuan Quintela  curses_found=no
15804d3b6f6eSbalrog  cat > $TMPC << EOF
15814d3b6f6eSbalrog#include <curses.h>
15825a8ff3aaSblueswir1#ifdef __OpenBSD__
15835a8ff3aaSblueswir1#define resize_term resizeterm
15845a8ff3aaSblueswir1#endif
15855a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); }
15864d3b6f6eSbalrogEOF
15874f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
15884f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1589c584a6d0SJuan Quintela      curses_found=yes
15904f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
15914f78ef9aSJuan Quintela      break
15924d3b6f6eSbalrog    fi
15934f78ef9aSJuan Quintela  done
1594c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1595c584a6d0SJuan Quintela    curses=yes
1596c584a6d0SJuan Quintela  else
1597c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1598c584a6d0SJuan Quintela      feature_not_found "curses"
1599c584a6d0SJuan Quintela    fi
1600c584a6d0SJuan Quintela    curses=no
1601c584a6d0SJuan Quintela  fi
16024f78ef9aSJuan Quintelafi
16034d3b6f6eSbalrog
1604414f0dabSblueswir1##########################################
1605769ce76dSAlexander Graf# curl probe
1606769ce76dSAlexander Graf
1607a8bd70adSPaolo Bonziniif $pkg_config libcurl --modversion >/dev/null 2>&1; then
1608a8bd70adSPaolo Bonzini  curlconfig="$pkg_config libcurl"
16094e2b0658SPaolo Bonzinielse
16104e2b0658SPaolo Bonzini  curlconfig=curl-config
16114e2b0658SPaolo Bonzinifi
16124e2b0658SPaolo Bonzini
1613788c8196SJuan Quintelaif test "$curl" != "no" ; then
1614769ce76dSAlexander Graf  cat > $TMPC << EOF
1615769ce76dSAlexander Graf#include <curl/curl.h>
1616769ce76dSAlexander Grafint main(void) { return curl_easy_init(); }
1617769ce76dSAlexander GrafEOF
16184e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
16194e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
1620b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
1621769ce76dSAlexander Graf    curl=yes
1622f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
1623f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
1624788c8196SJuan Quintela  else
1625788c8196SJuan Quintela    if test "$curl" = "yes" ; then
1626788c8196SJuan Quintela      feature_not_found "curl"
1627788c8196SJuan Quintela    fi
1628788c8196SJuan Quintela    curl=no
1629769ce76dSAlexander Graf  fi
1630769ce76dSAlexander Graffi # test "$curl"
1631769ce76dSAlexander Graf
1632769ce76dSAlexander Graf##########################################
16335495ed11SLuiz Capitulino# check framework probe
16345495ed11SLuiz Capitulino
16355495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then
16365495ed11SLuiz Capitulino  cat > $TMPC << EOF
16375495ed11SLuiz Capitulino#include <check.h>
16385495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; }
16395495ed11SLuiz CapitulinoEOF
1640a8bd70adSPaolo Bonzini  check_libs=`$pkg_config --libs check`
16415495ed11SLuiz Capitulino  if compile_prog "" $check_libs ; then
16425495ed11SLuiz Capitulino    check_utests=yes
16435495ed11SLuiz Capitulino    libs_tools="$check_libs $libs_tools"
16445495ed11SLuiz Capitulino  else
16455495ed11SLuiz Capitulino    if test "$check_utests" = "yes" ; then
16465495ed11SLuiz Capitulino      feature_not_found "check"
16475495ed11SLuiz Capitulino    fi
16485495ed11SLuiz Capitulino    check_utests=no
16495495ed11SLuiz Capitulino  fi
16505495ed11SLuiz Capitulinofi # test "$check_utests"
16515495ed11SLuiz Capitulino
16525495ed11SLuiz Capitulino##########################################
1653fb599c9aSbalrog# bluez support probe
1654a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
1655e820e3f4Sbalrog  cat > $TMPC << EOF
1656e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
1657e820e3f4Sbalrogint main(void) { return bt_error(0); }
1658e820e3f4SbalrogEOF
1659a8bd70adSPaolo Bonzini  bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null`
1660a8bd70adSPaolo Bonzini  bluez_libs=`$pkg_config --libs bluez 2> /dev/null`
166152166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1662a20a6f46SJuan Quintela    bluez=yes
1663e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
1664e820e3f4Sbalrog  else
1665a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
1666a20a6f46SJuan Quintela      feature_not_found "bluez"
1667a20a6f46SJuan Quintela    fi
1668e820e3f4Sbalrog    bluez="no"
1669e820e3f4Sbalrog  fi
1670fb599c9aSbalrogfi
1671fb599c9aSbalrog
1672fb599c9aSbalrog##########################################
16737ba1e619Saliguori# kvm probe
1674b31a0277SJuan Quintelaif test "$kvm" != "no" ; then
16757ba1e619Saliguori    cat > $TMPC <<EOF
16767ba1e619Saliguori#include <linux/kvm.h>
16779fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
16787ba1e619Saliguori#error Invalid KVM version
16797ba1e619Saliguori#endif
168094a8d39aSJan KiszkaEOF
168194a8d39aSJan Kiszka    must_have_caps="KVM_CAP_USER_MEMORY \
168294a8d39aSJan Kiszka                    KVM_CAP_DESTROY_MEMORY_REGION_WORKS \
168394a8d39aSJan Kiszka                    KVM_CAP_COALESCED_MMIO \
168494a8d39aSJan Kiszka                    KVM_CAP_SYNC_MMU \
168594a8d39aSJan Kiszka                   "
168694a8d39aSJan Kiszka    if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) ; then
168794a8d39aSJan Kiszka      must_have_caps="$caps \
168894a8d39aSJan Kiszka                      KVM_CAP_SET_TSS_ADDR \
168994a8d39aSJan Kiszka                      KVM_CAP_EXT_CPUID \
169094a8d39aSJan Kiszka                      KVM_CAP_CLOCKSOURCE \
169194a8d39aSJan Kiszka                      KVM_CAP_NOP_IO_DELAY \
169294a8d39aSJan Kiszka                      KVM_CAP_PV_MMU \
169394a8d39aSJan Kiszka                      KVM_CAP_MP_STATE \
169494a8d39aSJan Kiszka                      KVM_CAP_USER_NMI \
169594a8d39aSJan Kiszka                     "
169694a8d39aSJan Kiszka    fi
169794a8d39aSJan Kiszka    for c in $must_have_caps ; do
169894a8d39aSJan Kiszka      cat >> $TMPC <<EOF
169994a8d39aSJan Kiszka#if !defined($c)
170094a8d39aSJan Kiszka#error Missing KVM capability $c
17019fd8d8d7Saliguori#endif
170294a8d39aSJan KiszkaEOF
170394a8d39aSJan Kiszka    done
170494a8d39aSJan Kiszka    cat >> $TMPC <<EOF
17057ba1e619Saliguoriint main(void) { return 0; }
17067ba1e619SaliguoriEOF
1707eac30262Saliguori  if test "$kerneldir" != "" ; then
1708eac30262Saliguori      kvm_cflags=-I"$kerneldir"/include
17098444eb6eSaliguori      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
17108444eb6eSaliguori         -a -d "$kerneldir/arch/x86/include" ; then
17118444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1712406b430dSaliguori	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1713406b430dSaliguori	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
17140e60a699SAlexander Graf	elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
17150e60a699SAlexander Graf	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
17168444eb6eSaliguori        elif test -d "$kerneldir/arch/$cpu/include" ; then
17178444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
17188444eb6eSaliguori      fi
1719eac30262Saliguori  else
1720a8bd70adSPaolo Bonzini    kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null`
1721eac30262Saliguori  fi
172252166aa0SJuan Quintela  if compile_prog "$kvm_cflags" "" ; then
1723b31a0277SJuan Quintela    kvm=yes
1724dae5079aSJan Kiszka    cat > $TMPC <<EOF
1725dae5079aSJan Kiszka#include <linux/kvm_para.h>
1726dae5079aSJan Kiszkaint main(void) { return 0; }
1727dae5079aSJan KiszkaEOF
1728dae5079aSJan Kiszka    if compile_prog "$kvm_cflags" "" ; then
1729dae5079aSJan Kiszka      kvm_para=yes
1730dae5079aSJan Kiszka    fi
17317ba1e619Saliguori  else
1732b31a0277SJuan Quintela    if test "$kvm" = "yes" ; then
17330dba6195SLoïc Minier      if has awk && has grep; then
1734a558ee17SJuan Quintela        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
17359fd8d8d7Saliguori	| grep "error: " \
17369fd8d8d7Saliguori	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
17379fd8d8d7Saliguori        if test "$kvmerr" != "" ; then
1738b31a0277SJuan Quintela          echo -e "${kvmerr}\n\
1739168ccc11SJan KiszkaNOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1740168ccc11SJan Kiszkarecent kvm-kmod from http://sourceforge.net/projects/kvm."
17419fd8d8d7Saliguori        fi
17429fd8d8d7Saliguori      fi
1743b31a0277SJuan Quintela      feature_not_found "kvm"
1744b31a0277SJuan Quintela    fi
1745b31a0277SJuan Quintela    kvm=no
17467ba1e619Saliguori  fi
17477ba1e619Saliguorifi
17487ba1e619Saliguori
17497ba1e619Saliguori##########################################
1750d5970055SMichael S. Tsirkin# test for vhost net
1751d5970055SMichael S. Tsirkin
1752d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then
1753d5970055SMichael S. Tsirkin    if test "$kvm" != "no"; then
1754d5970055SMichael S. Tsirkin            cat > $TMPC <<EOF
1755d5970055SMichael S. Tsirkin    #include <linux/vhost.h>
1756d5970055SMichael S. Tsirkin    int main(void) { return 0; }
1757d5970055SMichael S. TsirkinEOF
1758d5970055SMichael S. Tsirkin            if compile_prog "$kvm_cflags" "" ; then
1759d5970055SMichael S. Tsirkin                vhost_net=yes
1760d5970055SMichael S. Tsirkin            else
1761d5970055SMichael S. Tsirkin                if test "$vhost_net" = "yes" ; then
1762d5970055SMichael S. Tsirkin                    feature_not_found "vhost-net"
1763d5970055SMichael S. Tsirkin                fi
1764d5970055SMichael S. Tsirkin                vhost_net=no
1765d5970055SMichael S. Tsirkin            fi
1766d5970055SMichael S. Tsirkin    else
1767d5970055SMichael S. Tsirkin            if test "$vhost_net" = "yes" ; then
17684021d247SAurelien Jarno                echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1769d5970055SMichael S. Tsirkin                feature_not_found "vhost-net"
1770d5970055SMichael S. Tsirkin            fi
1771d5970055SMichael S. Tsirkin            vhost_net=no
1772d5970055SMichael S. Tsirkin    fi
1773d5970055SMichael S. Tsirkinfi
1774d5970055SMichael S. Tsirkin
1775d5970055SMichael S. Tsirkin##########################################
1776e5d355d1Saliguori# pthread probe
1777de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2"
17783c529d93Saliguori
1779e5d355d1Saliguoripthread=no
1780414f0dabSblueswir1cat > $TMPC << EOF
17813c529d93Saliguori#include <pthread.h>
1782de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; }
1783414f0dabSblueswir1EOF
1784bd00d539SAndreas Färberif compile_prog "" "" ; then
1785bd00d539SAndreas Färber  pthread=yes
1786bd00d539SAndreas Färberelse
1787de65fe0fSSebastian Herbszt  for pthread_lib in $PTHREADLIBS_LIST; do
178852166aa0SJuan Quintela    if compile_prog "" "$pthread_lib" ; then
1789e5d355d1Saliguori      pthread=yes
17905572b539SJuan Quintela      LIBS="$pthread_lib $LIBS"
1791de65fe0fSSebastian Herbszt      break
1792414f0dabSblueswir1    fi
1793de65fe0fSSebastian Herbszt  done
1794bd00d539SAndreas Färberfi
1795414f0dabSblueswir1
17964617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
17974dd75c70SChristoph Hellwig  echo
17984dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
17994dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
18004dd75c70SChristoph Hellwig  echo
18014dd75c70SChristoph Hellwig  exit 1
1802e5d355d1Saliguorifi
1803e5d355d1Saliguori
1804bf9298b9Saliguori##########################################
1805f27aaf4bSChristian Brunner# rbd probe
1806f27aaf4bSChristian Brunnerif test "$rbd" != "no" ; then
1807f27aaf4bSChristian Brunner  cat > $TMPC <<EOF
1808f27aaf4bSChristian Brunner#include <stdio.h>
1809f27aaf4bSChristian Brunner#include <rados/librados.h>
1810f27aaf4bSChristian Brunnerint main(void) { rados_initialize(0, NULL); return 0; }
1811f27aaf4bSChristian BrunnerEOF
1812cc4e8741SAurelien Jarno  rbd_libs="-lrados"
1813f27aaf4bSChristian Brunner  if compile_prog "" "$rbd_libs" ; then
1814f27aaf4bSChristian Brunner    librados_too_old=no
1815f27aaf4bSChristian Brunner    cat > $TMPC <<EOF
1816f27aaf4bSChristian Brunner#include <stdio.h>
1817f27aaf4bSChristian Brunner#include <rados/librados.h>
1818f27aaf4bSChristian Brunner#ifndef CEPH_OSD_TMAP_SET
1819f27aaf4bSChristian Brunner#error missing CEPH_OSD_TMAP_SET
1820f27aaf4bSChristian Brunner#endif
1821f27aaf4bSChristian Brunnerint main(void) {
1822f27aaf4bSChristian Brunner    int (*func)(const rados_pool_t pool, uint64_t *snapid) = rados_selfmanaged_snap_create;
1823f27aaf4bSChristian Brunner    rados_initialize(0, NULL);
1824f27aaf4bSChristian Brunner    return 0;
1825f27aaf4bSChristian Brunner}
1826f27aaf4bSChristian BrunnerEOF
1827f27aaf4bSChristian Brunner    if compile_prog "" "$rbd_libs" ; then
1828f27aaf4bSChristian Brunner      rbd=yes
1829f27aaf4bSChristian Brunner      libs_tools="$rbd_libs $libs_tools"
1830f27aaf4bSChristian Brunner      libs_softmmu="$rbd_libs $libs_softmmu"
1831f27aaf4bSChristian Brunner    else
1832f27aaf4bSChristian Brunner      rbd=no
1833f27aaf4bSChristian Brunner      librados_too_old=yes
1834f27aaf4bSChristian Brunner    fi
1835f27aaf4bSChristian Brunner  else
1836f27aaf4bSChristian Brunner    if test "$rbd" = "yes" ; then
1837f27aaf4bSChristian Brunner      feature_not_found "rados block device"
1838f27aaf4bSChristian Brunner    fi
1839f27aaf4bSChristian Brunner    rbd=no
1840f27aaf4bSChristian Brunner  fi
1841f27aaf4bSChristian Brunner  if test "$librados_too_old" = "yes" ; then
1842f27aaf4bSChristian Brunner    echo "-> Your librados version is too old - upgrade needed to have rbd support"
1843f27aaf4bSChristian Brunner  fi
1844f27aaf4bSChristian Brunnerfi
1845f27aaf4bSChristian Brunner
1846f27aaf4bSChristian Brunner##########################################
18475c6c3a6cSChristoph Hellwig# linux-aio probe
18485c6c3a6cSChristoph Hellwig
18495c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
18505c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
18515c6c3a6cSChristoph Hellwig#include <libaio.h>
18525c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
1853832ce9c2SScott Wood#include <stddef.h>
18545c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
18555c6c3a6cSChristoph HellwigEOF
18565c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
18575c6c3a6cSChristoph Hellwig    linux_aio=yes
1858048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
1859048d179fSPaul Brook    libs_tools="$libs_tools -laio"
18605c6c3a6cSChristoph Hellwig  else
18615c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
18625c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
18635c6c3a6cSChristoph Hellwig    fi
18643cfcae3cSLuiz Capitulino    linux_aio=no
18655c6c3a6cSChristoph Hellwig  fi
18665c6c3a6cSChristoph Hellwigfi
18675c6c3a6cSChristoph Hellwig
18685c6c3a6cSChristoph Hellwig##########################################
1869758e8e38SVenkateswararao Jujjuri (JV)# attr probe
1870758e8e38SVenkateswararao Jujjuri (JV)
1871758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
1872758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
1873758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
1874758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
1875758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h>
1876758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1877758e8e38SVenkateswararao Jujjuri (JV)EOF
1878758e8e38SVenkateswararao Jujjuri (JV)  if compile_prog "" "-lattr" ; then
1879758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
1880758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
1881758e8e38SVenkateswararao Jujjuri (JV)  else
1882758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
1883758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
1884758e8e38SVenkateswararao Jujjuri (JV)    fi
1885758e8e38SVenkateswararao Jujjuri (JV)    attr=no
1886758e8e38SVenkateswararao Jujjuri (JV)  fi
1887758e8e38SVenkateswararao Jujjuri (JV)fi
1888758e8e38SVenkateswararao Jujjuri (JV)
1889758e8e38SVenkateswararao Jujjuri (JV)##########################################
1890bf9298b9Saliguori# iovec probe
1891bf9298b9Saliguoricat > $TMPC <<EOF
1892db34f0b3Sblueswir1#include <sys/types.h>
1893bf9298b9Saliguori#include <sys/uio.h>
1894db34f0b3Sblueswir1#include <unistd.h>
1895bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; }
1896bf9298b9SaliguoriEOF
1897bf9298b9Saliguoriiovec=no
189852166aa0SJuan Quintelaif compile_prog "" "" ; then
1899bf9298b9Saliguori  iovec=yes
1900bf9298b9Saliguorifi
1901bf9298b9Saliguori
1902f652e6afSaurel32##########################################
1903ceb42de8Saliguori# preadv probe
1904ceb42de8Saliguoricat > $TMPC <<EOF
1905ceb42de8Saliguori#include <sys/types.h>
1906ceb42de8Saliguori#include <sys/uio.h>
1907ceb42de8Saliguori#include <unistd.h>
1908ceb42de8Saliguoriint main(void) { preadv; }
1909ceb42de8SaliguoriEOF
1910ceb42de8Saliguoripreadv=no
191152166aa0SJuan Quintelaif compile_prog "" "" ; then
1912ceb42de8Saliguori  preadv=yes
1913ceb42de8Saliguorifi
1914ceb42de8Saliguori
1915ceb42de8Saliguori##########################################
1916f652e6afSaurel32# fdt probe
19172df87df7SJuan Quintelaif test "$fdt" != "no" ; then
1918b41af4baSJuan Quintela  fdt_libs="-lfdt"
1919f652e6afSaurel32  cat > $TMPC << EOF
1920f652e6afSaurel32int main(void) { return 0; }
1921f652e6afSaurel32EOF
192252166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
1923f652e6afSaurel32    fdt=yes
1924e4782985SJuan Quintela    libs_softmmu="$fdt_libs $libs_softmmu"
19252df87df7SJuan Quintela  else
19262df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
19272df87df7SJuan Quintela      feature_not_found "fdt"
19282df87df7SJuan Quintela    fi
19292df87df7SJuan Quintela    fdt=no
1930f652e6afSaurel32  fi
1931f652e6afSaurel32fi
1932f652e6afSaurel32
19333b3f24adSaurel32#
19343b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
19353b3f24adSaurel32# emulator.  This is done because older glibc versions don't
19363b3f24adSaurel32# have syscall stubs for these implemented.
19373b3f24adSaurel32#
19383b3f24adSaurel32atfile=no
19393b3f24adSaurel32cat > $TMPC << EOF
19403b3f24adSaurel32#define _ATFILE_SOURCE
19413b3f24adSaurel32#include <sys/types.h>
19423b3f24adSaurel32#include <fcntl.h>
19433b3f24adSaurel32#include <unistd.h>
19443b3f24adSaurel32
19453b3f24adSaurel32int
19463b3f24adSaurel32main(void)
19473b3f24adSaurel32{
19483b3f24adSaurel32	/* try to unlink nonexisting file */
19493b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
19503b3f24adSaurel32}
19513b3f24adSaurel32EOF
195252166aa0SJuan Quintelaif compile_prog "" "" ; then
19533b3f24adSaurel32  atfile=yes
19543b3f24adSaurel32fi
19553b3f24adSaurel32
195639386ac7Saurel32# Check for inotify functions when we are building linux-user
19573b3f24adSaurel32# emulator.  This is done because older glibc versions don't
19583b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
19593b3f24adSaurel32# don't provide them even if kernel supports them.
19603b3f24adSaurel32#
19613b3f24adSaurel32inotify=no
19623b3f24adSaurel32cat > $TMPC << EOF
19633b3f24adSaurel32#include <sys/inotify.h>
19643b3f24adSaurel32
19653b3f24adSaurel32int
19663b3f24adSaurel32main(void)
19673b3f24adSaurel32{
19683b3f24adSaurel32	/* try to start inotify */
19698690e420Saurel32	return inotify_init();
19703b3f24adSaurel32}
19713b3f24adSaurel32EOF
197252166aa0SJuan Quintelaif compile_prog "" "" ; then
19733b3f24adSaurel32  inotify=yes
19743b3f24adSaurel32fi
19753b3f24adSaurel32
1976c05c7a73SRiku Voipioinotify1=no
1977c05c7a73SRiku Voipiocat > $TMPC << EOF
1978c05c7a73SRiku Voipio#include <sys/inotify.h>
1979c05c7a73SRiku Voipio
1980c05c7a73SRiku Voipioint
1981c05c7a73SRiku Voipiomain(void)
1982c05c7a73SRiku Voipio{
1983c05c7a73SRiku Voipio    /* try to start inotify */
1984c05c7a73SRiku Voipio    return inotify_init1(0);
1985c05c7a73SRiku Voipio}
1986c05c7a73SRiku VoipioEOF
1987c05c7a73SRiku Voipioif compile_prog "" "" ; then
1988c05c7a73SRiku Voipio  inotify1=yes
1989c05c7a73SRiku Voipiofi
1990c05c7a73SRiku Voipio
1991ebc996f3SRiku Voipio# check if utimensat and futimens are supported
1992ebc996f3SRiku Voipioutimens=no
1993ebc996f3SRiku Voipiocat > $TMPC << EOF
1994ebc996f3SRiku Voipio#define _ATFILE_SOURCE
1995ebc996f3SRiku Voipio#include <stddef.h>
1996ebc996f3SRiku Voipio#include <fcntl.h>
1997ebc996f3SRiku Voipio
1998ebc996f3SRiku Voipioint main(void)
1999ebc996f3SRiku Voipio{
2000ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
2001ebc996f3SRiku Voipio    futimens(0, NULL);
2002ebc996f3SRiku Voipio    return 0;
2003ebc996f3SRiku Voipio}
2004ebc996f3SRiku VoipioEOF
200552166aa0SJuan Quintelaif compile_prog "" "" ; then
2006ebc996f3SRiku Voipio  utimens=yes
2007ebc996f3SRiku Voipiofi
2008ebc996f3SRiku Voipio
2009099d6b0fSRiku Voipio# check if pipe2 is there
2010099d6b0fSRiku Voipiopipe2=no
2011099d6b0fSRiku Voipiocat > $TMPC << EOF
2012099d6b0fSRiku Voipio#include <unistd.h>
2013099d6b0fSRiku Voipio#include <fcntl.h>
2014099d6b0fSRiku Voipio
2015099d6b0fSRiku Voipioint main(void)
2016099d6b0fSRiku Voipio{
2017099d6b0fSRiku Voipio    int pipefd[2];
2018099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
2019099d6b0fSRiku Voipio    return 0;
2020099d6b0fSRiku Voipio}
2021099d6b0fSRiku VoipioEOF
202252166aa0SJuan Quintelaif compile_prog "" "" ; then
2023099d6b0fSRiku Voipio  pipe2=yes
2024099d6b0fSRiku Voipiofi
2025099d6b0fSRiku Voipio
202640ff6d7eSKevin Wolf# check if accept4 is there
202740ff6d7eSKevin Wolfaccept4=no
202840ff6d7eSKevin Wolfcat > $TMPC << EOF
202940ff6d7eSKevin Wolf#include <sys/socket.h>
203040ff6d7eSKevin Wolf#include <stddef.h>
203140ff6d7eSKevin Wolf
203240ff6d7eSKevin Wolfint main(void)
203340ff6d7eSKevin Wolf{
203440ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
203540ff6d7eSKevin Wolf    return 0;
203640ff6d7eSKevin Wolf}
203740ff6d7eSKevin WolfEOF
203840ff6d7eSKevin Wolfif compile_prog "" "" ; then
203940ff6d7eSKevin Wolf  accept4=yes
204040ff6d7eSKevin Wolffi
204140ff6d7eSKevin Wolf
20423ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
20433ce34dfbSvibisreenivasansplice=no
20443ce34dfbSvibisreenivasancat > $TMPC << EOF
20453ce34dfbSvibisreenivasan#include <unistd.h>
20463ce34dfbSvibisreenivasan#include <fcntl.h>
20473ce34dfbSvibisreenivasan#include <limits.h>
20483ce34dfbSvibisreenivasan
20493ce34dfbSvibisreenivasanint main(void)
20503ce34dfbSvibisreenivasan{
20513ce34dfbSvibisreenivasan    int len, fd;
20523ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
20533ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
20543ce34dfbSvibisreenivasan    return 0;
20553ce34dfbSvibisreenivasan}
20563ce34dfbSvibisreenivasanEOF
205752166aa0SJuan Quintelaif compile_prog "" "" ; then
20583ce34dfbSvibisreenivasan  splice=yes
20593ce34dfbSvibisreenivasanfi
20603ce34dfbSvibisreenivasan
2061dcc38d1cSMarcelo Tosatti##########################################
2062dcc38d1cSMarcelo Tosatti# signalfd probe
2063dcc38d1cSMarcelo Tosattisignalfd="no"
2064dcc38d1cSMarcelo Tosatticat > $TMPC << EOF
2065dcc38d1cSMarcelo Tosatti#define _GNU_SOURCE
2066dcc38d1cSMarcelo Tosatti#include <unistd.h>
2067dcc38d1cSMarcelo Tosatti#include <sys/syscall.h>
2068dcc38d1cSMarcelo Tosatti#include <signal.h>
2069dcc38d1cSMarcelo Tosattiint main(void) { return syscall(SYS_signalfd, -1, NULL, _NSIG / 8); }
2070dcc38d1cSMarcelo TosattiEOF
2071dcc38d1cSMarcelo Tosatti
2072dcc38d1cSMarcelo Tosattiif compile_prog "" "" ; then
2073dcc38d1cSMarcelo Tosatti  signalfd=yes
2074de758970SJan Kiszkaelif test "$kvm" = "yes" -a "$io_thread" != "yes"; then
2075de758970SJan Kiszka  echo
2076de758970SJan Kiszka  echo "ERROR: Host kernel lacks signalfd() support,"
2077de758970SJan Kiszka  echo "but KVM depends on it when the IO thread is disabled."
2078de758970SJan Kiszka  echo
2079de758970SJan Kiszka  exit 1
2080dcc38d1cSMarcelo Tosattifi
2081dcc38d1cSMarcelo Tosatti
2082c2882b96SRiku Voipio# check if eventfd is supported
2083c2882b96SRiku Voipioeventfd=no
2084c2882b96SRiku Voipiocat > $TMPC << EOF
2085c2882b96SRiku Voipio#include <sys/eventfd.h>
2086c2882b96SRiku Voipio
2087c2882b96SRiku Voipioint main(void)
2088c2882b96SRiku Voipio{
2089c2882b96SRiku Voipio    int efd = eventfd(0, 0);
2090c2882b96SRiku Voipio    return 0;
2091c2882b96SRiku Voipio}
2092c2882b96SRiku VoipioEOF
2093c2882b96SRiku Voipioif compile_prog "" "" ; then
2094c2882b96SRiku Voipio  eventfd=yes
2095c2882b96SRiku Voipiofi
2096c2882b96SRiku Voipio
2097d0927938SUlrich Hecht# check for fallocate
2098d0927938SUlrich Hechtfallocate=no
2099d0927938SUlrich Hechtcat > $TMPC << EOF
2100d0927938SUlrich Hecht#include <fcntl.h>
2101d0927938SUlrich Hecht
2102d0927938SUlrich Hechtint main(void)
2103d0927938SUlrich Hecht{
2104d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
2105d0927938SUlrich Hecht    return 0;
2106d0927938SUlrich Hecht}
2107d0927938SUlrich HechtEOF
2108be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then
2109d0927938SUlrich Hecht  fallocate=yes
2110d0927938SUlrich Hechtfi
2111d0927938SUlrich Hecht
2112c727f47dSPeter Maydell# check for sync_file_range
2113c727f47dSPeter Maydellsync_file_range=no
2114c727f47dSPeter Maydellcat > $TMPC << EOF
2115c727f47dSPeter Maydell#include <fcntl.h>
2116c727f47dSPeter Maydell
2117c727f47dSPeter Maydellint main(void)
2118c727f47dSPeter Maydell{
2119c727f47dSPeter Maydell    sync_file_range(0, 0, 0, 0);
2120c727f47dSPeter Maydell    return 0;
2121c727f47dSPeter Maydell}
2122c727f47dSPeter MaydellEOF
2123c727f47dSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
2124c727f47dSPeter Maydell  sync_file_range=yes
2125c727f47dSPeter Maydellfi
2126c727f47dSPeter Maydell
2127dace20dcSPeter Maydell# check for linux/fiemap.h and FS_IOC_FIEMAP
2128dace20dcSPeter Maydellfiemap=no
2129dace20dcSPeter Maydellcat > $TMPC << EOF
2130dace20dcSPeter Maydell#include <sys/ioctl.h>
2131dace20dcSPeter Maydell#include <linux/fs.h>
2132dace20dcSPeter Maydell#include <linux/fiemap.h>
2133dace20dcSPeter Maydell
2134dace20dcSPeter Maydellint main(void)
2135dace20dcSPeter Maydell{
2136dace20dcSPeter Maydell    ioctl(0, FS_IOC_FIEMAP, 0);
2137dace20dcSPeter Maydell    return 0;
2138dace20dcSPeter Maydell}
2139dace20dcSPeter MaydellEOF
2140dace20dcSPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
2141dace20dcSPeter Maydell  fiemap=yes
2142dace20dcSPeter Maydellfi
2143dace20dcSPeter Maydell
2144d0927938SUlrich Hecht# check for dup3
2145d0927938SUlrich Hechtdup3=no
2146d0927938SUlrich Hechtcat > $TMPC << EOF
2147d0927938SUlrich Hecht#include <unistd.h>
2148d0927938SUlrich Hecht
2149d0927938SUlrich Hechtint main(void)
2150d0927938SUlrich Hecht{
2151d0927938SUlrich Hecht    dup3(0, 0, 0);
2152d0927938SUlrich Hecht    return 0;
2153d0927938SUlrich Hecht}
2154d0927938SUlrich HechtEOF
215578f5d726SJan Kiszkaif compile_prog "" "" ; then
2156d0927938SUlrich Hecht  dup3=yes
2157d0927938SUlrich Hechtfi
2158d0927938SUlrich Hecht
21593b6edd16SPeter Maydell# check for epoll support
21603b6edd16SPeter Maydellepoll=no
21613b6edd16SPeter Maydellcat > $TMPC << EOF
21623b6edd16SPeter Maydell#include <sys/epoll.h>
21633b6edd16SPeter Maydell
21643b6edd16SPeter Maydellint main(void)
21653b6edd16SPeter Maydell{
21663b6edd16SPeter Maydell    epoll_create(0);
21673b6edd16SPeter Maydell    return 0;
21683b6edd16SPeter Maydell}
21693b6edd16SPeter MaydellEOF
21703b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
21713b6edd16SPeter Maydell  epoll=yes
21723b6edd16SPeter Maydellfi
21733b6edd16SPeter Maydell
21743b6edd16SPeter Maydell# epoll_create1 and epoll_pwait are later additions
21753b6edd16SPeter Maydell# so we must check separately for their presence
21763b6edd16SPeter Maydellepoll_create1=no
21773b6edd16SPeter Maydellcat > $TMPC << EOF
21783b6edd16SPeter Maydell#include <sys/epoll.h>
21793b6edd16SPeter Maydell
21803b6edd16SPeter Maydellint main(void)
21813b6edd16SPeter Maydell{
21823b6edd16SPeter Maydell    epoll_create1(0);
21833b6edd16SPeter Maydell    return 0;
21843b6edd16SPeter Maydell}
21853b6edd16SPeter MaydellEOF
21863b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
21873b6edd16SPeter Maydell  epoll_create1=yes
21883b6edd16SPeter Maydellfi
21893b6edd16SPeter Maydell
21903b6edd16SPeter Maydellepoll_pwait=no
21913b6edd16SPeter Maydellcat > $TMPC << EOF
21923b6edd16SPeter Maydell#include <sys/epoll.h>
21933b6edd16SPeter Maydell
21943b6edd16SPeter Maydellint main(void)
21953b6edd16SPeter Maydell{
21963b6edd16SPeter Maydell    epoll_pwait(0, 0, 0, 0, 0);
21973b6edd16SPeter Maydell    return 0;
21983b6edd16SPeter Maydell}
21993b6edd16SPeter MaydellEOF
22003b6edd16SPeter Maydellif compile_prog "$ARCH_CFLAGS" "" ; then
22013b6edd16SPeter Maydell  epoll_pwait=yes
22023b6edd16SPeter Maydellfi
22033b6edd16SPeter Maydell
2204cc8ae6deSpbrook# Check if tools are available to build documentation.
2205a25dba17SJuan Quintelaif test "$docs" != "no" ; then
220601668d98SStefan Weil  if has makeinfo && has pod2man; then
2207a25dba17SJuan Quintela    docs=yes
220883a3ab8bSJuan Quintela  else
2209a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
2210a25dba17SJuan Quintela      feature_not_found "docs"
221183a3ab8bSJuan Quintela    fi
2212a25dba17SJuan Quintela    docs=no
221383a3ab8bSJuan Quintela  fi
2214cc8ae6deSpbrookfi
2215cc8ae6deSpbrook
2216f514f41cSStefan Weil# Search for bswap_32 function
22176ae9a1f4SJuan Quintelabyteswap_h=no
22186ae9a1f4SJuan Quintelacat > $TMPC << EOF
22196ae9a1f4SJuan Quintela#include <byteswap.h>
22206ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
22216ae9a1f4SJuan QuintelaEOF
222252166aa0SJuan Quintelaif compile_prog "" "" ; then
22236ae9a1f4SJuan Quintela  byteswap_h=yes
22246ae9a1f4SJuan Quintelafi
22256ae9a1f4SJuan Quintela
2226f514f41cSStefan Weil# Search for bswap_32 function
22276ae9a1f4SJuan Quintelabswap_h=no
22286ae9a1f4SJuan Quintelacat > $TMPC << EOF
22296ae9a1f4SJuan Quintela#include <sys/endian.h>
22306ae9a1f4SJuan Quintela#include <sys/types.h>
22316ae9a1f4SJuan Quintela#include <machine/bswap.h>
22326ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
22336ae9a1f4SJuan QuintelaEOF
223452166aa0SJuan Quintelaif compile_prog "" "" ; then
22356ae9a1f4SJuan Quintela  bswap_h=yes
22366ae9a1f4SJuan Quintelafi
22376ae9a1f4SJuan Quintela
2238da93a1fdSaliguori##########################################
2239da93a1fdSaliguori# Do we need librt
2240da93a1fdSaliguoricat > $TMPC <<EOF
2241da93a1fdSaliguori#include <signal.h>
2242da93a1fdSaliguori#include <time.h>
2243da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); }
2244da93a1fdSaliguoriEOF
2245da93a1fdSaliguori
224652166aa0SJuan Quintelaif compile_prog "" "" ; then
224707ffa4bdSJuan Quintela  :
224852166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
224907ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2250da93a1fdSaliguorifi
2251da93a1fdSaliguori
225231ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
2253179cf400SAndreas Färber        "$aix" != "yes" -a "$haiku" != "yes" ; then
22546362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
22556362a53fSJuan Quintelafi
22566362a53fSJuan Quintela
2257de5071c5SBlue Swirl##########################################
2258de5071c5SBlue Swirl# check if the compiler defines offsetof
2259de5071c5SBlue Swirl
2260de5071c5SBlue Swirlneed_offsetof=yes
2261de5071c5SBlue Swirlcat > $TMPC << EOF
2262de5071c5SBlue Swirl#include <stddef.h>
2263de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); }
2264de5071c5SBlue SwirlEOF
2265de5071c5SBlue Swirlif compile_prog "" "" ; then
2266de5071c5SBlue Swirl    need_offsetof=no
2267de5071c5SBlue Swirlfi
2268de5071c5SBlue Swirl
22695f6b9e8fSBlue Swirl##########################################
2270747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result
2271747bbdf7SBlue Swirl#
2272747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning
2273747bbdf7SBlue Swirl# about attribute warn_unused_result
2274747bbdf7SBlue Swirl
2275747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no
2276747bbdf7SBlue Swirlcat > $TMPC << EOF
2277747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2278747bbdf7SBlue Swirl#error gcc 3.3 or older
2279747bbdf7SBlue Swirl#endif
2280747bbdf7SBlue Swirlint main(void) { return 0;}
2281747bbdf7SBlue SwirlEOF
2282747bbdf7SBlue Swirlif compile_prog "" ""; then
2283747bbdf7SBlue Swirl    gcc_attribute_warn_unused_result=yes
2284747bbdf7SBlue Swirlfi
2285747bbdf7SBlue Swirl
2286cd4ec0b4SGerd Hoffmann# spice probe
2287cd4ec0b4SGerd Hoffmannif test "$spice" != "no" ; then
2288cd4ec0b4SGerd Hoffmann  cat > $TMPC << EOF
2289cd4ec0b4SGerd Hoffmann#include <spice.h>
2290cd4ec0b4SGerd Hoffmannint main(void) { spice_server_new(); return 0; }
2291cd4ec0b4SGerd HoffmannEOF
2292710fc4f5SJiri Denemark  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
2293710fc4f5SJiri Denemark  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
2294710fc4f5SJiri Denemark  if $pkg_config --atleast-version=0.5.3 spice-server >/dev/null 2>&1 && \
2295cd4ec0b4SGerd Hoffmann     compile_prog "$spice_cflags" "$spice_libs" ; then
2296cd4ec0b4SGerd Hoffmann    spice="yes"
2297cd4ec0b4SGerd Hoffmann    libs_softmmu="$libs_softmmu $spice_libs"
2298cd4ec0b4SGerd Hoffmann    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
2299cd4ec0b4SGerd Hoffmann  else
2300cd4ec0b4SGerd Hoffmann    if test "$spice" = "yes" ; then
2301cd4ec0b4SGerd Hoffmann      feature_not_found "spice"
2302cd4ec0b4SGerd Hoffmann    fi
2303cd4ec0b4SGerd Hoffmann    spice="no"
2304cd4ec0b4SGerd Hoffmann  fi
2305cd4ec0b4SGerd Hoffmannfi
2306cd4ec0b4SGerd Hoffmann
2307cd4ec0b4SGerd Hoffmann##########################################
2308cd4ec0b4SGerd Hoffmann
2309747bbdf7SBlue Swirl##########################################
23105f6b9e8fSBlue Swirl# check if we have fdatasync
23115f6b9e8fSBlue Swirl
23125f6b9e8fSBlue Swirlfdatasync=no
23135f6b9e8fSBlue Swirlcat > $TMPC << EOF
23145f6b9e8fSBlue Swirl#include <unistd.h>
23155f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); }
23165f6b9e8fSBlue SwirlEOF
23175f6b9e8fSBlue Swirlif compile_prog "" "" ; then
23185f6b9e8fSBlue Swirl    fdatasync=yes
23195f6b9e8fSBlue Swirlfi
23205f6b9e8fSBlue Swirl
232194a420b1SStefan Hajnoczi##########################################
2322e78815a5SAndreas Färber# check if we have madvise
2323e78815a5SAndreas Färber
2324e78815a5SAndreas Färbermadvise=no
2325e78815a5SAndreas Färbercat > $TMPC << EOF
2326e78815a5SAndreas Färber#include <sys/types.h>
2327e78815a5SAndreas Färber#include <sys/mman.h>
2328832ce9c2SScott Wood#include <stddef.h>
2329e78815a5SAndreas Färberint main(void) { return madvise(NULL, 0, MADV_DONTNEED); }
2330e78815a5SAndreas FärberEOF
2331e78815a5SAndreas Färberif compile_prog "" "" ; then
2332e78815a5SAndreas Färber    madvise=yes
2333e78815a5SAndreas Färberfi
2334e78815a5SAndreas Färber
2335e78815a5SAndreas Färber##########################################
2336e78815a5SAndreas Färber# check if we have posix_madvise
2337e78815a5SAndreas Färber
2338e78815a5SAndreas Färberposix_madvise=no
2339e78815a5SAndreas Färbercat > $TMPC << EOF
2340e78815a5SAndreas Färber#include <sys/mman.h>
2341832ce9c2SScott Wood#include <stddef.h>
2342e78815a5SAndreas Färberint main(void) { return posix_madvise(NULL, 0, POSIX_MADV_DONTNEED); }
2343e78815a5SAndreas FärberEOF
2344e78815a5SAndreas Färberif compile_prog "" "" ; then
2345e78815a5SAndreas Färber    posix_madvise=yes
2346e78815a5SAndreas Färberfi
2347e78815a5SAndreas Färber
2348e78815a5SAndreas Färber##########################################
234994a420b1SStefan Hajnoczi# check if trace backend exists
235094a420b1SStefan Hajnoczi
23514c3b5a48SBlue Swirlsh "$source_path/scripts/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
235294a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
235394a420b1SStefan Hajnoczi  echo
235494a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
235594a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
235694a420b1SStefan Hajnoczi  echo
235794a420b1SStefan Hajnoczi  exit 1
235894a420b1SStefan Hajnoczifi
235994a420b1SStefan Hajnoczi
23607e24e92aSStefan Hajnoczi##########################################
23617e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
23627e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
23637e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
23647e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
23657e24e92aSStefan Hajnoczi#include <ust/marker.h>
23667e24e92aSStefan Hajnocziint main(void) { return 0; }
23677e24e92aSStefan HajnocziEOF
23687e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
23697e24e92aSStefan Hajnoczi    LIBS="-lust $LIBS"
23707e24e92aSStefan Hajnoczi  else
23717e24e92aSStefan Hajnoczi    echo
23727e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
23737e24e92aSStefan Hajnoczi    echo
23747e24e92aSStefan Hajnoczi    exit 1
23757e24e92aSStefan Hajnoczi  fi
23767e24e92aSStefan Hajnoczifi
2377b3d08c02SDaniel P. Berrange
2378b3d08c02SDaniel P. Berrange##########################################
2379b3d08c02SDaniel P. Berrange# For 'dtrace' backend, test if 'dtrace' command is present
2380b3d08c02SDaniel P. Berrangeif test "$trace_backend" = "dtrace"; then
2381b3d08c02SDaniel P. Berrange  if ! has 'dtrace' ; then
2382b3d08c02SDaniel P. Berrange    echo
2383b3d08c02SDaniel P. Berrange    echo "Error: dtrace command is not found in PATH $PATH"
2384b3d08c02SDaniel P. Berrange    echo
2385b3d08c02SDaniel P. Berrange    exit 1
2386b3d08c02SDaniel P. Berrange  fi
2387c276b17dSDaniel P. Berrange  trace_backend_stap="no"
2388c276b17dSDaniel P. Berrange  if has 'stap' ; then
2389c276b17dSDaniel P. Berrange    trace_backend_stap="yes"
2390c276b17dSDaniel P. Berrange  fi
2391b3d08c02SDaniel P. Berrangefi
2392b3d08c02SDaniel P. Berrange
23937e24e92aSStefan Hajnoczi##########################################
2394e86ecd4bSJuan Quintela# End of CC checks
2395e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2396e86ecd4bSJuan Quintela
2397e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
23981156c669SJuan Quintela  CFLAGS="-O2 $CFLAGS"
2399e86ecd4bSJuan Quintelafi
2400a316e378SJuan Quintela
2401e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
2402e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
2403e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
240420ff6c80SAnthony Liguori
240520ff6c80SAnthony Liguoriif test -z "$werror" ; then
2406e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
2407e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
2408e86ecd4bSJuan Quintela        werror="yes"
2409e86ecd4bSJuan Quintela    else
2410e86ecd4bSJuan Quintela        werror="no"
2411e86ecd4bSJuan Quintela    fi
2412e86ecd4bSJuan Quintelafi
2413e86ecd4bSJuan Quintela
241420ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
241520ff6c80SAnthony Liguori# enable/disable
241620ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
241720ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
241820ff6c80SAnthony Liguori	zero_malloc="no"
241920ff6c80SAnthony Liguori    else
242020ff6c80SAnthony Liguori	zero_malloc="yes"
242120ff6c80SAnthony Liguori    fi
242220ff6c80SAnthony Liguorifi
242320ff6c80SAnthony Liguori
2424e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
2425a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2426e86ecd4bSJuan Quintelafi
2427e86ecd4bSJuan Quintela
2428e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2429e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
24301156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2431e86ecd4bSJuan Quintela    fi
2432e86ecd4bSJuan Quintelafi
2433e86ecd4bSJuan Quintela
2434952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
2435952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
2436952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
2437952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2438952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
2439952afb71SBlue Swirl        fi
2440952afb71SBlue Swirl    done
2441952afb71SBlue Swirlfi
2442952afb71SBlue Swirl
2443190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix
24445a67135aSbellard
2445ca35f780SPaolo Bonzinitools=
2446ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2447ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2448ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2449ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2450ca35f780SPaolo Bonzini    if [ "$check_utests" = "yes" ]; then
2451ca35f780SPaolo Bonzini      tools="check-qint check-qstring check-qdict check-qlist $tools"
2452ca35f780SPaolo Bonzini      tools="check-qfloat check-qjson $tools"
2453ca35f780SPaolo Bonzini    fi
2454ca35f780SPaolo Bonzini  fi
2455ca35f780SPaolo Bonzinifi
2456ca35f780SPaolo Bonzini
2457ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
2458ca35f780SPaolo Bonziniroms=
2459ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2460ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2461ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
2462ca35f780SPaolo Bonzini  roms="optionrom"
2463ca35f780SPaolo Bonzinifi
2464ca35f780SPaolo Bonzini
2465ca35f780SPaolo Bonzini
24667d13299dSbellardecho "Install prefix    $prefix"
2467f2b9e1e3SPaolo Bonziniecho "BIOS directory    `eval echo $datadir`"
2468f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
24691c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
247011d9f695Sbellardif test "$mingw32" = "no" ; then
2471f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
247243ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
247311d9f695Sbellardfi
24745a67135aSbellardecho "Source path       $source_path"
24757d13299dSbellardecho "C compiler        $cc"
247683469015Sbellardecho "Host C compiler   $host_cc"
24770c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
2478a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
24790c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
24807d13299dSbellardecho "make              $make"
24816a882643Spbrookecho "install           $install"
2482a98fd896Sbellardecho "host CPU          $cpu"
2483de83cd02Sbellardecho "host big endian   $bigendian"
248497a847bcSbellardecho "target list       $target_list"
2485ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
2486b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
24877d13299dSbellardecho "gprof enabled     $gprof"
248803b4fe7dSaliguoriecho "sparse enabled    $sparse"
24891625af87Saliguoriecho "strip binaries    $strip_opt"
249005c2a3e7Sbellardecho "profiler          $profiler"
249143ce4dfeSbellardecho "static build      $static"
249285aa5189Sbellardecho "-Werror enabled   $werror"
24935b0753e0Sbellardif test "$darwin" = "yes" ; then
24945b0753e0Sbellard    echo "Cocoa support     $cocoa"
24955b0753e0Sbellardfi
249697a847bcSbellardecho "SDL support       $sdl"
24974d3b6f6eSbalrogecho "curses support    $curses"
2498769ce76dSAlexander Grafecho "curl support      $curl"
24995495ed11SLuiz Capitulinoecho "check support     $check_utests"
250067b915a5Sbellardecho "mingw32 support   $mingw32"
25010c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
25020c58ac1cSmalcecho "Extra audio cards $audio_card_list"
2503eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
25048ff9cbf7Smalcecho "Mixer emulation   $mixemu"
2505*821601eaSJes Sorensenecho "VNC support       $vnc"
2506*821601eaSJes Sorensenif test "$vnc" = "yes" ; then
25078d5d2d4cSths    echo "VNC TLS support   $vnc_tls"
25082f9606b3Saliguori    echo "VNC SASL support  $vnc_sasl"
25092f6f5c7aSCorentin Chary    echo "VNC JPEG support  $vnc_jpeg"
2510efe556adSCorentin Chary    echo "VNC PNG support   $vnc_png"
2511bd023f95SCorentin Chary    echo "VNC thread        $vnc_thread"
2512*821601eaSJes Sorensenfi
25133142255cSblueswir1if test -n "$sparc_cpu"; then
25143142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
25153142255cSblueswir1fi
2516e37630caSaliguoriecho "xen support       $xen"
25172e4d9fb1Saurel32echo "brlapi support    $brlapi"
2518a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
2519a25dba17SJuan Quintelaecho "Documentation     $docs"
2520c5937220Spbrook[ ! -z "$uname_release" ] && \
2521c5937220Spbrookecho "uname -r          $uname_release"
2522bd0c5661Spbrookecho "NPTL support      $nptl"
2523379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
252434005a00SKirill A. Shutemovecho "PIE user targets  $user_pie"
25258a16d273Sthsecho "vde support       $vde"
2526e5d355d1Saliguoriecho "IO thread         $io_thread"
25275c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
2528758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
252977755340Sthsecho "Install blobs     $blobs"
2530b31a0277SJuan Quintelaecho "KVM support       $kvm"
2531f652e6afSaurel32echo "fdt support       $fdt"
2532ceb42de8Saliguoriecho "preadv support    $preadv"
25335f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
2534e78815a5SAndreas Färberecho "madvise           $madvise"
2535e78815a5SAndreas Färberecho "posix_madvise     $posix_madvise"
2536ee682d27SStefan Weilecho "uuid support      $uuid"
2537d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
253894a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
25399410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
2540cd4ec0b4SGerd Hoffmannecho "spice support     $spice"
2541f27aaf4bSChristian Brunnerecho "rbd support       $rbd"
2542dce512deSChristoph Hellwigecho "xfsctl support    $xfs"
254367b915a5Sbellard
254497a847bcSbellardif test $sdl_too_old = "yes"; then
254524b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
2546e8cd23deSbellardfi
254797a847bcSbellard
254898ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
25494bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
255097a847bcSbellard
255198ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
255298ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
255398ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
255498ec69acSJuan Quintelaecho >> $config_host_mak
255598ec69acSJuan Quintela
2556e6c3b0f7SPaolo Bonziniecho all: >> $config_host_mak
255799d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
255899d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
255999d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
256099d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak
256199d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
256299d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak
25631dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak
2564804edf29SJuan Quintela
25652408a527Saurel32case "$cpu" in
2566613a22c9SMichael Walle  i386|x86_64|alpha|cris|hppa|ia64|lm32|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2567e0da9dd3SJuan Quintela    ARCH=$cpu
25682408a527Saurel32  ;;
2569a302c32dSLaurent Desnogues  armv4b|armv4l)
257016dbd14fSJuan Quintela    ARCH=arm
25712408a527Saurel32  ;;
25722408a527Saurel32esac
257398ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
2574f8393946Saurel32if test "$debug_tcg" = "yes" ; then
25752358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2576f8393946Saurel32fi
2577b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
2578b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2579b4475aa2SLuiz Capitulinofi
2580f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
25812358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2582f3d08ee6SPaul Brookfi
25831625af87Saliguoriif test "$strip_opt" = "yes" ; then
258452ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
25851625af87Saliguorifi
25867d13299dSbellardif test "$bigendian" = "yes" ; then
2587e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
258897a847bcSbellardfi
25892358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
259067b915a5Sbellardif test "$mingw32" = "yes" ; then
259198ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
25929fe6de94SBlue Swirl  rc_version=`cat $source_path/VERSION`
25939fe6de94SBlue Swirl  version_major=${rc_version%%.*}
25949fe6de94SBlue Swirl  rc_version=${rc_version#*.}
25959fe6de94SBlue Swirl  version_minor=${rc_version%%.*}
25969fe6de94SBlue Swirl  rc_version=${rc_version#*.}
25979fe6de94SBlue Swirl  version_subminor=${rc_version%%.*}
25989fe6de94SBlue Swirl  version_micro=0
25999fe6de94SBlue Swirl  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
26009fe6de94SBlue Swirl  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
2601210fa556Spbrookelse
260235f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
2603210fa556Spbrookfi
2604128ab2ffSblueswir1
2605dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
2606dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
2607dffcb71cSMark McLoughlinfi
2608dffcb71cSMark McLoughlin
260983fb7adfSbellardif test "$darwin" = "yes" ; then
261098ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
261183fb7adfSbellardfi
2612b29fe3edSmalc
2613b29fe3edSmalcif test "$aix" = "yes" ; then
261498ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
2615b29fe3edSmalcfi
2616b29fe3edSmalc
2617ec530c81Sbellardif test "$solaris" = "yes" ; then
261898ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
26192358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
26200475a5caSths  if test "$needs_libsunmath" = "yes" ; then
262175b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
26220475a5caSths  fi
2623ec530c81Sbellardfi
2624179cf400SAndreas Färberif test "$haiku" = "yes" ; then
2625179cf400SAndreas Färber  echo "CONFIG_HAIKU=y" >> $config_host_mak
2626179cf400SAndreas Färberfi
262797a847bcSbellardif test "$static" = "yes" ; then
262898ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
262997a847bcSbellardfi
263005c2a3e7Sbellardif test $profiler = "yes" ; then
26312358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
263205c2a3e7Sbellardfi
2633c20709aaSbellardif test "$slirp" = "yes" ; then
263498ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
2635f9728943SPaolo Bonzini  QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES"
2636c20709aaSbellardfi
26378a16d273Sthsif test "$vde" = "yes" ; then
263898ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
26398a16d273Sthsfi
26400c58ac1cSmalcfor card in $audio_card_list; do
2641f6e5889eSpbrook    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
264298ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
26430c58ac1cSmalcdone
26442358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
26450c58ac1cSmalcfor drv in $audio_drv_list; do
2646f6e5889eSpbrook    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
264798ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
2648923e4521Smalc    if test "$drv" = "fmod"; then
26497aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2650fb065187Sbellard    fi
26510c58ac1cSmalcdone
265267f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
265367f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
265467f86e8eSJuan Quintelafi
2655d5631638Smalcif test "$audio_win_int" = "yes" ; then
2656d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2657d5631638Smalcfi
2658eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
26598ff9cbf7Smalcif test "$mixemu" = "yes" ; then
266098ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
26618ff9cbf7Smalcfi
2662*821601eaSJes Sorensenif test "$vnc" = "yes" ; then
2663*821601eaSJes Sorensen  echo "CONFIG_VNC=y" >> $config_host_mak
2664*821601eaSJes Sorensenfi
26658d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
266698ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2667525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
26688d5d2d4cSthsfi
26692f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
267098ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
267160ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
26722f9606b3Saliguorifi
2673*821601eaSJes Sorensenif test "$vnc_jpeg" = "yes" ; then
26742f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
26752f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
26762f6f5c7aSCorentin Charyfi
2677*821601eaSJes Sorensenif test "$vnc_png" = "yes" ; then
2678efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2679efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2680efe556adSCorentin Charyfi
2681*821601eaSJes Sorensenif test "$vnc_thread" = "yes" ; then
2682bd023f95SCorentin Chary  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2683bd023f95SCorentin Charyfi
268476655d6dSaliguoriif test "$fnmatch" = "yes" ; then
26852358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
268676655d6dSaliguorifi
2687ee682d27SStefan Weilif test "$uuid" = "yes" ; then
2688ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
2689ee682d27SStefan Weilfi
2690dce512deSChristoph Hellwigif test "$xfs" = "yes" ; then
2691dce512deSChristoph Hellwig  echo "CONFIG_XFS=y" >> $config_host_mak
2692dce512deSChristoph Hellwigfi
2693b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
269498ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
26952358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
269698ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
269798ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
2698a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
269998ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
2700cc8ae6deSpbrookfi
27011ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
270298ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
27038ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
270449ecc3faSbellardfi
270549ecc3faSbellardif test "$cocoa" = "yes" ; then
270698ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
270749ecc3faSbellardfi
27084d3b6f6eSbalrogif test "$curses" = "yes" ; then
270998ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
2710ab4e5602SJan Kiszkafi
27113b3f24adSaurel32if test "$atfile" = "yes" ; then
27122358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
27133b3f24adSaurel32fi
2714ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
27152358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2716ebc996f3SRiku Voipiofi
2717099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
27182358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
2719099d6b0fSRiku Voipiofi
272040ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
272140ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
272240ff6d7eSKevin Wolffi
27233ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
27242358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
27253ce34dfbSvibisreenivasanfi
2726c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
2727c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2728c2882b96SRiku Voipiofi
2729d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
2730d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2731d0927938SUlrich Hechtfi
2732c727f47dSPeter Maydellif test "$sync_file_range" = "yes" ; then
2733c727f47dSPeter Maydell  echo "CONFIG_SYNC_FILE_RANGE=y" >> $config_host_mak
2734c727f47dSPeter Maydellfi
2735dace20dcSPeter Maydellif test "$fiemap" = "yes" ; then
2736dace20dcSPeter Maydell  echo "CONFIG_FIEMAP=y" >> $config_host_mak
2737dace20dcSPeter Maydellfi
2738d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
2739d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
2740d0927938SUlrich Hechtfi
27413b6edd16SPeter Maydellif test "$epoll" = "yes" ; then
27423b6edd16SPeter Maydell  echo "CONFIG_EPOLL=y" >> $config_host_mak
27433b6edd16SPeter Maydellfi
27443b6edd16SPeter Maydellif test "$epoll_create1" = "yes" ; then
27453b6edd16SPeter Maydell  echo "CONFIG_EPOLL_CREATE1=y" >> $config_host_mak
27463b6edd16SPeter Maydellfi
27473b6edd16SPeter Maydellif test "$epoll_pwait" = "yes" ; then
27483b6edd16SPeter Maydell  echo "CONFIG_EPOLL_PWAIT=y" >> $config_host_mak
27493b6edd16SPeter Maydellfi
27503b3f24adSaurel32if test "$inotify" = "yes" ; then
27512358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
27523b3f24adSaurel32fi
2753c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
2754c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2755c05c7a73SRiku Voipiofi
27566ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
27576ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
27586ae9a1f4SJuan Quintelafi
27596ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
27606ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
27616ae9a1f4SJuan Quintelafi
2762769ce76dSAlexander Grafif test "$curl" = "yes" ; then
276398ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
2764b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2765769ce76dSAlexander Graffi
27662e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
276798ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
27682e4d9fb1Saurel32fi
2769fb599c9aSbalrogif test "$bluez" = "yes" ; then
277098ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2771ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2772fb599c9aSbalrogfi
2773e37630caSaliguoriif test "$xen" = "yes" ; then
27745647eb74SJuan Quintela  echo "CONFIG_XEN=y" >> $config_host_mak
2775e37630caSaliguorifi
2776e5d355d1Saliguoriif test "$io_thread" = "yes" ; then
277798ec69acSJuan Quintela  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2778e5d355d1Saliguorifi
27795c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
27805c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
27815c6c3a6cSChristoph Hellwigfi
2782758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
2783758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
2784758e8e38SVenkateswararao Jujjuri (JV)fi
2785758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then
2786758e8e38SVenkateswararao Jujjuri (JV)  if test "$attr" = "yes" ; then
2787758e8e38SVenkateswararao Jujjuri (JV)    echo "CONFIG_VIRTFS=y" >> $config_host_mak
2788758e8e38SVenkateswararao Jujjuri (JV)  fi
2789758e8e38SVenkateswararao Jujjuri (JV)fi
279077755340Sthsif test "$blobs" = "yes" ; then
279198ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
279277755340Sthsfi
2793bf9298b9Saliguoriif test "$iovec" = "yes" ; then
27942358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
2795bf9298b9Saliguorifi
2796ceb42de8Saliguoriif test "$preadv" = "yes" ; then
27972358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
2798ceb42de8Saliguorifi
2799f652e6afSaurel32if test "$fdt" = "yes" ; then
28003f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
2801f652e6afSaurel32fi
2802dcc38d1cSMarcelo Tosattiif test "$signalfd" = "yes" ; then
2803dcc38d1cSMarcelo Tosatti  echo "CONFIG_SIGNALFD=y" >> $config_host_mak
2804dcc38d1cSMarcelo Tosattifi
2805de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then
2806de5071c5SBlue Swirl  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2807de5071c5SBlue Swirlfi
2808747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then
2809747bbdf7SBlue Swirl  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2810747bbdf7SBlue Swirlfi
28115f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
28125f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
28135f6b9e8fSBlue Swirlfi
2814e78815a5SAndreas Färberif test "$madvise" = "yes" ; then
2815e78815a5SAndreas Färber  echo "CONFIG_MADVISE=y" >> $config_host_mak
2816e78815a5SAndreas Färberfi
2817e78815a5SAndreas Färberif test "$posix_madvise" = "yes" ; then
2818e78815a5SAndreas Färber  echo "CONFIG_POSIX_MADVISE=y" >> $config_host_mak
2819e78815a5SAndreas Färberfi
282097a847bcSbellard
2821cd4ec0b4SGerd Hoffmannif test "$spice" = "yes" ; then
2822cd4ec0b4SGerd Hoffmann  echo "CONFIG_SPICE=y" >> $config_host_mak
2823cd4ec0b4SGerd Hoffmannfi
2824cd4ec0b4SGerd Hoffmann
282583fb7adfSbellard# XXX: suppress that
28267d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
28272358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
28287d3505c5Sbellardfi
28297d3505c5Sbellard
28302358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2831c5937220Spbrook
283220ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
283320ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
283420ff6c80SAnthony Liguorifi
2835f27aaf4bSChristian Brunnerif test "$rbd" = "yes" ; then
2836f27aaf4bSChristian Brunner  echo "CONFIG_RBD=y" >> $config_host_mak
2837f27aaf4bSChristian Brunnerfi
283820ff6c80SAnthony Liguori
283968063649Sblueswir1# USB host support
284068063649Sblueswir1case "$usb" in
284168063649Sblueswir1linux)
284298ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
284368063649Sblueswir1;;
284468063649Sblueswir1bsd)
284598ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
284668063649Sblueswir1;;
284768063649Sblueswir1*)
284898ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
284968063649Sblueswir1;;
285068063649Sblueswir1esac
285168063649Sblueswir1
285294a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
285322890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then
285422890ab5SPrerna Saxena  echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
285522890ab5SPrerna Saxenafi
28569410b56cSPrerna Saxena# Set the appropriate trace file.
28579410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
28589410b56cSPrerna Saxena  trace_file="\"$trace_file-%u\""
28599410b56cSPrerna Saxenafi
2860c276b17dSDaniel P. Berrangeif test "$trace_backend" = "dtrace" -a "$trace_backend_stap" = "yes" ; then
2861c276b17dSDaniel P. Berrange  echo "CONFIG_SYSTEMTAP_TRACE=y" >> $config_host_mak
2862c276b17dSDaniel P. Berrangefi
28639410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
28649410b56cSPrerna Saxena
286598ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
286698ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
2867804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
2868804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
2869804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2870804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2871804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2872804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
28732b2e59e6SPaolo Bonziniecho "CC_I386=$cc_i386" >> $config_host_mak
2874804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
2875804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
2876804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
2877804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
28789fe6de94SBlue Swirlecho "WINDRES=$windres" >> $config_host_mak
2879e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
2880a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2881f9728943SPaolo Bonziniecho "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
2882e39f0062SPaolo Bonziniif test "$sparse" = "yes" ; then
2883e39f0062SPaolo Bonzini  echo "CC           := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
2884e39f0062SPaolo Bonzini  echo "HOST_CC      := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
2885e39f0062SPaolo Bonzini  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2886e39f0062SPaolo Bonzinifi
2887c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2888e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
2889a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2890a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
289173da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
28923e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2893804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
2894804edf29SJuan Quintela
28954bf6b55bSJuan Quintela# generate list of library paths for linker script
28964bf6b55bSJuan Quintela
28974bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
28984bf6b55bSJuan Quintela
28994bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
29004bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
29014bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
29024bf6b55bSJuan Quintela  else
29034bf6b55bSJuan Quintela    rm ${config_host_ld}~
29044bf6b55bSJuan Quintela  fi
29054bf6b55bSJuan Quintelafi
29064bf6b55bSJuan Quintela
29074d904533SBlue Swirlfor d in libdis libdis-user; do
29084d904533SBlue Swirl    mkdir -p $d
290911568d6dSPaolo Bonzini    symlink $source_path/Makefile.dis $d/Makefile
29104d904533SBlue Swirl    echo > $d/config.mak
29114d904533SBlue Swirldone
2912d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then
2913d44cff22SRichard Henderson  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2914d44cff22SRichard Hendersonfi
29154d904533SBlue Swirl
291697a847bcSbellardfor target in $target_list; do
291797a847bcSbellardtarget_dir="$target"
291825be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
2919600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
292097a847bcSbellardtarget_bigendian="no"
29211f3d3c8fSJuan Quintela
2922ea2d6a39SJuan Quintelacase "$target_arch2" in
2923613a22c9SMichael Walle  armeb|lm32|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2924ea2d6a39SJuan Quintela  target_bigendian=yes
2925ea2d6a39SJuan Quintela  ;;
2926ea2d6a39SJuan Quintelaesac
292797a847bcSbellardtarget_softmmu="no"
2928997344f3Sbellardtarget_user_only="no"
2929831b7825Sthstarget_linux_user="no"
2930831b7825Sthstarget_darwin_user="no"
293184778508Sblueswir1target_bsd_user="no"
29329e407a85Spbrookcase "$target" in
2933600309b6SBlue Swirl  ${target_arch2}-softmmu)
29349e407a85Spbrook    target_softmmu="yes"
29359e407a85Spbrook    ;;
2936600309b6SBlue Swirl  ${target_arch2}-linux-user)
29379c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
29389c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
29399c7a4202SBlue Swirl      exit 1
29409c7a4202SBlue Swirl    fi
29419e407a85Spbrook    target_user_only="yes"
29429e407a85Spbrook    target_linux_user="yes"
29439e407a85Spbrook    ;;
2944600309b6SBlue Swirl  ${target_arch2}-darwin-user)
29459c7a4202SBlue Swirl    if test "$darwin" != "yes" ; then
29469c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Darwin host"
29479c7a4202SBlue Swirl      exit 1
29489c7a4202SBlue Swirl    fi
29499e407a85Spbrook    target_user_only="yes"
2950831b7825Sths    target_darwin_user="yes"
29519e407a85Spbrook    ;;
2952600309b6SBlue Swirl  ${target_arch2}-bsd-user)
29539cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
29549c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
29559c7a4202SBlue Swirl      exit 1
29569c7a4202SBlue Swirl    fi
295784778508Sblueswir1    target_user_only="yes"
295884778508Sblueswir1    target_bsd_user="yes"
295984778508Sblueswir1    ;;
29609e407a85Spbrook  *)
29619e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
29629e407a85Spbrook    exit 1
29639e407a85Spbrook    ;;
29649e407a85Spbrookesac
2965831b7825Sths
296697a847bcSbellardmkdir -p $target_dir
2967158142c2Sbellardmkdir -p $target_dir/fpu
296857fec1feSbellardmkdir -p $target_dir/tcg
296959f2a787SGerd Hoffmannmkdir -p $target_dir/ide
297084778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
297169de927cSbellard  mkdir -p $target_dir/nwfpe
297269de927cSbellardfi
297311568d6dSPaolo Bonzinisymlink $source_path/Makefile.target $target_dir/Makefile
2974ec530c81Sbellard
297597a847bcSbellard
297625be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
297797a847bcSbellard
2978e5fe0c52Spbrookbflt="no"
2979bd0c5661Spbrooktarget_nptl="no"
2980600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
29817ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
298256aebc89Spbrookgdb_xml_files=""
2983c2e3dee6SLaurent Viviertarget_short_alignment=2
2984c2e3dee6SLaurent Viviertarget_int_alignment=4
2985c2e3dee6SLaurent Viviertarget_long_alignment=4
2986c2e3dee6SLaurent Viviertarget_llong_alignment=8
29877ba1e619Saliguori
2988938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
29896acff7daSJuan QuintelaTARGET_BASE_ARCH=""
2990e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
2991e73aae67SJuan Quintela
2992600309b6SBlue Swirlcase "$target_arch2" in
29932408a527Saurel32  i386)
299471deff27SAurelien Jarno    target_phys_bits=64
29952408a527Saurel32  ;;
29962408a527Saurel32  x86_64)
29976acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
29981ad2134fSPaul Brook    target_phys_bits=64
2999c2e3dee6SLaurent Vivier    target_long_alignment=8
30002408a527Saurel32  ;;
30012408a527Saurel32  alpha)
30021ad2134fSPaul Brook    target_phys_bits=64
3003c2e3dee6SLaurent Vivier    target_long_alignment=8
3004a4b388ffSRichard Henderson    target_nptl="yes"
30052408a527Saurel32  ;;
30062408a527Saurel32  arm|armeb)
3007b498c8a0SJuan Quintela    TARGET_ARCH=arm
3008e5fe0c52Spbrook    bflt="yes"
3009bd0c5661Spbrook    target_nptl="yes"
301056aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
30111ad2134fSPaul Brook    target_phys_bits=32
3012c2e3dee6SLaurent Vivier    target_llong_alignment=4
30132408a527Saurel32  ;;
30142408a527Saurel32  cris)
3015253bd7f8Sedgar_igl    target_nptl="yes"
30161ad2134fSPaul Brook    target_phys_bits=32
30172408a527Saurel32  ;;
3018613a22c9SMichael Walle  lm32)
3019613a22c9SMichael Walle    target_phys_bits=32
3020613a22c9SMichael Walle  ;;
30212408a527Saurel32  m68k)
30220938cda5Saurel32    bflt="yes"
302356aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
30241ad2134fSPaul Brook    target_phys_bits=32
3025c2e3dee6SLaurent Vivier    target_int_alignment=2
3026c2e3dee6SLaurent Vivier    target_long_alignment=2
3027c2e3dee6SLaurent Vivier    target_llong_alignment=2
30282408a527Saurel32  ;;
3029877fdc12SEdgar E. Iglesias  microblaze|microblazeel)
3030877fdc12SEdgar E. Iglesias    TARGET_ARCH=microblaze
303172b675caSEdgar E. Iglesias    bflt="yes"
303272b675caSEdgar E. Iglesias    target_nptl="yes"
303372b675caSEdgar E. Iglesias    target_phys_bits=32
303472b675caSEdgar E. Iglesias  ;;
30352408a527Saurel32  mips|mipsel)
3036b498c8a0SJuan Quintela    TARGET_ARCH=mips
303725be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
3038f04dc72fSPaul Brook    target_nptl="yes"
30391ad2134fSPaul Brook    target_phys_bits=64
30402408a527Saurel32  ;;
30412408a527Saurel32  mipsn32|mipsn32el)
3042b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
30436acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
304425be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
30451ad2134fSPaul Brook    target_phys_bits=64
30462408a527Saurel32  ;;
30472408a527Saurel32  mips64|mips64el)
3048b498c8a0SJuan Quintela    TARGET_ARCH=mips64
30496acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
305025be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
30511ad2134fSPaul Brook    target_phys_bits=64
3052c2e3dee6SLaurent Vivier    target_long_alignment=8
30532408a527Saurel32  ;;
30542408a527Saurel32  ppc)
3055c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
30561ad2134fSPaul Brook    target_phys_bits=32
3057d6630708SNathan Froyd    target_nptl="yes"
30582408a527Saurel32  ;;
30592408a527Saurel32  ppcemb)
30606acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3061e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3062c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
30631ad2134fSPaul Brook    target_phys_bits=64
3064d6630708SNathan Froyd    target_nptl="yes"
30652408a527Saurel32  ;;
30662408a527Saurel32  ppc64)
30676acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3068e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
3069c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
30701ad2134fSPaul Brook    target_phys_bits=64
3071c2e3dee6SLaurent Vivier    target_long_alignment=8
30722408a527Saurel32  ;;
30732408a527Saurel32  ppc64abi32)
3074b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
30756acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
3076e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
307725be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
3078c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
30791ad2134fSPaul Brook    target_phys_bits=64
30802408a527Saurel32  ;;
30812408a527Saurel32  sh4|sh4eb)
3082b498c8a0SJuan Quintela    TARGET_ARCH=sh4
30834dbed897Spbrook    bflt="yes"
30840b6d3ae0Saurel32    target_nptl="yes"
30851ad2134fSPaul Brook    target_phys_bits=32
30862408a527Saurel32  ;;
30872408a527Saurel32  sparc)
30881ad2134fSPaul Brook    target_phys_bits=64
30892408a527Saurel32  ;;
30902408a527Saurel32  sparc64)
30916acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
30921ad2134fSPaul Brook    target_phys_bits=64
3093c2e3dee6SLaurent Vivier    target_long_alignment=8
30942408a527Saurel32  ;;
30952408a527Saurel32  sparc32plus)
3096b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
30976acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
3098e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
309925be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
31001ad2134fSPaul Brook    target_phys_bits=64
31012408a527Saurel32  ;;
310224e804ecSAlexander Graf  s390x)
310324e804ecSAlexander Graf    target_phys_bits=64
310424e804ecSAlexander Graf  ;;
31052408a527Saurel32  *)
3106de83cd02Sbellard    echo "Unsupported target CPU"
3107de83cd02Sbellard    exit 1
31082408a527Saurel32  ;;
31092408a527Saurel32esac
3110c2e3dee6SLaurent Vivierecho "TARGET_SHORT_ALIGNMENT=$target_short_alignment" >> $config_target_mak
3111c2e3dee6SLaurent Vivierecho "TARGET_INT_ALIGNMENT=$target_int_alignment" >> $config_target_mak
3112c2e3dee6SLaurent Vivierecho "TARGET_LONG_ALIGNMENT=$target_long_alignment" >> $config_target_mak
3113c2e3dee6SLaurent Vivierecho "TARGET_LLONG_ALIGNMENT=$target_llong_alignment" >> $config_target_mak
311425be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
3115053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
311625be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
311725be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
311842bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
31196acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then
31206acff7daSJuan Quintela  TARGET_BASE_ARCH=$TARGET_ARCH
31216acff7daSJuan Quintelafi
312225be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
3123e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
3124e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
3125e6e91b9cSJuan Quintelafi
312625be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
31271b0c87fcSJuan Quintelacase "$target_arch2" in
31281b0c87fcSJuan Quintela  i386|x86_64)
31291b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
313025be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
31311b0c87fcSJuan Quintela    fi
31321b0c87fcSJuan Quintelaesac
3133c59249f9SJuan Quintelacase "$target_arch2" in
31340e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
3135c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
3136c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
3137c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
3138c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
31395f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
3140adf82011SRené Rebe      \( "$target_arch2" = "ppc"    -a "$cpu" = "ppc64" \) -o \
3141adf82011SRené Rebe      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
3142c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
3143c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
314425be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
314525be210fSJuan Quintela      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
3146dae5079aSJan Kiszka      if test "$kvm_para" = "yes"; then
3147dae5079aSJan Kiszka        echo "CONFIG_KVM_PARA=y" >> $config_target_mak
3148dae5079aSJan Kiszka      fi
3149d5970055SMichael S. Tsirkin      if test $vhost_net = "yes" ; then
3150d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
3151d5970055SMichael S. Tsirkin      fi
3152c59249f9SJuan Quintela    fi
3153c59249f9SJuan Quintelaesac
3154de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
315525be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
315697a847bcSbellardfi
315797a847bcSbellardif test "$target_softmmu" = "yes" ; then
3158b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
315925be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
316025be210fSJuan Quintela  echo "LIBS+=$libs_softmmu" >> $config_target_mak
31610e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
31625791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
3163de83cd02Sbellardfi
3164997344f3Sbellardif test "$target_user_only" = "yes" ; then
316525be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
3166997344f3Sbellardfi
3167831b7825Sthsif test "$target_linux_user" = "yes" ; then
316825be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
3169831b7825Sthsfi
3170831b7825Sthsif test "$target_darwin_user" = "yes" ; then
317125be210fSJuan Quintela  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
3172831b7825Sthsfi
317356aebc89Spbrooklist=""
317456aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
317556aebc89Spbrook  for x in $gdb_xml_files; do
317656aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
317756aebc89Spbrook  done
317825be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
31793d0f1517SJuan Quintelafi
3180de83cd02Sbellard
3181f57975fbSJuan Quintelacase "$target_arch2" in
3182eb8f7776SAurelien Jarno  i386|x86_64)
3183eb8f7776SAurelien Jarno    echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
3184f57975fbSJuan Quintela    ;;
3185d6b38939SJuan Quintela  *)
3186eb8f7776SAurelien Jarno    echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
3187d6b38939SJuan Quintela    ;;
3188f57975fbSJuan Quintelaesac
3189f57975fbSJuan Quintela
3190e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
319125be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
3192e5fe0c52Spbrookfi
3193bd0c5661Spbrookif test "$target_user_only" = "yes" \
3194bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
319525be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
3196bd0c5661Spbrookfi
3197379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
319825be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
3199379f6698SPaul Brookfi
320084778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
320125be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
320284778508Sblueswir1fi
32035b0753e0Sbellard
32044afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
3205fa282484SJuan Quintela
32064afddb55SJuan Quintelacflags=""
3207f9728943SPaolo Bonziniincludes=""
3208fa282484SJuan Quintelaldflags=""
32099b8e111fSJuan Quintela
321057ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then
3211f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/sparc $includes"
321224e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
3213f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/s390 $includes"
32145d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
3215f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/i386 $includes"
321657ddfbf7SJuan Quintelaelse
3217f9728943SPaolo Bonzini  includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes"
321857ddfbf7SJuan Quintelafi
3219f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/tcg $includes"
3220f9728943SPaolo Bonziniincludes="-I\$(SRC_PATH)/fpu $includes"
322157ddfbf7SJuan Quintela
32224d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
32234d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
32244d904533SBlue Swirlelse
32254d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
32264d904533SBlue Swirlfi
32274d904533SBlue Swirl
322864656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
322964656024SJuan Quintela  case "$i" in
323064656024SJuan Quintela  alpha)
323125be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
32324d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
323364656024SJuan Quintela  ;;
323464656024SJuan Quintela  arm)
323525be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
32364d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
323764656024SJuan Quintela  ;;
323864656024SJuan Quintela  cris)
323925be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
32404d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
324164656024SJuan Quintela  ;;
324264656024SJuan Quintela  hppa)
324325be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
32444d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
324564656024SJuan Quintela  ;;
324664656024SJuan Quintela  i386|x86_64)
324725be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
32484d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
324964656024SJuan Quintela  ;;
3250903ec55cSAurelien Jarno  ia64*)
3251903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
3252903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
3253903ec55cSAurelien Jarno  ;;
325464656024SJuan Quintela  m68k)
325525be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
32564d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
325764656024SJuan Quintela  ;;
3258877fdc12SEdgar E. Iglesias  microblaze*)
325925be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
32604d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
326164656024SJuan Quintela  ;;
326264656024SJuan Quintela  mips*)
326325be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
32644d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
326564656024SJuan Quintela  ;;
326664656024SJuan Quintela  ppc*)
326725be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
32684d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
326964656024SJuan Quintela  ;;
327024e804ecSAlexander Graf  s390*)
327125be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
32724d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
327364656024SJuan Quintela  ;;
327464656024SJuan Quintela  sh4)
327525be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
32764d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
327764656024SJuan Quintela  ;;
327864656024SJuan Quintela  sparc*)
327925be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
32804d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
328164656024SJuan Quintela  ;;
328264656024SJuan Quintela  esac
328364656024SJuan Quinteladone
328464656024SJuan Quintela
32856ee7126fSJuan Quintelacase "$ARCH" in
32866ee7126fSJuan Quintelaalpha)
32876ee7126fSJuan Quintela  # Ensure there's only a single GP
32886ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
32896ee7126fSJuan Quintela;;
32906ee7126fSJuan Quintelaesac
32916ee7126fSJuan Quintela
329255d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
329355d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
329455d9c04bSJuan Quintela  arm)
329555d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
329655d9c04bSJuan Quintela  ;;
329755d9c04bSJuan Quintela  i386|mips|ppc)
329855d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
329955d9c04bSJuan Quintela  ;;
330055d9c04bSJuan Quintela  esac
330155d9c04bSJuan Quintelafi
330255d9c04bSJuan Quintela
330334005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \
330434005a00SKirill A. Shutemov	"$user_pie" = "yes" ; then
330534005a00SKirill A. Shutemov  cflags="-fpie $cflags"
330634005a00SKirill A. Shutemov  ldflags="-pie $ldflags"
330734005a00SKirill A. Shutemovfi
330834005a00SKirill A. Shutemov
3309471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \
3310471857ddSJuan Quintela        "$TARGET_ARCH" = "microblaze" -o \
3311471857ddSJuan Quintela        "$TARGET_ARCH" = "cris" \) ; then
331225be210fSJuan Quintela  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
3313471857ddSJuan Quintelafi
3314471857ddSJuan Quintela
3315d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
331625be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
3317d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
3318d02c1db3SJuan Quintela    cflags="-p $cflags"
3319d02c1db3SJuan Quintela    ldflags="-p $ldflags"
3320d02c1db3SJuan Quintela  fi
3321d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
3322d02c1db3SJuan Quintela    ldflags="-p $ldflags"
332325be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
3324d02c1db3SJuan Quintela  fi
3325d02c1db3SJuan Quintelafi
3326d02c1db3SJuan Quintela
33276ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
33289b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
3329fa282484SJuan Quintela  case "$ARCH" in
3330fa282484SJuan Quintela  sparc)
3331fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
3332322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
3333fa282484SJuan Quintela    ;;
33344d58be06SRichard Henderson  alpha | s390x)
33354d58be06SRichard Henderson    # The default placement of the application is fine.
33364d58be06SRichard Henderson    ;;
3337fd76e73aSRichard Henderson  *)
3338322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
3339fa282484SJuan Quintela    ;;
3340fa282484SJuan Quintela  esac
3341fa282484SJuan Quintelafi
3342fa282484SJuan Quintela
334325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
334425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
3345f9728943SPaolo Bonziniecho "QEMU_INCLUDES+=$includes" >> $config_target_mak
3346fa282484SJuan Quintela
334797a847bcSbellarddone # for target in $targets
33487d13299dSbellard
3349d1807a4fSPaolo Bonzini# build tree in object directory in case the source is not in the current directory
3350e1144d00SMark McLoughlinDIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
33512d9f27d2SAnthony LiguoriDIRS="$DIRS roms/seabios roms/vgabios"
33523e230dd2SCorentin CharyDIRS="$DIRS fsdev ui"
33537d13299dSbellardFILES="Makefile tests/Makefile"
3354e7daa605SthsFILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
3355ae0bfb79SBlue SwirlFILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
33562d9f27d2SAnthony LiguoriFILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
33577ea78b74SJan Kiszkafor bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
33587ea78b74SJan Kiszka    FILES="$FILES pc-bios/`basename $bios_file`"
33597ea78b74SJan Kiszkadone
3360d1807a4fSPaolo Bonzinimkdir -p $DIRS
33617d13299dSbellardfor f in $FILES ; do
3362eae30c8fSAurelien Jarno    test -e $f || symlink $source_path/$f $f
33637d13299dSbellarddone
33641ad2134fSPaul Brook
3365c34ebfdcSAnthony Liguori# temporary config to build submodules
33662d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
3367c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
336837116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
3369c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3370c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
3371c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
3372c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
3373c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
3374c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
3375c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
3376c34ebfdcSAnthony Liguoridone
3377c34ebfdcSAnthony Liguori
33781ad2134fSPaul Brookfor hwlib in 32 64; do
33791ad2134fSPaul Brook  d=libhw$hwlib
33801ad2134fSPaul Brook  mkdir -p $d
33819953b2fcSBlue Swirl  mkdir -p $d/ide
338211568d6dSPaolo Bonzini  symlink $source_path/Makefile.hw $d/Makefile
338337116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
33841ad2134fSPaul Brookdone
3385add16157SBlue Swirl
3386add16157SBlue Swirld=libuser
3387add16157SBlue Swirlmkdir -p $d
338811568d6dSPaolo Bonzinisymlink $source_path/Makefile.user $d/Makefile
3389299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then
3390299060a0SKirill A. Shutemov  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3391299060a0SKirill A. Shutemovfi
3392b40292e7SJan Kiszka
3393b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
3394b40292e7SJan Kiszka  mkdir -p QMP
3395b40292e7SJan Kiszkafi
3396