xref: /openbmc/qemu/configure (revision 7e24e92a)
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
141a0f291fcSJuan Quintelagcc_flags="-Wold-style-declaration -Wold-style-definition -fstack-protector-all"
142be17dc90SMichael S. Tsirkincat > $TMPC << EOF
143aa527b65SAurelien Jarnoint main(void) { return 0; }
144be17dc90SMichael S. TsirkinEOF
145be17dc90SMichael S. Tsirkinfor flag in $gcc_flags; do
146aa527b65SAurelien Jarno    if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
147be17dc90SMichael S. Tsirkin	QEMU_CFLAGS="$flag $QEMU_CFLAGS"
148be17dc90SMichael S. Tsirkin    fi
149be17dc90SMichael S. Tsirkindone
150be17dc90SMichael S. Tsirkin
151ac0df51dSaliguori# check that the C compiler works.
152ac0df51dSaliguoricat > $TMPC <<EOF
153ac0df51dSaliguoriint main(void) {}
154ac0df51dSaliguoriEOF
155ac0df51dSaliguori
15652166aa0SJuan Quintelaif compile_object ; then
157ac0df51dSaliguori  : C compiler works ok
158ac0df51dSaliguorielse
159ac0df51dSaliguori    echo "ERROR: \"$cc\" either does not exist or does not work"
160ac0df51dSaliguori    exit 1
161ac0df51dSaliguorifi
162ac0df51dSaliguori
163ac0df51dSaliguoricheck_define() {
164ac0df51dSaliguoricat > $TMPC <<EOF
165ac0df51dSaliguori#if !defined($1)
166ac0df51dSaliguori#error Not defined
167ac0df51dSaliguori#endif
168ac0df51dSaliguoriint main(void) { return 0; }
169ac0df51dSaliguoriEOF
17052166aa0SJuan Quintela  compile_object
171ac0df51dSaliguori}
172ac0df51dSaliguori
1732ff6b91eSJuan Quintelaif test ! -z "$cpu" ; then
1742ff6b91eSJuan Quintela  # command line argument
1752ff6b91eSJuan Quintela  :
1762ff6b91eSJuan Quintelaelif check_define __i386__ ; then
177ac0df51dSaliguori  cpu="i386"
178ac0df51dSaliguorielif check_define __x86_64__ ; then
179ac0df51dSaliguori  cpu="x86_64"
1803aa9bd6cSblueswir1elif check_define __sparc__ ; then
1813aa9bd6cSblueswir1  # We can't check for 64 bit (when gcc is biarch) or V8PLUSA
1823aa9bd6cSblueswir1  # They must be specified using --sparc_cpu
1833aa9bd6cSblueswir1  if check_define __arch64__ ; then
1843aa9bd6cSblueswir1    cpu="sparc64"
1853aa9bd6cSblueswir1  else
1863aa9bd6cSblueswir1    cpu="sparc"
1873aa9bd6cSblueswir1  fi
188fdf7ed96Smalcelif check_define _ARCH_PPC ; then
189fdf7ed96Smalc  if check_define _ARCH_PPC64 ; then
190fdf7ed96Smalc    cpu="ppc64"
191ac0df51dSaliguori  else
192fdf7ed96Smalc    cpu="ppc"
193fdf7ed96Smalc  fi
194afa05235SAurelien Jarnoelif check_define __mips__ ; then
195afa05235SAurelien Jarno  cpu="mips"
196477ba620SAurelien Jarnoelif check_define __ia64__ ; then
197477ba620SAurelien Jarno  cpu="ia64"
198d66ed0eaSAurelien Jarnoelif check_define __s390__ ; then
199d66ed0eaSAurelien Jarno  if check_define __s390x__ ; then
200d66ed0eaSAurelien Jarno    cpu="s390x"
201d66ed0eaSAurelien Jarno  else
202d66ed0eaSAurelien Jarno    cpu="s390"
203d66ed0eaSAurelien Jarno  fi
204fdf7ed96Smalcelse
205fdf7ed96Smalc  cpu=`uname -m`
206ac0df51dSaliguorifi
207ac0df51dSaliguori
2085327cf48Sbellardtarget_list=""
2097d13299dSbellardcase "$cpu" in
210afa05235SAurelien Jarno  alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
211ea8f20f8SJuan Quintela    cpu="$cpu"
212ea8f20f8SJuan Quintela  ;;
2137d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
21497a847bcSbellard    cpu="i386"
2157d13299dSbellard  ;;
216aaa5fa14Saurel32  x86_64|amd64)
217aaa5fa14Saurel32    cpu="x86_64"
218aaa5fa14Saurel32  ;;
219ba68055eSbellard  armv*b)
220808c4954Sbellard    cpu="armv4b"
221808c4954Sbellard  ;;
222ba68055eSbellard  armv*l)
2237d13299dSbellard    cpu="armv4l"
2247d13299dSbellard  ;;
225f54b3f92Saurel32  parisc|parisc64)
226f54b3f92Saurel32    cpu="hppa"
227f54b3f92Saurel32  ;;
228afa05235SAurelien Jarno  mips*)
229afa05235SAurelien Jarno    cpu="mips"
230afa05235SAurelien Jarno  ;;
23124e804ecSAlexander Graf  s390)
232fb3e5849Sbellard    cpu="s390"
233fb3e5849Sbellard  ;;
23424e804ecSAlexander Graf  s390x)
23524e804ecSAlexander Graf    cpu="s390x"
23624e804ecSAlexander Graf  ;;
2373142255cSblueswir1  sparc|sun4[cdmuv])
238ae228531Sbellard    cpu="sparc"
239ae228531Sbellard  ;;
2407d13299dSbellard  *)
241a447d4dcSPaolo Bonzini    echo "Unsupported CPU = $cpu"
242a447d4dcSPaolo Bonzini    exit 1
2437d13299dSbellard  ;;
2447d13299dSbellardesac
245e2d52ad3SJuan Quintela
2463a3fb96dSStefan Weil# Default value for a variable defining feature "foo".
2473a3fb96dSStefan Weil#  * foo="no"  feature will only be used if --enable-foo arg is given
2483a3fb96dSStefan Weil#  * foo=""    feature will be searched for, and if found, will be used
2493a3fb96dSStefan Weil#              unless --disable-foo is given
2503a3fb96dSStefan Weil#  * foo="yes" this value will only be set by --enable-foo flag.
2513a3fb96dSStefan Weil#              feature will searched for,
2523a3fb96dSStefan Weil#              if not found, configure exits with error
253e2d52ad3SJuan Quintela#
2543a3fb96dSStefan Weil# Always add --enable-foo and --disable-foo command line args.
2553a3fb96dSStefan Weil# Distributions want to ensure that several features are compiled in, and it
2563a3fb96dSStefan Weil# is impossible without a --enable-foo that exits if a feature is not found.
257e2d52ad3SJuan Quintela
258a20a6f46SJuan Quintelabluez=""
2594ffcedb6SJuan Quintelabrlapi=""
260788c8196SJuan Quintelacurl=""
261c584a6d0SJuan Quintelacurses=""
262a25dba17SJuan Quinteladocs=""
2632df87df7SJuan Quintelafdt=""
264b31a0277SJuan Quintelakvm=""
265dae5079aSJan Kiszkakvm_para=""
266b0a47e79SJuan Quintelanptl=""
267c4198157SJuan Quintelasdl=""
268dfffc653SJuan Quintelasparse="no"
269ee682d27SStefan Weiluuid=""
270dfb278bdSJuan Quintelavde=""
2711be10ad2SJuan Quintelavnc_tls=""
272ea784e3bSJuan Quintelavnc_sasl=""
2732f6f5c7aSCorentin Charyvnc_jpeg=""
274efe556adSCorentin Charyvnc_png=""
27596763cf9SCorentin Charyvnc_thread="no"
276fc321b4bSJuan Quintelaxen=""
2775c6c3a6cSChristoph Hellwiglinux_aio=""
278758e8e38SVenkateswararao Jujjuri (JV)attr=""
279d5970055SMichael S. Tsirkinvhost_net=""
280dfb278bdSJuan Quintela
2817d13299dSbellardgprof="no"
282f8393946Saurel32debug_tcg="no"
283b4475aa2SLuiz Capitulinodebug_mon="no"
284f3d08ee6SPaul Brookdebug="no"
2851625af87Saliguoristrip_opt="yes"
2867d13299dSbellardbigendian="no"
28767b915a5Sbellardmingw32="no"
28867b915a5SbellardEXESUF=""
289683035deSPaolo Bonziniprefix="/usr/local"
290683035deSPaolo Bonzinimandir="\${prefix}/share/man"
291683035deSPaolo Bonzinidatadir="\${prefix}/share/qemu"
292683035deSPaolo Bonzinidocdir="\${prefix}/share/doc/qemu"
293683035deSPaolo Bonzinibindir="\${prefix}/bin"
294683035deSPaolo Bonzinisysconfdir="\${prefix}/etc"
295683035deSPaolo Bonziniconfsuffix="/qemu"
296443f1376Sbellardslirp="yes"
297102a52e4Sbellardfmod_lib=""
298102a52e4Sbellardfmod_inc=""
2992f6a1ab0Sblueswir1oss_lib=""
300b1a550a0Spbrookbsd="no"
3015327cf48Sbellardlinux="no"
302d2c7c9b8Sblueswir1solaris="no"
30305c2a3e7Sbellardprofiler="no"
3045b0753e0Sbellardcocoa="no"
3050a8e90f4Spbrooksoftmmu="yes"
306831b7825Sthslinux_user="no"
307831b7825Sthsdarwin_user="no"
30884778508Sblueswir1bsd_user="no"
309379f6698SPaul Brookguest_base=""
310c5937220Spbrookuname_release=""
311e5d355d1Saliguoriio_thread="no"
3128ff9cbf7Smalcmixemu="no"
313eac30262Saliguorikerneldir=""
314b29fe3edSmalcaix="no"
31577755340Sthsblobs="yes"
3164a19f1ecSpbrookpkgversion=""
3175495ed11SLuiz Capitulinocheck_utests="no"
31834005a00SKirill A. Shutemovuser_pie="no"
31920ff6c80SAnthony Liguorizero_malloc=""
32094a420b1SStefan Hajnoczitrace_backend="nop"
3219410b56cSPrerna Saxenatrace_file="trace"
3227d13299dSbellard
3237d13299dSbellard# OS specific
324ac0df51dSaliguoriif check_define __linux__ ; then
325ac0df51dSaliguori  targetos="Linux"
326ac0df51dSaliguorielif check_define _WIN32 ; then
327ac0df51dSaliguori  targetos='MINGW32'
328169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
329169dc5d3Sblueswir1  targetos='OpenBSD'
330169dc5d3Sblueswir1elif check_define __sun__ ; then
331169dc5d3Sblueswir1  targetos='SunOS'
332ac0df51dSaliguorielse
3337d13299dSbellard  targetos=`uname -s`
334ac0df51dSaliguorifi
3350dbfc675SJuan Quintela
3367d13299dSbellardcase $targetos in
337c326e0afSbellardCYGWIN*)
338c326e0afSbellard  mingw32="yes"
339a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
340d5631638Smalc  audio_possible_drivers="winwave sdl"
341d5631638Smalc  audio_drv_list="winwave"
342c326e0afSbellard;;
34367b915a5SbellardMINGW32*)
34467b915a5Sbellard  mingw32="yes"
345d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
346d5631638Smalc  audio_drv_list="winwave"
34767b915a5Sbellard;;
3485c40d2bdSthsGNU/kFreeBSD)
349a167ba50SAurelien Jarno  bsd="yes"
3500c58ac1cSmalc  audio_drv_list="oss"
351f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3525c40d2bdSths;;
3537d3505c5SbellardFreeBSD)
3547d3505c5Sbellard  bsd="yes"
355a167ba50SAurelien Jarno  make="gmake"
3560c58ac1cSmalc  audio_drv_list="oss"
357f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
358f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
359f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3607d3505c5Sbellard;;
361c5e97233Sblueswir1DragonFly)
362c5e97233Sblueswir1  bsd="yes"
363a167ba50SAurelien Jarno  make="gmake"
364c5e97233Sblueswir1  audio_drv_list="oss"
365c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
366c5e97233Sblueswir1;;
3677d3505c5SbellardNetBSD)
3687d3505c5Sbellard  bsd="yes"
369a167ba50SAurelien Jarno  make="gmake"
3700c58ac1cSmalc  audio_drv_list="oss"
371c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3728ef92a88Sblueswir1  oss_lib="-lossaudio"
3737d3505c5Sbellard;;
3747d3505c5SbellardOpenBSD)
3757d3505c5Sbellard  bsd="yes"
376a167ba50SAurelien Jarno  make="gmake"
3770c58ac1cSmalc  audio_drv_list="oss"
378c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3792f6a1ab0Sblueswir1  oss_lib="-lossaudio"
3807d3505c5Sbellard;;
38183fb7adfSbellardDarwin)
38283fb7adfSbellard  bsd="yes"
38383fb7adfSbellard  darwin="yes"
3840dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
3850dbfc675SJuan Quintela  # run 64-bit userspace code
386aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
3871b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
388aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
3891b0f9cc2Saliguori  fi
3901b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
391a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
3920c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
3931b0f9cc2Saliguori  else
394a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
3951b0f9cc2Saliguori  fi
396831b7825Sths  darwin_user="yes"
397fd677642Sths  cocoa="yes"
3980c58ac1cSmalc  audio_drv_list="coreaudio"
399c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
4000c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
4017973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
40283fb7adfSbellard;;
403ec530c81SbellardSunOS)
404ec530c81Sbellard  solaris="yes"
405c2b84fabSths  make="gmake"
406c2b84fabSths  install="ginstall"
407fa58948dSBlue Swirl  ld="gld"
4080475a5caSths  needs_libsunmath="no"
409c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
410ef18c883Sths  # have to select again, because `uname -m` returns i86pc
411ef18c883Sths  # even on an x86_64 box.
412ef18c883Sths  solariscpu=`isainfo -k`
413ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
414ef18c883Sths    cpu="x86_64"
415ef18c883Sths  fi
416c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
4170475a5caSths    if test "$solarisrev" -le 9 ; then
4180475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
4190475a5caSths        needs_libsunmath="yes"
420f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
421f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
422f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4230475a5caSths      else
4240475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4250475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4260475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4270475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4280475a5caSths        exit 1
4290475a5caSths      fi
4300475a5caSths    fi
43186b2bd93Sths  fi
4326b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4330c58ac1cSmalc    audio_drv_list="oss"
4346b4d2ba1Sths  fi
435c2de5c91Smalc  audio_possible_drivers="oss sdl"
436d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
437d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
438d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
439d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
440a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
441e174c0bbSJuan Quintela  LIBS="-lsocket -lnsl -lresolv $LIBS"
442ec530c81Sbellard;;
443b29fe3edSmalcAIX)
444b29fe3edSmalc  aix="yes"
445b29fe3edSmalc  make="gmake"
446b29fe3edSmalc;;
447fb065187Sbellard*)
4480c58ac1cSmalc  audio_drv_list="oss"
449b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4505327cf48Sbellard  linux="yes"
451831b7825Sths  linux_user="yes"
45268063649Sblueswir1  usb="linux"
45307f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
454c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
455c9ec1fe4Sbellard  fi
456fb065187Sbellard;;
4577d13299dSbellardesac
4587d13299dSbellard
4597d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
460b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
46168063649Sblueswir1    usb="bsd"
46283fb7adfSbellard  fi
46384778508Sblueswir1  bsd_user="yes"
4647d3505c5Sbellardfi
4657d3505c5Sbellard
4663457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
4673457a3f8SJuan Quintela  EXESUF=".exe"
468a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
469e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
470e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
471884044aaSJuan Quintela  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
472683035deSPaolo Bonzini  prefix="c:/Program Files/Qemu"
473683035deSPaolo Bonzini  mandir="\${prefix}"
474683035deSPaolo Bonzini  datadir="\${prefix}"
475683035deSPaolo Bonzini  docdir="\${prefix}"
476683035deSPaolo Bonzini  bindir="\${prefix}"
477683035deSPaolo Bonzini  sysconfdir="\${prefix}"
478683035deSPaolo Bonzini  confsuffix=""
4793457a3f8SJuan Quintelafi
4803457a3f8SJuan Quintela
4817d13299dSbellard# find source path
482ad064840Spbrooksource_path=`dirname "$0"`
48359faef3aSbalrogsource_path_used="no"
48459faef3aSbalrogworkdir=`pwd`
485ad064840Spbrookif [ -z "$source_path" ]; then
48659faef3aSbalrog    source_path=$workdir
487ad064840Spbrookelse
488ad064840Spbrook    source_path=`cd "$source_path"; pwd`
4897d13299dSbellardfi
490724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes"
4917d13299dSbellard
492487fefdbSAnthony Liguoriwerror=""
49385aa5189Sbellard
4947d13299dSbellardfor opt do
495a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
4967d13299dSbellard  case "$opt" in
4972efc3265Sbellard  --help|-h) show_help=yes
4982efc3265Sbellard  ;;
499b1a550a0Spbrook  --prefix=*) prefix="$optarg"
5007d13299dSbellard  ;;
501b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
50232ce6337Sbellard  ;;
503b1a550a0Spbrook  --source-path=*) source_path="$optarg"
504ad064840Spbrook  source_path_used="yes"
5057d13299dSbellard  ;;
506ac0df51dSaliguori  --cross-prefix=*)
5077d13299dSbellard  ;;
508ac0df51dSaliguori  --cc=*)
5097d13299dSbellard  ;;
510b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
51183469015Sbellard  ;;
512b1a550a0Spbrook  --make=*) make="$optarg"
5137d13299dSbellard  ;;
5146a882643Spbrook  --install=*) install="$optarg"
5156a882643Spbrook  ;;
516e2a2ed06SJuan Quintela  --extra-cflags=*)
5177d13299dSbellard  ;;
518e2a2ed06SJuan Quintela  --extra-ldflags=*)
5197d13299dSbellard  ;;
5202ff6b91eSJuan Quintela  --cpu=*)
5217d13299dSbellard  ;;
522b1a550a0Spbrook  --target-list=*) target_list="$optarg"
523de83cd02Sbellard  ;;
52494a420b1SStefan Hajnoczi  --trace-backend=*) trace_backend="$optarg"
52594a420b1SStefan Hajnoczi  ;;
5269410b56cSPrerna Saxena  --trace-file=*) trace_file="$optarg"
5279410b56cSPrerna Saxena  ;;
5287d13299dSbellard  --enable-gprof) gprof="yes"
5297d13299dSbellard  ;;
53079427693SLoïc Minier  --static)
53179427693SLoïc Minier    static="yes"
53279427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
53343ce4dfeSbellard  ;;
5340b24e75fSPaolo Bonzini  --mandir=*) mandir="$optarg"
5350b24e75fSPaolo Bonzini  ;;
5360b24e75fSPaolo Bonzini  --bindir=*) bindir="$optarg"
5370b24e75fSPaolo Bonzini  ;;
5380b24e75fSPaolo Bonzini  --datadir=*) datadir="$optarg"
5390b24e75fSPaolo Bonzini  ;;
5400b24e75fSPaolo Bonzini  --docdir=*) docdir="$optarg"
5410b24e75fSPaolo Bonzini  ;;
542ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
54307381cc1SAnthony Liguori  ;;
54497a847bcSbellard  --disable-sdl) sdl="no"
54597a847bcSbellard  ;;
546c4198157SJuan Quintela  --enable-sdl) sdl="yes"
547c4198157SJuan Quintela  ;;
548b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
549102a52e4Sbellard  ;;
550c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
551c2de5c91Smalc  ;;
5522f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
5532f6a1ab0Sblueswir1  ;;
5542fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
5550c58ac1cSmalc  ;;
5560c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
5570c58ac1cSmalc  ;;
558eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
559eb852011SMarkus Armbruster  ;;
560f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
561f8393946Saurel32  ;;
562f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
563f8393946Saurel32  ;;
564b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
565b4475aa2SLuiz Capitulino  ;;
566b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
567b4475aa2SLuiz Capitulino  ;;
568f3d08ee6SPaul Brook  --enable-debug)
569f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
570f3d08ee6SPaul Brook      debug_tcg="yes"
571b4475aa2SLuiz Capitulino      debug_mon="yes"
572f3d08ee6SPaul Brook      debug="yes"
573f3d08ee6SPaul Brook      strip_opt="no"
574f3d08ee6SPaul Brook  ;;
57503b4fe7dSaliguori  --enable-sparse) sparse="yes"
57603b4fe7dSaliguori  ;;
57703b4fe7dSaliguori  --disable-sparse) sparse="no"
57803b4fe7dSaliguori  ;;
5791625af87Saliguori  --disable-strip) strip_opt="no"
5801625af87Saliguori  ;;
5818d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
5828d5d2d4cSths  ;;
5831be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
5841be10ad2SJuan Quintela  ;;
5852f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
5862f9606b3Saliguori  ;;
587ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
588ea784e3bSJuan Quintela  ;;
5892f6f5c7aSCorentin Chary  --disable-vnc-jpeg) vnc_jpeg="no"
5902f6f5c7aSCorentin Chary  ;;
5912f6f5c7aSCorentin Chary  --enable-vnc-jpeg) vnc_jpeg="yes"
5922f6f5c7aSCorentin Chary  ;;
593efe556adSCorentin Chary  --disable-vnc-png) vnc_png="no"
594efe556adSCorentin Chary  ;;
595efe556adSCorentin Chary  --enable-vnc-png) vnc_png="yes"
596efe556adSCorentin Chary  ;;
597bd023f95SCorentin Chary  --disable-vnc-thread) vnc_thread="no"
598bd023f95SCorentin Chary  ;;
599bd023f95SCorentin Chary  --enable-vnc-thread) vnc_thread="yes"
600bd023f95SCorentin Chary  ;;
601443f1376Sbellard  --disable-slirp) slirp="no"
602c20709aaSbellard  ;;
603ee682d27SStefan Weil  --disable-uuid) uuid="no"
604ee682d27SStefan Weil  ;;
605ee682d27SStefan Weil  --enable-uuid) uuid="yes"
606ee682d27SStefan Weil  ;;
607e0e6c8c0Saliguori  --disable-vde) vde="no"
6088a16d273Sths  ;;
609dfb278bdSJuan Quintela  --enable-vde) vde="yes"
610dfb278bdSJuan Quintela  ;;
611e37630caSaliguori  --disable-xen) xen="no"
612e37630caSaliguori  ;;
613fc321b4bSJuan Quintela  --enable-xen) xen="yes"
614fc321b4bSJuan Quintela  ;;
6152e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
6162e4d9fb1Saurel32  ;;
6174ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
6184ffcedb6SJuan Quintela  ;;
619fb599c9aSbalrog  --disable-bluez) bluez="no"
620fb599c9aSbalrog  ;;
621a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
622a20a6f46SJuan Quintela  ;;
6237ba1e619Saliguori  --disable-kvm) kvm="no"
6247ba1e619Saliguori  ;;
625b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
626b31a0277SJuan Quintela  ;;
62705c2a3e7Sbellard  --enable-profiler) profiler="yes"
62805c2a3e7Sbellard  ;;
629c2de5c91Smalc  --enable-cocoa)
630c2de5c91Smalc      cocoa="yes" ;
631c2de5c91Smalc      sdl="no" ;
632c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
6335b0753e0Sbellard  ;;
634cad25d69Spbrook  --disable-system) softmmu="no"
6350a8e90f4Spbrook  ;;
636cad25d69Spbrook  --enable-system) softmmu="yes"
6370a8e90f4Spbrook  ;;
6380953a80fSZachary Amsden  --disable-user)
6390953a80fSZachary Amsden      linux_user="no" ;
6400953a80fSZachary Amsden      bsd_user="no" ;
6410953a80fSZachary Amsden      darwin_user="no"
6420953a80fSZachary Amsden  ;;
6430953a80fSZachary Amsden  --enable-user) ;;
644831b7825Sths  --disable-linux-user) linux_user="no"
6450a8e90f4Spbrook  ;;
646831b7825Sths  --enable-linux-user) linux_user="yes"
647831b7825Sths  ;;
648831b7825Sths  --disable-darwin-user) darwin_user="no"
649831b7825Sths  ;;
650831b7825Sths  --enable-darwin-user) darwin_user="yes"
6510a8e90f4Spbrook  ;;
65284778508Sblueswir1  --disable-bsd-user) bsd_user="no"
65384778508Sblueswir1  ;;
65484778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
65584778508Sblueswir1  ;;
656379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
657379f6698SPaul Brook  ;;
658379f6698SPaul Brook  --disable-guest-base) guest_base="no"
659379f6698SPaul Brook  ;;
66034005a00SKirill A. Shutemov  --enable-user-pie) user_pie="yes"
66134005a00SKirill A. Shutemov  ;;
66234005a00SKirill A. Shutemov  --disable-user-pie) user_pie="no"
66334005a00SKirill A. Shutemov  ;;
664c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
665c5937220Spbrook  ;;
6663142255cSblueswir1  --sparc_cpu=*)
6673142255cSblueswir1  ;;
66885aa5189Sbellard  --enable-werror) werror="yes"
66985aa5189Sbellard  ;;
67085aa5189Sbellard  --disable-werror) werror="no"
67185aa5189Sbellard  ;;
6724d3b6f6eSbalrog  --disable-curses) curses="no"
6734d3b6f6eSbalrog  ;;
674c584a6d0SJuan Quintela  --enable-curses) curses="yes"
675c584a6d0SJuan Quintela  ;;
676769ce76dSAlexander Graf  --disable-curl) curl="no"
677769ce76dSAlexander Graf  ;;
678788c8196SJuan Quintela  --enable-curl) curl="yes"
679788c8196SJuan Quintela  ;;
6802df87df7SJuan Quintela  --disable-fdt) fdt="no"
6812df87df7SJuan Quintela  ;;
6822df87df7SJuan Quintela  --enable-fdt) fdt="yes"
6832df87df7SJuan Quintela  ;;
6845495ed11SLuiz Capitulino  --disable-check-utests) check_utests="no"
6855495ed11SLuiz Capitulino  ;;
6865495ed11SLuiz Capitulino  --enable-check-utests) check_utests="yes"
6875495ed11SLuiz Capitulino  ;;
688bd0c5661Spbrook  --disable-nptl) nptl="no"
689bd0c5661Spbrook  ;;
690b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
691b0a47e79SJuan Quintela  ;;
6928ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
6938ff9cbf7Smalc  ;;
6945c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
6955c6c3a6cSChristoph Hellwig  ;;
6965c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
6975c6c3a6cSChristoph Hellwig  ;;
698758e8e38SVenkateswararao Jujjuri (JV)  --disable-attr) attr="no"
699758e8e38SVenkateswararao Jujjuri (JV)  ;;
700758e8e38SVenkateswararao Jujjuri (JV)  --enable-attr) attr="yes"
701758e8e38SVenkateswararao Jujjuri (JV)  ;;
702e5d355d1Saliguori  --enable-io-thread) io_thread="yes"
703e5d355d1Saliguori  ;;
70477755340Sths  --disable-blobs) blobs="no"
70577755340Sths  ;;
706eac30262Saliguori  --kerneldir=*) kerneldir="$optarg"
707eac30262Saliguori  ;;
7084a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
7094a19f1ecSpbrook  ;;
710a25dba17SJuan Quintela  --disable-docs) docs="no"
71170ec5dc0SAnthony Liguori  ;;
712a25dba17SJuan Quintela  --enable-docs) docs="yes"
71383a3ab8bSJuan Quintela  ;;
714d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
715d5970055SMichael S. Tsirkin  ;;
716d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
717d5970055SMichael S. Tsirkin  ;;
7186bde81cbSPaolo Bonzini  --*dir)
7196bde81cbSPaolo Bonzini  ;;
7207f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
7217f1559c6Sbalrog  ;;
7227d13299dSbellard  esac
7237d13299dSbellarddone
7247d13299dSbellard
7253142255cSblueswir1#
7263142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
727a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
7283142255cSblueswir1#
729379f6698SPaul Brookhost_guest_base="no"
73040293e58Sbellardcase "$cpu" in
731ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
732ed968ff1SJuan Quintela           v7|v8)
733a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
734ed968ff1SJuan Quintela           ;;
735ed968ff1SJuan Quintela           v8plus|v8plusa)
736a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
737ed968ff1SJuan Quintela           ;;
738ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
739a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
740ed968ff1SJuan Quintela           esac
7410c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
742a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
743762e8230Sblueswir1           if test "$solaris" = "no" ; then
744a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
745c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
746762e8230Sblueswir1           fi
7473142255cSblueswir1           ;;
748ed968ff1SJuan Quintela    sparc64)
749a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
7500c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
751a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
752ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
753a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
754762e8230Sblueswir1           fi
7553142255cSblueswir1           ;;
75676d83bdeSths    s390)
75728d7cc49SRichard Henderson           QEMU_CFLAGS="-m31 -march=z990 $QEMU_CFLAGS"
75828d7cc49SRichard Henderson           LDFLAGS="-m31 $LDFLAGS"
75948bb3750SRichard Henderson           host_guest_base="yes"
76028d7cc49SRichard Henderson           ;;
76128d7cc49SRichard Henderson    s390x)
76228d7cc49SRichard Henderson           QEMU_CFLAGS="-m64 -march=z990 $QEMU_CFLAGS"
76328d7cc49SRichard Henderson           LDFLAGS="-m64 $LDFLAGS"
76448bb3750SRichard Henderson           host_guest_base="yes"
76576d83bdeSths           ;;
76640293e58Sbellard    i386)
767a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
7680c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
769c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
770379f6698SPaul Brook           host_guest_base="yes"
77140293e58Sbellard           ;;
77240293e58Sbellard    x86_64)
773a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
7740c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
775379f6698SPaul Brook           host_guest_base="yes"
776379f6698SPaul Brook           ;;
777379f6698SPaul Brook    arm*)
778379f6698SPaul Brook           host_guest_base="yes"
77940293e58Sbellard           ;;
780f6548c0aSmalc    ppc*)
781f6548c0aSmalc           host_guest_base="yes"
782f6548c0aSmalc           ;;
783cc01cc8eSAurelien Jarno    mips*)
784cc01cc8eSAurelien Jarno           host_guest_base="yes"
785cc01cc8eSAurelien Jarno           ;;
786477ba620SAurelien Jarno    ia64*)
787477ba620SAurelien Jarno           host_guest_base="yes"
788477ba620SAurelien Jarno           ;;
789fd76e73aSRichard Henderson    hppa*)
790fd76e73aSRichard Henderson           host_guest_base="yes"
791fd76e73aSRichard Henderson           ;;
7923142255cSblueswir1esac
7933142255cSblueswir1
794379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
795379f6698SPaul Brook
796af5db58eSpbrookif test x"$show_help" = x"yes" ; then
797af5db58eSpbrookcat << EOF
798af5db58eSpbrook
799af5db58eSpbrookUsage: configure [options]
800af5db58eSpbrookOptions: [defaults in brackets after descriptions]
801af5db58eSpbrook
802af5db58eSpbrookEOF
803af5db58eSpbrookecho "Standard options:"
804af5db58eSpbrookecho "  --help                   print this message"
805af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
806af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
807af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
808af5db58eSpbrookecho "  --target-list=LIST       set target list [$target_list]"
809af5db58eSpbrookecho ""
810af5db58eSpbrookecho "Advanced options (experts only):"
811af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
812af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
813af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
8140bfe8cc0SPaolo Bonziniecho "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
8150bfe8cc0SPaolo Bonziniecho "                           build time"
816a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
817e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
818af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
8196a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
820af5db58eSpbrookecho "  --static                 enable static build [$static]"
8210b24e75fSPaolo Bonziniecho "  --mandir=PATH            install man pages in PATH"
8220b24e75fSPaolo Bonziniecho "  --datadir=PATH           install firmware in PATH"
8230b24e75fSPaolo Bonziniecho "  --docdir=PATH            install documentation in PATH"
8240b24e75fSPaolo Bonziniecho "  --bindir=PATH            install binaries in PATH"
8250b24e75fSPaolo Bonziniecho "  --sysconfdir=PATH        install config in PATH/qemu"
826f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
827f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
82809695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
829890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
830890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
8311625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
83285aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
833fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
834c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
835af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
836c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
837c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
8384c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
8394c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
840eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
841eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
8428ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
843e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
844fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
8452e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
8464ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
8478d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
8481be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
8492f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
850ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
8512f6f5c7aSCorentin Charyecho "  --disable-vnc-jpeg       disable JPEG lossy compression for VNC server"
8522f6f5c7aSCorentin Charyecho "  --enable-vnc-jpeg        enable JPEG lossy compression for VNC server"
85396763cf9SCorentin Charyecho "  --disable-vnc-png        disable PNG compression for VNC server (default)"
854efe556adSCorentin Charyecho "  --enable-vnc-png         enable PNG compression for VNC server"
855bd023f95SCorentin Charyecho "  --disable-vnc-thread     disable threaded VNC server"
856bd023f95SCorentin Charyecho "  --enable-vnc-thread      enable threaded VNC server"
857af896aaaSpbrookecho "  --disable-curses         disable curses output"
858c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
859769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
860788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
8612df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
8622df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
8635495ed11SLuiz Capitulinoecho "  --disable-check-utests   disable check unit-tests"
8645495ed11SLuiz Capitulinoecho "  --enable-check-utests    enable check unit-tests"
865fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
866a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
8677ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
868b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
869bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
870e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
871af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
872af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
8730953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
8740953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
875831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
876831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
877831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
878831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
87984778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
88084778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
881379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
882379f6698SPaul Brookecho "                           emulation targets"
883379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
88434005a00SKirill A. Shutemovecho "  --enable-user-pie        build usermode emulation targets as PIE"
88534005a00SKirill A. Shutemovecho "  --disable-user-pie       do not build usermode emulation targets as PIE"
886af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
887af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
8882f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
889c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
8903142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
891ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
892ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
893e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
894dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
8955c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
8965c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
897758e8e38SVenkateswararao Jujjuri (JV)echo "  --disable-attr           disables attr and xattr support"
898758e8e38SVenkateswararao Jujjuri (JV)echo "  --enable-attr            enable attr and xattr support"
899e5d355d1Saliguoriecho "  --enable-io-thread       enable IO thread"
90077755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
901eac30262Saliguoriecho "  --kerneldir=PATH         look for kernel includes in PATH"
902d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
903d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
904d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
905d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
906*7e24e92aSStefan Hajnocziecho "  --trace-backend=B        Trace backend nop simple ust"
9079410b56cSPrerna Saxenaecho "  --trace-file=NAME        Full PATH,NAME of file to store traces"
9089410b56cSPrerna Saxenaecho "                           Default:trace-<pid>"
909af5db58eSpbrookecho ""
9105bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
911af5db58eSpbrookexit 1
912af5db58eSpbrookfi
913af5db58eSpbrook
914ec530c81Sbellard#
915ec530c81Sbellard# Solaris specific configure tool chain decisions
916ec530c81Sbellard#
917ec530c81Sbellardif test "$solaris" = "yes" ; then
9186792aa11SLoïc Minier  if has $install; then
9196792aa11SLoïc Minier    :
9206792aa11SLoïc Minier  else
921ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
922ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
923ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
924ec530c81Sbellard    exit 1
925ec530c81Sbellard  fi
9266792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
927ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
928ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
929ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
930ec530c81Sbellard    exit 1
931ec530c81Sbellard  fi
9326792aa11SLoïc Minier  if has ar; then
9336792aa11SLoïc Minier    :
9346792aa11SLoïc Minier  else
935ec530c81Sbellard    echo "Error: No path includes ar"
936ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
937ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
938ec530c81Sbellard    fi
939ec530c81Sbellard    exit 1
940ec530c81Sbellard  fi
941ec530c81Sbellardfi
942ec530c81Sbellard
943ec530c81Sbellard
9445327cf48Sbellardif test -z "$target_list" ; then
9455327cf48Sbellard# these targets are portable
9460a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
9472408a527Saurel32        target_list="\
9482408a527Saurel32i386-softmmu \
9492408a527Saurel32x86_64-softmmu \
9502408a527Saurel32arm-softmmu \
9512408a527Saurel32cris-softmmu \
9522408a527Saurel32m68k-softmmu \
95372b675caSEdgar E. Iglesiasmicroblaze-softmmu \
9542408a527Saurel32mips-softmmu \
9552408a527Saurel32mipsel-softmmu \
9562408a527Saurel32mips64-softmmu \
9572408a527Saurel32mips64el-softmmu \
9582408a527Saurel32ppc-softmmu \
9592408a527Saurel32ppcemb-softmmu \
9602408a527Saurel32ppc64-softmmu \
9612408a527Saurel32sh4-softmmu \
9622408a527Saurel32sh4eb-softmmu \
9632408a527Saurel32sparc-softmmu \
9641b64fcaeSIgor V. Kovalenkosparc64-softmmu \
9652408a527Saurel32"
9660a8e90f4Spbrook    fi
9675327cf48Sbellard# the following are Linux specific
968831b7825Sths    if [ "$linux_user" = "yes" ] ; then
9692408a527Saurel32        target_list="${target_list}\
9702408a527Saurel32i386-linux-user \
9712408a527Saurel32x86_64-linux-user \
9722408a527Saurel32alpha-linux-user \
9732408a527Saurel32arm-linux-user \
9742408a527Saurel32armeb-linux-user \
9752408a527Saurel32cris-linux-user \
9762408a527Saurel32m68k-linux-user \
97772b675caSEdgar E. Iglesiasmicroblaze-linux-user \
9782408a527Saurel32mips-linux-user \
9792408a527Saurel32mipsel-linux-user \
9802408a527Saurel32ppc-linux-user \
9812408a527Saurel32ppc64-linux-user \
9822408a527Saurel32ppc64abi32-linux-user \
9832408a527Saurel32sh4-linux-user \
9842408a527Saurel32sh4eb-linux-user \
9852408a527Saurel32sparc-linux-user \
9862408a527Saurel32sparc64-linux-user \
9872408a527Saurel32sparc32plus-linux-user \
9882408a527Saurel32"
989831b7825Sths    fi
990831b7825Sths# the following are Darwin specific
991831b7825Sths    if [ "$darwin_user" = "yes" ] ; then
9922408a527Saurel32        target_list="$target_list i386-darwin-user ppc-darwin-user "
9935327cf48Sbellard    fi
99484778508Sblueswir1# the following are BSD specific
99584778508Sblueswir1    if [ "$bsd_user" = "yes" ] ; then
99684778508Sblueswir1        target_list="${target_list}\
99731fc12dfSblueswir1i386-bsd-user \
99831fc12dfSblueswir1x86_64-bsd-user \
99931fc12dfSblueswir1sparc-bsd-user \
100084778508Sblueswir1sparc64-bsd-user \
100184778508Sblueswir1"
100284778508Sblueswir1    fi
10036e20a45fSbellardelse
1004b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
10055327cf48Sbellardfi
10060a8e90f4Spbrookif test -z "$target_list" ; then
10070a8e90f4Spbrook    echo "No targets enabled"
10080a8e90f4Spbrook    exit 1
10090a8e90f4Spbrookfi
1010f55fe278SPaolo Bonzini# see if system emulation was really requested
1011f55fe278SPaolo Bonzinicase " $target_list " in
1012f55fe278SPaolo Bonzini  *"-softmmu "*) softmmu=yes
1013f55fe278SPaolo Bonzini  ;;
1014f55fe278SPaolo Bonzini  *) softmmu=no
1015f55fe278SPaolo Bonzini  ;;
1016f55fe278SPaolo Bonziniesac
10175327cf48Sbellard
1018249247c9SJuan Quintelafeature_not_found() {
1019249247c9SJuan Quintela  feature=$1
1020249247c9SJuan Quintela
1021249247c9SJuan Quintela  echo "ERROR"
1022249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
10239332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
1024249247c9SJuan Quintela  echo "ERROR"
1025249247c9SJuan Quintela  exit 1;
1026249247c9SJuan Quintela}
1027249247c9SJuan Quintela
10287d13299dSbellardif test -z "$cross_prefix" ; then
10297d13299dSbellard
10307d13299dSbellard# ---
10317d13299dSbellard# big/little endian test
10327d13299dSbellardcat > $TMPC << EOF
10337d13299dSbellard#include <inttypes.h>
10347d13299dSbellardint main(int argc, char ** argv){
10357d13299dSbellard        volatile uint32_t i=0x01234567;
10367d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
10377d13299dSbellard}
10387d13299dSbellardEOF
10397d13299dSbellard
104052166aa0SJuan Quintelaif compile_prog "" "" ; then
10417d13299dSbellard$TMPE && bigendian="yes"
10427d13299dSbellardelse
10437d13299dSbellardecho big/little test failed
10447d13299dSbellardfi
10457d13299dSbellard
10467d13299dSbellardelse
10477d13299dSbellard
10487d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
1049ea8f20f8SJuan Quintelacase "$cpu" in
105024e804ecSAlexander Graf  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
1051ea8f20f8SJuan Quintela    bigendian=yes
1052ea8f20f8SJuan Quintela  ;;
1053ea8f20f8SJuan Quintelaesac
10547d13299dSbellard
10557d13299dSbellardfi
10567d13299dSbellard
1057b6853697Sbellard# host long bits test
1058b6853697Sbellardhostlongbits="32"
1059ea8f20f8SJuan Quintelacase "$cpu" in
106024e804ecSAlexander Graf  x86_64|alpha|ia64|sparc64|ppc64|s390x)
1061ea8f20f8SJuan Quintela    hostlongbits=64
1062ea8f20f8SJuan Quintela  ;;
1063ea8f20f8SJuan Quintelaesac
1064b6853697Sbellard
1065b0a47e79SJuan Quintela
1066b0a47e79SJuan Quintela##########################################
1067b0a47e79SJuan Quintela# NPTL probe
1068b0a47e79SJuan Quintela
1069b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
1070bd0c5661Spbrook  cat > $TMPC <<EOF
1071bd0c5661Spbrook#include <sched.h>
107230813ceaSpbrook#include <linux/futex.h>
1073bd0c5661Spbrookvoid foo()
1074bd0c5661Spbrook{
1075bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
1076bd0c5661Spbrook#error bork
1077bd0c5661Spbrook#endif
1078bd0c5661Spbrook}
1079bd0c5661SpbrookEOF
1080bd0c5661Spbrook
108152166aa0SJuan Quintela  if compile_object ; then
1082b0a47e79SJuan Quintela    nptl=yes
1083bd0c5661Spbrook  else
1084b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
1085b0a47e79SJuan Quintela      feature_not_found "nptl"
1086b0a47e79SJuan Quintela    fi
1087b0a47e79SJuan Quintela    nptl=no
1088b0a47e79SJuan Quintela  fi
1089bd0c5661Spbrookfi
1090bd0c5661Spbrook
109111d9f695Sbellard##########################################
1092ac62922eSbalrog# zlib check
1093ac62922eSbalrog
1094ac62922eSbalrogcat > $TMPC << EOF
1095ac62922eSbalrog#include <zlib.h>
1096ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1097ac62922eSbalrogEOF
109852166aa0SJuan Quintelaif compile_prog "" "-lz" ; then
1099ac62922eSbalrog    :
1100ac62922eSbalrogelse
1101ac62922eSbalrog    echo
1102ac62922eSbalrog    echo "Error: zlib check failed"
1103ac62922eSbalrog    echo "Make sure to have the zlib libs and headers installed."
1104ac62922eSbalrog    echo
1105ac62922eSbalrog    exit 1
1106ac62922eSbalrogfi
1107ac62922eSbalrog
1108ac62922eSbalrog##########################################
1109e37630caSaliguori# xen probe
1110e37630caSaliguori
1111fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1112b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1113e37630caSaliguori  cat > $TMPC <<EOF
1114e37630caSaliguori#include <xenctrl.h>
1115e37630caSaliguori#include <xs.h>
1116df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1117e37630caSaliguoriEOF
111852166aa0SJuan Quintela  if compile_prog "" "$xen_libs" ; then
1119fc321b4bSJuan Quintela    xen=yes
11203efd632bSJuan Quintela    libs_softmmu="$xen_libs $libs_softmmu"
1121e37630caSaliguori  else
1122fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
1123fc321b4bSJuan Quintela      feature_not_found "xen"
1124fc321b4bSJuan Quintela    fi
1125fc321b4bSJuan Quintela    xen=no
1126e37630caSaliguori  fi
1127e37630caSaliguorifi
1128e37630caSaliguori
1129e37630caSaliguori##########################################
1130f91672e5SPaolo Bonzini# pkgconfig probe
1131f91672e5SPaolo Bonzini
1132f91672e5SPaolo Bonzinipkgconfig="${cross_prefix}pkg-config"
11330dba6195SLoïc Minierif ! has $pkgconfig; then
1134f91672e5SPaolo Bonzini  # likely not cross compiling, or hope for the best
1135f91672e5SPaolo Bonzini  pkgconfig=pkg-config
1136f91672e5SPaolo Bonzinifi
1137f91672e5SPaolo Bonzini
1138f91672e5SPaolo Bonzini##########################################
1139dfffc653SJuan Quintela# Sparse probe
1140dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
11410dba6195SLoïc Minier  if has cgcc; then
1142dfffc653SJuan Quintela    sparse=yes
1143dfffc653SJuan Quintela  else
1144dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1145dfffc653SJuan Quintela      feature_not_found "sparse"
1146dfffc653SJuan Quintela    fi
1147dfffc653SJuan Quintela    sparse=no
1148dfffc653SJuan Quintela  fi
1149dfffc653SJuan Quintelafi
1150dfffc653SJuan Quintela
1151dfffc653SJuan Quintela##########################################
115211d9f695Sbellard# SDL probe
115311d9f695Sbellard
1154fec0e3e8SStefan Weil# Look for sdl configuration program (pkg-config or sdl-config).
1155fec0e3e8SStefan Weil# Prefer variant with cross prefix if cross compiling,
1156fec0e3e8SStefan Weil# and favour pkg-config with sdl over sdl-config.
1157fec0e3e8SStefan Weilif test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1158fec0e3e8SStefan Weil     $pkgconfig sdl --modversion >/dev/null 2>&1; then
1159fec0e3e8SStefan Weil  sdlconfig="$pkgconfig sdl"
1160fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1161fec0e3e8SStefan Weilelif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1162fec0e3e8SStefan Weil  sdlconfig="${cross_prefix}sdl-config"
1163fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1164fec0e3e8SStefan Weilelif $pkgconfig sdl --modversion >/dev/null 2>&1; then
11659316f803SPaolo Bonzini  sdlconfig="$pkgconfig sdl"
11669316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
11670dba6195SLoïc Minierelif has sdl-config; then
11689316f803SPaolo Bonzini  sdlconfig='sdl-config'
11699316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1170a0dfd8a4SLoïc Minierelse
1171a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1172a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1173a0dfd8a4SLoïc Minier  fi
1174a0dfd8a4SLoïc Minier  sdl=no
11759316f803SPaolo Bonzinifi
117611d9f695Sbellard
11779316f803SPaolo Bonzinisdl_too_old=no
1178c4198157SJuan Quintelaif test "$sdl" != "no" ; then
117911d9f695Sbellard  cat > $TMPC << EOF
118011d9f695Sbellard#include <SDL.h>
118111d9f695Sbellard#undef main /* We don't want SDL to override our main() */
118211d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
118311d9f695SbellardEOF
11849316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
118574f42e18STeLeMan  if test "$static" = "yes" ; then
118674f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
118774f42e18STeLeMan  else
11889316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
118974f42e18STeLeMan  fi
119052166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
119111d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
119211d9f695Sbellard      sdl_too_old=yes
119311d9f695Sbellard    else
1194fd677642Sths      if test "$cocoa" = "no" ; then
119511d9f695Sbellard        sdl=yes
119611d9f695Sbellard      fi
1197fd677642Sths    fi
11987c1f25b4Sbellard
119967c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
12001ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
120167c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1202f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1203f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
120411d9f695Sbellard      fi
120552166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
12061ac88f28SJuan Quintela	:
12071ac88f28SJuan Quintela      else
12081ac88f28SJuan Quintela        sdl=no
12097c1f25b4Sbellard      fi
12107c1f25b4Sbellard    fi # static link
1211c4198157SJuan Quintela  else # sdl not found
1212c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1213c4198157SJuan Quintela      feature_not_found "sdl"
1214c4198157SJuan Quintela    fi
1215c4198157SJuan Quintela    sdl=no
12167c1f25b4Sbellard  fi # sdl compile test
1217fd677642Sthsfi
121811d9f695Sbellard
12195368a422Saliguoriif test "$sdl" = "yes" ; then
12205368a422Saliguori  cat > $TMPC <<EOF
12215368a422Saliguori#include <SDL.h>
12225368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
12235368a422Saliguori#include <X11/XKBlib.h>
12245368a422Saliguori#else
12255368a422Saliguori#error No x11 support
12265368a422Saliguori#endif
12275368a422Saliguoriint main(void) { return 0; }
12285368a422SaliguoriEOF
122952166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1230681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
12315368a422Saliguori  fi
123207d9ac44SJuan Quintela  if test "$mingw32" = "yes" ; then
123307d9ac44SJuan Quintela    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
123407d9ac44SJuan Quintela  fi
12350705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
12365368a422Saliguorifi
12375368a422Saliguori
12388f28f3fbSths##########################################
12398d5d2d4cSths# VNC TLS detection
12401be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then
1241ae6b5e5aSaliguori  cat > $TMPC <<EOF
1242ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1243ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1244ae6b5e5aSaliguoriEOF
1245f91672e5SPaolo Bonzini  vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1246f91672e5SPaolo Bonzini  vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
124752166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
12481be10ad2SJuan Quintela    vnc_tls=yes
1249a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1250ae6b5e5aSaliguori  else
12511be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
12521be10ad2SJuan Quintela      feature_not_found "vnc-tls"
12531be10ad2SJuan Quintela    fi
12541be10ad2SJuan Quintela    vnc_tls=no
12558d5d2d4cSths  fi
12568d5d2d4cSthsfi
12578d5d2d4cSths
12588d5d2d4cSths##########################################
12592f9606b3Saliguori# VNC SASL detection
12603aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then
12612f9606b3Saliguori  cat > $TMPC <<EOF
12622f9606b3Saliguori#include <sasl/sasl.h>
12632f9606b3Saliguori#include <stdio.h>
12642f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
12652f9606b3SaliguoriEOF
12662f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
12672f9606b3Saliguori  vnc_sasl_cflags=""
12682f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
126952166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1270ea784e3bSJuan Quintela    vnc_sasl=yes
1271fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
12722f9606b3Saliguori  else
1273ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1274ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1275ea784e3bSJuan Quintela    fi
1276ea784e3bSJuan Quintela    vnc_sasl=no
12772f9606b3Saliguori  fi
12782f9606b3Saliguorifi
12792f9606b3Saliguori
12802f9606b3Saliguori##########################################
12812f6f5c7aSCorentin Chary# VNC JPEG detection
128296763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then
12832f6f5c7aSCorentin Charycat > $TMPC <<EOF
12842f6f5c7aSCorentin Chary#include <stdio.h>
12852f6f5c7aSCorentin Chary#include <jpeglib.h>
12862f6f5c7aSCorentin Charyint main(void) { struct jpeg_compress_struct s; jpeg_create_compress(&s); return 0; }
12872f6f5c7aSCorentin CharyEOF
12882f6f5c7aSCorentin Chary    vnc_jpeg_cflags=""
12892f6f5c7aSCorentin Chary    vnc_jpeg_libs="-ljpeg"
12902f6f5c7aSCorentin Chary  if compile_prog "$vnc_jpeg_cflags" "$vnc_jpeg_libs" ; then
12912f6f5c7aSCorentin Chary    vnc_jpeg=yes
12922f6f5c7aSCorentin Chary    libs_softmmu="$vnc_jpeg_libs $libs_softmmu"
12932f6f5c7aSCorentin Chary  else
12942f6f5c7aSCorentin Chary    if test "$vnc_jpeg" = "yes" ; then
12952f6f5c7aSCorentin Chary      feature_not_found "vnc-jpeg"
12962f6f5c7aSCorentin Chary    fi
12972f6f5c7aSCorentin Chary    vnc_jpeg=no
12982f6f5c7aSCorentin Chary  fi
12992f6f5c7aSCorentin Charyfi
13002f6f5c7aSCorentin Chary
13012f6f5c7aSCorentin Chary##########################################
1302efe556adSCorentin Chary# VNC PNG detection
130396763cf9SCorentin Charyif test "$vnc_png" != "no" ; then
1304efe556adSCorentin Charycat > $TMPC <<EOF
1305efe556adSCorentin Chary//#include <stdio.h>
1306efe556adSCorentin Chary#include <png.h>
1307efe556adSCorentin Charyint main(void) {
1308efe556adSCorentin Chary    png_structp png_ptr;
1309efe556adSCorentin Chary    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
1310efe556adSCorentin Chary    return 0;
1311efe556adSCorentin Chary}
1312efe556adSCorentin CharyEOF
1313efe556adSCorentin Chary    vnc_png_cflags=""
1314efe556adSCorentin Chary    vnc_png_libs="-lpng"
1315efe556adSCorentin Chary  if compile_prog "$vnc_png_cflags" "$vnc_png_libs" ; then
1316efe556adSCorentin Chary    vnc_png=yes
1317efe556adSCorentin Chary    libs_softmmu="$vnc_png_libs $libs_softmmu"
1318efe556adSCorentin Chary  else
1319efe556adSCorentin Chary    if test "$vnc_png" = "yes" ; then
1320efe556adSCorentin Chary      feature_not_found "vnc-png"
1321efe556adSCorentin Chary    fi
1322efe556adSCorentin Chary    vnc_png=no
1323efe556adSCorentin Chary  fi
1324efe556adSCorentin Charyfi
1325efe556adSCorentin Chary
1326efe556adSCorentin Chary##########################################
132776655d6dSaliguori# fnmatch() probe, used for ACL routines
132876655d6dSaliguorifnmatch="no"
132976655d6dSaliguoricat > $TMPC << EOF
133076655d6dSaliguori#include <fnmatch.h>
133176655d6dSaliguoriint main(void)
133276655d6dSaliguori{
133376655d6dSaliguori    fnmatch("foo", "foo", 0);
133476655d6dSaliguori    return 0;
133576655d6dSaliguori}
133676655d6dSaliguoriEOF
133752166aa0SJuan Quintelaif compile_prog "" "" ; then
133876655d6dSaliguori   fnmatch="yes"
133976655d6dSaliguorifi
134076655d6dSaliguori
134176655d6dSaliguori##########################################
1342ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1343ee682d27SStefan Weilif test "$uuid" != "no" ; then
1344ee682d27SStefan Weil  uuid_libs="-luuid"
1345ee682d27SStefan Weil  cat > $TMPC << EOF
1346ee682d27SStefan Weil#include <uuid/uuid.h>
1347ee682d27SStefan Weilint main(void)
1348ee682d27SStefan Weil{
1349ee682d27SStefan Weil    uuid_t my_uuid;
1350ee682d27SStefan Weil    uuid_generate(my_uuid);
1351ee682d27SStefan Weil    return 0;
1352ee682d27SStefan Weil}
1353ee682d27SStefan WeilEOF
1354ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1355ee682d27SStefan Weil    uuid="yes"
1356ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1357ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1358ee682d27SStefan Weil  else
1359ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1360ee682d27SStefan Weil      feature_not_found "uuid"
1361ee682d27SStefan Weil    fi
1362ee682d27SStefan Weil    uuid=no
1363ee682d27SStefan Weil  fi
1364ee682d27SStefan Weilfi
1365ee682d27SStefan Weil
1366ee682d27SStefan Weil##########################################
13678a16d273Sths# vde libraries probe
1368dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
13694baae0acSJuan Quintela  vde_libs="-lvdeplug"
13708a16d273Sths  cat > $TMPC << EOF
13718a16d273Sths#include <libvdeplug.h>
13724a7f0e06Spbrookint main(void)
13734a7f0e06Spbrook{
13744a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
13754a7f0e06Spbrook    vde_open("", "", &a);
13764a7f0e06Spbrook    return 0;
13774a7f0e06Spbrook}
13788a16d273SthsEOF
137952166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
13804baae0acSJuan Quintela    vde=yes
13818e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
13828e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1383dfb278bdSJuan Quintela  else
1384dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1385dfb278bdSJuan Quintela      feature_not_found "vde"
1386dfb278bdSJuan Quintela    fi
1387dfb278bdSJuan Quintela    vde=no
13888a16d273Sths  fi
13898a16d273Sthsfi
13908a16d273Sths
13918a16d273Sths##########################################
1392c2de5c91Smalc# Sound support libraries probe
13938f28f3fbSths
1394c2de5c91Smalcaudio_drv_probe()
1395c2de5c91Smalc{
1396c2de5c91Smalc    drv=$1
1397c2de5c91Smalc    hdr=$2
1398c2de5c91Smalc    lib=$3
1399c2de5c91Smalc    exp=$4
1400c2de5c91Smalc    cfl=$5
14018f28f3fbSths        cat > $TMPC << EOF
1402c2de5c91Smalc#include <$hdr>
1403c2de5c91Smalcint main(void) { $exp }
14048f28f3fbSthsEOF
140552166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
14068f28f3fbSths        :
14078f28f3fbSths    else
14088f28f3fbSths        echo
1409c2de5c91Smalc        echo "Error: $drv check failed"
1410c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
14118f28f3fbSths        echo
14128f28f3fbSths        exit 1
14138f28f3fbSths    fi
1414c2de5c91Smalc}
1415c2de5c91Smalc
14162fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1417c2de5c91Smalcfor drv in $audio_drv_list; do
1418c2de5c91Smalc    case $drv in
1419c2de5c91Smalc    alsa)
1420c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1421c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1422a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1423c2de5c91Smalc    ;;
1424c2de5c91Smalc
1425c2de5c91Smalc    fmod)
1426c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1427c2de5c91Smalc        echo
1428c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1429c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1430c2de5c91Smalc        echo
1431c2de5c91Smalc        exit 1
14328f28f3fbSths    fi
1433c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1434a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1435c2de5c91Smalc    ;;
1436c2de5c91Smalc
1437c2de5c91Smalc    esd)
1438c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1439a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
144067f86e8eSJuan Quintela    audio_pt_int="yes"
1441c2de5c91Smalc    ;;
1442b8e59f18Smalc
1443b8e59f18Smalc    pa)
1444493abda6SAurelien Jarno    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1445b8e59f18Smalc        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1446493abda6SAurelien Jarno    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
144767f86e8eSJuan Quintela    audio_pt_int="yes"
1448b8e59f18Smalc    ;;
1449b8e59f18Smalc
1450997e690aSJuan Quintela    coreaudio)
1451997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1452997e690aSJuan Quintela    ;;
1453997e690aSJuan Quintela
1454a4bf6780SJuan Quintela    dsound)
1455a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1456d5631638Smalc      audio_win_int="yes"
1457a4bf6780SJuan Quintela    ;;
1458a4bf6780SJuan Quintela
1459a4bf6780SJuan Quintela    oss)
1460a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1461a4bf6780SJuan Quintela    ;;
1462a4bf6780SJuan Quintela
1463a4bf6780SJuan Quintela    sdl|wav)
14642f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
14652f6a1ab0Sblueswir1    ;;
14662f6a1ab0Sblueswir1
1467d5631638Smalc    winwave)
1468d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1469d5631638Smalc      audio_win_int="yes"
1470d5631638Smalc    ;;
1471d5631638Smalc
1472e4c63a6aSmalc    *)
14731c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1474e4c63a6aSmalc        echo
1475e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1476e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1477e4c63a6aSmalc        echo
1478e4c63a6aSmalc        exit 1
1479e4c63a6aSmalc    }
1480e4c63a6aSmalc    ;;
1481c2de5c91Smalc    esac
1482c2de5c91Smalcdone
14838f28f3fbSths
14844d3b6f6eSbalrog##########################################
14852e4d9fb1Saurel32# BrlAPI probe
14862e4d9fb1Saurel32
14874ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1488eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
14892e4d9fb1Saurel32  cat > $TMPC << EOF
14902e4d9fb1Saurel32#include <brlapi.h>
14912e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
14922e4d9fb1Saurel32EOF
149352166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
14942e4d9fb1Saurel32    brlapi=yes
1495264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
14964ffcedb6SJuan Quintela  else
14974ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
14984ffcedb6SJuan Quintela      feature_not_found "brlapi"
14994ffcedb6SJuan Quintela    fi
15004ffcedb6SJuan Quintela    brlapi=no
1501eb82284fSJuan Quintela  fi
1502eb82284fSJuan Quintelafi
15032e4d9fb1Saurel32
15042e4d9fb1Saurel32##########################################
15054d3b6f6eSbalrog# curses probe
15064f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses"
15074d3b6f6eSbalrog
1508c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1509c584a6d0SJuan Quintela  curses_found=no
15104d3b6f6eSbalrog  cat > $TMPC << EOF
15114d3b6f6eSbalrog#include <curses.h>
15125a8ff3aaSblueswir1#ifdef __OpenBSD__
15135a8ff3aaSblueswir1#define resize_term resizeterm
15145a8ff3aaSblueswir1#endif
15155a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); }
15164d3b6f6eSbalrogEOF
15174f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
15184f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1519c584a6d0SJuan Quintela      curses_found=yes
15204f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
15214f78ef9aSJuan Quintela      break
15224d3b6f6eSbalrog    fi
15234f78ef9aSJuan Quintela  done
1524c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1525c584a6d0SJuan Quintela    curses=yes
1526c584a6d0SJuan Quintela  else
1527c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1528c584a6d0SJuan Quintela      feature_not_found "curses"
1529c584a6d0SJuan Quintela    fi
1530c584a6d0SJuan Quintela    curses=no
1531c584a6d0SJuan Quintela  fi
15324f78ef9aSJuan Quintelafi
15334d3b6f6eSbalrog
1534414f0dabSblueswir1##########################################
1535769ce76dSAlexander Graf# curl probe
1536769ce76dSAlexander Graf
15374e2b0658SPaolo Bonziniif $pkgconfig libcurl --modversion >/dev/null 2>&1; then
15384e2b0658SPaolo Bonzini  curlconfig="$pkgconfig libcurl"
15394e2b0658SPaolo Bonzinielse
15404e2b0658SPaolo Bonzini  curlconfig=curl-config
15414e2b0658SPaolo Bonzinifi
15424e2b0658SPaolo Bonzini
1543788c8196SJuan Quintelaif test "$curl" != "no" ; then
1544769ce76dSAlexander Graf  cat > $TMPC << EOF
1545769ce76dSAlexander Graf#include <curl/curl.h>
1546769ce76dSAlexander Grafint main(void) { return curl_easy_init(); }
1547769ce76dSAlexander GrafEOF
15484e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
15494e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
1550b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
1551769ce76dSAlexander Graf    curl=yes
1552f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
1553f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
1554788c8196SJuan Quintela  else
1555788c8196SJuan Quintela    if test "$curl" = "yes" ; then
1556788c8196SJuan Quintela      feature_not_found "curl"
1557788c8196SJuan Quintela    fi
1558788c8196SJuan Quintela    curl=no
1559769ce76dSAlexander Graf  fi
1560769ce76dSAlexander Graffi # test "$curl"
1561769ce76dSAlexander Graf
1562769ce76dSAlexander Graf##########################################
15635495ed11SLuiz Capitulino# check framework probe
15645495ed11SLuiz Capitulino
15655495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then
15665495ed11SLuiz Capitulino  cat > $TMPC << EOF
15675495ed11SLuiz Capitulino#include <check.h>
15685495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; }
15695495ed11SLuiz CapitulinoEOF
1570f91672e5SPaolo Bonzini  check_libs=`$pkgconfig --libs check`
15715495ed11SLuiz Capitulino  if compile_prog "" $check_libs ; then
15725495ed11SLuiz Capitulino    check_utests=yes
15735495ed11SLuiz Capitulino    libs_tools="$check_libs $libs_tools"
15745495ed11SLuiz Capitulino  else
15755495ed11SLuiz Capitulino    if test "$check_utests" = "yes" ; then
15765495ed11SLuiz Capitulino      feature_not_found "check"
15775495ed11SLuiz Capitulino    fi
15785495ed11SLuiz Capitulino    check_utests=no
15795495ed11SLuiz Capitulino  fi
15805495ed11SLuiz Capitulinofi # test "$check_utests"
15815495ed11SLuiz Capitulino
15825495ed11SLuiz Capitulino##########################################
1583fb599c9aSbalrog# bluez support probe
1584a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
1585e820e3f4Sbalrog  cat > $TMPC << EOF
1586e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
1587e820e3f4Sbalrogint main(void) { return bt_error(0); }
1588e820e3f4SbalrogEOF
1589f91672e5SPaolo Bonzini  bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1590f91672e5SPaolo Bonzini  bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
159152166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1592a20a6f46SJuan Quintela    bluez=yes
1593e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
1594e820e3f4Sbalrog  else
1595a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
1596a20a6f46SJuan Quintela      feature_not_found "bluez"
1597a20a6f46SJuan Quintela    fi
1598e820e3f4Sbalrog    bluez="no"
1599e820e3f4Sbalrog  fi
1600fb599c9aSbalrogfi
1601fb599c9aSbalrog
1602fb599c9aSbalrog##########################################
16037ba1e619Saliguori# kvm probe
1604b31a0277SJuan Quintelaif test "$kvm" != "no" ; then
16057ba1e619Saliguori    cat > $TMPC <<EOF
16067ba1e619Saliguori#include <linux/kvm.h>
16079fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
16087ba1e619Saliguori#error Invalid KVM version
16097ba1e619Saliguori#endif
16109fd8d8d7Saliguori#if !defined(KVM_CAP_USER_MEMORY)
16119fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_USER_MEMORY
16129fd8d8d7Saliguori#endif
16139fd8d8d7Saliguori#if !defined(KVM_CAP_SET_TSS_ADDR)
16149fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
16159fd8d8d7Saliguori#endif
16169fd8d8d7Saliguori#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
16179fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
16189fd8d8d7Saliguori#endif
16197ba1e619Saliguoriint main(void) { return 0; }
16207ba1e619SaliguoriEOF
1621eac30262Saliguori  if test "$kerneldir" != "" ; then
1622eac30262Saliguori      kvm_cflags=-I"$kerneldir"/include
16238444eb6eSaliguori      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
16248444eb6eSaliguori         -a -d "$kerneldir/arch/x86/include" ; then
16258444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1626406b430dSaliguori	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1627406b430dSaliguori	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
16280e60a699SAlexander Graf	elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
16290e60a699SAlexander Graf	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
16308444eb6eSaliguori        elif test -d "$kerneldir/arch/$cpu/include" ; then
16318444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
16328444eb6eSaliguori      fi
1633eac30262Saliguori  else
1634f038e8f7SStefan Weil    kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
1635eac30262Saliguori  fi
163652166aa0SJuan Quintela  if compile_prog "$kvm_cflags" "" ; then
1637b31a0277SJuan Quintela    kvm=yes
1638dae5079aSJan Kiszka    cat > $TMPC <<EOF
1639dae5079aSJan Kiszka#include <linux/kvm_para.h>
1640dae5079aSJan Kiszkaint main(void) { return 0; }
1641dae5079aSJan KiszkaEOF
1642dae5079aSJan Kiszka    if compile_prog "$kvm_cflags" "" ; then
1643dae5079aSJan Kiszka      kvm_para=yes
1644dae5079aSJan Kiszka    fi
16457ba1e619Saliguori  else
1646b31a0277SJuan Quintela    if test "$kvm" = "yes" ; then
16470dba6195SLoïc Minier      if has awk && has grep; then
1648a558ee17SJuan Quintela        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
16499fd8d8d7Saliguori	| grep "error: " \
16509fd8d8d7Saliguori	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
16519fd8d8d7Saliguori        if test "$kvmerr" != "" ; then
1652b31a0277SJuan Quintela          echo -e "${kvmerr}\n\
1653168ccc11SJan Kiszka      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1654168ccc11SJan Kiszka  recent kvm-kmod from http://sourceforge.net/projects/kvm."
16559fd8d8d7Saliguori        fi
16569fd8d8d7Saliguori      fi
1657b31a0277SJuan Quintela      feature_not_found "kvm"
1658b31a0277SJuan Quintela    fi
1659b31a0277SJuan Quintela    kvm=no
16607ba1e619Saliguori  fi
16617ba1e619Saliguorifi
16627ba1e619Saliguori
16637ba1e619Saliguori##########################################
1664d5970055SMichael S. Tsirkin# test for vhost net
1665d5970055SMichael S. Tsirkin
1666d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then
1667d5970055SMichael S. Tsirkin    if test "$kvm" != "no"; then
1668d5970055SMichael S. Tsirkin            cat > $TMPC <<EOF
1669d5970055SMichael S. Tsirkin    #include <linux/vhost.h>
1670d5970055SMichael S. Tsirkin    int main(void) { return 0; }
1671d5970055SMichael S. TsirkinEOF
1672d5970055SMichael S. Tsirkin            if compile_prog "$kvm_cflags" "" ; then
1673d5970055SMichael S. Tsirkin                vhost_net=yes
1674d5970055SMichael S. Tsirkin            else
1675d5970055SMichael S. Tsirkin                if test "$vhost_net" = "yes" ; then
1676d5970055SMichael S. Tsirkin                    feature_not_found "vhost-net"
1677d5970055SMichael S. Tsirkin                fi
1678d5970055SMichael S. Tsirkin                vhost_net=no
1679d5970055SMichael S. Tsirkin            fi
1680d5970055SMichael S. Tsirkin    else
1681d5970055SMichael S. Tsirkin            if test "$vhost_net" = "yes" ; then
16824021d247SAurelien Jarno                echo "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1683d5970055SMichael S. Tsirkin                feature_not_found "vhost-net"
1684d5970055SMichael S. Tsirkin            fi
1685d5970055SMichael S. Tsirkin            vhost_net=no
1686d5970055SMichael S. Tsirkin    fi
1687d5970055SMichael S. Tsirkinfi
1688d5970055SMichael S. Tsirkin
1689d5970055SMichael S. Tsirkin##########################################
1690e5d355d1Saliguori# pthread probe
1691de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2"
16923c529d93Saliguori
1693e5d355d1Saliguoripthread=no
1694414f0dabSblueswir1cat > $TMPC << EOF
16953c529d93Saliguori#include <pthread.h>
1696de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; }
1697414f0dabSblueswir1EOF
1698de65fe0fSSebastian Herbsztfor pthread_lib in $PTHREADLIBS_LIST; do
169952166aa0SJuan Quintela  if compile_prog "" "$pthread_lib" ; then
1700e5d355d1Saliguori    pthread=yes
17015572b539SJuan Quintela    LIBS="$pthread_lib $LIBS"
1702de65fe0fSSebastian Herbszt    break
1703414f0dabSblueswir1  fi
1704de65fe0fSSebastian Herbsztdone
1705414f0dabSblueswir1
17064617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
17074dd75c70SChristoph Hellwig  echo
17084dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
17094dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
17104dd75c70SChristoph Hellwig  echo
17114dd75c70SChristoph Hellwig  exit 1
1712e5d355d1Saliguorifi
1713e5d355d1Saliguori
1714bf9298b9Saliguori##########################################
17155c6c3a6cSChristoph Hellwig# linux-aio probe
17165c6c3a6cSChristoph Hellwig
17175c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
17185c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
17195c6c3a6cSChristoph Hellwig#include <libaio.h>
17205c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
17215c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
17225c6c3a6cSChristoph HellwigEOF
17235c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
17245c6c3a6cSChristoph Hellwig    linux_aio=yes
1725048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
1726048d179fSPaul Brook    libs_tools="$libs_tools -laio"
17275c6c3a6cSChristoph Hellwig  else
17285c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
17295c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
17305c6c3a6cSChristoph Hellwig    fi
17313cfcae3cSLuiz Capitulino    linux_aio=no
17325c6c3a6cSChristoph Hellwig  fi
17335c6c3a6cSChristoph Hellwigfi
17345c6c3a6cSChristoph Hellwig
17355c6c3a6cSChristoph Hellwig##########################################
1736758e8e38SVenkateswararao Jujjuri (JV)# attr probe
1737758e8e38SVenkateswararao Jujjuri (JV)
1738758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" != "no" ; then
1739758e8e38SVenkateswararao Jujjuri (JV)  cat > $TMPC <<EOF
1740758e8e38SVenkateswararao Jujjuri (JV)#include <stdio.h>
1741758e8e38SVenkateswararao Jujjuri (JV)#include <sys/types.h>
1742758e8e38SVenkateswararao Jujjuri (JV)#include <attr/xattr.h>
1743758e8e38SVenkateswararao Jujjuri (JV)int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
1744758e8e38SVenkateswararao Jujjuri (JV)EOF
1745758e8e38SVenkateswararao Jujjuri (JV)  if compile_prog "" "-lattr" ; then
1746758e8e38SVenkateswararao Jujjuri (JV)    attr=yes
1747758e8e38SVenkateswararao Jujjuri (JV)    LIBS="-lattr $LIBS"
1748758e8e38SVenkateswararao Jujjuri (JV)  else
1749758e8e38SVenkateswararao Jujjuri (JV)    if test "$attr" = "yes" ; then
1750758e8e38SVenkateswararao Jujjuri (JV)      feature_not_found "ATTR"
1751758e8e38SVenkateswararao Jujjuri (JV)    fi
1752758e8e38SVenkateswararao Jujjuri (JV)    attr=no
1753758e8e38SVenkateswararao Jujjuri (JV)  fi
1754758e8e38SVenkateswararao Jujjuri (JV)fi
1755758e8e38SVenkateswararao Jujjuri (JV)
1756758e8e38SVenkateswararao Jujjuri (JV)##########################################
1757bf9298b9Saliguori# iovec probe
1758bf9298b9Saliguoricat > $TMPC <<EOF
1759db34f0b3Sblueswir1#include <sys/types.h>
1760bf9298b9Saliguori#include <sys/uio.h>
1761db34f0b3Sblueswir1#include <unistd.h>
1762bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; }
1763bf9298b9SaliguoriEOF
1764bf9298b9Saliguoriiovec=no
176552166aa0SJuan Quintelaif compile_prog "" "" ; then
1766bf9298b9Saliguori  iovec=yes
1767bf9298b9Saliguorifi
1768bf9298b9Saliguori
1769f652e6afSaurel32##########################################
1770ceb42de8Saliguori# preadv probe
1771ceb42de8Saliguoricat > $TMPC <<EOF
1772ceb42de8Saliguori#include <sys/types.h>
1773ceb42de8Saliguori#include <sys/uio.h>
1774ceb42de8Saliguori#include <unistd.h>
1775ceb42de8Saliguoriint main(void) { preadv; }
1776ceb42de8SaliguoriEOF
1777ceb42de8Saliguoripreadv=no
177852166aa0SJuan Quintelaif compile_prog "" "" ; then
1779ceb42de8Saliguori  preadv=yes
1780ceb42de8Saliguorifi
1781ceb42de8Saliguori
1782ceb42de8Saliguori##########################################
1783f652e6afSaurel32# fdt probe
17842df87df7SJuan Quintelaif test "$fdt" != "no" ; then
1785b41af4baSJuan Quintela  fdt_libs="-lfdt"
1786f652e6afSaurel32  cat > $TMPC << EOF
1787f652e6afSaurel32int main(void) { return 0; }
1788f652e6afSaurel32EOF
178952166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
1790f652e6afSaurel32    fdt=yes
1791e4782985SJuan Quintela    libs_softmmu="$fdt_libs $libs_softmmu"
17922df87df7SJuan Quintela  else
17932df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
17942df87df7SJuan Quintela      feature_not_found "fdt"
17952df87df7SJuan Quintela    fi
17962df87df7SJuan Quintela    fdt=no
1797f652e6afSaurel32  fi
1798f652e6afSaurel32fi
1799f652e6afSaurel32
18003b3f24adSaurel32#
18013b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
18023b3f24adSaurel32# emulator.  This is done because older glibc versions don't
18033b3f24adSaurel32# have syscall stubs for these implemented.
18043b3f24adSaurel32#
18053b3f24adSaurel32atfile=no
18063b3f24adSaurel32cat > $TMPC << EOF
18073b3f24adSaurel32#define _ATFILE_SOURCE
18083b3f24adSaurel32#include <sys/types.h>
18093b3f24adSaurel32#include <fcntl.h>
18103b3f24adSaurel32#include <unistd.h>
18113b3f24adSaurel32
18123b3f24adSaurel32int
18133b3f24adSaurel32main(void)
18143b3f24adSaurel32{
18153b3f24adSaurel32	/* try to unlink nonexisting file */
18163b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
18173b3f24adSaurel32}
18183b3f24adSaurel32EOF
181952166aa0SJuan Quintelaif compile_prog "" "" ; then
18203b3f24adSaurel32  atfile=yes
18213b3f24adSaurel32fi
18223b3f24adSaurel32
182339386ac7Saurel32# Check for inotify functions when we are building linux-user
18243b3f24adSaurel32# emulator.  This is done because older glibc versions don't
18253b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
18263b3f24adSaurel32# don't provide them even if kernel supports them.
18273b3f24adSaurel32#
18283b3f24adSaurel32inotify=no
18293b3f24adSaurel32cat > $TMPC << EOF
18303b3f24adSaurel32#include <sys/inotify.h>
18313b3f24adSaurel32
18323b3f24adSaurel32int
18333b3f24adSaurel32main(void)
18343b3f24adSaurel32{
18353b3f24adSaurel32	/* try to start inotify */
18368690e420Saurel32	return inotify_init();
18373b3f24adSaurel32}
18383b3f24adSaurel32EOF
183952166aa0SJuan Quintelaif compile_prog "" "" ; then
18403b3f24adSaurel32  inotify=yes
18413b3f24adSaurel32fi
18423b3f24adSaurel32
1843c05c7a73SRiku Voipioinotify1=no
1844c05c7a73SRiku Voipiocat > $TMPC << EOF
1845c05c7a73SRiku Voipio#include <sys/inotify.h>
1846c05c7a73SRiku Voipio
1847c05c7a73SRiku Voipioint
1848c05c7a73SRiku Voipiomain(void)
1849c05c7a73SRiku Voipio{
1850c05c7a73SRiku Voipio    /* try to start inotify */
1851c05c7a73SRiku Voipio    return inotify_init1(0);
1852c05c7a73SRiku Voipio}
1853c05c7a73SRiku VoipioEOF
1854c05c7a73SRiku Voipioif compile_prog "" "" ; then
1855c05c7a73SRiku Voipio  inotify1=yes
1856c05c7a73SRiku Voipiofi
1857c05c7a73SRiku Voipio
1858ebc996f3SRiku Voipio# check if utimensat and futimens are supported
1859ebc996f3SRiku Voipioutimens=no
1860ebc996f3SRiku Voipiocat > $TMPC << EOF
1861ebc996f3SRiku Voipio#define _ATFILE_SOURCE
1862ebc996f3SRiku Voipio#define _GNU_SOURCE
1863ebc996f3SRiku Voipio#include <stddef.h>
1864ebc996f3SRiku Voipio#include <fcntl.h>
1865ebc996f3SRiku Voipio
1866ebc996f3SRiku Voipioint main(void)
1867ebc996f3SRiku Voipio{
1868ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
1869ebc996f3SRiku Voipio    futimens(0, NULL);
1870ebc996f3SRiku Voipio    return 0;
1871ebc996f3SRiku Voipio}
1872ebc996f3SRiku VoipioEOF
187352166aa0SJuan Quintelaif compile_prog "" "" ; then
1874ebc996f3SRiku Voipio  utimens=yes
1875ebc996f3SRiku Voipiofi
1876ebc996f3SRiku Voipio
1877099d6b0fSRiku Voipio# check if pipe2 is there
1878099d6b0fSRiku Voipiopipe2=no
1879099d6b0fSRiku Voipiocat > $TMPC << EOF
1880099d6b0fSRiku Voipio#define _GNU_SOURCE
1881099d6b0fSRiku Voipio#include <unistd.h>
1882099d6b0fSRiku Voipio#include <fcntl.h>
1883099d6b0fSRiku Voipio
1884099d6b0fSRiku Voipioint main(void)
1885099d6b0fSRiku Voipio{
1886099d6b0fSRiku Voipio    int pipefd[2];
1887099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
1888099d6b0fSRiku Voipio    return 0;
1889099d6b0fSRiku Voipio}
1890099d6b0fSRiku VoipioEOF
189152166aa0SJuan Quintelaif compile_prog "" "" ; then
1892099d6b0fSRiku Voipio  pipe2=yes
1893099d6b0fSRiku Voipiofi
1894099d6b0fSRiku Voipio
189540ff6d7eSKevin Wolf# check if accept4 is there
189640ff6d7eSKevin Wolfaccept4=no
189740ff6d7eSKevin Wolfcat > $TMPC << EOF
189840ff6d7eSKevin Wolf#define _GNU_SOURCE
189940ff6d7eSKevin Wolf#include <sys/socket.h>
190040ff6d7eSKevin Wolf#include <stddef.h>
190140ff6d7eSKevin Wolf
190240ff6d7eSKevin Wolfint main(void)
190340ff6d7eSKevin Wolf{
190440ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
190540ff6d7eSKevin Wolf    return 0;
190640ff6d7eSKevin Wolf}
190740ff6d7eSKevin WolfEOF
190840ff6d7eSKevin Wolfif compile_prog "" "" ; then
190940ff6d7eSKevin Wolf  accept4=yes
191040ff6d7eSKevin Wolffi
191140ff6d7eSKevin Wolf
19123ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
19133ce34dfbSvibisreenivasansplice=no
19143ce34dfbSvibisreenivasancat > $TMPC << EOF
19153ce34dfbSvibisreenivasan#define _GNU_SOURCE
19163ce34dfbSvibisreenivasan#include <unistd.h>
19173ce34dfbSvibisreenivasan#include <fcntl.h>
19183ce34dfbSvibisreenivasan#include <limits.h>
19193ce34dfbSvibisreenivasan
19203ce34dfbSvibisreenivasanint main(void)
19213ce34dfbSvibisreenivasan{
19223ce34dfbSvibisreenivasan    int len, fd;
19233ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
19243ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
19253ce34dfbSvibisreenivasan    return 0;
19263ce34dfbSvibisreenivasan}
19273ce34dfbSvibisreenivasanEOF
192852166aa0SJuan Quintelaif compile_prog "" "" ; then
19293ce34dfbSvibisreenivasan  splice=yes
19303ce34dfbSvibisreenivasanfi
19313ce34dfbSvibisreenivasan
1932c2882b96SRiku Voipio# check if eventfd is supported
1933c2882b96SRiku Voipioeventfd=no
1934c2882b96SRiku Voipiocat > $TMPC << EOF
1935c2882b96SRiku Voipio#include <sys/eventfd.h>
1936c2882b96SRiku Voipio
1937c2882b96SRiku Voipioint main(void)
1938c2882b96SRiku Voipio{
1939c2882b96SRiku Voipio    int efd = eventfd(0, 0);
1940c2882b96SRiku Voipio    return 0;
1941c2882b96SRiku Voipio}
1942c2882b96SRiku VoipioEOF
1943c2882b96SRiku Voipioif compile_prog "" "" ; then
1944c2882b96SRiku Voipio  eventfd=yes
1945c2882b96SRiku Voipiofi
1946c2882b96SRiku Voipio
1947d0927938SUlrich Hecht# check for fallocate
1948d0927938SUlrich Hechtfallocate=no
1949d0927938SUlrich Hechtcat > $TMPC << EOF
1950d0927938SUlrich Hecht#include <fcntl.h>
1951d0927938SUlrich Hecht
1952d0927938SUlrich Hechtint main(void)
1953d0927938SUlrich Hecht{
1954d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
1955d0927938SUlrich Hecht    return 0;
1956d0927938SUlrich Hecht}
1957d0927938SUlrich HechtEOF
1958be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then
1959d0927938SUlrich Hecht  fallocate=yes
1960d0927938SUlrich Hechtfi
1961d0927938SUlrich Hecht
1962d0927938SUlrich Hecht# check for dup3
1963d0927938SUlrich Hechtdup3=no
1964d0927938SUlrich Hechtcat > $TMPC << EOF
1965d0927938SUlrich Hecht#include <unistd.h>
1966d0927938SUlrich Hecht
1967d0927938SUlrich Hechtint main(void)
1968d0927938SUlrich Hecht{
1969d0927938SUlrich Hecht    dup3(0, 0, 0);
1970d0927938SUlrich Hecht    return 0;
1971d0927938SUlrich Hecht}
1972d0927938SUlrich HechtEOF
197378f5d726SJan Kiszkaif compile_prog "" "" ; then
1974d0927938SUlrich Hecht  dup3=yes
1975d0927938SUlrich Hechtfi
1976d0927938SUlrich Hecht
1977cc8ae6deSpbrook# Check if tools are available to build documentation.
1978a25dba17SJuan Quintelaif test "$docs" != "no" ; then
197901668d98SStefan Weil  if has makeinfo && has pod2man; then
1980a25dba17SJuan Quintela    docs=yes
198183a3ab8bSJuan Quintela  else
1982a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
1983a25dba17SJuan Quintela      feature_not_found "docs"
198483a3ab8bSJuan Quintela    fi
1985a25dba17SJuan Quintela    docs=no
198683a3ab8bSJuan Quintela  fi
1987cc8ae6deSpbrookfi
1988cc8ae6deSpbrook
1989f514f41cSStefan Weil# Search for bswap_32 function
19906ae9a1f4SJuan Quintelabyteswap_h=no
19916ae9a1f4SJuan Quintelacat > $TMPC << EOF
19926ae9a1f4SJuan Quintela#include <byteswap.h>
19936ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
19946ae9a1f4SJuan QuintelaEOF
199552166aa0SJuan Quintelaif compile_prog "" "" ; then
19966ae9a1f4SJuan Quintela  byteswap_h=yes
19976ae9a1f4SJuan Quintelafi
19986ae9a1f4SJuan Quintela
1999f514f41cSStefan Weil# Search for bswap_32 function
20006ae9a1f4SJuan Quintelabswap_h=no
20016ae9a1f4SJuan Quintelacat > $TMPC << EOF
20026ae9a1f4SJuan Quintela#include <sys/endian.h>
20036ae9a1f4SJuan Quintela#include <sys/types.h>
20046ae9a1f4SJuan Quintela#include <machine/bswap.h>
20056ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
20066ae9a1f4SJuan QuintelaEOF
200752166aa0SJuan Quintelaif compile_prog "" "" ; then
20086ae9a1f4SJuan Quintela  bswap_h=yes
20096ae9a1f4SJuan Quintelafi
20106ae9a1f4SJuan Quintela
2011da93a1fdSaliguori##########################################
2012da93a1fdSaliguori# Do we need librt
2013da93a1fdSaliguoricat > $TMPC <<EOF
2014da93a1fdSaliguori#include <signal.h>
2015da93a1fdSaliguori#include <time.h>
2016da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); }
2017da93a1fdSaliguoriEOF
2018da93a1fdSaliguori
201952166aa0SJuan Quintelaif compile_prog "" "" ; then
202007ffa4bdSJuan Quintela  :
202152166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
202207ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
2023da93a1fdSaliguorifi
2024da93a1fdSaliguori
202531ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
20266362a53fSJuan Quintela        "$aix" != "yes" ; then
20276362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
20286362a53fSJuan Quintelafi
20296362a53fSJuan Quintela
2030de5071c5SBlue Swirl##########################################
2031de5071c5SBlue Swirl# check if the compiler defines offsetof
2032de5071c5SBlue Swirl
2033de5071c5SBlue Swirlneed_offsetof=yes
2034de5071c5SBlue Swirlcat > $TMPC << EOF
2035de5071c5SBlue Swirl#include <stddef.h>
2036de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); }
2037de5071c5SBlue SwirlEOF
2038de5071c5SBlue Swirlif compile_prog "" "" ; then
2039de5071c5SBlue Swirl    need_offsetof=no
2040de5071c5SBlue Swirlfi
2041de5071c5SBlue Swirl
20425f6b9e8fSBlue Swirl##########################################
2043747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result
2044747bbdf7SBlue Swirl#
2045747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning
2046747bbdf7SBlue Swirl# about attribute warn_unused_result
2047747bbdf7SBlue Swirl
2048747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no
2049747bbdf7SBlue Swirlcat > $TMPC << EOF
2050747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
2051747bbdf7SBlue Swirl#error gcc 3.3 or older
2052747bbdf7SBlue Swirl#endif
2053747bbdf7SBlue Swirlint main(void) { return 0;}
2054747bbdf7SBlue SwirlEOF
2055747bbdf7SBlue Swirlif compile_prog "" ""; then
2056747bbdf7SBlue Swirl    gcc_attribute_warn_unused_result=yes
2057747bbdf7SBlue Swirlfi
2058747bbdf7SBlue Swirl
2059747bbdf7SBlue Swirl##########################################
20605f6b9e8fSBlue Swirl# check if we have fdatasync
20615f6b9e8fSBlue Swirl
20625f6b9e8fSBlue Swirlfdatasync=no
20635f6b9e8fSBlue Swirlcat > $TMPC << EOF
20645f6b9e8fSBlue Swirl#include <unistd.h>
20655f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); }
20665f6b9e8fSBlue SwirlEOF
20675f6b9e8fSBlue Swirlif compile_prog "" "" ; then
20685f6b9e8fSBlue Swirl    fdatasync=yes
20695f6b9e8fSBlue Swirlfi
20705f6b9e8fSBlue Swirl
207194a420b1SStefan Hajnoczi##########################################
207294a420b1SStefan Hajnoczi# check if trace backend exists
207394a420b1SStefan Hajnoczi
207494a420b1SStefan Hajnoczish "$source_path/tracetool" "--$trace_backend" --check-backend > /dev/null 2> /dev/null
207594a420b1SStefan Hajnocziif test "$?" -ne 0 ; then
207694a420b1SStefan Hajnoczi  echo
207794a420b1SStefan Hajnoczi  echo "Error: invalid trace backend"
207894a420b1SStefan Hajnoczi  echo "Please choose a supported trace backend."
207994a420b1SStefan Hajnoczi  echo
208094a420b1SStefan Hajnoczi  exit 1
208194a420b1SStefan Hajnoczifi
208294a420b1SStefan Hajnoczi
2083*7e24e92aSStefan Hajnoczi##########################################
2084*7e24e92aSStefan Hajnoczi# For 'ust' backend, test if ust headers are present
2085*7e24e92aSStefan Hajnocziif test "$trace_backend" = "ust"; then
2086*7e24e92aSStefan Hajnoczi  cat > $TMPC << EOF
2087*7e24e92aSStefan Hajnoczi#include <ust/tracepoint.h>
2088*7e24e92aSStefan Hajnoczi#include <ust/marker.h>
2089*7e24e92aSStefan Hajnocziint main(void) { return 0; }
2090*7e24e92aSStefan HajnocziEOF
2091*7e24e92aSStefan Hajnoczi  if compile_prog "" "" ; then
2092*7e24e92aSStefan Hajnoczi    LIBS="-lust $LIBS"
2093*7e24e92aSStefan Hajnoczi  else
2094*7e24e92aSStefan Hajnoczi    echo
2095*7e24e92aSStefan Hajnoczi    echo "Error: Trace backend 'ust' missing libust header files"
2096*7e24e92aSStefan Hajnoczi    echo
2097*7e24e92aSStefan Hajnoczi    exit 1
2098*7e24e92aSStefan Hajnoczi  fi
2099*7e24e92aSStefan Hajnoczifi
2100*7e24e92aSStefan Hajnoczi##########################################
2101e86ecd4bSJuan Quintela# End of CC checks
2102e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
2103e86ecd4bSJuan Quintela
2104e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
21051156c669SJuan Quintela  CFLAGS="-O2 $CFLAGS"
2106e86ecd4bSJuan Quintelafi
2107a316e378SJuan Quintela
2108e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
2109e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
2110e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
211120ff6c80SAnthony Liguori
211220ff6c80SAnthony Liguoriif test -z "$werror" ; then
2113e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
2114e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
2115e86ecd4bSJuan Quintela        werror="yes"
2116e86ecd4bSJuan Quintela    else
2117e86ecd4bSJuan Quintela        werror="no"
2118e86ecd4bSJuan Quintela    fi
2119e86ecd4bSJuan Quintelafi
2120e86ecd4bSJuan Quintela
212120ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
212220ff6c80SAnthony Liguori# enable/disable
212320ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
212420ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
212520ff6c80SAnthony Liguori	zero_malloc="no"
212620ff6c80SAnthony Liguori    else
212720ff6c80SAnthony Liguori	zero_malloc="yes"
212820ff6c80SAnthony Liguori    fi
212920ff6c80SAnthony Liguorifi
213020ff6c80SAnthony Liguori
2131e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
2132a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
2133e86ecd4bSJuan Quintelafi
2134e86ecd4bSJuan Quintela
2135e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
2136e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
21371156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
2138e86ecd4bSJuan Quintela    fi
2139e86ecd4bSJuan Quintelafi
2140e86ecd4bSJuan Quintela
2141190e9c59SPaolo Bonziniconfdir=$sysconfdir$confsuffix
21425a67135aSbellard
2143ca35f780SPaolo Bonzinitools=
2144ca35f780SPaolo Bonziniif test "$softmmu" = yes ; then
2145ca35f780SPaolo Bonzini  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
2146ca35f780SPaolo Bonzini  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
2147ca35f780SPaolo Bonzini      tools="qemu-nbd\$(EXESUF) $tools"
2148ca35f780SPaolo Bonzini    if [ "$check_utests" = "yes" ]; then
2149ca35f780SPaolo Bonzini      tools="check-qint check-qstring check-qdict check-qlist $tools"
2150ca35f780SPaolo Bonzini      tools="check-qfloat check-qjson $tools"
2151ca35f780SPaolo Bonzini    fi
2152ca35f780SPaolo Bonzini  fi
2153ca35f780SPaolo Bonzinifi
2154ca35f780SPaolo Bonzini
2155ca35f780SPaolo Bonzini# Mac OS X ships with a broken assembler
2156ca35f780SPaolo Bonziniroms=
2157ca35f780SPaolo Bonziniif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2158ca35f780SPaolo Bonzini        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2159ca35f780SPaolo Bonzini        "$softmmu" = yes ; then
2160ca35f780SPaolo Bonzini  roms="optionrom"
2161ca35f780SPaolo Bonzinifi
2162ca35f780SPaolo Bonzini
2163ca35f780SPaolo Bonzini
21647d13299dSbellardecho "Install prefix    $prefix"
2165f2b9e1e3SPaolo Bonziniecho "BIOS directory    `eval echo $datadir`"
2166f2b9e1e3SPaolo Bonziniecho "binary directory  `eval echo $bindir`"
21671c0fd160SAurelien Jarnoecho "config directory  `eval echo $sysconfdir`"
216811d9f695Sbellardif test "$mingw32" = "no" ; then
2169f2b9e1e3SPaolo Bonziniecho "Manual directory  `eval echo $mandir`"
217043ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
217111d9f695Sbellardfi
21725a67135aSbellardecho "Source path       $source_path"
21737d13299dSbellardecho "C compiler        $cc"
217483469015Sbellardecho "Host C compiler   $host_cc"
21750c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
2176a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
21770c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
21787d13299dSbellardecho "make              $make"
21796a882643Spbrookecho "install           $install"
2180a98fd896Sbellardecho "host CPU          $cpu"
2181de83cd02Sbellardecho "host big endian   $bigendian"
218297a847bcSbellardecho "target list       $target_list"
2183ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
2184b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
21857d13299dSbellardecho "gprof enabled     $gprof"
218603b4fe7dSaliguoriecho "sparse enabled    $sparse"
21871625af87Saliguoriecho "strip binaries    $strip_opt"
218805c2a3e7Sbellardecho "profiler          $profiler"
218943ce4dfeSbellardecho "static build      $static"
219085aa5189Sbellardecho "-Werror enabled   $werror"
21915b0753e0Sbellardif test "$darwin" = "yes" ; then
21925b0753e0Sbellard    echo "Cocoa support     $cocoa"
21935b0753e0Sbellardfi
219497a847bcSbellardecho "SDL support       $sdl"
21954d3b6f6eSbalrogecho "curses support    $curses"
2196769ce76dSAlexander Grafecho "curl support      $curl"
21975495ed11SLuiz Capitulinoecho "check support     $check_utests"
219867b915a5Sbellardecho "mingw32 support   $mingw32"
21990c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
22000c58ac1cSmalcecho "Extra audio cards $audio_card_list"
2201eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
22028ff9cbf7Smalcecho "Mixer emulation   $mixemu"
22038d5d2d4cSthsecho "VNC TLS support   $vnc_tls"
22042f9606b3Saliguoriecho "VNC SASL support  $vnc_sasl"
22052f6f5c7aSCorentin Charyecho "VNC JPEG support  $vnc_jpeg"
2206efe556adSCorentin Charyecho "VNC PNG support   $vnc_png"
2207bd023f95SCorentin Charyecho "VNC thread        $vnc_thread"
22083142255cSblueswir1if test -n "$sparc_cpu"; then
22093142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
22103142255cSblueswir1fi
2211e37630caSaliguoriecho "xen support       $xen"
22122e4d9fb1Saurel32echo "brlapi support    $brlapi"
2213a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
2214a25dba17SJuan Quintelaecho "Documentation     $docs"
2215c5937220Spbrook[ ! -z "$uname_release" ] && \
2216c5937220Spbrookecho "uname -r          $uname_release"
2217bd0c5661Spbrookecho "NPTL support      $nptl"
2218379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
221934005a00SKirill A. Shutemovecho "PIE user targets  $user_pie"
22208a16d273Sthsecho "vde support       $vde"
2221e5d355d1Saliguoriecho "IO thread         $io_thread"
22225c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
2223758e8e38SVenkateswararao Jujjuri (JV)echo "ATTR/XATTR support $attr"
222477755340Sthsecho "Install blobs     $blobs"
2225b31a0277SJuan Quintelaecho "KVM support       $kvm"
2226f652e6afSaurel32echo "fdt support       $fdt"
2227ceb42de8Saliguoriecho "preadv support    $preadv"
22285f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
2229ee682d27SStefan Weilecho "uuid support      $uuid"
2230d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
223194a420b1SStefan Hajnocziecho "Trace backend     $trace_backend"
22329410b56cSPrerna Saxenaecho "Trace output file $trace_file-<pid>"
223367b915a5Sbellard
223497a847bcSbellardif test $sdl_too_old = "yes"; then
223524b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
2236e8cd23deSbellardfi
223797a847bcSbellard
223898ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
22394bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
224097a847bcSbellard
224198ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
224298ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
224398ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
224498ec69acSJuan Quintelaecho >> $config_host_mak
224598ec69acSJuan Quintela
224699d7cc75SPaolo Bonziniecho "prefix=$prefix" >> $config_host_mak
224799d7cc75SPaolo Bonziniecho "bindir=$bindir" >> $config_host_mak
224899d7cc75SPaolo Bonziniecho "mandir=$mandir" >> $config_host_mak
224999d7cc75SPaolo Bonziniecho "datadir=$datadir" >> $config_host_mak
225099d7cc75SPaolo Bonziniecho "sysconfdir=$sysconfdir" >> $config_host_mak
225199d7cc75SPaolo Bonziniecho "docdir=$docdir" >> $config_host_mak
22521dabe05cSPaolo Bonziniecho "confdir=$confdir" >> $config_host_mak
2253804edf29SJuan Quintela
22542408a527Saurel32case "$cpu" in
225524e804ecSAlexander Graf  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2256e0da9dd3SJuan Quintela    ARCH=$cpu
22572408a527Saurel32  ;;
2258a302c32dSLaurent Desnogues  armv4b|armv4l)
225916dbd14fSJuan Quintela    ARCH=arm
22602408a527Saurel32  ;;
22612408a527Saurel32esac
226298ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
2263f8393946Saurel32if test "$debug_tcg" = "yes" ; then
22642358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2265f8393946Saurel32fi
2266b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
2267b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2268b4475aa2SLuiz Capitulinofi
2269f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
22702358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2271f3d08ee6SPaul Brookfi
22721625af87Saliguoriif test "$strip_opt" = "yes" ; then
227352ba784dSHollis Blanchard  echo "STRIP=${strip}" >> $config_host_mak
22741625af87Saliguorifi
22757d13299dSbellardif test "$bigendian" = "yes" ; then
2276e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
227797a847bcSbellardfi
22782358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
227967b915a5Sbellardif test "$mingw32" = "yes" ; then
228098ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
2281210fa556Spbrookelse
228235f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
2283210fa556Spbrookfi
2284128ab2ffSblueswir1
2285dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
2286dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
2287dffcb71cSMark McLoughlinfi
2288dffcb71cSMark McLoughlin
228983fb7adfSbellardif test "$darwin" = "yes" ; then
229098ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
229183fb7adfSbellardfi
2292b29fe3edSmalc
2293b29fe3edSmalcif test "$aix" = "yes" ; then
229498ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
2295b29fe3edSmalcfi
2296b29fe3edSmalc
2297ec530c81Sbellardif test "$solaris" = "yes" ; then
229898ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
22992358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
23000475a5caSths  if test "$needs_libsunmath" = "yes" ; then
230175b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
23020475a5caSths  fi
2303ec530c81Sbellardfi
230497a847bcSbellardif test "$static" = "yes" ; then
230598ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
230697a847bcSbellardfi
230705c2a3e7Sbellardif test $profiler = "yes" ; then
23082358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
230905c2a3e7Sbellardfi
2310c20709aaSbellardif test "$slirp" = "yes" ; then
231198ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
2312b6e31c12SJuan Quintela  QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
2313c20709aaSbellardfi
23148a16d273Sthsif test "$vde" = "yes" ; then
231598ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
23168a16d273Sthsfi
23170c58ac1cSmalcfor card in $audio_card_list; do
2318f6e5889eSpbrook    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
231998ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
23200c58ac1cSmalcdone
23212358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
23220c58ac1cSmalcfor drv in $audio_drv_list; do
2323f6e5889eSpbrook    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
232498ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
2325923e4521Smalc    if test "$drv" = "fmod"; then
23267aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2327fb065187Sbellard    fi
23280c58ac1cSmalcdone
232967f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
233067f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
233167f86e8eSJuan Quintelafi
2332d5631638Smalcif test "$audio_win_int" = "yes" ; then
2333d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2334d5631638Smalcfi
2335eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
23368ff9cbf7Smalcif test "$mixemu" = "yes" ; then
233798ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
23388ff9cbf7Smalcfi
23398d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
234098ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2341525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
23428d5d2d4cSthsfi
23432f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
234498ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
234560ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
23462f9606b3Saliguorifi
234796763cf9SCorentin Charyif test "$vnc_jpeg" != "no" ; then
23482f6f5c7aSCorentin Chary  echo "CONFIG_VNC_JPEG=y" >> $config_host_mak
23492f6f5c7aSCorentin Chary  echo "VNC_JPEG_CFLAGS=$vnc_jpeg_cflags" >> $config_host_mak
23502f6f5c7aSCorentin Charyfi
235196763cf9SCorentin Charyif test "$vnc_png" != "no" ; then
2352efe556adSCorentin Chary  echo "CONFIG_VNC_PNG=y" >> $config_host_mak
2353efe556adSCorentin Chary  echo "VNC_PNG_CFLAGS=$vnc_png_cflags" >> $config_host_mak
2354efe556adSCorentin Charyfi
235596763cf9SCorentin Charyif test "$vnc_thread" != "no" ; then
2356bd023f95SCorentin Chary  echo "CONFIG_VNC_THREAD=y" >> $config_host_mak
2357bd023f95SCorentin Chary  echo "CONFIG_THREAD=y" >> $config_host_mak
2358bd023f95SCorentin Charyfi
235976655d6dSaliguoriif test "$fnmatch" = "yes" ; then
23602358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
236176655d6dSaliguorifi
2362ee682d27SStefan Weilif test "$uuid" = "yes" ; then
2363ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
2364ee682d27SStefan Weilfi
2365b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
236698ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
23672358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
236898ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
236998ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
2370a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
237198ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
2372cc8ae6deSpbrookfi
23731ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
237498ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
23758ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
237649ecc3faSbellardfi
237749ecc3faSbellardif test "$cocoa" = "yes" ; then
237898ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
237949ecc3faSbellardfi
23804d3b6f6eSbalrogif test "$curses" = "yes" ; then
238198ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
2382ab4e5602SJan Kiszkafi
23833b3f24adSaurel32if test "$atfile" = "yes" ; then
23842358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
23853b3f24adSaurel32fi
2386ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
23872358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2388ebc996f3SRiku Voipiofi
2389099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
23902358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
2391099d6b0fSRiku Voipiofi
239240ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
239340ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
239440ff6d7eSKevin Wolffi
23953ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
23962358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
23973ce34dfbSvibisreenivasanfi
2398c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
2399c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2400c2882b96SRiku Voipiofi
2401d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
2402d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2403d0927938SUlrich Hechtfi
2404d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
2405d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
2406d0927938SUlrich Hechtfi
24073b3f24adSaurel32if test "$inotify" = "yes" ; then
24082358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
24093b3f24adSaurel32fi
2410c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
2411c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2412c05c7a73SRiku Voipiofi
24136ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
24146ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
24156ae9a1f4SJuan Quintelafi
24166ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
24176ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
24186ae9a1f4SJuan Quintelafi
2419769ce76dSAlexander Grafif test "$curl" = "yes" ; then
242098ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
2421b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2422769ce76dSAlexander Graffi
24232e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
242498ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
24252e4d9fb1Saurel32fi
2426fb599c9aSbalrogif test "$bluez" = "yes" ; then
242798ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2428ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2429fb599c9aSbalrogfi
2430e37630caSaliguoriif test "$xen" = "yes" ; then
24315647eb74SJuan Quintela  echo "CONFIG_XEN=y" >> $config_host_mak
2432e37630caSaliguorifi
2433e5d355d1Saliguoriif test "$io_thread" = "yes" ; then
243498ec69acSJuan Quintela  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2435bd023f95SCorentin Chary  echo "CONFIG_THREAD=y" >> $config_host_mak
2436e5d355d1Saliguorifi
24375c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
24385c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
24395c6c3a6cSChristoph Hellwigfi
2440758e8e38SVenkateswararao Jujjuri (JV)if test "$attr" = "yes" ; then
2441758e8e38SVenkateswararao Jujjuri (JV)  echo "CONFIG_ATTR=y" >> $config_host_mak
2442758e8e38SVenkateswararao Jujjuri (JV)fi
2443758e8e38SVenkateswararao Jujjuri (JV)if test "$linux" = "yes" ; then
2444758e8e38SVenkateswararao Jujjuri (JV)  if test "$attr" = "yes" ; then
2445758e8e38SVenkateswararao Jujjuri (JV)    echo "CONFIG_VIRTFS=y" >> $config_host_mak
2446758e8e38SVenkateswararao Jujjuri (JV)  fi
2447758e8e38SVenkateswararao Jujjuri (JV)fi
244877755340Sthsif test "$blobs" = "yes" ; then
244998ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
245077755340Sthsfi
2451bf9298b9Saliguoriif test "$iovec" = "yes" ; then
24522358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
2453bf9298b9Saliguorifi
2454ceb42de8Saliguoriif test "$preadv" = "yes" ; then
24552358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
2456ceb42de8Saliguorifi
2457f652e6afSaurel32if test "$fdt" = "yes" ; then
24583f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
2459f652e6afSaurel32fi
2460de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then
2461de5071c5SBlue Swirl  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2462de5071c5SBlue Swirlfi
2463747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then
2464747bbdf7SBlue Swirl  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2465747bbdf7SBlue Swirlfi
24665f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
24675f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
24685f6b9e8fSBlue Swirlfi
246997a847bcSbellard
247083fb7adfSbellard# XXX: suppress that
24717d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
24722358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
24737d3505c5Sbellardfi
24747d3505c5Sbellard
24752358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2476c5937220Spbrook
247720ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
247820ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
247920ff6c80SAnthony Liguorifi
248020ff6c80SAnthony Liguori
248168063649Sblueswir1# USB host support
248268063649Sblueswir1case "$usb" in
248368063649Sblueswir1linux)
248498ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
248568063649Sblueswir1;;
248668063649Sblueswir1bsd)
248798ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
248868063649Sblueswir1;;
248968063649Sblueswir1*)
249098ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
249168063649Sblueswir1;;
249268063649Sblueswir1esac
249368063649Sblueswir1
249494a420b1SStefan Hajnocziecho "TRACE_BACKEND=$trace_backend" >> $config_host_mak
249522890ab5SPrerna Saxenaif test "$trace_backend" = "simple"; then
249622890ab5SPrerna Saxena  echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
249722890ab5SPrerna Saxenafi
24989410b56cSPrerna Saxena# Set the appropriate trace file.
24999410b56cSPrerna Saxenaif test "$trace_backend" = "simple"; then
25009410b56cSPrerna Saxena  trace_file="\"$trace_file-%u\""
25019410b56cSPrerna Saxenafi
25029410b56cSPrerna Saxenaecho "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
25039410b56cSPrerna Saxena
250498ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
250598ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
2506804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
2507804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
2508804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2509804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2510804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2511804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
2512804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
2513804edf29SJuan Quintelaif test "$sparse" = "yes" ; then
2514804edf29SJuan Quintela  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
2515804edf29SJuan Quintela  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
2516a558ee17SJuan Quintela  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2517804edf29SJuan Quintelafi
2518804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
2519804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
2520804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
2521e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
2522a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2523c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2524e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
2525a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2526a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
252773da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
25283e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2529804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
2530804edf29SJuan Quintela
25314bf6b55bSJuan Quintela# generate list of library paths for linker script
25324bf6b55bSJuan Quintela
25334bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
25344bf6b55bSJuan Quintela
25354bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
25364bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
25374bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
25384bf6b55bSJuan Quintela  else
25394bf6b55bSJuan Quintela    rm ${config_host_ld}~
25404bf6b55bSJuan Quintela  fi
25414bf6b55bSJuan Quintelafi
25424bf6b55bSJuan Quintela
25434d904533SBlue Swirlfor d in libdis libdis-user; do
25444d904533SBlue Swirl    mkdir -p $d
25454d904533SBlue Swirl    rm -f $d/Makefile
25464d904533SBlue Swirl    ln -s $source_path/Makefile.dis $d/Makefile
25474d904533SBlue Swirl    echo > $d/config.mak
25484d904533SBlue Swirldone
2549d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then
2550d44cff22SRichard Henderson  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2551d44cff22SRichard Hendersonfi
25524d904533SBlue Swirl
255397a847bcSbellardfor target in $target_list; do
255497a847bcSbellardtarget_dir="$target"
255525be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
2556600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
255797a847bcSbellardtarget_bigendian="no"
25581f3d3c8fSJuan Quintela
2559ea2d6a39SJuan Quintelacase "$target_arch2" in
256024e804ecSAlexander Graf  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2561ea2d6a39SJuan Quintela  target_bigendian=yes
2562ea2d6a39SJuan Quintela  ;;
2563ea2d6a39SJuan Quintelaesac
256497a847bcSbellardtarget_softmmu="no"
2565997344f3Sbellardtarget_user_only="no"
2566831b7825Sthstarget_linux_user="no"
2567831b7825Sthstarget_darwin_user="no"
256884778508Sblueswir1target_bsd_user="no"
25699e407a85Spbrookcase "$target" in
2570600309b6SBlue Swirl  ${target_arch2}-softmmu)
25719e407a85Spbrook    target_softmmu="yes"
25729e407a85Spbrook    ;;
2573600309b6SBlue Swirl  ${target_arch2}-linux-user)
25749c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
25759c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
25769c7a4202SBlue Swirl      exit 1
25779c7a4202SBlue Swirl    fi
25789e407a85Spbrook    target_user_only="yes"
25799e407a85Spbrook    target_linux_user="yes"
25809e407a85Spbrook    ;;
2581600309b6SBlue Swirl  ${target_arch2}-darwin-user)
25829c7a4202SBlue Swirl    if test "$darwin" != "yes" ; then
25839c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Darwin host"
25849c7a4202SBlue Swirl      exit 1
25859c7a4202SBlue Swirl    fi
25869e407a85Spbrook    target_user_only="yes"
2587831b7825Sths    target_darwin_user="yes"
25889e407a85Spbrook    ;;
2589600309b6SBlue Swirl  ${target_arch2}-bsd-user)
25909cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
25919c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
25929c7a4202SBlue Swirl      exit 1
25939c7a4202SBlue Swirl    fi
259484778508Sblueswir1    target_user_only="yes"
259584778508Sblueswir1    target_bsd_user="yes"
259684778508Sblueswir1    ;;
25979e407a85Spbrook  *)
25989e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
25999e407a85Spbrook    exit 1
26009e407a85Spbrook    ;;
26019e407a85Spbrookesac
2602831b7825Sths
260397a847bcSbellardmkdir -p $target_dir
2604158142c2Sbellardmkdir -p $target_dir/fpu
260557fec1feSbellardmkdir -p $target_dir/tcg
260659f2a787SGerd Hoffmannmkdir -p $target_dir/ide
260784778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
260869de927cSbellard  mkdir -p $target_dir/nwfpe
260969de927cSbellardfi
261069de927cSbellard
2611ec530c81Sbellard#
2612ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
2613ec530c81Sbellard#
2614ec530c81Sbellardrm -f $target_dir/Makefile
2615ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
2616ec530c81Sbellard
261797a847bcSbellard
261825be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
261997a847bcSbellard
2620e5fe0c52Spbrookbflt="no"
2621bd0c5661Spbrooktarget_nptl="no"
2622600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
26237ee2822cSPaolo Bonziniecho "CONFIG_QEMU_INTERP_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
262456aebc89Spbrookgdb_xml_files=""
26257ba1e619Saliguori
2626938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
26276acff7daSJuan QuintelaTARGET_BASE_ARCH=""
2628e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
2629e73aae67SJuan Quintela
2630600309b6SBlue Swirlcase "$target_arch2" in
26312408a527Saurel32  i386)
26321ad2134fSPaul Brook    target_phys_bits=32
26332408a527Saurel32  ;;
26342408a527Saurel32  x86_64)
26356acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
26361ad2134fSPaul Brook    target_phys_bits=64
26372408a527Saurel32  ;;
26382408a527Saurel32  alpha)
26391ad2134fSPaul Brook    target_phys_bits=64
2640a4b388ffSRichard Henderson    target_nptl="yes"
26412408a527Saurel32  ;;
26422408a527Saurel32  arm|armeb)
2643b498c8a0SJuan Quintela    TARGET_ARCH=arm
2644e5fe0c52Spbrook    bflt="yes"
2645bd0c5661Spbrook    target_nptl="yes"
264656aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
26471ad2134fSPaul Brook    target_phys_bits=32
26482408a527Saurel32  ;;
26492408a527Saurel32  cris)
2650253bd7f8Sedgar_igl    target_nptl="yes"
26511ad2134fSPaul Brook    target_phys_bits=32
26522408a527Saurel32  ;;
26532408a527Saurel32  m68k)
26540938cda5Saurel32    bflt="yes"
265556aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
26561ad2134fSPaul Brook    target_phys_bits=32
26572408a527Saurel32  ;;
265872b675caSEdgar E. Iglesias  microblaze)
265972b675caSEdgar E. Iglesias    bflt="yes"
266072b675caSEdgar E. Iglesias    target_nptl="yes"
266172b675caSEdgar E. Iglesias    target_phys_bits=32
266272b675caSEdgar E. Iglesias  ;;
26632408a527Saurel32  mips|mipsel)
2664b498c8a0SJuan Quintela    TARGET_ARCH=mips
266525be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2666f04dc72fSPaul Brook    target_nptl="yes"
26671ad2134fSPaul Brook    target_phys_bits=64
26682408a527Saurel32  ;;
26692408a527Saurel32  mipsn32|mipsn32el)
2670b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
26716acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
267225be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
26731ad2134fSPaul Brook    target_phys_bits=64
26742408a527Saurel32  ;;
26752408a527Saurel32  mips64|mips64el)
2676b498c8a0SJuan Quintela    TARGET_ARCH=mips64
26776acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
267825be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
26791ad2134fSPaul Brook    target_phys_bits=64
26802408a527Saurel32  ;;
26812408a527Saurel32  ppc)
2682c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
26831ad2134fSPaul Brook    target_phys_bits=32
2684d6630708SNathan Froyd    target_nptl="yes"
26852408a527Saurel32  ;;
26862408a527Saurel32  ppcemb)
26876acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2688e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
2689c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
26901ad2134fSPaul Brook    target_phys_bits=64
2691d6630708SNathan Froyd    target_nptl="yes"
26922408a527Saurel32  ;;
26932408a527Saurel32  ppc64)
26946acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2695e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
2696c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
26971ad2134fSPaul Brook    target_phys_bits=64
26982408a527Saurel32  ;;
26992408a527Saurel32  ppc64abi32)
2700b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
27016acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2702e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
270325be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
2704c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
27051ad2134fSPaul Brook    target_phys_bits=64
27062408a527Saurel32  ;;
27072408a527Saurel32  sh4|sh4eb)
2708b498c8a0SJuan Quintela    TARGET_ARCH=sh4
27094dbed897Spbrook    bflt="yes"
27100b6d3ae0Saurel32    target_nptl="yes"
27111ad2134fSPaul Brook    target_phys_bits=32
27122408a527Saurel32  ;;
27132408a527Saurel32  sparc)
27141ad2134fSPaul Brook    target_phys_bits=64
27152408a527Saurel32  ;;
27162408a527Saurel32  sparc64)
27176acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
27181ad2134fSPaul Brook    target_phys_bits=64
27192408a527Saurel32  ;;
27202408a527Saurel32  sparc32plus)
2721b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
27226acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
2723e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
272425be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
27251ad2134fSPaul Brook    target_phys_bits=64
27262408a527Saurel32  ;;
272724e804ecSAlexander Graf  s390x)
272824e804ecSAlexander Graf    target_phys_bits=64
272924e804ecSAlexander Graf  ;;
27302408a527Saurel32  *)
2731de83cd02Sbellard    echo "Unsupported target CPU"
2732de83cd02Sbellard    exit 1
27332408a527Saurel32  ;;
27342408a527Saurel32esac
273525be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2736053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
273725be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
273825be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
273942bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
27406acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then
27416acff7daSJuan Quintela  TARGET_BASE_ARCH=$TARGET_ARCH
27426acff7daSJuan Quintelafi
274325be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2744e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
2745e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
2746e6e91b9cSJuan Quintelafi
274725be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
27481b0c87fcSJuan Quintelacase "$target_arch2" in
27491b0c87fcSJuan Quintela  i386|x86_64)
27501b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
275125be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
27521b0c87fcSJuan Quintela    fi
27531b0c87fcSJuan Quintelaesac
2754c59249f9SJuan Quintelacase "$target_arch2" in
27550e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
2756c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
2757c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2758c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
2759c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
27605f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
2761c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
2762c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
276325be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
276425be210fSJuan Quintela      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2765dae5079aSJan Kiszka      if test "$kvm_para" = "yes"; then
2766dae5079aSJan Kiszka        echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2767dae5079aSJan Kiszka      fi
2768d5970055SMichael S. Tsirkin      if test $vhost_net = "yes" ; then
2769d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2770d5970055SMichael S. Tsirkin      fi
2771c59249f9SJuan Quintela    fi
2772c59249f9SJuan Quintelaesac
2773de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
277425be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
277597a847bcSbellardfi
277697a847bcSbellardif test "$target_softmmu" = "yes" ; then
2777b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
277825be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
277925be210fSJuan Quintela  echo "LIBS+=$libs_softmmu" >> $config_target_mak
27800e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
27815791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2782de83cd02Sbellardfi
2783997344f3Sbellardif test "$target_user_only" = "yes" ; then
278425be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2785997344f3Sbellardfi
2786831b7825Sthsif test "$target_linux_user" = "yes" ; then
278725be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2788831b7825Sthsfi
2789831b7825Sthsif test "$target_darwin_user" = "yes" ; then
279025be210fSJuan Quintela  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2791831b7825Sthsfi
279256aebc89Spbrooklist=""
279356aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
279456aebc89Spbrook  for x in $gdb_xml_files; do
279556aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
279656aebc89Spbrook  done
279725be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
27983d0f1517SJuan Quintelafi
2799de83cd02Sbellard
2800f57975fbSJuan Quintelacase "$target_arch2" in
2801990b3e19SRichard Henderson  alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
280225be210fSJuan Quintela    echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2803f57975fbSJuan Quintela    ;;
2804d6b38939SJuan Quintela  *)
280525be210fSJuan Quintela    echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2806d6b38939SJuan Quintela    ;;
2807f57975fbSJuan Quintelaesac
2808f57975fbSJuan Quintela
2809e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
281025be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2811e5fe0c52Spbrookfi
2812bd0c5661Spbrookif test "$target_user_only" = "yes" \
2813bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
281425be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2815bd0c5661Spbrookfi
2816379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
281725be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2818379f6698SPaul Brookfi
281984778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
282025be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
282184778508Sblueswir1fi
28225b0753e0Sbellard
28234afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
2824fa282484SJuan Quintela
28254afddb55SJuan Quintelacflags=""
2826fa282484SJuan Quintelaldflags=""
28279b8e111fSJuan Quintela
282857ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then
282957ddfbf7SJuan Quintela  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
283024e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
283124e804ecSAlexander Graf  cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
28325d8a4f8fSRichard Hendersonelif test "$ARCH" = "x86_64" ; then
28335d8a4f8fSRichard Henderson  cflags="-I\$(SRC_PATH)/tcg/i386 $cflags"
283457ddfbf7SJuan Quintelaelse
283557ddfbf7SJuan Quintela  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
283657ddfbf7SJuan Quintelafi
283757ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/tcg $cflags"
283857ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/fpu $cflags"
283957ddfbf7SJuan Quintela
28404d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
28414d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
28424d904533SBlue Swirlelse
28434d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
28444d904533SBlue Swirlfi
28454d904533SBlue Swirl
284664656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
284764656024SJuan Quintela  case "$i" in
284864656024SJuan Quintela  alpha)
284925be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
28504d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
285164656024SJuan Quintela  ;;
285264656024SJuan Quintela  arm)
285325be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
28544d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
285564656024SJuan Quintela  ;;
285664656024SJuan Quintela  cris)
285725be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
28584d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
285964656024SJuan Quintela  ;;
286064656024SJuan Quintela  hppa)
286125be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
28624d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
286364656024SJuan Quintela  ;;
286464656024SJuan Quintela  i386|x86_64)
286525be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
28664d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
286764656024SJuan Quintela  ;;
2868903ec55cSAurelien Jarno  ia64*)
2869903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
2870903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
2871903ec55cSAurelien Jarno  ;;
287264656024SJuan Quintela  m68k)
287325be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
28744d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
287564656024SJuan Quintela  ;;
287664656024SJuan Quintela  microblaze)
287725be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
28784d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
287964656024SJuan Quintela  ;;
288064656024SJuan Quintela  mips*)
288125be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
28824d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
288364656024SJuan Quintela  ;;
288464656024SJuan Quintela  ppc*)
288525be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
28864d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
288764656024SJuan Quintela  ;;
288824e804ecSAlexander Graf  s390*)
288925be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
28904d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
289164656024SJuan Quintela  ;;
289264656024SJuan Quintela  sh4)
289325be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
28944d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
289564656024SJuan Quintela  ;;
289664656024SJuan Quintela  sparc*)
289725be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
28984d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
289964656024SJuan Quintela  ;;
290064656024SJuan Quintela  esac
290164656024SJuan Quinteladone
290264656024SJuan Quintela
29036ee7126fSJuan Quintelacase "$ARCH" in
29046ee7126fSJuan Quintelaalpha)
29056ee7126fSJuan Quintela  # Ensure there's only a single GP
29066ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
29076ee7126fSJuan Quintela;;
29086ee7126fSJuan Quintelaesac
29096ee7126fSJuan Quintela
291055d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
291155d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
291255d9c04bSJuan Quintela  arm)
291355d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
291455d9c04bSJuan Quintela  ;;
291555d9c04bSJuan Quintela  i386|mips|ppc)
291655d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
291755d9c04bSJuan Quintela  ;;
291855d9c04bSJuan Quintela  esac
291955d9c04bSJuan Quintelafi
292055d9c04bSJuan Quintela
292134005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \
292234005a00SKirill A. Shutemov	"$user_pie" = "yes" ; then
292334005a00SKirill A. Shutemov  cflags="-fpie $cflags"
292434005a00SKirill A. Shutemov  ldflags="-pie $ldflags"
292534005a00SKirill A. Shutemovfi
292634005a00SKirill A. Shutemov
2927471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \
2928471857ddSJuan Quintela        "$TARGET_ARCH" = "microblaze" -o \
2929471857ddSJuan Quintela        "$TARGET_ARCH" = "cris" \) ; then
293025be210fSJuan Quintela  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2931471857ddSJuan Quintelafi
2932471857ddSJuan Quintela
2933d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
293425be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
2935d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
2936d02c1db3SJuan Quintela    cflags="-p $cflags"
2937d02c1db3SJuan Quintela    ldflags="-p $ldflags"
2938d02c1db3SJuan Quintela  fi
2939d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
2940d02c1db3SJuan Quintela    ldflags="-p $ldflags"
294125be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
2942d02c1db3SJuan Quintela  fi
2943d02c1db3SJuan Quintelafi
2944d02c1db3SJuan Quintela
29456ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
29469b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2947fa282484SJuan Quintela  case "$ARCH" in
2948fa282484SJuan Quintela  sparc)
2949fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
2950322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
2951fa282484SJuan Quintela    ;;
29524d58be06SRichard Henderson  alpha | s390x)
29534d58be06SRichard Henderson    # The default placement of the application is fine.
29544d58be06SRichard Henderson    ;;
2955fd76e73aSRichard Henderson  *)
2956322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
2957fa282484SJuan Quintela    ;;
2958fa282484SJuan Quintela  esac
2959fa282484SJuan Quintelafi
2960fa282484SJuan Quintela
296125be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
296225be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2963fa282484SJuan Quintela
296497a847bcSbellarddone # for target in $targets
29657d13299dSbellard
29667d13299dSbellard# build tree in object directory if source path is different from current one
29677d13299dSbellardif test "$source_path_used" = "yes" ; then
2968e1144d00SMark McLoughlin    DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
29692d9f27d2SAnthony Liguori    DIRS="$DIRS roms/seabios roms/vgabios"
29703e230dd2SCorentin Chary    DIRS="$DIRS fsdev ui"
29717d13299dSbellard    FILES="Makefile tests/Makefile"
2972e7daa605Sths    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2973e1ffb0f1Sedgar_igl    FILES="$FILES tests/test-mmap.c"
29747ea78b74SJan Kiszka    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
29752d9f27d2SAnthony Liguori    FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
29767ea78b74SJan Kiszka    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
29777ea78b74SJan Kiszka        FILES="$FILES pc-bios/`basename $bios_file`"
29787ea78b74SJan Kiszka    done
29797d13299dSbellard    for dir in $DIRS ; do
29807d13299dSbellard            mkdir -p $dir
29817d13299dSbellard    done
2982ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
29837d13299dSbellard    for f in $FILES ; do
2984ec530c81Sbellard        rm -f $f
2985ec530c81Sbellard        ln -s $source_path/$f $f
29867d13299dSbellard    done
29877d13299dSbellardfi
29881ad2134fSPaul Brook
2989c34ebfdcSAnthony Liguori# temporary config to build submodules
29902d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
2991c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
299237116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
2993c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2994c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
2995c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
2996c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
2997c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
2998c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
2999c34ebfdcSAnthony Liguori    echo "HOST_CC=$host_cc" >> $config_mak
3000c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
3001c34ebfdcSAnthony Liguoridone
3002c34ebfdcSAnthony Liguori
30031ad2134fSPaul Brookfor hwlib in 32 64; do
30041ad2134fSPaul Brook  d=libhw$hwlib
30051ad2134fSPaul Brook  mkdir -p $d
30069953b2fcSBlue Swirl  mkdir -p $d/ide
30071ad2134fSPaul Brook  rm -f $d/Makefile
30081ad2134fSPaul Brook  ln -s $source_path/Makefile.hw $d/Makefile
300937116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
30101ad2134fSPaul Brookdone
3011add16157SBlue Swirl
3012add16157SBlue Swirld=libuser
3013add16157SBlue Swirlmkdir -p $d
3014add16157SBlue Swirlrm -f $d/Makefile
3015add16157SBlue Swirlln -s $source_path/Makefile.user $d/Makefile
3016299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then
3017299060a0SKirill A. Shutemov  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
3018299060a0SKirill A. Shutemovfi
3019b40292e7SJan Kiszka
3020b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
3021b40292e7SJan Kiszka  mkdir -p QMP
3022b40292e7SJan Kiszkafi
3023