added Solaris support

git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@154 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
ikits 2003-10-27 05:28:55 +00:00
parent a17580e044
commit 412814404b
9 changed files with 54 additions and 32 deletions

View File

@ -1,4 +1,4 @@
#! gmake #!gmake
## The OpenGL Extension Wrangler Library ## The OpenGL Extension Wrangler Library
## Copyright (C) 2003, 2002, Milan Ikits <milan.ikits@ieee.org> ## Copyright (C) 2003, 2002, Milan Ikits <milan.ikits@ieee.org>
## Copyright (C) 2003, 2002, Marcelo E. Magallon <mmagallo@debian.org> ## Copyright (C) 2003, 2002, Marcelo E. Magallon <mmagallo@debian.org>
@ -41,7 +41,6 @@ TARBALL = ../glew_$(GLEW_VERSION).tar.gz
SHELL = /bin/sh SHELL = /bin/sh
SYSTEM = $(strip $(shell uname -s)) SYSTEM = $(strip $(shell uname -s))
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Cygwin # Cygwin
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
@ -53,10 +52,9 @@ CFLAGS.EXTRA = -DGLEW_STATIC
LDFLAGS.SO = -shared -soname $(LIB.SONAME) LDFLAGS.SO = -shared -soname $(LIB.SONAME)
LDFLAGS.GL = -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.GL = -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32
LDFLAGS.EXTRA = LDFLAGS.EXTRA =
WARN = -Wall -W WARN = -Wall -W
POPT = -O2
BIN.SUFFIX = .exe BIN.SUFFIX = .exe
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR) LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION) LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
@ -76,6 +74,7 @@ LDFLAGS.EXTRA = -L/usr/X11R6/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11 LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
NAME = GLEW NAME = GLEW
WARN = -Wall -W WARN = -Wall -W
POPT = -O2
BIN.SUFFIX = BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR) LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so LIB.DEVLNK = lib$(NAME).so
@ -99,6 +98,7 @@ LDFLAGS.EXTRA =
LDFLAGS.GL = -lGL -lXext -lX11 LDFLAGS.GL = -lGL -lXext -lX11
NAME = GLEW NAME = GLEW
WARN = -fullwarn -woff 1110,1498 WARN = -fullwarn -woff 1110,1498
POPT = -O2
BIN.SUFFIX = BIN.SUFFIX =
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR) LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so LIB.DEVLNK = lib$(NAME).so
@ -125,11 +125,32 @@ endif
NAME = GLEW NAME = GLEW
BIN.SUFFIX = BIN.SUFFIX =
WARN = -Wall -W WARN = -Wall -W
POPT = -O2
LIB.SONAME = lib$(NAME).$(GLEW_MAJOR).dylib LIB.SONAME = lib$(NAME).$(GLEW_MAJOR).dylib
LIB.DEVLNK = lib$(NAME).dylib LIB.DEVLNK = lib$(NAME).dylib
LIB.SHARED = lib$(NAME).$(GLEW_VERSION).dylib LIB.SHARED = lib$(NAME).$(GLEW_VERSION).dylib
LIB.STATIC = lib$(NAME).a LIB.STATIC = lib$(NAME).a
else
# ----------------------------------------------------------------------------
# Solaris
# ----------------------------------------------------------------------------
ifeq ($(patsubst SunOS%,SunOS,$(SYSTEM)), SunOS)
NAME = GLEW
CC = cc
LD = ld
CFLAGS.EXTRA = -I/usr/openwin/include
LDFLAGS.SO = -shared
LDFLAGS.EXTRA = -L/usr/openwin/lib
LDFLAGS.GL = -lXmu -lXi -lGLU -lGL -lXext -lX11
NAME = GLEW
BIN.SUFFIX =
WARN =
POPT = -xO2
LIB.SONAME = lib$(NAME).so.$(GLEW_MAJOR)
LIB.DEVLNK = lib$(NAME).so
LIB.SHARED = lib$(NAME).so.$(GLEW_VERSION)
LIB.STATIC = lib$(NAME).a
else else
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
$(error "Platform '$(SYSTEM)' not supported") $(error "Platform '$(SYSTEM)' not supported")
@ -137,6 +158,7 @@ endif
endif endif
endif endif
endif endif
endif
AR = ar AR = ar
INSTALL = install INSTALL = install
@ -146,7 +168,7 @@ ifeq ($(MAKECMDGOALS), debug)
OPT = -g OPT = -g
STRIP = STRIP =
else else
OPT = -O2 OPT = $(POPT)
STRIP = -s STRIP = -s
endif endif
INCLUDE = -Iinclude INCLUDE = -Iinclude

View File

@ -18,7 +18,7 @@ do 'bin/make.pl';
sub make_pfn_info($%) sub make_pfn_info($%)
{ {
my $name = prefixname($_[0]); my $name = prefixname($_[0]);
return " glewInfoFunc(\"$_[0]\", $name == NULL);"; return " glewInfoFunc((const GLubyte*)\"$_[0]\", $name == NULL);";
} }
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------
@ -48,12 +48,12 @@ foreach my $ext (sort @extlist)
print "static void _glewInfo_$extname (void)\n{\n"; print "static void _glewInfo_$extname (void)\n{\n";
if ($extvar =~ /VERSION/) if ($extvar =~ /VERSION/)
{ {
print " glewPrintExt(\"$extname\", $extvar, $extvar);\n"; print " glewPrintExt((const GLubyte*)\"$extname\", $extvar, $extvar);\n";
} }
else else
{ {
print " glewPrintExt(\"$extname\", $extvar, $extpre" . print " glewPrintExt((const GLubyte*)\"$extname\", $extvar, $extpre" .
"ewGetExtension(\"$extname\"));\n"; "ewGetExtension((const GLubyte*)\"$extname\"));\n";
} }
output_decls($functions, \&make_pfn_info); output_decls($functions, \&make_pfn_info);
print "}\n\n"; print "}\n\n";

View File

@ -24,7 +24,7 @@ sub make_pfn_def($%)
sub make_init_call($%) sub make_init_call($%)
{ {
my $name = prefixname($_[0]); my $name = prefixname($_[0]);
return " r = r || (" . $name . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress(\"" . $name . "\")) == NULL;"; return " r = r || (" . $name . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $name . "\")) == NULL;";
} }
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------

View File

@ -24,7 +24,7 @@ sub make_pfn_def($%)
sub make_pfn_def_init($%) sub make_pfn_def_init($%)
{ {
my $name = prefixname($_[0]); my $name = prefixname($_[0]);
return " r = ((" . $name . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress(\"" . $_[0] . "\")) == NULL) || r;"; return " r = ((" . $name . " = (PFN" . (uc $_[0]) . "PROC)glewGetProcAddress((const GLubyte*)\"" . $_[0] . "\")) == NULL) || r;";
} }
#--------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------

View File

@ -51,7 +51,7 @@ foreach my $ext (sort @extlist)
$extpre =~ s/^(W?)GL(X?).*$/\l$1gl\l$2ew/; $extpre =~ s/^(W?)GL(X?).*$/\l$1gl\l$2ew/;
print "#ifdef $extname\n"; print "#ifdef $extname\n";
print " $extvar = " . $extpre . "GetExtension(\"$extname\");\n"; print " $extvar = " . $extpre . "GetExtension((const GLubyte*)\"$extname\");\n";
if (keys %$functions) if (keys %$functions)
{ {
if ($extname =~ /WGL_.*/) if ($extname =~ /WGL_.*/)

View File

@ -75,7 +75,7 @@ my %typemap = (
); );
my %voidtypemap = ( my %voidtypemap = (
void => "GLvoid ", void => "GLvoid",
); );
my %taboo_tokens = ( my %taboo_tokens = (

View File

@ -9,11 +9,11 @@ const GLubyte* glewGetErrorString (GLenum error)
{ {
static const GLubyte* _glewErrorString[] = static const GLubyte* _glewErrorString[] =
{ {
"No error", (const GLubyte*)"No error",
"Missing GL version", (const GLubyte*)"Missing GL version",
"GL 1.1 and up are not supported", (const GLubyte*)"GL 1.1 and up are not supported",
"GLX 1.2 and up are not supported", (const GLubyte*)"GLX 1.2 and up are not supported",
"Unknown error" (const GLubyte*)"Unknown error"
}; };
const int max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1; const int max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1;
return _glewErrorString[(int)error > max_error ? max_error : (int)error]; return _glewErrorString[(int)error > max_error ? max_error : (int)error];
@ -23,8 +23,8 @@ const GLubyte* glewGetString (GLenum name)
{ {
static const GLubyte* _glewString[] = static const GLubyte* _glewString[] =
{ {
NULL, (const GLubyte*)NULL,
"GLEW_VERSION_STRING" (const GLubyte*)"GLEW_VERSION_STRING"
}; };
const int max_string = sizeof(_glewString)/sizeof(*_glewString) - 1; const int max_string = sizeof(_glewString)/sizeof(*_glewString) - 1;
return _glewString[(int)name > max_string ? 0 : (int)name]; return _glewString[(int)name > max_string ? 0 : (int)name];

View File

@ -42,7 +42,7 @@
# if defined(__APPLE__) # if defined(__APPLE__)
# define glewGetProcAddress(name) NSGLGetProcAddress(name) # define glewGetProcAddress(name) NSGLGetProcAddress(name)
# else # else
# if defined(__sgi) # if defined(__sgi) || defined(__sun)
# define glewGetProcAddress(name) dlGetProcAddress(name) # define glewGetProcAddress(name) dlGetProcAddress(name)
# else /* __linux */ # else /* __linux */
# define glewGetProcAddress(name) (*glXGetProcAddressARB)(name) # define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
@ -55,13 +55,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
static void* NSGLGetProcAddress (const char* name) static void *NSGLGetProcAddress (const GLubyte *name)
{ {
NSSymbol symbol; NSSymbol symbol;
char* symbolName; char *symbolName;
/* prepend a '_' for the Unix C symbol mangling convention */ /* prepend a '_' for the Unix C symbol mangling convention */
symbolName = malloc(strlen(name) + 2); symbolName = malloc(strlen((const char *)name) + 2);
strcpy(symbolName+1, name); strcpy(symbolName+1, (const char *)name);
symbolName[0] = '_'; symbolName[0] = '_';
symbol = NULL; symbol = NULL;
if (NSIsSymbolNameDefined(symbolName)) if (NSIsSymbolNameDefined(symbolName))
@ -71,14 +71,14 @@ static void* NSGLGetProcAddress (const char* name)
} }
#endif /* __APPLE__ */ #endif /* __APPLE__ */
#if defined(__sgi) #if defined(__sgi) || defined (__sun)
#include <dlfcn.h> #include <dlfcn.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
static void* dlGetProcAddress (const char* name) static void *dlGetProcAddress (const GLubyte* name)
{ {
static void* h = NULL; static void *h = NULL;
static void *gpa; static void *gpa;
if (h == NULL) if (h == NULL)
@ -88,11 +88,11 @@ static void* dlGetProcAddress (const char* name)
} }
if (gpa != NULL) if (gpa != NULL)
return ((void* (*)(const GLubyte*))gpa)((const GLubyte*)name); return ((void *(*)(const GLubyte *))gpa)(name);
else else
return dlsym(h, name); return dlsym(h, (const char *)name);
} }
#endif /* __sgi */ #endif /* __sgi || __sun */
/* ----------------------------- GL_VERSION_1_1 ---------------------------- */ /* ----------------------------- GL_VERSION_1_1 ---------------------------- */

View File

@ -75,7 +75,7 @@ static void glewInfoFunc (const GLubyte* name, GLint undefined)
static void _glewInfo_GL_VERSION_1_1 (void) static void _glewInfo_GL_VERSION_1_1 (void)
{ {
glewPrintExt("GL_VERSION_1_1", GLEW_VERSION_1_1, GLEW_VERSION_1_1); glewPrintExt((const GLubyte*)"GL_VERSION_1_1", GLEW_VERSION_1_1, GLEW_VERSION_1_1);
} }
#endif /* GL_VERSION_1_1 */ #endif /* GL_VERSION_1_1 */