X-Git-Url: https://repo.jachan.dev/qemu.git/blobdiff_plain/6b383c08c46468ecee98ecf71ffd8362e9bd7f42..7107e5a756317151666d47d1bc1e170293babaff:/configure diff --git a/configure b/configure index 7ba4bcb866..222694f34d 100755 --- a/configure +++ b/configure @@ -103,7 +103,8 @@ update_cxxflags() { } compile_object() { - do_cc $QEMU_CFLAGS -c -o $TMPO $TMPC + local_cflags="$1" + do_cc $QEMU_CFLAGS $local_cflags -c -o $TMPO $TMPC } compile_prog() { @@ -284,8 +285,6 @@ sysconfdir="\${prefix}/etc" local_statedir="\${prefix}/var" confsuffix="/qemu" slirp="yes" -fmod_lib="" -fmod_inc="" oss_lib="" bsd="no" linux="no" @@ -309,7 +308,7 @@ rbd="" smartcard_nss="" libusb="" usb_redir="" -glx="" +opengl="" zlib="yes" lzo="" snappy="" @@ -327,7 +326,7 @@ seccomp="" glusterfs="" glusterfs_discard="no" glusterfs_zerofill="no" -archipelago="" +archipelago="no" gtk="" gtkabi="" vte="" @@ -336,6 +335,7 @@ libssh2="" vhdx="" quorum="" numa="" +tcmalloc="no" # parse CC options first for opt do @@ -351,7 +351,7 @@ for opt do ;; --cpu=*) cpu="$optarg" ;; - --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS" + --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg" EXTRA_CFLAGS="$optarg" ;; --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS" @@ -435,6 +435,20 @@ EOF compile_object } +check_include() { +cat > $TMPC < +int main(void) { return 0; } +EOF + compile_object +} + +write_c_skeleton() { + cat > $TMPC < $TMPC << EOF -int main(void) { return 0; } -EOF + write_c_skeleton; if compile_prog "" "-liberty" ; then LIBS="-liberty $LIBS" fi @@ -841,10 +854,6 @@ for opt do ;; --enable-vnc) vnc="yes" ;; - --fmod-lib=*) fmod_lib="$optarg" - ;; - --fmod-inc=*) fmod_inc="$optarg" - ;; --oss-lib=*) oss_lib="$optarg" ;; --audio-drv-list=*) audio_drv_list="$optarg" @@ -1027,9 +1036,9 @@ for opt do ;; --enable-vhost-scsi) vhost_scsi="yes" ;; - --disable-glx) glx="no" + --disable-opengl) opengl="no" ;; - --enable-glx) glx="yes" + --enable-opengl) opengl="yes" ;; --disable-rbd) rbd="no" ;; @@ -1134,6 +1143,10 @@ for opt do ;; --enable-numa) numa="yes" ;; + --disable-tcmalloc) tcmalloc="no" + ;; + --enable-tcmalloc) tcmalloc="yes" + ;; *) echo "ERROR: unknown option $opt" echo "Try '$0 --help' for more information" @@ -1339,8 +1352,6 @@ Advanced options (experts only): --disable-guest-base disable GUEST_BASE support --enable-pie build Position Independent Executables --disable-pie do not build Position Independent Executables - --fmod-lib path to FMOD library - --fmod-inc path to FMOD includes --oss-lib path to OSS library --cpu=CPU Build for host CPU [$cpu] --disable-uuid disable uuid support @@ -1407,6 +1418,8 @@ Advanced options (experts only): --enable-quorum enable quorum block filter support --disable-numa disable libnuma support --enable-numa enable libnuma support + --disable-tcmalloc disable tcmalloc support + --enable-tcmalloc enable tcmalloc support NOTE: The object files are built at the place where configure is launched EOF @@ -1438,10 +1451,7 @@ if test -z "$werror" ; then fi # check that the C compiler works. -cat > $TMPC < $TMPC << EOF -int main(void) { return 0; } -EOF -for flag in $gcc_flags; do + +cc_has_warning_flag() { + write_c_skeleton; + # Use the positive sense of the flag when testing for -Wno-wombat # support (gcc will happily accept the -Wno- form of unknown # warning options). - optflag="$(echo $flag | sed -e 's/^-Wno-/-W/')" - if compile_prog "-Werror $optflag" "" ; then - QEMU_CFLAGS="$QEMU_CFLAGS $flag" + optflag="$(echo $1 | sed -e 's/^-Wno-/-W/')" + compile_prog "-Werror $optflag" "" +} + +for flag in $gcc_flags; do + if cc_has_warning_flag $flag ; then + QEMU_CFLAGS="$QEMU_CFLAGS $flag" fi done @@ -1549,6 +1563,17 @@ if test "$static" = "yes" ; then fi fi +# Unconditional check for compiler __thread support + cat > $TMPC << EOF +static __thread int tls_var; +int main(void) { return tls_var; } +EOF + +if ! compile_prog "-Werror" "" ; then + error_exit "Your compiler does not support the __thread specifier for " \ + "Thread-Local Storage (TLS). Please upgrade to a version that does." +fi + if test "$pie" = ""; then case "$cpu-$targetos" in i386-Linux|x86_64-Linux|x32-Linux|i386-OpenBSD|x86_64-OpenBSD) @@ -1589,7 +1614,7 @@ EOF fi fi - if compile_prog "-fno-pie" "-nopie"; then + if compile_prog "-Werror -fno-pie" "-nopie"; then CFLAGS_NOPIE="-fno-pie" LDFLAGS_NOPIE="-nopie" fi @@ -2084,6 +2109,15 @@ if test "$sparse" != "no" ; then fi fi +########################################## +# X11 probe +x11_cflags= +x11_libs=-lX11 +if $pkg_config --exists "x11"; then + x11_cflags=`$pkg_config --cflags x11` + x11_libs=`$pkg_config --libs x11` +fi + ########################################## # GTK probe @@ -2111,7 +2145,8 @@ if test "$gtk" != "no"; then gtk_cflags=`$pkg_config --cflags $gtkpackage` gtk_libs=`$pkg_config --libs $gtkpackage` if $pkg_config --exists "$gtkx11package >= $gtkversion"; then - gtk_libs="$gtk_libs -lX11" + gtk_cflags="$gtk_cflags $x11_cflags" + gtk_libs="$gtk_libs $x11_libs" fi libs_softmmu="$gtk_libs $libs_softmmu" gtk="yes" @@ -2236,8 +2271,9 @@ if test "$sdl" = "yes" ; then #endif int main(void) { return 0; } EOF - if compile_prog "$sdl_cflags" "$sdl_libs" ; then - sdl_libs="$sdl_libs -lX11" + if compile_prog "$sdl_cflags $x11_cflags" "$sdl_libs $x11_libs" ; then + sdl_cflags="$sdl_cflags $x11_cflags" + sdl_libs="$sdl_libs $x11_libs" fi libs_softmmu="$sdl_libs $libs_softmmu" fi @@ -2586,21 +2622,6 @@ for drv in $audio_drv_list; do libs_softmmu="-lasound $libs_softmmu" ;; - fmod) - if test -z $fmod_lib || test -z $fmod_inc; then - error_exit "You must specify path to FMOD library and headers" \ - "Example: --fmod-inc=/path/include/fmod --fmod-lib=/path/lib/libfmod-3.74.so" - fi - audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc" - libs_softmmu="$fmod_lib $libs_softmmu" - ;; - - esd) - audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);' - libs_softmmu="-lesd $libs_softmmu" - audio_pt_int="yes" - ;; - pa) audio_drv_probe $drv pulse/mainloop.h "-lpulse" \ "pa_mainloop *m = 0; pa_mainloop_free (m); return 0;" @@ -2625,11 +2646,6 @@ for drv in $audio_drv_list; do # XXX: Probes for CoreAudio, DirectSound, SDL(?) ;; - winwave) - libs_softmmu="-lwinmm $libs_softmmu" - audio_win_int="yes" - ;; - *) echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { error_exit "Unknown driver '$drv' selected" \ @@ -2744,12 +2760,7 @@ fi ########################################## # glib support probe -if test "$mingw32" = yes; then - # g_poll is required in order to integrate with the glib main loop. - glib_req_ver=2.20 -else - glib_req_ver=2.12 -fi +glib_req_ver=2.22 glib_modules=gthread-2.0 if test "$modules" = yes; then glib_modules="$glib_modules gmodule-2.0" @@ -2773,6 +2784,18 @@ if ! $pkg_config --atleast-version=2.38 glib-2.0; then glib_subprocess=no fi +# Silence clang 3.5.0 warnings about glib attribute __alloc_size__ usage +cat > $TMPC << EOF +#include +int main(void) { return 0; } +EOF +if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then + if cc_has_warning_flag "-Wno-unknown-attributes"; then + glib_cflags="-Wno-unknown-attributes $glib_cflags" + CFLAGS="-Wno-unknown-attributes $CFLAGS" + fi +fi + ########################################## # SHA command probe for modules if test "$modules" = yes; then @@ -3073,9 +3096,11 @@ fi if test "$fdt" != "no" ; then fdt_libs="-lfdt" # explicitly check for libfdt_env.h as it is missing in some stable installs + # and test for required functions to make sure we are on a version >= 1.4.0 cat > $TMPC << EOF +#include #include -int main(void) { return 0; } +int main(void) { fdt_get_property_by_offset(0, 0, 0); return 0; } EOF if compile_prog "" "$fdt_libs" ; then # system DTC is good - use it @@ -3093,7 +3118,7 @@ EOF fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs" elif test "$fdt" = "yes" ; then # have neither and want - prompt for system/submodule install - error_exit "DTC (libfdt) not present. Your options:" \ + error_exit "DTC (libfdt) version >= 1.4.0 not present. Your options:" \ " (1) Preferred: Install the DTC (libfdt) devel package" \ " (2) Fetch the DTC submodule, using:" \ " git submodule update --init dtc" @@ -3107,23 +3132,35 @@ fi libs_softmmu="$libs_softmmu $fdt_libs" ########################################## +# opengl probe (for sdl2, milkymist-tmu2) + # GLX probe, used by milkymist-tmu2 -if test "$glx" != "no" ; then - glx_libs="-lGL -lX11" - cat > $TMPC << EOF +# this is temporary, code will be switched to egl mid-term. +cat > $TMPC << EOF #include #include #include int main(void) { glBegin(0); glXQueryVersion(0,0,0); return 0; } EOF - if compile_prog "" "-lGL -lX11" ; then - glx=yes +if compile_prog "" "-lGL -lX11" ; then + have_glx=yes +else + have_glx=no +fi + +if test "$opengl" != "no" ; then + opengl_pkgs="gl glesv2 epoxy egl" + if $pkg_config $opengl_pkgs x11 && test "$have_glx" = "yes"; then + opengl_cflags="$($pkg_config --cflags $opengl_pkgs) $x11_cflags" + opengl_libs="$($pkg_config --libs $opengl_pkgs) $x11_libs" + opengl=yes else - if test "$glx" = "yes" ; then - feature_not_found "glx" "Install GL devel (e.g. MESA)" + if test "$opengl" = "yes" ; then + feature_not_found "opengl" "Please install opengl (mesa) devel pkgs: $opengl_pkgs" fi - glx_libs= - glx=no + opengl_cflags="" + opengl_libs="" + opengl=no fi fi @@ -3145,6 +3182,12 @@ EOF archipelago="yes" libs_tools="$archipelago_libs $libs_tools" libs_softmmu="$archipelago_libs $libs_softmmu" + + echo "WARNING: Please check the licenses of QEMU and libxseg carefully." + echo "GPLv3 versions of libxseg may not be compatible with QEMU's" + echo "license and therefore prevent redistribution." + echo + echo "To disable Archipelago, use --disable-archipelago" else if test "$archipelago" = "yes" ; then feature_not_found "Archipelago backend support" "Install libxseg devel" @@ -3301,6 +3344,22 @@ EOF fi fi +########################################## +# tcmalloc probe + +if test "$tcmalloc" = "yes" ; then + cat > $TMPC << EOF +#include +int main(void) { malloc(1); return 0; } +EOF + + if compile_prog "" "-ltcmalloc" ; then + LIBS="-ltcmalloc $LIBS" + else + feature_not_found "tcmalloc" "install gperftools devel" + fi +fi + ########################################## # signalfd probe signalfd="no" @@ -4129,6 +4188,33 @@ if compile_prog "" "" ; then getauxval=yes fi +######################################## +# check if ccache is interfering with +# semantic analysis of macros + +ccache_cpp2=no +cat > $TMPC << EOF +static const int Z = 1; +#define fn() ({ Z; }) +#define TAUT(X) ((X) == Z) +#define PAREN(X, Y) (X == Y) +#define ID(X) (X) +int main(int argc, char *argv[]) +{ + int x = 0, y = 0; + x = ID(x); + x = fn(); + fn(); + if (PAREN(x, y)) return 0; + if (TAUT(Z)) return 0; + return 0; +} +EOF + +if ! compile_object "-Werror"; then + ccache_cpp2=yes +fi + ########################################## # End of CC checks # After here, no more $cc or $ld runs @@ -4390,7 +4476,7 @@ echo "xfsctl support $xfs" echo "nss used $smartcard_nss" echo "libusb $libusb" echo "usb net redir $usb_redir" -echo "GLX support $glx" +echo "OpenGL support $opengl" echo "libiscsi support $libiscsi" echo "libnfs support $libnfs" echo "build guest agent $guest_agent" @@ -4412,6 +4498,7 @@ echo "lzo support $lzo" echo "snappy support $snappy" echo "bzip2 support $bzip2" echo "NUMA host support $numa" +echo "tcmalloc support $tcmalloc" if test "$sdl_too_old" = "yes"; then echo "-> Your SDL version is too old - please upgrade to have SDL support" @@ -4523,9 +4610,6 @@ echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak for drv in $audio_drv_list; do def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'` echo "$def=y" >> $config_host_mak - if test "$drv" = "fmod"; then - echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak - fi done if test "$audio_pt_int" = "yes" ; then echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak @@ -4756,9 +4840,10 @@ if test "$usb_redir" = "yes" ; then echo "CONFIG_USB_REDIR=y" >> $config_host_mak fi -if test "$glx" = "yes" ; then - echo "CONFIG_GLX=y" >> $config_host_mak - echo "GLX_LIBS=$glx_libs" >> $config_host_mak +if test "$opengl" = "yes" ; then + echo "CONFIG_OPENGL=y" >> $config_host_mak + echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak + echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak fi if test "$lzo" = "yes" ; then @@ -5139,8 +5224,6 @@ case "$target_name" in TARGET_BASE_ARCH=mips echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak ;; - tricore) - ;; moxie) ;; or32) @@ -5189,7 +5272,9 @@ case "$target_name" in echo "TARGET_ABI32=y" >> $config_target_mak ;; s390x) - gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml" + gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml" + ;; + tricore) ;; unicore32) ;; @@ -5244,7 +5329,9 @@ case "$target_name" in \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \ \( "$target_name" = "mipsel" -a "$cpu" = "mips" \) -o \ \( "$target_name" = "x86_64" -a "$cpu" = "i386" \) -o \ - \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) \) ; then + \( "$target_name" = "i386" -a "$cpu" = "x86_64" \) -o \ + \( "$target_name" = "x86_64" -a "$cpu" = "x32" \) -o \ + \( "$target_name" = "i386" -a "$cpu" = "x32" \) \) ; then echo "CONFIG_KVM=y" >> $config_target_mak if test "$vhost_net" = "yes" ; then echo "CONFIG_VHOST_NET=y" >> $config_target_mak @@ -5418,6 +5505,10 @@ if test "$numa" = "yes"; then echo "CONFIG_NUMA=y" >> $config_host_mak fi +if test "$ccache_cpp2" = "yes"; then + echo "export CCACHE_CPP2=y" >> $config_host_mak +fi + # build tree in object directory in case the source is not in the current directory DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests" DIRS="$DIRS fsdev"