xref: /openbmc/qemu/configure (revision 952afb71)
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
184021d247SAurelien Jarnotrap "rm -f $TMPC $TMPO $TMPE ; exit" EXIT INT QUIT TERM
199ac81bbbSmalc
2052166aa0SJuan Quintelacompile_object() {
21a558ee17SJuan Quintela  $cc $QEMU_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
2252166aa0SJuan Quintela}
2352166aa0SJuan Quintela
2452166aa0SJuan Quintelacompile_prog() {
2552166aa0SJuan Quintela  local_cflags="$1"
2652166aa0SJuan Quintela  local_ldflags="$2"
27a558ee17SJuan Quintela  $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
2852166aa0SJuan Quintela}
2952166aa0SJuan Quintela
300dba6195SLoïc Minier# check whether a command is available to this shell (may be either an
310dba6195SLoïc Minier# executable or a builtin)
320dba6195SLoïc Minierhas() {
330dba6195SLoïc Minier    type "$1" >/dev/null 2>&1
340dba6195SLoïc Minier}
350dba6195SLoïc Minier
360dba6195SLoïc Minier# search for an executable in PATH
370dba6195SLoïc Minierpath_of() {
380dba6195SLoïc Minier    local_command="$1"
390dba6195SLoïc Minier    local_ifs="$IFS"
400dba6195SLoïc Minier    local_dir=""
410dba6195SLoïc Minier
420dba6195SLoïc Minier    # pathname has a dir component?
430dba6195SLoïc Minier    if [ "${local_command#*/}" != "$local_command" ]; then
440dba6195SLoïc Minier        if [ -x "$local_command" ] && [ ! -d "$local_command" ]; then
450dba6195SLoïc Minier            echo "$local_command"
460dba6195SLoïc Minier            return 0
470dba6195SLoïc Minier        fi
480dba6195SLoïc Minier    fi
490dba6195SLoïc Minier    if [ -z "$local_command" ]; then
500dba6195SLoïc Minier        return 1
510dba6195SLoïc Minier    fi
520dba6195SLoïc Minier
530dba6195SLoïc Minier    IFS=:
540dba6195SLoïc Minier    for local_dir in $PATH; do
550dba6195SLoïc Minier        if [ -x "$local_dir/$local_command" ] && [ ! -d "$local_dir/$local_command" ]; then
560dba6195SLoïc Minier            echo "$local_dir/$local_command"
570dba6195SLoïc Minier            IFS="${local_ifs:-$(printf ' \t\n')}"
580dba6195SLoïc Minier            return 0
590dba6195SLoïc Minier        fi
600dba6195SLoïc Minier    done
610dba6195SLoïc Minier    # not found
620dba6195SLoïc Minier    IFS="${local_ifs:-$(printf ' \t\n')}"
630dba6195SLoïc Minier    return 1
640dba6195SLoïc Minier}
650dba6195SLoïc Minier
667d13299dSbellard# default parameters
672ff6b91eSJuan Quintelacpu=""
681e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
6943ce4dfeSbellardstatic="no"
70ed968ff1SJuan Quintelasparc_cpu=""
717d13299dSbellardcross_prefix=""
727d13299dSbellardcc="gcc"
730c58ac1cSmalcaudio_drv_list=""
744c9b53e3Smalcaudio_card_list="ac97 es1370 sb16"
754c9b53e3Smalcaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
76eb852011SMarkus Armbrusterblock_drv_whitelist=""
777d13299dSbellardhost_cc="gcc"
787d13299dSbellardar="ar"
797d13299dSbellardmake="make"
806a882643Spbrookinstall="install"
817aa486feSAnthony Liguoriobjcopy="objcopy"
827aa486feSAnthony Liguorild="ld"
8352ba784dSHollis Blanchardstrip="strip"
84c81da56eSJuan Quintelahelper_cflags=""
8573da375eSJuan Quintelalibs_softmmu=""
863e2e0e6bSJuan Quintelalibs_tools=""
8767f86e8eSJuan Quintelaaudio_pt_int=""
88d5631638Smalcaudio_win_int=""
89ac0df51dSaliguori
90ac0df51dSaliguori# parse CC options first
91ac0df51dSaliguorifor opt do
92ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
93ac0df51dSaliguori  case "$opt" in
94ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
95ac0df51dSaliguori  ;;
96ac0df51dSaliguori  --cc=*) cc="$optarg"
97ac0df51dSaliguori  ;;
982ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
992ff6b91eSJuan Quintela  ;;
100a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
101e2a2ed06SJuan Quintela  ;;
102e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
103e2a2ed06SJuan Quintela  ;;
10450e7b1a0SJuan Quintela  --sparc_cpu=*)
10550e7b1a0SJuan Quintela    sparc_cpu="$optarg"
10650e7b1a0SJuan Quintela    case $sparc_cpu in
107ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
10850e7b1a0SJuan Quintela      cpu="sparc"
10950e7b1a0SJuan Quintela    ;;
11050e7b1a0SJuan Quintela    v9)
11150e7b1a0SJuan Quintela      cpu="sparc64"
11250e7b1a0SJuan Quintela    ;;
11350e7b1a0SJuan Quintela    *)
11450e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
11550e7b1a0SJuan Quintela      exit 1
11650e7b1a0SJuan Quintela    ;;
11750e7b1a0SJuan Quintela    esac
11850e7b1a0SJuan Quintela  ;;
119ac0df51dSaliguori  esac
120ac0df51dSaliguoridone
121ac0df51dSaliguori# OS specific
122ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
123ac0df51dSaliguori# we can eliminate it's usage altogether
124ac0df51dSaliguori
125ac0df51dSaliguoricc="${cross_prefix}${cc}"
126ac0df51dSaliguoriar="${cross_prefix}${ar}"
1277aa486feSAnthony Liguoriobjcopy="${cross_prefix}${objcopy}"
1287aa486feSAnthony Liguorild="${cross_prefix}${ld}"
12952ba784dSHollis Blanchardstrip="${cross_prefix}${strip}"
130ac0df51dSaliguori
131be17dc90SMichael S. Tsirkin# default flags for all hosts
132be17dc90SMichael S. TsirkinQEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
133be17dc90SMichael S. TsirkinCFLAGS="-g $CFLAGS"
134be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
135be17dc90SMichael S. TsirkinQEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
136be17dc90SMichael S. TsirkinQEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
13784958305SKirill A. ShutemovQEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
138be17dc90SMichael S. TsirkinQEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
139be17dc90SMichael S. TsirkinLDFLAGS="-g $LDFLAGS"
140be17dc90SMichael S. Tsirkin
141a21493e0SBlue Swirlgcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
142a21493e0SBlue Swirlgcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
1430b65b9e1SBlue Swirlgcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
144a21493e0SBlue Swirlgcc_flags="-fstack-protector-all $gcc_flags"
145be17dc90SMichael S. Tsirkincat > $TMPC << EOF
146aa527b65SAurelien Jarnoint main(void) { return 0; }
147be17dc90SMichael S. TsirkinEOF
148be17dc90SMichael S. Tsirkinfor flag in $gcc_flags; do
149aa527b65SAurelien Jarno    if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
150be17dc90SMichael S. Tsirkin	QEMU_CFLAGS="$flag $QEMU_CFLAGS"
151be17dc90SMichael S. Tsirkin    fi
152be17dc90SMichael S. Tsirkindone
153be17dc90SMichael S. Tsirkin
154ac0df51dSaliguori# check that the C compiler works.
155ac0df51dSaliguoricat > $TMPC <<EOF
156ac0df51dSaliguoriint main(void) {}
157ac0df51dSaliguoriEOF
158ac0df51dSaliguori
15952166aa0SJuan Quintelaif compile_object ; then
160ac0df51dSaliguori  : C compiler works ok
161ac0df51dSaliguorielse
162ac0df51dSaliguori    echo "ERROR: \"$cc\" either does not exist or does not work"
163ac0df51dSaliguori    exit 1
164ac0df51dSaliguorifi
165ac0df51dSaliguori
166ac0df51dSaliguoricheck_define() {
167ac0df51dSaliguoricat > $TMPC <<EOF
168ac0df51dSaliguori#if !defined($1)
169ac0df51dSaliguori#error Not defined
170ac0df51dSaliguori#endif
171ac0df51dSaliguoriint main(void) { return 0; }
172ac0df51dSaliguoriEOF
17352166aa0SJuan Quintela  compile_object
174ac0df51dSaliguori}
175ac0df51dSaliguori
1762ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
1772ff6b91eSJuan Quintela  # command line argument
1782ff6b91eSJuan Quintela  :
1792ff6b91eSJuan Quintelaelif check_define __i386__ ; then
180ac0df51dSaliguori  cpu="i386"
181ac0df51dSaliguorielif check_define __x86_64__ ; then
182ac0df51dSaliguori  cpu="x86_64"
1833aa9bd6cSblueswir1elif check_define __sparc__ ; then
1843aa9bd6cSblueswir1  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
1853aa9bd6cSblueswir1  # They must be specified using --sparc_cpu
1863aa9bd6cSblueswir1  if check_define __arch64__ ; then
1873aa9bd6cSblueswir1    cpu="sparc64"
1883aa9bd6cSblueswir1  else
1893aa9bd6cSblueswir1    cpu="sparc"
1903aa9bd6cSblueswir1  fi
191fdf7ed96Smalcelif check_define _ARCH_PPC ; then
192fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
193fdf7ed96Smalc    cpu="ppc64"
194ac0df51dSaliguori  else
195fdf7ed96Smalc    cpu="ppc"
196fdf7ed96Smalc  fi
197afa05235SAurelien Jarnoelif check_define __mips__ ; then
198afa05235SAurelien Jarno  cpu="mips"
199477ba620SAurelien Jarnoelif check_define __ia64__ ; then
200477ba620SAurelien Jarno  cpu="ia64"
201d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
202d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
203d66ed0eaSAurelien Jarno    cpu="s390x"
204d66ed0eaSAurelien Jarno  else
205d66ed0eaSAurelien Jarno    cpu="s390"
206d66ed0eaSAurelien Jarno  fi
207fdf7ed96Smalcelse
208fdf7ed96Smalc  cpu=`uname -m`
209ac0df51dSaliguorifi
210ac0df51dSaliguori
2115327cf48Sbellardtarget_list=""
2127d13299dSbellardcase "$cpu" in
213afa05235SAurelien Jarno  alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
214ea8f20f8SJuan Quintela    cpu="$cpu"
215ea8f20f8SJuan Quintela  ;;
2167d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
21797a847bcSbellard    cpu="i386"
2187d13299dSbellard  ;;
219aaa5fa14Saurel32  x86_64|amd64)
220aaa5fa14Saurel32    cpu="x86_64"
221aaa5fa14Saurel32  ;;
222ba68055eSbellard  armv*b)
223808c4954Sbellard    cpu="armv4b"
224808c4954Sbellard  ;;
225ba68055eSbellard  armv*l)
2267d13299dSbellard    cpu="armv4l"
2277d13299dSbellard  ;;
228f54b3f92Saurel32  parisc|parisc64)
229f54b3f92Saurel32    cpu="hppa"
230f54b3f92Saurel32  ;;
231afa05235SAurelien Jarno  mips*)
232afa05235SAurelien Jarno    cpu="mips"
233afa05235SAurelien Jarno  ;;
23424e804ecSAlexander Graf  s390)
235fb3e5849Sbellard    cpu="s390"
236fb3e5849Sbellard  ;;
23724e804ecSAlexander Graf  s390x)
23824e804ecSAlexander Graf    cpu="s390x"
23924e804ecSAlexander Graf  ;;
2403142255cSblueswir1  sparc|sun4[cdmuv])
241ae228531Sbellard    cpu="sparc"
242ae228531Sbellard  ;;
2437d13299dSbellard  *)
244a447d4dcSPaolo Bonzini    echo "Unsupported CPU = $cpu"
245a447d4dcSPaolo Bonzini    exit 1
2467d13299dSbellard  ;;
2477d13299dSbellardesac
248e2d52ad3SJuan Quintela
2493a3fb96dSStefan Weil# Default value for a variable defining feature "foo".
2503a3fb96dSStefan Weil#  * foo="no"  feature will only be used if --enable-foo arg is given
2513a3fb96dSStefan Weil#  * foo=""    feature will be searched for, and if found, will be used
2523a3fb96dSStefan Weil#              unless --disable-foo is given
2533a3fb96dSStefan Weil#  * foo="yes" this value will only be set by --enable-foo flag.
2543a3fb96dSStefan Weil#              feature will searched for,
2553a3fb96dSStefan Weil#              if not found, configure exits with error
256e2d52ad3SJuan Quintela#
2573a3fb96dSStefan Weil# Always add --enable-foo and --disable-foo command line args.
2583a3fb96dSStefan Weil# Distributions want to ensure that several features are compiled in, and it
2593a3fb96dSStefan Weil# is impossible without a --enable-foo that exits if a feature is not found.
260e2d52ad3SJuan Quintela
261a20a6f46SJuan Quintelabluez=""
2624ffcedb6SJuan Quintelabrlapi=""
263788c8196SJuan Quintelacurl=""
264c584a6d0SJuan Quintelacurses=""
265a25dba17SJuan Quinteladocs=""
2662df87df7SJuan Quintelafdt=""
267b31a0277SJuan Quintelakvm=""
268dae5079aSJan Kiszkakvm_para=""
269b0a47e79SJuan Quintelanptl=""
270c4198157SJuan Quintelasdl=""
271dfffc653SJuan Quintelasparse="no"
272ee682d27SStefan Weiluuid=""
273dfb278bdSJuan Quintelavde=""
2741be10ad2SJuan Quintelavnc_tls=""
275ea784e3bSJuan Quintelavnc_sasl=""
2762f6f5c7aSCorentin Charyvnc_jpeg=""
277efe556adSCorentin Charyvnc_png=""
27896763cf9SCorentin Charyvnc_thread="no"
279fc321b4bSJuan Quintelaxen=""
2805c6c3a6cSChristoph Hellwiglinux_aio=""
281758e8e38SVenkateswararao Jujjuri (JV)attr=""
282d5970055SMichael S. Tsirkinvhost_net=""
283dfb278bdSJuan Quintela
2847d13299dSbellardgprof="no"
285f8393946Saurel32debug_tcg="no"
286b4475aa2SLuiz Capitulinodebug_mon="no"
287f3d08ee6SPaul Brookdebug="no"
2881625af87Saliguoristrip_opt="yes"
2897d13299dSbellardbigendian="no"
29067b915a5Sbellardmingw32="no"
29167b915a5SbellardEXESUF=""
292683035deSPaolo Bonziniprefix="/usr/local"
293683035deSPaolo Bonzinimandir="\${prefix}/share/man"
294683035deSPaolo Bonzinidatadir="\${prefix}/share/qemu"
295683035deSPaolo Bonzinidocdir="\${prefix}/share/doc/qemu"
296683035deSPaolo Bonzinibindir="\${prefix}/bin"
297683035deSPaolo Bonzinisysconfdir="\${prefix}/etc"
298683035deSPaolo Bonziniconfsuffix="/qemu"
299443f1376Sbellardslirp="yes"
300102a52e4Sbellardfmod_lib=""
301102a52e4Sbellardfmod_inc=""
3022f6a1ab0Sblueswir1oss_lib=""
303b1a550a0Spbrookbsd="no"
3045327cf48Sbellardlinux="no"
305d2c7c9b8Sblueswir1solaris="no"
30605c2a3e7Sbellardprofiler="no"
3075b0753e0Sbellardcocoa="no"
3080a8e90f4Spbrooksoftmmu="yes"
309831b7825Sthslinux_user="no"
310831b7825Sthsdarwin_user="no"
31184778508Sblueswir1bsd_user="no"
312379f6698SPaul Brookguest_base=""
313c5937220Spbrookuname_release=""
314e5d355d1Saliguoriio_thread="no"
3158ff9cbf7Smalcmixemu="no"
316eac30262Saliguorikerneldir=""
317b29fe3edSmalcaix="no"
31877755340Sthsblobs="yes"
3194a19f1ecSpbrookpkgversion=""
3205495ed11SLuiz Capitulinocheck_utests="no"
32134005a00SKirill A. Shutemovuser_pie="no"
32220ff6c80SAnthony Liguorizero_malloc=""
32394a420b1SStefan Hajnoczitrace_backend="nop"
3249410b56cSPrerna Saxenatrace_file="trace"
3257d13299dSbellard
3267d13299dSbellard# OS specific
327ac0df51dSaliguoriif check_define __linux__ ; then
328ac0df51dSaliguori  targetos="Linux"
329ac0df51dSaliguorielif check_define _WIN32 ; then
330ac0df51dSaliguori  targetos='MINGW32'
331169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
332169dc5d3Sblueswir1  targetos='OpenBSD'
333169dc5d3Sblueswir1elif check_define __sun__ ; then
334169dc5d3Sblueswir1  targetos='SunOS'
335ac0df51dSaliguorielse
3367d13299dSbellard  targetos=`uname -s`
337ac0df51dSaliguorifi
3380dbfc675SJuan Quintela
3397d13299dSbellardcase $targetos in
340c326e0afSbellardCYGWIN*)
341c326e0afSbellard  mingw32="yes"
342a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
343d5631638Smalc  audio_possible_drivers="winwave sdl"
344d5631638Smalc  audio_drv_list="winwave"
345c326e0afSbellard;;
34667b915a5SbellardMINGW32*)
34767b915a5Sbellard  mingw32="yes"
348d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
349d5631638Smalc  audio_drv_list="winwave"
35067b915a5Sbellard;;
3515c40d2bdSthsGNU/kFreeBSD)
352a167ba50SAurelien Jarno  bsd="yes"
3530c58ac1cSmalc  audio_drv_list="oss"
354f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3555c40d2bdSths;;
3567d3505c5SbellardFreeBSD)
3577d3505c5Sbellard  bsd="yes"
358a167ba50SAurelien Jarno  make="gmake"
3590c58ac1cSmalc  audio_drv_list="oss"
360f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
361f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
362f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3637d3505c5Sbellard;;
364c5e97233Sblueswir1DragonFly)
365c5e97233Sblueswir1  bsd="yes"
366a167ba50SAurelien Jarno  make="gmake"
367c5e97233Sblueswir1  audio_drv_list="oss"
368c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
369c5e97233Sblueswir1;;
3707d3505c5SbellardNetBSD)
3717d3505c5Sbellard  bsd="yes"
372a167ba50SAurelien Jarno  make="gmake"
3730c58ac1cSmalc  audio_drv_list="oss"
374c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3758ef92a88Sblueswir1  oss_lib="-lossaudio"
3767d3505c5Sbellard;;
3777d3505c5SbellardOpenBSD)
3787d3505c5Sbellard  bsd="yes"
379a167ba50SAurelien Jarno  make="gmake"
3800c58ac1cSmalc  audio_drv_list="oss"
381c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3822f6a1ab0Sblueswir1  oss_lib="-lossaudio"
3837d3505c5Sbellard;;
38483fb7adfSbellardDarwin)
38583fb7adfSbellard  bsd="yes"
38683fb7adfSbellard  darwin="yes"
3870dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
3880dbfc675SJuan Quintela  # run 64-bit userspace code
389aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
3901b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
391aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
3921b0f9cc2Saliguori  fi
3931b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
394a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
3950c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
3961b0f9cc2Saliguori  else
397a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
3981b0f9cc2Saliguori  fi
399831b7825Sths  darwin_user="yes"
400fd677642Sths  cocoa="yes"
4010c58ac1cSmalc  audio_drv_list="coreaudio"
402c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4030c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4047973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
40583fb7adfSbellard;;
406ec530c81SbellardSunOS)
407ec530c81Sbellard  solaris="yes"
408c2b84fabSths  make="gmake"
409c2b84fabSths  install="ginstall"
410fa58948dSBlue Swirl  ld="gld"
4110475a5caSths  needs_libsunmath="no"
412c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
413ef18c883Sths  # have to select again, because `uname -m` returns i86pc
414ef18c883Sths  # even on an x86_64 box.
415ef18c883Sths  solariscpu=`isainfo -k`
416ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
417ef18c883Sths    cpu="x86_64"
418ef18c883Sths  fi
419c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4200475a5caSths    if test "$solarisrev" -le 9 ; then
4210475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4220475a5caSths        needs_libsunmath="yes"
423f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
424f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
425f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4260475a5caSths      else
4270475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4280475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4290475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4300475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4310475a5caSths        exit 1
4320475a5caSths      fi
4330475a5caSths    fi
43486b2bd93Sths  fi
4356b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4360c58ac1cSmalc    audio_drv_list="oss"
4376b4d2ba1Sths  fi
438c2de5c91Smalc  audio_possible_drivers="oss sdl"
439d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
440d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
441d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
442d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
443a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
444e174c0bbSJuan Quintela  LIBS="-lsocket -lnsl -lresolv $LIBS"
445ec530c81Sbellard;;
446b29fe3edSmalcAIX)
447b29fe3edSmalc  aix="yes"
448b29fe3edSmalc  make="gmake"
449b29fe3edSmalc;;
450fb065187Sbellard*)
4510c58ac1cSmalc  audio_drv_list="oss"
452b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4535327cf48Sbellard  linux="yes"
454831b7825Sths  linux_user="yes"
45568063649Sblueswir1  usb="linux"
45607f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
457c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
458c9ec1fe4Sbellard  fi
459fb065187Sbellard;;
4607d13299dSbellardesac
4617d13299dSbellard
4627d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
463b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
46468063649Sblueswir1    usb="bsd"
46583fb7adfSbellard  fi
46684778508Sblueswir1  bsd_user="yes"
4677d3505c5Sbellardfi
4687d3505c5Sbellard
4693457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
4703457a3f8SJuan Quintela  EXESUF=".exe"
471a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
472e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
473e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
474884044aaSJuan Quintela  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
475683035deSPaolo Bonzini  prefix="c:/Program Files/Qemu"
476683035deSPaolo Bonzini  mandir="\${prefix}"
477683035deSPaolo Bonzini  datadir="\${prefix}"
478683035deSPaolo Bonzini  docdir="\${prefix}"
479683035deSPaolo Bonzini  bindir="\${prefix}"
480683035deSPaolo Bonzini  sysconfdir="\${prefix}"
481683035deSPaolo Bonzini  confsuffix=""
4823457a3f8SJuan Quintelafi
4833457a3f8SJuan Quintela
4847d13299dSbellard# find source path
485ad064840Spbrooksource_path=`dirname "$0"`
48659faef3aSbalrogsource_path_used="no"
48759faef3aSbalrogworkdir=`pwd`
488ad064840Spbrookif [ -z "$source_path" ]; then
48959faef3aSbalrog    source_path=$workdir
490ad064840Spbrookelse
491ad064840Spbrook    source_path=`cd "$source_path"; pwd`
4927d13299dSbellardfi
493724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes"
4947d13299dSbellard
495487fefdbSAnthony Liguoriwerror=""
49685aa5189Sbellard
4977d13299dSbellardfor opt do
498a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
4997d13299dSbellard  case "$opt" in
5002efc3265Sbellard  --help|-h) show_help=yes
5012efc3265Sbellard  ;;
502b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5037d13299dSbellard  ;;
504b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
50532ce6337Sbellard  ;;
506b1a550a0Spbrook  --source-path=*) source_path="$optarg"
507ad064840Spbrook  source_path_used="yes"
5087d13299dSbellard  ;;
509ac0df51dSaliguori  --cross-prefix=*)
5107d13299dSbellard  ;;
511ac0df51dSaliguori  --cc=*)
5127d13299dSbellard  ;;
513b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
51483469015Sbellard  ;;
515b1a550a0Spbrook  --make=*) make="$optarg"
5167d13299dSbellard  ;;
5176a882643Spbrook  --install=*) install="$optarg"
5186a882643Spbrook  ;;
519e2a2ed06SJuan Quintela  --extra-cflags=*)
5207d13299dSbellard  ;;
521e2a2ed06SJuan Quintela  --extra-ldflags=*)
5227d13299dSbellard  ;;
5232ff6b91eSJuan Quintela  --cpu=*)
5247d13299dSbellard  ;;
525b1a550a0Spbrook  --target-list=*) target_list="$optarg"
526de83cd02Sbellard  ;;
52794a420b1SStefan Hajnoczi  --trace-backend=*) trace_backend="$optarg"
52894a420b1SStefan Hajnoczi  ;;
5299410b56cSPrerna Saxena  --trace-file=*) trace_file="$optarg"
5309410b56cSPrerna Saxena  ;;
5317d13299dSbellard  --enable-gprof) gprof="yes"
5327d13299dSbellard  ;;
53379427693SLoïc Minier  --static)
53479427693SLoïc Minier    static="yes"
53579427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
53643ce4dfeSbellard  ;;
5370b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5380b24e75fSPaolo Bonzini  ;;
5390b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5400b24e75fSPaolo Bonzini  ;;
5410b24e75fSPaolo Bonzini  --datadir=*) datadir="$optarg"
5420b24e75fSPaolo Bonzini  ;;
5430b24e75fSPaolo Bonzini  --docdir=*) docdir="$optarg"
5440b24e75fSPaolo Bonzini  ;;
545ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
54607381cc1SAnthony Liguori  ;;
54797a847bcSbellard  --disable-sdl) sdl="no"
54897a847bcSbellard  ;;
549c4198157SJuan Quintela  --enable-sdl) sdl="yes"
550c4198157SJuan Quintela  ;;
551b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
552102a52e4Sbellard  ;;
553c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
554c2de5c91Smalc  ;;
5552f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
5562f6a1ab0Sblueswir1  ;;
5572fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
5580c58ac1cSmalc  ;;
5590c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
5600c58ac1cSmalc  ;;
561eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
562eb852011SMarkus Armbruster  ;;
563f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
564f8393946Saurel32  ;;
565f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
566f8393946Saurel32  ;;
567b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
568b4475aa2SLuiz Capitulino  ;;
569b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
570b4475aa2SLuiz Capitulino  ;;
571f3d08ee6SPaul Brook  --enable-debug)
572f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
573f3d08ee6SPaul Brook      debug_tcg="yes"
574b4475aa2SLuiz Capitulino      debug_mon="yes"
575f3d08ee6SPaul Brook      debug="yes"
576f3d08ee6SPaul Brook      strip_opt="no"
577f3d08ee6SPaul Brook  ;;
57803b4fe7dSaliguori  --enable-sparse) sparse="yes"
57903b4fe7dSaliguori  ;;
58003b4fe7dSaliguori  --disable-sparse) sparse="no"
58103b4fe7dSaliguori  ;;
5821625af87Saliguori  --disable-strip) strip_opt="no"
5831625af87Saliguori  ;;
5848d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
5858d5d2d4cSths  ;;
5861be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
5871be10ad2SJuan Quintela  ;;
5882f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
5892f9606b3Saliguori  ;;
590ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
591ea784e3bSJuan Quintela  ;;
5922f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
5932f6f5c7aSCorentin Chary  ;;
5942f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
5952f6f5c7aSCorentin Chary  ;;
596efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
597efe556adSCorentin Chary  ;;
598efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
599efe556adSCorentin Chary  ;;
600bd023f95SCorentin Chary  --disable-vnc-thread) vnc_thread="no"
601bd023f95SCorentin Chary  ;;
602bd023f95SCorentin Chary  --enable-vnc-thread) vnc_thread="yes"
603bd023f95SCorentin Chary  ;;
604443f1376Sbellard  --disable-slirp) slirp="no"
605c20709aaSbellard  ;;
606ee682d27SStefan Weil  --disable-uuid) uuid="no"
607ee682d27SStefan Weil  ;;
608ee682d27SStefan Weil  --enable-uuid) uuid="yes"
609ee682d27SStefan Weil  ;;
610e0e6c8c0Saliguori  --disable-vde) vde="no"
6118a16d273Sths  ;;
612dfb278bdSJuan Quintela  --enable-vde) vde="yes"
613dfb278bdSJuan Quintela  ;;
614e37630caSaliguori  --disable-xen) xen="no"
615e37630caSaliguori  ;;
616fc321b4bSJuan Quintela  --enable-xen) xen="yes"
617fc321b4bSJuan Quintela  ;;
6182e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6192e4d9fb1Saurel32  ;;
6204ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6214ffcedb6SJuan Quintela  ;;
622fb599c9aSbalrog  --disable-bluez) bluez="no"
623fb599c9aSbalrog  ;;
624a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
625a20a6f46SJuan Quintela  ;;
6267ba1e619Saliguori  --disable-kvm) kvm="no"
6277ba1e619Saliguori  ;;
628b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
629b31a0277SJuan Quintela  ;;
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  ;;
7237f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
7247f1559c6Sbalrog  ;;
7257d13299dSbellard  esac
7267d13299dSbellarddone
7277d13299dSbellard
7283142255cSblueswir1#
7293142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
730a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
7313142255cSblueswir1#
732379f6698SPaul Brookhost_guest_base="no"
73340293e58Sbellardcase "$cpu" in
734ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
735ed968ff1SJuan Quintela           v7|v8)
736a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
737ed968ff1SJuan Quintela           ;;
738ed968ff1SJuan Quintela           v8plus|v8plusa)
739a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
740ed968ff1SJuan Quintela           ;;
741ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
742a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
743ed968ff1SJuan Quintela           esac
7440c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
745a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
746762e8230Sblueswir1           if test "$solaris" = "no" ; then
747a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
748c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
749762e8230Sblueswir1           fi
7503142255cSblueswir1           ;;
751ed968ff1SJuan Quintela    sparc64)
752a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
7530c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
754a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
755ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
756a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
757762e8230Sblueswir1           fi
7583142255cSblueswir1           ;;
75976d83bdeSths    s390)
76028d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
76128d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
76248bb3750SRichard Henderson           host_guest_base="yes"
76328d7cc49SRichard Henderson           ;;
76428d7cc49SRichard Henderson    s390x)
76528d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
76628d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
76748bb3750SRichard Henderson           host_guest_base="yes"
76876d83bdeSths           ;;
76940293e58Sbellard    i386)
770a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
7710c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
772c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
773379f6698SPaul Brook           host_guest_base="yes"
77440293e58Sbellard           ;;
77540293e58Sbellard    x86_64)
776a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
7770c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
778379f6698SPaul Brook           host_guest_base="yes"
779379f6698SPaul Brook           ;;
780379f6698SPaul Brook    arm*)
781379f6698SPaul Brook           host_guest_base="yes"
78240293e58Sbellard           ;;
783f6548c0aSmalc    ppc*)
784f6548c0aSmalc           host_guest_base="yes"
785f6548c0aSmalc           ;;
786cc01cc8eSAurelien Jarno    mips*)
787cc01cc8eSAurelien Jarno           host_guest_base="yes"
788cc01cc8eSAurelien Jarno           ;;
789477ba620SAurelien Jarno    ia64*)
790477ba620SAurelien Jarno           host_guest_base="yes"
791477ba620SAurelien Jarno           ;;
792fd76e73aSRichard Henderson    hppa*)
793fd76e73aSRichard Henderson           host_guest_base="yes"
794fd76e73aSRichard Henderson           ;;
7953142255cSblueswir1esac
7963142255cSblueswir1
797379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
798379f6698SPaul Brook
799af5db58eSpbrookif test x"$show_help" = x"yes" ; then
800af5db58eSpbrookcat << EOF
801af5db58eSpbrook
802af5db58eSpbrookUsage: configure [options]
803af5db58eSpbrookOptions: [defaults in brackets after descriptions]
804af5db58eSpbrook
805af5db58eSpbrookEOF
806af5db58eSpbrookecho "Standard options:"
807af5db58eSpbrookecho "  --help                   print this message"
808af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
809af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
810af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
811af5db58eSpbrookecho "  --target-list=LIST       set target list [$target_list]"
812af5db58eSpbrookecho ""
813af5db58eSpbrookecho "Advanced options (experts only):"
814af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
815af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
816af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
8170bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
8180bfe8cc0SPaolo Bonziniecho "                           build time"
819a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
820e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
821af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
8226a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
823af5db58eSpbrookecho "  --static                 enable static build [$static]"
8240b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
8250b24e75fSPaolo Bonziniecho "  --datadir=PATH           install firmware in PATH"
8260b24e75fSPaolo Bonziniecho "  --docdir=PATH            install documentation in PATH"
8270b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
8280b24e75fSPaolo Bonziniecho "  --sysconfdir=PATH        install config in PATH/qemu"
829f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
830f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
83109695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
832890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
833890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
8341625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
83585aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
836fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
837c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
838af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
839c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
840c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
8414c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
8424c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
843eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
844eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
8458ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
846e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
847fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
8482e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
8494ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
8508d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
8511be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
8522f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
853ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
8542f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
8552f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
85696763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
857efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
858bd023f95SCorentin Charyecho "  --disable-vnc-thread     disable threaded VNC server"
859bd023f95SCorentin Charyecho "  --enable-vnc-thread      enable threaded VNC server"
860af896aaaSpbrookecho "  --disable-curses         disable curses output"
861c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
862769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
863788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
8642df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
8652df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
8665495ed11SLuiz Capitulinoecho "  --disable-check-utests   disable check unit-tests"
8675495ed11SLuiz Capitulinoecho "  --enable-check-utests    enable check unit-tests"
868fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
869a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
8707ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
871b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
872bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
873e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
874af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
875af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
8760953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
8770953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
878831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
879831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
880831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
881831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
88284778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
88384778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
884379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
885379f6698SPaul Brookecho "                           emulation targets"
886379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
88734005a00SKirill A. Shutemovecho "  --enable-user-pie        build usermode emulation targets as PIE"
88834005a00SKirill A. Shutemovecho "  --disable-user-pie       do not build usermode emulation targets as PIE"
889af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
890af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
8912f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
892c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
8933142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
894ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
895ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
896e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
897dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
8985c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
8995c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
900758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
901758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
902e5d355d1Saliguoriecho "  --enable-io-thread       enable IO thread"
90377755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
904eac30262Saliguoriecho "  --kerneldir=PATH         look for kernel includes in PATH"
905d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
906d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
907d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
908d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
9097e24e92aSStefan Hajnocziecho "  --trace-backend=B        Trace backend nop simple ust"
9109410b56cSPrerna Saxenaecho "  --trace-file=NAME        Full PATH,NAME of file to store traces"
9119410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
912af5db58eSpbrookecho ""
9135bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
914af5db58eSpbrookexit 1
915af5db58eSpbrookfi
916af5db58eSpbrook
917ec530c81Sbellard#
918ec530c81Sbellard# Solaris specific configure tool chain decisions
919ec530c81Sbellard#
920ec530c81Sbellardif test "$solaris" = "yes" ; then
9216792aa11SLoïc Minier  if has $install; then
9226792aa11SLoïc Minier    :
9236792aa11SLoïc Minier  else
924ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
925ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
926ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
927ec530c81Sbellard    exit 1
928ec530c81Sbellard  fi
9296792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
930ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
931ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
932ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
933ec530c81Sbellard    exit 1
934ec530c81Sbellard  fi
9356792aa11SLoïc Minier  if has ar; then
9366792aa11SLoïc Minier    :
9376792aa11SLoïc Minier  else
938ec530c81Sbellard    echo "Error: No path includes ar"
939ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
940ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
941ec530c81Sbellard    fi
942ec530c81Sbellard    exit 1
943ec530c81Sbellard  fi
944ec530c81Sbellardfi
945ec530c81Sbellard
946ec530c81Sbellard
9475327cf48Sbellardif test -z "$target_list" ; then
9485327cf48Sbellard# these targets are portable
9490a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
9502408a527Saurel32        target_list="\
9512408a527Saurel32i386-softmmu \
9522408a527Saurel32x86_64-softmmu \
9532408a527Saurel32arm-softmmu \
9542408a527Saurel32cris-softmmu \
9552408a527Saurel32m68k-softmmu \
95672b675caSEdgar E. Iglesiasmicroblaze-softmmu \
9572408a527Saurel32mips-softmmu \
9582408a527Saurel32mipsel-softmmu \
9592408a527Saurel32mips64-softmmu \
9602408a527Saurel32mips64el-softmmu \
9612408a527Saurel32ppc-softmmu \
9622408a527Saurel32ppcemb-softmmu \
9632408a527Saurel32ppc64-softmmu \
9642408a527Saurel32sh4-softmmu \
9652408a527Saurel32sh4eb-softmmu \
9662408a527Saurel32sparc-softmmu \
9671b64fcaeSIgor V. Kovalenkosparc64-softmmu \
9682408a527Saurel32"
9690a8e90f4Spbrook    fi
9705327cf48Sbellard# the following are Linux specific
971831b7825Sths    if [ "$linux_user" = "yes" ] ; then
9722408a527Saurel32        target_list="${target_list}\
9732408a527Saurel32i386-linux-user \
9742408a527Saurel32x86_64-linux-user \
9752408a527Saurel32alpha-linux-user \
9762408a527Saurel32arm-linux-user \
9772408a527Saurel32armeb-linux-user \
9782408a527Saurel32cris-linux-user \
9792408a527Saurel32m68k-linux-user \
98072b675caSEdgar E. Iglesiasmicroblaze-linux-user \
9812408a527Saurel32mips-linux-user \
9822408a527Saurel32mipsel-linux-user \
9832408a527Saurel32ppc-linux-user \
9842408a527Saurel32ppc64-linux-user \
9852408a527Saurel32ppc64abi32-linux-user \
9862408a527Saurel32sh4-linux-user \
9872408a527Saurel32sh4eb-linux-user \
9882408a527Saurel32sparc-linux-user \
9892408a527Saurel32sparc64-linux-user \
9902408a527Saurel32sparc32plus-linux-user \
9912408a527Saurel32"
992831b7825Sths    fi
993831b7825Sths# the following are Darwin specific
994831b7825Sths    if [ "$darwin_user" = "yes" ] ; then
9952408a527Saurel32        target_list="$target_list i386-darwin-user ppc-darwin-user "
9965327cf48Sbellard    fi
99784778508Sblueswir1# the following are BSD specific
99884778508Sblueswir1    if [ "$bsd_user" = "yes" ] ; then
99984778508Sblueswir1        target_list="${target_list}\
100031fc12dfSblueswir1i386-bsd-user \
100131fc12dfSblueswir1x86_64-bsd-user \
100231fc12dfSblueswir1sparc-bsd-user \
100384778508Sblueswir1sparc64-bsd-user \
100484778508Sblueswir1"
100584778508Sblueswir1    fi
10066e20a45fSbellardelse
1007b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
10085327cf48Sbellardfi
10090a8e90f4Spbrookif test -z "$target_list" ; then
10100a8e90f4Spbrook    echo "No targets enabled"
10110a8e90f4Spbrook    exit 1
10120a8e90f4Spbrookfi
1013f55fe278SPaolo Bonzini# see if system emulation was really requested
1014f55fe278SPaolo Bonzinicase " $target_list " in
1015f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1016f55fe278SPaolo Bonzini  ;;
1017f55fe278SPaolo Bonzini  *) softmmu=no
1018f55fe278SPaolo Bonzini  ;;
1019f55fe278SPaolo Bonziniesac
10205327cf48Sbellard
1021249247c9SJuan Quintelafeature_not_found() {
1022249247c9SJuan Quintela  feature=$1
1023249247c9SJuan Quintela
1024249247c9SJuan Quintela  echo "ERROR"
1025249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
10269332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1027249247c9SJuan Quintela  echo "ERROR"
1028249247c9SJuan Quintela  exit 1;
1029249247c9SJuan Quintela}
1030249247c9SJuan Quintela
10317d13299dSbellardif test -z "$cross_prefix" ; then
10327d13299dSbellard
10337d13299dSbellard# ---
10347d13299dSbellard# big/little endian test
10357d13299dSbellardcat > $TMPC << EOF
10367d13299dSbellard#include <inttypes.h>
10377d13299dSbellardint main(int argc, char ** argv){
10387d13299dSbellard        volatile uint32_t i=0x01234567;
10397d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
10407d13299dSbellard}
10417d13299dSbellardEOF
10427d13299dSbellard
104352166aa0SJuan Quintelaif compile_prog "" "" ; then
10447d13299dSbellard$TMPE && bigendian="yes"
10457d13299dSbellardelse
10467d13299dSbellardecho big/little test failed
10477d13299dSbellardfi
10487d13299dSbellard
10497d13299dSbellardelse
10507d13299dSbellard
10517d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1052ea8f20f8SJuan Quintelacase "$cpu" in
105324e804ecSAlexander Graf  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1054ea8f20f8SJuan Quintela    bigendian=yes
1055ea8f20f8SJuan Quintela  ;;
1056ea8f20f8SJuan Quintelaesac
10577d13299dSbellard
10587d13299dSbellardfi
10597d13299dSbellard
1060b6853697Sbellard# host long bits test
1061b6853697Sbellardhostlongbits="32"
1062ea8f20f8SJuan Quintelacase "$cpu" in
106324e804ecSAlexander Graf  x86_64|alpha|ia64|sparc64|ppc64|s390x)
1064ea8f20f8SJuan Quintela    hostlongbits=64
1065ea8f20f8SJuan Quintela  ;;
1066ea8f20f8SJuan Quintelaesac
1067b6853697Sbellard
1068b0a47e79SJuan Quintela
1069b0a47e79SJuan Quintela##########################################
1070b0a47e79SJuan Quintela# NPTL probe
1071b0a47e79SJuan Quintela
1072b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1073bd0c5661Spbrook  cat > $TMPC <<EOF
1074bd0c5661Spbrook#include <sched.h>
107530813ceaSpbrook#include <linux/futex.h>
1076bd0c5661Spbrookvoid foo()
1077bd0c5661Spbrook{
1078bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1079bd0c5661Spbrook#error bork
1080bd0c5661Spbrook#endif
1081bd0c5661Spbrook}
1082bd0c5661SpbrookEOF
1083bd0c5661Spbrook
108452166aa0SJuan Quintela  if compile_object ; then
1085b0a47e79SJuan Quintela    nptl=yes
1086bd0c5661Spbrook  else
1087b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1088b0a47e79SJuan Quintela      feature_not_found "nptl"
1089b0a47e79SJuan Quintela    fi
1090b0a47e79SJuan Quintela    nptl=no
1091b0a47e79SJuan Quintela  fi
1092bd0c5661Spbrookfi
1093bd0c5661Spbrook
109411d9f695Sbellard##########################################
1095ac62922eSbalrog# zlib check
1096ac62922eSbalrog
1097ac62922eSbalrogcat > $TMPC << EOF
1098ac62922eSbalrog#include <zlib.h>
1099ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1100ac62922eSbalrogEOF
110152166aa0SJuan Quintelaif compile_prog "" "-lz" ; then
1102ac62922eSbalrog    :
1103ac62922eSbalrogelse
1104ac62922eSbalrog    echo
1105ac62922eSbalrog    echo "Error: zlib check failed"
1106ac62922eSbalrog    echo "Make sure to have the zlib libs and headers installed."
1107ac62922eSbalrog    echo
1108ac62922eSbalrog    exit 1
1109ac62922eSbalrogfi
1110ac62922eSbalrog
1111ac62922eSbalrog##########################################
1112e37630caSaliguori# xen probe
1113e37630caSaliguori
1114fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1115b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1116e37630caSaliguori  cat > $TMPC <<EOF
1117e37630caSaliguori#include <xenctrl.h>
1118e37630caSaliguori#include <xs.h>
1119df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1120e37630caSaliguoriEOF
112152166aa0SJuan Quintela  if compile_prog "" "$xen_libs" ; then
1122fc321b4bSJuan Quintela    xen=yes
11233efd632bSJuan Quintela    libs_softmmu="$xen_libs $libs_softmmu"
1124e37630caSaliguori  else
1125fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
1126fc321b4bSJuan Quintela      feature_not_found "xen"
1127fc321b4bSJuan Quintela    fi
1128fc321b4bSJuan Quintela    xen=no
1129e37630caSaliguori  fi
1130e37630caSaliguorifi
1131e37630caSaliguori
1132e37630caSaliguori##########################################
1133f91672e5SPaolo Bonzini# pkgconfig probe
1134f91672e5SPaolo Bonzini
1135f91672e5SPaolo Bonzinipkgconfig="${cross_prefix}pkg-config"
11360dba6195SLoïc Minierif ! has $pkgconfig; then
1137f91672e5SPaolo Bonzini  # likely not cross compiling, or hope for the best
1138f91672e5SPaolo Bonzini  pkgconfig=pkg-config
1139f91672e5SPaolo Bonzinifi
1140f91672e5SPaolo Bonzini
1141f91672e5SPaolo Bonzini##########################################
1142dfffc653SJuan Quintela# Sparse probe
1143dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
11440dba6195SLoïc Minier  if has cgcc; then
1145dfffc653SJuan Quintela    sparse=yes
1146dfffc653SJuan Quintela  else
1147dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1148dfffc653SJuan Quintela      feature_not_found "sparse"
1149dfffc653SJuan Quintela    fi
1150dfffc653SJuan Quintela    sparse=no
1151dfffc653SJuan Quintela  fi
1152dfffc653SJuan Quintelafi
1153dfffc653SJuan Quintela
1154dfffc653SJuan Quintela##########################################
115511d9f695Sbellard# SDL probe
115611d9f695Sbellard
1157fec0e3e8SStefan Weil# Look for sdl configuration program (pkg-config or sdl-config).
1158fec0e3e8SStefan Weil# Prefer variant with cross prefix if cross compiling,
1159fec0e3e8SStefan Weil# and favour pkg-config with sdl over sdl-config.
1160fec0e3e8SStefan Weilif test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1161fec0e3e8SStefan Weil     $pkgconfig sdl --modversion >/dev/null 2>&1; then
1162fec0e3e8SStefan Weil  sdlconfig="$pkgconfig sdl"
1163fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1164fec0e3e8SStefan Weilelif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1165fec0e3e8SStefan Weil  sdlconfig="${cross_prefix}sdl-config"
1166fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1167fec0e3e8SStefan Weilelif $pkgconfig sdl --modversion >/dev/null 2>&1; then
11689316f803SPaolo Bonzini  sdlconfig="$pkgconfig sdl"
11699316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
11700dba6195SLoïc Minierelif has sdl-config; then
11719316f803SPaolo Bonzini  sdlconfig='sdl-config'
11729316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1173a0dfd8a4SLoïc Minierelse
1174a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1175a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1176a0dfd8a4SLoïc Minier  fi
1177a0dfd8a4SLoïc Minier  sdl=no
11789316f803SPaolo Bonzinifi
117911d9f695Sbellard
11809316f803SPaolo Bonzinisdl_too_old=no
1181c4198157SJuan Quintelaif test "$sdl" != "no" ; then
118211d9f695Sbellard  cat > $TMPC << EOF
118311d9f695Sbellard#include <SDL.h>
118411d9f695Sbellard#undef main /* We don't want SDL to override our main() */
118511d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
118611d9f695SbellardEOF
11879316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
118874f42e18STeLeMan  if test "$static" = "yes" ; then
118974f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
119074f42e18STeLeMan  else
11919316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
119274f42e18STeLeMan  fi
119352166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
119411d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
119511d9f695Sbellard      sdl_too_old=yes
119611d9f695Sbellard    else
1197fd677642Sths      if test "$cocoa" = "no" ; then
119811d9f695Sbellard        sdl=yes
119911d9f695Sbellard      fi
1200fd677642Sths    fi
12017c1f25b4Sbellard
120267c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
12031ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
120467c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1205f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1206f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
120711d9f695Sbellard      fi
120852166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
12091ac88f28SJuan Quintela	:
12101ac88f28SJuan Quintela      else
12111ac88f28SJuan Quintela        sdl=no
12127c1f25b4Sbellard      fi
12137c1f25b4Sbellard    fi # static link
1214c4198157SJuan Quintela  else # sdl not found
1215c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1216c4198157SJuan Quintela      feature_not_found "sdl"
1217c4198157SJuan Quintela    fi
1218c4198157SJuan Quintela    sdl=no
12197c1f25b4Sbellard  fi # sdl compile test
1220fd677642Sthsfi
122111d9f695Sbellard
12225368a422Saliguoriif test "$sdl" = "yes" ; then
12235368a422Saliguori  cat > $TMPC <<EOF
12245368a422Saliguori#include <SDL.h>
12255368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
12265368a422Saliguori#include <X11/XKBlib.h>
12275368a422Saliguori#else
12285368a422Saliguori#error No x11 support
12295368a422Saliguori#endif
12305368a422Saliguoriint main(void) { return 0; }
12315368a422SaliguoriEOF
123252166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1233681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
12345368a422Saliguori  fi
123507d9ac44SJuan Quintela  if test "$mingw32" = "yes" ; then
123607d9ac44SJuan Quintela    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
123707d9ac44SJuan Quintela  fi
12380705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
12395368a422Saliguorifi
12405368a422Saliguori
12418f28f3fbSths##########################################
12428d5d2d4cSths# VNC TLS detection
12431be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then
1244ae6b5e5aSaliguori  cat > $TMPC <<EOF
1245ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1246ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1247ae6b5e5aSaliguoriEOF
1248f91672e5SPaolo Bonzini  vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1249f91672e5SPaolo Bonzini  vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
125052166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
12511be10ad2SJuan Quintela    vnc_tls=yes
1252a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1253ae6b5e5aSaliguori  else
12541be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
12551be10ad2SJuan Quintela      feature_not_found "vnc-tls"
12561be10ad2SJuan Quintela    fi
12571be10ad2SJuan Quintela    vnc_tls=no
12588d5d2d4cSths  fi
12598d5d2d4cSthsfi
12608d5d2d4cSths
12618d5d2d4cSths##########################################
12622f9606b3Saliguori# VNC SASL detection
12633aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then
12642f9606b3Saliguori  cat > $TMPC <<EOF
12652f9606b3Saliguori#include <sasl/sasl.h>
12662f9606b3Saliguori#include <stdio.h>
12672f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
12682f9606b3SaliguoriEOF
12692f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
12702f9606b3Saliguori  vnc_sasl_cflags=""
12712f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
127252166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1273ea784e3bSJuan Quintela    vnc_sasl=yes
1274fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
12752f9606b3Saliguori  else
1276ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1277ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1278ea784e3bSJuan Quintela    fi
1279ea784e3bSJuan Quintela    vnc_sasl=no
12802f9606b3Saliguori  fi
12812f9606b3Saliguorifi
12822f9606b3Saliguori
12832f9606b3Saliguori##########################################
12842f6f5c7aSCorentin Chary# VNC JPEG detection
128596763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then
12862f6f5c7aSCorentin Charycat > $TMPC <<EOF
12872f6f5c7aSCorentin Chary#include <stdio.h>
12882f6f5c7aSCorentin Chary#include <jpeglib.h>
12892f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
12902f6f5c7aSCorentin CharyEOF
12912f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
12922f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
12932f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
12942f6f5c7aSCorentin Chary    vnc_jpeg=yes
12952f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
12962f6f5c7aSCorentin Chary  else
12972f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
12982f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
12992f6f5c7aSCorentin Chary    fi
13002f6f5c7aSCorentin Chary    vnc_jpeg=no
13012f6f5c7aSCorentin Chary  fi
13022f6f5c7aSCorentin Charyfi
13032f6f5c7aSCorentin Chary
13042f6f5c7aSCorentin Chary##########################################
1305efe556adSCorentin Chary# VNC PNG detection
130696763cf9SCorentin Charyif test "$vnc_png" != "no" ; then
1307efe556adSCorentin Charycat > $TMPC <<EOF
1308efe556adSCorentin Chary//#include <stdio.h>
1309efe556adSCorentin Chary#include <png.h>
1310efe556adSCorentin Charyint main(void) {
1311efe556adSCorentin Chary    png_structp png_ptr;
1312efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1313efe556adSCorentin Chary    return 0;
1314efe556adSCorentin Chary}
1315efe556adSCorentin CharyEOF
1316efe556adSCorentin Chary    vnc_png_cflags=""
1317efe556adSCorentin Chary    vnc_png_libs="-lpng"
1318efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1319efe556adSCorentin Chary    vnc_png=yes
1320efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
1321efe556adSCorentin Chary  else
1322efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1323efe556adSCorentin Chary      feature_not_found "vnc-png"
1324efe556adSCorentin Chary    fi
1325efe556adSCorentin Chary    vnc_png=no
1326efe556adSCorentin Chary  fi
1327efe556adSCorentin Charyfi
1328efe556adSCorentin Chary
1329efe556adSCorentin Chary##########################################
133076655d6dSaliguori# fnmatch() probe, used for ACL routines
133176655d6dSaliguorifnmatch="no"
133276655d6dSaliguoricat > $TMPC << EOF
133376655d6dSaliguori#include <fnmatch.h>
133476655d6dSaliguoriint main(void)
133576655d6dSaliguori{
133676655d6dSaliguori    fnmatch("foo", "foo", 0);
133776655d6dSaliguori    return 0;
133876655d6dSaliguori}
133976655d6dSaliguoriEOF
134052166aa0SJuan Quintelaif compile_prog "" "" ; then
134176655d6dSaliguori   fnmatch="yes"
134276655d6dSaliguorifi
134376655d6dSaliguori
134476655d6dSaliguori##########################################
1345ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1346ee682d27SStefan Weilif test "$uuid" != "no" ; then
1347ee682d27SStefan Weil  uuid_libs="-luuid"
1348ee682d27SStefan Weil  cat > $TMPC << EOF
1349ee682d27SStefan Weil#include <uuid/uuid.h>
1350ee682d27SStefan Weilint main(void)
1351ee682d27SStefan Weil{
1352ee682d27SStefan Weil    uuid_t my_uuid;
1353ee682d27SStefan Weil    uuid_generate(my_uuid);
1354ee682d27SStefan Weil    return 0;
1355ee682d27SStefan Weil}
1356ee682d27SStefan WeilEOF
1357ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1358ee682d27SStefan Weil    uuid="yes"
1359ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1360ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1361ee682d27SStefan Weil  else
1362ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1363ee682d27SStefan Weil      feature_not_found "uuid"
1364ee682d27SStefan Weil    fi
1365ee682d27SStefan Weil    uuid=no
1366ee682d27SStefan Weil  fi
1367ee682d27SStefan Weilfi
1368ee682d27SStefan Weil
1369ee682d27SStefan Weil##########################################
13708a16d273Sths# vde libraries probe
1371dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
13724baae0acSJuan Quintela  vde_libs="-lvdeplug"
13738a16d273Sths  cat > $TMPC << EOF
13748a16d273Sths#include <libvdeplug.h>
13754a7f0e06Spbrookint main(void)
13764a7f0e06Spbrook{
13774a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
13784a7f0e06Spbrook    vde_open("", "", &a);
13794a7f0e06Spbrook    return 0;
13804a7f0e06Spbrook}
13818a16d273SthsEOF
138252166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
13834baae0acSJuan Quintela    vde=yes
13848e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
13858e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1386dfb278bdSJuan Quintela  else
1387dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1388dfb278bdSJuan Quintela      feature_not_found "vde"
1389dfb278bdSJuan Quintela    fi
1390dfb278bdSJuan Quintela    vde=no
13918a16d273Sths  fi
13928a16d273Sthsfi
13938a16d273Sths
13948a16d273Sths##########################################
1395c2de5c91Smalc# Sound support libraries probe
13968f28f3fbSths
1397c2de5c91Smalcaudio_drv_probe()
1398c2de5c91Smalc{
1399c2de5c91Smalc    drv=$1
1400c2de5c91Smalc    hdr=$2
1401c2de5c91Smalc    lib=$3
1402c2de5c91Smalc    exp=$4
1403c2de5c91Smalc    cfl=$5
14048f28f3fbSths        cat > $TMPC << EOF
1405c2de5c91Smalc#include <$hdr>
1406c2de5c91Smalcint main(void) { $exp }
14078f28f3fbSthsEOF
140852166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
14098f28f3fbSths        :
14108f28f3fbSths    else
14118f28f3fbSths        echo
1412c2de5c91Smalc        echo "Error: $drv check failed"
1413c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
14148f28f3fbSths        echo
14158f28f3fbSths        exit 1
14168f28f3fbSths    fi
1417c2de5c91Smalc}
1418c2de5c91Smalc
14192fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1420c2de5c91Smalcfor drv in $audio_drv_list; do
1421c2de5c91Smalc    case $drv in
1422c2de5c91Smalc    alsa)
1423c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1424c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1425a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1426c2de5c91Smalc    ;;
1427c2de5c91Smalc
1428c2de5c91Smalc    fmod)
1429c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1430c2de5c91Smalc        echo
1431c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1432c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1433c2de5c91Smalc        echo
1434c2de5c91Smalc        exit 1
14358f28f3fbSths    fi
1436c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1437a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1438c2de5c91Smalc    ;;
1439c2de5c91Smalc
1440c2de5c91Smalc    esd)
1441c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1442a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
144367f86e8eSJuan Quintela    audio_pt_int="yes"
1444c2de5c91Smalc    ;;
1445b8e59f18Smalc
1446b8e59f18Smalc    pa)
1447493abda6SAurelien Jarno    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1448b8e59f18Smalc        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1449493abda6SAurelien Jarno    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
145067f86e8eSJuan Quintela    audio_pt_int="yes"
1451b8e59f18Smalc    ;;
1452b8e59f18Smalc
1453997e690aSJuan Quintela    coreaudio)
1454997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1455997e690aSJuan Quintela    ;;
1456997e690aSJuan Quintela
1457a4bf6780SJuan Quintela    dsound)
1458a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1459d5631638Smalc      audio_win_int="yes"
1460a4bf6780SJuan Quintela    ;;
1461a4bf6780SJuan Quintela
1462a4bf6780SJuan Quintela    oss)
1463a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1464a4bf6780SJuan Quintela    ;;
1465a4bf6780SJuan Quintela
1466a4bf6780SJuan Quintela    sdl|wav)
14672f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
14682f6a1ab0Sblueswir1    ;;
14692f6a1ab0Sblueswir1
1470d5631638Smalc    winwave)
1471d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1472d5631638Smalc      audio_win_int="yes"
1473d5631638Smalc    ;;
1474d5631638Smalc
1475e4c63a6aSmalc    *)
14761c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1477e4c63a6aSmalc        echo
1478e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1479e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1480e4c63a6aSmalc        echo
1481e4c63a6aSmalc        exit 1
1482e4c63a6aSmalc    }
1483e4c63a6aSmalc    ;;
1484c2de5c91Smalc    esac
1485c2de5c91Smalcdone
14868f28f3fbSths
14874d3b6f6eSbalrog##########################################
14882e4d9fb1Saurel32# BrlAPI probe
14892e4d9fb1Saurel32
14904ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1491eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
14922e4d9fb1Saurel32  cat > $TMPC << EOF
14932e4d9fb1Saurel32#include <brlapi.h>
14942e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
14952e4d9fb1Saurel32EOF
149652166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
14972e4d9fb1Saurel32    brlapi=yes
1498264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
14994ffcedb6SJuan Quintela  else
15004ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
15014ffcedb6SJuan Quintela      feature_not_found "brlapi"
15024ffcedb6SJuan Quintela    fi
15034ffcedb6SJuan Quintela    brlapi=no
1504eb82284fSJuan Quintela  fi
1505eb82284fSJuan Quintelafi
15062e4d9fb1Saurel32
15072e4d9fb1Saurel32##########################################
15084d3b6f6eSbalrog# curses probe
15094f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses"
15104d3b6f6eSbalrog
1511c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1512c584a6d0SJuan Quintela  curses_found=no
15134d3b6f6eSbalrog  cat > $TMPC << EOF
15144d3b6f6eSbalrog#include <curses.h>
15155a8ff3aaSblueswir1#ifdef __OpenBSD__
15165a8ff3aaSblueswir1#define resize_term resizeterm
15175a8ff3aaSblueswir1#endif
15185a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); }
15194d3b6f6eSbalrogEOF
15204f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
15214f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1522c584a6d0SJuan Quintela      curses_found=yes
15234f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
15244f78ef9aSJuan Quintela      break
15254d3b6f6eSbalrog    fi
15264f78ef9aSJuan Quintela  done
1527c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1528c584a6d0SJuan Quintela    curses=yes
1529c584a6d0SJuan Quintela  else
1530c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1531c584a6d0SJuan Quintela      feature_not_found "curses"
1532c584a6d0SJuan Quintela    fi
1533c584a6d0SJuan Quintela    curses=no
1534c584a6d0SJuan Quintela  fi
15354f78ef9aSJuan Quintelafi
15364d3b6f6eSbalrog
1537414f0dabSblueswir1##########################################
1538769ce76dSAlexander Graf# curl probe
1539769ce76dSAlexander Graf
15404e2b0658SPaolo Bonziniif $pkgconfig libcurl --modversion >/dev/null 2>&1; then
15414e2b0658SPaolo Bonzini  curlconfig="$pkgconfig libcurl"
15424e2b0658SPaolo Bonzinielse
15434e2b0658SPaolo Bonzini  curlconfig=curl-config
15444e2b0658SPaolo Bonzinifi
15454e2b0658SPaolo Bonzini
1546788c8196SJuan Quintelaif test "$curl" != "no" ; then
1547769ce76dSAlexander Graf  cat > $TMPC << EOF
1548769ce76dSAlexander Graf#include <curl/curl.h>
1549769ce76dSAlexander Grafint main(void) { return curl_easy_init(); }
1550769ce76dSAlexander GrafEOF
15514e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
15524e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
1553b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
1554769ce76dSAlexander Graf    curl=yes
1555f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
1556f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
1557788c8196SJuan Quintela  else
1558788c8196SJuan Quintela    if test "$curl" = "yes" ; then
1559788c8196SJuan Quintela      feature_not_found "curl"
1560788c8196SJuan Quintela    fi
1561788c8196SJuan Quintela    curl=no
1562769ce76dSAlexander Graf  fi
1563769ce76dSAlexander Graffi # test "$curl"
1564769ce76dSAlexander Graf
1565769ce76dSAlexander Graf##########################################
15665495ed11SLuiz Capitulino# check framework probe
15675495ed11SLuiz Capitulino
15685495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then
15695495ed11SLuiz Capitulino  cat > $TMPC << EOF
15705495ed11SLuiz Capitulino#include <check.h>
15715495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; }
15725495ed11SLuiz CapitulinoEOF
1573f91672e5SPaolo Bonzini  check_libs=`$pkgconfig --libs check`
15745495ed11SLuiz Capitulino  if compile_prog "" $check_libs ; then
15755495ed11SLuiz Capitulino    check_utests=yes
15765495ed11SLuiz Capitulino    libs_tools="$check_libs $libs_tools"
15775495ed11SLuiz Capitulino  else
15785495ed11SLuiz Capitulino    if test "$check_utests" = "yes" ; then
15795495ed11SLuiz Capitulino      feature_not_found "check"
15805495ed11SLuiz Capitulino    fi
15815495ed11SLuiz Capitulino    check_utests=no
15825495ed11SLuiz Capitulino  fi
15835495ed11SLuiz Capitulinofi # test "$check_utests"
15845495ed11SLuiz Capitulino
15855495ed11SLuiz Capitulino##########################################
1586fb599c9aSbalrog# bluez support probe
1587a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
1588e820e3f4Sbalrog  cat > $TMPC << EOF
1589e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
1590e820e3f4Sbalrogint main(void) { return bt_error(0); }
1591e820e3f4SbalrogEOF
1592f91672e5SPaolo Bonzini  bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1593f91672e5SPaolo Bonzini  bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
159452166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1595a20a6f46SJuan Quintela    bluez=yes
1596e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
1597e820e3f4Sbalrog  else
1598a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
1599a20a6f46SJuan Quintela      feature_not_found "bluez"
1600a20a6f46SJuan Quintela    fi
1601e820e3f4Sbalrog    bluez="no"
1602e820e3f4Sbalrog  fi
1603fb599c9aSbalrogfi
1604fb599c9aSbalrog
1605fb599c9aSbalrog##########################################
16067ba1e619Saliguori# kvm probe
1607b31a0277SJuan Quintelaif test "$kvm" != "no" ; then
16087ba1e619Saliguori    cat > $TMPC <<EOF
16097ba1e619Saliguori#include <linux/kvm.h>
16109fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
16117ba1e619Saliguori#error Invalid KVM version
16127ba1e619Saliguori#endif
16139fd8d8d7Saliguori#if !defined(KVM_CAP_USER_MEMORY)
16149fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_USER_MEMORY
16159fd8d8d7Saliguori#endif
16169fd8d8d7Saliguori#if !defined(KVM_CAP_SET_TSS_ADDR)
16179fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
16189fd8d8d7Saliguori#endif
16199fd8d8d7Saliguori#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
16209fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
16219fd8d8d7Saliguori#endif
16227ba1e619Saliguoriint main(void) { return 0; }
16237ba1e619SaliguoriEOF
1624eac30262Saliguori  if test "$kerneldir" != "" ; then
1625eac30262Saliguori      kvm_cflags=-I"$kerneldir"/include
16268444eb6eSaliguori      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
16278444eb6eSaliguori         -a -d "$kerneldir/arch/x86/include" ; then
16288444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1629406b430dSaliguori	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1630406b430dSaliguori	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
16310e60a699SAlexander Graf	elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
16320e60a699SAlexander Graf	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
16338444eb6eSaliguori        elif test -d "$kerneldir/arch/$cpu/include" ; then
16348444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
16358444eb6eSaliguori      fi
1636eac30262Saliguori  else
1637f038e8f7SStefan Weil    kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
1638eac30262Saliguori  fi
163952166aa0SJuan Quintela  if compile_prog "$kvm_cflags" "" ; then
1640b31a0277SJuan Quintela    kvm=yes
1641dae5079aSJan Kiszka    cat > $TMPC <<EOF
1642dae5079aSJan Kiszka#include <linux/kvm_para.h>
1643dae5079aSJan Kiszkaint main(void) { return 0; }
1644dae5079aSJan KiszkaEOF
1645dae5079aSJan Kiszka    if compile_prog "$kvm_cflags" "" ; then
1646dae5079aSJan Kiszka      kvm_para=yes
1647dae5079aSJan Kiszka    fi
16487ba1e619Saliguori  else
1649b31a0277SJuan Quintela    if test "$kvm" = "yes" ; then
16500dba6195SLoïc Minier      if has awk && has grep; then
1651a558ee17SJuan Quintela        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
16529fd8d8d7Saliguori	| grep "error: " \
16539fd8d8d7Saliguori	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
16549fd8d8d7Saliguori        if test "$kvmerr" != "" ; then
1655b31a0277SJuan Quintela          echo -e "${kvmerr}\n\
1656168ccc11SJan Kiszka      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1657168ccc11SJan Kiszka  recent kvm-kmod from http://sourceforge.net/projects/kvm."
16589fd8d8d7Saliguori        fi
16599fd8d8d7Saliguori      fi
1660b31a0277SJuan Quintela      feature_not_found "kvm"
1661b31a0277SJuan Quintela    fi
1662b31a0277SJuan Quintela    kvm=no
16637ba1e619Saliguori  fi
16647ba1e619Saliguorifi
16657ba1e619Saliguori
16667ba1e619Saliguori##########################################
1667d5970055SMichael S. Tsirkin# test for vhost net
1668d5970055SMichael S. Tsirkin
1669d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then
1670d5970055SMichael S. Tsirkin    if test "$kvm" != "no"; then
1671d5970055SMichael S. Tsirkin            cat > $TMPC <<EOF
1672d5970055SMichael S. Tsirkin    #include <linux/vhost.h>
1673d5970055SMichael S. Tsirkin    int main(void) { return 0; }
1674d5970055SMichael S. TsirkinEOF
1675d5970055SMichael S. Tsirkin            if compile_prog "$kvm_cflags" "" ; then
1676d5970055SMichael S. Tsirkin                vhost_net=yes
1677d5970055SMichael S. Tsirkin            else
1678d5970055SMichael S. Tsirkin                if test "$vhost_net" = "yes" ; then
1679d5970055SMichael S. Tsirkin                    feature_not_found "vhost-net"
1680d5970055SMichael S. Tsirkin                fi
1681d5970055SMichael S. Tsirkin                vhost_net=no
1682d5970055SMichael S. Tsirkin            fi
1683d5970055SMichael S. Tsirkin    else
1684d5970055SMichael S. Tsirkin            if test "$vhost_net" = "yes" ; then
16854021d247SAurelien Jarno                echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1686d5970055SMichael S. Tsirkin                feature_not_found "vhost-net"
1687d5970055SMichael S. Tsirkin            fi
1688d5970055SMichael S. Tsirkin            vhost_net=no
1689d5970055SMichael S. Tsirkin    fi
1690d5970055SMichael S. Tsirkinfi
1691d5970055SMichael S. Tsirkin
1692d5970055SMichael S. Tsirkin##########################################
1693e5d355d1Saliguori# pthread probe
1694de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2"
16953c529d93Saliguori
1696e5d355d1Saliguoripthread=no
1697414f0dabSblueswir1cat > $TMPC << EOF
16983c529d93Saliguori#include <pthread.h>
1699de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; }
1700414f0dabSblueswir1EOF
1701de65fe0fSSebastian Herbsztfor pthread_lib in $PTHREADLIBS_LIST; do
170252166aa0SJuan Quintela  if compile_prog "" "$pthread_lib" ; then
1703e5d355d1Saliguori    pthread=yes
17045572b539SJuan Quintela    LIBS="$pthread_lib $LIBS"
1705de65fe0fSSebastian Herbszt    break
1706414f0dabSblueswir1  fi
1707de65fe0fSSebastian Herbsztdone
1708414f0dabSblueswir1
17094617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
17104dd75c70SChristoph Hellwig  echo
17114dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
17124dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
17134dd75c70SChristoph Hellwig  echo
17144dd75c70SChristoph Hellwig  exit 1
1715e5d355d1Saliguorifi
1716e5d355d1Saliguori
1717bf9298b9Saliguori##########################################
17185c6c3a6cSChristoph Hellwig# linux-aio probe
17195c6c3a6cSChristoph Hellwig
17205c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
17215c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
17225c6c3a6cSChristoph Hellwig#include <libaio.h>
17235c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
17245c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
17255c6c3a6cSChristoph HellwigEOF
17265c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
17275c6c3a6cSChristoph Hellwig    linux_aio=yes
1728048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
1729048d179fSPaul Brook    libs_tools="$libs_tools -laio"
17305c6c3a6cSChristoph Hellwig  else
17315c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
17325c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
17335c6c3a6cSChristoph Hellwig    fi
17343cfcae3cSLuiz Capitulino    linux_aio=no
17355c6c3a6cSChristoph Hellwig  fi
17365c6c3a6cSChristoph Hellwigfi
17375c6c3a6cSChristoph Hellwig
17385c6c3a6cSChristoph Hellwig##########################################
1739758e8e38SVenkateswararao Jujjuri (JV)# attr probe
1740758e8e38SVenkateswararao Jujjuri (JV)
1741758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
1742758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
1743758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
1744758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
1745758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h>
1746758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1747758e8e38SVenkateswararao Jujjuri (JV)EOF
1748758e8e38SVenkateswararao Jujjuri (JV)  if compile_prog "" "-lattr" ; then
1749758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
1750758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
1751758e8e38SVenkateswararao Jujjuri (JV)  else
1752758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
1753758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
1754758e8e38SVenkateswararao Jujjuri (JV)    fi
1755758e8e38SVenkateswararao Jujjuri (JV)    attr=no
1756758e8e38SVenkateswararao Jujjuri (JV)  fi
1757758e8e38SVenkateswararao Jujjuri (JV)fi
1758758e8e38SVenkateswararao Jujjuri (JV)
1759758e8e38SVenkateswararao Jujjuri (JV)##########################################
1760bf9298b9Saliguori# iovec probe
1761bf9298b9Saliguoricat > $TMPC <<EOF
1762db34f0b3Sblueswir1#include <sys/types.h>
1763bf9298b9Saliguori#include <sys/uio.h>
1764db34f0b3Sblueswir1#include <unistd.h>
1765bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; }
1766bf9298b9SaliguoriEOF
1767bf9298b9Saliguoriiovec=no
176852166aa0SJuan Quintelaif compile_prog "" "" ; then
1769bf9298b9Saliguori  iovec=yes
1770bf9298b9Saliguorifi
1771bf9298b9Saliguori
1772f652e6afSaurel32##########################################
1773ceb42de8Saliguori# preadv probe
1774ceb42de8Saliguoricat > $TMPC <<EOF
1775ceb42de8Saliguori#include <sys/types.h>
1776ceb42de8Saliguori#include <sys/uio.h>
1777ceb42de8Saliguori#include <unistd.h>
1778ceb42de8Saliguoriint main(void) { preadv; }
1779ceb42de8SaliguoriEOF
1780ceb42de8Saliguoripreadv=no
178152166aa0SJuan Quintelaif compile_prog "" "" ; then
1782ceb42de8Saliguori  preadv=yes
1783ceb42de8Saliguorifi
1784ceb42de8Saliguori
1785ceb42de8Saliguori##########################################
1786f652e6afSaurel32# fdt probe
17872df87df7SJuan Quintelaif test "$fdt" != "no" ; then
1788b41af4baSJuan Quintela  fdt_libs="-lfdt"
1789f652e6afSaurel32  cat > $TMPC << EOF
1790f652e6afSaurel32int main(void) { return 0; }
1791f652e6afSaurel32EOF
179252166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
1793f652e6afSaurel32    fdt=yes
1794e4782985SJuan Quintela    libs_softmmu="$fdt_libs $libs_softmmu"
17952df87df7SJuan Quintela  else
17962df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
17972df87df7SJuan Quintela      feature_not_found "fdt"
17982df87df7SJuan Quintela    fi
17992df87df7SJuan Quintela    fdt=no
1800f652e6afSaurel32  fi
1801f652e6afSaurel32fi
1802f652e6afSaurel32
18033b3f24adSaurel32#
18043b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
18053b3f24adSaurel32# emulator.  This is done because older glibc versions don't
18063b3f24adSaurel32# have syscall stubs for these implemented.
18073b3f24adSaurel32#
18083b3f24adSaurel32atfile=no
18093b3f24adSaurel32cat > $TMPC << EOF
18103b3f24adSaurel32#define _ATFILE_SOURCE
18113b3f24adSaurel32#include <sys/types.h>
18123b3f24adSaurel32#include <fcntl.h>
18133b3f24adSaurel32#include <unistd.h>
18143b3f24adSaurel32
18153b3f24adSaurel32int
18163b3f24adSaurel32main(void)
18173b3f24adSaurel32{
18183b3f24adSaurel32	/* try to unlink nonexisting file */
18193b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
18203b3f24adSaurel32}
18213b3f24adSaurel32EOF
182252166aa0SJuan Quintelaif compile_prog "" "" ; then
18233b3f24adSaurel32  atfile=yes
18243b3f24adSaurel32fi
18253b3f24adSaurel32
182639386ac7Saurel32# Check for inotify functions when we are building linux-user
18273b3f24adSaurel32# emulator.  This is done because older glibc versions don't
18283b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
18293b3f24adSaurel32# don't provide them even if kernel supports them.
18303b3f24adSaurel32#
18313b3f24adSaurel32inotify=no
18323b3f24adSaurel32cat > $TMPC << EOF
18333b3f24adSaurel32#include <sys/inotify.h>
18343b3f24adSaurel32
18353b3f24adSaurel32int
18363b3f24adSaurel32main(void)
18373b3f24adSaurel32{
18383b3f24adSaurel32	/* try to start inotify */
18398690e420Saurel32	return inotify_init();
18403b3f24adSaurel32}
18413b3f24adSaurel32EOF
184252166aa0SJuan Quintelaif compile_prog "" "" ; then
18433b3f24adSaurel32  inotify=yes
18443b3f24adSaurel32fi
18453b3f24adSaurel32
1846c05c7a73SRiku Voipioinotify1=no
1847c05c7a73SRiku Voipiocat > $TMPC << EOF
1848c05c7a73SRiku Voipio#include <sys/inotify.h>
1849c05c7a73SRiku Voipio
1850c05c7a73SRiku Voipioint
1851c05c7a73SRiku Voipiomain(void)
1852c05c7a73SRiku Voipio{
1853c05c7a73SRiku Voipio    /* try to start inotify */
1854c05c7a73SRiku Voipio    return inotify_init1(0);
1855c05c7a73SRiku Voipio}
1856c05c7a73SRiku VoipioEOF
1857c05c7a73SRiku Voipioif compile_prog "" "" ; then
1858c05c7a73SRiku Voipio  inotify1=yes
1859c05c7a73SRiku Voipiofi
1860c05c7a73SRiku Voipio
1861ebc996f3SRiku Voipio# check if utimensat and futimens are supported
1862ebc996f3SRiku Voipioutimens=no
1863ebc996f3SRiku Voipiocat > $TMPC << EOF
1864ebc996f3SRiku Voipio#define _ATFILE_SOURCE
1865ebc996f3SRiku Voipio#define _GNU_SOURCE
1866ebc996f3SRiku Voipio#include <stddef.h>
1867ebc996f3SRiku Voipio#include <fcntl.h>
1868ebc996f3SRiku Voipio
1869ebc996f3SRiku Voipioint main(void)
1870ebc996f3SRiku Voipio{
1871ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
1872ebc996f3SRiku Voipio    futimens(0, NULL);
1873ebc996f3SRiku Voipio    return 0;
1874ebc996f3SRiku Voipio}
1875ebc996f3SRiku VoipioEOF
187652166aa0SJuan Quintelaif compile_prog "" "" ; then
1877ebc996f3SRiku Voipio  utimens=yes
1878ebc996f3SRiku Voipiofi
1879ebc996f3SRiku Voipio
1880099d6b0fSRiku Voipio# check if pipe2 is there
1881099d6b0fSRiku Voipiopipe2=no
1882099d6b0fSRiku Voipiocat > $TMPC << EOF
1883099d6b0fSRiku Voipio#define _GNU_SOURCE
1884099d6b0fSRiku Voipio#include <unistd.h>
1885099d6b0fSRiku Voipio#include <fcntl.h>
1886099d6b0fSRiku Voipio
1887099d6b0fSRiku Voipioint main(void)
1888099d6b0fSRiku Voipio{
1889099d6b0fSRiku Voipio    int pipefd[2];
1890099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
1891099d6b0fSRiku Voipio    return 0;
1892099d6b0fSRiku Voipio}
1893099d6b0fSRiku VoipioEOF
189452166aa0SJuan Quintelaif compile_prog "" "" ; then
1895099d6b0fSRiku Voipio  pipe2=yes
1896099d6b0fSRiku Voipiofi
1897099d6b0fSRiku Voipio
189840ff6d7eSKevin Wolf# check if accept4 is there
189940ff6d7eSKevin Wolfaccept4=no
190040ff6d7eSKevin Wolfcat > $TMPC << EOF
190140ff6d7eSKevin Wolf#define _GNU_SOURCE
190240ff6d7eSKevin Wolf#include <sys/socket.h>
190340ff6d7eSKevin Wolf#include <stddef.h>
190440ff6d7eSKevin Wolf
190540ff6d7eSKevin Wolfint main(void)
190640ff6d7eSKevin Wolf{
190740ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
190840ff6d7eSKevin Wolf    return 0;
190940ff6d7eSKevin Wolf}
191040ff6d7eSKevin WolfEOF
191140ff6d7eSKevin Wolfif compile_prog "" "" ; then
191240ff6d7eSKevin Wolf  accept4=yes
191340ff6d7eSKevin Wolffi
191440ff6d7eSKevin Wolf
19153ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
19163ce34dfbSvibisreenivasansplice=no
19173ce34dfbSvibisreenivasancat > $TMPC << EOF
19183ce34dfbSvibisreenivasan#define _GNU_SOURCE
19193ce34dfbSvibisreenivasan#include <unistd.h>
19203ce34dfbSvibisreenivasan#include <fcntl.h>
19213ce34dfbSvibisreenivasan#include <limits.h>
19223ce34dfbSvibisreenivasan
19233ce34dfbSvibisreenivasanint main(void)
19243ce34dfbSvibisreenivasan{
19253ce34dfbSvibisreenivasan    int len, fd;
19263ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
19273ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
19283ce34dfbSvibisreenivasan    return 0;
19293ce34dfbSvibisreenivasan}
19303ce34dfbSvibisreenivasanEOF
193152166aa0SJuan Quintelaif compile_prog "" "" ; then
19323ce34dfbSvibisreenivasan  splice=yes
19333ce34dfbSvibisreenivasanfi
19343ce34dfbSvibisreenivasan
1935c2882b96SRiku Voipio# check if eventfd is supported
1936c2882b96SRiku Voipioeventfd=no
1937c2882b96SRiku Voipiocat > $TMPC << EOF
1938c2882b96SRiku Voipio#include <sys/eventfd.h>
1939c2882b96SRiku Voipio
1940c2882b96SRiku Voipioint main(void)
1941c2882b96SRiku Voipio{
1942c2882b96SRiku Voipio    int efd = eventfd(0, 0);
1943c2882b96SRiku Voipio    return 0;
1944c2882b96SRiku Voipio}
1945c2882b96SRiku VoipioEOF
1946c2882b96SRiku Voipioif compile_prog "" "" ; then
1947c2882b96SRiku Voipio  eventfd=yes
1948c2882b96SRiku Voipiofi
1949c2882b96SRiku Voipio
1950d0927938SUlrich Hecht# check for fallocate
1951d0927938SUlrich Hechtfallocate=no
1952d0927938SUlrich Hechtcat > $TMPC << EOF
1953d0927938SUlrich Hecht#include <fcntl.h>
1954d0927938SUlrich Hecht
1955d0927938SUlrich Hechtint main(void)
1956d0927938SUlrich Hecht{
1957d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
1958d0927938SUlrich Hecht    return 0;
1959d0927938SUlrich Hecht}
1960d0927938SUlrich HechtEOF
1961be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then
1962d0927938SUlrich Hecht  fallocate=yes
1963d0927938SUlrich Hechtfi
1964d0927938SUlrich Hecht
1965d0927938SUlrich Hecht# check for dup3
1966d0927938SUlrich Hechtdup3=no
1967d0927938SUlrich Hechtcat > $TMPC << EOF
1968d0927938SUlrich Hecht#include <unistd.h>
1969d0927938SUlrich Hecht
1970d0927938SUlrich Hechtint main(void)
1971d0927938SUlrich Hecht{
1972d0927938SUlrich Hecht    dup3(0, 0, 0);
1973d0927938SUlrich Hecht    return 0;
1974d0927938SUlrich Hecht}
1975d0927938SUlrich HechtEOF
197678f5d726SJan Kiszkaif compile_prog "" "" ; then
1977d0927938SUlrich Hecht  dup3=yes
1978d0927938SUlrich Hechtfi
1979d0927938SUlrich Hecht
1980cc8ae6deSpbrook# Check if tools are available to build documentation.
1981a25dba17SJuan Quintelaif test "$docs" != "no" ; then
198201668d98SStefan Weil  if has makeinfo && has pod2man; then
1983a25dba17SJuan Quintela    docs=yes
198483a3ab8bSJuan Quintela  else
1985a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
1986a25dba17SJuan Quintela      feature_not_found "docs"
198783a3ab8bSJuan Quintela    fi
1988a25dba17SJuan Quintela    docs=no
198983a3ab8bSJuan Quintela  fi
1990cc8ae6deSpbrookfi
1991cc8ae6deSpbrook
1992f514f41cSStefan Weil# Search for bswap_32 function
19936ae9a1f4SJuan Quintelabyteswap_h=no
19946ae9a1f4SJuan Quintelacat > $TMPC << EOF
19956ae9a1f4SJuan Quintela#include <byteswap.h>
19966ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
19976ae9a1f4SJuan QuintelaEOF
199852166aa0SJuan Quintelaif compile_prog "" "" ; then
19996ae9a1f4SJuan Quintela  byteswap_h=yes
20006ae9a1f4SJuan Quintelafi
20016ae9a1f4SJuan Quintela
2002f514f41cSStefan Weil# Search for bswap_32 function
20036ae9a1f4SJuan Quintelabswap_h=no
20046ae9a1f4SJuan Quintelacat > $TMPC << EOF
20056ae9a1f4SJuan Quintela#include <sys/endian.h>
20066ae9a1f4SJuan Quintela#include <sys/types.h>
20076ae9a1f4SJuan Quintela#include <machine/bswap.h>
20086ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
20096ae9a1f4SJuan QuintelaEOF
201052166aa0SJuan Quintelaif compile_prog "" "" ; then
20116ae9a1f4SJuan Quintela  bswap_h=yes
20126ae9a1f4SJuan Quintelafi
20136ae9a1f4SJuan Quintela
2014da93a1fdSaliguori##########################################
2015da93a1fdSaliguori# Do we need librt
2016da93a1fdSaliguoricat > $TMPC <<EOF
2017da93a1fdSaliguori#include <signal.h>
2018da93a1fdSaliguori#include <time.h>
2019da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); }
2020da93a1fdSaliguoriEOF
2021da93a1fdSaliguori
202252166aa0SJuan Quintelaif compile_prog "" "" ; then
202307ffa4bdSJuan Quintela  :
202452166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
202507ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2026da93a1fdSaliguorifi
2027da93a1fdSaliguori
202831ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
20296362a53fSJuan Quintela        "$aix" != "yes" ; then
20306362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
20316362a53fSJuan Quintelafi
20326362a53fSJuan Quintela
2033de5071c5SBlue Swirl##########################################
2034de5071c5SBlue Swirl# check if the compiler defines offsetof
2035de5071c5SBlue Swirl
2036de5071c5SBlue Swirlneed_offsetof=yes
2037de5071c5SBlue Swirlcat > $TMPC << EOF
2038de5071c5SBlue Swirl#include <stddef.h>
2039de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); }
2040de5071c5SBlue SwirlEOF
2041de5071c5SBlue Swirlif compile_prog "" "" ; then
2042de5071c5SBlue Swirl    need_offsetof=no
2043de5071c5SBlue Swirlfi
2044de5071c5SBlue Swirl
20455f6b9e8fSBlue Swirl##########################################
2046747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result
2047747bbdf7SBlue Swirl#
2048747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning
2049747bbdf7SBlue Swirl# about attribute warn_unused_result
2050747bbdf7SBlue Swirl
2051747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no
2052747bbdf7SBlue Swirlcat > $TMPC << EOF
2053747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2054747bbdf7SBlue Swirl#error gcc 3.3 or older
2055747bbdf7SBlue Swirl#endif
2056747bbdf7SBlue Swirlint main(void) { return 0;}
2057747bbdf7SBlue SwirlEOF
2058747bbdf7SBlue Swirlif compile_prog "" ""; then
2059747bbdf7SBlue Swirl    gcc_attribute_warn_unused_result=yes
2060747bbdf7SBlue Swirlfi
2061747bbdf7SBlue Swirl
2062747bbdf7SBlue Swirl##########################################
20635f6b9e8fSBlue Swirl# check if we have fdatasync
20645f6b9e8fSBlue Swirl
20655f6b9e8fSBlue Swirlfdatasync=no
20665f6b9e8fSBlue Swirlcat > $TMPC << EOF
20675f6b9e8fSBlue Swirl#include <unistd.h>
20685f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); }
20695f6b9e8fSBlue SwirlEOF
20705f6b9e8fSBlue Swirlif compile_prog "" "" ; then
20715f6b9e8fSBlue Swirl    fdatasync=yes
20725f6b9e8fSBlue Swirlfi
20735f6b9e8fSBlue Swirl
207494a420b1SStefan Hajnoczi##########################################
207594a420b1SStefan Hajnoczi# check if trace backend exists
207694a420b1SStefan Hajnoczi
207794a420b1SStefan Hajnoczish "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
207894a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
207994a420b1SStefan Hajnoczi  echo
208094a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
208194a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
208294a420b1SStefan Hajnoczi  echo
208394a420b1SStefan Hajnoczi  exit 1
208494a420b1SStefan Hajnoczifi
208594a420b1SStefan Hajnoczi
20867e24e92aSStefan Hajnoczi##########################################
20877e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
20887e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
20897e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
20907e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
20917e24e92aSStefan Hajnoczi#include <ust/marker.h>
20927e24e92aSStefan Hajnocziint main(void) { return 0; }
20937e24e92aSStefan HajnocziEOF
20947e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
20957e24e92aSStefan Hajnoczi    LIBS="-lust $LIBS"
20967e24e92aSStefan Hajnoczi  else
20977e24e92aSStefan Hajnoczi    echo
20987e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
20997e24e92aSStefan Hajnoczi    echo
21007e24e92aSStefan Hajnoczi    exit 1
21017e24e92aSStefan Hajnoczi  fi
21027e24e92aSStefan Hajnoczifi
21037e24e92aSStefan Hajnoczi##########################################
2104e86ecd4bSJuan Quintela# End of CC checks
2105e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2106e86ecd4bSJuan Quintela
2107e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
21081156c669SJuan Quintela  CFLAGS="-O2 $CFLAGS"
2109e86ecd4bSJuan Quintelafi
2110a316e378SJuan Quintela
2111e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
2112e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
2113e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
211420ff6c80SAnthony Liguori
211520ff6c80SAnthony Liguoriif test -z "$werror" ; then
2116e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
2117e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
2118e86ecd4bSJuan Quintela        werror="yes"
2119e86ecd4bSJuan Quintela    else
2120e86ecd4bSJuan Quintela        werror="no"
2121e86ecd4bSJuan Quintela    fi
2122e86ecd4bSJuan Quintelafi
2123e86ecd4bSJuan Quintela
212420ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
212520ff6c80SAnthony Liguori# enable/disable
212620ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
212720ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
212820ff6c80SAnthony Liguori	zero_malloc="no"
212920ff6c80SAnthony Liguori    else
213020ff6c80SAnthony Liguori	zero_malloc="yes"
213120ff6c80SAnthony Liguori    fi
213220ff6c80SAnthony Liguorifi
213320ff6c80SAnthony Liguori
2134e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
2135a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2136e86ecd4bSJuan Quintelafi
2137e86ecd4bSJuan Quintela
2138e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2139e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
21401156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2141e86ecd4bSJuan Quintela    fi
2142e86ecd4bSJuan Quintelafi
2143e86ecd4bSJuan Quintela
2144*952afb71SBlue Swirl# Use ASLR, no-SEH and DEP if available
2145*952afb71SBlue Swirlif test "$mingw32" = "yes" ; then
2146*952afb71SBlue Swirl    for flag in --dynamicbase --no-seh --nxcompat; do
2147*952afb71SBlue Swirl        if $ld --help 2>/dev/null | grep ".$flag" >/dev/null 2>/dev/null ; then
2148*952afb71SBlue Swirl            LDFLAGS="-Wl,$flag $LDFLAGS"
2149*952afb71SBlue Swirl        fi
2150*952afb71SBlue Swirl    done
2151*952afb71SBlue Swirlfi
2152*952afb71SBlue Swirl
2153190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix
21545a67135aSbellard
2155ca35f780SPaolo Bonzinitools=
2156ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2157ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2158ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2159ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2160ca35f780SPaolo Bonzini    if [ "$check_utests" = "yes" ]; then
2161ca35f780SPaolo Bonzini      tools="check-qint check-qstring check-qdict check-qlist $tools"
2162ca35f780SPaolo Bonzini      tools="check-qfloat check-qjson $tools"
2163ca35f780SPaolo Bonzini    fi
2164ca35f780SPaolo Bonzini  fi
2165ca35f780SPaolo Bonzinifi
2166ca35f780SPaolo Bonzini
2167ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
2168ca35f780SPaolo Bonziniroms=
2169ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2170ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2171ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
2172ca35f780SPaolo Bonzini  roms="optionrom"
2173ca35f780SPaolo Bonzinifi
2174ca35f780SPaolo Bonzini
2175ca35f780SPaolo Bonzini
21767d13299dSbellardecho "Install prefix    $prefix"
2177f2b9e1e3SPaolo Bonziniecho "BIOS directory    `eval echo $datadir`"
2178f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
21791c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
218011d9f695Sbellardif test "$mingw32" = "no" ; then
2181f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
218243ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
218311d9f695Sbellardfi
21845a67135aSbellardecho "Source path       $source_path"
21857d13299dSbellardecho "C compiler        $cc"
218683469015Sbellardecho "Host C compiler   $host_cc"
21870c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
2188a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
21890c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
21907d13299dSbellardecho "make              $make"
21916a882643Spbrookecho "install           $install"
2192a98fd896Sbellardecho "host CPU          $cpu"
2193de83cd02Sbellardecho "host big endian   $bigendian"
219497a847bcSbellardecho "target list       $target_list"
2195ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
2196b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
21977d13299dSbellardecho "gprof enabled     $gprof"
219803b4fe7dSaliguoriecho "sparse enabled    $sparse"
21991625af87Saliguoriecho "strip binaries    $strip_opt"
220005c2a3e7Sbellardecho "profiler          $profiler"
220143ce4dfeSbellardecho "static build      $static"
220285aa5189Sbellardecho "-Werror enabled   $werror"
22035b0753e0Sbellardif test "$darwin" = "yes" ; then
22045b0753e0Sbellard    echo "Cocoa support     $cocoa"
22055b0753e0Sbellardfi
220697a847bcSbellardecho "SDL support       $sdl"
22074d3b6f6eSbalrogecho "curses support    $curses"
2208769ce76dSAlexander Grafecho "curl support      $curl"
22095495ed11SLuiz Capitulinoecho "check support     $check_utests"
221067b915a5Sbellardecho "mingw32 support   $mingw32"
22110c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
22120c58ac1cSmalcecho "Extra audio cards $audio_card_list"
2213eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
22148ff9cbf7Smalcecho "Mixer emulation   $mixemu"
22158d5d2d4cSthsecho "VNC TLS support   $vnc_tls"
22162f9606b3Saliguoriecho "VNC SASL support  $vnc_sasl"
22172f6f5c7aSCorentin Charyecho "VNC JPEG support  $vnc_jpeg"
2218efe556adSCorentin Charyecho "VNC PNG support   $vnc_png"
2219bd023f95SCorentin Charyecho "VNC thread        $vnc_thread"
22203142255cSblueswir1if test -n "$sparc_cpu"; then
22213142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
22223142255cSblueswir1fi
2223e37630caSaliguoriecho "xen support       $xen"
22242e4d9fb1Saurel32echo "brlapi support    $brlapi"
2225a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
2226a25dba17SJuan Quintelaecho "Documentation     $docs"
2227c5937220Spbrook[ ! -z "$uname_release" ] && \
2228c5937220Spbrookecho "uname -r          $uname_release"
2229bd0c5661Spbrookecho "NPTL support      $nptl"
2230379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
223134005a00SKirill A. Shutemovecho "PIE user targets  $user_pie"
22328a16d273Sthsecho "vde support       $vde"
2233e5d355d1Saliguoriecho "IO thread         $io_thread"
22345c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
2235758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
223677755340Sthsecho "Install blobs     $blobs"
2237b31a0277SJuan Quintelaecho "KVM support       $kvm"
2238f652e6afSaurel32echo "fdt support       $fdt"
2239ceb42de8Saliguoriecho "preadv support    $preadv"
22405f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
2241ee682d27SStefan Weilecho "uuid support      $uuid"
2242d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
224394a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
22449410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
224567b915a5Sbellard
224697a847bcSbellardif test $sdl_too_old = "yes"; then
224724b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
2248e8cd23deSbellardfi
224997a847bcSbellard
225098ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
22514bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
225297a847bcSbellard
225398ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
225498ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
225598ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
225698ec69acSJuan Quintelaecho >> $config_host_mak
225798ec69acSJuan Quintela
225899d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
225999d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
226099d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
226199d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak
226299d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
226399d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak
22641dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak
2265804edf29SJuan Quintela
22662408a527Saurel32case "$cpu" in
226724e804ecSAlexander Graf  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2268e0da9dd3SJuan Quintela    ARCH=$cpu
22692408a527Saurel32  ;;
2270a302c32dSLaurent Desnogues  armv4b|armv4l)
227116dbd14fSJuan Quintela    ARCH=arm
22722408a527Saurel32  ;;
22732408a527Saurel32esac
227498ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
2275f8393946Saurel32if test "$debug_tcg" = "yes" ; then
22762358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2277f8393946Saurel32fi
2278b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
2279b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2280b4475aa2SLuiz Capitulinofi
2281f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
22822358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2283f3d08ee6SPaul Brookfi
22841625af87Saliguoriif test "$strip_opt" = "yes" ; then
228552ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
22861625af87Saliguorifi
22877d13299dSbellardif test "$bigendian" = "yes" ; then
2288e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
228997a847bcSbellardfi
22902358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
229167b915a5Sbellardif test "$mingw32" = "yes" ; then
229298ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
2293210fa556Spbrookelse
229435f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
2295210fa556Spbrookfi
2296128ab2ffSblueswir1
2297dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
2298dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
2299dffcb71cSMark McLoughlinfi
2300dffcb71cSMark McLoughlin
230183fb7adfSbellardif test "$darwin" = "yes" ; then
230298ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
230383fb7adfSbellardfi
2304b29fe3edSmalc
2305b29fe3edSmalcif test "$aix" = "yes" ; then
230698ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
2307b29fe3edSmalcfi
2308b29fe3edSmalc
2309ec530c81Sbellardif test "$solaris" = "yes" ; then
231098ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
23112358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
23120475a5caSths  if test "$needs_libsunmath" = "yes" ; then
231375b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
23140475a5caSths  fi
2315ec530c81Sbellardfi
231697a847bcSbellardif test "$static" = "yes" ; then
231798ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
231897a847bcSbellardfi
231905c2a3e7Sbellardif test $profiler = "yes" ; then
23202358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
232105c2a3e7Sbellardfi
2322c20709aaSbellardif test "$slirp" = "yes" ; then
232398ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
2324b6e31c12SJuan Quintela  QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
2325c20709aaSbellardfi
23268a16d273Sthsif test "$vde" = "yes" ; then
232798ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
23288a16d273Sthsfi
23290c58ac1cSmalcfor card in $audio_card_list; do
2330f6e5889eSpbrook    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
233198ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
23320c58ac1cSmalcdone
23332358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
23340c58ac1cSmalcfor drv in $audio_drv_list; do
2335f6e5889eSpbrook    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
233698ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
2337923e4521Smalc    if test "$drv" = "fmod"; then
23387aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2339fb065187Sbellard    fi
23400c58ac1cSmalcdone
234167f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
234267f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
234367f86e8eSJuan Quintelafi
2344d5631638Smalcif test "$audio_win_int" = "yes" ; then
2345d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2346d5631638Smalcfi
2347eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
23488ff9cbf7Smalcif test "$mixemu" = "yes" ; then
234998ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
23508ff9cbf7Smalcfi
23518d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
235298ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2353525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
23548d5d2d4cSthsfi
23552f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
235698ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
235760ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
23582f9606b3Saliguorifi
235996763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then
23602f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
23612f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
23622f6f5c7aSCorentin Charyfi
236396763cf9SCorentin Charyif test "$vnc_png" != "no" ; then
2364efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2365efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2366efe556adSCorentin Charyfi
236796763cf9SCorentin Charyif test "$vnc_thread" != "no" ; then
2368bd023f95SCorentin Chary  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2369bd023f95SCorentin Chary  echo "CONFIG_THREAD=y" >> $config_host_mak
2370bd023f95SCorentin Charyfi
237176655d6dSaliguoriif test "$fnmatch" = "yes" ; then
23722358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
237376655d6dSaliguorifi
2374ee682d27SStefan Weilif test "$uuid" = "yes" ; then
2375ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
2376ee682d27SStefan Weilfi
2377b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
237898ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
23792358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
238098ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
238198ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
2382a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
238398ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
2384cc8ae6deSpbrookfi
23851ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
238698ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
23878ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
238849ecc3faSbellardfi
238949ecc3faSbellardif test "$cocoa" = "yes" ; then
239098ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
239149ecc3faSbellardfi
23924d3b6f6eSbalrogif test "$curses" = "yes" ; then
239398ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
2394ab4e5602SJan Kiszkafi
23953b3f24adSaurel32if test "$atfile" = "yes" ; then
23962358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
23973b3f24adSaurel32fi
2398ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
23992358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2400ebc996f3SRiku Voipiofi
2401099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
24022358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
2403099d6b0fSRiku Voipiofi
240440ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
240540ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
240640ff6d7eSKevin Wolffi
24073ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
24082358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
24093ce34dfbSvibisreenivasanfi
2410c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
2411c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2412c2882b96SRiku Voipiofi
2413d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
2414d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2415d0927938SUlrich Hechtfi
2416d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
2417d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
2418d0927938SUlrich Hechtfi
24193b3f24adSaurel32if test "$inotify" = "yes" ; then
24202358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
24213b3f24adSaurel32fi
2422c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
2423c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2424c05c7a73SRiku Voipiofi
24256ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
24266ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
24276ae9a1f4SJuan Quintelafi
24286ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
24296ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
24306ae9a1f4SJuan Quintelafi
2431769ce76dSAlexander Grafif test "$curl" = "yes" ; then
243298ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
2433b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2434769ce76dSAlexander Graffi
24352e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
243698ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
24372e4d9fb1Saurel32fi
2438fb599c9aSbalrogif test "$bluez" = "yes" ; then
243998ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2440ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2441fb599c9aSbalrogfi
2442e37630caSaliguoriif test "$xen" = "yes" ; then
24435647eb74SJuan Quintela  echo "CONFIG_XEN=y" >> $config_host_mak
2444e37630caSaliguorifi
2445e5d355d1Saliguoriif test "$io_thread" = "yes" ; then
244698ec69acSJuan Quintela  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2447bd023f95SCorentin Chary  echo "CONFIG_THREAD=y" >> $config_host_mak
2448e5d355d1Saliguorifi
24495c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
24505c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
24515c6c3a6cSChristoph Hellwigfi
2452758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
2453758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
2454758e8e38SVenkateswararao Jujjuri (JV)fi
2455758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then
2456758e8e38SVenkateswararao Jujjuri (JV)  if test "$attr" = "yes" ; then
2457758e8e38SVenkateswararao Jujjuri (JV)    echo "CONFIG_VIRTFS=y" >> $config_host_mak
2458758e8e38SVenkateswararao Jujjuri (JV)  fi
2459758e8e38SVenkateswararao Jujjuri (JV)fi
246077755340Sthsif test "$blobs" = "yes" ; then
246198ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
246277755340Sthsfi
2463bf9298b9Saliguoriif test "$iovec" = "yes" ; then
24642358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
2465bf9298b9Saliguorifi
2466ceb42de8Saliguoriif test "$preadv" = "yes" ; then
24672358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
2468ceb42de8Saliguorifi
2469f652e6afSaurel32if test "$fdt" = "yes" ; then
24703f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
2471f652e6afSaurel32fi
2472de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then
2473de5071c5SBlue Swirl  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2474de5071c5SBlue Swirlfi
2475747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then
2476747bbdf7SBlue Swirl  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2477747bbdf7SBlue Swirlfi
24785f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
24795f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
24805f6b9e8fSBlue Swirlfi
248197a847bcSbellard
248283fb7adfSbellard# XXX: suppress that
24837d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
24842358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
24857d3505c5Sbellardfi
24867d3505c5Sbellard
24872358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2488c5937220Spbrook
248920ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
249020ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
249120ff6c80SAnthony Liguorifi
249220ff6c80SAnthony Liguori
249368063649Sblueswir1# USB host support
249468063649Sblueswir1case "$usb" in
249568063649Sblueswir1linux)
249698ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
249768063649Sblueswir1;;
249868063649Sblueswir1bsd)
249998ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
250068063649Sblueswir1;;
250168063649Sblueswir1*)
250298ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
250368063649Sblueswir1;;
250468063649Sblueswir1esac
250568063649Sblueswir1
250694a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
250722890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then
250822890ab5SPrerna Saxena  echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
250922890ab5SPrerna Saxenafi
25109410b56cSPrerna Saxena# Set the appropriate trace file.
25119410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
25129410b56cSPrerna Saxena  trace_file="\"$trace_file-%u\""
25139410b56cSPrerna Saxenafi
25149410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
25159410b56cSPrerna Saxena
251698ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
251798ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
2518804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
2519804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
2520804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2521804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2522804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2523804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
2524804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
2525804edf29SJuan Quintelaif test "$sparse" = "yes" ; then
2526804edf29SJuan Quintela  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
2527804edf29SJuan Quintela  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
2528a558ee17SJuan Quintela  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2529804edf29SJuan Quintelafi
2530804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
2531804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
2532804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
2533e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
2534a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2535c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2536e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
2537a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2538a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
253973da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
25403e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2541804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
2542804edf29SJuan Quintela
25434bf6b55bSJuan Quintela# generate list of library paths for linker script
25444bf6b55bSJuan Quintela
25454bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
25464bf6b55bSJuan Quintela
25474bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
25484bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
25494bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
25504bf6b55bSJuan Quintela  else
25514bf6b55bSJuan Quintela    rm ${config_host_ld}~
25524bf6b55bSJuan Quintela  fi
25534bf6b55bSJuan Quintelafi
25544bf6b55bSJuan Quintela
25554d904533SBlue Swirlfor d in libdis libdis-user; do
25564d904533SBlue Swirl    mkdir -p $d
25574d904533SBlue Swirl    rm -f $d/Makefile
25584d904533SBlue Swirl    ln -s $source_path/Makefile.dis $d/Makefile
25594d904533SBlue Swirl    echo > $d/config.mak
25604d904533SBlue Swirldone
2561d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then
2562d44cff22SRichard Henderson  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2563d44cff22SRichard Hendersonfi
25644d904533SBlue Swirl
256597a847bcSbellardfor target in $target_list; do
256697a847bcSbellardtarget_dir="$target"
256725be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
2568600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
256997a847bcSbellardtarget_bigendian="no"
25701f3d3c8fSJuan Quintela
2571ea2d6a39SJuan Quintelacase "$target_arch2" in
257224e804ecSAlexander Graf  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2573ea2d6a39SJuan Quintela  target_bigendian=yes
2574ea2d6a39SJuan Quintela  ;;
2575ea2d6a39SJuan Quintelaesac
257697a847bcSbellardtarget_softmmu="no"
2577997344f3Sbellardtarget_user_only="no"
2578831b7825Sthstarget_linux_user="no"
2579831b7825Sthstarget_darwin_user="no"
258084778508Sblueswir1target_bsd_user="no"
25819e407a85Spbrookcase "$target" in
2582600309b6SBlue Swirl  ${target_arch2}-softmmu)
25839e407a85Spbrook    target_softmmu="yes"
25849e407a85Spbrook    ;;
2585600309b6SBlue Swirl  ${target_arch2}-linux-user)
25869c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
25879c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
25889c7a4202SBlue Swirl      exit 1
25899c7a4202SBlue Swirl    fi
25909e407a85Spbrook    target_user_only="yes"
25919e407a85Spbrook    target_linux_user="yes"
25929e407a85Spbrook    ;;
2593600309b6SBlue Swirl  ${target_arch2}-darwin-user)
25949c7a4202SBlue Swirl    if test "$darwin" != "yes" ; then
25959c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Darwin host"
25969c7a4202SBlue Swirl      exit 1
25979c7a4202SBlue Swirl    fi
25989e407a85Spbrook    target_user_only="yes"
2599831b7825Sths    target_darwin_user="yes"
26009e407a85Spbrook    ;;
2601600309b6SBlue Swirl  ${target_arch2}-bsd-user)
26029cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
26039c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
26049c7a4202SBlue Swirl      exit 1
26059c7a4202SBlue Swirl    fi
260684778508Sblueswir1    target_user_only="yes"
260784778508Sblueswir1    target_bsd_user="yes"
260884778508Sblueswir1    ;;
26099e407a85Spbrook  *)
26109e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
26119e407a85Spbrook    exit 1
26129e407a85Spbrook    ;;
26139e407a85Spbrookesac
2614831b7825Sths
261597a847bcSbellardmkdir -p $target_dir
2616158142c2Sbellardmkdir -p $target_dir/fpu
261757fec1feSbellardmkdir -p $target_dir/tcg
261859f2a787SGerd Hoffmannmkdir -p $target_dir/ide
261984778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
262069de927cSbellard  mkdir -p $target_dir/nwfpe
262169de927cSbellardfi
262269de927cSbellard
2623ec530c81Sbellard#
2624ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
2625ec530c81Sbellard#
2626ec530c81Sbellardrm -f $target_dir/Makefile
2627ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
2628ec530c81Sbellard
262997a847bcSbellard
263025be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
263197a847bcSbellard
2632e5fe0c52Spbrookbflt="no"
2633bd0c5661Spbrooktarget_nptl="no"
2634600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
26357ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
263656aebc89Spbrookgdb_xml_files=""
26377ba1e619Saliguori
2638938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
26396acff7daSJuan QuintelaTARGET_BASE_ARCH=""
2640e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
2641e73aae67SJuan Quintela
2642600309b6SBlue Swirlcase "$target_arch2" in
26432408a527Saurel32  i386)
26441ad2134fSPaul Brook    target_phys_bits=32
26452408a527Saurel32  ;;
26462408a527Saurel32  x86_64)
26476acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
26481ad2134fSPaul Brook    target_phys_bits=64
26492408a527Saurel32  ;;
26502408a527Saurel32  alpha)
26511ad2134fSPaul Brook    target_phys_bits=64
2652a4b388ffSRichard Henderson    target_nptl="yes"
26532408a527Saurel32  ;;
26542408a527Saurel32  arm|armeb)
2655b498c8a0SJuan Quintela    TARGET_ARCH=arm
2656e5fe0c52Spbrook    bflt="yes"
2657bd0c5661Spbrook    target_nptl="yes"
265856aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
26591ad2134fSPaul Brook    target_phys_bits=32
26602408a527Saurel32  ;;
26612408a527Saurel32  cris)
2662253bd7f8Sedgar_igl    target_nptl="yes"
26631ad2134fSPaul Brook    target_phys_bits=32
26642408a527Saurel32  ;;
26652408a527Saurel32  m68k)
26660938cda5Saurel32    bflt="yes"
266756aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
26681ad2134fSPaul Brook    target_phys_bits=32
26692408a527Saurel32  ;;
267072b675caSEdgar E. Iglesias  microblaze)
267172b675caSEdgar E. Iglesias    bflt="yes"
267272b675caSEdgar E. Iglesias    target_nptl="yes"
267372b675caSEdgar E. Iglesias    target_phys_bits=32
267472b675caSEdgar E. Iglesias  ;;
26752408a527Saurel32  mips|mipsel)
2676b498c8a0SJuan Quintela    TARGET_ARCH=mips
267725be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2678f04dc72fSPaul Brook    target_nptl="yes"
26791ad2134fSPaul Brook    target_phys_bits=64
26802408a527Saurel32  ;;
26812408a527Saurel32  mipsn32|mipsn32el)
2682b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
26836acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
268425be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
26851ad2134fSPaul Brook    target_phys_bits=64
26862408a527Saurel32  ;;
26872408a527Saurel32  mips64|mips64el)
2688b498c8a0SJuan Quintela    TARGET_ARCH=mips64
26896acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
269025be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
26911ad2134fSPaul Brook    target_phys_bits=64
26922408a527Saurel32  ;;
26932408a527Saurel32  ppc)
2694c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
26951ad2134fSPaul Brook    target_phys_bits=32
2696d6630708SNathan Froyd    target_nptl="yes"
26972408a527Saurel32  ;;
26982408a527Saurel32  ppcemb)
26996acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2700e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
2701c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
27021ad2134fSPaul Brook    target_phys_bits=64
2703d6630708SNathan Froyd    target_nptl="yes"
27042408a527Saurel32  ;;
27052408a527Saurel32  ppc64)
27066acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2707e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
2708c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
27091ad2134fSPaul Brook    target_phys_bits=64
27102408a527Saurel32  ;;
27112408a527Saurel32  ppc64abi32)
2712b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
27136acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2714e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
271525be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
2716c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
27171ad2134fSPaul Brook    target_phys_bits=64
27182408a527Saurel32  ;;
27192408a527Saurel32  sh4|sh4eb)
2720b498c8a0SJuan Quintela    TARGET_ARCH=sh4
27214dbed897Spbrook    bflt="yes"
27220b6d3ae0Saurel32    target_nptl="yes"
27231ad2134fSPaul Brook    target_phys_bits=32
27242408a527Saurel32  ;;
27252408a527Saurel32  sparc)
27261ad2134fSPaul Brook    target_phys_bits=64
27272408a527Saurel32  ;;
27282408a527Saurel32  sparc64)
27296acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
27301ad2134fSPaul Brook    target_phys_bits=64
27312408a527Saurel32  ;;
27322408a527Saurel32  sparc32plus)
2733b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
27346acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
2735e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
273625be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
27371ad2134fSPaul Brook    target_phys_bits=64
27382408a527Saurel32  ;;
273924e804ecSAlexander Graf  s390x)
274024e804ecSAlexander Graf    target_phys_bits=64
274124e804ecSAlexander Graf  ;;
27422408a527Saurel32  *)
2743de83cd02Sbellard    echo "Unsupported target CPU"
2744de83cd02Sbellard    exit 1
27452408a527Saurel32  ;;
27462408a527Saurel32esac
274725be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2748053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
274925be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
275025be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
275142bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
27526acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then
27536acff7daSJuan Quintela  TARGET_BASE_ARCH=$TARGET_ARCH
27546acff7daSJuan Quintelafi
275525be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2756e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
2757e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
2758e6e91b9cSJuan Quintelafi
275925be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
27601b0c87fcSJuan Quintelacase "$target_arch2" in
27611b0c87fcSJuan Quintela  i386|x86_64)
27621b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
276325be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
27641b0c87fcSJuan Quintela    fi
27651b0c87fcSJuan Quintelaesac
2766c59249f9SJuan Quintelacase "$target_arch2" in
27670e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
2768c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
2769c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2770c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
2771c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
27725f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
2773c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
2774c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
277525be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
277625be210fSJuan Quintela      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2777dae5079aSJan Kiszka      if test "$kvm_para" = "yes"; then
2778dae5079aSJan Kiszka        echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2779dae5079aSJan Kiszka      fi
2780d5970055SMichael S. Tsirkin      if test $vhost_net = "yes" ; then
2781d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2782d5970055SMichael S. Tsirkin      fi
2783c59249f9SJuan Quintela    fi
2784c59249f9SJuan Quintelaesac
2785de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
278625be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
278797a847bcSbellardfi
278897a847bcSbellardif test "$target_softmmu" = "yes" ; then
2789b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
279025be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
279125be210fSJuan Quintela  echo "LIBS+=$libs_softmmu" >> $config_target_mak
27920e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
27935791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2794de83cd02Sbellardfi
2795997344f3Sbellardif test "$target_user_only" = "yes" ; then
279625be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2797997344f3Sbellardfi
2798831b7825Sthsif test "$target_linux_user" = "yes" ; then
279925be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2800831b7825Sthsfi
2801831b7825Sthsif test "$target_darwin_user" = "yes" ; then
280225be210fSJuan Quintela  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2803831b7825Sthsfi
280456aebc89Spbrooklist=""
280556aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
280656aebc89Spbrook  for x in $gdb_xml_files; do
280756aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
280856aebc89Spbrook  done
280925be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
28103d0f1517SJuan Quintelafi
2811de83cd02Sbellard
2812f57975fbSJuan Quintelacase "$target_arch2" in
2813990b3e19SRichard Henderson  alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
281425be210fSJuan Quintela    echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2815f57975fbSJuan Quintela    ;;
2816d6b38939SJuan Quintela  *)
281725be210fSJuan Quintela    echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2818d6b38939SJuan Quintela    ;;
2819f57975fbSJuan Quintelaesac
2820f57975fbSJuan Quintela
2821e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
282225be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2823e5fe0c52Spbrookfi
2824bd0c5661Spbrookif test "$target_user_only" = "yes" \
2825bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
282625be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2827bd0c5661Spbrookfi
2828379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
282925be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2830379f6698SPaul Brookfi
283184778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
283225be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
283384778508Sblueswir1fi
28345b0753e0Sbellard
28354afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
2836fa282484SJuan Quintela
28374afddb55SJuan Quintelacflags=""
2838fa282484SJuan Quintelaldflags=""
28399b8e111fSJuan Quintela
284057ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then
284157ddfbf7SJuan Quintela  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
284224e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
284324e804ecSAlexander Graf  cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
28445d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
28455d8a4f8fSRichard Henderson  cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
284657ddfbf7SJuan Quintelaelse
284757ddfbf7SJuan Quintela  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
284857ddfbf7SJuan Quintelafi
284957ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/tcg $cflags"
285057ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/fpu $cflags"
285157ddfbf7SJuan Quintela
28524d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
28534d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
28544d904533SBlue Swirlelse
28554d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
28564d904533SBlue Swirlfi
28574d904533SBlue Swirl
285864656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
285964656024SJuan Quintela  case "$i" in
286064656024SJuan Quintela  alpha)
286125be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
28624d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
286364656024SJuan Quintela  ;;
286464656024SJuan Quintela  arm)
286525be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
28664d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
286764656024SJuan Quintela  ;;
286864656024SJuan Quintela  cris)
286925be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
28704d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
287164656024SJuan Quintela  ;;
287264656024SJuan Quintela  hppa)
287325be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
28744d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
287564656024SJuan Quintela  ;;
287664656024SJuan Quintela  i386|x86_64)
287725be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
28784d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
287964656024SJuan Quintela  ;;
2880903ec55cSAurelien Jarno  ia64*)
2881903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
2882903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
2883903ec55cSAurelien Jarno  ;;
288464656024SJuan Quintela  m68k)
288525be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
28864d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
288764656024SJuan Quintela  ;;
288864656024SJuan Quintela  microblaze)
288925be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
28904d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
289164656024SJuan Quintela  ;;
289264656024SJuan Quintela  mips*)
289325be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
28944d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
289564656024SJuan Quintela  ;;
289664656024SJuan Quintela  ppc*)
289725be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
28984d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
289964656024SJuan Quintela  ;;
290024e804ecSAlexander Graf  s390*)
290125be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
29024d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
290364656024SJuan Quintela  ;;
290464656024SJuan Quintela  sh4)
290525be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
29064d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
290764656024SJuan Quintela  ;;
290864656024SJuan Quintela  sparc*)
290925be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
29104d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
291164656024SJuan Quintela  ;;
291264656024SJuan Quintela  esac
291364656024SJuan Quinteladone
291464656024SJuan Quintela
29156ee7126fSJuan Quintelacase "$ARCH" in
29166ee7126fSJuan Quintelaalpha)
29176ee7126fSJuan Quintela  # Ensure there's only a single GP
29186ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
29196ee7126fSJuan Quintela;;
29206ee7126fSJuan Quintelaesac
29216ee7126fSJuan Quintela
292255d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
292355d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
292455d9c04bSJuan Quintela  arm)
292555d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
292655d9c04bSJuan Quintela  ;;
292755d9c04bSJuan Quintela  i386|mips|ppc)
292855d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
292955d9c04bSJuan Quintela  ;;
293055d9c04bSJuan Quintela  esac
293155d9c04bSJuan Quintelafi
293255d9c04bSJuan Quintela
293334005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \
293434005a00SKirill A. Shutemov	"$user_pie" = "yes" ; then
293534005a00SKirill A. Shutemov  cflags="-fpie $cflags"
293634005a00SKirill A. Shutemov  ldflags="-pie $ldflags"
293734005a00SKirill A. Shutemovfi
293834005a00SKirill A. Shutemov
2939471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \
2940471857ddSJuan Quintela        "$TARGET_ARCH" = "microblaze" -o \
2941471857ddSJuan Quintela        "$TARGET_ARCH" = "cris" \) ; then
294225be210fSJuan Quintela  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2943471857ddSJuan Quintelafi
2944471857ddSJuan Quintela
2945d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
294625be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
2947d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
2948d02c1db3SJuan Quintela    cflags="-p $cflags"
2949d02c1db3SJuan Quintela    ldflags="-p $ldflags"
2950d02c1db3SJuan Quintela  fi
2951d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
2952d02c1db3SJuan Quintela    ldflags="-p $ldflags"
295325be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
2954d02c1db3SJuan Quintela  fi
2955d02c1db3SJuan Quintelafi
2956d02c1db3SJuan Quintela
29576ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
29589b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2959fa282484SJuan Quintela  case "$ARCH" in
2960fa282484SJuan Quintela  sparc)
2961fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
2962322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
2963fa282484SJuan Quintela    ;;
29644d58be06SRichard Henderson  alpha | s390x)
29654d58be06SRichard Henderson    # The default placement of the application is fine.
29664d58be06SRichard Henderson    ;;
2967fd76e73aSRichard Henderson  *)
2968322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
2969fa282484SJuan Quintela    ;;
2970fa282484SJuan Quintela  esac
2971fa282484SJuan Quintelafi
2972fa282484SJuan Quintela
297325be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
297425be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2975fa282484SJuan Quintela
297697a847bcSbellarddone # for target in $targets
29777d13299dSbellard
29787d13299dSbellard# build tree in object directory if source path is different from current one
29797d13299dSbellardif test "$source_path_used" = "yes" ; then
2980e1144d00SMark McLoughlin    DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
29812d9f27d2SAnthony Liguori    DIRS="$DIRS roms/seabios roms/vgabios"
29823e230dd2SCorentin Chary    DIRS="$DIRS fsdev ui"
29837d13299dSbellard    FILES="Makefile tests/Makefile"
2984e7daa605Sths    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2985e1ffb0f1Sedgar_igl    FILES="$FILES tests/test-mmap.c"
29867ea78b74SJan Kiszka    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
29872d9f27d2SAnthony Liguori    FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
29887ea78b74SJan Kiszka    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
29897ea78b74SJan Kiszka        FILES="$FILES pc-bios/`basename $bios_file`"
29907ea78b74SJan Kiszka    done
29917d13299dSbellard    for dir in $DIRS ; do
29927d13299dSbellard            mkdir -p $dir
29937d13299dSbellard    done
2994ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
29957d13299dSbellard    for f in $FILES ; do
2996ec530c81Sbellard        rm -f $f
2997ec530c81Sbellard        ln -s $source_path/$f $f
29987d13299dSbellard    done
29997d13299dSbellardfi
30001ad2134fSPaul Brook
3001c34ebfdcSAnthony Liguori# temporary config to build submodules
30022d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
3003c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
300437116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
3005c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
3006c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
3007c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
3008c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
3009c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
3010c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
3011c34ebfdcSAnthony Liguori    echo "HOST_CC=$host_cc" >> $config_mak
3012c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
3013c34ebfdcSAnthony Liguoridone
3014c34ebfdcSAnthony Liguori
30151ad2134fSPaul Brookfor hwlib in 32 64; do
30161ad2134fSPaul Brook  d=libhw$hwlib
30171ad2134fSPaul Brook  mkdir -p $d
30189953b2fcSBlue Swirl  mkdir -p $d/ide
30191ad2134fSPaul Brook  rm -f $d/Makefile
30201ad2134fSPaul Brook  ln -s $source_path/Makefile.hw $d/Makefile
302137116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
30221ad2134fSPaul Brookdone
3023add16157SBlue Swirl
3024add16157SBlue Swirld=libuser
3025add16157SBlue Swirlmkdir -p $d
3026add16157SBlue Swirlrm -f $d/Makefile
3027add16157SBlue Swirlln -s $source_path/Makefile.user $d/Makefile
3028299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then
3029299060a0SKirill A. Shutemov  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3030299060a0SKirill A. Shutemovfi
3031b40292e7SJan Kiszka
3032b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
3033b40292e7SJan Kiszka  mkdir -p QMP
3034b40292e7SJan Kiszkafi
3035