*** empty log message ***

This commit is contained in:
Elias Naur 2003-09-07 16:11:15 +00:00
parent 7886c80c9a
commit 8b947a575f
8 changed files with 125 additions and 139 deletions

View File

@ -2,5 +2,5 @@ SUBDIRS = common @native_build_dir@
lib_LTLIBRARIES = liblwjgl.la lib_LTLIBRARIES = liblwjgl.la
liblwjgl_la_SOURCES = liblwjgl_la_SOURCES =
liblwjgl_la_LIBADD = common/libcommon.la linux/liblinux.la liblwjgl_la_LIBADD = common/libcommon.la @native_build_dir@/libnative.la
liblwjgl_la_DEPENDENCIES = common/libcommon.la linux/liblinux.la liblwjgl_la_DEPENDENCIES = common/libcommon.la @native_build_dir@/libnative.la

View File

@ -1,5 +1,4 @@
aclocal aclocal
autoheader autoheader
#libtoolize --automake
automake --foreign --include-deps --add-missing --copy automake --foreign --include-deps --add-missing --copy
autoconf autoconf

View File

@ -127,7 +127,7 @@ HMODULE handleOAL;
#ifdef _X11 #ifdef _X11
void* handleOAL; void* handleOAL;
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
OSStatus oalInitEntryPoints (void); OSStatus oalInitEntryPoints (void);
void oalDellocEntryPoints (void); void oalDellocEntryPoints (void);
@ -165,7 +165,7 @@ void* GetFunctionPointer(const char* function) {
#ifdef _X11 #ifdef _X11
return dlsym(handleOAL, function); return dlsym(handleOAL, function);
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
return CFBundleGetFunctionPointerForName (handleOAL,CFStringCreateWithCStringNoCopy (NULL, function, CFStringGetSystemEncoding (), NULL)); return CFBundleGetFunctionPointerForName (handleOAL,CFStringCreateWithCStringNoCopy (NULL, function, CFStringGetSystemEncoding (), NULL));
#endif #endif
} }
@ -191,7 +191,7 @@ void LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) {
#ifdef _X11 #ifdef _X11
handleOAL = dlopen(path_str, RTLD_LAZY); handleOAL = dlopen(path_str, RTLD_LAZY);
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
// NOTE: This totally ignores the input array! - SWP // NOTE: This totally ignores the input array! - SWP
oalInitEntryPoints(); oalInitEntryPoints();
#endif #endif
@ -215,7 +215,7 @@ void UnLoadOpenAL() {
#ifdef _X11 #ifdef _X11
dlclose(handleOAL); dlclose(handleOAL);
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
oalDellocEntryPoints(); oalDellocEntryPoints();
#endif #endif
} }
@ -431,7 +431,7 @@ int LoadALExtensions() {
return JNI_TRUE; return JNI_TRUE;
} }
#ifdef TARGET_OS_MAC #ifdef _AGL
// ------------------------- // -------------------------
OSStatus oalInitEntryPoints (void) OSStatus oalInitEntryPoints (void)
{ {

View File

@ -61,12 +61,11 @@ extern "C" {
#define ALCAPIENTRY __cdecl #define ALCAPIENTRY __cdecl
#else #else
#ifdef TARGET_OS_MAC #ifdef _AGL
#if TARGET_OS_MAC #if _AGL
typedef struct ALCdevice_struct ALCdevice; typedef struct ALCdevice_struct ALCdevice;
typedef struct ALCcontext_struct ALCcontext; typedef struct ALCcontext_struct ALCcontext;
#pragma export on
#endif #endif
#endif #endif
#define ALCAPI #define ALCAPI
@ -116,11 +115,6 @@ typedef void ALCvoid;
#define ALAPIENTRY __cdecl #define ALAPIENTRY __cdecl
#define AL_CALLBACK #define AL_CALLBACK
#else #else
#ifdef TARGET_OS_MAC
#if TARGET_OS_MAC
#pragma export on
#endif
#endif
#define ALAPI #define ALAPI
#define ALAPIENTRY #define ALAPIENTRY
#define AL_CALLBACK #define AL_CALLBACK

View File

@ -774,9 +774,9 @@ glXAllocateMemoryNVPROC glXAllocateMemoryNV = NULL;
glXFreeMemoryNVPROC glXFreeMemoryNV = NULL; glXFreeMemoryNVPROC glXFreeMemoryNV = NULL;
#endif /* X11 */ #endif /* X11 */
#ifdef TARGET_OS_MAC #ifdef _AGL
// TODO: find the OSX equivalent of these functions // TODO: find the OSX equivalent of these functions
#endif /* TARGET_OS_MAC */ #endif /* _AGL */
#endif /* GL_NV_vertex_array_range */ #endif /* GL_NV_vertex_array_range */
@ -1359,10 +1359,93 @@ void * lib_gl_handle = NULL;
void * lib_glu_handle = NULL; void * lib_glu_handle = NULL;
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
// Note: Not used, there is a CFBundleRef in the header file that handles the CFBundleRef gBundleRefOpenGL = NULL;
// dynamic load from the GL Framework bundle and this framework include gl #endif
// and glu in the same library
#ifdef _AGL
// -------------------------
OSStatus aglInitEntryPoints (void)
{
OSStatus err = noErr;
const Str255 frameworkName = "\pOpenGL.framework";
FSRefParam fileRefParam;
FSRef fileRef;
CFURLRef bundleURLOpenGL;
memset(&fileRefParam, 0, sizeof(fileRefParam));
memset(&fileRef, 0, sizeof(fileRef));
fileRefParam.ioNamePtr = frameworkName;
fileRefParam.newRef = &fileRef;
// Frameworks directory/folder
//
err = FindFolder (kSystemDomain, kFrameworksFolderType, false, &fileRefParam.ioVRefNum, &fileRefParam.ioDirID);
if (noErr != err)
{
DebugStr ("\pCould not find frameworks folder");
return err;
}
// make FSRef for folder
//
err = PBMakeFSRefSync (&fileRefParam);
if (noErr != err)
{
DebugStr ("\pCould make FSref to frameworks folder");
return err;
}
// create URL to folder
//
bundleURLOpenGL = CFURLCreateFromFSRef (kCFAllocatorDefault, &fileRef);
if (!bundleURLOpenGL)
{
DebugStr ("\pCould create OpenGL Framework bundle URL");
return paramErr;
}
// create ref to GL's bundle
//
gBundleRefOpenGL = CFBundleCreate (kCFAllocatorDefault,bundleURLOpenGL);
if (!gBundleRefOpenGL)
{
DebugStr ("\pCould not create OpenGL Framework bundle");
return paramErr;
}
// release created bundle
//
CFRelease (bundleURLOpenGL);
// if the code was successfully loaded, look for our function.
if (!CFBundleLoadExecutable (gBundleRefOpenGL))
{
DebugStr ("\pCould not load MachO executable");
return paramErr;
}
return err;
}
static void aglDellocEntryPoints (void)
{
if (gBundleRefOpenGL != NULL)
{
// unload the bundle's code.
CFBundleUnloadExecutable (gBundleRefOpenGL);
CFRelease (gBundleRefOpenGL);
gBundleRefOpenGL = NULL;
}
}
static void * aglGetProcAddress (char * pszProc)
{
return CFBundleGetFunctionPointerForName (gBundleRefOpenGL,CFStringCreateWithCStringNoCopy (NULL, pszProc, CFStringGetSystemEncoding (), NULL));
}
#endif #endif
/* getProcAddress */ /* getProcAddress */
@ -1400,7 +1483,7 @@ static void *extgl_GetProcAddress(char *name)
return t; return t;
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
void *t =(void *)aglGetProcAddress(name); void *t =(void *)aglGetProcAddress(name);
return t; return t;
@ -1560,7 +1643,7 @@ static int extgl_InitializeWGL()
/*-----------------------------------------------------*/ /*-----------------------------------------------------*/
/* AGL stuff BEGIN*/ /* AGL stuff BEGIN*/
/*-----------------------------------------------------*/ /*-----------------------------------------------------*/
#ifdef TARGET_OS_MAC #ifdef _AGL
static int extgl_InitializeAGL() static int extgl_InitializeAGL()
{ {
@ -3286,7 +3369,7 @@ int extgl_Initialize()
extgl_InitializeWGL(); extgl_InitializeWGL();
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
/* load AGL extensions */ /* load AGL extensions */
extgl_InitializeAGL(); extgl_InitializeAGL();
#endif #endif
@ -3331,7 +3414,7 @@ int extgl_Open(void)
} }
#endif /* WIN32 */ #endif /* WIN32 */
#ifdef TARGET_OS_MAC #ifdef _AGL
int extgl_Open(void) int extgl_Open(void)
{ {
OSStatus err = aglInitEntryPoints(); OSStatus err = aglInitEntryPoints();
@ -3347,7 +3430,7 @@ int extgl_Open(void)
// //
return 0; return 0;
} }
#endif /* TARGET_OS_MAC */ #endif /* _AGL */
void extgl_Close(void) void extgl_Close(void)
{ {
@ -3359,97 +3442,11 @@ void extgl_Close(void)
FreeLibrary(lib_gl_handle); FreeLibrary(lib_gl_handle);
FreeLibrary(lib_glu_handle); FreeLibrary(lib_glu_handle);
#endif #endif
#ifdef TARGET_OS_MAC #ifdef _AGL
aglDellocEntryPoints(); aglDellocEntryPoints();
#endif #endif
} }
#ifdef TARGET_OS_MAC
CFBundleRef gBundleRefOpenGL = NULL;
// -------------------------
OSStatus aglInitEntryPoints (void)
{
OSStatus err = noErr;
const Str255 frameworkName = "\pOpenGL.framework";
FSRefParam fileRefParam;
FSRef fileRef;
CFURLRef bundleURLOpenGL;
memset(&fileRefParam, 0, sizeof(fileRefParam));
memset(&fileRef, 0, sizeof(fileRef));
fileRefParam.ioNamePtr = frameworkName;
fileRefParam.newRef = &fileRef;
// Frameworks directory/folder
//
err = FindFolder (kSystemDomain, kFrameworksFolderType, false, &fileRefParam.ioVRefNum, &fileRefParam.ioDirID);
if (noErr != err)
{
DebugStr ("\pCould not find frameworks folder");
return err;
}
// make FSRef for folder
//
err = PBMakeFSRefSync (&fileRefParam);
if (noErr != err)
{
DebugStr ("\pCould make FSref to frameworks folder");
return err;
}
// create URL to folder
//
bundleURLOpenGL = CFURLCreateFromFSRef (kCFAllocatorDefault, &fileRef);
if (!bundleURLOpenGL)
{
DebugStr ("\pCould create OpenGL Framework bundle URL");
return paramErr;
}
// create ref to GL's bundle
//
gBundleRefOpenGL = CFBundleCreate (kCFAllocatorDefault,bundleURLOpenGL);
if (!gBundleRefOpenGL)
{
DebugStr ("\pCould not create OpenGL Framework bundle");
return paramErr;
}
// release created bundle
//
CFRelease (bundleURLOpenGL);
// if the code was successfully loaded, look for our function.
if (!CFBundleLoadExecutable (gBundleRefOpenGL))
{
DebugStr ("\pCould not load MachO executable");
return paramErr;
}
return err;
}
static void aglDellocEntryPoints (void)
{
if (gBundleRefOpenGL != NULL)
{
// unload the bundle's code.
CFBundleUnloadExecutable (gBundleRefOpenGL);
CFRelease (gBundleRefOpenGL);
gBundleRefOpenGL = NULL;
}
}
static void * aglGetProcAddress (char * pszProc)
{
return CFBundleGetFunctionPointerForName (gBundleRefOpenGL,CFStringCreateWithCStringNoCopy (NULL, pszProc, CFStringGetSystemEncoding (), NULL));
}
#endif
/* turn on the warning for the borland compiler*/ /* turn on the warning for the borland compiler*/
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma warn .8064 #pragma warn .8064

View File

@ -324,7 +324,7 @@ extern glXQueryExtensionsStringPROC glXQueryExtensionsString;
#endif /* X11 */ #endif /* X11 */
#ifdef TARGET_OS_MAC #ifdef _AGL
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#include <OpenGL/gliContext.h> #include <OpenGL/gliContext.h>
#include <OpenGL/gliDispatch.h> #include <OpenGL/gliDispatch.h>
@ -337,10 +337,10 @@ typedef struct __AGLContextRec *AGLContext;
typedef GDHandle AGLDevice; typedef GDHandle AGLDevice;
typedef CGrafPtr AGLDrawable; typedef CGrafPtr AGLDrawable;
OSStatus aglInitEntryPoints(void); /*OSStatus aglInitEntryPoints(void);
void aglDellocEntryPoints (void); void aglDellocEntryPoints (void);
void * aglGetProcAddress (char * pszProc); void * aglGetProcAddress (char * pszProc);
*/
typedef AGLPixelFormat (APIENTRY * aglChoosePixelFormatEXTPROC)(const AGLDevice *gdevs, GLint ndev, const GLint *attribs); typedef AGLPixelFormat (APIENTRY * aglChoosePixelFormatEXTPROC)(const AGLDevice *gdevs, GLint ndev, const GLint *attribs);
typedef void (APIENTRY * aglDestroyPixelFormatEXTPROC)(AGLPixelFormat pix); typedef void (APIENTRY * aglDestroyPixelFormatEXTPROC)(AGLPixelFormat pix);
typedef AGLPixelFormat (APIENTRY * aglNextPixelFormatEXTPROC)(AGLPixelFormat pix); typedef AGLPixelFormat (APIENTRY * aglNextPixelFormatEXTPROC)(AGLPixelFormat pix);
@ -593,7 +593,7 @@ extern aglSurfaceTextureEXTPROC aglSurfaceTexture;
/************************************************************************/ /************************************************************************/
#endif /* TARGET_OS_MAC */ #endif /* _AGL */
/*************************************************************/ /*************************************************************/
/* GLU functions */ /* GLU functions */
@ -5829,11 +5829,11 @@ struct GLXExtensionTypes
}; };
#endif /* X11 */ #endif /* X11 */
#ifdef TARGET_OS_MAC #ifdef _AGL
struct AGLExtensionTypes struct AGLExtensionTypes
{ {
}; };
#endif /* TARGET_OS_MAC */ #endif /* _AGL */
struct GLUExtensionTypes struct GLUExtensionTypes
{ {
@ -5851,9 +5851,9 @@ struct ExtensionTypes
#ifdef _X11 #ifdef _X11
struct GLXExtensionTypes glx; struct GLXExtensionTypes glx;
#endif /* X11 */ #endif /* X11 */
#ifdef TARGET_OS_MAC #ifdef _AGL
struct AGLExtensionTypes agl; struct AGLExtensionTypes agl;
#endif /* TARGET_OS_MAC */ #endif /* _AGL */
struct GLUExtensionTypes glu; struct GLUExtensionTypes glu;
int ARB_imaging; int ARB_imaging;
@ -5951,19 +5951,11 @@ extern struct ExtensionTypes extgl_Extensions;
/* initializes everything, call this right after the rc is created. the function returns 0 if successful */ /* initializes everything, call this right after the rc is created. the function returns 0 if successful */
int extgl_Initialize(); int extgl_Initialize();
int extgl_Open(void);
#ifdef _X11 #ifdef _X11
int extgl_Open(void);
int extgl_InitGLX(Display *disp, int screen); int extgl_InitGLX(Display *disp, int screen);
#endif #endif
#ifdef _WIN32
int extgl_Open(void);
#endif
#ifdef TARGET_OS_MAC
int extgl_Open(void);
#endif
void extgl_Close(void); void extgl_Close(void);
int glInitialize(); /* deprecated, please do not use */ int glInitialize(); /* deprecated, please do not use */

View File

@ -31,16 +31,17 @@ AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
case "$host_os" in case "$host_os" in
darwin*) _BUILD_FLAGS="-D_AGL" darwin*) _BUILD_FLAGS="-D_AGL -fpascal-strings -I/Library/Frameworks/OpenAL.framework/Headers"
AC_CHECK_HEADERS([altypes.h alctypes.h],, AC_MSG_ERROR([OpenAL headers required1])) AC_CHECK_HEADER([/Library/Frameworks/OpenAL.framework/Headers/altypes.h],, AC_MSG_ERROR([OpenAL headers required]))
AC_SUBST(native_build_dir, [macosx]) AC_CHECK_HEADER([/Library/Frameworks/OpenAL.framework/Headers/alctypes.h],, AC_MSG_ERROR([OpenAL headers required]))
NATIVE_BUILD_DIR=macosx
CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS"
CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS"
;; ;;
bsdi* | linux* | solaris*) AC_PATH_XTRA bsdi* | linux* | solaris*) AC_PATH_XTRA
_BUILD_FLAGS="-pthread -D_X11 $X_CFLAGS" _BUILD_FLAGS="-pthread -D_X11 $X_CFLAGS"
AC_CHECK_HEADERS([AL/altypes.h AL/alctypes.h],, AC_MSG_ERROR([OpenAL headers required])) AC_CHECK_HEADERS([AL/altypes.h AL/alctypes.h],, AC_MSG_ERROR([OpenAL headers required]))
AC_SUBST(native_build_dir, [linux]) NATIVE_BUILD_DIR=linux
CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS"
CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS"
LIBS="$LIBS $X_LIBS" LIBS="$LIBS $X_LIBS"
@ -50,9 +51,11 @@ case "$host_os" in
AC_CHECK_LIB(pthread, pthread_create,, AC_MSG_ERROR(pthread is required)) AC_CHECK_LIB(pthread, pthread_create,, AC_MSG_ERROR(pthread is required))
;; ;;
*) AC_MSG_ERROR([Unknown system $host_os]);; *) AC_MSG_ERROR([Unsupported system $host_os]);;
esac esac
AC_SUBST(native_build_dir, [$NATIVE_BUILD_DIR])
# Checks for libraries. # Checks for libraries.
# Checks for header files. # Checks for header files.
@ -79,5 +82,6 @@ AC_CHECK_FUNCS([gettimeofday memset strchr strstr])
AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile
common/Makefile common/Makefile
linux/Makefile]) linux/Makefile
macosx/Makefile])
AC_OUTPUT AC_OUTPUT

View File

@ -1,6 +1,6 @@
noinst_LTLIBRARIES = liblinux.la noinst_LTLIBRARIES = libnative.la
liblinux_la_SOURCES = $(NATIVE) libnative_la_SOURCES = $(NATIVE)
INCLUDES = -I../common INCLUDES = -I../common
NATIVE = \ NATIVE = \