[Scummvm-devel] [Scummvm-cvs-logs] SF.net SVN: scummvm:[51676] scummvm/branches/gsoc2010-opengl/configure

Max Horn max at quendi.de
Tue Aug 3 14:37:23 CEST 2010


Am 03.08.2010 um 12:01 schrieb Joost Peters:

> Hi Alejandro,
> 
> The OpenGL detection currently fails on Mac OS X.
> 
> Besides that __MACOSX__ is not a built-in define (__APPLE__ would be, 
> but it's probably also set on e.g. iPhone, so not a good choice),

Don't use __APPLE__. In fact, no code should *ever* rely on any __FOOBAR__ vendor defined #define, this just leads to a myriad of problems. The power of configure scripts (in the autoconf spirit) comes from them being feature based, not OS based. E.g. it is a bad idea to detect endianess basd on the OS (some apps used to have logic of the form "if macosx then big endian" which, surprise surprise, failed once Apple started producing Intel based systems).

However, if you *really* need to do something specific to Mac OS X, you can check for the MACOSX #define, which we set ourselves in our configure script.


> the  correct include to use is <OpenGL/gl.h>.

Yup.

> 
> Actually, I'm not sure if detection is even necessary on OS X.  AFAIK 
> OpenGL is always present,

Yes, it is always present.

> though you would still want to be able to disable it with --disable-opengl.

Indeed, that's a must. Typically we do it this way: We have an "_opengl" variable in configure which is set to auto initially. If --en/disable-opengl is used, it is set to yes/no. The actual detection code comes later, and it peforms detection only if "_opengl" is still set to "auto"; the detection code will then do whatever it does, and finally set _opengl to yes or no.

After this block, _opengl is guaranteed to be yes or no, and at *that* point, we have code like this (pseudo code!)
  if opengl == yes {
     switch host {
     case macosx:
       LIBS += -framework OpenGL
     default:
       INCLUDES += -I/usr/local/opengl/include
       LIBS += -lgl
     }
  }
Well, you get the idea, I hope.

Bye,
Max



More information about the Scummvm-devel mailing list