preparation for autoconfy configure script
v3 cover preparation for autoconfy configure script
This is part two of the configure series. It does various miscellaneous changes to the configure script that make it possible to later handle an autoconfy command-line.
The rest is left for after 0.14, unless the release takes much more than expected.
v1->v2
misc comments addressed
v2->v3
rebased, preserved Solaris compatibility for the three srcdir patches (11 to 13).
Paolo Bonzini (15):
default compilation tools to environment variables
default make and install to environment variables
move feature variables to the top
fix sparse support (?)
test cc with the complete set of chosen flags
do not pass bogus $(SRC_PATH) include paths to cc during configure provide portable HOST_LONG_BITS test
fix spelling of $pkg_config, move default together with other cross tools do not default to non-prefixed pkg-config when cross compiling reorganize sdl-config tests
move "ln -sf" emulation to a function
remove source_path_used
move --srcdir detection earlier
remove HOST_CC mention from roms/{sea,vga}bios/config.mak make trace options use autoconfy names
configure | 438 +++++++++++++++++++++++++++----------------------------- rules.mak | 6 +- tests/Makefile | 3 +- 3 files changed, 216 insertions(+), 231 deletions(-)
Signature · 1 line
1.7.3.2
PATCH v3 1/15 default compilation tools to environment variables
--- configure | 20 +++++++------------- 1 files changed, 7 insertions(+), 13 deletions(-)
configure +7 -13
@@ -74,19 +74,13 @@ interp_prefix="/usr/gnemul/qemu-%M" static="no" sparc_cpu="" cross_prefix="" -cc="gcc" audio_drv_list="" audio_card_list="ac97 es1370 sb16 hda" audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" block_drv_whitelist="" host_cc="gcc" -ar="ar" make="make" install="install" -objcopy="objcopy" -ld="ld" -strip="strip" -windres="windres" helper_cflags="" libs_softmmu="" libs_tools=""
@@ -100,7 +94,7 @@ for opt do case "$opt" in --cross-prefix=*) cross_prefix="$optarg" ;; - --cc=*) cc="$optarg" + --cc=*) CC="$optarg" ;; --cpu=*) cpu="$optarg" ;;
@@ -129,12 +123,12 @@ done # Using uname is really, really broken. Once we have the right set of checks # we can eliminate it's usage altogether -cc="${cross_prefix}${cc}" -ar="${cross_prefix}${ar}" -objcopy="${cross_prefix}${objcopy}" -ld="${cross_prefix}${ld}" -strip="${cross_prefix}${strip}" -windres="${cross_prefix}${windres}" +cc="${cross_prefix}${CC-gcc}" +ar="${cross_prefix}${AR-ar}" +objcopy="${cross_prefix}${OBJCOPY-objcopy}" +ld="${cross_prefix}${LD-ld}" +strip="${cross_prefix}${STRIP-strip}" +windres="${cross_prefix}${WINDRES-windres}" # default flags for all hosts QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
Signature · 1 line
1.7.3.2
PATCH v3 2/15 default make and install to environment variables
In reply to Paolo Bonzini--- configure | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
configure +10 -9
@@ -79,8 +79,6 @@ audio_card_list="ac97 es1370 sb16 hda" audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda" block_drv_whitelist="" host_cc="gcc" -make="make" -install="install" helper_cflags="" libs_softmmu="" libs_tools=""
@@ -363,7 +361,7 @@ GNU/kFreeBSD) ;; FreeBSD) bsd="yes" - make="gmake" + make="${MAKE-gmake}" audio_drv_list="oss" audio_possible_drivers="oss sdl esd pa" # needed for kinfo_getvmmap(3) in libutil.h
@@ -371,20 +369,20 @@ FreeBSD) ;; DragonFly) bsd="yes" - make="gmake" + make="${MAKE-gmake}" audio_drv_list="oss" audio_possible_drivers="oss sdl esd pa" ;; NetBSD) bsd="yes" - make="gmake" + make="${MAKE-gmake}" audio_drv_list="oss" audio_possible_drivers="oss sdl esd" oss_lib="-lossaudio" ;; OpenBSD) bsd="yes" - make="gmake" + make="${MAKE-gmake}" audio_drv_list="oss" audio_possible_drivers="oss sdl esd" oss_lib="-lossaudio"
@@ -413,8 +411,8 @@ Darwin) ;; SunOS) solaris="yes" - make="gmake" - install="ginstall" + make="${MAKE-gmake}" + install="${INSTALL-ginstall}" ld="gld" needs_libsunmath="no" solarisrev=`uname -r | cut -f2 -d.`
@@ -453,7 +451,7 @@ SunOS) ;; AIX) aix="yes" - make="gmake" + make="${MAKE-gmake}" ;; Haiku) haiku="yes"
@@ -479,6 +477,9 @@ if [ "$bsd" = "yes" ] ; then bsd_user="yes" fi +: ${make=${MAKE-make}} +: ${install=${INSTALL-install}} + if test "$mingw32" = "yes" ; then EXESUF=".exe" QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
Signature · 1 line
1.7.3.2
PATCH v3 3/15 move feature variables to the top
In reply to Paolo Bonzini--- configure | 164 ++++++++++++++++++++++++++++++------------------------------ 1 files changed, 82 insertions(+), 82 deletions(-)
configure +82 -82
@@ -86,6 +86,88 @@ audio_pt_int="" audio_win_int="" cc_i386=i386-pc-linux-gnu-gcc +target_list="" + +# Default value for a variable defining feature "foo". +# * foo="no" feature will only be used if --enable-foo arg is given +# * foo="" feature will be searched for, and if found, will be used +# unless --disable-foo is given +# * foo="yes" this value will only be set by --enable-foo flag. +# feature will searched for, +# if not found, configure exits with error +# +# Always add --enable-foo and --disable-foo command line args. +# Distributions want to ensure that several features are compiled in, and it +# is impossible without a --enable-foo that exits if a feature is not found. + +bluez="" +brlapi="" +curl="" +curses="" +docs="" +fdt="" +kvm="" +kvm_para="" +nptl="" +sdl="" +sparse="no" +uuid="" +vde="" +vnc_tls="" +vnc_sasl="" +vnc_jpeg="" +vnc_png="" +vnc_thread="no" +xen="" +linux_aio="" +attr="" +vhost_net="" +xfs="" + +gprof="no" +debug_tcg="no" +debug_mon="no" +debug="no" +strip_opt="yes" +bigendian="no" +mingw32="no" +EXESUF="" +prefix="/usr/local" +mandir="\${prefix}/share/man" +datadir="\${prefix}/share/qemu" +docdir="\${prefix}/share/doc/qemu" +bindir="\${prefix}/bin" +sysconfdir="\${prefix}/etc" +confsuffix="/qemu" +slirp="yes" +fmod_lib="" +fmod_inc="" +oss_lib="" +bsd="no" +linux="no" +solaris="no" +profiler="no" +cocoa="no" +softmmu="yes" +linux_user="no" +darwin_user="no" +bsd_user="no" +guest_base="" +uname_release="" +io_thread="no" +mixemu="no" +kerneldir="" +aix="no" +blobs="yes" +pkgversion="" +check_utests="no" +user_pie="no" +zero_malloc="" +trace_backend="nop" +trace_file="trace" +spice="" +rbd="" + # parse CC options first for opt do optarg=`expr "x$opt" : 'x[^=]*=\(.*\)'`
@@ -208,7 +290,6 @@ else cpu=`uname -m` fi -target_list="" case "$cpu" in alpha|cris|ia64|m68k|microblaze|ppc|ppc64|sparc64) cpu="$cpu"
@@ -246,87 +327,6 @@ case "$cpu" in ;; esac -# Default value for a variable defining feature "foo". -# * foo="no" feature will only be used if --enable-foo arg is given -# * foo="" feature will be searched for, and if found, will be used -# unless --disable-foo is given -# * foo="yes" this value will only be set by --enable-foo flag. -# feature will searched for, -# if not found, configure exits with error -# -# Always add --enable-foo and --disable-foo command line args. -# Distributions want to ensure that several features are compiled in, and it -# is impossible without a --enable-foo that exits if a feature is not found. - -bluez="" -brlapi="" -curl="" -curses="" -docs="" -fdt="" -kvm="" -kvm_para="" -nptl="" -sdl="" -sparse="no" -uuid="" -vde="" -vnc_tls="" -vnc_sasl="" -vnc_jpeg="" -vnc_png="" -vnc_thread="no" -xen="" -linux_aio="" -attr="" -vhost_net="" -xfs="" - -gprof="no" -debug_tcg="no" -debug_mon="no" -debug="no" -strip_opt="yes" -bigendian="no" -mingw32="no" -EXESUF="" -prefix="/usr/local" -mandir="\${prefix}/share/man" -datadir="\${prefix}/share/qemu" -docdir="\${prefix}/share/doc/qemu" -bindir="\${prefix}/bin" -sysconfdir="\${prefix}/etc" -confsuffix="/qemu" -slirp="yes" -fmod_lib="" -fmod_inc="" -oss_lib="" -bsd="no" -linux="no" -solaris="no" -profiler="no" -cocoa="no" -softmmu="yes" -linux_user="no" -darwin_user="no" -bsd_user="no" -guest_base="" -uname_release="" -io_thread="no" -mixemu="no" -kerneldir="" -aix="no" -haiku="no" -blobs="yes" -pkgversion="" -check_utests="no" -user_pie="no" -zero_malloc="" -trace_backend="nop" -trace_file="trace" -spice="" -rbd="" - # OS specific if check_define __linux__ ; then targetos="Linux"
Signature · 1 line
1.7.3.2
PATCH v3 4/15 fix sparse support (?)
In reply to Paolo BonziniI didn't test with sparse, but the old code using += before a variable was set was wrong. Sparse support should probably be ripped out or redone, but this at least keeps some sanity.
--- configure | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
configure +5 -5
@@ -2737,17 +2737,17 @@ echo "INSTALL_PROG=$install -m0755 -p" >> $config_host_mak echo "CC=$cc" >> $config_host_mak echo "CC_I386=$cc_i386" >> $config_host_mak echo "HOST_CC=$host_cc" >> $config_host_mak -if test "$sparse" = "yes" ; then - echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak - echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak - echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak -fi echo "AR=$ar" >> $config_host_mak echo "OBJCOPY=$objcopy" >> $config_host_mak echo "LD=$ld" >> $config_host_mak echo "WINDRES=$windres" >> $config_host_mak echo "CFLAGS=$CFLAGS" >> $config_host_mak echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak +if test "$sparse" = "yes" ; then + echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak + echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak + echo "QEMU_CFLAGS += -Wbitwise -Wno-transparent-union -Wno-old-initializer -Wno-non-pointer-null" >> $config_host_mak +fi echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak echo "LDFLAGS=$LDFLAGS" >> $config_host_mak echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
Signature · 1 line
1.7.3.2
PATCH v3 5/15 test cc with the complete set of chosen flags
In reply to Paolo BonziniThe "test the C compiler works ok" comes before a bunch of flags are added for --cpu or just depending on the host. It helps debugging if the test is done after these flags are (unconditionally) added.
--- configure | 50 +++++++++++++++++++++++++------------------------- 1 files changed, 25 insertions(+), 25 deletions(-)
configure +25 -25
@@ -220,31 +220,6 @@ QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" LDFLAGS="-g $LDFLAGS" -gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" -gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" -gcc_flags="-fstack-protector-all $gcc_flags" -cat > $TMPC << EOF -int main(void) { return 0; } -EOF -for flag in $gcc_flags; do - if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then - QEMU_CFLAGS="$QEMU_CFLAGS $flag" - fi -done - -# check that the C compiler works. -cat > $TMPC <<EOF -int main(void) {} -EOF - -if compile_object ; then - : C compiler works ok -else - echo "ERROR: \"$cc\" either does not exist or does not work" - exit 1 -fi - check_define() { cat > $TMPC <<EOF #if !defined($1)
@@ -941,6 +916,31 @@ echo "NOTE: The object files are built at the place where configure is launched" exit 1 fi +# check that the C compiler works. +cat > $TMPC <<EOF +int main(void) {} +EOF + +if compile_object ; then + : C compiler works ok +else + echo "ERROR: \"$cc\" either does not exist or does not work" + exit 1 +fi + +gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" +gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" +gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" +gcc_flags="-fstack-protector-all $gcc_flags" +cat > $TMPC << EOF +int main(void) { return 0; } +EOF +for flag in $gcc_flags; do + if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then + QEMU_CFLAGS="$QEMU_CFLAGS $flag" + fi +done + # # Solaris specific configure tool chain decisions #
Signature · 1 line
1.7.3.2
PATCH v3 6/15 do not pass bogus $(SRC_PATH) include paths to cc during configure
In reply to Paolo BonziniNon-existent -I paths are dropped silently by the compiler, but still it is not polite to pass bogus options. Configure-time tests do not need any include files from the source path, so only include -I flags at make time (when they're properly expanded).
--- configure | 19 +++++++++++-------- rules.mak | 6 +++--- tests/Makefile | 3 ++- 3 files changed, 16 insertions(+), 12 deletions(-)
configure +11 -8
@@ -217,7 +217,7 @@ QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $ QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" -QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS" +QEMU_INCLUDES="-I. -I\$(SRC_PATH)" LDFLAGS="-g $LDFLAGS" check_define() {
@@ -2513,7 +2513,7 @@ if test $profiler = "yes" ; then fi if test "$slirp" = "yes" ; then echo "CONFIG_SLIRP=y" >> $config_host_mak - QEMU_CFLAGS="-I\$(SRC_PATH)/slirp $QEMU_CFLAGS" + QEMU_INCLUDES="-I\$(SRC_PATH)/slirp $QEMU_INCLUDES" fi if test "$vde" = "yes" ; then echo "CONFIG_VDE=y" >> $config_host_mak
@@ -2743,6 +2743,7 @@ echo "LD=$ld" >> $config_host_mak echo "WINDRES=$windres" >> $config_host_mak echo "CFLAGS=$CFLAGS" >> $config_host_mak echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak +echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak if test "$sparse" = "yes" ; then echo "CC := REAL_CC=\"\$(CC)\" cgcc" >> $config_host_mak echo "HOST_CC := REAL_CC=\"\$(HOST_CC)\" cgcc" >> $config_host_mak
@@ -3051,19 +3052,20 @@ fi # generate QEMU_CFLAGS/LDFLAGS for targets cflags="" +includes="" ldflags="" if test "$ARCH" = "sparc64" ; then - cflags="-I\$(SRC_PATH)/tcg/sparc $cflags" + includes="-I\$(SRC_PATH)/tcg/sparc $includes" elif test "$ARCH" = "s390x" ; then - cflags="-I\$(SRC_PATH)/tcg/s390 $cflags" + includes="-I\$(SRC_PATH)/tcg/s390 $includes" elif test "$ARCH" = "x86_64" ; then - cflags="-I\$(SRC_PATH)/tcg/i386 $cflags" + includes="-I\$(SRC_PATH)/tcg/i386 $includes" else - cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags" + includes="-I\$(SRC_PATH)/tcg/\$(ARCH) $includes" fi -cflags="-I\$(SRC_PATH)/tcg $cflags" -cflags="-I\$(SRC_PATH)/fpu $cflags" +includes="-I\$(SRC_PATH)/tcg $includes" +includes="-I\$(SRC_PATH)/fpu $includes" if test "$target_user_only" = "yes" ; then libdis_config_mak=libdis-user/config.mak
@@ -3188,6 +3190,7 @@ fi echo "LDFLAGS+=$ldflags" >> $config_target_mak echo "QEMU_CFLAGS+=$cflags" >> $config_target_mak +echo "QEMU_INCLUDES+=$includes" >> $config_target_mak done # for target in $targets
rules.mak +3 -3
@@ -15,13 +15,13 @@ MAKEFLAGS += -rR QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d %.o: %.c - $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@") + $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," CC $(TARGET_DIR)$@") %.o: %.S - $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@") + $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," AS $(TARGET_DIR)$@") %.o: %.m - $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") + $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@") LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(LIBS)," LINK $(TARGET_DIR)$@")
tests/Makefile +2 -1
@@ -7,7 +7,8 @@ QEMU=../i386-linux-user/qemu-i386 QEMU_X86_64=../x86_64-linux-user/qemu-x86_64 CC_X86_64=$(CC_I386) -m64 -CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.. +QEMU_INCLUDES += -I.. +CFLAGS=-Wall -O2 -g -fno-strict-aliasing #CFLAGS+=-msse2 LDFLAGS=
Signature · 1 line
1.7.3.2
PATCH v3 7/15 provide portable HOST_LONG_BITS test
In reply to Paolo BonziniDo not hardcode the list of 64-bit CPUs. Use sizeof(void *) to compute it. Renaming it to HOST_LONG_BITS to HOST_POINTER_BITS is left for later.
--- configure | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-)
configure +9 -7
@@ -1084,13 +1084,15 @@ esac fi -# host long bits test -hostlongbits="32" -case "$cpu" in - x86_64|alpha|ia64|sparc64|ppc64|s390x) - hostlongbits=64 - ;; -esac +# host long bits test, actually a pointer size test +cat > $TMPC << EOF +int sizeof_pointer_is_8[sizeof(void *) == 8 ? 1 : -1]; +EOF +if compile_object; then +hostlongbits=64 +else +hostlongbits=32 +fi ##########################################
Signature · 1 line
1.7.3.2
PATCH v3 8/15 fix spelling of $pkg_config, move default together with other cross tools
In reply to Paolo Bonzini--- configure | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-)
configure +17 -17
@@ -209,6 +209,7 @@ objcopy="${cross_prefix}${OBJCOPY-objcopy}" ld="${cross_prefix}${LD-ld}" strip="${cross_prefix}${STRIP-strip}" windres="${cross_prefix}${WINDRES-windres}" +pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}" # default flags for all hosts QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
@@ -1159,12 +1160,11 @@ EOF fi ########################################## -# pkgconfig probe +# pkg-config probe -pkgconfig="${cross_prefix}pkg-config" -if ! has $pkgconfig; then +if ! has $pkg_config; then # likely not cross compiling, or hope for the best - pkgconfig=pkg-config + pkg_config=pkg-config fi ##########################################
@@ -1186,15 +1186,15 @@ fi # Look for sdl configuration program (pkg-config or sdl-config). # Prefer variant with cross prefix if cross compiling, # and favour pkg-config with sdl over sdl-config. -if test -n "$cross_prefix" -a $pkgconfig != pkg-config && \ - $pkgconfig sdl --modversion >/dev/null 2>&1; then - sdlconfig="$pkgconfig sdl" +if test -n "$cross_prefix" -a $pkg_config != pkg-config && \ + $pkg_config sdl --modversion >/dev/null 2>&1; then + sdlconfig="$pkg_config sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then sdlconfig="${cross_prefix}sdl-config" _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` -elif $pkgconfig sdl --modversion >/dev/null 2>&1; then - sdlconfig="$pkgconfig sdl" +elif $pkg_config sdl --modversion >/dev/null 2>&1; then + sdlconfig="$pkg_config sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` elif has sdl-config; then sdlconfig='sdl-config'
@@ -1274,8 +1274,8 @@ if test "$vnc_tls" != "no" ; then #include <gnutls/gnutls.h> int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } EOF - vnc_tls_cflags=`$pkgconfig --cflags gnutls 2> /dev/null` - vnc_tls_libs=`$pkgconfig --libs gnutls 2> /dev/null` + vnc_tls_cflags=`$pkg_config --cflags gnutls 2> /dev/null` + vnc_tls_libs=`$pkg_config --libs gnutls 2> /dev/null` if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then vnc_tls=yes libs_softmmu="$vnc_tls_libs $libs_softmmu"
@@ -1589,8 +1589,8 @@ fi ########################################## # curl probe -if $pkgconfig libcurl --modversion >/dev/null 2>&1; then - curlconfig="$pkgconfig libcurl" +if $pkg_config libcurl --modversion >/dev/null 2>&1; then + curlconfig="$pkg_config libcurl" else curlconfig=curl-config fi
@@ -1622,7 +1622,7 @@ if test "$check_utests" != "no" ; then #include <check.h> int main(void) { suite_create("qemu test"); return 0; } EOF - check_libs=`$pkgconfig --libs check` + check_libs=`$pkg_config --libs check` if compile_prog "" $check_libs ; then check_utests=yes libs_tools="$check_libs $libs_tools"
@@ -1641,8 +1641,8 @@ if test "$bluez" != "no" ; then #include <bluetooth/bluetooth.h> int main(void) { return bt_error(0); } EOF - bluez_cflags=`$pkgconfig --cflags bluez 2> /dev/null` - bluez_libs=`$pkgconfig --libs bluez 2> /dev/null` + bluez_cflags=`$pkg_config --cflags bluez 2> /dev/null` + bluez_libs=`$pkg_config --libs bluez 2> /dev/null` if compile_prog "$bluez_cflags" "$bluez_libs" ; then bluez=yes libs_softmmu="$bluez_libs $libs_softmmu"
@@ -1686,7 +1686,7 @@ EOF kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" fi else - kvm_cflags=`$pkgconfig --cflags kvm-kmod 2>/dev/null` + kvm_cflags=`$pkg_config --cflags kvm-kmod 2>/dev/null` fi if compile_prog "$kvm_cflags" "" ; then kvm=yes
Signature · 1 line
1.7.3.2
PATCH v3 9/15 do not default to non-prefixed pkg-config when cross compiling
In reply to Paolo BonziniThis can still be requested with PKG_CONFIG=/path/to/pkg-config. Just do not use it as a default, and print a warning.
--- configure | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
@@ -1163,8 +1163,8 @@ fi # pkg-config probe if ! has $pkg_config; then - # likely not cross compiling, or hope for the best - pkg_config=pkg-config + echo warning: proceeding without "$pkg_config" >&2 + pkg_config=/bin/false fi ##########################################
Signature · 1 line
1.7.3.2
PATCH v3 10/15 reorganize sdl-config tests
In reply to Paolo BonziniThis also allows overriding it with SDL_CONFIG, and warning in suspicious cross-compilation scenarios.
--- configure | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
configure +13 -13
@@ -210,6 +210,7 @@ ld="${cross_prefix}${LD-ld}" strip="${cross_prefix}${STRIP-strip}" windres="${cross_prefix}${WINDRES-windres}" pkg_config="${cross_prefix}${PKG_CONFIG-pkg-config}" +sdl_config="${cross_prefix}${SDL_CONFIG-sdl-config}" # default flags for all hosts QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
@@ -1183,21 +1184,17 @@ fi ########################################## # SDL probe -# Look for sdl configuration program (pkg-config or sdl-config). -# Prefer variant with cross prefix if cross compiling, -# and favour pkg-config with sdl over sdl-config. -if test -n "$cross_prefix" -a $pkg_config != pkg-config && \ - $pkg_config sdl --modversion >/dev/null 2>&1; then - sdlconfig="$pkg_config sdl" - _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` -elif test -n "$cross_prefix" && has ${cross_prefix}sdl-config; then - sdlconfig="${cross_prefix}sdl-config" - _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` -elif $pkg_config sdl --modversion >/dev/null 2>&1; then +# Look for sdl configuration program (pkg-config or sdl-config). Try +# sdl-config even without cross prefix, and favour pkg-config over sdl-config. +if test "`basename $sdl_config`" != sdl-config && ! has ${sdl_config}; then + sdl_config=sdl-config +fi + +if $pkg_config sdl --modversion >/dev/null 2>&1; then sdlconfig="$pkg_config sdl" _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'` -elif has sdl-config; then - sdlconfig='sdl-config' +elif has ${sdl_config}; then + sdlconfig="$sdl_config" _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'` else if test "$sdl" = "yes" ; then
@@ -1205,6 +1202,9 @@ else fi sdl=no fi +if test -n "$cross_prefix" && test "`basename $sdlconfig`" = sdl-config; then + echo warning: using "\"$sdlconfig\"" to detect cross-compiled sdl >&2 +fi sdl_too_old=no if test "$sdl" != "no" ; then
Signature · 1 line
1.7.3.2
PATCH v3 11/15 move "ln -sf" emulation to a function
In reply to Paolo Bonzini"ln -sf" does not really do anything more than "ln -s" on Solaris.
--- configure | 26 +++++++++++--------------- 1 files changed, 11 insertions(+), 15 deletions(-)
configure +11 -15
@@ -32,6 +32,12 @@ compile_prog() { $cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags >> config.log 2>&1 } +# symbolically link $1 to $2. Portable version of "ln -sf". +symlink() { + rm -f $2 + ln -s $1 $2 +} + # check whether a command is available to this shell (may be either an # executable or a builtin) has() {
@@ -2773,8 +2779,7 @@ fi for d in libdis libdis-user; do mkdir -p $d - rm -f $d/Makefile - ln -s $source_path/Makefile.dis $d/Makefile + symlink $source_path/Makefile.dis $d/Makefile echo > $d/config.mak done if test "$static" = "no" -a "$user_pie" = "yes" ; then
@@ -2838,12 +2843,7 @@ mkdir -p $target_dir/ide if test "$target" = "arm-linux-user" -o "$target" = "armeb-linux-user" -o "$target" = "arm-bsd-user" -o "$target" = "armeb-bsd-user" ; then mkdir -p $target_dir/nwfpe fi - -# -# don't use ln -sf as not all "ln -sf" over write the file/link -# -rm -f $target_dir/Makefile -ln -s $source_path/Makefile.target $target_dir/Makefile +symlink $source_path/Makefile.target $target_dir/Makefile echo "# Automatically generated by configure - do not modify" > $config_target_mak
@@ -3212,10 +3212,8 @@ if test "$source_path_used" = "yes" ; then for dir in $DIRS ; do mkdir -p $dir done - # remove the link and recreate it, as not all "ln -sf" overwrite the link for f in $FILES ; do - rm -f $f - ln -s $source_path/$f $f + symlink $source_path/$f $f done fi
@@ -3237,15 +3235,13 @@ for hwlib in 32 64; do d=libhw$hwlib mkdir -p $d mkdir -p $d/ide - rm -f $d/Makefile - ln -s $source_path/Makefile.hw $d/Makefile + symlink $source_path/Makefile.hw $d/Makefile echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak done d=libuser mkdir -p $d -rm -f $d/Makefile -ln -s $source_path/Makefile.user $d/Makefile +symlink $source_path/Makefile.user $d/Makefile if test "$static" = "no" -a "$user_pie" = "yes" ; then echo "QEMU_CFLAGS+=-fpie" > $d/config.mak fi
Signature · 1 line
1.7.3.2
PATCH v3 12/15 remove source_path_used
In reply to Paolo BonziniNot necessary since we use mkdir -p and from this patch test -f.
Also, dirname returns "." if a path has no directory component, as is the case for "sh configure".
--- configure | 45 ++++++++++++++++----------------------------- 1 files changed, 16 insertions(+), 29 deletions(-)
configure +16 -29
@@ -480,14 +480,7 @@ fi # find source path source_path=`dirname "$0"` -source_path_used="no" -workdir=`pwd` -if [ -z "$source_path" ]; then - source_path=$workdir -else - source_path=`cd "$source_path"; pwd` -fi -[ -f "$workdir/vl.c" ] || source_path_used="yes" +source_path=`cd "$source_path"; pwd` werror=""
@@ -501,7 +494,6 @@ for opt do --interp-prefix=*) interp_prefix="$optarg" ;; --source-path=*) source_path="$optarg" - source_path_used="yes" ;; --cross-prefix=*) ;;
@@ -3196,26 +3188,21 @@ echo "QEMU_INCLUDES+=$includes" >> $config_target_mak done # for target in $targets -# build tree in object directory if source path is different from current one -if test "$source_path_used" = "yes" ; then - DIRS="tests tests/cris slirp audio block net pc-bios/optionrom" - DIRS="$DIRS roms/seabios roms/vgabios" - DIRS="$DIRS fsdev ui" - FILES="Makefile tests/Makefile" - FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" - FILES="$FILES tests/test-mmap.c" - FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" - FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" - for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do - FILES="$FILES pc-bios/`basename $bios_file`" - done - for dir in $DIRS ; do - mkdir -p $dir - done - for f in $FILES ; do - symlink $source_path/$f $f - done -fi +# build tree in object directory in case the source is not in the current directory +DIRS="tests tests/cris slirp audio block net pc-bios/optionrom" +DIRS="$DIRS roms/seabios roms/vgabios" +DIRS="$DIRS fsdev ui" +FILES="Makefile tests/Makefile" +FILES="$FILES tests/cris/Makefile tests/cris/.gdbinit" +FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" +FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" +for bios_file in $source_path/pc-bios/*.bin $source_path/pc-bios/*.dtb $source_path/pc-bios/openbios-*; do + FILES="$FILES pc-bios/`basename $bios_file`" +done +mkdir -p $DIRS +for f in $FILES ; do + test -f $f || symlink $source_path/$f $f +done # temporary config to build submodules for rom in seabios vgabios ; do
Signature · 1 line
1.7.3.2
PATCH v3 13/15 move --srcdir detection earlier
In reply to Paolo BonziniThis will help getting config.guess and config.sub from the srcdir.
--- configure | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-)
configure +7 -5
@@ -75,6 +75,7 @@ path_of() { } # default parameters +source_path=`dirname "$0"` cpu="" interp_prefix="/usr/gnemul/qemu-%M" static="no"
@@ -182,6 +183,8 @@ for opt do ;; --cc=*) CC="$optarg" ;; + --source-path=*) source_path="$optarg" + ;; --cpu=*) cpu="$optarg" ;; --extra-cflags=*) QEMU_CFLAGS="$optarg $QEMU_CFLAGS"
@@ -228,6 +231,9 @@ QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS" QEMU_INCLUDES="-I. -I\$(SRC_PATH)" LDFLAGS="-g $LDFLAGS" +# make source path absolute +source_path=`cd "$source_path"; pwd` + check_define() { cat > $TMPC <<EOF #if !defined($1)
@@ -478,10 +484,6 @@ if test "$mingw32" = "yes" ; then confsuffix="" fi -# find source path -source_path=`dirname "$0"` -source_path=`cd "$source_path"; pwd` - werror="" for opt do
@@ -493,7 +495,7 @@ for opt do ;; --interp-prefix=*) interp_prefix="$optarg" ;; - --source-path=*) source_path="$optarg" + --source-path=*) ;; --cross-prefix=*) ;;
Signature · 1 line
1.7.3.2
PATCH v3 14/15 remove HOST_CC mention from roms/{sea, vga}bios/config.mak
In reply to Paolo BonziniNot used in the submodules.
--- configure | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
configure +0 -1
@@ -3216,7 +3216,6 @@ for rom in seabios vgabios ; do echo "CPP=${cross_prefix}cpp" >> $config_mak echo "OBJCOPY=objcopy" >> $config_mak echo "IASL=iasl" >> $config_mak - echo "HOST_CC=$host_cc" >> $config_mak echo "LD=$ld" >> $config_mak done
Signature · 1 line
1.7.3.2
PATCH v3 15/15 make trace options use autoconfy names
In reply to Paolo BonziniThese are not in any release, so I am just renaming them.
--- configure | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
configure +4 -4
@@ -515,9 +515,9 @@ for opt do ;; --target-list=*) target_list="$optarg" ;; - --trace-backend=*) trace_backend="$optarg" + --enable-trace-backend=*) trace_backend="$optarg" ;; - --trace-file=*) trace_file="$optarg" + --with-trace-file=*) trace_file="$optarg" ;; --enable-gprof) gprof="yes" ;;
@@ -907,8 +907,8 @@ echo " --enable-docs enable documentation build" echo " --disable-docs disable documentation build" echo " --disable-vhost-net disable vhost-net acceleration support" echo " --enable-vhost-net enable vhost-net acceleration support" -echo " --trace-backend=B Trace backend nop simple ust dtrace" -echo " --trace-file=NAME Full PATH,NAME of file to store traces" +echo " --enable-trace-backend=B Trace backend nop simple ust dtrace" +echo " --with-trace-file=NAME Full PATH,NAME of file to store traces" echo " Default:trace-<pid>" echo " --disable-spice disable spice" echo " --enable-spice enable spice"
Signature · 1 line
1.7.3.2
Quoted 31 lines · Paolo Bonzini
This is part two of the configure series. It does various miscellaneous changes to the configure script that make it possible to later handle an autoconfy command-line.
The rest is left for after 0.14, unless the release takes much more than expected.
v1->v2
misc comments addressed
v2->v3
rebased, preserved Solaris compatibility for the three srcdir patches (11 to 13).Paolo Bonzini (15):
default compilation tools to environment variables
default make and install to environment variables
move feature variables to the top
fix sparse support (?)
test cc with the complete set of chosen flags
do not pass bogus $(SRC_PATH) include paths to cc during configure provide portableHOST_LONG_BITStest
fix spelling of $pkg_config, move default together with other cross tools do not default to non-prefixed pkg-config when cross compiling reorganize sdl-config tests
move "ln -sf" emulation to a function
removesource_path_used
move --srcdir detection earlier
removeHOST_CCmention from roms/{sea,vga}bios/config.mak make trace options use autoconfy names
Quoted 4 lines
configure | 438 +++++++++++++++++++++++++++----------------------------- rules.mak | 6 +- tests/Makefile | 3 +- 3 files changed, 216 insertions(+), 231 deletions(-)
Ping?
Paolo
Blue Swirl
AppliedThanks, applied all.
Quoted 44 lines · Paolo Bonzini
Quoted 33 lines · Paolo Bonzini
This is part two of the configure series. It does various miscellaneous changes to the configure script that make it possible to later handle an autoconfy command-line.
The rest is left for after 0.14, unless the release takes much more than expected.
v1->v2
misc comments addressed
v2->v3
rebased, preserved Solaris compatibility for the three srcdir patches (11 to 13).Paolo Bonzini (15):
default compilation tools to environment variables default make and install to environment variables
move feature variables to the top
fix sparse support (?)
test cc with the complete set of chosen flags
do not pass bogus $(SRC_PATH) include paths to cc during configure provide portableHOST_LONG_BITStest
fix spelling of $pkg_config, move default together with other cross tools
do not default to non-prefixed pkg-config when cross compiling reorganize sdl-config tests
move "ln -sf" emulation to a function
removesource_path_used
move --srcdir detection earlier
removeHOST_CCmention from roms/{sea,vga}bios/config.mak make trace options use autoconfy namesQuoted 5 lines
configure | 438
+++++++++++++++++++++++++++-----------------------------
rules.mak | 6 +-
tests/Makefile | 3 +-3 files changed, 216 insertions(+), 231 deletions(-)Ping?
Paolo