Hello, everyone!

I'd like to answer the following call.
Any further information on building "freeglut" on a Mac would be deeply
appreciated.  I believe that much of the information on building it on
*nix systems also applies to the Mac.

John F. Fay
1/22/11

I've successfully built  freeglut static library with all its demos on Mac OS X 10.6.8 for i386 arch

To make this happen one has to use the following configure arguments and patch some sources.

./configure --disable-warnings --disable-shared --enable-static CPPFLAGS="-I/usr/X11/include -L/usr/X11/lib" LDFLAGS="-I/usr/X11/include -L/usr/X11/lib" CC="gcc -m32"


The previous suggested arguments in README.mac are wrong for it forces the use of xcode GLUT framework that actually replaces the FREEGLUT framework for demos.
./configure --disable-warnings --disable-shared --enable-static CPPFLAGS=-I/usr/X11/include -L/usr/X11/lib LDFLAGS=-I/usr/X11/include -L/usr/X11/lib -framework GLUT 


1. The first problem i had was with smooth_opengl3.c wrong declarations that should be removed
#if !defined(__APPLE__)
typedef void (APIENTRY *PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
typedef void (APIENTRY *PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
typedef void (APIENTRY *PFNGLBUFFERDATAPROC) (GLenum target, ourGLsizeiptr size, const GLvoid *data, GLenum usage);
typedef GLuint (APIENTRY *PFNGLCREATESHADERPROC) (GLenum type);
typedef void (APIENTRY *PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const ourGLchar **string, const GLint *length);
typedef void (APIENTRY *PFNGLCOMPILESHADERPROC) (GLuint shader);
typedef GLuint (APIENTRY *PFNGLCREATEPROGRAMPROC) (void);
typedef void (APIENTRY *PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
typedef void (APIENTRY *PFNGLLINKPROGRAMPROC) (GLuint program);
typedef void (APIENTRY *PFNGLUSEPROGRAMPROC) (GLuint program);
typedef void (APIENTRY *PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
typedef void (APIENTRY *PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, ourGLchar *infoLog);
typedef void (APIENTRY *PFNGLGETPROGRAMIVPROC) (GLenum target, GLenum pname, GLint *params);
typedef void (APIENTRY *PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, ourGLchar *infoLog);
typedef GLint (APIENTRY *PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const ourGLchar *name);
typedef void (APIENTRY *PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
typedef void (APIENTRY *PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
typedef GLint (APIENTRY *PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const ourGLchar *name);
typedef void (APIENTRY *PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
#endif

2. The next problem i had was with unfamous cpp hack used in freeglut_glutfont_definitions.c

#define glutStrokeRoman glutStrokeRomanIGNOREME
#include <GL/freeglut_std.h>
#undef glutStrokeRoman
This way didn't work for me. So  I had to remove *IGNOREME define-undef pairs and subsequent redeclarations like
struct freeglutStrokeFont glutStrokeRoman ;

This is the way that works fine:
 

//declare some static structures
static struct freeglutStrokeFont _glutStrokeRoman ;
static struct freeglutStrokeFont _glutStrokeMonoRoman ;
static struct freeglutBitmapFont _glutBitmap9By15 ;
static struct freeglutBitmapFont _glutBitmap8By13 ;
static struct freeglutBitmapFont _glutBitmapTimesRoman10 ;
static struct freeglutBitmapFont _glutBitmapTimesRoman24 ;
static struct freeglutBitmapFont _glutBitmapHelvetica10 ;
static struct freeglutBitmapFont _glutBitmapHelvetica12 ;
static struct freeglutBitmapFont _glutBitmapHelvetica18 ;

//assign extern pointers declared in GL/freeglut_std.h
extern void * glutStrokeRoman                  = (void *)&_glutStrokeRoman;
extern void * glutStrokeMonoRoman       = (void *)&_glutStrokeMonoRoman;
extern void * glutBitmap9By15                 = (void *)&_glutBitmap9By15;
extern void * glutBitmap8By13                 = (void *)&_glutBitmap8By13;
extern void * glutBitmapTimesRoman10 = (void *)&_glutBitmapTimesRoman10;
extern void * glutBitmapTimesRoman24 = (void *)&_glutBitmapTimesRoman24;
extern void * glutBitmapHelvetica10        = (void *)&_glutBitmapHelvetica10;
extern void * glutBitmapHelvetica12        = (void *)&_glutBitmapHelvetica12;
extern void * glutBitmapHelvetica18        = (void *)&_glutBitmapHelvetica18;

After the magic happen and i had demo apps built I tried to run them from PUTTY (from my Windows PC) that failed with $DISPLAY environment variable being undefined.
I switched to native Mac Terminal application where $DISPLAY was actually defined
echo $DISPLAY
/tmp/launch-0DdyxN/org.x:0

Every test app works ok without any Mac OS X frameworks liinked.

I hope this experience will be usefull

--
Regards,
Sergey Mikhailov
Software Engineer
Integrit Ltd.
www.integrit.com