configure: allow C{,XX}FLAGS override
[mesa.git] / include / GL / glut.h
index 49225361bb787e44c36dc8d8ee69d6f07388d1d0..a2826352051f18955ee7b005d79aeef44a4455f5 100644 (file)
@@ -7,35 +7,25 @@
    provided without guarantee or warrantee expressed or  implied. This
    program is -not- in the public domain. */
 
+#if defined(_WIN32)
+#  ifndef WIN32_LEAN_AND_MEAN
+#    define WIN32_LEAN_AND_MEAN 1
+#  endif
+#  include <windows.h>
+#endif
+
 #include <GL/gl.h>
 #include <GL/glu.h>
 
-#if defined(__MINGW32__)
-#include <GL/mesa_wgl.h>
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 #if defined(_WIN32)
 
-/* GLUT 3.7 now tries to avoid including <windows.h>
-   to avoid name space pollution, but Win32's <GL/gl.h>
-   needs APIENTRY and WINGDIAPI defined properly.
-
-   tjump@spgs.com contributes:
-   If users are building glut code on MS Windows, then they should
-   make sure they include windows.h early, let's not get into a
-   header definitions war since MS has proven it's capability to
-   change header dependencies w/o publishing they have done so.
-
-   So, let's not include windows.h here, as it's not really required and
-   MS own gl/gl.h *should* include it if the dependency is there. */
-
 /* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
    in your compile preprocessor options. */
-# if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
+# if defined(_MSC_VER) && !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
 #  pragma comment (lib, "winmm.lib")      /* link with Windows MultiMedia lib */
 /* To enable automatic SGI OpenGL for Windows library usage for GLUT,
    define GLUT_USE_SGI_OPENGL in your compile preprocessor options.  */
@@ -84,23 +74,9 @@ extern "C" {
 #  define __cdecl
 #  define GLUT_DEFINED___CDECL
 # endif
-# ifndef _CRTIMP
-#  ifdef _NTSDK
-    /* Definition compatible with NT SDK */
-#   define _CRTIMP
-#  else
-    /* Current definition */
-#   ifdef _DLL
-#    define _CRTIMP __declspec(dllimport)
-#   else
-#    define _CRTIMP
-#   endif
-#  endif
-#  define GLUT_DEFINED__CRTIMP
-# endif
-# ifndef GLUT_BUILDING_LIB
-extern _CRTIMP void __cdecl exit(int);
-# endif
+#if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
+#include <stdlib.h>
+#endif
 
 /* GLUT callback calling convention for Win32. */
 # define GLUTCALLBACK __cdecl
@@ -119,88 +95,25 @@ extern _CRTIMP void __cdecl exit(int);
 #endif
 
 /* GLUT API entry point declarations for Win32. */
-#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && defined(_DLL)
+#if (defined(BUILD_GLUT32) || defined(GLUT_BUILDING_LIB)) && !defined(GLUT_STATIC)
 #      define GLUTAPI __declspec(dllexport)
-#elif defined(_DLL)
+#elif !defined(GLUT_STATIC)
 #   define GLUTAPI __declspec(dllimport)
 #else
 #      define GLUTAPI extern
 #endif
 
-#if defined(_WIN32) && !defined(_WINDEF_) && !defined(MESA)
-#      if !defined(MESA_MINWARN)
-#              pragma message( "note: WINDOWS.H not included, providing Mesa definition of CALLBACK macro" )
-#              pragma message( "----: and PROC typedef. If you receive compiler warnings about either ")
-#              pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" )
-#      endif
-#      define CALLBACK __stdcall
-
-#if !defined(__MINGW32__)
-       typedef int (GLUTAPIENTRY *PROC)();
-       typedef void *HGLRC;
-       typedef void *HDC;
-#endif
-typedef unsigned long COLORREF;
-#endif
-
-#if defined(_WIN32) && !defined(_WINGDI_) && !defined(MESA)
-#      if !defined(MESA_MINWARN)
-#              pragma message( "note: WINDOWS.H not included, providing Mesa definition of wgl functions" )
-#              pragma message( "----: and macros. If you receive compiler warnings about any being multiply ")
-#              pragma message( "----: defined you should include WINDOWS.H priot to gl/glut.h" )
-#      endif
-#      define WGL_FONT_LINES      0
-#      define WGL_FONT_POLYGONS   1
-#      ifdef UNICODE
-#              define wglUseFontBitmaps  wglUseFontBitmapsW
-#              define wglUseFontOutlines  wglUseFontOutlinesW
-#      else
-#              define wglUseFontBitmaps  wglUseFontBitmapsA
-#              define wglUseFontOutlines  wglUseFontOutlinesA
-#      endif /* !UNICODE */
-typedef struct tagLAYERPLANEDESCRIPTOR LAYERPLANEDESCRIPTOR, *PLAYERPLANEDESCRIPTOR, *LPLAYERPLANEDESCRIPTOR;
-typedef struct _GLYPHMETRICSFLOAT GLYPHMETRICSFLOAT, *PGLYPHMETRICSFLOAT, *LPGLYPHMETRICSFLOAT;
-#  pragma warning( push )
-#  pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
-#  define WGLAPI __declspec(dllimport)
-WGLAPI int   GLAPIENTRY wglDeleteContext(HGLRC);
-WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
-WGLAPI int   GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
-WGLAPI int   GLAPIENTRY wglSwapBuffers(HDC hdc);
-WGLAPI HDC   GLAPIENTRY wglGetCurrentDC(void);
-WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
-WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
-WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
-WGLAPI PROC  GLAPIENTRY wglGetProcAddress(const char*);
-WGLAPI int   GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
-WGLAPI int   GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
-WGLAPI int   GLAPIENTRY wglDeleteContext(HGLRC);
-WGLAPI int   GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
-WGLAPI int   GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
-WGLAPI int   GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
-WGLAPI int   GLAPIENTRY wglGetPixelFormat(HDC hdc);
-WGLAPI int   GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
-WGLAPI int   GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
-WGLAPI int   GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
-WGLAPI int   GLAPIENTRY wglShareLists(HGLRC, HGLRC);
-WGLAPI int   GLAPIENTRY wglSwapLayerBuffers(HDC, unsigned int);
-WGLAPI int   GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, unsigned long);
-WGLAPI int   GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
-WGLAPI int   GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
-WGLAPI int   GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
-WGLAPI int   GLAPIENTRY SwapBuffers(HDC);
-WGLAPI int   GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
-WGLAPI int   GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
-WGLAPI int   GLAPIENTRY GetPixelFormat(HDC);
-WGLAPI int   GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
-#  undef WGLAPI
-#  pragma warning( pop )
-#endif
-
-#else /* _WIN32 not defined */
-
-/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing if we aren't on Win32. */
-#  define GLUTAPIENTRY GLAPIENTRY
+#elif defined(__GNUC__)
+
+#  define GLUTAPIENTRY
+#  define GLUTAPIENTRYV
+#  define GLUTCALLBACK
+#  define GLUTAPI extern __attribute__((visibility("default")))
+
+#else
+
+/* Define GLUTAPIENTRY and GLUTCALLBACK to nothing */
+#  define GLUTAPIENTRY
 #  define GLUTAPIENTRYV
 #  define GLUTCALLBACK
 #  define GLUTAPI extern
@@ -539,8 +452,7 @@ GLUTAPI void GLUTAPIENTRY glutInit(int *argcp, char **argv);
 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
 GLUTAPI void GLUTAPIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
 #ifndef GLUT_BUILDING_LIB
-static void GLUTAPIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
-#define glutInit glutInit_ATEXIT_HACK
+#define glutInit(__argcp, __argv) __glutInitWithExit(__argcp, __argv, exit)
 #endif
 #endif
 GLUTAPI void GLUTAPIENTRY glutInitDisplayMode(unsigned int mode);
@@ -556,8 +468,7 @@ GLUTAPI int GLUTAPIENTRY glutCreateWindow(const char *title);
 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
 GLUTAPI int GLUTAPIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
 #ifndef GLUT_BUILDING_LIB
-static int GLUTAPIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
-#define glutCreateWindow glutCreateWindow_ATEXIT_HACK
+#define glutCreateWindow(__title) __glutCreateWindowWithExit(__title, exit)
 #endif
 #endif
 GLUTAPI int GLUTAPIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
@@ -602,8 +513,7 @@ GLUTAPI int GLUTAPIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
 #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
 GLUTAPI int GLUTAPIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
 #ifndef GLUT_BUILDING_LIB
-static int GLUTAPIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
-#define glutCreateMenu glutCreateMenu_ATEXIT_HACK
+#define glutCreateMenu(__func) __glutCreateMenuWithExit(__func, exit)
 #endif
 #endif
 GLUTAPI void GLUTAPIENTRY glutDestroyMenu(int menu);