* [Qemu-devel] [PATCH] Fix cygwin build and simplify feature detection in 'configure' script @ 2009-06-10 11:53 David Turner 2009-06-10 20:52 ` [Qemu-devel] " David Turner 0 siblings, 1 reply; 13+ messages in thread From: David Turner @ 2009-06-10 11:53 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 10625 bytes --] Feature detection didn't work properly under cygwin because the OS_CFLAGS=-mno-cygwin flags was not passed to the feature checks (which only used $ARCH_CFLAGS). The end result being that features were detected against the mostly-Posix Cygwin headers, while compilation happened against the Mingw headers which lack many headers like <sys/uio.h>, <fnmatch.h> and others. Also, an OS_LDFLAGS=-mno-cygwin was missing, resulting in a link-time error Finally, three helper functions are introduced to simplify feature detection within the configure script: check_compile, check_link and check_link_with_log. Feature detection code was modified to use them instead of directly calling $cc with a really long list of arguments. Signed-off-by: digit <digit@google.com> --- configure | 98 +++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 56 insertions(+), 42 deletions(-) diff --git a/configure b/configure index 89e7f53..e0191f0 100755 --- a/configure +++ b/configure @@ -73,7 +73,21 @@ cat > $TMPC <<EOF #endif int main(void) { return 0; } EOF - $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null + $cc $ARCH_CFLAGS -c -o $TMPO $TMPC ${OS_CFLAGS} > /dev/null 2> /dev/null +} + +check_compile() { + $cc $ARCH_CFLAGS $OS_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null +} + +check_link() { + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > /dev/null 2> /dev/null +} + +check_link_with_log() { + TMPLOG=$1 + shift + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > $TMPLOG 2>&1 } if check_define __i386__ ; then @@ -216,6 +230,7 @@ case $targetos in CYGWIN*) mingw32="yes" OS_CFLAGS="-mno-cygwin" +OS_LDFLAGS="-mno-cygwin" if [ "$cpu" = "i386" ] ; then kqemu="yes" fi @@ -763,7 +778,7 @@ int main(int argc, char ** argv){ } EOF -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then $TMPE && bigendian="yes" else echo big/little test failed @@ -809,7 +824,7 @@ void foo() } EOF -if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then +if check_compile; then : else nptl="no" @@ -822,7 +837,7 @@ cat > $TMPC << EOF #include <zlib.h> int main(void) { zlibVersion(); return 0; } EOF -if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then +if check_link -lz; then : else echo @@ -841,7 +856,7 @@ cat > $TMPC <<EOF #include <xs.h> int main(void) { xs_daemon_open; xc_interface_open; } EOF - if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then + if check_link -lxenstore -lxenctrl; then : else xen="no" @@ -855,6 +870,8 @@ sdl_too_old=no if test "$sdl" = "yes" ; then sdl_config="sdl-config" + sdl_cflags=`$sdl_config --cflags 2> /dev/null` + sdl_ldflags=`$sdl_config --libs 2> /dev/null` sdl=no sdl_static=no @@ -863,7 +880,7 @@ cat > $TMPC << EOF #undef main /* We don't want SDL to override our main() */ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } EOF - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then + if check_link_with_log $TMPSDLLOG $sdl_cflags $sdl_ldflags; then _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` if test "$_sdlversion" -lt 121 ; then sdl_too_old=yes @@ -882,7 +899,7 @@ EOF sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`" fi - if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then + if check_link `$sdl_config --cflags 2> /dev/null` $sdl_static_libs; then sdl_static=yes fi fi # static link @@ -905,8 +922,8 @@ cat > $TMPC <<EOF #endif int main(void) { return 0; } EOF - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then - sdl_x11="yes" + if check_link $sdl_cflags $sdl_ldflags; then + sdl_x11="yes" fi fi @@ -919,11 +936,10 @@ int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; } EOF vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null` vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null` - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \ - $vnc_tls_libs > /dev/null 2> /dev/null ; then - : + if check_link $vnc_tls_cflags $vnc_tls_libs; then + : else - vnc_tls="no" + vnc_tls="no" fi fi @@ -938,11 +954,10 @@ EOF # Assuming Cyrus-SASL installed in /usr prefix vnc_sasl_cflags="" vnc_sasl_libs="-lsasl2" - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \ - $vnc_sasl_libs 2> /dev/null > /dev/null ; then - : + if check_link $vnc_sasl_cflags $vnc_sasl_libs; then + : else - vnc_sasl="no" + vnc_sasl="no" fi fi @@ -957,7 +972,7 @@ int main(void) return 0; } EOF -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then fnmatch="yes" fi @@ -973,7 +988,7 @@ int main(void) return 0; } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then + if check_link -lvdeplug; then : else vde="no" @@ -994,7 +1009,7 @@ audio_drv_probe() #include <$hdr> int main(void) { $exp } EOF - if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then + if check_link $cfl $lib; then : else echo @@ -1058,8 +1073,8 @@ cat > $TMPC << EOF #include <brlapi.h> int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } EOF - if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null 2> /dev/null ; then - brlapi=yes + if check_link -lbrlapi; then + brlapi=yes fi # brlapi compile test fi # -z $brlapi @@ -1075,7 +1090,7 @@ if test "$curses" = "yes" ; then #endif int main(void) { resize_term(0, 0); return curses_version(); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then + if check_link -lcurses; then curses=yes fi fi # test "$curses" @@ -1089,8 +1104,9 @@ if test "$curl" = "yes" ; then #include <curl/curl.h> int main(void) { return curl_easy_init(); } EOF + curl_cflags=`curl-cflags --cflags 2>/dev/null` curl_libs=`curl-config --libs 2>/dev/null` - if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then + if check_link $curl_cflags $curl_libs; then curl=yes fi fi # test "$curl" @@ -1107,8 +1123,7 @@ int main(void) { return bt_error(0); } EOF bluez_cflags=`pkg-config --cflags bluez 2> /dev/null` bluez_libs=`pkg-config --libs bluez 2> /dev/null` - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \ - $bluez_libs > /dev/null 2> /dev/null ; then + if check_link $bluez_cflags $bluez_libs; then : else bluez="no" @@ -1139,24 +1154,23 @@ EOF if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ -a -d "$kerneldir/arch/x86/include" ; then kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" - elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then - kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" + elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then + kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" elif test -d "$kerneldir/arch/$cpu/include" ; then kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" fi else kvm_cflags="" fi - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \ - > /dev/null 2>/dev/null ; then + if check_link $kvm_cflags; then : else kvm="no"; if [ -x "`which awk 2>/dev/null`" ] && \ [ -x "`which grep 2>/dev/null`" ]; then kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \ - | grep "error: " \ - | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` + | grep "error: " \ + | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` if test "$kvmerr" != "" ; then kvm="no - (${kvmerr})\n\ NOTE: To enable KVM support, update your kernel to 2.6.29+ or install \ @@ -1178,7 +1192,7 @@ cat > $TMPC << EOF int main(void) { pthread_create(0,0,0,0); return 0; } EOF for pthread_lib in $PTHREADLIBS_LIST; do - if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then + if check_link $pthread_lib; then pthread=yes PTHREADLIBS="$pthread_lib" break @@ -1200,7 +1214,7 @@ cat > $TMPC <<EOF int main(void) { struct iovec iov; return 0; } EOF iovec=no -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then iovec=yes fi @@ -1213,7 +1227,7 @@ cat > $TMPC <<EOF int main(void) { preadv; } EOF preadv=no -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then preadv=yes fi @@ -1224,7 +1238,7 @@ if test "$fdt" = "yes" ; then cat > $TMPC << EOF int main(void) { return 0; } EOF - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > /dev/null ; then + if check_link -lfdt; then fdt=yes fi fi @@ -1249,7 +1263,7 @@ main(void) return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then + if check_link; then atfile=yes fi fi @@ -1271,7 +1285,7 @@ main(void) return inotify_init(); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then + if check_link; then inotify=yes fi fi @@ -1291,9 +1305,9 @@ int main(void) { clockid_t id; return clock_gettime(id, NULL); } EOF rt=no -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then +if check_link; then : -elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then +elif check_link -lrt; then rt=yes fi @@ -1529,7 +1543,7 @@ else #include <byteswap.h> int main(void) { return bswap_32(0); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then + if check_link; then echo "#define HAVE_BYTESWAP_H 1" >> $config_h fi cat > $TMPC << EOF @@ -1538,7 +1552,7 @@ EOF #include <machine/bswap.h> int main(void) { return bswap32(0); } EOF - if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then + if check_link; then echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h fi fi -- 1.6.1.2 [-- Attachment #2: Type: text/html, Size: 16018 bytes --] ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 11:53 [Qemu-devel] [PATCH] Fix cygwin build and simplify feature detection in 'configure' script David Turner @ 2009-06-10 20:52 ` David Turner 2009-06-10 21:40 ` malc 2009-06-10 21:46 ` Consul 0 siblings, 2 replies; 13+ messages in thread From: David Turner @ 2009-06-10 20:52 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 12416 bytes --] As a related note, is anyone seriously using/developing the mainline QEMU sources on/for Windows? If so, what is the recommended environment to do so? I'm currently using cygwin to generate mingw-linked binaries (which dont require cygwin.dll at runtime), but I can think of other ways to generate these: - using MSYS + mingw - using mingw and the Windows command line - using Linux and the linux-mingw32 toolchain Finally, what is the best way to send patches to this list?. I notice that many patches are also sent directly to various developers, and that they tend to get reviewed/accepted/rejected a tad more rapidly. Is it ok to send patches as attachments ? or should they be sent with git-send-email instead? By the way, I'd be happy to regularly check the Windows mainline build if that can help. I'm also preparing a series of patches that fix several Windows-specific issues (most of them related to this horrible thing they called Winsock...). Thanks for your time. - David On Wed, Jun 10, 2009 at 1:53 PM, David Turner <digit@google.com> wrote: > Feature detection didn't work properly under cygwin because the > OS_CFLAGS=-mno-cygwin > flags was not passed to the feature checks (which only used $ARCH_CFLAGS). > The end > result being that features were detected against the mostly-Posix Cygwin > headers, > while compilation happened against the Mingw headers which lack many > headers like > <sys/uio.h>, <fnmatch.h> and others. > > Also, an OS_LDFLAGS=-mno-cygwin was missing, resulting in a link-time error > > Finally, three helper functions are introduced to simplify feature > detection within > the configure script: check_compile, check_link and check_link_with_log. > Feature > detection code was modified to use them instead of directly calling $cc > with a really > long list of arguments. > > Signed-off-by: digit <digit@google.com> > --- > configure | 98 > +++++++++++++++++++++++++++++++++++-------------------------- > 1 files changed, 56 insertions(+), 42 deletions(-) > > diff --git a/configure b/configure > index 89e7f53..e0191f0 100755 > --- a/configure > +++ b/configure > @@ -73,7 +73,21 @@ cat > $TMPC <<EOF > #endif > int main(void) { return 0; } > EOF > - $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null > + $cc $ARCH_CFLAGS -c -o $TMPO $TMPC ${OS_CFLAGS} > /dev/null 2> /dev/null > +} > + > +check_compile() { > + $cc $ARCH_CFLAGS $OS_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null > +} > + > +check_link() { > + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > /dev/null 2> /dev/null > +} > + > +check_link_with_log() { > + TMPLOG=$1 > + shift > + $cc $ARCH_CFLAGS $OS_CFLAGS -o $TMPE $TMPC $* > $TMPLOG 2>&1 > } > > if check_define __i386__ ; then > @@ -216,6 +230,7 @@ case $targetos in > CYGWIN*) > mingw32="yes" > OS_CFLAGS="-mno-cygwin" > +OS_LDFLAGS="-mno-cygwin" > if [ "$cpu" = "i386" ] ; then > kqemu="yes" > fi > @@ -763,7 +778,7 @@ int main(int argc, char ** argv){ > } > EOF > > -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then > +if check_link; then > $TMPE && bigendian="yes" > else > echo big/little test failed > @@ -809,7 +824,7 @@ void foo() > } > EOF > > -if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then > +if check_compile; then > : > else > nptl="no" > @@ -822,7 +837,7 @@ cat > $TMPC << EOF > #include <zlib.h> > int main(void) { zlibVersion(); return 0; } > EOF > -if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> > /dev/null ; then > +if check_link -lz; then > : > else > echo > @@ -841,7 +856,7 @@ cat > $TMPC <<EOF > #include <xs.h> > int main(void) { xs_daemon_open; xc_interface_open; } > EOF > - if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC -lxenstore -lxenctrl 2> /dev/null > > /dev/null ; then > + if check_link -lxenstore -lxenctrl; then > : > else > xen="no" > @@ -855,6 +870,8 @@ sdl_too_old=no > > if test "$sdl" = "yes" ; then > sdl_config="sdl-config" > + sdl_cflags=`$sdl_config --cflags 2> /dev/null` > + sdl_ldflags=`$sdl_config --libs 2> /dev/null` > sdl=no > sdl_static=no > > @@ -863,7 +880,7 @@ cat > $TMPC << EOF > #undef main /* We don't want SDL to override our main() */ > int main( void ) { return SDL_Init (SDL_INIT_VIDEO); } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> > /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then > + if check_link_with_log $TMPSDLLOG $sdl_cflags $sdl_ldflags; then > _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'` > if test "$_sdlversion" -lt 121 ; then > sdl_too_old=yes > @@ -882,7 +899,7 @@ EOF > sdl_static_libs="$sdl_static_libs `aalib-config > --static-libs`" > fi > > - if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> > /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then > + if check_link `$sdl_config --cflags 2> /dev/null` > $sdl_static_libs; then > sdl_static=yes > fi > fi # static link > @@ -905,8 +922,8 @@ cat > $TMPC <<EOF > #endif > int main(void) { return 0; } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> > /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then > - sdl_x11="yes" > + if check_link $sdl_cflags $sdl_ldflags; then > + sdl_x11="yes" > fi > fi > > @@ -919,11 +936,10 @@ int main(void) { gnutls_session_t s; gnutls_init(&s, > GNUTLS_SERVER); return 0; } > EOF > vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null` > vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null` > - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \ > - $vnc_tls_libs > /dev/null 2> /dev/null ; then > - : > + if check_link $vnc_tls_cflags $vnc_tls_libs; then > + : > else > - vnc_tls="no" > + vnc_tls="no" > fi > fi > > @@ -938,11 +954,10 @@ EOF > # Assuming Cyrus-SASL installed in /usr prefix > vnc_sasl_cflags="" > vnc_sasl_libs="-lsasl2" > - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \ > - $vnc_sasl_libs 2> /dev/null > /dev/null ; then > - : > + if check_link $vnc_sasl_cflags $vnc_sasl_libs; then > + : > else > - vnc_sasl="no" > + vnc_sasl="no" > fi > fi > > @@ -957,7 +972,7 @@ int main(void) > return 0; > } > EOF > -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then > +if check_link; then > fnmatch="yes" > fi > > @@ -973,7 +988,7 @@ int main(void) > return 0; > } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null > ; then > + if check_link -lvdeplug; then > : > else > vde="no" > @@ -994,7 +1009,7 @@ audio_drv_probe() > #include <$hdr> > int main(void) { $exp } > EOF > - if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null > ; then > + if check_link $cfl $lib; then > : > else > echo > @@ -1058,8 +1073,8 @@ cat > $TMPC << EOF > #include <brlapi.h> > int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); } > EOF > - if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC -lbrlapi > /dev/null > 2> /dev/null ; then > - brlapi=yes > + if check_link -lbrlapi; then > + brlapi=yes > fi # brlapi compile test > fi # -z $brlapi > > @@ -1075,7 +1090,7 @@ if test "$curses" = "yes" ; then > #endif > int main(void) { resize_term(0, 0); return curses_version(); } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; > then > + if check_link -lcurses; then > curses=yes > fi > fi # test "$curses" > @@ -1089,8 +1104,9 @@ if test "$curl" = "yes" ; then > #include <curl/curl.h> > int main(void) { return curl_easy_init(); } > EOF > + curl_cflags=`curl-cflags --cflags 2>/dev/null` > curl_libs=`curl-config --libs 2>/dev/null` > - if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; > then > + if check_link $curl_cflags $curl_libs; then > curl=yes > fi > fi # test "$curl" > @@ -1107,8 +1123,7 @@ int main(void) { return bt_error(0); } > EOF > bluez_cflags=`pkg-config --cflags bluez 2> /dev/null` > bluez_libs=`pkg-config --libs bluez 2> /dev/null` > - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \ > - $bluez_libs > /dev/null 2> /dev/null ; then > + if check_link $bluez_cflags $bluez_libs; then > : > else > bluez="no" > @@ -1139,24 +1154,23 @@ EOF > if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) \ > -a -d "$kerneldir/arch/x86/include" ; then > kvm_cflags="$kvm_cflags -I$kerneldir/arch/x86/include" > - elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; then > - kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" > + elif test "$cpu" = "ppc" -a -d "$kerneldir/arch/powerpc/include" ; > then > + kvm_cflags="$kvm_cflags -I$kerneldir/arch/powerpc/include" > elif test -d "$kerneldir/arch/$cpu/include" ; then > kvm_cflags="$kvm_cflags -I$kerneldir/arch/$cpu/include" > fi > else > kvm_cflags="" > fi > - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \ > - > /dev/null 2>/dev/null ; then > + if check_link $kvm_cflags; then > : > else > kvm="no"; > if [ -x "`which awk 2>/dev/null`" ] && \ > [ -x "`which grep 2>/dev/null`" ]; then > kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags > $TMPC 2>&1 \ > - | grep "error: " \ > - | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` > + | grep "error: " \ > + | awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'` > if test "$kvmerr" != "" ; then > kvm="no - (${kvmerr})\n\ > NOTE: To enable KVM support, update your kernel to 2.6.29+ or install > \ > @@ -1178,7 +1192,7 @@ cat > $TMPC << EOF > int main(void) { pthread_create(0,0,0,0); return 0; } > EOF > for pthread_lib in $PTHREADLIBS_LIST; do > - if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > > /dev/null ; then > + if check_link $pthread_lib; then > pthread=yes > PTHREADLIBS="$pthread_lib" > break > @@ -1200,7 +1214,7 @@ cat > $TMPC <<EOF > int main(void) { struct iovec iov; return 0; } > EOF > iovec=no > -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then > +if check_link; then > iovec=yes > fi > > @@ -1213,7 +1227,7 @@ cat > $TMPC <<EOF > int main(void) { preadv; } > EOF > preadv=no > -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then > +if check_link; then > preadv=yes > fi > > @@ -1224,7 +1238,7 @@ if test "$fdt" = "yes" ; then > cat > $TMPC << EOF > int main(void) { return 0; } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lfdt 2> /dev/null > > /dev/null ; then > + if check_link -lfdt; then > fdt=yes > fi > fi > @@ -1249,7 +1263,7 @@ main(void) > return (unlinkat(AT_FDCWD, "nonexistent_file", 0)); > } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then > + if check_link; then > atfile=yes > fi > fi > @@ -1271,7 +1285,7 @@ main(void) > return inotify_init(); > } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then > + if check_link; then > inotify=yes > fi > fi > @@ -1291,9 +1305,9 @@ int main(void) { clockid_t id; return > clock_gettime(id, NULL); } > EOF > > rt=no > -if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then > +if check_link; then > : > -elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then > +elif check_link -lrt; then > rt=yes > fi > > @@ -1529,7 +1543,7 @@ else > #include <byteswap.h> > int main(void) { return bswap_32(0); } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then > + if check_link; then > echo "#define HAVE_BYTESWAP_H 1" >> $config_h > fi > cat > $TMPC << EOF > @@ -1538,7 +1552,7 @@ EOF > #include <machine/bswap.h> > int main(void) { return bswap32(0); } > EOF > - if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then > + if check_link; then > echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h > fi > fi > -- > 1.6.1.2 > > > > [-- Attachment #2: Type: text/html, Size: 17571 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 20:52 ` [Qemu-devel] " David Turner @ 2009-06-10 21:40 ` malc 2009-06-10 22:09 ` David Turner 2009-06-10 21:46 ` Consul 1 sibling, 1 reply; 13+ messages in thread From: malc @ 2009-06-10 21:40 UTC (permalink / raw) To: David Turner; +Cc: qemu-devel On Wed, 10 Jun 2009, David Turner wrote: > As a related note, is anyone seriously using/developing the mainline QEMU > sources on/for Windows? > > If so, what is the recommended environment to do so? I'm currently using > cygwin to generate > mingw-linked binaries (which dont require cygwin.dll at runtime), but I can > think of other ways > to generate these: > > - using MSYS + mingw > - using mingw and the Windows command line > - using Linux and the linux-mingw32 toolchain Last time I needed to test QEMU on Windows I used cygwin and just configured things with: ./configure [options] --cc='gcc -mno-cygwin' and things just worked. [..snip..] -- mailto:av1474@comtv.ru ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 21:40 ` malc @ 2009-06-10 22:09 ` David Turner 2009-06-10 22:17 ` Filip Navara 2009-06-10 22:19 ` malc 0 siblings, 2 replies; 13+ messages in thread From: David Turner @ 2009-06-10 22:09 UTC (permalink / raw) To: malc; +Cc: qemu-devel [-- Attachment #1: Type: text/plain, Size: 633 bytes --] On Wed, Jun 10, 2009 at 11:40 PM, malc <av1474@comtv.ru> wrote: > On Wed, 10 Jun 2009, David Turner wrote: > > Last time I needed to test QEMU on Windows I used cygwin and just > configured things with: ./configure [options] --cc='gcc -mno-cygwin' > and things just worked. > thanks malc, I believe the patch above should get rid of the need for the --cc='gcc -mno-cygwin' entirely and just auto-configure things. Looking at configure through 'git blame' shows that the "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. So I presume that no one is really testing the mainline sources on Windows on a regular basis :-( [-- Attachment #2: Type: text/html, Size: 984 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 22:09 ` David Turner @ 2009-06-10 22:17 ` Filip Navara 2009-06-10 22:29 ` David Turner 2009-06-10 22:19 ` malc 1 sibling, 1 reply; 13+ messages in thread From: Filip Navara @ 2009-06-10 22:17 UTC (permalink / raw) To: David Turner; +Cc: qemu-devel On Thu, Jun 11, 2009 at 12:09 AM, David Turner<digit@google.com> wrote: [snip] > Looking at configure through 'git blame' shows that the > "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. > So I presume that no one is really testing the mainline sources on Windows > on a regular basis :-( Wrong presumption. :-) Using MSYS+MinGW here. F. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 22:17 ` Filip Navara @ 2009-06-10 22:29 ` David Turner 2009-06-10 23:32 ` David Turner 0 siblings, 1 reply; 13+ messages in thread From: David Turner @ 2009-06-10 22:29 UTC (permalink / raw) To: Filip Navara; +Cc: qemu-devel [-- Attachment #1: Type: text/plain, Size: 859 bytes --] On Thu, Jun 11, 2009 at 12:17 AM, Filip Navara <filip.navara@gmail.com>wrote: > On Thu, Jun 11, 2009 at 12:09 AM, David Turner<digit@google.com> wrote: > [snip] > > Looking at configure through 'git blame' shows that the > > "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. > > So I presume that no one is really testing the mainline sources on > Windows > > on a regular basis :-( > > Wrong presumption. :-) Using MSYS+MinGW here. Mea culpa :-) Thanks for all the answers. As an after-thought, it seems the patch could be greatly simplified by just forcing the compiler to "gcc -mno-cygwin" if a Cygwin environment is detected. I still think that the check_compile() / check_link() helpers are a good ideas, but they are not directly related to this issue, so they'd better be in a different patch. I'll send these soon. Thanks > > F. > [-- Attachment #2: Type: text/html, Size: 1485 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 22:29 ` David Turner @ 2009-06-10 23:32 ` David Turner 2009-06-11 0:53 ` David Turner 0 siblings, 1 reply; 13+ messages in thread From: David Turner @ 2009-06-10 23:32 UTC (permalink / raw) To: Filip Navara; +Cc: qemu-devel [-- Attachment #1.1: Type: text/plain, Size: 52 bytes --] And here comes a new patch to fix the Cygwin build: [-- Attachment #1.2: Type: text/html, Size: 98 bytes --] [-- Attachment #2: 0001-Fix-the-cygwin-build-by-forcing-the-compiler-to-use.patch --] [-- Type: application/octet-stream, Size: 963 bytes --] From 3e7486b8562fde1c291515eae22bf67b484a775f Mon Sep 17 00:00:00 2001 From: David Turner <digit@google.com> Date: Thu, 11 Jun 2009 01:26:45 +0200 Subject: [PATCH] Fix the cygwin build by forcing the compiler to use the -mno-cygwin flag. Without this change, all feature tests were run against the nearly-Posix Cygwin headers, generating a config-host.h file that didn't correspond to the features of the Mingw headers used at build time. This resulted in errors when trying to include things like <sys/uio.h> or <fnmatch.h> which are not available from Mingw. Signed-off-by: David Turner <digit@google.com> --- configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 89e7f53..62ebd2e 100755 --- a/configure +++ b/configure @@ -215,7 +215,7 @@ fi case $targetos in CYGWIN*) mingw32="yes" -OS_CFLAGS="-mno-cygwin" +cc="$cc -mno-cygwin" if [ "$cpu" = "i386" ] ; then kqemu="yes" fi -- 1.6.1.2 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 23:32 ` David Turner @ 2009-06-11 0:53 ` David Turner 0 siblings, 0 replies; 13+ messages in thread From: David Turner @ 2009-06-11 0:53 UTC (permalink / raw) To: Filip Navara; +Cc: qemu-devel [-- Attachment #1: Type: text/plain, Size: 1126 bytes --] And here's the patch inlined: >From 3e7486b8562fde1c291515eae22bf67b484a775f Mon Sep 17 00:00:00 2001 From: David Turner <digit@google.com> Date: Thu, 11 Jun 2009 01:26:45 +0200 Subject: [PATCH] Fix the cygwin build by forcing the compiler to use the -mno-cygwin flag. Without this change, all feature tests were run against the nearly-Posix Cygwin headers, generating a config-host.h file that didn't correspond to the features of the Mingw headers used at build time. This resulted in errors when trying to include things like <sys/uio.h> or <fnmatch.h> which are not available from Mingw. Signed-off-by: David Turner <digit@google.com> --- configure | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 89e7f53..62ebd2e 100755 --- a/configure +++ b/configure @@ -215,7 +215,7 @@ fi case $targetos in CYGWIN*) mingw32="yes" -OS_CFLAGS="-mno-cygwin" +cc="$cc -mno-cygwin" if [ "$cpu" = "i386" ] ; then kqemu="yes" fi -- 1.6.1.2 On Thu, Jun 11, 2009 at 1:32 AM, David Turner <digit@google.com> wrote: > And here comes a new patch to fix the Cygwin build: > [-- Attachment #2: Type: text/html, Size: 1707 bytes --] ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 22:09 ` David Turner 2009-06-10 22:17 ` Filip Navara @ 2009-06-10 22:19 ` malc 2009-06-12 2:26 ` Jamie Lokier 1 sibling, 1 reply; 13+ messages in thread From: malc @ 2009-06-10 22:19 UTC (permalink / raw) To: David Turner; +Cc: qemu-devel On Thu, 11 Jun 2009, David Turner wrote: > On Wed, Jun 10, 2009 at 11:40 PM, malc <av1474@comtv.ru> wrote: > > > On Wed, 10 Jun 2009, David Turner wrote: > > > > Last time I needed to test QEMU on Windows I used cygwin and just > > configured things with: ./configure [options] --cc='gcc -mno-cygwin' > > and things just worked. > > > > thanks malc, I believe the patch above should get rid of the need for the > --cc='gcc -mno-cygwin' entirely and just auto-configure things. > > Looking at configure through 'git blame' shows that the > "OS_CFLAGS=-mno-cygwin" line inside it is dated January 2007. > So I presume that no one is really testing the mainline sources on Windows > on a regular basis :-( I believe Anthony tests it on Linux via cross-mingw. -- mailto:av1474@comtv.ru ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 22:19 ` malc @ 2009-06-12 2:26 ` Jamie Lokier 2009-06-12 9:55 ` Daniel P. Berrange 0 siblings, 1 reply; 13+ messages in thread From: Jamie Lokier @ 2009-06-12 2:26 UTC (permalink / raw) To: malc; +Cc: David Turner, qemu-devel malc wrote: > I believe Anthony tests it on Linux via cross-mingw. For other projects, I find cross-mingw under Linux runs ./configure and compiles about 10 times faster than Cygwin (for ./configure) + Mingw (compiler) native on the same machine inside KVM. I'm not sure if that's KVM being slow at running Windows guest processes, or if what I've heard about Cygwin being slow to spawn processes is the reason. Either way, cross-mingw is great for Windows development :-) (But not 64-bit yet). -- Jamie ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-12 2:26 ` Jamie Lokier @ 2009-06-12 9:55 ` Daniel P. Berrange 2009-06-12 10:36 ` Mark Cave-Ayland 0 siblings, 1 reply; 13+ messages in thread From: Daniel P. Berrange @ 2009-06-12 9:55 UTC (permalink / raw) To: Jamie Lokier; +Cc: David Turner, qemu-devel On Fri, Jun 12, 2009 at 03:26:33AM +0100, Jamie Lokier wrote: > malc wrote: > > I believe Anthony tests it on Linux via cross-mingw. > > For other projects, I find cross-mingw under Linux runs ./configure > and compiles about 10 times faster than Cygwin (for ./configure) + > Mingw (compiler) native on the same machine inside KVM. > > I'm not sure if that's KVM being slow at running Windows guest > processes, or if what I've heard about Cygwin being slow to spawn > processes is the reason. > > Either way, cross-mingw is great for Windows development :-) > > (But not 64-bit yet). There is a mingw64 project that is under active development that aims to support both Win32 and Win64 APIs. It may well already be good enough to test QEMU builds for Win64, though I've not had personal experiance of it Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-12 9:55 ` Daniel P. Berrange @ 2009-06-12 10:36 ` Mark Cave-Ayland 0 siblings, 0 replies; 13+ messages in thread From: Mark Cave-Ayland @ 2009-06-12 10:36 UTC (permalink / raw) To: Daniel P. Berrange, Jamie Lokier, David Turner, qemu-devel Daniel P. Berrange wrote: > There is a mingw64 project that is under active development that aims > to support both Win32 and Win64 APIs. It may well already be good > enough to test QEMU builds for Win64, though I've not had personal > experiance of it FWIW the Mingw64 port is in reasonably good shape (the only reason it's still marked as beta is because the project feels they don't want to change this until all of the gcc languages are supported). They have a good history of working with open source projects to fix any bugs that arise, and generally are very helpful with bug reports (perhaps more so than the original MingW project). http://sourceforge.net/projects/mingw-w64 ATB, Mark. -- Mark Cave-Ayland - Senior Technical Architect PostgreSQL - PostGIS Sirius Corporation plc - control through freedom http://www.siriusit.co.uk t: +44 870 608 0063 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Qemu-devel] Re: [PATCH] Fix cygwin build and simplify feature detection in 'configure' script 2009-06-10 20:52 ` [Qemu-devel] " David Turner 2009-06-10 21:40 ` malc @ 2009-06-10 21:46 ` Consul 1 sibling, 0 replies; 13+ messages in thread From: Consul @ 2009-06-10 21:46 UTC (permalink / raw) To: qemu-devel David Turner wrote: > As a related note, is anyone seriously using/developing the mainline > QEMU sources on/for Windows? I don't consider myself "seriously developing" qemu but... > If so, what is the recommended environment to do so? I'm currently using MSYS + mingw + msysgit works fine for me There is a resent post around here about VS port of qemu also, if you're interested > Finally, what is the best way to send patches to this list?. I notice Inline and/or plain text attachments are generally accepted > that many patches are also sent directly to various developers, > and that they tend to get reviewed/accepted/rejected a tad more rapidly. That seems to be true. Some folks here prefer to be always cc'ed. That does not work for me. I can post to the gmane newsgroup only from this location due to stupid firewall rules. > By the way, I'd be happy to regularly check the Windows mainline build > if that can help. Well, an extra pair of eyes certainly would not hurt... > > I'm also preparing a series of patches that fix several Windows-specific > issues (most of them related > to this horrible thing they called Winsock...). You scared me :) > > Thanks for your time. > > - David ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2009-06-12 10:37 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-06-10 11:53 [Qemu-devel] [PATCH] Fix cygwin build and simplify feature detection in 'configure' script David Turner 2009-06-10 20:52 ` [Qemu-devel] " David Turner 2009-06-10 21:40 ` malc 2009-06-10 22:09 ` David Turner 2009-06-10 22:17 ` Filip Navara 2009-06-10 22:29 ` David Turner 2009-06-10 23:32 ` David Turner 2009-06-11 0:53 ` David Turner 2009-06-10 22:19 ` malc 2009-06-12 2:26 ` Jamie Lokier 2009-06-12 9:55 ` Daniel P. Berrange 2009-06-12 10:36 ` Mark Cave-Ayland 2009-06-10 21:46 ` Consul
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).