xref: /openbmc/qemu/configure (revision d44cff22047651aefe8ea68f173e1dcbb56b07a7)
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
1802d5467eSmalctrap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15
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=""
6811d9f695Sbellardprefix=""
691e43adfcSbellardinterp_prefix="/usr/gnemul/qemu-%M"
7043ce4dfeSbellardstatic="no"
7107381cc1SAnthony Liguorisysconfdir=""
72ed968ff1SJuan Quintelasparc_cpu=""
737d13299dSbellardcross_prefix=""
747d13299dSbellardcc="gcc"
750c58ac1cSmalcaudio_drv_list=""
764c9b53e3Smalcaudio_card_list="ac97 es1370 sb16"
774c9b53e3Smalcaudio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
78eb852011SMarkus Armbrusterblock_drv_whitelist=""
797d13299dSbellardhost_cc="gcc"
807d13299dSbellardar="ar"
817d13299dSbellardmake="make"
826a882643Spbrookinstall="install"
837aa486feSAnthony Liguoriobjcopy="objcopy"
847aa486feSAnthony Liguorild="ld"
85c81da56eSJuan Quintelahelper_cflags=""
8673da375eSJuan Quintelalibs_softmmu=""
873e2e0e6bSJuan Quintelalibs_tools=""
8867f86e8eSJuan Quintelaaudio_pt_int=""
89d5631638Smalcaudio_win_int=""
90ac0df51dSaliguori
91ac0df51dSaliguori# parse CC options first
92ac0df51dSaliguorifor opt do
93ac0df51dSaliguori  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
94ac0df51dSaliguori  case "$opt" in
95ac0df51dSaliguori  --cross-prefix=*) cross_prefix="$optarg"
96ac0df51dSaliguori  ;;
97ac0df51dSaliguori  --cc=*) cc="$optarg"
98ac0df51dSaliguori  ;;
992ff6b91eSJuan Quintela  --cpu=*) cpu="$optarg"
1002ff6b91eSJuan Quintela  ;;
101a558ee17SJuan Quintela  --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
102e2a2ed06SJuan Quintela  ;;
103e2a2ed06SJuan Quintela  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
104e2a2ed06SJuan Quintela  ;;
10550e7b1a0SJuan Quintela  --sparc_cpu=*)
10650e7b1a0SJuan Quintela    sparc_cpu="$optarg"
10750e7b1a0SJuan Quintela    case $sparc_cpu in
108ed968ff1SJuan Quintela    v7|v8|v8plus|v8plusa)
10950e7b1a0SJuan Quintela      cpu="sparc"
11050e7b1a0SJuan Quintela    ;;
11150e7b1a0SJuan Quintela    v9)
11250e7b1a0SJuan Quintela      cpu="sparc64"
11350e7b1a0SJuan Quintela    ;;
11450e7b1a0SJuan Quintela    *)
11550e7b1a0SJuan Quintela      echo "undefined SPARC architecture. Exiting";
11650e7b1a0SJuan Quintela      exit 1
11750e7b1a0SJuan Quintela    ;;
11850e7b1a0SJuan Quintela    esac
11950e7b1a0SJuan Quintela  ;;
120ac0df51dSaliguori  esac
121ac0df51dSaliguoridone
122ac0df51dSaliguori# OS specific
123ac0df51dSaliguori# Using uname is really, really broken.  Once we have the right set of checks
124ac0df51dSaliguori# we can eliminate it's usage altogether
125ac0df51dSaliguori
126ac0df51dSaliguoricc="${cross_prefix}${cc}"
127ac0df51dSaliguoriar="${cross_prefix}${ar}"
1287aa486feSAnthony Liguoriobjcopy="${cross_prefix}${objcopy}"
1297aa486feSAnthony Liguorild="${cross_prefix}${ld}"
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"
198fdf7ed96Smalcelse
199fdf7ed96Smalc  cpu=`uname -m`
200ac0df51dSaliguorifi
201ac0df51dSaliguori
2025327cf48Sbellardtarget_list=""
2037d13299dSbellardcase "$cpu" in
204afa05235SAurelien Jarno  alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64)
205ea8f20f8SJuan Quintela    cpu="$cpu"
206ea8f20f8SJuan Quintela  ;;
2077d13299dSbellard  i386|i486|i586|i686|i86pc|BePC)
20897a847bcSbellard    cpu="i386"
2097d13299dSbellard  ;;
210aaa5fa14Saurel32  x86_64|amd64)
211aaa5fa14Saurel32    cpu="x86_64"
212aaa5fa14Saurel32  ;;
213ba68055eSbellard  armv*b)
214808c4954Sbellard    cpu="armv4b"
215808c4954Sbellard  ;;
216ba68055eSbellard  armv*l)
2177d13299dSbellard    cpu="armv4l"
2187d13299dSbellard  ;;
219f54b3f92Saurel32  parisc|parisc64)
220f54b3f92Saurel32    cpu="hppa"
221f54b3f92Saurel32  ;;
222afa05235SAurelien Jarno  mips*)
223afa05235SAurelien Jarno    cpu="mips"
224afa05235SAurelien Jarno  ;;
22524e804ecSAlexander Graf  s390)
226fb3e5849Sbellard    cpu="s390"
227fb3e5849Sbellard  ;;
22824e804ecSAlexander Graf  s390x)
22924e804ecSAlexander Graf    cpu="s390x"
23024e804ecSAlexander Graf  ;;
2313142255cSblueswir1  sparc|sun4[cdmuv])
232ae228531Sbellard    cpu="sparc"
233ae228531Sbellard  ;;
2347d13299dSbellard  *)
2357d13299dSbellard    cpu="unknown"
2367d13299dSbellard  ;;
2377d13299dSbellardesac
238e2d52ad3SJuan Quintela
2393a3fb96dSStefan Weil# Default value for a variable defining feature "foo".
2403a3fb96dSStefan Weil#  * foo="no"  feature will only be used if --enable-foo arg is given
2413a3fb96dSStefan Weil#  * foo=""    feature will be searched for, and if found, will be used
2423a3fb96dSStefan Weil#              unless --disable-foo is given
2433a3fb96dSStefan Weil#  * foo="yes" this value will only be set by --enable-foo flag.
2443a3fb96dSStefan Weil#              feature will searched for,
2453a3fb96dSStefan Weil#              if not found, configure exits with error
246e2d52ad3SJuan Quintela#
2473a3fb96dSStefan Weil# Always add --enable-foo and --disable-foo command line args.
2483a3fb96dSStefan Weil# Distributions want to ensure that several features are compiled in, and it
2493a3fb96dSStefan Weil# is impossible without a --enable-foo that exits if a feature is not found.
250e2d52ad3SJuan Quintela
251a20a6f46SJuan Quintelabluez=""
2524ffcedb6SJuan Quintelabrlapi=""
253788c8196SJuan Quintelacurl=""
254c584a6d0SJuan Quintelacurses=""
255a25dba17SJuan Quinteladocs=""
2562df87df7SJuan Quintelafdt=""
257b31a0277SJuan Quintelakvm=""
258dae5079aSJan Kiszkakvm_para=""
259b0a47e79SJuan Quintelanptl=""
260c4198157SJuan Quintelasdl=""
261dfffc653SJuan Quintelasparse="no"
262ee682d27SStefan Weiluuid=""
263dfb278bdSJuan Quintelavde=""
2641be10ad2SJuan Quintelavnc_tls=""
265ea784e3bSJuan Quintelavnc_sasl=""
266fc321b4bSJuan Quintelaxen=""
2675c6c3a6cSChristoph Hellwiglinux_aio=""
268d5970055SMichael S. Tsirkinvhost_net=""
269dfb278bdSJuan Quintela
2707d13299dSbellardgprof="no"
271f8393946Saurel32debug_tcg="no"
272b4475aa2SLuiz Capitulinodebug_mon="no"
273f3d08ee6SPaul Brookdebug="no"
2741625af87Saliguoristrip_opt="yes"
2757d13299dSbellardbigendian="no"
27667b915a5Sbellardmingw32="no"
27767b915a5SbellardEXESUF=""
278443f1376Sbellardslirp="yes"
279102a52e4Sbellardfmod_lib=""
280102a52e4Sbellardfmod_inc=""
2812f6a1ab0Sblueswir1oss_lib=""
282b1a550a0Spbrookbsd="no"
2835327cf48Sbellardlinux="no"
284d2c7c9b8Sblueswir1solaris="no"
28505c2a3e7Sbellardprofiler="no"
2865b0753e0Sbellardcocoa="no"
2870a8e90f4Spbrooksoftmmu="yes"
288831b7825Sthslinux_user="no"
289831b7825Sthsdarwin_user="no"
29084778508Sblueswir1bsd_user="no"
291379f6698SPaul Brookguest_base=""
292c5937220Spbrookuname_release=""
293e5d355d1Saliguoriio_thread="no"
2948ff9cbf7Smalcmixemu="no"
295eac30262Saliguorikerneldir=""
296b29fe3edSmalcaix="no"
29777755340Sthsblobs="yes"
2984a19f1ecSpbrookpkgversion=""
2995495ed11SLuiz Capitulinocheck_utests="no"
30034005a00SKirill A. Shutemovuser_pie="no"
30120ff6c80SAnthony Liguorizero_malloc=""
3027d13299dSbellard
3037d13299dSbellard# OS specific
304ac0df51dSaliguoriif check_define __linux__ ; then
305ac0df51dSaliguori  targetos="Linux"
306ac0df51dSaliguorielif check_define _WIN32 ; then
307ac0df51dSaliguori  targetos='MINGW32'
308169dc5d3Sblueswir1elif check_define __OpenBSD__ ; then
309169dc5d3Sblueswir1  targetos='OpenBSD'
310169dc5d3Sblueswir1elif check_define __sun__ ; then
311169dc5d3Sblueswir1  targetos='SunOS'
312ac0df51dSaliguorielse
3137d13299dSbellard  targetos=`uname -s`
314ac0df51dSaliguorifi
3150dbfc675SJuan Quintela
3167d13299dSbellardcase $targetos in
317c326e0afSbellardCYGWIN*)
318c326e0afSbellard  mingw32="yes"
319a558ee17SJuan Quintela  QEMU_CFLAGS="-mno-cygwin $QEMU_CFLAGS"
320d5631638Smalc  audio_possible_drivers="winwave sdl"
321d5631638Smalc  audio_drv_list="winwave"
322c326e0afSbellard;;
32367b915a5SbellardMINGW32*)
32467b915a5Sbellard  mingw32="yes"
325d5631638Smalc  audio_possible_drivers="winwave dsound sdl fmod"
326d5631638Smalc  audio_drv_list="winwave"
32767b915a5Sbellard;;
3285c40d2bdSthsGNU/kFreeBSD)
329a167ba50SAurelien Jarno  bsd="yes"
3300c58ac1cSmalc  audio_drv_list="oss"
331f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
3325c40d2bdSths;;
3337d3505c5SbellardFreeBSD)
3347d3505c5Sbellard  bsd="yes"
335a167ba50SAurelien Jarno  make="gmake"
3360c58ac1cSmalc  audio_drv_list="oss"
337f34af52cSaurel32  audio_possible_drivers="oss sdl esd pa"
338f01576f1SJuergen Lock  # needed for kinfo_getvmmap(3) in libutil.h
339f01576f1SJuergen Lock  LIBS="-lutil $LIBS"
3407d3505c5Sbellard;;
341c5e97233Sblueswir1DragonFly)
342c5e97233Sblueswir1  bsd="yes"
343a167ba50SAurelien Jarno  make="gmake"
344c5e97233Sblueswir1  audio_drv_list="oss"
345c5e97233Sblueswir1  audio_possible_drivers="oss sdl esd pa"
346c5e97233Sblueswir1;;
3477d3505c5SbellardNetBSD)
3487d3505c5Sbellard  bsd="yes"
349a167ba50SAurelien Jarno  make="gmake"
3500c58ac1cSmalc  audio_drv_list="oss"
351c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3528ef92a88Sblueswir1  oss_lib="-lossaudio"
3537d3505c5Sbellard;;
3547d3505c5SbellardOpenBSD)
3557d3505c5Sbellard  bsd="yes"
356a167ba50SAurelien Jarno  make="gmake"
3570c58ac1cSmalc  audio_drv_list="oss"
358c2de5c91Smalc  audio_possible_drivers="oss sdl esd"
3592f6a1ab0Sblueswir1  oss_lib="-lossaudio"
3607d3505c5Sbellard;;
36183fb7adfSbellardDarwin)
36283fb7adfSbellard  bsd="yes"
36383fb7adfSbellard  darwin="yes"
3640dbfc675SJuan Quintela  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
3650dbfc675SJuan Quintela  # run 64-bit userspace code
366aab8588aSmalc  if [ "$cpu" = "i386" ] ; then
3671b0f9cc2Saliguori    is_x86_64=`sysctl -n hw.optional.x86_64`
368aab8588aSmalc    [ "$is_x86_64" = "1" ] && cpu=x86_64
3691b0f9cc2Saliguori  fi
3701b0f9cc2Saliguori  if [ "$cpu" = "x86_64" ] ; then
371a558ee17SJuan Quintela    QEMU_CFLAGS="-arch x86_64 $QEMU_CFLAGS"
3720c439cbfSJuan Quintela    LDFLAGS="-arch x86_64 $LDFLAGS"
3731b0f9cc2Saliguori  else
374a558ee17SJuan Quintela    QEMU_CFLAGS="-mdynamic-no-pic $QEMU_CFLAGS"
3751b0f9cc2Saliguori  fi
376831b7825Sths  darwin_user="yes"
377fd677642Sths  cocoa="yes"
3780c58ac1cSmalc  audio_drv_list="coreaudio"
379c2de5c91Smalc  audio_possible_drivers="coreaudio sdl fmod"
3800c439cbfSJuan Quintela  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
3817973f21cSJuan Quintela  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
38283fb7adfSbellard;;
383ec530c81SbellardSunOS)
384ec530c81Sbellard  solaris="yes"
385c2b84fabSths  make="gmake"
386c2b84fabSths  install="ginstall"
387fa58948dSBlue Swirl  ld="gld"
3880475a5caSths  needs_libsunmath="no"
389c2b84fabSths  solarisrev=`uname -r | cut -f2 -d.`
390ef18c883Sths  # have to select again, because `uname -m` returns i86pc
391ef18c883Sths  # even on an x86_64 box.
392ef18c883Sths  solariscpu=`isainfo -k`
393ef18c883Sths  if test "${solariscpu}" = "amd64" ; then
394ef18c883Sths    cpu="x86_64"
395ef18c883Sths  fi
396c2b84fabSths  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
3970475a5caSths    if test "$solarisrev" -le 9 ; then
3980475a5caSths      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
3990475a5caSths        needs_libsunmath="yes"
400f14bfdf9SJuan Quintela        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
401f14bfdf9SJuan Quintela        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
402f14bfdf9SJuan Quintela        LIBS="-lsunmath $LIBS"
4030475a5caSths      else
4040475a5caSths        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
4050475a5caSths        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
4060475a5caSths        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
4070475a5caSths        echo "Studio 11 can be downloaded from www.sun.com."
4080475a5caSths        exit 1
4090475a5caSths      fi
4100475a5caSths    fi
41186b2bd93Sths  fi
4126b4d2ba1Sths  if test -f /usr/include/sys/soundcard.h ; then
4130c58ac1cSmalc    audio_drv_list="oss"
4146b4d2ba1Sths  fi
415c2de5c91Smalc  audio_possible_drivers="oss sdl"
416d741429aSBlue Swirl# needed for CMSG_ macros in sys/socket.h
417d741429aSBlue Swirl  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
418d741429aSBlue Swirl# needed for TIOCWIN* defines in termios.h
419d741429aSBlue Swirl  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
420a558ee17SJuan Quintela  QEMU_CFLAGS="-std=gnu99 $QEMU_CFLAGS"
421e174c0bbSJuan Quintela  LIBS="-lsocket -lnsl -lresolv $LIBS"
422ec530c81Sbellard;;
423b29fe3edSmalcAIX)
424b29fe3edSmalc  aix="yes"
425b29fe3edSmalc  make="gmake"
426b29fe3edSmalc;;
427fb065187Sbellard*)
4280c58ac1cSmalc  audio_drv_list="oss"
429b8e59f18Smalc  audio_possible_drivers="oss alsa sdl esd pa"
4305327cf48Sbellard  linux="yes"
431831b7825Sths  linux_user="yes"
43268063649Sblueswir1  usb="linux"
43307f4ddbfSbellard  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
434c2de5c91Smalc    audio_possible_drivers="$audio_possible_drivers fmod"
435c9ec1fe4Sbellard  fi
436fb065187Sbellard;;
4377d13299dSbellardesac
4387d13299dSbellard
4397d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
440b1a550a0Spbrook  if [ "$darwin" != "yes" ] ; then
44168063649Sblueswir1    usb="bsd"
44283fb7adfSbellard  fi
44384778508Sblueswir1  bsd_user="yes"
4447d3505c5Sbellardfi
4457d3505c5Sbellard
4463457a3f8SJuan Quintelaif test "$mingw32" = "yes" ; then
4473457a3f8SJuan Quintela  EXESUF=".exe"
448a558ee17SJuan Quintela  QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
449e94a7936SStefan Weil  # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
450e94a7936SStefan Weil  QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
451884044aaSJuan Quintela  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
4523457a3f8SJuan Quintelafi
4533457a3f8SJuan Quintela
4547d13299dSbellard# find source path
455ad064840Spbrooksource_path=`dirname "$0"`
45659faef3aSbalrogsource_path_used="no"
45759faef3aSbalrogworkdir=`pwd`
458ad064840Spbrookif [ -z "$source_path" ]; then
45959faef3aSbalrog    source_path=$workdir
460ad064840Spbrookelse
461ad064840Spbrook    source_path=`cd "$source_path"; pwd`
4627d13299dSbellardfi
463724db118Spbrook[ -f "$workdir/vl.c" ] || source_path_used="yes"
4647d13299dSbellard
465487fefdbSAnthony Liguoriwerror=""
46685aa5189Sbellard
4677d13299dSbellardfor opt do
468a46e4035Spbrook  optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
4697d13299dSbellard  case "$opt" in
4702efc3265Sbellard  --help|-h) show_help=yes
4712efc3265Sbellard  ;;
472b1a550a0Spbrook  --prefix=*) prefix="$optarg"
4737d13299dSbellard  ;;
474b1a550a0Spbrook  --interp-prefix=*) interp_prefix="$optarg"
47532ce6337Sbellard  ;;
476b1a550a0Spbrook  --source-path=*) source_path="$optarg"
477ad064840Spbrook  source_path_used="yes"
4787d13299dSbellard  ;;
479ac0df51dSaliguori  --cross-prefix=*)
4807d13299dSbellard  ;;
481ac0df51dSaliguori  --cc=*)
4827d13299dSbellard  ;;
483b1a550a0Spbrook  --host-cc=*) host_cc="$optarg"
48483469015Sbellard  ;;
485b1a550a0Spbrook  --make=*) make="$optarg"
4867d13299dSbellard  ;;
4876a882643Spbrook  --install=*) install="$optarg"
4886a882643Spbrook  ;;
489e2a2ed06SJuan Quintela  --extra-cflags=*)
4907d13299dSbellard  ;;
491e2a2ed06SJuan Quintela  --extra-ldflags=*)
4927d13299dSbellard  ;;
4932ff6b91eSJuan Quintela  --cpu=*)
4947d13299dSbellard  ;;
495b1a550a0Spbrook  --target-list=*) target_list="$optarg"
496de83cd02Sbellard  ;;
4977d13299dSbellard  --enable-gprof) gprof="yes"
4987d13299dSbellard  ;;
49979427693SLoïc Minier  --static)
50079427693SLoïc Minier    static="yes"
50179427693SLoïc Minier    LDFLAGS="-static $LDFLAGS"
50243ce4dfeSbellard  ;;
503ca2fb938SAndre Przywara  --sysconfdir=*) sysconfdir="$optarg"
50407381cc1SAnthony Liguori  ;;
50597a847bcSbellard  --disable-sdl) sdl="no"
50697a847bcSbellard  ;;
507c4198157SJuan Quintela  --enable-sdl) sdl="yes"
508c4198157SJuan Quintela  ;;
509b1a550a0Spbrook  --fmod-lib=*) fmod_lib="$optarg"
510102a52e4Sbellard  ;;
511c2de5c91Smalc  --fmod-inc=*) fmod_inc="$optarg"
512c2de5c91Smalc  ;;
5132f6a1ab0Sblueswir1  --oss-lib=*) oss_lib="$optarg"
5142f6a1ab0Sblueswir1  ;;
5152fa7d3bfSmalc  --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
5160c58ac1cSmalc  ;;
5170c58ac1cSmalc  --audio-drv-list=*) audio_drv_list="$optarg"
5180c58ac1cSmalc  ;;
519eb852011SMarkus Armbruster  --block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
520eb852011SMarkus Armbruster  ;;
521f8393946Saurel32  --enable-debug-tcg) debug_tcg="yes"
522f8393946Saurel32  ;;
523f8393946Saurel32  --disable-debug-tcg) debug_tcg="no"
524f8393946Saurel32  ;;
525b4475aa2SLuiz Capitulino  --enable-debug-mon) debug_mon="yes"
526b4475aa2SLuiz Capitulino  ;;
527b4475aa2SLuiz Capitulino  --disable-debug-mon) debug_mon="no"
528b4475aa2SLuiz Capitulino  ;;
529f3d08ee6SPaul Brook  --enable-debug)
530f3d08ee6SPaul Brook      # Enable debugging options that aren't excessively noisy
531f3d08ee6SPaul Brook      debug_tcg="yes"
532b4475aa2SLuiz Capitulino      debug_mon="yes"
533f3d08ee6SPaul Brook      debug="yes"
534f3d08ee6SPaul Brook      strip_opt="no"
535f3d08ee6SPaul Brook  ;;
53603b4fe7dSaliguori  --enable-sparse) sparse="yes"
53703b4fe7dSaliguori  ;;
53803b4fe7dSaliguori  --disable-sparse) sparse="no"
53903b4fe7dSaliguori  ;;
5401625af87Saliguori  --disable-strip) strip_opt="no"
5411625af87Saliguori  ;;
5428d5d2d4cSths  --disable-vnc-tls) vnc_tls="no"
5438d5d2d4cSths  ;;
5441be10ad2SJuan Quintela  --enable-vnc-tls) vnc_tls="yes"
5451be10ad2SJuan Quintela  ;;
5462f9606b3Saliguori  --disable-vnc-sasl) vnc_sasl="no"
5472f9606b3Saliguori  ;;
548ea784e3bSJuan Quintela  --enable-vnc-sasl) vnc_sasl="yes"
549ea784e3bSJuan Quintela  ;;
550443f1376Sbellard  --disable-slirp) slirp="no"
551c20709aaSbellard  ;;
552ee682d27SStefan Weil  --disable-uuid) uuid="no"
553ee682d27SStefan Weil  ;;
554ee682d27SStefan Weil  --enable-uuid) uuid="yes"
555ee682d27SStefan Weil  ;;
556e0e6c8c0Saliguori  --disable-vde) vde="no"
5578a16d273Sths  ;;
558dfb278bdSJuan Quintela  --enable-vde) vde="yes"
559dfb278bdSJuan Quintela  ;;
560e37630caSaliguori  --disable-xen) xen="no"
561e37630caSaliguori  ;;
562fc321b4bSJuan Quintela  --enable-xen) xen="yes"
563fc321b4bSJuan Quintela  ;;
5642e4d9fb1Saurel32  --disable-brlapi) brlapi="no"
5652e4d9fb1Saurel32  ;;
5664ffcedb6SJuan Quintela  --enable-brlapi) brlapi="yes"
5674ffcedb6SJuan Quintela  ;;
568fb599c9aSbalrog  --disable-bluez) bluez="no"
569fb599c9aSbalrog  ;;
570a20a6f46SJuan Quintela  --enable-bluez) bluez="yes"
571a20a6f46SJuan Quintela  ;;
5727ba1e619Saliguori  --disable-kvm) kvm="no"
5737ba1e619Saliguori  ;;
574b31a0277SJuan Quintela  --enable-kvm) kvm="yes"
575b31a0277SJuan Quintela  ;;
57605c2a3e7Sbellard  --enable-profiler) profiler="yes"
57705c2a3e7Sbellard  ;;
578c2de5c91Smalc  --enable-cocoa)
579c2de5c91Smalc      cocoa="yes" ;
580c2de5c91Smalc      sdl="no" ;
581c2de5c91Smalc      audio_drv_list="coreaudio `echo $audio_drv_list | sed s,coreaudio,,g`"
5825b0753e0Sbellard  ;;
583cad25d69Spbrook  --disable-system) softmmu="no"
5840a8e90f4Spbrook  ;;
585cad25d69Spbrook  --enable-system) softmmu="yes"
5860a8e90f4Spbrook  ;;
5870953a80fSZachary Amsden  --disable-user)
5880953a80fSZachary Amsden      linux_user="no" ;
5890953a80fSZachary Amsden      bsd_user="no" ;
5900953a80fSZachary Amsden      darwin_user="no"
5910953a80fSZachary Amsden  ;;
5920953a80fSZachary Amsden  --enable-user) ;;
593831b7825Sths  --disable-linux-user) linux_user="no"
5940a8e90f4Spbrook  ;;
595831b7825Sths  --enable-linux-user) linux_user="yes"
596831b7825Sths  ;;
597831b7825Sths  --disable-darwin-user) darwin_user="no"
598831b7825Sths  ;;
599831b7825Sths  --enable-darwin-user) darwin_user="yes"
6000a8e90f4Spbrook  ;;
60184778508Sblueswir1  --disable-bsd-user) bsd_user="no"
60284778508Sblueswir1  ;;
60384778508Sblueswir1  --enable-bsd-user) bsd_user="yes"
60484778508Sblueswir1  ;;
605379f6698SPaul Brook  --enable-guest-base) guest_base="yes"
606379f6698SPaul Brook  ;;
607379f6698SPaul Brook  --disable-guest-base) guest_base="no"
608379f6698SPaul Brook  ;;
60934005a00SKirill A. Shutemov  --enable-user-pie) user_pie="yes"
61034005a00SKirill A. Shutemov  ;;
61134005a00SKirill A. Shutemov  --disable-user-pie) user_pie="no"
61234005a00SKirill A. Shutemov  ;;
613c5937220Spbrook  --enable-uname-release=*) uname_release="$optarg"
614c5937220Spbrook  ;;
6153142255cSblueswir1  --sparc_cpu=*)
6163142255cSblueswir1  ;;
61785aa5189Sbellard  --enable-werror) werror="yes"
61885aa5189Sbellard  ;;
61985aa5189Sbellard  --disable-werror) werror="no"
62085aa5189Sbellard  ;;
6214d3b6f6eSbalrog  --disable-curses) curses="no"
6224d3b6f6eSbalrog  ;;
623c584a6d0SJuan Quintela  --enable-curses) curses="yes"
624c584a6d0SJuan Quintela  ;;
625769ce76dSAlexander Graf  --disable-curl) curl="no"
626769ce76dSAlexander Graf  ;;
627788c8196SJuan Quintela  --enable-curl) curl="yes"
628788c8196SJuan Quintela  ;;
6292df87df7SJuan Quintela  --disable-fdt) fdt="no"
6302df87df7SJuan Quintela  ;;
6312df87df7SJuan Quintela  --enable-fdt) fdt="yes"
6322df87df7SJuan Quintela  ;;
6335495ed11SLuiz Capitulino  --disable-check-utests) check_utests="no"
6345495ed11SLuiz Capitulino  ;;
6355495ed11SLuiz Capitulino  --enable-check-utests) check_utests="yes"
6365495ed11SLuiz Capitulino  ;;
637bd0c5661Spbrook  --disable-nptl) nptl="no"
638bd0c5661Spbrook  ;;
639b0a47e79SJuan Quintela  --enable-nptl) nptl="yes"
640b0a47e79SJuan Quintela  ;;
6418ff9cbf7Smalc  --enable-mixemu) mixemu="yes"
6428ff9cbf7Smalc  ;;
6435c6c3a6cSChristoph Hellwig  --disable-linux-aio) linux_aio="no"
6445c6c3a6cSChristoph Hellwig  ;;
6455c6c3a6cSChristoph Hellwig  --enable-linux-aio) linux_aio="yes"
6465c6c3a6cSChristoph Hellwig  ;;
647e5d355d1Saliguori  --enable-io-thread) io_thread="yes"
648e5d355d1Saliguori  ;;
64977755340Sths  --disable-blobs) blobs="no"
65077755340Sths  ;;
651eac30262Saliguori  --kerneldir=*) kerneldir="$optarg"
652eac30262Saliguori  ;;
6534a19f1ecSpbrook  --with-pkgversion=*) pkgversion=" ($optarg)"
6544a19f1ecSpbrook  ;;
655a25dba17SJuan Quintela  --disable-docs) docs="no"
65670ec5dc0SAnthony Liguori  ;;
657a25dba17SJuan Quintela  --enable-docs) docs="yes"
65883a3ab8bSJuan Quintela  ;;
659d5970055SMichael S. Tsirkin  --disable-vhost-net) vhost_net="no"
660d5970055SMichael S. Tsirkin  ;;
661d5970055SMichael S. Tsirkin  --enable-vhost-net) vhost_net="yes"
662d5970055SMichael S. Tsirkin  ;;
6637f1559c6Sbalrog  *) echo "ERROR: unknown option $opt"; show_help="yes"
6647f1559c6Sbalrog  ;;
6657d13299dSbellard  esac
6667d13299dSbellarddone
6677d13299dSbellard
6683142255cSblueswir1#
6693142255cSblueswir1# If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
670a558ee17SJuan Quintela# QEMU_CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
6713142255cSblueswir1#
672379f6698SPaul Brookhost_guest_base="no"
67340293e58Sbellardcase "$cpu" in
674ed968ff1SJuan Quintela    sparc) case $sparc_cpu in
675ed968ff1SJuan Quintela           v7|v8)
676a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
677ed968ff1SJuan Quintela           ;;
678ed968ff1SJuan Quintela           v8plus|v8plusa)
679a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $QEMU_CFLAGS"
680ed968ff1SJuan Quintela           ;;
681ed968ff1SJuan Quintela           *) # sparc_cpu not defined in the command line
682a558ee17SJuan Quintela             QEMU_CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $QEMU_CFLAGS"
683ed968ff1SJuan Quintela           esac
6840c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
685a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
686762e8230Sblueswir1           if test "$solaris" = "no" ; then
687a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
688c81da56eSJuan Quintela             helper_cflags="-ffixed-i0"
689762e8230Sblueswir1           fi
6903142255cSblueswir1           ;;
691ed968ff1SJuan Quintela    sparc64)
692a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $QEMU_CFLAGS"
6930c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
694a558ee17SJuan Quintela           QEMU_CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $QEMU_CFLAGS"
695ed968ff1SJuan Quintela           if test "$solaris" != "no" ; then
696a558ee17SJuan Quintela             QEMU_CFLAGS="-ffixed-g1 $QEMU_CFLAGS"
697762e8230Sblueswir1           fi
6983142255cSblueswir1           ;;
69976d83bdeSths    s390)
700a558ee17SJuan Quintela           QEMU_CFLAGS="-march=z900 $QEMU_CFLAGS"
70176d83bdeSths           ;;
70240293e58Sbellard    i386)
703a558ee17SJuan Quintela           QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
7040c439cbfSJuan Quintela           LDFLAGS="-m32 $LDFLAGS"
705c81da56eSJuan Quintela           helper_cflags="-fomit-frame-pointer"
706379f6698SPaul Brook           host_guest_base="yes"
70740293e58Sbellard           ;;
70840293e58Sbellard    x86_64)
709a558ee17SJuan Quintela           QEMU_CFLAGS="-m64 $QEMU_CFLAGS"
7100c439cbfSJuan Quintela           LDFLAGS="-m64 $LDFLAGS"
711379f6698SPaul Brook           host_guest_base="yes"
712379f6698SPaul Brook           ;;
713379f6698SPaul Brook    arm*)
714379f6698SPaul Brook           host_guest_base="yes"
71540293e58Sbellard           ;;
716f6548c0aSmalc    ppc*)
717f6548c0aSmalc           host_guest_base="yes"
718f6548c0aSmalc           ;;
719cc01cc8eSAurelien Jarno    mips*)
720cc01cc8eSAurelien Jarno           host_guest_base="yes"
721cc01cc8eSAurelien Jarno           ;;
722477ba620SAurelien Jarno    ia64*)
723477ba620SAurelien Jarno           host_guest_base="yes"
724477ba620SAurelien Jarno           ;;
725fd76e73aSRichard Henderson    hppa*)
726fd76e73aSRichard Henderson           host_guest_base="yes"
727fd76e73aSRichard Henderson           ;;
7283142255cSblueswir1esac
7293142255cSblueswir1
730379f6698SPaul Brook[ -z "$guest_base" ] && guest_base="$host_guest_base"
731379f6698SPaul Brook
732af5db58eSpbrookif test x"$show_help" = x"yes" ; then
733af5db58eSpbrookcat << EOF
734af5db58eSpbrook
735af5db58eSpbrookUsage: configure [options]
736af5db58eSpbrookOptions: [defaults in brackets after descriptions]
737af5db58eSpbrook
738af5db58eSpbrookEOF
739af5db58eSpbrookecho "Standard options:"
740af5db58eSpbrookecho "  --help                   print this message"
741af5db58eSpbrookecho "  --prefix=PREFIX          install in PREFIX [$prefix]"
742af5db58eSpbrookecho "  --interp-prefix=PREFIX   where to find shared libraries, etc."
743af5db58eSpbrookecho "                           use %M for cpu name [$interp_prefix]"
744af5db58eSpbrookecho "  --target-list=LIST       set target list [$target_list]"
745af5db58eSpbrookecho ""
746af5db58eSpbrookecho "Advanced options (experts only):"
747af5db58eSpbrookecho "  --source-path=PATH       path of source code [$source_path]"
748af5db58eSpbrookecho "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
749af5db58eSpbrookecho "  --cc=CC                  use C compiler CC [$cc]"
750af5db58eSpbrookecho "  --host-cc=CC             use C compiler CC [$host_cc] for dyngen etc."
751a558ee17SJuan Quintelaecho "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
752e3fc14c3SJan Kiszkaecho "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
753af5db58eSpbrookecho "  --make=MAKE              use specified make [$make]"
7546a882643Spbrookecho "  --install=INSTALL        use specified install [$install]"
755af5db58eSpbrookecho "  --static                 enable static build [$static]"
75607381cc1SAnthony Liguoriecho "  --sysconfdir=PATH        install config in PATH"
757f8393946Saurel32echo "  --enable-debug-tcg       enable TCG debugging"
758f8393946Saurel32echo "  --disable-debug-tcg      disable TCG debugging (default)"
75909695a4aSStefan Weilecho "  --enable-debug           enable common debug build options"
760890b1658Saliguoriecho "  --enable-sparse          enable sparse checker"
761890b1658Saliguoriecho "  --disable-sparse         disable sparse checker (default)"
7621625af87Saliguoriecho "  --disable-strip          disable stripping binaries"
76385aa5189Sbellardecho "  --disable-werror         disable compilation abort on warning"
764fe8f78e4Sbalrogecho "  --disable-sdl            disable SDL"
765c4198157SJuan Quintelaecho "  --enable-sdl             enable SDL"
766af5db58eSpbrookecho "  --enable-cocoa           enable COCOA (Mac OS X only)"
767c2de5c91Smalcecho "  --audio-drv-list=LIST    set audio drivers list:"
768c2de5c91Smalcecho "                           Available drivers: $audio_possible_drivers"
7694c9b53e3Smalcecho "  --audio-card-list=LIST   set list of emulated audio cards [$audio_card_list]"
7704c9b53e3Smalcecho "                           Available cards: $audio_possible_cards"
771eb852011SMarkus Armbrusterecho "  --block-drv-whitelist=L  set block driver whitelist"
772eb852011SMarkus Armbrusterecho "                           (affects only QEMU, not qemu-img)"
7738ff9cbf7Smalcecho "  --enable-mixemu          enable mixer emulation"
774e37630caSaliguoriecho "  --disable-xen            disable xen backend driver support"
775fc321b4bSJuan Quintelaecho "  --enable-xen             enable xen backend driver support"
7762e4d9fb1Saurel32echo "  --disable-brlapi         disable BrlAPI"
7774ffcedb6SJuan Quintelaecho "  --enable-brlapi          enable BrlAPI"
7788d5d2d4cSthsecho "  --disable-vnc-tls        disable TLS encryption for VNC server"
7791be10ad2SJuan Quintelaecho "  --enable-vnc-tls         enable TLS encryption for VNC server"
7802f9606b3Saliguoriecho "  --disable-vnc-sasl       disable SASL encryption for VNC server"
781ea784e3bSJuan Quintelaecho "  --enable-vnc-sasl        enable SASL encryption for VNC server"
782af896aaaSpbrookecho "  --disable-curses         disable curses output"
783c584a6d0SJuan Quintelaecho "  --enable-curses          enable curses output"
784769ce76dSAlexander Grafecho "  --disable-curl           disable curl connectivity"
785788c8196SJuan Quintelaecho "  --enable-curl            enable curl connectivity"
7862df87df7SJuan Quintelaecho "  --disable-fdt            disable fdt device tree"
7872df87df7SJuan Quintelaecho "  --enable-fdt             enable fdt device tree"
7885495ed11SLuiz Capitulinoecho "  --disable-check-utests   disable check unit-tests"
7895495ed11SLuiz Capitulinoecho "  --enable-check-utests    enable check unit-tests"
790fb599c9aSbalrogecho "  --disable-bluez          disable bluez stack connectivity"
791a20a6f46SJuan Quintelaecho "  --enable-bluez           enable bluez stack connectivity"
7927ba1e619Saliguoriecho "  --disable-kvm            disable KVM acceleration support"
793b31a0277SJuan Quintelaecho "  --enable-kvm             enable KVM acceleration support"
794bd0c5661Spbrookecho "  --disable-nptl           disable usermode NPTL support"
795e5934d33SAndre Przywaraecho "  --enable-nptl            enable usermode NPTL support"
796af5db58eSpbrookecho "  --enable-system          enable all system emulation targets"
797af5db58eSpbrookecho "  --disable-system         disable all system emulation targets"
7980953a80fSZachary Amsdenecho "  --enable-user            enable supported user emulation targets"
7990953a80fSZachary Amsdenecho "  --disable-user           disable all user emulation targets"
800831b7825Sthsecho "  --enable-linux-user      enable all linux usermode emulation targets"
801831b7825Sthsecho "  --disable-linux-user     disable all linux usermode emulation targets"
802831b7825Sthsecho "  --enable-darwin-user     enable all darwin usermode emulation targets"
803831b7825Sthsecho "  --disable-darwin-user    disable all darwin usermode emulation targets"
80484778508Sblueswir1echo "  --enable-bsd-user        enable all BSD usermode emulation targets"
80584778508Sblueswir1echo "  --disable-bsd-user       disable all BSD usermode emulation targets"
806379f6698SPaul Brookecho "  --enable-guest-base      enable GUEST_BASE support for usermode"
807379f6698SPaul Brookecho "                           emulation targets"
808379f6698SPaul Brookecho "  --disable-guest-base     disable GUEST_BASE support"
80934005a00SKirill A. Shutemovecho "  --enable-user-pie        build usermode emulation targets as PIE"
81034005a00SKirill A. Shutemovecho "  --disable-user-pie       do not build usermode emulation targets as PIE"
811af5db58eSpbrookecho "  --fmod-lib               path to FMOD library"
812af5db58eSpbrookecho "  --fmod-inc               path to FMOD includes"
8132f6a1ab0Sblueswir1echo "  --oss-lib                path to OSS library"
814c5937220Spbrookecho "  --enable-uname-release=R Return R for uname -r in usermode emulation"
8153142255cSblueswir1echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
816ee682d27SStefan Weilecho "  --disable-uuid           disable uuid support"
817ee682d27SStefan Weilecho "  --enable-uuid            enable uuid support"
818e0e6c8c0Saliguoriecho "  --disable-vde            disable support for vde network"
819dfb278bdSJuan Quintelaecho "  --enable-vde             enable support for vde network"
8205c6c3a6cSChristoph Hellwigecho "  --disable-linux-aio      disable Linux AIO support"
8215c6c3a6cSChristoph Hellwigecho "  --enable-linux-aio       enable Linux AIO support"
822e5d355d1Saliguoriecho "  --enable-io-thread       enable IO thread"
82377755340Sthsecho "  --disable-blobs          disable installing provided firmware blobs"
824eac30262Saliguoriecho "  --kerneldir=PATH         look for kernel includes in PATH"
825d2807bc9SDirk Ullrichecho "  --enable-docs            enable documentation build"
826d2807bc9SDirk Ullrichecho "  --disable-docs           disable documentation build"
827d5970055SMichael S. Tsirkinecho "  --disable-vhost-net      disable vhost-net acceleration support"
828d5970055SMichael S. Tsirkinecho "  --enable-vhost-net       enable vhost-net acceleration support"
829af5db58eSpbrookecho ""
8305bf08934Sthsecho "NOTE: The object files are built at the place where configure is launched"
831af5db58eSpbrookexit 1
832af5db58eSpbrookfi
833af5db58eSpbrook
834ec530c81Sbellard#
835ec530c81Sbellard# Solaris specific configure tool chain decisions
836ec530c81Sbellard#
837ec530c81Sbellardif test "$solaris" = "yes" ; then
8386792aa11SLoïc Minier  if has $install; then
8396792aa11SLoïc Minier    :
8406792aa11SLoïc Minier  else
841ec530c81Sbellard    echo "Solaris install program not found. Use --install=/usr/ucb/install or"
842ec530c81Sbellard    echo "install fileutils from www.blastwave.org using pkg-get -i fileutils"
843ec530c81Sbellard    echo "to get ginstall which is used by default (which lives in /opt/csw/bin)"
844ec530c81Sbellard    exit 1
845ec530c81Sbellard  fi
8466792aa11SLoïc Minier  if test "`path_of $install`" = "/usr/sbin/install" ; then
847ec530c81Sbellard    echo "Error: Solaris /usr/sbin/install is not an appropriate install program."
848ec530c81Sbellard    echo "try ginstall from the GNU fileutils available from www.blastwave.org"
849ec530c81Sbellard    echo "using pkg-get -i fileutils, or use --install=/usr/ucb/install"
850ec530c81Sbellard    exit 1
851ec530c81Sbellard  fi
8526792aa11SLoïc Minier  if has ar; then
8536792aa11SLoïc Minier    :
8546792aa11SLoïc Minier  else
855ec530c81Sbellard    echo "Error: No path includes ar"
856ec530c81Sbellard    if test -f /usr/ccs/bin/ar ; then
857ec530c81Sbellard      echo "Add /usr/ccs/bin to your path and rerun configure"
858ec530c81Sbellard    fi
859ec530c81Sbellard    exit 1
860ec530c81Sbellard  fi
861ec530c81Sbellardfi
862ec530c81Sbellard
863ec530c81Sbellard
8645327cf48Sbellardif test -z "$target_list" ; then
8655327cf48Sbellard# these targets are portable
8660a8e90f4Spbrook    if [ "$softmmu" = "yes" ] ; then
8672408a527Saurel32        target_list="\
8682408a527Saurel32i386-softmmu \
8692408a527Saurel32x86_64-softmmu \
8702408a527Saurel32arm-softmmu \
8712408a527Saurel32cris-softmmu \
8722408a527Saurel32m68k-softmmu \
87372b675caSEdgar E. Iglesiasmicroblaze-softmmu \
8742408a527Saurel32mips-softmmu \
8752408a527Saurel32mipsel-softmmu \
8762408a527Saurel32mips64-softmmu \
8772408a527Saurel32mips64el-softmmu \
8782408a527Saurel32ppc-softmmu \
8792408a527Saurel32ppcemb-softmmu \
8802408a527Saurel32ppc64-softmmu \
8812408a527Saurel32sh4-softmmu \
8822408a527Saurel32sh4eb-softmmu \
8832408a527Saurel32sparc-softmmu \
8841b64fcaeSIgor V. Kovalenkosparc64-softmmu \
8852408a527Saurel32"
8860a8e90f4Spbrook    fi
8875327cf48Sbellard# the following are Linux specific
888831b7825Sths    if [ "$linux_user" = "yes" ] ; then
8892408a527Saurel32        target_list="${target_list}\
8902408a527Saurel32i386-linux-user \
8912408a527Saurel32x86_64-linux-user \
8922408a527Saurel32alpha-linux-user \
8932408a527Saurel32arm-linux-user \
8942408a527Saurel32armeb-linux-user \
8952408a527Saurel32cris-linux-user \
8962408a527Saurel32m68k-linux-user \
89772b675caSEdgar E. Iglesiasmicroblaze-linux-user \
8982408a527Saurel32mips-linux-user \
8992408a527Saurel32mipsel-linux-user \
9002408a527Saurel32ppc-linux-user \
9012408a527Saurel32ppc64-linux-user \
9022408a527Saurel32ppc64abi32-linux-user \
9032408a527Saurel32sh4-linux-user \
9042408a527Saurel32sh4eb-linux-user \
9052408a527Saurel32sparc-linux-user \
9062408a527Saurel32sparc64-linux-user \
9072408a527Saurel32sparc32plus-linux-user \
9082408a527Saurel32"
909831b7825Sths    fi
910831b7825Sths# the following are Darwin specific
911831b7825Sths    if [ "$darwin_user" = "yes" ] ; then
9122408a527Saurel32        target_list="$target_list i386-darwin-user ppc-darwin-user "
9135327cf48Sbellard    fi
91484778508Sblueswir1# the following are BSD specific
91584778508Sblueswir1    if [ "$bsd_user" = "yes" ] ; then
91684778508Sblueswir1        target_list="${target_list}\
91731fc12dfSblueswir1i386-bsd-user \
91831fc12dfSblueswir1x86_64-bsd-user \
91931fc12dfSblueswir1sparc-bsd-user \
92084778508Sblueswir1sparc64-bsd-user \
92184778508Sblueswir1"
92284778508Sblueswir1    fi
9236e20a45fSbellardelse
924b1a550a0Spbrook    target_list=`echo "$target_list" | sed -e 's/,/ /g'`
9255327cf48Sbellardfi
9260a8e90f4Spbrookif test -z "$target_list" ; then
9270a8e90f4Spbrook    echo "No targets enabled"
9280a8e90f4Spbrook    exit 1
9290a8e90f4Spbrookfi
9305327cf48Sbellard
931249247c9SJuan Quintelafeature_not_found() {
932249247c9SJuan Quintela  feature=$1
933249247c9SJuan Quintela
934249247c9SJuan Quintela  echo "ERROR"
935249247c9SJuan Quintela  echo "ERROR: User requested feature $feature"
9369332f6a2SSebastian Herbszt  echo "ERROR: configure was not able to find it"
937249247c9SJuan Quintela  echo "ERROR"
938249247c9SJuan Quintela  exit 1;
939249247c9SJuan Quintela}
940249247c9SJuan Quintela
9417d13299dSbellardif test -z "$cross_prefix" ; then
9427d13299dSbellard
9437d13299dSbellard# ---
9447d13299dSbellard# big/little endian test
9457d13299dSbellardcat > $TMPC << EOF
9467d13299dSbellard#include <inttypes.h>
9477d13299dSbellardint main(int argc, char ** argv){
9487d13299dSbellard        volatile uint32_t i=0x01234567;
9497d13299dSbellard        return (*((uint8_t*)(&i))) == 0x67;
9507d13299dSbellard}
9517d13299dSbellardEOF
9527d13299dSbellard
95352166aa0SJuan Quintelaif compile_prog "" "" ; then
9547d13299dSbellard$TMPE && bigendian="yes"
9557d13299dSbellardelse
9567d13299dSbellardecho big/little test failed
9577d13299dSbellardfi
9587d13299dSbellard
9597d13299dSbellardelse
9607d13299dSbellard
9617d13299dSbellard# if cross compiling, cannot launch a program, so make a static guess
962ea8f20f8SJuan Quintelacase "$cpu" in
96324e804ecSAlexander Graf  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
964ea8f20f8SJuan Quintela    bigendian=yes
965ea8f20f8SJuan Quintela  ;;
966ea8f20f8SJuan Quintelaesac
9677d13299dSbellard
9687d13299dSbellardfi
9697d13299dSbellard
970b6853697Sbellard# host long bits test
971b6853697Sbellardhostlongbits="32"
972ea8f20f8SJuan Quintelacase "$cpu" in
97324e804ecSAlexander Graf  x86_64|alpha|ia64|sparc64|ppc64|s390x)
974ea8f20f8SJuan Quintela    hostlongbits=64
975ea8f20f8SJuan Quintela  ;;
976ea8f20f8SJuan Quintelaesac
977b6853697Sbellard
978b0a47e79SJuan Quintela
979b0a47e79SJuan Quintela##########################################
980b0a47e79SJuan Quintela# NPTL probe
981b0a47e79SJuan Quintela
982b0a47e79SJuan Quintelaif test "$nptl" != "no" ; then
983bd0c5661Spbrook  cat > $TMPC <<EOF
984bd0c5661Spbrook#include <sched.h>
98530813ceaSpbrook#include <linux/futex.h>
986bd0c5661Spbrookvoid foo()
987bd0c5661Spbrook{
988bd0c5661Spbrook#if !defined(CLONE_SETTLS) || !defined(FUTEX_WAIT)
989bd0c5661Spbrook#error bork
990bd0c5661Spbrook#endif
991bd0c5661Spbrook}
992bd0c5661SpbrookEOF
993bd0c5661Spbrook
99452166aa0SJuan Quintela  if compile_object ; then
995b0a47e79SJuan Quintela    nptl=yes
996bd0c5661Spbrook  else
997b0a47e79SJuan Quintela    if test "$nptl" = "yes" ; then
998b0a47e79SJuan Quintela      feature_not_found "nptl"
999b0a47e79SJuan Quintela    fi
1000b0a47e79SJuan Quintela    nptl=no
1001b0a47e79SJuan Quintela  fi
1002bd0c5661Spbrookfi
1003bd0c5661Spbrook
100411d9f695Sbellard##########################################
1005ac62922eSbalrog# zlib check
1006ac62922eSbalrog
1007ac62922eSbalrogcat > $TMPC << EOF
1008ac62922eSbalrog#include <zlib.h>
1009ac62922eSbalrogint main(void) { zlibVersion(); return 0; }
1010ac62922eSbalrogEOF
101152166aa0SJuan Quintelaif compile_prog "" "-lz" ; then
1012ac62922eSbalrog    :
1013ac62922eSbalrogelse
1014ac62922eSbalrog    echo
1015ac62922eSbalrog    echo "Error: zlib check failed"
1016ac62922eSbalrog    echo "Make sure to have the zlib libs and headers installed."
1017ac62922eSbalrog    echo
1018ac62922eSbalrog    exit 1
1019ac62922eSbalrogfi
1020ac62922eSbalrog
1021ac62922eSbalrog##########################################
1022e37630caSaliguori# xen probe
1023e37630caSaliguori
1024fc321b4bSJuan Quintelaif test "$xen" != "no" ; then
1025b2266beeSJuan Quintela  xen_libs="-lxenstore -lxenctrl -lxenguest"
1026e37630caSaliguori  cat > $TMPC <<EOF
1027e37630caSaliguori#include <xenctrl.h>
1028e37630caSaliguori#include <xs.h>
1029df7a607bSChristoph Eggerint main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
1030e37630caSaliguoriEOF
103152166aa0SJuan Quintela  if compile_prog "" "$xen_libs" ; then
1032fc321b4bSJuan Quintela    xen=yes
10333efd632bSJuan Quintela    libs_softmmu="$xen_libs $libs_softmmu"
1034e37630caSaliguori  else
1035fc321b4bSJuan Quintela    if test "$xen" = "yes" ; then
1036fc321b4bSJuan Quintela      feature_not_found "xen"
1037fc321b4bSJuan Quintela    fi
1038fc321b4bSJuan Quintela    xen=no
1039e37630caSaliguori  fi
1040e37630caSaliguorifi
1041e37630caSaliguori
1042e37630caSaliguori##########################################
1043f91672e5SPaolo Bonzini# pkgconfig probe
1044f91672e5SPaolo Bonzini
1045f91672e5SPaolo Bonzinipkgconfig="${cross_prefix}pkg-config"
10460dba6195SLoïc Minierif ! has $pkgconfig; then
1047f91672e5SPaolo Bonzini  # likely not cross compiling, or hope for the best
1048f91672e5SPaolo Bonzini  pkgconfig=pkg-config
1049f91672e5SPaolo Bonzinifi
1050f91672e5SPaolo Bonzini
1051f91672e5SPaolo Bonzini##########################################
1052dfffc653SJuan Quintela# Sparse probe
1053dfffc653SJuan Quintelaif test "$sparse" != "no" ; then
10540dba6195SLoïc Minier  if has cgcc; then
1055dfffc653SJuan Quintela    sparse=yes
1056dfffc653SJuan Quintela  else
1057dfffc653SJuan Quintela    if test "$sparse" = "yes" ; then
1058dfffc653SJuan Quintela      feature_not_found "sparse"
1059dfffc653SJuan Quintela    fi
1060dfffc653SJuan Quintela    sparse=no
1061dfffc653SJuan Quintela  fi
1062dfffc653SJuan Quintelafi
1063dfffc653SJuan Quintela
1064dfffc653SJuan Quintela##########################################
106511d9f695Sbellard# SDL probe
106611d9f695Sbellard
1067fec0e3e8SStefan Weil# Look for sdl configuration program (pkg-config or sdl-config).
1068fec0e3e8SStefan Weil# Prefer variant with cross prefix if cross compiling,
1069fec0e3e8SStefan Weil# and favour pkg-config with sdl over sdl-config.
1070fec0e3e8SStefan Weilif test -n "$cross_prefix" -a $pkgconfig != pkg-config && \
1071fec0e3e8SStefan Weil     $pkgconfig sdl --modversion >/dev/null 2>&1; then
1072fec0e3e8SStefan Weil  sdlconfig="$pkgconfig sdl"
1073fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
1074fec0e3e8SStefan Weilelif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then
1075fec0e3e8SStefan Weil  sdlconfig="${cross_prefix}sdl-config"
1076fec0e3e8SStefan Weil  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1077fec0e3e8SStefan Weilelif $pkgconfig sdl --modversion >/dev/null 2>&1; then
10789316f803SPaolo Bonzini  sdlconfig="$pkgconfig sdl"
10799316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
10800dba6195SLoïc Minierelif has sdl-config; then
10819316f803SPaolo Bonzini  sdlconfig='sdl-config'
10829316f803SPaolo Bonzini  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
1083a0dfd8a4SLoïc Minierelse
1084a0dfd8a4SLoïc Minier  if test "$sdl" = "yes" ; then
1085a0dfd8a4SLoïc Minier    feature_not_found "sdl"
1086a0dfd8a4SLoïc Minier  fi
1087a0dfd8a4SLoïc Minier  sdl=no
10889316f803SPaolo Bonzinifi
108911d9f695Sbellard
10909316f803SPaolo Bonzinisdl_too_old=no
1091c4198157SJuan Quintelaif test "$sdl" != "no" ; then
109211d9f695Sbellard  cat > $TMPC << EOF
109311d9f695Sbellard#include <SDL.h>
109411d9f695Sbellard#undef main /* We don't want SDL to override our main() */
109511d9f695Sbellardint main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
109611d9f695SbellardEOF
10979316f803SPaolo Bonzini  sdl_cflags=`$sdlconfig --cflags 2> /dev/null`
109874f42e18STeLeMan  if test "$static" = "yes" ; then
109974f42e18STeLeMan    sdl_libs=`$sdlconfig --static-libs 2>/dev/null`
110074f42e18STeLeMan  else
11019316f803SPaolo Bonzini    sdl_libs=`$sdlconfig --libs 2> /dev/null`
110274f42e18STeLeMan  fi
110352166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
110411d9f695Sbellard    if test "$_sdlversion" -lt 121 ; then
110511d9f695Sbellard      sdl_too_old=yes
110611d9f695Sbellard    else
1107fd677642Sths      if test "$cocoa" = "no" ; then
110811d9f695Sbellard        sdl=yes
110911d9f695Sbellard      fi
1110fd677642Sths    fi
11117c1f25b4Sbellard
111267c274d3SPaolo Bonzini    # static link with sdl ? (note: sdl.pc's --static --libs is broken)
11131ac88f28SJuan Quintela    if test "$sdl" = "yes" -a "$static" = "yes" ; then
111467c274d3SPaolo Bonzini      if test $? = 0 && echo $sdl_libs | grep -- -laa > /dev/null; then
1115f8aa6c7bSStefan Weil         sdl_libs="$sdl_libs `aalib-config --static-libs 2>/dev/null`"
1116f8aa6c7bSStefan Weil         sdl_cflags="$sdl_cflags `aalib-config --cflags 2>/dev/null`"
111711d9f695Sbellard      fi
111852166aa0SJuan Quintela      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
11191ac88f28SJuan Quintela	:
11201ac88f28SJuan Quintela      else
11211ac88f28SJuan Quintela        sdl=no
11227c1f25b4Sbellard      fi
11237c1f25b4Sbellard    fi # static link
1124c4198157SJuan Quintela  else # sdl not found
1125c4198157SJuan Quintela    if test "$sdl" = "yes" ; then
1126c4198157SJuan Quintela      feature_not_found "sdl"
1127c4198157SJuan Quintela    fi
1128c4198157SJuan Quintela    sdl=no
11297c1f25b4Sbellard  fi # sdl compile test
1130fd677642Sthsfi
113111d9f695Sbellard
11325368a422Saliguoriif test "$sdl" = "yes" ; then
11335368a422Saliguori  cat > $TMPC <<EOF
11345368a422Saliguori#include <SDL.h>
11355368a422Saliguori#if defined(SDL_VIDEO_DRIVER_X11)
11365368a422Saliguori#include <X11/XKBlib.h>
11375368a422Saliguori#else
11385368a422Saliguori#error No x11 support
11395368a422Saliguori#endif
11405368a422Saliguoriint main(void) { return 0; }
11415368a422SaliguoriEOF
114252166aa0SJuan Quintela  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
1143681306dfSJuan Quintela    sdl_libs="$sdl_libs -lX11"
11445368a422Saliguori  fi
114507d9ac44SJuan Quintela  if test "$mingw32" = "yes" ; then
114607d9ac44SJuan Quintela    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
114707d9ac44SJuan Quintela  fi
11480705667eSJuan Quintela  libs_softmmu="$sdl_libs $libs_softmmu"
11495368a422Saliguorifi
11505368a422Saliguori
11518f28f3fbSths##########################################
11528d5d2d4cSths# VNC TLS detection
11531be10ad2SJuan Quintelaif test "$vnc_tls" != "no" ; then
1154ae6b5e5aSaliguori  cat > $TMPC <<EOF
1155ae6b5e5aSaliguori#include <gnutls/gnutls.h>
1156ae6b5e5aSaliguoriint main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
1157ae6b5e5aSaliguoriEOF
1158f91672e5SPaolo Bonzini  vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null`
1159f91672e5SPaolo Bonzini  vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null`
116052166aa0SJuan Quintela  if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
11611be10ad2SJuan Quintela    vnc_tls=yes
1162a5e32cc9SJuan Quintela    libs_softmmu="$vnc_tls_libs $libs_softmmu"
1163ae6b5e5aSaliguori  else
11641be10ad2SJuan Quintela    if test "$vnc_tls" = "yes" ; then
11651be10ad2SJuan Quintela      feature_not_found "vnc-tls"
11661be10ad2SJuan Quintela    fi
11671be10ad2SJuan Quintela    vnc_tls=no
11688d5d2d4cSths  fi
11698d5d2d4cSthsfi
11708d5d2d4cSths
11718d5d2d4cSths##########################################
11722f9606b3Saliguori# VNC SASL detection
11733aefa744SJuan Quintelaif test "$vnc_sasl" != "no" ; then
11742f9606b3Saliguori  cat > $TMPC <<EOF
11752f9606b3Saliguori#include <sasl/sasl.h>
11762f9606b3Saliguori#include <stdio.h>
11772f9606b3Saliguoriint main(void) { sasl_server_init(NULL, "qemu"); return 0; }
11782f9606b3SaliguoriEOF
11792f9606b3Saliguori  # Assuming Cyrus-SASL installed in /usr prefix
11802f9606b3Saliguori  vnc_sasl_cflags=""
11812f9606b3Saliguori  vnc_sasl_libs="-lsasl2"
118252166aa0SJuan Quintela  if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
1183ea784e3bSJuan Quintela    vnc_sasl=yes
1184fa838301SJuan Quintela    libs_softmmu="$vnc_sasl_libs $libs_softmmu"
11852f9606b3Saliguori  else
1186ea784e3bSJuan Quintela    if test "$vnc_sasl" = "yes" ; then
1187ea784e3bSJuan Quintela      feature_not_found "vnc-sasl"
1188ea784e3bSJuan Quintela    fi
1189ea784e3bSJuan Quintela    vnc_sasl=no
11902f9606b3Saliguori  fi
11912f9606b3Saliguorifi
11922f9606b3Saliguori
11932f9606b3Saliguori##########################################
119476655d6dSaliguori# fnmatch() probe, used for ACL routines
119576655d6dSaliguorifnmatch="no"
119676655d6dSaliguoricat > $TMPC << EOF
119776655d6dSaliguori#include <fnmatch.h>
119876655d6dSaliguoriint main(void)
119976655d6dSaliguori{
120076655d6dSaliguori    fnmatch("foo", "foo", 0);
120176655d6dSaliguori    return 0;
120276655d6dSaliguori}
120376655d6dSaliguoriEOF
120452166aa0SJuan Quintelaif compile_prog "" "" ; then
120576655d6dSaliguori   fnmatch="yes"
120676655d6dSaliguorifi
120776655d6dSaliguori
120876655d6dSaliguori##########################################
1209ee682d27SStefan Weil# uuid_generate() probe, used for vdi block driver
1210ee682d27SStefan Weilif test "$uuid" != "no" ; then
1211ee682d27SStefan Weil  uuid_libs="-luuid"
1212ee682d27SStefan Weil  cat > $TMPC << EOF
1213ee682d27SStefan Weil#include <uuid/uuid.h>
1214ee682d27SStefan Weilint main(void)
1215ee682d27SStefan Weil{
1216ee682d27SStefan Weil    uuid_t my_uuid;
1217ee682d27SStefan Weil    uuid_generate(my_uuid);
1218ee682d27SStefan Weil    return 0;
1219ee682d27SStefan Weil}
1220ee682d27SStefan WeilEOF
1221ee682d27SStefan Weil  if compile_prog "" "$uuid_libs" ; then
1222ee682d27SStefan Weil    uuid="yes"
1223ee682d27SStefan Weil    libs_softmmu="$uuid_libs $libs_softmmu"
1224ee682d27SStefan Weil    libs_tools="$uuid_libs $libs_tools"
1225ee682d27SStefan Weil  else
1226ee682d27SStefan Weil    if test "$uuid" = "yes" ; then
1227ee682d27SStefan Weil      feature_not_found "uuid"
1228ee682d27SStefan Weil    fi
1229ee682d27SStefan Weil    uuid=no
1230ee682d27SStefan Weil  fi
1231ee682d27SStefan Weilfi
1232ee682d27SStefan Weil
1233ee682d27SStefan Weil##########################################
12348a16d273Sths# vde libraries probe
1235dfb278bdSJuan Quintelaif test "$vde" != "no" ; then
12364baae0acSJuan Quintela  vde_libs="-lvdeplug"
12378a16d273Sths  cat > $TMPC << EOF
12388a16d273Sths#include <libvdeplug.h>
12394a7f0e06Spbrookint main(void)
12404a7f0e06Spbrook{
12414a7f0e06Spbrook    struct vde_open_args a = {0, 0, 0};
12424a7f0e06Spbrook    vde_open("", "", &a);
12434a7f0e06Spbrook    return 0;
12444a7f0e06Spbrook}
12458a16d273SthsEOF
124652166aa0SJuan Quintela  if compile_prog "" "$vde_libs" ; then
12474baae0acSJuan Quintela    vde=yes
12488e02e54cSJuan Quintela    libs_softmmu="$vde_libs $libs_softmmu"
12498e02e54cSJuan Quintela    libs_tools="$vde_libs $libs_tools"
1250dfb278bdSJuan Quintela  else
1251dfb278bdSJuan Quintela    if test "$vde" = "yes" ; then
1252dfb278bdSJuan Quintela      feature_not_found "vde"
1253dfb278bdSJuan Quintela    fi
1254dfb278bdSJuan Quintela    vde=no
12558a16d273Sths  fi
12568a16d273Sthsfi
12578a16d273Sths
12588a16d273Sths##########################################
1259c2de5c91Smalc# Sound support libraries probe
12608f28f3fbSths
1261c2de5c91Smalcaudio_drv_probe()
1262c2de5c91Smalc{
1263c2de5c91Smalc    drv=$1
1264c2de5c91Smalc    hdr=$2
1265c2de5c91Smalc    lib=$3
1266c2de5c91Smalc    exp=$4
1267c2de5c91Smalc    cfl=$5
12688f28f3fbSths        cat > $TMPC << EOF
1269c2de5c91Smalc#include <$hdr>
1270c2de5c91Smalcint main(void) { $exp }
12718f28f3fbSthsEOF
127252166aa0SJuan Quintela    if compile_prog "$cfl" "$lib" ; then
12738f28f3fbSths        :
12748f28f3fbSths    else
12758f28f3fbSths        echo
1276c2de5c91Smalc        echo "Error: $drv check failed"
1277c2de5c91Smalc        echo "Make sure to have the $drv libs and headers installed."
12788f28f3fbSths        echo
12798f28f3fbSths        exit 1
12808f28f3fbSths    fi
1281c2de5c91Smalc}
1282c2de5c91Smalc
12832fa7d3bfSmalcaudio_drv_list=`echo "$audio_drv_list" | sed -e 's/,/ /g'`
1284c2de5c91Smalcfor drv in $audio_drv_list; do
1285c2de5c91Smalc    case $drv in
1286c2de5c91Smalc    alsa)
1287c2de5c91Smalc    audio_drv_probe $drv alsa/asoundlib.h -lasound \
1288c2de5c91Smalc        "snd_pcm_t **handle; return snd_pcm_close(*handle);"
1289a4bf6780SJuan Quintela    libs_softmmu="-lasound $libs_softmmu"
1290c2de5c91Smalc    ;;
1291c2de5c91Smalc
1292c2de5c91Smalc    fmod)
1293c2de5c91Smalc    if test -z $fmod_lib || test -z $fmod_inc; then
1294c2de5c91Smalc        echo
1295c2de5c91Smalc        echo "Error: You must specify path to FMOD library and headers"
1296c2de5c91Smalc        echo "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so"
1297c2de5c91Smalc        echo
1298c2de5c91Smalc        exit 1
12998f28f3fbSths    fi
1300c2de5c91Smalc    audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
1301a4bf6780SJuan Quintela    libs_softmmu="$fmod_lib $libs_softmmu"
1302c2de5c91Smalc    ;;
1303c2de5c91Smalc
1304c2de5c91Smalc    esd)
1305c2de5c91Smalc    audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
1306a4bf6780SJuan Quintela    libs_softmmu="-lesd $libs_softmmu"
130767f86e8eSJuan Quintela    audio_pt_int="yes"
1308c2de5c91Smalc    ;;
1309b8e59f18Smalc
1310b8e59f18Smalc    pa)
1311493abda6SAurelien Jarno    audio_drv_probe $drv pulse/simple.h "-lpulse-simple -lpulse" \
1312b8e59f18Smalc        "pa_simple *s = NULL; pa_simple_free(s); return 0;"
1313493abda6SAurelien Jarno    libs_softmmu="-lpulse -lpulse-simple $libs_softmmu"
131467f86e8eSJuan Quintela    audio_pt_int="yes"
1315b8e59f18Smalc    ;;
1316b8e59f18Smalc
1317997e690aSJuan Quintela    coreaudio)
1318997e690aSJuan Quintela      libs_softmmu="-framework CoreAudio $libs_softmmu"
1319997e690aSJuan Quintela    ;;
1320997e690aSJuan Quintela
1321a4bf6780SJuan Quintela    dsound)
1322a4bf6780SJuan Quintela      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
1323d5631638Smalc      audio_win_int="yes"
1324a4bf6780SJuan Quintela    ;;
1325a4bf6780SJuan Quintela
1326a4bf6780SJuan Quintela    oss)
1327a4bf6780SJuan Quintela      libs_softmmu="$oss_lib $libs_softmmu"
1328a4bf6780SJuan Quintela    ;;
1329a4bf6780SJuan Quintela
1330a4bf6780SJuan Quintela    sdl|wav)
13312f6a1ab0Sblueswir1    # XXX: Probes for CoreAudio, DirectSound, SDL(?)
13322f6a1ab0Sblueswir1    ;;
13332f6a1ab0Sblueswir1
1334d5631638Smalc    winwave)
1335d5631638Smalc      libs_softmmu="-lwinmm $libs_softmmu"
1336d5631638Smalc      audio_win_int="yes"
1337d5631638Smalc    ;;
1338d5631638Smalc
1339e4c63a6aSmalc    *)
13401c9b2a52Smalc    echo "$audio_possible_drivers" | grep -q "\<$drv\>" || {
1341e4c63a6aSmalc        echo
1342e4c63a6aSmalc        echo "Error: Unknown driver '$drv' selected"
1343e4c63a6aSmalc        echo "Possible drivers are: $audio_possible_drivers"
1344e4c63a6aSmalc        echo
1345e4c63a6aSmalc        exit 1
1346e4c63a6aSmalc    }
1347e4c63a6aSmalc    ;;
1348c2de5c91Smalc    esac
1349c2de5c91Smalcdone
13508f28f3fbSths
13514d3b6f6eSbalrog##########################################
13522e4d9fb1Saurel32# BrlAPI probe
13532e4d9fb1Saurel32
13544ffcedb6SJuan Quintelaif test "$brlapi" != "no" ; then
1355eb82284fSJuan Quintela  brlapi_libs="-lbrlapi"
13562e4d9fb1Saurel32  cat > $TMPC << EOF
13572e4d9fb1Saurel32#include <brlapi.h>
13582e4d9fb1Saurel32int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
13592e4d9fb1Saurel32EOF
136052166aa0SJuan Quintela  if compile_prog "" "$brlapi_libs" ; then
13612e4d9fb1Saurel32    brlapi=yes
1362264606b3SJuan Quintela    libs_softmmu="$brlapi_libs $libs_softmmu"
13634ffcedb6SJuan Quintela  else
13644ffcedb6SJuan Quintela    if test "$brlapi" = "yes" ; then
13654ffcedb6SJuan Quintela      feature_not_found "brlapi"
13664ffcedb6SJuan Quintela    fi
13674ffcedb6SJuan Quintela    brlapi=no
1368eb82284fSJuan Quintela  fi
1369eb82284fSJuan Quintelafi
13702e4d9fb1Saurel32
13712e4d9fb1Saurel32##########################################
13724d3b6f6eSbalrog# curses probe
13734f78ef9aSJuan Quintelacurses_list="-lncurses -lcurses"
13744d3b6f6eSbalrog
1375c584a6d0SJuan Quintelaif test "$curses" != "no" ; then
1376c584a6d0SJuan Quintela  curses_found=no
13774d3b6f6eSbalrog  cat > $TMPC << EOF
13784d3b6f6eSbalrog#include <curses.h>
13795a8ff3aaSblueswir1#ifdef __OpenBSD__
13805a8ff3aaSblueswir1#define resize_term resizeterm
13815a8ff3aaSblueswir1#endif
13825a8ff3aaSblueswir1int main(void) { resize_term(0, 0); return curses_version(); }
13834d3b6f6eSbalrogEOF
13844f78ef9aSJuan Quintela  for curses_lib in $curses_list; do
13854f78ef9aSJuan Quintela    if compile_prog "" "$curses_lib" ; then
1386c584a6d0SJuan Quintela      curses_found=yes
13874f78ef9aSJuan Quintela      libs_softmmu="$curses_lib $libs_softmmu"
13884f78ef9aSJuan Quintela      break
13894d3b6f6eSbalrog    fi
13904f78ef9aSJuan Quintela  done
1391c584a6d0SJuan Quintela  if test "$curses_found" = "yes" ; then
1392c584a6d0SJuan Quintela    curses=yes
1393c584a6d0SJuan Quintela  else
1394c584a6d0SJuan Quintela    if test "$curses" = "yes" ; then
1395c584a6d0SJuan Quintela      feature_not_found "curses"
1396c584a6d0SJuan Quintela    fi
1397c584a6d0SJuan Quintela    curses=no
1398c584a6d0SJuan Quintela  fi
13994f78ef9aSJuan Quintelafi
14004d3b6f6eSbalrog
1401414f0dabSblueswir1##########################################
1402769ce76dSAlexander Graf# curl probe
1403769ce76dSAlexander Graf
14044e2b0658SPaolo Bonziniif $pkgconfig libcurl --modversion >/dev/null 2>&1; then
14054e2b0658SPaolo Bonzini  curlconfig="$pkgconfig libcurl"
14064e2b0658SPaolo Bonzinielse
14074e2b0658SPaolo Bonzini  curlconfig=curl-config
14084e2b0658SPaolo Bonzinifi
14094e2b0658SPaolo Bonzini
1410788c8196SJuan Quintelaif test "$curl" != "no" ; then
1411769ce76dSAlexander Graf  cat > $TMPC << EOF
1412769ce76dSAlexander Graf#include <curl/curl.h>
1413769ce76dSAlexander Grafint main(void) { return curl_easy_init(); }
1414769ce76dSAlexander GrafEOF
14154e2b0658SPaolo Bonzini  curl_cflags=`$curlconfig --cflags 2>/dev/null`
14164e2b0658SPaolo Bonzini  curl_libs=`$curlconfig --libs 2>/dev/null`
1417b1d5a277SJuan Quintela  if compile_prog "$curl_cflags" "$curl_libs" ; then
1418769ce76dSAlexander Graf    curl=yes
1419f0302935SJuan Quintela    libs_tools="$curl_libs $libs_tools"
1420f0302935SJuan Quintela    libs_softmmu="$curl_libs $libs_softmmu"
1421788c8196SJuan Quintela  else
1422788c8196SJuan Quintela    if test "$curl" = "yes" ; then
1423788c8196SJuan Quintela      feature_not_found "curl"
1424788c8196SJuan Quintela    fi
1425788c8196SJuan Quintela    curl=no
1426769ce76dSAlexander Graf  fi
1427769ce76dSAlexander Graffi # test "$curl"
1428769ce76dSAlexander Graf
1429769ce76dSAlexander Graf##########################################
14305495ed11SLuiz Capitulino# check framework probe
14315495ed11SLuiz Capitulino
14325495ed11SLuiz Capitulinoif test "$check_utests" != "no" ; then
14335495ed11SLuiz Capitulino  cat > $TMPC << EOF
14345495ed11SLuiz Capitulino#include <check.h>
14355495ed11SLuiz Capitulinoint main(void) { suite_create("qemu test"); return 0; }
14365495ed11SLuiz CapitulinoEOF
1437f91672e5SPaolo Bonzini  check_libs=`$pkgconfig --libs check`
14385495ed11SLuiz Capitulino  if compile_prog "" $check_libs ; then
14395495ed11SLuiz Capitulino    check_utests=yes
14405495ed11SLuiz Capitulino    libs_tools="$check_libs $libs_tools"
14415495ed11SLuiz Capitulino  else
14425495ed11SLuiz Capitulino    if test "$check_utests" = "yes" ; then
14435495ed11SLuiz Capitulino      feature_not_found "check"
14445495ed11SLuiz Capitulino    fi
14455495ed11SLuiz Capitulino    check_utests=no
14465495ed11SLuiz Capitulino  fi
14475495ed11SLuiz Capitulinofi # test "$check_utests"
14485495ed11SLuiz Capitulino
14495495ed11SLuiz Capitulino##########################################
1450fb599c9aSbalrog# bluez support probe
1451a20a6f46SJuan Quintelaif test "$bluez" != "no" ; then
1452e820e3f4Sbalrog  cat > $TMPC << EOF
1453e820e3f4Sbalrog#include <bluetooth/bluetooth.h>
1454e820e3f4Sbalrogint main(void) { return bt_error(0); }
1455e820e3f4SbalrogEOF
1456f91672e5SPaolo Bonzini  bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null`
1457f91672e5SPaolo Bonzini  bluez_libs=`$pkgconfig --libs bluez 2> /dev/null`
145852166aa0SJuan Quintela  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
1459a20a6f46SJuan Quintela    bluez=yes
1460e482d56aSJuan Quintela    libs_softmmu="$bluez_libs $libs_softmmu"
1461e820e3f4Sbalrog  else
1462a20a6f46SJuan Quintela    if test "$bluez" = "yes" ; then
1463a20a6f46SJuan Quintela      feature_not_found "bluez"
1464a20a6f46SJuan Quintela    fi
1465e820e3f4Sbalrog    bluez="no"
1466e820e3f4Sbalrog  fi
1467fb599c9aSbalrogfi
1468fb599c9aSbalrog
1469fb599c9aSbalrog##########################################
14707ba1e619Saliguori# kvm probe
1471b31a0277SJuan Quintelaif test "$kvm" != "no" ; then
14727ba1e619Saliguori    cat > $TMPC <<EOF
14737ba1e619Saliguori#include <linux/kvm.h>
14749fd8d8d7Saliguori#if !defined(KVM_API_VERSION) || KVM_API_VERSION < 12 || KVM_API_VERSION > 12
14757ba1e619Saliguori#error Invalid KVM version
14767ba1e619Saliguori#endif
14779fd8d8d7Saliguori#if !defined(KVM_CAP_USER_MEMORY)
14789fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_USER_MEMORY
14799fd8d8d7Saliguori#endif
14809fd8d8d7Saliguori#if !defined(KVM_CAP_SET_TSS_ADDR)
14819fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_SET_TSS_ADDR
14829fd8d8d7Saliguori#endif
14839fd8d8d7Saliguori#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
14849fd8d8d7Saliguori#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
14859fd8d8d7Saliguori#endif
14867ba1e619Saliguoriint main(void) { return 0; }
14877ba1e619SaliguoriEOF
1488eac30262Saliguori  if test "$kerneldir" != "" ; then
1489eac30262Saliguori      kvm_cflags=-I"$kerneldir"/include
14908444eb6eSaliguori      if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \
14918444eb6eSaliguori         -a -d "$kerneldir/arch/x86/include" ; then
14928444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include"
1493406b430dSaliguori	elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then
1494406b430dSaliguori	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include"
14950e60a699SAlexander Graf	elif test "$cpu" = "s390x" -a -d "$kerneldir/arch/s390/include" ; then
14960e60a699SAlexander Graf	    kvm_cflags="$kvm_cflags -I$kerneldir/arch/s390/include"
14978444eb6eSaliguori        elif test -d "$kerneldir/arch/$cpu/include" ; then
14988444eb6eSaliguori            kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include"
14998444eb6eSaliguori      fi
1500eac30262Saliguori  else
1501f038e8f7SStefan Weil    kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null`
1502eac30262Saliguori  fi
150352166aa0SJuan Quintela  if compile_prog "$kvm_cflags" "" ; then
1504b31a0277SJuan Quintela    kvm=yes
1505dae5079aSJan Kiszka    cat > $TMPC <<EOF
1506dae5079aSJan Kiszka#include <linux/kvm_para.h>
1507dae5079aSJan Kiszkaint main(void) { return 0; }
1508dae5079aSJan KiszkaEOF
1509dae5079aSJan Kiszka    if compile_prog "$kvm_cflags" "" ; then
1510dae5079aSJan Kiszka      kvm_para=yes
1511dae5079aSJan Kiszka    fi
15127ba1e619Saliguori  else
1513b31a0277SJuan Quintela    if test "$kvm" = "yes" ; then
15140dba6195SLoïc Minier      if has awk && has grep; then
1515a558ee17SJuan Quintela        kvmerr=`LANG=C $cc $QEMU_CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
15169fd8d8d7Saliguori	| grep "error: " \
15179fd8d8d7Saliguori	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
15189fd8d8d7Saliguori        if test "$kvmerr" != "" ; then
1519b31a0277SJuan Quintela          echo -e "${kvmerr}\n\
1520168ccc11SJan Kiszka      NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \
1521168ccc11SJan Kiszka  recent kvm-kmod from http://sourceforge.net/projects/kvm."
15229fd8d8d7Saliguori        fi
15239fd8d8d7Saliguori      fi
1524b31a0277SJuan Quintela      feature_not_found "kvm"
1525b31a0277SJuan Quintela    fi
1526b31a0277SJuan Quintela    kvm=no
15277ba1e619Saliguori  fi
15287ba1e619Saliguorifi
15297ba1e619Saliguori
15307ba1e619Saliguori##########################################
1531d5970055SMichael S. Tsirkin# test for vhost net
1532d5970055SMichael S. Tsirkin
1533d5970055SMichael S. Tsirkinif test "$vhost_net" != "no"; then
1534d5970055SMichael S. Tsirkin    if test "$kvm" != "no"; then
1535d5970055SMichael S. Tsirkin            cat > $TMPC <<EOF
1536d5970055SMichael S. Tsirkin    #include <linux/vhost.h>
1537d5970055SMichael S. Tsirkin    int main(void) { return 0; }
1538d5970055SMichael S. TsirkinEOF
1539d5970055SMichael S. Tsirkin            if compile_prog "$kvm_cflags" "" ; then
1540d5970055SMichael S. Tsirkin                vhost_net=yes
1541d5970055SMichael S. Tsirkin            else
1542d5970055SMichael S. Tsirkin                if test "$vhost_net" = "yes" ; then
1543d5970055SMichael S. Tsirkin                    feature_not_found "vhost-net"
1544d5970055SMichael S. Tsirkin                fi
1545d5970055SMichael S. Tsirkin                vhost_net=no
1546d5970055SMichael S. Tsirkin            fi
1547d5970055SMichael S. Tsirkin    else
1548d5970055SMichael S. Tsirkin            if test "$vhost_net" = "yes" ; then
1549d5970055SMichael S. Tsirkin                echo -e "NOTE: vhost-net feature requires KVM (--enable-kvm)."
1550d5970055SMichael S. Tsirkin                feature_not_found "vhost-net"
1551d5970055SMichael S. Tsirkin            fi
1552d5970055SMichael S. Tsirkin            vhost_net=no
1553d5970055SMichael S. Tsirkin    fi
1554d5970055SMichael S. Tsirkinfi
1555d5970055SMichael S. Tsirkin
1556d5970055SMichael S. Tsirkin##########################################
1557e5d355d1Saliguori# pthread probe
1558de65fe0fSSebastian HerbsztPTHREADLIBS_LIST="-lpthread -lpthreadGC2"
15593c529d93Saliguori
1560e5d355d1Saliguoripthread=no
1561414f0dabSblueswir1cat > $TMPC << EOF
15623c529d93Saliguori#include <pthread.h>
1563de65fe0fSSebastian Herbsztint main(void) { pthread_create(0,0,0,0); return 0; }
1564414f0dabSblueswir1EOF
1565de65fe0fSSebastian Herbsztfor pthread_lib in $PTHREADLIBS_LIST; do
156652166aa0SJuan Quintela  if compile_prog "" "$pthread_lib" ; then
1567e5d355d1Saliguori    pthread=yes
15685572b539SJuan Quintela    LIBS="$pthread_lib $LIBS"
1569de65fe0fSSebastian Herbszt    break
1570414f0dabSblueswir1  fi
1571de65fe0fSSebastian Herbsztdone
1572414f0dabSblueswir1
15734617e593SAnthony Liguoriif test "$mingw32" != yes -a "$pthread" = no; then
15744dd75c70SChristoph Hellwig  echo
15754dd75c70SChristoph Hellwig  echo "Error: pthread check failed"
15764dd75c70SChristoph Hellwig  echo "Make sure to have the pthread libs and headers installed."
15774dd75c70SChristoph Hellwig  echo
15784dd75c70SChristoph Hellwig  exit 1
1579e5d355d1Saliguorifi
1580e5d355d1Saliguori
1581bf9298b9Saliguori##########################################
15825c6c3a6cSChristoph Hellwig# linux-aio probe
15835c6c3a6cSChristoph Hellwig
15845c6c3a6cSChristoph Hellwigif test "$linux_aio" != "no" ; then
15855c6c3a6cSChristoph Hellwig  cat > $TMPC <<EOF
15865c6c3a6cSChristoph Hellwig#include <libaio.h>
15875c6c3a6cSChristoph Hellwig#include <sys/eventfd.h>
15885c6c3a6cSChristoph Hellwigint main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); return 0; }
15895c6c3a6cSChristoph HellwigEOF
15905c6c3a6cSChristoph Hellwig  if compile_prog "" "-laio" ; then
15915c6c3a6cSChristoph Hellwig    linux_aio=yes
1592048d179fSPaul Brook    libs_softmmu="$libs_softmmu -laio"
1593048d179fSPaul Brook    libs_tools="$libs_tools -laio"
15945c6c3a6cSChristoph Hellwig  else
15955c6c3a6cSChristoph Hellwig    if test "$linux_aio" = "yes" ; then
15965c6c3a6cSChristoph Hellwig      feature_not_found "linux AIO"
15975c6c3a6cSChristoph Hellwig    fi
15983cfcae3cSLuiz Capitulino    linux_aio=no
15995c6c3a6cSChristoph Hellwig  fi
16005c6c3a6cSChristoph Hellwigfi
16015c6c3a6cSChristoph Hellwig
16025c6c3a6cSChristoph Hellwig##########################################
1603bf9298b9Saliguori# iovec probe
1604bf9298b9Saliguoricat > $TMPC <<EOF
1605db34f0b3Sblueswir1#include <sys/types.h>
1606bf9298b9Saliguori#include <sys/uio.h>
1607db34f0b3Sblueswir1#include <unistd.h>
1608bf9298b9Saliguoriint main(void) { struct iovec iov; return 0; }
1609bf9298b9SaliguoriEOF
1610bf9298b9Saliguoriiovec=no
161152166aa0SJuan Quintelaif compile_prog "" "" ; then
1612bf9298b9Saliguori  iovec=yes
1613bf9298b9Saliguorifi
1614bf9298b9Saliguori
1615f652e6afSaurel32##########################################
1616ceb42de8Saliguori# preadv probe
1617ceb42de8Saliguoricat > $TMPC <<EOF
1618ceb42de8Saliguori#include <sys/types.h>
1619ceb42de8Saliguori#include <sys/uio.h>
1620ceb42de8Saliguori#include <unistd.h>
1621ceb42de8Saliguoriint main(void) { preadv; }
1622ceb42de8SaliguoriEOF
1623ceb42de8Saliguoripreadv=no
162452166aa0SJuan Quintelaif compile_prog "" "" ; then
1625ceb42de8Saliguori  preadv=yes
1626ceb42de8Saliguorifi
1627ceb42de8Saliguori
1628ceb42de8Saliguori##########################################
1629f652e6afSaurel32# fdt probe
16302df87df7SJuan Quintelaif test "$fdt" != "no" ; then
1631b41af4baSJuan Quintela  fdt_libs="-lfdt"
1632f652e6afSaurel32  cat > $TMPC << EOF
1633f652e6afSaurel32int main(void) { return 0; }
1634f652e6afSaurel32EOF
163552166aa0SJuan Quintela  if compile_prog "" "$fdt_libs" ; then
1636f652e6afSaurel32    fdt=yes
1637e4782985SJuan Quintela    libs_softmmu="$fdt_libs $libs_softmmu"
16382df87df7SJuan Quintela  else
16392df87df7SJuan Quintela    if test "$fdt" = "yes" ; then
16402df87df7SJuan Quintela      feature_not_found "fdt"
16412df87df7SJuan Quintela    fi
16422df87df7SJuan Quintela    fdt=no
1643f652e6afSaurel32  fi
1644f652e6afSaurel32fi
1645f652e6afSaurel32
16463b3f24adSaurel32#
16473b3f24adSaurel32# Check for xxxat() functions when we are building linux-user
16483b3f24adSaurel32# emulator.  This is done because older glibc versions don't
16493b3f24adSaurel32# have syscall stubs for these implemented.
16503b3f24adSaurel32#
16513b3f24adSaurel32atfile=no
16523b3f24adSaurel32cat > $TMPC << EOF
16533b3f24adSaurel32#define _ATFILE_SOURCE
16543b3f24adSaurel32#include <sys/types.h>
16553b3f24adSaurel32#include <fcntl.h>
16563b3f24adSaurel32#include <unistd.h>
16573b3f24adSaurel32
16583b3f24adSaurel32int
16593b3f24adSaurel32main(void)
16603b3f24adSaurel32{
16613b3f24adSaurel32	/* try to unlink nonexisting file */
16623b3f24adSaurel32	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
16633b3f24adSaurel32}
16643b3f24adSaurel32EOF
166552166aa0SJuan Quintelaif compile_prog "" "" ; then
16663b3f24adSaurel32  atfile=yes
16673b3f24adSaurel32fi
16683b3f24adSaurel32
166939386ac7Saurel32# Check for inotify functions when we are building linux-user
16703b3f24adSaurel32# emulator.  This is done because older glibc versions don't
16713b3f24adSaurel32# have syscall stubs for these implemented.  In that case we
16723b3f24adSaurel32# don't provide them even if kernel supports them.
16733b3f24adSaurel32#
16743b3f24adSaurel32inotify=no
16753b3f24adSaurel32cat > $TMPC << EOF
16763b3f24adSaurel32#include <sys/inotify.h>
16773b3f24adSaurel32
16783b3f24adSaurel32int
16793b3f24adSaurel32main(void)
16803b3f24adSaurel32{
16813b3f24adSaurel32	/* try to start inotify */
16828690e420Saurel32	return inotify_init();
16833b3f24adSaurel32}
16843b3f24adSaurel32EOF
168552166aa0SJuan Quintelaif compile_prog "" "" ; then
16863b3f24adSaurel32  inotify=yes
16873b3f24adSaurel32fi
16883b3f24adSaurel32
1689c05c7a73SRiku Voipioinotify1=no
1690c05c7a73SRiku Voipiocat > $TMPC << EOF
1691c05c7a73SRiku Voipio#include <sys/inotify.h>
1692c05c7a73SRiku Voipio
1693c05c7a73SRiku Voipioint
1694c05c7a73SRiku Voipiomain(void)
1695c05c7a73SRiku Voipio{
1696c05c7a73SRiku Voipio    /* try to start inotify */
1697c05c7a73SRiku Voipio    return inotify_init1(0);
1698c05c7a73SRiku Voipio}
1699c05c7a73SRiku VoipioEOF
1700c05c7a73SRiku Voipioif compile_prog "" "" ; then
1701c05c7a73SRiku Voipio  inotify1=yes
1702c05c7a73SRiku Voipiofi
1703c05c7a73SRiku Voipio
1704ebc996f3SRiku Voipio# check if utimensat and futimens are supported
1705ebc996f3SRiku Voipioutimens=no
1706ebc996f3SRiku Voipiocat > $TMPC << EOF
1707ebc996f3SRiku Voipio#define _ATFILE_SOURCE
1708ebc996f3SRiku Voipio#define _GNU_SOURCE
1709ebc996f3SRiku Voipio#include <stddef.h>
1710ebc996f3SRiku Voipio#include <fcntl.h>
1711ebc996f3SRiku Voipio
1712ebc996f3SRiku Voipioint main(void)
1713ebc996f3SRiku Voipio{
1714ebc996f3SRiku Voipio    utimensat(AT_FDCWD, "foo", NULL, 0);
1715ebc996f3SRiku Voipio    futimens(0, NULL);
1716ebc996f3SRiku Voipio    return 0;
1717ebc996f3SRiku Voipio}
1718ebc996f3SRiku VoipioEOF
171952166aa0SJuan Quintelaif compile_prog "" "" ; then
1720ebc996f3SRiku Voipio  utimens=yes
1721ebc996f3SRiku Voipiofi
1722ebc996f3SRiku Voipio
1723099d6b0fSRiku Voipio# check if pipe2 is there
1724099d6b0fSRiku Voipiopipe2=no
1725099d6b0fSRiku Voipiocat > $TMPC << EOF
1726099d6b0fSRiku Voipio#define _GNU_SOURCE
1727099d6b0fSRiku Voipio#include <unistd.h>
1728099d6b0fSRiku Voipio#include <fcntl.h>
1729099d6b0fSRiku Voipio
1730099d6b0fSRiku Voipioint main(void)
1731099d6b0fSRiku Voipio{
1732099d6b0fSRiku Voipio    int pipefd[2];
1733099d6b0fSRiku Voipio    pipe2(pipefd, O_CLOEXEC);
1734099d6b0fSRiku Voipio    return 0;
1735099d6b0fSRiku Voipio}
1736099d6b0fSRiku VoipioEOF
173752166aa0SJuan Quintelaif compile_prog "" "" ; then
1738099d6b0fSRiku Voipio  pipe2=yes
1739099d6b0fSRiku Voipiofi
1740099d6b0fSRiku Voipio
174140ff6d7eSKevin Wolf# check if accept4 is there
174240ff6d7eSKevin Wolfaccept4=no
174340ff6d7eSKevin Wolfcat > $TMPC << EOF
174440ff6d7eSKevin Wolf#define _GNU_SOURCE
174540ff6d7eSKevin Wolf#include <sys/socket.h>
174640ff6d7eSKevin Wolf#include <stddef.h>
174740ff6d7eSKevin Wolf
174840ff6d7eSKevin Wolfint main(void)
174940ff6d7eSKevin Wolf{
175040ff6d7eSKevin Wolf    accept4(0, NULL, NULL, SOCK_CLOEXEC);
175140ff6d7eSKevin Wolf    return 0;
175240ff6d7eSKevin Wolf}
175340ff6d7eSKevin WolfEOF
175440ff6d7eSKevin Wolfif compile_prog "" "" ; then
175540ff6d7eSKevin Wolf  accept4=yes
175640ff6d7eSKevin Wolffi
175740ff6d7eSKevin Wolf
17583ce34dfbSvibisreenivasan# check if tee/splice is there. vmsplice was added same time.
17593ce34dfbSvibisreenivasansplice=no
17603ce34dfbSvibisreenivasancat > $TMPC << EOF
17613ce34dfbSvibisreenivasan#define _GNU_SOURCE
17623ce34dfbSvibisreenivasan#include <unistd.h>
17633ce34dfbSvibisreenivasan#include <fcntl.h>
17643ce34dfbSvibisreenivasan#include <limits.h>
17653ce34dfbSvibisreenivasan
17663ce34dfbSvibisreenivasanint main(void)
17673ce34dfbSvibisreenivasan{
17683ce34dfbSvibisreenivasan    int len, fd;
17693ce34dfbSvibisreenivasan    len = tee(STDIN_FILENO, STDOUT_FILENO, INT_MAX, SPLICE_F_NONBLOCK);
17703ce34dfbSvibisreenivasan    splice(STDIN_FILENO, NULL, fd, NULL, len, SPLICE_F_MOVE);
17713ce34dfbSvibisreenivasan    return 0;
17723ce34dfbSvibisreenivasan}
17733ce34dfbSvibisreenivasanEOF
177452166aa0SJuan Quintelaif compile_prog "" "" ; then
17753ce34dfbSvibisreenivasan  splice=yes
17763ce34dfbSvibisreenivasanfi
17773ce34dfbSvibisreenivasan
1778c2882b96SRiku Voipio# check if eventfd is supported
1779c2882b96SRiku Voipioeventfd=no
1780c2882b96SRiku Voipiocat > $TMPC << EOF
1781c2882b96SRiku Voipio#include <sys/eventfd.h>
1782c2882b96SRiku Voipio
1783c2882b96SRiku Voipioint main(void)
1784c2882b96SRiku Voipio{
1785c2882b96SRiku Voipio    int efd = eventfd(0, 0);
1786c2882b96SRiku Voipio    return 0;
1787c2882b96SRiku Voipio}
1788c2882b96SRiku VoipioEOF
1789c2882b96SRiku Voipioif compile_prog "" "" ; then
1790c2882b96SRiku Voipio  eventfd=yes
1791c2882b96SRiku Voipiofi
1792c2882b96SRiku Voipio
1793d0927938SUlrich Hecht# check for fallocate
1794d0927938SUlrich Hechtfallocate=no
1795d0927938SUlrich Hechtcat > $TMPC << EOF
1796d0927938SUlrich Hecht#include <fcntl.h>
1797d0927938SUlrich Hecht
1798d0927938SUlrich Hechtint main(void)
1799d0927938SUlrich Hecht{
1800d0927938SUlrich Hecht    fallocate(0, 0, 0, 0);
1801d0927938SUlrich Hecht    return 0;
1802d0927938SUlrich Hecht}
1803d0927938SUlrich HechtEOF
1804be17dc90SMichael S. Tsirkinif compile_prog "$ARCH_CFLAGS" "" ; then
1805d0927938SUlrich Hecht  fallocate=yes
1806d0927938SUlrich Hechtfi
1807d0927938SUlrich Hecht
1808d0927938SUlrich Hecht# check for dup3
1809d0927938SUlrich Hechtdup3=no
1810d0927938SUlrich Hechtcat > $TMPC << EOF
1811d0927938SUlrich Hecht#include <unistd.h>
1812d0927938SUlrich Hecht
1813d0927938SUlrich Hechtint main(void)
1814d0927938SUlrich Hecht{
1815d0927938SUlrich Hecht    dup3(0, 0, 0);
1816d0927938SUlrich Hecht    return 0;
1817d0927938SUlrich Hecht}
1818d0927938SUlrich HechtEOF
181978f5d726SJan Kiszkaif compile_prog "" "" ; then
1820d0927938SUlrich Hecht  dup3=yes
1821d0927938SUlrich Hechtfi
1822d0927938SUlrich Hecht
1823cc8ae6deSpbrook# Check if tools are available to build documentation.
1824a25dba17SJuan Quintelaif test "$docs" != "no" ; then
182501668d98SStefan Weil  if has makeinfo && has pod2man; then
1826a25dba17SJuan Quintela    docs=yes
182783a3ab8bSJuan Quintela  else
1828a25dba17SJuan Quintela    if test "$docs" = "yes" ; then
1829a25dba17SJuan Quintela      feature_not_found "docs"
183083a3ab8bSJuan Quintela    fi
1831a25dba17SJuan Quintela    docs=no
183283a3ab8bSJuan Quintela  fi
1833cc8ae6deSpbrookfi
1834cc8ae6deSpbrook
1835f514f41cSStefan Weil# Search for bswap_32 function
18366ae9a1f4SJuan Quintelabyteswap_h=no
18376ae9a1f4SJuan Quintelacat > $TMPC << EOF
18386ae9a1f4SJuan Quintela#include <byteswap.h>
18396ae9a1f4SJuan Quintelaint main(void) { return bswap_32(0); }
18406ae9a1f4SJuan QuintelaEOF
184152166aa0SJuan Quintelaif compile_prog "" "" ; then
18426ae9a1f4SJuan Quintela  byteswap_h=yes
18436ae9a1f4SJuan Quintelafi
18446ae9a1f4SJuan Quintela
1845f514f41cSStefan Weil# Search for bswap_32 function
18466ae9a1f4SJuan Quintelabswap_h=no
18476ae9a1f4SJuan Quintelacat > $TMPC << EOF
18486ae9a1f4SJuan Quintela#include <sys/endian.h>
18496ae9a1f4SJuan Quintela#include <sys/types.h>
18506ae9a1f4SJuan Quintela#include <machine/bswap.h>
18516ae9a1f4SJuan Quintelaint main(void) { return bswap32(0); }
18526ae9a1f4SJuan QuintelaEOF
185352166aa0SJuan Quintelaif compile_prog "" "" ; then
18546ae9a1f4SJuan Quintela  bswap_h=yes
18556ae9a1f4SJuan Quintelafi
18566ae9a1f4SJuan Quintela
1857da93a1fdSaliguori##########################################
1858da93a1fdSaliguori# Do we need librt
1859da93a1fdSaliguoricat > $TMPC <<EOF
1860da93a1fdSaliguori#include <signal.h>
1861da93a1fdSaliguori#include <time.h>
1862da93a1fdSaliguoriint main(void) { clockid_t id; return clock_gettime(id, NULL); }
1863da93a1fdSaliguoriEOF
1864da93a1fdSaliguori
186552166aa0SJuan Quintelaif compile_prog "" "" ; then
186607ffa4bdSJuan Quintela  :
186752166aa0SJuan Quintelaelif compile_prog "" "-lrt" ; then
186807ffa4bdSJuan Quintela  LIBS="-lrt $LIBS"
1869da93a1fdSaliguorifi
1870da93a1fdSaliguori
187131ff504dSBlue Swirlif test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
18726362a53fSJuan Quintela        "$aix" != "yes" ; then
18736362a53fSJuan Quintela    libs_softmmu="-lutil $libs_softmmu"
18746362a53fSJuan Quintelafi
18756362a53fSJuan Quintela
1876de5071c5SBlue Swirl##########################################
1877de5071c5SBlue Swirl# check if the compiler defines offsetof
1878de5071c5SBlue Swirl
1879de5071c5SBlue Swirlneed_offsetof=yes
1880de5071c5SBlue Swirlcat > $TMPC << EOF
1881de5071c5SBlue Swirl#include <stddef.h>
1882de5071c5SBlue Swirlint main(void) { struct s { int f; }; return offsetof(struct s, f); }
1883de5071c5SBlue SwirlEOF
1884de5071c5SBlue Swirlif compile_prog "" "" ; then
1885de5071c5SBlue Swirl    need_offsetof=no
1886de5071c5SBlue Swirlfi
1887de5071c5SBlue Swirl
18885f6b9e8fSBlue Swirl##########################################
1889747bbdf7SBlue Swirl# check if the compiler understands attribute warn_unused_result
1890747bbdf7SBlue Swirl#
1891747bbdf7SBlue Swirl# This could be smarter, but gcc -Werror does not error out even when warning
1892747bbdf7SBlue Swirl# about attribute warn_unused_result
1893747bbdf7SBlue Swirl
1894747bbdf7SBlue Swirlgcc_attribute_warn_unused_result=no
1895747bbdf7SBlue Swirlcat > $TMPC << EOF
1896747bbdf7SBlue Swirl#if defined(__GNUC__) && (__GNUC__ < 4) && defined(__GNUC_MINOR__) && (__GNUC__ < 4)
1897747bbdf7SBlue Swirl#error gcc 3.3 or older
1898747bbdf7SBlue Swirl#endif
1899747bbdf7SBlue Swirlint main(void) { return 0;}
1900747bbdf7SBlue SwirlEOF
1901747bbdf7SBlue Swirlif compile_prog "" ""; then
1902747bbdf7SBlue Swirl    gcc_attribute_warn_unused_result=yes
1903747bbdf7SBlue Swirlfi
1904747bbdf7SBlue Swirl
1905747bbdf7SBlue Swirl##########################################
19065f6b9e8fSBlue Swirl# check if we have fdatasync
19075f6b9e8fSBlue Swirl
19085f6b9e8fSBlue Swirlfdatasync=no
19095f6b9e8fSBlue Swirlcat > $TMPC << EOF
19105f6b9e8fSBlue Swirl#include <unistd.h>
19115f6b9e8fSBlue Swirlint main(void) { return fdatasync(0); }
19125f6b9e8fSBlue SwirlEOF
19135f6b9e8fSBlue Swirlif compile_prog "" "" ; then
19145f6b9e8fSBlue Swirl    fdatasync=yes
19155f6b9e8fSBlue Swirlfi
19165f6b9e8fSBlue Swirl
1917e86ecd4bSJuan Quintela# End of CC checks
1918e86ecd4bSJuan Quintela# After here, no more $cc or $ld runs
1919e86ecd4bSJuan Quintela
1920e86ecd4bSJuan Quintelaif test "$debug" = "no" ; then
19211156c669SJuan Quintela  CFLAGS="-O2 $CFLAGS"
1922e86ecd4bSJuan Quintelafi
1923a316e378SJuan Quintela
1924e86ecd4bSJuan Quintela# Consult white-list to determine whether to enable werror
1925e86ecd4bSJuan Quintela# by default.  Only enable by default for git builds
1926e86ecd4bSJuan Quintelaz_version=`cut -f3 -d. $source_path/VERSION`
192720ff6c80SAnthony Liguori
192820ff6c80SAnthony Liguoriif test -z "$werror" ; then
1929e86ecd4bSJuan Quintela    if test "$z_version" = "50" -a \
1930e86ecd4bSJuan Quintela        "$linux" = "yes" ; then
1931e86ecd4bSJuan Quintela        werror="yes"
1932e86ecd4bSJuan Quintela    else
1933e86ecd4bSJuan Quintela        werror="no"
1934e86ecd4bSJuan Quintela    fi
1935e86ecd4bSJuan Quintelafi
1936e86ecd4bSJuan Quintela
193720ff6c80SAnthony Liguori# Disable zero malloc errors for official releases unless explicitly told to
193820ff6c80SAnthony Liguori# enable/disable
193920ff6c80SAnthony Liguoriif test -z "$zero_malloc" ; then
194020ff6c80SAnthony Liguori    if test "$z_version" = "50" ; then
194120ff6c80SAnthony Liguori	zero_malloc="no"
194220ff6c80SAnthony Liguori    else
194320ff6c80SAnthony Liguori	zero_malloc="yes"
194420ff6c80SAnthony Liguori    fi
194520ff6c80SAnthony Liguorifi
194620ff6c80SAnthony Liguori
1947e86ecd4bSJuan Quintelaif test "$werror" = "yes" ; then
1948a558ee17SJuan Quintela    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
1949e86ecd4bSJuan Quintelafi
1950e86ecd4bSJuan Quintela
1951e86ecd4bSJuan Quintelaif test "$solaris" = "no" ; then
1952e86ecd4bSJuan Quintela    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
19531156c669SJuan Quintela        LDFLAGS="-Wl,--warn-common $LDFLAGS"
1954e86ecd4bSJuan Quintela    fi
1955e86ecd4bSJuan Quintelafi
1956e86ecd4bSJuan Quintela
195711d9f695Sbellardif test "$mingw32" = "yes" ; then
195811d9f695Sbellard  if test -z "$prefix" ; then
195955418b96SStefan Weil      prefix="c:/Program Files/Qemu"
196011d9f695Sbellard  fi
1961308c3593Spbrook  mansuffix=""
1962308c3593Spbrook  datasuffix=""
196307381cc1SAnthony Liguori  confsuffix=""
1964308c3593Spbrook  docsuffix=""
1965308c3593Spbrook  binsuffix=""
196607381cc1SAnthony Liguori  if test -z "$sysconfdir" ; then
196707381cc1SAnthony Liguori      sysconfdir="${prefix}"
196807381cc1SAnthony Liguori  fi
196911d9f695Sbellardelse
197011d9f695Sbellard  if test -z "$prefix" ; then
197111d9f695Sbellard      prefix="/usr/local"
197211d9f695Sbellard  fi
1973308c3593Spbrook  mansuffix="/share/man"
1974308c3593Spbrook  datasuffix="/share/qemu"
1975308c3593Spbrook  docsuffix="/share/doc/qemu"
1976308c3593Spbrook  binsuffix="/bin"
197707381cc1SAnthony Liguori  if test -z "$sysconfdir" ; then
197807381cc1SAnthony Liguori      sysconfdir="${prefix}/etc"
197907381cc1SAnthony Liguori  fi
198011d9f695Sbellardfi
19815a67135aSbellard
19827d13299dSbellardecho "Install prefix    $prefix"
1983308c3593Spbrookecho "BIOS directory    $prefix$datasuffix"
1984308c3593Spbrookecho "binary directory  $prefix$binsuffix"
198511d9f695Sbellardif test "$mingw32" = "no" ; then
1986308c3593Spbrookecho "Manual directory  $prefix$mansuffix"
198743ce4dfeSbellardecho "ELF interp prefix $interp_prefix"
198811d9f695Sbellardfi
19895a67135aSbellardecho "Source path       $source_path"
19907d13299dSbellardecho "C compiler        $cc"
199183469015Sbellardecho "Host C compiler   $host_cc"
19920c439cbfSJuan Quintelaecho "CFLAGS            $CFLAGS"
1993a558ee17SJuan Quintelaecho "QEMU_CFLAGS       $QEMU_CFLAGS"
19940c439cbfSJuan Quintelaecho "LDFLAGS           $LDFLAGS"
19957d13299dSbellardecho "make              $make"
19966a882643Spbrookecho "install           $install"
1997a98fd896Sbellardecho "host CPU          $cpu"
1998de83cd02Sbellardecho "host big endian   $bigendian"
199997a847bcSbellardecho "target list       $target_list"
2000ade25b0dSaurel32echo "tcg debug enabled $debug_tcg"
2001b4475aa2SLuiz Capitulinoecho "Mon debug enabled $debug_mon"
20027d13299dSbellardecho "gprof enabled     $gprof"
200303b4fe7dSaliguoriecho "sparse enabled    $sparse"
20041625af87Saliguoriecho "strip binaries    $strip_opt"
200505c2a3e7Sbellardecho "profiler          $profiler"
200643ce4dfeSbellardecho "static build      $static"
200785aa5189Sbellardecho "-Werror enabled   $werror"
20085b0753e0Sbellardif test "$darwin" = "yes" ; then
20095b0753e0Sbellard    echo "Cocoa support     $cocoa"
20105b0753e0Sbellardfi
201197a847bcSbellardecho "SDL support       $sdl"
20124d3b6f6eSbalrogecho "curses support    $curses"
2013769ce76dSAlexander Grafecho "curl support      $curl"
20145495ed11SLuiz Capitulinoecho "check support     $check_utests"
201567b915a5Sbellardecho "mingw32 support   $mingw32"
20160c58ac1cSmalcecho "Audio drivers     $audio_drv_list"
20170c58ac1cSmalcecho "Extra audio cards $audio_card_list"
2018eb852011SMarkus Armbrusterecho "Block whitelist   $block_drv_whitelist"
20198ff9cbf7Smalcecho "Mixer emulation   $mixemu"
20208d5d2d4cSthsecho "VNC TLS support   $vnc_tls"
20212f9606b3Saliguoriecho "VNC SASL support  $vnc_sasl"
20223142255cSblueswir1if test -n "$sparc_cpu"; then
20233142255cSblueswir1    echo "Target Sparc Arch $sparc_cpu"
20243142255cSblueswir1fi
2025e37630caSaliguoriecho "xen support       $xen"
20262e4d9fb1Saurel32echo "brlapi support    $brlapi"
2027a20a6f46SJuan Quintelaecho "bluez  support    $bluez"
2028a25dba17SJuan Quintelaecho "Documentation     $docs"
2029c5937220Spbrook[ ! -z "$uname_release" ] && \
2030c5937220Spbrookecho "uname -r          $uname_release"
2031bd0c5661Spbrookecho "NPTL support      $nptl"
2032379f6698SPaul Brookecho "GUEST_BASE        $guest_base"
203334005a00SKirill A. Shutemovecho "PIE user targets  $user_pie"
20348a16d273Sthsecho "vde support       $vde"
2035e5d355d1Saliguoriecho "IO thread         $io_thread"
20365c6c3a6cSChristoph Hellwigecho "Linux AIO support $linux_aio"
203777755340Sthsecho "Install blobs     $blobs"
2038b31a0277SJuan Quintelaecho "KVM support       $kvm"
2039f652e6afSaurel32echo "fdt support       $fdt"
2040ceb42de8Saliguoriecho "preadv support    $preadv"
20415f6b9e8fSBlue Swirlecho "fdatasync         $fdatasync"
2042ee682d27SStefan Weilecho "uuid support      $uuid"
2043d5970055SMichael S. Tsirkinecho "vhost-net support $vhost_net"
204467b915a5Sbellard
204597a847bcSbellardif test $sdl_too_old = "yes"; then
204624b55b96Sbellardecho "-> Your SDL version is too old - please upgrade to have SDL support"
2047e8cd23deSbellardfi
204897a847bcSbellard
204998ec69acSJuan Quintelaconfig_host_mak="config-host.mak"
20504bf6b55bSJuan Quintelaconfig_host_ld="config-host.ld"
205197a847bcSbellard
205298ec69acSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_host_mak
205398ec69acSJuan Quintelaprintf "# Configured with:" >> $config_host_mak
205498ec69acSJuan Quintelaprintf " '%s'" "$0" "$@" >> $config_host_mak
205598ec69acSJuan Quintelaecho >> $config_host_mak
205698ec69acSJuan Quintela
20572358a494SJuan Quintelaecho "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
205807381cc1SAnthony Liguoriif test "$mingw32" = "yes" ; then
205907381cc1SAnthony Liguori  echo "CONFIG_QEMU_CONFDIR=\"$sysconfdir\"" >> $config_host_mak
206007381cc1SAnthony Liguorielse
206107381cc1SAnthony Liguori  echo "CONFIG_QEMU_CONFDIR=\"${sysconfdir}/qemu\"" >> $config_host_mak
206207381cc1SAnthony Liguorifi
2063804edf29SJuan Quintela
20642408a527Saurel32case "$cpu" in
206524e804ecSAlexander Graf  i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
2066e0da9dd3SJuan Quintela    ARCH=$cpu
20672408a527Saurel32  ;;
2068a302c32dSLaurent Desnogues  armv4b|armv4l)
206916dbd14fSJuan Quintela    ARCH=arm
20702408a527Saurel32  ;;
20712408a527Saurel32  *)
20723142255cSblueswir1    echo "Unsupported CPU = $cpu"
20737d13299dSbellard    exit 1
20742408a527Saurel32  ;;
20752408a527Saurel32esac
207698ec69acSJuan Quintelaecho "ARCH=$ARCH" >> $config_host_mak
2077f8393946Saurel32if test "$debug_tcg" = "yes" ; then
20782358a494SJuan Quintela  echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
2079f8393946Saurel32fi
2080b4475aa2SLuiz Capitulinoif test "$debug_mon" = "yes" ; then
2081b4475aa2SLuiz Capitulino  echo "CONFIG_DEBUG_MONITOR=y" >> $config_host_mak
2082b4475aa2SLuiz Capitulinofi
2083f3d08ee6SPaul Brookif test "$debug" = "yes" ; then
20842358a494SJuan Quintela  echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
2085f3d08ee6SPaul Brookfi
20861625af87Saliguoriif test "$strip_opt" = "yes" ; then
208798ec69acSJuan Quintela  echo "STRIP_OPT=-s" >> $config_host_mak
20881625af87Saliguorifi
20897d13299dSbellardif test "$bigendian" = "yes" ; then
2090e2542fe2SJuan Quintela  echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
209197a847bcSbellardfi
20922358a494SJuan Quintelaecho "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
209367b915a5Sbellardif test "$mingw32" = "yes" ; then
209498ec69acSJuan Quintela  echo "CONFIG_WIN32=y" >> $config_host_mak
2095210fa556Spbrookelse
209635f4df27SJuan Quintela  echo "CONFIG_POSIX=y" >> $config_host_mak
2097210fa556Spbrookfi
2098128ab2ffSblueswir1
2099dffcb71cSMark McLoughlinif test "$linux" = "yes" ; then
2100dffcb71cSMark McLoughlin  echo "CONFIG_LINUX=y" >> $config_host_mak
2101dffcb71cSMark McLoughlinfi
2102dffcb71cSMark McLoughlin
210383fb7adfSbellardif test "$darwin" = "yes" ; then
210498ec69acSJuan Quintela  echo "CONFIG_DARWIN=y" >> $config_host_mak
210583fb7adfSbellardfi
2106b29fe3edSmalc
2107b29fe3edSmalcif test "$aix" = "yes" ; then
210898ec69acSJuan Quintela  echo "CONFIG_AIX=y" >> $config_host_mak
2109b29fe3edSmalcfi
2110b29fe3edSmalc
2111ec530c81Sbellardif test "$solaris" = "yes" ; then
211298ec69acSJuan Quintela  echo "CONFIG_SOLARIS=y" >> $config_host_mak
21132358a494SJuan Quintela  echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
21140475a5caSths  if test "$needs_libsunmath" = "yes" ; then
211575b5a697SJuan Quintela    echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
21160475a5caSths  fi
2117ec530c81Sbellardfi
211897a847bcSbellardif test "$static" = "yes" ; then
211998ec69acSJuan Quintela  echo "CONFIG_STATIC=y" >> $config_host_mak
212097a847bcSbellardfi
212105c2a3e7Sbellardif test $profiler = "yes" ; then
21222358a494SJuan Quintela  echo "CONFIG_PROFILER=y" >> $config_host_mak
212305c2a3e7Sbellardfi
2124c20709aaSbellardif test "$slirp" = "yes" ; then
212598ec69acSJuan Quintela  echo "CONFIG_SLIRP=y" >> $config_host_mak
2126b6e31c12SJuan Quintela  QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS"
2127c20709aaSbellardfi
21288a16d273Sthsif test "$vde" = "yes" ; then
212998ec69acSJuan Quintela  echo "CONFIG_VDE=y" >> $config_host_mak
21308a16d273Sthsfi
21310c58ac1cSmalcfor card in $audio_card_list; do
2132f6e5889eSpbrook    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
213398ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
21340c58ac1cSmalcdone
21352358a494SJuan Quintelaecho "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
21360c58ac1cSmalcfor drv in $audio_drv_list; do
2137f6e5889eSpbrook    def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
213898ec69acSJuan Quintela    echo "$def=y" >> $config_host_mak
2139923e4521Smalc    if test "$drv" = "fmod"; then
21407aac6cb1SJuan Quintela        echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
2141fb065187Sbellard    fi
21420c58ac1cSmalcdone
214367f86e8eSJuan Quintelaif test "$audio_pt_int" = "yes" ; then
214467f86e8eSJuan Quintela  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
214567f86e8eSJuan Quintelafi
2146d5631638Smalcif test "$audio_win_int" = "yes" ; then
2147d5631638Smalc  echo "CONFIG_AUDIO_WIN_INT=y" >> $config_host_mak
2148d5631638Smalcfi
2149eb852011SMarkus Armbrusterecho "CONFIG_BDRV_WHITELIST=$block_drv_whitelist" >> $config_host_mak
21508ff9cbf7Smalcif test "$mixemu" = "yes" ; then
215198ec69acSJuan Quintela  echo "CONFIG_MIXEMU=y" >> $config_host_mak
21528ff9cbf7Smalcfi
21538d5d2d4cSthsif test "$vnc_tls" = "yes" ; then
215498ec69acSJuan Quintela  echo "CONFIG_VNC_TLS=y" >> $config_host_mak
2155525061bfSJuan Quintela  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
21568d5d2d4cSthsfi
21572f9606b3Saliguoriif test "$vnc_sasl" = "yes" ; then
215898ec69acSJuan Quintela  echo "CONFIG_VNC_SASL=y" >> $config_host_mak
215960ddf533SJuan Quintela  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
21602f9606b3Saliguorifi
216176655d6dSaliguoriif test "$fnmatch" = "yes" ; then
21622358a494SJuan Quintela  echo "CONFIG_FNMATCH=y" >> $config_host_mak
216376655d6dSaliguorifi
2164ee682d27SStefan Weilif test "$uuid" = "yes" ; then
2165ee682d27SStefan Weil  echo "CONFIG_UUID=y" >> $config_host_mak
2166ee682d27SStefan Weilfi
2167b1a550a0Spbrookqemu_version=`head $source_path/VERSION`
216898ec69acSJuan Quintelaecho "VERSION=$qemu_version" >>$config_host_mak
21692358a494SJuan Quintelaecho "PKGVERSION=$pkgversion" >>$config_host_mak
217098ec69acSJuan Quintelaecho "SRC_PATH=$source_path" >> $config_host_mak
217198ec69acSJuan Quintelaecho "TARGET_DIRS=$target_list" >> $config_host_mak
2172a25dba17SJuan Quintelaif [ "$docs" = "yes" ] ; then
217398ec69acSJuan Quintela  echo "BUILD_DOCS=yes" >> $config_host_mak
2174cc8ae6deSpbrookfi
21751ac88f28SJuan Quintelaif test "$sdl" = "yes" ; then
217698ec69acSJuan Quintela  echo "CONFIG_SDL=y" >> $config_host_mak
21778ad3a7ddSJuan Quintela  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
217849ecc3faSbellardfi
217949ecc3faSbellardif test "$cocoa" = "yes" ; then
218098ec69acSJuan Quintela  echo "CONFIG_COCOA=y" >> $config_host_mak
218149ecc3faSbellardfi
21824d3b6f6eSbalrogif test "$curses" = "yes" ; then
218398ec69acSJuan Quintela  echo "CONFIG_CURSES=y" >> $config_host_mak
2184ab4e5602SJan Kiszkafi
21853b3f24adSaurel32if test "$atfile" = "yes" ; then
21862358a494SJuan Quintela  echo "CONFIG_ATFILE=y" >> $config_host_mak
21873b3f24adSaurel32fi
2188ebc996f3SRiku Voipioif test "$utimens" = "yes" ; then
21892358a494SJuan Quintela  echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
2190ebc996f3SRiku Voipiofi
2191099d6b0fSRiku Voipioif test "$pipe2" = "yes" ; then
21922358a494SJuan Quintela  echo "CONFIG_PIPE2=y" >> $config_host_mak
2193099d6b0fSRiku Voipiofi
219440ff6d7eSKevin Wolfif test "$accept4" = "yes" ; then
219540ff6d7eSKevin Wolf  echo "CONFIG_ACCEPT4=y" >> $config_host_mak
219640ff6d7eSKevin Wolffi
21973ce34dfbSvibisreenivasanif test "$splice" = "yes" ; then
21982358a494SJuan Quintela  echo "CONFIG_SPLICE=y" >> $config_host_mak
21993ce34dfbSvibisreenivasanfi
2200c2882b96SRiku Voipioif test "$eventfd" = "yes" ; then
2201c2882b96SRiku Voipio  echo "CONFIG_EVENTFD=y" >> $config_host_mak
2202c2882b96SRiku Voipiofi
2203d0927938SUlrich Hechtif test "$fallocate" = "yes" ; then
2204d0927938SUlrich Hecht  echo "CONFIG_FALLOCATE=y" >> $config_host_mak
2205d0927938SUlrich Hechtfi
2206d0927938SUlrich Hechtif test "$dup3" = "yes" ; then
2207d0927938SUlrich Hecht  echo "CONFIG_DUP3=y" >> $config_host_mak
2208d0927938SUlrich Hechtfi
22093b3f24adSaurel32if test "$inotify" = "yes" ; then
22102358a494SJuan Quintela  echo "CONFIG_INOTIFY=y" >> $config_host_mak
22113b3f24adSaurel32fi
2212c05c7a73SRiku Voipioif test "$inotify1" = "yes" ; then
2213c05c7a73SRiku Voipio  echo "CONFIG_INOTIFY1=y" >> $config_host_mak
2214c05c7a73SRiku Voipiofi
22156ae9a1f4SJuan Quintelaif test "$byteswap_h" = "yes" ; then
22166ae9a1f4SJuan Quintela  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
22176ae9a1f4SJuan Quintelafi
22186ae9a1f4SJuan Quintelaif test "$bswap_h" = "yes" ; then
22196ae9a1f4SJuan Quintela  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
22206ae9a1f4SJuan Quintelafi
2221769ce76dSAlexander Grafif test "$curl" = "yes" ; then
222298ec69acSJuan Quintela  echo "CONFIG_CURL=y" >> $config_host_mak
2223b1d5a277SJuan Quintela  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
2224769ce76dSAlexander Graffi
22252e4d9fb1Saurel32if test "$brlapi" = "yes" ; then
222698ec69acSJuan Quintela  echo "CONFIG_BRLAPI=y" >> $config_host_mak
22272e4d9fb1Saurel32fi
2228fb599c9aSbalrogif test "$bluez" = "yes" ; then
222998ec69acSJuan Quintela  echo "CONFIG_BLUEZ=y" >> $config_host_mak
2230ef7635ecSJuan Quintela  echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
2231fb599c9aSbalrogfi
2232e37630caSaliguoriif test "$xen" = "yes" ; then
22335647eb74SJuan Quintela  echo "CONFIG_XEN=y" >> $config_host_mak
2234e37630caSaliguorifi
2235e5d355d1Saliguoriif test "$io_thread" = "yes" ; then
223698ec69acSJuan Quintela  echo "CONFIG_IOTHREAD=y" >> $config_host_mak
2237e5d355d1Saliguorifi
22385c6c3a6cSChristoph Hellwigif test "$linux_aio" = "yes" ; then
22395c6c3a6cSChristoph Hellwig  echo "CONFIG_LINUX_AIO=y" >> $config_host_mak
22405c6c3a6cSChristoph Hellwigfi
224177755340Sthsif test "$blobs" = "yes" ; then
224298ec69acSJuan Quintela  echo "INSTALL_BLOBS=yes" >> $config_host_mak
224377755340Sthsfi
2244bf9298b9Saliguoriif test "$iovec" = "yes" ; then
22452358a494SJuan Quintela  echo "CONFIG_IOVEC=y" >> $config_host_mak
2246bf9298b9Saliguorifi
2247ceb42de8Saliguoriif test "$preadv" = "yes" ; then
22482358a494SJuan Quintela  echo "CONFIG_PREADV=y" >> $config_host_mak
2249ceb42de8Saliguorifi
2250f652e6afSaurel32if test "$fdt" = "yes" ; then
22513f0855b1SJuan Quintela  echo "CONFIG_FDT=y" >> $config_host_mak
2252f652e6afSaurel32fi
2253de5071c5SBlue Swirlif test "$need_offsetof" = "yes" ; then
2254de5071c5SBlue Swirl  echo "CONFIG_NEED_OFFSETOF=y" >> $config_host_mak
2255de5071c5SBlue Swirlfi
2256747bbdf7SBlue Swirlif test "$gcc_attribute_warn_unused_result" = "yes" ; then
2257747bbdf7SBlue Swirl  echo "CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT=y" >> $config_host_mak
2258747bbdf7SBlue Swirlfi
22595f6b9e8fSBlue Swirlif test "$fdatasync" = "yes" ; then
22605f6b9e8fSBlue Swirl  echo "CONFIG_FDATASYNC=y" >> $config_host_mak
22615f6b9e8fSBlue Swirlfi
226297a847bcSbellard
226383fb7adfSbellard# XXX: suppress that
22647d3505c5Sbellardif [ "$bsd" = "yes" ] ; then
22652358a494SJuan Quintela  echo "CONFIG_BSD=y" >> $config_host_mak
22667d3505c5Sbellardfi
22677d3505c5Sbellard
22682358a494SJuan Quintelaecho "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
2269c5937220Spbrook
227020ff6c80SAnthony Liguoriif test "$zero_malloc" = "yes" ; then
227120ff6c80SAnthony Liguori  echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
227220ff6c80SAnthony Liguorifi
227320ff6c80SAnthony Liguori
227468063649Sblueswir1# USB host support
227568063649Sblueswir1case "$usb" in
227668063649Sblueswir1linux)
227798ec69acSJuan Quintela  echo "HOST_USB=linux" >> $config_host_mak
227868063649Sblueswir1;;
227968063649Sblueswir1bsd)
228098ec69acSJuan Quintela  echo "HOST_USB=bsd" >> $config_host_mak
228168063649Sblueswir1;;
228268063649Sblueswir1*)
228398ec69acSJuan Quintela  echo "HOST_USB=stub" >> $config_host_mak
228468063649Sblueswir1;;
228568063649Sblueswir1esac
228668063649Sblueswir1
2287c39e3338Spbrooktools=
2288c39e3338Spbrookif test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
228986355e07SAurelien Jarno  tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools"
22902bff4b6fSBlue Swirl  if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then
229186355e07SAurelien Jarno      tools="qemu-nbd\$(EXESUF) $tools"
22925495ed11SLuiz Capitulino    if [ "$check_utests" = "yes" ]; then
22933aa3dcffSLuiz Capitulino      tools="check-qint check-qstring check-qdict check-qlist $tools"
2294422c46a8SAnthony Liguori      tools="check-qfloat check-qjson $tools"
22955495ed11SLuiz Capitulino    fi
22967a5ca864Sbellard  fi
2297c39e3338Spbrookfi
229898ec69acSJuan Quintelaecho "TOOLS=$tools" >> $config_host_mak
2299c39e3338Spbrook
2300161294d8SJuan Quintela# Mac OS X ships with a broken assembler
2301253d0942SAlexander Grafroms=
2302161294d8SJuan Quintelaif test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
2303ea5ad306SAndreas Faerber        "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \
2304b461cdc9SBlue Swirl        `expr "$target_list" : ".*softmmu.*"` != 0 ; then
2305c05ac895SPaul Brook  roms="optionrom"
2306253d0942SAlexander Graffi
230798ec69acSJuan Quintelaecho "ROMS=$roms" >> $config_host_mak
2308253d0942SAlexander Graf
2309804edf29SJuan Quintelaecho "prefix=$prefix" >> $config_host_mak
2310804edf29SJuan Quintelaecho "bindir=\${prefix}$binsuffix" >> $config_host_mak
2311804edf29SJuan Quintelaecho "mandir=\${prefix}$mansuffix" >> $config_host_mak
2312804edf29SJuan Quintelaecho "datadir=\${prefix}$datasuffix" >> $config_host_mak
231307381cc1SAnthony Liguoriecho "sysconfdir=$sysconfdir" >> $config_host_mak
2314804edf29SJuan Quintelaecho "docdir=\${prefix}$docsuffix" >> $config_host_mak
2315804edf29SJuan Quintelaecho "MAKE=$make" >> $config_host_mak
2316804edf29SJuan Quintelaecho "INSTALL=$install" >> $config_host_mak
2317804edf29SJuan Quintelaecho "INSTALL_DIR=$install -d -m0755 -p" >> $config_host_mak
2318804edf29SJuan Quintelaecho "INSTALL_DATA=$install -m0644 -p" >> $config_host_mak
2319804edf29SJuan Quintelaecho "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak
2320804edf29SJuan Quintelaecho "CC=$cc" >> $config_host_mak
2321804edf29SJuan Quintelaecho "HOST_CC=$host_cc" >> $config_host_mak
2322804edf29SJuan Quintelaif test "$sparse" = "yes" ; then
2323804edf29SJuan Quintela  echo "CC      := REAL_CC=\"\$(CC)\" cgcc"       >> $config_host_mak
2324804edf29SJuan Quintela  echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc"  >> $config_host_mak
2325a558ee17SJuan Quintela  echo "QEMU_CFLAGS  += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak
2326804edf29SJuan Quintelafi
2327804edf29SJuan Quintelaecho "AR=$ar" >> $config_host_mak
2328804edf29SJuan Quintelaecho "OBJCOPY=$objcopy" >> $config_host_mak
2329804edf29SJuan Quintelaecho "LD=$ld" >> $config_host_mak
2330e2a2ed06SJuan Quintelaecho "CFLAGS=$CFLAGS" >> $config_host_mak
2331a558ee17SJuan Quintelaecho "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
2332c81da56eSJuan Quintelaecho "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
2333e2a2ed06SJuan Quintelaecho "LDFLAGS=$LDFLAGS" >> $config_host_mak
2334a36abbbbSJuan Quintelaecho "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
2335a36abbbbSJuan Quintelaecho "ARLIBS_END=$arlibs_end" >> $config_host_mak
233673da375eSJuan Quintelaecho "LIBS+=$LIBS" >> $config_host_mak
23373e2e0e6bSJuan Quintelaecho "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
2338804edf29SJuan Quintelaecho "EXESUF=$EXESUF" >> $config_host_mak
2339804edf29SJuan Quintela
23404bf6b55bSJuan Quintela# generate list of library paths for linker script
23414bf6b55bSJuan Quintela
23424bf6b55bSJuan Quintela$ld --verbose -v 2> /dev/null | grep SEARCH_DIR > ${config_host_ld}
23434bf6b55bSJuan Quintela
23444bf6b55bSJuan Quintelaif test -f ${config_host_ld}~ ; then
23454bf6b55bSJuan Quintela  if cmp -s $config_host_ld ${config_host_ld}~ ; then
23464bf6b55bSJuan Quintela    mv ${config_host_ld}~ $config_host_ld
23474bf6b55bSJuan Quintela  else
23484bf6b55bSJuan Quintela    rm ${config_host_ld}~
23494bf6b55bSJuan Quintela  fi
23504bf6b55bSJuan Quintelafi
23514bf6b55bSJuan Quintela
23524d904533SBlue Swirlfor d in libdis libdis-user; do
23534d904533SBlue Swirl    mkdir -p $d
23544d904533SBlue Swirl    rm -f $d/Makefile
23554d904533SBlue Swirl    ln -s $source_path/Makefile.dis $d/Makefile
23564d904533SBlue Swirl    echo > $d/config.mak
23574d904533SBlue Swirldone
2358*d44cff22SRichard Hendersonif test "$static" = "no" -a "$user_pie" = "yes" ; then
2359*d44cff22SRichard Henderson  echo "QEMU_CFLAGS+=-fpie" > libdis-user/config.mak
2360*d44cff22SRichard Hendersonfi
23614d904533SBlue Swirl
236297a847bcSbellardfor target in $target_list; do
236397a847bcSbellardtarget_dir="$target"
236425be210fSJuan Quintelaconfig_target_mak=$target_dir/config-target.mak
2365600309b6SBlue Swirltarget_arch2=`echo $target | cut -d '-' -f 1`
236697a847bcSbellardtarget_bigendian="no"
23671f3d3c8fSJuan Quintela
2368ea2d6a39SJuan Quintelacase "$target_arch2" in
236924e804ecSAlexander Graf  armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
2370ea2d6a39SJuan Quintela  target_bigendian=yes
2371ea2d6a39SJuan Quintela  ;;
2372ea2d6a39SJuan Quintelaesac
237397a847bcSbellardtarget_softmmu="no"
2374997344f3Sbellardtarget_user_only="no"
2375831b7825Sthstarget_linux_user="no"
2376831b7825Sthstarget_darwin_user="no"
237784778508Sblueswir1target_bsd_user="no"
23789e407a85Spbrookcase "$target" in
2379600309b6SBlue Swirl  ${target_arch2}-softmmu)
23809e407a85Spbrook    target_softmmu="yes"
23819e407a85Spbrook    ;;
2382600309b6SBlue Swirl  ${target_arch2}-linux-user)
23839c7a4202SBlue Swirl    if test "$linux" != "yes" ; then
23849c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Linux host"
23859c7a4202SBlue Swirl      exit 1
23869c7a4202SBlue Swirl    fi
23879e407a85Spbrook    target_user_only="yes"
23889e407a85Spbrook    target_linux_user="yes"
23899e407a85Spbrook    ;;
2390600309b6SBlue Swirl  ${target_arch2}-darwin-user)
23919c7a4202SBlue Swirl    if test "$darwin" != "yes" ; then
23929c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a Darwin host"
23939c7a4202SBlue Swirl      exit 1
23949c7a4202SBlue Swirl    fi
23959e407a85Spbrook    target_user_only="yes"
2396831b7825Sths    target_darwin_user="yes"
23979e407a85Spbrook    ;;
2398600309b6SBlue Swirl  ${target_arch2}-bsd-user)
23999cf55765SBlue Swirl    if test "$bsd" != "yes" ; then
24009c7a4202SBlue Swirl      echo "ERROR: Target '$target' is only available on a BSD host"
24019c7a4202SBlue Swirl      exit 1
24029c7a4202SBlue Swirl    fi
240384778508Sblueswir1    target_user_only="yes"
240484778508Sblueswir1    target_bsd_user="yes"
240584778508Sblueswir1    ;;
24069e407a85Spbrook  *)
24079e407a85Spbrook    echo "ERROR: Target '$target' not recognised"
24089e407a85Spbrook    exit 1
24099e407a85Spbrook    ;;
24109e407a85Spbrookesac
2411831b7825Sths
241297a847bcSbellardmkdir -p $target_dir
2413158142c2Sbellardmkdir -p $target_dir/fpu
241457fec1feSbellardmkdir -p $target_dir/tcg
241559f2a787SGerd Hoffmannmkdir -p $target_dir/ide
241684778508Sblueswir1if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then
241769de927cSbellard  mkdir -p $target_dir/nwfpe
241869de927cSbellardfi
241969de927cSbellard
2420ec530c81Sbellard#
2421ec530c81Sbellard# don't use ln -sf as not all "ln -sf" over write the file/link
2422ec530c81Sbellard#
2423ec530c81Sbellardrm -f $target_dir/Makefile
2424ec530c81Sbellardln -s $source_path/Makefile.target $target_dir/Makefile
2425ec530c81Sbellard
242697a847bcSbellard
242725be210fSJuan Quintelaecho "# Automatically generated by configure - do not modify" > $config_target_mak
242897a847bcSbellard
2429e5fe0c52Spbrookbflt="no"
2430bd0c5661Spbrooktarget_nptl="no"
2431600309b6SBlue Swirlinterp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_arch2/g"`
243225be210fSJuan Quintelaecho "CONFIG_QEMU_PREFIX=\"$interp_prefix1\"" >> $config_target_mak
243356aebc89Spbrookgdb_xml_files=""
24347ba1e619Saliguori
2435938b1eddSJuan QuintelaTARGET_ARCH="$target_arch2"
24366acff7daSJuan QuintelaTARGET_BASE_ARCH=""
2437e6e91b9cSJuan QuintelaTARGET_ABI_DIR=""
2438e73aae67SJuan Quintela
2439600309b6SBlue Swirlcase "$target_arch2" in
24402408a527Saurel32  i386)
24411ad2134fSPaul Brook    target_phys_bits=32
24422408a527Saurel32  ;;
24432408a527Saurel32  x86_64)
24446acff7daSJuan Quintela    TARGET_BASE_ARCH=i386
24451ad2134fSPaul Brook    target_phys_bits=64
24462408a527Saurel32  ;;
24472408a527Saurel32  alpha)
24481ad2134fSPaul Brook    target_phys_bits=64
2449a4b388ffSRichard Henderson    target_nptl="yes"
24502408a527Saurel32  ;;
24512408a527Saurel32  arm|armeb)
2452b498c8a0SJuan Quintela    TARGET_ARCH=arm
2453e5fe0c52Spbrook    bflt="yes"
2454bd0c5661Spbrook    target_nptl="yes"
245556aebc89Spbrook    gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
24561ad2134fSPaul Brook    target_phys_bits=32
24572408a527Saurel32  ;;
24582408a527Saurel32  cris)
2459253bd7f8Sedgar_igl    target_nptl="yes"
24601ad2134fSPaul Brook    target_phys_bits=32
24612408a527Saurel32  ;;
24622408a527Saurel32  m68k)
24630938cda5Saurel32    bflt="yes"
246456aebc89Spbrook    gdb_xml_files="cf-core.xml cf-fp.xml"
24651ad2134fSPaul Brook    target_phys_bits=32
24662408a527Saurel32  ;;
246772b675caSEdgar E. Iglesias  microblaze)
246872b675caSEdgar E. Iglesias    bflt="yes"
246972b675caSEdgar E. Iglesias    target_nptl="yes"
247072b675caSEdgar E. Iglesias    target_phys_bits=32
247172b675caSEdgar E. Iglesias  ;;
24722408a527Saurel32  mips|mipsel)
2473b498c8a0SJuan Quintela    TARGET_ARCH=mips
247425be210fSJuan Quintela    echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
2475f04dc72fSPaul Brook    target_nptl="yes"
24761ad2134fSPaul Brook    target_phys_bits=64
24772408a527Saurel32  ;;
24782408a527Saurel32  mipsn32|mipsn32el)
2479b498c8a0SJuan Quintela    TARGET_ARCH=mipsn32
24806acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
248125be210fSJuan Quintela    echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
24821ad2134fSPaul Brook    target_phys_bits=64
24832408a527Saurel32  ;;
24842408a527Saurel32  mips64|mips64el)
2485b498c8a0SJuan Quintela    TARGET_ARCH=mips64
24866acff7daSJuan Quintela    TARGET_BASE_ARCH=mips
248725be210fSJuan Quintela    echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
24881ad2134fSPaul Brook    target_phys_bits=64
24892408a527Saurel32  ;;
24902408a527Saurel32  ppc)
2491c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
24921ad2134fSPaul Brook    target_phys_bits=32
2493d6630708SNathan Froyd    target_nptl="yes"
24942408a527Saurel32  ;;
24952408a527Saurel32  ppcemb)
24966acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2497e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
2498c8b3532dSaurel32    gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
24991ad2134fSPaul Brook    target_phys_bits=64
2500d6630708SNathan Froyd    target_nptl="yes"
25012408a527Saurel32  ;;
25022408a527Saurel32  ppc64)
25036acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2504e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
2505c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
25061ad2134fSPaul Brook    target_phys_bits=64
25072408a527Saurel32  ;;
25082408a527Saurel32  ppc64abi32)
2509b498c8a0SJuan Quintela    TARGET_ARCH=ppc64
25106acff7daSJuan Quintela    TARGET_BASE_ARCH=ppc
2511e6e91b9cSJuan Quintela    TARGET_ABI_DIR=ppc
251225be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
2513c8b3532dSaurel32    gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
25141ad2134fSPaul Brook    target_phys_bits=64
25152408a527Saurel32  ;;
25162408a527Saurel32  sh4|sh4eb)
2517b498c8a0SJuan Quintela    TARGET_ARCH=sh4
25184dbed897Spbrook    bflt="yes"
25190b6d3ae0Saurel32    target_nptl="yes"
25201ad2134fSPaul Brook    target_phys_bits=32
25212408a527Saurel32  ;;
25222408a527Saurel32  sparc)
25231ad2134fSPaul Brook    target_phys_bits=64
25242408a527Saurel32  ;;
25252408a527Saurel32  sparc64)
25266acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
25271ad2134fSPaul Brook    target_phys_bits=64
25282408a527Saurel32  ;;
25292408a527Saurel32  sparc32plus)
2530b498c8a0SJuan Quintela    TARGET_ARCH=sparc64
25316acff7daSJuan Quintela    TARGET_BASE_ARCH=sparc
2532e6e91b9cSJuan Quintela    TARGET_ABI_DIR=sparc
253325be210fSJuan Quintela    echo "TARGET_ABI32=y" >> $config_target_mak
25341ad2134fSPaul Brook    target_phys_bits=64
25352408a527Saurel32  ;;
253624e804ecSAlexander Graf  s390x)
253724e804ecSAlexander Graf    target_phys_bits=64
253824e804ecSAlexander Graf  ;;
25392408a527Saurel32  *)
2540de83cd02Sbellard    echo "Unsupported target CPU"
2541de83cd02Sbellard    exit 1
25422408a527Saurel32  ;;
25432408a527Saurel32esac
254425be210fSJuan Quintelaecho "TARGET_ARCH=$TARGET_ARCH" >> $config_target_mak
2545053dd92eSJuan Quintelatarget_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
254625be210fSJuan Quintelaecho "TARGET_$target_arch_name=y" >> $config_target_mak
254725be210fSJuan Quintelaecho "TARGET_ARCH2=$target_arch2" >> $config_target_mak
254842bc608bSJuan Quintela# TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
25496acff7daSJuan Quintelaif [ "$TARGET_BASE_ARCH" = "" ]; then
25506acff7daSJuan Quintela  TARGET_BASE_ARCH=$TARGET_ARCH
25516acff7daSJuan Quintelafi
255225be210fSJuan Quintelaecho "TARGET_BASE_ARCH=$TARGET_BASE_ARCH" >> $config_target_mak
2553e6e91b9cSJuan Quintelaif [ "$TARGET_ABI_DIR" = "" ]; then
2554e6e91b9cSJuan Quintela  TARGET_ABI_DIR=$TARGET_ARCH
2555e6e91b9cSJuan Quintelafi
255625be210fSJuan Quintelaecho "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
25571b0c87fcSJuan Quintelacase "$target_arch2" in
25581b0c87fcSJuan Quintela  i386|x86_64)
25591b0c87fcSJuan Quintela    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
256025be210fSJuan Quintela      echo "CONFIG_XEN=y" >> $config_target_mak
25611b0c87fcSJuan Quintela    fi
25621b0c87fcSJuan Quintelaesac
2563c59249f9SJuan Quintelacase "$target_arch2" in
25640e60a699SAlexander Graf  i386|x86_64|ppcemb|ppc|ppc64|s390x)
2565c59249f9SJuan Quintela    # Make sure the target and host cpus are compatible
2566c59249f9SJuan Quintela    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
2567c59249f9SJuan Quintela      \( "$target_arch2" = "$cpu" -o \
2568c59249f9SJuan Quintela      \( "$target_arch2" = "ppcemb" -a "$cpu" = "ppc" \) -o \
25695f114bc6SAlexander Graf      \( "$target_arch2" = "ppc64"  -a "$cpu" = "ppc" \) -o \
2570c59249f9SJuan Quintela      \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
2571c59249f9SJuan Quintela      \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
257225be210fSJuan Quintela      echo "CONFIG_KVM=y" >> $config_target_mak
257325be210fSJuan Quintela      echo "KVM_CFLAGS=$kvm_cflags" >> $config_target_mak
2574dae5079aSJan Kiszka      if test "$kvm_para" = "yes"; then
2575dae5079aSJan Kiszka        echo "CONFIG_KVM_PARA=y" >> $config_target_mak
2576dae5079aSJan Kiszka      fi
2577d5970055SMichael S. Tsirkin      if test $vhost_net = "yes" ; then
2578d5970055SMichael S. Tsirkin        echo "CONFIG_VHOST_NET=y" >> $config_target_mak
2579d5970055SMichael S. Tsirkin      fi
2580c59249f9SJuan Quintela    fi
2581c59249f9SJuan Quintelaesac
2582de83cd02Sbellardif test "$target_bigendian" = "yes" ; then
258325be210fSJuan Quintela  echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
258497a847bcSbellardfi
258597a847bcSbellardif test "$target_softmmu" = "yes" ; then
2586b1aa27c4SPaul Brook  echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
258725be210fSJuan Quintela  echo "CONFIG_SOFTMMU=y" >> $config_target_mak
258825be210fSJuan Quintela  echo "LIBS+=$libs_softmmu" >> $config_target_mak
25890e8c9214SAndreas Färber  echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
25905791f45bSKirill A. Shutemov  echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
2591de83cd02Sbellardfi
2592997344f3Sbellardif test "$target_user_only" = "yes" ; then
259325be210fSJuan Quintela  echo "CONFIG_USER_ONLY=y" >> $config_target_mak
2594997344f3Sbellardfi
2595831b7825Sthsif test "$target_linux_user" = "yes" ; then
259625be210fSJuan Quintela  echo "CONFIG_LINUX_USER=y" >> $config_target_mak
2597831b7825Sthsfi
2598831b7825Sthsif test "$target_darwin_user" = "yes" ; then
259925be210fSJuan Quintela  echo "CONFIG_DARWIN_USER=y" >> $config_target_mak
2600831b7825Sthsfi
260156aebc89Spbrooklist=""
260256aebc89Spbrookif test ! -z "$gdb_xml_files" ; then
260356aebc89Spbrook  for x in $gdb_xml_files; do
260456aebc89Spbrook    list="$list $source_path/gdb-xml/$x"
260556aebc89Spbrook  done
260625be210fSJuan Quintela  echo "TARGET_XML_FILES=$list" >> $config_target_mak
26073d0f1517SJuan Quintelafi
2608de83cd02Sbellard
2609f57975fbSJuan Quintelacase "$target_arch2" in
2610990b3e19SRichard Henderson  alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
261125be210fSJuan Quintela    echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
2612f57975fbSJuan Quintela    ;;
2613d6b38939SJuan Quintela  *)
261425be210fSJuan Quintela    echo "CONFIG_NOSOFTFLOAT=y" >> $config_target_mak
2615d6b38939SJuan Quintela    ;;
2616f57975fbSJuan Quintelaesac
2617f57975fbSJuan Quintela
2618e5fe0c52Spbrookif test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
261925be210fSJuan Quintela  echo "TARGET_HAS_BFLT=y" >> $config_target_mak
2620e5fe0c52Spbrookfi
2621bd0c5661Spbrookif test "$target_user_only" = "yes" \
2622bd0c5661Spbrook        -a "$nptl" = "yes" -a "$target_nptl" = "yes"; then
262325be210fSJuan Quintela  echo "CONFIG_USE_NPTL=y" >> $config_target_mak
2624bd0c5661Spbrookfi
2625379f6698SPaul Brookif test "$target_user_only" = "yes" -a "$guest_base" = "yes"; then
262625be210fSJuan Quintela  echo "CONFIG_USE_GUEST_BASE=y" >> $config_target_mak
2627379f6698SPaul Brookfi
262884778508Sblueswir1if test "$target_bsd_user" = "yes" ; then
262925be210fSJuan Quintela  echo "CONFIG_BSD_USER=y" >> $config_target_mak
263084778508Sblueswir1fi
26315b0753e0Sbellard
26324afddb55SJuan Quintela# generate QEMU_CFLAGS/LDFLAGS for targets
2633fa282484SJuan Quintela
26344afddb55SJuan Quintelacflags=""
2635fa282484SJuan Quintelaldflags=""
26369b8e111fSJuan Quintela
263757ddfbf7SJuan Quintelaif test "$ARCH" = "sparc64" ; then
263857ddfbf7SJuan Quintela  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
263924e804ecSAlexander Grafelif test "$ARCH" = "s390x" ; then
264024e804ecSAlexander Graf  cflags="-I\$(SRC_PATH)/tcg/s390 $cflags"
264157ddfbf7SJuan Quintelaelse
264257ddfbf7SJuan Quintela  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
264357ddfbf7SJuan Quintelafi
264457ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/tcg $cflags"
264557ddfbf7SJuan Quintelacflags="-I\$(SRC_PATH)/fpu $cflags"
264657ddfbf7SJuan Quintela
26474d904533SBlue Swirlif test "$target_user_only" = "yes" ; then
26484d904533SBlue Swirl    libdis_config_mak=libdis-user/config.mak
26494d904533SBlue Swirlelse
26504d904533SBlue Swirl    libdis_config_mak=libdis/config.mak
26514d904533SBlue Swirlfi
26524d904533SBlue Swirl
265364656024SJuan Quintelafor i in $ARCH $TARGET_BASE_ARCH ; do
265464656024SJuan Quintela  case "$i" in
265564656024SJuan Quintela  alpha)
265625be210fSJuan Quintela    echo "CONFIG_ALPHA_DIS=y"  >> $config_target_mak
26574d904533SBlue Swirl    echo "CONFIG_ALPHA_DIS=y"  >> $libdis_config_mak
265864656024SJuan Quintela  ;;
265964656024SJuan Quintela  arm)
266025be210fSJuan Quintela    echo "CONFIG_ARM_DIS=y"  >> $config_target_mak
26614d904533SBlue Swirl    echo "CONFIG_ARM_DIS=y"  >> $libdis_config_mak
266264656024SJuan Quintela  ;;
266364656024SJuan Quintela  cris)
266425be210fSJuan Quintela    echo "CONFIG_CRIS_DIS=y"  >> $config_target_mak
26654d904533SBlue Swirl    echo "CONFIG_CRIS_DIS=y"  >> $libdis_config_mak
266664656024SJuan Quintela  ;;
266764656024SJuan Quintela  hppa)
266825be210fSJuan Quintela    echo "CONFIG_HPPA_DIS=y"  >> $config_target_mak
26694d904533SBlue Swirl    echo "CONFIG_HPPA_DIS=y"  >> $libdis_config_mak
267064656024SJuan Quintela  ;;
267164656024SJuan Quintela  i386|x86_64)
267225be210fSJuan Quintela    echo "CONFIG_I386_DIS=y"  >> $config_target_mak
26734d904533SBlue Swirl    echo "CONFIG_I386_DIS=y"  >> $libdis_config_mak
267464656024SJuan Quintela  ;;
2675903ec55cSAurelien Jarno  ia64*)
2676903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $config_target_mak
2677903ec55cSAurelien Jarno    echo "CONFIG_IA64_DIS=y"  >> $libdis_config_mak
2678903ec55cSAurelien Jarno  ;;
267964656024SJuan Quintela  m68k)
268025be210fSJuan Quintela    echo "CONFIG_M68K_DIS=y"  >> $config_target_mak
26814d904533SBlue Swirl    echo "CONFIG_M68K_DIS=y"  >> $libdis_config_mak
268264656024SJuan Quintela  ;;
268364656024SJuan Quintela  microblaze)
268425be210fSJuan Quintela    echo "CONFIG_MICROBLAZE_DIS=y"  >> $config_target_mak
26854d904533SBlue Swirl    echo "CONFIG_MICROBLAZE_DIS=y"  >> $libdis_config_mak
268664656024SJuan Quintela  ;;
268764656024SJuan Quintela  mips*)
268825be210fSJuan Quintela    echo "CONFIG_MIPS_DIS=y"  >> $config_target_mak
26894d904533SBlue Swirl    echo "CONFIG_MIPS_DIS=y"  >> $libdis_config_mak
269064656024SJuan Quintela  ;;
269164656024SJuan Quintela  ppc*)
269225be210fSJuan Quintela    echo "CONFIG_PPC_DIS=y"  >> $config_target_mak
26934d904533SBlue Swirl    echo "CONFIG_PPC_DIS=y"  >> $libdis_config_mak
269464656024SJuan Quintela  ;;
269524e804ecSAlexander Graf  s390*)
269625be210fSJuan Quintela    echo "CONFIG_S390_DIS=y"  >> $config_target_mak
26974d904533SBlue Swirl    echo "CONFIG_S390_DIS=y"  >> $libdis_config_mak
269864656024SJuan Quintela  ;;
269964656024SJuan Quintela  sh4)
270025be210fSJuan Quintela    echo "CONFIG_SH4_DIS=y"  >> $config_target_mak
27014d904533SBlue Swirl    echo "CONFIG_SH4_DIS=y"  >> $libdis_config_mak
270264656024SJuan Quintela  ;;
270364656024SJuan Quintela  sparc*)
270425be210fSJuan Quintela    echo "CONFIG_SPARC_DIS=y"  >> $config_target_mak
27054d904533SBlue Swirl    echo "CONFIG_SPARC_DIS=y"  >> $libdis_config_mak
270664656024SJuan Quintela  ;;
270764656024SJuan Quintela  esac
270864656024SJuan Quinteladone
270964656024SJuan Quintela
27106ee7126fSJuan Quintelacase "$ARCH" in
27116ee7126fSJuan Quintelaalpha)
27126ee7126fSJuan Quintela  # Ensure there's only a single GP
27136ee7126fSJuan Quintela  cflags="-msmall-data $cflags"
27146ee7126fSJuan Quintela;;
27156ee7126fSJuan Quintelaesac
27166ee7126fSJuan Quintela
271755d9c04bSJuan Quintelaif test "$target_softmmu" = "yes" ; then
271855d9c04bSJuan Quintela  case "$TARGET_BASE_ARCH" in
271955d9c04bSJuan Quintela  arm)
272055d9c04bSJuan Quintela    cflags="-DHAS_AUDIO $cflags"
272155d9c04bSJuan Quintela  ;;
272255d9c04bSJuan Quintela  i386|mips|ppc)
272355d9c04bSJuan Quintela    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
272455d9c04bSJuan Quintela  ;;
272555d9c04bSJuan Quintela  esac
272655d9c04bSJuan Quintelafi
272755d9c04bSJuan Quintela
272834005a00SKirill A. Shutemovif test "$target_user_only" = "yes" -a "$static" = "no" -a \
272934005a00SKirill A. Shutemov	"$user_pie" = "yes" ; then
273034005a00SKirill A. Shutemov  cflags="-fpie $cflags"
273134005a00SKirill A. Shutemov  ldflags="-pie $ldflags"
273234005a00SKirill A. Shutemovfi
273334005a00SKirill A. Shutemov
2734471857ddSJuan Quintelaif test "$target_softmmu" = "yes" -a \( \
2735471857ddSJuan Quintela        "$TARGET_ARCH" = "microblaze" -o \
2736471857ddSJuan Quintela        "$TARGET_ARCH" = "cris" \) ; then
273725be210fSJuan Quintela  echo "CONFIG_NEED_MMU=y" >> $config_target_mak
2738471857ddSJuan Quintelafi
2739471857ddSJuan Quintela
2740d02c1db3SJuan Quintelaif test "$gprof" = "yes" ; then
274125be210fSJuan Quintela  echo "TARGET_GPROF=yes" >> $config_target_mak
2742d02c1db3SJuan Quintela  if test "$target_linux_user" = "yes" ; then
2743d02c1db3SJuan Quintela    cflags="-p $cflags"
2744d02c1db3SJuan Quintela    ldflags="-p $ldflags"
2745d02c1db3SJuan Quintela  fi
2746d02c1db3SJuan Quintela  if test "$target_softmmu" = "yes" ; then
2747d02c1db3SJuan Quintela    ldflags="-p $ldflags"
274825be210fSJuan Quintela    echo "GPROF_CFLAGS=-p" >> $config_target_mak
2749d02c1db3SJuan Quintela  fi
2750d02c1db3SJuan Quintelafi
2751d02c1db3SJuan Quintela
27526ee7126fSJuan Quintelalinker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
27539b8e111fSJuan Quintelaif test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
2754fa282484SJuan Quintela  case "$ARCH" in
2755fa282484SJuan Quintela  sparc)
2756fa282484SJuan Quintela    # -static is used to avoid g1/g3 usage by the dynamic linker
2757322e5878SJuan Quintela    ldflags="$linker_script -static $ldflags"
2758fa282484SJuan Quintela    ;;
2759fd76e73aSRichard Henderson  *)
2760322e5878SJuan Quintela    ldflags="$linker_script $ldflags"
2761fa282484SJuan Quintela    ;;
2762fa282484SJuan Quintela  esac
2763fa282484SJuan Quintelafi
2764fa282484SJuan Quintela
276525be210fSJuan Quintelaecho "LDFLAGS+=$ldflags" >> $config_target_mak
276625be210fSJuan Quintelaecho "QEMU_CFLAGS+=$cflags" >> $config_target_mak
2767fa282484SJuan Quintela
276897a847bcSbellarddone # for target in $targets
27697d13299dSbellard
27707d13299dSbellard# build tree in object directory if source path is different from current one
27717d13299dSbellardif test "$source_path_used" = "yes" ; then
2772e1144d00SMark McLoughlin    DIRS="tests tests/cris slirp audio block net pc-bios/optionrom"
27732d9f27d2SAnthony Liguori    DIRS="$DIRS roms/seabios roms/vgabios"
277474db920cSGautham R Shenoy    DIRS="$DIRS fsdev"
27757d13299dSbellard    FILES="Makefile tests/Makefile"
2776e7daa605Sths    FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit"
2777e1ffb0f1Sedgar_igl    FILES="$FILES tests/test-mmap.c"
27787ea78b74SJan Kiszka    FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps pc-bios/video.x"
27792d9f27d2SAnthony Liguori    FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
27807ea78b74SJan Kiszka    for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do
27817ea78b74SJan Kiszka        FILES="$FILES pc-bios/`basename $bios_file`"
27827ea78b74SJan Kiszka    done
27837d13299dSbellard    for dir in $DIRS ; do
27847d13299dSbellard            mkdir -p $dir
27857d13299dSbellard    done
2786ec530c81Sbellard    # remove the link and recreate it, as not all "ln -sf" overwrite the link
27877d13299dSbellard    for f in $FILES ; do
2788ec530c81Sbellard        rm -f $f
2789ec530c81Sbellard        ln -s $source_path/$f $f
27907d13299dSbellard    done
27917d13299dSbellardfi
27921ad2134fSPaul Brook
2793c34ebfdcSAnthony Liguori# temporary config to build submodules
27942d9f27d2SAnthony Liguorifor rom in seabios vgabios ; do
2795c34ebfdcSAnthony Liguori    config_mak=roms/$rom/config.mak
279637116c89SStefan Weil    echo "# Automatically generated by configure - do not modify" > $config_mak
2797c34ebfdcSAnthony Liguori    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
2798c34ebfdcSAnthony Liguori    echo "CC=$cc" >> $config_mak
2799c34ebfdcSAnthony Liguori    echo "BCC=bcc" >> $config_mak
2800c34ebfdcSAnthony Liguori    echo "CPP=${cross_prefix}cpp" >> $config_mak
2801c34ebfdcSAnthony Liguori    echo "OBJCOPY=objcopy" >> $config_mak
2802c34ebfdcSAnthony Liguori    echo "IASL=iasl" >> $config_mak
2803c34ebfdcSAnthony Liguori    echo "HOST_CC=$host_cc" >> $config_mak
2804c34ebfdcSAnthony Liguori    echo "LD=$ld" >> $config_mak
2805c34ebfdcSAnthony Liguoridone
2806c34ebfdcSAnthony Liguori
28071ad2134fSPaul Brookfor hwlib in 32 64; do
28081ad2134fSPaul Brook  d=libhw$hwlib
28091ad2134fSPaul Brook  mkdir -p $d
28109953b2fcSBlue Swirl  mkdir -p $d/ide
28111ad2134fSPaul Brook  rm -f $d/Makefile
28121ad2134fSPaul Brook  ln -s $source_path/Makefile.hw $d/Makefile
281337116c89SStefan Weil  echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
28141ad2134fSPaul Brookdone
2815add16157SBlue Swirl
2816add16157SBlue Swirld=libuser
2817add16157SBlue Swirlmkdir -p $d
2818add16157SBlue Swirlrm -f $d/Makefile
2819add16157SBlue Swirlln -s $source_path/Makefile.user $d/Makefile
2820299060a0SKirill A. Shutemovif test "$static" = "no" -a "$user_pie" = "yes" ; then
2821299060a0SKirill A. Shutemov  echo "QEMU_CFLAGS+=-fpie" > $d/config.mak
2822299060a0SKirill A. Shutemovfi
2823b40292e7SJan Kiszka
2824b40292e7SJan Kiszkaif test "$docs" = "yes" ; then
2825b40292e7SJan Kiszka  mkdir -p QMP
2826b40292e7SJan Kiszkafi
2827