qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Add option to disable Cocoa on Mac OS X
@ 2011-05-06  9:48 Ben Leslie
  2011-05-06 10:46 ` Tristan Gingold
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Leslie @ 2011-05-06  9:48 UTC (permalink / raw)
  To: qemu-devel

Hi all,

Are there any objections to adding a --disable-cocoa configure option?
For simulating ARM microcontrollers I have no desire or need for graphics.

Thanks,

Benno

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-06  9:48 [Qemu-devel] Add option to disable Cocoa on Mac OS X Ben Leslie
@ 2011-05-06 10:46 ` Tristan Gingold
  2011-05-06 12:01   ` Alexander Graf
  0 siblings, 1 reply; 9+ messages in thread
From: Tristan Gingold @ 2011-05-06 10:46 UTC (permalink / raw)
  To: Ben Leslie; +Cc: qemu-devel


On May 6, 2011, at 11:48 AM, Ben Leslie wrote:

> Hi all,
> 
> Are there any objections to adding a --disable-cocoa configure option?
> For simulating ARM microcontrollers I have no desire or need for graphics.

Seconded.  I think I have once posted such a patch.

Tristan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-06 10:46 ` Tristan Gingold
@ 2011-05-06 12:01   ` Alexander Graf
  2011-05-07 10:12     ` Andreas Färber
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Graf @ 2011-05-06 12:01 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Andreas Faerber, QEMU-devel Developers, Ben Leslie


On 06.05.2011, at 12:46, Tristan Gingold wrote:

> 
> On May 6, 2011, at 11:48 AM, Ben Leslie wrote:
> 
>> Hi all,
>> 
>> Are there any objections to adding a --disable-cocoa configure option?
>> For simulating ARM microcontrollers I have no desire or need for graphics.
> 
> Seconded.  I think I have once posted such a patch.

Andreas?


Alex

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-06 12:01   ` Alexander Graf
@ 2011-05-07 10:12     ` Andreas Färber
  2011-05-07 10:40       ` Alexander Graf
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2011-05-07 10:12 UTC (permalink / raw)
  To: Alexander Graf, Ben Leslie; +Cc: Tristan Gingold, qemu-devel Developers

Hi,

Am 06.05.2011 um 14:01 schrieb Alexander Graf:

> On 06.05.2011, at 12:46, Tristan Gingold wrote:
>
>> On May 6, 2011, at 11:48 AM, Ben Leslie wrote:
>>
>>> Are there any objections to adding a --disable-cocoa configure  
>>> option?
>>> For simulating ARM microcontrollers I have no desire or need for  
>>> graphics.
>>
>> Seconded.  I think I have once posted such a patch.

Not aware, sorry.

> Andreas?

My build scripts used to need an explicit --enable-cocoa.
Did the default somehow change so that --disable-cocoa is necessary  
now to disable it? Or is it just for symmetry?

Andreas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-07 10:12     ` Andreas Färber
@ 2011-05-07 10:40       ` Alexander Graf
  2011-05-11 13:54         ` Peter Maydell
  0 siblings, 1 reply; 9+ messages in thread
From: Alexander Graf @ 2011-05-07 10:40 UTC (permalink / raw)
  To: Andreas Färber; +Cc: Tristan Gingold, qemu-devel Developers, Ben Leslie


On 07.05.2011, at 12:12, Andreas Färber wrote:

> Hi,
> 
> Am 06.05.2011 um 14:01 schrieb Alexander Graf:
> 
>> On 06.05.2011, at 12:46, Tristan Gingold wrote:
>> 
>>> On May 6, 2011, at 11:48 AM, Ben Leslie wrote:
>>> 
>>>> Are there any objections to adding a --disable-cocoa configure option?
>>>> For simulating ARM microcontrollers I have no desire or need for graphics.
>>> 
>>> Seconded.  I think I have once posted such a patch.
> 
> Not aware, sorry.
> 
>> Andreas?
> 
> My build scripts used to need an explicit --enable-cocoa.
> Did the default somehow change so that --disable-cocoa is necessary now to disable it? Or is it just for symmetry?

It definitely gets enabled by default:

> dekai:qemu alex$ ./configure --target-list=x86_64-softmmu
> Install prefix    /usr/local
> BIOS directory    /usr/local/share/qemu
> binary directory  /usr/local/bin
> config directory  /usr/local/etc
> Manual directory  /usr/local/share/man
> ELF interp prefix /usr/gnemul/qemu-%M
> Source path       /Users/alex/git/qemu
> C compiler        gcc
> Host C compiler   gcc
> CFLAGS            -O2 -g 
> QEMU_CFLAGS       -m64 -arch x86_64 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing  -fstack-protector-all -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wold-style-definition
> LDFLAGS           -m64 -framework CoreFoundation -framework IOKit -arch x86_64 -g 
> make              make
> install           install
> host CPU          x86_64
> host big endian   no
> target list       x86_64-softmmu
> tcg debug enabled no
> Mon debug enabled no
> gprof enabled     no
> sparse enabled    no
> strip binaries    yes
> profiler          no
> static build      no
> -Werror enabled   no
> Cocoa support     yes

So I suppose the only thing missing is a --disable-cocoa option, yup.


Alex

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-07 10:40       ` Alexander Graf
@ 2011-05-11 13:54         ` Peter Maydell
  2011-05-16 10:57           ` Ben Leslie
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Maydell @ 2011-05-11 13:54 UTC (permalink / raw)
  To: Alexander Graf
  Cc: Andreas Färber, Tristan Gingold, qemu-devel Developers,
	Ben Leslie

On 7 May 2011 12:40, Alexander Graf <agraf@suse.de> wrote:
> So I suppose the only thing missing is a --disable-cocoa option, yup.

I've just noticed that some of the code in block/raw-posix.c
uses the CONFIG_COCOA #define to gate whether to do MacOSX
specific handling of CDROMs and so on. I'm not a MacOS expert
but maybe that needs to be changed to some other ifdef -- I'm
guessing we don't want to have cdrom handling randomly change
behaviour just because the user tried to disable Cocoa graphics
handling...

-- PMM

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-11 13:54         ` Peter Maydell
@ 2011-05-16 10:57           ` Ben Leslie
  2011-05-29 16:17             ` Andreas Färber
  0 siblings, 1 reply; 9+ messages in thread
From: Ben Leslie @ 2011-05-16 10:57 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Andreas Färber, Tristan Gingold, Alexander Graf,
	qemu-devel Developers

On Wed, May 11, 2011 at 23:54, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 7 May 2011 12:40, Alexander Graf <agraf@suse.de> wrote:
>> So I suppose the only thing missing is a --disable-cocoa option, yup.
>
> I've just noticed that some of the code in block/raw-posix.c
> uses the CONFIG_COCOA #define to gate whether to do MacOSX
> specific handling of CDROMs and so on. I'm not a MacOS expert
> but maybe that needs to be changed to some other ifdef -- I'm
> guessing we don't want to have cdrom handling randomly change
> behaviour just because the user tried to disable Cocoa graphics
> handling...

These seems to be a good point. Potentially checking for __APPLE__ and
__MACH__ makes more sense? (See: http://predef.sourceforge.net/preos.html#sec20)

Cheers,

Ben

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-16 10:57           ` Ben Leslie
@ 2011-05-29 16:17             ` Andreas Färber
  2011-05-29 22:25               ` Ben Leslie
  0 siblings, 1 reply; 9+ messages in thread
From: Andreas Färber @ 2011-05-29 16:17 UTC (permalink / raw)
  To: Ben Leslie, Tristan Gingold
  Cc: Peter Maydell, Alexander Graf, qemu-devel Developers

Am 16.05.2011 um 12:57 schrieb Ben Leslie:

> On Wed, May 11, 2011 at 23:54, Peter Maydell  
> <peter.maydell@linaro.org> wrote:
>> On 7 May 2011 12:40, Alexander Graf <agraf@suse.de> wrote:
>>> So I suppose the only thing missing is a --disable-cocoa option,  
>>> yup.
>>
>> I've just noticed that some of the code in block/raw-posix.c
>> uses the CONFIG_COCOA #define to gate whether to do MacOSX
>> specific handling of CDROMs and so on. I'm not a MacOS expert
>> but maybe that needs to be changed to some other ifdef -- I'm
>> guessing we don't want to have cdrom handling randomly change
>> behaviour just because the user tried to disable Cocoa graphics
>> handling...
>
> These seems to be a good point. Potentially checking for __APPLE__ and
> __MACH__ makes more sense? (See: http://predef.sourceforge.net/preos.html#sec20)

Any update on this?

IIUC without digging further, today, Cocoa not only means displaying  
the graphical window but also has impact on which libraries are linked  
to, such as IOKit and CoreAudio. So simply replacing CONFIG_COCOA with  
__APPLE__ would seem not to be enough.

Tristan, if your patch takes care of everything, mind to resend or to  
provide a Patchwork link please?

Andreas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] Add option to disable Cocoa on Mac OS X
  2011-05-29 16:17             ` Andreas Färber
@ 2011-05-29 22:25               ` Ben Leslie
  0 siblings, 0 replies; 9+ messages in thread
From: Ben Leslie @ 2011-05-29 22:25 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Peter Maydell, Tristan Gingold, Alexander Graf,
	qemu-devel Developers

On Mon, May 30, 2011 at 02:17, Andreas Färber <andreas.faerber@web.de> wrote:
> Am 16.05.2011 um 12:57 schrieb Ben Leslie:
>
>> On Wed, May 11, 2011 at 23:54, Peter Maydell <peter.maydell@linaro.org>
>> wrote:
>>>
>>> On 7 May 2011 12:40, Alexander Graf <agraf@suse.de> wrote:
>>>>
>>>> So I suppose the only thing missing is a --disable-cocoa option, yup.
>>>
>>> I've just noticed that some of the code in block/raw-posix.c
>>> uses the CONFIG_COCOA #define to gate whether to do MacOSX
>>> specific handling of CDROMs and so on. I'm not a MacOS expert
>>> but maybe that needs to be changed to some other ifdef -- I'm
>>> guessing we don't want to have cdrom handling randomly change
>>> behaviour just because the user tried to disable Cocoa graphics
>>> handling...
>>
>> These seems to be a good point. Potentially checking for __APPLE__ and
>> __MACH__ makes more sense? (See:
>> http://predef.sourceforge.net/preos.html#sec20)
>
> Any update on this?
>
> IIUC without digging further, today, Cocoa not only means displaying the
> graphical window but also has impact on which libraries are linked to, such
> as IOKit and CoreAudio. So simply replacing CONFIG_COCOA with __APPLE__
> would seem not to be enough.
>
> Tristan, if your patch takes care of everything, mind to resend or to
> provide a Patchwork link please?

Replacing with CONFIG_COCOA with __APPLE__ seemed to be enough for me, but
I might have missed something. Here is the patch if someone else could
try it out:

Signed-off-by: Ben Leslie <benno@benno.id.au>
---
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 6b72470..1f61a7f 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -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>
@@ -235,7 +235,7 @@ static int raw_open(BlockDriverState *bs, const
char *filename, int flags)
                 bufsize = sectorsize;
         }
 #endif
-#ifdef CONFIG_COCOA
+#if defined(__APPLE__) && defined(__MACH__)
         uint32_t blockSize = 512;
         if ( !ioctl( fd, DKIOCGETBLOCKSIZE, &blockSize ) && blockSize
> bufsize) {
             bufsize = blockSize;
@@ -680,7 +680,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);
@@ -820,7 +820,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 );

@@ -898,7 +898,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;
diff --git a/configure b/configure
index d7dba5d..6a5864f 100755
--- a/configure
+++ b/configure
@@ -635,6 +635,8 @@ for opt do
   ;;
   --enable-profiler) profiler="yes"
   ;;
+  --disable-cocoa) cocoa="no"
+  ;;
   --enable-cocoa)
       cocoa="yes" ;
       sdl="no" ;
@@ -932,6 +934,7 @@ echo "  --disable-sdl            disable SDL"
 echo "  --enable-sdl             enable SDL"
 echo "  --disable-vnc            disable VNC"
 echo "  --enable-vnc             enable VNC"
+echo "  --disable-cocoa          disable COCOA"
 echo "  --enable-cocoa           enable COCOA (Mac OS X only)"
 echo "  --audio-drv-list=LIST    set audio drivers list:"
 echo "                           Available drivers: $audio_possible_drivers"

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-05-29 22:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-06  9:48 [Qemu-devel] Add option to disable Cocoa on Mac OS X Ben Leslie
2011-05-06 10:46 ` Tristan Gingold
2011-05-06 12:01   ` Alexander Graf
2011-05-07 10:12     ` Andreas Färber
2011-05-07 10:40       ` Alexander Graf
2011-05-11 13:54         ` Peter Maydell
2011-05-16 10:57           ` Ben Leslie
2011-05-29 16:17             ` Andreas Färber
2011-05-29 22:25               ` Ben Leslie

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).