Make GUI frontends optional on Mac OS X
cover Make GUI frontends optional on Mac OS X
After applying this small patch series, you'll be able to build QEMU on Mac OS X without both SDL and Cocoa frontends. First two patches deal with raw-posix, which is the only CONFIG_COCOA user not related to GUI. The third patch adds '--disable-cocoa' switch to configure.
Pavel Borzenkov (3):
raw-posix: Remove dead code
raw-posix: Do not use CONFIG_COCOA macro
configure: add '--disable-cocoa' switch
block/raw-posix.c | 26 ++++---------------------- configure | 9 +++++++-- 2 files changed, 11 insertions(+), 24 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/3 raw-posix: Remove dead code
It was commented out since the initial import from svn.
--- block/raw-posix.c | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)
block/raw-posix.c +0 -18
@@ -37,7 +37,6 @@#include <IOKit/storage/IOMediaBSDClient.h> #include <IOKit/storage/IOMedia.h> #include <IOKit/storage/IOCDMedia.h> -//#include <IOKit/storage/IOCDTypes.h> #include <CoreFoundation/CoreFoundation.h> #endif
@@ -279,23 +278,6 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)return raw_open_common (bs, filename, flags,0 ); } -/* XXX: use host sector size if necessary with: -#ifdef DIOCGSECTORSIZE -{ -unsigned int sectorsize = 512; -if (!ioctl(fd, DIOCGSECTORSIZE, §orsize) && -sectorsize > bufsize) -bufsize = sectorsize; -} -#endif -#ifdef CONFIG_COCOA -uint32_t blockSize = 512; -if ( !ioctl( fd, DKIOCGETBLOCKSIZE, &blockSize ) && blockSize > bufsize) { -bufsize = blockSize; -} -#endif -*/ -/* * Check if all memory in this vector is sector aligned. */
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH 1/3] raw-posix: Remove dead code
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 3 lines
It was commented out since the initial import from svn.
Signed-off-by Pavel Borzenkov <[email protected]>
This dead code has just been picked up by Paolo for his "Support mismatched host and guest logical block sizes" series (10/17).
Feel invited to test whether it works as expected on your Mac OS X.
Andreas
Quoted 40 lines
--- block/raw-posix.c | 18 ------------------ 1 files changed, 0 insertions(+), 18 deletions(-)block/raw-posix.c +0
-18@@ -37,7 +37,6 @@#include <IOKit/storage/IOMediaBSDClient.h> #include <IOKit/storage/IOMedia.h> #include <IOKit/storage/IOCDMedia.h> -//#include <IOKit/storage/IOCDTypes.h> #include <CoreFoundation/CoreFoundation.h> #endif @@ -279,23 +278,6 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)return raw_open_common (bs, filename, flags,0 ); } -/* XXX: use host sector size if necessary with: -#ifdef DIOCGSECTORSIZE -{ -unsigned int sectorsize = 512; -if (!ioctl(fd, DIOCGSECTORSIZE, §orsize) && -sectorsize > bufsize) -bufsize = sectorsize; -} -#endif -#ifdef CONFIG_COCOA -uint32_t blockSize = 512; -if ( !ioctl( fd, DKIOCGETBLOCKSIZE, &blockSize ) && blockSize > bufsize) { -bufsize = blockSize; -} -#endif -*/ -/* * Check if all memory in this vector is sector aligned. */
PATCH 2/3 raw-posix: Do not use CONFIG_COCOA macro
In reply to Pavel BorzenkovUse __APPLE__ and __MACH__ macros instead of CONFIG_COCOA to detect Mac OS X host. The patch is based on the Ben Leslie's patch:
http://patchwork.ozlabs.org/patch/97859/
--- block/raw-posix.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
block/raw-posix.c +4 -4
@@ -29,7 +29,7 @@#include "module.h" #include "block/raw-posix-aio.h" -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && (__MACH__)#include <paths.h> #include <sys/param.h> #include <IOKit/IOKitLib.h>
@@ -487,7 +487,7 @@ again: } if (size == 0)#endif -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__) size =LONG_LONG_MAX ;#else size =lseek (fd,0LL ,SEEK_END );
@@ -632,7 +632,7 @@ static BlockDriver bdrv_file = {/***********************************************/ /* host device */ -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__)static kern_return_t FindEjectableCDMedia (io_iterator_t *mediaIterator );static kern_return_t GetBSDPath (io_iterator_t mediaIterator,char *bsdPath,CFIndex maxPathSize );
@@ -710,7 +710,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) {BDRVRawState *s = bs->opaque; -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__)if (strstart (filename,"/dev/cdrom" ,NULL )) {kern_return_t kernResult;io_iterator_t mediaIterator;
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH 2/3] raw-posix: Do not use CONFIG_COCOA macro
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 5 lines
Use
__APPLE__and__MACH__macros instead ofCONFIG_COCOAto detect Mac OS X host. The patch is based on the Ben Leslie's patch:
http://patchwork.ozlabs.org/patch/97859/Signed-off-by Pavel Borzenkov <[email protected]>
Still in my queue for testing on a Mac though.
Andreas
Quoted 44 lines
--- block/raw-posix.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)block/raw-posix.c +4
-4@@ -29,7 +29,7 @@#include "module.h" #include "block/raw-posix-aio.h" -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && (__MACH__)#include <paths.h> #include <sys/param.h> #include <IOKit/IOKitLib.h> @@ -487,7 +487,7 @@ again: } if (size == 0)#endif -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__) size =LONG_LONG_MAX ;#else size =lseek (fd,0LL ,SEEK_END );@@ -632,7 +632,7 @@ static BlockDriver bdrv_file = {/***********************************************/ /* host device */ -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__)static kern_return_t FindEjectableCDMedia (io_iterator_t *mediaIterator );static kern_return_t GetBSDPath (io_iterator_t mediaIterator,char *bsdPath,CFIndex maxPathSize );@@ -710,7 +710,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) {BDRVRawState *s = bs->opaque; -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__)if (strstart (filename,"/dev/cdrom" ,NULL )) {kern_return_t kernResult;io_iterator_t mediaIterator;
Andreas Färber
AppliedRe: [Qemu-devel] [PATCH 2/3] raw-posix: Do not use CONFIG_COCOA macro
Am 30.11.2011 01:38, schrieb Andreas Färber:
Quoted 8 lines
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 5 lines
Use
__APPLE__and__MACH__macros instead ofCONFIG_COCOAto detect Mac OS X host. The patch is based on the Ben Leslie's patch:
http://patchwork.ozlabs.org/patch/97859/Signed-off-by Pavel Borzenkov <[email protected]>Reviewed-by Andreas Färber <[email protected]>
Thanks, applied to the cocoa branch with a minor edit (s/the//).
http://repo.or.cz/w/qemu/afaerber.git/shortlog/refs/heads/cocoa-for-upstream
Andreas
Quoted 44 lines
Quoted 44 lines
--- block/raw-posix.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)block/raw-posix.c +4
-4@@ -29,7 +29,7 @@#include "module.h" #include "block/raw-posix-aio.h" -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && (__MACH__)#include <paths.h> #include <sys/param.h> #include <IOKit/IOKitLib.h> @@ -487,7 +487,7 @@ again: } if (size == 0)#endif -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__) size =LONG_LONG_MAX ;#else size =lseek (fd,0LL ,SEEK_END );@@ -632,7 +632,7 @@ static BlockDriver bdrv_file = {/***********************************************/ /* host device */ -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__)static kern_return_t FindEjectableCDMedia (io_iterator_t *mediaIterator );static kern_return_t GetBSDPath (io_iterator_t mediaIterator,char *bsdPath,CFIndex maxPathSize );@@ -710,7 +710,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) {BDRVRawState *s = bs->opaque; -#ifdef CONFIG_COCOA +#if defined(__APPLE__) && defined(__MACH__)if (strstart (filename,"/dev/cdrom" ,NULL )) {kern_return_t kernResult;io_iterator_t mediaIterator;
PATCH 3/3 configure: add '--disable-cocoa' switch
In reply to Pavel BorzenkovWhen SDL support is disabled, there is no way to build QEMU without Cocoa support on MacOS X. This patch adds '--disable-cocoa' switch and allows to build QEMU without both SDL and Cocoa frontends.
--- configure | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
configure +6 -1
@@ -670,6 +670,8 @@ for opt do ;; --enable-profiler) profiler="yes" ;; + --disable-cocoa) cocoa="no" + ;; --enable-cocoa) cocoa="yes" ; sdl="no" ;
@@ -980,7 +982,10 @@ echo " --disable-sdl disable SDL" echo " --enable-sdl enable SDL" echo " --disable-vnc disable VNC" echo " --enable-vnc enable VNC" -echo " --enable-cocoa enable COCOA (Mac OS X only)" +if test "$darwin" = "yes" ; then + echo " --disable-cocoa disable COCOA" + echo " --enable-cocoa enable COCOA (default)" +fi echo " --audio-drv-list=LIST set audio drivers list:" echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
Signature · 1 line
1.7.5.4
Re: [Qemu-devel] [PATCH 3/3] configure: add '--disable-cocoa' switch
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 14 lines
When SDL support is disabled, there is no way to build QEMU without Cocoa support on MacOS X. This patch adds '--disable-cocoa' switch and allows to build QEMU without both SDL and Cocoa frontends.
Signed-off-by Pavel Borzenkov <[email protected]>--- configure | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)configure +0
-0
configure for opt do · line 677
Quoted 8 lines
configure +2
-0@@ -670,6 +670,8 @@ for opt do ;; --enable-profiler) profiler="yes" ;; + --disable-cocoa) cocoa="no" + ;; --enable-cocoa) cocoa="yes" ; sdl="no" ;
configure echo " --disable-sdl disable SDL" · line 991
Quoted 12 lines
configure +4
-1@@ -980,7 +982,10 @@ echo " --disable-sdl disable SDL" echo " --enable-sdl enable SDL" echo " --disable-vnc disable VNC" echo " --enable-vnc enable VNC" -echo " --enable-cocoa enable COCOA (Mac OS X only)" +if test "$darwin" = "yes" ; then + echo " --disable-cocoa disable COCOA" + echo " --enable-cocoa enable COCOA (default)" +fi echo " --audio-drv-list=LIST set audio drivers list:" echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
I see no prior art of any conditional help output in configure. Anthony? Andrzej?
Andreas
Re: [Qemu-devel] [PATCH 3/3] configure: add '--disable-cocoa' switch
Am 08.12.2011 01:41, schrieb Andreas Färber:
Quoted 26 lines
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 14 lines
When SDL support is disabled, there is no way to build QEMU without Cocoa support on MacOS X. This patch adds '--disable-cocoa' switch and allows to build QEMU without both SDL and Cocoa frontends.
Signed-off-by Pavel Borzenkov <[email protected]>--- configure | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)configure +0
-0configure for opt do · line 677
Quoted 8 lines
configure +2
-0@@ -670,6 +670,8 @@ for opt do ;; --enable-profiler) profiler="yes" ;; + --disable-cocoa) cocoa="no" + ;; --enable-cocoa) cocoa="yes" ; sdl="no" ;Tested-by Andreas Färber <[email protected]>
Quoted 15 lines
configure echo " --disable-sdl disable SDL" · line 991
Quoted 12 lines
configure +4
-1@@ -980,7 +982,10 @@ echo " --disable-sdl disable SDL" echo " --enable-sdl enable SDL" echo " --disable-vnc disable VNC" echo " --enable-vnc enable VNC" -echo " --enable-cocoa enable COCOA (Mac OS X only)" +if test "$darwin" = "yes" ; then + echo " --disable-cocoa disable COCOA" + echo " --enable-cocoa enable COCOA (default)" +fi echo " --audio-drv-list=LIST set audio drivers list:" echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"I see no prior art of any conditional help output in configure. Anthony? Andrzej?
Ping? Should we keep command line options a flat list with comments on applicability or start introducing tests like above?
Me, I'd prefer not doing this since the switch cases above don't check.
Andreas
Re: [Qemu-devel] [PATCH 3/3] configure: add '--disable-cocoa' switch
Quoted 43 lines · Andreas Färber
Am 08.12.2011 01:41, schrieb Andreas Färber:
Quoted 26 lines
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 15 lines
When SDL support is disabled, there is no way to build QEMU without Cocoa support on MacOS X. This patch adds '--disable-cocoa' switch and allows to build QEMU without both SDL and Cocoa frontends.
Signed-off-by Pavel Borzenkov <[email protected]>---
configure | 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)configure +0
-0@@ -670,6 +670,8 @@ for opt do ;;Quoted 7 lines
--enable-profiler) profiler="yes"
;;
+ --disable-cocoa) cocoa="no"
+ ;;
--enable-cocoa)
cocoa="yes" ;
sdl="no" ;Tested-by Andreas Färber <[email protected]>Quoted 15 lines
Quoted 9 lines
configure +0
-0@@ -980,7 +982,10 @@ echo " --disable-sdl disable SDL"echo " --enable-sdl enable SDL"
echo " --disable-vnc disable VNC"
echo " --enable-vnc enable VNC"configure +4
-1-echo " --enable-cocoa enable COCOA (Mac OS X only)" +if test "$darwin" = "yes" ; then + echo " --disable-cocoa disable COCOA" + echo " --enable-cocoa enable COCOA (default)" +fiQuoted 3 lines
echo " --audio-drv-list=LIST set audio drivers list:"
echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"I see no prior art of any conditional help output in configure. Anthony? Andrzej?
Quoted 4 lines
Ping? Should we keep command line options a flat list with comments on applicability or start introducing tests like above?
Me, I'd prefer not doing this since the switch cases above don't check.
Perhaps --diable-cocoa should be allowed on any platform. You're right we don't have such checks now, but then it's hard to see downsides of doing them, so I'm quite ambivalent.
I still don't see the purpose of the following test in configure though:
if test "$cocoa" = "no" ; then
sdl=yes
fi
With it in place and no --disable-cocoa there's no way to compile SDL.
--enable-cocoa is also broken as fas as I can tell.
Cheers
Re: [Qemu-devel] [PATCH 3/3] configure: add '--disable-cocoa' switch
Am 17.01.2012 00:46, schrieb Andrzej Zaborowski:
Quoted 49 lines · Andreas Färber
Quoted 43 lines
Am 08.12.2011 01:41, schrieb Andreas Färber:
Quoted 26 lines
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 14 lines
When SDL support is disabled, there is no way to build QEMU without Cocoa support on MacOS X. This patch adds '--disable-cocoa' switch and allows to build QEMU without both SDL and Cocoa frontends.
Signed-off-by Pavel Borzenkov <[email protected]>--- configure | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)configure +0
-0configure for opt do · line 677
Quoted 8 lines
configure +2
-0@@ -670,6 +670,8 @@ for opt do ;; --enable-profiler) profiler="yes" ;; + --disable-cocoa) cocoa="no" + ;; --enable-cocoa) cocoa="yes" ; sdl="no" ;Tested-by Andreas Färber <[email protected]>Quoted 15 lines
configure echo " --disable-sdl disable SDL" · line 991
Quoted 12 lines
configure +4
-1@@ -980,7 +982,10 @@ echo " --disable-sdl disable SDL" echo " --enable-sdl enable SDL" echo " --disable-vnc disable VNC" echo " --enable-vnc enable VNC" -echo " --enable-cocoa enable COCOA (Mac OS X only)" +if test "$darwin" = "yes" ; then + echo " --disable-cocoa disable COCOA" + echo " --enable-cocoa enable COCOA (default)" +fi echo " --audio-drv-list=LIST set audio drivers list:" echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"I see no prior art of any conditional help output in configure. Anthony? Andrzej?
Quoted 4 lines
Ping? Should we keep command line options a flat list with comments on applicability or start introducing tests like above?
Me, I'd prefer not doing this since the switch cases above don't check.
Quoted 8 lines
Perhaps --diable-cocoa should be allowed on any platform. You're right we don't have such checks now, but then it's hard to see downsides of doing them, so I'm quite ambivalent.
I still don't see the purpose of the following test in configure though:
if test "$cocoa" = "no" ; then
sdl=yes
fi
The reason is that SDL and Cocoa must not both be detected due to the way it is handled in vl.c. Given that Cocoa is enabled by default, SDL must not be detected in that case. If Cocoa is disabled, then detecting SDL is fine of course.
The alternative would be to check for SDL and, if present, disable Cocoa. Still collides with Pavel's patch though - we need to sort out how to merge them.
Quoted 3 lines
With it in place and no --disable-cocoa there's no way to compile SDL.
--enable-cocoa is also broken as fas as I can tell.
I've been using it for historic reasons without noticeable problems.
Andreas
Re: [Qemu-devel] [PATCH 3/3] configure: add '--disable-cocoa' switch
Quoted 68 lines · Andreas Färber
Am 17.01.2012 00:46, schrieb Andrzej Zaborowski:
Quoted 49 lines · Andreas Färber
Quoted 43 lines
Am 08.12.2011 01:41, schrieb Andreas Färber:
Quoted 26 lines
Am 10.11.2011 19:40, schrieb Pavel Borzenkov:
Quoted 15 lines
When SDL support is disabled, there is no way to build QEMU without Cocoa support on MacOS X. This patch adds '--disable-cocoa' switch and allows to build QEMU without both SDL and Cocoa frontends.
Signed-off-by Pavel Borzenkov <[email protected]>---
configure | 7 ++++++-1 files changed, 6 insertions(+), 1 deletions(-)configure +0
-0@@ -670,6 +670,8 @@ for opt do ;;Quoted 7 lines
--enable-profiler) profiler="yes"
;;
+ --disable-cocoa) cocoa="no"
+ ;;
--enable-cocoa)
cocoa="yes" ;
sdl="no" ;Tested-by Andreas Färber <[email protected]>Quoted 15 lines
Quoted 9 lines
configure +0
-0@@ -980,7 +982,10 @@ echo " --disable-sdl disable SDL"echo " --enable-sdl enable SDL"
echo " --disable-vnc disable VNC"
echo " --enable-vnc enable VNC"configure +4
-1-echo " --enable-cocoa enable COCOA (Mac OS X only)" +if test "$darwin" = "yes" ; then + echo " --disable-cocoa disable COCOA" + echo " --enable-cocoa enable COCOA (default)" +fiQuoted 3 lines
echo " --audio-drv-list=LIST set audio drivers list:"
echo " Available drivers: $audio_possible_drivers" echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"I see no prior art of any conditional help output in configure. Anthony? Andrzej?
Quoted 4 lines
Ping? Should we keep command line options a flat list with comments on applicability or start introducing tests like above?
Me, I'd prefer not doing this since the switch cases above don't check.
Quoted 8 lines
Perhaps --diable-cocoa should be allowed on any platform. You're right we don't have such checks now, but then it's hard to see downsides of doing them, so I'm quite ambivalent.
I still don't see the purpose of the following test in configure though:
if test "$cocoa" = "no" ; then
sdl=yes
fiThe reason is that SDL and Cocoa must not both be detected due to the way it is handled in
vl.c. Given that Cocoa is enabled by default, SDL must not be detected in that case. If Cocoa is disabled, then detecting SDL is fine of course.The alternative would be to check for SDL and, if present, disable Cocoa. Still collides with Pavel's patch though - we need to sort out how to merge them.
Quoted 5 lines
Quoted 3 lines
With it in place and no --disable-cocoa there's no way to compile SDL.
--enable-cocoa is also broken as fas as I can tell.
I've been using it for historic reasons without noticeable problems.
The problem I see is that the handler touches the sdl variable, which is also touched by --enable/disable-sdl. So the order of the options on the command line starts to matter. I think the options should be treated orthogonally, and then after parsing the command line the script should bail out if two incompatible options are enabled.
Cheers
Re: [Qemu-devel] [PATCH 3/3] configure: add '--disable-cocoa' switch
In reply to Andrzej ZaborowskiQuoted 9 lines · Andrzej Zaborowski
Quoted 4 lines · Andreas Färber
Ping? Should we keep command line options a flat list with comments on applicability or start introducing tests like above?
Me, I'd prefer not doing this since the switch cases above don't check.
Perhaps --diable-cocoa should be allowed on any platform. You're right we don't have such checks now, but then it's hard to see downsides of doing them, so I'm quite ambivalent.
I'm vaguely negative about it because heading down that path increases the number of tests and checks we end up performing before we do the relatively straightforward thing of printing out a help message. (We already do a pile of compiler/cpu tests early, which among other things means 'configure --help' trashes config.log.)
"allow everything as an option and complain if it's not valid on this machine" is at least easy to keep consistent.
-- PMM